@jheavenknows/bluerouter 1.0.115 → 1.0.118

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 (411) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +2 -2
  3. package/app/.next-cli-build/build-manifest.json +2 -2
  4. package/app/.next-cli-build/server/app/(dashboard)/dashboard/api-keys/page_client-reference-manifest.js +1 -1
  5. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +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.nft.json +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_client-reference-manifest.js +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +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_client-reference-manifest.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +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_client-reference-manifest.js +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-logs/page_client-reference-manifest.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/provider-health/page_client-reference-manifest.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.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_client-reference-manifest.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  33. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  34. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  35. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  36. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  37. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  38. package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  39. package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  40. package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  41. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  42. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  43. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  44. package/app/.next-cli-build/server/app/_not-found.rsc +4 -4
  45. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +4 -4
  46. package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  47. package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +4 -4
  48. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  49. package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  50. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  51. package/app/.next-cli-build/server/app/api/auth/ldap/test/route.js.nft.json +1 -1
  52. package/app/.next-cli-build/server/app/api/auth/ldap/users/route.js.nft.json +1 -1
  53. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  54. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  55. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  56. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  57. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  58. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  59. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  60. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  61. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/autostart/route.js.nft.json +1 -1
  62. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/prompt-log-db/route.js.nft.json +1 -1
  63. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/root-ca/route.js.nft.json +1 -1
  64. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  65. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  66. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  67. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  68. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  69. package/app/.next-cli-build/server/app/api/dashboard/prompt-logs/[id]/route.js.nft.json +1 -1
  70. package/app/.next-cli-build/server/app/api/dashboard/prompt-logs/options/route.js.nft.json +1 -1
  71. package/app/.next-cli-build/server/app/api/dashboard/prompt-logs/route.js.nft.json +1 -1
  72. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  73. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  74. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  75. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  76. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  77. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  78. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  79. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  80. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  81. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  82. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  83. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  84. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  85. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  86. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  87. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  88. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  89. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  90. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  91. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  92. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  93. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  94. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  95. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  96. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  97. package/app/.next-cli-build/server/app/api/provider-health/route.js.nft.json +1 -1
  98. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  99. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  100. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  101. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  102. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  103. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  104. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  106. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  107. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  108. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  110. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  112. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  114. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  116. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  117. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  118. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  119. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  120. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
  121. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  122. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  123. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  124. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  126. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  127. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  130. package/app/.next-cli-build/server/app/api/tunnel/tailscale-login/route.js.nft.json +1 -1
  131. package/app/.next-cli-build/server/app/api/tunnel/tailscale-start-daemon/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  133. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  134. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  136. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  137. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  138. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  139. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  140. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  141. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  142. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  143. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  144. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  145. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  146. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  147. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  148. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  149. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  151. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  152. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  153. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  154. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  155. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  157. package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  158. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  159. package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  160. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  161. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  162. package/app/.next-cli-build/server/app/callback.html +1 -1
  163. package/app/.next-cli-build/server/app/callback.rsc +4 -4
  164. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +4 -4
  165. package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  166. package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +4 -4
  167. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  168. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  169. package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  170. package/app/.next-cli-build/server/app/dashboard/api-keys.html +1 -1
  171. package/app/.next-cli-build/server/app/dashboard/api-keys.rsc +6 -6
  172. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/!KGRhc2hib2FyZCk/dashboard/api-keys/__PAGE__.segment.rsc +2 -2
  173. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/!KGRhc2hib2FyZCk/dashboard/api-keys.segment.rsc +1 -1
  174. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  175. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  176. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_full.segment.rsc +6 -6
  177. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_head.segment.rsc +1 -1
  178. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_index.segment.rsc +4 -4
  179. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_tree.segment.rsc +2 -2
  180. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  181. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +6 -6
  182. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  183. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  184. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  185. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  186. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +6 -6
  187. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  188. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +4 -4
  189. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
  190. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  191. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +6 -6
  192. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  193. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  194. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  195. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  196. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
  197. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  198. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
  199. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  200. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  201. package/app/.next-cli-build/server/app/dashboard/combos.rsc +6 -6
  202. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  203. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  204. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  205. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  206. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
  207. package/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  208. package/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
  209. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  210. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  211. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +7 -7
  212. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +3 -3
  213. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  214. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  215. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  216. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +7 -7
  217. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  218. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
  219. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  220. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  221. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +6 -6
  222. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  223. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
  224. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
  225. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  226. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  227. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +6 -6
  228. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
  229. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +4 -4
  230. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
  231. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  232. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +6 -6
  233. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  234. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  235. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  236. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  237. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
  238. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  239. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
  240. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  241. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  242. package/app/.next-cli-build/server/app/dashboard/profile.rsc +5 -5
  243. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +1 -1
  244. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  245. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  246. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  247. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +5 -5
  248. package/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  249. package/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
  250. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  251. package/app/.next-cli-build/server/app/dashboard/prompt-logs.html +1 -1
  252. package/app/.next-cli-build/server/app/dashboard/prompt-logs.rsc +5 -5
  253. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/!KGRhc2hib2FyZCk/dashboard/prompt-logs/__PAGE__.segment.rsc +1 -1
  254. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/!KGRhc2hib2FyZCk/dashboard/prompt-logs.segment.rsc +1 -1
  255. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  256. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  257. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_full.segment.rsc +5 -5
  258. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_head.segment.rsc +1 -1
  259. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_index.segment.rsc +4 -4
  260. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_tree.segment.rsc +2 -2
  261. package/app/.next-cli-build/server/app/dashboard/provider-health.html +1 -1
  262. package/app/.next-cli-build/server/app/dashboard/provider-health.rsc +5 -5
  263. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/!KGRhc2hib2FyZCk/dashboard/provider-health/__PAGE__.segment.rsc +1 -1
  264. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/!KGRhc2hib2FyZCk/dashboard/provider-health.segment.rsc +1 -1
  265. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  266. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  267. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_full.segment.rsc +5 -5
  268. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_head.segment.rsc +1 -1
  269. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_index.segment.rsc +4 -4
  270. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_tree.segment.rsc +2 -2
  271. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  272. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +6 -6
  273. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  274. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  275. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  276. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  277. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  278. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
  279. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  280. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
  281. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  282. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  283. package/app/.next-cli-build/server/app/dashboard/providers.rsc +6 -6
  284. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  285. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  286. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  287. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  288. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
  289. package/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  290. package/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
  291. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  292. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  293. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +6 -6
  294. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  295. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  296. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  297. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  298. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
  299. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  300. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
  301. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  302. package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
  303. package/app/.next-cli-build/server/app/dashboard/quota.rsc +7 -7
  304. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  305. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  306. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  307. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  308. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
  309. package/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  310. package/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
  311. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  312. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  313. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  314. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
  315. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
  316. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  317. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
  318. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  319. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  320. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  321. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  322. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  323. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  324. package/app/.next-cli-build/server/app/dashboard/skills.rsc +6 -6
  325. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
  326. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
  327. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  328. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  329. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +6 -6
  330. package/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
  331. package/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +4 -4
  332. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
  333. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  334. package/app/.next-cli-build/server/app/dashboard/translator.rsc +6 -6
  335. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  336. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  337. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  338. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  339. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
  340. package/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  341. package/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
  342. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  343. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  344. package/app/.next-cli-build/server/app/dashboard/usage.rsc +6 -6
  345. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  346. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  347. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  348. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  349. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
  350. package/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  351. package/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
  352. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  353. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  354. package/app/.next-cli-build/server/app/dashboard.rsc +6 -6
  355. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  356. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  357. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  358. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +6 -6
  359. package/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
  360. package/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +4 -4
  361. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  362. package/app/.next-cli-build/server/app/index.html +1 -1
  363. package/app/.next-cli-build/server/app/index.rsc +4 -4
  364. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  365. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +4 -4
  366. package/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
  367. package/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +4 -4
  368. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  369. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  370. package/app/.next-cli-build/server/app/landing.html +1 -1
  371. package/app/.next-cli-build/server/app/landing.rsc +4 -4
  372. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +4 -4
  373. package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  374. package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +4 -4
  375. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
  376. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  377. package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  378. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  379. package/app/.next-cli-build/server/app/login.html +1 -1
  380. package/app/.next-cli-build/server/app/login.rsc +4 -4
  381. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
  382. package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  383. package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +4 -4
  384. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
  385. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
  386. package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  387. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  388. package/app/.next-cli-build/server/app-paths-manifest.json +2 -2
  389. package/app/.next-cli-build/server/chunks/2496.js +1 -1
  390. package/app/.next-cli-build/server/chunks/3110.js +1 -1
  391. package/app/.next-cli-build/server/chunks/4746.js +1 -1
  392. package/app/.next-cli-build/server/chunks/6604.js +1 -1
  393. package/app/.next-cli-build/server/chunks/7130.js +1 -1
  394. package/app/.next-cli-build/server/chunks/7153.js +1 -1
  395. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  396. package/app/.next-cli-build/server/pages/404.html +1 -1
  397. package/app/.next-cli-build/server/pages/500.html +1 -1
  398. package/app/.next-cli-build/static/chunks/{1321-13272b170581733a.js → 1321-bd6fad95132fd93f.js} +1 -1
  399. package/app/.next-cli-build/static/chunks/5497-711bf598e02550cc.js +7 -0
  400. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-5e178086cce9f9f0.js → page-54d0a876cf56345f.js} +2 -2
  401. package/app/.next-cli-build/static/css/e6e57b3fbfd16fc4.css +1 -0
  402. package/app/cli/.build-home/AppData/Roaming/bluerouter/db/data.sqlite-shm +0 -0
  403. package/app/cli/.build-home/AppData/Roaming/bluerouter/db/data.sqlite-wal +0 -0
  404. package/app/package.json +1 -1
  405. package/package.json +1 -1
  406. package/app/.next-cli-build/static/chunks/5497-29482bef7f947c2b.js +0 -7
  407. package/app/.next-cli-build/static/css/706876854798b6ab.css +0 -1
  408. /package/app/.next-cli-build/static/{2Ok--6_6DMEUz77-5PBcL → CMWn-EVG6KE1-Qmhm2AR5}/_buildManifest.js +0 -0
  409. /package/app/.next-cli-build/static/{2Ok--6_6DMEUz77-5PBcL → CMWn-EVG6KE1-Qmhm2AR5}/_ssgManifest.js +0 -0
  410. /package/app/cli/.build-home/AppData/Roaming/bluerouter/db/backups/{upgrade-1.0.110-to-1.0.111-1.0.111-20260609-203407 → upgrade-1.0.115-to-1.0.117-1.0.117-20260609-215212}/data.sqlite +0 -0
  411. /package/app/cli/.build-home/AppData/Roaming/bluerouter/db/backups/{upgrade-1.0.111-to-1.0.112-1.0.112-20260609-204126 → upgrade-1.0.117-to-1.0.118-1.0.118-20260609-222041}/data.sqlite +0 -0
@@ -1,7 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5497],{98:(e,t,r)=>{r.d(t,{default:()=>l});var a=r(95155),s=r(31474);function l({label:e,options:t=[],value:r,onChange:n,placeholder:i="Select an option",error:o,hint:d,disabled:c=!1,required:m=!1,className:u,selectClassName:x,...p}){return(0,a.jsxs)("div",{className:(0,s.cn)("flex flex-col gap-1.5",u),children:[e&&(0,a.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,m&&(0,a.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)("select",{value:r,onChange:n,disabled:c,className:(0,s.cn)("w-full py-2.5 px-3 pr-10 text-sm text-text-main","bg-surface-2 border border-transparent rounded-[10px] appearance-none","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",o&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",x),...p,children:[(0,a.jsx)("option",{value:"",disabled:!0,children:i}),t.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,a.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"expand_more"})})]}),o&&(0,a.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},1620:(e,t,r)=>{r.d(t,{D:()=>o});var a=r(12115),s=r(90085);function l(e){let t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function n(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function i(){return!1}function o(){let{theme:e,setTheme:t,toggleTheme:r,initTheme:o}=(0,s.A)(),d=(0,a.useSyncExternalStore)(l,n,i);(0,a.useEffect)(()=>{o()},[o]),(0,a.useEffect)(()=>{if("system"!==e)return;let t=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>o();return t.addEventListener("change",r),()=>t.removeEventListener("change",r)},[e,o]);let c="dark"===e||"system"===e&&d;return{theme:e,setTheme:t,toggleTheme:r,isDark:c}}},4809:(e,t,r)=>{r.d(t,{default:()=>X});var a=r(95155),s=r(12115),l=r(73321),n=r(52679),i=r(56061),o=r(84588),d=r(14051),c=r.n(d);let m=e=>new Intl.NumberFormat().format(e||0);function u({stats:e}){let t;return(0,a.jsxs)("div",{className:"grid min-w-0 grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-4 sm:gap-4",children:[(0,a.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,a.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Total Requests"}),(0,a.jsx)("span",{className:"truncate text-2xl font-bold",children:m(e.totalRequests)})]}),(0,a.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,a.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Total Input Tokens"}),(0,a.jsx)("span",{className:"truncate text-2xl font-bold text-primary",children:m(e.totalPromptTokens)})]}),(0,a.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,a.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Output Tokens"}),(0,a.jsx)("span",{className:"truncate text-2xl font-bold text-success",children:m(e.totalCompletionTokens)})]}),(0,a.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,a.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Est. Cost"}),(0,a.jsxs)("span",{className:"truncate text-2xl font-bold text-warning",children:["~",(t=e.totalCost,`$${(t||0).toFixed(2)}`)]}),(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"Estimated, not actual billing"})]})]})}u.propTypes={stats:c().object.isRequired};let x=e=>new Intl.NumberFormat().format(e||0),p=e=>`$${(e||0).toFixed(2)}`;function h(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 b({field:e,currentSort:t,currentOrder:r}){return t!==e?(0,a.jsx)("span",{className:"ml-1 opacity-20",children:"↕"}):(0,a.jsx)("span",{className:"ml-1",children:"asc"===r?"↑":"↓"})}function f({item:e,viewMode:t,isSummary:r=!1}){return"tokens"===t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:r&&void 0===e.promptTokens?"—":x(e.promptTokens)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:r&&void 0===e.completionTokens?"—":x(e.completionTokens)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right font-medium",children:x(e.totalTokens)})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:r&&void 0===e.inputCost?"—":p(e.inputCost)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:r&&void 0===e.outputCost?"—":p(e.outputCost)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right font-medium text-warning",children:p(e.totalCost||e.cost)})]})}function g({title:e,columns:t,groupedData:r,tableType:l,sortBy:n,sortOrder:i,onToggleSort:d,viewMode:c,storageKey:m,renderDetailCells:u,renderSummaryCells:x,emptyMessage:p}){let[h,y]=(0,s.useState)(new Set);(0,s.useEffect)(()=>{try{let e=localStorage.getItem(m);e&&y(new Set(JSON.parse(e)))}catch(e){console.error(`Failed to load ${m}:`,e)}},[m]),(0,s.useEffect)(()=>{try{localStorage.setItem(m,JSON.stringify([...h]))}catch(e){console.error(`Failed to save ${m}:`,e)}},[h,m]);let v=(0,s.useCallback)(e=>{y(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),j=(0,s.useMemo)(()=>"tokens"===c?[{field:"promptTokens",label:"Input Tokens"},{field:"completionTokens",label:"Output Tokens"},{field:"totalTokens",label:"Total Tokens"}]:[{field:"promptTokens",label:"Input Cost"},{field:"completionTokens",label:"Output Cost"},{field:"cost",label:"Total Cost"}],[c]),N=t.length+j.length;return(0,a.jsxs)(o.default,{className:"overflow-hidden",children:[(0,a.jsx)("div",{className:"p-4 border-b border-border bg-bg-subtle/50",children:(0,a.jsx)("h3",{className:"font-semibold",children:e})}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,a.jsx)("thead",{className:"bg-bg-subtle/30 text-text-muted uppercase text-xs",children:(0,a.jsxs)("tr",{children:[t.map(e=>(0,a.jsxs)("th",{className:`px-6 py-3 cursor-pointer hover:bg-bg-subtle/50 ${"right"===e.align?"text-right":""}`,onClick:()=>d(l,e.field),children:[e.label," ",(0,a.jsx)(b,{field:e.field,currentSort:n,currentOrder:i})]},e.field)),j.map(e=>(0,a.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>d(l,e.field),children:[e.label," ",(0,a.jsx)(b,{field:e.field,currentSort:n,currentOrder:i})]},e.field))]})}),(0,a.jsxs)("tbody",{className:"divide-y divide-border",children:[r.map(e=>(0,a.jsxs)(s.Fragment,{children:[(0,a.jsxs)("tr",{className:"group-summary cursor-pointer hover:bg-bg-subtle/50 transition-colors",onClick:()=>v(e.groupKey),children:[(0,a.jsx)("td",{className:"px-6 py-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted transition-transform ${h.has(e.groupKey)?"rotate-90":""}`,children:"chevron_right"}),(0,a.jsx)("span",{className:`font-medium transition-colors ${e.summary.pending>0?"text-primary":""}`,children:e.groupKey})]})}),x(e),(0,a.jsx)(f,{item:e.summary,viewMode:c,isSummary:!0})]}),h.has(e.groupKey)&&e.items.map(e=>(0,a.jsxs)("tr",{className:"group-detail hover:bg-bg-subtle/20 transition-colors",children:[u(e),(0,a.jsx)(f,{item:e,viewMode:c})]},`detail-${e.key}`))]},e.groupKey)),0===r.length&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:N,className:"px-6 py-8 text-center text-text-muted",children:p})})]})]})})]})}b.propTypes={field:c().string.isRequired,currentSort:c().string.isRequired,currentOrder:c().string.isRequired},f.propTypes={item:c().object.isRequired,viewMode:c().string.isRequired,isSummary:c().bool},g.propTypes={title:c().string.isRequired,columns:c().arrayOf(c().shape({field:c().string.isRequired,label:c().string.isRequired,align:c().string})).isRequired,groupedData:c().array.isRequired,tableType:c().string.isRequired,sortBy:c().string.isRequired,sortOrder:c().string.isRequired,onToggleSort:c().func.isRequired,viewMode:c().string.isRequired,storageKey:c().string.isRequired,renderDetailCells:c().func.isRequired,renderSummaryCells:c().func.isRequired,emptyMessage:c().string.isRequired};var y=r(81750),v=r(6793);function j({data:e}){let{label:t,color:r,imageUrl:l,textIcon:n,active:i}=e,[o,d]=(0,s.useState)(!1);return(0,a.jsxs)("div",{className:"flex items-center gap-2.5 px-4 py-2.5 rounded-lg border-2 transition-all duration-300 bg-bg",style:{borderColor:i?r:"var(--color-border)",boxShadow:i?`0 0 16px ${r}40`:"none",minWidth:"150px"},children:[(0,a.jsx)(y.h7,{type:"target",position:v.yX.Top,id:"top",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,a.jsx)(y.h7,{type:"target",position:v.yX.Bottom,id:"bottom",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,a.jsx)(y.h7,{type:"target",position:v.yX.Left,id:"left",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,a.jsx)(y.h7,{type:"target",position:v.yX.Right,id:"right",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,a.jsx)("div",{className:"w-8 h-8 rounded-md flex items-center justify-center shrink-0",style:{backgroundColor:`${r}15`},children:o?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:r},children:n}):(0,a.jsx)("img",{src:l,alt:t,className:"w-6 h-6 rounded-sm object-contain",onError:()=>d(!0)})}),(0,a.jsx)("span",{className:"text-base font-medium truncate",style:{color:i?r:"var(--color-text)"},children:t}),i&&(0,a.jsxs)("span",{className:"relative flex h-2 w-2 shrink-0",children:[(0,a.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:r}}),(0,a.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2",style:{backgroundColor:r}})]})]})}function N({data:e}){return(0,a.jsxs)("div",{className:"flex items-center justify-center px-5 py-3 rounded-xl border-2 border-primary bg-primary/5 shadow-md min-w-[130px]",children:[(0,a.jsx)(y.h7,{type:"source",position:v.yX.Top,id:"top",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,a.jsx)(y.h7,{type:"source",position:v.yX.Bottom,id:"bottom",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,a.jsx)(y.h7,{type:"source",position:v.yX.Left,id:"left",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,a.jsx)(y.h7,{type:"source",position:v.yX.Right,id:"right",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,a.jsx)("img",{src:"/favicon.svg",alt:"Bluerouter",className:"w-6 h-6 mr-2"}),(0,a.jsx)("span",{className:"text-sm font-bold text-primary",children:"Blue Router"}),e.activeCount>0&&(0,a.jsx)("span",{className:"ml-2 px-1.5 py-0.5 rounded-full bg-primary text-white text-xs font-bold",children:e.activeCount})]})}r(53255),j.propTypes={data:c().object.isRequired},N.propTypes={data:c().object.isRequired};let w={provider:j,router:N};function k({providers:e=[],activeRequests:t=[],lastProvider:r="",errorProvider:l=""}){let i=(0,s.useMemo)(()=>t.map(e=>e.provider?.toLowerCase()).filter(Boolean).sort().join(","),[t]),o=r?.toLowerCase()||"",d=l?.toLowerCase()||"",c=(0,s.useMemo)(()=>new Set(i?i.split(","):[]),[i]),m=(0,s.useMemo)(()=>new Set(o?[o]:[]),[o]),u=(0,s.useMemo)(()=>new Set(d?[d]:[]),[d]),x=(0,s.useRef)({}),[p,h]=(0,s.useState)(0);(0,s.useEffect)(()=>{let e=x.current,t=Date.now();for(let r of c)e[r]||(e[r]=t);for(let t of Object.keys(e))c.has(t)||delete e[t]},[c]),(0,s.useEffect)(()=>{if(0===c.size)return;let e=setInterval(()=>h(e=>e+1),1e3);return()=>clearInterval(e)},[c]);let b=(0,s.useMemo)(()=>{let e=Date.now(),t=new Set;for(let r of c){let a=x.current[r];(!a||e-a<6e4)&&t.add(r)}return t},[c,p]),{nodes:f,edges:g}=(0,s.useMemo)(()=>(function(e,t,r,a){let s=e.length,l=Math.max(320,204*s/(2*Math.PI)),i=Math.max(200,.55*l);if(0===s)return{nodes:[{id:"router",type:"router",position:{x:0,y:0},data:{activeCount:0},draggable:!1}],edges:[]};let o=[],d=[];return o.push({id:"router",type:"router",position:{x:-60,y:-22},data:{activeCount:t.size},draggable:!1}),e.forEach((e,c)=>{var m,u;let x,p,h=(m=e.provider,n.Q2[m]||{color:"#6b7280",name:m}),b=t.has(e.provider?.toLowerCase()),f=!b&&r.has(e.provider?.toLowerCase()),g=!b&&a.has(e.provider?.toLowerCase()),y=`provider-${e.provider}`,v={label:(h.name!==e.provider?h.name:null)||e.name||e.provider,color:h.color||"#6b7280",imageUrl:(u=e.provider,`/providers/${u}.png`),textIcon:h.textIcon||(e.provider||"?").slice(0,2).toUpperCase(),active:b},j=-Math.PI/2+2*Math.PI*c/s,N=l*Math.cos(j),w=i*Math.sin(j);Math.abs(j+Math.PI/2)<Math.PI/4||Math.abs(j-3*Math.PI/2)<Math.PI/4?(x="top",p="bottom"):Math.abs(j-Math.PI/2)<Math.PI/4?(x="bottom",p="top"):N>0?(x="right",p="left"):(x="left",p="right"),o.push({id:y,type:"provider",position:{x:N-90,y:w-15},data:v,draggable:!1}),d.push({id:`e-${y}`,source:"router",sourceHandle:x,target:y,targetHandle:p,animated:b,style:(h.color,g?{stroke:"#ef4444",strokeWidth:2.5,opacity:.9}:b?{stroke:"#22c55e",strokeWidth:2.5,opacity:.9}:f?{stroke:"#f59e0b",strokeWidth:2,opacity:.7}:{stroke:"var(--color-border)",strokeWidth:1,opacity:.3})})}),{nodes:o,edges:d}})(e,b,m,u),[e,b,o,d]),v=(0,s.useMemo)(()=>e.map(e=>e.provider).sort().join(","),[e]),j=(0,s.useRef)(null),N=(0,s.useRef)(null),C={padding:.2,duration:200},S=(0,s.useCallback)(e=>{j.current=e,setTimeout(()=>e.fitView(C),50)},[]);return(0,s.useEffect)(()=>{let e=N.current;if(!e)return;let t=new ResizeObserver(()=>{j.current&&j.current.fitView(C)});return t.observe(e),()=>t.disconnect()},[]),(0,s.useEffect)(()=>{if(j.current){let e=setTimeout(()=>j.current.fitView(C),50);return()=>clearTimeout(e)}},[f.length]),(0,a.jsx)("div",{ref:N,className:"h-[320px] w-full min-w-0 rounded-lg border border-border bg-bg-subtle/30 sm:h-[480px]",children:0===e.length?(0,a.jsx)("div",{className:"h-full flex items-center justify-center text-text-muted text-sm",children:"No providers connected"}):(0,a.jsx)(y.Gc,{nodes:f,edges:g,nodeTypes:w,fitView:!0,fitViewOptions:C,minZoom:.1,maxZoom:2,onInit:S,proOptions:{hideAttribution:!0},panOnDrag:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,preventScrolling:!1,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,children:(0,a.jsx)(y.H2,{showInteractive:!1,className:"react-flow-controls-custom"})},v)})}k.propTypes={providers:c().arrayOf(c().shape({id:c().string,provider:c().string,name:c().string})),activeRequests:c().arrayOf(c().shape({provider:c().string,model:c().string,account:c().string})),lastProvider:c().string,errorProvider:c().string};var C=r(1728),S=r(63346),T=r(28408),I=r(32539),$=r(59656),R=r(95543),P=r(40968);let A=e=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e||0),O=e=>`$${(e||0).toFixed(4)}`;function _({period:e="7d"}){let[t,r]=(0,s.useState)([]),[l,n]=(0,s.useState)(!0),[i,d]=(0,s.useState)("tokens"),c=(0,s.useCallback)(async()=>{n(!0);try{let t=await fetch(`/api/usage/chart?period=${e}`);if(t.ok){let e=await t.json();r(e)}}catch(e){console.error("Failed to fetch chart data:",e)}finally{n(!1)}},[e]);(0,s.useEffect)(()=>{c()},[c]);let m=t.some(e=>e.tokens>0||e.cost>0);return(0,a.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-3 p-3 sm:p-4",children:[(0,a.jsxs)("div",{className:"grid w-full grid-cols-2 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:w-auto sm:self-start",children:[(0,a.jsx)("button",{onClick:()=>d("tokens"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"tokens"===i?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Tokens"}),(0,a.jsx)("button",{onClick:()=>d("cost"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"cost"===i?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Cost"})]}),l?(0,a.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"Loading..."}):m?(0,a.jsx)(C.u,{width:"100%",height:220,children:(0,a.jsxs)(S.Q,{data:t,margin:{top:4,right:8,left:0,bottom:0},children:[(0,a.jsxs)("defs",{children:[(0,a.jsxs)("linearGradient",{id:"gradTokens",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"5%",stopColor:"#6366f1",stopOpacity:.25}),(0,a.jsx)("stop",{offset:"95%",stopColor:"#6366f1",stopOpacity:0})]}),(0,a.jsxs)("linearGradient",{id:"gradCost",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"5%",stopColor:"#f59e0b",stopOpacity:.25}),(0,a.jsx)("stop",{offset:"95%",stopColor:"#f59e0b",stopOpacity:0})]})]}),(0,a.jsx)(T.d,{strokeDasharray:"3 3",strokeOpacity:.1}),(0,a.jsx)(I.W,{dataKey:"label",tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,interval:"preserveStartEnd"}),(0,a.jsx)($.h,{tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,tickFormatter:"tokens"===i?A:O,width:50}),(0,a.jsx)(R.m,{contentStyle:{backgroundColor:"var(--color-bg)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"},formatter:(e,t)=>"tokens"===t?[A(e),"Tokens"]:[O(e),"Cost"]}),"tokens"===i?(0,a.jsx)(P.Gk,{type:"monotone",dataKey:"tokens",stroke:"#6366f1",strokeWidth:2,fill:"url(#gradTokens)",dot:!1,activeDot:{r:4}}):(0,a.jsx)(P.Gk,{type:"monotone",dataKey:"cost",stroke:"#f59e0b",strokeWidth:2,fill:"url(#gradCost)",dot:!1,activeDot:{r:4}})]})}):(0,a.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"No data for this period"})]})}function M(e){let t=n.Q2[e];return!t?.serviceKinds||t.serviceKinds.includes("llm")}function L(e){let t=String(e||"").trim();if(!t)return"";try{return new URL(t).hostname||""}catch{return t.replace(/^https?:\/\//,"").replace(/\/.*$/,"").replace(/:\d+$/,"")}}function E(e){let t=String(e||"").trim();return/^openai-compatible-chat-[0-9a-f-]{20,}$/i.test(t)||/^openai-compatible-[0-9a-f-]{20,}$/i.test(t)}function z(e){return String(e||"").trim()}function q(e=[]){let t={},r={};for(let a of e||[]){let e=function(e={}){let t=z(e.provider||e.providerId||e.provider_id||e.id);return{providerId:t,accountName:z(e.accountName||e.account_name||e.name||e.label||e.connectionName||e.connection_name),endpointHost:L(e.endpoint)||L(e.baseUrl)||L(e.baseURL)||L(e.base_url)||L(e.providerUrl)||L(e.provider_url)||L(e.url)}}(a);for(let r of[a.id,a.connectionId,a.connection_id,a.providerId,a.provider_id,a.provider].map(z).filter(Boolean))t[r]||(t[r]=e);e.accountName&&!r[e.accountName]&&(r[e.accountName]=e)}return{byId:t,byAccount:r}}function U(e={},t={}){let r=e.model||e.rawModel||e.raw_model||"-",a=function(e={},t={}){let r=function(e={},t={}){for(let r of[e.connectionId,e.connection_id,e.providerId,e.provider_id,e.provider].map(z).filter(Boolean))if(t.byId?.[r])return t.byId[r];let r=z(e.accountName||e.account_name||e.keyName||e.key_name||e.connectionName||e.connection_name||e.providerName||e.provider_name||e.providerLabel||e.provider_label);return r&&t.byAccount?.[r]?t.byAccount[r]:null}(e,t);if(r){let e=r.providerId,t=r.accountName,a=r.endpointHost;if(e&&!E(e))return t&&t!==e?`${e}/${t}`:e;if(t)return t;if(a)return a}let a=L(e.endpoint)||L(e.providerUrl)||L(e.provider_url)||L(e.baseUrl)||L(e.baseURL)||L(e.base_url)||L(e.url);if(a)return a;let s=z(e.provider||e.providerId||e.provider_id),l=z(e.accountName||e.account_name||e.keyName||e.key_name||e.connectionName||e.connection_name||e.providerName||e.provider_name||e.providerLabel||e.provider_label);return s&&!E(s)?l&&l!==s?`${s}/${l}`:s:l||""}(e,t);return!a||"-"===r||String(r).startsWith(`${a}/`)?r:`${a}/${r}`}function D({timestamp:e}){let t,[,r]=(0,s.useState)(0);return(0,s.useEffect)(()=>{let e=setInterval(()=>r(e=>e+1),1e3);return()=>clearInterval(e)},[]),(0,a.jsx)(a.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 F({requests:e=[],providers:t=[]}){let r=(0,s.useMemo)(()=>q(t),[t]);return(0,a.jsxs)(o.default,{className:"flex min-w-0 flex-col overflow-hidden",padding:"sm",style:{height:480},children:[(0,a.jsx)("div",{className:"px-1 py-2 border-b border-border shrink-0",children:(0,a.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wide",children:"Recent Requests"})}),e.length?(0,a.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,a.jsxs)("table",{className:"w-full min-w-[300px] border-collapse text-xs",children:[(0,a.jsx)("thead",{className:"sticky top-0 bg-bg z-10",children:(0,a.jsxs)("tr",{className:"border-b border-border",children:[(0,a.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted w-2"}),(0,a.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted",children:"Model"}),(0,a.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted whitespace-nowrap",children:"In / Out"}),(0,a.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted",children:"When"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-border/50",children:e.map((e,t)=>{let s=!e.status||"ok"===e.status||"success"===e.status;return(0,a.jsxs)("tr",{className:"hover:bg-bg-subtle transition-colors",children:[(0,a.jsx)("td",{className:"py-1.5",children:(0,a.jsx)("span",{className:`block w-1.5 h-1.5 rounded-full ${s?"bg-success":"bg-error"}`})}),(0,a.jsx)("td",{className:"py-1.5 font-mono truncate max-w-[240px]",title:U(e,r),children:U(e,r)}),(0,a.jsxs)("td",{className:"py-1.5 text-right whitespace-nowrap",children:[(0,a.jsxs)("span",{className:"text-primary",children:[x(e.promptTokens),"↑"]})," ",(0,a.jsxs)("span",{className:"text-success",children:[x(e.completionTokens),"↓"]})]}),(0,a.jsx)("td",{className:"py-1.5 text-right text-text-muted whitespace-nowrap",children:(0,a.jsx)(D,{timestamp:e.timestamp})})]},t)})})]})}):(0,a.jsx)("div",{className:"flex-1 flex items-center justify-center text-text-muted text-sm",children:"No requests yet."})]})}function W(e,t={},r,a){return Object.entries(e||{}).map(([e,r])=>{let a=(r.promptTokens||0)+(r.completionTokens||0),s=r.cost||0,l=a>0?(r.promptTokens||0)*(s/a):0,n=a>0?(r.completionTokens||0)*(s/a):0;return{...r,key:e,totalTokens:a,totalCost:s,inputCost:l,outputCost:n,pending:t[e]||0}}).sort((e,t)=>{let s=e[r],l=t[r];return("string"==typeof s&&(s=s.toLowerCase()),"string"==typeof l&&(l=l.toLowerCase()),s<l)?"asc"===a?-1:1:s>l?"asc"===a?1:-1:0})}function K(e,t){if(!Array.isArray(e))return[];let r={};return e.forEach(e=>{let a=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);r[a]||(r[a]={groupKey:a,summary:{requests:0,promptTokens:0,completionTokens:0,totalTokens:0,cost:0,inputCost:0,outputCost:0,lastUsed:null,pending:0},items:[]});let s=r[a].summary;s.requests+=e.requests||0,s.promptTokens+=e.promptTokens||0,s.completionTokens+=e.completionTokens||0,s.totalTokens+=e.totalTokens||0,s.cost+=e.cost||0,s.inputCost+=e.inputCost||0,s.outputCost+=e.outputCost||0,s.pending+=e.pending||0,e.lastUsed&&(!s.lastUsed||new Date(e.lastUsed)>new Date(s.lastUsed))&&(s.lastUsed=e.lastUsed),r[a].items.push(e)}),Object.values(r)}_.propTypes={period:c().string};let B=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],G=[{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"}],V=[{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"}],J=[{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"}],Q=[{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"}],H=[{value:"today",label:"Today"},{value:"24h",label:"24h"},{value:"7d",label:"7D"},{value:"30d",label:"30D"},{value:"60d",label:"60D"}];function X({period:e,setPeriod:t,hidePeriodSelector:r=!1}={}){let o=(0,l.useRouter)(),d=(0,l.useSearchParams)(),c=d.get("sortBy")||"rawModel",m=d.get("sortOrder")||"asc",[p,b]=(0,s.useState)(null),[f,y]=(0,s.useState)(!0),[v,j]=(0,s.useState)(!1),[N,w]=(0,s.useState)("model"),[C,S]=(0,s.useState)("costs"),[T,I]=(0,s.useState)([]),[$,R]=(0,s.useState)("today"),P=(0,s.useRef)(!0),A=e??$,O=t??R,L=(0,s.useMemo)(()=>q(T),[T]);(0,s.useEffect)(()=>{fetch("/api/providers").then(e=>e.ok?e.json():null).then(e=>{let t=new Set;I([...(e?.connections||[]).filter(e=>!(!1===e.isActive||!M(e.provider)||t.has(e.provider))&&(t.add(e.provider),!0)),...Object.values(n.IS).filter(e=>e.noAuth&&!t.has(e.id)&&M(e.id)).map(e=>({provider:e.id,name:e.name}))])}).catch(()=>{})},[]),(0,s.useEffect)(()=>{P.current?(P.current=!1,y(!0)):j(!0),fetch(`/api/usage/stats?period=${A}`).then(e=>e.ok?e.json():null).then(e=>{e&&b(t=>({...t,...e}))}).catch(()=>{}).finally(()=>{y(!1),j(!1)})},[A]),(0,s.useEffect)(()=>{let e=new EventSource("/api/usage/stream");return e.onmessage=e=>{try{let t=JSON.parse(e.data);b(e=>({...e||{},activeRequests:t.activeRequests,recentRequests:t.recentRequests,errorProvider:t.errorProvider,pending:t.pending})),y(!1)}catch(e){console.error("[SSE CLIENT] parse error:",e)}},e.onerror=()=>y(!1),()=>e.close()},[]);let E=(0,s.useCallback)((e,t)=>{let r=new URLSearchParams(d.toString());r.get("sortBy")===t?r.set("sortOrder","asc"===r.get("sortOrder")?"desc":"asc"):(r.set("sortBy",t),r.set("sortOrder","asc")),o.replace(`?${r.toString()}`,{scroll:!1})},[d,o]),z=(0,s.useMemo)(()=>{if(!p)return null;switch(N){case"model":{let e=p.pending?.byModel||{};return{columns:B,groupedData:K(W(p.byModel,e,c,m),"rawModel"),storageKey:"usage-stats:expanded-models",emptyMessage:"No usage recorded yet.",renderSummaryCells:e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,a.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.summary.requests)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${e.pending>0?"text-primary":""}`,title:U(e,L),children:U(e,L)}),(0,a.jsx)("td",{className:"px-6 py-3",children:(0,a.jsx)(i.default,{variant:e.pending>0?"primary":"neutral",size:"sm",children:e.provider})}),(0,a.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.requests)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.lastUsed)})]})}}case"account":{let e={};return p?.pending?.byAccount&&Object.entries(p.byAccount||{}).forEach(([t,r])=>{let a=p.pending.byAccount[r.connectionId];if(a){let s=r.provider?`${r.rawModel} (${r.provider})`:r.rawModel;e[t]=a[s]||0}}),{columns:G,groupedData:K(W(p.byAccount,e,c,m),"accountName"),storageKey:"usage-stats:expanded-accounts",emptyMessage:"No account-specific usage recorded yet.",renderSummaryCells:e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,a.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,a.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.summary.requests)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.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,a.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${e.pending>0?"text-primary":""}`,title:U(e,L),children:U(e,L)}),(0,a.jsx)("td",{className:"px-6 py-3",children:(0,a.jsx)(i.default,{variant:e.pending>0?"primary":"neutral",size:"sm",children:e.provider})}),(0,a.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.requests)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.lastUsed)})]})}}case"apiKey":return{columns:V,groupedData:K(W(p.byApiKey,{},c,m),"keyName"),storageKey:"usage-stats:expanded-apikeys",emptyMessage:"No API key usage recorded yet.",renderSummaryCells:e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,a.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,a.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.summary.requests)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"px-6 py-3 font-medium",children:e.keyName}),(0,a.jsx)("td",{className:"px-6 py-3",title:U(e,L),children:U(e,L)}),(0,a.jsx)("td",{className:"px-6 py-3",children:(0,a.jsx)(i.default,{variant:"neutral",size:"sm",children:e.provider})}),(0,a.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.requests)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.lastUsed)})]})};default:return{columns:J,groupedData:K(W(p.byEndpoint,{},c,m),"endpoint"),storageKey:"usage-stats:expanded-endpoints",emptyMessage:"No endpoint usage recorded yet.",renderSummaryCells:e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,a.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,a.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.summary.requests)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"px-6 py-3 font-medium font-mono text-sm",children:e.endpoint}),(0,a.jsx)("td",{className:"px-6 py-3",title:U(e,L),children:U(e,L)}),(0,a.jsx)("td",{className:"px-6 py-3",children:(0,a.jsx)(i.default,{variant:"neutral",size:"sm",children:e.provider})}),(0,a.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.requests)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.lastUsed)})]})}}},[p,N,c,m]);if(!p&&!f)return(0,a.jsx)("div",{className:"text-text-muted",children:"Failed to load usage statistics."});let D=(0,a.jsx)("div",{className:"flex items-center justify-center py-12 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px] animate-spin",children:"progress_activity"})});return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[!r&&(0,a.jsxs)("div",{className:"flex w-full items-center gap-2 sm:w-auto sm:self-end",children:[(0,a.jsx)("div",{className:"grid flex-1 grid-cols-5 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:flex sm:flex-none",children:H.map(e=>(0,a.jsx)("button",{onClick:()=>O(e.value),disabled:v,className:`rounded-md px-3 py-1 text-sm font-medium transition-colors ${A===e.value?"bg-primary text-white shadow-sm":"text-text-muted hover:bg-bg-hover hover:text-text"}`,children:e.label},e.value))}),v&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted animate-spin",children:"progress_activity"})]}),f?D:(0,a.jsx)(u,{stats:p}),f?D:(0,a.jsxs)("div",{className:"grid min-w-0 grid-cols-1 items-stretch gap-2 lg:grid-cols-[minmax(0,2fr)_minmax(280px,1fr)]",children:[(0,a.jsx)(k,{providers:T,activeRequests:p.activeRequests||[],lastProvider:p.recentRequests?.[0]?.provider||"",errorProvider:p.errorProvider||""}),(0,a.jsx)(F,{requests:p.recentRequests||[],providers:T})]}),f?D:(0,a.jsx)(_,{period:A}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("select",{value:N,onChange:e=>w(e.target.value),className:"w-full rounded-lg border border-border bg-surface px-3 py-1.5 text-sm font-medium text-text-main focus:outline-none focus:ring-2 focus:ring-primary/50 sm:w-auto",style:{colorScheme:"auto"},children:Q.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsxs)("div",{className:"grid grid-cols-2 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:flex",children:[(0,a.jsx)("button",{onClick:()=>S("costs"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"costs"===C?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Costs"}),(0,a.jsx)("button",{onClick:()=>S("tokens"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"tokens"===C?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Tokens"})]})]}),f?D:z&&(0,a.jsx)(g,{title:"",columns:z.columns,groupedData:z.groupedData,tableType:N,sortBy:c,sortOrder:m,onToggleSort:E,viewMode:C,storageKey:z.storageKey,renderSummaryCells:z.renderSummaryCells,renderDetailCells:z.renderDetailCells,emptyMessage:z.emptyMessage})]})]})}},4823:(e,t,r)=>{r.d(t,{default:()=>m});var a=r(95155),s=r(12115),l=r(14051),n=r.n(l),i=r(84588),o=r(98),d=r(56061);let c="__none__";function m({providerId:e}){let[t,r]=(0,s.useState)([]),[l,n]=(0,s.useState)(c),[u,x]=(0,s.useState)(!1),[p,h]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let t=!1;return Promise.all([fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.ok?e.json():{proxyPools:[]}),fetch("/api/settings",{cache:"no-store"}).then(e=>e.ok?e.json():{})]).then(([a,s])=>{t||(r(a.proxyPools||[]),n(((s.providerStrategies||{})[e]||{}).proxyPoolId||c))}).catch(()=>{}),()=>{t=!0}},[e]);let b=async t=>{n(t),x(!0);try{let r=await fetch("/api/settings",{cache:"no-store"}),a=(r.ok?await r.json():{}).providerStrategies||{},s={...a[e]||{}};t===c?delete s.proxyPoolId:s.proxyPoolId=t;let l={...a};0===Object.keys(s).length?delete l[e]:l[e]=s,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:l})}),h(!0),setTimeout(()=>h(!1),1500)}catch(e){console.log("Save proxyPoolId error:",e)}finally{x(!1)}};return(0,a.jsxs)(i.default,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-green-500/10 text-green-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"lock_open"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"No authentication required"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"This provider is ready to use. Optionally route requests through a proxy pool to bypass IP-based limits."})]}),p&&(0,a.jsx)(d.default,{variant:"success",size:"sm",children:"Saved"})]}),(0,a.jsx)(o.default,{label:"Proxy Pool",value:l,onChange:e=>b(e.target.value),disabled:u,options:[{value:c,label:"None (direct)"},...t.map(e=>({value:e.id,label:e.name}))]})]})}m.propTypes={providerId:n().string.isRequired}},11059:(e,t,r)=>{r.d(t,{C:()=>s});var a=r(12115);function s(e=2e3){let[t,r]=(0,a.useState)(null),l=(0,a.useRef)(null);return{copied:t,copy:(0,a.useCallback)((t,a="default")=>{(async()=>{if(navigator?.clipboard?.writeText)await navigator.clipboard.writeText(t);else{let e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}})(),r(a),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{r(null)},e)},[e])}}},11910:(e,t,r)=>{r.d(t,{default:()=>l});var a=r(95155),s=r(31474);function l({label:e,type:t="text",placeholder:r,value:n,onChange:i,error:o,hint:d,icon:c,disabled:m=!1,required:u=!1,className:x,inputClassName:p,...h}){return(0,a.jsxs)("div",{className:(0,s.cn)("flex flex-col gap-1.5",x),children:[e&&(0,a.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,u&&(0,a.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,a.jsxs)("div",{className:"relative",children:[c&&(0,a.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:c})}),(0,a.jsx)("input",{type:t,placeholder:r,value:n,onChange:i,disabled:m,className:(0,s.cn)("w-full py-2.5 px-3 text-sm text-text-main bg-surface-2 rounded-[10px]","border border-transparent placeholder-text-muted/70","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 ease-out disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",c&&"pl-10",o&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",p),...h})]}),o&&(0,a.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},14932:(e,t,r)=>{r.d(t,{A:()=>o});var a=r(95155),s=r(12115),l=r(47650);let n=[{icon:"terminal",label:"Terminal",desc:"Full shell access"},{icon:"cast",label:"Desktop",desc:"Screen sharing"},{icon:"folder_open",label:"Files",desc:"Browse & edit files"}],i=[{icon:"qr_code_scanner",text:"Scan QR to connect instantly"},{icon:"wifi_off",text:"No port forwarding needed"},{icon:"devices",text:"Works on any device"}];function o({isOpen:e,onClose:t}){return((0,s.useEffect)(()=>{if(!e)return;document.body.style.overflow="hidden";let r=e=>{"Escape"===e.key&&t()};return document.addEventListener("keydown",r),()=>{document.body.style.overflow="",document.removeEventListener("keydown",r)}},[e,t]),e)?(0,l.createPortal)((0,a.jsxs)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:t}),(0,a.jsxs)("div",{className:"relative w-full max-w-sm rounded-[14px] overflow-hidden shadow-[var(--shadow-elev)] fade-in flex flex-col bg-surface border border-border-subtle",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border-subtle",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-7 h-7 rounded-[8px] flex items-center justify-center bg-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-white text-base",children:"terminal"})}),(0,a.jsx)("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-mono",children:"9Remote"})]}),(0,a.jsx)("button",{onClick:t,className:"p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-base",children:"close"})})]}),(0,a.jsxs)("div",{className:"px-7 py-7 pb-9 flex flex-col gap-6",children:[(0,a.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center mt-2",children:[(0,a.jsx)("div",{className:"w-14 h-14 rounded-[14px] flex items-center justify-center mb-1 bg-primary shadow-[var(--shadow-warm)]",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-white text-[30px]",children:"terminal"})}),(0,a.jsx)("h1",{className:"text-lg font-bold text-text-main tracking-tight",children:"9Remote"}),(0,a.jsx)("p",{className:"text-xs text-text-muted leading-5 max-w-[220px]",children:"Access your terminal, desktop & files from anywhere"})]}),(0,a.jsx)("div",{className:"flex gap-2 w-full",children:n.map(({icon:e,label:t,desc:r})=>(0,a.jsxs)("div",{className:"flex-1 flex flex-col items-center gap-1.5 py-4 px-1 rounded-[10px] border border-border-subtle bg-surface-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[22px]",children:e}),(0,a.jsx)("p",{className:"text-xs font-semibold text-text-main",children:t}),(0,a.jsx)("p",{className:"text-[10px] text-text-muted text-center leading-4",children:r})]},t))}),(0,a.jsx)("div",{className:"flex flex-col gap-3 w-full",children:i.map(({icon:e,text:t})=>(0,a.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined flex-shrink-0 text-primary text-[16px]",children:e}),(0,a.jsx)("span",{className:"text-xs text-text-muted",children:t})]},e))}),(0,a.jsxs)("button",{onClick:()=>window.open("https://9remote.cc","_blank"),className:"w-full py-3 flex items-center justify-center gap-2 text-sm font-semibold text-white rounded-[10px] bg-primary hover:bg-primary-hover shadow-[var(--shadow-warm)] active:scale-[0.98] transition-all",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base",children:"open_in_new"}),"Get 9Remote"]})]})]})]}),document.body):null}},21931:(e,t,r)=>{r.d(t,{default:()=>d});var a=r(95155),s=r(12115),l=r(47650),n=r(93308),i=r(73006);let o=e=>({en:{name:"English",flag:"\uD83C\uDDFA\uD83C\uDDF8"},vi:{name:"Tiếng Việt",flag:"\uD83C\uDDFB\uD83C\uDDF3"},"zh-CN":{name:"简体中文",flag:"\uD83C\uDDE8\uD83C\uDDF3"},"zh-TW":{name:"繁體中文",flag:"\uD83C\uDDF9\uD83C\uDDFC"},ja:{name:"日本語",flag:"\uD83C\uDDEF\uD83C\uDDF5"},"pt-BR":{name:"Portugu\xeas (Brasil)",flag:"\uD83C\uDDE7\uD83C\uDDF7"},"pt-PT":{name:"Portugu\xeas (Portugal)",flag:"\uD83C\uDDF5\uD83C\uDDF9"},ko:{name:"한국어",flag:"\uD83C\uDDF0\uD83C\uDDF7"},es:{name:"Espa\xf1ol",flag:"\uD83C\uDDEA\uD83C\uDDF8"},de:{name:"Deutsch",flag:"\uD83C\uDDE9\uD83C\uDDEA"},fr:{name:"Fran\xe7ais",flag:"\uD83C\uDDEB\uD83C\uDDF7"},he:{name:"עברית",flag:"\uD83C\uDDEE\uD83C\uDDF1"},ar:{name:"العربية",flag:"\uD83C\uDDF8\uD83C\uDDE6"},ru:{name:"Русский",flag:"\uD83C\uDDF7\uD83C\uDDFA"},pl:{name:"Polski",flag:"\uD83C\uDDF5\uD83C\uDDF1"},cs:{name:"Čeština",flag:"\uD83C\uDDE8\uD83C\uDDFF"},nl:{name:"Nederlands",flag:"\uD83C\uDDF3\uD83C\uDDF1"},tr:{name:"T\xfcrk\xe7e",flag:"\uD83C\uDDF9\uD83C\uDDF7"},uk:{name:"Українська",flag:"\uD83C\uDDFA\uD83C\uDDE6"},tl:{name:"Tagalog",flag:"\uD83C\uDDF5\uD83C\uDDED"},id:{name:"Indonesia",flag:"\uD83C\uDDEE\uD83C\uDDE9"},th:{name:"ไทย",flag:"\uD83C\uDDF9\uD83C\uDDED"},hi:{name:"हिन्दी",flag:"\uD83C\uDDEE\uD83C\uDDF3"},bn:{name:"বাংলা",flag:"\uD83C\uDDE7\uD83C\uDDE9"},ur:{name:"اردو",flag:"\uD83C\uDDF5\uD83C\uDDF0"},ro:{name:"Rom\xe2nă",flag:"\uD83C\uDDF7\uD83C\uDDF4"},sv:{name:"Svenska",flag:"\uD83C\uDDF8\uD83C\uDDEA"},it:{name:"Italiano",flag:"\uD83C\uDDEE\uD83C\uDDF9"},el:{name:"Ελληνικά",flag:"\uD83C\uDDEC\uD83C\uDDF7"},hu:{name:"Magyar",flag:"\uD83C\uDDED\uD83C\uDDFA"},fi:{name:"Suomi",flag:"\uD83C\uDDEB\uD83C\uDDEE"},da:{name:"Dansk",flag:"\uD83C\uDDE9\uD83C\uDDF0"},no:{name:"Norsk",flag:"\uD83C\uDDF3\uD83C\uDDF4"}})[e]||{name:e,flag:"\uD83C\uDF10"};function d({className:e="",isOpen:t,onClose:r,hideTrigger:c=!1}){let[m,u]=(0,s.useState)("en"),[x,p]=(0,s.useState)(!1),[h,b]=(0,s.useState)(!1),f=(0,s.useRef)(null),g="boolean"==typeof t,y=g?t:h,v=e=>{g?!e&&r&&r(m):b(e)};(0,s.useEffect)(()=>{u(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${n.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,n.QC)(t)}())},[]),(0,s.useEffect)(()=>{function e(e){f.current&&!f.current.contains(e.target)&&v(!1)}if(y)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[y]);let j=async e=>{if(e!==m&&!x){p(!0),v(!1);try{await fetch("/api/locale",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:e})}),await (0,i.wn)(),u(e)}catch(e){console.error("Failed to set locale:",e)}finally{p(!1)}}};return(0,a.jsxs)("div",{className:e,children:[!c&&(0,a.jsxs)("button",{onClick:()=>v(!y),disabled:x,className:"flex items-center gap-2 px-3 py-2 rounded-lg text-text-muted hover:text-text-main hover:bg-surface/60 transition-colors",title:"Language","data-i18n-skip":"true",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"language"}),(0,a.jsx)("span",{className:"text-sm font-medium",children:o(m).name}),(0,a.jsx)("span",{className:"text-lg",children:o(m).flag})]}),y&&(0,l.createPortal)((0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4","data-i18n-skip":"true",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:()=>v(!1)}),(0,a.jsxs)("div",{ref:f,className:"relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-2xl flex flex-col max-h-[80vh]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Select Language"}),(0,a.jsx)("button",{onClick:()=>v(!1),className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":"Close",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,a.jsx)("div",{className:"p-6 overflow-y-auto flex-1",children:(0,a.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(100px,1fr))] gap-2",children:n.YZ.map(e=>{let t=m===e,r=o(e);return(0,a.jsxs)("button",{onClick:()=>j(e),disabled:x,className:`flex flex-col items-center justify-start gap-1 px-2 py-3 rounded-lg text-xs font-medium transition-colors w-full ${t?"bg-primary/15 text-primary ring-2 ring-primary":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"} ${x?"opacity-70 cursor-wait":""}`,title:r.name,children:[(0,a.jsx)("span",{className:"text-2xl",children:r.flag}),(0,a.jsx)("span",{className:"text-center leading-tight line-clamp-2 h-8 flex items-center",children:r.name}),t&&(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check"})]},e)})})})]})]}),document.body)]})}},23615:(e,t,r)=>{r.d(t,{default:()=>n});var a=r(95155),s=r(12115),l=r(84588);function n(){let[e,t]=(0,s.useState)([]),[r,n]=(0,s.useState)(!0),[i,o]=(0,s.useState)(!0);(0,s.useEffect)(()=>{d()},[]),(0,s.useEffect)(()=>{let e;return i&&(e=setInterval(()=>{d(!1)},3e3)),()=>clearInterval(e)},[i]);let d=async(e=!0)=>{e&&n(!0);try{let e=await fetch("/api/usage/request-logs");if(e.ok){let r=await e.json();t(r)}}catch(e){console.error("Failed to fetch logs:",e)}finally{e&&n(!1)}};return(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold",children:"Request Logs"}),(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsxs)("label",{className:"text-sm font-medium text-text-muted flex items-center gap-2 cursor-pointer",children:[(0,a.jsx)("span",{children:"Auto Refresh (3s)"}),(0,a.jsx)("div",{onClick:()=>o(!i),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none ${i?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,a.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${i?"translate-x-5":"translate-x-1"}`})})]})})]}),(0,a.jsx)(l.default,{className:"overflow-hidden bg-black/5 dark:bg-black/20",children:(0,a.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:r&&0===e.length?(0,a.jsx)("div",{className:"p-8 text-center text-text-muted",children:"Loading logs..."}):0===e.length?(0,a.jsx)("div",{className:"p-8 text-center text-text-muted",children:"No logs recorded yet."}):(0,a.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,a.jsx)("thead",{className:"sticky top-0 bg-bg-subtle border-b border-border z-10",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"DateTime"}),(0,a.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Model"}),(0,a.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Provider"}),(0,a.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Account"}),(0,a.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"In"}),(0,a.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Out"}),(0,a.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-border/50",children:e.map((e,t)=>{let r=e.split(" | ");if(r.length<7)return null;let s=r[6],l=s.includes("PENDING"),n=s.includes("FAILED"),i=s.includes("OK");return(0,a.jsxs)("tr",{className:`hover:bg-primary/5 transition-colors ${l?"bg-primary/5":""}`,children:[(0,a.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-text-muted",children:r[0]}),(0,a.jsx)("td",{className:"px-3 py-1.5 border-r border-border font-medium",children:r[1]}),(0,a.jsx)("td",{className:"px-3 py-1.5 border-r border-border",children:(0,a.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-bg-subtle border border-border text-[10px] uppercase font-bold",children:r[2]})}),(0,a.jsx)("td",{className:"px-3 py-1.5 border-r border-border truncate max-w-[150px]",title:r[3],children:r[3]}),(0,a.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-primary",children:r[4]}),(0,a.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-success",children:r[5]}),(0,a.jsx)("td",{className:`px-3 py-1.5 font-bold ${i?"text-success":n?"text-error":"text-primary animate-pulse"}`,children:s})]},t)})})]})})}),(0,a.jsx)("div",{className:"text-[10px] text-text-muted italic",children:"Logs are loaded from the request history database."})]})}},23936:(e,t,r)=>{r.d(t,{default:()=>o});var a=r(95155),s=r(12115),l=r(14051),n=r.n(l),i=r(35497);function o({isOpen:e,onSuccess:t,onClose:r}){let[l,n]=(0,s.useState)(""),[d,c]=(0,s.useState)(!1),[m,u]=(0,s.useState)(null),[x,p]=(0,s.useState)(!1),h=async()=>{if(!l.trim())return void u("Please paste your cookie");c(!0),u(null);try{let e=await fetch("/api/oauth/iflow/cookie",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:l.trim()})}),r=await e.json();if(!e.ok)throw Error(r.error||"Authentication failed");p(!0),setTimeout(()=>{t?.(),b()},1500)}catch(e){u(e.message)}finally{c(!1)}},b=()=>{n(""),u(null),p(!1),r?.()};return(0,a.jsx)(i.aF,{isOpen:e,onClose:b,title:"iFlow Cookie Authentication",children:(0,a.jsx)("div",{className:"space-y-4",children:x?(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,a.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,a.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,a.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,a.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,a.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,a.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,a.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,a.jsx)("li",{children:"Login to your account"}),(0,a.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,a.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,a.jsx)("li",{children:"Paste it below"})]})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,a.jsx)("textarea",{value:l,onChange:e=>n(e.target.value),placeholder:"BXAuth=xxx; ...",className:"w-full px-3 py-2 bg-surface-secondary border border-border rounded-lg text-sm text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-primary resize-none",rows:4,disabled:d})]}),m&&(0,a.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,a.jsx)("p",{className:"text-sm text-error",children:m})}),(0,a.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,a.jsx)(i.$n,{variant:"secondary",onClick:b,disabled:d,fullWidth:!0,children:"Cancel"}),(0,a.jsx)(i.$n,{onClick:h,loading:d,fullWidth:!0,children:"Authenticate"})]})]})})})}o.propTypes={isOpen:n().bool.isRequired,onSuccess:n().func,onClose:n().func}},25086:(e,t,r)=>{r.d(t,{CardSkeleton:()=>o,PageLoading:()=>n,Skeleton:()=>i,Spinner:()=>l,default:()=>d});var a=r(95155),s=r(31474);function l({size:e="md",className:t}){return(0,a.jsx)("span",{className:(0,s.cn)("material-symbols-outlined animate-spin text-brand-500",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[e],t),children:"progress_activity"})}function n({message:e="Loading..."}){return(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,a.jsx)(l,{size:"xl"}),(0,a.jsx)("p",{className:"mt-4 text-text-muted",children:e})]})}function i({className:e,...t}){return(0,a.jsx)("div",{className:(0,s.cn)("animate-pulse rounded-[10px] bg-surface-2",e),...t})}function o(){return(0,a.jsxs)("div",{className:"p-6 rounded-[14px] border border-border-subtle bg-surface shadow-[var(--shadow-soft)]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)(i,{className:"h-4 w-24"}),(0,a.jsx)(i,{className:"size-10 rounded-[10px]"})]}),(0,a.jsx)(i,{className:"h-8 w-16 mb-2"}),(0,a.jsx)(i,{className:"h-3 w-20"})]})}function d({type:e="spinner",...t}){switch(e){case"page":return(0,a.jsx)(n,{...t});case"skeleton":return(0,a.jsx)(i,{...t});case"card":return(0,a.jsx)(o,{...t});default:return(0,a.jsx)(l,{...t})}}},28058:(e,t,r)=>{r.d(t,{default:()=>n});var a=r(95155),s=r(12115),l=r(81127);function n({isOpen:e,onClose:t,onAdd:r,addedNames:i=[]}){let[o,d]=(0,s.useState)([]),[c,m]=(0,s.useState)(!1),[u,x]=(0,s.useState)(""),[p,h]=(0,s.useState)("all"),[b,f]=(0,s.useState)(null),[g,y]=(0,s.useState)(null),[v,j]=(0,s.useState)({}),[N,w]=(0,s.useState)({}),[k,C]=(0,s.useState)({});(0,s.useEffect)(()=>{!e||o.length>0||(m(!0),fetch("/api/cli-tools/cowork-mcp-registry").then(e=>e.json()).then(e=>{e.error?f(e.error):d(e.servers||[])}).catch(e=>f(e.message)).finally(()=>m(!1)))},[e]);let S=(0,s.useMemo)(()=>new Set(i),[i]),T=(0,s.useMemo)(()=>{let e=u.trim().toLowerCase();return o.filter(t=>("authless"!==p||!t.oauth)&&("oauth"!==p||!!t.oauth)&&(!e||(t.title||"").toLowerCase().includes(e)||(t.description||"").toLowerCase().includes(e)||(t.name||"").toLowerCase().includes(e)))},[o,u,p]),I=async e=>{if(!v[e.url]){w(t=>({...t,[e.url]:!0}));try{let t=await fetch("/api/cli-tools/cowork-mcp-tools",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e.url})}),r=await t.json(),a=r.tools||[],s=Array.isArray(e.toolNames)?e.toolNames:[],l=a.length>0?a.map(e=>e.name):s;j(t=>({...t,[e.url]:{tools:a,requiresAuth:!!r.requiresAuth,error:r.error}})),C(t=>({...t,[e.url]:Object.fromEntries(l.map(e=>[e,!0]))}))}catch(t){j(r=>({...r,[e.url]:{tools:[],error:t.message}}))}finally{w(t=>({...t,[e.url]:!1}))}}},$=(e,t)=>{let r=k[e]||{};C(a=>({...a,[e]:Object.fromEntries(Object.keys(r).map(e=>[e,t]))}))};return(0,a.jsx)(l.default,{isOpen:e,onClose:t,title:"Browse MCP Marketplace",size:"lg",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"text",value:u,onChange:e=>x(e.target.value),placeholder:"Search by name or description...",className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,a.jsxs)("select",{value:p,onChange:e=>h(e.target.value),className:"px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:[(0,a.jsx)("option",{value:"all",children:"All"}),(0,a.jsx)("option",{value:"authless",children:"Authless"}),(0,a.jsx)("option",{value:"oauth",children:"OAuth"})]})]}),b&&(0,a.jsx)("div",{className:"px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:b}),c&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-xs py-4 justify-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}),(0,a.jsx)("span",{children:"Loading registry..."})]}),!c&&(0,a.jsxs)("div",{className:"flex flex-col gap-1 max-h-[60vh] overflow-y-auto",children:[0===T.length&&(0,a.jsx)("div",{className:"text-center text-xs text-text-muted py-6",children:"No servers match filter"}),T.map(e=>{let t=S.has(e.slug||e.name),s=g===e.url,l=v[e.url],n=N[e.url],i=k[e.url]||{},o=Object.keys(i),d=Object.values(i).filter(Boolean).length;return(0,a.jsxs)("div",{className:"rounded border border-transparent hover:border-border",children:[(0,a.jsxs)("div",{className:"flex items-start gap-2 px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5",children:[e.iconUrl?(0,a.jsx)("img",{src:e.iconUrl,alt:"",className:"size-7 rounded shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}):(0,a.jsx)("div",{className:"size-7 rounded bg-surface shrink-0"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,a.jsx)("span",{className:"font-medium text-xs",children:e.title}),e.oauth?(0,a.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-amber-500/10 text-amber-600",children:"OAuth"}):(0,a.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-green-500/10 text-green-600",children:"Authless"}),e.toolCount>0&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted",children:[e.toolCount," tools"]})]}),e.description&&(0,a.jsx)("p",{className:"text-[10px] text-text-muted line-clamp-2 mt-0.5",children:e.description})]}),(0,a.jsx)("button",{onClick:()=>t?null:void(g===e.url?y(null):(y(e.url),I(e))),disabled:t,className:`shrink-0 px-2 py-1 rounded text-[10px] font-medium transition-colors ${t?"bg-green-500/10 text-green-600 cursor-default":s?"bg-surface border border-border text-text-muted hover:bg-black/5":"bg-primary/10 border border-primary/40 text-primary hover:bg-primary/20"}`,children:t?"Added":s?"Cancel":"+ Add"})]}),s&&(0,a.jsxs)("div",{className:"px-3 py-2 bg-surface/40 border-t border-border flex flex-col gap-2",children:[n&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-[10px] py-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[14px]",children:"progress_activity"}),(0,a.jsx)("span",{children:"Probing server for tools..."})]}),!n&&l?.requiresAuth&&(0,a.jsx)("p",{className:"text-[10px] text-amber-600 bg-amber-500/10 px-2 py-1 rounded",children:"\uD83D\uDD10 OAuth required. Add now and authenticate after Apply; tool list will be discovered after first connect."}),!n&&l?.error&&!l?.requiresAuth&&(0,a.jsxs)("p",{className:"text-[10px] text-red-600 bg-red-500/10 px-2 py-1 rounded",children:["Probe failed: ",l.error]}),!n&&0===o.length&&!l?.requiresAuth&&!l?.error&&(0,a.jsx)("p",{className:"text-[10px] text-text-muted",children:"No tools advertised by server."}),!n&&o.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("span",{className:"text-[10px] text-text-muted",children:[d,"/",o.length," tools enabled"]}),(0,a.jsxs)("div",{className:"flex gap-1",children:[(0,a.jsx)("button",{onClick:()=>$(e.url,!0),className:"text-[10px] text-primary hover:underline",children:"All"}),(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"\xb7"}),(0,a.jsx)("button",{onClick:()=>$(e.url,!1),className:"text-[10px] text-primary hover:underline",children:"None"})]})]}),(0,a.jsx)("div",{className:"grid grid-cols-2 gap-1 max-h-40 overflow-y-auto",children:o.map(t=>(0,a.jsxs)("label",{className:"flex items-center gap-1.5 text-[10px] cursor-pointer hover:bg-black/5 dark:hover:bg-white/5 px-1 rounded",children:[(0,a.jsx)("input",{type:"checkbox",checked:!!i[t],onChange:()=>{var r;return r=e.url,void C(e=>({...e,[r]:{...e[r],[t]:!e[r]?.[t]}}))},className:"size-3"}),(0,a.jsx)("span",{className:"truncate",children:t})]},t))})]}),(0,a.jsx)("button",{onClick:()=>{let t,a;return a=Object.keys(t=k[e.url]||{}).filter(e=>t[e]),void(r?.({name:e.slug||e.name,title:e.title,description:e.description,url:e.url,transport:e.transport,oauth:e.oauth,toolNames:a}),y(null))},className:"self-end px-2 py-1 rounded text-[10px] font-medium bg-primary text-white hover:bg-primary/90",children:"✓ Confirm Add"})]})]},e.url)})]}),(0,a.jsxs)("div",{className:"text-[10px] text-text-muted text-right",children:[T.length," of ",o.length," servers"]})]})})}},28067:(e,t,r)=>{r.d(t,{default:()=>l});var a=r(95155),s=r(31474);function l({options:e=[],value:t,onChange:r,size:n="md",className:i}){let o={sm:"h-7 text-xs",md:"h-9 text-sm",lg:"h-11 text-base"};return(0,a.jsx)("div",{className:(0,s.cn)("inline-flex items-center p-1 rounded-[10px] overflow-x-auto","bg-surface-2",i),children:e.map(e=>(0,a.jsxs)("button",{onClick:()=>r(e.value),className:(0,s.cn)("shrink-0 px-4 rounded-[8px] font-medium transition-all",o[n],t===e.value?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[e.icon&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] mr-1.5",children:e.icon}),e.label]},e.value))})}},28815:(e,t,r)=>{r.d(t,{default:()=>o});var a=r(95155),s=r(12115),l=r(81127),n=r(92542),i=r(11059);function o({isOpen:e,onClose:t,title:r="Manual Configuration",configs:d=[]}){let{copy:c}=(0,i.C)(),[m,u]=(0,s.useState)(null);return(0,a.jsx)(l.default,{isOpen:e,onClose:t,title:r,size:"xl",children:(0,a.jsx)("div",{className:"flex flex-col gap-4",children:d.map((e,t)=>(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)("span",{className:"text-sm font-medium text-text-main",children:e.filename}),(0,a.jsxs)(n.default,{variant:"ghost",size:"sm",onClick:()=>{var r;return r=e.content,void(c(r,`manualconfig-${t}`),u(t),setTimeout(()=>u(null),2e3))},children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:m===t?"check":"content_copy"}),m===t?"Copied!":"Copy"]})]}),(0,a.jsx)("pre",{className:"px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs overflow-x-auto whitespace-pre-wrap break-all max-h-60 overflow-y-auto border border-border",children:e.content})]},t))})})}},30815:(e,t,r)=>{r.d(t,{default:()=>o});var a=r(95155),s=r(12115),l=r(14051),n=r.n(l),i=r(35497);function o({isOpen:e,onSuccess:t,onClose:r}){let[l,n]=(0,s.useState)(""),[d,c]=(0,s.useState)(""),[m,u]=(0,s.useState)(null),[x,p]=(0,s.useState)(!1),[h,b]=(0,s.useState)(!1),[f,g]=(0,s.useState)(!1),[y,v]=(0,s.useState)(!1),j=async()=>{b(!0),u(null),g(!1),v(!1);try{let e=await fetch("/api/oauth/cursor/auto-import"),t=await e.json();t.found?(n(t.accessToken),c(t.machineId),g(!0)):t.windowsManual?v(!0):u(t.error||"Could not auto-detect tokens")}catch(e){u("Failed to auto-detect tokens")}finally{b(!1)}};(0,s.useEffect)(()=>{e&&j()},[e]);let N=async()=>{if(!l.trim())return void u("Please enter an access token");if(!d.trim())return void u("Please enter a machine ID");p(!0),u(null);try{let e=await fetch("/api/oauth/cursor/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:l.trim(),machineId:d.trim()})}),a=await e.json();if(!e.ok)throw Error(a.error||"Import failed");t?.(),r()}catch(e){u(e.message)}finally{p(!1)}};return(0,a.jsx)(i.aF,{isOpen:e,title:"Connect Cursor IDE",onClose:r,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[h&&(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting tokens..."}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from Cursor IDE database"})]}),!h&&(0,a.jsxs)(a.Fragment,{children:[f&&(0,a.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,a.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Tokens auto-detected from Cursor IDE successfully!"})]})}),y&&(0,a.jsxs)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-3 rounded-lg border border-amber-200 dark:border-amber-800 flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,a.jsx)("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Could not read Cursor database automatically."})]}),(0,a.jsxs)("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Make sure Cursor IDE has been opened at least once, then click ",(0,a.jsx)("strong",{children:"Retry"}),". If the problem persists, paste your tokens manually below."]}),(0,a.jsx)(i.$n,{onClick:j,variant:"outline",fullWidth:!0,children:"Retry"})]}),!f&&!y&&!m&&(0,a.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,a.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Cursor IDE not detected. Please paste your tokens manually."})]})}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)("textarea",{value:l,onChange:e=>n(e.target.value),placeholder:"Access token will be auto-filled...",rows:3,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-lg bg-background focus:outline-none focus:border-primary resize-none"})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Machine ID ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)(i.pd,{value:d,onChange:e=>c(e.target.value),placeholder:"Machine ID will be auto-filled...",className:"font-mono text-sm"})]}),m&&(0,a.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,a.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:m})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:N,fullWidth:!0,disabled:x||!l.trim()||!d.trim(),children:x?"Importing...":"Import Token"}),(0,a.jsx)(i.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}o.propTypes={isOpen:n().bool.isRequired,onSuccess:n().func,onClose:n().func.isRequired}},31474:(e,t,r)=>{r.d(t,{cn:()=>a});function a(...e){return e.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}},35497:(e,t,r)=>{r.d(t,{x0:()=>w.default,Ex:()=>d.default,$n:()=>a.default,Zp:()=>n.default,Qv:()=>o.CardSkeleton,CK:()=>p.default,uo:()=>i.ConfirmModal,G9:()=>y.default,wI:()=>N.default,vj:()=>j.default,vE:()=>v.default,pd:()=>s.default,Mh:()=>g.default,uR:()=>x.default,Nf:()=>h.default,aF:()=>i.default,rq:()=>u.default,gw:()=>k.default,LF:()=>m.default,Wx:()=>T.default,gM:()=>f.default,Iz:()=>C.default,l6:()=>l.default,lM:()=>c.default,m_:()=>S.default,jK:()=>b.default});var a=r(92542),s=r(11910),l=r(98),n=r(84588),i=r(81127),o=r(25086);r(56319);var d=r(56061),c=r(98542);r(38587),r(21110),r(92622),r(74891),r(92173);var m=r(90882),u=r(72908),x=r(28815),p=r(45455),h=r(28058),b=r(4809);r(21931),r(36548),r(80752),r(40197);var f=r(23615);r(61500);var g=r(62899);r(94230);var y=r(30815),v=r(23936),j=r(95088),N=r(73579),w=r(96748),k=r(4823),C=r(28067),S=r(97677),T=r(51825);r(86671),r(91450)},36548:(e,t,r)=>{r.d(t,{default:()=>n});var a=r(95155),s=r(12115),l=r(14932);function n(){let[e,t]=(0,s.useState)(!1);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{onClick:()=>t(!0),className:"relative flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg transition-all text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5",title:"9Remote",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"computer"}),(0,a.jsx)("span",{className:"text-xs font-medium",children:"Remote"})]}),(0,a.jsx)(l.A,{isOpen:e,onClose:()=>t(!1)})]})}},38003:(e,t,r)=>{r.d(t,{C:()=>a});let a=(0,r(1934).v)(e=>({query:"",placeholder:"",visible:!1,setQuery:t=>e({query:t}),register:(t="Search...")=>e({visible:!0,placeholder:t,query:""}),unregister:()=>e({visible:!1,placeholder:"",query:""})}))},38587:(e,t,r)=>{r.d(t,{default:()=>n});var a=r(95155),s=r(1620),l=r(31474);function n({className:e,variant:t="default"}){let{isDark:r,toggleTheme:i}=(0,s.D)(),o={default:(0,l.cn)("flex items-center justify-center size-10 rounded-full","text-text-muted hover:text-text-main","hover:bg-surface-2 transition-colors"),card:(0,l.cn)("flex items-center justify-center size-11 rounded-full","bg-surface/60 hover:bg-surface","border border-border","backdrop-blur-md shadow-sm hover:shadow-[var(--shadow-warm)]","text-text-muted hover:text-brand-500","transition-all group")};return(0,a.jsx)("button",{onClick:i,className:(0,l.cn)(o[t],e),"aria-label":`Switch to ${r?"light":"dark"} mode`,title:`Switch to ${r?"light":"dark"} mode`,children:(0,a.jsx)("span",{className:(0,l.cn)("material-symbols-outlined text-[22px]","card"===t&&"transition-transform duration-300 group-hover:rotate-12"),children:r?"light_mode":"dark_mode"})})}},40197:(e,t,r)=>{r.d(t,{default:()=>c});var a=r(95155),s=r(12115),l=r(47650),n=r(14051),i=r.n(n),o=r(9233),d=r(90620);function c({isOpen:e,onClose:t}){let[r,n]=(0,s.useState)(""),[i,m]=(0,s.useState)(!1),[u,x]=(0,s.useState)(""),p=(0,s.useRef)(null);return((0,s.useEffect)(()=>{e&&!r&&(m(!0),x(""),fetch(d.Nu.changelogUrl).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.text()}).then(e=>n(o.xI.parse(e))).catch(e=>x(e.message||"Failed to load")).finally(()=>m(!1)))},[e,r]),(0,s.useEffect)(()=>{let r=e=>{p.current&&!p.current.contains(e.target)&&t()};if(e)return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[e,t]),!e||"u"<typeof document)?null:(0,l.createPortal)((0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:t}),(0,a.jsxs)("div",{ref:p,className:"relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-3xl flex flex-col max-h-[85vh]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Change Log"}),(0,a.jsx)("button",{onClick:t,className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":"Close",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,a.jsxs)("div",{className:"p-6 overflow-y-auto flex-1",children:[i&&(0,a.jsxs)("div",{className:"flex items-center justify-center py-10 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin mr-2",children:"progress_activity"}),"Loading..."]}),u&&(0,a.jsxs)("div",{className:"text-red-500 py-4",children:["Failed to load changelog: ",u]}),!i&&!u&&r&&(0,a.jsx)("div",{className:"changelog-body text-text-main",dangerouslySetInnerHTML:{__html:r}})]})]})]}),document.body)}o.xI.setOptions({gfm:!0,breaks:!0}),c.propTypes={isOpen:i().bool.isRequired,onClose:i().func.isRequired}},45455:(e,t,r)=>{r.d(t,{default:()=>m});var a=r(95155),s=r(12115),l=r(81127),n=r(11910),i=r(92542),o=r(72908);let d=/^[a-zA-Z0-9_.\-]+$/;function c({index:e,model:t,isFirst:r,isLast:l,onEdit:n,onMoveUp:i,onMoveDown:o,onRemove:d}){let[m,u]=(0,s.useState)(!1),[x,p]=(0,s.useState)(t),h=()=>{let e=x.trim();e&&e!==t?n(e):p(t),u(!1)};return(0,a.jsxs)("div",{className:"group flex min-w-0 items-center gap-1.5 rounded-md bg-black/[0.02] px-2 py-1 transition-colors hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04]",children:[(0,a.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:e+1}),m?(0,a.jsx)("input",{autoFocus:!0,value:x,onChange:e=>p(e.target.value),onBlur:h,onKeyDown:e=>{"Enter"===e.key&&h(),"Escape"===e.key&&(p(t),u(!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,a.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:()=>u(!0),title:"Click to edit",children:t}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,a.jsx)("button",{onClick:i,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,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,a.jsx)("button",{onClick:o,disabled:l,className:`p-0.5 rounded ${l?"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,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,a.jsx)("button",{onClick:d,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function m({isOpen:e,combo:t,comboStrategy:r={},onClose:u,onSave:x,activeProviders:p,kindFilter:h=null,forcePrefix:b="",title:f}){let g=t?.name?b&&t.name.startsWith(b)?t.name.slice(b.length):t.name:"",[y,v]=(0,s.useState)(g),[j,N]=(0,s.useState)(t?.models||[]),[w,k]=(0,s.useState)(!1),[C,S]=(0,s.useState)(!1),[T,I]=(0,s.useState)(""),[$,R]=(0,s.useState)({});(0,s.useEffect)(()=>{e&&fetch("/api/models/alias").then(e=>e.ok?e.json():null).then(e=>e&&R(e.aliases||{})).catch(()=>{})},[e]);let P=e=>{if(!e.trim())return I("Name is required"),!1;let t=b+e;return d.test(t)?(I(""),!0):(I("Only letters, numbers, -, _ and . allowed"),!1)},A=e=>{let t=e.target.value;b&&t.startsWith(b)&&(t=t.slice(b.length)),v(t),t?P(t):I("")},O=async()=>{P(y)&&(S(!0),await x({name:b+y.trim(),models:j}),S(!1))},_=!!t,M=r?.fallbackStrategy||"fallback";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.default,{isOpen:e,onClose:u,title:f||(_?"Edit Combo":"Create Combo"),children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{children:[b?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1 block",children:"Combo Name"}),(0,a.jsxs)("div",{className:"flex items-stretch",children:[(0,a.jsx)("span",{className:"inline-flex items-center px-2 rounded-l border border-r-0 border-black/10 dark:border-white/10 bg-black/[0.04] dark:bg-white/[0.04] text-text-muted font-mono text-sm",children:b}),(0,a.jsx)("input",{value:y,onChange:A,placeholder:"my-combo",className:"flex-1 min-w-0 rounded-r border border-black/10 dark:border-white/10 bg-white dark:bg-black/20 px-2 py-1.5 font-mono text-sm outline-none focus:border-primary"})]}),T&&(0,a.jsx)("p",{className:"text-[11px] text-red-500 mt-0.5",children:T})]}):(0,a.jsx)(n.default,{label:"Combo Name",value:y,onChange:A,placeholder:"my-combo",error:T}),(0,a.jsxs)("p",{className:"text-[10px] text-text-muted mt-0.5",children:[b?`Auto-prefixed with "${b}". `:"","Only letters, numbers, -, _ and . allowed"]})]}),(0,a.jsxs)("div",{className:"rounded-lg border border-primary/15 bg-primary/5 px-3 py-2 text-xs text-text-muted",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 font-medium text-primary",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"route"}),"Routing: ","least-latency"===M?"Least latency":"p2c"===M?"P2C":"round-robin"===M?"Round Robin":"Fallback priority"]}),(0,a.jsx)("p",{className:"mt-1",children:"Strategy, LAN health, and tag rules are saved in settings.comboStrategies and can be edited from the Combo card."})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===j.length?(0,a.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,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,a.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:j.map((e,t)=>(0,a.jsx)(c,{index:t,model:e,isFirst:0===t,isLast:t===j.length-1,onEdit:e=>{let r=[...j];r[t]=e,N(r)},onMoveUp:()=>(e=>{if(0===e)return;let t=[...j];[t[e-1],t[e]]=[t[e],t[e-1]],N(t)})(t),onMoveDown:()=>(e=>{if(e===j.length-1)return;let t=[...j];[t[e],t[e+1]]=[t[e+1],t[e]],N(t)})(t),onRemove:()=>N(j.filter((e,r)=>r!==t))},t))}),(0,a.jsxs)("button",{onClick:()=>k(!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,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,a.jsx)(i.default,{onClick:u,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,a.jsx)(i.default,{onClick:O,fullWidth:!0,size:"sm",disabled:!y.trim()||!!T||C,children:C?"Saving...":_?"Save":"Create"})]})]})}),(0,a.jsx)(o.default,{isOpen:w,onClose:()=>k(!1),onSelect:e=>{j.includes(e.value)||N([...j,e.value])},onDeselect:e=>{N(j.filter(t=>t!==e.value))},activeProviders:p,modelAliases:$,title:"Add Model to Combo",kindFilter:h,addedModelValues:j,closeOnSelect:!1})]})}},51825:(e,t,r)=>{r.d(t,{default:()=>n});var a=r(95155),s=r(84588);let l={mode:{label:"Mode",format:e=>e},defaultModel:{label:"Model",format:e=>e,mono:!0},baseUrl:{label:"Endpoint",format:e=>e,isLink:!0,mono:!0},costPerQuery:{label:"Cost / call",format:e=>0===e?"Free":`$${e.toFixed(4)}`},pricingUrl:{label:"Pricing",format:()=>"View pricing",isLink:!0},freeTier:{label:"Free tier",format:e=>e},freeMonthlyQuota:{label:"Free quota",format:e=>0===e?"—":e>=999999?"Unlimited":`${e.toLocaleString()} / mo`},searchTypes:{label:"Types",format:e=>e.join(", ")},formats:{label:"Formats",format:e=>e.join(", ")},maxMaxResults:{label:"Max results",format:e=>e},maxCharacters:{label:"Max chars",format:e=>e.toLocaleString()}};function n({config:e,provider:t,title:r="Provider Info"}){if(!e)return null;let i=Object.entries(l).filter(([t])=>void 0!==e[t]&&null!==e[t]&&""!==e[t]).map(([t,r])=>({key:t,label:r.label,value:r.format(e[t]),isLink:r.isLink,mono:r.mono,raw:e[t]})),o=t?.notice?.apiKeyUrl||t?.website,d=t?.notice?.text;return(0,a.jsxs)(s.default,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:r}),o&&(0,a.jsxs)("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),"Get API Key"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-2",children:[i.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted w-28 shrink-0",children:e.label}),e.isLink?(0,a.jsx)("a",{href:e.raw,target:"_blank",rel:"noopener noreferrer",className:`text-sm text-primary hover:underline truncate ${e.mono?"font-mono":""}`,children:e.value}):(0,a.jsx)("span",{className:`text-sm text-text-main truncate ${e.mono?"font-mono":""}`,children:e.value})]},e.key)),d&&(0,a.jsxs)("div",{className:"flex items-start gap-3 min-w-0 sm:col-span-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted w-28 shrink-0 mt-0.5",children:"Notice"}),(0,a.jsx)("span",{className:"text-sm text-text-main leading-relaxed",children:d})]})]})]})}},56061:(e,t,r)=>{r.d(t,{default:()=>i});var a=r(95155),s=r(31474);let l={default:"bg-surface-2 text-text-muted",primary:"bg-brand-500/10 text-brand-600 dark:text-brand-300",success:"bg-green-500/10 text-green-600 dark:text-green-400",warning:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",error:"bg-red-500/10 text-red-600 dark:text-red-400",info:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},n={sm:"px-2 py-0.5 text-[10px]",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1.5 text-sm"};function i({children:e,variant:t="default",size:r="md",dot:o=!1,icon:d,className:c}){return(0,a.jsxs)("span",{className:(0,s.cn)("inline-flex items-center gap-1.5 rounded-full font-semibold",l[t],n[r],c),children:[o&&(0,a.jsx)("span",{className:(0,s.cn)("size-1.5 rounded-full","success"===t&&"bg-green-500","warning"===t&&"bg-yellow-500","error"===t&&"bg-red-500","info"===t&&"bg-blue-500","primary"===t&&"bg-brand-500","default"===t&&"bg-gray-500")}),d&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:d}),e]})}},56319:(e,t,r)=>{r.d(t,{default:()=>l});var a=r(95155),s=r(31474);function l({src:e,alt:t="Avatar",name:r,size:n="md",className:i}){let o={xs:"size-6 text-xs",sm:"size-8 text-sm",md:"size-10 text-base",lg:"size-12 text-lg",xl:"size-16 text-xl"};return e?(0,a.jsx)("div",{className:(0,s.cn)("rounded-full bg-cover bg-center bg-no-repeat","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[n],i),style:{backgroundImage:`url(${e})`},role:"img","aria-label":t}):(0,a.jsx)("div",{className:(0,s.cn)("rounded-full flex items-center justify-center font-semibold text-white","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[n],(e=>{if(!e)return"bg-primary";let t=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],r=e.charCodeAt(0)%t.length;return t[r]})(r),i),role:"img","aria-label":t,children:(e=>{if(!e)return"?";let t=e.split(" ");return t.length>=2?`${t[0][0]}${t[1][0]}`.toUpperCase():e.substring(0,2).toUpperCase()})(r)})}},57250:(e,t,r)=>{r.d(t,{A:()=>i});var a=r(95155),s=r(12115),l=r(14051),n=r.n(l);function i({src:e,alt:t,size:r=32,className:l="",fallbackText:n="?",fallbackColor:o}){let[d,c]=(0,s.useState)(!1);return!e||d?(0,a.jsx)("span",{className:`inline-flex items-center justify-center font-bold rounded-lg ${l}`.trim(),style:{width:r,height:r,color:o,fontSize:Math.max(10,Math.floor(.38*r))},children:n}):(0,a.jsx)("img",{src:e,alt:t,width:r,height:r,className:l,onError:()=>c(!0)})}i.propTypes={src:n().string,alt:n().string,size:n().number,className:n().string,fallbackText:n().string,fallbackColor:n().string}},61500:(e,t,r)=>{r.d(t,{default:()=>o});var a=r(95155),s=r(12115),l=r(14051),n=r.n(l),i=r(35497);function o({isOpen:e,onMethodSelect:t,onClose:r}){let[l,n]=(0,s.useState)(null),[d,c]=(0,s.useState)(""),[m,u]=(0,s.useState)("us-east-1"),[x,p]=(0,s.useState)(""),[h,b]=(0,s.useState)(null),[f,g]=(0,s.useState)(!1),[y,v]=(0,s.useState)(!1),[j,N]=(0,s.useState)(!1);(0,s.useEffect)(()=>{"import"===l&&e&&(async()=>{v(!0),b(null),N(!1);try{let e=await fetch("/api/oauth/kiro/auto-import"),t=await e.json();t.found?(p(t.refreshToken),N(!0)):b(t.error||"Could not auto-detect token")}catch(e){b("Failed to auto-detect token")}finally{v(!1)}})()},[l,e]);let w=e=>{n(e),b(null)},k=()=>{n(null),b(null)},C=async()=>{if(!x.trim())return void b("Please enter a refresh token");g(!0),b(null);try{let e=await fetch("/api/oauth/kiro/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:x.trim()})}),r=await e.json();if(!e.ok)throw Error(r.error||"Import failed");t("import")}catch(e){b(e.message)}finally{g(!1)}},S=e=>{t("social",{provider:e})};return(0,a.jsx)(i.aF,{isOpen:e,title:"Connect Kiro",onClose:r,size:"lg",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[!l&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Choose your authentication method:"}),(0,a.jsx)("button",{onClick:()=>t("builder-id"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"shield"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"font-semibold mb-1",children:"AWS Builder ID"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Recommended for most users. Free AWS account required."})]})]})}),(0,a.jsx)("button",{onClick:()=>w("idc"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"business"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"font-semibold mb-1",children:"AWS IAM Identity Center"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"For enterprise users with custom AWS IAM Identity Center."})]})]})}),(0,a.jsx)("button",{onClick:()=>w("social-google"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"account_circle"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"font-semibold mb-1",children:"Google Account"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your Google account (manual callback)."})]})]})}),(0,a.jsx)("button",{onClick:()=>w("social-github"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"code"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"font-semibold mb-1",children:"GitHub Account"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your GitHub account (manual callback)."})]})]})}),(0,a.jsx)("button",{onClick:()=>w("import"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"file_upload"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"font-semibold mb-1",children:"Import Token"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Paste refresh token from Kiro IDE."})]})]})})]}),"idc"===l&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["IDC Start URL ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)(i.pd,{value:d,onChange:e=>c(e.target.value),placeholder:"https://your-org.awsapps.com/start",className:"font-mono text-sm"}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Your organization's AWS IAM Identity Center URL"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium mb-2",children:"AWS Region"}),(0,a.jsx)(i.pd,{value:m,onChange:e=>u(e.target.value),placeholder:"us-east-1",className:"font-mono text-sm"}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"AWS region for your Identity Center (default: us-east-1)"})]}),h&&(0,a.jsx)("p",{className:"text-sm text-red-600",children:h}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:()=>{d.trim()?t("idc",{startUrl:d.trim(),region:m}):b("Please enter your IDC start URL")},fullWidth:!0,children:"Continue"}),(0,a.jsx)(i.$n,{onClick:k,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-google"===l&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,a.jsxs)("div",{className:"flex-1 text-sm",children:[(0,a.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,a.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:()=>S("google"),fullWidth:!0,children:"Continue with Google"}),(0,a.jsx)(i.$n,{onClick:k,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-github"===l&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,a.jsxs)("div",{className:"flex-1 text-sm",children:[(0,a.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,a.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:()=>S("github"),fullWidth:!0,children:"Continue with GitHub"}),(0,a.jsx)(i.$n,{onClick:k,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"import"===l&&(0,a.jsxs)("div",{className:"space-y-4",children:[y&&(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting token..."}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from AWS SSO cache"})]}),!y&&(0,a.jsxs)(a.Fragment,{children:[j&&(0,a.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,a.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Token auto-detected from Kiro IDE successfully!"})]})}),!j&&!h&&(0,a.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,a.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Kiro IDE not detected. Please paste your refresh token manually."})]})}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Refresh Token ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)(i.pd,{value:x,onChange:e=>p(e.target.value),placeholder:"Token will be auto-filled...",className:"font-mono text-sm"})]}),h&&(0,a.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,a.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:h})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:C,fullWidth:!0,disabled:f||!x.trim(),children:f?"Importing...":"Import Token"}),(0,a.jsx)(i.$n,{onClick:k,variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})]})})}o.propTypes={isOpen:n().bool.isRequired,onMethodSelect:n().func.isRequired,onClose:n().func.isRequired}},62899:(e,t,r)=>{r.d(t,{default:()=>c});var a=r(95155),s=r(12115),l=r(14051),n=r.n(l),i=r(90882),o=r(61500),d=r(94230);function c({isOpen:e,providerInfo:t,onSuccess:r,onClose:l}){let[n,m]=(0,s.useState)(null),[u,x]=(0,s.useState)(null),[p,h]=(0,s.useState)(null),b=(0,s.useCallback)((e,t)=>{"builder-id"===e?m("builder-id"):"idc"===e?(m("idc"),h(t)):"social"===e?(m("social"),x(t.provider)):"import"===e&&r?.()},[r]),f=()=>{m(null),x(null),h(null)};return n?"builder-id"===n||"idc"===n?(0,a.jsx)(i.default,{isOpen:e,provider:"kiro",providerInfo:t,onSuccess:()=>{m(null),h(null),r?.(),l?.()},onClose:f,idcConfig:p}):"social"===n&&u?(0,a.jsx)(d.default,{isOpen:e,provider:u,onSuccess:()=>{m(null),x(null),r?.(),l?.()},onClose:f}):null:(0,a.jsx)(o.default,{isOpen:e,onMethodSelect:b,onClose:l})}c.propTypes={isOpen:n().bool.isRequired,providerInfo:n().shape({name:n().string}),onSuccess:n().func,onClose:n().func.isRequired}},65921:(e,t,r)=>{r.d(t,{i:()=>l});var a=r(1934);let s=0,l=(0,a.v)((e,t)=>({notifications:[],addNotification:r=>{let a=++s,l={id:a,type:r.type||"info",message:r.message,title:r.title||null,duration:r.duration??5e3,dismissible:r.dismissible??!0,createdAt:Date.now()};return e(e=>({notifications:[...e.notifications,l]})),l.duration>0&&setTimeout(()=>t().removeNotification(a),l.duration),a},removeNotification:t=>{e(e=>({notifications:e.notifications.filter(e=>e.id!==t)}))},clearAll:()=>e({notifications:[]}),success:(e,r)=>t().addNotification({type:"success",message:e,title:r}),error:(e,r)=>t().addNotification({type:"error",message:e,title:r,duration:8e3}),warning:(e,r)=>t().addNotification({type:"warning",message:e,title:r}),info:(e,r)=>t().addNotification({type:"info",message:e,title:r})}))},72908:(e,t,r)=>{r.d(t,{default:()=>u});var a=r(95155),s=r(12115),l=r(14051),n=r.n(l),i=r(57250),o=r(28777),d=r(52679);let c=[...Object.keys(d.zN),...Object.keys(d.IS),...Object.keys(d.nJ),...Object.keys(d.fg)],m=Object.keys(d.IS).filter(e=>d.IS[e].noAuth);function u({isOpen:e,onClose:t,onSelect:r,onDeselect:l,selectedModel:n,activeProviders:x=[],title:p="Select Model",modelAliases:h={},kindFilter:b=null,addedModelValues:f=[],closeOnSelect:g=!0}){let y=(0,s.useMemo)(()=>b?x.filter(e=>{let t=d.Q2[e.provider];return(t?.serviceKinds||["llm"]).includes(b)}):x,[x,b]),[v,j]=(0,s.useState)(""),[N,w]=(0,s.useState)([]),[k,C]=(0,s.useState)([]),[S,T]=(0,s.useState)([]),[I,$]=(0,s.useState)({}),R=(e,t="combo")=>{if(!e||"object"!=typeof e)return null;let r=String(e.exposedModel||e.model||e.alias||e.name||e.id||"").trim();if(!r)return null;let a=String(e.exposedModel||e.name||r).trim()||r,s=String(e.name||e.id||"").trim(),l=String(e.type||e.comboType||e.kindType||"combo").trim();return{...e,id:e.id||r,name:a,value:r,label:a,internalName:s,pickerSource:t,pickerType:l,isOllamaLocalCombo:l.toLowerCase().includes("ollama")}},P=async()=>{try{let[e,t]=await Promise.allSettled([fetch("/api/combos",{cache:"no-store"}),fetch("/api/virtual-combos",{cache:"no-store"})]),r=[];if("fulfilled"===e.status&&e.value.ok)for(let t of(await e.value.json()).combos||[]){let e=R(t,"legacy");e&&r.push(e)}if("fulfilled"===t.status&&t.value.ok)for(let e of(await t.value.json()).virtualCombos||[]){if(e?.enabled===!1)continue;let t=R(e,"virtual");t&&r.push(t)}let a=new Set,s=[];for(let e of r){let t=String(e.value||e.name||"").trim();!t||a.has(t)||(a.add(t),s.push(e))}s.sort((e,t)=>String(e.value||e.name).localeCompare(String(t.value||t.name))),w(s)}catch(e){console.error("Error fetching combos:",e),w([])}};(0,s.useEffect)(()=>{e&&P()},[e]);let A=async()=>{try{let e=await fetch("/api/provider-nodes");if(!e.ok)throw Error(`Failed to fetch provider nodes: ${e.status}`);let t=await e.json();C(t.nodes||[])}catch(e){console.error("Error fetching provider nodes:",e),C([])}};(0,s.useEffect)(()=>{e&&A()},[e]);let O=async()=>{try{let e=await fetch("/api/models/custom");if(!e.ok)throw Error(`Failed to fetch custom models: ${e.status}`);let t=await e.json();T(t.models||[])}catch(e){console.error("Error fetching custom models:",e),T([])}};(0,s.useEffect)(()=>{e&&O()},[e]);let _=async()=>{try{let e=await fetch("/api/models/disabled");if(!e.ok)throw Error(`Failed to fetch disabled models: ${e.status}`);let t=await e.json();$(t.disabled||{})}catch(e){console.error("Error fetching disabled models:",e),$({})}};(0,s.useEffect)(()=>{e&&_()},[e]);let M=(0,s.useMemo)(()=>({...d.zN,...d.IS,...d.nJ,...d.fg}),[]),L=(0,s.useMemo)(()=>{let e={},t=new Set(["webSearch","webFetch"]),r=new Set(["image","tts","stt","embedding","imageToText"]),a=new Set(["tts","image","webFetch"]);return[...new Set([...y.map(e=>e.provider),...b?m.filter(e=>(d.Q2[e]?.serviceKinds||["llm"]).includes(b)):m])].sort((e,t)=>{let r=c.indexOf(e),a=c.indexOf(t);return(-1===r?999:r)-(-1===a?999:a)}).forEach(s=>{let l=(0,d.wG)(s),n=M[s]||{name:s,color:"#666"},i=(0,d.mq)(s)||(0,d.gb)(s);if(b&&t.has(b)){e[s]={name:n.name,alias:l,color:n.color,models:[{id:s,name:n.name,value:s}]};return}if(n.passthroughModels){let t=Object.entries(h).filter(([,e])=>e.startsWith(`${l}/`)).map(([e,t])=>({id:t.replace(`${l}/`,""),name:e,value:t}));if(b&&r.has(b)&&0===(t=(0,o.KC)(s).filter(e=>e.type===b).map(e=>({id:e.id,name:e.name,value:`${l}/${e.id}`,type:e.type}))).length&&a.has(b)&&(n.serviceKinds||["llm"]).includes(b)&&(t=[{id:s,name:n.name,value:l}]),t.length>0){let r=k.find(e=>e.id===s),a=r?.name||n.name;e[s]={name:a,alias:l,color:n.color,models:t}}}else if(i){if(b&&r.has(b))return;let t=x.find(e=>e.provider===s),a=k.find(e=>e.id===s),l=t?.name||a?.name||n.name,i=t?.providerSpecificData?.prefix||a?.prefix||s,o=Object.entries(h).filter(([,e])=>e.startsWith(`${s}/`)).map(([e,t])=>({id:t.replace(`${s}/`,""),name:e,value:`${i}/${t.replace(`${s}/`,"")}`})),d=o.length>0?o:[{id:`__placeholder__${s}`,name:`${i}/model-id`,value:`${i}/model-id`,isPlaceholder:!0}];e[s]={name:l,alias:i,color:n.color,models:d,isCustom:!0,hasModels:o.length>0}}else{var c;let t=(0,o.KC)(s),i=new Set(t.map(e=>e.id)),d=t.length>0,m=Object.entries(h).filter(([e,t])=>t.startsWith(`${l}/`)&&(!d||e===t.replace(`${l}/`,""))&&!i.has(t.replace(`${l}/`,""))).map(([e,t])=>({id:t.replace(`${l}/`,""),name:e,value:t,isCustom:!0})),u=new Set(m.map(e=>e.id)),x=S.filter(e=>e.providerAlias===l&&!i.has(e.id)&&!u.has(e.id)).map(e=>({id:e.id,name:e.name||e.id,value:`${l}/${e.id}`,isCustom:!0})),p=[...t.map(e=>({id:e.id,name:e.name,value:`${l}/${e.id}`,type:e.type})),...m,...x],f=new Set,g=(c=p.filter(e=>!f.has(e.value)&&(f.add(e.value),!0)),b?r.has(b)?c.filter(e=>e.isPlaceholder||e.type===b):c:c.filter(e=>e.isPlaceholder||!e.type||"llm"===e.type));0===g.length&&b&&a.has(b)&&(n.serviceKinds||["llm"]).includes(b)&&(g=[{id:s,name:n.name,value:l}]),g.length>0&&(e[s]={name:n.name,alias:l,color:n.color,models:g})}}),Object.entries(e).forEach(([t,r])=>{let a=new Set([...I[(0,d.wG)(t)]||[],...I[t]||[]]);0!==a.size&&(r.models=r.models.filter(e=>!a.has(e.id)),0===r.models.length&&delete e[t])}),e},[y,h,M,k,S,I,b,x]),E=(0,s.useMemo)(()=>{if(b)return[];if(!v.trim())return N;let e=v.toLowerCase();return N.filter(t=>[t.name,t.value,t.exposedModel,t.internalName,t.description,t.pickerType].map(e=>String(e||"").toLowerCase()).some(t=>t.includes(e)))},[N,v,b]),z=(0,s.useMemo)(()=>{let e=v.trim().toLowerCase(),t={};return Object.entries(L).forEach(([r,a])=>{var s;let l=a.models;if(e){let t=a.name.toLowerCase().includes(e);if(0===(l=l.filter(t=>t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e))).length&&!t)return}t[r]={...a,models:[...(s=l).filter(e=>f.includes(e.value)).sort((e,t)=>e.name.localeCompare(t.name)),...s.filter(e=>!f.includes(e.value)).sort((e,t)=>e.name.localeCompare(t.name))]}}),t},[L,v,f]),q=e=>{let a=e?.value||e?.name||e;f.includes(a)&&l?l(e):r(e),g&&(t(),j(""))},U=()=>{t(),j("")};return e?(0,a.jsx)("div",{className:"fixed inset-0 z-[300] flex items-center justify-center bg-black/65 p-4 backdrop-blur-sm",onMouseDown:e=>{e.target===e.currentTarget&&U()},role:"dialog","aria-modal":"true","aria-label":p,children:(0,a.jsxs)("div",{className:"flex max-h-[88vh] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border border-border bg-white shadow-2xl dark:bg-zinc-950",onMouseDown:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3 border-b border-border px-4 py-3",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h2",{className:"truncate text-base font-semibold text-text-main",children:p}),(0,a.jsx)("p",{className:"mt-0.5 text-xs text-text-muted",children:"Click to add models to the combo. Click an added item again to remove it."})]}),(0,a.jsx)("button",{type:"button",onClick:U,className:"rounded-lg p-1.5 text-text-muted transition hover:bg-surface hover:text-text-main","aria-label":"Close",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,a.jsxs)("div",{className:"min-h-0 flex-1 overflow-hidden bg-white p-4 dark:bg-zinc-950",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-3 px-2.5 py-2 bg-primary/8 border border-primary/20 rounded-lg text-xs text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary shrink-0",style:{fontSize:"14px"},children:"info"}),(0,a.jsx)("span",{children:"Click to add, click again to remove. Changes are saved automatically."})]}),(0,a.jsx)("div",{className:"mb-3",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("span",{className:"material-symbols-outlined absolute left-2.5 top-1/2 -translate-y-1/2 text-text-muted text-[16px]",children:"search"}),(0,a.jsx)("input",{type:"text",placeholder:"Search...",value:v,onChange:e=>j(e.target.value),className:"w-full rounded-xl border border-border bg-white py-2 pl-9 pr-3 text-sm text-text-main shadow-sm outline-none focus:border-primary focus:ring-2 focus:ring-primary/20 dark:bg-zinc-900"})]})}),(0,a.jsxs)("div",{className:"max-h-[58vh] overflow-y-auto space-y-3 pr-1",children:[E.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 z-10 bg-white py-1 dark:bg-zinc-950",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[14px]",children:"layers"}),(0,a.jsx)("span",{className:"text-xs font-medium text-primary",children:"Combos"}),(0,a.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",E.length,")"]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:E.map(e=>{let t=e.value||e.exposedModel||e.model||e.name||e.id,r=e.name||t,s=f.includes(t),l=n===t;return(0,a.jsxs)("button",{onClick:()=>q({id:t,name:r,value:t,combo:e}),className:`
2
- px-2 py-1 rounded-xl text-xs font-medium transition-all border hover:cursor-pointer flex items-center gap-1
3
- ${l?"bg-primary text-white border-primary":s?"bg-primary border-primary text-white hover:bg-primary-hover":"bg-surface border-border text-text-main hover:border-primary/50 hover:bg-primary/5"}
4
- `,title:e.internalName&&e.internalName!==t?`Internal: ${e.internalName}`:t,children:[s&&(0,a.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),(0,a.jsx)("span",{children:r}),e.isOllamaLocalCombo&&(0,a.jsx)("span",{className:`rounded-full px-1.5 py-0.5 text-[9px] ${l||s?"bg-white/20 text-white":"bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"}`,children:"ollama"})]},`${e.pickerSource||"combo"}-${e.id||t}`)})})]}),Object.entries(z).map(([e,t])=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 z-10 bg-white py-1 dark:bg-zinc-950",children:[(0,a.jsx)(i.A,{src:(0,d.mq)(e)||(0,d.gb)(e)?null:`/providers/${e}.png`,alt:t.name,size:14,fallbackText:(t.name||e).slice(0,2).toUpperCase(),fallbackColor:t.color}),(0,a.jsx)("span",{className:"text-xs font-medium text-primary",children:t.name}),(0,a.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",t.models.length,")"]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:t.models.map(e=>{let t=n===e.value,r=e.isPlaceholder;return(0,a.jsx)("button",{onClick:()=>q(e),title:r?"Select to pre-fill, then edit model ID in the input":void 0,className:`
5
- px-2 py-1 rounded-xl text-xs font-medium transition-all border hover:cursor-pointer
6
- ${r?"border-dashed border-border text-text-muted hover:border-primary/50 hover:text-primary bg-surface italic":t?"bg-primary text-white border-primary":f.includes(e.value)?"bg-primary border-primary text-white hover:bg-primary-hover":"bg-surface border-border text-text-main hover:border-primary/50 hover:bg-primary/5"}
7
- `,children:(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[f.includes(e.value)&&!r&&(0,a.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),r?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"edit"}),e.name]}):e.isCustom?(0,a.jsxs)(a.Fragment,{children:[e.name,(0,a.jsx)("span",{className:"text-[9px] opacity-60 font-normal",children:"custom"})]}):e.name]})},e.value)})})]},e)),0===Object.keys(z).length&&0===E.length&&(0,a.jsxs)("div",{className:"text-center py-4 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1 block",children:"search_off"}),(0,a.jsx)("p",{className:"text-xs",children:"No models found"})]})]})]})]})}):null}u.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onSelect:n().func.isRequired,onDeselect:n().func,selectedModel:n().string,activeProviders:n().arrayOf(n().shape({provider:n().string.isRequired})),title:n().string,modelAliases:n().object,kindFilter:n().string,addedModelValues:n().arrayOf(n().string),closeOnSelect:n().bool}},73579:(e,t,r)=>{r.d(t,{default:()=>j});var a=r(95155),s=r(12115),l=r(14051),n=r.n(l),i=r(81127),o=r(11910),d=r(92542),c=r(56061),m=r(52679),u=r(90620);let x=[0,1,2,3,4,5,6],p=[{value:1,label:"Mon"},{value:2,label:"Tue"},{value:3,label:"Wed"},{value:4,label:"Thu"},{value:5,label:"Fri"},{value:6,label:"Sat"},{value:0,label:"Sun"}],h=[{id:"@cf/meta/llama-3.1-8b-instruct",name:"Cloudflare: Llama 3.1 8B Instruct"},{id:"@cf/meta/llama-3.1-70b-instruct",name:"Cloudflare: Llama 3.1 70B Instruct"},{id:"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b",name:"Cloudflare: DeepSeek R1 Distill Qwen 32B"},{id:"@cf/qwen/qwen1.5-14b-chat-awq",name:"Cloudflare: Qwen 1.5 14B Chat AWQ"}],b=new Set(["antigravity","codex","claude","gemini-cli"]);function f(e=""){return"cloudflare-ai"===e?h:[]}function g(e,t){let r=String(e||"").trim();return/^([01]\d|2[0-3]):([0-5]\d)$/.test(r)?r:t}function y(e={}){let t=e&&"object"==typeof e?e:{},r=Array.isArray(t.weekdays)?t.weekdays.map(Number).filter(e=>e>=0&&e<=6):x;return{enabled:!1!==t.enabled,weekdays:[...new Set(r)].sort((e,t)=>e-t),fromTime:g(t.fromTime||t.from,"00:00"),toTime:g(t.toTime||t.to,"23:59")}}function v(e={}){var t;let r=e&&"object"==typeof e?e:{};return{enabled:!0===r.enabled,intervalSec:Math.max(10,Number.parseInt(r.intervalSec||60,10)||60),failureThreshold:Math.max(1,Number.parseInt(r.failureThreshold||3,10)||3),timeoutMs:Math.max(1e3,Number.parseInt(r.timeoutMs||15e3,10)||15e3),prompt:"string"==typeof r.prompt&&r.prompt.trim()?r.prompt.trim():"Say hi",disableThinking:!1!==r.disableThinking,model:"string"==typeof(t=r.model||r.healthModel||r.testModel)?t.trim():""}}function j({isOpen:e,connection:t,proxyPools:r,onSave:l,onClose:n}){let[h,g]=(0,s.useState)({name:"",priority:1,apiKey:""}),[N,w]=(0,s.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[k,C]=(0,s.useState)({accountId:""}),[S,T]=(0,s.useState)(!1),[I,$]=(0,s.useState)(null),[R,P]=(0,s.useState)(!1),[A,O]=(0,s.useState)(null),[_,M]=(0,s.useState)(!1),[L,E]=(0,s.useState)(y()),[z,q]=(0,s.useState)(v()),[U,D]=(0,s.useState)(!1),[F,W]=(0,s.useState)(!1),[K,B]=(0,s.useState)([]),[G,V]=(0,s.useState)(!1),[J,Q]=(0,s.useState)("");(0,s.useEffect)(()=>{t&&(g({name:t.name||"",priority:t.priority||1,apiKey:""}),"azure"===t.provider&&t.providerSpecificData&&w({azureEndpoint:t.providerSpecificData.azureEndpoint||"",apiVersion:t.providerSpecificData.apiVersion||"2024-10-01-preview",deployment:t.providerSpecificData.deployment||"",organization:t.providerSpecificData.organization||""}),"cloudflare-ai"===t.provider&&t.providerSpecificData&&C({accountId:t.providerSpecificData.accountId||""}),E(y(t.schedule||{})),q(v(t.healthCheck||{})),D(!0===t.providerScheduleOverride),W(!0===t.providerHealthOverride),$(null),O(null))},[t]);let H=t?.authType==="oauth",X=t?.provider==="azure",Y=t?.provider==="cloudflare-ai",Z=t?function(e=""){if((0,m.gb)(e))return"anthropic";if((0,m.mq)(e)||"cloudflare-ai"===e)return"openai";if("gemini"===e)return"gemini";if("github"===e)return"openai";let t=u.X3?.[e]||"";return t.includes("/messages")?"anthropic":t.includes("/chat/completions")||t.includes("/responses")?"openai":null}(t.provider):null,ee=!!Z;(0,s.useEffect)(()=>{if(!e||!t?.id)return;let r=!1;return async function(){let e=f(t.provider);if(e.length>0){V(!1),B(e),Q("Cloudflare does not expose a simple account /models list here. Pick a common Workers AI model below or type the exact model manually.");return}if(!function(e=""){return!(f(e).length>0||b.has(e))}(t.provider)){V(!1),B([]),Q("This provider uses a session/OAuth-specific model resolver. Healthcheck will use connection/token probe unless you type a supported direct chat model manually.");return}V(!0),Q("");try{let e=await fetch(`/api/providers/${t.id}/models`,{cache:"no-store"}),a=e.ok?await e.json():{};if(!r){let t,r,s=e.ok?(t=Array.isArray(a?.models)?a.models:[],r=new Set,t.map(e=>{let t="string"==typeof e?e:e?.id||e?.name||e?.model||e?.displayName;if(!t)return null;let a=String(t).trim();return!a||r.has(a)?null:(r.add(a),{id:a,name:e?.name||e?.displayName||e?.model||a})}).filter(Boolean).sort((e,t)=>e.id.localeCompare(t.id))):[];B(s),e.ok?a.warning?Q(a.warning):0===s.length&&Q("Provider did not return a model list. You can type the healthcheck model manually if this account supports chat ping."):Q(a.error||"Failed to load models")}}catch(e){r||(B([]),Q(e.message||"Failed to load models"))}finally{r||V(!1)}}(),()=>{r=!0}},[e,t?.id,t?.provider]);let et=async()=>{if(t?.provider){T(!0),$(null);try{let e=await fetch(`/api/providers/${t.id}/test`,{method:"POST"}),r=await e.json();$(r.valid?"success":"failed")}catch{$("failed")}finally{T(!1)}}},er=async()=>{if(t?.provider&&h.apiKey){P(!0),O(null);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:h.apiKey,...X?{providerSpecificData:N}:{},...Y?{providerSpecificData:k}:{}})}),r=await e.json();O(r.valid?"success":"failed")}catch{O("failed")}finally{P(!1)}}},ea=async()=>{if(t){M(!0);try{let e={name:h.name,priority:h.priority,schedule:y(L),healthCheck:v(z)};if(!H&&h.apiKey){e.apiKey=h.apiKey;let r="success"===A;if(!r)try{P(!0),O(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:h.apiKey,...X?{providerSpecificData:N}:{},...Y?{providerSpecificData:k}:{}})});r=!!(await e.json()).valid,O(r?"success":"failed")}catch{O("failed")}finally{P(!1)}r&&(e.testStatus="active",e.lastError=null,e.lastErrorAt=null)}X&&(e.providerSpecificData={azureEndpoint:N.azureEndpoint,apiVersion:N.apiVersion,deployment:N.deployment,organization:N.organization}),Y&&(e.providerSpecificData={accountId:k.accountId}),await l(e)}finally{M(!1)}}};return t?(0,a.jsx)(i.default,{isOpen:e,onClose:n,title:"Edit Connection",maxWidth:"2xl",children:(0,a.jsxs)("div",{className:"space-y-5",children:[(0,a.jsx)(o.default,{label:"Name",value:h.name,onChange:e=>g({...h,name:e.target.value}),placeholder:H?"Account name":"Production Key"}),H&&t.email&&(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface p-3 text-sm",children:[(0,a.jsx)("div",{className:"text-text-muted",children:"Email"}),(0,a.jsx)("div",{className:"font-medium text-text-main",children:t.email})]}),(0,a.jsx)(o.default,{label:"Priority",type:"number",min:"1",value:h.priority,onChange:e=>g({...h,priority:Number.parseInt(e.target.value,10)||1})}),!H&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(o.default,{label:"API Key",type:"password",value:h.apiKey,onChange:e=>g({...h,apiKey:e.target.value}),placeholder:"Enter new API key",hint:"Leave blank to keep the current API key.",className:"flex-1"}),(0,a.jsxs)("div",{className:"mt-6 flex items-center gap-2",children:[(0,a.jsx)(d.default,{type:"button",variant:"secondary",onClick:er,disabled:R||!h.apiKey,children:R?"Checking...":"Check"}),A&&(0,a.jsx)(c.default,{variant:"success"===A?"success":"danger",children:"success"===A?"Valid":"Invalid"})]})]}),X&&(0,a.jsxs)("div",{className:"space-y-3 rounded-lg border border-border p-4",children:[(0,a.jsx)("h3",{className:"font-semibold text-text-main",children:"Azure OpenAI Configuration"}),(0,a.jsx)(o.default,{label:"Azure Endpoint",value:N.azureEndpoint,onChange:e=>w({...N,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,a.jsx)(o.default,{label:"Deployment",value:N.deployment,onChange:e=>w({...N,deployment:e.target.value}),placeholder:"gpt-4"}),(0,a.jsx)(o.default,{label:"API Version",value:N.apiVersion,onChange:e=>w({...N,apiVersion:e.target.value}),placeholder:"2024-10-01-preview"}),(0,a.jsx)(o.default,{label:"Organization",value:N.organization,onChange:e=>w({...N,organization:e.target.value}),placeholder:"Organization ID"})]}),Y&&(0,a.jsx)(o.default,{label:"Cloudflare Account ID",value:k.accountId,onChange:e=>C({...k,accountId:e.target.value})}),(0,a.jsxs)("div",{className:"space-y-3 rounded-lg border border-border p-4",children:[(0,a.jsx)("h3",{className:"font-semibold text-text-main",children:"Scheduler"}),U&&(0,a.jsx)("div",{className:"rounded-md border border-warning/30 bg-warning/10 p-2 text-xs text-warning",children:"Provider-level scheduler override is enabled. This account scheduler is locked and ignored while override is on."}),(0,a.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)("input",{type:"checkbox",checked:!1!==L.enabled,disabled:U,onChange:e=>E(t=>({...t,enabled:e.target.checked}))}),"Enable account scheduler"]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:p.map(e=>(0,a.jsxs)("label",{className:"flex items-center gap-1 rounded border border-border px-2 py-1 text-xs",children:[(0,a.jsx)("input",{type:"checkbox",checked:(L.weekdays||[]).includes(e.value),disabled:U||!1===L.enabled,onChange:()=>E(t=>{let r=new Set(Array.isArray(t.weekdays)?t.weekdays:x);return r.has(e.value)?r.delete(e.value):r.add(e.value),{...t,weekdays:[...r].sort((e,t)=>e-t)}})}),e.label]},e.value))}),(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,a.jsxs)("label",{className:"text-sm text-text-muted",children:["From time",(0,a.jsx)("input",{type:"time",value:L.fromTime,disabled:U||!1===L.enabled,onChange:e=>E(t=>({...t,fromTime:e.target.value})),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary disabled:opacity-50"})]}),(0,a.jsxs)("label",{className:"text-sm text-text-muted",children:["To time",(0,a.jsx)("input",{type:"time",value:L.toTime,disabled:U||!1===L.enabled,onChange:e=>E(t=>({...t,toTime:e.target.value})),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary disabled:opacity-50"})]})]})]}),(0,a.jsxs)("div",{className:"space-y-3 rounded-lg border border-border p-4",children:[(0,a.jsx)("h3",{className:"font-semibold text-text-main",children:"Ping Health Check"}),F&&(0,a.jsx)("div",{className:"rounded-md border border-warning/30 bg-warning/10 p-2 text-xs text-warning",children:"Provider-level healthcheck override is enabled. This account healthcheck policy is locked and ignored while override is on."}),(0,a.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)("input",{type:"checkbox",checked:!0===z.enabled,disabled:F,onChange:e=>q(t=>({...t,enabled:e.target.checked}))}),"Enable periodic health check"]}),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("label",{className:"text-sm text-text-muted",children:["Healthcheck model",(0,a.jsxs)("select",{value:z.model||"",disabled:F||!z.enabled,onChange:e=>q(t=>({...t,model:e.target.value})),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary disabled:opacity-50",children:[(0,a.jsx)("option",{value:"",children:"Connection/base URL only — no chat ping"}),K.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name||e.id},e.id))]})]}),(0,a.jsxs)("label",{className:"text-sm text-text-muted",children:["Manual healthcheck model",(0,a.jsx)("input",{type:"text",value:z.model||"",disabled:F||!z.enabled,onChange:e=>q(t=>({...t,model:e.target.value})),placeholder:"anthropic"===Z?"claude/model name from this endpoint":"gemini"===Z?"gemini model, e.g. gemini-2.5-flash":"model name from this endpoint",className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary disabled:opacity-50"})]}),G&&(0,a.jsx)("div",{className:"text-xs text-text-muted",children:"Loading models..."}),J&&(0,a.jsxs)("div",{className:"text-xs text-warning",children:["Model list note: ",J]}),"anthropic"===Z&&(0,a.jsxs)("div",{className:"rounded-md bg-surface p-2 text-xs text-text-muted",children:["Anthropic-compatible healthcheck sends Say hi to ",(0,a.jsx)("code",{children:"/v1/messages"})," only when a model is selected. If this endpoint does not expose ",(0,a.jsx)("code",{children:"/v1/models"}),", type the model name manually."]}),"gemini"===Z&&(0,a.jsxs)("div",{className:"rounded-md bg-surface p-2 text-xs text-text-muted",children:["Gemini healthcheck sends Say hi with the native ",(0,a.jsx)("code",{children:"generateContent"})," API only when a model is selected."]}),"cloudflare-ai"===t.provider&&(0,a.jsxs)("div",{className:"rounded-md bg-surface p-2 text-xs text-text-muted",children:["Cloudflare healthcheck sends Say hi to the Workers AI OpenAI-style chat endpoint only when a model is selected. If the model list is incomplete, type the exact ",(0,a.jsx)("code",{children:"@cf/..."})," model manually."]}),!ee&&(0,a.jsx)("div",{className:"rounded-md bg-surface p-2 text-xs text-text-muted",children:"This provider can still load/show models if its model resolver supports it. Auto healthcheck will keep using the original connection/token/account probe until a direct chat endpoint is available."})]}),z.enabled&&(!ee||!z.model)&&(0,a.jsx)("div",{className:"rounded-md border border-warning/30 bg-warning/10 p-2 text-xs text-warning",children:"No direct chat healthcheck model/endpoint is active. Auto healthcheck will test connection/base URL/key/token/account and will not send the Say hi chat ping."}),(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,a.jsxs)("label",{className:"text-sm text-text-muted",children:["Interval seconds",(0,a.jsx)("input",{type:"number",value:z.intervalSec,disabled:F||!z.enabled,onChange:e=>q(t=>({...t,intervalSec:Math.max(10,Number.parseInt(e.target.value,10)||60)})),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary disabled:opacity-50"})]}),(0,a.jsxs)("label",{className:"text-sm text-text-muted",children:["Fail threshold",(0,a.jsx)("input",{type:"number",value:z.failureThreshold,disabled:F||!z.enabled,onChange:e=>q(t=>({...t,failureThreshold:Math.max(1,Number.parseInt(e.target.value,10)||3)})),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary disabled:opacity-50"})]}),(0,a.jsxs)("label",{className:"text-sm text-text-muted",children:["Timeout ms",(0,a.jsx)("input",{type:"number",value:z.timeoutMs,disabled:F||!z.enabled,onChange:e=>q(t=>({...t,timeoutMs:Math.max(1e3,Number.parseInt(e.target.value,10)||15e3)})),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary disabled:opacity-50"})]})]}),(0,a.jsxs)("label",{className:"text-sm text-text-muted",children:["Prompt",(0,a.jsx)("input",{type:"text",value:z.prompt,disabled:F||!z.enabled||!z.model,onChange:e=>q(t=>({...t,prompt:e.target.value})),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary disabled:opacity-50"})]}),(0,a.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)("input",{type:"checkbox",checked:!1!==z.disableThinking,disabled:F||!z.enabled||!z.model,onChange:e=>q(t=>({...t,disableThinking:e.target.checked}))}),"Prefer lightweight test / disable thinking where supported"]}),(0,a.jsxs)("div",{className:"rounded-md bg-surface p-2 text-xs text-text-muted",children:["Status: ",t.healthStatus||"unknown",t.healthLastCheckedAt&&(0,a.jsxs)("span",{children:[" \xb7 last checked: ",t.healthLastCheckedAt]}),t.healthLastError&&(0,a.jsx)("div",{className:"mt-1 text-danger",children:t.healthLastError})]})]}),!X&&!Y&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(d.default,{type:"button",variant:"secondary",onClick:et,disabled:S,children:S?"Testing...":"Test Connection"}),I&&(0,a.jsx)(c.default,{variant:"success"===I?"success":"danger",children:"success"===I?"Valid":"Failed"})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,a.jsx)(d.default,{type:"button",variant:"primary",onClick:ea,disabled:_||R,children:_?"Saving...":"Save"}),(0,a.jsx)(d.default,{type:"button",variant:"secondary",onClick:n,disabled:_,children:"Cancel"})]})]})}):null}j.propTypes={isOpen:n().bool.isRequired,connection:n().shape({id:n().string,name:n().string,email:n().string,priority:n().number,authType:n().string,provider:n().string,providerSpecificData:n().object,schedule:n().object,healthCheck:n().object,healthStatus:n().string,healthLastCheckedAt:n().string,healthLastError:n().string,providerScheduleOverride:n().bool,providerHealthOverride:n().bool}),proxyPools:n().arrayOf(n().shape({id:n().string,name:n().string})),onSave:n().func.isRequired,onClose:n().func.isRequired}},74891:(e,t,r)=>{r.d(t,{default:()=>f});var a=r(95155),s=r(12115),l=r(73321),n=r(98500),i=r.n(n),o=r(14051),d=r.n(o),c=r(57250),m=r(80752),u=r(38587),x=r(38003),p=r(90620),h=r(52679),b=r(73006);function f({onMenuClick:e,showMenuButton:t=!0}){let r=(0,l.usePathname)(),n=(0,l.useRouter)(),[o,d]=(0,s.useState)(""),[x,y]=(0,s.useState)(""),{title:v,description:j,icon:N,breadcrumbs:w}=(0,s.useMemo)(()=>(e=>{if(!e)return{title:"",description:"",breadcrumbs:[]};let t=e.match(/\/media-providers\/([^/]+)\/([^/]+)$/);if(t){let e=t[1],r=t[2],a=h.rj.find(t=>t.id===e),s=h.Q2[r];return{title:s?.name||r,description:"",breadcrumbs:[{label:"Media Providers",href:`/dashboard/media-providers/${e}`},{label:a?.label||e,href:`/dashboard/media-providers/${e}`},{label:s?.name||r,image:`/providers/${r}.png`}]}}let r=e.match(/\/media-providers\/([^/]+)$/);if(r){let e=r[1],t=h.rj.find(t=>t.id===e);return{title:t?.label||e,description:`Manage your ${t?.label||e} providers`,icon:t?.icon||"perm_media",breadcrumbs:[]}}let a=e.match(/\/providers\/([^/]+)$/);if(a){let e=a[1],t=p.zN[e]||p.fg[e];if(t)return{title:t.name,description:"",breadcrumbs:[{label:"Providers",href:"/dashboard/providers"},{label:t.name,image:`/providers/${t.id}.png`}]}}return e.includes("/providers")&&!e.includes("/media-providers")?{title:"Providers",description:"Manage your AI provider connections",icon:"dns",breadcrumbs:[]}:e.includes("/combos")?{title:"Combos",description:"Model combos with fallback",icon:"layers",breadcrumbs:[]}:e.includes("/usage")?{title:"Usage & Analytics",description:"Monitor your API usage, token consumption, and request logs",icon:"bar_chart",breadcrumbs:[]}:e.includes("/auth-files")?{title:"Auth Files",description:"Map provider credentials stored in the local database",icon:"vpn_key",breadcrumbs:[]}:e.includes("/quota")?{title:"Quota Tracker",description:"Track and manage your API quota limits",icon:"data_usage",breadcrumbs:[]}:e.includes("/mitm")?{title:"AI Traffic Proxy",description:"Intercept CLI tool traffic and route through this router gateway",icon:"security",breadcrumbs:[]}:e.includes("/cli-tools")?{title:"CLI Tools",description:"Configure CLI tools",icon:"terminal",breadcrumbs:[]}:e.includes("/proxy-pools")?{title:"Proxy Pools",description:"Manage your proxy pool configurations",icon:"lan",breadcrumbs:[]}:e.includes("/skills")?{title:"Agent Skills",description:"Copy a link and paste to your AI to use this Router — no install needed",icon:"extension",breadcrumbs:[]}:e.includes("/endpoint")?{title:"Endpoint",description:"API endpoint configuration",icon:"api",breadcrumbs:[]}:e.includes("/profile")?{title:"Settings",description:"Manage your preferences",icon:"settings",breadcrumbs:[]}:e.includes("/translator")?{title:"Translator",description:"Debug translation flow between formats",icon:"translate",breadcrumbs:[]}:e.includes("/console-log")?{title:"Console Log",description:"Live server console output",icon:"monitor",breadcrumbs:[]}:"/dashboard"===e?{title:"Endpoint",description:"API endpoint configuration",icon:"api",breadcrumbs:[]}:{title:"",description:"",breadcrumbs:[]}})(r),[r]);(0,s.useEffect)(()=>{let e=!1;return async function(){try{let t=await fetch("/api/auth/status",{cache:"no-store"});if(!t.ok)return;let r=await t.json();e||(d(r?.displayName||r?.oidcName||r?.oidcEmail||""),y(r?.loginMethod||""))}catch{e||(d(""),y(""))}}(),()=>{e=!0}},[]);let k=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&(n.push("/login"),n.refresh())}catch(e){console.error("Failed to logout:",e)}};return(0,a.jsxs)("header",{className:"shrink-0 flex items-center justify-between gap-3 px-4 lg:px-8 pt-3 pb-2 border-b border-border-subtle bg-surface/60 backdrop-blur-xl lg:bg-transparent lg:backdrop-blur-none z-20",children:[(0,a.jsx)("div",{className:"flex items-center gap-3 lg:hidden shrink-0",children:t&&(0,a.jsx)("button",{onClick:e,className:"text-text-main hover:text-primary transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined",children:"menu"})})}),(0,a.jsx)("div",{className:"flex flex-col min-w-0 flex-1",children:w.length>0?(0,a.jsx)("div",{className:"flex items-center gap-2",children:w.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[t>0&&(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-base",children:"chevron_right"}),e.href?(0,a.jsx)(i(),{href:e.href,className:"text-text-muted hover:text-primary transition-colors",children:e.label}):(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[e.image&&(0,a.jsx)(c.A,{src:e.image,alt:e.label,size:28,className:"object-contain rounded max-w-[28px] max-h-[28px]",fallbackText:e.label.slice(0,2).toUpperCase()}),(0,a.jsx)("h1",{className:"text-base lg:text-2xl font-semibold text-text-main tracking-tight truncate",children:(0,b.Tl)(e.label)})]})]},`${e.label}-${e.href||"current"}`))}):v?(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[N&&(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-xl lg:text-2xl",children:N}),(0,a.jsx)("h1",{className:"text-base lg:text-2xl font-semibold tracking-tight truncate",children:(0,b.Tl)(v)})]}),j&&(0,a.jsx)("p",{className:"hidden lg:block text-sm text-text-muted truncate",children:(0,b.Tl)(j)})]}):null}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[o&&"OIDC"===x&&(0,a.jsxs)("div",{className:"hidden sm:flex items-center max-w-[220px] px-3 py-1.5 rounded-full border border-border bg-surface/70 text-xs text-text-muted truncate",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1.5 text-primary",children:"person"}),(0,a.jsx)("span",{className:"truncate",children:o}),(0,a.jsx)("span",{className:"ml-2 shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary",children:"OIDC"})]}),(0,a.jsx)(g,{}),(0,a.jsx)(u.default,{}),(0,a.jsx)(m.default,{onLogout:k})]})]})}function g(){let e=(0,x.C)(e=>e.visible),t=(0,x.C)(e=>e.query),r=(0,x.C)(e=>e.placeholder),s=(0,x.C)(e=>e.setQuery);return e?(0,a.jsxs)("div",{className:"relative w-[160px] sm:w-[220px]",children:[(0,a.jsx)("span",{className:"material-symbols-outlined absolute left-2 top-1/2 -translate-y-1/2 text-text-muted text-[16px] pointer-events-none",children:"search"}),(0,a.jsx)("input",{type:"text",value:t,onChange:e=>s(e.target.value),placeholder:r,className:"w-full h-8 pl-7 pr-7 rounded-lg border border-border bg-surface/60 text-sm focus:outline-none focus:border-primary/50 transition-colors"}),t&&(0,a.jsx)("button",{type:"button",onClick:()=>s(""),className:"absolute right-1 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-main p-0.5 rounded","aria-label":"Clear search",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]}):null}f.propTypes={onMenuClick:d().func,showMenuButton:d().bool}},80752:(e,t,r)=>{r.d(t,{default:()=>x});var a=r(95155),s=r(12115),l=r(14051),n=r.n(l),i=r(93308),o=r(1620),d=r(40197);r(14932);var c=r(21931);let m={en:{name:"English",flag:"\uD83C\uDDFA\uD83C\uDDF8"},vi:{name:"Tiếng Việt",flag:"\uD83C\uDDFB\uD83C\uDDF3"},"zh-CN":{name:"简体中文",flag:"\uD83C\uDDE8\uD83C\uDDF3"},"zh-TW":{name:"繁體中文",flag:"\uD83C\uDDF9\uD83C\uDDFC"},ja:{name:"日本語",flag:"\uD83C\uDDEF\uD83C\uDDF5"},"pt-BR":{name:"Portugu\xeas (BR)",flag:"\uD83C\uDDE7\uD83C\uDDF7"},"pt-PT":{name:"Portugu\xeas (PT)",flag:"\uD83C\uDDF5\uD83C\uDDF9"},ko:{name:"한국어",flag:"\uD83C\uDDF0\uD83C\uDDF7"},es:{name:"Espa\xf1ol",flag:"\uD83C\uDDEA\uD83C\uDDF8"},de:{name:"Deutsch",flag:"\uD83C\uDDE9\uD83C\uDDEA"},fr:{name:"Fran\xe7ais",flag:"\uD83C\uDDEB\uD83C\uDDF7"},he:{name:"עברית",flag:"\uD83C\uDDEE\uD83C\uDDF1"},ar:{name:"العربية",flag:"\uD83C\uDDF8\uD83C\uDDE6"},ru:{name:"Русский",flag:"\uD83C\uDDF7\uD83C\uDDFA"},pl:{name:"Polski",flag:"\uD83C\uDDF5\uD83C\uDDF1"},cs:{name:"Čeština",flag:"\uD83C\uDDE8\uD83C\uDDFF"},nl:{name:"Nederlands",flag:"\uD83C\uDDF3\uD83C\uDDF1"},tr:{name:"T\xfcrk\xe7e",flag:"\uD83C\uDDF9\uD83C\uDDF7"},uk:{name:"Українська",flag:"\uD83C\uDDFA\uD83C\uDDE6"},tl:{name:"Tagalog",flag:"\uD83C\uDDF5\uD83C\uDDED"},id:{name:"Indonesia",flag:"\uD83C\uDDEE\uD83C\uDDE9"},th:{name:"ไทย",flag:"\uD83C\uDDF9\uD83C\uDDED"},hi:{name:"हिन्दी",flag:"\uD83C\uDDEE\uD83C\uDDF3"},bn:{name:"বাংলা",flag:"\uD83C\uDDE7\uD83C\uDDE9"},ur:{name:"اردو",flag:"\uD83C\uDDF5\uD83C\uDDF0"},ro:{name:"Rom\xe2nă",flag:"\uD83C\uDDF7\uD83C\uDDF4"},sv:{name:"Svenska",flag:"\uD83C\uDDF8\uD83C\uDDEA"},it:{name:"Italiano",flag:"\uD83C\uDDEE\uD83C\uDDF9"},el:{name:"Ελληνικά",flag:"\uD83C\uDDEC\uD83C\uDDF7"},hu:{name:"Magyar",flag:"\uD83C\uDDED\uD83C\uDDFA"},fi:{name:"Suomi",flag:"\uD83C\uDDEB\uD83C\uDDEE"},da:{name:"Dansk",flag:"\uD83C\uDDE9\uD83C\uDDF0"},no:{name:"Norsk",flag:"\uD83C\uDDF3\uD83C\uDDF4"}};function u({icon:e,label:t,onClick:r,trailing:s,danger:l}){return(0,a.jsxs)("button",{onClick:r,className:`flex items-center gap-3 w-full px-4 py-2.5 text-sm transition-colors ${l?"text-red-500 hover:bg-red-500/10":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[20px] ${l?"":"text-text-muted"}`,children:e}),(0,a.jsx)("span",{className:"flex-1 text-left",children:t}),s&&(0,a.jsx)("span",{className:"text-base",children:s})]})}function x({onLogout:e}){let[t,r]=(0,s.useState)(!1),[l,n]=(0,s.useState)(!1),[p,h]=(0,s.useState)(!1),[b,f]=(0,s.useState)("en"),{toggleTheme:g,isDark:y}=(0,o.D)(),v=(0,s.useRef)(null);return(0,s.useEffect)(()=>{f(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${i.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,i.QC)(t)}())},[p]),(0,s.useEffect)(()=>{let e=e=>{v.current&&!v.current.contains(e.target)&&r(!1)};if(t)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[t]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"relative",ref:v,children:[(0,a.jsx)("button",{onClick:()=>r(e=>!e),className:"flex items-center justify-center p-2 rounded-lg text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5 transition-all",title:"Menu",children:(0,a.jsx)("span",{className:"material-symbols-outlined",children:"grid_view"})}),t&&(0,a.jsxs)("div",{className:"absolute right-0 top-full mt-2 w-60 bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl z-50 animate-in fade-in zoom-in-95 duration-150 overflow-hidden py-1",children:[(0,a.jsx)(u,{icon:"history",label:"Change Log",onClick:()=>{r(!1),n(!0)}}),(0,a.jsx)(u,{icon:"language",label:m[b]?.name||b,trailing:m[b]?.flag||"\uD83C\uDF10",onClick:()=>{r(!1),h(!0)}}),(0,a.jsx)(u,{icon:y?"light_mode":"dark_mode",label:"Theme",onClick:()=>{g(),r(!1)}}),(0,a.jsx)(u,{icon:"logout",label:"Logout",danger:!0,onClick:()=>{r(!1),e()}})]})]}),(0,a.jsx)(d.default,{isOpen:l,onClose:()=>n(!1)}),(0,a.jsx)(c.default,{hideTrigger:!0,isOpen:p,onClose:e=>{h(!1),f(e)}})]})}u.propTypes={icon:n().string.isRequired,label:n().string.isRequired,onClick:n().func.isRequired,trailing:n().node,danger:n().bool},x.propTypes={onLogout:n().func.isRequired}},81127:(e,t,r)=>{r.d(t,{ConfirmModal:()=>d,default:()=>o});var a=r(95155),s=r(12115),l=r(31474),n=r(92542),i=r(97677);function o({isOpen:e,onClose:t,title:r,children:n,footer:d,size:c="md",closeOnOverlay:m=!0,showTrafficLights:u=!0,className:x}){return((0,s.useEffect)(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),(0,s.useEffect)(()=>{let r=r=>{"Escape"===r.key&&e&&t()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,t]),e)?(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:m?t:void 0}),(0,a.jsxs)("div",{className:(0,l.cn)("relative w-full bg-surface","border border-border-subtle","rounded-[14px] shadow-[var(--shadow-elev)]","fade-in",{sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"}[c],x),children:[(r||u)&&(0,a.jsxs)("div",{className:"flex items-center justify-between p-2 border-b border-border-subtle",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[u&&(0,a.jsxs)("div",{className:"hidden md:flex items-center gap-2 mr-4 ml-2",children:[(0,a.jsx)(i.default,{text:"Close",position:"top",color:"#FF5F56",children:(0,a.jsx)("button",{onClick:t,"aria-label":"Close",title:"Close",className:"w-4 h-4 rounded-full bg-[#FF5F56] hover:brightness-90 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,a.jsx)("span",{className:"text-[9px] font-bold text-white opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:"✕"})})}),(0,a.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"}),(0,a.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"})]}),r&&(0,a.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:r})]}),(0,a.jsx)("button",{onClick:t,"aria-label":"Close",className:"md:hidden p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,a.jsx)("div",{className:"p-6 max-h-[calc(85vh-100px)] overflow-y-auto custom-scrollbar",children:n}),d&&(0,a.jsx)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-border-subtle",children:d})]})]}):null}function d({isOpen:e,onClose:t,onConfirm:r,title:s="Confirm",message:l,confirmText:i="Confirm",cancelText:c="Cancel",variant:m="danger",loading:u=!1}){return(0,a.jsx)(o,{isOpen:e,onClose:t,title:s,size:"sm",footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.default,{variant:"ghost",onClick:t,disabled:u,children:c}),(0,a.jsx)(n.default,{variant:m,onClick:r,loading:u,children:i})]}),children:(0,a.jsx)("p",{className:"text-text-muted",children:l})})}},84588:(e,t,r)=>{r.d(t,{default:()=>l});var a=r(95155),s=r(31474);function l({children:e,title:t,subtitle:r,icon:n,action:i,padding:o="md",hover:d=!1,elev:c=!1,className:m,...u}){return(0,a.jsxs)("div",{className:(0,s.cn)("bg-surface border border-border-subtle",c?"rounded-[14px] shadow-[var(--shadow-elev)]":"rounded-[14px] shadow-[var(--shadow-soft)]",d&&"hover:shadow-[var(--shadow-warm)] hover:border-brand-500/30 transition-all cursor-pointer",{none:"",xs:"p-3",sm:"p-4",md:"p-6",lg:"p-8"}[o],m),...u,children:[(t||i)&&(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[n&&(0,a.jsx)("div",{className:"p-2 rounded-[10px] bg-bg text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:n})}),(0,a.jsxs)("div",{children:[t&&(0,a.jsx)("h3",{className:"text-text-main font-semibold",children:t}),r&&(0,a.jsx)("p",{className:"text-sm text-text-muted",children:r})]})]}),i]}),e]})}l.Section=function({children:e,className:t,...r}){return(0,a.jsx)("div",{className:(0,s.cn)("p-4 rounded-[10px]","bg-bg border border-border-subtle",t),...r,children:e})},l.Row=function({children:e,className:t,...r}){return(0,a.jsx)("div",{className:(0,s.cn)("p-3 -mx-3 px-3 transition-colors","border-b border-border-subtle last:border-b-0","hover:bg-surface-2/50",t),...r,children:e})},l.ListItem=function({children:e,actions:t,className:r,...l}){return(0,a.jsxs)("div",{className:(0,s.cn)("group flex items-center justify-between p-3 -mx-3 px-3","border-b border-border-subtle last:border-b-0","hover:bg-surface-2/50 transition-colors",r),...l,children:[(0,a.jsx)("div",{className:"flex-1 min-w-0",children:e}),t&&(0,a.jsx)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:t})]})}},86671:(e,t,r)=>{r.d(t,{default:()=>u});var a=r(95155),s=r(12115),l=r(65921),n=r(92622),i=r(74891),o=r(73321);let d=["/dashboard/api-keys"];function c(e){return d.some(t=>e===t||e.startsWith(`${t}/`))}function m({children:e}){let t=(0,o.usePathname)(),r=(0,o.useRouter)(),[l,n]=(0,s.useState)(!1),[i,d]=(0,s.useState)(!0);return((0,s.useEffect)(()=>{let e=!1;return fetch("/api/auth/status",{cache:"no-store"}).then(e=>e.json()).then(a=>{if(e)return;let s=a?.isAdmin!==!1;d(s),s||c(t)||r.replace("/dashboard/api-keys")}).catch(()=>{}).finally(()=>{e||n(!0)}),()=>{e=!0}},[t,r]),l)?i||c(t)?e:(0,a.jsx)("div",{className:"flex min-h-[50vh] items-center justify-center text-sm text-text-muted",children:"Redirecting..."}):(0,a.jsxs)("div",{className:"flex min-h-[50vh] items-center justify-center text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined mr-2 animate-spin",children:"progress_activity"}),"Loading dashboard..."]})}function u({children:e}){let[t,r]=(0,s.useState)(!1),o=(0,l.i)(e=>e.notifications),d=(0,l.i)(e=>e.removeNotification);return(0,a.jsxs)("div",{className:"min-h-screen bg-background text-text-main",children:[(0,a.jsx)("div",{className:"pointer-events-none fixed inset-0 bg-[linear-gradient(to_right,rgba(99,102,241,0.07)_1px,transparent_1px),linear-gradient(to_bottom,rgba(99,102,241,0.07)_1px,transparent_1px)] bg-size-[32px_32px]"}),(0,a.jsx)("div",{className:"fixed right-4 top-4 z-50 flex w-[min(420px,calc(100vw-2rem))] flex-col gap-2",children:o.map(e=>{var t;let r="success"===(t=e.type)?{wrapper:"border-green-500/30 bg-green-500/10 text-green-600 dark:text-green-400",icon:"check_circle"}:"error"===t?{wrapper:"border-red-500/30 bg-red-500/10 text-red-600 dark:text-red-400",icon:"error"}:"warning"===t?{wrapper:"border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400",icon:"warning"}:{wrapper:"border-blue-500/30 bg-blue-500/10 text-blue-600 dark:text-blue-400",icon:"info"};return(0,a.jsx)("div",{className:`rounded-xl border px-4 py-3 shadow-lg backdrop-blur ${r.wrapper}`,children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-lg",children:r.icon}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 text-sm",children:[e.title?(0,a.jsx)("div",{className:"font-semibold",children:e.title}):null,(0,a.jsx)("div",{children:e.message})]}),e.dismissible?(0,a.jsx)("button",{onClick:()=>d(e.id),className:"text-current/70 hover:text-current","aria-label":"Dismiss notification",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})}):null]})},e.id)})}),t&&(0,a.jsx)("div",{className:"fixed inset-0 z-40 bg-black/40 lg:hidden",onClick:()=>r(!1)}),(0,a.jsx)("aside",{className:"fixed inset-y-0 left-0 z-40 hidden w-72 border-r border-border bg-surface/90 backdrop-blur lg:block",children:(0,a.jsx)(n.default,{})}),(0,a.jsx)("aside",{className:`fixed inset-y-0 left-0 z-50 w-72 border-r border-border bg-surface/95 backdrop-blur transition-transform lg:hidden ${t?"translate-x-0":"-translate-x-full"}`,children:(0,a.jsx)(n.default,{onClose:()=>r(!1)})}),(0,a.jsxs)("main",{className:"relative z-10 min-h-screen lg:pl-72",children:[(0,a.jsx)(i.default,{onMenuClick:()=>r(!0)}),(0,a.jsx)("div",{className:"w-full max-w-none min-w-0 px-4 py-6 sm:px-6 lg:px-8",children:(0,a.jsx)(m,{children:e})})]})]})}},90882:(e,t,r)=>{r.d(t,{default:()=>d});var a=r(95155),s=r(12115),l=r(14051),n=r.n(l),i=r(35497),o=r(11059);function d({isOpen:e,provider:t,providerInfo:r,onSuccess:l,onClose:n,oauthMeta:c,idcConfig:m}){let[u,x]=(0,s.useState)("waiting"),[p,h]=(0,s.useState)(null),[b,f]=(0,s.useState)(""),[g,y]=(0,s.useState)(null),[v,j]=(0,s.useState)(!1),[N,w]=(0,s.useState)(null),[k,C]=(0,s.useState)(!1),S=(0,s.useRef)(null),T=(0,s.useRef)(!1),{copied:I,copy:$}=(0,o.C)(),[R,P]=(0,s.useState)(!1),[A,O]=(0,s.useState)("/callback?code=..."),_=(0,s.useRef)(!1);(0,s.useEffect)(()=>{P("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname),O(`${window.location.origin}/callback?code=...`)},[]);let M=(0,s.useCallback)(async(e,r)=>{if(p)try{let a=await fetch(`/api/oauth/${t}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,redirectUri:p.redirectUri,codeVerifier:p.codeVerifier,state:r,...c?{meta:c}:{}})}),s=await a.json();if(!a.ok)throw Error(s.error);x("success"),l?.()}catch(e){y(e.message),x("error")}},[p,t,l]),L=(0,s.useCallback)(async e=>{if(p?.state)try{let t=await fetch("/api/oauth/xai/manual-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,state:p.state})}),r=await t.json();if(!t.ok)throw Error(r.error);x("success"),l?.()}catch(e){y(e.message),x("error")}},[p,l]),E=(0,s.useCallback)(async(e,r,a,s)=>{T.current=!1,C(!0);for(let n=0;n<60;n++){if(T.current){console.log("[OAuthModal] Polling aborted"),C(!1);return}if(await new Promise(e=>setTimeout(e,1e3*a)),T.current){console.log("[OAuthModal] Polling aborted after sleep"),C(!1);return}try{let n=await fetch(`/api/oauth/${t}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:e,codeVerifier:r,extraData:s})}),i=await n.json();if(i.success){T.current=!0,x("success"),C(!1),l?.();return}if("expired_token"===i.error||"access_denied"===i.error)throw Error(i.errorDescription||i.error);"slow_down"===i.error&&(a=Math.min(a+5,30))}catch(e){y(e.message),x("error"),C(!1);return}}y("Authorization timeout"),x("error"),C(!1)},[t,l]),z=(0,s.useCallback)(async()=>{if(t)try{let e;if(y(null),["github","qwen","kiro","kimi-coding","kilocode","codebuddy"].includes(t)){j(!0),x("waiting");let e=new URL(`/api/oauth/${t}/device-code`,window.location.origin);"kiro"===t&&m?.startUrl&&(e.searchParams.set("start_url",m.startUrl),m.region&&e.searchParams.set("region",m.region),e.searchParams.set("auth_method","idc"));let r=await fetch(e.toString()),a=await r.json();if(!r.ok)throw Error(a.error);w(a);let s=a.verification_uri_complete||a.verification_uri;s&&window.open(s,"_blank","noopener,noreferrer");let l="kiro"===t?{_clientId:a._clientId,_clientSecret:a._clientSecret,_region:a._region,_authMethod:a._authMethod,_startUrl:a._startUrl}:null;E(a.device_code,a.codeVerifier,a.interval||5,l);return}let r=window.location.port||("https:"===window.location.protocol?"443":"80");e="codex"===t?"http://localhost:1455/auth/callback":"xai"===t?"http://127.0.0.1:56121/callback":`http://localhost:${r}/callback`;let a=new URL(`/api/oauth/${t}/authorize`,window.location.origin);a.searchParams.set("redirect_uri",e),c&&Object.entries(c).forEach(([e,t])=>{t&&a.searchParams.set(e,t)});let s=await fetch(a.toString()),l=await s.json();if(!s.ok)throw Error(l.error);let n=!1,i=!1;if("codex"===t)try{let t=new URL("/api/oauth/codex/start-proxy",window.location.origin);t.searchParams.set("app_port",r),t.searchParams.set("state",l.state),t.searchParams.set("code_verifier",l.codeVerifier),t.searchParams.set("redirect_uri",e);let a=await fetch(t.toString()),s=await a.json();n=s.success,i=!!s.serverSide}catch{n=!1}let o=!1,d=!1;if("xai"===t)try{let t=new URL("/api/oauth/xai/start-proxy",window.location.origin);t.searchParams.set("app_port",r),t.searchParams.set("state",l.state),t.searchParams.set("code_verifier",l.codeVerifier),t.searchParams.set("redirect_uri",e);let a=await fetch(t.toString()),s=await a.json();if(o=s.success,d=!!s.serverSide,!o&&"port_busy"===s.reason)throw Error("Port 56121 in use; close the conflicting process and retry")}catch(e){if(e?.message)throw e;o=!1}h({...l,redirectUri:e,codexServerSide:i,xaiServerSide:d}),"codex"===t&&n||"xai"===t&&o||R&&"codex"!==t&&"xai"!==t?(x("waiting"),S.current=window.open(l.authUrl,"oauth_popup","width=600,height=700"),S.current||x("input")):(x("input"),window.open(l.authUrl,"_blank"))}catch(e){y(e.message),x("error")}},[t,R,E,c,m]);(0,s.useEffect)(()=>{e&&t?(h(null),f(""),y(null),j(!1),w(null),C(!1),T.current=!1,z()):e||(T.current=!0,"codex"===t?fetch("/api/oauth/codex/stop-proxy").catch(()=>{}):"xai"===t&&fetch("/api/oauth/xai/stop-proxy").catch(()=>{}))},[e,t,z]),(0,s.useEffect)(()=>{let e=p?.codexServerSide?"codex":p?.xaiServerSide?"xai":null;if(!e||!p?.state||_.current)return;let t=!1,r=0,a=async()=>{if(!t&&!_.current){r+=1;try{let r=await fetch(`/api/oauth/${e}/poll-status?state=${encodeURIComponent(p.state)}`),a=await r.json();if(t||_.current)return;if("done"===a.status){_.current=!0,x("success"),l?.();return}if("error"===a.status){_.current=!0,y(a.error||"Authentication failed"),x("error");return}}catch{}if(r>=200){_.current=!0,y("Authentication timeout"),x("error");return}setTimeout(a,1500)}};return setTimeout(a,1500),()=>{t=!0}},[p,l]),(0,s.useEffect)(()=>{let e;if(!p)return;_.current=!1;let t=async e=>{if(_.current)return;let{code:t,state:r,error:a,errorDescription:s}=e;if(a){_.current=!0,y(s||a),x("error");return}t&&(_.current=!0,await M(t,r))},r=e=>{let r=e.origin.includes("localhost")||e.origin.includes("127.0.0.1"),a=e.origin===window.location.origin;(r||a)&&e.data?.type==="oauth_callback"&&t(e.data.data)};window.addEventListener("message",r);try{(e=new BroadcastChannel("oauth_callback")).onmessage=e=>t(e.data)}catch(e){console.log("BroadcastChannel not supported")}let a=e=>{if("oauth_callback"===e.key&&e.newValue)try{let r=JSON.parse(e.newValue);t(r),localStorage.removeItem("oauth_callback")}catch(e){console.log("Failed to parse localStorage data")}};window.addEventListener("storage",a);try{let e=localStorage.getItem("oauth_callback");if(e){let r=JSON.parse(e);r.timestamp&&Date.now()-r.timestamp<3e4&&t(r),localStorage.removeItem("oauth_callback")}}catch{}return()=>{window.removeEventListener("message",r),window.removeEventListener("storage",a),e&&e.close()}},[p,M]);let q=async()=>{try{y(null);let e=b.trim();if(e.startsWith("eyJ")&&e.includes("."))return void await M(e,null);if("xai"===t&&e&&!e.includes("://")&&!e.includes("?")&&!e.includes("code="))return void await L(e);let r=new URL(e),a=r.searchParams.get("code"),s=r.searchParams.get("state"),l=r.searchParams.get("error");if(l)throw Error(r.searchParams.get("error_description")||l);if(!a)throw Error("xai"===t?"Paste the callback URL or copied xAI code":"No authorization code found in URL");await M(a,s)}catch(e){y(e.message),x("error")}},U=(0,s.useCallback)(()=>{"codex"===t?fetch("/api/oauth/codex/stop-proxy").catch(()=>{}):"xai"===t&&fetch("/api/oauth/xai/stop-proxy").catch(()=>{}),n()},[n,t]);if(!t||!r)return null;let D="xai"===t,F=N?.verification_uri_complete||N?.verification_uri||"",W=D?"Connect Grok Build OAuth":`Connect ${r.name}`;return(0,a.jsx)(i.aF,{isOpen:e,title:W,onClose:U,size:"lg",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[("waiting"===u||"input"===u)&&!v&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base text-primary animate-spin",children:"progress_activity"}),(0,a.jsx)("span",{className:"text-sm",children:D?"Waiting for Grok Build OAuth…":"Waiting for popup authorization…"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 my-1",children:[(0,a.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,a.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wider",children:"Or paste callback URL manually"}),(0,a.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{className:"text-sm font-medium mb-2",children:["Step 1: Open this ",D?"Grok Build OAuth URL":"URL"," in your browser"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.pd,{value:p?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,a.jsx)(i.$n,{variant:"secondary",icon:"auth_url"===I?"check":"content_copy",onClick:()=>$(p?.authUrl,"auth_url"),disabled:!p?.authUrl,children:"Copy"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{className:"text-sm font-medium mb-2",children:["Step 2: Paste the ","xai"===t?"callback URL or copied code":"callback URL"," here"]}),(0,a.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"xai"===t?"If xAI shows a code instead of redirecting, paste that code here.":"After authorization, copy the full URL from your browser."}),(0,a.jsx)(i.pd,{value:b,onChange:e=>f(e.target.value),placeholder:D?"http://127.0.0.1:56121/callback?code=... or copied code":A,className:"font-mono text-xs"})]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:q,fullWidth:!0,disabled:!b,children:"Connect"}),(0,a.jsx)(i.$n,{onClick:U,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"waiting"===u&&v&&N&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"text-center py-4",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Visit the login URL below and authorize:"}),(0,a.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Login URL"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("code",{className:"flex-1 text-sm break-all",children:F}),(0,a.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"login_url"===I?"check":"content_copy",onClick:()=>$(F,"login_url"),disabled:!F}),(0,a.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"open_in_new",onClick:()=>window.open(F,"_blank","noopener,noreferrer"),disabled:!F,children:"Open"})]})]}),(0,a.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Your Code"}),(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,a.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:N.user_code}),(0,a.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"user_code"===I?"check":"content_copy",onClick:()=>$(N.user_code,"user_code")})]})]})]}),k&&(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),"Waiting for authorization..."]})]}),"success"===u&&(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,a.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your ",r.name," account has been connected."]}),(0,a.jsx)(i.$n,{onClick:U,fullWidth:!0,children:"Done"})]}),"error"===u&&(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,a.jsx)("p",{className:"text-sm text-red-600 mb-4",children:g}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:z,variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,a.jsx)(i.$n,{onClick:U,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}d.propTypes={isOpen:n().bool.isRequired,provider:n().string,providerInfo:n().shape({name:n().string}),onSuccess:n().func,onClose:n().func.isRequired,oauthMeta:n().object,idcConfig:n().shape({startUrl:n().string,region:n().string})}},91450:(e,t,r)=>{r.d(t,{default:()=>i});var a=r(95155),s=r(14051),l=r.n(s),n=r(38587);function i({children:e}){return(0,a.jsxs)("div",{className:"min-h-screen flex flex-col relative bg-bg transition-colors duration-500 overflow-x-hidden selection:bg-primary/20 selection:text-primary",children:[(0,a.jsx)("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-primary/5 dark:bg-primary/5 rounded-full blur-[100px] pointer-events-none z-0"}),(0,a.jsx)("div",{className:"fixed bottom-0 right-0 w-[600px] h-[600px] bg-orange-200/20 dark:bg-orange-900/10 rounded-full blur-[120px] pointer-events-none z-0 translate-y-1/3 translate-x-1/3"}),(0,a.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,a.jsx)(n.default,{variant:"card"})}),(0,a.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:e})]})}i.propTypes={children:l().node.isRequired}},92173:(e,t,r)=>{r.d(t,{default:()=>c});var a=r(95155),s=r(98500),l=r.n(s),n=r(90620);let i=[{label:"Features",href:"#features"},{label:"Pricing",href:"#pricing"},{label:"Changelog",href:"#"}],o=[{label:"Documentation",href:"#"},{label:"API Reference",href:"#"},{label:"Help Center",href:"#"}],d=[{label:"About",href:"#"},{label:"Blog",href:"#"},{label:"Contact",href:"#"}];function c(){return(0,a.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,a.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-10 mb-12",children:[(0,a.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,a.jsx)("div",{className:"size-6 text-primary",children:(0,a.jsx)("svg",{className:"w-full h-full",fill:"currentColor",viewBox:"0 0 48 48",children:(0,a.jsx)("path",{clipRule:"evenodd",d:"M12.0799 24L4 19.2479L9.95537 8.75216L18.04 13.4961L18.0446 4H29.9554L29.96 13.4961L38.0446 8.75216L44 19.2479L35.92 24L44 28.7521L38.0446 39.2479L29.96 34.5039L29.9554 44H18.0446L18.04 34.5039L9.95537 39.2479L4 28.7521L12.0799 24Z",fillRule:"evenodd"})})}),(0,a.jsx)("span",{className:"text-xl font-bold text-text-main",children:n.vQ.name})]}),(0,a.jsx)("p",{className:"text-text-muted mb-6 max-w-sm font-light",children:"The unified interface for modern AI infrastructure. Secure, observable, and scalable."}),(0,a.jsxs)("div",{className:"flex gap-4",children:[(0,a.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"Twitter",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z"})})}),(0,a.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})})})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Product"}),(0,a.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:i.map(e=>(0,a.jsx)("li",{children:(0,a.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Resources"}),(0,a.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:o.map(e=>(0,a.jsx)("li",{children:(0,a.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Company"}),(0,a.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:d.map(e=>(0,a.jsx)("li",{children:(0,a.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]})]}),(0,a.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["\xa9 ",new Date().getFullYear()," ",n.vQ.name," Inc. All rights reserved."]}),(0,a.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[(0,a.jsx)(l(),{href:"#",className:"hover:text-primary transition-colors",children:"Privacy Policy"}),(0,a.jsx)(l(),{href:"#",className:"hover:text-primary transition-colors",children:"Terms of Service"})]})]})]})})}},92542:(e,t,r)=>{r.d(t,{default:()=>i});var a=r(95155),s=r(31474);let l={primary:"bg-brand-500 hover:bg-brand-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",secondary:"bg-surface-2 hover:bg-surface-3 text-text-main border border-border disabled:opacity-50",outline:"border border-border text-text-main hover:bg-surface-2 hover:border-brand-500/40",ghost:"text-text-muted hover:bg-surface-2 hover:text-text-main",danger:"bg-red-500 hover:bg-red-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",success:"bg-green-600 hover:bg-green-700 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted"},n={sm:"h-7 px-3 text-xs rounded-[8px]",md:"h-9 px-4 text-sm rounded-[10px]",lg:"h-11 px-6 text-sm rounded-[10px]"};function i({children:e,variant:t="primary",size:r="md",icon:o,iconRight:d,disabled:c=!1,loading:m=!1,fullWidth:u=!1,className:x,...p}){return(0,a.jsxs)("button",{className:(0,s.cn)("inline-flex items-center justify-center gap-2 font-semibold transition-all duration-150 ease-out cursor-pointer","active:scale-[0.97] disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100",l[t],n[r],u&&"w-full",x),disabled:c||m,...p,children:[m?(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}):o?(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:o}):null,e,d&&!m&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:d})]})}},92622:(e,t,r)=>{r.d(t,{default:()=>h});var a=r(95155),s=r(12115),l=r(14051),n=r.n(l),i=r(98500),o=r.n(i),d=r(73321),c=r(31474),m=r(90620);let u=[{href:"/dashboard/endpoint",label:"Endpoint",icon:"api"},{href:"/dashboard/api-keys",label:"API Keys",icon:"vpn_key"},{href:"/dashboard/providers",label:"Providers",icon:"dns"},{href:"/dashboard/combos",label:"Combos",icon:"layers"},{href:"/dashboard/usage",label:"Usage",icon:"bar_chart"},{href:"/dashboard/quota",label:"Quota Tracker",icon:"data_usage"},{href:"/dashboard/media-providers/web",label:"Media / Web",icon:"perm_media"},{href:"/dashboard/mitm",label:"AI Traffic Gateway",icon:"security"},{href:"/dashboard/prompt-logs",label:"Prompt Logs",icon:"manage_search"},{href:"/dashboard/cli-tools",label:"CLI Tools",icon:"terminal"},{href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"lan"},{href:"/dashboard/skills",label:"Skills",icon:"extension"},{href:"/dashboard/profile",label:"Settings",icon:"settings"},{href:"/dashboard/console-log",label:"Console Log",icon:"terminal"},{href:"/dashboard/translator",label:"Translator",icon:"translate"}],x=[{href:"/dashboard/api-keys",label:"API Keys",icon:"vpn_key"}];function p({href:e,label:t,icon:r,active:s,onClick:l}){return(0,a.jsxs)(o(),{href:e,onClick:l,className:(0,c.cn)("group flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-all",s?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:r}),(0,a.jsx)("span",{className:"truncate",children:t})]})}function h({onClose:e}){let t=(0,d.usePathname)(),r=(0,d.useRouter)(),[l,n]=(0,s.useState)(""),[i,o]=(0,s.useState)(""),[c,b]=(0,s.useState)(!0),[f,g]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let e=!1;return fetch("/api/auth/status",{cache:"no-store"}).then(e=>e.json()).then(t=>{e||(n(t?.displayName||t?.userId||""),o(t?.loginMethod||""),b(t?.isAdmin!==!1))}).catch(()=>{e||(n(""),o(""),b(!0))}),()=>{e=!0}},[]);let y=()=>e?.(),v=async()=>{if(!f&&confirm("Restart BlueRouter now? The dashboard will be unavailable for a few seconds.")){g(!0);try{let e=await fetch("/api/version/restart",{method:"POST"}),t=await e.json().catch(()=>({}));if(!e.ok||t?.success===!1)throw Error(t?.message||"Restart request failed");setTimeout(()=>{window.location.reload()},2500)}catch(e){alert(e?.message||"Restart request failed"),g(!1)}}},j=async()=>{try{await fetch("/api/auth/logout",{method:"POST"})}catch{}r.push("/login"),r.refresh()};return(0,a.jsxs)("div",{className:"flex h-full flex-col p-4",children:[(0,a.jsxs)("div",{className:"mb-5 rounded-2xl bg-primary/10 p-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary",children:"hub"}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"truncate text-lg font-bold text-text-main",children:"Blue Router"}),(0,a.jsxs)("div",{className:"text-xs text-text-muted",children:["v",m.vQ?.version||"local"]})]})]}),l?(0,a.jsxs)("div",{className:"mt-3 rounded-xl bg-background/70 px-3 py-2 text-xs text-text-muted",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 font-medium text-text-main",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base",children:"person"}),(0,a.jsx)("span",{className:"truncate",children:l})]}),(0,a.jsxs)("div",{className:"mt-1",children:[c?"Admin":"User",i?` \xb7 ${i}`:""]})]}):null]}),(0,a.jsx)("nav",{className:"flex-1 space-y-1 overflow-y-auto pr-1",children:(c?u:x).map(e=>{var r;return(0,a.jsx)(p,{...e,active:"/dashboard/endpoint"===(r=e.href)?"/dashboard"===t||t.startsWith("/dashboard/endpoint"):t===r||t.startsWith(`${r}/`),onClick:y},e.href)})}),(0,a.jsxs)("div",{className:"mt-4 space-y-2 border-t border-border pt-4",children:[c?(0,a.jsxs)("button",{onClick:v,disabled:f,className:"flex w-full items-center justify-center gap-2 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm font-medium text-amber-700 transition hover:bg-amber-500/20 disabled:cursor-not-allowed disabled:opacity-60 dark:text-amber-300",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"restart_alt"}),f?"Restarting...":"Restart"]}):null,(0,a.jsxs)("button",{onClick:j,className:"flex w-full items-center justify-center gap-2 rounded-xl border border-border px-3 py-2 text-sm font-medium text-text-muted transition hover:bg-surface-2 hover:text-text-main",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"logout"}),"Logout"]})]})]})}p.propTypes={href:n().string.isRequired,label:n().string.isRequired,icon:n().string.isRequired,active:n().bool,onClick:n().func},h.propTypes={onClose:n().func}},94230:(e,t,r)=>{r.d(t,{default:()=>d});var a=r(95155),s=r(12115),l=r(14051),n=r.n(l),i=r(35497),o=r(11059);function d({isOpen:e,provider:t,onSuccess:r,onClose:l}){let[n,c]=(0,s.useState)("loading"),[m,u]=(0,s.useState)(""),[x,p]=(0,s.useState)(null),[h,b]=(0,s.useState)(""),[f,g]=(0,s.useState)(null),{copied:y,copy:v}=(0,o.C)();(0,s.useEffect)(()=>{e&&t&&(async()=>{try{g(null),c("loading");let e=await fetch(`/api/oauth/kiro/social-authorize?provider=${t}`),r=await e.json();if(!e.ok)throw Error(r.error);p(r),u(r.authUrl),c("input"),window.open(r.authUrl,"_blank")}catch(e){g(e.message),c("error")}})()},[e,t]);let j=async()=>{try{let e;g(null);try{e=new URL(h)}catch(e){throw Error("Invalid callback URL format")}let a=e.searchParams.get("code");e.searchParams.get("state");let s=e.searchParams.get("error");if(s)throw Error(e.searchParams.get("error_description")||s);if(!a)throw Error("No authorization code found in URL");let l=await fetch("/api/oauth/kiro/social-exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,codeVerifier:x.codeVerifier,provider:t})}),n=await l.json();if(!l.ok)throw Error(n.error);c("success"),r?.()}catch(e){g(e.message),c("error")}},N="google"===t?"Google":"GitHub";return(0,a.jsx)(i.aF,{isOpen:e,title:`Connect Kiro via ${N}`,onClose:l,size:"lg",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:["loading"===n&&(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Initializing..."}),(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Setting up ",N," authentication"]})]}),"input"===n&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.pd,{value:m,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,a.jsx)(i.$n,{variant:"secondary",icon:"auth_url"===y?"check":"content_copy",onClick:()=>v(m,"auth_url"),children:"Copy"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,a.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser address bar."}),(0,a.jsx)(i.pd,{value:h,onChange:e=>b(e.target.value),placeholder:"kiro://kiro.kiroAgent/authenticate-success?code=...",className:"font-mono text-xs"})]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:j,fullWidth:!0,disabled:!h,children:"Connect"}),(0,a.jsx)(i.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===n&&(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,a.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your Kiro account via ",N," has been connected."]}),(0,a.jsx)(i.$n,{onClick:l,fullWidth:!0,children:"Done"})]}),"error"===n&&(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,a.jsx)("p",{className:"text-sm text-red-600 mb-4",children:f}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:()=>c("input"),variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,a.jsx)(i.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}d.propTypes={isOpen:n().bool.isRequired,provider:n().oneOf(["google","github"]).isRequired,onSuccess:n().func,onClose:n().func.isRequired}},95088:(e,t,r)=>{r.d(t,{default:()=>d});var a=r(95155),s=r(12115),l=r(14051),n=r.n(l),i=r(35497);let o="https://gitlab.com";function d({isOpen:e,providerInfo:t,onSuccess:r,onClose:l}){let n,[c,m]=(0,s.useState)(null),[u,x]=(0,s.useState)(o),[p,h]=(0,s.useState)(""),[b,f]=(0,s.useState)(""),[g,y]=(0,s.useState)(""),[v,j]=(0,s.useState)(!1),[N,w]=(0,s.useState)(null),[k,C]=(0,s.useState)(!1),[S,T]=(0,s.useState)(null),I=()=>{m(null),x(o),h(""),f(""),y(""),w(null),j(!1),C(!1),T(null),l()},$=async()=>{if(!g.trim())return void w("Personal Access Token is required");j(!0),w(null);try{let e=await fetch("/api/oauth/gitlab/pat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:g.trim(),baseUrl:u.trim()||o})}),t=await e.json();if(!e.ok)throw Error(t.error||"Authentication failed");r?.(),I()}catch(e){w(e.message)}finally{j(!1)}};return e?k&&S?(0,a.jsx)(i.LF,{isOpen:!0,provider:"gitlab",providerInfo:t,oauthMeta:S,onSuccess:()=>{r?.(),I()},onClose:()=>{C(!1),T(null)}}):(0,a.jsx)(i.aF,{isOpen:e,title:"Connect GitLab Duo",onClose:I,size:"lg",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[!c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Choose how to authenticate with GitLab Duo:"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,a.jsxs)("button",{onClick:()=>m("oauth"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary",children:"lock_open"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"OAuth App"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab OAuth application"})]})]}),(0,a.jsxs)("button",{onClick:()=>m("pat"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary",children:"key"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Personal Access Token"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab PAT with api scope"})]})]})]})]}),"oauth"===c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Create an OAuth app at"," ",(0,a.jsx)("a",{href:`${u.trim()||o}/-/profile/applications`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Applications"})," ","with redirect URI"," ",(0,a.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:(n=window.location.port||("https:"===window.location.protocol?"443":"80"),`http://localhost:${n}/callback`)})]}),(0,a.jsx)(i.pd,{label:"GitLab Base URL",value:u,onChange:e=>x(e.target.value),placeholder:o}),(0,a.jsx)(i.pd,{label:"Client ID",value:p,onChange:e=>h(e.target.value),placeholder:"Your OAuth application client ID"}),(0,a.jsx)(i.pd,{label:"Client Secret (optional for PKCE)",value:b,onChange:e=>f(e.target.value),placeholder:"Leave empty for public PKCE app"}),N&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:N}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:()=>{p.trim()?(w(null),T({baseUrl:u.trim()||o,clientId:p.trim(),clientSecret:b.trim()}),C(!0)):w("Client ID is required")},fullWidth:!0,disabled:!p.trim(),children:"Authorize"}),(0,a.jsx)(i.$n,{onClick:()=>{m(null),w(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"pat"===c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Create a PAT at"," ",(0,a.jsx)("a",{href:`${u.trim()||o}/-/user_settings/personal_access_tokens`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Access Tokens"})," ","with scopes: ",(0,a.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"api"}),","," ",(0,a.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"read_user"}),", and"," ",(0,a.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"ai_features"}),"."]}),(0,a.jsx)(i.pd,{label:"GitLab Base URL",value:u,onChange:e=>x(e.target.value),placeholder:o}),(0,a.jsx)(i.pd,{label:"Personal Access Token",value:g,onChange:e=>y(e.target.value),placeholder:"glpat-xxxxxxxxxxxxxxxxxxxx",type:"password"}),N&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:N}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:$,fullWidth:!0,disabled:!g.trim()||v,loading:v,children:"Connect"}),(0,a.jsx)(i.$n,{onClick:()=>{m(null),w(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})}):null}d.propTypes={isOpen:n().bool.isRequired,providerInfo:n().shape({name:n().string}),onSuccess:n().func,onClose:n().func.isRequired}},96748:(e,t,r)=>{r.d(t,{default:()=>d});var a=r(95155),s=r(12115),l=r(14051),n=r.n(l),i=r(35497);let o="https://api.openai.com/v1";function d({isOpen:e,onClose:t,onCreated:r,onSaved:l,node:n}){let c=!!n,[m,u]=(0,s.useState)({name:"",prefix:"",baseUrl:o}),[x,p]=(0,s.useState)(!1),[h,b]=(0,s.useState)(""),[f,g]=(0,s.useState)(""),[y,v]=(0,s.useState)(!1),[j,N]=(0,s.useState)(null);(0,s.useEffect)(()=>{e&&(N(null),b(""),g(""),c?u({name:n.name||"",prefix:n.prefix||"",baseUrl:n.baseUrl||o}):u({name:"",prefix:"",baseUrl:o}))},[e,c,n]);let w=async()=>{if(m.name.trim()&&m.prefix.trim()&&m.baseUrl.trim()){p(!0);try{let e=c?`/api/provider-nodes/${n.id}`:"/api/provider-nodes",t=c?"PUT":"POST",a={name:m.name,prefix:m.prefix,baseUrl:m.baseUrl};c||(a.type="custom-embedding");let s=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),i=await s.json();s.ok&&(c?l?.(i.node):r?.(i.node))}catch(e){console.log("Error saving custom embedding node:",e)}finally{p(!1)}}},k=async()=>{v(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:m.baseUrl,apiKey:h,type:"custom-embedding",modelId:f.trim()||void 0})}),t=await e.json();N(t)}catch{N({valid:!1,error:"Network error"})}finally{v(!1)}};return(0,a.jsx)(i.aF,{isOpen:e,title:c?"Edit Custom Embedding":"Add Custom Embedding",onClose:t,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(i.pd,{label:"Name",value:m.name,onChange:e=>u({...m,name:e.target.value}),placeholder:"Voyage AI",hint:"Required. A friendly label for this embedding provider."}),(0,a.jsx)(i.pd,{label:"Prefix",value:m.prefix,onChange:e=>u({...m,prefix:e.target.value}),placeholder:"voyage",hint:"Required. Used as the provider prefix for model IDs (e.g. voyage/voyage-3)."}),(0,a.jsx)(i.pd,{label:"Base URL",value:m.baseUrl,onChange:e=>u({...m,baseUrl:e.target.value}),placeholder:"https://api.voyageai.com/v1",hint:"Most embedding APIs are OpenAI-compatible: Voyage, Cohere, Jina, Mistral, Together..."}),(0,a.jsx)(i.pd,{label:"API Key (for Check)",type:"password",value:h,onChange:e=>b(e.target.value)}),(0,a.jsx)(i.pd,{label:"Model ID (for Check)",value:f,onChange:e=>g(e.target.value),placeholder:"e.g. voyage-3, embed-english-v3.0, text-embedding-3-small",hint:"Required for validation. Will send a test embeddings request."}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(i.$n,{onClick:k,disabled:!h||!f.trim()||y||!m.baseUrl.trim(),variant:"secondary",children:y?"Checking...":"Check"}),(()=>{if(!j)return null;let{valid:e,error:t,dimensions:r}=j;return e?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.Ex,{variant:"success",children:"Valid"}),r&&(0,a.jsxs)("span",{className:"text-sm text-text-muted",children:[r," dims"]})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)(i.Ex,{variant:"error",children:"Invalid"}),t&&(0,a.jsx)("span",{className:"text-sm text-red-500",children:t})]})})()]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:w,fullWidth:!0,disabled:!m.name.trim()||!m.prefix.trim()||!m.baseUrl.trim()||x,children:x?c?"Saving...":"Creating...":c?"Save":"Create"}),(0,a.jsx)(i.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}d.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onCreated:n().func,onSaved:n().func,node:n().shape({id:n().string,name:n().string,prefix:n().string,baseUrl:n().string})}},97677:(e,t,r)=>{r.d(t,{default:()=>s});var a=r(95155);function s({text:e,children:t,position:r="top",color:l}){let n=l?"":"bg-gray-900";return(0,a.jsxs)("div",{className:"relative inline-flex group",children:[t,(0,a.jsx)("div",{className:`pointer-events-none absolute ${{top:"bottom-full left-1/2 -translate-x-1/2 mb-1.5",bottom:"top-full left-1/2 -translate-x-1/2 mt-1.5",left:"right-full top-1/2 -translate-y-1/2 mr-1.5",right:"left-full top-1/2 -translate-y-1/2 ml-1.5"}[r]} z-50 w-max max-w-56 rounded px-2 py-1 text-[11px] leading-snug ${n} text-white opacity-0 group-hover:opacity-100 transition-opacity duration-150 whitespace-normal`,style:l?{backgroundColor:l}:{},children:e})]})}},98542:(e,t,r)=>{r.d(t,{default:()=>l});var a=r(95155),s=r(31474);function l({checked:e=!1,onChange:t,label:r,description:n,disabled:i=!1,size:o="md",className:d}){let c={sm:{track:"w-8 h-4",thumb:"size-3",translate:"translate-x-4"},md:{track:"w-11 h-6",thumb:"size-5",translate:"translate-x-5"},lg:{track:"w-14 h-7",thumb:"size-6",translate:"translate-x-7"}};return(0,a.jsxs)("div",{className:(0,s.cn)("flex items-center gap-3",i&&"opacity-50 cursor-not-allowed",d),children:[(0,a.jsx)("button",{type:"button",role:"switch","aria-checked":e,disabled:i,onClick:()=>{!i&&t&&t(!e)},className:(0,s.cn)("relative inline-flex shrink-0 cursor-pointer rounded-full","transition-colors duration-200 ease-in-out","focus:outline-none focus:ring-2 focus:ring-brand-500/30",e?"bg-brand-500":"bg-surface-3",c[o].track,i&&"cursor-not-allowed"),children:(0,a.jsx)("span",{className:(0,s.cn)("pointer-events-none inline-block rounded-full bg-white shadow-sm","transform transition duration-200 ease-in-out",e?c[o].translate:"translate-x-0.5",c[o].thumb,"mt-0.5")})}),(r||n)&&(0,a.jsxs)("div",{className:"flex flex-col",children:[r&&(0,a.jsx)("span",{className:"text-sm font-medium text-text-main",children:r}),n&&(0,a.jsx)("span",{className:"text-xs text-text-muted",children:n})]})]})}}}]);