prozygent 0.5.21 → 0.5.23

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 (366) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +10 -10
  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_client-reference-manifest.js +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  30. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  31. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  32. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  33. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  34. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  35. package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  36. package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  37. package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  38. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  39. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  40. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  41. package/app/.next-cli-build/server/app/_not-found.rsc +4 -4
  42. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +4 -4
  43. package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  44. package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +4 -4
  45. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  46. package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  47. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  48. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  49. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  50. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  51. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  52. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  53. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
  54. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  55. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  56. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  57. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  58. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  59. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  60. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  61. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  62. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  63. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  64. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  65. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  66. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  67. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  68. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  69. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  70. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  71. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  72. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  73. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  74. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  75. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  76. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  77. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  78. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  79. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  80. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  81. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  82. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  83. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  84. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  85. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  86. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  87. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  88. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  89. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  90. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  91. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  92. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  93. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  94. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  95. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  96. package/app/.next-cli-build/server/app/api/providers/merlin/auth/callback/route.js.nft.json +1 -1
  97. package/app/.next-cli-build/server/app/api/providers/merlin/auth/google/route.js.nft.json +1 -1
  98. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  99. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  100. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  101. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  102. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  103. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  104. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  106. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  107. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  108. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/settings/migrate-9router/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 +1 -1
  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/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  124. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  126. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  127. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  130. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  131. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  133. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  134. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  136. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  137. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  138. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  139. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  140. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  141. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  142. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  143. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  144. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  145. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  146. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  147. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  148. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  149. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  151. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  152. package/app/.next-cli-build/server/app/callback.html +1 -1
  153. package/app/.next-cli-build/server/app/callback.rsc +4 -4
  154. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +4 -4
  155. package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  156. package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +4 -4
  157. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
  158. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  159. package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  160. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  161. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +6 -6
  162. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  163. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  164. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  165. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  166. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +6 -6
  167. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  168. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +4 -4
  169. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
  170. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  171. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +6 -6
  172. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  173. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  174. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  175. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  176. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
  177. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  178. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
  179. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
  180. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  181. package/app/.next-cli-build/server/app/dashboard/combos.rsc +6 -6
  182. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  183. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  184. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  185. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  186. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
  187. package/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  188. package/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
  189. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
  190. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  191. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +6 -6
  192. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  193. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  194. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  195. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  196. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -6
  197. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  198. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
  199. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
  200. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  201. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +6 -6
  202. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  203. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
  204. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
  205. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  206. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  207. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +6 -6
  208. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
  209. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +4 -4
  210. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
  211. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  212. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +6 -6
  213. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  214. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  215. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  216. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  217. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
  218. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  219. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
  220. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
  221. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  222. package/app/.next-cli-build/server/app/dashboard/profile.rsc +6 -6
  223. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  224. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  225. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  226. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  227. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +6 -6
  228. package/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  229. package/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
  230. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
  231. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  232. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +6 -6
  233. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  234. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  235. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  236. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  237. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  238. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
  239. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  240. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
  241. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
  242. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  243. package/app/.next-cli-build/server/app/dashboard/providers.rsc +6 -6
  244. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  245. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  246. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  247. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  248. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
  249. package/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  250. package/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
  251. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
  252. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  253. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +6 -6
  254. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  255. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  256. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  257. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  258. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
  259. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  260. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
  261. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
  262. package/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
  263. package/app/.next-cli-build/server/app/dashboard/quota.rsc +7 -7
  264. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  265. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  266. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  267. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  268. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
  269. package/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  270. package/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
  271. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
  272. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  273. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  274. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
  275. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
  276. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  277. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
  278. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  279. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  280. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  281. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  282. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  283. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  284. package/app/.next-cli-build/server/app/dashboard/skills.rsc +6 -6
  285. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
  286. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
  287. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  288. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  289. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +6 -6
  290. package/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
  291. package/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +4 -4
  292. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
  293. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  294. package/app/.next-cli-build/server/app/dashboard/translator.rsc +6 -6
  295. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  296. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  297. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  298. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  299. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
  300. package/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  301. package/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
  302. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
  303. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  304. package/app/.next-cli-build/server/app/dashboard/usage.rsc +6 -6
  305. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  306. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  307. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  308. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  309. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
  310. package/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  311. package/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
  312. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
  313. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  314. package/app/.next-cli-build/server/app/dashboard.rsc +6 -6
  315. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  316. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  317. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  318. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +6 -6
  319. package/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
  320. package/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +4 -4
  321. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  322. package/app/.next-cli-build/server/app/index.html +1 -1
  323. package/app/.next-cli-build/server/app/index.rsc +4 -4
  324. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  325. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +4 -4
  326. package/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
  327. package/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +4 -4
  328. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
  329. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  330. package/app/.next-cli-build/server/app/landing.html +1 -1
  331. package/app/.next-cli-build/server/app/landing.rsc +4 -4
  332. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +4 -4
  333. package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  334. package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +4 -4
  335. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
  336. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  337. package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  338. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  339. package/app/.next-cli-build/server/app/login.html +1 -1
  340. package/app/.next-cli-build/server/app/login.rsc +5 -5
  341. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +5 -5
  342. package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  343. package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +4 -4
  344. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
  345. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  346. package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  347. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  348. package/app/.next-cli-build/server/app-paths-manifest.json +10 -10
  349. package/app/.next-cli-build/server/chunks/1350.js +1 -1
  350. package/app/.next-cli-build/server/chunks/1719.js +1 -1
  351. package/app/.next-cli-build/server/chunks/2231.js +1 -1
  352. package/app/.next-cli-build/server/chunks/318.js +1 -1
  353. package/app/.next-cli-build/server/chunks/8238.js +1 -1
  354. package/app/.next-cli-build/server/chunks/9870.js +1 -1
  355. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  356. package/app/.next-cli-build/server/pages/404.html +1 -1
  357. package/app/.next-cli-build/server/pages/500.html +1 -1
  358. package/app/.next-cli-build/static/chunks/{1321-3d482b36076ed486.js → 1321-62e459db470d341a.js} +1 -1
  359. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-dd012fa8b3902047.js → page-f8fa442f8ef20945.js} +3 -3
  360. package/app/cli/.build-home/.prozygent/db/backups/{upgrade-0.5.16-to-0.5.17-0.5.17-20260622-012702 → upgrade-0.5.20-to-0.5.21-0.5.21-20260622-022136}/data.sqlite +0 -0
  361. package/app/cli/.build-home/.prozygent/db/backups/{upgrade-0.5.17-to-0.5.18-0.5.18-20260622-013139 → upgrade-0.5.21-to-0.5.22-0.5.22-20260622-022817}/data.sqlite +0 -0
  362. package/app/cli/.build-home/.prozygent/db/data.sqlite +0 -0
  363. package/app/package.json +1 -1
  364. package/package.json +1 -1
  365. /package/app/.next-cli-build/static/{H1lo0YHt7MWaWj_jjxLtu → _7cfAJVjKAolsrcD9cxYS}/_buildManifest.js +0 -0
  366. /package/app/.next-cli-build/static/{H1lo0YHt7MWaWj_jjxLtu → _7cfAJVjKAolsrcD9cxYS}/_ssgManifest.js +0 -0
@@ -1,10 +1,10 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{31421:(e,t,s)=>{Promise.resolve().then(s.bind(s,78907))},70217:(e,t,s)=>{"use strict";function a(e,t){return!1===e?"default":"active"===t||"success"===t?"success":"error"===t||"expired"===t||"unavailable"===t?"error":"default"}s.d(t,{g:()=>a})},78907:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>E});var a=s(95155),i=s(12115),l=s(73321),o=s(98500),r=s.n(o),n=s(5772),d=s(35497),c=s(88105),m=s(28777),p=s(11059),x=s(53593),u=s(73006);let h=new Map;async function f(e){if(!e?.url||!e?.type)return[];let t=h.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 h.set(e.url,{data:a,expiresAt:Date.now()+6e5}),a}catch{return[]}}function y({customModels:e=[],modelAliases:t={},providerAlias:s,builtInModels:a=[],type:i="llm",includeLegacyAliases:l=!0}){let o=new Set(a.map(e=>e.id)),r=new Set,n=[];for(let t of e){if(!t?.id||t.providerAlias!==s)continue;let e=t?.kind||t?.type||"llm";if(i&&e!==i||o.has(t.id))continue;let a=`${s}/${t.id}`;r.has(a)||(r.add(a),n.push({id:t.id,name:t.name||t.id,fullModel:a,source:"custom",type:e}))}if(!l)return n;let d=`${s}/`;for(let[e,s]of Object.entries(t||{})){if("string"!=typeof s||!s.startsWith(d))continue;let t=s.slice(d.length);!t||o.has(t)||r.has(s)||(r.add(s),n.push({id:t,alias:e,fullModel:s,source:"legacyAlias",type:i||"llm"}))}return n}var g=s(14051),b=s.n(g);function v({model:e,fullModel:t,alias:s,copied:i,onCopy:l,testStatus:o,isCustom:r,isFree:n,onDeleteAlias:c,onTest:m,isTesting:p,onDisable:x,caps:u}){let h="ok"===o?"#22c55e":"error"===o?"#ef4444":void 0;return(0,a.jsx)("div",{className:`group min-w-0 max-w-full rounded-lg border px-3 py-2 ${"ok"===o?"border-green-500/40":"error"===o?"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:h?{color:h}:void 0,children:"ok"===o?"check_circle":"error"===o?"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}),(0,a.jsxs)("span",{className:"flex min-w-0 items-center text-[9px] gap-1 pl-1",children:[e.name&&(0,a.jsx)("span",{className:"truncate text-[9px] italic text-text-muted/70",children:e.name}),(0,a.jsx)(d.nh,{caps:u,colorOverride:"text-text-muted/70",size:12})]})]}),m&&(0,a.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,a.jsx)("button",{onClick:m,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"})]}),r?(0,a.jsx)("button",{onClick:c,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"})}):x?(0,a.jsx)("button",{onClick:x,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 j({modelId:e,fullModel:t,copied:s,onCopy:i,onDeleteAlias:l,onTest:o,testStatus:r,isTesting:n}){let d="ok"===r?"#22c55e":"error"===r?"#ef4444":void 0;return(0,a.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===r?"border-green-500/40":"error"===r?"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"===r?"check_circle":"error"===r?"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"})]}),o&&(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:o,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 w({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:s,customModels:l,copied:o,onCopy:r,onDeleteAlias:n,onAddCustomModel:c,onDeleteCustomModel:m,connections:p,isAnthropic:x}){let[u,h]=(0,i.useState)(""),[f,g]=(0,i.useState)(!1),[b,v]=(0,i.useState)(!1),[N,k]=(0,i.useState)(null),[C,S]=(0,i.useState)({}),A=async t=>{if(!N){k(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();S(e=>({...e,[t]:a.ok?"ok":"error"}))}catch{S(e=>({...e,[t]:"error"}))}finally{k(null)}}},$=y({customModels:l,modelAliases:s,providerAlias:e,type:"llm"}),T=async()=>{if(!u.trim()||f)return;let e=u.trim();if($.some(t=>t.id===e))return void alert("Model already exists for this provider.");g(!0);try{await c(e),h("")}catch(e){console.log("Error adding model:",e)}finally{g(!1)}},O=async()=>{if(b)return;let e=p.find(e=>!1!==e.isActive);if(e){v(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||"Failed to import models");let a=s.models||[];if(0===a.length)return void alert("No models returned from /models.");let i=0;for(let e of a){let t=e.id||e.name||e.model;t&&($.some(e=>e.id===t)||(await c(t),i+=1))}0===i&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{v(!1)}}},P=p.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 ",x?"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:u,onChange:e=>h(e.target.value),onKeyDown:e=>"Enter"===e.key&&T(),placeholder:x?"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:T,disabled:!u.trim()||f,children:f?"Adding...":"Add"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"download",onClick:O,disabled:!P||b,children:b?"Importing...":"Import from /models"})]}),!P&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),$.length>0&&(0,a.jsx)("div",{className:"flex flex-col gap-3",children:$.map(({id:s,alias:i,source:l})=>(0,a.jsx)(j,{modelId:s,fullModel:`${t}/${s}`,copied:o,onCopy:r,onDeleteAlias:()=>"custom"===l?m(s):n(i),onTest:p.length>0?()=>A(s):void 0,testStatus:C[s],isTesting:N===s},`${l}-${e}/${s}`))})]})}v.propTypes={model:b().shape({id:b().string.isRequired}).isRequired,fullModel:b().string.isRequired,alias:b().string,copied:b().string,onCopy:b().func.isRequired,testStatus:b().oneOf(["ok","error"]),isCustom:b().bool,isFree:b().bool,onDeleteAlias:b().func,onTest:b().func,isTesting:b().bool,onDisable:b().func,caps:b().object},b().string.isRequired,b().string.isRequired,b().string,b().func.isRequired,b().func.isRequired,b().func,b().oneOf(["ok","error"]),b().bool,b().string.isRequired,b().object.isRequired,b().arrayOf(b().object),b().string,b().func.isRequired,b().func.isRequired,b().func.isRequired,b().func.isRequired,w.propTypes={providerStorageAlias:b().string.isRequired,providerDisplayAlias:b().string.isRequired,modelAliases:b().object.isRequired,customModels:b().arrayOf(b().object),copied:b().string,onCopy:b().func.isRequired,onDeleteAlias:b().func.isRequired,onAddCustomModel:b().func.isRequired,onDeleteCustomModel:b().func.isRequired,connections:b().arrayOf(b().shape({id:b().string,isActive:b().bool})).isRequired,isAnthropic:b().bool};var N=s(70217);function k({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 C({connection:e,proxyPools:t,isOAuth:s,isFirst:l,isLast:o,onMoveUp:r,onMoveDown:n,onToggleActive:c,onUpdateProxy:m,onEdit:p,onDelete:x,oneByOneStatus:u=null,autoPing:h=null}){let[f,y]=(0,i.useState)(!1),[g,b]=(0,i.useState)(!1),v=(0,i.useRef)(null),j=new Map((t||[]).map(e=>[e.id,e])),w=e.providerSpecificData?.proxyPoolId||null,S=w?j.get(w):null,A=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,$=!!w||A,T=S?`Pool: ${S.name}`:w?`Pool: ${w} (inactive/missing)`:A?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",O="";if(S?.proxyUrl||e.providerSpecificData?.connectionProxyUrl){let t=S?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);O=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{O=t}}let P=S?.noProxy||e.providerSpecificData?.connectionNoProxy||"",E="default";S?.isActive===!0?E="success":(w||A)&&(E="error"),(0,i.useEffect)(()=>{if(!f)return;let e=e=>{v.current&&!v.current.contains(e.target)&&y(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[f]);let I=async e=>{b(!0);try{await m("__none__"===e?null:e)}finally{b(!1),y(!1)}},R=e.authType||(s?"oauth":"apikey"),D="oauth"===R,U="cookie"===R,_=e.name?.trim()||e.email?.trim()||e.displayName?.trim()||(D?"OAuth Account":U?"Cookie Account":"API Key"),q=e.name?.trim()&&e.email?.trim()&&e.name.trim()!==e.email.trim()?e.email.trim():e.name?.trim()&&e.displayName?.trim()&&e.name.trim()!==e.displayName.trim()?e.displayName.trim():null,[z,M]=(0,i.useState)(!1),F=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>!!e).sort()[0]||null;(0,i.useEffect)(()=>{let t=()=>{M(!!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=F?setInterval(t,1e3):null;return()=>{s&&clearInterval(s)}},[F]);let K="unavailable"!==e.testStatus||z?e.testStatus:"active",L=()=>u?"queued"===u.state?"queued":"testing"===u.state?"testing":"success"===u.state?"success":"failed"===u.state?u.error?`failed: ${u.error}`:"failed":null:null;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:r,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:o,className:`p-0.5 rounded ${o?"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:U?"cookie":D?"lock":"key"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:_}),q&&(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:q}),(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:(0,N.g)(e.isActive,K),size:"sm",dot:!0,children:!1===e.isActive?"disabled":K||"Unknown"}),(0,a.jsx)(d.Ex,{variant:"default",size:"sm",children:D?"OAuth":U?"Cookie":"API Key"}),$&&(0,a.jsx)(d.Ex,{variant:E,size:"sm",children:"Proxy"}),z&&!1!==e.isActive&&(0,a.jsx)(k,{until:F}),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]}),L()&&(0,a.jsx)(d.Ex,{variant:u?"success"===u.state?"success":"failed"===u.state?"error":"testing"===u.state?"primary":"default":"default",size:"sm",children:L()})]}),$&&(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:T,children:T}),O&&(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:O}),P&&(0,a.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:P,children:["no_proxy: ",P]})]})]})]}),(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:v,children:[(0,a.jsxs)("button",{onClick:()=>y(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 ${$?"text-primary":"text-text-muted hover:text-primary"}`,disabled:g,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:g?"progress_activity":"lan"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),f&&(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:()=>I("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!w?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,a.jsx)("button",{onClick:()=>I(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${w===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),h&&(0,a.jsx)(d.m_,{text:"When your 5h quota runs out, auto-sends a request the moment it resets so a new window starts right away.",children:(0,a.jsxs)("button",{onClick:()=>h.onToggle(!h.on),className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${h.on?"text-primary":"text-text-muted hover:text-primary"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Auto-ping"})]})}),(0,a.jsxs)("button",{onClick:p,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"})]})]})}k.propTypes={until:b().string.isRequired},C.propTypes={connection:b().shape({id:b().string,name:b().string,email:b().string,displayName:b().string,modelLockUntil:b().string,testStatus:b().string,isActive:b().bool,lastError:b().string,priority:b().number,globalPriority:b().number}).isRequired,proxyPools:b().arrayOf(b().shape({id:b().string,name:b().string,proxyUrl:b().string,noProxy:b().string,isActive:b().bool})),isOAuth:b().bool.isRequired,isFirst:b().bool.isRequired,isLast:b().bool.isRequired,onMoveUp:b().func.isRequired,onMoveDown:b().func.isRequired,onToggleActive:b().func.isRequired,onUpdateProxy:b().func,onEdit:b().func.isRequired,onDelete:b().func.isRequired,oneByOneStatus:b().shape({state:b().string,error:b().string}),autoPing:b().shape({on:b().bool,onToggle:b().func})};let S=`name1|sk-key1
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{31421:(e,t,s)=>{Promise.resolve().then(s.bind(s,78907))},70217:(e,t,s)=>{"use strict";function a(e,t){return!1===e?"default":"active"===t||"success"===t?"success":"error"===t||"expired"===t||"unavailable"===t?"error":"default"}s.d(t,{g:()=>a})},78907:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>E});var a=s(95155),i=s(12115),l=s(73321),o=s(98500),r=s.n(o),n=s(5772),d=s(35497),c=s(88105),m=s(28777),p=s(11059),x=s(53593),u=s(73006);let h=new Map;async function f(e){if(!e?.url||!e?.type)return[];let t=h.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 h.set(e.url,{data:a,expiresAt:Date.now()+6e5}),a}catch{return[]}}function y({customModels:e=[],modelAliases:t={},providerAlias:s,builtInModels:a=[],type:i="llm",includeLegacyAliases:l=!0}){let o=new Set(a.map(e=>e.id)),r=new Set,n=[];for(let t of e){if(!t?.id||t.providerAlias!==s)continue;let e=t?.kind||t?.type||"llm";if(i&&e!==i||o.has(t.id))continue;let a=`${s}/${t.id}`;r.has(a)||(r.add(a),n.push({id:t.id,name:t.name||t.id,fullModel:a,source:"custom",type:e}))}if(!l)return n;let d=`${s}/`;for(let[e,s]of Object.entries(t||{})){if("string"!=typeof s||!s.startsWith(d))continue;let t=s.slice(d.length);!t||o.has(t)||r.has(s)||(r.add(s),n.push({id:t,alias:e,fullModel:s,source:"legacyAlias",type:i||"llm"}))}return n}var g=s(14051),b=s.n(g);function v({model:e,fullModel:t,alias:s,copied:i,onCopy:l,testStatus:o,isCustom:r,isFree:n,onDeleteAlias:c,onTest:m,isTesting:p,onDisable:x,caps:u}){let h="ok"===o?"#22c55e":"error"===o?"#ef4444":void 0;return(0,a.jsx)("div",{className:`group min-w-0 max-w-full rounded-lg border px-3 py-2 ${"ok"===o?"border-green-500/40":"error"===o?"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:h?{color:h}:void 0,children:"ok"===o?"check_circle":"error"===o?"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}),(0,a.jsxs)("span",{className:"flex min-w-0 items-center text-[9px] gap-1 pl-1",children:[e.name&&(0,a.jsx)("span",{className:"truncate text-[9px] italic text-text-muted/70",children:e.name}),(0,a.jsx)(d.nh,{caps:u,colorOverride:"text-text-muted/70",size:12})]})]}),m&&(0,a.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,a.jsx)("button",{onClick:m,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"})]}),r?(0,a.jsx)("button",{onClick:c,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"})}):x?(0,a.jsx)("button",{onClick:x,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 j({modelId:e,fullModel:t,copied:s,onCopy:i,onDeleteAlias:l,onTest:o,testStatus:r,isTesting:n}){let d="ok"===r?"#22c55e":"error"===r?"#ef4444":void 0;return(0,a.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===r?"border-green-500/40":"error"===r?"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"===r?"check_circle":"error"===r?"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"})]}),o&&(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:o,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 w({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:s,customModels:l,copied:o,onCopy:r,onDeleteAlias:n,onAddCustomModel:c,onDeleteCustomModel:m,connections:p,isAnthropic:x}){let[u,h]=(0,i.useState)(""),[f,g]=(0,i.useState)(!1),[b,v]=(0,i.useState)(!1),[N,k]=(0,i.useState)(null),[C,S]=(0,i.useState)({}),A=async t=>{if(!N){k(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();S(e=>({...e,[t]:a.ok?"ok":"error"}))}catch{S(e=>({...e,[t]:"error"}))}finally{k(null)}}},$=y({customModels:l,modelAliases:s,providerAlias:e,type:"llm"}),T=async()=>{if(!u.trim()||f)return;let e=u.trim();if($.some(t=>t.id===e))return void alert("Model already exists for this provider.");g(!0);try{await c(e),h("")}catch(e){console.log("Error adding model:",e)}finally{g(!1)}},O=async()=>{if(b)return;let e=p.find(e=>!1!==e.isActive);if(e){v(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||"Failed to import models");let a=s.models||[];if(0===a.length)return void alert("No models returned from /models.");let i=0;for(let e of a){let t=e.id||e.name||e.model;t&&($.some(e=>e.id===t)||(await c(t),i+=1))}0===i&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{v(!1)}}},P=p.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 ",x?"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:u,onChange:e=>h(e.target.value),onKeyDown:e=>"Enter"===e.key&&T(),placeholder:x?"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:T,disabled:!u.trim()||f,children:f?"Adding...":"Add"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"download",onClick:O,disabled:!P||b,children:b?"Importing...":"Import from /models"})]}),!P&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),$.length>0&&(0,a.jsx)("div",{className:"flex flex-col gap-3",children:$.map(({id:s,alias:i,source:l})=>(0,a.jsx)(j,{modelId:s,fullModel:`${t}/${s}`,copied:o,onCopy:r,onDeleteAlias:()=>"custom"===l?m(s):n(i),onTest:p.length>0?()=>A(s):void 0,testStatus:C[s],isTesting:N===s},`${l}-${e}/${s}`))})]})}v.propTypes={model:b().shape({id:b().string.isRequired}).isRequired,fullModel:b().string.isRequired,alias:b().string,copied:b().string,onCopy:b().func.isRequired,testStatus:b().oneOf(["ok","error"]),isCustom:b().bool,isFree:b().bool,onDeleteAlias:b().func,onTest:b().func,isTesting:b().bool,onDisable:b().func,caps:b().object},b().string.isRequired,b().string.isRequired,b().string,b().func.isRequired,b().func.isRequired,b().func,b().oneOf(["ok","error"]),b().bool,b().string.isRequired,b().object.isRequired,b().arrayOf(b().object),b().string,b().func.isRequired,b().func.isRequired,b().func.isRequired,b().func.isRequired,w.propTypes={providerStorageAlias:b().string.isRequired,providerDisplayAlias:b().string.isRequired,modelAliases:b().object.isRequired,customModels:b().arrayOf(b().object),copied:b().string,onCopy:b().func.isRequired,onDeleteAlias:b().func.isRequired,onAddCustomModel:b().func.isRequired,onDeleteCustomModel:b().func.isRequired,connections:b().arrayOf(b().shape({id:b().string,isActive:b().bool})).isRequired,isAnthropic:b().bool};var N=s(70217);function k({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 C({connection:e,proxyPools:t,isOAuth:s,isFirst:l,isLast:o,onMoveUp:r,onMoveDown:n,onToggleActive:c,onUpdateProxy:m,onEdit:p,onDelete:x,oneByOneStatus:u=null,autoPing:h=null}){let[f,y]=(0,i.useState)(!1),[g,b]=(0,i.useState)(!1),v=(0,i.useRef)(null),j=new Map((t||[]).map(e=>[e.id,e])),w=e.providerSpecificData?.proxyPoolId||null,S=w?j.get(w):null,A=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,$=!!w||A,T=S?`Pool: ${S.name}`:w?`Pool: ${w} (inactive/missing)`:A?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",O="";if(S?.proxyUrl||e.providerSpecificData?.connectionProxyUrl){let t=S?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);O=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{O=t}}let P=S?.noProxy||e.providerSpecificData?.connectionNoProxy||"",E="default";S?.isActive===!0?E="success":(w||A)&&(E="error"),(0,i.useEffect)(()=>{if(!f)return;let e=e=>{v.current&&!v.current.contains(e.target)&&y(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[f]);let I=async e=>{b(!0);try{await m("__none__"===e?null:e)}finally{b(!1),y(!1)}},R=e.authType||(s?"oauth":"apikey"),D="oauth"===R,U="cookie"===R,_=e.name?.trim()||e.email?.trim()||e.displayName?.trim()||(D?"OAuth Account":U?"Cookie Account":"API Key"),q=e.name?.trim()&&e.email?.trim()&&e.name.trim()!==e.email.trim()?e.email.trim():e.name?.trim()&&e.displayName?.trim()&&e.name.trim()!==e.displayName.trim()?e.displayName.trim():null,[z,M]=(0,i.useState)(!1),K=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>!!e).sort()[0]||null;(0,i.useEffect)(()=>{let t=()=>{M(!!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=K?setInterval(t,1e3):null;return()=>{s&&clearInterval(s)}},[K]);let F="unavailable"!==e.testStatus||z?e.testStatus:"active",J=()=>u?"queued"===u.state?"queued":"testing"===u.state?"testing":"success"===u.state?"success":"failed"===u.state?u.error?`failed: ${u.error}`:"failed":null:null;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:r,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:o,className:`p-0.5 rounded ${o?"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:U?"cookie":D?"lock":"key"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:_}),q&&(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:q}),(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:(0,N.g)(e.isActive,F),size:"sm",dot:!0,children:!1===e.isActive?"disabled":F||"Unknown"}),(0,a.jsx)(d.Ex,{variant:"default",size:"sm",children:D?"OAuth":U?"Cookie":"API Key"}),$&&(0,a.jsx)(d.Ex,{variant:E,size:"sm",children:"Proxy"}),z&&!1!==e.isActive&&(0,a.jsx)(k,{until:K}),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]}),J()&&(0,a.jsx)(d.Ex,{variant:u?"success"===u.state?"success":"failed"===u.state?"error":"testing"===u.state?"primary":"default":"default",size:"sm",children:J()})]}),$&&(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:T,children:T}),O&&(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:O}),P&&(0,a.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:P,children:["no_proxy: ",P]})]})]})]}),(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:v,children:[(0,a.jsxs)("button",{onClick:()=>y(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 ${$?"text-primary":"text-text-muted hover:text-primary"}`,disabled:g,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:g?"progress_activity":"lan"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),f&&(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:()=>I("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!w?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,a.jsx)("button",{onClick:()=>I(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${w===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),h&&(0,a.jsx)(d.m_,{text:"When your 5h quota runs out, auto-sends a request the moment it resets so a new window starts right away.",children:(0,a.jsxs)("button",{onClick:()=>h.onToggle(!h.on),className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${h.on?"text-primary":"text-text-muted hover:text-primary"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Auto-ping"})]})}),(0,a.jsxs)("button",{onClick:p,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"})]})]})}k.propTypes={until:b().string.isRequired},C.propTypes={connection:b().shape({id:b().string,name:b().string,email:b().string,displayName:b().string,modelLockUntil:b().string,testStatus:b().string,isActive:b().bool,lastError:b().string,priority:b().number,globalPriority:b().number}).isRequired,proxyPools:b().arrayOf(b().shape({id:b().string,name:b().string,proxyUrl:b().string,noProxy:b().string,isActive:b().bool})),isOAuth:b().bool.isRequired,isFirst:b().bool.isRequired,isLast:b().bool.isRequired,onMoveUp:b().func.isRequired,onMoveDown:b().func.isRequired,onToggleActive:b().func.isRequired,onUpdateProxy:b().func,onEdit:b().func.isRequired,onDelete:b().func.isRequired,oneByOneStatus:b().shape({state:b().string,error:b().string}),autoPing:b().shape({on:b().bool,onToggle:b().func})};let S=`name1|sk-key1
2
2
  name2|sk-key2
3
- sk-key-only-auto-named`;function A({isOpen:e,provider:t,providerName:s,isCompatible:l,isAnthropic:o,authType:r,authHint:n,website:m,proxyPools:p,error:x,onSave:u,onBulkDone:h,onClose:f}){let y="__none__",g="ollama-local"===t,b="cookie"===r,v="xai"===t&&!b,j=b?"Cookie Value":"API Key",w="azure"===t,N="cloudflare-ai"===t,k=c.Q2?.[t]?.regions||null,C=c.Q2?.[t]?.defaultRegion||k?.[0]?.id||"",[$,T]=(0,i.useState)({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:y,ollamaHostUrl:""}),[O,P]=(0,i.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[E,I]=(0,i.useState)({accountId:""}),[R,D]=(0,i.useState)(C),[U,_]=(0,i.useState)(!1),[q,z]=(0,i.useState)(null),[M,F]=(0,i.useState)(!1),[K,L]=(0,i.useState)("single"),[J,W]=(0,i.useState)(""),[B,G]=(0,i.useState)(null),H=()=>g&&$.ollamaHostUrl.trim()?{baseUrl:$.ollamaHostUrl.trim()}:w?{azureEndpoint:O.azureEndpoint,apiVersion:O.apiVersion,deployment:O.deployment,organization:O.organization}:N?{accountId:E.accountId}:k&&R?{region:R}:void 0,V=async()=>{_(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:$.apiKey,providerSpecificData:H()})}),s=await e.json();z(s.valid?"success":"failed")}catch{z("failed")}finally{_(!1)}},Q=async()=>{if(t&&(g||$.apiKey)&&(g||$.name)&&(!l||$.defaultModel.trim())){F(!0);try{let e=!1;try{_(!0),z(null);let s=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:$.apiKey,providerSpecificData:H()})});e=!!(await s.json()).valid,z(e?"success":"failed")}catch{z("failed")}finally{_(!1)}await u({name:$.name||(g?"Ollama Local":""),apiKey:$.apiKey,defaultModel:l?$.defaultModel.trim():void 0,priority:$.priority,proxyPoolId:$.proxyPoolId===y?null:$.proxyPoolId,testStatus:e?"active":"unknown",providerSpecificData:H()})}finally{F(!1)}}},Z=async()=>{let e=J.split("\n").map(e=>e.trim()).filter(Boolean);if(!e.length)return;F(!0),G(null);let s=0,a=0;for(let i=0;i<e.length;i++){let l=e[i].split("|"),o=l.length>=2?l.slice(1).join("|").trim():l[0].trim(),r=l.length>=2?l[0].trim():"Key",n=`${r} ${i+1}`;try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:o,name:n,priority:1,testStatus:"unknown"})})).ok?s++:a++}catch{a++}}F(!1),G({success:s,failed:a}),s>0&&h&&h()};return t?(0,a.jsx)(d.aF,{isOpen:e,title:`Add ${s||t} ${j}`,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"),G(null)},children:"Single"}),(0,a.jsx)(d.$n,{size:"sm",variant:"bulk"===K?"primary":"ghost",onClick:()=>{L("bulk"),G(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:S,value:J,onChange:e=>W(e.target.value)}),B&&(0,a.jsxs)("div",{className:`text-sm font-medium ${B.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",B.success," added",B.failed>0?`, ✗ ${B.failed} failed`:""]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:Z,fullWidth:!0,disabled:M||!J.trim(),children:M?"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:$.name,onChange:e=>T({...$,name:e.target.value}),placeholder:g?"Ollama Local":"Production Key"}),g&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:"Ollama Host URL",value:$.ollamaHostUrl,onChange:e=>T({...$,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:V,disabled:U||M,variant:"secondary",children:U?"Checking...":"Check"})})]}),!g&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:j,type:b?"text":"password",value:$.apiKey,onChange:e=>T({...$,apiKey:e.target.value}),placeholder:b?"grok-web"===t?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":v?"xai-...":"",className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:V,disabled:!$.apiKey||U||M,variant:"secondary",children:U?"Checking...":"Check"})})]}),v&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Use a direct xAI API key from console.x.ai. This is separate from Grok Build OAuth."}),b&&n&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[n,m&&(0,a.jsxs)(a.Fragment,{children:[" ",(0,a.jsxs)("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",m.replace(/^https?:\/\//,"")]})]})]}),k&&(0,a.jsx)(d.l6,{label:"Region",value:R,onChange:e=>D(e.target.value),options:k.map(e=>({value:e.id,label:e.label}))}),l&&(0,a.jsx)(d.pd,{label:"Default Model",value:$.defaultModel,onChange:e=>T({...$,defaultModel:e.target.value}),placeholder:o?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),g&&(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"}),")."]}),q&&(0,a.jsx)(d.Ex,{variant:"success"===q?"success":"error",children:"success"===q?"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."}),N&&(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:E.accountId,onChange:e=>I({...E,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"})]})]}),w&&(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:O.azureEndpoint,onChange:e=>P({...O,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,a.jsx)(d.pd,{label:"Deployment Name",value:O.deployment,onChange:e=>P({...O,deployment:e.target.value}),placeholder:"gpt-4"}),(0,a.jsx)(d.pd,{label:"API Version",value:O.apiVersion,onChange:e=>P({...O,apiVersion:e.target.value}),placeholder:"2024-10-01-preview"}),(0,a.jsx)(d.pd,{label:"Organization",value:O.organization,onChange:e=>P({...O,organization:e.target.value}),placeholder:"Organization ID"})]})]}),(0,a.jsx)(d.pd,{label:"Priority",type:"number",value:$.priority,onChange:e=>T({...$,priority:Number.parseInt(e.target.value)||1})}),(0,a.jsx)(d.l6,{label:"Proxy Pool",value:$.proxyPoolId,onChange:e=>T({...$,proxyPoolId:e.target.value}),options:[{value:y,label:"None"},...(p||[]).map(e=>({value:e.id,label:e.name}))],placeholder:"None"}),0===(p||[]).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:Q,fullWidth:!0,disabled:M||!g&&(!$.name||!$.apiKey)||l&&!$.defaultModel.trim()||w&&(!O.azureEndpoint||!O.deployment||!O.organization)||N&&!E.accountId,children:M?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function $({isOpen:e,node:t,onSave:s,onClose:l,isAnthropic:o}){let[r,n]=(0,i.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[c,m]=(0,i.useState)(!1),[p,x]=(0,i.useState)(""),[u,h]=(0,i.useState)(""),[f,y]=(0,i.useState)(!1),[g,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{t&&n({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(o?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,o]);let v=async()=>{if(r.name.trim()&&r.prefix.trim()&&r.baseUrl.trim()){m(!0);try{let e={name:r.name,prefix:r.prefix,baseUrl:r.baseUrl};o||(e.apiType=r.apiType),await s(e)}finally{m(!1)}}},j=async()=>{y(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:r.baseUrl,apiKey:p,type:o?"anthropic-compatible":"openai-compatible",modelId:u.trim()||void 0})}),t=await e.json();b(t.valid?"success":"failed")}catch{b("failed")}finally{y(!1)}};return t?(0,a.jsx)(d.aF,{isOpen:e,title:`Edit ${o?"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:r.name,onChange:e=>n({...r,name:e.target.value}),placeholder:`${o?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,a.jsx)(d.pd,{label:"Prefix",value:r.prefix,onChange:e=>n({...r,prefix:e.target.value}),placeholder:o?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!o&&(0,a.jsx)(d.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:r.apiType,onChange:e=>n({...r,apiType:e.target.value})}),(0,a.jsx)(d.pd,{label:"Base URL",value:r.baseUrl,onChange:e=>n({...r,baseUrl:e.target.value}),placeholder:o?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${o?"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:p,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:!p||f||!r.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."}),g&&(0,a.jsx)(d.Ex,{variant:"success"===g?"success":"error",children:"success"===g?"Valid":"Invalid"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:v,fullWidth:!0,disabled:!r.name.trim()||!r.prefix.trim()||!r.baseUrl.trim()||c,children:c?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function T({isOpen:e,providerAlias:t,providerDisplayAlias:s,onSave:l,onClose:o}){let[r,n]=(0,i.useState)(""),[c,m]=(0,i.useState)(null),[p,x]=(0,i.useState)(""),[u,h]=(0,i.useState)(!1);(0,i.useEffect)(()=>{e&&(n(""),m(null),x(""))},[e]);let f=e=>{let s=`${t}/`;return e.startsWith(s)?e.slice(s.length):e},y=async()=>{let e=f(r.trim());if(e){m("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();m(a.ok?"ok":"error"),x(a.error||"")}catch(e){m("error"),x(e.message)}}},g=async()=>{let e=f(r.trim());if(e&&!u){h(!0);try{await l(e)}finally{h(!1)}}};return(0,a.jsx)(d.aF,{isOpen:e,onClose:o,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:r,onChange:e=>{n(e.target.value),m(null),x("")},onKeyDown:e=>{"Enter"===e.key&&y()},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:y,disabled:!r.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(r.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:p||"Model not reachable"})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,a.jsx)(d.$n,{onClick:o,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,a.jsx)(d.$n,{onClick:g,fullWidth:!0,size:"sm",disabled:!r.trim()||u,children:u?"Adding...":"Add Model"})]})]})})}A.propTypes={isOpen:b().bool.isRequired,provider:b().string,providerName:b().string,isCompatible:b().bool,isAnthropic:b().bool,authType:b().string,authHint:b().string,website:b().string,proxyPools:b().arrayOf(b().shape({id:b().string,name:b().string})),error:b().string,onSave:b().func.isRequired,onBulkDone:b().func,onClose:b().func.isRequired},$.propTypes={isOpen:b().bool.isRequired,node:b().shape({id:b().string,name:b().string,prefix:b().string,apiType:b().string,baseUrl:b().string}),onSave:b().func.isRequired,onClose:b().func.isRequired,isAnthropic:b().bool},T.propTypes={isOpen:b().bool.isRequired,providerAlias:b().string.isRequired,providerDisplayAlias:b().string.isRequired,onSave:b().func.isRequired,onClose:b().func.isRequired};let O=`[
3
+ sk-key-only-auto-named`;function A({isOpen:e,provider:t,providerName:s,isCompatible:l,isAnthropic:o,authType:r,authHint:n,website:m,proxyPools:p,error:x,onSave:u,onBulkDone:h,onClose:f}){let y="__none__",g="ollama-local"===t,b="cookie"===r,v="xai"===t&&!b,j=b?"Cookie Value":"API Key",w="azure"===t,N="cloudflare-ai"===t,k=c.Q2?.[t]?.regions||null,C=c.Q2?.[t]?.defaultRegion||k?.[0]?.id||"",[$,T]=(0,i.useState)({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:y,ollamaHostUrl:""}),[O,P]=(0,i.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[E,I]=(0,i.useState)({accountId:""}),[R,D]=(0,i.useState)(C),[U,_]=(0,i.useState)(!1),[q,z]=(0,i.useState)(null),[M,K]=(0,i.useState)(!1),[F,J]=(0,i.useState)("single"),[L,W]=(0,i.useState)(""),[B,G]=(0,i.useState)(null),H=()=>g&&$.ollamaHostUrl.trim()?{baseUrl:$.ollamaHostUrl.trim()}:w?{azureEndpoint:O.azureEndpoint,apiVersion:O.apiVersion,deployment:O.deployment,organization:O.organization}:N?{accountId:E.accountId}:k&&R?{region:R}:void 0,V=async()=>{_(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:$.apiKey,providerSpecificData:H()})}),s=await e.json();z(s.valid?"success":"failed")}catch{z("failed")}finally{_(!1)}},Q=async()=>{if(t&&(g||$.apiKey)&&(g||$.name)&&(!l||$.defaultModel.trim())){K(!0);try{let e=!1;try{_(!0),z(null);let s=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:$.apiKey,providerSpecificData:H()})});e=!!(await s.json()).valid,z(e?"success":"failed")}catch{z("failed")}finally{_(!1)}await u({name:$.name||(g?"Ollama Local":""),apiKey:$.apiKey,defaultModel:l?$.defaultModel.trim():void 0,priority:$.priority,proxyPoolId:$.proxyPoolId===y?null:$.proxyPoolId,testStatus:e?"active":"unknown",providerSpecificData:H()})}finally{K(!1)}}},Z=async()=>{let e=L.split("\n").map(e=>e.trim()).filter(Boolean);if(!e.length)return;K(!0),G(null);let s=0,a=0;for(let i=0;i<e.length;i++){let l=e[i].split("|"),o=l.length>=2?l.slice(1).join("|").trim():l[0].trim(),r=l.length>=2?l[0].trim():"Key",n=`${r} ${i+1}`;try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:o,name:n,priority:1,testStatus:"unknown"})})).ok?s++:a++}catch{a++}}K(!1),G({success:s,failed:a}),s>0&&h&&h()};return t?(0,a.jsx)(d.aF,{isOpen:e,title:`Add ${s||t} ${j}`,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"===F?"primary":"ghost",onClick:()=>{J("single"),G(null)},children:"Single"}),(0,a.jsx)(d.$n,{size:"sm",variant:"bulk"===F?"primary":"ghost",onClick:()=>{J("bulk"),G(null)},children:"Bulk Add"})]}),"bulk"===F&&(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:S,value:L,onChange:e=>W(e.target.value)}),B&&(0,a.jsxs)("div",{className:`text-sm font-medium ${B.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",B.success," added",B.failed>0?`, ✗ ${B.failed} failed`:""]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:Z,fullWidth:!0,disabled:M||!L.trim(),children:M?"Adding...":"Add All Keys"}),(0,a.jsx)(d.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"single"===F&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.pd,{label:"Name",value:$.name,onChange:e=>T({...$,name:e.target.value}),placeholder:g?"Ollama Local":"Production Key"}),g&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:"Ollama Host URL",value:$.ollamaHostUrl,onChange:e=>T({...$,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:V,disabled:U||M,variant:"secondary",children:U?"Checking...":"Check"})})]}),!g&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:j,type:b?"text":"password",value:$.apiKey,onChange:e=>T({...$,apiKey:e.target.value}),placeholder:b?"grok-web"===t?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":v?"xai-...":"",className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:V,disabled:!$.apiKey||U||M,variant:"secondary",children:U?"Checking...":"Check"})})]}),v&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Use a direct xAI API key from console.x.ai. This is separate from Grok Build OAuth."}),b&&n&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[n,m&&(0,a.jsxs)(a.Fragment,{children:[" ",(0,a.jsxs)("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",m.replace(/^https?:\/\//,"")]})]})]}),k&&(0,a.jsx)(d.l6,{label:"Region",value:R,onChange:e=>D(e.target.value),options:k.map(e=>({value:e.id,label:e.label}))}),l&&(0,a.jsx)(d.pd,{label:"Default Model",value:$.defaultModel,onChange:e=>T({...$,defaultModel:e.target.value}),placeholder:o?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),g&&(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"}),")."]}),q&&(0,a.jsx)(d.Ex,{variant:"success"===q?"success":"error",children:"success"===q?"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."}),N&&(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:E.accountId,onChange:e=>I({...E,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"})]})]}),w&&(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:O.azureEndpoint,onChange:e=>P({...O,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,a.jsx)(d.pd,{label:"Deployment Name",value:O.deployment,onChange:e=>P({...O,deployment:e.target.value}),placeholder:"gpt-4"}),(0,a.jsx)(d.pd,{label:"API Version",value:O.apiVersion,onChange:e=>P({...O,apiVersion:e.target.value}),placeholder:"2024-10-01-preview"}),(0,a.jsx)(d.pd,{label:"Organization",value:O.organization,onChange:e=>P({...O,organization:e.target.value}),placeholder:"Organization ID"})]})]}),(0,a.jsx)(d.pd,{label:"Priority",type:"number",value:$.priority,onChange:e=>T({...$,priority:Number.parseInt(e.target.value)||1})}),(0,a.jsx)(d.l6,{label:"Proxy Pool",value:$.proxyPoolId,onChange:e=>T({...$,proxyPoolId:e.target.value}),options:[{value:y,label:"None"},...(p||[]).map(e=>({value:e.id,label:e.name}))],placeholder:"None"}),0===(p||[]).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:Q,fullWidth:!0,disabled:M||!g&&(!$.name||!$.apiKey)||l&&!$.defaultModel.trim()||w&&(!O.azureEndpoint||!O.deployment||!O.organization)||N&&!E.accountId,children:M?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function $({isOpen:e,node:t,onSave:s,onClose:l,isAnthropic:o}){let[r,n]=(0,i.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[c,m]=(0,i.useState)(!1),[p,x]=(0,i.useState)(""),[u,h]=(0,i.useState)(""),[f,y]=(0,i.useState)(!1),[g,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{t&&n({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(o?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,o]);let v=async()=>{if(r.name.trim()&&r.prefix.trim()&&r.baseUrl.trim()){m(!0);try{let e={name:r.name,prefix:r.prefix,baseUrl:r.baseUrl};o||(e.apiType=r.apiType),await s(e)}finally{m(!1)}}},j=async()=>{y(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:r.baseUrl,apiKey:p,type:o?"anthropic-compatible":"openai-compatible",modelId:u.trim()||void 0})}),t=await e.json();b(t.valid?"success":"failed")}catch{b("failed")}finally{y(!1)}};return t?(0,a.jsx)(d.aF,{isOpen:e,title:`Edit ${o?"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:r.name,onChange:e=>n({...r,name:e.target.value}),placeholder:`${o?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,a.jsx)(d.pd,{label:"Prefix",value:r.prefix,onChange:e=>n({...r,prefix:e.target.value}),placeholder:o?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!o&&(0,a.jsx)(d.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:r.apiType,onChange:e=>n({...r,apiType:e.target.value})}),(0,a.jsx)(d.pd,{label:"Base URL",value:r.baseUrl,onChange:e=>n({...r,baseUrl:e.target.value}),placeholder:o?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${o?"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:p,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:!p||f||!r.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."}),g&&(0,a.jsx)(d.Ex,{variant:"success"===g?"success":"error",children:"success"===g?"Valid":"Invalid"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:v,fullWidth:!0,disabled:!r.name.trim()||!r.prefix.trim()||!r.baseUrl.trim()||c,children:c?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function T({isOpen:e,providerAlias:t,providerDisplayAlias:s,onSave:l,onClose:o}){let[r,n]=(0,i.useState)(""),[c,m]=(0,i.useState)(null),[p,x]=(0,i.useState)(""),[u,h]=(0,i.useState)(!1);(0,i.useEffect)(()=>{e&&(n(""),m(null),x(""))},[e]);let f=e=>{let s=`${t}/`;return e.startsWith(s)?e.slice(s.length):e},y=async()=>{let e=f(r.trim());if(e){m("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();m(a.ok?"ok":"error"),x(a.error||"")}catch(e){m("error"),x(e.message)}}},g=async()=>{let e=f(r.trim());if(e&&!u){h(!0);try{await l(e)}finally{h(!1)}}};return(0,a.jsx)(d.aF,{isOpen:e,onClose:o,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:r,onChange:e=>{n(e.target.value),m(null),x("")},onKeyDown:e=>{"Enter"===e.key&&y()},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:y,disabled:!r.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(r.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:p||"Model not reachable"})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,a.jsx)(d.$n,{onClick:o,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,a.jsx)(d.$n,{onClick:g,fullWidth:!0,size:"sm",disabled:!r.trim()||u,children:u?"Adding...":"Add Model"})]})]})})}A.propTypes={isOpen:b().bool.isRequired,provider:b().string,providerName:b().string,isCompatible:b().bool,isAnthropic:b().bool,authType:b().string,authHint:b().string,website:b().string,proxyPools:b().arrayOf(b().shape({id:b().string,name:b().string})),error:b().string,onSave:b().func.isRequired,onBulkDone:b().func,onClose:b().func.isRequired},$.propTypes={isOpen:b().bool.isRequired,node:b().shape({id:b().string,name:b().string,prefix:b().string,apiType:b().string,baseUrl:b().string}),onSave:b().func.isRequired,onClose:b().func.isRequired,isAnthropic:b().bool},T.propTypes={isOpen:b().bool.isRequired,providerAlias:b().string.isRequired,providerDisplayAlias:b().string.isRequired,onSave:b().func.isRequired,onClose:b().func.isRequired};let O=`[
4
4
  {
5
5
  "accessToken": "eyJhbGc...",
6
6
  "refreshToken": "rt_...",
7
7
  "idToken": "eyJhbGc...",
8
8
  "email": "user@example.com"
9
9
  }
10
- ]`;function P({isOpen:e,onClose:t,onSuccess:s}){let[l,o]=(0,i.useState)(""),[r,n]=(0,i.useState)(!1),[c,m]=(0,i.useState)(""),[p,x]=(0,i.useState)(null),h=()=>{r||(o(""),m(""),x(null),t())},f=async()=>{var e;let t;m(""),x(null);let a=l.trim();if(!a)return;try{t=JSON.parse(a)}catch(e){m(`${(0,u.Tl)("Invalid JSON")}: ${e.message}`);return}let i=Array.isArray(e=t)?e:e&&"object"==typeof e?Array.isArray(e.accounts)?e.accounts:[e]:null;if(!i||0===i.length)return void m((0,u.Tl)("No accounts found in input"));n(!0);try{let e=await fetch("/api/oauth/codex/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:i})}),t=await e.json();if(!e.ok)return void m(t?.error||`Request failed: ${e.status}`);x(t),t.success>0&&"function"==typeof s&&s()}catch(e){m(e.message||(0,u.Tl)("Request failed"))}finally{n(!1)}},y=p?.results?.filter(e=>!e.ok)||[];return(0,a.jsx)(d.aF,{isOpen:e,title:(0,u.Tl)("Bulk Add Codex Accounts"),onClose:h,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:(0,u.Tl)("Paste an array of codex account JSON objects. Each must include accessToken (and ideally refreshToken, idToken).")}),(0,a.jsx)("textarea",{className:"w-full rounded border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[240px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:O,value:l,onChange:e=>o(e.target.value),disabled:r}),c&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:c}),p&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:`text-sm font-medium ${p.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",p.success," ",(0,u.Tl)("added"),p.failed>0?`, ✗ ${p.failed} ${(0,u.Tl)("failed")}`:""]}),y.length>0&&(0,a.jsx)("ul",{className:"rounded border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:y.map(e=>(0,a.jsxs)("li",{className:"text-red-400",children:["[",e.index,"] ",e.error]},e.index))})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:f,fullWidth:!0,disabled:r||!l.trim(),children:r?(0,u.Tl)("Importing..."):(0,u.Tl)("Import All")}),(0,a.jsx)(d.$n,{onClick:h,variant:"ghost",fullWidth:!0,disabled:r,children:(0,u.Tl)("Close")})]})]})})}function E(){let e,t=(0,l.useParams)(),s=(0,l.useRouter)(),o=t.id,{getCaps:h}=(0,x.y)(),[g,b]=(0,i.useState)([]),[j,N]=(0,i.useState)(!0),[k,S]=(0,i.useState)(null),[O,E]=(0,i.useState)([]),[I,R]=(0,i.useState)(!1),[D,U]=(0,i.useState)(!1),[_,q]=(0,i.useState)(!1),[z,M]=(0,i.useState)(""),[F,K]=(0,i.useState)(!1),[L,J]=(0,i.useState)(!1),[W,B]=(0,i.useState)(!1),[G,H]=(0,i.useState)(!1),[V,Q]=(0,i.useState)(null),[Z,X]=(0,i.useState)({}),[Y,ee]=(0,i.useState)([]),[et,es]=(0,i.useState)(!1),[ea,ei]=(0,i.useState)({}),[el,eo]=(0,i.useState)(""),[er,en]=(0,i.useState)(()=>new Set),[ed,ec]=(0,i.useState)(!1),[em,ep]=(0,i.useState)([]),[ex,eu]=(0,i.useState)("__none__"),[eh,ef]=(0,i.useState)(!1),[ey,eg]=(0,i.useState)(null),[eb,ev]=(0,i.useState)(""),[ej,ew]=(0,i.useState)("auto"),[eN,ek]=(0,i.useState)({enabled:!1,connections:{}}),[eC,eS]=(0,i.useState)([]),[eA,e$]=(0,i.useState)([]),[eT,eO]=(0,i.useState)([]),[eP,eE]=(0,i.useState)(null),[eI,eR]=(0,i.useState)(!1),[eD,eU]=(0,i.useState)(!1),[e_,eq]=(0,i.useState)(!1),[ez,eM]=(0,i.useState)(null),[eF,eK]=(0,i.useState)({}),[eL,eJ]=(0,i.useState)(null),eW=(0,i.useRef)(!1),[eB,eG]=(0,i.useState)(!1),{copied:eH,copy:eV}=(0,p.C)(),eQ="ag_risk_confirmed",eZ=()=>{R(!0)},eX=()=>{"antigravity"===o&&"true"!==window.localStorage.getItem(eQ)?eR(!0):e5?eZ():(M(""),q(!0))},eY=()=>{M(""),q(!0)},e0=()=>{e5?eX():eY()},e1=k?{id:k.id,name:k.name||("anthropic-compatible"===k.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===k.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===k.type?"AC":"OC",apiType:k.apiType,baseUrl:k.baseUrl,type:k.type}:c.zN[o]||c.fg[o]||c.IS[o]||c.nJ[o]||c.br[o],e2=e1?.authModes||[],e5=!!c.zN[o]||!!c.IS[o]||e2.includes("oauth"),e3=!!c.fg[o]||e2.includes("apikey"),e4=!!c.IS[o]?.noAuth,e6=(0,m.KC)(o),e7=(0,c.wG)(o),e8=(0,c.mq)(o),e9=(0,c.gb)(o),te=e8||e9,tt=!te&&e5&&e3,ts="xai"===o?"Grok Build OAuth":"OAuth",ta="xai"===o?"xAI API Key":"API Key";c.Q2[o]?.thinkingConfig||c.s9.extended;let ti=te?o:e7,tl=te?k?.prefix||o:e7,to=(0,i.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(ti)}`,{cache:"no-store"}),t=await e.json();e.ok&&eO(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[ti]),tr=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:ti,ids:[e]})})).ok&&await to()}catch(e){console.log("Error disabling model:",e)}},tn=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(ti)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await to()}catch(e){console.log("Error enabling model:",e)}},td=async e=>{e.length&&eE({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{eE(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:ti,ids:e})})).ok&&await to()}catch(e){console.log("Error disabling all models:",e)}}})},tc=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(ti)}`,{method:"DELETE"})).ok&&await to()}catch(e){console.log("Error enabling all models:",e)}},tm=(0,i.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&X(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),tp=(0,i.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&ee(t.models||[])}catch(e){console.log("Error fetching custom models:",e)}},[]);(0,i.useEffect)(()=>{"kilocode"===o&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&e$(e.models)}).catch(()=>{})},[o]);let tx=(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(),r=await s.json(),n=a.ok?await a.json():{};if(e.ok){let e=(i.connections||[]).filter(e=>e.provider===o);b(e)}s.ok&&E(r.proxyPools||[]);let d=(n.providerStrategies||{})[o]||{};eg(d.fallbackStrategy||null),ev(null!=d.stickyRoundRobinLimit?String(d.stickyRoundRobinLimit):"1");let c=(n.providerThinking||{})[o]||{};ew(c.mode||"auto");let m=n.claudeAutoPing||{};if(ek({enabled:!0===m.enabled,connections:m.connections||{}}),t.ok){let e=(l.nodes||[]).find(e=>e.id===o)||null;if(!e&&te)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===o)||null))break}S(e)}}catch(e){console.log("Error fetching connections:",e)}finally{N(!1)}},[o,te]),tu=async e=>{try{let t=await fetch(`/api/provider-nodes/${o}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(S(s.node),await tx(),B(!1))}catch(e){console.log("Error updating provider node:",e)}},th=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[o]:l[o]=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)}},tf=async e=>{ek(e);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({claudeAutoPing:e})})}catch(e){console.log("Error saving auto-ping config:",e)}};(0,i.useEffect)(()=>{tx(),tm(),tp(),to()},[tx,tm,tp,to]),(0,i.useEffect)(()=>{let e=(c.zN[o]||c.fg[o]||c.IS[o]||c.nJ[o])?.modelsFetcher;e&&f(e).then(eS)},[o]);let ty=async(e,t,s=e7)=>{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 tm();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},tg=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tm()}catch(e){console.log("Error deleting alias:",e)}},tb=async(e,t="llm",s=ti)=>{try{let a=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:s,id:e,type:t})});if(a.ok)await tp(),window.dispatchEvent(new CustomEvent("customModelChanged"));else{let e=await a.json();alert(e.error||"Failed to add custom model")}}catch(e){console.log("Error adding custom model:",e)}},tv=async(e,t="llm",s=ti)=>{try{let a=new URLSearchParams({providerAlias:s,id:e,type:t});(await fetch(`/api/models/custom?${a}`,{method:"DELETE"})).ok&&(await tp(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("Error deleting custom model:",e)}},tj=async()=>{if(eB)return;let e=g.find(e=>!1!==e.isActive);if(!e)return void alert((0,u.Tl)("Please add an active Qoder connection first"));eG(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,u.Tl)("Failed to fetch models"));let a=s.models||[];if(0===a.length)return void alert((0,u.Tl)("No models returned"));let i=0;for(let e of a){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^qoder\//,"");Y.some(e=>e.providerAlias===ti&&e.id===s&&"llm"===(e.kind||e.type||"llm"))||Object.values(Z).includes(`${ti}/${s}`)||(await tb(s,"llm",ti),i+=1)}0===i?alert((0,u.Tl)("All models already exist, no new models added")):alert((0,u.Tl)("Successfully added")+` ${i} `+(0,u.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,u.Tl)("Error fetching models")+": "+e.message)}finally{eG(!1)}},tw=async()=>{if(eD||0===g.length)return;let e=Object.fromEntries(g.map(e=>[e.id,{state:"queued",error:null}]));eW.current=!1,eU(!0),eq(!1),eM(null),eK(e),eJ({total:g.length,completed:0,passed:0,failed:0,stopped:!1});let t=0,s=0;try{for(let e=0;e<g.length;e+=1){if(eW.current){eJ({total:g.length,completed:e,passed:t,failed:s,stopped:!0});break}let a=g[e];eM(a.id),eK(e=>({...e,[a.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${a.id}/test`,{method:"POST"}),i=await e.json(),l=!!i.valid;l?t+=1:s+=1,eK(e=>({...e,[a.id]:{state:l?"success":"failed",error:l?null:i.error||null}}))}catch(e){s+=1,eK(t=>({...t,[a.id]:{state:"failed",error:e.message||"Test failed"}}))}eJ({total:g.length,completed:e+1,passed:t,failed:s,stopped:!1}),e<g.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{eM(null),eU(!1),eq(!1),eW.current=!1}},tN=async e=>{eE({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{eE(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&b(g.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},tk=()=>{tx(),R(!1)},tC=async e=>{M("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:o,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await tx(),q(!1);return}M(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),M("Failed to save connection")}},tS=async e=>{try{(await fetch(`/api/providers/${V.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await tx(),J(!1))}catch(e){console.log("Error updating connection:",e)}},tA=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&b(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},t$=async(e,t)=>{let s=[...g];[s[e],s[t]]=[s[t],s[e]],b(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 tx()}},tT=g.filter(e=>em.includes(e.id));g.length>0&&(em.length,g.length),(0,i.useEffect)(()=>{ep(e=>e.filter(e=>g.some(t=>t.id===e)))},[g]),(()=>{if(0===tT.length)return;let e=new Set(tT.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return;let s=O.find(e=>e.id===t);return s?.name}})();let tO=()=>{eh||H(!1)},tP=async e=>{ef(!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 tx(),H(!1)}finally{ef(!1)}},tE=e=>tP(g.map(t=>({connectionId:t.id,proxyPoolId:e}))),tI=(0,a.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:g.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)(C,{connection:e,proxyPools:O,isOAuth:e5,isFirst:0===t,isLast:t===g.length-1,onMoveUp:()=>t$(t,t-1),onMoveDown:()=>t$(t,t+1),onToggleActive:t=>tA(e.id,t),autoPing:"claude"===o&&"oauth"===e.authType?{on:!0===eN.connections[e.id],onToggle:t=>{var s;return s=e.id,void tf({...eN,connections:{...eN.connections,[s]:t}})}}:null,onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&b(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:()=>{Q(e),J(!0)},onDelete:()=>tN(e.id),oneByOneStatus:eF[e.id]||null})})},e.id))}),tR=O.filter(e=>!0===e.isActive),tD=(0,a.jsx)(d.aF,{isOpen:G,onClose:tO,title:`Apply Proxy (${g.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=O.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):tP(g.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:eh||0===tR.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:()=>tE(null),disabled:eh,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)"})]}),O.map(e=>(0,a.jsxs)("button",{onClick:()=>tE(e.id),disabled:eh||!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))]}),eh&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,a.jsx)(d.$n,{onClick:tO,variant:"ghost",fullWidth:!0,disabled:eh,children:"Cancel"})]})}),tU=async e=>{if(!er.has(e)){en(t=>new Set(t).add(e));try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${ti}/${e}`})}),s=await t.json();ei(t=>({...t,[e]:s.ok?"ok":"error"})),eo(s.ok?"":s.error||"Model not reachable")}catch{ei(t=>({...t,[e]:"error"})),eo("Network error")}finally{en(t=>{let s=new Set(t);return s.delete(e),s})}}};return j?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(d.Qv,{}),(0,a.jsx)(d.Qv,{})]}):e1?(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)(r(),{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:`${e1.color}15`},children:et?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:e1.color},children:e1.textIcon||e1.id.slice(0,2).toUpperCase()}):(0,a.jsx)(n.default,{src:e8&&e1.apiType?"responses"===e1.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":e9?"/providers/anthropic-m.png":`/providers/${e1.id}.png`,alt:e1.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>es(!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:e1.name}),(e1.notice?.apiKeyUrl||e1.notice?.signupUrl||e1.website)&&(0,a.jsxs)("a",{href:e1.notice?.apiKeyUrl||e1.notice?.signupUrl||e1.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"}),e1.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:[g.length," connection",1===g.length?"":"s"]})]})]})]}),e1.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:e1.deprecationNotice})]}),e1.notice?.text&&!e1.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:e1.notice.text}),e1.notice.apiKeyUrl&&(0,a.jsx)("a",{href:e1.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 →"})]}),te&&k&&(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:e9?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,a.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[e9?"Messages API":"responses"===k.apiType?"Responses API":"Chat Completions"," \xb7 ",(k.baseUrl||"").replace(/\/$/,""),"/",e9?"messages":"responses"===k.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:()=>{M(""),q(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>B(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{eE({title:"Delete Compatible Node",message:`Delete this ${e9?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{eE(null);try{(await fetch(`/api/provider-nodes/${o}`,{method:"DELETE"})).ok&&s.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),e4?(0,a.jsx)(d.gw,{providerId:o}):(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:[g.length>0&&O.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>H(!0),children:"Apply Proxy"}),g.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:tw,disabled:eD,children:eD?"Testing Connection One-by-One...":"Test Connection One-by-One"}),eD&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{eD&&(eW.current=!0,eq(!0))},disabled:e_,children:e_?"Stopping...":"Stop"})]}),(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"===ey,onChange:e=>{let t=e?"round-robin":null,s=e?eb||"1":eb;e&&!eb&&ev("1"),eg(t),th(t,s)}}),"round-robin"===ey&&(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:eb,onChange:e=>{var t;ev(t=e.target.value),th("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===g.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:e5?"lock":"key"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),tt&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",ts," or ",ta,"."]})]})]}),(0,a.jsx)("div",{className:"flex gap-2",children:tt?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:eX,children:ts}),(0,a.jsx)(d.$n,{size:"sm",icon:"key",onClick:eY,children:ta})]}):(0,a.jsxs)(a.Fragment,{children:[!te&&"iflow"===o&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>U(!0),children:"Cookie"}),"codex"===o&&(0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>K(!0),children:(0,u.Tl)("Bulk Add")}),"merlin"===o&&(0,a.jsx)(d.$n,{size:"sm",icon:"login",variant:"secondary",onClick:()=>{if(0===g.length){notify.info("Add a connection first, then click Login with Google"),e0();return}window.open(`/api/providers/merlin/auth/google?connectionId=${g[0].id}`,"_blank")},children:"Login with Google"}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:e0,children:te?"Add API Key":"iflow"===o?"OAuth":"Add Connection"})]})})]}):(0,a.jsxs)(a.Fragment,{children:[eL&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsxs)("span",{children:["Total: ",eL.total]}),(0,a.jsxs)("span",{children:["Completed: ",eL.completed]}),(0,a.jsxs)("span",{children:["Passed: ",eL.passed]}),(0,a.jsxs)("span",{children:["Failed: ",eL.failed]}),eL.stopped&&(0,a.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),eD&&ez&&(0,a.jsxs)("span",{children:["Running: ",g.find(e=>e.id===ez)?.name||ez]})]})}),tI,!te&&(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===o&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>U(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codex"===o&&(0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>K(!0),title:(0,u.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,u.Tl)("Bulk Add")}),tt?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:eX,className:"w-full sm:w-auto",children:ts}),(0,a.jsx)(d.$n,{size:"sm",icon:"key",onClick:eY,className:"w-full sm:w-auto",children:ta})]}):(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:e0,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"}),!te&&(e=[...e6,...eA.filter(e=>!e6.some(t=>t.id===e.id))].filter(e=>{let t=(0,m.CP)(e);return!t||"llm"===t}).map(e=>e.id).filter(e=>!eT.includes(e)),(0,a.jsxs)("div",{className:"flex gap-2",children:[eT.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:tc,children:"Active All"}),e.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>td(e),children:"Disable All"})]}))]}),!!el&&(0,a.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:el}),(()=>{let e,t,s;if(te)return(0,a.jsx)(w,{providerStorageAlias:ti,providerDisplayAlias:tl,modelAliases:Z,customModels:Y,copied:eH,onCopy:eV,onSetAlias:ty,onDeleteAlias:tg,onAddCustomModel:e=>tb(e,"llm",ti),onDeleteCustomModel:e=>tv(e,"llm",ti),connections:g,isAnthropic:e9});let i=[...e6,...eA.filter(e=>!e6.some(t=>t.id===e.id))].filter(e=>{let t=(0,m.CP)(e);return!t||"llm"===t}),l=new Set(eT),r=i.filter(e=>!l.has(e.id)),n=i.filter(e=>l.has(e.id)),d=y({customModels:Y,modelAliases:Z,providerAlias:ti,builtInModels:e6,type:"llm"});return(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[d.map(e=>(0,a.jsx)(v,{model:{id:e.id,name:e.name},fullModel:`${tl}/${e.id}`,alias:e.alias,copied:eH,onCopy:eV,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===e.source?tv(e.id,"llm",ti):tg(e.alias)},testStatus:ea[e.id],onTest:g.length>0||e4?()=>tU(e.id):void 0,isTesting:er.has(e.id),isCustom:!0,isFree:!1,caps:h(`${o}/${e.id}`)},`${e.source}-${e.fullModel}`)),r.map(e=>{let t=`${ti}/${e.id}`,s=`${o}/${e.id}`,i=Object.entries(Z).find(([,e])=>e===t||e===s)?.[0];return(0,a.jsx)(v,{model:e,fullModel:`${tl}/${e.id}`,alias:i,copied:eH,onCopy:eV,onSetAlias:t=>ty(e.id,t,ti),onDeleteAlias:()=>tg(i),testStatus:ea[e.id],onTest:g.length>0||e4?()=>tU(e.id):void 0,isTesting:er.has(e.id),isFree:e.isFree,onDisable:()=>tr(e.id),caps:h(`${o}/${e.id}`)},e.id)}),(0,a.jsxs)("button",{onClick:()=>ec(!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"]}),"qoder"===o&&g.some(e=>!1!==e.isActive)&&(0,a.jsxs)("button",{onClick:tj,disabled:eB,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-blue-500/40 px-3 py-2 text-xs text-blue-600 dark:text-blue-400 transition-colors hover:border-blue-500 hover:bg-blue-500/5 sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:eB?{animation:"spin 1s linear infinite"}:void 0,children:eB?"progress_activity":"download"}),eB?(0,u.Tl)("Fetching..."):(0,u.Tl)("Fetch Qoder Models")]}),eC.length>0&&(e=new Set([...Object.values(Z),...d.map(e=>e.fullModel)]),t=new Set(e6.map(e=>e.id)),0===(s=eC.filter(s=>!e.has(`${ti}/${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()=>{await tb(e.id,"llm",ti)},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:()=>tn(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))})]})]})})()]}),tD,"kiro"===o?(0,a.jsx)(d.Mh,{isOpen:I,providerInfo:e1,onSuccess:tk,onClose:()=>R(!1)}):"cursor"===o?(0,a.jsx)(d.G9,{isOpen:I,onSuccess:tk,onClose:()=>R(!1)}):"gitlab"===o?(0,a.jsx)(d.vj,{isOpen:I,providerInfo:e1,onSuccess:tk,onClose:()=>R(!1)}):(0,a.jsx)(d.LF,{isOpen:I,provider:o,providerInfo:e1,onSuccess:tk,onClose:()=>R(!1)}),"iflow"===o&&(0,a.jsx)(d.vE,{isOpen:D,onSuccess:()=>{tx(),U(!1)},onClose:()=>U(!1)}),(0,a.jsx)(A,{isOpen:_,provider:o,providerName:e1.name,isCompatible:te,isAnthropic:e9,authType:e1?.authType,authHint:e1?.authHint,website:e1?.website,proxyPools:O,error:z,onSave:tC,onBulkDone:tx,onClose:()=>{M(""),q(!1)}}),(0,a.jsx)(d.wI,{isOpen:L,connection:V,proxyPools:O,onSave:tS,onClose:()=>J(!1)}),te&&(0,a.jsx)($,{isOpen:W,node:k,onSave:tu,onClose:()=>B(!1),isAnthropic:e9}),!te&&(0,a.jsx)(T,{isOpen:ed,providerAlias:ti,providerDisplayAlias:tl,onSave:async e=>{await tb(e,"llm",ti),ec(!1)},onClose:()=>ec(!1)}),"codex"===o&&(0,a.jsx)(P,{isOpen:F,onClose:()=>K(!1),onSuccess:tx}),(0,a.jsx)(d.uo,{isOpen:eI,onClose:()=>eR(!1),onConfirm:()=>{(window.localStorage.setItem(eQ,"true"),eR(!1),e5)?eZ():eY()},title:"Risk Notice",message:e1?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,a.jsx)(d.uo,{isOpen:!!eP,onClose:()=>eE(null),onConfirm:eP?.onConfirm,title:eP?.title||"Confirm",message:eP?.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)(r(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}P.propTypes={isOpen:b().bool.isRequired,onClose:b().func.isRequired,onSuccess:b().func}}},e=>{e.O(0,[2574,3862,2649,5772,1321,705,5497,8441,3794,7358],()=>e(e.s=31421)),_N_E=e.O()}]);
10
+ ]`;function P({isOpen:e,onClose:t,onSuccess:s}){let[l,o]=(0,i.useState)(""),[r,n]=(0,i.useState)(!1),[c,m]=(0,i.useState)(""),[p,x]=(0,i.useState)(null),h=()=>{r||(o(""),m(""),x(null),t())},f=async()=>{var e;let t;m(""),x(null);let a=l.trim();if(!a)return;try{t=JSON.parse(a)}catch(e){m(`${(0,u.Tl)("Invalid JSON")}: ${e.message}`);return}let i=Array.isArray(e=t)?e:e&&"object"==typeof e?Array.isArray(e.accounts)?e.accounts:[e]:null;if(!i||0===i.length)return void m((0,u.Tl)("No accounts found in input"));n(!0);try{let e=await fetch("/api/oauth/codex/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:i})}),t=await e.json();if(!e.ok)return void m(t?.error||`Request failed: ${e.status}`);x(t),t.success>0&&"function"==typeof s&&s()}catch(e){m(e.message||(0,u.Tl)("Request failed"))}finally{n(!1)}},y=p?.results?.filter(e=>!e.ok)||[];return(0,a.jsx)(d.aF,{isOpen:e,title:(0,u.Tl)("Bulk Add Codex Accounts"),onClose:h,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:(0,u.Tl)("Paste an array of codex account JSON objects. Each must include accessToken (and ideally refreshToken, idToken).")}),(0,a.jsx)("textarea",{className:"w-full rounded border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[240px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:O,value:l,onChange:e=>o(e.target.value),disabled:r}),c&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:c}),p&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:`text-sm font-medium ${p.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",p.success," ",(0,u.Tl)("added"),p.failed>0?`, ✗ ${p.failed} ${(0,u.Tl)("failed")}`:""]}),y.length>0&&(0,a.jsx)("ul",{className:"rounded border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:y.map(e=>(0,a.jsxs)("li",{className:"text-red-400",children:["[",e.index,"] ",e.error]},e.index))})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:f,fullWidth:!0,disabled:r||!l.trim(),children:r?(0,u.Tl)("Importing..."):(0,u.Tl)("Import All")}),(0,a.jsx)(d.$n,{onClick:h,variant:"ghost",fullWidth:!0,disabled:r,children:(0,u.Tl)("Close")})]})]})})}function E(){let e,t=(0,l.useParams)(),s=(0,l.useRouter)(),o=t.id,{getCaps:h}=(0,x.y)(),[g,b]=(0,i.useState)([]),[j,N]=(0,i.useState)(!0),[k,S]=(0,i.useState)(null),[O,E]=(0,i.useState)([]),[I,R]=(0,i.useState)(!1),[D,U]=(0,i.useState)(!1),[_,q]=(0,i.useState)(!1),[z,M]=(0,i.useState)(""),[K,F]=(0,i.useState)(!1),[J,L]=(0,i.useState)(!1),[W,B]=(0,i.useState)(!1),[G,H]=(0,i.useState)(!1),[V,Q]=(0,i.useState)(null),[Z,X]=(0,i.useState)({}),[Y,ee]=(0,i.useState)([]),[et,es]=(0,i.useState)(!1),[ea,ei]=(0,i.useState)({}),[el,eo]=(0,i.useState)(""),[er,en]=(0,i.useState)(()=>new Set),[ed,ec]=(0,i.useState)(!1),[em,ep]=(0,i.useState)([]),[ex,eu]=(0,i.useState)("__none__"),[eh,ef]=(0,i.useState)(!1),[ey,eg]=(0,i.useState)(null),[eb,ev]=(0,i.useState)(""),[ej,ew]=(0,i.useState)("auto"),[eN,ek]=(0,i.useState)({enabled:!1,connections:{}}),[eC,eS]=(0,i.useState)([]),[eA,e$]=(0,i.useState)([]),[eT,eO]=(0,i.useState)([]),[eP,eE]=(0,i.useState)(null),[eI,eR]=(0,i.useState)(!1),[eD,eU]=(0,i.useState)(!1),[e_,eq]=(0,i.useState)(!1),[ez,eM]=(0,i.useState)(null),[eK,eF]=(0,i.useState)({}),[eJ,eL]=(0,i.useState)(null),eW=(0,i.useRef)(!1),[eB,eG]=(0,i.useState)(!1),{copied:eH,copy:eV}=(0,p.C)(),eQ="ag_risk_confirmed",eZ=()=>{R(!0)},eX=()=>{"antigravity"===o&&"true"!==window.localStorage.getItem(eQ)?eR(!0):e5?eZ():(M(""),q(!0))},eY=()=>{M(""),q(!0)},e0=()=>{e5?eX():eY()},e1=k?{id:k.id,name:k.name||("anthropic-compatible"===k.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===k.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===k.type?"AC":"OC",apiType:k.apiType,baseUrl:k.baseUrl,type:k.type}:c.zN[o]||c.fg[o]||c.IS[o]||c.nJ[o]||c.br[o],e2=e1?.authModes||[],e5=!!c.zN[o]||!!c.IS[o]||e2.includes("oauth"),e3=!!c.fg[o]||e2.includes("apikey"),e4=!!c.IS[o]?.noAuth,e6=(0,m.KC)(o),e7=(0,c.wG)(o),e8=(0,c.mq)(o),e9=(0,c.gb)(o),te=e8||e9,tt=!te&&e5&&e3,ts="xai"===o?"Grok Build OAuth":"OAuth",ta="xai"===o?"xAI API Key":"API Key";c.Q2[o]?.thinkingConfig||c.s9.extended;let ti=te?o:e7,tl=te?k?.prefix||o:e7,to=(0,i.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(ti)}`,{cache:"no-store"}),t=await e.json();e.ok&&eO(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[ti]),tr=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:ti,ids:[e]})})).ok&&await to()}catch(e){console.log("Error disabling model:",e)}},tn=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(ti)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await to()}catch(e){console.log("Error enabling model:",e)}},td=async e=>{e.length&&eE({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{eE(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:ti,ids:e})})).ok&&await to()}catch(e){console.log("Error disabling all models:",e)}}})},tc=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(ti)}`,{method:"DELETE"})).ok&&await to()}catch(e){console.log("Error enabling all models:",e)}},tm=(0,i.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&X(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),tp=(0,i.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&ee(t.models||[])}catch(e){console.log("Error fetching custom models:",e)}},[]);(0,i.useEffect)(()=>{"kilocode"===o&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&e$(e.models)}).catch(()=>{})},[o]);let tx=(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(),r=await s.json(),n=a.ok?await a.json():{};if(e.ok){let e=(i.connections||[]).filter(e=>e.provider===o);b(e)}s.ok&&E(r.proxyPools||[]);let d=(n.providerStrategies||{})[o]||{};eg(d.fallbackStrategy||null),ev(null!=d.stickyRoundRobinLimit?String(d.stickyRoundRobinLimit):"1");let c=(n.providerThinking||{})[o]||{};ew(c.mode||"auto");let m=n.claudeAutoPing||{};if(ek({enabled:!0===m.enabled,connections:m.connections||{}}),t.ok){let e=(l.nodes||[]).find(e=>e.id===o)||null;if(!e&&te)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===o)||null))break}S(e)}}catch(e){console.log("Error fetching connections:",e)}finally{N(!1)}},[o,te]),tu=async e=>{try{let t=await fetch(`/api/provider-nodes/${o}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(S(s.node),await tx(),B(!1))}catch(e){console.log("Error updating provider node:",e)}},th=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[o]:l[o]=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)}},tf=async e=>{ek(e);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({claudeAutoPing:e})})}catch(e){console.log("Error saving auto-ping config:",e)}};(0,i.useEffect)(()=>{tx(),tm(),tp(),to()},[tx,tm,tp,to]),(0,i.useEffect)(()=>{let e=(c.zN[o]||c.fg[o]||c.IS[o]||c.nJ[o])?.modelsFetcher;e&&f(e).then(eS)},[o]);let ty=async(e,t,s=e7)=>{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 tm();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},tg=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tm()}catch(e){console.log("Error deleting alias:",e)}},tb=async(e,t="llm",s=ti)=>{try{let a=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:s,id:e,type:t})});if(a.ok)await tp(),window.dispatchEvent(new CustomEvent("customModelChanged"));else{let e=await a.json();alert(e.error||"Failed to add custom model")}}catch(e){console.log("Error adding custom model:",e)}},tv=async(e,t="llm",s=ti)=>{try{let a=new URLSearchParams({providerAlias:s,id:e,type:t});(await fetch(`/api/models/custom?${a}`,{method:"DELETE"})).ok&&(await tp(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("Error deleting custom model:",e)}},tj=async()=>{if(eB)return;let e=g.find(e=>!1!==e.isActive);if(!e)return void alert((0,u.Tl)("Please add an active Qoder connection first"));eG(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,u.Tl)("Failed to fetch models"));let a=s.models||[];if(0===a.length)return void alert((0,u.Tl)("No models returned"));let i=0;for(let e of a){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^qoder\//,"");Y.some(e=>e.providerAlias===ti&&e.id===s&&"llm"===(e.kind||e.type||"llm"))||Object.values(Z).includes(`${ti}/${s}`)||(await tb(s,"llm",ti),i+=1)}0===i?alert((0,u.Tl)("All models already exist, no new models added")):alert((0,u.Tl)("Successfully added")+` ${i} `+(0,u.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,u.Tl)("Error fetching models")+": "+e.message)}finally{eG(!1)}},tw=async()=>{if(eD||0===g.length)return;let e=Object.fromEntries(g.map(e=>[e.id,{state:"queued",error:null}]));eW.current=!1,eU(!0),eq(!1),eM(null),eF(e),eL({total:g.length,completed:0,passed:0,failed:0,stopped:!1});let t=0,s=0;try{for(let e=0;e<g.length;e+=1){if(eW.current){eL({total:g.length,completed:e,passed:t,failed:s,stopped:!0});break}let a=g[e];eM(a.id),eF(e=>({...e,[a.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${a.id}/test`,{method:"POST"}),i=await e.json(),l=!!i.valid;l?t+=1:s+=1,eF(e=>({...e,[a.id]:{state:l?"success":"failed",error:l?null:i.error||null}}))}catch(e){s+=1,eF(t=>({...t,[a.id]:{state:"failed",error:e.message||"Test failed"}}))}eL({total:g.length,completed:e+1,passed:t,failed:s,stopped:!1}),e<g.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{eM(null),eU(!1),eq(!1),eW.current=!1}},tN=async e=>{eE({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{eE(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&b(g.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},tk=()=>{tx(),R(!1)},tC=async e=>{M("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:o,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await tx(),q(!1);return}M(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),M("Failed to save connection")}},tS=async e=>{try{(await fetch(`/api/providers/${V.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await tx(),L(!1))}catch(e){console.log("Error updating connection:",e)}},tA=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&b(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},t$=async(e,t)=>{let s=[...g];[s[e],s[t]]=[s[t],s[e]],b(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 tx()}},tT=g.filter(e=>em.includes(e.id));g.length>0&&(em.length,g.length),(0,i.useEffect)(()=>{ep(e=>e.filter(e=>g.some(t=>t.id===e)))},[g]),(()=>{if(0===tT.length)return;let e=new Set(tT.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return;let s=O.find(e=>e.id===t);return s?.name}})();let tO=()=>{eh||H(!1)},tP=async e=>{ef(!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 tx(),H(!1)}finally{ef(!1)}},tE=e=>tP(g.map(t=>({connectionId:t.id,proxyPoolId:e}))),tI=(0,a.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:g.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)(C,{connection:e,proxyPools:O,isOAuth:e5,isFirst:0===t,isLast:t===g.length-1,onMoveUp:()=>t$(t,t-1),onMoveDown:()=>t$(t,t+1),onToggleActive:t=>tA(e.id,t),autoPing:"claude"===o&&"oauth"===e.authType?{on:!0===eN.connections[e.id],onToggle:t=>{var s;return s=e.id,void tf({...eN,connections:{...eN.connections,[s]:t}})}}:null,onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&b(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:()=>{Q(e),L(!0)},onDelete:()=>tN(e.id),oneByOneStatus:eK[e.id]||null})})},e.id))}),tR=O.filter(e=>!0===e.isActive),tD=(0,a.jsx)(d.aF,{isOpen:G,onClose:tO,title:`Apply Proxy (${g.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=O.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):tP(g.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:eh||0===tR.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:()=>tE(null),disabled:eh,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)"})]}),O.map(e=>(0,a.jsxs)("button",{onClick:()=>tE(e.id),disabled:eh||!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))]}),eh&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,a.jsx)(d.$n,{onClick:tO,variant:"ghost",fullWidth:!0,disabled:eh,children:"Cancel"})]})}),tU=async e=>{if(!er.has(e)){en(t=>new Set(t).add(e));try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${ti}/${e}`})}),s=await t.json();ei(t=>({...t,[e]:s.ok?"ok":"error"})),eo(s.ok?"":s.error||"Model not reachable")}catch{ei(t=>({...t,[e]:"error"})),eo("Network error")}finally{en(t=>{let s=new Set(t);return s.delete(e),s})}}};return j?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(d.Qv,{}),(0,a.jsx)(d.Qv,{})]}):e1?(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)(r(),{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:`${e1.color}15`},children:et?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:e1.color},children:e1.textIcon||e1.id.slice(0,2).toUpperCase()}):(0,a.jsx)(n.default,{src:e8&&e1.apiType?"responses"===e1.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":e9?"/providers/anthropic-m.png":`/providers/${e1.id}.png`,alt:e1.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>es(!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:e1.name}),(e1.notice?.apiKeyUrl||e1.notice?.signupUrl||e1.website)&&(0,a.jsxs)("a",{href:e1.notice?.apiKeyUrl||e1.notice?.signupUrl||e1.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"}),e1.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:[g.length," connection",1===g.length?"":"s"]})]})]})]}),e1.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:e1.deprecationNotice})]}),e1.notice?.text&&!e1.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:e1.notice.text}),e1.notice.apiKeyUrl&&(0,a.jsx)("a",{href:e1.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 →"})]}),te&&k&&(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:e9?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,a.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[e9?"Messages API":"responses"===k.apiType?"Responses API":"Chat Completions"," \xb7 ",(k.baseUrl||"").replace(/\/$/,""),"/",e9?"messages":"responses"===k.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:()=>{M(""),q(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>B(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{eE({title:"Delete Compatible Node",message:`Delete this ${e9?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{eE(null);try{(await fetch(`/api/provider-nodes/${o}`,{method:"DELETE"})).ok&&s.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),e4?(0,a.jsx)(d.gw,{providerId:o}):(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:[g.length>0&&O.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>H(!0),children:"Apply Proxy"}),g.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:tw,disabled:eD,children:eD?"Testing Connection One-by-One...":"Test Connection One-by-One"}),eD&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{eD&&(eW.current=!0,eq(!0))},disabled:e_,children:e_?"Stopping...":"Stop"})]}),(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"===ey,onChange:e=>{let t=e?"round-robin":null,s=e?eb||"1":eb;e&&!eb&&ev("1"),eg(t),th(t,s)}}),"round-robin"===ey&&(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:eb,onChange:e=>{var t;ev(t=e.target.value),th("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===g.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:e5?"lock":"key"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),tt&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",ts," or ",ta,"."]})]})]}),(0,a.jsx)("div",{className:"flex gap-2",children:tt?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:eX,children:ts}),(0,a.jsx)(d.$n,{size:"sm",icon:"key",onClick:eY,children:ta})]}):(0,a.jsxs)(a.Fragment,{children:[!te&&"iflow"===o&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>U(!0),children:"Cookie"}),"codex"===o&&(0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>F(!0),children:(0,u.Tl)("Bulk Add")}),"merlin"===o&&(0,a.jsx)(d.$n,{size:"sm",icon:"login",variant:"secondary",onClick:async()=>{let e=g[0]?.id;if(!e){let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:"merlin",name:"Merlin (Google)",apiKey:""})});(e=(await t.json()).id)&&await tx()}e&&window.open(`/api/providers/merlin/auth/google?connectionId=${e}`,"_blank")},children:"Login with Google"}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:e0,className:"merlin"===o?"hidden":"",children:te?"Add API Key":"iflow"===o?"OAuth":"Add Connection"})]})})]}):(0,a.jsxs)(a.Fragment,{children:[eJ&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsxs)("span",{children:["Total: ",eJ.total]}),(0,a.jsxs)("span",{children:["Completed: ",eJ.completed]}),(0,a.jsxs)("span",{children:["Passed: ",eJ.passed]}),(0,a.jsxs)("span",{children:["Failed: ",eJ.failed]}),eJ.stopped&&(0,a.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),eD&&ez&&(0,a.jsxs)("span",{children:["Running: ",g.find(e=>e.id===ez)?.name||ez]})]})}),tI,!te&&(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===o&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>U(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codex"===o&&(0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>F(!0),title:(0,u.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,u.Tl)("Bulk Add")}),tt?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:eX,className:"w-full sm:w-auto",children:ts}),(0,a.jsx)(d.$n,{size:"sm",icon:"key",onClick:eY,className:"w-full sm:w-auto",children:ta})]}):(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:e0,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"}),!te&&(e=[...e6,...eA.filter(e=>!e6.some(t=>t.id===e.id))].filter(e=>{let t=(0,m.CP)(e);return!t||"llm"===t}).map(e=>e.id).filter(e=>!eT.includes(e)),(0,a.jsxs)("div",{className:"flex gap-2",children:[eT.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:tc,children:"Active All"}),e.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>td(e),children:"Disable All"})]}))]}),!!el&&(0,a.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:el}),(()=>{let e,t,s;if(te)return(0,a.jsx)(w,{providerStorageAlias:ti,providerDisplayAlias:tl,modelAliases:Z,customModels:Y,copied:eH,onCopy:eV,onSetAlias:ty,onDeleteAlias:tg,onAddCustomModel:e=>tb(e,"llm",ti),onDeleteCustomModel:e=>tv(e,"llm",ti),connections:g,isAnthropic:e9});let i=[...e6,...eA.filter(e=>!e6.some(t=>t.id===e.id))].filter(e=>{let t=(0,m.CP)(e);return!t||"llm"===t}),l=new Set(eT),r=i.filter(e=>!l.has(e.id)),n=i.filter(e=>l.has(e.id)),d=y({customModels:Y,modelAliases:Z,providerAlias:ti,builtInModels:e6,type:"llm"});return(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[d.map(e=>(0,a.jsx)(v,{model:{id:e.id,name:e.name},fullModel:`${tl}/${e.id}`,alias:e.alias,copied:eH,onCopy:eV,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===e.source?tv(e.id,"llm",ti):tg(e.alias)},testStatus:ea[e.id],onTest:g.length>0||e4?()=>tU(e.id):void 0,isTesting:er.has(e.id),isCustom:!0,isFree:!1,caps:h(`${o}/${e.id}`)},`${e.source}-${e.fullModel}`)),r.map(e=>{let t=`${ti}/${e.id}`,s=`${o}/${e.id}`,i=Object.entries(Z).find(([,e])=>e===t||e===s)?.[0];return(0,a.jsx)(v,{model:e,fullModel:`${tl}/${e.id}`,alias:i,copied:eH,onCopy:eV,onSetAlias:t=>ty(e.id,t,ti),onDeleteAlias:()=>tg(i),testStatus:ea[e.id],onTest:g.length>0||e4?()=>tU(e.id):void 0,isTesting:er.has(e.id),isFree:e.isFree,onDisable:()=>tr(e.id),caps:h(`${o}/${e.id}`)},e.id)}),(0,a.jsxs)("button",{onClick:()=>ec(!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"]}),"qoder"===o&&g.some(e=>!1!==e.isActive)&&(0,a.jsxs)("button",{onClick:tj,disabled:eB,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-blue-500/40 px-3 py-2 text-xs text-blue-600 dark:text-blue-400 transition-colors hover:border-blue-500 hover:bg-blue-500/5 sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:eB?{animation:"spin 1s linear infinite"}:void 0,children:eB?"progress_activity":"download"}),eB?(0,u.Tl)("Fetching..."):(0,u.Tl)("Fetch Qoder Models")]}),eC.length>0&&(e=new Set([...Object.values(Z),...d.map(e=>e.fullModel)]),t=new Set(e6.map(e=>e.id)),0===(s=eC.filter(s=>!e.has(`${ti}/${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()=>{await tb(e.id,"llm",ti)},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:()=>tn(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))})]})]})})()]}),tD,"kiro"===o?(0,a.jsx)(d.Mh,{isOpen:I,providerInfo:e1,onSuccess:tk,onClose:()=>R(!1)}):"cursor"===o?(0,a.jsx)(d.G9,{isOpen:I,onSuccess:tk,onClose:()=>R(!1)}):"gitlab"===o?(0,a.jsx)(d.vj,{isOpen:I,providerInfo:e1,onSuccess:tk,onClose:()=>R(!1)}):(0,a.jsx)(d.LF,{isOpen:I,provider:o,providerInfo:e1,onSuccess:tk,onClose:()=>R(!1)}),"iflow"===o&&(0,a.jsx)(d.vE,{isOpen:D,onSuccess:()=>{tx(),U(!1)},onClose:()=>U(!1)}),(0,a.jsx)(A,{isOpen:_,provider:o,providerName:e1.name,isCompatible:te,isAnthropic:e9,authType:e1?.authType,authHint:e1?.authHint,website:e1?.website,proxyPools:O,error:z,onSave:tC,onBulkDone:tx,onClose:()=>{M(""),q(!1)}}),(0,a.jsx)(d.wI,{isOpen:J,connection:V,proxyPools:O,onSave:tS,onClose:()=>L(!1)}),te&&(0,a.jsx)($,{isOpen:W,node:k,onSave:tu,onClose:()=>B(!1),isAnthropic:e9}),!te&&(0,a.jsx)(T,{isOpen:ed,providerAlias:ti,providerDisplayAlias:tl,onSave:async e=>{await tb(e,"llm",ti),ec(!1)},onClose:()=>ec(!1)}),"codex"===o&&(0,a.jsx)(P,{isOpen:K,onClose:()=>F(!1),onSuccess:tx}),(0,a.jsx)(d.uo,{isOpen:eI,onClose:()=>eR(!1),onConfirm:()=>{(window.localStorage.setItem(eQ,"true"),eR(!1),e5)?eZ():eY()},title:"Risk Notice",message:e1?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,a.jsx)(d.uo,{isOpen:!!eP,onClose:()=>eE(null),onConfirm:eP?.onConfirm,title:eP?.title||"Confirm",message:eP?.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)(r(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}P.propTypes={isOpen:b().bool.isRequired,onClose:b().func.isRequired,onSuccess:b().func}}},e=>{e.O(0,[2574,3862,2649,5772,1321,705,5497,8441,3794,7358],()=>e(e.s=31421)),_N_E=e.O()}]);
package/app/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prozygent-app",
3
- "version": "0.5.21",
3
+ "version": "0.5.23",
4
4
  "description": "Prozygent web dashboard",
5
5
  "private": true,
6
6
  "scripts": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prozygent",
3
- "version": "0.5.21",
3
+ "version": "0.5.23",
4
4
  "description": "Prozygent - FREE AI Router & Token Saver. Never stop coding. Save 20-40% tokens with RTK + auto-fallback to FREE & cheap AI models.",
5
5
  "bin": {
6
6
  "prozygent": "./cli.js"