zevairouter 1.1.73 → 1.1.75

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 (236) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/cli/app/.next-cli-build/BUILD_ID +1 -1
  3. package/cli/app/.next-cli-build/app-path-routes-manifest.json +16 -16
  4. package/cli/app/.next-cli-build/build-manifest.json +2 -2
  5. package/cli/app/.next-cli-build/prerender-manifest.json +3 -3
  6. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page_client-reference-manifest.js +1 -1
  7. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  8. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  9. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  10. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  11. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  12. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page_client-reference-manifest.js +1 -1
  13. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  14. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  15. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  16. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  17. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  18. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  19. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  20. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
  21. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  22. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  23. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
  24. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  25. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  26. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  27. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  28. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  29. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  30. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  31. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  32. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page_client-reference-manifest.js +1 -1
  33. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  34. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  35. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  36. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  37. package/cli/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  38. package/cli/app/.next-cli-build/server/app/_global-error.html +1 -1
  39. package/cli/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  40. package/cli/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  41. package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  42. package/cli/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  43. package/cli/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  44. package/cli/app/.next-cli-build/server/app/_not-found.html +1 -1
  45. package/cli/app/.next-cli-build/server/app/_not-found.rsc +2 -2
  46. package/cli/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +2 -2
  47. package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  48. package/cli/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  49. package/cli/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
  50. package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  51. package/cli/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
  52. package/cli/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +1 -1
  53. package/cli/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js +2 -2
  54. package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +2 -2
  55. package/cli/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
  56. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +2 -2
  57. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
  58. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  59. package/cli/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js +2 -2
  60. package/cli/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +2 -2
  61. package/cli/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js +1 -1
  62. package/cli/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
  63. package/cli/app/.next-cli-build/server/app/api/cli-tools/dsh-settings/route.js +1 -1
  64. package/cli/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js +2 -2
  65. package/cli/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +2 -2
  66. package/cli/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +2 -2
  67. package/cli/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
  68. package/cli/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  69. package/cli/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js +2 -2
  70. package/cli/app/.next-cli-build/server/app/api/cli-tools/openbot-settings/route.js +2 -2
  71. package/cli/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +1 -1
  72. package/cli/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
  73. package/cli/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +2 -2
  74. package/cli/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js +2 -2
  75. package/cli/app/.next-cli-build/server/app/api/models/route.js +1 -1
  76. package/cli/app/.next-cli-build/server/app/api/providers/opencode/discover-models/route.js +1 -1
  77. package/cli/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  78. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  79. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
  80. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +2 -2
  81. package/cli/app/.next-cli-build/server/app/api/version/route.js +1 -1
  82. package/cli/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  83. package/cli/app/.next-cli-build/server/app/callback.html +1 -1
  84. package/cli/app/.next-cli-build/server/app/callback.rsc +2 -2
  85. package/cli/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +2 -2
  86. package/cli/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
  87. package/cli/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +2 -2
  88. package/cli/app/.next-cli-build/server/app/dashboard/automation.html +1 -1
  89. package/cli/app/.next-cli-build/server/app/dashboard/automation.rsc +2 -2
  90. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation/__PAGE__.segment.rsc +2 -2
  91. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_full.segment.rsc +2 -2
  92. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_tree.segment.rsc +1 -1
  93. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  94. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +2 -2
  95. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  96. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +2 -2
  97. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
  98. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  99. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +2 -2
  100. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  101. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +2 -2
  102. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
  103. package/cli/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  104. package/cli/app/.next-cli-build/server/app/dashboard/combos.rsc +2 -2
  105. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  106. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +2 -2
  107. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
  108. package/cli/app/.next-cli-build/server/app/dashboard/context.html +1 -1
  109. package/cli/app/.next-cli-build/server/app/dashboard/context.rsc +2 -2
  110. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context/__PAGE__.segment.rsc +2 -2
  111. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_full.segment.rsc +2 -2
  112. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_tree.segment.rsc +1 -1
  113. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  114. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.rsc +2 -2
  115. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  116. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +2 -2
  117. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
  118. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  119. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +2 -2
  120. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  121. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +2 -2
  122. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
  123. package/cli/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  124. package/cli/app/.next-cli-build/server/app/dashboard/mitm.rsc +2 -2
  125. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  126. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +2 -2
  127. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
  128. package/cli/app/.next-cli-build/server/app/dashboard/playground.html +1 -1
  129. package/cli/app/.next-cli-build/server/app/dashboard/playground.rsc +2 -2
  130. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground/__PAGE__.segment.rsc +2 -2
  131. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_full.segment.rsc +2 -2
  132. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_tree.segment.rsc +1 -1
  133. package/cli/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  134. package/cli/app/.next-cli-build/server/app/dashboard/profile.rsc +2 -2
  135. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  136. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +2 -2
  137. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
  138. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  139. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.rsc +2 -2
  140. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  141. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +2 -2
  142. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
  143. package/cli/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  144. package/cli/app/.next-cli-build/server/app/dashboard/providers.rsc +2 -2
  145. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  146. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +2 -2
  147. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
  148. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  149. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +2 -2
  150. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  151. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +2 -2
  152. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
  153. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  154. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +2 -2
  155. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
  156. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +2 -2
  157. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
  158. package/cli/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
  159. package/cli/app/.next-cli-build/server/app/dashboard/quota.rsc +2 -2
  160. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +2 -2
  161. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +2 -2
  162. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
  163. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  164. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +2 -2
  165. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing/__PAGE__.segment.rsc +2 -2
  166. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +2 -2
  167. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  168. package/cli/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  169. package/cli/app/.next-cli-build/server/app/dashboard/skills.rsc +2 -2
  170. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
  171. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +2 -2
  172. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
  173. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  174. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.rsc +2 -2
  175. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
  176. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +2 -2
  177. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
  178. package/cli/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  179. package/cli/app/.next-cli-build/server/app/dashboard/translator.rsc +2 -2
  180. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  181. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +2 -2
  182. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
  183. package/cli/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  184. package/cli/app/.next-cli-build/server/app/dashboard/usage.rsc +2 -2
  185. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  186. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +2 -2
  187. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
  188. package/cli/app/.next-cli-build/server/app/dashboard.html +1 -1
  189. package/cli/app/.next-cli-build/server/app/dashboard.rsc +2 -2
  190. package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  191. package/cli/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +2 -2
  192. package/cli/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  193. package/cli/app/.next-cli-build/server/app/index.html +1 -1
  194. package/cli/app/.next-cli-build/server/app/index.rsc +2 -2
  195. package/cli/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  196. package/cli/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +2 -2
  197. package/cli/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
  198. package/cli/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  199. package/cli/app/.next-cli-build/server/app/landing.html +1 -1
  200. package/cli/app/.next-cli-build/server/app/landing.rsc +2 -2
  201. package/cli/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +2 -2
  202. package/cli/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
  203. package/cli/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +2 -2
  204. package/cli/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  205. package/cli/app/.next-cli-build/server/app/login.html +1 -1
  206. package/cli/app/.next-cli-build/server/app/login.rsc +2 -2
  207. package/cli/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +2 -2
  208. package/cli/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
  209. package/cli/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  210. package/cli/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  211. package/cli/app/.next-cli-build/server/app-paths-manifest.json +16 -16
  212. package/cli/app/.next-cli-build/server/chunks/1350.js +1 -1
  213. package/cli/app/.next-cli-build/server/chunks/1757.js +1 -1
  214. package/cli/app/.next-cli-build/server/chunks/267.js +1 -1
  215. package/cli/app/.next-cli-build/server/chunks/412.js +2 -2
  216. package/cli/app/.next-cli-build/server/chunks/5330.js +61 -61
  217. package/cli/app/.next-cli-build/server/chunks/5626.js +1 -1
  218. package/cli/app/.next-cli-build/server/chunks/5744.js +1 -1
  219. package/cli/app/.next-cli-build/server/chunks/5819.js +72 -16
  220. package/cli/app/.next-cli-build/server/chunks/6166.js +1 -1
  221. package/cli/app/.next-cli-build/server/chunks/7135.js +1 -1
  222. package/cli/app/.next-cli-build/server/chunks/7319.js +92 -36
  223. package/cli/app/.next-cli-build/server/chunks/7364.js +1 -1
  224. package/cli/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  225. package/cli/app/.next-cli-build/server/pages/404.html +1 -1
  226. package/cli/app/.next-cli-build/server/pages/500.html +1 -1
  227. package/cli/app/.next-cli-build/server/preview-props.json +3 -3
  228. package/cli/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  229. package/cli/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  230. package/cli/app/.next-cli-build/static/chunks/{620-5b28c7cb880945f8.js → 620-5dcb9cde7ac3a657.js} +1 -1
  231. package/cli/app/CHANGELOG.md +10 -0
  232. package/cli/app/package.json +1 -1
  233. package/cli/package.json +1 -1
  234. package/package.json +1 -1
  235. /package/cli/app/.next-cli-build/static/{WZO5flg0UOsDeLokBauKB → Un7-kxqLQqw_hcB3wU7vf}/_buildManifest.js +0 -0
  236. /package/cli/app/.next-cli-build/static/{WZO5flg0UOsDeLokBauKB → Un7-kxqLQqw_hcB3wU7vf}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- (()=>{var a={};a.id=2134,a.ids=[2134],a.modules={643:a=>{"use strict";a.exports=require("node:perf_hooks")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{"use strict";a.exports=require("node:buffer")},5757:(a,b,c)=>{Promise.resolve().then(c.bind(c,93110))},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},16698:a=>{"use strict";a.exports=require("node:async_hooks")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},28354:a=>{"use strict";a.exports=require("util")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},32467:a=>{"use strict";a.exports=require("node:http2")},33873:a=>{"use strict";a.exports=require("path")},34589:a=>{"use strict";a.exports=require("node:assert")},37067:a=>{"use strict";a.exports=require("node:http")},37540:a=>{"use strict";a.exports=require("node:console")},37830:a=>{"use strict";a.exports=require("node:stream/web")},38522:a=>{"use strict";a.exports=require("node:zlib")},40610:a=>{"use strict";a.exports=require("node:dns")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},41692:a=>{"use strict";a.exports=require("node:tls")},41792:a=>{"use strict";a.exports=require("node:querystring")},44062:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>aT});var d=c(48249),e=c(67484),f=c(19099),g=c(2116),h=c.n(g),i=c(81220),j=c(50412),k=c(7585);let l=["kiro","codebuddy","codebuddy-cn","qoder","antigravity","cloudflare-ai","grok-cli"];function m(a){return l.includes(String(a||""))}function n(a){let b=String(a||"").trim();return b&&m(b)?`/dashboard/automation?provider=${encodeURIComponent(b)}`:"/dashboard/automation"}var o=c(91431),p=c(50377),q=c(99258),r=c(67088),s=c(17223),t=c(74875);c(22062);let u=Object.freeze({oauth:Object.freeze({id:"oauth",label:"OAuth",icon:"lock",description:"Connect through the provider sign-in flow."}),apikey:Object.freeze({id:"apikey",label:"API Key",icon:"key",description:"Connect with an API key or provider credential."}),cookie:Object.freeze({id:"cookie",label:"Browser Cookie",icon:"cookie",description:"Connect with a signed-in browser session cookie."}),"quota-cookie":Object.freeze({id:"quota-cookie",label:"Quota Cookie",icon:"cookie",description:"Attach a web session so Quota Tracker can read credits."})}),v=Object.freeze({codebuddy:Object.freeze(["quota-cookie"]),"codebuddy-cn":Object.freeze(["quota-cookie"]),iflow:Object.freeze(["cookie"])}),w=Object.freeze({qoder:Object.freeze({apikey:Object.freeze({label:"Qoder PAT"})}),"qoder-cn":Object.freeze({apikey:Object.freeze({label:"Qoder PAT"})}),xai:Object.freeze({oauth:Object.freeze({label:"Grok Build OAuth"}),apikey:Object.freeze({label:"xAI API Key"})}),kimi:Object.freeze({oauth:Object.freeze({label:"Kimi Coding OAuth"}),apikey:Object.freeze({label:"Kimi API Key"})}),muse:Object.freeze({oauth:Object.freeze({label:"OAuth"}),apikey:Object.freeze({label:"API Key"})}),"grok-cli":Object.freeze({oauth:Object.freeze({label:"Grok CLI Device Login"})})});function x(a,b){a.includes(b)||a.push(b)}var y=c(41371),z=c(85191),A=c(49885),B=c.n(A);function C({model:a,fullModel:b,alias:c,copied:e,onCopy:f,testStatus:g,isCustom:h,isFree:i,onDeleteAlias:j,onTest:k,isTesting:l,onDisable:m,thinkingSuffix:n}){let o="ok"===g?"#22c55e":"error"===g?"#ef4444":void 0,p=n?`${b}(${n})`:b;return(0,d.jsx)("div",{className:`group min-w-0 max-w-full rounded-lg border px-3 py-2 ${"ok"===g?"border-green-500/40":"error"===g?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2 sm:items-center",children:[(0,d.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base",style:o?{color:o}:void 0,children:"ok"===g?"check_circle":"error"===g?"cancel":"smart_toy"}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,d.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:p}),a.name&&(0,d.jsx)("span",{className:"truncate pl-1 text-[9px] italic text-text-muted/70",children:a.name})]}),k&&(0,d.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,d.jsx)("button",{onClick:k,disabled:l,className:`rounded p-0.5 text-text-muted transition-opacity hover:bg-sidebar hover:text-primary ${l?"opacity-100":"opacity-100 sm:opacity-0 sm:group-hover:opacity-100"}`,children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",style:l?{animation:"spin 1s linear infinite"}:void 0,children:l?"progress_activity":"science"})}),(0,d.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:l?"Testing...":"Test"})]}),(0,d.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,d.jsx)("button",{onClick:()=>f(p,`model-${a.id}`),className:"rounded p-0.5 text-text-muted hover:bg-sidebar hover:text-primary",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:e===`model-${a.id}`?"check":"content_copy"})}),(0,d.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:e===`model-${a.id}`?"Copied!":"Copy"})]}),h?(0,d.jsx)("button",{onClick:j,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,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):m?(0,d.jsx)("button",{onClick:m,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Disable this model",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):null]})})}function D({models:a,modelAliases:b,providerStorageAlias:c,providerDisplayAlias:d}){let e={...b||{}},f=new Set(Object.values(e)),g=[];for(let b of Array.isArray(a)?a:[]){let a=function(a){if(!a)return"";if("string"==typeof a)return a.trim();let b=a.id||a.name||a.model;return"string"==typeof b?b.trim():""}(b);if(!a)continue;let h=`${c}/${a}`;if(f.has(h))continue;let i=function(a,b,c){let d=a.split("/"),e=d[d.length-1];if(!e)return"";if(!b[e])return e;let f=`${c}-${e}`;if(!b[f])return f;let g=2;for(;b[`${f}-${g}`];)g+=1;return`${f}-${g}`}(a,e,d);i&&(g.push({alias:i,model:h,modelId:a}),e[i]=h,f.add(h))}return g}function E({modelId:a,fullModel:b,copied:c,onCopy:e,onDeleteAlias:f,onTest:g,testStatus:h,isTesting:i}){let j="ok"===h?"#22c55e":"error"===h?"#ef4444":void 0;return(0,d.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===h?"border-green-500/40":"error"===h?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",style:j?{color:j}:void 0,children:"ok"===h?"check_circle":"error"===h?"cancel":"smart_toy"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium truncate",children:a}),(0,d.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,d.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:b}),(0,d.jsxs)("div",{className:"relative group/btn",children:[(0,d.jsx)("button",{onClick:()=>e(b,`model-${a}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:c===`model-${a}`?"check":"content_copy"})}),(0,d.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:c===`model-${a}`?"Copied!":"Copy"})]}),g&&(0,d.jsxs)("div",{className:"relative group/btn",children:[(0,d.jsx)("button",{onClick:g,disabled:i,className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",style:i?{animation:"spin 1s linear infinite"}:void 0,children:i?"progress_activity":"science"})}),(0,d.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:i?"Testing...":"Test"})]})]})]}),(0,d.jsx)("button",{onClick:f,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function F({providerStorageAlias:a,providerDisplayAlias:b,modelAliases:c,copied:f,onCopy:g,onSetAlias:h,onDeleteAlias:i,onAliasesChanged:k,connections:l,isAnthropic:m}){let[n,o]=(0,e.useState)(""),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(()=>new Set),[v,w]=(0,e.useState)({}),x=async b=>{let c=`${a}/${b}`;u(a=>new Set(a).add(b));try{let a=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:c})}),b=await a.json();w(a=>({...a,[c]:b.ok?"ok":"error"}))}catch{w(a=>({...a,[c]:"error"}))}finally{u(a=>{let c=new Set(a);return c.delete(b),c})}},y=Object.entries(c).filter(([,b])=>b.startsWith(`${a}/`)).map(([b,c])=>({modelId:c.replace(`${a}/`,""),fullModel:c,alias:b})),z=async()=>{if(!n.trim()||p)return;let d=n.trim(),[e]=D({models:[{id:d}],modelAliases:c,providerStorageAlias:a,providerDisplayAlias:b});if(!e)return void alert("This model already exists.");q(!0);try{await h(d,e.alias,a),o("")}catch(a){console.log("Error adding model:",a),alert(a?.message||`Failed to add model "${d}".`)}finally{q(!1)}},A=async()=>{if(r)return;let d=l.find(a=>!1!==a.isActive);if(d){s(!0);try{let e=await fetch(`/api/providers/${d.id}/models`),f=await e.json();if(!e.ok)return void alert(f.error||"Failed to import models");let g=f.models||[];if(0===g.length)return void alert("No models returned from /models.");let h=D({models:g,modelAliases:c,providerStorageAlias:a,providerDisplayAlias:b});if(0===h.length)return void alert("No new models were added.");let i=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({aliases:h.map(({alias:a,model:b})=>({alias:a,model:b}))})}),j=await i.json();if(!i.ok)throw Error(j.error||"Failed to save imported models.");await k(),alert(`Successfully added ${j.count||h.length} models.`)}catch(a){console.log("Error importing models:",a),alert(a?.message||"Failed to import models from /models.")}finally{s(!1)}}},B=l.some(a=>!1!==a.isActive);return(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",m?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,d.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,d.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,d.jsx)("input",{id:"new-compatible-model-input",type:"text",value:n,onChange:a=>o(a.target.value),onKeyDown:a=>"Enter"===a.key&&z(),placeholder:m?"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,d.jsx)(j.$n,{size:"sm",icon:"add",onClick:z,disabled:!n.trim()||p,children:p?"Adding...":"Add"}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"download",onClick:A,disabled:!B||r,children:r?"Importing...":"Import from /models"})]}),!B&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),y.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-3",children:y.map(({modelId:c,fullModel:e,alias:h})=>(0,d.jsx)(E,{modelId:c,fullModel:`${b}/${c}`,copied:f,onCopy:g,onDeleteAlias:()=>i(h),onTest:l.length>0?()=>x(c):void 0,testStatus:v[`${a}/${c}`],isTesting:t.has(c)},e))})]})}C.propTypes={model:B().shape({id:B().string.isRequired}).isRequired,fullModel:B().string.isRequired,alias:B().string,copied:B().string,onCopy:B().func.isRequired,testStatus:B().oneOf(["ok","error"]),isCustom:B().bool,isFree:B().bool,onDeleteAlias:B().func,onTest:B().func,isTesting:B().bool,onDisable:B().func,thinkingSuffix:B().string},B().string.isRequired,B().string.isRequired,B().string,B().func.isRequired,B().func.isRequired,B().func,B().oneOf(["ok","error"]),B().bool,B().string.isRequired,B().object.isRequired,B().string,B().func.isRequired,B().func.isRequired,B().func.isRequired,F.propTypes={providerStorageAlias:B().string.isRequired,providerDisplayAlias:B().string.isRequired,modelAliases:B().object.isRequired,copied:B().string,onCopy:B().func.isRequired,onSetAlias:B().func.isRequired,onDeleteAlias:B().func.isRequired,onAliasesChanged:B().func.isRequired,connections:B().arrayOf(B().shape({id:B().string,isActive:B().bool})).isRequired,isAnthropic:B().bool};var G=c(74429),H=c(25049);function I({until:a}){let[b,c]=(0,e.useState)("");return b?(0,d.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",b]}):null}I.propTypes={until:B().string.isRequired};var J=c(74016);function K({connection:a,proxyPools:b,isOAuth:c,isFirst:f,isLast:g,onMoveUp:h,onMoveDown:i,onToggleActive:k,onUpdateProxy:l,onEdit:m,onDelete:n,autoPingEnabled:o=!1,onToggleAutoPing:p,autoPingScheduled:q=!1,onOpenAutoPingSchedule:r,onTogglePaid:s,oneByOneStatus:u=null}){let[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(null),z=(0,e.useRef)(null),[A,B]=(0,e.useState)(!1),C=(0,e.useRef)(null),D=(0,e.useMemo)(()=>new Map((b||[]).map(a=>[a.id,a])),[b]),E=(0,e.useMemo)(()=>b||[],[b]),F=a.providerSpecificData?.proxyPoolId||null,L=F?D.get(F):null,M=a.providerSpecificData?.connectionProxyEnabled===!0&&!!a.providerSpecificData?.connectionProxyUrl,N=!!F||M,O=L?`Pool: ${L.name}`:F?`Pool: ${F} (inactive/missing)`:M?`Legacy: ${a.providerSpecificData?.connectionProxyUrl}`:"",P="";if(L?.proxyUrl||a.providerSpecificData?.connectionProxyUrl){let b=L?.proxyUrl||a.providerSpecificData?.connectionProxyUrl;try{let a=new URL(b);P=`${a.protocol}//${a.hostname}${a.port?`:${a.port}`:""}`}catch{P=b}}let Q=L?.noProxy||a.providerSpecificData?.connectionNoProxy||"",R="default";L?.isActive===!0?R="success":(F||M)&&(R="error");let S=async a=>{B(!0);try{await l("__none__"===a?null:a)}finally{B(!1),w(!1)}},T=a.authType||(c?"oauth":"apikey"),U="oauth"===T,V="cookie"===T,W=a=>"string"==typeof a&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a),X=U?W(a.email)?a.email:W(a.name)?a.name:a.name||a.email||a.displayName||"OAuth Account":a.name||a.email||a.displayName||"API Key",Y=(0,H.c)(a),Z=null!==Y,$="unavailable"!==a.testStatus||Z?a.testStatus:"active",_=(0,t.d4)(a),aa=!!a.quarantinedAt,ab={policy_suspended:"Policy suspension",account_validation_required:"Account verification required",credential_rejected:"Credential rejected",reauth_required:"Sign-in required",authentication:"Repeated authentication failure"}[a.failureClass]||a.quarantineReason||"Account quarantined",ac=Number.isFinite(Date.parse(a.quarantinedAt))?new Date(a.quarantinedAt).toLocaleString():a.quarantinedAt||null,ad=a.modelLockReason?.resetsAt,ae=Number.isFinite(Date.parse(ad))?new Date(ad).toLocaleString():ad||null,af=()=>u?"queued"===u.state?"queued":"testing"===u.state?"testing":"success"===u.state?u.error?`connected: ${u.error}`:"success":"failed"===u.state?u.error?`failed: ${u.error}`:"failed":null:null;return(0,d.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===a.isActive&&!aa?"opacity-60":""}`,children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2 sm:items-center sm:gap-3",children:[(0,d.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,d.jsx)("button",{onClick:h,disabled:f,className:`p-0.5 rounded ${f?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,d.jsx)("button",{onClick:i,disabled:g,className:`p-0.5 rounded ${g?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,d.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base text-text-muted",children:V?"cookie":U?"lock":"key"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium truncate",children:X}),(0,d.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 sm:gap-2",children:[(0,d.jsx)(j.Ex,{variant:(()=>{if(!1===a.isActive)return"default";let b=(0,t.BU)(_);return"active"!==_.key?b:"active"===$||"success"===$?"success":"error"===$||"expired"===$||"unavailable"===$?"error":"default"})(),size:"sm",dot:!0,children:_.label||$||"unknown"}),(0,d.jsx)(j.Ex,{variant:"default",size:"sm",children:U?"OAuth":V?"Cookie":"API Key"}),aa&&(0,d.jsx)(j.Ex,{variant:"error",size:"sm",children:"Quarantined"}),N&&(0,d.jsx)(j.Ex,{variant:R,size:"sm",children:"Proxy"}),a.autoDisabledAt&&!aa&&(0,d.jsxs)("span",{className:"text-[10px] text-text-muted",children:["token_expired"===a.autoDisabledReason?"Token expired":"banned"===a.autoDisabledReason?"Banned":"quota_exhausted"===a.autoDisabledReason?"Quota exhausted":"Auto-disabled"," — ",new Date(a.autoDisabledAt).toLocaleDateString()]}),aa&&(0,d.jsxs)("span",{className:"max-w-full truncate text-xs text-red-600 dark:text-red-400 sm:max-w-[420px]",title:`${a.quarantineReason||ab}${ac?` - ${ac}`:""}`,children:[ab,ac?` - ${ac}`:""]}),Z&&!1!==a.isActive&&(0,d.jsx)(I,{until:Y}),Z&&a.modelLockReason&&!1!==a.isActive&&(0,d.jsxs)("span",{className:"max-w-full truncate text-xs text-amber-600 dark:text-amber-400 sm:max-w-[360px]",title:`${a.modelLockReason.reason}${ae?` — resets ${ae}`:""}`,children:[a.modelLockReason.model,a.modelLockReason.providerErrorCode?` (${a.modelLockReason.providerErrorCode})`:"",ae?` — resets ${ae}`:""]}),a.lastError&&!1!==a.isActive&&(0,d.jsx)("span",{className:"max-w-full truncate text-xs text-red-500 sm:max-w-[300px]",title:a.lastError,children:a.lastError}),(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:["#",a.priority]}),a.globalPriority&&(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",a.globalPriority]}),af()&&(0,d.jsx)(j.Ex,{variant:u?"success"===u.state?"success":"failed"===u.state?"error":"testing"===u.state?"primary":"default":"default",size:"sm",children:af()})]}),N&&(0,d.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,d.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:O,children:O}),P&&(0,d.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}),Q&&(0,d.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:Q,children:["no_proxy: ",Q]})]}),aa&&!1===a.isActive&&(0,d.jsx)("p",{className:"mt-1 text-[11px] leading-relaxed text-text-muted",children:"Re-enable only permits router requests again; it does not change the account's upstream status."})]})]}),(0,d.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,d.jsxs)("div",{className:"grid flex-1 grid-cols-3 gap-1 sm:flex sm:flex-none",children:[E.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsxs)("button",{ref:z,type:"button",onClick:()=>{if(v)return void w(!1);let a=z.current?.getBoundingClientRect();a&&y((0,J.x)(a,E.length,{width:window.innerWidth,height:window.innerHeight})),w(!0)},className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${N?"text-primary":"text-text-muted hover:text-primary"}`,disabled:A,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:A?"progress_activity":"lan"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),v&&"u">typeof document&&(0,G.createPortal)((0,d.jsxs)("div",{ref:C,style:x,className:"z-50 max-w-[78vw] min-w-[160px] overflow-y-auto rounded-lg border border-border bg-bg py-1 shadow-lg",children:[(0,d.jsx)("button",{onClick:()=>S("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!F?"text-primary font-medium":"text-text-main"}`,children:"None"}),E.map(a=>(0,d.jsx)("button",{onClick:()=>S(a.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${F===a.id?"text-primary font-medium":"text-text-main"}`,children:a.name},a.id))]}),document.body)]}),s&&(0,d.jsxs)("button",{type:"button",onClick:()=>s(a.providerSpecificData?.paidSubscription!==!0),"aria-pressed":a.providerSpecificData?.paidSubscription===!0,className:`flex flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${a.providerSpecificData?.paidSubscription===!0?"text-primary":"text-text-muted hover:text-primary"}`,title:"Paid subscription: may serve Argon and Claude 5.5 when Google's quota data doesn't say",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"workspace_premium"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Paid"})]}),p&&(0,d.jsxs)("button",{onClick:()=>p(!o),className:`flex flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${o?"text-primary":"text-text-muted hover:text-primary"}`,title:o?"Disable quota auto-ping for this account":"Warm the 5-hour quota window after reset with a tiny request",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Auto-ping"})]}),r&&(0,d.jsxs)("button",{type:"button",onClick:r,className:`flex flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${q?"text-primary":"text-text-muted hover:text-primary"}`,title:"Ping at fixed local times",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"schedule"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Schedule"})]}),(0,d.jsxs)("button",{onClick:m,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,d.jsxs)("button",{onClick:n,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 hover:bg-red-500/10",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,d.jsx)(j.lM,{size:"sm",checked:a.isActive??!0,onChange:k,title:a.isActive??!0?"Disable connection":aa?"Re-enable routing only; upstream suspension or credential status is unchanged":"Enable connection"})]})]})}K.propTypes={connection:B().shape({id:B().string,name:B().string,email:B().string,displayName:B().string,modelLockUntil:B().string,testStatus:B().string,isActive:B().bool,lastError:B().string,failureClass:B().string,quarantinedAt:B().string,quarantineReason:B().string,priority:B().number,globalPriority:B().number}).isRequired,proxyPools:B().arrayOf(B().shape({id:B().string,name:B().string,proxyUrl:B().string,noProxy:B().string,isActive:B().bool})),isOAuth:B().bool.isRequired,isFirst:B().bool.isRequired,isLast:B().bool.isRequired,onMoveUp:B().func.isRequired,onMoveDown:B().func.isRequired,onToggleActive:B().func.isRequired,onUpdateProxy:B().func,autoPingEnabled:B().bool,onToggleAutoPing:B().func,autoPingScheduled:B().bool,onOpenAutoPingSchedule:B().func,onTogglePaid:B().func,onEdit:B().func.isRequired,onDelete:B().func.isRequired,oneByOneStatus:B().shape({state:B().string,error:B().string})};var L=c(71404);function M(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}let N={anchor:"09:30",timezone:M(),windowHours:5,slotsPerDay:3};function O(a){let b=/^(\d{1,2}):(\d{2})$/.exec(String(a||"").trim());if(!b)return null;let c=Number(b[1]),d=Number(b[2]);return c>23||d>59?null:{hour:c,minute:d}}function P(a){return Math.max(1,Math.floor(24/a))}function Q(a,b,c,d){let e="number"==typeof a?a:Number(a);return Number.isFinite(e)?Math.min(d,Math.max(c,e)):b}let R=[{value:"off",label:"Off",icon:"block"},{value:"reset",label:"On reset",icon:"bolt"},{value:"schedule",label:"Schedule",icon:"schedule"}];function S({isOpen:a,onClose:b,onSave:c,connection:f,reactive:g=!1,schedule:h=null}){let[i,k]=(0,e.useState)(()=>({mode:h?.enabled===!0?"schedule":!0===g?"reset":"off",anchor:h?.anchor||N.anchor,timezone:M(),windowHours:String(h?.windowHours??N.windowHours),slotsPerDay:String(h?.slotsPerDay??N.slotsPerDay)})),l=Number(i.windowHours),m=Number(i.slotsPerDay),n=!!O(i.anchor),o=Number.isFinite(l)&&l>=.5&&l<=24,p=o?P(l):24,q=Number.isInteger(m)&&m>=1&&m<=p,r="schedule"!==i.mode||n&&o&&q,s=n&&o&&q?function(a){let b=function(a){if(!a||!0!==a.enabled)return null;let b=O(a.anchor)||O(N.anchor),c=`${String(b.hour).padStart(2,"0")}:${String(b.minute).padStart(2,"0")}`,d=!function(a){if(!a||"string"!=typeof a)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:a}),!0}catch{return!1}}(a.timezone)?N.timezone:a.timezone,e=Q(a.windowHours,N.windowHours,.5,24),f=Math.round(Q(a.slotsPerDay,N.slotsPerDay,1,P(e)));return{enabled:!0,anchor:c,timezone:d,windowHours:e,slotsPerDay:f}}(a);if(!b)return[];let{hour:c,minute:d}=O(b.anchor),e=60*c+d;return Array.from({length:b.slotsPerDay},(a,c)=>{let d=Math.round(e+c*b.windowHours*60)%1440;return`${String(Math.floor(d/60)).padStart(2,"0")}:${String(d%60).padStart(2,"0")}`})}({enabled:!0,...i,windowHours:l,slotsPerDay:m}):[],t=s.length?(()=>{let{hour:a,minute:b}=O(i.anchor),c=Math.round(60*a+b+m*l*60)%1440;return`${String(Math.floor(c/60)).padStart(2,"0")}:${String(c%60).padStart(2,"0")}`})():"";return(0,d.jsx)(j.aF,{isOpen:a,onClose:b,title:"Auto-ping settings",footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.$n,{variant:"secondary",onClick:b,children:"Cancel"}),(0,d.jsx)(j.$n,{onClick:()=>{r&&(c({reactive:"reset"===i.mode,schedule:"schedule"===i.mode?{enabled:!0,anchor:i.anchor,timezone:i.timezone,windowHours:l,slotsPerDay:m}:{enabled:!1}}),b())},disabled:!r,children:"Save"})]}),children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Warm the 5-hour window",f?.name?` for ${f.name}`:"",". Pick one mode."]}),(0,d.jsx)("div",{className:"grid grid-cols-3 gap-1 rounded-lg bg-black/[0.03] p-1 dark:bg-white/[0.03]",children:R.map(a=>(0,d.jsxs)("button",{type:"button",onClick:()=>k(b=>({...b,mode:a.value})),className:(0,L.cn)("flex h-9 items-center justify-center gap-1.5 rounded-md text-sm font-medium",i.mode===a.value?"bg-surface text-text-main":"text-text-muted"),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[15px]",children:a.icon}),a.label]},a.value))}),"reset"===i.mode&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Pings once after the window resets."}),"schedule"===i.mode&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[(0,d.jsx)(j.pd,{label:"Anchor time",type:"time",value:i.anchor,onChange:a=>k(b=>({...b,anchor:a.target.value})),error:n?"":"Use HH:MM"}),(0,d.jsx)(j.pd,{label:"Window (hours)",type:"number",min:"0.5",max:"24",step:"0.5",value:i.windowHours,onChange:a=>k(b=>({...b,windowHours:a.target.value})),error:o?"":"0.5 – 24"}),(0,d.jsx)(j.pd,{label:"Pings per day",type:"number",min:"1",max:String(p),step:"1",value:i.slotsPerDay,onChange:a=>k(b=>({...b,slotsPerDay:a.target.value})),error:q?"":`1 – ${p}`})]}),s.length>0&&(0,d.jsxs)("p",{className:"text-sm text-text-main",children:[s.join(" → ")," (",i.timezone,"). Covers until ",t,"."]})]})]})})}S.propTypes={isOpen:B().bool.isRequired,onClose:B().func.isRequired,onSave:B().func.isRequired,connection:B().object,reactive:B().bool,schedule:B().object};var T=c(58962),U=c(41651);let V=`name1|sk-key1
1
+ (()=>{var a={};a.id=2134,a.ids=[2134],a.modules={643:a=>{"use strict";a.exports=require("node:perf_hooks")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{"use strict";a.exports=require("node:buffer")},5757:(a,b,c)=>{Promise.resolve().then(c.bind(c,93110))},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},16698:a=>{"use strict";a.exports=require("node:async_hooks")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},28354:a=>{"use strict";a.exports=require("util")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},32467:a=>{"use strict";a.exports=require("node:http2")},33873:a=>{"use strict";a.exports=require("path")},34589:a=>{"use strict";a.exports=require("node:assert")},37067:a=>{"use strict";a.exports=require("node:http")},37540:a=>{"use strict";a.exports=require("node:console")},37830:a=>{"use strict";a.exports=require("node:stream/web")},38522:a=>{"use strict";a.exports=require("node:zlib")},40610:a=>{"use strict";a.exports=require("node:dns")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},41692:a=>{"use strict";a.exports=require("node:tls")},41792:a=>{"use strict";a.exports=require("node:querystring")},44062:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>aT});var d=c(48249),e=c(67484),f=c(19099),g=c(2116),h=c.n(g),i=c(81220),j=c(50412),k=c(7585);let l=["kiro","codebuddy","codebuddy-cn","qoder","antigravity","cloudflare-ai","grok-cli"];function m(a){return l.includes(String(a||""))}function n(a){let b=String(a||"").trim();return b&&m(b)?`/dashboard/automation?provider=${encodeURIComponent(b)}`:"/dashboard/automation"}var o=c(91431),p=c(50377),q=c(99258),r=c(67088),s=c(17223),t=c(74875);c(22062);let u=Object.freeze({oauth:Object.freeze({id:"oauth",label:"OAuth",icon:"lock",description:"Connect through the provider sign-in flow."}),apikey:Object.freeze({id:"apikey",label:"API Key",icon:"key",description:"Connect with an API key or provider credential."}),cookie:Object.freeze({id:"cookie",label:"Browser Cookie",icon:"cookie",description:"Connect with a signed-in browser session cookie."}),"quota-cookie":Object.freeze({id:"quota-cookie",label:"Quota Cookie",icon:"cookie",description:"Attach a web session so Quota Tracker can read credits."})}),v=Object.freeze({codebuddy:Object.freeze(["quota-cookie"]),"codebuddy-cn":Object.freeze(["quota-cookie"]),iflow:Object.freeze(["cookie"])}),w=Object.freeze({qoder:Object.freeze({apikey:Object.freeze({label:"Qoder PAT"})}),"qoder-cn":Object.freeze({apikey:Object.freeze({label:"Qoder PAT"})}),xai:Object.freeze({oauth:Object.freeze({label:"Grok Build OAuth"}),apikey:Object.freeze({label:"xAI API Key"})}),kimi:Object.freeze({oauth:Object.freeze({label:"Kimi Coding OAuth"}),apikey:Object.freeze({label:"Kimi API Key"})}),muse:Object.freeze({oauth:Object.freeze({label:"OAuth"}),apikey:Object.freeze({label:"API Key"})}),"grok-cli":Object.freeze({oauth:Object.freeze({label:"Grok CLI Device Login"})})});function x(a,b){a.includes(b)||a.push(b)}var y=c(41371),z=c(85191),A=c(49885),B=c.n(A);function C({model:a,fullModel:b,alias:c,copied:e,onCopy:f,testStatus:g,isCustom:h,isFree:i,onDeleteAlias:j,onTest:k,isTesting:l,onDisable:m,thinkingSuffix:n}){let o="ok"===g?"#22c55e":"error"===g?"#ef4444":void 0,p=n?`${b}(${n})`:b;return(0,d.jsx)("div",{className:`group min-w-0 max-w-full rounded-lg border px-3 py-2 ${"ok"===g?"border-green-500/40":"error"===g?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2 sm:items-center",children:[(0,d.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base",style:o?{color:o}:void 0,children:"ok"===g?"check_circle":"error"===g?"cancel":"smart_toy"}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,d.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:p}),a.name&&(0,d.jsx)("span",{className:"truncate pl-1 text-[9px] italic text-text-muted/70",children:a.name})]}),k&&(0,d.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,d.jsx)("button",{onClick:k,disabled:l,className:`rounded p-0.5 text-text-muted transition-opacity hover:bg-sidebar hover:text-primary ${l?"opacity-100":"opacity-100 sm:opacity-0 sm:group-hover:opacity-100"}`,children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",style:l?{animation:"spin 1s linear infinite"}:void 0,children:l?"progress_activity":"science"})}),(0,d.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:l?"Testing...":"Test"})]}),(0,d.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,d.jsx)("button",{onClick:()=>f(p,`model-${a.id}`),className:"rounded p-0.5 text-text-muted hover:bg-sidebar hover:text-primary",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:e===`model-${a.id}`?"check":"content_copy"})}),(0,d.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:e===`model-${a.id}`?"Copied!":"Copy"})]}),h?(0,d.jsx)("button",{onClick:j,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,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):m?(0,d.jsx)("button",{onClick:m,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Disable this model",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):null]})})}function D({models:a,modelAliases:b,providerStorageAlias:c,providerDisplayAlias:d}){let e={...b||{}},f=new Set(Object.values(e)),g=[];for(let b of Array.isArray(a)?a:[]){let a=function(a){if(!a)return"";if("string"==typeof a)return a.trim();let b=a.id||a.name||a.model;return"string"==typeof b?b.trim():""}(b);if(!a)continue;let h=`${c}/${a}`;if(f.has(h))continue;let i=function(a,b,c){let d=a.split("/"),e=d[d.length-1];if(!e)return"";if(!b[e])return e;let f=`${c}-${e}`;if(!b[f])return f;let g=2;for(;b[`${f}-${g}`];)g+=1;return`${f}-${g}`}(a,e,d);i&&(g.push({alias:i,model:h,modelId:a}),e[i]=h,f.add(h))}return g}function E({modelId:a,fullModel:b,copied:c,onCopy:e,onDeleteAlias:f,onTest:g,testStatus:h,isTesting:i}){let j="ok"===h?"#22c55e":"error"===h?"#ef4444":void 0;return(0,d.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===h?"border-green-500/40":"error"===h?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",style:j?{color:j}:void 0,children:"ok"===h?"check_circle":"error"===h?"cancel":"smart_toy"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium truncate",children:a}),(0,d.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,d.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:b}),(0,d.jsxs)("div",{className:"relative group/btn",children:[(0,d.jsx)("button",{onClick:()=>e(b,`model-${a}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:c===`model-${a}`?"check":"content_copy"})}),(0,d.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:c===`model-${a}`?"Copied!":"Copy"})]}),g&&(0,d.jsxs)("div",{className:"relative group/btn",children:[(0,d.jsx)("button",{onClick:g,disabled:i,className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",style:i?{animation:"spin 1s linear infinite"}:void 0,children:i?"progress_activity":"science"})}),(0,d.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:i?"Testing...":"Test"})]})]})]}),(0,d.jsx)("button",{onClick:f,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function F({providerStorageAlias:a,providerDisplayAlias:b,modelAliases:c,copied:f,onCopy:g,onSetAlias:h,onDeleteAlias:i,onAliasesChanged:k,connections:l,isAnthropic:m}){let[n,o]=(0,e.useState)(""),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(()=>new Set),[v,w]=(0,e.useState)({}),x=async b=>{let c=`${a}/${b}`;u(a=>new Set(a).add(b));try{let a=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:c})}),b=await a.json();w(a=>({...a,[c]:b.ok?"ok":"error"}))}catch{w(a=>({...a,[c]:"error"}))}finally{u(a=>{let c=new Set(a);return c.delete(b),c})}},y=Object.entries(c).filter(([,b])=>b.startsWith(`${a}/`)).map(([b,c])=>({modelId:c.replace(`${a}/`,""),fullModel:c,alias:b})),z=async()=>{if(!n.trim()||p)return;let d=n.trim(),[e]=D({models:[{id:d}],modelAliases:c,providerStorageAlias:a,providerDisplayAlias:b});if(!e)return void alert("This model already exists.");q(!0);try{await h(d,e.alias,a),o("")}catch(a){console.log("Error adding model:",a),alert(a?.message||`Failed to add model "${d}".`)}finally{q(!1)}},A=async()=>{if(r)return;let d=l.find(a=>!1!==a.isActive);if(d){s(!0);try{let e=await fetch(`/api/providers/${d.id}/models`),f=await e.json();if(!e.ok)return void alert(f.error||"Failed to import models");let g=f.models||[];if(0===g.length)return void alert("No models returned from /models.");let h=D({models:g,modelAliases:c,providerStorageAlias:a,providerDisplayAlias:b});if(0===h.length)return void alert("No new models were added.");let i=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({aliases:h.map(({alias:a,model:b})=>({alias:a,model:b}))})}),j=await i.json();if(!i.ok)throw Error(j.error||"Failed to save imported models.");await k(),alert(`Successfully added ${j.count||h.length} models.`)}catch(a){console.log("Error importing models:",a),alert(a?.message||"Failed to import models from /models.")}finally{s(!1)}}},B=l.some(a=>!1!==a.isActive);return(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",m?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,d.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,d.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,d.jsx)("input",{id:"new-compatible-model-input",type:"text",value:n,onChange:a=>o(a.target.value),onKeyDown:a=>"Enter"===a.key&&z(),placeholder:m?"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,d.jsx)(j.$n,{size:"sm",icon:"add",onClick:z,disabled:!n.trim()||p,children:p?"Adding...":"Add"}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"download",onClick:A,disabled:!B||r,children:r?"Importing...":"Import from /models"})]}),!B&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),y.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-3",children:y.map(({modelId:c,fullModel:e,alias:h})=>(0,d.jsx)(E,{modelId:c,fullModel:`${b}/${c}`,copied:f,onCopy:g,onDeleteAlias:()=>i(h),onTest:l.length>0?()=>x(c):void 0,testStatus:v[`${a}/${c}`],isTesting:t.has(c)},e))})]})}C.propTypes={model:B().shape({id:B().string.isRequired}).isRequired,fullModel:B().string.isRequired,alias:B().string,copied:B().string,onCopy:B().func.isRequired,testStatus:B().oneOf(["ok","error"]),isCustom:B().bool,isFree:B().bool,onDeleteAlias:B().func,onTest:B().func,isTesting:B().bool,onDisable:B().func,thinkingSuffix:B().string},B().string.isRequired,B().string.isRequired,B().string,B().func.isRequired,B().func.isRequired,B().func,B().oneOf(["ok","error"]),B().bool,B().string.isRequired,B().object.isRequired,B().string,B().func.isRequired,B().func.isRequired,B().func.isRequired,F.propTypes={providerStorageAlias:B().string.isRequired,providerDisplayAlias:B().string.isRequired,modelAliases:B().object.isRequired,copied:B().string,onCopy:B().func.isRequired,onSetAlias:B().func.isRequired,onDeleteAlias:B().func.isRequired,onAliasesChanged:B().func.isRequired,connections:B().arrayOf(B().shape({id:B().string,isActive:B().bool})).isRequired,isAnthropic:B().bool};var G=c(74429),H=c(25049);function I({until:a}){let[b,c]=(0,e.useState)("");return b?(0,d.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",b]}):null}I.propTypes={until:B().string.isRequired};var J=c(74016);function K({connection:a,proxyPools:b,isOAuth:c,isFirst:f,isLast:g,onMoveUp:h,onMoveDown:i,onToggleActive:k,onUpdateProxy:l,onEdit:m,onDelete:n,autoPingEnabled:o=!1,onToggleAutoPing:p,autoPingScheduled:q=!1,onOpenAutoPingSchedule:r,onTogglePaid:s,oneByOneStatus:u=null}){let[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(null),z=(0,e.useRef)(null),[A,B]=(0,e.useState)(!1),C=(0,e.useRef)(null),D=(0,e.useMemo)(()=>new Map((b||[]).map(a=>[a.id,a])),[b]),E=(0,e.useMemo)(()=>b||[],[b]),F=a.providerSpecificData?.proxyPoolId||null,L=F?D.get(F):null,M=a.providerSpecificData?.connectionProxyEnabled===!0&&!!a.providerSpecificData?.connectionProxyUrl,N=!!F||M,O=L?`Pool: ${L.name}`:F?`Pool: ${F} (inactive/missing)`:M?`Legacy: ${a.providerSpecificData?.connectionProxyUrl}`:"",P="";if(L?.proxyUrl||a.providerSpecificData?.connectionProxyUrl){let b=L?.proxyUrl||a.providerSpecificData?.connectionProxyUrl;try{let a=new URL(b);P=`${a.protocol}//${a.hostname}${a.port?`:${a.port}`:""}`}catch{P=b}}let Q=L?.noProxy||a.providerSpecificData?.connectionNoProxy||"",R="default";L?.isActive===!0?R="success":(F||M)&&(R="error");let S=async a=>{B(!0);try{await l("__none__"===a?null:a)}finally{B(!1),w(!1)}},T=a.authType||(c?"oauth":"apikey"),U="oauth"===T,V="cookie"===T,W=a=>"string"==typeof a&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a),X=U?W(a.email)?a.email:W(a.name)?a.name:a.name||a.email||a.displayName||"OAuth Account":a.name||a.email||a.displayName||"API Key",Y=(0,H.c)(a),Z=null!==Y,$="unavailable"!==a.testStatus||Z?a.testStatus:"active",_=(0,t.d4)(a),aa=!!a.quarantinedAt,ab={policy_suspended:"Policy suspension",account_validation_required:"Account verification required",credential_rejected:"Credential rejected",reauth_required:"Sign-in required",authentication:"Repeated authentication failure"}[a.failureClass]||a.quarantineReason||"Account quarantined",ac=Number.isFinite(Date.parse(a.quarantinedAt))?new Date(a.quarantinedAt).toLocaleString():a.quarantinedAt||null,ad=a.modelLockReason?.resetsAt,ae=Number.isFinite(Date.parse(ad))?new Date(ad).toLocaleString():ad||null,af=()=>u?"queued"===u.state?"queued":"testing"===u.state?"testing":"success"===u.state?u.error?`connected: ${u.error}`:"success":"failed"===u.state?u.error?`failed: ${u.error}`:"failed":null:null;return(0,d.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===a.isActive&&!aa?"opacity-60":""}`,children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2 sm:items-center sm:gap-3",children:[(0,d.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,d.jsx)("button",{onClick:h,disabled:f,className:`p-0.5 rounded ${f?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,d.jsx)("button",{onClick:i,disabled:g,className:`p-0.5 rounded ${g?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,d.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base text-text-muted",children:V?"cookie":U?"lock":"key"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium truncate",children:X}),(0,d.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 sm:gap-2",children:[(0,d.jsx)(j.Ex,{variant:(()=>{if(!1===a.isActive)return"default";let b=(0,t.BU)(_);return"active"!==_.key?b:"active"===$||"success"===$?"success":"error"===$||"expired"===$||"unavailable"===$?"error":"default"})(),size:"sm",dot:!0,children:_.label||$||"unknown"}),(0,d.jsx)(j.Ex,{variant:"default",size:"sm",children:U?"OAuth":V?"Cookie":"API Key"}),aa&&(0,d.jsx)(j.Ex,{variant:"error",size:"sm",children:"Quarantined"}),N&&(0,d.jsx)(j.Ex,{variant:R,size:"sm",children:"Proxy"}),a.autoDisabledAt&&!aa&&(0,d.jsxs)("span",{className:"text-[10px] text-text-muted",children:["token_expired"===a.autoDisabledReason?"Token expired":"banned"===a.autoDisabledReason?"Banned":"quota_exhausted"===a.autoDisabledReason?"Quota exhausted":"Auto-disabled"," — ",new Date(a.autoDisabledAt).toLocaleDateString()]}),aa&&(0,d.jsxs)("span",{className:"max-w-full truncate text-xs text-red-600 dark:text-red-400 sm:max-w-[420px]",title:`${a.quarantineReason||ab}${ac?` - ${ac}`:""}`,children:[ab,ac?` - ${ac}`:""]}),Z&&!1!==a.isActive&&(0,d.jsx)(I,{until:Y}),Z&&a.modelLockReason&&!1!==a.isActive&&(0,d.jsxs)("span",{className:"max-w-full truncate text-xs text-amber-600 dark:text-amber-400 sm:max-w-[360px]",title:`${a.modelLockReason.reason}${ae?` — resets ${ae}`:""}`,children:[a.modelLockReason.model,a.modelLockReason.providerErrorCode?` (${a.modelLockReason.providerErrorCode})`:"",ae?` — resets ${ae}`:""]}),a.lastError&&!1!==a.isActive&&(0,d.jsx)("span",{className:"max-w-full truncate text-xs text-red-500 sm:max-w-[300px]",title:a.lastError,children:a.lastError}),(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:["#",a.priority]}),a.globalPriority&&(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",a.globalPriority]}),af()&&(0,d.jsx)(j.Ex,{variant:u?"success"===u.state?"success":"failed"===u.state?"error":"testing"===u.state?"primary":"default":"default",size:"sm",children:af()})]}),N&&(0,d.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,d.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:O,children:O}),P&&(0,d.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}),Q&&(0,d.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:Q,children:["no_proxy: ",Q]})]}),aa&&!1===a.isActive&&(0,d.jsx)("p",{className:"mt-1 text-[11px] leading-relaxed text-text-muted",children:"Re-enable only permits router requests again; it does not change the account's upstream status."})]})]}),(0,d.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,d.jsxs)("div",{className:"grid flex-1 grid-cols-3 gap-1 sm:flex sm:flex-none",children:[E.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsxs)("button",{ref:z,type:"button",onClick:()=>{if(v)return void w(!1);let a=z.current?.getBoundingClientRect();a&&y((0,J.x)(a,E.length,{width:window.innerWidth,height:window.innerHeight})),w(!0)},className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${N?"text-primary":"text-text-muted hover:text-primary"}`,disabled:A,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:A?"progress_activity":"lan"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),v&&"u">typeof document&&(0,G.createPortal)((0,d.jsxs)("div",{ref:C,style:x,className:"z-50 max-w-[78vw] min-w-[160px] overflow-y-auto rounded-lg border border-border bg-bg py-1 shadow-lg",children:[(0,d.jsx)("button",{onClick:()=>S("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!F?"text-primary font-medium":"text-text-main"}`,children:"None"}),E.map(a=>(0,d.jsx)("button",{onClick:()=>S(a.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${F===a.id?"text-primary font-medium":"text-text-main"}`,children:a.name},a.id))]}),document.body)]}),s&&(0,d.jsxs)("button",{type:"button",onClick:()=>s(a.providerSpecificData?.paidSubscription!==!0),"aria-pressed":a.providerSpecificData?.paidSubscription===!0,className:`flex flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${a.providerSpecificData?.paidSubscription===!0?"text-primary":"text-text-muted hover:text-primary"}`,title:"Paid subscription: may serve Argon and Claude 5.5 when Google's quota data doesn't say",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"workspace_premium"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Paid"})]}),p&&(0,d.jsxs)("button",{onClick:()=>p(!o),className:`flex flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${o?"text-primary":"text-text-muted hover:text-primary"}`,title:o?"Disable quota auto-ping for this account":"Warm the 5-hour quota window after reset with a tiny request",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Auto-ping"})]}),r&&(0,d.jsxs)("button",{type:"button",onClick:r,className:`flex flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${q?"text-primary":"text-text-muted hover:text-primary"}`,title:"Ping at fixed local times",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"schedule"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Schedule"})]}),(0,d.jsxs)("button",{onClick:m,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,d.jsxs)("button",{onClick:n,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 hover:bg-red-500/10",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,d.jsx)(j.lM,{size:"sm",checked:a.isActive??!0,onChange:k,title:a.isActive??!0?"Disable connection":aa?"Re-enable routing only; upstream suspension or credential status is unchanged":"Enable connection"})]})]})}K.propTypes={connection:B().shape({id:B().string,name:B().string,email:B().string,displayName:B().string,modelLockUntil:B().string,testStatus:B().string,isActive:B().bool,lastError:B().string,failureClass:B().string,quarantinedAt:B().string,quarantineReason:B().string,priority:B().number,globalPriority:B().number}).isRequired,proxyPools:B().arrayOf(B().shape({id:B().string,name:B().string,proxyUrl:B().string,noProxy:B().string,isActive:B().bool})),isOAuth:B().bool.isRequired,isFirst:B().bool.isRequired,isLast:B().bool.isRequired,onMoveUp:B().func.isRequired,onMoveDown:B().func.isRequired,onToggleActive:B().func.isRequired,onUpdateProxy:B().func,autoPingEnabled:B().bool,onToggleAutoPing:B().func,autoPingScheduled:B().bool,onOpenAutoPingSchedule:B().func,onTogglePaid:B().func,onEdit:B().func.isRequired,onDelete:B().func.isRequired,oneByOneStatus:B().shape({state:B().string,error:B().string})};var L=c(49023);function M(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}let N={anchor:"09:30",timezone:M(),windowHours:5,slotsPerDay:3};function O(a){let b=/^(\d{1,2}):(\d{2})$/.exec(String(a||"").trim());if(!b)return null;let c=Number(b[1]),d=Number(b[2]);return c>23||d>59?null:{hour:c,minute:d}}function P(a){return Math.max(1,Math.floor(24/a))}function Q(a,b,c,d){let e="number"==typeof a?a:Number(a);return Number.isFinite(e)?Math.min(d,Math.max(c,e)):b}let R=[{value:"off",label:"Off",icon:"block"},{value:"reset",label:"On reset",icon:"bolt"},{value:"schedule",label:"Schedule",icon:"schedule"}];function S({isOpen:a,onClose:b,onSave:c,connection:f,reactive:g=!1,schedule:h=null}){let[i,k]=(0,e.useState)(()=>({mode:h?.enabled===!0?"schedule":!0===g?"reset":"off",anchor:h?.anchor||N.anchor,timezone:M(),windowHours:String(h?.windowHours??N.windowHours),slotsPerDay:String(h?.slotsPerDay??N.slotsPerDay)})),l=Number(i.windowHours),m=Number(i.slotsPerDay),n=!!O(i.anchor),o=Number.isFinite(l)&&l>=.5&&l<=24,p=o?P(l):24,q=Number.isInteger(m)&&m>=1&&m<=p,r="schedule"!==i.mode||n&&o&&q,s=n&&o&&q?function(a){let b=function(a){if(!a||!0!==a.enabled)return null;let b=O(a.anchor)||O(N.anchor),c=`${String(b.hour).padStart(2,"0")}:${String(b.minute).padStart(2,"0")}`,d=!function(a){if(!a||"string"!=typeof a)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:a}),!0}catch{return!1}}(a.timezone)?N.timezone:a.timezone,e=Q(a.windowHours,N.windowHours,.5,24),f=Math.round(Q(a.slotsPerDay,N.slotsPerDay,1,P(e)));return{enabled:!0,anchor:c,timezone:d,windowHours:e,slotsPerDay:f}}(a);if(!b)return[];let{hour:c,minute:d}=O(b.anchor),e=60*c+d;return Array.from({length:b.slotsPerDay},(a,c)=>{let d=Math.round(e+c*b.windowHours*60)%1440;return`${String(Math.floor(d/60)).padStart(2,"0")}:${String(d%60).padStart(2,"0")}`})}({enabled:!0,...i,windowHours:l,slotsPerDay:m}):[],t=s.length?(()=>{let{hour:a,minute:b}=O(i.anchor),c=Math.round(60*a+b+m*l*60)%1440;return`${String(Math.floor(c/60)).padStart(2,"0")}:${String(c%60).padStart(2,"0")}`})():"";return(0,d.jsx)(j.aF,{isOpen:a,onClose:b,title:"Auto-ping settings",footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.$n,{variant:"secondary",onClick:b,children:"Cancel"}),(0,d.jsx)(j.$n,{onClick:()=>{r&&(c({reactive:"reset"===i.mode,schedule:"schedule"===i.mode?{enabled:!0,anchor:i.anchor,timezone:i.timezone,windowHours:l,slotsPerDay:m}:{enabled:!1}}),b())},disabled:!r,children:"Save"})]}),children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Warm the 5-hour window",f?.name?` for ${f.name}`:"",". Pick one mode."]}),(0,d.jsx)("div",{className:"grid grid-cols-3 gap-1 rounded-lg bg-black/[0.03] p-1 dark:bg-white/[0.03]",children:R.map(a=>(0,d.jsxs)("button",{type:"button",onClick:()=>k(b=>({...b,mode:a.value})),className:(0,L.cn)("flex h-9 items-center justify-center gap-1.5 rounded-md text-sm font-medium",i.mode===a.value?"bg-surface text-text-main":"text-text-muted"),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[15px]",children:a.icon}),a.label]},a.value))}),"reset"===i.mode&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Pings once after the window resets."}),"schedule"===i.mode&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[(0,d.jsx)(j.pd,{label:"Anchor time",type:"time",value:i.anchor,onChange:a=>k(b=>({...b,anchor:a.target.value})),error:n?"":"Use HH:MM"}),(0,d.jsx)(j.pd,{label:"Window (hours)",type:"number",min:"0.5",max:"24",step:"0.5",value:i.windowHours,onChange:a=>k(b=>({...b,windowHours:a.target.value})),error:o?"":"0.5 – 24"}),(0,d.jsx)(j.pd,{label:"Pings per day",type:"number",min:"1",max:String(p),step:"1",value:i.slotsPerDay,onChange:a=>k(b=>({...b,slotsPerDay:a.target.value})),error:q?"":`1 – ${p}`})]}),s.length>0&&(0,d.jsxs)("p",{className:"text-sm text-text-main",children:[s.join(" → ")," (",i.timezone,"). Covers until ",t,"."]})]})]})})}S.propTypes={isOpen:B().bool.isRequired,onClose:B().func.isRequired,onSave:B().func.isRequired,connection:B().object,reactive:B().bool,schedule:B().object};var T=c(58962),U=c(41651);let V=`name1|sk-key1
2
2
  name2|sk-key2
3
3
  sk-key-only-auto-named`;function W({isOpen:a,provider:b,providerName:c,isCompatible:f,isAnthropic:g,authType:h,authHint:i,website:l,proxyPools:m,existingNames:n=[],error:o,onSave:p,onBulkDone:q,onClose:r}){let s="__none__",t="ollama-local"===b,u="flow"===b,v="cookie"===h,w="xai"===b&&!v,x="aws-polly"===b,y="qoder"===b||"qoder-cn"===b,z="bedrock"===b||"bedrock-xai"===b,A="aistudio"===b,B=x||z?"Secret Access Key":u?"Daemon token":A?"Storage state JSON":v?"Cookie Value":y?"Personal Access Token (PAT)":"API Key",C=A?'{"cookies":[...],"origins":[...]}':v?"grok-web"===b?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":w?"xai-...":y?"pt-...":"",D="azure"===b,E="cloudflare-ai"===b,F=k.Q2?.[b]?.regions||null,G=k.Q2?.[b]?.defaultRegion||F?.[0]?.id||"",[H,I]=(0,e.useState)({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:s,ollamaHostUrl:"",flowProfile:"",flowBaseUrl:"http://127.0.0.1:8077/mcp",flowI2vReady:!1}),[J,K]=(0,e.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[L,M]=(0,e.useState)({accountId:""}),[N,O]=(0,e.useState)({accessKeyId:"",region:""}),[P,Q]=(0,e.useState)({accessKeyId:"",region:"",sessionToken:""}),[R,S]=(0,e.useState)(G),[X,Y]=(0,e.useState)(!1),[Z,$]=(0,e.useState)(null),[_,aa]=(0,e.useState)(""),[ab,ac]=(0,e.useState)(null),[ad,ae]=(0,e.useState)(!1),[af,ag]=(0,e.useState)("single"),[ah,ai]=(0,e.useState)(""),[aj,ak]=(0,e.useState)(null);(0,e.useRef)(!1);let al=()=>{if(t&&H.ollamaHostUrl.trim())return{baseUrl:H.ollamaHostUrl.trim()};if(u)return{profile:H.flowProfile.trim(),baseUrl:H.flowBaseUrl.trim()||"http://127.0.0.1:8077/mcp",i2vReady:H.flowI2vReady};if(D)return{azureEndpoint:J.azureEndpoint,apiVersion:J.apiVersion,deployment:J.deployment,organization:J.organization};if(E)return{accountId:L.accountId};if(x){let a={accessKeyId:N.accessKeyId.trim()};return N.region.trim()&&(a.region=N.region.trim()),a}if(z){let a={accessKeyId:P.accessKeyId.trim()};return P.region.trim()&&(a.region=P.region.trim()),P.sessionToken.trim()&&(a.sessionToken=P.sessionToken.trim()),a}if(F&&R)return{region:R}},am=async()=>{Y(!0);try{let a=await (0,T.x6)("/api/providers/validate",{method:"POST",body:{provider:b,apiKey:H.apiKey,providerSpecificData:al()}});$(a.valid?"success":"failed"),aa(a.valid?"":(0,U.o)(a.error,H.apiKey)),ac(a.valid&&a.details||null)}catch{aa(""),$("unknown")}finally{Y(!1)}},an=async()=>{if(b&&(t||H.apiKey)&&(!u||H.flowProfile.trim())&&(t||H.name)&&(!f||H.defaultModel.trim())){ae(!0);try{let a=!1,c=null;try{Y(!0),$(null);let d=await (0,T.x6)("/api/providers/validate",{method:"POST",body:{provider:b,apiKey:H.apiKey,providerSpecificData:al()}});a=!!d.valid,$(a?"success":"failed"),aa(a?"":(0,U.o)(d.error,H.apiKey)),c=a&&d.details||null,ac(c)}catch{aa(""),$("unknown")}finally{Y(!1)}let d=Number.parseInt(H.priority,10);await p({name:H.name||(t?"Ollama Local":""),apiKey:H.apiKey,defaultModel:f?H.defaultModel.trim():void 0,priority:Number.isFinite(d)?d:1,proxyPoolId:u||H.proxyPoolId===s?null:H.proxyPoolId,testStatus:a?"active":"unknown",providerSpecificData:A&&c?.catalog?{...al()||{},aistudioCatalog:c.catalog}:al()})}finally{ae(!1)}}},ao=async()=>{let a=function(a,b,c={}){let d=new Set((Array.isArray(b)?b:[]).filter(a=>"string"==typeof a).map(a=>a.toLowerCase())),e=[];for(let b of Array.isArray(a)?a:[]){let a="string"==typeof b?b.trim():"";if(!a)continue;let f=function(a,{isCloudflareAi:b=!1}={}){let c=a.split("|");if(b&&c.length>=3){let a=c[0].trim(),b=c[c.length-1].trim(),d=c.slice(1,-1).join("|").trim();return d&&b?{baseName:a||"Key",apiKey:d,providerSpecificData:{accountId:b}}:null}if(c.length>=2){let a=c[0].trim(),b=c.slice(1).join("|").trim();return b?{baseName:a||"Key",apiKey:b}:null}let d=c[0].trim();return d?{baseName:"Key",apiKey:d}:null}(a,c);if(!f)continue;let g=1,h=`${f.baseName} ${g}`;for(;d.has(h.toLowerCase());)g+=1,h=`${f.baseName} ${g}`;d.add(h.toLowerCase()),e.push({name:h,apiKey:f.apiKey,...f.providerSpecificData?{providerSpecificData:f.providerSpecificData}:{}})}return e}(ah.split("\n").map(a=>a.trim()).filter(Boolean),n,{isCloudflareAi:E});if(!a.length)return;ae(!0),ak(null);let c=0,d=0,e=[],f=[];for(let g of a)try{await (0,T.x6)("/api/providers",{method:"POST",body:{provider:b,apiKey:g.apiKey,name:g.name,priority:1,testStatus:"unknown",...g.providerSpecificData?{providerSpecificData:g.providerSpecificData}:{}}}),c++}catch(a){d++,e.push({line:g.name,message:a?.message||"Request failed"}),f.push(g.providerSpecificData?`${g.name.replace(/ \d+$/,"")}|${g.apiKey}|${g.providerSpecificData.accountId}`:`${g.name.replace(/ \d+$/,"")}|${g.apiKey}`)}ae(!1),ak({success:c,failed:d,failedRows:e}),ai(f.join("\n")),c>0&&q&&q()};return b?(0,d.jsx)(j.aF,{isOpen:a,title:u?"Add Google Flow Account":`Add ${c||b} ${B}`,onClose:r,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[!u&&(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.$n,{size:"sm",variant:"single"===af?"primary":"ghost",onClick:()=>{ag("single"),ak(null)},children:"Single"}),(0,d.jsx)(j.$n,{size:"sm",variant:"bulk"===af?"primary":"ghost",onClick:()=>{ag("bulk"),ak(null)},children:"Bulk Add"})]}),"bulk"===af&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["One key per line. Format: ",(0,d.jsx)("code",{children:"name|apiKey"})," or just ",(0,d.jsx)("code",{children:"apiKey"}),". A name that is already used gets the next free number, so an earlier key is not replaced.",E?" Cloudflare also accepts name|apiKey|accountId.":""]}),(0,d.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:V,value:ah,onChange:a=>ai(a.target.value)}),aj&&(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsxs)("div",{className:`text-sm font-medium ${aj.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",aj.success," added",aj.failed>0?`, ✗ ${aj.failed} failed`:""]}),aj.failedRows?.length>0&&(0,d.jsx)("ul",{className:"text-xs text-red-500 flex flex-col gap-0.5",children:aj.failedRows.map((a,b)=>(0,d.jsxs)("li",{className:"break-words",children:[(0,d.jsx)("span",{className:"font-mono",children:a.line.length>40?`${a.line.slice(0,40)}…`:a.line}),` — ${a.message}`]},b))})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.$n,{onClick:ao,fullWidth:!0,disabled:ad||!ah.trim(),children:ad?"Adding...":"Add All Keys"}),(0,d.jsx)(j.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"single"===af&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.pd,{label:u?"Account name":"Name",value:H.name,onChange:a=>I({...H,name:a.target.value}),placeholder:u?"Google account email":t?"Ollama Local":"Production Key"}),u&&(0,d.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20 flex flex-col gap-3",children:[(0,d.jsx)(j.pd,{label:"gflow profile",value:H.flowProfile,onChange:a=>I({...H,flowProfile:a.target.value}),placeholder:"from: gflow auth list",hint:"One connection maps to one Google Flow browser profile.",required:!0}),(0,d.jsx)(j.pd,{label:"Daemon URL",value:H.flowBaseUrl,onChange:a=>I({...H,flowBaseUrl:a.target.value}),placeholder:"http://127.0.0.1:8077/mcp"}),(0,d.jsxs)("label",{className:"flex items-start gap-2 text-sm text-text-main",children:[(0,d.jsx)("input",{type:"checkbox",checked:H.flowI2vReady,onChange:a=>I({...H,flowI2vReady:a.target.checked}),className:"mt-1"}),(0,d.jsxs)("span",{children:["I2V upload consent confirmed ",(0,d.jsx)("span",{className:"block text-xs text-text-muted",children:"Enable only after uploading an image you own once on flow.google.com and accepting Google's rights dialog. Required for 20–60s videos."})]})]})]}),t&&(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.pd,{label:"Ollama Host URL",value:H.ollamaHostUrl,onChange:a=>I({...H,ollamaHostUrl:a.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,d.jsx)("div",{className:"pt-6",children:(0,d.jsx)(j.$n,{onClick:am,disabled:X||ad,variant:"secondary",children:X?"Checking...":"Check"})})]}),!t&&(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.pd,{label:B,type:v?"text":"password",value:H.apiKey,onChange:a=>I({...H,apiKey:a.target.value}),placeholder:u?"GFLOW_DAEMON_TOKEN":C,hint:u?"Must match the token used by `gflow serve`.":void 0,className:"flex-1"}),(0,d.jsx)("div",{className:"pt-6",children:(0,d.jsx)(j.$n,{onClick:am,disabled:!H.apiKey||u&&!H.flowProfile.trim()||X||ad,variant:"secondary",children:X?"Checking...":"Check"})})]}),w&&(0,d.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."}),v&&i&&(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:[i,l&&(0,d.jsxs)(d.Fragment,{children:[" ",(0,d.jsxs)("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",l.replace(/^https?:\/\//,"")]})]})]}),F&&(0,d.jsx)(j.l6,{label:"Region",value:R,onChange:a=>S(a.target.value),options:F.map(a=>({value:a.id,label:a.label}))}),f&&(0,d.jsx)(j.pd,{label:"Default Model",value:H.defaultModel,onChange:a=>I({...H,defaultModel:a.target.value}),placeholder:g?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),t&&(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,d.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,d.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),Z&&(0,d.jsx)(j.Ex,{variant:"success"===Z?"success":"failed"===Z?"error":"default",children:"success"===Z?"Valid":"failed"===Z?"Invalid":"Could not validate"}),"success"===Z&&ab?.tier&&(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:[ab.tier," tier \xb7 ",ab.modelCount," models"]}),"success"===Z&&ab?.warning&&(0,d.jsx)("p",{className:"text-xs text-yellow-500 break-words",children:ab.warning}),"failed"===Z&&_&&(0,d.jsx)("p",{className:"text-xs text-red-500 break-words",children:_}),o&&(0,d.jsx)("p",{className:"text-xs text-red-500 break-words",children:o}),f&&(0,d.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."}),z&&(0,d.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,d.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"AWS Bedrock"}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)(j.pd,{label:"Access Key ID",value:P.accessKeyId,onChange:a=>Q({...P,accessKeyId:a.target.value}),placeholder:"AKIA..."}),(0,d.jsx)(j.pd,{label:"Region",value:P.region,onChange:a=>Q({...P,region:a.target.value}),placeholder:"us-east-1"}),(0,d.jsx)(j.pd,{label:"Session Token",value:P.sessionToken,onChange:a=>Q({...P,sessionToken:a.target.value}),placeholder:"Only for temporary keys"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-2",children:"Leave region empty to use us-east-1. A profile name is not accepted."})]}),x&&(0,d.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,d.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"AWS Polly"}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)(j.pd,{label:"Access Key ID",value:N.accessKeyId,onChange:a=>O({...N,accessKeyId:a.target.value}),placeholder:"AKIA..."}),(0,d.jsx)(j.pd,{label:"Region",value:N.region,onChange:a=>O({...N,region:a.target.value}),placeholder:"us-east-1"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-2",children:"Leave region empty to use us-east-1. The voice id is chosen on the TTS page."})]}),E&&(0,d.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,d.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,d.jsx)(j.pd,{label:"Account ID",value:L.accountId,onChange:a=>M({...L,accountId:a.target.value}),placeholder:"abc123def456..."}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Find your Account ID in the right sidebar of ",(0,d.jsx)("a",{href:"https://dash.cloudflare.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"dash.cloudflare.com"})]})]}),D&&(0,d.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,d.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)(j.pd,{label:"Azure Endpoint",value:J.azureEndpoint,onChange:a=>K({...J,azureEndpoint:a.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,d.jsx)(j.pd,{label:"Deployment Name",value:J.deployment,onChange:a=>K({...J,deployment:a.target.value}),placeholder:"gpt-4"}),(0,d.jsx)(j.pd,{label:"API Version",value:J.apiVersion,onChange:a=>K({...J,apiVersion:a.target.value}),placeholder:"2024-10-01-preview"}),(0,d.jsx)(j.pd,{label:"Organization",value:J.organization,onChange:a=>K({...J,organization:a.target.value}),placeholder:"Organization ID"})]})]}),(0,d.jsx)(j.pd,{label:"Priority",type:"number",value:H.priority,onChange:a=>I({...H,priority:a.target.value}),onBlur:a=>{let b=Number.parseInt(a.target.value,10);I(a=>({...a,priority:Number.isFinite(b)?b:1}))}}),!u&&(0,d.jsx)(j.l6,{label:"Proxy Pool",value:H.proxyPoolId,onChange:a=>I({...H,proxyPoolId:a.target.value}),options:[{value:s,label:"None"},...(m||[]).map(a=>({value:a.id,label:a.name}))],placeholder:"None"}),!u&&0===(m||[]).length&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"No active proxy pools available. Create one in Proxy Pools page first."}),!u&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Legacy manual proxy fields are still accepted by API for backward compatibility."}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.$n,{onClick:an,fullWidth:!0,disabled:ad||!t&&(!H.name||!H.apiKey)||u&&!H.flowProfile.trim()||f&&!H.defaultModel.trim()||D&&(!J.azureEndpoint||!J.deployment||!J.organization)||E&&!L.accountId||x&&!N.accessKeyId.trim()||z&&!P.accessKeyId.trim(),children:ad?"Saving...":"Save"}),(0,d.jsx)(j.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function X({isOpen:a,node:b,onSave:c,onClose:f,isAnthropic:g}){let[h,i]=(0,e.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(null),u=async()=>{if(h.name.trim()&&h.prefix.trim()&&h.baseUrl.trim()){l(!0);try{let a={name:h.name,prefix:h.prefix,baseUrl:h.baseUrl};g||(a.apiType=h.apiType),await c(a)}finally{l(!1)}}},v=async()=>{r(!0);try{let a=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:h.baseUrl,apiKey:m,type:g?"anthropic-compatible":"openai-compatible",modelId:o.trim()||void 0})}),b=await a.json();t(b.valid?"success":"failed")}catch{t("failed")}finally{r(!1)}};return b?(0,d.jsx)(j.aF,{isOpen:a,title:`Edit ${g?"Anthropic":"OpenAI"} Compatible`,onClose:f,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(j.pd,{label:"Name",value:h.name,onChange:a=>i({...h,name:a.target.value}),placeholder:`${g?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,d.jsx)(j.pd,{label:"Prefix",value:h.prefix,onChange:a=>i({...h,prefix:a.target.value}),placeholder:g?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!g&&(0,d.jsx)(j.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:h.apiType,onChange:a=>i({...h,apiType:a.target.value})}),(0,d.jsx)(j.pd,{label:"Base URL",value:h.baseUrl,onChange:a=>i({...h,baseUrl:a.target.value}),placeholder:g?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${g?"Anthropic":"OpenAI"}-compatible API.`}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.pd,{label:"API Key (for Check)",type:"password",value:m,onChange:a=>n(a.target.value),className:"flex-1"}),(0,d.jsx)("div",{className:"pt-6",children:(0,d.jsx)(j.$n,{onClick:v,disabled:!m||q||!h.baseUrl.trim(),variant:"secondary",children:q?"Checking...":"Check"})})]}),(0,d.jsx)(j.pd,{label:"Model ID (optional)",value:o,onChange:a=>p(a.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),s&&(0,d.jsx)(j.Ex,{variant:"success"===s?"success":"error",children:"success"===s?"Valid":"Invalid"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.$n,{onClick:u,fullWidth:!0,disabled:!h.name.trim()||!h.prefix.trim()||!h.baseUrl.trim()||k,children:k?"Saving...":"Save"}),(0,d.jsx)(j.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function Y({isOpen:a,providerAlias:b,providerDisplayAlias:c,onSave:f,onClose:g}){let[h,i]=(0,e.useState)(""),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(!1),q=a=>{let c=`${b}/`;return a.startsWith(c)?a.slice(c.length):a},r=async()=>{let a=q(h.trim());if(a){l("testing"),n("");try{let c=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${b}/${a}`})}),d=await c.json();l(d.ok?"ok":"error"),n(d.error||"")}catch(a){l("error"),n(a.message)}}},s=async()=>{let a=q(h.trim());if(a&&!o){p(!0);try{await f(a)}finally{p(!1)}}};return(0,d.jsx)(j.aF,{isOpen:a,onClose:g,title:"Add Custom Model",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("input",{type:"text",value:h,onChange:a=>{i(a.target.value),l(null),n("")},onKeyDown:a=>{"Enter"===a.key&&r()},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,d.jsx)(j.$n,{variant:"secondary",icon:"science",loading:"testing"===k,onClick:r,disabled:!h.trim()||"testing"===k,children:"testing"===k?"Testing...":"Test"})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,d.jsx)("code",{className:"font-mono bg-sidebar px-1 rounded",children:q(h.trim())||"model-id"})]})]}),"ok"===k&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-base",children:"check_circle"}),"Model is reachable"]}),"error"===k&&(0,d.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",children:"cancel"}),(0,d.jsx)("span",{children:m||"Model not reachable"})]}),(0,d.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,d.jsx)(j.$n,{onClick:g,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,d.jsx)(j.$n,{onClick:s,fullWidth:!0,size:"sm",disabled:!h.trim()||o,children:o?"Adding...":"Add Model"})]})]})})}W.propTypes={isOpen:B().bool.isRequired,provider:B().string,providerName:B().string,isCompatible:B().bool,isAnthropic:B().bool,authType:B().string,authHint:B().string,website:B().string,proxyPools:B().arrayOf(B().shape({id:B().string,name:B().string})),error:B().string,onSave:B().func.isRequired,onBulkDone:B().func,existingNames:B().arrayOf(B().string),onClose:B().func.isRequired},X.propTypes={isOpen:B().bool.isRequired,node:B().shape({id:B().string,name:B().string,prefix:B().string,apiType:B().string,baseUrl:B().string}),onSave:B().func.isRequired,onClose:B().func.isRequired,isAnthropic:B().bool},Y.propTypes={isOpen:B().bool.isRequired,providerAlias:B().string.isRequired,providerDisplayAlias:B().string.isRequired,onSave:B().func.isRequired,onClose:B().func.isRequired};let Z="/api/providers/codebuddy/discover-models",$={verified:"Verified",recognized:"Recognized",unavailable:"Unavailable",credential_rejected:"Credential rejected",error:"Inconclusive",skipped:"Skipped"},_={verified:"border-green-500/30 bg-green-500/[0.08] text-green-700 dark:text-green-300",recognized:"border-sky-500/30 bg-sky-500/[0.08] text-sky-700 dark:text-sky-300",unavailable:"border-black/10 bg-black/[0.03] text-text-muted dark:border-white/10 dark:bg-white/[0.04]",credential_rejected:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",error:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300",skipped:"border-black/10 bg-black/[0.03] text-text-muted dark:border-white/10 dark:bg-white/[0.04]"};function aa(a,b){return a?.error||b}function ab({isOpen:a,connections:b,onModelsAdded:c,onClose:f}){let g=(0,e.useMemo)(()=>b.filter(a=>"codebuddy"===a.provider&&!1!==a.isActive),[b]),[h,i]=(0,e.useState)(null),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(()=>new Set),[s,t]=(0,e.useState)(""),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)([]),[A,B]=(0,e.useState)(()=>new Set),C=(0,e.useCallback)(async()=>{l(!0),n(""),p(""),v(!1),z([]);try{let a=await fetch(Z,{cache:"no-store"}),b=await a.json();if(!a.ok)throw Error(aa(b,"Could not refresh model candidates"));i(b),r(new Set((b.hidden||[]).map(a=>a.id)))}catch(a){n(a.message)}finally{l(!1)}},[]),D=async()=>{if(s&&0!==q.size&&!w){x(!0),n(""),p("");try{let a=await fetch(Z,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:s,models:[...q]})}),b=await a.json();if(!a.ok)throw Error(aa(b,"Hidden model scan failed"));z(b.results||[]),v(!1)}catch(a){n(a.message)}finally{x(!1)}}},E=(0,e.useMemo)(()=>new Map(y.map(a=>[a.id,a])),[y]),F=(0,e.useMemo)(()=>(h?.hidden||[]).filter(a=>{let b=E.get(a.id)?.status;return a.previouslyVerified||"verified"===b||"recognized"===b}),[h,E]),G=async a=>{let b=a.filter(a=>!A.has(a.id));if(!b.length)return;B(a=>new Set([...a,...b.map(a=>a.id)])),n(""),p("");let d=[];try{for(let a of b){let b=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:"cb",id:a.id,type:"llm",name:a.name})}),c=await b.json();if(!b.ok)throw Error(aa(c,`Could not add ${a.id}`));d.push(a)}window.dispatchEvent(new Event("customModelChanged")),await c?.(d),p(`${d.length} model${1===d.length?"":"s"} added to CodeBuddy Global.`)}catch(a){d.length&&(window.dispatchEvent(new Event("customModelChanged")),await c?.(d)),n(a.message)}finally{B(a=>{let c=new Set(a);return b.forEach(a=>c.delete(a.id)),c})}},H=F.filter(a=>q.has(a.id));return(0,d.jsx)(j.aF,{isOpen:a,onClose:f,title:"Discover CodeBuddy Global Models",size:"full",children:(0,d.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,d.jsx)("div",{className:"live-probe-panel p-4",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Live package candidates"}),(0,d.jsx)("p",{className:"mt-1 text-xs leading-relaxed text-text-muted",children:"Refreshing reads Tencent's current CLI manifests and does not call a model or use credits."}),h?.version&&(0,d.jsxs)("p",{className:"mt-2 font-mono text-xs text-primary",children:["codebuddy-code@",h.version]})]}),(0,d.jsx)(j.$n,{variant:"secondary",size:"sm",icon:"refresh",loading:k,onClick:C,children:"Refresh Candidates"})]})}),m&&(0,d.jsx)("p",{role:"alert",className:"rounded-lg border border-red-500/25 bg-red-500/[0.08] px-3 py-2 text-sm text-red-600 dark:text-red-300",children:m}),o&&(0,d.jsx)("p",{className:"rounded-lg border border-green-500/25 bg-green-500/[0.08] px-3 py-2 text-sm text-green-700 dark:text-green-300",children:o}),h?.warnings?.map(a=>(0,d.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-300",children:a},a)),h&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:[(0,d.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,d.jsx)("p",{className:"text-2xl font-semibold text-text-main",children:h.official?.length||0}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Official Global"})]}),(0,d.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,d.jsx)("p",{className:"text-2xl font-semibold text-text-main",children:h.hidden?.length||0}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Hidden candidates"})]}),(0,d.jsxs)("div",{className:"col-span-2 rounded-lg border border-border bg-surface-2 px-3 py-2 sm:col-span-1",children:[(0,d.jsx)("p",{className:"text-2xl font-semibold text-text-main",children:h.hidden?.filter(a=>a.previouslyVerified).length||0}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Previously verified"})]})]}),(0,d.jsxs)("section",{children:[(0,d.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:"Hidden route candidates"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"From alternate official manifests; availability is not guaranteed on Global SaaS."})]}),(0,d.jsx)("button",{type:"button",className:"text-xs font-medium text-primary hover:underline",onClick:()=>r(q.size===(h.hidden?.length||0)?new Set:new Set(h.hidden.map(a=>a.id))),children:q.size===(h.hidden?.length||0)?"Clear":"Select all"})]}),(0,d.jsx)("div",{className:"max-h-64 overflow-y-auto rounded-xl border border-border custom-scrollbar",children:(h.hidden||[]).map(a=>{let b=E.get(a.id);return(0,d.jsxs)("label",{className:"flex cursor-pointer items-start gap-3 border-b border-border-subtle px-3 py-2.5 last:border-b-0 hover:bg-surface-2",children:[(0,d.jsx)("input",{type:"checkbox",checked:q.has(a.id),onChange:()=>{var b;return b=a.id,void r(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:"mt-1 accent-primary"}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:"block truncate text-sm font-medium text-text-main",children:a.name}),(0,d.jsx)("span",{className:"block truncate font-mono text-[11px] text-text-muted",children:a.id}),(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:a.sources.length?a.sources.join(" + "):"request history"})]}),(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[a.previouslyVerified&&(0,d.jsx)("span",{className:"rounded-full bg-green-500/10 px-2 py-0.5 text-[10px] font-medium text-green-700 dark:text-green-300",children:"previous success"}),b&&(0,d.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10px] font-medium ${_[b.status]||_.error}`,children:$[b.status]||b.status}),(a.previouslyVerified||["verified","recognized"].includes(b?.status))&&(0,d.jsx)("button",{type:"button",onClick:b=>{b.preventDefault(),G([a])},className:"text-xs font-semibold text-primary hover:underline",disabled:A.has(a.id),children:A.has(a.id)?"Adding...":"Add"})]})]},a.id)})})]}),(0,d.jsxs)("section",{className:"live-probe-bar",children:[(0,d.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[1fr_auto] sm:items-end",children:[(0,d.jsx)(j.l6,{label:"CodeBuddy Global connection",value:s,onChange:a=>t(a.target.value),options:g.map(a=>({value:a.id,label:a.name||a.email||a.id})),placeholder:"No active Global connection",disabled:!g.length||w,hint:"Every probe is pinned to this connection."}),(0,d.jsxs)(j.$n,{size:"sm",icon:"radar",onClick:()=>v(!0),disabled:!s||0===q.size||w,children:["Scan Hidden Models (",q.size,")"]})]}),!g.length&&(0,d.jsx)("p",{className:"mt-2 text-xs text-red-500",children:"Add and activate a CodeBuddy Global connection before scanning."}),u&&(0,d.jsxs)("div",{className:"live-probe-confirm",children:[(0,d.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Confirm credit-using scan"}),(0,d.jsx)("p",{className:"mt-1 text-xs leading-relaxed text-text-muted",children:"These are real completion probes and may consume CodeBuddy credits. Scanning uses at most 3 concurrent requests and stops scheduling if the selected credential is rejected."}),(0,d.jsxs)("div",{className:"mt-3 flex justify-end gap-2",children:[(0,d.jsx)(j.$n,{size:"sm",variant:"ghost",onClick:()=>v(!1),disabled:w,children:"Cancel"}),(0,d.jsx)(j.$n,{size:"sm",icon:"science",loading:w,onClick:D,children:"Start Credit Scan"})]})]})]}),y.length>0&&(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:[y.filter(a=>"verified"===a.status).length," verified, ",y.filter(a=>"recognized"===a.status).length," recognized, ",y.filter(a=>"unavailable"===a.status).length," unavailable"]}),(0,d.jsxs)(j.$n,{size:"sm",icon:"playlist_add",onClick:()=>G(H),disabled:!H.length||A.size>0,children:["Add Selected Available (",H.length,")"]})]})]})]})})}ab.propTypes={isOpen:B().bool.isRequired,connections:B().arrayOf(B().object).isRequired,onModelsAdded:B().func,onClose:B().func.isRequired};let ac={"codebuddy-intl":{label:"CodeBuddy",alias:"cbai",title:"Live Probe CodeBuddy Models"},"codebuddy-cn":{label:"CodeBuddy CN",alias:"cb-cn",title:"Live Probe CodeBuddy CN Models"}},ad={verified:"Verified",recognized:"Recognized",unavailable:"Unavailable",credential_rejected:"Credential rejected",error:"Inconclusive",skipped:"Skipped"},ae={verified:"border-green-500/30 bg-green-500/[0.08] text-green-700 dark:text-green-300",recognized:"border-sky-500/30 bg-sky-500/[0.08] text-sky-700 dark:text-sky-300",unavailable:"border-black/10 bg-black/[0.03] text-text-muted dark:border-white/10 dark:bg-white/[0.04]",credential_rejected:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",error:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300",skipped:"border-black/10 bg-black/[0.03] text-text-muted dark:border-white/10 dark:bg-white/[0.04]"};function af({isOpen:a,providerId:b,connections:c,onModelsAdded:f,onClose:g}){let h=ac[b]||ac["codebuddy-intl"],i=(0,e.useMemo)(()=>(c||[]).filter(a=>a.provider===b&&!1!==a.isActive),[c,b]),[k,l]=(0,e.useState)([]),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(""),[s,t]=(0,e.useState)(()=>new Set),[u,v]=(0,e.useState)(""),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)([]),[C,D]=(0,e.useState)(()=>new Set),E=(0,e.useCallback)(async()=>{n(!0),p(""),r(""),x(!1),B([]);try{let a=await fetch(`/api/providers/${b}/discover-models`,{cache:"no-store"}),c=await a.json();if(!a.ok)throw Error(c?.error||"Could not load model candidates");let d=c.candidates||[];l(d),t(new Set(d.map(a=>a.id)))}catch(a){p(a.message)}finally{n(!1)}},[b]),F=async()=>{if(u&&0!==s.size&&!y){z(!0),p(""),r("");try{let a=await fetch(`/api/providers/${b}/discover-models`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:u,models:[...s]})}),c=await a.json();if(!a.ok)throw Error(c?.error||"Live probe failed");B(c.results||[]),x(!1)}catch(a){p(a.message)}finally{z(!1)}}},G=(0,e.useMemo)(()=>new Map(A.map(a=>[a.id,a])),[A]),H=async a=>{let b=a.filter(a=>"catalog"!==a.source&&!C.has(a.id));if(!b.length)return;D(a=>new Set([...a,...b.map(a=>a.id)])),p(""),r("");let c=[];try{for(let a of b){let b=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:h.alias,id:a.id,type:"llm",name:a.name})}),d=await b.json();if(!b.ok)throw Error(d?.error||`Could not add ${a.id}`);c.push(a)}window.dispatchEvent(new Event("customModelChanged")),await f?.(c),r(`${c.length} model${1===c.length?"":"s"} added to ${h.label}.`)}catch(a){c.length&&(window.dispatchEvent(new Event("customModelChanged")),await f?.(c)),p(a.message)}finally{D(a=>{let c=new Set(a);return b.forEach(a=>c.delete(a.id)),c})}};return(0,d.jsx)(j.aF,{isOpen:a,onClose:g,title:h.title,size:"full",children:(0,d.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,d.jsxs)("div",{className:"live-probe-panel p-4",children:[(0,d.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[1fr_auto] sm:items-end",children:[(0,d.jsx)(j.l6,{label:`${h.label} connection`,value:u,onChange:a=>v(a.target.value),options:i.map(a=>({value:a.id,label:a.name||a.email||a.id})),placeholder:`No active ${h.label} connection`,disabled:!i.length||y,hint:"Every probe is pinned to this connection."}),(0,d.jsx)(j.$n,{variant:"secondary",size:"sm",icon:"refresh",loading:m,disabled:y,onClick:E,children:"Refresh Catalog"})]}),(0,d.jsxs)("p",{className:"mt-3 text-xs leading-relaxed text-text-muted",children:["Probes the models this router already knows for ",h.label,". A probe sends one short completion and may use credits."]}),!i.length&&(0,d.jsxs)("p",{className:"mt-2 text-xs text-red-500",children:["Add and activate a ",h.label," connection first."]})]}),o&&(0,d.jsx)("p",{role:"alert",className:"rounded-lg border border-red-500/25 bg-red-500/[0.08] px-3 py-2 text-sm text-red-600 dark:text-red-300",children:o}),q&&(0,d.jsx)("p",{className:"rounded-lg border border-green-500/25 bg-green-500/[0.08] px-3 py-2 text-sm text-green-700 dark:text-green-300",children:q}),(0,d.jsxs)("section",{children:[(0,d.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:"Models"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:[k.length," candidate",1===k.length?"":"s"]})]}),(0,d.jsx)("button",{type:"button",className:"text-xs font-medium text-primary hover:underline",onClick:()=>t(s.size===k.length?new Set:new Set(k.map(a=>a.id))),disabled:!k.length,children:s.size===k.length?"Clear":"Select all"})]}),(0,d.jsxs)("div",{className:"max-h-80 overflow-y-auto rounded-xl border border-border custom-scrollbar",children:[k.map(a=>{let b=G.get(a.id);return(0,d.jsxs)("label",{className:"flex cursor-pointer items-start gap-3 border-b border-border-subtle px-3 py-2.5 last:border-b-0 hover:bg-surface-2",children:[(0,d.jsx)("input",{type:"checkbox",checked:s.has(a.id),onChange:()=>{var b;return b=a.id,void t(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:"mt-1 accent-primary"}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:"block truncate text-sm font-medium text-text-main",children:a.name}),(0,d.jsx)("span",{className:"block truncate font-mono text-[11px] text-text-muted",children:a.id})]}),(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[b&&(0,d.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10px] font-medium ${ae[b.status]||ae.error}`,children:ad[b.status]||b.status}),"catalog"!==a.source&&["verified","recognized"].includes(b?.status)&&(0,d.jsx)("button",{type:"button",onClick:b=>{b.preventDefault(),H([a])},className:"text-xs font-semibold text-primary hover:underline",disabled:C.has(a.id),children:C.has(a.id)?"Adding...":"Add"})]})]},a.id)}),!m&&0===k.length&&(0,d.jsx)("p",{className:"px-3 py-6 text-center text-sm text-text-muted",children:"No model candidates yet."})]})]}),(0,d.jsxs)("section",{className:"live-probe-bar",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted",children:A.length>0?`${A.filter(a=>"verified"===a.status).length} verified, ${A.filter(a=>"unavailable"===a.status).length} unavailable`:"Probe sends one real completion per selected model."}),(0,d.jsxs)(j.$n,{size:"sm",icon:"radar",onClick:()=>x(!0),disabled:!u||0===s.size||y,children:["Live Probe (",s.size,")"]})]}),w&&(0,d.jsxs)("div",{className:"live-probe-confirm",children:[(0,d.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Confirm credit-using probe"}),(0,d.jsxs)("p",{className:"mt-1 text-xs leading-relaxed text-text-muted",children:["These are real completion probes and may consume ",h.label," credits. Probing uses at most 3 concurrent requests and stops scheduling if the selected credential is rejected."]}),(0,d.jsxs)("div",{className:"mt-3 flex justify-end gap-2",children:[(0,d.jsx)(j.$n,{size:"sm",variant:"ghost",onClick:()=>x(!1),disabled:y,children:"Cancel"}),(0,d.jsx)(j.$n,{size:"sm",icon:"science",loading:y,onClick:F,children:"Start Probe"})]})]})]})]})})}af.propTypes={isOpen:B().bool,providerId:B().string.isRequired,connections:B().arrayOf(B().object),onModelsAdded:B().func,onClose:B().func.isRequired};let ag="/api/providers/opencode/discover-models",ah={verified:"Works",quota_exhausted:"Free quota used up",skipped:"Not tested",overloaded:"Overloaded",unavailable:"Unavailable",deprecated:"Deprecated",unsupported:"Protocol unsupported",error:"Error"},ai={verified:"border-green-500/30 bg-green-500/[0.08] text-green-700 dark:text-green-300",quota_exhausted:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300",skipped:"border-zinc-500/30 bg-zinc-500/[0.08] text-zinc-600 dark:text-zinc-400",overloaded:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300",unavailable:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",deprecated:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",unsupported:"border-purple-500/30 bg-purple-500/[0.08] text-purple-700 dark:text-purple-300",error:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300"},aj=new Set(["unavailable","deprecated","unsupported"]);function ak({isOpen:a,onModelsAdded:b,onClose:c}){let[f,g]=(0,e.useState)([]),[h,i]=(0,e.useState)(!1),[k,l]=(0,e.useState)(""),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(()=>new Set),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)([]),[u,v]=(0,e.useState)(()=>new Set),[w,x]=(0,e.useState)(()=>new Set),y=(0,e.useCallback)(async()=>{i(!0),l(""),n(""),t([]);try{let a=await fetch(ag,{cache:"no-store"}),b=await a.json();if(!a.ok)throw Error(b?.error||"Could not fetch OpenCode models");let c=b.candidates||[];g(c),p(new Set(c.filter(a=>!1!==a.inCatalog).map(a=>a.id))),x(new Set(c.filter(a=>a.isConfigured).map(a=>a.id))),!1===b.catalogAvailable&&n("OpenCode's model catalog could not be fetched; showing configured models only.")}catch(a){l(a.message)}finally{i(!1)}},[]),z=async()=>{if(0!==o.size&&!q){r(!0),l(""),n("");try{let a=await fetch(ag,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({models:[...o]})}),b=await a.json();if(!a.ok)throw Error(b?.error||"Live probe failed");let c=b.results||[];t(c);let d=c.find(a=>"quota_exhausted"===a.status);d&&l(`OpenCode's free quota for this IP is used up (${d.id}). The remaining models were not tested; this says nothing about whether they work. Try again later.`)}catch(a){l(a.message)}finally{r(!1)}}},A=(0,e.useMemo)(()=>new Map(s.map(a=>[a.id,a])),[s]),B=async a=>{let c=a.filter(a=>!u.has(a.id)&&!w.has(a.id));if(!c.length)return;v(a=>new Set([...a,...c.map(a=>a.id)])),l(""),n("");let d=[];try{for(let a of c){let b=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:"oc",id:a.id,type:"llm",name:a.name||a.id})}),c=await b.json();if(!b.ok)throw Error(c?.error||`Could not add ${a.id}`);d.push(a)}window.dispatchEvent(new Event("customModelChanged")),x(a=>new Set([...a,...d.map(a=>a.id)])),await b?.(d),n(`${d.length} model${1===d.length?"":"s"} added to OpenCode Free!`)}catch(a){d.length&&(window.dispatchEvent(new Event("customModelChanged")),x(a=>new Set([...a,...d.map(a=>a.id)])),await b?.(d)),l(a.message)}finally{v(a=>{let b=new Set(a);return c.forEach(a=>b.delete(a.id)),b})}},C=(0,e.useMemo)(()=>f.filter(a=>{let b=A.get(a.id);return b?.ok&&!w.has(a.id)}),[f,A,w]);return(0,d.jsx)(j.aF,{isOpen:a,onClose:c,title:"Live Probe OpenCode Free Models",size:"full",children:(0,d.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,d.jsx)("div",{className:"live-probe-panel p-4",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Upstream Catalog Live Probe"}),(0,d.jsxs)("p",{className:"mt-1 text-xs leading-relaxed text-text-muted",children:["Pulls candidates directly from ",(0,d.jsx)("span",{className:"font-mono",children:"opencode.ai/zen/v1/models"})," and tests real-time completions to verify which free models are alive."]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(j.$n,{variant:"secondary",size:"sm",icon:"refresh",loading:h,onClick:y,children:"Refresh Catalog"}),(0,d.jsx)(j.$n,{size:"sm",icon:"radar",loading:q,disabled:0===o.size||q,onClick:z,children:q?"Probing Upstream...":`Live Probe (${o.size})`})]})]})}),k&&(0,d.jsx)("p",{role:"alert",className:"rounded-lg border border-red-500/25 bg-red-500/[0.08] px-3 py-2 text-sm text-red-600 dark:text-red-300",children:k}),m&&(0,d.jsx)("p",{className:"rounded-lg border border-green-500/25 bg-green-500/[0.08] px-3 py-2 text-sm text-green-700 dark:text-green-300",children:m}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:["Total Candidates: ",(0,d.jsx)("strong",{className:"text-text-main",children:f.length})]}),s.length>0&&(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:["• Works: ",(0,d.jsx)("strong",{className:"text-green-600",children:s.filter(a=>a.ok).length})," ","• Dead: ",(0,d.jsx)("strong",{className:"text-red-600",children:s.filter(a=>aj.has(a.status)).length})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[C.length>0&&(0,d.jsxs)("button",{type:"button",onClick:()=>B(C),disabled:u.size>0,className:"text-xs font-semibold text-primary hover:underline",children:["+ Add All Verified (",C.length,")"]}),(0,d.jsx)("button",{type:"button",className:"text-xs font-medium text-primary hover:underline",onClick:()=>p(o.size===f.length?new Set:new Set(f.map(a=>a.id))),children:o.size===f.length?"Deselect All":"Select All"})]})]}),(0,d.jsx)("div",{className:"max-h-96 overflow-y-auto rounded-xl border border-border custom-scrollbar",children:f.map(a=>{let b=A.get(a.id),c=w.has(a.id),e=u.has(a.id);return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3 border-b border-border-subtle px-3 py-2.5 last:border-b-0 hover:bg-surface-2",children:[(0,d.jsxs)("label",{className:"flex min-w-0 flex-1 cursor-pointer items-center gap-3",children:[(0,d.jsx)("input",{type:"checkbox",checked:o.has(a.id),onChange:()=>{var b;return b=a.id,void p(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:"accent-primary"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-text-main truncate",children:a.name}),c&&(0,d.jsx)("span",{className:"rounded-full bg-blue-500/10 px-2 py-0.5 text-[10px] font-medium text-blue-600 dark:text-blue-400",children:"Active in Router"}),!1===a.inCatalog&&(0,d.jsx)("span",{className:"rounded-full bg-red-500/10 px-2 py-0.5 text-[10px] font-medium text-red-600 dark:text-red-400",title:"Not listed in opencode.ai/zen/v1/models anymore",children:"Retired upstream"})]}),(0,d.jsxs)("span",{className:"block font-mono text-[11px] text-text-muted truncate",children:["oc/",a.id]})]})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-3",children:[b?(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`rounded-full border px-2.5 py-0.5 text-[11px] font-medium ${ai[b.status]||ai.error}`,title:b.error||b.message,children:ah[b.status]||b.status}),b.latencyMs>0&&(0,d.jsxs)("span",{className:"text-[11px] text-text-muted font-mono",children:[b.latencyMs,"ms"]})]}):(0,d.jsx)("span",{className:"text-[11px] text-text-muted italic",children:"Ready to probe"}),!c&&!1!==a.inCatalog&&!aj.has(b?.status)&&(0,d.jsx)("button",{type:"button",onClick:()=>B([a]),disabled:e,className:"text-xs font-semibold text-primary hover:underline disabled:opacity-50",children:e?"Adding...":"+ Add"})]})]},a.id)})}),(0,d.jsx)("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:(0,d.jsx)(j.$n,{variant:"secondary",size:"sm",onClick:c,children:"Close"})})]})})}ak.propTypes={isOpen:B().bool.isRequired,onModelsAdded:B().func,onClose:B().func.isRequired};var al=c(51621);let am="/api/providers/kiro/discover-models",an={verified:"Verified",recognized:"Recognized (quota)",unavailable:"Unavailable",credential_rejected:"Credential rejected",error:"Inconclusive",skipped:"Skipped"},ao={verified:"border-green-500/30 bg-green-500/[0.08] text-green-700 dark:text-green-300",recognized:"border-sky-500/30 bg-sky-500/[0.08] text-sky-700 dark:text-sky-300",unavailable:"border-black/10 bg-black/[0.03] text-text-muted dark:border-white/10 dark:bg-white/[0.04]",credential_rejected:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",error:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300",skipped:"border-black/10 bg-black/[0.03] text-text-muted dark:border-white/10 dark:bg-white/[0.04]"},ap={live:"live catalog",known:"known Kiro model",saved:"saved on account",alias:"your alias"};function aq(a){return a?a>=1e6?`${a/1e6}M`:`${Math.round(a/1e3)}K`:null}function ar({isOpen:a,connections:b,onClose:c}){let f=(0,e.useMemo)(()=>b.filter(a=>"kiro"===a.provider&&!1!==a.isActive&&!a.quarantinedAt),[b]),[g,h]=(0,e.useState)(""),[i,k]=(0,e.useState)(null),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(""),[p,q]=(0,e.useState)(()=>new Set),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)([]),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(""),B=(0,e.useCallback)(async a=>{if(a){m(!0),o(""),A(""),s(!1),w([]);try{let b=await fetch(`${am}?connectionId=${encodeURIComponent(a)}`,{cache:"no-store"}),c=await b.json();if(!b.ok)throw Error(c?.error||"Could not refresh Kiro candidates");k(c),q(new Set((c.candidates||[]).filter(a=>!a.inLive).map(a=>a.id)))}catch(a){k(null),o(a.message)}finally{m(!1)}}},[]),C=async()=>{if(g&&0!==p.size&&!t){u(!0),o("");try{let a=await fetch(am,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:g,models:[...p]})}),b=await a.json();if(!a.ok)throw Error(b?.error||"Kiro model probe failed");w(b.results||[]),s(!1)}catch(a){o(a.message)}finally{u(!1)}}},D=(0,e.useMemo)(()=>new Map(v.map(a=>[a.id,a])),[v]),E=i?.candidates||[],F=E.filter(a=>a.inLive).length,G=E.length-F,H=v.filter(a=>"verified"===a.status).map(a=>a.id),I=!!i&&!i.hasProfile&&H.length>0,J=async()=>{if(I&&!x){y(!0),o(""),A("");try{let a=await fetch(am,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:g,models:H})}),b=await a.json();if(!a.ok)throw Error(b?.error||"Saving verified models failed");A(`${b.saved.length} verified model${1===b.saved.length?"":"s"} saved to this connection.`)}catch(a){o(a.message)}finally{y(!1)}}};return(0,d.jsx)(j.aF,{isOpen:a,onClose:c,title:"Live Probe Kiro Models",size:"full",children:(0,d.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,d.jsxs)("div",{className:"live-probe-panel p-4",children:[(0,d.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[1fr_auto] sm:items-end",children:[(0,d.jsx)(j.l6,{label:"Kiro connection",value:g,onChange:a=>h(a.target.value),options:f.map(a=>({value:a.id,label:a.name||a.email||a.id})),placeholder:"No active Kiro connection",disabled:!f.length||t,hint:"The catalog and every probe are pinned to this connection."}),(0,d.jsx)(j.$n,{variant:"secondary",size:"sm",icon:"refresh",loading:l,disabled:!g||t,onClick:()=>B(g),children:"Refresh Catalog"})]}),(0,d.jsx)("p",{className:"mt-3 text-xs leading-relaxed text-text-muted",children:"Refreshing calls Kiro's ListAvailableModels for this account and does not use credits."}),!f.length&&(0,d.jsx)("p",{className:"mt-2 text-xs text-red-500",children:"Add and activate a Kiro connection first."})]}),n&&(0,d.jsx)("p",{role:"alert",className:"rounded-lg border border-red-500/25 bg-red-500/[0.08] px-3 py-2 text-sm text-red-600 dark:text-red-300",children:n}),z&&(0,d.jsx)("p",{className:"rounded-lg border border-green-500/25 bg-green-500/[0.08] px-3 py-2 text-sm text-green-700 dark:text-green-300",children:z}),i?.warnings?.map(a=>(0,d.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-300",children:a},a)),i&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:[(0,d.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,d.jsx)("p",{className:"text-2xl font-semibold text-text-main",children:F}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"In live catalog"})]}),(0,d.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,d.jsx)("p",{className:"text-2xl font-semibold text-text-main",children:G}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Saved / alias only"})]}),(0,d.jsxs)("div",{className:"col-span-2 rounded-lg border border-border bg-surface-2 px-3 py-2 sm:col-span-1",children:[(0,d.jsx)("p",{className:`text-sm font-semibold ${i.liveCatalog?"text-green-700 dark:text-green-300":"text-amber-700 dark:text-amber-300"}`,children:i.liveCatalog?"Live catalog readable":"Live catalog unavailable"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:i.hasProfile?"Account has a CodeWhisperer profile":"No profile (API-key login)"})]})]}),(0,d.jsxs)("section",{children:[(0,d.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:"Base models"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"-thinking and -agentic variants share their base model and are not probed separately."})]}),(0,d.jsx)("button",{type:"button",className:"text-xs font-medium text-primary hover:underline",onClick:()=>q(p.size===E.length?new Set:new Set(E.map(a=>a.id))),children:p.size===E.length?"Clear":"Select all"})]}),(0,d.jsx)("div",{className:"max-h-80 overflow-y-auto rounded-xl border border-border custom-scrollbar",children:E.map(a=>{let b=D.get(a.id),c=[aq(a.contextLength),aq(a.maxOutputTokens)].filter(Boolean).join(" / ");return(0,d.jsxs)("label",{className:"flex cursor-pointer items-start gap-3 border-b border-border-subtle px-3 py-2.5 last:border-b-0 hover:bg-surface-2",children:[(0,d.jsx)("input",{type:"checkbox",checked:p.has(a.id),onChange:()=>{var b;return b=a.id,void q(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:"mt-1 accent-primary"}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:"block truncate text-sm font-medium text-text-main",children:a.name}),(0,d.jsxs)("span",{className:"block truncate font-mono text-[11px] text-text-muted",children:["kr/",a.id]}),(0,d.jsxs)("span",{className:"text-[10px] text-text-muted",children:[a.sources.map(a=>ap[a]||a).join(" + "),c&&` \xb7 ${c}`,a.rateMultiplier&&1!==a.rateMultiplier&&` \xb7 ${a.rateMultiplier}x credit`]})]}),(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[a.inLive&&(0,d.jsx)("span",{className:"rounded-full bg-green-500/10 px-2 py-0.5 text-[10px] font-medium text-green-700 dark:text-green-300",children:"live"}),b&&(0,d.jsxs)("span",{title:b.error||"",className:`rounded-full border px-2 py-0.5 text-[10px] font-medium ${ao[b.status]||ao.error}`,children:[an[b.status]||b.status,"verified"===b.status&&Number.isFinite(b.latencyMs)&&` \xb7 ${b.latencyMs}ms`]})]})]},a.id)})})]}),(0,d.jsxs)("section",{className:"live-probe-bar",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted",children:v.length>0?`${v.filter(a=>"verified"===a.status).length} verified, ${v.filter(a=>"unavailable"===a.status).length} unavailable, ${v.filter(a=>!["verified","unavailable"].includes(a.status)).length} other`:"Probe sends one real completion per selected model."}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[I&&(0,d.jsxs)(j.$n,{size:"sm",variant:"secondary",icon:"save",loading:x,onClick:J,children:["Save Verified to Connection (",H.length,")"]}),(0,d.jsxs)(j.$n,{size:"sm",icon:"radar",onClick:()=>s(!0),disabled:!g||0===p.size||t,children:["Probe Selected (",p.size,")"]})]})]}),r&&(0,d.jsxs)("div",{className:"live-probe-confirm",children:[(0,d.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Confirm credit-using probe"}),(0,d.jsx)("p",{className:"mt-1 text-xs leading-relaxed text-text-muted",children:"These are real completion requests and may consume Kiro credits. Probing uses at most 3 concurrent requests and stops scheduling if the selected credential is rejected."}),(0,d.jsxs)("div",{className:"mt-3 flex justify-end gap-2",children:[(0,d.jsx)(j.$n,{size:"sm",variant:"ghost",onClick:()=>s(!1),disabled:t,children:"Cancel"}),(0,d.jsx)(j.$n,{size:"sm",icon:"science",loading:t,onClick:C,children:"Start Probe"})]})]})]})]})]})})}ar.propTypes={isOpen:B().bool.isRequired,connections:B().arrayOf(B().object).isRequired,onClose:B().func.isRequired};let as="/api/providers/cloudflare-ai/discover-models",at={verified:"Works",paid_only:"Paid plan only",no_access:"No access",unavailable:"Unavailable",deprecated:"Deprecated",unsupported:"Not a chat model",agreement_required:"License agreement needed",input_rejected:"Input rejected",quota_exhausted:"Daily quota used up",credential_rejected:"Token rejected",rate_limited:"Rate limited",skipped:"Not tested",error:"Inconclusive"},au={verified:"border-green-500/30 bg-green-500/[0.08] text-green-700 dark:text-green-300",paid_only:"border-sky-500/30 bg-sky-500/[0.08] text-sky-700 dark:text-sky-300",no_access:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",unavailable:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",input_rejected:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300",deprecated:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",unsupported:"border-purple-500/30 bg-purple-500/[0.08] text-purple-700 dark:text-purple-300",agreement_required:"border-sky-500/30 bg-sky-500/[0.08] text-sky-700 dark:text-sky-300",quota_exhausted:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300",credential_rejected:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",rate_limited:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300",skipped:"border-black/10 bg-black/[0.03] text-text-muted dark:border-white/10 dark:bg-white/[0.04]",error:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300"},av=new Set(["unavailable","no_access","deprecated","unsupported"]),aw=[{kind:"llm",title:"Chat models",hint:"Probed with one short chat completion."},{kind:"image",title:"Image models",hint:"Probed with one small generation. Image probes use far more neurons than chat."}];function ax({isOpen:a,connections:b,onModelsAdded:c,onClose:f}){let g=(0,e.useMemo)(()=>b.filter(a=>"cloudflare-ai"===a.provider&&!1!==a.isActive&&!a.quarantinedAt),[b]),[h,i]=(0,e.useState)(""),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(""),[s,t]=(0,e.useState)(()=>new Set),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)([]),[A,B]=(0,e.useState)(()=>new Set),[C,D]=(0,e.useState)(()=>new Set),E=(0,e.useCallback)(async a=>{if(a){n(!0),p(""),r(""),v(!1),z([]);try{let b=await fetch(`${as}?connectionId=${encodeURIComponent(a)}`,{cache:"no-store"}),c=await b.json();if(!b.ok)throw Error(c?.error||"Could not read the Cloudflare model catalog");l(c),t(new Set((c.candidates||[]).filter(a=>!a.paidOnly).map(a=>a.id))),D(new Set((c.candidates||[]).filter(a=>a.builtIn||a.aliased).map(a=>a.id))),c.catalogAvailable||r("Cloudflare's model catalog could not be read; showing built-in and saved models only.")}catch(a){l(null),p(a.message)}finally{n(!1)}}},[]),F=(0,e.useMemo)(()=>k?.candidates||[],[k]),G=(0,e.useMemo)(()=>new Map(y.map(a=>[a.id,a])),[y]),H=F.filter(a=>"image"===a.kind&&s.has(a.id)).length,I=async()=>{if(h&&0!==s.size&&!w){x(!0),p(""),r("");try{let a=F.filter(a=>s.has(a.id)).map(a=>({id:a.id,kind:a.kind})),b=await fetch(as,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:h,models:a})}),c=await b.json();if(!b.ok)throw Error(c?.error||"Cloudflare model probe failed");let d=c.results||[];z(d),v(!1);let e=d.find(a=>"quota_exhausted"===a.status||"credential_rejected"===a.status);e&&p("quota_exhausted"===e.status?`This account's daily Workers AI allocation is used up (${e.id}). The remaining models were not tested; try again after the daily reset or pick another connection.`:`Cloudflare rejected this connection's API token (${e.id}). The remaining models were not tested.`)}catch(a){p(a.message)}finally{x(!1)}}},J=async a=>{let b=a.filter(a=>!C.has(a.id)&&!A.has(a.id));if(b.length){B(a=>new Set([...a,...b.map(a=>a.id)])),p(""),r("");try{await c?.(b),D(a=>new Set([...a,...b.map(a=>a.id)])),r(`${b.length} model${1===b.length?"":"s"} added to the router.`)}catch(a){p(a.message)}finally{B(a=>{let c=new Set(a);return b.forEach(a=>c.delete(a.id)),c})}}},K=F.filter(a=>"llm"===a.kind&&G.get(a.id)?.status==="verified"&&!C.has(a.id)),L={works:y.filter(a=>"verified"===a.status).length,dead:y.filter(a=>av.has(a.status)).length,paid:y.filter(a=>"paid_only"===a.status).length,other:y.filter(a=>!["verified","paid_only"].includes(a.status)&&!av.has(a.status)).length};return(0,d.jsx)(j.aF,{isOpen:a,onClose:f,title:"Live Probe Cloudflare Workers AI Models",size:"full",children:(0,d.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,d.jsxs)("div",{className:"live-probe-panel p-4",children:[(0,d.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[1fr_auto] sm:items-end",children:[(0,d.jsx)(j.l6,{label:"Cloudflare connection",value:h,onChange:a=>i(a.target.value),options:g.map(a=>({value:a.id,label:a.name||a.email||a.id})),placeholder:"No active Cloudflare connection",disabled:!g.length||w,hint:"The catalog and every probe use this account."}),(0,d.jsx)(j.$n,{variant:"secondary",size:"sm",icon:"refresh",loading:m,disabled:!h||w,onClick:()=>E(h),children:"Refresh Catalog"})]}),(0,d.jsx)("p",{className:"mt-3 text-xs leading-relaxed text-text-muted",children:"Refreshing reads this account's Workers AI model catalog and does not use neurons. Only chat and text-to-image models are listed."}),!g.length&&(0,d.jsx)("p",{className:"mt-2 text-xs text-red-500",children:"Add and activate a Cloudflare connection first."})]}),o&&(0,d.jsx)("p",{role:"alert",className:"rounded-lg border border-red-500/25 bg-red-500/[0.08] px-3 py-2 text-sm text-red-600 dark:text-red-300",children:o}),q&&(0,d.jsx)("p",{className:"rounded-lg border border-green-500/25 bg-green-500/[0.08] px-3 py-2 text-sm text-green-700 dark:text-green-300",children:q}),k&&aw.map(a=>{let b=F.filter(b=>b.kind===a.kind);if(!b.length)return null;let c=b.every(a=>s.has(a.id));return(0,d.jsxs)("section",{children:[(0,d.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("h3",{className:"text-sm font-semibold text-text-main",children:[a.title," (",b.length,")"]}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:a.hint})]}),(0,d.jsx)("button",{type:"button",className:"text-xs font-medium text-primary hover:underline",onClick:()=>{var b;let c,d;return b=a.kind,d=(c=F.filter(a=>a.kind===b).map(a=>a.id)).every(a=>s.has(a)),void t(a=>{let b=new Set(a);for(let a of c)d?b.delete(a):b.add(a);return b})},children:c?"Clear":"Select all"})]}),(0,d.jsx)("div",{className:"max-h-80 overflow-y-auto rounded-xl border border-border custom-scrollbar",children:b.map(a=>{var b;let c=G.get(a.id),e=C.has(a.id),f="llm"===a.kind&&!e&&c?.status==="verified",g=[!(b=a.contextLength)?null:b>=1e6?`${Math.round(b/1e5)/10}M ctx`:`${Math.round(b/1e3)}K ctx`,...a.flags].filter(Boolean).join(" \xb7 ");return(0,d.jsxs)("div",{className:"flex items-start gap-3 border-b border-border-subtle px-3 py-2.5 last:border-b-0 hover:bg-surface-2",children:[(0,d.jsxs)("label",{className:"flex min-w-0 flex-1 cursor-pointer items-start gap-3",children:[(0,d.jsx)("input",{type:"checkbox",checked:s.has(a.id),onChange:()=>{var b;return b=a.id,void t(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:"mt-1 accent-primary"}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)("span",{className:"truncate text-sm font-medium text-text-main",children:a.name}),e&&(0,d.jsx)("span",{className:"rounded-full bg-blue-500/10 px-2 py-0.5 text-[10px] font-medium text-blue-600 dark:text-blue-400",children:"In router"}),a.paidOnly&&(0,d.jsx)("span",{className:"rounded-full bg-sky-500/10 px-2 py-0.5 text-[10px] font-medium text-sky-700 dark:text-sky-300",children:"Workers Paid"}),!1===a.inCatalog&&(0,d.jsx)("span",{className:"rounded-full bg-zinc-500/10 px-2 py-0.5 text-[10px] font-medium text-text-muted",title:"Not listed in this account's Workers AI catalog",children:"Not in catalog"})]}),(0,d.jsxs)("span",{className:"block truncate font-mono text-[11px] text-text-muted",children:["cf/",a.id]}),g&&(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:g})]})]}),(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-2 pt-0.5",children:[c&&(0,d.jsxs)("span",{title:c.error||"",className:`rounded-full border px-2 py-0.5 text-[10px] font-medium ${au[c.status]||au.error}`,children:[at[c.status]||c.status,"verified"===c.status&&Number.isFinite(c.latencyMs)&&` \xb7 ${c.latencyMs}ms`]}),f&&(0,d.jsx)("button",{type:"button",onClick:()=>J([a]),disabled:A.has(a.id),className:"text-xs font-semibold text-primary hover:underline disabled:opacity-50",children:A.has(a.id)?"Adding...":"+ Add"})]})]},a.id)})})]},a.kind)}),k&&(0,d.jsxs)("section",{className:"live-probe-bar",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted",children:y.length>0?`${L.works} work, ${L.dead} dead, ${L.paid} need Workers Paid, ${L.other} other`:"Probe sends one real request per selected model."}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[K.length>0&&(0,d.jsxs)(j.$n,{size:"sm",variant:"secondary",icon:"add",loading:A.size>0,onClick:()=>J(K),children:["Add Working Chat Models (",K.length,")"]}),(0,d.jsxs)(j.$n,{size:"sm",icon:"radar",onClick:()=>v(!0),disabled:!h||0===s.size||w,children:["Probe Selected (",s.size,")"]})]})]}),u&&(0,d.jsxs)("div",{className:"live-probe-confirm",children:[(0,d.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Confirm neuron-using probe"}),(0,d.jsxs)("p",{className:"mt-1 text-xs leading-relaxed text-text-muted",children:["These are real Workers AI requests on the selected account and count toward its daily free allocation of 10,000 neurons.",H>0&&` ${H} image model${1===H?"":"s"} selected; each image probe costs much more than a chat probe.`," ","At most 3 run at once, and the scan stops if the allocation runs out or the token is rejected."]}),(0,d.jsxs)("div",{className:"mt-3 flex justify-end gap-2",children:[(0,d.jsx)(j.$n,{size:"sm",variant:"ghost",onClick:()=>v(!1),disabled:w,children:"Cancel"}),(0,d.jsx)(j.$n,{size:"sm",icon:"science",loading:w,onClick:I,children:"Start Probe"})]})]})]})]})})}function ay({showAutomation:a,showAddConnection:b,onOpenAutomation:c,onAddConnection:e,methods:f=null,onSelectMethod:g=null,extra:h=null}){let i=Array.isArray(f)?f.filter(a=>"oauth"===a.id||"apikey"===a.id):[],k=2===i.length&&"function"==typeof g,l=Array.isArray(f)?f.filter(a=>"oauth"!==a.id&&"apikey"!==a.id):[];return a||b||k||h||0!==l.length?(0,d.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:flex-wrap sm:justify-end",children:[a?(0,d.jsx)(j.$n,{size:"sm",icon:"automation",variant:"secondary",onClick:c,className:"w-full sm:w-auto",children:"Open Automation"}):null,k?(0,d.jsxs)(d.Fragment,{children:[i.map(a=>(0,d.jsx)(j.$n,{size:"sm",icon:a.icon||("oauth"===a.id?"lock":"key"),variant:"oauth"===a.id?"secondary":void 0,onClick:()=>g(a.id),disabled:a.disabled,className:"w-full sm:w-auto",children:a.label},a.id)),l.map(a=>(0,d.jsx)(j.$n,{size:"sm",icon:a.icon||"add",variant:"secondary",onClick:()=>g(a.id),disabled:a.disabled,className:"w-full sm:w-auto",children:a.label},a.id))]}):b?(0,d.jsx)(j.$n,{size:"sm",icon:"add",onClick:e,className:"w-full sm:w-auto",children:"Add Connection"}):null,h]}):null}ax.propTypes={isOpen:B().bool.isRequired,connections:B().arrayOf(B().object).isRequired,onModelsAdded:B().func,onClose:B().func.isRequired},ay.propTypes={showAutomation:B().bool.isRequired,showAddConnection:B().bool.isRequired,onOpenAutomation:B().func.isRequired,onAddConnection:B().func.isRequired,methods:B().arrayOf(B().shape({id:B().string.isRequired,label:B().string.isRequired,icon:B().string,disabled:B().bool})),onSelectMethod:B().func,extra:B().node};let az=`[
4
4
  {