omniroute 1.4.10 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (374) hide show
  1. package/README.ar.md +1153 -0
  2. package/README.bg.md +1238 -0
  3. package/README.da.md +1238 -0
  4. package/README.de.md +1 -1
  5. package/README.es.md +1 -1
  6. package/README.fi.md +1238 -0
  7. package/README.fr.md +1 -1
  8. package/README.he.md +1238 -0
  9. package/README.hu.md +1238 -0
  10. package/README.id.md +1238 -0
  11. package/README.in.md +952 -0
  12. package/README.it.md +1 -1
  13. package/README.ja.md +1152 -0
  14. package/README.ko.md +1238 -0
  15. package/README.md +25 -20
  16. package/README.ms.md +1238 -0
  17. package/README.nl.md +1238 -0
  18. package/README.no.md +1238 -0
  19. package/README.phi.md +1238 -0
  20. package/README.pl.md +1238 -0
  21. package/README.pt-BR.md +16 -12
  22. package/README.pt.md +1238 -0
  23. package/README.ro.md +1238 -0
  24. package/README.ru.md +1 -1
  25. package/README.sk.md +1239 -0
  26. package/README.sv.md +1238 -0
  27. package/README.th.md +1229 -0
  28. package/README.uk-UA.md +1240 -0
  29. package/README.vi.md +1238 -0
  30. package/README.zh-CN.md +1 -1
  31. package/app/.next/BUILD_ID +1 -1
  32. package/app/.next/app-path-routes-manifest.json +39 -39
  33. package/app/.next/build-manifest.json +2 -2
  34. package/app/.next/prerender-manifest.json +3 -3
  35. package/app/.next/server/app/(dashboard)/dashboard/analytics/page.js +2 -2
  36. package/app/.next/server/app/(dashboard)/dashboard/analytics/page.js.nft.json +1 -1
  37. package/app/.next/server/app/(dashboard)/dashboard/analytics/page_client-reference-manifest.js +1 -1
  38. package/app/.next/server/app/(dashboard)/dashboard/api-manager/page.js +1 -1
  39. package/app/.next/server/app/(dashboard)/dashboard/api-manager/page.js.nft.json +1 -1
  40. package/app/.next/server/app/(dashboard)/dashboard/api-manager/page_client-reference-manifest.js +1 -1
  41. package/app/.next/server/app/(dashboard)/dashboard/audit-log/page.js +2 -2
  42. package/app/.next/server/app/(dashboard)/dashboard/audit-log/page.js.nft.json +1 -1
  43. package/app/.next/server/app/(dashboard)/dashboard/audit-log/page_client-reference-manifest.js +1 -1
  44. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +6 -6
  45. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  46. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  47. package/app/.next/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  48. package/app/.next/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  49. package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  50. package/app/.next/server/app/(dashboard)/dashboard/costs/page.js +2 -2
  51. package/app/.next/server/app/(dashboard)/dashboard/costs/page.js.nft.json +1 -1
  52. package/app/.next/server/app/(dashboard)/dashboard/costs/page_client-reference-manifest.js +1 -1
  53. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js +2 -2
  54. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  55. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  56. package/app/.next/server/app/(dashboard)/dashboard/health/page.js +2 -2
  57. package/app/.next/server/app/(dashboard)/dashboard/health/page.js.nft.json +1 -1
  58. package/app/.next/server/app/(dashboard)/dashboard/health/page_client-reference-manifest.js +1 -1
  59. package/app/.next/server/app/(dashboard)/dashboard/limits/page.js +2 -2
  60. package/app/.next/server/app/(dashboard)/dashboard/limits/page.js.nft.json +1 -1
  61. package/app/.next/server/app/(dashboard)/dashboard/limits/page_client-reference-manifest.js +1 -1
  62. package/app/.next/server/app/(dashboard)/dashboard/logs/page.js +1 -1
  63. package/app/.next/server/app/(dashboard)/dashboard/logs/page.js.nft.json +1 -1
  64. package/app/.next/server/app/(dashboard)/dashboard/logs/page_client-reference-manifest.js +1 -1
  65. package/app/.next/server/app/(dashboard)/dashboard/onboarding/page.js +2 -2
  66. package/app/.next/server/app/(dashboard)/dashboard/onboarding/page.js.nft.json +1 -1
  67. package/app/.next/server/app/(dashboard)/dashboard/onboarding/page_client-reference-manifest.js +1 -1
  68. package/app/.next/server/app/(dashboard)/dashboard/page.js +2 -2
  69. package/app/.next/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  70. package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  71. package/app/.next/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  72. package/app/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  73. package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  74. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
  75. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  76. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  77. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  78. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  79. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  80. package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  81. package/app/.next/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  82. package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  83. package/app/.next/server/app/(dashboard)/dashboard/settings/page.js +2 -2
  84. package/app/.next/server/app/(dashboard)/dashboard/settings/page.js.nft.json +1 -1
  85. package/app/.next/server/app/(dashboard)/dashboard/settings/page_client-reference-manifest.js +1 -1
  86. package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page.js +2 -2
  87. package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page.js.nft.json +1 -1
  88. package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  89. package/app/.next/server/app/(dashboard)/dashboard/translator/page.js +4 -4
  90. package/app/.next/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  91. package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  92. package/app/.next/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  93. package/app/.next/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  94. package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  95. package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  96. package/app/.next/server/app/_global-error.html +2 -2
  97. package/app/.next/server/app/_global-error.rsc +1 -1
  98. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  99. package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  100. package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  101. package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  102. package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  103. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  104. package/app/.next/server/app/_not-found/page.js +1 -1
  105. package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
  106. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  107. package/app/.next/server/app/api/auth/login/route.js +1 -1
  108. package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  109. package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  110. package/app/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  111. package/app/.next/server/app/api/cache/route_client-reference-manifest.js +1 -1
  112. package/app/.next/server/app/api/cache/stats/route_client-reference-manifest.js +1 -1
  113. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  114. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route_client-reference-manifest.js +1 -1
  115. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +2 -2
  116. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route_client-reference-manifest.js +1 -1
  117. package/app/.next/server/app/api/cli-tools/backups/route.js +1 -1
  118. package/app/.next/server/app/api/cli-tools/backups/route_client-reference-manifest.js +1 -1
  119. package/app/.next/server/app/api/cli-tools/claude-settings/route.js +1 -1
  120. package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
  121. package/app/.next/server/app/api/cli-tools/cline-settings/route.js +1 -1
  122. package/app/.next/server/app/api/cli-tools/cline-settings/route_client-reference-manifest.js +1 -1
  123. package/app/.next/server/app/api/cli-tools/codex-profiles/route.js +2 -2
  124. package/app/.next/server/app/api/cli-tools/codex-profiles/route_client-reference-manifest.js +1 -1
  125. package/app/.next/server/app/api/cli-tools/codex-settings/route.js +2 -2
  126. package/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
  127. package/app/.next/server/app/api/cli-tools/droid-settings/route.js +1 -1
  128. package/app/.next/server/app/api/cli-tools/droid-settings/route_client-reference-manifest.js +1 -1
  129. package/app/.next/server/app/api/cli-tools/guide-settings/[toolId]/route_client-reference-manifest.js +1 -1
  130. package/app/.next/server/app/api/cli-tools/kilo-settings/route.js +1 -1
  131. package/app/.next/server/app/api/cli-tools/kilo-settings/route_client-reference-manifest.js +1 -1
  132. package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  133. package/app/.next/server/app/api/cli-tools/openclaw-settings/route_client-reference-manifest.js +1 -1
  134. package/app/.next/server/app/api/cli-tools/runtime/[toolId]/route.js +2 -2
  135. package/app/.next/server/app/api/cli-tools/runtime/[toolId]/route_client-reference-manifest.js +1 -1
  136. package/app/.next/server/app/api/cli-tools/status/route.js +1 -1
  137. package/app/.next/server/app/api/cli-tools/status/route_client-reference-manifest.js +1 -1
  138. package/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
  139. package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
  140. package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
  141. package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
  142. package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
  143. package/app/.next/server/app/api/combos/metrics/route_client-reference-manifest.js +1 -1
  144. package/app/.next/server/app/api/combos/route.js +1 -1
  145. package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
  146. package/app/.next/server/app/api/combos/test/route_client-reference-manifest.js +1 -1
  147. package/app/.next/server/app/api/compliance/audit-log/route_client-reference-manifest.js +1 -1
  148. package/app/.next/server/app/api/db-backups/export/route_client-reference-manifest.js +1 -1
  149. package/app/.next/server/app/api/db-backups/exportAll/route_client-reference-manifest.js +1 -1
  150. package/app/.next/server/app/api/db-backups/import/route_client-reference-manifest.js +1 -1
  151. package/app/.next/server/app/api/db-backups/route_client-reference-manifest.js +1 -1
  152. package/app/.next/server/app/api/evals/[suiteId]/route_client-reference-manifest.js +1 -1
  153. package/app/.next/server/app/api/evals/route_client-reference-manifest.js +1 -1
  154. package/app/.next/server/app/api/fallback/chains/route_client-reference-manifest.js +1 -1
  155. package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  156. package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
  157. package/app/.next/server/app/api/keys/route.js +1 -1
  158. package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
  159. package/app/.next/server/app/api/logs/console/route_client-reference-manifest.js +1 -1
  160. package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
  161. package/app/.next/server/app/api/models/availability/route_client-reference-manifest.js +1 -1
  162. package/app/.next/server/app/api/models/catalog/route_client-reference-manifest.js +1 -1
  163. package/app/.next/server/app/api/models/route.js +1 -1
  164. package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
  165. package/app/.next/server/app/api/monitoring/health/route.js +1 -1
  166. package/app/.next/server/app/api/monitoring/health/route_client-reference-manifest.js +1 -1
  167. package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
  168. package/app/.next/server/app/api/oauth/cursor/auto-import/route_client-reference-manifest.js +1 -1
  169. package/app/.next/server/app/api/oauth/cursor/import/route_client-reference-manifest.js +1 -1
  170. package/app/.next/server/app/api/oauth/kiro/auto-import/route_client-reference-manifest.js +1 -1
  171. package/app/.next/server/app/api/oauth/kiro/import/route_client-reference-manifest.js +1 -1
  172. package/app/.next/server/app/api/oauth/kiro/social-authorize/route_client-reference-manifest.js +1 -1
  173. package/app/.next/server/app/api/oauth/kiro/social-exchange/route_client-reference-manifest.js +1 -1
  174. package/app/.next/server/app/api/policies/route_client-reference-manifest.js +1 -1
  175. package/app/.next/server/app/api/pricing/defaults/route_client-reference-manifest.js +1 -1
  176. package/app/.next/server/app/api/pricing/models/route_client-reference-manifest.js +1 -1
  177. package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
  178. package/app/.next/server/app/api/provider-metrics/route_client-reference-manifest.js +1 -1
  179. package/app/.next/server/app/api/provider-models/route_client-reference-manifest.js +1 -1
  180. package/app/.next/server/app/api/provider-nodes/[id]/route_client-reference-manifest.js +1 -1
  181. package/app/.next/server/app/api/provider-nodes/route_client-reference-manifest.js +1 -1
  182. package/app/.next/server/app/api/provider-nodes/validate/route_client-reference-manifest.js +1 -1
  183. package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
  184. package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
  185. package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
  186. package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
  187. package/app/.next/server/app/api/providers/route.js +1 -1
  188. package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
  189. package/app/.next/server/app/api/providers/test-batch/route_client-reference-manifest.js +1 -1
  190. package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
  191. package/app/.next/server/app/api/rate-limit/route_client-reference-manifest.js +1 -1
  192. package/app/.next/server/app/api/rate-limits/route_client-reference-manifest.js +1 -1
  193. package/app/.next/server/app/api/resilience/reset/route_client-reference-manifest.js +1 -1
  194. package/app/.next/server/app/api/resilience/route_client-reference-manifest.js +1 -1
  195. package/app/.next/server/app/api/restart/route_client-reference-manifest.js +1 -1
  196. package/app/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
  197. package/app/.next/server/app/api/settings/combo-defaults/route_client-reference-manifest.js +1 -1
  198. package/app/.next/server/app/api/settings/ip-filter/route_client-reference-manifest.js +1 -1
  199. package/app/.next/server/app/api/settings/proxy/route_client-reference-manifest.js +1 -1
  200. package/app/.next/server/app/api/settings/proxy/test/route_client-reference-manifest.js +1 -1
  201. package/app/.next/server/app/api/settings/require-login/route_client-reference-manifest.js +1 -1
  202. package/app/.next/server/app/api/settings/route.js +1 -1
  203. package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  204. package/app/.next/server/app/api/settings/system-prompt/route_client-reference-manifest.js +1 -1
  205. package/app/.next/server/app/api/settings/thinking-budget/route_client-reference-manifest.js +1 -1
  206. package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  207. package/app/.next/server/app/api/storage/health/route_client-reference-manifest.js +1 -1
  208. package/app/.next/server/app/api/sync/cloud/route_client-reference-manifest.js +1 -1
  209. package/app/.next/server/app/api/sync/initialize/route_client-reference-manifest.js +1 -1
  210. package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
  211. package/app/.next/server/app/api/telemetry/summary/route_client-reference-manifest.js +1 -1
  212. package/app/.next/server/app/api/token-health/route_client-reference-manifest.js +1 -1
  213. package/app/.next/server/app/api/translator/detect/route_client-reference-manifest.js +1 -1
  214. package/app/.next/server/app/api/translator/history/route_client-reference-manifest.js +1 -1
  215. package/app/.next/server/app/api/translator/load/route_client-reference-manifest.js +1 -1
  216. package/app/.next/server/app/api/translator/save/route_client-reference-manifest.js +1 -1
  217. package/app/.next/server/app/api/translator/send/route_client-reference-manifest.js +1 -1
  218. package/app/.next/server/app/api/translator/translate/route_client-reference-manifest.js +1 -1
  219. package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
  220. package/app/.next/server/app/api/usage/analytics/route_client-reference-manifest.js +1 -1
  221. package/app/.next/server/app/api/usage/budget/route_client-reference-manifest.js +1 -1
  222. package/app/.next/server/app/api/usage/call-logs/[id]/route_client-reference-manifest.js +1 -1
  223. package/app/.next/server/app/api/usage/call-logs/route_client-reference-manifest.js +1 -1
  224. package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
  225. package/app/.next/server/app/api/usage/logs/route_client-reference-manifest.js +1 -1
  226. package/app/.next/server/app/api/usage/proxy-logs/route_client-reference-manifest.js +1 -1
  227. package/app/.next/server/app/api/usage/request-logs/route_client-reference-manifest.js +1 -1
  228. package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
  229. package/app/.next/server/app/api/v1/audio/speech/route_client-reference-manifest.js +1 -1
  230. package/app/.next/server/app/api/v1/audio/transcriptions/route_client-reference-manifest.js +1 -1
  231. package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
  232. package/app/.next/server/app/api/v1/embeddings/route_client-reference-manifest.js +1 -1
  233. package/app/.next/server/app/api/v1/images/generations/route_client-reference-manifest.js +1 -1
  234. package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
  235. package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
  236. package/app/.next/server/app/api/v1/models/route_client-reference-manifest.js +1 -1
  237. package/app/.next/server/app/api/v1/moderations/route_client-reference-manifest.js +1 -1
  238. package/app/.next/server/app/api/v1/providers/[provider]/chat/completions/route_client-reference-manifest.js +1 -1
  239. package/app/.next/server/app/api/v1/providers/[provider]/embeddings/route_client-reference-manifest.js +1 -1
  240. package/app/.next/server/app/api/v1/providers/[provider]/images/generations/route_client-reference-manifest.js +1 -1
  241. package/app/.next/server/app/api/v1/rerank/route_client-reference-manifest.js +1 -1
  242. package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
  243. package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
  244. package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
  245. package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
  246. package/app/.next/server/app/callback/page.js +2 -2
  247. package/app/.next/server/app/callback/page.js.nft.json +1 -1
  248. package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  249. package/app/.next/server/app/docs/page.js +2 -2
  250. package/app/.next/server/app/docs/page.js.nft.json +1 -1
  251. package/app/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  252. package/app/.next/server/app/forbidden/page.js +2 -2
  253. package/app/.next/server/app/forbidden/page.js.nft.json +1 -1
  254. package/app/.next/server/app/forbidden/page_client-reference-manifest.js +1 -1
  255. package/app/.next/server/app/forgot-password/page.js +2 -2
  256. package/app/.next/server/app/forgot-password/page.js.nft.json +1 -1
  257. package/app/.next/server/app/forgot-password/page_client-reference-manifest.js +1 -1
  258. package/app/.next/server/app/landing/page.js +2 -2
  259. package/app/.next/server/app/landing/page.js.nft.json +1 -1
  260. package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  261. package/app/.next/server/app/login/page.js +2 -2
  262. package/app/.next/server/app/login/page.js.nft.json +1 -1
  263. package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
  264. package/app/.next/server/app/page.js +1 -1
  265. package/app/.next/server/app/page.js.nft.json +1 -1
  266. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  267. package/app/.next/server/app/privacy/page.js +2 -2
  268. package/app/.next/server/app/privacy/page.js.nft.json +1 -1
  269. package/app/.next/server/app/privacy/page_client-reference-manifest.js +1 -1
  270. package/app/.next/server/app/terms/page.js +2 -2
  271. package/app/.next/server/app/terms/page.js.nft.json +1 -1
  272. package/app/.next/server/app/terms/page_client-reference-manifest.js +1 -1
  273. package/app/.next/server/app-paths-manifest.json +39 -39
  274. package/app/.next/server/chunks/1248.js +1 -0
  275. package/app/.next/server/chunks/{3994.js → 1465.js} +2 -2
  276. package/app/.next/server/chunks/1526.js +1 -0
  277. package/app/.next/server/chunks/1584.js +1 -0
  278. package/app/.next/server/chunks/1623.js +1 -0
  279. package/app/.next/server/chunks/1880.js +1 -0
  280. package/app/.next/server/chunks/1960.js +1 -1
  281. package/app/.next/server/chunks/1990.js +1 -1
  282. package/app/.next/server/chunks/2214.js +1 -0
  283. package/app/.next/server/chunks/2372.js +1 -0
  284. package/app/.next/server/chunks/2594.js +1 -0
  285. package/app/.next/server/chunks/3371.js +1 -0
  286. package/app/.next/server/chunks/3498.js +5 -3
  287. package/app/.next/server/chunks/3911.js +1 -0
  288. package/app/.next/server/chunks/438.js +1 -0
  289. package/app/.next/server/chunks/496.js +1 -0
  290. package/app/.next/server/chunks/5047.js +1 -0
  291. package/app/.next/server/chunks/5094.js +1 -0
  292. package/app/.next/server/chunks/5097.js +1 -0
  293. package/app/.next/server/chunks/5393.js +2 -0
  294. package/app/.next/server/chunks/5521.js +1 -0
  295. package/app/.next/server/chunks/5945.js +1 -0
  296. package/app/.next/server/chunks/6118.js +1 -0
  297. package/app/.next/server/chunks/6930.js +1 -0
  298. package/app/.next/server/chunks/7011.js +1 -0
  299. package/app/.next/server/chunks/708.js +1 -0
  300. package/app/.next/server/chunks/7650.js +1 -0
  301. package/app/.next/server/chunks/8220.js +1 -0
  302. package/app/.next/server/chunks/8464.js +1 -0
  303. package/app/.next/server/chunks/8706.js +1 -0
  304. package/app/.next/server/chunks/8976.js +1 -0
  305. package/app/.next/server/chunks/9119.js +1 -0
  306. package/app/.next/server/chunks/944.js +1 -0
  307. package/app/.next/server/chunks/9824.js +2 -2
  308. package/app/.next/server/chunks/9837.js +1 -0
  309. package/app/.next/server/pages/500.html +2 -2
  310. package/app/.next/server/server-reference-manifest.js +1 -1
  311. package/app/.next/server/server-reference-manifest.json +1 -1
  312. package/app/.next/static/chunks/{6458-085536744d592424.js → 1149-fefe7f95f0e9842f.js} +1 -1
  313. package/app/.next/static/chunks/{5846-bac355f56b136439.js → 5846-c6bffec2bf9757fa.js} +1 -1
  314. package/app/.next/static/chunks/{782-5e138760b7f7bf48.js → 8055-5844ff783b2e8a99.js} +3 -3
  315. package/app/.next/static/chunks/{993-961f6e199b93539a.js → 993-cf9fe6c017bc7e67.js} +3 -3
  316. package/app/.next/static/chunks/app/(dashboard)/dashboard/analytics/page-52f76c7c91444ec2.js +1 -0
  317. package/app/.next/static/chunks/app/(dashboard)/dashboard/api-manager/page-1dd4d0c348a7b0a6.js +1 -0
  318. package/app/.next/static/chunks/app/(dashboard)/dashboard/audit-log/page-e5bf8955e7b9a4f5.js +1 -0
  319. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-ce332ffdb491a4d8.js +15 -0
  320. package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/{page-ede2315b6918315e.js → page-6abed29d64c46388.js} +1 -1
  321. package/app/.next/static/chunks/app/(dashboard)/dashboard/costs/page-3ed2a7685adf9b91.js +1 -0
  322. package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-1420c3ca376f1585.js +1 -0
  323. package/app/.next/static/chunks/app/(dashboard)/dashboard/health/page-9a6519bf1468f16e.js +1 -0
  324. package/app/.next/static/chunks/app/(dashboard)/dashboard/limits/page-f4a2d6d07df5ddc4.js +1 -0
  325. package/app/.next/static/chunks/app/(dashboard)/dashboard/logs/{page-6ee69634597daee0.js → page-833d24f322a20f5a.js} +1 -1
  326. package/app/.next/static/chunks/app/(dashboard)/dashboard/onboarding/page-ec914ae79f085e6f.js +1 -0
  327. package/app/.next/static/chunks/app/(dashboard)/dashboard/page-388840686801f3f5.js +1 -0
  328. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-9c8ffb212f855704.js +1 -0
  329. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/new/page-31cdb6e15134d8c2.js +1 -0
  330. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-1f022385b812b987.js +1 -0
  331. package/app/.next/static/chunks/app/(dashboard)/dashboard/settings/page-1393d4935fc087cf.js +1 -0
  332. package/app/.next/static/chunks/app/(dashboard)/dashboard/settings/pricing/{page-77158451270c1852.js → page-f10a8d4bb8236913.js} +1 -1
  333. package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-83b07523f81d6282.js +4 -0
  334. package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-9cc99ab874fc36e7.js +1 -0
  335. package/app/.next/static/chunks/app/(dashboard)/{layout-b23c2c5427e04dcf.js → layout-00d5d56af65098a9.js} +1 -1
  336. package/app/.next/static/chunks/app/callback/page-585a53f7dc6a30f1.js +1 -0
  337. package/app/.next/static/chunks/app/docs/page-2fe9dcbeb3f738c0.js +1 -0
  338. package/app/.next/static/chunks/app/forbidden/{page-4a39fedc08aaaf55.js → page-df886dfa2d5bd9fa.js} +1 -1
  339. package/app/.next/static/chunks/app/forgot-password/page-2a495f0b0c653ab4.js +1 -0
  340. package/app/.next/static/chunks/app/landing/page-9d540ab1716f8e3e.js +1 -0
  341. package/app/.next/static/chunks/app/login/page-121c612ee459e7c2.js +1 -0
  342. package/app/.next/static/chunks/app/privacy/page-2fe9dcbeb3f738c0.js +1 -0
  343. package/app/.next/static/chunks/app/terms/page-2fe9dcbeb3f738c0.js +1 -0
  344. package/app/.next/static/css/6f101b114a4a7286.css +1 -0
  345. package/app/package.json +1 -1
  346. package/package.json +1 -1
  347. package/app/.next/server/chunks/1259.js +0 -2
  348. package/app/.next/server/chunks/4509.js +0 -1
  349. package/app/.next/static/chunks/app/(dashboard)/dashboard/analytics/page-3fcbbdb2221f0b0c.js +0 -1
  350. package/app/.next/static/chunks/app/(dashboard)/dashboard/api-manager/page-d806e4f28c15636a.js +0 -1
  351. package/app/.next/static/chunks/app/(dashboard)/dashboard/audit-log/page-27bc511cf3930e1e.js +0 -1
  352. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-ad885fdf9806e9a6.js +0 -15
  353. package/app/.next/static/chunks/app/(dashboard)/dashboard/costs/page-f256689b8410bd74.js +0 -1
  354. package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-6e4f3ca7ac9778be.js +0 -1
  355. package/app/.next/static/chunks/app/(dashboard)/dashboard/health/page-8725f1a181e558a3.js +0 -1
  356. package/app/.next/static/chunks/app/(dashboard)/dashboard/limits/page-a5a48afa8c125ada.js +0 -1
  357. package/app/.next/static/chunks/app/(dashboard)/dashboard/onboarding/page-931fa0c45dca76c9.js +0 -1
  358. package/app/.next/static/chunks/app/(dashboard)/dashboard/page-04bc41f9e9de17ef.js +0 -1
  359. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-6b6d62c5872aee46.js +0 -1
  360. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/new/page-2dc2a865e90681dd.js +0 -1
  361. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-ac85ce5066cd9044.js +0 -1
  362. package/app/.next/static/chunks/app/(dashboard)/dashboard/settings/page-88cac9e6f2fbe335.js +0 -1
  363. package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-75c8b38a55e13042.js +0 -4
  364. package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-f0809c7842e4f5b4.js +0 -1
  365. package/app/.next/static/chunks/app/callback/page-e439cd5a287000d8.js +0 -1
  366. package/app/.next/static/chunks/app/docs/page-8f74097544a61b9d.js +0 -1
  367. package/app/.next/static/chunks/app/forgot-password/page-057ea91c6f140e0b.js +0 -1
  368. package/app/.next/static/chunks/app/landing/page-09741814aaca7548.js +0 -1
  369. package/app/.next/static/chunks/app/login/page-c1d7bfab91a7877c.js +0 -1
  370. package/app/.next/static/chunks/app/privacy/page-8f74097544a61b9d.js +0 -1
  371. package/app/.next/static/chunks/app/terms/page-8f74097544a61b9d.js +0 -1
  372. package/app/.next/static/css/e90887a86e63903f.css +0 -1
  373. /package/app/.next/static/{8UAle4UTGR7gIVofXmh_1 → XOdkUGO-Pm15MwsN4s6B3}/_buildManifest.js +0 -0
  374. /package/app/.next/static/{8UAle4UTGR7gIVofXmh_1 → XOdkUGO-Pm15MwsN4s6B3}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8460],{37667:(e,t,a)=>{Promise.resolve().then(a.bind(a,75926))},75926:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>f});var s=a(95155),r=a(12115),l=a(5772),i=a(14051),n=a.n(i),o=a(40993),d=a(52529),c=a(20909),p=a(98500),m=a.n(p),x=a(67671),u=a(50910);function h(){let e=(0,u.c)("providers"),t=(0,u.c)("common"),a={available:{icon:"check_circle",color:"#22c55e",label:e("available")},cooldown:{icon:"schedule",color:"#f59e0b",label:e("cooldown")},unavailable:{icon:"error",color:"#ef4444",label:e("unavailable")},unknown:{icon:"help",color:"#6b7280",label:e("unknown")}},[l,i]=(0,r.useState)(null),[n,d]=(0,r.useState)(!0),[c,p]=(0,r.useState)(!1),[m,h]=(0,r.useState)(null),b=(0,r.useRef)(null),f=(0,x.i)(),g=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/models/availability");if(e.ok){let t=await e.json();i(t)}}catch{}finally{d(!1)}},[]);(0,r.useEffect)(()=>{g();let e=setInterval(g,3e4);return()=>clearInterval(e)},[g]),(0,r.useEffect)(()=>{let e=e=>{b.current&&!b.current.contains(e.target)&&p(!1)};return c&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[c]);let v=async(t,a)=>{h(`${t}:${a}`);try{(await fetch("/api/models/availability",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clearCooldown",provider:t,model:a})})).ok?(f.success(e("cooldownCleared",{model:a})),await g()):f.error(e("failedClearCooldown"))}catch{f.error(e("failedClearCooldown"))}finally{h(null)}};if(n)return null;let y=l?.models||[],j=l?.unavailableCount||y.filter(e=>"available"!==e.status).length,N=0===j,C={};return y.forEach(e=>{if("available"===e.status)return;let t=e.provider||"unknown";C[t]||(C[t]=[]),C[t].push(e)}),(0,s.jsxs)("div",{className:"relative",ref:b,children:[(0,s.jsxs)("button",{onClick:()=>p(!c),className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-all ${N?"bg-emerald-500/10 border-emerald-500/20 text-emerald-500 hover:bg-emerald-500/15":"bg-amber-500/10 border-amber-500/20 text-amber-500 hover:bg-amber-500/15"}`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]","aria-hidden":"true",children:N?"verified":"warning"}),N?e("allModelsOperational"):e("modelsWithIssues",{count:j})]}),c&&(0,s.jsxs)("div",{className:"absolute top-full right-0 mt-2 w-80 bg-surface border border-border rounded-xl shadow-2xl z-50 overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-bg",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",style:{color:N?"#22c55e":"#f59e0b"},"aria-hidden":"true",children:N?"verified":"warning"}),(0,s.jsx)("span",{className:"text-sm font-semibold text-text-main",children:e("modelStatus")})]}),(0,s.jsx)("button",{onClick:g,className:"p-1 rounded-lg hover:bg-surface text-text-muted hover:text-text-main transition-colors",title:t("refresh"),children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]","aria-hidden":"true",children:"refresh"})})]}),(0,s.jsx)("div",{className:"px-4 py-3 max-h-60 overflow-y-auto",children:N?(0,s.jsx)("p",{className:"text-sm text-text-muted text-center py-2",children:e("allModelsNormal")}):(0,s.jsx)("div",{className:"flex flex-col gap-2.5",children:Object.entries(C).map(([t,r])=>(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-text-main mb-1.5 capitalize",children:t}),(0,s.jsx)("div",{className:"flex flex-col gap-1",children:r.map(t=>{let r=a[t.status]||a.unknown,l=m===`${t.provider}:${t.model}`;return(0,s.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5 rounded-lg bg-surface/30",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px] shrink-0",style:{color:r.color},"aria-hidden":"true",children:r.icon}),(0,s.jsx)("span",{className:"font-mono text-xs text-text-main truncate",children:t.model})]}),"cooldown"===t.status&&(0,s.jsx)(o.$n,{size:"sm",variant:"ghost",onClick:()=>v(t.provider,t.model),disabled:l,className:"text-[10px] px-1.5! py-0.5! ml-2",children:l?e("clearing"):e("clearCooldown")})]},`${t.provider}-${t.model}`)})})]},t))})})]})]})}function b(e,t,a,r){let l=[];if(e>0&&l.push((0,s.jsx)(o.Ex,{variant:"success",size:"sm",dot:!0,children:r("connected",{count:e})},"connected")),t>0){let e=a?r("errorCount",{count:t,code:a}):r("errorCountNoCode",{count:t});l.push((0,s.jsx)(o.Ex,{variant:"error",size:"sm",dot:!0,children:e},"error"))}return 0===l.length?(0,s.jsx)("span",{className:"text-text-muted",children:r("noConnections")}):l}function f(){let[e,t]=(0,r.useState)([]),[a,l]=(0,r.useState)([]),[i,n]=(0,r.useState)(!0),[p,m]=(0,r.useState)(!1),[b,f]=(0,r.useState)(!1),[C,k]=(0,r.useState)(null),[w,T]=(0,r.useState)(null),S=(0,x.i)(),U=(0,u.c)("providers"),E=(0,u.c)("common");(0,r.useEffect)(()=>{(async()=>{try{let[e,a]=await Promise.all([fetch("/api/providers"),fetch("/api/provider-nodes")]),s=await e.json(),r=await a.json();e.ok&&t(s.connections||[]),a.ok&&l(r.nodes||[])}catch(e){console.log("Error fetching data:",e)}finally{n(!1)}})()},[]);let A=(t,a)=>{let s=e.filter(e=>e.provider===t&&e.authType===a),r=e=>{let t=e.rateLimitedUntil&&new Date(e.rateLimitedUntil).getTime()>Date.now();return"unavailable"!==e.testStatus||t?e.testStatus:"active"},l=s.filter(e=>{let t=r(e);return"active"===t||"success"===t}).length,i=s.filter(e=>{let t=r(e);return"error"===t||"expired"===t||"unavailable"===t}),n=i.length,o=s.length,d=o>0&&s.every(e=>!1===e.isActive),c=i.sort((e,t)=>new Date(t.lastErrorAt||0)-new Date(e.lastErrorAt||0))[0];return{connected:l,error:n,total:o,errorCode:c?function(e){if(!e)return null;let t=e.lastErrorType;if("runtime_error"===t)return"RUNTIME";if("upstream_auth_error"===t||"auth_missing"===t||"token_refresh_failed"===t||"token_expired"===t)return"AUTH";if("upstream_rate_limited"===t)return"429";if("upstream_unavailable"===t)return"5XX";if("network_error"===t)return"NET";let a=Number(e.errorCode);if(Number.isFinite(a)&&a>=400)return String(a);let s=function(e){if(!e)return null;let t=e.match(/\b([45]\d{2})\b/);return t?t[1]:"ERR"}(e.lastError);if("401"===s||"403"===s)return"AUTH";if(s&&"ERR"!==s)return s;let r=(e.lastError||"").toLowerCase();return r.includes("runtime")||r.includes("not runnable")||r.includes("not installed")?"RUNTIME":r.includes("invalid api key")||r.includes("token invalid")||r.includes("revoked")||r.includes("unauthorized")?"AUTH":"ERR"}(c):null,errorTime:c?.lastErrorAt?function(e){if(!e)return"";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let a=Math.floor(t/60);if(a<24)return`${a}h ago`;let s=Math.floor(a/24);return`${s}d ago`}(c.lastErrorAt):null,allDisabled:d}},$=async(a,s,r)=>{let l=e.filter(e=>e.provider===a&&e.authType===s);t(e=>e.map(e=>e.provider===a&&e.authType===s?{...e,isActive:r}:e)),await Promise.allSettled(l.map(e=>fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:r})})))},O=async(e,t=null)=>{if(!C){k("provider"===e?t:e),T(null);try{let a=await fetch("/api/providers/test-batch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e,providerId:t})}),s=await a.json();if(T(s),s.summary){let{passed:e,failed:t,total:a}=s.summary;0===t?S.success(U("allTestsPassed",{total:a})):S.warning(U("testSummary",{passed:e,failed:t,total:a}))}}catch(e){T({error:U("providerTestFailed")}),S.error(U("providerTestFailed"))}finally{k(null)}}},P=a.filter(e=>"openai-compatible"===e.type).map(e=>({id:e.id,name:e.name||U("openaiCompatibleName"),color:"#10A37F",textIcon:"OC",apiType:e.apiType})),z=a.filter(e=>"anthropic-compatible"===e.type).map(e=>({id:e.id,name:e.name||U("anthropicCompatibleName"),color:"#D97757",textIcon:"AC"}));return i?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsx)(o.Qv,{}),(0,s.jsx)(o.Qv,{})]}):(0,s.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[U("oauthProviders")," ",(0,s.jsx)("span",{className:"size-2.5 rounded-full bg-blue-500",title:U("oauthLabel")})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(h,{}),(0,s.jsxs)("button",{onClick:()=>O("oauth"),disabled:!!C,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-colors ${"oauth"===C?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg-subtle border-border text-text-muted hover:text-text-primary hover:border-primary/40"}`,title:U("testAllOAuth"),"aria-label":U("testAllOAuth"),children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"oauth"===C?"sync":"play_arrow"}),"oauth"===C?U("testing"):U("testAll")]})]})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Object.entries(d.zN).map(([e,t])=>(0,s.jsx)(g,{providerId:e,provider:t,stats:A(e,"oauth"),authType:"oauth",onToggle:t=>$(e,"oauth",t)},e))})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[U("freeProviders")," ",(0,s.jsx)("span",{className:"size-2.5 rounded-full bg-green-500",title:E("free")})]}),(0,s.jsxs)("button",{onClick:()=>O("free"),disabled:!!C,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-colors ${"free"===C?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg-subtle border-border text-text-muted hover:text-text-primary hover:border-primary/40"}`,title:U("testAllFree"),"aria-label":U("testAllFree"),children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"free"===C?"sync":"play_arrow"}),"free"===C?U("testing"):U("testAll")]})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Object.entries(c.IS).map(([e,t])=>(0,s.jsx)(g,{providerId:e,provider:t,stats:A(e,"oauth"),authType:"free",onToggle:t=>$(e,"oauth",t)},e))})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[U("apiKeyProviders")," ",(0,s.jsx)("span",{className:"size-2.5 rounded-full bg-amber-500",title:U("apiKeyLabel")})]}),(0,s.jsxs)("button",{onClick:()=>O("apikey"),disabled:!!C,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-colors ${"apikey"===C?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg-subtle border-border text-text-muted hover:text-text-primary hover:border-primary/40"}`,title:U("testAllApiKey"),"aria-label":U("testAllApiKey"),children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"apikey"===C?"sync":"play_arrow"}),"apikey"===C?U("testing"):U("testAll")]})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Object.entries(d.fg).map(([e,t])=>(0,s.jsx)(v,{providerId:e,provider:t,stats:A(e,"apikey"),authType:"apikey",onToggle:t=>$(e,"apikey",t)},e))})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[U("compatibleProviders")," ",(0,s.jsx)("span",{className:"size-2.5 rounded-full bg-orange-500",title:U("compatibleLabel")})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(P.length>0||z.length>0)&&(0,s.jsxs)("button",{onClick:()=>O("compatible"),disabled:!!C,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-colors ${"compatible"===C?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg-subtle border-border text-text-muted hover:text-text-primary hover:border-primary/40"}`,title:U("testAllCompatible"),children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"compatible"===C?"sync":"play_arrow"}),"compatible"===C?U("testing"):U("testAll")]}),(0,s.jsx)(o.$n,{size:"sm",icon:"add",onClick:()=>f(!0),children:U("addAnthropicCompatible")}),(0,s.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"add",onClick:()=>m(!0),className:"!bg-white !text-black hover:!bg-gray-100",children:U("addOpenAICompatible")})]})]}),0===P.length&&0===z.length?(0,s.jsxs)("div",{className:"text-center py-8 border border-dashed border-border rounded-xl",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[32px] text-text-muted mb-2",children:"extension"}),(0,s.jsx)("p",{className:"text-text-muted text-sm",children:U("noCompatibleYet")}),(0,s.jsx)("p",{className:"text-text-muted text-xs mt-1",children:U("compatibleHint")})]}):(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[...P,...z].map(e=>(0,s.jsx)(v,{providerId:e.id,provider:e,stats:A(e.id,"apikey"),authType:"compatible",onToggle:t=>$(e.id,"apikey",t)},e.id))})]}),(0,s.jsx)(y,{isOpen:p,onClose:()=>m(!1),onCreated:e=>{l(t=>[...t,e]),m(!1)}}),(0,s.jsx)(j,{isOpen:b,onClose:()=>f(!1),onCreated:e=>{l(t=>[...t,e]),f(!1)}}),w&&(0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[10vh]",onClick:()=>T(null),children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),(0,s.jsxs)("div",{className:"relative bg-bg-primary border border-border rounded-xl w-full max-w-[600px] max-h-[80vh] overflow-y-auto shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"sticky top-0 z-10 flex items-center justify-between px-5 py-3 border-b border-border bg-bg-primary/95 backdrop-blur-sm rounded-t-xl",children:[(0,s.jsx)("h3",{className:"font-semibold",children:U("testResults")}),(0,s.jsx)("button",{onClick:()=>T(null),className:"p-1 rounded-lg hover:bg-bg-subtle text-text-muted hover:text-text-primary transition-colors","aria-label":E("close"),children:(0,s.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]}),(0,s.jsx)("div",{className:"p-5",children:(0,s.jsx)(N,{results:w})})]})]})]})}function g({providerId:e,provider:t,stats:a,authType:i,onToggle:n}){let d=(0,u.c)("providers"),c=(0,u.c)("common"),{connected:p,error:x,errorCode:h,errorTime:f,allDisabled:g}=a,[v,y]=(0,r.useState)(!1),j={free:"bg-green-500",oauth:"bg-blue-500",apikey:"bg-amber-500",compatible:"bg-orange-500"},N={free:c("free"),oauth:d("oauthLabel"),apikey:d("apiKeyLabel"),compatible:d("compatibleLabel")};return(0,s.jsx)(m(),{href:`/dashboard/providers/${e}`,className:"group",children:(0,s.jsx)(o.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${g?"opacity-50":""}`,children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color}15`},children:v?(0,s.jsx)("span",{className:"text-xs font-bold",style:{color:t.color},children:t.textIcon||t.id.slice(0,2).toUpperCase()}):(0,s.jsx)(l.default,{src:`/providers/${t.id}.png`,alt:t.name,width:30,height:30,className:"object-contain rounded-lg max-w-[32px] max-h-[32px]",sizes:"32px",onError:()=>y(!0)})}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("h3",{className:"font-semibold flex items-center gap-1.5",children:[t.name,(0,s.jsx)("span",{className:`size-2 rounded-full ${j[i]||j.oauth} shrink-0`,title:N[i]||d("oauthLabel")})]}),(0,s.jsx)("div",{className:"flex items-center gap-2 text-xs flex-wrap",children:g?(0,s.jsx)(o.Ex,{variant:"default",size:"sm",children:(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"pause_circle"}),d("disabled")]})}):(0,s.jsxs)(s.Fragment,{children:[b(p,x,h,d),f&&(0,s.jsxs)("span",{className:"text-text-muted",children:["• ",f]})]})})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[a.total>0&&(0,s.jsx)("div",{onClick:e=>{e.preventDefault(),e.stopPropagation(),n(!!g)},className:"",children:(0,s.jsx)(o.lM,{size:"sm",checked:!g,onChange:()=>{},title:d(g?"enableProvider":"disableProvider")})}),(0,s.jsx)("span",{className:"material-symbols-outlined text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"chevron_right"})]})]})})})}function v({providerId:e,provider:t,stats:a,authType:i,onToggle:n}){let d=(0,u.c)("providers"),p=(0,u.c)("common"),{connected:x,error:h,errorCode:f,errorTime:g,allDisabled:v}=a,y=e.startsWith(c.JH),j=e.startsWith(c.DI),[N,C]=(0,r.useState)(!1),k={free:"bg-green-500",oauth:"bg-blue-500",apikey:"bg-amber-500",compatible:"bg-orange-500"},w={free:p("free"),oauth:d("oauthLabel"),apikey:d("apiKeyLabel"),compatible:d("compatibleLabel")};return(0,s.jsx)(m(),{href:`/dashboard/providers/${e}`,className:"group",children:(0,s.jsx)(o.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${v?"opacity-50":""}`,children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color}15`},children:N?(0,s.jsx)("span",{className:"text-xs font-bold",style:{color:t.color},children:t.textIcon||t.id.slice(0,2).toUpperCase()}):(0,s.jsx)(l.default,{src:y?"responses"===t.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":j?"/providers/anthropic-m.png":`/providers/${t.id}.png`,alt:t.name,width:30,height:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",sizes:"30px",onError:()=>C(!0)})}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("h3",{className:"font-semibold flex items-center gap-1.5",children:[t.name,(0,s.jsx)("span",{className:`size-2 rounded-full ${k[i]||k.apikey} shrink-0`,title:w[i]||d("apiKeyLabel")})]}),(0,s.jsx)("div",{className:"flex items-center gap-2 text-xs flex-wrap",children:v?(0,s.jsx)(o.Ex,{variant:"default",size:"sm",children:(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"pause_circle"}),d("disabled")]})}):(0,s.jsxs)(s.Fragment,{children:[b(x,h,f,d),y&&(0,s.jsx)(o.Ex,{variant:"default",size:"sm",children:d("responses"===t.apiType?"responses":"chat")}),j&&(0,s.jsx)(o.Ex,{variant:"default",size:"sm",children:d("messages")}),g&&(0,s.jsxs)("span",{className:"text-text-muted",children:["• ",g]})]})})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[a.total>0&&(0,s.jsx)("div",{onClick:e=>{e.preventDefault(),e.stopPropagation(),n(!!v)},className:"",children:(0,s.jsx)(o.lM,{size:"sm",checked:!v,onChange:()=>{},title:d(v?"enableProvider":"disableProvider")})}),(0,s.jsx)("span",{className:"material-symbols-outlined text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"chevron_right"})]})]})})})}function y({isOpen:e,onClose:t,onCreated:a}){let l=(0,u.c)("providers"),[i,n]=(0,r.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[d,c]=(0,r.useState)(!1),[p,m]=(0,r.useState)(""),[x,h]=(0,r.useState)(!1),[b,f]=(0,r.useState)(null),g=[{value:"chat",label:l("chatCompletions")},{value:"responses",label:l("responsesApi")}];(0,r.useEffect)(()=>{n(e=>({...e,baseUrl:"https://api.openai.com/v1"}))},[i.apiType]);let v=async()=>{if(i.name.trim()&&i.prefix.trim()&&i.baseUrl.trim()){c(!0);try{let e=await fetch("/api/provider-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i.name,prefix:i.prefix,apiType:i.apiType,baseUrl:i.baseUrl,type:"openai-compatible"})}),t=await e.json();e.ok&&(a(t.node),n({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),m(""),f(null))}catch(e){console.log("Error creating OpenAI Compatible node:",e)}finally{c(!1)}}},y=async()=>{h(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:i.baseUrl,apiKey:p,type:"openai-compatible"})}),t=await e.json();f(t.valid?"success":"failed")}catch{f("failed")}finally{h(!1)}};return(0,s.jsx)(o.aF,{isOpen:e,title:l("addOpenAICompatible"),onClose:t,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(o.pd,{label:l("nameLabel"),value:i.name,onChange:e=>n({...i,name:e.target.value}),placeholder:l("compatibleProdPlaceholder",{type:l("openai")}),hint:l("nameHint")}),(0,s.jsx)(o.pd,{label:l("prefixLabel"),value:i.prefix,onChange:e=>n({...i,prefix:e.target.value}),placeholder:l("openaiPrefixPlaceholder"),hint:l("prefixHint")}),(0,s.jsx)(o.l6,{label:l("apiTypeLabel"),options:g,value:i.apiType,onChange:e=>n({...i,apiType:e.target.value})}),(0,s.jsx)(o.pd,{label:l("baseUrlLabel"),value:i.baseUrl,onChange:e=>n({...i,baseUrl:e.target.value}),placeholder:l("openaiBaseUrlPlaceholder"),hint:l("compatibleBaseUrlHint",{type:l("openai")})}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(o.pd,{label:l("apiKeyForCheck"),type:"password",value:p,onChange:e=>m(e.target.value),className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(o.$n,{onClick:y,disabled:!p||x||!i.baseUrl.trim(),variant:"secondary",children:l(x?"checking":"check")})})]}),b&&(0,s.jsx)(o.Ex,{variant:"success"===b?"success":"error",children:l("success"===b?"valid":"invalid")}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(o.$n,{onClick:v,fullWidth:!0,disabled:!i.name.trim()||!i.prefix.trim()||!i.baseUrl.trim()||d,children:l(d?"creating":"add")}),(0,s.jsx)(o.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:l("cancel")})]})]})})}function j({isOpen:e,onClose:t,onCreated:a}){let l=(0,u.c)("providers"),[i,n]=(0,r.useState)({name:"",prefix:"",baseUrl:"https://api.anthropic.com/v1"}),[d,c]=(0,r.useState)(!1),[p,m]=(0,r.useState)(""),[x,h]=(0,r.useState)(!1),[b,f]=(0,r.useState)(null);(0,r.useEffect)(()=>{e&&(f(null),m(""))},[e]);let g=async()=>{if(i.name.trim()&&i.prefix.trim()&&i.baseUrl.trim()){c(!0);try{let e=await fetch("/api/provider-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i.name,prefix:i.prefix,baseUrl:i.baseUrl,type:"anthropic-compatible"})}),t=await e.json();e.ok&&(a(t.node),n({name:"",prefix:"",baseUrl:"https://api.anthropic.com/v1"}),m(""),f(null))}catch(e){console.log("Error creating Anthropic Compatible node:",e)}finally{c(!1)}}},v=async()=>{h(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:i.baseUrl,apiKey:p,type:"anthropic-compatible"})}),t=await e.json();f(t.valid?"success":"failed")}catch{f("failed")}finally{h(!1)}};return(0,s.jsx)(o.aF,{isOpen:e,title:l("addAnthropicCompatible"),onClose:t,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(o.pd,{label:l("nameLabel"),value:i.name,onChange:e=>n({...i,name:e.target.value}),placeholder:l("compatibleProdPlaceholder",{type:l("anthropic")}),hint:l("nameHint")}),(0,s.jsx)(o.pd,{label:l("prefixLabel"),value:i.prefix,onChange:e=>n({...i,prefix:e.target.value}),placeholder:l("anthropicPrefixPlaceholder"),hint:l("prefixHint")}),(0,s.jsx)(o.pd,{label:l("baseUrlLabel"),value:i.baseUrl,onChange:e=>n({...i,baseUrl:e.target.value}),placeholder:l("anthropicBaseUrlPlaceholder"),hint:l("compatibleBaseUrlHint",{type:l("anthropic")})}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(o.pd,{label:l("apiKeyForCheck"),type:"password",value:p,onChange:e=>m(e.target.value),className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(o.$n,{onClick:v,disabled:!p||x||!i.baseUrl.trim(),variant:"secondary",children:l(x?"checking":"check")})})]}),b&&(0,s.jsx)(o.Ex,{variant:"success"===b?"success":"error",children:l("success"===b?"valid":"invalid")}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(o.$n,{onClick:g,fullWidth:!0,disabled:!i.name.trim()||!i.prefix.trim()||!i.baseUrl.trim()||d,children:l(d?"creating":"add")}),(0,s.jsx)(o.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:l("cancel")})]})]})})}function N({results:e}){let t=(0,u.c)("providers"),a=(0,u.c)("common");if(e.error&&!e.results)return(0,s.jsxs)("div",{className:"text-center py-6",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-red-500 text-[32px] mb-2 block",children:"error"}),(0,s.jsx)("p",{className:"text-sm text-red-400",children:e.error})]});let{summary:r,mode:l}=e,i=e.results||[],n={oauth:t("oauthLabel"),free:a("free"),apikey:t("apiKeyLabel"),compatible:t("compatibleLabel"),provider:t("providerLabel"),all:a("all")}[l]||l;return(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[r&&(0,s.jsxs)("div",{className:"flex items-center gap-3 text-xs mb-1",children:[(0,s.jsx)("span",{className:"text-text-muted",children:t("modeTest",{mode:n})}),(0,s.jsx)("span",{className:"px-2 py-0.5 rounded bg-emerald-500/15 text-emerald-400 font-medium",children:t("passedCount",{count:r.passed})}),r.failed>0&&(0,s.jsx)("span",{className:"px-2 py-0.5 rounded bg-red-500/15 text-red-400 font-medium",children:t("failedCount",{count:r.failed})}),(0,s.jsx)("span",{className:"text-text-muted ml-auto",children:t("testedCount",{count:r.total})})]}),i.map((e,a)=>(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs px-3 py-2 rounded-lg bg-black/[0.03] dark:bg-white/[0.03]",children:[(0,s.jsx)("span",{className:`material-symbols-outlined text-[16px] ${e.valid?"text-emerald-500":"text-red-500"}`,children:e.valid?"check_circle":"error"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("span",{className:"font-medium",children:e.connectionName}),(0,s.jsxs)("span",{className:"text-text-muted ml-1.5",children:["(",e.provider,")"]})]}),void 0!==e.latencyMs&&(0,s.jsx)("span",{className:"text-text-muted font-mono tabular-nums",children:t("millisecondsAbbr",{value:e.latencyMs})}),(0,s.jsx)("span",{className:`text-[10px] uppercase font-bold px-1.5 py-0.5 rounded ${e.valid?"bg-emerald-500/15 text-emerald-400":"bg-red-500/15 text-red-400"}`,children:e.valid?t("okShort"):e.diagnosis?.type||t("errorShort")})]},e.connectionId||a)),0===i.length&&(0,s.jsx)("div",{className:"text-center py-4 text-text-muted text-sm",children:t("noActiveConnectionsInGroup")})]})}g.propTypes={providerId:n().string.isRequired,provider:n().shape({id:n().string.isRequired,name:n().string.isRequired,color:n().string,textIcon:n().string}).isRequired,stats:n().shape({connected:n().number,error:n().number,errorCode:n().string,errorTime:n().string}).isRequired,authType:n().string},v.propTypes={providerId:n().string.isRequired,provider:n().shape({id:n().string.isRequired,name:n().string.isRequired,color:n().string,textIcon:n().string,apiType:n().string}).isRequired,stats:n().shape({connected:n().number,error:n().number,errorCode:n().string,errorTime:n().string}).isRequired,authType:n().string},y.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onCreated:n().func.isRequired},j.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onCreated:n().func.isRequired},N.propTypes={results:n().shape({mode:n().string,results:n().array,summary:n().shape({total:n().number,passed:n().number,failed:n().number}),error:n().string}).isRequired}}},e=>{e.O(0,[3418,8500,9751,8055,1149,5846,993,8441,3794,7358],()=>e(e.s=37667)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2791],{49162:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>q});var a=s(95155),l=s(12115),r=s(73321),i=s(67040),n=s(52529),c=s(50910),d=s(40993),o=s(33418);function m(){let[e,t]=(0,l.useState)([]),[s,r]=(0,l.useState)(!1),[i,n]=(0,l.useState)(!1),[m,x]=(0,l.useState)({type:"",message:""}),[h,u]=(0,l.useState)(null),[p,b]=(0,l.useState)(null),[g,f]=(0,l.useState)(!1),[j,v]=(0,l.useState)({type:"",message:""}),[y,N]=(0,l.useState)(!1),[k,w]=(0,l.useState)(!1),[C,S]=(0,l.useState)({type:"",message:""}),[D,P]=(0,l.useState)(!1),[$,L]=(0,l.useState)(null),T=(0,l.useRef)(null),A=(0,o.Ym)(),E=(0,c.c)("settings"),K=(0,c.c)("common"),[M,O]=(0,l.useState)({driver:"sqlite",dbPath:"~/.omniroute/storage.sqlite",sizeBytes:0,retentionDays:90,lastBackupAt:null}),_=async()=>{r(!0);try{let e=await fetch("/api/db-backups"),s=await e.json();t(s.backups||[])}catch(e){console.error("Failed to fetch backups:",e)}finally{r(!1)}},B=async()=>{try{let e=await fetch("/api/storage/health");if(!e.ok)return;let t=await e.json();O(e=>({...e,...t}))}catch(e){console.error("Failed to fetch storage health:",e)}},F=async()=>{f(!0),v({type:"",message:""});try{let e=await fetch("/api/db-backups",{method:"PUT"}),t=await e.json();e.ok?(t.filename?v({type:"success",message:E("backupCreated",{file:t.filename})}):v({type:"info",message:t.message||E("noChangesSinceBackup")}),await B(),i&&await _()):v({type:"error",message:t.error||E("backupFailed")})}catch{v({type:"error",message:E("errorOccurred")})}finally{f(!1)}},z=async e=>{u(e),x({type:"",message:""});try{let t=await fetch("/api/db-backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({backupId:e})}),s=await t.json();t.ok?(x({type:"success",message:E("restoreSuccess",{connections:s.connectionCount,nodes:s.nodeCount,combos:s.comboCount,apiKeys:s.apiKeyCount})}),await _(),await B()):x({type:"error",message:s.error||E("restoreFailed")})}catch{x({type:"error",message:E("errorDuringRestore")})}finally{u(null),b(null)}};(0,l.useEffect)(()=>{B()},[]);let R=async()=>{N(!0);try{let e=await fetch("/api/db-backups/export");if(!e.ok){let t=await e.json();throw Error(t.error||E("exportFailed"))}let t=await e.blob(),s=URL.createObjectURL(t),a=(e.headers.get("Content-Disposition")||"").match(/filename="(.+)"/),l=a?a[1]:`omniroute-backup-${new Date().toISOString().replace(/[:.]/g,"-")}.sqlite`,r=document.createElement("a");r.href=s,r.download=l,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(s)}catch(e){console.error("Export failed:",e),S({type:"error",message:E("exportFailedWithError",{error:e.message})})}finally{N(!1)}},q=async()=>{if($){w(!0),S({type:"",message:""}),P(!1);try{let e=new FormData;e.append("file",$);let t=await fetch("/api/db-backups/import",{method:"POST",body:e}),s=await t.json();t.ok?(S({type:"success",message:E("importSuccess",{connections:s.connectionCount,nodes:s.nodeCount,combos:s.comboCount,apiKeys:s.apiKeyCount})}),await B(),i&&await _()):S({type:"error",message:s.error||E("importFailed")})}catch{S({type:"error",message:E("errorDuringImport")})}finally{w(!1),L(null)}}},I=e=>e&&0!==e?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`:"0 B";return(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-green-500/10 text-green-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"database"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:E("systemStorage")}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:E("allDataLocal")})]}),(0,a.jsx)(d.Ex,{variant:"success",size:"sm",children:M.driver||"json"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-4",children:[(0,a.jsxs)("div",{className:"p-3 rounded-lg bg-bg border border-border",children:[(0,a.jsx)("p",{className:"text-[11px] text-text-muted uppercase tracking-wide mb-1",children:E("databasePath")}),(0,a.jsx)("p",{className:"text-sm font-mono text-text-main break-all",children:M.dbPath||"~/.omniroute/storage.sqlite"})]}),(0,a.jsxs)("div",{className:"p-3 rounded-lg bg-bg border border-border",children:[(0,a.jsx)("p",{className:"text-[11px] text-text-muted uppercase tracking-wide mb-1",children:E("databaseSize")}),(0,a.jsx)("p",{className:"text-sm font-mono text-text-main",children:I(M.sizeBytes)})]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-4",children:[(0,a.jsxs)(d.$n,{variant:"outline",size:"sm",onClick:R,loading:y,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1","aria-hidden":"true",children:"download"}),E("exportDatabase")]}),(0,a.jsxs)(d.$n,{variant:"outline",size:"sm",onClick:async()=>{N(!0);try{let e=await fetch("/api/db-backups/exportAll");if(!e.ok)throw Error(E("exportFailed"));let t=await e.blob(),s=(e.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),a=s?.[1]||"omniroute-full-backup.tar.gz",l=URL.createObjectURL(t),r=document.createElement("a");r.href=l,r.download=a,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(l)}catch(e){S({type:"error",message:E("fullExportFailedWithError",{error:e.message})})}finally{N(!1)}},loading:y,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1","aria-hidden":"true",children:"folder_zip"}),E("exportAll")]}),(0,a.jsxs)(d.$n,{variant:"outline",size:"sm",onClick:()=>{T.current?.click()},loading:k,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1","aria-hidden":"true",children:"upload"}),E("importDatabase")]}),(0,a.jsx)("input",{ref:T,type:"file",accept:".sqlite",className:"hidden",onChange:e=>{let t=e.target.files?.[0];if(t){if(!t.name.endsWith(".sqlite"))return void S({type:"error",message:E("invalidFileType")});L(t),P(!0),T.current&&(T.current.value="")}}})]}),D&&$&&(0,a.jsx)("div",{className:"p-4 rounded-lg mb-4 bg-amber-500/10 border border-amber-500/30",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px] text-amber-500 mt-0.5","aria-hidden":"true",children:"warning"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-amber-500 mb-1",children:E("confirmDbImport")}),(0,a.jsx)("p",{className:"text-xs text-text-muted mb-2",children:E("confirmDbImportDesc",{file:$.name})}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(d.$n,{variant:"primary",size:"sm",onClick:q,className:"!bg-amber-500 hover:!bg-amber-600",children:E("yesImport")}),(0,a.jsx)(d.$n,{variant:"outline",size:"sm",onClick:()=>{P(!1),L(null)},children:K("cancel")})]})]})]})}),C.message&&(0,a.jsx)("div",{className:`p-3 rounded-lg mb-4 text-sm ${"success"===C.type?"bg-green-500/10 text-green-500 border border-green-500/20":"bg-red-500/10 text-red-500 border border-red-500/20"}`,role:"alert",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"success"===C.type?"check_circle":"error"}),C.message]})}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-bg border border-border mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-amber-500","aria-hidden":"true",children:"schedule"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:E("lastBackup")}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:M.lastBackupAt?`${new Date(M.lastBackupAt).toLocaleString(A)} (${(e=>{if(!e)return null;let t=Math.floor((new Date-new Date(e))/6e4);if(t<1)return E("justNow");if(t<60)return E("minutesAgo",{count:t});let s=Math.floor(t/60);return s<24?E("hoursAgo",{count:s}):E("daysAgo",{count:Math.floor(s/24)})})(M.lastBackupAt)})`:E("noBackupYet")})]})]}),(0,a.jsxs)(d.$n,{variant:"outline",size:"sm",onClick:F,loading:g,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1","aria-hidden":"true",children:"backup"}),E("backupNow")]})]}),j.message&&(0,a.jsx)("div",{className:`p-3 rounded-lg mb-4 text-sm ${"success"===j.type?"bg-green-500/10 text-green-500 border border-green-500/20":"info"===j.type?"bg-blue-500/10 text-blue-500 border border-blue-500/20":"bg-red-500/10 text-red-500 border border-red-500/20"}`,role:"alert",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"success"===j.type?"check_circle":"info"===j.type?"info":"error"}),j.message]})}),(0,a.jsxs)("div",{className:"pt-3 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-amber-500","aria-hidden":"true",children:"restore"}),(0,a.jsx)("p",{className:"font-medium",children:E("backupRestore")})]}),(0,a.jsx)(d.$n,{variant:"outline",size:"sm",onClick:()=>{n(!i),i||0!==e.length||_()},children:i?E("hide"):E("viewBackups")})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted mb-3",children:E("backupRetentionDesc")}),m.message&&(0,a.jsx)("div",{className:`p-3 rounded-lg mb-3 text-sm ${"success"===m.type?"bg-green-500/10 text-green-500 border border-green-500/20":"bg-red-500/10 text-red-500 border border-red-500/20"}`,role:"alert",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"success"===m.type?"check_circle":"error"}),m.message]})}),i&&(0,a.jsx)("div",{className:"flex flex-col gap-2",children:s?(0,a.jsxs)("div",{className:"flex items-center justify-center py-6 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[20px] mr-2","aria-hidden":"true",children:"progress_activity"}),E("loadingBackups")]}):0===e.length?(0,a.jsxs)("div",{className:"text-center py-6 text-text-muted text-sm",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px] mb-2 block opacity-40","aria-hidden":"true",children:"folder_off"}),E("noBackupsYet")]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:E("backupsAvailable",{count:e.length})}),(0,a.jsxs)("button",{onClick:_,className:"text-xs text-primary hover:underline flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]","aria-hidden":"true",children:"refresh"}),E("refresh")]})]}),e.map(e=>{var t;return(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-black/[0.02] dark:bg-white/[0.02] border border-border/50 hover:border-border transition-colors",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-amber-500","aria-hidden":"true",children:"description"}),(0,a.jsx)("span",{className:"text-sm font-medium truncate",children:new Date(e.createdAt).toLocaleString(A)}),(0,a.jsx)(d.Ex,{variant:"pre-restore"===e.reason?"warning":"manual"===e.reason?"success":"default",size:"sm",children:"manual"===(t=e.reason)?E("backupReasonManual"):"pre-restore"===t?E("backupReasonPreRestore"):t})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 text-xs text-text-muted ml-6",children:[(0,a.jsx)("span",{children:E("connectionsCount",{count:e.connectionCount})}),(0,a.jsx)("span",{children:"•"}),(0,a.jsx)("span",{children:I(e.size)})]})]}),(0,a.jsx)("div",{className:"flex items-center gap-2 ml-3",children:p===e.id?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-xs text-amber-500 font-medium",children:E("confirm")}),(0,a.jsx)(d.$n,{variant:"primary",size:"sm",onClick:()=>z(e.id),loading:h===e.id,className:"!bg-amber-500 hover:!bg-amber-600",children:E("yes")}),(0,a.jsx)(d.$n,{variant:"outline",size:"sm",onClick:()=>b(null),children:E("no")})]}):(0,a.jsxs)(d.$n,{variant:"outline",size:"sm",onClick:()=>b(e.id),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1","aria-hidden":"true",children:"restore"}),E("restore")]})})]},e.id)})]})})]})]})}var x=s(20909);let h=[{value:"disabled",labelKey:"ipModeDisabled",icon:"block"},{value:"blacklist",labelKey:"ipModeBlacklist",icon:"do_not_disturb"},{value:"whitelist",labelKey:"ipModeWhitelist",icon:"verified_user"},{value:"whitelist-priority",labelKey:"ipModeWhitelistPriority",icon:"priority_high"}];function u(){let[e,t]=(0,l.useState)({enabled:!1,mode:"blacklist",blacklist:[],whitelist:[],tempBans:[]}),[s,r]=(0,l.useState)(!0),[i,n]=(0,l.useState)(""),[o,m]=(0,l.useState)("blacklist"),x=(0,c.c)("settings");(0,l.useEffect)(()=>{u()},[]);let u=async()=>{try{let e=await fetch("/api/settings/ip-filter");e.ok&&t(await e.json())}catch{}finally{r(!1)}},p=async e=>{try{let s=await fetch("/api/settings/ip-filter",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});s.ok&&t(await s.json())}catch{}},b=()=>{i.trim()&&(p({["blacklist"===o?"addBlacklist":"addWhitelist"]:i.trim()}),n(""))},g=(e,t)=>{p({["blacklist"===t?"removeBlacklist":"removeWhitelist"]:e})},f=e.enabled?e.mode:"disabled";return(0,a.jsxs)(d.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-red-500/10 text-red-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"security"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:x("ipAccessControl")}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:x("ipAccessControlDesc")})]})]}),(0,a.jsx)("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-2 mb-5",children:h.map(e=>(0,a.jsxs)("button",{onClick:()=>{var t;"disabled"===(t=e.value)?p({enabled:!1}):p({enabled:!0,mode:t})},disabled:s,className:`flex flex-col items-center gap-1.5 p-3 rounded-lg border text-center transition-all ${f===e.value?"border-red-500/50 bg-red-500/5 ring-1 ring-red-500/20":"border-border/50 hover:border-border hover:bg-surface/30"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[20px] ${f===e.value?"text-red-400":"text-text-muted"}`,children:e.icon}),(0,a.jsx)("span",{className:`text-xs font-medium ${f===e.value?"text-red-400":"text-text-muted"}`,children:x(e.labelKey)})]},e.value))}),e.enabled&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2 items-stretch sm:items-end",children:[(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)(d.pd,{label:x("addIpAddress"),placeholder:x("ipAddressPlaceholder"),value:i,onChange:e=>n(e.target.value),onKeyDown:e=>"Enter"===e.key&&b()})}),(0,a.jsxs)("div",{className:"flex gap-1 pb-[2px]",children:[(0,a.jsx)(d.$n,{size:"sm",variant:"blacklist"===o?"danger":"secondary",onClick:()=>{m("blacklist"),i.trim()&&b()},children:x("block")}),(0,a.jsx)(d.$n,{size:"sm",variant:"whitelist"===o?"primary":"secondary",onClick:()=>{m("whitelist"),i.trim()&&b()},children:x("allow")})]})]}),e.blacklist.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider mb-2",children:x("blocked",{count:e.blacklist.length})}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.blacklist.map(e=>(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-mono bg-red-500/10 text-red-400 border border-red-500/20",children:[e,(0,a.jsx)("button",{onClick:()=>g(e,"blacklist"),className:"hover:text-red-300",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e))})]}),e.whitelist.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider mb-2",children:x("allowed",{count:e.whitelist.length})}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.whitelist.map(e=>(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-mono bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[e,(0,a.jsx)("button",{onClick:()=>g(e,"whitelist"),className:"hover:text-emerald-300",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e))})]}),e.tempBans.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider mb-2",children:x("temporaryBans",{count:e.tempBans.length})}),(0,a.jsx)("div",{className:"flex flex-col gap-1.5",children:e.tempBans.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2 rounded-lg bg-orange-500/5 border border-orange-500/20 text-sm",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,a.jsx)("span",{className:"font-mono text-xs text-orange-400 shrink-0",children:e.ip}),(0,a.jsxs)("span",{className:"text-xs text-text-muted truncate",children:["— ",e.reason]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted tabular-nums",children:x("minLeft",{min:Math.ceil(e.remainingMs/6e4)})}),(0,a.jsx)("button",{onClick:()=>p({removeBan:e.ip}),className:"text-text-muted hover:text-orange-400",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"delete"})})]})]},e.ip))})]})]})]})}function p(){let[e,t]=(0,l.useState)(null),[s,r]=(0,l.useState)(!0),i=(0,c.c)("settings");(0,l.useEffect)(()=>{let e=!1;return async function(){let s=sessionStorage.getItem("omniroute_login_time"),a=Date.now(),l=i("unknown");if(s){let e=a-parseInt(s,10),t=Math.floor(e/36e5),r=Math.floor(e%36e5/6e4);l=t>0?`${t}h ${r}m`:`${r}m`}let n=!1;try{let e=await fetch("/api/auth/status",{method:"GET",cache:"no-store"});if(e.ok){let t=await e.json();n=!0===t.authenticated}}catch{}e||(t({authenticated:n,loginTime:s?new Date(parseInt(s,10)).toLocaleString():null,sessionAge:l,ipAddress:"—",userAgent:navigator.userAgent.split(" ").slice(-2).join(" ")||i("unknown")}),r(!1))}(),()=>{e=!0}},[]);let n=async()=>{try{await fetch("/api/auth/logout",{method:"POST"}),sessionStorage.removeItem("omniroute_login_time"),window.location.href="/"}catch{window.location.href="/"}};return s?(0,a.jsx)(d.Zp,{children:(0,a.jsx)("div",{className:"animate-pulse h-32 bg-black/5 dark:bg-white/5 rounded-lg"})}):(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-blue-500/10 text-blue-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"person"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:i("session")})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",role:"list","aria-label":i("sessionDetailsAria"),children:[(0,a.jsxs)("div",{className:"flex justify-between items-center text-sm",role:"listitem",children:[(0,a.jsx)("span",{className:"text-text-muted",children:i("status")}),(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:`w-2 h-2 rounded-full ${e?.authenticated?"bg-green-500":"bg-yellow-500"}`,"aria-hidden":"true"}),e?.authenticated?i("authenticated"):i("guest")]})]}),e?.loginTime&&(0,a.jsxs)("div",{className:"flex justify-between items-center text-sm",role:"listitem",children:[(0,a.jsx)("span",{className:"text-text-muted",children:i("loginTime")}),(0,a.jsx)("span",{className:"font-mono text-xs",children:e.loginTime})]}),(0,a.jsxs)("div",{className:"flex justify-between items-center text-sm",role:"listitem",children:[(0,a.jsx)("span",{className:"text-text-muted",children:i("sessionAge")}),(0,a.jsx)("span",{className:"font-mono text-xs",children:e?.sessionAge})]}),(0,a.jsxs)("div",{className:"flex justify-between items-center text-sm",role:"listitem",children:[(0,a.jsx)("span",{className:"text-text-muted",children:i("browser")}),(0,a.jsx)("span",{className:"font-mono text-xs truncate max-w-[200px]",children:e?.userAgent})]})]}),(0,a.jsxs)("div",{className:"flex gap-3 mt-4 pt-4 border-t border-border/50",children:[(0,a.jsx)(d.$n,{variant:"secondary",onClick:()=>{confirm(i("clearLocalDataConfirm"))&&(localStorage.clear(),sessionStorage.clear(),window.location.reload())},children:i("clearLocalData")}),e?.authenticated&&(0,a.jsx)(d.$n,{variant:"danger",onClick:n,children:i("logout")})]})]})}function b(){let[e,t]=(0,l.useState)({requireLogin:!1,hasPassword:!1}),[s,r]=(0,l.useState)(!0),[i,n]=(0,l.useState)({current:"",new:"",confirm:""}),[o,m]=(0,l.useState)({type:"",message:""}),[h,b]=(0,l.useState)(!1),g=(0,c.c)("settings");(0,l.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{t(e),r(!1)}).catch(()=>r(!1))},[]);let f=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireLogin:e})})).ok&&t(t=>({...t,requireLogin:e}))}catch(e){console.error("Failed to update require login:",e)}},j=async(e,s)=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[e]:s})})).ok&&t(t=>({...t,[e]:s}))}catch(t){console.error(`Failed to update ${e}:`,t)}},v=async e=>{if(e.preventDefault(),i.new!==i.confirm)return void m({type:"error",message:g("passwordsNoMatch")});b(!0),m({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:i.current,newPassword:i.new})}),t=await e.json();e.ok?(m({type:"success",message:g("passwordUpdated")}),n({current:"",new:"",confirm:""})):m({type:"error",message:t.error||g("failedUpdatePassword")})}catch{m({type:"error",message:g("errorOccurred")})}finally{b(!1)}},y=e.blockedProviders||[];return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"shield"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:g("security")})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:g("requireLogin")}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:g("requireLoginDesc")})]}),(0,a.jsx)(d.lM,{checked:!0===e.requireLogin,onChange:()=>f(!e.requireLogin),disabled:s})]}),!0===e.requireLogin&&(0,a.jsxs)("form",{onSubmit:v,className:"flex flex-col gap-4 pt-4 border-t border-border/50",children:[e.hasPassword&&(0,a.jsx)(d.pd,{label:g("currentPassword"),type:"password",placeholder:g("enterCurrentPassword"),value:i.current,onChange:e=>n({...i,current:e.target.value}),required:!0}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsx)(d.pd,{label:g("newPassword"),type:"password",placeholder:g("enterNewPassword"),value:i.new,onChange:e=>n({...i,new:e.target.value}),required:!0}),(0,a.jsx)(d.pd,{label:g("confirmPassword"),type:"password",placeholder:g("confirmPasswordPlaceholder"),value:i.confirm,onChange:e=>n({...i,confirm:e.target.value}),required:!0})]}),o.message&&(0,a.jsx)("p",{className:`text-sm ${"error"===o.type?"text-red-500":"text-green-500"}`,children:o.message}),(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsx)(d.$n,{type:"submit",variant:"primary",loading:h,children:e.hasPassword?g("updatePassword"):g("setPassword")})})]})]})]}),(0,a.jsxs)(d.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-amber-500/10 text-amber-600 dark:text-amber-400",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"api"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:g("apiEndpointProtection")})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:g("requireAuthModels")}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:g("requireAuthModelsDesc")})]}),(0,a.jsx)(d.lM,{checked:!0===e.requireAuthForModels,onChange:()=>j("requireAuthForModels",!e.requireAuthForModels),disabled:s})]}),(0,a.jsxs)("div",{className:"pt-4 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsx)("p",{className:"font-medium",children:g("blockedProviders")}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:g("blockedProvidersDesc")})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.values(x.Q2).map(t=>{let l=y.includes(t.id);return(0,a.jsxs)("button",{onClick:()=>{var s;let a;return s=t.id,void j("blockedProviders",(a=e.blockedProviders||[]).includes(s)?a.filter(e=>e!==s):[...a,s])},disabled:s,className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs font-medium transition-all border ${l?"bg-red-500/10 border-red-500/30 text-red-600 dark:text-red-400":"bg-black/[0.02] dark:bg-white/[0.02] border-transparent text-text-muted hover:bg-black/[0.05] dark:hover:bg-white/[0.05]"}`,title:l?g("unblockProviderTitle",{provider:t.name}):g("blockProviderTitle",{provider:t.name}),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:{color:l?void 0:t.color},children:l?"block":t.icon}),t.name,l&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px] text-red-500",children:"close"})]},t.id)})}),y.length>0&&(0,a.jsxs)("p",{className:"text-xs text-amber-600 dark:text-amber-400 mt-2 flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"warning"}),g("providersBlocked",{count:y.length})]})]})]})]}),(0,a.jsx)(p,{}),(0,a.jsx)(u,{})]})}var g=s(67671);let f=["#6366f1","#22c55e","#f59e0b","#ef4444","#8b5cf6","#06b6d4","#ec4899","#14b8a6"];function j(){let[e,t]=(0,l.useState)({}),[s,r]=(0,l.useState)(!0),[i,n]=(0,l.useState)(!1),[o,m]=(0,l.useState)(""),[x,h]=(0,l.useState)(""),[u,p]=(0,l.useState)(!1),b=(0,g.i)(),j=(0,c.c)("settings"),v=(0,c.c)("common"),y=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/fallback/chains");if(e.ok){let s=await e.json();t(s.chains||s||{})}}catch{}finally{r(!1)}},[]);(0,l.useEffect)(()=>{y()},[y]);let N=async()=>{if(!o.trim()||!x.trim())return void b.warning(j("fillModelAndProviders"));let e=x.split(",").map(e=>e.trim()).filter(Boolean).map((e,t)=>({provider:e,priority:t+1,enabled:!0}));if(0===e.length)return void b.warning(j("addAtLeastOneProvider"));p(!0);try{(await fetch("/api/fallback/chains",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:o.trim(),chain:e})})).ok?(b.success(j("chainCreated",{model:o.trim()})),m(""),h(""),n(!1),await y()):b.error(j("failedCreateChain"))}catch{b.error(j("failedCreateChain"))}finally{p(!1)}},k=async e=>{if(confirm(j("deleteChainConfirm",{model:e})))try{(await fetch("/api/fallback/chains",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:e})})).ok?(b.success(j("chainDeleted",{model:e})),await y()):b.error(j("failedDeleteChain"))}catch{b.error(j("failedDeleteChain"))}};if(s)return(0,a.jsx)(d.Zp,{className:"p-6 mt-6",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted animate-pulse",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"timeline"}),j("loadingFallbackChains")]})});let w=Object.entries(e);return(0,a.jsxs)(d.Zp,{className:"mt-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4 p-6 pb-0",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]",children:"timeline"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:j("fallbackChainsTitle")}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:j("fallbackChainsDesc")})]}),(0,a.jsx)(d.$n,{size:"sm",variant:"primary",onClick:()=>n(!i),children:i?v("cancel"):j("addChain")})]}),i&&(0,a.jsxs)("div",{className:"mx-6 p-4 rounded-lg border border-border/30 bg-surface/20 mb-4",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 mb-3",children:[(0,a.jsx)(d.pd,{label:j("modelName"),placeholder:j("modelNamePlaceholder"),value:o,onChange:e=>m(e.target.value)}),(0,a.jsx)(d.pd,{label:j("providersCommaSeparated"),placeholder:j("providersCommaSeparatedPlaceholder"),value:x,onChange:e=>h(e.target.value)})]}),(0,a.jsx)(d.$n,{variant:"primary",size:"sm",onClick:N,loading:u,children:j("createChain")})]}),(0,a.jsx)("div",{className:"px-6 pb-6",children:0===w.length?(0,a.jsx)(d.pp,{icon:"timeline",title:j("noFallbackChains"),description:j("noFallbackChainsDesc")}):(0,a.jsx)("div",{className:"flex flex-col gap-2",children:w.map(([e,t])=>(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 rounded-lg border border-border/20 bg-surface/20 hover:bg-surface/40 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,a.jsx)("span",{className:"font-mono text-sm text-text-main truncate max-w-[200px]",children:e}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"arrow_forward"}),(0,a.jsx)("div",{className:"flex gap-1.5 flex-wrap",children:(Array.isArray(t)?t:[]).map((e,t)=>(0,a.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded-full font-medium",style:{backgroundColor:`${f[t%f.length]}20`,color:f[t%f.length],border:`1px solid ${f[t%f.length]}40`},children:[t+1,". ",e.provider]},`${e.provider}-${t}`))})]}),(0,a.jsx)("button",{onClick:()=>k(e),className:"text-text-muted hover:text-red-400 transition-colors ml-2",title:j("deleteChain"),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]},e))})})]})}let v=[{value:"fill-first",labelKey:"fillFirst",descKey:"fillFirstDesc",icon:"vertical_align_top"},{value:"round-robin",labelKey:"roundRobin",descKey:"roundRobinDesc",icon:"loop"},{value:"p2c",labelKey:"p2c",descKey:"p2cDesc",icon:"balance"},{value:"random",labelKey:"random",descKey:"randomDesc",icon:"shuffle"},{value:"least-used",labelKey:"leastUsed",descKey:"leastUsedDesc",icon:"low_priority"},{value:"cost-optimized",labelKey:"costOpt",descKey:"costOptDesc",icon:"savings"}];function y(){let[e,t]=(0,l.useState)({fallbackStrategy:"fill-first"}),[s,r]=(0,l.useState)(!0),[i,n]=(0,l.useState)([]),[o,m]=(0,l.useState)(""),[x,h]=(0,l.useState)(""),u=(0,c.c)("settings");(0,l.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{t(e),n(e.wildcardAliases||[]),r(!1)}).catch(()=>r(!1))},[]);let p=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&t(t=>({...t,...e}))}catch(e){console.error("Failed to update settings:",e)}},b=async()=>{if(!o.trim()||!x.trim())return;let e=[...i,{pattern:o.trim(),target:x.trim()}];await p({wildcardAliases:e}),n(e),m(""),h("")},g=async e=>{let t=i.filter((t,s)=>s!==e);await p({wildcardAliases:t}),n(t)};return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-blue-500/10 text-blue-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"route"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:u("routingStrategy")})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-2 mb-4",style:{gridAutoRows:"1fr"},children:v.map(t=>(0,a.jsxs)("button",{onClick:()=>p({fallbackStrategy:t.value}),disabled:s,className:`flex flex-col items-center gap-2 p-4 rounded-lg border text-center transition-all ${e.fallbackStrategy===t.value?"border-blue-500/50 bg-blue-500/5 ring-1 ring-blue-500/20":"border-border/50 hover:border-border hover:bg-surface/30"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[24px] ${e.fallbackStrategy===t.value?"text-blue-400":"text-text-muted"}`,children:t.icon}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:`text-sm font-medium ${e.fallbackStrategy===t.value?"text-blue-400":""}`,children:u(t.labelKey)}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:u(t.descKey)})]})]},t.value))}),"round-robin"===e.fallbackStrategy&&(0,a.jsxs)("div",{className:"flex items-center justify-between pt-3 border-t border-border/30",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:u("stickyLimit")}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:u("stickyLimitDesc")})]}),(0,a.jsx)(d.pd,{type:"number",min:"1",max:"10",value:e.stickyRoundRobinLimit||3,onChange:e=>p({stickyRoundRobinLimit:parseInt(e.target.value)}),disabled:s,className:"w-20 text-center"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted italic pt-3 border-t border-border/30 mt-3",children:u({"fill-first":"fillFirstDesc","round-robin":"roundRobinDesc",p2c:"p2cDesc",random:"randomDesc","least-used":"leastUsedDesc","cost-optimized":"costOptDesc"}[e.fallbackStrategy]||"fillFirstDesc")})]}),(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/10 text-purple-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"alt_route"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:u("modelAliases")}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:u("modelAliasesDesc")})]})]}),i.length>0&&(0,a.jsx)("div",{className:"flex flex-col gap-1.5 mb-4",children:i.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2 rounded-lg bg-surface/30 border border-border/20",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2 text-sm",children:[(0,a.jsx)("span",{className:"font-mono text-purple-400 break-all",children:e.pattern}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"arrow_forward"}),(0,a.jsx)("span",{className:"font-mono text-text-main break-all",children:e.target})]}),(0,a.jsx)("button",{onClick:()=>g(t),className:"shrink-0 text-text-muted hover:text-red-400 transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]},t))}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2 items-stretch sm:items-end",children:[(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)(d.pd,{label:u("pattern"),placeholder:u("aliasPatternPlaceholder"),value:o,onChange:e=>m(e.target.value)})}),(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)(d.pd,{label:u("targetModel"),placeholder:u("aliasTargetPlaceholder"),value:x,onChange:e=>h(e.target.value)})}),(0,a.jsx)(d.$n,{size:"sm",variant:"primary",onClick:b,className:"mb-[2px] sm:w-auto w-full",children:u("add")})]})]}),(0,a.jsx)(j,{})]})}function N(){let[e,t]=(0,l.useState)({strategy:"priority",maxRetries:1,retryDelayMs:2e3,timeoutMs:12e4,healthCheckEnabled:!0,healthCheckTimeoutMs:3e3,maxComboDepth:3,trackMetrics:!0}),[s,r]=(0,l.useState)({}),[n,o]=(0,l.useState)(""),[m,x]=(0,l.useState)(!1),h=(0,c.c)("settings"),u=(0,c.c)("common"),p=[{value:"priority",label:h("priority"),icon:"sort"},{value:"weighted",label:h("weighted"),icon:"percent"},{value:"round-robin",label:h("roundRobin"),icon:"autorenew"},{value:"random",label:h("random"),icon:"shuffle"},{value:"least-used",label:h("leastUsed"),icon:"low_priority"},{value:"cost-optimized",label:h("costOpt"),icon:"savings"}],b=[{key:"maxRetries",label:h("maxRetriesLabel"),min:0,max:5},{key:"retryDelayMs",label:h("retryDelayLabel"),min:500,max:1e4,step:500},{key:"timeoutMs",label:h("timeoutLabel"),min:5e3,max:3e5,step:5e3},{key:"maxComboDepth",label:h("maxNestingDepth"),min:1,max:10}];(0,l.useEffect)(()=>{fetch("/api/settings/combo-defaults").then(e=>e.json()).then(e=>{e.comboDefaults&&t(e.comboDefaults),e.providerOverrides&&r(e.providerOverrides)}).catch(e=>console.error("Failed to fetch combo defaults:",e))},[]);let g=async()=>{x(!0);try{await fetch("/api/settings/combo-defaults",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboDefaults:e,providerOverrides:s})})}catch(e){console.error("Failed to save combo defaults:",e)}finally{x(!1)}},f=()=>{let e=n.trim().toLowerCase();e&&!s[e]&&(r(t=>({...t,[e]:{maxRetries:1,timeoutMs:12e4}})),o(""))};return(0,a.jsxs)(d.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-amber-500/10 text-amber-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"tune"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:h("comboDefaultsTitle")}),(0,a.jsx)("span",{className:"text-xs text-text-muted ml-auto",children:h("globalComboConfig")})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-sm",children:h("defaultStrategy")}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:h("defaultStrategyDesc")})]}),(0,a.jsx)("div",{role:"tablist","aria-label":h("comboStrategyAria"),className:"grid grid-cols-3 gap-1 p-0.5 rounded-md bg-black/5 dark:bg-white/5",children:p.map(s=>(0,a.jsxs)("button",{role:"tab","aria-selected":e.strategy===s.value,onClick:()=>t(e=>({...e,strategy:s.value})),className:(0,i.cn)("px-2 py-1 rounded text-xs font-medium transition-all flex items-center justify-center gap-0.5",e.strategy===s.value?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:s.icon}),s.label]},s.value))})]}),(0,a.jsx)("div",{className:"grid grid-cols-2 gap-3 pt-3 border-t border-border/50",children:b.map(({key:s,label:l,min:r,max:i,step:n})=>(0,a.jsx)(d.pd,{label:l,type:"number",min:r,max:i,step:n||1,value:e[s]??"",onChange:e=>t(t=>({...t,[s]:parseInt(e.target.value)||0})),className:"text-sm"},s))}),"round-robin"===e.strategy&&(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 pt-3 border-t border-border/50",children:[(0,a.jsx)(d.pd,{label:h("concurrencyPerModel"),type:"number",min:1,max:20,value:e.concurrencyPerModel??"",placeholder:"3",onChange:e=>t(t=>({...t,concurrencyPerModel:parseInt(e.target.value)||0})),className:"text-sm"}),(0,a.jsx)(d.pd,{label:h("queueTimeout"),type:"number",min:1e3,max:12e4,step:1e3,value:e.queueTimeoutMs??"",placeholder:"30000",onChange:e=>t(t=>({...t,queueTimeoutMs:parseInt(e.target.value)||0})),className:"text-sm"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 pt-3 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-sm",children:h("healthCheck")}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:h("healthCheckDesc")})]}),(0,a.jsx)(d.lM,{checked:!1!==e.healthCheckEnabled,onChange:()=>t(e=>({...e,healthCheckEnabled:!e.healthCheckEnabled}))})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-sm",children:h("trackMetrics")}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:h("trackMetricsDesc")})]}),(0,a.jsx)(d.lM,{checked:!1!==e.trackMetrics,onChange:()=>t(e=>({...e,trackMetrics:!e.trackMetrics}))})]})]}),(0,a.jsxs)("div",{className:"pt-3 border-t border-border/50",children:[(0,a.jsx)("p",{className:"font-medium text-sm mb-2",children:h("providerOverrides")}),(0,a.jsx)("p",{className:"text-xs text-text-muted mb-3",children:h("providerOverridesDesc")}),Object.entries(s).map(([e,t])=>(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2 p-2 rounded-lg bg-black/[0.02] dark:bg-white/[0.02]",children:[(0,a.jsx)("span",{className:"text-xs font-mono font-medium min-w-[80px]",children:e}),(0,a.jsx)(d.pd,{type:"number",min:"0",max:"5",value:t.maxRetries??1,onChange:t=>r(s=>({...s,[e]:{...s[e],maxRetries:parseInt(t.target.value)||0}})),className:"text-xs w-16","aria-label":h("providerMaxRetriesAria",{provider:e})}),(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:h("retries")}),(0,a.jsx)(d.pd,{type:"number",min:"5000",max:"300000",step:"5000",value:t.timeoutMs??12e4,onChange:t=>r(s=>({...s,[e]:{...s[e],timeoutMs:parseInt(t.target.value)||12e4}})),className:"text-xs w-24","aria-label":h("providerTimeoutAria",{provider:e})}),(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:h("ms")}),(0,a.jsx)("button",{onClick:()=>{r(t=>{let s={...t};return delete s[e],s})},className:"ml-auto text-red-400 hover:text-red-500 transition-colors","aria-label":h("removeProviderOverrideAria",{provider:e}),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"close"})})]},e)),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,a.jsx)(d.pd,{type:"text",placeholder:h("newProviderNamePlaceholder"),value:n,onChange:e=>o(e.target.value),onKeyDown:e=>"Enter"===e.key&&f(),className:"text-xs flex-1","aria-label":h("newProviderNameAria")}),(0,a.jsx)(d.$n,{variant:"outline",size:"sm",onClick:f,disabled:!n.trim(),children:u("add")})]})]}),(0,a.jsx)("div",{className:"pt-3 border-t border-border/50",children:(0,a.jsx)(d.$n,{variant:"primary",size:"sm",onClick:g,loading:m,children:h("saveComboDefaults")})})]})]})}function k(){let[e,t]=(0,l.useState)(!1),[s,r]=(0,l.useState)(null),i=(0,l.useRef)(!0),n=(0,c.c)("settings"),o=(0,c.c)("common"),m=async()=>{try{let e=await fetch("/api/settings/proxy?level=global");if(e.ok){let t=await e.json();r(t.proxy||null)}}catch{}};return(0,l.useEffect)(()=>(i.current=!0,async function(){try{let e=await fetch("/api/settings/proxy?level=global");if(!i.current)return;if(e.ok){let t=await e.json();i.current&&r(t.proxy||null)}}catch{}}(),()=>{i.current=!1}),[]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.Zp,{className:"p-0 overflow-hidden",children:(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"vpn_lock"}),(0,a.jsx)("h2",{className:"text-lg font-bold",children:n("globalProxy")})]}),(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:n("globalProxyDesc")}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[s?(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsxs)("span",{className:"px-2.5 py-1 rounded text-xs font-bold uppercase bg-emerald-500/15 text-emerald-400 border border-emerald-500/30",children:[s.type,"://",s.host,":",s.port]})}):(0,a.jsx)("span",{className:"text-sm text-text-muted",children:n("noGlobalProxy")}),(0,a.jsx)(d.$n,{size:"sm",variant:s?"secondary":"primary",icon:"settings",onClick:()=>{m(),t(!0)},children:s?o("edit"):n("configure")})]})]})}),(0,a.jsx)(d.KN,{isOpen:e,onClose:()=>t(!1),level:"global",levelLabel:n("globalLabel"),onSaved:m})]})}var w=s(97550);function C(){let{theme:e,setTheme:t,isDark:s}=(0,w.D)(),r=(0,c.c)("settings"),[n,o]=(0,l.useState)({}),[m,x]=(0,l.useState)(!0),h={light:r("themeLight"),dark:r("themeDark"),system:r("themeSystem")};(0,l.useEffect)(()=>{fetch("/api/settings").then(e=>{if(!e.ok)throw Error(`HTTP error ${e.status}`);return e.json()}).then(e=>{o(e),x(!1)}).catch(()=>x(!1))},[]);let u=async(e,t)=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[e]:t})})).ok&&o(s=>({...s,[e]:t}))}catch(t){console.error(`Failed to update ${e}:`,t)}};return(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/10 text-purple-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"palette"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:r("appearance")})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:r("darkMode")}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:r("switchThemes")})]}),(0,a.jsx)(d.lM,{checked:s,onChange:()=>t(s?"light":"dark")})]}),(0,a.jsx)("div",{className:"pt-4 border-t border-border",children:(0,a.jsx)("div",{role:"tablist","aria-label":r("themeSelectionAria"),className:"inline-flex p-1 rounded-lg bg-black/5 dark:bg-white/5",children:["light","dark","system"].map(s=>(0,a.jsxs)("button",{role:"tab","aria-selected":e===s,onClick:()=>t(s),className:(0,i.cn)("flex items-center gap-2 px-4 py-2 rounded-md font-medium transition-all",e===s?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"light"===s?"light_mode":"dark"===s?"dark_mode":"contrast"}),(0,a.jsx)("span",{children:h[s]||s})]},s))})}),(0,a.jsx)("div",{className:"pt-4 border-t border-border",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:r("hideHealthLogs")}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:r("hideHealthLogsDesc")})]}),(0,a.jsx)(d.lM,{checked:!0===n.hideHealthCheckLogs,onChange:()=>u("hideHealthCheckLogs",!n.hideHealthCheckLogs),disabled:m})]})})]})]})}let S=[{value:"passthrough",labelKey:"passthrough",descKey:"passthroughDesc",icon:"arrow_forward"},{value:"auto",labelKey:"auto",descKey:"autoDesc",icon:"auto_awesome"},{value:"custom",labelKey:"custom",descKey:"customDesc",icon:"tune"},{value:"adaptive",labelKey:"adaptive",descKey:"adaptiveDesc",icon:"trending_up"}],D=[{value:"none",labelKey:"effortNone"},{value:"low",labelKey:"effortLow"},{value:"medium",labelKey:"effortMedium"},{value:"high",labelKey:"effortHigh"}];function P(){let[e,t]=(0,l.useState)({mode:"passthrough",customBudget:10240,effortLevel:"medium"}),[s,r]=(0,l.useState)(!0),[i,n]=(0,l.useState)(!1),[o,m]=(0,l.useState)(""),x=(0,c.c)("settings");(0,l.useEffect)(()=>{fetch("/api/settings/thinking-budget").then(e=>e.json()).then(e=>{t(e),r(!1)}).catch(()=>r(!1))},[]);let h=async s=>{let a={...e,...s};t(a),n(!0),m("");try{(await fetch("/api/settings/thinking-budget",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).ok?(m("saved"),setTimeout(()=>m(""),2e3)):m("error")}catch{m("error")}finally{n(!1)}};return(0,a.jsxs)(d.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-violet-500/10 text-violet-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"psychology"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:x("thinkingBudgetTitle")}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:x("thinkingBudgetDesc")})]}),"saved"===o&&(0,a.jsxs)("span",{className:"ml-auto text-xs font-medium text-emerald-500 flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"})," ",x("saved")]})]}),(0,a.jsx)("div",{className:"grid grid-cols-2 gap-2 mb-5",children:S.map(t=>(0,a.jsxs)("button",{onClick:()=>h({mode:t.value}),disabled:s||i,className:`flex items-start gap-3 p-3 rounded-lg border text-left transition-all ${e.mode===t.value?"border-violet-500/50 bg-violet-500/5 ring-1 ring-violet-500/20":"border-border/50 hover:border-border hover:bg-surface/30"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[20px] mt-0.5 ${e.mode===t.value?"text-violet-500":"text-text-muted"}`,children:t.icon}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:`text-sm font-medium ${e.mode===t.value?"text-violet-400":""}`,children:x(t.labelKey)}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-0.5 leading-relaxed",children:x(t.descKey)})]})]},t.value))}),"custom"===e.mode&&(0,a.jsxs)("div",{className:"p-4 rounded-lg bg-surface/30 border border-border/30 mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:x("tokenBudget")}),(0,a.jsxs)("span",{className:"text-sm font-mono tabular-nums text-violet-400",children:[e.customBudget.toLocaleString()," ",x("tokens")]})]}),(0,a.jsx)("input",{type:"range",min:"0",max:"131072",step:"1024",value:e.customBudget,onChange:e=>h({customBudget:parseInt(e.target.value)}),className:"w-full accent-violet-500"}),(0,a.jsxs)("div",{className:"flex justify-between text-xs text-text-muted mt-1",children:[(0,a.jsx)("span",{children:x("off")}),(0,a.jsx)("span",{children:"1K"}),(0,a.jsx)("span",{children:"10K"}),(0,a.jsx)("span",{children:"64K"}),(0,a.jsx)("span",{children:"128K"})]})]}),"adaptive"===e.mode&&(0,a.jsxs)("div",{className:"p-4 rounded-lg bg-surface/30 border border-border/30",children:[(0,a.jsx)("p",{className:"text-sm font-medium mb-3",children:x("baseEffortLevel")}),(0,a.jsx)("p",{className:"text-xs text-text-muted mb-3",children:x("adaptiveHint")}),(0,a.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:D.map(t=>(0,a.jsx)("button",{onClick:()=>h({effortLevel:t.value}),disabled:s||i,className:`px-3 py-2 rounded-lg text-xs font-medium border transition-all ${e.effortLevel===t.value?"border-violet-500/50 bg-violet-500/10 text-violet-400":"border-border/50 text-text-muted hover:border-border"}`,children:x(t.labelKey)},t.value))})]})]})}function $(){let[e,t]=(0,l.useState)({enabled:!1,prompt:""}),[s,r]=(0,l.useState)(!0),[i,n]=(0,l.useState)(""),[o,m]=(0,l.useState)(null),x=(0,c.c)("settings");(0,l.useEffect)(()=>{fetch("/api/settings/system-prompt").then(e=>e.json()).then(e=>{t(e),r(!1)}).catch(()=>r(!1))},[]);let h=async s=>{let a={...e,...s};t(a),n("");try{(await fetch("/api/settings/system-prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).ok&&(n("saved"),setTimeout(()=>n(""),2e3))}catch{n("error")}};return(0,a.jsxs)(d.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-amber-500/10 text-amber-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"edit_note"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:x("globalSystemPrompt")}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:x("systemPromptDesc")})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:["saved"===i&&(0,a.jsxs)("span",{className:"text-xs font-medium text-emerald-500 flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"})," ",x("saved")]}),(0,a.jsx)(d.lM,{checked:e.enabled,onChange:()=>h({enabled:!e.enabled}),disabled:s})]})]}),e.enabled&&(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("textarea",{value:e.prompt,onChange:e=>{var s;return s=e.target.value,void(t(e=>({...e,prompt:s})),o&&clearTimeout(o),m(setTimeout(()=>{h({prompt:s})},800)))},placeholder:x("systemPromptPlaceholder"),rows:5,className:"w-full px-4 py-3 rounded-lg border border-border/50 bg-surface/30 text-sm placeholder:text-text-muted/50 resize-y min-h-[120px] focus:outline-none focus:ring-1 focus:ring-amber-500/30 focus:border-amber-500/50 transition-colors",disabled:s}),(0,a.jsx)("div",{className:"absolute bottom-2 right-3 text-xs text-text-muted/60 tabular-nums",children:x("chars",{count:e.prompt.length})})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted/70 flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"info"}),x("systemPromptHint")]})]})]})}function L(){let[e,t]=(0,l.useState)(null),[s,r]=(0,l.useState)(!1),i=(0,c.c)("settings"),n=()=>{fetch("/api/cache/stats").then(e=>e.json()).then(t).catch(()=>{})};(0,l.useEffect)(n,[]);let o=async()=>{r(!0);try{await fetch("/api/cache/stats",{method:"DELETE"}),n()}finally{r(!1)}};return(0,a.jsxs)(d.Zp,{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h3",{className:"text-lg font-semibold text-text-main flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"cached"}),i("promptCache")]}),(0,a.jsx)("button",{onClick:o,disabled:s,className:"px-3 py-1.5 text-xs rounded-lg bg-red-500/10 text-red-400 hover:bg-red-500/20 transition-colors disabled:opacity-50",children:i(s?"flushing":"flushCache")})]}),e?(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-text-muted",children:i("size")}),(0,a.jsxs)("p",{className:"font-mono text-lg text-text-main",children:[e.size,"/",e.maxSize]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-text-muted",children:i("hitRate")}),(0,a.jsxs)("p",{className:"font-mono text-lg text-text-main",children:[e.hitRate?.toFixed(1)??0,"%"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-text-muted",children:i("hits")}),(0,a.jsx)("p",{className:"font-mono text-text-main",children:e.hits??0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-text-muted",children:i("evictions")}),(0,a.jsx)("p",{className:"font-mono text-text-main",children:e.evictions??0})]})]}):(0,a.jsx)("p",{className:"text-sm text-text-muted",children:i("loadingCacheStats")})]})}let T={CLOSED:{bg:"bg-emerald-500/15",text:"text-emerald-400",border:"border-emerald-500/30",icon:"check_circle"},OPEN:{bg:"bg-red-500/15",text:"text-red-400",border:"border-red-500/30",icon:"error"},HALF_OPEN:{bg:"bg-amber-500/15",text:"text-amber-400",border:"border-amber-500/30",icon:"warning"}},A={closed:{icon:"check_circle",color:"#22c55e"},"half-open":{icon:"pending",color:"#f59e0b"},open:{icon:"error",color:"#ef4444"}};function E(e,t){let s=String(e||"closed").toLowerCase().replaceAll("_","-");return t("open"===s?"breakerStateOpen":"half-open"===s?"breakerStateHalfOpen":"breakerStateClosed")}function K(e){return!e||e<=0?"—":e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${(e/6e4).toFixed(1)}m`}function M(e,t){return e instanceof Error&&e.message?e.message:t}function O({profiles:e,onSave:t,saving:s}){let[r,i]=(0,l.useState)(!1),[n,o]=(0,l.useState)(e),m=(0,c.c)("settings"),x=(0,c.c)("common");(0,l.useEffect)(()=>{o(e)},[e]);let h=e=>null==e?"—":`${e}${m("ms")}`,u=[{key:"transientCooldown",label:m("transientCooldown"),format:h},{key:"rateLimitCooldown",label:m("rateLimitCooldown"),format:h},{key:"maxBackoffLevel",label:m("maxBackoffLevel")},{key:"circuitBreakerThreshold",label:m("cbThreshold"),format:e=>null==e?"—":m("failures",{count:e})},{key:"circuitBreakerReset",label:m("cbResetTime"),format:h}];return(0,a.jsx)(d.Zp,{className:"p-0 overflow-hidden",children:(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"tune"}),(0,a.jsx)("h2",{className:"text-lg font-bold",children:m("providerProfiles")})]}),r?(0,a.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",onClick:()=>i(!1),children:x("cancel")}),(0,a.jsx)(d.$n,{size:"sm",variant:"primary",icon:"save",onClick:()=>{t(n),i(!1)},disabled:s,children:x("save")})]}):(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>i(!0),children:x("edit")})]}),(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:m("providerProfilesDesc")}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:["oauth","apikey"].map(t=>(0,a.jsxs)("div",{className:"rounded-lg bg-black/5 dark:bg-white/5 p-4",children:[(0,a.jsxs)("h3",{className:"text-sm font-bold uppercase tracking-wider mb-3 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base","aria-hidden":"true",children:"oauth"===t?"lock":"key"}),"oauth"===t?m("oauthProviders"):m("apiKeyProviders")]}),(0,a.jsx)("div",{className:"space-y-2",children:u.map(({key:s,label:l,format:i})=>(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:l}),r?(0,a.jsx)("input",{type:"number",min:"0",value:n?.[t]?.[s]??0,onChange:e=>o({...n,[t]:{...n[t],[s]:Number(e.target.value)}}),className:"w-24 px-2 py-1 text-xs rounded bg-white/10 border border-white/20 text-right"}):(0,a.jsx)("span",{className:"text-sm font-mono",children:i?i(e?.[t]?.[s]):e?.[t]?.[s]??"—"})]},s))})]},t))})]})})}function _({rateLimitStatus:e,defaults:t,onSaveDefaults:s,saving:r}){let[i,n]=(0,l.useState)(!1),[o,m]=(0,l.useState)(t||{}),x=(0,c.c)("settings"),h=(0,c.c)("common");return(0,l.useEffect)(()=>{t&&m(t)},[t]),(0,a.jsx)(d.Zp,{className:"p-0 overflow-hidden",children:(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"speed"}),(0,a.jsx)("h2",{className:"text-lg font-bold",children:x("rateLimiting")})]}),i?(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",onClick:()=>n(!1),children:h("cancel")}),(0,a.jsx)(d.$n,{size:"sm",variant:"primary",icon:"save",onClick:()=>{s(o),n(!1)},disabled:r,children:h("save")})]}):(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>n(!0),children:h("edit")})]}),(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:x("rateLimitingDesc")}),(0,a.jsxs)("div",{className:"rounded-lg bg-black/5 dark:bg-white/5 p-4 mb-4",children:[(0,a.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider mb-3 text-text-muted",children:x("defaultSafetyNet")}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[{key:"requestsPerMinute",label:x("rpm")},{key:"minTimeBetweenRequests",label:x("minGap"),format:K},{key:"concurrentRequests",label:x("maxConcurrent")}].map(({key:e,label:s,format:l})=>(0,a.jsxs)("div",{children:[i?(0,a.jsx)("input",{type:"number",min:"1",value:o[e]??0,onChange:t=>m(s=>({...s,[e]:parseInt(t.target.value)||0})),className:"w-full px-2 py-1 text-lg font-bold rounded bg-white/10 border border-white/20"}):(0,a.jsx)("div",{className:"text-lg font-bold",children:l?l(t?.[e]):t?.[e]??"—"}),(0,a.jsx)("div",{className:"text-xs text-text-muted",children:s})]},e))})]}),e&&e.length>0?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider text-text-muted",children:x("activeLimiters")}),e.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center justify-between py-2 px-3 rounded-lg bg-black/5 dark:bg-white/5",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:e.provider||e.key}),(0,a.jsxs)("div",{className:"flex items-center gap-3 text-xs text-text-muted",children:[null!=e.reservoir&&(0,a.jsxs)("span",{children:[x("reservoir"),": ",e.reservoir]}),null!=e.running&&(0,a.jsxs)("span",{children:[x("running"),": ",e.running]}),null!=e.queued&&(0,a.jsxs)("span",{children:[x("queued"),": ",e.queued]})]})]},t))]}):(0,a.jsx)("p",{className:"text-xs text-text-muted",children:x("noActiveLimiters")})]})})}function B({breakers:e,onReset:t,loading:s}){let l=e.filter(e=>"CLOSED"!==e.state),r=e.length,i=(0,c.c)("settings");return(0,a.jsx)(d.Zp,{className:"p-0 overflow-hidden",children:(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"electrical_services"}),(0,a.jsx)("h2",{className:"text-lg font-bold",children:i("circuitBreakers")})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:l.length>0?i("tripped",{count:l.length}):i("healthy",{count:r})}),l.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"danger",icon:"restart_alt",onClick:t,disabled:s,children:i("resetAll")})]})]}),0===e.length?(0,a.jsx)("p",{className:"text-sm text-text-muted",children:i("noCircuitBreakers")}):(0,a.jsx)("div",{className:"space-y-2",children:e.map(e=>{let t=T[e.state]||T.CLOSED;return(0,a.jsxs)("div",{className:"flex items-center justify-between py-2 px-3 rounded-lg bg-black/5 dark:bg-white/5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-base ${t.text}`,"aria-hidden":"true",children:t.icon}),(0,a.jsx)("span",{className:"text-sm font-medium",children:e.name.replace("combo:","")})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[e.failureCount>0&&(0,a.jsx)("span",{className:"text-xs text-text-muted",children:i("failures",{count:e.failureCount})}),(0,a.jsx)("span",{className:`px-2 py-0.5 rounded text-xs font-bold uppercase ${t.bg} ${t.text} border ${t.border}`,children:E(e.state,i)})]})]},e.name)})})]})})}function F(){let[e,t]=(0,l.useState)(null),[s,r]=(0,l.useState)(!0),[i,n]=(0,l.useState)(null),m=(0,g.i)(),x=(0,o.Ym)(),h=(0,c.c)("settings"),u=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/policies");if(e.ok){let s=await e.json();t(s)}}catch{}finally{r(!1)}},[]);(0,l.useEffect)(()=>{u();let e=setInterval(u,15e3);return()=>clearInterval(e)},[u]);let p=async e=>{n(e);try{(await fetch("/api/policies",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"unlock",identifier:e})})).ok?(m.success(h("unlockedIdentifier",{identifier:e})),await u()):m.error(h("failedUnlock"))}catch{m.error(h("failedUnlock"))}finally{n(null)}},b=e?.circuitBreakers||[],f=e?.lockedIdentifiers||[],j=b.some(e=>"closed"!==e.state)||f.length>0;return s?(0,a.jsx)(d.Zp,{className:"p-6",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted animate-pulse",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"policy"}),h("loadingPolicies")]})}):(0,a.jsx)(d.Zp,{className:"p-0 overflow-hidden",children:(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-xl text-primary","aria-hidden":"true",children:"policy"}),(0,a.jsx)("h2",{className:"text-lg font-bold",children:h("policiesLocked")})]}),j&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",onClick:u,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"refresh"})})]}),j?(0,a.jsxs)(a.Fragment,{children:[b.filter(e=>"closed"!==e.state).length>0&&(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-text-muted mb-2",children:h("circuitBreakers")}),(0,a.jsx)("div",{className:"flex flex-col gap-1.5",children:b.filter(e=>"closed"!==e.state).map((e,t)=>{let s=A[e.state]||A.open;return(0,a.jsx)("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-surface/30 border border-border/20",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",style:{color:s.color},children:s.icon}),(0,a.jsx)("span",{className:"text-sm text-text-main font-medium",children:e.name||e.provider||h("unknown")}),(0,a.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${s.color}15`,color:s.color},children:E(e.state,h)}),e.failures>0&&(0,a.jsx)("span",{className:"text-xs text-text-muted",children:h("failures",{count:e.failures})})]})},e.name||t)})})]}),f.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium text-text-muted mb-2",children:h("lockedIdentifiers")}),(0,a.jsx)("div",{className:"flex flex-col gap-1.5",children:f.map((e,t)=>{let s="string"==typeof e?e:e.identifier||e.id;return(0,a.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-surface/30 border border-border/20",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-red-400",children:"lock"}),(0,a.jsx)("span",{className:"font-mono text-sm text-text-main",children:s}),"object"==typeof e&&e.lockedAt&&(0,a.jsx)("span",{className:"text-xs text-text-muted",children:h("sinceDate",{date:new Date(e.lockedAt).toLocaleString(x)})})]}),(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",onClick:()=>p(s),disabled:i===s,className:"text-xs",children:i===s?h("unlocking"):h("forceUnlock")})]},s||t)})})]})]}):(0,a.jsxs)("div",{className:"flex items-center gap-3",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:"verified_user"})}),(0,a.jsx)("div",{children:(0,a.jsx)("p",{className:"text-sm text-text-muted",children:h("allOperational")})})]})]})})}function z(){let[e,t]=(0,l.useState)(null),[s,r]=(0,l.useState)(!0),[i,n]=(0,l.useState)(!1),[o,m]=(0,l.useState)(null),x=(0,c.c)("settings"),h=(0,l.useCallback)(async()=>{try{r(!0);let e=await fetch("/api/resilience");if(!e.ok)throw Error(x("failedLoadWithStatus",{status:e.status}));let s=await e.json();t(s),m(null)}catch(e){m(M(e,x("failedLoadResilience")))}finally{r(!1)}},[x]);(0,l.useEffect)(()=>{h();let e=setInterval(h,1e4);return()=>clearInterval(e)},[h]);let u=async()=>{try{if(r(!0),!(await fetch("/api/resilience/reset",{method:"POST"})).ok)throw Error(x("resetFailed"));await h()}catch(e){m(M(e,x("resetFailed")))}finally{r(!1)}},p=async e=>{try{if(n(!0),!(await fetch("/api/resilience",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({profiles:e})})).ok)throw Error(x("saveFailed"));await h()}catch(e){m(M(e,x("saveFailed")))}finally{n(!1)}},b=async e=>{try{if(n(!0),!(await fetch("/api/resilience",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaults:e})})).ok)throw Error(x("saveFailed"));await h()}catch(e){m(M(e,x("saveFailed")))}finally{n(!1)}};return s&&!e?(0,a.jsxs)("div",{className:"flex items-center justify-center py-12 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin mr-2",children:"hourglass_empty"}),x("loadingResilience")]}):o&&!e?(0,a.jsxs)(d.Zp,{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-red-400",children:[(0,a.jsx)("span",{className:"material-symbols-outlined",children:"error"}),(0,a.jsx)("span",{className:"text-sm",children:o})]}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"refresh",onClick:h,className:"mt-3",children:x("retry")})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(O,{profiles:e?.profiles||{},onSave:p,saving:i}),(0,a.jsx)(_,{rateLimitStatus:e?.rateLimitStatus||[],defaults:e?.defaults||{},onSaveDefaults:b,saving:i}),(0,a.jsx)(B,{breakers:e?.circuitBreakers||[],onReset:u,loading:s}),(0,a.jsx)(F,{})]})}let R=[{id:"general",labelKey:"general",icon:"settings"},{id:"ai",labelKey:"ai",icon:"smart_toy"},{id:"security",labelKey:"security",icon:"shield"},{id:"routing",labelKey:"routing",icon:"route"},{id:"resilience",labelKey:"resilience",icon:"electrical_services"},{id:"advanced",labelKey:"advanced",icon:"tune"}];function q(){let e=(0,c.c)("settings"),t=(0,r.useSearchParams)().get("tab"),[s,d]=(0,l.useState)(null),o=s||R.find(e=>e.id===t)?.id||"general";return(0,a.jsx)("div",{className:"max-w-2xl mx-auto min-w-0",children:(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)("div",{className:"w-full overflow-x-auto pb-1",children:(0,a.jsx)("div",{role:"tablist","aria-label":e("settingsSectionsAria"),className:"inline-flex items-center p-1 rounded-lg bg-black/5 dark:bg-white/5 min-w-max",children:R.map(t=>(0,a.jsxs)("button",{role:"tab","aria-selected":o===t.id,tabIndex:o===t.id?0:-1,onClick:()=>d(t.id),className:(0,i.cn)("flex items-center gap-2 px-4 py-2 rounded-md font-medium transition-all text-sm",o===t.id?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]","aria-hidden":"true",children:t.icon}),(0,a.jsx)("span",{className:"hidden sm:inline whitespace-nowrap",children:e(t.labelKey)})]},t.id))})}),(0,a.jsxs)("div",{role:"tabpanel","aria-label":e(R.find(e=>e.id===o)?.labelKey||"general"),children:["general"===o&&(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(m,{}),(0,a.jsx)(C,{})]})}),"ai"===o&&(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(P,{}),(0,a.jsx)($,{}),(0,a.jsx)(L,{})]}),"security"===o&&(0,a.jsx)(b,{}),"routing"===o&&(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(y,{}),(0,a.jsx)(N,{})]}),"resilience"===o&&(0,a.jsx)(z,{}),"advanced"===o&&(0,a.jsx)(k,{})]}),(0,a.jsxs)("div",{className:"text-center text-sm text-text-muted py-4",children:[(0,a.jsxs)("p",{children:[n.vQ.name," v",n.vQ.version]}),(0,a.jsx)("p",{className:"mt-1",children:e("localMode")})]})]})})}},99344:(e,t,s)=>{Promise.resolve().then(s.bind(s,49162))}},e=>{e.O(0,[3418,8500,9751,8055,1149,5846,993,8441,3794,7358],()=>e(e.s=99344)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[410],{43265:(e,t,c)=>{Promise.resolve().then(c.bind(c,95204))},50910:(e,t,c)=>{"use strict";c.d(t,{c:()=>i});var a=c(33418);function n(e,t){return(...e)=>{try{return t(...e)}catch{throw Error(void 0)}}}let i=n(0,a.c3);n(0,a.kc)},67040:(e,t,c)=>{"use strict";function a(...e){return e.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}c.d(t,{cn:()=>a})},73321:(e,t,c)=>{"use strict";var a=c(74645);c.o(a,"useParams")&&c.d(t,{useParams:function(){return a.useParams}}),c.o(a,"usePathname")&&c.d(t,{usePathname:function(){return a.usePathname}}),c.o(a,"useRouter")&&c.d(t,{useRouter:function(){return a.useRouter}}),c.o(a,"useSearchParams")&&c.d(t,{useSearchParams:function(){return a.useSearchParams}})},81060:(e,t,c)=>{"use strict";c.d(t,{default:()=>i});var a=c(95155),n=c(67040);function i({children:e,title:t,subtitle:c,icon:i,action:r,padding:s="md",hover:o=!1,className:u,...d}){return(0,a.jsxs)("div",{className:(0,n.cn)("bg-surface","border border-black/5 dark:border-white/5","rounded-lg shadow-sm",o&&"hover:shadow-md hover:border-primary/30 transition-all cursor-pointer",{none:"",xs:"p-3",sm:"p-4",md:"p-6",lg:"p-8"}[s],u),...d,children:[(t||r)&&(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[i&&(0,a.jsx)("div",{className:"p-2 rounded-lg bg-bg text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:i})}),(0,a.jsxs)("div",{children:[t&&(0,a.jsx)("h3",{className:"text-text-main font-semibold",children:t}),c&&(0,a.jsx)("p",{className:"text-sm text-text-muted",children:c})]})]}),r]}),e]})}i.Section=function({children:e,className:t,...c}){return(0,a.jsx)("div",{className:(0,n.cn)("p-4 rounded-lg","bg-black/[0.02] dark:bg-white/[0.02]","border border-black/5 dark:border-white/5",t),...c,children:e})},i.Row=function({children:e,className:t,...c}){return(0,a.jsx)("div",{className:(0,n.cn)("p-3 -mx-3 px-3 transition-colors","border-b border-black/5 dark:border-white/5 last:border-b-0","hover:bg-black/[0.02] dark:hover:bg-white/[0.02]",t),...c,children:e})},i.ListItem=function({children:e,actions:t,className:c,...i}){return(0,a.jsxs)("div",{className:(0,n.cn)("group flex items-center justify-between p-3 -mx-3 px-3","border-b border-black/[0.03] dark:border-white/[0.03] last:border-b-0","hover:bg-black/[0.02] dark:hover:bg-white/[0.02]","transition-colors",c),...i,children:[(0,a.jsx)("div",{className:"flex-1 min-w-0",children:e}),t&&(0,a.jsx)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity",children:t})]})}},95204:(e,t,c)=>{"use strict";c.r(t),c.d(t,{default:()=>d});var a=c(95155),n=c(12115),i=c(73321),r=c(81060);let s={cc:{"claude-opus-4-5-20251101":{input:15,output:75,cached:7.5,reasoning:75,cache_creation:15},"claude-sonnet-4-5-20250929":{input:3,output:15,cached:1.5,reasoning:15,cache_creation:3},"claude-haiku-4-5-20251001":{input:.5,output:2.5,cached:.25,reasoning:2.5,cache_creation:.5}},cx:{"gpt-5.2-codex":{input:5,output:20,cached:2.5,reasoning:30,cache_creation:5},"gpt-5.2":{input:5,output:20,cached:2.5,reasoning:30,cache_creation:5},"gpt-5.1-codex-max":{input:8,output:32,cached:4,reasoning:48,cache_creation:8},"gpt-5.1-codex":{input:4,output:16,cached:2,reasoning:24,cache_creation:4},"gpt-5.1-codex-mini":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5},"gpt-5.1":{input:4,output:16,cached:2,reasoning:24,cache_creation:4},"gpt-5-codex":{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3},"gpt-5-codex-mini":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},gc:{"gemini-3-flash-preview":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-3-pro-preview":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-2.5-pro":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-2.5-flash":{input:.3,output:2.5,cached:.03,reasoning:3.75,cache_creation:.3},"gemini-2.5-flash-lite":{input:.15,output:1.25,cached:.015,reasoning:1.875,cache_creation:.15}},qw:{"qwen3-coder-plus":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"qwen3-coder-flash":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"vision-model":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5}},if:{"qwen3-coder-plus":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"kimi-k2":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"kimi-k2-thinking":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5},"deepseek-r1":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"deepseek-v3.2-chat":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"deepseek-v3.2-reasoner":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"minimax-m2":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"glm-4.6":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"glm-4.7":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75}},ag:{"gemini-3.1-pro-low":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-3.1-pro-high":{input:4,output:18,cached:.5,reasoning:27,cache_creation:4},"gemini-3-flash":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"claude-sonnet-4-6":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-opus-4-6-thinking":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"gpt-oss-120b-medium":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},gh:{"gpt-5":{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3},"gpt-5-mini":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"gpt-5.1-codex":{input:4,output:16,cached:2,reasoning:24,cache_creation:4},"gpt-5.1-codex-max":{input:8,output:32,cached:4,reasoning:48,cache_creation:8},"gpt-4.1":{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5},"claude-4.5-sonnet":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-4.5-opus":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"claude-4.5-haiku":{input:.5,output:2.5,cached:.05,reasoning:3.75,cache_creation:.5},"gemini-3-pro":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-3-flash":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-2.5-pro":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"grok-code-fast-1":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},openai:{"gpt-4o":{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5},"gpt-4o-mini":{input:.15,output:.6,cached:.075,reasoning:.9,cache_creation:.15},"gpt-4-turbo":{input:10,output:30,cached:5,reasoning:45,cache_creation:10},o1:{input:15,output:60,cached:7.5,reasoning:90,cache_creation:15},"o1-mini":{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3}},anthropic:{"claude-sonnet-4-20250514":{input:3,output:15,cached:1.5,reasoning:15,cache_creation:3},"claude-opus-4-20250514":{input:15,output:75,cached:7.5,reasoning:112.5,cache_creation:15},"claude-3-5-sonnet-20241022":{input:3,output:15,cached:1.5,reasoning:15,cache_creation:3}},gemini:{"gemini-3-pro-preview":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-2.5-pro":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-2.5-flash":{input:.3,output:2.5,cached:.03,reasoning:3.75,cache_creation:.3},"gemini-2.5-flash-lite":{input:.15,output:1.25,cached:.015,reasoning:1.875,cache_creation:.15}},openrouter:{auto:{input:2,output:8,cached:1,reasoning:12,cache_creation:2}},glm:{"glm-4.7":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"glm-4.6":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"glm-4.6v":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75}},kimi:{"kimi-latest":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},minimax:{"MiniMax-M2.1":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},groq:{"openai/gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"llama-3.3-70b-versatile":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"meta-llama/llama-4-maverick-17b-128e-instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"qwen/qwen3-32b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0}},fireworks:{"accounts/fireworks/models/gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"accounts/fireworks/models/deepseek-v3p1":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"accounts/fireworks/models/llama-v3p3-70b-instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"accounts/fireworks/models/qwen3-235b-a22b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0}},cerebras:{"gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"zai-glm-4.7":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"llama-3.3-70b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"llama-4-scout-17b-16e-instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"qwen-3-235b-a22b-instruct-2507":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"qwen-3-32b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0}},nvidia:{"openai/gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"moonshotai/kimi-k2.5":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"z-ai/glm4.7":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"deepseek-ai/deepseek-v3.2":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"nvidia/llama-3.3-70b-instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"meta/llama-4-maverick-17b-128e-instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"deepseek/deepseek-r1":{input:0,output:0,cached:0,reasoning:0,cache_creation:0}},nebius:{"openai/gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"meta-llama/Llama-3.3-70B-Instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0}},siliconflow:{"openai/gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"deepseek-ai/DeepSeek-V3.2":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"deepseek-ai/DeepSeek-V3.1":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"deepseek-ai/DeepSeek-R1":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"Qwen/Qwen3-235B-A22B-Instruct-2507":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"Qwen/Qwen3-Coder-480B-A35B-Instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"Qwen/Qwen3-32B":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"moonshotai/Kimi-K2.5":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"zai-org/GLM-4.7":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"baidu/ERNIE-4.5-300B-A47B":{input:0,output:0,cached:0,reasoning:0,cache_creation:0}},hyperbolic:{"openai/gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"Qwen/QwQ-32B":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"deepseek-ai/DeepSeek-R1":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"deepseek-ai/DeepSeek-V3":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"meta-llama/Llama-3.3-70B-Instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"meta-llama/Llama-3.2-3B-Instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"Qwen/Qwen2.5-72B-Instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"Qwen/Qwen2.5-Coder-32B-Instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"NousResearch/Hermes-3-Llama-3.1-70B":{input:0,output:0,cached:0,reasoning:0,cache_creation:0}},kiro:{"claude-sonnet-4.5":{input:3,output:15,cached:1.5,reasoning:15,cache_creation:3},"claude-haiku-4.5":{input:.5,output:2.5,cached:.25,reasoning:2.5,cache_creation:.5}}};function o({isOpen:e,onClose:t,onSave:c}){let[i,r]=(0,n.useState)({}),[o,u]=(0,n.useState)(!0),[d,p]=(0,n.useState)(!1);(0,n.useEffect)(()=>{e&&l()},[e]);let l=async()=>{u(!0);try{let e=await fetch("/api/pricing");if(e.ok){let t=await e.json();r(t)}else r(s)}catch(e){console.error("Failed to load pricing:",e),r(s)}finally{u(!1)}},h=async()=>{p(!0);try{let e=await fetch("/api/pricing",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(e.ok)c?.(),t();else{let t=await e.json();alert(`Failed to save pricing: ${t.error}`)}}catch(e){console.error("Failed to save pricing:",e),alert("Failed to save pricing")}finally{p(!1)}},g=async()=>{if(confirm("Reset all pricing to defaults? This cannot be undone."))try{(await fetch("/api/pricing",{method:"DELETE"})).ok&&r(s)}catch(e){console.error("Failed to reset pricing:",e),alert("Failed to reset pricing")}};if(!e)return null;let m=Object.keys(i).sort(),x=["input","output","cached","reasoning","cache_creation"];return(0,a.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:(0,a.jsxs)("div",{className:"bg-bg-base border border-border rounded-lg shadow-xl max-w-6xl w-full max-h-[90vh] overflow-hidden flex flex-col",children:[(0,a.jsxs)("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold",children:"Pricing Configuration"}),(0,a.jsx)("button",{onClick:t,className:"text-text-muted hover:text-text text-2xl leading-none",children:"\xd7"})]}),(0,a.jsx)("div",{className:"flex-1 overflow-auto p-4",children:o?(0,a.jsx)("div",{className:"text-center py-8 text-text-muted",children:"Loading pricing data..."}):(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"bg-bg-subtle border border-border rounded-lg p-3 text-sm",children:[(0,a.jsx)("p",{className:"font-medium mb-1",children:"Pricing Rates Format"}),(0,a.jsxs)("p",{className:"text-text-muted",children:["All rates are in ",(0,a.jsx)("strong",{children:"dollars per million tokens"})," ($/1M tokens). Example: Input rate of 2.50 means $2.50 per 1,000,000 input tokens."]})]}),m.map(e=>{let t=Object.keys(i[e]).sort();return(0,a.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,a.jsx)("div",{className:"bg-bg-subtle px-4 py-2 font-semibold text-sm",children:e.toUpperCase()}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-bg-hover text-text-muted uppercase text-xs",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 text-left",children:"Model"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"Input"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"Output"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"Cached"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"Reasoning"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"Cache Creation"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-border",children:t.map(t=>(0,a.jsxs)("tr",{className:"hover:bg-bg-subtle/50",children:[(0,a.jsx)("td",{className:"px-3 py-2 font-medium",children:t}),x.map(c=>(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsx)("input",{type:"number",step:"0.01",min:"0",value:i[e][t][c]||0,onChange:a=>{let n;!isNaN(n=parseFloat(a.target.value))&&!(n<0)&&r(a=>{let i={...a};return i[e]||(i[e]={}),i[e][t]||(i[e][t]={}),i[e][t][c]=n,i})},className:"w-20 px-2 py-1 text-right bg-bg-base border border-border rounded focus:outline-none focus:border-primary"})},c))]},t))})]})})]},e)}),0===m.length&&(0,a.jsx)("div",{className:"text-center py-8 text-text-muted",children:"No pricing data available"})]})}),(0,a.jsxs)("div",{className:"p-4 border-t border-border flex items-center justify-between gap-2",children:[(0,a.jsx)("button",{onClick:g,className:"px-4 py-2 text-sm text-red-500 hover:bg-red-500/10 rounded border border-red-500/20 transition-colors",disabled:d,children:"Reset to Defaults"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:t,className:"px-4 py-2 text-sm text-text-muted hover:text-text border border-border rounded transition-colors",disabled:d,children:"Cancel"}),(0,a.jsx)("button",{onClick:h,className:"px-4 py-2 text-sm bg-primary text-white rounded hover:bg-primary/90 transition-colors disabled:opacity-50",disabled:d,children:d?"Saving...":"Save Changes"})]})]})]})})}var u=c(50910);function d(){(0,i.useRouter)();let[e,t]=(0,n.useState)(!1),[c,s]=(0,n.useState)(null),[d,p]=(0,n.useState)(!0),l=(0,u.c)("settings");(0,n.useEffect)(()=>{h()},[]);let h=async()=>{p(!0);try{let e=await fetch("/api/pricing");if(e.ok){let t=await e.json();s(t)}}catch(e){console.error("Failed to load pricing:",e)}finally{p(!1)}};return(0,a.jsxs)("div",{className:"max-w-6xl mx-auto p-6 space-y-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-3xl font-bold",children:l("pricingSettingsTitle")}),(0,a.jsx)("p",{className:"text-text-muted mt-1",children:l("modelPricingDesc")})]}),(0,a.jsx)("button",{onClick:()=>t(!0),className:"px-4 py-2 bg-primary text-white rounded hover:bg-primary/90 transition-colors",children:l("editPricing")})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,a.jsxs)(r.default,{className:"p-4",children:[(0,a.jsx)("div",{className:"text-text-muted text-sm uppercase font-semibold",children:l("totalModels")}),(0,a.jsx)("div",{className:"text-2xl font-bold mt-1",children:d?"...":(()=>{if(!c)return 0;let e=0;for(let t in c)e+=Object.keys(c[t]).length;return e})()})]}),(0,a.jsxs)(r.default,{className:"p-4",children:[(0,a.jsx)("div",{className:"text-text-muted text-sm uppercase font-semibold",children:l("providers")}),(0,a.jsx)("div",{className:"text-2xl font-bold mt-1",children:d?"...":(!c?[]:Object.keys(c).sort()).length})]}),(0,a.jsxs)(r.default,{className:"p-4",children:[(0,a.jsx)("div",{className:"text-text-muted text-sm uppercase font-semibold",children:l("status")}),(0,a.jsx)("div",{className:"text-2xl font-bold mt-1 text-success",children:d?"...":l("active")})]})]}),(0,a.jsxs)(r.default,{className:"p-6",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold mb-4",children:l("howPricingWorks")}),(0,a.jsxs)("div",{className:"space-y-3 text-sm text-text-muted",children:[(0,a.jsxs)("p",{children:[(0,a.jsxs)("strong",{children:[l("costCalculation"),":"]})," ",l("costCalculationDesc")]}),(0,a.jsxs)("p",{children:[(0,a.jsxs)("strong",{children:[l("pricingFormat"),":"]})," ",l("pricingFormatDesc")]}),(0,a.jsx)("p",{children:(0,a.jsxs)("strong",{children:[l("tokenTypes"),":"]})}),(0,a.jsxs)("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[(0,a.jsxs)("li",{children:[(0,a.jsx)("strong",{children:"Input:"})," ",l("inputTokenDesc")]}),(0,a.jsxs)("li",{children:[(0,a.jsx)("strong",{children:"Output:"})," ",l("outputTokenDesc")]}),(0,a.jsxs)("li",{children:[(0,a.jsx)("strong",{children:"Cached:"})," ",l("cachedTokenDesc")]}),(0,a.jsxs)("li",{children:[(0,a.jsx)("strong",{children:"Reasoning:"})," ",l("reasoningTokenDesc")]}),(0,a.jsxs)("li",{children:[(0,a.jsx)("strong",{children:"Cache Creation:"})," ",l("cacheCreationTokenDesc")]})]}),(0,a.jsx)("p",{children:l("customPricingNote")})]})]}),(0,a.jsxs)(r.default,{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold",children:l("currentPricing")}),(0,a.jsx)("button",{onClick:()=>t(!0),className:"text-primary hover:underline text-sm",children:l("viewFullDetails")})]}),d?(0,a.jsx)("div",{className:"text-center py-4 text-text-muted",children:l("loadingPricing")}):c?(0,a.jsxs)("div",{className:"space-y-3",children:[Object.keys(c).slice(0,5).map(e=>(0,a.jsxs)("div",{className:"text-sm",children:[(0,a.jsxs)("span",{className:"font-semibold",children:[e.toUpperCase(),":"]})," ",(0,a.jsxs)("span",{className:"text-text-muted",children:[Object.keys(c[e]).length," models"]})]},e)),Object.keys(c).length>5&&(0,a.jsxs)("div",{className:"text-sm text-text-muted",children:["+ ",Object.keys(c).length-5," more providers"]})]}):(0,a.jsx)("div",{className:"text-text-muted",children:l("noPricing")})]}),e&&(0,a.jsx)(o,{isOpen:e,onClose:()=>t(!1),onSave:()=>{h()}})]})}}},e=>{e.O(0,[3418,8441,3794,7358],()=>e(e.s=43265)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[410],{43265:(e,t,c)=>{Promise.resolve().then(c.bind(c,95204))},50910:(e,t,c)=>{"use strict";c.d(t,{c:()=>i});var a=c(33418);function n(e,t){return(...e)=>{try{return t(...e)}catch{throw Error(void 0)}}}let i=n(0,a.c3);n(0,a.kc)},67040:(e,t,c)=>{"use strict";function a(...e){return e.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}c.d(t,{cn:()=>a})},73321:(e,t,c)=>{"use strict";var a=c(74645);c.o(a,"useParams")&&c.d(t,{useParams:function(){return a.useParams}}),c.o(a,"usePathname")&&c.d(t,{usePathname:function(){return a.usePathname}}),c.o(a,"useRouter")&&c.d(t,{useRouter:function(){return a.useRouter}}),c.o(a,"useSearchParams")&&c.d(t,{useSearchParams:function(){return a.useSearchParams}})},81060:(e,t,c)=>{"use strict";c.d(t,{default:()=>i});var a=c(95155),n=c(67040);function i({children:e,title:t,subtitle:c,icon:i,action:r,padding:s="md",hover:o=!1,className:u,...d}){return(0,a.jsxs)("div",{className:(0,n.cn)("bg-surface","border border-black/5 dark:border-white/5","rounded-lg shadow-sm",o&&"hover:shadow-md hover:border-primary/30 transition-all cursor-pointer",{none:"",xs:"p-3",sm:"p-4",md:"p-6",lg:"p-8"}[s],u),...d,children:[(t||r)&&(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[i&&(0,a.jsx)("div",{className:"p-2 rounded-lg bg-bg text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:i})}),(0,a.jsxs)("div",{children:[t&&(0,a.jsx)("h3",{className:"text-text-main font-semibold",children:t}),c&&(0,a.jsx)("p",{className:"text-sm text-text-muted",children:c})]})]}),r]}),e]})}i.Section=function({children:e,className:t,...c}){return(0,a.jsx)("div",{className:(0,n.cn)("p-4 rounded-lg","bg-black/[0.02] dark:bg-white/[0.02]","border border-black/5 dark:border-white/5",t),...c,children:e})},i.Row=function({children:e,className:t,...c}){return(0,a.jsx)("div",{className:(0,n.cn)("p-3 -mx-3 px-3 transition-colors","border-b border-black/5 dark:border-white/5 last:border-b-0","hover:bg-black/[0.02] dark:hover:bg-white/[0.02]",t),...c,children:e})},i.ListItem=function({children:e,actions:t,className:c,...i}){return(0,a.jsxs)("div",{className:(0,n.cn)("group flex items-center justify-between p-3 -mx-3 px-3","border-b border-black/[0.03] dark:border-white/[0.03] last:border-b-0","hover:bg-black/[0.02] dark:hover:bg-white/[0.02]","transition-colors",c),...i,children:[(0,a.jsx)("div",{className:"flex-1 min-w-0",children:e}),t&&(0,a.jsx)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity",children:t})]})}},95204:(e,t,c)=>{"use strict";c.r(t),c.d(t,{default:()=>d});var a=c(95155),n=c(12115),i=c(73321),r=c(81060);let s={cc:{"claude-opus-4-5-20251101":{input:15,output:75,cached:7.5,reasoning:75,cache_creation:15},"claude-sonnet-4-5-20250929":{input:3,output:15,cached:1.5,reasoning:15,cache_creation:3},"claude-haiku-4-5-20251001":{input:.5,output:2.5,cached:.25,reasoning:2.5,cache_creation:.5}},cx:{"gpt-5.2-codex":{input:5,output:20,cached:2.5,reasoning:30,cache_creation:5},"gpt-5.2":{input:5,output:20,cached:2.5,reasoning:30,cache_creation:5},"gpt-5.1-codex-max":{input:8,output:32,cached:4,reasoning:48,cache_creation:8},"gpt-5.1-codex":{input:4,output:16,cached:2,reasoning:24,cache_creation:4},"gpt-5.1-codex-mini":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5},"gpt-5.1":{input:4,output:16,cached:2,reasoning:24,cache_creation:4},"gpt-5-codex":{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3},"gpt-5-codex-mini":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},gc:{"gemini-3-flash-preview":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-3-pro-preview":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-2.5-pro":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-2.5-flash":{input:.3,output:2.5,cached:.03,reasoning:3.75,cache_creation:.3},"gemini-2.5-flash-lite":{input:.15,output:1.25,cached:.015,reasoning:1.875,cache_creation:.15}},qw:{"qwen3-coder-plus":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"qwen3-coder-flash":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"vision-model":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5}},if:{"qwen3-coder-plus":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"kimi-k2":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"kimi-k2-thinking":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5},"deepseek-r1":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"deepseek-v3.2-chat":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"deepseek-v3.2-reasoner":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"minimax-m2":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"glm-4.6":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"glm-4.7":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75}},ag:{"gemini-3.1-pro-low":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-3.1-pro-high":{input:4,output:18,cached:.5,reasoning:27,cache_creation:4},"gemini-3-flash":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"claude-sonnet-4-6":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-opus-4-6-thinking":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"gpt-oss-120b-medium":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},gh:{"gpt-5":{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3},"gpt-5-mini":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"gpt-5.1-codex":{input:4,output:16,cached:2,reasoning:24,cache_creation:4},"gpt-5.1-codex-max":{input:8,output:32,cached:4,reasoning:48,cache_creation:8},"gpt-4.1":{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5},"claude-4.5-sonnet":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-4.5-opus":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"claude-4.5-haiku":{input:.5,output:2.5,cached:.05,reasoning:3.75,cache_creation:.5},"gemini-3-pro":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-3-flash":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-2.5-pro":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"grok-code-fast-1":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},openai:{"gpt-4o":{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5},"gpt-4o-mini":{input:.15,output:.6,cached:.075,reasoning:.9,cache_creation:.15},"gpt-4-turbo":{input:10,output:30,cached:5,reasoning:45,cache_creation:10},o1:{input:15,output:60,cached:7.5,reasoning:90,cache_creation:15},"o1-mini":{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3}},anthropic:{"claude-sonnet-4-20250514":{input:3,output:15,cached:1.5,reasoning:15,cache_creation:3},"claude-opus-4-20250514":{input:15,output:75,cached:7.5,reasoning:112.5,cache_creation:15},"claude-3-5-sonnet-20241022":{input:3,output:15,cached:1.5,reasoning:15,cache_creation:3}},gemini:{"gemini-3-pro-preview":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-2.5-pro":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-2.5-flash":{input:.3,output:2.5,cached:.03,reasoning:3.75,cache_creation:.3},"gemini-2.5-flash-lite":{input:.15,output:1.25,cached:.015,reasoning:1.875,cache_creation:.15}},openrouter:{auto:{input:2,output:8,cached:1,reasoning:12,cache_creation:2}},glm:{"glm-4.7":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"glm-4.6":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"glm-4.6v":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75}},kimi:{"kimi-latest":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},minimax:{"MiniMax-M2.1":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},groq:{"openai/gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"llama-3.3-70b-versatile":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"meta-llama/llama-4-maverick-17b-128e-instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"qwen/qwen3-32b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0}},fireworks:{"accounts/fireworks/models/gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"accounts/fireworks/models/deepseek-v3p1":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"accounts/fireworks/models/llama-v3p3-70b-instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"accounts/fireworks/models/qwen3-235b-a22b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0}},cerebras:{"gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"zai-glm-4.7":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"llama-3.3-70b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"llama-4-scout-17b-16e-instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"qwen-3-235b-a22b-instruct-2507":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"qwen-3-32b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0}},nvidia:{"openai/gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"moonshotai/kimi-k2.5":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"z-ai/glm4.7":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"deepseek-ai/deepseek-v3.2":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"nvidia/llama-3.3-70b-instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"meta/llama-4-maverick-17b-128e-instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"deepseek/deepseek-r1":{input:0,output:0,cached:0,reasoning:0,cache_creation:0}},nebius:{"openai/gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"meta-llama/Llama-3.3-70B-Instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0}},siliconflow:{"openai/gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"deepseek-ai/DeepSeek-V3.2":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"deepseek-ai/DeepSeek-V3.1":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"deepseek-ai/DeepSeek-R1":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"Qwen/Qwen3-235B-A22B-Instruct-2507":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"Qwen/Qwen3-Coder-480B-A35B-Instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"Qwen/Qwen3-32B":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"moonshotai/Kimi-K2.5":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"zai-org/GLM-4.7":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"baidu/ERNIE-4.5-300B-A47B":{input:0,output:0,cached:0,reasoning:0,cache_creation:0}},hyperbolic:{"openai/gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"gpt-oss-120b":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"Qwen/QwQ-32B":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"deepseek-ai/DeepSeek-R1":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"deepseek-ai/DeepSeek-V3":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"meta-llama/Llama-3.3-70B-Instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"meta-llama/Llama-3.2-3B-Instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"Qwen/Qwen2.5-72B-Instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"Qwen/Qwen2.5-Coder-32B-Instruct":{input:0,output:0,cached:0,reasoning:0,cache_creation:0},"NousResearch/Hermes-3-Llama-3.1-70B":{input:0,output:0,cached:0,reasoning:0,cache_creation:0}},kiro:{"claude-sonnet-4.5":{input:3,output:15,cached:1.5,reasoning:15,cache_creation:3},"claude-haiku-4.5":{input:.5,output:2.5,cached:.25,reasoning:2.5,cache_creation:.5}}};function o({isOpen:e,onClose:t,onSave:c}){let[i,r]=(0,n.useState)({}),[o,u]=(0,n.useState)(!0),[d,p]=(0,n.useState)(!1);(0,n.useEffect)(()=>{e&&l()},[e]);let l=async()=>{u(!0);try{let e=await fetch("/api/pricing");if(e.ok){let t=await e.json();r(t)}else r(s)}catch(e){console.error("Failed to load pricing:",e),r(s)}finally{u(!1)}},h=async()=>{p(!0);try{let e=await fetch("/api/pricing",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(e.ok)c?.(),t();else{let t=await e.json();alert(`Failed to save pricing: ${t.error}`)}}catch(e){console.error("Failed to save pricing:",e),alert("Failed to save pricing")}finally{p(!1)}},g=async()=>{if(confirm("Reset all pricing to defaults? This cannot be undone."))try{(await fetch("/api/pricing",{method:"DELETE"})).ok&&r(s)}catch(e){console.error("Failed to reset pricing:",e),alert("Failed to reset pricing")}};if(!e)return null;let m=Object.keys(i).sort(),x=["input","output","cached","reasoning","cache_creation"];return(0,a.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:(0,a.jsxs)("div",{className:"bg-bg-base border border-border rounded-lg shadow-xl max-w-6xl w-full max-h-[90vh] overflow-hidden flex flex-col",children:[(0,a.jsxs)("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold",children:"Pricing Configuration"}),(0,a.jsx)("button",{onClick:t,className:"text-text-muted hover:text-text text-2xl leading-none",children:"\xd7"})]}),(0,a.jsx)("div",{className:"flex-1 overflow-auto p-4",children:o?(0,a.jsx)("div",{className:"text-center py-8 text-text-muted",children:"Loading pricing data..."}):(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"bg-bg-subtle border border-border rounded-lg p-3 text-sm",children:[(0,a.jsx)("p",{className:"font-medium mb-1",children:"Pricing Rates Format"}),(0,a.jsxs)("p",{className:"text-text-muted",children:["All rates are in ",(0,a.jsx)("strong",{children:"dollars per million tokens"})," ($/1M tokens). Example: Input rate of 2.50 means $2.50 per 1,000,000 input tokens."]})]}),m.map(e=>{let t=Object.keys(i[e]).sort();return(0,a.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,a.jsx)("div",{className:"bg-bg-subtle px-4 py-2 font-semibold text-sm",children:e.toUpperCase()}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-bg-hover text-text-muted uppercase text-xs",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 text-left",children:"Model"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"Input"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"Output"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"Cached"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"Reasoning"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"Cache Creation"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-border",children:t.map(t=>(0,a.jsxs)("tr",{className:"hover:bg-bg-subtle/50",children:[(0,a.jsx)("td",{className:"px-3 py-2 font-medium",children:t}),x.map(c=>(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsx)("input",{type:"number",step:"0.01",min:"0",value:i[e][t][c]||0,onChange:a=>{let n;!isNaN(n=parseFloat(a.target.value))&&!(n<0)&&r(a=>{let i={...a};return i[e]||(i[e]={}),i[e][t]||(i[e][t]={}),i[e][t][c]=n,i})},className:"w-20 px-2 py-1 text-right bg-bg-base border border-border rounded focus:outline-none focus:border-primary"})},c))]},t))})]})})]},e)}),0===m.length&&(0,a.jsx)("div",{className:"text-center py-8 text-text-muted",children:"No pricing data available"})]})}),(0,a.jsxs)("div",{className:"p-4 border-t border-border flex items-center justify-between gap-2",children:[(0,a.jsx)("button",{onClick:g,className:"px-4 py-2 text-sm text-red-500 hover:bg-red-500/10 rounded border border-red-500/20 transition-colors",disabled:d,children:"Reset to Defaults"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:t,className:"px-4 py-2 text-sm text-text-muted hover:text-text border border-border rounded transition-colors",disabled:d,children:"Cancel"}),(0,a.jsx)("button",{onClick:h,className:"px-4 py-2 text-sm bg-primary text-white rounded hover:bg-primary/90 transition-colors disabled:opacity-50",disabled:d,children:d?"Saving...":"Save Changes"})]})]})]})})}var u=c(50910);function d(){(0,i.useRouter)();let[e,t]=(0,n.useState)(!1),[c,s]=(0,n.useState)(null),[d,p]=(0,n.useState)(!0),l=(0,u.c)("settings");(0,n.useEffect)(()=>{h()},[]);let h=async()=>{p(!0);try{let e=await fetch("/api/pricing");if(e.ok){let t=await e.json();s(t)}}catch(e){console.error("Failed to load pricing:",e)}finally{p(!1)}};return(0,a.jsxs)("div",{className:"max-w-6xl mx-auto p-6 space-y-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-3xl font-bold",children:l("pricingSettingsTitle")}),(0,a.jsx)("p",{className:"text-text-muted mt-1",children:l("modelPricingDesc")})]}),(0,a.jsx)("button",{onClick:()=>t(!0),className:"px-4 py-2 bg-primary text-white rounded hover:bg-primary/90 transition-colors",children:l("editPricing")})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,a.jsxs)(r.default,{className:"p-4",children:[(0,a.jsx)("div",{className:"text-text-muted text-sm uppercase font-semibold",children:l("totalModels")}),(0,a.jsx)("div",{className:"text-2xl font-bold mt-1",children:d?"...":(()=>{if(!c)return 0;let e=0;for(let t in c)e+=Object.keys(c[t]).length;return e})()})]}),(0,a.jsxs)(r.default,{className:"p-4",children:[(0,a.jsx)("div",{className:"text-text-muted text-sm uppercase font-semibold",children:l("providers")}),(0,a.jsx)("div",{className:"text-2xl font-bold mt-1",children:d?"...":(!c?[]:Object.keys(c).sort()).length})]}),(0,a.jsxs)(r.default,{className:"p-4",children:[(0,a.jsx)("div",{className:"text-text-muted text-sm uppercase font-semibold",children:l("status")}),(0,a.jsx)("div",{className:"text-2xl font-bold mt-1 text-success",children:d?"...":l("active")})]})]}),(0,a.jsxs)(r.default,{className:"p-6",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold mb-4",children:l("howPricingWorks")}),(0,a.jsxs)("div",{className:"space-y-3 text-sm text-text-muted",children:[(0,a.jsxs)("p",{children:[(0,a.jsxs)("strong",{children:[l("costCalculation"),":"]})," ",l("costCalculationDesc")]}),(0,a.jsxs)("p",{children:[(0,a.jsxs)("strong",{children:[l("pricingFormat"),":"]})," ",l("pricingFormatDesc")]}),(0,a.jsx)("p",{children:(0,a.jsxs)("strong",{children:[l("tokenTypes"),":"]})}),(0,a.jsxs)("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[(0,a.jsxs)("li",{children:[(0,a.jsxs)("strong",{children:[l("input"),":"]})," ",l("inputTokenDesc")]}),(0,a.jsxs)("li",{children:[(0,a.jsxs)("strong",{children:[l("output"),":"]})," ",l("outputTokenDesc")]}),(0,a.jsxs)("li",{children:[(0,a.jsxs)("strong",{children:[l("cached"),":"]})," ",l("cachedTokenDesc")]}),(0,a.jsxs)("li",{children:[(0,a.jsxs)("strong",{children:[l("reasoning"),":"]})," ",l("reasoningTokenDesc")]}),(0,a.jsxs)("li",{children:[(0,a.jsxs)("strong",{children:[l("cacheCreation"),":"]})," ",l("cacheCreationTokenDesc")]})]}),(0,a.jsx)("p",{children:l("customPricingNote")})]})]}),(0,a.jsxs)(r.default,{className:"p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold",children:l("currentPricing")}),(0,a.jsx)("button",{onClick:()=>t(!0),className:"text-primary hover:underline text-sm",children:l("viewFullDetails")})]}),d?(0,a.jsx)("div",{className:"text-center py-4 text-text-muted",children:l("loadingPricing")}):c?(0,a.jsxs)("div",{className:"space-y-3",children:[Object.keys(c).slice(0,5).map(e=>(0,a.jsxs)("div",{className:"text-sm",children:[(0,a.jsxs)("span",{className:"font-semibold",children:[e.toUpperCase(),":"]})," ",(0,a.jsxs)("span",{className:"text-text-muted",children:[Object.keys(c[e]).length," ",l("models")]})]},e)),Object.keys(c).length>5&&(0,a.jsxs)("div",{className:"text-sm text-text-muted",children:["+ ",l("moreProviders",{count:Object.keys(c).length-5})]})]}):(0,a.jsx)("div",{className:"text-text-muted",children:l("noPricing")})]}),e&&(0,a.jsx)(o,{isOpen:e,onClose:()=>t(!1),onSave:()=>{h()}})]})}}},e=>{e.O(0,[3418,8441,3794,7358],()=>e(e.s=43265)),_N_E=e.O()}]);
@@ -0,0 +1,4 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3528],{2824:(e,t,s)=>{"use strict";s.d(t,{default:()=>k});var a=s(95155),r=s(50910),l=s(12115),n=s(40993);function i(e){let t=e("templatePayloads.simpleChat.system"),s=e("templatePayloads.simpleChat.userGreeting"),a=e("templatePayloads.toolCalling.userWeather"),r=e("templatePayloads.toolCalling.toolDescription"),l=e("templatePayloads.toolCalling.cityNameDescription"),n=e("templatePayloads.multiTurn.system"),i=e("templatePayloads.multiTurn.userInitial"),o=e("templatePayloads.multiTurn.assistantExample"),c=e("templatePayloads.multiTurn.userFollowUp"),d=e("templatePayloads.thinking.question"),m=e("templatePayloads.systemPrompt.systemInstruction"),x=e("templatePayloads.systemPrompt.question"),p=e("templatePayloads.streaming.prompt");return[{id:"simple-chat",name:e("templateNames.simple-chat"),icon:"chat",description:e("templateDescriptions.simple-chat"),formats:{openai:{model:"gpt-4o",messages:[{role:"system",content:t},{role:"user",content:s}],stream:!0},claude:{model:"claude-sonnet-4-20250514",system:t,max_tokens:1024,messages:[{role:"user",content:s}],stream:!0},gemini:{model:"gemini-2.5-flash",contents:[{role:"user",parts:[{text:s}]}],systemInstruction:{parts:[{text:t}]}},"openai-responses":{model:"gpt-4o",input:s,instructions:t}}},{id:"tool-calling",name:e("templateNames.tool-calling"),icon:"build",description:e("templateDescriptions.tool-calling"),formats:{openai:{model:"gpt-4o",messages:[{role:"user",content:a}],tools:[{type:"function",function:{name:"get_weather",description:r,parameters:{type:"object",properties:{location:{type:"string",description:l},unit:{type:"string",enum:["celsius","fahrenheit"]}},required:["location"]}}}],stream:!0},claude:{model:"claude-sonnet-4-20250514",max_tokens:1024,messages:[{role:"user",content:a}],tools:[{name:"get_weather",description:r,input_schema:{type:"object",properties:{location:{type:"string",description:l},unit:{type:"string",enum:["celsius","fahrenheit"]}},required:["location"]}}],stream:!0},gemini:{model:"gemini-2.5-flash",contents:[{role:"user",parts:[{text:a}]}],tools:[{functionDeclarations:[{name:"get_weather",description:r,parameters:{type:"object",properties:{location:{type:"string",description:l},unit:{type:"string",enum:["celsius","fahrenheit"]}},required:["location"]}}]}]}}},{id:"multi-turn",name:e("templateNames.multi-turn"),icon:"forum",description:e("templateDescriptions.multi-turn"),formats:{openai:{model:"gpt-4o",messages:[{role:"system",content:n},{role:"user",content:i},{role:"assistant",content:o},{role:"user",content:c}],stream:!0},claude:{model:"claude-sonnet-4-20250514",system:n,max_tokens:1024,messages:[{role:"user",content:i},{role:"assistant",content:o},{role:"user",content:c}],stream:!0},gemini:{model:"gemini-2.5-flash",contents:[{role:"user",parts:[{text:i}]},{role:"model",parts:[{text:o}]},{role:"user",parts:[{text:c}]}],systemInstruction:{parts:[{text:n}]}}}},{id:"thinking",name:e("templateNames.thinking"),icon:"psychology",description:e("templateDescriptions.thinking"),formats:{openai:{model:"o3-mini",messages:[{role:"user",content:d}],stream:!0},claude:{model:"claude-sonnet-4-20250514",max_tokens:16e3,thinking:{type:"enabled",budget_tokens:1e4},messages:[{role:"user",content:d}],stream:!0},gemini:{model:"gemini-2.5-flash-thinking",contents:[{role:"user",parts:[{text:d}]}],generationConfig:{thinkingConfig:{thinkingBudget:1e4}}}}},{id:"system-prompt",name:e("templateNames.system-prompt"),icon:"settings",description:e("templateDescriptions.system-prompt"),formats:{openai:{model:"gpt-4o",messages:[{role:"system",content:m},{role:"user",content:x}],temperature:.7,stream:!0},claude:{model:"claude-sonnet-4-20250514",system:m,max_tokens:2048,messages:[{role:"user",content:x}],temperature:.7,stream:!0},gemini:{model:"gemini-2.5-flash",contents:[{role:"user",parts:[{text:x}]}],systemInstruction:{parts:[{text:m}]},generationConfig:{temperature:.7}}}},{id:"streaming",name:e("templateNames.streaming"),icon:"stream",description:e("templateDescriptions.streaming"),formats:{openai:{model:"gpt-4o",messages:[{role:"user",content:p}],stream:!0,stream_options:{include_usage:!0}},claude:{model:"claude-sonnet-4-20250514",max_tokens:1024,messages:[{role:"user",content:p}],stream:!0},gemini:{model:"gemini-2.5-flash",contents:[{role:"user",parts:[{text:p}]}]}}}]}let o={openai:{label:"OpenAI",color:"emerald",icon:"smart_toy"},"openai-responses":{label:"OpenAI Responses",color:"amber",icon:"swap_horiz"},claude:{label:"Claude",color:"orange",icon:"psychology"},gemini:{label:"Gemini",color:"blue",icon:"auto_awesome"},antigravity:{label:"Antigravity",color:"purple",icon:"rocket_launch"},kiro:{label:"Kiro",color:"cyan",icon:"terminal"},cursor:{label:"Cursor",color:"pink",icon:"edit"},codex:{label:"Codex",color:"yellow",icon:"code"}},c=Object.entries(o).map(([e,t])=>({value:e,label:t.label}));var d=s(75707),m=s.n(d);let x=m()(()=>s.e(8202).then(s.bind(s,28202)),{loadableGenerated:{webpack:()=>[28202]},ssr:!1});function p(){let e=(0,r.c)("translator"),t=(0,r.c)("common"),[s,d]=(0,l.useState)("claude"),[m,p]=(0,l.useState)("openai"),[u,h]=(0,l.useState)(""),[g,b]=(0,l.useState)(""),[f,j]=(0,l.useState)(null),[y,v]=(0,l.useState)(!1),[N,w]=(0,l.useState)(!1),[k,S]=(0,l.useState)(null),_=(0,l.useMemo)(()=>i(e),[e]),C=(0,l.useCallback)(async e=>{if(!e||e.trim().length<5)return void j(null);try{let t=JSON.parse(e);w(!0);let s=await fetch("/api/translator/detect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:t})}),a=await s.json();a.success&&(j(a.format),d(a.format))}catch{}finally{w(!1)}},[]);(0,l.useEffect)(()=>{let e=setTimeout(()=>{C(u)},600);return()=>clearTimeout(e)},[u,C]);let O=async()=>{if(u.trim()){v(!0),b("");try{let e=JSON.parse(u),t=await fetch("/api/translator/translate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step:"direct",sourceFormat:s,targetFormat:m,body:e})}),a=await t.json();a.success?b(JSON.stringify(a.result,null,2)):b(JSON.stringify({error:a.error},null,2))}catch(e){b(JSON.stringify({error:e.message},null,2))}v(!1)}},T=async e=>{try{await navigator.clipboard.writeText(e)}catch{}},P=o[s]||o.openai,D=o[m]||o.openai;return(0,a.jsxs)("div",{className:"space-y-5",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 rounded-lg bg-primary/5 border border-primary/10 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px] mt-0.5 shrink-0",children:"info"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-text-main mb-0.5",children:e("formatConverter")}),(0,a.jsx)("p",{children:e("formatConverterDescription")})]})]}),(0,a.jsx)(n.Zp,{children:(0,a.jsxs)("div",{className:"p-4 flex flex-col sm:flex-row items-center gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 w-full",children:[(0,a.jsx)("label",{className:"block text-xs font-medium text-text-muted mb-1.5 uppercase tracking-wider",children:e("source")}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[20px] text-${P.color}-500`,children:P.icon}),(0,a.jsx)(n.l6,{value:s,onChange:e=>{d(e.target.value),j(null)},options:c,className:"flex-1"}),f&&(0,a.jsx)(n.Ex,{variant:"primary",size:"sm",icon:"auto_awesome",children:e("auto")})]})]}),(0,a.jsx)("button",{onClick:()=>{d(m),p(s),h(g),b(""),j(null)},className:"p-2 rounded-full hover:bg-primary/10 text-text-muted hover:text-primary transition-all mt-4 sm:mt-5",title:e("swapFormats"),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[24px]",children:"swap_horiz"})}),(0,a.jsxs)("div",{className:"flex-1 w-full",children:[(0,a.jsx)("label",{className:"block text-xs font-medium text-text-muted mb-1.5 uppercase tracking-wider",children:e("target")}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[20px] text-${D.color}-500`,children:D.icon}),(0,a.jsx)(n.l6,{value:m,onChange:e=>p(e.target.value),options:c,className:"flex-1"})]})]}),(0,a.jsx)("div",{className:"pt-0 sm:pt-5",children:(0,a.jsx)(n.$n,{icon:"arrow_forward",onClick:O,loading:y,disabled:!u.trim()||y,className:"w-full sm:w-auto",children:e("translateAction")})})]})}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,a.jsx)(n.Zp,{children:(0,a.jsxs)("div",{className:"p-4 space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:"input"}),(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:e("input")}),f&&(0,a.jsx)(n.Ex,{variant:"info",size:"sm",dot:!0,children:o[f]?.label||f}),N&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted animate-spin",children:"progress_activity"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("button",{onClick:()=>T(u),className:"p-1.5 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-text-main transition-colors",title:t("copy"),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"content_copy"})}),(0,a.jsx)("button",{onClick:()=>{h(""),b(""),j(null),S(null)},className:"p-1.5 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-text-main transition-colors",title:e("clear"),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"delete"})})]})]}),(0,a.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:(0,a.jsx)(x,{height:"400px",defaultLanguage:"json",value:u,onChange:e=>h(e||""),theme:"vs-dark",options:{minimap:{enabled:!1},fontSize:12,lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,formatOnPaste:!0,placeholder:e("inputPlaceholder")}})})]})}),(0,a.jsx)(n.Zp,{children:(0,a.jsxs)("div",{className:"p-4 space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:"output"}),(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:e("output")}),g&&(0,a.jsx)(n.Ex,{variant:"success",size:"sm",dot:!0,children:o[m]?.label||m})]}),(0,a.jsx)("div",{className:"flex items-center gap-1",children:(0,a.jsx)("button",{onClick:()=>T(g),className:"p-1.5 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-text-main transition-colors",title:t("copy"),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"content_copy"})})})]}),(0,a.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:(0,a.jsx)(x,{height:"400px",defaultLanguage:"json",value:g,theme:"vs-dark",options:{minimap:{enabled:!1},fontSize:12,lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,readOnly:!0}})})]})})]}),(0,a.jsx)(n.Zp,{children:(0,a.jsxs)("div",{className:"p-4 space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary",children:"library_books"}),(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:e("exampleTemplates")}),(0,a.jsx)("span",{className:"text-xs text-text-muted",children:e("exampleTemplatesHint")})]}),(0,a.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-6 gap-2",children:_.map(e=>(0,a.jsxs)("button",{onClick:()=>{h(JSON.stringify(e.formats[s]||e.formats.openai,null,2)),S(e.id),b("")},className:`
2
+ group flex flex-col items-center gap-1.5 p-3 rounded-lg border transition-all text-center
3
+ ${k===e.id?"border-primary bg-primary/5 text-primary":"border-border hover:border-primary/30 hover:bg-primary/5 text-text-muted hover:text-text-main"}
4
+ `,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[22px] ${k===e.id?"text-primary":"text-text-muted group-hover:text-primary"} transition-colors`,children:e.icon}),(0,a.jsx)("span",{className:"text-xs font-medium leading-tight",children:e.name})]},e.id))}),k&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"info"}),e("templateLoadHint",{format:o[s]?.label||s})]})]})})]})}var u=s(20909);function h(e="openai"){let t=(0,r.c)("translator"),[s,a]=(0,l.useState)(e),[n,i]=(0,l.useState)([]),[o,c]=(0,l.useState)(!0);return(0,l.useEffect)(()=>{(async()=>{try{let[e,s]=await Promise.all([fetch("/api/providers"),fetch("/api/provider-nodes")]),[r,l]=await Promise.all([e.json(),s.json()]),n=new Map((l.nodes||[]).map(e=>[e.id,e])),o=[...new Set((r.connections||[]).filter(e=>!1!==e.isActive).map(e=>e.provider))].map(e=>{let s=u.Q2[e],a=n.get(e),r=s?.name||a?.name||e;return!s&&e.startsWith(u.JH)&&(r=a?.name||t("openaiCompatibleLabel")),!s&&e.startsWith(u.DI)&&(r=a?.name||t("anthropicCompatibleLabel")),{value:e,label:r}}).sort((e,t)=>e.label.localeCompare(t.label)),c=o.length>0?o:Object.entries(u.Q2).map(([e,t])=>({value:e,label:t.name}));i(c),c.length>0&&a(e=>c.some(t=>t.value===e)?e:c[0].value)}catch{let e=Object.entries(u.Q2).map(([e,t])=>({value:e,label:t.name}));i(e),e.length>0&&a(t=>e.some(e=>e.value===t)?t:e[0].value)}finally{c(!1)}})()},[t]),{provider:s,setProvider:a,providerOptions:n,loading:o}}let g={openai:["gpt-","o1-","o3-","o4-"],"openai-responses":["gpt-","o1-","o3-","o4-"],claude:["claude-"],gemini:["gemini-"]};function b(){let[e,t]=(0,l.useState)(""),[s,a]=(0,l.useState)([]),[r,n]=(0,l.useState)(!0);(0,l.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/v1/models"),t=((await e.json()).data||[]).map(e=>e.id).sort((e,t)=>e.localeCompare(t));a(t)}catch{a([])}finally{n(!1)}})()},[]);let i=(0,l.useCallback)(e=>{if(0===s.length)return"";for(let t of g[e]||[]){let e=s.find(e=>e.startsWith(t));if(e)return e}return s[0]},[s]);return{model:e,setModel:t,availableModels:s,loading:r,pickModelForFormat:i}}let f=m()(()=>s.e(8202).then(s.bind(s,28202)),{loadableGenerated:{webpack:()=>[28202]},ssr:!1});function j(){let e=(0,r.c)("translator"),{provider:t,setProvider:s,providerOptions:i}=h("openai"),{model:d,setModel:m,availableModels:x,pickModelForFormat:p}=b(),[u,g]=(0,l.useState)("openai"),[j,y]=(0,l.useState)(""),[v,N]=(0,l.useState)(!1),[w,k]=(0,l.useState)([]),[S,_]=(0,l.useState)(null),[C,O]=(0,l.useState)(null),T=(0,l.useRef)(null);(0,l.useEffect)(()=>{let e=p(u);e&&m(e)},[u,p,m]);let P=()=>{T.current?.scrollIntoView({behavior:"smooth"})},D=async()=>{if(!j.trim()||v)return;let s=j.trim();y(""),N(!0),k(e=>[...e,{role:"user",content:s}]);let a=[];try{let r,l=[...w.map(e=>({role:e.role,content:e.content})),{role:"user",content:s}];r="claude"===u?{model:d,max_tokens:1024,messages:l,stream:!0}:"gemini"===u?{model:d,contents:l.map(e=>({role:"assistant"===e.role?"model":"user",parts:[{text:e.content}]}))}:"openai-responses"===u?{model:d,input:l.map(e=>({type:"message",role:e.role,content:[{type:"input_text",text:e.content}]})),stream:!0}:{model:d,messages:l,stream:!0},a.push({id:1,name:e("clientRequest"),description:e("clientRequestDescription"),format:u,content:JSON.stringify(r,null,2),status:"done"});let n=await fetch("/api/translator/detect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:r})}),i=(await n.json()).format||u;a.push({id:2,name:e("formatDetected"),description:e("formatDetectedDescription"),format:i,content:JSON.stringify({detectedFormat:i,clientFormat:u,match:i===u},null,2),status:"done"});let o=await fetch("/api/translator/translate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step:"direct",sourceFormat:i,targetFormat:"openai",body:r})}),c=await o.json();a.push({id:3,name:e("openaiIntermediate"),description:e("openaiIntermediateDescription"),format:"openai",content:JSON.stringify(c.result||c,null,2),status:c.success?"done":"error"});let m=await fetch("/api/translator/translate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step:"direct",sourceFormat:"openai",provider:t,body:c.result})}),x=await m.json(),p=x.targetFormat||"openai";a.push({id:4,name:e("providerFormat"),description:e("providerFormatDescription"),format:p,content:JSON.stringify(x.result||x,null,2),status:x.success?"done":"error"});let h=await fetch("/api/translator/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,body:x.result||c.result})});if(h.ok){let t=h.body.getReader(),s=new TextDecoder,r="";for(;;){let{done:e,value:a}=await t.read();if(e)break;r+=s.decode(a,{stream:!0})}a.push({id:5,name:e("providerResponse"),description:e("providerResponseSseDescription"),format:p,content:r.slice(0,5e3)+(r.length>5e3?"\n... (truncated)":""),status:"done"});let l=function(e){let t="";for(let s of e.split("\n")){if(!s.startsWith("data: "))continue;let e=s.slice(6).trim();if("[DONE]"===e)break;try{let s=JSON.parse(e),a=s.choices?.[0]?.delta;a?.content&&(t+=a.content),"content_block_delta"===s.type&&s.delta?.text&&(t+=s.delta.text)}catch{}}return t||e.slice(0,500)}(r);k(t=>[...t,{role:"assistant",content:l||e("noTextExtracted")}])}else{let t=await h.json().catch(()=>({error:e("requestFailed")}));a.push({id:5,name:e("providerResponse"),description:e("providerResponseRawDescription"),format:p,content:JSON.stringify(t,null,2),status:"error"}),k(s=>[...s,{role:"assistant",content:e("errorMessage",{message:t.error||e("requestFailed")})}])}}catch(t){a.push({id:a.length+1,name:e("error"),description:e("unexpectedError"),format:"error",content:JSON.stringify({error:t.message},null,2),status:"error"}),k(s=>[...s,{role:"assistant",content:e("errorMessage",{message:t.message})}])}_(a),O(a.length>0?a[a.length-1].id:null),N(!1),setTimeout(P,100)};return(0,a.jsxs)("div",{className:"space-y-4 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 rounded-lg bg-primary/5 border border-primary/10 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px] mt-0.5 shrink-0",children:"info"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-text-main mb-0.5",children:e("pipelineDebugger")}),(0,a.jsx)("p",{children:e("chatTesterDescription")}),(0,a.jsxs)("p",{children:[(0,a.jsx)("strong",{className:"text-text-main",children:e("chatTesterFlow")}),"."," ",e("clickStepToInspect")]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 min-w-0",children:[(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(n.Zp,{children:(0,a.jsxs)("div",{className:"p-4 flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("label",{className:"block text-xs font-medium text-text-muted mb-1 uppercase tracking-wider",children:e("clientFormat")}),(0,a.jsx)(n.l6,{value:u,onChange:e=>g(e.target.value),options:c.filter(e=>["openai","claude","gemini","openai-responses"].includes(e.value))})]}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("label",{className:"block text-xs font-medium text-text-muted mb-1 uppercase tracking-wider",children:e("provider")}),(0,a.jsx)(n.l6,{value:t,onChange:e=>s(e.target.value),options:i})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs font-medium text-text-muted mb-1 uppercase tracking-wider",children:e("model")}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{type:"text",value:d,onChange:e=>m(e.target.value),list:"model-suggestions",placeholder:e("modelPlaceholder"),className:"w-full bg-bg-subtle border border-border rounded-lg px-3 py-2 text-sm text-text-main placeholder:text-text-muted focus:outline-none focus:border-primary transition-colors"}),(0,a.jsx)("datalist",{id:"model-suggestions",children:x.map(e=>(0,a.jsx)("option",{value:e},e))})]})]})]})}),(0,a.jsxs)(n.Zp,{className:"min-h-[400px] flex flex-col",children:[(0,a.jsxs)("div",{className:"p-4 flex-1 overflow-y-auto max-h-[500px] space-y-3",children:[0===w.length&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-text-muted py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[48px] mb-3 opacity-30",children:"chat"}),(0,a.jsx)("p",{className:"text-sm font-medium mb-1",children:e("sendMessageToSeePipeline")}),(0,a.jsxs)("p",{className:"text-xs text-center max-w-xs",children:[e("chatMessageHintPrefix")," ",(0,a.jsx)("strong",{children:o[u]?.label})," ",e("chatMessageHintSuffix")]})]}),w.map((t,s)=>(0,a.jsx)("div",{className:`flex ${"user"===t.role?"justify-end":"justify-start"}`,children:(0,a.jsxs)("div",{className:`max-w-[85%] rounded-lg px-3 py-2 text-sm ${"user"===t.role?"bg-primary/10 text-text-main border border-primary/20":"bg-bg-subtle text-text-main border border-border"}`,children:[(0,a.jsx)("p",{className:"text-[10px] font-semibold text-text-muted mb-1 uppercase",children:"user"===t.role?e("youWithFormat",{format:o[u]?.label}):e("assistant")}),(0,a.jsx)("p",{className:"whitespace-pre-wrap break-words",children:t.content})]})},s)),(0,a.jsx)("div",{ref:T})]}),(0,a.jsx)("div",{className:"p-3 border-t border-border",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:j,onChange:e=>y(e.target.value),onKeyDown:e=>"Enter"===e.key&&!e.shiftKey&&D(),placeholder:e("typeMessage"),className:"flex-1 bg-bg-subtle border border-border rounded-lg px-3 py-2 text-sm text-text-main placeholder:text-text-muted focus:outline-none focus:border-primary transition-colors",disabled:v}),(0,a.jsx)(n.$n,{icon:"send",onClick:D,loading:v,disabled:!j.trim()||v,children:e("send")})]})})]})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(n.Zp,{children:(0,a.jsxs)("div",{className:"p-4 space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary",children:"account_tree"}),(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:e("translationPipeline")})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:e("clickStepToInspect")})]})}),S?(0,a.jsx)("div",{className:"space-y-2",children:S.map((e,t)=>{let s=o[e.format]||{label:e.format,color:"gray",icon:"code"},r=C===e.id;return(0,a.jsxs)("div",{children:[t>0&&(0,a.jsx)("div",{className:"flex justify-center py-1",children:(0,a.jsx)("div",{className:"w-px h-4 bg-border"})}),(0,a.jsxs)(n.Zp,{className:"error"===e.status?"border-red-500/30":r?"border-primary/30":"",children:[(0,a.jsxs)("button",{onClick:()=>O(r?null:e.id),className:"w-full p-3 flex items-center gap-3 text-left",children:[(0,a.jsx)("div",{className:`flex items-center justify-center w-7 h-7 rounded-full text-xs font-bold ${"error"===e.status?"bg-red-500/10 text-red-500":"done"===e.status?`bg-${s.color}-500/10 text-${s.color}-500`:"bg-bg-subtle text-text-muted"}`,children:"error"===e.status?"!":e.id}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-text-main",children:e.name}),e.description&&(0,a.jsx)("p",{className:"text-[10px] text-text-muted truncate",children:e.description})]}),(0,a.jsx)(n.Ex,{variant:"error"===e.status?"error":"default",size:"sm",children:s.label}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:r?"expand_less":"expand_more"})]}),r&&(0,a.jsx)("div",{className:"px-3 pb-3",children:(0,a.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:(0,a.jsx)(f,{height:"250px",defaultLanguage:"json",value:e.content,theme:"vs-dark",options:{minimap:{enabled:!1},fontSize:11,lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,readOnly:!0}})})})]})]},e.id)})}):(0,a.jsx)(n.Zp,{children:(0,a.jsxs)("div",{className:"p-8 flex flex-col items-center justify-center text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[48px] mb-3 opacity-30",children:"account_tree"}),(0,a.jsx)("p",{className:"text-sm font-medium mb-1",children:e("pipelineVisualization")}),(0,a.jsx)("p",{className:"text-xs text-center max-w-xs",children:e("pipelineVisualizationHint")})]})})]})]})]})}let y=[{id:"simple-chat",icon:"chat",templateId:"simple-chat"},{id:"tool-calling",icon:"build",templateId:"tool-calling"},{id:"multi-turn",icon:"forum",templateId:"multi-turn"},{id:"thinking",icon:"psychology",templateId:"thinking"},{id:"system-prompt",icon:"settings",templateId:"system-prompt"},{id:"streaming",icon:"stream",templateId:"streaming"}];function v(){let e=(0,r.c)("translator"),t={"simple-chat":e("scenarioSimpleChat"),"tool-calling":e("scenarioToolCalling"),"multi-turn":e("scenarioMultiTurn"),thinking:e("scenarioThinking"),"system-prompt":e("scenarioSystemPrompt"),streaming:e("scenarioStreaming")},s=(0,l.useMemo)(()=>i(e),[e]),[d,m]=(0,l.useState)("claude"),{provider:x,setProvider:p,providerOptions:u}=h("openai"),{model:g,setModel:f,availableModels:j,pickModelForFormat:v}=b(),[N,w]=(0,l.useState)({}),[k,S]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=v(d);e&&f(e)},[d,v,f]);let _=async t=>{w(e=>({...e,[t.id]:{status:"running"}}));let a=Date.now();try{let r=s.find(e=>e.id===t.templateId),l=r?.formats[d]||r?.formats.openai;if(!l)return void w(s=>({...s,[t.id]:{status:"error",error:e("noTemplateForFormat"),latency:0}}));let n={...l,model:g};l.contents&&(n.model=g);let i=await fetch("/api/translator/translate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step:"direct",sourceFormat:d,provider:x,body:n})}),o=await i.json();if(!o.success)return void w(s=>({...s,[t.id]:{status:"error",error:e("translationFailed",{error:o.error}),latency:Date.now()-a}}));let c=await fetch("/api/translator/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:x,body:o.result})}),m=Date.now()-a;if(!c.ok){let s=await c.json().catch(()=>({}));w(a=>({...a,[t.id]:{status:"error",error:s.error||e("errorMessage",{message:`HTTP ${c.status}`}),latency:m,httpStatus:c.status}}));return}let p=c.body.getReader(),u=0;for(;;){let{done:e}=await p.read();if(e)break;u++}w(e=>({...e,[t.id]:{status:"pass",latency:Date.now()-a,chunks:u}}))}catch(e){w(s=>({...s,[t.id]:{status:"error",error:e.message,latency:Date.now()-a}}))}},C=async()=>{for(let e of(S(!0),w({}),y))await _(e);S(!1)},O=Object.values(N).filter(e=>"pass"===e.status).length,T=Object.values(N).filter(e=>"error"===e.status).length,P=O+T,D=P>0?Math.round(O/P*100):0,E=o[d]||o.openai;return(0,a.jsxs)("div",{className:"space-y-5 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 rounded-lg bg-primary/5 border border-primary/10 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px] mt-0.5 shrink-0",children:"info"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-text-main mb-0.5",children:e("compatibilityTester")}),(0,a.jsx)("p",{children:e("testBenchDescription")})]})]}),(0,a.jsx)(n.Zp,{children:(0,a.jsxs)("div",{className:"p-4 flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row items-end gap-4 min-w-0",children:[(0,a.jsxs)("div",{className:"flex-1 w-full",children:[(0,a.jsx)("label",{className:"block text-xs font-medium text-text-muted mb-1.5 uppercase tracking-wider",children:e("source")}),(0,a.jsx)(n.l6,{value:d,onChange:e=>{m(e.target.value),w({})},options:c.filter(e=>["openai","claude","gemini","openai-responses"].includes(e.value))})]}),(0,a.jsx)("div",{className:"flex items-center justify-center px-2",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[22px] text-text-muted",children:"arrow_forward"})}),(0,a.jsxs)("div",{className:"flex-1 w-full",children:[(0,a.jsx)("label",{className:"block text-xs font-medium text-text-muted mb-1.5 uppercase tracking-wider",children:e("targetProvider")}),(0,a.jsx)(n.l6,{value:x,onChange:e=>{p(e.target.value),w({})},options:u})]}),(0,a.jsx)(n.$n,{icon:"play_arrow",onClick:C,loading:k,disabled:k,className:"w-full sm:w-auto",children:e("runAllTests")})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs font-medium text-text-muted mb-1.5 uppercase tracking-wider",children:e("model")}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{type:"text",value:g,onChange:e=>f(e.target.value),list:"testbench-model-suggestions",placeholder:e("modelPlaceholder"),className:"w-full bg-bg-subtle border border-border rounded-lg px-3 py-2 text-sm text-text-main placeholder:text-text-muted focus:outline-none focus:border-primary transition-colors"}),(0,a.jsx)("datalist",{id:"testbench-model-suggestions",children:j.map(e=>(0,a.jsx)("option",{value:e},e))})]})]})]})}),P>0&&(0,a.jsx)(n.Zp,{children:(0,a.jsxs)("div",{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:e("compatibilityReport")}),(0,a.jsxs)(n.Ex,{variant:D>=80?"success":D>=50?"warning":"error",size:"lg",children:[D,"%"]})]}),(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"})," ",O," ",e("passed")]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"size-2 rounded-full bg-red-500"})," ",T," ",e("failed")]})]})]}),(0,a.jsx)("div",{className:"w-full h-2 bg-bg-subtle rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:"h-full bg-gradient-to-r from-green-500 to-emerald-400 rounded-full transition-all duration-500",style:{width:`${D}%`}})})]})}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:y.map(s=>{let r=N[s.id],l=r?.status==="running";return(0,a.jsx)(n.Zp,{className:`transition-all ${r?.status==="pass"?"border-green-500/30":r?.status==="error"?"border-red-500/30":""}`,children:(0,a.jsxs)("div",{className:"p-4 space-y-3",children:[(0,a.jsx)("div",{className:"flex items-center justify-between",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:`flex items-center justify-center w-9 h-9 rounded-lg ${r?.status==="pass"?"bg-green-500/10 text-green-500":r?.status==="error"?"bg-red-500/10 text-red-500":"bg-bg-subtle text-text-muted"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:l?"progress_activity":r?.status==="pass"?"check_circle":r?.status==="error"?"error":s.icon})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium text-text-main",children:t[s.id]||s.id}),(0,a.jsxs)("p",{className:"text-[10px] text-text-muted uppercase",children:[E.label," →"," ",u.find(e=>e.value===x)?.label||x]})]})]})}),r&&"running"!==r.status&&(0,a.jsx)("div",{className:`rounded-lg p-2 text-xs ${"pass"===r.status?"bg-green-500/5 text-green-600 dark:text-green-400":"bg-red-500/5 text-red-600 dark:text-red-400"}`,children:"pass"===r.status?(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{children:e("passedIconLabel")}),(0,a.jsxs)("span",{className:"text-text-muted",children:[r.latency,"ms • ",r.chunks," ",e("chunks")]})]}):(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{children:["❌ ",r.error]}),(0,a.jsxs)("p",{className:"text-text-muted mt-0.5",children:[r.latency,"ms"]})]})}),(0,a.jsx)(n.$n,{size:"sm",variant:r?.status==="pass"?"ghost":"outline",icon:l?"progress_activity":"play_arrow",onClick:()=>_(s),disabled:l||k,className:"w-full",children:l?e("running"):r?e("reRun"):e("runTest")})]})},s.id)})})]})}function N(){let e=(0,r.c)("translator"),t=(0,r.c)("common"),[s,i]=(0,l.useState)([]),[c,d]=(0,l.useState)(!0),[m,x]=(0,l.useState)(!0),p=(0,l.useRef)(null),u=e("notAvailableSymbol"),h=t=>e("millisecondsShort",{value:t}),g=async()=>{try{let e=await fetch("/api/translator/history?limit=50");if(e.ok){let t=await e.json();i(t.events||[])}}catch{}finally{d(!1)}};(0,l.useEffect)(()=>(g(),m&&(p.current=setInterval(g,3e3)),()=>{p.current&&clearInterval(p.current)}),[m]);let b=s.filter(e=>"success"===e.status).length,f=s.filter(e=>"error"===e.status).length,j=s.length>0?Math.round(s.reduce((e,t)=>e+(t.latency||0),0)/s.length):0;return(0,a.jsxs)("div",{className:"space-y-5 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 rounded-lg bg-primary/5 border border-primary/10 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px] mt-0.5 shrink-0","aria-hidden":"true",children:"info"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-text-main mb-0.5",children:e("realtime")}),(0,a.jsxs)("p",{children:[e("liveMonitorDescriptionPrefix")," ",(0,a.jsx)("strong",{className:"text-text-main",children:e("chatTester")}),","," ",(0,a.jsx)("strong",{className:"text-text-main",children:e("testBench")}),e("liveMonitorDescriptionSuffix")]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[(0,a.jsx)(w,{icon:"translate",label:e("totalTranslations"),value:s.length,color:"blue"}),(0,a.jsx)(w,{icon:"check_circle",label:e("successful"),value:b,color:"green"}),(0,a.jsx)(w,{icon:"error",label:e("errors"),value:f,color:"red"}),(0,a.jsx)(w,{icon:"speed",label:e("avgLatency"),value:h(j),color:"purple"})]}),(0,a.jsx)(n.Zp,{children:(0,a.jsxs)("div",{className:"p-3 flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] ${m?"text-green-500 animate-pulse":"text-text-muted"}`,"aria-hidden":"true",children:m?"radio_button_checked":"radio_button_unchecked"}),(0,a.jsx)("button",{onClick:()=>x(!m),className:"text-sm text-text-main hover:text-primary transition-colors",children:m?e("liveAutoRefreshing"):e("paused")})]}),(0,a.jsxs)("button",{onClick:g,className:"flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"refresh"}),t("refresh")]})]})}),(0,a.jsx)(n.Zp,{children:(0,a.jsxs)("div",{className:"p-4",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:e("recentTranslations")}),c?(0,a.jsxs)("div",{className:"flex items-center justify-center py-12 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin mr-2","aria-hidden":"true",children:"progress_activity"}),t("loading")]}):0===s.length?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[48px] mb-3 opacity-30","aria-hidden":"true",children:"monitoring"}),(0,a.jsx)("p",{className:"text-sm font-medium mb-1",children:e("noTranslations")}),(0,a.jsx)("p",{className:"text-xs text-center max-w-sm",children:e("eventsAppearHint")}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 mt-3 text-xs",children:[(0,a.jsx)("span",{className:"px-2 py-1 rounded-md bg-bg-subtle border border-border",children:e("chatTesterTab")}),(0,a.jsx)("span",{className:"px-2 py-1 rounded-md bg-bg-subtle border border-border",children:e("testBenchTab")}),(0,a.jsx)("span",{className:"px-2 py-1 rounded-md bg-bg-subtle border border-border",children:e("externalApiCalls")}),(0,a.jsx)("span",{className:"px-2 py-1 rounded-md bg-bg-subtle border border-border",children:e("ideCliIntegrations")})]}),(0,a.jsx)("p",{className:"text-[10px] mt-3 text-text-muted/70",children:e("inMemoryNote")})]}):(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:"text-left text-xs text-text-muted border-b border-border",children:[(0,a.jsx)("th",{className:"pb-2 pr-4",children:e("time")}),(0,a.jsx)("th",{className:"pb-2 pr-4",children:e("source")}),(0,a.jsx)("th",{className:"pb-2 pr-4"}),(0,a.jsx)("th",{className:"pb-2 pr-4",children:e("target")}),(0,a.jsx)("th",{className:"pb-2 pr-4",children:e("model")}),(0,a.jsx)("th",{className:"pb-2 pr-4",children:e("status")}),(0,a.jsx)("th",{className:"pb-2 text-right",children:e("latency")})]})}),(0,a.jsx)("tbody",{children:s.map((t,s)=>{let r=o[t.sourceFormat]||{label:t.sourceFormat||"?",color:"gray"},l=o[t.targetFormat]||{label:t.targetFormat||"?",color:"gray"};return(0,a.jsxs)("tr",{className:"border-b border-border/50 hover:bg-bg-subtle/50 transition-colors",children:[(0,a.jsx)("td",{className:"py-2 pr-4 text-xs text-text-muted whitespace-nowrap",children:t.timestamp?new Date(t.timestamp).toLocaleTimeString():u}),(0,a.jsx)("td",{className:"py-2 pr-4",children:(0,a.jsx)(n.Ex,{variant:"default",size:"sm",children:r.label})}),(0,a.jsx)("td",{className:"py-2 pr-4 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]","aria-hidden":"true",children:"arrow_forward"})}),(0,a.jsx)("td",{className:"py-2 pr-4",children:(0,a.jsx)(n.Ex,{variant:"primary",size:"sm",children:l.label})}),(0,a.jsx)("td",{className:"py-2 pr-4 text-xs font-mono text-text-muted break-all",children:t.model||u}),(0,a.jsx)("td",{className:"py-2 pr-4",children:"success"===t.status?(0,a.jsx)(n.Ex,{variant:"success",size:"sm",dot:!0,children:e("ok")}):(0,a.jsx)(n.Ex,{variant:"error",size:"sm",dot:!0,children:t.statusCode||e("errorShort")})}),(0,a.jsx)("td",{className:"py-2 text-right text-xs text-text-muted",children:t.latency?h(t.latency):u})]},t.id||s)})})]})})]})})]})}function w({icon:e,label:t,value:s,color:r}){return(0,a.jsx)(n.Zp,{children:(0,a.jsxs)("div",{className:"p-4 flex items-center gap-3",children:[(0,a.jsx)("div",{className:`flex items-center justify-center w-10 h-10 rounded-lg bg-${r}-500/10`,children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[22px] text-${r}-500`,"aria-hidden":"true",children:e})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-lg font-bold text-text-main",children:s}),(0,a.jsx)("p",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:t})]})]})})}function k(){let e=(0,r.c)("translator"),[t,s]=(0,l.useState)("playground"),i=[{value:"playground",label:e("playground"),icon:"code"},{value:"chat-tester",label:e("chatTester"),icon:"chat"},{value:"test-bench",label:e("testBench"),icon:"science"},{value:"live-monitor",label:e("liveMonitor"),icon:"monitoring"}],o={playground:e("modeDescriptionPlayground"),"chat-tester":e("modeDescriptionChatTester"),"test-bench":e("modeDescriptionTestBench"),"live-monitor":e("modeDescriptionLiveMonitor")};return(0,a.jsxs)("div",{className:"p-4 sm:p-8 space-y-6 min-w-0",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 min-w-0",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("h1",{className:"text-2xl font-bold text-text-main flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[28px]",children:"translate"}),e("playgroundTitle")]}),(0,a.jsx)("p",{className:"text-sm text-text-muted mt-1",children:o[t]||e("modeDescriptionFallback")})]}),(0,a.jsx)("div",{className:"w-full sm:w-auto overflow-x-auto",children:(0,a.jsx)(n.Iz,{options:i,value:t,onChange:s,size:"md",className:"min-w-max"})})]}),"playground"===t&&(0,a.jsx)(p,{}),"chat-tester"===t&&(0,a.jsx)(j,{}),"test-bench"===t&&(0,a.jsx)(v,{}),"live-monitor"===t&&(0,a.jsx)(N,{})]})}},5214:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorage",{enumerable:!0,get:function(){return a.workAsyncStorageInstance}});let a=s(17828)},17828:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return a}});let a=(0,s(64054).createAsyncLocalStorage)()},21957:(e,t,s)=>{"use strict";function a({moduleIds:e}){return null}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return a}}),s(95155),s(47650),s(5214),s(2451),s(53887)},41112:(e,t,s)=>{"use strict";function a({reason:e,children:t}){return t}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return a}}),s(1980)},64054:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s={bindSnapshot:function(){return o},createAsyncLocalStorage:function(){return i},createSnapshot:function(){return c}};for(var a in s)Object.defineProperty(t,a,{enumerable:!0,get:s[a]});let r=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class l{disable(){throw r}getStore(){}run(){throw r}exit(){throw r}enterWith(){throw r}static bind(e){return e}}let n="u">typeof globalThis&&globalThis.AsyncLocalStorage;function i(){return n?new n:new l}function o(e){return n?n.bind(e):l.bind(e)}function c(){return n?n.snapshot():function(e,...t){return e(...t)}}},65355:(e,t,s)=>{Promise.resolve().then(s.bind(s,2824))},68635:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return o}});let a=s(95155),r=s(12115),l=s(41112);function n(e){return{default:e&&"default"in e?e.default:e}}s(21957);let i={loader:()=>Promise.resolve(n(()=>null)),loading:null,ssr:!0},o=function(e){let t={...i,...e},s=(0,r.lazy)(()=>t.loader().then(n)),o=t.loading;function c(e){let n=o?(0,a.jsx)(o,{isLoading:!0,pastDelay:!0,error:null}):null,i=!t.ssr||!!t.loading,c=i?r.Suspense:r.Fragment,d=t.ssr?(0,a.jsxs)(a.Fragment,{children:[null,(0,a.jsx)(s,{...e})]}):(0,a.jsx)(l.BailoutToCSR,{reason:"next/dynamic",children:(0,a.jsx)(s,{...e})});return(0,a.jsx)(c,{...i?{fallback:n}:{},children:d})}return c.displayName="LoadableComponent",c}},75707:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return r}});let a=s(73623)._(s(68635));function r(e,t){let s={};"function"==typeof e&&(s.loader=e);let r={...s,...t};return(0,a.default)({...r,modules:r.loadableGenerated?.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)}},e=>{e.O(0,[3418,8500,9751,8055,1149,5846,993,8441,3794,7358],()=>e(e.s=65355)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2825],{39608:(e,l,s)=>{Promise.resolve().then(s.bind(s,97449))},97449:(e,l,s)=>{"use strict";s.r(l),s.d(l,{default:()=>n});var a=s(95155),o=s(50910),r=s(12115),u=s(40993);function n(){let e=(0,o.c)("usage"),[l,s]=(0,r.useState)("logs");return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(u.Iz,{options:[{value:"logs",label:e("loggerTab")},{value:"proxy-logs",label:e("proxyTab")}],value:l,onChange:s}),"logs"===l&&(0,a.jsx)(u.y7,{}),"proxy-logs"===l&&(0,a.jsx)(u.Lo,{})]})}}},e=>{e.O(0,[3418,8500,9751,8055,1149,5846,993,8441,3794,7358],()=>e(e.s=39608)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9305],{69436:(e,s,n)=>{Promise.resolve().then(n.bind(n,17705)),Promise.resolve().then(n.bind(n,80927)),Promise.resolve().then(n.bind(n,76332)),Promise.resolve().then(n.bind(n,35806)),Promise.resolve().then(n.bind(n,81060)),Promise.resolve().then(n.bind(n,54128)),Promise.resolve().then(n.bind(n,71689)),Promise.resolve().then(n.bind(n,44638)),Promise.resolve().then(n.bind(n,66200)),Promise.resolve().then(n.bind(n,51503)),Promise.resolve().then(n.bind(n,99023)),Promise.resolve().then(n.bind(n,89938)),Promise.resolve().then(n.bind(n,34422)),Promise.resolve().then(n.bind(n,1652)),Promise.resolve().then(n.bind(n,92701)),Promise.resolve().then(n.bind(n,18150)),Promise.resolve().then(n.bind(n,97050)),Promise.resolve().then(n.bind(n,21720)),Promise.resolve().then(n.bind(n,92542)),Promise.resolve().then(n.bind(n,91961)),Promise.resolve().then(n.bind(n,71361)),Promise.resolve().then(n.bind(n,85444)),Promise.resolve().then(n.bind(n,61580)),Promise.resolve().then(n.bind(n,80178)),Promise.resolve().then(n.bind(n,48643)),Promise.resolve().then(n.bind(n,8287)),Promise.resolve().then(n.bind(n,37415)),Promise.resolve().then(n.bind(n,33709)),Promise.resolve().then(n.bind(n,42994)),Promise.resolve().then(n.bind(n,34243)),Promise.resolve().then(n.bind(n,55846)),Promise.resolve().then(n.bind(n,6261)),Promise.resolve().then(n.bind(n,19790)),Promise.resolve().then(n.bind(n,45624)),Promise.resolve().then(n.bind(n,25112))}},e=>{e.O(0,[3418,8500,9751,782,6458,5846,993,8441,3794,7358],()=>e(e.s=69436)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9305],{69436:(e,s,n)=>{Promise.resolve().then(n.bind(n,17705)),Promise.resolve().then(n.bind(n,80927)),Promise.resolve().then(n.bind(n,76332)),Promise.resolve().then(n.bind(n,35806)),Promise.resolve().then(n.bind(n,81060)),Promise.resolve().then(n.bind(n,54128)),Promise.resolve().then(n.bind(n,71689)),Promise.resolve().then(n.bind(n,44638)),Promise.resolve().then(n.bind(n,66200)),Promise.resolve().then(n.bind(n,51503)),Promise.resolve().then(n.bind(n,99023)),Promise.resolve().then(n.bind(n,89938)),Promise.resolve().then(n.bind(n,34422)),Promise.resolve().then(n.bind(n,1652)),Promise.resolve().then(n.bind(n,92701)),Promise.resolve().then(n.bind(n,18150)),Promise.resolve().then(n.bind(n,97050)),Promise.resolve().then(n.bind(n,21720)),Promise.resolve().then(n.bind(n,92542)),Promise.resolve().then(n.bind(n,91961)),Promise.resolve().then(n.bind(n,71361)),Promise.resolve().then(n.bind(n,85444)),Promise.resolve().then(n.bind(n,61580)),Promise.resolve().then(n.bind(n,80178)),Promise.resolve().then(n.bind(n,48643)),Promise.resolve().then(n.bind(n,8287)),Promise.resolve().then(n.bind(n,37415)),Promise.resolve().then(n.bind(n,33709)),Promise.resolve().then(n.bind(n,42994)),Promise.resolve().then(n.bind(n,34243)),Promise.resolve().then(n.bind(n,55846)),Promise.resolve().then(n.bind(n,6261)),Promise.resolve().then(n.bind(n,19790)),Promise.resolve().then(n.bind(n,45624)),Promise.resolve().then(n.bind(n,25112))}},e=>{e.O(0,[3418,8500,9751,8055,1149,5846,993,8441,3794,7358],()=>e(e.s=69436)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7852],{44037:(e,s,t)=>{Promise.resolve().then(t.bind(t,62308))},50910:(e,s,t)=>{"use strict";t.d(s,{c:()=>l});var a=t(33418);function r(e,s){return(...e)=>{try{return s(...e)}catch{throw Error(void 0)}}}let l=r(0,a.c3);r(0,a.kc)},62308:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>i});var a=t(95155),r=t(50910),l=t(12115),n=t(73321);function c(){let e=(0,n.useSearchParams)(),[s,t]=(0,l.useState)("processing"),c=(0,r.c)("auth");return(0,l.useEffect)(()=>{let s=e.get("code"),a=e.get("state"),r=e.get("error"),l={code:s,state:a,error:r,errorDescription:e.get("error_description"),fullUrl:window.location.href},n=!1;if(window.location.origin,window.opener)try{window.opener.postMessage({type:"oauth_callback",data:l},"*"),n=!0}catch(e){console.log("postMessage failed:",e)}try{let e=new BroadcastChannel("oauth_callback");e.postMessage(l),e.close(),n=!0}catch(e){console.log("BroadcastChannel failed:",e)}try{localStorage.setItem("oauth_callback",JSON.stringify({...l,timestamp:Date.now()})),n=!0}catch(e){console.log("localStorage failed:",e)}n&&(s||r)?setTimeout(()=>{window.opener?(t("success"),setTimeout(()=>{window.close(),setTimeout(()=>t("done"),500)},1500)):t("done")},0):setTimeout(()=>t("manual"),0)},[e]),(0,a.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-bg",children:(0,a.jsxs)("div",{className:"text-center p-8 max-w-md",children:["processing"===s&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,a.jsx)("h1",{className:"text-xl font-semibold mb-2",children:c("processing")}),(0,a.jsx)("p",{className:"text-text-muted",children:c("pleaseWait")})]}),("success"===s||"done"===s)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,a.jsx)("h1",{className:"text-xl font-semibold mb-2",children:c("authSuccess")}),(0,a.jsx)("p",{className:"text-text-muted",children:c("success"===s?"windowWillClose":"closeTabNow")})]}),"manual"===s&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-yellow-100 dark:bg-yellow-900/30 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-yellow-600",children:"info"})}),(0,a.jsx)("h1",{className:"text-xl font-semibold mb-2",children:c("copyUrl")}),(0,a.jsx)("p",{className:"text-text-muted mb-4",children:c("copyUrlManual")}),(0,a.jsx)("div",{className:"bg-surface border border-border rounded-lg p-3 text-left",children:(0,a.jsx)("code",{className:"text-xs break-all",children:window.location.href})})]})]})})}function i(){let e=(0,r.c)("auth");return(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-bg",children:(0,a.jsxs)("div",{className:"text-center p-8",children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,a.jsx)("p",{className:"text-text-muted",children:e("loading")})]})}),children:(0,a.jsx)(c,{})})}},73321:(e,s,t)=>{"use strict";var a=t(74645);t.o(a,"useParams")&&t.d(s,{useParams:function(){return a.useParams}}),t.o(a,"usePathname")&&t.d(s,{usePathname:function(){return a.usePathname}}),t.o(a,"useRouter")&&t.d(s,{useRouter:function(){return a.useRouter}}),t.o(a,"useSearchParams")&&t.d(s,{useSearchParams:function(){return a.useSearchParams}})}},e=>{e.O(0,[3418,8441,3794,7358],()=>e(e.s=44037)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7066,9040,9877],{16680:(e,r,s)=>{Promise.resolve().then(s.bind(s,91930)),Promise.resolve().then(s.t.bind(s,98500,23))},91930:(e,r,s)=>{"use strict";s.d(r,{default:()=>n});var o=s(33418),l=s(95155);function n({locale:e,...r}){if(!e)throw Error(void 0);return(0,l.jsx)(o.Dk,{locale:e,...r})}}},e=>{e.O(0,[3418,8500,8441,3794,7358],()=>e(e.s=16680)),_N_E=e.O()}]);