n9router 0.4.21 → 0.4.24

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 (499) hide show
  1. package/app/.next/BUILD_ID +1 -1
  2. package/app/.next/app-path-routes-manifest.json +10 -10
  3. package/app/.next/build-manifest.json +2 -2
  4. package/app/.next/prerender-manifest.json +3 -3
  5. package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  6. package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  7. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  8. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  9. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  10. package/app/.next/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  11. package/app/.next/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  12. package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  13. package/app/.next/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  14. package/app/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  15. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  16. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  17. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +1 -1
  18. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  19. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  20. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  21. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  22. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/combo/[id]/page.js.nft.json +1 -1
  23. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/combo/[id]/page_client-reference-manifest.js +1 -1
  24. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  25. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  26. package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  27. package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  28. package/app/.next/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  29. package/app/.next/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  30. package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  31. package/app/.next/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  32. package/app/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  33. package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  34. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
  35. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  36. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  37. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  38. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  39. package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  40. package/app/.next/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  41. package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  42. package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
  43. package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  44. package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  45. package/app/.next/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  46. package/app/.next/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  47. package/app/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  48. package/app/.next/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  49. package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  50. package/app/.next/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  51. package/app/.next/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  52. package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  53. package/app/.next/server/app/_global-error/page.js.nft.json +1 -1
  54. package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  55. package/app/.next/server/app/_global-error.html +1 -1
  56. package/app/.next/server/app/_global-error.rsc +1 -1
  57. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  58. package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  59. package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  60. package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  61. package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  62. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  63. package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
  64. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  65. package/app/.next/server/app/_not-found.html +1 -1
  66. package/app/.next/server/app/_not-found.rsc +5 -5
  67. package/app/.next/server/app/_not-found.segments/_full.segment.rsc +5 -5
  68. package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  69. package/app/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
  70. package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  71. package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  72. package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  73. package/app/.next/server/app/api/antigravity-ide/route.js.nft.json +1 -1
  74. package/app/.next/server/app/api/antigravity-tools/import/route.js.nft.json +1 -1
  75. package/app/.next/server/app/api/antigravity-tools/import-refresh-tokens/route.js.nft.json +1 -1
  76. package/app/.next/server/app/api/auth/login/route.js.nft.json +1 -1
  77. package/app/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  78. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  79. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  80. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  81. package/app/.next/server/app/api/cli-tools/claude-settings/route.js +2 -2
  82. package/app/.next/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  83. package/app/.next/server/app/api/cli-tools/codex-settings/route.js +2 -2
  84. package/app/.next/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  85. package/app/.next/server/app/api/cli-tools/copilot-settings/route.js +2 -2
  86. package/app/.next/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  87. package/app/.next/server/app/api/cli-tools/droid-settings/route.js +1 -1
  88. package/app/.next/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  89. package/app/.next/server/app/api/cli-tools/hermes-settings/route.js +3 -3
  90. package/app/.next/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  91. package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  92. package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  93. package/app/.next/server/app/api/cli-tools/opencode-settings/route.js +2 -2
  94. package/app/.next/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  95. package/app/.next/server/app/api/cloud/auth/route.js.nft.json +1 -1
  96. package/app/.next/server/app/api/cloud/credentials/update/route.js.nft.json +1 -1
  97. package/app/.next/server/app/api/cloud/model/resolve/route.js.nft.json +1 -1
  98. package/app/.next/server/app/api/cloud/models/alias/route.js.nft.json +1 -1
  99. package/app/.next/server/app/api/combos/[id]/route.js +1 -1
  100. package/app/.next/server/app/api/combos/[id]/route.js.nft.json +1 -1
  101. package/app/.next/server/app/api/combos/route.js.nft.json +1 -1
  102. package/app/.next/server/app/api/health/route.js.nft.json +1 -1
  103. package/app/.next/server/app/api/init/route.js.nft.json +1 -1
  104. package/app/.next/server/app/api/internal/account-health/route.js.nft.json +1 -1
  105. package/app/.next/server/app/api/internal/request-detail/route.js.nft.json +1 -1
  106. package/app/.next/server/app/api/internal/usage/route.js.nft.json +1 -1
  107. package/app/.next/server/app/api/keys/[id]/route.js.nft.json +1 -1
  108. package/app/.next/server/app/api/keys/route.js.nft.json +1 -1
  109. package/app/.next/server/app/api/locale/route.js.nft.json +1 -1
  110. package/app/.next/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  111. package/app/.next/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  112. package/app/.next/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  113. package/app/.next/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  114. package/app/.next/server/app/api/media-providers/tts/voices/route.js +1 -1
  115. package/app/.next/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  116. package/app/.next/server/app/api/models/alias/route.js.nft.json +1 -1
  117. package/app/.next/server/app/api/models/availability/route.js.nft.json +1 -1
  118. package/app/.next/server/app/api/models/custom/route.js.nft.json +1 -1
  119. package/app/.next/server/app/api/models/route.js +1 -1
  120. package/app/.next/server/app/api/models/route.js.nft.json +1 -1
  121. package/app/.next/server/app/api/models/test/route.js.nft.json +1 -1
  122. package/app/.next/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  123. package/app/.next/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  124. package/app/.next/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  125. package/app/.next/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  126. package/app/.next/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  127. package/app/.next/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  128. package/app/.next/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  129. package/app/.next/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  130. package/app/.next/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  131. package/app/.next/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  132. package/app/.next/server/app/api/pricing/route.js.nft.json +1 -1
  133. package/app/.next/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  134. package/app/.next/server/app/api/provider-nodes/route.js.nft.json +1 -1
  135. package/app/.next/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  136. package/app/.next/server/app/api/providers/[id]/models/route.js +1 -1
  137. package/app/.next/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  138. package/app/.next/server/app/api/providers/[id]/route.js.nft.json +1 -1
  139. package/app/.next/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  140. package/app/.next/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  141. package/app/.next/server/app/api/providers/client/route.js +1 -1
  142. package/app/.next/server/app/api/providers/client/route.js.nft.json +1 -1
  143. package/app/.next/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  144. package/app/.next/server/app/api/providers/route.js +1 -1
  145. package/app/.next/server/app/api/providers/route.js.nft.json +1 -1
  146. package/app/.next/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  147. package/app/.next/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  148. package/app/.next/server/app/api/providers/validate/route.js +1 -1
  149. package/app/.next/server/app/api/providers/validate/route.js.nft.json +1 -1
  150. package/app/.next/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  151. package/app/.next/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  152. package/app/.next/server/app/api/proxy-pools/route.js.nft.json +1 -1
  153. package/app/.next/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  154. package/app/.next/server/app/api/settings/database/route.js.nft.json +1 -1
  155. package/app/.next/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  156. package/app/.next/server/app/api/settings/require-login/route.js.nft.json +1 -1
  157. package/app/.next/server/app/api/settings/route.js +1 -1
  158. package/app/.next/server/app/api/settings/route.js.nft.json +1 -1
  159. package/app/.next/server/app/api/shutdown/route.js.nft.json +1 -1
  160. package/app/.next/server/app/api/tags/route.js.nft.json +1 -1
  161. package/app/.next/server/app/api/translator/console-logs/route.js +1 -1
  162. package/app/.next/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  163. package/app/.next/server/app/api/translator/console-logs/stream/route.js +1 -1
  164. package/app/.next/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  165. package/app/.next/server/app/api/translator/load/route.js.nft.json +1 -1
  166. package/app/.next/server/app/api/translator/save/route.js.nft.json +1 -1
  167. package/app/.next/server/app/api/translator/send/route.js +1 -1
  168. package/app/.next/server/app/api/translator/send/route.js.nft.json +1 -1
  169. package/app/.next/server/app/api/translator/translate/route.js +1 -1
  170. package/app/.next/server/app/api/translator/translate/route.js.nft.json +1 -1
  171. package/app/.next/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  172. package/app/.next/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  173. package/app/.next/server/app/api/tunnel/status/route.js.nft.json +1 -1
  174. package/app/.next/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  175. package/app/.next/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  176. package/app/.next/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  177. package/app/.next/server/app/api/tunnel/tailscale-install/route.js +2 -2
  178. package/app/.next/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  179. package/app/.next/server/app/api/tunnel/tailscale-login/route.js.nft.json +1 -1
  180. package/app/.next/server/app/api/tunnel/tailscale-start-daemon/route.js +1 -1
  181. package/app/.next/server/app/api/tunnel/tailscale-start-daemon/route.js.nft.json +1 -1
  182. package/app/.next/server/app/api/usage/[connectionId]/route.js +1 -1
  183. package/app/.next/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  184. package/app/.next/server/app/api/usage/chart/route.js.nft.json +1 -1
  185. package/app/.next/server/app/api/usage/history/route.js.nft.json +1 -1
  186. package/app/.next/server/app/api/usage/logs/route.js.nft.json +1 -1
  187. package/app/.next/server/app/api/usage/providers/route.js +1 -1
  188. package/app/.next/server/app/api/usage/providers/route.js.nft.json +1 -1
  189. package/app/.next/server/app/api/usage/request-details/route.js.nft.json +1 -1
  190. package/app/.next/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  191. package/app/.next/server/app/api/usage/stats/route.js.nft.json +1 -1
  192. package/app/.next/server/app/api/usage/stream/route.js.nft.json +1 -1
  193. package/app/.next/server/app/api/v1/api/chat/route.js +1 -1
  194. package/app/.next/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  195. package/app/.next/server/app/api/v1/audio/speech/route.js +1 -1
  196. package/app/.next/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  197. package/app/.next/server/app/api/v1/chat/completions/route.js +1 -1
  198. package/app/.next/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  199. package/app/.next/server/app/api/v1/embeddings/route.js +1 -1
  200. package/app/.next/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  201. package/app/.next/server/app/api/v1/images/generations/route.js +2 -2
  202. package/app/.next/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  203. package/app/.next/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  204. package/app/.next/server/app/api/v1/messages/route.js +1 -1
  205. package/app/.next/server/app/api/v1/messages/route.js.nft.json +1 -1
  206. package/app/.next/server/app/api/v1/models/route.js.nft.json +1 -1
  207. package/app/.next/server/app/api/v1/responses/compact/route.js +1 -1
  208. package/app/.next/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  209. package/app/.next/server/app/api/v1/responses/route.js +1 -1
  210. package/app/.next/server/app/api/v1/responses/route.js.nft.json +1 -1
  211. package/app/.next/server/app/api/v1/route.js.nft.json +1 -1
  212. package/app/.next/server/app/api/v1/search/route.js +1 -1
  213. package/app/.next/server/app/api/v1/search/route.js.nft.json +1 -1
  214. package/app/.next/server/app/api/v1/web/fetch/route.js +1 -1
  215. package/app/.next/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  216. package/app/.next/server/app/api/v1beta/models/[...path]/route.js +1 -1
  217. package/app/.next/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  218. package/app/.next/server/app/api/v1beta/models/route.js.nft.json +1 -1
  219. package/app/.next/server/app/api/version/route.js +1 -1
  220. package/app/.next/server/app/api/version/route.js.nft.json +1 -1
  221. package/app/.next/server/app/api/version/update/route.js +1 -1
  222. package/app/.next/server/app/api/version/update/route.js.nft.json +1 -1
  223. package/app/.next/server/app/callback/page.js.nft.json +1 -1
  224. package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  225. package/app/.next/server/app/callback.html +1 -1
  226. package/app/.next/server/app/callback.rsc +5 -5
  227. package/app/.next/server/app/callback.segments/_full.segment.rsc +5 -5
  228. package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
  229. package/app/.next/server/app/callback.segments/_index.segment.rsc +4 -4
  230. package/app/.next/server/app/callback.segments/_tree.segment.rsc +2 -2
  231. package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  232. package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
  233. package/app/.next/server/app/dashboard/basic-chat.html +1 -1
  234. package/app/.next/server/app/dashboard/basic-chat.rsc +7 -7
  235. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  236. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  237. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  238. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  239. package/app/.next/server/app/dashboard/basic-chat.segments/_full.segment.rsc +7 -7
  240. package/app/.next/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  241. package/app/.next/server/app/dashboard/basic-chat.segments/_index.segment.rsc +4 -4
  242. package/app/.next/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
  243. package/app/.next/server/app/dashboard/cli-tools.html +1 -1
  244. package/app/.next/server/app/dashboard/cli-tools.rsc +7 -7
  245. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  246. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  247. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  248. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  249. package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +7 -7
  250. package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  251. package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
  252. package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  253. package/app/.next/server/app/dashboard/combos.html +1 -1
  254. package/app/.next/server/app/dashboard/combos.rsc +7 -7
  255. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  256. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  257. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  258. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  259. package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +7 -7
  260. package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  261. package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
  262. package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  263. package/app/.next/server/app/dashboard/endpoint.html +1 -1
  264. package/app/.next/server/app/dashboard/endpoint.rsc +7 -7
  265. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  266. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  267. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  268. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  269. package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +7 -7
  270. package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  271. package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
  272. package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  273. package/app/.next/server/app/dashboard/media-providers/web.html +1 -1
  274. package/app/.next/server/app/dashboard/media-providers/web.rsc +7 -7
  275. package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  276. package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
  277. package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
  278. package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  279. package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  280. package/app/.next/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +7 -7
  281. package/app/.next/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
  282. package/app/.next/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +4 -4
  283. package/app/.next/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
  284. package/app/.next/server/app/dashboard/mitm.html +1 -1
  285. package/app/.next/server/app/dashboard/mitm.rsc +7 -7
  286. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  287. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  288. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  289. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  290. package/app/.next/server/app/dashboard/mitm.segments/_full.segment.rsc +7 -7
  291. package/app/.next/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  292. package/app/.next/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
  293. package/app/.next/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  294. package/app/.next/server/app/dashboard/profile.html +1 -1
  295. package/app/.next/server/app/dashboard/profile.rsc +7 -7
  296. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  297. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  298. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  299. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  300. package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +7 -7
  301. package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  302. package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
  303. package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  304. package/app/.next/server/app/dashboard/providers/new.html +1 -1
  305. package/app/.next/server/app/dashboard/providers/new.rsc +7 -7
  306. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  307. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  308. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  309. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  310. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  311. package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +7 -7
  312. package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  313. package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
  314. package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  315. package/app/.next/server/app/dashboard/providers.html +1 -1
  316. package/app/.next/server/app/dashboard/providers.rsc +7 -7
  317. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  318. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  319. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  320. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  321. package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +7 -7
  322. package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  323. package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
  324. package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  325. package/app/.next/server/app/dashboard/proxy-pools.html +1 -1
  326. package/app/.next/server/app/dashboard/proxy-pools.rsc +7 -7
  327. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  328. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  329. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  330. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  331. package/app/.next/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +7 -7
  332. package/app/.next/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  333. package/app/.next/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
  334. package/app/.next/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  335. package/app/.next/server/app/dashboard/quota.html +2 -2
  336. package/app/.next/server/app/dashboard/quota.rsc +8 -8
  337. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  338. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  339. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  340. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  341. package/app/.next/server/app/dashboard/quota.segments/_full.segment.rsc +8 -8
  342. package/app/.next/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  343. package/app/.next/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
  344. package/app/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  345. package/app/.next/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  346. package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  347. package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
  348. package/app/.next/server/app/dashboard/settings/pricing.rsc +5 -5
  349. package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +5 -5
  350. package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  351. package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
  352. package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  353. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  354. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  355. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  356. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  357. package/app/.next/server/app/dashboard/translator.html +1 -1
  358. package/app/.next/server/app/dashboard/translator.rsc +7 -7
  359. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  360. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  361. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  362. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  363. package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +7 -7
  364. package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  365. package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
  366. package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  367. package/app/.next/server/app/dashboard/usage.html +1 -1
  368. package/app/.next/server/app/dashboard/usage.rsc +7 -7
  369. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  370. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  371. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  372. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  373. package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +7 -7
  374. package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  375. package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
  376. package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  377. package/app/.next/server/app/dashboard.html +1 -1
  378. package/app/.next/server/app/dashboard.rsc +7 -7
  379. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  380. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  381. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  382. package/app/.next/server/app/dashboard.segments/_full.segment.rsc +7 -7
  383. package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
  384. package/app/.next/server/app/dashboard.segments/_index.segment.rsc +4 -4
  385. package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  386. package/app/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  387. package/app/.next/server/app/index.html +1 -1
  388. package/app/.next/server/app/index.rsc +5 -5
  389. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  390. package/app/.next/server/app/index.segments/_full.segment.rsc +5 -5
  391. package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
  392. package/app/.next/server/app/index.segments/_index.segment.rsc +4 -4
  393. package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  394. package/app/.next/server/app/landing/page.js.nft.json +1 -1
  395. package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  396. package/app/.next/server/app/landing.html +1 -1
  397. package/app/.next/server/app/landing.rsc +5 -5
  398. package/app/.next/server/app/landing.segments/_full.segment.rsc +5 -5
  399. package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
  400. package/app/.next/server/app/landing.segments/_index.segment.rsc +4 -4
  401. package/app/.next/server/app/landing.segments/_tree.segment.rsc +2 -2
  402. package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  403. package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
  404. package/app/.next/server/app/login/page.js.nft.json +1 -1
  405. package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
  406. package/app/.next/server/app/login.html +1 -1
  407. package/app/.next/server/app/login.rsc +6 -6
  408. package/app/.next/server/app/login.segments/_full.segment.rsc +6 -6
  409. package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
  410. package/app/.next/server/app/login.segments/_index.segment.rsc +4 -4
  411. package/app/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  412. package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  413. package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
  414. package/app/.next/server/app/manifest.webmanifest/route.js +1 -1
  415. package/app/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  416. package/app/.next/server/app/manifest.webmanifest.body +1 -1
  417. package/app/.next/server/app/page.js.nft.json +1 -1
  418. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  419. package/app/.next/server/app-paths-manifest.json +10 -10
  420. package/app/.next/server/chunks/1051.js +1 -0
  421. package/app/.next/server/chunks/318.js +3 -3
  422. package/app/.next/server/chunks/3646.js +1 -1
  423. package/app/.next/server/chunks/412.js +2 -2
  424. package/app/.next/server/chunks/4177.js +1 -0
  425. package/app/.next/server/chunks/4989.js +2 -2
  426. package/app/.next/server/chunks/5681.js +1 -1
  427. package/app/.next/server/chunks/5787.js +3 -3
  428. package/app/.next/server/chunks/{4084.js → 622.js} +2 -2
  429. package/app/.next/server/chunks/6327.js +1 -0
  430. package/app/.next/server/chunks/6555.js +1 -1
  431. package/app/.next/server/chunks/7595.js +1 -1
  432. package/app/.next/server/chunks/7994.js +2 -2
  433. package/app/.next/server/chunks/8590.js +1 -1
  434. package/app/.next/server/chunks/8760.js +1 -1
  435. package/app/.next/server/chunks/8895.js +8 -2
  436. package/app/.next/server/chunks/9489.js +1 -1
  437. package/app/.next/server/chunks/9609.js +1 -1
  438. package/app/.next/server/chunks/9718.js +1 -1
  439. package/app/.next/server/middleware-build-manifest.js +1 -1
  440. package/app/.next/server/middleware.js +1 -1
  441. package/app/.next/server/pages/404.html +1 -1
  442. package/app/.next/server/pages/500.html +1 -1
  443. package/app/.next/server/server-reference-manifest.js +1 -1
  444. package/app/.next/server/server-reference-manifest.json +1 -1
  445. package/app/.next/static/chunks/1321-b2081c642c72002a.js +1 -0
  446. package/app/.next/static/chunks/2589-5e8a0fa7cb3f227d.js +3 -0
  447. package/app/.next/static/chunks/5497-28242e3ae0b31a36.js +7 -0
  448. package/app/.next/static/chunks/6309-ff36cf5344142814.js +23 -0
  449. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-28383c480ec5b127.js +1 -0
  450. package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-85548757b84b3172.js +1 -0
  451. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-88171c9a70b02d07.js → page-b2837760558bde3d.js} +8 -8
  452. package/app/.next/static/chunks/app/(dashboard)/dashboard/mitm/page-f55f0e573440f5e8.js +1 -0
  453. package/app/.next/static/chunks/app/(dashboard)/dashboard/profile/page-d22744b1e72de612.js +1 -0
  454. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-6925a4857ab01924.js +4 -0
  455. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-8dad17b86423b20a.js +1 -0
  456. package/app/.next/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-eb76b6bd9948a29e.js +2 -0
  457. package/app/.next/static/chunks/app/(dashboard)/dashboard/quota/page-efaa6dd8c7eb8a65.js +1 -0
  458. package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-0baabdbcfbf34c07.js +1 -0
  459. package/app/.next/static/css/bcf0d6683b3c65df.css +1 -0
  460. package/app/open-sse/config/providerModels.js +7 -1
  461. package/app/open-sse/config/providers.js +4 -0
  462. package/app/open-sse/executors/antigravity.js +11 -18
  463. package/app/open-sse/handlers/chatCore.js +19 -2
  464. package/app/open-sse/rtk/caveman.js +100 -0
  465. package/app/open-sse/rtk/cavemanPrompts.js +35 -0
  466. package/app/open-sse/services/combo.js +42 -16
  467. package/app/open-sse/services/model.js +2 -0
  468. package/app/open-sse/translator/helpers/claudeHelper.js +8 -0
  469. package/app/open-sse/translator/helpers/openaiHelper.js +9 -2
  470. package/app/open-sse/translator/index.js +1 -9
  471. package/app/open-sse/translator/request/claude-to-openai.js +11 -9
  472. package/app/open-sse/utils/proxyFetch.js +2 -4
  473. package/app/open-sse/utils/streamHelpers.js +2 -2
  474. package/app/package.json +1 -1
  475. package/app/public/providers/xiaomi-mimo.png +0 -0
  476. package/app/src/mitm/handlers/antigravity.js +2 -2
  477. package/app/src/mitm/server.js +11 -11
  478. package/app/src/mitm/usageTracker.js +14 -1
  479. package/app/src/shared/constants/providers.js +35 -34
  480. package/package.json +1 -1
  481. package/app/.next/server/chunks/2549.js +0 -1
  482. package/app/.next/server/chunks/7828.js +0 -1
  483. package/app/.next/server/chunks/8491.js +0 -1
  484. package/app/.next/static/chunks/1321-758994bc249e4966.js +0 -1
  485. package/app/.next/static/chunks/2589-a1b46e66317dffd7.js +0 -3
  486. package/app/.next/static/chunks/5497-dc001333990a942c.js +0 -7
  487. package/app/.next/static/chunks/6309-a7e57611cfcbe5fa.js +0 -23
  488. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-f033f4a266ecfa10.js +0 -1
  489. package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-ba5ac6c8e331e7d3.js +0 -1
  490. package/app/.next/static/chunks/app/(dashboard)/dashboard/mitm/page-e8c6b296929523ee.js +0 -1
  491. package/app/.next/static/chunks/app/(dashboard)/dashboard/profile/page-cf73f6db045a7e2d.js +0 -1
  492. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-1c46f0fe4f131e65.js +0 -4
  493. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-92d99df7ce85fd58.js +0 -1
  494. package/app/.next/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-86caff27d92376bc.js +0 -2
  495. package/app/.next/static/chunks/app/(dashboard)/dashboard/quota/page-751c8e04880cb0d7.js +0 -1
  496. package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-a819f6afc52ee43e.js +0 -1
  497. package/app/.next/static/css/34a45bfcb212973d.css +0 -1
  498. /package/app/.next/static/{wozf5GL2edkjzl9Gac_lV → PSWjQzItQS96mOJ2LNJHi}/_buildManifest.js +0 -0
  499. /package/app/.next/static/{wozf5GL2edkjzl9Gac_lV → PSWjQzItQS96mOJ2LNJHi}/_ssgManifest.js +0 -0
@@ -1,23 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6309],{3534:(e,t,s)=>{s.d(t,{dM:()=>r,wn:()=>a});let a={antigravity:{id:"antigravity",name:"Antigravity",image:"/providers/antigravity.png",color:"#4285F4",description:"Google Antigravity IDE with MITM",configType:"mitm",mitmDomain:"daily-cloudcode-pa.googleapis.com",supportsTokenSwap:!0,tokenSwapProvider:"antigravity",modelAliases:["claude-opus-4-6-thinking","claude-sonnet-4-6","gemini-3-flash","gpt-oss-120b-medium","gemini-3-pro-high","gemini-3-pro-low"],defaultModels:[{id:"gemini-3.1-pro-high",name:"Gemini 3.1 Pro High",alias:"gemini-3.1-pro-high"},{id:"gemini-3.1-pro-low",name:"Gemini 3.1 Pro Low",alias:"gemini-3.1-pro-low"},{id:"gemini-3-flash",name:"Gemini 3 Flash / Default",alias:"gemini-3-flash"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",alias:"claude-sonnet-4-6"},{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking",alias:"claude-opus-4-6-thinking"},{id:"gpt-oss-120b-medium",name:"GPT OSS 120B Medium",alias:"gpt-oss-120b-medium"}]},copilot:{id:"copilot",name:"GitHub Copilot",image:"/providers/copilot.png",color:"#1F6FEB",description:"GitHub Copilot IDE with MITM",configType:"mitm",mitmDomain:"api.individual.githubcopilot.com",modelAliases:["gpt-4o-mini","claude-haiku-4.5","gpt-4o","gpt-5-mini"],defaultModels:[{id:"gpt-4o",name:"GPT-4o",alias:"gpt-4o"},{id:"gpt-4.1",name:"GPT-4.1",alias:"gpt-4.1"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",alias:"claude-haiku-4.5"}]},kiro:{id:"kiro",name:"Kiro",image:"/providers/kiro.png",color:"#FF6B00",description:"Kiro IDE with MITM",configType:"mitm",mitmDomain:"q.us-east-1.amazonaws.com",defaultModels:[{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",alias:"claude-sonnet-4.5"},{id:"claude-sonnet-4",name:"Claude Sonnet 4",alias:"claude-sonnet-4"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",alias:"claude-haiku-4.5"},{id:"deepseek-3.2",name:"DeepSeek 3.2",alias:"deepseek-3.2"},{id:"minimax-m2.1",name:"MiniMax M2.1",alias:"minimax-m2.1"},{id:"simple-task",name:"Qwen3 Coder Next",alias:"simple-task"}]}},r={claude:{id:"claude",name:"Claude Code",icon:"terminal",color:"#D97757",description:"Anthropic Claude Code CLI",configType:"env",envVars:{baseUrl:"ANTHROPIC_BASE_URL",model:"ANTHROPIC_MODEL",opusModel:"ANTHROPIC_DEFAULT_OPUS_MODEL",sonnetModel:"ANTHROPIC_DEFAULT_SONNET_MODEL",haikuModel:"ANTHROPIC_DEFAULT_HAIKU_MODEL"},modelAliases:["default","sonnet","opus","haiku","opusplan"],settingsFile:"~/.claude/settings.json",defaultModels:[{id:"opus",name:"Claude Opus",alias:"opus",envKey:"ANTHROPIC_DEFAULT_OPUS_MODEL",defaultValue:"cc/claude-opus-4-6"},{id:"sonnet",name:"Claude Sonnet",alias:"sonnet",envKey:"ANTHROPIC_DEFAULT_SONNET_MODEL",defaultValue:"cc/claude-sonnet-4-6"},{id:"haiku",name:"Claude Haiku",alias:"haiku",envKey:"ANTHROPIC_DEFAULT_HAIKU_MODEL",defaultValue:"cc/claude-haiku-4-5-20251001"}]},openclaw:{id:"openclaw",name:"Open Claw",image:"/providers/openclaw.png",color:"#FF6B35",description:"Open Claw AI Assistant",configType:"custom"},codex:{id:"codex",name:"OpenAI Codex CLI",image:"/providers/codex.png",color:"#10A37F",description:"OpenAI Codex CLI",configType:"custom"},opencode:{id:"opencode",name:"OpenCode",image:"/providers/opencode.png",color:"#E87040",description:"OpenCode AI Terminal Assistant",configType:"custom"},droid:{id:"droid",name:"Factory Droid",image:"/providers/droid.png",color:"#00D4FF",description:"Factory Droid AI Assistant",configType:"custom"},cursor:{id:"cursor",name:"Cursor",image:"/providers/cursor.png",color:"#000000",description:"Cursor AI Code Editor",configType:"guide",requiresExternalUrl:!0,notes:[{type:"warning",text:"Requires Cursor Pro account to use this feature."},{type:"cloudCheck",text:"Cursor routes requests through its own server, so local endpoint is not supported. Please enable Tunnel or Cloud Endpoint in Settings."}],guideSteps:[{step:1,title:"Open Settings",desc:"Go to Settings → Models"},{step:2,title:"Enable OpenAI API",desc:'Enable "OpenAI API key" option'},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Add Custom Model",desc:'Click "View All Model" → "Add Custom Model"'},{step:6,title:"Select Model",type:"modelSelector"}]},cline:{id:"cline",name:"Cline",image:"/providers/cline.png",color:"#00D1B2",description:"Cline AI Coding Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Cline Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → OpenAI Compatible"},{step:3,title:"Base URL",value:"{{baseUrl}}/v1",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},kilo:{id:"kilo",name:"Kilo Code",image:"/providers/kilocode.png",color:"#FF6B6B",description:"Kilo Code AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Kilo Code Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → OpenAI Compatible"},{step:3,title:"Base URL",value:"{{baseUrl}}/v1",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},roo:{id:"roo",name:"Roo",image:"/providers/roo.png",color:"#FF6B6B",description:"Roo AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Roo Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → Ollama"},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},continue:{id:"continue",name:"Continue",image:"/providers/continue.png",color:"#7C3AED",description:"Continue AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Config",desc:"Open Continue configuration file"},{step:2,title:"API Key",type:"apiKeySelector"},{step:3,title:"Select Model",type:"modelSelector"},{step:4,title:"Add Model Config",desc:"Add the following configuration to your models array:"}],codeBlock:{language:"json",code:`{
2
- "apiBase": "{{baseUrl}}",
3
- "title": "{{model}}",
4
- "model": "{{model}}",
5
- "provider": "openai",
6
- "apiKey": "{{apiKey}}"
7
- }`}},hermes:{id:"hermes",name:"Hermes Agent",image:"/providers/hermes.png",color:"#8B5CF6",description:"Nous Research self-improving AI agent",configType:"custom"}}},16722:(e,t,s)=>{s.d(t,{Tk:()=>o,Ah:()=>d,a7:()=>g,ZM:()=>x,RF:()=>p,gY:()=>U,tA:()=>A,kn:()=>E,yZ:()=>m,qO:()=>C,xm:()=>D});var a=s(95155),r=s(12115),l=s(35497),n=s(5772);let i="https://9router.com";function o({tool:e,isExpanded:t,onToggle:s,activeProviders:d,modelMappings:c,onModelMappingChange:x,baseUrl:m,hasActiveProviders:u,apiKeys:p,cloudEnabled:h,initialStatus:g}){let f,y,b,[j,v]=(0,r.useState)(g||null),[N,w]=(0,r.useState)(!1),[k,C]=(0,r.useState)(!1),[S,A]=(0,r.useState)(!1),[_,E]=(0,r.useState)(null),[$,M]=(0,r.useState)(!1),[T,O]=(0,r.useState)(!1),[R,I]=(0,r.useState)(null),[P,D]=(0,r.useState)(""),[U,z]=(0,r.useState)({}),[L,F]=(0,r.useState)(!1),[K,q]=(0,r.useState)(""),[H,B]=(0,r.useState)(!1),W=(0,r.useRef)(!1),J=(()=>{if(!j?.installed)return null;let e=j.settings?.env?.ANTHROPIC_BASE_URL;if(!e)return"not_configured";let t=e.includes("localhost")||e.includes("127.0.0.1"),s=h&&i&&e.startsWith(i),a=m&&e.startsWith(m);return t||s||a?"configured":"other"})();(0,r.useEffect)(()=>{p?.length>0&&!P&&D(p[0].key)},[p,P]),(0,r.useEffect)(()=>{g&&v(g)},[g]),(0,r.useEffect)(()=>{t&&!j&&(Y(),Z()),t&&Z()},[t]),(0,r.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{B(!!e.ccFilterNaming)}).catch(()=>{})},[]);let G=async e=>{let t=e.target.checked;B(t),await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ccFilterNaming:t})}).catch(()=>{})},Z=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&z(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,r.useEffect)(()=>{if(j?.installed&&!W.current){W.current=!0;let t=j.settings?.env||{};e.defaultModels.forEach(e=>{if(e.envKey){let s=t[e.envKey]||e.defaultValue||"";s&&x(e.alias,s)}});let s=t.ANTHROPIC_AUTH_TOKEN;s&&p?.some(e=>e.key===s)&&D(s)}},[j,p,e.defaultModels,x]);let Y=async()=>{w(!0);try{let e=await fetch("/api/cli-tools/claude-settings"),t=await e.json();v(t)}catch(e){v({installed:!1,error:e.message})}finally{w(!1)}},V=()=>{let e=K||m;return e.endsWith("/v1")?e:`${e}/v1`},Q=async()=>{C(!0),E(null);try{let t={ANTHROPIC_BASE_URL:V()},s=P?.trim()||(p?.length>0?p[0].key:null)||(h?null:"sk_9router");s&&(t.ANTHROPIC_AUTH_TOKEN=s),e.defaultModels.forEach(e=>{let s=c[e.alias];s&&e.envKey&&(t[e.envKey]=s)});let a=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:t})}),r=await a.json();a.ok?(E({type:"success",text:"Settings applied successfully!"}),v(e=>({...e,hasBackup:!0,settings:{...e?.settings,env:t}}))):E({type:"error",text:r.error||"Failed to apply settings"})}catch(e){E({type:"error",text:e.message})}finally{C(!1)}},X=async()=>{A(!0),E(null);try{let t=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),s=await t.json();t.ok?(E({type:"success",text:"Settings reset successfully!"}),e.defaultModels.forEach(e=>x(e.alias,e.defaultValue||"")),D("")):E({type:"error",text:s.error||"Failed to reset settings"})}catch(e){E({type:"error",text:e.message})}finally{A(!1)}};return(0,a.jsxs)(l.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(n.default,{src:"/providers/claude.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===J&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===J&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===J&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[N&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Claude CLI..."})]}),!N&&j&&!j.installed&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude CLI not detected locally"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,a.jsxs)(l.$n,{variant:"secondary",size:"sm",onClick:()=>F(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,a.jsxs)(l.$n,{variant:"outline",size:"sm",onClick:()=>M(!$),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:$?"expand_less":"help"}),$?"Hide":"How to Install"]})]})]}),$&&(0,a.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,a.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,a.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,a.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @anthropic-ai/claude-code"})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,a.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!N&&j?.installed&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[j?.settings?.env?.ANTHROPIC_BASE_URL&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:j.settings.env.ANTHROPIC_BASE_URL})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:(f=K||m).endsWith("/v1")?f:`${f}/v1`,onChange:e=>q(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),K&&K!==m&&(0,a.jsx)("button",{onClick:()=>q(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),p.length>0?(0,a.jsx)("select",{value:P,onChange:e=>D(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:p.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:h?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),e.defaultModels.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:e.name}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:c[e.alias]||"",onChange:t=>x(e.alias,t.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>{I(e.alias),O(!0)},disabled:!u,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${u?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),c[e.alias]&&(0,a.jsx)("button",{onClick:()=>x(e.alias,""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.alias)),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Filter naming"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,a.jsx)("input",{type:"checkbox",checked:H,onChange:G,className:"w-3.5 h-3.5 accent-primary cursor-pointer"}),(0,a.jsx)("span",{className:"text-xs text-text-muted",children:"Filter naming requests"})]}),(0,a.jsx)(l.m_,{text:"Intercepts Claude Code's topic-naming requests and returns a fake response locally, saving API tokens.",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]}),_&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===_.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===_.type?"check_circle":"error"}),(0,a.jsx)("span",{children:_.text})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(l.$n,{variant:"primary",size:"sm",onClick:Q,disabled:!u,loading:k,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,a.jsxs)(l.$n,{variant:"outline",size:"sm",onClick:X,disabled:!j?.has9Router,loading:S,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,a.jsxs)(l.$n,{variant:"ghost",size:"sm",onClick:()=>F(!0),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,a.jsx)(l.rq,{isOpen:T,onClose:()=>O(!1),onSelect:e=>{R&&x(R,e.value)},selectedModel:R?c[R]:null,activeProviders:d,modelAliases:U,title:`Select model for ${R}`}),(0,a.jsx)(l.uR,{isOpen:L,onClose:()=>F(!1),title:"Claude CLI - Manual Configuration",configs:(y=P&&P.trim()?P:h?"<API_KEY_FROM_DASHBOARD>":"sk_9router",b={ANTHROPIC_BASE_URL:V(),ANTHROPIC_AUTH_TOKEN:y},e.defaultModels.forEach(e=>{let t=c[e.alias];t&&e.envKey&&(b[e.envKey]=t)}),[{filename:"~/.claude/settings.json",content:JSON.stringify({hasCompletedOnboarding:!0,env:b},null,2)}])})]})}function d({tool:e,isExpanded:t,onToggle:s,baseUrl:i,apiKeys:o,activeProviders:c,cloudEnabled:x,initialStatus:m}){let u,p,h,g,[f,y]=(0,r.useState)(m||null),[b,j]=(0,r.useState)(!1),[v,N]=(0,r.useState)(!1),[w,k]=(0,r.useState)(!1),[C,S]=(0,r.useState)(null),[A,_]=(0,r.useState)(!1),[E,$]=(0,r.useState)(""),[M,T]=(0,r.useState)(""),[O,R]=(0,r.useState)(""),[I,P]=(0,r.useState)(!1),[D,U]=(0,r.useState)(!1),[z,L]=(0,r.useState)({}),[F,K]=(0,r.useState)(!1),[q,H]=(0,r.useState)("");(0,r.useEffect)(()=>{o?.length>0&&!E&&$(o[0].key)},[o,E]),(0,r.useEffect)(()=>{m&&y(m)},[m]),(0,r.useEffect)(()=>{t&&!f&&(G(),B()),t&&B()},[t]);let B=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&L(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,r.useEffect)(()=>{if(f?.config){let e=f.config.match(/^model\s*=\s*"([^"]+)"/m);e&&T(e[1]);let t=f.config.match(/\[agents\.subagent\]\s*\n\s*model\s*=\s*"([^"]+)"/m);t&&R(t[1])}},[f]);let W=f?.installed?f.config?f.config.includes(i)||f.config.includes("localhost")||f.config.includes("127.0.0.1")?"configured":"other":"not_configured":null,J=()=>{let e=q||`${i}/v1`;return e.endsWith("/v1")?e:`${e}/v1`},G=async()=>{j(!0);try{let e=await fetch("/api/cli-tools/codex-settings"),t=await e.json();y(t)}catch(e){y({installed:!1,error:e.message})}finally{j(!1)}},Z=async()=>{N(!0),S(null);try{let e=E&&E.trim()||x?E:"sk_9router",t=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:J(),apiKey:e,model:M,subagentModel:O||M})}),s=await t.json();t.ok?(S({type:"success",text:"Settings applied successfully!"}),G()):S({type:"error",text:s.error||"Failed to apply settings"})}catch(e){S({type:"error",text:e.message})}finally{N(!1)}},Y=async()=>{k(!0),S(null);try{let e=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),t=await e.json();e.ok?(S({type:"success",text:"Settings reset successfully!"}),T(""),R(""),G()):S({type:"error",text:t.error||"Failed to reset settings"})}catch(e){S({type:"error",text:e.message})}finally{k(!1)}};return(0,a.jsxs)(l.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(n.default,{src:"/providers/codex.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===W&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===W&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===W&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[b&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Codex CLI..."})]}),!b&&f&&!f.installed&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Codex CLI not detected locally"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,a.jsxs)(l.$n,{variant:"secondary",size:"sm",onClick:()=>K(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,a.jsxs)(l.$n,{variant:"outline",size:"sm",onClick:()=>_(!A),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:A?"expand_less":"help"}),A?"Hide":"How to Install"]})]})]}),A&&(0,a.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,a.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,a.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,a.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @openai/codex"})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,a.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"codex"})," to verify."]}),(0,a.jsx)("div",{className:"pt-2 border-t border-border",children:(0,a.jsxs)("p",{className:"text-text-muted text-xs",children:["Codex uses ",(0,a.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"~/.codex/auth.json"})," with ",(0,a.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"OPENAI_API_KEY"}),'. Click "Apply" to auto-configure.']})})]})]})]}),!b&&f?.installed&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[f?.config&&((p=(u=f.config.match(/base_url\s*=\s*"([^"]+)"/))?u[1]:null)?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:p})]}):null),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:q||`${i}/v1`,onChange:e=>H(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),q&&q!==`${i}/v1`&&(0,a.jsx)("button",{onClick:()=>H(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),o.length>0?(0,a.jsx)("select",{value:E,onChange:e=>$(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:o.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:M,onChange:e=>T(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>P(!0),disabled:!c?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${c?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),M&&(0,a.jsx)("button",{onClick:()=>T(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Subagent Model"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:O,onChange:e=>R(e.target.value),placeholder:M||"provider/model-id (defaults to main model)",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>U(!0),disabled:!c?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${c?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),O&&(0,a.jsx)("button",{onClick:()=>R(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear (will use main model)",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),C&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===C.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===C.type?"check_circle":"error"}),(0,a.jsx)("span",{children:C.text})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(l.$n,{variant:"primary",size:"sm",onClick:Z,disabled:!E&&x&&o.length>0||!M,loading:v,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,a.jsxs)(l.$n,{variant:"outline",size:"sm",onClick:Y,disabled:w,loading:w,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,a.jsxs)(l.$n,{variant:"ghost",size:"sm",onClick:()=>K(!0),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,a.jsx)(l.rq,{isOpen:I,onClose:()=>P(!1),onSelect:e=>{T(e.value),O||R(e.value),P(!1)},selectedModel:M,activeProviders:c,modelAliases:z,title:"Select Model for Codex"}),(0,a.jsx)(l.rq,{isOpen:D,onClose:()=>U(!1),onSelect:e=>{R(e.value),U(!1)},selectedModel:O,activeProviders:c,modelAliases:z,title:"Select Subagent Model for Codex"}),(0,a.jsx)(l.uR,{isOpen:F,onClose:()=>K(!1),title:"Codex CLI - Manual Configuration",configs:(h=E&&E.trim()?E:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",g=O||M,[{filename:"~/.codex/config.toml",content:`# 9Router Configuration for Codex CLI
8
- model = "${M}"
9
- model_provider = "9router"
10
-
11
- [model_providers.9router]
12
- name = "9Router"
13
- base_url = "${J()}"
14
- wire_api = "responses"
15
-
16
- [agents.subagent]
17
- model = "${g}"
18
- `},{filename:"~/.codex/auth.json",content:JSON.stringify({auth_mode:"apikey",OPENAI_API_KEY:h},null,2)}])})]})}let c="https://9router.com";function x({tool:e,isExpanded:t,onToggle:s,baseUrl:i,hasActiveProviders:o,apiKeys:d,activeProviders:m,cloudEnabled:u,initialStatus:p}){let h,g,f,y,[b,j]=(0,r.useState)(p||null),[v,N]=(0,r.useState)(!1),[w,k]=(0,r.useState)(!1),[C,S]=(0,r.useState)(!1),[A,_]=(0,r.useState)(null),[E,$]=(0,r.useState)(""),[M,T]=(0,r.useState)([]),[O,R]=(0,r.useState)(""),[I,P]=(0,r.useState)(!1),[D,U]=(0,r.useState)({}),[z,L]=(0,r.useState)(!1),[F,K]=(0,r.useState)(!1),[q,H]=(0,r.useState)(""),B=(0,r.useRef)(!1),W=(()=>{if(!b?.installed)return null;let e=b.settings?.customModels?.find(e=>e.id?.startsWith("custom:9Router"));if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1"),s=u&&c&&e.baseUrl?.startsWith(c),a=i&&e.baseUrl?.startsWith(i);return t||s||a?"configured":"other"})();(0,r.useEffect)(()=>{d?.length>0&&!E&&$(d[0].key)},[d,E]),(0,r.useEffect)(()=>{p&&j(p)},[p]),(0,r.useEffect)(()=>{t&&!b&&(G(),J()),t&&J()},[t]);let J=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&U(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,r.useEffect)(()=>{if(b?.installed&&!B.current){B.current=!0;let e=(b.settings?.customModels||[]).filter(e=>e.id?.startsWith("custom:9Router")).sort((e,t)=>(e.index||0)-(t.index||0)).map(e=>e.model);if(e.length>0)T(e);else{let e=b.settings?.customModels?.find(e=>"custom:9Router-0"===e.id);e?.model&&T([e.model])}}},[b]);let G=async()=>{N(!0);try{let e=await fetch("/api/cli-tools/droid-settings"),t=await e.json();j(t)}catch(e){j({installed:!1,error:e.message})}finally{N(!1)}},Z=()=>{let e=q||i;return e.endsWith("/v1")?e:`${e}/v1`},Y=()=>{let e=O.trim();!e||M.includes(e)||(T(t=>[...t,e]),R(""))},V=async()=>{k(!0),_(null);try{let e=E?.trim()||(d?.length>0?d[0].key:null)||(u?null:"sk_9router"),t=await fetch("/api/cli-tools/droid-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:Z(),apiKey:e,models:M,activeModel:M[0]||""})}),s=await t.json();t.ok?(_({type:"success",text:"Settings applied successfully!"}),G()):_({type:"error",text:s.error||"Failed to apply settings"})}catch(e){_({type:"error",text:e.message})}finally{k(!1)}},Q=async()=>{S(!0),_(null);try{let e=await fetch("/api/cli-tools/droid-settings",{method:"DELETE"}),t=await e.json();e.ok?(_({type:"success",text:"Settings reset successfully!"}),T([]),G()):_({type:"error",text:t.error||"Failed to reset settings"})}catch(e){_({type:"error",text:e.message})}finally{S(!1)}};return(0,a.jsxs)(l.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(n.default,{src:"/providers/droid.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===W&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===W&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===W&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[v&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Factory Droid CLI..."})]}),!v&&b&&!b.installed&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Factory Droid CLI not detected locally"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,a.jsxs)(l.$n,{variant:"secondary",size:"sm",onClick:()=>L(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,a.jsxs)(l.$n,{variant:"outline",size:"sm",onClick:()=>K(!F),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:F?"expand_less":"help"}),F?"Hide":"How to Install"]})]})]}),F&&(0,a.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,a.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,a.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,a.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"curl -fsSL https://app.factory.ai/cli | sh"})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,a.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"droid"})," to verify."]})]})]})]}),!v&&b?.installed&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[b?.settings?.customModels?.find(e=>e.id?.startsWith("custom:9Router"))?.baseUrl&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:b.settings.customModels.find(e=>e.id?.startsWith("custom:9Router")).baseUrl})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:(h=q||i).endsWith("/v1")?h:`${h}/v1`,onChange:e=>H(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),q&&q!==i&&(0,a.jsx)("button",{onClick:()=>H(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,a.jsx)("select",{value:E,onChange:e=>$(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:u?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:["Models ",M.length>0&&(0,a.jsxs)("span",{className:"text-primary",children:["(",M.length,")"]})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsxs)("div",{className:"flex-1 flex flex-col gap-1",children:[M.length>0&&(0,a.jsx)("div",{className:"flex flex-col gap-0.5 mb-1",children:M.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-bg-secondary rounded border border-border",children:[(0,a.jsx)("span",{className:"flex-1 text-xs font-mono truncate",children:e}),(0,a.jsx)("button",{onClick:()=>T(t=>t.filter(t=>t!==e)),className:"text-text-muted hover:text-red-500 transition-colors shrink-0",title:"Remove",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},e))}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("input",{type:"text",value:O,onChange:e=>R(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),Y())},placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>P(!0),disabled:!o,className:`px-2 py-1.5 rounded border text-xs shrink-0 ${o?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),(0,a.jsx)("button",{onClick:Y,disabled:!O.trim(),className:"px-2 py-1.5 rounded border bg-surface border-border hover:border-primary text-xs shrink-0 disabled:opacity-50",title:"Add model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"add"})})]})]})]})]}),A&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===A.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===A.type?"check_circle":"error"}),(0,a.jsx)("span",{children:A.text})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(l.$n,{variant:"primary",size:"sm",onClick:V,disabled:0===M.length,loading:w,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,a.jsxs)(l.$n,{variant:"outline",size:"sm",onClick:Q,disabled:!b?.has9Router,loading:C,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,a.jsxs)(l.$n,{variant:"ghost",size:"sm",onClick:()=>L(!0),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,a.jsx)(l.rq,{isOpen:I,onClose:()=>P(!1),onSelect:e=>{!e.value||M.includes(e.value)||(T(t=>[...t,e.value]),P(!1))},selectedModel:null,activeProviders:m,modelAliases:D,title:"Select Model for Factory Droid"}),(0,a.jsx)(l.uR,{isOpen:z,onClose:()=>L(!1),title:"Factory Droid - Manual Configuration",configs:(g=E&&E.trim()?E:u?"<API_KEY_FROM_DASHBOARD>":"sk_9router",f={customModels:M.map((e,t)=>({model:e,id:`custom:9Router-${t}`,index:t,baseUrl:Z(),apiKey:g,displayName:e,maxOutputTokens:131072,noImageSupport:!1,provider:"openai"}))},y="u">typeof navigator&&navigator.platform,[{filename:y?.toLowerCase().includes("win")?"%USERPROFILE%\\.factory\\settings.json":"~/.factory/settings.json",content:JSON.stringify(f,null,2)}])})]})}function m({tool:e,isExpanded:t,onToggle:s,baseUrl:i,hasActiveProviders:o,apiKeys:d,activeProviders:c,cloudEnabled:x,initialStatus:u}){let p,h,[g,f]=(0,r.useState)(u||null),[y,b]=(0,r.useState)(!1),[j,v]=(0,r.useState)(!1),[N,w]=(0,r.useState)(!1),[k,C]=(0,r.useState)(null),[S,A]=(0,r.useState)(""),[_,E]=(0,r.useState)(""),[$,M]=(0,r.useState)({}),[T,O]=(0,r.useState)(null),[R,I]=(0,r.useState)(!1),[P,D]=(0,r.useState)({}),[U,z]=(0,r.useState)(!1),[L,F]=(0,r.useState)(""),K=(0,r.useRef)(!1),q=(()=>{if(!g?.installed)return null;let e=g.settings?.models?.providers?.["9router"];if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1")||e.baseUrl?.includes("0.0.0.0"),s=i&&e.baseUrl?.startsWith(i);return t||s?"configured":"other"})();(0,r.useEffect)(()=>{d?.length>0&&!S&&A(d[0].key)},[d,S]),(0,r.useEffect)(()=>{u&&f(u)},[u]),(0,r.useEffect)(()=>{t&&!g&&(B(),H()),t&&H()},[t]);let H=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&D(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,r.useEffect)(()=>{if(g?.installed&&!K.current){K.current=!0;let e=g.settings?.models?.providers?.["9router"];if(e){let t=g.settings?.agents?.defaults?.model?.primary;t&&E(t.replace("9router/","")),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&A(e.apiKey)}let t=g.agents||[],s={};t.forEach(e=>{e.currentModel&&(s[e.id]=e.currentModel)}),M(s)}},[g,d]);let B=async()=>{b(!0);try{let e=await fetch("/api/cli-tools/openclaw-settings"),t=await e.json();f(t)}catch(e){f({installed:!1,error:e.message})}finally{b(!1)}},W=()=>window.location.origin.replace("://localhost","://127.0.0.1"),J=()=>{let e=L||W();return e.endsWith("/v1")?e:`${e}/v1`},G=async()=>{v(!0),C(null);try{let e=S?.trim()||(d?.length>0?d[0].key:null)||(x?null:"sk_9router"),t=await fetch("/api/cli-tools/openclaw-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:J(),apiKey:e,model:_,agentModels:$})}),s=await t.json();t.ok?(C({type:"success",text:"Settings applied successfully!"}),B()):C({type:"error",text:s.error||"Failed to apply settings"})}catch(e){C({type:"error",text:e.message})}finally{v(!1)}},Z=async()=>{w(!0),C(null);try{let e=await fetch("/api/cli-tools/openclaw-settings",{method:"DELETE"}),t=await e.json();e.ok?(C({type:"success",text:"Settings reset successfully!"}),E(""),A(""),B()):C({type:"error",text:t.error||"Failed to reset settings"})}catch(e){C({type:"error",text:e.message})}finally{w(!1)}};return(0,a.jsxs)(l.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(n.default,{src:"/providers/openclaw.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===q&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===q&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===q&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[y&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Open Claw CLI..."})]}),!y&&g&&!g.installed&&(0,a.jsx)("div",{className:"flex flex-col gap-4",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Open Claw CLI not detected locally"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,a.jsx)("div",{className:"flex items-center gap-2 pl-9",children:(0,a.jsxs)(l.$n,{variant:"secondary",size:"sm",onClick:()=>z(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!y&&g?.installed&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[g?.settings?.models?.providers?.["9router"]?.baseUrl&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:g.settings.models.providers["9router"].baseUrl})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:(p=L||W()).endsWith("/v1")?p:`${p}/v1`,onChange:e=>F(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),L&&L!==i&&(0,a.jsx)("button",{onClick:()=>F(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,a.jsx)("select",{value:S,onChange:e=>A(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Default Model"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:_,onChange:e=>E(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>{O(null),I(!0)},disabled:!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),_&&(0,a.jsx)("button",{onClick:()=>E(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(g.agents||[]).filter(e=>e.agentDir).map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2 pl-4",children:[(0,a.jsxs)("span",{className:"w-32 shrink-0 text-xs text-primary text-right truncate",title:e.name||e.id,children:["Agent ",e.name||e.id]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:$[e.id]||"",onChange:t=>M(s=>({...s,[e.id]:t.target.value})),placeholder:`default (${_||"provider/model-id"})`,className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>{O(e.id),I(!0)},disabled:!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),$[e.id]&&(0,a.jsx)("button",{onClick:()=>M(t=>({...t,[e.id]:""})),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.id))]}),k&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===k.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===k.type?"check_circle":"error"}),(0,a.jsx)("span",{children:k.text})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(l.$n,{variant:"primary",size:"sm",onClick:G,disabled:!_,loading:j,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,a.jsxs)(l.$n,{variant:"outline",size:"sm",onClick:Z,disabled:!g?.has9Router,loading:N,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,a.jsxs)(l.$n,{variant:"ghost",size:"sm",onClick:()=>z(!0),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,a.jsx)(l.rq,{isOpen:R,onClose:()=>I(!1),onSelect:e=>{T?(M(t=>({...t,[T]:e.value})),O(null)):E(e.value),I(!1)},selectedModel:_,activeProviders:c,modelAliases:P,title:"Select Model for Open Claw"}),(0,a.jsx)(l.uR,{isOpen:U,onClose:()=>z(!1),title:"Open Claw - Manual Configuration",configs:(h=S&&S.trim()?S:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.openclaw/openclaw.json",content:JSON.stringify({agents:{defaults:{model:{primary:`9router/${_||"provider/model-id"}`}}},models:{providers:{"9router":{baseUrl:J(),apiKey:h,api:"openai-completions",models:[{id:_||"provider/model-id",name:(_||"provider/model-id").split("/").pop()}]}}}},null,2)}])})]})}let u="/api/cli-tools/hermes-settings";function p({tool:e,isExpanded:t,onToggle:s,baseUrl:i,hasActiveProviders:o,apiKeys:d,activeProviders:c,cloudEnabled:x,initialStatus:m}){let h,[g,f]=(0,r.useState)(m||null),[y,b]=(0,r.useState)(!1),[j,v]=(0,r.useState)(!1),[N,w]=(0,r.useState)(!1),[k,C]=(0,r.useState)(null),[S,A]=(0,r.useState)(""),[_,E]=(0,r.useState)(""),[$,M]=(0,r.useState)(!1),[T,O]=(0,r.useState)({}),[R,I]=(0,r.useState)(!1),[P,D]=(0,r.useState)(""),U=(0,r.useRef)(!1),z=(()=>{if(!g?.installed)return null;let e=g.settings?.model;if(!e?.base_url)return"not_configured";let t=/localhost|127\.0\.0\.1|0\.0\.0\.0/.test(e.base_url),s=i&&e.base_url.startsWith(i);return t||s?"configured":"other"})();(0,r.useEffect)(()=>{d?.length>0&&!S&&A(d[0].key)},[d,S]),(0,r.useEffect)(()=>{m&&f(m)},[m]),(0,r.useEffect)(()=>{t&&!g&&(F(),L()),t&&L()},[t]);let L=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&O(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,r.useEffect)(()=>{if(g?.installed&&!U.current){U.current=!0;let e=g.settings?.model;e?.default&&E(e.default)}},[g]);let F=async()=>{b(!0);try{let e=await fetch(u),t=await e.json();f(t)}catch(e){f({installed:!1,error:e.message})}finally{b(!1)}},K=()=>{let e=P||window.location.origin.replace("://localhost","://127.0.0.1");return e.endsWith("/v1")?e:`${e}/v1`},q=async()=>{v(!0),C(null);try{let e=S?.trim()||(d?.length>0?d[0].key:null)||(x?null:"sk_9router"),t=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:K(),apiKey:e,model:_})}),s=await t.json();t.ok?(C({type:"success",text:"Settings applied successfully!"}),F()):C({type:"error",text:s.error||"Failed to apply settings"})}catch(e){C({type:"error",text:e.message})}finally{v(!1)}},H=async()=>{w(!0),C(null);try{let e=await fetch(u,{method:"DELETE"}),t=await e.json();e.ok?(C({type:"success",text:"Settings reset successfully!"}),E(""),F()):C({type:"error",text:t.error||"Failed to reset settings"})}catch(e){C({type:"error",text:e.message})}finally{w(!1)}};return(0,a.jsxs)(l.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(n.default,{src:"/providers/hermes.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===z&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===z&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===z&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[y&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Hermes Agent..."})]}),!y&&g&&!g.installed&&(0,a.jsx)("div",{className:"flex flex-col gap-4",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Hermes Agent not detected locally"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Install: curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash"})]})]}),(0,a.jsx)("div",{className:"flex items-center gap-2 pl-9",children:(0,a.jsxs)(l.$n,{variant:"secondary",size:"sm",onClick:()=>I(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!y&&g?.installed&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[g?.settings?.model?.base_url&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:g.settings.model.base_url})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:K(),onChange:e=>D(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),P&&P!==i&&(0,a.jsx)("button",{onClick:()=>D(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,a.jsx)("select",{value:S,onChange:e=>A(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Default Model"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:_,onChange:e=>E(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>M(!0),disabled:!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),_&&(0,a.jsx)("button",{onClick:()=>E(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),k&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===k.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===k.type?"check_circle":"error"}),(0,a.jsx)("span",{children:k.text})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(l.$n,{variant:"primary",size:"sm",onClick:q,disabled:!_,loading:j,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,a.jsxs)(l.$n,{variant:"outline",size:"sm",onClick:H,disabled:!g?.has9Router,loading:N,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,a.jsxs)(l.$n,{variant:"ghost",size:"sm",onClick:()=>I(!0),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,a.jsx)(l.rq,{isOpen:$,onClose:()=>M(!1),onSelect:e=>{E(e.value),M(!1)},selectedModel:_,activeProviders:c,modelAliases:T,title:"Select Model for Hermes Agent"}),(0,a.jsx)(l.uR,{isOpen:R,onClose:()=>I(!1),title:"Hermes Agent - Manual Configuration",configs:(h=S&&S.trim()?S:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.hermes/config.yaml",content:`model:
19
- default: "${_||"provider/model-id"}"
20
- provider: "custom"
21
- base_url: "${K()}"
22
- `},{filename:"~/.hermes/.env",content:`OPENAI_API_KEY=${h}
23
- `}])})]})}var h=s(11059);function g({toolId:e,tool:t,isExpanded:s,onToggle:i,baseUrl:o,apiKeys:d,activeProviders:c=[],cloudEnabled:x=!1,tunnelEnabled:m=!1}){let[u,p]=(0,r.useState)(null),[f,y]=(0,r.useState)(!1),[b,j]=(0,r.useState)(""),[v,N]=(0,r.useState)(()=>d?.length>0?d[0].key:""),w=e=>{let t=v&&v.trim()?v:x?"your-api-key":"sk_9router",s=o||"http://localhost:20128",a=s.endsWith("/v1")?s:`${s}/v1`;return e.replace(/\{\{baseUrl\}\}/g,a).replace(/\{\{apiKey\}\}/g,t).replace(/\{\{model\}\}/g,b||"provider/model-id")},{copy:k}=(0,h.C)(),C=async(e,t)=>{await k(w(e),`toolcard-${t}`),p(t),setTimeout(()=>p(null),2e3)},S=c.length>0,A=()=>(!t.requiresExternalUrl||!!x||!!m)&&(!t.requiresCloud||!!x);return(0,a.jsxs)(l.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:i,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:t.image?(0,a.jsx)(n.default,{src:t.image,alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}}):t.icon?(0,a.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:t.color},children:t.icon}):(0,a.jsx)(n.default,{src:`/providers/${e}.png`,alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:t.name}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:t.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${s?"rotate-180":""}`,children:"expand_more"})]}),s&&(0,a.jsx)("div",{className:"mt-6 pt-6 border-t border-border",children:t.guideSteps?(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[t.notes&&0!==t.notes.length?(0,a.jsx)("div",{className:"flex flex-col gap-2 mb-4",children:t.notes.map((e,t)=>{if("cloudCheck"===e.type&&(x||m))return null;let s="warning"===e.type,r="cloudCheck"===e.type&&!x&&!m,l="bg-blue-500/10 border-blue-500/30",n="text-blue-600 dark:text-blue-400",i="text-blue-500",o="info";return s?(l="bg-yellow-500/10 border-yellow-500/30",n="text-yellow-600 dark:text-yellow-400",i="text-yellow-500",o="warning"):r&&(l="bg-red-500/10 border-red-500/30",n="text-red-600 dark:text-red-400",i="text-red-500",o="error"),(0,a.jsxs)("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${l}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-lg ${i}`,children:o}),(0,a.jsx)("p",{className:`text-sm ${n}`,children:e.text})]},t)})}):null,A()&&t.guideSteps.map(e=>(0,a.jsxs)("div",{className:"flex items-start gap-4",children:[(0,a.jsx)("div",{className:"size-8 rounded-full flex items-center justify-center shrink-0 text-sm font-semibold text-white",style:{backgroundColor:t.color},children:e.step}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-text",children:e.title}),e.desc&&(0,a.jsx)("p",{className:"text-sm text-text-muted mt-0.5",children:e.desc}),"apiKeySelector"===e.type&&(0,a.jsx)("div",{className:"mt-2 flex items-center gap-2",children:d&&d.length>0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("select",{value:v,onChange:e=>N(e.target.value),className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}),(0,a.jsx)("button",{onClick:()=>C(v,"apiKey"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"apiKey"===u?"check":"content_copy"})})]}):(0,a.jsx)("span",{className:"text-sm text-text-muted",children:x?"No API keys - Create one in Keys page":"sk_9router"})}),"modelSelector"===e.type&&(0,a.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,a.jsx)("input",{type:"text",value:b,onChange:e=>j(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>y(!0),disabled:!S,className:`shrink-0 px-3 py-2 rounded-lg border text-sm transition-colors ${S?"bg-bg-secondary border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),b&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{onClick:()=>C(b,"model"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"model"===u?"check":"content_copy"})}),(0,a.jsx)("button",{onClick:()=>j(""),className:"p-2 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]})]}),e.value&&(0,a.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,a.jsx)("code",{className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm font-mono border border-border truncate",children:w(e.value)}),e.copyable&&(0,a.jsx)("button",{onClick:()=>C(e.value,`${e.step}-${e.title}`),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:u===`${e.step}-${e.title}`?"check":"content_copy"})})]})]})]},e.step)),A()&&t.codeBlock&&(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wide",children:t.codeBlock.language}),(0,a.jsxs)("button",{onClick:()=>C(t.codeBlock.code,"codeblock"),className:"flex items-center gap-1 px-2 py-1 text-xs bg-bg-secondary hover:bg-bg-tertiary rounded border border-border transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"codeblock"===u?"check":"content_copy"}),"codeblock"===u?"Copied!":"Copy"]})]}),(0,a.jsx)("pre",{className:"p-4 bg-bg-secondary rounded-lg border border-border overflow-x-auto",children:(0,a.jsx)("code",{className:"text-sm font-mono whitespace-pre",children:w(t.codeBlock.code)})})]})]}):(0,a.jsx)("p",{className:"text-text-muted text-sm",children:"Coming soon..."})}),(0,a.jsx)(l.rq,{isOpen:f,onClose:()=>y(!1),onSelect:e=>{j(e.value)},selectedModel:b,activeProviders:c,title:"Select Model"})]})}let f="round-robin",y=[{value:"round-robin",label:"Round-Robin"},{value:"fallback",label:"Fallback"}];function b({tool:e,mappings:t,strategy:s=f,dnsActive:r=!0,hasActiveProviders:n,onChangeEntry:i,onBlurEntry:o,onOpenSelector:d,onAddEntry:c,onRemoveEntry:x,onReorderEntry:m,onChangeStrategy:u,feedback:p,compact:h=!1}){let g=h?"w-32 shrink-0 text-sm font-semibold text-text-main text-right":"w-36 shrink-0 text-xs font-semibold text-text-main text-right",j=h?"px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap":"px-2 py-1.5 rounded border text-xs transition-colors shrink-0",v="h-8 min-w-8 inline-flex items-center justify-center rounded-md border border-border text-text-muted transition-colors",N=h?"h-8 px-2.5 inline-flex items-center justify-center rounded-md border border-border text-[11px] font-medium text-text-main transition-colors shrink-0 whitespace-nowrap":"h-8 px-2.5 inline-flex items-center justify-center rounded-md border border-border text-[11px] font-medium text-text-main transition-colors shrink-0",w=!r;return(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)("div",{className:"rounded-xl border border-border/70 bg-surface/60 p-3",children:(0,a.jsxs)("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-text-main",children:"Routing strategy"}),(0,a.jsx)("p",{className:"text-[11px] text-text-muted",children:"Round-robin spreads load. Fallback keeps priority order."}),(0,a.jsx)("p",{className:"text-[10px] text-text-muted mt-1",children:"Tip: paste comma-separated models into one row to expand multiple targets at once."})]}),(0,a.jsx)("div",{className:"sm:w-44",children:(0,a.jsx)(l.l6,{value:s,onChange:e=>u(e.target.value),disabled:w,options:y,selectClassName:"py-1.5 px-2 pr-8 text-xs bg-surface border-border","aria-label":`${e.name} MITM strategy`})})]})}),p&&(0,a.jsx)("div",{className:"rounded-lg border border-primary/20 bg-primary/5 px-3 py-2 text-[11px] text-text-muted",children:p}),(0,a.jsx)("div",{className:"flex flex-col gap-2",children:e.defaultModels?.map(e=>{let s=Array.isArray(t?.[e.alias])?t[e.alias]:[],l=r&&s.length<5;return(0,a.jsx)("div",{className:"rounded-xl border border-border/70 bg-surface/40 p-3",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("div",{className:g,children:(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("span",{children:e.name}),(0,a.jsxs)("span",{className:"text-[10px] font-normal text-text-muted",children:["Max ",5," targets"]})]})}),(0,a.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[s.length>0?s.map((t,r)=>{let l=w||0===r,c=w||r===s.length-1;return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-6 text-center text-[11px] font-semibold text-text-muted",children:r+1}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:t,onChange:t=>i(e.alias,r,t.target.value),onBlur:t=>o(e.alias,r,t.target.value),placeholder:"provider/model-id",disabled:w,className:`flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 ${w?"opacity-50 cursor-not-allowed":""}`}),(0,a.jsx)("button",{type:"button",onClick:()=>d(e.alias,r),disabled:!n||w,className:`${N} ${n&&!w?"hover:border-primary hover:text-primary cursor-pointer":"opacity-40 cursor-not-allowed"}`,title:"Select model",children:"Select"}),(0,a.jsx)("button",{type:"button",onClick:()=>m(e.alias,r,r-1),disabled:l,className:`${v} ${l?"opacity-40 cursor-not-allowed":"hover:border-primary hover:text-primary cursor-pointer"}`,title:"Move up",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"keyboard_arrow_up"})}),(0,a.jsx)("button",{type:"button",onClick:()=>m(e.alias,r,r+1),disabled:c,className:`${v} ${c?"opacity-40 cursor-not-allowed":"hover:border-primary hover:text-primary cursor-pointer"}`,title:"Move down",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"keyboard_arrow_down"})}),(0,a.jsx)("button",{type:"button",onClick:()=>x(e.alias,r),disabled:w,className:`${v} ${w?"opacity-40 cursor-not-allowed":"hover:border-red-500 hover:text-red-500 cursor-pointer"}`,title:"Remove",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]},`${e.alias}-${r}`)}):(0,a.jsx)("div",{className:"rounded-lg border border-dashed border-border px-3 py-2 text-[11px] text-text-muted",children:"No mapping — passthrough"}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 pl-8",children:[(0,a.jsx)("button",{type:"button",onClick:()=>c(e.alias),disabled:!l,className:`${j} ${l?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"+ Add"}),(0,a.jsxs)("span",{className:"text-[10px] text-text-muted",children:[s.length,"/",5," mapped"]})]})]})]})},e.alias)})})]})}function j(e){return Array.isArray(e)?e.map(e=>"string"==typeof e?e.trim():"").filter(Boolean).slice(0,5):"string"==typeof e&&e.trim()?[e.trim()]:[]}function v(e){return Object.fromEntries(Object.entries(e||{}).map(([e,t])=>[e,j(t)]).filter(([,e])=>e.length>0))}function N(e,t,s){let a="string"==typeof s?s.trim():"";if(!t||!a)return e;let r=j(e?.[t]);return r.length>=5?e:{...e,[t]:[...r,a]}}function w(e,t,s,a){let r=Array.isArray(e?.[t])?[...e[t]]:[];return s<0||s>=r.length?e:(r[s]=a,{...e,[t]:r})}function k(e){return"fallback"===(e||f)?"fallback":f}function C({tool:e,isExpanded:t,onToggle:s,baseUrl:i,apiKeys:o,activeProviders:d,cloudEnabled:c,initialStatus:x}){let m,u,p,h,g,[f,y]=(0,r.useState)(x||null),[b,j]=(0,r.useState)(!1),[v,N]=(0,r.useState)(!1),[w,k]=(0,r.useState)(!1),[S,A]=(0,r.useState)(null),[_,E]=(0,r.useState)(!1),[$,M]=(0,r.useState)(""),[T,O]=(0,r.useState)(""),[R,I]=(0,r.useState)(""),[P,D]=(0,r.useState)(!1),[U,z]=(0,r.useState)(!1),[L,F]=(0,r.useState)({}),[K,q]=(0,r.useState)(!1),[H,B]=(0,r.useState)(""),[W,J]=(0,r.useState)([]),[G,Z]=(0,r.useState)("");(0,r.useEffect)(()=>{o?.length>0&&!$&&M(o[0].key)},[o,$]),(0,r.useEffect)(()=>{x&&y(x)},[x]),(0,r.useEffect)(()=>{t&&!f&&(X(),Y()),t&&Y()},[t]),(0,r.useEffect)(()=>{f?.opencode?.models&&J(f.opencode.models),f?.opencode?.activeModel&&Z(f.opencode.activeModel),f?.config?.agent?.explorer?.model?.startsWith("9router/")&&I(f.config.agent.explorer.model.replace("9router/",""))},[f]);let Y=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&F(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}},V=(()=>{if(!f?.installed)return null;if(!f.config)return"not_configured";let e=f.config?.provider?.["9router"]?.options?.baseURL||"",t=e.includes("localhost")||e.includes("127.0.0.1");return f.has9Router&&(t||e.includes(i))?"configured":f.has9Router?"other":"not_configured"})(),Q=()=>{let e=H||i;return e.endsWith("/v1")?e:`${e}/v1`},X=async()=>{j(!0);try{let e=await fetch("/api/cli-tools/opencode-settings"),t=await e.json();y(t)}catch(e){y({installed:!1,error:e.message})}finally{j(!1)}},ee=async()=>{N(!0),A(null);try{let e=$&&$.trim()||c?$:"sk_9router",t=await fetch("/api/cli-tools/opencode-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:Q(),apiKey:e,models:W,activeModel:""===G?"":G||W[0],subagentModel:R})}),s=await t.json();t.ok?(A({type:"success",text:"Settings applied successfully!"}),X()):A({type:"error",text:s.error||"Failed to apply settings"})}catch(e){A({type:"error",text:e.message})}finally{N(!1)}},et=async()=>{k(!0),A(null);try{let e=await fetch("/api/cli-tools/opencode-settings",{method:"DELETE"}),t=await e.json();e.ok?(A({type:"success",text:"Settings reset successfully!"}),O(""),I(""),J([]),Z(""),X()):A({type:"error",text:t.error||"Failed to reset settings"})}catch(e){A({type:"error",text:e.message})}finally{k(!1)}};return(0,a.jsxs)(l.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(n.default,{src:"/providers/opencode.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===V&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===V&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===V&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[b&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking OpenCode CLI..."})]}),!b&&f&&!f.installed&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"OpenCode CLI not detected locally"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,a.jsxs)(l.$n,{variant:"secondary",size:"sm",onClick:()=>q(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,a.jsxs)(l.$n,{variant:"outline",size:"sm",onClick:()=>E(!_),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:_?"expand_less":"help"}),_?"Hide":"How to Install"]})]})]}),_&&(0,a.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,a.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,a.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux:"}),(0,a.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g opencode-ai"})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,a.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"opencode"})," to verify."]})]})]})]}),!b&&f?.installed&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[f?.config?.provider?.["9router"]?.options?.baseURL&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:f.config.provider["9router"].options.baseURL})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:H||`${i}/v1`,onChange:e=>B(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),H&&H!==`${i}/v1`&&(0,a.jsx)("button",{onClick:()=>B(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),o.length>0?(0,a.jsx)("select",{value:$,onChange:e=>M(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:o.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:c?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right pt-1",children:"Models"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] mt-1.5",children:"arrow_forward"}),(0,a.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5 min-h-[28px] px-2 py-1.5 bg-surface rounded border border-border",children:0===W.length?(0,a.jsx)("span",{className:"text-xs text-text-muted",children:"No models selected"}):W.map(e=>(0,a.jsxs)("span",{onClick:async()=>{if(e===G)try{(await fetch("/api/cli-tools/opencode-settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({clearActiveModel:!0})})).ok&&(Z(""),X())}catch(e){console.log("Error clearing active model:",e)}else Z(e)},className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs cursor-pointer transition-colors ${e===G?"bg-primary/10 text-primary border border-primary":"bg-black/5 dark:bg-white/5 text-text-muted border border-transparent hover:border-border"}`,title:e===G?"Click to clear active model":"Click to set as active",children:[e===G&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[10px]",children:"star"}),e,(0,a.jsx)("button",{onClick:async t=>{t.stopPropagation();try{if((await fetch(`/api/cli-tools/opencode-settings?model=${encodeURIComponent(e)}`,{method:"DELETE"})).ok){let t=W.filter(t=>t!==e);J(t),G===e&&Z(""),X()}}catch(e){console.log("Error removing model:",e)}},className:"ml-0.5 hover:text-red-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},e))}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:()=>D(!0),disabled:!d?.length,className:`px-2 py-1 rounded border text-xs transition-colors ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Add Model"}),(0,a.jsx)("span",{className:"text-xs text-text-muted",children:W.length>0&&G?(0,a.jsxs)(a.Fragment,{children:["Active: ",(0,a.jsx)("span",{className:"text-primary",children:G})]}):W.length>0?(0,a.jsx)("span",{className:"text-yellow-500",children:"Click a model to set/clear active"}):"Select models to add"})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Subagent Model"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:R,onChange:e=>I(e.target.value),placeholder:T||"provider/model-id (defaults to main model)",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>z(!0),disabled:!d?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),R&&(0,a.jsx)("button",{onClick:()=>I(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear (will use main model)",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),S&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===S.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===S.type?"check_circle":"error"}),(0,a.jsx)("span",{children:S.text})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(l.$n,{variant:"primary",size:"sm",onClick:ee,disabled:0===W.length,loading:v,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,a.jsxs)(l.$n,{variant:"outline",size:"sm",onClick:et,disabled:!f.has9Router,loading:w,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,a.jsxs)(l.$n,{variant:"ghost",size:"sm",onClick:()=>q(!0),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,a.jsx)(l.rq,{isOpen:P,onClose:()=>D(!1),onSelect:e=>{!W.includes(e.value)&&(J([...W,e.value]),G||Z(e.value)),D(!1)},selectedModel:null,activeProviders:d,modelAliases:L,title:"Add Model for OpenCode"}),(0,a.jsx)(l.rq,{isOpen:U,onClose:()=>z(!1),onSelect:e=>{I(e.value),z(!1)},selectedModel:R,activeProviders:d,modelAliases:L,title:"Select Subagent Model for OpenCode"}),(0,a.jsx)(l.uR,{isOpen:K,onClose:()=>q(!1),title:"OpenCode - Manual Configuration",configs:(m=$&&$.trim()?$:c?"<API_KEY_FROM_DASHBOARD>":"sk_9router",u=W.length>0?W:["provider/model-id"],p=G||W[0]||u[0],h=R||p,g={},u.forEach(e=>{g[e]={name:e}}),[{filename:"~/.config/opencode/opencode.json",content:JSON.stringify({provider:{"9router":{npm:"@ai-sdk/openai-compatible",options:{baseURL:Q(),apiKey:m},models:g}},model:`9router/${p}`,agent:{explorer:{description:"Fast explorer subagent for codebase exploration",mode:"subagent",model:`9router/${h}`}}},null,2)}])})]})}let S="http://localhost:20128";function A({apiKeys:e,cloudEnabled:t,onStatusChange:s}){let[n,i]=(0,r.useState)(null),[o,d]=(0,r.useState)(!1),[c,x]=(0,r.useState)(!1),[m,u]=(0,r.useState)(""),[p,h]=(0,r.useState)(""),[g,f]=(0,r.useState)(null),[y,b]=(0,r.useState)(null),[j,v]=(0,r.useState)(null),[N,w]=(0,r.useState)(S),k="u">typeof navigator&&navigator.userAgent?.includes("Windows"),C=n?.isAdmin!==!1;(0,r.useEffect)(()=>{e?.length>0&&!p&&h(e[0].key)},[e,p]),(0,r.useEffect)(()=>{_()},[]);let _=async()=>{try{let e=await fetch("/api/cli-tools/antigravity-mitm");if(e.ok){let t=await e.json();i(t),t.mitmRouterBaseUrl&&w(t.mitmRouterBaseUrl),s?.(t)}}catch{i({running:!1,certExists:!1,dnsStatus:{}})}},E=e=>{v(null),k||n?.hasCachedPassword?$(e,""):(f(e),x(!0),b(null))},$=async(s,a)=>{d(!0),v(null);try{let r;if("trust-cert"===s)r=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"trust-cert",sudoPassword:a})});else if("start"===s){let s=p?.trim()||(e?.length>0?e[0].key:null)||(t?null:"sk_9router");r=await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:s,sudoPassword:a,mitmRouterBaseUrl:N.trim()||S})})}else r=await fetch("/api/cli-tools/antigravity-mitm",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:a})});let l=await r.json().catch(()=>({}));if(!r.ok)throw Error(l.error||"MITM action failed");x(!1),u(""),b(null),await _()}catch(t){let e=t?.message||"MITM action failed";v(e),c&&b(e)}finally{d(!1),f(null)}},M=()=>{m?$(g,m):b("Sudo password is required")},T=n?.running;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.Zp,{padding:"sm",className:"border-primary/20 bg-primary/5",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"security"}),(0,a.jsx)("span",{className:"font-semibold text-sm text-text-main",children:"MITM Server"}),T?(0,a.jsx)(l.Ex,{variant:"success",size:"sm",children:"Running"}):(0,a.jsx)(l.Ex,{variant:"default",size:"sm",children:"Stopped"})]}),(0,a.jsx)("div",{className:"flex items-center gap-1 text-xs text-text-muted","data-i18n-skip":"true",children:[{label:"Cert",ok:n?.certExists},{label:"Trusted",ok:n?.certTrusted},{label:"Server",ok:T}].map(({label:e,ok:t})=>(0,a.jsxs)("span",{className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded ${t?"text-green-600":"text-text-muted"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:t?"check_circle":"cancel"}),e]},e))})]}),(0,a.jsxs)("div",{className:"px-2 py-2 rounded-lg bg-surface/50 border border-border/50 flex flex-col gap-2",children:[(0,a.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,a.jsx)("span",{className:"font-medium text-text-main",children:"Purpose:"})," Use Antigravity IDE & GitHub Copilot → with ANY provider/model from 9Router"]}),(0,a.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,a.jsx)("span",{className:"font-medium text-text-main",children:"How it works:"})," Antigravity/Copilot IDE request → DNS redirect to localhost:443 → MITM proxy intercepts → 9Router → response to Antigravity/Copilot"]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"9Router Base URL"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:N,onChange:e=>w(e.target.value),placeholder:S,disabled:T,className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50 disabled:opacity-50"})]}),!T&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",list:"mitm-api-keys",value:p,onChange:e=>h(e.target.value),placeholder:t?"Enter or pick API key":"sk_9router (default)",className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50"}),e?.length>0&&(0,a.jsx)("datalist",{id:"mitm-api-keys",children:e.map(e=>(0,a.jsx)("option",{value:e.key,children:e.name||e.key},e.id))})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap","data-i18n-skip":"true",children:[n?.certExists&&!n?.certTrusted&&(0,a.jsxs)("button",{onClick:()=>E("trust-cert"),disabled:o,className:"px-4 py-1.5 rounded-lg bg-yellow-500/10 border border-yellow-500/30 text-yellow-600 font-medium text-xs flex items-center gap-1.5 hover:bg-yellow-500/20 transition-colors disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"verified_user"}),"Trust Cert"]}),T?(0,a.jsxs)("button",{onClick:()=>E("stop"),disabled:o,className:"px-4 py-1.5 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-xs flex items-center gap-1.5 hover:bg-red-500/20 transition-colors disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop Server"]}):(0,a.jsxs)("button",{onClick:()=>E("start"),disabled:o||k&&!C,className:"px-4 py-1.5 rounded-lg bg-primary/10 border border-primary/30 text-primary font-medium text-xs flex items-center gap-1.5 hover:bg-primary/20 transition-colors disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start Server"]}),T&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Enable DNS per tool below to activate interception"})]}),j&&(0,a.jsxs)("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mt-0.5 shrink-0",children:"error"}),(0,a.jsx)("span",{children:j})]}),k&&!C&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 border border-red-500/20",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"shield_lock"}),(0,a.jsx)("span",{children:"Administrator required — restart 9Router as Administrator to use MITM"})]})]})}),c&&(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,a.jsxs)("div",{className:"bg-surface border border-border rounded-xl p-6 w-full max-w-sm flex flex-col gap-4 shadow-xl",children:[(0,a.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Required for SSL certificate and server startup"})]}),(0,a.jsx)(l.pd,{type:"password",placeholder:"Enter sudo password",value:m,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"!==e.key||o||M()}}),y&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,a.jsx)("span",{children:y})]}),(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,a.jsx)(l.$n,{variant:"ghost",size:"sm",onClick:()=>{x(!1),u(""),b(null)},disabled:o,children:"Cancel"}),(0,a.jsx)(l.$n,{variant:"primary",size:"sm",onClick:M,loading:o,children:"Confirm"})]})]})})]})}var _=s(40295);function E({tool:e,isExpanded:t,onToggle:s,serverRunning:i,dnsActive:o,hasCachedPassword:d,apiKeys:c,activeProviders:x,hasActiveProviders:m,modelAliases:u={},cloudEnabled:p,onDnsChange:h,tokenSwapActive:g=!1}){let[f,y]=(0,r.useState)(!1),[j,C]=(0,r.useState)(null),[S,A]=(0,r.useState)(null),[T,O]=(0,r.useState)(!1),[R,I]=(0,r.useState)(""),[P,D]=(0,r.useState)(null),[U,z]=(0,r.useState)(null),{currentEditingAlias:L,handleAddMapping:F,handleMappingBlur:K,handleModelMappingChange:q,handleModelSelect:H,handleRemoveMapping:B,handleReorderMapping:W,handleStrategyChange:J,loadSavedMappings:G,mappingFeedback:Z,modalOpen:Y,modelMappings:V,openModelSelector:Q,selectedStrategy:X,setModalOpen:ee}=function(e){let[t,s]=(0,r.useState)({}),[a,l]=(0,r.useState)("round-robin"),[n,i]=(0,r.useState)(!1),[o,d]=(0,r.useState)(null),[c,x]=(0,r.useState)(null),[m,u]=(0,r.useState)(null),p=(0,r.useCallback)(async()=>{try{let t=await fetch(`/api/cli-tools/antigravity-mitm/alias?tool=${e}`);if(!t.ok)return;let a=await t.json();s(v(a.aliases)),l(k(a.strategy))}catch{}},[e]),h=(0,r.useCallback)(async(t,s)=>{try{await fetch("/api/cli-tools/antigravity-mitm/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e,mappings:v(t),strategy:k(s)})})}catch{}},[e]),g=(0,r.useCallback)((e,t=null)=>{d(e),x(t),i(!0)},[]),f=(0,r.useCallback)((e,t="")=>{s(s=>N(s,e,t))},[]),y=(0,r.useCallback)((e,t,a)=>{s(s=>w(s,e,t,a))},[]),b=(0,r.useCallback)((e,t,r)=>{s(s=>{let l=Array.isArray(s?.[e])?s[e].length:0,n=function(e,t,s,a){let r=Array.isArray(e?.[t])?[...e[t]]:[];if(s<0||s>=r.length)return e;let l=r.slice(0,s),n=r.slice(s+1),i=Math.max(0,5-l.length-n.length),o=[...l,...String(a||"").split(",").map(e=>e.trim()).filter(Boolean).slice(0,i),...n].slice(0,5);if(0===o.length){let{[t]:s,...a}=e||{};return a}return{...e,[t]:o}}(s,e,t,r),i=Array.isArray(n?.[e])?n[e].length:0,o=String(r||"").split(",").map(e=>e.trim()).filter(Boolean).length;return o>1||i<l?u(i<l?`Max 5 targets per alias. Extra models were ignored for ${e}.`:`Expanded ${o} targets for ${e}.`):u(null),h(n,a),n})},[h,a]),j=(0,r.useCallback)((e,t)=>{s(s=>{let r=function(e,t,s){let a=(Array.isArray(e?.[t])?e[t]:[]).filter((e,t)=>t!==s);if(0===a.length){let{[t]:s,...a}=e||{};return a}return{...e,[t]:a}}(s,e,t);return h(r,a),r})},[h,a]),C=(0,r.useCallback)((e,t,r)=>{s(s=>{let l=function(e,t,s,a){let r=Array.isArray(e?.[t])?[...e[t]]:[];if(s<0||a<0||s>=r.length||a>=r.length||s===a)return e;let[l]=r.splice(s,1);return r.splice(a,0,l),{...e,[t]:r}}(s,e,t,r);return h(l,a),l})},[h,a]),S=(0,r.useCallback)(e=>{o&&!e.isPlaceholder&&(s(t=>{let s=null===c?N(t,o,e.value):w(t,o,c,e.value),r=Array.isArray(t?.[o])?t[o].length:0,l=Array.isArray(s?.[o])?s[o].length:0;return u(null===c&&l===r?`Max 5 targets per alias. Remove one before adding another for ${o}.`:null),h(s,a),s}),i(!1),x(null))},[o,c,h,a]);return{currentEditingAlias:o,currentEditingIndex:c,handleAddMapping:f,handleMappingBlur:b,handleModelMappingChange:y,handleModelSelect:S,handleRemoveMapping:j,handleReorderMapping:C,handleStrategyChange:(0,r.useCallback)(e=>{let t=k(e);l(t),s(e=>(h(e,t),e))},[h]),loadSavedMappings:p,mappingFeedback:m,modalOpen:n,modelMappings:t,openModelSelector:g,selectedStrategy:a,setCurrentEditingIndex:x,setMappingFeedback:u,setModalOpen:i}}(e.id),et=_.TOOL_HOSTS[e.id]??[],es="u">typeof navigator&&navigator.userAgent?.includes("Windows"),ea="antigravity"===e.id&&!t;(0,r.useEffect)(()=>{t&&G()},[t,G]);let er=()=>{if(!i)return;let e=o?"disable":"enable";es||d?el(e,""):(D(e),O(!0),z(null))},el=async(t,s)=>{y(!0),C(null),A(null);try{let a=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e.id,action:t,sudoPassword:s})}),r=await a.json().catch(()=>({}));if(!a.ok)throw Error(r.error||`Failed to ${t} DNS`);"enable"===t&&C(`Restart ${e.name} to apply changes`),O(!1),I(""),h?.(r)}catch(e){A(e.message||`Failed to ${t} DNS`)}finally{y(!1),D(null)}},en=()=>{R?el(P,R):z("Sudo password is required")};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(l.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(n.default,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),e.supportsTokenSwap&&(0,a.jsx)("span",{className:"text-[9px] uppercase tracking-wider text-text-muted bg-surface border border-border px-1.5 py-0.5 rounded font-semibold",children:"Mode A"}),i?g?(0,a.jsx)(l.Ex,{variant:"default",size:"sm",children:"Bypassed"}):o?(0,a.jsx)(l.Ex,{variant:"success",size:"sm",children:"Active"}):(0,a.jsx)(l.Ex,{variant:"warning",size:"sm",children:"DNS off"}):(0,a.jsx)(l.Ex,{variant:"default",size:"sm",children:"Server off"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Model routing — remap model IDs in intercepted requests"})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[ea&&(0,a.jsxs)("div",{className:"flex items-center gap-2",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)(M,{compact:!0}),(0,a.jsx)($,{dnsActive:o,loading:f,serverRunning:i,onClick:er,compact:!0})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[g&&(0,a.jsxs)("div",{className:"flex items-start gap-2 px-2 py-2 rounded-lg bg-violet-500/5 border border-violet-500/15",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-violet-400 mt-0.5 shrink-0",children:"info"}),(0,a.jsx)("p",{className:"text-[11px] text-violet-400",children:"Token Rotation (Mode B) is active — model routing is currently bypassed. Disable Token Rotation to use model routing."})]}),"antigravity"===e.id&&(0,a.jsx)(M,{}),et.length>0&&(0,a.jsxs)("div",{className:"mt-2 rounded-md border border-border bg-surface/50 px-2 py-1.5",children:[(0,a.jsx)("p",{className:"text-[10px] font-medium tracking-wide text-text-main/80 mb-1",children:"Edit hosts file manually to add the following entries:"}),(0,a.jsx)("ul",{className:"list-none space-y-0.5 font-mono text-[10px] text-text-muted break-all",children:et.map(e=>(0,a.jsxs)("li",{children:["127.0.0.1 ",e]},e))})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-0.5 text-[11px] text-text-muted px-1",children:[(0,a.jsxs)("p",{children:["Toggle DNS to redirect ",e.name," traffic through 9Router via MITM."]}),!o&&(0,a.jsx)("p",{className:"text-amber-600 text-[10px] mt-1",children:"⚠️ Enable DNS to edit model mappings"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 items-start",children:[(0,a.jsx)($,{dnsActive:o,loading:f,serverRunning:i,onClick:er}),j&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs text-amber-500",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"warning"}),(0,a.jsx)("span",{children:j})]}),S&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,a.jsx)("span",{children:S})]})]}),e.defaultModels?.length>0&&(0,a.jsx)(b,{tool:e,mappings:V,strategy:X,dnsActive:o,hasActiveProviders:m,onChangeEntry:q,onBlurEntry:K,onOpenSelector:Q,onAddEntry:t=>F(t,`${e.id}/model-id`),onRemoveEntry:B,onReorderEntry:W,onChangeStrategy:J,feedback:Z}),e.defaultModels?.length===0&&(0,a.jsx)("p",{className:"text-xs text-text-muted px-1",children:"Model mappings will be available soon."})]})]}),T&&(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,a.jsxs)("div",{className:"bg-surface border border-border rounded-xl p-6 w-full max-w-sm flex flex-col gap-4 shadow-xl",children:[(0,a.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Required to modify /etc/hosts and flush DNS cache"})]}),(0,a.jsx)(l.pd,{type:"password",placeholder:"Enter sudo password",value:R,onChange:e=>I(e.target.value),onKeyDown:e=>{"Enter"!==e.key||f||en()}}),U&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,a.jsx)("span",{children:U})]}),(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,a.jsx)(l.$n,{variant:"ghost",size:"sm",onClick:()=>{O(!1),I(""),z(null)},disabled:f,children:"Cancel"}),(0,a.jsx)(l.$n,{variant:"primary",size:"sm",onClick:en,loading:f,children:"Confirm"})]})]})}),(0,a.jsx)(l.rq,{isOpen:Y,onClose:()=>ee(!1),onSelect:H,selectedModel:L?V[L]?.[0]:null,activeProviders:x,modelAliases:u,title:`Add mapped model for ${L}`})]})}function $({dnsActive:e,loading:t,serverRunning:s,onClick:r,compact:l=!1}){let n=e?"Stop DNS":"Start DNS";return(0,a.jsxs)("button",{type:"button",onClick:r,disabled:!s||t,className:`${l?"px-2.5 py-1.5":"px-4 py-1.5"} rounded-lg border font-medium text-xs flex items-center gap-1.5 transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${e?"bg-red-500/10 border-red-500/30 text-red-500 hover:bg-red-500/20":"bg-primary/10 border-primary/30 text-primary hover:bg-primary/20"}`,title:s?n:"MITM server is not running",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] ${t?"animate-spin":""}`,children:t?"progress_activity":e?"stop_circle":"play_circle"}),(0,a.jsx)("span",{className:l?"hidden sm:inline":"",children:t?"Working...":n})]})}function M({compact:e=!1}){let[t,s]=(0,r.useState)(null),[l,n]=(0,r.useState)(!1),[i,o]=(0,r.useState)(null),d=(0,r.useCallback)(async({signal:e}={})=>{try{let t=await fetch("/api/antigravity-ide",{signal:e});t.ok&&s(await t.json())}catch(e){if(e?.name==="AbortError")return}},[]);(0,r.useEffect)(()=>{let e=new AbortController,t=window.setTimeout(()=>{d({signal:e.signal})},0),s=window.setInterval(()=>{d({signal:e.signal})},5e3);return()=>{e.abort(),window.clearTimeout(t),window.clearInterval(s)}},[d]);let c=async()=>{n(!0),o(null);try{let e=await fetch("/api/antigravity-ide",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"close"})}),t=await e.json();o(t),setTimeout(d,1e3)}catch(e){o({success:!1,error:e.message})}n(!1)};return(0,a.jsxs)("div",{className:`flex items-center gap-2 ${e?"":"px-1"}`,children:[(0,a.jsxs)("button",{type:"button",onClick:c,disabled:l||!t?.running,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs font-medium border border-red-500/30 text-red-500 bg-red-500/5 hover:bg-red-500/15 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:t?.running?"Close all Antigravity IDE processes":"Antigravity IDE is not running",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${l?"animate-spin":""}`,children:l?"progress_activity":"close"}),(0,a.jsx)("span",{className:e?"hidden sm:inline":"",children:l?"Closing...":"Close IDE"})]}),t&&(0,a.jsxs)("span",{className:`flex items-center gap-1 text-text-muted whitespace-nowrap ${e?"text-[11px]":"text-[10px]"}`,children:[(0,a.jsx)("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${!t.installed?"bg-gray-400":t.running?"bg-green-500":"bg-red-400"}`}),t.installed?t.running?"Running":"Stopped":"Not installed"]}),i&&!l&&!e&&(0,a.jsxs)("span",{className:`text-[10px] ${i.success?"text-green-500":"text-red-400"}`,children:[i.success?"✓":"✗"," ",i.message||i.error]})]})}var T=s(98500),O=s.n(T);function R(e){if(null==e)return null;let t=String(e).trim();if(!t)return null;let s=t.toLowerCase();return s.includes("ultra")?"Ultra":s.includes("pro")?"Pro":s.includes("free")?"Free":null}["Free","Pro","Ultra"].map(e=>({value:e,label:e}));var I=s(57294);function P(e){if(!e||"string"!=typeof e)return e;let t=e.indexOf("@");if(t<=0||t===e.length-1)return e;let s=e.slice(0,t),a=e.slice(t+1);return 1===s.length?`${s[0]}**@${a}`:2===s.length?`${s[0]}**${s[1]}@${a}`:`${s[0]}**${s[s.length-1]}@${a}`}function D({tool:e,connections:t=[],serverRunning:s,dnsActive:n,onToggle:i,onRefreshConnections:o}){let[d,c]=(0,r.useState)(!1),[x,m]=(0,r.useState)(!1),[u,p]=(0,r.useState)("round-robin"),[h,g]=(0,r.useState)(!1),[f,y]=(0,r.useState)(!1),[b,j]=(0,r.useState)(!1),[v,N]=(0,r.useState)(3),[w,k]=(0,r.useState)({}),[C,S]=(0,r.useState)(null),[A,_]=(0,r.useState)(null),[E,$]=(0,r.useState)(!1),[M,T]=(0,r.useState)({}),U=(0,r.useRef)({}),z=(0,r.useRef)(null),L=(0,r.useRef)({}),[F,K]=(0,r.useState)({}),q=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/settings");if(e.ok){let t=await e.json();c(!!t.tokenSwapEnabled),p(t.tokenSwapStrategy||"round-robin"),y(!!t.tokenSwapMaskEmails),N(t.antigravity503RetryCount??3)}}catch{}},[]);(0,r.useEffect)(()=>{q()},[q]),(0,r.useEffect)(()=>{k(e=>{let s={...e};return t.forEach(e=>{e.id in s||(s[e.id]=null!=e.antigravity503RetryCount?String(e.antigravity503RetryCount):"")}),s})},[t]);let H=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/internal/account-health");if(!e.ok)return;let t=await e.json();K(t.accounts||{})}catch{}},[]),B=(0,r.useCallback)(async(t,s=!1)=>{if(!t||0===t.length)return;let a=Date.now(),r=[],l={};if(t.forEach(e=>{let t=U.current[e.id];!s&&t&&a-t.ts<12e4?l[e.id]={quotas:t.data,error:t.error,loading:!1,accountType:t.accountType||null}:r.push(e)}),Object.keys(l).length>0&&T(e=>({...e,...l})),0===r.length)return;let n={};r.forEach(e=>{n[e.id]={quotas:[],error:null,loading:!0}}),T(e=>({...e,...n})),await Promise.all(r.map(async t=>{try{let s=await fetch(`/api/usage/${t.id}`);if(!s.ok){let e=(await s.json().catch(()=>({}))).error||`HTTP ${s.status}`;U.current[t.id]={data:[],error:e,ts:Date.now(),accountType:null},T(s=>({...s,[t.id]:{quotas:[],error:e,loading:!1,accountType:null}}));return}let a=await s.json(),r=(0,I.W_)(e.tokenSwapProvider||"antigravity",a),l=function(e){if(!e)return null;if("string"==typeof e)return R(e);for(let t of[e.accountType,e.plan,e.paidTier?.name,e.subscriptionTier,e.subscription_tier,e.currentTier?.name,e.subscriptionInfo?.paidTier?.name,e.quota?.subscription_tier,e.subscriptionInfo?.currentTier?.name]){let e=R(t);if(e)return e}return null}(a);U.current[t.id]={data:r,error:null,ts:Date.now(),accountType:l},T(e=>({...e,[t.id]:{quotas:r,error:null,loading:!1,accountType:l}}))}catch(s){let e=s.message||"Failed";U.current[t.id]={data:[],error:e,ts:Date.now(),accountType:null},T(s=>({...s,[t.id]:{quotas:[],error:e,loading:!1,accountType:null}}))}}))},[e.tokenSwapProvider]);if(!e?.supportsTokenSwap)return null;let W=async()=>{m(!0);let e=!d;try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tokenSwapEnabled:e})})).ok&&(c(e),i?.(e))}catch{}m(!1)},J=async e=>{if(e!==u&&!h){g(!0);try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tokenSwapStrategy:e})})).ok&&p(e)}catch{}g(!1)}},G=async()=>{if(b)return;j(!0);let e=!f;try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tokenSwapMaskEmails:e})})).ok&&y(e)}catch{}j(!1)},Z=t.filter(t=>t.provider===e.tokenSwapProvider),Y=Z.filter(e=>!1!==e.isActive),V=Y.length,Q=Z.map(e=>`${e.id}:${!1===e.isActive?"0":"1"}`).join("|"),X=function(e,t){if(!e||0===e.length)return null;if(1===e.length)return e[0].id;let s=[...e].sort((e,t)=>e.lastUsedAt||t.lastUsedAt?e.lastUsedAt?t.lastUsedAt?new Date(t.lastUsedAt)-new Date(e.lastUsedAt):-1:1:(e.priority||999)-(t.priority||999));if("sticky"===t)return s[0]?.id||null;let a=[...e].sort((e,t)=>e.lastUsedAt||t.lastUsedAt?e.lastUsedAt?t.lastUsedAt?new Date(e.lastUsedAt)-new Date(t.lastUsedAt):1:-1:(e.priority||999)-(t.priority||999));return a[0]?.id||null}(Y,u);(0,r.useEffect)(()=>{d&&Z.length>0&&B(Z)},[d,Z.length,Q,B]),(0,r.useEffect)(()=>{if(!d||0===V)return;H();let e=setInterval(H,1e4);return()=>clearInterval(e)},[d,V,H]);let ee=s&&n,et=d&&ee&&V>0,es=e=>{let t=(e=>{let t=M[e];if(!t)return{state:"empty"};if(t.loading)return{state:"loading"};if(t.error)return{state:"error",error:t.error};if(!t.quotas||0===t.quotas.length)return{state:"no-data"};let s=t.quotas.find(e=>e.modelKey?.includes("claude-sonnet-4-6")||e.name?.toLowerCase().includes("opus"))||t.quotas[0];if(!s)return{state:"no-data"};let a=void 0!==s.remainingPercentage?Math.round(s.remainingPercentage):s.total>0?Math.round((s.total-s.used)/s.total*100):null,r=(s.resetAt&&new Date(s.resetAt).getTime()>Date.now()?s.resetAt:null)||[...t.quotas].map(e=>e.resetAt).filter(Boolean).filter(e=>new Date(e).getTime()>Date.now()).sort((e,t)=>new Date(e).getTime()-new Date(t).getTime())[0]||null;return{state:null===a?"no-data":"ready",highlight:s,accountType:t.accountType||null,pct:a,nextResetAt:r,resetCountdown:(0,I.mO)(r),resetDisplay:(0,I.sQ)(r)}})(e);if(!t||"empty"===t.state)return(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"Enable to load quota data"});if("loading"===t.state)return(0,a.jsx)("span",{className:"text-[10px] text-text-muted animate-pulse",children:"Loading quota…"});if("error"===t.state)return(0,a.jsx)("span",{className:"text-[10px] text-red-400",title:t.error,children:"Quota unavailable"});if("no-data"===t.state)return(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"No quota data"});let{highlight:s,pct:r,resetCountdown:l,resetDisplay:n}=t;return(0,a.jsxs)("div",{className:"flex flex-col gap-1.5 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)("span",{className:"text-[10px] text-text-muted truncate",children:s.name}),(0,a.jsx)("div",{className:"flex-1 h-1.5 rounded-full bg-surface-alt overflow-hidden min-w-[56px]",children:(0,a.jsx)("div",{className:`h-full rounded-full ${r>70?"bg-green-500":r>=30?"bg-yellow-500":"bg-red-500"}`,style:{width:`${Math.min(r,100)}%`}})}),(0,a.jsxs)("span",{className:`text-[10px] font-medium shrink-0 ${r>70?"text-green-500":r>=30?"text-yellow-500":"text-red-500"}`,children:[r,"%"]})]}),"-"!==l&&n?(0,a.jsxs)("div",{className:"text-[10px] text-text-muted",children:["Reset in ",(0,a.jsx)("span",{className:"text-text-main",children:l}),(0,a.jsxs)("span",{className:"text-text-muted/70",children:[" • ",n]})]}):(0,a.jsx)("div",{className:"text-[10px] text-text-muted",children:"Reset time unavailable"})]})},ea=async(e,t)=>{if(e&&!C&&!A){S(e);try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&await o?.()}catch{}S(null)}},er=async e=>{!e?.id||A||E||C||(_(e.id),delete U.current[e.id],await B([e],!0),_(null))},el=async()=>{E||A||0===Z.length||($(!0),Z.forEach(e=>{delete U.current[e.id]}),await B(Z,!0),$(!1))},en=async e=>{let t=Math.max(0,Math.min(20,isNaN(e)?3:e));N(t),z.current&&clearTimeout(z.current),z.current=setTimeout(async()=>{try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({antigravity503RetryCount:t})})}catch{}},500)},ei=(e,t)=>{if(t)k(t=>({...t,[e]:""})),L.current[e]&&clearTimeout(L.current[e]),fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({antigravity503RetryCount:null})}).catch(()=>{});else{let t=String(v);k(s=>({...s,[e]:t})),fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({antigravity503RetryCount:v})}).catch(()=>{})}};return(0,a.jsxs)(l.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0 rounded-lg bg-violet-500/10",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-violet-400 text-[18px]",children:"swap_horiz"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:"Token Rotation"}),(0,a.jsx)("span",{className:"text-[9px] uppercase tracking-wider text-text-muted bg-surface border border-border px-1.5 py-0.5 rounded font-semibold",children:"Mode B"}),et?(0,a.jsx)(l.Ex,{variant:"success",size:"sm",children:"Active"}):d?(0,a.jsx)(l.Ex,{variant:"warning",size:"sm",children:"Enabled"}):(0,a.jsx)(l.Ex,{variant:"default",size:"sm",children:"Off"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Rotate auth tokens across pool accounts to bypass per-account quota"})]})]}),(0,a.jsx)("button",{onClick:W,disabled:x,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors shrink-0 ${d?"bg-violet-500":"bg-surface-alt border border-border"} ${x?"opacity-50":"cursor-pointer"}`,title:d?"Disable Token Rotation":"Enable Token Rotation",children:(0,a.jsx)("span",{className:`inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform shadow-sm ${d?"translate-x-4":"translate-x-0.5"}`})})]}),d&&(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-border/50 flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex items-start gap-2 px-2 py-2 rounded-lg bg-violet-500/5 border border-violet-500/15",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-violet-400 mt-0.5 shrink-0",children:"info"}),(0,a.jsxs)("div",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,a.jsx)("p",{children:"Intercepts Antigravity requests → swaps IDE's auth token with a pool account → auto-retries on 429 quota error with next account in pool."}),(0,a.jsx)("p",{className:"mt-1 text-violet-400/80 font-medium",children:"⚠ When active, Model Routing (Mode A) is bypassed."})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1.5 px-1",children:[(0,a.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-text-muted font-semibold",children:"Rotation Strategy"}),(0,a.jsxs)("div",{className:"flex gap-1.5",children:[(0,a.jsxs)("button",{onClick:()=>J("round-robin"),disabled:h,className:`flex-1 flex flex-col items-center gap-0.5 px-2 py-2 rounded-lg border text-[11px] font-medium transition-colors ${"round-robin"===u?"border-violet-500/50 bg-violet-500/10 text-violet-400":"border-border bg-surface text-text-muted hover:border-border-alt"} disabled:opacity-50`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"autorenew"}),"Round Robin"]}),(0,a.jsxs)("button",{onClick:()=>J("sticky"),disabled:h,className:`flex-1 flex flex-col items-center gap-0.5 px-2 py-2 rounded-lg border text-[11px] font-medium transition-colors ${"sticky"===u?"border-violet-500/50 bg-violet-500/10 text-violet-400":"border-border bg-surface text-text-muted hover:border-border-alt"} disabled:opacity-50`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"push_pin"}),"Sticky"]})]}),(0,a.jsx)("p",{className:"text-[10px] text-text-muted px-0.5",children:"sticky"===u?"Stays on the same account until its quota is exhausted for the requested model, then switches. Optimizes session-level token cache.":"Chooses the least recently used eligible account first. Each successful request updates that account's last-used time."})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1 px-1",children:[(0,a.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-text-muted font-semibold mb-0.5",children:"Prerequisites"}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${s?"text-green-500":"text-red-400"}`,children:s?"check_circle":"cancel"}),(0,a.jsx)("span",{className:s?"text-text-main":"text-text-muted",children:"MITM Server"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${n?"text-green-500":"text-red-400"}`,children:n?"check_circle":"cancel"}),(0,a.jsxs)("span",{className:n?"text-text-main":"text-text-muted",children:["DNS redirect",!n&&(0,a.jsx)("span",{className:"text-[10px] text-text-muted ml-1",children:"— enable via Antigravity card above"})]})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1 px-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-0.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-text-muted font-semibold",children:"Pool Accounts"}),(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:Z.length>0?`${V}/${Z.length} active`:"none"}),V>1&&(0,a.jsx)("span",{className:"text-[9px] text-text-muted bg-surface border border-border px-1 py-0.5 rounded",children:"round-robin"})]}),Z.length>0&&(0,a.jsxs)("button",{onClick:el,disabled:E||!!A,className:"inline-flex items-center gap-1 rounded-md border border-border bg-surface px-2 py-1 text-[10px] font-medium text-text-main hover:border-border-alt hover:bg-surface-alt disabled:opacity-50 disabled:cursor-not-allowed transition-colors",title:"Refresh quotas for all pool accounts, including disabled accounts",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[12px] ${E?"animate-spin":""}`,children:"refresh"}),E?"Refreshing…":"Refresh All"]})]}),(0,a.jsx)("p",{className:"text-[10px] text-text-muted px-0.5",children:"Round robin uses least-recently-used ordering. Accounts with no usage timestamp are tried first, then older timestamps rotate ahead of newer ones."}),(0,a.jsxs)("div",{className:"flex items-center gap-2 px-1.5 py-1.5 rounded-lg border border-border bg-surface-alt/40",children:[(0,a.jsxs)("button",{onClick:G,disabled:b,title:`${f?"Disable":"Enable"} email masking — hides pool account emails in logs and this panel (e.g. ${P("email@gmail.com")})`,className:`flex items-center gap-1.5 flex-1 min-w-0 px-1.5 py-1 rounded-md transition-colors text-left ${b?"opacity-50":"hover:bg-surface-alt cursor-pointer"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[13px] shrink-0 ${f?"text-violet-400":"text-text-muted"}`,children:"alternate_email"}),(0,a.jsx)("span",{className:`text-[11px] font-medium truncate ${f?"text-violet-300":"text-text-muted"}`,children:"Mask emails"}),(0,a.jsx)("span",{className:`relative inline-flex h-4 w-7 items-center rounded-full transition-colors shrink-0 ml-auto ${f?"bg-violet-500":"bg-surface-alt border border-border"}`,children:(0,a.jsx)("span",{className:`inline-block h-2.5 w-2.5 transform rounded-full bg-white transition-transform shadow-sm ${f?"translate-x-3.5":"translate-x-0.5"}`})})]}),(0,a.jsx)("div",{className:"w-px h-5 bg-border shrink-0"}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",title:'Global 503 retry count (0–20). Retry "high traffic" errors on same account before switching. Each account row can override this.',children:[(0,a.jsx)("span",{className:"text-[11px] text-text-muted whitespace-nowrap",children:"503 retries"}),(0,a.jsx)("input",{type:"number",min:"0",max:"20",step:"1",value:v,onChange:e=>en(parseInt(e.target.value)),className:"w-10 rounded border border-border bg-surface px-1 py-0.5 text-[11px] text-text-main text-center focus:outline-none focus:border-violet-500 transition-colors",title:"Global 503 retry count (0-20). Each account can override this."})]})]}),Z.length>0?(0,a.jsxs)(a.Fragment,{children:[Z.map(e=>{let t,s=R(M[e.id]?.accountType)||R(e.accountType)||null;return(0,a.jsxs)("div",{className:`rounded-xl border border-border bg-surface-alt/30 px-3 py-2.5 transition-colors ${!1===e.isActive?"opacity-65":"hover:bg-surface-alt/50"}`,children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] shrink-0 ${!1===e.isActive?"text-text-muted":"text-green-500"}`,children:!1===e.isActive?"pause_circle":"check_circle"}),(0,a.jsx)("span",{className:"text-xs font-medium text-text-main truncate",children:e.email?f?P(e.email):e.email:e.name||e.id.slice(0,16)}),s&&(0,a.jsx)(l.Ex,{variant:"Ultra"===s?"warning":"Pro"===s?"primary":"Free"===s?"info":"default",size:"sm",children:s}),X===e.id&&!1!==e.isActive&&(0,a.jsx)("span",{className:"text-[9px] text-violet-300 bg-violet-500/10 border border-violet-500/20 px-1 py-0.5 rounded shrink-0",children:"next"}),(0,a.jsx)(l.Ex,{variant:!1===e.isActive?"default":"success",size:"sm",children:!1===e.isActive?"disabled":"active"})]}),(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap text-[10px] text-text-muted",children:[(0,a.jsxs)("span",{children:["Priority #",e.priority??"-"]}),e.lastUsedAt&&(0,a.jsxs)("span",{children:["Last used ",new Date(e.lastUsedAt).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})]}),null!=(t=w[e.id])&&""!==t?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 rounded bg-violet-500/10 border border-violet-500/20 px-1.5 py-0.5",title:`Custom 503 retry count for this account. Global default: ${v}. Auto-saves. Click ↩ to revert.`,children:[(0,a.jsx)("span",{className:"text-violet-300",children:"503:"}),(0,a.jsx)("input",{type:"number",min:"0",max:"20",step:"1",value:t,onChange:t=>{var s,a;return s=e.id,a=t.target.value,void(k(e=>({...e,[s]:a})),L.current[s]&&clearTimeout(L.current[s]),L.current[s]=setTimeout(async()=>{let e=""===a?null:Math.max(0,Math.min(20,parseInt(a)||0));try{await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({antigravity503RetryCount:e})})}catch{}},500))},className:"w-8 rounded border-none bg-transparent text-[10px] text-center text-violet-200 focus:outline-none [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",title:`Custom 503 retry count for this account (global: ${v}). Auto-saves as you type.`,autoFocus:!0}),(0,a.jsx)("button",{onClick:()=>ei(e.id,!0),className:"text-violet-400/70 hover:text-text-muted transition-colors leading-none",title:`Revert to global default (${v})`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"undo"})})]}):(0,a.jsxs)("button",{onClick:()=>ei(e.id,!1),className:"inline-flex items-center gap-0.5 rounded px-1.5 py-0.5 text-text-muted hover:bg-surface-alt hover:text-text-main transition-colors",title:`Using global 503 retry count (${v}). Click to set a custom value for this account only.`,children:[(0,a.jsxs)("span",{children:["503: ",v]}),(0,a.jsx)("span",{className:"text-[10px] opacity-60 leading-none",children:"✎"})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[(0,a.jsxs)("button",{onClick:()=>er(e),disabled:!!A||C===e.id,className:"inline-flex items-center gap-1 rounded-md border border-border bg-surface px-2 py-1 text-[10px] font-medium text-text-main hover:border-border-alt hover:bg-surface-alt disabled:opacity-50 disabled:cursor-not-allowed transition-colors",title:"Force-refresh quota for this account",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"refresh"}),A===e.id?"…":"Refresh Quota"]}),(0,a.jsx)(l.lM,{size:"sm",checked:!1!==e.isActive,disabled:!!A||C===e.id,onChange:t=>ea(e.id,t)})]})]}),(0,a.jsxs)("div",{className:"mt-2 pl-6",children:[!1===e.isActive?(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"text-[10px] text-text-muted",children:"Disabled; excluded from token rotation."}),es(e.id)]}):es(e.id),(e=>{let t=F[e];if(!t||0===t.length)return null;let s=t.filter(e=>"success"===e.status).length,r=t.filter(e=>"retry_success"===e.status).length,l=t.filter(e=>"fail"===e.status).length;return(0,a.jsxs)("div",{className:"mt-1.5",children:[(0,a.jsx)("div",{className:"flex flex-wrap gap-[2px]",title:`Last ${t.length} call${1!==t.length?"s":""}${s?` \xb7 ${s} ok`:""}${r?` \xb7 ${r} retry`:""}${l?` \xb7 ${l} fail`:""}`,children:t.map((e,t)=>{let s,r;return(0,a.jsx)("div",{className:"rounded-[1px] shrink-0",style:{width:"6px",height:"6px",backgroundColor:"success"===e.status?"#22c55e":"fail"===e.status?"#ef4444":e.attempts<=2?"#fb923c":e.attempts<=3?"#f97316":"#ea580c",opacity:.85},title:(s=new Date(e.ts).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}),r=Number(e.attempts)||1,"success"===e.status?`${s} — ✅ Success`:"fail"===e.status?`${s} — ❌ Failed`:`${s} — 🔄 Success after ${r} attempt${1!==r?"s":""}`)},t)})}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,a.jsxs)("span",{className:"text-[9px] text-text-muted",children:["last ",t.length," call",1!==t.length?"s":""]}),s>0&&(0,a.jsxs)("span",{className:"text-[9px] text-green-500",children:[s," ok"]}),r>0&&(0,a.jsxs)("span",{className:"text-[9px] text-orange-400",children:[r," retry"]}),l>0&&(0,a.jsxs)("span",{className:"text-[9px] text-red-400",children:[l," fail"]})]})]})})(e.email||e.id)]})]},e.id)}),(0,a.jsxs)(O(),{href:"/dashboard/providers",className:"text-[11px] text-primary hover:underline flex items-center gap-1 px-1 mt-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"open_in_new"}),"Manage accounts"]})]}):(0,a.jsx)("div",{className:"px-1",children:(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["No active ",e.name," accounts in pool."," ",(0,a.jsx)(O(),{href:"/dashboard/providers",className:"text-primary hover:underline",children:"Add account →"})]})})]}),!ee&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-amber-500/10 text-amber-600 border border-amber-500/20",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"warning"}),(0,a.jsx)("span",{children:"Start MITM server and enable DNS to activate token rotation"})]})]})]})}function U({tool:e}){return(0,a.jsx)(O(),{href:"/dashboard/mitm",className:"block",children:(0,a.jsx)(l.Zp,{padding:"sm",className:"overflow-hidden hover:border-primary/50 transition-colors cursor-pointer",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(n.default,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-purple-500/10 text-purple-600 dark:text-purple-400 rounded-full",children:"MITM"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[20px]",children:"chevron_right"})]})})})}},40295:e=>{e.exports={TOOL_HOSTS:{antigravity:["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com"],copilot:["api.individual.githubcopilot.com"],kiro:["q.us-east-1.amazonaws.com","codewhisperer.us-east-1.amazonaws.com"],cursor:["api2.cursor.sh"]}}},57294:(e,t,s)=>{s.d(t,{$4:()=>n,W_:()=>i,mO:()=>r,sQ:()=>l});var a=s(45564);function r(e){if(!e)return"-";try{let t="string"==typeof e?new Date(e):e,s=new Date,a=t-s;if(a<=0)return"-";let r=Math.ceil(a/6e4);if(r<60)return`${r}m`;let l=Math.floor(r/60),n=r%60;if(l<24)return`${l}h ${n}m`;let i=Math.floor(l/24);return`${i}d ${l%24}h ${n}m`}catch(e){return"-"}}function l(e){if(!e)return null;try{let t="string"==typeof e?new Date(e):e,s=new Date,a=new Date(s.getFullYear(),s.getMonth(),s.getDate()),r=new Date(a);r.setDate(r.getDate()+1);let l=new Date(r);l.setDate(l.getDate()+1);let n="";n=t>=a&&t<r?"Today":t>=r&&t<l?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let i=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${n}, ${i}`}catch{return null}}function n(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}function i(e,t){if(!t||"object"!=typeof t)return[];let s=[];try{switch(e.toLowerCase()){case"github":default:t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"antigravity":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codex":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"kiro":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"claude":t.message?s.push({name:"error",used:0,total:0,resetAt:null,message:t.message}):t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}let r=(0,a.KC)(e);if(r.length>0){let e=new Map(r.map((e,t)=>[e.id,t]));s.sort((t,s)=>{let a=t.modelKey||t.name,r=s.modelKey||s.name;return(e.get(a)??999)-(e.get(r)??999)})}return s}}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2326],{70044:(e,t,a)=>{Promise.resolve().then(a.bind(a,75228))},75228:(e,t,a)=>{"use strict";a.d(t,{default:()=>u});var s=a(95155),i=a(12115),l=a(35497),o=a(3534),r=a(28777),c=a(16722);let n="https://9router.com",d={claude:"/api/cli-tools/claude-settings",codex:"/api/cli-tools/codex-settings",opencode:"/api/cli-tools/opencode-settings",droid:"/api/cli-tools/droid-settings",openclaw:"/api/cli-tools/openclaw-settings",hermes:"/api/cli-tools/hermes-settings"};function u({machineId:e}){let t,a,p,[v,h]=(0,i.useState)([]),[f,g]=(0,i.useState)(!0),[x,j]=(0,i.useState)(null),[b,w]=(0,i.useState)({}),[E,m]=(0,i.useState)(!1),[S,y]=(0,i.useState)(!1),[P,k]=(0,i.useState)(""),[N,A]=(0,i.useState)([]),[O,_]=(0,i.useState)({});(0,i.useEffect)(()=>{I(),M(),$(),C()},[]);let C=async()=>{try{let e=await Promise.all(Object.entries(d).map(async([e,t])=>{try{let a=await fetch(t),s=await a.json();return[e,s]}catch{return[e,null]}}));_(Object.fromEntries(e))}catch(e){console.log("Error fetching tool statuses:",e)}},M=async()=>{try{let[e,t]=await Promise.all([fetch("/api/settings"),fetch("/api/tunnel/status")]);if(e.ok){let t=await e.json();m(t.cloudEnabled||!1)}if(t.ok){let e=await t.json();y(e.enabled||!1),k(e.publicUrl||"")}}catch(e){console.log("Error loading settings:",e)}},$=async()=>{try{let e=await fetch("/api/keys");if(e.ok){let t=await e.json();A(t.keys||[])}}catch(e){console.log("Error fetching API keys:",e)}},I=async()=>{try{let e=await fetch("/api/providers"),t=await e.json();e.ok&&h(t.connections||[])}catch(e){console.log("Error fetching connections:",e)}finally{g(!1)}},Q=()=>v.filter(e=>!1!==e.isActive),T=(0,i.useCallback)((e,t,a)=>{w(s=>s[e]?.[t]===a?s:{...s,[e]:{...s[e],[t]:a}})},[]);if(f)return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(l.Qv,{}),(0,s.jsx)(l.Qv,{}),(0,s.jsx)(l.Qv,{})]});let U=(t=Q(),a=[],p=new Set,t.forEach(e=>{let t=r.Xg[e.provider]||e.provider;(0,r.KC)(e.provider).forEach(s=>{let i=`${t}/${s.id}`;p.has(i)||(p.add(i),a.push({value:i,label:`${t}/${s.id}`,provider:e.provider,alias:t,connectionName:e.name,modelId:s.id}))})}),a).length>0,Z=Object.entries(o.dM),q=Object.entries(o.wn);return(0,s.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,s.jsx)("div",{className:"flex flex-col gap-4",children:Z.map(([e,t])=>((e,t)=>{let a={tool:t,isExpanded:x===e,onToggle:()=>j(x===e?null:e),baseUrl:S&&P?P:E&&n?n:window.location.origin,apiKeys:N};switch(e){case"claude":return(0,s.jsx)(c.Tk,{...a,activeProviders:Q(),modelMappings:b[e]||{},onModelMappingChange:(t,a)=>T(e,t,a),hasActiveProviders:U,cloudEnabled:E,initialStatus:O.claude},e);case"codex":return(0,s.jsx)(c.Ah,{...a,activeProviders:Q(),cloudEnabled:E,initialStatus:O.codex},e);case"opencode":return(0,s.jsx)(c.qO,{...a,activeProviders:Q(),cloudEnabled:E,initialStatus:O.opencode},e);case"droid":return(0,s.jsx)(c.ZM,{...a,activeProviders:Q(),hasActiveProviders:U,cloudEnabled:E,initialStatus:O.droid},e);case"openclaw":return(0,s.jsx)(c.yZ,{...a,activeProviders:Q(),hasActiveProviders:U,cloudEnabled:E,initialStatus:O.openclaw},e);case"hermes":return(0,s.jsx)(c.RF,{...a,activeProviders:Q(),hasActiveProviders:U,cloudEnabled:E,initialStatus:O.hermes},e);default:return(0,s.jsx)(c.a7,{toolId:e,...a,activeProviders:Q(),cloudEnabled:E,tunnelEnabled:S},e)}})(e,t))}),(0,s.jsx)("div",{className:"flex flex-col gap-4",children:q.map(([e,t])=>(0,s.jsx)(c.gY,{tool:t},e))})]})}}},e=>{e.O(0,[2574,3862,1051,5772,1321,5497,6309,8441,3794,7358],()=>e(e.s=70044)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3649],{16474:(e,t,s)=>{Promise.resolve().then(s.bind(s,47295))},47295:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>i});var a=s(95155),l=s(12115),o=s(35497),r=s(11059);s(52679);let n=/^[a-zA-Z0-9_.\-]+$/;function i(){let[e,t]=(0,l.useState)([]),[s,n]=(0,l.useState)(!0),[i,c]=(0,l.useState)(!1),[x,h]=(0,l.useState)(null),[p,u]=(0,l.useState)([]),[b,f]=(0,l.useState)({}),{copied:g,copy:j}=(0,r.C)();(0,l.useEffect)(()=>{y()},[]);let y=async()=>{try{let[e,s,a]=await Promise.all([fetch("/api/combos"),fetch("/api/providers"),fetch("/api/settings")]),l=await e.json(),o=await s.json(),r=a.ok?await a.json():{};e.ok&&t(l.combos||[]),s.ok&&u(o.connections||[]),f(r.comboStrategies||{})}catch(e){console.log("Error fetching data:",e)}finally{n(!1)}},v=async e=>{try{let t=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)await y(),c(!1);else{let e=await t.json();alert(e.error||"Failed to create combo")}}catch(e){console.log("Error creating combo:",e)}},N=async(e,t)=>{try{let s=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(s.ok)await y(),h(null);else{let e=await s.json();alert(e.error||"Failed to update combo")}}catch(e){console.log("Error updating combo:",e)}},k=async s=>{if(confirm("Delete this combo?"))try{(await fetch(`/api/combos/${s}`,{method:"DELETE"})).ok&&t(e.filter(e=>e.id!==s))}catch(e){console.log("Error deleting combo:",e)}},w=async(e,t)=>{try{let s={...b};t?s[e]={fallbackStrategy:"round-robin"}:delete s[e],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:s})}),f(s)}catch(e){console.log("Error updating combo strategy:",e)}};return s?(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(o.Qv,{}),(0,a.jsx)(o.Qv,{})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold",children:"Combos"}),(0,a.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Create model combos with fallback support"})]}),(0,a.jsx)(o.$n,{icon:"add",onClick:()=>c(!0),children:"Create Combo"})]}),0===e.length?(0,a.jsx)(o.Zp,{children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"layers"})}),(0,a.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No combos yet"}),(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Create model combos with fallback support"}),(0,a.jsx)(o.$n,{icon:"add",onClick:()=>c(!0),children:"Create Combo"})]})}):(0,a.jsx)("div",{className:"flex flex-col gap-4",children:e.map(e=>(0,a.jsx)(d,{combo:e,copied:g,onCopy:j,onEdit:()=>h(e),onDelete:()=>k(e.id),roundRobinEnabled:b[e.name]?.fallbackStrategy==="round-robin",onToggleRoundRobin:t=>w(e.name,t)},e.id))}),(0,a.jsx)(m,{isOpen:i,onClose:()=>c(!1),onSave:v,activeProviders:p},"create"),(0,a.jsx)(m,{isOpen:!!x,combo:x,onClose:()=>h(null),onSave:e=>N(x.id,e),activeProviders:p},x?.id||"new")]})}function d({combo:e,copied:t,onCopy:s,onEdit:l,onDelete:r,roundRobinEnabled:n,onToggleRoundRobin:i}){return(0,a.jsx)(o.Zp,{padding:"sm",className:"group",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"size-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("code",{className:"text-sm font-medium font-mono truncate",children:e.name}),(0,a.jsxs)("div",{className:"flex items-center gap-1 mt-0.5 flex-wrap",children:[0===e.models.length?(0,a.jsx)("span",{className:"text-xs text-text-muted italic",children:"No models"}):e.models.slice(0,3).map((e,t)=>(0,a.jsx)("code",{className:"text-[10px] font-mono bg-black/5 dark:bg-white/5 px-1.5 py-0.5 rounded text-text-muted",children:e},t)),e.models.length>3&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted",children:["+",e.models.length-3," more"]})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,a.jsx)(o.lM,{size:"sm",checked:n,onChange:i})]}),(0,a.jsxs)("div",{className:"flex gap-1",children:[(0,a.jsxs)("button",{onClick:t=>{t.stopPropagation(),s(e.name,`combo-${e.id}`)},className:"flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary transition-colors",title:"Copy combo name",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:t===`combo-${e.id}`?"check":"content_copy"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Copy"})]}),(0,a.jsxs)("button",{onClick:l,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary transition-colors",title:"Edit",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,a.jsxs)("button",{onClick:r,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-red-500/10 text-red-500 transition-colors",title:"Delete",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]})]})]})})}function c({index:e,model:t,isFirst:s,isLast:o,onEdit:r,onMoveUp:n,onMoveDown:i,onRemove:d}){let[m,x]=(0,l.useState)(!1),[h,p]=(0,l.useState)(t),u=()=>{let e=h.trim();e&&e!==t?r(e):p(t),x(!1)};return(0,a.jsxs)("div",{className:"group flex items-center gap-1.5 px-2 py-1 rounded-md bg-black/[0.02] dark:bg-white/[0.02] hover:bg-black/[0.04] dark:hover:bg-white/[0.04] transition-colors",children:[(0,a.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:e+1}),m?(0,a.jsx)("input",{autoFocus:!0,value:h,onChange:e=>p(e.target.value),onBlur:u,onKeyDown:e=>{"Enter"===e.key&&u(),"Escape"===e.key&&(p(t),x(!1))},className:"flex-1 min-w-0 px-1.5 py-0.5 text-xs font-mono bg-white dark:bg-black/20 border border-primary/40 rounded outline-none text-text-main"}):(0,a.jsx)("div",{className:"flex-1 min-w-0 px-1.5 py-0.5 text-xs font-mono text-text-main truncate cursor-text hover:bg-black/5 dark:hover:bg-white/5 rounded",onClick:()=>x(!0),title:"Click to edit",children:t}),(0,a.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,a.jsx)("button",{onClick:n,disabled:s,className:`p-0.5 rounded ${s?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,a.jsx)("button",{onClick:i,disabled:o,className:`p-0.5 rounded ${o?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,a.jsx)("button",{onClick:d,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function m({isOpen:e,combo:t,onClose:s,onSave:r,activeProviders:i,kindFilter:d=null}){let[x,h]=(0,l.useState)(t?.name||""),[p,u]=(0,l.useState)(t?.models||[]),[b,f]=(0,l.useState)(!1),[g,j]=(0,l.useState)(!1),[y,v]=(0,l.useState)(""),[N,k]=(0,l.useState)({}),w=async()=>{try{let e=await fetch("/api/models/alias");if(!e.ok)return;let t=await e.json();k(t.aliases||{})}catch(e){console.error("Error fetching modal data:",e)}};(0,l.useEffect)(()=>{e&&w()},[e]);let C=e=>e.trim()?n.test(e)?(v(""),!0):(v("Only letters, numbers, -, _ and . allowed"),!1):(v("Name is required"),!1),S=async()=>{C(x)&&(j(!0),await r({name:x.trim(),models:p}),j(!1))},E=!!t;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.aF,{isOpen:e,onClose:s,title:E?"Edit Combo":"Create Combo",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(o.pd,{label:"Combo Name",value:x,onChange:e=>{let t=e.target.value;h(t),t?C(t):v("")},placeholder:"my-combo",error:y}),(0,a.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:"Only letters, numbers, -, _ and . allowed"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===p.length?(0,a.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,a.jsx)("div",{className:"flex flex-col gap-1 max-h-[350px] overflow-y-auto",children:p.map((e,t)=>(0,a.jsx)(c,{index:t,model:e,isFirst:0===t,isLast:t===p.length-1,onEdit:e=>{let s=[...p];s[t]=e,u(s)},onMoveUp:()=>(e=>{if(0===e)return;let t=[...p];[t[e-1],t[e]]=[t[e],t[e-1]],u(t)})(t),onMoveDown:()=>(e=>{if(e===p.length-1)return;let t=[...p];[t[e],t[e+1]]=[t[e+1],t[e]],u(t)})(t),onRemove:()=>{u(p.filter((e,s)=>s!==t))}},t))}),(0,a.jsxs)("button",{onClick:()=>f(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-primary font-medium hover:text-primary hover:border-primary/50 transition-colors flex items-center justify-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,a.jsx)(o.$n,{onClick:s,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,a.jsx)(o.$n,{onClick:S,fullWidth:!0,size:"sm",disabled:!x.trim()||!!y||g,children:g?"Saving...":E?"Save":"Create"})]})]})}),(0,a.jsx)(o.rq,{isOpen:b,onClose:()=>f(!1),onSelect:e=>{p.includes(e.value)||u([...p,e.value])},activeProviders:i,modelAliases:N,title:"Add Model to Combo",kindFilter:d})]})}}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=16474)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6607],{23879:(e,s,t)=>{"use strict";t.d(s,{default:()=>r});var a=t(95155),n=t(12115),i=t(3534),o=t(28777),l=t(52679),c=t(16722);function r(){let[e,s]=(0,n.useState)([]),[t,r]=(0,n.useState)([]),[d,u]=(0,n.useState)({}),[h,p]=(0,n.useState)(!1),[f,w]=(0,n.useState)(null),[v,S]=(0,n.useState)({running:!1,certExists:!1,dnsStatus:{},hasCachedPassword:!1}),[g,k]=(0,n.useState)(!1),x=async()=>{try{let e=await fetch("/api/providers");if(e.ok){let t=await e.json();s(t.connections||[])}}catch{}},y=async()=>{try{let e=await fetch("/api/keys");if(e.ok){let s=await e.json();r(s.keys||[])}}catch{}},j=async()=>{try{let e=await fetch("/api/models/alias");if(e.ok){let s=await e.json();u(s.aliases||{})}}catch{}},m=async()=>{try{let e=await fetch("/api/settings");if(e.ok){let s=await e.json();p(s.cloudEnabled||!1),k(!!s.tokenSwapEnabled)}}catch{}};(0,n.useEffect)(()=>{(async()=>{await Promise.all([x(),y(),j(),m()])})()},[]);let E=()=>e.filter(e=>!1!==e.isActive),b=Object.entries(i.wn);return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(c.tA,{apiKeys:t,cloudEnabled:h,onStatusChange:S}),(0,a.jsx)("div",{className:"flex flex-col gap-2",children:b.map(([s,i])=>(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(c.kn,{tool:i,isExpanded:f===s,onToggle:()=>w(f===s?null:s),serverRunning:v.running,dnsActive:v.dnsStatus?.[s]||!1,hasCachedPassword:v.hasCachedPassword||!1,apiKeys:t,activeProviders:E(),hasActiveProviders:E().some(e=>(0,o.KC)(e.provider).length>0||(0,l.mq)(e.provider)||(0,l.gb)(e.provider)),modelAliases:d,cloudEnabled:h,tokenSwapActive:i.supportsTokenSwap&&g,onDnsChange:e=>S(s=>({...s,dnsStatus:e.dnsStatus??s.dnsStatus}))}),i.supportsTokenSwap&&(0,a.jsx)(c.xm,{tool:i,connections:e,serverRunning:v.running,dnsActive:v.dnsStatus?.[s]||!1,onToggle:e=>k(e),onRefreshConnections:x})]},s))})]})}},60817:(e,s,t)=>{Promise.resolve().then(t.bind(t,23879))}},e=>{e.O(0,[2574,3862,1051,5772,1321,5497,6309,8441,3794,7358],()=>e(e.s=60817)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3471],{64561:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>c});var a=s(95155),r=s(12115),i=s(35497),n=s(1620),o=s(11059),l=s(31474),d=s(90620);function c(){let{theme:e,setTheme:t,isDark:s}=(0,n.D)(),{copied:c,copy:m}=(0,o.C)(),[x,p]=(0,r.useState)({fallbackStrategy:"fill-first"}),[u,y]=(0,r.useState)(!0),[b,h]=(0,r.useState)({current:"",new:"",confirm:""}),[g,f]=(0,r.useState)({type:"",message:""}),[j,v]=(0,r.useState)(!1),[N,w]=(0,r.useState)(!1),[k,C]=(0,r.useState)({type:"",message:""}),P=(0,r.useRef)(null),[S,A]=(0,r.useState)({outboundProxyEnabled:!1,outboundProxyUrl:"",outboundNoProxy:""}),[O,E]=(0,r.useState)({type:"",message:""}),[T,D]=(0,r.useState)(!1),[R,L]=(0,r.useState)(!1),[F,H]=(0,r.useState)("1.23.2"),[I,q]=(0,r.useState)({type:"",message:""}),[J,M]=(0,r.useState)(!1);(0,r.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{p(e),A({outboundProxyEnabled:e?.outboundProxyEnabled===!0,outboundProxyUrl:e?.outboundProxyUrl||"",outboundNoProxy:e?.outboundNoProxy||""}),H(e?.mitmAntigravityIdeVersion||"1.23.2"),y(!1)}).catch(e=>{console.error("Failed to fetch settings:",e),y(!1)})},[]);let U=async e=>{if(e.preventDefault(),!0===x.outboundProxyEnabled){D(!0),E({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({outboundProxyUrl:S.outboundProxyUrl,outboundNoProxy:S.outboundNoProxy})}),t=await e.json();e.ok?(p(e=>({...e,...t})),E({type:"success",message:"Proxy settings applied"})):E({type:"error",message:t.error||"Failed to update proxy settings"})}catch(e){E({type:"error",message:"An error occurred"})}finally{D(!1)}}},$=async()=>{if(!0!==x.outboundProxyEnabled)return;let e=(S.outboundProxyUrl||"").trim();if(!e)return void E({type:"error",message:"Please enter a Proxy URL to test"});L(!0),E({type:"",message:""});try{let t=await fetch("/api/settings/proxy-test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyUrl:e})}),s=await t.json();t.ok&&s?.ok?E({type:"success",message:`Proxy test OK (${s.status}) in ${s.elapsedMs}ms`}):E({type:"error",message:s?.error||"Proxy test failed"})}catch(e){E({type:"error",message:"An error occurred"})}finally{L(!1)}},V=async e=>{D(!0),E({type:"",message:""});try{let t=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({outboundProxyEnabled:e})}),s=await t.json();t.ok?(p(e=>({...e,...s})),A(e=>({...e,outboundProxyEnabled:s?.outboundProxyEnabled===!0})),E({type:"success",message:e?"Proxy enabled":"Proxy disabled"})):E({type:"error",message:s.error||"Failed to update proxy settings"})}catch(e){E({type:"error",message:"An error occurred"})}finally{D(!1)}},Z=async e=>{if(e.preventDefault(),b.new!==b.confirm)return void f({type:"error",message:"Passwords do not match"});v(!0),f({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:b.current,newPassword:b.new})}),t=await e.json();e.ok?(f({type:"success",message:"Password updated successfully"}),h({current:"",new:"",confirm:""})):f({type:"error",message:t.error||"Failed to update password"})}catch(e){f({type:"error",message:"An error occurred"})}finally{v(!1)}},B=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({fallbackStrategy:e})})).ok&&p(t=>({...t,fallbackStrategy:e}))}catch(e){console.error("Failed to update settings:",e)}},_=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategy:e})})).ok&&p(t=>({...t,comboStrategy:e}))}catch(e){console.error("Failed to update combo strategy:",e)}},z=async e=>{let t=parseInt(e);if(!isNaN(t)&&!(t<1))try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({stickyRoundRobinLimit:t})})).ok&&p(e=>({...e,stickyRoundRobinLimit:t}))}catch(e){console.error("Failed to update sticky limit:",e)}},W=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireLogin:e})})).ok&&p(t=>({...t,requireLogin:e}))}catch(e){console.error("Failed to update require login:",e)}},K=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({enableObservability:e})})).ok&&p(t=>({...t,enableObservability:e}))}catch(e){console.error("Failed to update enableObservability:",e)}},Q=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({mitmAntigravityDebugLogsEnabled:e})})).ok&&p(t=>({...t,mitmAntigravityDebugLogsEnabled:e}))}catch(e){console.error("Failed to update mitmAntigravityDebugLogsEnabled:",e)}},G=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({mitmAntigravityAutoDisableOnSonnetZero:e})})).ok&&p(t=>({...t,mitmAntigravityAutoDisableOnSonnetZero:e}))}catch(e){console.error("Failed to update mitmAntigravityAutoDisableOnSonnetZero:",e)}},X=async e=>{q({type:"",message:""});try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({mitmAntigravityIdeVersionOverrideEnabled:e})})).ok&&p(t=>({...t,mitmAntigravityIdeVersionOverrideEnabled:e}))}catch(e){console.error("Failed to update mitmAntigravityIdeVersionOverrideEnabled:",e)}},Y=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({mitmAntigravityHostRewriteEnabled:e})})).ok&&p(t=>({...t,mitmAntigravityHostRewriteEnabled:e}))}catch(e){console.error("Failed to update mitmAntigravityHostRewriteEnabled:",e)}},ee=async e=>{e.preventDefault();let t=F.trim()||"1.23.2";M(!0),q({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({mitmAntigravityIdeVersion:t})}),s=await e.json().catch(()=>({}));e.ok?(p(e=>({...e,...s})),H(s?.mitmAntigravityIdeVersion||t),q({type:"success",message:"Antigravity IDE version saved"})):q({type:"error",message:s.error||"Failed to save Antigravity IDE version"})}catch(e){q({type:"error",message:"An error occurred"})}finally{M(!1)}},et=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({periodicDbBackupsEnabled:e})})).ok&&p(t=>({...t,periodicDbBackupsEnabled:e}))}catch(e){console.error("Failed to update periodicDbBackupsEnabled:",e)}},es=async()=>{try{let e=await fetch("/api/settings");if(!e.ok)return;let t=await e.json();p(t),H(t?.mitmAntigravityIdeVersion||"1.23.2")}catch(e){console.error("Failed to reload settings:",e)}},ea=async()=>{w(!0),C({type:"",message:""});try{let e=await fetch("/api/settings/database");if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||"Failed to export database")}let t=await e.json(),s=JSON.stringify(t,null,2),a=new Blob([s],{type:"application/json"}),r=URL.createObjectURL(a),i=document.createElement("a"),n=new Date().toISOString().replace(/[.:]/g,"-");i.href=r,i.download=`9router-backup-${n}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r),C({type:"success",message:"Database backup downloaded"})}catch(e){C({type:"error",message:e.message||"Failed to export database"})}finally{w(!1)}},er=async e=>{let t=e.target.files?.[0];if(t){w(!0),C({type:"",message:""});try{let e=await t.text(),s=JSON.parse(e),a=await fetch("/api/settings/database",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),r=await a.json().catch(()=>({}));if(!a.ok)throw Error(r.error||"Failed to import database");await es(),C({type:"success",message:"Database imported successfully"})}catch(e){C({type:"error",message:e.message||"Invalid backup file"})}finally{P.current&&(P.current.value=""),w(!1)}}},ei=!0===x.enableObservability,en=!0===x.mitmAntigravityDebugLogsEnabled,eo=!1!==x.mitmAntigravityAutoDisableOnSonnetZero,el=!0===x.mitmAntigravityIdeVersionOverrideEnabled,ed=!1!==x.mitmAntigravityHostRewriteEnabled,ec=x.mitmAntigravityDebugLogDir||"",em=!1!==x.periodicDbBackupsEnabled;return(0,a.jsx)("div",{className:"max-w-2xl mx-auto",children:(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)(i.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)("div",{className:"size-12 rounded-lg bg-green-500/10 text-green-500 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-2xl",children:"computer"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-xl font-semibold",children:"Local Mode"}),(0,a.jsx)("p",{className:"text-text-muted",children:"Running on your machine"})]})]}),(0,a.jsx)("div",{className:"inline-flex p-1 rounded-lg bg-black/5 dark:bg-white/5",children:["light","dark","system"].map(s=>(0,a.jsxs)("button",{type:"button",onClick:()=>t(s),className:(0,l.cn)("flex items-center gap-1.5 px-3 py-1.5 rounded-md font-medium transition-all",e===s?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"light"===s?"light_mode":"dark"===s?"dark_mode":"contrast"}),(0,a.jsx)("span",{className:"capitalize text-sm",children:s})]},s))})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 pt-4 border-t border-border",children:[(0,a.jsx)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-bg border border-border",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Database Location"}),(0,a.jsx)("p",{className:"text-sm text-text-muted font-mono",children:"~/.n9router/db.json"})]})}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-bg border border-border",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Hourly Database Backups"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Keep hourly snapshots for 3 days in ~/.n9router/backups/db"})]}),(0,a.jsx)(i.lM,{checked:em,onChange:et,disabled:u})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsx)(i.$n,{variant:"secondary",icon:"download",onClick:ea,loading:N,children:"Download Backup"}),(0,a.jsx)(i.$n,{variant:"outline",icon:"upload",onClick:()=>P.current?.click(),disabled:N,children:"Import Backup"}),(0,a.jsx)("input",{ref:P,type:"file",accept:"application/json,.json",className:"hidden",onChange:er})]}),k.message&&(0,a.jsx)("p",{className:`text-sm ${"error"===k.type?"text-red-500":"text-green-600 dark:text-green-400"}`,children:k.message})]})]}),(0,a.jsxs)(i.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"shield"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Security"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Require login"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"When ON, dashboard requires password. When OFF, access without login."})]}),(0,a.jsx)(i.lM,{checked:!0===x.requireLogin,onChange:()=>W(!x.requireLogin),disabled:u})]}),!0===x.requireLogin&&(0,a.jsxs)("form",{onSubmit:Z,className:"flex flex-col gap-4 pt-4 border-t border-border/50",children:[x.hasPassword&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium",children:"Current Password"}),(0,a.jsx)(i.pd,{type:"password",placeholder:"Enter current password",value:b.current,onChange:e=>h({...b,current:e.target.value}),required:!0})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium",children:"New Password"}),(0,a.jsx)(i.pd,{type:"password",placeholder:"Enter new password",value:b.new,onChange:e=>h({...b,new:e.target.value}),required:!0})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium",children:"Confirm New Password"}),(0,a.jsx)(i.pd,{type:"password",placeholder:"Confirm new password",value:b.confirm,onChange:e=>h({...b,confirm:e.target.value}),required:!0})]})]}),g.message&&(0,a.jsx)("p",{className:`text-sm ${"error"===g.type?"text-red-500":"text-green-500"}`,children:g.message}),(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsx)(i.$n,{type:"submit",variant:"primary",loading:j,children:x.hasPassword?"Update Password":"Set Password"})})]})]})]}),(0,a.jsxs)(i.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-blue-500/10 text-blue-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"route"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Routing Strategy"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Round Robin"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Cycle through accounts to distribute load"})]}),(0,a.jsx)(i.lM,{checked:"round-robin"===x.fallbackStrategy,onChange:()=>B("round-robin"===x.fallbackStrategy?"fill-first":"round-robin"),disabled:u})]}),"round-robin"===x.fallbackStrategy&&(0,a.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Sticky Limit"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Calls per account before switching"})]}),(0,a.jsx)(i.pd,{type:"number",min:"1",max:"10",value:x.stickyRoundRobinLimit||3,onChange:e=>z(e.target.value),disabled:u,className:"w-20 text-center"})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between pt-4 border-t border-border/50",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Combo Round Robin"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Cycle through providers in combos instead of always starting with first"})]}),(0,a.jsx)(i.lM,{checked:"round-robin"===x.comboStrategy,onChange:()=>_("round-robin"===x.comboStrategy?"fallback":"round-robin"),disabled:u})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted italic pt-2 border-t border-border/50",children:"round-robin"===x.fallbackStrategy?`Currently distributing requests across all available accounts with ${x.stickyRoundRobinLimit||3} calls per account.`:"Currently using accounts in priority order (Fill First)."})]})]}),(0,a.jsxs)(i.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/10 text-purple-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"wifi"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Network"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Outbound Proxy"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Enable proxy for OAuth + provider outbound requests."})]}),(0,a.jsx)(i.lM,{checked:!0===x.outboundProxyEnabled,onChange:()=>V(!0!==x.outboundProxyEnabled),disabled:u||T})]}),!0===x.outboundProxyEnabled&&(0,a.jsxs)("form",{onSubmit:U,className:"flex flex-col gap-4 pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium",children:"Proxy URL"}),(0,a.jsx)(i.pd,{placeholder:"http://127.0.0.1:7897",value:S.outboundProxyUrl,onChange:e=>A(t=>({...t,outboundProxyUrl:e.target.value})),disabled:u||T}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Leave empty to inherit existing env proxy (if any)."})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 pt-2 border-t border-border/50",children:[(0,a.jsx)("label",{className:"font-medium",children:"No Proxy"}),(0,a.jsx)(i.pd,{placeholder:"localhost,127.0.0.1",value:S.outboundNoProxy,onChange:e=>A(t=>({...t,outboundNoProxy:e.target.value})),disabled:u||T}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Comma-separated hostnames/domains to bypass the proxy."})]}),(0,a.jsxs)("div",{className:"pt-2 border-t border-border/50 flex items-center gap-2",children:[(0,a.jsx)(i.$n,{type:"button",variant:"secondary",loading:R,disabled:u||T,onClick:$,children:"Test proxy URL"}),(0,a.jsx)(i.$n,{type:"submit",variant:"primary",loading:T,children:"Apply"})]})]}),O.message&&(0,a.jsx)("p",{className:`text-sm ${"error"===O.type?"text-red-500":"text-green-500"} pt-2 border-t border-border/50`,children:O.message})]})]}),(0,a.jsxs)(i.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-orange-500/10 text-orange-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"monitoring"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Observability"})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Enable Observability"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Record request details for inspection in the logs view"})]}),(0,a.jsx)(i.lM,{checked:ei,onChange:K,disabled:u})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between pt-4 mt-4 border-t border-border/50",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Antigravity MITM Debug Logs"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Write all Antigravity MITM requests to debug log files with masked tokens, related account info, and response payloads"})]}),(0,a.jsx)(i.lM,{checked:en,onChange:Q,disabled:u})]}),en&&ec&&(0,a.jsx)("div",{className:"pt-3 mt-3 border-t border-border/50",children:(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"font-medium",children:"Log Folder"}),(0,a.jsx)("p",{className:"mt-1 break-all rounded-md bg-surface/70 px-3 py-2 font-mono text-xs text-text-muted",children:ec})]}),(0,a.jsx)(i.$n,{variant:"outline",size:"sm",onClick:()=>m(ec,"mitm-antigravity-log-dir"),children:"mitm-antigravity-log-dir"===c?"Copied!":"Copy"})]})}),(0,a.jsxs)("div",{className:"flex items-center justify-between pt-4 mt-4 border-t border-border/50",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Antigravity Auto-disable Empty Sonnet Accounts"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Disable an Antigravity token-rotation account after a failed request when its Claude Sonnet 4.6 quota is 0%"})]}),(0,a.jsx)(i.lM,{checked:eo,onChange:G,disabled:u})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between pt-4 mt-4 border-t border-border/50",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Antigravity Host Rewrite"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Rewrite Antigravity requests from cloudcode-pa.googleapis.com to daily-cloudcode-pa.googleapis.com to avoid 429 rate limits"})]}),(0,a.jsx)(i.lM,{checked:ed,onChange:Y,disabled:u})]}),(0,a.jsxs)("div",{className:"pt-4 mt-4 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Antigravity IDE Version Override"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Replace Antigravity token-swap request metadata and user-agent version"}),(0,a.jsx)("p",{className:"mt-1 text-xs font-medium text-amber-600 dark:text-amber-400",children:"Use this feature at your own risk. Spoofing IDE versions may affect account eligibility, upstream behavior, or request reliability."})]}),(0,a.jsx)(i.lM,{checked:el,onChange:X,disabled:u})]}),el&&(0,a.jsxs)("form",{onSubmit:ee,className:"mt-4 flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 sm:items-end",children:[(0,a.jsx)(i.pd,{label:"Antigravity IDE Version",value:F,onChange:e=>H(e.target.value),placeholder:"1.23.2",inputMode:"decimal",disabled:J,className:"flex-1"}),(0,a.jsx)(i.$n,{type:"submit",variant:"outline",disabled:J,children:J?"Saving...":"Save"})]}),I.message&&(0,a.jsx)("p",{className:`text-sm ${"error"===I.type?"text-red-500":"text-green-500"}`,children:I.message})]})]})]}),(0,a.jsxs)("div",{className:"text-center text-sm text-text-muted py-4",children:[(0,a.jsxs)("p",{children:[d.vQ.name," v",d.vQ.version]}),(0,a.jsx)("p",{className:"mt-1",children:"Local Mode - All data stored on your machine"})]})]})})}},68594:(e,t,s)=>{Promise.resolve().then(s.bind(s,64561))}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=68594)),_N_E=e.O()}]);