9router 0.2.72 → 0.2.74

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 (450) hide show
  1. package/app/.next/BUILD_ID +1 -1
  2. package/app/.next/app-path-routes-manifest.json +36 -34
  3. package/app/.next/build-manifest.json +2 -2
  4. package/app/.next/prerender-manifest.json +3 -3
  5. package/app/.next/routes-manifest.json +12 -0
  6. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +2 -2
  7. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  8. package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  9. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  10. package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  11. package/app/.next/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  12. package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  13. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
  14. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  15. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  16. package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  17. package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  18. package/app/.next/server/app/(dashboard)/dashboard/usage/page.js +2 -2
  19. package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  20. package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  21. package/app/.next/server/app/_global-error.html +2 -2
  22. package/app/.next/server/app/_global-error.rsc +1 -1
  23. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  24. package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  25. package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  26. package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  27. package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  28. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  29. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  30. package/app/.next/server/app/_not-found.html +1 -1
  31. package/app/.next/server/app/_not-found.rsc +3 -3
  32. package/app/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  33. package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  34. package/app/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
  35. package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  36. package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  37. package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  38. package/app/.next/server/app/api/auth/login/route.js +1 -1
  39. package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  40. package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  41. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  42. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route_client-reference-manifest.js +1 -1
  43. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +2 -2
  44. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route_client-reference-manifest.js +1 -1
  45. package/app/.next/server/app/api/cli-tools/claude-settings/route.js +2 -2
  46. package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
  47. package/app/.next/server/app/api/cli-tools/codex-settings/route.js +2 -2
  48. package/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
  49. package/app/.next/server/app/api/cli-tools/droid-settings/route.js +1 -1
  50. package/app/.next/server/app/api/cli-tools/droid-settings/route_client-reference-manifest.js +1 -1
  51. package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  52. package/app/.next/server/app/api/cli-tools/openclaw-settings/route_client-reference-manifest.js +1 -1
  53. package/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
  54. package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
  55. package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
  56. package/app/.next/server/app/api/cloud/models/alias/route.js +1 -1
  57. package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
  58. package/app/.next/server/app/api/combos/[id]/route.js +1 -1
  59. package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
  60. package/app/.next/server/app/api/combos/route.js +1 -1
  61. package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
  62. package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  63. package/app/.next/server/app/api/keys/[id]/route.js +1 -1
  64. package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
  65. package/app/.next/server/app/api/keys/route.js +1 -1
  66. package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
  67. package/app/.next/server/app/api/models/alias/route.js +1 -1
  68. package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
  69. package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
  70. package/app/.next/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  71. package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
  72. package/app/.next/server/app/api/oauth/cursor/auto-import/route.js +1 -1
  73. package/app/.next/server/app/api/oauth/cursor/auto-import/route_client-reference-manifest.js +1 -1
  74. package/app/.next/server/app/api/oauth/cursor/import/route.js +1 -1
  75. package/app/.next/server/app/api/oauth/cursor/import/route_client-reference-manifest.js +1 -1
  76. package/app/.next/server/app/api/oauth/kiro/auto-import/route_client-reference-manifest.js +1 -1
  77. package/app/.next/server/app/api/oauth/kiro/import/route.js +1 -1
  78. package/app/.next/server/app/api/oauth/kiro/import/route_client-reference-manifest.js +1 -1
  79. package/app/.next/server/app/api/oauth/kiro/social-authorize/route_client-reference-manifest.js +1 -1
  80. package/app/.next/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  81. package/app/.next/server/app/api/oauth/kiro/social-exchange/route_client-reference-manifest.js +1 -1
  82. package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
  83. package/app/.next/server/app/api/provider-nodes/[id]/route_client-reference-manifest.js +1 -1
  84. package/app/.next/server/app/api/provider-nodes/route.js +1 -1
  85. package/app/.next/server/app/api/provider-nodes/route_client-reference-manifest.js +1 -1
  86. package/app/.next/server/app/api/provider-nodes/validate/route_client-reference-manifest.js +1 -1
  87. package/app/.next/server/app/api/providers/[id]/models/route.js +1 -1
  88. package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
  89. package/app/.next/server/app/api/providers/[id]/route.js +1 -1
  90. package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
  91. package/app/.next/server/app/api/providers/[id]/test/route.js +1 -1
  92. package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
  93. package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
  94. package/app/.next/server/app/api/providers/route.js +1 -1
  95. package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
  96. package/app/.next/server/app/api/providers/validate/route.js +1 -1
  97. package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
  98. package/app/.next/server/app/api/settings/require-login/route.js +1 -1
  99. package/app/.next/server/app/api/settings/require-login/route_client-reference-manifest.js +1 -1
  100. package/app/.next/server/app/api/settings/route.js +1 -1
  101. package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  102. package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  103. package/app/.next/server/app/api/sync/cloud/route.js +1 -1
  104. package/app/.next/server/app/api/sync/cloud/route_client-reference-manifest.js +1 -1
  105. package/app/.next/server/app/api/sync/initialize/route_client-reference-manifest.js +1 -1
  106. package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
  107. package/app/.next/server/app/api/translator/load/route_client-reference-manifest.js +1 -1
  108. package/app/.next/server/app/api/translator/save/route_client-reference-manifest.js +1 -1
  109. package/app/.next/server/app/api/translator/send/route.js +1 -1
  110. package/app/.next/server/app/api/translator/send/route.js.nft.json +1 -1
  111. package/app/.next/server/app/api/translator/send/route_client-reference-manifest.js +1 -1
  112. package/app/.next/server/app/api/translator/translate/route.js +1 -1
  113. package/app/.next/server/app/api/translator/translate/route.js.nft.json +1 -1
  114. package/app/.next/server/app/api/translator/translate/route_client-reference-manifest.js +1 -1
  115. package/app/.next/server/app/api/usage/[connectionId]/route.js +1 -1
  116. package/app/.next/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  117. package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
  118. package/app/.next/server/app/api/usage/history/route.js +1 -2
  119. package/app/.next/server/app/api/usage/history/route.js.nft.json +1 -1
  120. package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
  121. package/app/.next/server/app/api/usage/providers/route.js +45 -0
  122. package/app/.next/server/app/api/usage/providers/route.js.nft.json +1 -0
  123. package/app/.next/server/app/api/usage/providers/route_client-reference-manifest.js +1 -0
  124. package/app/.next/server/app/api/usage/request-details/route.js +1 -0
  125. package/app/.next/server/app/api/usage/request-details/route.js.nft.json +1 -0
  126. package/app/.next/server/app/api/usage/request-details/route_client-reference-manifest.js +1 -0
  127. package/app/.next/server/app/api/usage/request-logs/route.js +1 -2
  128. package/app/.next/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  129. package/app/.next/server/app/api/usage/request-logs/route_client-reference-manifest.js +1 -1
  130. package/app/.next/server/app/api/v1/api/chat/route.js +1 -1
  131. package/app/.next/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  132. package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
  133. package/app/.next/server/app/api/v1/chat/completions/route.js +1 -1
  134. package/app/.next/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  135. package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
  136. package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
  137. package/app/.next/server/app/api/v1/messages/route.js +1 -1
  138. package/app/.next/server/app/api/v1/messages/route.js.nft.json +1 -1
  139. package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
  140. package/app/.next/server/app/api/v1/models/route.js +1 -1
  141. package/app/.next/server/app/api/v1/models/route_client-reference-manifest.js +1 -1
  142. package/app/.next/server/app/api/v1/responses/route.js +1 -1
  143. package/app/.next/server/app/api/v1/responses/route.js.nft.json +1 -1
  144. package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
  145. package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
  146. package/app/.next/server/app/api/v1beta/models/[...path]/route.js +1 -1
  147. package/app/.next/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  148. package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
  149. package/app/.next/server/app/api/v1beta/models/route.js +1 -1
  150. package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
  151. package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  152. package/app/.next/server/app/callback.html +1 -1
  153. package/app/.next/server/app/callback.rsc +3 -3
  154. package/app/.next/server/app/callback.segments/_full.segment.rsc +3 -3
  155. package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
  156. package/app/.next/server/app/callback.segments/_index.segment.rsc +3 -3
  157. package/app/.next/server/app/callback.segments/_tree.segment.rsc +2 -2
  158. package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  159. package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
  160. package/app/.next/server/app/dashboard/cli-tools.html +1 -1
  161. package/app/.next/server/app/dashboard/cli-tools.rsc +5 -5
  162. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  163. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  164. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  165. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  166. package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +5 -5
  167. package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  168. package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +3 -3
  169. package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  170. package/app/.next/server/app/dashboard/combos.html +1 -1
  171. package/app/.next/server/app/dashboard/combos.rsc +5 -5
  172. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  173. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  174. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  175. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  176. package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +5 -5
  177. package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  178. package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +3 -3
  179. package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  180. package/app/.next/server/app/dashboard/endpoint.html +1 -1
  181. package/app/.next/server/app/dashboard/endpoint.rsc +5 -5
  182. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  183. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  184. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  185. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  186. package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +5 -5
  187. package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  188. package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +3 -3
  189. package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  190. package/app/.next/server/app/dashboard/profile.html +1 -1
  191. package/app/.next/server/app/dashboard/profile.rsc +5 -5
  192. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  193. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  194. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  195. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  196. package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +5 -5
  197. package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  198. package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +3 -3
  199. package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  200. package/app/.next/server/app/dashboard/providers/new.html +1 -1
  201. package/app/.next/server/app/dashboard/providers/new.rsc +5 -5
  202. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  203. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  204. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  205. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  206. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  207. package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +5 -5
  208. package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  209. package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +3 -3
  210. package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  211. package/app/.next/server/app/dashboard/providers.html +1 -1
  212. package/app/.next/server/app/dashboard/providers.rsc +5 -5
  213. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  214. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  215. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  216. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  217. package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +5 -5
  218. package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  219. package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +3 -3
  220. package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  221. package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  222. package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
  223. package/app/.next/server/app/dashboard/settings/pricing.rsc +3 -3
  224. package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
  225. package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  226. package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
  227. package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  228. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  229. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  230. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  231. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  232. package/app/.next/server/app/dashboard/translator.html +1 -1
  233. package/app/.next/server/app/dashboard/translator.rsc +5 -5
  234. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  235. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  236. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  237. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  238. package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +5 -5
  239. package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  240. package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +3 -3
  241. package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  242. package/app/.next/server/app/dashboard/usage.html +1 -1
  243. package/app/.next/server/app/dashboard/usage.rsc +5 -5
  244. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  245. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  246. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  247. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  248. package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
  249. package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  250. package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +3 -3
  251. package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  252. package/app/.next/server/app/dashboard.html +1 -1
  253. package/app/.next/server/app/dashboard.rsc +5 -5
  254. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  255. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  256. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  257. package/app/.next/server/app/dashboard.segments/_full.segment.rsc +5 -5
  258. package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
  259. package/app/.next/server/app/dashboard.segments/_index.segment.rsc +3 -3
  260. package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  261. package/app/.next/server/app/index.html +1 -1
  262. package/app/.next/server/app/index.rsc +3 -3
  263. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  264. package/app/.next/server/app/index.segments/_full.segment.rsc +3 -3
  265. package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
  266. package/app/.next/server/app/index.segments/_index.segment.rsc +3 -3
  267. package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  268. package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  269. package/app/.next/server/app/landing.html +1 -1
  270. package/app/.next/server/app/landing.rsc +3 -3
  271. package/app/.next/server/app/landing.segments/_full.segment.rsc +3 -3
  272. package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
  273. package/app/.next/server/app/landing.segments/_index.segment.rsc +3 -3
  274. package/app/.next/server/app/landing.segments/_tree.segment.rsc +2 -2
  275. package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  276. package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
  277. package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
  278. package/app/.next/server/app/login.html +1 -1
  279. package/app/.next/server/app/login.rsc +4 -4
  280. package/app/.next/server/app/login.segments/_full.segment.rsc +4 -4
  281. package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
  282. package/app/.next/server/app/login.segments/_index.segment.rsc +3 -3
  283. package/app/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  284. package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  285. package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
  286. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  287. package/app/.next/server/app-paths-manifest.json +36 -34
  288. package/app/.next/server/chunks/3110.js +1 -1
  289. package/app/.next/server/chunks/3990.js +41 -0
  290. package/app/.next/server/chunks/412.js +4 -4
  291. package/app/.next/server/chunks/5330.js +2 -3
  292. package/app/.next/server/chunks/7647.js +1 -0
  293. package/app/.next/server/chunks/8152.js +1 -1
  294. package/app/.next/server/chunks/8954.js +1 -1
  295. package/app/.next/server/chunks/9718.js +1 -1
  296. package/app/.next/server/chunks/9862.js +1 -1
  297. package/app/.next/server/pages/404.html +1 -1
  298. package/app/.next/server/pages/500.html +2 -2
  299. package/app/.next/server/server-reference-manifest.js +1 -1
  300. package/app/.next/server/server-reference-manifest.json +1 -1
  301. package/app/.next/static/chunks/1393-e72d9173010b9d65.js +1 -0
  302. package/app/.next/static/chunks/8729-82e9a6a333963202.js +1 -0
  303. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-90f6753022b6031c.js → page-8a7d7ab7f43677a0.js} +3 -3
  304. package/app/.next/static/chunks/app/(dashboard)/dashboard/profile/page-738071ba2546b274.js +1 -0
  305. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-d48c3e28182c53fd.js +1 -0
  306. package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-874d3494c011eaf2.js +1 -0
  307. package/app/.next/static/chunks/app/_global-error/page-1968aadfb379c0a3.js +1 -0
  308. package/app/.next/static/chunks/app/api/auth/login/route-1968aadfb379c0a3.js +1 -0
  309. package/app/.next/static/chunks/app/api/auth/logout/route-1968aadfb379c0a3.js +1 -0
  310. package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/alias/route-1968aadfb379c0a3.js +1 -0
  311. package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/route-1968aadfb379c0a3.js +1 -0
  312. package/app/.next/static/chunks/app/api/cli-tools/claude-settings/route-1968aadfb379c0a3.js +1 -0
  313. package/app/.next/static/chunks/app/api/cli-tools/codex-settings/route-1968aadfb379c0a3.js +1 -0
  314. package/app/.next/static/chunks/app/api/cli-tools/droid-settings/route-1968aadfb379c0a3.js +1 -0
  315. package/app/.next/static/chunks/app/api/cli-tools/openclaw-settings/route-1968aadfb379c0a3.js +1 -0
  316. package/app/.next/static/chunks/app/api/cloud/auth/route-1968aadfb379c0a3.js +1 -0
  317. package/app/.next/static/chunks/app/api/cloud/credentials/update/route-1968aadfb379c0a3.js +1 -0
  318. package/app/.next/static/chunks/app/api/cloud/model/resolve/route-1968aadfb379c0a3.js +1 -0
  319. package/app/.next/static/chunks/app/api/cloud/models/alias/route-1968aadfb379c0a3.js +1 -0
  320. package/app/.next/static/chunks/app/api/combos/[id]/route-1968aadfb379c0a3.js +1 -0
  321. package/app/.next/static/chunks/app/api/combos/route-1968aadfb379c0a3.js +1 -0
  322. package/app/.next/static/chunks/app/api/init/route-1968aadfb379c0a3.js +1 -0
  323. package/app/.next/static/chunks/app/api/keys/[id]/route-1968aadfb379c0a3.js +1 -0
  324. package/app/.next/static/chunks/app/api/keys/route-1968aadfb379c0a3.js +1 -0
  325. package/app/.next/static/chunks/app/api/models/alias/route-1968aadfb379c0a3.js +1 -0
  326. package/app/.next/static/chunks/app/api/models/route-1968aadfb379c0a3.js +1 -0
  327. package/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-1968aadfb379c0a3.js +1 -0
  328. package/app/.next/static/chunks/app/api/oauth/cursor/auto-import/route-1968aadfb379c0a3.js +1 -0
  329. package/app/.next/static/chunks/app/api/oauth/cursor/import/route-1968aadfb379c0a3.js +1 -0
  330. package/app/.next/static/chunks/app/api/oauth/kiro/auto-import/route-1968aadfb379c0a3.js +1 -0
  331. package/app/.next/static/chunks/app/api/oauth/kiro/import/route-1968aadfb379c0a3.js +1 -0
  332. package/app/.next/static/chunks/app/api/oauth/kiro/social-authorize/route-1968aadfb379c0a3.js +1 -0
  333. package/app/.next/static/chunks/app/api/oauth/kiro/social-exchange/route-1968aadfb379c0a3.js +1 -0
  334. package/app/.next/static/chunks/app/api/pricing/route-1968aadfb379c0a3.js +1 -0
  335. package/app/.next/static/chunks/app/api/provider-nodes/[id]/route-1968aadfb379c0a3.js +1 -0
  336. package/app/.next/static/chunks/app/api/provider-nodes/route-1968aadfb379c0a3.js +1 -0
  337. package/app/.next/static/chunks/app/api/provider-nodes/validate/route-1968aadfb379c0a3.js +1 -0
  338. package/app/.next/static/chunks/app/api/providers/[id]/models/route-1968aadfb379c0a3.js +1 -0
  339. package/app/.next/static/chunks/app/api/providers/[id]/route-1968aadfb379c0a3.js +1 -0
  340. package/app/.next/static/chunks/app/api/providers/[id]/test/route-1968aadfb379c0a3.js +1 -0
  341. package/app/.next/static/chunks/app/api/providers/client/route-1968aadfb379c0a3.js +1 -0
  342. package/app/.next/static/chunks/app/api/providers/route-1968aadfb379c0a3.js +1 -0
  343. package/app/.next/static/chunks/app/api/providers/validate/route-1968aadfb379c0a3.js +1 -0
  344. package/app/.next/static/chunks/app/api/settings/require-login/route-1968aadfb379c0a3.js +1 -0
  345. package/app/.next/static/chunks/app/api/settings/route-1968aadfb379c0a3.js +1 -0
  346. package/app/.next/static/chunks/app/api/shutdown/route-1968aadfb379c0a3.js +1 -0
  347. package/app/.next/static/chunks/app/api/sync/cloud/route-1968aadfb379c0a3.js +1 -0
  348. package/app/.next/static/chunks/app/api/sync/initialize/route-1968aadfb379c0a3.js +1 -0
  349. package/app/.next/static/chunks/app/api/tags/route-1968aadfb379c0a3.js +1 -0
  350. package/app/.next/static/chunks/app/api/translator/load/route-1968aadfb379c0a3.js +1 -0
  351. package/app/.next/static/chunks/app/api/translator/save/route-1968aadfb379c0a3.js +1 -0
  352. package/app/.next/static/chunks/app/api/translator/send/route-1968aadfb379c0a3.js +1 -0
  353. package/app/.next/static/chunks/app/api/translator/translate/route-1968aadfb379c0a3.js +1 -0
  354. package/app/.next/static/chunks/app/api/usage/[connectionId]/route-1968aadfb379c0a3.js +1 -0
  355. package/app/.next/static/chunks/app/api/usage/history/route-1968aadfb379c0a3.js +1 -0
  356. package/app/.next/static/chunks/app/api/usage/providers/route-1968aadfb379c0a3.js +1 -0
  357. package/app/.next/static/chunks/app/api/usage/request-details/route-1968aadfb379c0a3.js +1 -0
  358. package/app/.next/static/chunks/app/api/usage/request-logs/route-1968aadfb379c0a3.js +1 -0
  359. package/app/.next/static/chunks/app/api/v1/api/chat/route-1968aadfb379c0a3.js +1 -0
  360. package/app/.next/static/chunks/app/api/v1/chat/completions/route-1968aadfb379c0a3.js +1 -0
  361. package/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-1968aadfb379c0a3.js +1 -0
  362. package/app/.next/static/chunks/app/api/v1/messages/route-1968aadfb379c0a3.js +1 -0
  363. package/app/.next/static/chunks/app/api/v1/models/route-1968aadfb379c0a3.js +1 -0
  364. package/app/.next/static/chunks/app/api/v1/responses/route-1968aadfb379c0a3.js +1 -0
  365. package/app/.next/static/chunks/app/api/v1/route-1968aadfb379c0a3.js +1 -0
  366. package/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-1968aadfb379c0a3.js +1 -0
  367. package/app/.next/static/chunks/app/api/v1beta/models/route-1968aadfb379c0a3.js +1 -0
  368. package/app/.next/static/chunks/app/page-1968aadfb379c0a3.js +1 -0
  369. package/app/.next/static/chunks/next/dist/client/components/builtin/app-error-1968aadfb379c0a3.js +1 -0
  370. package/app/.next/static/chunks/next/dist/client/components/builtin/forbidden-1968aadfb379c0a3.js +1 -0
  371. package/app/.next/static/chunks/next/dist/client/components/builtin/not-found-1968aadfb379c0a3.js +1 -0
  372. package/app/.next/static/chunks/next/dist/client/components/builtin/unauthorized-1968aadfb379c0a3.js +1 -0
  373. package/app/.next/static/css/e4a2c774b676c378.css +3 -0
  374. package/app/.next/static/y2yqm3nawhQ8AeKLcj0DT/_buildManifest.js +1 -0
  375. package/app/package.json +1 -1
  376. package/app/public/providers/glm-cn.png +0 -0
  377. package/package.json +1 -1
  378. package/app/.next/server/chunks/9707.js +0 -1
  379. package/app/.next/static/VRVsJDwKk6UAo3wjmb_Mu/_buildManifest.js +0 -1
  380. package/app/.next/static/chunks/1393-e96aa4a79d3e1568.js +0 -1
  381. package/app/.next/static/chunks/8729-d228d83251fca5a4.js +0 -1
  382. package/app/.next/static/chunks/app/(dashboard)/dashboard/profile/page-b61f704bc7de9783.js +0 -1
  383. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-e8509c35110f8541.js +0 -1
  384. package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-15eac98ba6db9df4.js +0 -1
  385. package/app/.next/static/chunks/app/_global-error/page-901ec69b71429e39.js +0 -1
  386. package/app/.next/static/chunks/app/api/auth/login/route-901ec69b71429e39.js +0 -1
  387. package/app/.next/static/chunks/app/api/auth/logout/route-901ec69b71429e39.js +0 -1
  388. package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/alias/route-901ec69b71429e39.js +0 -1
  389. package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/route-901ec69b71429e39.js +0 -1
  390. package/app/.next/static/chunks/app/api/cli-tools/claude-settings/route-901ec69b71429e39.js +0 -1
  391. package/app/.next/static/chunks/app/api/cli-tools/codex-settings/route-901ec69b71429e39.js +0 -1
  392. package/app/.next/static/chunks/app/api/cli-tools/droid-settings/route-901ec69b71429e39.js +0 -1
  393. package/app/.next/static/chunks/app/api/cli-tools/openclaw-settings/route-901ec69b71429e39.js +0 -1
  394. package/app/.next/static/chunks/app/api/cloud/auth/route-901ec69b71429e39.js +0 -1
  395. package/app/.next/static/chunks/app/api/cloud/credentials/update/route-901ec69b71429e39.js +0 -1
  396. package/app/.next/static/chunks/app/api/cloud/model/resolve/route-901ec69b71429e39.js +0 -1
  397. package/app/.next/static/chunks/app/api/cloud/models/alias/route-901ec69b71429e39.js +0 -1
  398. package/app/.next/static/chunks/app/api/combos/[id]/route-901ec69b71429e39.js +0 -1
  399. package/app/.next/static/chunks/app/api/combos/route-901ec69b71429e39.js +0 -1
  400. package/app/.next/static/chunks/app/api/init/route-901ec69b71429e39.js +0 -1
  401. package/app/.next/static/chunks/app/api/keys/[id]/route-901ec69b71429e39.js +0 -1
  402. package/app/.next/static/chunks/app/api/keys/route-901ec69b71429e39.js +0 -1
  403. package/app/.next/static/chunks/app/api/models/alias/route-901ec69b71429e39.js +0 -1
  404. package/app/.next/static/chunks/app/api/models/route-901ec69b71429e39.js +0 -1
  405. package/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-901ec69b71429e39.js +0 -1
  406. package/app/.next/static/chunks/app/api/oauth/cursor/auto-import/route-901ec69b71429e39.js +0 -1
  407. package/app/.next/static/chunks/app/api/oauth/cursor/import/route-901ec69b71429e39.js +0 -1
  408. package/app/.next/static/chunks/app/api/oauth/kiro/auto-import/route-901ec69b71429e39.js +0 -1
  409. package/app/.next/static/chunks/app/api/oauth/kiro/import/route-901ec69b71429e39.js +0 -1
  410. package/app/.next/static/chunks/app/api/oauth/kiro/social-authorize/route-901ec69b71429e39.js +0 -1
  411. package/app/.next/static/chunks/app/api/oauth/kiro/social-exchange/route-901ec69b71429e39.js +0 -1
  412. package/app/.next/static/chunks/app/api/pricing/route-901ec69b71429e39.js +0 -1
  413. package/app/.next/static/chunks/app/api/provider-nodes/[id]/route-901ec69b71429e39.js +0 -1
  414. package/app/.next/static/chunks/app/api/provider-nodes/route-901ec69b71429e39.js +0 -1
  415. package/app/.next/static/chunks/app/api/provider-nodes/validate/route-901ec69b71429e39.js +0 -1
  416. package/app/.next/static/chunks/app/api/providers/[id]/models/route-901ec69b71429e39.js +0 -1
  417. package/app/.next/static/chunks/app/api/providers/[id]/route-901ec69b71429e39.js +0 -1
  418. package/app/.next/static/chunks/app/api/providers/[id]/test/route-901ec69b71429e39.js +0 -1
  419. package/app/.next/static/chunks/app/api/providers/client/route-901ec69b71429e39.js +0 -1
  420. package/app/.next/static/chunks/app/api/providers/route-901ec69b71429e39.js +0 -1
  421. package/app/.next/static/chunks/app/api/providers/validate/route-901ec69b71429e39.js +0 -1
  422. package/app/.next/static/chunks/app/api/settings/require-login/route-901ec69b71429e39.js +0 -1
  423. package/app/.next/static/chunks/app/api/settings/route-901ec69b71429e39.js +0 -1
  424. package/app/.next/static/chunks/app/api/shutdown/route-901ec69b71429e39.js +0 -1
  425. package/app/.next/static/chunks/app/api/sync/cloud/route-901ec69b71429e39.js +0 -1
  426. package/app/.next/static/chunks/app/api/sync/initialize/route-901ec69b71429e39.js +0 -1
  427. package/app/.next/static/chunks/app/api/tags/route-901ec69b71429e39.js +0 -1
  428. package/app/.next/static/chunks/app/api/translator/load/route-901ec69b71429e39.js +0 -1
  429. package/app/.next/static/chunks/app/api/translator/save/route-901ec69b71429e39.js +0 -1
  430. package/app/.next/static/chunks/app/api/translator/send/route-901ec69b71429e39.js +0 -1
  431. package/app/.next/static/chunks/app/api/translator/translate/route-901ec69b71429e39.js +0 -1
  432. package/app/.next/static/chunks/app/api/usage/[connectionId]/route-901ec69b71429e39.js +0 -1
  433. package/app/.next/static/chunks/app/api/usage/history/route-901ec69b71429e39.js +0 -1
  434. package/app/.next/static/chunks/app/api/usage/request-logs/route-901ec69b71429e39.js +0 -1
  435. package/app/.next/static/chunks/app/api/v1/api/chat/route-901ec69b71429e39.js +0 -1
  436. package/app/.next/static/chunks/app/api/v1/chat/completions/route-901ec69b71429e39.js +0 -1
  437. package/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-901ec69b71429e39.js +0 -1
  438. package/app/.next/static/chunks/app/api/v1/messages/route-901ec69b71429e39.js +0 -1
  439. package/app/.next/static/chunks/app/api/v1/models/route-901ec69b71429e39.js +0 -1
  440. package/app/.next/static/chunks/app/api/v1/responses/route-901ec69b71429e39.js +0 -1
  441. package/app/.next/static/chunks/app/api/v1/route-901ec69b71429e39.js +0 -1
  442. package/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-901ec69b71429e39.js +0 -1
  443. package/app/.next/static/chunks/app/api/v1beta/models/route-901ec69b71429e39.js +0 -1
  444. package/app/.next/static/chunks/app/page-901ec69b71429e39.js +0 -1
  445. package/app/.next/static/chunks/next/dist/client/components/builtin/app-error-901ec69b71429e39.js +0 -1
  446. package/app/.next/static/chunks/next/dist/client/components/builtin/forbidden-901ec69b71429e39.js +0 -1
  447. package/app/.next/static/chunks/next/dist/client/components/builtin/not-found-901ec69b71429e39.js +0 -1
  448. package/app/.next/static/chunks/next/dist/client/components/builtin/unauthorized-901ec69b71429e39.js +0 -1
  449. package/app/.next/static/css/69b23ffd995e0cf4.css +0 -3
  450. /package/app/.next/static/{VRVsJDwKk6UAo3wjmb_Mu → y2yqm3nawhQ8AeKLcj0DT}/_ssgManifest.js +0 -0
@@ -1,10 +1,10 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2326],{2016:(e,t,s)=>{Promise.resolve().then(s.bind(s,9378))},9378:(e,t,s)=>{"use strict";s.d(t,{default:()=>b});var l=s(5155),r=s(2115),a=s(5497);let n={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-5-20251101"},{id:"sonnet",name:"Claude Sonnet",alias:"sonnet",envKey:"ANTHROPIC_DEFAULT_SONNET_MODEL",defaultValue:"cc/claude-sonnet-4-5-20250929"},{id:"haiku",name:"Claude Haiku",alias:"haiku",envKey:"ANTHROPIC_DEFAULT_HAIKU_MODEL",defaultValue:"cc/claude-haiku-4-5-20251001"}]},codex:{id:"codex",name:"OpenAI Codex CLI",image:"/providers/codex.png",color:"#10A37F",description:"OpenAI Codex CLI",configType:"custom"},droid:{id:"droid",name:"Factory Droid",image:"/providers/droid.png",color:"#00D4FF",description:"Factory Droid AI Assistant",configType:"custom"},openclaw:{id:"openclaw",name:"Open Claw",image:"/providers/openclaw.png",color:"#FF6B35",description:"Open Claw AI Assistant",configType:"custom"},cursor:{id:"cursor",name:"Cursor",image:"/providers/cursor.png",color:"#000000",description:"Cursor AI Code Editor",configType:"guide",requiresCloud:!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 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 Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to CLINE 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"}]},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:`{
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2326],{2016:(e,t,s)=>{Promise.resolve().then(s.bind(s,9378))},9378:(e,t,s)=>{"use strict";s.d(t,{default:()=>f});var l=s(5155),a=s(2115),r=s(5497);let n={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-5-20251101"},{id:"sonnet",name:"Claude Sonnet",alias:"sonnet",envKey:"ANTHROPIC_DEFAULT_SONNET_MODEL",defaultValue:"cc/claude-sonnet-4-5-20250929"},{id:"haiku",name:"Claude Haiku",alias:"haiku",envKey:"ANTHROPIC_DEFAULT_HAIKU_MODEL",defaultValue:"cc/claude-haiku-4-5-20251001"}]},codex:{id:"codex",name:"OpenAI Codex CLI",image:"/providers/codex.png",color:"#10A37F",description:"OpenAI Codex CLI",configType:"custom"},droid:{id:"droid",name:"Factory Droid",image:"/providers/droid.png",color:"#00D4FF",description:"Factory Droid AI Assistant",configType:"custom"},openclaw:{id:"openclaw",name:"Open Claw",image:"/providers/openclaw.png",color:"#FF6B35",description:"Open Claw AI Assistant",configType:"custom"},cursor:{id:"cursor",name:"Cursor",image:"/providers/cursor.png",color:"#000000",description:"Cursor AI Code Editor",configType:"guide",requiresCloud:!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 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 Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to CLINE 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"}]},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
2
  "apiBase": "{{baseUrl}}",
3
3
  "title": "{{model}}",
4
4
  "model": "{{model}}",
5
5
  "provider": "openai",
6
6
  "apiKey": "{{apiKey}}"
7
- }`}},antigravity:{id:"antigravity",name:"Antigravity",image:"/providers/antigravity.png",color:"#4285F4",description:"Google Antigravity IDE with MITM",configType:"mitm",modelAliases:["claude-opus-4-5-thinking","claude-sonnet-4-5-thinking","claude-sonnet-4-5","gemini-3-pro-high"],defaultModels:[{id:"claude-opus-4-5-thinking",name:"Claude Opus 4.5 Thinking",alias:"claude-opus-4-5-thinking"},{id:"claude-sonnet-4-5-thinking",name:"Claude Sonnet 4.5 Thinking",alias:"claude-sonnet-4-5-thinking"},{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5",alias:"claude-sonnet-4-5"},{id:"gemini-3-pro-high",name:"Gemini 3 Pro High",alias:"gemini-3-pro-high"},{id:"gemini-3-flash",name:"Gemini 3 Flash",alias:"gemini-3-flash"}]}};var i=s(8777),o=s(5772);let d="https://9router.com";function c({tool:e,isExpanded:t,onToggle:s,activeProviders:n,modelMappings:i,onModelMappingChange:c,baseUrl:x,hasActiveProviders:m,apiKeys:p,cloudEnabled:u}){let h,g,y,[f,b]=(0,r.useState)(null),[j,v]=(0,r.useState)(!1),[N,w]=(0,r.useState)(!1),[k,C]=(0,r.useState)(!1),[S,_]=(0,r.useState)(null),[A,E]=(0,r.useState)(!1),[O,I]=(0,r.useState)(!1),[P,M]=(0,r.useState)(null),[R,T]=(0,r.useState)(""),[$,K]=(0,r.useState)({}),[L,U]=(0,r.useState)(!1),[F,z]=(0,r.useState)(""),D=(0,r.useRef)(!1),H=(()=>{if(!f?.installed)return null;let e=f.settings?.env?.ANTHROPIC_BASE_URL;if(!e)return"not_configured";let t=e.includes("localhost")||e.includes("127.0.0.1"),s=u&&d&&e.startsWith(d);return t||s?"configured":"other"})();(0,r.useEffect)(()=>{p?.length>0&&!R&&T(p[0].key)},[p,R]),(0,r.useEffect)(()=>{t&&!f&&(W(),B())},[t,f]);let B=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&K(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,r.useEffect)(()=>{if(f?.installed&&!D.current){D.current=!0;let t=f.settings?.env||{};e.defaultModels.forEach(e=>{if(e.envKey){let s=t[e.envKey]||e.defaultValue||"";s&&c(e.alias,s)}});let s=t.ANTHROPIC_AUTH_TOKEN;s&&p?.some(e=>e.key===s)&&T(s)}},[f,p,e.defaultModels,c]);let W=async()=>{v(!0);try{let e=await fetch("/api/cli-tools/claude-settings"),t=await e.json();b(t)}catch(e){b({installed:!1,error:e.message})}finally{v(!1)}},q=()=>{let e=F||x;return e.endsWith("/v1")?e:`${e}/v1`},J=async()=>{w(!0),_(null);try{let t={ANTHROPIC_BASE_URL:q()},s=R?.trim()||(p?.length>0?p[0].key:null)||(u?null:"sk_9router");s&&(t.ANTHROPIC_AUTH_TOKEN=s),e.defaultModels.forEach(e=>{let s=i[e.alias];s&&e.envKey&&(t[e.envKey]=s)});let l=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:t})}),r=await l.json();l.ok?(_({type:"success",text:"Settings applied successfully!"}),b(e=>({...e,hasBackup:!0,settings:{...e?.settings,env:t}}))):_({type:"error",text:r.error||"Failed to apply settings"})}catch(e){_({type:"error",text:e.message})}finally{w(!1)}},G=async()=>{C(!0),_(null);try{let t=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),s=await t.json();t.ok?(_({type:"success",text:"Settings reset successfully!"}),e.defaultModels.forEach(e=>c(e.alias,e.defaultValue||"")),T("")):_({type:"error",text:s.error||"Failed to reset settings"})}catch(e){_({type:"error",text:e.message})}finally{C(!1)}};return(0,l.jsxs)(a.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(o.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,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===H&&(0,l.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"===H&&(0,l.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"===H&&(0,l.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,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[j&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Claude CLI..."})]}),!j&&f&&!f.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Claude CLI to use this feature."})]}),(0,l.jsxs)(a.$n,{variant:"outline",size:"sm",onClick:()=>E(!A),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:A?"expand_less":"help"}),A?"Hide":"How to Install"]})]}),A&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.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,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!j&&f?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[f?.settings?.env?.ANTHROPIC_BASE_URL&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:f.settings.env.ANTHROPIC_BASE_URL})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(h=F||x).endsWith("/v1")?h:`${h}/v1`,onChange:e=>z(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"}),F&&F!==x&&(0,l.jsx)("button",{onClick:()=>z(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),p.length>0?(0,l.jsx)("select",{value:R,onChange:e=>T(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,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.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)"})]}),e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:i[e.alias]||"",onChange:t=>c(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,l.jsx)("button",{onClick:()=>{M(e.alias),I(!0)},disabled:!m,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${m?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),i[e.alias]&&(0,l.jsx)("button",{onClick:()=>c(e.alias,""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.alias))]}),S&&(0,l.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,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===S.type?"check_circle":"error"}),(0,l.jsx)("span",{children:S.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(a.$n,{variant:"primary",size:"sm",onClick:J,disabled:!m,loading:N,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(a.$n,{variant:"outline",size:"sm",onClick:G,disabled:!f?.has9Router,loading:k,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(a.$n,{variant:"ghost",size:"sm",onClick:()=>U(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(a.rq,{isOpen:O,onClose:()=>I(!1),onSelect:e=>{P&&c(P,e.value)},selectedModel:P?i[P]:null,activeProviders:n,modelAliases:$,title:`Select model for ${P}`}),(0,l.jsx)(a.uR,{isOpen:L,onClose:()=>U(!1),title:"Claude CLI - Manual Configuration",configs:(g=R&&R.trim()?R:u?"<API_KEY_FROM_DASHBOARD>":"sk_9router",y={ANTHROPIC_BASE_URL:q(),ANTHROPIC_AUTH_TOKEN:g},e.defaultModels.forEach(e=>{let t=i[e.alias];t&&e.envKey&&(y[e.envKey]=t)}),[{filename:"~/.claude/settings.json",content:JSON.stringify({env:y},null,2)}])})]})}function x({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:i,activeProviders:d,cloudEnabled:c}){let x,m,p,[u,h]=(0,r.useState)(null),[g,y]=(0,r.useState)(!1),[f,b]=(0,r.useState)(!1),[j,v]=(0,r.useState)(!1),[N,w]=(0,r.useState)(null),[k,C]=(0,r.useState)(!1),[S,_]=(0,r.useState)(""),[A,E]=(0,r.useState)(""),[O,I]=(0,r.useState)(!1),[P,M]=(0,r.useState)({}),[R,T]=(0,r.useState)(!1),[$,K]=(0,r.useState)("");(0,r.useEffect)(()=>{i?.length>0&&!S&&_(i[0].key)},[i,S]),(0,r.useEffect)(()=>{t&&!u&&(z(),L())},[t,u]);let L=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&M(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,r.useEffect)(()=>{if(u?.config){let e=u.config.match(/^model\s*=\s*"([^"]+)"/m);e&&E(e[1])}},[u]);let U=u?.installed?u.config?u.config.includes(n)||u.config.includes("localhost")||u.config.includes("127.0.0.1")?"configured":"other":"not_configured":null,F=()=>{let e=$||`${n}/v1`;return e.endsWith("/v1")?e:`${e}/v1`},z=async()=>{y(!0);try{let e=await fetch("/api/cli-tools/codex-settings"),t=await e.json();h(t)}catch(e){h({installed:!1,error:e.message})}finally{y(!1)}},D=async()=>{b(!0),w(null);try{let e=S&&S.trim()||c?S:"sk_9router",t=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:F(),apiKey:e,model:A})}),s=await t.json();t.ok?(w({type:"success",text:"Settings applied successfully!"}),z()):w({type:"error",text:s.error||"Failed to apply settings"})}catch(e){w({type:"error",text:e.message})}finally{b(!1)}},H=async()=>{v(!0),w(null);try{let e=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),t=await e.json();e.ok?(w({type:"success",text:"Settings reset successfully!"}),E(""),z()):w({type:"error",text:t.error||"Failed to reset settings"})}catch(e){w({type:"error",text:e.message})}finally{v(!1)}};return(0,l.jsxs)(a.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(o.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,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===U&&(0,l.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"===U&&(0,l.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"===U&&(0,l.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,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[g&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Codex CLI..."})]}),!g&&u&&!u.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Codex CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Codex CLI to use auto-apply feature."})]}),(0,l.jsxs)(a.$n,{variant:"outline",size:"sm",onClick:()=>C(!k),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:k?"expand_less":"help"}),k?"Hide":"How to Install"]})]}),k&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.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,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"codex"})," to verify."]}),(0,l.jsx)("div",{className:"pt-2 border-t border-border",children:(0,l.jsxs)("p",{className:"text-text-muted text-xs",children:["Codex uses ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"~/.codex/auth.json"})," with ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"OPENAI_API_KEY"}),'. Click "Apply" to auto-configure.']})})]})]})]}),!g&&u?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[u?.config&&((m=(x=u.config.match(/base_url\s*=\s*"([^"]+)"/))?x[1]:null)?(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:m})]}):null),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:$||`${n}/v1`,onChange:e=>K(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"}),$&&$!==`${n}/v1`&&(0,l.jsx)("button",{onClick:()=>K(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),i.length>0?(0,l.jsx)("select",{value:S,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:i.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.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,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:A,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,l.jsx)("button",{onClick:()=>I(!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"}),A&&(0,l.jsx)("button",{onClick:()=>E(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),N&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===N.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===N.type?"check_circle":"error"}),(0,l.jsx)("span",{children:N.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(a.$n,{variant:"primary",size:"sm",onClick:D,disabled:!S||!A,loading:f,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(a.$n,{variant:"outline",size:"sm",onClick:H,disabled:!u.has9Router,loading:j,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(a.$n,{variant:"ghost",size:"sm",onClick:()=>T(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(a.rq,{isOpen:O,onClose:()=>I(!1),onSelect:e=>{E(e.value),I(!1)},selectedModel:A,activeProviders:d,modelAliases:P,title:"Select Model for Codex"}),(0,l.jsx)(a.uR,{isOpen:R,onClose:()=>T(!1),title:"Codex CLI - Manual Configuration",configs:(p=S&&S.trim()?S:c?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.codex/config.toml",content:`# 9Router Configuration for Codex CLI
7
+ }`}},antigravity:{id:"antigravity",name:"Antigravity",image:"/providers/antigravity.png",color:"#4285F4",description:"Google Antigravity IDE with MITM",configType:"mitm",modelAliases:["claude-opus-4-5-thinking","claude-sonnet-4-5-thinking","claude-sonnet-4-5","gemini-3-pro-high"],defaultModels:[{id:"claude-opus-4-5-thinking",name:"Claude Opus 4.5 Thinking",alias:"claude-opus-4-5-thinking"},{id:"claude-sonnet-4-5-thinking",name:"Claude Sonnet 4.5 Thinking",alias:"claude-sonnet-4-5-thinking"},{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5",alias:"claude-sonnet-4-5"},{id:"gemini-3-pro-high",name:"Gemini 3 Pro High",alias:"gemini-3-pro-high"},{id:"gemini-3-flash",name:"Gemini 3 Flash",alias:"gemini-3-flash"}]}};var i=s(8777),o=s(5772);let d="https://9router.com";function c({tool:e,isExpanded:t,onToggle:s,activeProviders:n,modelMappings:i,onModelMappingChange:c,baseUrl:x,hasActiveProviders:m,apiKeys:p,cloudEnabled:u}){let h,g,y,[f,b]=(0,a.useState)(null),[j,v]=(0,a.useState)(!1),[N,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(!1),[S,_]=(0,a.useState)(null),[A,E]=(0,a.useState)(!1),[O,I]=(0,a.useState)(!1),[P,M]=(0,a.useState)(null),[R,T]=(0,a.useState)(""),[$,K]=(0,a.useState)({}),[L,U]=(0,a.useState)(!1),[F,z]=(0,a.useState)(""),D=(0,a.useRef)(!1),H=(()=>{if(!f?.installed)return null;let e=f.settings?.env?.ANTHROPIC_BASE_URL;if(!e)return"not_configured";let t=e.includes("localhost")||e.includes("127.0.0.1"),s=u&&d&&e.startsWith(d);return t||s?"configured":"other"})();(0,a.useEffect)(()=>{p?.length>0&&!R&&T(p[0].key)},[p,R]),(0,a.useEffect)(()=>{t&&!f&&(q(),B())},[t,f]);let B=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&K(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(f?.installed&&!D.current){D.current=!0;let t=f.settings?.env||{};e.defaultModels.forEach(e=>{if(e.envKey){let s=t[e.envKey]||e.defaultValue||"";s&&c(e.alias,s)}});let s=t.ANTHROPIC_AUTH_TOKEN;s&&p?.some(e=>e.key===s)&&T(s)}},[f,p,e.defaultModels,c]);let q=async()=>{v(!0);try{let e=await fetch("/api/cli-tools/claude-settings"),t=await e.json();b(t)}catch(e){b({installed:!1,error:e.message})}finally{v(!1)}},W=()=>{let e=F||x;return e.endsWith("/v1")?e:`${e}/v1`},J=async()=>{w(!0),_(null);try{let t={ANTHROPIC_BASE_URL:W()},s=R?.trim()||(p?.length>0?p[0].key:null)||(u?null:"sk_9router");s&&(t.ANTHROPIC_AUTH_TOKEN=s),e.defaultModels.forEach(e=>{let s=i[e.alias];s&&e.envKey&&(t[e.envKey]=s)});let l=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:t})}),a=await l.json();l.ok?(_({type:"success",text:"Settings applied successfully!"}),b(e=>({...e,hasBackup:!0,settings:{...e?.settings,env:t}}))):_({type:"error",text:a.error||"Failed to apply settings"})}catch(e){_({type:"error",text:e.message})}finally{w(!1)}},G=async()=>{C(!0),_(null);try{let t=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),s=await t.json();t.ok?(_({type:"success",text:"Settings reset successfully!"}),e.defaultModels.forEach(e=>c(e.alias,e.defaultValue||"")),T("")):_({type:"error",text:s.error||"Failed to reset settings"})}catch(e){_({type:"error",text:e.message})}finally{C(!1)}};return(0,l.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(o.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,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===H&&(0,l.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"===H&&(0,l.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"===H&&(0,l.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,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[j&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Claude CLI..."})]}),!j&&f&&!f.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Claude CLI to use this feature."})]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>E(!A),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:A?"expand_less":"help"}),A?"Hide":"How to Install"]})]}),A&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.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,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!j&&f?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[f?.settings?.env?.ANTHROPIC_BASE_URL&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:f.settings.env.ANTHROPIC_BASE_URL})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(h=F||x).endsWith("/v1")?h:`${h}/v1`,onChange:e=>z(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"}),F&&F!==x&&(0,l.jsx)("button",{onClick:()=>z(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),p.length>0?(0,l.jsx)("select",{value:R,onChange:e=>T(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,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.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)"})]}),e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:i[e.alias]||"",onChange:t=>c(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,l.jsx)("button",{onClick:()=>{M(e.alias),I(!0)},disabled:!m,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${m?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),i[e.alias]&&(0,l.jsx)("button",{onClick:()=>c(e.alias,""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.alias))]}),S&&(0,l.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,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===S.type?"check_circle":"error"}),(0,l.jsx)("span",{children:S.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:J,disabled:!m,loading:N,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:G,disabled:!f?.has9Router,loading:k,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>U(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:O,onClose:()=>I(!1),onSelect:e=>{P&&c(P,e.value)},selectedModel:P?i[P]:null,activeProviders:n,modelAliases:$,title:`Select model for ${P}`}),(0,l.jsx)(r.uR,{isOpen:L,onClose:()=>U(!1),title:"Claude CLI - Manual Configuration",configs:(g=R&&R.trim()?R:u?"<API_KEY_FROM_DASHBOARD>":"sk_9router",y={ANTHROPIC_BASE_URL:W(),ANTHROPIC_AUTH_TOKEN:g},e.defaultModels.forEach(e=>{let t=i[e.alias];t&&e.envKey&&(y[e.envKey]=t)}),[{filename:"~/.claude/settings.json",content:JSON.stringify({env:y},null,2)}])})]})}function x({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:i,activeProviders:d,cloudEnabled:c}){let x,m,p,[u,h]=(0,a.useState)(null),[g,y]=(0,a.useState)(!1),[f,b]=(0,a.useState)(!1),[j,v]=(0,a.useState)(!1),[N,w]=(0,a.useState)(null),[k,C]=(0,a.useState)(!1),[S,_]=(0,a.useState)(""),[A,E]=(0,a.useState)(""),[O,I]=(0,a.useState)(!1),[P,M]=(0,a.useState)({}),[R,T]=(0,a.useState)(!1),[$,K]=(0,a.useState)("");(0,a.useEffect)(()=>{i?.length>0&&!S&&_(i[0].key)},[i,S]),(0,a.useEffect)(()=>{t&&!u&&(z(),L())},[t,u]);let L=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&M(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(u?.config){let e=u.config.match(/^model\s*=\s*"([^"]+)"/m);e&&E(e[1])}},[u]);let U=u?.installed?u.config?u.config.includes(n)||u.config.includes("localhost")||u.config.includes("127.0.0.1")?"configured":"other":"not_configured":null,F=()=>{let e=$||`${n}/v1`;return e.endsWith("/v1")?e:`${e}/v1`},z=async()=>{y(!0);try{let e=await fetch("/api/cli-tools/codex-settings"),t=await e.json();h(t)}catch(e){h({installed:!1,error:e.message})}finally{y(!1)}},D=async()=>{b(!0),w(null);try{let e=S&&S.trim()||c?S:"sk_9router",t=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:F(),apiKey:e,model:A})}),s=await t.json();t.ok?(w({type:"success",text:"Settings applied successfully!"}),z()):w({type:"error",text:s.error||"Failed to apply settings"})}catch(e){w({type:"error",text:e.message})}finally{b(!1)}},H=async()=>{v(!0),w(null);try{let e=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),t=await e.json();e.ok?(w({type:"success",text:"Settings reset successfully!"}),E(""),z()):w({type:"error",text:t.error||"Failed to reset settings"})}catch(e){w({type:"error",text:e.message})}finally{v(!1)}};return(0,l.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(o.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,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===U&&(0,l.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"===U&&(0,l.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"===U&&(0,l.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,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[g&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Codex CLI..."})]}),!g&&u&&!u.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Codex CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Codex CLI to use auto-apply feature."})]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>C(!k),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:k?"expand_less":"help"}),k?"Hide":"How to Install"]})]}),k&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.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,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"codex"})," to verify."]}),(0,l.jsx)("div",{className:"pt-2 border-t border-border",children:(0,l.jsxs)("p",{className:"text-text-muted text-xs",children:["Codex uses ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"~/.codex/auth.json"})," with ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"OPENAI_API_KEY"}),'. Click "Apply" to auto-configure.']})})]})]})]}),!g&&u?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[u?.config&&((m=(x=u.config.match(/base_url\s*=\s*"([^"]+)"/))?x[1]:null)?(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:m})]}):null),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:$||`${n}/v1`,onChange:e=>K(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"}),$&&$!==`${n}/v1`&&(0,l.jsx)("button",{onClick:()=>K(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),i.length>0?(0,l.jsx)("select",{value:S,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:i.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.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,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:A,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,l.jsx)("button",{onClick:()=>I(!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"}),A&&(0,l.jsx)("button",{onClick:()=>E(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),N&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===N.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===N.type?"check_circle":"error"}),(0,l.jsx)("span",{children:N.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:D,disabled:!S||!A,loading:f,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:H,disabled:!u.has9Router,loading:j,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>T(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:O,onClose:()=>I(!1),onSelect:e=>{E(e.value),I(!1)},selectedModel:A,activeProviders:d,modelAliases:P,title:"Select Model for Codex"}),(0,l.jsx)(r.uR,{isOpen:R,onClose:()=>T(!1),title:"Codex CLI - Manual Configuration",configs:(p=S&&S.trim()?S:c?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.codex/config.toml",content:`# 9Router Configuration for Codex CLI
8
8
  model = "${A}"
9
9
  model_provider = "9router"
10
10
 
@@ -12,4 +12,4 @@ model_provider = "9router"
12
12
  name = "9Router"
13
13
  base_url = "${F()}"
14
14
  wire_api = "responses"
15
- `},{filename:"~/.codex/auth.json",content:JSON.stringify({OPENAI_API_KEY:p},null,2)}])})]})}let m="https://9router.com";function p({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:i,apiKeys:d,activeProviders:c,cloudEnabled:x}){let p,u,h,g,[y,f]=(0,r.useState)(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)(""),[E,O]=(0,r.useState)(""),[I,P]=(0,r.useState)(!1),[M,R]=(0,r.useState)({}),[T,$]=(0,r.useState)(!1),[K,L]=(0,r.useState)(""),U=(0,r.useRef)(!1),F=(()=>{if(!y?.installed)return null;let e=y.settings?.customModels?.find(e=>"custom:9Router-0"===e.id);if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1"),s=x&&m&&e.baseUrl?.startsWith(m);return t||s?"configured":"other"})();(0,r.useEffect)(()=>{d?.length>0&&!_&&A(d[0].key)},[d,_]),(0,r.useEffect)(()=>{t&&!y&&(D(),z())},[t,y]);let z=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&R(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,r.useEffect)(()=>{if(y?.installed&&!U.current){U.current=!0;let e=y.settings?.customModels?.find(e=>"custom:9Router-0"===e.id);e&&(e.model&&O(e.model),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&A(e.apiKey))}},[y,d]);let D=async()=>{j(!0);try{let e=await fetch("/api/cli-tools/droid-settings"),t=await e.json();f(t)}catch(e){f({installed:!1,error:e.message})}finally{j(!1)}},H=()=>{let e=K||n;return e.endsWith("/v1")?e:`${e}/v1`},B=async()=>{N(!0),S(null);try{let e=_?.trim()||(d?.length>0?d[0].key:null)||(x?null:"sk_9router"),t=await fetch("/api/cli-tools/droid-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:H(),apiKey:e,model:E})}),s=await t.json();t.ok?(S({type:"success",text:"Settings applied successfully!"}),D()):S({type:"error",text:s.error||"Failed to apply settings"})}catch(e){S({type:"error",text:e.message})}finally{N(!1)}},W=async()=>{k(!0),S(null);try{let e=await fetch("/api/cli-tools/droid-settings",{method:"DELETE"}),t=await e.json();e.ok?(S({type:"success",text:"Settings reset successfully!"}),O(""),A(""),D()):S({type:"error",text:t.error||"Failed to reset settings"})}catch(e){S({type:"error",text:e.message})}finally{k(!1)}};return(0,l.jsxs)(a.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(o.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,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===F&&(0,l.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"===F&&(0,l.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"===F&&(0,l.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,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[b&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Factory Droid CLI..."})]}),!b&&y&&!y.installed&&(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Factory Droid CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Factory Droid CLI to use this feature."})]})]}),!b&&y?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[y?.settings?.customModels?.find(e=>"custom:9Router-0"===e.id)?.baseUrl&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:y.settings.customModels.find(e=>"custom:9Router-0"===e.id).baseUrl})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(p=K||n).endsWith("/v1")?p:`${p}/v1`,onChange:e=>L(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!==n&&(0,l.jsx)("button",{onClick:()=>L(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,l.jsx)("select",{value:_,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,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.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,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:E,onChange:e=>O(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,l.jsx)("button",{onClick:()=>P(!0),disabled:!i,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${i?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),E&&(0,l.jsx)("button",{onClick:()=>O(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),C&&(0,l.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,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===C.type?"check_circle":"error"}),(0,l.jsx)("span",{children:C.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(a.$n,{variant:"primary",size:"sm",onClick:B,disabled:!E,loading:v,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(a.$n,{variant:"outline",size:"sm",onClick:W,disabled:!y?.has9Router,loading:w,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(a.$n,{variant:"ghost",size:"sm",onClick:()=>$(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(a.rq,{isOpen:I,onClose:()=>P(!1),onSelect:e=>{O(e.value),P(!1)},selectedModel:E,activeProviders:c,modelAliases:M,title:"Select Model for Factory Droid"}),(0,l.jsx)(a.uR,{isOpen:T,onClose:()=>$(!1),title:"Factory Droid - Manual Configuration",configs:(u=_&&_.trim()?_:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",h={customModels:[{model:E||"provider/model-id",id:"custom:9Router-0",index:0,baseUrl:H(),apiKey:u,displayName:E||"provider/model-id",maxOutputTokens:131072,noImageSupport:!1,provider:"openai"}]},g="u">typeof navigator&&navigator.platform,[{filename:g?.toLowerCase().includes("win")?"%USERPROFILE%\\.factory\\settings.json":"~/.factory/settings.json",content:JSON.stringify(h,null,2)}])})]})}let u="https://9router.com";function h({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:i,apiKeys:d,activeProviders:c,cloudEnabled:x}){let m,p,[h,g]=(0,r.useState)(null),[y,f]=(0,r.useState)(!1),[b,j]=(0,r.useState)(!1),[v,N]=(0,r.useState)(!1),[w,k]=(0,r.useState)(null),[C,S]=(0,r.useState)(""),[_,A]=(0,r.useState)(""),[E,O]=(0,r.useState)(!1),[I,P]=(0,r.useState)({}),[M,R]=(0,r.useState)(!1),[T,$]=(0,r.useState)(""),K=(0,r.useRef)(!1),L=(()=>{if(!h?.installed)return null;let e=h.settings?.models?.providers?.["9router"];if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1"),s=x&&u&&e.baseUrl?.startsWith(u);return t||s?"configured":"other"})();(0,r.useEffect)(()=>{d?.length>0&&!C&&S(d[0].key)},[d,C]),(0,r.useEffect)(()=>{t&&!h&&(F(),U())},[t,h]);let U=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&P(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,r.useEffect)(()=>{if(h?.installed&&!K.current){K.current=!0;let e=h.settings?.models?.providers?.["9router"];if(e){let t=h.settings?.agents?.defaults?.model?.primary;t&&A(t.replace("9router/","")),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&S(e.apiKey)}}},[h,d]);let F=async()=>{f(!0);try{let e=await fetch("/api/cli-tools/openclaw-settings"),t=await e.json();g(t)}catch(e){g({installed:!1,error:e.message})}finally{f(!1)}},z=()=>{let e=T||n;return e.endsWith("/v1")?e:`${e}/v1`},D=async()=>{j(!0),k(null);try{let e=C?.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:z(),apiKey:e,model:_})}),s=await t.json();t.ok?(k({type:"success",text:"Settings applied successfully!"}),F()):k({type:"error",text:s.error||"Failed to apply settings"})}catch(e){k({type:"error",text:e.message})}finally{j(!1)}},H=async()=>{N(!0),k(null);try{let e=await fetch("/api/cli-tools/openclaw-settings",{method:"DELETE"}),t=await e.json();e.ok?(k({type:"success",text:"Settings reset successfully!"}),A(""),S(""),F()):k({type:"error",text:t.error||"Failed to reset settings"})}catch(e){k({type:"error",text:e.message})}finally{N(!1)}};return(0,l.jsxs)(a.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(o.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,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===L&&(0,l.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"===L&&(0,l.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"===L&&(0,l.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,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[y&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Open Claw CLI..."})]}),!y&&h&&!h.installed&&(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Open Claw CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Open Claw CLI to use this feature."})]})]}),!y&&h?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[h?.settings?.models?.providers?.["9router"]?.baseUrl&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:h.settings.models.providers["9router"].baseUrl})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(m=T||n).endsWith("/v1")?m:`${m}/v1`,onChange:e=>$(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"}),T&&T!==n&&(0,l.jsx)("button",{onClick:()=>$(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,l.jsx)("select",{value:C,onChange:e=>S(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,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.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,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:_,onChange:e=>A(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,l.jsx)("button",{onClick:()=>O(!0),disabled:!i,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${i?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),_&&(0,l.jsx)("button",{onClick:()=>A(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),w&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===w.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===w.type?"check_circle":"error"}),(0,l.jsx)("span",{children:w.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(a.$n,{variant:"primary",size:"sm",onClick:D,disabled:!_,loading:b,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(a.$n,{variant:"outline",size:"sm",onClick:H,disabled:!h?.has9Router,loading:v,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(a.$n,{variant:"ghost",size:"sm",onClick:()=>R(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(a.rq,{isOpen:E,onClose:()=>O(!1),onSelect:e=>{A(e.value),O(!1)},selectedModel:_,activeProviders:c,modelAliases:I,title:"Select Model for Open Claw"}),(0,l.jsx)(a.uR,{isOpen:M,onClose:()=>R(!1),title:"Open Claw - Manual Configuration",configs:(p=C&&C.trim()?C: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:z(),apiKey:p,api:"openai-completions",models:[{id:_||"provider/model-id",name:(_||"provider/model-id").split("/").pop()}]}}}},null,2)}])})]})}function g({toolId:e,tool:t,isExpanded:s,onToggle:n,baseUrl:i,apiKeys:d,activeProviders:c=[],cloudEnabled:x=!1}){let[m,p]=(0,r.useState)(null),[u,h]=(0,r.useState)(!1),[g,y]=(0,r.useState)(""),[f,b]=(0,r.useState)(()=>d?.length>0?d[0].key:""),j=e=>{let t=f&&f.trim()?f:x?"your-api-key":"sk_9router",s=i||"http://localhost:20128",l=s.endsWith("/v1")?s:`${s}/v1`;return e.replace(/\{\{baseUrl\}\}/g,l).replace(/\{\{apiKey\}\}/g,t).replace(/\{\{model\}\}/g,g||"provider/model-id")},v=async(e,t)=>{await navigator.clipboard.writeText(j(e)),p(t),setTimeout(()=>p(null),2e3)},N=c.length>0,w=()=>!t.requiresCloud||!!x;return(0,l.jsxs)(a.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:n,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:t.image?(0,l.jsx)(o.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,l.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:t.color},children:t.icon}):(0,l.jsx)(o.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,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:t.name}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:t.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${s?"rotate-180":""}`,children:"expand_more"})]}),s&&(0,l.jsx)("div",{className:"mt-6 pt-6 border-t border-border",children:t.guideSteps?(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[t.notes&&0!==t.notes.length?(0,l.jsx)("div",{className:"flex flex-col gap-2 mb-4",children:t.notes.map((e,t)=>{if("cloudCheck"===e.type&&x)return null;let s="warning"===e.type,r="cloudCheck"===e.type&&!x,a="bg-blue-500/10 border-blue-500/30",n="text-blue-600 dark:text-blue-400",i="text-blue-500",o="info";return s?(a="bg-yellow-500/10 border-yellow-500/30",n="text-yellow-600 dark:text-yellow-400",i="text-yellow-500",o="warning"):r&&(a="bg-red-500/10 border-red-500/30",n="text-red-600 dark:text-red-400",i="text-red-500",o="error"),(0,l.jsxs)("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${a}`,children:[(0,l.jsx)("span",{className:`material-symbols-outlined text-lg ${i}`,children:o}),(0,l.jsx)("p",{className:`text-sm ${n}`,children:e.text})]},t)})}):null,w()&&t.guideSteps.map(e=>(0,l.jsxs)("div",{className:"flex items-start gap-4",children:[(0,l.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,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("p",{className:"font-medium text-text",children:e.title}),e.desc&&(0,l.jsx)("p",{className:"text-sm text-text-muted mt-0.5",children:e.desc}),"apiKeySelector"===e.type&&(0,l.jsx)("div",{className:"mt-2 flex items-center gap-2",children:d&&d.length>0?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("select",{value:f,onChange:e=>b(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,l.jsx)("option",{value:e.key,children:e.key},e.id))}),(0,l.jsx)("button",{onClick:()=>v(f,"apiKey"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"apiKey"===m?"check":"content_copy"})})]}):(0,l.jsx)("span",{className:"text-sm text-text-muted",children:x?"No API keys - Create one in Keys page":"sk_9router"})}),"modelSelector"===e.type&&(0,l.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,l.jsx)("input",{type:"text",value:g,onChange:e=>y(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,l.jsx)("button",{onClick:()=>h(!0),disabled:!N,className:`shrink-0 px-3 py-2 rounded-lg border text-sm transition-colors ${N?"bg-bg-secondary border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),g&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{onClick:()=>v(g,"model"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"model"===m?"check":"content_copy"})}),(0,l.jsx)("button",{onClick:()=>y(""),className:"p-2 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]})]}),e.value&&(0,l.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,l.jsx)("code",{className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm font-mono border border-border truncate",children:j(e.value)}),e.copyable&&(0,l.jsx)("button",{onClick:()=>v(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,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:m===`${e.step}-${e.title}`?"check":"content_copy"})})]})]})]},e.step)),w()&&t.codeBlock&&(0,l.jsxs)("div",{className:"mt-2",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wide",children:t.codeBlock.language}),(0,l.jsxs)("button",{onClick:()=>v(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,l.jsx)("span",{className:"material-symbols-outlined text-sm",children:"codeblock"===m?"check":"content_copy"}),"codeblock"===m?"Copied!":"Copy"]})]}),(0,l.jsx)("pre",{className:"p-4 bg-bg-secondary rounded-lg border border-border overflow-x-auto",children:(0,l.jsx)("code",{className:"text-sm font-mono whitespace-pre",children:j(t.codeBlock.code)})})]})]}):(0,l.jsx)("p",{className:"text-text-muted text-sm",children:"Coming soon..."})}),(0,l.jsx)(a.rq,{isOpen:u,onClose:()=>h(!1),onSelect:e=>{y(e.value)},selectedModel:g,activeProviders:c,title:"Select Model"})]})}function y({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:i,activeProviders:d,hasActiveProviders:c,cloudEnabled:x}){let[m,p]=(0,r.useState)(null),[u,h]=(0,r.useState)(!1),[g,y]=(0,r.useState)(!1),[f,b]=(0,r.useState)(""),[j,v]=(0,r.useState)(""),[N,w]=(0,r.useState)(null),[k,C]=(0,r.useState)({}),[S,_]=(0,r.useState)(!1),[A,E]=(0,r.useState)(null);(0,r.useEffect)(()=>{i?.length>0&&!j&&v(i[0].key)},[i,j]),(0,r.useEffect)(()=>{t&&!m&&(I(),O())},[t,m]);let O=async()=>{try{let e=await fetch("/api/cli-tools/antigravity-mitm/alias?tool=antigravity");if(e.ok){let t=(await e.json()).aliases||{};Object.keys(t).length>0&&C(t)}}catch(e){console.log("Error loading saved mappings:",e)}},I=async()=>{try{let e=await fetch("/api/cli-tools/antigravity-mitm");if(e.ok){let t=await e.json();p(t)}}catch(e){console.log("Error fetching status:",e),p({running:!1})}},P="u">typeof navigator&&navigator.userAgent?.includes("Windows"),M=async e=>{h(!0),w(null);try{let t=j?.trim()||(i?.length>0?i[0].key:null)||(x?null:"sk_9router"),s=await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:t,sudoPassword:e})}),l=await s.json();s.ok?(w({type:"success",text:"MITM started"}),y(!1),b(""),I()):w({type:"error",text:l.error||"Failed to start"})}catch(e){w({type:"error",text:e.message})}finally{h(!1)}},R=async e=>{h(!0),w(null);try{let t=await fetch("/api/cli-tools/antigravity-mitm",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:e})}),s=await t.json();t.ok?(w({type:"success",text:"MITM stopped"}),y(!1),b(""),I()):w({type:"error",text:s.error||"Failed to stop"})}catch(e){w({type:"error",text:e.message})}finally{h(!1)}},T=()=>{f.trim()?m?.running?R(f):M(f):w({type:"error",text:"Sudo password is required"})},$=(e,t)=>{C(s=>({...s,[e]:t}))},K=async()=>{h(!0),w(null);try{let e=await fetch("/api/cli-tools/antigravity-mitm/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:"antigravity",mappings:k})});if(!e.ok){let t=await e.json();throw Error(t.error||"Failed to save mappings")}w({type:"success",text:"Mappings saved!"})}catch(e){w({type:"error",text:e.message})}finally{h(!1)}},L=m?.running;return(0,l.jsxs)(a.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(o.default,{src:"/providers/antigravity.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,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),L?(0,l.jsx)(a.Ex,{variant:"success",size:"sm",children:"Active"}):(0,l.jsx)(a.Ex,{variant:"default",size:"sm",children:"Inactive"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[(0,l.jsx)("div",{className:"flex items-center gap-2",children:L?(0,l.jsxs)("button",{onClick:()=>{P||m?.hasCachedPassword?R(""):(y(!0),w(null))},disabled:u,className:"px-4 py-2 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-sm flex items-center gap-2 hover:bg-red-500/20 transition-colors disabled:opacity-50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"stop_circle"}),"Stop MITM"]}):(0,l.jsxs)("button",{onClick:()=>{P||m?.hasCachedPassword?M(""):(y(!0),w(null))},disabled:u||!c,className:"px-4 py-2 rounded-lg bg-primary/10 border border-primary/30 text-primary font-medium text-sm flex items-center gap-2 hover:bg-primary/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"play_circle"}),"Start MITM"]})}),N?.type==="error"&&(0,l.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,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,l.jsx)("span",{children:N.text})]}),L&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),i.length>0?(0,l.jsx)("select",{value:j,onChange:e=>v(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:i.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.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)"})]}),e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:k[e.alias]||"",onChange:t=>$(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,l.jsx)("button",{onClick:()=>{E(e.alias),_(!0)},disabled:!c,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${c?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),k[e.alias]&&(0,l.jsx)("button",{onClick:()=>$(e.alias,""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.alias)),(0,l.jsx)("div",{className:"flex items-center gap-2",children:(0,l.jsxs)(a.$n,{variant:"primary",size:"sm",onClick:K,disabled:u||0===Object.keys(k).length,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Save Mappings"]})})]}),!L&&(0,l.jsxs)("div",{className:"flex flex-col gap-1.5 px-1",children:[(0,l.jsxs)("p",{className:"text-xs text-text-muted",children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"How it works:"})," Intercepts Antigravity traffic via DNS redirect, letting you reroute models through 9Router."]}),(0,l.jsxs)("div",{className:"flex flex-col gap-0.5 text-[11px] text-text-muted",children:[(0,l.jsx)("span",{children:"1. Generates SSL cert & adds to system keychain"}),(0,l.jsxs)("span",{children:["2. Redirects ",(0,l.jsx)("code",{className:"text-[10px] bg-surface px-1 rounded",children:"daily-cloudcode-pa.googleapis.com"})," → localhost"]}),(0,l.jsx)("span",{children:"3. Maps Antigravity models to any provider via 9Router"})]})]})]}),(0,l.jsx)(a.aF,{isOpen:g,onClose:()=>{y(!1),b(""),w(null)},title:"Sudo Password Required",size:"sm",children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Required for SSL certificate and DNS configuration"})]}),(0,l.jsx)(a.pd,{type:"password",placeholder:"Enter sudo password",value:f,onChange:e=>b(e.target.value),onKeyDown:e=>{"Enter"!==e.key||u||T()}}),N&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===N.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===N.type?"check_circle":"error"}),(0,l.jsx)("span",{children:N.text})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(a.$n,{variant:"ghost",size:"sm",onClick:()=>{y(!1),b(""),w(null)},disabled:u,children:"Cancel"}),(0,l.jsx)(a.$n,{variant:"primary",size:"sm",onClick:T,loading:u,children:"Confirm"})]})]})}),(0,l.jsx)(a.rq,{isOpen:S,onClose:()=>_(!1),onSelect:e=>{A&&C(t=>({...t,[A]:e.value}))},selectedModel:A?k[A]:null,activeProviders:d,title:`Select model for ${A}`})]})}let f="https://9router.com";function b({machineId:e}){let t,s,o,[d,m]=(0,r.useState)([]),[u,b]=(0,r.useState)(!0),[j,v]=(0,r.useState)(null),[N,w]=(0,r.useState)({}),[k,C]=(0,r.useState)(!1),[S,_]=(0,r.useState)([]);(0,r.useEffect)(()=>{O(),A(),E()},[]);let A=async()=>{try{let e=await fetch("/api/settings");if(e.ok){let t=await e.json();C(t.cloudEnabled||!1)}}catch(e){console.log("Error loading cloud settings:",e)}},E=async()=>{try{let e=await fetch("/api/keys");if(e.ok){let t=await e.json();_(t.keys||[])}}catch(e){console.log("Error fetching API keys:",e)}},O=async()=>{try{let e=await fetch("/api/providers"),t=await e.json();e.ok&&m(t.connections||[])}catch(e){console.log("Error fetching connections:",e)}finally{b(!1)}},I=()=>d.filter(e=>!1!==e.isActive),P=(0,r.useCallback)((e,t,s)=>{w(l=>l[e]?.[t]===s?l:{...l,[e]:{...l[e],[t]:s}})},[]);if(u)return(0,l.jsx)("div",{className:"flex flex-col gap-6",children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)(a.Qv,{}),(0,l.jsx)(a.Qv,{}),(0,l.jsx)(a.Qv,{})]})});let M=(t=I(),s=[],o=new Set,t.forEach(e=>{let t=i.Xg[e.provider]||e.provider;(0,i.KC)(e.provider).forEach(l=>{let r=`${t}/${l.id}`;o.has(r)||(o.add(r),s.push({value:r,label:`${t}/${l.id}`,provider:e.provider,alias:t,connectionName:e.name,modelId:l.id}))})}),s).length>0;return(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[!M&&(0,l.jsx)(a.Zp,{className:"border-yellow-500/50 bg-yellow-500/5",children:(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"No active providers"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please add and connect providers first to configure CLI tools."})]})]})}),(0,l.jsx)("div",{className:"flex flex-col gap-4",children:Object.entries(n).map(([e,t])=>((e,t)=>{let s={tool:t,isExpanded:j===e,onToggle:()=>v(j===e?null:e),baseUrl:k&&f?f:window.location.origin,apiKeys:S};switch(e){case"claude":return(0,l.jsx)(c,{...s,activeProviders:I(),modelMappings:N[e]||{},onModelMappingChange:(t,s)=>P(e,t,s),hasActiveProviders:M,cloudEnabled:k},e);case"codex":return(0,l.jsx)(x,{...s,activeProviders:I(),cloudEnabled:k},e);case"droid":return(0,l.jsx)(p,{...s,activeProviders:I(),hasActiveProviders:M,cloudEnabled:k},e);case"openclaw":return(0,l.jsx)(h,{...s,activeProviders:I(),hasActiveProviders:M,cloudEnabled:k},e);case"antigravity":return(0,l.jsx)(y,{...s,activeProviders:I(),hasActiveProviders:M,cloudEnabled:k},e);default:return(0,l.jsx)(g,{toolId:e,...s,activeProviders:I(),cloudEnabled:k},e)}})(e,t))})]})}}},e=>{e.O(0,[600,3624,8729,5497,8441,3794,7358],()=>e(e.s=2016)),_N_E=e.O()}]);
15
+ `},{filename:"~/.codex/auth.json",content:JSON.stringify({OPENAI_API_KEY:p},null,2)}])})]})}let m="https://9router.com";function p({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:i,apiKeys:d,activeProviders:c,cloudEnabled:x}){let p,u,h,g,[y,f]=(0,a.useState)(null),[b,j]=(0,a.useState)(!1),[v,N]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(null),[_,A]=(0,a.useState)(""),[E,O]=(0,a.useState)(""),[I,P]=(0,a.useState)(!1),[M,R]=(0,a.useState)({}),[T,$]=(0,a.useState)(!1),[K,L]=(0,a.useState)(""),U=(0,a.useRef)(!1),F=(()=>{if(!y?.installed)return null;let e=y.settings?.customModels?.find(e=>"custom:9Router-0"===e.id);if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1"),s=x&&m&&e.baseUrl?.startsWith(m);return t||s?"configured":"other"})();(0,a.useEffect)(()=>{d?.length>0&&!_&&A(d[0].key)},[d,_]),(0,a.useEffect)(()=>{t&&!y&&(D(),z())},[t,y]);let z=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&R(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(y?.installed&&!U.current){U.current=!0;let e=y.settings?.customModels?.find(e=>"custom:9Router-0"===e.id);e&&(e.model&&O(e.model),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&A(e.apiKey))}},[y,d]);let D=async()=>{j(!0);try{let e=await fetch("/api/cli-tools/droid-settings"),t=await e.json();f(t)}catch(e){f({installed:!1,error:e.message})}finally{j(!1)}},H=()=>{let e=K||n;return e.endsWith("/v1")?e:`${e}/v1`},B=async()=>{N(!0),S(null);try{let e=_?.trim()||(d?.length>0?d[0].key:null)||(x?null:"sk_9router"),t=await fetch("/api/cli-tools/droid-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:H(),apiKey:e,model:E})}),s=await t.json();t.ok?(S({type:"success",text:"Settings applied successfully!"}),D()):S({type:"error",text:s.error||"Failed to apply settings"})}catch(e){S({type:"error",text:e.message})}finally{N(!1)}},q=async()=>{k(!0),S(null);try{let e=await fetch("/api/cli-tools/droid-settings",{method:"DELETE"}),t=await e.json();e.ok?(S({type:"success",text:"Settings reset successfully!"}),O(""),A(""),D()):S({type:"error",text:t.error||"Failed to reset settings"})}catch(e){S({type:"error",text:e.message})}finally{k(!1)}};return(0,l.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(o.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,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===F&&(0,l.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"===F&&(0,l.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"===F&&(0,l.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,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[b&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Factory Droid CLI..."})]}),!b&&y&&!y.installed&&(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Factory Droid CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Factory Droid CLI to use this feature."})]})]}),!b&&y?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[y?.settings?.customModels?.find(e=>"custom:9Router-0"===e.id)?.baseUrl&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:y.settings.customModels.find(e=>"custom:9Router-0"===e.id).baseUrl})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(p=K||n).endsWith("/v1")?p:`${p}/v1`,onChange:e=>L(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!==n&&(0,l.jsx)("button",{onClick:()=>L(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,l.jsx)("select",{value:_,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,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.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,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:E,onChange:e=>O(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,l.jsx)("button",{onClick:()=>P(!0),disabled:!i,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${i?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),E&&(0,l.jsx)("button",{onClick:()=>O(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),C&&(0,l.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,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===C.type?"check_circle":"error"}),(0,l.jsx)("span",{children:C.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:B,disabled:!E,loading:v,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:q,disabled:!y?.has9Router,loading:w,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>$(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:I,onClose:()=>P(!1),onSelect:e=>{O(e.value),P(!1)},selectedModel:E,activeProviders:c,modelAliases:M,title:"Select Model for Factory Droid"}),(0,l.jsx)(r.uR,{isOpen:T,onClose:()=>$(!1),title:"Factory Droid - Manual Configuration",configs:(u=_&&_.trim()?_:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",h={customModels:[{model:E||"provider/model-id",id:"custom:9Router-0",index:0,baseUrl:H(),apiKey:u,displayName:E||"provider/model-id",maxOutputTokens:131072,noImageSupport:!1,provider:"openai"}]},g="u">typeof navigator&&navigator.platform,[{filename:g?.toLowerCase().includes("win")?"%USERPROFILE%\\.factory\\settings.json":"~/.factory/settings.json",content:JSON.stringify(h,null,2)}])})]})}function u({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:i,apiKeys:d,activeProviders:c,cloudEnabled:x}){let m,p,[u,h]=(0,a.useState)(null),[g,y]=(0,a.useState)(!1),[f,b]=(0,a.useState)(!1),[j,v]=(0,a.useState)(!1),[N,w]=(0,a.useState)(null),[k,C]=(0,a.useState)(""),[S,_]=(0,a.useState)(""),[A,E]=(0,a.useState)(!1),[O,I]=(0,a.useState)({}),[P,M]=(0,a.useState)(!1),[R,T]=(0,a.useState)(""),$=(0,a.useRef)(!1),K=(()=>{if(!u?.installed)return null;let e=u.settings?.models?.providers?.["9router"];return e?e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1")||e.baseUrl?.includes("0.0.0.0")?"configured":"other":"not_configured"})();(0,a.useEffect)(()=>{d?.length>0&&!k&&C(d[0].key)},[d,k]),(0,a.useEffect)(()=>{t&&!u&&(U(),L())},[t,u]);let L=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&I(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(u?.installed&&!$.current){$.current=!0;let e=u.settings?.models?.providers?.["9router"];if(e){let t=u.settings?.agents?.defaults?.model?.primary;t&&_(t.replace("9router/","")),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&C(e.apiKey)}}},[u,d]);let U=async()=>{y(!0);try{let e=await fetch("/api/cli-tools/openclaw-settings"),t=await e.json();h(t)}catch(e){h({installed:!1,error:e.message})}finally{y(!1)}},F=()=>window.location.origin.replace("://localhost","://127.0.0.1"),z=()=>{let e=R||F();return e.endsWith("/v1")?e:`${e}/v1`},D=async()=>{b(!0),w(null);try{let e=k?.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:z(),apiKey:e,model:S})}),s=await t.json();t.ok?(w({type:"success",text:"Settings applied successfully!"}),U()):w({type:"error",text:s.error||"Failed to apply settings"})}catch(e){w({type:"error",text:e.message})}finally{b(!1)}},H=async()=>{v(!0),w(null);try{let e=await fetch("/api/cli-tools/openclaw-settings",{method:"DELETE"}),t=await e.json();e.ok?(w({type:"success",text:"Settings reset successfully!"}),_(""),C(""),U()):w({type:"error",text:t.error||"Failed to reset settings"})}catch(e){w({type:"error",text:e.message})}finally{v(!1)}};return(0,l.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(o.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,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===K&&(0,l.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"===K&&(0,l.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"===K&&(0,l.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,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[g&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Open Claw CLI..."})]}),!g&&u&&!u.installed&&(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Open Claw CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Open Claw CLI to use this feature."})]})]}),!g&&u?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[u?.settings?.models?.providers?.["9router"]?.baseUrl&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:u.settings.models.providers["9router"].baseUrl})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(m=R||F()).endsWith("/v1")?m:`${m}/v1`,onChange:e=>T(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"}),R&&R!==n&&(0,l.jsx)("button",{onClick:()=>T(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,l.jsx)("select",{value:k,onChange:e=>C(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,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.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,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:S,onChange: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,l.jsx)("button",{onClick:()=>E(!0),disabled:!i,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${i?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),S&&(0,l.jsx)("button",{onClick:()=>_(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),N&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===N.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===N.type?"check_circle":"error"}),(0,l.jsx)("span",{children:N.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:D,disabled:!S,loading:f,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:H,disabled:!u?.has9Router,loading:j,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>M(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:A,onClose:()=>E(!1),onSelect:e=>{_(e.value),E(!1)},selectedModel:S,activeProviders:c,modelAliases:O,title:"Select Model for Open Claw"}),(0,l.jsx)(r.uR,{isOpen:P,onClose:()=>M(!1),title:"Open Claw - Manual Configuration",configs:(p=k&&k.trim()?k:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.openclaw/openclaw.json",content:JSON.stringify({agents:{defaults:{model:{primary:`9router/${S||"provider/model-id"}`}}},models:{providers:{"9router":{baseUrl:z(),apiKey:p,api:"openai-completions",models:[{id:S||"provider/model-id",name:(S||"provider/model-id").split("/").pop()}]}}}},null,2)}])})]})}function h({toolId:e,tool:t,isExpanded:s,onToggle:n,baseUrl:i,apiKeys:d,activeProviders:c=[],cloudEnabled:x=!1}){let[m,p]=(0,a.useState)(null),[u,h]=(0,a.useState)(!1),[g,y]=(0,a.useState)(""),[f,b]=(0,a.useState)(()=>d?.length>0?d[0].key:""),j=e=>{let t=f&&f.trim()?f:x?"your-api-key":"sk_9router",s=i||"http://localhost:20128",l=s.endsWith("/v1")?s:`${s}/v1`;return e.replace(/\{\{baseUrl\}\}/g,l).replace(/\{\{apiKey\}\}/g,t).replace(/\{\{model\}\}/g,g||"provider/model-id")},v=async(e,t)=>{await navigator.clipboard.writeText(j(e)),p(t),setTimeout(()=>p(null),2e3)},N=c.length>0,w=()=>!t.requiresCloud||!!x;return(0,l.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:n,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:t.image?(0,l.jsx)(o.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,l.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:t.color},children:t.icon}):(0,l.jsx)(o.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,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:t.name}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:t.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${s?"rotate-180":""}`,children:"expand_more"})]}),s&&(0,l.jsx)("div",{className:"mt-6 pt-6 border-t border-border",children:t.guideSteps?(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[t.notes&&0!==t.notes.length?(0,l.jsx)("div",{className:"flex flex-col gap-2 mb-4",children:t.notes.map((e,t)=>{if("cloudCheck"===e.type&&x)return null;let s="warning"===e.type,a="cloudCheck"===e.type&&!x,r="bg-blue-500/10 border-blue-500/30",n="text-blue-600 dark:text-blue-400",i="text-blue-500",o="info";return s?(r="bg-yellow-500/10 border-yellow-500/30",n="text-yellow-600 dark:text-yellow-400",i="text-yellow-500",o="warning"):a&&(r="bg-red-500/10 border-red-500/30",n="text-red-600 dark:text-red-400",i="text-red-500",o="error"),(0,l.jsxs)("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${r}`,children:[(0,l.jsx)("span",{className:`material-symbols-outlined text-lg ${i}`,children:o}),(0,l.jsx)("p",{className:`text-sm ${n}`,children:e.text})]},t)})}):null,w()&&t.guideSteps.map(e=>(0,l.jsxs)("div",{className:"flex items-start gap-4",children:[(0,l.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,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("p",{className:"font-medium text-text",children:e.title}),e.desc&&(0,l.jsx)("p",{className:"text-sm text-text-muted mt-0.5",children:e.desc}),"apiKeySelector"===e.type&&(0,l.jsx)("div",{className:"mt-2 flex items-center gap-2",children:d&&d.length>0?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("select",{value:f,onChange:e=>b(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,l.jsx)("option",{value:e.key,children:e.key},e.id))}),(0,l.jsx)("button",{onClick:()=>v(f,"apiKey"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"apiKey"===m?"check":"content_copy"})})]}):(0,l.jsx)("span",{className:"text-sm text-text-muted",children:x?"No API keys - Create one in Keys page":"sk_9router"})}),"modelSelector"===e.type&&(0,l.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,l.jsx)("input",{type:"text",value:g,onChange:e=>y(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,l.jsx)("button",{onClick:()=>h(!0),disabled:!N,className:`shrink-0 px-3 py-2 rounded-lg border text-sm transition-colors ${N?"bg-bg-secondary border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),g&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{onClick:()=>v(g,"model"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"model"===m?"check":"content_copy"})}),(0,l.jsx)("button",{onClick:()=>y(""),className:"p-2 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]})]}),e.value&&(0,l.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,l.jsx)("code",{className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm font-mono border border-border truncate",children:j(e.value)}),e.copyable&&(0,l.jsx)("button",{onClick:()=>v(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,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:m===`${e.step}-${e.title}`?"check":"content_copy"})})]})]})]},e.step)),w()&&t.codeBlock&&(0,l.jsxs)("div",{className:"mt-2",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wide",children:t.codeBlock.language}),(0,l.jsxs)("button",{onClick:()=>v(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,l.jsx)("span",{className:"material-symbols-outlined text-sm",children:"codeblock"===m?"check":"content_copy"}),"codeblock"===m?"Copied!":"Copy"]})]}),(0,l.jsx)("pre",{className:"p-4 bg-bg-secondary rounded-lg border border-border overflow-x-auto",children:(0,l.jsx)("code",{className:"text-sm font-mono whitespace-pre",children:j(t.codeBlock.code)})})]})]}):(0,l.jsx)("p",{className:"text-text-muted text-sm",children:"Coming soon..."})}),(0,l.jsx)(r.rq,{isOpen:u,onClose:()=>h(!1),onSelect:e=>{y(e.value)},selectedModel:g,activeProviders:c,title:"Select Model"})]})}function g({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:i,activeProviders:d,hasActiveProviders:c,cloudEnabled:x}){let[m,p]=(0,a.useState)(null),[u,h]=(0,a.useState)(!1),[g,y]=(0,a.useState)(!1),[f,b]=(0,a.useState)(""),[j,v]=(0,a.useState)(""),[N,w]=(0,a.useState)(null),[k,C]=(0,a.useState)({}),[S,_]=(0,a.useState)(!1),[A,E]=(0,a.useState)(null);(0,a.useEffect)(()=>{i?.length>0&&!j&&v(i[0].key)},[i,j]),(0,a.useEffect)(()=>{t&&!m&&(I(),O())},[t,m]);let O=async()=>{try{let e=await fetch("/api/cli-tools/antigravity-mitm/alias?tool=antigravity");if(e.ok){let t=(await e.json()).aliases||{};Object.keys(t).length>0&&C(t)}}catch(e){console.log("Error loading saved mappings:",e)}},I=async()=>{try{let e=await fetch("/api/cli-tools/antigravity-mitm");if(e.ok){let t=await e.json();p(t)}}catch(e){console.log("Error fetching status:",e),p({running:!1})}},P="u">typeof navigator&&navigator.userAgent?.includes("Windows"),M=async e=>{h(!0),w(null);try{let t=j?.trim()||(i?.length>0?i[0].key:null)||(x?null:"sk_9router"),s=await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:t,sudoPassword:e})}),l=await s.json();s.ok?(w({type:"success",text:"MITM started"}),y(!1),b(""),I()):w({type:"error",text:l.error||"Failed to start"})}catch(e){w({type:"error",text:e.message})}finally{h(!1)}},R=async e=>{h(!0),w(null);try{let t=await fetch("/api/cli-tools/antigravity-mitm",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:e})}),s=await t.json();t.ok?(w({type:"success",text:"MITM stopped"}),y(!1),b(""),I()):w({type:"error",text:s.error||"Failed to stop"})}catch(e){w({type:"error",text:e.message})}finally{h(!1)}},T=()=>{f.trim()?m?.running?R(f):M(f):w({type:"error",text:"Sudo password is required"})},$=(e,t)=>{C(s=>({...s,[e]:t}))},K=async()=>{h(!0),w(null);try{let e=await fetch("/api/cli-tools/antigravity-mitm/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:"antigravity",mappings:k})});if(!e.ok){let t=await e.json();throw Error(t.error||"Failed to save mappings")}w({type:"success",text:"Mappings saved!"})}catch(e){w({type:"error",text:e.message})}finally{h(!1)}},L=m?.running;return(0,l.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(o.default,{src:"/providers/antigravity.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,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),L?(0,l.jsx)(r.Ex,{variant:"success",size:"sm",children:"Active"}):(0,l.jsx)(r.Ex,{variant:"default",size:"sm",children:"Inactive"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[(0,l.jsx)("div",{className:"flex items-center gap-2",children:L?(0,l.jsxs)("button",{onClick:()=>{P||m?.hasCachedPassword?R(""):(y(!0),w(null))},disabled:u,className:"px-4 py-2 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-sm flex items-center gap-2 hover:bg-red-500/20 transition-colors disabled:opacity-50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"stop_circle"}),"Stop MITM"]}):(0,l.jsxs)("button",{onClick:()=>{P||m?.hasCachedPassword?M(""):(y(!0),w(null))},disabled:u||!c,className:"px-4 py-2 rounded-lg bg-primary/10 border border-primary/30 text-primary font-medium text-sm flex items-center gap-2 hover:bg-primary/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"play_circle"}),"Start MITM"]})}),N?.type==="error"&&(0,l.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,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,l.jsx)("span",{children:N.text})]}),L&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),i.length>0?(0,l.jsx)("select",{value:j,onChange:e=>v(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:i.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.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)"})]}),e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:k[e.alias]||"",onChange:t=>$(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,l.jsx)("button",{onClick:()=>{E(e.alias),_(!0)},disabled:!c,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${c?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),k[e.alias]&&(0,l.jsx)("button",{onClick:()=>$(e.alias,""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.alias)),(0,l.jsx)("div",{className:"flex items-center gap-2",children:(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:K,disabled:u||0===Object.keys(k).length,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Save Mappings"]})})]}),!L&&(0,l.jsxs)("div",{className:"flex flex-col gap-1.5 px-1",children:[(0,l.jsxs)("p",{className:"text-xs text-text-muted",children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"How it works:"})," Intercepts Antigravity traffic via DNS redirect, letting you reroute models through 9Router."]}),(0,l.jsxs)("div",{className:"flex flex-col gap-0.5 text-[11px] text-text-muted",children:[(0,l.jsx)("span",{children:"1. Generates SSL cert & adds to system keychain"}),(0,l.jsxs)("span",{children:["2. Redirects ",(0,l.jsx)("code",{className:"text-[10px] bg-surface px-1 rounded",children:"daily-cloudcode-pa.googleapis.com"})," → localhost"]}),(0,l.jsx)("span",{children:"3. Maps Antigravity models to any provider via 9Router"})]})]})]}),(0,l.jsx)(r.aF,{isOpen:g,onClose:()=>{y(!1),b(""),w(null)},title:"Sudo Password Required",size:"sm",children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Required for SSL certificate and DNS configuration"})]}),(0,l.jsx)(r.pd,{type:"password",placeholder:"Enter sudo password",value:f,onChange:e=>b(e.target.value),onKeyDown:e=>{"Enter"!==e.key||u||T()}}),N&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===N.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===N.type?"check_circle":"error"}),(0,l.jsx)("span",{children:N.text})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{y(!1),b(""),w(null)},disabled:u,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:T,loading:u,children:"Confirm"})]})]})}),(0,l.jsx)(r.rq,{isOpen:S,onClose:()=>_(!1),onSelect:e=>{A&&C(t=>({...t,[A]:e.value}))},selectedModel:A?k[A]:null,activeProviders:d,title:`Select model for ${A}`})]})}let y="https://9router.com";function f({machineId:e}){let t,s,o,[d,m]=(0,a.useState)([]),[f,b]=(0,a.useState)(!0),[j,v]=(0,a.useState)(null),[N,w]=(0,a.useState)({}),[k,C]=(0,a.useState)(!1),[S,_]=(0,a.useState)([]);(0,a.useEffect)(()=>{O(),A(),E()},[]);let A=async()=>{try{let e=await fetch("/api/settings");if(e.ok){let t=await e.json();C(t.cloudEnabled||!1)}}catch(e){console.log("Error loading cloud settings:",e)}},E=async()=>{try{let e=await fetch("/api/keys");if(e.ok){let t=await e.json();_(t.keys||[])}}catch(e){console.log("Error fetching API keys:",e)}},O=async()=>{try{let e=await fetch("/api/providers"),t=await e.json();e.ok&&m(t.connections||[])}catch(e){console.log("Error fetching connections:",e)}finally{b(!1)}},I=()=>d.filter(e=>!1!==e.isActive),P=(0,a.useCallback)((e,t,s)=>{w(l=>l[e]?.[t]===s?l:{...l,[e]:{...l[e],[t]:s}})},[]);if(f)return(0,l.jsx)("div",{className:"flex flex-col gap-6",children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)(r.Qv,{}),(0,l.jsx)(r.Qv,{}),(0,l.jsx)(r.Qv,{})]})});let M=(t=I(),s=[],o=new Set,t.forEach(e=>{let t=i.Xg[e.provider]||e.provider;(0,i.KC)(e.provider).forEach(l=>{let a=`${t}/${l.id}`;o.has(a)||(o.add(a),s.push({value:a,label:`${t}/${l.id}`,provider:e.provider,alias:t,connectionName:e.name,modelId:l.id}))})}),s).length>0;return(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[!M&&(0,l.jsx)(r.Zp,{className:"border-yellow-500/50 bg-yellow-500/5",children:(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"No active providers"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please add and connect providers first to configure CLI tools."})]})]})}),(0,l.jsx)("div",{className:"flex flex-col gap-4",children:Object.entries(n).map(([e,t])=>((e,t)=>{let s={tool:t,isExpanded:j===e,onToggle:()=>v(j===e?null:e),baseUrl:k&&y?y:window.location.origin,apiKeys:S};switch(e){case"claude":return(0,l.jsx)(c,{...s,activeProviders:I(),modelMappings:N[e]||{},onModelMappingChange:(t,s)=>P(e,t,s),hasActiveProviders:M,cloudEnabled:k},e);case"codex":return(0,l.jsx)(x,{...s,activeProviders:I(),cloudEnabled:k},e);case"droid":return(0,l.jsx)(p,{...s,activeProviders:I(),hasActiveProviders:M,cloudEnabled:k},e);case"openclaw":return(0,l.jsx)(u,{...s,activeProviders:I(),hasActiveProviders:M,cloudEnabled:k},e);case"antigravity":return(0,l.jsx)(g,{...s,activeProviders:I(),hasActiveProviders:M,cloudEnabled:k},e);default:return(0,l.jsx)(h,{toolId:e,...s,activeProviders:I(),cloudEnabled:k},e)}})(e,t))})]})}}},e=>{e.O(0,[600,3624,8729,5497,8441,3794,7358],()=>e(e.s=2016)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3471],{4561:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>c});var a=t(5155),r=t(2115),i=t(5497),l=t(1620),n=t(1474),d=t(620);function c(){let{theme:e,setTheme:s,isDark:t}=(0,l.D)(),[c,o]=(0,r.useState)({fallbackStrategy:"fill-first"}),[m,x]=(0,r.useState)(!0),[h,p]=(0,r.useState)({current:"",new:"",confirm:""}),[u,b]=(0,r.useState)({type:"",message:""}),[j,f]=(0,r.useState)(!1);(0,r.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{o(e),x(!1)}).catch(e=>{console.error("Failed to fetch settings:",e),x(!1)})},[]);let g=async e=>{if(e.preventDefault(),h.new!==h.confirm)return void b({type:"error",message:"Passwords do not match"});f(!0),b({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:h.current,newPassword:h.new})}),s=await e.json();e.ok?(b({type:"success",message:"Password updated successfully"}),p({current:"",new:"",confirm:""})):b({type:"error",message:s.error||"Failed to update password"})}catch(e){b({type:"error",message:"An error occurred"})}finally{f(!1)}},N=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({fallbackStrategy:e})})).ok&&o(s=>({...s,fallbackStrategy:e}))}catch(e){console.error("Failed to update settings:",e)}},y=async e=>{let s=parseInt(e);if(!isNaN(s)&&!(s<1))try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({stickyRoundRobinLimit:s})})).ok&&o(e=>({...e,stickyRoundRobinLimit:s}))}catch(e){console.error("Failed to update sticky limit:",e)}},v=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireLogin:e})})).ok&&o(s=>({...s,requireLogin:e}))}catch(e){console.error("Failed to update require login:",e)}},w=async(e,s)=>{let t=parseInt(s);if(!isNaN(t)&&!(t<1))try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[e]:t})})).ok&&o(s=>({...s,[e]:t}))}catch(s){console.error(`Failed to update ${e}:`,s)}};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 gap-4 mb-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:"pt-4 border-t border-border",children:(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["All data is stored locally in the ",(0,a.jsx)("code",{className:"bg-sidebar px-1 rounded",children:"~/.9router/db.json"})," file."]})})]}),(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===c.requireLogin,onChange:()=>v(!c.requireLogin),disabled:m})]}),!0===c.requireLogin&&(0,a.jsxs)("form",{onSubmit:g,className:"flex flex-col gap-4 pt-4 border-t border-border/50",children:[c.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:h.current,onChange:e=>p({...h,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:h.new,onChange:e=>p({...h,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:h.confirm,onChange:e=>p({...h,confirm:e.target.value}),required:!0})]})]}),u.message&&(0,a.jsx)("p",{className:`text-sm ${"error"===u.type?"text-red-500":"text-green-500"}`,children:u.message}),(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsx)(i.$n,{type:"submit",variant:"primary",loading:j,children:c.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"===c.fallbackStrategy,onChange:()=>N("round-robin"===c.fallbackStrategy?"fill-first":"round-robin"),disabled:m})]}),"round-robin"===c.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:c.stickyRoundRobinLimit||3,onChange:e=>y(e.target.value),disabled:m,className:"w-20 text-center"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted italic pt-2 border-t border-border/50",children:"round-robin"===c.fallbackStrategy?`Currently distributing requests across all available accounts with ${c.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:"palette"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Appearance"})]}),(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:"Dark Mode"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Switch between light and dark themes"})]}),(0,a.jsx)(i.lM,{checked:t,onChange:()=>s(t?"light":"dark")})]}),(0,a.jsx)("div",{className:"pt-4 border-t border-border",children:(0,a.jsx)("div",{className:"inline-flex p-1 rounded-lg bg-black/5 dark:bg-white/5",children:["light","dark","system"].map(t=>(0,a.jsxs)("button",{type:"button",onClick:()=>s(t),className:(0,n.cn)("flex items-center gap-2 px-4 py-2 rounded-md font-medium transition-all",e===t?"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-[20px]",children:"light"===t?"light_mode":"dark"===t?"dark_mode":"contrast"}),(0,a.jsx)("span",{className:"capitalize",children:t})]},t))})})]})]}),(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-green-500/10 text-green-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"database"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Data"})]}),(0,a.jsx)("div",{className:"flex flex-col gap-3",children:(0,a.jsx)("div",{className:"flex items-center justify-between p-4 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:"~/.9router/db.json"})]})})})]}),(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 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:"Max Records"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Maximum request detail records to keep (older records are auto-deleted)"})]}),(0,a.jsx)(i.pd,{type:"number",min:"100",max:"10000",step:"100",value:c.observabilityMaxRecords||1e3,onChange:e=>w("observabilityMaxRecords",parseInt(e.target.value)),disabled:m,className:"w-28 text-center"})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Batch Size"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Number of items to accumulate before writing to database (higher = better performance)"})]}),(0,a.jsx)(i.pd,{type:"number",min:"5",max:"100",step:"5",value:c.observabilityBatchSize||20,onChange:e=>w("observabilityBatchSize",parseInt(e.target.value)),disabled:m,className:"w-28 text-center"})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Flush Interval (ms)"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Maximum time to wait before flushing buffer (prevents data loss during low traffic)"})]}),(0,a.jsx)(i.pd,{type:"number",min:"1000",max:"30000",step:"1000",value:c.observabilityFlushIntervalMs||5e3,onChange:e=>w("observabilityFlushIntervalMs",parseInt(e.target.value)),disabled:m,className:"w-28 text-center"})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Max JSON Size (KB)"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Maximum size for each JSON field (request/response) before truncation"})]}),(0,a.jsx)(i.pd,{type:"number",min:"100",max:"10240",step:"100",value:c.observabilityMaxJsonSize||1024,onChange:e=>w("observabilityMaxJsonSize",parseInt(e.target.value)),disabled:m,className:"w-28 text-center"})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted italic pt-2 border-t border-border/50",children:["Current: Keeps ",c.observabilityMaxRecords||1e3," records, batches every ",c.observabilityBatchSize||20," requests, max ",c.observabilityMaxJsonSize||1024,"KB per field"]})]})]}),(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"})]})]})})}},6086:(e,s,t)=>{Promise.resolve().then(t.bind(t,4561))}},e=>{e.O(0,[600,3624,8729,5497,8441,3794,7358],()=>e(e.s=6086)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{2397:(e,t,i)=>{Promise.resolve().then(i.bind(i,7162))},7162:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>h});var s=i(5155),a=i(2115),l=i(4051),r=i.n(l),n=i(3321),o=i(8500),d=i.n(o),c=i(5772),p=i(5497),m=i(2679),u=i(8777),x=i(1059);function h(){let e=(0,n.useParams)(),t=(0,n.useRouter)(),i=e.id,[l,r]=(0,a.useState)([]),[o,h]=(0,a.useState)(!0),[v,b]=(0,a.useState)(null),[w,k]=(0,a.useState)(!1),[S,$]=(0,a.useState)(!1),[T,O]=(0,a.useState)(!1),[E,R]=(0,a.useState)(!1),[I,q]=(0,a.useState)(null),[P,U]=(0,a.useState)({}),[K,D]=(0,a.useState)(!1),{copied:M,copy:L}=(0,x.C)(),_=v?{id:v.id,name:v.name||("anthropic-compatible"===v.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===v.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===v.type?"AC":"OC",apiType:v.apiType,baseUrl:v.baseUrl,type:v.type}:m.zN[i]||m.fg[i]||m.IS[i],F=!!m.zN[i]||!!m.IS[i],z=(0,u.KC)(i),J=(0,m.wG)(i),W=(0,m.mq)(i),V=(0,m.gb)(i),B=W||V,Z=B?i:J,G=B?v?.prefix||i:J,Q=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&U(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),H=(0,a.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"})]),s=await e.json(),a=await t.json();if(e.ok){let e=(s.connections||[]).filter(e=>e.provider===i);r(e)}if(t.ok){let e=(a.nodes||[]).find(e=>e.id===i)||null;if(!e&&B)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===i)||null))break}b(e)}}catch(e){console.log("Error fetching connections:",e)}finally{h(!1)}},[i,B]),X=async e=>{try{let t=await fetch(`/api/provider-nodes/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(b(s.node),await H(),R(!1))}catch(e){console.log("Error updating provider node:",e)}};(0,a.useEffect)(()=>{H(),Q()},[H,Q]);let Y=async(e,t,i=J)=>{let s=`${i}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:s,alias:t})});if(e.ok)await Q();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},ee=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await Q()}catch(e){console.log("Error deleting alias:",e)}},et=async e=>{if(confirm("Delete this connection?"))try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&r(l.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}},ei=()=>{H(),k(!1)},es=async e=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:i,...e})})).ok&&(await H(),$(!1))}catch(e){console.log("Error saving connection:",e)}},ea=async e=>{try{(await fetch(`/api/providers/${I.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await H(),O(!1))}catch(e){console.log("Error updating connection:",e)}},el=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&r(i=>i.map(i=>i.id===e?{...i,isActive:t}:i))}catch(e){console.log("Error updating connection status:",e)}},er=async(e,t)=>{if(e&&t)try{let i=t.priority,s=e.priority;i===s&&(i=l.indexOf(e)>l.indexOf(t)?t.priority-.5:t.priority+.5),await Promise.all([fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:i})}),fetch(`/api/providers/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:s})})]),await H()}catch(e){console.log("Error swapping priority:",e)}};return o?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsx)(p.Qv,{}),(0,s.jsx)(p.Qv,{})]}):_?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)(d(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)("div",{className:"rounded-lg flex items-center justify-center",style:{backgroundColor:`${_.color}15`},children:K?(0,s.jsx)("span",{className:"text-sm font-bold",style:{color:_.color},children:_.textIcon||_.id.slice(0,2).toUpperCase()}):(0,s.jsx)(c.default,{src:W&&_.apiType?"responses"===_.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":V?"/providers/anthropic-m.png":`/providers/${_.id}.png`,alt:_.name,width:48,height:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",sizes:"48px",onError:()=>D(!0)})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:_.name}),(0,s.jsxs)("p",{className:"text-text-muted",children:[l.length," connection",1===l.length?"":"s"]})]})]})]}),B&&v&&(0,s.jsxs)(p.Zp,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:V?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:[V?"Messages API":"responses"===v.apiType?"Responses API":"Chat Completions"," \xb7 ",(v.baseUrl||"").replace(/\/$/,""),"/",V?"messages":"responses"===v.apiType?"responses":"chat/completions"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(p.$n,{size:"sm",icon:"add",onClick:()=>$(!0),disabled:l.length>0,children:"Add"}),(0,s.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>R(!0),children:"Edit"}),(0,s.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{if(confirm(`Delete this ${V?"Anthropic":"OpenAI"} Compatible node?`))try{(await fetch(`/api/provider-nodes/${i}`,{method:"DELETE"})).ok&&t.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}},children:"Delete"})]})]}),l.length>0&&(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Only one connection is allowed per compatible node. Add another node if you need more connections."})]}),(0,s.jsxs)(p.Zp,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),!B&&(0,s.jsx)(p.$n,{size:"sm",icon:"add",onClick:()=>F?k(!0):$(!0),children:"Add"})]}),0===l.length?(0,s.jsxs)("div",{className:"text-center py-12",children:[(0,s.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:F?"lock":"key"})}),(0,s.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No connections yet"}),(0,s.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Add your first connection to get started"}),!B&&(0,s.jsx)(p.$n,{icon:"add",onClick:()=>F?k(!0):$(!0),children:"Add Connection"})]}):(0,s.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:l.sort((e,t)=>(e.priority||0)-(t.priority||0)).map((e,t)=>(0,s.jsx)(j,{connection:e,isOAuth:F,isFirst:0===t,isLast:t===l.length-1,onMoveUp:()=>er(e,l[t-1]),onMoveDown:()=>er(e,l[t+1]),onToggleActive:t=>el(e.id,t),onEdit:()=>{q(e),O(!0)},onDelete:()=>et(e.id)},e.id))})]}),(0,s.jsxs)(p.Zp,{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4",children:_.passthroughModels?"Model Aliases":"Available Models"}),B?(0,s.jsx)(g,{providerStorageAlias:Z,providerDisplayAlias:G,modelAliases:P,copied:M,onCopy:L,onSetAlias:Y,onDeleteAlias:ee,connections:l,isAnthropic:V}):_.passthroughModels?(0,s.jsx)(f,{providerAlias:J,modelAliases:P,copied:M,onCopy:L,onSetAlias:Y,onDeleteAlias:ee}):0===z.length?(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"No models configured"}):(0,s.jsx)("div",{className:"flex flex-wrap gap-3",children:z.map(e=>{let t=`${Z}/${e.id}`,a=`${i}/${e.id}`,l=Object.entries(P).find(([,e])=>e===t||e===a)?.[0];return(0,s.jsx)(y,{model:e,fullModel:`${G}/${e.id}`,alias:l,copied:M,onCopy:L,onSetAlias:t=>Y(e.id,t,Z),onDeleteAlias:()=>ee(l)},e.id)})})]}),"kiro"===i?(0,s.jsx)(p.Mh,{isOpen:w,providerInfo:_,onSuccess:ei,onClose:()=>k(!1)}):"cursor"===i?(0,s.jsx)(p.G9,{isOpen:w,onSuccess:ei,onClose:()=>k(!1)}):(0,s.jsx)(p.LF,{isOpen:w,provider:i,providerInfo:_,onSuccess:ei,onClose:()=>k(!1)}),(0,s.jsx)(N,{isOpen:S,provider:i,providerName:_.name,isCompatible:B,isAnthropic:V,onSave:es,onClose:()=>$(!1)}),(0,s.jsx)(C,{isOpen:T,connection:I,onSave:ea,onClose:()=>O(!1)}),B&&(0,s.jsx)(A,{isOpen:E,node:v,onSave:X,onClose:()=>R(!1),isAnthropic:V})]}):(0,s.jsxs)("div",{className:"text-center py-20",children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,s.jsx)(d(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}function y({model:e,fullModel:t,alias:i,copied:a,onCopy:l}){return(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:"smart_toy"}),(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,s.jsx)("button",{onClick:()=>l(t,`model-${e.id}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:a===`model-${e.id}`?"check":"content_copy"})})]})}function f({providerAlias:e,modelAliases:t,copied:i,onCopy:l,onSetAlias:r,onDeleteAlias:n}){let[o,d]=(0,a.useState)(""),[c,m]=(0,a.useState)(!1),u=Object.entries(t).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,i])=>({modelId:i.replace(`${e}/`,""),fullModel:i,alias:t})),x=async()=>{let e;if(!o.trim()||c)return;let i=o.trim(),s=(e=i.split("/"))[e.length-1];if(t[s])return void alert(`Alias "${s}" already exists. Please use a different model or edit existing alias.`);m(!0);try{await r(i,s),d("")}catch(e){console.log("Error adding model:",e)}finally{m(!1)}};return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"OpenRouter supports any model. Add models and create aliases for quick access."}),(0,s.jsxs)("div",{className:"flex items-end gap-2",children:[(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("label",{htmlFor:"new-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID (from OpenRouter)"}),(0,s.jsx)("input",{id:"new-model-input",type:"text",value:o,onChange:e=>d(e.target.value),onKeyDown:e=>"Enter"===e.key&&x(),placeholder:"anthropic/claude-3-opus",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,s.jsx)(p.$n,{size:"sm",icon:"add",onClick:x,disabled:!o.trim()||c,children:c?"Adding...":"Add"})]}),u.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-3",children:u.map(({modelId:e,fullModel:t,alias:a})=>(0,s.jsx)(v,{modelId:e,fullModel:t,copied:i,onCopy:l,onDeleteAlias:()=>n(a)},t))})]})}function v({modelId:e,fullModel:t,copied:i,onCopy:a,onDeleteAlias:l}){return(0,s.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:"smart_toy"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,s.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,s.jsx)("button",{onClick:()=>a(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:i===`model-${e}`?"check":"content_copy"})})]})]}),(0,s.jsx)("button",{onClick:l,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function g({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:i,copied:l,onCopy:r,onSetAlias:n,onDeleteAlias:o,connections:d,isAnthropic:c}){let[m,u]=(0,a.useState)(""),[x,h]=(0,a.useState)(!1),[y,f]=(0,a.useState)(!1),g=Object.entries(i).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,i])=>({modelId:i.replace(`${e}/`,""),fullModel:i,alias:t})),b=e=>{let s,a=(s=e.split("/"))[s.length-1];if(!i[a])return a;let l=`${t}-${a}`;return i[l]?null:l},j=async()=>{if(!m.trim()||x)return;let t=m.trim(),i=b(t);if(!i)return void alert("All suggested aliases already exist. Please choose a different model or remove conflicting aliases.");h(!0);try{await n(t,i,e),u("")}catch(e){console.log("Error adding model:",e)}finally{h(!1)}},N=async()=>{if(y)return;let t=d.find(e=>!1!==e.isActive);if(t){f(!0);try{let i=await fetch(`/api/providers/${t.id}/models`),s=await i.json();if(!i.ok)return void alert(s.error||"Failed to import models");let a=s.models||[];if(0===a.length)return void alert("No models returned from /models.");let l=0;for(let t of a){let i=t.id||t.name||t.model;if(!i)continue;let s=b(i);s&&(await n(i,s,e),l+=1)}0===l&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{f(!1)}}},C=d.some(e=>!1!==e.isActive);return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",c?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,s.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,s.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,s.jsx)("input",{id:"new-compatible-model-input",type:"text",value:m,onChange:e=>u(e.target.value),onKeyDown:e=>"Enter"===e.key&&j(),placeholder:c?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,s.jsx)(p.$n,{size:"sm",icon:"add",onClick:j,disabled:!m.trim()||x,children:x?"Adding...":"Add"}),(0,s.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"download",onClick:N,disabled:!C||y,children:y?"Importing...":"Import from /models"})]}),!C&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),g.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-3",children:g.map(({modelId:e,fullModel:i,alias:a})=>(0,s.jsx)(v,{modelId:e,fullModel:`${t}/${e}`,copied:l,onCopy:r,onDeleteAlias:()=>o(a)},i))})]})}function b({until:e}){let[t,i]=(0,a.useState)("");return((0,a.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void i("");let s=Math.floor(t/1e3);if(s<60)i(`${s}s`);else if(s<3600)i(`${Math.floor(s/60)}m ${s%60}s`);else{let e=Math.floor(s/3600),t=Math.floor(s%3600/60);i(`${e}h ${t}m`)}};t();let s=setInterval(t,1e3);return()=>clearInterval(s)},[e]),t)?(0,s.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function j({connection:e,isOAuth:t,isFirst:i,isLast:l,onMoveUp:r,onMoveDown:n,onToggleActive:o,onEdit:d,onDelete:c}){let m=t?e.name||e.email||e.displayName||"OAuth Account":e.name,[u,x]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let t=()=>{x(e.rateLimitedUntil&&new Date(e.rateLimitedUntil).getTime()>Date.now())};t();let i=e.rateLimitedUntil?setInterval(t,1e3):null;return()=>{i&&clearInterval(i)}},[e.rateLimitedUntil]);let h="unavailable"!==e.testStatus||u?e.testStatus:"active";return(0,s.jsxs)("div",{className:`group flex items-center justify-between p-3 rounded-lg hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${!1===e.isActive?"opacity-60":""}`,children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("button",{onClick:r,disabled:i,className:`p-0.5 rounded ${i?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,s.jsx)("button",{onClick:n,disabled:l,className:`p-0.5 rounded ${l?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:t?"lock":"key"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:m}),(0,s.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,s.jsx)(p.Ex,{variant:!1===e.isActive?"default":"active"===h||"success"===h?"success":"error"===h||"expired"===h||"unavailable"===h?"error":"default",size:"sm",dot:!0,children:!1===e.isActive?"disabled":h||"Unknown"}),u&&!1!==e.isActive&&(0,s.jsx)(b,{until:e.rateLimitedUntil}),e.lastError&&!1!==e.isActive&&(0,s.jsx)("span",{className:"text-xs text-red-500 truncate max-w-[300px]",title:e.lastError,children:e.lastError}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]})]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(p.lM,{size:"sm",checked:e.isActive??!0,onChange:o,title:e.isActive??!0?"Disable connection":"Enable connection"}),(0,s.jsxs)("div",{className:"flex gap-1 ml-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,s.jsx)("button",{onClick:d,className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,s.jsx)("button",{onClick:c,className:"p-2 hover:bg-red-500/10 rounded text-red-500",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]})]})}function N({isOpen:e,provider:t,providerName:i,isCompatible:l,isAnthropic:r,onSave:n,onClose:o}){let[d,c]=(0,a.useState)({name:"",apiKey:"",priority:1}),[m,u]=(0,a.useState)(!1),[x,h]=(0,a.useState)(null),[y,f]=(0,a.useState)(!1),v=async()=>{u(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:d.apiKey})}),i=await e.json();h(i.valid?"success":"failed")}catch{h("failed")}finally{u(!1)}},g=async()=>{if(t&&d.apiKey){f(!0);try{let e=!1;try{u(!0),h(null);let i=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:d.apiKey})});e=!!(await i.json()).valid,h(e?"success":"failed")}catch{h("failed")}finally{u(!1)}await n({name:d.name,apiKey:d.apiKey,priority:d.priority,testStatus:e?"active":"unknown"})}finally{f(!1)}}};return t?(0,s.jsx)(p.aF,{isOpen:e,title:`Add ${i||t} API Key`,onClose:o,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(p.pd,{label:"Name",value:d.name,onChange:e=>c({...d,name:e.target.value}),placeholder:"Production Key"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.pd,{label:"API Key",type:"password",value:d.apiKey,onChange:e=>c({...d,apiKey:e.target.value}),className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(p.$n,{onClick:v,disabled:!d.apiKey||m||y,variant:"secondary",children:m?"Checking...":"Check"})})]}),x&&(0,s.jsx)(p.Ex,{variant:"success"===x?"success":"error",children:"success"===x?"Valid":"Invalid"}),l&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:r?`Validation checks ${i||"Anthropic Compatible"} by verifying the API key.`:`Validation checks ${i||"OpenAI Compatible"} via /models on your base URL.`}),(0,s.jsx)(p.pd,{label:"Priority",type:"number",value:d.priority,onChange:e=>c({...d,priority:Number.parseInt(e.target.value)||1})}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.$n,{onClick:g,fullWidth:!0,disabled:!d.name||!d.apiKey||y,children:y?"Saving...":"Save"}),(0,s.jsx)(p.$n,{onClick:o,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function C({isOpen:e,connection:t,onSave:i,onClose:l}){let[r,n]=(0,a.useState)({name:"",priority:1,apiKey:""}),[o,d]=(0,a.useState)(!1),[c,u]=(0,a.useState)(null),[x,h]=(0,a.useState)(!1),[y,f]=(0,a.useState)(null),[v,g]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&(n({name:t.name||"",priority:t.priority||1,apiKey:""}),u(null),f(null))},[t]);let b=async()=>{if(t?.provider){d(!0),u(null);try{let e=await fetch(`/api/providers/${t.id}/test`,{method:"POST"}),i=await e.json();u(i.valid?"success":"failed")}catch{u("failed")}finally{d(!1)}}},j=async()=>{if(t?.provider&&r.apiKey){h(!0),f(null);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:r.apiKey})}),i=await e.json();f(i.valid?"success":"failed")}catch{f("failed")}finally{h(!1)}}},N=async()=>{g(!0);try{let e={name:r.name,priority:r.priority};if(!C&&r.apiKey){e.apiKey=r.apiKey;let i="success"===y;if(!i)try{h(!0),f(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:r.apiKey})});i=!!(await e.json()).valid,f(i?"success":"failed")}catch{f("failed")}finally{h(!1)}i&&(e.testStatus="active",e.lastError=null,e.lastErrorAt=null)}await i(e)}finally{g(!1)}};if(!t)return null;let C="oauth"===t.authType,A=(0,m.mq)(t.provider)||(0,m.gb)(t.provider);return(0,s.jsx)(p.aF,{isOpen:e,title:"Edit Connection",onClose:l,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(p.pd,{label:"Name",value:r.name,onChange:e=>n({...r,name:e.target.value}),placeholder:C?"Account name":"Production Key"}),C&&t.email&&(0,s.jsxs)("div",{className:"bg-sidebar/50 p-3 rounded-lg",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted mb-1",children:"Email"}),(0,s.jsx)("p",{className:"font-medium",children:t.email})]}),(0,s.jsx)(p.pd,{label:"Priority",type:"number",value:r.priority,onChange:e=>n({...r,priority:Number.parseInt(e.target.value)||1})}),!C&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.pd,{label:"API Key",type:"password",value:r.apiKey,onChange:e=>n({...r,apiKey:e.target.value}),placeholder:"Enter new API key",hint:"Leave blank to keep the current API key.",className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(p.$n,{onClick:j,disabled:!r.apiKey||x||v,variant:"secondary",children:x?"Checking...":"Check"})})]}),y&&(0,s.jsx)(p.Ex,{variant:"success"===y?"success":"error",children:"success"===y?"Valid":"Invalid"})]}),!A&&(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(p.$n,{onClick:b,variant:"secondary",disabled:o,children:o?"Testing...":"Test Connection"}),c&&(0,s.jsx)(p.Ex,{variant:"success"===c?"success":"error",children:"success"===c?"Valid":"Failed"})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.$n,{onClick:N,fullWidth:!0,disabled:v,children:v?"Saving...":"Save"}),(0,s.jsx)(p.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function A({isOpen:e,node:t,onSave:i,onClose:l,isAnthropic:r}){let[n,o]=(0,a.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[d,c]=(0,a.useState)(!1),[m,u]=(0,a.useState)(""),[x,h]=(0,a.useState)(!1),[y,f]=(0,a.useState)(null);(0,a.useEffect)(()=>{t&&o({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(r?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,r]);let v=async()=>{if(n.name.trim()&&n.prefix.trim()&&n.baseUrl.trim()){c(!0);try{let e={name:n.name,prefix:n.prefix,baseUrl:n.baseUrl};r||(e.apiType=n.apiType),await i(e)}finally{c(!1)}}},g=async()=>{h(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:n.baseUrl,apiKey:m,type:r?"anthropic-compatible":"openai-compatible"})}),t=await e.json();f(t.valid?"success":"failed")}catch{f("failed")}finally{h(!1)}};return t?(0,s.jsx)(p.aF,{isOpen:e,title:`Edit ${r?"Anthropic":"OpenAI"} Compatible`,onClose:l,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(p.pd,{label:"Name",value:n.name,onChange:e=>o({...n,name:e.target.value}),placeholder:`${r?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,s.jsx)(p.pd,{label:"Prefix",value:n.prefix,onChange:e=>o({...n,prefix:e.target.value}),placeholder:r?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!r&&(0,s.jsx)(p.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:n.apiType,onChange:e=>o({...n,apiType:e.target.value})}),(0,s.jsx)(p.pd,{label:"Base URL",value:n.baseUrl,onChange:e=>o({...n,baseUrl:e.target.value}),placeholder:r?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${r?"Anthropic":"OpenAI"}-compatible API.`}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.pd,{label:"API Key (for Check)",type:"password",value:m,onChange:e=>u(e.target.value),className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(p.$n,{onClick:g,disabled:!m||x||!n.baseUrl.trim(),variant:"secondary",children:x?"Checking...":"Check"})})]}),y&&(0,s.jsx)(p.Ex,{variant:"success"===y?"success":"error",children:"success"===y?"Valid":"Invalid"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.$n,{onClick:v,fullWidth:!0,disabled:!n.name.trim()||!n.prefix.trim()||!n.baseUrl.trim()||d,children:d?"Saving...":"Save"}),(0,s.jsx)(p.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}y.propTypes={model:r().shape({id:r().string.isRequired}).isRequired,fullModel:r().string.isRequired,alias:r().string,copied:r().string,onCopy:r().func.isRequired},f.propTypes={providerAlias:r().string.isRequired,modelAliases:r().object.isRequired,copied:r().string,onCopy:r().func.isRequired,onSetAlias:r().func.isRequired,onDeleteAlias:r().func.isRequired},v.propTypes={modelId:r().string.isRequired,fullModel:r().string.isRequired,copied:r().string,onCopy:r().func.isRequired,onDeleteAlias:r().func.isRequired},g.propTypes={providerStorageAlias:r().string.isRequired,providerDisplayAlias:r().string.isRequired,modelAliases:r().object.isRequired,copied:r().string,onCopy:r().func.isRequired,onSetAlias:r().func.isRequired,onDeleteAlias:r().func.isRequired,connections:r().arrayOf(r().shape({id:r().string,isActive:r().bool})).isRequired,isAnthropic:r().bool},b.propTypes={until:r().string.isRequired},j.propTypes={connection:r().shape({id:r().string,name:r().string,email:r().string,displayName:r().string,rateLimitedUntil:r().string,testStatus:r().string,isActive:r().bool,lastError:r().string,priority:r().number,globalPriority:r().number}).isRequired,isOAuth:r().bool.isRequired,isFirst:r().bool.isRequired,isLast:r().bool.isRequired,onMoveUp:r().func.isRequired,onMoveDown:r().func.isRequired,onToggleActive:r().func.isRequired,onEdit:r().func.isRequired,onDelete:r().func.isRequired},N.propTypes={isOpen:r().bool.isRequired,provider:r().string,providerName:r().string,isCompatible:r().bool,isAnthropic:r().bool,onSave:r().func.isRequired,onClose:r().func.isRequired},C.propTypes={isOpen:r().bool.isRequired,connection:r().shape({id:r().string,name:r().string,email:r().string,priority:r().number,authType:r().string,provider:r().string}),onSave:r().func.isRequired,onClose:r().func.isRequired},A.propTypes={isOpen:r().bool.isRequired,node:r().shape({id:r().string,name:r().string,prefix:r().string,apiType:r().string,baseUrl:r().string}),onSave:r().func.isRequired,onClose:r().func.isRequired,isAnthropic:r().bool}}},e=>{e.O(0,[600,3624,8729,5497,8441,3794,7358],()=>e(e.s=2397)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2825],{6788:(e,t,s)=>{Promise.resolve().then(s.bind(s,8982))},8982:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>y});var a=s(5155),r=s(2115),l=s(5497),n=s(5772),i=s(4588);s(6061);var o=s(3097);function d(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}function c({quotas:e=[]}){return e&&0!==e.length?(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full table-fixed",children:[(0,a.jsxs)("colgroup",{children:[(0,a.jsx)("col",{className:"w-[30%]"})," ",(0,a.jsx)("col",{className:"w-[45%]"})," ",(0,a.jsx)("col",{className:"w-[25%]"})," "]}),(0,a.jsx)("tbody",{children:e.map((e,t)=>{let s=void 0!==e.remainingPercentage?Math.round(e.remainingPercentage):d(e.used,e.total),r=s>70?{text:"text-green-600 dark:text-green-400",bg:"bg-green-500",bgLight:"bg-green-500/10",emoji:"\uD83D\uDFE2"}:s>=30?{text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-500",bgLight:"bg-yellow-500/10",emoji:"\uD83D\uDFE1"}:{text:"text-red-600 dark:text-red-400",bg:"bg-red-500",bgLight:"bg-red-500/10",emoji:"\uD83D\uDD34"},l=function(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"-"}}(e.resetAt),n=function(e){if(!e)return null;try{let t=new Date(e),s=new Date,a=new Date(s.getFullYear(),s.getMonth(),s.getDate()),r=new Date(a);r.setDate(r.getDate()+1);let l="";l=t>=a&&t<r?"Today":t>=r&&t<new Date(r.getTime()+864e5)?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let n=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${l}, ${n}`}catch{return null}}(e.resetAt);return(0,a.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,a.jsx)("td",{className:"py-2 px-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs",children:r.emoji}),(0,a.jsx)("span",{className:"text-sm font-medium text-text-primary",children:e.name})]})}),(0,a.jsx)("td",{className:"py-2 px-3",children:(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)("div",{className:`h-1.5 rounded-full overflow-hidden border ${r.bgLight} ${0===s?"border-black/10 dark:border-white/10":"border-transparent"}`,children:(0,a.jsx)("div",{className:`h-full transition-all duration-300 ${r.bg}`,style:{width:`${Math.min(s,100)}%`}})}),(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,a.jsxs)("span",{className:"text-text-muted",children:[e.used.toLocaleString()," / ",e.total>0?e.total.toLocaleString():"∞"]}),(0,a.jsxs)("span",{className:`font-medium ${r.text}`,children:[s,"%"]})]})]})}),(0,a.jsx)("td",{className:"py-2 px-3",children:"-"!==l||n?(0,a.jsxs)("div",{className:"space-y-0.5",children:["-"!==l&&(0,a.jsxs)("div",{className:"text-sm text-text-primary font-medium",children:["in ",l]}),n&&(0,a.jsx)("div",{className:"text-xs text-text-muted",children:n})]}):(0,a.jsx)("div",{className:"text-sm text-text-muted italic",children:"N/A"})})]},t)})})]})}):null}var x=s(2542),m=s(5086),u=s(2679);function h(){let[e,t]=(0,r.useState)([]),[s,l]=(0,r.useState)({}),[h,p]=(0,r.useState)({}),[f,g]=(0,r.useState)({}),[b,j]=(0,r.useState)(!0),[v,N]=(0,r.useState)(null),[w,k]=(0,r.useState)(!1),[y,S]=(0,r.useState)(60),[C,D]=(0,r.useState)(!0),q=(0,r.useRef)(null),$=(0,r.useRef)(null),L=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/providers/client");if(!e.ok)throw Error("Failed to fetch connections");let s=(await e.json()).connections||[];return t(s),s}catch(e){return console.error("Error fetching connections:",e),t([]),[]}},[]),E=(0,r.useCallback)(async(e,t)=>{p(t=>({...t,[e]:!0})),g(t=>({...t,[e]:null}));try{console.log(`[ProviderLimits] Fetching quota for ${t} (${e})`);let s=await fetch(`/api/usage/${e}`);if(!s.ok){let a=(await s.json().catch(()=>({}))).error||s.statusText;if(404===s.status)return void console.warn(`[ProviderLimits] Connection not found for ${t}, skipping`);if(401===s.status){console.warn(`[ProviderLimits] Auth error for ${t}:`,a),l(t=>({...t,[e]:{quotas:[],message:a}}));return}throw Error(`HTTP ${s.status}: ${a}`)}let a=await s.json();console.log(`[ProviderLimits] Got quota for ${t}:`,a);let r=function(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 a=(0,o.KC)(e);if(a.length>0){let e=new Map(a.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}(t,a);l(t=>({...t,[e]:{quotas:r,plan:a.plan||null,message:a.message||null,raw:a}}))}catch(s){console.error(`[ProviderLimits] Error fetching quota for ${t} (${e}):`,s),g(t=>({...t,[e]:s.message||"Failed to fetch quota"}))}finally{p(t=>({...t,[e]:!1}))}},[]),P=(0,r.useCallback)(async(e,t)=>{await E(e,t),N(new Date)},[E]),T=(0,r.useCallback)(async()=>{if(!w){k(!0),S(60);try{let e=(await L()).filter(e=>u.wb.includes(e.provider)&&"oauth"===e.authType);await Promise.all(e.map(e=>E(e.id,e.provider))),N(new Date)}catch(e){console.error("Error refreshing all providers:",e)}finally{k(!1)}}},[w,L,E]);(0,r.useEffect)(()=>{(async()=>{D(!0),await T(),D(!1)})()},[]),(0,r.useEffect)(()=>{if(!b){q.current&&(clearInterval(q.current),q.current=null),$.current&&(clearInterval($.current),$.current=null);return}return q.current=setInterval(()=>{T()},6e4),$.current=setInterval(()=>{S(e=>e<=1?60:e-1)},1e3),()=>{q.current&&clearInterval(q.current),$.current&&clearInterval($.current)}},[b,T]),(0,r.useEffect)(()=>{let e=()=>{document.hidden?(q.current&&(clearInterval(q.current),q.current=null),$.current&&(clearInterval($.current),$.current=null)):b&&(q.current=setInterval(T,6e4),$.current=setInterval(()=>{S(e=>e<=1?60:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[b,T]);let A=(0,r.useCallback)(()=>{if(!v)return"Never";let e=Math.floor((new Date-v)/6e4),t=Math.floor(e/60),s=Math.floor(t/24);return s>0?`${s}d ago`:t>0?`${t}h ago`:e>0?`${e}m ago`:"Just now"},[v]),z=[...e.filter(e=>u.wb.includes(e.provider)&&"oauth"===e.authType)].sort((e,t)=>{let s=e=>"antigravity"===e?1:"kiro"===e?2:3,a=s(e.provider),r=s(t.provider);return a!==r?a-r:e.provider.localeCompare(t.provider)});return(z.length,Object.values(s).filter(e=>e?.quotas?.length>0).length,Object.values(s).reduce((e,t)=>t?.quotas?e+ +!!t.quotas.some(e=>30>d(e.used,e.total)&&e.total>0):e,0),C)?(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(m.CardSkeleton,{}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[(0,a.jsx)(m.CardSkeleton,{}),(0,a.jsx)(m.CardSkeleton,{}),(0,a.jsx)(m.CardSkeleton,{})]})]}):0===z.length?(0,a.jsx)(i.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] text-text-muted opacity-20",children:"cloud_off"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:"No Providers Connected"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:"Connect to providers with OAuth to track your API quota limits and usage."})]})}):(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-text-primary",children:"Provider Limits"}),(0,a.jsxs)("span",{className:"text-sm text-text-muted",children:["Last updated: ",A()]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("button",{onClick:()=>j(e=>!e),className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-black/10 dark:border-white/10 hover:bg-black/5 dark:hover:bg-white/5 transition-colors",title:b?"Disable auto-refresh":"Enable auto-refresh",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] ${b?"text-primary":"text-text-muted"}`,children:b?"toggle_on":"toggle_off"}),(0,a.jsx)("span",{className:"text-sm text-text-primary",children:"Auto-refresh"}),b&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["(",y,"s)"]})]}),(0,a.jsx)(x.default,{variant:"secondary",size:"md",icon:"refresh",onClick:T,disabled:w,loading:w,children:"Refresh All"})]})]}),(0,a.jsx)("div",{className:"flex flex-col gap-4",children:z.map(e=>{let t=s[e.id],r=h[e.id],l=f[e.id];return(0,a.jsxs)(i.default,{padding:"none",children:[(0,a.jsx)("div",{className:"p-6 border-b border-black/10 dark:border-white/10",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:"w-10 h-10 rounded-lg flex items-center justify-center overflow-hidden",children:(0,a.jsx)(n.default,{src:`/providers/${e.provider}.png`,alt:e.provider,width:40,height:40,className:"object-contain",sizes:"40px"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-base font-semibold text-text-primary capitalize",children:e.provider}),e.name&&(0,a.jsx)("p",{className:"text-sm text-text-muted",children:e.name})]})]}),(0,a.jsx)("button",{onClick:()=>P(e.id,e.provider),disabled:r,className:"p-2 rounded-lg hover:bg-black/5 dark:hover:bg-white/5 transition-colors disabled:opacity-50",title:"Refresh quota",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[20px] text-text-muted ${r?"animate-spin":""}`,children:"refresh"})})]})}),(0,a.jsx)("div",{className:"p-6",children:r?(0,a.jsx)("div",{className:"text-center py-8 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px] animate-spin",children:"progress_activity"})}):l?(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px] text-red-500",children:"error"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted",children:l})]}):t?.message?(0,a.jsx)("div",{className:"text-center py-8",children:(0,a.jsx)("p",{className:"text-sm text-text-muted",children:t.message})}):(0,a.jsx)(c,{quotas:t?.quotas})})]},e.id)})})]})}var p=s(1474);function f({isOpen:e,onClose:t,title:s,children:l,width:n="md",className:i}){let o={sm:"w-[400px]",md:"w-[500px]",lg:"w-[600px]",xl:"w-[800px]",full:"w-full"};return((0,r.useEffect)(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),(0,r.useEffect)(()=>{let s=s=>{"Escape"===s.key&&e&&t()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,t]),e)?(0,a.jsxs)("div",{className:"fixed inset-0 z-50",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm transition-opacity cursor-pointer",onClick:t,"aria-hidden":"true"}),(0,a.jsxs)("div",{className:(0,p.cn)("absolute right-0 top-0 h-full bg-surface shadow-2xl flex flex-col","animate-in slide-in-from-right duration-200","border-l border-black/10 dark:border-white/10",o[n]||o.md,i),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-black/5 dark:border-white/5 flex-shrink-0",children:[(0,a.jsx)("div",{className:"flex items-center gap-3",children:s&&(0,a.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:s})}),(0,a.jsx)("button",{type:"button",onClick:t,className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto p-6",children:l})]})]}):null}function g({currentPage:e,pageSize:t,totalItems:s,onPageChange:r,onPageSizeChange:l,className:n}){let i=Math.ceil(s/t),o=s>0?(e-1)*t+1:0,d=Math.min(e*t,s),c=(()=>{let t=[],s=Math.max(1,e-2),a=Math.min(i,s+5-1);a-s+1<5&&(s=Math.max(1,a-5+1));for(let e=s;e<=a;e++)t.push(e);return t})();return(0,a.jsxs)("div",{className:(0,p.cn)("flex flex-col sm:flex-row items-center justify-between gap-4 py-4",n),children:[s>0&&(0,a.jsxs)("div",{className:"text-sm text-text-muted",children:["Showing ",(0,a.jsx)("span",{className:"font-medium text-text-main",children:o})," to"," ",(0,a.jsx)("span",{className:"font-medium text-text-main",children:d})," of"," ",(0,a.jsx)("span",{className:"font-medium text-text-main",children:s})," results"]}),(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[l&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"Rows:"}),(0,a.jsx)("select",{value:t,onChange:e=>l(Number(e.target.value)),className:(0,p.cn)("h-9 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20","cursor-pointer"),children:[10,20,50].map(e=>(0,a.jsx)("option",{value:e,children:e},e))})]}),i>1&&(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(x.default,{variant:"outline",size:"sm",onClick:()=>r(e-1),disabled:1===e,className:"w-9 px-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_left"})}),c[0]>1&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x.default,{variant:"ghost",size:"sm",onClick:()=>r(1),className:"w-9 px-0",children:"1"}),c[0]>2&&(0,a.jsx)("span",{className:"text-text-muted px-1",children:"..."})]}),c.map(t=>(0,a.jsx)(x.default,{variant:e===t?"primary":"ghost",size:"sm",onClick:()=>r(t),className:"w-9 px-0",children:t},t)),c[c.length-1]<i&&(0,a.jsxs)(a.Fragment,{children:[c[c.length-1]<i-1&&(0,a.jsx)("span",{className:"text-text-muted px-1",children:"..."}),(0,a.jsx)(x.default,{variant:"ghost",size:"sm",onClick:()=>r(i),className:"w-9 px-0",children:i})]}),(0,a.jsx)(x.default,{variant:"outline",size:"sm",onClick:()=>r(e+1),disabled:e===i,className:"w-9 px-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_right"})})]})]})]})}let b=null,j=null;async function v(){if(b&&j)return{providerNameCache:b,providerNodesCache:j};let e=await fetch("/api/provider-nodes"),t=(await e.json()).nodes||[];for(let e of(j={},t))j[e.id]=e.name;return{providerNameCache:b={...u.Q2,...j},providerNodesCache:j}}function N(e,t){if(!e||!t)return e;let s=t[e];if("string"==typeof s)return s;if(s?.name)return s.name;let a=(0,u.zt)(e)||u.Q2[e];return a?.name||e}function w({title:e,children:t,defaultOpen:s=!1,icon:l=null}){let[n,i]=(0,r.useState)(s);return(0,a.jsxs)("div",{className:"border border-black/5 dark:border-white/5 rounded-lg overflow-hidden",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>i(!n),className:"w-full flex items-center justify-between p-3 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.jsxs)("div",{className:"flex items-center gap-2",children:[l&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:l}),(0,a.jsx)("span",{className:"font-semibold text-sm text-text-main",children:e})]}),(0,a.jsx)("span",{className:(0,p.cn)("material-symbols-outlined text-[20px] text-text-muted transition-transform duration-200",n?"rotate-90":""),children:"chevron_right"})]}),n&&(0,a.jsx)("div",{className:"p-4 border-t border-black/5 dark:border-white/5",children:t})]})}function k(){let[e,t]=(0,r.useState)([]),[s,l]=(0,r.useState)({page:1,pageSize:20,totalItems:0,totalPages:0}),[n,o]=(0,r.useState)(!1),[d,c]=(0,r.useState)(null),[m,u]=(0,r.useState)(!1),[h,b]=(0,r.useState)([]),[j,k]=(0,r.useState)(null),[y,S]=(0,r.useState)({provider:"",startDate:"",endDate:""}),C=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/usage/providers"),t=await e.json();b(t.providers||[]);let s=await v();k(s.providerNameCache)}catch(e){console.error("Failed to fetch providers:",e)}},[]),D=(0,r.useCallback)(async()=>{o(!0);try{let e=new URLSearchParams({page:s.page.toString(),pageSize:s.pageSize.toString()});y.provider&&e.append("provider",y.provider),y.startDate&&e.append("startDate",y.startDate),y.endDate&&e.append("endDate",y.endDate);let a=await fetch(`/api/usage/request-details?${e}`),r=await a.json();t(r.details||[]),l(e=>({...e,...r.pagination}))}catch(e){console.error("Failed to fetch request details:",e)}finally{o(!1)}},[s.page,s.pageSize,y]);return(0,r.useEffect)(()=>{C()},[C]),(0,r.useEffect)(()=>{D()},[D]),(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(i.default,{padding:"md",children:(0,a.jsxs)("div",{className:"flex flex-wrap gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{htmlFor:"provider-filter",className:"text-sm font-medium text-text-main",children:"Provider"}),(0,a.jsxs)("select",{id:"provider-filter",value:y.provider,onChange:e=>S({...y,provider:e.target.value}),className:(0,p.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20","cursor-pointer min-w-[150px]"),children:[(0,a.jsx)("option",{value:"",children:"All Providers"}),h.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{htmlFor:"start-date-filter",className:"text-sm font-medium text-text-main",children:"Start Date"}),(0,a.jsx)("input",{id:"start-date-filter",type:"datetime-local",value:y.startDate,onChange:e=>S({...y,startDate:e.target.value}),className:(0,p.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20")})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{htmlFor:"end-date-filter",className:"text-sm font-medium text-text-main",children:"End Date"}),(0,a.jsx)("input",{id:"end-date-filter",type:"datetime-local",value:y.endDate,onChange:e=>S({...y,endDate:e.target.value}),className:(0,p.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20")})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-text-main opacity-0","aria-hidden":"true",children:"Clear"}),(0,a.jsx)(x.default,{variant:"ghost",onClick:()=>{S({provider:"",startDate:"",endDate:""})},disabled:!y.provider&&!y.startDate&&!y.endDate,children:"Clear Filters"})]})]})}),(0,a.jsxs)(i.default,{padding:"none",children:[(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5",children:[(0,a.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Timestamp"}),(0,a.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Model"}),(0,a.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Provider"}),(0,a.jsx)("th",{className:"text-right p-4 text-sm font-semibold text-text-main",children:"Input Tokens"}),(0,a.jsx)("th",{className:"text-right p-4 text-sm font-semibold text-text-main",children:"Output Tokens"}),(0,a.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Latency"}),(0,a.jsx)("th",{className:"text-center p-4 text-sm font-semibold text-text-main",children:"Action"})]})}),(0,a.jsx)("tbody",{children:n?(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:"7",className:"p-8 text-center text-text-muted",children:(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[20px]",children:"progress_activity"}),"Loading..."]})})}):0===e.length?(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:"7",className:"p-8 text-center text-text-muted",children:"No request details found"})}):e.map((e,t)=>(0,a.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5 last:border-b-0 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,a.jsx)("td",{className:"p-4 text-sm text-text-main",children:new Date(e.timestamp).toLocaleString()}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main font-mono",children:e.model}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main",children:(0,a.jsx)("span",{className:"font-medium",children:N(e.provider,j)})}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:e.tokens?.prompt_tokens?.toLocaleString()||0}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:e.tokens?.completion_tokens?.toLocaleString()||0}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-muted",children:(0,a.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,a.jsxs)("div",{children:["TTFT: ",(0,a.jsxs)("span",{className:"font-mono",children:[e.latency?.ttft||0,"ms"]})]}),(0,a.jsxs)("div",{children:["Total: ",(0,a.jsxs)("span",{className:"font-mono",children:[e.latency?.total||0,"ms"]})]})]})}),(0,a.jsx)("td",{className:"p-4 text-center",children:(0,a.jsx)(x.default,{variant:"outline",size:"sm",onClick:()=>{c(e),u(!0)},children:"Detail"})})]},`${e.id}-${t}`))})]})}),!n&&e.length>0&&(0,a.jsx)("div",{className:"border-t border-black/5 dark:border-white/5",children:(0,a.jsx)(g,{currentPage:s.page,pageSize:s.pageSize,totalItems:s.totalItems,onPageChange:e=>{l(t=>({...t,page:e}))},onPageSizeChange:e=>{l(t=>({...t,pageSize:e,page:1}))}})})]}),(0,a.jsx)(f,{isOpen:m,onClose:()=>u(!1),title:"Request Details",width:"lg",children:d&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"ID:"})," ",(0,a.jsx)("span",{className:"text-text-main font-mono",children:d.id})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Timestamp:"})," ",(0,a.jsx)("span",{className:"text-text-main",children:new Date(d.timestamp).toLocaleString()})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Provider:"})," ",(0,a.jsx)("span",{className:"text-text-main font-medium",children:N(d.provider,j)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Model:"})," ",(0,a.jsx)("span",{className:"text-text-main font-mono",children:d.model})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Status:"})," ",(0,a.jsx)("span",{className:(0,p.cn)("font-medium","success"===d.status?"text-green-600":"text-red-600"),children:d.status})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Latency:"})," ",(0,a.jsxs)("span",{className:"text-text-main font-mono",children:["TTFT ",d.latency?.ttft||0,"ms / Total ",d.latency?.total||0,"ms"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Input Tokens:"})," ",(0,a.jsx)("span",{className:"text-text-main font-mono",children:d.tokens?.prompt_tokens?.toLocaleString()||0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Output Tokens:"})," ",(0,a.jsx)("span",{className:"text-text-main font-mono",children:d.tokens?.completion_tokens?.toLocaleString()||0})]})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(w,{title:"1. Client Request (Input)",defaultOpen:!0,icon:"input",children:(0,a.jsx)("pre",{className:"bg-black/5 dark:bg-white/5 p-4 rounded-lg overflow-auto max-h-[300px] text-xs font-mono text-text-main border border-black/5 dark:border-white/5",children:JSON.stringify(d.request,null,2)})}),d.providerRequest&&(0,a.jsx)(w,{title:"2. Provider Request (Translated)",icon:"translate",children:(0,a.jsx)("pre",{className:"bg-black/5 dark:bg-white/5 p-4 rounded-lg overflow-auto max-h-[300px] text-xs font-mono text-text-main border border-black/5 dark:border-white/5",children:JSON.stringify(d.providerRequest,null,2)})}),d.providerResponse&&(0,a.jsx)(w,{title:"3. Provider Response (Raw)",icon:"data_object",children:(0,a.jsx)("pre",{className:"bg-black/5 dark:bg-white/5 p-4 rounded-lg overflow-auto max-h-[300px] text-xs font-mono text-text-main border border-black/5 dark:border-white/5",children:"object"==typeof d.providerResponse?JSON.stringify(d.providerResponse,null,2):d.providerResponse})}),(0,a.jsxs)(w,{title:"4. Client Response (Final)",defaultOpen:!0,icon:"output",children:[d.response?.thinking&&(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("h4",{className:"font-semibold text-text-main mb-2 flex items-center gap-2 text-xs uppercase tracking-wide opacity-70",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"psychology"}),"Thinking Process"]}),(0,a.jsx)("pre",{className:"bg-amber-50 dark:bg-amber-950/30 p-4 rounded-lg overflow-auto max-h-[200px] text-xs font-mono text-amber-900 dark:text-amber-100 border border-amber-200 dark:border-amber-800",children:d.response.thinking})]}),(0,a.jsx)("h4",{className:"font-semibold text-text-main mb-2 text-xs uppercase tracking-wide opacity-70",children:"Content"}),(0,a.jsx)("pre",{className:"bg-black/5 dark:bg-white/5 p-4 rounded-lg overflow-auto max-h-[300px] text-xs font-mono text-text-main border border-black/5 dark:border-white/5",children:d.response?.content||"[No content]"})]})]})]})})]})}function y(){let[e,t]=(0,r.useState)("overview");return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(l.Iz,{options:[{value:"overview",label:"Overview"},{value:"logs",label:"Logger"},{value:"limits",label:"Limits"},{value:"details",label:"Details"}],value:e,onChange:t}),"overview"===e&&(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)(l.Qv,{}),children:(0,a.jsx)(l.jK,{})}),"logs"===e&&(0,a.jsx)(l.gM,{}),"limits"===e&&(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)(l.Qv,{}),children:(0,a.jsx)(h,{})}),"details"===e&&(0,a.jsx)(k,{})]})}}},e=>{e.O(0,[600,3624,8729,5497,8441,3794,7358],()=>e(e.s=6788)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[204,335,552,747,748,907,931,992,1070,1088,1110,1200,1288,1451,1512,1566,1625,1666,1860,1949,2121,2296,2720,2797,3025,3038,3079,3102,3472,3549,4286,4896,5079,5107,5177,5211,5466,5745,5922,6268,6529,6580,6819,6988,7241,7429,7442,7520,7758,7851,8167,8207,8246,8453,8489,8573,8648,8814,8948,8974,8975,9027,9069,9088,9141,9321,9461],{4441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[204,335,552,747,748,907,931,992,1070,1088,1110,1200,1288,1451,1512,1566,1625,1666,1860,1949,2121,2296,2720,2797,3025,3038,3079,3102,3472,3549,4286,4896,5079,5107,5177,5211,5466,5745,5922,6268,6529,6580,6819,6988,7241,7429,7442,7520,7758,7851,8167,8207,8246,8453,8489,8573,8648,8814,8948,8974,8975,9027,9069,9088,9141,9321,9461],{4441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=4441)),_N_E=_.O()}]);