zevairouter 1.0.199 → 1.0.201

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 (588) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/cli/app/.next-cli-build/BUILD_ID +1 -1
  3. package/cli/app/.next-cli-build/app-path-routes-manifest.json +3 -3
  4. package/cli/app/.next-cli-build/build-manifest.json +2 -2
  5. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page.js.nft.json +1 -1
  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.js.nft.json +1 -1
  8. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  9. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  10. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  11. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  12. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  13. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  14. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  15. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  16. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  17. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page.js.nft.json +1 -1
  18. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page_client-reference-manifest.js +1 -1
  19. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  20. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  21. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +1 -1
  22. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  23. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  24. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  25. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  26. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  27. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  28. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  29. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  30. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  31. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  32. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  33. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  34. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page.js.nft.json +1 -1
  35. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
  36. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  37. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  38. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
  39. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  40. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  41. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  42. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  43. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  44. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  45. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  46. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  47. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  48. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
  49. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  50. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  51. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  52. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page.js.nft.json +1 -1
  53. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  54. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  55. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  56. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page.js.nft.json +1 -1
  57. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page_client-reference-manifest.js +1 -1
  58. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  59. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  60. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  61. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  62. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  63. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  64. package/cli/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  65. package/cli/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  66. package/cli/app/.next-cli-build/server/app/_global-error.html +1 -1
  67. package/cli/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  68. package/cli/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  69. package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  70. package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  71. package/cli/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  72. package/cli/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  73. package/cli/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  74. package/cli/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  75. package/cli/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  76. package/cli/app/.next-cli-build/server/app/_not-found.html +1 -1
  77. package/cli/app/.next-cli-build/server/app/_not-found.rsc +3 -3
  78. package/cli/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
  79. package/cli/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  80. package/cli/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +3 -3
  81. package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  82. package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  83. package/cli/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  84. package/cli/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  85. package/cli/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  86. package/cli/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  87. package/cli/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  88. package/cli/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  89. package/cli/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  90. package/cli/app/.next-cli-build/server/app/api/cache/stats/route.js.nft.json +1 -1
  91. package/cli/app/.next-cli-build/server/app/api/changelog/route.js.nft.json +1 -1
  92. package/cli/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +2 -2
  93. package/cli/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  94. package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  95. package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  96. package/cli/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  97. package/cli/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  98. package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-gateway/accounts/route.js.nft.json +1 -1
  99. package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
  100. package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  101. package/cli/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  102. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  103. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  104. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  105. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  106. package/cli/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  107. package/cli/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  108. package/cli/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
  109. package/cli/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  110. package/cli/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  111. package/cli/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  112. package/cli/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  113. package/cli/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  114. package/cli/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  115. package/cli/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  116. package/cli/app/.next-cli-build/server/app/api/context/[id]/route.js.nft.json +1 -1
  117. package/cli/app/.next-cli-build/server/app/api/context/bulk/route.js.nft.json +1 -1
  118. package/cli/app/.next-cli-build/server/app/api/context/route.js.nft.json +1 -1
  119. package/cli/app/.next-cli-build/server/app/api/dashboard/chat/completions/route.js.nft.json +1 -1
  120. package/cli/app/.next-cli-build/server/app/api/dashboard/cli-tools/keys/route.js.nft.json +1 -1
  121. package/cli/app/.next-cli-build/server/app/api/dashboard/media/[operation]/route.js.nft.json +1 -1
  122. package/cli/app/.next-cli-build/server/app/api/dashboard/media/videos/[id]/route.js.nft.json +1 -1
  123. package/cli/app/.next-cli-build/server/app/api/headroom/enable/route.js.nft.json +1 -1
  124. package/cli/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
  125. package/cli/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  126. package/cli/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
  127. package/cli/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  128. package/cli/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  129. package/cli/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  130. package/cli/app/.next-cli-build/server/app/api/health/ready/route.js.nft.json +1 -1
  131. package/cli/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  132. package/cli/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  133. package/cli/app/.next-cli-build/server/app/api/keys/[id]/rotate/route.js.nft.json +1 -1
  134. package/cli/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  135. package/cli/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  136. package/cli/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  137. package/cli/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  138. package/cli/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  139. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  140. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  141. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  142. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  143. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  144. package/cli/app/.next-cli-build/server/app/api/metrics/route.js.nft.json +1 -1
  145. package/cli/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  146. package/cli/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  147. package/cli/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  148. package/cli/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  149. package/cli/app/.next-cli-build/server/app/api/models/route.js +1 -1
  150. package/cli/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  151. package/cli/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  152. package/cli/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  153. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  154. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  155. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/route.js.nft.json +1 -1
  156. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/latest/route.js.nft.json +1 -1
  157. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/route.js.nft.json +1 -1
  158. package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  159. package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  160. package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/[jobId]/route.js.nft.json +1 -1
  161. package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/latest/route.js.nft.json +1 -1
  162. package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/route.js.nft.json +1 -1
  163. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  164. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  165. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/route.js.nft.json +1 -1
  166. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/latest/route.js.nft.json +1 -1
  167. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/route.js.nft.json +1 -1
  168. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-token/route.js.nft.json +1 -1
  169. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/quota-cookie/route.js.nft.json +1 -1
  170. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  171. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  172. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/[jobId]/route.js.nft.json +1 -1
  173. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/latest/route.js.nft.json +1 -1
  174. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/route.js.nft.json +1 -1
  175. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-token/route.js.nft.json +1 -1
  176. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/quota-cookie/route.js.nft.json +1 -1
  177. package/cli/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  178. package/cli/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  179. package/cli/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  180. package/cli/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  181. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  182. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  183. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/[jobId]/route.js.nft.json +1 -1
  184. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/latest/route.js.nft.json +1 -1
  185. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js.nft.json +1 -1
  186. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-token/route.js.nft.json +1 -1
  187. package/cli/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  188. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  189. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  190. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  191. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  192. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/route.js.nft.json +1 -1
  193. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/latest/route.js.nft.json +1 -1
  194. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/route.js.nft.json +1 -1
  195. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  196. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  197. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  198. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  199. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  200. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  201. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/route.js.nft.json +1 -1
  202. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/latest/route.js.nft.json +1 -1
  203. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/route.js.nft.json +1 -1
  204. package/cli/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  205. package/cli/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  206. package/cli/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  207. package/cli/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  208. package/cli/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  209. package/cli/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  210. package/cli/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  211. package/cli/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  212. package/cli/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  213. package/cli/app/.next-cli-build/server/app/api/providers/bulk-delete/route.js.nft.json +1 -1
  214. package/cli/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  215. package/cli/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  216. package/cli/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  217. package/cli/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  218. package/cli/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  219. package/cli/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  220. package/cli/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  221. package/cli/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  222. package/cli/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  223. package/cli/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  224. package/cli/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  225. package/cli/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  226. package/cli/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  227. package/cli/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  228. package/cli/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  229. package/cli/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
  230. package/cli/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
  231. package/cli/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
  232. package/cli/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
  233. package/cli/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
  234. package/cli/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
  235. package/cli/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
  236. package/cli/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  237. package/cli/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  238. package/cli/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  239. package/cli/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  240. package/cli/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  241. package/cli/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  242. package/cli/app/.next-cli-build/server/app/api/terminal/auth/setup/route.js.nft.json +1 -1
  243. package/cli/app/.next-cli-build/server/app/api/terminal/auth/status/route.js.nft.json +1 -1
  244. package/cli/app/.next-cli-build/server/app/api/terminal/auth/unlock/route.js.nft.json +1 -1
  245. package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/input/route.js.nft.json +1 -1
  246. package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/resize/route.js.nft.json +1 -1
  247. package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/route.js.nft.json +1 -1
  248. package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/stream/route.js.nft.json +1 -1
  249. package/cli/app/.next-cli-build/server/app/api/terminal/session/route.js.nft.json +1 -1
  250. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  251. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  252. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
  253. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  254. package/cli/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  255. package/cli/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  256. package/cli/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  257. package/cli/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  258. package/cli/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  259. package/cli/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  260. package/cli/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  261. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  262. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  263. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  264. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  265. package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  266. package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  267. package/cli/app/.next-cli-build/server/app/api/usage/aggregate/route.js.nft.json +1 -1
  268. package/cli/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  269. package/cli/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  270. package/cli/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  271. package/cli/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  272. package/cli/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  273. package/cli/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  274. package/cli/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  275. package/cli/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  276. package/cli/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  277. package/cli/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  278. package/cli/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  279. package/cli/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  280. package/cli/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  281. package/cli/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  282. package/cli/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  283. package/cli/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  284. package/cli/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js +1 -1
  285. package/cli/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  286. package/cli/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  287. package/cli/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  288. package/cli/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  289. package/cli/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  290. package/cli/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  291. package/cli/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  292. package/cli/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  293. package/cli/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  294. package/cli/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
  295. package/cli/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
  296. package/cli/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
  297. package/cli/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
  298. package/cli/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  299. package/cli/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  300. package/cli/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  301. package/cli/app/.next-cli-build/server/app/api/version/route.js +1 -1
  302. package/cli/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  303. package/cli/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  304. package/cli/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  305. package/cli/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  306. package/cli/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  307. package/cli/app/.next-cli-build/server/app/callback.html +1 -1
  308. package/cli/app/.next-cli-build/server/app/callback.rsc +3 -3
  309. package/cli/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
  310. package/cli/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  311. package/cli/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +3 -3
  312. package/cli/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
  313. package/cli/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  314. package/cli/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  315. package/cli/app/.next-cli-build/server/app/dashboard/automation.html +1 -1
  316. package/cli/app/.next-cli-build/server/app/dashboard/automation.rsc +5 -5
  317. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation/__PAGE__.segment.rsc +2 -2
  318. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation.segment.rsc +1 -1
  319. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  320. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  321. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_full.segment.rsc +5 -5
  322. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_head.segment.rsc +1 -1
  323. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_index.segment.rsc +3 -3
  324. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_tree.segment.rsc +1 -1
  325. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  326. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +5 -5
  327. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  328. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  329. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  330. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  331. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +5 -5
  332. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  333. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +3 -3
  334. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
  335. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  336. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +5 -5
  337. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  338. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  339. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  340. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  341. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +5 -5
  342. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  343. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +3 -3
  344. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
  345. package/cli/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  346. package/cli/app/.next-cli-build/server/app/dashboard/combos.rsc +5 -5
  347. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  348. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  349. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  350. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  351. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +5 -5
  352. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  353. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +3 -3
  354. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
  355. package/cli/app/.next-cli-build/server/app/dashboard/context.html +1 -1
  356. package/cli/app/.next-cli-build/server/app/dashboard/context.rsc +5 -5
  357. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context/__PAGE__.segment.rsc +2 -2
  358. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context.segment.rsc +1 -1
  359. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  360. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  361. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_full.segment.rsc +5 -5
  362. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_head.segment.rsc +1 -1
  363. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_index.segment.rsc +3 -3
  364. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_tree.segment.rsc +1 -1
  365. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  366. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.rsc +5 -5
  367. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  368. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  369. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  370. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  371. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +5 -5
  372. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  373. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +3 -3
  374. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
  375. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  376. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +5 -5
  377. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  378. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
  379. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
  380. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  381. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  382. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +5 -5
  383. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
  384. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +3 -3
  385. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
  386. package/cli/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  387. package/cli/app/.next-cli-build/server/app/dashboard/mitm.rsc +5 -5
  388. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  389. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  390. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  391. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  392. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +5 -5
  393. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  394. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +3 -3
  395. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
  396. package/cli/app/.next-cli-build/server/app/dashboard/playground.html +1 -1
  397. package/cli/app/.next-cli-build/server/app/dashboard/playground.rsc +5 -5
  398. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground/__PAGE__.segment.rsc +2 -2
  399. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground.segment.rsc +1 -1
  400. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  401. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  402. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_full.segment.rsc +5 -5
  403. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_head.segment.rsc +1 -1
  404. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_index.segment.rsc +3 -3
  405. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_tree.segment.rsc +1 -1
  406. package/cli/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  407. package/cli/app/.next-cli-build/server/app/dashboard/profile.rsc +5 -5
  408. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  409. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  410. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  411. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  412. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +5 -5
  413. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  414. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +3 -3
  415. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
  416. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  417. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.rsc +5 -5
  418. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  419. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  420. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  421. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  422. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  423. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +5 -5
  424. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  425. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +3 -3
  426. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
  427. package/cli/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  428. package/cli/app/.next-cli-build/server/app/dashboard/providers.rsc +5 -5
  429. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  430. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  431. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  432. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  433. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +5 -5
  434. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  435. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +3 -3
  436. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
  437. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  438. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +5 -5
  439. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  440. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  441. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  442. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  443. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +5 -5
  444. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  445. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +3 -3
  446. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
  447. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  448. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +5 -5
  449. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
  450. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe.segment.rsc +1 -1
  451. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  452. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  453. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +5 -5
  454. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_head.segment.rsc +1 -1
  455. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_index.segment.rsc +3 -3
  456. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
  457. package/cli/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
  458. package/cli/app/.next-cli-build/server/app/dashboard/quota.rsc +6 -6
  459. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  460. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  461. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  462. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  463. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +6 -6
  464. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  465. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +3 -3
  466. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
  467. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  468. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
  469. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  470. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing.segment.rsc +1 -1
  471. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings.segment.rsc +1 -1
  472. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  473. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  474. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
  475. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  476. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
  477. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  478. package/cli/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  479. package/cli/app/.next-cli-build/server/app/dashboard/skills.rsc +5 -5
  480. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
  481. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
  482. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  483. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  484. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +5 -5
  485. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
  486. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +3 -3
  487. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
  488. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  489. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.rsc +5 -5
  490. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
  491. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +1 -1
  492. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  493. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  494. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +5 -5
  495. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +1 -1
  496. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +3 -3
  497. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
  498. package/cli/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  499. package/cli/app/.next-cli-build/server/app/dashboard/translator.rsc +5 -5
  500. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  501. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  502. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  503. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  504. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +5 -5
  505. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  506. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +3 -3
  507. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
  508. package/cli/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  509. package/cli/app/.next-cli-build/server/app/dashboard/usage.rsc +5 -5
  510. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  511. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  512. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  513. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  514. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
  515. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  516. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +3 -3
  517. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
  518. package/cli/app/.next-cli-build/server/app/dashboard.html +1 -1
  519. package/cli/app/.next-cli-build/server/app/dashboard.rsc +5 -5
  520. package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  521. package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  522. package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  523. package/cli/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +5 -5
  524. package/cli/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
  525. package/cli/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +3 -3
  526. package/cli/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  527. package/cli/app/.next-cli-build/server/app/index.html +1 -1
  528. package/cli/app/.next-cli-build/server/app/index.rsc +3 -3
  529. package/cli/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  530. package/cli/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
  531. package/cli/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
  532. package/cli/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +3 -3
  533. package/cli/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
  534. package/cli/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  535. package/cli/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  536. package/cli/app/.next-cli-build/server/app/landing.html +1 -1
  537. package/cli/app/.next-cli-build/server/app/landing.rsc +4 -4
  538. package/cli/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +4 -4
  539. package/cli/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  540. package/cli/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +3 -3
  541. package/cli/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
  542. package/cli/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +2 -2
  543. package/cli/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  544. package/cli/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  545. package/cli/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  546. package/cli/app/.next-cli-build/server/app/login.html +1 -1
  547. package/cli/app/.next-cli-build/server/app/login.rsc +4 -4
  548. package/cli/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
  549. package/cli/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  550. package/cli/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +3 -3
  551. package/cli/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
  552. package/cli/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  553. package/cli/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  554. package/cli/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  555. package/cli/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  556. package/cli/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  557. package/cli/app/.next-cli-build/server/app/provider-icons/[provider]/route.js.nft.json +1 -1
  558. package/cli/app/.next-cli-build/server/app-paths-manifest.json +3 -3
  559. package/cli/app/.next-cli-build/server/chunks/1131.js +1 -1
  560. package/cli/app/.next-cli-build/server/chunks/3949.js +1 -1
  561. package/cli/app/.next-cli-build/server/chunks/4025.js +5 -5
  562. package/cli/app/.next-cli-build/server/chunks/4404.js +1 -1
  563. package/cli/app/.next-cli-build/server/chunks/4827.js +1 -1
  564. package/cli/app/.next-cli-build/server/chunks/5681.js +1 -1
  565. package/cli/app/.next-cli-build/server/chunks/7276.js +1 -1
  566. package/cli/app/.next-cli-build/server/chunks/7319.js +5 -5
  567. package/cli/app/.next-cli-build/server/chunks/8202.js +1 -0
  568. package/cli/app/.next-cli-build/server/chunks/8255.js +1 -1
  569. package/cli/app/.next-cli-build/server/chunks/8274.js +1 -1
  570. package/cli/app/.next-cli-build/server/chunks/8306.js +1 -1
  571. package/cli/app/.next-cli-build/server/chunks/9489.js +1 -1
  572. package/cli/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  573. package/cli/app/.next-cli-build/server/pages/404.html +1 -1
  574. package/cli/app/.next-cli-build/server/pages/500.html +1 -1
  575. package/cli/app/.next-cli-build/static/chunks/{4686-3870bc6cc2baf49c.js → 4686-9853e280b3d115cd.js} +5 -5
  576. package/cli/app/.next-cli-build/static/chunks/620-4f9354613812794d.js +1 -0
  577. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-f12cb6a2bcaec9fe.js → page-15dd47ab818e675d.js} +8 -8
  578. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-4c3a2c103daf032d.js +3 -0
  579. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-53b93e9ce3d13457.js +1 -0
  580. package/cli/app/CHANGELOG.md +11 -0
  581. package/cli/app/package.json +1 -1
  582. package/cli/package.json +1 -1
  583. package/package.json +1 -1
  584. package/cli/app/.next-cli-build/static/chunks/620-abe9e47b22606c8c.js +0 -1
  585. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-be7d9bbb3ce0bb40.js +0 -3
  586. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-7f25296cd5a4eeab.js +0 -1
  587. /package/cli/app/.next-cli-build/static/{vXCx3sJBUb9AL2WtKv2-b → w1sCnXd2bDo0uOd51yNpl}/_buildManifest.js +0 -0
  588. /package/cli/app/.next-cli-build/static/{vXCx3sJBUb9AL2WtKv2-b → w1sCnXd2bDo0uOd51yNpl}/_ssgManifest.js +0 -0
@@ -1,9 +1,9 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[182],{7651:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>K});var s=r(95155),a=r(73321),o=r(98500),n=r.n(o),l=r(12115),i=r(35497),d=r(57250),c=r(52679),u=r(28777),m=r(11059),p=r(14051),x=r.n(p),h=r(81277);function b({until:e}){let[t,r]=(0,l.useState)("");return((0,l.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void r("");let s=Math.floor(t/1e3);s<60?r(`${s}s`):s<3600?r(`${Math.floor(s/60)}m ${s%60}s`):r(`${Math.floor(s/3600)}h ${Math.floor(s%3600/60)}m`)};t();let s=setInterval(t,1e3);return()=>clearInterval(s)},[e]),t)?(0,s.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function f({connection:e,proxyPools:t,isOAuth:r,isFirst:a,isLast:o,onMoveUp:n,onMoveDown:d,onToggleActive:c,onUpdateProxy:u,onEdit:m,onDelete:p}){let[x,g]=(0,l.useState)(!1),[y,v]=(0,l.useState)(!1),j=(0,l.useRef)(null),w=new Map((t||[]).map(e=>[e.id,e])),N=e.providerSpecificData?.proxyPoolId||null,k=N?w.get(N):null,C=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,S=!!N||C,_=k?`Pool: ${k.name}`:N?`Pool: ${N} (inactive/missing)`:C?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",$="",E=k?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;if(E)try{let e=new URL(E);$=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{$=E}let T=k?.noProxy||e.providerSpecificData?.connectionNoProxy||"",R=k?.isActive===!0?"success":N||C?"error":"default",A=(0,h.c)(e),O=null!==A;(0,l.useEffect)(()=>{if(!x)return;let e=e=>{j.current&&!j.current.contains(e.target)&&g(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[x]);let P="unavailable"!==e.testStatus||O?e.testStatus:"active",I=r?e.name||e.email||e.displayName||"OAuth Account":e.name,L=async e=>{v(!0);try{await u("__none__"===e?null:e)}finally{v(!1),g(!1)}};return(0,s.jsxs)("div",{className:`group flex flex-col gap-3 p-2 rounded-lg sm:flex-row sm:items-center sm:justify-between hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${!1===e.isActive?"opacity-60":""}`,children:[(0,s.jsxs)("div",{className:"flex w-full min-w-0 flex-1 items-start gap-3 sm:items-center",children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("button",{onClick:n,disabled:a,className:`p-0.5 rounded ${a?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,s.jsx)("button",{onClick:d,disabled:o,className:`p-0.5 rounded ${o?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:r?"lock":"key"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:I}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-1",children:[(0,s.jsx)(i.Ex,{variant:!1===e.isActive?"default":"active"===P||"success"===P?"success":"error"===P||"expired"===P||"unavailable"===P?"error":"default",size:"sm",dot:!0,children:!1===e.isActive?"disabled":P||"Unknown"}),S&&(0,s.jsx)(i.Ex,{variant:R,size:"sm",children:"Proxy"}),O&&!1!==e.isActive&&(0,s.jsx)(b,{until:A}),e.lastError&&!1!==e.isActive&&(0,s.jsx)("span",{className:"text-xs text-red-500 truncate max-w-[300px]",title:e.lastError,children:e.lastError}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]})]}),S&&(0,s.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"text-[11px] text-text-muted truncate max-w-[420px]",title:_,children:_}),$&&(0,s.jsx)("code",{className:"text-[10px] font-mono bg-black/5 dark:bg-white/5 px-1 py-0.5 rounded text-text-muted",children:$}),T&&(0,s.jsxs)("span",{className:"text-[11px] text-text-muted truncate max-w-[320px]",title:T,children:["no_proxy: ",T]})]})]})]}),(0,s.jsxs)("div",{className:"flex w-full flex-wrap items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,s.jsxs)("div",{className:"flex flex-wrap gap-1",children:[(t||[]).length>0&&(0,s.jsxs)("div",{className:"relative",ref:j,children:[(0,s.jsxs)("button",{onClick:()=>g(e=>!e),className:`flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 transition-colors ${S?"text-primary":"text-text-muted hover:text-primary"}`,disabled:y,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:y?"progress_activity":"lan"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),x&&(0,s.jsxs)("div",{className:"absolute right-0 top-full mt-1 z-50 bg-bg border border-border rounded-lg shadow-lg py-1 min-w-[160px]",children:[(0,s.jsx)("button",{onClick:()=>L("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!N?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,s.jsx)("button",{onClick:()=>L(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${N===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),(0,s.jsxs)("button",{onClick:m,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,s.jsxs)("button",{onClick:p,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-red-500/10 text-red-500",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,s.jsx)(i.lM,{size:"sm",checked:e.isActive??!0,onChange:c,title:e.isActive??!0?"Disable":"Enable"})]})]})}function g({isOpen:e,provider:t,providerName:r,proxyPools:a,onSave:o,onClose:n}){let d="__none__",[c,u]=(0,l.useState)({name:"",apiKey:"",priority:1,proxyPoolId:d}),[m,p]=(0,l.useState)(!1),[x,h]=(0,l.useState)(null),[b,f]=(0,l.useState)(!1),y=async()=>{p(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:c.apiKey})}),r=await e.json();h(r.valid?"success":"failed")}catch{h("failed")}finally{p(!1)}},v=async()=>{if(t&&c.apiKey){f(!0);try{let e=!1;try{p(!0),h(null);let r=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:c.apiKey})});e=!!(await r.json()).valid,h(e?"success":"failed")}catch{h("failed")}finally{p(!1)}await o({name:c.name,apiKey:c.apiKey,priority:c.priority,proxyPoolId:c.proxyPoolId===d?null:c.proxyPoolId,testStatus:e?"active":"unknown"})}finally{f(!1)}}};return t?(0,s.jsx)(i.aF,{isOpen:e,title:`Add ${r||t} API Key`,onClose:n,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Name"}),(0,s.jsx)("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:c.name,onChange:e=>u({...c,name:e.target.value}),placeholder:"Production Key"})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"API Key"}),(0,s.jsx)("input",{type:"password",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:c.apiKey,onChange:e=>u({...c,apiKey:e.target.value})})]}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(i.$n,{onClick:y,disabled:!c.apiKey||m||b,variant:"secondary",children:m?"Checking...":"Check"})})]}),x&&(0,s.jsx)(i.Ex,{variant:"success"===x?"success":"error",children:"success"===x?"Valid":"Invalid"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Priority"}),(0,s.jsx)("input",{type:"number",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:c.priority,onChange:e=>u({...c,priority:Number.parseInt(e.target.value)||1})})]}),(0,s.jsx)(i.l6,{label:"Proxy Pool",value:c.proxyPoolId,onChange:e=>u({...c,proxyPoolId:e.target.value}),options:[{value:d,label:"None"},...(a||[]).map(e=>({value:e.id,label:e.name}))]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(i.$n,{onClick:v,fullWidth:!0,disabled:!c.name||!c.apiKey||b,children:b?"Saving...":"Save"}),(0,s.jsx)(i.$n,{onClick:n,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function y({providerId:e,isOAuth:t}){let[r,a]=(0,l.useState)([]),[o,n]=(0,l.useState)([]),[d,c]=(0,l.useState)(!0),[u,m]=(0,l.useState)(""),[p,x]=(0,l.useState)(!1),[h,b]=(0,l.useState)(!1),[v,j]=(0,l.useState)(null),[w,N]=(0,l.useState)(null),[k,C]=(0,l.useState)("1"),S=(0,l.useRef)(null),_=(0,l.useRef)("1"),[$,E]=(0,l.useState)(null),T=async e=>{if(!e.ok)return null;try{return await e.json()}catch{return null}},R=(0,l.useCallback)(async()=>{try{let[t,r,s]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),o=await T(t),l=await T(r),i=await T(s)||{},d=null===o,c=null===l;d||a((o.connections||[]).filter(t=>t.provider===e)),c||n(l.proxyPools||[]),d||c?m("Connection data could not be loaded. Check that the server is running, then retry."):m("");let u=(i.providerStrategies||{})[e]||{};N(u.fallbackStrategy||null),C(null!=u.stickyRoundRobinLimit?String(u.stickyRoundRobinLimit):"1"),_.current=null!=u.stickyRoundRobinLimit?String(u.stickyRoundRobinLimit):"1"}catch(e){console.log("ConnectionsCard fetch error:",e),m("Connection data could not be loaded. Check that the server is running, then retry.")}finally{c(!1)}},[e]);(0,l.useEffect)(()=>{R()},[R]);let A=async(t,r)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},o={};t&&(o.fallbackStrategy=t),"round-robin"===t&&""!==r&&(o.stickyRoundRobinLimit=Number(r)||3);let n={...a};0===Object.keys(o).length?delete n[e]:n[e]=o,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:n})})}catch(e){console.log("saveStrategy error:",e)}},O=async(e,t)=>{let s=[...r];[s[e],s[t]]=[s[t],s[e]],a(s);try{let[r,a]=await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e+1})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t+1})})]);r.ok&&a.ok||await R()}catch{await R()}},P=async e=>{E({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{E(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&a(t=>t.filter(t=>t.id!==e))}catch(e){console.log("delete error:",e)}}})},I=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&a(r=>r.map(r=>r.id===e?{...r,isActive:t}:r))}catch(e){console.log("toggle error:",e)}},L=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&a(r=>r.map(r=>r.id===e?{...r,providerSpecificData:{...r.providerSpecificData,proxyPoolId:t||null}}:r))}catch(e){console.log("proxy error:",e)}},M=async t=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,...t})})).ok&&(await R(),x(!1))}catch(e){console.log("save apikey error:",e)}},D=async e=>{try{(await fetch(`/api/providers/${v.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await R(),b(!1))}catch(e){console.log("update connection error:",e)}};return d?(0,s.jsx)(i.Zp,{children:(0,s.jsx)("div",{className:"h-20 animate-pulse bg-black/5 rounded-lg"})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(i.Zp,{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,s.jsx)(i.lM,{checked:"round-robin"===w,onChange:e=>{let t=e?"round-robin":null;N(t),e&&!k&&C("1");let r=e?k||"1":k;_.current=r,S.current&&(clearTimeout(S.current),S.current=null),A(t,r)}}),"round-robin"===w&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,s.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,s.jsx)("input",{type:"number",min:1,value:k,onChange:e=>{C(e.target.value),_.current=e.target.value,S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{A("round-robin",_.current)},500)},className:"w-16 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]}),u&&(0,s.jsxs)("div",{className:"mb-4 flex flex-col gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-600 dark:border-red-800 dark:bg-red-900/20 dark:text-red-400 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsx)("span",{children:u}),(0,s.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"refresh",onClick:()=>{c(!0),R()},children:"Retry"})]}),0!==r.length||u?r.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:r.map((e,a)=>(0,s.jsx)(f,{connection:e,proxyPools:o,isOAuth:t,isFirst:0===a,isLast:a===r.length-1,onMoveUp:()=>O(a,a-1),onMoveDown:()=>O(a,a+1),onToggleActive:t=>I(e.id,t),onUpdateProxy:t=>L(e.id,t),onEdit:()=>{j(e),b(!0)},onDelete:()=>P(e.id)},e.id))}),(0,s.jsx)("div",{className:"mt-4 flex justify-stretch sm:justify-start",children:(0,s.jsx)(i.$n,{size:"sm",icon:"add",onClick:()=>x(!0),children:"Add"})})]}):(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),(0,s.jsx)(i.$n,{size:"sm",icon:"add",onClick:()=>x(!0),children:"Add Connection"})]})]}),(0,s.jsx)(g,{isOpen:p,provider:e,proxyPools:o,onSave:M,onClose:()=>x(!1)}),(0,s.jsx)(i.wI,{isOpen:h,connection:v,proxyPools:o,onSave:D,onClose:()=>b(!1)}),(0,s.jsx)(i.uo,{isOpen:!!$,onClose:()=>E(null),onConfirm:$?.onConfirm,title:$?.title||"Confirm",message:$?.message,variant:"danger"})]})}function v({model:e,fullModel:t,copied:r,onCopy:a,testStatus:o,isCustom:n,isFree:l,onDeleteAlias:i,onTest:d,isTesting:c}){let u="ok"===o?"#22c55e":"error"===o?"#ef4444":void 0;return(0,s.jsx)("div",{className:`group px-3 py-2 rounded-lg border ${"ok"===o?"border-green-500/40":"error"===o?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base",style:u?{color:u}:void 0,children:"ok"===o?"check_circle":"error"===o?"cancel":"smart_toy"}),(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),e.name&&(0,s.jsx)("span",{className:"text-[9px] text-text-muted/70 italic pl-1",children:e.name})]}),d&&(0,s.jsxs)("div",{className:"relative group/btn",children:[(0,s.jsx)("button",{onClick:d,disabled:c,className:`p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-opacity ${c?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",style:c?{animation:"spin 1s linear infinite"}:void 0,children:c?"progress_activity":"science"})}),(0,s.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:c?"Testing...":"Test"})]}),(0,s.jsxs)("div",{className:"relative group/btn",children:[(0,s.jsx)("button",{onClick:()=>a(t,`model-${e.id}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:r===`model-${e.id}`?"check":"content_copy"})}),(0,s.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:r===`model-${e.id}`?"Copied!":"Copy"})]}),l&&(0,s.jsx)("span",{className:"text-[10px] font-bold text-green-500 bg-green-500/10 px-1.5 py-0.5 rounded",children:"FREE"}),n&&(0,s.jsx)("button",{onClick:i,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity ml-auto",title:"Remove custom model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})})]})})}function j({isOpen:e,onSave:t,onClose:r}){let[a,o]=(0,l.useState)(""),n=()=>{a.trim()&&(t(a.trim()),o(""))};return(0,s.jsx)(i.aF,{isOpen:e,title:"Add Custom Model",onClose:r,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,s.jsx)("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:a,onChange:e=>o(e.target.value),onKeyDown:e=>"Enter"===e.key&&n(),placeholder:"e.g. tts-1-hd",autoFocus:!0})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(i.$n,{onClick:n,fullWidth:!0,disabled:!a.trim(),children:"Add"}),(0,s.jsx)(i.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function w({providerId:e,kindFilter:t,providerAliasOverride:r}){let{copied:a,copy:o}=(0,m.C)(),[n,d]=(0,l.useState)({}),[p,x]=(0,l.useState)([]),[h,b]=(0,l.useState)({}),[f,g]=(0,l.useState)(null),[y,N]=(0,l.useState)(null),[k,C]=(0,l.useState)(!1),[S,_]=(0,l.useState)([]),$=r||(0,c.wG)(e),E=t||"llm",T=(0,l.useCallback)(async()=>{try{let[t,r,s]=await Promise.all([fetch("/api/models/alias"),fetch("/api/providers",{cache:"no-store"}),fetch("/api/models/custom",{cache:"no-store"})]),a=await t.json(),o=await r.json(),n=await s.json();t.ok&&d(a.aliases||{}),r.ok&&_((o.connections||[]).filter(t=>t.provider===e)),s.ok&&x(n.models||[])}catch(e){console.log("ModelsCard fetch error:",e)}},[e]);(0,l.useEffect)(()=>{T()},[T]);let R=async(e,t)=>{let r=`${$}/${e}`;try{(await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:r,alias:t})})).ok&&await T()}catch(e){console.log("set alias error:",e)}},A=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await T()}catch(e){console.log("delete alias error:",e)}},O=async e=>{try{(await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:$,id:e,type:E})})).ok&&(await T(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("add custom model error:",e)}},P=async e=>{try{let t=new URLSearchParams({providerAlias:$,id:e,type:E});(await fetch(`/api/models/custom?${t}`,{method:"DELETE"})).ok&&(await T(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("delete custom model error:",e)}},I=async e=>{if(!f){g(e);try{let r=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${$}/${e}`,kind:t})}),s=await r.json();b(t=>({...t,[e]:s.ok?"ok":"error"})),N(s.ok?null:{modelId:e,message:s.error||"Model not reachable"})}catch{b(t=>({...t,[e]:"error"})),N({modelId:e,message:"Network error"})}finally{g(null)}}},L=(0,u.KC)(e),M=t?L.filter(e=>e.kinds?e.kinds.includes(t):(e.type||"llm")===t):L,D=p.filter(e=>e.providerAlias===$&&(e.type||"llm")===E&&!M.some(t=>t.id===e.id)),U=(0,l.useMemo)(()=>{let e={};for(let[t,r]of Object.entries(n))r in e||(e[r]=t);return e},[n]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(i.Zp,{children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,s.jsxs)("h2",{className:"text-lg font-semibold",children:["Models",t?` — ${t.toUpperCase()}`:""]})}),y&&(0,s.jsxs)("p",{className:"text-xs text-red-500 mb-3 break-words",children:[y.modelId,": ",y.message]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-3",children:[M.map(e=>{let t=U[`${$}/${e.id}`];return(0,s.jsx)(v,{model:e,fullModel:`${$}/${e.id}`,alias:t,copied:a,onCopy:o,onSetAlias:t=>R(e.id,t),onDeleteAlias:()=>A(t),testStatus:h[e.id],onTest:S.length>0?()=>I(e.id):void 0,isTesting:f===e.id,isFree:e.isFree},e.id)}),D.map(e=>(0,s.jsx)(v,{model:{id:e.id,name:e.name},fullModel:`${$}/${e.id}`,copied:a,onCopy:o,onSetAlias:()=>{},onDeleteAlias:()=>P(e.id),testStatus:h[e.id],onTest:S.length>0?()=>I(e.id):void 0,isTesting:f===e.id,isCustom:!0},`${e.id}-${e.type}`)),(0,s.jsxs)("button",{onClick:()=>C(!0),className:"flex items-center gap-1.5 px-3 py-2 rounded-lg border border-dashed border-black/15 dark:border-white/15 text-xs text-text-muted hover:text-primary hover:border-primary/40 transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]})]})]}),(0,s.jsx)(j,{isOpen:k,onSave:async e=>{await O(e),C(!1)},onClose:()=>C(!1)})]})}b.propTypes={until:x().string.isRequired},f.propTypes={connection:x().shape({id:x().string,name:x().string,email:x().string,displayName:x().string,testStatus:x().string,isActive:x().bool,lastError:x().string,priority:x().number}).isRequired,proxyPools:x().array,isOAuth:x().bool.isRequired,isFirst:x().bool.isRequired,isLast:x().bool.isRequired,onMoveUp:x().func.isRequired,onMoveDown:x().func.isRequired,onToggleActive:x().func.isRequired,onUpdateProxy:x().func,onEdit:x().func.isRequired,onDelete:x().func.isRequired},g.propTypes={isOpen:x().bool.isRequired,provider:x().string,providerName:x().string,proxyPools:x().array,onSave:x().func.isRequired,onClose:x().func.isRequired},y.propTypes={providerId:x().string.isRequired,isOAuth:x().bool},v.propTypes={model:x().shape({id:x().string.isRequired}).isRequired,fullModel:x().string.isRequired,copied:x().string,onCopy:x().func.isRequired,testStatus:x().oneOf(["ok","error"]),isCustom:x().bool,isFree:x().bool,onDeleteAlias:x().func,onTest:x().func,isTesting:x().bool},j.propTypes={isOpen:x().bool.isRequired,onSave:x().func.isRequired,onClose:x().func.isRequired},w.propTypes={providerId:x().string.isRequired,kindFilter:x().string,providerAliasOverride:x().string};let N={"google-tts":{hasLanguageDropdown:!1,hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"hardcoded"},openai:{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"openai-tts-models",voiceKey:"openai-tts-voices",voicesPerModel:!0},openrouter:{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"openrouter-tts-models",voiceKey:"openrouter-tts-voices",voicesPerModel:!0},elevenlabs:{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",modelKey:"elevenlabs-tts-models",apiEndpoint:"/api/media-providers/tts/elevenlabs/voices"},"edge-tts":{hasLanguageDropdown:!1,hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"api-language"},"local-device":{hasLanguageDropdown:!1,hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"api-language"},nvidia:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},hyperbolic:{hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"config"},deepgram:{hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/deepgram/voices"},huggingface:{hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"config"},cartesia:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},playht:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},coqui:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},tortoise:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},inworld:{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",modelKey:"inworld-tts-models",apiEndpoint:"/api/media-providers/tts/inworld/voices"},qwen:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},minimax:{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/minimax/voices",defaultVoiceId:"English_expressive_narrator"},"minimax-cn":{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/minimax/voices?provider=minimax-cn",defaultVoiceId:"English_expressive_narrator"},gemini:{hasLanguageDropdown:!1,hasLanguageHint:!0,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"gemini-tts-models",voiceKey:"gemini-tts-voices",voicesPerModel:!0}};var k=r(717),C=r(91781),S=r(62199);let _=new Set(["done","failed","completed","error","expired","cancelled"]),$=new Set(["failed","error","expired","cancelled"]);async function E({requestId:e,connectionId:t,signal:r,fetchImpl:s=fetch,pollIntervalMs:a=3e3,timeoutMs:o=6e5,onProgress:n}){if(!e)throw Error("Video response did not include a request id");let l=(0,S.x)(String(e));if(!l)throw Error("Video response included an invalid request id");let i=Date.now()+o;for(;Date.now()<=i;){if(r?.aborted)throw new DOMException("Video polling aborted","AbortError");let e={Accept:"application/json"};t&&(e["x-connection-id"]=t);let o=await s(l,{method:"GET",headers:e,signal:r}),i=await o.json().catch(()=>({}));if(o.ok){let e=String(i?.status||"pending").toLowerCase();if(n?.({status:e,progress:i?.progress}),$.has(e)){let e=i?.error?.message||i?.error||"Video generation failed";throw Error("string"==typeof e?e:JSON.stringify(e))}if(_.has(e))return i}else if(429!==o.status&&503!==o.status){let e=i?.error?.message||i?.error||`Video polling failed (HTTP ${o.status})`;throw Error("string"==typeof e?e:JSON.stringify(e))}await function(e,t){return new Promise((r,s)=>{let a=()=>{clearTimeout(o),s(new DOMException("Video polling aborted","AbortError"))},o=setTimeout(()=>{t?.removeEventListener("abort",a),r()},e);t?.addEventListener("abort",a,{once:!0})})}(a,r)}throw Error("Timed out while waiting for the video job")}function T({label:e,children:t}){return(0,s.jsxs)("div",{className:"flex min-w-0 flex-col gap-1.5 sm:flex-row sm:items-center sm:gap-3",children:[(0,s.jsx)("span",{className:"w-full text-xs font-medium text-text-muted sm:w-20 sm:shrink-0",children:e}),(0,s.jsx)("div",{className:"w-full min-w-0 flex-1",children:t})]})}let R=`// Audio will appear here after running.
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[182],{7651:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>K});var s=r(95155),a=r(73321),o=r(98500),n=r.n(o),l=r(12115),i=r(35497),d=r(57250),c=r(52679),u=r(28777),m=r(11059),p=r(14051),x=r.n(p),h=r(81277);function b({until:e}){let[t,r]=(0,l.useState)("");return((0,l.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void r("");let s=Math.floor(t/1e3);s<60?r(`${s}s`):s<3600?r(`${Math.floor(s/60)}m ${s%60}s`):r(`${Math.floor(s/3600)}h ${Math.floor(s%3600/60)}m`)};t();let s=setInterval(t,1e3);return()=>clearInterval(s)},[e]),t)?(0,s.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function f({connection:e,proxyPools:t,isOAuth:r,isFirst:a,isLast:o,onMoveUp:n,onMoveDown:d,onToggleActive:c,onUpdateProxy:u,onEdit:m,onDelete:p}){let[x,g]=(0,l.useState)(!1),[y,v]=(0,l.useState)(!1),j=(0,l.useRef)(null),w=new Map((t||[]).map(e=>[e.id,e])),N=e.providerSpecificData?.proxyPoolId||null,k=N?w.get(N):null,C=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,S=!!N||C,_=k?`Pool: ${k.name}`:N?`Pool: ${N} (inactive/missing)`:C?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",$="",E=k?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;if(E)try{let e=new URL(E);$=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{$=E}let T=k?.noProxy||e.providerSpecificData?.connectionNoProxy||"",R=k?.isActive===!0?"success":N||C?"error":"default",O=(0,h.c)(e),A=null!==O;(0,l.useEffect)(()=>{if(!x)return;let e=e=>{j.current&&!j.current.contains(e.target)&&g(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[x]);let P="unavailable"!==e.testStatus||A?e.testStatus:"active",I=r?e.name||e.email||e.displayName||"OAuth Account":e.name,L=async e=>{v(!0);try{await u("__none__"===e?null:e)}finally{v(!1),g(!1)}};return(0,s.jsxs)("div",{className:`group flex flex-col gap-3 p-2 rounded-lg sm:flex-row sm:items-center sm:justify-between hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${!1===e.isActive?"opacity-60":""}`,children:[(0,s.jsxs)("div",{className:"flex w-full min-w-0 flex-1 items-start gap-3 sm:items-center",children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("button",{onClick:n,disabled:a,className:`p-0.5 rounded ${a?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,s.jsx)("button",{onClick:d,disabled:o,className:`p-0.5 rounded ${o?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:r?"lock":"key"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:I}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-1",children:[(0,s.jsx)(i.Ex,{variant:!1===e.isActive?"default":"active"===P||"success"===P?"success":"error"===P||"expired"===P||"unavailable"===P?"error":"default",size:"sm",dot:!0,children:!1===e.isActive?"disabled":P||"Unknown"}),S&&(0,s.jsx)(i.Ex,{variant:R,size:"sm",children:"Proxy"}),A&&!1!==e.isActive&&(0,s.jsx)(b,{until:O}),e.lastError&&!1!==e.isActive&&(0,s.jsx)("span",{className:"text-xs text-red-500 truncate max-w-[300px]",title:e.lastError,children:e.lastError}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]})]}),S&&(0,s.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"text-[11px] text-text-muted truncate max-w-[420px]",title:_,children:_}),$&&(0,s.jsx)("code",{className:"text-[10px] font-mono bg-black/5 dark:bg-white/5 px-1 py-0.5 rounded text-text-muted",children:$}),T&&(0,s.jsxs)("span",{className:"text-[11px] text-text-muted truncate max-w-[320px]",title:T,children:["no_proxy: ",T]})]})]})]}),(0,s.jsxs)("div",{className:"flex w-full flex-wrap items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,s.jsxs)("div",{className:"flex flex-wrap gap-1",children:[(t||[]).length>0&&(0,s.jsxs)("div",{className:"relative",ref:j,children:[(0,s.jsxs)("button",{onClick:()=>g(e=>!e),className:`flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 transition-colors ${S?"text-primary":"text-text-muted hover:text-primary"}`,disabled:y,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:y?"progress_activity":"lan"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),x&&(0,s.jsxs)("div",{className:"absolute right-0 top-full mt-1 z-50 bg-bg border border-border rounded-lg shadow-lg py-1 min-w-[160px]",children:[(0,s.jsx)("button",{onClick:()=>L("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!N?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,s.jsx)("button",{onClick:()=>L(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${N===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),(0,s.jsxs)("button",{onClick:m,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,s.jsxs)("button",{onClick:p,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-red-500/10 text-red-500",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,s.jsx)(i.lM,{size:"sm",checked:e.isActive??!0,onChange:c,title:e.isActive??!0?"Disable":"Enable"})]})]})}function g({isOpen:e,provider:t,providerName:r,proxyPools:a,onSave:o,onClose:n}){let d="__none__",[c,u]=(0,l.useState)({name:"",apiKey:"",priority:1,proxyPoolId:d}),[m,p]=(0,l.useState)(!1),[x,h]=(0,l.useState)(null),[b,f]=(0,l.useState)(!1),y=async()=>{p(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:c.apiKey})}),r=await e.json();h(r.valid?"success":"failed")}catch{h("failed")}finally{p(!1)}},v=async()=>{if(t&&c.apiKey){f(!0);try{let e=!1;try{p(!0),h(null);let r=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:c.apiKey})});e=!!(await r.json()).valid,h(e?"success":"failed")}catch{h("failed")}finally{p(!1)}await o({name:c.name,apiKey:c.apiKey,priority:c.priority,proxyPoolId:c.proxyPoolId===d?null:c.proxyPoolId,testStatus:e?"active":"unknown"})}finally{f(!1)}}};return t?(0,s.jsx)(i.aF,{isOpen:e,title:`Add ${r||t} API Key`,onClose:n,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Name"}),(0,s.jsx)("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:c.name,onChange:e=>u({...c,name:e.target.value}),placeholder:"Production Key"})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"API Key"}),(0,s.jsx)("input",{type:"password",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:c.apiKey,onChange:e=>u({...c,apiKey:e.target.value})})]}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(i.$n,{onClick:y,disabled:!c.apiKey||m||b,variant:"secondary",children:m?"Checking...":"Check"})})]}),x&&(0,s.jsx)(i.Ex,{variant:"success"===x?"success":"error",children:"success"===x?"Valid":"Invalid"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Priority"}),(0,s.jsx)("input",{type:"number",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:c.priority,onChange:e=>u({...c,priority:Number.parseInt(e.target.value)||1})})]}),(0,s.jsx)(i.l6,{label:"Proxy Pool",value:c.proxyPoolId,onChange:e=>u({...c,proxyPoolId:e.target.value}),options:[{value:d,label:"None"},...(a||[]).map(e=>({value:e.id,label:e.name}))]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(i.$n,{onClick:v,fullWidth:!0,disabled:!c.name||!c.apiKey||b,children:b?"Saving...":"Save"}),(0,s.jsx)(i.$n,{onClick:n,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function y({providerId:e,isOAuth:t}){let[r,a]=(0,l.useState)([]),[o,n]=(0,l.useState)([]),[d,c]=(0,l.useState)(!0),[u,m]=(0,l.useState)(""),[p,x]=(0,l.useState)(!1),[h,b]=(0,l.useState)(!1),[v,j]=(0,l.useState)(null),[w,N]=(0,l.useState)(null),[k,C]=(0,l.useState)("1"),S=(0,l.useRef)(null),_=(0,l.useRef)("1"),[$,E]=(0,l.useState)(null),T=async e=>{if(!e.ok)return null;try{return await e.json()}catch{return null}},R=(0,l.useCallback)(async()=>{try{let[t,r,s]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),o=await T(t),l=await T(r),i=await T(s)||{},d=null===o,c=null===l;d||a((o.connections||[]).filter(t=>t.provider===e)),c||n(l.proxyPools||[]),d||c?m("Connection data could not be loaded. Check that the server is running, then retry."):m("");let u=(i.providerStrategies||{})[e]||{};N(u.fallbackStrategy||null),C(null!=u.stickyRoundRobinLimit?String(u.stickyRoundRobinLimit):"1"),_.current=null!=u.stickyRoundRobinLimit?String(u.stickyRoundRobinLimit):"1"}catch(e){console.log("ConnectionsCard fetch error:",e),m("Connection data could not be loaded. Check that the server is running, then retry.")}finally{c(!1)}},[e]);(0,l.useEffect)(()=>{R()},[R]);let O=async(t,r)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},o={};t&&(o.fallbackStrategy=t),"round-robin"===t&&""!==r&&(o.stickyRoundRobinLimit=Number(r)||3);let n={...a};0===Object.keys(o).length?delete n[e]:n[e]=o,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:n})})}catch(e){console.log("saveStrategy error:",e)}},A=async(e,t)=>{let s=[...r];[s[e],s[t]]=[s[t],s[e]],a(s);try{let[r,a]=await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e+1})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t+1})})]);r.ok&&a.ok||await R()}catch{await R()}},P=async e=>{E({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{E(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&a(t=>t.filter(t=>t.id!==e))}catch(e){console.log("delete error:",e)}}})},I=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&a(r=>r.map(r=>r.id===e?{...r,isActive:t}:r))}catch(e){console.log("toggle error:",e)}},L=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&a(r=>r.map(r=>r.id===e?{...r,providerSpecificData:{...r.providerSpecificData,proxyPoolId:t||null}}:r))}catch(e){console.log("proxy error:",e)}},M=async t=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,...t})})).ok&&(await R(),x(!1))}catch(e){console.log("save apikey error:",e)}},D=async e=>{try{(await fetch(`/api/providers/${v.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await R(),b(!1))}catch(e){console.log("update connection error:",e)}};return d?(0,s.jsx)(i.Zp,{children:(0,s.jsx)("div",{className:"h-20 animate-pulse bg-black/5 rounded-lg"})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(i.Zp,{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,s.jsx)(i.lM,{checked:"round-robin"===w,onChange:e=>{let t=e?"round-robin":null;N(t),e&&!k&&C("1");let r=e?k||"1":k;_.current=r,S.current&&(clearTimeout(S.current),S.current=null),O(t,r)}}),"round-robin"===w&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,s.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,s.jsx)("input",{type:"number",min:1,value:k,onChange:e=>{C(e.target.value),_.current=e.target.value,S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{O("round-robin",_.current)},500)},className:"w-16 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]}),u&&(0,s.jsxs)("div",{className:"mb-4 flex flex-col gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-600 dark:border-red-800 dark:bg-red-900/20 dark:text-red-400 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsx)("span",{children:u}),(0,s.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"refresh",onClick:()=>{c(!0),R()},children:"Retry"})]}),0!==r.length||u?r.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:r.map((e,a)=>(0,s.jsx)(f,{connection:e,proxyPools:o,isOAuth:t,isFirst:0===a,isLast:a===r.length-1,onMoveUp:()=>A(a,a-1),onMoveDown:()=>A(a,a+1),onToggleActive:t=>I(e.id,t),onUpdateProxy:t=>L(e.id,t),onEdit:()=>{j(e),b(!0)},onDelete:()=>P(e.id)},e.id))}),(0,s.jsx)("div",{className:"mt-4 flex justify-stretch sm:justify-start",children:(0,s.jsx)(i.$n,{size:"sm",icon:"add",onClick:()=>x(!0),children:"Add"})})]}):(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),(0,s.jsx)(i.$n,{size:"sm",icon:"add",onClick:()=>x(!0),children:"Add Connection"})]})]}),(0,s.jsx)(g,{isOpen:p,provider:e,proxyPools:o,onSave:M,onClose:()=>x(!1)}),(0,s.jsx)(i.wI,{isOpen:h,connection:v,proxyPools:o,onSave:D,onClose:()=>b(!1)}),(0,s.jsx)(i.uo,{isOpen:!!$,onClose:()=>E(null),onConfirm:$?.onConfirm,title:$?.title||"Confirm",message:$?.message,variant:"danger"})]})}function v({model:e,fullModel:t,copied:r,onCopy:a,testStatus:o,isCustom:n,isFree:l,onDeleteAlias:i,onTest:d,isTesting:c}){let u="ok"===o?"#22c55e":"error"===o?"#ef4444":void 0;return(0,s.jsx)("div",{className:`group px-3 py-2 rounded-lg border ${"ok"===o?"border-green-500/40":"error"===o?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base",style:u?{color:u}:void 0,children:"ok"===o?"check_circle":"error"===o?"cancel":"smart_toy"}),(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),e.name&&(0,s.jsx)("span",{className:"text-[9px] text-text-muted/70 italic pl-1",children:e.name})]}),d&&(0,s.jsxs)("div",{className:"relative group/btn",children:[(0,s.jsx)("button",{onClick:d,disabled:c,className:`p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-opacity ${c?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",style:c?{animation:"spin 1s linear infinite"}:void 0,children:c?"progress_activity":"science"})}),(0,s.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:c?"Testing...":"Test"})]}),(0,s.jsxs)("div",{className:"relative group/btn",children:[(0,s.jsx)("button",{onClick:()=>a(t,`model-${e.id}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:r===`model-${e.id}`?"check":"content_copy"})}),(0,s.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:r===`model-${e.id}`?"Copied!":"Copy"})]}),l&&(0,s.jsx)("span",{className:"text-[10px] font-bold text-green-500 bg-green-500/10 px-1.5 py-0.5 rounded",children:"FREE"}),n&&(0,s.jsx)("button",{onClick:i,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity ml-auto",title:"Remove custom model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})})]})})}function j({isOpen:e,onSave:t,onClose:r}){let[a,o]=(0,l.useState)(""),n=()=>{a.trim()&&(t(a.trim()),o(""))};return(0,s.jsx)(i.aF,{isOpen:e,title:"Add Custom Model",onClose:r,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,s.jsx)("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:a,onChange:e=>o(e.target.value),onKeyDown:e=>"Enter"===e.key&&n(),placeholder:"e.g. tts-1-hd",autoFocus:!0})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(i.$n,{onClick:n,fullWidth:!0,disabled:!a.trim(),children:"Add"}),(0,s.jsx)(i.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function w({providerId:e,kindFilter:t,providerAliasOverride:r}){let{copied:a,copy:o}=(0,m.C)(),[n,d]=(0,l.useState)({}),[p,x]=(0,l.useState)([]),[h,b]=(0,l.useState)({}),[f,g]=(0,l.useState)(()=>new Set),[y,N]=(0,l.useState)({}),[k,C]=(0,l.useState)(!1),[S,_]=(0,l.useState)([]),$=r||(0,c.wG)(e),E=t||"llm",T=(0,l.useCallback)(async()=>{try{let[t,r,s]=await Promise.all([fetch("/api/models/alias"),fetch("/api/providers",{cache:"no-store"}),fetch("/api/models/custom",{cache:"no-store"})]),a=await t.json(),o=await r.json(),n=await s.json();t.ok&&d(a.aliases||{}),r.ok&&_((o.connections||[]).filter(t=>t.provider===e)),s.ok&&x(n.models||[])}catch(e){console.log("ModelsCard fetch error:",e)}},[e]);(0,l.useEffect)(()=>{T()},[T]);let R=async(e,t)=>{let r=`${$}/${e}`;try{(await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:r,alias:t})})).ok&&await T()}catch(e){console.log("set alias error:",e)}},O=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await T()}catch(e){console.log("delete alias error:",e)}},A=async e=>{try{(await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:$,id:e,type:E})})).ok&&(await T(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("add custom model error:",e)}},P=async e=>{try{let t=new URLSearchParams({providerAlias:$,id:e,type:E});(await fetch(`/api/models/custom?${t}`,{method:"DELETE"})).ok&&(await T(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("delete custom model error:",e)}},I=async e=>{g(t=>new Set(t).add(e));try{let r=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${$}/${e}`,kind:t})}),s=await r.json();b(t=>({...t,[e]:s.ok?"ok":"error"})),N(t=>({...t,[e]:s.ok?"":s.error||"Model not reachable"}))}catch{b(t=>({...t,[e]:"error"})),N(t=>({...t,[e]:"Network error"}))}finally{g(t=>{let r=new Set(t);return r.delete(e),r})}},L=(0,u.KC)(e),M=t?L.filter(e=>e.kinds?e.kinds.includes(t):(e.type||"llm")===t):L,D=p.filter(e=>e.providerAlias===$&&(e.type||"llm")===E&&!M.some(t=>t.id===e.id)),U=(0,l.useMemo)(()=>{let e={};for(let[t,r]of Object.entries(n))r in e||(e[r]=t);return e},[n]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(i.Zp,{children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,s.jsxs)("h2",{className:"text-lg font-semibold",children:["Models",t?` — ${t.toUpperCase()}`:""]})}),Object.values(y).some(Boolean)&&(0,s.jsx)("div",{className:"mb-3 space-y-1",children:Object.entries(y).filter(([,e])=>!!e).map(([e,t])=>(0,s.jsxs)("p",{className:"break-words text-xs text-red-500",children:[e,": ",t]},e))}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-3",children:[M.map(e=>{let t=U[`${$}/${e.id}`];return(0,s.jsx)(v,{model:e,fullModel:`${$}/${e.id}`,alias:t,copied:a,onCopy:o,onSetAlias:t=>R(e.id,t),onDeleteAlias:()=>O(t),testStatus:h[e.id],onTest:S.length>0?()=>I(e.id):void 0,isTesting:f.has(e.id),isFree:e.isFree},e.id)}),D.map(e=>(0,s.jsx)(v,{model:{id:e.id,name:e.name},fullModel:`${$}/${e.id}`,copied:a,onCopy:o,onSetAlias:()=>{},onDeleteAlias:()=>P(e.id),testStatus:h[e.id],onTest:S.length>0?()=>I(e.id):void 0,isTesting:f.has(e.id),isCustom:!0},`${e.id}-${e.type}`)),(0,s.jsxs)("button",{onClick:()=>C(!0),className:"flex items-center gap-1.5 px-3 py-2 rounded-lg border border-dashed border-black/15 dark:border-white/15 text-xs text-text-muted hover:text-primary hover:border-primary/40 transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]})]})]}),(0,s.jsx)(j,{isOpen:k,onSave:async e=>{await A(e),C(!1)},onClose:()=>C(!1)})]})}b.propTypes={until:x().string.isRequired},f.propTypes={connection:x().shape({id:x().string,name:x().string,email:x().string,displayName:x().string,testStatus:x().string,isActive:x().bool,lastError:x().string,priority:x().number}).isRequired,proxyPools:x().array,isOAuth:x().bool.isRequired,isFirst:x().bool.isRequired,isLast:x().bool.isRequired,onMoveUp:x().func.isRequired,onMoveDown:x().func.isRequired,onToggleActive:x().func.isRequired,onUpdateProxy:x().func,onEdit:x().func.isRequired,onDelete:x().func.isRequired},g.propTypes={isOpen:x().bool.isRequired,provider:x().string,providerName:x().string,proxyPools:x().array,onSave:x().func.isRequired,onClose:x().func.isRequired},y.propTypes={providerId:x().string.isRequired,isOAuth:x().bool},v.propTypes={model:x().shape({id:x().string.isRequired}).isRequired,fullModel:x().string.isRequired,copied:x().string,onCopy:x().func.isRequired,testStatus:x().oneOf(["ok","error"]),isCustom:x().bool,isFree:x().bool,onDeleteAlias:x().func,onTest:x().func,isTesting:x().bool},j.propTypes={isOpen:x().bool.isRequired,onSave:x().func.isRequired,onClose:x().func.isRequired},w.propTypes={providerId:x().string.isRequired,kindFilter:x().string,providerAliasOverride:x().string};let N={"google-tts":{hasLanguageDropdown:!1,hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"hardcoded"},openai:{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"openai-tts-models",voiceKey:"openai-tts-voices",voicesPerModel:!0},openrouter:{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"openrouter-tts-models",voiceKey:"openrouter-tts-voices",voicesPerModel:!0},elevenlabs:{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",modelKey:"elevenlabs-tts-models",apiEndpoint:"/api/media-providers/tts/elevenlabs/voices"},"edge-tts":{hasLanguageDropdown:!1,hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"api-language"},"local-device":{hasLanguageDropdown:!1,hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"api-language"},nvidia:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},hyperbolic:{hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"config"},deepgram:{hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/deepgram/voices"},huggingface:{hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"config"},cartesia:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},playht:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},coqui:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},tortoise:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},inworld:{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",modelKey:"inworld-tts-models",apiEndpoint:"/api/media-providers/tts/inworld/voices"},qwen:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},minimax:{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/minimax/voices",defaultVoiceId:"English_expressive_narrator"},"minimax-cn":{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/minimax/voices?provider=minimax-cn",defaultVoiceId:"English_expressive_narrator"},gemini:{hasLanguageDropdown:!1,hasLanguageHint:!0,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"gemini-tts-models",voiceKey:"gemini-tts-voices",voicesPerModel:!0}};var k=r(717),C=r(91781),S=r(62199);let _=new Set(["done","failed","completed","error","expired","cancelled"]),$=new Set(["failed","error","expired","cancelled"]);async function E({requestId:e,connectionId:t,signal:r,fetchImpl:s=fetch,pollIntervalMs:a=3e3,timeoutMs:o=6e5,onProgress:n}){if(!e)throw Error("Video response did not include a request id");let l=(0,S.x)(String(e));if(!l)throw Error("Video response included an invalid request id");let i=Date.now()+o;for(;Date.now()<=i;){if(r?.aborted)throw new DOMException("Video polling aborted","AbortError");let e={Accept:"application/json"};t&&(e["x-connection-id"]=t);let o=await s(l,{method:"GET",headers:e,signal:r}),i=await o.json().catch(()=>({}));if(o.ok){let e=String(i?.status||"pending").toLowerCase();if(n?.({status:e,progress:i?.progress}),$.has(e)){let e=i?.error?.message||i?.error||"Video generation failed";throw Error("string"==typeof e?e:JSON.stringify(e))}if(_.has(e))return i}else if(429!==o.status&&503!==o.status){let e=i?.error?.message||i?.error||`Video polling failed (HTTP ${o.status})`;throw Error("string"==typeof e?e:JSON.stringify(e))}await function(e,t){return new Promise((r,s)=>{let a=()=>{clearTimeout(o),s(new DOMException("Video polling aborted","AbortError"))},o=setTimeout(()=>{t?.removeEventListener("abort",a),r()},e);t?.addEventListener("abort",a,{once:!0})})}(a,r)}throw Error("Timed out while waiting for the video job")}function T({label:e,children:t}){return(0,s.jsxs)("div",{className:"flex min-w-0 flex-col gap-1.5 sm:flex-row sm:items-center sm:gap-3",children:[(0,s.jsx)("span",{className:"w-full text-xs font-medium text-text-muted sm:w-20 sm:shrink-0",children:e}),(0,s.jsx)("div",{className:"w-full min-w-0 flex-1",children:t})]})}let R=`// Audio will appear here after running.
2
2
  // Example JSON response (response_format=json):
3
3
  {
4
4
  "format": "mp3",
5
5
  "audio": "//NExAANaAIIAUAAANNNNNNNN..." // base64 encoded MP3
6
- }`,A=`{
6
+ }`,O=`{
7
7
  "object": "list",
8
8
  "data": [{
9
9
  "object": "embedding",
@@ -12,7 +12,7 @@
12
12
  }],
13
13
  "model": "...",
14
14
  "usage": { "prompt_tokens": 9, "total_tokens": 9 }
15
- }`,O="https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png";function P(e){let t="string"==typeof e?e.trim():"";return t?/^(data:image\/|https?:\/\/)/i.test(t)?t:`data:image/png;base64,${t}`:""}let I={webSearch:{inputLabel:"Query",inputPlaceholder:"What is the latest news about AI?",defaultInput:"What is the latest news about AI?",bodyKey:"query",defaultResponse:`{
15
+ }`,A="https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png";function P(e){let t="string"==typeof e?e.trim():"";return t?/^(data:image\/|https?:\/\/)/i.test(t)?t:`data:image/png;base64,${t}`:""}let I={webSearch:{inputLabel:"Query",inputPlaceholder:"What is the latest news about AI?",defaultInput:"What is the latest news about AI?",bodyKey:"query",defaultResponse:`{
16
16
  "results": [
17
17
  { "title": "...", "url": "...", "snippet": "..." }
18
18
  ]
@@ -34,19 +34,19 @@
34
34
  "data": [
35
35
  { "url": "...", "format": "mp3" }
36
36
  ]
37
- }`}};function L({providerId:e,customAlias:t}){let r=(0,c.gC)(e),a=r?t||e:(0,c.wG)(e),o=r?[]:(0,u.KC)(e).filter(e=>"embedding"===e.type),[n,d]=(0,l.useState)(o[0]?.id??""),[p,x]=(0,l.useState)("The quick brown fox jumps over the lazy dog"),[h,b]=(0,l.useState)(""),[f,g]=(0,l.useState)(""),[y,v]=(0,l.useState)(!1),[j,w]=(0,l.useState)(""),[N,k]=(0,l.useState)(""),[C,_]=(0,l.useState)(null),[$,E]=(0,l.useState)(!1),[R,O]=(0,l.useState)(""),{copied:P,copy:I}=(0,m.C)(),{copied:M,copy:D}=(0,m.C)();(0,l.useEffect)(()=>{w(window.location.origin),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&k(e.publicUrl)}).catch(()=>{})},[]);let U=y?N:j,K=n?`${a}/${n}`:"",B=()=>{let e={model:K,input:p.trim()},t=Number(h);return h&&Number.isFinite(t)&&t>0&&(e.dimensions=t),e},F=`curl -X POST ${U}/v1/embeddings \\
37
+ }`}};function L({providerId:e,customAlias:t}){let r=(0,c.gC)(e),a=r?t||e:(0,c.wG)(e),o=r?[]:(0,u.KC)(e).filter(e=>"embedding"===e.type),[n,d]=(0,l.useState)(o[0]?.id??""),[p,x]=(0,l.useState)("The quick brown fox jumps over the lazy dog"),[h,b]=(0,l.useState)(""),[f,g]=(0,l.useState)(""),[y,v]=(0,l.useState)(!1),[j,w]=(0,l.useState)(""),[N,k]=(0,l.useState)(""),[C,_]=(0,l.useState)(null),[$,E]=(0,l.useState)(!1),[R,A]=(0,l.useState)(""),{copied:P,copy:I}=(0,m.C)(),{copied:M,copy:D}=(0,m.C)();(0,l.useEffect)(()=>{w(window.location.origin),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&k(e.publicUrl)}).catch(()=>{})},[]);let U=y?N:j,K=n?`${a}/${n}`:"",B=()=>{let e={model:K,input:p.trim()},t=Number(h);return h&&Number.isFinite(t)&&t>0&&(e.dimensions=t),e},F=`curl -X POST ${U}/v1/embeddings \\
38
38
  -H "Content-Type: application/json" \\
39
39
  -H "Authorization: Bearer ${f||"YOUR_KEY"}" \\
40
- -d '${JSON.stringify(B())}'`,q=async()=>{if(!p.trim()||!K)return;E(!0),O(""),_(null);let e=Date.now();try{let t={"Content-Type":"application/json"};f&&(t.Authorization=`Bearer ${f}`);let r=await fetch((0,S.O)("/v1/embeddings"),{method:"POST",headers:t,body:JSON.stringify(B())}),s=Date.now()-e,a=await r.json().catch(()=>null);if(!r.ok)return void O(a?.error?.message||a?.error||`HTTP ${r.status}`);if(null==a)return void O("Invalid response from server");_({data:a,latencyMs:s})}catch(e){O(e.message||"Network error")}finally{E(!1)}},J=C?JSON.stringify(C.data,null,2):"";return(0,s.jsxs)(i.Zp,{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Example"}),(0,s.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,s.jsx)(T,{label:"Model",children:r?(0,s.jsx)("input",{value:n,onChange:e=>d(e.target.value),placeholder:"e.g. voyage-3, embed-english-v3.0, text-embedding-3-small",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"}):(0,s.jsx)("select",{value:n,onChange:e=>d(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:o.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),(0,s.jsx)(T,{label:"Endpoint",children:(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsx)("input",{value:U,onChange:e=>y?k(e.target.value):w(e.target.value),className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono",placeholder:"http://localhost:3000"}),N&&(0,s.jsxs)("button",{onClick:()=>v(e=>!e),title:y?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${y?"border-primary/40 bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"wifi_tethering"}),"Tunnel"]})]})}),(0,s.jsx)(T,{label:"API Key",children:(0,s.jsx)("input",{type:"password",value:f,onChange:e=>g(e.target.value),placeholder:"sk-...",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}),(0,s.jsx)(T,{label:"Input",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:p,onChange:e=>x(e.target.value),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),p&&(0,s.jsx)("button",{type:"button",onClick:()=>x(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})}),(0,s.jsx)(T,{label:"Dimensions",children:(0,s.jsx)("input",{type:"number",min:"1",value:h,onChange:e=>b(e.target.value),placeholder:"optional, e.g. 512, 1024 (leave empty for default)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),(0,s.jsxs)("div",{className:"mt-1",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsxs)("button",{onClick:()=>I(F),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:P?"check":"content_copy"}),P?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:q,disabled:$||!p.trim()||!K,className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:$?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),$?"Running...":"Run"]})]})]}),(0,s.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:F})]}),R&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:R}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsxs)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["Response ",C&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",C.latencyMs,"ms"]})]}),C&&(0,s.jsxs)("button",{onClick:()=>D(J),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:M?"check":"content_copy"}),M?"Copied":"Copy"]})]}),(0,s.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all opacity-70",children:(e=>{if(!e)return A;let t=JSON.parse(JSON.stringify(e));return(t.data||[]).forEach(e=>{Array.isArray(e.embedding)&&e.embedding.length>4&&(e.embedding=[...e.embedding.slice(0,4).map(e=>parseFloat(e.toFixed(6))),`... (${e.embedding.length} dims)`])}),JSON.stringify(t,null,2)})(C?.data)})]})]})]})}function M({providerId:e}){let t,r=(0,c.wG)(e),a=N[e]||N["edge-tts"],[o,n]=(0,l.useState)(a.defaultVoiceId||""),[d,p]=(0,l.useState)(""),[x,h]=(0,l.useState)(a.defaultVoiceId||""),[b,f]=(0,l.useState)([]),[g,y]=(0,l.useState)(""),[v,j]=(0,l.useState)(()=>{let t=c.Q2[e]?.ttsConfig?.models;if(t?.length)return t[0].id;if(a.hasModelSelector&&a.modelKey){let e=(0,u.KC)(a.modelKey);return e?.[0]?.id||""}return""}),[w,_]=(0,l.useState)("Hello, this is a text to speech test."),[$,E]=(0,l.useState)(!1),[A,O]=(0,l.useState)(""),[P,I]=(0,l.useState)(""),[L,D]=(0,l.useState)("mp3"),[U,K]=(0,l.useState)(""),[B,F]=(0,l.useState)(null),[q,J]=(0,l.useState)(!1),[V,z]=(0,l.useState)(""),[H,G]=(0,l.useState)(null),{copied:W,copy:Y}=(0,m.C)(),Q=(0,l.useRef)("");(0,l.useEffect)(()=>()=>{if(Q.current)try{URL.revokeObjectURL(Q.current)}catch{}},[]);let[Z,X]=(0,l.useState)(!1),[ee,et]=(0,l.useState)([]),[er,es]=(0,l.useState)(!1),[ea,eo]=(0,l.useState)(""),[en,el]=(0,l.useState)(""),[ei,ed]=(0,l.useState)({}),[ec,eu]=(0,l.useState)("");(0,l.useEffect)(()=>{if(O(window.location.origin),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&I(e.publicUrl)}).catch(()=>{}),"hardcoded"===a.voiceSource){let t=a.hasModelSelector&&a.modelKey&&(0,u.KC)(a.modelKey)?.[0]?.id||"",r=a.voicesPerModel&&t?(0,k.jY)(e,t)||[]:(0,u.KC)(a.voiceKey||e).filter(e=>"tts"===e.type);if(r.length)if(a.hasBrowseButton){let e=r.find(e=>"en"===e.id)||r[0];y(e.id),n(e.id),p(e.name),f([{id:e.id,name:e.name}])}else f(r),n(r[0].id),p(r[0].name||r[0].id)}},[e]),(0,l.useEffect)(()=>{if(!a.voicesPerModel||!v)return;let t=(0,k.jY)(e,v)||[];f(t),t.length&&(n(t[0].id),p(t[0].name||t[0].id))},[v]);let em=async()=>{if(X(!0),eo(""),el(""),!ee.length){es(!0);try{if("hardcoded"===a.voiceSource){let t=a.voiceKey||e,r=(0,u.KC)(t).filter(e=>"tts"===e.type),s={};for(let e of r)s[e.id]||(s[e.id]={code:e.id,name:e.name,voices:[{id:e.id,name:e.name}]});ed(s),et(Object.values(s).sort((e,t)=>e.name.localeCompare(t.name)))}else{let t=a.apiEndpoint?a.apiEndpoint:`/api/media-providers/tts/voices?provider=${"local-device"===e?"local-device":"edge-tts"}`,r=await fetch(t),s=await r.json();if(s.error)return void el(s.error);et(s.languages||[]),ed(s.byLang||{})}}catch(e){el(e.message)}finally{es(!1)}}},ep=ea?ee.filter(e=>e.name.toLowerCase().includes(ea.toLowerCase())||e.code.toLowerCase().includes(ea.toLowerCase())):ee,ex=$?P:A,eh=a.hasVoiceIdInput&&x||o,eb=a.hasModelSelector&&v&&eh?`${r}/${v}/${eh}`:a.hasModelSelector&&v?`${r}/${v}`:eh?`${r}/${eh}`:"",ef=(t={model:eb,input:w},a.hasLanguageHint&&ec&&(t.language=ec),t),eg=`curl -X POST ${ex}/v1/audio/speech${"json"===L?"?response_format=json":""} \\
40
+ -d '${JSON.stringify(B())}'`,q=async()=>{if(!p.trim()||!K)return;E(!0),A(""),_(null);let e=Date.now();try{let t={"Content-Type":"application/json"};f&&(t.Authorization=`Bearer ${f}`);let r=await fetch((0,S.O)("/v1/embeddings"),{method:"POST",headers:t,body:JSON.stringify(B())}),s=Date.now()-e,a=await r.json().catch(()=>null);if(!r.ok)return void A(a?.error?.message||a?.error||`HTTP ${r.status}`);if(null==a)return void A("Invalid response from server");_({data:a,latencyMs:s})}catch(e){A(e.message||"Network error")}finally{E(!1)}},J=C?JSON.stringify(C.data,null,2):"";return(0,s.jsxs)(i.Zp,{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Example"}),(0,s.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,s.jsx)(T,{label:"Model",children:r?(0,s.jsx)("input",{value:n,onChange:e=>d(e.target.value),placeholder:"e.g. voyage-3, embed-english-v3.0, text-embedding-3-small",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"}):(0,s.jsx)("select",{value:n,onChange:e=>d(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:o.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),(0,s.jsx)(T,{label:"Endpoint",children:(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsx)("input",{value:U,onChange:e=>y?k(e.target.value):w(e.target.value),className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono",placeholder:"http://localhost:3000"}),N&&(0,s.jsxs)("button",{onClick:()=>v(e=>!e),title:y?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${y?"border-primary/40 bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"wifi_tethering"}),"Tunnel"]})]})}),(0,s.jsx)(T,{label:"API Key",children:(0,s.jsx)("input",{type:"password",value:f,onChange:e=>g(e.target.value),placeholder:"sk-...",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}),(0,s.jsx)(T,{label:"Input",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:p,onChange:e=>x(e.target.value),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),p&&(0,s.jsx)("button",{type:"button",onClick:()=>x(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})}),(0,s.jsx)(T,{label:"Dimensions",children:(0,s.jsx)("input",{type:"number",min:"1",value:h,onChange:e=>b(e.target.value),placeholder:"optional, e.g. 512, 1024 (leave empty for default)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),(0,s.jsxs)("div",{className:"mt-1",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsxs)("button",{onClick:()=>I(F),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:P?"check":"content_copy"}),P?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:q,disabled:$||!p.trim()||!K,className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:$?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),$?"Running...":"Run"]})]})]}),(0,s.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:F})]}),R&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:R}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsxs)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["Response ",C&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",C.latencyMs,"ms"]})]}),C&&(0,s.jsxs)("button",{onClick:()=>D(J),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:M?"check":"content_copy"}),M?"Copied":"Copy"]})]}),(0,s.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all opacity-70",children:(e=>{if(!e)return O;let t=JSON.parse(JSON.stringify(e));return(t.data||[]).forEach(e=>{Array.isArray(e.embedding)&&e.embedding.length>4&&(e.embedding=[...e.embedding.slice(0,4).map(e=>parseFloat(e.toFixed(6))),`... (${e.embedding.length} dims)`])}),JSON.stringify(t,null,2)})(C?.data)})]})]})]})}function M({providerId:e}){let t,r=(0,c.wG)(e),a=N[e]||N["edge-tts"],[o,n]=(0,l.useState)(a.defaultVoiceId||""),[d,p]=(0,l.useState)(""),[x,h]=(0,l.useState)(a.defaultVoiceId||""),[b,f]=(0,l.useState)([]),[g,y]=(0,l.useState)(""),[v,j]=(0,l.useState)(()=>{let t=c.Q2[e]?.ttsConfig?.models;if(t?.length)return t[0].id;if(a.hasModelSelector&&a.modelKey){let e=(0,u.KC)(a.modelKey);return e?.[0]?.id||""}return""}),[w,_]=(0,l.useState)("Hello, this is a text to speech test."),[$,E]=(0,l.useState)(!1),[O,A]=(0,l.useState)(""),[P,I]=(0,l.useState)(""),[L,D]=(0,l.useState)("mp3"),[U,K]=(0,l.useState)(""),[B,F]=(0,l.useState)(null),[q,J]=(0,l.useState)(!1),[V,z]=(0,l.useState)(""),[H,G]=(0,l.useState)(null),{copied:W,copy:Y}=(0,m.C)(),Q=(0,l.useRef)("");(0,l.useEffect)(()=>()=>{if(Q.current)try{URL.revokeObjectURL(Q.current)}catch{}},[]);let[Z,X]=(0,l.useState)(!1),[ee,et]=(0,l.useState)([]),[er,es]=(0,l.useState)(!1),[ea,eo]=(0,l.useState)(""),[en,el]=(0,l.useState)(""),[ei,ed]=(0,l.useState)({}),[ec,eu]=(0,l.useState)("");(0,l.useEffect)(()=>{if(A(window.location.origin),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&I(e.publicUrl)}).catch(()=>{}),"hardcoded"===a.voiceSource){let t=a.hasModelSelector&&a.modelKey&&(0,u.KC)(a.modelKey)?.[0]?.id||"",r=a.voicesPerModel&&t?(0,k.jY)(e,t)||[]:(0,u.KC)(a.voiceKey||e).filter(e=>"tts"===e.type);if(r.length)if(a.hasBrowseButton){let e=r.find(e=>"en"===e.id)||r[0];y(e.id),n(e.id),p(e.name),f([{id:e.id,name:e.name}])}else f(r),n(r[0].id),p(r[0].name||r[0].id)}},[e]),(0,l.useEffect)(()=>{if(!a.voicesPerModel||!v)return;let t=(0,k.jY)(e,v)||[];f(t),t.length&&(n(t[0].id),p(t[0].name||t[0].id))},[v]);let em=async()=>{if(X(!0),eo(""),el(""),!ee.length){es(!0);try{if("hardcoded"===a.voiceSource){let t=a.voiceKey||e,r=(0,u.KC)(t).filter(e=>"tts"===e.type),s={};for(let e of r)s[e.id]||(s[e.id]={code:e.id,name:e.name,voices:[{id:e.id,name:e.name}]});ed(s),et(Object.values(s).sort((e,t)=>e.name.localeCompare(t.name)))}else{let t=a.apiEndpoint?a.apiEndpoint:`/api/media-providers/tts/voices?provider=${"local-device"===e?"local-device":"edge-tts"}`,r=await fetch(t),s=await r.json();if(s.error)return void el(s.error);et(s.languages||[]),ed(s.byLang||{})}}catch(e){el(e.message)}finally{es(!1)}}},ep=ea?ee.filter(e=>e.name.toLowerCase().includes(ea.toLowerCase())||e.code.toLowerCase().includes(ea.toLowerCase())):ee,ex=$?P:O,eh=a.hasVoiceIdInput&&x||o,eb=a.hasModelSelector&&v&&eh?`${r}/${v}/${eh}`:a.hasModelSelector&&v?`${r}/${v}`:eh?`${r}/${eh}`:"",ef=(t={model:eb,input:w},a.hasLanguageHint&&ec&&(t.language=ec),t),eg=`curl -X POST ${ex}/v1/audio/speech${"json"===L?"?response_format=json":""} \\
41
41
  -H "Content-Type: application/json" \\
42
42
  -H "Authorization: Bearer YOUR_KEY" \\
43
43
  -d '${JSON.stringify(ef)}' \\
44
- ${"json"===L?"":"--output speech.mp3"}`,ey=async()=>{if(!w.trim()||!eb)return;if(J(!0),z(""),Q.current){try{URL.revokeObjectURL(Q.current)}catch{}Q.current=""}K(""),F(null);let e=Date.now();try{let t=(0,S.O)(`/v1/audio/speech${"json"===L?"?response_format=json":""}`),r=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...ef,input:w.trim()})});if(G(Date.now()-e),!r.ok){let e=await r.json().catch(()=>({}));z(e?.error?.message||e?.error||`HTTP ${r.status}`);return}if("json"===L){let e=await r.json().catch(()=>null);if(!e||"string"!=typeof e.audio||!e.audio)return void z(e?.error?.message||e?.error||"TTS response did not include audio data");F(e);let t=await fetch(`data:audio/mp3;base64,${e.audio}`).then(e=>e.blob()),s=URL.createObjectURL(t);Q.current=s,K(s)}else{let e=await r.blob(),t=URL.createObjectURL(e);Q.current=t,K(t)}}catch(e){z(e.message||"Network error")}finally{J(!1)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(i.Zp,{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Example"}),(0,s.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,s.jsx)(T,{label:"Endpoint",children:(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsxs)("span",{className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate",children:[ex,"/v1/audio/speech"]}),P&&(0,s.jsxs)("button",{onClick:()=>E(e=>!e),title:$?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${$?"border-primary/40 bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"wifi_tethering"}),"Tunnel"]})]})}),(0,s.jsx)(T,{label:"API Key",children:(0,s.jsx)("span",{className:"px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate block",children:(0,s.jsx)("span",{className:"text-text-muted italic",children:"Dashboard session (server-side)"})})}),a.hasModelSelector&&(a.modelKey||c.Q2[e]?.ttsConfig?.models?.length)&&(0,s.jsx)(T,{label:"Model",children:(0,s.jsx)("select",{value:v,onChange:e=>j(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:((c.Q2[e]?.ttsConfig?.models?.length?c.Q2[e].ttsConfig.models:(0,u.KC)(a.modelKey))||[]).map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),a.hasLanguageHint&&(0,s.jsx)(T,{label:"Language",children:(0,s.jsxs)("select",{value:ec,onChange:e=>eu(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"",children:"Auto-detect"}),C.I.map(e=>(0,s.jsx)("option",{value:e.name,children:e.name},e.id))]})}),a.hasBrowseButton&&(0,s.jsx)(T,{label:"Language",children:(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsx)("button",{onClick:em,className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm border border-border rounded-lg bg-background font-mono truncate text-left hover:border-primary/40 transition-colors",children:g?(0,s.jsx)("span",{className:"text-text-main",children:ee.find(e=>e.code===g)?.name||g}):(0,s.jsx)("span",{className:"text-text-muted",children:"No language selected"})}),(0,s.jsxs)("button",{onClick:em,className:"flex w-full items-center justify-center gap-1 text-xs px-2.5 py-1.5 rounded-lg border border-border text-text-muted hover:text-primary hover:border-primary/40 transition-colors sm:w-auto sm:shrink-0",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"language"}),"Select language"]})]})}),b.length>0&&(0,s.jsx)(T,{label:"Voice",children:(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:b.map(e=>(0,s.jsxs)("button",{onClick:()=>{n(e.id),p(e.name),a.hasVoiceIdInput&&h(e.id)},className:`px-2.5 py-1 rounded-full text-xs border transition-colors ${o===e.id?"bg-primary/15 border-primary/40 text-primary font-medium":"border-border text-text-muted hover:text-primary hover:border-primary/40"}`,children:[e.name,e.gender?` \xb7 ${e.gender[0].toUpperCase()}`:"",!0===e.free_users_allowed&&(0,s.jsx)("span",{className:"ml-1.5 px-1 py-0.5 text-[9px] font-semibold rounded bg-green-500/15 text-green-600 border border-green-500/20",children:"Free"}),!1===e.free_users_allowed&&(0,s.jsx)("span",{className:"ml-1.5 px-1 py-0.5 text-[9px] font-semibold rounded bg-amber-500/15 text-amber-600 border border-amber-500/20",children:"Paid"})]},e.id))})}),a.hasVoiceIdInput&&(0,s.jsx)(T,{label:"Voice ID",children:(0,s.jsx)("div",{className:"flex flex-col gap-1",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:x,onChange:e=>{h(e.target.value),n(e.target.value)},placeholder:"e.g. CwhRBWXzGAHq8TQ4Fs17",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"}),x&&(0,s.jsx)("button",{type:"button",onClick:()=>{h(""),n("")},className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})})}),a.hasLanguageDropdown&&(0,s.jsx)(T,{label:"Language",children:(0,s.jsx)("select",{value:o,onChange:t=>{let r=(0,u.KC)(e).filter(e=>"tts"===e.type).find(e=>e.id===t.target.value);n(t.target.value),p(r?.name||t.target.value)},className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:(0,u.KC)(e).filter(e=>"tts"===e.type).map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),(0,s.jsx)(T,{label:"Input",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:w,onChange:e=>_(e.target.value),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),w&&(0,s.jsx)("button",{type:"button",onClick:()=>_(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})}),(0,s.jsx)(T,{label:"Output Format",children:(0,s.jsxs)("select",{value:L,onChange:e=>D(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"mp3",children:"MP3 (Binary)"}),(0,s.jsx)("option",{value:"json",children:"JSON (Base64)"})]})}),(0,s.jsxs)("div",{className:"mt-1",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsxs)("button",{onClick:()=>Y(eg),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:W?"check":"content_copy"}),W?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:ey,disabled:q||!w.trim()||!eb,className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:q?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),q?"Generating...":"Run"]})]})]}),(0,s.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:eg})]}),V&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:V}),U?(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsxs)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["Response ",H&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",H,"ms"]})]}),(0,s.jsxs)("a",{href:U,download:"speech.mp3",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})]}),(0,s.jsx)("audio",{controls:!0,src:U,className:"w-full"}),B&&(0,s.jsxs)("div",{className:"mt-3",children:[(0,s.jsx)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"JSON Response"})}),(0,s.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:JSON.stringify({format:B.format,audio:B.audio?`${B.audio.substring(0,100)}...`:""},null,2)})]})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Response"}),(0,s.jsx)("pre",{className:"mt-1.5 bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all opacity-50",children:R})]})]})]}),Z&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-end justify-center sm:items-center",style:{backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(2px)"},onClick:()=>X(!1),children:(0,s.jsxs)("div",{className:"border border-border rounded-xl shadow-2xl w-full max-w-md mx-4 flex flex-col max-h-[80vh]",style:{backgroundColor:"var(--color-bg)",isolation:"isolate"},onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border shrink-0 rounded-t-xl",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold",children:"Select Language"}),(0,s.jsx)("button",{onClick:()=>X(!1),className:"text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,s.jsx)("div",{className:"px-4 py-2.5 border-b border-border shrink-0",children:(0,s.jsx)("input",{autoFocus:!0,value:ea,onChange:e=>eo(e.target.value),placeholder:"Search language...",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),(0,s.jsxs)("div",{className:"overflow-y-auto flex-1 p-2",children:[en&&(0,s.jsx)("p",{className:"text-xs text-red-500 px-2 py-1",children:en}),er?(0,s.jsx)("p",{className:"text-xs text-text-muted px-2 py-3",children:"Loading..."}):(0,s.jsxs)("div",{className:"flex flex-col gap-0.5",children:[ep.map(e=>(0,s.jsxs)("button",{onClick:()=>{let t;return X(!1),y(e.code),void(f(t=ei[e.code]?.voices||[]),t.length&&(n(t[0].id),p(t[0].name),a.hasVoiceIdInput&&h(t[0].id)))},className:`flex items-center justify-between w-full px-3 py-2 rounded-lg text-left hover:bg-sidebar transition-colors ${g===e.code?"bg-primary/10 text-primary":""}`,children:[(0,s.jsx)("span",{className:"text-sm",children:e.name}),(0,s.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:[e.voices.length," voices"]}),g===e.code&&(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"check"})]})]},e.code)),0===ep.length&&(0,s.jsx)("p",{className:"text-xs text-text-muted px-2 py-3",children:"No languages found."})]})]})]})})]})}function D({providerId:e,kind:t}){var r;let a=(0,c.wG)(e),o=(0,c.rs)(a)===e?a:e,n=c.rj.find(e=>e.id===t),d=I[t],p=d||{},x=(0,u.KC)(e).filter(e=>e.type===t),h=new Set(["image","video","music","imageToText"]).has(t),b=h&&0===x.length,[f,g]=(0,l.useState)(x[0]?.id??""),y=x.find(e=>e.id===f),v=!!y?.capabilities?.includes("edit"),j=!!y?.capabilities?.includes("mask"),[w,N]=(0,l.useState)(p.defaultInput||""),[k,C]=(0,l.useState)(""),[_,$]=(0,l.useState)(""),[R,A]=(0,l.useState)(()=>(p.extraFields||[]).reduce((e,t)=>(e[t.key]=t.default??"",e),{})),[L,M]=(0,l.useState)(!1),[U,K]=(0,l.useState)(""),[B,F]=(0,l.useState)(""),[q,J]=(0,l.useState)(null),[V,z]=(0,l.useState)(null),[H,G]=(0,l.useState)(null),[W,Y]=(0,l.useState)("json"),[Q,Z]=(0,l.useState)(""),[X,ee]=(0,l.useState)(!1),[et,er]=(0,l.useState)(""),[es,ea]=(0,l.useState)([]),[eo,en]=(0,l.useState)(""),{copied:el,copy:ei}=(0,m.C)(),{copied:ed,copy:ec}=(0,m.C)(),eu=(0,l.useRef)(null);if((0,l.useEffect)(()=>()=>{eu.current?.abort()},[]),(0,l.useEffect)(()=>{K(window.location.origin),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&F(e.publicUrl)}).catch(()=>{}),fetch("/api/providers/client").then(e=>e.json()).then(t=>{ea((t.connections||[]).filter(t=>t.provider===e&&!1!==t.isActive))}).catch(()=>{})},[e]),!n||!d)return null;let em=L?B:U,ep=n.endpoint.path,ex=h?f?`${o}/${f}`:b?"":o:o,eh="cloudflare-ai"!==e?{}:"@cf/runwayml/stable-diffusion-v1-5-img2img"===f?{image:O}:"@cf/runwayml/stable-diffusion-v1-5-inpainting"===f?{image:O,mask_image:"https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png"}:{},eb=k.trim()||eh.image||"",ef=_.trim()||eh.mask_image||"",eg=P(eb),ey=P(ef),ev=Object.entries(R).reduce((e,[t,r])=>(""===r||null==r||"number"==typeof r&&Number.isNaN(r)||(e[t]=r),e),{}),ej={model:ex,[d.bodyKey]:w,...d.extraBody,...ev,...v&&eb?{image:eb}:{},...j&&ef?{mask_image:ef}:{}},ew="image"===t&&"binary"===W,eN="image"===t&&"codex"===e&&!ew,ek=`${ep}${ew?"?response_format=binary":""}`,eC=(0,S.O)(ek),eS=`-H "Content-Type: application/json" \\
44
+ ${"json"===L?"":"--output speech.mp3"}`,ey=async()=>{if(!w.trim()||!eb)return;if(J(!0),z(""),Q.current){try{URL.revokeObjectURL(Q.current)}catch{}Q.current=""}K(""),F(null);let e=Date.now();try{let t=(0,S.O)(`/v1/audio/speech${"json"===L?"?response_format=json":""}`),r=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...ef,input:w.trim()})});if(G(Date.now()-e),!r.ok){let e=await r.json().catch(()=>({}));z(e?.error?.message||e?.error||`HTTP ${r.status}`);return}if("json"===L){let e=await r.json().catch(()=>null);if(!e||"string"!=typeof e.audio||!e.audio)return void z(e?.error?.message||e?.error||"TTS response did not include audio data");F(e);let t=await fetch(`data:audio/mp3;base64,${e.audio}`).then(e=>e.blob()),s=URL.createObjectURL(t);Q.current=s,K(s)}else{let e=await r.blob(),t=URL.createObjectURL(e);Q.current=t,K(t)}}catch(e){z(e.message||"Network error")}finally{J(!1)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(i.Zp,{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Example"}),(0,s.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,s.jsx)(T,{label:"Endpoint",children:(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsxs)("span",{className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate",children:[ex,"/v1/audio/speech"]}),P&&(0,s.jsxs)("button",{onClick:()=>E(e=>!e),title:$?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${$?"border-primary/40 bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"wifi_tethering"}),"Tunnel"]})]})}),(0,s.jsx)(T,{label:"API Key",children:(0,s.jsx)("span",{className:"px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate block",children:(0,s.jsx)("span",{className:"text-text-muted italic",children:"Dashboard session (server-side)"})})}),a.hasModelSelector&&(a.modelKey||c.Q2[e]?.ttsConfig?.models?.length)&&(0,s.jsx)(T,{label:"Model",children:(0,s.jsx)("select",{value:v,onChange:e=>j(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:((c.Q2[e]?.ttsConfig?.models?.length?c.Q2[e].ttsConfig.models:(0,u.KC)(a.modelKey))||[]).map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),a.hasLanguageHint&&(0,s.jsx)(T,{label:"Language",children:(0,s.jsxs)("select",{value:ec,onChange:e=>eu(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"",children:"Auto-detect"}),C.I.map(e=>(0,s.jsx)("option",{value:e.name,children:e.name},e.id))]})}),a.hasBrowseButton&&(0,s.jsx)(T,{label:"Language",children:(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsx)("button",{onClick:em,className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm border border-border rounded-lg bg-background font-mono truncate text-left hover:border-primary/40 transition-colors",children:g?(0,s.jsx)("span",{className:"text-text-main",children:ee.find(e=>e.code===g)?.name||g}):(0,s.jsx)("span",{className:"text-text-muted",children:"No language selected"})}),(0,s.jsxs)("button",{onClick:em,className:"flex w-full items-center justify-center gap-1 text-xs px-2.5 py-1.5 rounded-lg border border-border text-text-muted hover:text-primary hover:border-primary/40 transition-colors sm:w-auto sm:shrink-0",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"language"}),"Select language"]})]})}),b.length>0&&(0,s.jsx)(T,{label:"Voice",children:(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:b.map(e=>(0,s.jsxs)("button",{onClick:()=>{n(e.id),p(e.name),a.hasVoiceIdInput&&h(e.id)},className:`px-2.5 py-1 rounded-full text-xs border transition-colors ${o===e.id?"bg-primary/15 border-primary/40 text-primary font-medium":"border-border text-text-muted hover:text-primary hover:border-primary/40"}`,children:[e.name,e.gender?` \xb7 ${e.gender[0].toUpperCase()}`:"",!0===e.free_users_allowed&&(0,s.jsx)("span",{className:"ml-1.5 px-1 py-0.5 text-[9px] font-semibold rounded bg-green-500/15 text-green-600 border border-green-500/20",children:"Free"}),!1===e.free_users_allowed&&(0,s.jsx)("span",{className:"ml-1.5 px-1 py-0.5 text-[9px] font-semibold rounded bg-amber-500/15 text-amber-600 border border-amber-500/20",children:"Paid"})]},e.id))})}),a.hasVoiceIdInput&&(0,s.jsx)(T,{label:"Voice ID",children:(0,s.jsx)("div",{className:"flex flex-col gap-1",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:x,onChange:e=>{h(e.target.value),n(e.target.value)},placeholder:"e.g. CwhRBWXzGAHq8TQ4Fs17",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"}),x&&(0,s.jsx)("button",{type:"button",onClick:()=>{h(""),n("")},className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})})}),a.hasLanguageDropdown&&(0,s.jsx)(T,{label:"Language",children:(0,s.jsx)("select",{value:o,onChange:t=>{let r=(0,u.KC)(e).filter(e=>"tts"===e.type).find(e=>e.id===t.target.value);n(t.target.value),p(r?.name||t.target.value)},className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:(0,u.KC)(e).filter(e=>"tts"===e.type).map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),(0,s.jsx)(T,{label:"Input",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:w,onChange:e=>_(e.target.value),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),w&&(0,s.jsx)("button",{type:"button",onClick:()=>_(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})}),(0,s.jsx)(T,{label:"Output Format",children:(0,s.jsxs)("select",{value:L,onChange:e=>D(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"mp3",children:"MP3 (Binary)"}),(0,s.jsx)("option",{value:"json",children:"JSON (Base64)"})]})}),(0,s.jsxs)("div",{className:"mt-1",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsxs)("button",{onClick:()=>Y(eg),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:W?"check":"content_copy"}),W?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:ey,disabled:q||!w.trim()||!eb,className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:q?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),q?"Generating...":"Run"]})]})]}),(0,s.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:eg})]}),V&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:V}),U?(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsxs)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["Response ",H&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",H,"ms"]})]}),(0,s.jsxs)("a",{href:U,download:"speech.mp3",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})]}),(0,s.jsx)("audio",{controls:!0,src:U,className:"w-full"}),B&&(0,s.jsxs)("div",{className:"mt-3",children:[(0,s.jsx)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"JSON Response"})}),(0,s.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:JSON.stringify({format:B.format,audio:B.audio?`${B.audio.substring(0,100)}...`:""},null,2)})]})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Response"}),(0,s.jsx)("pre",{className:"mt-1.5 bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all opacity-50",children:R})]})]})]}),Z&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-end justify-center sm:items-center",style:{backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(2px)"},onClick:()=>X(!1),children:(0,s.jsxs)("div",{className:"border border-border rounded-xl shadow-2xl w-full max-w-md mx-4 flex flex-col max-h-[80vh]",style:{backgroundColor:"var(--color-bg)",isolation:"isolate"},onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border shrink-0 rounded-t-xl",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold",children:"Select Language"}),(0,s.jsx)("button",{onClick:()=>X(!1),className:"text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,s.jsx)("div",{className:"px-4 py-2.5 border-b border-border shrink-0",children:(0,s.jsx)("input",{autoFocus:!0,value:ea,onChange:e=>eo(e.target.value),placeholder:"Search language...",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),(0,s.jsxs)("div",{className:"overflow-y-auto flex-1 p-2",children:[en&&(0,s.jsx)("p",{className:"text-xs text-red-500 px-2 py-1",children:en}),er?(0,s.jsx)("p",{className:"text-xs text-text-muted px-2 py-3",children:"Loading..."}):(0,s.jsxs)("div",{className:"flex flex-col gap-0.5",children:[ep.map(e=>(0,s.jsxs)("button",{onClick:()=>{let t;return X(!1),y(e.code),void(f(t=ei[e.code]?.voices||[]),t.length&&(n(t[0].id),p(t[0].name),a.hasVoiceIdInput&&h(t[0].id)))},className:`flex items-center justify-between w-full px-3 py-2 rounded-lg text-left hover:bg-sidebar transition-colors ${g===e.code?"bg-primary/10 text-primary":""}`,children:[(0,s.jsx)("span",{className:"text-sm",children:e.name}),(0,s.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:[e.voices.length," voices"]}),g===e.code&&(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"check"})]})]},e.code)),0===ep.length&&(0,s.jsx)("p",{className:"text-xs text-text-muted px-2 py-3",children:"No languages found."})]})]})]})})]})}function D({providerId:e,kind:t}){var r;let a=(0,c.wG)(e),o=(0,c.rs)(a)===e?a:e,n=c.rj.find(e=>e.id===t),d=I[t],p=d||{},x=(0,u.KC)(e).filter(e=>e.type===t),h=new Set(["image","video","music","imageToText"]).has(t),b=h&&0===x.length,[f,g]=(0,l.useState)(x[0]?.id??""),y=x.find(e=>e.id===f),v=!!y?.capabilities?.includes("edit"),j=!!y?.capabilities?.includes("mask"),[w,N]=(0,l.useState)(p.defaultInput||""),[k,C]=(0,l.useState)(""),[_,$]=(0,l.useState)(""),[R,O]=(0,l.useState)(()=>(p.extraFields||[]).reduce((e,t)=>(e[t.key]=t.default??"",e),{})),[L,M]=(0,l.useState)(!1),[U,K]=(0,l.useState)(""),[B,F]=(0,l.useState)(""),[q,J]=(0,l.useState)(null),[V,z]=(0,l.useState)(null),[H,G]=(0,l.useState)(null),[W,Y]=(0,l.useState)("json"),[Q,Z]=(0,l.useState)(""),[X,ee]=(0,l.useState)(!1),[et,er]=(0,l.useState)(""),[es,ea]=(0,l.useState)([]),[eo,en]=(0,l.useState)(""),{copied:el,copy:ei}=(0,m.C)(),{copied:ed,copy:ec}=(0,m.C)(),eu=(0,l.useRef)(null);if((0,l.useEffect)(()=>()=>{eu.current?.abort()},[]),(0,l.useEffect)(()=>{K(window.location.origin),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&F(e.publicUrl)}).catch(()=>{}),fetch("/api/providers/client").then(e=>e.json()).then(t=>{ea((t.connections||[]).filter(t=>t.provider===e&&!1!==t.isActive))}).catch(()=>{})},[e]),!n||!d)return null;let em=L?B:U,ep=n.endpoint.path,ex=h?f?`${o}/${f}`:b?"":o:o,eh="cloudflare-ai"!==e?{}:"@cf/runwayml/stable-diffusion-v1-5-img2img"===f?{image:A}:"@cf/runwayml/stable-diffusion-v1-5-inpainting"===f?{image:A,mask_image:"https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png"}:{},eb=k.trim()||eh.image||"",ef=_.trim()||eh.mask_image||"",eg=P(eb),ey=P(ef),ev=Object.entries(R).reduce((e,[t,r])=>(""===r||null==r||"number"==typeof r&&Number.isNaN(r)||(e[t]=r),e),{}),ej={model:ex,[d.bodyKey]:w,...d.extraBody,...ev,...v&&eb?{image:eb}:{},...j&&ef?{mask_image:ef}:{}},ew="image"===t&&"binary"===W,eN="image"===t&&"codex"===e&&!ew,ek=`${ep}${ew?"?response_format=binary":""}`,eC=(0,S.O)(ek),eS=`-H "Content-Type: application/json" \\
45
45
  -H "Authorization: Bearer YOUR_KEY"${eo?` \\
46
46
  -H "x-connection-id: ${eo}"`:""}${eN?` \\
47
47
  -H "Accept: text/event-stream"`:""}`,e_=`curl -X ${n.endpoint.method} ${em}${ek} \\
48
48
  ${eS.replace(/\\\n /g,"\\\n ")} \\
49
- -d '${JSON.stringify(ej)}'${ew?" \\\n --output image.png":""}`,e$=async()=>{if(!eC)return void er("Not supported by this router build");if(!w.trim()||!ex)return;if(ee(!0),er(""),J(null),z(null),G(null),Q){try{URL.revokeObjectURL(Q)}catch{}Z("")}let e=Date.now();try{let r={"Content-Type":"application/json"};eo&&(r["x-connection-id"]=eo),eN&&(r.Accept="text/event-stream");let s={...ej,model:ex},a=await fetch(eC,{method:n.endpoint.method,headers:r,body:JSON.stringify(s)});if(!a.ok){let e=await a.json().catch(()=>({}));er(e?.error?.message||e?.error||`HTTP ${a.status}`);return}let o=a.headers.get("content-type")||"";if(o.startsWith("image/")){let t=await a.blob(),r=URL.createObjectURL(t);Z(r),J({data:{binary:!0,mime:o,size:t.size},latencyMs:Date.now()-e});return}if(o.includes("text/event-stream")&&a.body){let t=new AbortController;eu.current=t;let r=a.body.getReader(),s=()=>{r.cancel().catch(()=>{})};t.signal.addEventListener("abort",s,{once:!0});let o=new TextDecoder,n="",l=null,i=null;try{for(;;){let e;if(t.signal.aborted)return;let{done:s,value:a}=await r.read();if(s)break;for(n+=o.decode(a,{stream:!0});-1!==(e=n.indexOf("\n\n"));){let t=n.slice(0,e);n=n.slice(e+2);let r=null,s="";for(let e of t.split("\n"))e.startsWith("event:")?r=e.slice(6).trim():e.startsWith("data:")&&(s+=e.slice(5).trim());if(r)try{let e=s?JSON.parse(s):{};"progress"===r?z(e):"partial_image"===r?G(e):"done"===r?l=e:"error"===r&&(i=e?.message||"Stream error")}catch{}}}}catch(e){if(t.signal.aborted)return;throw e}finally{t.signal.removeEventListener("abort",s),eu.current===t&&(eu.current=null)}let d=Date.now()-e;if(i)return void er(i);l&&J({data:l,latencyMs:d})}else{let r=await a.json();if("video"===t&&r?.request_id){let t=new AbortController;eu.current=t;let s=a.headers.get("x-zevai-connection-id")||a.headers.get("x-connection-id")||eo;try{let a=await E({requestId:String(r.request_id),connectionId:s,signal:t.signal,onProgress:({status:e,progress:t})=>{z({stage:e,percent:t})}});J({data:{...r,...a,request_id:r.request_id},latencyMs:Date.now()-e})}finally{eu.current===t&&(eu.current=null)}return}let s=Date.now()-e;J({data:r,latencyMs:s})}}catch(e){if(e?.name==="AbortError")return;er(e.message||"Network error")}finally{ee(!1)}},eE=e=>{if(!e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(eE);let t={};for(let[r,s]of Object.entries(e))t[r]="b64_json"===r&&"string"==typeof s&&s.length>100?`<${s.length} chars base64>`:eE(s);return t},eT=q?JSON.stringify(eE(q.data),null,2):"",eR="video"===t?(r=q?.data,r?.video?.url||r?.video?.file_output?.public_url||r?.data?.[0]?.url||""):"";return(0,s.jsxs)(i.Zp,{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Example"}),(0,s.jsxs)("div",{className:"flex flex-col gap-2.5",children:[x.length>0?(0,s.jsx)(T,{label:"Model",children:(0,s.jsx)("select",{value:f,onChange:e=>g(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:x.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}):b?(0,s.jsx)(T,{label:"Model",children:(0,s.jsx)("input",{value:f,onChange:e=>g(e.target.value),placeholder:"Enter model id (provider-specific)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}):null,(0,s.jsx)(T,{label:"Endpoint",children:(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsxs)("span",{className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate",children:[em,ep]}),B&&(0,s.jsxs)("button",{onClick:()=>M(e=>!e),title:L?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${L?"border-primary/40 bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"wifi_tethering"}),"Tunnel"]})]})}),(0,s.jsx)(T,{label:"API Key",children:(0,s.jsx)("span",{className:"px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate block",children:(0,s.jsx)("span",{className:"text-text-muted italic",children:"Dashboard session (server-side)"})})}),es.length>0&&(0,s.jsx)(T,{label:"Connection",children:(0,s.jsxs)("select",{value:eo,onChange:e=>en(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"",children:"Auto (by priority)"}),es.map(e=>{let t=e.providerSpecificData?.chatgptPlanType,r=e.email||e.name||e.id.slice(0,8);return(0,s.jsxs)("option",{value:e.id,children:[r,t?` [${t}]`:""]},e.id)})]})}),(0,s.jsx)(T,{label:d.inputLabel,children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:w,onChange:e=>N(e.target.value),placeholder:d.inputPlaceholder,className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),w&&(0,s.jsx)("button",{type:"button",onClick:()=>N(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})}),v&&(0,s.jsx)(T,{label:"Ref Image (URL)",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:k,onChange:e=>C(e.target.value),placeholder:eh.image||"https://example.com/source.png",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),k&&(0,s.jsx)("button",{type:"button",onClick:()=>C(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),eg&&(0,s.jsx)("img",{src:eg,alt:"Reference",className:"max-h-40 rounded-lg border border-border object-contain bg-sidebar",onError:e=>{e.currentTarget.style.display="none"},onLoad:e=>{e.currentTarget.style.display="block"}})]})}),j&&(0,s.jsx)(T,{label:"Mask (URL)",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:_,onChange:e=>$(e.target.value),placeholder:eh.mask_image||"https://example.com/mask.png",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),_&&(0,s.jsx)("button",{type:"button",onClick:()=>$(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),ey&&(0,s.jsx)("img",{src:ey,alt:"Mask",className:"max-h-40 rounded-lg border border-border object-contain bg-sidebar",onError:e=>{e.currentTarget.style.display="none"},onLoad:e=>{e.currentTarget.style.display="block"}})]})}),(d.extraFields||[]).filter(e=>0===x.length||Array.isArray(y?.params)&&y.params.includes(e.key)).map(e=>(0,s.jsx)(T,{label:e.label,children:"select"===e.type?(0,s.jsx)("select",{value:R[e.key]??"",onChange:t=>A(r=>({...r,[e.key]:t.target.value})),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:(e.options||[]).map(e=>(0,s.jsx)("option",{value:e,children:""===e?"(default)":e},e))}):"text"===e.type?(0,s.jsx)("input",{type:"text",value:R[e.key]??"",placeholder:e.placeholder,onChange:t=>A(r=>({...r,[e.key]:t.target.value})),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}):(0,s.jsx)("input",{type:"number",value:R[e.key]??"",min:e.min,max:e.max,onChange:t=>A(r=>({...r,[e.key]:""===t.target.value?"":Number(t.target.value)})),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})},e.key)),"image"===t&&(0,s.jsx)(T,{label:"Output Format",children:(0,s.jsxs)("select",{value:W,onChange:e=>Y(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"json",children:"JSON (Base64)"}),(0,s.jsx)("option",{value:"binary",children:"Binary File"})]})}),(0,s.jsxs)("div",{className:"mt-1",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[eC&&(0,s.jsxs)("button",{onClick:()=>ei(e_),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:el?"check":"content_copy"}),el?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:e$,disabled:!eC||X||!w.trim()||!ex,title:eC?void 0:"Not supported by this router build",className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:X?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),eC?X?"Running...":"Run":"Unavailable"]})]})]}),eC?(0,s.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:e_}):(0,s.jsx)("div",{className:"rounded-lg border border-border bg-sidebar px-3 py-2.5 text-xs text-text-muted",children:"Not supported by this router build"})]}),(X||V)&&eN&&(0,s.jsxs)("div",{className:"flex flex-col gap-2 px-3 py-2 rounded-lg bg-sidebar border border-border sm:flex-row sm:items-center sm:gap-3",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",style:X?{animation:"spin 1s linear infinite"}:void 0,children:X?"progress_activity":"check_circle"}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:[V?.stage||"starting",!X&&V?.bytesReceived?` \xb7 ${(V.bytesReceived/1024).toFixed(1)} KB`:""]})]}),(X||V)&&"video"===t&&(0,s.jsxs)("div",{className:"flex flex-col gap-2 px-3 py-2 rounded-lg bg-sidebar border border-border sm:flex-row sm:items-center sm:gap-3",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",style:X?{animation:"spin 1s linear infinite"}:void 0,children:X?"progress_activity":"check_circle"}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:[V?.stage||"submitting",Number.isFinite(V?.percent)?` \xb7 ${V.percent}%`:""]})]}),H?.b64_json&&!q&&(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Partial preview"}),(0,s.jsx)("img",{src:`data:image/png;base64,${H.b64_json}`,alt:"Partial",className:"max-w-full rounded-lg border border-border mt-1.5 opacity-80"})]}),et&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:et}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsxs)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["Response ",q&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",q.latencyMs,"ms"]})]}),q&&(0,s.jsxs)("button",{onClick:()=>ec(eT),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:ed?"check":"content_copy"}),ed?"Copied":"Copy"]})]}),(0,s.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all opacity-70",children:q?eT:d.defaultResponse}),"image"===t&&(Q||q?.data?.data?.[0])&&(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,s.jsxs)("a",{href:Q||(q?.data?.data?.[0]?.b64_json?`data:image/png;base64,${q.data.data[0].b64_json}`:q?.data?.data?.[0]?.url||""),download:"image.png",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})}),(0,s.jsx)("img",{src:Q||(q?.data?.data?.[0]?.b64_json?`data:image/png;base64,${q.data.data[0].b64_json}`:q?.data?.data?.[0]?.url),alt:"Generated",className:"max-w-full rounded-lg border border-border"})]}),eR&&(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,s.jsxs)("a",{href:eR,download:"video.mp4",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})}),(0,s.jsx)("video",{controls:!0,src:eR,className:"max-w-full rounded-lg border border-border bg-black"})]})]})]})]})}function U({providerId:e}){let t=(0,c.wG)(e),r=(0,u.KC)(e).filter(e=>"stt"===e.type),[a,o]=(0,l.useState)([]),n=[...r,...a],[d,p]=(0,l.useState)(r[0]?.id??""),x=n.find(e=>e.id===d),h=Array.isArray(x?.params)?x.params:[],[b,f]=(0,l.useState)(null),[g,y]=(0,l.useState)(""),[v,j]=(0,l.useState)(""),[w,N]=(0,l.useState)("json"),[k,C]=(0,l.useState)(""),[_,$]=(0,l.useState)(!1),[E,R]=(0,l.useState)(""),[A,O]=(0,l.useState)(""),[P,I]=(0,l.useState)(null),[L,M]=(0,l.useState)(null),[D,K]=(0,l.useState)(!1),[B,F]=(0,l.useState)(""),{copied:q,copy:J}=(0,m.C)(),{copied:V,copy:z}=(0,m.C)();(0,l.useEffect)(()=>{R(window.location.origin),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&O(e.publicUrl)}).catch(()=>{});let e=()=>{fetch("/api/models/custom",{cache:"no-store"}).then(e=>e.json()).then(e=>{o((e.models||[]).filter(e=>"stt"===e.type&&e.providerAlias===t))}).catch(()=>{})};return e(),window.addEventListener("focus",e),window.addEventListener("customModelChanged",e),()=>{window.removeEventListener("focus",e),window.removeEventListener("customModelChanged",e)}},[t]);let H=_?A:E,G=d?`${t}/${d}`:"",W=`curl -X POST ${H}/v1/audio/transcriptions \\
49
+ -d '${JSON.stringify(ej)}'${ew?" \\\n --output image.png":""}`,e$=async()=>{if(!eC)return void er("Not supported by this router build");if(!w.trim()||!ex)return;if(ee(!0),er(""),J(null),z(null),G(null),Q){try{URL.revokeObjectURL(Q)}catch{}Z("")}let e=Date.now();try{let r={"Content-Type":"application/json"};eo&&(r["x-connection-id"]=eo),eN&&(r.Accept="text/event-stream");let s={...ej,model:ex},a=await fetch(eC,{method:n.endpoint.method,headers:r,body:JSON.stringify(s)});if(!a.ok){let e=await a.json().catch(()=>({}));er(e?.error?.message||e?.error||`HTTP ${a.status}`);return}let o=a.headers.get("content-type")||"";if(o.startsWith("image/")){let t=await a.blob(),r=URL.createObjectURL(t);Z(r),J({data:{binary:!0,mime:o,size:t.size},latencyMs:Date.now()-e});return}if(o.includes("text/event-stream")&&a.body){let t=new AbortController;eu.current=t;let r=a.body.getReader(),s=()=>{r.cancel().catch(()=>{})};t.signal.addEventListener("abort",s,{once:!0});let o=new TextDecoder,n="",l=null,i=null;try{for(;;){let e;if(t.signal.aborted)return;let{done:s,value:a}=await r.read();if(s)break;for(n+=o.decode(a,{stream:!0});-1!==(e=n.indexOf("\n\n"));){let t=n.slice(0,e);n=n.slice(e+2);let r=null,s="";for(let e of t.split("\n"))e.startsWith("event:")?r=e.slice(6).trim():e.startsWith("data:")&&(s+=e.slice(5).trim());if(r)try{let e=s?JSON.parse(s):{};"progress"===r?z(e):"partial_image"===r?G(e):"done"===r?l=e:"error"===r&&(i=e?.message||"Stream error")}catch{}}}}catch(e){if(t.signal.aborted)return;throw e}finally{t.signal.removeEventListener("abort",s),eu.current===t&&(eu.current=null)}let d=Date.now()-e;if(i)return void er(i);l&&J({data:l,latencyMs:d})}else{let r=await a.json();if("video"===t&&r?.request_id){let t=new AbortController;eu.current=t;let s=a.headers.get("x-zevai-connection-id")||a.headers.get("x-connection-id")||eo;try{let a=await E({requestId:String(r.request_id),connectionId:s,signal:t.signal,onProgress:({status:e,progress:t})=>{z({stage:e,percent:t})}});J({data:{...r,...a,request_id:r.request_id},latencyMs:Date.now()-e})}finally{eu.current===t&&(eu.current=null)}return}let s=Date.now()-e;J({data:r,latencyMs:s})}}catch(e){if(e?.name==="AbortError")return;er(e.message||"Network error")}finally{ee(!1)}},eE=e=>{if(!e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(eE);let t={};for(let[r,s]of Object.entries(e))t[r]="b64_json"===r&&"string"==typeof s&&s.length>100?`<${s.length} chars base64>`:eE(s);return t},eT=q?JSON.stringify(eE(q.data),null,2):"",eR="video"===t?(r=q?.data,r?.video?.url||r?.video?.file_output?.public_url||r?.data?.[0]?.url||""):"";return(0,s.jsxs)(i.Zp,{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Example"}),(0,s.jsxs)("div",{className:"flex flex-col gap-2.5",children:[x.length>0?(0,s.jsx)(T,{label:"Model",children:(0,s.jsx)("select",{value:f,onChange:e=>g(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:x.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}):b?(0,s.jsx)(T,{label:"Model",children:(0,s.jsx)("input",{value:f,onChange:e=>g(e.target.value),placeholder:"Enter model id (provider-specific)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}):null,(0,s.jsx)(T,{label:"Endpoint",children:(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsxs)("span",{className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate",children:[em,ep]}),B&&(0,s.jsxs)("button",{onClick:()=>M(e=>!e),title:L?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${L?"border-primary/40 bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"wifi_tethering"}),"Tunnel"]})]})}),(0,s.jsx)(T,{label:"API Key",children:(0,s.jsx)("span",{className:"px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate block",children:(0,s.jsx)("span",{className:"text-text-muted italic",children:"Dashboard session (server-side)"})})}),es.length>0&&(0,s.jsx)(T,{label:"Connection",children:(0,s.jsxs)("select",{value:eo,onChange:e=>en(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"",children:"Auto (by priority)"}),es.map(e=>{let t=e.providerSpecificData?.chatgptPlanType,r=e.email||e.name||e.id.slice(0,8);return(0,s.jsxs)("option",{value:e.id,children:[r,t?` [${t}]`:""]},e.id)})]})}),(0,s.jsx)(T,{label:d.inputLabel,children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:w,onChange:e=>N(e.target.value),placeholder:d.inputPlaceholder,className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),w&&(0,s.jsx)("button",{type:"button",onClick:()=>N(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})}),v&&(0,s.jsx)(T,{label:"Ref Image (URL)",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:k,onChange:e=>C(e.target.value),placeholder:eh.image||"https://example.com/source.png",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),k&&(0,s.jsx)("button",{type:"button",onClick:()=>C(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),eg&&(0,s.jsx)("img",{src:eg,alt:"Reference",className:"max-h-40 rounded-lg border border-border object-contain bg-sidebar",onError:e=>{e.currentTarget.style.display="none"},onLoad:e=>{e.currentTarget.style.display="block"}})]})}),j&&(0,s.jsx)(T,{label:"Mask (URL)",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:_,onChange:e=>$(e.target.value),placeholder:eh.mask_image||"https://example.com/mask.png",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),_&&(0,s.jsx)("button",{type:"button",onClick:()=>$(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),ey&&(0,s.jsx)("img",{src:ey,alt:"Mask",className:"max-h-40 rounded-lg border border-border object-contain bg-sidebar",onError:e=>{e.currentTarget.style.display="none"},onLoad:e=>{e.currentTarget.style.display="block"}})]})}),(d.extraFields||[]).filter(e=>0===x.length||Array.isArray(y?.params)&&y.params.includes(e.key)).map(e=>(0,s.jsx)(T,{label:e.label,children:"select"===e.type?(0,s.jsx)("select",{value:R[e.key]??"",onChange:t=>O(r=>({...r,[e.key]:t.target.value})),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:(e.options||[]).map(e=>(0,s.jsx)("option",{value:e,children:""===e?"(default)":e},e))}):"text"===e.type?(0,s.jsx)("input",{type:"text",value:R[e.key]??"",placeholder:e.placeholder,onChange:t=>O(r=>({...r,[e.key]:t.target.value})),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}):(0,s.jsx)("input",{type:"number",value:R[e.key]??"",min:e.min,max:e.max,onChange:t=>O(r=>({...r,[e.key]:""===t.target.value?"":Number(t.target.value)})),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})},e.key)),"image"===t&&(0,s.jsx)(T,{label:"Output Format",children:(0,s.jsxs)("select",{value:W,onChange:e=>Y(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"json",children:"JSON (Base64)"}),(0,s.jsx)("option",{value:"binary",children:"Binary File"})]})}),(0,s.jsxs)("div",{className:"mt-1",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[eC&&(0,s.jsxs)("button",{onClick:()=>ei(e_),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:el?"check":"content_copy"}),el?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:e$,disabled:!eC||X||!w.trim()||!ex,title:eC?void 0:"Not supported by this router build",className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:X?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),eC?X?"Running...":"Run":"Unavailable"]})]})]}),eC?(0,s.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:e_}):(0,s.jsx)("div",{className:"rounded-lg border border-border bg-sidebar px-3 py-2.5 text-xs text-text-muted",children:"Not supported by this router build"})]}),(X||V)&&eN&&(0,s.jsxs)("div",{className:"flex flex-col gap-2 px-3 py-2 rounded-lg bg-sidebar border border-border sm:flex-row sm:items-center sm:gap-3",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",style:X?{animation:"spin 1s linear infinite"}:void 0,children:X?"progress_activity":"check_circle"}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:[V?.stage||"starting",!X&&V?.bytesReceived?` \xb7 ${(V.bytesReceived/1024).toFixed(1)} KB`:""]})]}),(X||V)&&"video"===t&&(0,s.jsxs)("div",{className:"flex flex-col gap-2 px-3 py-2 rounded-lg bg-sidebar border border-border sm:flex-row sm:items-center sm:gap-3",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",style:X?{animation:"spin 1s linear infinite"}:void 0,children:X?"progress_activity":"check_circle"}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:[V?.stage||"submitting",Number.isFinite(V?.percent)?` \xb7 ${V.percent}%`:""]})]}),H?.b64_json&&!q&&(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Partial preview"}),(0,s.jsx)("img",{src:`data:image/png;base64,${H.b64_json}`,alt:"Partial",className:"max-w-full rounded-lg border border-border mt-1.5 opacity-80"})]}),et&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:et}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsxs)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["Response ",q&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",q.latencyMs,"ms"]})]}),q&&(0,s.jsxs)("button",{onClick:()=>ec(eT),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:ed?"check":"content_copy"}),ed?"Copied":"Copy"]})]}),(0,s.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all opacity-70",children:q?eT:d.defaultResponse}),"image"===t&&(Q||q?.data?.data?.[0])&&(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,s.jsxs)("a",{href:Q||(q?.data?.data?.[0]?.b64_json?`data:image/png;base64,${q.data.data[0].b64_json}`:q?.data?.data?.[0]?.url||""),download:"image.png",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})}),(0,s.jsx)("img",{src:Q||(q?.data?.data?.[0]?.b64_json?`data:image/png;base64,${q.data.data[0].b64_json}`:q?.data?.data?.[0]?.url),alt:"Generated",className:"max-w-full rounded-lg border border-border"})]}),eR&&(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,s.jsxs)("a",{href:eR,download:"video.mp4",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})}),(0,s.jsx)("video",{controls:!0,src:eR,className:"max-w-full rounded-lg border border-border bg-black"})]})]})]})]})}function U({providerId:e}){let t=(0,c.wG)(e),r=(0,u.KC)(e).filter(e=>"stt"===e.type),[a,o]=(0,l.useState)([]),n=[...r,...a],[d,p]=(0,l.useState)(r[0]?.id??""),x=n.find(e=>e.id===d),h=Array.isArray(x?.params)?x.params:[],[b,f]=(0,l.useState)(null),[g,y]=(0,l.useState)(""),[v,j]=(0,l.useState)(""),[w,N]=(0,l.useState)("json"),[k,C]=(0,l.useState)(""),[_,$]=(0,l.useState)(!1),[E,R]=(0,l.useState)(""),[O,A]=(0,l.useState)(""),[P,I]=(0,l.useState)(null),[L,M]=(0,l.useState)(null),[D,K]=(0,l.useState)(!1),[B,F]=(0,l.useState)(""),{copied:q,copy:J}=(0,m.C)(),{copied:V,copy:z}=(0,m.C)();(0,l.useEffect)(()=>{R(window.location.origin),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&A(e.publicUrl)}).catch(()=>{});let e=()=>{fetch("/api/models/custom",{cache:"no-store"}).then(e=>e.json()).then(e=>{o((e.models||[]).filter(e=>"stt"===e.type&&e.providerAlias===t))}).catch(()=>{})};return e(),window.addEventListener("focus",e),window.addEventListener("customModelChanged",e),()=>{window.removeEventListener("focus",e),window.removeEventListener("customModelChanged",e)}},[t]);let H=_?O:E,G=d?`${t}/${d}`:"",W=`curl -X POST ${H}/v1/audio/transcriptions \\
50
50
  -H "Authorization: Bearer YOUR_KEY" \\
51
51
  -F "file=@${b?.name||"audio.mp3"}" \\
52
52
  -F "model=${G}"${h.includes("language")&&g?` \\
@@ -55,4 +55,4 @@
55
55
  -F "temperature=${k}"`:""}${h.includes("prompt")&&v?` \\
56
56
  -F "prompt=${v}"`:""}`,Y=async()=>{if(!b||!G)return;K(!0),F(""),I(null);let e=Date.now();try{let t=new FormData;t.append("file",b),t.append("model",G),h.includes("language")&&g&&t.append("language",g),h.includes("response_format")&&t.append("response_format",w),h.includes("temperature")&&k&&t.append("temperature",k),h.includes("prompt")&&v&&t.append("prompt",v);let r=await fetch((0,S.O)("/v1/audio/transcriptions"),{method:"POST",body:t});M(Date.now()-e);let s=(r.headers.get("content-type")||"").includes("application/json")?await r.json():await r.text();if(!r.ok)return void F(s?.error?.message||s?.error||s||`HTTP ${r.status}`);I(s)}catch(e){F(e.message||"Network error")}finally{K(!1)}},Q="string"==typeof P?P:P?JSON.stringify(P,null,2):`{
57
57
  "text": "Hello world..."
58
- }`;return(0,s.jsxs)(i.Zp,{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Example"}),(0,s.jsxs)("div",{className:"flex flex-col gap-2.5",children:[n.length>0?(0,s.jsx)(T,{label:"Model",children:(0,s.jsx)("select",{value:d,onChange:e=>p(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:n.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}):(0,s.jsx)(T,{label:"Model",children:(0,s.jsx)("input",{value:d,onChange:e=>p(e.target.value),placeholder:"Enter model id",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}),(0,s.jsx)(T,{label:"Endpoint",children:(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsxs)("span",{className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate",children:[H,"/v1/audio/transcriptions"]}),A&&(0,s.jsxs)("button",{onClick:()=>$(e=>!e),title:_?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${_?"border-primary/40 bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"wifi_tethering"}),"Tunnel"]})]})}),(0,s.jsx)(T,{label:"API Key",children:(0,s.jsx)("span",{className:"px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate block",children:(0,s.jsx)("span",{className:"text-text-muted italic",children:"Dashboard session (server-side)"})})}),(0,s.jsx)(T,{label:"Audio File",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)("input",{type:"file",accept:"audio/*,video/mp4,.m4a,.mp3,.wav,.ogg,.flac,.webm,.opus",onChange:e=>f(e.target.files?.[0]||null),className:"w-full text-xs text-text-muted file:mr-2 file:py-1 file:px-2.5 file:rounded-lg file:border file:border-border file:bg-background file:text-text-main hover:file:bg-sidebar file:cursor-pointer"}),b&&(0,s.jsxs)("span",{className:"text-xs text-text-muted font-mono",children:[b.name," \xb7 ",(b.size/1024).toFixed(1)," KB"]})]})}),h.includes("language")&&(0,s.jsx)(T,{label:"Language",children:(0,s.jsx)("input",{value:g,onChange:e=>y(e.target.value),placeholder:"e.g. en, vi, ja (auto-detect if empty)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}),h.includes("prompt")&&(0,s.jsx)(T,{label:"Prompt",children:(0,s.jsx)("input",{value:v,onChange:e=>j(e.target.value),placeholder:"optional context to improve accuracy",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),h.includes("temperature")&&(0,s.jsx)(T,{label:"Temperature",children:(0,s.jsx)("input",{type:"number",step:"0.1",min:"0",max:"1",value:k,onChange:e=>C(e.target.value),placeholder:"0 - 1 (default 0)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),h.includes("response_format")&&(0,s.jsx)(T,{label:"Response Format",children:(0,s.jsxs)("select",{value:w,onChange:e=>N(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"json",children:"json"}),(0,s.jsx)("option",{value:"text",children:"text"}),(0,s.jsx)("option",{value:"srt",children:"srt"}),(0,s.jsx)("option",{value:"verbose_json",children:"verbose_json"}),(0,s.jsx)("option",{value:"vtt",children:"vtt"})]})}),(0,s.jsxs)("div",{className:"mt-1",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsxs)("button",{onClick:()=>J(W),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:q?"check":"content_copy"}),q?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:Y,disabled:D||!b||!G,className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:D?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),D?"Transcribing...":"Run"]})]})]}),(0,s.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:W})]}),B&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:B}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsxs)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["Response ",P&&L&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",L,"ms"]})]}),P&&(0,s.jsxs)("button",{onClick:()=>z(Q),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:V?"check":"content_copy"}),V?"Copied":"Copy"]})]}),(0,s.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all opacity-70",children:Q})]})]})]})}function K(){let{kind:e,id:t}=(0,a.useParams)(),r=(0,a.useRouter)(),o=c.rj.find(t=>t.id===e),u=(0,c.gC)(t)&&"embedding"===e,[m,p]=(0,l.useState)(null),[x,h]=(0,l.useState)(u),[b,f]=(0,l.useState)(!1),[g,v]=(0,l.useState)(!1),j=async()=>{if(confirm("Delete this Custom Embedding node?")){v(!0);try{let s=await fetch(`/api/provider-nodes/${t}`,{method:"DELETE"});if(s.ok)return void r.push(`/dashboard/media-providers/${e}`);let a=await s.json().catch(()=>({}));alert(a.error||"Failed to delete custom embedding node")}catch{alert("Failed to delete custom embedding node")}v(!1)}};if((0,l.useEffect)(()=>{if(!u)return;let e=!1;return fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(r=>{e||(p((r.nodes||[]).find(e=>e.id===t)||null),h(!1))}).catch(()=>{e||h(!1)}),()=>{e=!0}},[t,u]),!o)return(0,a.notFound)();let N=c.Q2[t],k=u?m?{id:t,name:m.name||"Custom Embedding",color:"#6366F1",textIcon:"CE"}:null:N;if(!u&&!N||u&&!x&&!m)return(0,a.notFound)();if(u&&x)return(0,s.jsx)("div",{className:"text-text-muted text-sm py-12 text-center",children:"Loading..."});let C=u?["embedding"]:k.serviceKinds??["llm"];return u||C.includes(e)?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)(n(),{href:`/dashboard/media-providers/${e}`,className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),o.label]}),(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[(0,s.jsx)("div",{className:"size-12 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${k.color}15`},children:(0,s.jsx)(d.A,{src:`/providers/${k.id}.png`,alt:k.name,size:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",fallbackText:k.textIcon||k.id.slice(0,2).toUpperCase(),fallbackColor:k.color})}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[(0,s.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:k.name}),!u&&k.notice?.apiKeyUrl&&(0,s.jsxs)("a",{href:k.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),"Get API Key"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5 mt-1 flex-wrap",children:[u&&(0,s.jsxs)(i.Ex,{variant:"default",size:"sm",children:["Custom \xb7 ",m?.prefix]}),C.map(t=>(0,s.jsx)(i.Ex,{variant:t===e?"primary":"default",size:"sm",children:t.toUpperCase()},t))]})]}),u&&(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>f(!0),children:"Edit"}),(0,s.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:j,disabled:g,children:g?"Deleting...":"Delete"})]})]})]}),!u&&k.kindNotice?.[e]&&(0,s.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 rounded-lg bg-amber-500/10 border border-amber-500/30 text-amber-700 dark:text-amber-400",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px] mt-0.5",children:"warning"}),(0,s.jsx)("p",{className:"text-sm",children:k.kindNotice[e]})]}),!u&&k.notice?.text&&!k.deprecated&&(0,s.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,s.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:k.notice.text}),k.notice.apiKeyUrl&&(0,s.jsx)("a",{href:k.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),!u&&k.noAuth?(0,s.jsx)(i.gw,{providerId:t}):(0,s.jsx)(y,{providerId:t,isOAuth:!1}),"tts"!==e&&"webSearch"!==e&&"webFetch"!==e&&(0,s.jsx)(w,{providerId:t,kindFilter:e,providerAliasOverride:u?m?.prefix:void 0}),!u&&(k.searchConfig||k.fetchConfig||k.ttsConfig||k.sttConfig||k.embeddingConfig||k.searchViaChat)&&(0,s.jsx)(i.Wx,{config:"webFetch"===e?k.fetchConfig:"tts"===e?k.ttsConfig:"stt"===e?k.sttConfig:"embedding"===e?k.embeddingConfig:k.searchConfig||{mode:"chat-completions",defaultModel:k.searchViaChat?.defaultModel,pricingUrl:k.searchViaChat?.pricingUrl,freeTier:k.searchViaChat?.freeTier},provider:k,title:`${o.label} Config`}),"embedding"===e&&(0,s.jsx)(L,{providerId:t,customAlias:m?.prefix}),"tts"===e&&(0,s.jsx)(M,{providerId:t}),"stt"===e&&!u&&(0,s.jsx)(U,{providerId:t}),!u&&I[e]&&(0,s.jsx)(D,{providerId:t,kind:e}),u&&(0,s.jsx)(i.x0,{isOpen:b,node:m,onClose:()=>f(!1),onSaved:e=>{p(e),f(!1)}})]}):(0,a.notFound)()}},54909:(e,t,r)=>{Promise.resolve().then(r.bind(r,7651))},62199:(e,t,r)=>{"use strict";r.d(t,{O:()=>a,x:()=>o});let s=Object.freeze({"/v1/embeddings":"embeddings","/v1/images/generations":"images","/v1/audio/speech":"speech","/v1/audio/transcriptions":"transcriptions","/v1/search":"search","/v1/web/fetch":"fetch","/v1/videos/generations":"videos"});function a(e){if("string"!=typeof e)return null;let t=e.indexOf("?"),r=-1===t?e:e.slice(0,t),a=-1===t?"":e.slice(t),o=s[r];return o?`/api/dashboard/media/${o}${a}`:null}function o(e){return"string"==typeof e&&e.trim()?`/api/dashboard/media/videos/${encodeURIComponent(e.trim())}`:null}},70217:(e,t,r)=>{"use strict";r.d(t,{BU:()=>u,G9:()=>l,d4:()=>d,gJ:()=>s,i2:()=>c});let s=[{id:"all",label:"All"},{id:"active",label:"Active",keys:["active"]},{id:"errors",label:"Errors",keys:["connection_error","auth_error","quota_exhausted","rate_limited","banned","cooldown","unknown"]},{id:"connection",label:"Connection",keys:["connection_error"]},{id:"auth",label:"Auth",keys:["auth_error"]},{id:"limit",label:"Limit",keys:["rate_limited","cooldown"]},{id:"exhausted",label:"Exhausted",keys:["quota_exhausted"]},{id:"banned",label:"Banned",keys:["banned"]},{id:"disabled",label:"Disabled",keys:["disabled"]}],a={active:{label:"active",severity:"success",terminal:!1},disabled:{label:"disabled",severity:"default",terminal:!1},connection_error:{label:"connection error",severity:"error",terminal:!1},auth_error:{label:"auth error",severity:"error",terminal:!0},quota_exhausted:{label:"exhausted",severity:"error",terminal:!0},rate_limited:{label:"rate limited",severity:"warning",terminal:!1},banned:{label:"banned",severity:"error",terminal:!0},cooldown:{label:"cooldown",severity:"warning",terminal:!1},unknown:{label:"unknown",severity:"default",terminal:!1}},o={policy_suspended:"banned",credential_rejected:"auth_error",reauth_required:"auth_error",authentication:"auth_error",entitlement_or_quota:"quota_exhausted",rate_limited:"rate_limited",permission_denied:"auth_error",upstream_transient:"connection_error"};function n(e){if(!e)return"";if("string"==typeof e)return e.toLowerCase();try{return JSON.stringify(e).toLowerCase()}catch{return String(e).toLowerCase()}}function l(e={},t=Date.now()){let r=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>new Date(e).getTime()).filter(e=>Number.isFinite(e)&&e>t);return r.length>0?new Date(Math.min(...r)).toISOString():null}function i(e,t=""){let r=a[e]||a.unknown;return{key:e,...r,reason:t}}function d(e={}){var t;let r=(t=e).quarantinedAt?i(o[n(t.failureClass)]||"unknown",t.quarantineReason||t.lastError||"Connection is quarantined"):null;if(r)return r;if(!1===e.isActive)return i("disabled","Connection is disabled");if(function(e={}){return null!==l(e)}(e))return i("cooldown","Model cooldown is active");if(function(e){if(!e)return!1;let t=new Date(e).getTime();return Number.isFinite(t)&&t>Date.now()}(e.rateLimitedUntil))return i("rate_limited","Rate limit cooldown is active");let s=n(e.testStatus||e.status),a=n(e.lastErrorType||e.errorType),c=n(e.errorCode||e.statusCode),u=n(e.lastError||e.error),m=`${s} ${a} ${c} ${u}`.trim();return!m||["active","success","ok"].includes(s)?i("active",""):m.includes("ban")||m.includes("suspend")||m.includes("restricted")?i("banned",e.lastError||"Account appears restricted"):m.includes("exhaust")||m.includes("quota exceeded")||m.includes("insufficient_quota")||m.includes("payment required")||"402"===c?i("quota_exhausted",e.lastError||"Quota exhausted"):a.includes("rate_limited")||m.includes("rate limit")||m.includes("too many requests")||"429"===c?i("rate_limited",e.lastError||"Rate limited"):a.includes("auth")||a.includes("token")||m.includes("unauthorized")||m.includes("invalid api key")||m.includes("token invalid")||m.includes("token expired")||m.includes("revoked")||"401"===c||"403"===c?i("auth_error",e.lastError||"Authentication failed"):a.includes("network")||m.includes("network")||m.includes("timeout")||m.includes("fetch failed")||m.includes("econn")||m.includes("dns")||m.includes("proxy")?i("connection_error",e.lastError||"Connection failed"):["error","expired","unavailable","failed"].includes(s)?i("connection_error",e.lastError||e.testStatus||"Connection failed"):i("unknown",e.lastError||e.testStatus||"")}function c(e,t){if(!t||"all"===t)return!0;let r=s.find(e=>e.id===t);return!r||r.keys.includes(d(e).key)}function u(e){return e?.severity==="success"?"success":e?.severity==="error"?"error":"default"}},81277:(e,t,r)=>{"use strict";r.d(t,{c:()=>o});var s=r(12115),a=r(70217);function o(e={}){let[t,r]=(0,s.useState)(null),n=JSON.stringify(Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).sort(([e],[t])=>e.localeCompare(t)));return(0,s.useEffect)(()=>(function(e,t,r={}){let s=r.now||Date.now,o=r.setTimer||globalThis.setTimeout,n=r.clearTimer||globalThis.clearTimeout,l=!1,i=null,d=()=>{if(i=null,l)return;let r=s(),n=(0,a.G9)(e,r);t(n),n&&(i=o(d,Math.min(Math.max(1,new Date(n).getTime()-r+1),0x7fffffff)))};return i=o(d,0),()=>{l=!0,null!==i&&n(i),i=null}})(Object.fromEntries(JSON.parse(n)),r),[n]),t}}},e=>{e.O(0,[2574,3862,3745,3339,620,5497,8441,3794,7358],()=>e(e.s=54909)),_N_E=e.O()}]);
58
+ }`;return(0,s.jsxs)(i.Zp,{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Example"}),(0,s.jsxs)("div",{className:"flex flex-col gap-2.5",children:[n.length>0?(0,s.jsx)(T,{label:"Model",children:(0,s.jsx)("select",{value:d,onChange:e=>p(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:n.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}):(0,s.jsx)(T,{label:"Model",children:(0,s.jsx)("input",{value:d,onChange:e=>p(e.target.value),placeholder:"Enter model id",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}),(0,s.jsx)(T,{label:"Endpoint",children:(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsxs)("span",{className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate",children:[H,"/v1/audio/transcriptions"]}),O&&(0,s.jsxs)("button",{onClick:()=>$(e=>!e),title:_?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${_?"border-primary/40 bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"wifi_tethering"}),"Tunnel"]})]})}),(0,s.jsx)(T,{label:"API Key",children:(0,s.jsx)("span",{className:"px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate block",children:(0,s.jsx)("span",{className:"text-text-muted italic",children:"Dashboard session (server-side)"})})}),(0,s.jsx)(T,{label:"Audio File",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)("input",{type:"file",accept:"audio/*,video/mp4,.m4a,.mp3,.wav,.ogg,.flac,.webm,.opus",onChange:e=>f(e.target.files?.[0]||null),className:"w-full text-xs text-text-muted file:mr-2 file:py-1 file:px-2.5 file:rounded-lg file:border file:border-border file:bg-background file:text-text-main hover:file:bg-sidebar file:cursor-pointer"}),b&&(0,s.jsxs)("span",{className:"text-xs text-text-muted font-mono",children:[b.name," \xb7 ",(b.size/1024).toFixed(1)," KB"]})]})}),h.includes("language")&&(0,s.jsx)(T,{label:"Language",children:(0,s.jsx)("input",{value:g,onChange:e=>y(e.target.value),placeholder:"e.g. en, vi, ja (auto-detect if empty)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}),h.includes("prompt")&&(0,s.jsx)(T,{label:"Prompt",children:(0,s.jsx)("input",{value:v,onChange:e=>j(e.target.value),placeholder:"optional context to improve accuracy",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),h.includes("temperature")&&(0,s.jsx)(T,{label:"Temperature",children:(0,s.jsx)("input",{type:"number",step:"0.1",min:"0",max:"1",value:k,onChange:e=>C(e.target.value),placeholder:"0 - 1 (default 0)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),h.includes("response_format")&&(0,s.jsx)(T,{label:"Response Format",children:(0,s.jsxs)("select",{value:w,onChange:e=>N(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"json",children:"json"}),(0,s.jsx)("option",{value:"text",children:"text"}),(0,s.jsx)("option",{value:"srt",children:"srt"}),(0,s.jsx)("option",{value:"verbose_json",children:"verbose_json"}),(0,s.jsx)("option",{value:"vtt",children:"vtt"})]})}),(0,s.jsxs)("div",{className:"mt-1",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsxs)("button",{onClick:()=>J(W),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:q?"check":"content_copy"}),q?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:Y,disabled:D||!b||!G,className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:D?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),D?"Transcribing...":"Run"]})]})]}),(0,s.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:W})]}),B&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:B}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsxs)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["Response ",P&&L&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",L,"ms"]})]}),P&&(0,s.jsxs)("button",{onClick:()=>z(Q),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:V?"check":"content_copy"}),V?"Copied":"Copy"]})]}),(0,s.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all opacity-70",children:Q})]})]})]})}function K(){let{kind:e,id:t}=(0,a.useParams)(),r=(0,a.useRouter)(),o=c.rj.find(t=>t.id===e),u=(0,c.gC)(t)&&"embedding"===e,[m,p]=(0,l.useState)(null),[x,h]=(0,l.useState)(u),[b,f]=(0,l.useState)(!1),[g,v]=(0,l.useState)(!1),j=async()=>{if(confirm("Delete this Custom Embedding node?")){v(!0);try{let s=await fetch(`/api/provider-nodes/${t}`,{method:"DELETE"});if(s.ok)return void r.push(`/dashboard/media-providers/${e}`);let a=await s.json().catch(()=>({}));alert(a.error||"Failed to delete custom embedding node")}catch{alert("Failed to delete custom embedding node")}v(!1)}};if((0,l.useEffect)(()=>{if(!u)return;let e=!1;return fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(r=>{e||(p((r.nodes||[]).find(e=>e.id===t)||null),h(!1))}).catch(()=>{e||h(!1)}),()=>{e=!0}},[t,u]),!o)return(0,a.notFound)();let N=c.Q2[t],k=u?m?{id:t,name:m.name||"Custom Embedding",color:"#6366F1",textIcon:"CE"}:null:N;if(!u&&!N||u&&!x&&!m)return(0,a.notFound)();if(u&&x)return(0,s.jsx)("div",{className:"text-text-muted text-sm py-12 text-center",children:"Loading..."});let C=u?["embedding"]:k.serviceKinds??["llm"];return u||C.includes(e)?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)(n(),{href:`/dashboard/media-providers/${e}`,className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),o.label]}),(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[(0,s.jsx)("div",{className:"size-12 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${k.color}15`},children:(0,s.jsx)(d.A,{src:`/providers/${k.id}.png`,alt:k.name,size:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",fallbackText:k.textIcon||k.id.slice(0,2).toUpperCase(),fallbackColor:k.color})}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[(0,s.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:k.name}),!u&&k.notice?.apiKeyUrl&&(0,s.jsxs)("a",{href:k.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),"Get API Key"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5 mt-1 flex-wrap",children:[u&&(0,s.jsxs)(i.Ex,{variant:"default",size:"sm",children:["Custom \xb7 ",m?.prefix]}),C.map(t=>(0,s.jsx)(i.Ex,{variant:t===e?"primary":"default",size:"sm",children:t.toUpperCase()},t))]})]}),u&&(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>f(!0),children:"Edit"}),(0,s.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:j,disabled:g,children:g?"Deleting...":"Delete"})]})]})]}),!u&&k.kindNotice?.[e]&&(0,s.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 rounded-lg bg-amber-500/10 border border-amber-500/30 text-amber-700 dark:text-amber-400",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px] mt-0.5",children:"warning"}),(0,s.jsx)("p",{className:"text-sm",children:k.kindNotice[e]})]}),!u&&k.notice?.text&&!k.deprecated&&(0,s.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,s.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:k.notice.text}),k.notice.apiKeyUrl&&(0,s.jsx)("a",{href:k.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),!u&&k.noAuth?(0,s.jsx)(i.gw,{providerId:t}):(0,s.jsx)(y,{providerId:t,isOAuth:!1}),"tts"!==e&&"webSearch"!==e&&"webFetch"!==e&&(0,s.jsx)(w,{providerId:t,kindFilter:e,providerAliasOverride:u?m?.prefix:void 0}),!u&&(k.searchConfig||k.fetchConfig||k.ttsConfig||k.sttConfig||k.embeddingConfig||k.searchViaChat)&&(0,s.jsx)(i.Wx,{config:"webFetch"===e?k.fetchConfig:"tts"===e?k.ttsConfig:"stt"===e?k.sttConfig:"embedding"===e?k.embeddingConfig:k.searchConfig||{mode:"chat-completions",defaultModel:k.searchViaChat?.defaultModel,pricingUrl:k.searchViaChat?.pricingUrl,freeTier:k.searchViaChat?.freeTier},provider:k,title:`${o.label} Config`}),"embedding"===e&&(0,s.jsx)(L,{providerId:t,customAlias:m?.prefix}),"tts"===e&&(0,s.jsx)(M,{providerId:t}),"stt"===e&&!u&&(0,s.jsx)(U,{providerId:t}),!u&&I[e]&&(0,s.jsx)(D,{providerId:t,kind:e}),u&&(0,s.jsx)(i.x0,{isOpen:b,node:m,onClose:()=>f(!1),onSaved:e=>{p(e),f(!1)}})]}):(0,a.notFound)()}},54909:(e,t,r)=>{Promise.resolve().then(r.bind(r,7651))},62199:(e,t,r)=>{"use strict";r.d(t,{O:()=>a,x:()=>o});let s=Object.freeze({"/v1/embeddings":"embeddings","/v1/images/generations":"images","/v1/audio/speech":"speech","/v1/audio/transcriptions":"transcriptions","/v1/search":"search","/v1/web/fetch":"fetch","/v1/videos/generations":"videos"});function a(e){if("string"!=typeof e)return null;let t=e.indexOf("?"),r=-1===t?e:e.slice(0,t),a=-1===t?"":e.slice(t),o=s[r];return o?`/api/dashboard/media/${o}${a}`:null}function o(e){return"string"==typeof e&&e.trim()?`/api/dashboard/media/videos/${encodeURIComponent(e.trim())}`:null}},70217:(e,t,r)=>{"use strict";r.d(t,{BU:()=>u,G9:()=>l,d4:()=>d,gJ:()=>s,i2:()=>c});let s=[{id:"all",label:"All"},{id:"active",label:"Active",keys:["active"]},{id:"errors",label:"Errors",keys:["connection_error","auth_error","quota_exhausted","rate_limited","banned","cooldown","unknown"]},{id:"connection",label:"Connection",keys:["connection_error"]},{id:"auth",label:"Auth",keys:["auth_error"]},{id:"limit",label:"Limit",keys:["rate_limited","cooldown"]},{id:"exhausted",label:"Exhausted",keys:["quota_exhausted"]},{id:"banned",label:"Banned",keys:["banned"]},{id:"disabled",label:"Disabled",keys:["disabled"]}],a={active:{label:"active",severity:"success",terminal:!1},disabled:{label:"disabled",severity:"default",terminal:!1},connection_error:{label:"connection error",severity:"error",terminal:!1},auth_error:{label:"auth error",severity:"error",terminal:!0},quota_exhausted:{label:"exhausted",severity:"error",terminal:!0},rate_limited:{label:"rate limited",severity:"warning",terminal:!1},banned:{label:"banned",severity:"error",terminal:!0},cooldown:{label:"cooldown",severity:"warning",terminal:!1},unknown:{label:"unknown",severity:"default",terminal:!1}},o={policy_suspended:"banned",credential_rejected:"auth_error",reauth_required:"auth_error",authentication:"auth_error",entitlement_or_quota:"quota_exhausted",rate_limited:"rate_limited",permission_denied:"auth_error",upstream_transient:"connection_error"};function n(e){if(!e)return"";if("string"==typeof e)return e.toLowerCase();try{return JSON.stringify(e).toLowerCase()}catch{return String(e).toLowerCase()}}function l(e={},t=Date.now()){let r=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>new Date(e).getTime()).filter(e=>Number.isFinite(e)&&e>t);return r.length>0?new Date(Math.min(...r)).toISOString():null}function i(e,t=""){let r=a[e]||a.unknown;return{key:e,...r,reason:t}}function d(e={}){var t;let r=(t=e).quarantinedAt?i(o[n(t.failureClass)]||"unknown",t.quarantineReason||t.lastError||"Connection is quarantined"):null;if(r)return r;if(!1===e.isActive)return i("disabled","Connection is disabled");if(function(e={}){return null!==l(e)}(e))return i("cooldown","Model cooldown is active");if(function(e){if(!e)return!1;let t=new Date(e).getTime();return Number.isFinite(t)&&t>Date.now()}(e.rateLimitedUntil))return i("rate_limited","Rate limit cooldown is active");let s=n(e.testStatus||e.status),a=n(e.lastErrorType||e.errorType),c=n(e.errorCode||e.statusCode),u=n(e.lastError||e.error),m=`${s} ${a} ${c} ${u}`.trim();return!m||["active","success","ok"].includes(s)?i("active",""):m.includes("ban")||m.includes("suspend")||m.includes("restricted")?i("banned",e.lastError||"Account appears restricted"):m.includes("exhaust")||m.includes("quota exceeded")||m.includes("insufficient_quota")||m.includes("payment required")||"402"===c?i("quota_exhausted",e.lastError||"Quota exhausted"):a.includes("rate_limited")||m.includes("rate limit")||m.includes("too many requests")||"429"===c?i("rate_limited",e.lastError||"Rate limited"):a.includes("auth")||a.includes("token")||m.includes("unauthorized")||m.includes("invalid api key")||m.includes("token invalid")||m.includes("token expired")||m.includes("revoked")||"401"===c||"403"===c?i("auth_error",e.lastError||"Authentication failed"):a.includes("network")||m.includes("network")||m.includes("timeout")||m.includes("fetch failed")||m.includes("econn")||m.includes("dns")||m.includes("proxy")?i("connection_error",e.lastError||"Connection failed"):["error","expired","unavailable","failed"].includes(s)?i("connection_error",e.lastError||e.testStatus||"Connection failed"):i("unknown",e.lastError||e.testStatus||"")}function c(e,t){if(!t||"all"===t)return!0;let r=s.find(e=>e.id===t);return!r||r.keys.includes(d(e).key)}function u(e){return e?.severity==="success"?"success":e?.severity==="error"?"error":"default"}},81277:(e,t,r)=>{"use strict";r.d(t,{c:()=>o});var s=r(12115),a=r(70217);function o(e={}){let[t,r]=(0,s.useState)(null),n=JSON.stringify(Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).sort(([e],[t])=>e.localeCompare(t)));return(0,s.useEffect)(()=>(function(e,t,r={}){let s=r.now||Date.now,o=r.setTimer||globalThis.setTimeout,n=r.clearTimer||globalThis.clearTimeout,l=!1,i=null,d=()=>{if(i=null,l)return;let r=s(),n=(0,a.G9)(e,r);t(n),n&&(i=o(d,Math.min(Math.max(1,new Date(n).getTime()-r+1),0x7fffffff)))};return i=o(d,0),()=>{l=!0,null!==i&&n(i),i=null}})(Object.fromEntries(JSON.parse(n)),r),[n]),t}}},e=>{e.O(0,[2574,3862,3745,3339,620,5497,8441,3794,7358],()=>e(e.s=54909)),_N_E=e.O()}]);