@rsalmn/extremerouter 0.7.2 → 0.7.4

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 (664) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +4 -4
  3. package/app/.next-cli-build/build-manifest.json +2 -2
  4. package/app/.next-cli-build/prerender-manifest.json +3 -459
  5. package/app/.next-cli-build/server/app/(dashboard)/dashboard/alerts/page.js +1 -1
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/alerts/page.js.nft.json +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/alerts/page_client-reference-manifest.js +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +2 -2
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/health/page.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/health/page.js.nft.json +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/health/page_client-reference-manifest.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/overview/page.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/overview/page.js.nft.json +1 -1
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/overview/page_client-reference-manifest.js +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page.js +2 -2
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page.js.nft.json +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/swarm/page.js +1 -1
  75. package/app/.next-cli-build/server/app/(dashboard)/dashboard/swarm/page.js.nft.json +1 -1
  76. package/app/.next-cli-build/server/app/(dashboard)/dashboard/swarm/page_client-reference-manifest.js +1 -1
  77. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  78. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  79. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  80. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  81. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  82. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  83. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  84. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  85. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  86. package/app/.next-cli-build/server/app/_global-error/page.js +2 -2
  87. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  88. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  89. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  90. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  91. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  92. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  93. package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  94. package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  95. package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  96. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  97. package/app/.next-cli-build/server/app/_not-found/page.js +2 -2
  98. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  99. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  100. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  101. package/app/.next-cli-build/server/app/_not-found.rsc +5 -5
  102. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +5 -5
  103. package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  104. package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +5 -5
  105. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  106. package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  107. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  108. package/app/.next-cli-build/server/app/api/alerts/test/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/auth/login/route.js +1 -1
  110. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/auth/logout/route.js +1 -1
  112. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js +1 -1
  114. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js +1 -1
  116. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  117. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js +1 -1
  118. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  119. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
  120. package/app/.next-cli-build/server/app/api/auth/status/route.js +1 -1
  121. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  122. package/app/.next-cli-build/server/app/api/cache/route.js.nft.json +1 -1
  123. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +4 -4
  124. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  126. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  127. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
  129. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  130. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +1 -1
  131. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
  133. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  134. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
  135. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  136. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
  137. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  138. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
  139. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  140. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  141. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  142. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +2 -2
  143. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  144. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
  145. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  146. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +3 -3
  147. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  148. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
  149. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  151. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  152. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  153. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  154. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
  155. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  157. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  158. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  159. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  160. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  161. package/app/.next-cli-build/server/app/api/health/providers/route.js.nft.json +1 -1
  162. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  163. package/app/.next-cli-build/server/app/api/health/stream/route.js.nft.json +1 -1
  164. package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  165. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  166. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  167. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  168. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  169. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  170. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  171. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  172. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  173. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  175. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js +1 -1
  176. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  177. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  179. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  181. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  182. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  183. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  184. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  185. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  186. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  187. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  188. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  189. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  190. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  192. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
  193. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  194. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  196. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js +1 -1
  197. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  198. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  199. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js +1 -1
  200. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  201. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  202. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
  203. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  204. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  205. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  206. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  207. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  208. package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
  209. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  210. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js +1 -1
  211. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  212. package/app/.next-cli-build/server/app/api/providers/[id]/freebuff-profile/route.js.nft.json +1 -1
  213. package/app/.next-cli-build/server/app/api/providers/[id]/health-timeline/route.js.nft.json +1 -1
  214. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  215. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  216. package/app/.next-cli-build/server/app/api/providers/[id]/qwencloud-profile/route.js.nft.json +1 -1
  217. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  218. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
  219. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  220. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  221. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  222. package/app/.next-cli-build/server/app/api/providers/[id]/v0-profile/route.js.nft.json +1 -1
  223. package/app/.next-cli-build/server/app/api/providers/[id]/vault-pool/route.js.nft.json +1 -1
  224. package/app/.next-cli-build/server/app/api/providers/[id]/zenmux-plans/route.js.nft.json +1 -1
  225. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  226. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  227. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  228. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  229. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  230. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  232. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  234. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  236. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  237. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  238. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  239. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  240. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  241. package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
  242. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
  243. package/app/.next-cli-build/server/app/api/settings/database/route.js +1 -1
  244. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  245. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  246. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  247. package/app/.next-cli-build/server/app/api/settings/route.js +1 -1
  248. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  249. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  250. package/app/.next-cli-build/server/app/api/swarm/active/route.js.nft.json +1 -1
  251. package/app/.next-cli-build/server/app/api/swarm/stream/route.js.nft.json +1 -1
  252. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  253. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  254. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  255. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +2 -2
  256. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  257. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  258. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  259. package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  260. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  261. package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  262. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  263. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  264. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  265. package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  266. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  267. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  268. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  269. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +2 -2
  270. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  271. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  272. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  273. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  274. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  275. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  276. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  277. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  278. package/app/.next-cli-build/server/app/api/usage/meta/route.js +1 -1
  279. package/app/.next-cli-build/server/app/api/usage/meta/route.js.nft.json +1 -1
  280. package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
  281. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  282. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  283. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  284. package/app/.next-cli-build/server/app/api/usage/retry-stats/route.js.nft.json +1 -1
  285. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  286. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  287. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  288. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  289. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  290. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  291. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  292. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  293. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
  294. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  295. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  296. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  297. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  298. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  299. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
  300. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  301. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  302. package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  303. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  304. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js +1 -1
  305. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  306. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  307. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  308. package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  309. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  310. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  311. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  312. package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  313. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  314. package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  315. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  316. package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
  317. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  318. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  319. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  320. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
  321. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  322. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  323. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  324. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  325. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  326. package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  327. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  328. package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  329. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  330. package/app/.next-cli-build/server/app/callback/page.js +2 -2
  331. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  332. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  333. package/app/.next-cli-build/server/app/callback.html +1 -1
  334. package/app/.next-cli-build/server/app/callback.rsc +5 -5
  335. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +5 -5
  336. package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  337. package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +5 -5
  338. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  339. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  340. package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  341. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +2 -2
  342. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  343. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  344. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  345. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +6 -6
  346. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +6 -6
  347. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  348. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +5 -5
  349. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  350. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +2 -2
  351. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  352. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  353. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  354. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  355. package/app/.next-cli-build/server/app/index.html +1 -1
  356. package/app/.next-cli-build/server/app/index.rsc +5 -5
  357. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  358. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +5 -5
  359. package/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
  360. package/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +5 -5
  361. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  362. package/app/.next-cli-build/server/app/landing/page.js +2 -2
  363. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  364. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  365. package/app/.next-cli-build/server/app/landing.html +1 -1
  366. package/app/.next-cli-build/server/app/landing.rsc +5 -5
  367. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +5 -5
  368. package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  369. package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +5 -5
  370. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
  371. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  372. package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  373. package/app/.next-cli-build/server/app/login/page.js +2 -2
  374. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  375. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  376. package/app/.next-cli-build/server/app/login.html +1 -1
  377. package/app/.next-cli-build/server/app/login.rsc +6 -6
  378. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +6 -6
  379. package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  380. package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +5 -5
  381. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
  382. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  383. package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  384. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  385. package/app/.next-cli-build/server/app/page.js +2 -2
  386. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  387. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  388. package/app/.next-cli-build/server/app-paths-manifest.json +4 -4
  389. package/app/.next-cli-build/server/chunks/1216.js +1 -1
  390. package/app/.next-cli-build/server/chunks/1350.js +1 -1
  391. package/app/.next-cli-build/server/chunks/1719.js +1 -1
  392. package/app/.next-cli-build/server/chunks/2231.js +1 -1
  393. package/app/.next-cli-build/server/chunks/2701.js +1 -1
  394. package/app/.next-cli-build/server/chunks/318.js +9 -7
  395. package/app/.next-cli-build/server/chunks/319.js +3 -3
  396. package/app/.next-cli-build/server/chunks/3571.js +1 -0
  397. package/app/.next-cli-build/server/chunks/{2391.js → 4013.js} +1 -1
  398. package/app/.next-cli-build/server/chunks/412.js +2 -2
  399. package/app/.next-cli-build/server/chunks/42.js +1 -0
  400. package/app/.next-cli-build/server/chunks/5612.js +1 -1
  401. package/app/.next-cli-build/server/chunks/5699.js +1 -1
  402. package/app/.next-cli-build/server/chunks/5961.js +1 -1
  403. package/app/.next-cli-build/server/chunks/6070.js +1 -1
  404. package/app/.next-cli-build/server/chunks/615.js +1 -1
  405. package/app/.next-cli-build/server/chunks/6306.js +1 -1
  406. package/app/.next-cli-build/server/chunks/6316.js +2 -2
  407. package/app/.next-cli-build/server/chunks/6591.js +1 -0
  408. package/app/.next-cli-build/server/chunks/6763.js +1 -1
  409. package/app/.next-cli-build/server/chunks/6777.js +1 -1
  410. package/app/.next-cli-build/server/chunks/788.js +1 -1
  411. package/app/.next-cli-build/server/chunks/8238.js +1 -1
  412. package/app/.next-cli-build/server/chunks/8271.js +1 -1
  413. package/app/.next-cli-build/server/chunks/8833.js +1 -1
  414. package/app/.next-cli-build/server/chunks/8920.js +1 -1
  415. package/app/.next-cli-build/server/chunks/9630.js +1 -1
  416. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  417. package/app/.next-cli-build/server/middleware.js +1 -1
  418. package/app/.next-cli-build/server/pages/404.html +1 -1
  419. package/app/.next-cli-build/server/pages/500.html +1 -1
  420. package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  421. package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  422. package/app/.next-cli-build/static/chunks/1321-b29070c75a1bf41b.js +1 -0
  423. package/app/.next-cli-build/static/chunks/{1696-2558002db021b00d.js → 1696-bafe4b44a7a0439e.js} +1 -1
  424. package/app/.next-cli-build/static/chunks/1992-b492aa3235a8c259.js +1 -0
  425. package/app/.next-cli-build/static/chunks/5497-2bcb49ea235529a8.js +7 -0
  426. package/app/.next-cli-build/static/chunks/705-b7d7b61f41806f0d.js +1 -0
  427. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/playground/page-8a44865bda8d1138.js +1 -0
  428. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-1e4e44e8b9d5d986.js → page-0cb65a048e0ac91a.js} +3 -3
  429. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-80f241f97889edc2.js +1 -0
  430. package/app/.next-cli-build/static/css/f99fd82ccc97a1ed.css +1 -0
  431. package/app/cli/.build-home/AppData/Roaming/extremerouter/db/backups/upgrade-0.7.3-to-0.7.4-0.7.4-20260722-105125/data.sqlite +0 -0
  432. package/app/cli/.build-home/AppData/Roaming/extremerouter/db/data.sqlite-shm +0 -0
  433. package/app/cli/.build-home/AppData/Roaming/extremerouter/db/data.sqlite-wal +0 -0
  434. package/app/package.json +3 -1
  435. package/app/public/providers/alibaba-cn.svg +11 -0
  436. package/app/public/providers/alibaba.svg +11 -0
  437. package/app/public/providers/forge.svg +9 -0
  438. package/app/public/providers/hcnsec.svg +10 -0
  439. package/app/public/providers/qwen-cloud-token-plan.svg +8 -0
  440. package/app/public/providers/qwen-cloud.svg +8 -0
  441. package/app/public/providers/tokenrouter.svg +15 -0
  442. package/package.json +1 -1
  443. package/app/.next-cli-build/server/app/dashboard/alerts.html +0 -1
  444. package/app/.next-cli-build/server/app/dashboard/alerts.meta +0 -17
  445. package/app/.next-cli-build/server/app/dashboard/alerts.rsc +0 -25
  446. package/app/.next-cli-build/server/app/dashboard/alerts.segments/!KGRhc2hib2FyZCk/dashboard/alerts/__PAGE__.segment.rsc +0 -9
  447. package/app/.next-cli-build/server/app/dashboard/alerts.segments/!KGRhc2hib2FyZCk/dashboard/alerts.segment.rsc +0 -5
  448. package/app/.next-cli-build/server/app/dashboard/alerts.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  449. package/app/.next-cli-build/server/app/dashboard/alerts.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  450. package/app/.next-cli-build/server/app/dashboard/alerts.segments/_full.segment.rsc +0 -25
  451. package/app/.next-cli-build/server/app/dashboard/alerts.segments/_head.segment.rsc +0 -6
  452. package/app/.next-cli-build/server/app/dashboard/alerts.segments/_index.segment.rsc +0 -9
  453. package/app/.next-cli-build/server/app/dashboard/alerts.segments/_tree.segment.rsc +0 -3
  454. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +0 -1
  455. package/app/.next-cli-build/server/app/dashboard/basic-chat.meta +0 -17
  456. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +0 -22
  457. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +0 -6
  458. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +0 -5
  459. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  460. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  461. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +0 -22
  462. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +0 -6
  463. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +0 -9
  464. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +0 -3
  465. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +0 -1
  466. package/app/.next-cli-build/server/app/dashboard/cli-tools.meta +0 -17
  467. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +0 -23
  468. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +0 -6
  469. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +0 -5
  470. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  471. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  472. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +0 -23
  473. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +0 -6
  474. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +0 -9
  475. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +0 -3
  476. package/app/.next-cli-build/server/app/dashboard/combos.html +0 -1
  477. package/app/.next-cli-build/server/app/dashboard/combos.meta +0 -17
  478. package/app/.next-cli-build/server/app/dashboard/combos.rsc +0 -25
  479. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +0 -9
  480. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +0 -5
  481. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  482. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  483. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +0 -25
  484. package/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +0 -6
  485. package/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +0 -9
  486. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +0 -3
  487. package/app/.next-cli-build/server/app/dashboard/endpoint.html +0 -1
  488. package/app/.next-cli-build/server/app/dashboard/endpoint.meta +0 -17
  489. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +0 -23
  490. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +0 -6
  491. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +0 -5
  492. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  493. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  494. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +0 -23
  495. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +0 -6
  496. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +0 -9
  497. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +0 -3
  498. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +0 -1
  499. package/app/.next-cli-build/server/app/dashboard/media-providers/web.meta +0 -18
  500. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +0 -25
  501. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +0 -9
  502. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +0 -5
  503. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +0 -5
  504. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  505. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  506. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +0 -25
  507. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +0 -6
  508. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +0 -9
  509. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +0 -3
  510. package/app/.next-cli-build/server/app/dashboard/mitm.html +0 -1
  511. package/app/.next-cli-build/server/app/dashboard/mitm.meta +0 -17
  512. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +0 -22
  513. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +0 -6
  514. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +0 -5
  515. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  516. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  517. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +0 -22
  518. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +0 -6
  519. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +0 -9
  520. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +0 -3
  521. package/app/.next-cli-build/server/app/dashboard/overview.html +0 -1
  522. package/app/.next-cli-build/server/app/dashboard/overview.meta +0 -17
  523. package/app/.next-cli-build/server/app/dashboard/overview.rsc +0 -22
  524. package/app/.next-cli-build/server/app/dashboard/overview.segments/!KGRhc2hib2FyZCk/dashboard/overview/__PAGE__.segment.rsc +0 -6
  525. package/app/.next-cli-build/server/app/dashboard/overview.segments/!KGRhc2hib2FyZCk/dashboard/overview.segment.rsc +0 -5
  526. package/app/.next-cli-build/server/app/dashboard/overview.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  527. package/app/.next-cli-build/server/app/dashboard/overview.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  528. package/app/.next-cli-build/server/app/dashboard/overview.segments/_full.segment.rsc +0 -22
  529. package/app/.next-cli-build/server/app/dashboard/overview.segments/_head.segment.rsc +0 -6
  530. package/app/.next-cli-build/server/app/dashboard/overview.segments/_index.segment.rsc +0 -9
  531. package/app/.next-cli-build/server/app/dashboard/overview.segments/_tree.segment.rsc +0 -3
  532. package/app/.next-cli-build/server/app/dashboard/playground.html +0 -1
  533. package/app/.next-cli-build/server/app/dashboard/playground.meta +0 -17
  534. package/app/.next-cli-build/server/app/dashboard/playground.rsc +0 -22
  535. package/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground/__PAGE__.segment.rsc +0 -6
  536. package/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground.segment.rsc +0 -5
  537. package/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  538. package/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  539. package/app/.next-cli-build/server/app/dashboard/playground.segments/_full.segment.rsc +0 -22
  540. package/app/.next-cli-build/server/app/dashboard/playground.segments/_head.segment.rsc +0 -6
  541. package/app/.next-cli-build/server/app/dashboard/playground.segments/_index.segment.rsc +0 -9
  542. package/app/.next-cli-build/server/app/dashboard/playground.segments/_tree.segment.rsc +0 -3
  543. package/app/.next-cli-build/server/app/dashboard/profile.html +0 -1
  544. package/app/.next-cli-build/server/app/dashboard/profile.meta +0 -17
  545. package/app/.next-cli-build/server/app/dashboard/profile.rsc +0 -25
  546. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +0 -9
  547. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +0 -5
  548. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  549. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  550. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +0 -25
  551. package/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +0 -6
  552. package/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +0 -9
  553. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +0 -3
  554. package/app/.next-cli-build/server/app/dashboard/providers/new.html +0 -1
  555. package/app/.next-cli-build/server/app/dashboard/providers/new.meta +0 -18
  556. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +0 -25
  557. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +0 -9
  558. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +0 -5
  559. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +0 -5
  560. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  561. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  562. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +0 -25
  563. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +0 -6
  564. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +0 -9
  565. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +0 -3
  566. package/app/.next-cli-build/server/app/dashboard/providers.html +0 -1
  567. package/app/.next-cli-build/server/app/dashboard/providers.meta +0 -17
  568. package/app/.next-cli-build/server/app/dashboard/providers.rsc +0 -25
  569. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +0 -9
  570. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +0 -5
  571. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  572. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  573. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +0 -25
  574. package/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +0 -6
  575. package/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +0 -9
  576. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +0 -3
  577. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +0 -1
  578. package/app/.next-cli-build/server/app/dashboard/proxy-pools.meta +0 -17
  579. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +0 -25
  580. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +0 -9
  581. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +0 -5
  582. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  583. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  584. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +0 -25
  585. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +0 -6
  586. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +0 -9
  587. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +0 -3
  588. package/app/.next-cli-build/server/app/dashboard/quota.html +0 -2
  589. package/app/.next-cli-build/server/app/dashboard/quota.meta +0 -17
  590. package/app/.next-cli-build/server/app/dashboard/quota.rsc +0 -23
  591. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +0 -7
  592. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +0 -5
  593. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  594. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  595. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +0 -23
  596. package/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +0 -6
  597. package/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +0 -9
  598. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +0 -3
  599. package/app/.next-cli-build/server/app/dashboard/skills.html +0 -1
  600. package/app/.next-cli-build/server/app/dashboard/skills.meta +0 -17
  601. package/app/.next-cli-build/server/app/dashboard/skills.rsc +0 -25
  602. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +0 -9
  603. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +0 -5
  604. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  605. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  606. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +0 -25
  607. package/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +0 -6
  608. package/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +0 -9
  609. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +0 -3
  610. package/app/.next-cli-build/server/app/dashboard/token-saver.html +0 -1
  611. package/app/.next-cli-build/server/app/dashboard/token-saver.meta +0 -17
  612. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +0 -22
  613. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +0 -6
  614. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +0 -5
  615. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  616. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  617. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +0 -22
  618. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +0 -6
  619. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +0 -9
  620. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +0 -3
  621. package/app/.next-cli-build/server/app/dashboard/translator.html +0 -1
  622. package/app/.next-cli-build/server/app/dashboard/translator.meta +0 -17
  623. package/app/.next-cli-build/server/app/dashboard/translator.rsc +0 -25
  624. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +0 -9
  625. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +0 -5
  626. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  627. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  628. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +0 -25
  629. package/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +0 -6
  630. package/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +0 -9
  631. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +0 -3
  632. package/app/.next-cli-build/server/app/dashboard/usage.html +0 -1
  633. package/app/.next-cli-build/server/app/dashboard/usage.meta +0 -17
  634. package/app/.next-cli-build/server/app/dashboard/usage.rsc +0 -26
  635. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +0 -10
  636. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +0 -5
  637. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  638. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  639. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +0 -26
  640. package/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +0 -6
  641. package/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +0 -9
  642. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +0 -4
  643. package/app/.next-cli-build/server/app/dashboard.html +0 -1
  644. package/app/.next-cli-build/server/app/dashboard.meta +0 -16
  645. package/app/.next-cli-build/server/app/dashboard.rsc +0 -23
  646. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +0 -6
  647. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +0 -5
  648. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +0 -5
  649. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +0 -23
  650. package/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +0 -6
  651. package/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +0 -9
  652. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +0 -3
  653. package/app/.next-cli-build/server/chunks/4306.js +0 -1
  654. package/app/.next-cli-build/server/chunks/8881.js +0 -1
  655. package/app/.next-cli-build/static/chunks/1321-767de793890bdf8c.js +0 -1
  656. package/app/.next-cli-build/static/chunks/5497-09625960ec618fe0.js +0 -7
  657. package/app/.next-cli-build/static/chunks/705-197061b2f061280b.js +0 -1
  658. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/playground/page-f83681329e5612b2.js +0 -1
  659. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-5fc4c9e1400d741e.js +0 -1
  660. package/app/.next-cli-build/static/css/5dcaa119b622f73a.css +0 -1
  661. /package/app/.next-cli-build/static/{zG5Y3KIUIUTgefLUSHfaI → fsglpkHqAEeF3CQ_z_ynh}/_buildManifest.js +0 -0
  662. /package/app/.next-cli-build/static/{zG5Y3KIUIUTgefLUSHfaI → fsglpkHqAEeF3CQ_z_ynh}/_ssgManifest.js +0 -0
  663. /package/app/cli/.build-home/AppData/Roaming/extremerouter/db/backups/{upgrade-0.6.7-to-0.6.8-0.6.8-20260712-041517 → upgrade-0.7.1-to-0.7.2-0.7.2-20260718-105318}/data.sqlite +0 -0
  664. /package/app/cli/.build-home/AppData/Roaming/extremerouter/db/backups/{upgrade-0.6.8-to-0.6.9-0.6.9-20260713-141714 → upgrade-0.7.2-to-0.7.3-0.7.3-20260719-100408}/data.sqlite +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1287],{51191:(e,t,s)=>{Promise.resolve().then(s.bind(s,65784))},65784:(e,t,s)=>{"use strict";s.d(t,{default:()=>R});var r=s(95155),a=s(12115),n=s(35497),l=s(14051),o=s.n(l),i=s(57250),c=s(8247),d=s(28777);function m({value:e,onChange:t,models:s,compact:l=!1,modelAliases:o={},activeProviders:u=[]}){let[x,p]=(0,a.useState)(!1),g="string"==typeof e?e:null==e?"":String(e),f=(()=>{if(!g)return null;let e=s?.find(e=>e.id===g);return e?.provider||g.split("/")[0]})(),h=(()=>{if(!g)return"Select a model...";if(o?.[g])return o[g];if(f){let e=(0,d.u0)(f,g);if(e&&e!==g)return e}return g})();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{type:"button",onClick:()=>p(!0),className:l?"flex h-8 items-center gap-1.5 rounded-lg border border-border-subtle bg-surface-2 px-2 text-xs text-text-main hover:border-primary/40":"flex h-9 w-full items-center gap-2 rounded-lg border border-border-subtle bg-surface-2 px-3 text-sm text-text-main hover:border-primary/40",title:h,children:[f&&(0,r.jsx)(i.A,{src:(0,c.k)(f),alt:f,size:l?16:18,fallbackText:(f||"?").slice(0,2).toUpperCase()}),(0,r.jsx)("span",{className:`truncate ${e?"font-medium":"text-text-muted"}`,children:h}),(0,r.jsx)("span",{className:"material-symbols-outlined ml-auto text-[16px] text-text-muted",children:"expand_more"})]}),(0,r.jsx)(n.rq,{isOpen:x,onClose:()=>p(!1),onSelect:e=>{t("string"==typeof e?e:e?.value||e?.name||e?.id||""),p(!1)},selectedModel:g,activeProviders:u,title:"Select Model",modelAliases:o})]})}m.propTypes={value:o().string,onChange:o().func.isRequired,models:o().arrayOf(o().shape({id:o().string,provider:o().string})),compact:o().bool,modelAliases:o().object,activeProviders:o().array};var u=s(53593);let x=["low","medium","high","max"];function p({params:e,onChange:t,selectedModel:s=""}){let[n,l]=(0,a.useState)(!0),{getCaps:o}=(0,u.y)(),i=(s,r)=>t({...e,[s]:r}),c=o?.(s),d=!!c?.reasoning,m=!!(e.systemPrompt&&e.systemPrompt.trim());return(0,r.jsxs)("div",{className:"rounded-brand border border-border-subtle bg-panel p-3",children:[(0,r.jsxs)("button",{onClick:()=>l(!n),className:"mb-3 flex w-full items-center justify-between",children:[(0,r.jsxs)("span",{className:"flex items-center gap-2 text-sm font-semibold text-text-main",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary",children:"tune"}),"Parameters",m&&(0,r.jsx)("span",{className:"rounded-full bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary",children:"system"})]}),(0,r.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted transition-transform ${n?"rotate-90":""}`,children:"chevron_right"})]}),n&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-1 block text-xs font-medium text-text-muted",children:"System Prompt"}),(0,r.jsx)("textarea",{value:e.systemPrompt||"",onChange:e=>i("systemPrompt",e.target.value),placeholder:"You are a helpful assistant...",rows:3,className:"custom-scrollbar w-full resize-none rounded-lg border border-border-subtle bg-surface-2 px-3 py-2 text-sm text-text-main placeholder:text-text-muted focus:border-primary focus:outline-none"})]}),d&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-1 block text-xs font-medium text-text-muted",children:"Thinking Level"}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1",children:x.map(t=>{let s=(e.reasoningEffort||"medium")===t;return"max"!==t||c?.thinkingMaxEffort?(0,r.jsx)("button",{onClick:()=>i("reasoningEffort",s?"":t),className:`rounded-lg px-2.5 py-1 text-xs font-medium capitalize transition-colors ${s?"bg-primary text-white":"bg-surface-2 text-text-muted hover:bg-surface-3"}`,children:t},t):null})}),(0,r.jsx)("p",{className:"mt-1 text-[10px] text-text-muted",children:"Reasoning effort. Tap active level to clear."})]}),(0,r.jsx)(g,{label:"Temperature",value:e.temperature??.7,min:0,max:2,step:.05,onChange:e=>i("temperature",e)}),(0,r.jsx)(g,{label:"Top P",value:e.topP??1,min:0,max:1,step:.05,onChange:e=>i("topP",e)}),(0,r.jsx)(g,{label:"Frequency Penalty",value:e.frequencyPenalty??0,min:0,max:2,step:.1,onChange:e=>i("frequencyPenalty",e)}),(0,r.jsx)(g,{label:"Presence Penalty",value:e.presencePenalty??0,min:0,max:2,step:.1,onChange:e=>i("presencePenalty",e)}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-1 block text-xs font-medium text-text-muted",children:"Max Tokens"}),(0,r.jsx)("input",{type:"number",min:"1",max:"128000",value:e.maxTokens??4096,onChange:e=>i("maxTokens",parseInt(e.target.value)||4096),className:"w-full rounded-lg border border-border-subtle bg-surface-2 px-3 py-1.5 text-sm text-text-main focus:border-primary focus:outline-none"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-1 block text-xs font-medium text-text-muted",children:"Top K"}),(0,r.jsx)("input",{type:"number",min:"1",max:"1000",placeholder:"unset",value:e.topK??"",onChange:e=>i("topK",""===e.target.value?null:parseInt(e.target.value)),className:"w-full rounded-lg border border-border-subtle bg-surface-2 px-3 py-1.5 text-sm text-text-main placeholder:text-text-muted focus:border-primary focus:outline-none"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-1 block text-xs font-medium text-text-muted",children:"Seed"}),(0,r.jsx)("input",{type:"number",placeholder:"unset",value:e.seed??"",onChange:e=>i("seed",""===e.target.value?null:parseInt(e.target.value)),className:"w-full rounded-lg border border-border-subtle bg-surface-2 px-3 py-1.5 text-sm text-text-main placeholder:text-text-muted focus:border-primary focus:outline-none"})]})]})]})}function g({label:e,value:t,min:s,max:a,step:n,onChange:l}){return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"mb-1 flex items-center justify-between",children:[(0,r.jsx)("label",{className:"text-xs font-medium text-text-muted",children:e}),(0,r.jsx)("span",{className:"text-xs font-mono text-text-main",children:Number(t).toFixed(2)})]}),(0,r.jsx)("input",{type:"range",min:s,max:a,step:n,value:t,onChange:e=>l(parseFloat(e.target.value)),className:"w-full accent-primary"})]})}p.propTypes={params:o().shape({systemPrompt:o().string,reasoningEffort:o().string,temperature:o().number,maxTokens:o().number,topP:o().number,frequencyPenalty:o().number,presencePenalty:o().number,topK:o().number,seed:o().number}).isRequired,onChange:o().func.isRequired,selectedModel:o().string},g.propTypes={label:o().string.isRequired,value:o().number.isRequired,min:o().number.isRequired,max:o().number.isRequired,step:o().number.isRequired,onChange:o().func.isRequired};var f=s(62630);function h(e){return null==e?"—":e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString()}function b(e){return null==e?"—":e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function y({stats:e,mode:t="single"}){var s;if("compare"===t)return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3 rounded-brand border border-border-subtle bg-surface-2 px-3 py-2 text-xs",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] text-primary",children:"compare_arrows"}),(0,r.jsxs)("span",{className:"font-medium text-text-main",children:[e.models||0," models compared"]})]}),(0,r.jsx)("span",{className:"text-text-muted",children:"\xb7"}),(0,r.jsxs)("span",{className:"text-text-muted",children:["Total: ",b(e.compareLatencyMs)]})]});let a=null==(s=function(e){if(!e?.model||!e.inputTokens&&!e.outputTokens)return null;let t=e.model,s=t.indexOf("/"),r=s>0?t.slice(0,s):null,a=s>0?t.slice(s+1):t,n=(0,f.PS)(r,a);if(!n)return null;let l={prompt_tokens:e.inputTokens||0,completion_tokens:e.outputTokens||0,cached_tokens:e.cachedTokens||0,reasoning_tokens:e.reasoningTokens||0};return(0,f.uy)(l,n)}(e))||0===s?null:s<.01?`$${s.toFixed(4)}`:(0,f.BD)(s);return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3 rounded-brand border border-border-subtle bg-surface-2 px-3 py-2 text-xs",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] text-success",children:"arrow_upward"}),(0,r.jsx)("span",{className:"text-text-muted",children:"In:"}),(0,r.jsx)("span",{className:"font-mono font-medium text-text-main",children:h(e.inputTokens)})]}),(0,r.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] text-info",children:"arrow_downward"}),(0,r.jsx)("span",{className:"text-text-muted",children:"Out:"}),(0,r.jsx)("span",{className:"font-mono font-medium text-text-main",children:h(e.outputTokens)})]}),(0,r.jsx)("span",{className:"text-text-muted",children:"\xb7"}),(0,r.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"timer"}),(0,r.jsx)("span",{className:"text-text-muted",children:"Latency:"}),(0,r.jsx)("span",{className:"font-mono font-medium text-text-main",children:b(e.latencyMs)})]}),a&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-text-muted",children:"\xb7"}),(0,r.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] text-warning",children:"payments"}),(0,r.jsx)("span",{className:"text-text-muted",children:"Cost:"}),(0,r.jsx)("span",{className:"font-mono font-medium text-warning",children:a})]})]}),e.model&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-text-muted",children:"\xb7"}),(0,r.jsx)("span",{className:"font-mono text-text-muted",children:e.model})]})]})}function j({sessions:e,currentSession:t,onNew:s,onLoad:l,onDelete:o}){let[i,c]=(0,a.useState)(""),[,d]=(0,a.useState)(0);(0,a.useEffect)(()=>{let e=setInterval(()=>d(e=>e+1),6e4);return()=>clearInterval(e)},[]);let m=(0,a.useMemo)(()=>{let t=i.trim().toLowerCase();return t?e.filter(e=>(e.title||"").toLowerCase().includes(t)):e},[e,i]);return(0,r.jsxs)("div",{className:"flex flex-col gap-2 rounded-brand border border-border-subtle bg-panel p-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wide text-text-muted",children:"History"}),(0,r.jsx)(n.$n,{size:"sm",variant:"ghost",icon:"add",onClick:s,title:"New chat"})]}),e.length>0&&(0,r.jsxs)("div",{className:"flex items-center gap-1.5 rounded-lg border border-border-subtle bg-surface-2 px-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"search"}),(0,r.jsx)("input",{value:i,onChange:e=>c(e.target.value),placeholder:"Search...",className:"w-full bg-transparent py-1 text-xs text-text-main placeholder:text-text-muted focus:outline-none"})]}),0===e.length?(0,r.jsx)("p",{className:"py-4 text-center text-xs text-text-muted",children:"No saved conversations"}):0===m.length?(0,r.jsx)("p",{className:"py-4 text-center text-xs text-text-muted",children:"No matches"}):(0,r.jsx)("div",{className:"custom-scrollbar flex max-h-[70vh] flex-col gap-1 overflow-y-auto",children:m.map(e=>(0,r.jsxs)("div",{className:`group flex items-center gap-2 rounded-lg px-2 py-1.5 transition-colors ${t===e.id?"bg-primary/10":"hover:bg-surface-2"}`,children:[(0,r.jsxs)("button",{onClick:()=>l(e),className:"flex min-w-0 flex-1 flex-col items-start",children:[(0,r.jsx)("span",{className:"w-full truncate text-xs font-medium text-text-main",children:e.title}),(0,r.jsx)("span",{className:"text-[10px] text-text-muted",children:function(e){if(!e)return"";let t=Math.floor((Date.now()-e)/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let s=Math.floor(t/60);return s<24?`${s}h ago`:new Date(e).toLocaleDateString()}(e.updatedAt||e.createdAt)})]}),(0,r.jsx)("button",{onClick:()=>o(e.id),className:"rounded p-1 text-text-muted opacity-0 hover:text-danger group-hover:opacity-100",title:"Delete",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"delete"})})]},e.id))})]})}y.propTypes={stats:o().object,mode:o().string},j.propTypes={sessions:o().array,currentSession:o().string,onNew:o().func.isRequired,onLoad:o().func.isRequired,onDelete:o().func.isRequired};var v=s(9233),N=s(91992);N.A.addHook("afterSanitizeAttributes",e=>{for(let t of("A"===e.tagName&&(e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer")),["src","href","xlink:href","action","formaction"])){let s=e.getAttribute(t);s&&/^\s*data:/i.test(s)&&!/^\s*data:image\/(?:png|jpe?g|gif|webp);/i.test(s)&&e.removeAttribute(t)}});let w={FORBID_TAGS:["style","form","input","textarea","button","select","svg"],FORBID_ATTR:["style"],ALLOW_UNKNOWN_PROTOCOLS:!1};function k({content:e,role:t,error:s=!1}){let n=!s&&"assistant"===t,l=(0,a.useMemo)(()=>{if(!n||!e)return"";try{var t;let s=v.xI.parse(e);return t="string"==typeof s?s:String(s),"string"==typeof t&&t?N.A.sanitize(t,w):""}catch{return""}},[e,n]);return n&&l?(0,r.jsx)("div",{className:"prose-chat whitespace-pre-wrap break-words",dangerouslySetInnerHTML:{__html:l}}):(0,r.jsx)("p",{className:"whitespace-pre-wrap break-words",children:e})}function C({messages:e,onSend:t,streaming:s}){let l=(0,a.useRef)(null);return((0,a.useEffect)(()=>{l.current&&(l.current.scrollTop=l.current.scrollHeight)},[e]),0===e.length)?(0,r.jsx)("div",{className:"flex min-h-[300px] flex-1 items-center justify-center",children:(0,r.jsx)(n.pp,{icon:"science",title:"Start a conversation",description:"Pick a model above, type a message below, and press Enter. Switch to Compare mode to test multiple models side-by-side."})}):(0,r.jsx)("div",{ref:l,className:"custom-scrollbar flex max-h-[60vh] min-h-[200px] flex-1 flex-col gap-3 overflow-y-auto rounded-brand border border-border-subtle bg-panel p-4",children:e.map(e=>(0,r.jsx)(S,{msg:e},e.id))})}function S({msg:e}){let t="user"===e.role,s=e.error;return(0,r.jsx)("div",{className:`flex ${t?"justify-end":"justify-start"}`,children:(0,r.jsxs)("div",{className:`max-w-[80%] rounded-2xl px-4 py-2.5 text-sm ${t?"bg-primary text-white":s?"bg-danger/10 text-danger border border-danger/20":"bg-surface-2 text-text-main"}`,children:[e.model&&!t&&(0,r.jsx)("div",{className:"mb-1 text-[10px] font-medium text-text-muted",children:e.model}),e.reasoning&&(0,r.jsxs)("details",{className:"mb-1.5 rounded bg-black/5 px-2 py-1 dark:bg-white/5",children:[(0,r.jsx)("summary",{className:"cursor-pointer text-[10px] font-medium text-text-muted",children:"Reasoning"}),(0,r.jsx)("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs italic text-text-muted",children:e.reasoning})]}),t&&e.attachments&&e.attachments.length>0&&(0,r.jsx)("div",{className:"mb-1.5 flex flex-wrap gap-1.5",children:e.attachments.map(e=>(0,r.jsx)("img",{src:e.dataUrl,alt:e.name,className:"h-20 w-20 rounded-lg border border-white/20 object-cover"},e.id))}),(0,r.jsxs)("div",{className:"break-words",children:[(0,r.jsx)(k,{content:e.content,role:e.role,error:s}),e.streaming&&(0,r.jsx)("span",{className:"ml-0.5 inline-block size-3 animate-pulse rounded-full bg-primary/50 align-middle"})]})]})})}async function T(e,{onChunk:t}={}){if(!e?.body?.getReader)return null;let s=e.body.getReader(),r=new TextDecoder,a="",n=null;for(;;){let{value:e,done:l}=await s.read();if(l)break;let o=(a+=r.decode(e,{stream:!0})).split(/\r?\n/);for(let e of(a=o.pop()||"",o)){let s=e.trim();if(!s.startsWith("data:"))continue;let r=s.slice(5).trim();if(r&&"[DONE]"!==r)try{let e=function(e){let t=e?.choices?.[0],s=t?.delta||{};return{content:"string"==typeof s.content?s.content:null,reasoning:"string"==typeof s.reasoning_content?s.reasoning_content:null,toolCalls:Array.isArray(s.tool_calls)&&s.tool_calls.length>0?s.tool_calls:null,finishReason:t?.finish_reason??null,usage:e?.usage??null}}(JSON.parse(r));e.usage&&(n=e.usage),t?.(e)}catch{}}}return n}v.xI.setOptions({gfm:!0,breaks:!0,async:!1}),k.propTypes={content:o().string,role:o().string,error:o().bool},C.propTypes={messages:o().arrayOf(o().shape({id:o().string,role:o().string,content:o().string,reasoning:o().string,model:o().string,streaming:o().bool,error:o().bool,attachments:o().array})),onSend:o().func,streaming:o().bool};let P="extremerouter.playground.sessions";function _(){return`${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function A(e){try{localStorage.setItem(P,JSON.stringify(e))}catch{}}function R(){let[e,t]=(0,a.useState)(!0),[s,l]=(0,a.useState)([]),[o,i]=(0,a.useState)([]),[c,d]=(0,a.useState)({}),[u,x]=(0,a.useState)([]),[g,f]=(0,a.useState)(null),[h,b]=(0,a.useState)([]),[v,N]=(0,a.useState)({}),[w,S]=(0,a.useState)("single"),[R,O]=(0,a.useState)([""]),[$,D]=(0,a.useState)({systemPrompt:"",temperature:.7,maxTokens:4096,topP:1,frequencyPenalty:0,presencePenalty:0,topK:null,seed:null,reasoningEffort:""}),[q,z]=(0,a.useState)({}),M=(0,a.useRef)(null),I=(0,a.useRef)({}),{streamChat:L,abortAll:F,streaming:K}=function({onDelta:e,onComplete:t,onError:s}){let r=(0,a.useRef)({}),[n,l]=(0,a.useState)(0);(0,a.useEffect)(()=>{let e=r.current;return()=>{Object.values(e).forEach(e=>e?.abort?.())}},[]);let o=(0,a.useCallback)(async(a,{body:n,apiKey:o})=>{let i=new AbortController;r.current[a]=i,l(e=>e+1);try{let r={"Content-Type":"application/json",Accept:"text/event-stream"};o&&(r.Authorization=`Bearer ${o}`);let l=await fetch("/api/v1/chat/completions",{method:"POST",headers:r,body:JSON.stringify({...n,stream:!0}),signal:i.signal});if(!l.ok){let e=await l.json().catch(()=>({error:{message:`HTTP ${l.status}`}}));s(a,e.error?.message||`HTTP ${l.status}`,l.status);return}let c=await T(l,{onChunk:t=>e(a,t)});t(a,{usage:c,ok:!0})}catch(e){e?.name!=="AbortError"&&s(a,e?.message||"Network error",0)}finally{delete r.current[a],l(e=>Math.max(0,e-1))}},[e,t,s]);return{streamChat:o,abort:(0,a.useCallback)(e=>{r.current[e]?.abort?.()},[]),abortAll:(0,a.useCallback)(()=>{Object.values(r.current).forEach(e=>e?.abort?.())},[]),streaming:n>0}}({onDelta:(0,a.useCallback)((e,t)=>{let s=I.current[e];if(!s)return;let r=(e,t,s)=>s?(e||"")+s:e;"single"===s.mode?b(e=>e.map(e=>e.id!==s.assistantId?e:{...e,content:r(e.content,"content",t.content),reasoning:r(e.reasoning,"reasoning",t.reasoning)})):N(s=>{let a=s[e]||{content:"",reasoning:"",streaming:!0,error:null};return{...s,[e]:{...a,content:r(a.content,"content",t.content),reasoning:r(a.reasoning,"reasoning",t.reasoning)}}})},[]),onComplete:(0,a.useCallback)((e,{usage:t})=>{let s=I.current[e];s&&("single"===s.mode?(b(e=>e.map(e=>e.id===s.assistantId?{...e,streaming:!1}:e)),z({model:s.modelId,inputTokens:t?.prompt_tokens||0,outputTokens:t?.completion_tokens||0,latencyMs:Date.now()-s.startTime})):N(s=>({...s,[e]:{...s[e],streaming:!1,usage:t}})),delete I.current[e])},[]),onError:(0,a.useCallback)((e,t)=>{let s,r=I.current[e];if(!r)return;let a=((s=(s=(s=(s=(s="string"==typeof t?t:String(t??"")).replace(/https?:\/\/[^\s"'<>]+/g,"[url]")).replace(/(Bearer\s+)[A-Za-z0-9._\-]{16,}/gi,"$1[token]")).replace(/(signature=)[A-Za-z0-9%+/=]{16,}/gi,"$1[sig]")).replace(/\{[\s\S]{80,}\}/g,"[provider json]")).length>300&&(s=s.slice(0,297)+"..."),s.trim());"single"===r.mode?b(e=>e.map(e=>e.id===r.assistantId?{...e,content:`❌ Error: ${a}`,streaming:!1,error:!0}:e)):N(t=>({...t,[e]:{...t[e],content:`❌ ${a}`,streaming:!1,error:!0}})),delete I.current[e]},[])});(0,a.useEffect)(()=>{(async()=>{x(function(){try{let e=localStorage.getItem(P);return e?JSON.parse(e):[]}catch{return[]}}());try{let e=await fetch("/api/keys"),t=await e.json(),s=(t.keys||t||[]).find?.(e=>!1!==e.isActive);s?.key&&(M.current=s.key)}catch{}try{let[e,t,s]=await Promise.all([fetch("/api/providers"),fetch("/api/models/alias"),fetch("/api/v1/models")]),r=await e.json();i((r.connections||[]).filter(e=>!1!==e.isActive));let a=await t.json();d(a.aliases||{});let n=((await s.json()).data||[]).map(e=>({id:e.id,name:e.id,provider:e.owned_by||e.id.split("/")[0]}));l(n),n.length>0&&O([n[0].id])}catch{}t(!1)})()},[]);let B=(0,a.useCallback)(()=>{h.length>0&&g&&W(g,h),b([]),f(null),z({}),N({})},[h,g]),H=(0,a.useCallback)(e=>{h.length>0&&g&&W(g,h),b(e.messages||[]),f(e.id),e.model&&O([e.model]),e.params&&D(e.params),z({}),N({})},[h,g]),U=(0,a.useCallback)(e=>{let t=u.filter(t=>t.id!==e);x(t),A(t),g===e&&(f(null),b([]))},[u,g]),W=(0,a.useCallback)((e,t)=>{let s=u.map(s=>s.id===e?{...s,messages:t,updatedAt:Date.now()}:s);x(s),A(s)},[u]),J=(0,a.useCallback)(()=>{if(0===h.length)return;let e=g||_(),t={id:e,title:h.find(e=>"user"===e.role)?.content?.slice(0,40)||"New Chat",messages:h,model:R[0],params:$,createdAt:Date.now(),updatedAt:Date.now()},s=u.find(t=>t.id===e)?u.map(s=>s.id===e?{...s,...t}:s):[t,...u];x(s),A(s),f(e)},[h,g,u,R,$]),Y=(0,a.useCallback)((e,t=[])=>{let s=t.length>0,r={role:"user",content:s?[{type:"text",text:e},...t.map(e=>({type:"image_url",image_url:{url:e.dataUrl}}))]:e,id:_(),displayText:e,displayAttachments:s?t:void 0},a=[...h];$.systemPrompt&&a.unshift({role:"system",content:$.systemPrompt});let n=[...a.slice(-50),r],l={temperature:$.temperature,max_tokens:$.maxTokens,top_p:$.topP};return $.frequencyPenalty&&(l.frequency_penalty=$.frequencyPenalty),$.presencePenalty&&(l.presence_penalty=$.presencePenalty),$.topK&&(l.top_k=$.topK),null!=$.seed&&(l.seed=$.seed),$.reasoningEffort&&(l.reasoning_effort=$.reasoningEffort),{userMsg:r,baseMessages:n,requestParams:l}},[h,$]),Z=(0,a.useCallback)(async(e,t=[])=>{if(!e.trim()&&0===t.length||K)return;let{userMsg:s,baseMessages:r,requestParams:a}=Y(e,t),n=M.current,l=Date.now();if("single"===w){let e=R[0];if(!e)return;let t=_();b([...r.filter(e=>"system"!==e.role).map(e=>"user"===e.role?{...e,content:e.displayText??e.content,attachments:e.displayAttachments}:e),{role:"assistant",content:"",reasoning:"",id:t,model:e,streaming:!0}]),I.current.single={mode:"single",assistantId:t,modelId:e,startTime:l},await L("single",{body:{model:e,messages:r,...a},apiKey:n})}else{let e=R.filter(Boolean);if(0===e.length)return;N({}),e.forEach(e=>{I.current[e]={mode:"compare",modelId:e,startTime:l}}),await Promise.allSettled(e.map(e=>L(e,{body:{model:e,messages:r,...a},apiKey:n}))),z({compareLatencyMs:Date.now()-l,models:e.length})}},[K,w,R,Y,L]),G=(0,a.useCallback)(()=>{F(),b(e=>e.map(e=>e.streaming?{...e,streaming:!1}:e)),N(e=>{let t={};for(let[s,r]of Object.entries(e))t[s]={...r,streaming:!1};return t})},[F]);return e?(0,r.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,r.jsx)(n.zY,{title:"Playground",description:"Test models, compare outputs, tune parameters",icon:"science"}),(0,r.jsx)(n.Qv,{})]}):(0,r.jsxs)("div",{className:"flex min-w-0 flex-col gap-4",children:[(0,r.jsx)(n.zY,{title:"Playground",description:"Test models, compare outputs, tune parameters",icon:"science",actions:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(n.Iz,{options:[{value:"single",label:"Chat"},{value:"compare",label:"Compare"}],value:w,onChange:S,size:"sm"}),(0,r.jsx)(n.$n,{size:"sm",variant:"ghost",icon:K?"stop":"save",onClick:K?G:J,disabled:!K&&0===h.length,children:K?"Stop":"Save"})]})}),(0,r.jsxs)("div",{className:"flex min-w-0 gap-4",children:[(0,r.jsx)("div",{className:"hidden w-56 shrink-0 lg:block",children:(0,r.jsx)(j,{sessions:u,currentSession:g,onNew:B,onLoad:H,onDelete:U})}),(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:["single"===w?(0,r.jsx)(m,{models:s,value:R[0],onChange:e=>O([e]),activeProviders:o,modelAliases:c}):(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[R.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(m,{models:s,value:e,onChange:e=>{let s=[...R];s[t]=e,O(s)},compact:!0,activeProviders:o,modelAliases:c}),R.length>2&&(0,r.jsx)("button",{onClick:()=>O(R.filter((e,s)=>s!==t)),className:"rounded-lg p-1.5 text-text-muted hover:bg-surface-2 hover:text-danger",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]},t)),R.length<4&&(0,r.jsxs)("button",{onClick:()=>O([...R,""]),className:"flex items-center gap-1 rounded-lg border border-dashed border-border px-3 py-1.5 text-xs text-text-muted hover:border-primary/40 hover:text-primary",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"add"}),"Add Model"]})]}),"single"===w?(0,r.jsx)(C,{messages:h,onSend:Z,streaming:K,stats:q}):(0,r.jsx)("div",{className:"flex min-w-0 gap-3",children:R.filter(Boolean).map(e=>{let t=v[e];return(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col rounded-brand border border-border-subtle bg-panel",children:[(0,r.jsx)("div",{className:"border-b border-border-subtle px-3 py-2",children:(0,r.jsx)("span",{className:"truncate text-xs font-medium text-text-main",children:e})}),(0,r.jsxs)("div",{className:"custom-scrollbar max-h-[60vh] min-h-[200px] overflow-y-auto p-3",children:[t?.reasoning&&(0,r.jsxs)("details",{className:"mb-2 rounded bg-black/5 px-2 py-1 dark:bg-white/5",children:[(0,r.jsx)("summary",{className:"cursor-pointer text-[10px] font-medium text-text-muted",children:"Reasoning"}),(0,r.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-xs italic text-text-muted",children:t.reasoning})]}),t?.content?(0,r.jsxs)("div",{className:`text-sm ${t.error?"text-danger":"text-text-main"}`,children:[t.error?(0,r.jsx)("p",{className:"whitespace-pre-wrap break-words",children:t.content}):(0,r.jsx)(k,{content:t.content,role:"assistant"}),t.streaming&&(0,r.jsx)("span",{className:"ml-0.5 inline-block size-3 animate-pulse rounded-full bg-primary/50 align-middle"})]}):(0,r.jsx)("p",{className:"text-sm text-text-muted",children:K?"Waiting...":"Send a message to compare"})]})]},e)})}),(0,r.jsx)(E,{onSend:Z,streaming:K,onStop:G}),Object.keys(q).length>0&&(0,r.jsx)(y,{stats:q,mode:w})]}),(0,r.jsx)("div",{className:"hidden w-60 shrink-0 xl:block",children:(0,r.jsx)(p,{params:$,onChange:D,selectedModel:R[0]})})]})]})}function E({onSend:e,streaming:t,onStop:s}){let[n,l]=(0,a.useState)(""),[o,i]=(0,a.useState)([]),c=(0,a.useRef)(null),d=e=>{if(!e||!e.type.startsWith("image/")||e.size>5242880)return;let t=new FileReader;t.onload=()=>{i(s=>[...s,{id:_(),dataUrl:t.result,name:e.name}])},t.readAsDataURL(e)},m=()=>{(n.trim()||0!==o.length)&&!t&&(e(n,o),l(""),i([]),c.current&&(c.current.style.height="auto"))},u=(n.trim()||o.length>0)&&!t;return(0,r.jsxs)("div",{className:"flex flex-col gap-2 rounded-brand border border-border-subtle bg-panel p-2",children:[o.length>0&&(0,r.jsx)("div",{className:"flex flex-wrap gap-2",children:o.map(e=>(0,r.jsxs)("div",{className:"group relative",children:[(0,r.jsx)("img",{src:e.dataUrl,alt:e.name,className:"h-16 w-16 rounded-lg border border-border-subtle object-cover"}),(0,r.jsx)("button",{onClick:()=>i(t=>t.filter(t=>t.id!==e.id)),className:"absolute -right-1.5 -top-1.5 flex size-5 items-center justify-center rounded-full bg-danger text-white opacity-0 transition-opacity group-hover:opacity-100",title:"Remove",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},e.id))}),(0,r.jsxs)("div",{className:"flex items-end gap-2",children:[(0,r.jsx)("textarea",{ref:c,value:n,onChange:e=>{l(e.target.value),e.target.style.height="auto",e.target.style.height=Math.min(e.target.scrollHeight,120)+"px"},onPaste:e=>{let t=e.clipboardData?.items;if(!t)return;let s=!1;for(let e of t)e.type.startsWith("image/")&&(s=!0,d(e.getAsFile()));s&&e.preventDefault()},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),m())},placeholder:"Send a message... (Enter to send, Shift+Enter for newline, paste images)",rows:1,className:"custom-scrollbar max-h-[120px] flex-1 resize-none bg-transparent px-2 py-1.5 text-sm text-text-main placeholder:text-text-muted focus:outline-none"}),t?(0,r.jsx)("button",{onClick:s,className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-danger/15 text-danger hover:bg-danger/25",title:"Stop",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"stop"})}):(0,r.jsx)("button",{onClick:m,disabled:!u,className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-primary text-white hover:bg-primary-hover disabled:opacity-40",title:"Send",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"send"})})]})]})}}},e=>{e.O(0,[27,1992,1321,705,5497,8441,3794,7358],()=>e(e.s=51191)),_N_E=e.O()}]);
@@ -1,10 +1,10 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{26706:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>J});var a=s(95155),l=s(12115),i=s(73321),r=s(98500),n=s.n(r),o=s(5772),d=s(35497),c=s(88105),m=s(28777),x=s(11059),p=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 g({customModels:e=[],modelAliases:t={},providerAlias:s,builtInModels:a=[],type:l="llm",includeLegacyAliases:i=!0}){let r=new Set(a.map(e=>e.id)),n=new Set,o=[];for(let t of e){if(!t?.id||t.providerAlias!==s)continue;let e=t?.kind||t?.type||"llm";if(l&&e!==l||r.has(t.id))continue;let a=`${s}/${t.id}`;n.has(a)||(n.add(a),o.push({id:t.id,name:t.name||t.id,fullModel:a,source:"custom",type:e}))}if(!i)return o;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||r.has(t)||n.has(s)||(n.add(s),o.push({id:t,alias:e,fullModel:s,source:"legacyAlias",type:l||"llm"}))}return o}var y=s(8247),b=s(14051),v=s.n(b);let j=[{value:"auto",label:"Auto",hint:"No override"},{value:"none",label:"Off",hint:"Disable thinking"},{value:"minimal",label:"Minimal",hint:"512 tokens"},{value:"low",label:"Low",hint:"1,024 tokens"},{value:"medium",label:"Medium",hint:"8,192 tokens"},{value:"high",label:"High",hint:"24,576 tokens"},{value:"xhigh",label:"X-High",hint:"32,768 tokens"},{value:"max",label:"Max",hint:"128,000 tokens"}];function N({caps:e,selectedLevel:t,onSelect:s}){let[i,r]=(0,l.useState)(!1),n=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(!i)return;let e=e=>{n.current&&!n.current.contains(e.target)&&r(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);let o=j.filter(t=>"auto"===t.value||("none"===t.value?e?.thinkingCanDisable!==!1:"max"!==t.value||e?.thinkingMaxEffort===!0)),d=o.find(e=>e.value===t)||o[0];return(0,a.jsxs)("div",{className:"relative",ref:n,children:[(0,a.jsx)("button",{onClick:()=>r(e=>!e),title:`Thinking: ${d.label}${d.hint?` (${d.hint})`:""}`,className:`rounded p-0.5 transition-colors ${"auto"!==t?"text-primary":"text-text-muted hover:bg-sidebar hover:text-primary"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"psychology"})}),i&&(0,a.jsxs)("div",{className:"absolute right-0 top-full z-20 mt-1 min-w-[140px] rounded-lg border border-border bg-panel shadow-[var(--shadow-warm)]",children:[(0,a.jsx)("div",{className:"px-2 py-1.5 border-b border-border-subtle",children:(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-text-muted",children:"Thinking Level"})}),o.map(e=>(0,a.jsxs)("button",{onClick:()=>{s(e.value),r(!1)},className:`flex w-full items-center justify-between gap-2 px-2.5 py-1.5 text-xs transition-colors hover:bg-sidebar ${e.value===t?"text-primary font-semibold":"text-text-main"}`,children:[(0,a.jsx)("span",{children:e.label}),(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:e.hint})]},e.value))]})]})}function w({model:e,fullModel:t,alias:s,copied:i,onCopy:r,testStatus:n,isCustom:o,isFree:c,onDeleteAlias:m,onTest:x,isTesting:p,onDisable:u,caps:h}){let[f,g]=(0,l.useState)("auto"),y="ok"===n?"#22c55e":"error"===n?"#ef4444":void 0,b=!!h?.reasoning,v="auto"!==f&&"none"!==f?`${t}(${f})`:"none"===f?`${t}(none)`:t;return(0,a.jsx)("div",{className:`group min-w-0 max-w-full rounded-lg border px-3 py-2 ${"ok"===n?"border-green-500/40":"error"===n?"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:y?{color:y}:void 0,children:"ok"===n?"check_circle":"error"===n?"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:v}),(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:h,colorOverride:"text-text-muted/70",size:12})]})]}),b&&(0,a.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,a.jsx)(N,{caps:h,selectedLevel:f,onSelect:g}),(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:"Thinking"})]}),x&&(0,a.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,a.jsx)("button",{onClick:x,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:()=>r(v,`model-${e.id}`),className:"rounded p-0.5 text-text-muted hover:bg-sidebar hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:i===`model-${e.id}`?"check":"content_copy"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:i===`model-${e.id}`?"Copied!":"Copy"})]}),o?(0,a.jsx)("button",{onClick:m,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Remove custom model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):u?(0,a.jsx)("button",{onClick:u,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 k({modelId:e,fullModel:t,copied:s,onCopy:l,onDeleteAlias:i,onTest:r,testStatus:n,isTesting:o}){let d="ok"===n?"#22c55e":"error"===n?"#ef4444":void 0;return(0,a.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===n?"border-green-500/40":"error"===n?"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"===n?"check_circle":"error"===n?"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:()=>l(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:s===`model-${e}`?"check":"content_copy"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:s===`model-${e}`?"Copied!":"Copy"})]}),r&&(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:r,disabled:o,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:o?{animation:"spin 1s linear infinite"}:void 0,children:o?"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:o?"Testing...":"Test"})]})]})]}),(0,a.jsx)("button",{onClick:i,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 C({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:s,customModels:i,copied:r,onCopy:n,onDeleteAlias:o,onAddCustomModel:c,onDeleteCustomModel:m,connections:x,isAnthropic:p}){let[u,h]=(0,l.useState)(""),[f,y]=(0,l.useState)(!1),[b,v]=(0,l.useState)(!1),[j,N]=(0,l.useState)(null),[w,S]=(0,l.useState)({}),$=async t=>{if(!j){N(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{N(null)}}},A=g({customModels:i,modelAliases:s,providerAlias:e,type:"llm"}),T=async()=>{if(!u.trim()||f)return;let e=u.trim();if(A.some(t=>t.id===e))return void alert("Model already exists for this provider.");y(!0);try{await c(e),h("")}catch(e){console.log("Error adding model:",e)}finally{y(!1)}},E=async()=>{if(b)return;let e=x.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 l=0;for(let e of a){let t=e.id||e.name||e.model;t&&(A.some(e=>e.id===t)||(await c(t),l+=1))}0===l&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{v(!1)}}},P=x.some(e=>!1!==e.isActive);return(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",p?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,a.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,a.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,a.jsx)("input",{id:"new-compatible-model-input",type:"text",value:u,onChange:e=>h(e.target.value),onKeyDown:e=>"Enter"===e.key&&T(),placeholder:p?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:T,disabled:!u.trim()||f,children:f?"Adding...":"Add"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"download",onClick:E,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."}),A.length>0&&(0,a.jsx)("div",{className:"flex flex-col gap-3",children:A.map(({id:s,alias:l,source:i})=>(0,a.jsx)(k,{modelId:s,fullModel:`${t}/${s}`,copied:r,onCopy:n,onDeleteAlias:()=>"custom"===i?m(s):o(l),onTest:x.length>0?()=>$(s):void 0,testStatus:w[s],isTesting:j===s},`${i}-${e}/${s}`))})]})}w.propTypes={model:v().shape({id:v().string.isRequired}).isRequired,fullModel:v().string.isRequired,alias:v().string,copied:v().string,onCopy:v().func.isRequired,testStatus:v().oneOf(["ok","error"]),isCustom:v().bool,isFree:v().bool,onDeleteAlias:v().func,onTest:v().func,isTesting:v().bool,onDisable:v().func,caps:v().object},C.propTypes={providerStorageAlias:v().string.isRequired,providerDisplayAlias:v().string.isRequired,modelAliases:v().object.isRequired,customModels:v().arrayOf(v().object),copied:v().string,onCopy:v().func.isRequired,onDeleteAlias:v().func.isRequired,onAddCustomModel:v().func.isRequired,onDeleteCustomModel:v().func.isRequired,connections:v().arrayOf(v().shape({id:v().string,isActive:v().bool})).isRequired,isAnthropic:v().bool};var S=s(70217);function $({until:e}){let[t,s]=(0,l.useState)("");return((0,l.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 A({connection:e,proxyPools:t,isOAuth:s,isFirst:i,isLast:r,onMoveUp:n,onMoveDown:o,onToggleActive:c,onUpdateProxy:m,onEdit:x,onDelete:p,oneByOneStatus:u=null,autoPing:h=null}){let[f,g]=(0,l.useState)(!1),[y,b]=(0,l.useState)(!1),v=(0,l.useRef)(null),j=new Map((t||[]).map(e=>[e.id,e])),N=e.providerSpecificData?.proxyPoolId||null,w=N?j.get(N):null,k=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,C=!!N||k,T=w?`Pool: ${w.name}`:N?`Pool: ${N} (inactive/missing)`:k?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",E=h?.provider==="codex"?"Auto-starts the next 5h Codex window after reset by sending a tiny gpt-5.5 request. Consumes a small amount of quota.":"When your 5h quota runs out, auto-sends a request the moment it resets so a new window starts right away.",P="";if(w?.proxyUrl||e.providerSpecificData?.connectionProxyUrl){let t=w?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);P=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{P=t}}let O=w?.noProxy||e.providerSpecificData?.connectionNoProxy||"",I="default";w?.isActive===!0?I="success":(N||k)&&(I="error"),(0,l.useEffect)(()=>{if(!f)return;let e=e=>{v.current&&!v.current.contains(e.target)&&g(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[f]);let z=async e=>{b(!0);try{await m("__none__"===e?null:e)}finally{b(!1),g(!1)}},D=e.authType||(s?"oauth":"apikey"),_="oauth"===D,U="cookie"===D,R=e.name?.trim()||e.email?.trim()||e.displayName?.trim()||(_?"OAuth Account":U?"Cookie Account":"API Key"),M=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,[q,L]=(0,l.useState)(!1),K=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>!!e).sort()[0]||null;(0,l.useEffect)(()=>{let t=()=>{L(!!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||q?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:n,disabled:i,className:`p-0.5 rounded ${i?"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:o,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,a.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base text-text-muted",children:U?"cookie":_?"lock":"key"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:R}),M&&(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:M}),(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,S.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:_?"OAuth":U?"Cookie":"API Key"}),C&&(0,a.jsx)(d.Ex,{variant:I,size:"sm",children:"Proxy"}),q&&!1!==e.isActive&&(0,a.jsx)($,{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()})]}),C&&(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:T,children:T}),P&&(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:P}),O&&(0,a.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:O,children:["no_proxy: ",O]})]})]})]}),(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:()=>g(e=>!e),className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${C?"text-primary":"text-text-muted hover:text-primary"}`,disabled:y,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:y?"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:()=>z("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!N?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,a.jsx)("button",{onClick:()=>z(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${N===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),h&&(0,a.jsx)(d.m_,{text:E,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:x,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:p,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"})]})]})}$.propTypes={until:v().string.isRequired},A.propTypes={connection:v().shape({id:v().string,name:v().string,email:v().string,displayName:v().string,modelLockUntil:v().string,testStatus:v().string,isActive:v().bool,lastError:v().string,priority:v().number,globalPriority:v().number}).isRequired,proxyPools:v().arrayOf(v().shape({id:v().string,name:v().string,proxyUrl:v().string,noProxy:v().string,isActive:v().bool})),isOAuth:v().bool.isRequired,isFirst:v().bool.isRequired,isLast:v().bool.isRequired,onMoveUp:v().func.isRequired,onMoveDown:v().func.isRequired,onToggleActive:v().func.isRequired,onUpdateProxy:v().func,onEdit:v().func.isRequired,onDelete:v().func.isRequired,oneByOneStatus:v().shape({state:v().string,error:v().string}),autoPing:v().shape({on:v().bool,onToggle:v().func,provider:v().string})};let T=`name1|sk-key1
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{26706:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>J});var a=s(95155),l=s(12115),i=s(73321),r=s(98500),n=s.n(r),o=s(5772),d=s(35497),c=s(88105),m=s(28777),x=s(11059),p=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 g({customModels:e=[],modelAliases:t={},providerAlias:s,builtInModels:a=[],type:l="llm",includeLegacyAliases:i=!0}){let r=new Set(a.map(e=>e.id)),n=new Set,o=[];for(let t of e){if(!t?.id||t.providerAlias!==s)continue;let e=t?.kind||t?.type||"llm";if(l&&e!==l||r.has(t.id))continue;let a=`${s}/${t.id}`;n.has(a)||(n.add(a),o.push({id:t.id,name:t.name||t.id,fullModel:a,source:"custom",type:e}))}if(!i)return o;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||r.has(t)||n.has(s)||(n.add(s),o.push({id:t,alias:e,fullModel:s,source:"legacyAlias",type:l||"llm"}))}return o}var y=s(8247),b=s(14051),v=s.n(b);let j=[{value:"auto",label:"Auto",hint:"No override"},{value:"none",label:"Off",hint:"Disable thinking"},{value:"minimal",label:"Minimal",hint:"512 tokens"},{value:"low",label:"Low",hint:"1,024 tokens"},{value:"medium",label:"Medium",hint:"8,192 tokens"},{value:"high",label:"High",hint:"24,576 tokens"},{value:"xhigh",label:"X-High",hint:"32,768 tokens"},{value:"max",label:"Max",hint:"128,000 tokens"}];function N({caps:e,selectedLevel:t,onSelect:s}){let[i,r]=(0,l.useState)(!1),n=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(!i)return;let e=e=>{n.current&&!n.current.contains(e.target)&&r(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);let o=j.filter(t=>"auto"===t.value||("none"===t.value?e?.thinkingCanDisable!==!1:"max"!==t.value||e?.thinkingMaxEffort===!0)),d=o.find(e=>e.value===t)||o[0];return(0,a.jsxs)("div",{className:"relative",ref:n,children:[(0,a.jsx)("button",{onClick:()=>r(e=>!e),title:`Thinking: ${d.label}${d.hint?` (${d.hint})`:""}`,className:`rounded p-0.5 transition-colors ${"auto"!==t?"text-primary":"text-text-muted hover:bg-sidebar hover:text-primary"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"psychology"})}),i&&(0,a.jsxs)("div",{className:"absolute right-0 top-full z-20 mt-1 min-w-[140px] rounded-lg border border-border bg-panel shadow-[var(--shadow-warm)]",children:[(0,a.jsx)("div",{className:"px-2 py-1.5 border-b border-border-subtle",children:(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-text-muted",children:"Thinking Level"})}),o.map(e=>(0,a.jsxs)("button",{onClick:()=>{s(e.value),r(!1)},className:`flex w-full items-center justify-between gap-2 px-2.5 py-1.5 text-xs transition-colors hover:bg-sidebar ${e.value===t?"text-primary font-semibold":"text-text-main"}`,children:[(0,a.jsx)("span",{children:e.label}),(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:e.hint})]},e.value))]})]})}function w({model:e,fullModel:t,alias:s,copied:i,onCopy:r,testStatus:n,isCustom:o,isFree:c,onDeleteAlias:m,onTest:x,isTesting:p,onDisable:u,caps:h}){let[f,g]=(0,l.useState)("auto"),y="ok"===n?"#22c55e":"error"===n?"#ef4444":void 0,b=!!h?.reasoning,v="auto"!==f&&"none"!==f?`${t}(${f})`:"none"===f?`${t}(none)`:t;return(0,a.jsx)("div",{className:`group min-w-0 max-w-full rounded-lg border px-3 py-2 ${"ok"===n?"border-green-500/40":"error"===n?"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:y?{color:y}:void 0,children:"ok"===n?"check_circle":"error"===n?"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:v}),(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:h,colorOverride:"text-text-muted/70",size:12})]})]}),b&&(0,a.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,a.jsx)(N,{caps:h,selectedLevel:f,onSelect:g}),(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:"Thinking"})]}),x&&(0,a.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,a.jsx)("button",{onClick:x,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:()=>r(v,`model-${e.id}`),className:"rounded p-0.5 text-text-muted hover:bg-sidebar hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:i===`model-${e.id}`?"check":"content_copy"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:i===`model-${e.id}`?"Copied!":"Copy"})]}),o?(0,a.jsx)("button",{onClick:m,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Remove custom model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):u?(0,a.jsx)("button",{onClick:u,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 k({modelId:e,fullModel:t,copied:s,onCopy:l,onDeleteAlias:i,onTest:r,testStatus:n,isTesting:o}){let d="ok"===n?"#22c55e":"error"===n?"#ef4444":void 0;return(0,a.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===n?"border-green-500/40":"error"===n?"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"===n?"check_circle":"error"===n?"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:()=>l(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:s===`model-${e}`?"check":"content_copy"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:s===`model-${e}`?"Copied!":"Copy"})]}),r&&(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:r,disabled:o,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:o?{animation:"spin 1s linear infinite"}:void 0,children:o?"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:o?"Testing...":"Test"})]})]})]}),(0,a.jsx)("button",{onClick:i,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 C({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:s,customModels:i,copied:r,onCopy:n,onDeleteAlias:o,onAddCustomModel:c,onDeleteCustomModel:m,connections:x,isAnthropic:p}){let[u,h]=(0,l.useState)(""),[f,y]=(0,l.useState)(!1),[b,v]=(0,l.useState)(!1),[j,N]=(0,l.useState)(null),[w,S]=(0,l.useState)({}),$=async t=>{if(!j){N(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{N(null)}}},A=g({customModels:i,modelAliases:s,providerAlias:e,type:"llm"}),T=async()=>{if(!u.trim()||f)return;let e=u.trim();if(A.some(t=>t.id===e))return void alert("Model already exists for this provider.");y(!0);try{await c(e),h("")}catch(e){console.log("Error adding model:",e)}finally{y(!1)}},E=async()=>{if(b)return;let e=x.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 l=0;for(let e of a){let t=e.id||e.name||e.model;t&&(A.some(e=>e.id===t)||(await c(t),l+=1))}0===l&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{v(!1)}}},P=x.some(e=>!1!==e.isActive);return(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",p?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,a.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,a.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,a.jsx)("input",{id:"new-compatible-model-input",type:"text",value:u,onChange:e=>h(e.target.value),onKeyDown:e=>"Enter"===e.key&&T(),placeholder:p?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:T,disabled:!u.trim()||f,children:f?"Adding...":"Add"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"download",onClick:E,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."}),A.length>0&&(0,a.jsx)("div",{className:"flex flex-col gap-3",children:A.map(({id:s,alias:l,source:i})=>(0,a.jsx)(k,{modelId:s,fullModel:`${t}/${s}`,copied:r,onCopy:n,onDeleteAlias:()=>"custom"===i?m(s):o(l),onTest:x.length>0?()=>$(s):void 0,testStatus:w[s],isTesting:j===s},`${i}-${e}/${s}`))})]})}w.propTypes={model:v().shape({id:v().string.isRequired}).isRequired,fullModel:v().string.isRequired,alias:v().string,copied:v().string,onCopy:v().func.isRequired,testStatus:v().oneOf(["ok","error"]),isCustom:v().bool,isFree:v().bool,onDeleteAlias:v().func,onTest:v().func,isTesting:v().bool,onDisable:v().func,caps:v().object},C.propTypes={providerStorageAlias:v().string.isRequired,providerDisplayAlias:v().string.isRequired,modelAliases:v().object.isRequired,customModels:v().arrayOf(v().object),copied:v().string,onCopy:v().func.isRequired,onDeleteAlias:v().func.isRequired,onAddCustomModel:v().func.isRequired,onDeleteCustomModel:v().func.isRequired,connections:v().arrayOf(v().shape({id:v().string,isActive:v().bool})).isRequired,isAnthropic:v().bool};var S=s(70217);function $({until:e}){let[t,s]=(0,l.useState)("");return((0,l.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 A({connection:e,proxyPools:t,isOAuth:s,isFirst:i,isLast:r,onMoveUp:n,onMoveDown:o,onToggleActive:c,onUpdateProxy:m,onEdit:x,onDelete:p,oneByOneStatus:u=null,autoPing:h=null}){let[f,g]=(0,l.useState)(!1),[y,b]=(0,l.useState)(!1),v=(0,l.useRef)(null),j=new Map((t||[]).map(e=>[e.id,e])),N=e.providerSpecificData?.proxyPoolId||null,w=N?j.get(N):null,k=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,C=!!N||k,T=w?`Pool: ${w.name}`:N?`Pool: ${N} (inactive/missing)`:k?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",E=h?.provider==="codex"?"Auto-starts the next 5h Codex window after reset by sending a tiny gpt-5.5 request. Consumes a small amount of quota.":"When your 5h quota runs out, auto-sends a request the moment it resets so a new window starts right away.",P="";if(w?.proxyUrl||e.providerSpecificData?.connectionProxyUrl){let t=w?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);P=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{P=t}}let O=w?.noProxy||e.providerSpecificData?.connectionNoProxy||"",I="default";w?.isActive===!0?I="success":(N||k)&&(I="error"),(0,l.useEffect)(()=>{if(!f)return;let e=e=>{v.current&&!v.current.contains(e.target)&&g(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[f]);let z=async e=>{b(!0);try{await m("__none__"===e?null:e)}finally{b(!1),g(!1)}},D=e.authType||(s?"oauth":"apikey"),_="oauth"===D,R="cookie"===D,U=e.name?.trim()||e.email?.trim()||e.displayName?.trim()||(_?"OAuth Account":R?"Cookie Account":"API Key"),M=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,[q,L]=(0,l.useState)(!1),K=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>!!e).sort()[0]||null;(0,l.useEffect)(()=>{let t=()=>{L(!!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||q?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:n,disabled:i,className:`p-0.5 rounded ${i?"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:o,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,a.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base text-text-muted",children:R?"cookie":_?"lock":"key"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:U}),M&&(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:M}),(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,S.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:_?"OAuth":R?"Cookie":"API Key"}),C&&(0,a.jsx)(d.Ex,{variant:I,size:"sm",children:"Proxy"}),q&&!1!==e.isActive&&(0,a.jsx)($,{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()})]}),C&&(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:T,children:T}),P&&(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:P}),O&&(0,a.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:O,children:["no_proxy: ",O]})]})]})]}),(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:()=>g(e=>!e),className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${C?"text-primary":"text-text-muted hover:text-primary"}`,disabled:y,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:y?"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:()=>z("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!N?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,a.jsx)("button",{onClick:()=>z(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${N===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),h&&(0,a.jsx)(d.m_,{text:E,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:x,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:p,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"})]})]})}$.propTypes={until:v().string.isRequired},A.propTypes={connection:v().shape({id:v().string,name:v().string,email:v().string,displayName:v().string,modelLockUntil:v().string,testStatus:v().string,isActive:v().bool,lastError:v().string,priority:v().number,globalPriority:v().number}).isRequired,proxyPools:v().arrayOf(v().shape({id:v().string,name:v().string,proxyUrl:v().string,noProxy:v().string,isActive:v().bool})),isOAuth:v().bool.isRequired,isFirst:v().bool.isRequired,isLast:v().bool.isRequired,onMoveUp:v().func.isRequired,onMoveDown:v().func.isRequired,onToggleActive:v().func.isRequired,onUpdateProxy:v().func,onEdit:v().func.isRequired,onDelete:v().func.isRequired,oneByOneStatus:v().shape({state:v().string,error:v().string}),autoPing:v().shape({on:v().bool,onToggle:v().func,provider:v().string})};let T=`name1|sk-key1
2
2
  name2|sk-key2
3
- sk-key-only-auto-named`;function E({isOpen:e,provider:t,providerName:s,isCompatible:i,isAnthropic:r,authType:n,authHint:o,website:m,proxyPools:x,error:p,onSave:u,onBulkDone:h,onClose:f}){let g="__none__",y="ollama-local"===t,b="cookie"===n,v="xai"===t&&!b,j=b?"Cookie Value":"API Key",N=b?"grok-web"===t?"sso=xxxxx... or just the raw value":"chatglm-cn"===t?"Paste your full chatglm.cn cookies, or just the chatglm_refresh_token value (eyJhbGc...)":"eyJhbGciOi...":v?"xai-...":"",w="azure"===t,k="cloudflare-ai"===t,C=c.Q2?.[t]?.regions||null,S=c.Q2?.[t]?.defaultRegion||C?.[0]?.id||"",[$,A]=(0,l.useState)({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:g,ollamaHostUrl:""}),[P,O]=(0,l.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[I,z]=(0,l.useState)({accountId:""}),[D,_]=(0,l.useState)(S),[U,R]=(0,l.useState)(!1),[M,q]=(0,l.useState)(null),[L,K]=(0,l.useState)(!1),[F,J]=(0,l.useState)("single"),[W,B]=(0,l.useState)(""),[H,G]=(0,l.useState)(null),Q=()=>y&&$.ollamaHostUrl.trim()?{baseUrl:$.ollamaHostUrl.trim()}:w?{azureEndpoint:P.azureEndpoint,apiVersion:P.apiVersion,deployment:P.deployment,organization:P.organization}:k?{accountId:I.accountId}:C&&D?{region:D}:void 0,V=async()=>{R(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:$.apiKey,providerSpecificData:Q()})}),s=await e.json();q(s.valid?"success":"failed")}catch{q("failed")}finally{R(!1)}},Z=async()=>{if(t&&(y||$.apiKey)&&(y||$.name)&&(!i||$.defaultModel.trim())){K(!0);try{let e=!1;try{R(!0),q(null);let s=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:$.apiKey,providerSpecificData:Q()})});e=!!(await s.json()).valid,q(e?"success":"failed")}catch{q("failed")}finally{R(!1)}await u({name:$.name||(y?"Ollama Local":""),apiKey:$.apiKey,defaultModel:i?$.defaultModel.trim():void 0,priority:$.priority,proxyPoolId:$.proxyPoolId===g?null:$.proxyPoolId,testStatus:e?"active":"unknown",providerSpecificData:Q()})}finally{K(!1)}}},X=async()=>{let e=W.split("\n").map(e=>e.trim()).filter(Boolean);if(!e.length)return;K(!0),G(null);let s=0,a=0;for(let l=0;l<e.length;l++){let i=e[l].split("|"),r=i.length>=2?i.slice(1).join("|").trim():i[0].trim(),n=i.length>=2?i[0].trim():"Key",o=`${n} ${l+1}`;try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:r,name:o,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:T,value:W,onChange:e=>B(e.target.value)}),H&&(0,a.jsxs)("div",{className:`text-sm font-medium ${H.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",H.success," added",H.failed>0?`, ✗ ${H.failed} failed`:""]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:X,fullWidth:!0,disabled:L||!W.trim(),children:L?"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=>A({...$,name:e.target.value}),placeholder:y?"Ollama Local":"Production Key"}),y&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:"Ollama Host URL",value:$.ollamaHostUrl,onChange:e=>A({...$,ollamaHostUrl:e.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:V,disabled:U||L,variant:"secondary",children:U?"Checking...":"Check"})})]}),!y&&(0,a.jsxs)("div",{className:"flex gap-2",children:[b?(0,a.jsxs)("div",{className:"flex-1 flex flex-col gap-1",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-text-muted",children:j}),(0,a.jsx)("textarea",{value:$.apiKey,onChange:e=>A({...$,apiKey:e.target.value}),placeholder:N,rows:5,spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",className:"w-full rounded-lg border border-border bg-input px-3 py-2 text-sm text-text-main placeholder:text-text-muted focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary font-mono resize-y"})]}):(0,a.jsx)(d.pd,{label:j,type:"password",value:$.apiKey,onChange:e=>A({...$,apiKey:e.target.value}),placeholder:N,className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:V,disabled:!$.apiKey||U||L,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&&o&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[o,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?:\/\//,"")]})]})]}),C&&(0,a.jsx)(d.l6,{label:"Region",value:D,onChange:e=>_(e.target.value),options:C.map(e=>({value:e.id,label:e.label}))}),i&&(0,a.jsx)(d.pd,{label:"Default Model",value:$.defaultModel,onChange:e=>A({...$,defaultModel:e.target.value}),placeholder:r?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),y&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,a.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,a.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),M&&(0,a.jsx)(d.Ex,{variant:"success"===M?"success":"error",children:"success"===M?"Valid":"Invalid"}),p&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:p}),i&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Enter the model ID exactly as your compatible endpoint expects it. This model will be saved as the connection default."}),k&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,a.jsx)(d.pd,{label:"Account ID",value:I.accountId,onChange:e=>z({...I,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:P.azureEndpoint,onChange:e=>O({...P,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,a.jsx)(d.pd,{label:"Deployment Name",value:P.deployment,onChange:e=>O({...P,deployment:e.target.value}),placeholder:"gpt-4"}),(0,a.jsx)(d.pd,{label:"API Version",value:P.apiVersion,onChange:e=>O({...P,apiVersion:e.target.value}),placeholder:"2024-10-01-preview"}),(0,a.jsx)(d.pd,{label:"Organization",value:P.organization,onChange:e=>O({...P,organization:e.target.value}),placeholder:"Organization ID"})]})]}),(0,a.jsx)(d.pd,{label:"Priority",type:"number",value:$.priority,onChange:e=>A({...$,priority:Number.parseInt(e.target.value)||1})}),(0,a.jsx)(d.l6,{label:"Proxy Pool",value:$.proxyPoolId,onChange:e=>A({...$,proxyPoolId:e.target.value}),options:[{value:g,label:"None"},...(x||[]).map(e=>({value:e.id,label:e.name}))],placeholder:"None"}),0===(x||[]).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:Z,fullWidth:!0,disabled:L||!y&&(!$.name||!$.apiKey)||i&&!$.defaultModel.trim()||w&&(!P.azureEndpoint||!P.deployment||!P.organization)||k&&!I.accountId,children:L?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function P({isOpen:e,node:t,onSave:s,onClose:i,isAnthropic:r}){let[n,o]=(0,l.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[c,m]=(0,l.useState)(!1),[x,p]=(0,l.useState)(""),[u,h]=(0,l.useState)(""),[f,g]=(0,l.useState)(!1),[y,b]=(0,l.useState)(null);(0,l.useEffect)(()=>{t&&o({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(r?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,r]);let v=async()=>{if(n.name.trim()&&n.prefix.trim()&&n.baseUrl.trim()){m(!0);try{let e={name:n.name,prefix:n.prefix,baseUrl:n.baseUrl};r||(e.apiType=n.apiType),await s(e)}finally{m(!1)}}},j=async()=>{g(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:n.baseUrl,apiKey:x,type:r?"anthropic-compatible":"openai-compatible",modelId:u.trim()||void 0})}),t=await e.json();b(t.valid?"success":"failed")}catch{b("failed")}finally{g(!1)}};return t?(0,a.jsx)(d.aF,{isOpen:e,title:`Edit ${r?"Anthropic":"OpenAI"} Compatible`,onClose:i,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(d.pd,{label:"Name",value:n.name,onChange:e=>o({...n,name:e.target.value}),placeholder:`${r?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,a.jsx)(d.pd,{label:"Prefix",value:n.prefix,onChange:e=>o({...n,prefix:e.target.value}),placeholder:r?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!r&&(0,a.jsx)(d.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:n.apiType,onChange:e=>o({...n,apiType:e.target.value})}),(0,a.jsx)(d.pd,{label:"Base URL",value:n.baseUrl,onChange:e=>o({...n,baseUrl:e.target.value}),placeholder:r?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${r?"Anthropic":"OpenAI"}-compatible API.`}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:"API Key (for Check)",type:"password",value:x,onChange:e=>p(e.target.value),className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:j,disabled:!x||f||!n.baseUrl.trim(),variant:"secondary",children:f?"Checking...":"Check"})})]}),(0,a.jsx)(d.pd,{label:"Model ID (optional)",value:u,onChange:e=>h(e.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),y&&(0,a.jsx)(d.Ex,{variant:"success"===y?"success":"error",children:"success"===y?"Valid":"Invalid"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:v,fullWidth:!0,disabled:!n.name.trim()||!n.prefix.trim()||!n.baseUrl.trim()||c,children:c?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:i,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function O({isOpen:e,providerAlias:t,providerDisplayAlias:s,onSave:i,onClose:r}){let[n,o]=(0,l.useState)(""),[c,m]=(0,l.useState)(null),[x,p]=(0,l.useState)(""),[u,h]=(0,l.useState)(!1);(0,l.useEffect)(()=>{e&&(o(""),m(null),p(""))},[e]);let f=e=>{let s=`${t}/`;return e.startsWith(s)?e.slice(s.length):e},g=async()=>{let e=f(n.trim());if(e){m("testing"),p("");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"),p(a.error||"")}catch(e){m("error"),p(e.message)}}},y=async()=>{let e=f(n.trim());if(e&&!u){h(!0);try{await i(e)}finally{h(!1)}}};return(0,a.jsx)(d.aF,{isOpen:e,onClose:r,title:"Add Custom Model",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:n,onChange:e=>{o(e.target.value),m(null),p("")},onKeyDown:e=>{"Enter"===e.key&&g()},placeholder:"e.g. claude-opus-4-5",className:"flex-1 px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",autoFocus:!0}),(0,a.jsx)(d.$n,{variant:"secondary",icon:"science",loading:"testing"===c,onClick:g,disabled:!n.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(n.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:x||"Model not reachable"})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,a.jsx)(d.$n,{onClick:r,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,a.jsx)(d.$n,{onClick:y,fullWidth:!0,size:"sm",disabled:!n.trim()||u,children:u?"Adding...":"Add Model"})]})]})})}E.propTypes={isOpen:v().bool.isRequired,provider:v().string,providerName:v().string,isCompatible:v().bool,isAnthropic:v().bool,authType:v().string,authHint:v().string,website:v().string,proxyPools:v().arrayOf(v().shape({id:v().string,name:v().string})),error:v().string,onSave:v().func.isRequired,onBulkDone:v().func,onClose:v().func.isRequired},P.propTypes={isOpen:v().bool.isRequired,node:v().shape({id:v().string,name:v().string,prefix:v().string,apiType:v().string,baseUrl:v().string}),onSave:v().func.isRequired,onClose:v().func.isRequired,isAnthropic:v().bool},O.propTypes={isOpen:v().bool.isRequired,providerAlias:v().string.isRequired,providerDisplayAlias:v().string.isRequired,onSave:v().func.isRequired,onClose:v().func.isRequired};let I=`[
3
+ sk-key-only-auto-named`;function E({isOpen:e,provider:t,providerName:s,isCompatible:i,isAnthropic:r,authType:n,authHint:o,website:m,proxyPools:x,error:p,onSave:u,onBulkDone:h,onClose:f}){let g="__none__",y="ollama-local"===t,b="cookie"===n,v="xai"===t&&!b,j="tokenrouter"===t,N=b?"Cookie Value":"API Key",w=b?"grok-web"===t?"sso=xxxxx... or just the raw value":"chatglm-cn"===t?"Paste your full chatglm.cn cookies, or just the chatglm_refresh_token value (eyJhbGc...)":"eyJhbGciOi...":v?"xai-...":"",k="azure"===t,C="cloudflare-ai"===t,S=c.Q2?.[t]?.regions||null,$=c.Q2?.[t]?.defaultRegion||S?.[0]?.id||"",[A,P]=(0,l.useState)({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:g,ollamaHostUrl:""}),[O,I]=(0,l.useState)(""),[z,D]=(0,l.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[_,R]=(0,l.useState)({accountId:""}),[U,M]=(0,l.useState)($),[q,L]=(0,l.useState)(!1),[K,F]=(0,l.useState)(null),[J,W]=(0,l.useState)(!1),[B,H]=(0,l.useState)("single"),[G,Q]=(0,l.useState)(""),[V,Z]=(0,l.useState)(null),X=()=>y&&A.ollamaHostUrl.trim()?{baseUrl:A.ollamaHostUrl.trim()}:k?{azureEndpoint:z.azureEndpoint,apiVersion:z.apiVersion,deployment:z.deployment,organization:z.organization}:C?{accountId:_.accountId}:j&&O.trim()?{mgmtKey:O.trim()}:S&&U?{region:U}:void 0,Y=async()=>{L(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:A.apiKey,providerSpecificData:X()})}),s=await e.json();F(s.valid?"success":"failed")}catch{F("failed")}finally{L(!1)}},ee=async()=>{if(t&&(y||A.apiKey)&&(y||A.name)&&(!i||A.defaultModel.trim())){W(!0);try{let e=!1;try{L(!0),F(null);let s=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:A.apiKey,providerSpecificData:X()})});e=!!(await s.json()).valid,F(e?"success":"failed")}catch{F("failed")}finally{L(!1)}await u({name:A.name||(y?"Ollama Local":""),apiKey:A.apiKey,defaultModel:i?A.defaultModel.trim():void 0,priority:A.priority,proxyPoolId:A.proxyPoolId===g?null:A.proxyPoolId,testStatus:e?"active":"unknown",providerSpecificData:X()})}finally{W(!1)}}},et=async()=>{let e=G.split("\n").map(e=>e.trim()).filter(Boolean);if(!e.length)return;W(!0),Z(null);let s=0,a=0;for(let l=0;l<e.length;l++){let i=e[l].split("|"),r=i.length>=2?i.slice(1).join("|").trim():i[0].trim(),n=i.length>=2?i[0].trim():"Key",o=`${n} ${l+1}`;try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:r,name:o,priority:1,testStatus:"unknown"})})).ok?s++:a++}catch{a++}}W(!1),Z({success:s,failed:a}),s>0&&h&&h()};return t?(0,a.jsx)(d.aF,{isOpen:e,title:`Add ${s||t} ${N}`,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"===B?"primary":"ghost",onClick:()=>{H("single"),Z(null)},children:"Single"}),(0,a.jsx)(d.$n,{size:"sm",variant:"bulk"===B?"primary":"ghost",onClick:()=>{H("bulk"),Z(null)},children:"Bulk Add"})]}),"bulk"===B&&(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:T,value:G,onChange:e=>Q(e.target.value)}),V&&(0,a.jsxs)("div",{className:`text-sm font-medium ${V.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",V.success," added",V.failed>0?`, ✗ ${V.failed} failed`:""]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:et,fullWidth:!0,disabled:J||!G.trim(),children:J?"Adding...":"Add All Keys"}),(0,a.jsx)(d.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"single"===B&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.pd,{label:"Name",value:A.name,onChange:e=>P({...A,name:e.target.value}),placeholder:y?"Ollama Local":"Production Key"}),y&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:"Ollama Host URL",value:A.ollamaHostUrl,onChange:e=>P({...A,ollamaHostUrl:e.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:Y,disabled:q||J,variant:"secondary",children:q?"Checking...":"Check"})})]}),!y&&(0,a.jsxs)("div",{className:"flex gap-2",children:[b?(0,a.jsxs)("div",{className:"flex-1 flex flex-col gap-1",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-text-muted",children:N}),(0,a.jsx)("textarea",{value:A.apiKey,onChange:e=>P({...A,apiKey:e.target.value}),placeholder:w,rows:5,spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",className:"w-full rounded-lg border border-border bg-input px-3 py-2 text-sm text-text-main placeholder:text-text-muted focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary font-mono resize-y"})]}):(0,a.jsx)(d.pd,{label:N,type:"password",value:A.apiKey,onChange:e=>P({...A,apiKey:e.target.value}),placeholder:w,className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:Y,disabled:!A.apiKey||q||J,variant:"secondary",children:q?"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&&o&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[o,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?:\/\//,"")]})]})]}),S&&(0,a.jsx)(d.l6,{label:"Region",value:U,onChange:e=>M(e.target.value),options:S.map(e=>({value:e.id,label:e.label}))}),i&&(0,a.jsx)(d.pd,{label:"Default Model",value:A.defaultModel,onChange:e=>P({...A,defaultModel:e.target.value}),placeholder:r?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),y&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,a.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,a.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),K&&(0,a.jsx)(d.Ex,{variant:"success"===K?"success":"error",children:"success"===K?"Valid":"Invalid"}),p&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:p}),i&&(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."}),j&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"TokenRouter Management Key (optional)"}),(0,a.jsx)(d.pd,{label:"Management Key",type:"password",value:O,onChange:e=>I(e.target.value),placeholder:"your_management_key..."}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-2",children:"The management key is separate from the chat API key (sk-...) and is required for Quota Tracker to read your wallet balance. Without it, chat still works but quota tracking is disabled. Get it from the TokenRouter dashboard."})]}),C&&(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:_.accountId,onChange:e=>R({..._,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"})]})]}),k&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)(d.pd,{label:"Azure Endpoint",value:z.azureEndpoint,onChange:e=>D({...z,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,a.jsx)(d.pd,{label:"Deployment Name",value:z.deployment,onChange:e=>D({...z,deployment:e.target.value}),placeholder:"gpt-4"}),(0,a.jsx)(d.pd,{label:"API Version",value:z.apiVersion,onChange:e=>D({...z,apiVersion:e.target.value}),placeholder:"2024-10-01-preview"}),(0,a.jsx)(d.pd,{label:"Organization",value:z.organization,onChange:e=>D({...z,organization:e.target.value}),placeholder:"Organization ID"})]})]}),(0,a.jsx)(d.pd,{label:"Priority",type:"number",value:A.priority,onChange:e=>P({...A,priority:Number.parseInt(e.target.value)||1})}),(0,a.jsx)(d.l6,{label:"Proxy Pool",value:A.proxyPoolId,onChange:e=>P({...A,proxyPoolId:e.target.value}),options:[{value:g,label:"None"},...(x||[]).map(e=>({value:e.id,label:e.name}))],placeholder:"None"}),0===(x||[]).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:ee,fullWidth:!0,disabled:J||!y&&(!A.name||!A.apiKey)||i&&!A.defaultModel.trim()||k&&(!z.azureEndpoint||!z.deployment||!z.organization)||C&&!_.accountId,children:J?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function P({isOpen:e,node:t,onSave:s,onClose:i,isAnthropic:r}){let[n,o]=(0,l.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[c,m]=(0,l.useState)(!1),[x,p]=(0,l.useState)(""),[u,h]=(0,l.useState)(""),[f,g]=(0,l.useState)(!1),[y,b]=(0,l.useState)(null);(0,l.useEffect)(()=>{t&&o({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(r?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,r]);let v=async()=>{if(n.name.trim()&&n.prefix.trim()&&n.baseUrl.trim()){m(!0);try{let e={name:n.name,prefix:n.prefix,baseUrl:n.baseUrl};r||(e.apiType=n.apiType),await s(e)}finally{m(!1)}}},j=async()=>{g(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:n.baseUrl,apiKey:x,type:r?"anthropic-compatible":"openai-compatible",modelId:u.trim()||void 0})}),t=await e.json();b(t.valid?"success":"failed")}catch{b("failed")}finally{g(!1)}};return t?(0,a.jsx)(d.aF,{isOpen:e,title:`Edit ${r?"Anthropic":"OpenAI"} Compatible`,onClose:i,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(d.pd,{label:"Name",value:n.name,onChange:e=>o({...n,name:e.target.value}),placeholder:`${r?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,a.jsx)(d.pd,{label:"Prefix",value:n.prefix,onChange:e=>o({...n,prefix:e.target.value}),placeholder:r?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!r&&(0,a.jsx)(d.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:n.apiType,onChange:e=>o({...n,apiType:e.target.value})}),(0,a.jsx)(d.pd,{label:"Base URL",value:n.baseUrl,onChange:e=>o({...n,baseUrl:e.target.value}),placeholder:r?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${r?"Anthropic":"OpenAI"}-compatible API.`}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:"API Key (for Check)",type:"password",value:x,onChange:e=>p(e.target.value),className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:j,disabled:!x||f||!n.baseUrl.trim(),variant:"secondary",children:f?"Checking...":"Check"})})]}),(0,a.jsx)(d.pd,{label:"Model ID (optional)",value:u,onChange:e=>h(e.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),y&&(0,a.jsx)(d.Ex,{variant:"success"===y?"success":"error",children:"success"===y?"Valid":"Invalid"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:v,fullWidth:!0,disabled:!n.name.trim()||!n.prefix.trim()||!n.baseUrl.trim()||c,children:c?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:i,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function O({isOpen:e,providerAlias:t,providerDisplayAlias:s,onSave:i,onClose:r}){let[n,o]=(0,l.useState)(""),[c,m]=(0,l.useState)(null),[x,p]=(0,l.useState)(""),[u,h]=(0,l.useState)(!1);(0,l.useEffect)(()=>{e&&(o(""),m(null),p(""))},[e]);let f=e=>{let s=`${t}/`;return e.startsWith(s)?e.slice(s.length):e},g=async()=>{let e=f(n.trim());if(e){m("testing"),p("");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"),p(a.error||"")}catch(e){m("error"),p(e.message)}}},y=async()=>{let e=f(n.trim());if(e&&!u){h(!0);try{await i(e)}finally{h(!1)}}};return(0,a.jsx)(d.aF,{isOpen:e,onClose:r,title:"Add Custom Model",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:n,onChange:e=>{o(e.target.value),m(null),p("")},onKeyDown:e=>{"Enter"===e.key&&g()},placeholder:"e.g. claude-opus-4-5",className:"flex-1 px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",autoFocus:!0}),(0,a.jsx)(d.$n,{variant:"secondary",icon:"science",loading:"testing"===c,onClick:g,disabled:!n.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(n.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:x||"Model not reachable"})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,a.jsx)(d.$n,{onClick:r,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,a.jsx)(d.$n,{onClick:y,fullWidth:!0,size:"sm",disabled:!n.trim()||u,children:u?"Adding...":"Add Model"})]})]})})}E.propTypes={isOpen:v().bool.isRequired,provider:v().string,providerName:v().string,isCompatible:v().bool,isAnthropic:v().bool,authType:v().string,authHint:v().string,website:v().string,proxyPools:v().arrayOf(v().shape({id:v().string,name:v().string})),error:v().string,onSave:v().func.isRequired,onBulkDone:v().func,onClose:v().func.isRequired},P.propTypes={isOpen:v().bool.isRequired,node:v().shape({id:v().string,name:v().string,prefix:v().string,apiType:v().string,baseUrl:v().string}),onSave:v().func.isRequired,onClose:v().func.isRequired,isAnthropic:v().bool},O.propTypes={isOpen:v().bool.isRequired,providerAlias:v().string.isRequired,providerDisplayAlias:v().string.isRequired,onSave:v().func.isRequired,onClose:v().func.isRequired};let I=`[
4
4
  {
5
5
  "accessToken": "eyJhbGc...",
6
6
  "refreshToken": "rt_...",
7
7
  "idToken": "eyJhbGc...",
8
8
  "email": "user@example.com"
9
9
  }
10
- ]`;function z({isOpen:e,onClose:t,onSuccess:s}){let[i,r]=(0,l.useState)(""),[n,o]=(0,l.useState)(!1),[c,m]=(0,l.useState)(""),[x,p]=(0,l.useState)(null),h=()=>{n||(r(""),m(""),p(null),t())},f=async()=>{var e;let t;m(""),p(null);let a=i.trim();if(!a)return;try{t=JSON.parse(a)}catch(e){m(`${(0,u.Tl)("Invalid JSON")}: ${e.message}`);return}let l=Array.isArray(e=t)?e:e&&"object"==typeof e?Array.isArray(e.accounts)?e.accounts:[e]:null;if(!l||0===l.length)return void m((0,u.Tl)("No accounts found in input"));o(!0);try{let e=await fetch("/api/oauth/codex/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:l})}),t=await e.json();if(!e.ok)return void m(t?.error||`Request failed: ${e.status}`);p(t),t.success>0&&"function"==typeof s&&s()}catch(e){m(e.message||(0,u.Tl)("Request failed"))}finally{o(!1)}},g=x?.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:I,value:i,onChange:e=>r(e.target.value),disabled:n}),c&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:c}),x&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:`text-sm font-medium ${x.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",x.success," ",(0,u.Tl)("added"),x.failed>0?`, ✗ ${x.failed} ${(0,u.Tl)("failed")}`:""]}),g.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:g.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:n||!i.trim(),children:n?(0,u.Tl)("Importing..."):(0,u.Tl)("Import All")}),(0,a.jsx)(d.$n,{onClick:h,variant:"ghost",fullWidth:!0,disabled:n,children:(0,u.Tl)("Close")})]})]})})}z.propTypes={isOpen:v().bool.isRequired,onClose:v().func.isRequired,onSuccess:v().func};let D={healthy:{variant:"success",label:"Pool healthy",icon:"shield"},degraded:{variant:"warning",label:"Pool degraded",icon:"warning"},exhausted:{variant:"error",label:"Pool exhausted",icon:"error"}};function _({providerId:e}){let[t,s]=(0,l.useState)(null);if((0,l.useEffect)(()=>{let t;if(!e)return;let a=!1,l=async()=>{try{let t=await fetch(`/api/providers/${e}/vault-pool`,{cache:"no-store"});if(!t.ok)return;let l=await t.json();a||s(l)}catch{}};l();let i=()=>{t||(t=setInterval(l,1e4))},r=()=>{t&&(clearInterval(t),t=null)},n=()=>document.hidden?r():i();return i(),document.addEventListener("visibilitychange",n),()=>{a=!0,r(),document.removeEventListener("visibilitychange",n)}},[e]),!t||!t.hasPool)return null;let i=D[t.status]||D.healthy;return(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",title:"Admin-provided shared key pool. Keys are hidden; only counts are shown.",children:[(0,a.jsx)(d.Ex,{variant:i.variant,size:"sm",icon:i.icon,children:i.label}),(0,a.jsxs)(d.Ex,{variant:"info",size:"sm",icon:"key",children:[t.total," pool keys"]}),(0,a.jsxs)(d.Ex,{variant:"success",size:"sm",icon:"check_circle",children:[t.available," available"]}),t.rateLimited>0&&(0,a.jsxs)(d.Ex,{variant:"warning",size:"sm",icon:"schedule",children:[t.rateLimited," cooling"]})]})}function U({connectionId:e,cookie:t,currentPlan:s="free",onPlanChanged:i}){let r,[n,o]=(0,l.useState)([]),[c,m]=(0,l.useState)(s),[x,p]=(0,l.useState)(null),[u,h]=(0,l.useState)(!1),[f,g]=(0,l.useState)(!1),[y,b]=(0,l.useState)(null),v=(r=String(t||"").match(/ctoken=([^;]+)/),r?.[1]||"");(0,l.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch("/api/providers/zenmux-free/zenmux-plans",{cache:"no-store"});if(!t.ok)return;let s=await t.json();!e&&Array.isArray(s.plans)&&o(s.plans)}catch{}})(),()=>{e=!0}},[]),(0,l.useEffect)(()=>{if(!v)return;let e=!1;return h(!0),(async()=>{try{let t=await fetch("/api/providers/zenmux-free/zenmux-plans",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ctoken:v})});if(!t.ok)return;let a=await t.json();!e&&a.planKey&&(p(a.planKey),s&&"free"!==s||m(a.planKey))}catch{}finally{e||h(!1)}})(),()=>{e=!0}},[v,s]);let j=async t=>{let a=t.target.value;m(a),g(!0),b(null);try{if(!(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerSpecificData:{zenmuxPlan:a}})})).ok)throw Error("Failed to save plan");i?.(a)}catch(e){b(e.message),m(s)}finally{g(!1)}},N=x&&x===c;return 0===n.length?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"ZenMux Plan"}),(0,a.jsx)("select",{value:c,onChange:j,disabled:!0,className:"appearance-none rounded-brand border border-border bg-surface-2 py-1.5 pl-3 pr-8 text-xs text-text-muted [-webkit-appearance:none] [-moz-appearance:none]",children:(0,a.jsxs)("option",{value:c,children:[c," (loading…)"]})})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(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:"ZenMux Plan"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("select",{value:c,onChange:j,disabled:f,title:"Select your ZenMux subscription plan. Models from this plan will be available.",className:"appearance-none rounded-brand border border-border bg-surface-2 py-1.5 pl-3 pr-8 text-xs text-text-main [-webkit-appearance:none] [-moz-appearance:none] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/35 disabled:opacity-50",children:n.map(e=>(0,a.jsxs)("option",{value:e.planKey,children:[e.name," (",e.modelCount," models",e.price>0?`, $${e.price}/mo`:", free",")"]},e.planKey))}),(0,a.jsx)("span",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"expand_more"})})]}),u&&(0,a.jsx)(d.Ex,{variant:"info",size:"sm",children:"Detecting…"}),N&&!u&&(0,a.jsx)(d.Ex,{variant:"success",size:"sm",icon:"check_circle",dot:!0,children:"Auto-detected"}),f&&(0,a.jsx)(d.Ex,{variant:"info",size:"sm",children:"Saving…"}),y&&(0,a.jsx)(d.Ex,{variant:"error",size:"sm",icon:"error",children:y})]}),(0,a.jsx)("p",{className:"text-[11px] text-text-muted",children:x?`Plan auto-detected from your ctoken: ${x}. You can override manually if needed.`:"Select your ZenMux subscription plan. Models available depend on your plan."})]})}function R({providerId:e,hours:t=24}){let[s,i]=(0,l.useState)(null);if((0,l.useEffect)(()=>{if(!e)return;let s=!1,a=async()=>{try{let a=await fetch(`/api/providers/${e}/health-timeline?hours=${t}`,{cache:"no-store"});if(!a.ok)return;let l=await a.json();s||i(l.timeline||[])}catch{}};a();let l=setInterval(a,6e4),r=()=>{document.hidden?clearInterval(l):(clearInterval(l),a(),l=setInterval(a,6e4))};return document.addEventListener("visibilitychange",r),()=>{s=!0,clearInterval(l),document.removeEventListener("visibilitychange",r)}},[e,t]),!s)return(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] animate-pulse",children:"monitor_heart"}),"Loading health timeline..."]});if(0===s.length||s.every(e=>0===e.ok&&0===e.err))return(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"monitor_heart"}),"No request history yet."]});let r=s.length,n=s.reduce((e,t)=>e+t.ok+t.err,0),o=s.reduce((e,t)=>e+t.err,0),d=Math.max(...s.map(e=>e.ok+e.err),1),c=Math.max(...s.map(e=>e.latency),1),m=Math.max(6*r,120),x=Math.max(m/r-1,2),p=s.filter(e=>e.latency>0).map((e,t)=>{let s=t/Math.max(r-1,1)*m,a=32-e.latency/c*19.2-2;return`${s.toFixed(1)},${a.toFixed(1)}`}),u=p.length>1?`M${p.join(" L")}`:"",h=n>0?Math.round((n-o)/n*100):null;return(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-text-muted",children:"Health (24h)"}),null!==h&&(0,a.jsxs)("span",{className:`text-[10px] font-bold ${h>=90?"text-success":h>=70?"text-warning":"text-danger"}`,children:[h,"% success \xb7 ",n," requests \xb7 ",o," errors"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[10px] text-text-muted",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"inline-block size-2 rounded-sm bg-success"})," OK"]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"inline-block size-2 rounded-sm bg-danger"})," Error"]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"inline-block h-0.5 w-3 bg-info"})," Latency"]})]})]}),(0,a.jsxs)("svg",{width:m,height:32,className:"overflow-visible",children:[s.map((e,t)=>{let s=m/r*t;if(0===e.ok+e.err)return null;let l=e.ok/d*32,i=e.err/d*32;return(0,a.jsxs)("g",{children:[(0,a.jsx)("rect",{x:s,y:32-l-i,width:x,height:i,rx:.5,className:"fill-danger/60"}),(0,a.jsx)("rect",{x:s,y:32-l,width:x,height:l,rx:.5,className:"fill-success/60"})]},t)}),u&&(0,a.jsx)("path",{d:u,fill:"none",strokeWidth:1,className:"stroke-info",strokeDasharray:"2 2"})]})]})}function M({connectionId:e}){let[t,s]=(0,l.useState)(null),[i,r]=(0,l.useState)(!0);if((0,l.useEffect)(()=>{if(!e)return;let t=!1;return(async()=>{try{let a=await fetch(`/api/providers/${e}/freebuff-profile`,{cache:"no-store"});if(!a.ok)return;let l=await a.json();t||s(l)}catch{}t||r(!1)})(),()=>{t=!0}},[e]),i)return(0,a.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border-subtle bg-surface-2/50 px-3 py-2",children:[(0,a.jsx)("div",{className:"size-8 animate-pulse rounded-full bg-sidebar"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"h-3 w-32 animate-pulse rounded bg-sidebar"}),(0,a.jsx)("div",{className:"h-2 w-48 animate-pulse rounded bg-sidebar"})]})]});if(!t)return null;let n=t.expires?new Date(t.expires):null,o=n?Math.ceil((n.getTime()-Date.now())/864e5):null,c=null!==o&&o<=3;return(0,a.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border-subtle bg-surface-2/50 px-3 py-2",children:[t.image?(0,a.jsx)("img",{src:t.image,alt:t.name,className:"size-9 rounded-full object-cover ring-2 ring-border-subtle"}):(0,a.jsx)("div",{className:"flex size-9 items-center justify-center rounded-full bg-primary/10 text-sm font-bold text-primary",children:t.name?.charAt(0)?.toUpperCase()||"F"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("p",{className:"truncate text-sm font-medium text-text-main",children:t.name}),t.email&&(0,a.jsx)("span",{className:"truncate text-xs text-text-muted",children:t.email})]}),n&&(0,a.jsxs)("div",{className:"mt-0.5 flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px] text-text-muted",children:"schedule"}),(0,a.jsxs)("span",{className:"text-[11px] text-text-muted",children:["Session expires ",n.toLocaleDateString()]}),null!==o&&(0,a.jsxs)(d.Ex,{variant:c?"warning":"success",size:"sm",children:[o,"d left"]})]})]})]})}function q({connectionId:e}){let[t,s]=(0,l.useState)(null),[i,r]=(0,l.useState)(!0);if((0,l.useEffect)(()=>{if(!e)return;let t=!1;return(async()=>{try{let a=await fetch(`/api/providers/${e}/v0-profile`,{cache:"no-store"});if(!a.ok)return;let l=await a.json();t||s(l)}catch{}t||r(!1)})(),()=>{t=!0}},[e]),i)return(0,a.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border-subtle bg-surface-2/50 px-3 py-2",children:[(0,a.jsx)("div",{className:"size-8 animate-pulse rounded-full bg-sidebar"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"h-3 w-32 animate-pulse rounded bg-sidebar"}),(0,a.jsx)("div",{className:"h-2 w-48 animate-pulse rounded bg-sidebar"})]})]});if(!t?.profile&&!t?.balance)return null;let{profile:n,balance:o}=t;return(0,a.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border-subtle bg-surface-2/50 px-3 py-2",children:[n?.image?(0,a.jsx)("img",{src:n.image,alt:n.name,className:"size-9 rounded-full object-cover ring-2 ring-border-subtle"}):(0,a.jsx)("div",{className:"flex size-9 items-center justify-center rounded-full bg-primary/10 text-sm font-bold text-primary",children:n?.name?.charAt(0)?.toUpperCase()||"v"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("p",{className:"truncate text-sm font-medium text-text-main",children:n?.name||"User"}),n?.email&&(0,a.jsx)("span",{className:"truncate text-xs text-text-muted",children:n.email})]}),(0,a.jsxs)("div",{className:"mt-0.5 flex items-center gap-1.5",children:[n?.plan&&(0,a.jsx)(d.Ex,{variant:"v0-free"===n.plan?"default":"primary",size:"sm",children:"v0-free"===n.plan?"Free":n.plan}),n?.teamName&&(0,a.jsx)("span",{className:"truncate text-[11px] text-text-muted",children:n.teamName})]})]}),o&&(0,a.jsxs)("div",{className:"flex shrink-0 flex-col items-end",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-warning",children:"bolt"}),(0,a.jsx)("span",{className:"font-mono text-sm font-bold text-text-main",children:o.remaining}),(0,a.jsxs)("span",{className:"text-[10px] text-text-muted",children:["/",o.total||"?"]})]}),(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"credits left"})]})]})}function L({connectionId:e}){let[t,s]=(0,l.useState)(null),[i,r]=(0,l.useState)(!0);return((0,l.useEffect)(()=>{if(!e)return;let t=!1;return(async()=>{try{let a=await fetch(`/api/providers/${e}/qwencloud-profile`,{cache:"no-store"});if(!a.ok)return;let l=await a.json();t||s(l)}catch{}t||r(!1)})(),()=>{t=!0}},[e]),i)?(0,a.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border-subtle bg-surface-2/50 px-3 py-2",children:[(0,a.jsx)("div",{className:"size-8 animate-pulse rounded-full bg-sidebar"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"h-3 w-32 animate-pulse rounded bg-sidebar"}),(0,a.jsx)("div",{className:"h-2 w-48 animate-pulse rounded bg-sidebar"})]})]}):t?(0,a.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border-subtle bg-surface-2/50 px-3 py-2",children:[t.image?(0,a.jsx)("img",{src:t.image,alt:t.name,className:"size-9 rounded-full object-cover ring-2 ring-border-subtle"}):(0,a.jsx)("div",{className:"flex size-9 items-center justify-center rounded-full bg-primary/10 text-sm font-bold text-primary",children:t.name?.charAt(0)?.toUpperCase()||"Q"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("p",{className:"truncate text-sm font-medium text-text-main",children:t.name}),t.email&&(0,a.jsx)("span",{className:"truncate text-xs text-text-muted",children:t.email})]}),(0,a.jsxs)("div",{className:"mt-0.5 flex items-center gap-1.5",children:[t.channelId&&(0,a.jsxs)(d.Ex,{variant:"info",size:"sm",children:["Region: ",t.channelId]}),t.uid&&(0,a.jsxs)("span",{className:"text-[11px] text-text-muted",children:["UID: ",t.uid]})]})]})]}):null}var K=s(67098);let F={claude:"claudeAutoPing",codex:"codexAutoPing"};function J(){let e,t,s,r=(0,i.useParams)(),h=(0,i.useRouter)(),b=r.id,{getCaps:v}=(0,p.y)(),{markSeen:j}=(0,K.P)("providers");(0,l.useEffect)(()=>{b&&j(b)},[b,j]);let[N,k]=(0,l.useState)([]),[S,$]=(0,l.useState)(!0),[T,I]=(0,l.useState)(null),[D,J]=(0,l.useState)([]),[W,B]=(0,l.useState)(!1),[H,G]=(0,l.useState)(!1),[Q,V]=(0,l.useState)(!1),[Z,X]=(0,l.useState)(""),[Y,ee]=(0,l.useState)(!1),[et,es]=(0,l.useState)(!1),[ea,el]=(0,l.useState)(!1),[ei,er]=(0,l.useState)(!1),[en,eo]=(0,l.useState)(null),[ed,ec]=(0,l.useState)({}),[em,ex]=(0,l.useState)([]),[ep,eu]=(0,l.useState)(!1),[eh,ef]=(0,l.useState)({}),[eg,ey]=(0,l.useState)(""),[eb,ev]=(0,l.useState)(()=>new Set),[ej,eN]=(0,l.useState)(""),[ew,ek]=(0,l.useState)(!1),[eC,eS]=(0,l.useState)(!1),[e$,eA]=(0,l.useState)([]),[eT,eE]=(0,l.useState)("__none__"),[eP,eO]=(0,l.useState)(!1),[eI,ez]=(0,l.useState)(null),[eD,e_]=(0,l.useState)(""),[eU,eR]=(0,l.useState)("auto"),[eM,eq]=(0,l.useState)({enabled:!1,connections:{}}),[eL,eK]=(0,l.useState)([]),[eF,eJ]=(0,l.useState)([]),[eW,eB]=(0,l.useState)([]),[eH,eG]=(0,l.useState)(null),[eQ,eV]=(0,l.useState)(!1),[eZ,eX]=(0,l.useState)(!1),[eY,e0]=(0,l.useState)(!1),[e1,e2]=(0,l.useState)(null),[e5,e3]=(0,l.useState)({}),[e4,e6]=(0,l.useState)(null),e8=(0,l.useRef)(!1),[e7,e9]=(0,l.useState)(!1),{copied:te,copy:tt}=(0,x.C)(),ts="ag_risk_confirmed",ta=()=>{B(!0)},tl=()=>{"antigravity"===b&&"true"!==window.localStorage.getItem(ts)?eV(!0):td?ta():(X(""),V(!0))},ti=()=>{X(""),V(!0)},tr=()=>{td?tl():ti()},tn=T?{id:T.id,name:T.name||("anthropic-compatible"===T.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===T.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===T.type?"AC":"OC",apiType:T.apiType,baseUrl:T.baseUrl,type:T.type}:c.zN[b]||c.fg[b]||c.IS[b]||c.nJ[b]||c.br[b],to=tn?.authModes||[],td=(!!c.zN[b]||!!c.IS[b]||to.includes("oauth"))&&tn?.hasOAuth!==!1,tc=!!c.fg[b]||to.includes("apikey")||tn?.hasOAuth===!1,tm=!!c.IS[b]?.noAuth,tx=(0,m.KC)(b),tp=(0,c.wG)(b),tu=(0,c.mq)(b),th=(0,c.gb)(b),tf=tu||th,tg=!tf&&td&&tc,ty="xai"===b?"Grok Build OAuth":"OAuth",tb="xai"===b?"xAI API Key":"API Key",tv=c.Q2[b]?.thinkingConfig||c.s9.extended,tj=tf?b:tp,tN=tf?T?.prefix||b:tp,tw=(0,l.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tj)}`,{cache:"no-store"}),t=await e.json();e.ok&&eB(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[tj]),tk=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tj,ids:[e]})})).ok&&await tw()}catch(e){console.log("Error disabling model:",e)}},tC=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tj)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tw()}catch(e){console.log("Error enabling model:",e)}},tS=async e=>{e.length&&eG({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{eG(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tj,ids:e})})).ok&&await tw()}catch(e){console.log("Error disabling all models:",e)}}})},t$=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tj)}`,{method:"DELETE"})).ok&&await tw()}catch(e){console.log("Error enabling all models:",e)}},tA=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&ec(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),tT=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&ex(t.models||[])}catch(e){console.log("Error fetching custom models:",e)}},[]);(0,l.useEffect)(()=>{"kilocode"===b&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&eJ(e.models)}).catch(()=>{})},[b]);let tE=(0,l.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"})]),l=await e.json(),i=await t.json(),r=await s.json(),n=a.ok?await a.json():{};if(e.ok){let e=(l.connections||[]).filter(e=>e.provider===b);k(e)}s.ok&&J(r.proxyPools||[]);let o=(n.providerStrategies||{})[b]||{};ez(o.fallbackStrategy||null),e_(null!=o.stickyRoundRobinLimit?String(o.stickyRoundRobinLimit):"1");let d=(n.providerThinking||{})[b]||{};eR(d.mode||"auto");let c=F[b],m=c&&n[c]||{};if(eq({enabled:!0===m.enabled,connections:m.connections||{}}),t.ok){let e=(i.nodes||[]).find(e=>e.id===b)||null;if(!e&&tf)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===b)||null))break}I(e)}}catch(e){console.log("Error fetching connections:",e)}finally{$(!1)}},[b,tf]),tP=async e=>{try{let t=await fetch(`/api/provider-nodes/${b}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(I(s.node),await tE(),el(!1))}catch(e){console.log("Error updating provider node:",e)}},tO=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},l={};e&&(l.fallbackStrategy=e),"round-robin"===e&&""!==t&&(l.stickyRoundRobinLimit=Number(t)||3);let i={...a};0===Object.keys(l).length?delete i[b]:i[b]=l,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:i})})}catch(e){console.log("Error saving provider strategy:",e)}},tI=async e=>{try{let t=await fetch("/api/settings",{cache:"no-store"}),s={...(t.ok?await t.json():{}).providerThinking||{}};e&&"auto"!==e?s[b]={mode:e}:delete s[b],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:s})})}catch(e){console.log("Error saving thinking config:",e)}},tz=async e=>{let t=F[b];if(t){eq(e);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[t]:e})})}catch(e){console.log("Error saving auto-ping config:",e)}}};(0,l.useEffect)(()=>{tE(),tA(),tT(),tw()},[tE,tA,tT,tw]),(0,l.useEffect)(()=>{let e=(c.zN[b]||c.fg[b]||c.IS[b]||c.nJ[b])?.modelsFetcher;e&&f(e).then(eK)},[b]);let tD=async(e,t,s=tp)=>{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 tA();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},t_=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tA()}catch(e){console.log("Error deleting alias:",e)}},tU=async(e,t="llm",s=tj)=>{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 tT(),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)}},tR=async(e,t="llm",s=tj)=>{try{let a=new URLSearchParams({providerAlias:s,id:e,type:t});(await fetch(`/api/models/custom?${a}`,{method:"DELETE"})).ok&&(await tT(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("Error deleting custom model:",e)}},tM=async()=>{if(e7)return;let e=N.find(e=>!1!==e.isActive);if(!e)return void alert((0,u.Tl)("Please add an active Qoder connection first"));e9(!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 l=0;for(let e of a){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^qoder\//,"");em.some(e=>e.providerAlias===tj&&e.id===s&&"llm"===(e.kind||e.type||"llm"))||Object.values(ed).includes(`${tj}/${s}`)||(await tU(s,"llm",tj),l+=1)}0===l?alert((0,u.Tl)("All models already exist, no new models added")):alert((0,u.Tl)("Successfully added")+` ${l} `+(0,u.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,u.Tl)("Error fetching models")+": "+e.message)}finally{e9(!1)}},tq=async()=>{if(eZ||0===N.length)return;let e=Object.fromEntries(N.map(e=>[e.id,{state:"queued",error:null}]));e8.current=!1,eX(!0),e0(!1),e2(null),e3(e),e6({total:N.length,completed:0,passed:0,failed:0,stopped:!1});let t=0,s=0;try{for(let e=0;e<N.length;e+=1){if(e8.current){e6({total:N.length,completed:e,passed:t,failed:s,stopped:!0});break}let a=N[e];e2(a.id),e3(e=>({...e,[a.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${a.id}/test`,{method:"POST"}),l=await e.json(),i=!!l.valid;i?t+=1:s+=1,e3(e=>({...e,[a.id]:{state:i?"success":"failed",error:i?null:l.error||null}}))}catch(e){s+=1,e3(t=>({...t,[a.id]:{state:"failed",error:e.message||"Test failed"}}))}e6({total:N.length,completed:e+1,passed:t,failed:s,stopped:!1}),e<N.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{e2(null),eX(!1),e0(!1),e8.current=!1}},tL=async e=>{eG({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{eG(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&k(t=>t.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},tK=()=>{tE(),B(!1)},tF=async e=>{X("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await tE(),V(!1);return}X(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),X("Failed to save connection")}},tJ=async e=>{try{(await fetch(`/api/providers/${en.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await tE(),es(!1))}catch(e){console.log("Error updating connection:",e)}},tW=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&k(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},tB=async(e,t)=>{let s=[...N];[s[e],s[t]]=[s[t],s[e]],k(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 tE()}},tH=N.filter(e=>e$.includes(e.id)),tG=N.length>0&&e$.length===N.length;(0,l.useEffect)(()=>{eA(e=>e.filter(e=>N.some(t=>t.id===e)))},[N]),(()=>{if(0===tH.length)return;let e=new Set(tH.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return;let s=D.find(e=>e.id===t);return s?.name}})();let tQ=()=>{eP||er(!1)},tV=async e=>{eO(!0);try{let t=0;for(let{connectionId:s,proxyPoolId:a}of e)try{(await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:a})})).ok||(t+=1)}catch(e){console.log("Error applying proxy for",s,e),t+=1}t>0&&alert(`Updated with ${t} failed request(s).`),await tE(),er(!1)}finally{eO(!1)}},tZ=e=>tV(N.map(t=>({connectionId:t.id,proxyPoolId:e}))),tX=(0,a.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-border-subtle",children:N.map((e,t)=>{let s;return(0,a.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,a.jsx)("div",{className:"flex shrink-0 items-center pl-1 sm:pl-2",children:(0,a.jsx)("input",{type:"checkbox",checked:(s=e.id,e$.includes(s)),onChange:()=>{var t;return t=e.id,void eA(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"})}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsx)(A,{connection:e,proxyPools:D,isOAuth:td,isFirst:0===t,isLast:t===N.length-1,onMoveUp:()=>tB(t,t-1),onMoveDown:()=>tB(t,t+1),onToggleActive:t=>tW(e.id,t),autoPing:F[b]&&"oauth"===e.authType?{on:!0===eM.connections[e.id],onToggle:t=>{var s;return s=e.id,void tz({...eM,connections:{...eM.connections,[s]:t}})},provider:b}: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&&k(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:()=>{eo(e),es(!0)},onDelete:()=>tL(e.id),oneByOneStatus:e5[e.id]||null})})]},e.id)})}),tY=D.filter(e=>!0===e.isActive),t0=(0,a.jsx)(d.aF,{isOpen:ei,onClose:tQ,title:`Apply Proxy (${N.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=D.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):tV(N.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:eP||0===tY.length,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-surface-2 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:()=>tZ(null),disabled:eP,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-surface-2 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)"})]}),D.map(e=>(0,a.jsxs)("button",{onClick:()=>tZ(e.id),disabled:eP||!0!==e.isActive,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-surface-2 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))]}),eP&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,a.jsx)(d.$n,{onClick:tQ,variant:"ghost",fullWidth:!0,disabled:eP,children:"Cancel"})]})}),t1=async e=>{if(!eb.has(e)){ev(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:`${tj}/${e}`})}),s=await t.json();ef(t=>({...t,[e]:s.ok?"ok":"error"})),ey(s.ok?"":s.error||"Model not reachable")}catch{ef(t=>({...t,[e]:"error"})),ey("Network error")}finally{ev(t=>{let s=new Set(t);return s.delete(e),s})}}},t2=async e=>{ew||0===e.length||(ek(!0),ey(""),await Promise.all(e.map(e=>t1(e))),ek(!1))};if(S)return(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(d.Qv,{}),(0,a.jsx)(d.Qv,{})]});if(!tn)return(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)(n(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]});let t5=(0,y.k)(tn.id,tn.apiType);return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)(n(),{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:`${tn.color}15`},children:ep?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:tn.color},children:tn.textIcon||tn.id.slice(0,2).toUpperCase()}):(0,a.jsx)(o.default,{src:t5,alt:tn.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>eu(!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:tn.name}),(tn.notice?.apiKeyUrl||tn.notice?.signupUrl||tn.website)&&(0,a.jsxs)("a",{href:tn.notice?.apiKeyUrl||tn.notice?.signupUrl||tn.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"}),tn.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]}),"moonshot"===b&&(0,a.jsxs)("a",{href:"https://www.kimi.com/activities/viral-referral/share?scenario=invite&from=share_poster&invitation_code=BPGXZR",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 rounded-full bg-primary/12 px-3 py-1 text-xs font-semibold text-primary ring-1 ring-primary/20 hover:bg-primary/20 transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"celebration"}),"Get KIMI K3 For Free"]})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:[N.length," connection",1===N.length?"":"s"]})]})]})]}),tn.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:tn.deprecationNotice})]}),tn.notice?.text&&!tn.deprecated&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-info/30 bg-info/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-info shrink-0",children:"info"}),(0,a.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-info",children:tn.notice.text}),tn.notice.apiKeyUrl&&(0,a.jsx)("a",{href:tn.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 →"})]}),tf&&T&&(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:th?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,a.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[th?"Messages API":"responses"===T.apiType?"Responses API":"Chat Completions"," \xb7 ",(T.baseUrl||"").replace(/\/$/,""),"/",th?"messages":"responses"===T.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:()=>{X(""),V(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>el(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{eG({title:"Delete Compatible Node",message:`Delete this ${th?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{eG(null);try{(await fetch(`/api/provider-nodes/${b}`,{method:"DELETE"})).ok&&h.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),tm?(0,a.jsx)(d.gw,{providerId:b}):(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.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,a.jsx)(_,{providerId:b}),"freebuff-web"===b&&N.length>0&&(0,a.jsx)(M,{connectionId:N[0].id}),"v0-vercel-web"===b&&N.length>0&&(0,a.jsx)(q,{connectionId:N[0].id}),"qwencloud"===b&&N.length>0&&(0,a.jsx)(L,{connectionId:N[0].id})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[N.length>0&&D.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>er(!0),children:"Apply Proxy"}),N.length>0&&(0,a.jsxs)(a.Fragment,{children:[e$.length>0&&(0,a.jsxs)(d.$n,{size:"sm",variant:"danger",icon:"delete",onClick:()=>{let e=e$.length;0!==e&&eG({title:`Delete ${e} Connection${e>1?"s":""}`,message:`Delete ${e} connection${e>1?"s":""}? This cannot be undone.`,onConfirm:async()=>{eG(null);let e=0,t=[...e$];for(let s of t)try{(await fetch(`/api/providers/${s}`,{method:"DELETE"})).ok||(e+=1)}catch(t){console.log("Error deleting connection:",t),e+=1}k(e=>e.filter(e=>!t.includes(e.id))),eA([]),e>0&&alert(`Deleted ${t.length-e} connection(s), ${e} failed.`)}})},children:["Delete Selected (",e$.length,")"]}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:tq,disabled:eZ,children:eZ?"Testing Connection One-by-One...":"Test Connection One-by-One"}),eZ&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{eZ&&(e8.current=!0,e0(!0))},disabled:eY,children:eY?"Stopping...":"Stop"})]}),tv&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Thought Level"}),(0,a.jsx)("select",{value:eU,onChange:e=>{var t;eR(t=e.target.value),tI(t)},className:"text-xs px-2 py-1 border border-border rounded-md bg-background focus:outline-none focus:border-primary",children:tv.options.map(e=>(0,a.jsx)("option",{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(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"===eI,onChange:e=>{let t=e?"round-robin":null,s=e?eD||"1":eD;e&&!eD&&e_("1"),ez(t),tO(t,s)}}),"round-robin"===eI&&(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:eD,onChange:e=>{var t;e_(t=e.target.value),tO("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"})]})]}),"zenmux-free"===b&&N.length>0&&(0,a.jsx)(U,{connectionId:N[0].id,cookie:N[0].apiKey||"",currentPlan:N[0].providerSpecificData?.zenmuxPlan||"free",onPlanChanged:()=>{tE()}})]})]}),0===N.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:td?"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"}),tg&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",ty," or ",tb,"."]})]})]}),(0,a.jsx)("div",{className:"flex gap-2",children:tg?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:tl,children:ty}),(0,a.jsx)(d.$n,{size:"sm",icon:"key",onClick:ti,children:tb})]}):(0,a.jsxs)(a.Fragment,{children:[!tf&&"iflow"===b&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>G(!0),children:"Cookie"}),"codex"===b&&(0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>ee(!0),children:(0,u.Tl)("Bulk Add")}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:tr,children:tf?"Add API Key":"iflow"===b?"OAuth":"Add Connection"})]})})]}):(0,a.jsxs)(a.Fragment,{children:[e4&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-border 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: ",e4.total]}),(0,a.jsxs)("span",{children:["Completed: ",e4.completed]}),(0,a.jsxs)("span",{children:["Passed: ",e4.passed]}),(0,a.jsxs)("span",{children:["Failed: ",e4.failed]}),e4.stopped&&(0,a.jsx)("span",{className:"text-warning",children:"Stopped"}),eZ&&e1&&(0,a.jsxs)("span",{children:["Running: ",N.find(e=>e.id===e1)?.name||e1]})]})}),N.length>0&&(0,a.jsx)("div",{className:"mb-3 flex items-center gap-2 border-b border-black/[0.03] pb-2 dark:border-white/[0.03]",children:(0,a.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-xs text-text-muted hover:text-primary",children:[(0,a.jsx)("input",{type:"checkbox",checked:tG,onChange:()=>{tG?eA([]):eA(N.map(e=>e.id))},className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Select All"]})}),tX,!tf&&(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===b&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>G(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codex"===b&&(0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>ee(!0),title:(0,u.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,u.Tl)("Bulk Add")}),tg?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:tl,className:"w-full sm:w-auto",children:ty}),(0,a.jsx)(d.$n,{size:"sm",icon:"key",onClick:ti,className:"w-full sm:w-auto",children:tb})]}):(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:tr,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,a.jsx)(d.Zp,{children:(0,a.jsx)("div",{className:"py-1",children:(0,a.jsx)(R,{providerId:b})})}),(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),!tf&&(e=[...tx,...eF.filter(e=>!tx.some(t=>t.id===e.id))].filter(e=>{let t=(0,m.CP)(e);return!t||"llm"===t}).map(e=>e.id).filter(e=>!eW.includes(e)),t=ej.trim().toLowerCase(),s=e.filter(e=>!t||e.toLowerCase().includes(t)),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[eW.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:t$,children:"Active All"}),e.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>tS(e),children:"Disable All"}),(N.length>0||tm)&&s.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"primary",icon:ew?"progress_activity":"play_arrow",onClick:()=>t2(s),disabled:ew,children:ew?"Testing...":`Test All (${s.length})`})]}))]}),(0,a.jsx)("div",{className:"sm:max-w-xs",children:(0,a.jsx)(d.pd,{type:"search",placeholder:"Search models...",value:ej,onChange:e=>eN(e.target.value),className:"w-full"})})]}),!!eg&&(0,a.jsx)("p",{className:"text-xs text-danger mb-3 break-words",children:eg}),(()=>{let e,t,s;if(tf)return(0,a.jsx)(C,{providerStorageAlias:tj,providerDisplayAlias:tN,modelAliases:ed,customModels:em,copied:te,onCopy:tt,onSetAlias:tD,onDeleteAlias:t_,onAddCustomModel:e=>tU(e,"llm",tj),onDeleteCustomModel:e=>tR(e,"llm",tj),connections:N,isAnthropic:th});let l=[...tx,...eF.filter(e=>!tx.some(t=>t.id===e.id))].filter(e=>{let t=(0,m.CP)(e);return!t||"llm"===t}),i=new Set(eW),r=l.filter(e=>!i.has(e.id)),n=l.filter(e=>i.has(e.id)),o=g({customModels:em,modelAliases:ed,providerAlias:tj,builtInModels:tx,type:"llm"}),d=ej.trim().toLowerCase(),c=(e,t="")=>!d||e.toLowerCase().includes(d)||String(t).toLowerCase().includes(d),x=r.filter(e=>c(e.id,e.name)),p=o.filter(e=>c(e.id,e.name));return(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[p.map(e=>(0,a.jsx)(w,{model:{id:e.id,name:e.name},fullModel:`${tN}/${e.id}`,alias:e.alias,copied:te,onCopy:tt,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===e.source?tR(e.id,"llm",tj):t_(e.alias)},testStatus:eh[e.id],onTest:N.length>0||tm?()=>t1(e.id):void 0,isTesting:eb.has(e.id),isCustom:!0,isFree:!1,caps:v(`${b}/${e.id}`)},`${e.source}-${e.fullModel}`)),x.map(e=>{let t=`${tj}/${e.id}`,s=`${b}/${e.id}`,l=Object.entries(ed).find(([,e])=>e===t||e===s)?.[0];return(0,a.jsx)(w,{model:e,fullModel:`${tN}/${e.id}`,alias:l,copied:te,onCopy:tt,onSetAlias:t=>tD(e.id,t,tj),onDeleteAlias:()=>t_(l),testStatus:eh[e.id],onTest:N.length>0||tm?()=>t1(e.id):void 0,isTesting:eb.has(e.id),isFree:e.isFree,onDisable:()=>tk(e.id),caps:v(`${b}/${e.id}`)},e.id)}),ej.trim()&&0===x.length&&0===p.length&&(0,a.jsxs)("p",{className:"w-full text-center text-sm text-text-muted py-4",children:["No models match “",ej,"”"]}),(0,a.jsxs)("button",{onClick:()=>eS(!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"===b&&N.some(e=>!1!==e.isActive)&&(0,a.jsxs)("button",{onClick:tM,disabled:e7,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-info 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:e7?{animation:"spin 1s linear infinite"}:void 0,children:e7?"progress_activity":"download"}),e7?(0,u.Tl)("Fetching..."):(0,u.Tl)("Fetch Qoder Models")]}),eL.length>0&&(e=new Set([...Object.values(ed),...o.map(e=>e.fullModel)]),t=new Set(tx.map(e=>e.id)),0===(s=eL.filter(s=>!e.has(`${tj}/${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 tU(e.id,"llm",tj)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-border 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:()=>tC(e.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-border 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))})]})]})})()]}),t0,"kiro"===b?(0,a.jsx)(d.Mh,{isOpen:W,providerInfo:tn,onSuccess:tK,onClose:()=>B(!1)}):"cursor"===b?(0,a.jsx)(d.G9,{isOpen:W,onSuccess:tK,onClose:()=>B(!1)}):"gitlab"===b?(0,a.jsx)(d.vj,{isOpen:W,providerInfo:tn,onSuccess:tK,onClose:()=>B(!1)}):(0,a.jsx)(d.LF,{isOpen:W,provider:b,providerInfo:tn,onSuccess:tK,onClose:()=>B(!1)}),"iflow"===b&&(0,a.jsx)(d.vE,{isOpen:H,onSuccess:()=>{tE(),G(!1)},onClose:()=>G(!1)}),(0,a.jsx)(E,{isOpen:Q,provider:b,providerName:tn.name,isCompatible:tf,isAnthropic:th,authType:tn?.authType,authHint:tn?.authHint,website:tn?.website,proxyPools:D,error:Z,onSave:tF,onBulkDone:tE,onClose:()=>{X(""),V(!1)}}),(0,a.jsx)(d.wI,{isOpen:et,connection:en,proxyPools:D,onSave:tJ,onClose:()=>es(!1)}),tf&&(0,a.jsx)(P,{isOpen:ea,node:T,onSave:tP,onClose:()=>el(!1),isAnthropic:th}),!tf&&(0,a.jsx)(O,{isOpen:eC,providerAlias:tj,providerDisplayAlias:tN,onSave:async e=>{await tU(e,"llm",tj),eS(!1)},onClose:()=>eS(!1)}),"codex"===b&&(0,a.jsx)(z,{isOpen:Y,onClose:()=>ee(!1),onSuccess:tE}),(0,a.jsx)(d.uo,{isOpen:eQ,onClose:()=>eV(!1),onConfirm:()=>{(window.localStorage.setItem(ts,"true"),eV(!1),td)?ta():ti()},title:"Risk Notice",message:tn?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,a.jsx)(d.uo,{isOpen:!!eH,onClose:()=>eG(null),onConfirm:eH?.onConfirm,title:eH?.title||"Confirm",message:eH?.message,variant:"danger"})]})}},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})},88845:(e,t,s)=>{Promise.resolve().then(s.bind(s,26706))}},e=>{e.O(0,[27,5772,1321,705,5497,8441,3794,7358],()=>e(e.s=88845)),_N_E=e.O()}]);
10
+ ]`;function z({isOpen:e,onClose:t,onSuccess:s}){let[i,r]=(0,l.useState)(""),[n,o]=(0,l.useState)(!1),[c,m]=(0,l.useState)(""),[x,p]=(0,l.useState)(null),h=()=>{n||(r(""),m(""),p(null),t())},f=async()=>{var e;let t;m(""),p(null);let a=i.trim();if(!a)return;try{t=JSON.parse(a)}catch(e){m(`${(0,u.Tl)("Invalid JSON")}: ${e.message}`);return}let l=Array.isArray(e=t)?e:e&&"object"==typeof e?Array.isArray(e.accounts)?e.accounts:[e]:null;if(!l||0===l.length)return void m((0,u.Tl)("No accounts found in input"));o(!0);try{let e=await fetch("/api/oauth/codex/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:l})}),t=await e.json();if(!e.ok)return void m(t?.error||`Request failed: ${e.status}`);p(t),t.success>0&&"function"==typeof s&&s()}catch(e){m(e.message||(0,u.Tl)("Request failed"))}finally{o(!1)}},g=x?.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:I,value:i,onChange:e=>r(e.target.value),disabled:n}),c&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:c}),x&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:`text-sm font-medium ${x.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",x.success," ",(0,u.Tl)("added"),x.failed>0?`, ✗ ${x.failed} ${(0,u.Tl)("failed")}`:""]}),g.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:g.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:n||!i.trim(),children:n?(0,u.Tl)("Importing..."):(0,u.Tl)("Import All")}),(0,a.jsx)(d.$n,{onClick:h,variant:"ghost",fullWidth:!0,disabled:n,children:(0,u.Tl)("Close")})]})]})})}z.propTypes={isOpen:v().bool.isRequired,onClose:v().func.isRequired,onSuccess:v().func};let D={healthy:{variant:"success",label:"Pool healthy",icon:"shield"},degraded:{variant:"warning",label:"Pool degraded",icon:"warning"},exhausted:{variant:"error",label:"Pool exhausted",icon:"error"}};function _({providerId:e}){let[t,s]=(0,l.useState)(null);if((0,l.useEffect)(()=>{let t;if(!e)return;let a=!1,l=async()=>{try{let t=await fetch(`/api/providers/${e}/vault-pool`,{cache:"no-store"});if(!t.ok)return;let l=await t.json();a||s(l)}catch{}};l();let i=()=>{t||(t=setInterval(l,1e4))},r=()=>{t&&(clearInterval(t),t=null)},n=()=>document.hidden?r():i();return i(),document.addEventListener("visibilitychange",n),()=>{a=!0,r(),document.removeEventListener("visibilitychange",n)}},[e]),!t||!t.hasPool)return null;let i=D[t.status]||D.healthy;return(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",title:"Admin-provided shared key pool. Keys are hidden; only counts are shown.",children:[(0,a.jsx)(d.Ex,{variant:i.variant,size:"sm",icon:i.icon,children:i.label}),(0,a.jsxs)(d.Ex,{variant:"info",size:"sm",icon:"key",children:[t.total," pool keys"]}),(0,a.jsxs)(d.Ex,{variant:"success",size:"sm",icon:"check_circle",children:[t.available," available"]}),t.rateLimited>0&&(0,a.jsxs)(d.Ex,{variant:"warning",size:"sm",icon:"schedule",children:[t.rateLimited," cooling"]})]})}function R({connectionId:e,cookie:t,currentPlan:s="free",onPlanChanged:i}){let r,[n,o]=(0,l.useState)([]),[c,m]=(0,l.useState)(s),[x,p]=(0,l.useState)(null),[u,h]=(0,l.useState)(!1),[f,g]=(0,l.useState)(!1),[y,b]=(0,l.useState)(null),v=(r=String(t||"").match(/ctoken=([^;]+)/),r?.[1]||"");(0,l.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch("/api/providers/zenmux-free/zenmux-plans",{cache:"no-store"});if(!t.ok)return;let s=await t.json();!e&&Array.isArray(s.plans)&&o(s.plans)}catch{}})(),()=>{e=!0}},[]),(0,l.useEffect)(()=>{if(!v)return;let e=!1;return h(!0),(async()=>{try{let t=await fetch("/api/providers/zenmux-free/zenmux-plans",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ctoken:v})});if(!t.ok)return;let a=await t.json();!e&&a.planKey&&(p(a.planKey),s&&"free"!==s||m(a.planKey))}catch{}finally{e||h(!1)}})(),()=>{e=!0}},[v,s]);let j=async t=>{let a=t.target.value;m(a),g(!0),b(null);try{if(!(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerSpecificData:{zenmuxPlan:a}})})).ok)throw Error("Failed to save plan");i?.(a)}catch(e){b(e.message),m(s)}finally{g(!1)}},N=x&&x===c;return 0===n.length?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"ZenMux Plan"}),(0,a.jsx)("select",{value:c,onChange:j,disabled:!0,className:"appearance-none rounded-brand border border-border bg-surface-2 py-1.5 pl-3 pr-8 text-xs text-text-muted [-webkit-appearance:none] [-moz-appearance:none]",children:(0,a.jsxs)("option",{value:c,children:[c," (loading…)"]})})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(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:"ZenMux Plan"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("select",{value:c,onChange:j,disabled:f,title:"Select your ZenMux subscription plan. Models from this plan will be available.",className:"appearance-none rounded-brand border border-border bg-surface-2 py-1.5 pl-3 pr-8 text-xs text-text-main [-webkit-appearance:none] [-moz-appearance:none] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/35 disabled:opacity-50",children:n.map(e=>(0,a.jsxs)("option",{value:e.planKey,children:[e.name," (",e.modelCount," models",e.price>0?`, $${e.price}/mo`:", free",")"]},e.planKey))}),(0,a.jsx)("span",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"expand_more"})})]}),u&&(0,a.jsx)(d.Ex,{variant:"info",size:"sm",children:"Detecting…"}),N&&!u&&(0,a.jsx)(d.Ex,{variant:"success",size:"sm",icon:"check_circle",dot:!0,children:"Auto-detected"}),f&&(0,a.jsx)(d.Ex,{variant:"info",size:"sm",children:"Saving…"}),y&&(0,a.jsx)(d.Ex,{variant:"error",size:"sm",icon:"error",children:y})]}),(0,a.jsx)("p",{className:"text-[11px] text-text-muted",children:x?`Plan auto-detected from your ctoken: ${x}. You can override manually if needed.`:"Select your ZenMux subscription plan. Models available depend on your plan."})]})}function U({providerId:e,hours:t=24}){let[s,i]=(0,l.useState)(null);if((0,l.useEffect)(()=>{if(!e)return;let s=!1,a=async()=>{try{let a=await fetch(`/api/providers/${e}/health-timeline?hours=${t}`,{cache:"no-store"});if(!a.ok)return;let l=await a.json();s||i(l.timeline||[])}catch{}};a();let l=setInterval(a,6e4),r=()=>{document.hidden?clearInterval(l):(clearInterval(l),a(),l=setInterval(a,6e4))};return document.addEventListener("visibilitychange",r),()=>{s=!0,clearInterval(l),document.removeEventListener("visibilitychange",r)}},[e,t]),!s)return(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] animate-pulse",children:"monitor_heart"}),"Loading health timeline..."]});if(0===s.length||s.every(e=>0===e.ok&&0===e.err))return(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"monitor_heart"}),"No request history yet."]});let r=s.length,n=s.reduce((e,t)=>e+t.ok+t.err,0),o=s.reduce((e,t)=>e+t.err,0),d=Math.max(...s.map(e=>e.ok+e.err),1),c=Math.max(...s.map(e=>e.latency),1),m=Math.max(6*r,120),x=Math.max(m/r-1,2),p=s.filter(e=>e.latency>0).map((e,t)=>{let s=t/Math.max(r-1,1)*m,a=32-e.latency/c*19.2-2;return`${s.toFixed(1)},${a.toFixed(1)}`}),u=p.length>1?`M${p.join(" L")}`:"",h=n>0?Math.round((n-o)/n*100):null;return(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-text-muted",children:"Health (24h)"}),null!==h&&(0,a.jsxs)("span",{className:`text-[10px] font-bold ${h>=90?"text-success":h>=70?"text-warning":"text-danger"}`,children:[h,"% success \xb7 ",n," requests \xb7 ",o," errors"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[10px] text-text-muted",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"inline-block size-2 rounded-sm bg-success"})," OK"]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"inline-block size-2 rounded-sm bg-danger"})," Error"]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"inline-block h-0.5 w-3 bg-info"})," Latency"]})]})]}),(0,a.jsxs)("svg",{width:m,height:32,className:"overflow-visible",children:[s.map((e,t)=>{let s=m/r*t;if(0===e.ok+e.err)return null;let l=e.ok/d*32,i=e.err/d*32;return(0,a.jsxs)("g",{children:[(0,a.jsx)("rect",{x:s,y:32-l-i,width:x,height:i,rx:.5,className:"fill-danger/60"}),(0,a.jsx)("rect",{x:s,y:32-l,width:x,height:l,rx:.5,className:"fill-success/60"})]},t)}),u&&(0,a.jsx)("path",{d:u,fill:"none",strokeWidth:1,className:"stroke-info",strokeDasharray:"2 2"})]})]})}function M({connectionId:e}){let[t,s]=(0,l.useState)(null),[i,r]=(0,l.useState)(!0);if((0,l.useEffect)(()=>{if(!e)return;let t=!1;return(async()=>{try{let a=await fetch(`/api/providers/${e}/freebuff-profile`,{cache:"no-store"});if(!a.ok)return;let l=await a.json();t||s(l)}catch{}t||r(!1)})(),()=>{t=!0}},[e]),i)return(0,a.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border-subtle bg-surface-2/50 px-3 py-2",children:[(0,a.jsx)("div",{className:"size-8 animate-pulse rounded-full bg-sidebar"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"h-3 w-32 animate-pulse rounded bg-sidebar"}),(0,a.jsx)("div",{className:"h-2 w-48 animate-pulse rounded bg-sidebar"})]})]});if(!t)return null;let n=t.expires?new Date(t.expires):null,o=n?Math.ceil((n.getTime()-Date.now())/864e5):null,c=null!==o&&o<=3;return(0,a.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border-subtle bg-surface-2/50 px-3 py-2",children:[t.image?(0,a.jsx)("img",{src:t.image,alt:t.name,className:"size-9 rounded-full object-cover ring-2 ring-border-subtle"}):(0,a.jsx)("div",{className:"flex size-9 items-center justify-center rounded-full bg-primary/10 text-sm font-bold text-primary",children:t.name?.charAt(0)?.toUpperCase()||"F"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("p",{className:"truncate text-sm font-medium text-text-main",children:t.name}),t.email&&(0,a.jsx)("span",{className:"truncate text-xs text-text-muted",children:t.email})]}),n&&(0,a.jsxs)("div",{className:"mt-0.5 flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px] text-text-muted",children:"schedule"}),(0,a.jsxs)("span",{className:"text-[11px] text-text-muted",children:["Session expires ",n.toLocaleDateString()]}),null!==o&&(0,a.jsxs)(d.Ex,{variant:c?"warning":"success",size:"sm",children:[o,"d left"]})]})]})]})}function q({connectionId:e}){let[t,s]=(0,l.useState)(null),[i,r]=(0,l.useState)(!0);if((0,l.useEffect)(()=>{if(!e)return;let t=!1;return(async()=>{try{let a=await fetch(`/api/providers/${e}/v0-profile`,{cache:"no-store"});if(!a.ok)return;let l=await a.json();t||s(l)}catch{}t||r(!1)})(),()=>{t=!0}},[e]),i)return(0,a.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border-subtle bg-surface-2/50 px-3 py-2",children:[(0,a.jsx)("div",{className:"size-8 animate-pulse rounded-full bg-sidebar"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"h-3 w-32 animate-pulse rounded bg-sidebar"}),(0,a.jsx)("div",{className:"h-2 w-48 animate-pulse rounded bg-sidebar"})]})]});if(!t?.profile&&!t?.balance)return null;let{profile:n,balance:o}=t;return(0,a.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border-subtle bg-surface-2/50 px-3 py-2",children:[n?.image?(0,a.jsx)("img",{src:n.image,alt:n.name,className:"size-9 rounded-full object-cover ring-2 ring-border-subtle"}):(0,a.jsx)("div",{className:"flex size-9 items-center justify-center rounded-full bg-primary/10 text-sm font-bold text-primary",children:n?.name?.charAt(0)?.toUpperCase()||"v"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("p",{className:"truncate text-sm font-medium text-text-main",children:n?.name||"User"}),n?.email&&(0,a.jsx)("span",{className:"truncate text-xs text-text-muted",children:n.email})]}),(0,a.jsxs)("div",{className:"mt-0.5 flex items-center gap-1.5",children:[n?.plan&&(0,a.jsx)(d.Ex,{variant:"v0-free"===n.plan?"default":"primary",size:"sm",children:"v0-free"===n.plan?"Free":n.plan}),n?.teamName&&(0,a.jsx)("span",{className:"truncate text-[11px] text-text-muted",children:n.teamName})]})]}),o&&(0,a.jsxs)("div",{className:"flex shrink-0 flex-col items-end",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-warning",children:"bolt"}),(0,a.jsx)("span",{className:"font-mono text-sm font-bold text-text-main",children:o.remaining}),(0,a.jsxs)("span",{className:"text-[10px] text-text-muted",children:["/",o.total||"?"]})]}),(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"credits left"})]})]})}function L({connectionId:e}){let[t,s]=(0,l.useState)(null),[i,r]=(0,l.useState)(!0);return((0,l.useEffect)(()=>{if(!e)return;let t=!1;return(async()=>{try{let a=await fetch(`/api/providers/${e}/qwencloud-profile`,{cache:"no-store"});if(!a.ok)return;let l=await a.json();t||s(l)}catch{}t||r(!1)})(),()=>{t=!0}},[e]),i)?(0,a.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border-subtle bg-surface-2/50 px-3 py-2",children:[(0,a.jsx)("div",{className:"size-8 animate-pulse rounded-full bg-sidebar"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"h-3 w-32 animate-pulse rounded bg-sidebar"}),(0,a.jsx)("div",{className:"h-2 w-48 animate-pulse rounded bg-sidebar"})]})]}):t?(0,a.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border-subtle bg-surface-2/50 px-3 py-2",children:[t.image?(0,a.jsx)("img",{src:t.image,alt:t.name,className:"size-9 rounded-full object-cover ring-2 ring-border-subtle"}):(0,a.jsx)("div",{className:"flex size-9 items-center justify-center rounded-full bg-primary/10 text-sm font-bold text-primary",children:t.name?.charAt(0)?.toUpperCase()||"Q"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("p",{className:"truncate text-sm font-medium text-text-main",children:t.name}),t.email&&(0,a.jsx)("span",{className:"truncate text-xs text-text-muted",children:t.email})]}),(0,a.jsxs)("div",{className:"mt-0.5 flex items-center gap-1.5",children:[t.channelId&&(0,a.jsxs)(d.Ex,{variant:"info",size:"sm",children:["Region: ",t.channelId]}),t.uid&&(0,a.jsxs)("span",{className:"text-[11px] text-text-muted",children:["UID: ",t.uid]})]})]})]}):null}var K=s(67098);let F={claude:"claudeAutoPing",codex:"codexAutoPing"};function J(){let e,t,s,r=(0,i.useParams)(),h=(0,i.useRouter)(),b=r.id,{getCaps:v}=(0,p.y)(),{markSeen:j}=(0,K.P)("providers");(0,l.useEffect)(()=>{b&&j(b)},[b,j]);let[N,k]=(0,l.useState)([]),[S,$]=(0,l.useState)(!0),[T,I]=(0,l.useState)(null),[D,J]=(0,l.useState)([]),[W,B]=(0,l.useState)(!1),[H,G]=(0,l.useState)(!1),[Q,V]=(0,l.useState)(!1),[Z,X]=(0,l.useState)(""),[Y,ee]=(0,l.useState)(!1),[et,es]=(0,l.useState)(!1),[ea,el]=(0,l.useState)(!1),[ei,er]=(0,l.useState)(!1),[en,eo]=(0,l.useState)(null),[ed,ec]=(0,l.useState)({}),[em,ex]=(0,l.useState)([]),[ep,eu]=(0,l.useState)(!1),[eh,ef]=(0,l.useState)({}),[eg,ey]=(0,l.useState)(""),[eb,ev]=(0,l.useState)(()=>new Set),[ej,eN]=(0,l.useState)(""),[ew,ek]=(0,l.useState)(!1),[eC,eS]=(0,l.useState)(!1),[e$,eA]=(0,l.useState)([]),[eT,eE]=(0,l.useState)("__none__"),[eP,eO]=(0,l.useState)(!1),[eI,ez]=(0,l.useState)(null),[eD,e_]=(0,l.useState)(""),[eR,eU]=(0,l.useState)("auto"),[eM,eq]=(0,l.useState)({enabled:!1,connections:{}}),[eL,eK]=(0,l.useState)([]),[eF,eJ]=(0,l.useState)([]),[eW,eB]=(0,l.useState)([]),[eH,eG]=(0,l.useState)(null),[eQ,eV]=(0,l.useState)(!1),[eZ,eX]=(0,l.useState)(!1),[eY,e0]=(0,l.useState)(!1),[e1,e2]=(0,l.useState)(null),[e5,e3]=(0,l.useState)({}),[e4,e6]=(0,l.useState)(null),e8=(0,l.useRef)(!1),[e7,e9]=(0,l.useState)(!1),{copied:te,copy:tt}=(0,x.C)(),ts="ag_risk_confirmed",ta=()=>{B(!0)},tl=()=>{"antigravity"===b&&"true"!==window.localStorage.getItem(ts)?eV(!0):td?ta():(X(""),V(!0))},ti=()=>{X(""),V(!0)},tr=()=>{td?tl():ti()},tn=T?{id:T.id,name:T.name||("anthropic-compatible"===T.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===T.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===T.type?"AC":"OC",apiType:T.apiType,baseUrl:T.baseUrl,type:T.type}:c.zN[b]||c.fg[b]||c.IS[b]||c.nJ[b]||c.br[b],to=tn?.authModes||[],td=(!!c.zN[b]||!!c.IS[b]||to.includes("oauth"))&&tn?.hasOAuth!==!1,tc=!!c.fg[b]||to.includes("apikey")||tn?.hasOAuth===!1,tm=!!c.IS[b]?.noAuth,tx=(0,m.KC)(b),tp=(0,c.wG)(b),tu=(0,c.mq)(b),th=(0,c.gb)(b),tf=tu||th,tg=!tf&&td&&tc,ty="xai"===b?"Grok Build OAuth":"OAuth",tb="xai"===b?"xAI API Key":"API Key",tv=c.Q2[b]?.thinkingConfig||c.s9.extended,tj=tf?b:tp,tN=tf?T?.prefix||b:tp,tw=(0,l.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tj)}`,{cache:"no-store"}),t=await e.json();e.ok&&eB(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[tj]),tk=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tj,ids:[e]})})).ok&&await tw()}catch(e){console.log("Error disabling model:",e)}},tC=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tj)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tw()}catch(e){console.log("Error enabling model:",e)}},tS=async e=>{e.length&&eG({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{eG(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tj,ids:e})})).ok&&await tw()}catch(e){console.log("Error disabling all models:",e)}}})},t$=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tj)}`,{method:"DELETE"})).ok&&await tw()}catch(e){console.log("Error enabling all models:",e)}},tA=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&ec(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),tT=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&ex(t.models||[])}catch(e){console.log("Error fetching custom models:",e)}},[]);(0,l.useEffect)(()=>{"kilocode"===b&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&eJ(e.models)}).catch(()=>{})},[b]);let tE=(0,l.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"})]),l=await e.json(),i=await t.json(),r=await s.json(),n=a.ok?await a.json():{};if(e.ok){let e=(l.connections||[]).filter(e=>e.provider===b);k(e)}s.ok&&J(r.proxyPools||[]);let o=(n.providerStrategies||{})[b]||{};ez(o.fallbackStrategy||null),e_(null!=o.stickyRoundRobinLimit?String(o.stickyRoundRobinLimit):"1");let d=(n.providerThinking||{})[b]||{};eU(d.mode||"auto");let c=F[b],m=c&&n[c]||{};if(eq({enabled:!0===m.enabled,connections:m.connections||{}}),t.ok){let e=(i.nodes||[]).find(e=>e.id===b)||null;if(!e&&tf)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===b)||null))break}I(e)}}catch(e){console.log("Error fetching connections:",e)}finally{$(!1)}},[b,tf]),tP=async e=>{try{let t=await fetch(`/api/provider-nodes/${b}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(I(s.node),await tE(),el(!1))}catch(e){console.log("Error updating provider node:",e)}},tO=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},l={};e&&(l.fallbackStrategy=e),"round-robin"===e&&""!==t&&(l.stickyRoundRobinLimit=Number(t)||3);let i={...a};0===Object.keys(l).length?delete i[b]:i[b]=l,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:i})})}catch(e){console.log("Error saving provider strategy:",e)}},tI=async e=>{try{let t=await fetch("/api/settings",{cache:"no-store"}),s={...(t.ok?await t.json():{}).providerThinking||{}};e&&"auto"!==e?s[b]={mode:e}:delete s[b],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:s})})}catch(e){console.log("Error saving thinking config:",e)}},tz=async e=>{let t=F[b];if(t){eq(e);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[t]:e})})}catch(e){console.log("Error saving auto-ping config:",e)}}};(0,l.useEffect)(()=>{tE(),tA(),tT(),tw()},[tE,tA,tT,tw]),(0,l.useEffect)(()=>{let e=(c.zN[b]||c.fg[b]||c.IS[b]||c.nJ[b])?.modelsFetcher;e&&f(e).then(eK)},[b]);let tD=async(e,t,s=tp)=>{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 tA();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},t_=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tA()}catch(e){console.log("Error deleting alias:",e)}},tR=async(e,t="llm",s=tj)=>{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 tT(),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)}},tU=async(e,t="llm",s=tj)=>{try{let a=new URLSearchParams({providerAlias:s,id:e,type:t});(await fetch(`/api/models/custom?${a}`,{method:"DELETE"})).ok&&(await tT(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("Error deleting custom model:",e)}},tM=async()=>{if(e7)return;let e=N.find(e=>!1!==e.isActive);if(!e)return void alert((0,u.Tl)("Please add an active Qoder connection first"));e9(!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 l=0;for(let e of a){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^qoder\//,"");em.some(e=>e.providerAlias===tj&&e.id===s&&"llm"===(e.kind||e.type||"llm"))||Object.values(ed).includes(`${tj}/${s}`)||(await tR(s,"llm",tj),l+=1)}0===l?alert((0,u.Tl)("All models already exist, no new models added")):alert((0,u.Tl)("Successfully added")+` ${l} `+(0,u.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,u.Tl)("Error fetching models")+": "+e.message)}finally{e9(!1)}},tq=async()=>{if(eZ||0===N.length)return;let e=Object.fromEntries(N.map(e=>[e.id,{state:"queued",error:null}]));e8.current=!1,eX(!0),e0(!1),e2(null),e3(e),e6({total:N.length,completed:0,passed:0,failed:0,stopped:!1});let t=0,s=0;try{for(let e=0;e<N.length;e+=1){if(e8.current){e6({total:N.length,completed:e,passed:t,failed:s,stopped:!0});break}let a=N[e];e2(a.id),e3(e=>({...e,[a.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${a.id}/test`,{method:"POST"}),l=await e.json(),i=!!l.valid;i?t+=1:s+=1,e3(e=>({...e,[a.id]:{state:i?"success":"failed",error:i?null:l.error||null}}))}catch(e){s+=1,e3(t=>({...t,[a.id]:{state:"failed",error:e.message||"Test failed"}}))}e6({total:N.length,completed:e+1,passed:t,failed:s,stopped:!1}),e<N.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{e2(null),eX(!1),e0(!1),e8.current=!1}},tL=async e=>{eG({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{eG(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&k(t=>t.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},tK=()=>{tE(),B(!1)},tF=async e=>{X("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await tE(),V(!1);return}X(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),X("Failed to save connection")}},tJ=async e=>{try{(await fetch(`/api/providers/${en.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await tE(),es(!1))}catch(e){console.log("Error updating connection:",e)}},tW=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&k(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},tB=async(e,t)=>{let s=[...N];[s[e],s[t]]=[s[t],s[e]],k(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 tE()}},tH=N.filter(e=>e$.includes(e.id)),tG=N.length>0&&e$.length===N.length;(0,l.useEffect)(()=>{eA(e=>e.filter(e=>N.some(t=>t.id===e)))},[N]),(()=>{if(0===tH.length)return;let e=new Set(tH.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return;let s=D.find(e=>e.id===t);return s?.name}})();let tQ=()=>{eP||er(!1)},tV=async e=>{eO(!0);try{let t=0;for(let{connectionId:s,proxyPoolId:a}of e)try{(await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:a})})).ok||(t+=1)}catch(e){console.log("Error applying proxy for",s,e),t+=1}t>0&&alert(`Updated with ${t} failed request(s).`),await tE(),er(!1)}finally{eO(!1)}},tZ=e=>tV(N.map(t=>({connectionId:t.id,proxyPoolId:e}))),tX=(0,a.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-border-subtle",children:N.map((e,t)=>{let s;return(0,a.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,a.jsx)("div",{className:"flex shrink-0 items-center pl-1 sm:pl-2",children:(0,a.jsx)("input",{type:"checkbox",checked:(s=e.id,e$.includes(s)),onChange:()=>{var t;return t=e.id,void eA(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"})}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsx)(A,{connection:e,proxyPools:D,isOAuth:td,isFirst:0===t,isLast:t===N.length-1,onMoveUp:()=>tB(t,t-1),onMoveDown:()=>tB(t,t+1),onToggleActive:t=>tW(e.id,t),autoPing:F[b]&&"oauth"===e.authType?{on:!0===eM.connections[e.id],onToggle:t=>{var s;return s=e.id,void tz({...eM,connections:{...eM.connections,[s]:t}})},provider:b}: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&&k(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:()=>{eo(e),es(!0)},onDelete:()=>tL(e.id),oneByOneStatus:e5[e.id]||null})})]},e.id)})}),tY=D.filter(e=>!0===e.isActive),t0=(0,a.jsx)(d.aF,{isOpen:ei,onClose:tQ,title:`Apply Proxy (${N.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=D.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):tV(N.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:eP||0===tY.length,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-surface-2 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:()=>tZ(null),disabled:eP,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-surface-2 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)"})]}),D.map(e=>(0,a.jsxs)("button",{onClick:()=>tZ(e.id),disabled:eP||!0!==e.isActive,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-surface-2 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))]}),eP&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,a.jsx)(d.$n,{onClick:tQ,variant:"ghost",fullWidth:!0,disabled:eP,children:"Cancel"})]})}),t1=async e=>{if(!eb.has(e)){ev(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:`${tj}/${e}`})}),s=await t.json();ef(t=>({...t,[e]:s.ok?"ok":"error"})),ey(s.ok?"":s.error||"Model not reachable")}catch{ef(t=>({...t,[e]:"error"})),ey("Network error")}finally{ev(t=>{let s=new Set(t);return s.delete(e),s})}}},t2=async e=>{ew||0===e.length||(ek(!0),ey(""),await Promise.all(e.map(e=>t1(e))),ek(!1))};if(S)return(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(d.Qv,{}),(0,a.jsx)(d.Qv,{})]});if(!tn)return(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)(n(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]});let t5=(0,y.k)(tn.id,tn.apiType);return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)(n(),{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:`${tn.color}15`},children:ep?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:tn.color},children:tn.textIcon||tn.id.slice(0,2).toUpperCase()}):(0,a.jsx)(o.default,{src:t5,alt:tn.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>eu(!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:tn.name}),(tn.notice?.apiKeyUrl||tn.notice?.signupUrl||tn.website)&&(0,a.jsxs)("a",{href:tn.notice?.apiKeyUrl||tn.notice?.signupUrl||tn.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"}),tn.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]}),"moonshot"===b&&(0,a.jsxs)("a",{href:"https://www.kimi.com/activities/viral-referral/share?scenario=invite&from=share_poster&invitation_code=BPGXZR",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 rounded-full bg-primary/12 px-3 py-1 text-xs font-semibold text-primary ring-1 ring-primary/20 hover:bg-primary/20 transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"celebration"}),"Get KIMI K3 For Free"]})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:[N.length," connection",1===N.length?"":"s"]})]})]})]}),tn.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:tn.deprecationNotice})]}),tn.notice?.text&&!tn.deprecated&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-info/30 bg-info/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-info shrink-0",children:"info"}),(0,a.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-info",children:tn.notice.text}),tn.notice.apiKeyUrl&&(0,a.jsx)("a",{href:tn.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 →"})]}),tf&&T&&(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:th?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,a.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[th?"Messages API":"responses"===T.apiType?"Responses API":"Chat Completions"," \xb7 ",(T.baseUrl||"").replace(/\/$/,""),"/",th?"messages":"responses"===T.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:()=>{X(""),V(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>el(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{eG({title:"Delete Compatible Node",message:`Delete this ${th?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{eG(null);try{(await fetch(`/api/provider-nodes/${b}`,{method:"DELETE"})).ok&&h.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),tm?(0,a.jsx)(d.gw,{providerId:b}):(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.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,a.jsx)(_,{providerId:b}),"freebuff-web"===b&&N.length>0&&(0,a.jsx)(M,{connectionId:N[0].id}),"v0-vercel-web"===b&&N.length>0&&(0,a.jsx)(q,{connectionId:N[0].id}),"qwencloud"===b&&N.length>0&&(0,a.jsx)(L,{connectionId:N[0].id})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[N.length>0&&D.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>er(!0),children:"Apply Proxy"}),N.length>0&&(0,a.jsxs)(a.Fragment,{children:[e$.length>0&&(0,a.jsxs)(d.$n,{size:"sm",variant:"danger",icon:"delete",onClick:()=>{let e=e$.length;0!==e&&eG({title:`Delete ${e} Connection${e>1?"s":""}`,message:`Delete ${e} connection${e>1?"s":""}? This cannot be undone.`,onConfirm:async()=>{eG(null);let e=0,t=[...e$];for(let s of t)try{(await fetch(`/api/providers/${s}`,{method:"DELETE"})).ok||(e+=1)}catch(t){console.log("Error deleting connection:",t),e+=1}k(e=>e.filter(e=>!t.includes(e.id))),eA([]),e>0&&alert(`Deleted ${t.length-e} connection(s), ${e} failed.`)}})},children:["Delete Selected (",e$.length,")"]}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:tq,disabled:eZ,children:eZ?"Testing Connection One-by-One...":"Test Connection One-by-One"}),eZ&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{eZ&&(e8.current=!0,e0(!0))},disabled:eY,children:eY?"Stopping...":"Stop"})]}),tv&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Thought Level"}),(0,a.jsx)("select",{value:eR,onChange:e=>{var t;eU(t=e.target.value),tI(t)},className:"text-xs px-2 py-1 border border-border rounded-md bg-background focus:outline-none focus:border-primary",children:tv.options.map(e=>(0,a.jsx)("option",{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(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"===eI,onChange:e=>{let t=e?"round-robin":null,s=e?eD||"1":eD;e&&!eD&&e_("1"),ez(t),tO(t,s)}}),"round-robin"===eI&&(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:eD,onChange:e=>{var t;e_(t=e.target.value),tO("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"})]})]}),"zenmux-free"===b&&N.length>0&&(0,a.jsx)(R,{connectionId:N[0].id,cookie:N[0].apiKey||"",currentPlan:N[0].providerSpecificData?.zenmuxPlan||"free",onPlanChanged:()=>{tE()}})]})]}),0===N.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:td?"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"}),tg&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",ty," or ",tb,"."]})]})]}),(0,a.jsx)("div",{className:"flex gap-2",children:tg?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:tl,children:ty}),(0,a.jsx)(d.$n,{size:"sm",icon:"key",onClick:ti,children:tb})]}):(0,a.jsxs)(a.Fragment,{children:[!tf&&"iflow"===b&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>G(!0),children:"Cookie"}),"codex"===b&&(0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>ee(!0),children:(0,u.Tl)("Bulk Add")}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:tr,children:tf?"Add API Key":"iflow"===b?"OAuth":"Add Connection"})]})})]}):(0,a.jsxs)(a.Fragment,{children:[e4&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-border 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: ",e4.total]}),(0,a.jsxs)("span",{children:["Completed: ",e4.completed]}),(0,a.jsxs)("span",{children:["Passed: ",e4.passed]}),(0,a.jsxs)("span",{children:["Failed: ",e4.failed]}),e4.stopped&&(0,a.jsx)("span",{className:"text-warning",children:"Stopped"}),eZ&&e1&&(0,a.jsxs)("span",{children:["Running: ",N.find(e=>e.id===e1)?.name||e1]})]})}),N.length>0&&(0,a.jsx)("div",{className:"mb-3 flex items-center gap-2 border-b border-black/[0.03] pb-2 dark:border-white/[0.03]",children:(0,a.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-xs text-text-muted hover:text-primary",children:[(0,a.jsx)("input",{type:"checkbox",checked:tG,onChange:()=>{tG?eA([]):eA(N.map(e=>e.id))},className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Select All"]})}),tX,!tf&&(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===b&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>G(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codex"===b&&(0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>ee(!0),title:(0,u.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,u.Tl)("Bulk Add")}),tg?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:tl,className:"w-full sm:w-auto",children:ty}),(0,a.jsx)(d.$n,{size:"sm",icon:"key",onClick:ti,className:"w-full sm:w-auto",children:tb})]}):(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:tr,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,a.jsx)(d.Zp,{children:(0,a.jsx)("div",{className:"py-1",children:(0,a.jsx)(U,{providerId:b})})}),(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),!tf&&(e=[...tx,...eF.filter(e=>!tx.some(t=>t.id===e.id))].filter(e=>{let t=(0,m.CP)(e);return!t||"llm"===t}).map(e=>e.id).filter(e=>!eW.includes(e)),t=ej.trim().toLowerCase(),s=e.filter(e=>!t||e.toLowerCase().includes(t)),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[eW.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:t$,children:"Active All"}),e.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>tS(e),children:"Disable All"}),(N.length>0||tm)&&s.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"primary",icon:ew?"progress_activity":"play_arrow",onClick:()=>t2(s),disabled:ew,children:ew?"Testing...":`Test All (${s.length})`})]}))]}),(0,a.jsx)("div",{className:"sm:max-w-xs",children:(0,a.jsx)(d.pd,{type:"search",placeholder:"Search models...",value:ej,onChange:e=>eN(e.target.value),className:"w-full"})})]}),!!eg&&(0,a.jsx)("p",{className:"text-xs text-danger mb-3 break-words",children:eg}),(()=>{let e,t,s;if(tf)return(0,a.jsx)(C,{providerStorageAlias:tj,providerDisplayAlias:tN,modelAliases:ed,customModels:em,copied:te,onCopy:tt,onSetAlias:tD,onDeleteAlias:t_,onAddCustomModel:e=>tR(e,"llm",tj),onDeleteCustomModel:e=>tU(e,"llm",tj),connections:N,isAnthropic:th});let l=[...tx,...eF.filter(e=>!tx.some(t=>t.id===e.id))].filter(e=>{let t=(0,m.CP)(e);return!t||"llm"===t}),i=new Set(eW),r=l.filter(e=>!i.has(e.id)),n=l.filter(e=>i.has(e.id)),o=g({customModels:em,modelAliases:ed,providerAlias:tj,builtInModels:tx,type:"llm"}),d=ej.trim().toLowerCase(),c=(e,t="")=>!d||e.toLowerCase().includes(d)||String(t).toLowerCase().includes(d),x=r.filter(e=>c(e.id,e.name)),p=o.filter(e=>c(e.id,e.name));return(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[p.map(e=>(0,a.jsx)(w,{model:{id:e.id,name:e.name},fullModel:`${tN}/${e.id}`,alias:e.alias,copied:te,onCopy:tt,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===e.source?tU(e.id,"llm",tj):t_(e.alias)},testStatus:eh[e.id],onTest:N.length>0||tm?()=>t1(e.id):void 0,isTesting:eb.has(e.id),isCustom:!0,isFree:!1,caps:v(`${b}/${e.id}`)},`${e.source}-${e.fullModel}`)),x.map(e=>{let t=`${tj}/${e.id}`,s=`${b}/${e.id}`,l=Object.entries(ed).find(([,e])=>e===t||e===s)?.[0];return(0,a.jsx)(w,{model:e,fullModel:`${tN}/${e.id}`,alias:l,copied:te,onCopy:tt,onSetAlias:t=>tD(e.id,t,tj),onDeleteAlias:()=>t_(l),testStatus:eh[e.id],onTest:N.length>0||tm?()=>t1(e.id):void 0,isTesting:eb.has(e.id),isFree:e.isFree,onDisable:()=>tk(e.id),caps:v(`${b}/${e.id}`)},e.id)}),ej.trim()&&0===x.length&&0===p.length&&(0,a.jsxs)("p",{className:"w-full text-center text-sm text-text-muted py-4",children:["No models match “",ej,"”"]}),(0,a.jsxs)("button",{onClick:()=>eS(!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"===b&&N.some(e=>!1!==e.isActive)&&(0,a.jsxs)("button",{onClick:tM,disabled:e7,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-info 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:e7?{animation:"spin 1s linear infinite"}:void 0,children:e7?"progress_activity":"download"}),e7?(0,u.Tl)("Fetching..."):(0,u.Tl)("Fetch Qoder Models")]}),eL.length>0&&(e=new Set([...Object.values(ed),...o.map(e=>e.fullModel)]),t=new Set(tx.map(e=>e.id)),0===(s=eL.filter(s=>!e.has(`${tj}/${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 tR(e.id,"llm",tj)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-border 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:()=>tC(e.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-border 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))})]})]})})()]}),t0,"kiro"===b?(0,a.jsx)(d.Mh,{isOpen:W,providerInfo:tn,onSuccess:tK,onClose:()=>B(!1)}):"cursor"===b?(0,a.jsx)(d.G9,{isOpen:W,onSuccess:tK,onClose:()=>B(!1)}):"gitlab"===b?(0,a.jsx)(d.vj,{isOpen:W,providerInfo:tn,onSuccess:tK,onClose:()=>B(!1)}):(0,a.jsx)(d.LF,{isOpen:W,provider:b,providerInfo:tn,onSuccess:tK,onClose:()=>B(!1)}),"iflow"===b&&(0,a.jsx)(d.vE,{isOpen:H,onSuccess:()=>{tE(),G(!1)},onClose:()=>G(!1)}),(0,a.jsx)(E,{isOpen:Q,provider:b,providerName:tn.name,isCompatible:tf,isAnthropic:th,authType:tn?.authType,authHint:tn?.authHint,website:tn?.website,proxyPools:D,error:Z,onSave:tF,onBulkDone:tE,onClose:()=>{X(""),V(!1)}}),(0,a.jsx)(d.wI,{isOpen:et,connection:en,proxyPools:D,onSave:tJ,onClose:()=>es(!1)}),tf&&(0,a.jsx)(P,{isOpen:ea,node:T,onSave:tP,onClose:()=>el(!1),isAnthropic:th}),!tf&&(0,a.jsx)(O,{isOpen:eC,providerAlias:tj,providerDisplayAlias:tN,onSave:async e=>{await tR(e,"llm",tj),eS(!1)},onClose:()=>eS(!1)}),"codex"===b&&(0,a.jsx)(z,{isOpen:Y,onClose:()=>ee(!1),onSuccess:tE}),(0,a.jsx)(d.uo,{isOpen:eQ,onClose:()=>eV(!1),onConfirm:()=>{(window.localStorage.setItem(ts,"true"),eV(!1),td)?ta():ti()},title:"Risk Notice",message:tn?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,a.jsx)(d.uo,{isOpen:!!eH,onClose:()=>eG(null),onConfirm:eH?.onConfirm,title:eH?.title||"Confirm",message:eH?.message,variant:"danger"})]})}},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})},88845:(e,t,s)=>{Promise.resolve().then(s.bind(s,26706))}},e=>{e.O(0,[27,5772,1321,705,5497,8441,3794,7358],()=>e(e.s=88845)),_N_E=e.O()}]);