switchboard-router 0.9.2 → 0.9.3

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 (253) hide show
  1. package/app/.next/static/chunks/{1321-4de88db4bd94a23c.js → 1321-6bd6f91d24e9863e.js} +1 -1
  2. package/app/.next/static/chunks/1330-56405eca78b12fee.js +7 -0
  3. package/app/{.next-cli-build/static/chunks/3531-936a1e7912d9876c.js → .next/static/chunks/3531-eb5d385c954b3765.js} +7 -7
  4. package/app/.next/static/chunks/app/(dashboard)/dashboard/agent-library/page-cf3bc192f7a27304.js +1 -0
  5. package/app/.next/static/chunks/app/(dashboard)/dashboard/basic-chat/page-0e1d54e59ac767a1.js +1 -0
  6. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-d7205b7328b3fed1.js → page-af0d85c06970853b.js} +1 -1
  7. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-d0b6efe01e687aec.js → page-2cfc2352bc42d9b8.js} +1 -1
  8. package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-62cd36ee99eaa630.js +1 -0
  9. package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/routing/page-0b02e9a2f1cc6e43.js +1 -0
  10. package/app/.next/static/chunks/app/(dashboard)/dashboard/console-log/page-ded6ec41e583b3b3.js +1 -0
  11. package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-ca47b09e6ed6ae7b.js +16 -0
  12. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-772f246688672d59.js → page-78d098f14f8cff05.js} +8 -8
  13. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-d1654fba27199492.js +1 -0
  14. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/{page-8554ba79c854167f.js → page-ff13a39fb7744f5e.js} +3 -3
  15. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/page-919f3eec8dfc9b6e.js +1 -0
  16. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/web/page-db19da41661d630b.js +1 -0
  17. package/app/.next/static/chunks/app/(dashboard)/dashboard/mitm/{page-8779ff2bc755ba78.js → page-309b09a142a2995d.js} +1 -1
  18. package/app/.next/static/chunks/app/(dashboard)/dashboard/page-86cd6523dcd61f1b.js +1 -0
  19. package/app/.next/static/chunks/app/(dashboard)/dashboard/profile/{page-d32871b974f7e72f.js → page-ae6cf9ce7ac84eb7.js} +1 -1
  20. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-d8610d9b77a2cae4.js → page-97e0f7067cab0724.js} +3 -3
  21. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/new/page-413b59dd764a1563.js +1 -0
  22. package/app/{.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-555f079cdf31bbf6.js → .next/static/chunks/app/(dashboard)/dashboard/providers/page-31212a5a4a9825b0.js} +1 -1
  23. package/app/.next/static/chunks/app/(dashboard)/dashboard/pxpipe/page-1805f993834a1adb.js +1 -0
  24. package/app/.next/static/chunks/app/(dashboard)/dashboard/quota/page-798a65a8c4d2708a.js +1 -0
  25. package/app/.next/static/chunks/app/(dashboard)/dashboard/skills/[id]/page-aba614778bfe50ad.js +1 -0
  26. package/app/.next/static/chunks/app/(dashboard)/dashboard/skills/page-b1e9603ce7be0155.js +1 -0
  27. package/app/.next/static/chunks/app/(dashboard)/dashboard/token-saver/page-1711a424a8dcad0e.js +1 -0
  28. package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-0c7b901caf8614b9.js +1 -0
  29. package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-b085086e6c5b9387.js +1 -0
  30. package/app/.next/static/chunks/app/(dashboard)/{layout-62b4e2cdf745f8d0.js → layout-59baac68c7aedd25.js} +1 -1
  31. package/app/.next/static/css/c5928b380ef8a163.css +1 -0
  32. package/app/.next-cli-build/BUILD_ID +1 -1
  33. package/app/.next-cli-build/app-path-routes-manifest.json +6 -6
  34. package/app/.next-cli-build/build-manifest.json +2 -2
  35. package/app/.next-cli-build/prerender-manifest.json +3 -3
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page.js +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page_client-reference-manifest.js +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page_client-reference-manifest.js +1 -1
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +15 -2
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page_client-reference-manifest.js +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  75. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page.js +1 -1
  76. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page_client-reference-manifest.js +1 -1
  77. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  78. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  79. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  80. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  81. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  82. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  83. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  84. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  85. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  86. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  87. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  88. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  89. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  90. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  91. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  92. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  93. package/app/.next-cli-build/server/app/_not-found.rsc +4 -4
  94. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +4 -4
  95. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +4 -4
  96. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  97. package/app/.next-cli-build/server/app/api/cli-tools/aider-settings/route.js +2 -2
  98. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
  99. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  100. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
  101. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
  102. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +2 -2
  103. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
  104. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +2 -2
  105. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +1 -1
  106. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
  107. package/app/.next-cli-build/server/app/api/cli-tools/gemini-cli-settings/route.js +3 -3
  108. package/app/.next-cli-build/server/app/api/cli-tools/grok-settings/route.js +3 -3
  109. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +3 -3
  110. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
  111. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  112. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  113. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
  114. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +1 -1
  115. package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  116. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js +1 -1
  117. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  118. package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  119. package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  120. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  121. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  122. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  123. package/app/.next-cli-build/server/app/callback.html +1 -1
  124. package/app/.next-cli-build/server/app/callback.rsc +4 -4
  125. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +4 -4
  126. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  127. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +4 -4
  128. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  129. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  130. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
  131. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
  132. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  133. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +4 -4
  134. package/app/.next-cli-build/server/app/index.html +1 -1
  135. package/app/.next-cli-build/server/app/index.rsc +4 -4
  136. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +4 -4
  137. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +4 -4
  138. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  139. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  140. package/app/.next-cli-build/server/app/landing.html +1 -1
  141. package/app/.next-cli-build/server/app/landing.rsc +4 -4
  142. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +4 -4
  143. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
  144. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +4 -4
  145. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  146. package/app/.next-cli-build/server/app/login.html +1 -1
  147. package/app/.next-cli-build/server/app/login.rsc +4 -4
  148. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
  149. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
  150. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +4 -4
  151. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  152. package/app/.next-cli-build/server/app-paths-manifest.json +6 -6
  153. package/app/.next-cli-build/server/chunks/1350.js +1 -1
  154. package/app/.next-cli-build/server/chunks/194.js +1 -1
  155. package/app/.next-cli-build/server/chunks/6395.js +1 -1
  156. package/app/.next-cli-build/server/chunks/6406.js +1 -1
  157. package/app/.next-cli-build/server/chunks/646.js +1 -1
  158. package/app/.next-cli-build/server/chunks/6985.js +1 -1
  159. package/app/.next-cli-build/server/chunks/7454.js +1 -1
  160. package/app/.next-cli-build/server/chunks/869.js +1 -1
  161. package/app/.next-cli-build/server/chunks/8834.js +1 -1
  162. package/app/.next-cli-build/server/chunks/8976.js +1 -1
  163. package/app/.next-cli-build/server/chunks/8998.js +9 -9
  164. package/app/.next-cli-build/server/chunks/9261.js +6 -6
  165. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  166. package/app/.next-cli-build/server/pages/404.html +1 -1
  167. package/app/.next-cli-build/server/pages/500.html +1 -1
  168. package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  169. package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  170. package/app/.next-cli-build/static/chunks/{1321-4de88db4bd94a23c.js → 1321-6bd6f91d24e9863e.js} +1 -1
  171. package/app/.next-cli-build/static/chunks/1330-56405eca78b12fee.js +7 -0
  172. package/app/{.next/static/chunks/3531-936a1e7912d9876c.js → .next-cli-build/static/chunks/3531-eb5d385c954b3765.js} +7 -7
  173. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/agent-library/page-cf3bc192f7a27304.js +1 -0
  174. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/basic-chat/page-0e1d54e59ac767a1.js +1 -0
  175. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-d7205b7328b3fed1.js → page-af0d85c06970853b.js} +1 -1
  176. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-d0b6efe01e687aec.js → page-2cfc2352bc42d9b8.js} +1 -1
  177. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-62cd36ee99eaa630.js +1 -0
  178. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/routing/page-0b02e9a2f1cc6e43.js +1 -0
  179. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/page-ded6ec41e583b3b3.js +1 -0
  180. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/page-ca47b09e6ed6ae7b.js +16 -0
  181. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-772f246688672d59.js → page-78d098f14f8cff05.js} +8 -8
  182. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-d1654fba27199492.js +1 -0
  183. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/{page-8554ba79c854167f.js → page-ff13a39fb7744f5e.js} +3 -3
  184. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/page-919f3eec8dfc9b6e.js +1 -0
  185. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/web/page-db19da41661d630b.js +1 -0
  186. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/mitm/{page-8779ff2bc755ba78.js → page-309b09a142a2995d.js} +1 -1
  187. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/page-86cd6523dcd61f1b.js +1 -0
  188. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/{page-d32871b974f7e72f.js → page-ae6cf9ce7ac84eb7.js} +1 -1
  189. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-d8610d9b77a2cae4.js → page-97e0f7067cab0724.js} +3 -3
  190. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/new/page-413b59dd764a1563.js +1 -0
  191. package/app/{.next/static/chunks/app/(dashboard)/dashboard/providers/page-555f079cdf31bbf6.js → .next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-31212a5a4a9825b0.js} +1 -1
  192. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/pxpipe/page-1805f993834a1adb.js +1 -0
  193. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-798a65a8c4d2708a.js +1 -0
  194. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/[id]/page-aba614778bfe50ad.js +1 -0
  195. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/page-b1e9603ce7be0155.js +1 -0
  196. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/token-saver/page-1711a424a8dcad0e.js +1 -0
  197. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/translator/page-0c7b901caf8614b9.js +1 -0
  198. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-b085086e6c5b9387.js +1 -0
  199. package/app/.next-cli-build/static/chunks/app/(dashboard)/{layout-62b4e2cdf745f8d0.js → layout-59baac68c7aedd25.js} +1 -1
  200. package/app/.next-cli-build/static/css/c5928b380ef8a163.css +1 -0
  201. package/app/open-sse/identity/tls/bin/darwin/arm64/switchboard-claude-tls +0 -0
  202. package/app/open-sse/identity/tls/bin/darwin/x64/switchboard-claude-tls +0 -0
  203. package/app/open-sse/identity/tls/bin/linux/arm64/switchboard-claude-tls +0 -0
  204. package/app/open-sse/identity/tls/bin/linux/x64/switchboard-claude-tls +0 -0
  205. package/app/open-sse/identity/tls/bin/win32/arm64/switchboard-claude-tls.exe +0 -0
  206. package/app/open-sse/identity/tls/bin/win32/x64/switchboard-claude-tls.exe +0 -0
  207. package/app/package.json +1 -1
  208. package/package.json +1 -1
  209. package/src/cli/api/client.js +1 -1
  210. package/app/.next/static/chunks/5497-78bd7208dc4a083d.js +0 -7
  211. package/app/.next/static/chunks/app/(dashboard)/dashboard/agent-library/page-24b5a8515eee26d6.js +0 -1
  212. package/app/.next/static/chunks/app/(dashboard)/dashboard/basic-chat/page-4ec8bfa73afe20a6.js +0 -1
  213. package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-5cfdfdf507c8222f.js +0 -1
  214. package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/routing/page-25629f96675ad55d.js +0 -1
  215. package/app/.next/static/chunks/app/(dashboard)/dashboard/console-log/page-b54cd17200807e49.js +0 -1
  216. package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-cd44cb44125275b6.js +0 -3
  217. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-52c12af07f9a6de0.js +0 -1
  218. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/page-0f54c9a5e7391a77.js +0 -1
  219. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/web/page-cfbd3661ac75b8c5.js +0 -1
  220. package/app/.next/static/chunks/app/(dashboard)/dashboard/page-c33d24bdadcf0c6e.js +0 -1
  221. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/new/page-74d56b3b7ac42546.js +0 -1
  222. package/app/.next/static/chunks/app/(dashboard)/dashboard/pxpipe/page-bd18ad88b98cd373.js +0 -1
  223. package/app/.next/static/chunks/app/(dashboard)/dashboard/quota/page-b3ffcc7df06a37d8.js +0 -1
  224. package/app/.next/static/chunks/app/(dashboard)/dashboard/skills/[id]/page-56bf48ee2068208e.js +0 -1
  225. package/app/.next/static/chunks/app/(dashboard)/dashboard/skills/page-46986a955b8c89b2.js +0 -1
  226. package/app/.next/static/chunks/app/(dashboard)/dashboard/token-saver/page-20972a96e348f397.js +0 -1
  227. package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-0cc2ccbe11cc0013.js +0 -1
  228. package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-5af5fff7d28ed91d.js +0 -1
  229. package/app/.next/static/css/d89fdbc0e71b454e.css +0 -1
  230. package/app/.next-cli-build/static/chunks/5497-78bd7208dc4a083d.js +0 -7
  231. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/agent-library/page-24b5a8515eee26d6.js +0 -1
  232. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/basic-chat/page-4ec8bfa73afe20a6.js +0 -1
  233. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-5cfdfdf507c8222f.js +0 -1
  234. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/routing/page-25629f96675ad55d.js +0 -1
  235. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/page-b54cd17200807e49.js +0 -1
  236. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/page-cd44cb44125275b6.js +0 -3
  237. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-52c12af07f9a6de0.js +0 -1
  238. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/page-0f54c9a5e7391a77.js +0 -1
  239. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/web/page-cfbd3661ac75b8c5.js +0 -1
  240. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/page-c33d24bdadcf0c6e.js +0 -1
  241. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/new/page-74d56b3b7ac42546.js +0 -1
  242. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/pxpipe/page-bd18ad88b98cd373.js +0 -1
  243. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-b3ffcc7df06a37d8.js +0 -1
  244. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/[id]/page-56bf48ee2068208e.js +0 -1
  245. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/page-46986a955b8c89b2.js +0 -1
  246. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/token-saver/page-20972a96e348f397.js +0 -1
  247. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/translator/page-0cc2ccbe11cc0013.js +0 -1
  248. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-5af5fff7d28ed91d.js +0 -1
  249. package/app/.next-cli-build/static/css/d89fdbc0e71b454e.css +0 -1
  250. /package/app/.next/static/{Fq0KReA64JGBdC8atypku → kGdbG3TEpkBeoqsRS2Mre}/_buildManifest.js +0 -0
  251. /package/app/.next/static/{Fq0KReA64JGBdC8atypku → kGdbG3TEpkBeoqsRS2Mre}/_ssgManifest.js +0 -0
  252. /package/app/.next-cli-build/static/{Fq0KReA64JGBdC8atypku → kGdbG3TEpkBeoqsRS2Mre}/_buildManifest.js +0 -0
  253. /package/app/.next-cli-build/static/{Fq0KReA64JGBdC8atypku → kGdbG3TEpkBeoqsRS2Mre}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[182],{17845:(e,t,a)=>{Promise.resolve().then(a.bind(a,41095))},41095:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>D});var s=a(95155),r=a(73321),l=a(98500),o=a.n(l),i=a(12115),n=a(35497),d=a(57250),c=a(88105),m=a(70217),u=a(14051),p=a.n(u),x=a(65921),h=a(53578);function b({until:e}){let[t,a]=(0,i.useState)("");return((0,i.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-orange-500 font-mono",children:["⏱ ",t]}):null}function f({connection:e,isOAuth:t,isFirst:a,isLast:r,onMoveUp:l,onMoveDown:o,onToggleActive:d,onEdit:c,onDelete:u}){let[p,x]=(0,i.useState)(!1),h=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,g=h?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",y="",v=e.providerSpecificData?.connectionProxyUrl;if(v)try{let e=new URL(v);y=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{y=v}let j=e.providerSpecificData?.connectionNoProxy||"",w=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(Boolean).sort()[0]||null;(0,i.useEffect)(()=>{let t=()=>{x(!!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=w?setInterval(t,1e3):null;return()=>{a&&clearInterval(a)}},[e,w]);let N="unavailable"!==e.testStatus||p?e.testStatus:"active",k=t?e.name||e.email||e.displayName||"OAuth Account":e.name;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:l,disabled:a,className:`p-0.5 rounded ${a?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,s.jsx)("button",{onClick:o,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,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:t?"lock":"key"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:k}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-1",children:[(0,s.jsx)(n.Ex,{variant:(0,m.g)(e.isActive,N),size:"sm",dot:!0,children:!1===e.isActive?"disabled":N||"Unknown"}),h&&(0,s.jsx)(n.Ex,{variant:"success",size:"sm",children:"Proxy"}),p&&!1!==e.isActive&&(0,s.jsx)(b,{until:w}),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]})]}),h&&(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:g,children:g}),y&&(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:y}),j&&(0,s.jsxs)("span",{className:"text-[11px] text-text-muted truncate max-w-[320px]",title:j,children:["no_proxy: ",j]})]})]})]}),(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:[(0,s.jsxs)("button",{onClick:c,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:u,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)(n.lM,{size:"sm",checked:e.isActive??!0,onChange:d,title:e.isActive??!0?"Disable":"Enable"})]})]})}function g({isOpen:e,provider:t,providerName:a,onSave:r,onClose:l}){let[o,d]=(0,i.useState)({name:"",apiKey:"",priority:1}),[c,m]=(0,i.useState)(!1),[u,p]=(0,i.useState)(null),[x,h]=(0,i.useState)(!1),b=o.name.trim().length>0,f=o.apiKey.trim().length>0,y=async()=>{let e=o.apiKey.trim();if(e){m(!0);try{let a=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:e})}),s=await a.json();p(s.valid?"success":"failed")}catch{p("failed")}finally{m(!1)}}},v=async()=>{let e=o.name.trim(),a=o.apiKey.trim();if(t&&e&&a){h(!0);try{let s=!1;try{m(!0),p(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:a})});s=!!(await e.json()).valid,p(s?"success":"failed")}catch{p("failed")}finally{m(!1)}await r({name:e,apiKey:a,priority:o.priority,testStatus:s?"active":"unknown"})}finally{h(!1)}}};return t?(0,s.jsx)(n.aF,{isOpen:e,title:`Add ${a||t} API Key`,onClose:l,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:o.name,onChange:e=>d({...o,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",autoComplete:"off",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:o.apiKey,onChange:e=>d({...o,apiKey:e.target.value})})]}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(n.$n,{onClick:y,disabled:!f||c||x,variant:"secondary",children:c?"Checking...":"Check"})})]}),u&&(0,s.jsx)(n.Ex,{variant:"success"===u?"success":"error",children:"success"===u?"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",min:1,className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:o.priority,onChange:e=>d({...o,priority:Number.parseInt(e.target.value)||1})})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(n.$n,{onClick:v,fullWidth:!0,disabled:!b||!f||x,children:x?"Saving...":"Save"}),(0,s.jsx)(n.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function y({providerId:e,isOAuth:t}){let[a,r]=(0,i.useState)([]),[l,o]=(0,i.useState)(!0),[d,c]=(0,i.useState)(!1),[m,u]=(0,i.useState)(!1),[p,b]=(0,i.useState)(null),[v,j]=(0,i.useState)(null),[w,N]=(0,i.useState)("1"),[k,C]=(0,i.useState)(!1),[S,$]=(0,i.useState)("30"),[F,E]=(0,i.useState)(null),A=(0,x.i)(e=>e.error),T=(0,i.useCallback)(async()=>{try{let[t,a]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]);if(!t.ok||!a.ok)throw Error("Failed to load connections");let s=await t.json(),l=await a.json();r((s.connections||[]).filter(t=>t.provider===e));let o=(l.providerStrategies||{})[e]||{};j(o.fallbackStrategy||null),N(null!=o.stickyRoundRobinLimit?String(o.stickyRoundRobinLimit):"1");let i=o.accountScheduler||{};C(!0===i.enabled),$(String(Math.max(1,Math.round((i.sessionAffinityTtlSeconds||1800)/60))))}catch(e){A(e?.message||"Failed to load connections")}finally{o(!1)}},[A,e]);(0,i.useEffect)(()=>{T()},[T]);let R=async(t,a)=>{try{return await (0,h.T)(e,e=>{let s={...e};return t?s.fallbackStrategy=t:delete s.fallbackStrategy,"round-robin"===t&&""!==a?s.stickyRoundRobinLimit=Number(a)||3:t||delete s.stickyRoundRobinLimit,s}),!0}catch(e){return A(e?.message||"Failed to save provider strategy"),!1}},P=async(t,a)=>{let s=Math.min(1440,Math.max(1,Number.parseInt(a,10)||30));try{return await (0,h.T)(e,e=>({...e,accountScheduler:{...e.accountScheduler||{},enabled:t,sessionAffinityTtlSeconds:60*s}})),!0}catch(e){return A(e?.message||"Failed to save balanced scheduler"),!1}},I=async e=>{await P(k,e)&&$(e)},_=async e=>{await R("round-robin",e)&&N(e)},O=async(e,t)=>{let s=[...a];[s[e],s[t]]=[s[t],s[e]],r(s);try{if((await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])).some(e=>!e.ok))throw Error("Failed to reorder connections")}catch(e){A(e?.message||"Failed to reorder connections"),await T()}},M=async e=>{let t=a.find(t=>t.id===e),s=t?.name?.trim()||t?.email?.trim()||e;E({title:"Delete Connection",message:`Delete connection “${s}”?`,onConfirm:async()=>{E(null);try{let t=await fetch(`/api/providers/${e}`,{method:"DELETE"});if(!t.ok)throw Error(`Failed to delete connection (${t.status})`);r(t=>t.filter(t=>t.id!==e))}catch(e){A("Failed to delete connection")}}})},L=async(e,t)=>{try{let a=await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})});if(!a.ok)throw Error(`Failed to toggle connection (${a.status})`);r(a=>a.map(a=>a.id===e?{...a,isActive:t}:a))}catch(e){A("Failed to toggle connection")}},K=async t=>{try{let a=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,...t})});if(!a.ok)throw Error(`Failed to save API key (${a.status})`);await T(),c(!1)}catch(e){A("Failed to save API key")}},B=async e=>{try{let t=await fetch(`/api/providers/${p.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(`Failed to update connection (${t.status})`);await T(),u(!1)}catch(e){A("Failed to update connection")}};if(l)return(0,s.jsx)(n.Zp,{children:(0,s.jsx)("div",{className:"h-20 animate-pulse bg-black/5 rounded-lg"})});let D=k?"balanced":"round-robin"===v?"round-robin":"fill-first",U=async e=>{"balanced"===e?await P(!0,S)&&C(!0):"round-robin"===e?(k&&(await P(!1,S),C(!1)),await R("round-robin",w||"1")&&j("round-robin")):(k&&(await P(!1,S),C(!1)),await R("fill-first","")&&j("fill-first"))};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.Zp,{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between mb-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,s.jsxs)("p",{className:"text-xs text-text-muted mt-0.5",children:["Manage accounts and selection strategy for ",e]})]}),a.length>1&&(0,s.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border/40 bg-surface-2/40 p-3 text-xs",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("span",{className:"font-semibold text-text-main",children:"Account Strategy"}),(0,s.jsxs)("div",{className:"inline-flex rounded-lg border border-border/60 bg-background/60 p-0.5",children:[(0,s.jsx)("button",{type:"button",onClick:()=>U("fill-first"),className:`rounded-md px-2 py-1 text-[11px] font-medium transition-all ${"fill-first"===D?"bg-primary text-black font-semibold shadow-xs":"text-text-muted hover:text-text-main"}`,children:"Fill-First"}),(0,s.jsx)("button",{type:"button",onClick:()=>U("round-robin"),className:`rounded-md px-2 py-1 text-[11px] font-medium transition-all ${"round-robin"===D?"bg-primary text-black font-semibold shadow-xs":"text-text-muted hover:text-text-main"}`,children:"Round Robin"}),(0,s.jsx)("button",{type:"button",onClick:()=>U("balanced"),className:`rounded-md px-2 py-1 text-[11px] font-medium transition-all ${"balanced"===D?"bg-primary text-black font-semibold shadow-xs":"text-text-muted hover:text-text-main"}`,children:"Balanced"})]})]}),"fill-first"===D&&(0,s.jsx)("p",{className:"max-w-md text-[11px] text-text-muted",children:"Routes all requests to top-priority connection first. Spills over to subsequent accounts on rate limit (429) or quota exhaustion."}),"round-robin"===D&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-text-muted",children:[(0,s.jsx)("span",{children:"Cycles evenly across accounts."}),(0,s.jsxs)("label",{className:"inline-flex items-center gap-1",children:["Sticky limit:",(0,s.jsx)("input",{type:"number",min:1,max:100,value:w,onChange:e=>_(e.target.value),className:"w-12 px-1.5 py-0.5 text-[11px] border border-border rounded bg-background focus:outline-none focus:border-primary"})]})]}),"balanced"===D&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-text-muted",children:[(0,s.jsx)("span",{children:"Least in-flight concurrency with session affinity."}),(0,s.jsxs)("label",{className:"inline-flex items-center gap-1",children:["Affinity:",(0,s.jsx)("input",{"aria-label":"Session affinity minutes",type:"number",min:1,max:1440,value:S,onChange:e=>I(e.target.value),className:"w-14 px-1.5 py-0.5 text-[11px] border border-border rounded bg-background focus:outline-none focus:border-primary"}),"min"]})]})]})]}),0===a.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.jsx)(n.$n,{size:"sm",icon:"add",onClick:()=>c(!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]",children:a.map((e,r)=>(0,s.jsx)(f,{connection:e,isOAuth:t,isFirst:0===r,isLast:r===a.length-1,onMoveUp:()=>O(r,r-1),onMoveDown:()=>O(r,r+1),onToggleActive:t=>L(e.id,t),onEdit:()=>{b(e),u(!0)},onDelete:()=>M(e.id)},e.id))}),(0,s.jsx)("div",{className:"mt-4 flex justify-stretch sm:justify-start",children:(0,s.jsx)(n.$n,{size:"sm",icon:"add",onClick:()=>c(!0),children:"Add"})})]})]}),(0,s.jsx)(g,{isOpen:d,provider:e,onSave:K,onClose:()=>c(!1)}),(0,s.jsx)(n.wI,{isOpen:m,connection:p,onSave:B,onClose:()=>u(!1)}),(0,s.jsx)(n.uo,{isOpen:!!F,onClose:()=>E(null),onConfirm:F?.onConfirm,title:F?.title||"Confirm",message:F?.message,variant:"danger"})]})}b.propTypes={until:p().string.isRequired},f.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,isOAuth:p().bool.isRequired,isFirst:p().bool.isRequired,isLast:p().bool.isRequired,onMoveUp:p().func.isRequired,onMoveDown:p().func.isRequired,onToggleActive:p().func.isRequired,onEdit:p().func.isRequired,onDelete:p().func.isRequired},g.propTypes={isOpen:p().bool.isRequired,provider:p().string,providerName:p().string,onSave:p().func.isRequired,onClose:p().func.isRequired},y.propTypes={providerId:p().string.isRequired,isOAuth:p().bool};var v=a(28777),j=a(11059),w=a(78559);function N({model:e,fullModel:t,copied:a,onCopy:r,testStatus:l,isCustom:o,isFree:i,onDeleteAlias:n,onTest:d,isTesting:c}){let m="ok"===l?"#22c55e":"error"===l?"#ef4444":void 0;return(0,s.jsx)("div",{className:`group px-3 py-2 rounded-lg border ${"ok"===l?"border-green-500/40":"error"===l?"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:m?{color:m}:void 0,children:"ok"===l?"check_circle":"error"===l?"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:()=>r(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"})]}),i&&(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:n,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 k({isOpen:e,onSave:t,onClose:a}){let[r,l]=(0,i.useState)(""),o=()=>{r.trim()&&(t(r.trim()),l(""))};return(0,s.jsx)(n.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:r,onChange:e=>l(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)(n.$n,{onClick:o,fullWidth:!0,disabled:!r.trim(),children:"Add"}),(0,s.jsx)(n.$n,{onClick:a,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function C({providerId:e,kindFilter:t,providerAliasOverride:a}){let{copied:r,copy:l}=(0,j.C)(),[o,d]=(0,i.useState)({}),[m,u]=(0,i.useState)([]),[p,x]=(0,i.useState)({}),[h,b]=(0,i.useState)(null),[f,g]=(0,i.useState)(""),[y,S]=(0,i.useState)(!1),[$,F]=(0,i.useState)([]),E=a||(0,c.wG)(e),A=t||"llm",T=(0,i.useCallback)(async()=>{try{let[t,a,s]=await Promise.all([fetch("/api/models/alias"),fetch("/api/providers",{cache:"no-store"}),fetch("/api/models/custom",{cache:"no-store"})]),r=await t.json(),l=await a.json(),o=await s.json();t.ok&&d(r.aliases||{}),a.ok&&F((l.connections||[]).filter(t=>t.provider===e)),s.ok&&u(o.models||[])}catch(e){(0,w.s)("ModelsCard fetch error:",e)}},[e]);(0,i.useEffect)(()=>{T()},[T]);let R=async(e,t)=>{let a=`${E}/${e}`;try{(await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a,alias:t})})).ok&&await T()}catch(e){(0,w.s)("set alias error:",e)}},P=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await T()}catch(e){(0,w.s)("delete alias error:",e)}},I=async e=>{try{(await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:E,id:e,type:A})})).ok&&(await T(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){(0,w.s)("add custom model error:",e)}},_=async e=>{try{let t=new URLSearchParams({providerAlias:E,id:e,type:A});(await fetch(`/api/models/custom?${t}`,{method:"DELETE"})).ok&&(await T(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){(0,w.s)("delete custom model error:",e)}},O=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:`${E}/${e}`,kind:t})}),s=await a.json();x(t=>({...t,[e]:s.ok?"ok":"error"})),g(s.ok?"":s.error||"Model not reachable")}catch{x(t=>({...t,[e]:"error"})),g("Network error")}finally{b(null)}}},M=(0,v.KC)(e),L=t?M.filter(e=>e.kinds?e.kinds.includes(t):(0,v.CP)(e,"llm")===t):M,K=m.filter(e=>e.providerAlias===E&&(0,v.CP)(e,"llm")===A&&!L.some(t=>t.id===e.id));return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.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()}`:""]})}),f&&(0,s.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:f}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-3",children:[L.map(e=>{let t=`${E}/${e.id}`,a=Object.entries(o).find(([,e])=>e===t)?.[0];return(0,s.jsx)(N,{model:e,fullModel:`${E}/${e.id}`,alias:a,copied:r,onCopy:l,onSetAlias:t=>R(e.id,t),onDeleteAlias:()=>P(a),testStatus:p[e.id],onTest:$.length>0?()=>O(e.id):void 0,isTesting:h===e.id,isFree:e.isFree},e.id)}),K.map(e=>(0,s.jsx)(N,{model:{id:e.id,name:e.name},fullModel:`${E}/${e.id}`,copied:r,onCopy:l,onSetAlias:()=>{},onDeleteAlias:()=>_(e.id),testStatus:p[e.id],onTest:$.length>0?()=>O(e.id):void 0,isTesting:h===e.id,isCustom:!0},`${e.id}-${e.type}`)),(0,s.jsxs)("button",{onClick:()=>S(!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)(k,{isOpen:y,onSave:async e=>{await I(e),S(!1)},onClose:()=>S(!1)})]})}function S({label:e,htmlFor:t,children:a}){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)(t?"label":"span",{htmlFor:t,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:a})]})}N.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},k.propTypes={isOpen:p().bool.isRequired,onSave:p().func.isRequired,onClose:p().func.isRequired},C.propTypes={providerId:p().string.isRequired,kindFilter:p().string,providerAliasOverride:p().string};let $={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],{17845:(e,t,a)=>{Promise.resolve().then(a.bind(a,41095))},35497:(e,t,a)=>{"use strict";a.d(t,{x0:()=>N.default,Ex:()=>d.default,$n:()=>s.default,nh:()=>F.default,Zp:()=>o.default,Qv:()=>n.CardSkeleton,CK:()=>x.default,uo:()=>i.ConfirmModal,G9:()=>y.default,wI:()=>w.default,vj:()=>j.default,vE:()=>v.default,pd:()=>r.default,Mh:()=>g.default,uR:()=>p.default,Nf:()=>h.default,aF:()=>i.default,rq:()=>u.default,gw:()=>k.default,LF:()=>m.default,Wx:()=>$.default,gM:()=>f.default,Iz:()=>C.default,l6:()=>l.default,lM:()=>c.default,m_:()=>S.default,jK:()=>b.default});var s=a(92542),r=a(11910),l=a(98),o=a(84588),i=a(81127),n=a(25086);a(56319);var d=a(56061),c=a(98542);a(38587),a(21110),a(92622),a(8823),a(92173);var m=a(90882),u=a(72908),p=a(28815),x=a(45455),h=a(28058),b=a(4809);a(21931),a(80752),a(40197);var f=a(23615);a(44736);var g=a(62899);a(94230);var y=a(30815),v=a(23936),j=a(95088),w=a(73579),N=a(96748),k=a(4823),C=a(28067),S=a(97677),$=a(51825),F=a(29366);a(76361),a(91450)},41095:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>D});var s=a(95155),r=a(73321),l=a(98500),o=a.n(l),i=a(12115),n=a(35497),d=a(57250),c=a(88105),m=a(70217),u=a(14051),p=a.n(u),x=a(65921),h=a(53578);function b({until:e}){let[t,a]=(0,i.useState)("");return((0,i.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-orange-500 font-mono",children:["⏱ ",t]}):null}function f({connection:e,isOAuth:t,isFirst:a,isLast:r,onMoveUp:l,onMoveDown:o,onToggleActive:d,onEdit:c,onDelete:u}){let[p,x]=(0,i.useState)(!1),h=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,g=h?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",y="",v=e.providerSpecificData?.connectionProxyUrl;if(v)try{let e=new URL(v);y=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{y=v}let j=e.providerSpecificData?.connectionNoProxy||"",w=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(Boolean).sort()[0]||null;(0,i.useEffect)(()=>{let t=()=>{x(!!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=w?setInterval(t,1e3):null;return()=>{a&&clearInterval(a)}},[e,w]);let N="unavailable"!==e.testStatus||p?e.testStatus:"active",k=t?e.name||e.email||e.displayName||"OAuth Account":e.name;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:l,disabled:a,className:`p-0.5 rounded ${a?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,s.jsx)("button",{onClick:o,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,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:t?"lock":"key"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:k}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-1",children:[(0,s.jsx)(n.Ex,{variant:(0,m.g)(e.isActive,N),size:"sm",dot:!0,children:!1===e.isActive?"disabled":N||"Unknown"}),h&&(0,s.jsx)(n.Ex,{variant:"success",size:"sm",children:"Proxy"}),p&&!1!==e.isActive&&(0,s.jsx)(b,{until:w}),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]})]}),h&&(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:g,children:g}),y&&(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:y}),j&&(0,s.jsxs)("span",{className:"text-[11px] text-text-muted truncate max-w-[320px]",title:j,children:["no_proxy: ",j]})]})]})]}),(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:[(0,s.jsxs)("button",{onClick:c,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:u,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)(n.lM,{size:"sm",checked:e.isActive??!0,onChange:d,title:e.isActive??!0?"Disable":"Enable"})]})]})}function g({isOpen:e,provider:t,providerName:a,onSave:r,onClose:l}){let[o,d]=(0,i.useState)({name:"",apiKey:"",priority:1}),[c,m]=(0,i.useState)(!1),[u,p]=(0,i.useState)(null),[x,h]=(0,i.useState)(!1),b=o.name.trim().length>0,f=o.apiKey.trim().length>0,y=async()=>{let e=o.apiKey.trim();if(e){m(!0);try{let a=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:e})}),s=await a.json();p(s.valid?"success":"failed")}catch{p("failed")}finally{m(!1)}}},v=async()=>{let e=o.name.trim(),a=o.apiKey.trim();if(t&&e&&a){h(!0);try{let s=!1;try{m(!0),p(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:a})});s=!!(await e.json()).valid,p(s?"success":"failed")}catch{p("failed")}finally{m(!1)}await r({name:e,apiKey:a,priority:o.priority,testStatus:s?"active":"unknown"})}finally{h(!1)}}};return t?(0,s.jsx)(n.aF,{isOpen:e,title:`Add ${a||t} API Key`,onClose:l,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:o.name,onChange:e=>d({...o,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",autoComplete:"off",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:o.apiKey,onChange:e=>d({...o,apiKey:e.target.value})})]}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(n.$n,{onClick:y,disabled:!f||c||x,variant:"secondary",children:c?"Checking...":"Check"})})]}),u&&(0,s.jsx)(n.Ex,{variant:"success"===u?"success":"error",children:"success"===u?"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",min:1,className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:o.priority,onChange:e=>d({...o,priority:Number.parseInt(e.target.value)||1})})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(n.$n,{onClick:v,fullWidth:!0,disabled:!b||!f||x,children:x?"Saving...":"Save"}),(0,s.jsx)(n.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function y({providerId:e,isOAuth:t}){let[a,r]=(0,i.useState)([]),[l,o]=(0,i.useState)(!0),[d,c]=(0,i.useState)(!1),[m,u]=(0,i.useState)(!1),[p,b]=(0,i.useState)(null),[v,j]=(0,i.useState)(null),[w,N]=(0,i.useState)("1"),[k,C]=(0,i.useState)(!1),[S,$]=(0,i.useState)("30"),[F,E]=(0,i.useState)(null),A=(0,x.i)(e=>e.error),T=(0,i.useCallback)(async()=>{try{let[t,a]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]);if(!t.ok||!a.ok)throw Error("Failed to load connections");let s=await t.json(),l=await a.json();r((s.connections||[]).filter(t=>t.provider===e));let o=(l.providerStrategies||{})[e]||{};j(o.fallbackStrategy||null),N(null!=o.stickyRoundRobinLimit?String(o.stickyRoundRobinLimit):"1");let i=o.accountScheduler||{};C(!0===i.enabled),$(String(Math.max(1,Math.round((i.sessionAffinityTtlSeconds||1800)/60))))}catch(e){A(e?.message||"Failed to load connections")}finally{o(!1)}},[A,e]);(0,i.useEffect)(()=>{T()},[T]);let R=async(t,a)=>{try{return await (0,h.T)(e,e=>{let s={...e};return t?s.fallbackStrategy=t:delete s.fallbackStrategy,"round-robin"===t&&""!==a?s.stickyRoundRobinLimit=Number(a)||3:t||delete s.stickyRoundRobinLimit,s}),!0}catch(e){return A(e?.message||"Failed to save provider strategy"),!1}},P=async(t,a)=>{let s=Math.min(1440,Math.max(1,Number.parseInt(a,10)||30));try{return await (0,h.T)(e,e=>({...e,accountScheduler:{...e.accountScheduler||{},enabled:t,sessionAffinityTtlSeconds:60*s}})),!0}catch(e){return A(e?.message||"Failed to save balanced scheduler"),!1}},I=async e=>{await P(k,e)&&$(e)},_=async e=>{await R("round-robin",e)&&N(e)},M=async(e,t)=>{let s=[...a];[s[e],s[t]]=[s[t],s[e]],r(s);try{if((await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])).some(e=>!e.ok))throw Error("Failed to reorder connections")}catch(e){A(e?.message||"Failed to reorder connections"),await T()}},O=async e=>{let t=a.find(t=>t.id===e),s=t?.name?.trim()||t?.email?.trim()||e;E({title:"Delete Connection",message:`Delete connection “${s}”?`,onConfirm:async()=>{E(null);try{let t=await fetch(`/api/providers/${e}`,{method:"DELETE"});if(!t.ok)throw Error(`Failed to delete connection (${t.status})`);r(t=>t.filter(t=>t.id!==e))}catch(e){A("Failed to delete connection")}}})},L=async(e,t)=>{try{let a=await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})});if(!a.ok)throw Error(`Failed to toggle connection (${a.status})`);r(a=>a.map(a=>a.id===e?{...a,isActive:t}:a))}catch(e){A("Failed to toggle connection")}},K=async t=>{try{let a=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,...t})});if(!a.ok)throw Error(`Failed to save API key (${a.status})`);await T(),c(!1)}catch(e){A("Failed to save API key")}},B=async e=>{try{let t=await fetch(`/api/providers/${p.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(`Failed to update connection (${t.status})`);await T(),u(!1)}catch(e){A("Failed to update connection")}};if(l)return(0,s.jsx)(n.Zp,{children:(0,s.jsx)("div",{className:"h-20 animate-pulse bg-black/5 rounded-lg"})});let D=k?"balanced":"round-robin"===v?"round-robin":"fill-first",U=async e=>{"balanced"===e?await P(!0,S)&&C(!0):"round-robin"===e?(k&&(await P(!1,S),C(!1)),await R("round-robin",w||"1")&&j("round-robin")):(k&&(await P(!1,S),C(!1)),await R("fill-first","")&&j("fill-first"))};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.Zp,{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between mb-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,s.jsxs)("p",{className:"text-xs text-text-muted mt-0.5",children:["Manage accounts and selection strategy for ",e]})]}),a.length>1&&(0,s.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border/40 bg-surface-2/40 p-3 text-xs",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("span",{className:"font-semibold text-text-main",children:"Account Strategy"}),(0,s.jsxs)("div",{className:"inline-flex rounded-lg border border-border/60 bg-background/60 p-0.5",children:[(0,s.jsx)("button",{type:"button",onClick:()=>U("fill-first"),className:`rounded-md px-2 py-1 text-[11px] font-medium transition-all ${"fill-first"===D?"bg-primary text-black font-semibold shadow-xs":"text-text-muted hover:text-text-main"}`,children:"Fill-First"}),(0,s.jsx)("button",{type:"button",onClick:()=>U("round-robin"),className:`rounded-md px-2 py-1 text-[11px] font-medium transition-all ${"round-robin"===D?"bg-primary text-black font-semibold shadow-xs":"text-text-muted hover:text-text-main"}`,children:"Round Robin"}),(0,s.jsx)("button",{type:"button",onClick:()=>U("balanced"),className:`rounded-md px-2 py-1 text-[11px] font-medium transition-all ${"balanced"===D?"bg-primary text-black font-semibold shadow-xs":"text-text-muted hover:text-text-main"}`,children:"Balanced"})]})]}),"fill-first"===D&&(0,s.jsx)("p",{className:"max-w-md text-[11px] text-text-muted",children:"Routes all requests to top-priority connection first. Spills over to subsequent accounts on rate limit (429) or quota exhaustion."}),"round-robin"===D&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-text-muted",children:[(0,s.jsx)("span",{children:"Cycles evenly across accounts."}),(0,s.jsxs)("label",{className:"inline-flex items-center gap-1",children:["Sticky limit:",(0,s.jsx)("input",{type:"number",min:1,max:100,value:w,onChange:e=>_(e.target.value),className:"w-12 px-1.5 py-0.5 text-[11px] border border-border rounded bg-background focus:outline-none focus:border-primary"})]})]}),"balanced"===D&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-text-muted",children:[(0,s.jsx)("span",{children:"Least in-flight concurrency with session affinity."}),(0,s.jsxs)("label",{className:"inline-flex items-center gap-1",children:["Affinity:",(0,s.jsx)("input",{"aria-label":"Session affinity minutes",type:"number",min:1,max:1440,value:S,onChange:e=>I(e.target.value),className:"w-14 px-1.5 py-0.5 text-[11px] border border-border rounded bg-background focus:outline-none focus:border-primary"}),"min"]})]})]})]}),0===a.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.jsx)(n.$n,{size:"sm",icon:"add",onClick:()=>c(!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]",children:a.map((e,r)=>(0,s.jsx)(f,{connection:e,isOAuth:t,isFirst:0===r,isLast:r===a.length-1,onMoveUp:()=>M(r,r-1),onMoveDown:()=>M(r,r+1),onToggleActive:t=>L(e.id,t),onEdit:()=>{b(e),u(!0)},onDelete:()=>O(e.id)},e.id))}),(0,s.jsx)("div",{className:"mt-4 flex justify-stretch sm:justify-start",children:(0,s.jsx)(n.$n,{size:"sm",icon:"add",onClick:()=>c(!0),children:"Add"})})]})]}),(0,s.jsx)(g,{isOpen:d,provider:e,onSave:K,onClose:()=>c(!1)}),(0,s.jsx)(n.wI,{isOpen:m,connection:p,onSave:B,onClose:()=>u(!1)}),(0,s.jsx)(n.uo,{isOpen:!!F,onClose:()=>E(null),onConfirm:F?.onConfirm,title:F?.title||"Confirm",message:F?.message,variant:"danger"})]})}b.propTypes={until:p().string.isRequired},f.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,isOAuth:p().bool.isRequired,isFirst:p().bool.isRequired,isLast:p().bool.isRequired,onMoveUp:p().func.isRequired,onMoveDown:p().func.isRequired,onToggleActive:p().func.isRequired,onEdit:p().func.isRequired,onDelete:p().func.isRequired},g.propTypes={isOpen:p().bool.isRequired,provider:p().string,providerName:p().string,onSave:p().func.isRequired,onClose:p().func.isRequired},y.propTypes={providerId:p().string.isRequired,isOAuth:p().bool};var v=a(28777),j=a(11059),w=a(78559);function N({model:e,fullModel:t,copied:a,onCopy:r,testStatus:l,isCustom:o,isFree:i,onDeleteAlias:n,onTest:d,isTesting:c}){let m="ok"===l?"#22c55e":"error"===l?"#ef4444":void 0;return(0,s.jsx)("div",{className:`group px-3 py-2 rounded-lg border ${"ok"===l?"border-green-500/40":"error"===l?"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:m?{color:m}:void 0,children:"ok"===l?"check_circle":"error"===l?"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:()=>r(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"})]}),i&&(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:n,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 k({isOpen:e,onSave:t,onClose:a}){let[r,l]=(0,i.useState)(""),o=()=>{r.trim()&&(t(r.trim()),l(""))};return(0,s.jsx)(n.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:r,onChange:e=>l(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)(n.$n,{onClick:o,fullWidth:!0,disabled:!r.trim(),children:"Add"}),(0,s.jsx)(n.$n,{onClick:a,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function C({providerId:e,kindFilter:t,providerAliasOverride:a}){let{copied:r,copy:l}=(0,j.C)(),[o,d]=(0,i.useState)({}),[m,u]=(0,i.useState)([]),[p,x]=(0,i.useState)({}),[h,b]=(0,i.useState)(null),[f,g]=(0,i.useState)(""),[y,S]=(0,i.useState)(!1),[$,F]=(0,i.useState)([]),E=a||(0,c.wG)(e),A=t||"llm",T=(0,i.useCallback)(async()=>{try{let[t,a,s]=await Promise.all([fetch("/api/models/alias"),fetch("/api/providers",{cache:"no-store"}),fetch("/api/models/custom",{cache:"no-store"})]),r=await t.json(),l=await a.json(),o=await s.json();t.ok&&d(r.aliases||{}),a.ok&&F((l.connections||[]).filter(t=>t.provider===e)),s.ok&&u(o.models||[])}catch(e){(0,w.s)("ModelsCard fetch error:",e)}},[e]);(0,i.useEffect)(()=>{T()},[T]);let R=async(e,t)=>{let a=`${E}/${e}`;try{(await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a,alias:t})})).ok&&await T()}catch(e){(0,w.s)("set alias error:",e)}},P=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await T()}catch(e){(0,w.s)("delete alias error:",e)}},I=async e=>{try{(await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:E,id:e,type:A})})).ok&&(await T(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){(0,w.s)("add custom model error:",e)}},_=async e=>{try{let t=new URLSearchParams({providerAlias:E,id:e,type:A});(await fetch(`/api/models/custom?${t}`,{method:"DELETE"})).ok&&(await T(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){(0,w.s)("delete custom model error:",e)}},M=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:`${E}/${e}`,kind:t})}),s=await a.json();x(t=>({...t,[e]:s.ok?"ok":"error"})),g(s.ok?"":s.error||"Model not reachable")}catch{x(t=>({...t,[e]:"error"})),g("Network error")}finally{b(null)}}},O=(0,v.KC)(e),L=t?O.filter(e=>e.kinds?e.kinds.includes(t):(0,v.CP)(e,"llm")===t):O,K=m.filter(e=>e.providerAlias===E&&(0,v.CP)(e,"llm")===A&&!L.some(t=>t.id===e.id));return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.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()}`:""]})}),f&&(0,s.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:f}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-3",children:[L.map(e=>{let t=`${E}/${e.id}`,a=Object.entries(o).find(([,e])=>e===t)?.[0];return(0,s.jsx)(N,{model:e,fullModel:`${E}/${e.id}`,alias:a,copied:r,onCopy:l,onSetAlias:t=>R(e.id,t),onDeleteAlias:()=>P(a),testStatus:p[e.id],onTest:$.length>0?()=>M(e.id):void 0,isTesting:h===e.id,isFree:e.isFree},e.id)}),K.map(e=>(0,s.jsx)(N,{model:{id:e.id,name:e.name},fullModel:`${E}/${e.id}`,copied:r,onCopy:l,onSetAlias:()=>{},onDeleteAlias:()=>_(e.id),testStatus:p[e.id],onTest:$.length>0?()=>M(e.id):void 0,isTesting:h===e.id,isCustom:!0},`${e.id}-${e.type}`)),(0,s.jsxs)("button",{onClick:()=>S(!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)(k,{isOpen:y,onSave:async e=>{await I(e),S(!1)},onClose:()=>S(!1)})]})}function S({label:e,htmlFor:t,children:a}){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)(t?"label":"span",{htmlFor:t,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:a})]})}N.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},k.propTypes={isOpen:p().bool.isRequired,onSave:p().func.isRequired,onClose:p().func.isRequired},C.propTypes={providerId:p().string.isRequired,kindFilter:p().string,providerAliasOverride:p().string};let $={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
  ]
@@ -30,30 +30,30 @@
30
30
  }],
31
31
  "model": "...",
32
32
  "usage": { "prompt_tokens": 9, "total_tokens": 9 }
33
- }`;function E({providerId:e,customAlias:t}){let a=(0,c.gC)(e),r=a?t||e:(0,c.wG)(e),l=a?[]:(0,v.KC)(e).filter(e=>"embedding"===(0,v.CP)(e)),[o,d]=(0,i.useState)(l[0]?.id??""),[m,u]=(0,i.useState)("The quick brown fox jumps over the lazy dog"),[p,x]=(0,i.useState)(""),[h,b]=(0,i.useState)(""),[f,g]=(0,i.useState)(""),[y,w]=(0,i.useState)(null),[N,k]=(0,i.useState)(!1),[C,$]=(0,i.useState)(""),{copied:A,copy:T}=(0,j.C)(),{copied:R,copy:P}=(0,j.C)();(0,i.useEffect)(()=>{g(window.location.origin)},[]);let I=o?`${r}/${o}`:"",_=()=>{let e={model:I,input:m.trim()},t=Number(p);return p&&Number.isFinite(t)&&t>0&&(e.dimensions=t),e},O=`curl -X POST ${f}/v1/embeddings \\
33
+ }`;function E({providerId:e,customAlias:t}){let a=(0,c.gC)(e),r=a?t||e:(0,c.wG)(e),l=a?[]:(0,v.KC)(e).filter(e=>"embedding"===(0,v.CP)(e)),[o,d]=(0,i.useState)(l[0]?.id??""),[m,u]=(0,i.useState)("The quick brown fox jumps over the lazy dog"),[p,x]=(0,i.useState)(""),[h,b]=(0,i.useState)(""),[f,g]=(0,i.useState)(""),[y,w]=(0,i.useState)(null),[N,k]=(0,i.useState)(!1),[C,$]=(0,i.useState)(""),{copied:A,copy:T}=(0,j.C)(),{copied:R,copy:P}=(0,j.C)();(0,i.useEffect)(()=>{g(window.location.origin)},[]);let I=o?`${r}/${o}`:"",_=()=>{let e={model:I,input:m.trim()},t=Number(p);return p&&Number.isFinite(t)&&t>0&&(e.dimensions=t),e},M=`curl -X POST ${f}/v1/embeddings \\
34
34
  -H "Content-Type: application/json" \\
35
35
  -H "Authorization: Bearer ${h||"YOUR_KEY"}" \\
36
- -d '${JSON.stringify(_())}'`,M=async()=>{if(!m.trim()||!I||!h.trim())return;k(!0),$(""),w(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(_())}),s=Date.now()-e,r=await a.json();if(!a.ok)return void $(r?.error?.message||r?.error||`HTTP ${a.status}`);w({data:r,latencyMs:s})}catch(e){$(e.message||"Network error")}finally{k(!1)}},L=y?JSON.stringify(y.data,null,2):"";return(0,s.jsxs)(n.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)(S,{label:"Model",htmlFor:"embedding-example-model",children:a?(0,s.jsx)("input",{id:"embedding-example-model",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)("select",{id:"embedding-example-model",value:o,onChange:e=>d(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:l.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),(0,s.jsx)(S,{label:"Endpoint",htmlFor:"embedding-example-endpoint",children:(0,s.jsx)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:(0,s.jsx)("input",{id:"embedding-example-endpoint",value:f,onChange:e=>g(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"})})}),(0,s.jsx)(S,{label:"API Key",htmlFor:"embedding-example-key",children:(0,s.jsx)("input",{id:"embedding-example-key",type:"password",autoComplete:"off",value:h,onChange:e=>b(e.target.value),placeholder:"Paste a Switchboard client key secret (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)(S,{label:"Input",htmlFor:"embedding-example-input",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{id:"embedding-example-input",value:m,onChange:e=>u(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"}),m&&(0,s.jsx)("button",{type:"button",onClick:()=>u(""),"aria-label":"Clear input",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]","aria-hidden":"true",children:"close"})})]})}),(0,s.jsx)(S,{label:"Dimensions",htmlFor:"embedding-example-dimensions",children:(0,s.jsx)("input",{id:"embedding-example-dimensions",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:()=>T(O),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:A?"check":"content_copy"}),A?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:M,disabled:N||!m.trim()||!I||!h.trim(),className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-on-primary 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:N?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),N?"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:O})]}),C&&(0,s.jsx)("p",{role:"alert",className:"text-xs text-red-500 break-words",children:C}),(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 ",y&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",y.latencyMs,"ms"]})]}),y&&(0,s.jsxs)("button",{onClick:()=>P(L),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:R?"check":"content_copy"}),R?"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 F;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)})(y?.data)})]})]})]})}let A={"google-tts":{hasLanguageDropdown:!1,hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"hardcoded"},openai:{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"openai-tts-models",voiceKey:"openai-tts-voices",voicesPerModel:!0},openrouter:{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"openrouter-tts-models",voiceKey:"openrouter-tts-voices",voicesPerModel:!0},elevenlabs:{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",modelKey:"elevenlabs-tts-models",apiEndpoint:"/api/media-providers/tts/elevenlabs/voices"},"edge-tts":{hasLanguageDropdown:!1,hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"api-language"},"local-device":{hasLanguageDropdown:!1,hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"api-language"},nvidia:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},hyperbolic:{hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"config"},deepgram:{hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/deepgram/voices"},huggingface:{hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"config"},cartesia:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},playht:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},coqui:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},tortoise:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},inworld:{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",modelKey:"inworld-tts-models",apiEndpoint:"/api/media-providers/tts/inworld/voices"},qwen:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},minimax:{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/minimax/voices",defaultVoiceId:"English_expressive_narrator"},"minimax-cn":{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/minimax/voices?provider=minimax-cn",defaultVoiceId:"English_expressive_narrator"},gemini:{hasLanguageDropdown:!1,hasLanguageHint:!0,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"gemini-tts-models",voiceKey:"gemini-tts-voices",voicesPerModel:!0}};var T=a(63935),R=a(14683);let P=`// Audio will appear here after running.
36
+ -d '${JSON.stringify(_())}'`,O=async()=>{if(!m.trim()||!I||!h.trim())return;k(!0),$(""),w(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(_())}),s=Date.now()-e,r=await a.json();if(!a.ok)return void $(r?.error?.message||r?.error||`HTTP ${a.status}`);w({data:r,latencyMs:s})}catch(e){$(e.message||"Network error")}finally{k(!1)}},L=y?JSON.stringify(y.data,null,2):"";return(0,s.jsxs)(n.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)(S,{label:"Model",htmlFor:"embedding-example-model",children:a?(0,s.jsx)("input",{id:"embedding-example-model",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)("select",{id:"embedding-example-model",value:o,onChange:e=>d(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:l.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),(0,s.jsx)(S,{label:"Endpoint",htmlFor:"embedding-example-endpoint",children:(0,s.jsx)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:(0,s.jsx)("input",{id:"embedding-example-endpoint",value:f,onChange:e=>g(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"})})}),(0,s.jsx)(S,{label:"API Key",htmlFor:"embedding-example-key",children:(0,s.jsx)("input",{id:"embedding-example-key",type:"password",autoComplete:"off",value:h,onChange:e=>b(e.target.value),placeholder:"Paste a Switchboard client key secret (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)(S,{label:"Input",htmlFor:"embedding-example-input",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{id:"embedding-example-input",value:m,onChange:e=>u(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"}),m&&(0,s.jsx)("button",{type:"button",onClick:()=>u(""),"aria-label":"Clear input",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]","aria-hidden":"true",children:"close"})})]})}),(0,s.jsx)(S,{label:"Dimensions",htmlFor:"embedding-example-dimensions",children:(0,s.jsx)("input",{id:"embedding-example-dimensions",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:()=>T(M),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:A?"check":"content_copy"}),A?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:O,disabled:N||!m.trim()||!I||!h.trim(),className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-on-primary 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:N?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),N?"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:M})]}),C&&(0,s.jsx)("p",{role:"alert",className:"text-xs text-red-500 break-words",children:C}),(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 ",y&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",y.latencyMs,"ms"]})]}),y&&(0,s.jsxs)("button",{onClick:()=>P(L),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:R?"check":"content_copy"}),R?"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 F;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)})(y?.data)})]})]})]})}let A={"google-tts":{hasLanguageDropdown:!1,hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"hardcoded"},openai:{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"openai-tts-models",voiceKey:"openai-tts-voices",voicesPerModel:!0},openrouter:{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"openrouter-tts-models",voiceKey:"openrouter-tts-voices",voicesPerModel:!0},elevenlabs:{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",modelKey:"elevenlabs-tts-models",apiEndpoint:"/api/media-providers/tts/elevenlabs/voices"},"edge-tts":{hasLanguageDropdown:!1,hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"api-language"},"local-device":{hasLanguageDropdown:!1,hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"api-language"},nvidia:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},hyperbolic:{hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"config"},deepgram:{hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/deepgram/voices"},huggingface:{hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"config"},cartesia:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},playht:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},coqui:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},tortoise:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},inworld:{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",modelKey:"inworld-tts-models",apiEndpoint:"/api/media-providers/tts/inworld/voices"},qwen:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},minimax:{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/minimax/voices",defaultVoiceId:"English_expressive_narrator"},"minimax-cn":{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/minimax/voices?provider=minimax-cn",defaultVoiceId:"English_expressive_narrator"},gemini:{hasLanguageDropdown:!1,hasLanguageHint:!0,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"gemini-tts-models",voiceKey:"gemini-tts-voices",voicesPerModel:!0}};var T=a(63935),R=a(14683);let P=`// Audio will appear here after running.
37
37
  // Example JSON response (response_format=json):
38
38
  {
39
39
  "format": "mp3",
40
40
  "audio": "//NExAANaAIIAUAAANNNNNNNN..." // base64 encoded MP3
41
- }`;function I({providerId:e}){let t,a,r=(0,c.wG)(e),l=A[e]||A["edge-tts"],[o,d]=(0,i.useState)(l.defaultVoiceId||""),[m,u]=(0,i.useState)(""),[p,x]=(0,i.useState)(l.defaultVoiceId||""),[h,b]=(0,i.useState)([]),[f,g]=(0,i.useState)(""),[y,w]=(0,i.useState)(()=>{let t=c.Q2[e]?.ttsConfig?.models;if(t?.length)return t[0].id;if(l.hasModelSelector&&l.modelKey){let e=(0,v.KC)(l.modelKey);return e?.[0]?.id||""}return""}),[N,k]=(0,i.useState)("Hello, this is a text to speech test."),[C,$]=(0,i.useState)(""),[F,E]=(0,i.useState)(""),[_,O]=(0,i.useState)("mp3"),[M,L]=(0,i.useState)(""),[K,B]=(0,i.useState)(null),[D,U]=(0,i.useState)(!1),[q,z]=(0,i.useState)(""),[J,V]=(0,i.useState)(null),{copied:H,copy:W}=(0,j.C)(),[G,Y]=(0,i.useState)(!1),[Z,Q]=(0,i.useState)([]),[X,ee]=(0,i.useState)(!1),[et,ea]=(0,i.useState)(""),[es,er]=(0,i.useState)(""),[el,eo]=(0,i.useState)({}),[ei,en]=(0,i.useState)("");(0,i.useEffect)(()=>{if(E(window.location.origin),"hardcoded"===l.voiceSource){let t=l.hasModelSelector&&l.modelKey&&(0,v.KC)(l.modelKey)?.[0]?.id||"",a=l.voicesPerModel&&t?(0,T.jY)(e,t)||[]:(0,v.KC)(l.voiceKey||e).filter(e=>"tts"===(0,v.CP)(e));if(a.length)if(l.hasBrowseButton){let e=a.find(e=>"en"===e.id)||a[0];g(e.id),d(e.id),u(e.name),b([{id:e.id,name:e.name}])}else b(a),d(a[0].id),u(a[0].name||a[0].id)}},[l.hasBrowseButton,l.hasModelSelector,l.modelKey,l.voiceKey,l.voiceSource,l.voicesPerModel,e]),(0,i.useEffect)(()=>{if(!l.voicesPerModel||!y)return;let t=(0,T.jY)(e,y)||[];b(t),t.length&&(d(t[0].id),u(t[0].name||t[0].id))},[l.voicesPerModel,e,y]);let ed=async()=>{if(Y(!0),ea(""),er(""),!Z.length){ee(!0);try{if("hardcoded"===l.voiceSource){let t=l.voiceKey||e,a=(0,v.KC)(t).filter(e=>"tts"===(0,v.CP)(e)),s={};for(let e of a)s[e.id]||(s[e.id]={code:e.id,name:e.name,voices:[{id:e.id,name:e.name}]});eo(s),Q(Object.values(s).sort((e,t)=>e.name.localeCompare(t.name)))}else{let t=l.apiEndpoint?l.apiEndpoint:`/api/media-providers/tts/voices?provider=${"local-device"===e?"local-device":"edge-tts"}`,a=await fetch(t),s=await a.json();if(s.error)return void er(s.error);Q(s.languages||[]),eo(s.byLang||{})}}catch(e){er(e.message)}finally{ee(!1)}}},ec=et?Z.filter(e=>e.name.toLowerCase().includes(et.toLowerCase())||e.code.toLowerCase().includes(et.toLowerCase())):Z,em=l.hasVoiceIdInput&&p||o,eu=l.hasModelSelector&&y&&em?`${r}/${y}/${em}`:l.hasModelSelector&&y?`${r}/${y}`:em?`${r}/${em}`:"",ep=(t={model:eu,input:N},l.hasLanguageHint&&ei&&(t.language=ei),t),ex=`curl -X POST ${F}/v1/audio/speech${"json"===_?"?response_format=json":""} \\
41
+ }`;function I({providerId:e}){let t,a,r=(0,c.wG)(e),l=A[e]||A["edge-tts"],[o,d]=(0,i.useState)(l.defaultVoiceId||""),[m,u]=(0,i.useState)(""),[p,x]=(0,i.useState)(l.defaultVoiceId||""),[h,b]=(0,i.useState)([]),[f,g]=(0,i.useState)(""),[y,w]=(0,i.useState)(()=>{let t=c.Q2[e]?.ttsConfig?.models;if(t?.length)return t[0].id;if(l.hasModelSelector&&l.modelKey){let e=(0,v.KC)(l.modelKey);return e?.[0]?.id||""}return""}),[N,k]=(0,i.useState)("Hello, this is a text to speech test."),[C,$]=(0,i.useState)(""),[F,E]=(0,i.useState)(""),[_,M]=(0,i.useState)("mp3"),[O,L]=(0,i.useState)(""),[K,B]=(0,i.useState)(null),[D,U]=(0,i.useState)(!1),[q,z]=(0,i.useState)(""),[J,V]=(0,i.useState)(null),{copied:H,copy:W}=(0,j.C)(),[G,Y]=(0,i.useState)(!1),[Z,Q]=(0,i.useState)([]),[X,ee]=(0,i.useState)(!1),[et,ea]=(0,i.useState)(""),[es,er]=(0,i.useState)(""),[el,eo]=(0,i.useState)({}),[ei,en]=(0,i.useState)("");(0,i.useEffect)(()=>{if(E(window.location.origin),"hardcoded"===l.voiceSource){let t=l.hasModelSelector&&l.modelKey&&(0,v.KC)(l.modelKey)?.[0]?.id||"",a=l.voicesPerModel&&t?(0,T.jY)(e,t)||[]:(0,v.KC)(l.voiceKey||e).filter(e=>"tts"===(0,v.CP)(e));if(a.length)if(l.hasBrowseButton){let e=a.find(e=>"en"===e.id)||a[0];g(e.id),d(e.id),u(e.name),b([{id:e.id,name:e.name}])}else b(a),d(a[0].id),u(a[0].name||a[0].id)}},[l.hasBrowseButton,l.hasModelSelector,l.modelKey,l.voiceKey,l.voiceSource,l.voicesPerModel,e]),(0,i.useEffect)(()=>{if(!l.voicesPerModel||!y)return;let t=(0,T.jY)(e,y)||[];b(t),t.length&&(d(t[0].id),u(t[0].name||t[0].id))},[l.voicesPerModel,e,y]);let ed=async()=>{if(Y(!0),ea(""),er(""),!Z.length){ee(!0);try{if("hardcoded"===l.voiceSource){let t=l.voiceKey||e,a=(0,v.KC)(t).filter(e=>"tts"===(0,v.CP)(e)),s={};for(let e of a)s[e.id]||(s[e.id]={code:e.id,name:e.name,voices:[{id:e.id,name:e.name}]});eo(s),Q(Object.values(s).sort((e,t)=>e.name.localeCompare(t.name)))}else{let t=l.apiEndpoint?l.apiEndpoint:`/api/media-providers/tts/voices?provider=${"local-device"===e?"local-device":"edge-tts"}`,a=await fetch(t),s=await a.json();if(s.error)return void er(s.error);Q(s.languages||[]),eo(s.byLang||{})}}catch(e){er(e.message)}finally{ee(!1)}}},ec=et?Z.filter(e=>e.name.toLowerCase().includes(et.toLowerCase())||e.code.toLowerCase().includes(et.toLowerCase())):Z,em=l.hasVoiceIdInput&&p||o,eu=l.hasModelSelector&&y&&em?`${r}/${y}/${em}`:l.hasModelSelector&&y?`${r}/${y}`:em?`${r}/${em}`:"",ep=(t={model:eu,input:N},l.hasLanguageHint&&ei&&(t.language=ei),t),ex=`curl -X POST ${F}/v1/audio/speech${"json"===_?"?response_format=json":""} \\
42
42
  -H "Content-Type: application/json" \\
43
43
  -H "Authorization: Bearer ${C||"YOUR_KEY"}" \\
44
44
  -d '${JSON.stringify(ep)}' \\
45
- ${"json"===_?"":"--output speech.mp3"}`,eh=async()=>{if(!N.trim()||!eu||!C.trim())return;U(!0),z(""),L(""),B(null);let e=Date.now();try{let t={"Content-Type":"application/json"};C&&(t.Authorization=`Bearer ${C}`);let a=`/api/v1/audio/speech${"json"===_?"?response_format=json":""}`,s=await fetch(a,{method:"POST",headers:t,body:JSON.stringify({...ep,input:N.trim()})});if(V(Date.now()-e),!s.ok){let e=await s.json().catch(()=>({}));z(e?.error?.message||e?.error||`HTTP ${s.status}`);return}if("json"===_){let e=await s.json();B(e);let t=await fetch(`data:audio/mp3;base64,${e.audio}`).then(e=>e.blob());L(URL.createObjectURL(t))}else{let e=await s.blob();L(URL.createObjectURL(e))}}catch(e){z(e.message||"Network error")}finally{U(!1)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.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)(S,{label:"Endpoint",children:(0,s.jsx)("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:[F,"/v1/audio/speech"]})})}),(0,s.jsx)(S,{label:"API Key",htmlFor:"tts-example-key",children:(0,s.jsx)("input",{id:"tts-example-key",type:"password",autoComplete:"off",value:C,onChange:e=>$(e.target.value),placeholder:"Paste a Switchboard client key secret (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"})}),l.hasModelSelector&&(l.modelKey||(0,v.KC)(e).some(e=>"tts"===(0,v.CP)(e)))&&(0,s.jsx)(S,{label:"Model",htmlFor:"tts-example-model",children:(0,s.jsx)("select",{id:"tts-example-model",value:y,onChange:e=>w(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:((a=(0,v.KC)(e).filter(e=>"tts"===(0,v.CP)(e))).length?a:(0,v.KC)(l.modelKey)||[]).map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),l.hasLanguageHint&&(0,s.jsx)(S,{label:"Language",htmlFor:"tts-example-language-hint",children:(0,s.jsxs)("select",{id:"tts-example-language-hint",value:ei,onChange:e=>en(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"",children:"Auto-detect"}),R.I.map(e=>(0,s.jsx)("option",{value:e.name,children:e.name},e.id))]})}),l.hasBrowseButton&&(0,s.jsx)(S,{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:ed,"aria-haspopup":"dialog","aria-expanded":G,"aria-label":f?`Language: ${Z.find(e=>e.code===f)?.name||f}. Change language`:"Select language",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:Z.find(e=>e.code===f)?.name||f}):(0,s.jsx)("span",{className:"text-text-muted",children:"No language selected"})}),(0,s.jsxs)("button",{onClick:ed,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"]})]})}),h.length>0&&(0,s.jsx)(S,{label:"Voice",children:(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.map(e=>(0,s.jsxs)("button",{onClick:()=>{d(e.id),u(e.name),l.hasVoiceIdInput&&x(e.id)},className:`px-2.5 py-1 rounded-full text-xs border transition-colors ${o===e.id?"bg-primary/15 border-primary/40 text-primary font-medium":"border-border text-text-muted hover:text-primary hover:border-primary/40"}`,children:[e.name,e.gender?` \xb7 ${e.gender[0].toUpperCase()}`:"",!0===e.free_users_allowed&&(0,s.jsx)("span",{className:"ml-1.5 px-1 py-0.5 text-[9px] font-semibold rounded bg-green-500/15 text-green-600 border border-green-500/20",children:"Free"}),!1===e.free_users_allowed&&(0,s.jsx)("span",{className:"ml-1.5 px-1 py-0.5 text-[9px] font-semibold rounded bg-amber-500/15 text-amber-600 border border-amber-500/20",children:"Paid"})]},e.id))})}),l.hasVoiceIdInput&&(0,s.jsx)(S,{label:"Voice ID",htmlFor:"tts-example-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",{id:"tts-example-voice-id",value:p,onChange:e=>{x(e.target.value),d(e.target.value)},placeholder:"e.g. CwhRBWXzGAHq8TQ4Fs17",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"}),p&&(0,s.jsx)("button",{type:"button",onClick:()=>{x(""),d("")},"aria-label":"Clear voice ID",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]","aria-hidden":"true",children:"close"})})]})})}),l.hasLanguageDropdown&&(0,s.jsx)(S,{label:"Language",htmlFor:"tts-example-language",children:(0,s.jsx)("select",{id:"tts-example-language",value:o,onChange:t=>{let a=(0,v.KC)(e).filter(e=>"tts"===(0,v.CP)(e)).find(e=>e.id===t.target.value);d(t.target.value),u(a?.name||t.target.value)},className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:(0,v.KC)(e).filter(e=>"tts"===(0,v.CP)(e)).map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),(0,s.jsx)(S,{label:"Input",htmlFor:"tts-example-input",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{id:"tts-example-input",value:N,onChange:e=>k(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"}),N&&(0,s.jsx)("button",{type:"button",onClick:()=>k(""),"aria-label":"Clear input",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]","aria-hidden":"true",children:"close"})})]})}),(0,s.jsx)(S,{label:"Output Format",htmlFor:"tts-example-format",children:(0,s.jsxs)("select",{id:"tts-example-format",value:_,onChange:e=>O(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"mp3",children:"MP3 (Binary)"}),(0,s.jsx)("option",{value:"json",children:"JSON (Base64)"})]})}),(0,s.jsxs)("div",{className:"mt-1",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsxs)("button",{onClick:()=>W(ex),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:H?"check":"content_copy"}),H?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:eh,disabled:D||!N.trim()||!eu||!C.trim(),className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-on-primary text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:D?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),D?"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:ex})]}),q&&(0,s.jsx)("p",{role:"alert",className:"text-xs text-red-500 break-words",children:q}),M?(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&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",J,"ms"]})]}),(0,s.jsxs)("a",{href:M,download:"speech.mp3",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})]}),(0,s.jsx)("audio",{controls:!0,src:M,className:"w-full"}),K&&(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:K.format,audio:K.audio?`${K.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:P})]})]})]}),G&&(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:()=>Y(!1),onKeyDown:e=>{"Escape"===e.key&&Y(!1)},children:(0,s.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"tts-language-modal-title",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",{id:"tts-language-modal-title",className:"text-sm font-semibold","data-i18n":"Select Language",children:"Select Language"}),(0,s.jsx)("button",{onClick:()=>Y(!1),"aria-label":"Close language picker",className:"text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",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,type:"text","aria-label":"Search language",value:et,onChange:e=>ea(e.target.value),placeholder:"Search language...","data-i18n-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:[es&&(0,s.jsx)("p",{className:"text-xs text-red-500 px-2 py-1",children:es}),X?(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:[ec.map(e=>(0,s.jsxs)("button",{onClick:()=>{let t;return Y(!1),g(e.code),void(b(t=el[e.code]?.voices||[]),t.length&&(d(t[0].id),u(t[0].name),l.hasVoiceIdInput&&x(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===ec.length&&(0,s.jsx)("p",{className:"text-xs text-text-muted px-2 py-3",children:"No languages found."})]})]})]})})]})}var _=a(5772);let O="https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png";function M(e){let t="string"==typeof e?e.trim():"";return t?/^(data:image\/|https?:\/\/)/i.test(t)?t:`data:image/png;base64,${t}`:""}function L({providerId:e,kind:t}){let a=(0,c.wG)(e),r=(0,c.rs)(a)===e?a:e,l=c.rj.find(e=>e.id===t),o=$[t],d=o||{},m=(0,v.KC)(e).filter(e=>(0,v.CP)(e)===t),u=new Set(["image","video","music","imageToText"]).has(t),p=u&&0===m.length,[x,h]=(0,i.useState)(m[0]?.id??""),b=m.find(e=>e.id===x),f=!!b?.capabilities?.includes("edit"),g=!!b?.capabilities?.includes("mask"),[y,w]=(0,i.useState)(d.defaultInput||""),[N,k]=(0,i.useState)(""),[C,F]=(0,i.useState)(""),[E,A]=(0,i.useState)(()=>(d.extraFields||[]).reduce((e,t)=>(e[t.key]=t.default??"",e),{})),[T,R]=(0,i.useState)(""),[P,I]=(0,i.useState)(""),[K,B]=(0,i.useState)(null),[D,U]=(0,i.useState)(null),[q,z]=(0,i.useState)(null),[J,V]=(0,i.useState)("json"),[H,W]=(0,i.useState)(""),[G,Y]=(0,i.useState)(!1),[Z,Q]=(0,i.useState)(""),[X,ee]=(0,i.useState)([]),[et,ea]=(0,i.useState)(""),{copied:es,copy:er}=(0,j.C)(),{copied:el,copy:eo}=(0,j.C)();if((0,i.useEffect)(()=>{I(window.location.origin),fetch("/api/providers/client").then(e=>e.json()).then(t=>{ee((t.connections||[]).filter(t=>t.provider===e&&!1!==t.isActive))}).catch(()=>{})},[e]),!l||!o)return null;let ei=l.endpoint.path,en=u?x?`${r}/${x}`:p?"":r:r,ed="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"}:{},ec=N.trim()||ed.image||"",em=C.trim()||ed.mask_image||"",eu=M(ec),ep=M(em),ex=Object.entries(E).reduce((e,[t,a])=>(""===a||null==a||"number"==typeof a&&Number.isNaN(a)||(e[t]=a),e),{}),eh={model:en,[o.bodyKey]:y,...o.extraBody,...ex,...f&&ec?{image:ec}:{},...g&&em?{mask_image:em}:{}},eb="image"===t&&"binary"===J,ef="image"===t&&"codex"===e&&!eb,eg=`${ei}${eb?"?response_format=binary":""}`,ey=`-H "Content-Type: application/json" \\
45
+ ${"json"===_?"":"--output speech.mp3"}`,eh=async()=>{if(!N.trim()||!eu||!C.trim())return;U(!0),z(""),L(""),B(null);let e=Date.now();try{let t={"Content-Type":"application/json"};C&&(t.Authorization=`Bearer ${C}`);let a=`/api/v1/audio/speech${"json"===_?"?response_format=json":""}`,s=await fetch(a,{method:"POST",headers:t,body:JSON.stringify({...ep,input:N.trim()})});if(V(Date.now()-e),!s.ok){let e=await s.json().catch(()=>({}));z(e?.error?.message||e?.error||`HTTP ${s.status}`);return}if("json"===_){let e=await s.json();B(e);let t=await fetch(`data:audio/mp3;base64,${e.audio}`).then(e=>e.blob());L(URL.createObjectURL(t))}else{let e=await s.blob();L(URL.createObjectURL(e))}}catch(e){z(e.message||"Network error")}finally{U(!1)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.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)(S,{label:"Endpoint",children:(0,s.jsx)("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:[F,"/v1/audio/speech"]})})}),(0,s.jsx)(S,{label:"API Key",htmlFor:"tts-example-key",children:(0,s.jsx)("input",{id:"tts-example-key",type:"password",autoComplete:"off",value:C,onChange:e=>$(e.target.value),placeholder:"Paste a Switchboard client key secret (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"})}),l.hasModelSelector&&(l.modelKey||(0,v.KC)(e).some(e=>"tts"===(0,v.CP)(e)))&&(0,s.jsx)(S,{label:"Model",htmlFor:"tts-example-model",children:(0,s.jsx)("select",{id:"tts-example-model",value:y,onChange:e=>w(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:((a=(0,v.KC)(e).filter(e=>"tts"===(0,v.CP)(e))).length?a:(0,v.KC)(l.modelKey)||[]).map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),l.hasLanguageHint&&(0,s.jsx)(S,{label:"Language",htmlFor:"tts-example-language-hint",children:(0,s.jsxs)("select",{id:"tts-example-language-hint",value:ei,onChange:e=>en(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"",children:"Auto-detect"}),R.I.map(e=>(0,s.jsx)("option",{value:e.name,children:e.name},e.id))]})}),l.hasBrowseButton&&(0,s.jsx)(S,{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:ed,"aria-haspopup":"dialog","aria-expanded":G,"aria-label":f?`Language: ${Z.find(e=>e.code===f)?.name||f}. Change language`:"Select language",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:Z.find(e=>e.code===f)?.name||f}):(0,s.jsx)("span",{className:"text-text-muted",children:"No language selected"})}),(0,s.jsxs)("button",{onClick:ed,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"]})]})}),h.length>0&&(0,s.jsx)(S,{label:"Voice",children:(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.map(e=>(0,s.jsxs)("button",{onClick:()=>{d(e.id),u(e.name),l.hasVoiceIdInput&&x(e.id)},className:`px-2.5 py-1 rounded-full text-xs border transition-colors ${o===e.id?"bg-primary/15 border-primary/40 text-primary font-medium":"border-border text-text-muted hover:text-primary hover:border-primary/40"}`,children:[e.name,e.gender?` \xb7 ${e.gender[0].toUpperCase()}`:"",!0===e.free_users_allowed&&(0,s.jsx)("span",{className:"ml-1.5 px-1 py-0.5 text-[9px] font-semibold rounded bg-green-500/15 text-green-600 border border-green-500/20",children:"Free"}),!1===e.free_users_allowed&&(0,s.jsx)("span",{className:"ml-1.5 px-1 py-0.5 text-[9px] font-semibold rounded bg-amber-500/15 text-amber-600 border border-amber-500/20",children:"Paid"})]},e.id))})}),l.hasVoiceIdInput&&(0,s.jsx)(S,{label:"Voice ID",htmlFor:"tts-example-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",{id:"tts-example-voice-id",value:p,onChange:e=>{x(e.target.value),d(e.target.value)},placeholder:"e.g. CwhRBWXzGAHq8TQ4Fs17",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"}),p&&(0,s.jsx)("button",{type:"button",onClick:()=>{x(""),d("")},"aria-label":"Clear voice ID",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]","aria-hidden":"true",children:"close"})})]})})}),l.hasLanguageDropdown&&(0,s.jsx)(S,{label:"Language",htmlFor:"tts-example-language",children:(0,s.jsx)("select",{id:"tts-example-language",value:o,onChange:t=>{let a=(0,v.KC)(e).filter(e=>"tts"===(0,v.CP)(e)).find(e=>e.id===t.target.value);d(t.target.value),u(a?.name||t.target.value)},className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:(0,v.KC)(e).filter(e=>"tts"===(0,v.CP)(e)).map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),(0,s.jsx)(S,{label:"Input",htmlFor:"tts-example-input",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{id:"tts-example-input",value:N,onChange:e=>k(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"}),N&&(0,s.jsx)("button",{type:"button",onClick:()=>k(""),"aria-label":"Clear input",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]","aria-hidden":"true",children:"close"})})]})}),(0,s.jsx)(S,{label:"Output Format",htmlFor:"tts-example-format",children:(0,s.jsxs)("select",{id:"tts-example-format",value:_,onChange:e=>M(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"mp3",children:"MP3 (Binary)"}),(0,s.jsx)("option",{value:"json",children:"JSON (Base64)"})]})}),(0,s.jsxs)("div",{className:"mt-1",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsxs)("button",{onClick:()=>W(ex),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:H?"check":"content_copy"}),H?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:eh,disabled:D||!N.trim()||!eu||!C.trim(),className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-on-primary text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:D?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),D?"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:ex})]}),q&&(0,s.jsx)("p",{role:"alert",className:"text-xs text-red-500 break-words",children:q}),O?(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&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",J,"ms"]})]}),(0,s.jsxs)("a",{href:O,download:"speech.mp3",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})]}),(0,s.jsx)("audio",{controls:!0,src:O,className:"w-full"}),K&&(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:K.format,audio:K.audio?`${K.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:P})]})]})]}),G&&(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:()=>Y(!1),onKeyDown:e=>{"Escape"===e.key&&Y(!1)},children:(0,s.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"tts-language-modal-title",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",{id:"tts-language-modal-title",className:"text-sm font-semibold","data-i18n":"Select Language",children:"Select Language"}),(0,s.jsx)("button",{onClick:()=>Y(!1),"aria-label":"Close language picker",className:"text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",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,type:"text","aria-label":"Search language",value:et,onChange:e=>ea(e.target.value),placeholder:"Search language...","data-i18n-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:[es&&(0,s.jsx)("p",{className:"text-xs text-red-500 px-2 py-1",children:es}),X?(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:[ec.map(e=>(0,s.jsxs)("button",{onClick:()=>{let t;return Y(!1),g(e.code),void(b(t=el[e.code]?.voices||[]),t.length&&(d(t[0].id),u(t[0].name),l.hasVoiceIdInput&&x(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===ec.length&&(0,s.jsx)("p",{className:"text-xs text-text-muted px-2 py-3",children:"No languages found."})]})]})]})})]})}var _=a(5772);let M="https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png";function O(e){let t="string"==typeof e?e.trim():"";return t?/^(data:image\/|https?:\/\/)/i.test(t)?t:`data:image/png;base64,${t}`:""}function L({providerId:e,kind:t}){let a=(0,c.wG)(e),r=(0,c.rs)(a)===e?a:e,l=c.rj.find(e=>e.id===t),o=$[t],d=o||{},m=(0,v.KC)(e).filter(e=>(0,v.CP)(e)===t),u=new Set(["image","video","music","imageToText"]).has(t),p=u&&0===m.length,[x,h]=(0,i.useState)(m[0]?.id??""),b=m.find(e=>e.id===x),f=!!b?.capabilities?.includes("edit"),g=!!b?.capabilities?.includes("mask"),[y,w]=(0,i.useState)(d.defaultInput||""),[N,k]=(0,i.useState)(""),[C,F]=(0,i.useState)(""),[E,A]=(0,i.useState)(()=>(d.extraFields||[]).reduce((e,t)=>(e[t.key]=t.default??"",e),{})),[T,R]=(0,i.useState)(""),[P,I]=(0,i.useState)(""),[K,B]=(0,i.useState)(null),[D,U]=(0,i.useState)(null),[q,z]=(0,i.useState)(null),[J,V]=(0,i.useState)("json"),[H,W]=(0,i.useState)(""),[G,Y]=(0,i.useState)(!1),[Z,Q]=(0,i.useState)(""),[X,ee]=(0,i.useState)([]),[et,ea]=(0,i.useState)(""),{copied:es,copy:er}=(0,j.C)(),{copied:el,copy:eo}=(0,j.C)();if((0,i.useEffect)(()=>{I(window.location.origin),fetch("/api/providers/client").then(e=>e.json()).then(t=>{ee((t.connections||[]).filter(t=>t.provider===e&&!1!==t.isActive))}).catch(()=>{})},[e]),!l||!o)return null;let ei=l.endpoint.path,en=u?x?`${r}/${x}`:p?"":r:r,ed="cloudflare-ai"!==e?{}:"@cf/runwayml/stable-diffusion-v1-5-img2img"===x?{image:M}:"@cf/runwayml/stable-diffusion-v1-5-inpainting"===x?{image:M,mask_image:"https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png"}:{},ec=N.trim()||ed.image||"",em=C.trim()||ed.mask_image||"",eu=O(ec),ep=O(em),ex=Object.entries(E).reduce((e,[t,a])=>(""===a||null==a||"number"==typeof a&&Number.isNaN(a)||(e[t]=a),e),{}),eh={model:en,[o.bodyKey]:y,...o.extraBody,...ex,...f&&ec?{image:ec}:{},...g&&em?{mask_image:em}:{}},eb="image"===t&&"binary"===J,ef="image"===t&&"codex"===e&&!eb,eg=`${ei}${eb?"?response_format=binary":""}`,ey=`-H "Content-Type: application/json" \\
46
46
  -H "Authorization: Bearer ${T||"YOUR_KEY"}"${et?` \\
47
47
  -H "x-connection-id: ${et}"`:""}${ef?` \\
48
48
  -H "Accept: text/event-stream"`:""}`,ev=`curl -X ${l.endpoint.method} ${P}${eg} \\
49
49
  ${ey.replace(/\\\n /g,"\\\n ")} \\
50
- -d '${JSON.stringify(eh)}'${eb?" \\\n --output image.png":""}`,ej=async()=>{if(!y.trim()||!en||!T.trim())return;if(Y(!0),Q(""),B(null),U(null),z(null),H){try{URL.revokeObjectURL(H)}catch{}W("")}let e=Date.now();try{let t={"Content-Type":"application/json"};T&&(t.Authorization=`Bearer ${T}`),et&&(t["x-connection-id"]=et),ef&&(t.Accept="text/event-stream");let a={...eh,model:en},s=await fetch(`/api${eg}`,{method:l.endpoint.method,headers:t,body:JSON.stringify(a)});if(!s.ok){let e=await s.json().catch(()=>({}));Q(e?.error?.message||e?.error||`HTTP ${s.status}`);return}let r=s.headers.get("content-type")||"";if(r.startsWith("image/")){let t=await s.blob(),a=URL.createObjectURL(t);W(a),B({data:{binary:!0,mime:r,size:t.size},latencyMs:Date.now()-e});return}if(r.includes("text/event-stream")&&s.body){let t=s.body.getReader(),a=new TextDecoder,r="",l=null,o=null;for(;;){let e,{done:s,value:i}=await t.read();if(s)break;for(r+=a.decode(i,{stream:!0});-1!==(e=r.indexOf("\n\n"));){let t=r.slice(0,e);r=r.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?U(e):"partial_image"===a?z(e):"done"===a?l=e:"error"===a&&(o=e?.message||"Stream error")}catch{}}}let i=Date.now()-e;if(o)return void Q(o);l&&B({data:l,latencyMs:i})}else{let t=await s.json(),a=Date.now()-e;B({data:t,latencyMs:a})}}catch(e){Q(e.message||"Network error")}finally{Y(!1)}},ew=e=>{if(!e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(ew);let t={};for(let[a,s]of Object.entries(e))t[a]="b64_json"===a&&"string"==typeof s&&s.length>100?`<${s.length} chars base64>`:ew(s);return t},eN=K?JSON.stringify(ew(K.data),null,2):"";return(0,s.jsxs)(n.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:[m.length>0?(0,s.jsx)(S,{label:"Model",htmlFor:"generic-example-model",children:(0,s.jsx)("select",{id:"generic-example-model",value:x,onChange:e=>h(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:m.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}):p?(0,s.jsx)(S,{label:"Model",htmlFor:"generic-example-model",children:(0,s.jsx)("input",{id:"generic-example-model",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)(S,{label:"Endpoint",children:(0,s.jsx)("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:[P,ei]})})}),(0,s.jsx)(S,{label:"API Key",htmlFor:"generic-example-key",children:(0,s.jsx)("input",{id:"generic-example-key",type:"password",autoComplete:"off",value:T,onChange:e=>R(e.target.value),placeholder:"Paste a Switchboard client key secret (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"})}),X.length>0&&(0,s.jsx)(S,{label:"Connection",htmlFor:"generic-example-connection",children:(0,s.jsxs)("select",{id:"generic-example-connection",value:et,onChange:e=>ea(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"",children:"Auto (by priority)"}),X.map(e=>{let t=e.providerSpecificData?.chatgptPlanType,a=e.email||e.name||e.id.slice(0,8);return(0,s.jsxs)("option",{value:e.id,children:[a,t?` [${t}]`:""]},e.id)})]})}),(0,s.jsx)(S,{label:o.inputLabel,htmlFor:"generic-example-input",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{id:"generic-example-input",value:y,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"}),y&&(0,s.jsx)("button",{type:"button",onClick:()=>w(""),"aria-label":`Clear ${o.inputLabel.toLowerCase()}`,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]","aria-hidden":"true",children:"close"})})]})}),f&&(0,s.jsx)(S,{label:"Ref Image (URL)",htmlFor:"generic-example-ref-image",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{id:"generic-example-ref-image",value:N,onChange:e=>k(e.target.value),placeholder:ed.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"}),N&&(0,s.jsx)("button",{type:"button",onClick:()=>k(""),"aria-label":"Clear reference image URL",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]","aria-hidden":"true",children:"close"})})]}),eu&&(0,s.jsx)(_.default,{src:eu,alt:"Reference",width:640,height:320,unoptimized:!0,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"}})]})}),g&&(0,s.jsx)(S,{label:"Mask (URL)",htmlFor:"generic-example-mask",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{id:"generic-example-mask",value:C,onChange:e=>F(e.target.value),placeholder:ed.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"}),C&&(0,s.jsx)("button",{type:"button",onClick:()=>F(""),"aria-label":"Clear mask image URL",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]","aria-hidden":"true",children:"close"})})]}),ep&&(0,s.jsx)(_.default,{src:ep,alt:"Mask",width:640,height:320,unoptimized:!0,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"}})]})}),(o.extraFields||[]).filter(e=>0===m.length||Array.isArray(b?.params)&&b.params.includes(e.key)).map(e=>(0,s.jsx)(S,{label:e.label,htmlFor:`generic-example-${e.key}`,children:"select"===e.type?(0,s.jsx)("select",{id:`generic-example-${e.key}`,value:E[e.key]??"",onChange:t=>A(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",children:(e.options||[]).map(e=>(0,s.jsx)("option",{value:e,children:""===e?"(default)":e},e))}):"text"===e.type?(0,s.jsx)("input",{id:`generic-example-${e.key}`,type:"text",value:E[e.key]??"",placeholder:e.placeholder,onChange:t=>A(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"}):(0,s.jsx)("input",{id:`generic-example-${e.key}`,type:"number",value:E[e.key]??"",min:e.min,max:e.max,onChange:t=>A(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)(S,{label:"Output Format",htmlFor:"generic-example-output-format",children:(0,s.jsxs)("select",{id:"generic-example-output-format",value:J,onChange:e=>V(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"json",children:"JSON (Base64)"}),(0,s.jsx)("option",{value:"binary",children:"Binary File"})]})}),(0,s.jsxs)("div",{className:"mt-1",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsxs)("button",{onClick:()=>er(ev),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:es?"check":"content_copy"}),es?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:ej,disabled:G||!y.trim()||!en||!T.trim(),className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-on-primary 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:G?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),G?"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:ev})]}),(G||D)&&ef&&(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:G?{animation:"spin 1s linear infinite"}:void 0,children:G?"progress_activity":"check_circle"}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:[D?.stage||"starting",!G&&D?.bytesReceived?` \xb7 ${(D.bytesReceived/1024).toFixed(1)} KB`:""]})]}),q?.b64_json&&!K&&(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)(_.default,{src:`data:image/png;base64,${q.b64_json}`,alt:"Partial",width:1024,height:1024,unoptimized:!0,className:"max-w-full rounded-lg border border-border mt-1.5 opacity-80"})]}),Z&&(0,s.jsx)("p",{role:"alert",className:"text-xs text-red-500 break-words",children:Z}),(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 ",K&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",K.latencyMs,"ms"]})]}),K&&(0,s.jsxs)("button",{onClick:()=>eo(eN),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.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:K?eN:o.defaultResponse}),"image"===t&&(H||K?.data?.data?.[0])&&(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,s.jsxs)("a",{href:H||(K?.data?.data?.[0]?.b64_json?`data:image/png;base64,${K.data.data[0].b64_json}`:K?.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)(_.default,{src:H||(K?.data?.data?.[0]?.b64_json?`data:image/png;base64,${K.data.data[0].b64_json}`:K?.data?.data?.[0]?.url),alt:"Generated",width:1024,height:1024,unoptimized:!0,className:"max-w-full rounded-lg border border-border"})]})]})]})]})}function K({providerId:e}){let t=(0,c.wG)(e),a=(0,v.KC)(e).filter(e=>"stt"===(0,v.CP)(e)),[r,l]=(0,i.useState)([]),o=[...a,...r],[d,m]=(0,i.useState)(a[0]?.id??""),u=o.find(e=>e.id===d),p=Array.isArray(u?.params)?u.params:[],[x,h]=(0,i.useState)(null),[b,f]=(0,i.useState)(""),[g,y]=(0,i.useState)(""),[w,N]=(0,i.useState)("json"),[k,C]=(0,i.useState)(""),[$,F]=(0,i.useState)(""),[E,A]=(0,i.useState)(""),[T,R]=(0,i.useState)(null),[P,I]=(0,i.useState)(null),[_,O]=(0,i.useState)(!1),[M,L]=(0,i.useState)(""),{copied:B,copy:D}=(0,j.C)(),{copied:U,copy:q}=(0,j.C)();(0,i.useEffect)(()=>{A(window.location.origin);let e=()=>{fetch("/api/models/custom",{cache:"no-store"}).then(e=>e.json()).then(e=>{l((e.models||[]).filter(e=>"stt"===(0,v.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 z=d?`${t}/${d}`:"",J=`curl -X POST ${E}/v1/audio/transcriptions \\
50
+ -d '${JSON.stringify(eh)}'${eb?" \\\n --output image.png":""}`,ej=async()=>{if(!y.trim()||!en||!T.trim())return;if(Y(!0),Q(""),B(null),U(null),z(null),H){try{URL.revokeObjectURL(H)}catch{}W("")}let e=Date.now();try{let t={"Content-Type":"application/json"};T&&(t.Authorization=`Bearer ${T}`),et&&(t["x-connection-id"]=et),ef&&(t.Accept="text/event-stream");let a={...eh,model:en},s=await fetch(`/api${eg}`,{method:l.endpoint.method,headers:t,body:JSON.stringify(a)});if(!s.ok){let e=await s.json().catch(()=>({}));Q(e?.error?.message||e?.error||`HTTP ${s.status}`);return}let r=s.headers.get("content-type")||"";if(r.startsWith("image/")){let t=await s.blob(),a=URL.createObjectURL(t);W(a),B({data:{binary:!0,mime:r,size:t.size},latencyMs:Date.now()-e});return}if(r.includes("text/event-stream")&&s.body){let t=s.body.getReader(),a=new TextDecoder,r="",l=null,o=null;for(;;){let e,{done:s,value:i}=await t.read();if(s)break;for(r+=a.decode(i,{stream:!0});-1!==(e=r.indexOf("\n\n"));){let t=r.slice(0,e);r=r.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?U(e):"partial_image"===a?z(e):"done"===a?l=e:"error"===a&&(o=e?.message||"Stream error")}catch{}}}let i=Date.now()-e;if(o)return void Q(o);l&&B({data:l,latencyMs:i})}else{let t=await s.json(),a=Date.now()-e;B({data:t,latencyMs:a})}}catch(e){Q(e.message||"Network error")}finally{Y(!1)}},ew=e=>{if(!e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(ew);let t={};for(let[a,s]of Object.entries(e))t[a]="b64_json"===a&&"string"==typeof s&&s.length>100?`<${s.length} chars base64>`:ew(s);return t},eN=K?JSON.stringify(ew(K.data),null,2):"";return(0,s.jsxs)(n.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:[m.length>0?(0,s.jsx)(S,{label:"Model",htmlFor:"generic-example-model",children:(0,s.jsx)("select",{id:"generic-example-model",value:x,onChange:e=>h(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:m.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}):p?(0,s.jsx)(S,{label:"Model",htmlFor:"generic-example-model",children:(0,s.jsx)("input",{id:"generic-example-model",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)(S,{label:"Endpoint",children:(0,s.jsx)("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:[P,ei]})})}),(0,s.jsx)(S,{label:"API Key",htmlFor:"generic-example-key",children:(0,s.jsx)("input",{id:"generic-example-key",type:"password",autoComplete:"off",value:T,onChange:e=>R(e.target.value),placeholder:"Paste a Switchboard client key secret (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"})}),X.length>0&&(0,s.jsx)(S,{label:"Connection",htmlFor:"generic-example-connection",children:(0,s.jsxs)("select",{id:"generic-example-connection",value:et,onChange:e=>ea(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"",children:"Auto (by priority)"}),X.map(e=>{let t=e.providerSpecificData?.chatgptPlanType,a=e.email||e.name||e.id.slice(0,8);return(0,s.jsxs)("option",{value:e.id,children:[a,t?` [${t}]`:""]},e.id)})]})}),(0,s.jsx)(S,{label:o.inputLabel,htmlFor:"generic-example-input",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{id:"generic-example-input",value:y,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"}),y&&(0,s.jsx)("button",{type:"button",onClick:()=>w(""),"aria-label":`Clear ${o.inputLabel.toLowerCase()}`,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]","aria-hidden":"true",children:"close"})})]})}),f&&(0,s.jsx)(S,{label:"Ref Image (URL)",htmlFor:"generic-example-ref-image",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{id:"generic-example-ref-image",value:N,onChange:e=>k(e.target.value),placeholder:ed.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"}),N&&(0,s.jsx)("button",{type:"button",onClick:()=>k(""),"aria-label":"Clear reference image URL",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]","aria-hidden":"true",children:"close"})})]}),eu&&(0,s.jsx)(_.default,{src:eu,alt:"Reference",width:640,height:320,unoptimized:!0,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"}})]})}),g&&(0,s.jsx)(S,{label:"Mask (URL)",htmlFor:"generic-example-mask",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{id:"generic-example-mask",value:C,onChange:e=>F(e.target.value),placeholder:ed.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"}),C&&(0,s.jsx)("button",{type:"button",onClick:()=>F(""),"aria-label":"Clear mask image URL",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]","aria-hidden":"true",children:"close"})})]}),ep&&(0,s.jsx)(_.default,{src:ep,alt:"Mask",width:640,height:320,unoptimized:!0,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"}})]})}),(o.extraFields||[]).filter(e=>0===m.length||Array.isArray(b?.params)&&b.params.includes(e.key)).map(e=>(0,s.jsx)(S,{label:e.label,htmlFor:`generic-example-${e.key}`,children:"select"===e.type?(0,s.jsx)("select",{id:`generic-example-${e.key}`,value:E[e.key]??"",onChange:t=>A(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",children:(e.options||[]).map(e=>(0,s.jsx)("option",{value:e,children:""===e?"(default)":e},e))}):"text"===e.type?(0,s.jsx)("input",{id:`generic-example-${e.key}`,type:"text",value:E[e.key]??"",placeholder:e.placeholder,onChange:t=>A(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"}):(0,s.jsx)("input",{id:`generic-example-${e.key}`,type:"number",value:E[e.key]??"",min:e.min,max:e.max,onChange:t=>A(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)(S,{label:"Output Format",htmlFor:"generic-example-output-format",children:(0,s.jsxs)("select",{id:"generic-example-output-format",value:J,onChange:e=>V(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"json",children:"JSON (Base64)"}),(0,s.jsx)("option",{value:"binary",children:"Binary File"})]})}),(0,s.jsxs)("div",{className:"mt-1",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsxs)("button",{onClick:()=>er(ev),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:es?"check":"content_copy"}),es?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:ej,disabled:G||!y.trim()||!en||!T.trim(),className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-on-primary 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:G?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),G?"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:ev})]}),(G||D)&&ef&&(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:G?{animation:"spin 1s linear infinite"}:void 0,children:G?"progress_activity":"check_circle"}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:[D?.stage||"starting",!G&&D?.bytesReceived?` \xb7 ${(D.bytesReceived/1024).toFixed(1)} KB`:""]})]}),q?.b64_json&&!K&&(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)(_.default,{src:`data:image/png;base64,${q.b64_json}`,alt:"Partial",width:1024,height:1024,unoptimized:!0,className:"max-w-full rounded-lg border border-border mt-1.5 opacity-80"})]}),Z&&(0,s.jsx)("p",{role:"alert",className:"text-xs text-red-500 break-words",children:Z}),(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 ",K&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",K.latencyMs,"ms"]})]}),K&&(0,s.jsxs)("button",{onClick:()=>eo(eN),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.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:K?eN:o.defaultResponse}),"image"===t&&(H||K?.data?.data?.[0])&&(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,s.jsxs)("a",{href:H||(K?.data?.data?.[0]?.b64_json?`data:image/png;base64,${K.data.data[0].b64_json}`:K?.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)(_.default,{src:H||(K?.data?.data?.[0]?.b64_json?`data:image/png;base64,${K.data.data[0].b64_json}`:K?.data?.data?.[0]?.url),alt:"Generated",width:1024,height:1024,unoptimized:!0,className:"max-w-full rounded-lg border border-border"})]})]})]})]})}function K({providerId:e}){let t=(0,c.wG)(e),a=(0,v.KC)(e).filter(e=>"stt"===(0,v.CP)(e)),[r,l]=(0,i.useState)([]),o=[...a,...r],[d,m]=(0,i.useState)(a[0]?.id??""),u=o.find(e=>e.id===d),p=Array.isArray(u?.params)?u.params:[],[x,h]=(0,i.useState)(null),[b,f]=(0,i.useState)(""),[g,y]=(0,i.useState)(""),[w,N]=(0,i.useState)("json"),[k,C]=(0,i.useState)(""),[$,F]=(0,i.useState)(""),[E,A]=(0,i.useState)(""),[T,R]=(0,i.useState)(null),[P,I]=(0,i.useState)(null),[_,M]=(0,i.useState)(!1),[O,L]=(0,i.useState)(""),{copied:B,copy:D}=(0,j.C)(),{copied:U,copy:q}=(0,j.C)();(0,i.useEffect)(()=>{A(window.location.origin);let e=()=>{fetch("/api/models/custom",{cache:"no-store"}).then(e=>e.json()).then(e=>{l((e.models||[]).filter(e=>"stt"===(0,v.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 z=d?`${t}/${d}`:"",J=`curl -X POST ${E}/v1/audio/transcriptions \\
51
51
  -H "Authorization: Bearer ${$||"YOUR_KEY"}" \\
52
52
  -F "file=@${x?.name||"audio.mp3"}" \\
53
53
  -F "model=${z}"${p.includes("language")&&b?` \\
54
54
  -F "language=${b}"`:""}${p.includes("response_format")?` \\
55
55
  -F "response_format=${w}"`:""}${p.includes("temperature")&&k?` \\
56
56
  -F "temperature=${k}"`:""}${p.includes("prompt")&&g?` \\
57
- -F "prompt=${g}"`:""}`,V=async()=>{if(!x||!z||!$.trim())return;O(!0),L(""),R(null);let e=Date.now();try{let t=new FormData;t.append("file",x),t.append("model",z),p.includes("language")&&b&&t.append("language",b),p.includes("response_format")&&t.append("response_format",w),p.includes("temperature")&&k&&t.append("temperature",k),p.includes("prompt")&&g&&t.append("prompt",g);let a={};$&&(a.Authorization=`Bearer ${$}`);let s=await fetch("/api/v1/audio/transcriptions",{method:"POST",headers:a,body:t});I(Date.now()-e);let r=(s.headers.get("content-type")||"").includes("application/json")?await s.json():await s.text();if(!s.ok)return void L(r?.error?.message||r?.error||r||`HTTP ${s.status}`);R(r)}catch(e){L(e.message||"Network error")}finally{O(!1)}},H="string"==typeof T?T:T?JSON.stringify(T,null,2):`{
57
+ -F "prompt=${g}"`:""}`,V=async()=>{if(!x||!z||!$.trim())return;M(!0),L(""),R(null);let e=Date.now();try{let t=new FormData;t.append("file",x),t.append("model",z),p.includes("language")&&b&&t.append("language",b),p.includes("response_format")&&t.append("response_format",w),p.includes("temperature")&&k&&t.append("temperature",k),p.includes("prompt")&&g&&t.append("prompt",g);let a={};$&&(a.Authorization=`Bearer ${$}`);let s=await fetch("/api/v1/audio/transcriptions",{method:"POST",headers:a,body:t});I(Date.now()-e);let r=(s.headers.get("content-type")||"").includes("application/json")?await s.json():await s.text();if(!s.ok)return void L(r?.error?.message||r?.error||r||`HTTP ${s.status}`);R(r)}catch(e){L(e.message||"Network error")}finally{M(!1)}},H="string"==typeof T?T:T?JSON.stringify(T,null,2):`{
58
58
  "text": "Hello world..."
59
- }`;return(0,s.jsxs)(n.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)(S,{label:"Model",htmlFor:"stt-example-model",children:(0,s.jsx)("select",{id:"stt-example-model",value:d,onChange:e=>m(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:o.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}):(0,s.jsx)(S,{label:"Model",htmlFor:"stt-example-model",children:(0,s.jsx)("input",{id:"stt-example-model",value:d,onChange:e=>m(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)(S,{label:"Endpoint",children:(0,s.jsx)("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:[E,"/v1/audio/transcriptions"]})})}),(0,s.jsx)(S,{label:"API Key",htmlFor:"stt-example-key",children:(0,s.jsx)("input",{id:"stt-example-key",type:"password",autoComplete:"off",value:$,onChange:e=>F(e.target.value),placeholder:"Paste a Switchboard client key secret (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)(S,{label:"Audio File",htmlFor:"stt-example-audio",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)("input",{id:"stt-example-audio",type:"file",accept:"audio/*,video/mp4,.m4a,.mp3,.wav,.ogg,.flac,.webm,.opus",onChange:e=>h(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"}),x&&(0,s.jsxs)("span",{className:"text-xs text-text-muted font-mono",children:[x.name," \xb7 ",(x.size/1024).toFixed(1)," KB"]})]})}),p.includes("language")&&(0,s.jsx)(S,{label:"Language",htmlFor:"stt-example-language",children:(0,s.jsx)("input",{id:"stt-example-language",value:b,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)(S,{label:"Prompt",htmlFor:"stt-example-prompt",children:(0,s.jsx)("input",{id:"stt-example-prompt",value:g,onChange:e=>y(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)(S,{label:"Temperature",htmlFor:"stt-example-temperature",children:(0,s.jsx)("input",{id:"stt-example-temperature",type:"number",step:"0.1",min:"0",max:"1",value:k,onChange:e=>C(e.target.value),placeholder:"0 - 1 (default 0)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),p.includes("response_format")&&(0,s.jsx)(S,{label:"Response Format",htmlFor:"stt-example-format",children:(0,s.jsxs)("select",{id:"stt-example-format",value:w,onChange:e=>N(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"json",children:"json"}),(0,s.jsx)("option",{value:"text",children:"text"}),(0,s.jsx)("option",{value:"srt",children:"srt"}),(0,s.jsx)("option",{value:"verbose_json",children:"verbose_json"}),(0,s.jsx)("option",{value:"vtt",children:"vtt"})]})}),(0,s.jsxs)("div",{className:"mt-1",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsxs)("button",{onClick:()=>D(J),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:B?"check":"content_copy"}),B?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:V,disabled:_||!x||!z||!$.trim(),className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-on-primary text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:_?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),_?"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:J})]}),M&&(0,s.jsx)("p",{role:"alert",className:"text-xs text-red-500 break-words",children:M}),(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&&P&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",P,"ms"]})]}),T&&(0,s.jsxs)("button",{onClick:()=>q(H),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:U?"check":"content_copy"}),U?"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:H})]})]})]})}var B=a(77251);function D(){let{kind:e,id:t}=(0,r.useParams)(),a=(0,r.useRouter)(),l=c.rj.find(t=>t.id===e),m=(0,c.gC)(t)&&"embedding"===e,u=async()=>{if(await (0,B.l)({message:"Delete this Custom Embedding node?",confirmText:"Continue"}))try{(await fetch(`/api/provider-nodes/${t}`,{method:"DELETE"})).ok&&a.push(`/dashboard/media-providers/${e}`)}catch(e){(0,w.s)("Error deleting custom embedding node:",e)}},[p,x]=(0,i.useState)(null),[h,b]=(0,i.useState)(m),[f,g]=(0,i.useState)(!1);if((0,i.useEffect)(()=>{if(!m)return;let e=!1;return fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(a=>{e||(x((a.nodes||[]).find(e=>e.id===t)||null),b(!1))}).catch(()=>{e||b(!1)}),()=>{e=!0}},[t,m]),!l)return(0,r.notFound)();let v=c.Q2[t],j=m?p?{id:t,name:p.name||"Custom Embedding",color:"#6366F1",textIcon:"CE"}:null:v;if(!m&&!v||m&&!h&&!p)return(0,r.notFound)();if(m&&h)return(0,s.jsx)("div",{className:"text-text-muted text-sm py-12 text-center",children:"Loading..."});let N=m?["embedding"]:j.serviceKinds??["llm"];return m||N.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"}),l.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:`${j.color}15`},children:(0,s.jsx)(d.A,{src:`/providers/${j.id}.png`,alt:j.name,size:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",fallbackText:j.textIcon||j.id.slice(0,2).toUpperCase(),fallbackColor:j.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:j.name}),!m&&j.notice?.apiKeyUrl&&(0,s.jsxs)("a",{href:j.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:[m&&(0,s.jsxs)(n.Ex,{variant:"default",size:"sm",children:["Custom \xb7 ",p?.prefix]}),N.map(t=>(0,s.jsx)(n.Ex,{variant:t===e?"primary":"default",size:"sm",children:t.toUpperCase()},t))]})]}),m&&(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)(n.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>g(!0),children:"Edit"}),(0,s.jsx)(n.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:u,children:"Delete"})]})]})]}),!m&&j.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:j.kindNotice[e]})]}),!m&&j.notice?.text&&!j.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:j.notice.text}),j.notice.apiKeyUrl&&(0,s.jsx)("a",{href:j.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 →"})]}),!m&&j.noAuth?(0,s.jsx)(n.gw,{providerId:t}):(0,s.jsx)(y,{providerId:t,isOAuth:!1}),"tts"!==e&&"webSearch"!==e&&"webFetch"!==e&&(0,s.jsx)(C,{providerId:t,kindFilter:e,providerAliasOverride:m?p?.prefix:void 0}),!m&&(j.searchConfig||j.fetchConfig||j.ttsConfig||j.sttConfig||j.embeddingConfig||j.searchViaChat)&&(0,s.jsx)(n.Wx,{config:"webFetch"===e?j.fetchConfig:"tts"===e?j.ttsConfig:"stt"===e?j.sttConfig:"embedding"===e?j.embeddingConfig:j.searchConfig||{mode:"chat-completions",defaultModel:j.searchViaChat?.defaultModel,pricingUrl:j.searchViaChat?.pricingUrl,freeTier:j.searchViaChat?.freeTier},provider:j,title:`${l.label} Config`}),"embedding"===e&&(0,s.jsx)(E,{providerId:t,customAlias:p?.prefix}),"tts"===e&&(0,s.jsx)(I,{providerId:t}),"stt"===e&&!m&&(0,s.jsx)(K,{providerId:t}),!m&&$[e]&&(0,s.jsx)(L,{providerId:t,kind:e}),m&&(0,s.jsx)(n.x0,{isOpen:f,node:p,onClose:()=>g(!1),onSaved:e=>{x(e),g(!1)}})]}):(0,r.notFound)()}},53578:(e,t,a)=>{"use strict";async function s(e,t,a=fetch){let r=await a("/api/settings",{cache:"no-store"});if(!r.ok)throw Error(`Failed to load settings (${r.status})`);let l=(await r.json()).providerStrategies||{},o=t(l[e]||{}),i={...l};o&&Object.keys(o).length>0?i[e]=o:delete i[e];let n=await a("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:i})});if(!n.ok)throw Error(`Failed to save settings (${n.status})`);return o}a.d(t,{T:()=>s})},70217:(e,t,a)=>{"use strict";function s(e,t){return!1===e?"default":"active"===t||"success"===t?"success":"error"===t||"expired"===t||"unavailable"===t?"error":"default"}a.d(t,{g:()=>s})}},e=>{e.O(0,[2574,3862,782,8500,594,1321,4707,5497,8441,3794,7358],()=>e(e.s=17845)),_N_E=e.O()}]);
59
+ }`;return(0,s.jsxs)(n.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)(S,{label:"Model",htmlFor:"stt-example-model",children:(0,s.jsx)("select",{id:"stt-example-model",value:d,onChange:e=>m(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:o.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}):(0,s.jsx)(S,{label:"Model",htmlFor:"stt-example-model",children:(0,s.jsx)("input",{id:"stt-example-model",value:d,onChange:e=>m(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)(S,{label:"Endpoint",children:(0,s.jsx)("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:[E,"/v1/audio/transcriptions"]})})}),(0,s.jsx)(S,{label:"API Key",htmlFor:"stt-example-key",children:(0,s.jsx)("input",{id:"stt-example-key",type:"password",autoComplete:"off",value:$,onChange:e=>F(e.target.value),placeholder:"Paste a Switchboard client key secret (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)(S,{label:"Audio File",htmlFor:"stt-example-audio",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)("input",{id:"stt-example-audio",type:"file",accept:"audio/*,video/mp4,.m4a,.mp3,.wav,.ogg,.flac,.webm,.opus",onChange:e=>h(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"}),x&&(0,s.jsxs)("span",{className:"text-xs text-text-muted font-mono",children:[x.name," \xb7 ",(x.size/1024).toFixed(1)," KB"]})]})}),p.includes("language")&&(0,s.jsx)(S,{label:"Language",htmlFor:"stt-example-language",children:(0,s.jsx)("input",{id:"stt-example-language",value:b,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)(S,{label:"Prompt",htmlFor:"stt-example-prompt",children:(0,s.jsx)("input",{id:"stt-example-prompt",value:g,onChange:e=>y(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)(S,{label:"Temperature",htmlFor:"stt-example-temperature",children:(0,s.jsx)("input",{id:"stt-example-temperature",type:"number",step:"0.1",min:"0",max:"1",value:k,onChange:e=>C(e.target.value),placeholder:"0 - 1 (default 0)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),p.includes("response_format")&&(0,s.jsx)(S,{label:"Response Format",htmlFor:"stt-example-format",children:(0,s.jsxs)("select",{id:"stt-example-format",value:w,onChange:e=>N(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"json",children:"json"}),(0,s.jsx)("option",{value:"text",children:"text"}),(0,s.jsx)("option",{value:"srt",children:"srt"}),(0,s.jsx)("option",{value:"verbose_json",children:"verbose_json"}),(0,s.jsx)("option",{value:"vtt",children:"vtt"})]})}),(0,s.jsxs)("div",{className:"mt-1",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,s.jsxs)("button",{onClick:()=>D(J),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:B?"check":"content_copy"}),B?"Copied":"Copy"]}),(0,s.jsxs)("button",{onClick:V,disabled:_||!x||!z||!$.trim(),className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-on-primary text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:_?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),_?"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:J})]}),O&&(0,s.jsx)("p",{role:"alert",className:"text-xs text-red-500 break-words",children:O}),(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&&P&&(0,s.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",P,"ms"]})]}),T&&(0,s.jsxs)("button",{onClick:()=>q(H),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:U?"check":"content_copy"}),U?"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:H})]})]})]})}var B=a(77251);function D(){let{kind:e,id:t}=(0,r.useParams)(),a=(0,r.useRouter)(),l=c.rj.find(t=>t.id===e),m=(0,c.gC)(t)&&"embedding"===e,u=async()=>{if(await (0,B.l)({message:"Delete this Custom Embedding node?",confirmText:"Continue"}))try{(await fetch(`/api/provider-nodes/${t}`,{method:"DELETE"})).ok&&a.push(`/dashboard/media-providers/${e}`)}catch(e){(0,w.s)("Error deleting custom embedding node:",e)}},[p,x]=(0,i.useState)(null),[h,b]=(0,i.useState)(m),[f,g]=(0,i.useState)(!1);if((0,i.useEffect)(()=>{if(!m)return;let e=!1;return fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(a=>{e||(x((a.nodes||[]).find(e=>e.id===t)||null),b(!1))}).catch(()=>{e||b(!1)}),()=>{e=!0}},[t,m]),!l)return(0,r.notFound)();let v=c.Q2[t],j=m?p?{id:t,name:p.name||"Custom Embedding",color:"#6366F1",textIcon:"CE"}:null:v;if(!m&&!v||m&&!h&&!p)return(0,r.notFound)();if(m&&h)return(0,s.jsx)("div",{className:"text-text-muted text-sm py-12 text-center",children:"Loading..."});let N=m?["embedding"]:j.serviceKinds??["llm"];return m||N.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"}),l.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:`${j.color}15`},children:(0,s.jsx)(d.A,{src:`/providers/${j.id}.png`,alt:j.name,size:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",fallbackText:j.textIcon||j.id.slice(0,2).toUpperCase(),fallbackColor:j.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:j.name}),!m&&j.notice?.apiKeyUrl&&(0,s.jsxs)("a",{href:j.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:[m&&(0,s.jsxs)(n.Ex,{variant:"default",size:"sm",children:["Custom \xb7 ",p?.prefix]}),N.map(t=>(0,s.jsx)(n.Ex,{variant:t===e?"primary":"default",size:"sm",children:t.toUpperCase()},t))]})]}),m&&(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)(n.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>g(!0),children:"Edit"}),(0,s.jsx)(n.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:u,children:"Delete"})]})]})]}),!m&&j.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:j.kindNotice[e]})]}),!m&&j.notice?.text&&!j.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:j.notice.text}),j.notice.apiKeyUrl&&(0,s.jsx)("a",{href:j.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 →"})]}),!m&&j.noAuth?(0,s.jsx)(n.gw,{providerId:t}):(0,s.jsx)(y,{providerId:t,isOAuth:!1}),"tts"!==e&&"webSearch"!==e&&"webFetch"!==e&&(0,s.jsx)(C,{providerId:t,kindFilter:e,providerAliasOverride:m?p?.prefix:void 0}),!m&&(j.searchConfig||j.fetchConfig||j.ttsConfig||j.sttConfig||j.embeddingConfig||j.searchViaChat)&&(0,s.jsx)(n.Wx,{config:"webFetch"===e?j.fetchConfig:"tts"===e?j.ttsConfig:"stt"===e?j.sttConfig:"embedding"===e?j.embeddingConfig:j.searchConfig||{mode:"chat-completions",defaultModel:j.searchViaChat?.defaultModel,pricingUrl:j.searchViaChat?.pricingUrl,freeTier:j.searchViaChat?.freeTier},provider:j,title:`${l.label} Config`}),"embedding"===e&&(0,s.jsx)(E,{providerId:t,customAlias:p?.prefix}),"tts"===e&&(0,s.jsx)(I,{providerId:t}),"stt"===e&&!m&&(0,s.jsx)(K,{providerId:t}),!m&&$[e]&&(0,s.jsx)(L,{providerId:t,kind:e}),m&&(0,s.jsx)(n.x0,{isOpen:f,node:p,onClose:()=>g(!1),onSaved:e=>{x(e),g(!1)}})]}):(0,r.notFound)()}},53578:(e,t,a)=>{"use strict";async function s(e,t,a=fetch){let r=await a("/api/settings",{cache:"no-store"});if(!r.ok)throw Error(`Failed to load settings (${r.status})`);let l=(await r.json()).providerStrategies||{},o=t(l[e]||{}),i={...l};o&&Object.keys(o).length>0?i[e]=o:delete i[e];let n=await a("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:i})});if(!n.ok)throw Error(`Failed to save settings (${n.status})`);return o}a.d(t,{T:()=>s})},70217:(e,t,a)=>{"use strict";function s(e,t){return!1===e?"default":"active"===t||"success"===t?"success":"error"===t||"expired"===t||"unavailable"===t?"error":"default"}a.d(t,{g:()=>s})}},e=>{e.O(0,[2574,3862,782,8500,594,1321,4707,1330,8441,3794,7358],()=>e(e.s=17845)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6620],{16144:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>j});var a=s(95155),r=s(73321),d=s(98500),i=s.n(d),n=s(12115),o=s(35497),l=s(11059),c=s(57250),m=s(88105),x=s(54026),p=s(78559);let h=new Set([]),u={image:"image-combo",tts:"tts-combo"};function f(e){let t=Object.entries(e).some(([e,t])=>e.startsWith("modelLock_")&&t&&new Date(t).getTime()>Date.now());return"unavailable"!==e.testStatus||t?e.testStatus:"active"}function b({provider:e,kind:t,connections:s,isCustom:r,onToggle:d}){let n=m.Q2[e.id],l=!!n?.noAuth,x=s.filter(t=>t.provider===e.id),p=x.filter(e=>{let t=f(e);return"active"===t||"success"===t}).length,h=x.filter(e=>{let t=f(e);return"error"===t||"expired"===t||"unavailable"===t}).length,u=x.length,v=u>0&&x.every(e=>!1===e.isActive);return(0,a.jsx)(i(),{href:`/dashboard/media-providers/${t}/${e.id}`,className:"group",children:(0,a.jsx)(o.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${v?"opacity-50":""}`,children:(0,a.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${e.color?.length>7?e.color:(e.color??"#888")+"15"}`},children:(0,a.jsx)(c.A,{src:`/providers/${e.id}.png`,alt:e.name,size:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",fallbackText:e.textIcon||e.id.slice(0,2).toUpperCase(),fallbackColor:e.color})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"font-semibold text-sm",children:e.name}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[r&&(0,a.jsx)(o.Ex,{variant:"default",size:"sm",children:"Custom"}),l?(0,a.jsx)(o.Ex,{variant:"success",size:"sm",children:"Ready"}):v?(0,a.jsx)(o.Ex,{variant:"default",size:"sm",children:"Disabled"}):0===u?(0,a.jsx)("span",{className:"text-xs text-text-muted",children:"No connections"}):(0,a.jsxs)(a.Fragment,{children:[p>0&&(0,a.jsxs)(o.Ex,{variant:"success",size:"sm",dot:!0,children:[p," Connected"]}),h>0&&(0,a.jsxs)(o.Ex,{variant:"error",size:"sm",dot:!0,children:[h," Error"]}),0===p&&0===h&&(0,a.jsxs)(o.Ex,{variant:"default",size:"sm",children:[u," Added"]})]})]})]})]}),u>0&&(0,a.jsx)("div",{className:"shrink-0 opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100",onClick:t=>{t.preventDefault(),t.stopPropagation(),d&&d(e.id,v)},children:(0,a.jsx)(o.lM,{size:"sm",checked:!v,onChange:()=>{},title:v?"Enable provider":"Disable provider"})})]})})})}function v({combos:e}){return 0===e.length?null:(0,a.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>(0,a.jsx)(i(),{href:`/dashboard/media-providers/combo/${e.id}`,children:(0,a.jsx)(o.Zp,{padding:"xs",className:"hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors cursor-pointer",children:(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"}),(0,a.jsx)("code",{className:"text-sm font-mono font-medium flex-1 truncate",children:e.name}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1 sm:shrink-0",children:[e.models.slice(0,6).map((e,t)=>{let s="string"==typeof e?e.split("/")[0]:"",r=m.Q2[s];return(0,a.jsx)("div",{title:r?.name||e,className:"size-5 rounded flex items-center justify-center",style:{backgroundColor:`${r?.color??"#888"}15`},children:(0,a.jsx)(c.A,{src:`/providers/${s}.png`,alt:r?.name||s,size:18,className:"object-contain rounded max-w-[18px] max-h-[18px]",fallbackText:r?.textIcon||s.slice(0,2).toUpperCase(),fallbackColor:r?.color})},`${e}-${t}`)}),e.models.length>6&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted ml-1",children:["+",e.models.length-6]})]}),(0,a.jsx)("span",{className:"text-[11px] text-text-muted shrink-0",children:e.models.length}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[16px]",children:"chevron_right"})]})})},e.id))})}let g={image:{method:"POST",path:"/v1/images/generations",desc:"OpenAI-compatible text-to-image synthesis endpoint",payloadExample:'{ "model": "...", "prompt": "..." }'},video:{method:"POST",path:"/v1/videos/generations",desc:"Video generation and edit endpoint",payloadExample:'{ "model": "...", "prompt": "..." }'},tts:{method:"POST",path:"/v1/audio/speech",desc:"OpenAI-compatible text-to-speech audio synthesis",payloadExample:'{ "model": "...", "input": "...", "voice": "alloy" }'},stt:{method:"POST",path:"/v1/audio/transcriptions",desc:"OpenAI-compatible multipart speech-to-text audio transcription",payloadExample:"multipart/form-data with 'file' and 'model'"},embedding:{method:"POST",path:"/v1/embeddings",desc:"OpenAI-compatible vector embeddings endpoint",payloadExample:'{ "model": "...", "input": "..." }'}};function j(){let{kind:e}=(0,r.useParams)(),t=(0,r.useRouter)(),[s,d]=(0,n.useState)([]),[i,c]=(0,n.useState)([]),[f,j]=(0,n.useState)([]),[N,y]=(0,n.useState)(!1),[w,k]=(0,n.useState)("http://127.0.0.1:20128"),{copied:C,copy:E}=(0,l.C)();(0,n.useEffect)(()=>{k(window.location.origin)},[]),(0,n.useEffect)(()=>{("webSearch"===e||"webFetch"===e)&&t.replace("/dashboard/media-providers/web")},[e,t]);let S=m.rj.find(t=>t.id===e),$="embedding"===e,T=h.has(e),O=g[e];if((0,n.useEffect)(()=>{S&&(fetch("/api/providers",{cache:"no-store"}).then(e=>e.json()).then(e=>d(e.connections||[])).catch(()=>{}),$&&fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(e=>c((e.nodes||[]).filter(e=>"custom-embedding"===e.type))).catch(()=>{}),T&&fetch("/api/combos",{cache:"no-store"}).then(e=>e.json()).then(e=>j(e.combos||[])).catch(()=>{}))},[$,T,S]),!S)return(0,r.notFound)();let A=(0,m.o5)(e),z=f.filter(t=>t.kind===e),P=i.map(e=>({id:e.id,name:e.name||"Custom Embedding",color:"#6366F1",textIcon:"CE"})),_=[...A,...P],I=async(e,t)=>{let a=s.filter(t=>t.provider===e);d(s=>s.map(s=>s.provider===e?{...s,isActive:t}:s)),await Promise.allSettled(a.map(e=>fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})))},F=async()=>{let s=u[e]||`${e}-combo`,a=s,r=1,d=new Set(f.map(e=>e.name));for(;d.has(a);)a=`${s}-${r++}`;let i=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a,models:[],kind:e})});if(i.ok){let e=await i.json();t.push(`/dashboard/media-providers/combo/${e.id}`)}else{let e=await i.json();(0,p.s)(e.error||"Failed to create combo")}},M=O?`${w.replace(/\/+$/,"")}${O.path}`:"";return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("h1",{className:"text-[17px] font-semibold text-text-main",children:S.label}),(0,a.jsx)("p",{className:"text-xs font-mono text-text-subtle",children:"Media providers \xb7 not agent Skills"})]}),(0,a.jsx)(x.A,{activeKind:e}),O&&(0,a.jsx)(o.Zp,{padding:"xs",className:"border border-border/80 bg-surface-2/60",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)("span",{className:"text-[11px] font-mono font-semibold px-2 py-0.5 rounded bg-teal-500/10 text-teal-600 dark:text-teal-400 border border-teal-500/20 shrink-0",children:O.method}),(0,a.jsxs)("span",{className:"text-xs font-semibold text-text-main truncate",children:[S.label," API Endpoint"]})]}),(0,a.jsx)("span",{className:"text-[11px] font-mono text-text-muted hidden sm:inline truncate",children:O.payloadExample})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)(o.pd,{value:M,readOnly:!0,className:"flex-1 min-w-0",inputClassName:"font-mono text-xs bg-surface"}),(0,a.jsx)("button",{type:"button",onClick:()=>E(M,"media_endpoint"),className:"p-2 hover:bg-surface rounded text-text-muted hover:text-primary transition-colors shrink-0 border border-border/60",title:"Copy Endpoint URL","aria-label":`Copy ${S.label} Endpoint URL`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] leading-none",children:"media_endpoint"===C?"check":"content_copy"})})]}),(0,a.jsx)("p",{className:"text-[11px] text-text-muted",children:O.desc})]})}),($||T)&&(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[T&&(0,a.jsx)(o.$n,{size:"sm",icon:"add",onClick:F,children:"Create Combo"}),$&&(0,a.jsx)(o.$n,{size:"sm",icon:"add",onClick:()=>y(!0),children:"Add Custom Embedding"})]}),T&&z.length>0&&(0,a.jsx)(v,{combos:z}),0===_.length?(0,a.jsxs)("div",{className:"text-center py-12 border border-dashed border-border rounded-xl text-text-muted text-sm",children:["No providers support ",(0,a.jsx)("strong",{children:S.label})," yet."]}):(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[A.map(t=>(0,a.jsx)(b,{provider:t,kind:e,connections:s,onToggle:I},t.id)),P.map(t=>(0,a.jsx)(b,{provider:t,kind:e,connections:s,isCustom:!0,onToggle:I},t.id))]}),$&&(0,a.jsx)(o.x0,{isOpen:N,onClose:()=>y(!1),onCreated:e=>{c(t=>[...t,e]),y(!1)}})]})}},35497:(e,t,s)=>{"use strict";s.d(t,{x0:()=>w.default,Ex:()=>l.default,$n:()=>a.default,nh:()=>$.default,Zp:()=>i.default,Qv:()=>o.CardSkeleton,CK:()=>h.default,uo:()=>n.ConfirmModal,G9:()=>g.default,wI:()=>y.default,vj:()=>N.default,vE:()=>j.default,pd:()=>r.default,Mh:()=>v.default,uR:()=>p.default,Nf:()=>u.default,aF:()=>n.default,rq:()=>x.default,gw:()=>k.default,LF:()=>m.default,Wx:()=>S.default,gM:()=>b.default,Iz:()=>C.default,l6:()=>d.default,lM:()=>c.default,m_:()=>E.default,jK:()=>f.default});var a=s(92542),r=s(11910),d=s(98),i=s(84588),n=s(81127),o=s(25086);s(56319);var l=s(56061),c=s(98542);s(38587),s(21110),s(92622),s(8823),s(92173);var m=s(90882),x=s(72908),p=s(28815),h=s(45455),u=s(28058),f=s(4809);s(21931),s(80752),s(40197);var b=s(23615);s(44736);var v=s(62899);s(94230);var g=s(30815),j=s(23936),N=s(95088),y=s(73579),w=s(96748),k=s(4823),C=s(28067),E=s(97677),S=s(51825),$=s(29366);s(76361),s(91450)},54026:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});var a=s(95155),r=s(98500),d=s.n(r),i=s(73321),n=s(31474);let o=[{id:"image",label:"Image",href:"/dashboard/media-providers/image"},{id:"tts",label:"TTS",href:"/dashboard/media-providers/tts"},{id:"stt",label:"STT",href:"/dashboard/media-providers/stt"},{id:"embedding",label:"Embedding",href:"/dashboard/media-providers/embedding"},{id:"web",label:"Web",href:"/dashboard/media-providers/web"}];function l({activeKind:e}){let t=(0,i.usePathname)(),s=e||o.find(e=>t===e.href||t.startsWith(`${e.href}/`))?.id||"";return(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 mb-5",children:[(0,a.jsx)(d(),{href:"/dashboard/media-providers",className:(0,n.cn)("px-2.5 py-1 rounded-[7px] text-xs font-medium border transition-colors","/dashboard/media-providers"===t?"bg-brand-500/15 text-primary border-brand-500/40":"bg-transparent text-text-muted border-border hover:text-text-main hover:border-brand-500/30"),children:"All"}),o.map(e=>{let t=s===e.id;return(0,a.jsx)(d(),{href:e.href,className:(0,n.cn)("px-2.5 py-1 rounded-[7px] text-xs font-medium border transition-colors",t?"bg-brand-500/15 text-primary border-brand-500/40":"bg-transparent text-text-muted border-border hover:text-text-main hover:border-brand-500/30"),children:e.label},e.id)})]})}},61493:(e,t,s)=>{Promise.resolve().then(s.bind(s,16144))}},e=>{e.O(0,[2574,3862,782,8500,594,1321,4707,1330,8441,3794,7358],()=>e(e.s=61493)),_N_E=e.O()}]);
@@ -1,4 +1,4 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8334],{22662:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>g});var s=a(95155),l=a(73321),r=a(12115),i=a(98500),n=a.n(i),o=a(35497),d=a(57250),c=a(88105),m=a(78559),x=a(77251),h=a(5772);let u=/^[a-zA-Z0-9_.\-]+$/,p={webSearch:"Web Search",webFetch:"Web Fetch",image:"Text to Image",tts:"Text To Speech"},b={webSearch:"/v1/search",webFetch:"/v1/web/fetch",image:"/v1/images/generations",tts:"/v1/audio/speech"},f={webSearch:e=>({model:e,query:"What is the latest news about AI?",search_type:"web",max_results:5}),webFetch:e=>({model:e,url:"https://example.com",format:"markdown"}),image:e=>({model:e,prompt:"A cute cat playing piano",n:1,size:"1024x1024"}),tts:e=>({model:e,input:"Hello, this is a test.",voice:"alloy"})};function j(e){return"webSearch"===e||"webFetch"===e?"/dashboard/media-providers/web":`/dashboard/media-providers/${e}`}function g(){let{id:e}=(0,l.useParams)(),t=(0,l.useRouter)(),[a,i]=(0,r.useState)(null),[g,w]=(0,r.useState)(!0),[y,v]=(0,r.useState)(""),[N,k]=(0,r.useState)(""),[S,$]=(0,r.useState)([]),[C,U]=(0,r.useState)(!1),[O,_]=(0,r.useState)(!1),[R,T]=(0,r.useState)([]),[A,P]=(0,r.useState)(!1),[L,z]=(0,r.useState)(null),[E,M]=(0,r.useState)(""),[D,F]=(0,r.useState)(""),[I,J]=(0,r.useState)([]),[W,H]=(0,r.useState)({}),Z=async()=>{try{let[t,a,s,l,r]=await Promise.all([fetch(`/api/combos/${e}`,{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"}),fetch("/api/usage/logs",{cache:"no-store"}),fetch("/api/providers",{cache:"no-store"}),fetch("/api/models/alias",{cache:"no-store"})]);if(r.ok&&H((await r.json()).aliases||{}),l.ok&&J((await l.json()).connections||[]),!t.ok){i(null),w(!1);return}let n=await t.json();i(n),v(n.name),$(n.models||[]);let o=a.ok?await a.json():{};U(o.comboStrategies?.[n.name]?.fallbackStrategy==="round-robin");let d=s.ok?await s.json():[];T(d.filter(e=>"string"==typeof e&&e.includes(n.name)).slice(0,50))}catch{}w(!1)};(0,r.useEffect)(()=>{Z()},[e]);let q=e=>e.trim()?u.test(e)?(k(""),!0):(k("Only letters, numbers, -, _ and ."),!1):(k("Name is required"),!1),B=async t=>{let a=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!a.ok){let e=await a.json();return(0,m.s)(e.error||"Failed to save"),!1}return!0},K=async()=>{!q(y)||y===a.name||await B({name:y})&&await Z()},Y=async e=>{let t=e?.value||e;if(!t||S.includes(t))return;let a=[...S,t];$(a),await B({models:a})},G=async e=>{let t=e?.value||e;if(!t||!S.includes(t))return;let a=S.filter(e=>e!==t);$(a),await B({models:a})},Q=async e=>{let t=S.filter((t,a)=>a!==e);$(t),await B({models:t})},V=async(e,t)=>{let a=[...S],s=e+t;s<0||s>=a.length||([a[e],a[s]]=[a[s],a[e]],$(a),await B({models:a}))},X=async e=>{U(e);let t=await fetch("/api/settings",{cache:"no-store"}),s={...(t.ok?await t.json():{}).comboStrategies||{}};e?s[a.name]={fallbackStrategy:"round-robin"}:delete s[a.name],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:s})})},ee=async()=>{!await (0,x.l)({message:`Delete combo "${a.name?.trim()||e}"?`,confirmText:"Continue"})||(await fetch(`/api/combos/${e}`,{method:"DELETE"})).ok&&t.push(j(a.kind))},et=async()=>{if(!D.trim())return void M("Paste a client key secret before running this example.");if(P(!0),z(null),M(""),L?.audioUrl)try{URL.revokeObjectURL(L.audioUrl)}catch{}if(L?.imageUrl?.startsWith("blob:"))try{URL.revokeObjectURL(L.imageUrl)}catch{}let e=Date.now();try{let t=b[a.kind],s=f[a.kind](a.name),l={"Content-Type":"application/json"};D&&(l.Authorization=`Bearer ${D}`);let r=await fetch(`/api${t}`,{method:"POST",headers:l,body:JSON.stringify(s)}),i=Date.now()-e;if(!r.ok){let e=await r.json().catch(()=>({}));M(e?.error?.message||e?.error||`HTTP ${r.status}`),z({json:JSON.stringify(e,null,2),latencyMs:i});return}let n=r.headers.get("content-type")||"";if(n.startsWith("image/")){let e=await r.blob();z({imageUrl:URL.createObjectURL(e),latencyMs:i});return}if(n.startsWith("audio/")||"application/octet-stream"===n){let e=await r.blob();z({audioUrl:URL.createObjectURL(e),latencyMs:i});return}let o=await r.json(),d=o?.data?.[0],c=d?.b64_json?`data:image/png;base64,${d.b64_json}`:d?.url||"";z({json:JSON.stringify(function e(t){if(!t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(e);let a={};for(let[s,l]of Object.entries(t))a[s]="b64_json"===s&&"string"==typeof l&&l.length>100?`<${l.length} chars base64>`:e(l);return a}(o),null,2),imageUrl:c,latencyMs:i})}catch(e){M(e.message||"Network error")}P(!1)};if(g)return(0,s.jsx)("div",{className:"text-text-muted text-sm",children:"Loading..."});if(!a)return(0,l.notFound)();let ea=p[a.kind]||c.rj.find(e=>e.id===a.kind)?.label||"Combo",es=b[a.kind],el=a.kind&&f[a.kind]?f[a.kind](a.name):null,er=es?`curl -X POST http://localhost:20128${es} \\
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8334],{22662:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>g});var s=a(95155),l=a(73321),r=a(12115),i=a(98500),n=a.n(i),o=a(35497),d=a(57250),c=a(88105),m=a(78559),x=a(77251),u=a(5772);let h=/^[a-zA-Z0-9_.\-]+$/,p={webSearch:"Web Search",webFetch:"Web Fetch",image:"Text to Image",tts:"Text To Speech"},f={webSearch:"/v1/search",webFetch:"/v1/web/fetch",image:"/v1/images/generations",tts:"/v1/audio/speech"},b={webSearch:e=>({model:e,query:"What is the latest news about AI?",search_type:"web",max_results:5}),webFetch:e=>({model:e,url:"https://example.com",format:"markdown"}),image:e=>({model:e,prompt:"A cute cat playing piano",n:1,size:"1024x1024"}),tts:e=>({model:e,input:"Hello, this is a test.",voice:"alloy"})};function j(e){return"webSearch"===e||"webFetch"===e?"/dashboard/media-providers/web":`/dashboard/media-providers/${e}`}function g(){let{id:e}=(0,l.useParams)(),t=(0,l.useRouter)(),[a,i]=(0,r.useState)(null),[g,w]=(0,r.useState)(!0),[v,y]=(0,r.useState)(""),[N,k]=(0,r.useState)(""),[S,C]=(0,r.useState)([]),[$,U]=(0,r.useState)(!1),[O,_]=(0,r.useState)(!1),[R,T]=(0,r.useState)([]),[A,M]=(0,r.useState)(!1),[P,L]=(0,r.useState)(null),[z,E]=(0,r.useState)(""),[F,D]=(0,r.useState)(""),[I,W]=(0,r.useState)([]),[J,Z]=(0,r.useState)({}),q=async()=>{try{let[t,a,s,l,r]=await Promise.all([fetch(`/api/combos/${e}`,{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"}),fetch("/api/usage/logs",{cache:"no-store"}),fetch("/api/providers",{cache:"no-store"}),fetch("/api/models/alias",{cache:"no-store"})]);if(r.ok&&Z((await r.json()).aliases||{}),l.ok&&W((await l.json()).connections||[]),!t.ok){i(null),w(!1);return}let n=await t.json();i(n),y(n.name),C(n.models||[]);let o=a.ok?await a.json():{};U(o.comboStrategies?.[n.name]?.fallbackStrategy==="round-robin");let d=s.ok?await s.json():[];T(d.filter(e=>"string"==typeof e&&e.includes(n.name)).slice(0,50))}catch{}w(!1)};(0,r.useEffect)(()=>{q()},[e]);let H=e=>e.trim()?h.test(e)?(k(""),!0):(k("Only letters, numbers, -, _ and ."),!1):(k("Name is required"),!1),K=async t=>{let a=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!a.ok){let e=await a.json();return(0,m.s)(e.error||"Failed to save"),!1}return!0},B=async()=>{!H(v)||v===a.name||await K({name:v})&&await q()},G=async e=>{let t=e?.value||e;if(!t||S.includes(t))return;let a=[...S,t];C(a),await K({models:a})},Q=async e=>{let t=e?.value||e;if(!t||!S.includes(t))return;let a=S.filter(e=>e!==t);C(a),await K({models:a})},Y=async e=>{let t=S.filter((t,a)=>a!==e);C(t),await K({models:t})},V=async(e,t)=>{let a=[...S],s=e+t;s<0||s>=a.length||([a[e],a[s]]=[a[s],a[e]],C(a),await K({models:a}))},X=async e=>{U(e);let t=await fetch("/api/settings",{cache:"no-store"}),s={...(t.ok?await t.json():{}).comboStrategies||{}};e?s[a.name]={fallbackStrategy:"round-robin"}:delete s[a.name],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:s})})},ee=async()=>{!await (0,x.l)({message:`Delete combo "${a.name?.trim()||e}"?`,confirmText:"Continue"})||(await fetch(`/api/combos/${e}`,{method:"DELETE"})).ok&&t.push(j(a.kind))},et=async()=>{if(!F.trim())return void E("Paste a client key secret before running this example.");if(M(!0),L(null),E(""),P?.audioUrl)try{URL.revokeObjectURL(P.audioUrl)}catch{}if(P?.imageUrl?.startsWith("blob:"))try{URL.revokeObjectURL(P.imageUrl)}catch{}let e=Date.now();try{let t=f[a.kind],s=b[a.kind](a.name),l={"Content-Type":"application/json"};F&&(l.Authorization=`Bearer ${F}`);let r=await fetch(`/api${t}`,{method:"POST",headers:l,body:JSON.stringify(s)}),i=Date.now()-e;if(!r.ok){let e=await r.json().catch(()=>({}));E(e?.error?.message||e?.error||`HTTP ${r.status}`),L({json:JSON.stringify(e,null,2),latencyMs:i});return}let n=r.headers.get("content-type")||"";if(n.startsWith("image/")){let e=await r.blob();L({imageUrl:URL.createObjectURL(e),latencyMs:i});return}if(n.startsWith("audio/")||"application/octet-stream"===n){let e=await r.blob();L({audioUrl:URL.createObjectURL(e),latencyMs:i});return}let o=await r.json(),d=o?.data?.[0],c=d?.b64_json?`data:image/png;base64,${d.b64_json}`:d?.url||"";L({json:JSON.stringify(function e(t){if(!t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(e);let a={};for(let[s,l]of Object.entries(t))a[s]="b64_json"===s&&"string"==typeof l&&l.length>100?`<${l.length} chars base64>`:e(l);return a}(o),null,2),imageUrl:c,latencyMs:i})}catch(e){E(e.message||"Network error")}M(!1)};if(g)return(0,s.jsx)("div",{className:"text-text-muted text-sm",children:"Loading..."});if(!a)return(0,l.notFound)();let ea=p[a.kind]||c.rj.find(e=>e.id===a.kind)?.label||"Combo",es=f[a.kind],el=a.kind&&b[a.kind]?b[a.kind](a.name):null,er=es?`curl -X POST http://localhost:20128${es} \\
2
2
  -H "Content-Type: application/json" \\
3
- -H "Authorization: Bearer ${D||"YOUR_KEY"}" \\
4
- -d '${JSON.stringify(el)}'`:"",ei=j(a.kind);return(0,s.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,s.jsx)(n(),{href:ei,className:"text-text-muted hover:text-primary",children:(0,s.jsx)("span",{className:"material-symbols-outlined",children:"arrow_back"})}),(0,s.jsx)("div",{className:"size-10 rounded-lg bg-primary/10 flex items-center justify-center",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-primary",children:"layers"})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("p",{className:"text-xs text-text-muted",children:[ea," Combo"]}),(0,s.jsx)("code",{className:"text-lg font-semibold font-mono",children:a.name})]})]}),(0,s.jsx)(o.$n,{variant:"outline",icon:"delete",onClick:ee,className:"text-red-500 border-red-200 hover:bg-red-50",children:"Delete"})]}),(0,s.jsxs)(o.Zp,{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Settings"}),(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(o.pd,{label:"Combo Name",value:y,onChange:e=>{v(e.target.value),q(e.target.value)},onBlur:K,error:N}),(0,s.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:"Only letters, numbers, -, _ and ."})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"Round Robin"}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Rotate providers across requests instead of strict fallback order."})]}),(0,s.jsx)(o.lM,{checked:C,onChange:X})]})]})]}),(0,s.jsxs)(o.Zp,{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Providers"}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Tried in order (top-down) or rotated when round-robin is on."})]}),(0,s.jsx)(o.$n,{size:"sm",icon:"add",onClick:()=>_(!0),children:"Add Provider"})]}),0===S.length?(0,s.jsx)("div",{className:"text-center py-6 border border-dashed border-border rounded-lg text-text-muted text-sm",children:"No providers yet."}):(0,s.jsx)("div",{className:"flex flex-col gap-2",children:S.map((e,t)=>{let{providerId:a,model:l}=function(e){if("string"!=typeof e)return{providerId:"",model:""};let t=e.indexOf("/");return t<0?{providerId:e,model:""}:{providerId:e.slice(0,t),model:e.slice(t+1)}}(e),r=c.Q2[a];return(0,s.jsxs)("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-black/[0.02] dark:bg-white/[0.02]",children:[(0,s.jsx)("span",{className:"text-xs text-text-muted w-5 text-center",children:t+1}),(0,s.jsx)(d.A,{src:`/providers/${a}.png`,alt:r?.name||a,size:24,className:"object-contain rounded shrink-0",fallbackText:r?.textIcon||a.slice(0,2).toUpperCase(),fallbackColor:r?.color}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"text-sm font-medium truncate",children:r?.name||a}),l&&(0,s.jsx)("code",{className:"text-[10px] text-text-muted font-mono truncate block",children:l})]}),(0,s.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,s.jsx)("button",{onClick:()=>V(t,-1),disabled:0===t,className:`p-1 rounded ${0===t?"text-text-muted/20":"text-text-muted hover:text-primary hover:bg-black/5"}`,"aria-label":`Move ${r?.name||a} up`,title:"Move up",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"arrow_upward"})}),(0,s.jsx)("button",{onClick:()=>V(t,1),disabled:t===S.length-1,className:`p-1 rounded ${t===S.length-1?"text-text-muted/20":"text-text-muted hover:text-primary hover:bg-black/5"}`,"aria-label":`Move ${r?.name||a} down`,title:"Move down",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"arrow_downward"})}),(0,s.jsx)("button",{onClick:()=>Q(t),className:"p-1 rounded text-text-muted hover:text-red-500 hover:bg-red-500/10","aria-label":`Remove ${r?.name||a}`,title:"Remove",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"close"})})]})]},`${e}-${t}`)})})]}),a.kind&&es&&(0,s.jsxs)(o.Zp,{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Test Example"}),(0,s.jsx)(o.$n,{size:"sm",icon:"play_arrow",onClick:et,disabled:A||0===S.length||!D.trim(),children:A?"Running...":"Run"})]}),(0,s.jsx)("div",{className:"mb-3",children:(0,s.jsx)(o.pd,{id:"combo-example-key",label:"Client Key Secret",type:"password",autoComplete:"off",placeholder:"Paste a Switchboard client key secret (sk-...)",value:D,onChange:e=>F(e.target.value),hint:"Run uses this key as the Authorization bearer for the local gateway endpoint."})}),(0,s.jsx)("pre",{className:"text-xs font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-x-auto whitespace-pre-wrap break-all",children:er}),E&&(0,s.jsx)("p",{role:"alert",className:"mt-3 text-xs text-red-500 break-words",children:E}),L&&(0,s.jsxs)("div",{className:"mt-3 flex flex-col gap-3",children:[null!=L.latencyMs&&(0,s.jsxs)("span",{className:"text-[11px] text-text-muted",children:["⚡ ",L.latencyMs,"ms"]}),L.imageUrl&&(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,s.jsxs)("a",{href:L.imageUrl,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)(h.default,{src:L.imageUrl,alt:"Generated",width:1024,height:1024,unoptimized:!0,className:"max-w-full rounded-lg border border-border"})]}),L.audioUrl&&(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,s.jsxs)("a",{href:L.audioUrl,download:"speech.mp3",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})}),(0,s.jsx)("audio",{controls:!0,src:L.audioUrl,className:"w-full"})]}),L.json&&(0,s.jsx)("pre",{className:"text-xs font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-auto max-h-[300px] whitespace-pre-wrap break-all",children:L.json})]})]}),(0,s.jsxs)(o.Zp,{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Usage Logs"}),0===R.length?(0,s.jsx)("p",{className:"text-xs text-text-muted italic",children:"No usage yet."}):(0,s.jsx)("pre",{className:"text-[11px] font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-auto max-h-[400px] whitespace-pre-wrap",children:R.join("\n")})]}),(0,s.jsx)(o.rq,{isOpen:O,onClose:()=>_(!1),onSelect:Y,onDeselect:G,activeProviders:I,modelAliases:W,title:`Add ${ea} Model`,kindFilter:a.kind,addedModelValues:S,closeOnSelect:!1})]})}},69701:(e,t,a)=>{Promise.resolve().then(a.bind(a,22662))}},e=>{e.O(0,[2574,3862,782,8500,594,1321,4707,5497,8441,3794,7358],()=>e(e.s=69701)),_N_E=e.O()}]);
3
+ -H "Authorization: Bearer ${F||"YOUR_KEY"}" \\
4
+ -d '${JSON.stringify(el)}'`:"",ei=j(a.kind);return(0,s.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,s.jsx)(n(),{href:ei,className:"text-text-muted hover:text-primary",children:(0,s.jsx)("span",{className:"material-symbols-outlined",children:"arrow_back"})}),(0,s.jsx)("div",{className:"size-10 rounded-lg bg-primary/10 flex items-center justify-center",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-primary",children:"layers"})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("p",{className:"text-xs text-text-muted",children:[ea," Combo"]}),(0,s.jsx)("code",{className:"text-lg font-semibold font-mono",children:a.name})]})]}),(0,s.jsx)(o.$n,{variant:"outline",icon:"delete",onClick:ee,className:"text-red-500 border-red-200 hover:bg-red-50",children:"Delete"})]}),(0,s.jsxs)(o.Zp,{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Settings"}),(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(o.pd,{label:"Combo Name",value:v,onChange:e=>{y(e.target.value),H(e.target.value)},onBlur:B,error:N}),(0,s.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:"Only letters, numbers, -, _ and ."})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"Round Robin"}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Rotate providers across requests instead of strict fallback order."})]}),(0,s.jsx)(o.lM,{checked:$,onChange:X})]})]})]}),(0,s.jsxs)(o.Zp,{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Providers"}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Tried in order (top-down) or rotated when round-robin is on."})]}),(0,s.jsx)(o.$n,{size:"sm",icon:"add",onClick:()=>_(!0),children:"Add Provider"})]}),0===S.length?(0,s.jsx)("div",{className:"text-center py-6 border border-dashed border-border rounded-lg text-text-muted text-sm",children:"No providers yet."}):(0,s.jsx)("div",{className:"flex flex-col gap-2",children:S.map((e,t)=>{let{providerId:a,model:l}=function(e){if("string"!=typeof e)return{providerId:"",model:""};let t=e.indexOf("/");return t<0?{providerId:e,model:""}:{providerId:e.slice(0,t),model:e.slice(t+1)}}(e),r=c.Q2[a];return(0,s.jsxs)("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-black/[0.02] dark:bg-white/[0.02]",children:[(0,s.jsx)("span",{className:"text-xs text-text-muted w-5 text-center",children:t+1}),(0,s.jsx)(d.A,{src:`/providers/${a}.png`,alt:r?.name||a,size:24,className:"object-contain rounded shrink-0",fallbackText:r?.textIcon||a.slice(0,2).toUpperCase(),fallbackColor:r?.color}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"text-sm font-medium truncate",children:r?.name||a}),l&&(0,s.jsx)("code",{className:"text-[10px] text-text-muted font-mono truncate block",children:l})]}),(0,s.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,s.jsx)("button",{onClick:()=>V(t,-1),disabled:0===t,className:`p-1 rounded ${0===t?"text-text-muted/20":"text-text-muted hover:text-primary hover:bg-black/5"}`,"aria-label":`Move ${r?.name||a} up`,title:"Move up",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"arrow_upward"})}),(0,s.jsx)("button",{onClick:()=>V(t,1),disabled:t===S.length-1,className:`p-1 rounded ${t===S.length-1?"text-text-muted/20":"text-text-muted hover:text-primary hover:bg-black/5"}`,"aria-label":`Move ${r?.name||a} down`,title:"Move down",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"arrow_downward"})}),(0,s.jsx)("button",{onClick:()=>Y(t),className:"p-1 rounded text-text-muted hover:text-red-500 hover:bg-red-500/10","aria-label":`Remove ${r?.name||a}`,title:"Remove",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"close"})})]})]},`${e}-${t}`)})})]}),a.kind&&es&&(0,s.jsxs)(o.Zp,{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Test Example"}),(0,s.jsx)(o.$n,{size:"sm",icon:"play_arrow",onClick:et,disabled:A||0===S.length||!F.trim(),children:A?"Running...":"Run"})]}),(0,s.jsx)("div",{className:"mb-3",children:(0,s.jsx)(o.pd,{id:"combo-example-key",label:"Client Key Secret",type:"password",autoComplete:"off",placeholder:"Paste a Switchboard client key secret (sk-...)",value:F,onChange:e=>D(e.target.value),hint:"Run uses this key as the Authorization bearer for the local gateway endpoint."})}),(0,s.jsx)("pre",{className:"text-xs font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-x-auto whitespace-pre-wrap break-all",children:er}),z&&(0,s.jsx)("p",{role:"alert",className:"mt-3 text-xs text-red-500 break-words",children:z}),P&&(0,s.jsxs)("div",{className:"mt-3 flex flex-col gap-3",children:[null!=P.latencyMs&&(0,s.jsxs)("span",{className:"text-[11px] text-text-muted",children:["⚡ ",P.latencyMs,"ms"]}),P.imageUrl&&(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,s.jsxs)("a",{href:P.imageUrl,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)(u.default,{src:P.imageUrl,alt:"Generated",width:1024,height:1024,unoptimized:!0,className:"max-w-full rounded-lg border border-border"})]}),P.audioUrl&&(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,s.jsxs)("a",{href:P.audioUrl,download:"speech.mp3",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})}),(0,s.jsx)("audio",{controls:!0,src:P.audioUrl,className:"w-full"})]}),P.json&&(0,s.jsx)("pre",{className:"text-xs font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-auto max-h-[300px] whitespace-pre-wrap break-all",children:P.json})]})]}),(0,s.jsxs)(o.Zp,{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Usage Logs"}),0===R.length?(0,s.jsx)("p",{className:"text-xs text-text-muted italic",children:"No usage yet."}):(0,s.jsx)("pre",{className:"text-[11px] font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-auto max-h-[400px] whitespace-pre-wrap",children:R.join("\n")})]}),(0,s.jsx)(o.rq,{isOpen:O,onClose:()=>_(!1),onSelect:G,onDeselect:Q,activeProviders:I,modelAliases:J,title:`Add ${ea} Model`,kindFilter:a.kind,addedModelValues:S,closeOnSelect:!1})]})}},35497:(e,t,a)=>{"use strict";a.d(t,{x0:()=>N.default,Ex:()=>d.default,$n:()=>s.default,nh:()=>U.default,Zp:()=>i.default,Qv:()=>o.CardSkeleton,CK:()=>h.default,uo:()=>n.ConfirmModal,G9:()=>g.default,wI:()=>y.default,vj:()=>v.default,vE:()=>w.default,pd:()=>l.default,Mh:()=>j.default,uR:()=>u.default,Nf:()=>p.default,aF:()=>n.default,rq:()=>x.default,gw:()=>k.default,LF:()=>m.default,Wx:()=>$.default,gM:()=>b.default,Iz:()=>S.default,l6:()=>r.default,lM:()=>c.default,m_:()=>C.default,jK:()=>f.default});var s=a(92542),l=a(11910),r=a(98),i=a(84588),n=a(81127),o=a(25086);a(56319);var d=a(56061),c=a(98542);a(38587),a(21110),a(92622),a(8823),a(92173);var m=a(90882),x=a(72908),u=a(28815),h=a(45455),p=a(28058),f=a(4809);a(21931),a(80752),a(40197);var b=a(23615);a(44736);var j=a(62899);a(94230);var g=a(30815),w=a(23936),v=a(95088),y=a(73579),N=a(96748),k=a(4823),S=a(28067),C=a(97677),$=a(51825),U=a(29366);a(76361),a(91450)},69701:(e,t,a)=>{Promise.resolve().then(a.bind(a,22662))}},e=>{e.O(0,[2574,3862,782,8500,594,1321,4707,1330,8441,3794,7358],()=>e(e.s=69701)),_N_E=e.O()}]);