omniroute 1.4.10 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (374) hide show
  1. package/README.ar.md +1153 -0
  2. package/README.bg.md +1238 -0
  3. package/README.da.md +1238 -0
  4. package/README.de.md +1 -1
  5. package/README.es.md +1 -1
  6. package/README.fi.md +1238 -0
  7. package/README.fr.md +1 -1
  8. package/README.he.md +1238 -0
  9. package/README.hu.md +1238 -0
  10. package/README.id.md +1238 -0
  11. package/README.in.md +952 -0
  12. package/README.it.md +1 -1
  13. package/README.ja.md +1152 -0
  14. package/README.ko.md +1238 -0
  15. package/README.md +25 -20
  16. package/README.ms.md +1238 -0
  17. package/README.nl.md +1238 -0
  18. package/README.no.md +1238 -0
  19. package/README.phi.md +1238 -0
  20. package/README.pl.md +1238 -0
  21. package/README.pt-BR.md +16 -12
  22. package/README.pt.md +1238 -0
  23. package/README.ro.md +1238 -0
  24. package/README.ru.md +1 -1
  25. package/README.sk.md +1239 -0
  26. package/README.sv.md +1238 -0
  27. package/README.th.md +1229 -0
  28. package/README.uk-UA.md +1240 -0
  29. package/README.vi.md +1238 -0
  30. package/README.zh-CN.md +1 -1
  31. package/app/.next/BUILD_ID +1 -1
  32. package/app/.next/app-path-routes-manifest.json +39 -39
  33. package/app/.next/build-manifest.json +2 -2
  34. package/app/.next/prerender-manifest.json +3 -3
  35. package/app/.next/server/app/(dashboard)/dashboard/analytics/page.js +2 -2
  36. package/app/.next/server/app/(dashboard)/dashboard/analytics/page.js.nft.json +1 -1
  37. package/app/.next/server/app/(dashboard)/dashboard/analytics/page_client-reference-manifest.js +1 -1
  38. package/app/.next/server/app/(dashboard)/dashboard/api-manager/page.js +1 -1
  39. package/app/.next/server/app/(dashboard)/dashboard/api-manager/page.js.nft.json +1 -1
  40. package/app/.next/server/app/(dashboard)/dashboard/api-manager/page_client-reference-manifest.js +1 -1
  41. package/app/.next/server/app/(dashboard)/dashboard/audit-log/page.js +2 -2
  42. package/app/.next/server/app/(dashboard)/dashboard/audit-log/page.js.nft.json +1 -1
  43. package/app/.next/server/app/(dashboard)/dashboard/audit-log/page_client-reference-manifest.js +1 -1
  44. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +6 -6
  45. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  46. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  47. package/app/.next/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  48. package/app/.next/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  49. package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  50. package/app/.next/server/app/(dashboard)/dashboard/costs/page.js +2 -2
  51. package/app/.next/server/app/(dashboard)/dashboard/costs/page.js.nft.json +1 -1
  52. package/app/.next/server/app/(dashboard)/dashboard/costs/page_client-reference-manifest.js +1 -1
  53. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js +2 -2
  54. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  55. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  56. package/app/.next/server/app/(dashboard)/dashboard/health/page.js +2 -2
  57. package/app/.next/server/app/(dashboard)/dashboard/health/page.js.nft.json +1 -1
  58. package/app/.next/server/app/(dashboard)/dashboard/health/page_client-reference-manifest.js +1 -1
  59. package/app/.next/server/app/(dashboard)/dashboard/limits/page.js +2 -2
  60. package/app/.next/server/app/(dashboard)/dashboard/limits/page.js.nft.json +1 -1
  61. package/app/.next/server/app/(dashboard)/dashboard/limits/page_client-reference-manifest.js +1 -1
  62. package/app/.next/server/app/(dashboard)/dashboard/logs/page.js +1 -1
  63. package/app/.next/server/app/(dashboard)/dashboard/logs/page.js.nft.json +1 -1
  64. package/app/.next/server/app/(dashboard)/dashboard/logs/page_client-reference-manifest.js +1 -1
  65. package/app/.next/server/app/(dashboard)/dashboard/onboarding/page.js +2 -2
  66. package/app/.next/server/app/(dashboard)/dashboard/onboarding/page.js.nft.json +1 -1
  67. package/app/.next/server/app/(dashboard)/dashboard/onboarding/page_client-reference-manifest.js +1 -1
  68. package/app/.next/server/app/(dashboard)/dashboard/page.js +2 -2
  69. package/app/.next/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  70. package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  71. package/app/.next/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  72. package/app/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  73. package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  74. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
  75. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  76. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  77. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  78. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  79. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  80. package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  81. package/app/.next/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  82. package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  83. package/app/.next/server/app/(dashboard)/dashboard/settings/page.js +2 -2
  84. package/app/.next/server/app/(dashboard)/dashboard/settings/page.js.nft.json +1 -1
  85. package/app/.next/server/app/(dashboard)/dashboard/settings/page_client-reference-manifest.js +1 -1
  86. package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page.js +2 -2
  87. package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page.js.nft.json +1 -1
  88. package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  89. package/app/.next/server/app/(dashboard)/dashboard/translator/page.js +4 -4
  90. package/app/.next/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  91. package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  92. package/app/.next/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  93. package/app/.next/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  94. package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  95. package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  96. package/app/.next/server/app/_global-error.html +2 -2
  97. package/app/.next/server/app/_global-error.rsc +1 -1
  98. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  99. package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  100. package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  101. package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  102. package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  103. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  104. package/app/.next/server/app/_not-found/page.js +1 -1
  105. package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
  106. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  107. package/app/.next/server/app/api/auth/login/route.js +1 -1
  108. package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  109. package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  110. package/app/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  111. package/app/.next/server/app/api/cache/route_client-reference-manifest.js +1 -1
  112. package/app/.next/server/app/api/cache/stats/route_client-reference-manifest.js +1 -1
  113. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  114. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route_client-reference-manifest.js +1 -1
  115. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +2 -2
  116. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route_client-reference-manifest.js +1 -1
  117. package/app/.next/server/app/api/cli-tools/backups/route.js +1 -1
  118. package/app/.next/server/app/api/cli-tools/backups/route_client-reference-manifest.js +1 -1
  119. package/app/.next/server/app/api/cli-tools/claude-settings/route.js +1 -1
  120. package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
  121. package/app/.next/server/app/api/cli-tools/cline-settings/route.js +1 -1
  122. package/app/.next/server/app/api/cli-tools/cline-settings/route_client-reference-manifest.js +1 -1
  123. package/app/.next/server/app/api/cli-tools/codex-profiles/route.js +2 -2
  124. package/app/.next/server/app/api/cli-tools/codex-profiles/route_client-reference-manifest.js +1 -1
  125. package/app/.next/server/app/api/cli-tools/codex-settings/route.js +2 -2
  126. package/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
  127. package/app/.next/server/app/api/cli-tools/droid-settings/route.js +1 -1
  128. package/app/.next/server/app/api/cli-tools/droid-settings/route_client-reference-manifest.js +1 -1
  129. package/app/.next/server/app/api/cli-tools/guide-settings/[toolId]/route_client-reference-manifest.js +1 -1
  130. package/app/.next/server/app/api/cli-tools/kilo-settings/route.js +1 -1
  131. package/app/.next/server/app/api/cli-tools/kilo-settings/route_client-reference-manifest.js +1 -1
  132. package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  133. package/app/.next/server/app/api/cli-tools/openclaw-settings/route_client-reference-manifest.js +1 -1
  134. package/app/.next/server/app/api/cli-tools/runtime/[toolId]/route.js +2 -2
  135. package/app/.next/server/app/api/cli-tools/runtime/[toolId]/route_client-reference-manifest.js +1 -1
  136. package/app/.next/server/app/api/cli-tools/status/route.js +1 -1
  137. package/app/.next/server/app/api/cli-tools/status/route_client-reference-manifest.js +1 -1
  138. package/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
  139. package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
  140. package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
  141. package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
  142. package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
  143. package/app/.next/server/app/api/combos/metrics/route_client-reference-manifest.js +1 -1
  144. package/app/.next/server/app/api/combos/route.js +1 -1
  145. package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
  146. package/app/.next/server/app/api/combos/test/route_client-reference-manifest.js +1 -1
  147. package/app/.next/server/app/api/compliance/audit-log/route_client-reference-manifest.js +1 -1
  148. package/app/.next/server/app/api/db-backups/export/route_client-reference-manifest.js +1 -1
  149. package/app/.next/server/app/api/db-backups/exportAll/route_client-reference-manifest.js +1 -1
  150. package/app/.next/server/app/api/db-backups/import/route_client-reference-manifest.js +1 -1
  151. package/app/.next/server/app/api/db-backups/route_client-reference-manifest.js +1 -1
  152. package/app/.next/server/app/api/evals/[suiteId]/route_client-reference-manifest.js +1 -1
  153. package/app/.next/server/app/api/evals/route_client-reference-manifest.js +1 -1
  154. package/app/.next/server/app/api/fallback/chains/route_client-reference-manifest.js +1 -1
  155. package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  156. package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
  157. package/app/.next/server/app/api/keys/route.js +1 -1
  158. package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
  159. package/app/.next/server/app/api/logs/console/route_client-reference-manifest.js +1 -1
  160. package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
  161. package/app/.next/server/app/api/models/availability/route_client-reference-manifest.js +1 -1
  162. package/app/.next/server/app/api/models/catalog/route_client-reference-manifest.js +1 -1
  163. package/app/.next/server/app/api/models/route.js +1 -1
  164. package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
  165. package/app/.next/server/app/api/monitoring/health/route.js +1 -1
  166. package/app/.next/server/app/api/monitoring/health/route_client-reference-manifest.js +1 -1
  167. package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
  168. package/app/.next/server/app/api/oauth/cursor/auto-import/route_client-reference-manifest.js +1 -1
  169. package/app/.next/server/app/api/oauth/cursor/import/route_client-reference-manifest.js +1 -1
  170. package/app/.next/server/app/api/oauth/kiro/auto-import/route_client-reference-manifest.js +1 -1
  171. package/app/.next/server/app/api/oauth/kiro/import/route_client-reference-manifest.js +1 -1
  172. package/app/.next/server/app/api/oauth/kiro/social-authorize/route_client-reference-manifest.js +1 -1
  173. package/app/.next/server/app/api/oauth/kiro/social-exchange/route_client-reference-manifest.js +1 -1
  174. package/app/.next/server/app/api/policies/route_client-reference-manifest.js +1 -1
  175. package/app/.next/server/app/api/pricing/defaults/route_client-reference-manifest.js +1 -1
  176. package/app/.next/server/app/api/pricing/models/route_client-reference-manifest.js +1 -1
  177. package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
  178. package/app/.next/server/app/api/provider-metrics/route_client-reference-manifest.js +1 -1
  179. package/app/.next/server/app/api/provider-models/route_client-reference-manifest.js +1 -1
  180. package/app/.next/server/app/api/provider-nodes/[id]/route_client-reference-manifest.js +1 -1
  181. package/app/.next/server/app/api/provider-nodes/route_client-reference-manifest.js +1 -1
  182. package/app/.next/server/app/api/provider-nodes/validate/route_client-reference-manifest.js +1 -1
  183. package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
  184. package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
  185. package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
  186. package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
  187. package/app/.next/server/app/api/providers/route.js +1 -1
  188. package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
  189. package/app/.next/server/app/api/providers/test-batch/route_client-reference-manifest.js +1 -1
  190. package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
  191. package/app/.next/server/app/api/rate-limit/route_client-reference-manifest.js +1 -1
  192. package/app/.next/server/app/api/rate-limits/route_client-reference-manifest.js +1 -1
  193. package/app/.next/server/app/api/resilience/reset/route_client-reference-manifest.js +1 -1
  194. package/app/.next/server/app/api/resilience/route_client-reference-manifest.js +1 -1
  195. package/app/.next/server/app/api/restart/route_client-reference-manifest.js +1 -1
  196. package/app/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
  197. package/app/.next/server/app/api/settings/combo-defaults/route_client-reference-manifest.js +1 -1
  198. package/app/.next/server/app/api/settings/ip-filter/route_client-reference-manifest.js +1 -1
  199. package/app/.next/server/app/api/settings/proxy/route_client-reference-manifest.js +1 -1
  200. package/app/.next/server/app/api/settings/proxy/test/route_client-reference-manifest.js +1 -1
  201. package/app/.next/server/app/api/settings/require-login/route_client-reference-manifest.js +1 -1
  202. package/app/.next/server/app/api/settings/route.js +1 -1
  203. package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  204. package/app/.next/server/app/api/settings/system-prompt/route_client-reference-manifest.js +1 -1
  205. package/app/.next/server/app/api/settings/thinking-budget/route_client-reference-manifest.js +1 -1
  206. package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  207. package/app/.next/server/app/api/storage/health/route_client-reference-manifest.js +1 -1
  208. package/app/.next/server/app/api/sync/cloud/route_client-reference-manifest.js +1 -1
  209. package/app/.next/server/app/api/sync/initialize/route_client-reference-manifest.js +1 -1
  210. package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
  211. package/app/.next/server/app/api/telemetry/summary/route_client-reference-manifest.js +1 -1
  212. package/app/.next/server/app/api/token-health/route_client-reference-manifest.js +1 -1
  213. package/app/.next/server/app/api/translator/detect/route_client-reference-manifest.js +1 -1
  214. package/app/.next/server/app/api/translator/history/route_client-reference-manifest.js +1 -1
  215. package/app/.next/server/app/api/translator/load/route_client-reference-manifest.js +1 -1
  216. package/app/.next/server/app/api/translator/save/route_client-reference-manifest.js +1 -1
  217. package/app/.next/server/app/api/translator/send/route_client-reference-manifest.js +1 -1
  218. package/app/.next/server/app/api/translator/translate/route_client-reference-manifest.js +1 -1
  219. package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
  220. package/app/.next/server/app/api/usage/analytics/route_client-reference-manifest.js +1 -1
  221. package/app/.next/server/app/api/usage/budget/route_client-reference-manifest.js +1 -1
  222. package/app/.next/server/app/api/usage/call-logs/[id]/route_client-reference-manifest.js +1 -1
  223. package/app/.next/server/app/api/usage/call-logs/route_client-reference-manifest.js +1 -1
  224. package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
  225. package/app/.next/server/app/api/usage/logs/route_client-reference-manifest.js +1 -1
  226. package/app/.next/server/app/api/usage/proxy-logs/route_client-reference-manifest.js +1 -1
  227. package/app/.next/server/app/api/usage/request-logs/route_client-reference-manifest.js +1 -1
  228. package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
  229. package/app/.next/server/app/api/v1/audio/speech/route_client-reference-manifest.js +1 -1
  230. package/app/.next/server/app/api/v1/audio/transcriptions/route_client-reference-manifest.js +1 -1
  231. package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
  232. package/app/.next/server/app/api/v1/embeddings/route_client-reference-manifest.js +1 -1
  233. package/app/.next/server/app/api/v1/images/generations/route_client-reference-manifest.js +1 -1
  234. package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
  235. package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
  236. package/app/.next/server/app/api/v1/models/route_client-reference-manifest.js +1 -1
  237. package/app/.next/server/app/api/v1/moderations/route_client-reference-manifest.js +1 -1
  238. package/app/.next/server/app/api/v1/providers/[provider]/chat/completions/route_client-reference-manifest.js +1 -1
  239. package/app/.next/server/app/api/v1/providers/[provider]/embeddings/route_client-reference-manifest.js +1 -1
  240. package/app/.next/server/app/api/v1/providers/[provider]/images/generations/route_client-reference-manifest.js +1 -1
  241. package/app/.next/server/app/api/v1/rerank/route_client-reference-manifest.js +1 -1
  242. package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
  243. package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
  244. package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
  245. package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
  246. package/app/.next/server/app/callback/page.js +2 -2
  247. package/app/.next/server/app/callback/page.js.nft.json +1 -1
  248. package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  249. package/app/.next/server/app/docs/page.js +2 -2
  250. package/app/.next/server/app/docs/page.js.nft.json +1 -1
  251. package/app/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  252. package/app/.next/server/app/forbidden/page.js +2 -2
  253. package/app/.next/server/app/forbidden/page.js.nft.json +1 -1
  254. package/app/.next/server/app/forbidden/page_client-reference-manifest.js +1 -1
  255. package/app/.next/server/app/forgot-password/page.js +2 -2
  256. package/app/.next/server/app/forgot-password/page.js.nft.json +1 -1
  257. package/app/.next/server/app/forgot-password/page_client-reference-manifest.js +1 -1
  258. package/app/.next/server/app/landing/page.js +2 -2
  259. package/app/.next/server/app/landing/page.js.nft.json +1 -1
  260. package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  261. package/app/.next/server/app/login/page.js +2 -2
  262. package/app/.next/server/app/login/page.js.nft.json +1 -1
  263. package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
  264. package/app/.next/server/app/page.js +1 -1
  265. package/app/.next/server/app/page.js.nft.json +1 -1
  266. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  267. package/app/.next/server/app/privacy/page.js +2 -2
  268. package/app/.next/server/app/privacy/page.js.nft.json +1 -1
  269. package/app/.next/server/app/privacy/page_client-reference-manifest.js +1 -1
  270. package/app/.next/server/app/terms/page.js +2 -2
  271. package/app/.next/server/app/terms/page.js.nft.json +1 -1
  272. package/app/.next/server/app/terms/page_client-reference-manifest.js +1 -1
  273. package/app/.next/server/app-paths-manifest.json +39 -39
  274. package/app/.next/server/chunks/1248.js +1 -0
  275. package/app/.next/server/chunks/{3994.js → 1465.js} +2 -2
  276. package/app/.next/server/chunks/1526.js +1 -0
  277. package/app/.next/server/chunks/1584.js +1 -0
  278. package/app/.next/server/chunks/1623.js +1 -0
  279. package/app/.next/server/chunks/1880.js +1 -0
  280. package/app/.next/server/chunks/1960.js +1 -1
  281. package/app/.next/server/chunks/1990.js +1 -1
  282. package/app/.next/server/chunks/2214.js +1 -0
  283. package/app/.next/server/chunks/2372.js +1 -0
  284. package/app/.next/server/chunks/2594.js +1 -0
  285. package/app/.next/server/chunks/3371.js +1 -0
  286. package/app/.next/server/chunks/3498.js +5 -3
  287. package/app/.next/server/chunks/3911.js +1 -0
  288. package/app/.next/server/chunks/438.js +1 -0
  289. package/app/.next/server/chunks/496.js +1 -0
  290. package/app/.next/server/chunks/5047.js +1 -0
  291. package/app/.next/server/chunks/5094.js +1 -0
  292. package/app/.next/server/chunks/5097.js +1 -0
  293. package/app/.next/server/chunks/5393.js +2 -0
  294. package/app/.next/server/chunks/5521.js +1 -0
  295. package/app/.next/server/chunks/5945.js +1 -0
  296. package/app/.next/server/chunks/6118.js +1 -0
  297. package/app/.next/server/chunks/6930.js +1 -0
  298. package/app/.next/server/chunks/7011.js +1 -0
  299. package/app/.next/server/chunks/708.js +1 -0
  300. package/app/.next/server/chunks/7650.js +1 -0
  301. package/app/.next/server/chunks/8220.js +1 -0
  302. package/app/.next/server/chunks/8464.js +1 -0
  303. package/app/.next/server/chunks/8706.js +1 -0
  304. package/app/.next/server/chunks/8976.js +1 -0
  305. package/app/.next/server/chunks/9119.js +1 -0
  306. package/app/.next/server/chunks/944.js +1 -0
  307. package/app/.next/server/chunks/9824.js +2 -2
  308. package/app/.next/server/chunks/9837.js +1 -0
  309. package/app/.next/server/pages/500.html +2 -2
  310. package/app/.next/server/server-reference-manifest.js +1 -1
  311. package/app/.next/server/server-reference-manifest.json +1 -1
  312. package/app/.next/static/chunks/{6458-085536744d592424.js → 1149-fefe7f95f0e9842f.js} +1 -1
  313. package/app/.next/static/chunks/{5846-bac355f56b136439.js → 5846-c6bffec2bf9757fa.js} +1 -1
  314. package/app/.next/static/chunks/{782-5e138760b7f7bf48.js → 8055-5844ff783b2e8a99.js} +3 -3
  315. package/app/.next/static/chunks/{993-961f6e199b93539a.js → 993-cf9fe6c017bc7e67.js} +3 -3
  316. package/app/.next/static/chunks/app/(dashboard)/dashboard/analytics/page-52f76c7c91444ec2.js +1 -0
  317. package/app/.next/static/chunks/app/(dashboard)/dashboard/api-manager/page-1dd4d0c348a7b0a6.js +1 -0
  318. package/app/.next/static/chunks/app/(dashboard)/dashboard/audit-log/page-e5bf8955e7b9a4f5.js +1 -0
  319. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-ce332ffdb491a4d8.js +15 -0
  320. package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/{page-ede2315b6918315e.js → page-6abed29d64c46388.js} +1 -1
  321. package/app/.next/static/chunks/app/(dashboard)/dashboard/costs/page-3ed2a7685adf9b91.js +1 -0
  322. package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-1420c3ca376f1585.js +1 -0
  323. package/app/.next/static/chunks/app/(dashboard)/dashboard/health/page-9a6519bf1468f16e.js +1 -0
  324. package/app/.next/static/chunks/app/(dashboard)/dashboard/limits/page-f4a2d6d07df5ddc4.js +1 -0
  325. package/app/.next/static/chunks/app/(dashboard)/dashboard/logs/{page-6ee69634597daee0.js → page-833d24f322a20f5a.js} +1 -1
  326. package/app/.next/static/chunks/app/(dashboard)/dashboard/onboarding/page-ec914ae79f085e6f.js +1 -0
  327. package/app/.next/static/chunks/app/(dashboard)/dashboard/page-388840686801f3f5.js +1 -0
  328. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-9c8ffb212f855704.js +1 -0
  329. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/new/page-31cdb6e15134d8c2.js +1 -0
  330. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-1f022385b812b987.js +1 -0
  331. package/app/.next/static/chunks/app/(dashboard)/dashboard/settings/page-1393d4935fc087cf.js +1 -0
  332. package/app/.next/static/chunks/app/(dashboard)/dashboard/settings/pricing/{page-77158451270c1852.js → page-f10a8d4bb8236913.js} +1 -1
  333. package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-83b07523f81d6282.js +4 -0
  334. package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-9cc99ab874fc36e7.js +1 -0
  335. package/app/.next/static/chunks/app/(dashboard)/{layout-b23c2c5427e04dcf.js → layout-00d5d56af65098a9.js} +1 -1
  336. package/app/.next/static/chunks/app/callback/page-585a53f7dc6a30f1.js +1 -0
  337. package/app/.next/static/chunks/app/docs/page-2fe9dcbeb3f738c0.js +1 -0
  338. package/app/.next/static/chunks/app/forbidden/{page-4a39fedc08aaaf55.js → page-df886dfa2d5bd9fa.js} +1 -1
  339. package/app/.next/static/chunks/app/forgot-password/page-2a495f0b0c653ab4.js +1 -0
  340. package/app/.next/static/chunks/app/landing/page-9d540ab1716f8e3e.js +1 -0
  341. package/app/.next/static/chunks/app/login/page-121c612ee459e7c2.js +1 -0
  342. package/app/.next/static/chunks/app/privacy/page-2fe9dcbeb3f738c0.js +1 -0
  343. package/app/.next/static/chunks/app/terms/page-2fe9dcbeb3f738c0.js +1 -0
  344. package/app/.next/static/css/6f101b114a4a7286.css +1 -0
  345. package/app/package.json +1 -1
  346. package/package.json +1 -1
  347. package/app/.next/server/chunks/1259.js +0 -2
  348. package/app/.next/server/chunks/4509.js +0 -1
  349. package/app/.next/static/chunks/app/(dashboard)/dashboard/analytics/page-3fcbbdb2221f0b0c.js +0 -1
  350. package/app/.next/static/chunks/app/(dashboard)/dashboard/api-manager/page-d806e4f28c15636a.js +0 -1
  351. package/app/.next/static/chunks/app/(dashboard)/dashboard/audit-log/page-27bc511cf3930e1e.js +0 -1
  352. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-ad885fdf9806e9a6.js +0 -15
  353. package/app/.next/static/chunks/app/(dashboard)/dashboard/costs/page-f256689b8410bd74.js +0 -1
  354. package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-6e4f3ca7ac9778be.js +0 -1
  355. package/app/.next/static/chunks/app/(dashboard)/dashboard/health/page-8725f1a181e558a3.js +0 -1
  356. package/app/.next/static/chunks/app/(dashboard)/dashboard/limits/page-a5a48afa8c125ada.js +0 -1
  357. package/app/.next/static/chunks/app/(dashboard)/dashboard/onboarding/page-931fa0c45dca76c9.js +0 -1
  358. package/app/.next/static/chunks/app/(dashboard)/dashboard/page-04bc41f9e9de17ef.js +0 -1
  359. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-6b6d62c5872aee46.js +0 -1
  360. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/new/page-2dc2a865e90681dd.js +0 -1
  361. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-ac85ce5066cd9044.js +0 -1
  362. package/app/.next/static/chunks/app/(dashboard)/dashboard/settings/page-88cac9e6f2fbe335.js +0 -1
  363. package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-75c8b38a55e13042.js +0 -4
  364. package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-f0809c7842e4f5b4.js +0 -1
  365. package/app/.next/static/chunks/app/callback/page-e439cd5a287000d8.js +0 -1
  366. package/app/.next/static/chunks/app/docs/page-8f74097544a61b9d.js +0 -1
  367. package/app/.next/static/chunks/app/forgot-password/page-057ea91c6f140e0b.js +0 -1
  368. package/app/.next/static/chunks/app/landing/page-09741814aaca7548.js +0 -1
  369. package/app/.next/static/chunks/app/login/page-c1d7bfab91a7877c.js +0 -1
  370. package/app/.next/static/chunks/app/privacy/page-8f74097544a61b9d.js +0 -1
  371. package/app/.next/static/chunks/app/terms/page-8f74097544a61b9d.js +0 -1
  372. package/app/.next/static/css/e90887a86e63903f.css +0 -1
  373. /package/app/.next/static/{8UAle4UTGR7gIVofXmh_1 → XOdkUGO-Pm15MwsN4s6B3}/_buildManifest.js +0 -0
  374. /package/app/.next/static/{8UAle4UTGR7gIVofXmh_1 → XOdkUGO-Pm15MwsN4s6B3}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8978],{53701:(e,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>o});var l=a(95155),n=a(12115),r=a(40993),i=a(50910),c=a(67671);let d=[{name:"contains",label:"Contains",icon:"search",color:"text-sky-400",bg:"bg-sky-500/10",description:"Checks if the response contains a specific text (case-insensitive)"},{name:"exact",label:"Exact Match",icon:"check_circle",color:"text-emerald-400",bg:"bg-emerald-500/10",description:"Response must be an exact character-for-character match"},{name:"regex",label:"Regex Pattern",icon:"code",color:"text-amber-400",bg:"bg-amber-500/10",description:"Matches response against a regular expression pattern"},{name:"custom",label:"Custom Function",icon:"tune",color:"text-violet-400",bg:"bg-violet-500/10",description:"Uses a custom function for advanced evaluation logic"}];function x(){let e=(0,i.c)("usage"),[s,a]=(0,n.useState)([]),[x,o]=(0,n.useState)(null),[p,u]=(0,n.useState)(!0),[h,g]=(0,n.useState)(null),[f,b]=(0,n.useState)({current:0,total:0}),[j,v]=(0,n.useState)({}),[N,y]=(0,n.useState)(""),[k,w]=(0,n.useState)(null),[C,S]=(0,n.useState)(!1),R=(0,c.i)(),$=(0,n.useCallback)(async()=>{try{let e=await fetch("/api/evals");if(e.ok){let s=await e.json();a(Array.isArray(s)?s:s.suites||[])}}catch{}finally{u(!1)}},[]),E=(0,n.useCallback)(async()=>{try{let e=await fetch("/api/keys");if(!e.ok)return;let s=await e.json(),a=s?.keys?.[0]?.key||null;o(a)}catch{}},[]);(0,n.useEffect)(()=>{$(),E()},[$,E]);let L=async e=>{try{let s={"Content-Type":"application/json"};x&&(s.Authorization=`Bearer ${x}`);let a=await fetch("/v1/chat/completions",{method:"POST",headers:s,body:JSON.stringify({model:e.model||"gpt-4o",messages:e.input?.messages||[],max_tokens:512,stream:!1})});if(!a.ok)return`[ERROR: HTTP ${a.status}]`;let l=await a.json();return l.choices?.[0]?.message?.content||"[No content returned]"}catch(e){return`[ERROR: ${e.message}]`}},M=async e=>{let s=e.cases||[];if(0===s.length)return void R.warning("No test cases defined for this suite");g(e.id),b({current:0,total:s.length});try{let a={};for(let e=0;e<s.length;e++){b({current:e+1,total:s.length});let l=await L(s[e]);a[s[e].id]=l}let l=await fetch("/api/evals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({suiteId:e.id,outputs:a})}),n=await l.json();if(v(s=>({...s,[e.id]:n})),n.summary){let{passed:s,failed:a,total:l}=n.summary;0===a?R.success(`All ${l} cases passed ✅`,`Eval: ${e.name}`):R.warning(`${s}/${l} passed, ${a} failed`,`Eval: ${e.name}`)}w(e.id)}catch{R.error("Eval run failed")}finally{g(null),b({current:0,total:0})}},T=s.filter(e=>!N||e.name?.toLowerCase().includes(N.toLowerCase())||e.id?.toLowerCase().includes(N.toLowerCase())),_=s.reduce((e,s)=>e+(s.cases?.length||s.caseCount||0),0),O=[...new Set(s.flatMap(e=>(e.cases||[]).map(e=>e.model)).filter(Boolean))];if(p)return(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted p-8 animate-pulse",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"science"}),"Loading eval suites..."]});if(0===s.length)return(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsx)(m,{}),(0,l.jsx)(r.pp,{icon:"science",title:"No Eval Suites Found",description:"Eval suites can be defined via the API or in code. They test model outputs against expected results using strategies like contains, regex, exact match, and custom functions."})]});let P=[{key:"caseName",label:"Case"},{key:"status",label:"Status"},{key:"durationMs",label:"Latency"},{key:"details",label:"Details"}];return(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsx)(m,{}),(0,l.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[(0,l.jsxs)(r.Zp,{className:"px-4 py-3 text-center",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase font-semibold tracking-wide",children:"Suites"}),(0,l.jsx)("div",{className:"text-2xl font-bold mt-1 text-violet-400",children:s.length})]}),(0,l.jsxs)(r.Zp,{className:"px-4 py-3 text-center",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase font-semibold tracking-wide",children:"Test Cases"}),(0,l.jsx)("div",{className:"text-2xl font-bold mt-1 text-sky-400",children:_})]}),(0,l.jsxs)(r.Zp,{className:"px-4 py-3 text-center",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase font-semibold tracking-wide",children:"Models"}),(0,l.jsx)("div",{className:"text-2xl font-bold mt-1 text-emerald-400",children:O.length})]}),(0,l.jsxs)(r.Zp,{className:"px-4 py-3 text-center",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase font-semibold tracking-wide",children:"Coverage"}),(0,l.jsxs)("div",{className:"text-2xl font-bold mt-1 text-amber-400",children:[d.length," strategies"]})]})]}),(0,l.jsxs)(r.Zp,{className:"p-0 overflow-hidden",children:[(0,l.jsxs)("button",{onClick:()=>S(!C),className:"w-full flex items-center justify-between px-6 py-4 hover:bg-surface/30 transition-colors text-left",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"help"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:"How It Works"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Learn how evaluations validate your LLM responses"})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted transition-transform duration-200 ${C?"rotate-180":""}`,children:"expand_more"})]}),C&&(0,l.jsxs)("div",{className:"px-6 pb-6 border-t border-border/10",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mt-4",children:[(0,l.jsxs)("div",{className:"flex flex-col items-center text-center p-4 rounded-lg bg-violet-500/5 border border-violet-500/10",children:[(0,l.jsx)("div",{className:"w-10 h-10 rounded-full bg-violet-500/20 flex items-center justify-center mb-3",children:(0,l.jsx)("span",{className:"text-lg font-bold text-violet-400",children:"1"})}),(0,l.jsx)("h4",{className:"text-sm font-semibold text-text-main mb-1",children:e(">define</")}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Create test cases with input prompts and expected output criteria using strategies like contains, regex, or exact match."})]}),(0,l.jsxs)("div",{className:"flex flex-col items-center text-center p-4 rounded-lg bg-sky-500/5 border border-sky-500/10",children:[(0,l.jsx)("div",{className:"w-10 h-10 rounded-full bg-sky-500/20 flex items-center justify-center mb-3",children:(0,l.jsx)("span",{className:"text-lg font-bold text-sky-400",children:"2"})}),(0,l.jsx)("h4",{className:"text-sm font-semibold text-text-main mb-1",children:e(">run</")}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Execute test cases against your LLM endpoints through OmniRoute. Each case is sent as a real API request."})]}),(0,l.jsxs)("div",{className:"flex flex-col items-center text-center p-4 rounded-lg bg-emerald-500/5 border border-emerald-500/10",children:[(0,l.jsx)("div",{className:"w-10 h-10 rounded-full bg-emerald-500/20 flex items-center justify-center mb-3",children:(0,l.jsx)("span",{className:"text-lg font-bold text-emerald-400",children:"3"})}),(0,l.jsx)("h4",{className:"text-sm font-semibold text-text-main mb-1",children:e(">evaluate</")}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Responses are compared against expected criteria. See pass/fail for each case with latency metrics and detailed feedback."})]})]}),(0,l.jsxs)("div",{className:"mt-6",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold text-text-muted uppercase tracking-wide mb-3",children:"Evaluation Strategies"}),(0,l.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:d.map(e=>(0,l.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg ${e.bg} border border-transparent`,children:[(0,l.jsx)("span",{className:`material-symbols-outlined text-[18px] ${e.color}`,children:e.icon}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:`text-xs font-mono font-semibold ${e.color}`,children:e.name}),(0,l.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:e.description})]})]},e.name))})]}),O.length>0&&(0,l.jsxs)("div",{className:"mt-6",children:[(0,l.jsx)("h4",{className:"text-xs font-semibold text-text-muted uppercase tracking-wide mb-3",children:"Models Under Test"}),(0,l.jsx)("div",{className:"flex flex-wrap gap-2",children:O.map(e=>(0,l.jsx)("span",{className:"px-3 py-1.5 rounded-full text-xs font-mono font-medium bg-primary/10 text-primary border border-primary/20",children:e},e))})]})]})]}),(0,l.jsxs)(r.Zp,{className:"p-6",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,l.jsx)("div",{className:"p-2 rounded-lg bg-violet-500/10 text-violet-500",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"science"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:"text-lg font-semibold",children:e("evalSuites")}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Click a suite to view test cases, then run to evaluate your LLM endpoints"})]})]}),(0,l.jsx)(r.Qn,{searchValue:N,onSearchChange:y,placeholder:"Search suites...",filters:[],activeFilters:{},onFilterChange:()=>{},children:null}),(0,l.jsx)("div",{className:"flex flex-col gap-3 mt-4",children:T.map(e=>{let s=j[e.id],a=h===e.id,n=k===e.id,i=e.cases?.length||e.caseCount||0,c=[...new Set((e.cases||[]).map(e=>e.model).filter(Boolean))];return(0,l.jsxs)("div",{className:"border border-border/30 rounded-lg overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 cursor-pointer hover:bg-surface/30 transition-colors",onClick:()=>w(n?null:e.id),children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted",children:n?"expand_more":"chevron_right"}),(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("p",{className:"text-sm font-medium text-text-main",children:e.name||e.id}),s?.summary&&(0,l.jsxs)("span",{className:`px-2 py-0.5 rounded-full text-xs font-semibold ${100===s.summary.passRate?"bg-emerald-500/10 text-emerald-400":s.summary.passRate>=80?"bg-amber-500/10 text-amber-400":"bg-red-500/10 text-red-400"}`,children:[s.summary.passRate,"% pass"]})]}),(0,l.jsxs)("p",{className:"text-xs text-text-muted",children:[i," case",1!==i?"s":"",e.description&&(0,l.jsxs)("span",{className:"ml-1",children:["— ",e.description]})]}),c.length>0&&(0,l.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:c.map(e=>(0,l.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono text-text-muted bg-black/5 dark:bg-white/5",children:e},e))})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[a&&f.total>0&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-24 h-1.5 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden",children:(0,l.jsx)("div",{className:"h-full bg-violet-500 rounded-full transition-all duration-300",style:{width:`${f.current/f.total*100}%`}})}),(0,l.jsxs)("span",{className:"text-xs text-text-muted font-mono tabular-nums",children:[f.current,"/",f.total]})]}),(0,l.jsx)(r.$n,{size:"sm",variant:"primary",onClick:s=>{s.stopPropagation(),M(e)},loading:a,disabled:a,children:a?`Running ${f.current}/${f.total}...`:"Run Eval"})]})]}),n&&(0,l.jsx)("div",{className:"border-t border-border/20 p-4",children:s?.results?(0,l.jsxs)(l.Fragment,{children:[s.summary&&(0,l.jsxs)("div",{className:"flex items-center gap-4 mb-4 p-3 rounded-lg bg-surface/30 border border-border/20",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)("span",{className:`text-lg font-bold ${100===s.summary.passRate?"text-emerald-400":s.summary.passRate>=80?"text-amber-400":"text-red-400"}`,children:[s.summary.passRate,"%"]}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"pass rate"})]}),(0,l.jsxs)("div",{className:"text-xs text-text-muted",children:[s.summary.passed," passed \xb7 ",s.summary.failed," ","failed \xb7 ",s.summary.total," total"]}),(0,l.jsx)("div",{className:"flex-1 h-2 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden",children:(0,l.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${s.summary.passRate}%`,background:100===s.summary.passRate?"linear-gradient(90deg, #22c55e, #16a34a)":s.summary.passRate>=80?"linear-gradient(90deg, #f59e0b, #d97706)":"linear-gradient(90deg, #ef4444, #dc2626)"}})})]}),(0,l.jsx)(r.bQ,{columns:P,data:s.results.map((e,s)=>({...e,id:e.caseId||s})),renderCell:(e,s)=>{if("status"===s.key)return e.passed?(0,l.jsx)("span",{className:"text-emerald-400",children:"✅ Passed"}):(0,l.jsx)("span",{className:"text-red-400",children:"❌ Failed"});if("durationMs"===s.key)return(0,l.jsx)("span",{className:"text-text-muted text-xs font-mono",children:null!=e.durationMs?`${e.durationMs}ms`:"—"});if("details"===s.key){let s=e.details||{};return(0,l.jsx)("span",{className:"text-text-muted text-xs truncate max-w-[300px] block",children:String(s.searchTerm?`Contains: "${s.searchTerm}"`:s.pattern?`Regex: ${s.pattern}`:s.expected?`Expected: "${String(s.expected).slice(0,50)}"`:e.error||"—")})}return(0,l.jsx)("span",{className:"text-sm text-text-main",children:e[s.key]||"—"})},maxHeight:"400px",emptyMessage:"No results yet"})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted",children:"checklist"}),(0,l.jsxs)("span",{className:"text-xs text-text-muted font-medium",children:["Test Cases (",(e.cases||[]).length,")"]})]}),(0,l.jsx)(r.bQ,{columns:[{key:"name",label:"Case"},{key:"model",label:"Model"},{key:"strategy",label:"Strategy"},{key:"expected",label:"Expected"}],data:(e.cases||[]).map((e,s)=>({id:e.id||s,name:e.name,model:e.model||"—",strategy:e.expected?.strategy||"—",expected:e.expected?.value?String(e.expected.value).slice(0,80):"—"})),renderCell:(e,s)=>{if("strategy"===s.key){let s=d.find(s=>s.name===e.strategy);return(0,l.jsx)("span",{className:`text-xs font-mono font-semibold ${s?.color||"text-text-muted"}`,children:e.strategy})}return"model"===s.key?(0,l.jsx)("span",{className:"text-xs font-mono text-primary/80",children:e.model}):"expected"===s.key?(0,l.jsx)("span",{className:"text-text-muted text-xs font-mono truncate max-w-[300px] block",children:e.expected}):(0,l.jsx)("span",{className:"text-sm text-text-main",children:e[s.key]||"—"})},maxHeight:"400px",emptyMessage:"No test cases defined"}),(0,l.jsxs)("p",{className:"text-xs text-text-muted mt-3 flex items-center gap-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"info"}),'Click "Run Eval" to execute all cases against your LLM endpoint. Each test sends a real request through OmniRoute.']})]})})]},e.id)})})]})]})}function m(){return(0,l.jsx)(r.Zp,{className:"p-0 overflow-hidden",children:(0,l.jsx)("div",{className:"p-6",style:{background:"linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(59, 130, 246, 0.05) 50%, rgba(16, 185, 129, 0.05) 100%)"},children:(0,l.jsxs)("div",{className:"flex items-start gap-4",children:[(0,l.jsx)("div",{className:"p-3 rounded-xl bg-violet-500/10 text-violet-500",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[28px]",children:"science"})}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("h2",{className:"text-xl font-bold text-text-main mb-1",children:t("modelEvals")}),(0,l.jsx)("p",{className:"text-sm text-text-muted leading-relaxed max-w-2xl",children:"Test and validate your LLM endpoints by running predefined evaluation suites. Each suite contains test cases that send real prompts through OmniRoute and compare responses against expected criteria — helping you detect regressions, compare models, and ensure response quality across providers."}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-4 mt-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-emerald-400",children:"verified"}),"Quality Validation"]}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-sky-400",children:"compare"}),"Model Comparison"]}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-amber-400",children:"bug_report"}),"Regression Detection"]}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-violet-400",children:"speed"}),"Latency Benchmarks"]})]})]})]})})})}function o(){let[e,s]=(0,n.useState)("overview"),a=(0,i.c)("analytics"),c={overview:a("overviewDescription"),evals:a("evalsDescription")};return(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[28px]",children:"analytics"}),a("title")]}),(0,l.jsx)("p",{className:"text-sm text-text-muted mt-1",children:c[e]})]}),(0,l.jsx)(r.Iz,{options:[{value:"overview",label:a("overview")},{value:"evals",label:a("evals")}],value:e,onChange:s}),"overview"===e&&(0,l.jsx)(n.Suspense,{fallback:(0,l.jsx)(r.Qv,{}),children:(0,l.jsx)(r.cn,{})}),"evals"===e&&(0,l.jsx)(x,{})]})}},69589:(e,s,a)=>{Promise.resolve().then(a.bind(a,53701))}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=69589)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2888],{42712:(e,t,s)=>{"use strict";s.d(t,{default:()=>c});var l=s(95155),a=s(12115),r=s(40993),i=s(30949),n=s(50910);function c(){let e=(0,n.c)("apiManager"),t=(0,n.c)("common"),[s,c]=(0,a.useState)([]),[o,x]=(0,a.useState)([]),[m,h]=(0,a.useState)(!0),[p,u]=(0,a.useState)(!1),[g,j]=(0,a.useState)(""),[b,y]=(0,a.useState)(null),[f,N]=(0,a.useState)(null),[v,k]=(0,a.useState)(!1),[w,C]=(0,a.useState)(""),[S,_]=(0,a.useState)(null),[$,M]=(0,a.useState)(!1),[A,D]=(0,a.useState)({}),{copied:E,copy:K}=(0,i.C)();(0,a.useEffect)(()=>{O(),F()},[]);let F=async()=>{try{let e=await fetch("/v1/models");if(e.ok){let t=await e.json();x(t.data||[])}}catch(e){console.log("Error fetching models:",e)}},O=async()=>{try{let e=await fetch("/api/keys");if(e.ok){let t=await e.json();c(t.keys||[]),T(t.keys||[])}}catch(e){console.log("Error fetching keys:",e)}finally{h(!1)}},T=async e=>{if(0!==e.length)try{let t=await fetch("/api/usage/call-logs?limit=1000");if(!t.ok)return;let s=await t.json(),l={};for(let t of e){let e=(s||[]).filter(e=>e.apiKeyId===t.id||e.apiKeyName===t.name);l[t.id]={totalRequests:e.length,lastUsed:e.length>0?e.sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime())[0]?.timestamp:null}}D(l)}catch(e){console.log("Error fetching usage stats:",e)}},P=(0,a.useCallback)(()=>_(null),[]),R=async()=>{let e=g.replace(/[<>]/g,"").replace(/"/g,"").replace(/'/g,"").trim().slice(0,100),t=e&&e.trim()?e.length>100?{valid:!1,error:"Key name must be 100 characters or less"}:/^[a-zA-Z0-9_\-\s]+$/.test(e)?{valid:!0}:{valid:!1,error:"Key name can only contain letters, numbers, spaces, hyphens, and underscores"}:{valid:!1,error:"Key name is required"};if(!t.valid)return void _(t.error||"Invalid key name");M(!0),P();try{let t=await fetch("/api/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})}),s=await t.json();t.ok?(y(s.key),await O(),j(""),u(!1)):_(s.error||"Failed to create key")}catch(e){console.error("Error creating key:",e),_("Failed to create key. Please try again.")}finally{M(!1)}},Z=async t=>{if(!t||"string"!=typeof t||!/^[a-zA-Z0-9_-]+$/.test(t))return void _("Invalid key ID");if(confirm(e("deleteConfirm"))){M(!0),P();try{let e=await fetch(`/api/keys/${encodeURIComponent(t)}`,{method:"DELETE"});if(e.ok)c(e=>e.filter(e=>e.id!==t));else{let t=await e.json();_(t.error||"Failed to delete key")}}catch(e){console.error("Error deleting key:",e),_("Failed to delete key. Please try again.")}finally{M(!1)}}},z=e=>{e&&e.id&&(N(e),k(!0))},I=async e=>{if(!f||!f.id)return;if(!Array.isArray(e))return void _("Invalid models selection");if(e.length>500)return void _("Cannot select more than 500 models");let t=e.filter(e=>"string"==typeof e&&e.length>0&&e.length<200);M(!0),P();try{let e=await fetch(`/api/keys/${encodeURIComponent(f.id)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({allowedModels:t})});if(e.ok)await O(),k(!1),N(null);else{let t=await e.json();_(t.error||"Failed to update permissions")}}catch(e){console.error("Error updating permissions:",e),_("Failed to update permissions. Please try again.")}finally{M(!1)}},L=function(e,t){let[s,l]=(0,a.useState)(e);return(0,a.useEffect)(()=>{let t=setTimeout(()=>l(e),150);return()=>clearTimeout(t)},[e,150]),s}(w,0),q=(0,a.useMemo)(()=>{let e={};for(let t of o){let s=t.owned_by||"unknown";e[s]||(e[s]=[]),e[s].push(t)}return Object.entries(e).sort((e,t)=>e[0].localeCompare(t[0]))},[o]),U=(0,a.useMemo)(()=>{if(!L.trim())return q;let e=L.toLowerCase();return q.map(([t,s])=>[t,s.filter(s=>s.id.toLowerCase().includes(e)||t.toLowerCase().includes(e))]).filter(([,e])=>e.length>0)},[q,L]);return m?(0,l.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,l.jsx)(r.Qv,{}),(0,l.jsx)(r.Qv,{})]}):(0,l.jsxs)("div",{className:"flex flex-col gap-8",children:[S&&(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-red-500/10 border border-red-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-red-500",children:"error"}),(0,l.jsx)("p",{className:"text-sm text-red-700 dark:text-red-300 flex-1",children:S}),(0,l.jsx)("button",{onClick:P,className:"text-red-500 hover:text-red-700 transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined",children:"close"})})]}),s.length>0&&(0,l.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[(0,l.jsx)(r.Zp,{className:"p-4",children:(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"flex items-center justify-center size-9 rounded-lg bg-primary/10",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-lg",children:"vpn_key"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-2xl font-bold",children:s.length}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:e("totalKeys")})]})]})}),(0,l.jsx)(r.Zp,{className:"p-4",children:(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"flex items-center justify-center size-9 rounded-lg bg-amber-500/10",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-amber-500 text-lg",children:"lock"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-2xl font-bold",children:s.filter(e=>Array.isArray(e.allowedModels)&&e.allowedModels.length>0).length}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:e("restricted")})]})]})}),(0,l.jsx)(r.Zp,{className:"p-4",children:(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"flex items-center justify-center size-9 rounded-lg bg-blue-500/10",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-blue-500 text-lg",children:"bar_chart"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-2xl font-bold",children:Object.values(A).reduce((e,t)=>e+t.totalRequests,0)}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:e("totalRequests")})]})]})}),(0,l.jsx)(r.Zp,{className:"p-4",children:(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"flex items-center justify-center size-9 rounded-lg bg-emerald-500/10",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-emerald-500 text-lg",children:"model_training"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-2xl font-bold",children:o.length}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:e("modelsAvailable")})]})]})})]}),(0,l.jsx)(r.Zp,{children:(0,l.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-lg font-semibold",children:e("keyManagement")}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:e("keyManagementDesc")})]}),(0,l.jsx)(r.$n,{icon:"add",onClick:()=>u(!0),children:e("createKey")})]})}),(0,l.jsxs)(r.Zp,{children:[(0,l.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"flex items-center justify-center size-10 rounded-lg bg-amber-500/10 shrink-0",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-xl text-amber-500",children:"vpn_key"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:"font-semibold",children:e("registeredKeys")}),(0,l.jsxs)("p",{className:"text-xs text-text-muted",children:[s.length," ",1===s.length?e("keyRegistered",{count:s.length}):e("keysRegistered",{count:s.length})]})]})]})}),(0,l.jsx)("p",{className:"text-sm text-text-muted mb-4",children:e("keysSecurityNote")}),0===s.length?(0,l.jsxs)("div",{className:"text-center py-12 border border-dashed border-border rounded-lg",children:[(0,l.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"vpn_key"})}),(0,l.jsx)("p",{className:"text-text-main font-medium mb-2",children:e("noKeys")}),(0,l.jsx)("p",{className:"text-sm text-text-muted mb-4",children:e("noKeysDesc")}),(0,l.jsx)(r.$n,{icon:"add",onClick:()=>u(!0),children:e("createFirstKey")})]}):(0,l.jsxs)("div",{className:"flex flex-col border border-border rounded-lg overflow-hidden",children:[(0,l.jsxs)("div",{className:"grid grid-cols-12 gap-4 px-4 py-3 bg-surface/50 border-b border-border text-xs font-semibold text-text-muted uppercase tracking-wider",children:[(0,l.jsx)("div",{className:"col-span-2",children:e("name")}),(0,l.jsx)("div",{className:"col-span-3",children:e("key")}),(0,l.jsx)("div",{className:"col-span-2",children:e("permissions")}),(0,l.jsx)("div",{className:"col-span-2",children:e("usage")}),(0,l.jsx)("div",{className:"col-span-1",children:e("created")}),(0,l.jsx)("div",{className:"col-span-2 text-right",children:e("actions")})]}),s.map(t=>{let s=A[t.id],a=Array.isArray(t.allowedModels)&&t.allowedModels.length>0;return(0,l.jsxs)("div",{className:"grid grid-cols-12 gap-4 px-4 py-3 border-b border-black/[0.03] dark:border-white/[0.03] last:border-b-0 hover:bg-surface/30 transition-colors group",children:[(0,l.jsxs)("div",{className:"col-span-2 flex items-center gap-2",children:[(0,l.jsx)("span",{className:`material-symbols-outlined text-sm ${a?"text-amber-500":"text-emerald-500"}`,children:a?"lock":"lock_open"}),(0,l.jsx)("span",{className:"text-sm font-medium truncate",title:t.name,children:t.name})]}),(0,l.jsxs)("div",{className:"col-span-3 flex items-center gap-1.5",children:[(0,l.jsx)("code",{className:"text-sm text-text-muted font-mono truncate",children:t.key}),(0,l.jsx)("button",{onClick:()=>K(t.key,t.id),className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary opacity-0 group-hover:opacity-100 transition-all shrink-0",title:"Copy masked key",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:E===t.id?"check":"content_copy"})})]}),(0,l.jsx)("div",{className:"col-span-2 flex items-center",children:a?(0,l.jsxs)("button",{onClick:()=>z(t),className:"flex items-center gap-1.5 px-2 py-1 rounded-md bg-amber-500/10 text-amber-600 dark:text-amber-400 text-xs font-medium hover:bg-amber-500/20 transition-colors",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"lock"}),t.allowedModels.length," ",1===t.allowedModels.length?"model":"models"]}):(0,l.jsxs)("button",{onClick:()=>z(t),className:"flex items-center gap-1.5 px-2 py-1 rounded-md bg-green-500/10 text-green-600 dark:text-green-400 text-xs font-medium hover:bg-green-500/20 transition-colors",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"lock_open"}),e("allModels")]})}),(0,l.jsxs)("div",{className:"col-span-2 flex flex-col justify-center",children:[(0,l.jsxs)("span",{className:"text-sm font-medium tabular-nums",children:[s?.totalRequests??0," ",(0,l.jsx)("span",{className:"text-text-muted font-normal text-xs",children:e("reqs")})]}),s?.lastUsed?(0,l.jsxs)("span",{className:"text-[10px] text-text-muted",children:["Last: ",new Date(s.lastUsed).toLocaleDateString()]}):(0,l.jsx)("span",{className:"text-[10px] text-text-muted italic",children:e("neverUsed")})]}),(0,l.jsx)("div",{className:"col-span-1 flex items-center text-sm text-text-muted",children:new Date(t.createdAt).toLocaleDateString()}),(0,l.jsxs)("div",{className:"col-span-2 flex items-center justify-end gap-1",children:[(0,l.jsx)("button",{onClick:()=>z(t),className:"p-2 hover:bg-primary/10 rounded text-text-muted hover:text-primary opacity-0 group-hover:opacity-100 transition-all",title:"Edit permissions",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"tune"})}),(0,l.jsx)("button",{onClick:()=>Z(t.id),className:"p-2 hover:bg-red-500/10 rounded text-red-500 opacity-0 group-hover:opacity-100 transition-all",title:"Delete key",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]},t.id)})]})]}),(0,l.jsx)(r.Zp,{children:(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("div",{className:"flex items-center justify-center size-10 rounded-lg bg-blue-500/10 shrink-0",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-xl text-blue-500",children:"lightbulb"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:"font-semibold mb-2",children:e("usageTips")}),(0,l.jsxs)("ul",{className:"text-sm text-text-muted space-y-1.5",children:[(0,l.jsxs)("li",{className:"flex items-start gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-xs text-primary mt-1",children:"check"}),(0,l.jsx)("span",{children:e("tipAuth")})]}),(0,l.jsxs)("li",{className:"flex items-start gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-xs text-primary mt-1",children:"check"}),(0,l.jsx)("span",{children:e("tipSecure")})]}),(0,l.jsxs)("li",{className:"flex items-start gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-xs text-primary mt-1",children:"check"}),(0,l.jsx)("span",{children:e("tipSeparate")})]}),(0,l.jsxs)("li",{className:"flex items-start gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-xs text-primary mt-1",children:"check"}),(0,l.jsx)("span",{children:e("tipRestrict")})]})]})]})]})}),(0,l.jsx)(r.aF,{isOpen:p,title:e("createKey"),onClose:()=>{u(!1),j("")},children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"text-sm font-medium text-text-main mb-1.5 block",children:e("keyName")}),(0,l.jsx)(r.pd,{value:g,onChange:e=>j(e.target.value),placeholder:e("keyNamePlaceholder"),autoFocus:!0}),(0,l.jsx)("p",{className:"text-xs text-text-muted mt-1.5",children:e("keyNameDesc")})]}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(r.$n,{onClick:()=>{u(!1),j("")},variant:"ghost",fullWidth:!0,children:t("cancel")}),(0,l.jsx)(r.$n,{onClick:R,fullWidth:!0,disabled:!g.trim(),children:e("createKey")})]})]})}),(0,l.jsx)(r.aF,{isOpen:!!b,title:e("keyCreated"),onClose:()=>y(null),children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-4",children:(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200 font-medium mb-1",children:e("keyCreatedSuccess")}),(0,l.jsx)("p",{className:"text-sm text-green-700 dark:text-green-300",children:e("keyCreatedNote")})]})]})}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(r.pd,{value:b||"",readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,l.jsx)(r.$n,{variant:"secondary",icon:"created_key"===E?"check":"content_copy",onClick:()=>K(b,"created_key"),children:t("created_key"===E?"copied":"copy")})]}),(0,l.jsx)(r.$n,{onClick:()=>y(null),fullWidth:!0,children:"Done"})]})}),f&&(0,l.jsx)(d,{isOpen:v,onClose:()=>{k(!1),N(null)},apiKey:f,modelsByProvider:U,allModels:o,searchModel:w,onSearchChange:C,onSave:I},f.id)]})}let d=(0,a.memo)(function({isOpen:e,onClose:t,apiKey:s,modelsByProvider:i,allModels:c,searchModel:d,onSearchChange:o,onSave:x}){let m=(0,n.c)("apiManager"),h=(0,n.c)("common"),p=Array.isArray(s?.allowedModels)?s.allowedModels:[],[u,g]=(0,a.useState)(p),[j,b]=(0,a.useState)(0===p.length),[y,f]=(0,a.useState)(()=>p.length>0?new Set(i.map(([e])=>e)):new Set),N=(0,a.useCallback)(e=>{j||g(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[j]),v=(0,a.useCallback)((e,t)=>{if(j)return;let s=t.map(e=>e.id);g(e=>s.every(t=>e.includes(t))?e.filter(e=>!s.includes(e)):[...new Set([...e,...s])])},[j]),k=(0,a.useCallback)(()=>{b(!0),g([])},[]),w=(0,a.useCallback)(()=>{b(!1),f(new Set(i.map(([e])=>e)))},[i]),C=(0,a.useCallback)(e=>{f(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),S=(0,a.useCallback)(()=>{g(c.map(e=>e.id))},[c]),_=(0,a.useCallback)(()=>{g([])},[]),$=(0,a.useCallback)(()=>{x(j?[]:u)},[x,j,u]);(0,a.useCallback)(()=>{o("")},[o]);let M=u.length,A=c.length;return(0,l.jsx)(r.aF,{isOpen:!!t&&e,title:m("permissionsTitle",{name:s?.name||""}),onClose:t,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex gap-2 p-1 bg-surface rounded-lg",children:[(0,l.jsxs)("button",{onClick:k,className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-all ${j?"bg-primary text-white":"text-text-muted hover:bg-black/5 dark:hover:bg-white/5"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"lock_open"}),m("allowAll")]}),(0,l.jsxs)("button",{onClick:w,className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-all ${!j?"bg-primary text-white":"text-text-muted hover:bg-black/5 dark:hover:bg-white/5"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"lock"}),m("restrict")]})]}),(0,l.jsxs)("div",{className:`flex items-start gap-2 p-3 rounded-lg ${j?"bg-green-500/10 border border-green-500/30":"bg-amber-500/10 border border-amber-500/30"}`,children:[(0,l.jsx)("span",{className:`material-symbols-outlined text-[18px] ${j?"text-green-500":"text-amber-500"}`,children:j?"info":"warning"}),(0,l.jsx)("p",{className:`text-xs ${j?"text-green-700 dark:text-green-300":"text-amber-700 dark:text-amber-300"}`,children:j?m("allowAllDesc"):m("restrictDesc",{selectedCount:M,totalModels:A})})]}),!j&&M>0&&(0,l.jsxs)("div",{className:"flex flex-col gap-1.5 p-2 bg-primary/5 rounded-lg border border-primary/20",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)("span",{className:"text-xs font-medium text-primary",children:m("selectedCount",{count:M})}),(0,l.jsxs)("div",{className:"flex gap-1",children:[(0,l.jsx)("button",{onClick:S,className:"text-[10px] text-primary hover:bg-primary/10 px-1.5 py-0.5 rounded transition-colors",children:h("all")}),(0,l.jsx)("button",{onClick:_,className:"text-[10px] text-red-500 hover:bg-red-500/10 px-1.5 py-0.5 rounded transition-colors",children:m("clear")})]})]}),(0,l.jsx)("div",{className:"flex flex-wrap gap-1 max-h-16 overflow-y-auto content-start",children:u.map(e=>(0,l.jsxs)("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 bg-white dark:bg-surface text-text-main text-[10px] rounded border border-border",children:[(0,l.jsx)("span",{className:"font-mono truncate max-w-[120px]",title:e,children:e}),(0,l.jsx)("button",{onClick:()=>N(e),className:"text-text-muted hover:text-red-500 transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},e))})]}),!j&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)(r.pd,{value:d,onChange:e=>o(e.target.value),placeholder:m("searchModels"),icon:"search"}),d&&(0,l.jsx)("button",{onClick:()=>o(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-main",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),(0,l.jsx)("div",{className:"max-h-[280px] overflow-y-auto border border-border rounded-lg divide-y divide-border",children:0===i.length?(0,l.jsxs)("div",{className:"flex flex-col items-center justify-center py-6 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1",children:"search_off"}),(0,l.jsx)("p",{className:"text-xs",children:m("noModelsFound")})]}):i.map(([e,t])=>{let s=u.filter(e=>t.some(t=>t.id===e)).length,a=t.every(e=>u.includes(e.id)),r=s>0&&!a;return(0,l.jsxs)("div",{className:"group",children:[(0,l.jsxs)("button",{onClick:()=>C(e),className:"w-full flex items-center gap-2 px-3 py-2 hover:bg-surface/50 transition-colors text-left",children:[(0,l.jsx)("span",{className:`material-symbols-outlined text-base transition-transform duration-200 ${y.has(e)?"rotate-90":""}`,children:"chevron_right"}),(0,l.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,l.jsx)("div",{className:"relative flex items-center cursor-pointer shrink-0",onClick:s=>{s.stopPropagation(),v(e,t)},children:(0,l.jsxs)("div",{className:`w-4 h-4 rounded border-2 transition-colors flex items-center justify-center ${a?"bg-primary border-primary":r?"bg-primary/20 border-primary":"border-border hover:border-primary/50"}`,children:[a&&(0,l.jsx)("span",{className:"material-symbols-outlined text-white text-[12px]",children:"check"}),r&&!a&&(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[12px]",children:"remove"})]})}),(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main truncate",children:e}),(0,l.jsx)("span",{className:"text-[10px] text-text-muted bg-surface px-1 py-0.5 rounded shrink-0",children:t.length})]}),s>0&&(0,l.jsx)("span",{className:"text-[10px] font-medium text-primary bg-primary/10 px-1.5 py-0.5 rounded-full shrink-0",children:s})]}),y.has(e)&&(0,l.jsx)("div",{className:"px-3 pb-2 pl-9",children:(0,l.jsx)("div",{className:"flex flex-wrap gap-1",children:t.map(e=>{let t=u.includes(e.id);return(0,l.jsx)("button",{onClick:()=>N(e.id),className:`inline-flex items-center gap-1 px-2 py-1 rounded-full text-[10px] font-mono transition-all ${t?"bg-primary text-white":"bg-surface border border-border text-text-muted hover:border-primary/50 hover:text-text-main"}`,title:e.id,children:e.id},e.id)})})})]},e)})})]}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(r.$n,{onClick:$,fullWidth:!0,children:m("savePermissions")}),(0,l.jsx)(r.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:h("cancel")})]})]})})})},57018:(e,t,s)=>{Promise.resolve().then(s.bind(s,42712))}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=57018)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6782],{29698:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>s});var o=r(95155),a=r(12115),l=r(50910);function s(){let e=(0,l.c)("auditLog"),t=(0,l.c)("common"),[r,s]=(0,a.useState)([]),[c,d]=(0,a.useState)(!0),[n,i]=(0,a.useState)(null),[x,u]=(0,a.useState)(""),[m,b]=(0,a.useState)(""),[p,h]=(0,a.useState)(0),[v,g]=(0,a.useState)(!1),f=(0,a.useCallback)(async()=>{d(!0),i(null);try{let e=new URLSearchParams;x&&e.set("action",x),m&&e.set("actor",m),e.set("limit",String(26)),e.set("offset",String(p));let t=await fetch(`/api/compliance/audit-log?${e.toString()}`);if(!t.ok)throw Error(`HTTP ${t.status}`);let r=await t.json();g(r.length>25),s(r.slice(0,25))}catch(e){i(e.message||"Failed to fetch audit log")}finally{d(!1)}},[x,m,p]);(0,a.useEffect)(()=>{f()},[f]);let y=()=>{h(0),f()};return(0,o.jsxs)("div",{className:"max-w-6xl mx-auto p-6 space-y-6",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"text-2xl font-bold text-[var(--color-text-main)]",children:e("title")}),(0,o.jsx)("p",{className:"text-sm text-[var(--color-text-muted)] mt-1",children:e("description")})]}),(0,o.jsx)("button",{onClick:f,disabled:c,"aria-label":"Refresh audit log",className:"px-4 py-2 rounded-lg text-sm font-medium bg-[var(--color-surface)] border border-[var(--color-border)] text-[var(--color-text-main)] hover:bg-[var(--color-bg-alt)] transition-colors disabled:opacity-50",children:t(c?"loading":"refresh")})]}),(0,o.jsxs)("div",{className:"flex flex-wrap gap-3 p-4 rounded-xl bg-[var(--color-surface)] border border-[var(--color-border)]",role:"search","aria-label":"Filter audit log entries",children:[(0,o.jsx)("input",{type:"text",placeholder:e("filterByAction"),value:x,onChange:e=>u(e.target.value),onKeyDown:e=>"Enter"===e.key&&y(),"aria-label":"Filter by action type",className:"flex-1 min-w-[180px] px-3 py-2 rounded-lg text-sm bg-[var(--color-bg)] border border-[var(--color-border)] text-[var(--color-text-main)] placeholder:text-[var(--color-text-muted)] focus:outline-2 focus:outline-[var(--color-accent)]"}),(0,o.jsx)("input",{type:"text",placeholder:e("filterByActor"),value:m,onChange:e=>b(e.target.value),onKeyDown:e=>"Enter"===e.key&&y(),"aria-label":"Filter by actor",className:"flex-1 min-w-[180px] px-3 py-2 rounded-lg text-sm bg-[var(--color-bg)] border border-[var(--color-border)] text-[var(--color-text-main)] placeholder:text-[var(--color-text-muted)] focus:outline-2 focus:outline-[var(--color-accent)]"}),(0,o.jsx)("button",{onClick:y,className:"px-4 py-2 rounded-lg text-sm font-medium bg-[var(--color-accent)] text-white hover:bg-[var(--color-accent-hover)] transition-colors focus:outline-2 focus:outline-offset-2 focus:outline-[var(--color-accent)]",children:t("search")})]}),n&&(0,o.jsx)("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",role:"alert",children:n}),(0,o.jsx)("div",{className:"overflow-x-auto rounded-xl border border-[var(--color-border)]",children:(0,o.jsxs)("table",{className:"w-full text-sm",role:"table","aria-label":"Audit log entries",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{className:"bg-[var(--color-bg-alt)] border-b border-[var(--color-border)]",children:[(0,o.jsx)("th",{className:"text-left px-4 py-3 font-medium text-[var(--color-text-muted)]",children:e("timestamp")}),(0,o.jsx)("th",{className:"text-left px-4 py-3 font-medium text-[var(--color-text-muted)]",children:e("action")}),(0,o.jsx)("th",{className:"text-left px-4 py-3 font-medium text-[var(--color-text-muted)]",children:e("actor")}),(0,o.jsx)("th",{className:"text-left px-4 py-3 font-medium text-[var(--color-text-muted)]",children:e("target")}),(0,o.jsx)("th",{className:"text-left px-4 py-3 font-medium text-[var(--color-text-muted)]",children:t("details")}),(0,o.jsx)("th",{className:"text-left px-4 py-3 font-medium text-[var(--color-text-muted)]",children:e("ipAddress")})]})}),(0,o.jsx)("tbody",{children:0!==r.length||c?r.map(e=>{var t;return(0,o.jsxs)("tr",{className:"border-b border-[var(--color-border)] hover:bg-[var(--color-bg-alt)] transition-colors",children:[(0,o.jsx)("td",{className:"px-4 py-3 whitespace-nowrap text-[var(--color-text-muted)] font-mono text-xs",children:(e=>{try{return new Date(e).toLocaleString()}catch{return e}})(e.timestamp)}),(0,o.jsx)("td",{className:"px-4 py-3",children:(0,o.jsx)("span",{className:`inline-block px-2 py-0.5 rounded-md text-xs font-medium border ${(t=e.action).includes("delete")||t.includes("remove")?"bg-red-500/15 text-red-400 border-red-500/20":t.includes("create")||t.includes("add")?"bg-green-500/15 text-green-400 border-green-500/20":t.includes("update")||t.includes("change")?"bg-blue-500/15 text-blue-400 border-blue-500/20":t.includes("login")||t.includes("auth")?"bg-purple-500/15 text-purple-400 border-purple-500/20":"bg-gray-500/15 text-gray-400 border-gray-500/20"}`,children:e.action})}),(0,o.jsx)("td",{className:"px-4 py-3 text-[var(--color-text-main)]",children:e.actor}),(0,o.jsx)("td",{className:"px-4 py-3 text-[var(--color-text-muted)] max-w-[200px] truncate",children:e.target||"—"}),(0,o.jsx)("td",{className:"px-4 py-3 text-[var(--color-text-muted)] max-w-[300px] truncate font-mono text-xs",children:e.details?JSON.stringify(e.details):"—"}),(0,o.jsx)("td",{className:"px-4 py-3 text-[var(--color-text-muted)] font-mono text-xs whitespace-nowrap",children:e.ip_address||"—"})]},e.id)}):(0,o.jsx)("tr",{children:(0,o.jsx)("td",{colSpan:6,className:"px-4 py-8 text-center text-[var(--color-text-muted)]",children:e("noEntries")})})})]})}),(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsx)("p",{className:"text-xs text-[var(--color-text-muted)]",children:e("showing",{count:r.length,offset:p})}),(0,o.jsxs)("div",{className:"flex gap-2",children:[(0,o.jsxs)("button",{onClick:()=>h(Math.max(0,p-25)),disabled:0===p,className:"px-3 py-1.5 rounded-lg text-xs font-medium bg-[var(--color-surface)] border border-[var(--color-border)] text-[var(--color-text-main)] hover:bg-[var(--color-bg-alt)] disabled:opacity-30 transition-colors",children:["← ",e("previous")]}),(0,o.jsxs)("button",{onClick:()=>h(p+25),disabled:!v,className:"px-3 py-1.5 rounded-lg text-xs font-medium bg-[var(--color-surface)] border border-[var(--color-border)] text-[var(--color-text-main)] hover:bg-[var(--color-bg-alt)] disabled:opacity-30 transition-colors",children:[t("next")," →"]})]})]})]})}},50910:(e,t,r)=>{"use strict";r.d(t,{c:()=>l});var o=r(33418);function a(e,t){return(...e)=>{try{return t(...e)}catch{throw Error(void 0)}}}let l=a(0,o.c3);a(0,o.kc)},61265:(e,t,r)=>{Promise.resolve().then(r.bind(r,29698))}},e=>{e.O(0,[3418,8441,3794,7358],()=>e(e.s=61265)),_N_E=e.O()}]);
@@ -1,15 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2326],{33782:(e,t,s)=>{Promise.resolve().then(s.bind(s,96758))},96758:(e,t,s)=>{"use strict";s.d(t,{default:()=>w});var a=s(95155),l=s(12115),r=s(40993);let i={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 Coding Assistant CLI",configType:"custom"},kilo:{id:"kilo",name:"Kilo Code",image:"/providers/kilocode.png",color:"#FF6B6B",description:"Kilo Code AI Assistant CLI",configType:"custom"},continue:{id:"continue",name:"Continue",image:"/providers/continue.png",color:"#7C3AED",description:"Continue AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Config",desc:"Open Continue configuration file"},{step:2,title:"API Key",type:"apiKeySelector"},{step:3,title:"Select Model",type:"modelSelector"},{step:4,title:"Add Model Config",desc:"Add the following configuration to your models array:"}],codeBlock:{language:"json",code:`{
2
- "apiBase": "{{baseUrl}}",
3
- "title": "{{model}}",
4
- "model": "{{model}}",
5
- "provider": "openai",
6
- "apiKey": "{{apiKey}}"
7
- }`}},antigravity:{id:"antigravity",name:"Antigravity",image:"/providers/antigravity.png",color:"#4285F4",description:"Google Antigravity IDE with MITM",configType:"mitm",modelAliases:["claude-opus-4-6-thinking","claude-sonnet-4-6","gemini-3-flash","gpt-oss-120b-medium","gemini-3.1-pro-high","gemini-3.1-pro-low"],defaultModels:[{id:"gemini-3.1-pro-high",name:"Gemini 3.1 Pro High",alias:"gemini-3.1-pro-high"},{id:"gemini-3.1-pro-low",name:"Gemini 3.1 Pro Low",alias:"gemini-3.1-pro-low"},{id:"gemini-3-flash",name:"Gemini 3 Flash",alias:"gemini-3-flash"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",alias:"claude-sonnet-4-6"},{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking",alias:"claude-opus-4-6-thinking"},{id:"gpt-oss-120b-medium",name:"GPT OSS 120B Medium",alias:"gpt-oss-120b-medium"}]}};var n=s(81135),o=s(5772);function c({effectiveConfigStatus:e,batchStatus:t,lastConfiguredAt:s=null}){let l=e||t?.configStatus||null,r={configured:{dotClass:"bg-green-500",badgeClass:"bg-green-500/10 text-green-600 dark:text-green-400",text:"Configured"},not_configured:{dotClass:"bg-yellow-500",badgeClass:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",text:"Not configured"},not_installed:{dotClass:"bg-zinc-400 dark:bg-zinc-500",badgeClass:"bg-zinc-500/10 text-zinc-500 dark:text-zinc-400",text:"Not installed"},other:{dotClass:"bg-blue-500",badgeClass:"bg-blue-500/10 text-blue-600 dark:text-blue-400",text:"Custom"},unknown:{dotClass:"bg-zinc-400 dark:bg-zinc-500",badgeClass:"bg-zinc-500/10 text-zinc-500 dark:text-zinc-400",text:"Unknown"}},i=l?r[l]||r.unknown:null;return(0,a.jsxs)(a.Fragment,{children:[i&&(0,a.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-[11px] font-medium rounded-full ${i.badgeClass}`,children:[(0,a.jsx)("span",{className:`size-1.5 rounded-full ${i.dotClass}`}),i.text]}),s?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] text-text-muted",title:`Last saved: ${new Date(s).toLocaleString()}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"schedule"}),function(e){let t=Date.now()-new Date(e).getTime();if(t<0)return"just now";let s=Math.floor(t/1e3);if(s<60)return"just now";let a=Math.floor(s/60);if(a<60)return`${a}m ago`;let l=Math.floor(a/60);if(l<24)return`${l}h ago`;let r=Math.floor(l/24);if(r<30)return`${r}d ago`;let i=Math.floor(r/30);return i<12?`${i}mo ago`:`${Math.floor(i/12)}y ago`}(s)]}):l&&"not_installed"!==l?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"schedule"}),"Never"]}):null]})}let d=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function x({tool:e,isExpanded:t,onToggle:s,activeProviders:i,modelMappings:n,onModelMappingChange:x,baseUrl:m,hasActiveProviders:u,apiKeys:p,cloudEnabled:h,batchStatus:g,lastConfiguredAt:f}){let y,b,j,[N,v]=(0,l.useState)(null),[k,w]=(0,l.useState)(!1),[C,S]=(0,l.useState)(!1),[_,A]=(0,l.useState)(!1),[O,E]=(0,l.useState)(null),[P,I]=(0,l.useState)(!1),[$,T]=(0,l.useState)(!1),[L,R]=(0,l.useState)(null),[M,z]=(0,l.useState)(""),[U,K]=(0,l.useState)({}),[F,D]=(0,l.useState)(!1),[B,H]=(0,l.useState)(""),J=(0,l.useRef)(!1),[q,W]=(0,l.useState)([]),[G,Z]=(0,l.useState)(!1),[V,X]=(0,l.useState)(null),Y=!!(N?.installed&&N?.runnable),Q=(()=>{if(!Y)return null;let e=N.settings?.env?.ANTHROPIC_BASE_URL;if(!e)return"not_configured";let t=e.includes("localhost")||e.includes("127.0.0.1"),s=h&&d&&e.startsWith(d);return t||s?"configured":"other"})()||g?.configStatus||null;(0,l.useEffect)(()=>{p?.length>0&&!M&&z(p[0].key)},[p,M]),(0,l.useEffect)(()=>{t&&!N&&(et(),ee(),er())},[t,N]);let ee=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,l.useEffect)(()=>{if(N?.installed&&!J.current){J.current=!0;let t=N.settings?.env||{};e.defaultModels.forEach(e=>{if(e.envKey){let s=t[e.envKey]||e.defaultValue||"";s&&x(e.alias,s)}});let s=t.ANTHROPIC_AUTH_TOKEN;s&&p?.some(e=>e.key===s)&&z(s)}},[N,p,e.defaultModels,x]);let et=async()=>{w(!0);try{let e=await fetch("/api/cli-tools/claude-settings"),t=await e.json();v(t)}catch(e){v({installed:!1,error:e.message})}finally{w(!1)}},es=()=>{let e=B||m;return e.endsWith("/v1")?e:`${e}/v1`},ea=async()=>{S(!0),E(null);try{let t={ANTHROPIC_BASE_URL:es()},s=M?.trim()||(p?.length>0?p[0].key:null)||(h?null:"sk_omniroute");s&&(t.ANTHROPIC_AUTH_TOKEN=s),e.defaultModels.forEach(e=>{let s=n[e.alias];s&&e.envKey&&(t[e.envKey]=s)});let a=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:t})}),l=await a.json();a.ok?(E({type:"success",text:"Settings applied successfully!"}),v(e=>({...e,hasBackup:!0,settings:{...e?.settings,env:t}}))):E({type:"error",text:l.error||"Failed to apply settings"})}catch(e){E({type:"error",text:e.message})}finally{S(!1)}},el=async()=>{A(!0),E(null);try{let t=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),s=await t.json();t.ok?(E({type:"success",text:"Settings reset successfully!"}),e.defaultModels.forEach(e=>x(e.alias,e.defaultValue||"")),z("")):E({type:"error",text:s.error||"Failed to reset settings"})}catch(e){E({type:"error",text:e.message})}finally{A(!1)}},er=async()=>{try{let e=await fetch("/api/cli-tools/backups?tool=claude"),t=await e.json();e.ok&&W(t.backups||[])}catch(e){console.log("Error fetching backups:",e)}},ei=async e=>{X(e),E(null);try{let t=await fetch("/api/cli-tools/backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:"claude",backupId:e})}),s=await t.json();t.ok?(E({type:"success",text:"Backup restored!"}),et(),er()):E({type:"error",text:s.error||"Failed to restore"})}catch(e){E({type:"error",text:e.message})}finally{X(null)}};return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(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.currentTarget.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,a.jsx)(c,{effectiveConfigStatus:Q,batchStatus:g,lastConfiguredAt:f})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[k&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Claude CLI..."})]}),!k&&N&&!Y&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:N.installed?"Claude CLI not runnable":"Claude CLI not installed"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:N.installed?`Claude CLI was found but failed runtime healthcheck${N.reason?` (${N.reason})`:""}.`:"Please install Claude CLI to use this feature."})]}),(0,a.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>I(!P),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:P?"expand_less":"help"}),P?"Hide":"How to Install"]})]}),P&&(0,a.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,a.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,a.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,a.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @anthropic-ai/claude-code"})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:["After installation, run"," ",(0,a.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!k&&Y&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[N?.settings?.env?.ANTHROPIC_BASE_URL&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:N.settings.env.ANTHROPIC_BASE_URL})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:(y=B||m).endsWith("/v1")?y:`${y}/v1`,onChange:e=>H(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),B&&B!==m&&(0,a.jsx)("button",{onClick:()=>H(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),p.length>0?(0,a.jsx)("select",{value:M,onChange:e=>z(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:p.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:h?"No API keys - Create one in Keys page":"sk_omniroute (default)"})]}),e.defaultModels.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:e.name}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:n[e.alias]||"",onChange:t=>x(e.alias,t.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>{R(e.alias),T(!0)},disabled:!u,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${u?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),n[e.alias]&&(0,a.jsx)("button",{onClick:()=>x(e.alias,""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.alias))]}),O&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===O.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===O.type?"check_circle":"error"}),(0,a.jsx)("span",{children:O.text})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:ea,disabled:!u,loading:C,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,a.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:el,disabled:!N?.hasOmniRoute,loading:_,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,a.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>D(!0),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{Z(!G),G||er()},children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"history"}),"Backups",q.length>0&&` (${q.length})`]})]}),G&&(0,a.jsxs)("div",{className:"mt-2 p-3 bg-surface border border-border rounded-lg",children:[(0,a.jsxs)("h4",{className:"text-xs font-semibold text-text-main mb-2 flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"history"}),"Config Backups"]}),0===q.length?(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No backups yet. Backups are created automatically before each Apply or Reset."}):(0,a.jsx)("div",{className:"space-y-1.5",children:q.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 bg-black/5 dark:bg-white/5 rounded text-xs",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"description"}),(0,a.jsx)("span",{className:"flex-1 truncate font-mono",title:e.id,children:e.id}),(0,a.jsx)("span",{className:"text-text-muted whitespace-nowrap",children:new Date(e.createdAt).toLocaleString()}),(0,a.jsx)("button",{onClick:()=>ei(e.id),disabled:V===e.id,className:"px-2 py-0.5 bg-primary/10 text-primary rounded text-[10px] font-medium hover:bg-primary/20 transition-colors disabled:opacity-50",children:V===e.id?"...":"Restore"})]},e.id))})]})]})]}),(0,a.jsx)(r.rq,{isOpen:$,onClose:()=>T(!1),onSelect:e=>{L&&x(L,e.value)},selectedModel:L?n[L]:null,activeProviders:i,modelAliases:U,title:`Select model for ${L}`}),(0,a.jsx)(r.uR,{isOpen:F,onClose:()=>D(!1),title:"Claude CLI - Manual Configuration",configs:(b=M&&M.trim()?M:h?"<API_KEY_FROM_DASHBOARD>":"sk_omniroute",j={ANTHROPIC_BASE_URL:es(),ANTHROPIC_AUTH_TOKEN:b},e.defaultModels.forEach(e=>{let t=n[e.alias];t&&e.envKey&&(j[e.envKey]=t)}),[{filename:"~/.claude/settings.json",content:JSON.stringify({env:j},null,2)}])})]})}function m({tool:e,isExpanded:t,onToggle:s,baseUrl:i,apiKeys:n,activeProviders:d,cloudEnabled:x,batchStatus:m,lastConfiguredAt:u}){let p,h,g,[f,y]=(0,l.useState)(null),[b,j]=(0,l.useState)(!1),[N,v]=(0,l.useState)(!1),[k,w]=(0,l.useState)(!1),[C,S]=(0,l.useState)(null),[_,A]=(0,l.useState)(!1),[O,E]=(0,l.useState)(""),[P,I]=(0,l.useState)(""),[$,T]=(0,l.useState)(!1),[L,R]=(0,l.useState)({}),[M,z]=(0,l.useState)(!1),[U,K]=(0,l.useState)(""),[F,D]=(0,l.useState)([]),[B,H]=(0,l.useState)(!1),[J,q]=(0,l.useState)(""),[W,G]=(0,l.useState)(!1),[Z,V]=(0,l.useState)(null),[X,Y]=(0,l.useState)([]),[Q,ee]=(0,l.useState)(!1),[et,es]=(0,l.useState)(null),ea=!!(f?.installed&&f?.runnable);(0,l.useEffect)(()=>{n?.length>0&&!O&&E(n[0].key)},[n,O]),(0,l.useEffect)(()=>{t&&!f&&(en(),el(),ed(),ep())},[t,f]);let el=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,l.useEffect)(()=>{if(f?.config){let e=f.config.match(/^model\s*=\s*"([^"]+)"/m);e&&I(e[1])}},[f]);let er=(ea?f.config?f.config.includes(i)||f.config.includes("localhost")||f.config.includes("127.0.0.1")?"configured":"other":"not_configured":null)||m?.configStatus||null,ei=()=>{let e=U||`${i}/v1`;return e.endsWith("/v1")?e:`${e}/v1`},en=async()=>{j(!0);try{let e=await fetch("/api/cli-tools/codex-settings"),t=await e.json();y(t)}catch(e){y({installed:!1,error:e.message})}finally{j(!1)}},eo=async()=>{v(!0),S(null);try{let e=O&&O.trim()||x?O:"sk_omniroute",t=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:ei(),apiKey:e,model:P})}),s=await t.json();t.ok?(S({type:"success",text:"Settings applied successfully!"}),en()):S({type:"error",text:s.error||"Failed to apply settings"})}catch(e){S({type:"error",text:e.message})}finally{v(!1)}},ec=async()=>{w(!0),S(null);try{let e=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),t=await e.json();e.ok?(S({type:"success",text:"Settings reset successfully!"}),I(""),en()):S({type:"error",text:t.error||"Failed to reset settings"})}catch(e){S({type:"error",text:e.message})}finally{w(!1)}},ed=async()=>{try{let e=await fetch("/api/cli-tools/codex-profiles"),t=await e.json();e.ok&&D(t.profiles||[])}catch(e){console.log("Error fetching profiles:",e)}},ex=async()=>{if(J.trim()){G(!0),S(null);try{let e=await fetch("/api/cli-tools/codex-profiles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:J.trim()})}),t=await e.json();e.ok?(S({type:"success",text:`Profile "${J}" saved!`}),q(""),ed()):S({type:"error",text:t.error||"Failed to save profile"})}catch(e){S({type:"error",text:e.message})}finally{G(!1)}}},em=async e=>{V(e),S(null);try{let t=await fetch("/api/cli-tools/codex-profiles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({profileId:e})}),s=await t.json();t.ok?(S({type:"success",text:s.message||"Profile activated!"}),en(),ep()):S({type:"error",text:s.error||"Failed to activate profile"})}catch(e){S({type:"error",text:e.message})}finally{V(null)}},eu=async e=>{try{(await fetch("/api/cli-tools/codex-profiles",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({profileId:e})})).ok&&ed()}catch(e){console.log("Error deleting profile:",e)}},ep=async()=>{try{let e=await fetch("/api/cli-tools/backups?tool=codex"),t=await e.json();e.ok&&Y(t.backups||[])}catch(e){console.log("Error fetching backups:",e)}},eh=async e=>{es(e),S(null);try{let t=await fetch("/api/cli-tools/backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:"codex",backupId:e})}),s=await t.json();t.ok?(S({type:"success",text:"Backup restored!"}),en(),ep()):S({type:"error",text:s.error||"Failed to restore"})}catch(e){S({type:"error",text:e.message})}finally{es(null)}};return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(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.currentTarget.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,a.jsx)(c,{effectiveConfigStatus:er,batchStatus:m,lastConfiguredAt:u})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[b&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Codex CLI..."})]}),!b&&f&&!ea&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:f.installed?"Codex CLI not runnable":"Codex CLI not installed"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:f.installed?`Codex CLI was found but failed runtime healthcheck${f.reason?` (${f.reason})`:""}.`:"Please install Codex CLI to use auto-apply feature."})]}),(0,a.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>A(!_),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:_?"expand_less":"help"}),_?"Hide":"How to Install"]})]}),_&&(0,a.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,a.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,a.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,a.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @openai/codex"})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:["After installation, run"," ",(0,a.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"codex"})," to verify."]}),(0,a.jsx)("div",{className:"pt-2 border-t border-border",children:(0,a.jsxs)("p",{className:"text-text-muted text-xs",children:["Codex uses"," ",(0,a.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"~/.codex/auth.json"})," ","with"," ",(0,a.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"OPENAI_API_KEY"}),'. Click "Apply" to auto-configure.']})})]})]})]}),!b&&ea&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[f?.config&&((h=(p=f.config.match(/base_url\s*=\s*"([^"]+)"/))?p[1]:null)?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:h})]}):null),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:U||`${i}/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"}),U&&U!==`${i}/v1`&&(0,a.jsx)("button",{onClick:()=>K(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),n.length>0?(0,a.jsx)("select",{value:O,onChange:e=>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:n.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_omniroute (default)"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:P,onChange:e=>I(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>T(!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"}),P&&(0,a.jsx)("button",{onClick:()=>I(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),C&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===C.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===C.type?"check_circle":"error"}),(0,a.jsx)("span",{children:C.text})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:eo,disabled:!O||!P,loading:N,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,a.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:ec,disabled:!f.hasOmniRoute,loading:k,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,a.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>z(!0),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{H(!B),B||ed()},children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"manage_accounts"}),"Profiles"]}),(0,a.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{ee(!Q),Q||ep()},children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"history"}),"Backups",X.length>0&&` (${X.length})`]})]}),B&&(0,a.jsxs)("div",{className:"mt-2 p-3 bg-surface border border-border rounded-lg",children:[(0,a.jsxs)("h4",{className:"text-xs font-semibold text-text-main mb-2 flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"manage_accounts"}),"Saved Profiles"]}),0===F.length?(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No profiles saved yet. Save current config as a profile below."}):(0,a.jsx)("div",{className:"space-y-1.5 mb-3",children:F.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 bg-black/5 dark:bg-white/5 rounded text-xs",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"person"}),(0,a.jsx)("span",{className:"font-medium flex-1 truncate",children:e.name}),(0,a.jsx)("span",{className:"text-text-muted truncate max-w-[140px]",title:e.authLabel,children:e.authLabel}),(0,a.jsx)("button",{onClick:()=>em(e.id),disabled:Z===e.id,className:"px-2 py-0.5 bg-primary/10 text-primary rounded text-[10px] font-medium hover:bg-primary/20 transition-colors disabled:opacity-50",children:Z===e.id?"...":"Activate"}),(0,a.jsx)("button",{onClick:()=>eu(e.id),className:"p-0.5 text-text-muted hover:text-red-500 transition-colors",title:"Delete profile",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"delete"})})]},e.id))}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"text",value:J,onChange:e=>q(e.target.value),placeholder:"Profile name (e.g. Personal Account)",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",onKeyDown:e=>"Enter"===e.key&&ex()}),(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:ex,disabled:!J.trim(),loading:W,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Save Current"]})]})]}),Q&&(0,a.jsxs)("div",{className:"mt-2 p-3 bg-surface border border-border rounded-lg",children:[(0,a.jsxs)("h4",{className:"text-xs font-semibold text-text-main mb-2 flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"history"}),"Config Backups"]}),0===X.length?(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No backups yet. Backups are created automatically before each Apply or Reset."}):(0,a.jsx)("div",{className:"space-y-1.5",children:X.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 bg-black/5 dark:bg-white/5 rounded text-xs",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"description"}),(0,a.jsx)("span",{className:"flex-1 truncate font-mono",title:e.id,children:e.id}),(0,a.jsx)("span",{className:"text-text-muted whitespace-nowrap",children:new Date(e.createdAt).toLocaleString()}),(0,a.jsx)("button",{onClick:()=>eh(e.id),disabled:et===e.id,className:"px-2 py-0.5 bg-primary/10 text-primary rounded text-[10px] font-medium hover:bg-primary/20 transition-colors disabled:opacity-50",children:et===e.id?"...":"Restore"})]},e.id))})]})]})]}),(0,a.jsx)(r.rq,{isOpen:$,onClose:()=>T(!1),onSelect:e=>{I(e.value),T(!1)},selectedModel:P,activeProviders:d,modelAliases:L,title:"Select Model for Codex"}),(0,a.jsx)(r.uR,{isOpen:M,onClose:()=>z(!1),title:"Codex CLI - Manual Configuration",configs:(g=O&&O.trim()?O:x?"<API_KEY_FROM_DASHBOARD>":"sk_omniroute",[{filename:"~/.codex/config.toml",content:`# OmniRoute Configuration for Codex CLI
8
- model = "${P}"
9
- model_provider = "omniroute"
10
-
11
- [model_providers.omniroute]
12
- name = "OmniRoute"
13
- base_url = "${ei()}"
14
- wire_api = "responses"
15
- `},{filename:"~/.codex/auth.json",content:JSON.stringify({OPENAI_API_KEY:g},null,2)}])})]})}let u=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function p({tool:e,isExpanded:t,onToggle:s,baseUrl:i,hasActiveProviders:n,apiKeys:d,activeProviders:x,cloudEnabled:m,batchStatus:p,lastConfiguredAt:h}){let g,f,y,b,[j,N]=(0,l.useState)(null),[v,k]=(0,l.useState)(!1),[w,C]=(0,l.useState)(!1),[S,_]=(0,l.useState)(!1),[A,O]=(0,l.useState)(null),[E,P]=(0,l.useState)(""),[I,$]=(0,l.useState)(""),[T,L]=(0,l.useState)(!1),[R,M]=(0,l.useState)({}),[z,U]=(0,l.useState)(!1),[K,F]=(0,l.useState)(""),D=(0,l.useRef)(!1),[B,H]=(0,l.useState)([]),[J,q]=(0,l.useState)(!1),[W,G]=(0,l.useState)(null),Z=!!(j?.installed&&j?.runnable),V=(()=>{if(!Z)return null;let e=j.settings?.customModels?.find(e=>"custom:OmniRoute-0"===e.id);if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1"),s=m&&u&&e.baseUrl?.startsWith(u);return t||s?"configured":"other"})()||p?.configStatus||null;(0,l.useEffect)(()=>{d?.length>0&&!E&&P(d[0].key)},[d,E]),(0,l.useEffect)(()=>{t&&!j&&(Y(),X(),es())},[t,j]);let X=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,l.useEffect)(()=>{if(j?.installed&&!D.current){D.current=!0;let e=j.settings?.customModels?.find(e=>"custom:OmniRoute-0"===e.id);e&&(e.model&&$(e.model),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&P(e.apiKey))}},[j,d]);let Y=async()=>{k(!0);try{let e=await fetch("/api/cli-tools/droid-settings"),t=await e.json();N(t)}catch(e){N({installed:!1,error:e.message})}finally{k(!1)}},Q=()=>{let e=K||i;return e.endsWith("/v1")?e:`${e}/v1`},ee=async()=>{C(!0),O(null);try{let e=E?.trim()||(d?.length>0?d[0].key:null)||(m?null:"sk_omniroute"),t=await fetch("/api/cli-tools/droid-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:Q(),apiKey:e,model:I})}),s=await t.json();t.ok?(O({type:"success",text:"Settings applied successfully!"}),Y()):O({type:"error",text:s.error||"Failed to apply settings"})}catch(e){O({type:"error",text:e.message})}finally{C(!1)}},et=async()=>{_(!0),O(null);try{let e=await fetch("/api/cli-tools/droid-settings",{method:"DELETE"}),t=await e.json();e.ok?(O({type:"success",text:"Settings reset successfully!"}),$(""),P(""),Y()):O({type:"error",text:t.error||"Failed to reset settings"})}catch(e){O({type:"error",text:e.message})}finally{_(!1)}},es=async()=>{try{let e=await fetch("/api/cli-tools/backups?tool=droid"),t=await e.json();e.ok&&H(t.backups||[])}catch(e){console.log("Error fetching backups:",e)}},ea=async e=>{G(e),O(null);try{let t=await fetch("/api/cli-tools/backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:"droid",backupId:e})}),s=await t.json();t.ok?(O({type:"success",text:"Backup restored!"}),Y(),es()):O({type:"error",text:s.error||"Failed to restore"})}catch(e){O({type:"error",text:e.message})}finally{G(null)}};return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(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.currentTarget.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,a.jsx)(c,{effectiveConfigStatus:V,batchStatus:p,lastConfiguredAt:h})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[v&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Factory Droid CLI..."})]}),!v&&j&&!Z&&(0,a.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:j.installed?"Factory Droid CLI not runnable":"Factory Droid CLI not installed"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:j.installed?`Factory Droid CLI was found but failed runtime healthcheck${j.reason?` (${j.reason})`:""}.`:"Please install Factory Droid CLI to use this feature."})]})]}),!v&&Z&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[j?.settings?.customModels?.find(e=>"custom:OmniRoute-0"===e.id)?.baseUrl&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:j.settings.customModels.find(e=>"custom:OmniRoute-0"===e.id).baseUrl})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:(g=K||i).endsWith("/v1")?g:`${g}/v1`,onChange:e=>F(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),K&&K!==i&&(0,a.jsx)("button",{onClick:()=>F(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,a.jsx)("select",{value:E,onChange:e=>P(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:m?"No API keys - Create one in Keys page":"sk_omniroute (default)"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:I,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,a.jsx)("button",{onClick:()=>L(!0),disabled:!n,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${n?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),I&&(0,a.jsx)("button",{onClick:()=>$(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),A&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===A.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===A.type?"check_circle":"error"}),(0,a.jsx)("span",{children:A.text})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:ee,disabled:!I,loading:w,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,a.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:et,disabled:!j?.hasOmniRoute,loading:S,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,a.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>U(!0),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{q(!J),J||es()},children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"history"}),"Backups",B.length>0&&` (${B.length})`]})]}),J&&(0,a.jsxs)("div",{className:"mt-2 p-3 bg-surface border border-border rounded-lg",children:[(0,a.jsxs)("h4",{className:"text-xs font-semibold text-text-main mb-2 flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"history"}),"Config Backups"]}),0===B.length?(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No backups yet. Backups are created automatically before each Apply or Reset."}):(0,a.jsx)("div",{className:"space-y-1.5",children:B.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 bg-black/5 dark:bg-white/5 rounded text-xs",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"description"}),(0,a.jsx)("span",{className:"flex-1 truncate font-mono",title:e.id,children:e.id}),(0,a.jsx)("span",{className:"text-text-muted whitespace-nowrap",children:new Date(e.createdAt).toLocaleString()}),(0,a.jsx)("button",{onClick:()=>ea(e.id),disabled:W===e.id,className:"px-2 py-0.5 bg-primary/10 text-primary rounded text-[10px] font-medium hover:bg-primary/20 transition-colors disabled:opacity-50",children:W===e.id?"...":"Restore"})]},e.id))})]})]})]}),(0,a.jsx)(r.rq,{isOpen:T,onClose:()=>L(!1),onSelect:e=>{$(e.value),L(!1)},selectedModel:I,activeProviders:x,modelAliases:R,title:"Select Model for Factory Droid"}),(0,a.jsx)(r.uR,{isOpen:z,onClose:()=>U(!1),title:"Factory Droid - Manual Configuration",configs:(f=E&&E.trim()?E:m?"<API_KEY_FROM_DASHBOARD>":"sk_omniroute",y={customModels:[{model:I||"provider/model-id",id:"custom:OmniRoute-0",index:0,baseUrl:Q(),apiKey:f,displayName:I||"provider/model-id",maxOutputTokens:131072,noImageSupport:!1,provider:"openai"}]},b="u">typeof navigator&&navigator.platform,[{filename:b?.toLowerCase().includes("win")?"%USERPROFILE%\\.factory\\settings.json":"~/.factory/settings.json",content:JSON.stringify(y,null,2)}])})]})}let h=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function g({tool:e,isExpanded:t,onToggle:s,baseUrl:i,hasActiveProviders:n,apiKeys:d,activeProviders:x,cloudEnabled:m,batchStatus:u,lastConfiguredAt:p}){let g,f,[y,b]=(0,l.useState)(null),[j,N]=(0,l.useState)(!1),[v,k]=(0,l.useState)(!1),[w,C]=(0,l.useState)(!1),[S,_]=(0,l.useState)(null),[A,O]=(0,l.useState)(""),[E,P]=(0,l.useState)(""),[I,$]=(0,l.useState)(!1),[T,L]=(0,l.useState)({}),[R,M]=(0,l.useState)(!1),[z,U]=(0,l.useState)(""),K=(0,l.useRef)(!1),[F,D]=(0,l.useState)([]),[B,H]=(0,l.useState)(!1),[J,q]=(0,l.useState)(null),W=!!(y?.installed&&y?.runnable),G=(()=>{if(!W)return null;let e=y.settings?.models?.providers?.omniroute;if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1"),s=m&&h&&e.baseUrl?.startsWith(h);return t||s?"configured":"other"})()||u?.configStatus||null;(0,l.useEffect)(()=>{d?.length>0&&!A&&O(d[0].key)},[d,A]),(0,l.useEffect)(()=>{t&&!y&&(V(),Z(),ee())},[t,y]);let Z=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&L(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,l.useEffect)(()=>{if(y?.installed&&!K.current){K.current=!0;let e=y.settings?.models?.providers?.omniroute;if(e){let t=y.settings?.agents?.defaults?.model?.primary;t&&P(t.replace("omniroute/","")),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&O(e.apiKey)}}},[y,d]);let V=async()=>{N(!0);try{let e=await fetch("/api/cli-tools/openclaw-settings"),t=await e.json();b(t)}catch(e){b({installed:!1,error:e.message})}finally{N(!1)}},X=()=>{let e=z||i;return e.endsWith("/v1")?e:`${e}/v1`},Y=async()=>{k(!0),_(null);try{let e=A?.trim()||(d?.length>0?d[0].key:null)||(m?null:"sk_omniroute"),t=await fetch("/api/cli-tools/openclaw-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:X(),apiKey:e,model:E})}),s=await t.json();t.ok?(_({type:"success",text:"Settings applied successfully!"}),V()):_({type:"error",text:s.error||"Failed to apply settings"})}catch(e){_({type:"error",text:e.message})}finally{k(!1)}},Q=async()=>{C(!0),_(null);try{let e=await fetch("/api/cli-tools/openclaw-settings",{method:"DELETE"}),t=await e.json();e.ok?(_({type:"success",text:"Settings reset successfully!"}),P(""),O(""),V()):_({type:"error",text:t.error||"Failed to reset settings"})}catch(e){_({type:"error",text:e.message})}finally{C(!1)}},ee=async()=>{try{let e=await fetch("/api/cli-tools/backups?tool=openclaw"),t=await e.json();e.ok&&D(t.backups||[])}catch(e){console.log("Error fetching backups:",e)}},et=async e=>{q(e),_(null);try{let t=await fetch("/api/cli-tools/backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:"openclaw",backupId:e})}),s=await t.json();t.ok?(_({type:"success",text:"Backup restored!"}),V(),ee()):_({type:"error",text:s.error||"Failed to restore"})}catch(e){_({type:"error",text:e.message})}finally{q(null)}};return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(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.currentTarget.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,a.jsx)(c,{effectiveConfigStatus:G,batchStatus:u,lastConfiguredAt:p})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[j&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Open Claw CLI..."})]}),!j&&y&&!W&&(0,a.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:y.installed?"Open Claw CLI not runnable":"Open Claw CLI not installed"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:y.installed?`Open Claw CLI was found but failed runtime healthcheck${y.reason?` (${y.reason})`:""}.`:"Please install Open Claw CLI to use this feature."})]})]}),!j&&W&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[y?.settings?.models?.providers?.omniroute?.baseUrl&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:y.settings.models.providers.omniroute.baseUrl})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:(g=z||i).endsWith("/v1")?g:`${g}/v1`,onChange:e=>U(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"}),z&&z!==i&&(0,a.jsx)("button",{onClick:()=>U(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,a.jsx)("select",{value:A,onChange:e=>O(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:m?"No API keys - Create one in Keys page":"sk_omniroute (default)"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:E,onChange:e=>P(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>$(!0),disabled:!n,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${n?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),E&&(0,a.jsx)("button",{onClick:()=>P(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),S&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===S.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===S.type?"check_circle":"error"}),(0,a.jsx)("span",{children:S.text})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:Y,disabled:!E,loading:v,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,a.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:Q,disabled:!y?.hasOmniRoute,loading:w,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,a.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>M(!0),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{H(!B),B||ee()},children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"history"}),"Backups",F.length>0&&` (${F.length})`]})]}),B&&(0,a.jsxs)("div",{className:"mt-2 p-3 bg-surface border border-border rounded-lg",children:[(0,a.jsxs)("h4",{className:"text-xs font-semibold text-text-main mb-2 flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"history"}),"Config Backups"]}),0===F.length?(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No backups yet. Backups are created automatically before each Apply or Reset."}):(0,a.jsx)("div",{className:"space-y-1.5",children:F.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 bg-black/5 dark:bg-white/5 rounded text-xs",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"description"}),(0,a.jsx)("span",{className:"flex-1 truncate font-mono",title:e.id,children:e.id}),(0,a.jsx)("span",{className:"text-text-muted whitespace-nowrap",children:new Date(e.createdAt).toLocaleString()}),(0,a.jsx)("button",{onClick:()=>et(e.id),disabled:J===e.id,className:"px-2 py-0.5 bg-primary/10 text-primary rounded text-[10px] font-medium hover:bg-primary/20 transition-colors disabled:opacity-50",children:J===e.id?"...":"Restore"})]},e.id))})]})]})]}),(0,a.jsx)(r.rq,{isOpen:I,onClose:()=>$(!1),onSelect:e=>{P(e.value),$(!1)},selectedModel:E,activeProviders:x,modelAliases:T,title:"Select Model for Open Claw"}),(0,a.jsx)(r.uR,{isOpen:R,onClose:()=>M(!1),title:"Open Claw - Manual Configuration",configs:(f=A&&A.trim()?A:m?"<API_KEY_FROM_DASHBOARD>":"sk_omniroute",[{filename:"~/.openclaw/openclaw.json",content:JSON.stringify({agents:{defaults:{model:{primary:`omniroute/${E||"provider/model-id"}`}}},models:{providers:{omniroute:{baseUrl:X(),apiKey:f,api:"openai-completions",models:[{id:E||"provider/model-id",name:(E||"provider/model-id").split("/").pop()}]}}}},null,2)}])})]})}let f=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function y({tool:e,isExpanded:t,onToggle:s,baseUrl:i,hasActiveProviders:n,apiKeys:d,activeProviders:x,cloudEnabled:m,batchStatus:u,lastConfiguredAt:p}){let[h,g]=(0,l.useState)(null),[y,b]=(0,l.useState)(!1),[j,N]=(0,l.useState)(!1),[v,k]=(0,l.useState)(!1),[w,C]=(0,l.useState)(null),[S,_]=(0,l.useState)(""),[A,O]=(0,l.useState)(""),[E,P]=(0,l.useState)(!1),[I,$]=(0,l.useState)({}),[T,L]=(0,l.useState)(!1),[R,M]=(0,l.useState)(""),z=(0,l.useRef)(!1),[U,K]=(0,l.useState)([]),[F,D]=(0,l.useState)(!1),[B,H]=(0,l.useState)(null),J=!!(h?.installed&&h?.runnable),q=(()=>{if(!J)return null;if(!h.hasOmniRoute)return"not_configured";let e=h.settings?.openAiBaseUrl||"",t=e.includes("localhost")||e.includes("127.0.0.1"),s=m&&f&&e.startsWith(f);return t||s?"configured":"other"})(),W=q||u?.configStatus||null;(0,l.useEffect)(()=>{d?.length>0&&!S&&_(d[0].key)},[d,S]),(0,l.useEffect)(()=>{t&&!h&&(X(),G(),Z())},[t,h]),(0,l.useEffect)(()=>{if(h?.settings&&!z.current){let e=h.settings.openAiModelId;e&&(O(e),z.current=!0)}},[h]);let G=async()=>{try{let e=await fetch("/api/models/alias");if(e.ok){let t=await e.json();$(t.aliases||{})}}catch{}},Z=async()=>{try{let e=await fetch("/api/cli-tools/backups?tool=cline");if(e.ok){let t=await e.json();K(t.backups||[])}}catch{}},V=async e=>{H(e);try{let t=await fetch("/api/cli-tools/backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:"cline",backupId:e})});if(t.ok)C({type:"success",text:"Backup restored! Reloading status..."}),await X(),await Z();else{let e=await t.json();C({type:"error",text:e.error||"Failed to restore backup"})}}catch(e){C({type:"error",text:e.message})}finally{H(null)}},X=async()=>{b(!0);try{let e=await fetch("/api/cli-tools/cline-settings"),t=await e.json();g(t)}catch(e){g({error:e.message})}finally{b(!1)}},Y=async()=>{N(!0),C(null);try{let e=R||i||"http://localhost:20128",t=e.endsWith("/v1")?e:`${e}/v1`,s=await fetch("/api/cli-tools/cline-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:t,apiKey:S||"sk_omniroute",model:A})}),a=await s.json();s.ok?(C({type:"success",text:a.message||"Applied!"}),await X(),await Z()):C({type:"error",text:a.error||"Failed"})}catch(e){C({type:"error",text:e.message})}finally{N(!1)}},Q=async()=>{k(!0),C(null);try{let e=await fetch("/api/cli-tools/cline-settings",{method:"DELETE"}),t=await e.json();e.ok?(C({type:"success",text:t.message||"Reset!"}),O(""),z.current=!1,await X(),await Z()):C({type:"error",text:t.error||"Failed"})}catch(e){C({type:"error",text:e.message})}finally{k(!1)}};return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:e.image?(0,a.jsx)(o.default,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.currentTarget.style.display="none"}}):(0,a.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:e.color},children:"terminal"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,a.jsx)(c,{effectiveConfigStatus:W,batchStatus:u,lastConfiguredAt:p})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-6 pt-6 border-t border-border",children:[y&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-sm",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-base",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Cline CLI..."})]}),h&&!y&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-lg border bg-bg-secondary/50 border-border",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-lg ${J?"text-green-500":"text-yellow-500"}`,children:J?"check_circle":"warning"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:J?"Cline CLI detected and ready":h.installed?"Cline CLI installed but not runnable":"Cline CLI not detected"}),h.commandPath&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Binary:"," ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/10",children:h.commandPath})]}),h.globalStatePath&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Config:"," ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/10",children:h.globalStatePath})]})]})]}),J&&(0,a.jsxs)(a.Fragment,{children:["configured"===q&&(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-green-500/10 border border-green-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-green-500 text-lg",children:"check_circle"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm text-green-700 dark:text-green-300",children:"OmniRoute is configured as OpenAI-compatible provider"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Provider: ",(0,a.jsx)("strong",{children:"openai"})," • Model:"," ",(0,a.jsx)("strong",{children:h.settings?.openAiModelId||"—"})]})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm text-text-muted",children:"Model"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"text",value:A,onChange:e=>O(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)(r.$n,{variant:"outline",size:"sm",onClick:()=>P(!0),disabled:!n,children:"Select"}),(0,a.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>L(!0),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"edit"})})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm text-text-muted",children:"API Key"}),d&&d.length>0?(0,a.jsx)("select",{value:S,onChange:e=>_(e.target.value),className:"px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("p",{className:"text-sm text-text-muted",children:m?"No API keys available":"Using default: sk_omniroute"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 pt-2",children:[(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:Y,disabled:!A,loading:j,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"configured"===q?"Update Config":"Apply Config"]}),"configured"===q&&(0,a.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:Q,loading:v,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restart_alt"}),"Reset"]})]}),w&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-3 py-2 rounded-lg text-sm ${"success"===w.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"success"===w.type?"check_circle":"error"}),(0,a.jsx)("span",{children:w.text})]}),(0,a.jsxs)("div",{className:"border-t border-border pt-3 mt-1",children:[(0,a.jsxs)("button",{onClick:()=>D(!F),className:"flex items-center gap-2 text-sm text-text-muted hover:text-text transition-colors",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] transition-transform ${F?"rotate-90":""}`,children:"chevron_right"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"backup"}),"Backups ",U.length>0&&`(${U.length})`]}),F&&U.length>0&&(0,a.jsx)("div",{className:"mt-2 flex flex-col gap-1.5 pl-6",children:U.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 p-2 rounded bg-bg-secondary/50 text-xs",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-medium",children:e.originalFile}),(0,a.jsx)("span",{className:"text-text-muted",children:new Date(e.createdAt).toLocaleString()})]}),(0,a.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>V(e.id),loading:B===e.id,children:"Restore"})]},e.id))}),F&&0===U.length&&(0,a.jsx)("p",{className:"mt-2 pl-6 text-xs text-text-muted",children:"No backups available."})]})]})]})]}),(0,a.jsx)(r.rq,{isOpen:E,onClose:()=>P(!1),onSelect:e=>{O(e.value),P(!1)},selectedModel:A,activeProviders:x,title:"Select Model for Cline"}),T&&(0,a.jsx)(r.uR,{isOpen:T,onClose:()=>L(!1),title:"Cline Manual Configuration",onApply:e=>{e.model&&O(e.model),e.apiKey&&_(e.apiKey),e.baseUrl&&M(e.baseUrl),L(!1)},currentConfig:{model:A,apiKey:S,baseUrl:R||i}})]})}function b({tool:e,isExpanded:t,onToggle:s,baseUrl:i,hasActiveProviders:n,apiKeys:d,activeProviders:x,cloudEnabled:m,batchStatus:u,lastConfiguredAt:p}){let[h,g]=(0,l.useState)(null),[f,y]=(0,l.useState)(!1),[b,j]=(0,l.useState)(!1),[N,v]=(0,l.useState)(!1),[k,w]=(0,l.useState)(null),[C,S]=(0,l.useState)(""),[_,A]=(0,l.useState)(""),[O,E]=(0,l.useState)(!1),[P,I]=(0,l.useState)({}),[$,T]=(0,l.useState)(!1),[L,R]=(0,l.useState)(""),M=(0,l.useRef)(!1),[z,U]=(0,l.useState)([]),[K,F]=(0,l.useState)(!1),[D,B]=(0,l.useState)(null),H=!!(h?.installed&&h?.runnable),J=H?h.hasOmniRoute?"configured":"not_configured":null,q=J||u?.configStatus||null;(0,l.useEffect)(()=>{d?.length>0&&!C&&S(d[0].key)},[d,C]),(0,l.useEffect)(()=>{t&&!h&&(V(),W(),G())},[t,h]);let W=async()=>{try{let e=await fetch("/api/models/alias");if(e.ok){let t=await e.json();I(t.aliases||{})}}catch{}},G=async()=>{try{let e=await fetch("/api/cli-tools/backups?tool=kilo");if(e.ok){let t=await e.json();U(t.backups||[])}}catch{}},Z=async e=>{B(e);try{let t=await fetch("/api/cli-tools/backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:"kilo",backupId:e})});if(t.ok)w({type:"success",text:"Backup restored! Reloading status..."}),await V(),await G();else{let e=await t.json();w({type:"error",text:e.error||"Failed to restore backup"})}}catch(e){w({type:"error",text:e.message})}finally{B(null)}},V=async()=>{y(!0);try{let e=await fetch("/api/cli-tools/kilo-settings"),t=await e.json();g(t)}catch(e){g({error:e.message})}finally{y(!1)}},X=async()=>{j(!0),w(null);try{let e=L||i||"http://localhost:20128",t=e.endsWith("/v1")?e:`${e}/v1`,s=await fetch("/api/cli-tools/kilo-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:t,apiKey:C||"sk_omniroute",model:_})}),a=await s.json();s.ok?(w({type:"success",text:a.message||"Applied!"}),await V(),await G()):w({type:"error",text:a.error||"Failed"})}catch(e){w({type:"error",text:e.message})}finally{j(!1)}},Y=async()=>{v(!0),w(null);try{let e=await fetch("/api/cli-tools/kilo-settings",{method:"DELETE"}),t=await e.json();e.ok?(w({type:"success",text:t.message||"Reset!"}),A(""),M.current=!1,await V(),await G()):w({type:"error",text:t.error||"Failed"})}catch(e){w({type:"error",text:e.message})}finally{v(!1)}};return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:e.image?(0,a.jsx)(o.default,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.currentTarget.style.display="none"}}):(0,a.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:e.color},children:"terminal"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,a.jsx)(c,{effectiveConfigStatus:q,batchStatus:u,lastConfiguredAt:p})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-6 pt-6 border-t border-border",children:[f&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-sm",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-base",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking Kilo Code CLI..."})]}),h&&!f&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-lg border bg-bg-secondary/50 border-border",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-lg ${H?"text-green-500":"text-yellow-500"}`,children:H?"check_circle":"warning"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:H?"Kilo Code CLI detected and ready":h.installed?"Kilo Code CLI installed but not runnable":"Kilo Code CLI not detected"}),h.commandPath&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Binary:"," ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/10",children:h.commandPath})]}),h.authPath&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Auth:"," ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/10",children:h.authPath})]})]})]}),H&&(0,a.jsxs)(a.Fragment,{children:["configured"===J&&(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-green-500/10 border border-green-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-green-500 text-lg",children:"check_circle"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm text-green-700 dark:text-green-300",children:"OmniRoute is configured as OpenAI-compatible provider"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Providers: ",(0,a.jsx)("strong",{children:h.settings?.auth?.join(", ")||"—"})]})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm text-text-muted",children:"Model"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"text",value:_,onChange:e=>A(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)(r.$n,{variant:"outline",size:"sm",onClick:()=>E(!0),disabled:!n,children:"Select"}),(0,a.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>T(!0),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"edit"})})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm text-text-muted",children:"API Key"}),d&&d.length>0?(0,a.jsx)("select",{value:C,onChange:e=>S(e.target.value),className:"px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("p",{className:"text-sm text-text-muted",children:m?"No API keys available":"Using default: sk_omniroute"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 pt-2",children:[(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:X,disabled:!_,loading:b,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"configured"===J?"Update Config":"Apply Config"]}),"configured"===J&&(0,a.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:Y,loading:N,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restart_alt"}),"Reset"]})]}),k&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-3 py-2 rounded-lg text-sm ${"success"===k.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"success"===k.type?"check_circle":"error"}),(0,a.jsx)("span",{children:k.text})]}),(0,a.jsxs)("div",{className:"border-t border-border pt-3 mt-1",children:[(0,a.jsxs)("button",{onClick:()=>F(!K),className:"flex items-center gap-2 text-sm text-text-muted hover:text-text transition-colors",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] transition-transform ${K?"rotate-90":""}`,children:"chevron_right"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"backup"}),"Backups ",z.length>0&&`(${z.length})`]}),K&&z.length>0&&(0,a.jsx)("div",{className:"mt-2 flex flex-col gap-1.5 pl-6",children:z.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 p-2 rounded bg-bg-secondary/50 text-xs",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-medium",children:e.originalFile}),(0,a.jsx)("span",{className:"text-text-muted",children:new Date(e.createdAt).toLocaleString()})]}),(0,a.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>Z(e.id),loading:D===e.id,children:"Restore"})]},e.id))}),K&&0===z.length&&(0,a.jsx)("p",{className:"mt-2 pl-6 text-xs text-text-muted",children:"No backups available."})]})]})]})]}),(0,a.jsx)(r.rq,{isOpen:O,onClose:()=>E(!1),onSelect:e=>{A(e.value),E(!1)},selectedModel:_,activeProviders:x,title:"Select Model for Kilo Code"}),$&&(0,a.jsx)(r.uR,{isOpen:$,onClose:()=>T(!1),title:"Kilo Code Manual Configuration",onApply:e=>{e.model&&A(e.model),e.apiKey&&S(e.apiKey),e.baseUrl&&R(e.baseUrl),T(!1)},currentConfig:{model:_,apiKey:C,baseUrl:L||i}})]})}function j({toolId:e,tool:t,isExpanded:s,onToggle:i,baseUrl:n,apiKeys:c,activeProviders:d=[],cloudEnabled:x=!1,batchStatus:m}){let u,p,h,[g,f]=(0,l.useState)(null),[y,b]=(0,l.useState)(!1),[j,N]=(0,l.useState)(""),[v,k]=(0,l.useState)(null),[w,C]=(0,l.useState)(null),[S,_]=(0,l.useState)(!1),A=(0,l.useRef)(!1),[O,E]=(0,l.useState)(()=>c?.length>0?c[0].key:"");(0,l.useEffect)(()=>{let t=localStorage.getItem(`omniroute-cli-model-${e}`);t&&N(t);let s=localStorage.getItem(`omniroute-cli-key-${e}`);s&&c?.some(e=>e.key===s)&&E(s)},[e,c]);let P=(0,l.useCallback)(t=>{N(t),t?localStorage.setItem(`omniroute-cli-model-${e}`,t):localStorage.removeItem(`omniroute-cli-model-${e}`)},[e]),I=(0,l.useCallback)(t=>{E(t),t&&localStorage.setItem(`omniroute-cli-key-${e}`,t)},[e]);(0,l.useEffect)(()=>{!s||v||A.current||(A.current=!0,fetch(`/api/cli-tools/runtime/${e}`).then(e=>e.json()).then(e=>k(e)).catch(e=>k({error:e?.message||"runtime_check_failed"})))},[s,v,e]);let $=e=>{let t=O&&O.trim()?O:x?"your-api-key":"sk_omniroute",s=n||"http://localhost:20128",a=s.endsWith("/v1")?s:`${s}/v1`;return e.replace(/\{\{baseUrl\}\}/g,a).replace(/\{\{apiKey\}\}/g,t).replace(/\{\{model\}\}/g,j||"provider/model-id")},T=async(e,t)=>{await navigator.clipboard.writeText($(e)),f(t),setTimeout(()=>f(null),2e3)},L=d.length>0,R=s&&null===v,M=async()=>{_(!0),C(null);try{let t=O&&O.trim()?O:x?"":"sk_omniroute",s=n||"http://localhost:20128",a=s.endsWith("/v1")?s:`${s}/v1`,l=await fetch(`/api/cli-tools/guide-settings/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:a,apiKey:t,model:j})}),r=await l.json();l.ok?C({type:"success",text:r.message||"Configuration saved!"}):C({type:"error",text:r.error||"Failed to save"})}catch(e){C({type:"error",text:e.message})}finally{_(!1)}},z=["continue"].includes(e),U=()=>!t.requiresCloud||!!x;return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:i,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:t.image?(0,a.jsx)(o.default,{src:t.image,alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.currentTarget.style.display="none"}}):t.icon?(0,a.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:t.color},children:t.icon}):(0,a.jsx)(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.currentTarget.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:t.name}),(u=v?.reason==="not_required"||"guide"===t.configType,p=v?v.installed&&v.runnable:m?.installed&&m?.runnable,h=v?v.installed:m?.installed,u?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 text-[11px] font-medium rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400",children:[(0,a.jsx)("span",{className:"size-1.5 rounded-full bg-blue-500"}),"Guide"]}):p?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 text-[11px] font-medium rounded-full bg-green-500/10 text-green-600 dark:text-green-400",children:[(0,a.jsx)("span",{className:"size-1.5 rounded-full bg-green-500"}),"Detected"]}):!1===h&&(v||m)?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 text-[11px] font-medium rounded-full bg-zinc-500/10 text-zinc-500 dark:text-zinc-400",children:[(0,a.jsx)("span",{className:"size-1.5 rounded-full bg-zinc-400 dark:bg-zinc-500"}),"Not installed"]}):h&&!p&&(v||m)?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 text-[11px] font-medium rounded-full bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",children:[(0,a.jsx)("span",{className:"size-1.5 rounded-full bg-yellow-500"}),"Not ready"]}):null)]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:t.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${s?"rotate-180":""}`,children:"expand_more"})]}),s&&(0,a.jsx)("div",{className:"mt-6 pt-6 border-t border-border",children:t.guideSteps?(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[R&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-sm",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-base",children:"progress_activity"}),(0,a.jsx)("span",{children:"Checking runtime..."})]}),!R&&v&&!v.error&&(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-blue-500/10 border border-blue-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-blue-500 text-lg",children:"not_required"===v.reason?"info":v.installed&&v.runnable?"check_circle":"warning"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:"not_required"===v.reason?"Guide-only integration: no local binary required":v.installed&&v.runnable?"CLI runtime detected and healthy":v.installed?`CLI found but not runnable${v.reason?` (${v.reason})`:""}`:"CLI runtime not detected"}),v.commandPath&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Binary:"," ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/10",children:v.commandPath})]}),v.configPath&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Config path:"," ",(0,a.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/10",children:v.configPath})]})]})]}),!R&&v?.error&&(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-red-500/10 border border-red-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-red-500 text-lg",children:"error"}),(0,a.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:"Failed to check runtime status."})]}),t.notes&&0!==t.notes.length?(0,a.jsx)("div",{className:"flex flex-col gap-2 mb-4",children:t.notes.map((e,t)=>{if("cloudCheck"===e.type&&x)return null;let s="warning"===e.type,l="cloudCheck"===e.type&&!x,r="bg-blue-500/10 border-blue-500/30",i="text-blue-600 dark:text-blue-400",n="text-blue-500",o="info";return s?(r="bg-yellow-500/10 border-yellow-500/30",i="text-yellow-600 dark:text-yellow-400",n="text-yellow-500",o="warning"):l&&(r="bg-red-500/10 border-red-500/30",i="text-red-600 dark:text-red-400",n="text-red-500",o="error"),(0,a.jsxs)("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${r}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-lg ${n}`,children:o}),(0,a.jsx)("p",{className:`text-sm ${i}`,children:e.text})]},t)})}):null,U()&&t.guideSteps.map(e=>(0,a.jsxs)("div",{className:"flex items-start gap-4",children:[(0,a.jsx)("div",{className:"size-8 rounded-full flex items-center justify-center shrink-0 text-sm font-semibold text-white",style:{backgroundColor:t.color},children:e.step}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-text",children:e.title}),e.desc&&(0,a.jsx)("p",{className:"text-sm text-text-muted mt-0.5",children:e.desc}),"apiKeySelector"===e.type&&(0,a.jsx)("div",{className:"mt-2 flex items-center gap-2",children:c&&c.length>0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("select",{value:O,onChange:e=>I(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:c.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}),(0,a.jsx)("button",{onClick:()=>T(O,"apiKey"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"apiKey"===g?"check":"content_copy"})})]}):(0,a.jsx)("span",{className:"text-sm text-text-muted",children:x?"No API keys - Create one in Keys page":"sk_omniroute"})}),"modelSelector"===e.type&&(0,a.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,a.jsx)("input",{type:"text",value:j,onChange:e=>P(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>b(!0),disabled:!L,className:`shrink-0 px-3 py-2 rounded-lg border text-sm transition-colors ${L?"bg-bg-secondary border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),j&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{onClick:()=>T(j,"model"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"model"===g?"check":"content_copy"})}),(0,a.jsx)("button",{onClick:()=>P(""),className:"p-2 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]})]}),e.value&&(0,a.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,a.jsx)("code",{className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm font-mono border border-border truncate",children:$(e.value)}),e.copyable&&(0,a.jsx)("button",{onClick:()=>T(e.value,`${e.step}-${e.title}`),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:g===`${e.step}-${e.title}`?"check":"content_copy"})})]})]})]},e.step)),U()&&t.codeBlock&&(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wide",children:t.codeBlock.language}),(0,a.jsxs)("button",{onClick:()=>T(t.codeBlock.code,"codeblock"),className:"flex items-center gap-1 px-2 py-1 text-xs bg-bg-secondary hover:bg-bg-tertiary rounded border border-border transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"codeblock"===g?"check":"content_copy"}),"codeblock"===g?"Copied!":"Copy"]})]}),(0,a.jsx)("pre",{className:"p-4 bg-bg-secondary rounded-lg border border-border overflow-x-auto",children:(0,a.jsx)("code",{className:"text-sm font-mono whitespace-pre",children:$(t.codeBlock.code)})})]}),U()&&(0,a.jsxs)("div",{className:"mt-2",children:[w&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs mb-2 ${"success"===w.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===w.type?"check_circle":"error"}),(0,a.jsx)("span",{children:w.text})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[z&&(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:M,disabled:!j,loading:S,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Save Config"]}),t.codeBlock&&(0,a.jsxs)(r.$n,{variant:z?"outline":"primary",size:"sm",onClick:()=>T(t.codeBlock.code,"codeblock"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"codeblock"===g?"check":"content_copy"}),"codeblock"===g?"Copied!":"Copy Config"]}),j&&(0,a.jsxs)("span",{className:"text-xs text-text-muted flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-green-500",children:"check_circle"}),"Selection saved"]})]})]})]}):(0,a.jsx)("p",{className:"text-text-muted text-sm",children:"Coming soon..."})}),(0,a.jsx)(r.rq,{isOpen:y,onClose:()=>b(!1),onSelect:e=>{P(e.value)},selectedModel:j,activeProviders:d,title:"Select Model"})]})}function N({tool:e,isExpanded:t,onToggle:s,baseUrl:i,apiKeys:n,activeProviders:c,hasActiveProviders:d,cloudEnabled:x}){let[m,u]=(0,l.useState)(null),[p,h]=(0,l.useState)(!1),[g,f]=(0,l.useState)(!1),[y,b]=(0,l.useState)(""),[j,N]=(0,l.useState)(""),[v,k]=(0,l.useState)(null),[w,C]=(0,l.useState)({}),[S,_]=(0,l.useState)(!1),[A,O]=(0,l.useState)(null);(0,l.useEffect)(()=>{n?.length>0&&!j&&N(n[0].key)},[n,j]),(0,l.useEffect)(()=>{t&&!m&&(P(),E())},[t,m]);let E=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)}},P=async()=>{try{let e=await fetch("/api/cli-tools/antigravity-mitm");if(e.ok){let t=await e.json();u(t)}}catch(e){console.log("Error fetching status:",e),u({running:!1})}},I="u">typeof navigator&&navigator.userAgent?.includes("Windows"),$=async e=>{h(!0),k(null);try{let t=j?.trim()||(n?.length>0?n[0].key:null)||(x?null:"sk_omniroute"),s=await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:t,sudoPassword:e})}),a=await s.json();s.ok?(k({type:"success",text:"MITM started"}),f(!1),b(""),P()):k({type:"error",text:a.error||"Failed to start"})}catch(e){k({type:"error",text:e.message})}finally{h(!1)}},T=async e=>{h(!0),k(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?(k({type:"success",text:"MITM stopped"}),f(!1),b(""),P()):k({type:"error",text:s.error||"Failed to stop"})}catch(e){k({type:"error",text:e.message})}finally{h(!1)}},L=()=>{y.trim()?m?.running?T(y):$(y):k({type:"error",text:"Sudo password is required"})},R=(e,t)=>{C(s=>({...s,[e]:t}))},M=async()=>{h(!0),k(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:w})});if(!e.ok){let t=await e.json();throw Error(t.error||"Failed to save mappings")}k({type:"success",text:"Mappings saved!"})}catch(e){k({type:"error",text:e.message})}finally{h(!1)}},z=m?.running;return(0,a.jsxs)(r.Zp,{padding:"sm",className:"overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,a.jsx)(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.currentTarget.style.display="none"}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm",children:e.name}),z?(0,a.jsx)(r.Ex,{variant:"success",size:"sm",children:"Active"}):(0,a.jsx)(r.Ex,{variant:"default",size:"sm",children:"Inactive"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,a.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[(0,a.jsx)("div",{className:"flex items-center gap-2",children:z?(0,a.jsxs)("button",{onClick:()=>{I||m?.hasCachedPassword?T(""):(f(!0),k(null))},disabled:p,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,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"stop_circle"}),"Stop MITM"]}):(0,a.jsxs)("button",{onClick:()=>{I||m?.hasCachedPassword?$(""):(f(!0),k(null))},disabled:p||!d,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,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"play_circle"}),"Start MITM"]})}),v?.type==="error"&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,a.jsx)("span",{children:v.text})]}),z&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),n.length>0?(0,a.jsx)("select",{value:j,onChange:e=>N(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:n.map(e=>(0,a.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,a.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_omniroute (default)"})]}),e.defaultModels.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:e.name}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,a.jsx)("input",{type:"text",value:w[e.alias]||"",onChange:t=>R(e.alias,t.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsx)("button",{onClick:()=>{O(e.alias),_(!0)},disabled:!d,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${d?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),w[e.alias]&&(0,a.jsx)("button",{onClick:()=>R(e.alias,""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.alias)),(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:M,disabled:p||0===Object.keys(w).length,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Save Mappings"]})})]}),!z&&(0,a.jsxs)("div",{className:"flex flex-col gap-1.5 px-1",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[(0,a.jsx)("span",{className:"font-medium text-text-main",children:"How it works:"})," Intercepts Antigravity traffic via DNS redirect, letting you reroute models through OmniRoute."]}),(0,a.jsxs)("div",{className:"flex flex-col gap-0.5 text-[11px] text-text-muted",children:[(0,a.jsx)("span",{children:"1. Generates SSL cert & adds to system keychain"}),(0,a.jsxs)("span",{children:["2. Redirects"," ",(0,a.jsx)("code",{className:"text-[10px] bg-surface px-1 rounded",children:"daily-cloudcode-pa.googleapis.com"})," ","→ localhost"]}),(0,a.jsx)("span",{children:"3. Maps Antigravity models to any provider via OmniRoute"})]})]})]}),(0,a.jsx)(r.aF,{isOpen:g,onClose:()=>{f(!1),b(""),k(null)},title:"Sudo Password Required",size:"sm",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Required for SSL certificate and DNS configuration"})]}),(0,a.jsx)(r.pd,{type:"password",placeholder:"Enter sudo password",value:y,onChange:e=>b(e.target.value),onKeyDown:e=>{"Enter"!==e.key||p||L()}}),v&&(0,a.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===v.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===v.type?"check_circle":"error"}),(0,a.jsx)("span",{children:v.text})]}),(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,a.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{f(!1),b(""),k(null)},disabled:p,children:"Cancel"}),(0,a.jsx)(r.$n,{variant:"primary",size:"sm",onClick:L,loading:p,children:"Confirm"})]})]})}),(0,a.jsx)(r.rq,{isOpen:S,onClose:()=>_(!1),onSelect:e=>{A&&C(t=>({...t,[A]:e.value}))},selectedModel:A?w[A]:null,activeProviders:c,title:`Select model for ${A}`})]})}s(41463).env.NEXT_PUBLIC_CLOUD_URL;var v=s(50910);let k=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function w({machineId:e}){let t,s,o,c=(0,v.c)("cliTools"),[d,u]=(0,l.useState)([]),[h,f]=(0,l.useState)(!0),[w,C]=(0,l.useState)(null),[S,_]=(0,l.useState)({}),[A,O]=(0,l.useState)(!1),[E,P]=(0,l.useState)([]),[I,$]=(0,l.useState)({}),[T,L]=(0,l.useState)(!1);(0,l.useEffect)(()=>{U(),R(),M(),z()},[]);let R=async()=>{try{let e=await fetch("/api/settings");if(e.ok){let t=await e.json();O(t.cloudEnabled||!1)}}catch(e){console.log("Error loading cloud settings:",e)}},M=async()=>{try{let e=await fetch("/api/keys");if(e.ok){let t=await e.json();P(t.keys||[])}}catch(e){console.log("Error fetching API keys:",e)}},z=async()=>{try{let e=new AbortController,t=setTimeout(()=>e.abort(),8e3),s=await fetch("/api/cli-tools/status",{signal:e.signal});if(clearTimeout(t),s.ok){let e=await s.json();$(e||{})}}catch(e){console.log("CLI tool status check timed out or failed:",e)}finally{L(!0)}},U=async()=>{try{let e=await fetch("/api/providers"),t=await e.json();e.ok&&u(t.connections||[])}catch(e){console.log("Error fetching connections:",e)}finally{f(!1)}},K=()=>d.filter(e=>!1!==e.isActive),F=(0,l.useCallback)((e,t,s)=>{_(a=>a[e]?.[t]===s?a:{...a,[e]:{...a[e],[t]:s}})},[]);if(h||!T)return(0,a.jsx)("div",{className:"flex flex-col gap-6",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(r.Qv,{}),(0,a.jsx)(r.Qv,{}),(0,a.jsx)(r.Qv,{})]})});let D=(t=K(),s=[],o=new Set,t.forEach(e=>{let t=n.Xg[e.provider]||e.provider;(0,n.KC)(e.provider).forEach(a=>{let l=`${t}/${a.id}`;o.has(l)||(o.add(l),s.push({value:l,label:`${t}/${a.id}`,provider:e.provider,alias:t,connectionName:e.name,modelId:a.id}))})}),s).length>0;return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[!D&&(0,a.jsx)(r.Zp,{className:"border-yellow-500/50 bg-yellow-500/5",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:c("noActiveProviders")}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:c("noActiveProvidersDesc")})]})]})}),(0,a.jsx)("div",{className:"flex flex-col gap-4",children:Object.entries(i).map(([e,t])=>((e,t)=>{let s={tool:t,isExpanded:w===e,onToggle:()=>C(w===e?null:e),baseUrl:A&&k?k:window.location.origin,apiKeys:E,batchStatus:I[e]||null,lastConfiguredAt:I[e]?.lastConfiguredAt||null};switch(e){case"claude":return(0,a.jsx)(x,{...s,activeProviders:K(),modelMappings:S[e]||{},onModelMappingChange:(t,s)=>F(e,t,s),hasActiveProviders:D,cloudEnabled:A},e);case"codex":return(0,a.jsx)(m,{...s,activeProviders:K(),cloudEnabled:A},e);case"droid":return(0,a.jsx)(p,{...s,activeProviders:K(),hasActiveProviders:D,cloudEnabled:A},e);case"openclaw":return(0,a.jsx)(g,{...s,activeProviders:K(),hasActiveProviders:D,cloudEnabled:A},e);case"antigravity":return(0,a.jsx)(N,{...s,activeProviders:K(),hasActiveProviders:D,cloudEnabled:A},e);case"cline":return(0,a.jsx)(y,{...s,activeProviders:K(),hasActiveProviders:D,cloudEnabled:A},e);case"kilo":return(0,a.jsx)(b,{...s,activeProviders:K(),hasActiveProviders:D,cloudEnabled:A},e);default:return(0,a.jsx)(j,{toolId:e,...s,activeProviders:K(),cloudEnabled:A},e)}})(e,t))})]})}}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=33782)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3700],{14031:(e,t,s)=>{Promise.resolve().then(s.bind(s,70595))},70595:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>h});var a=s(95155),l=s(12115),i=s(40993),r=s(50910),d=s(67671);function n({value:e,max:t,warningAt:s=.8}){let l=t>0?Math.min(e/t*100,100):0,i=t>0?e/t:0;return(0,a.jsxs)("div",{className:"w-full",children:[(0,a.jsxs)("div",{className:"flex justify-between text-xs mb-1",children:[(0,a.jsxs)("span",{className:"text-text-muted",children:["$",e.toFixed(2)]}),(0,a.jsxs)("span",{className:"text-text-muted",children:["$",t.toFixed(2)]})]}),(0,a.jsx)("div",{className:"w-full h-2 rounded-full bg-surface/50 overflow-hidden",children:(0,a.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${l}%`,backgroundColor:i>=1?"#ef4444":i>=s?"#f59e0b":"#22c55e"}})})]})}function o(){let e=(0,r.c)("usage"),[t,s]=(0,l.useState)([]),[o,c]=(0,l.useState)(null),[m,x]=(0,l.useState)(null),[u,p]=(0,l.useState)(!0),[h,g]=(0,l.useState)(!1),[b,f]=(0,l.useState)({dailyLimitUsd:"",monthlyLimitUsd:"",warningThreshold:"80"}),j=(0,d.i)();(0,l.useEffect)(()=>{fetch("/api/keys").then(e=>e.json()).then(e=>{let t=Array.isArray(e)?e:e.keys||[];s(t),t.length>0&&c(t[0].id),p(!1)}).catch(()=>p(!1))},[]);let y=(0,l.useCallback)(async()=>{if(o)try{let e=await fetch(`/api/usage/budget?apiKeyId=${o}`);if(e.ok){let t=await e.json();x(t),t.dailyLimitUsd&&f(e=>({...e,dailyLimitUsd:String(t.dailyLimitUsd)})),t.monthlyLimitUsd&&f(e=>({...e,monthlyLimitUsd:String(t.monthlyLimitUsd)})),t.warningThreshold&&f(e=>({...e,warningThreshold:String(t.warningThreshold)}))}}catch{}},[o]);(0,l.useEffect)(()=>{y()},[y]);let v=async()=>{g(!0);try{(await fetch("/api/usage/budget",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKeyId:o,dailyLimitUsd:b.dailyLimitUsd?parseFloat(b.dailyLimitUsd):null,monthlyLimitUsd:b.monthlyLimitUsd?parseFloat(b.monthlyLimitUsd):null,warningThreshold:parseInt(b.warningThreshold)||80})})).ok?(j.success("Budget limits saved"),await y()):j.error("Failed to save budget")}catch{j.error("Failed to save budget")}finally{g(!1)}};if(u)return(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted p-8 animate-pulse",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"account_balance_wallet"}),"Loading budget data..."]});if(0===t.length)return(0,a.jsx)(i.pp,{icon:"vpn_key",title:"No API Keys",description:"Add API keys first to set up budget limits."});let N=m?.dailyLimitUsd||parseFloat(b.dailyLimitUsd)||0,w=m?.monthlyLimitUsd||parseFloat(b.monthlyLimitUsd)||0,C=m?.totalCostToday||0,k=m?.totalCostMonth||0,S=(parseInt(b.warningThreshold)||80)/100;return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)(i.Zp,{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-emerald-500/10 text-emerald-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"account_balance_wallet"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:e("budgetManagement")})]}),(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("label",{className:"text-sm text-text-muted mb-1 block",children:e(">apiKey</")}),(0,a.jsx)("select",{value:o||"",onChange:e=>c(e.target.value),className:"w-full md:w-auto px-3 py-2 rounded-lg border border-border/50 bg-surface/30 text-text-main text-sm focus:outline-none focus:ring-1 focus:ring-primary",children:t.map(e=>(0,a.jsxs)("option",{value:e.id,children:[e.name||e.id," ",e.provider?`(${e.provider})`:""]},e.id))})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[(0,a.jsxs)("div",{className:"p-4 rounded-lg border border-border/30 bg-surface/20",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted mb-2",children:"Today's Spend"}),(0,a.jsxs)("p",{className:"text-2xl font-bold text-text-main",children:["$",C.toFixed(2)]}),N>0&&(0,a.jsx)(n,{value:C,max:N,warningAt:S})]}),(0,a.jsxs)("div",{className:"p-4 rounded-lg border border-border/30 bg-surface/20",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted mb-2",children:e("thisMonth")}),(0,a.jsxs)("p",{className:"text-2xl font-bold text-text-main",children:["$",k.toFixed(2)]}),w>0&&(0,a.jsx)(n,{value:k,max:w,warningAt:S})]})]}),(0,a.jsxs)("div",{className:"border-t border-border/30 pt-4",children:[(0,a.jsx)("p",{className:"text-sm font-medium mb-3",children:e("setLimits")}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4",children:[(0,a.jsx)(i.pd,{label:"Daily Limit (USD)",type:"number",step:"0.01",min:"0",placeholder:"e.g. 5.00",value:b.dailyLimitUsd,onChange:e=>f({...b,dailyLimitUsd:e.target.value})}),(0,a.jsx)(i.pd,{label:"Monthly Limit (USD)",type:"number",step:"0.01",min:"0",placeholder:"e.g. 50.00",value:b.monthlyLimitUsd,onChange:e=>f({...b,monthlyLimitUsd:e.target.value})}),(0,a.jsx)(i.pd,{label:"Warning Threshold (%)",type:"number",min:"1",max:"100",placeholder:"80",value:b.warningThreshold,onChange:e=>f({...b,warningThreshold:e.target.value})})]}),(0,a.jsx)(i.$n,{variant:"primary",onClick:v,loading:h,children:"Save Limits"})]})]}),m?.budgetCheck&&(0,a.jsx)(i.Zp,{className:"p-4",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",style:{color:m.budgetCheck.allowed?"#22c55e":"#ef4444"},children:m.budgetCheck.allowed?"check_circle":"block"}),(0,a.jsx)("span",{className:"text-sm",children:m.budgetCheck.allowed?`Budget OK — $${(m.budgetCheck.remaining||0).toFixed(2)} remaining`:"Budget exceeded — requests may be blocked"})]})})]})}let c=["input","output","cached","reasoning","cache_creation"],m={input:"Input",output:"Output",cached:"Cached",reasoning:"Reasoning",cache_creation:"Cache Write"};function x(){let[e,t]=(0,l.useState)({}),[s,d]=(0,l.useState)({}),[n,o]=(0,l.useState)(!0),[c,m]=(0,l.useState)(!1),[x,p]=(0,l.useState)(""),[h,g]=(0,l.useState)(null),[b,f]=(0,l.useState)(new Set),[j,y]=(0,l.useState)(""),[v,N]=(0,l.useState)(new Set),w=(0,r.c)("settings");(0,l.useEffect)(()=>{C()},[]);let C=async()=>{o(!0);try{let[e,s]=await Promise.all([fetch("/api/pricing/models"),fetch("/api/pricing")]);e.ok&&t(await e.json()),s.ok&&d(await s.json())}catch(e){console.error("Failed to load pricing data:",e)}finally{o(!1)}},k=(0,l.useMemo)(()=>Object.entries(e).map(([e,t])=>({alias:e,...t,pricedModels:s[e]?Object.keys(s[e]).length:0})).sort((e,t)=>t.modelCount-e.modelCount),[e,s]),S=(0,l.useMemo)(()=>{if(!j.trim())return k;let e=j.toLowerCase();return k.filter(t=>t.alias.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||t.models.some(t=>t.id.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)))},[k,j]),L=(0,l.useMemo)(()=>{let e=k.reduce((e,t)=>e+t.modelCount,0),t=Object.values(s).reduce((e,t)=>e+Object.keys(t).length,0);return{providers:k.length,totalModels:e,pricedCount:t}},[k,s]),U=(0,l.useCallback)(e=>{f(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),T=(0,l.useCallback)((e,t,s,a)=>{let l=parseFloat(a);isNaN(l)||l<0||(d(a=>{let i={...a};return i[e]||(i[e]={}),i[e][t]||(i[e][t]={input:0,output:0,cached:0,reasoning:0,cache_creation:0}),i[e][t]={...i[e][t],[s]:l},i}),N(t=>new Set(t).add(e)))},[]),$=(0,l.useCallback)(async e=>{m(!0),p("");try{let t=s[e]||{},a=await fetch("/api/pricing",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[e]:t})});if(a.ok)p(`✅ ${e.toUpperCase()} saved`),N(t=>{let s=new Set(t);return s.delete(e),s}),setTimeout(()=>p(""),3e3);else{let e=await a.json();p(`❌ Error: ${e.error}`)}}catch(e){p(`❌ Save failed: ${e.message}`)}finally{m(!1)}},[s]),P=(0,l.useCallback)(async e=>{if(confirm(w("resetPricingConfirm",{provider:e.toUpperCase()})))try{let t=await fetch(`/api/pricing?provider=${e}`,{method:"DELETE"});if(t.ok){let s=await t.json();d(s),p(`🔄 ${e.toUpperCase()} reset to defaults`),N(t=>{let s=new Set(t);return s.delete(e),s}),setTimeout(()=>p(""),3e3)}}catch(e){p(`❌ Reset failed: ${e.message}`)}},[]),_=(0,l.useCallback)(e=>{g(t=>t===e?null:e)},[]),O=(0,l.useMemo)(()=>h?S.filter(e=>e.alias===h):S,[S,h]);return n?(0,a.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,a.jsx)("div",{className:"text-text-muted animate-pulse",children:w("loadingPricing")})}):(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between flex-wrap gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-xl font-bold",children:w("modelPricing")}),(0,a.jsx)("p",{className:"text-text-muted text-sm mt-1",children:w("modelPricingDesc")})]}),(0,a.jsxs)("div",{className:"flex gap-3 text-sm",children:[(0,a.jsxs)("div",{className:"bg-bg-subtle rounded-lg px-3 py-2 text-center",children:[(0,a.jsx)("div",{className:"text-text-muted text-xs font-semibold",children:w("providers")}),(0,a.jsx)("div",{className:"text-lg font-bold",children:L.providers})]}),(0,a.jsxs)("div",{className:"bg-bg-subtle rounded-lg px-3 py-2 text-center",children:[(0,a.jsx)("div",{className:"text-text-muted text-xs font-semibold",children:w("registry")}),(0,a.jsx)("div",{className:"text-lg font-bold",children:L.totalModels})]}),(0,a.jsxs)("div",{className:"bg-bg-subtle rounded-lg px-3 py-2 text-center",children:[(0,a.jsx)("div",{className:"text-text-muted text-xs font-semibold",children:w("priced")}),(0,a.jsx)("div",{className:"text-lg font-bold text-success",children:L.pricedCount})]})]})]}),x&&(0,a.jsx)("div",{className:"px-3 py-2 rounded-lg bg-bg-subtle border border-border text-sm",children:x}),(0,a.jsxs)("div",{className:"flex gap-3 items-center flex-wrap",children:[(0,a.jsxs)("div",{className:"relative flex-1 min-w-[200px]",children:[(0,a.jsx)("span",{className:"material-symbols-outlined absolute left-3 top-1/2 -translate-y-1/2 text-text-muted text-lg",children:"search"}),(0,a.jsx)("input",{type:"text",placeholder:w("searchProvidersModels"),value:j,onChange:e=>y(e.target.value),className:"w-full pl-10 pr-3 py-2 bg-bg-base border border-border rounded-lg focus:outline-none focus:border-primary text-sm"})]}),h&&(0,a.jsxs)("button",{onClick:()=>g(null),className:"px-3 py-2 text-xs bg-primary/10 text-primary border border-primary/20 rounded-lg hover:bg-primary/20 transition-colors flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"}),h.toUpperCase()," — ",w("showAll")]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:k.map(e=>(0,a.jsxs)("button",{onClick:()=>_(e.alias),className:`px-2.5 py-1 rounded-md text-xs font-medium transition-all ${h===e.alias?"bg-primary text-white shadow-sm":v.has(e.alias)?"bg-yellow-500/15 text-yellow-400 border border-yellow-500/30":"bg-bg-subtle text-text-muted hover:bg-bg-hover border border-transparent"}`,children:[e.alias.toUpperCase()," ",(0,a.jsxs)("span",{className:"opacity-60",children:["(",e.modelCount,")"]})]},e.alias))}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[O.map(e=>(0,a.jsx)(u,{provider:e,pricingData:s[e.alias]||{},isExpanded:b.has(e.alias),isEdited:v.has(e.alias),onToggle:()=>U(e.alias),onPricingChange:(t,s,a)=>T(e.alias,t,s,a),onSave:()=>$(e.alias),onReset:()=>P(e.alias),saving:c},e.alias)),0===O.length&&(0,a.jsx)("div",{className:"text-center py-12 text-text-muted",children:w("noProvidersMatch")})]}),(0,a.jsxs)(i.Zp,{className:"p-4 mt-2",children:[(0,a.jsxs)("h3",{className:"text-sm font-semibold mb-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm align-middle mr-1",children:"info"}),w("howPricingWorks")]}),(0,a.jsxs)("div",{className:"text-xs text-text-muted space-y-1",children:[(0,a.jsxs)("p",{children:[w("pricingDescInput")," • ",w("pricingDescOutput")," • ",w("pricingDescCached")," •"," ",w("pricingDescReasoning")," • ",w("pricingDescCacheWrite")]}),(0,a.jsx)("p",{children:w("pricingDescFormula")})]})]})]})}function u({provider:e,pricingData:t,isExpanded:s,isEdited:l,onToggle:i,onPricingChange:d,onSave:n,onReset:o,saving:x}){let u=(0,r.c)("settings"),h=Object.keys(t).length,g="oauth"===e.authType?"OAuth":"apikey"===e.authType?"API Key":e.authType;return(0,a.jsxs)("div",{className:`border rounded-lg overflow-hidden transition-colors ${l?"border-yellow-500/40 bg-yellow-500/5":"border-border"}`,children:[(0,a.jsxs)("button",{onClick:i,className:"w-full flex items-center justify-between px-4 py-3 hover:bg-bg-hover/50 transition-colors text-left",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-lg transition-transform ${s?"rotate-90":""}`,children:"chevron_right"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-semibold text-sm",children:e.id.charAt(0).toUpperCase()+e.id.slice(1)}),(0,a.jsxs)("span",{className:"text-text-muted text-xs ml-2",children:["(",e.alias.toUpperCase(),")"]})]}),(0,a.jsx)("span",{className:"px-1.5 py-0.5 bg-bg-subtle text-text-muted text-[10px] rounded uppercase font-semibold",children:g}),(0,a.jsx)("span",{className:"px-1.5 py-0.5 bg-bg-subtle text-text-muted text-[10px] rounded uppercase font-semibold",children:e.format})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[l&&(0,a.jsx)("span",{className:"text-yellow-500 text-xs font-medium",children:u("unsaved")}),(0,a.jsxs)("span",{className:"text-text-muted text-xs",children:[h,"/",e.modelCount," priced"]}),(0,a.jsx)("div",{className:"w-16 h-1.5 bg-bg-subtle rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${e.modelCount>0?Math.round(h/e.modelCount*100):0}%`}})})]})]}),s&&(0,a.jsxs)("div",{className:"border-t border-border",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 bg-bg-subtle/50",children:[(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:[e.modelCount," models • ",h," with pricing configured"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:e=>{e.stopPropagation(),o()},className:"px-2.5 py-1 text-[11px] text-red-400 hover:bg-red-500/10 rounded border border-red-500/20 transition-colors",children:u("resetDefaults")}),(0,a.jsx)("button",{onClick:e=>{e.stopPropagation(),n()},disabled:x||!l,className:"px-2.5 py-1 text-[11px] bg-primary text-white rounded hover:bg-primary/90 transition-colors disabled:opacity-40",children:u(x?"saving":"saveProvider")})]})]}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{className:"text-[11px] text-text-muted uppercase bg-bg-subtle/30",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-4 py-2 text-left font-semibold",children:u("model")}),c.map(e=>(0,a.jsx)("th",{className:"px-2 py-2 text-right font-semibold w-24",children:m[e]},e))]})}),(0,a.jsx)("tbody",{className:"divide-y divide-border/50",children:e.models.map(e=>(0,a.jsx)(p,{model:e,pricing:t[e.id],onPricingChange:(t,s)=>d(e.id,t,s)},e.id))})]})})]})]})}function p({model:e,pricing:t,onPricingChange:s}){let l=t&&Object.values(t).some(e=>e>0);return(0,a.jsxs)("tr",{className:"hover:bg-bg-hover/30 group",children:[(0,a.jsx)("td",{className:"px-4 py-1.5",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${l?"bg-success":"bg-text-muted/30"}`}),(0,a.jsx)("span",{className:"font-medium text-xs",children:e.name}),e.custom&&(0,a.jsx)("span",{className:"px-1 py-0.5 text-[8px] font-bold bg-blue-500/15 text-blue-400 border border-blue-500/20 rounded uppercase",children:"custom"}),(0,a.jsx)("span",{className:"text-text-muted text-[10px] opacity-0 group-hover:opacity-100 transition-opacity",children:e.id})]})}),c.map(e=>(0,a.jsx)("td",{className:"px-2 py-1.5",children:(0,a.jsx)("input",{type:"number",step:"0.01",min:"0",value:t?.[e]||0,onChange:t=>s(e,t.target.value),className:"w-full px-2 py-1 text-right text-xs bg-transparent border border-transparent hover:border-border focus:border-primary focus:bg-bg-base rounded transition-colors outline-none tabular-nums"})},e))]})}function h(){let[e,t]=(0,l.useState)("budget"),s=(0,r.c)("costs"),d=(0,r.c)("settings");return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(i.Iz,{options:[{value:"budget",label:s("budget")},{value:"pricing",label:d("pricing")}],value:e,onChange:t}),"budget"===e&&(0,a.jsx)(o,{}),"pricing"===e&&(0,a.jsx)(x,{})]})}}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=14031)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6099],{10373:(e,s,t)=>{Promise.resolve().then(t.bind(t,40877))},40877:(e,s,t)=>{"use strict";t.d(s,{default:()=>p});var i=t(95155),r=t(12115),l=t(14051),a=t.n(l),n=t(40993),o=t(30949),d=t(20909),c=t(50910);let m=t(41463).env.NEXT_PUBLIC_CLOUD_URL,x=15e3;function p({machineId:e}){let s=(0,c.c)("endpoint"),t=(0,c.c)("common"),[l,a]=(0,r.useState)([]),[p,h]=(0,r.useState)(!0),[b,f]=(0,r.useState)([]),[y,j]=(0,r.useState)(null),[v,N]=(0,r.useState)(!1),[k,w]=(0,r.useState)(!1),[C,T]=(0,r.useState)(!1),[_,S]=(0,r.useState)(!1),[$,E]=(0,r.useState)(null),[q,R]=(0,r.useState)(""),[B,O]=(0,r.useState)(!1),[U,D]=(0,r.useState)(null),{copied:P,copy:A}=(0,o.C)();(0,r.useEffect)(()=>{z(),W(),F()},[]);let F=async()=>{try{let e=await fetch("/v1/models");if(e.ok){let s=await e.json();f(s.data||[])}}catch(e){console.log("Error fetching models:",e)}},I=(0,r.useMemo)(()=>{let e=b.filter(e=>!e.type&&!e.parent),s=b.filter(e=>"embedding"===e.type&&!e.parent),t=b.filter(e=>"image"===e.type&&!e.parent),i=b.filter(e=>"rerank"===e.type&&!e.parent),r=b.filter(e=>"audio"===e.type&&"transcription"===e.subtype&&!e.parent);return{chat:e,embeddings:s,images:t,rerank:i,audioTranscription:r,audioSpeech:b.filter(e=>"audio"===e.type&&"speech"===e.subtype&&!e.parent),moderation:b.filter(e=>"moderation"===e.type&&!e.parent)}},[b]);(0,r.useMemo)(()=>Object.entries(d.Q2).map(([e,s])=>{let t=l.filter(s=>s.provider===e),i=t.filter(e=>!1!==e.isActive&&("active"===e.testStatus||"success"===e.testStatus||"unknown"===e.testStatus)).length,r=t.filter(e=>!1!==e.isActive&&("error"===e.testStatus||"expired"===e.testStatus||"unavailable"===e.testStatus)).length;return{id:e,provider:s,total:t.length,connected:i,errors:r}}),[l]);let M=async(e,s=x)=>{let t=new AbortController,i=setTimeout(()=>t.abort(),s);try{let s=await fetch("/api/sync/cloud",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e}),signal:t.signal}),i=await s.json().catch(()=>({}));return{ok:s.ok,status:s.status,data:i}}catch(e){if(e?.name==="AbortError")return{ok:!1,status:408,data:{error:"Cloud request timeout"}};return{ok:!1,status:500,data:{error:e.message||"Cloud request failed"}}}finally{clearTimeout(i)}},W=async()=>{try{let e=await fetch("/api/settings");if(e.ok){let s=await e.json();N(s.cloudEnabled||!1)}}catch(e){console.log("Error loading cloud settings:",e)}},z=async()=>{try{let e=await fetch("/api/providers"),s=await e.json();e.ok&&a(s.connections||[])}catch(e){console.log("Error fetching data:",e)}finally{h(!1)}},L=e=>{e?w(!0):T(!0)};(0,r.useEffect)(()=>{if($){let e=setTimeout(()=>E(null),5e3);return()=>clearTimeout(e)}},[$]);let Q=()=>{globalThis.dispatchEvent(new Event("cloud-status-changed"))},G=async()=>{S(!0),O(!1),R("syncing");try{let{ok:e,status:s,data:t}=await M("enable");if(e)R("verifying"),await new Promise(e=>setTimeout(e,600)),N(!0),R("done"),O(!0),S(!1),Q(),await new Promise(e=>setTimeout(e,1200)),w(!1),O(!1),t.verified?E({type:"success",message:"Cloud Proxy connected and verified!"}):E({type:"warning",message:t.verifyError?`Connected — verification pending: ${t.verifyError}`:"Connected — verification pending"}),t.createdKey&&await z(),await W();else{let e=t.error||"Failed to enable cloud";(502===s||408===s)&&(e="Could not reach cloud worker. Make sure the cloud service is running (npm run dev in /cloud)."),E({type:"error",message:e}),w(!1)}}catch(e){E({type:"error",message:e.message||"Connection failed"}),w(!1)}finally{S(!1),R("")}},Z=async()=>{S(!0),R("syncing");try{await M("sync"),R("disabling");let{ok:e,data:s}=await M("disable");e?(N(!1),E({type:"success",message:"Cloud disabled successfully"}),T(!1),Q(),await W()):E({type:"error",message:s.error||"Failed to disable cloud"})}catch(e){console.log("Error disabling cloud:",e),E({type:"error",message:"Failed to disable cloud"})}finally{S(!1),R("")}},[J,K]=(0,r.useState)("/v1"),X=`${m}/v1`;if((0,r.useEffect)(()=>{K(`${window.location.origin}/v1`)},[]),p)return(0,i.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,i.jsx)(n.Qv,{}),(0,i.jsx)(n.Qv,{})]});let Y=v?X:J;return(0,i.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,i.jsxs)(n.Zp,{className:"",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:s("title")}),(0,i.jsx)("p",{className:"text-sm text-text-muted",children:s(v?"usingCloudProxy":"usingLocalServer")}),e&&(0,i.jsx)("p",{className:"text-xs text-text-muted mt-1",children:s("machineId",{id:e.slice(0,8)})})]}),(0,i.jsx)("div",{className:"flex items-center gap-2",children:v?(0,i.jsx)(n.$n,{size:"sm",variant:"secondary",icon:"cloud_off",onClick:()=>L(!1),disabled:_,className:"bg-red-500/10! text-red-500! hover:bg-red-500/20! border-red-500/30!",children:s("disableCloud")}):(0,i.jsx)(n.$n,{variant:"primary",icon:"cloud_upload",onClick:()=>L(!0),disabled:_,className:"bg-linear-to-r from-primary to-blue-500 hover:from-primary-hover hover:to-blue-600",children:s("enableCloud")})})]}),$&&(0,i.jsxs)("div",{className:`flex items-center gap-2 px-4 py-2.5 rounded-lg mb-4 text-sm font-medium animate-in fade-in slide-in-from-top-2 duration-300 ${"success"===$.type?"bg-green-500/10 border border-green-500/30 text-green-400":"warning"===$.type?"bg-amber-500/10 border border-amber-500/30 text-amber-400":"bg-red-500/10 border border-red-500/30 text-red-400"}`,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"success"===$.type?"check_circle":"warning"===$.type?"warning":"error"}),(0,i.jsx)("span",{className:"flex-1",children:$.message}),(0,i.jsx)("button",{onClick:()=>E(null),className:"p-0.5 hover:bg-white/10 rounded transition-colors",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]}),(0,i.jsxs)("div",{className:"flex gap-2 mb-3",children:[(0,i.jsx)(n.pd,{value:Y,readOnly:!0,className:`flex-1 font-mono text-sm ${v?"animate-border-glow":""}`}),(0,i.jsx)(n.$n,{variant:"secondary",icon:"endpoint_url"===P?"check":"content_copy",onClick:()=>A(Y,"endpoint_url"),children:t("endpoint_url"===P?"copied":"copy")})]})]}),(0,i.jsxs)(n.Zp,{children:[(0,i.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:s("available")}),(0,i.jsxs)("p",{className:"text-sm text-text-muted",children:[Object.values(I).reduce((e,s)=>e+s.length,0)," models across"," ",[I.chat,I.embeddings,I.images,I.rerank,I.audioTranscription,I.audioSpeech,I.moderation].filter(e=>e.length>0).length," ","endpoints"]})]})}),(0,i.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,i.jsx)(g,{icon:"chat",iconColor:"text-blue-500",iconBg:"bg-blue-500/10",title:s("chatCompletions"),path:"/v1/chat/completions",description:s("chatDesc"),models:I.chat,expanded:"chat"===y,onToggle:()=>j("chat"===y?null:"chat"),copy:A,copied:P,baseUrl:Y}),(0,i.jsx)(g,{icon:"data_array",iconColor:"text-emerald-500",iconBg:"bg-emerald-500/10",title:s("embeddings"),path:"/v1/embeddings",description:s("embeddingsDesc"),models:I.embeddings,expanded:"embeddings"===y,onToggle:()=>j("embeddings"===y?null:"embeddings"),copy:A,copied:P,baseUrl:Y}),(0,i.jsx)(g,{icon:"image",iconColor:"text-purple-500",iconBg:"bg-purple-500/10",title:s("imageGeneration"),path:"/v1/images/generations",description:s("imageDesc"),models:I.images,expanded:"images"===y,onToggle:()=>j("images"===y?null:"images"),copy:A,copied:P,baseUrl:Y}),(0,i.jsx)(g,{icon:"sort",iconColor:"text-amber-500",iconBg:"bg-amber-500/10",title:s("rerank"),path:"/v1/rerank",description:s("rerankDesc"),models:I.rerank,expanded:"rerank"===y,onToggle:()=>j("rerank"===y?null:"rerank"),copy:A,copied:P,baseUrl:Y}),(0,i.jsx)(g,{icon:"mic",iconColor:"text-rose-500",iconBg:"bg-rose-500/10",title:s("audioTranscription"),path:"/v1/audio/transcriptions",description:s("audioTranscriptionDesc"),models:I.audioTranscription,expanded:"audioTranscription"===y,onToggle:()=>j("audioTranscription"===y?null:"audioTranscription"),copy:A,copied:P,baseUrl:Y}),(0,i.jsx)(g,{icon:"record_voice_over",iconColor:"text-cyan-500",iconBg:"bg-cyan-500/10",title:s("textToSpeech"),path:"/v1/audio/speech",description:s("textToSpeechDesc"),models:I.audioSpeech,expanded:"audioSpeech"===y,onToggle:()=>j("audioSpeech"===y?null:"audioSpeech"),copy:A,copied:P,baseUrl:Y}),(0,i.jsx)(g,{icon:"shield",iconColor:"text-orange-500",iconBg:"bg-orange-500/10",title:s("moderations"),path:"/v1/moderations",description:s("moderationsDesc"),models:I.moderation,expanded:"moderation"===y,onToggle:()=>j("moderation"===y?null:"moderation"),copy:A,copied:P,baseUrl:Y})]})]}),!1,(0,i.jsx)(n.aF,{isOpen:k,title:s("enableCloudTitle"),onClose:()=>w(!1),children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[(0,i.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200 font-medium mb-2",children:s("whatYouGet")}),(0,i.jsxs)("ul",{className:"text-sm text-blue-700 dark:text-blue-300 space-y-1",children:[(0,i.jsxs)("li",{children:["• ",s("cloudBenefitAccess")]}),(0,i.jsxs)("li",{children:["• ",s("cloudBenefitShare")]}),(0,i.jsxs)("li",{children:["• ",s("cloudBenefitPorts")]}),(0,i.jsxs)("li",{children:["• ",s("cloudBenefitEdge")]})]})]}),(0,i.jsxs)("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[(0,i.jsx)("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium mb-1",children:"Note"}),(0,i.jsxs)("ul",{className:"text-sm text-yellow-700 dark:text-yellow-300 space-y-1",children:[(0,i.jsx)("li",{children:"• Cloud will keep your auth session for 1 day. If not used, it will be automatically deleted."}),(0,i.jsx)("li",{children:"• Cloud is currently unstable with Claude Code OAuth in some cases."})]})]}),(_||B)&&(0,i.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border transition-all duration-300 ${B?"bg-green-500/10 border-green-500/30":"bg-primary/10 border-primary/30"}`,children:[B?(0,i.jsx)("span",{className:"material-symbols-outlined text-green-500 text-xl",children:"check_circle"}):(0,i.jsx)("span",{className:"material-symbols-outlined animate-spin text-primary",children:"progress_activity"}),(0,i.jsx)("div",{className:"flex-1",children:(0,i.jsxs)("p",{className:`text-sm font-medium ${B?"text-green-500":"text-primary"}`,children:[B&&s("cloudConnected"),!B&&"syncing"===q&&s("connectingToCloud"),!B&&"verifying"===q&&s("verifyingConnection")]})})]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(n.$n,{onClick:G,fullWidth:!0,disabled:_||B,children:_?(0,i.jsxs)("span",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),s("syncing"===q?"connecting":"verifying")]}):B?(0,i.jsxs)("span",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check"}),s("connected")]}):s("enableCloud")}),(0,i.jsx)(n.$n,{onClick:()=>w(!1),variant:"ghost",fullWidth:!0,disabled:_||B,children:t("cancel")})]})]})}),(0,i.jsx)(n.aF,{isOpen:C,title:s("disableCloudTitle"),onClose:()=>!_&&T(!1),children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:(0,i.jsxs)("div",{className:"flex items-start gap-3",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-red-600 dark:text-red-400",children:"warning"}),(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium mb-1",children:"Warning"}),(0,i.jsx)("p",{className:"text-sm text-red-700 dark:text-red-300",children:"All auth sessions will be deleted from cloud."})]})]})}),_&&(0,i.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-primary/10 border border-primary/30 rounded-lg",children:[(0,i.jsx)("span",{className:"material-symbols-outlined animate-spin text-primary",children:"progress_activity"}),(0,i.jsx)("div",{className:"flex-1",children:(0,i.jsxs)("p",{className:"text-sm font-medium text-primary",children:["syncing"===q&&s("syncingData"),"disabling"===q&&s("disablingCloud")]})})]}),(0,i.jsx)("p",{className:"text-sm text-text-muted",children:s("disableConfirm")}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(n.$n,{onClick:Z,fullWidth:!0,disabled:_,className:"bg-red-500! hover:bg-red-600! text-white!",children:_?(0,i.jsxs)("span",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),s("syncing"===q?"syncing":"disabling")]}):s("disableCloud")}),(0,i.jsx)(n.$n,{onClick:()=>T(!1),variant:"ghost",fullWidth:!0,disabled:_,children:t("cancel")})]})]})}),U&&(0,i.jsx)(u,{provider:U,models:b,copy:A,copied:P,onClose:()=>D(null)})]})}function u({provider:e,models:s,copy:t,copied:l,onClose:a}){let o=e.provider.alias||e.id,d=(0,r.useMemo)(()=>s.filter(s=>!s.parent&&(s.owned_by===o||s.owned_by===e.id)),[s,o,e.id]),c=d.filter(e=>!e.type),m=d.filter(e=>"embedding"===e.type),x=d.filter(e=>"image"===e.type),p=(e,s,r)=>0===r.length?null:(0,i.jsxs)("div",{className:"mb-4",children:[(0,i.jsxs)("h4",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider mb-2 flex items-center gap-1.5",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:s}),e," (",r.length,")"]}),(0,i.jsx)("div",{className:"flex flex-col gap-1",children:r.map(e=>{let s=`modal-${e.id}`;return(0,i.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg hover:bg-surface/60 group",children:[(0,i.jsx)("code",{className:"text-sm font-mono flex-1 truncate",children:e.id}),e.custom&&(0,i.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary",children:"custom"}),(0,i.jsx)("button",{onClick:()=>t(e.id,s),className:"p-1 hover:bg-sidebar rounded text-text-muted hover:text-primary opacity-0 group-hover:opacity-100 transition-opacity",title:"Copy model ID",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:l===s?"check":"content_copy"})})]},e.id)})})]});return(0,i.jsx)(n.aF,{isOpen:!0,onClose:a,title:`${e.provider.name} — Models`,children:(0,i.jsx)("div",{className:"max-h-[60vh] overflow-y-auto",children:0===d.length?(0,i.jsx)("p",{className:"text-sm text-text-muted py-4 text-center",children:"No models available for this provider."}):(0,i.jsxs)(i.Fragment,{children:[p("Chat","chat",c),p("Embedding","data_array",m),p("Image","image",x)]})})})}function g({icon:e,iconColor:s,iconBg:t,title:l,path:a,description:n,models:o,expanded:c,onToggle:m,copy:x,copied:p,baseUrl:u}){let g=(0,r.useMemo)(()=>{let e={};for(let s of o){let t=s.owned_by||"unknown";e[t]||(e[t]=[]),e[t].push(s)}return Object.entries(e).sort((e,s)=>s[1].length-e[1].length)},[o]),h=e=>d.Q2[e]||(0,d.zt)(e),b=`endpoint_${a}`;return(0,i.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,i.jsxs)("button",{onClick:m,className:"w-full flex items-center gap-3 p-4 hover:bg-surface/50 transition-colors text-left",children:[(0,i.jsx)("div",{className:`flex items-center justify-center size-10 rounded-lg ${t} shrink-0`,children:(0,i.jsx)("span",{className:`material-symbols-outlined text-xl ${s}`,children:e})}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"font-semibold text-sm",children:l}),(0,i.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-surface text-text-muted font-medium",children:[o.length," ",1===o.length?"model":"models"]})]}),(0,i.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:n})]}),(0,i.jsx)("span",{className:`material-symbols-outlined text-text-muted text-lg transition-transform ${c?"rotate-180":""}`,children:"expand_more"})]}),c&&(0,i.jsxs)("div",{className:"border-t border-border px-4 pb-4",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 mt-3 mb-3",children:[(0,i.jsxs)("code",{className:"flex-1 text-xs font-mono text-text-muted bg-surface/80 px-3 py-1.5 rounded-lg truncate",children:[u.replace(/\/v1$/,""),a]}),(0,i.jsx)("button",{onClick:()=>x(`${u.replace(/\/v1$/,"")}${a}`,b),className:"p-1.5 hover:bg-surface rounded-lg text-text-muted hover:text-primary transition-colors shrink-0",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:p===b?"check":"content_copy"})})]}),(0,i.jsx)("div",{className:"flex flex-col gap-2",children:g.map(([e,s])=>(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,i.jsx)("div",{className:"size-2.5 rounded-full shrink-0",style:{backgroundColor:h(e)?.color||"#888"}}),(0,i.jsx)("span",{className:"text-xs font-semibold text-text-main",children:h(e)?.name||e}),(0,i.jsxs)("span",{className:"text-xs text-text-muted",children:["(",s.length,")"]})]}),(0,i.jsx)("div",{className:"ml-5 flex flex-wrap gap-1.5",children:s.map(e=>(0,i.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-md bg-surface/80 text-text-muted font-mono",title:e.id,children:e.root||e.id.split("/").pop()},e.id))})]},e))})]})]})}p.propTypes={machineId:a().string.isRequired},u.propTypes={provider:a().object.isRequired,models:a().array.isRequired,copy:a().func.isRequired,copied:a().string,onClose:a().func.isRequired},g.propTypes={icon:a().string.isRequired,iconColor:a().string.isRequired,iconBg:a().string.isRequired,title:a().string.isRequired,path:a().string.isRequired,description:a().string.isRequired,models:a().array.isRequired,expanded:a().bool.isRequired,onToggle:a().func.isRequired,copy:a().func.isRequired,copied:a().string,baseUrl:a().string.isRequired}}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=10373)),_N_E=e.O()}]);