keyrouter 1.0.4 → 1.0.5

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 (508) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +19 -19
  3. package/app/.next-cli-build/build-manifest.json +3 -3
  4. package/app/.next-cli-build/prerender-manifest.json +19 -19
  5. package/app/.next-cli-build/react-loadable-manifest.json +8 -8
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +5 -5
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-injection/page.js +1 -1
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-injection/page.js.nft.json +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-injection/page_client-reference-manifest.js +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  75. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  76. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  77. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  78. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  79. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  80. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  81. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  82. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  83. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  84. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  85. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  86. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  87. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  88. package/app/.next-cli-build/server/app/_not-found.rsc +7 -7
  89. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +7 -7
  90. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +7 -7
  91. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  92. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  93. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  94. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  95. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  96. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  97. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
  98. package/app/.next-cli-build/server/app/api/auth/saml/acs/route.js.nft.json +1 -1
  99. package/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js.nft.json +1 -1
  100. package/app/.next-cli-build/server/app/api/auth/saml/start/route.js.nft.json +1 -1
  101. package/app/.next-cli-build/server/app/api/auth/saml/test/route.js.nft.json +1 -1
  102. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  103. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  104. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  106. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  107. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  108. package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/cli-tools/codex-profiles/route.js.nft.json +1 -1
  110. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  112. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  114. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js.nft.json +1 -1
  116. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  117. package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js.nft.json +1 -1
  118. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  119. package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js.nft.json +1 -1
  120. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
  121. package/app/.next-cli-build/server/app/api/cli-tools/hermes-profiles/route.js.nft.json +1 -1
  122. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  123. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  124. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js.nft.json +1 -1
  126. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  127. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js.nft.json +1 -1
  130. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  131. package/app/.next-cli-build/server/app/api/combos/presets/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  133. package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
  134. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
  136. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  137. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  138. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  139. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  140. package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  141. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  142. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  143. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  144. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  145. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  146. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  147. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  148. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  149. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  151. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  152. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  153. package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js.nft.json +1 -1
  154. package/app/.next-cli-build/server/app/api/models/custom/route.js +1 -1
  155. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  157. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  158. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  159. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  160. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  161. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  162. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  163. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  164. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  165. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  166. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  167. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  168. package/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js.nft.json +1 -1
  169. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  170. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  171. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  172. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  173. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  175. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  176. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/api-key/route.js.nft.json +1 -1
  177. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/start/route.js.nft.json +1 -1
  179. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/status/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/oauth/zed/auto-import/route.js.nft.json +1 -1
  181. package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js.nft.json +1 -1
  182. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  183. package/app/.next-cli-build/server/app/api/prompt-injection/route.js.nft.json +1 -1
  184. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  185. package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
  186. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  187. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  188. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  189. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  190. package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
  192. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  194. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  196. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  197. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  198. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  199. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  200. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  201. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  202. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  203. package/app/.next-cli-build/server/app/api/providers/web-login/route.js.nft.json +1 -1
  204. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  205. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  206. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  207. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  208. package/app/.next-cli-build/server/app/api/proxy-pools/netlify-deploy/route.js.nft.json +1 -1
  209. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  210. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  211. package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
  212. package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
  213. package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
  214. package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
  215. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
  216. package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
  217. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
  218. package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
  219. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  220. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  221. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  222. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  223. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  224. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  225. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  226. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  227. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  228. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  229. package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  230. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  232. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  234. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  236. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  237. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  238. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  239. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  240. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js +1 -1
  241. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js.nft.json +1 -1
  242. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  243. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  244. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  245. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  246. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  247. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  248. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  249. package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
  250. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  251. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  252. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  253. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  254. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  255. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  256. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  257. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  258. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
  259. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  260. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  261. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  262. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  263. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  264. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  265. package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js.nft.json +1 -1
  266. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  267. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  268. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  269. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  270. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  271. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  272. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  273. package/app/.next-cli-build/server/app/api/v1/systemone/route.js.nft.json +1 -1
  274. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
  275. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
  276. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
  277. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
  278. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  279. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  280. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  281. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  282. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  283. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  284. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  285. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  286. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  287. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  288. package/app/.next-cli-build/server/app/callback.html +1 -1
  289. package/app/.next-cli-build/server/app/callback.rsc +7 -7
  290. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +7 -7
  291. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  292. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +7 -7
  293. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  294. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +7 -7
  295. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +7 -7
  296. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +7 -7
  297. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
  298. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  299. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +8 -8
  300. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +8 -8
  301. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +8 -8
  302. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  303. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  304. package/app/.next-cli-build/server/app/dashboard/combos.rsc +8 -8
  305. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +8 -8
  306. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +8 -8
  307. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  308. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  309. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +8 -8
  310. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +8 -8
  311. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +8 -8
  312. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  313. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  314. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +7 -7
  315. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +7 -7
  316. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +7 -7
  317. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
  318. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  319. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +8 -8
  320. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +8 -8
  321. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +8 -8
  322. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  323. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  324. package/app/.next-cli-build/server/app/dashboard/profile.rsc +8 -8
  325. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +8 -8
  326. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +8 -8
  327. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  328. package/app/.next-cli-build/server/app/dashboard/prompt-injection.html +1 -1
  329. package/app/.next-cli-build/server/app/dashboard/prompt-injection.rsc +8 -8
  330. package/app/.next-cli-build/server/app/dashboard/prompt-injection.segments/!KGRhc2hib2FyZCk/dashboard/prompt-injection/__PAGE__.segment.rsc +8 -8
  331. package/app/.next-cli-build/server/app/dashboard/prompt-injection.segments/_full.segment.rsc +8 -8
  332. package/app/.next-cli-build/server/app/dashboard/prompt-injection.segments/_tree.segment.rsc +2 -2
  333. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  334. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +7 -7
  335. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +7 -7
  336. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +7 -7
  337. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  338. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  339. package/app/.next-cli-build/server/app/dashboard/providers.rsc +8 -8
  340. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +8 -8
  341. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +8 -8
  342. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  343. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  344. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +8 -8
  345. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +8 -8
  346. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +8 -8
  347. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  348. package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  349. package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +8 -8
  350. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +8 -8
  351. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +8 -8
  352. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +2 -2
  353. package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
  354. package/app/.next-cli-build/server/app/dashboard/quota.rsc +8 -8
  355. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +8 -8
  356. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +8 -8
  357. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  358. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +1 -1
  359. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  360. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  361. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  362. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +8 -8
  363. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +8 -8
  364. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  365. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +8 -8
  366. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  367. package/app/.next-cli-build/server/app/dashboard/skills.rsc +8 -8
  368. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +8 -8
  369. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +8 -8
  370. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
  371. package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  372. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +8 -8
  373. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +8 -8
  374. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +8 -8
  375. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +2 -2
  376. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  377. package/app/.next-cli-build/server/app/dashboard/translator.rsc +7 -7
  378. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +7 -7
  379. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +7 -7
  380. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  381. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  382. package/app/.next-cli-build/server/app/dashboard/usage.rsc +9 -9
  383. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +9 -9
  384. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +9 -9
  385. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  386. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  387. package/app/.next-cli-build/server/app/dashboard.rsc +8 -8
  388. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +8 -8
  389. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +8 -8
  390. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  391. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  392. package/app/.next-cli-build/server/app/index.html +1 -1
  393. package/app/.next-cli-build/server/app/index.rsc +7 -7
  394. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +7 -7
  395. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +7 -7
  396. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  397. package/app/.next-cli-build/server/app/landing/page.js +1 -1
  398. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  399. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  400. package/app/.next-cli-build/server/app/landing.html +1 -1
  401. package/app/.next-cli-build/server/app/landing.rsc +8 -8
  402. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +8 -8
  403. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
  404. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +8 -8
  405. package/app/.next-cli-build/server/app/login/page.js +1 -1
  406. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  407. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  408. package/app/.next-cli-build/server/app/login.html +1 -1
  409. package/app/.next-cli-build/server/app/login.rsc +8 -8
  410. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +8 -8
  411. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
  412. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +8 -8
  413. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  414. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  415. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  416. package/app/.next-cli-build/server/app-paths-manifest.json +19 -19
  417. package/app/.next-cli-build/server/chunks/1051.js +1 -1
  418. package/app/.next-cli-build/server/chunks/2172.js +1 -1
  419. package/app/.next-cli-build/server/chunks/3449.js +1 -1
  420. package/app/.next-cli-build/server/chunks/3697.js +1 -1
  421. package/app/.next-cli-build/server/chunks/412.js +6 -6
  422. package/app/.next-cli-build/server/chunks/4190.js +1 -1
  423. package/app/.next-cli-build/server/chunks/4620.js +1 -0
  424. package/app/.next-cli-build/server/chunks/5299.js +7 -7
  425. package/app/.next-cli-build/server/chunks/615.js +1 -1
  426. package/app/.next-cli-build/server/chunks/6708.js +1 -1
  427. package/app/.next-cli-build/server/chunks/7066.js +1 -1
  428. package/app/.next-cli-build/server/chunks/8128.js +1 -1
  429. package/app/.next-cli-build/server/chunks/8251.js +1 -1
  430. package/app/.next-cli-build/server/chunks/8682.js +3 -3
  431. package/app/.next-cli-build/server/chunks/869.js +1 -1
  432. package/app/.next-cli-build/server/chunks/9604.js +1 -1
  433. package/app/.next-cli-build/server/instrumentation.js.nft.json +1 -1
  434. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  435. package/app/.next-cli-build/server/middleware-react-loadable-manifest.js +1 -1
  436. package/app/.next-cli-build/server/middleware.js.nft.json +1 -1
  437. package/app/.next-cli-build/server/pages/404.html +1 -1
  438. package/app/.next-cli-build/server/pages/500.html +1 -1
  439. package/app/.next-cli-build/static/chunks/{124.b7052d76521ac60b.js → 124.2dcfd9a087c9e48b.js} +1 -1
  440. package/app/.next-cli-build/static/chunks/{2435.51481baa53b475e1.js → 2435.7cc8c894f4a21999.js} +1 -1
  441. package/app/.next-cli-build/static/chunks/{2470-e9f1fd5f21c43fac.js → 2470-73a591ec7a5bdf40.js} +1 -1
  442. package/app/.next-cli-build/static/chunks/3521.96065c08772d432e.js +1 -0
  443. package/app/.next-cli-build/static/chunks/3557-ab733a862d0bba72.js +10 -0
  444. package/app/.next-cli-build/static/chunks/{5462.500e87268a882da6.js → 5462.b5dccc4c3626a6a1.js} +1 -1
  445. package/app/.next-cli-build/static/chunks/5496-336ad33bc5785fb5.js +9 -0
  446. package/app/.next-cli-build/static/chunks/5497-b6161d058c4b63f4.js +1 -0
  447. package/app/.next-cli-build/static/chunks/6808-ecaf0603c2c647dd.js +1 -0
  448. package/app/.next-cli-build/static/chunks/761-748923a2523301a7.js +132 -0
  449. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/page-dc2bbddae0338265.js +1 -0
  450. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-946dbaff84568fd1.js +1 -0
  451. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/page-c995565de72de5d6.js +1 -0
  452. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-569d2ce1c361cb5b.js → page-e9856c47cc41d2f2.js} +5 -5
  453. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/page-d8d32b819432e76e.js +1 -0
  454. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/prompt-injection/page-c0c7f0ec4d840259.js +1 -0
  455. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-745147f2bf98d096.js +27 -0
  456. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-3006aca559388a7a.js +1 -0
  457. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-c832cd28ad361668.js +4 -0
  458. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/pxpipe/page-f4d89bf3d96928c9.js +1 -0
  459. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-33826a8bc196b7de.js +1 -0
  460. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/page-6acecf90f03a1af3.js +1 -0
  461. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/token-saver/page-71814d68cea6ef7d.js +1 -0
  462. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-ebe244550b022a8f.js +1 -0
  463. package/app/.next-cli-build/static/chunks/app/(dashboard)/layout-84ba30538381db07.js +1 -0
  464. package/app/.next-cli-build/static/chunks/app/dashboard/settings/pricing/page-607b1f15b82c8bba.js +1 -0
  465. package/app/.next-cli-build/static/chunks/app/landing/page-3e38f4876602c2fb.js +1 -0
  466. package/app/.next-cli-build/static/chunks/app/{layout-5be078fd5da689ca.js → layout-8e337d947af1970c.js} +1 -1
  467. package/app/.next-cli-build/static/chunks/app/login/{page-d50a71c8703d2790.js → page-17082356385ade34.js} +1 -1
  468. package/app/.next-cli-build/static/chunks/{webpack-01b0b9fe7dbba18d.js → webpack-a1905b20ab1a879d.js} +1 -1
  469. package/app/.next-cli-build/static/css/d7b388223f36a397.css +1 -0
  470. package/app/package.json +1 -1
  471. package/app/public/favicon.svg +2 -12
  472. package/app/public/fonts/arabic-subset.ttf +0 -0
  473. package/app/public/fonts/bengali-subset.ttf +0 -0
  474. package/app/public/fonts/devanagari-subset.ttf +0 -0
  475. package/app/public/fonts/hebrew-subset.ttf +0 -0
  476. package/app/public/fonts/jp-subset.ttf +0 -0
  477. package/app/public/fonts/khmer-subset.ttf +0 -0
  478. package/app/public/fonts/kr-subset.ttf +0 -0
  479. package/app/public/fonts/sc-subset.ttf +0 -0
  480. package/app/public/fonts/tc-subset.ttf +0 -0
  481. package/app/public/fonts/thai-subset.ttf +0 -0
  482. package/package.json +1 -1
  483. package/app/.next-cli-build/server/chunks/5626.js +0 -1
  484. package/app/.next-cli-build/static/chunks/3521.03e47d524e0fcbf6.js +0 -1
  485. package/app/.next-cli-build/static/chunks/3557-437defff109ccb42.js +0 -10
  486. package/app/.next-cli-build/static/chunks/5496-a3a9ad577f310490.js +0 -9
  487. package/app/.next-cli-build/static/chunks/5497-3add1c35ece30dbf.js +0 -1
  488. package/app/.next-cli-build/static/chunks/6808-4e4ca2233c09ffad.js +0 -1
  489. package/app/.next-cli-build/static/chunks/761-00700c1c25957243.js +0 -132
  490. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/page-7feaa4a67a8eb771.js +0 -1
  491. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-624e8d61fe459544.js +0 -1
  492. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/page-5da47ad2a6d8d5de.js +0 -1
  493. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/page-628c4ef1c9482980.js +0 -1
  494. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/prompt-injection/page-35a6881f7569aa64.js +0 -1
  495. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-3b9d43febf1e79d4.js +0 -27
  496. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-e9c955f52e5ae812.js +0 -1
  497. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-bbf57717de4a9782.js +0 -4
  498. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/pxpipe/page-b275a947fc978997.js +0 -1
  499. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-5434337e59f24de1.js +0 -1
  500. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/page-c7eb81dfb0b4fd77.js +0 -1
  501. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/token-saver/page-1b0510b28ff8de92.js +0 -1
  502. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-be974a86e9053540.js +0 -1
  503. package/app/.next-cli-build/static/chunks/app/(dashboard)/layout-18c2613dd78ff66f.js +0 -1
  504. package/app/.next-cli-build/static/chunks/app/dashboard/settings/pricing/page-c439d82cf7840dc9.js +0 -1
  505. package/app/.next-cli-build/static/chunks/app/landing/page-38fc3c430a1a29dc.js +0 -1
  506. package/app/.next-cli-build/static/css/841943e9a30fe5cd.css +0 -1
  507. /package/app/.next-cli-build/static/{7Sq72xYQxt_cCm5BESVbY → nPdnpoRoh59z5OwsCS3Vd}/_buildManifest.js +0 -0
  508. /package/app/.next-cli-build/static/{7Sq72xYQxt_cCm5BESVbY → nPdnpoRoh59z5OwsCS3Vd}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[182],{5539:(e,t,a)=>{"use strict";a.d(t,{A:()=>m,w:()=>d});var s=a(95155),l=a(12115),r=a(14051),o=a.n(r),n=a(35497),i=a(73006);let d=new Set(["grok-web","chatgpt-web","gemini-web","muse-web","deepseek-web","uc-web"]),c={default:"person",grok:"bolt",work:"work",personal:"home"},u=[{key:"opening",label:"Opening browser window",icon:"open_in_new"},{key:"waiting",label:"Waiting for you to log in",icon:"hourglass_top"},{key:"saving",label:"Saving connection",icon:"save"}];function m({providerId:e,onConnected:t,size:a="sm"}){let[r,o]=(0,l.useState)(!1),[d,p]=(0,l.useState)("idle"),[x,h]=(0,l.useState)(""),[b,g]=(0,l.useState)(["default"]),[f,y]=(0,l.useState)("default"),v=(0,l.useRef)(null),j=(0,l.useRef)(null),w=(0,l.useCallback)(()=>{v.current&&(clearInterval(v.current),v.current=null)},[]);(0,l.useEffect)(()=>()=>{w(),j.current&&clearTimeout(j.current)},[w]),(0,l.useEffect)(()=>{if(!r)return;let t=!1;return fetch("/api/providers/web-login",{cache:"no-store"}).then(e=>e.json()).then(a=>{if(t||!Array.isArray(a.profiles))return;let s=window.localStorage.getItem(`weblogin:profile:${e}`),l=a.profiles.includes("default")?a.profiles:["default",...a.profiles];g(l),y(s&&l.includes(s)?s:"default")}).catch(()=>{}),()=>{t=!0}},[r,e]);let N=(0,l.useCallback)(t=>{y(t),window.localStorage.setItem(`weblogin:profile:${e}`,t)},[e]),k="opening"===d||"waiting"===d,C=(0,l.useCallback)(()=>{k||(w(),o(!1),"error"===d&&(p("idle"),h("")))},[k,d,w]),S=(0,l.useCallback)(()=>{w(),v.current=setInterval(async()=>{try{let a=await fetch(`/api/providers/web-login?provider=${encodeURIComponent(e)}`,{cache:"no-store"}),s=await a.json();"success"===s.status?(w(),p("success"),h(s.email?`${(0,i.Tl)("Signed in as")} ${s.email}`:"Connection saved"),"function"==typeof t&&t(),j.current=setTimeout(()=>{o(!1),h("")},1500)):"error"===s.status||"timeout"===s.status||"cancelled"===s.status?(w(),p("error"),h(s.error||(0,i.Tl)("Login failed"))):p(e=>"opening"===e?"waiting":e)}catch{}},2e3)},[e,t,w]),$=(0,l.useCallback)(async()=>{p("opening"),h("");try{let t=await fetch("/api/providers/web-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,profile:f})}),a=await t.json();if(!t.ok){p("error"),h(a.error||(0,i.Tl)("Failed to start login"));return}p("waiting"),h((0,i.Tl)("A browser window has opened - log in there, this page updates itself.")),S()}catch(e){p("error"),h(e?.message||(0,i.Tl)("Failed to start login"))}},[e,f,S]),_=(0,l.useCallback)(()=>{fetch(`/api/providers/web-login?provider=${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{}),w(),p("idle"),h("")},[e,w]),T=(0,l.useCallback)(()=>{let e=window.prompt((0,i.Tl)("New browser profile name (e.g. work, personal):"),"");if(!e)return;let t=e.trim().replace(/[^a-zA-Z0-9_-]/g,"-").slice(0,40);t&&(g(e=>e.includes(t)?e:[...e,t]),N(t))},[N]),A="opening"===d?0:"waiting"===d?1:"success"===d?2:-1;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.$n,{size:a,icon:"success"===d?"check_circle":"language",variant:"secondary",onClick:()=>{p("idle"),h(""),o(!0)},title:(0,i.Tl)("Open a browser window, log in by hand - the cookie is captured automatically"),children:"success"===d?(0,i.Tl)("Connected"):(0,i.Tl)("Login via Browser")}),(0,s.jsx)(n.aF,{isOpen:r,onClose:C,title:(0,i.Tl)("Login via Browser"),size:"sm",children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)("p",{className:"text-xs text-text-muted",children:(0,i.Tl)("A Chrome window opens on a shared browser profile. Log in there - the session is captured automatically. One Google login in a profile makes every other provider a single “Continue with Google” click.")}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:(0,i.Tl)("Browser profile")}),(0,s.jsxs)("button",{type:"button",onClick:T,disabled:k,className:"flex items-center gap-1 text-xs text-primary hover:underline disabled:opacity-50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"add"}),(0,i.Tl)("New profile")]})]}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2",children:b.map(e=>{let t=e===f;return(0,s.jsxs)("button",{type:"button",disabled:k,onClick:()=>N(e),className:`flex items-center gap-2 rounded border border-accent/30 bg-sidebar p-2 text-left text-sm transition-colors focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50 ${t?"border-primary ring-1 ring-primary":"hover:border-accent/60"}`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:function(e){let t=String(e).toLowerCase();for(let[e,a]of Object.entries(c))if(t.includes(e))return a;return"folder_shared"}(e)}),(0,s.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e}),t&&(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"check_circle"})]},e)})})]}),"idle"!==d&&(0,s.jsx)("div",{className:"rounded border border-accent/20 bg-sidebar/50 p-3",children:"success"===d?(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-green-400",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"check_circle"}),"✓ ",x||(0,i.Tl)("Connection saved")]}):"error"===d?(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-yellow-400",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"error"}),(0,i.Tl)("Login failed")]}),x&&(0,s.jsx)("p",{className:"pl-6 text-xs text-red-500 break-words",children:x})]}):(0,s.jsxs)("ol",{className:"flex flex-col gap-2",children:[u.map((e,t)=>{let a=t<A,l=t===A;return(0,s.jsxs)("li",{className:`flex items-center gap-2 text-sm ${a?"text-green-400":l?"text-primary":"text-text-muted opacity-50"}`,children:[(0,s.jsx)("span",{className:`material-symbols-outlined text-[18px] ${l?"animate-pulse":""}`,children:a?"check_circle":e.icon}),(0,i.Tl)(e.label)]},e.key)}),x&&(0,s.jsx)("li",{className:"pl-6 text-xs text-text-muted",children:x})]})}),(0,s.jsx)("div",{className:"flex gap-2",children:"success"===d?(0,s.jsx)(n.$n,{onClick:C,fullWidth:!0,children:(0,i.Tl)("Done")}):k?(0,s.jsx)(n.$n,{onClick:_,variant:"ghost",fullWidth:!0,children:(0,i.Tl)("Cancel")}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.$n,{onClick:$,fullWidth:!0,disabled:"error"===d&&!x,children:(0,i.Tl)("Open Browser & Login")}),(0,s.jsx)(n.$n,{onClick:C,variant:"ghost",fullWidth:!0,disabled:k,children:(0,i.Tl)("Close")})]})})]})})]})}m.propTypes={providerId:o().string.isRequired,onConnected:o().func,size:o().oneOf(["sm","md","lg"])}},41095:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>B});var s=a(95155),l=a(73321),r=a(98500),o=a.n(r),n=a(12115),i=a(35497),d=a(57250),c=a(88105),u=a(70217),m=a(14051),p=a.n(m),x=a(5539);function h({until:e}){let[t,a]=(0,n.useState)("");return((0,n.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void a("");let s=Math.floor(t/1e3);s<60?a(`${s}s`):s<3600?a(`${Math.floor(s/60)}m ${s%60}s`):a(`${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-warning font-mono",children:["⏱ ",t]}):null}function b({connection:e,proxyPools:t,isOAuth:a,isFirst:l,isLast:r,onMoveUp:o,onMoveDown:d,onToggleActive:c,onUpdateProxy:m,onEdit:p,onDelete:x}){let[g,f]=(0,n.useState)(!1),[y,v]=(0,n.useState)(!1),[j,w]=(0,n.useState)(!1),N=(0,n.useRef)(null),k=new Map((t||[]).map(e=>[e.id,e])),C=e.providerSpecificData?.proxyPoolId||null,S=C?k.get(C):null,$=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,_=!!C||$,T=S?`Pool: ${S.name}`:C?`Pool: ${C} (inactive/missing)`:$?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",A="",I=S?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;if(I)try{let e=new URL(I);A=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{A=I}let P=S?.noProxy||e.providerSpecificData?.connectionNoProxy||"",R=S?.isActive===!0?"success":C||$?"error":"default",E=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(Boolean).sort()[0]||null;(0,n.useEffect)(()=>{let t=()=>{w(!!Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>e&&new Date(e).getTime()>Date.now()).sort()[0])};t();let a=E?setInterval(t,1e3):null;return()=>{a&&clearInterval(a)}},[E]),(0,n.useEffect)(()=>{if(!g)return;let e=e=>{N.current&&!N.current.contains(e.target)&&f(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[g]);let O="unavailable"!==e.testStatus||j?e.testStatus:"active",L=a?e.name||e.email||e.displayName||"OAuth Account":e.name,M=async e=>{v(!0);try{await m("__none__"===e?null:e)}finally{v(!1),f(!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:o,disabled:l,className:`p-0.5 rounded ${l?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,s.jsx)("button",{onClick:d,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,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:a?"lock":"key"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:L}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-1",children:[(0,s.jsx)(i.Ex,{variant:(0,u.g)(e.isActive,O),size:"sm",dot:!0,children:!1===e.isActive?"disabled":O||"Unknown"}),_&&(0,s.jsx)(i.Ex,{variant:R,size:"sm",children:"Proxy"}),j&&!1!==e.isActive&&(0,s.jsx)(h,{until:E}),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]})]}),_&&(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:T,children:T}),A&&(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:A}),P&&(0,s.jsxs)("span",{className:"text-[11px] text-text-muted truncate max-w-[320px]",title:P,children:["no_proxy: ",P]})]})]})]}),(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:N,children:[(0,s.jsxs)("button",{onClick:()=>f(e=>!e),className:`flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 transition-colors ${_?"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"})]}),g&&(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:()=>M("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!C?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,s.jsx)("button",{onClick:()=>M(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${C===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),(0,s.jsxs)("button",{onClick:p,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:x,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:a,proxyPools:l,onSave:r,onClose:o}){let d="__none__",[c,u]=(0,n.useState)({name:"",apiKey:"",priority:1,proxyPoolId:d}),[m,p]=(0,n.useState)(!1),[x,h]=(0,n.useState)(null),[b,f]=(0,n.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})}),a=await e.json();h(a.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 a=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:c.apiKey})});e=!!(await a.json()).valid,h(e?"success":"failed")}catch{h("failed")}finally{p(!1)}await r({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 ${a||t} API Key`,onClose:o,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"},...(l||[]).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:o,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function f({providerId:e,isOAuth:t,loginProviderId:a=null}){let[l,r]=(0,n.useState)([]),[o,d]=(0,n.useState)([]),[c,u]=(0,n.useState)(!0),[m,p]=(0,n.useState)(!1),[h,y]=(0,n.useState)(!1),[v,j]=(0,n.useState)(null),[w,N]=(0,n.useState)(null),[k,C]=(0,n.useState)("1"),[S,$]=(0,n.useState)(null),_=(0,n.useCallback)(async()=>{try{let[t,a,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"})]),l=await t.json(),o=await a.json(),n=s.ok?await s.json():{};t.ok&&r((l.connections||[]).filter(t=>t.provider===e)),a.ok&&d(o.proxyPools||[]);let i=(n.providerStrategies||{})[e]||{};N(i.fallbackStrategy||null),C(null!=i.stickyRoundRobinLimit?String(i.stickyRoundRobinLimit):"1")}catch(e){console.log("ConnectionsCard fetch error:",e)}finally{u(!1)}},[e]);(0,n.useEffect)(()=>{_()},[_]);let T=async(t,a)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),l=(s.ok?await s.json():{}).providerStrategies||{},r={};t&&(r.fallbackStrategy=t),"round-robin"===t&&""!==a&&(r.stickyRoundRobinLimit=Number(a)||3);let o={...l};0===Object.keys(r).length?delete o[e]:o[e]=r,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:o})})}catch(e){console.log("saveStrategy error:",e)}},A=async(e,t)=>{let a=[...l];[a[e],a[t]]=[a[t],a[e]],r(a);try{await Promise.all([fetch(`/api/providers/${a[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${a[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])}catch{await _()}},I=async e=>{$({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{$(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&r(t=>t.filter(t=>t.id!==e))}catch(e){console.log("delete error:",e)}}})},P=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&r(a=>a.map(a=>a.id===e?{...a,isActive:t}:a))}catch(e){console.log("toggle error:",e)}},R=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&r(a=>a.map(a=>a.id===e?{...a,providerSpecificData:{...a.providerSpecificData,proxyPoolId:t||null}}:a))}catch(e){console.log("proxy error:",e)}},E=async t=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,...t})})).ok&&(await _(),p(!1))}catch(e){console.log("save apikey error:",e)}},O=async e=>{try{(await fetch(`/api/providers/${v.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await _(),y(!1))}catch(e){console.log("update connection error:",e)}};return c?(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.5 rounded-lg border border-border bg-surface-2/40 px-3 py-2",children:[(0,s.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-wider text-text-subtle",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"),T(t,e?k||"1":k)}}),"round-robin"===w&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,s.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:"Sticky:"}),(0,s.jsx)("input",{type:"number",min:1,value:k,onChange:e=>{C(e.target.value),T("round-robin",e.target.value)},className:"w-16 rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs text-text-main focus:border-text-subtle focus:outline-none"})]})]})]}),0===l.length?(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.jsxs)("div",{className:"flex flex-wrap gap-2",children:[a&&(0,s.jsx)(x.A,{providerId:a,onConnected:_}),(0,s.jsx)(i.$n,{size:"sm",icon:"add",onClick:()=>p(!0),children:"Add Connection"})]})]}):(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] max-h-[500px] overflow-y-auto pr-1",children:l.map((e,a)=>(0,s.jsx)(b,{connection:e,proxyPools:o,isOAuth:t,isFirst:0===a,isLast:a===l.length-1,onMoveUp:()=>A(a,a-1),onMoveDown:()=>A(a,a+1),onToggleActive:t=>P(e.id,t),onUpdateProxy:t=>R(e.id,t),onEdit:()=>{j(e),y(!0)},onDelete:()=>I(e.id)},e.id))}),(0,s.jsxs)("div",{className:"mt-4 flex justify-stretch gap-2 sm:justify-start",children:[(0,s.jsx)(i.$n,{size:"sm",icon:"add",onClick:()=>p(!0),children:"Add"}),a&&(0,s.jsx)(x.A,{providerId:a,onConnected:_})]})]})]}),(0,s.jsx)(g,{isOpen:m,provider:e,proxyPools:o,onSave:E,onClose:()=>p(!1)}),(0,s.jsx)(i.wI,{isOpen:h,connection:v,proxyPools:o,onSave:O,onClose:()=>y(!1)}),(0,s.jsx)(i.uo,{isOpen:!!S,onClose:()=>$(null),onConfirm:S?.onConfirm,title:S?.title||"Confirm",message:S?.message,variant:"danger"})]})}h.propTypes={until:p().string.isRequired},b.propTypes={connection:p().shape({id:p().string,name:p().string,email:p().string,displayName:p().string,testStatus:p().string,isActive:p().bool,lastError:p().string,priority:p().number}).isRequired,proxyPools:p().array,isOAuth:p().bool.isRequired,isFirst:p().bool.isRequired,isLast:p().bool.isRequired,onMoveUp:p().func.isRequired,onMoveDown:p().func.isRequired,onToggleActive:p().func.isRequired,onUpdateProxy:p().func,onEdit:p().func.isRequired,onDelete:p().func.isRequired},g.propTypes={isOpen:p().bool.isRequired,provider:p().string,providerName:p().string,proxyPools:p().array,onSave:p().func.isRequired,onClose:p().func.isRequired},f.propTypes={providerId:p().string.isRequired,isOAuth:p().bool,loginProviderId:p().string};var y=a(28777),v=a(11059);function j({model:e,fullModel:t,copied:a,onCopy:l,testStatus:r,isCustom:o,isFree:n,onDeleteAlias:i,onTest:d,isTesting:c}){let u="ok"===r?"#22c55e":"error"===r?"#ef4444":void 0;return(0,s.jsx)("div",{className:`group px-3 py-2 rounded-lg border ${"ok"===r?"border-green-500/40":"error"===r?"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"===r?"check_circle":"error"===r?"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:()=>l(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:a===`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:a===`model-${e.id}`?"Copied!":"Copy"})]}),n&&(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"}),o&&(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 w({isOpen:e,onSave:t,onClose:a}){let[l,r]=(0,n.useState)(""),o=()=>{l.trim()&&(t(l.trim()),r(""))};return(0,s.jsx)(i.aF,{isOpen:e,title:"Add Custom Model",onClose:a,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:l,onChange:e=>r(e.target.value),onKeyDown:e=>"Enter"===e.key&&o(),placeholder:"e.g. tts-1-hd",autoFocus:!0})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(i.$n,{onClick:o,fullWidth:!0,disabled:!l.trim(),children:"Add"}),(0,s.jsx)(i.$n,{onClick:a,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function N({providerId:e,kindFilter:t,providerAliasOverride:a}){let{copied:l,copy:r}=(0,v.C)(),[o,d]=(0,n.useState)({}),[u,m]=(0,n.useState)([]),[p,x]=(0,n.useState)({}),[h,b]=(0,n.useState)(null),[g,f]=(0,n.useState)(""),[k,C]=(0,n.useState)(!1),S=a||(0,c.wG)(e),$=t||"llm",_=(0,n.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch("/api/models/alias"),fetch("/api/models/custom",{cache:"no-store"})]),a=await e.json(),s=await t.json();e.ok&&d(a.aliases||{}),t.ok&&m(s.models||[])}catch(e){console.log("ModelsCard fetch error:",e)}},[]);(0,n.useEffect)(()=>{_()},[_]);let T=async(e,t)=>{let a=`${S}/${e}`;try{(await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a,alias:t})})).ok&&await _()}catch(e){console.log("set alias error:",e)}},A=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await _()}catch(e){console.log("delete alias error:",e)}},I=async e=>{try{(await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:S,id:e,type:$})})).ok&&(await _(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("add custom model error:",e)}},P=async e=>{try{let t=new URLSearchParams({providerAlias:S,id:e,type:$});(await fetch(`/api/models/custom?${t}`,{method:"DELETE"})).ok&&(await _(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("delete custom model error:",e)}},R=async e=>{if(!h){b(e);try{let a=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${S}/${e}`,kind:t})}),s=await a.json();x(t=>({...t,[e]:s.ok?"ok":"error"})),f(s.ok?"":s.error||"Model not reachable")}catch{x(t=>({...t,[e]:"error"})),f("Network error")}finally{b(null)}}},E=(0,y.KC)(e),O=t?E.filter(e=>e.kinds?e.kinds.includes(t):(0,y.CP)(e,"llm")===t):E,L=u.filter(e=>e.providerAlias===S&&(0,y.CP)(e,"llm")===$&&!O.some(t=>t.id===e.id));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()}`:""]})}),g&&(0,s.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:g}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-3",children:[O.map(e=>{let t=`${S}/${e.id}`,a=Object.entries(o).find(([,e])=>e===t)?.[0];return(0,s.jsx)(j,{model:e,fullModel:`${S}/${e.id}`,alias:a,copied:l,onCopy:r,onSetAlias:t=>T(e.id,t),onDeleteAlias:()=>A(a),testStatus:p[e.id],onTest:()=>R(e.id),isTesting:h===e.id,isFree:e.isFree},e.id)}),L.map(e=>(0,s.jsx)(j,{model:{id:e.id,name:e.name},fullModel:`${S}/${e.id}`,copied:l,onCopy:r,onSetAlias:()=>{},onDeleteAlias:()=>P(e.id),testStatus:p[e.id],onTest:()=>R(e.id),isTesting:h===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)(w,{isOpen:k,onSave:async e=>{await I(e),C(!1)},onClose:()=>C(!1)})]})}function k({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})]})}j.propTypes={model:p().shape({id:p().string.isRequired}).isRequired,fullModel:p().string.isRequired,copied:p().string,onCopy:p().func.isRequired,testStatus:p().oneOf(["ok","error"]),isCustom:p().bool,isFree:p().bool,onDeleteAlias:p().func,onTest:p().func,isTesting:p().bool},w.propTypes={isOpen:p().bool.isRequired,onSave:p().func.isRequired,onClose:p().func.isRequired},N.propTypes={providerId:p().string.isRequired,kindFilter:p().string,providerAliasOverride:p().string};let C={webSearch:{inputLabel:"Query",inputPlaceholder:"What is the latest news about AI?",defaultInput:"What is the latest news about AI?",bodyKey:"query",defaultResponse:`{
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[182],{5539:(e,t,a)=>{"use strict";a.d(t,{A:()=>m,w:()=>d});var s=a(95155),l=a(12115),r=a(14051),o=a.n(r),n=a(35497),i=a(73006);let d=new Set(["grok-web","chatgpt-web","gemini-web","muse-web","deepseek-web","uc-web"]),c={default:"person",grok:"bolt",work:"work",personal:"home"},u=[{key:"opening",label:"Opening browser window",icon:"open_in_new"},{key:"waiting",label:"Waiting for you to log in",icon:"hourglass_top"},{key:"saving",label:"Saving connection",icon:"save"}];function m({providerId:e,onConnected:t,size:a="sm"}){let[r,o]=(0,l.useState)(!1),[d,p]=(0,l.useState)("idle"),[x,h]=(0,l.useState)(""),[b,g]=(0,l.useState)(["default"]),[f,y]=(0,l.useState)("default"),v=(0,l.useRef)(null),j=(0,l.useRef)(null),w=(0,l.useCallback)(()=>{v.current&&(clearInterval(v.current),v.current=null)},[]);(0,l.useEffect)(()=>()=>{w(),j.current&&clearTimeout(j.current)},[w]),(0,l.useEffect)(()=>{if(!r)return;let t=!1;return fetch("/api/providers/web-login",{cache:"no-store"}).then(e=>e.json()).then(a=>{if(t||!Array.isArray(a.profiles))return;let s=window.localStorage.getItem(`weblogin:profile:${e}`),l=a.profiles.includes("default")?a.profiles:["default",...a.profiles];g(l),y(s&&l.includes(s)?s:"default")}).catch(()=>{}),()=>{t=!0}},[r,e]);let N=(0,l.useCallback)(t=>{y(t),window.localStorage.setItem(`weblogin:profile:${e}`,t)},[e]),k="opening"===d||"waiting"===d,C=(0,l.useCallback)(()=>{k||(w(),o(!1),"error"===d&&(p("idle"),h("")))},[k,d,w]),S=(0,l.useCallback)(()=>{w(),v.current=setInterval(async()=>{try{let a=await fetch(`/api/providers/web-login?provider=${encodeURIComponent(e)}`,{cache:"no-store"}),s=await a.json();"success"===s.status?(w(),p("success"),h(s.email?`${(0,i.Tl)("Signed in as")} ${s.email}`:"Connection saved"),"function"==typeof t&&t(),j.current=setTimeout(()=>{o(!1),h("")},1500)):"error"===s.status||"timeout"===s.status||"cancelled"===s.status?(w(),p("error"),h(s.error||(0,i.Tl)("Login failed"))):p(e=>"opening"===e?"waiting":e)}catch{}},2e3)},[e,t,w]),$=(0,l.useCallback)(async()=>{p("opening"),h("");try{let t=await fetch("/api/providers/web-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,profile:f})}),a=await t.json();if(!t.ok){p("error"),h(a.error||(0,i.Tl)("Failed to start login"));return}p("waiting"),h((0,i.Tl)("A browser window has opened - log in there, this page updates itself.")),S()}catch(e){p("error"),h(e?.message||(0,i.Tl)("Failed to start login"))}},[e,f,S]),_=(0,l.useCallback)(()=>{fetch(`/api/providers/web-login?provider=${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{}),w(),p("idle"),h("")},[e,w]),T=(0,l.useCallback)(()=>{let e=window.prompt((0,i.Tl)("New browser profile name (e.g. work, personal):"),"");if(!e)return;let t=e.trim().replace(/[^a-zA-Z0-9_-]/g,"-").slice(0,40);t&&(g(e=>e.includes(t)?e:[...e,t]),N(t))},[N]),A="opening"===d?0:"waiting"===d?1:"success"===d?2:-1;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.$n,{size:a,icon:"success"===d?"check_circle":"language",variant:"secondary",onClick:()=>{p("idle"),h(""),o(!0)},title:(0,i.Tl)("Open a browser window, log in by hand - the cookie is captured automatically"),children:"success"===d?(0,i.Tl)("Connected"):(0,i.Tl)("Login via Browser")}),(0,s.jsx)(n.aF,{isOpen:r,onClose:C,title:(0,i.Tl)("Login via Browser"),size:"sm",children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)("p",{className:"text-xs text-text-muted",children:(0,i.Tl)("A Chrome window opens on a shared browser profile. Log in there - the session is captured automatically. One Google login in a profile makes every other provider a single “Continue with Google” click.")}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:(0,i.Tl)("Browser profile")}),(0,s.jsxs)("button",{type:"button",onClick:T,disabled:k,className:"flex items-center gap-1 text-xs text-primary hover:underline disabled:opacity-50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"add"}),(0,i.Tl)("New profile")]})]}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2",children:b.map(e=>{let t=e===f;return(0,s.jsxs)("button",{type:"button",disabled:k,onClick:()=>N(e),className:`flex items-center gap-2 rounded border border-accent/30 bg-sidebar p-2 text-left text-sm transition-colors focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50 ${t?"border-primary ring-1 ring-primary":"hover:border-accent/60"}`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:function(e){let t=String(e).toLowerCase();for(let[e,a]of Object.entries(c))if(t.includes(e))return a;return"folder_shared"}(e)}),(0,s.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e}),t&&(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"check_circle"})]},e)})})]}),"idle"!==d&&(0,s.jsx)("div",{className:"rounded border border-accent/20 bg-sidebar/50 p-3",children:"success"===d?(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-green-400",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"check_circle"}),"✓ ",x||(0,i.Tl)("Connection saved")]}):"error"===d?(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-yellow-400",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"error"}),(0,i.Tl)("Login failed")]}),x&&(0,s.jsx)("p",{className:"pl-6 text-xs text-red-500 break-words",children:x})]}):(0,s.jsxs)("ol",{className:"flex flex-col gap-2",children:[u.map((e,t)=>{let a=t<A,l=t===A;return(0,s.jsxs)("li",{className:`flex items-center gap-2 text-sm ${a?"text-green-400":l?"text-primary":"text-text-muted opacity-50"}`,children:[(0,s.jsx)("span",{className:`material-symbols-outlined text-[18px] ${l?"animate-pulse":""}`,children:a?"check_circle":e.icon}),(0,i.Tl)(e.label)]},e.key)}),x&&(0,s.jsx)("li",{className:"pl-6 text-xs text-text-muted",children:x})]})}),(0,s.jsx)("div",{className:"flex gap-2",children:"success"===d?(0,s.jsx)(n.$n,{onClick:C,fullWidth:!0,children:(0,i.Tl)("Done")}):k?(0,s.jsx)(n.$n,{onClick:_,variant:"ghost",fullWidth:!0,children:(0,i.Tl)("Cancel")}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.$n,{onClick:$,fullWidth:!0,disabled:"error"===d&&!x,children:(0,i.Tl)("Open Browser & Login")}),(0,s.jsx)(n.$n,{onClick:C,variant:"ghost",fullWidth:!0,disabled:k,children:(0,i.Tl)("Close")})]})})]})})]})}m.propTypes={providerId:o().string.isRequired,onConnected:o().func,size:o().oneOf(["sm","md","lg"])}},41095:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>B});var s=a(95155),l=a(73321),r=a(98500),o=a.n(r),n=a(12115),i=a(35497),d=a(57250),c=a(88105),u=a(70217),m=a(14051),p=a.n(m),x=a(5539);function h({until:e}){let[t,a]=(0,n.useState)("");return((0,n.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void a("");let s=Math.floor(t/1e3);s<60?a(`${s}s`):s<3600?a(`${Math.floor(s/60)}m ${s%60}s`):a(`${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-warning font-mono",children:["⏱ ",t]}):null}function b({connection:e,proxyPools:t,isOAuth:a,isFirst:l,isLast:r,onMoveUp:o,onMoveDown:d,onToggleActive:c,onUpdateProxy:m,onEdit:p,onDelete:x}){let[g,f]=(0,n.useState)(!1),[y,v]=(0,n.useState)(!1),[j,w]=(0,n.useState)(!1),N=(0,n.useRef)(null),k=new Map((t||[]).map(e=>[e.id,e])),C=e.providerSpecificData?.proxyPoolId||null,S=C?k.get(C):null,$=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,_=!!C||$,T=S?`Pool: ${S.name}`:C?`Pool: ${C} (inactive/missing)`:$?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",A="",I=S?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;if(I)try{let e=new URL(I);A=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{A=I}let P=S?.noProxy||e.providerSpecificData?.connectionNoProxy||"",R=S?.isActive===!0?"success":C||$?"error":"default",E=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(Boolean).sort()[0]||null;(0,n.useEffect)(()=>{let t=()=>{w(!!Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>e&&new Date(e).getTime()>Date.now()).sort()[0])};t();let a=E?setInterval(t,1e3):null;return()=>{a&&clearInterval(a)}},[E]),(0,n.useEffect)(()=>{if(!g)return;let e=e=>{N.current&&!N.current.contains(e.target)&&f(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[g]);let O="unavailable"!==e.testStatus||j?e.testStatus:"active",L=a?e.name||e.email||e.displayName||"OAuth Account":e.name,M=async e=>{v(!0);try{await m("__none__"===e?null:e)}finally{v(!1),f(!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:o,disabled:l,className:`p-0.5 rounded ${l?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,s.jsx)("button",{onClick:d,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-primary dark:text-primary",children:a?"lock":"key"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:L}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-1",children:[(0,s.jsx)(i.Ex,{variant:(0,u.g)(e.isActive,O),size:"sm",dot:!0,children:!1===e.isActive?"disabled":O||"Unknown"}),_&&(0,s.jsx)(i.Ex,{variant:R,size:"sm",children:"Proxy"}),j&&!1!==e.isActive&&(0,s.jsx)(h,{until:E}),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]})]}),_&&(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:T,children:T}),A&&(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:A}),P&&(0,s.jsxs)("span",{className:"text-[11px] text-text-muted truncate max-w-[320px]",title:P,children:["no_proxy: ",P]})]})]})]}),(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:N,children:[(0,s.jsxs)("button",{onClick:()=>f(e=>!e),className:`flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 transition-colors ${_?"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"})]}),g&&(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:()=>M("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!C?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,s.jsx)("button",{onClick:()=>M(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${C===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),(0,s.jsxs)("button",{onClick:p,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:x,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:a,proxyPools:l,onSave:r,onClose:o}){let d="__none__",[c,u]=(0,n.useState)({name:"",apiKey:"",priority:1,proxyPoolId:d}),[m,p]=(0,n.useState)(!1),[x,h]=(0,n.useState)(null),[b,f]=(0,n.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})}),a=await e.json();h(a.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 a=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:c.apiKey})});e=!!(await a.json()).valid,h(e?"success":"failed")}catch{h("failed")}finally{p(!1)}await r({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 ${a||t} API Key`,onClose:o,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"},...(l||[]).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:o,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function f({providerId:e,isOAuth:t,loginProviderId:a=null}){let[l,r]=(0,n.useState)([]),[o,d]=(0,n.useState)([]),[c,u]=(0,n.useState)(!0),[m,p]=(0,n.useState)(!1),[h,y]=(0,n.useState)(!1),[v,j]=(0,n.useState)(null),[w,N]=(0,n.useState)(null),[k,C]=(0,n.useState)("1"),[S,$]=(0,n.useState)(null),_=(0,n.useCallback)(async()=>{try{let[t,a,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"})]),l=await t.json(),o=await a.json(),n=s.ok?await s.json():{};t.ok&&r((l.connections||[]).filter(t=>t.provider===e)),a.ok&&d(o.proxyPools||[]);let i=(n.providerStrategies||{})[e]||{};N(i.fallbackStrategy||null),C(null!=i.stickyRoundRobinLimit?String(i.stickyRoundRobinLimit):"1")}catch(e){console.log("ConnectionsCard fetch error:",e)}finally{u(!1)}},[e]);(0,n.useEffect)(()=>{_()},[_]);let T=async(t,a)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),l=(s.ok?await s.json():{}).providerStrategies||{},r={};t&&(r.fallbackStrategy=t),"round-robin"===t&&""!==a&&(r.stickyRoundRobinLimit=Number(a)||3);let o={...l};0===Object.keys(r).length?delete o[e]:o[e]=r,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:o})})}catch(e){console.log("saveStrategy error:",e)}},A=async(e,t)=>{let a=[...l];[a[e],a[t]]=[a[t],a[e]],r(a);try{await Promise.all([fetch(`/api/providers/${a[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${a[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])}catch{await _()}},I=async e=>{$({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{$(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&r(t=>t.filter(t=>t.id!==e))}catch(e){console.log("delete error:",e)}}})},P=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&r(a=>a.map(a=>a.id===e?{...a,isActive:t}:a))}catch(e){console.log("toggle error:",e)}},R=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&r(a=>a.map(a=>a.id===e?{...a,providerSpecificData:{...a.providerSpecificData,proxyPoolId:t||null}}:a))}catch(e){console.log("proxy error:",e)}},E=async t=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,...t})})).ok&&(await _(),p(!1))}catch(e){console.log("save apikey error:",e)}},O=async e=>{try{(await fetch(`/api/providers/${v.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await _(),y(!1))}catch(e){console.log("update connection error:",e)}};return c?(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.5 rounded-lg border border-border bg-surface-2/40 px-3 py-2",children:[(0,s.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-wider text-text-muted",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"),T(t,e?k||"1":k)}}),"round-robin"===w&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,s.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:"Sticky:"}),(0,s.jsx)("input",{type:"number",min:1,value:k,onChange:e=>{C(e.target.value),T("round-robin",e.target.value)},className:"w-16 rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs text-text-main focus:border-text-subtle focus:outline-none"})]})]})]}),0===l.length?(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.jsxs)("div",{className:"flex flex-wrap gap-2",children:[a&&(0,s.jsx)(x.A,{providerId:a,onConnected:_}),(0,s.jsx)(i.$n,{size:"sm",icon:"add",onClick:()=>p(!0),children:"Add Connection"})]})]}):(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] max-h-[500px] overflow-y-auto pr-1",children:l.map((e,a)=>(0,s.jsx)(b,{connection:e,proxyPools:o,isOAuth:t,isFirst:0===a,isLast:a===l.length-1,onMoveUp:()=>A(a,a-1),onMoveDown:()=>A(a,a+1),onToggleActive:t=>P(e.id,t),onUpdateProxy:t=>R(e.id,t),onEdit:()=>{j(e),y(!0)},onDelete:()=>I(e.id)},e.id))}),(0,s.jsxs)("div",{className:"mt-4 flex justify-stretch gap-2 sm:justify-start",children:[(0,s.jsx)(i.$n,{size:"sm",icon:"add",onClick:()=>p(!0),children:"Add"}),a&&(0,s.jsx)(x.A,{providerId:a,onConnected:_})]})]})]}),(0,s.jsx)(g,{isOpen:m,provider:e,proxyPools:o,onSave:E,onClose:()=>p(!1)}),(0,s.jsx)(i.wI,{isOpen:h,connection:v,proxyPools:o,onSave:O,onClose:()=>y(!1)}),(0,s.jsx)(i.uo,{isOpen:!!S,onClose:()=>$(null),onConfirm:S?.onConfirm,title:S?.title||"Confirm",message:S?.message,variant:"danger"})]})}h.propTypes={until:p().string.isRequired},b.propTypes={connection:p().shape({id:p().string,name:p().string,email:p().string,displayName:p().string,testStatus:p().string,isActive:p().bool,lastError:p().string,priority:p().number}).isRequired,proxyPools:p().array,isOAuth:p().bool.isRequired,isFirst:p().bool.isRequired,isLast:p().bool.isRequired,onMoveUp:p().func.isRequired,onMoveDown:p().func.isRequired,onToggleActive:p().func.isRequired,onUpdateProxy:p().func,onEdit:p().func.isRequired,onDelete:p().func.isRequired},g.propTypes={isOpen:p().bool.isRequired,provider:p().string,providerName:p().string,proxyPools:p().array,onSave:p().func.isRequired,onClose:p().func.isRequired},f.propTypes={providerId:p().string.isRequired,isOAuth:p().bool,loginProviderId:p().string};var y=a(28777),v=a(11059);function j({model:e,fullModel:t,copied:a,onCopy:l,testStatus:r,isCustom:o,isFree:n,onDeleteAlias:i,onTest:d,isTesting:c}){let u="ok"===r?"#22c55e":"error"===r?"#ef4444":void 0;return(0,s.jsx)("div",{className:`group px-3 py-2 rounded-lg border ${"ok"===r?"border-green-500/40":"error"===r?"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"===r?"check_circle":"error"===r?"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:()=>l(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:a===`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:a===`model-${e.id}`?"Copied!":"Copy"})]}),n&&(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"}),o&&(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 w({isOpen:e,onSave:t,onClose:a}){let[l,r]=(0,n.useState)(""),o=()=>{l.trim()&&(t(l.trim()),r(""))};return(0,s.jsx)(i.aF,{isOpen:e,title:"Add Custom Model",onClose:a,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:l,onChange:e=>r(e.target.value),onKeyDown:e=>"Enter"===e.key&&o(),placeholder:"e.g. tts-1-hd",autoFocus:!0})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(i.$n,{onClick:o,fullWidth:!0,disabled:!l.trim(),children:"Add"}),(0,s.jsx)(i.$n,{onClick:a,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function N({providerId:e,kindFilter:t,providerAliasOverride:a}){let{copied:l,copy:r}=(0,v.C)(),[o,d]=(0,n.useState)({}),[u,m]=(0,n.useState)([]),[p,x]=(0,n.useState)({}),[h,b]=(0,n.useState)(null),[g,f]=(0,n.useState)(""),[k,C]=(0,n.useState)(!1),S=a||(0,c.wG)(e),$=t||"llm",_=(0,n.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch("/api/models/alias"),fetch("/api/models/custom",{cache:"no-store"})]),a=await e.json(),s=await t.json();e.ok&&d(a.aliases||{}),t.ok&&m(s.models||[])}catch(e){console.log("ModelsCard fetch error:",e)}},[]);(0,n.useEffect)(()=>{_()},[_]);let T=async(e,t)=>{let a=`${S}/${e}`;try{(await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a,alias:t})})).ok&&await _()}catch(e){console.log("set alias error:",e)}},A=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await _()}catch(e){console.log("delete alias error:",e)}},I=async e=>{try{(await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:S,id:e,type:$})})).ok&&(await _(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("add custom model error:",e)}},P=async e=>{try{let t=new URLSearchParams({providerAlias:S,id:e,type:$});(await fetch(`/api/models/custom?${t}`,{method:"DELETE"})).ok&&(await _(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("delete custom model error:",e)}},R=async e=>{if(!h){b(e);try{let a=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${S}/${e}`,kind:t})}),s=await a.json();x(t=>({...t,[e]:s.ok?"ok":"error"})),f(s.ok?"":s.error||"Model not reachable")}catch{x(t=>({...t,[e]:"error"})),f("Network error")}finally{b(null)}}},E=(0,y.KC)(e),O=t?E.filter(e=>e.kinds?e.kinds.includes(t):(0,y.CP)(e,"llm")===t):E,L=u.filter(e=>e.providerAlias===S&&(0,y.CP)(e,"llm")===$&&!O.some(t=>t.id===e.id));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()}`:""]})}),g&&(0,s.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:g}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-3",children:[O.map(e=>{let t=`${S}/${e.id}`,a=Object.entries(o).find(([,e])=>e===t)?.[0];return(0,s.jsx)(j,{model:e,fullModel:`${S}/${e.id}`,alias:a,copied:l,onCopy:r,onSetAlias:t=>T(e.id,t),onDeleteAlias:()=>A(a),testStatus:p[e.id],onTest:()=>R(e.id),isTesting:h===e.id,isFree:e.isFree},e.id)}),L.map(e=>(0,s.jsx)(j,{model:{id:e.id,name:e.name},fullModel:`${S}/${e.id}`,copied:l,onCopy:r,onSetAlias:()=>{},onDeleteAlias:()=>P(e.id),testStatus:p[e.id],onTest:()=>R(e.id),isTesting:h===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)(w,{isOpen:k,onSave:async e=>{await I(e),C(!1)},onClose:()=>C(!1)})]})}function k({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})]})}j.propTypes={model:p().shape({id:p().string.isRequired}).isRequired,fullModel:p().string.isRequired,copied:p().string,onCopy:p().func.isRequired,testStatus:p().oneOf(["ok","error"]),isCustom:p().bool,isFree:p().bool,onDeleteAlias:p().func,onTest:p().func,isTesting:p().bool},w.propTypes={isOpen:p().bool.isRequired,onSave:p().func.isRequired,onClose:p().func.isRequired},N.propTypes={providerId:p().string.isRequired,kindFilter:p().string,providerAliasOverride:p().string};let C={webSearch:{inputLabel:"Query",inputPlaceholder:"What is the latest news about AI?",defaultInput:"What is the latest news about AI?",bodyKey:"query",defaultResponse:`{
2
2
  "results": [
3
3
  { "title": "...", "url": "...", "snippet": "..." }
4
4
  ]
@@ -39,7 +39,7 @@
39
39
  }`;function _({providerId:e,customAlias:t}){let a=(0,c.gC)(e),l=a?t||e:(0,c.wG)(e),r=a?[]:(0,y.KC)(e).filter(e=>"embedding"===(0,y.CP)(e)),[o,d]=(0,n.useState)(r[0]?.id??""),[u,m]=(0,n.useState)("The quick brown fox jumps over the lazy dog"),[p,x]=(0,n.useState)(""),[h,b]=(0,n.useState)(""),[g,f]=(0,n.useState)(!1),[j,w]=(0,n.useState)(""),[N,C]=(0,n.useState)(""),[T,A]=(0,n.useState)(null),[I,P]=(0,n.useState)(!1),[R,E]=(0,n.useState)(""),{copied:O,copy:L}=(0,v.C)(),{copied:M,copy:U}=(0,v.C)();(0,n.useEffect)(()=>{w(window.location.origin),fetch("/api/keys").then(e=>e.json()).then(e=>{b((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}).catch(()=>{}),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&C(e.publicUrl)}).catch(()=>{})},[]);let B=g?N:j,K=o?`${l}/${o}`:"",D=()=>{let e={model:K,input:u.trim()},t=Number(p);return p&&Number.isFinite(t)&&t>0&&(e.dimensions=t),e},F=`curl -X POST ${B}/v1/embeddings \\
40
40
  -H "Content-Type: application/json" \\
41
41
  -H "Authorization: Bearer ${h||"YOUR_KEY"}" \\
42
- -d '${JSON.stringify(D())}'`,z=async()=>{if(!u.trim()||!K)return;P(!0),E(""),A(null);let e=Date.now();try{let t={"Content-Type":"application/json"};h&&(t.Authorization=`Bearer ${h}`);let a=await fetch("/api/v1/embeddings",{method:"POST",headers:t,body:JSON.stringify(D())}),s=Date.now()-e,l=await a.json();if(!a.ok)return void E(l?.error?.message||l?.error||`HTTP ${a.status}`);A({data:l,latencyMs:s})}catch(e){E(e.message||"Network error")}finally{P(!1)}},q=T?JSON.stringify(T.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)(k,{label:"Model",children:a?(0,s.jsx)("input",{value:o,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)(S.A,{value:o,onChange:d,options:r.map(e=>({value:e.id,label:e.name||e.id})),buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}),(0,s.jsx)(k,{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:B,onChange:e=>g?C(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:()=>f(e=>!e),title:g?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${g?"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)(k,{label:"API Key",children:(0,s.jsx)("input",{type:"password",value:h,onChange:e=>b(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)(k,{label:"Input",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:u,onChange:e=>m(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"}),u&&(0,s.jsx)("button",{type:"button",onClick:()=>m(""),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)(k,{label:"Dimensions",children:(0,s.jsx)("input",{type:"number",min:"1",value:p,onChange:e=>x(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:()=>L(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:O?"check":"content_copy"}),O?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:z,disabled:I||!u.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:I?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),I?"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 ",T&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",T.latencyMs,"ms"]})]}),T&&(0,s.jsxs)("button",{onClick:()=>U(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: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 $;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)})(T?.data)})]})]})]})}let T={"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"},"selfhosted-tts":{hasModelSelector:!0,hasVoiceIdInput:!0,hasBrowseButton:!1,voiceSource:"manual"},"ollama-local":{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"hardcoded",modelKey:"ollama-local-tts-models",voiceKey:"ollama-local-tts-voices",voicesPerModel:!0,defaultVoiceId:"default",defaultFormat:"wav",formatOptions:[{value:"wav",label:"WAV (Binary)"},{value:"pcm",label:"PCM (Raw)"}]},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},"xiaomi-mimo":{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!1,hasStyleInput:!0,hasLanguageHint:!0,languageOptions:["Chinese","English"],voiceSource:"hardcoded",modelKey:"xiaomi-mimo-tts-models",voicesPerModel:!0}};var A=a(73006),I=a(717),P=a(91781);let R=`// Audio will appear here after running.
42
+ -d '${JSON.stringify(D())}'`,z=async()=>{if(!u.trim()||!K)return;P(!0),E(""),A(null);let e=Date.now();try{let t={"Content-Type":"application/json"};h&&(t.Authorization=`Bearer ${h}`);let a=await fetch("/api/v1/embeddings",{method:"POST",headers:t,body:JSON.stringify(D())}),s=Date.now()-e,l=await a.json();if(!a.ok)return void E(l?.error?.message||l?.error||`HTTP ${a.status}`);A({data:l,latencyMs:s})}catch(e){E(e.message||"Network error")}finally{P(!1)}},q=T?JSON.stringify(T.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)(k,{label:"Model",children:a?(0,s.jsx)("input",{value:o,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)(S.A,{value:o,onChange:d,options:r.map(e=>({value:e.id,label:e.name||e.id})),buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}),(0,s.jsx)(k,{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:B,onChange:e=>g?C(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:()=>f(e=>!e),title:g?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${g?"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)(k,{label:"API Key",children:(0,s.jsx)("input",{type:"password",value:h,onChange:e=>b(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)(k,{label:"Input",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:u,onChange:e=>m(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"}),u&&(0,s.jsx)("button",{type:"button",onClick:()=>m(""),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)(k,{label:"Dimensions",children:(0,s.jsx)("input",{type:"number",min:"1",value:p,onChange:e=>x(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:()=>L(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:O?"check":"content_copy"}),O?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:z,disabled:I||!u.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 dark:text-amber-950 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:I?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),I?"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 ",T&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",T.latencyMs,"ms"]})]}),T&&(0,s.jsxs)("button",{onClick:()=>U(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: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 $;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)})(T?.data)})]})]})]})}let T={"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"},"selfhosted-tts":{hasModelSelector:!0,hasVoiceIdInput:!0,hasBrowseButton:!1,voiceSource:"manual"},"ollama-local":{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"hardcoded",modelKey:"ollama-local-tts-models",voiceKey:"ollama-local-tts-voices",voicesPerModel:!0,defaultVoiceId:"default",defaultFormat:"wav",formatOptions:[{value:"wav",label:"WAV (Binary)"},{value:"pcm",label:"PCM (Raw)"}]},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},"xiaomi-mimo":{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!1,hasStyleInput:!0,hasLanguageHint:!0,languageOptions:["Chinese","English"],voiceSource:"hardcoded",modelKey:"xiaomi-mimo-tts-models",voicesPerModel:!0}};var A=a(73006),I=a(717),P=a(91781);let R=`// Audio will appear here after running.
43
43
  // Example JSON response (response_format=json):
44
44
  {
45
45
  "format": "mp3",
@@ -48,12 +48,12 @@
48
48
  -H "Content-Type: application/json" \\
49
49
  -H "Authorization: Bearer ${L||"YOUR_KEY"}" \\
50
50
  -d '${JSON.stringify(e$)}' \\
51
- ${"json"===q?"":`--output speech.${e_}`}`,eA=async()=>{if(!C.trim()||!eS)return;X(!0),et(""),H(""),G(""),Z(null);let e=Date.now();try{let t={"Content-Type":"application/json"};L&&(t.Authorization=`Bearer ${L}`);let a=`/api/v1/audio/speech${"json"===q?"?response_format=json":""}`,s=await fetch(a,{method:"POST",headers:t,body:JSON.stringify({...e$,input:C.trim()})});if(es(Date.now()-e),!s.ok){let e=await s.json().catch(()=>({}));et(e?.error?.message||e?.error||`HTTP ${s.status}`);return}if("json"===q){let e=await s.json();Z(e);let t=e.format||"mp3",a=await fetch(`data:audio/${t};base64,${e.audio}`).then(e=>e.blob()),l=URL.createObjectURL(a);H(l),G(l)}else if("pcm"===q){let e=await s.arrayBuffer(),t=new Blob([e],{type:"audio/pcm"});G(URL.createObjectURL(t));let a=function(e,t=24e3,a=1){let s=2*a,l=e.byteLength,r=new ArrayBuffer(44+l),o=new DataView(r);function n(e,t){for(let a=0;a<t.length;a++)o.setUint8(e+a,t.charCodeAt(a))}return n(0,"RIFF"),o.setUint32(4,36+l,!0),n(8,"WAVE"),n(12,"fmt "),o.setUint32(16,16,!0),o.setUint16(20,1,!0),o.setUint16(22,a,!0),o.setUint32(24,t,!0),o.setUint32(28,t*s,!0),o.setUint16(32,s,!0),o.setUint16(34,16,!0),n(36,"data"),o.setUint32(40,l,!0),new Uint8Array(r,44).set(new Uint8Array(e)),new Blob([r],{type:"audio/wav"})}(e,24e3,1);H(URL.createObjectURL(a))}else{let e=await s.blob(),t=URL.createObjectURL(e);H(t),G(t)}}catch(e){et(e.message||"Network error")}finally{X(!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)(k,{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:[ek,"/v1/audio/speech"]}),F&&(0,s.jsxs)("button",{onClick:()=>B(e=>!e),title:U?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${U?"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)(k,{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:L?`${L.slice(0,8)}${"•".repeat(Math.min(20,Math.max(0,L.length-8)))}`:ev>0?(0,s.jsxs)("span",{className:"text-text-muted italic",children:["Using stored key(s) \xb7 ",ev," connection",ev>1?"s":""]}):(0,s.jsx)("span",{className:"text-text-muted italic",children:"No key configured"})})}),"selfhosted-tts"===e&&(0,s.jsx)(k,{label:"Model",children:(0,s.jsx)("input",{value:w,onChange:e=>N(e.target.value),placeholder:"e.g. kokoro or Qwen3-TTS-12Hz-1.7B-CustomVoice-bf16",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"})}),"selfhosted-tts"!==e&&r.hasModelSelector&&(r.modelKey||(0,y.KC)(e).some(e=>"tts"===(0,y.CP)(e)))&&(0,s.jsx)(k,{label:"Model",children:(0,s.jsx)(S.A,{value:w,onChange:N,options:((a=(0,y.KC)(e).filter(e=>"tts"===(0,y.CP)(e))).length?a:(0,y.KC)(r.modelKey)||[]).map(e=>({value:e.id,label:e.name||e.id})),buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}),r.hasLanguageHint&&(0,s.jsx)(k,{label:"Language",children:(0,s.jsx)(S.A,{value:ef,onChange:ey,options:[{value:"",label:"Auto-detect"},...(r.languageOptions||P.I).map(e=>"string"==typeof e?{value:e,label:e}:{value:e.name,label:e.name})],buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}),r.hasBrowseButton&&(0,s.jsx)(k,{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:ew,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:f?(0,s.jsx)("span",{className:"text-text-main",children:ei.find(e=>e.code===f)?.name||f}):(0,s.jsx)("span",{className:"text-text-muted",children:"No language selected"})}),(0,s.jsxs)("button",{onClick:ew,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)(k,{label:"Voice",children:(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:b.map(e=>(0,s.jsxs)("button",{onClick:()=>{u(e.id),p(e.name),r.hasVoiceIdInput&&h(e.id)},className:`px-2.5 py-1 rounded-full text-xs border transition-colors ${d===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.language?` \xb7 ${e.language}`:"",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))})}),r.hasVoiceIdInput&&(0,s.jsx)(k,{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),u(e.target.value)},placeholder:"selfhosted-tts"===e||"ollama-local"===e?"e.g. Zoey, Easton, Freya, or default":"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(""),u("")},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"})})]})})}),r.hasLanguageDropdown&&(0,s.jsx)(k,{label:"Language",children:(0,s.jsx)(S.A,{value:d,onChange:t=>{let a=(0,y.KC)(e).filter(e=>"tts"===(0,y.CP)(e)).find(e=>e.id===t);u(t),p(a?.name||t)},options:(0,y.KC)(e).filter(e=>"tts"===(0,y.CP)(e)).map(e=>({value:e.id,label:e.name||e.id})),buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}),(0,s.jsx)(k,{label:"Input",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:C,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"}),C&&(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"})})]})}),r.hasStyleInput&&(0,s.jsx)(k,{label:(0,A.Tl)("Style"),children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("textarea",{value:_,onChange:e=>O(e.target.value),placeholder:(0,A.Tl)("e.g. a warm, gentle voice, speaking slowly with a British accent"),rows:2,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 resize-none"}),_&&(0,s.jsx)("button",{type:"button",onClick:()=>O(""),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)(k,{label:"Output Format",children:(0,s.jsx)(S.A,{value:q,onChange:V,options:o.map(e=>({value:e.value,label:e.label})),buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}),(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:()=>er(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:el?"check":"content_copy"}),el?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:eA,disabled:Q||!C.trim()||!eS,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:eT})]}),ee&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:ee}),J?(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 ",ea&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",ea,"ms"]})]}),(0,s.jsxs)("a",{href:W||J,download:`speech.${"pcm"===q?"pcm":"wav"===q||"ollama-local"===e?"wav":"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:J,className:"w-full"}),Y&&(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:Y.format,audio:Y.audio?`${Y.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})]})]})]}),eo&&(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:()=>en(!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:()=>en(!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:em,onChange:e=>ep(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:[ex&&(0,s.jsx)("p",{className:"text-xs text-red-500 px-2 py-1",children:ex}),ec?(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:[eN.map(e=>(0,s.jsxs)("button",{onClick:()=>{let t;return en(!1),j(e.code),void(g(t=eb[e.code]?.voices||[]),t.length&&(u(t[0].id),p(t[0].name),r.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 ${f===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"]}),f===e.code&&(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"check"})]})]},e.code)),0===eN.length&&(0,s.jsx)("p",{className:"text-xs text-text-muted px-2 py-3",children:"No languages found."})]})]})]})})]})}let O="https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png";function L(e){let t="string"==typeof e?e.trim():"";return t?/^(data:image\/|https?:\/\/)/i.test(t)?t:`data:image/png;base64,${t}`:""}function M({providerId:e,kind:t}){let a=(0,c.wG)(e),l=(0,c.rs)(a)===e?a:e,r=c.rj.find(e=>e.id===t),o=C[t],d=o||{},u=(0,y.KC)(e).filter(e=>(0,y.CP)(e)===t),m=new Set(["image","video","music","imageToText","systemone"]).has(t),p=m&&0===u.length,[x,h]=(0,n.useState)(u[0]?.id??""),b=u.find(e=>e.id===x),g=!!b?.capabilities?.includes("edit"),f=!!b?.capabilities?.includes("mask"),[j,w]=(0,n.useState)(d.defaultInput||""),[N,$]=(0,n.useState)("Does this request require urgent attention?"),[_,T]=(0,n.useState)(""),[A,I]=(0,n.useState)(""),[P,R]=(0,n.useState)(()=>(d.extraFields||[]).reduce((e,t)=>(e[t.key]=t.default??"",e),{})),[E,U]=(0,n.useState)(""),[B,K]=(0,n.useState)(!1),[D,F]=(0,n.useState)(""),[z,q]=(0,n.useState)(""),[V,J]=(0,n.useState)(null),[H,W]=(0,n.useState)(null),[G,Y]=(0,n.useState)(null),[Z,Q]=(0,n.useState)("json"),[X,ee]=(0,n.useState)(""),[et,ea]=(0,n.useState)(!1),[es,el]=(0,n.useState)(""),[er,eo]=(0,n.useState)([]),[en,ei]=(0,n.useState)(""),{copied:ed,copy:ec}=(0,v.C)(),{copied:eu,copy:em}=(0,v.C)();if((0,n.useEffect)(()=>{F(window.location.origin),fetch("/api/keys").then(e=>e.json()).then(e=>{U((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}).catch(()=>{}),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&q(e.publicUrl)}).catch(()=>{}),fetch("/api/providers/client").then(e=>e.json()).then(t=>{eo((t.connections||[]).filter(t=>t.provider===e&&!1!==t.isActive))}).catch(()=>{})},[e]),!r||!o)return null;let ep=B?z:D,ex=r.endpoint.path,eh=m?x?`${l}/${x}`:p?"":l:l,eb="huggingface"===e?{image:O}:"cloudflare-ai"!==e?{}:"@cf/runwayml/stable-diffusion-v1-5-img2img"===x?{image:O}:"@cf/runwayml/stable-diffusion-v1-5-inpainting"===x?{image:O,mask_image:"https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png"}:{},eg=_.trim()||eb.image||"",ef=A.trim()||eb.mask_image||"",ey=L(eg),ev=L(ef),ej=Object.entries(P).reduce((e,[t,a])=>(""===a||null==a||"number"==typeof a&&Number.isNaN(a)||(e[t]=a),e),{}),ew="systemone"===t?{questions:{is_urgent:{type:"noul",instructions:N.trim()||"Does this request require urgent attention?"}}}:{},eN={model:eh,[o.bodyKey]:j,...o.extraBody,...ej,...ew,...g&&eg?{image:eg}:{},...f&&ef?{mask_image:ef}:{}},ek="image"===t&&"binary"===Z,eC="image"===t&&"codex"===e&&!ek,eS=`${ex}${ek?"?response_format=binary":""}`,e$=`-H "Content-Type: application/json" \\
51
+ ${"json"===q?"":`--output speech.${e_}`}`,eA=async()=>{if(!C.trim()||!eS)return;X(!0),et(""),H(""),G(""),Z(null);let e=Date.now();try{let t={"Content-Type":"application/json"};L&&(t.Authorization=`Bearer ${L}`);let a=`/api/v1/audio/speech${"json"===q?"?response_format=json":""}`,s=await fetch(a,{method:"POST",headers:t,body:JSON.stringify({...e$,input:C.trim()})});if(es(Date.now()-e),!s.ok){let e=await s.json().catch(()=>({}));et(e?.error?.message||e?.error||`HTTP ${s.status}`);return}if("json"===q){let e=await s.json();Z(e);let t=e.format||"mp3",a=await fetch(`data:audio/${t};base64,${e.audio}`).then(e=>e.blob()),l=URL.createObjectURL(a);H(l),G(l)}else if("pcm"===q){let e=await s.arrayBuffer(),t=new Blob([e],{type:"audio/pcm"});G(URL.createObjectURL(t));let a=function(e,t=24e3,a=1){let s=2*a,l=e.byteLength,r=new ArrayBuffer(44+l),o=new DataView(r);function n(e,t){for(let a=0;a<t.length;a++)o.setUint8(e+a,t.charCodeAt(a))}return n(0,"RIFF"),o.setUint32(4,36+l,!0),n(8,"WAVE"),n(12,"fmt "),o.setUint32(16,16,!0),o.setUint16(20,1,!0),o.setUint16(22,a,!0),o.setUint32(24,t,!0),o.setUint32(28,t*s,!0),o.setUint16(32,s,!0),o.setUint16(34,16,!0),n(36,"data"),o.setUint32(40,l,!0),new Uint8Array(r,44).set(new Uint8Array(e)),new Blob([r],{type:"audio/wav"})}(e,24e3,1);H(URL.createObjectURL(a))}else{let e=await s.blob(),t=URL.createObjectURL(e);H(t),G(t)}}catch(e){et(e.message||"Network error")}finally{X(!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)(k,{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:[ek,"/v1/audio/speech"]}),F&&(0,s.jsxs)("button",{onClick:()=>B(e=>!e),title:U?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${U?"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)(k,{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:L?`${L.slice(0,8)}${"•".repeat(Math.min(20,Math.max(0,L.length-8)))}`:ev>0?(0,s.jsxs)("span",{className:"text-text-muted italic",children:["Using stored key(s) \xb7 ",ev," connection",ev>1?"s":""]}):(0,s.jsx)("span",{className:"text-text-muted italic",children:"No key configured"})})}),"selfhosted-tts"===e&&(0,s.jsx)(k,{label:"Model",children:(0,s.jsx)("input",{value:w,onChange:e=>N(e.target.value),placeholder:"e.g. kokoro or Qwen3-TTS-12Hz-1.7B-CustomVoice-bf16",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"})}),"selfhosted-tts"!==e&&r.hasModelSelector&&(r.modelKey||(0,y.KC)(e).some(e=>"tts"===(0,y.CP)(e)))&&(0,s.jsx)(k,{label:"Model",children:(0,s.jsx)(S.A,{value:w,onChange:N,options:((a=(0,y.KC)(e).filter(e=>"tts"===(0,y.CP)(e))).length?a:(0,y.KC)(r.modelKey)||[]).map(e=>({value:e.id,label:e.name||e.id})),buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}),r.hasLanguageHint&&(0,s.jsx)(k,{label:"Language",children:(0,s.jsx)(S.A,{value:ef,onChange:ey,options:[{value:"",label:"Auto-detect"},...(r.languageOptions||P.I).map(e=>"string"==typeof e?{value:e,label:e}:{value:e.name,label:e.name})],buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}),r.hasBrowseButton&&(0,s.jsx)(k,{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:ew,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:f?(0,s.jsx)("span",{className:"text-text-main",children:ei.find(e=>e.code===f)?.name||f}):(0,s.jsx)("span",{className:"text-text-muted",children:"No language selected"})}),(0,s.jsxs)("button",{onClick:ew,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)(k,{label:"Voice",children:(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:b.map(e=>(0,s.jsxs)("button",{onClick:()=>{u(e.id),p(e.name),r.hasVoiceIdInput&&h(e.id)},className:`px-2.5 py-1 rounded-full text-xs border transition-colors ${d===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.language?` \xb7 ${e.language}`:"",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))})}),r.hasVoiceIdInput&&(0,s.jsx)(k,{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),u(e.target.value)},placeholder:"selfhosted-tts"===e||"ollama-local"===e?"e.g. Zoey, Easton, Freya, or default":"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(""),u("")},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"})})]})})}),r.hasLanguageDropdown&&(0,s.jsx)(k,{label:"Language",children:(0,s.jsx)(S.A,{value:d,onChange:t=>{let a=(0,y.KC)(e).filter(e=>"tts"===(0,y.CP)(e)).find(e=>e.id===t);u(t),p(a?.name||t)},options:(0,y.KC)(e).filter(e=>"tts"===(0,y.CP)(e)).map(e=>({value:e.id,label:e.name||e.id})),buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}),(0,s.jsx)(k,{label:"Input",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:C,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"}),C&&(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"})})]})}),r.hasStyleInput&&(0,s.jsx)(k,{label:(0,A.Tl)("Style"),children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("textarea",{value:_,onChange:e=>O(e.target.value),placeholder:(0,A.Tl)("e.g. a warm, gentle voice, speaking slowly with a British accent"),rows:2,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 resize-none"}),_&&(0,s.jsx)("button",{type:"button",onClick:()=>O(""),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)(k,{label:"Output Format",children:(0,s.jsx)(S.A,{value:q,onChange:V,options:o.map(e=>({value:e.value,label:e.label})),buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}),(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:()=>er(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:el?"check":"content_copy"}),el?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:eA,disabled:Q||!C.trim()||!eS,className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white dark:text-amber-950 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:eT})]}),ee&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:ee}),J?(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 ",ea&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",ea,"ms"]})]}),(0,s.jsxs)("a",{href:W||J,download:`speech.${"pcm"===q?"pcm":"wav"===q||"ollama-local"===e?"wav":"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:J,className:"w-full"}),Y&&(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:Y.format,audio:Y.audio?`${Y.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})]})]})]}),eo&&(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:()=>en(!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:()=>en(!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:em,onChange:e=>ep(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:[ex&&(0,s.jsx)("p",{className:"text-xs text-red-500 px-2 py-1",children:ex}),ec?(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:[eN.map(e=>(0,s.jsxs)("button",{onClick:()=>{let t;return en(!1),j(e.code),void(g(t=eb[e.code]?.voices||[]),t.length&&(u(t[0].id),p(t[0].name),r.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 ${f===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"]}),f===e.code&&(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"check"})]})]},e.code)),0===eN.length&&(0,s.jsx)("p",{className:"text-xs text-text-muted px-2 py-3",children:"No languages found."})]})]})]})})]})}let O="https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png";function L(e){let t="string"==typeof e?e.trim():"";return t?/^(data:image\/|https?:\/\/)/i.test(t)?t:`data:image/png;base64,${t}`:""}function M({providerId:e,kind:t}){let a=(0,c.wG)(e),l=(0,c.rs)(a)===e?a:e,r=c.rj.find(e=>e.id===t),o=C[t],d=o||{},u=(0,y.KC)(e).filter(e=>(0,y.CP)(e)===t),m=new Set(["image","video","music","imageToText","systemone"]).has(t),p=m&&0===u.length,[x,h]=(0,n.useState)(u[0]?.id??""),b=u.find(e=>e.id===x),g=!!b?.capabilities?.includes("edit"),f=!!b?.capabilities?.includes("mask"),[j,w]=(0,n.useState)(d.defaultInput||""),[N,$]=(0,n.useState)("Does this request require urgent attention?"),[_,T]=(0,n.useState)(""),[A,I]=(0,n.useState)(""),[P,R]=(0,n.useState)(()=>(d.extraFields||[]).reduce((e,t)=>(e[t.key]=t.default??"",e),{})),[E,U]=(0,n.useState)(""),[B,K]=(0,n.useState)(!1),[D,F]=(0,n.useState)(""),[z,q]=(0,n.useState)(""),[V,J]=(0,n.useState)(null),[H,W]=(0,n.useState)(null),[G,Y]=(0,n.useState)(null),[Z,Q]=(0,n.useState)("json"),[X,ee]=(0,n.useState)(""),[et,ea]=(0,n.useState)(!1),[es,el]=(0,n.useState)(""),[er,eo]=(0,n.useState)([]),[en,ei]=(0,n.useState)(""),{copied:ed,copy:ec}=(0,v.C)(),{copied:eu,copy:em}=(0,v.C)();if((0,n.useEffect)(()=>{F(window.location.origin),fetch("/api/keys").then(e=>e.json()).then(e=>{U((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}).catch(()=>{}),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&q(e.publicUrl)}).catch(()=>{}),fetch("/api/providers/client").then(e=>e.json()).then(t=>{eo((t.connections||[]).filter(t=>t.provider===e&&!1!==t.isActive))}).catch(()=>{})},[e]),!r||!o)return null;let ep=B?z:D,ex=r.endpoint.path,eh=m?x?`${l}/${x}`:p?"":l:l,eb="huggingface"===e?{image:O}:"cloudflare-ai"!==e?{}:"@cf/runwayml/stable-diffusion-v1-5-img2img"===x?{image:O}:"@cf/runwayml/stable-diffusion-v1-5-inpainting"===x?{image:O,mask_image:"https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png"}:{},eg=_.trim()||eb.image||"",ef=A.trim()||eb.mask_image||"",ey=L(eg),ev=L(ef),ej=Object.entries(P).reduce((e,[t,a])=>(""===a||null==a||"number"==typeof a&&Number.isNaN(a)||(e[t]=a),e),{}),ew="systemone"===t?{questions:{is_urgent:{type:"noul",instructions:N.trim()||"Does this request require urgent attention?"}}}:{},eN={model:eh,[o.bodyKey]:j,...o.extraBody,...ej,...ew,...g&&eg?{image:eg}:{},...f&&ef?{mask_image:ef}:{}},ek="image"===t&&"binary"===Z,eC="image"===t&&"codex"===e&&!ek,eS=`${ex}${ek?"?response_format=binary":""}`,e$=`-H "Content-Type: application/json" \\
52
52
  -H "Authorization: Bearer ${E||"YOUR_KEY"}"${en?` \\
53
53
  -H "x-connection-id: ${en}"`:""}${eC?` \\
54
54
  -H "Accept: text/event-stream"`:""}`,e_=`curl -X ${r.endpoint.method} ${ep}${eS} \\
55
55
  ${e$.replace(/\\\n /g,"\\\n ")} \\
56
- -d '${JSON.stringify(eN)}'${ek?" \\\n --output image.png":""}`,eT=async()=>{if(!j.trim()||!eh)return;if(ea(!0),el(""),J(null),W(null),Y(null),X){try{URL.revokeObjectURL(X)}catch{}ee("")}let e=Date.now();try{let t={"Content-Type":"application/json"};E&&(t.Authorization=`Bearer ${E}`),en&&(t["x-connection-id"]=en),eC&&(t.Accept="text/event-stream");let a={...eN,model:eh},s=await fetch(`/api${eS}`,{method:r.endpoint.method,headers:t,body:JSON.stringify(a)});if(!s.ok){let e=await s.json().catch(()=>({}));el(e?.error?.message||e?.error||`HTTP ${s.status}`);return}let l=s.headers.get("content-type")||"";if(l.startsWith("image/")){let t=await s.blob(),a=URL.createObjectURL(t);ee(a),J({data:{binary:!0,mime:l,size:t.size},latencyMs:Date.now()-e});return}if(l.includes("text/event-stream")&&s.body){let t=s.body.getReader(),a=new TextDecoder,l="",r=null,o=null;for(;;){let e,{done:s,value:n}=await t.read();if(s)break;for(l+=a.decode(n,{stream:!0});-1!==(e=l.indexOf("\n\n"));){let t=l.slice(0,e);l=l.slice(e+2);let a=null,s="";for(let e of t.split("\n"))e.startsWith("event:")?a=e.slice(6).trim():e.startsWith("data:")&&(s+=e.slice(5).trim());if(a)try{let e=s?JSON.parse(s):{};"progress"===a?W(e):"partial_image"===a?Y(e):"done"===a?r=e:"error"===a&&(o=e?.message||"Stream error")}catch{}}}let n=Date.now()-e;if(o)return void el(o);r&&J({data:r,latencyMs:n})}else{let t=await s.json(),a=Date.now()-e;J({data:t,latencyMs:a})}}catch(e){el(e.message||"Network error")}finally{ea(!1)}},eA=e=>{if(!e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(eA);let t={};for(let[a,s]of Object.entries(e))"b64_json"===a&&"string"==typeof s&&s.length>100?t[a]=`<${s.length} chars base64>`:"string"==typeof s&&s.length>100&&/^data:[^,]+,/.test(s)?t[a]=`<${s.length} chars data URI>`:t[a]=eA(s);return t},eI=V?JSON.stringify(eA(V.data),null,2):"",eP=V&&(V.data?.video?.url||V.data?.data?.[0]?.url)||null;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:[u.length>0?(0,s.jsx)(k,{label:"Model",children:(0,s.jsx)(S.A,{value:x,onChange:h,options:u.map(e=>({value:e.id,label:e.name||e.id})),buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}):p?(0,s.jsx)(k,{label:"Model",children:(0,s.jsx)("input",{value:x,onChange:e=>h(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)(k,{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:[ep,ex]}),z&&(0,s.jsxs)("button",{onClick:()=>K(e=>!e),title:B?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${B?"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)(k,{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:E?`${E.slice(0,8)}${"•".repeat(Math.min(20,Math.max(0,E.length-8)))}`:(0,s.jsx)("span",{className:"text-text-muted italic",children:"No key configured"})})}),er.length>0&&(0,s.jsx)(k,{label:"Connection",children:(0,s.jsx)(S.A,{value:en,onChange:ei,options:[{value:"",label:"Auto (by priority)"},...er.map(e=>{let t=e.providerSpecificData?.chatgptPlanType,a=e.email||e.name||e.id.slice(0,8);return{value:e.id,label:`${a}${t?` [${t}]`:""}`}})],buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}),(0,s.jsx)(k,{label:o.inputLabel,children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:j,onChange:e=>w(e.target.value),placeholder:o.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"}),j&&(0,s.jsx)("button",{type:"button",onClick:()=>w(""),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"})})]})}),"systemone"===t&&(0,s.jsx)(k,{label:"Question",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:N,onChange:e=>$(e.target.value),placeholder:"Enter evaluation question or criteria",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"}),N&&(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"})})]})}),g&&(0,s.jsx)(k,{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:_,onChange:e=>T(e.target.value),placeholder:eb.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"}),_&&(0,s.jsx)("button",{type:"button",onClick:()=>T(""),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:"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"},loading:"lazy",decoding:"async"})]})}),f&&(0,s.jsx)(k,{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:A,onChange:e=>I(e.target.value),placeholder:eb.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"}),A&&(0,s.jsx)("button",{type:"button",onClick:()=>I(""),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"})})]}),ev&&(0,s.jsx)("img",{src:ev,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"},loading:"lazy",decoding:"async"})]})}),(o.extraFields||[]).filter(e=>0===u.length||Array.isArray(b?.params)&&b.params.includes(e.key)).map(e=>(0,s.jsx)(k,{label:e.label,children:"select"===e.type?(0,s.jsx)(S.A,{value:P[e.key]??"",onChange:t=>R(a=>({...a,[e.key]:t})),options:(e.options||[]).map(e=>({value:e,label:""===e?"(default)":e})),buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"}):"text"===e.type?(0,s.jsx)("input",{type:"text",value:P[e.key]??"",placeholder:e.placeholder,onChange:t=>R(a=>({...a,[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"}):"image"===e.type?(0,s.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,s.jsx)("input",{type:"text",value:P[e.key]??"",placeholder:"https://… or click Upload",onChange:t=>R(a=>({...a,[e.key]:t.target.value})),className:"flex-1 min-w-0 px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),(0,s.jsxs)("label",{className:"shrink-0 inline-flex items-center gap-1 px-3 py-1.5 text-sm border border-border rounded-lg bg-background hover:bg-accent cursor-pointer transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"upload"}),"Upload",(0,s.jsx)("input",{type:"file",accept:"image/*",className:"hidden",onChange:t=>{let a=t.target.files?.[0];if(!a)return;let s=new FileReader;s.onload=()=>R(t=>({...t,[e.key]:String(s.result||"")})),s.readAsDataURL(a)}})]})]}):"boolean"===e.type?(0,s.jsxs)("label",{className:"inline-flex items-center gap-2 text-sm text-text-main",children:[(0,s.jsx)("input",{type:"checkbox",checked:!0===P[e.key],onChange:t=>R(a=>({...a,[e.key]:t.target.checked})),className:"size-4 accent-primary"}),P[e.key]?"Enabled":"Disabled"]}):(0,s.jsx)("input",{type:"number",value:P[e.key]??"",min:e.min,max:e.max,onChange:t=>R(a=>({...a,[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)(k,{label:"Output Format",children:(0,s.jsx)(S.A,{value:Z,onChange:Q,options:[{value:"json",label:"JSON (Base64)"},{value:"binary",label:"Binary File"}],buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}),(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:()=>ec(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:ed?"check":"content_copy"}),ed?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:eT,disabled:et||!j.trim()||!eh,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:et?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),et?"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:e_})]}),(et||H)&&eC&&(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:et?{animation:"spin 1s linear infinite"}:void 0,children:et?"progress_activity":"check_circle"}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:[H?.stage||"starting",!et&&H?.bytesReceived?` \xb7 ${(H.bytesReceived/1024).toFixed(1)} KB`:""]})]}),G?.b64_json&&!V&&(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,${G.b64_json}`,alt:"Partial",className:"max-w-full rounded-lg border border-border mt-1.5 opacity-80",loading:"lazy",decoding:"async"})]}),es&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:es}),(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 ",V&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",V.latencyMs,"ms"]})]}),V&&(0,s.jsxs)("button",{onClick:()=>em(eI),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:eu?"check":"content_copy"}),eu?"Copied":"Copy"]})]}),"image"===t&&(X||V?.data?.data?.[0])&&(0,s.jsxs)("div",{className:"mb-2",children:[(0,s.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,s.jsxs)("a",{href:X||(V?.data?.data?.[0]?.b64_json?`data:image/png;base64,${V.data.data[0].b64_json}`:V?.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:X||(V?.data?.data?.[0]?.b64_json?`data:image/png;base64,${V.data.data[0].b64_json}`:V?.data?.data?.[0]?.url),alt:"Generated",className:"max-w-full rounded-lg border border-border",loading:"lazy",decoding:"async"})]}),"video"===t&&eP&&(0,s.jsxs)("div",{className:"mb-2",children:[(0,s.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,s.jsxs)("a",{href:eP,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:eP,className:"max-w-full rounded-lg border border-border"})]}),(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:V?eI:o.defaultResponse})]})]})]})}function U({providerId:e}){let t=(0,c.wG)(e),a=(0,y.KC)(e).filter(e=>"stt"===(0,y.CP)(e)),[l,r]=(0,n.useState)([]),o=[...a,...l],[d,u]=(0,n.useState)(a[0]?.id??""),m=o.find(e=>e.id===d),p=Array.isArray(m?.params)?m.params:[],x=m?.responseFormats||["json","text","srt","verbose_json","vtt"],[h,b]=(0,n.useState)(null),[g,f]=(0,n.useState)(""),[j,w]=(0,n.useState)(""),[N,C]=(0,n.useState)("json"),[$,_]=(0,n.useState)(""),[T,A]=(0,n.useState)(""),[I,P]=(0,n.useState)(!1),[R,E]=(0,n.useState)(!1),[O,L]=(0,n.useState)(""),[M,B]=(0,n.useState)(""),[K,D]=(0,n.useState)(!1),[F,z]=(0,n.useState)(""),[q,V]=(0,n.useState)(""),[J,H]=(0,n.useState)(null),[W,G]=(0,n.useState)(null),[Y,Z]=(0,n.useState)(!1),[Q,X]=(0,n.useState)(""),{copied:ee,copy:et}=(0,v.C)(),{copied:ea,copy:es}=(0,v.C)();(0,n.useEffect)(()=>{z(window.location.origin),fetch("/api/keys").then(e=>e.json()).then(e=>{B((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}).catch(()=>{}),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&V(e.publicUrl)}).catch(()=>{});let e=()=>{fetch("/api/models/custom",{cache:"no-store"}).then(e=>e.json()).then(e=>{r((e.models||[]).filter(e=>"stt"===(0,y.CP)(e)&&e.providerAlias===t))}).catch(()=>{})};return e(),window.addEventListener("focus",e),window.addEventListener("customModelChanged",e),()=>{window.removeEventListener("focus",e),window.removeEventListener("customModelChanged",e)}},[t]);let el=K?q:F,er=d?`${t}/${d}`:"",eo=`curl -X POST ${el}/v1/audio/transcriptions \\
56
+ -d '${JSON.stringify(eN)}'${ek?" \\\n --output image.png":""}`,eT=async()=>{if(!j.trim()||!eh)return;if(ea(!0),el(""),J(null),W(null),Y(null),X){try{URL.revokeObjectURL(X)}catch{}ee("")}let e=Date.now();try{let t={"Content-Type":"application/json"};E&&(t.Authorization=`Bearer ${E}`),en&&(t["x-connection-id"]=en),eC&&(t.Accept="text/event-stream");let a={...eN,model:eh},s=await fetch(`/api${eS}`,{method:r.endpoint.method,headers:t,body:JSON.stringify(a)});if(!s.ok){let e=await s.json().catch(()=>({}));el(e?.error?.message||e?.error||`HTTP ${s.status}`);return}let l=s.headers.get("content-type")||"";if(l.startsWith("image/")){let t=await s.blob(),a=URL.createObjectURL(t);ee(a),J({data:{binary:!0,mime:l,size:t.size},latencyMs:Date.now()-e});return}if(l.includes("text/event-stream")&&s.body){let t=s.body.getReader(),a=new TextDecoder,l="",r=null,o=null;for(;;){let e,{done:s,value:n}=await t.read();if(s)break;for(l+=a.decode(n,{stream:!0});-1!==(e=l.indexOf("\n\n"));){let t=l.slice(0,e);l=l.slice(e+2);let a=null,s="";for(let e of t.split("\n"))e.startsWith("event:")?a=e.slice(6).trim():e.startsWith("data:")&&(s+=e.slice(5).trim());if(a)try{let e=s?JSON.parse(s):{};"progress"===a?W(e):"partial_image"===a?Y(e):"done"===a?r=e:"error"===a&&(o=e?.message||"Stream error")}catch{}}}let n=Date.now()-e;if(o)return void el(o);r&&J({data:r,latencyMs:n})}else{let t=await s.json(),a=Date.now()-e;J({data:t,latencyMs:a})}}catch(e){el(e.message||"Network error")}finally{ea(!1)}},eA=e=>{if(!e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(eA);let t={};for(let[a,s]of Object.entries(e))"b64_json"===a&&"string"==typeof s&&s.length>100?t[a]=`<${s.length} chars base64>`:"string"==typeof s&&s.length>100&&/^data:[^,]+,/.test(s)?t[a]=`<${s.length} chars data URI>`:t[a]=eA(s);return t},eI=V?JSON.stringify(eA(V.data),null,2):"",eP=V&&(V.data?.video?.url||V.data?.data?.[0]?.url)||null;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:[u.length>0?(0,s.jsx)(k,{label:"Model",children:(0,s.jsx)(S.A,{value:x,onChange:h,options:u.map(e=>({value:e.id,label:e.name||e.id})),buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}):p?(0,s.jsx)(k,{label:"Model",children:(0,s.jsx)("input",{value:x,onChange:e=>h(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)(k,{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:[ep,ex]}),z&&(0,s.jsxs)("button",{onClick:()=>K(e=>!e),title:B?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${B?"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)(k,{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:E?`${E.slice(0,8)}${"•".repeat(Math.min(20,Math.max(0,E.length-8)))}`:(0,s.jsx)("span",{className:"text-text-muted italic",children:"No key configured"})})}),er.length>0&&(0,s.jsx)(k,{label:"Connection",children:(0,s.jsx)(S.A,{value:en,onChange:ei,options:[{value:"",label:"Auto (by priority)"},...er.map(e=>{let t=e.providerSpecificData?.chatgptPlanType,a=e.email||e.name||e.id.slice(0,8);return{value:e.id,label:`${a}${t?` [${t}]`:""}`}})],buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}),(0,s.jsx)(k,{label:o.inputLabel,children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:j,onChange:e=>w(e.target.value),placeholder:o.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"}),j&&(0,s.jsx)("button",{type:"button",onClick:()=>w(""),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"})})]})}),"systemone"===t&&(0,s.jsx)(k,{label:"Question",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{value:N,onChange:e=>$(e.target.value),placeholder:"Enter evaluation question or criteria",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"}),N&&(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"})})]})}),g&&(0,s.jsx)(k,{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:_,onChange:e=>T(e.target.value),placeholder:eb.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"}),_&&(0,s.jsx)("button",{type:"button",onClick:()=>T(""),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:"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"},loading:"lazy",decoding:"async"})]})}),f&&(0,s.jsx)(k,{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:A,onChange:e=>I(e.target.value),placeholder:eb.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"}),A&&(0,s.jsx)("button",{type:"button",onClick:()=>I(""),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"})})]}),ev&&(0,s.jsx)("img",{src:ev,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"},loading:"lazy",decoding:"async"})]})}),(o.extraFields||[]).filter(e=>0===u.length||Array.isArray(b?.params)&&b.params.includes(e.key)).map(e=>(0,s.jsx)(k,{label:e.label,children:"select"===e.type?(0,s.jsx)(S.A,{value:P[e.key]??"",onChange:t=>R(a=>({...a,[e.key]:t})),options:(e.options||[]).map(e=>({value:e,label:""===e?"(default)":e})),buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"}):"text"===e.type?(0,s.jsx)("input",{type:"text",value:P[e.key]??"",placeholder:e.placeholder,onChange:t=>R(a=>({...a,[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"}):"image"===e.type?(0,s.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,s.jsx)("input",{type:"text",value:P[e.key]??"",placeholder:"https://… or click Upload",onChange:t=>R(a=>({...a,[e.key]:t.target.value})),className:"flex-1 min-w-0 px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),(0,s.jsxs)("label",{className:"shrink-0 inline-flex items-center gap-1 px-3 py-1.5 text-sm border border-border rounded-lg bg-background hover:bg-accent cursor-pointer transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"upload"}),"Upload",(0,s.jsx)("input",{type:"file",accept:"image/*",className:"hidden",onChange:t=>{let a=t.target.files?.[0];if(!a)return;let s=new FileReader;s.onload=()=>R(t=>({...t,[e.key]:String(s.result||"")})),s.readAsDataURL(a)}})]})]}):"boolean"===e.type?(0,s.jsxs)("label",{className:"inline-flex items-center gap-2 text-sm text-text-main",children:[(0,s.jsx)("input",{type:"checkbox",checked:!0===P[e.key],onChange:t=>R(a=>({...a,[e.key]:t.target.checked})),className:"size-4 accent-primary"}),P[e.key]?"Enabled":"Disabled"]}):(0,s.jsx)("input",{type:"number",value:P[e.key]??"",min:e.min,max:e.max,onChange:t=>R(a=>({...a,[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)(k,{label:"Output Format",children:(0,s.jsx)(S.A,{value:Z,onChange:Q,options:[{value:"json",label:"JSON (Base64)"},{value:"binary",label:"Binary File"}],buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}),(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:()=>ec(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:ed?"check":"content_copy"}),ed?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:eT,disabled:et||!j.trim()||!eh,className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white dark:text-amber-950 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:et?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),et?"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:e_})]}),(et||H)&&eC&&(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:et?{animation:"spin 1s linear infinite"}:void 0,children:et?"progress_activity":"check_circle"}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:[H?.stage||"starting",!et&&H?.bytesReceived?` \xb7 ${(H.bytesReceived/1024).toFixed(1)} KB`:""]})]}),G?.b64_json&&!V&&(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,${G.b64_json}`,alt:"Partial",className:"max-w-full rounded-lg border border-border mt-1.5 opacity-80",loading:"lazy",decoding:"async"})]}),es&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:es}),(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 ",V&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",V.latencyMs,"ms"]})]}),V&&(0,s.jsxs)("button",{onClick:()=>em(eI),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:eu?"check":"content_copy"}),eu?"Copied":"Copy"]})]}),"image"===t&&(X||V?.data?.data?.[0])&&(0,s.jsxs)("div",{className:"mb-2",children:[(0,s.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,s.jsxs)("a",{href:X||(V?.data?.data?.[0]?.b64_json?`data:image/png;base64,${V.data.data[0].b64_json}`:V?.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:X||(V?.data?.data?.[0]?.b64_json?`data:image/png;base64,${V.data.data[0].b64_json}`:V?.data?.data?.[0]?.url),alt:"Generated",className:"max-w-full rounded-lg border border-border",loading:"lazy",decoding:"async"})]}),"video"===t&&eP&&(0,s.jsxs)("div",{className:"mb-2",children:[(0,s.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,s.jsxs)("a",{href:eP,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:eP,className:"max-w-full rounded-lg border border-border"})]}),(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:V?eI:o.defaultResponse})]})]})]})}function U({providerId:e}){let t=(0,c.wG)(e),a=(0,y.KC)(e).filter(e=>"stt"===(0,y.CP)(e)),[l,r]=(0,n.useState)([]),o=[...a,...l],[d,u]=(0,n.useState)(a[0]?.id??""),m=o.find(e=>e.id===d),p=Array.isArray(m?.params)?m.params:[],x=m?.responseFormats||["json","text","srt","verbose_json","vtt"],[h,b]=(0,n.useState)(null),[g,f]=(0,n.useState)(""),[j,w]=(0,n.useState)(""),[N,C]=(0,n.useState)("json"),[$,_]=(0,n.useState)(""),[T,A]=(0,n.useState)(""),[I,P]=(0,n.useState)(!1),[R,E]=(0,n.useState)(!1),[O,L]=(0,n.useState)(""),[M,B]=(0,n.useState)(""),[K,D]=(0,n.useState)(!1),[F,z]=(0,n.useState)(""),[q,V]=(0,n.useState)(""),[J,H]=(0,n.useState)(null),[W,G]=(0,n.useState)(null),[Y,Z]=(0,n.useState)(!1),[Q,X]=(0,n.useState)(""),{copied:ee,copy:et}=(0,v.C)(),{copied:ea,copy:es}=(0,v.C)();(0,n.useEffect)(()=>{z(window.location.origin),fetch("/api/keys").then(e=>e.json()).then(e=>{B((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}).catch(()=>{}),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&V(e.publicUrl)}).catch(()=>{});let e=()=>{fetch("/api/models/custom",{cache:"no-store"}).then(e=>e.json()).then(e=>{r((e.models||[]).filter(e=>"stt"===(0,y.CP)(e)&&e.providerAlias===t))}).catch(()=>{})};return e(),window.addEventListener("focus",e),window.addEventListener("customModelChanged",e),()=>{window.removeEventListener("focus",e),window.removeEventListener("customModelChanged",e)}},[t]);let el=K?q:F,er=d?`${t}/${d}`:"",eo=`curl -X POST ${el}/v1/audio/transcriptions \\
57
57
  -H "Authorization: Bearer ${M||"YOUR_KEY"}" \\
58
58
  -F "file=@${h?.name||"audio.mp3"}" \\
59
59
  -F "model=${er}"${p.includes("language")&&g?` \\
@@ -66,4 +66,4 @@
66
66
  -F "diarize=true"`:""}${p.includes("num_speakers")&&!R&&O?` \\
67
67
  -F "num_speakers=${O}"`:""}`,en=async()=>{if(!h||!er)return;Z(!0),X(""),H(null);let e=Date.now();try{let t=new FormData;t.append("file",h),t.append("model",er),p.includes("language")&&g&&t.append("language",g),p.includes("response_format")&&t.append("response_format",N),p.includes("temperature")&&$&&t.append("temperature",$),p.includes("prompt")&&j&&t.append("prompt",j),p.includes("timestamps_granularity")&&T&&t.append("timestamps_granularity",T),p.includes("tag_audio_events")&&I&&t.append("tag_audio_events","true"),p.includes("diarize")&&R?t.append("diarize","true"):p.includes("num_speakers")&&O&&t.append("num_speakers",O);let a={};M&&(a.Authorization=`Bearer ${M}`);let s=await fetch("/api/v1/audio/transcriptions",{method:"POST",headers:a,body:t});G(Date.now()-e);let l=(s.headers.get("content-type")||"").includes("application/json")?await s.json():await s.text();if(!s.ok)return void X(l?.error?.message||l?.error||l||`HTTP ${s.status}`);H(l)}catch(e){X(e.message||"Network error")}finally{Z(!1)}},ei="string"==typeof J?J:J?JSON.stringify(J,null,2):`{
68
68
  "text": "Hello world..."
69
- }`;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:[o.length>0?(0,s.jsx)(k,{label:"Model",children:(0,s.jsx)(S.A,{value:d,onChange:u,options:o.map(e=>({value:e.id,label:e.name||e.id})),buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}):(0,s.jsx)(k,{label:"Model",children:(0,s.jsx)("input",{value:d,onChange:e=>u(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)(k,{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:[el,"/v1/audio/transcriptions"]}),q&&(0,s.jsxs)("button",{onClick:()=>D(e=>!e),title:K?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${K?"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)(k,{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:M?`${M.slice(0,8)}${"•".repeat(Math.min(20,Math.max(0,M.length-8)))}`:(0,s.jsx)("span",{className:"text-text-muted italic",children:"No key configured"})})}),(0,s.jsx)(k,{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=>b(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"}),h&&(0,s.jsxs)("span",{className:"text-xs text-text-muted font-mono",children:[h.name," \xb7 ",(h.size/1024).toFixed(1)," KB"]})]})}),p.includes("language")&&(0,s.jsx)(k,{label:"Language",children:(0,s.jsx)("input",{value:g,onChange:e=>f(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"})}),p.includes("prompt")&&(0,s.jsx)(k,{label:"Prompt",children:(0,s.jsx)("input",{value:j,onChange:e=>w(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"})}),p.includes("temperature")&&(0,s.jsx)(k,{label:"Temperature",children:(0,s.jsx)("input",{type:"number",step:"0.1",min:"0",max:"1",value:$,onChange:e=>_(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"})}),p.includes("response_format")&&(0,s.jsx)(k,{label:"Response Format",children:(0,s.jsx)(S.A,{value:N,onChange:C,options:x.map(e=>({value:e,label:e})),buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}),p.includes("timestamps_granularity")&&(0,s.jsx)(k,{label:"Timestamps",children:(0,s.jsx)(S.A,{value:T,onChange:A,options:[{value:"",label:"provider default"},{value:"word",label:"word"},{value:"character",label:"character"},{value:"none",label:"none"}],buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}),p.includes("tag_audio_events")&&(0,s.jsx)(k,{label:"Tag audio events",children:(0,s.jsxs)("label",{className:"flex items-center gap-2 text-sm text-text-muted",children:[(0,s.jsx)("input",{type:"checkbox",checked:I,onChange:e=>P(e.target.checked),className:"accent-primary"}),"Label non-speech sounds as [laughter], [applause], ..."]})}),p.includes("diarize")&&(0,s.jsx)(k,{label:"Speaker labels",children:(0,s.jsxs)("label",{className:"flex items-center gap-2 text-sm text-text-muted",children:[(0,s.jsx)("input",{type:"checkbox",checked:R,onChange:e=>E(e.target.checked),className:"accent-primary"}),"Detect speakers automatically (overrides speaker count)"]})}),p.includes("num_speakers")&&(0,s.jsx)(k,{label:"Speaker count",children:(0,s.jsx)("input",{type:"number",step:"1",min:"1",max:"32",value:O,onChange:e=>L(e.target.value),disabled:R,placeholder:"auto-detect",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary disabled:opacity-50"})}),(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:()=>et(eo),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:ee?"check":"content_copy"}),ee?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:en,disabled:Y||!h||!er,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:Y?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),Y?"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:eo})]}),Q&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:Q}),(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 ",J&&W&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",W,"ms"]})]}),J&&(0,s.jsxs)("button",{onClick:()=>es(ei),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:ea?"check":"content_copy"}),ea?"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:ei})]})]})]})}function B(){let{kind:e,id:t}=(0,l.useParams)(),a=(0,l.useRouter)(),r=c.rj.find(t=>t.id===e),u=(0,c.gC)(t)&&"embedding"===e,m=async()=>{if(confirm("Delete this Custom Embedding node?"))try{(await fetch(`/api/provider-nodes/${t}`,{method:"DELETE"})).ok&&a.push(`/dashboard/media-providers/${e}`)}catch(e){console.log("Error deleting custom embedding node:",e)}},[p,h]=(0,n.useState)(null),[b,g]=(0,n.useState)(u),[y,v]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{if(!u)return;let e=!1;return fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(a=>{e||(h((a.nodes||[]).find(e=>e.id===t)||null),g(!1))}).catch(()=>{e||g(!1)}),()=>{e=!0}},[t,u]),!r)return(0,l.notFound)();let j=c.Q2[t],w=u?p?{id:t,name:p.name||"Custom Embedding",color:"#525252",textIcon:"CE"}:null:j;if(!u&&!j||u&&!b&&!p)return(0,l.notFound)();if(u&&b)return(0,s.jsx)("div",{className:"text-text-muted text-sm py-12 text-center",children:"Loading..."});let k=u?["embedding"]:w.serviceKinds??["llm"];return u||k.includes(e)?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)(o(),{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"}),r.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:`${w.color}15`},children:(0,s.jsx)(d.A,{src:`/providers/${w.id}.png`,alt:w.name,size:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",fallbackText:w.textIcon||w.id.slice(0,2).toUpperCase(),fallbackColor:w.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:w.name}),!u&&w.notice?.apiKeyUrl&&(0,s.jsxs)("a",{href:w.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 ",p?.prefix]}),k.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:()=>v(!0),children:"Edit"}),(0,s.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:m,children:"Delete"})]})]})]}),!u&&w.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:w.kindNotice[e]})]}),!u&&w.notice?.text&&!w.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:w.notice.text}),w.notice.apiKeyUrl&&(0,s.jsx)("a",{href:w.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&&w.noAuth?(0,s.jsx)(i.gw,{providerId:t}):"stt"===e&&c.zN[t]?(0,s.jsxs)(i.Zp,{children:[(0,s.jsx)("p",{className:"text-sm text-text-muted mb-3",children:"This service shares your existing OAuth connections."}),(0,s.jsx)(o(),{href:`/dashboard/providers/${t}`,className:"text-primary hover:underline",children:"Manage OAuth connections →"})]}):(0,s.jsx)(f,{providerId:t,isOAuth:!1,loginProviderId:!u&&x.w.has(t)?t:null}),"tts"!==e&&"webSearch"!==e&&"webFetch"!==e&&(0,s.jsx)(N,{providerId:t,kindFilter:e,providerAliasOverride:u?p?.prefix:void 0}),!u&&(w.searchConfig||w.fetchConfig||w.ttsConfig||w.sttConfig||w.embeddingConfig||w.systemoneConfig||w.searchViaChat)&&(0,s.jsx)(i.Wx,{config:"webFetch"===e?w.fetchConfig:"tts"===e?w.ttsConfig:"stt"===e?w.sttConfig:"embedding"===e?w.embeddingConfig:"systemone"===e?w.systemoneConfig:w.searchConfig||{mode:"chat-completions",defaultModel:w.searchViaChat?.defaultModel,pricingUrl:w.searchViaChat?.pricingUrl,freeTier:w.searchViaChat?.freeTier},provider:w,title:`${r.label} Config`}),"embedding"===e&&(0,s.jsx)(_,{providerId:t,customAlias:p?.prefix}),"tts"===e&&(0,s.jsx)(E,{providerId:t}),"stt"===e&&!u&&(0,s.jsx)(U,{providerId:t}),!u&&C[e]&&(0,s.jsx)(M,{providerId:t,kind:e}),u&&(0,s.jsx)(i.x0,{isOpen:y,node:p,onClose:()=>v(!1),onSaved:e=>{h(e),v(!1)}})]}):(0,l.notFound)()}},78838:(e,t,a)=>{Promise.resolve().then(a.bind(a,41095))}},e=>{e.O(0,[763,2470,705,3557,5497,8441,3794,7358],()=>e(e.s=78838)),_N_E=e.O()}]);
69
+ }`;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:[o.length>0?(0,s.jsx)(k,{label:"Model",children:(0,s.jsx)(S.A,{value:d,onChange:u,options:o.map(e=>({value:e.id,label:e.name||e.id})),buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}):(0,s.jsx)(k,{label:"Model",children:(0,s.jsx)("input",{value:d,onChange:e=>u(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)(k,{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:[el,"/v1/audio/transcriptions"]}),q&&(0,s.jsxs)("button",{onClick:()=>D(e=>!e),title:K?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${K?"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)(k,{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:M?`${M.slice(0,8)}${"•".repeat(Math.min(20,Math.max(0,M.length-8)))}`:(0,s.jsx)("span",{className:"text-text-muted italic",children:"No key configured"})})}),(0,s.jsx)(k,{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=>b(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"}),h&&(0,s.jsxs)("span",{className:"text-xs text-text-muted font-mono",children:[h.name," \xb7 ",(h.size/1024).toFixed(1)," KB"]})]})}),p.includes("language")&&(0,s.jsx)(k,{label:"Language",children:(0,s.jsx)("input",{value:g,onChange:e=>f(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"})}),p.includes("prompt")&&(0,s.jsx)(k,{label:"Prompt",children:(0,s.jsx)("input",{value:j,onChange:e=>w(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"})}),p.includes("temperature")&&(0,s.jsx)(k,{label:"Temperature",children:(0,s.jsx)("input",{type:"number",step:"0.1",min:"0",max:"1",value:$,onChange:e=>_(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"})}),p.includes("response_format")&&(0,s.jsx)(k,{label:"Response Format",children:(0,s.jsx)(S.A,{value:N,onChange:C,options:x.map(e=>({value:e,label:e})),buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}),p.includes("timestamps_granularity")&&(0,s.jsx)(k,{label:"Timestamps",children:(0,s.jsx)(S.A,{value:T,onChange:A,options:[{value:"",label:"provider default"},{value:"word",label:"word"},{value:"character",label:"character"},{value:"none",label:"none"}],buttonClassName:"w-full px-3 py-1.5 rounded-lg",className:"w-full"})}),p.includes("tag_audio_events")&&(0,s.jsx)(k,{label:"Tag audio events",children:(0,s.jsxs)("label",{className:"flex items-center gap-2 text-sm text-text-muted",children:[(0,s.jsx)("input",{type:"checkbox",checked:I,onChange:e=>P(e.target.checked),className:"accent-primary"}),"Label non-speech sounds as [laughter], [applause], ..."]})}),p.includes("diarize")&&(0,s.jsx)(k,{label:"Speaker labels",children:(0,s.jsxs)("label",{className:"flex items-center gap-2 text-sm text-text-muted",children:[(0,s.jsx)("input",{type:"checkbox",checked:R,onChange:e=>E(e.target.checked),className:"accent-primary"}),"Detect speakers automatically (overrides speaker count)"]})}),p.includes("num_speakers")&&(0,s.jsx)(k,{label:"Speaker count",children:(0,s.jsx)("input",{type:"number",step:"1",min:"1",max:"32",value:O,onChange:e=>L(e.target.value),disabled:R,placeholder:"auto-detect",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary disabled:opacity-50"})}),(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:()=>et(eo),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:ee?"check":"content_copy"}),ee?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:en,disabled:Y||!h||!er,className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white dark:text-amber-950 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:Y?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),Y?"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:eo})]}),Q&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:Q}),(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 ",J&&W&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",W,"ms"]})]}),J&&(0,s.jsxs)("button",{onClick:()=>es(ei),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:ea?"check":"content_copy"}),ea?"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:ei})]})]})]})}function B(){let{kind:e,id:t}=(0,l.useParams)(),a=(0,l.useRouter)(),r=c.rj.find(t=>t.id===e),u=(0,c.gC)(t)&&"embedding"===e,m=async()=>{if(confirm("Delete this Custom Embedding node?"))try{(await fetch(`/api/provider-nodes/${t}`,{method:"DELETE"})).ok&&a.push(`/dashboard/media-providers/${e}`)}catch(e){console.log("Error deleting custom embedding node:",e)}},[p,h]=(0,n.useState)(null),[b,g]=(0,n.useState)(u),[y,v]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{if(!u)return;let e=!1;return fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(a=>{e||(h((a.nodes||[]).find(e=>e.id===t)||null),g(!1))}).catch(()=>{e||g(!1)}),()=>{e=!0}},[t,u]),!r)return(0,l.notFound)();let j=c.Q2[t],w=u?p?{id:t,name:p.name||"Custom Embedding",color:"#525252",textIcon:"CE"}:null:j;if(!u&&!j||u&&!b&&!p)return(0,l.notFound)();if(u&&b)return(0,s.jsx)("div",{className:"text-text-muted text-sm py-12 text-center",children:"Loading..."});let k=u?["embedding"]:w.serviceKinds??["llm"];return u||k.includes(e)?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)(o(),{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"}),r.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:`${w.color}15`},children:(0,s.jsx)(d.A,{src:`/providers/${w.id}.png`,alt:w.name,size:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",fallbackText:w.textIcon||w.id.slice(0,2).toUpperCase(),fallbackColor:w.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:w.name}),!u&&w.notice?.apiKeyUrl&&(0,s.jsxs)("a",{href:w.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 ",p?.prefix]}),k.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:()=>v(!0),children:"Edit"}),(0,s.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:m,children:"Delete"})]})]})]}),!u&&w.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:w.kindNotice[e]})]}),!u&&w.notice?.text&&!w.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:w.notice.text}),w.notice.apiKeyUrl&&(0,s.jsx)("a",{href:w.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&&w.noAuth?(0,s.jsx)(i.gw,{providerId:t}):"stt"===e&&c.zN[t]?(0,s.jsxs)(i.Zp,{children:[(0,s.jsx)("p",{className:"text-sm text-text-muted mb-3",children:"This service shares your existing OAuth connections."}),(0,s.jsx)(o(),{href:`/dashboard/providers/${t}`,className:"text-primary hover:underline",children:"Manage OAuth connections →"})]}):(0,s.jsx)(f,{providerId:t,isOAuth:!1,loginProviderId:!u&&x.w.has(t)?t:null}),"tts"!==e&&"webSearch"!==e&&"webFetch"!==e&&(0,s.jsx)(N,{providerId:t,kindFilter:e,providerAliasOverride:u?p?.prefix:void 0}),!u&&(w.searchConfig||w.fetchConfig||w.ttsConfig||w.sttConfig||w.embeddingConfig||w.systemoneConfig||w.searchViaChat)&&(0,s.jsx)(i.Wx,{config:"webFetch"===e?w.fetchConfig:"tts"===e?w.ttsConfig:"stt"===e?w.sttConfig:"embedding"===e?w.embeddingConfig:"systemone"===e?w.systemoneConfig:w.searchConfig||{mode:"chat-completions",defaultModel:w.searchViaChat?.defaultModel,pricingUrl:w.searchViaChat?.pricingUrl,freeTier:w.searchViaChat?.freeTier},provider:w,title:`${r.label} Config`}),"embedding"===e&&(0,s.jsx)(_,{providerId:t,customAlias:p?.prefix}),"tts"===e&&(0,s.jsx)(E,{providerId:t}),"stt"===e&&!u&&(0,s.jsx)(U,{providerId:t}),!u&&C[e]&&(0,s.jsx)(M,{providerId:t,kind:e}),u&&(0,s.jsx)(i.x0,{isOpen:y,node:p,onClose:()=>v(!1),onSaved:e=>{h(e),v(!1)}})]}):(0,l.notFound)()}},78838:(e,t,a)=>{Promise.resolve().then(a.bind(a,41095))}},e=>{e.O(0,[763,2470,705,3557,5497,8441,3794,7358],()=>e(e.s=78838)),_N_E=e.O()}]);