9router 0.4.50 → 0.4.55

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 (400) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +3 -3
  3. package/app/.next-cli-build/build-manifest.json +2 -2
  4. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  5. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +6 -6
  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/providers/[id]/page.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  32. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  33. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  34. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  35. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  36. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  37. package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  38. package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  39. package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  40. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  41. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  42. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  43. package/app/.next-cli-build/server/app/_not-found.rsc +4 -4
  44. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +4 -4
  45. package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  46. package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +4 -4
  47. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  48. package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  49. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  50. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  51. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  52. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  53. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  54. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  55. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  56. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +2 -2
  57. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  58. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  59. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  60. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  61. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  62. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  63. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +1 -1
  64. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  65. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  66. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  67. package/app/.next-cli-build/server/app/api/keys/route.js +1 -1
  68. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  69. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  70. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  71. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  72. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  73. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  74. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  75. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  76. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  77. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  78. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  79. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  80. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  81. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  82. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  83. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  84. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
  85. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  86. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  87. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  88. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  89. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  90. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  91. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  92. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  93. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  94. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  95. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  96. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  97. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  98. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  99. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  100. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  101. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  102. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  103. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  104. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  106. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  107. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  108. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  110. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  112. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  113. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +2 -2
  114. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  116. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  117. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  118. package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  119. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  120. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  121. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  122. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  123. package/app/.next-cli-build/server/app/api/tunnel/tailscale-login/route.js.nft.json +1 -1
  124. package/app/.next-cli-build/server/app/api/tunnel/tailscale-start-daemon/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  126. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  127. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  130. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  131. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  133. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  134. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  136. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  137. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  138. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  139. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  140. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  141. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  142. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  143. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  144. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  145. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  146. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  147. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  148. package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
  149. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  151. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  152. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  153. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  154. package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  155. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  157. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  158. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  159. package/app/.next-cli-build/server/app/callback.html +1 -1
  160. package/app/.next-cli-build/server/app/callback.rsc +4 -4
  161. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +4 -4
  162. package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  163. package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +4 -4
  164. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  165. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  166. package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  167. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  168. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +6 -6
  169. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  170. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  171. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  172. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  173. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +6 -6
  174. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  175. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +4 -4
  176. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
  177. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  178. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +6 -6
  179. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  180. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  181. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  182. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  183. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
  184. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  185. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
  186. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  187. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  188. package/app/.next-cli-build/server/app/dashboard/combos.rsc +6 -6
  189. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  190. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  191. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  192. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  193. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
  194. package/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  195. package/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
  196. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  197. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  198. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +6 -6
  199. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  200. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  201. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  202. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  203. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -6
  204. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  205. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
  206. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  207. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  208. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +6 -6
  209. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  210. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
  211. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
  212. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  213. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  214. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +6 -6
  215. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
  216. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +4 -4
  217. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
  218. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  219. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +6 -6
  220. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  221. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  222. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  223. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  224. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
  225. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  226. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
  227. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  228. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  229. package/app/.next-cli-build/server/app/dashboard/profile.rsc +6 -6
  230. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  231. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  232. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  233. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  234. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +6 -6
  235. package/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  236. package/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
  237. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  238. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  239. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +6 -6
  240. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  241. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  242. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  243. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  244. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  245. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
  246. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  247. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
  248. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  249. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  250. package/app/.next-cli-build/server/app/dashboard/providers.rsc +6 -6
  251. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  252. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  253. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  254. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  255. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
  256. package/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  257. package/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
  258. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  259. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  260. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +6 -6
  261. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  262. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  263. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  264. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  265. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
  266. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  267. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
  268. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  269. package/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
  270. package/app/.next-cli-build/server/app/dashboard/quota.rsc +7 -7
  271. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  272. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  273. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  274. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  275. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
  276. package/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  277. package/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
  278. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  279. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  280. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  281. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
  282. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
  283. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  284. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
  285. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  286. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  287. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  288. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  289. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  290. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  291. package/app/.next-cli-build/server/app/dashboard/skills.rsc +6 -6
  292. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
  293. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
  294. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  295. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  296. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +6 -6
  297. package/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
  298. package/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +4 -4
  299. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
  300. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  301. package/app/.next-cli-build/server/app/dashboard/translator.rsc +6 -6
  302. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  303. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  304. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  305. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  306. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
  307. package/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  308. package/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
  309. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  310. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  311. package/app/.next-cli-build/server/app/dashboard/usage.rsc +6 -6
  312. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  313. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  314. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  315. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  316. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
  317. package/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  318. package/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
  319. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  320. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  321. package/app/.next-cli-build/server/app/dashboard.rsc +6 -6
  322. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  323. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  324. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  325. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +6 -6
  326. package/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
  327. package/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +4 -4
  328. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  329. package/app/.next-cli-build/server/app/index.html +1 -1
  330. package/app/.next-cli-build/server/app/index.rsc +4 -4
  331. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  332. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +4 -4
  333. package/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
  334. package/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +4 -4
  335. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  336. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  337. package/app/.next-cli-build/server/app/landing.html +1 -1
  338. package/app/.next-cli-build/server/app/landing.rsc +4 -4
  339. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +4 -4
  340. package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  341. package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +4 -4
  342. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
  343. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  344. package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  345. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  346. package/app/.next-cli-build/server/app/login.html +1 -1
  347. package/app/.next-cli-build/server/app/login.rsc +5 -5
  348. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +5 -5
  349. package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  350. package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +4 -4
  351. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
  352. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  353. package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  354. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  355. package/app/.next-cli-build/server/app-paths-manifest.json +3 -3
  356. package/app/.next-cli-build/server/chunks/1229.js +2 -1
  357. package/app/.next-cli-build/server/chunks/1795.js +1 -1
  358. package/app/.next-cli-build/server/chunks/21.js +1 -1
  359. package/app/.next-cli-build/server/chunks/4185.js +1 -1
  360. package/app/.next-cli-build/server/chunks/450.js +1 -1
  361. package/app/.next-cli-build/server/chunks/514.js +3 -3
  362. package/app/.next-cli-build/server/chunks/5339.js +1 -1
  363. package/app/.next-cli-build/server/chunks/5445.js +1 -1
  364. package/app/.next-cli-build/server/chunks/5662.js +1 -1
  365. package/app/.next-cli-build/server/chunks/6263.js +3 -2
  366. package/app/.next-cli-build/server/chunks/6283.js +1 -1
  367. package/app/.next-cli-build/server/chunks/6379.js +2 -2
  368. package/app/.next-cli-build/server/chunks/6634.js +1 -1
  369. package/app/.next-cli-build/server/chunks/7171.js +1 -1
  370. package/app/.next-cli-build/server/chunks/8012.js +2 -2
  371. package/app/.next-cli-build/server/chunks/8202.js +4 -4
  372. package/app/.next-cli-build/server/chunks/8647.js +1 -1
  373. package/app/.next-cli-build/server/chunks/9060.js +1 -1
  374. package/app/.next-cli-build/server/chunks/9737.js +1 -1
  375. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  376. package/app/.next-cli-build/server/middleware.js +1 -1
  377. package/app/.next-cli-build/server/pages/404.html +1 -1
  378. package/app/.next-cli-build/server/pages/500.html +1 -1
  379. package/app/.next-cli-build/static/chunks/{3771-58963fe5c3d9e450.js → 3771-c6aa0933e598758e.js} +1 -1
  380. package/app/.next-cli-build/static/chunks/{4156-464d430895a9e111.js → 4156-999be510811b9306.js} +2 -2
  381. package/app/.next-cli-build/static/chunks/505-8f9b28080a3c254f.js +1 -0
  382. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-c8ed0db5955a05a5.js → page-88a892fe85ec49f1.js} +6 -6
  383. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-31b181d9feed8743.js +3 -0
  384. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-6cc2d457a7fca89c.js +1 -0
  385. package/app/.next-cli-build/static/css/{cf00d5ad75771e52.css → 90c07fe979303c56.css} +1 -1
  386. package/app/cli/.build-home/.9router/db/backups/{upgrade-0.4.44-to-0.4.45-0.4.45-20260515-124856 → upgrade-0.4.50-to-0.4.52-0.4.52-20260517-162943}/data.sqlite +0 -0
  387. package/app/cli/.build-home/.9router/db/backups/{upgrade-0.4.43-to-0.4.44-0.4.44-20260515-120531 → upgrade-0.4.52-to-0.4.55-0.4.55-20260518-162644}/data.sqlite +0 -0
  388. package/app/cli/.build-home/.9router/db/data.sqlite +0 -0
  389. package/app/cli/.build-home/.9router/machine-id +1 -0
  390. package/app/package.json +1 -1
  391. package/app/src/lib/db/migrate.js +56 -18
  392. package/app/src/mitm/server.js +28 -28
  393. package/cli.js +12 -12
  394. package/package.json +1 -1
  395. package/src/cli/api/client.js +25 -6
  396. package/app/.next-cli-build/static/chunks/505-46eb141bcb8efa6b.js +0 -1
  397. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-7f9c8937e17f949b.js +0 -3
  398. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-768dfa550531b27a.js +0 -1
  399. /package/app/.next-cli-build/static/{4hJhKmQNjYDMpsel-dmHu → xF65sBZWGFktafhNyRqms}/_buildManifest.js +0 -0
  400. /package/app/.next-cli-build/static/{4hJhKmQNjYDMpsel-dmHu → xF65sBZWGFktafhNyRqms}/_ssgManifest.js +0 -0
@@ -0,0 +1,3 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{7207:(e,t,s)=>{Promise.resolve().then(s.bind(s,60717))},60717:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>S});var a=s(73365),i=s(1521),l=s(29717),r=s(99568),o=s.n(r),n=s(58872),d=s(74156),c=s(82495),p=s(69633),m=s(96459);let x=new Map;async function u(e){if(!e?.url||!e?.type)return[];let t=x.get(e.url);if(t&&Date.now()<t.expiresAt)return t.data;try{let t=new URLSearchParams({url:e.url,type:e.type}),s=await fetch(`/api/providers/suggested-models?${t}`);if(!s.ok)return[];let a=(await s.json()).data??[];return x.set(e.url,{data:a,expiresAt:Date.now()+6e5}),a}catch{return[]}}var h=s(86447),f=s.n(h);function g({model:e,fullModel:t,alias:s,copied:i,onCopy:l,testStatus:r,isCustom:o,isFree:n,onDeleteAlias:d,onTest:c,isTesting:p,onDisable:m}){let x="ok"===r?"#22c55e":"error"===r?"#ef4444":void 0;return(0,a.jsx)("div",{className:`group min-w-0 max-w-full rounded-lg border px-3 py-2 ${"ok"===r?"border-green-500/40":"error"===r?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,a.jsxs)("div",{className:"flex min-w-0 items-start gap-2 sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base",style:x?{color:x}:void 0,children:"ok"===r?"check_circle":"error"===r?"cancel":"smart_toy"}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,a.jsx)("code",{className:"max-w-[72vw] truncate rounded bg-sidebar px-1.5 py-0.5 font-mono text-xs text-text-muted sm:max-w-[360px]",children:t}),e.name&&(0,a.jsx)("span",{className:"truncate pl-1 text-[9px] italic text-text-muted/70",children:e.name})]}),c&&(0,a.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,a.jsx)("button",{onClick:c,disabled:p,className:`rounded p-0.5 text-text-muted transition-opacity hover:bg-sidebar hover:text-primary ${p?"opacity-100":"opacity-100 sm:opacity-0 sm:group-hover:opacity-100"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:p?{animation:"spin 1s linear infinite"}:void 0,children:p?"progress_activity":"science"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:p?"Testing...":"Test"})]}),(0,a.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,a.jsx)("button",{onClick:()=>l(t,`model-${e.id}`),className:"rounded p-0.5 text-text-muted hover:bg-sidebar hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:i===`model-${e.id}`?"check":"content_copy"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:i===`model-${e.id}`?"Copied!":"Copy"})]}),o?(0,a.jsx)("button",{onClick:d,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Remove custom model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):m?(0,a.jsx)("button",{onClick:m,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Disable this model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):null]})})}function y({modelId:e,fullModel:t,copied:s,onCopy:i,onDeleteAlias:l,onTest:r,testStatus:o,isTesting:n}){let d="ok"===o?"#22c55e":"error"===o?"#ef4444":void 0;return(0,a.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===o?"border-green-500/40":"error"===o?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",style:d?{color:d}:void 0,children:"ok"===o?"check_circle":"error"===o?"cancel":"smart_toy"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,a.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,a.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:()=>i(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:s===`model-${e}`?"check":"content_copy"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:s===`model-${e}`?"Copied!":"Copy"})]}),r&&(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:r,disabled:n,className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:n?{animation:"spin 1s linear infinite"}:void 0,children:n?"progress_activity":"science"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:n?"Testing...":"Test"})]})]})]}),(0,a.jsx)("button",{onClick:l,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function b({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:s,copied:l,onCopy:r,onSetAlias:o,onDeleteAlias:n,connections:c,isAnthropic:p}){let[m,x]=(0,i.useState)(""),[u,h]=(0,i.useState)(!1),[f,g]=(0,i.useState)(!1),[v,j]=(0,i.useState)(null),[N,w]=(0,i.useState)({}),k=async t=>{if(!v){j(t);try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${e}/${t}`})}),a=await s.json();w(e=>({...e,[t]:a.ok?"ok":"error"}))}catch{w(e=>({...e,[t]:"error"}))}finally{j(null)}}},C=Object.entries(s).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,s])=>({modelId:s.replace(`${e}/`,""),fullModel:s,alias:t})),S=a=>{let i,l=`${e}/${a}`;if(Object.values(s).includes(l))return null;let r=(i=a.split("/"))[i.length-1];if(!s[r])return r;let o=`${t}-${r}`;return s[o]?null:o},A=async()=>{if(!m.trim()||u)return;let t=m.trim(),s=S(t);if(!s)return void alert("All suggested aliases already exist. Please choose a different model or remove conflicting aliases.");h(!0);try{await o(t,s,e),x("")}catch(e){console.log("Error adding model:",e)}finally{h(!1)}},$=async()=>{if(f)return;let t=c.find(e=>!1!==e.isActive);if(t){g(!0);try{let s=await fetch(`/api/providers/${t.id}/models`),a=await s.json();if(!s.ok)return void alert(a.error||"Failed to import models");let i=a.models||[];if(0===i.length)return void alert("No models returned from /models.");let l=0;for(let t of i){let s=t.id||t.name||t.model;if(!s)continue;let a=S(s);a&&(await o(s,a,e),l+=1)}0===l&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{g(!1)}}},T=c.some(e=>!1!==e.isActive);return(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",p?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,a.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,a.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,a.jsx)("input",{id:"new-compatible-model-input",type:"text",value:m,onChange:e=>x(e.target.value),onKeyDown:e=>"Enter"===e.key&&A(),placeholder:p?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:A,disabled:!m.trim()||u,children:u?"Adding...":"Add"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"download",onClick:$,disabled:!T||f,children:f?"Importing...":"Import from /models"})]}),!T&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),C.length>0&&(0,a.jsx)("div",{className:"flex flex-col gap-3",children:C.map(({modelId:e,fullModel:s,alias:i})=>(0,a.jsx)(y,{modelId:e,fullModel:`${t}/${e}`,copied:l,onCopy:r,onDeleteAlias:()=>n(i),onTest:c.length>0?()=>k(e):void 0,testStatus:N[e],isTesting:v===e},s))})]})}function v({until:e}){let[t,s]=(0,i.useState)("");return((0,i.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void s("");let a=Math.floor(t/1e3);if(a<60)s(`${a}s`);else if(a<3600)s(`${Math.floor(a/60)}m ${a%60}s`);else{let e=Math.floor(a/3600),t=Math.floor(a%3600/60);s(`${e}h ${t}m`)}};t();let a=setInterval(t,1e3);return()=>clearInterval(a)},[e]),t)?(0,a.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function j({connection:e,proxyPools:t,isOAuth:s,isFirst:l,isLast:r,onMoveUp:o,onMoveDown:n,onToggleActive:c,onUpdateProxy:p,onEdit:m,onDelete:x}){let[u,h]=(0,i.useState)(!1),[f,g]=(0,i.useState)(!1),y=(0,i.useRef)(null),b=new Map((t||[]).map(e=>[e.id,e])),N=e.providerSpecificData?.proxyPoolId||null,w=N?b.get(N):null,k=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,C=!!N||k,S=w?`Pool: ${w.name}`:N?`Pool: ${N} (inactive/missing)`:k?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",A="";if(w?.proxyUrl||e.providerSpecificData?.connectionProxyUrl){let t=w?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);A=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{A=t}}let $=w?.noProxy||e.providerSpecificData?.connectionNoProxy||"",T="default";w?.isActive===!0?T="success":(N||k)&&(T="error"),(0,i.useEffect)(()=>{if(!u)return;let e=e=>{y.current&&!y.current.contains(e.target)&&h(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[u]);let P=async e=>{g(!0);try{await p("__none__"===e?null:e)}finally{g(!1),h(!1)}},O=e=>"string"==typeof e&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e),I=s?O(e.email)?e.email:O(e.name)?e.name:e.name||e.email||e.displayName||"OAuth Account":e.name,[E,R]=(0,i.useState)(!1),D=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>!!e).sort()[0]||null;(0,i.useEffect)(()=>{let t=()=>{R(!!Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>e&&new Date(e).getTime()>Date.now()).sort()[0])};t();let s=D?setInterval(t,1e3):null;return()=>{s&&clearInterval(s)}},[D]);let U="unavailable"!==e.testStatus||E?e.testStatus:"active";return(0,a.jsxs)("div",{className:`group flex min-w-0 flex-col gap-3 rounded-lg p-2 transition-colors hover:bg-black/[0.02] dark:hover:bg-white/[0.02] sm:flex-row sm:items-center sm:justify-between ${!1===e.isActive?"opacity-60":""}`,children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2 sm:items-center sm:gap-3",children:[(0,a.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,a.jsx)("button",{onClick:o,disabled:l,className:`p-0.5 rounded ${l?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,a.jsx)("button",{onClick:n,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,a.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base text-text-muted",children:s?"lock":"key"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:I}),(0,a.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 sm:gap-2",children:[(0,a.jsx)(d.Ex,{variant:!1===e.isActive?"default":"active"===U||"success"===U?"success":"error"===U||"expired"===U||"unavailable"===U?"error":"default",size:"sm",dot:!0,children:!1===e.isActive?"disabled":U||"Unknown"}),C&&(0,a.jsx)(d.Ex,{variant:T,size:"sm",children:"Proxy"}),E&&!1!==e.isActive&&(0,a.jsx)(v,{until:D}),e.lastError&&!1!==e.isActive&&(0,a.jsx)("span",{className:"max-w-full truncate text-xs text-red-500 sm:max-w-[300px]",title:e.lastError,children:e.lastError}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]})]}),C&&(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:S,children:S}),A&&(0,a.jsx)("code",{className:"max-w-full truncate rounded bg-black/5 px-1 py-0.5 font-mono text-[10px] text-text-muted dark:bg-white/5 sm:max-w-[260px]",children:A}),$&&(0,a.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:$,children:["no_proxy: ",$]})]})]})]}),(0,a.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,a.jsxs)("div",{className:"grid flex-1 grid-cols-3 gap-1 sm:flex sm:flex-none",children:[(t||[]).length>0&&(0,a.jsxs)("div",{className:"relative",ref:y,children:[(0,a.jsxs)("button",{onClick:()=>h(e=>!e),className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${C?"text-primary":"text-text-muted hover:text-primary"}`,disabled:f,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:f?"progress_activity":"lan"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),u&&(0,a.jsxs)("div",{className:"absolute right-0 top-full z-50 mt-1 max-w-[78vw] min-w-[160px] rounded-lg border border-border bg-bg py-1 shadow-lg",children:[(0,a.jsx)("button",{onClick:()=>P("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!N?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,a.jsx)("button",{onClick:()=>P(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${N===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),(0,a.jsxs)("button",{onClick:m,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,a.jsxs)("button",{onClick:x,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 hover:bg-red-500/10",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,a.jsx)(d.lM,{size:"sm",checked:e.isActive??!0,onChange:c,title:e.isActive??!0?"Disable connection":"Enable connection"})]})]})}g.propTypes={model:f().shape({id:f().string.isRequired}).isRequired,fullModel:f().string.isRequired,alias:f().string,copied:f().string,onCopy:f().func.isRequired,testStatus:f().oneOf(["ok","error"]),isCustom:f().bool,isFree:f().bool,onDeleteAlias:f().func,onTest:f().func,isTesting:f().bool,onDisable:f().func},f().string.isRequired,f().string.isRequired,f().string,f().func.isRequired,f().func.isRequired,f().func,f().oneOf(["ok","error"]),f().bool,f().string.isRequired,f().object.isRequired,f().string,f().func.isRequired,f().func.isRequired,f().func.isRequired,b.propTypes={providerStorageAlias:f().string.isRequired,providerDisplayAlias:f().string.isRequired,modelAliases:f().object.isRequired,copied:f().string,onCopy:f().func.isRequired,onSetAlias:f().func.isRequired,onDeleteAlias:f().func.isRequired,connections:f().arrayOf(f().shape({id:f().string,isActive:f().bool})).isRequired,isAnthropic:f().bool},v.propTypes={until:f().string.isRequired},j.propTypes={connection:f().shape({id:f().string,name:f().string,email:f().string,displayName:f().string,modelLockUntil:f().string,testStatus:f().string,isActive:f().bool,lastError:f().string,priority:f().number,globalPriority:f().number}).isRequired,proxyPools:f().arrayOf(f().shape({id:f().string,name:f().string,proxyUrl:f().string,noProxy:f().string,isActive:f().bool})),isOAuth:f().bool.isRequired,isFirst:f().bool.isRequired,isLast:f().bool.isRequired,onMoveUp:f().func.isRequired,onMoveDown:f().func.isRequired,onToggleActive:f().func.isRequired,onUpdateProxy:f().func,onEdit:f().func.isRequired,onDelete:f().func.isRequired};let N=`name1|sk-key1
2
+ name2|sk-key2
3
+ sk-key-only-auto-named`;function w({isOpen:e,provider:t,providerName:s,isCompatible:l,isAnthropic:r,authType:o,authHint:n,website:p,proxyPools:m,error:x,onSave:u,onBulkDone:h,onClose:f}){let g="__none__",y="ollama-local"===t,b="cookie"===o,v=b?"Cookie Value":"API Key",j="azure"===t,k="cloudflare-ai"===t,C=c.Q2?.[t]?.regions||null,S=c.Q2?.[t]?.defaultRegion||C?.[0]?.id||"",[A,$]=(0,i.useState)({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:g,ollamaHostUrl:""}),[T,P]=(0,i.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[O,I]=(0,i.useState)({accountId:""}),[E,R]=(0,i.useState)(S),[D,U]=(0,i.useState)(!1),[_,q]=(0,i.useState)(null),[z,M]=(0,i.useState)(!1),[K,L]=(0,i.useState)("single"),[F,J]=(0,i.useState)(""),[W,H]=(0,i.useState)(null),V=()=>y&&A.ollamaHostUrl.trim()?{baseUrl:A.ollamaHostUrl.trim()}:j?{azureEndpoint:T.azureEndpoint,apiVersion:T.apiVersion,deployment:T.deployment,organization:T.organization}:k?{accountId:O.accountId}:C&&E?{region:E}:void 0,B=async()=>{U(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:A.apiKey,providerSpecificData:V()})}),s=await e.json();q(s.valid?"success":"failed")}catch{q("failed")}finally{U(!1)}},G=async()=>{if(t&&(y||A.apiKey)&&(y||A.name)&&(!l||A.defaultModel.trim())){M(!0);try{let e=!1;try{U(!0),q(null);let s=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:A.apiKey,providerSpecificData:V()})});e=!!(await s.json()).valid,q(e?"success":"failed")}catch{q("failed")}finally{U(!1)}await u({name:A.name||(y?"Ollama Local":""),apiKey:A.apiKey,defaultModel:l?A.defaultModel.trim():void 0,priority:A.priority,proxyPoolId:A.proxyPoolId===g?null:A.proxyPoolId,testStatus:e?"active":"unknown",providerSpecificData:V()})}finally{M(!1)}}},Q=async()=>{let e=F.split("\n").map(e=>e.trim()).filter(Boolean);if(!e.length)return;M(!0),H(null);let s=0,a=0;for(let i=0;i<e.length;i++){let l=e[i].split("|"),r=l.length>=2?l.slice(1).join("|").trim():l[0].trim(),o=l.length>=2?l[0].trim():"Key",n=`${o} ${i+1}`;try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:r,name:n,priority:1,testStatus:"unknown"})})).ok?s++:a++}catch{a++}}M(!1),H({success:s,failed:a}),s>0&&h&&h()};return t?(0,a.jsx)(d.aF,{isOpen:e,title:`Add ${s||t} ${v}`,onClose:f,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",variant:"single"===K?"primary":"ghost",onClick:()=>{L("single"),H(null)},children:"Single"}),(0,a.jsx)(d.$n,{size:"sm",variant:"bulk"===K?"primary":"ghost",onClick:()=>{L("bulk"),H(null)},children:"Bulk Add"})]}),"bulk"===K&&(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["One key per line. Format: ",(0,a.jsx)("code",{children:"name|apiKey"})," or just ",(0,a.jsx)("code",{children:"apiKey"})," (auto-named by index)."]}),(0,a.jsx)("textarea",{className:"w-full rounded border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[140px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:N,value:F,onChange:e=>J(e.target.value)}),W&&(0,a.jsxs)("div",{className:`text-sm font-medium ${W.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",W.success," added",W.failed>0?`, ✗ ${W.failed} failed`:""]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:Q,fullWidth:!0,disabled:z||!F.trim(),children:z?"Adding...":"Add All Keys"}),(0,a.jsx)(d.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"single"===K&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.pd,{label:"Name",value:A.name,onChange:e=>$({...A,name:e.target.value}),placeholder:y?"Ollama Local":"Production Key"}),y&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:"Ollama Host URL",value:A.ollamaHostUrl,onChange:e=>$({...A,ollamaHostUrl:e.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:B,disabled:D||z,variant:"secondary",children:D?"Checking...":"Check"})})]}),!y&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:v,type:b?"text":"password",value:A.apiKey,onChange:e=>$({...A,apiKey:e.target.value}),placeholder:b?"grok-web"===t?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":"",className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:B,disabled:!A.apiKey||D||z,variant:"secondary",children:D?"Checking...":"Check"})})]}),b&&n&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[n,p&&(0,a.jsxs)(a.Fragment,{children:[" ",(0,a.jsxs)("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",p.replace(/^https?:\/\//,"")]})]})]}),C&&(0,a.jsx)(d.l6,{label:"Region",value:E,onChange:e=>R(e.target.value),options:C.map(e=>({value:e.id,label:e.label}))}),l&&(0,a.jsx)(d.pd,{label:"Default Model",value:A.defaultModel,onChange:e=>$({...A,defaultModel:e.target.value}),placeholder:r?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),y&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,a.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,a.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),_&&(0,a.jsx)(d.Ex,{variant:"success"===_?"success":"error",children:"success"===_?"Valid":"Invalid"}),x&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:x}),l&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Enter the model ID exactly as your compatible endpoint expects it. This model will be saved as the connection default."}),k&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,a.jsx)(d.pd,{label:"Account ID",value:O.accountId,onChange:e=>I({...O,accountId:e.target.value}),placeholder:"abc123def456..."}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Find your Account ID in the right sidebar of ",(0,a.jsx)("a",{href:"https://dash.cloudflare.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"dash.cloudflare.com"})]})]}),j&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)(d.pd,{label:"Azure Endpoint",value:T.azureEndpoint,onChange:e=>P({...T,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,a.jsx)(d.pd,{label:"Deployment Name",value:T.deployment,onChange:e=>P({...T,deployment:e.target.value}),placeholder:"gpt-4"}),(0,a.jsx)(d.pd,{label:"API Version",value:T.apiVersion,onChange:e=>P({...T,apiVersion:e.target.value}),placeholder:"2024-10-01-preview"}),(0,a.jsx)(d.pd,{label:"Organization",value:T.organization,onChange:e=>P({...T,organization:e.target.value}),placeholder:"Organization ID"})]})]}),(0,a.jsx)(d.pd,{label:"Priority",type:"number",value:A.priority,onChange:e=>$({...A,priority:Number.parseInt(e.target.value)||1})}),(0,a.jsx)(d.l6,{label:"Proxy Pool",value:A.proxyPoolId,onChange:e=>$({...A,proxyPoolId:e.target.value}),options:[{value:g,label:"None"},...(m||[]).map(e=>({value:e.id,label:e.name}))],placeholder:"None"}),0===(m||[]).length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No active proxy pools available. Create one in Proxy Pools page first."}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Legacy manual proxy fields are still accepted by API for backward compatibility."}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:G,fullWidth:!0,disabled:z||!y&&(!A.name||!A.apiKey)||l&&!A.defaultModel.trim()||j&&(!T.azureEndpoint||!T.deployment||!T.organization)||k&&!O.accountId,children:z?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function k({isOpen:e,node:t,onSave:s,onClose:l,isAnthropic:r}){let[o,n]=(0,i.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[c,p]=(0,i.useState)(!1),[m,x]=(0,i.useState)(""),[u,h]=(0,i.useState)(""),[f,g]=(0,i.useState)(!1),[y,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{t&&n({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(r?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,r]);let v=async()=>{if(o.name.trim()&&o.prefix.trim()&&o.baseUrl.trim()){p(!0);try{let e={name:o.name,prefix:o.prefix,baseUrl:o.baseUrl};r||(e.apiType=o.apiType),await s(e)}finally{p(!1)}}},j=async()=>{g(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:o.baseUrl,apiKey:m,type:r?"anthropic-compatible":"openai-compatible",modelId:u.trim()||void 0})}),t=await e.json();b(t.valid?"success":"failed")}catch{b("failed")}finally{g(!1)}};return t?(0,a.jsx)(d.aF,{isOpen:e,title:`Edit ${r?"Anthropic":"OpenAI"} Compatible`,onClose:l,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(d.pd,{label:"Name",value:o.name,onChange:e=>n({...o,name:e.target.value}),placeholder:`${r?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,a.jsx)(d.pd,{label:"Prefix",value:o.prefix,onChange:e=>n({...o,prefix:e.target.value}),placeholder:r?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!r&&(0,a.jsx)(d.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:o.apiType,onChange:e=>n({...o,apiType:e.target.value})}),(0,a.jsx)(d.pd,{label:"Base URL",value:o.baseUrl,onChange:e=>n({...o,baseUrl:e.target.value}),placeholder:r?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${r?"Anthropic":"OpenAI"}-compatible API.`}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:"API Key (for Check)",type:"password",value:m,onChange:e=>x(e.target.value),className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:j,disabled:!m||f||!o.baseUrl.trim(),variant:"secondary",children:f?"Checking...":"Check"})})]}),(0,a.jsx)(d.pd,{label:"Model ID (optional)",value:u,onChange:e=>h(e.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),y&&(0,a.jsx)(d.Ex,{variant:"success"===y?"success":"error",children:"success"===y?"Valid":"Invalid"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:v,fullWidth:!0,disabled:!o.name.trim()||!o.prefix.trim()||!o.baseUrl.trim()||c,children:c?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function C({isOpen:e,providerAlias:t,providerDisplayAlias:s,onSave:l,onClose:r}){let[o,n]=(0,i.useState)(""),[c,p]=(0,i.useState)(null),[m,x]=(0,i.useState)(""),[u,h]=(0,i.useState)(!1);(0,i.useEffect)(()=>{e&&(n(""),p(null),x(""))},[e]);let f=e=>{let s=`${t}/`;return e.startsWith(s)?e.slice(s.length):e},g=async()=>{let e=f(o.trim());if(e){p("testing"),x("");try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${t}/${e}`})}),a=await s.json();p(a.ok?"ok":"error"),x(a.error||"")}catch(e){p("error"),x(e.message)}}},y=async()=>{let e=f(o.trim());if(e&&!u){h(!0);try{await l(e)}finally{h(!1)}}};return(0,a.jsx)(d.aF,{isOpen:e,onClose:r,title:"Add Custom Model",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:o,onChange:e=>{n(e.target.value),p(null),x("")},onKeyDown:e=>{"Enter"===e.key&&g()},placeholder:"e.g. claude-opus-4-5",className:"flex-1 px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",autoFocus:!0}),(0,a.jsx)(d.$n,{variant:"secondary",icon:"science",loading:"testing"===c,onClick:g,disabled:!o.trim()||"testing"===c,children:"testing"===c?"Testing...":"Test"})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,a.jsx)("code",{className:"font-mono bg-sidebar px-1 rounded",children:f(o.trim())||"model-id"})]})]}),"ok"===c&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base",children:"check_circle"}),"Model is reachable"]}),"error"===c&&(0,a.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",children:"cancel"}),(0,a.jsx)("span",{children:m||"Model not reachable"})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,a.jsx)(d.$n,{onClick:r,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,a.jsx)(d.$n,{onClick:y,fullWidth:!0,size:"sm",disabled:!o.trim()||u,children:u?"Adding...":"Add Model"})]})]})})}function S(){let e,t=(0,l.useParams)(),s=(0,l.useRouter)(),r=t.id,[x,h]=(0,i.useState)([]),[f,y]=(0,i.useState)(!0),[v,N]=(0,i.useState)(null),[S,A]=(0,i.useState)([]),[$,T]=(0,i.useState)(!1),[P,O]=(0,i.useState)(!1),[I,E]=(0,i.useState)(!1),[R,D]=(0,i.useState)(""),[U,_]=(0,i.useState)(!1),[q,z]=(0,i.useState)(!1),[M,K]=(0,i.useState)(!1),[L,F]=(0,i.useState)(null),[J,W]=(0,i.useState)({}),[H,V]=(0,i.useState)(!1),[B,G]=(0,i.useState)({}),[Q,Z]=(0,i.useState)(""),[X,Y]=(0,i.useState)(null),[ee,et]=(0,i.useState)(!1),[es,ea]=(0,i.useState)([]),[ei,el]=(0,i.useState)("__none__"),[er,eo]=(0,i.useState)(!1),[en,ed]=(0,i.useState)(null),[ec,ep]=(0,i.useState)(""),[em,ex]=(0,i.useState)("auto"),[eu,eh]=(0,i.useState)([]),[ef,eg]=(0,i.useState)([]),[ey,eb]=(0,i.useState)([]),[ev,ej]=(0,i.useState)(null),[eN,ew]=(0,i.useState)(!1),{copied:ek,copy:eC}=(0,m.C)(),eS="ag_risk_confirmed",eA=()=>{"antigravity"===r&&"true"!==window.localStorage.getItem(eS)?ew(!0):eT?T(!0):(D(""),E(!0))},e$=v?{id:v.id,name:v.name||("anthropic-compatible"===v.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===v.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===v.type?"AC":"OC",apiType:v.apiType,baseUrl:v.baseUrl,type:v.type}:c.zN[r]||c.fg[r]||c.IS[r]||c.nJ[r]||c.br[r],eT=!!c.zN[r]||!!c.IS[r],eP=!!c.IS[r]?.noAuth,eO=(0,p.KC)(r),eI=(0,c.wG)(r),eE=(0,c.mq)(r),eR=(0,c.gb)(r),eD=eE||eR;c.Q2[r]?.thinkingConfig||c.s9.extended;let eU=eD?r:eI,e_=eD?v?.prefix||r:eI,eq=(0,i.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(eU)}`,{cache:"no-store"}),t=await e.json();e.ok&&eb(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[eU]),ez=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:eU,ids:[e]})})).ok&&await eq()}catch(e){console.log("Error disabling model:",e)}},eM=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(eU)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await eq()}catch(e){console.log("Error enabling model:",e)}},eK=async e=>{e.length&&ej({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{ej(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:eU,ids:e})})).ok&&await eq()}catch(e){console.log("Error disabling all models:",e)}}})},eL=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(eU)}`,{method:"DELETE"})).ok&&await eq()}catch(e){console.log("Error enabling all models:",e)}},eF=(0,i.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&W(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]);(0,i.useEffect)(()=>{"kilocode"===r&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&eg(e.models)}).catch(()=>{})},[r]);let eJ=(0,i.useCallback)(async()=>{try{let[e,t,s,a]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),i=await e.json(),l=await t.json(),o=await s.json(),n=a.ok?await a.json():{};if(e.ok){let e=(i.connections||[]).filter(e=>e.provider===r);h(e)}s.ok&&A(o.proxyPools||[]);let d=(n.providerStrategies||{})[r]||{};ed(d.fallbackStrategy||null),ep(null!=d.stickyRoundRobinLimit?String(d.stickyRoundRobinLimit):"1");let c=(n.providerThinking||{})[r]||{};if(ex(c.mode||"auto"),t.ok){let e=(l.nodes||[]).find(e=>e.id===r)||null;if(!e&&eD)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===r)||null))break}N(e)}}catch(e){console.log("Error fetching connections:",e)}finally{y(!1)}},[r,eD]),eW=async e=>{try{let t=await fetch(`/api/provider-nodes/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(N(s.node),await eJ(),z(!1))}catch(e){console.log("Error updating provider node:",e)}},eH=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},i={};e&&(i.fallbackStrategy=e),"round-robin"===e&&""!==t&&(i.stickyRoundRobinLimit=Number(t)||3);let l={...a};0===Object.keys(i).length?delete l[r]:l[r]=i,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:l})})}catch(e){console.log("Error saving provider strategy:",e)}};(0,i.useEffect)(()=>{eJ(),eF(),eq()},[eJ,eF,eq]),(0,i.useEffect)(()=>{let e=(c.zN[r]||c.fg[r]||c.IS[r]||c.nJ[r])?.modelsFetcher;e&&u(e).then(eh)},[r]);let eV=async(e,t,s=eI)=>{let a=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a,alias:t})});if(e.ok)await eF();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},eB=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await eF()}catch(e){console.log("Error deleting alias:",e)}},eG=async e=>{ej({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{ej(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&h(x.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},eQ=()=>{eJ(),T(!1)},eZ=async e=>{D("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await eJ(),E(!1);return}D(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),D("Failed to save connection")}},eX=async e=>{try{(await fetch(`/api/providers/${L.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await eJ(),_(!1))}catch(e){console.log("Error updating connection:",e)}},eY=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&h(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},e0=async(e,t)=>{let s=[...x];[s[e],s[t]]=[s[t],s[e]],h(s);try{await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])}catch(e){console.log("Error swapping priority:",e),await eJ()}},e1=x.filter(e=>es.includes(e.id));x.length>0&&(es.length,x.length),(0,i.useEffect)(()=>{ea(e=>e.filter(e=>x.some(t=>t.id===e)))},[x]),(()=>{if(0===e1.length)return;let e=new Set(e1.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return;let s=S.find(e=>e.id===t);return s?.name}})();let e2=()=>{er||K(!1)},e5=async e=>{eo(!0);try{let t=0;for(let{connectionId:s,proxyPoolId:a}of e)try{(await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:a})})).ok||(t+=1)}catch(e){console.log("Error applying proxy for",s,e),t+=1}t>0&&alert(`Updated with ${t} failed request(s).`),await eJ(),K(!1)}finally{eo(!1)}},e3=e=>e5(x.map(t=>({connectionId:t.id,proxyPoolId:e}))),e4=(0,a.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:x.map((e,t)=>(0,a.jsx)("div",{className:"flex min-w-0 items-stretch",children:(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsx)(j,{connection:e,proxyPools:S,isOAuth:eT,isFirst:0===t,isLast:t===x.length-1,onMoveUp:()=>e0(t,t-1),onMoveDown:()=>e0(t,t+1),onToggleActive:t=>eY(e.id,t),onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&h(s=>s.map(s=>s.id===e.id?{...s,providerSpecificData:{...s.providerSpecificData,proxyPoolId:t||null}}:s))}catch(e){console.log("Error updating proxy:",e)}},onEdit:()=>{F(e),_(!0)},onDelete:()=>eG(e.id)})})},e.id))}),e6=S.filter(e=>!0===e.isActive),e7=(0,a.jsx)(d.aF,{isOpen:M,onClose:e2,title:`Apply Proxy (${x.length} connections)`,children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsxs)("button",{onClick:()=>{let e=S.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):e5(x.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:er||0===e6.length,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,a.jsxs)("button",{onClick:()=>e3(null),disabled:er,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),S.map(e=>(0,a.jsxs)("button",{onClick:()=>e3(e.id),disabled:er||!0!==e.isActive,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,a.jsx)("span",{className:"truncate text-sm text-text-main",children:e.name}),!0!==e.isActive&&(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},e.id))]}),er&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,a.jsx)(d.$n,{onClick:e2,variant:"ghost",fullWidth:!0,disabled:er,children:"Cancel"})]})}),e8=async e=>{if(!X){Y(e);try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${eU}/${e}`})}),s=await t.json();G(t=>({...t,[e]:s.ok?"ok":"error"})),Z(s.ok?"":s.error||"Model not reachable")}catch{G(t=>({...t,[e]:"error"})),Z("Network error")}finally{Y(null)}}};return f?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(d.Qv,{}),(0,a.jsx)(d.Qv,{})]}):e$?(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)(o(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${e$.color}15`},children:H?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:e$.color},children:e$.textIcon||e$.id.slice(0,2).toUpperCase()}):(0,a.jsx)(n.default,{src:eE&&e$.apiType?"responses"===e$.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":eR?"/providers/anthropic-m.png":`/providers/${e$.id}.png`,alt:e$.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>V(!0)})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,a.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:e$.name}),(e$.notice?.apiKeyUrl||e$.notice?.signupUrl||e$.website)&&(0,a.jsxs)("a",{href:e$.notice?.apiKeyUrl||e$.notice?.signupUrl||e$.website,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"}),e$.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:[x.length," connection",1===x.length?"":"s"]})]})]})]}),e$.deprecated&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,a.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:e$.deprecationNotice})]}),e$.notice?.text&&!e$.deprecated&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,a.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:e$.notice.text}),e$.notice.apiKeyUrl&&(0,a.jsx)("a",{href:e$.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),eD&&v&&(0,a.jsx)(d.Zp,{children:(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:eR?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,a.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[eR?"Messages API":"responses"===v.apiType?"Responses API":"Chat Completions"," \xb7 ",(v.baseUrl||"").replace(/\/$/,""),"/",eR?"messages":"responses"===v.apiType?"responses":"chat/completions"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>{D(""),E(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>z(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{ej({title:"Delete Compatible Node",message:`Delete this ${eR?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{ej(null);try{(await fetch(`/api/provider-nodes/${r}`,{method:"DELETE"})).ok&&s.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),eP?(0,a.jsx)(d.gw,{providerId:r}):(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[x.length>0&&S.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>K(!0),children:"Apply Proxy"}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,a.jsx)(d.lM,{checked:"round-robin"===en,onChange:e=>{let t=e?"round-robin":null,s=e?ec||"1":ec;e&&!ec&&ep("1"),ed(t),eH(t,s)}}),"round-robin"===en&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,a.jsx)("input",{type:"number",min:1,value:ec,onChange:e=>{var t;ep(t=e.target.value),eH("round-robin",t)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]})]}),0===x.length?(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:eT?"lock":"key"})}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[!eD&&"iflow"===r&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>O(!0),children:"Cookie"}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:eA,children:eD?"Add API Key":"iflow"===r?"OAuth":"Add Connection"})]})]}):(0,a.jsxs)(a.Fragment,{children:[e4,!eD&&(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===r&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>O(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:eA,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),!eD&&(e=[...eO,...ef.filter(e=>!eO.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type).map(e=>e.id).filter(e=>!ey.includes(e)),(0,a.jsxs)("div",{className:"flex gap-2",children:[ey.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:eL,children:"Active All"}),e.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>eK(e),children:"Disable All"})]}))]}),!!Q&&(0,a.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:Q}),(()=>{let e,t,s;if(eD)return(0,a.jsx)(b,{providerStorageAlias:eU,providerDisplayAlias:e_,modelAliases:J,copied:ek,onCopy:eC,onSetAlias:eV,onDeleteAlias:eB,connections:x,isAnthropic:eR});let i=[...eO,...ef.filter(e=>!eO.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type),l=new Set(ey),o=i.filter(e=>!l.has(e.id)),n=i.filter(e=>l.has(e.id)),d=Object.entries(J).filter(([e,t])=>{let s=`${eU}/`;if(!t.startsWith(s))return!1;let a=t.slice(s.length);return e$.passthroughModels?!eO.some(e=>e.id===a):!eO.some(e=>e.id===a)&&e===a}).map(([e,t])=>({id:t.slice(`${eU}/`.length),alias:e,fullModel:t}));return(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[d.map(e=>(0,a.jsx)(g,{model:{id:e.id},fullModel:`${e_}/${e.id}`,alias:e.alias,copied:ek,onCopy:eC,onSetAlias:()=>{},onDeleteAlias:()=>eB(e.alias),testStatus:B[e.id],onTest:x.length>0||eP?()=>e8(e.id):void 0,isTesting:X===e.id,isCustom:!0,isFree:!1},e.id)),o.map(e=>{let t=`${eU}/${e.id}`,s=`${r}/${e.id}`,i=Object.entries(J).find(([,e])=>e===t||e===s)?.[0];return(0,a.jsx)(g,{model:e,fullModel:`${e_}/${e.id}`,alias:i,copied:ek,onCopy:eC,onSetAlias:t=>eV(e.id,t,eU),onDeleteAlias:()=>eB(i),testStatus:B[e.id],onTest:x.length>0||eP?()=>e8(e.id):void 0,isTesting:X===e.id,isFree:e.isFree,onDisable:()=>ez(e.id)},e.id)}),(0,a.jsxs)("button",{onClick:()=>et(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-primary/40 px-3 py-2 text-xs text-primary transition-colors hover:border-primary hover:bg-primary/5 sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),eu.length>0&&(e=new Set(Object.values(J)),t=new Set(eO.map(e=>e.id)),0===(s=eu.filter(s=>!e.has(`${eU}/${s.id}`)&&!t.has(s.id))).length?null:(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,a.jsxs)("button",{onClick:async()=>{let t=e.id.split("/").pop();await eV(e.id,t,eU)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:`${e.name} \xb7 ${(e.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]})),n.length>0&&(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",n.length,"):"]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:n.map(e=>(0,a.jsxs)("button",{onClick:()=>eM(e.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:"Restore model",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id]},e.id))})]})]})})()]}),e7,"kiro"===r?(0,a.jsx)(d.Mh,{isOpen:$,providerInfo:e$,onSuccess:eQ,onClose:()=>T(!1)}):"cursor"===r?(0,a.jsx)(d.G9,{isOpen:$,onSuccess:eQ,onClose:()=>T(!1)}):"gitlab"===r?(0,a.jsx)(d.vj,{isOpen:$,providerInfo:e$,onSuccess:eQ,onClose:()=>T(!1)}):(0,a.jsx)(d.LF,{isOpen:$,provider:r,providerInfo:e$,onSuccess:eQ,onClose:()=>T(!1)}),"iflow"===r&&(0,a.jsx)(d.vE,{isOpen:P,onSuccess:()=>{eJ(),O(!1)},onClose:()=>O(!1)}),(0,a.jsx)(w,{isOpen:I,provider:r,providerName:e$.name,isCompatible:eD,isAnthropic:eR,authType:e$?.authType,authHint:e$?.authHint,website:e$?.website,proxyPools:S,error:R,onSave:eZ,onBulkDone:eJ,onClose:()=>{D(""),E(!1)}}),(0,a.jsx)(d.wI,{isOpen:U,connection:L,proxyPools:S,onSave:eX,onClose:()=>_(!1)}),eD&&(0,a.jsx)(k,{isOpen:q,node:v,onSave:eW,onClose:()=>z(!1),isAnthropic:eR}),!eD&&(0,a.jsx)(C,{isOpen:ee,providerAlias:eU,providerDisplayAlias:e_,onSave:async e=>{let t=e$?.passthroughModels?e.split("/").pop():e;await eV(e,t,eU),et(!1)},onClose:()=>et(!1)}),(0,a.jsx)(d.uo,{isOpen:eN,onClose:()=>ew(!1),onConfirm:()=>{(window.localStorage.setItem(eS,"true"),ew(!1),eT)?T(!0):(D(""),E(!0))},title:"Risk Notice",message:e$?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,a.jsx)(d.uo,{isOpen:!!ev,onClose:()=>ej(null),onConfirm:ev?.onConfirm,title:ev?.title||"Confirm",message:ev?.message,variant:"danger"})]}):(0,a.jsxs)("div",{className:"text-center py-20",children:[(0,a.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,a.jsx)(o(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}w.propTypes={isOpen:f().bool.isRequired,provider:f().string,providerName:f().string,isCompatible:f().bool,isAnthropic:f().bool,authType:f().string,authHint:f().string,website:f().string,proxyPools:f().arrayOf(f().shape({id:f().string,name:f().string})),error:f().string,onSave:f().func.isRequired,onBulkDone:f().func,onClose:f().func.isRequired},k.propTypes={isOpen:f().bool.isRequired,node:f().shape({id:f().string,name:f().string,prefix:f().string,apiType:f().string,baseUrl:f().string}),onSave:f().func.isRequired,onClose:f().func.isRequired,isAnthropic:f().bool},C.propTypes={isOpen:f().bool.isRequired,providerAlias:f().string.isRequired,providerDisplayAlias:f().string.isRequired,onSave:f().func.isRequired,onClose:f().func.isRequired}}},e=>{e.O(0,[7848,4335,6795,8872,505,4156,2347,5158,7358],()=>e(e.s=7207)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2825],{33154:(e,t,s)=>{Promise.resolve().then(s.bind(s,83101))},83101:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>N});var a=s(73365),l=s(1521),n=s(29717),r=s(74156),i=s(292),d=s(38230),o=s(87706);function c({isOpen:e,onClose:t,title:s,children:n,width:r="md",className:i}){let d={sm:"w-[400px]",md:"w-[500px]",lg:"w-[600px]",xl:"w-[800px]",full:"w-full"};return((0,l.useEffect)(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),(0,l.useEffect)(()=>{let s=s=>{"Escape"===s.key&&e&&t()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,t]),e)?(0,a.jsxs)("div",{className:"fixed inset-0 z-50",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in cursor-pointer",onClick:t,"aria-hidden":"true"}),(0,a.jsxs)("div",{className:(0,o.cn)("absolute right-0 top-0 h-full bg-surface flex flex-col","shadow-[var(--shadow-elev)]","slide-in-right","border-l border-border-subtle",d[r]||d.md,i),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-border-subtle flex-shrink-0",children:[(0,a.jsx)("div",{className:"flex items-center gap-3",children:s&&(0,a.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:s})}),(0,a.jsx)("button",{type:"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-[20px]",children:"close"})})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto p-6 custom-scrollbar",children:n})]})]}):null}function x({currentPage:e,pageSize:t,totalItems:s,onPageChange:l,onPageSizeChange:n,className:r}){let i=Math.ceil(s/t),c=s>0?(e-1)*t+1:0,m=Math.min(e*t,s),h=(()=>{let t=[],s=Math.max(1,e-2),a=Math.min(i,s+5-1);a-s+1<5&&(s=Math.max(1,a-5+1));for(let e=s;e<=a;e++)t.push(e);return t})();return(0,a.jsxs)("div",{className:(0,o.cn)("flex flex-col sm:flex-row items-center justify-between gap-4 py-4 px-2",r),children:[s>0&&(0,a.jsxs)("div",{className:"text-sm text-text-muted",children:["Showing ",(0,a.jsx)("span",{className:"font-medium text-text-main",children:c})," to"," ",(0,a.jsx)("span",{className:"font-medium text-text-main",children:m})," of"," ",(0,a.jsx)("span",{className:"font-medium text-text-main",children:s})," results"]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2 sm:gap-4",children:[n&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"Rows:"}),(0,a.jsx)("select",{value:t,onChange:e=>n(Number(e.target.value)),className:(0,o.cn)("h-9 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20","cursor-pointer"),style:{colorScheme:"auto"},children:[10,20,50].map(e=>(0,a.jsx)("option",{value:e,children:e},e))})]}),i>1&&(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(d.default,{variant:"outline",size:"sm",onClick:()=>l(e-1),disabled:1===e,className:"w-9 px-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_left"})}),h[0]>1&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.default,{variant:"ghost",size:"sm",onClick:()=>l(1),className:"w-9 px-0 hidden sm:inline-flex",children:"1"}),h[0]>2&&(0,a.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."})]}),h.map(t=>(0,a.jsx)(d.default,{variant:e===t?"primary":"ghost",size:"sm",onClick:()=>l(t),className:(0,o.cn)("w-9 px-0",e===t?"inline-flex":"hidden sm:inline-flex"),children:t},t)),h[h.length-1]<i&&(0,a.jsxs)(a.Fragment,{children:[h[h.length-1]<i-1&&(0,a.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."}),(0,a.jsx)(d.default,{variant:"ghost",size:"sm",onClick:()=>l(i),className:"w-9 px-0 hidden sm:inline-flex",children:i})]}),(0,a.jsx)(d.default,{variant:"outline",size:"sm",onClick:()=>l(e+1),disabled:e===i,className:"w-9 px-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_right"})})]})]})]})}var m=s(82495);let h=null,p=null;async function u(){if(h&&p)return{providerNameCache:h,providerNodesCache:p};let e=await fetch("/api/provider-nodes"),t=(await e.json()).nodes||[];for(let e of(p={},t))p[e.id]=e.name;return{providerNameCache:h={...m.Q2,...p},providerNodesCache:p}}function f(e,t){if(!e||!t)return e;let s=t[e];if("string"==typeof s)return s;if(s?.name)return s.name;let a=(0,m.zt)(e)||m.Q2[e];return a?.name||e}function b({title:e,children:t,defaultOpen:s=!1,icon:n=null}){let[r,i]=(0,l.useState)(s);return(0,a.jsxs)("div",{className:"border border-black/5 dark:border-white/5 rounded-lg overflow-hidden",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>i(!r),className:"w-full flex items-center justify-between p-3 bg-black/[0.02] dark:bg-white/[0.02] hover:bg-black/[0.04] dark:hover:bg-white/[0.04] transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[n&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:n}),(0,a.jsx)("span",{className:"font-semibold text-sm text-text-main",children:e})]}),(0,a.jsx)("span",{className:(0,o.cn)("material-symbols-outlined text-[20px] text-text-muted transition-transform duration-200",r?"rotate-90":""),children:"chevron_right"})]}),r&&(0,a.jsx)("div",{className:"p-4 border-t border-black/5 dark:border-white/5",children:t})]})}function j(e){let t=e?.prompt_tokens||e?.input_tokens||0,s=e?.cached_tokens||e?.cache_read_input_tokens||0;return t<s?s:t}function g(){let[e,t]=(0,l.useState)([]),[s,n]=(0,l.useState)({page:1,pageSize:20,totalItems:0,totalPages:0}),[r,m]=(0,l.useState)(!1),[h,p]=(0,l.useState)(null),[g,v]=(0,l.useState)(!1),[N,w]=(0,l.useState)([]),[k,y]=(0,l.useState)(null),[S,C]=(0,l.useState)({provider:"",startDate:"",endDate:""}),D=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/usage/providers"),t=await e.json();w(t.providers||[]);let s=await u();y(s.providerNameCache)}catch(e){console.error("Failed to fetch providers:",e)}},[]),z=(0,l.useCallback)(async()=>{m(!0);try{let e=new URLSearchParams({page:s.page.toString(),pageSize:s.pageSize.toString()});S.provider&&e.append("provider",S.provider),S.startDate&&e.append("startDate",S.startDate),S.endDate&&e.append("endDate",S.endDate);let a=await fetch(`/api/usage/request-details?${e}`),l=await a.json();t(l.details||[]),n(e=>({...e,...l.pagination}))}catch(e){console.error("Failed to fetch request details:",e)}finally{m(!1)}},[s.page,s.pageSize,S]);return(0,l.useEffect)(()=>{D()},[D]),(0,l.useEffect)(()=>{z()},[z]),(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[(0,a.jsx)(i.default,{padding:"md",children:(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,a.jsx)("label",{htmlFor:"provider-filter",className:"text-sm font-medium text-text-main",children:"Provider"}),(0,a.jsxs)("select",{id:"provider-filter",value:S.provider,onChange:e=>C({...S,provider:e.target.value}),className:(0,o.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20","w-full min-w-0 cursor-pointer"),style:{colorScheme:"auto"},children:[(0,a.jsx)("option",{value:"",children:"All Providers"}),N.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,a.jsx)("label",{htmlFor:"start-date-filter",className:"text-sm font-medium text-text-main",children:"Start Date"}),(0,a.jsx)("input",{id:"start-date-filter",type:"datetime-local",value:S.startDate,onChange:e=>C({...S,startDate:e.target.value}),className:(0,o.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 bg-surface","w-full min-w-0 text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20")})]}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,a.jsx)("label",{htmlFor:"end-date-filter",className:"text-sm font-medium text-text-main",children:"End Date"}),(0,a.jsx)("input",{id:"end-date-filter",type:"datetime-local",value:S.endDate,onChange:e=>C({...S,endDate:e.target.value}),className:(0,o.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 bg-surface","w-full min-w-0 text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20")})]}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-2 sm:col-span-2 lg:col-span-1",children:[(0,a.jsx)("span",{className:"hidden text-sm font-medium text-text-main opacity-0 lg:block","aria-hidden":"true",children:"Clear"}),(0,a.jsx)(d.default,{variant:"ghost",onClick:()=>{C({provider:"",startDate:"",endDate:""})},disabled:!S.provider&&!S.startDate&&!S.endDate,className:"w-full",children:"Clear Filters"})]})]})}),(0,a.jsxs)(i.default,{padding:"none",children:[(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full min-w-[880px]",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5",children:[(0,a.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Timestamp"}),(0,a.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Model"}),(0,a.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Provider"}),(0,a.jsx)("th",{className:"text-right p-4 text-sm font-semibold text-text-main",children:"Input Tokens"}),(0,a.jsx)("th",{className:"text-right p-4 text-sm font-semibold text-text-main",children:"Output Tokens"}),(0,a.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Latency"}),(0,a.jsx)("th",{className:"text-center p-4 text-sm font-semibold text-text-main",children:"Action"})]})}),(0,a.jsx)("tbody",{children:r?(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:"7",className:"p-8 text-center text-text-muted",children:(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[20px]",children:"progress_activity"}),"Loading..."]})})}):0===e.length?(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:"7",className:"p-8 text-center text-text-muted",children:"No request details found"})}):e.map((e,t)=>(0,a.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5 last:border-b-0 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,a.jsx)("td",{className:"whitespace-nowrap p-4 text-sm text-text-main",children:new Date(e.timestamp).toLocaleString()}),(0,a.jsx)("td",{className:"max-w-[260px] truncate p-4 font-mono text-sm text-text-main",children:e.model}),(0,a.jsx)("td",{className:"max-w-[180px] truncate p-4 text-sm text-text-main",children:(0,a.jsx)("span",{className:"font-medium",children:f(e.provider,k)})}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:j(e.tokens).toLocaleString()}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:e.tokens?.completion_tokens?.toLocaleString()||0}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-muted",children:(0,a.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,a.jsxs)("div",{children:["TTFT: ",(0,a.jsxs)("span",{className:"font-mono",children:[e.latency?.ttft||0,"ms"]})]}),(0,a.jsxs)("div",{children:["Total: ",(0,a.jsxs)("span",{className:"font-mono",children:[e.latency?.total||0,"ms"]})]})]})}),(0,a.jsx)("td",{className:"p-4 text-center",children:(0,a.jsx)(d.default,{variant:"outline",size:"sm",onClick:()=>{p(e),v(!0)},children:"Detail"})})]},`${e.id}-${t}`))})]})}),!r&&e.length>0&&(0,a.jsx)("div",{className:"border-t border-black/5 dark:border-white/5",children:(0,a.jsx)(x,{currentPage:s.page,pageSize:s.pageSize,totalItems:s.totalItems,onPageChange:e=>{n(t=>({...t,page:e}))},onPageSizeChange:e=>{n(t=>({...t,pageSize:e,page:1}))}})})]}),(0,a.jsx)(c,{isOpen:g,onClose:()=>v(!1),title:"Request Details",width:"lg",children:h&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"grid min-w-0 grid-cols-1 gap-4 text-sm sm:grid-cols-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"ID:"})," ",(0,a.jsx)("span",{className:"break-all font-mono text-text-main",children:h.id})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Timestamp:"})," ",(0,a.jsx)("span",{className:"text-text-main",children:new Date(h.timestamp).toLocaleString()})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Provider:"})," ",(0,a.jsx)("span",{className:"text-text-main font-medium",children:f(h.provider,k)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Model:"})," ",(0,a.jsx)("span",{className:"text-text-main font-mono",children:h.model})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Status:"})," ",(0,a.jsx)("span",{className:(0,o.cn)("font-medium","success"===h.status?"text-green-600":"text-red-600"),children:h.status})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Latency:"})," ",(0,a.jsxs)("span",{className:"text-text-main font-mono",children:["TTFT ",h.latency?.ttft||0,"ms / Total ",h.latency?.total||0,"ms"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Input Tokens:"})," ",(0,a.jsx)("span",{className:"text-text-main font-mono",children:j(h.tokens).toLocaleString()})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Output Tokens:"})," ",(0,a.jsx)("span",{className:"text-text-main font-mono",children:h.tokens?.completion_tokens?.toLocaleString()||0})]})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(b,{title:"1. Client Request (Input)",defaultOpen:!0,icon:"input",children:(0,a.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:JSON.stringify(h.request,null,2)})}),h.providerRequest&&(0,a.jsx)(b,{title:"2. Provider Request (Translated)",icon:"translate",children:(0,a.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:JSON.stringify(h.providerRequest,null,2)})}),h.providerResponse&&(0,a.jsx)(b,{title:"3. Provider Response (Raw)",icon:"data_object",children:(0,a.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:"object"==typeof h.providerResponse?JSON.stringify(h.providerResponse,null,2):h.providerResponse})}),(0,a.jsxs)(b,{title:"4. Client Response (Final)",defaultOpen:!0,icon:"output",children:[h.response?.thinking&&(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("h4",{className:"font-semibold text-text-main mb-2 flex items-center gap-2 text-xs uppercase tracking-wide opacity-70",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"psychology"}),"Thinking Process"]}),(0,a.jsx)("pre",{className:"max-h-[200px] max-w-full overflow-auto rounded-lg border border-amber-200 bg-amber-50 p-3 font-mono text-xs text-amber-900 dark:border-amber-800 dark:bg-amber-950/30 dark:text-amber-100 sm:p-4",children:h.response.thinking})]}),(0,a.jsx)("h4",{className:"font-semibold text-text-main mb-2 text-xs uppercase tracking-wide opacity-70",children:"Content"}),(0,a.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:h.response?.content||"[No content]"})]})]})]})})]})}let v=[{value:"today",label:"Today"},{value:"24h",label:"24h"},{value:"7d",label:"7D"},{value:"30d",label:"30D"},{value:"60d",label:"60D"}];function N(){return(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(r.Qv,{}),children:(0,a.jsx)(w,{})})}function w(){let e=(0,n.useSearchParams)(),t=(0,n.useRouter)(),[s,i]=(0,l.useState)("today"),d=e.get("tab"),o=d&&["overview","logs","details"].includes(d)?d:"overview";return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)(r.Iz,{options:[{value:"overview",label:"Overview"},{value:"details",label:"Details"}],value:o,onChange:s=>{if(s===o)return;let a=new URLSearchParams(e);a.set("tab",s),t.push(`/dashboard/usage?${a.toString()}`,{scroll:!1})},className:"w-full sm:w-auto"}),"overview"===o&&(0,a.jsx)(r.Iz,{options:v,value:s,onChange:i,size:"sm",className:"w-full sm:w-auto"})]}),"overview"===o&&(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(r.Qv,{}),children:(0,a.jsx)(r.jK,{period:s,setPeriod:i,hidePeriodSelector:!0})}),"logs"===o&&(0,a.jsx)(r.gM,{}),"details"===o&&(0,a.jsx)(g,{})]})}}},e=>{e.O(0,[7848,4335,6795,505,4156,2347,5158,7358],()=>e(e.s=33154)),_N_E=e.O()}]);