omniroute 1.4.5 → 1.4.9

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 (659) hide show
  1. package/README.md +90 -8
  2. package/README.pt-BR.md +1 -0
  3. package/app/.next/BUILD_ID +1 -1
  4. package/app/.next/app-path-routes-manifest.json +26 -26
  5. package/app/.next/build-manifest.json +2 -2
  6. package/app/.next/prerender-manifest.json +3 -676
  7. package/app/.next/required-server-files.json +4 -1
  8. package/app/.next/server/app/(dashboard)/dashboard/analytics/page.js +2 -2
  9. package/app/.next/server/app/(dashboard)/dashboard/analytics/page.js.nft.json +1 -1
  10. package/app/.next/server/app/(dashboard)/dashboard/analytics/page_client-reference-manifest.js +1 -1
  11. package/app/.next/server/app/(dashboard)/dashboard/api-manager/page.js +1 -1
  12. package/app/.next/server/app/(dashboard)/dashboard/api-manager/page.js.nft.json +1 -1
  13. package/app/.next/server/app/(dashboard)/dashboard/api-manager/page_client-reference-manifest.js +1 -1
  14. package/app/.next/server/app/(dashboard)/dashboard/audit-log/page.js +2 -2
  15. package/app/.next/server/app/(dashboard)/dashboard/audit-log/page.js.nft.json +1 -1
  16. package/app/.next/server/app/(dashboard)/dashboard/audit-log/page_client-reference-manifest.js +1 -1
  17. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +4 -4
  18. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  19. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  20. package/app/.next/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  21. package/app/.next/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  22. package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  23. package/app/.next/server/app/(dashboard)/dashboard/costs/page.js +2 -2
  24. package/app/.next/server/app/(dashboard)/dashboard/costs/page.js.nft.json +1 -1
  25. package/app/.next/server/app/(dashboard)/dashboard/costs/page_client-reference-manifest.js +1 -1
  26. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js +2 -2
  27. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  28. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  29. package/app/.next/server/app/(dashboard)/dashboard/health/page.js +2 -2
  30. package/app/.next/server/app/(dashboard)/dashboard/health/page.js.nft.json +1 -1
  31. package/app/.next/server/app/(dashboard)/dashboard/health/page_client-reference-manifest.js +1 -1
  32. package/app/.next/server/app/(dashboard)/dashboard/limits/page.js +2 -2
  33. package/app/.next/server/app/(dashboard)/dashboard/limits/page.js.nft.json +1 -1
  34. package/app/.next/server/app/(dashboard)/dashboard/limits/page_client-reference-manifest.js +1 -1
  35. package/app/.next/server/app/(dashboard)/dashboard/logs/page.js +1 -1
  36. package/app/.next/server/app/(dashboard)/dashboard/logs/page.js.nft.json +1 -1
  37. package/app/.next/server/app/(dashboard)/dashboard/logs/page_client-reference-manifest.js +1 -1
  38. package/app/.next/server/app/(dashboard)/dashboard/onboarding/page.js +2 -2
  39. package/app/.next/server/app/(dashboard)/dashboard/onboarding/page.js.nft.json +1 -1
  40. package/app/.next/server/app/(dashboard)/dashboard/onboarding/page_client-reference-manifest.js +1 -1
  41. package/app/.next/server/app/(dashboard)/dashboard/page.js +2 -2
  42. package/app/.next/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  43. package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  44. package/app/.next/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  45. package/app/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  46. package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  47. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
  48. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  49. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  50. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  51. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  52. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  53. package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  54. package/app/.next/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  55. package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  56. package/app/.next/server/app/(dashboard)/dashboard/settings/page.js +2 -2
  57. package/app/.next/server/app/(dashboard)/dashboard/settings/page.js.nft.json +1 -1
  58. package/app/.next/server/app/(dashboard)/dashboard/settings/page_client-reference-manifest.js +1 -1
  59. package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page.js +2 -2
  60. package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page.js.nft.json +1 -1
  61. package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  62. package/app/.next/server/app/(dashboard)/dashboard/translator/page.js +3 -3
  63. package/app/.next/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  64. package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  65. package/app/.next/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  66. package/app/.next/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  67. package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  68. package/app/.next/server/app/_global-error/page.js +1 -1
  69. package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  70. package/app/.next/server/app/_global-error.html +2 -2
  71. package/app/.next/server/app/_global-error.rsc +1 -1
  72. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  73. package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  74. package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  75. package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  76. package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  77. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  78. package/app/.next/server/app/_not-found/page.js +1 -1
  79. package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
  80. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  81. package/app/.next/server/app/api/auth/login/route.js +1 -1
  82. package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  83. package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  84. package/app/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  85. package/app/.next/server/app/api/cache/route_client-reference-manifest.js +1 -1
  86. package/app/.next/server/app/api/cache/stats/route_client-reference-manifest.js +1 -1
  87. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  88. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route_client-reference-manifest.js +1 -1
  89. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +2 -2
  90. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route_client-reference-manifest.js +1 -1
  91. package/app/.next/server/app/api/cli-tools/backups/route.js +2 -2
  92. package/app/.next/server/app/api/cli-tools/backups/route_client-reference-manifest.js +1 -1
  93. package/app/.next/server/app/api/cli-tools/claude-settings/route.js +1 -1
  94. package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
  95. package/app/.next/server/app/api/cli-tools/cline-settings/route.js +2 -2
  96. package/app/.next/server/app/api/cli-tools/cline-settings/route_client-reference-manifest.js +1 -1
  97. package/app/.next/server/app/api/cli-tools/codex-profiles/route.js +1 -1
  98. package/app/.next/server/app/api/cli-tools/codex-profiles/route_client-reference-manifest.js +1 -1
  99. package/app/.next/server/app/api/cli-tools/codex-settings/route.js +1 -1
  100. package/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
  101. package/app/.next/server/app/api/cli-tools/droid-settings/route.js +2 -2
  102. package/app/.next/server/app/api/cli-tools/droid-settings/route_client-reference-manifest.js +1 -1
  103. package/app/.next/server/app/api/cli-tools/guide-settings/[toolId]/route_client-reference-manifest.js +1 -1
  104. package/app/.next/server/app/api/cli-tools/kilo-settings/route.js +1 -1
  105. package/app/.next/server/app/api/cli-tools/kilo-settings/route_client-reference-manifest.js +1 -1
  106. package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  107. package/app/.next/server/app/api/cli-tools/openclaw-settings/route_client-reference-manifest.js +1 -1
  108. package/app/.next/server/app/api/cli-tools/runtime/[toolId]/route.js +2 -2
  109. package/app/.next/server/app/api/cli-tools/runtime/[toolId]/route_client-reference-manifest.js +1 -1
  110. package/app/.next/server/app/api/cli-tools/status/route.js +2 -2
  111. package/app/.next/server/app/api/cli-tools/status/route_client-reference-manifest.js +1 -1
  112. package/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
  113. package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
  114. package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
  115. package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
  116. package/app/.next/server/app/api/combos/[id]/route.js +1 -1
  117. package/app/.next/server/app/api/combos/[id]/route.js.nft.json +1 -1
  118. package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
  119. package/app/.next/server/app/api/combos/metrics/route_client-reference-manifest.js +1 -1
  120. package/app/.next/server/app/api/combos/route.js +1 -1
  121. package/app/.next/server/app/api/combos/route.js.nft.json +1 -1
  122. package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
  123. package/app/.next/server/app/api/combos/test/route_client-reference-manifest.js +1 -1
  124. package/app/.next/server/app/api/compliance/audit-log/route_client-reference-manifest.js +1 -1
  125. package/app/.next/server/app/api/db-backups/export/route_client-reference-manifest.js +1 -1
  126. package/app/.next/server/app/api/db-backups/exportAll/route_client-reference-manifest.js +1 -1
  127. package/app/.next/server/app/api/db-backups/import/route.js +1 -1
  128. package/app/.next/server/app/api/db-backups/import/route_client-reference-manifest.js +1 -1
  129. package/app/.next/server/app/api/db-backups/route_client-reference-manifest.js +1 -1
  130. package/app/.next/server/app/api/evals/[suiteId]/route_client-reference-manifest.js +1 -1
  131. package/app/.next/server/app/api/evals/route_client-reference-manifest.js +1 -1
  132. package/app/.next/server/app/api/fallback/chains/route_client-reference-manifest.js +1 -1
  133. package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  134. package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
  135. package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
  136. package/app/.next/server/app/api/logs/console/route_client-reference-manifest.js +1 -1
  137. package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
  138. package/app/.next/server/app/api/models/availability/route_client-reference-manifest.js +1 -1
  139. package/app/.next/server/app/api/models/catalog/route_client-reference-manifest.js +1 -1
  140. package/app/.next/server/app/api/models/route.js +1 -1
  141. package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
  142. package/app/.next/server/app/api/monitoring/health/route.js +1 -1
  143. package/app/.next/server/app/api/monitoring/health/route_client-reference-manifest.js +1 -1
  144. package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
  145. package/app/.next/server/app/api/oauth/cursor/auto-import/route_client-reference-manifest.js +1 -1
  146. package/app/.next/server/app/api/oauth/cursor/import/route_client-reference-manifest.js +1 -1
  147. package/app/.next/server/app/api/oauth/kiro/auto-import/route_client-reference-manifest.js +1 -1
  148. package/app/.next/server/app/api/oauth/kiro/import/route_client-reference-manifest.js +1 -1
  149. package/app/.next/server/app/api/oauth/kiro/social-authorize/route_client-reference-manifest.js +1 -1
  150. package/app/.next/server/app/api/oauth/kiro/social-exchange/route_client-reference-manifest.js +1 -1
  151. package/app/.next/server/app/api/policies/route_client-reference-manifest.js +1 -1
  152. package/app/.next/server/app/api/pricing/defaults/route.js +1 -1
  153. package/app/.next/server/app/api/pricing/defaults/route_client-reference-manifest.js +1 -1
  154. package/app/.next/server/app/api/pricing/models/route_client-reference-manifest.js +1 -1
  155. package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
  156. package/app/.next/server/app/api/provider-metrics/route_client-reference-manifest.js +1 -1
  157. package/app/.next/server/app/api/provider-models/route_client-reference-manifest.js +1 -1
  158. package/app/.next/server/app/api/provider-nodes/[id]/route_client-reference-manifest.js +1 -1
  159. package/app/.next/server/app/api/provider-nodes/route_client-reference-manifest.js +1 -1
  160. package/app/.next/server/app/api/provider-nodes/validate/route_client-reference-manifest.js +1 -1
  161. package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
  162. package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
  163. package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
  164. package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
  165. package/app/.next/server/app/api/providers/route.js +1 -1
  166. package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
  167. package/app/.next/server/app/api/providers/test-batch/route_client-reference-manifest.js +1 -1
  168. package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
  169. package/app/.next/server/app/api/rate-limit/route_client-reference-manifest.js +1 -1
  170. package/app/.next/server/app/api/rate-limits/route_client-reference-manifest.js +1 -1
  171. package/app/.next/server/app/api/resilience/reset/route_client-reference-manifest.js +1 -1
  172. package/app/.next/server/app/api/resilience/route_client-reference-manifest.js +1 -1
  173. package/app/.next/server/app/api/restart/route_client-reference-manifest.js +1 -1
  174. package/app/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
  175. package/app/.next/server/app/api/settings/combo-defaults/route_client-reference-manifest.js +1 -1
  176. package/app/.next/server/app/api/settings/ip-filter/route_client-reference-manifest.js +1 -1
  177. package/app/.next/server/app/api/settings/proxy/route_client-reference-manifest.js +1 -1
  178. package/app/.next/server/app/api/settings/proxy/test/route_client-reference-manifest.js +1 -1
  179. package/app/.next/server/app/api/settings/require-login/route_client-reference-manifest.js +1 -1
  180. package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  181. package/app/.next/server/app/api/settings/system-prompt/route_client-reference-manifest.js +1 -1
  182. package/app/.next/server/app/api/settings/thinking-budget/route_client-reference-manifest.js +1 -1
  183. package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  184. package/app/.next/server/app/api/storage/health/route_client-reference-manifest.js +1 -1
  185. package/app/.next/server/app/api/sync/cloud/route_client-reference-manifest.js +1 -1
  186. package/app/.next/server/app/api/sync/initialize/route_client-reference-manifest.js +1 -1
  187. package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
  188. package/app/.next/server/app/api/telemetry/summary/route_client-reference-manifest.js +1 -1
  189. package/app/.next/server/app/api/token-health/route_client-reference-manifest.js +1 -1
  190. package/app/.next/server/app/api/translator/detect/route_client-reference-manifest.js +1 -1
  191. package/app/.next/server/app/api/translator/history/route_client-reference-manifest.js +1 -1
  192. package/app/.next/server/app/api/translator/load/route_client-reference-manifest.js +1 -1
  193. package/app/.next/server/app/api/translator/save/route_client-reference-manifest.js +1 -1
  194. package/app/.next/server/app/api/translator/send/route_client-reference-manifest.js +1 -1
  195. package/app/.next/server/app/api/translator/translate/route_client-reference-manifest.js +1 -1
  196. package/app/.next/server/app/api/usage/[connectionId]/route.js +1 -1
  197. package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
  198. package/app/.next/server/app/api/usage/analytics/route_client-reference-manifest.js +1 -1
  199. package/app/.next/server/app/api/usage/budget/route_client-reference-manifest.js +1 -1
  200. package/app/.next/server/app/api/usage/call-logs/[id]/route_client-reference-manifest.js +1 -1
  201. package/app/.next/server/app/api/usage/call-logs/route_client-reference-manifest.js +1 -1
  202. package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
  203. package/app/.next/server/app/api/usage/logs/route_client-reference-manifest.js +1 -1
  204. package/app/.next/server/app/api/usage/proxy-logs/route_client-reference-manifest.js +1 -1
  205. package/app/.next/server/app/api/usage/request-logs/route_client-reference-manifest.js +1 -1
  206. package/app/.next/server/app/api/v1/api/chat/route.js +1 -1
  207. package/app/.next/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  208. package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
  209. package/app/.next/server/app/api/v1/audio/speech/route.js +1 -1
  210. package/app/.next/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  211. package/app/.next/server/app/api/v1/audio/speech/route_client-reference-manifest.js +1 -1
  212. package/app/.next/server/app/api/v1/audio/transcriptions/route.js +1 -1
  213. package/app/.next/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  214. package/app/.next/server/app/api/v1/audio/transcriptions/route_client-reference-manifest.js +1 -1
  215. package/app/.next/server/app/api/v1/chat/completions/route.js +1 -1
  216. package/app/.next/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  217. package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
  218. package/app/.next/server/app/api/v1/embeddings/route.js +1 -1
  219. package/app/.next/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  220. package/app/.next/server/app/api/v1/embeddings/route_client-reference-manifest.js +1 -1
  221. package/app/.next/server/app/api/v1/images/generations/route.js +1 -1
  222. package/app/.next/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  223. package/app/.next/server/app/api/v1/images/generations/route_client-reference-manifest.js +1 -1
  224. package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
  225. package/app/.next/server/app/api/v1/messages/route.js +1 -1
  226. package/app/.next/server/app/api/v1/messages/route.js.nft.json +1 -1
  227. package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
  228. package/app/.next/server/app/api/v1/models/route.js +1 -1
  229. package/app/.next/server/app/api/v1/models/route_client-reference-manifest.js +1 -1
  230. package/app/.next/server/app/api/v1/moderations/route.js +1 -1
  231. package/app/.next/server/app/api/v1/moderations/route.js.nft.json +1 -1
  232. package/app/.next/server/app/api/v1/moderations/route_client-reference-manifest.js +1 -1
  233. package/app/.next/server/app/api/v1/providers/[provider]/chat/completions/route.js +1 -1
  234. package/app/.next/server/app/api/v1/providers/[provider]/chat/completions/route.js.nft.json +1 -1
  235. package/app/.next/server/app/api/v1/providers/[provider]/chat/completions/route_client-reference-manifest.js +1 -1
  236. package/app/.next/server/app/api/v1/providers/[provider]/embeddings/route.js +1 -1
  237. package/app/.next/server/app/api/v1/providers/[provider]/embeddings/route.js.nft.json +1 -1
  238. package/app/.next/server/app/api/v1/providers/[provider]/embeddings/route_client-reference-manifest.js +1 -1
  239. package/app/.next/server/app/api/v1/providers/[provider]/images/generations/route.js +1 -1
  240. package/app/.next/server/app/api/v1/providers/[provider]/images/generations/route.js.nft.json +1 -1
  241. package/app/.next/server/app/api/v1/providers/[provider]/images/generations/route_client-reference-manifest.js +1 -1
  242. package/app/.next/server/app/api/v1/rerank/route.js +1 -1
  243. package/app/.next/server/app/api/v1/rerank/route.js.nft.json +1 -1
  244. package/app/.next/server/app/api/v1/rerank/route_client-reference-manifest.js +1 -1
  245. package/app/.next/server/app/api/v1/responses/route.js +1 -1
  246. package/app/.next/server/app/api/v1/responses/route.js.nft.json +1 -1
  247. package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
  248. package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
  249. package/app/.next/server/app/api/v1beta/models/[...path]/route.js +1 -1
  250. package/app/.next/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  251. package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
  252. package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
  253. package/app/.next/server/app/callback/page.js +2 -2
  254. package/app/.next/server/app/callback/page.js.nft.json +1 -1
  255. package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  256. package/app/.next/server/app/docs/page.js +1 -1
  257. package/app/.next/server/app/docs/page.js.nft.json +1 -1
  258. package/app/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  259. package/app/.next/server/app/forbidden/page.js +2 -2
  260. package/app/.next/server/app/forbidden/page.js.nft.json +1 -1
  261. package/app/.next/server/app/forbidden/page_client-reference-manifest.js +1 -1
  262. package/app/.next/server/app/forgot-password/page.js +2 -2
  263. package/app/.next/server/app/forgot-password/page.js.nft.json +1 -1
  264. package/app/.next/server/app/forgot-password/page_client-reference-manifest.js +1 -1
  265. package/app/.next/server/app/landing/page.js +1 -1
  266. package/app/.next/server/app/landing/page.js.nft.json +1 -1
  267. package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  268. package/app/.next/server/app/login/page.js +2 -2
  269. package/app/.next/server/app/login/page.js.nft.json +1 -1
  270. package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
  271. package/app/.next/server/app/page.js +1 -1
  272. package/app/.next/server/app/page.js.nft.json +1 -1
  273. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  274. package/app/.next/server/app/privacy/page.js +1 -1
  275. package/app/.next/server/app/privacy/page.js.nft.json +1 -1
  276. package/app/.next/server/app/privacy/page_client-reference-manifest.js +1 -1
  277. package/app/.next/server/app/terms/page.js +1 -1
  278. package/app/.next/server/app/terms/page.js.nft.json +1 -1
  279. package/app/.next/server/app/terms/page_client-reference-manifest.js +1 -1
  280. package/app/.next/server/app-paths-manifest.json +26 -26
  281. package/app/.next/server/chunks/1259.js +2 -0
  282. package/app/.next/server/chunks/1960.js +1 -0
  283. package/app/.next/server/chunks/1990.js +1 -0
  284. package/app/.next/server/chunks/2767.js +2 -2
  285. package/app/.next/server/chunks/2901.js +2 -2
  286. package/app/.next/server/chunks/3447.js +1 -1
  287. package/app/.next/server/chunks/3498.js +39 -0
  288. package/app/.next/server/chunks/3596.js +1 -1
  289. package/app/.next/server/chunks/3699.js +1 -1
  290. package/app/.next/server/chunks/{1079.js → 3875.js} +3 -1
  291. package/app/.next/server/chunks/4509.js +1 -0
  292. package/app/.next/server/chunks/5248.js +1 -1
  293. package/app/.next/server/chunks/5573.js +1 -1
  294. package/app/.next/server/chunks/7544.js +1 -1
  295. package/app/.next/server/chunks/7669.js +1 -3
  296. package/app/.next/server/chunks/8020.js +1 -1
  297. package/app/.next/server/chunks/9340.js +1 -0
  298. package/app/.next/server/chunks/9342.js +1 -1
  299. package/app/.next/server/chunks/9824.js +3 -3
  300. package/app/.next/server/instrumentation.js +1 -1
  301. package/app/.next/server/middleware.js +1 -1
  302. package/app/.next/server/pages/500.html +2 -2
  303. package/app/.next/server/pages-manifest.json +0 -1
  304. package/app/.next/server/server-reference-manifest.js +1 -1
  305. package/app/.next/server/server-reference-manifest.json +1 -1
  306. package/app/.next/static/chunks/3418-66271bd83bd2e66a.js +3 -0
  307. package/app/.next/static/chunks/5846-756d72eb0e01a60c.js +2 -0
  308. package/app/.next/static/chunks/{1149-fefe7f95f0e9842f.js → 6458-085536744d592424.js} +1 -1
  309. package/app/.next/static/chunks/993-961f6e199b93539a.js +21 -0
  310. package/app/.next/static/chunks/app/(dashboard)/dashboard/analytics/page-3fcbbdb2221f0b0c.js +1 -0
  311. package/app/.next/static/chunks/app/(dashboard)/dashboard/api-manager/page-d806e4f28c15636a.js +1 -0
  312. package/app/.next/static/chunks/app/(dashboard)/dashboard/audit-log/page-27bc511cf3930e1e.js +1 -0
  313. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-918d5f38d5cdbbc2.js → page-012be9f38cda4c4a.js} +4 -4
  314. package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-ede2315b6918315e.js +1 -0
  315. package/app/.next/static/chunks/app/(dashboard)/dashboard/costs/page-f256689b8410bd74.js +1 -0
  316. package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-6e4f3ca7ac9778be.js +1 -0
  317. package/app/.next/static/chunks/app/(dashboard)/dashboard/health/page-8725f1a181e558a3.js +1 -0
  318. package/app/.next/static/chunks/app/(dashboard)/dashboard/limits/page-a5a48afa8c125ada.js +1 -0
  319. package/app/.next/static/chunks/app/(dashboard)/dashboard/logs/page-6ee69634597daee0.js +1 -0
  320. package/app/.next/static/chunks/app/(dashboard)/dashboard/onboarding/page-931fa0c45dca76c9.js +1 -0
  321. package/app/.next/static/chunks/app/(dashboard)/dashboard/page-04bc41f9e9de17ef.js +1 -0
  322. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-62c6fceede3a5549.js +1 -0
  323. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/new/page-2dc2a865e90681dd.js +1 -0
  324. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-ac85ce5066cd9044.js +1 -0
  325. package/app/.next/static/chunks/app/(dashboard)/dashboard/settings/page-88cac9e6f2fbe335.js +1 -0
  326. package/app/.next/static/chunks/app/(dashboard)/dashboard/settings/pricing/page-77158451270c1852.js +1 -0
  327. package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-75c8b38a55e13042.js +4 -0
  328. package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/{page-51a813eac9d71eed.js → page-f0809c7842e4f5b4.js} +1 -1
  329. package/app/.next/static/chunks/app/(dashboard)/layout-b23c2c5427e04dcf.js +1 -0
  330. package/app/.next/static/chunks/app/callback/page-e439cd5a287000d8.js +1 -0
  331. package/app/.next/static/chunks/app/forbidden/page-4a39fedc08aaaf55.js +1 -0
  332. package/app/.next/static/chunks/app/forgot-password/page-057ea91c6f140e0b.js +1 -0
  333. package/app/.next/static/chunks/app/layout-108592eafb959363.js +1 -0
  334. package/app/.next/static/chunks/app/login/page-c1d7bfab91a7877c.js +1 -0
  335. package/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
  336. package/app/package.json +2 -1
  337. package/app/server.js +1 -1
  338. package/package.json +2 -1
  339. package/app/.next/server/app/_not-found.html +0 -1
  340. package/app/.next/server/app/_not-found.meta +0 -16
  341. package/app/.next/server/app/_not-found.rsc +0 -23
  342. package/app/.next/server/app/_not-found.segments/_full.segment.rsc +0 -23
  343. package/app/.next/server/app/_not-found.segments/_head.segment.rsc +0 -6
  344. package/app/.next/server/app/_not-found.segments/_index.segment.rsc +0 -10
  345. package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +0 -9
  346. package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +0 -4
  347. package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +0 -5
  348. package/app/.next/server/app/callback.html +0 -1
  349. package/app/.next/server/app/callback.meta +0 -15
  350. package/app/.next/server/app/callback.rsc +0 -24
  351. package/app/.next/server/app/callback.segments/_full.segment.rsc +0 -24
  352. package/app/.next/server/app/callback.segments/_head.segment.rsc +0 -6
  353. package/app/.next/server/app/callback.segments/_index.segment.rsc +0 -10
  354. package/app/.next/server/app/callback.segments/_tree.segment.rsc +0 -5
  355. package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +0 -9
  356. package/app/.next/server/app/callback.segments/callback.segment.rsc +0 -4
  357. package/app/.next/server/app/dashboard/analytics.html +0 -2
  358. package/app/.next/server/app/dashboard/analytics.meta +0 -17
  359. package/app/.next/server/app/dashboard/analytics.rsc +0 -26
  360. package/app/.next/server/app/dashboard/analytics.segments/!KGRhc2hib2FyZCk/dashboard/analytics/__PAGE__.segment.rsc +0 -9
  361. package/app/.next/server/app/dashboard/analytics.segments/!KGRhc2hib2FyZCk/dashboard/analytics.segment.rsc +0 -5
  362. package/app/.next/server/app/dashboard/analytics.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -4
  363. package/app/.next/server/app/dashboard/analytics.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  364. package/app/.next/server/app/dashboard/analytics.segments/_full.segment.rsc +0 -26
  365. package/app/.next/server/app/dashboard/analytics.segments/_head.segment.rsc +0 -6
  366. package/app/.next/server/app/dashboard/analytics.segments/_index.segment.rsc +0 -10
  367. package/app/.next/server/app/dashboard/analytics.segments/_tree.segment.rsc +0 -5
  368. package/app/.next/server/app/dashboard/api-manager.html +0 -1
  369. package/app/.next/server/app/dashboard/api-manager.meta +0 -17
  370. package/app/.next/server/app/dashboard/api-manager.rsc +0 -22
  371. package/app/.next/server/app/dashboard/api-manager.segments/!KGRhc2hib2FyZCk/dashboard/api-manager/__PAGE__.segment.rsc +0 -6
  372. package/app/.next/server/app/dashboard/api-manager.segments/!KGRhc2hib2FyZCk/dashboard/api-manager.segment.rsc +0 -4
  373. package/app/.next/server/app/dashboard/api-manager.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -4
  374. package/app/.next/server/app/dashboard/api-manager.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  375. package/app/.next/server/app/dashboard/api-manager.segments/_full.segment.rsc +0 -22
  376. package/app/.next/server/app/dashboard/api-manager.segments/_head.segment.rsc +0 -6
  377. package/app/.next/server/app/dashboard/api-manager.segments/_index.segment.rsc +0 -10
  378. package/app/.next/server/app/dashboard/api-manager.segments/_tree.segment.rsc +0 -5
  379. package/app/.next/server/app/dashboard/audit-log.html +0 -1
  380. package/app/.next/server/app/dashboard/audit-log.meta +0 -17
  381. package/app/.next/server/app/dashboard/audit-log.rsc +0 -25
  382. package/app/.next/server/app/dashboard/audit-log.segments/!KGRhc2hib2FyZCk/dashboard/audit-log/__PAGE__.segment.rsc +0 -9
  383. package/app/.next/server/app/dashboard/audit-log.segments/!KGRhc2hib2FyZCk/dashboard/audit-log.segment.rsc +0 -4
  384. package/app/.next/server/app/dashboard/audit-log.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -4
  385. package/app/.next/server/app/dashboard/audit-log.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  386. package/app/.next/server/app/dashboard/audit-log.segments/_full.segment.rsc +0 -25
  387. package/app/.next/server/app/dashboard/audit-log.segments/_head.segment.rsc +0 -6
  388. package/app/.next/server/app/dashboard/audit-log.segments/_index.segment.rsc +0 -10
  389. package/app/.next/server/app/dashboard/audit-log.segments/_tree.segment.rsc +0 -5
  390. package/app/.next/server/app/dashboard/cli-tools.html +0 -1
  391. package/app/.next/server/app/dashboard/cli-tools.meta +0 -17
  392. package/app/.next/server/app/dashboard/cli-tools.rsc +0 -23
  393. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +0 -6
  394. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +0 -4
  395. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -4
  396. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  397. package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +0 -23
  398. package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +0 -6
  399. package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +0 -10
  400. package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +0 -5
  401. package/app/.next/server/app/dashboard/combos.html +0 -1
  402. package/app/.next/server/app/dashboard/combos.meta +0 -17
  403. package/app/.next/server/app/dashboard/combos.rsc +0 -25
  404. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +0 -9
  405. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +0 -4
  406. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -4
  407. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  408. package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +0 -25
  409. package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +0 -6
  410. package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +0 -10
  411. package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +0 -5
  412. package/app/.next/server/app/dashboard/costs.html +0 -1
  413. package/app/.next/server/app/dashboard/costs.meta +0 -17
  414. package/app/.next/server/app/dashboard/costs.rsc +0 -25
  415. package/app/.next/server/app/dashboard/costs.segments/!KGRhc2hib2FyZCk/dashboard/costs/__PAGE__.segment.rsc +0 -9
  416. package/app/.next/server/app/dashboard/costs.segments/!KGRhc2hib2FyZCk/dashboard/costs.segment.rsc +0 -4
  417. package/app/.next/server/app/dashboard/costs.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -4
  418. package/app/.next/server/app/dashboard/costs.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  419. package/app/.next/server/app/dashboard/costs.segments/_full.segment.rsc +0 -25
  420. package/app/.next/server/app/dashboard/costs.segments/_head.segment.rsc +0 -6
  421. package/app/.next/server/app/dashboard/costs.segments/_index.segment.rsc +0 -10
  422. package/app/.next/server/app/dashboard/costs.segments/_tree.segment.rsc +0 -5
  423. package/app/.next/server/app/dashboard/endpoint.html +0 -1
  424. package/app/.next/server/app/dashboard/endpoint.meta +0 -17
  425. package/app/.next/server/app/dashboard/endpoint.rsc +0 -23
  426. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +0 -6
  427. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +0 -4
  428. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -4
  429. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  430. package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +0 -23
  431. package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +0 -6
  432. package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +0 -10
  433. package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +0 -5
  434. package/app/.next/server/app/dashboard/health.html +0 -1
  435. package/app/.next/server/app/dashboard/health.meta +0 -17
  436. package/app/.next/server/app/dashboard/health.rsc +0 -25
  437. package/app/.next/server/app/dashboard/health.segments/!KGRhc2hib2FyZCk/dashboard/health/__PAGE__.segment.rsc +0 -9
  438. package/app/.next/server/app/dashboard/health.segments/!KGRhc2hib2FyZCk/dashboard/health.segment.rsc +0 -4
  439. package/app/.next/server/app/dashboard/health.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -4
  440. package/app/.next/server/app/dashboard/health.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  441. package/app/.next/server/app/dashboard/health.segments/_full.segment.rsc +0 -25
  442. package/app/.next/server/app/dashboard/health.segments/_head.segment.rsc +0 -6
  443. package/app/.next/server/app/dashboard/health.segments/_index.segment.rsc +0 -10
  444. package/app/.next/server/app/dashboard/health.segments/_tree.segment.rsc +0 -5
  445. package/app/.next/server/app/dashboard/limits.html +0 -2
  446. package/app/.next/server/app/dashboard/limits.meta +0 -17
  447. package/app/.next/server/app/dashboard/limits.rsc +0 -25
  448. package/app/.next/server/app/dashboard/limits.segments/!KGRhc2hib2FyZCk/dashboard/limits/__PAGE__.segment.rsc +0 -9
  449. package/app/.next/server/app/dashboard/limits.segments/!KGRhc2hib2FyZCk/dashboard/limits.segment.rsc +0 -4
  450. package/app/.next/server/app/dashboard/limits.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -4
  451. package/app/.next/server/app/dashboard/limits.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  452. package/app/.next/server/app/dashboard/limits.segments/_full.segment.rsc +0 -25
  453. package/app/.next/server/app/dashboard/limits.segments/_head.segment.rsc +0 -6
  454. package/app/.next/server/app/dashboard/limits.segments/_index.segment.rsc +0 -10
  455. package/app/.next/server/app/dashboard/limits.segments/_tree.segment.rsc +0 -5
  456. package/app/.next/server/app/dashboard/logs.html +0 -1
  457. package/app/.next/server/app/dashboard/logs.meta +0 -17
  458. package/app/.next/server/app/dashboard/logs.rsc +0 -25
  459. package/app/.next/server/app/dashboard/logs.segments/!KGRhc2hib2FyZCk/dashboard/logs/__PAGE__.segment.rsc +0 -9
  460. package/app/.next/server/app/dashboard/logs.segments/!KGRhc2hib2FyZCk/dashboard/logs.segment.rsc +0 -4
  461. package/app/.next/server/app/dashboard/logs.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -4
  462. package/app/.next/server/app/dashboard/logs.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  463. package/app/.next/server/app/dashboard/logs.segments/_full.segment.rsc +0 -25
  464. package/app/.next/server/app/dashboard/logs.segments/_head.segment.rsc +0 -6
  465. package/app/.next/server/app/dashboard/logs.segments/_index.segment.rsc +0 -10
  466. package/app/.next/server/app/dashboard/logs.segments/_tree.segment.rsc +0 -5
  467. package/app/.next/server/app/dashboard/onboarding.html +0 -1
  468. package/app/.next/server/app/dashboard/onboarding.meta +0 -17
  469. package/app/.next/server/app/dashboard/onboarding.rsc +0 -25
  470. package/app/.next/server/app/dashboard/onboarding.segments/!KGRhc2hib2FyZCk/dashboard/onboarding/__PAGE__.segment.rsc +0 -9
  471. package/app/.next/server/app/dashboard/onboarding.segments/!KGRhc2hib2FyZCk/dashboard/onboarding.segment.rsc +0 -4
  472. package/app/.next/server/app/dashboard/onboarding.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -4
  473. package/app/.next/server/app/dashboard/onboarding.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  474. package/app/.next/server/app/dashboard/onboarding.segments/_full.segment.rsc +0 -25
  475. package/app/.next/server/app/dashboard/onboarding.segments/_head.segment.rsc +0 -6
  476. package/app/.next/server/app/dashboard/onboarding.segments/_index.segment.rsc +0 -10
  477. package/app/.next/server/app/dashboard/onboarding.segments/_tree.segment.rsc +0 -5
  478. package/app/.next/server/app/dashboard/profile.html +0 -1
  479. package/app/.next/server/app/dashboard/profile.meta +0 -19
  480. package/app/.next/server/app/dashboard/profile.rsc +0 -22
  481. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +0 -6
  482. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +0 -4
  483. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -4
  484. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  485. package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +0 -22
  486. package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +0 -6
  487. package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +0 -10
  488. package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +0 -5
  489. package/app/.next/server/app/dashboard/providers/new.html +0 -2
  490. package/app/.next/server/app/dashboard/providers/new.meta +0 -18
  491. package/app/.next/server/app/dashboard/providers/new.rsc +0 -27
  492. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +0 -9
  493. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +0 -4
  494. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +0 -6
  495. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -4
  496. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  497. package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +0 -27
  498. package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +0 -6
  499. package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +0 -10
  500. package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +0 -5
  501. package/app/.next/server/app/dashboard/providers.html +0 -2
  502. package/app/.next/server/app/dashboard/providers.meta +0 -17
  503. package/app/.next/server/app/dashboard/providers.rsc +0 -27
  504. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +0 -9
  505. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +0 -6
  506. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -4
  507. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  508. package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +0 -27
  509. package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +0 -6
  510. package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +0 -10
  511. package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +0 -5
  512. package/app/.next/server/app/dashboard/settings/pricing.html +0 -2
  513. package/app/.next/server/app/dashboard/settings/pricing.meta +0 -18
  514. package/app/.next/server/app/dashboard/settings/pricing.rsc +0 -27
  515. package/app/.next/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing/__PAGE__.segment.rsc +0 -9
  516. package/app/.next/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing.segment.rsc +0 -4
  517. package/app/.next/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings.segment.rsc +0 -6
  518. package/app/.next/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -4
  519. package/app/.next/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  520. package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +0 -27
  521. package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +0 -6
  522. package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +0 -10
  523. package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +0 -5
  524. package/app/.next/server/app/dashboard/settings.html +0 -1
  525. package/app/.next/server/app/dashboard/settings.meta +0 -17
  526. package/app/.next/server/app/dashboard/settings.rsc +0 -27
  527. package/app/.next/server/app/dashboard/settings.segments/!KGRhc2hib2FyZCk/dashboard/settings/__PAGE__.segment.rsc +0 -9
  528. package/app/.next/server/app/dashboard/settings.segments/!KGRhc2hib2FyZCk/dashboard/settings.segment.rsc +0 -6
  529. package/app/.next/server/app/dashboard/settings.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -4
  530. package/app/.next/server/app/dashboard/settings.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  531. package/app/.next/server/app/dashboard/settings.segments/_full.segment.rsc +0 -27
  532. package/app/.next/server/app/dashboard/settings.segments/_head.segment.rsc +0 -6
  533. package/app/.next/server/app/dashboard/settings.segments/_index.segment.rsc +0 -10
  534. package/app/.next/server/app/dashboard/settings.segments/_tree.segment.rsc +0 -5
  535. package/app/.next/server/app/dashboard/translator.html +0 -19
  536. package/app/.next/server/app/dashboard/translator.meta +0 -17
  537. package/app/.next/server/app/dashboard/translator.rsc +0 -22
  538. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +0 -6
  539. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +0 -4
  540. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -4
  541. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  542. package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +0 -22
  543. package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +0 -6
  544. package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +0 -10
  545. package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +0 -5
  546. package/app/.next/server/app/dashboard/usage.html +0 -1
  547. package/app/.next/server/app/dashboard/usage.meta +0 -17
  548. package/app/.next/server/app/dashboard/usage.rsc +0 -25
  549. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +0 -9
  550. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +0 -4
  551. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -4
  552. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  553. package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +0 -25
  554. package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +0 -6
  555. package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +0 -10
  556. package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +0 -5
  557. package/app/.next/server/app/docs.html +0 -1
  558. package/app/.next/server/app/docs.meta +0 -15
  559. package/app/.next/server/app/docs.rsc +0 -88
  560. package/app/.next/server/app/docs.segments/_full.segment.rsc +0 -88
  561. package/app/.next/server/app/docs.segments/_head.segment.rsc +0 -6
  562. package/app/.next/server/app/docs.segments/_index.segment.rsc +0 -10
  563. package/app/.next/server/app/docs.segments/_tree.segment.rsc +0 -5
  564. package/app/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +0 -67
  565. package/app/.next/server/app/docs.segments/docs.segment.rsc +0 -4
  566. package/app/.next/server/app/forbidden.html +0 -1
  567. package/app/.next/server/app/forbidden.meta +0 -15
  568. package/app/.next/server/app/forbidden.rsc +0 -24
  569. package/app/.next/server/app/forbidden.segments/_full.segment.rsc +0 -24
  570. package/app/.next/server/app/forbidden.segments/_head.segment.rsc +0 -6
  571. package/app/.next/server/app/forbidden.segments/_index.segment.rsc +0 -10
  572. package/app/.next/server/app/forbidden.segments/_tree.segment.rsc +0 -5
  573. package/app/.next/server/app/forbidden.segments/forbidden/__PAGE__.segment.rsc +0 -9
  574. package/app/.next/server/app/forbidden.segments/forbidden.segment.rsc +0 -4
  575. package/app/.next/server/app/forgot-password.html +0 -1
  576. package/app/.next/server/app/forgot-password.meta +0 -15
  577. package/app/.next/server/app/forgot-password.rsc +0 -24
  578. package/app/.next/server/app/forgot-password.segments/_full.segment.rsc +0 -24
  579. package/app/.next/server/app/forgot-password.segments/_head.segment.rsc +0 -6
  580. package/app/.next/server/app/forgot-password.segments/_index.segment.rsc +0 -10
  581. package/app/.next/server/app/forgot-password.segments/_tree.segment.rsc +0 -5
  582. package/app/.next/server/app/forgot-password.segments/forgot-password/__PAGE__.segment.rsc +0 -9
  583. package/app/.next/server/app/forgot-password.segments/forgot-password.segment.rsc +0 -4
  584. package/app/.next/server/app/index.html +0 -1
  585. package/app/.next/server/app/index.meta +0 -16
  586. package/app/.next/server/app/index.rsc +0 -21
  587. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +0 -6
  588. package/app/.next/server/app/index.segments/_full.segment.rsc +0 -21
  589. package/app/.next/server/app/index.segments/_head.segment.rsc +0 -6
  590. package/app/.next/server/app/index.segments/_index.segment.rsc +0 -10
  591. package/app/.next/server/app/index.segments/_tree.segment.rsc +0 -5
  592. package/app/.next/server/app/landing.html +0 -1
  593. package/app/.next/server/app/landing.meta +0 -15
  594. package/app/.next/server/app/landing.rsc +0 -24
  595. package/app/.next/server/app/landing.segments/_full.segment.rsc +0 -24
  596. package/app/.next/server/app/landing.segments/_head.segment.rsc +0 -6
  597. package/app/.next/server/app/landing.segments/_index.segment.rsc +0 -10
  598. package/app/.next/server/app/landing.segments/_tree.segment.rsc +0 -5
  599. package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +0 -9
  600. package/app/.next/server/app/landing.segments/landing.segment.rsc +0 -4
  601. package/app/.next/server/app/login.html +0 -1
  602. package/app/.next/server/app/login.meta +0 -15
  603. package/app/.next/server/app/login.rsc +0 -24
  604. package/app/.next/server/app/login.segments/_full.segment.rsc +0 -24
  605. package/app/.next/server/app/login.segments/_head.segment.rsc +0 -6
  606. package/app/.next/server/app/login.segments/_index.segment.rsc +0 -10
  607. package/app/.next/server/app/login.segments/_tree.segment.rsc +0 -5
  608. package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +0 -9
  609. package/app/.next/server/app/login.segments/login.segment.rsc +0 -4
  610. package/app/.next/server/app/privacy.html +0 -1
  611. package/app/.next/server/app/privacy.meta +0 -15
  612. package/app/.next/server/app/privacy.rsc +0 -28
  613. package/app/.next/server/app/privacy.segments/_full.segment.rsc +0 -28
  614. package/app/.next/server/app/privacy.segments/_head.segment.rsc +0 -6
  615. package/app/.next/server/app/privacy.segments/_index.segment.rsc +0 -10
  616. package/app/.next/server/app/privacy.segments/_tree.segment.rsc +0 -5
  617. package/app/.next/server/app/privacy.segments/privacy/__PAGE__.segment.rsc +0 -11
  618. package/app/.next/server/app/privacy.segments/privacy.segment.rsc +0 -4
  619. package/app/.next/server/app/terms.html +0 -1
  620. package/app/.next/server/app/terms.meta +0 -15
  621. package/app/.next/server/app/terms.rsc +0 -29
  622. package/app/.next/server/app/terms.segments/_full.segment.rsc +0 -29
  623. package/app/.next/server/app/terms.segments/_head.segment.rsc +0 -6
  624. package/app/.next/server/app/terms.segments/_index.segment.rsc +0 -10
  625. package/app/.next/server/app/terms.segments/_tree.segment.rsc +0 -5
  626. package/app/.next/server/app/terms.segments/terms/__PAGE__.segment.rsc +0 -7
  627. package/app/.next/server/app/terms.segments/terms.segment.rsc +0 -4
  628. package/app/.next/server/chunks/2760.js +0 -1
  629. package/app/.next/server/chunks/438.js +0 -1
  630. package/app/.next/server/chunks/9723.js +0 -37
  631. package/app/.next/server/chunks/9979.js +0 -2
  632. package/app/.next/server/pages/404.html +0 -1
  633. package/app/.next/static/chunks/5846-8a4d88e4bc5e07f6.js +0 -2
  634. package/app/.next/static/chunks/993-4cb24412f8681dc9.js +0 -21
  635. package/app/.next/static/chunks/app/(dashboard)/dashboard/analytics/page-f8b57e41a1b6fce6.js +0 -1
  636. package/app/.next/static/chunks/app/(dashboard)/dashboard/api-manager/page-10e24238da560d00.js +0 -1
  637. package/app/.next/static/chunks/app/(dashboard)/dashboard/audit-log/page-c37f849e39b1bf02.js +0 -1
  638. package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-f017a1a13b450ed3.js +0 -1
  639. package/app/.next/static/chunks/app/(dashboard)/dashboard/costs/page-9495b294cfe54d73.js +0 -1
  640. package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-90f0a2f2cfc02a76.js +0 -1
  641. package/app/.next/static/chunks/app/(dashboard)/dashboard/health/page-58ea3e55f475ea7b.js +0 -1
  642. package/app/.next/static/chunks/app/(dashboard)/dashboard/limits/page-2a3cd7fd5ca34713.js +0 -1
  643. package/app/.next/static/chunks/app/(dashboard)/dashboard/logs/page-88e667cb7ae99420.js +0 -1
  644. package/app/.next/static/chunks/app/(dashboard)/dashboard/onboarding/page-19072ecdea202e4e.js +0 -1
  645. package/app/.next/static/chunks/app/(dashboard)/dashboard/page-d2651dc387e7fdfd.js +0 -1
  646. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-56e8174ce9caec1b.js +0 -1
  647. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/new/page-200bed170f9ee2b0.js +0 -1
  648. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-7fec684a49291104.js +0 -1
  649. package/app/.next/static/chunks/app/(dashboard)/dashboard/settings/page-06d076294b449efb.js +0 -1
  650. package/app/.next/static/chunks/app/(dashboard)/dashboard/settings/pricing/page-1b3f14c99d3edf09.js +0 -1
  651. package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-775e1506821cac94.js +0 -4
  652. package/app/.next/static/chunks/app/(dashboard)/layout-cf710bbfb7c3ba11.js +0 -1
  653. package/app/.next/static/chunks/app/callback/page-5c58a06902dd94ed.js +0 -1
  654. package/app/.next/static/chunks/app/forbidden/page-86b6392f80a3ff69.js +0 -1
  655. package/app/.next/static/chunks/app/forgot-password/page-373672767bb0aae4.js +0 -1
  656. package/app/.next/static/chunks/app/layout-3375493e8f9133db.js +0 -1
  657. package/app/.next/static/chunks/app/login/page-ca4dde4376ccd169.js +0 -1
  658. /package/app/.next/static/{5wRmzcux4mm_n3yTB8RLl → oaQaCPrOo77oe3OAEMAe-}/_buildManifest.js +0 -0
  659. /package/app/.next/static/{5wRmzcux4mm_n3yTB8RLl → oaQaCPrOo77oe3OAEMAe-}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3649],{2729:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>m});var s=a(95155),r=a(12115),l=a(40993),i=a(30949),o=a(67671),n=a(50910);let d=/^[a-zA-Z0-9_/.-]+$/;function c(e){return"string"==typeof e?{model:e,weight:0}:{model:e.model,weight:e.weight||0}}function m(){let e=(0,n.c)("combos");(0,n.c)("common");let[t,a]=(0,r.useState)([]),[d,c]=(0,r.useState)(!0),[m,h]=(0,r.useState)(!1),[b,g]=(0,r.useState)(null),[f,y]=(0,r.useState)([]),[v,j]=(0,r.useState)({}),[N,k]=(0,r.useState)(null),[w,C]=(0,r.useState)(null),{copied:S,copy:$}=(0,i.C)(),M=(0,o.i)(),[T,P]=(0,r.useState)(null),[_,O]=(0,r.useState)(null);(0,r.useEffect)(()=>{D(),fetch("/api/settings/proxy").then(e=>e.ok?e.json():null).then(e=>O(e)).catch(()=>{})},[]);let D=async()=>{try{let[e,t,s]=await Promise.all([fetch("/api/combos"),fetch("/api/providers"),fetch("/api/combos/metrics")]),r=await e.json(),l=await t.json(),i=await s.json();if(e.ok&&a(r.combos||[]),t.ok){let e=(l.connections||[]).filter(e=>"active"===e.testStatus||"success"===e.testStatus);y(e)}s.ok&&j(i.metrics||{})}catch(e){console.log("Error fetching data:",e)}finally{c(!1)}},E=async t=>{try{let a=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(a.ok)await D(),h(!1),M.success(e("comboCreated"));else{let t=await a.json();M.error(t.error?.message||t.error||e("failedCreate"))}}catch(t){M.error(e("errorCreating"))}},R=async(t,a)=>{try{let s=await fetch(`/api/combos/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(s.ok)await D(),g(null),M.success(e("comboUpdated"));else{let t=await s.json();M.error(t.error?.message||t.error||e("failedUpdate"))}}catch(t){M.error(e("errorUpdating"))}},q=async s=>{if(confirm(e("deleteConfirm")))try{(await fetch(`/api/combos/${s}`,{method:"DELETE"})).ok&&(a(t.filter(e=>e.id!==s)),M.success(e("comboDeleted")))}catch(t){M.error(e("errorDeleting"))}},A=async e=>{let a=e.name.replace(/-copy(-\d+)?$/,""),s=t.map(e=>e.name),r=`${a}-copy`,l=1;for(;s.includes(r);)l++,r=`${a}-copy-${l}`;let i={name:r,models:e.models,strategy:e.strategy||"priority",config:e.config||{}};await E(i)},z=async t=>{C(t.name),k(null);try{let e=await fetch("/api/combos/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboName:t.name})}),a=await e.json();k(a)}catch(t){k({error:e("testFailed")}),M.error(e("testFailed"))}},U=async t=>{let s=!1===t.isActive;a(e=>e.map(e=>e.id===t.id?{...e,isActive:s}:e));try{await fetch(`/api/combos/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:s})})}catch(r){a(e=>e.map(e=>e.id===t.id?{...e,isActive:!s}:e)),M.error(e("failedToggle"))}};return d?(0,s.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,s.jsx)(l.Qv,{}),(0,s.jsx)(l.Qv,{})]}):(0,s.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-2xl font-semibold",children:e("title")}),(0,s.jsx)("p",{className:"text-sm text-text-muted mt-1",children:e("description")})]}),(0,s.jsx)(l.$n,{icon:"add",onClick:()=>h(!0),children:e("createCombo")})]}),0===t.length?(0,s.jsx)(l.pp,{icon:"\uD83E\uDDE9",title:e("noCombosYet"),description:e("description"),actionLabel:e("createCombo"),onAction:()=>h(!0)}):(0,s.jsx)("div",{className:"flex flex-col gap-4",children:t.map(e=>(0,s.jsx)(x,{combo:e,metrics:v[e.name],copied:S,onCopy:$,onEdit:()=>g(e),onDelete:()=>q(e.id),onDuplicate:()=>A(e),onTest:()=>z(e),testing:w===e.name,onProxy:()=>P(e),hasProxy:!!_?.combos?.[e.id],onToggle:()=>U(e)},e.id))}),N&&(0,s.jsx)(l.aF,{isOpen:!!N,onClose:()=>{k(null),C(null)},title:e("testResults",{name:w}),children:(0,s.jsx)(u,{results:N})}),(0,s.jsx)(p,{isOpen:m,onClose:()=>h(!1),onSave:E,activeProviders:f,combo:null},"create"),(0,s.jsx)(p,{isOpen:!!b,combo:b,onClose:()=>g(null),onSave:e=>R(b.id,e),activeProviders:f},b?.id||"new"),T&&(0,s.jsx)(l.KN,{isOpen:!!T,onClose:()=>P(null),level:"combo",levelId:T.id,levelLabel:T.name})]})}function x({combo:e,metrics:t,copied:a,onCopy:r,onEdit:i,onDelete:o,onDuplicate:d,onTest:m,testing:x,onProxy:u,hasProxy:p,onToggle:h}){let b=e.strategy||"priority",g=e.models||[],f=!1===e.isActive,y=(0,n.c)("combos"),v=(0,n.c)("common");return(0,s.jsx)(l.Zp,{padding:"sm",className:`group ${f?"opacity-50":""}`,children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,s.jsx)("div",{className:"size-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("code",{className:"text-sm font-medium font-mono truncate",children:e.name}),(0,s.jsx)("span",{className:`text-[9px] uppercase font-semibold px-1.5 py-0.5 rounded-full ${"weighted"===b?"bg-amber-500/15 text-amber-600 dark:text-amber-400":"round-robin"===b?"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400":"random"===b?"bg-purple-500/15 text-purple-600 dark:text-purple-400":"least-used"===b?"bg-cyan-500/15 text-cyan-600 dark:text-cyan-400":"cost-optimized"===b?"bg-teal-500/15 text-teal-600 dark:text-teal-400":"bg-blue-500/15 text-blue-600 dark:text-blue-400"}`,children:b}),p&&(0,s.jsxs)("span",{className:"text-[9px] uppercase font-semibold px-1.5 py-0.5 rounded-full bg-primary/15 text-primary flex items-center gap-0.5",title:y("proxyConfigured"),children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"vpn_lock"}),"proxy"]}),(0,s.jsx)("button",{onClick:t=>{t.stopPropagation(),r(e.name,`combo-${e.id}`)},className:"p-0.5 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary transition-colors opacity-0 group-hover:opacity-100",title:y("copyComboName"),children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:a===`combo-${e.id}`?"check":"content_copy"})})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1 mt-0.5 flex-wrap",children:[0===g.length?(0,s.jsx)("span",{className:"text-xs text-text-muted italic",children:y("noModels")}):g.slice(0,3).map((e,t)=>{let{model:a,weight:r}=c(e);return(0,s.jsxs)("code",{className:"text-[10px] font-mono bg-black/5 dark:bg-white/5 px-1.5 py-0.5 rounded text-text-muted",children:[a,"weighted"===b&&r>0?` (${r}%)`:""]},t)}),g.length>3&&(0,s.jsx)("span",{className:"text-[10px] text-text-muted",children:y("more",{count:g.length-3})})]}),t&&(0,s.jsxs)("div",{className:"flex items-center gap-3 mt-1",children:[(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:[(0,s.jsx)("span",{className:"text-emerald-500",children:t.totalSuccesses}),"/",t.totalRequests," ",y("reqs")]}),(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:[t.successRate,"% ",y("success")]}),(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:["~",t.avgLatencyMs,"ms"]}),t.fallbackRate>0&&(0,s.jsxs)("span",{className:"text-[10px] text-amber-500",children:[t.fallbackRate,"% fallback"]})]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0 ml-2",children:[(0,s.jsx)(l.lM,{size:"sm",checked:!f,onChange:h,title:y(f?"enableCombo":"disableCombo")}),(0,s.jsxs)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,s.jsx)("button",{onClick:m,disabled:x,className:"p-1.5 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-emerald-500 transition-colors",title:y("testCombo"),children:(0,s.jsx)("span",{className:`material-symbols-outlined text-[16px] ${x?"animate-spin":""}`,children:x?"progress_activity":"play_arrow"})}),(0,s.jsx)("button",{onClick:d,className:"p-1.5 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary transition-colors",title:y("duplicate"),children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"content_copy"})}),(0,s.jsx)("button",{onClick:u,className:"p-1.5 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary transition-colors",title:y("proxyConfig"),children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"vpn_lock"})}),(0,s.jsx)("button",{onClick:i,className:"p-1.5 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary transition-colors",title:v("edit"),children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"edit"})}),(0,s.jsx)("button",{onClick:o,className:"p-1.5 hover:bg-red-500/10 rounded text-red-500 transition-colors",title:v("delete"),children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"delete"})})]})]})]})})}function u({results:e}){return e.error?(0,s.jsxs)("div",{className:"flex items-center gap-2 text-red-500 text-sm",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"error"}),"string"==typeof e.error?e.error:JSON.stringify(e.error)]}):(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[e.resolvedBy&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-emerald-500 text-[18px]",children:"check_circle"}),(0,s.jsxs)("span",{children:["Resolved by:"," ",(0,s.jsx)("code",{className:"text-xs bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 px-1.5 py-0.5 rounded",children:e.resolvedBy})]})]}),e.results?.map((e,t)=>(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs px-2 py-1.5 rounded bg-black/[0.02] dark:bg-white/[0.02]",children:[(0,s.jsx)("span",{className:`material-symbols-outlined text-[14px] ${"ok"===e.status?"text-emerald-500":"skipped"===e.status?"text-text-muted":"text-red-500"}`,children:"ok"===e.status?"check_circle":"skipped"===e.status?"skip_next":"error"}),(0,s.jsx)("code",{className:"font-mono flex-1",children:e.model}),void 0!==e.latencyMs&&(0,s.jsxs)("span",{className:"text-text-muted",children:[e.latencyMs,"ms"]}),(0,s.jsx)("span",{className:`text-[10px] uppercase font-medium ${"ok"===e.status?"text-emerald-500":"skipped"===e.status?"text-text-muted":"text-red-500"}`,children:e.status})]},t))]})}function p({isOpen:e,combo:t,onClose:a,onSave:i,activeProviders:o}){let m=(0,n.c)("combos"),x=(0,n.c)("common"),[u,p]=(0,r.useState)(t?.name||""),[b,g]=(0,r.useState)(()=>(t?.models||[]).map(e=>c(e))),[f,y]=(0,r.useState)(t?.strategy||"priority"),[v,j]=(0,r.useState)(!1),[N,k]=(0,r.useState)(!1),[w,C]=(0,r.useState)(""),[S,$]=(0,r.useState)({}),[M,T]=(0,r.useState)([]),[P,_]=(0,r.useState)(!1),[O,D]=(0,r.useState)(t?.config||{}),[E,R]=(0,r.useState)(null),[q,A]=(0,r.useState)(null),z=async()=>{try{let[e,t]=await Promise.all([fetch("/api/models/alias"),fetch("/api/provider-nodes")]);if(!e.ok||!t.ok)throw Error(`Failed to fetch data: aliases=${e.status}, nodes=${t.status}`);let[a,s]=await Promise.all([e.json(),t.json()]);$(a.aliases||{}),T(s.nodes||[])}catch(e){console.error("Error fetching modal data:",e)}};(0,r.useEffect)(()=>{e&&z()},[e]);let U=e=>e.trim()?d.test(e)?(C(""),!0):(C(m("nameInvalid")),!1):(C(m("nameRequired")),!1),F=(0,r.useCallback)(e=>{let t=e.split("/");if(2!==t.length)return e;let[a,s]=t,r=M.find(e=>e.id===a||e.prefix===a);return r?`${r.name}/${s}`:e},[M]),J=e=>{e.target&&(e.currentTarget.style.opacity="1"),R(null),A(null)},L=async()=>{if(!U(u))return;k(!0);let e={name:u.trim(),models:"weighted"===f?b:b.map(e=>e.model),strategy:f},t={...O};"round-robin"===f&&(void 0!==O.concurrencyPerModel&&(t.concurrencyPerModel=O.concurrencyPerModel),void 0!==O.queueTimeoutMs&&(t.queueTimeoutMs=O.queueTimeoutMs)),Object.keys(t).length>0&&(e.config=t),await i(e),k(!1)},B=!!t;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.aF,{isOpen:e,onClose:a,title:B?m("editCombo"):m("createCombo"),children:(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(l.pd,{label:m("comboName"),value:u,onChange:e=>{let t=e.target.value;p(t),t?U(t):C("")},placeholder:m("comboNamePlaceholder"),error:w}),(0,s.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:m("nameHint")})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:m("routingStrategy")}),(0,s.jsx)("div",{className:"grid grid-cols-3 gap-1 p-0.5 bg-black/5 dark:bg-white/5 rounded-lg",children:[{value:"priority",label:"Priority",icon:"sort"},{value:"weighted",label:"Weighted",icon:"percent"},{value:"round-robin",label:"Round-Robin",icon:"autorenew"},{value:"random",label:"Random",icon:"shuffle"},{value:"least-used",label:"Least-Used",icon:"low_priority"},{value:"cost-optimized",label:"Cost-Opt",icon:"savings"}].map(e=>(0,s.jsxs)("button",{onClick:()=>y(e.value),className:`py-1.5 px-2 rounded-md text-xs font-medium transition-all ${f===e.value?"bg-white dark:bg-bg-main shadow-sm text-primary":"text-text-muted hover:text-text-main"}`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px] align-middle mr-0.5",children:e.icon}),e.label]},e.value))}),(0,s.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:{priority:"Sequential fallback: tries model 1 first, then 2, etc.",weighted:"Distributes traffic by weight percentage with fallback","round-robin":"Circular distribution: each request goes to the next model in rotation",random:"Uniform random selection, then fallback to remaining models","least-used":"Picks the model with fewest requests, balancing load over time","cost-optimized":"Routes to the cheapest model first based on pricing"}[f]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,s.jsx)("label",{className:"text-sm font-medium",children:m("models")}),"weighted"===f&&b.length>1&&(0,s.jsx)("button",{onClick:()=>{let e=b.length;if(0===e)return;let t=Math.floor(100/e),a=100-t*e;g(b.map((e,s)=>({...e,weight:t+(0===s?a:0)})))},className:"text-[10px] text-primary hover:text-primary/80 transition-colors",children:m("autoBalance")})]}),0===b.length?(0,s.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:m("noModelsYet")})]}):(0,s.jsx)("div",{className:"flex flex-col gap-1 max-h-[240px] overflow-y-auto",children:b.map((e,t)=>(0,s.jsxs)("div",{draggable:!0,onDragStart:e=>{R(t),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t.toString()),e.target&&setTimeout(()=>e.currentTarget.style.opacity="0.5",0)},onDragEnd:J,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",A(t)},onDrop:e=>((e,t)=>{if(e.preventDefault(),null===E||E===t)return;let a=[...b],[s]=a.splice(E,1);a.splice(t,0,s),g(a),R(null),A(null)})(e,t),className:`group/item flex items-center gap-1.5 px-2 py-1.5 rounded-md transition-all cursor-grab active:cursor-grabbing ${q===t&&E!==t?"bg-primary/10 border border-primary/30":"bg-black/[0.02] dark:bg-white/[0.02] hover:bg-black/[0.04] dark:hover:bg-white/[0.04] border border-transparent"} ${E===t?"opacity-50":""}`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted/40 cursor-grab shrink-0",children:"drag_indicator"}),(0,s.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:t+1}),(0,s.jsx)("div",{className:"flex-1 min-w-0 px-1 text-xs text-text-main truncate",children:F(e.model)}),"weighted"===f&&(0,s.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[(0,s.jsx)("input",{type:"number",min:"0",max:"100",value:e.weight,onChange:e=>{var a;let s;return a=e.target.value,void((s=[...b])[t]={...s[t],weight:Math.max(0,Math.min(100,Number(a)||0))},g(s))},className:"w-10 text-[11px] text-center py-0.5 rounded border border-black/10 dark:border-white/10 bg-transparent focus:border-primary focus:outline-none"}),(0,s.jsx)("span",{className:"text-[10px] text-text-muted",children:"%"})]}),"priority"===f&&(0,s.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,s.jsx)("button",{onClick:()=>(e=>{if(0===e)return;let t=[...b];[t[e-1],t[e]]=[t[e],t[e-1]],g(t)})(t),disabled:0===t,className:`p-0.5 rounded ${0===t?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,s.jsx)("button",{onClick:()=>(e=>{if(e===b.length-1)return;let t=[...b];[t[e],t[e+1]]=[t[e+1],t[e]],g(t)})(t),disabled:t===b.length-1,className:`p-0.5 rounded ${t===b.length-1?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,s.jsx)("button",{onClick:()=>{g(b.filter((e,a)=>a!==t))},className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},`${e.model}-${t}`))}),"weighted"===f&&b.length>0&&(0,s.jsx)(h,{models:b}),(0,s.jsxs)("button",{onClick:()=>j(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-text-muted hover:text-primary hover:border-primary/30 transition-colors flex items-center justify-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),m("addModel")]})]}),(0,s.jsxs)("button",{onClick:()=>_(!P),className:"flex items-center gap-1 text-xs text-text-muted hover:text-text-main transition-colors self-start",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:P?"expand_less":"expand_more"}),m("advancedSettings")]}),P&&(0,s.jsxs)("div",{className:"flex flex-col gap-2 p-3 bg-black/[0.02] dark:bg-white/[0.02] rounded-lg border border-black/5 dark:border-white/5",children:[(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-[10px] text-text-muted mb-0.5 block",children:m("maxRetries")}),(0,s.jsx)("input",{type:"number",min:"0",max:"10",value:O.maxRetries??"",placeholder:"1",onChange:e=>D({...O,maxRetries:e.target.value?Number(e.target.value):void 0}),className:"w-full text-xs py-1.5 px-2 rounded border border-black/10 dark:border-white/10 bg-transparent focus:border-primary focus:outline-none"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-[10px] text-text-muted mb-0.5 block",children:m("retryDelay")}),(0,s.jsx)("input",{type:"number",min:"0",max:"60000",step:"500",value:O.retryDelayMs??"",placeholder:"2000",onChange:e=>D({...O,retryDelayMs:e.target.value?Number(e.target.value):void 0}),className:"w-full text-xs py-1.5 px-2 rounded border border-black/10 dark:border-white/10 bg-transparent focus:border-primary focus:outline-none"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-[10px] text-text-muted mb-0.5 block",children:m("timeout")}),(0,s.jsx)("input",{type:"number",min:"1000",max:"600000",step:"1000",value:O.timeoutMs??"",placeholder:"120000",onChange:e=>D({...O,timeoutMs:e.target.value?Number(e.target.value):void 0}),className:"w-full text-xs py-1.5 px-2 rounded border border-black/10 dark:border-white/10 bg-transparent focus:border-primary focus:outline-none"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("label",{className:"text-[10px] text-text-muted",children:m("healthcheck")}),(0,s.jsx)("input",{type:"checkbox",checked:!1!==O.healthCheckEnabled,onChange:e=>D({...O,healthCheckEnabled:e.target.checked}),className:"accent-primary"})]})]}),"round-robin"===f&&(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2 pt-2 border-t border-black/5 dark:border-white/5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-[10px] text-text-muted mb-0.5 block",children:m("concurrencyPerModel")}),(0,s.jsx)("input",{type:"number",min:"1",max:"20",value:O.concurrencyPerModel??"",placeholder:"3",onChange:e=>D({...O,concurrencyPerModel:e.target.value?Number(e.target.value):void 0}),className:"w-full text-xs py-1.5 px-2 rounded border border-black/10 dark:border-white/10 bg-transparent focus:border-primary focus:outline-none"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-[10px] text-text-muted mb-0.5 block",children:m("queueTimeout")}),(0,s.jsx)("input",{type:"number",min:"1000",max:"120000",step:"1000",value:O.queueTimeoutMs??"",placeholder:"30000",onChange:e=>D({...O,queueTimeoutMs:e.target.value?Number(e.target.value):void 0}),className:"w-full text-xs py-1.5 px-2 rounded border border-black/10 dark:border-white/10 bg-transparent focus:border-primary focus:outline-none"})]})]}),(0,s.jsx)("p",{className:"text-[10px] text-text-muted",children:m("advancedHint")})]}),(0,s.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,s.jsx)(l.$n,{onClick:a,variant:"ghost",fullWidth:!0,size:"sm",children:x("cancel")}),(0,s.jsx)(l.$n,{onClick:L,fullWidth:!0,size:"sm",disabled:!u.trim()||!!w||N,children:N?m("saving"):B?x("save"):m("createCombo")})]})]})}),(0,s.jsx)(l.rq,{isOpen:v,onClose:()=>j(!1),onSelect:e=>{b.find(t=>t.model===e.value)||g([...b,{model:e.value,weight:0}])},activeProviders:o,modelAliases:S,title:m("addModelToCombo"),selectedModel:null})]})}function h({models:e}){let t=e.reduce((e,t)=>e+(t.weight||0),0),a=100===t,r=["bg-blue-500","bg-emerald-500","bg-amber-500","bg-purple-500","bg-rose-500","bg-cyan-500","bg-orange-500","bg-indigo-500"];return(0,s.jsxs)("div",{className:"mt-1.5",children:[(0,s.jsx)("div",{className:"h-1.5 rounded-full bg-black/5 dark:bg-white/5 overflow-hidden flex",children:e.map((e,t)=>e.weight?(0,s.jsx)("div",{className:`${r[t%r.length]} transition-all duration-300`,style:{width:`${Math.min(e.weight,100)}%`}},t):null)}),(0,s.jsxs)("div",{className:"flex items-center justify-between mt-0.5",children:[(0,s.jsx)("div",{className:"flex gap-1",children:e.map((e,t)=>e.weight>0&&(0,s.jsxs)("span",{className:"flex items-center gap-0.5 text-[9px] text-text-muted",children:[(0,s.jsx)("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${r[t%r.length]}`}),e.weight,"%"]},t))}),(0,s.jsxs)("span",{className:`text-[10px] font-medium ${a?"text-emerald-500":t>100?"text-red-500":"text-amber-500"}`,children:[t,"%",!a&&t>0&&" ≠ 100%"]})]})]})}},7762:(e,t,a)=>{Promise.resolve().then(a.bind(a,2729))}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=7762)),_N_E=e.O()}]);
@@ -0,0 +1 @@
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()}]);
@@ -0,0 +1 @@
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()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8192],{32424:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>d});var a=s(95155),l=s(12115),r=s(40993),n=s(20909),i=s(50910);function c(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}let x={CLOSED:{bg:"bg-green-500/10",text:"text-green-500",label:"Healthy"},OPEN:{bg:"bg-red-500/10",text:"text-red-500",label:"Open"},HALF_OPEN:{bg:"bg-amber-500/10",text:"text-amber-500",label:"Half-Open"}};function d(){var e;let t,s,d,m,o,p,h=(0,i.c)("health"),[u,j]=(0,l.useState)(null),[b,N]=(0,l.useState)(null),[g,f]=(0,l.useState)(null),[y,v]=(0,l.useState)(null),[w,$]=(0,l.useState)(null),[C,k]=(0,l.useState)(null),[S,O]=(0,l.useState)(!1),E=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/monitoring/health");if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();j(t),N(null),f(new Date)}catch(e){N(e.message)}},[]),D=(0,l.useCallback)(async()=>{let e=await Promise.allSettled([fetch("/api/telemetry/summary").then(e=>e.json()),fetch("/api/cache/stats").then(e=>e.json()),fetch("/api/rate-limits").then(e=>e.json())]);"fulfilled"===e[0].status&&v(e[0].value),"fulfilled"===e[1].status&&$(e[1].value),"fulfilled"===e[2].status&&e[2].value.cacheStats&&k(e[2].value.cacheStats)},[]);(0,l.useEffect)(()=>{E(),D();let e=setInterval(()=>{E(),D()},15e3);return()=>clearInterval(e)},[E,D]);let L=async()=>{if(confirm(h("resetConfirm"))){O(!0);try{let e=await fetch("/api/monitoring/health",{method:"DELETE"});if(!e.ok)throw Error(`HTTP ${e.status}`);await E(),await D()}catch(e){console.error("Failed to reset health:",e)}finally{O(!1)}}},_=e=>null!=e?`${Math.round(e)}ms`:"—";if(!u&&!b)return(0,a.jsx)("div",{className:"p-6 flex items-center justify-center min-h-[400px]",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-primary"}),(0,a.jsx)("p",{className:"text-text-muted mt-4",children:h("loadingHealth")})]})});if(b&&!u)return(0,a.jsx)("div",{className:"p-6",children:(0,a.jsxs)("div",{className:"bg-red-500/10 border border-red-500/30 rounded-xl p-6 text-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-red-500 text-[32px] mb-2",children:"error"}),(0,a.jsx)("p",{className:"text-red-400",children:h("failedToLoad",{error:b})}),(0,a.jsx)("button",{onClick:E,className:"mt-4 px-4 py-2 rounded-lg bg-primary/10 text-primary text-sm hover:bg-primary/20 transition-colors",children:h("retry")})]})});let{system:z,providerHealth:F,rateLimitStatus:T,lockouts:Z}=u,P=Object.entries(F||{}),q=Object.entries(Z||{});return(0,a.jsxs)("div",{className:"p-6 space-y-6 max-w-6xl mx-auto",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold text-text-main",children:h("title")}),(0,a.jsx)("p",{className:"text-sm text-text-muted mt-1",children:h("description")})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[g&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Updated ",g.toLocaleTimeString()]}),(0,a.jsx)("button",{onClick:()=>{E(),D()},className:"p-2 rounded-lg bg-surface hover:bg-surface/80 text-text-muted hover:text-text-main transition-colors",title:"Refresh",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"refresh"})})]})]}),(0,a.jsxs)("div",{role:"status","aria-live":"polite",className:`rounded-xl p-4 flex items-center gap-3 ${"healthy"===u.status?"bg-green-500/10 border border-green-500/20":"bg-red-500/10 border border-red-500/20"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[24px] ${"healthy"===u.status?"text-green-500":"text-red-500"}`,children:"healthy"===u.status?"check_circle":"error"}),(0,a.jsx)("span",{className:"healthy"===u.status?"text-green-400":"text-red-400",children:"healthy"===u.status?h("allOperational"):h("issuesDetected")})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[(0,a.jsxs)(r.Zp,{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,a.jsx)("div",{className:"flex items-center justify-center size-8 rounded-lg bg-primary/10 text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"timer"})}),(0,a.jsx)("span",{className:"text-sm text-text-muted",children:h("uptime")})]}),(0,a.jsx)("p",{className:"text-xl font-semibold text-text-main",children:(t=Math.floor((e=z.uptime)/86400),s=Math.floor(e%86400/3600),d=Math.floor(e%3600/60),t>0?`${t}d ${s}h ${d}m`:s>0?`${s}h ${d}m`:`${d}m`)})]}),(0,a.jsxs)(r.Zp,{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,a.jsx)("div",{className:"flex items-center justify-center size-8 rounded-lg bg-blue-500/10 text-blue-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"info"})}),(0,a.jsx)("span",{className:"text-sm text-text-muted",children:h("version")})]}),(0,a.jsxs)("p",{className:"text-xl font-semibold text-text-main",children:["v",z.version]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Node ",z.nodeVersion]})]}),(0,a.jsxs)(r.Zp,{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,a.jsx)("div",{className:"flex items-center justify-center size-8 rounded-lg bg-purple-500/10 text-purple-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"memory"})}),(0,a.jsx)("span",{className:"text-sm text-text-muted",children:h("memoryRss")})]}),(0,a.jsx)("p",{className:"text-xl font-semibold text-text-main",children:c(z.memoryUsage?.rss||0)}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:[h("heap"),": ",c(z.memoryUsage?.heapUsed||0)," /"," ",c(z.memoryUsage?.heapTotal||0)]})]}),(0,a.jsxs)(r.Zp,{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,a.jsx)("div",{className:"flex items-center justify-center size-8 rounded-lg bg-amber-500/10 text-amber-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"dns"})}),(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"Providers"})]}),(0,a.jsx)("p",{className:"text-xl font-semibold text-text-main",children:P.length}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:[P.filter(([,e])=>"CLOSED"===e.state).length," healthy"]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,a.jsxs)(r.Zp,{className:"p-4",children:[(0,a.jsxs)("h3",{className:"text-sm font-semibold text-text-muted mb-3 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"speed"}),h("latency")]}),y?(0,a.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-text-muted",children:"p50"}),(0,a.jsx)("span",{className:"font-mono",children:_(y.p50)})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-text-muted",children:"p95"}),(0,a.jsx)("span",{className:"font-mono",children:_(y.p95)})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-text-muted",children:"p99"}),(0,a.jsx)("span",{className:"font-mono",children:_(y.p99)})]}),(0,a.jsxs)("div",{className:"flex justify-between border-t border-border pt-2 mt-2",children:[(0,a.jsx)("span",{className:"text-text-muted",children:h("totalRequests")}),(0,a.jsx)("span",{className:"font-mono",children:y.totalRequests??0})]})]}):(0,a.jsx)("p",{className:"text-sm text-text-muted",children:h("noDataYet")})]}),(0,a.jsxs)(r.Zp,{className:"p-4",children:[(0,a.jsxs)("h3",{className:"text-sm font-semibold text-text-muted mb-3 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"cached"}),h("promptCache")]}),w?(0,a.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-text-muted",children:h("entries")}),(0,a.jsxs)("span",{className:"font-mono",children:[w.size,"/",w.maxSize]})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-text-muted",children:h("hitRate")}),(0,a.jsxs)("span",{className:"font-mono",children:[w.hitRate?.toFixed(1)??0,"%"]})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-text-muted",children:h("hitsMisses")}),(0,a.jsxs)("span",{className:"font-mono",children:[w.hits??0," / ",w.misses??0]})]})]}):(0,a.jsx)("p",{className:"text-sm text-text-muted",children:h("noDataYet")})]}),(0,a.jsxs)(r.Zp,{className:"p-4",children:[(0,a.jsxs)("h3",{className:"text-sm font-semibold text-text-muted mb-3 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"database"}),h("signatureCache")]}),C?(0,a.jsx)("div",{className:"grid grid-cols-2 gap-2",children:[{label:"Defaults",value:C.defaultCount,color:"text-text-muted"},{label:"Tool",value:`${C.tool.entries}/${C.tool.patterns}`,color:"text-blue-400"},{label:"Family",value:`${C.family.entries}/${C.family.patterns}`,color:"text-purple-400"},{label:"Session",value:`${C.session.entries}/${C.session.patterns}`,color:"text-cyan-400"}].map(({label:e,value:t,color:s})=>(0,a.jsxs)("div",{className:"text-center p-2 rounded-lg bg-surface/30 border border-border/30",children:[(0,a.jsx)("p",{className:`text-lg font-bold tabular-nums ${s}`,children:t}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:e})]},e))}):(0,a.jsx)("p",{className:"text-sm text-text-muted",children:h("noDataYet")})]})]}),(0,a.jsxs)(r.Zp,{className:"p-5",role:"region","aria-label":"Provider health status",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold text-text-main flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px] text-primary",children:"health_and_safety"}),h("providerHealth")]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[P.some(([,e])=>"CLOSED"!==e.state)&&(0,a.jsx)("button",{onClick:L,disabled:S,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold transition-all ${S?"bg-surface/50 text-text-muted cursor-wait":"bg-red-500/10 text-red-400 hover:bg-red-500/20 hover:text-red-300 border border-red-500/20"}`,title:"Reset all circuit breakers to healthy state",children:S?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] animate-spin",children:"progress_activity"}),h("resetting")]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"}),h("resetAll")]})}),P.length>0&&(0,a.jsxs)("div",{className:"flex items-center gap-3 text-xs text-text-muted",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"size-2 rounded-full bg-green-500"})," ",h("healthy")]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"size-2 rounded-full bg-amber-500"})," ",h("recovering")]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"size-2 rounded-full bg-red-500"})," ",h("down")]})]})]})]}),0===P.length?(0,a.jsx)("p",{className:"text-sm text-text-muted text-center py-4",children:h("noCBData")}):(m=P.filter(([,e])=>"CLOSED"!==e.state),o=P.filter(([,e])=>"CLOSED"===e.state),(0,a.jsxs)("div",{className:"space-y-4",children:[m.length>0&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("p",{className:"text-xs font-medium text-red-400 uppercase tracking-wide",children:h("issuesLabel")}),m.map(([e,t])=>{let s=x[t.state]||x.OPEN,l=n.Q2[e],r=l?.name||e;return(0,a.jsxs)("div",{className:`rounded-lg p-3 ${s.bg} border border-white/5 flex items-center gap-3`,children:[(0,a.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0 text-xs font-bold",style:{backgroundColor:`${l?.color||"#888"}15`,color:l?.color||"#888"},children:l?.textIcon||e.slice(0,2).toUpperCase()}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-text-main truncate",children:r}),(0,a.jsx)("span",{className:`text-xs font-semibold px-1.5 py-0.5 rounded ${s.bg} ${s.text}`,children:s.label})]}),(0,a.jsxs)("div",{className:"text-xs text-text-muted mt-0.5",children:[t.failures," failure",1!==t.failures?"s":"",t.lastFailure&&(0,a.jsxs)("span",{className:"ml-2",children:["\xb7 Last: ",new Date(t.lastFailure).toLocaleTimeString()]})]})]})]},e)})]}),o.length>0&&(0,a.jsxs)("div",{children:[m.length>0&&(0,a.jsx)("p",{className:"text-xs font-medium text-green-400 uppercase tracking-wide mb-2",children:h("operational")}),(0,a.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-2",children:o.map(([e])=>{let t=n.Q2[e],s=t?.name||e;return(0,a.jsxs)("div",{className:"rounded-lg p-2.5 bg-green-500/5 border border-white/5 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"size-2 rounded-full bg-green-500 shrink-0"}),(0,a.jsx)("span",{className:"text-xs font-medium text-text-main truncate",title:s,children:s})]},e)})})]})]}))]}),T&&Object.keys(T).length>0&&((p=Object.entries(T).map(([e,t])=>({key:e,...(e=>{let t,s=e.split(":"),a=s[0],l=s[1]||"",r=s.slice(2).join(":")||null,i=n.Q2[a];if(a.startsWith("openai-compatible-")){let e=a.replace("openai-compatible-","");t="OpenAI Compatible",i={color:"#10A37F",textIcon:"OC"},e.length>12?t+=` (${e.slice(0,8)}…)`:e&&(t+=` (${e})`)}else if(a.startsWith("anthropic-compatible-")){let e=a.replace("anthropic-compatible-","");t="Anthropic Compatible",i={color:"#D97757",textIcon:"AC"},e.length>12?t+=` (${e.slice(0,8)}…)`:e&&(t+=` (${e})`)}else t=i?.name||a;return{providerId:a,displayName:t,providerInfo:i,connectionId:l,model:r}})(e),status:t}))).sort((e,t)=>{let s=(e.status.queued||0)+(e.status.running||0),a=(t.status.queued||0)+(t.status.running||0);return s!==a?a-s:e.displayName.localeCompare(t.displayName)}),(0,a.jsxs)(r.Zp,{className:"p-5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold text-text-main flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px] text-amber-500",children:"speed"}),h("rateLimitStatus")]}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:[p.length," active limiter",1!==p.length?"s":""]})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:p.map(({key:e,displayName:t,providerInfo:s,connectionId:l,model:r,status:n})=>{let i=(n.queued||0)+(n.running||0)>0,c=(n.queued||0)>0;return(0,a.jsxs)("div",{className:`rounded-lg p-3 border transition-colors ${c?"bg-amber-500/5 border-amber-500/20":i?"bg-blue-500/5 border-blue-500/15":"bg-surface/30 border-white/5"}`,title:e,children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 mb-2",children:[(0,a.jsx)("div",{className:"size-7 rounded-md flex items-center justify-center shrink-0 text-[10px] font-bold",style:{backgroundColor:`${s?.color||"#888"}15`,color:s?.color||"#888"},children:s?.textIcon||t.slice(0,2).toUpperCase()}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-text-main truncate",children:t}),l&&(0,a.jsxs)("p",{className:"text-[10px] text-text-muted font-mono truncate",children:[l.length>12?l.slice(0,8)+"…":l,r&&(0,a.jsxs)("span",{className:"ml-1 text-text-muted/60",children:["\xb7 ",r]})]})]}),(0,a.jsx)("span",{className:`inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-semibold ${c?"bg-amber-500/15 text-amber-400":i?"bg-blue-500/15 text-blue-400":"bg-green-500/10 text-green-400"}`,children:c?"Queued":i?"Active":"OK"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 text-[11px] text-text-muted",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"schedule"}),n.queued||0," queued"]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"play_arrow"}),n.running||0," running"]})]})]},e)})})]})),q.length>0&&(0,a.jsxs)(r.Zp,{className:"p-5",children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold text-text-main mb-4 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px] text-red-500",children:"lock"}),h("activeLockouts")]}),(0,a.jsx)("div",{className:"space-y-2",children:q.map(([e,t])=>(0,a.jsxs)("div",{className:"rounded-lg p-3 bg-red-500/5 border border-red-500/10 flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-sm font-medium text-text-main",children:e}),t.reason&&(0,a.jsxs)("span",{className:"text-xs text-text-muted ml-2",children:["(",t.reason,")"]})]}),t.until&&(0,a.jsxs)("span",{className:"text-xs text-red-400",children:["Until ",new Date(t.until).toLocaleTimeString()]})]},e))})]})]})}},39449:(e,t,s)=>{Promise.resolve().then(s.bind(s,32424))}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=39449)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1066],{39387:(e,t,s)=>{Promise.resolve().then(s.bind(s,73732))},73732:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>j});var a=s(95155),l=s(12115),r=s(40993),n=s(50910),i=s(5772),c=s(35144);function o(e){let t="string"==typeof e?e.trim():"";if(!t)return{key:"unknown",label:"Unknown",variant:"default",rank:0,raw:null};let s=t.toUpperCase();return s.includes("ENTERPRISE")||s.includes("CORP")||s.includes("ORG")?{key:"enterprise",label:"Enterprise",variant:"info",rank:7,raw:t}:s.includes("TEAM")||s.includes("CHATGPTTEAM")?{key:"team",label:"Team",variant:"info",rank:6,raw:t}:s.includes("BUSINESS")||s.includes("STANDARD")||s.includes("BIZ")?{key:"business",label:"Business",variant:"warning",rank:5,raw:t}:s.includes("ULTRA")?{key:"ultra",label:"Ultra",variant:"success",rank:4,raw:t}:s.includes("PRO")||s.includes("PREMIUM")?{key:"pro",label:"Pro",variant:"primary",rank:3,raw:t}:s.includes("PLUS")||s.includes("PAID")?{key:"plus",label:"Plus",variant:"secondary",rank:2,raw:t}:s.includes("FREE")||s.includes("INDIVIDUAL")||s.includes("BASIC")||s.includes("TRIAL")||s.includes("LEGACY")?{key:"free",label:"Free",variant:"default",rank:1,raw:t}:{key:"unknown",label:t.toLowerCase().split(/[\s_-]+/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")||"Unknown",variant:"default",rank:0,raw:t}}var d=s(81060),x=s(80927),u=s(92542),m=s(20909);let p={antigravity:{label:"Antigravity",color:"#F59E0B"},github:{label:"GitHub Copilot",color:"#333"},kiro:{label:"Kiro AI",color:"#FF6B35"},codex:{label:"OpenAI Codex",color:"#10A37F"},claude:{label:"Claude Code",color:"#D97757"}},h=[{key:"all",label:"All"},{key:"enterprise",label:"Enterprise"},{key:"team",label:"Team"},{key:"business",label:"Business"},{key:"ultra",label:"Ultra"},{key:"pro",label:"Pro"},{key:"plus",label:"Plus"},{key:"free",label:"Free"},{key:"unknown",label:"Unknown"}];function f(){let e=(0,n.c)("usage"),[t,s]=(0,l.useState)([]),[r,f]=(0,l.useState)({}),[b,g]=(0,l.useState)({}),[j,y]=(0,l.useState)({}),[v,N]=(0,l.useState)(!0),[k,w]=(0,l.useState)(null),[A,E]=(0,l.useState)(!1),[C,I]=(0,l.useState)(120),[S,q]=(0,l.useState)(!0),[M,P]=(0,l.useState)("all"),T=(0,l.useRef)(null),$=(0,l.useRef)(null),_=(0,l.useRef)({}),R=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/providers/client");if(!e.ok)throw Error("Failed");let t=(await e.json()).connections||[];return s(t),t}catch{return s([]),[]}},[]),L=(0,l.useCallback)(async(e,t)=>{let s=Date.now();if(!(s-(_.current[e]||0)<3e4)){_.current[e]=s,g(t=>({...t,[e]:!0})),y(t=>({...t,[e]:null}));try{let s=await fetch(`/api/usage/${e}`);if(!s.ok){let t=(await s.json().catch(()=>({}))).error||s.statusText;if(404===s.status)return;if(401===s.status)return void f(s=>({...s,[e]:{quotas:[],message:t}}));throw Error(`HTTP ${s.status}: ${t}`)}let a=await s.json(),l=function(e,t){if(!t||"object"!=typeof t)return[];let s=[];try{switch(e.toLowerCase()){case"github":default:t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"antigravity":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codex":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"kiro":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"claude":t.message?s.push({name:"error",used:0,total:0,resetAt:null,message:t.message}):t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}let a=(0,c.KC)(e);if(a.length>0){let e=new Map(a.map((e,t)=>[e.id,t]));s.sort((t,s)=>{let a=t.modelKey||t.name,l=s.modelKey||s.name;return(e.get(a)??999)-(e.get(l)??999)})}return s}(t,a);f(t=>({...t,[e]:{quotas:l,plan:a.plan||null,message:a.message||null,raw:a}}))}catch(t){y(s=>({...s,[e]:t.message||"Failed to fetch quota"}))}finally{g(t=>({...t,[e]:!1}))}}},[]),O=(0,l.useCallback)(async(e,t)=>{await L(e,t),w(new Date)},[L]),D=(0,l.useCallback)(async()=>{if(!A){E(!0),I(120);try{let e=(await R()).filter(e=>m.wb.includes(e.provider)&&"oauth"===e.authType);await Promise.all(e.map(e=>L(e.id,e.provider))),w(new Date)}catch(e){console.error("Error refreshing all:",e)}finally{E(!1)}}},[A,R,L]);(0,l.useEffect)(()=>{(async()=>{q(!0),await D(),q(!1)})()},[]),(0,l.useEffect)(()=>{if(!v){T.current&&clearInterval(T.current),$.current&&clearInterval($.current);return}return T.current=setInterval(D,12e4),$.current=setInterval(()=>{I(e=>e<=1?120:e-1)},1e3),()=>{T.current&&clearInterval(T.current),$.current&&clearInterval($.current)}},[v,D]),(0,l.useEffect)(()=>{let e=()=>{document.hidden?(T.current&&clearInterval(T.current),$.current&&clearInterval($.current)):v&&(T.current=setInterval(D,12e4),$.current=setInterval(()=>{I(e=>e<=1?120:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[v,D]);let U=(0,l.useMemo)(()=>t.filter(e=>m.wb.includes(e.provider)&&"oauth"===e.authType),[t]),F=(0,l.useMemo)(()=>{let e={antigravity:1,github:2,codex:3,claude:4,kiro:5};return[...U].sort((t,s)=>(e[t.provider]||9)-(e[s.provider]||9))},[U]),B=(0,l.useMemo)(()=>{let e={};for(let t of F)e[t.id]=o(r[t.id]?.plan);return e},[F,r]),G=(0,l.useMemo)(()=>{let e={all:F.length,enterprise:0,team:0,business:0,ultra:0,pro:0,free:0,unknown:0};for(let t of F){let s=B[t.id]?.key||"unknown";e[s]=(e[s]||0)+1}return e},[F,B]),K=(0,l.useMemo)(()=>"all"===M?F:F.filter(e=>(B[e.id]?.key||"unknown")===M),[F,B,M]);return S?(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(u.CardSkeleton,{}),(0,a.jsx)(u.CardSkeleton,{})]}):0===F.length?(0,a.jsx)(d.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] opacity-15",children:"cloud_off"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-main",children:e("noProviders")}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-[400px] mx-auto",children:"Connect to providers with OAuth to track your API quota limits and usage."})]})}):(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-text-main m-0",children:e("providerLimits")}),(0,a.jsxs)("span",{className:"text-[13px] text-text-muted",children:[K.length," account",1!==K.length?"s":"",K.length!==F.length?` (filtered from ${F.length})`:""]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("button",{onClick:()=>N(e=>!e),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-white/[0.08] bg-transparent cursor-pointer text-text-main text-[13px]",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",style:{color:v?"#22c55e":"var(--text-muted)"},children:v?"toggle_on":"toggle_off"}),"Auto-refresh",v&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["(",C,"s)"]})]}),(0,a.jsxs)("button",{onClick:D,disabled:A,className:"flex items-center gap-1.5 px-3.5 py-1.5 rounded-lg bg-white/[0.06] border border-white/10 text-text-main text-[13px] disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] ${A?"animate-spin":""}`,children:"refresh"}),"Refresh All"]})]})]}),(0,a.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:h.map(e=>{if("all"!==e.key&&!G[e.key])return null;let t=M===e.key;return(0,a.jsxs)("button",{onClick:()=>P(e.key),className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-semibold cursor-pointer",style:{border:t?"1px solid var(--primary, #E54D5E)":"1px solid rgba(255,255,255,0.12)",background:t?"rgba(249,120,21,0.14)":"transparent",color:t?"var(--primary, #E54D5E)":"var(--text-muted)"},children:[(0,a.jsx)("span",{children:e.label}),(0,a.jsx)("span",{className:"opacity-85",children:G[e.key]||0})]},e.key)})}),(0,a.jsxs)("div",{className:"rounded-xl border border-white/[0.06] overflow-hidden bg-black/15",children:[(0,a.jsxs)("div",{className:"items-center px-4 py-2.5 border-b border-white/[0.06] text-[11px] font-semibold uppercase tracking-wider text-text-muted",style:{display:"grid",gridTemplateColumns:"280px 1fr 100px 48px"},children:[(0,a.jsx)("div",{children:e(">account</")}),(0,a.jsx)("div",{children:e("modelQuotas")}),(0,a.jsx)("div",{className:"text-center",children:e(">lastUsed</")}),(0,a.jsx)("div",{className:"text-center",children:e(">actions</")})]}),K.map((t,s)=>{let l=r[t.id],n=b[t.id],c=j[t.id],d=p[t.provider]||{label:t.provider,color:"#666"},u=B[t.id]||o(null);return(0,a.jsxs)("div",{className:"items-center px-4 py-3.5 transition-[background] duration-150 hover:bg-white/[0.02]",style:{display:"grid",gridTemplateColumns:"280px 1fr 100px 48px",borderBottom:s<K.length-1?"1px solid rgba(255,255,255,0.04)":"none"},children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center overflow-hidden shrink-0",children:(0,a.jsx)(i.default,{src:`/providers/${t.provider}.png`,alt:t.provider,width:32,height:32,className:"object-contain",sizes:"32px"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"text-[13px] font-semibold text-text-main truncate",children:t.name||d.label}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mt-0.5",children:[(0,a.jsx)("span",{title:l?.plan?`Raw plan: ${l.plan}`:"No plan from provider",children:(0,a.jsx)(x.default,{variant:u.variant,size:"sm",dot:!0,children:u.label})}),(0,a.jsx)("span",{className:"text-[11px] text-text-muted",children:d.label})]})]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-x-3 gap-y-1.5 pr-3",children:n?(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-text-muted text-xs",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[14px]",children:"progress_activity"}),"Loading..."]}):c?(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-red-500",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,a.jsx)("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap max-w-[300px]",children:c})]}):l?.message&&(!l.quotas||0===l.quotas.length)?(0,a.jsx)("div",{className:"text-xs text-text-muted italic",children:l.message}):l?.quotas?.length>0?l.quotas.map((e,t)=>{var s,l,r;let n=void 0!==e.remainingPercentage?Math.round(e.remainingPercentage):(s=e.used,(l=e.total)&&0!==l?!s||s<0?100:s>=l?0:Math.round((l-s)/l*100):0),i=n>70?{bar:"#22c55e",text:"#22c55e",bg:"rgba(34,197,94,0.12)"}:n>=30?{bar:"#eab308",text:"#eab308",bg:"rgba(234,179,8,0.12)"}:{bar:"#ef4444",text:"#ef4444",bg:"rgba(239,68,68,0.12)"},c=function(e){if(!e)return null;try{let t=new Date(e)-new Date;if(t<=0)return null;let s=Math.floor(t/36e5),a=Math.floor(t%36e5/6e4);if(s>=24){let e=Math.floor(s/24);return`${e}d ${s%24}h`}return`${s}h ${a}m`}catch{return null}}(e.resetAt),o={"gemini-3-pro-high":"G3 Pro","gemini-3-pro-low":"G3 Pro Low","gemini-3-flash":"G3 Flash","gemini-2.5-flash":"G2.5 Flash","claude-opus-4-6-thinking":"Opus 4.6 Tk","claude-opus-4-5-thinking":"Opus 4.5 Tk","claude-opus-4-5":"Opus 4.5","claude-sonnet-4-5-thinking":"Sonnet 4.5 Tk","claude-sonnet-4-5":"Sonnet 4.5",chat:"Chat",completions:"Completions",premium_interactions:"Premium",session:"Session",weekly:"Weekly",agentic_request:"Agentic",agentic_request_freetrial:"Agentic (Trial)"}[r=e.name]||r;return(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-[200px] shrink-0",children:[(0,a.jsx)("span",{className:"text-[11px] font-semibold py-0.5 px-2 rounded whitespace-nowrap min-w-[60px] text-center",style:{background:i.bg,color:i.text},children:o}),c&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted whitespace-nowrap",children:["⏱ ",c]}),(0,a.jsx)("div",{className:"flex-1 h-1.5 rounded-sm bg-white/[0.06] min-w-[60px] overflow-hidden",children:(0,a.jsx)("div",{className:"h-full rounded-sm transition-[width] duration-300 ease-out",style:{width:`${Math.min(n,100)}%`,background:i.bar}})}),(0,a.jsxs)("span",{className:"text-[11px] font-semibold min-w-[32px] text-right",style:{color:i.text},children:[n,"%"]})]},t)}):(0,a.jsx)("div",{className:"text-xs text-text-muted italic",children:e("noQuotaData")})}),(0,a.jsx)("div",{className:"text-center text-[11px] text-text-muted",children:k?(0,a.jsx)("span",{children:k.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}):"-"}),(0,a.jsx)("div",{className:"flex justify-center gap-0.5",children:(0,a.jsx)("button",{onClick:()=>O(t.id,t.provider),disabled:n,title:"Refresh quota",className:"p-1 rounded-md border-none bg-transparent cursor-pointer disabled:cursor-not-allowed disabled:opacity-30 opacity-60 hover:opacity-100 flex items-center justify-center transition-opacity duration-150",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] text-text-muted ${n?"animate-spin":""}`,children:"refresh"})})})]},t.id)}),0===K.length&&(0,a.jsxs)("div",{className:"py-6 px-4 text-center text-text-muted text-[13px]",children:["No accounts found for tier filter"," ",(0,a.jsx)("strong",{children:h.find(e=>e.key===M)?.label||M}),"."]})]})]})}function b(){let e=(0,n.c)("usage"),[t,s]=(0,l.useState)({lockouts:[],cacheStats:null}),[i,c]=(0,l.useState)(!0),o=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/rate-limits");e.ok&&s(await e.json())}catch{}finally{c(!1)}},[]);return(0,l.useEffect)(()=>{o();let e=setInterval(o,1e4);return()=>clearInterval(e)},[o]),(0,a.jsx)("div",{className:"flex flex-col gap-4",children:(0,a.jsxs)(r.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-orange-500/10 text-orange-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"lock_clock"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Model Lockouts"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Per-model rate limit locks • Auto-refresh 10s"})]}),t.lockouts.length>0&&(0,a.jsxs)("span",{className:"px-2.5 py-1 rounded-full text-xs font-semibold bg-orange-500/10 text-orange-400 border border-orange-500/20",children:[t.lockouts.length," locked"]})]}),0===t.lockouts.length?(0,a.jsxs)("div",{className:"text-center py-6 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px] mb-2 block opacity-40",children:"lock_open"}),(0,a.jsx)("p",{className:"text-sm",children:e("noLockouts")})]}):(0,a.jsx)("div",{className:"flex flex-col gap-2",children:t.lockouts.map((e,t)=>{var s;return(0,a.jsxs)("div",{className:"flex items-center justify-between px-3 py-2.5 rounded-lg bg-orange-500/5 border border-orange-500/15",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-orange-400",children:"lock"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:e.model}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Account:"," ",(0,a.jsx)("span",{className:"font-mono",children:e.accountId?.slice(0,12)||"N/A"}),e.reason&&(0,a.jsxs)(a.Fragment,{children:[" — ",e.reason]})]})]})]}),(0,a.jsxs)("span",{className:"text-xs font-mono tabular-nums text-orange-400",children:[(s=e.remainingMs)<1e3?`${s}ms`:s<6e4?`${Math.ceil(s/1e3)}s`:`${Math.ceil(s/6e4)}m`," left"]})]},t)})})]})})}function g(){let e=(0,n.c)("usage"),[t,s]=(0,l.useState)({count:0,sessions:[]}),[i,c]=(0,l.useState)(!0),o=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/sessions");e.ok&&s(await e.json())}catch{}finally{c(!1)}},[]);return(0,l.useEffect)(()=>{o();let e=setInterval(o,5e3);return()=>clearInterval(e)},[o]),(0,a.jsxs)(r.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-cyan-500/10 text-cyan-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"fingerprint"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:e("activeSessions")}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Tracked via request fingerprinting • Auto-refresh 5s"})]}),(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsxs)("span",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-cyan-500/10 border border-cyan-500/20",children:[(0,a.jsx)("span",{className:"w-2 h-2 rounded-full bg-cyan-500 animate-pulse"}),(0,a.jsx)("span",{className:"text-sm font-semibold tabular-nums text-cyan-400",children:t.count})]})})]}),0===t.sessions.length?(0,a.jsxs)("div",{className:"text-center py-8 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[40px] mb-2 block opacity-40",children:"fingerprint"}),(0,a.jsx)("p",{className:"text-sm",children:e("noSessions")}),(0,a.jsx)("p",{className:"text-xs mt-1",children:e("sessionsHint")})]}):(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-border/30",children:[(0,a.jsx)("th",{className:"text-left py-2 px-3 text-xs font-semibold text-text-muted uppercase tracking-wider",children:e(">session</")}),(0,a.jsx)("th",{className:"text-left py-2 px-3 text-xs font-semibold text-text-muted uppercase tracking-wider",children:e(">age</")}),(0,a.jsx)("th",{className:"text-right py-2 px-3 text-xs font-semibold text-text-muted uppercase tracking-wider",children:e(">requests</")}),(0,a.jsx)("th",{className:"text-left py-2 px-3 text-xs font-semibold text-text-muted uppercase tracking-wider",children:e(">connection</")})]})}),(0,a.jsx)("tbody",{children:t.sessions.map(e=>{var t;return(0,a.jsxs)("tr",{className:"border-b border-border/10 hover:bg-surface/20 transition-colors",children:[(0,a.jsx)("td",{className:"py-2.5 px-3",children:(0,a.jsxs)("span",{className:"font-mono text-xs px-2 py-1 rounded bg-surface/40 text-text-muted",children:[e.sessionId.slice(0,12),"…"]})}),(0,a.jsx)("td",{className:"py-2.5 px-3 text-text-muted tabular-nums",children:(t=e.ageMs)<6e4?`${Math.floor(t/1e3)}s`:t<36e5?`${Math.floor(t/6e4)}m`:`${Math.floor(t/36e5)}h`}),(0,a.jsx)("td",{className:"py-2.5 px-3 text-right",children:(0,a.jsx)("span",{className:"font-semibold tabular-nums",children:e.requestCount})}),(0,a.jsx)("td",{className:"py-2.5 px-3",children:e.connectionId?(0,a.jsx)("span",{className:"text-xs font-mono text-cyan-400",children:e.connectionId.slice(0,10)}):(0,a.jsx)("span",{className:"text-text-muted/40",children:"—"})})]},e.sessionId)})})]})})]})}function j(){return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(r.Qv,{}),children:(0,a.jsx)(f,{})}),(0,a.jsx)(b,{}),(0,a.jsx)(g,{})]})}}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=39387)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8013],{53586:(e,t,r)=>{Promise.resolve().then(r.bind(r,58802))},58802:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>x});var l=r(95155),a=r(12115),o=r(40993),s=r(50910);let n={debug:"text-gray-400",trace:"text-gray-500",info:"text-cyan-400",warn:"text-yellow-400",error:"text-red-400",fatal:"text-fuchsia-400"},c={debug:"bg-gray-500/10 border-gray-500/20",trace:"bg-gray-500/10 border-gray-500/20",info:"bg-cyan-500/10 border-cyan-500/20",warn:"bg-yellow-500/10 border-yellow-500/20",error:"bg-red-500/10 border-red-500/20",fatal:"bg-fuchsia-500/10 border-fuchsia-500/20"};function i(){let e=(0,s.c)("loggers"),[t,r]=(0,a.useState)([]),[o,i]=(0,a.useState)(!0),[d,x]=(0,a.useState)(null),[u,m]=(0,a.useState)("all"),[p,b]=(0,a.useState)(""),[g,h]=(0,a.useState)(!0),[v,f]=(0,a.useState)(null),[y,j]=(0,a.useState)(null),N=(0,a.useRef)(null),w=(0,a.useCallback)(async()=>{try{let e=new URLSearchParams;"all"!==u&&e.set("level",u),e.set("limit","500");let t=await fetch(`/api/logs/console?${e.toString()}`);if(!t.ok)throw Error(`HTTP ${t.status}`);let l=await t.json();r(l),f(new Date),x(null)}catch(e){x(e.message||"Failed to fetch logs")}finally{i(!1)}},[u]);(0,a.useEffect)(()=>{w();let e=setInterval(w,5e3);return()=>clearInterval(e)},[w]),(0,a.useEffect)(()=>{g&&N.current&&(N.current.scrollTop=N.current.scrollHeight)},[t,g]);let S=p?t.filter(e=>JSON.stringify(e).toLowerCase().includes(p.toLowerCase())):t;return(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-3 p-4 rounded-xl bg-[var(--color-surface)] border border-[var(--color-border)]",children:[(0,l.jsxs)("select",{value:u,onChange:e=>m(e.target.value),"aria-label":"Filter by log level",className:"px-3 py-2 rounded-lg text-sm bg-[var(--color-bg)] border border-[var(--color-border)] text-[var(--color-text-main)] focus:outline-2 focus:outline-[var(--color-accent)]",children:[(0,l.jsx)("option",{value:"all",children:e("allLevels")}),(0,l.jsx)("option",{value:"debug",children:"Debug+"}),(0,l.jsx)("option",{value:"info",children:"Info+"}),(0,l.jsx)("option",{value:"warn",children:"Warn+"}),(0,l.jsx)("option",{value:"error",children:"Error+"})]}),(0,l.jsx)("input",{type:"text",placeholder:"Search logs...",value:p,onChange:e=>b(e.target.value),"aria-label":"Search log entries",className:"flex-1 min-w-[200px] 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,l.jsxs)("button",{onClick:()=>h(!g),title:g?"Disable auto-scroll":"Enable auto-scroll",className:`px-3 py-2 rounded-lg text-sm font-medium border transition-colors ${g?"bg-cyan-500/15 text-cyan-400 border-cyan-500/30":"bg-[var(--color-bg)] text-[var(--color-text-muted)] border-[var(--color-border)]"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] align-middle mr-1",children:g?"vertical_align_bottom":"lock"}),"Auto-scroll"]}),(0,l.jsx)("button",{onClick:w,disabled:o,className:"px-3 py-2 rounded-lg text-sm font-medium bg-[var(--color-bg)] border border-[var(--color-border)] text-[var(--color-text-main)] hover:bg-[var(--color-bg-alt)] disabled:opacity-50 transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] align-middle",children:"refresh"})}),(0,l.jsxs)("div",{className:"flex items-center gap-2 ml-auto text-xs text-[var(--color-text-muted)]",children:[(0,l.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-green-500 animate-pulse"}),(0,l.jsxs)("span",{children:[S.length," entries"]}),(0,l.jsx)("span",{className:"text-[var(--color-text-muted)]/50",children:"•"}),(0,l.jsx)("span",{children:"Last 1h"}),v&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"text-[var(--color-text-muted)]/50",children:"•"}),(0,l.jsxs)("span",{children:["Updated ",v.toLocaleTimeString()]})]})]})]}),d&&(0,l.jsxs)("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",role:"alert",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] align-middle mr-2",children:"error"}),d,(0,l.jsx)("span",{className:"text-xs ml-2 opacity-70",children:"— Make sure the application is writing logs to file (LOG_TO_FILE=true)"})]}),(0,l.jsxs)("div",{ref:N,className:"rounded-xl border border-[var(--color-border)] bg-[#0d1117] overflow-auto font-mono text-xs leading-relaxed",style:{maxHeight:"calc(100vh - 340px)",minHeight:"400px"},role:"log","aria-label":"Application console logs","aria-live":"polite",children:[(0,l.jsxs)("div",{className:"sticky top-0 z-10 px-4 py-2 bg-[#161b22] border-b border-[#30363d] flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FF5F56]"}),(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]"}),(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]"}),(0,l.jsx)("span",{className:"ml-3 text-[#8b949e] text-[11px]",children:"OmniRoute — Application Console"})]}),(0,l.jsxs)("div",{className:"p-3 space-y-px",children:[0!==S.length||o?S.map((e,t)=>{let r=(e.level||"info").toLowerCase(),a=n[r]||n.info,o=c[r]||"",s=e.component||e.module||"",i=e.msg||e.message||"";return(0,l.jsxs)("div",{className:`group flex items-start gap-2 px-2 py-1 rounded hover:bg-white/5 transition-colors ${"error"===r||"fatal"===r?"bg-red-500/5":""}`,children:[(0,l.jsx)("span",{className:"text-[#484f58] whitespace-nowrap shrink-0 select-none",children:(e=>{try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3})}catch{return e}})(e.timestamp)}),(0,l.jsx)("span",{className:`inline-block px-1.5 py-0 rounded text-[10px] font-semibold uppercase border shrink-0 ${a} ${o}`,children:r.padEnd(5)}),s&&(0,l.jsxs)("span",{className:"text-purple-400/80 shrink-0",children:["[",s,"]"]}),(0,l.jsxs)("span",{className:"text-[#c9d1d9] flex-1 break-all",children:[i,e.correlationId&&(0,l.jsxs)("span",{className:"text-[#484f58] ml-2",children:["cid:",e.correlationId.slice(0,8)]})]}),(0,l.jsx)("button",{onClick:()=>{let r;return r=JSON.stringify(e,null,2),void navigator.clipboard.writeText(r).then(()=>{j(t),setTimeout(()=>j(null),2e3)})},title:"Copy log entry",className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0 text-[#8b949e] hover:text-white",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:y===t?"check":"content_copy"})})]},t)}):(0,l.jsxs)("div",{className:"text-[#8b949e] text-center py-12",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[40px] block mb-2 opacity-30",children:"terminal"}),(0,l.jsx)("p",{children:e("noLogEntries")}),(0,l.jsx)("p",{className:"text-[10px] mt-1 opacity-60",children:"Ensure LOG_TO_FILE=true is set in your .env file"})]}),o&&0===S.length&&(0,l.jsxs)("div",{className:"text-[#8b949e] text-center py-12",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[24px] animate-spin block mb-2",children:"progress_activity"}),"Loading logs..."]})]})]})]})}function d(){let[e,t]=(0,a.useState)([]),[r,o]=(0,a.useState)(!0),[n,c]=(0,a.useState)(null),[i,d]=(0,a.useState)(""),[x,u]=(0,a.useState)(""),[m,p]=(0,a.useState)(0),[b,g]=(0,a.useState)(!1),h=(0,s.c)("logs"),v=(0,a.useCallback)(async()=>{o(!0),c(null);try{let e=new URLSearchParams;i&&e.set("action",i),x&&e.set("actor",x),e.set("limit",String(26)),e.set("offset",String(m));let r=await fetch(`/api/compliance/audit-log?${e.toString()}`);if(!r.ok)throw Error(`HTTP ${r.status}`);let l=await r.json();g(l.length>25),t(l.slice(0,25))}catch(e){c(e.message||"Failed to fetch audit log")}finally{o(!1)}},[i,x,m]);(0,a.useEffect)(()=>{v()},[v]);let f=()=>{p(0),v()};return(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-xl font-bold text-[var(--color-text-main)]",children:h("auditLog")}),(0,l.jsx)("p",{className:"text-sm text-[var(--color-text-muted)] mt-1",children:h("auditLogDesc")})]}),(0,l.jsx)("button",{onClick:v,disabled:r,"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:h(r?"loading":"refresh")})]}),(0,l.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,l.jsx)("input",{type:"text",placeholder:h("filterByAction"),value:i,onChange:e=>d(e.target.value),onKeyDown:e=>"Enter"===e.key&&f(),"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,l.jsx)("input",{type:"text",placeholder:h("filterByActor"),value:x,onChange:e=>u(e.target.value),onKeyDown:e=>"Enter"===e.key&&f(),"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,l.jsx)("button",{onClick:f,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:h("search")})]}),n&&(0,l.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,l.jsx)("div",{className:"overflow-x-auto rounded-xl border border-[var(--color-border)]",children:(0,l.jsxs)("table",{className:"w-full text-sm",role:"table","aria-label":"Audit log entries",children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{className:"bg-[var(--color-bg-alt)] border-b border-[var(--color-border)]",children:[(0,l.jsx)("th",{className:"text-left px-4 py-3 font-medium text-[var(--color-text-muted)]",children:h("timestamp")}),(0,l.jsx)("th",{className:"text-left px-4 py-3 font-medium text-[var(--color-text-muted)]",children:h("action")}),(0,l.jsx)("th",{className:"text-left px-4 py-3 font-medium text-[var(--color-text-muted)]",children:h("actor")}),(0,l.jsx)("th",{className:"text-left px-4 py-3 font-medium text-[var(--color-text-muted)]",children:h("target")}),(0,l.jsx)("th",{className:"text-left px-4 py-3 font-medium text-[var(--color-text-muted)]",children:h("details")}),(0,l.jsx)("th",{className:"text-left px-4 py-3 font-medium text-[var(--color-text-muted)]",children:"IP"})]})}),(0,l.jsx)("tbody",{children:0!==e.length||r?e.map(e=>{var t;return(0,l.jsxs)("tr",{className:"border-b border-[var(--color-border)] hover:bg-[var(--color-bg-alt)] transition-colors",children:[(0,l.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,l.jsx)("td",{className:"px-4 py-3",children:(0,l.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,l.jsx)("td",{className:"px-4 py-3 text-[var(--color-text-main)]",children:e.actor}),(0,l.jsx)("td",{className:"px-4 py-3 text-[var(--color-text-muted)] max-w-[200px] truncate",children:e.target||"—"}),(0,l.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,l.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,l.jsx)("tr",{children:(0,l.jsx)("td",{colSpan:6,className:"px-4 py-8 text-center text-[var(--color-text-muted)]",children:h("noEntries")})})})]})}),(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("p",{className:"text-xs text-[var(--color-text-muted)]",children:["Showing ",e.length," entries (offset ",m,")"]}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsxs)("button",{onClick:()=>p(Math.max(0,m-25)),disabled:0===m,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:["← ",h("previous")]}),(0,l.jsxs)("button",{onClick:()=>p(m+25),disabled:!b,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:[h("next")," →"]})]})]})]})}function x(){let[e,t]=(0,a.useState)("request-logs"),r=(0,s.c)("logs");return(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsx)(o.Iz,{options:[{value:"request-logs",label:r("requestLogs")},{value:"proxy-logs",label:r("proxyLogs")},{value:"audit-logs",label:r("auditLog")},{value:"console",label:r("console")}],value:e,onChange:t}),"request-logs"===e&&(0,l.jsx)(o.y7,{}),"proxy-logs"===e&&(0,l.jsx)(o.Lo,{}),"audit-logs"===e&&(0,l.jsx)(d,{}),"console"===e&&(0,l.jsx)(i,{})]})}}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=53586)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9971],{4051:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>d});var r=s(95155),i=s(12115),a=s(73321),n=s(50910);let o=["welcome","security","provider","test","done"],c=["waving_hand","lock","dns","play_circle","check_circle"],l=[{id:"openai",name:"OpenAI",color:"#10A37F"},{id:"anthropic",name:"Anthropic",color:"#D97757"},{id:"google",name:"Google AI",color:"#4285F4"},{id:"openrouter",name:"OpenRouter",color:"#6B21A8"},{id:"groq",name:"Groq",color:"#F55036"},{id:"mistral",name:"Mistral",color:"#FF7000"}];function d(){let e=(0,a.useRouter)(),t=(0,n.c)("onboarding"),s=(0,n.c)("common"),[d,m]=(0,i.useState)(0),[x,u]=(0,i.useState)(!0),[p,h]=(0,i.useState)(""),[g,b]=(0,i.useState)(""),[y,f]=(0,i.useState)(!1),[j,N]=(0,i.useState)(null),[v,w]=(0,i.useState)(""),[k,C]=(0,i.useState)(""),[P,S]=(0,i.useState)(""),[O,_]=(0,i.useState)("idle"),[A,T]=(0,i.useState)("");(0,i.useEffect)(()=>{(async()=>{try{let t=await fetch("/api/settings");if(t.ok&&(await t.json()).setupComplete)return void e.replace("/dashboard")}catch{}u(!1)})()},[e]);let E=o.map((e,s)=>({id:e,title:t("done"===e?"ready":e),icon:c[s]})),F=E[d],R=d===E.length-1,q=()=>{d<E.length-1&&m(d+1)},[D,$]=(0,i.useState)(""),I=async()=>{if(y)return void q();if(p===g){$("");try{let e=await fetch("/api/settings/require-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireLogin:!0,password:p})});if(!e.ok){let s=await e.json().catch(()=>({}));$(s.error||t("failedSetPassword"));return}q()}catch{$(t("connectionError"))}}},J=async()=>{if(j&&k){$("");try{let e=l.find(e=>e.id===j),s=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:j,name:P||e?.name||j,url:v||({openai:"https://api.openai.com",anthropic:"https://api.anthropic.com",google:"https://generativelanguage.googleapis.com",openrouter:"https://openrouter.ai/api",groq:"https://api.groq.com/openai",mistral:"https://api.mistral.ai"})[j]||"",apiKey:k,isActive:!0})});if(!s.ok){let e=await s.json().catch(()=>({}));$(e.error||t("failedAddProvider"));return}q()}catch{$(t("connectionError"))}}},K=async()=>{_("testing"),T(t("testingConnection"));try{let e=await fetch("/api/providers");if(!e.ok)throw Error("Failed to fetch");let s=await e.json(),r=s.connections?.[0];if(!r){_("error"),T(t("noProviderFound"));return}let i=await fetch(`/api/providers/${r.id}/test`,{method:"POST"});if(i.ok)_("success"),T(t("connectionSuccessful"));else{let e=await i.json().catch(()=>({}));_("error"),T(e.error||t("testFailed"))}}catch{_("error"),T(t("couldNotTest"))}},M=async()=>{try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({setupComplete:!0})})}catch{}e.push("/dashboard")};return x?(0,r.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-bg",children:(0,r.jsx)("div",{className:"animate-pulse text-text-muted",children:s("loading")})}):(0,r.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-bg p-4",children:(0,r.jsxs)("div",{className:"w-full max-w-lg",children:[(0,r.jsx)("div",{className:"flex items-center justify-center gap-2 mb-8",children:E.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-semibold transition-all duration-300 ${t<d?"bg-green-500/20 text-green-400":t===d?"bg-primary/20 text-primary ring-2 ring-primary/40":"bg-white/5 text-text-muted"}`,children:t<d?(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"check"}):t+1}),t<E.length-1&&(0,r.jsx)("div",{className:`w-8 h-0.5 rounded-full transition-colors ${t<d?"bg-green-500/40":"bg-white/10"}`})]},e.id))}),(0,r.jsxs)("div",{className:"bg-surface rounded-2xl border border-white/[0.06] p-8 shadow-xl",children:[(0,r.jsxs)("div",{className:"text-center mb-6",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[48px] mb-3 block ${"done"===F.id?"text-green-400":"text-primary"}`,children:F.icon}),(0,r.jsx)("h2",{className:"text-2xl font-bold text-text-main mb-1",children:F.title})]}),(0,r.jsxs)("div",{className:"min-h-[200px]",children:["welcome"===F.id&&(0,r.jsxs)("div",{className:"text-center space-y-4",children:[(0,r.jsxs)("p",{className:"text-text-muted",children:[(0,r.jsx)("strong",{className:"text-text-main",children:"OmniRoute"})," ",t("welcomeDesc").replace("OmniRoute is your local AI API proxy. ","")]}),(0,r.jsx)("div",{className:"grid grid-cols-3 gap-3 mt-6",children:[{icon:"swap_horiz",label:t("multiProvider")},{icon:"monitoring",label:t("usageTracking")},{icon:"shield",label:t("apiKeyMgmt")}].map(e=>(0,r.jsxs)("div",{className:"bg-white/[0.03] rounded-xl p-3 text-center border border-white/[0.06]",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-[24px] mb-1 block",children:e.icon}),(0,r.jsx)("span",{className:"text-xs text-text-muted",children:e.label})]},e.icon))})]}),"security"===F.id&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted text-center",children:t("securityDesc")}),(0,r.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer text-sm text-text-muted",children:[(0,r.jsx)("input",{type:"checkbox",checked:y,onChange:e=>f(e.target.checked),className:"accent-primary"}),t("skipPassword")]}),!y&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("input",{type:"password",placeholder:t("enterPassword"),value:p,onChange:e=>h(e.target.value),className:"w-full px-4 py-2.5 bg-white/[0.04] border border-white/10 rounded-lg text-text-main text-sm placeholder:text-text-muted/50 focus:outline-none focus:ring-2 focus:ring-primary/40"}),(0,r.jsx)("input",{type:"password",placeholder:t("confirmPasswordPlaceholder"),value:g,onChange:e=>b(e.target.value),className:"w-full px-4 py-2.5 bg-white/[0.04] border border-white/10 rounded-lg text-text-main text-sm placeholder:text-text-muted/50 focus:outline-none focus:ring-2 focus:ring-primary/40"}),p&&g&&p!==g&&(0,r.jsx)("p",{className:"text-xs text-red-400",children:t("passwordsMismatch")})]})]}),"provider"===F.id&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted text-center",children:t("providerDesc")}),(0,r.jsx)("div",{className:"grid grid-cols-3 gap-2",children:l.map(e=>(0,r.jsx)("button",{onClick:()=>{N(e.id),S(e.name)},className:`p-3 rounded-xl border text-center text-xs font-medium transition-all cursor-pointer ${j===e.id?"border-primary/60 bg-primary/10 text-primary":"border-white/10 bg-white/[0.03] text-text-muted hover:border-white/20"}`,children:e.name},e.id))}),j&&(0,r.jsxs)("div",{className:"space-y-3 mt-4",children:[(0,r.jsx)("input",{type:"password",placeholder:t("apiKeyRequired"),value:k,onChange:e=>C(e.target.value),className:"w-full px-4 py-2.5 bg-white/[0.04] border border-white/10 rounded-lg text-text-main text-sm placeholder:text-text-muted/50 focus:outline-none focus:ring-2 focus:ring-primary/40"}),(0,r.jsx)("input",{type:"text",placeholder:t("customUrlOptional"),value:v,onChange:e=>w(e.target.value),className:"w-full px-4 py-2.5 bg-white/[0.04] border border-white/10 rounded-lg text-text-main text-sm placeholder:text-text-muted/50 focus:outline-none focus:ring-2 focus:ring-primary/40"})]})]}),"test"===F.id&&(0,r.jsxs)("div",{className:"text-center space-y-4",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted",children:t("testDesc")}),"idle"===O&&(0,r.jsx)("button",{onClick:K,className:"px-6 py-2.5 bg-primary rounded-lg text-white font-medium text-sm hover:bg-primary/90 transition-colors cursor-pointer",children:t("runTest")}),"testing"===O&&(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin text-[20px]",children:"progress_activity"}),(0,r.jsx)("span",{className:"text-sm",children:A})]}),"success"===O&&(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 text-green-400",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"check_circle"}),(0,r.jsx)("span",{className:"text-sm",children:A})]}),"error"===O&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 text-amber-400",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"warning"}),(0,r.jsx)("span",{className:"text-sm",children:A})]}),(0,r.jsx)("button",{onClick:K,className:"text-xs text-text-muted underline cursor-pointer",children:t("retry")})]})]}),"done"===F.id&&(0,r.jsxs)("div",{className:"text-center space-y-4",children:[(0,r.jsx)("p",{className:"text-text-muted",children:t("doneDesc")}),(0,r.jsxs)("div",{className:"bg-white/[0.03] rounded-xl p-4 border border-white/[0.06] text-left",children:[(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2 font-medium",children:t("yourEndpoint")}),(0,r.jsx)("code",{className:"text-sm text-primary",children:"http://localhost:20128/api/v1"})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mt-8 pt-6 border-t border-white/[0.06]",children:[(0,r.jsx)("div",{children:d>0&&!R&&(0,r.jsx)("button",{onClick:()=>{d>0&&m(d-1)},className:"px-4 py-2 text-sm text-text-muted hover:text-text-main transition-colors cursor-pointer",children:s("back")})}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[!R&&d>0&&(0,r.jsx)("button",{onClick:q,className:"px-4 py-2 text-sm text-text-muted hover:text-text-main transition-colors cursor-pointer",children:t("skip")}),"welcome"===F.id&&(0,r.jsx)("button",{onClick:q,className:"px-6 py-2.5 bg-primary rounded-lg text-white font-medium text-sm hover:bg-primary/90 transition-colors cursor-pointer",children:t("getStarted")}),"security"===F.id&&(0,r.jsx)("button",{onClick:I,disabled:!y&&(!p||p!==g),className:"px-6 py-2.5 bg-primary rounded-lg text-white font-medium text-sm hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",children:y?t("skipAndContinue"):t("setPassword")}),"provider"===F.id&&(0,r.jsx)("button",{onClick:J,disabled:!j||!k,className:"px-6 py-2.5 bg-primary rounded-lg text-white font-medium text-sm hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",children:t("addProvider")}),"test"===F.id&&(0,r.jsx)("button",{onClick:q,className:"px-6 py-2.5 bg-primary rounded-lg text-white font-medium text-sm hover:bg-primary/90 transition-colors cursor-pointer",children:"success"===O?t("continue"):t("skip")}),R&&(0,r.jsx)("button",{onClick:M,className:"px-6 py-2.5 bg-green-500 rounded-lg text-white font-medium text-sm hover:bg-green-500/90 transition-colors cursor-pointer",children:t("goToDashboard")})]})]})]}),!R&&(0,r.jsx)("div",{className:"text-center mt-4",children:(0,r.jsx)("button",{onClick:M,className:"text-xs text-text-muted/60 hover:text-text-muted transition-colors cursor-pointer",children:t("skipWizard")})})]})})}},50910:(e,t,s)=>{"use strict";s.d(t,{c:()=>a});var r=s(33418);function i(e,t){return(...e)=>{try{return t(...e)}catch{throw Error(void 0)}}}let a=i(0,r.c3);i(0,r.kc)},73321:(e,t,s)=>{"use strict";var r=s(74645);s.o(r,"useParams")&&s.d(t,{useParams:function(){return r.useParams}}),s.o(r,"usePathname")&&s.d(t,{usePathname:function(){return r.usePathname}}),s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}}),s.o(r,"useSearchParams")&&s.d(t,{useSearchParams:function(){return r.useSearchParams}})},89848:(e,t,s)=>{Promise.resolve().then(s.bind(s,4051))}},e=>{e.O(0,[3418,8441,3794,7358],()=>e(e.s=89848)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6337],{7153:(e,s,t)=>{Promise.resolve().then(t.bind(t,49433))},49433:(e,s,t)=>{"use strict";t.d(s,{default:()=>h});var r=t(95155),l=t(50910),a=t(12115),i=t(14051),n=t.n(i),o=t(5772),d=t(98500),c=t.n(d),x=t(73321),m=t(40993),u=t(20909),p=t(67671);function h({machineId:e}){let s=(0,l.c)("home"),t=(0,l.c)("common"),[i,n]=(0,a.useState)([]),[o,d]=(0,a.useState)([]),[x,p]=(0,a.useState)(!0),[h,g]=(0,a.useState)("/v1"),[j,v]=(0,a.useState)(null),[N,y]=(0,a.useState)({});(0,a.useEffect)(()=>{g(`${window.location.origin}/v1`)},[]);let k=(0,a.useCallback)(async()=>{try{let[e,s,t]=await Promise.all([fetch("/api/providers"),fetch("/api/models"),fetch("/api/provider-metrics")]);if(e.ok){let s=await e.json();n(s.connections||[])}if(s.ok){let e=await s.json();d(e.models||[])}if(t.ok){let e=await t.json();y(e.metrics||{})}}catch(e){console.log("Error fetching data:",e)}finally{p(!1)}},[]);(0,a.useEffect)(()=>{k()},[k]);let w=(0,a.useMemo)(()=>Object.entries(u.Q2).map(([e,s])=>{let t=i.filter(s=>s.provider===e),r=t.filter(e=>!1!==e.isActive&&("active"===e.testStatus||"success"===e.testStatus||"unknown"===e.testStatus)).length,l=t.filter(e=>!1!==e.isActive&&("error"===e.testStatus||"expired"===e.testStatus||"unavailable"===e.testStatus)).length,a=new Set([e,s.alias].filter(Boolean)),n=o.filter(e=>a.has(e.provider)),d=u.IS[e]?"free":u.zN[e]?"oauth":"apikey";return{id:e,provider:s,total:t.length,connected:r,errors:l,modelCount:n.length,authType:d}}),[i,o]),C=(0,a.useMemo)(()=>{if(!j)return[];let e=new Set([j.id,j.provider?.alias].filter(Boolean));return o.filter(s=>e.has(s.provider))},[j,o]),R=[{label:s("documentation"),href:"/docs",icon:"menu_book"},{label:t("provider")+"s",href:"/dashboard/providers",icon:"dns"},{label:"Combos",href:"/dashboard/combos",icon:"layers"},{label:"Analytics",href:"/dashboard/analytics",icon:"analytics"},{label:s("healthMonitor"),href:"/dashboard/health",icon:"health_and_safety"},{label:"CLI Tools",href:"/dashboard/cli-tools",icon:"terminal"},{label:s("reportIssue"),href:"https://github.com/diegosouzapw/OmniRoute/issues",external:!0,icon:"bug_report"}];return x?(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsx)(m.Qv,{}),(0,r.jsx)(m.Qv,{})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsx)(m.Zp,{children:(0,r.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:s("quickStart")}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:s("quickStartDesc")})]}),(0,r.jsxs)(c(),{href:"/docs",className:"hidden sm:inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border border-border text-text-muted hover:text-text-main hover:bg-bg-subtle transition-colors",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"menu_book"}),s("fullDocs")]})]}),(0,r.jsxs)("ol",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 text-sm",children:[(0,r.jsxs)("li",{className:"rounded-lg border border-border bg-bg-subtle p-4 flex gap-3",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-8 rounded-lg bg-primary/10 text-primary shrink-0",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"key"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"font-semibold",children:s("step1Title")}),(0,r.jsxs)("p",{className:"text-text-muted mt-0.5",children:["Go to"," ",(0,r.jsx)(c(),{href:"/dashboard/endpoint",className:"text-primary hover:underline",children:"Endpoint"})," ","→ Registered Keys. Generate one key per environment."]})]})]}),(0,r.jsxs)("li",{className:"rounded-lg border border-border bg-bg-subtle p-4 flex gap-3",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-8 rounded-lg bg-green-500/10 text-green-500 shrink-0",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"dns"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"font-semibold",children:s("step2Title")}),(0,r.jsxs)("p",{className:"text-text-muted mt-0.5",children:["Add accounts in"," ",(0,r.jsx)(c(),{href:"/dashboard/providers",className:"text-primary hover:underline",children:"Providers"}),". Supports OAuth, API Key, and free tiers."]})]})]}),(0,r.jsxs)("li",{className:"rounded-lg border border-border bg-bg-subtle p-4 flex gap-3",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-8 rounded-lg bg-blue-500/10 text-blue-500 shrink-0",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"link"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"font-semibold",children:s("step3Title")}),(0,r.jsxs)("p",{className:"text-text-muted mt-0.5",children:["Set base URL to"," ",(0,r.jsx)("code",{className:"px-1.5 py-0.5 rounded bg-surface text-xs font-mono",children:h})," ","in your IDE or API client."]})]})]}),(0,r.jsxs)("li",{className:"rounded-lg border border-border bg-bg-subtle p-4 flex gap-3",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-8 rounded-lg bg-amber-500/10 text-amber-500 shrink-0",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"analytics"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"font-semibold",children:s("step4Title")}),(0,r.jsxs)("p",{className:"text-text-muted mt-0.5",children:["Track tokens, cost and errors in"," ",(0,r.jsx)(c(),{href:"/dashboard/usage",className:"text-primary hover:underline",children:"Request Logs"})," ","and"," ",(0,r.jsx)(c(),{href:"/dashboard/analytics",className:"text-primary hover:underline",children:"Analytics"}),"."]})]})]})]}),(0,r.jsx)("div",{className:"flex flex-wrap gap-2",children:R.map(e=>(0,r.jsxs)("a",{href:e.href,target:e.external?"_blank":void 0,rel:e.external?"noopener noreferrer":void 0,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border border-border text-text-muted hover:text-text-main hover:bg-bg-subtle transition-colors",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:e.icon||(e.external?"open_in_new":"arrow_forward")}),e.label]},e.href))})]})}),(0,r.jsxs)(m.Zp,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:s("providersOverview")}),(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:[w.filter(e=>e.total>0).length," configured of"," ",w.length," available providers"]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsxs)("div",{className:"hidden sm:flex items-center gap-3 text-[11px] text-text-muted",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"size-2 rounded-full bg-green-500"})," Free"]}),(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"size-2 rounded-full bg-blue-500"})," OAuth"]}),(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"size-2 rounded-full bg-amber-500"})," API Key"]})]}),(0,r.jsxs)(c(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border border-border text-text-muted hover:text-text-main hover:bg-bg-subtle transition-colors",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"settings"}),"Manage"]})]})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:w.map(e=>(0,r.jsx)(b,{item:e,metrics:N[e.provider.alias]||N[e.id],onClick:()=>v(e)},e.id))})]}),j&&(0,r.jsx)(f,{provider:j,models:C,onClose:()=>v(null)})]})}function b({item:e,metrics:s,onClick:t}){let[i,n]=(0,a.useState)(!1),d=(0,l.c)("common"),c=e.errors>0?"text-red-500":e.connected>0?"text-green-500":"text-text-muted",x={free:{color:"bg-green-500",label:"Free"},oauth:{color:"bg-blue-500",label:"OAuth"},apikey:{color:"bg-amber-500",label:"API Key"}},m=x[e.authType]||x.apikey;return(0,r.jsx)("button",{onClick:t,className:"border border-border rounded-lg p-3 hover:bg-surface/40 transition-colors text-left cursor-pointer w-full",children:(0,r.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,r.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${e.provider.color||"#888"}15`},children:i?(0,r.jsx)("span",{className:"text-[10px] font-bold",style:{color:e.provider.color||"#888"},children:e.provider.textIcon||e.provider.id.slice(0,2).toUpperCase()}):(0,r.jsx)(o.default,{src:`/providers/${e.provider.id}.png`,alt:e.provider.name,width:26,height:26,className:"object-contain rounded-lg",sizes:"26px",onError:()=>n(!0)})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("p",{className:"text-sm font-semibold truncate",children:e.provider.name}),(0,r.jsx)("span",{className:`size-2 rounded-full ${m.color} shrink-0`,title:m.label})]}),(0,r.jsx)("p",{className:`text-xs ${c}`,children:0===e.total?d("notConfigured"):`${e.connected} active \xb7 ${e.errors} error`}),s&&s.totalRequests>0&&(0,r.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:[(0,r.jsx)("span",{className:"text-emerald-500",children:s.totalSuccesses}),"/",s.totalRequests," reqs"]}),(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:[s.successRate,"%"]}),(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:["~",s.avgLatencyMs,"ms"]})]})]}),(0,r.jsxs)("div",{className:"text-right shrink-0",children:[(0,r.jsx)("p",{className:"text-xs font-medium text-text-main",children:e.modelCount}),(0,r.jsx)("p",{className:"text-[10px] text-text-muted",children:"models"})]})]})})}function f({provider:e,models:s,onClose:t}){let[i,n]=(0,a.useState)(null),o=(0,p.i)(),d=(0,x.useRouter)(),c=(0,l.c)("home");(0,l.c)("common");let u=e=>{t(),d.push(e)};return(0,r.jsx)(m.aF,{isOpen:!0,title:`${e.provider.name} — Models`,onClose:t,children:(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"token"}),s.length," model",1!==s.length?"s":""," available",e.total>0&&(0,r.jsxs)("span",{className:"ml-auto text-xs text-green-500",children:["● ",e.connected," connection",1!==e.connected?"s":""," active"]})]}),0===s.length?(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[32px] text-text-muted mb-2",children:"search_off"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:c("noModelsAvailable")}),(0,r.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Configure a connection first in"," ",(0,r.jsx)("button",{onClick:()=>u("/dashboard/providers"),className:"text-primary hover:underline cursor-pointer",children:"Providers"})]})]}):(0,r.jsx)("div",{className:"flex flex-col gap-1 max-h-[400px] overflow-y-auto",children:s.map(e=>(0,r.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg hover:bg-surface/50 transition-colors group",children:[(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("p",{className:"font-mono text-sm text-text-main truncate",children:e.fullModel}),e.alias!==e.model&&(0,r.jsxs)("p",{className:"text-[10px] text-text-muted",children:["alias: ",e.alias]})]}),(0,r.jsx)("button",{onClick:()=>{var s;return s=e.fullModel,void(navigator.clipboard.writeText(s),n(s),o.success(`Copied: ${s}`),setTimeout(()=>n(null),2e3))},className:"shrink-0 ml-2 p-1.5 rounded-lg text-text-muted hover:text-text-main hover:bg-bg-subtle transition-colors opacity-0 group-hover:opacity-100",title:c("copyModelName"),children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:i===e.fullModel?"check":"content_copy"})})]},e.fullModel))}),(0,r.jsxs)("div",{className:"flex gap-2 pt-2 border-t border-border",children:[(0,r.jsxs)(m.$n,{variant:"secondary",fullWidth:!0,size:"sm",onClick:()=>u(`/dashboard/providers/${e.id}`),className:"flex-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"settings"}),c("configureProvider")]}),(0,r.jsx)(m.$n,{variant:"ghost",size:"sm",onClick:t,children:"Close"})]})]})})}h.propTypes={machineId:n().string},b.propTypes={item:n().shape({id:n().string.isRequired,provider:n().shape({id:n().string.isRequired,name:n().string.isRequired,color:n().string,textIcon:n().string,alias:n().string}).isRequired,total:n().number.isRequired,connected:n().number.isRequired,errors:n().number.isRequired,modelCount:n().number.isRequired,authType:n().string.isRequired}).isRequired,metrics:n().shape({totalRequests:n().number,totalSuccesses:n().number,successRate:n().number,avgLatencyMs:n().number}),onClick:n().func.isRequired},f.propTypes={provider:n().object.isRequired,models:n().array.isRequired,onClose:n().func.isRequired}}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=7153)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{56411:(e,t,r)=>{Promise.resolve().then(r.bind(r,88618))},88618:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>y});var s=r(95155),a=r(12115),i=r(67671),l=r(14051),o=r.n(l),n=r(73321),d=r(98500),c=r.n(d),m=r(5772),p=r(50910),u=r(40993),h=r(20909),x=r(81135),f=r(30949);function y(){let e=(0,n.useParams)(),t=(0,n.useRouter)(),r=e.id,[i,l]=(0,a.useState)([]),[o,d]=(0,a.useState)(!0),[y,b]=(0,a.useState)(null),[w,C]=(0,a.useState)(!1),[T,E]=(0,a.useState)(!1),[R,I]=(0,a.useState)(!1),[O,P]=(0,a.useState)(!1),[_,q]=(0,a.useState)(null),[U,D]=(0,a.useState)(null),[F,K]=(0,a.useState)({}),[L,M]=(0,a.useState)(!1),{copied:z,copy:J}=(0,f.C)(),V=(0,p.c)("providers"),W=(0,a.useRef)(!1),B=(0,a.useRef)(!1),[Z,G]=(0,a.useState)(null),[Q,H]=(0,a.useState)(null),[X,Y]=(0,a.useState)(!1),[ee,et]=(0,a.useState)(!1),[er,es]=(0,a.useState)({current:0,total:0,phase:"idle",status:"",logs:[],error:"",importedCount:0}),ea=y?{id:y.id,name:y.name||("anthropic-compatible"===y.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===y.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===y.type?"AC":"OC",apiType:y.apiType,baseUrl:y.baseUrl,type:y.type}:h.IS[r]||h.zN[r]||h.fg[r],ei=!!h.IS[r]||!!h.zN[r],el=(0,x.KC)(r),eo=(0,h.wG)(r),en=(0,h.mq)(r),ed=(0,h.gb)(r),ec=en||ed,em=ec?r:eo,ep=ec?y?.prefix||r:eo,eu=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&K(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),eh=(0,a.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"})]),s=await e.json(),a=await t.json();if(e.ok){let e=(s.connections||[]).filter(e=>e.provider===r);l(e)}if(t.ok){let e=(a.nodes||[]).find(e=>e.id===r)||null;if(!e&&ec)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===r)||null))break}b(e)}}catch(e){console.log("Error fetching connections:",e)}finally{d(!1)}},[r,ec]),ex=async e=>{try{let t=await fetch(`/api/provider-nodes/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(b(s.node),await eh(),P(!1))}catch(e){console.log("Error updating provider node:",e)}};(0,a.useEffect)(()=>{eh(),eu(),fetch("/api/settings/proxy").then(e=>e.ok?e.json():null).then(e=>H(e)).catch(()=>{})},[eh,eu]),(0,a.useEffect)(()=>{o||0!==i.length||!ea||ec||W.current||B.current||(W.current=!0,ei?C(!0):E(!0))},[o]);let ef=async(e,t,r=eo)=>{let s=`${r}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:s,alias:t})});if(e.ok)await eu();else{let t=await e.json();alert(t.error||V("failedSetAlias"))}}catch(e){console.log("Error setting alias:",e)}},ey=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await eu()}catch(e){console.log("Error deleting alias:",e)}},eg=async e=>{if(confirm(V("deleteConnectionConfirm")))try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&l(i.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}},ev=(0,a.useCallback)(()=>{eh(),C(!1)},[eh]),eb=async e=>{try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,...e})});if(t.ok)return await eh(),E(!1),null;let s=await t.json().catch(()=>({}));return s.error?.message||s.error||V("failedSaveConnection")}catch(e){return console.log("Error saving connection:",e),V("failedSaveConnectionRetry")}},ej=async e=>{try{(await fetch(`/api/providers/${_.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await eh(),I(!1))}catch(e){console.log("Error updating connection:",e)}},eN=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&l(r=>r.map(r=>r.id===e?{...r,isActive:t}:r))}catch(e){console.log("Error updating connection status:",e)}},ew=async(e,t)=>{try{(await fetch("/api/rate-limits",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:e,enabled:t})})).ok&&l(r=>r.map(r=>r.id===e?{...r,rateLimitProtection:t}:r))}catch(e){console.error("Error toggling rate limit:",e)}},eC=async e=>{if(e&&!U){D(e);try{let t=await fetch(`/api/providers/${e}/test`,{method:"POST"});if(!t.ok){let e=await t.json().catch(()=>({}));alert(e.error||V("failedRetestConnection"));return}await eh()}catch(e){console.error("Error retesting connection:",e)}finally{D(null)}}},ek=async(e,t)=>{if(e&&t)try{let r=t.priority,s=e.priority;r===s&&(r=i.indexOf(e)>i.indexOf(t)?t.priority-.5:t.priority+.5),await Promise.all([fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:r})}),fetch(`/api/providers/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:s})})]),await eh()}catch(e){console.log("Error swapping priority:",e)}},eS=async()=>{if(X)return;let e=i.find(e=>!1!==e.isActive);if(e){Y(!0),et(!0),es({current:0,total:0,phase:"fetching",status:V("fetchingModels"),logs:[],error:"",importedCount:0});try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void es(e=>({...e,phase:"error",status:V("failedFetchModels"),error:s.error||"Failed to import models"}));let a=s.models||[];if(0===a.length)return void es(e=>({...e,phase:"done",status:V("noModelsFound"),logs:["No models returned from /models endpoint."]}));es(e=>({...e,phase:"importing",total:a.length,status:`Importing 0 of ${a.length} models...`,logs:[`Found ${a.length} models. Starting import...`]}));let i=0;for(let e=0;e<a.length;e++){let t=a[e],s=t.id||t.name||t.model;if(!s)continue;let l=s.split("/"),o=l[l.length-1];es(t=>({...t,current:e+1,status:`Importing ${e+1} of ${a.length} models...`,logs:[...t.logs,`Importing ${s}...`]})),await fetch("/api/provider-models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,modelId:s,modelName:t.name||s,source:"imported"})}),F[o]||await ef(s,o,em),i+=1}await eu(),es(e=>({...e,phase:"done",current:a.length,status:i>0?`Successfully imported ${i} model${1===i?"":"s"}!`:"No new models were added (all already exist).",logs:[...e.logs,i>0?`✓ Done! ${i} model${1===i?"":"s"} imported.`:"No new models were added."],importedCount:i})),i>0&&setTimeout(()=>{window.location.reload()},2e3)}catch(e){console.log("Error importing models:",e),es(t=>({...t,phase:"error",status:V("importFailed"),error:e instanceof Error?e.message:"An unexpected error occurred"}))}finally{Y(!1)}}},eA=async(e,t)=>{et(!0),es({current:0,total:0,phase:"fetching",status:V("fetchingModels"),logs:[],error:"",importedCount:0});try{let r=(await e()).models||[];if(0===r.length)return void es(e=>({...e,phase:"done",status:V("noModelsFound"),logs:["No models returned from /models endpoint."]}));es(e=>({...e,phase:"importing",total:r.length,status:`Importing 0 of ${r.length} models...`,logs:[`Found ${r.length} models. Starting import...`]}));let s=0;for(let e=0;e<r.length;e++){let a=r[e],i=a.id||a.name||a.model;i&&(es(t=>({...t,current:e+1,status:`Importing ${e+1} of ${r.length} models...`,logs:[...t.logs,`Importing ${i}...`]})),await t(a)&&(s+=1))}es(e=>({...e,phase:"done",current:r.length,status:s>0?`Successfully imported ${s} model${1===s?"":"s"}!`:"No new models were added.",logs:[...e.logs,s>0?`✓ Done! ${s} model${1===s?"":"s"} imported.`:"No new models were added."],importedCount:s})),s>0&&setTimeout(()=>{window.location.reload()},2e3)}catch(e){console.log("Error importing models:",e),es(t=>({...t,phase:"error",status:V("importFailed"),error:e instanceof Error?e.message:"An unexpected error occurred"}))}},e$=i.some(e=>!1!==e.isActive);return o?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsx)(u.Qv,{}),(0,s.jsx)(u.Qv,{})]}):ea?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)(c(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),V("backToProviders")]}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)("div",{className:"rounded-lg flex items-center justify-center",style:{backgroundColor:`${ea.color}15`},children:L?(0,s.jsx)("span",{className:"text-sm font-bold",style:{color:ea.color},children:ea.textIcon||ea.id.slice(0,2).toUpperCase()}):(0,s.jsx)(m.default,{src:en&&ea.apiType?"responses"===ea.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":ed?"/providers/anthropic-m.png":`/providers/${ea.id}.png`,alt:ea.name,width:48,height:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",sizes:"48px",onError:()=>M(!0)})}),(0,s.jsxs)("div",{children:[ea.website?(0,s.jsxs)("a",{href:ea.website,target:"_blank",rel:"noopener noreferrer",className:"text-3xl font-semibold tracking-tight hover:underline inline-flex items-center gap-2",style:{color:ea.color},children:[ea.name,(0,s.jsx)("span",{className:"material-symbols-outlined text-lg opacity-60",children:"open_in_new"})]}):(0,s.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:ea.name}),(0,s.jsxs)("p",{className:"text-text-muted",children:[i.length," connection",1===i.length?"":"s"]})]})]})]}),ec&&y&&(0,s.jsxs)(u.Zp,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:ed?V("anthropicCompatibleDetails"):V("openaiCompatibleDetails")}),(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:[ed?V("messagesApi"):"responses"===y.apiType?V("responsesApi"):V("chatCompletions")," ","\xb7 ",(y.baseUrl||"").replace(/\/$/,""),"/",ed?"messages":"responses"===y.apiType?"responses":"chat/completions"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(u.$n,{size:"sm",icon:"add",onClick:()=>E(!0),disabled:i.length>0,children:"Add"}),(0,s.jsx)(u.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>P(!0),children:"Edit"}),(0,s.jsx)(u.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{if(confirm(`Delete this ${ed?"Anthropic":"OpenAI"} Compatible node?`))try{(await fetch(`/api/provider-nodes/${r}`,{method:"DELETE"})).ok&&t.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}},children:"Delete"})]})]}),i.length>0&&(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Only one connection is allowed per compatible node. Add another node if you need more connections."})]}),(0,s.jsxs)(u.Zp,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),!ec&&(0,s.jsx)(u.$n,{size:"sm",icon:"add",onClick:()=>ei?C(!0):E(!0),children:"Add"})]}),0===i.length?(0,s.jsxs)("div",{className:"text-center py-12",children:[(0,s.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:ei?"lock":"key"})}),(0,s.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No connections yet"}),(0,s.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Add your first connection to get started"}),!ec&&(0,s.jsx)(u.$n,{icon:"add",onClick:()=>ei?C(!0):E(!0),children:"Add Connection"})]}):(0,s.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:i.sort((e,t)=>(e.priority||0)-(t.priority||0)).map((e,t)=>(0,s.jsx)(k,{connection:e,isOAuth:ei,isFirst:0===t,isLast:t===i.length-1,onMoveUp:()=>ek(e,i[t-1]),onMoveDown:()=>ek(e,i[t+1]),onToggleActive:t=>eN(e.id,t),onToggleRateLimit:t=>ew(e.id,t),onRetest:()=>eC(e.id),isRetesting:U===e.id,onEdit:()=>{q(e),I(!0)},onDelete:()=>eg(e.id),onReauth:ei?()=>C(!0):void 0,onProxy:()=>G({level:"key",id:e.id,label:e.name||e.email||e.id}),hasProxy:!!Q?.keys?.[e.id]},e.id))})]}),(0,s.jsxs)(u.Zp,{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Available Models"}),(()=>{if(ec)return(0,s.jsx)(N,{providerStorageAlias:em,providerDisplayAlias:ep,modelAliases:F,copied:z,onCopy:J,onSetAlias:ef,onDeleteAlias:ey,connections:i,isAnthropic:ed,onImportWithProgress:eA});if(ea.passthroughModels)return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,s.jsx)(u.$n,{size:"sm",variant:"secondary",icon:"download",onClick:eS,disabled:!e$||X,children:X?V("importingModels"):V("importFromModels")}),!e$&&(0,s.jsx)("span",{className:"text-xs text-text-muted",children:V("addConnectionToImport")})]}),(0,s.jsx)(v,{providerAlias:eo,modelAliases:F,copied:z,onCopy:J,onSetAlias:ef,onDeleteAlias:ey})]});let e=(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,s.jsx)(u.$n,{size:"sm",variant:"secondary",icon:"download",onClick:eS,disabled:!e$||X,children:X?V("importingModels"):V("importFromModels")}),!e$&&(0,s.jsx)("span",{className:"text-xs text-text-muted",children:V("addConnectionToImport")})]});return 0===el.length?(0,s.jsxs)("div",{children:[e,(0,s.jsx)("p",{className:"text-sm text-text-muted",children:V("noModelsConfigured")})]}):(0,s.jsxs)("div",{children:[e,(0,s.jsx)("div",{className:"flex flex-wrap gap-3",children:el.map(e=>{let t=`${em}/${e.id}`,a=`${r}/${e.id}`,i=Object.entries(F).find(([,e])=>e===t||e===a)?.[0];return(0,s.jsx)(g,{model:e,fullModel:`${ep}/${e.id}`,alias:i,copied:z,onCopy:J,onSetAlias:t=>ef(e.id,t,em),onDeleteAlias:()=>ey(i)},e.id)})})]})})(),!ec&&(0,s.jsx)(j,{providerId:r,providerAlias:ep,copied:z,onCopy:J})]}),"kiro"===r?(0,s.jsx)(u.Mh,{isOpen:w,providerInfo:ea,onSuccess:ev,onClose:()=>{B.current=!0,C(!1)}}):"cursor"===r?(0,s.jsx)(u.G9,{isOpen:w,onSuccess:ev,onClose:()=>{B.current=!0,C(!1)}}):(0,s.jsx)(u.LF,{isOpen:w,provider:r,providerInfo:ea,onSuccess:ev,onClose:()=>{B.current=!0,C(!1)}}),(0,s.jsx)(S,{isOpen:T,provider:r,providerName:ea.name,isCompatible:ec,isAnthropic:ed,onSave:eb,onClose:()=>E(!1)}),(0,s.jsx)(A,{isOpen:R,connection:_,onSave:ej,onClose:()=>I(!1)}),ec&&(0,s.jsx)($,{isOpen:O,node:y,onSave:ex,onClose:()=>P(!1),isAnthropic:ed}),Z&&(0,s.jsx)(u.KN,{isOpen:!!Z,onClose:()=>G(null),level:Z.level,levelId:Z.id,levelLabel:Z.label}),(0,s.jsx)(u.aF,{isOpen:ee,onClose:()=>{("done"===er.phase||"error"===er.phase)&&et(!1)},title:"Importing Models",size:"md",closeOnOverlay:!1,showCloseButton:"done"===er.phase||"error"===er.phase,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:["fetching"===er.phase&&(0,s.jsx)("span",{className:"material-symbols-outlined text-primary animate-spin",children:"progress_activity"}),"importing"===er.phase&&(0,s.jsx)("span",{className:"material-symbols-outlined text-primary animate-spin",children:"progress_activity"}),"done"===er.phase&&(0,s.jsx)("span",{className:"material-symbols-outlined text-green-500",children:"check_circle"}),"error"===er.phase&&(0,s.jsx)("span",{className:"material-symbols-outlined text-red-500",children:"error"}),(0,s.jsx)("span",{className:"text-sm font-medium text-text-main",children:er.status})]}),("importing"===er.phase||"done"===er.phase)&&er.total>0&&(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:[er.current," / ",er.total]}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:[Math.round(er.current/er.total*100),"%"]})]}),(0,s.jsx)("div",{className:"w-full h-2.5 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden",children:(0,s.jsx)("div",{className:"h-full rounded-full transition-all duration-300 ease-out",style:{width:`${er.current/er.total*100}%`,background:"done"===er.phase?"linear-gradient(90deg, #22c55e, #16a34a)":"linear-gradient(90deg, var(--color-primary), var(--color-primary-hover, var(--color-primary)))"}})})]}),"fetching"===er.phase&&(0,s.jsx)("div",{className:"w-full h-2.5 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden",children:(0,s.jsx)("div",{className:"h-full rounded-full animate-pulse",style:{width:"60%",background:"linear-gradient(90deg, var(--color-primary), var(--color-primary-hover, var(--color-primary)))"}})}),"error"===er.phase&&er.error&&(0,s.jsx)("div",{className:"p-3 rounded-lg bg-red-500/10 border border-red-500/20",children:(0,s.jsx)("p",{className:"text-sm text-red-400",children:er.error})}),er.logs.length>0&&(0,s.jsx)("div",{className:"max-h-48 overflow-y-auto rounded-lg bg-black/5 dark:bg-white/5 p-3 border border-black/5 dark:border-white/5",children:(0,s.jsx)("div",{className:"flex flex-col gap-1",children:er.logs.map((e,t)=>(0,s.jsx)("p",{className:`text-xs font-mono ${e.startsWith("✓")?"text-green-500 font-semibold":"text-text-muted"}`,children:e},t))})}),"done"===er.phase&&er.importedCount>0&&(0,s.jsx)("p",{className:"text-xs text-text-muted text-center animate-pulse",children:"Page will refresh automatically..."})]})})]}):(0,s.jsxs)("div",{className:"text-center py-20",children:[(0,s.jsx)("p",{className:"text-text-muted",children:V("providerNotFound")}),(0,s.jsx)(c(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:V("backToProviders")})]})}function g({model:e,fullModel:t,alias:r,copied:a,onCopy:i,onSetAlias:l,onDeleteAlias:o}){return(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:"smart_toy"}),(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,s.jsx)("button",{onClick:()=>i(t,`model-${e.id}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:a===`model-${e.id}`?"check":"content_copy"})})]})}function v({providerAlias:e,modelAliases:t,copied:r,onCopy:i,onSetAlias:l,onDeleteAlias:o}){let[n,d]=(0,a.useState)(""),[c,m]=(0,a.useState)(!1),p=Object.entries(t).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,r])=>({modelId:r.replace(`${e}/`,""),fullModel:r,alias:t})),h=async()=>{let e;if(!n.trim()||c)return;let r=n.trim(),s=(e=r.split("/"))[e.length-1];if(t[s])return void alert(`Alias "${s}" already exists. Please use a different model or edit existing alias.`);m(!0);try{await l(r,s),d("")}catch(e){console.log("Error adding model:",e)}finally{m(!1)}};return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"OpenRouter supports any model. Add models and create aliases for quick access."}),(0,s.jsxs)("div",{className:"flex items-end gap-2",children:[(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("label",{htmlFor:"new-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID (from OpenRouter)"}),(0,s.jsx)("input",{id:"new-model-input",type:"text",value:n,onChange:e=>d(e.target.value),onKeyDown:e=>"Enter"===e.key&&h(),placeholder:"anthropic/claude-3-opus",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,s.jsx)(u.$n,{size:"sm",icon:"add",onClick:h,disabled:!n.trim()||c,children:c?"Adding...":"Add"})]}),p.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-3",children:p.map(({modelId:e,fullModel:t,alias:a})=>(0,s.jsx)(b,{modelId:e,fullModel:t,copied:r,onCopy:i,onDeleteAlias:()=>o(a)},t))})]})}function b({modelId:e,fullModel:t,copied:r,onCopy:a,onDeleteAlias:i}){return(0,s.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:"smart_toy"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,s.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,s.jsx)("button",{onClick:()=>a(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:r===`model-${e}`?"check":"content_copy"})})]})]}),(0,s.jsx)("button",{onClick:i,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function j({providerId:e,providerAlias:t,copied:r,onCopy:i}){let[l,o]=(0,a.useState)([]),[n,d]=(0,a.useState)(""),[c,m]=(0,a.useState)(""),[p,h]=(0,a.useState)(!1),[x,f]=(0,a.useState)(!0),y=(0,a.useCallback)(async()=>{try{let t=await fetch(`/api/provider-models?provider=${encodeURIComponent(e)}`);if(t.ok){let e=await t.json();o(e.models||[])}}catch(e){console.error("Failed to fetch custom models:",e)}finally{f(!1)}},[e]);(0,a.useEffect)(()=>{y()},[y]);let g=async()=>{if(n.trim()&&!p){h(!0);try{(await fetch("/api/provider-models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,modelId:n.trim(),modelName:c.trim()||void 0})})).ok&&(d(""),m(""),await y())}catch(e){console.error("Failed to add custom model:",e)}finally{h(!1)}}},v=async t=>{try{await fetch(`/api/provider-models?provider=${encodeURIComponent(e)}&model=${encodeURIComponent(t)}`,{method:"DELETE"}),await y()}catch(e){console.error("Failed to remove custom model:",e)}};return(0,s.jsxs)("div",{className:"mt-6 pt-6 border-t border-border",children:[(0,s.jsxs)("h3",{className:"text-sm font-semibold mb-3 flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-primary",children:"tune"}),"Custom Models"]}),(0,s.jsx)("p",{className:"text-xs text-text-muted mb-3",children:"Add model IDs not in the default list. These will be available for routing."}),(0,s.jsxs)("div",{className:"flex items-end gap-2 mb-3",children:[(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("label",{htmlFor:"custom-model-id",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,s.jsx)("input",{id:"custom-model-id",type:"text",value:n,onChange:e=>d(e.target.value),onKeyDown:e=>"Enter"===e.key&&g(),placeholder:"e.g. gpt-4.5-turbo",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,s.jsxs)("div",{className:"w-40",children:[(0,s.jsx)("label",{htmlFor:"custom-model-name",className:"text-xs text-text-muted mb-1 block",children:"Display Name"}),(0,s.jsx)("input",{id:"custom-model-name",type:"text",value:c,onChange:e=>m(e.target.value),onKeyDown:e=>"Enter"===e.key&&g(),placeholder:"Optional",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,s.jsx)(u.$n,{size:"sm",icon:"add",onClick:g,disabled:!n.trim()||p,children:p?"Adding...":"Add"})]}),x?(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Loading..."}):l.length>0?(0,s.jsx)("div",{className:"flex flex-col gap-2",children:l.map(e=>{let a=`${t}/${e.id}`,l=`custom-${e.id}`;return(0,s.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-primary",children:"tune"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:e.name||e.id}),(0,s.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:a}),(0,s.jsx)("button",{onClick:()=>i(a,l),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:r===l?"check":"content_copy"})})]})]}),(0,s.jsx)("button",{onClick:()=>v(e.id),className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove custom model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]},e.id)})}):(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"No custom models added yet."})]})}function N({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:r,copied:l,onCopy:o,onSetAlias:n,onDeleteAlias:d,connections:c,isAnthropic:m,onImportWithProgress:p}){let[h,x]=(0,a.useState)(""),[f,y]=(0,a.useState)(!1),[g,v]=(0,a.useState)(!1),j=(0,i.i)(),N=Object.entries(r).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,r])=>({modelId:r.replace(`${e}/`,""),fullModel:r,alias:t})),w=e=>{let s,a=(s=e.split("/"))[s.length-1];if(!r[a])return a;let i=`${t}-${a}`;return r[i]?null:i},C=async()=>{if(!h.trim()||f)return;let t=h.trim(),r=w(t);if(!r)return void j.error("All suggested aliases already exist. Please choose a different model or remove conflicting aliases.");y(!0);try{let s=await fetch("/api/provider-models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,modelId:t,modelName:t,source:"manual"})});if(!s.ok){let e={};try{e=await s.json()}catch(e){console.error("Failed to parse error response from custom model API:",e)}throw Error(e.error?.message||"Failed to save custom model")}await n(t,r,e),x(""),j.success(`Model ${t} added successfully`)}catch(e){console.error("Error adding model:",e),j.error(e instanceof Error?e.message:"Failed to add model. Please try again.")}finally{y(!1)}},k=async()=>{if(g)return;let t=c.find(e=>!1!==e.isActive);if(t){v(!0);try{await p(async()=>{let e=await fetch(`/api/providers/${t.id}/models`),r=await e.json();if(!e.ok)throw Error(r.error||"Failed to import models");return r},async t=>{let r=t.id||t.name||t.model;if(!r)return!1;let s=w(r);return!!s&&((await fetch("/api/provider-models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,modelId:r,modelName:t.name||r,source:"imported"})})).ok?(await n(r,s,e),!0):(j.error("Failed to save imported model to custom database"),!1))})}catch(e){console.error("Error importing models:",e),j.error("Failed to import models. Please try again.")}finally{v(!1)}}},S=c.some(e=>!1!==e.isActive),A=async(t,r)=>{try{if(!(await fetch(`/api/provider-models?provider=${encodeURIComponent(e)}&model=${encodeURIComponent(t)}`,{method:"DELETE"})).ok)throw Error("Failed to remove model from database");await d(r),j.success("Model removed successfully")}catch(e){console.error("Error deleting model:",e),j.error(e instanceof Error?e.message:"Failed to delete model. Please try again.")}};return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",m?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,s.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,s.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,s.jsx)("input",{id:"new-compatible-model-input",type:"text",value:h,onChange:e=>x(e.target.value),onKeyDown:e=>"Enter"===e.key&&C(),placeholder:m?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,s.jsx)(u.$n,{size:"sm",icon:"add",onClick:C,disabled:!h.trim()||f,children:f?"Adding...":"Add"}),(0,s.jsx)(u.$n,{size:"sm",variant:"secondary",icon:"download",onClick:k,disabled:!S||g,children:g?"Importing...":"Import from /models"})]}),!S&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),N.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-3",children:N.map(({modelId:e,fullModel:r,alias:a})=>(0,s.jsx)(b,{modelId:e,fullModel:`${t}/${e}`,copied:l,onCopy:o,onDeleteAlias:()=>A(e,a)},r))})]})}function w({until:e}){let[t,r]=(0,a.useState)("");return((0,a.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void r("");let s=Math.floor(t/1e3);if(s<60)r(`${s}s`);else if(s<3600)r(`${Math.floor(s/60)}m ${s%60}s`);else{let e=Math.floor(s/3600),t=Math.floor(s%3600/60);r(`${e}h ${t}m`)}};t();let s=setInterval(t,1e3);return()=>clearInterval(s)},[e]),t)?(0,s.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}g.propTypes={model:o().shape({id:o().string.isRequired}).isRequired,fullModel:o().string.isRequired,alias:o().string,copied:o().string,onCopy:o().func.isRequired},v.propTypes={providerAlias:o().string.isRequired,modelAliases:o().object.isRequired,copied:o().string,onCopy:o().func.isRequired,onSetAlias:o().func.isRequired,onDeleteAlias:o().func.isRequired},b.propTypes={modelId:o().string.isRequired,fullModel:o().string.isRequired,copied:o().string,onCopy:o().func.isRequired,onDeleteAlias:o().func.isRequired},j.propTypes={providerId:o().string.isRequired,providerAlias:o().string.isRequired,copied:o().string,onCopy:o().func.isRequired},N.propTypes={providerStorageAlias:o().string.isRequired,providerDisplayAlias:o().string.isRequired,modelAliases:o().object.isRequired,copied:o().string,onCopy:o().func.isRequired,onSetAlias:o().func.isRequired,onDeleteAlias:o().func.isRequired,connections:o().arrayOf(o().shape({id:o().string,isActive:o().bool})).isRequired,isAnthropic:o().bool,onImportWithProgress:o().func.isRequired},w.propTypes={until:o().string.isRequired};let C={runtime_error:{label:"Local runtime",variant:"warning"},upstream_auth_error:{label:"Upstream auth",variant:"error"},auth_missing:{label:"Missing credential",variant:"warning"},token_refresh_failed:{label:"Refresh failed",variant:"warning"},token_expired:{label:"Token expired",variant:"warning"},upstream_rate_limited:{label:"Rate limited",variant:"warning"},upstream_unavailable:{label:"Upstream unavailable",variant:"error"},network_error:{label:"Network error",variant:"warning"},unsupported:{label:"Test unsupported",variant:"default"},upstream_error:{label:"Upstream error",variant:"error"}};function k({connection:e,isOAuth:t,isFirst:r,isLast:i,onMoveUp:l,onMoveDown:o,onToggleActive:n,onToggleRateLimit:d,onRetest:c,isRetesting:m,onEdit:p,onDelete:h,onReauth:x,onProxy:f,hasProxy:y}){let g=t?e.name||e.email||e.displayName||"OAuth Account":e.name,[v,b]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let t=()=>{b(e.rateLimitedUntil&&new Date(e.rateLimitedUntil).getTime()>Date.now())};t();let r=e.rateLimitedUntil?setInterval(t,1e3):null;return()=>{r&&clearInterval(r)}},[e.rateLimitedUntil]);let j="unavailable"!==e.testStatus||v?e.testStatus:"active",N=function(e,t,r){if(!1===e.isActive)return{statusVariant:"default",statusLabel:"disabled",errorType:null,errorBadge:null,errorTextClass:"text-text-muted"};if("active"===t||"success"===t)return{statusVariant:"success",statusLabel:"connected",errorType:null,errorBadge:null,errorTextClass:"text-text-muted"};let s=function(e,t){if(t)return"upstream_rate_limited";if(e.lastErrorType)return e.lastErrorType;let r=Number(e.errorCode);if(401===r||403===r)return"upstream_auth_error";if(429===r)return"upstream_rate_limited";if(r>=500)return"upstream_unavailable";let s=(e.lastError||"").toLowerCase();return s?s.includes("runtime")||s.includes("not runnable")||s.includes("not installed")||s.includes("healthcheck")?"runtime_error":s.includes("refresh failed")?"token_refresh_failed":s.includes("token expired")||s.includes("expired")?"token_expired":s.includes("invalid api key")||s.includes("token invalid")||s.includes("revoked")||s.includes("access denied")||s.includes("unauthorized")?"upstream_auth_error":s.includes("rate limit")||s.includes("quota")||s.includes("too many requests")||s.includes("429")?"upstream_rate_limited":s.includes("fetch failed")||s.includes("network")||s.includes("timeout")||s.includes("econn")||s.includes("enotfound")?"network_error":s.includes("not supported")?"unsupported":"upstream_error":null}(e,r),a=s&&C[s]||null;return"runtime_error"===s?{statusVariant:"warning",statusLabel:"runtime issue",errorType:s,errorBadge:a,errorTextClass:"text-yellow-600 dark:text-yellow-400"}:"upstream_auth_error"===s||"auth_missing"===s||"token_refresh_failed"===s||"token_expired"===s?{statusVariant:"error",statusLabel:"auth failed",errorType:s,errorBadge:a,errorTextClass:"text-red-500"}:"upstream_rate_limited"===s?{statusVariant:"warning",statusLabel:"rate limited",errorType:s,errorBadge:a,errorTextClass:"text-yellow-600 dark:text-yellow-400"}:"network_error"===s?{statusVariant:"warning",statusLabel:"network issue",errorType:s,errorBadge:a,errorTextClass:"text-yellow-600 dark:text-yellow-400"}:"unsupported"===s?{statusVariant:"default",statusLabel:"test unsupported",errorType:s,errorBadge:a,errorTextClass:"text-text-muted"}:{statusVariant:"error",statusLabel:t||"error",errorType:s,errorBadge:a,errorTextClass:"text-red-500"}}(e,j,v),k=!!e.rateLimitProtection;return(0,s.jsxs)("div",{className:`group flex items-center justify-between p-3 rounded-lg hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${!1===e.isActive?"opacity-60":""}`,children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("button",{onClick:l,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,s.jsx)("button",{onClick:o,disabled:i,className:`p-0.5 rounded ${i?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:t?"lock":"key"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:g}),(0,s.jsxs)("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[(0,s.jsx)(u.Ex,{variant:N.statusVariant,size:"sm",dot:!0,children:N.statusLabel}),v&&!1!==e.isActive&&(0,s.jsx)(w,{until:e.rateLimitedUntil}),N.errorBadge&&!1!==e.isActive&&(0,s.jsx)(u.Ex,{variant:N.errorBadge.variant,size:"sm",children:N.errorBadge.label}),e.lastError&&!1!==e.isActive&&(0,s.jsx)("span",{className:`text-xs truncate max-w-[300px] ${N.errorTextClass}`,title:e.lastError,children:e.lastError}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]}),(0,s.jsx)("span",{className:"text-text-muted/30 select-none",children:"|"}),(0,s.jsxs)("button",{onClick:()=>d(!k),className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium transition-all cursor-pointer ${k?"bg-emerald-500/15 text-emerald-500 hover:bg-emerald-500/25":"bg-black/[0.03] dark:bg-white/[0.03] text-text-muted/50 hover:text-text-muted hover:bg-black/[0.06] dark:hover:bg-white/[0.06]"}`,title:k?"Click to disable rate limit protection":"Click to enable rate limit protection",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"shield"}),k?"Protected":"Unprotected"]}),y&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"text-text-muted/30 select-none",children:"|"}),(0,s.jsxs)("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-xs font-medium bg-primary/15 text-primary",title:"Proxy configured",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"vpn_lock"}),"Proxy"]})]})]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(u.$n,{size:"sm",variant:"ghost",icon:"refresh",loading:m,disabled:!1===e.isActive,onClick:c,className:"!h-7 !px-2 text-xs",title:"Retest authentication",children:"Retest"}),(0,s.jsx)(u.lM,{size:"sm",checked:e.isActive??!0,onChange:n,title:e.isActive??!0?"Disable connection":"Enable connection"}),(0,s.jsxs)("div",{className:"flex gap-1 ml-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[x&&(0,s.jsx)("button",{onClick:x,className:"p-2 hover:bg-amber-500/10 rounded text-amber-600 hover:text-amber-500",title:"Re-authenticate this connection",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"passkey"})}),(0,s.jsx)("button",{onClick:p,className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,s.jsx)("button",{onClick:f,className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary",title:"Proxy config",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"vpn_lock"})}),(0,s.jsx)("button",{onClick:h,className:"p-2 hover:bg-red-500/10 rounded text-red-500",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]})]})}function S({isOpen:e,provider:t,providerName:r,isCompatible:i,isAnthropic:l,onSave:o,onClose:n}){let[d,c]=(0,a.useState)({name:"",apiKey:"",priority:1}),[m,p]=(0,a.useState)(!1),[h,x]=(0,a.useState)(null),[f,y]=(0,a.useState)(!1),[g,v]=(0,a.useState)(null),b=async()=>{p(!0),v(null);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:d.apiKey})}),r=await e.json();x(r.valid?"success":"failed")}catch{x("failed")}finally{p(!1)}},j=async()=>{if(t&&d.apiKey){y(!0),v(null);try{let e=!1;try{p(!0),x(null);let r=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:d.apiKey})});e=!!(await r.json()).valid,x(e?"success":"failed")}catch{x("failed")}finally{p(!1)}if(!e)return void v("API key validation failed. Please check your key and try again.");let r=await o({name:d.name,apiKey:d.apiKey,priority:d.priority,testStatus:"active"});r&&v("string"==typeof r?r:"Failed to save connection")}finally{y(!1)}}};return t?(0,s.jsx)(u.aF,{isOpen:e,title:`Add ${r||t} API Key`,onClose:n,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(u.pd,{label:"Name",value:d.name,onChange:e=>c({...d,name:e.target.value}),placeholder:"Production Key"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(u.pd,{label:"API Key",type:"password",value:d.apiKey,onChange:e=>c({...d,apiKey:e.target.value}),className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(u.$n,{onClick:b,disabled:!d.apiKey||m||f,variant:"secondary",children:m?"Checking...":"Check"})})]}),h&&(0,s.jsx)(u.Ex,{variant:"success"===h?"success":"error",children:"success"===h?"Valid":"Invalid"}),g&&(0,s.jsx)("div",{className:"text-sm text-red-500 bg-red-500/10 border border-red-500/20 rounded-lg px-3 py-2",children:g}),i&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:l?`Validation checks ${r||"Anthropic Compatible"} by verifying the API key.`:`Validation checks ${r||"OpenAI Compatible"} via /models on your base URL.`}),(0,s.jsx)(u.pd,{label:"Priority",type:"number",value:d.priority,onChange:e=>c({...d,priority:Number.parseInt(e.target.value)||1})}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(u.$n,{onClick:j,fullWidth:!0,disabled:!d.name||!d.apiKey||f,children:f?"Saving...":"Save"}),(0,s.jsx)(u.$n,{onClick:n,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function A({isOpen:e,connection:t,onSave:r,onClose:i}){let[l,o]=(0,a.useState)({name:"",priority:1,apiKey:"",healthCheckInterval:60}),[n,d]=(0,a.useState)(!1),[c,m]=(0,a.useState)(null),[p,x]=(0,a.useState)(!1),[f,y]=(0,a.useState)(null),[g,v]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&(o({name:t.name||"",priority:t.priority||1,apiKey:"",healthCheckInterval:t.healthCheckInterval??60}),m(null),y(null))},[t]);let b=async()=>{if(t?.provider){d(!0),m(null);try{let e=await fetch(`/api/providers/${t.id}/test`,{method:"POST"}),r=await e.json();m({valid:!!r.valid,diagnosis:r.diagnosis||null,message:r.error||null})}catch{m({valid:!1,diagnosis:{type:"network_error"},message:"Failed to test connection"})}finally{d(!1)}}},j=async()=>{if(t?.provider&&l.apiKey){x(!0),y(null);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:l.apiKey})}),r=await e.json();y(r.valid?"success":"failed")}catch{y("failed")}finally{x(!1)}}},N=async()=>{v(!0);try{let e={name:l.name,priority:l.priority,healthCheckInterval:l.healthCheckInterval};if(!w&&l.apiKey){e.apiKey=l.apiKey;let r="success"===f;if(!r)try{x(!0),y(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:l.apiKey})});r=!!(await e.json()).valid,y(r?"success":"failed")}catch{y("failed")}finally{x(!1)}r&&(e.testStatus="active",e.lastError=null,e.lastErrorAt=null,e.lastErrorType=null,e.lastErrorSource=null,e.errorCode=null,e.rateLimitedUntil=null)}await r(e)}finally{v(!1)}};if(!t)return null;let w="oauth"===t.authType,k=(0,h.mq)(t.provider)||(0,h.gb)(t.provider),S=!c?.valid&&c?.diagnosis?.type&&C[c.diagnosis.type]||null;return(0,s.jsx)(u.aF,{isOpen:e,title:"Edit Connection",onClose:i,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(u.pd,{label:"Name",value:l.name,onChange:e=>o({...l,name:e.target.value}),placeholder:w?"Account name":"Production Key"}),w&&t.email&&(0,s.jsxs)("div",{className:"bg-sidebar/50 p-3 rounded-lg",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted mb-1",children:"Email"}),(0,s.jsx)("p",{className:"font-medium",children:t.email})]}),w&&(0,s.jsx)(u.pd,{label:"Health Check (min)",type:"number",value:l.healthCheckInterval,onChange:e=>o({...l,healthCheckInterval:Math.max(0,Number.parseInt(e.target.value)||0)}),hint:"Proactive token refresh interval. 0 = disabled."}),(0,s.jsx)(u.pd,{label:"Priority",type:"number",value:l.priority,onChange:e=>o({...l,priority:Number.parseInt(e.target.value)||1})}),!w&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(u.pd,{label:"API Key",type:"password",value:l.apiKey,onChange:e=>o({...l,apiKey:e.target.value}),placeholder:"Enter new API key",hint:"Leave blank to keep the current API key.",className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(u.$n,{onClick:j,disabled:!l.apiKey||p||g,variant:"secondary",children:p?"Checking...":"Check"})})]}),f&&(0,s.jsx)(u.Ex,{variant:"success"===f?"success":"error",children:"success"===f?"Valid":"Invalid"})]}),!k&&(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(u.$n,{onClick:b,variant:"secondary",disabled:n,children:n?"Testing...":"Test Connection"}),c&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.Ex,{variant:c.valid?"success":"error",children:c.valid?"Valid":"Failed"}),S&&(0,s.jsx)(u.Ex,{variant:S.variant,children:S.label})]})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(u.$n,{onClick:N,fullWidth:!0,disabled:g,children:g?"Saving...":"Save"}),(0,s.jsx)(u.$n,{onClick:i,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function $({isOpen:e,node:t,onSave:r,onClose:i,isAnthropic:l}){let[o,n]=(0,a.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[d,c]=(0,a.useState)(!1),[m,p]=(0,a.useState)(""),[h,x]=(0,a.useState)(!1),[f,y]=(0,a.useState)(null);(0,a.useEffect)(()=>{t&&n({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(l?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,l]);let g=async()=>{if(o.name.trim()&&o.prefix.trim()&&o.baseUrl.trim()){c(!0);try{let e={name:o.name,prefix:o.prefix,baseUrl:o.baseUrl};l||(e.apiType=o.apiType),await r(e)}finally{c(!1)}}},v=async()=>{x(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:o.baseUrl,apiKey:m,type:l?"anthropic-compatible":"openai-compatible"})}),t=await e.json();y(t.valid?"success":"failed")}catch{y("failed")}finally{x(!1)}};return t?(0,s.jsx)(u.aF,{isOpen:e,title:`Edit ${l?"Anthropic":"OpenAI"} Compatible`,onClose:i,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(u.pd,{label:"Name",value:o.name,onChange:e=>n({...o,name:e.target.value}),placeholder:`${l?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,s.jsx)(u.pd,{label:"Prefix",value:o.prefix,onChange:e=>n({...o,prefix:e.target.value}),placeholder:l?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!l&&(0,s.jsx)(u.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:o.apiType,onChange:e=>n({...o,apiType:e.target.value})}),(0,s.jsx)(u.pd,{label:"Base URL",value:o.baseUrl,onChange:e=>n({...o,baseUrl:e.target.value}),placeholder:l?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${l?"Anthropic":"OpenAI"}-compatible API.`}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(u.pd,{label:"API Key (for Check)",type:"password",value:m,onChange:e=>p(e.target.value),className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(u.$n,{onClick:v,disabled:!m||h||!o.baseUrl.trim(),variant:"secondary",children:h?"Checking...":"Check"})})]}),f&&(0,s.jsx)(u.Ex,{variant:"success"===f?"success":"error",children:"success"===f?"Valid":"Invalid"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(u.$n,{onClick:g,fullWidth:!0,disabled:!o.name.trim()||!o.prefix.trim()||!o.baseUrl.trim()||d,children:d?"Saving...":"Save"}),(0,s.jsx)(u.$n,{onClick:i,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}k.propTypes={connection:o().shape({id:o().string,name:o().string,email:o().string,displayName:o().string,rateLimitedUntil:o().string,rateLimitProtection:o().bool,testStatus:o().string,isActive:o().bool,priority:o().number,lastError:o().string,lastErrorType:o().string,lastErrorSource:o().string,errorCode:o().oneOfType([o().string,o().number]),globalPriority:o().number}).isRequired,isOAuth:o().bool.isRequired,isFirst:o().bool.isRequired,isLast:o().bool.isRequired,onMoveUp:o().func.isRequired,onMoveDown:o().func.isRequired,onToggleActive:o().func.isRequired,onToggleRateLimit:o().func.isRequired,onRetest:o().func.isRequired,isRetesting:o().bool,onEdit:o().func.isRequired,onDelete:o().func.isRequired,onReauth:o().func},S.propTypes={isOpen:o().bool.isRequired,provider:o().string,providerName:o().string,isCompatible:o().bool,isAnthropic:o().bool,onSave:o().func.isRequired,onClose:o().func.isRequired},A.propTypes={isOpen:o().bool.isRequired,connection:o().shape({id:o().string,name:o().string,email:o().string,priority:o().number,authType:o().string,provider:o().string}),onSave:o().func.isRequired,onClose:o().func.isRequired},$.propTypes={isOpen:o().bool.isRequired,node:o().shape({id:o().string,name:o().string,prefix:o().string,apiType:o().string,baseUrl:o().string}),onSave:o().func.isRequired,onClose:o().func.isRequired,isAnthropic:o().bool}}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=56411)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9089],{4346:(e,r,a)=>{Promise.resolve().then(a.bind(a,91241))},91241:(e,r,a)=>{"use strict";a.r(r),a.d(r,{default:()=>h});var t=a(95155),s=a(12115),l=a(73321),i=a(98500),d=a.n(i),o=a(40993),n=a(52529),c=a(50910);let m=Object.values(n.Q2).map(e=>({value:e.id,label:e.name})),p=Object.values(n.MA).map(e=>({value:e.id,label:e.name}));function h(){let e=(0,l.useRouter)(),[r,a]=(0,s.useState)(!1),i=(0,c.c)("providers"),[h,u]=(0,s.useState)({provider:"",authMethod:"api_key",apiKey:"",displayName:"",isActive:!0}),[x,b]=(0,s.useState)({}),v=(e,r)=>{u(a=>({...a,[e]:r})),x[e]&&b(r=>({...r,[e]:null}))},y=async r=>{let t;if(r.preventDefault(),t={},h.provider||(t.provider=i("selectProvider")),"api_key"!==h.authMethod||h.apiKey||(t.apiKey=i("apiKeyRequired")),b(t),0===Object.keys(t).length){a(!0);try{let r=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)});if(r.ok)e.push("/dashboard/providers");else{let e=await r.json();b({submit:e.error||i("failedCreate")})}}catch(e){b({submit:i("errorOccurred")})}finally{a(!1)}}},j=n.Q2[h.provider];return(0,t.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsxs)(d(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),i("backToProviders")]}),(0,t.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:i("addNewProvider")}),(0,t.jsx)("p",{className:"text-text-muted mt-2",children:i("configureNewProvider")})]}),(0,t.jsx)(o.Zp,{children:(0,t.jsxs)("form",{onSubmit:y,className:"flex flex-col gap-6",children:[(0,t.jsx)(o.l6,{label:"Provider",options:m,value:h.provider,onChange:e=>v("provider",e.target.value),placeholder:i("selectProvider"),error:x.provider,required:!0}),j&&(0,t.jsxs)(o.Zp.Section,{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"size-10 rounded-lg flex items-center justify-center bg-bg border border-border",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:j.color},children:j.icon})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:j.name}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:i("selectedProvider")})]})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,t.jsxs)("label",{className:"text-sm font-medium",children:[i("authMethod")," ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("div",{className:"flex gap-3",children:p.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>v("authMethod",e.value),className:`flex-1 flex items-center justify-center gap-2 p-4 rounded-lg border transition-all ${h.authMethod===e.value?"border-primary bg-primary/5 text-primary":"border-border hover:border-primary/50"}`,children:[(0,t.jsx)("span",{className:"material-symbols-outlined",children:"api_key"===e.value?"key":"lock"}),(0,t.jsx)("span",{className:"font-medium",children:e.label})]},e.value))})]}),"api_key"===h.authMethod&&(0,t.jsx)(o.pd,{label:"API Key",type:"password",placeholder:i("enterApiKey"),value:h.apiKey,onChange:e=>v("apiKey",e.target.value),error:x.apiKey,hint:i("apiKeySecure"),required:!0}),"oauth2"===h.authMethod&&(0,t.jsxs)(o.Zp.Section,{className:"",children:[(0,t.jsx)("p",{className:"text-sm text-text-muted mb-4",children:i("oauth2Desc")}),(0,t.jsx)(o.$n,{type:"button",variant:"secondary",icon:"link",children:i("oauth2Connect")})]}),(0,t.jsx)(o.pd,{label:"Display Name",placeholder:"e.g., Production API, Dev Environment",value:h.displayName,onChange:e=>v("displayName",e.target.value),hint:"Optional. A friendly name to identify this configuration."}),(0,t.jsx)(o.lM,{checked:h.isActive,onChange:e=>v("isActive",e),label:i("active"),description:i("activeDescription")}),x.submit&&(0,t.jsx)("div",{className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-600 dark:text-red-400 text-sm",children:x.submit}),(0,t.jsxs)("div",{className:"flex gap-3 pt-4 border-t border-border",children:[(0,t.jsx)(d(),{href:"/dashboard/providers",className:"flex-1",children:(0,t.jsx)(o.$n,{type:"button",variant:"ghost",fullWidth:!0,children:i("cancel")})}),(0,t.jsx)(o.$n,{type:"submit",loading:r,fullWidth:!0,className:"flex-1",children:i("createProvider")})]})]})})]})}}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=4346)),_N_E=e.O()}]);