67router 1.0.7 → 1.0.13

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 (244) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +5 -5
  3. package/app/.next-cli-build/build-manifest.json +3 -3
  4. package/app/.next-cli-build/prerender-manifest.json +17 -17
  5. package/app/.next-cli-build/react-loadable-manifest.json +2 -2
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +3 -3
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  37. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  38. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  39. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  40. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  41. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  42. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  43. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  44. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  45. package/app/.next-cli-build/server/app/_not-found.rsc +9 -9
  46. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +9 -9
  47. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +9 -9
  48. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  49. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  50. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  51. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  52. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  53. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  54. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  55. package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  56. package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  57. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js +1 -1
  58. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  59. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  60. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  61. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  62. package/app/.next-cli-build/server/app/callback.html +1 -1
  63. package/app/.next-cli-build/server/app/callback.rsc +9 -9
  64. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +9 -9
  65. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  66. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +9 -9
  67. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  68. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +12 -12
  69. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +12 -12
  70. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +12 -12
  71. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
  72. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  73. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +12 -12
  74. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +12 -12
  75. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +12 -12
  76. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  77. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  78. package/app/.next-cli-build/server/app/dashboard/combos.rsc +12 -12
  79. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +12 -12
  80. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +12 -12
  81. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  82. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  83. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +13 -13
  84. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +13 -13
  85. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +13 -13
  86. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  87. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  88. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +12 -12
  89. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +12 -12
  90. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +12 -12
  91. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
  92. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  93. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +12 -12
  94. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +12 -12
  95. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +12 -12
  96. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  97. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  98. package/app/.next-cli-build/server/app/dashboard/profile.rsc +12 -12
  99. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +12 -12
  100. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +12 -12
  101. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  102. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  103. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +12 -12
  104. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +12 -12
  105. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +12 -12
  106. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  107. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  108. package/app/.next-cli-build/server/app/dashboard/providers.rsc +12 -12
  109. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +12 -12
  110. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +12 -12
  111. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  112. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  113. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +12 -12
  114. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +12 -12
  115. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +12 -12
  116. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  117. package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  118. package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +12 -12
  119. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +12 -12
  120. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +12 -12
  121. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +2 -2
  122. package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
  123. package/app/.next-cli-build/server/app/dashboard/quota.rsc +13 -13
  124. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +13 -13
  125. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +13 -13
  126. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  127. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  128. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  129. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +9 -9
  130. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +9 -9
  131. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  132. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +9 -9
  133. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  134. package/app/.next-cli-build/server/app/dashboard/skills.rsc +12 -12
  135. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +12 -12
  136. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +12 -12
  137. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
  138. package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  139. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +12 -12
  140. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +12 -12
  141. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +12 -12
  142. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +2 -2
  143. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  144. package/app/.next-cli-build/server/app/dashboard/translator.rsc +12 -12
  145. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +12 -12
  146. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +12 -12
  147. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  148. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  149. package/app/.next-cli-build/server/app/dashboard/usage.rsc +13 -13
  150. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +13 -13
  151. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +13 -13
  152. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  153. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  154. package/app/.next-cli-build/server/app/dashboard.rsc +13 -13
  155. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +13 -13
  156. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +13 -13
  157. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  158. package/app/.next-cli-build/server/app/index.html +1 -1
  159. package/app/.next-cli-build/server/app/index.rsc +9 -9
  160. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +9 -9
  161. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +9 -9
  162. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  163. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  164. package/app/.next-cli-build/server/app/landing.html +1 -1
  165. package/app/.next-cli-build/server/app/landing.rsc +9 -9
  166. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +9 -9
  167. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
  168. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +9 -9
  169. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  170. package/app/.next-cli-build/server/app/login.html +1 -1
  171. package/app/.next-cli-build/server/app/login.rsc +11 -11
  172. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +11 -11
  173. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
  174. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +11 -11
  175. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  176. package/app/.next-cli-build/server/app-paths-manifest.json +5 -5
  177. package/app/.next-cli-build/server/chunks/412.js +2 -2
  178. package/app/.next-cli-build/server/chunks/5500.js +1 -1
  179. package/app/.next-cli-build/server/chunks/5946.js +6 -6
  180. package/app/.next-cli-build/server/chunks/6540.js +1 -1
  181. package/app/.next-cli-build/server/chunks/7037.js +1 -1
  182. package/app/.next-cli-build/server/chunks/7066.js +1 -1
  183. package/app/.next-cli-build/server/chunks/827.js +1 -1
  184. package/app/.next-cli-build/server/chunks/869.js +1 -1
  185. package/app/.next-cli-build/server/chunks/9604.js +1 -1
  186. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  187. package/app/.next-cli-build/server/middleware-react-loadable-manifest.js +1 -1
  188. package/app/.next-cli-build/server/pages/404.html +1 -1
  189. package/app/.next-cli-build/server/pages/500.html +1 -1
  190. package/app/.next-cli-build/static/chunks/2694-e38089f3fbc4f795.js +18 -0
  191. package/app/.next-cli-build/static/chunks/5497-424fa4c770985a02.js +7 -0
  192. package/app/.next-cli-build/static/chunks/5524.a4e52491e3114015.js +1 -0
  193. package/app/.next-cli-build/static/chunks/6808-54de8b855aaccfa4.js +1 -0
  194. package/app/.next-cli-build/static/chunks/7309-733bb48477dcf18e.js +1 -0
  195. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/basic-chat/{page-5a39e2c930083958.js → page-11398bffb8f731d6.js} +1 -1
  196. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-efa13471ca90cb6f.js → page-4b6f03d26918f2c8.js} +1 -1
  197. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/page-1b13e2f309dace52.js +1 -0
  198. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-52812c2f1eec1542.js +1 -0
  199. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/{page-4533d3729d0f3d2f.js → page-3f9ff52f7de3d5ce.js} +1 -1
  200. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/page-fb985695b0a7fece.js +1 -0
  201. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-99efb86d0bd7063d.js → page-cc18e2e55c9fc034.js} +1 -1
  202. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/{page-34a9de93009415b2.js → page-98408a15a31af09e.js} +1 -1
  203. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/page-259a9fbcb19b32bb.js +4 -0
  204. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/web/{page-e49129de51260b20.js → page-be260619b6663f68.js} +1 -1
  205. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/mitm/{page-0527ed7a1e5796d2.js → page-eb32542bad219188.js} +1 -1
  206. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/page-1f58f279da3d1d2e.js +1 -0
  207. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/page-e293bc909c375fda.js +1 -0
  208. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-4af847c5b1581140.js +27 -0
  209. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/new/{page-8c4efaab91f7315d.js → page-64c2ea1d68752a95.js} +1 -1
  210. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-4598bf7897896efe.js +1 -0
  211. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-e104456d4f92f5d7.js +4 -0
  212. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/pxpipe/{page-0d4b8225aa2a0570.js → page-90866408d05de0ea.js} +1 -1
  213. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/{page-c2e6b6ae60d66ee6.js → page-3f4373ff4d41429d.js} +1 -1
  214. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/{page-44136b54dd60ab1a.js → page-d30a8e3bcd1739fe.js} +1 -1
  215. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/token-saver/{page-4b073ba7273cde14.js → page-2d72a14feff46003.js} +1 -1
  216. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/translator/{page-9219cd8e2828aeb2.js → page-0aac17733e26291b.js} +1 -1
  217. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-f30d37a1c0a41094.js +1 -0
  218. package/app/.next-cli-build/static/chunks/app/(dashboard)/{layout-85b42e3587cdd780.js → layout-e2a9c08e575d5fb1.js} +1 -1
  219. package/app/.next-cli-build/static/chunks/app/{layout-53a33c2d919bd8e4.js → layout-6693e2013812704c.js} +1 -1
  220. package/app/.next-cli-build/static/chunks/app/login/{page-8c450d820c6b4a84.js → page-424bb7b9a4fadbef.js} +1 -1
  221. package/app/.next-cli-build/static/chunks/{webpack-396894770603fee1.js → webpack-5f3126bff1640c83.js} +1 -1
  222. package/app/.next-cli-build/static/css/9ade909ac2a94202.css +1 -0
  223. package/app/cli/.build-home/AppData/Roaming/67router/db/data.sqlite-shm +0 -0
  224. package/app/cli/.build-home/AppData/Roaming/67router/db/data.sqlite-wal +0 -0
  225. package/app/package.json +1 -1
  226. package/package.json +1 -1
  227. package/app/.next-cli-build/static/chunks/1321-6630b5aa23e3ec0e.js +0 -1
  228. package/app/.next-cli-build/static/chunks/2694-fa4a038c7addaf24.js +0 -18
  229. package/app/.next-cli-build/static/chunks/5497-1681f72f0e82b863.js +0 -7
  230. package/app/.next-cli-build/static/chunks/5524.fca1db6352c39218.js +0 -1
  231. package/app/.next-cli-build/static/chunks/6808-b6550a28721e71e1.js +0 -1
  232. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/page-e8e532618d63f944.js +0 -1
  233. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-dec9bfc425fb3885.js +0 -1
  234. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/page-7bd0715367619619.js +0 -1
  235. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/page-c5ec58d3c27337fa.js +0 -4
  236. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/page-b75f168ba5367af9.js +0 -1
  237. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/page-13b9f3596564691a.js +0 -1
  238. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-3ec2eae580cfd6e9.js +0 -27
  239. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-eafb435acef415a1.js +0 -1
  240. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-d61c6b11bb916a3c.js +0 -4
  241. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-be90b4d4a94a121d.js +0 -1
  242. package/app/.next-cli-build/static/css/2388dd0fafaf8266.css +0 -1
  243. /package/app/.next-cli-build/static/{ZSFfwWCBng6VPk2-0itNU → sKwjEEJfz6HiCKK5ronYO}/_buildManifest.js +0 -0
  244. /package/app/.next-cli-build/static/{ZSFfwWCBng6VPk2-0itNU → sKwjEEJfz6HiCKK5ronYO}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5524],{15524:(e,t,s)=>{s.r(t),s.d(t,{default:()=>o});var a=s(95155),r=s(12115),i=s(14051),n=s.n(i),d=s(88105);let l=(0,s(37206).default)(()=>Promise.all([s.e(2574),s.e(3862),s.e(3842),s.e(6357),s.e(3521)]).then(s.bind(s,63521)),{loadableGenerated:{webpack:()=>[63521]},ssr:!1});function o({providers:e=[],activeRequests:t=[],recentRequests:s=[],byProvider:i={},stats:n={}}){let[c,x]=(0,r.useState)("pipeline"),m=(0,r.useMemo)(()=>s?.[0]?.durationMs?Math.round(s[0].durationMs):21,[s]),p=(0,r.useMemo)(()=>{let e=n?.totalRequests||0;return e>0?`${Math.min(999,Math.max(12,e))} req/min`:"Idle 0 req/m"},[n]),h=(0,r.useMemo)(()=>{let s=(n?.totalPromptTokens||0)+(n?.totalCompletionTokens||0)||1,a=Object.entries(i||{}).map(([e,t])=>{let a=(t.promptTokens||0)+(t.completionTokens||0),r=(0,d.zt)(e)||d.Q2[e],i=r?.name||e,n=Math.round(a/s*100);return{id:e,name:i,requests:t.requests||0,tokens:a,share:Math.max(1,n)}});a.sort((e,t)=>t.tokens-e.tokens||t.requests-e.requests);let r=(e||[]).map(e=>{let t=(0,d.zt)(e.provider)||d.Q2[e.provider];return{id:e.provider,name:t?.name||e.provider,requests:0,tokens:0,share:5}}),l=[...a];for(let e of r)l.some(t=>t.id===e.id)||l.push(e);return 0===l.length?(l.push({id:"antigravity",name:"Antigravity",requests:112,share:92}),l.push({id:"opencode",name:"OpenCode",requests:7,share:6}),l.push({id:"minimax",name:"MiniMax",requests:2,share:2})):1===l.length?(l.push({id:"opencode",name:"OpenCode",requests:0,share:5}),l.push({id:"fallback",name:"Backup Proxy",requests:0,share:1})):2===l.length&&l.push({id:"fallback",name:"Backup Proxy",requests:0,share:1}),l.slice(0,3).map((e,s)=>{let a=0===s||t.some(t=>t.provider?.toLowerCase()===e.id.toLowerCase());return{...e,role:0===s?"Active":1===s?"Standby":"Backup",isActiveRole:a}})},[i,n,e,t]),u=s?.[0]?.durationMs?`${s[0].durationMs} ms`:"184 ms";return(0,a.jsxs)("div",{className:"bg-[#121216] border border-[#23242a] p-6 flex flex-col justify-between shadow-sm h-full",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between border-b border-[#23242a] pb-4 mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg text-[#c5a880]",children:"account_tree"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-[#ededef]",children:"Real-time Model Flow Routing"}),(0,a.jsx)("p",{className:"text-[11px] text-[#9c9ca4]",children:"Multi-provider dynamic load orchestration"})]})]}),(0,a.jsxs)("div",{className:"inline-flex items-center p-0.5 bg-[#181820] border border-[#23242a]",children:[(0,a.jsxs)("button",{onClick:()=>x("pipeline"),className:`px-2.5 py-1 text-xs font-medium transition-colors flex items-center gap-1 ${"pipeline"===c?"bg-[#242430] text-[#c5a880]":"text-[#9c9ca4] hover:text-[#ededef]"}`,title:"Pipeline View (Stitch Design)",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-xs",children:"schema"}),"Flow"]}),(0,a.jsxs)("button",{onClick:()=>x("graph"),className:`px-2.5 py-1 text-xs font-medium transition-colors flex items-center gap-1 ${"graph"===c?"bg-[#242430] text-[#c5a880]":"text-[#9c9ca4] hover:text-[#ededef]"}`,title:"Full Topology Canvas",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-xs",children:"hub"}),"Graph"]})]})]}),"pipeline"===c?(0,a.jsxs)("div",{className:"relative bg-[#0d0d10] border border-[#1d1d23] p-6 my-auto overflow-hidden min-h-[300px] flex items-center justify-center",children:[(0,a.jsx)("div",{className:"absolute inset-0 opacity-20 pointer-events-none",style:{backgroundImage:"radial-gradient(#2d2e38 1px, transparent 1px)",backgroundSize:"16px 16px"}}),(0,a.jsxs)("svg",{className:"absolute inset-0 w-full h-full pointer-events-none",fill:"none",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 600 300",children:[(0,a.jsx)("path",{d:"M120 150 C 180 150, 180 150, 240 150",stroke:"#c5a880",strokeDasharray:"4 4",strokeWidth:"2",children:(0,a.jsx)("animate",{attributeName:"stroke-dashoffset",dur:"1s",from:"8",to:"0",repeatCount:"indefinite"})}),(0,a.jsx)("path",{d:"M360 150 C 420 150, 420 75, 480 75",stroke:"#10b981",strokeWidth:"2.5",children:(0,a.jsx)("animate",{attributeName:"stroke-dashoffset",dur:"1.2s",from:"8",to:"0",repeatCount:"indefinite"})}),(0,a.jsx)("path",{d:"M360 150 C 420 150, 420 150, 480 150",stroke:"#353642",strokeWidth:"1.5"}),(0,a.jsx)("path",{d:"M360 150 C 420 150, 420 225, 480 225",stroke:"#353642",strokeWidth:"1.5"})]}),(0,a.jsxs)("div",{className:"relative z-10 w-full flex items-center justify-between px-2 gap-3",children:[(0,a.jsxs)("div",{className:"bg-[#16161c] border border-[#2b2c36] p-3 shadow-lg flex flex-col items-center gap-1.5 w-28 text-center shrink-0",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base text-[#9c9ca4]",children:"terminal"}),(0,a.jsx)("div",{className:"text-xs font-semibold text-[#ededef]",children:"Client Apps"}),(0,a.jsx)("span",{className:"text-[10px] text-[#9c9ca4] font-mono",children:p})]}),(0,a.jsxs)("div",{className:"bg-gradient-to-b from-[#1c1c24] to-[#14141a] border-2 border-[#c5a880] p-4 shadow-xl shadow-[#c5a880]/10 flex flex-col items-center gap-1 w-36 text-center transform scale-105 shrink-0",children:[(0,a.jsx)("div",{className:"w-9 h-9 bg-[#c5a880]/20 flex items-center justify-center text-[#c5a880] mb-1",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-base",children:"grain"})}),(0,a.jsx)("div",{className:"text-xs font-bold text-[#c5a880] tracking-wide",children:"67Router Hub"}),(0,a.jsxs)("div",{className:"text-[10px] text-[#ededef] font-mono",children:["Latency ~",m,"ms"]}),(0,a.jsx)("div",{className:"mt-1 text-[9px] px-2 py-0.5 bg-[#c5a880]/20 text-[#c5a880] font-semibold uppercase",children:"Adaptive"})]}),(0,a.jsx)("div",{className:"flex flex-col gap-3 w-36 shrink-0",children:h.map((e,t)=>0===t?(0,a.jsxs)("div",{className:"bg-[#161b17] border border-[#10b981]/50 p-2.5 shadow-md flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"text-xs font-bold text-[#ededef] truncate",children:e.name}),(0,a.jsxs)("div",{className:"text-[9px] text-[#10b981] font-mono uppercase tracking-wide",children:[e.role," ",e.share,"%"]})]}),(0,a.jsxs)("span",{className:"text-[10px] font-mono text-[#ededef] bg-[#10b981]/15 px-1.5 py-0.5 shrink-0",children:[e.requests,"r"]})]},e.id):(0,a.jsxs)("div",{className:"bg-[#15151a] border border-[#262630] p-2.5 shadow-sm flex items-center justify-between gap-2 opacity-80",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-[#ededef] truncate",children:e.name}),(0,a.jsxs)("div",{className:"text-[9px] text-[#9c9ca4] font-mono uppercase tracking-wide",children:[e.role," ",e.share,"%"]})]}),(0,a.jsxs)("span",{className:"text-[10px] font-mono text-[#9c9ca4] shrink-0",children:[e.requests,"r"]})]},e.id))})]})]}):(0,a.jsx)("div",{className:"relative bg-[#0d0d10] border border-[#1d1d23] overflow-hidden min-h-[300px] flex items-center justify-center",children:(0,a.jsx)(l,{providers:e,activeRequests:t,lastProvider:s?.[0]?.provider||"",errorProvider:n?.errorProvider||""})}),(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-3 gap-3 pt-4 border-t border-[#23242a]",children:[(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-[#9c9ca4]",children:"Fallback Rate"}),(0,a.jsx)("div",{className:"text-sm font-semibold text-[#ededef] font-mono mt-0.5",children:"0.00%"})]}),(0,a.jsxs)("div",{className:"text-center border-x border-[#23242a]",children:[(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-[#9c9ca4]",children:"P95 Time-to-First-Token"}),(0,a.jsx)("div",{className:"text-sm font-semibold text-[#10b981] font-mono mt-0.5",children:u})]}),(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-[#9c9ca4]",children:"Routing Health"}),(0,a.jsx)("div",{className:"text-sm font-semibold text-[#c5a880] font-mono mt-0.5",children:"99.98%"})]})]})]})}o.propTypes={providers:n().array,activeRequests:n().array,recentRequests:n().array,byProvider:n().object,stats:n().object}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6808],{5214:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorage",{enumerable:!0,get:function(){return r.workAsyncStorageInstance}});let r=s(17828)},6808:(e,t,s)=>{s.r(t),s.d(t,{default:()=>$});var r=s(95155),a=s(12115),l=s(73321),n=s(88105),o=s(56061);s(84588);var i=s(14051),d=s.n(i);let c=e=>new Intl.NumberFormat().format(e||0);function u({stats:e}){let t=e?.totalRequests||0,s=e?.totalPromptTokens||0,a=e?.totalCachedTokens||0,l=e?.totalCompletionTokens||0,n=e?.totalCost||0,o=s>0?(a/s*100).toFixed(1):"0.0",i=t>0?Math.round(s/t):0,d=t>0?Math.round(l/t):0,x=a>0?3e-6*a:0;return(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-4",children:[(0,r.jsxs)("div",{className:"bg-[#121216]/90 border border-[#23242a] hover:border-[#353642] transition-all p-5 flex flex-col justify-between shadow-sm relative overflow-hidden group",children:[(0,r.jsx)("div",{className:"absolute top-0 right-0 w-24 h-24 bg-white/5 rounded-full blur-2xl -mr-6 -mt-6 pointer-events-none"}),(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs text-[#9c9ca4] font-medium",children:[(0,r.jsx)("span",{className:"tracking-wider uppercase text-[11px]",children:"Total Requests"}),(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-[#9c9ca4] group-hover:text-[#ededef] transition-colors",children:"alt_route"})]}),(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsx)("div",{className:"text-2xl font-bold text-[#ededef] tracking-tight font-mono tabular-nums",children:c(t)}),(0,r.jsxs)("div",{className:"mt-1 flex items-center gap-1 text-[11px] text-[#10b981]",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-xs",children:"arrow_upward"}),(0,r.jsx)("span",{children:"Active"}),(0,r.jsx)("span",{className:"text-[#9c9ca4] font-normal",children:e?.activeRequests?.length?`${e.activeRequests.length} in flight`:"normal"})]})]})]}),(0,r.jsxs)("div",{className:"bg-[#121216]/90 border border-[#23242a] hover:border-[#c5a880]/50 transition-all p-5 flex flex-col justify-between shadow-sm relative overflow-hidden group",children:[(0,r.jsx)("div",{className:"absolute top-0 right-0 w-24 h-24 bg-[#c5a880]/10 rounded-full blur-2xl -mr-6 -mt-6 pointer-events-none"}),(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs text-[#9c9ca4] font-medium",children:[(0,r.jsx)("span",{className:"tracking-wider uppercase text-[11px] text-[#c5a880]",children:"Total Input Tokens"}),(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-[#c5a880]",children:"input"})]}),(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsx)("div",{className:"text-2xl font-bold text-[#c5a880] tracking-tight font-mono tabular-nums",children:c(s)}),(0,r.jsx)("div",{className:"mt-1 flex items-center gap-1 text-[11px] text-[#9c9ca4]",children:(0,r.jsxs)("span",{children:["Avg. ",c(i)," / req"]})})]})]}),(0,r.jsxs)("div",{className:"bg-[#121216]/90 border border-[#23242a] hover:border-[#3b82f6]/50 transition-all p-5 flex flex-col justify-between shadow-sm relative overflow-hidden group",children:[(0,r.jsx)("div",{className:"absolute top-0 right-0 w-24 h-24 bg-[#3b82f6]/10 rounded-full blur-2xl -mr-6 -mt-6 pointer-events-none"}),(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs text-[#9c9ca4] font-medium",children:[(0,r.jsx)("span",{className:"tracking-wider uppercase text-[11px] text-[#93c5fd]",children:"Cached Tokens"}),(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-[#3b82f6]",children:"cached"})]}),(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsx)("div",{className:"text-2xl font-bold text-[#60a5fa] tracking-tight font-mono tabular-nums",children:c(a)}),(0,r.jsx)("div",{className:"mt-1 flex items-center gap-1.5 text-[11px] text-[#60a5fa]",children:(0,r.jsxs)("span",{className:"px-1.5 py-0.5 bg-[#3b82f6]/15 font-semibold text-[10px]",children:[o,"% Hit Rate"]})})]})]}),(0,r.jsxs)("div",{className:"bg-[#121216]/90 border border-[#23242a] hover:border-[#10b981]/50 transition-all p-5 flex flex-col justify-between shadow-sm relative overflow-hidden group",children:[(0,r.jsx)("div",{className:"absolute top-0 right-0 w-24 h-24 bg-[#10b981]/10 rounded-full blur-2xl -mr-6 -mt-6 pointer-events-none"}),(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs text-[#9c9ca4] font-medium",children:[(0,r.jsx)("span",{className:"tracking-wider uppercase text-[11px] text-[#6ee7b7]",children:"Output Tokens"}),(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-[#10b981]",children:"output"})]}),(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsx)("div",{className:"text-2xl font-bold text-[#34d399] tracking-tight font-mono tabular-nums",children:c(l)}),(0,r.jsx)("div",{className:"mt-1 flex items-center gap-1 text-[11px] text-[#9c9ca4]",children:(0,r.jsxs)("span",{children:["Avg. ",c(d)," tokens"]})})]})]}),(0,r.jsxs)("div",{className:"bg-[#121216]/90 border border-[#23242a] hover:border-[#f59e0b]/50 transition-all p-5 flex flex-col justify-between shadow-sm relative overflow-hidden group",children:[(0,r.jsx)("div",{className:"absolute top-0 right-0 w-24 h-24 bg-[#f59e0b]/10 rounded-full blur-2xl -mr-6 -mt-6 pointer-events-none"}),(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs text-[#9c9ca4] font-medium",children:[(0,r.jsx)("span",{className:"tracking-wider uppercase text-[11px] text-[#fcd34d]",children:"Est. Cost"}),(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-[#f59e0b]",children:"payments"})]}),(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsxs)("div",{className:"text-2xl font-bold text-[#fbbf24] tracking-tight font-mono tabular-nums",children:["~$",n.toFixed(2)]}),(0,r.jsxs)("div",{className:"mt-1 flex items-center justify-between text-[10px] text-[#9c9ca4]",children:[(0,r.jsx)("span",{children:x>0?`Save ~$${x.toFixed(2)} (Cache)`:"Estimated billing"}),(0,r.jsx)("span",{className:"material-symbols-outlined text-xs text-[#10b981]",children:"savings"})]})]})]})]})}u.propTypes={stats:d().object.isRequired};let x=e=>new Intl.NumberFormat().format(e||0),m=e=>`$${(e||0).toFixed(2)}`;function p(e){if(!e)return"Never";let t=Math.floor((Date.now()-new Date(e))/6e4);return t<1?"Just now":t<60?`${t}m ago`:t<1440?`${Math.floor(t/60)}h ago`:new Date(e).toLocaleDateString()}function h({field:e,currentSort:t,currentOrder:s}){return t!==e?(0,r.jsx)("span",{className:"ml-1 opacity-20",children:"↕"}):(0,r.jsx)("span",{className:"ml-1 text-[#c5a880]",children:"asc"===s?"↑":"↓"})}function f({item:e,viewMode:t,isSummary:s=!1}){return"tokens"===t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:"px-5 py-3 text-right text-[#c5a880] font-mono",children:s&&void 0===e.promptTokens?"—":x(e.promptTokens)}),(0,r.jsx)("td",{className:"px-5 py-3 text-right text-[#60a5fa] font-mono",children:e.cachedTokens?x(e.cachedTokens):"—"}),(0,r.jsx)("td",{className:"px-5 py-3 text-right text-[#34d399] font-mono",children:s&&void 0===e.completionTokens?"—":x(e.completionTokens)}),(0,r.jsx)("td",{className:"px-5 py-3 text-right font-mono font-bold text-[#ededef]",children:x(e.totalTokens)})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:"px-5 py-3 text-right text-[#ededef] font-mono",children:s&&void 0===e.inputCost?"—":m(e.inputCost)}),(0,r.jsx)("td",{className:"px-5 py-3 text-right text-[#60a5fa] font-mono",children:e.cachedCost?m(e.cachedCost):"—"}),(0,r.jsx)("td",{className:"px-5 py-3 text-right text-[#34d399] font-mono",children:s&&void 0===e.outputCost?"—":m(e.outputCost)}),(0,r.jsx)("td",{className:"px-5 py-3 text-right font-mono font-bold text-[#fbbf24]",children:m(e.totalCost||e.cost)})]})}function g({title:e,columns:t,groupedData:s,tableType:l,sortBy:n,sortOrder:o,onToggleSort:i,viewMode:d,storageKey:c,renderDetailCells:u,renderSummaryCells:m,emptyMessage:p}){let[b,y]=(0,a.useState)(()=>{try{let e=localStorage.getItem(c);return e?new Set(JSON.parse(e)):new Set}catch{return new Set}});(0,a.useEffect)(()=>{try{localStorage.setItem(c,JSON.stringify([...b]))}catch(e){console.error(`Failed to save ${c}:`,e)}},[b,c]);let j=(0,a.useCallback)(e=>{y(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),v=(0,a.useMemo)(()=>"tokens"===d?[{field:"promptTokens",label:"Input Tokens"},{field:"cachedTokens",label:"Cached"},{field:"completionTokens",label:"Output Tokens"},{field:"totalTokens",label:"Total Tokens"}]:[{field:"promptTokens",label:"Input Cost"},{field:"cachedCost",label:"Cached Cost"},{field:"completionTokens",label:"Output Cost"},{field:"cost",label:"Total Cost"}],[d]),N=t.length+v.length,w=(0,a.useMemo)(()=>s.reduce((e,t)=>{let s=t.summary||{};return e.requests+=s.requests||0,e.promptTokens+=s.promptTokens||0,e.cachedTokens+=s.cachedTokens||0,e.completionTokens+=s.completionTokens||0,e.totalTokens+=s.totalTokens||0,e.inputCost+=s.inputCost||0,e.cachedCost+=s.cachedCost||0,e.outputCost+=s.outputCost||0,e.cost+=s.cost||0,e.totalCost+=s.totalCost||s.cost||0,e},{requests:0,promptTokens:0,cachedTokens:0,completionTokens:0,totalTokens:0,inputCost:0,cachedCost:0,outputCost:0,cost:0,totalCost:0}),[s]);return(0,r.jsxs)("div",{className:"bg-[#121216] border border-[#23242a] shadow-sm overflow-hidden",children:[e&&(0,r.jsx)("div",{className:"p-4 border-b border-[#23242a] bg-[#16161c]/40",children:(0,r.jsx)("h3",{className:"font-semibold text-sm text-[#ededef]",children:e})}),(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full text-xs text-left",children:[(0,r.jsx)("thead",{className:"bg-[#16161c]/70 text-[#9c9ca4] uppercase text-[10px] tracking-wider border-b border-[#23242a] font-semibold",children:(0,r.jsxs)("tr",{children:[t.map(e=>(0,r.jsxs)("th",{className:`px-5 py-3 cursor-pointer hover:bg-[#1a1a22] transition-colors ${"right"===e.align?"text-right":""}`,onClick:()=>i(l,e.field),children:[e.label," ",(0,r.jsx)(h,{field:e.field,currentSort:n,currentOrder:o})]},e.field)),v.map(e=>(0,r.jsxs)("th",{className:"px-5 py-3 text-right cursor-pointer hover:bg-[#1a1a22] transition-colors",onClick:()=>i(l,e.field),children:[e.label," ",(0,r.jsx)(h,{field:e.field,currentSort:n,currentOrder:o})]},e.field))]})}),(0,r.jsxs)("tbody",{className:"divide-y divide-[#1e1e26] font-mono",children:[s.map(e=>(0,r.jsxs)(a.Fragment,{children:[(0,r.jsxs)("tr",{className:"cursor-pointer hover:bg-[#16161d] transition-colors",onClick:()=>j(e.groupKey),children:[(0,r.jsx)("td",{className:"px-5 py-3.5",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[16px] text-[#9c9ca4] transition-transform ${b.has(e.groupKey)?"rotate-90":""}`,children:"chevron_right"}),(0,r.jsx)("span",{className:`font-medium transition-colors ${e.summary.pending>0?"text-[#c5a880]":"text-[#ededef]"}`,children:e.groupKey})]})}),m(e),(0,r.jsx)(f,{item:e.summary,viewMode:d,isSummary:!0})]}),b.has(e.groupKey)&&e.items.map(e=>(0,r.jsxs)("tr",{className:"bg-[#0e0e12]/60 hover:bg-[#16161d] transition-colors",children:[u(e),(0,r.jsx)(f,{item:e,viewMode:d})]},`detail-${e.key}`))]},e.groupKey)),0===s.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:N,className:"px-6 py-8 text-center text-[#9c9ca4] font-sans",children:p})})]}),s.length>0&&(0,r.jsx)("tfoot",{className:"border-t border-[#23242a] font-mono text-xs font-semibold text-[#ededef] bg-[#16161c]/50",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"px-5 py-3 font-sans",children:"Total"}),(0,r.jsxs)("td",{className:"px-5 py-3 font-sans text-[#9c9ca4]",children:[s.length," Groups"]}),(0,r.jsx)("td",{className:"px-5 py-3 text-right",children:x(w.requests)}),(0,r.jsx)("td",{className:"px-5 py-3 text-right text-[#9c9ca4]",children:"—"}),(0,r.jsx)(f,{item:w,viewMode:d,isSummary:!0})]})})]})})]})}h.propTypes={field:d().string.isRequired,currentSort:d().string.isRequired,currentOrder:d().string.isRequired},f.propTypes={item:d().object.isRequired,viewMode:d().string.isRequired,isSummary:d().bool},g.propTypes={title:d().string,columns:d().arrayOf(d().shape({field:d().string.isRequired,label:d().string.isRequired,align:d().string})).isRequired,groupedData:d().array.isRequired,tableType:d().string.isRequired,sortBy:d().string.isRequired,sortOrder:d().string.isRequired,onToggleSort:d().func.isRequired,viewMode:d().string.isRequired,storageKey:d().string.isRequired,renderDetailCells:d().func.isRequired,renderSummaryCells:d().func.isRequired,emptyMessage:d().string.isRequired};var b=s(37206);function y(e){let t=n.Q2[e];return!t?.serviceKinds||t.serviceKinds.includes("llm")}let j=(0,b.default)(()=>s.e(5524).then(s.bind(s,15524)),{loadableGenerated:{webpack:()=>[15524]},ssr:!1}),v=(0,b.default)(()=>Promise.all([s.e(3842),s.e(5815),s.e(1649),s.e(124)]).then(s.bind(s,10124)),{loadableGenerated:{webpack:()=>[10124]},ssr:!1}),N=(0,b.default)(()=>s.e(2435).then(s.bind(s,82435)),{loadableGenerated:{webpack:()=>[82435]},ssr:!1});function w({timestamp:e}){let t,[,s]=(0,a.useState)(0);return(0,a.useEffect)(()=>{let e=setInterval(()=>s(e=>e+1),1e3);return()=>clearInterval(e)},[]),(0,r.jsx)(r.Fragment,{children:(t=Math.floor((Date.now()-new Date(e))/1e3))<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`})}function k({requests:e=[]}){return e.length?(0,r.jsx)("div",{className:"space-y-2.5 overflow-y-auto max-h-[380px] pr-1",children:e.map((e,t)=>{let s=!e.status||"ok"===e.status||"success"===e.status||200===e.status,a=e.id?String(e.id).slice(-5):`${t+1}a`;return(0,r.jsxs)("div",{className:"p-3 bg-[#17171d] border border-[#23242e] hover:border-[#353644] transition-all flex items-center justify-between",children:[(0,r.jsx)("div",{className:"flex items-center gap-3 min-w-0",children:(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("div",{className:"text-xs font-semibold text-[#ededef] flex items-center gap-1.5 flex-wrap",children:[(0,r.jsx)("span",{className:"font-mono truncate max-w-[150px]",title:e.model,children:e.model||"standard"}),(0,r.jsx)("span",{className:`px-1.5 py-0.5 text-[9px] font-mono shrink-0 ${s?"bg-[#22222a] text-[#c5a880]":"bg-[#351515] text-[#ef4444]"}`,children:s?"200 OK":"500 ERR"})]}),(0,r.jsxs)("div",{className:"text-[10px] text-[#9c9ca4] font-mono mt-0.5 truncate",children:["req_",a," \xb7 ",e.provider||"Direct"," \xb7 ",(0,r.jsx)(w,{timestamp:e.timestamp})]})]})}),(0,r.jsxs)("div",{className:"text-right font-mono text-[11px] shrink-0 ml-2",children:[(0,r.jsxs)("div",{className:"text-[#c5a880] font-semibold",children:[x(e.promptTokens),"↑ ",(0,r.jsxs)("span",{className:"text-[#10b981]",children:[x(e.completionTokens),"↓"]})]}),(0,r.jsxs)("div",{className:"text-[10px] text-[#9c9ca4]",children:[e.cost?`$${e.cost.toFixed(3)}`:"—"," ",e.durationMs?`\xb7 ${e.durationMs}ms`:""]})]})]},t)})}):(0,r.jsx)("div",{className:"py-16 flex items-center justify-center text-[#9c9ca4] text-xs",children:"No recent gateway requests yet."})}function C(e,t={},s,r){return Object.entries(e||{}).map(([e,s])=>{let r=(s.promptTokens||0)+(s.completionTokens||0),a=s.cost||0,l=s.cachedTokens||0,n=Math.max(0,(s.promptTokens||0)-l),o=r>0?(s.completionTokens||0)*(a/r):0;return{...s,key:e,totalTokens:r,totalCost:a,inputCost:r>0?a/r*n:0,cachedCost:r>0?a/r*l:0,outputCost:o,pending:t[e]||0}}).sort((e,t)=>{let a=e[s],l=t[s];return("string"==typeof a&&(a=a.toLowerCase()),"string"==typeof l&&(l=l.toLowerCase()),a<l)?"asc"===r?-1:1:a>l?"asc"===r?1:-1:0})}function T(e,t){if(!Array.isArray(e))return[];let s={};return e.forEach(e=>{let r=function(e,t){switch(t){case"rawModel":return e.rawModel||"Unknown Model";case"accountName":return e.accountName||`Account ${e.connectionId?.slice(0,8)}...`||"Unknown Account";case"keyName":return e.keyName||"Unknown Key";case"endpoint":return e.endpoint||"Unknown Endpoint";default:return e[t]||"Unknown"}}(e,t);s[r]||(s[r]={groupKey:r,summary:{requests:0,promptTokens:0,completionTokens:0,cachedTokens:0,totalTokens:0,cost:0,inputCost:0,cachedCost:0,outputCost:0,lastUsed:null,pending:0},items:[]});let a=s[r].summary;a.requests+=e.requests||0,a.promptTokens+=e.promptTokens||0,a.completionTokens+=e.completionTokens||0,a.cachedTokens+=e.cachedTokens||0,a.totalTokens+=e.totalTokens||0,a.cost+=e.cost||0,a.inputCost+=e.inputCost||0,a.cachedCost+=e.cachedCost||0,a.outputCost+=e.outputCost||0,a.pending+=e.pending||0,e.lastUsed&&(!a.lastUsed||new Date(e.lastUsed)>new Date(a.lastUsed))&&(a.lastUsed=e.lastUsed),s[r].items.push(e)}),Object.values(s)}let S=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],q=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"accountName",label:"Account"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],M=[{field:"keyName",label:"API Key Name"},{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],R=[{field:"endpoint",label:"Endpoint"},{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],O=[{value:"model",label:"Usage by Model"},{value:"account",label:"Usage by Account"},{value:"apiKey",label:"Usage by API Key"},{value:"endpoint",label:"Usage by Endpoint"}],P=[{value:"today",label:"Today"},{value:"24h",label:"24h"},{value:"7d",label:"7D"},{value:"30d",label:"30D"},{value:"60d",label:"60D"},{value:"all",label:"All"}];function $({period:e,setPeriod:t,hidePeriodSelector:s=!1}={}){let i=(0,l.useRouter)(),d=(0,l.useSearchParams)(),c=d.get("sortBy")||"rawModel",m=d.get("sortOrder")||"asc",[h,f]=(0,a.useState)(null),[b,w]=(0,a.useState)(!0),[U,A]=(0,a.useState)(!1),[_,D]=(0,a.useState)("model"),[F,K]=(0,a.useState)("costs"),[E,I]=(0,a.useState)([]),[B,L]=(0,a.useState)("today"),G=(0,a.useRef)(!0),z=(0,a.useRef)(!1),J=e??B,Q=t??L;(0,a.useEffect)(()=>{Promise.all([fetch("/api/providers").then(e=>e.ok?e.json():null),fetch("/api/provider-nodes").then(e=>e.ok?e.json():null)]).then(([e,t])=>{let s={};for(let e of t?.nodes||[])s[e.id]=e.name;let r=new Set;I([...(e?.connections||[]).filter(e=>!(!1===e.isActive||!y(e.provider)||n.Q2[e.provider]?.hidden||r.has(e.provider))&&(r.add(e.provider),!0)).map(e=>({...e,nodeName:s[e.provider]||null})),...Object.values(n.IS).filter(e=>e.noAuth&&!e.hidden&&!r.has(e.id)&&y(e.id)).map(e=>({provider:e.id,name:e.name}))])}).catch(()=>{})},[]),(0,a.useEffect)(()=>{G.current?(G.current=!1,w(!0)):A(!0),fetch(`/api/usage/stats?period=${J}`).then(e=>e.ok?e.json():null).then(e=>{e&&(z.current=!0,f(t=>({...t,...e})))}).catch(()=>{}).finally(()=>{w(!1),A(!1)})},[J]),(0,a.useEffect)(()=>{let e=new EventSource("/api/usage/stream");return e.onmessage=e=>{try{let t=JSON.parse(e.data);f(e=>e?{...e,activeRequests:t.activeRequests,recentRequests:t.recentRequests,errorProvider:t.errorProvider,pending:t.pending}:e),z.current&&w(!1)}catch(e){console.error("[SSE CLIENT] parse error:",e)}},e.onerror=()=>w(!1),()=>e.close()},[]);let H=(0,a.useCallback)((e,t)=>{let s=new URLSearchParams(d.toString());s.get("sortBy")===t?s.set("sortOrder","asc"===s.get("sortOrder")?"desc":"asc"):(s.set("sortBy",t),s.set("sortOrder","asc")),i.replace(`?${s.toString()}`,{scroll:!1})},[d,i]),W=(0,a.useMemo)(()=>{if(!h)return null;switch(_){case"model":{let e=h.pending?.byModel||{};return{columns:S,groupedData:T(C(h.byModel,e,c,m),"rawModel"),storageKey:"usage-stats:expanded-models",emptyMessage:"No usage recorded yet.",renderSummaryCells:e=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,r.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.summary.requests)}),(0,r.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${e.pending>0?"text-primary":""}`,children:e.rawModel}),(0,r.jsx)("td",{className:"px-6 py-3",children:(0,r.jsx)(o.default,{variant:e.pending>0?"primary":"neutral",size:"sm",children:e.provider})}),(0,r.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.requests)}),(0,r.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(e.lastUsed)})]})}}case"account":{let e={};return h?.pending?.byAccount&&Object.entries(h.byAccount||{}).forEach(([t,s])=>{let r=h.pending.byAccount[s.connectionId];if(r){let a=s.provider?`${s.rawModel} (${s.provider})`:s.rawModel;e[t]=r[a]||0}}),{columns:q,groupedData:T(C(h.byAccount,e,c,m),"accountName"),storageKey:"usage-stats:expanded-accounts",emptyMessage:"No account-specific usage recorded yet.",renderSummaryCells:e=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,r.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,r.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.summary.requests)}),(0,r.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${e.pending>0?"text-primary":""}`,children:e.accountName||`Account ${e.connectionId?.slice(0,8)}...`}),(0,r.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${e.pending>0?"text-primary":""}`,children:e.rawModel}),(0,r.jsx)("td",{className:"px-6 py-3",children:(0,r.jsx)(o.default,{variant:e.pending>0?"primary":"neutral",size:"sm",children:e.provider})}),(0,r.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.requests)}),(0,r.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(e.lastUsed)})]})}}case"apiKey":return{columns:M,groupedData:T(C(h.byApiKey,{},c,m),"keyName"),storageKey:"usage-stats:expanded-apikeys",emptyMessage:"No API key usage recorded yet.",renderSummaryCells:e=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,r.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,r.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.summary.requests)}),(0,r.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:"px-6 py-3 font-medium",children:e.keyName}),(0,r.jsx)("td",{className:"px-6 py-3",children:e.rawModel}),(0,r.jsx)("td",{className:"px-6 py-3",children:(0,r.jsx)(o.default,{variant:"neutral",size:"sm",children:e.provider})}),(0,r.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.requests)}),(0,r.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(e.lastUsed)})]})};default:return{columns:R,groupedData:T(C(h.byEndpoint,{},c,m),"endpoint"),storageKey:"usage-stats:expanded-endpoints",emptyMessage:"No endpoint usage recorded yet.",renderSummaryCells:e=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,r.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,r.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.summary.requests)}),(0,r.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("td",{className:"px-6 py-3 font-medium font-mono text-sm",children:e.endpoint}),(0,r.jsx)("td",{className:"px-6 py-3",children:e.rawModel}),(0,r.jsx)("td",{className:"px-6 py-3",children:(0,r.jsx)(o.default,{variant:"neutral",size:"sm",children:e.provider})}),(0,r.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.requests)}),(0,r.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(e.lastUsed)})]})}}},[h,_,c,m]);if(!h&&!b)return(0,r.jsx)("div",{className:"text-text-muted",children:"Failed to load usage statistics."});let V=(0,r.jsx)("div",{className:"flex items-center justify-center py-12 text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[32px] animate-spin",children:"progress_activity"})});return(0,r.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[!s&&(0,r.jsxs)("div",{className:"flex w-full items-center gap-2 sm:w-auto sm:self-end",children:[(0,r.jsx)("div",{className:"grid flex-1 grid-cols-6 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:flex sm:flex-none",children:P.map(e=>(0,r.jsx)("button",{onClick:()=>Q(e.value),disabled:U,className:`rounded-md px-3 py-1 text-sm font-medium transition-colors ${J===e.value?"bg-primary text-white shadow-sm":"text-text-muted hover:bg-bg-hover hover:text-text"}`,children:e.label},e.value))}),U&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted animate-spin",children:"progress_activity"})]}),b?V:(0,r.jsx)(u,{stats:h}),b?V:(0,r.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-5 gap-4 items-stretch",children:[(0,r.jsx)("div",{className:"lg:col-span-3 h-full",children:(0,r.jsx)(j,{providers:E,activeRequests:h.activeRequests||[],recentRequests:h.recentRequests||[],byProvider:h.byProvider||{},stats:h})}),(0,r.jsxs)("div",{className:"lg:col-span-2 bg-[#121216] border border-[#23242a] p-6 flex flex-col justify-between shadow-sm h-full",children:[(0,r.jsx)("div",{className:"flex items-center justify-between border-b border-[#23242a] pb-4 mb-4 shrink-0",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-lg text-[#3b82f6]",children:"schedule"}),(0,r.jsx)("h2",{className:"text-sm font-semibold text-[#ededef]",children:"Recent Gateway Requests"})]})}),(0,r.jsx)("div",{className:"flex-1 min-h-0",children:(0,r.jsx)(k,{requests:h.recentRequests||[]})})]})]}),b?V:(0,r.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-5 gap-4 items-stretch",children:[(0,r.jsx)("div",{className:"lg:col-span-3 h-full",children:(0,r.jsx)(v,{period:J,stats:h})}),(0,r.jsx)("div",{className:"lg:col-span-2 h-full",children:(0,r.jsx)(N,{byProvider:h.byProvider,totalTokens:(h.totalPromptTokens||0)+(h.totalCompletionTokens||0),totalCachedTokens:h.totalCachedTokens||0})})]}),(0,r.jsxs)("div",{className:"bg-[#121216] border border-[#23242a] p-6 shadow-sm flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 border-b border-[#23242a] pb-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-sm font-semibold text-[#ededef]",children:"model"===_?"Usage Breakdown by Model":"account"===_?"Usage Breakdown by Account":"apiKey"===_?"Usage Breakdown by API Key":"Usage Breakdown by Endpoint"}),(0,r.jsx)("p",{className:"text-[11px] text-[#9c9ca4]",children:"Comprehensive telemetry, prompt caching ratios & billed cost"})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,r.jsx)("select",{value:_,onChange:e=>D(e.target.value),className:"bg-[#1c1c24] border border-[#272834] px-3 py-1.5 text-xs font-medium text-[#ededef] focus:outline-none focus:border-[#c5a880] transition-colors",children:O.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,r.jsxs)("div",{className:"inline-flex items-center p-0.5 bg-[#181820] border border-[#23242a]",children:[(0,r.jsx)("button",{onClick:()=>K("costs"),className:`px-3 py-1 text-xs font-medium transition-colors ${"costs"===F?"bg-[#242430] text-[#c5a880]":"text-[#9c9ca4] hover:text-[#ededef]"}`,children:"Costs"}),(0,r.jsx)("button",{onClick:()=>K("tokens"),className:`px-3 py-1 text-xs font-medium transition-colors ${"tokens"===F?"bg-[#242430] text-[#c5a880]":"text-[#9c9ca4] hover:text-[#ededef]"}`,children:"Tokens"})]})]})]}),b?V:W&&(0,r.jsx)(g,{columns:W.columns,groupedData:W.groupedData,tableType:_,sortBy:c,sortOrder:m,onToggleSort:H,viewMode:F,storageKey:W.storageKey,renderSummaryCells:W.renderSummaryCells,renderDetailCells:W.renderDetailCells,emptyMessage:W.emptyMessage})]})]})}},17828:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return r}});let r=(0,s(64054).getOrCreateGlobalAsyncLocalStorage)("work-async-storage")},21957:(e,t,s)=>{function r({moduleIds:e}){return null}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return r}}),s(95155),s(47650),s(5214),s(2451),s(53887)},37206:(e,t,s)=>{s.d(t,{default:()=>a.a});var r=s(75707),a=s.n(r)},41112:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSRForNextDynamic",{enumerable:!0,get:function(){return n}});let r=s(12115),a=s(47650);s(1980);let l=s(60614).createReactBrowserBailoutReason.bind(null,"next/dynamic");function n({children:e}){return(0,r.use)((0,a.browser)(l)),e}},60614:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var s={createReactBrowserBailoutReason:function(){return l},getReactBrowserBailoutReason:function(){return n},isNextBrowserBailoutError:function(){return o}};for(var r in s)Object.defineProperty(t,r,{enumerable:!0,get:s[r]});let a=Symbol.for("next.browser-bailout-reason");function l(e){return{$$typeof:a,reason:e}}function n(e){let t=e?.cause;return t?.$$typeof===a?t.reason:void 0}function o(e){return void 0!==n(e)}},64054:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var s={bindSnapshot:function(){return d},createAsyncLocalStorage:function(){return o},createSnapshot:function(){return c},getOrCreateGlobalAsyncLocalStorage:function(){return i}};for(var r in s)Object.defineProperty(t,r,{enumerable:!0,get:s[r]});let a=Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available");class l{disable(){throw a}getStore(){}run(){throw a}exit(){throw a}enterWith(){throw a}static bind(e){return e}}let n="u">typeof globalThis&&globalThis.AsyncLocalStorage;function o(){return n?new n:new l}function i(e){let t=Symbol.for(`@next/${e}@16.4.0`),s=globalThis;return s[t]??=o()}function d(e){return n?n.bind(e):l.bind(e)}function c(){return n?n.snapshot():function(e,...t){return e(...t)}}},68635:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i}});let r=s(95155),a=s(12115),l=s(41112);function n(e){return{default:e&&"default"in e?e.default:e}}s(21957);let o={loader:()=>Promise.resolve(n(()=>null)),loading:null,ssr:!0},i=function(e){let t={...o,...e},s=(0,a.lazy)(()=>t.loader().then(n)),i=t.loading;function d(e){let n=i?(0,r.jsx)(i,{isLoading:!0,pastDelay:!0,error:null}):null,o=!t.ssr||!!t.loading,d=o?a.Suspense:a.Fragment,c=t.ssr?(0,r.jsxs)(r.Fragment,{children:[null,(0,r.jsx)(s,{...e})]}):(0,r.jsx)(l.BailoutToCSRForNextDynamic,{children:(0,r.jsx)(s,{...e})});return(0,r.jsx)(d,{...o?{fallback:n}:{},children:c})}return d.displayName="LoadableComponent",d}},75707:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}});let r=s(73623)._(s(68635));function a(e,t){let s={};"function"==typeof e&&(s.loader=e);let a={...s,...t};return(0,r.default)({...a,modules:a.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)}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2326],{75882:(e,s,l)=>{"use strict";l.d(s,{default:()=>m});var t=l(95155),a=l(12115),i=l(35497),r=l(3534),c=l(10761),n=l(98500),o=l.n(n),d=l(5772);function x({toolId:e,tool:s,status:l}){let a=s?.configType==="guide"?{label:"Guide",cls:"bg-blue-500/10 text-blue-600 dark:text-blue-400"}:l?l.installed?l.has9Router?{label:"Connected",cls:"bg-green-500/10 text-green-600 dark:text-green-400"}:{label:"Not configured",cls:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400"}:{label:"Not installed",cls:"bg-gray-500/10 text-gray-500"}:{label:"Unknown",cls:"bg-gray-500/10 text-gray-500"};return(0,t.jsx)(o(),{href:`/dashboard/cli-tools/${e}`,className:"block",children:(0,t.jsx)(i.Zp,{padding:"sm",className:"h-full overflow-hidden hover:border-primary/50 transition-colors cursor-pointer",children:(0,t.jsx)("div",{className:"flex h-full flex-col gap-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:s.image?(0,t.jsx)(d.A,{src:s.image,alt:s.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"},loading:"lazy",decoding:"async"}):s.icon?(0,t.jsx)("span",{className:"material-symbols-outlined text-[28px]",style:{color:s.color},children:s.icon}):null}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("h3",{className:"font-medium text-sm truncate",children:s.name}),(0,t.jsx)("span",{className:`inline-block mt-1 px-1.5 py-0.5 text-[10px] font-medium rounded-full ${a.cls}`,children:a.label})]}),(0,t.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px] shrink-0",children:"chevron_right"})]})})})})}function m({machineId:e}){let[s,l]=(0,a.useState)(!0),[n,o]=(0,a.useState)({});if((0,a.useEffect)(()=>{let e=!0;return(async()=>{try{let s=await fetch("/api/cli-tools/all-statuses");s.ok&&e&&o(await s.json())}catch(e){console.log("Error fetching tool statuses:",e)}finally{e&&l(!1)}})(),()=>{e=!1}},[]),s)return(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-4",children:[(0,t.jsx)(i.Qv,{}),(0,t.jsx)(i.Qv,{}),(0,t.jsx)(i.Qv,{}),(0,t.jsx)(i.Qv,{}),(0,t.jsx)(i.Qv,{}),(0,t.jsx)(i.Qv,{})]});let d=Object.entries(r.dM),g=Object.entries(r.wn);return(0,t.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-6 px-1 sm:px-0",children:[(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-4",children:d.map(([e,s])=>(0,t.jsx)(x,{toolId:e,tool:s,status:n[e]},e))}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 sm:gap-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary",children:"security"}),(0,t.jsx)("h2",{className:"text-sm font-semibold text-text-main",children:"MITM Tools"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-4",children:g.map(([e,s])=>(0,t.jsx)(c.gY,{tool:s},e))})]})]})}},82325:(e,s,l)=>{Promise.resolve().then(l.bind(l,75882))}},e=>{e.O(0,[763,5772,1321,705,5497,761,8441,3794,7358],()=>e(e.s=82325)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3649],{54295:(e,t,s)=>{Promise.resolve().then(s.bind(s,80191))},80191:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>y});var l=s(95155),a=s(12115),r=s(44923),o=s(87256),i=s(39768),n=s(5020),d=s(35497),c=s(11059),m=s(929),x=s(67899);let u=/^[a-zA-Z0-9_.\-]+$/,p=[{key:"vision",label:"Vision",icon:"visibility",desc:"images (png, jpg, webp, …)"},{key:"audioInput",label:"Audio",icon:"graphic_eq",desc:"audio input"}],h="oc/mimo-v2.6-flash-free",f={enabled:!0,roundRobin:!1,models:[]},b={vision:{...f},pdf:{...f},audioInput:{...f},videoInput:{...f}},g=e=>"oc/mimo-v2.5-free"===e?h:e,j=[{value:"fallback",label:"Fallback — try in order"},{value:"round-robin",label:"Round Robin — rotate"},{value:"fusion",label:"Fusion — panel + judge"}];function y(){let e,[t,s]=(0,a.useState)([]),[r,o]=(0,a.useState)(!0),[i,n]=(0,a.useState)(!1),[x,u]=(0,a.useState)(null),[h,y]=(0,a.useState)([]),[v,k]=(0,a.useState)({}),[C,$]=(0,a.useState)(b),{getCaps:E}=(0,m.y)(),[M,D]=(0,a.useState)(null),[A,O]=(0,a.useState)(null),[F,P]=(0,a.useState)([]),[T,R]=(0,a.useState)(!1),{copied:_,copy:z}=(0,c.C)();(0,a.useEffect)(()=>{G()},[]),(0,a.useEffect)(()=>{let e=new Set(t.map(e=>e.id));P(t=>t.filter(t=>e.has(t)))},[t]);let I=t.filter(e=>F.includes(e.id)),q=t.length>0&&F.length===t.length,B=F.length>0,J=()=>P([]),V=async e=>{let t="cursor"===e?"Cursor Default":"Claude Default";O(e);try{let s=await fetch(`/api/combos/presets?source=${e}`),l=await s.json();if(!s.ok)return void alert(l.error||`Failed to preview ${t}`);let a=l.toCreate??(l.items||[]).filter(e=>!e.exists).length,r=l.toSkip??(l.items||[]).filter(e=>e.exists).length,o=(l.items||[]).length;if(0===o)return void alert(`No ${t} models available to generate.`);if(0===a)return void alert(`All ${o} ${t} combos already exist. Nothing to create.`);D({title:`Generate ${t}`,message:`Create ${a} combo${1===a?"":"s"} named like ${"cursor"===e?"Cursor":"Claude"} model IDs (seeded with cu/… or cc/…). ${r} already exist and will be skipped. You can edit any combo afterward to add fallbacks.`,confirmText:"Generate",variant:"primary",onConfirm:async()=>{D(e=>e?{...e,loading:!0}:null);try{let s=await fetch("/api/combos/presets",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:e})}),l=await s.json();if(!s.ok)return void alert(l.error||`Failed to generate ${t}`);await G(),D(null)}catch(e){console.log(`Error generating ${t}:`,e),alert(`Failed to generate ${t}`),D(e=>e?{...e,loading:!1}:null)}}})}catch(e){console.log(`Error previewing ${t}:`,e),alert(`Failed to preview ${t}`)}finally{O(null)}},G=async()=>{try{let[t,l,a]=await Promise.all([fetch("/api/combos"),fetch("/api/providers"),fetch("/api/settings")]),r=await t.json(),o=await l.json(),i=a.ok?await a.json():{};t.ok&&s((r.combos||[]).filter(e=>!e.kind||"llm"===e.kind)),l.ok&&y(o.connections||[]),k(i.comboStrategies||{});let n=i.capacityAdapter||{},d={};for(let t of p){var e;d[t.key]=(e=n[t.key],Array.isArray(e)?{enabled:!0,roundRobin:!1,models:e.map(e=>g(e?.model||e)).filter(Boolean)}:e&&"object"==typeof e?{enabled:!1!==e.enabled,roundRobin:!!e.roundRobin,models:Array.isArray(e.models)?e.models.map(g).filter(Boolean):[]}:{...f})}$(d)}catch(e){console.log("Error fetching data:",e)}finally{o(!1)}},L=async e=>{$(e);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({capacityAdapter:e})})}catch(e){console.log("Error updating capacity adapter:",e)}},Q=async e=>{try{let t=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)await G(),n(!1);else{let e=await t.json();alert(e.error||"Failed to create combo")}}catch(e){console.log("Error creating combo:",e)}},Z=async(e,t)=>{try{let s=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(s.ok)await G(),u(null);else{let e=await s.json();alert(e.error||"Failed to update combo")}}catch(e){console.log("Error updating combo:",e)}},U=(e,t=v)=>{let s={...t};for(let t of e)delete s[t];return s},W=async e=>{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:e})}),k(e)},H=async e=>{let l=t.find(t=>t.id===e);D({title:"Delete Combo",message:l?`Delete combo "${l.name}"?`:"Delete this combo?",onConfirm:async()=>{D(e=>e?{...e,loading:!0}:null);try{(await fetch(`/api/combos/${e}`,{method:"DELETE"})).ok&&(l?.name&&await W(U([l.name])),s(t=>t.filter(t=>t.id!==e)),P(t=>t.filter(t=>t!==e))),D(null)}catch(e){console.log("Error deleting combo:",e),D(e=>e?{...e,loading:!1}:null)}}})},K=async(e,t)=>{try{let s={...v},l={...s[e]||{},...t};l.fallbackStrategy&&"fallback"!==l.fallbackStrategy?s[e]=l:delete s[e],await W(s)}catch(e){console.log("Error updating combo strategy:",e)}},Y=async e=>{if(0!==I.length&&e){R(!0);try{let t={...v};for(let s of I)e&&"fallback"!==e?t[s.name]={...t[s.name]||{},fallbackStrategy:e}:delete t[s.name];await W(t)}catch(e){console.log("Error bulk updating combo strategy:",e),alert("Failed to update strategy for selected combos")}finally{R(!1)}}};return r?(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsx)(d.Qv,{}),(0,l.jsx)(d.Qv,{})]}):(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Group models under one name, then pick a strategy per combo:"}),(0,l.jsxs)("ul",{className:"text-sm text-text-muted mt-2 flex flex-col gap-1",children:[(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Fallback"})," — tries models in order (next on failure)"]}),(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Round Robin"})," — rotates models across requests to spread load"]}),(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Fusion"})," — queries all models in parallel, then a judge synthesizes one answer. Best quality, but costs the most: every request bills all panel models + the judge (N+1 calls)"]})]}),(0,l.jsxs)("p",{className:"hidden text-xs text-text-muted mt-3 max-w-2xl",children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Cursor / Claude Default"})," create combos named exactly like those clients' model IDs (e.g. ",(0,l.jsx)("code",{className:"font-mono",children:"composer-2.5"}),", ",(0,l.jsx)("code",{className:"font-mono",children:"opus"}),"), seeded with the matching ",(0,l.jsx)("code",{className:"font-mono",children:"cu/…"})," or ",(0,l.jsx)("code",{className:"font-mono",children:"cc/…"})," route so traffic can hit 9router without the prefix."," ",'Note: Cursor IDE itself often blocks built-in Composer / Grok from Override OpenAI Base URL ("model does not support custom API"); add them via Cursor\'s ',(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Add Custom Model"})," using the combo name, or pick a model Cursor allows through the custom endpoint."]})]}),(0,l.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:items-stretch",children:[(0,l.jsx)(d.$n,{icon:"add",onClick:()=>n(!0),className:"w-full sm:w-auto whitespace-nowrap",children:"Create Combo"}),(0,l.jsxs)("div",{className:"hidden",children:[(0,l.jsx)(d.$n,{variant:"secondary",size:"sm",icon:"edit_note",loading:"cursor"===A,disabled:!!A,onClick:()=>V("cursor"),className:"w-full whitespace-nowrap",children:"Cursor Default"}),(0,l.jsx)(d.$n,{variant:"secondary",size:"sm",icon:"smart_toy",loading:"claude"===A,disabled:!!A,onClick:()=>V("claude"),className:"w-full whitespace-nowrap",children:"Claude Default"})]})]})]}),0===t.length?(0,l.jsx)(d.Zp,{children:(0,l.jsxs)("div",{className:"text-center py-12",children:[(0,l.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"layers"})}),(0,l.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No combos yet"}),(0,l.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Create model combos with fallback support"}),(0,l.jsx)(d.$n,{icon:"add",onClick:()=>n(!0),className:"w-full sm:w-auto",children:"Create Combo"})]})}):(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-2 rounded-lg border border-black/5 bg-black/[0.015] px-3 py-2 dark:border-white/5 dark:bg-white/[0.02] sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 text-xs text-text-muted hover:text-primary select-none",children:[(0,l.jsx)("input",{type:"checkbox",checked:q,ref:e=>{e&&(e.indeterminate=B&&!q)},onChange:()=>{P(q?[]:t.map(e=>e.id))},className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),(0,l.jsx)("span",{children:B?`${F.length} selected`:`Select all (${t.length})`})]}),(0,l.jsx)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:B&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"w-full min-w-[160px] sm:w-[200px]",children:(0,l.jsx)(d.l6,{options:j,value:"",placeholder:"Set strategy…",disabled:T,onChange:e=>{let t=e.target.value;t&&Y(t)},selectClassName:"py-1.5 text-xs"})}),(0,l.jsxs)(d.$n,{size:"sm",variant:"danger",icon:"delete",disabled:T,loading:T,onClick:()=>{if(0===I.length)return;let e=I.length;D({title:"Delete Selected Combos",message:`Delete ${e} selected combo${1===e?"":"s"}? This cannot be undone.`,confirmText:"Delete",variant:"danger",onConfirm:async()=>{D(e=>e?{...e,loading:!0}:null),R(!0);try{let e=I.map(e=>e.id),t=I.map(e=>e.name),l=(await Promise.all(e.map(e=>fetch(`/api/combos/${e}`,{method:"DELETE"})))).filter(e=>!e.ok).length;await W(U(t)),s(t=>t.filter(t=>!e.includes(t.id))),J(),D(null),l>0&&alert(`Deleted with ${l} failure${1===l?"":"s"}.`)}catch(e){console.log("Error bulk deleting combos:",e),alert("Failed to delete selected combos"),D(e=>e?{...e,loading:!1}:null)}finally{R(!1)}}})},className:"whitespace-nowrap",children:["Delete (",F.length,")"]}),(0,l.jsx)(d.$n,{size:"sm",variant:"ghost",onClick:J,disabled:T,children:"Clear"})]})})]}),(0,l.jsx)("div",{className:"flex flex-col gap-3",children:(e=Object.fromEntries(t.map(e=>[e.name,e.models])),t.map(t=>(0,l.jsx)(w,{combo:t,getCaps:E,comboByName:e,activeProviders:h,copied:_,onCopy:z,onEdit:()=>u(t),onDelete:()=>H(t.id),strategy:v[t.name]||{},onSetStrategy:e=>K(t.name,e),selected:F.includes(t.id),onToggleSelect:()=>{var e;return e=t.id,void P(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}},t.id)))})]}),(0,l.jsx)(N,{capacityAdapter:C,onChange:L,activeProviders:h,getCaps:E}),i&&(0,l.jsx)(S,{isOpen:i,onClose:()=>n(!1),onSave:Q,activeProviders:h},"create"),x&&(0,l.jsx)(S,{isOpen:!!x,combo:x,onClose:()=>u(null),onSave:e=>Z(x.id,e),activeProviders:h},x.id),(0,l.jsx)(d.uo,{isOpen:!!M,onClose:()=>!M?.loading&&D(null),onConfirm:M?.onConfirm,title:M?.title||"Confirm",message:M?.message,confirmText:M?.confirmText||"Confirm",variant:M?.variant||"danger",loading:!!M?.loading})]})}let v=e=>{if(!e)return"?";if(e>=1e6){let t=e/1e6;return`${Number.isInteger(t)?t:t.toFixed(1)}M`}return`${Math.round(e/1e3)}k`};function w({combo:e,getCaps:t,comboByName:s={},activeProviders:r=[],copied:o,onCopy:i,onEdit:n,onDelete:c,strategy:m={},onSetStrategy:u,selected:p=!1,onToggleSelect:h}){let[f,b]=(0,a.useState)(!1),g=m.fallbackStrategy||"fallback",y=m.judgeModel||"",N=(0,x.Q5)(e.models,s,t);return(0,l.jsxs)(d.Zp,{padding:"sm",className:`group ${p?"ring-1 ring-primary/40 bg-primary/[0.03]":""}`,children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-3 sm:items-center",children:[(0,l.jsx)("label",{className:"flex shrink-0 items-center pt-1 sm:pt-0 cursor-pointer",title:"Select combo",children:(0,l.jsx)("input",{type:"checkbox",checked:p,onChange:h,onClick:e=>e.stopPropagation(),className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary","aria-label":`Select ${e.name}`})}),(0,l.jsx)("div",{className:"size-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"})}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("code",{className:"block truncate font-mono text-sm font-medium",children:e.name}),(0,l.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1",children:[0===e.models.length?(0,l.jsx)("span",{className:"text-xs text-text-muted italic",children:"No models"}):e.models.slice(0,3).map((e,a)=>(0,l.jsxs)("code",{className:"inline-flex items-center gap-1 rounded bg-black/5 px-1.5 py-0.5 font-mono text-xs text-text-muted dark:bg-white/5",children:[(0,l.jsx)("span",{children:e}),(0,l.jsx)(d.nh,{caps:s[e]?(0,x.Q5)(s[e],s,t):t?.(e)})]},a)),e.models.length>3&&(0,l.jsxs)("span",{className:"text-[10px] text-text-muted",children:["+",e.models.length-3," more"]})]}),N&&(0,l.jsxs)("div",{className:"mt-1 flex items-center gap-2 text-[10px] text-text-muted",children:[(0,l.jsxs)("span",{children:["ctx ",v(N.contextWindow)]}),(0,l.jsx)("span",{className:"opacity-40",children:"\xb7"}),(0,l.jsxs)("span",{children:["max ",v(N.maxOutput)]})]}),"fusion"===g&&(0,l.jsxs)("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,l.jsx)("span",{className:"text-[11px] font-medium text-text-muted",children:"Judge"}),(0,l.jsxs)("button",{onClick:()=>b(!0),className:"inline-flex max-w-full items-center gap-1 rounded border border-dashed border-primary/40 px-1.5 py-0.5 font-mono text-[11px] text-primary hover:border-primary hover:bg-primary/5 transition-colors",title:"Pick the model that fuses panel answers",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"gavel"}),(0,l.jsx)("span",{className:"truncate",children:y||`Auto — ${e.models[0]||"first model"}`})]}),y&&(0,l.jsx)("button",{onClick:()=>u({judgeModel:""}),className:"p-0.5 rounded text-text-muted hover:text-red-500 hover:bg-red-500/10 transition-colors",title:"Reset judge to Auto",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"close"})})]})]})]}),(0,l.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-3 sm:shrink-0",children:[(0,l.jsx)("div",{className:"w-full sm:w-[200px]",children:(0,l.jsx)(d.l6,{options:j,value:g,onChange:e=>u({fallbackStrategy:e.target.value}),selectClassName:"py-1.5 text-xs"})}),(0,l.jsxs)("div",{className:"grid grid-cols-3 gap-1 sm:flex",children:[(0,l.jsxs)("button",{onClick:t=>{t.stopPropagation(),i(e.name,`combo-${e.id}`)},className:"flex flex-col items-center rounded px-2 py-1 text-text-muted transition-colors hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",title:"Copy combo name",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:o===`combo-${e.id}`?"check":"content_copy"}),(0,l.jsx)("span",{className:"text-[10px] leading-tight",children:"Copy"})]}),(0,l.jsxs)("button",{onClick:n,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted transition-colors hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",title:"Edit",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,l.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,l.jsxs)("button",{onClick:c,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 transition-colors hover:bg-red-500/10",title:"Delete",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,l.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]})]})]}),f&&(0,l.jsx)(d.rq,{isOpen:f,onClose:()=>b(!1),onSelect:e=>{u({judgeModel:e?.value||""}),b(!1)},activeProviders:r,title:"Select Judge Model",addedModelValues:y?[y]:[],closeOnSelect:!0})]})}function N({capacityAdapter:e,onChange:t,activeProviders:s,getCaps:a}){return(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsx)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("p",{className:"text-sm font-medium",children:"Vision Adapter"}),(0,l.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:"Your model can't read image/audio? Auto-switches to a model in the pool below."})]})}),(0,l.jsx)("div",{className:"flex flex-col gap-4",children:p.map(r=>(0,l.jsx)(k,{cap:r,entry:e[r.key]||f,onChange:s=>t({...e,[r.key]:s}),activeProviders:s,getCaps:a},r.key))})]})}function k({cap:e,entry:t,onChange:s,activeProviders:r,getCaps:o}){let[i,n]=(0,a.useState)(!1),{enabled:c,roundRobin:m,models:x}=t,u=e=>s({...t,...e}),p=(e,t)=>{let s=e+t;if(s<0||s>=x.length)return;let l=[...x];[l[e],l[s]]=[l[s],l[e]],u({models:l})};return(0,l.jsxs)(d.Zp,{padding:"sm",className:`group ${!c?"opacity-50":""}`,children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2.5 sm:items-center",children:[(0,l.jsx)(d.lM,{checked:c,onChange:e=>u({enabled:e}),"aria-label":`Enable ${e.label} adapter`}),(0,l.jsx)("div",{className:"size-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:e.icon})}),(0,l.jsx)("div",{className:"min-w-0 flex-1",children:(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)("code",{className:"font-mono text-sm font-medium",children:e.label}),(0,l.jsxs)("span",{className:"text-[10px] text-text-muted",children:["— ",e.desc]})]})})]}),(0,l.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-3 sm:shrink-0",children:[(0,l.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-text-muted cursor-pointer select-none",children:[(0,l.jsx)(d.lM,{checked:m,onChange:e=>u({roundRobin:e}),disabled:!c,"aria-label":`Round-robin ${e.label} adapter`}),(0,l.jsx)("span",{children:"Round"})]}),(0,l.jsx)(d.$n,{icon:"add",variant:"ghost",size:"sm",onClick:()=>n(!0),disabled:!c,title:`Add ${e.label} model`,children:"Add Model"})]})]}),0===x.length?(0,l.jsxs)("div",{className:"mt-3 py-2 text-center text-xs text-text-muted italic",children:["No models in pool (will fallback to ",h,")"]}):(0,l.jsx)("div",{className:"mt-3 overflow-hidden rounded-lg border border-border/50",children:(0,l.jsxs)("table",{className:"w-full text-left text-xs",children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{className:"border-b border-border/40 bg-black/[0.02] text-text-muted dark:bg-white/[0.02]",children:[(0,l.jsx)("th",{className:"w-12 px-3 py-1.5 font-medium text-center",children:"#"}),(0,l.jsx)("th",{className:"px-3 py-1.5 font-medium",children:"Model"}),(0,l.jsx)("th",{className:"w-24 px-3 py-1.5 font-medium text-center",children:"Order"}),(0,l.jsx)("th",{className:"w-12 px-3 py-1.5 font-medium text-right"})]})}),(0,l.jsx)("tbody",{className:"divide-y divide-border/30 font-mono",children:x.map((e,t)=>(0,l.jsxs)("tr",{className:"hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,l.jsxs)("td",{className:"px-3 py-2 text-center text-text-muted text-[11px] font-sans",children:["#",t+1]}),(0,l.jsx)("td",{className:"px-3 py-2 text-text-main",children:(0,l.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,l.jsx)("span",{className:"truncate",children:e}),(0,l.jsx)(d.nh,{caps:o?.(e)}),e===h&&(0,l.jsx)("span",{className:"rounded bg-emerald-500/10 px-1.5 py-0.5 font-sans text-[10px] font-medium text-emerald-600 dark:text-emerald-400",children:"free default"})]})}),(0,l.jsx)("td",{className:"px-3 py-2 text-center",children:(0,l.jsxs)("div",{className:"inline-flex items-center gap-1",children:[(0,l.jsx)("button",{type:"button",onClick:()=>p(t,-1),disabled:!c||0===t,className:`p-1 rounded transition-colors ${!c||0===t?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] leading-none",children:"arrow_upward"})}),(0,l.jsx)("button",{type:"button",onClick:()=>p(t,1),disabled:!c||t===x.length-1,className:`p-1 rounded transition-colors ${!c||t===x.length-1?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] leading-none",children:"arrow_downward"})})]})}),(0,l.jsx)("td",{className:"px-3 py-2 text-right",children:(0,l.jsx)("button",{type:"button",onClick:()=>{let e;u({models:0===(e=x.filter((e,s)=>s!==t)).length?[h]:e})},disabled:!c,className:`p-1 rounded transition-colors ${!c?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-red-500 hover:bg-red-500/10"}`,title:"Remove model",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] leading-none",children:"close"})})})]},`${e}-${t}`))})]})}),i&&(0,l.jsx)(d.rq,{isOpen:i,onClose:()=>n(!1),onSelect:e=>{let t=e?.value||e?.name||e;!t||x.includes(t)||u({models:[...x,t]})},onDeselect:e=>{let t=e?.value||e?.name||e,s=x.filter(e=>e!==t);u({models:0===s.length?[h]:s})},activeProviders:r,title:`Add ${e.label} Model`,addedModelValues:x,capFilter:e.key,closeOnSelect:!1})]})}function C({id:e,index:t,model:s,isFirst:r,isLast:n,onEdit:d,onMoveUp:c,onMoveDown:m,onRemove:x}){let{attributes:u,listeners:p,setNodeRef:h,transform:f,isDragging:b}=(0,o.gl)({id:e}),g={transform:i.Ks.Transform.toString(f),opacity:b?.4:1,zIndex:b?999:void 0},[j,y]=(0,a.useState)(!1),[v,w]=(0,a.useState)(s),N=()=>{let e=v.trim();e&&e!==s?d(e):w(s),y(!1)};return(0,l.jsxs)("div",{ref:h,style:g,className:`group flex min-w-0 items-center gap-1.5 rounded-md px-2 py-1 bg-black/[0.02] hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04] transition-colors ${b?"shadow-md ring-1 ring-primary/30":""}`,children:[(0,l.jsx)("button",{...u,...p,type:"button",className:"cursor-grab touch-none p-0.5 rounded text-text-muted hover:text-primary active:cursor-grabbing shrink-0",title:"Drag to reorder",children:(0,l.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,l.jsx)("circle",{cx:"9",cy:"4",r:"2"}),(0,l.jsx)("circle",{cx:"15",cy:"4",r:"2"}),(0,l.jsx)("circle",{cx:"9",cy:"12",r:"2"}),(0,l.jsx)("circle",{cx:"15",cy:"12",r:"2"}),(0,l.jsx)("circle",{cx:"9",cy:"20",r:"2"}),(0,l.jsx)("circle",{cx:"15",cy:"20",r:"2"})]})}),(0,l.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:t+1}),j?(0,l.jsx)("input",{autoFocus:!0,value:v,onChange:e=>w(e.target.value),onBlur:N,onKeyDown:e=>{"Enter"===e.key&&N(),"Escape"===e.key&&(w(s),y(!1))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-white px-1.5 py-0.5 font-mono text-xs text-text-main outline-none dark:bg-black/20"}):(0,l.jsx)("div",{className:"min-w-0 flex-1 cursor-text truncate rounded px-1.5 py-0.5 font-mono text-xs text-text-main hover:bg-black/5 dark:hover:bg-white/5",onClick:()=>y(!0),title:"Click to edit",children:s}),(0,l.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,l.jsx)("button",{onClick:c,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,l.jsx)("button",{onClick:m,disabled:n,className:`p-0.5 rounded ${n?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,l.jsx)("button",{onClick:x,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function S({isOpen:e,combo:t,onClose:s,onSave:i,activeProviders:c,kindFilter:m=null}){let[x,p]=(0,a.useState)(t?.name||""),[h,f]=(0,a.useState)(t?.models||[]),[b,g]=(0,a.useState)(!1),[j,y]=(0,a.useState)(!1),[v,w]=(0,a.useState)(""),[N,k]=(0,a.useState)({}),$=(0,r.FR)((0,r.MS)(r.AN,{activationConstraint:{distance:5}}),(0,r.MS)(r.uN,{coordinateGetter:o.JR})),E=h.map((e,t)=>({uid:`item-${t}`,model:e})),M=async()=>{try{let e=await fetch("/api/models/alias");if(!e.ok)return;let t=await e.json();k(t.aliases||{})}catch(e){console.error("Error fetching modal data:",e)}};(0,a.useEffect)(()=>{e&&M()},[e]);let D=e=>e.trim()?u.test(e)?(w(""),!0):(w("Only letters, numbers, -, _ and . allowed"),!1):(w("Name is required"),!1),A=async()=>{D(x)&&(y(!0),await i({name:x.trim(),models:h}),y(!1))},O=!!t;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(d.aF,{isOpen:e,onClose:s,title:O?"Edit Combo":"Create Combo",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(d.pd,{label:"Combo Name",value:x,onChange:e=>{let t=e.target.value;p(t),t?D(t):w("")},placeholder:"my-combo",error:v}),(0,l.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:"Only letters, numbers, -, _ and . allowed"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===h.length?(0,l.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,l.jsx)(r.Mp,{sensors:$,collisionDetection:r.fp,onDragEnd:e=>{let{active:t,over:s}=e;if(s&&t.id!==s.id){let e=E.findIndex(e=>e.uid===t.id),l=E.findIndex(e=>e.uid===s.id);-1!==e&&-1!==l&&f(t=>(0,o.be)(t,e,l))}},modifiers:[n.FN,n.gj],children:(0,l.jsx)(o.gB,{items:E.map(e=>e.uid),strategy:o._G,children:(0,l.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:E.map(({uid:e,model:t},s)=>(0,l.jsx)(C,{id:e,index:s,model:t,isFirst:0===s,isLast:s===E.length-1,onEdit:e=>{let t=[...h];t[s]=e,f(t)},onMoveUp:()=>(e=>{if(0===e)return;let t=[...h];[t[e-1],t[e]]=[t[e],t[e-1]],f(t)})(s),onMoveDown:()=>(e=>{if(e===h.length-1)return;let t=[...h];[t[e],t[e+1]]=[t[e+1],t[e]],f(t)})(s),onRemove:()=>{f(h.filter((e,t)=>t!==s))}},e))})})}),(0,l.jsxs)("button",{onClick:()=>g(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-primary font-medium hover:text-primary hover:border-primary/50 transition-colors flex items-center justify-center gap-1",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,l.jsx)(d.$n,{onClick:s,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,l.jsx)(d.$n,{onClick:A,fullWidth:!0,size:"sm",disabled:!x.trim()||!!v||j,children:j?"Saving...":O?"Save":"Create"})]})]})}),b&&(0,l.jsx)(d.rq,{isOpen:b,onClose:()=>g(!1),onSelect:e=>{h.includes(e.value)||f([...h,e.value])},onDeselect:e=>{f(h.filter(t=>t!==e.value))},activeProviders:c,modelAliases:N,title:"Add Model to Combo",kindFilter:m,addedModelValues:h,closeOnSelect:!1})]})}},84680:(e,t,s)=>{"use strict";s.d(t,{PM:()=>l.PM,Sj:()=>l.Sj,Vy:()=>l.Vy,fF:()=>l.fF,sl:()=>l.sl,vL:()=>l.vL,y$:()=>l.y$,zM:()=>l.zM});var l=s(44923)}},e=>{e.O(0,[763,5353,1321,705,5497,8441,3794,7358],()=>e(e.s=54295)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6099],{},_=>{_.O(0,[763,1321,705,5497,2694,8441,3794,7358],()=>_(_.s=52694)),_N_E=_.O()}]);
@@ -1,4 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8334],{22662:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>b});var a=s(95155),l=s(73321),r=s(12115),n=s(98500),i=s.n(n),o=s(35497),c=s(57250),d=s(88105);let m=/^[a-zA-Z0-9_.\-]+$/,x={webSearch:"Web Search",webFetch:"Web Fetch",image:"Text to Image",tts:"Text To Speech"},h={webSearch:"/v1/search",webFetch:"/v1/web/fetch",image:"/v1/images/generations",tts:"/v1/audio/speech"},u={webSearch:e=>({model:e,query:"What is the latest news about AI?",search_type:"web",max_results:5}),webFetch:e=>({model:e,url:"https://example.com",format:"markdown"}),image:e=>({model:e,prompt:"A cute cat playing piano",n:1,size:"1024x1024"}),tts:e=>({model:e,input:"Hello, this is a test.",voice:"alloy"})};function p(e){return"webSearch"===e||"webFetch"===e?"/dashboard/media-providers/web":`/dashboard/media-providers/${e}`}function b(){let{id:e}=(0,l.useParams)(),t=(0,l.useRouter)(),[s,n]=(0,r.useState)(null),[b,f]=(0,r.useState)(!0),[j,g]=(0,r.useState)(""),[w,y]=(0,r.useState)(""),[v,N]=(0,r.useState)([]),[k,S]=(0,r.useState)(!1),[U,$]=(0,r.useState)(!1),[C,O]=(0,r.useState)([]),[_,T]=(0,r.useState)(!1),[R,A]=(0,r.useState)(null),[L,P]=(0,r.useState)(""),[z,E]=(0,r.useState)(""),[D,F]=(0,r.useState)([]),[M,I]=(0,r.useState)({}),J=async()=>{try{let[t,s,a,l,r,i]=await Promise.all([fetch(`/api/combos/${e}`,{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"}),fetch("/api/usage/logs",{cache:"no-store"}),fetch("/api/keys",{cache:"no-store"}),fetch("/api/providers",{cache:"no-store"}),fetch("/api/models/alias",{cache:"no-store"})]);if(i.ok&&I((await i.json()).aliases||{}),l.ok){let e=await l.json();E((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}if(r.ok&&F((await r.json()).connections||[]),!t.ok){n(null),f(!1);return}let o=await t.json();n(o),g(o.name),N(o.models||[]);let c=s.ok?await s.json():{};S(c.comboStrategies?.[o.name]?.fallbackStrategy==="round-robin");let d=a.ok?await a.json():[];O(d.filter(e=>"string"==typeof e&&e.includes(o.name)).slice(0,50))}catch{}f(!1)};(0,r.useEffect)(()=>{J()},[e]);let W=e=>e.trim()?m.test(e)?(y(""),!0):(y("Only letters, numbers, -, _ and ."),!1):(y("Name is required"),!1),H=async t=>{let s=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return!!s.ok||(alert((await s.json()).error||"Failed to save"),!1)},Z=async()=>{!W(j)||j===s.name||await H({name:j})&&await J()},q=async e=>{let t=e?.value||e;if(!t||v.includes(t))return;let s=[...v,t];N(s),await H({models:s})},B=async e=>{let t=e?.value||e;if(!t||!v.includes(t))return;let s=v.filter(e=>e!==t);N(s),await H({models:s})},Y=async e=>{let t=v.filter((t,s)=>s!==e);N(t),await H({models:t})},G=async(e,t)=>{let s=[...v],a=e+t;a<0||a>=s.length||([s[e],s[a]]=[s[a],s[e]],N(s),await H({models:s}))},K=async e=>{S(e);let t=await fetch("/api/settings",{cache:"no-store"}),a={...(t.ok?await t.json():{}).comboStrategies||{}};e?a[s.name]={fallbackStrategy:"round-robin"}:delete a[s.name],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:a})})},Q=async()=>{!confirm(`Delete combo "${s.name}"?`)||(await fetch(`/api/combos/${e}`,{method:"DELETE"})).ok&&t.push(p(s.kind))},V=async()=>{if(T(!0),A(null),P(""),R?.audioUrl)try{URL.revokeObjectURL(R.audioUrl)}catch{}if(R?.imageUrl?.startsWith("blob:"))try{URL.revokeObjectURL(R.imageUrl)}catch{}let e=Date.now();try{let t=h[s.kind],a=u[s.kind](s.name),l={"Content-Type":"application/json"};z&&(l.Authorization=`Bearer ${z}`);let r=await fetch(`/api${t}`,{method:"POST",headers:l,body:JSON.stringify(a)}),n=Date.now()-e;if(!r.ok){let e=await r.json().catch(()=>({}));P(e?.error?.message||e?.error||`HTTP ${r.status}`),A({json:JSON.stringify(e,null,2),latencyMs:n});return}let i=r.headers.get("content-type")||"";if(i.startsWith("image/")){let e=await r.blob();A({imageUrl:URL.createObjectURL(e),latencyMs:n});return}if(i.startsWith("audio/")||"application/octet-stream"===i){let e=await r.blob();A({audioUrl:URL.createObjectURL(e),latencyMs:n});return}let o=await r.json(),c=o?.data?.[0],d=c?.b64_json?`data:image/png;base64,${c.b64_json}`:c?.url||"";A({json:JSON.stringify(function e(t){if(!t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(e);let s={};for(let[a,l]of Object.entries(t))s[a]="b64_json"===a&&"string"==typeof l&&l.length>100?`<${l.length} chars base64>`:e(l);return s}(o),null,2),imageUrl:d,latencyMs:n})}catch(e){P(e.message||"Network error")}T(!1)};if(b)return(0,a.jsx)("div",{className:"text-text-muted text-sm",children:"Loading..."});if(!s)return(0,l.notFound)();let X=x[s.kind]||d.rj.find(e=>e.id===s.kind)?.label||"Combo",ee=h[s.kind],et=s.kind&&u[s.kind]?u[s.kind](s.name):null,es=ee?`curl -X POST http://localhost:20128${ee} \\
2
- -H "Content-Type: application/json" \\
3
- -H "Authorization: Bearer ${z||"YOUR_KEY"}" \\
4
- -d '${JSON.stringify(et)}'`:"",ea=p(s.kind);return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,a.jsx)(i(),{href:ea,className:"text-text-muted hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined",children:"arrow_back"})}),(0,a.jsx)("div",{className:"size-10 rounded-lg bg-primary/10 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"layers"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[X," Combo"]}),(0,a.jsx)("code",{className:"text-lg font-semibold font-mono",children:s.name})]})]}),(0,a.jsx)(o.$n,{variant:"outline",icon:"delete",onClick:Q,className:"text-red-500 border-red-200 hover:bg-red-50",children:"Delete"})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Settings"}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(o.pd,{label:"Combo Name",value:j,onChange:e=>{g(e.target.value),W(e.target.value)},onBlur:Z,error:w}),(0,a.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:"Only letters, numbers, -, _ and ."})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Round Robin"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Rotate providers across requests instead of strict fallback order."})]}),(0,a.jsx)(o.lM,{checked:k,onChange:K})]})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Providers"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Tried in order (top-down) or rotated when round-robin is on."})]}),(0,a.jsx)(o.$n,{size:"sm",icon:"add",onClick:()=>$(!0),children:"Add Provider"})]}),0===v.length?(0,a.jsx)("div",{className:"text-center py-6 border border-dashed border-border rounded-lg text-text-muted text-sm",children:"No providers yet."}):(0,a.jsx)("div",{className:"flex flex-col gap-2",children:v.map((e,t)=>{let{providerId:s,model:l}=function(e){if("string"!=typeof e)return{providerId:"",model:""};let t=e.indexOf("/");return t<0?{providerId:e,model:""}:{providerId:e.slice(0,t),model:e.slice(t+1)}}(e),r=d.Q2[s];return(0,a.jsxs)("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-black/[0.02] dark:bg-white/[0.02]",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted w-5 text-center",children:t+1}),(0,a.jsx)(c.A,{src:`/providers/${s}.png`,alt:r?.name||s,size:24,className:"object-contain rounded shrink-0",fallbackText:r?.textIcon||s.slice(0,2).toUpperCase(),fallbackColor:r?.color}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"text-sm font-medium truncate",children:r?.name||s}),l&&(0,a.jsx)("code",{className:"text-[10px] text-text-muted font-mono truncate block",children:l})]}),(0,a.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,a.jsx)("button",{onClick:()=>G(t,-1),disabled:0===t,className:`p-1 rounded ${0===t?"text-text-muted/20":"text-text-muted hover:text-primary hover:bg-black/5"}`,title:"Move up",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_upward"})}),(0,a.jsx)("button",{onClick:()=>G(t,1),disabled:t===v.length-1,className:`p-1 rounded ${t===v.length-1?"text-text-muted/20":"text-text-muted hover:text-primary hover:bg-black/5"}`,title:"Move down",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_downward"})}),(0,a.jsx)("button",{onClick:()=>Y(t),className:"p-1 rounded text-text-muted hover:text-red-500 hover:bg-red-500/10",title:"Remove",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]})]},`${e}-${t}`)})})]}),s.kind&&ee&&(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Test Example"}),(0,a.jsx)(o.$n,{size:"sm",icon:"play_arrow",onClick:V,disabled:_||0===v.length,children:_?"Running...":"Run"})]}),(0,a.jsx)("pre",{className:"text-xs font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-x-auto whitespace-pre-wrap break-all",children:es}),L&&(0,a.jsx)("p",{className:"mt-3 text-xs text-red-500 break-words",children:L}),R&&(0,a.jsxs)("div",{className:"mt-3 flex flex-col gap-3",children:[null!=R.latencyMs&&(0,a.jsxs)("span",{className:"text-[11px] text-text-muted",children:["⚡ ",R.latencyMs,"ms"]}),R.imageUrl&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,a.jsxs)("a",{href:R.imageUrl,download:"image.png",className:"inline-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-[14px]",children:"download"}),"Download"]})}),(0,a.jsx)("img",{src:R.imageUrl,alt:"Generated",className:"max-w-full rounded-lg border border-border",loading:"lazy",decoding:"async"})]}),R.audioUrl&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,a.jsxs)("a",{href:R.audioUrl,download:"speech.mp3",className:"inline-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-[14px]",children:"download"}),"Download"]})}),(0,a.jsx)("audio",{controls:!0,src:R.audioUrl,className:"w-full"})]}),R.json&&(0,a.jsx)("pre",{className:"text-xs font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-auto max-h-[300px] whitespace-pre-wrap break-all",children:R.json})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Usage Logs"}),0===C.length?(0,a.jsx)("p",{className:"text-xs text-text-muted italic",children:"No usage yet."}):(0,a.jsx)("pre",{className:"text-[11px] font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-auto max-h-[400px] whitespace-pre-wrap",children:C.join("\n")})]}),U&&(0,a.jsx)(o.rq,{isOpen:U,onClose:()=>$(!1),onSelect:q,onDeselect:B,activeProviders:D,modelAliases:M,title:`Add ${X} Model`,kindFilter:s.kind,addedModelValues:v,closeOnSelect:!1})]})}},85700:(e,t,s)=>{Promise.resolve().then(s.bind(s,22662))}},e=>{e.O(0,[763,1321,705,5497,8441,3794,7358],()=>e(e.s=85700)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6337],{},_=>{_.O(0,[763,1321,705,5497,2694,8441,3794,7358],()=>_(_.s=52694)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3471],{40939:(e,t,s)=>{Promise.resolve().then(s.bind(s,64561))},64561:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>p});var a=s(95155),r=s(12115),l=s(35497),i=s(81127),o=s(21931),n=s(1620),d=s(31474),c=s(90620),m=s(93308),x=s(38202);function p(){let{theme:e,setTheme:t,isDark:s}=(0,n.D)(),[p,u]=(0,r.useState)(()=>(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${m.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,m.QC)(t)})()),[h,b]=(0,r.useState)(!1),[g,f]=(0,r.useState)(!1),[y,j]=(0,r.useState)(!1),[N,w]=(0,r.useState)({fallbackStrategy:"fill-first"}),[v,S]=(0,r.useState)(!0),[C,k]=(0,r.useState)({current:"",new:"",confirm:""}),[L,I]=(0,r.useState)({type:"",message:""}),[A,P]=(0,r.useState)(!1),[O,M]=(0,r.useState)(!1),[E,R]=(0,r.useState)({type:"",message:""}),[D,T]=(0,r.useState)({open:!1,mode:"",password:""}),U=(0,r.useRef)(null),[$,F]=(0,r.useState)({authMode:"password",oidcIssuerUrl:"",oidcClientId:"",oidcScopes:"openid profile email",oidcLoginLabel:"Sign in with OIDC"}),[q,_]=(0,r.useState)(""),[J,X]=(0,r.useState)({type:"",message:""}),[H,z]=(0,r.useState)(!1),[B,K]=(0,r.useState)(!1),[W,Z]=(0,r.useState)({type:"",message:""}),[Q,G]=(0,r.useState)(!1),V=window.location.origin,Y=V?`${V}/api/auth/oidc/callback`:"/api/auth/oidc/callback",ee=V?`${V}/api/auth/saml/acs`:"/api/auth/saml/acs",et=V?`${V}/api/auth/saml/metadata`:"/api/auth/saml/metadata",[es,ea]=(0,r.useState)("saml"),[er,el]=(0,r.useState)({samlEntryPoint:"",samlIssuer:"urn:9router:sp",samlCert:"",samlLoginLabel:"Sign in with SAML SSO",samlAttributeEmail:"email",samlAttributeName:"name"}),[ei,eo]=(0,r.useState)({type:"",message:""}),[en,ed]=(0,r.useState)(!1),[ec,em]=(0,r.useState)(!1),[ex,ep]=(0,r.useState)({type:"",message:""}),[eu,eh]=(0,r.useState)(!1),eb=(0,r.useRef)(null),eg=(0,r.useRef)(null),ef=(0,r.useRef)(null),[ey,ej]=(0,r.useState)({outboundProxyEnabled:!1,outboundProxyUrl:"",outboundNoProxy:""}),[eN,ew]=(0,r.useState)({type:"",message:""}),[ev,eS]=(0,r.useState)(!1),[eC,ek]=(0,r.useState)(!1),[eL,eI]=(0,r.useState)(!1);(0,r.useEffect)(()=>{eI(!["localhost","127.0.0.1","::1"].includes(window.location.hostname))},[]),(0,r.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{w(e),F({authMode:e?.authMode||"password",oidcIssuerUrl:e?.oidcIssuerUrl||"",oidcClientId:e?.oidcClientId||"",oidcScopes:e?.oidcScopes||"openid profile email",oidcLoginLabel:e?.oidcLoginLabel||"Sign in with OIDC"}),_(""),ea(e?.ssoType||"saml"),el({samlEntryPoint:e?.samlEntryPoint||"",samlIssuer:e?.samlIssuer||"urn:9router:sp",samlCert:e?.samlCert||"",samlLoginLabel:e?.samlLoginLabel||"Sign in with SAML SSO",samlAttributeEmail:e?.samlAttributeEmail||"email",samlAttributeName:e?.samlAttributeName||"name"}),(e?.authMode==="sso"||e?.authMode==="saml"||e?.authMode==="oidc"||e?.authMode==="both")&&G(!0),ej({outboundProxyEnabled:e?.outboundProxyEnabled===!0,outboundProxyUrl:e?.outboundProxyUrl||"",outboundNoProxy:e?.outboundNoProxy||""}),S(!1)}).catch(e=>{console.error("Failed to fetch settings:",e),S(!1)})},[]);let eA=async e=>{if(e.preventDefault(),!0===N.outboundProxyEnabled){eS(!0),ew({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({outboundProxyUrl:ey.outboundProxyUrl,outboundNoProxy:ey.outboundNoProxy})}),t=await e.json();e.ok?(w(e=>({...e,...t})),ew({type:"success",message:"Proxy settings applied"})):ew({type:"error",message:t.error||"Failed to update proxy settings"})}catch(e){ew({type:"error",message:"An error occurred"})}finally{eS(!1)}}},eP=async()=>{if(!0!==N.outboundProxyEnabled)return;let e=(ey.outboundProxyUrl||"").trim();if(!e)return void ew({type:"error",message:"Please enter a Proxy URL to test"});ek(!0),ew({type:"",message:""});try{let t=await fetch("/api/settings/proxy-test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyUrl:e})}),s=await t.json();t.ok&&s?.ok?ew({type:"success",message:`Proxy test OK (${s.status}) in ${s.elapsedMs}ms`}):ew({type:"error",message:s?.error||"Proxy test failed"})}catch(e){ew({type:"error",message:"An error occurred"})}finally{ek(!1)}},eO=async e=>{eS(!0),ew({type:"",message:""});try{let t=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({outboundProxyEnabled:e})}),s=await t.json();t.ok?(w(e=>({...e,...s})),ej(e=>({...e,outboundProxyEnabled:s?.outboundProxyEnabled===!0})),ew({type:"success",message:e?"Proxy enabled":"Proxy disabled"})):ew({type:"error",message:s.error||"Failed to update proxy settings"})}catch(e){ew({type:"error",message:"An error occurred"})}finally{eS(!1)}},eM=async e=>{if(e.preventDefault(),C.new!==C.confirm)return void I({type:"error",message:"Passwords do not match"});P(!0),I({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:C.current,newPassword:C.new})}),t=await e.json();e.ok?(I({type:"success",message:"Password updated successfully"}),k({current:"",new:"",confirm:""})):I({type:"error",message:t.error||"Failed to update password"})}catch(e){I({type:"error",message:"An error occurred"})}finally{P(!1)}},eE=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({fallbackStrategy:e})})).ok&&w(t=>({...t,fallbackStrategy:e}))}catch(e){console.error("Failed to update settings:",e)}},eR=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategy:e})})).ok&&w(t=>({...t,comboStrategy:e}))}catch(e){console.error("Failed to update combo strategy:",e)}},eD=async e=>{let t=parseInt(e);if(!isNaN(t)&&!(t<1))try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({stickyRoundRobinLimit:t})})).ok&&w(e=>({...e,stickyRoundRobinLimit:t}))}catch(e){console.error("Failed to update sticky limit:",e)}},eT=async e=>{let t=parseInt(e);if(!isNaN(t)&&!(t<1))try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStickyRoundRobinLimit:t})})).ok&&w(e=>({...e,comboStickyRoundRobinLimit:t}))}catch(e){console.error("Failed to update combo sticky limit:",e)}},eU=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireLogin:e})})).ok&&w(t=>({...t,requireLogin:e}))}catch(e){console.error("Failed to update require login:",e)}},e$=(e,t)=>{F(s=>({...s,[e]:t}))},eF=async(e=$.authMode||"password")=>{let t=$.oidcIssuerUrl.trim(),s=$.oidcClientId.trim(),a=$.oidcScopes.trim(),r=$.oidcLoginLabel.trim(),l=q.trim();if("password"!==e&&(!t||!s||!l)&&!N.oidcConfigured)return void X({type:"error",message:"Issuer URL, client ID, and client secret are required to enable OIDC."});z(!0),X({type:"",message:""}),Z({type:"",message:""});try{let i={authMode:e,ssoType:"oidc",oidcIssuerUrl:t,oidcClientId:s,oidcScopes:a||"openid profile email",oidcLoginLabel:r||"Sign in with OIDC"};l&&(i.oidcClientSecret=l);let o=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}),n=await o.json();o.ok?(w(e=>({...e,...n})),F({authMode:n?.authMode||e,oidcIssuerUrl:n?.oidcIssuerUrl||t,oidcClientId:n?.oidcClientId||s,oidcScopes:n?.oidcScopes||a||"openid profile email",oidcLoginLabel:n?.oidcLoginLabel||r||"Sign in with OIDC"}),_(""),X({type:"success",message:"oidc"===e?"OIDC login enabled":"both"===e?"Password and OIDC login enabled":"OIDC settings saved"})):X({type:"error",message:n.error||"Failed to save OIDC settings"})}catch(e){X({type:"error",message:"An error occurred"})}finally{z(!1)}},eq=async()=>{let e=$.oidcIssuerUrl.trim(),t=$.oidcClientId.trim(),s=$.oidcScopes.trim(),a=q.trim();if(!e||!t)return void Z({type:"error",message:"Issuer URL and client ID are required to test the connection."});K(!0),X({type:"",message:""}),Z({type:"",message:""});try{let r=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({authMode:$.authMode||N.authMode||"password",oidcIssuerUrl:e,oidcClientId:t,oidcScopes:s||"openid profile email",oidcLoginLabel:$.oidcLoginLabel.trim()||"Sign in with OIDC",...a?{oidcClientSecret:a}:{}})}),l=await r.json().catch(()=>({}));if(!r.ok)return void Z({type:"error",message:l.error||"Failed to save OIDC settings before testing"});let i=await fetch("/api/auth/oidc/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issuerUrl:l.oidcIssuerUrl||e,clientId:l.oidcClientId||t,scopes:l.oidcScopes||s||"openid profile email"})}),o=await i.json().catch(()=>({}));if(i.ok&&o?.ok){let e=o.clientSecretTested?!0===o.clientSecretValid?`Connection OK. Discovery loaded from ${o.issuerUrl}. Client secret validated too.`:`Connection OK. Discovery loaded from ${o.issuerUrl}. Client secret was not checked.`:`Connection OK. Discovery loaded from ${o.issuerUrl}.`;Z({type:"success",message:e})}else Z({type:"error",message:o.error||"OIDC connection test failed"})}catch(e){Z({type:"error",message:"An error occurred"})}finally{K(!1)}},e_=(e,t)=>{el(s=>({...s,[e]:t}))},eJ=async(e=$.authMode||"password")=>{ed(!0),eo({type:"",message:""}),ep({type:"",message:""});try{let t={authMode:e,ssoType:"saml",samlEntryPoint:er.samlEntryPoint.trim(),samlIssuer:er.samlIssuer.trim()||"urn:9router:sp",samlCert:er.samlCert.trim(),samlLoginLabel:er.samlLoginLabel.trim()||"Sign in with SAML SSO",samlAttributeEmail:er.samlAttributeEmail.trim()||"email",samlAttributeName:er.samlAttributeName.trim()||"name"},s=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),a=await s.json();s.ok?(w(e=>({...e,...a})),el({samlEntryPoint:a?.samlEntryPoint||t.samlEntryPoint,samlIssuer:a?.samlIssuer||t.samlIssuer,samlCert:a?.samlCert||t.samlCert,samlLoginLabel:a?.samlLoginLabel||t.samlLoginLabel,samlAttributeEmail:a?.samlAttributeEmail||t.samlAttributeEmail,samlAttributeName:a?.samlAttributeName||t.samlAttributeName}),eo({type:"success",message:"sso"===e||"saml"===e?"SAML SSO login enabled":"both"===e?"Password and SAML SSO login enabled":"SAML 2.0 settings saved"})):eo({type:"error",message:a.error||"Failed to save SAML settings"})}catch{eo({type:"error",message:"An error occurred while saving SAML settings"})}finally{ed(!1)}},eX=async()=>{em(!0),eo({type:"",message:""}),ep({type:"",message:""});try{let e=await fetch("/api/auth/saml/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({samlEntryPoint:er.samlEntryPoint.trim(),samlIssuer:er.samlIssuer.trim(),samlCert:er.samlCert.trim()})}),t=await e.json();e.ok&&t.ok?ep({type:"success",message:t.message||"SAML configuration verified!"}):ep({type:"error",message:t.error||"SAML configuration test failed"})}catch{ep({type:"error",message:"An error occurred while testing SAML configuration"})}finally{em(!1)}},eH=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({enableObservability:e})})).ok&&w(t=>({...t,enableObservability:e}))}catch(e){console.error("Failed to update enableObservability:",e)}},ez=async()=>{try{let e=await fetch("/api/settings");if(!e.ok)return;let t=await e.json();w(t)}catch(e){console.error("Failed to reload settings:",e)}},eB=async e=>{M(!0),R({type:"",message:""});try{let t=await fetch("/api/settings/database",{headers:{"x-9r-password":e}});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||"Failed to export database")}let s=await t.json(),a=JSON.stringify(s,null,2),r=new Blob([a],{type:"application/json"}),l=URL.createObjectURL(r),i=document.createElement("a"),o=new Date().toISOString().replace(/[.:]/g,"-");i.href=l,i.download=`9router-backup-${o}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(l),R({type:"success",message:"Database backup downloaded"})}catch(e){R({type:"error",message:e.message||"Failed to export database"})}finally{M(!1)}},eK=async e=>{let t=U.current;if(t){M(!0);try{let s=await t.text(),a=JSON.parse(s),r=await fetch("/api/settings/database",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,password:e})}),l=await r.json().catch(()=>({}));if(!r.ok)throw Error(l.error||"Failed to import database");await ez(),R({type:"success",message:"Database imported successfully"})}catch(e){R({type:"error",message:e.message||"Invalid backup file"})}finally{U.current=null,M(!1)}}},eW=async()=>{let{mode:e,password:t}=D;T({open:!1,mode:"",password:""}),"export"===e?await eB(t):"import"===e&&await eK(t)},eZ=!0===N.enableObservability,eQ=async()=>{j(!0);try{await fetch("/api/version/shutdown",{method:"POST"})}catch(e){}j(!1),f(!1)},eG=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&window.location.assign("/login")}catch(e){console.error("Failed to logout:",e)}};return(0,a.jsxs)("div",{className:"max-w-2xl mx-auto px-4 sm:px-0",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"size-10 sm:size-12 rounded-lg bg-green-500/10 text-green-500 flex items-center justify-center shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-xl sm:text-2xl",children:"computer"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg sm:text-xl font-semibold",children:"Local Mode"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Running on your machine"})]})]}),(0,a.jsx)("div",{className:"inline-flex p-1 rounded-lg bg-black/5 dark:bg-white/5 w-full sm:w-auto",children:["light","dark","system"].map(s=>(0,a.jsxs)("button",{type:"button",onClick:()=>t(s),className:(0,d.cn)("flex items-center justify-center gap-1 sm:gap-1.5 px-2 sm:px-3 py-1.5 rounded-md font-medium transition-all flex-1 sm:flex-initial",e===s?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"light"===s?"light_mode":"dark"===s?"dark_mode":"contrast"}),(0,a.jsx)("span",{className:"capitalize text-xs sm:text-sm",children:s})]},s))})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 pt-4 border-t border-border",children:[(0,a.jsx)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-3 rounded-lg bg-bg border border-border gap-2",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Database Location"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted font-mono break-all",children:"~/.9router/db/data.sqlite"})]})}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsx)(l.$n,{variant:"secondary",icon:"download",onClick:()=>T({open:!0,mode:"export",password:""}),loading:O,className:"w-full sm:w-auto",children:"Download Backup"}),(0,a.jsx)(l.$n,{variant:"outline",icon:"upload",onClick:()=>ef.current?.click(),disabled:O,className:"w-full sm:w-auto",children:"Import Backup"}),(0,a.jsx)("input",{ref:ef,type:"file",accept:"application/json,.json",className:"hidden",onChange:e=>{let t=e.target.files?.[0];ef.current&&(ef.current.value=""),t&&(U.current=t,R({type:"",message:""}),T({open:!0,mode:"import",password:""}))}})]}),E.message&&(0,a.jsx)("p",{className:`text-sm ${"error"===E.type?"text-red-500":"text-green-600 dark:text-green-400"}`,children:E.message})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"size-10 rounded-lg bg-blue-500/10 text-blue-500 flex items-center justify-center shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"language"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Language"})]}),(0,a.jsxs)("button",{onClick:()=>b(!0),className:"flex items-center justify-between w-full p-3 rounded-lg bg-bg border border-border hover:border-primary/50 transition-colors","data-i18n-skip":"true",children:[(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"Display language"}),(0,a.jsx)("span",{className:"text-2xl",children:x.h[p]||"\uD83C\uDF10"})]})]}),(0,a.jsxs)(l.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 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"shield"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Security"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Require login"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"When ON, dashboard requires password. When OFF, access without login."})]}),(0,a.jsx)(l.lM,{checked:!0===N.requireLogin,onChange:()=>eU(!N.requireLogin),disabled:v})]}),!0===N.requireLogin&&(0,a.jsxs)("form",{onSubmit:eM,className:"flex flex-col gap-4 pt-4 border-t border-border/50",children:[N.hasPassword&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-xs sm:text-sm font-medium",children:"Current Password"}),(0,a.jsx)(l.pd,{type:"password",placeholder:"Enter current password",value:C.current,onChange:e=>k({...C,current:e.target.value}),required:!0})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-xs sm:text-sm font-medium",children:"New Password"}),(0,a.jsx)(l.pd,{type:"password",placeholder:"Enter new password",value:C.new,onChange:e=>k({...C,new:e.target.value}),required:!0})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-xs sm:text-sm font-medium",children:"Confirm New Password"}),(0,a.jsx)(l.pd,{type:"password",placeholder:"Confirm new password",value:C.confirm,onChange:e=>k({...C,confirm:e.target.value}),required:!0})]})]}),L.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===L.type?"text-red-500":"text-green-500"}`,children:L.message}),(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsx)(l.$n,{type:"submit",variant:"primary",loading:A,className:"w-full sm:w-auto",children:N.hasPassword?"Update Password":"Set Password"})})]})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("button",{type:"button",onClick:()=>G(e=>!e),className:"w-full flex items-center gap-3 text-left",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-indigo-500/10 text-indigo-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"lock_open"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Single Sign-On (SSO)"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"sso"===N.authMode||"oidc"===N.authMode||"saml"===N.authMode?`${"saml"===N.ssoType?"SAML 2.0":"OIDC"} SSO active`:"both"===N.authMode?`Password + ${"saml"===N.ssoType?"SAML 2.0":"OIDC"} active`:"Optional SSO via Okta, Entra ID, Keycloak, or OIDC"})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted shrink-0",children:Q?"expand_less":"expand_more"})]}),Q&&(0,a.jsxs)("div",{className:"flex flex-col gap-4 mt-4",children:[(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Configure enterprise Single Sign-On (SSO) for dashboard access using SAML 2.0 or OIDC."}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"SSO Protocol"}),(0,a.jsxs)("div",{className:"flex p-1 rounded-lg bg-black/5 dark:bg-white/5 border border-border",children:[(0,a.jsx)("button",{type:"button",onClick:()=>ea("saml"),className:(0,d.cn)("flex-1 py-1.5 px-3 rounded-md font-medium text-xs sm:text-sm transition-all text-center","saml"===es?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:"SAML 2.0"}),(0,a.jsx)("button",{type:"button",onClick:()=>ea("oidc"),className:(0,d.cn)("flex-1 py-1.5 px-3 rounded-md font-medium text-xs sm:text-sm transition-all text-center","oidc"===es?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:"OIDC"})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Auth Mode"}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:[{value:"password",title:"Password only",desc:"Keep legacy password login."},{value:"sso",title:`${"saml"===es?"SAML":"OIDC"} only`,desc:"Require SSO for dashboard access."},{value:"both",title:"Both",desc:"Allow password or SSO login."}].map(e=>{let t=$.authMode,s="password"===e.value?"password"===t:"sso"===e.value?"sso"===t||"saml"===t||"oidc"===t:"both"===t;return(0,a.jsxs)("button",{type:"button",onClick:()=>e$("authMode",e.value),className:(0,d.cn)("text-left rounded-lg border p-3 transition-colors",s?"border-primary bg-primary/5":"border-border bg-bg hover:bg-black/5 dark:hover:bg-white/5"),disabled:v||H||en,children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:e.title}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted mt-1",children:e.desc})]},e.value)})})]}),"saml"===es?(0,a.jsxs)("div",{className:"flex flex-col gap-4 pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-bg/80 overflow-hidden",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>eh(e=>!e),className:"w-full p-3 flex items-center justify-between gap-2 text-left hover:bg-surface/50 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-lg",children:"menu_book"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-semibold text-xs sm:text-sm text-text-main",children:"IdP Setup Guidelines & Provider Configuration Instructions"}),(0,a.jsx)("p",{className:"text-[11px] text-text-muted",children:"Click to view setup steps for AWS IAM Identity Center, Okta, Entra ID, Keycloak, & Authentik"})]})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted transition-transform text-lg",style:{transform:eu?"rotate(180deg)":"none"},children:"expand_more"})]}),eu&&(0,a.jsxs)("div",{className:"p-4 border-t border-border bg-surface/30 text-xs text-text-main flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"p-2.5 rounded border border-primary/20 bg-primary/5 text-primary text-xs",children:[(0,a.jsx)("p",{className:"font-semibold mb-1",children:"\uD83D\uDD11 Required Service Provider (SP) Values for your IdP Setup:"}),(0,a.jsxs)("ul",{className:"list-disc pl-4 space-y-1 font-mono text-[11px]",children:[(0,a.jsxs)("li",{children:[(0,a.jsx)("b",{children:"Assertion Consumer Service (ACS) URL:"})," ",(0,a.jsx)("code",{className:"bg-bg px-1 py-0.5 rounded break-all",children:ee})]}),(0,a.jsxs)("li",{children:[(0,a.jsx)("b",{children:"SP Entity ID / Audience URI:"})," ",(0,a.jsx)("code",{className:"bg-bg px-1 py-0.5 rounded break-all",children:er.samlIssuer||"urn:9router:sp"})]}),(0,a.jsxs)("li",{children:[(0,a.jsx)("b",{children:"NameID Format:"})," ",(0,a.jsx)("code",{className:"bg-bg px-1 py-0.5 rounded",children:"EmailAddress"})," or ",(0,a.jsx)("code",{className:"bg-bg px-1 py-0.5 rounded",children:"Unspecified"})]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 pt-1",children:[(0,a.jsxs)("div",{className:"p-3 rounded border border-border bg-bg/50 flex flex-col gap-1.5",children:[(0,a.jsxs)("p",{className:"font-semibold text-text-main flex items-center gap-1.5",children:[(0,a.jsx)("span",{children:"☁️"})," AWS IAM Identity Center"]}),(0,a.jsxs)("ol",{className:"list-decimal pl-4 text-text-muted space-y-1",children:[(0,a.jsxs)("li",{children:["Applications → ",(0,a.jsx)("b",{children:"Add application"})," → Select ",(0,a.jsx)("b",{children:"Add custom SAML 2.0 application"}),"."]}),(0,a.jsxs)("li",{children:["Set ",(0,a.jsx)("b",{children:"Application ACS URL"})," to ",(0,a.jsx)("code",{className:"text-text-main font-mono",children:ee}),"."]}),(0,a.jsxs)("li",{children:["Set ",(0,a.jsx)("b",{children:"Application SAML audience"})," to ",(0,a.jsx)("code",{className:"text-text-main font-mono",children:er.samlIssuer||"urn:9router:sp"}),"."]}),(0,a.jsxs)("li",{children:["Under ",(0,a.jsx)("i",{children:"Attribute mappings"}),", map ",(0,a.jsx)("code",{className:"text-text-main font-mono",children:"Subject"})," or ",(0,a.jsx)("code",{className:"text-text-main font-mono",children:"email"})," to ",(0,a.jsxs)("code",{className:"text-text-main font-mono",children:["$","{user:email}"]}),"."]}),(0,a.jsxs)("li",{children:["Download ",(0,a.jsx)("b",{children:"IAM Identity Center SAML metadata XML"})," file and use 1-Click Import below!"]})]})]}),(0,a.jsxs)("div",{className:"p-3 rounded border border-border bg-bg/50 flex flex-col gap-1.5",children:[(0,a.jsxs)("p",{className:"font-semibold text-text-main flex items-center gap-1.5",children:[(0,a.jsx)("span",{children:"\uD83D\uDD37"})," Microsoft Entra ID (Azure AD)"]}),(0,a.jsxs)("ol",{className:"list-decimal pl-4 text-text-muted space-y-1",children:[(0,a.jsxs)("li",{children:["Enterprise Applications → ",(0,a.jsx)("b",{children:"New application"})," → ",(0,a.jsx)("b",{children:"Create your own application"}),"."]}),(0,a.jsxs)("li",{children:["Select ",(0,a.jsx)("b",{children:"Single sign-on"})," → ",(0,a.jsx)("b",{children:"SAML"}),"."]}),(0,a.jsxs)("li",{children:[(0,a.jsx)("b",{children:"Identifier (Entity ID):"})," ",(0,a.jsx)("code",{className:"text-text-main font-mono",children:er.samlIssuer||"urn:9router:sp"})]}),(0,a.jsxs)("li",{children:[(0,a.jsx)("b",{children:"Reply URL (ACS):"})," ",(0,a.jsx)("code",{className:"text-text-main font-mono",children:ee})]}),(0,a.jsxs)("li",{children:["Download ",(0,a.jsx)("b",{children:"Federation Metadata XML"})," and import or copy X.509 Certificate."]})]})]}),(0,a.jsxs)("div",{className:"p-3 rounded border border-border bg-bg/50 flex flex-col gap-1.5",children:[(0,a.jsxs)("p",{className:"font-semibold text-text-main flex items-center gap-1.5",children:[(0,a.jsx)("span",{children:"\uD83D\uDFE2"})," Okta / Auth0"]}),(0,a.jsxs)("ol",{className:"list-decimal pl-4 text-text-muted space-y-1",children:[(0,a.jsxs)("li",{children:["Applications → ",(0,a.jsx)("b",{children:"Create App Integration"})," → Select ",(0,a.jsx)("b",{children:"SAML 2.0"}),"."]}),(0,a.jsxs)("li",{children:[(0,a.jsx)("b",{children:"Single Sign-On URL:"})," ",(0,a.jsx)("code",{className:"text-text-main font-mono",children:ee})]}),(0,a.jsxs)("li",{children:[(0,a.jsx)("b",{children:"Audience URI (SP Entity ID):"})," ",(0,a.jsx)("code",{className:"text-text-main font-mono",children:er.samlIssuer||"urn:9router:sp"})]}),(0,a.jsxs)("li",{children:["Name ID format: ",(0,a.jsx)("i",{children:"EmailAddress"}),"."]}),(0,a.jsx)("li",{children:"Download Identity Provider metadata XML or copy the X.509 cert."})]})]}),(0,a.jsxs)("div",{className:"p-3 rounded border border-border bg-bg/50 flex flex-col gap-1.5",children:[(0,a.jsxs)("p",{className:"font-semibold text-text-main flex items-center gap-1.5",children:[(0,a.jsx)("span",{children:"\uD83D\uDEE1️"})," Keycloak / Authentik"]}),(0,a.jsxs)("ol",{className:"list-decimal pl-4 text-text-muted space-y-1",children:[(0,a.jsxs)("li",{children:["Clients → ",(0,a.jsx)("b",{children:"Create client"})," → Select ",(0,a.jsx)("b",{children:"SAML"}),"."]}),(0,a.jsxs)("li",{children:[(0,a.jsx)("b",{children:"Client ID:"})," ",(0,a.jsx)("code",{className:"text-text-main font-mono",children:er.samlIssuer||"urn:9router:sp"})]}),(0,a.jsxs)("li",{children:[(0,a.jsx)("b",{children:"Master SAML Processing URL:"})," ",(0,a.jsx)("code",{className:"text-text-main font-mono",children:ee})]}),(0,a.jsx)("li",{children:"Export SAML Descriptor XML or copy IDP Certificate PEM."})]})]})]})]})]}),(0,a.jsxs)("div",{className:"p-3 rounded-lg border border-dashed border-primary/40 bg-primary/5 flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-sm text-text-main",children:"1-Click IdP Metadata XML Import"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Auto-fill SSO URL, Issuer & Cert from XML metadata"})]}),(0,a.jsx)(l.$n,{type:"button",variant:"outline",size:"sm",icon:"upload_file",onClick:()=>eb.current?.click(),children:"Upload Metadata XML"}),(0,a.jsx)("input",{ref:eb,type:"file",accept:".xml,application/xml,text/xml",className:"hidden",onChange:e=>{let t=e.target.files?.[0];if(eb.current&&(eb.current.value=""),!t)return;let s=new FileReader;s.onload=e=>{try{let t=e.target?.result||"",s=new DOMParser().parseFromString(t,"text/xml");if(s.querySelector("parsererror"))return void eo({type:"error",message:"Unable to parse valid SAML IdP metadata from XML file"});let a=s.documentElement.getAttribute("entityID")||"",r=Array.from(s.querySelectorAll("SingleSignOnService, *|SingleSignOnService")),l="";for(let e of r){let t=e.getAttribute("Binding")||"",s=e.getAttribute("Location")||"";if(s&&(l=s,t.includes("HTTP-Redirect")))break}let i=Array.from(s.querySelectorAll("X509Certificate, *|X509Certificate")),o="";i.length>0&&(o=i[0].textContent.trim()),el(e=>({...e,samlEntryPoint:l||e.samlEntryPoint,samlIssuer:e.samlIssuer||"urn:9router:sp",samlCert:o||e.samlCert})),eo({type:"success",message:`IdP Metadata imported! (SSO URL: ${l?"found":"not found"}, EntityID: ${a?"found":"not found"}, Cert: ${o?"found":"not found"})`})}catch(e){eo({type:"error",message:"Error reading IdP Metadata XML file"})}},s.readAsText(t)}})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Single Sign-On Service URL (samlEntryPoint)"}),(0,a.jsx)(l.pd,{placeholder:"https://idp.example.com/app/saml/sso/...",value:er.samlEntryPoint,onChange:e=>e_("samlEntryPoint",e.target.value),disabled:v||en})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"SP Entity ID / Audience (samlIssuer)"}),(0,a.jsx)(l.pd,{placeholder:"urn:9router:sp",value:er.samlIssuer,onChange:e=>e_("samlIssuer",e.target.value),disabled:v||en})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"IdP X.509 Certificate (samlCert)"}),(0,a.jsx)(l.$n,{type:"button",variant:"outline",size:"sm",icon:"file_upload",onClick:()=>eg.current?.click(),children:"Upload Certificate"}),(0,a.jsx)("input",{ref:eg,type:"file",accept:".crt,.pem,.cer,text/plain",className:"hidden",onChange:e=>{let t=e.target.files?.[0];if(eg.current&&(eg.current.value=""),!t)return;let s=new FileReader;s.onload=e=>{let t=e.target?.result||"";el(e=>({...e,samlCert:t.trim()})),eo({type:"success",message:"Certificate file loaded into configuration."})},s.readAsText(t)}})]}),(0,a.jsx)("textarea",{rows:4,placeholder:"-----BEGIN CERTIFICATE-----\nMIIC...\n-----END CERTIFICATE-----",value:er.samlCert,onChange:e=>e_("samlCert",e.target.value),className:"w-full p-2.5 rounded-lg border border-border bg-bg text-xs font-mono text-text-main focus:outline-none focus:border-primary",disabled:v||en}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Paste raw Base64 certificate or PEM block."})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Login Button Label"}),(0,a.jsx)(l.pd,{placeholder:"Sign in with SAML SSO",value:er.samlLoginLabel,onChange:e=>e_("samlLoginLabel",e.target.value),disabled:v||en})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Email Claim Attribute"}),(0,a.jsx)(l.pd,{placeholder:"email",value:er.samlAttributeEmail,onChange:e=>e_("samlAttributeEmail",e.target.value),disabled:v||en})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Display Name Claim"}),(0,a.jsx)(l.pd,{placeholder:"name",value:er.samlAttributeName,onChange:e=>e_("samlAttributeName",e.target.value),disabled:v||en})]})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 p-3 rounded-lg border border-border bg-bg text-xs sm:text-sm text-text-muted",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-text-main",children:"ACS Callback URL"}),(0,a.jsx)("code",{className:"block break-all font-mono text-xs",children:ee})]}),(0,a.jsx)(l.$n,{type:"button",variant:"outline",size:"sm",icon:"content_copy",onClick:()=>{navigator.clipboard.writeText(ee),eo({type:"success",message:"ACS URL copied to clipboard!"})},children:"Copy"})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-text-main",children:"SP XML Metadata"}),(0,a.jsx)("code",{className:"block break-all font-mono text-xs",children:et})]}),(0,a.jsxs)("a",{href:et,target:"_blank",rel:"noopener noreferrer",download:"9router-sp-metadata.xml",className:"inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"download"}),"Download XML"]})]})]}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2 pt-2 border-t border-border/50",children:[(0,a.jsx)(l.$n,{type:"button",variant:"primary",loading:en,onClick:()=>eJ($.authMode),className:"w-full sm:w-auto",children:"Save SAML settings"}),(0,a.jsx)(l.$n,{type:"button",variant:"outline",loading:ec,onClick:eX,className:"w-full sm:w-auto",children:"Test SAML settings"})]}),ex.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===ex.type?"text-red-500":"text-green-500"}`,children:ex.message}),ei.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===ei.type?"text-red-500":"text-green-500"}`,children:ei.message})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-4 pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Issuer URL"}),(0,a.jsx)(l.pd,{placeholder:"https://auth.example.com/application/o/9router/",value:$.oidcIssuerUrl,onChange:e=>e$("oidcIssuerUrl",e.target.value),disabled:v||H})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Client ID"}),(0,a.jsx)(l.pd,{placeholder:"9router-dashboard",value:$.oidcClientId,onChange:e=>e$("oidcClientId",e.target.value),disabled:v||H})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Client Secret"}),(0,a.jsx)(l.pd,{type:"password",placeholder:"Leave blank to keep existing secret",value:q,onChange:e=>_(e.target.value),disabled:v||H}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"This value is write-only after saving."})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Scopes"}),(0,a.jsx)(l.pd,{placeholder:"openid profile email",value:$.oidcScopes,onChange:e=>e$("oidcScopes",e.target.value),disabled:v||H})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Login Button Label"}),(0,a.jsx)(l.pd,{placeholder:"Sign in with OIDC",value:$.oidcLoginLabel,onChange:e=>e$("oidcLoginLabel",e.target.value),disabled:v||H})]})]}),(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-bg p-3 text-xs sm:text-sm text-text-muted",children:[(0,a.jsx)("p",{className:"font-medium text-text-main mb-1",children:"Redirect URI"}),(0,a.jsx)("code",{className:"block break-all font-mono",children:Y})]}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2 pt-2 border-t border-border/50",children:[(0,a.jsx)(l.$n,{type:"button",variant:"primary",loading:H,onClick:()=>eF(),className:"w-full sm:w-auto",children:"Save OIDC settings"}),(0,a.jsx)(l.$n,{type:"button",variant:"outline",loading:B,onClick:eq,className:"w-full sm:w-auto",children:"Test connection"})]}),W.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===W.type?"text-red-500":"text-green-500"}`,children:W.message}),J.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===J.type?"text-red-500":"text-green-500"}`,children:J.message})]}),"oidc"===N.authMode||"saml"===N.authMode||"sso"===N.authMode?(0,a.jsxs)("p",{className:"text-xs sm:text-sm text-amber-600 dark:text-amber-400",children:["SSO login (","saml"===N.ssoType?"SAML 2.0":"OIDC",") is currently active. Password login is disabled until you switch back."]}):null,"both"===N.authMode&&(0,a.jsxs)("p",{className:"text-xs sm:text-sm text-amber-600 dark:text-amber-400",children:["Password and SSO login (","saml"===N.ssoType?"SAML 2.0":"OIDC",") are both active."]})]})]}),(0,a.jsxs)(l.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 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"route"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Routing Strategy"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Round Robin"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Cycle through accounts to distribute load"})]}),(0,a.jsx)(l.lM,{checked:"round-robin"===N.fallbackStrategy,onChange:()=>eE("round-robin"===N.fallbackStrategy?"fill-first":"round-robin"),disabled:v})]}),"round-robin"===N.fallbackStrategy&&(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Sticky Limit"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Calls per account before switching"})]}),(0,a.jsx)(l.pd,{type:"number",min:"1",max:"10",value:N.stickyRoundRobinLimit||3,onChange:e=>eD(e.target.value),disabled:v,className:"w-16 sm:w-20 text-center shrink-0"})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-4 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Combo Round Robin"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Cycle through providers in combos instead of always starting with first"})]}),(0,a.jsx)(l.lM,{checked:"round-robin"===N.comboStrategy,onChange:()=>eR("round-robin"===N.comboStrategy?"fallback":"round-robin"),disabled:v})]}),"round-robin"===N.comboStrategy&&(0,a.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Combo Sticky Limit"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Calls per combo model before switching"})]}),(0,a.jsx)(l.pd,{type:"number",min:"1",max:"100",value:N.comboStickyRoundRobinLimit||1,onChange:e=>eT(e.target.value),disabled:v,className:"w-20 text-center"})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted italic pt-2 border-t border-border/50",children:["round-robin"===N.fallbackStrategy?`Currently distributing requests across all available accounts with ${N.stickyRoundRobinLimit||3} calls per account.`:"Currently using accounts in priority order (Fill First).","round-robin"===N.comboStrategy?` Combos rotate after ${N.comboStickyRoundRobinLimit||1} call${1===(N.comboStickyRoundRobinLimit||1)?"":"s"} per model.`:" Combos always start with their first model."]})]})]}),(0,a.jsxs)(l.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 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"wifi"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Network"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Outbound Proxy"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Enable proxy for OAuth + provider outbound requests."})]}),(0,a.jsx)(l.lM,{checked:!0===N.outboundProxyEnabled,onChange:()=>eO(!0!==N.outboundProxyEnabled),disabled:v||ev})]}),!0===N.outboundProxyEnabled&&(0,a.jsxs)("form",{onSubmit:eA,className:"flex flex-col gap-4 pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Proxy URL"}),(0,a.jsx)(l.pd,{placeholder:"http://127.0.0.1:7897",value:ey.outboundProxyUrl,onChange:e=>ej(t=>({...t,outboundProxyUrl:e.target.value})),disabled:v||ev}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Leave empty to inherit existing env proxy (if any)."})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 pt-2 border-t border-border/50",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"No Proxy"}),(0,a.jsx)(l.pd,{placeholder:"localhost,127.0.0.1",value:ey.outboundNoProxy,onChange:e=>ej(t=>({...t,outboundNoProxy:e.target.value})),disabled:v||ev}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Comma-separated hostnames/domains to bypass the proxy."})]}),(0,a.jsxs)("div",{className:"pt-2 border-t border-border/50 flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[(0,a.jsx)(l.$n,{type:"button",variant:"secondary",loading:eC,disabled:v||ev,onClick:eP,className:"w-full sm:w-auto",children:"Test proxy URL"}),(0,a.jsx)(l.$n,{type:"submit",variant:"primary",loading:ev,className:"w-full sm:w-auto",children:"Apply"})]})]}),eN.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===eN.type?"text-red-500":"text-green-500"} pt-2 border-t border-border/50`,children:eN.message})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-orange-500/10 text-orange-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"monitoring"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Observability"})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Enable Observability"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Record request details for inspection in the logs view"})]}),(0,a.jsx)(l.lM,{checked:eZ,onChange:eH,disabled:v})]})]}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsx)(l.$n,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>f(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"}),(0,a.jsx)(l.$n,{variant:"outline",fullWidth:!0,icon:"logout",onClick:eG,children:"Logout"})]}),(0,a.jsxs)("div",{className:"text-center text-xs sm:text-sm text-text-muted py-4",children:[(0,a.jsxs)("p",{children:[c.vQ.name," v",c.vQ.version]}),(0,a.jsx)("p",{className:"mt-1",children:eL?"Remote Mode":"Local Mode - All data stored on your machine"})]})]}),(0,a.jsx)(o.default,{hideTrigger:!0,isOpen:h,onClose:e=>{b(!1),u(e)}}),(0,a.jsx)(i.ConfirmModal,{isOpen:g,onClose:()=>f(!1),onConfirm:eQ,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:y}),(0,a.jsxs)(i.default,{isOpen:D.open,onClose:()=>T({open:!1,mode:"",password:""}),title:"Confirm Password",size:"sm",footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.$n,{variant:"ghost",onClick:()=>T({open:!1,mode:"",password:""}),disabled:O,children:"Cancel"}),(0,a.jsx)(l.$n,{variant:"primary",onClick:eW,loading:O,disabled:!D.password,children:"Confirm"})]}),children:[(0,a.jsxs)("p",{className:"text-text-muted mb-3 text-sm",children:["Enter your current password to ","export"===D.mode?"export":"import"," the database."]}),(0,a.jsx)(l.pd,{type:"password",value:D.password,onChange:e=>T(t=>({...t,password:e.target.value})),onKeyDown:e=>{"Enter"===e.key&&D.password&&eW()},placeholder:"Current password",autoFocus:!0})]})]})}}},e=>{e.O(0,[763,1321,705,5497,8441,3794,7358],()=>e(e.s=40939)),_N_E=e.O()}]);