@rabbi696/ezrouter 0.6.15 → 0.6.16

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 (863) hide show
  1. package/README.md +72 -1
  2. package/app/.next-cli-build/BUILD_ID +1 -1
  3. package/app/.next-cli-build/app-path-routes-manifest.json +27 -27
  4. package/app/.next-cli-build/build-manifest.json +2 -2
  5. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/convoy/page.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/convoy/page.js.nft.json +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/convoy/page_client-reference-manifest.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/error-log/page.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/error-log/page.js.nft.json +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/error-log/page_client-reference-manifest.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mcp-gateway/keys/page.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mcp-gateway/keys/page.js.nft.json +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mcp-gateway/keys/page_client-reference-manifest.js +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mcp-gateway/page.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mcp-gateway/page.js.nft.json +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mcp-gateway/page_client-reference-manifest.js +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mcp-gateway/servers/page.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mcp-gateway/servers/page.js.nft.json +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mcp-gateway/servers/page_client-reference-manifest.js +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +10 -6
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +3 -3
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/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.js.nft.json +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  75. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  76. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  77. package/app/.next-cli-build/server/app/(dashboard)/dashboard/routing-health/page.js +1 -1
  78. package/app/.next-cli-build/server/app/(dashboard)/dashboard/routing-health/page.js.nft.json +1 -1
  79. package/app/.next-cli-build/server/app/(dashboard)/dashboard/routing-health/page_client-reference-manifest.js +1 -1
  80. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  81. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  82. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  83. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  84. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  85. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  86. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  87. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  88. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  89. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  90. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  91. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  92. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  93. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  94. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  95. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  96. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  97. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  98. package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  99. package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  100. package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  101. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  102. package/app/.next-cli-build/server/app/_not-found/page.js +1 -1
  103. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  104. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  105. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  106. package/app/.next-cli-build/server/app/_not-found.rsc +3 -3
  107. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
  108. package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  109. package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +3 -3
  110. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  111. package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  112. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  113. package/app/.next-cli-build/server/app/api/auth/login/route.js +1 -1
  114. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/auth/logout/route.js +1 -1
  116. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  117. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js +1 -1
  118. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  119. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js +1 -1
  120. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  121. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js +1 -1
  122. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  123. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js +1 -1
  124. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/auth/saml/acs/route.js +1 -1
  126. package/app/.next-cli-build/server/app/api/auth/saml/acs/route.js.nft.json +1 -1
  127. package/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js +1 -1
  128. package/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/api/auth/saml/start/route.js +1 -1
  130. package/app/.next-cli-build/server/app/api/auth/saml/start/route.js.nft.json +1 -1
  131. package/app/.next-cli-build/server/app/api/auth/saml/test/route.js +1 -1
  132. package/app/.next-cli-build/server/app/api/auth/saml/test/route.js.nft.json +1 -1
  133. package/app/.next-cli-build/server/app/api/auth/status/route.js +1 -1
  134. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/api/changelog/route.js.nft.json +1 -1
  136. package/app/.next-cli-build/server/app/api/cli/providers/codex/route.js +1 -1
  137. package/app/.next-cli-build/server/app/api/cli/providers/codex/route.js.nft.json +1 -1
  138. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +1 -1
  139. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  140. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +1 -1
  141. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  142. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js +1 -1
  143. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  144. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  145. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  146. package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js +1 -1
  147. package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js.nft.json +1 -1
  148. package/app/.next-cli-build/server/app/api/cli-tools/codex-native/models/route.js +1 -1
  149. package/app/.next-cli-build/server/app/api/cli-tools/codex-native/models/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/cli-tools/codex-native/readiness/route.js +1 -1
  151. package/app/.next-cli-build/server/app/api/cli-tools/codex-native/readiness/route.js.nft.json +1 -1
  152. package/app/.next-cli-build/server/app/api/cli-tools/codex-profiles/route.js.nft.json +1 -1
  153. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  154. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +1 -1
  155. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  157. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
  158. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  159. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  160. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  161. package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js +1 -1
  162. package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js.nft.json +1 -1
  163. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +1 -1
  164. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  165. package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js.nft.json +1 -1
  166. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  167. package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js +1 -1
  168. package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js.nft.json +1 -1
  169. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +1 -1
  170. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
  171. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  172. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  173. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js +1 -1
  175. package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js.nft.json +1 -1
  176. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  177. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
  178. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  179. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +1 -1
  180. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
  181. package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js +1 -1
  182. package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js.nft.json +1 -1
  183. package/app/.next-cli-build/server/app/api/combos/[id]/route.js +1 -1
  184. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  185. package/app/.next-cli-build/server/app/api/combos/[id]/test/route.js +1 -1
  186. package/app/.next-cli-build/server/app/api/combos/[id]/test/route.js.nft.json +1 -1
  187. package/app/.next-cli-build/server/app/api/combos/export/route.js +1 -1
  188. package/app/.next-cli-build/server/app/api/combos/export/route.js.nft.json +1 -1
  189. package/app/.next-cli-build/server/app/api/combos/import/route.js +1 -1
  190. package/app/.next-cli-build/server/app/api/combos/import/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/combos/presets/route.js +1 -1
  192. package/app/.next-cli-build/server/app/api/combos/presets/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/combos/route.js +1 -1
  194. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/combos/test/route.js +1 -1
  196. package/app/.next-cli-build/server/app/api/combos/test/route.js.nft.json +1 -1
  197. package/app/.next-cli-build/server/app/api/convoy/rules/route.js.nft.json +1 -1
  198. package/app/.next-cli-build/server/app/api/headroom/extras/route.js +1 -1
  199. package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
  200. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js +1 -1
  201. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  202. package/app/.next-cli-build/server/app/api/headroom/restart/route.js +1 -1
  203. package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
  204. package/app/.next-cli-build/server/app/api/headroom/start/route.js +1 -1
  205. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  206. package/app/.next-cli-build/server/app/api/headroom/status/route.js +1 -1
  207. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  208. package/app/.next-cli-build/server/app/api/headroom/stop/route.js +1 -1
  209. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  210. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  211. package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  212. package/app/.next-cli-build/server/app/api/internal/codex-native/lease/[action]/route.js +1 -1
  213. package/app/.next-cli-build/server/app/api/internal/codex-native/lease/[action]/route.js.nft.json +1 -1
  214. package/app/.next-cli-build/server/app/api/keys/[id]/route.js +1 -1
  215. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  216. package/app/.next-cli-build/server/app/api/keys/route.js +1 -1
  217. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  218. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  219. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js +1 -1
  220. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  221. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js +1 -1
  222. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  223. package/app/.next-cli-build/server/app/api/mcp-gateway/instances/[id]/route.js +1 -1
  224. package/app/.next-cli-build/server/app/api/mcp-gateway/instances/[id]/route.js.nft.json +1 -1
  225. package/app/.next-cli-build/server/app/api/mcp-gateway/instances/[id]/test/route.js +1 -1
  226. package/app/.next-cli-build/server/app/api/mcp-gateway/instances/[id]/test/route.js.nft.json +1 -1
  227. package/app/.next-cli-build/server/app/api/mcp-gateway/instances/route.js +1 -1
  228. package/app/.next-cli-build/server/app/api/mcp-gateway/instances/route.js.nft.json +1 -1
  229. package/app/.next-cli-build/server/app/api/mcp-gateway/keys/[id]/route.js +1 -1
  230. package/app/.next-cli-build/server/app/api/mcp-gateway/keys/[id]/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/mcp-gateway/keys/route.js +1 -1
  232. package/app/.next-cli-build/server/app/api/mcp-gateway/keys/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/mcp-gateway/message/route.js +1 -1
  234. package/app/.next-cli-build/server/app/api/mcp-gateway/message/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/mcp-gateway/oauth/[id]/[action]/route.js +2 -2
  236. package/app/.next-cli-build/server/app/api/mcp-gateway/oauth/[id]/[action]/route.js.nft.json +1 -1
  237. package/app/.next-cli-build/server/app/api/mcp-gateway/route.js +1 -1
  238. package/app/.next-cli-build/server/app/api/mcp-gateway/route.js.nft.json +1 -1
  239. package/app/.next-cli-build/server/app/api/mcp-gateway/sse/route.js.nft.json +1 -1
  240. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js +1 -1
  241. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  242. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  243. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  244. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js +1 -1
  245. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  246. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js +1 -1
  247. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  248. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  249. package/app/.next-cli-build/server/app/api/models/alias/route.js +1 -1
  250. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  251. package/app/.next-cli-build/server/app/api/models/availability/route.js +1 -1
  252. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  253. package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js.nft.json +1 -1
  254. package/app/.next-cli-build/server/app/api/models/custom/route.js +1 -1
  255. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  256. package/app/.next-cli-build/server/app/api/models/disabled/route.js +1 -1
  257. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  258. package/app/.next-cli-build/server/app/api/models/enabled/route.js +1 -1
  259. package/app/.next-cli-build/server/app/api/models/enabled/route.js.nft.json +1 -1
  260. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  261. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  262. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  263. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  264. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  265. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  266. package/app/.next-cli-build/server/app/api/oauth/callback/route.js.nft.json +1 -1
  267. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  268. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  269. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  270. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  271. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js +1 -1
  272. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  273. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
  274. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  275. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js +1 -1
  276. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  277. package/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js +1 -1
  278. package/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js.nft.json +1 -1
  279. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js +1 -1
  280. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  281. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js +1 -1
  282. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  283. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js +1 -1
  284. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  285. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js +1 -1
  286. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  287. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js +1 -1
  288. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  289. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  290. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  291. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  292. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/api-key/route.js +1 -1
  293. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/api-key/route.js.nft.json +1 -1
  294. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js.nft.json +1 -1
  295. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/start/route.js.nft.json +1 -1
  296. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/status/route.js.nft.json +1 -1
  297. package/app/.next-cli-build/server/app/api/oauth/zed/auto-import/route.js.nft.json +1 -1
  298. package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js +1 -1
  299. package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js.nft.json +1 -1
  300. package/app/.next-cli-build/server/app/api/pricing/route.js +1 -1
  301. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  302. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js +1 -1
  303. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  304. package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
  305. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  306. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js +1 -1
  307. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  308. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  309. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  310. package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js +1 -1
  311. package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js.nft.json +1 -1
  312. package/app/.next-cli-build/server/app/api/providers/[id]/refresh-profile/route.js +1 -1
  313. package/app/.next-cli-build/server/app/api/providers/[id]/refresh-profile/route.js.nft.json +1 -1
  314. package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
  315. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  316. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
  317. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  318. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  319. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  320. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  321. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  322. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  323. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  324. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  325. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  326. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  327. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  328. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  329. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  330. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js +1 -1
  331. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  332. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js +1 -1
  333. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  334. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js +1 -1
  335. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  336. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js +1 -1
  337. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  338. package/app/.next-cli-build/server/app/api/proxy-pools/route.js +1 -1
  339. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  340. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js +1 -1
  341. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  342. package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
  343. package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
  344. package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
  345. package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
  346. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js +1 -1
  347. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
  348. package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
  349. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js +1 -1
  350. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
  351. package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
  352. package/app/.next-cli-build/server/app/api/routing-health/route.js +1 -1
  353. package/app/.next-cli-build/server/app/api/routing-health/route.js.nft.json +1 -1
  354. package/app/.next-cli-build/server/app/api/settings/database/route.js +1 -1
  355. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  356. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  357. package/app/.next-cli-build/server/app/api/settings/require-login/route.js +1 -1
  358. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  359. package/app/.next-cli-build/server/app/api/settings/route.js +1 -1
  360. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  361. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  362. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  363. package/app/.next-cli-build/server/app/api/token-saver/stats/route.js +1 -1
  364. package/app/.next-cli-build/server/app/api/token-saver/stats/route.js.nft.json +1 -1
  365. package/app/.next-cli-build/server/app/api/token-saver/stream/route.js +2 -2
  366. package/app/.next-cli-build/server/app/api/token-saver/stream/route.js.nft.json +1 -1
  367. package/app/.next-cli-build/server/app/api/tool-disclosure/stats/route.js.nft.json +1 -1
  368. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  369. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  370. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
  371. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  372. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  373. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  374. package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  375. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  376. package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  377. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  378. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js +1 -1
  379. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  380. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js +1 -1
  381. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  382. package/app/.next-cli-build/server/app/api/tunnel/status/route.js +1 -1
  383. package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  384. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js +1 -1
  385. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  386. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js +1 -1
  387. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  388. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js +1 -1
  389. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  390. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +1 -1
  391. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  392. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js +1 -1
  393. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js.nft.json +1 -1
  394. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  395. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  396. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  397. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  398. package/app/.next-cli-build/server/app/api/usage/chart/route.js +1 -1
  399. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  400. package/app/.next-cli-build/server/app/api/usage/error-logs/route.js.nft.json +1 -1
  401. package/app/.next-cli-build/server/app/api/usage/history/route.js +1 -1
  402. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  403. package/app/.next-cli-build/server/app/api/usage/logs/route.js +1 -1
  404. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  405. package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
  406. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  407. package/app/.next-cli-build/server/app/api/usage/request-details/route.js +1 -1
  408. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  409. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js +1 -1
  410. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  411. package/app/.next-cli-build/server/app/api/usage/stats/route.js +1 -1
  412. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  413. package/app/.next-cli-build/server/app/api/usage/stream/route.js +1 -1
  414. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  415. package/app/.next-cli-build/server/app/api/v1/alpha/search/route.js +1 -1
  416. package/app/.next-cli-build/server/app/api/v1/alpha/search/route.js.nft.json +1 -1
  417. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  418. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  419. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  420. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  421. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  422. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  423. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  424. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  425. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  426. package/app/.next-cli-build/server/app/api/v1/codex/alpha/search/route.js +1 -1
  427. package/app/.next-cli-build/server/app/api/v1/codex/alpha/search/route.js.nft.json +1 -1
  428. package/app/.next-cli-build/server/app/api/v1/codex/images/edits/route.js +1 -1
  429. package/app/.next-cli-build/server/app/api/v1/codex/images/edits/route.js.nft.json +1 -1
  430. package/app/.next-cli-build/server/app/api/v1/codex/images/generations/route.js +1 -1
  431. package/app/.next-cli-build/server/app/api/v1/codex/images/generations/route.js.nft.json +1 -1
  432. package/app/.next-cli-build/server/app/api/v1/codex/memories/trace_summarize/route.js +1 -1
  433. package/app/.next-cli-build/server/app/api/v1/codex/memories/trace_summarize/route.js.nft.json +1 -1
  434. package/app/.next-cli-build/server/app/api/v1/codex/models/route.js +1 -1
  435. package/app/.next-cli-build/server/app/api/v1/codex/models/route.js.nft.json +1 -1
  436. package/app/.next-cli-build/server/app/api/v1/codex/responses/compact/route.js +1 -1
  437. package/app/.next-cli-build/server/app/api/v1/codex/responses/compact/route.js.nft.json +1 -1
  438. package/app/.next-cli-build/server/app/api/v1/codex/responses/route.js +1 -1
  439. package/app/.next-cli-build/server/app/api/v1/codex/responses/route.js.nft.json +1 -1
  440. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  441. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  442. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +3 -3
  443. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  444. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  445. package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  446. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  447. package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js +1 -1
  448. package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js.nft.json +1 -1
  449. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  450. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  451. package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  452. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  453. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  454. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  455. package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  456. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  457. package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  458. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  459. package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
  460. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  461. package/app/.next-cli-build/server/app/api/v1/systemone/route.js +1 -1
  462. package/app/.next-cli-build/server/app/api/v1/systemone/route.js.nft.json +1 -1
  463. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
  464. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
  465. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
  466. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
  467. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
  468. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
  469. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
  470. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
  471. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  472. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  473. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
  474. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  475. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  476. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  477. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  478. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  479. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  480. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  481. package/app/.next-cli-build/server/app/callback/page.js +1 -1
  482. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  483. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  484. package/app/.next-cli-build/server/app/callback.html +1 -1
  485. package/app/.next-cli-build/server/app/callback.rsc +3 -3
  486. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
  487. package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  488. package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +3 -3
  489. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
  490. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  491. package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  492. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  493. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +5 -5
  494. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  495. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  496. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  497. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  498. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +5 -5
  499. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  500. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +3 -3
  501. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
  502. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  503. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +5 -5
  504. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  505. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  506. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  507. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  508. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +5 -5
  509. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  510. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +3 -3
  511. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
  512. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  513. package/app/.next-cli-build/server/app/dashboard/combos.rsc +5 -5
  514. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  515. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  516. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  517. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  518. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +5 -5
  519. package/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  520. package/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +3 -3
  521. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
  522. package/app/.next-cli-build/server/app/dashboard/convoy.html +1 -1
  523. package/app/.next-cli-build/server/app/dashboard/convoy.rsc +5 -5
  524. package/app/.next-cli-build/server/app/dashboard/convoy.segments/!KGRhc2hib2FyZCk/dashboard/convoy/__PAGE__.segment.rsc +2 -2
  525. package/app/.next-cli-build/server/app/dashboard/convoy.segments/!KGRhc2hib2FyZCk/dashboard/convoy.segment.rsc +1 -1
  526. package/app/.next-cli-build/server/app/dashboard/convoy.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  527. package/app/.next-cli-build/server/app/dashboard/convoy.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  528. package/app/.next-cli-build/server/app/dashboard/convoy.segments/_full.segment.rsc +5 -5
  529. package/app/.next-cli-build/server/app/dashboard/convoy.segments/_head.segment.rsc +1 -1
  530. package/app/.next-cli-build/server/app/dashboard/convoy.segments/_index.segment.rsc +3 -3
  531. package/app/.next-cli-build/server/app/dashboard/convoy.segments/_tree.segment.rsc +1 -1
  532. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  533. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +5 -5
  534. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  535. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  536. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  537. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  538. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +5 -5
  539. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  540. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +3 -3
  541. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
  542. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.html +1 -1
  543. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.rsc +5 -5
  544. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.segments/!KGRhc2hib2FyZCk/dashboard/mcp-gateway/keys/__PAGE__.segment.rsc +2 -2
  545. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.segments/!KGRhc2hib2FyZCk/dashboard/mcp-gateway/keys.segment.rsc +1 -1
  546. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.segments/!KGRhc2hib2FyZCk/dashboard/mcp-gateway.segment.rsc +1 -1
  547. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  548. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  549. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.segments/_full.segment.rsc +5 -5
  550. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.segments/_head.segment.rsc +1 -1
  551. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.segments/_index.segment.rsc +3 -3
  552. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.segments/_tree.segment.rsc +1 -1
  553. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.html +1 -1
  554. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.rsc +5 -5
  555. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.segments/!KGRhc2hib2FyZCk/dashboard/mcp-gateway/servers/__PAGE__.segment.rsc +2 -2
  556. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.segments/!KGRhc2hib2FyZCk/dashboard/mcp-gateway/servers.segment.rsc +1 -1
  557. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.segments/!KGRhc2hib2FyZCk/dashboard/mcp-gateway.segment.rsc +1 -1
  558. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  559. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  560. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.segments/_full.segment.rsc +5 -5
  561. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.segments/_head.segment.rsc +1 -1
  562. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.segments/_index.segment.rsc +3 -3
  563. package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.segments/_tree.segment.rsc +1 -1
  564. package/app/.next-cli-build/server/app/dashboard/mcp-gateway.html +1 -1
  565. package/app/.next-cli-build/server/app/dashboard/mcp-gateway.rsc +5 -5
  566. package/app/.next-cli-build/server/app/dashboard/mcp-gateway.segments/!KGRhc2hib2FyZCk/dashboard/mcp-gateway/__PAGE__.segment.rsc +2 -2
  567. package/app/.next-cli-build/server/app/dashboard/mcp-gateway.segments/!KGRhc2hib2FyZCk/dashboard/mcp-gateway.segment.rsc +1 -1
  568. package/app/.next-cli-build/server/app/dashboard/mcp-gateway.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  569. package/app/.next-cli-build/server/app/dashboard/mcp-gateway.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  570. package/app/.next-cli-build/server/app/dashboard/mcp-gateway.segments/_full.segment.rsc +5 -5
  571. package/app/.next-cli-build/server/app/dashboard/mcp-gateway.segments/_head.segment.rsc +1 -1
  572. package/app/.next-cli-build/server/app/dashboard/mcp-gateway.segments/_index.segment.rsc +3 -3
  573. package/app/.next-cli-build/server/app/dashboard/mcp-gateway.segments/_tree.segment.rsc +1 -1
  574. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  575. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +5 -5
  576. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  577. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
  578. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
  579. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  580. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  581. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +5 -5
  582. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
  583. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +3 -3
  584. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
  585. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  586. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +5 -5
  587. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  588. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  589. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  590. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  591. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +5 -5
  592. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  593. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +3 -3
  594. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
  595. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  596. package/app/.next-cli-build/server/app/dashboard/profile.rsc +5 -5
  597. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  598. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  599. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  600. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  601. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +5 -5
  602. package/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  603. package/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +3 -3
  604. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
  605. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  606. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +5 -5
  607. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  608. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  609. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  610. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  611. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  612. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +5 -5
  613. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  614. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +3 -3
  615. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
  616. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  617. package/app/.next-cli-build/server/app/dashboard/providers.rsc +5 -5
  618. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  619. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  620. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  621. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  622. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +5 -5
  623. package/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  624. package/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +3 -3
  625. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
  626. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  627. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +5 -5
  628. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  629. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  630. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  631. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  632. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +5 -5
  633. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  634. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +3 -3
  635. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
  636. package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  637. package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +5 -5
  638. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
  639. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe.segment.rsc +1 -1
  640. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  641. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  642. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +5 -5
  643. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_head.segment.rsc +1 -1
  644. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_index.segment.rsc +3 -3
  645. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
  646. package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
  647. package/app/.next-cli-build/server/app/dashboard/quota.rsc +6 -6
  648. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  649. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  650. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  651. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  652. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +6 -6
  653. package/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  654. package/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +3 -3
  655. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
  656. package/app/.next-cli-build/server/app/dashboard/routing-health.html +1 -1
  657. package/app/.next-cli-build/server/app/dashboard/routing-health.rsc +5 -5
  658. package/app/.next-cli-build/server/app/dashboard/routing-health.segments/!KGRhc2hib2FyZCk/dashboard/routing-health/__PAGE__.segment.rsc +2 -2
  659. package/app/.next-cli-build/server/app/dashboard/routing-health.segments/!KGRhc2hib2FyZCk/dashboard/routing-health.segment.rsc +1 -1
  660. package/app/.next-cli-build/server/app/dashboard/routing-health.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  661. package/app/.next-cli-build/server/app/dashboard/routing-health.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  662. package/app/.next-cli-build/server/app/dashboard/routing-health.segments/_full.segment.rsc +5 -5
  663. package/app/.next-cli-build/server/app/dashboard/routing-health.segments/_head.segment.rsc +1 -1
  664. package/app/.next-cli-build/server/app/dashboard/routing-health.segments/_index.segment.rsc +3 -3
  665. package/app/.next-cli-build/server/app/dashboard/routing-health.segments/_tree.segment.rsc +1 -1
  666. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +1 -1
  667. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  668. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  669. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  670. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
  671. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
  672. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  673. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
  674. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  675. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  676. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  677. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  678. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  679. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  680. package/app/.next-cli-build/server/app/dashboard/skills.rsc +5 -5
  681. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
  682. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
  683. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  684. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  685. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +5 -5
  686. package/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
  687. package/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +3 -3
  688. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
  689. package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  690. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +5 -5
  691. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
  692. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +1 -1
  693. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  694. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  695. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +5 -5
  696. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +1 -1
  697. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +3 -3
  698. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
  699. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  700. package/app/.next-cli-build/server/app/dashboard/translator.rsc +5 -5
  701. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  702. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  703. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  704. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  705. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +5 -5
  706. package/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  707. package/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +3 -3
  708. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
  709. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  710. package/app/.next-cli-build/server/app/dashboard/usage.rsc +5 -5
  711. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  712. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  713. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  714. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  715. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
  716. package/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  717. package/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +3 -3
  718. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
  719. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  720. package/app/.next-cli-build/server/app/dashboard.rsc +5 -5
  721. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  722. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  723. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  724. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +5 -5
  725. package/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
  726. package/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +3 -3
  727. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  728. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  729. package/app/.next-cli-build/server/app/index.html +1 -1
  730. package/app/.next-cli-build/server/app/index.rsc +3 -3
  731. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  732. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
  733. package/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
  734. package/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +3 -3
  735. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
  736. package/app/.next-cli-build/server/app/landing/page.js +1 -1
  737. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  738. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  739. package/app/.next-cli-build/server/app/landing.html +1 -1
  740. package/app/.next-cli-build/server/app/landing.rsc +3 -3
  741. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
  742. package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  743. package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +3 -3
  744. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
  745. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  746. package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  747. package/app/.next-cli-build/server/app/login/page.js +1 -1
  748. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  749. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  750. package/app/.next-cli-build/server/app/login.html +1 -1
  751. package/app/.next-cli-build/server/app/login.rsc +4 -4
  752. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
  753. package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  754. package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +3 -3
  755. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
  756. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  757. package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  758. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  759. package/app/.next-cli-build/server/app/page.js +1 -1
  760. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  761. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  762. package/app/.next-cli-build/server/app-paths-manifest.json +27 -27
  763. package/app/.next-cli-build/server/chunks/1253.js +1 -1
  764. package/app/.next-cli-build/server/chunks/1482.js +4 -2
  765. package/app/.next-cli-build/server/chunks/1531.js +1 -1
  766. package/app/.next-cli-build/server/chunks/1641.js +1 -0
  767. package/app/.next-cli-build/server/chunks/1733.js +1 -1
  768. package/app/.next-cli-build/server/chunks/1847.js +1 -1
  769. package/app/.next-cli-build/server/chunks/2269.js +1 -1
  770. package/app/.next-cli-build/server/chunks/2348.js +1 -1
  771. package/app/.next-cli-build/server/chunks/2898.js +1 -1
  772. package/app/.next-cli-build/server/chunks/3583.js +2 -2
  773. package/app/.next-cli-build/server/chunks/3593.js +2 -2
  774. package/app/.next-cli-build/server/chunks/369.js +22 -22
  775. package/app/.next-cli-build/server/chunks/3886.js +1 -1
  776. package/app/.next-cli-build/server/chunks/3912.js +1 -1
  777. package/app/.next-cli-build/server/chunks/3977.js +2 -2
  778. package/app/.next-cli-build/server/chunks/412.js +1 -1
  779. package/app/.next-cli-build/server/chunks/4378.js +3 -3
  780. package/app/.next-cli-build/server/chunks/4485.js +1 -1
  781. package/app/.next-cli-build/server/chunks/4574.js +1 -1
  782. package/app/.next-cli-build/server/chunks/4646.js +1 -1
  783. package/app/.next-cli-build/server/chunks/4704.js +2 -2
  784. package/app/.next-cli-build/server/chunks/4739.js +2 -2
  785. package/app/.next-cli-build/server/chunks/4768.js +1 -1
  786. package/app/.next-cli-build/server/chunks/4780.js +2 -2
  787. package/app/.next-cli-build/server/chunks/4803.js +2 -2
  788. package/app/.next-cli-build/server/chunks/4827.js +1 -1
  789. package/app/.next-cli-build/server/chunks/4878.js +1 -1
  790. package/app/.next-cli-build/server/chunks/5011.js +1 -1
  791. package/app/.next-cli-build/server/chunks/507.js +2 -2
  792. package/app/.next-cli-build/server/chunks/5130.js +1 -1
  793. package/app/.next-cli-build/server/chunks/{8421.js → 5251.js} +1 -1
  794. package/app/.next-cli-build/server/chunks/5258.js +2 -2
  795. package/app/.next-cli-build/server/chunks/5434.js +1 -1
  796. package/app/.next-cli-build/server/chunks/5460.js +40 -0
  797. package/app/.next-cli-build/server/chunks/5704.js +254 -0
  798. package/app/.next-cli-build/server/chunks/5872.js +1 -0
  799. package/app/.next-cli-build/server/chunks/5875.js +1 -1
  800. package/app/.next-cli-build/server/chunks/6252.js +2 -2
  801. package/app/.next-cli-build/server/chunks/6420.js +1 -1
  802. package/app/.next-cli-build/server/chunks/6670.js +2 -2
  803. package/app/.next-cli-build/server/chunks/6769.js +1 -0
  804. package/app/.next-cli-build/server/chunks/6799.js +2 -2
  805. package/app/.next-cli-build/server/chunks/698.js +2 -2
  806. package/app/.next-cli-build/server/chunks/7073.js +2 -2
  807. package/app/.next-cli-build/server/chunks/7218.js +1 -1
  808. package/app/.next-cli-build/server/chunks/7239.js +2 -2
  809. package/app/.next-cli-build/server/chunks/7362.js +1 -1
  810. package/app/.next-cli-build/server/chunks/7594.js +6 -6
  811. package/app/.next-cli-build/server/chunks/7663.js +1 -1
  812. package/app/.next-cli-build/server/chunks/7677.js +1 -1
  813. package/app/.next-cli-build/server/chunks/7775.js +1 -1
  814. package/app/.next-cli-build/server/chunks/7811.js +1 -0
  815. package/app/.next-cli-build/server/chunks/7965.js +2 -2
  816. package/app/.next-cli-build/server/chunks/8062.js +2 -2
  817. package/app/.next-cli-build/server/chunks/8129.js +1 -1
  818. package/app/.next-cli-build/server/chunks/8231.js +1 -1
  819. package/app/.next-cli-build/server/chunks/8243.js +5 -5
  820. package/app/.next-cli-build/server/chunks/8306.js +1 -1
  821. package/app/.next-cli-build/server/chunks/8469.js +2 -2
  822. package/app/.next-cli-build/server/chunks/8520.js +2 -2
  823. package/app/.next-cli-build/server/chunks/8644.js +1 -1
  824. package/app/.next-cli-build/server/chunks/8772.js +1 -1
  825. package/app/.next-cli-build/server/chunks/8976.js +1 -1
  826. package/app/.next-cli-build/server/chunks/9026.js +24 -24
  827. package/app/.next-cli-build/server/chunks/9062.js +1 -1
  828. package/app/.next-cli-build/server/chunks/9303.js +1 -1
  829. package/app/.next-cli-build/server/chunks/9485.js +1 -1
  830. package/app/.next-cli-build/server/chunks/9718.js +1 -1
  831. package/app/.next-cli-build/server/instrumentation.js +1 -1
  832. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  833. package/app/.next-cli-build/server/middleware.js +3 -3
  834. package/app/.next-cli-build/server/pages/404.html +1 -1
  835. package/app/.next-cli-build/server/pages/500.html +1 -1
  836. package/app/.next-cli-build/static/chunks/1321-73fdccd2b1bf151d.js +1 -0
  837. package/app/.next-cli-build/static/chunks/{5497-8766958582f95dc7.js → 5497-ff58e90f4053e184.js} +3 -3
  838. package/app/.next-cli-build/static/chunks/{6252-34f2d410651e1103.js → 6252-886aa8324e135e9c.js} +13 -13
  839. package/app/.next-cli-build/static/chunks/8105-9b41dc96e4b019cf.js +1 -0
  840. package/app/.next-cli-build/static/chunks/9227-4471c8f39a105c5f.js +5 -0
  841. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-89b4f70958736f2a.js → page-c35f746b4bd9fc90.js} +18 -14
  842. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-fa195b4f7348e2d6.js → page-0868ecc0d2f1bd04.js} +2 -2
  843. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/{page-a31d9ca05cc3d528.js → page-6cb070834a750fdd.js} +1 -1
  844. package/app/CHANGELOG.md +54 -32
  845. package/app/package.json +1 -1
  846. package/app/public/CHANGELOG.md +54 -32
  847. package/app/src/mitm/server.js +24 -24
  848. package/cli.js +71 -69
  849. package/package.json +1 -1
  850. package/src/cli/commands/connect.js +157 -15
  851. package/src/cli/commands/connectTools.js +222 -4
  852. package/src/cli/commands/show.js +101 -0
  853. package/src/cli/menus/providers.js +8 -0
  854. package/app/.next-cli-build/server/chunks/3252.js +0 -1
  855. package/app/.next-cli-build/server/chunks/3267.js +0 -40
  856. package/app/.next-cli-build/server/chunks/6707.js +0 -1
  857. package/app/.next-cli-build/server/chunks/8450.js +0 -254
  858. package/app/.next-cli-build/server/chunks/9143.js +0 -1
  859. package/app/.next-cli-build/static/chunks/1321-043afc56cba448b8.js +0 -1
  860. package/app/.next-cli-build/static/chunks/8105-9dfc2c5ffef6e778.js +0 -1
  861. package/app/.next-cli-build/static/chunks/9227-af65f6ac1fca28c9.js +0 -3
  862. /package/app/.next-cli-build/static/{zQapcWqcr7oLVi5jh7t01 → Y5Sk8uSUyB0vJ-ZgW1X1U}/_buildManifest.js +0 -0
  863. /package/app/.next-cli-build/static/{zQapcWqcr7oLVi5jh7t01 → Y5Sk8uSUyB0vJ-ZgW1X1U}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5497],{98:(e,t,a)=>{a.d(t,{default:()=>s});var r=a(95155),n=a(31474);function s({label:e,options:t=[],value:a,onChange:i,placeholder:l="Select an option",error:o,hint:d,disabled:c=!1,required:u=!1,className:m,selectClassName:x,...p}){return(0,r.jsxs)("div",{className:(0,n.cn)("flex flex-col gap-1.5",m),children:[e&&(0,r.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,u&&(0,r.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)("select",{value:a,onChange:i,disabled:c,className:(0,n.cn)("w-full py-2.5 px-3 pr-10 text-sm text-text-main","bg-surface-2 border border-transparent rounded-[10px] appearance-none","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",o&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",x),...p,children:[(0,r.jsx)("option",{value:"",disabled:!0,children:l}),t.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,r.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"expand_more"})})]}),o&&(0,r.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,r.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},929:(e,t,a)=>{a.d(t,{y:()=>o});var r=a(12115),n=a(57151);let s=null,i=null;function l(){return s?Promise.resolve(s):i||(i=fetch("/api/models").then(async e=>{if(!e.ok)throw Error(`models ${e.status}`);return s=function(e){let t={},a={};for(let r of e||[])r.caps&&(r.fullModel&&(t[r.fullModel]=r.caps),r.routedModel&&(t[r.routedModel]=r.caps),r.model&&(a[r.model]=r.caps));return{byFull:t,byId:a}}((await e.json()).models)}).catch(()=>({byFull:{},byId:{}})).finally(()=>{i=null}))}function o(){let[e,t]=(0,r.useState)(()=>s?.byFull||{}),[a,i]=(0,r.useState)(()=>s?.byId||{});return(0,r.useEffect)(()=>{let e=!0,a=a=>{e&&(t(a.byFull),i(a.byId))};s?a(s):l().then(a);let r=()=>{s=null,l().then(a)};return window.addEventListener("customModelChanged",r),()=>{e=!1,window.removeEventListener("customModelChanged",r)}},[]),{getCaps:(0,r.useCallback)(t=>(function(e,t,a){if(!a)return null;if(e[a])return e[a];let r=a.includes("/")?a.slice(a.indexOf("/")+1):a;if(t[r])return t[r];let s=a.includes("/")?a.slice(0,a.indexOf("/")):null,i=(0,n.nl)(s,r);return{vision:i.vision,search:i.search,reasoning:i.reasoning,contextWindow:i.contextWindow,maxOutput:i.maxOutput}})(e,a,t),[e,a])}}},1620:(e,t,a)=>{a.d(t,{D:()=>o});var r=a(12115),n=a(90085);function s(e){let t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function i(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function l(){return!1}function o(){let{theme:e,setTheme:t,toggleTheme:a,initTheme:o}=(0,n.A)(),d=(0,r.useSyncExternalStore)(s,i,l);(0,r.useEffect)(()=>{o()},[o]),(0,r.useEffect)(()=>{if("system"!==e)return;let t=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>o();return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e,o]);let c="dark"===e||"system"===e&&d;return{theme:e,setTheme:t,toggleTheme:a,isDark:c}}},2222:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497);let o="https://api.x.ai/v1/videos";function d({isOpen:e,onClose:t,onCreated:a,onSaved:s,node:i}){let c=!!i,[u,m]=(0,n.useState)({name:"",prefix:"",baseUrl:o}),[x,p]=(0,n.useState)(!1),[h,g]=(0,n.useState)(""),[f,b]=(0,n.useState)(!1),[v,j]=(0,n.useState)(null);(0,n.useEffect)(()=>{e&&(j(null),g(""),c?m({name:i.name||"",prefix:i.prefix||"",baseUrl:i.baseUrl||o}):m({name:"",prefix:"",baseUrl:o}))},[e,c,i]);let y=async()=>{if(u.name.trim()&&u.prefix.trim()&&u.baseUrl.trim()){p(!0);try{let e=c?`/api/provider-nodes/${i.id}`:"/api/provider-nodes",t=c?"PUT":"POST",r={name:u.name,prefix:u.prefix,baseUrl:u.baseUrl};c||(r.type="custom-video");let n=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),l=await n.json();n.ok&&(c?s?.(l.node):a?.(l.node))}catch(e){console.log("Error saving custom video node:",e)}finally{p(!1)}}},k=async()=>{b(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:u.baseUrl,apiKey:h,type:"custom-video"})}),t=await e.json();j(t)}catch{j({valid:!1,error:"Network error"})}finally{b(!1)}};return(0,r.jsx)(l.aF,{isOpen:e,title:c?"Edit Custom Video":"Add Custom Video",onClose:t,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(l.pd,{label:"Name",value:u.name,onChange:e=>m({...u,name:e.target.value}),placeholder:"Grok Imagine",hint:"Required. A friendly label for this video provider."}),(0,r.jsx)(l.pd,{label:"Prefix",value:u.prefix,onChange:e=>m({...u,prefix:e.target.value}),placeholder:"grok-video",hint:"Required. Used as the provider prefix for model IDs (e.g. grok-video/grok-imagine-video)."}),(0,r.jsx)(l.pd,{label:"Base URL",value:u.baseUrl,onChange:e=>m({...u,baseUrl:e.target.value}),placeholder:"https://api.x.ai/v1/videos",hint:"xAI-style async job endpoint. POST {base}/generations creates a job; GET {base}/{request_id} polls."}),(0,r.jsx)(l.pd,{label:"API Key (for Check)",type:"password",value:h,onChange:e=>g(e.target.value),hint:"Check probes the endpoint with an empty body — verifies the key is authorized without creating a billable job."}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(l.$n,{onClick:k,disabled:!h||f||!u.baseUrl.trim(),variant:"secondary",children:f?"Checking...":"Check"}),(()=>{if(!v)return null;let{valid:e,error:t}=v;return e?(0,r.jsx)(l.Ex,{variant:"success",children:"Reachable \xb7 Authorized"}):(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)(l.Ex,{variant:"error",children:"Invalid"}),t&&(0,r.jsx)("span",{className:"text-sm text-red-500",children:t})]})})()]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:y,fullWidth:!0,disabled:!u.name.trim()||!u.prefix.trim()||!u.baseUrl.trim()||x,children:x?c?"Saving...":"Creating...":c?"Save":"Create"}),(0,r.jsx)(l.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}d.propTypes={isOpen:i().bool.isRequired,onClose:i().func.isRequired,onCreated:i().func,onSaved:i().func,node:i().shape({id:i().string,name:i().string,prefix:i().string,baseUrl:i().string})}},4823:(e,t,a)=>{a.d(t,{default:()=>m});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(84588),o=a(98),d=a(56061);let c="__none__",u=[{value:"none",label:"None (single pool)"},{value:"round-robin",label:"Round-robin"},{value:"random",label:"Random"}];function m({providerId:e}){let[t,a]=(0,n.useState)([]),[s,i]=(0,n.useState)(c),[x,p]=(0,n.useState)("none"),[h,g]=(0,n.useState)(!1),[f,b]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let t=!1;return Promise.all([fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.ok?e.json():{proxyPools:[]}),fetch("/api/settings",{cache:"no-store"}).then(e=>e.ok?e.json():{})]).then(([r,n])=>{if(t)return;a(r.proxyPools||[]);let s=(n.providerStrategies||{})[e]||{};i(s.proxyPoolId||c),p(s.rotateStrategy||"none")}).catch(()=>{}),()=>{t=!0}},[e]);let v=(0,n.useCallback)(async(t,a)=>{g(!0);try{let r=await fetch("/api/settings",{cache:"no-store"}),n=(r.ok?await r.json():{}).providerStrategies||{},s={...n[e]||{}};t===c?delete s.proxyPoolId:s.proxyPoolId=t,"none"===a?delete s.rotateStrategy:s.rotateStrategy=a;let i={...n};0===Object.keys(s).length?delete i[e]:i[e]=s,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:i})}),b(!0),setTimeout(()=>b(!1),1500)}catch(e){console.log("Save proxy config error:",e)}finally{g(!1)}},[e]),j=t.length>=2,y="none"!==x;return(0,r.jsxs)(l.default,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,r.jsx)("div",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-green-500/10 text-green-500",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"lock_open"})}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"No authentication required"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"This provider is ready to use. Optionally route requests through a proxy pool to bypass IP-based limits."})]}),f&&(0,r.jsx)(d.default,{variant:"success",size:"sm",children:"Saved"})]}),(0,r.jsx)(o.default,{label:"Proxy Pool",value:s,onChange:e=>{var t;i(t=e.target.value),v(t,x)},disabled:h||y,options:[{value:c,label:"None (direct)"},...t.map(e=>({value:e.id,label:e.name}))],hint:y?"Pool selector is ignored when rotation is active — all active pools are used.":void 0}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 mt-4",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-text-main",children:"Rotation Strategy"}),(0,r.jsx)("select",{value:x,onChange:e=>{var t;p(t=e.target.value),v(s,t)},disabled:h,className:"py-2 px-3 text-sm text-text-main bg-white dark:bg-white/5 border border-black/10 dark:border-white/10 rounded-md focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none transition-all disabled:opacity-50",children:u.map(e=>(0,r.jsx)("option",{value:e.value,disabled:"none"!==e.value&&!j,children:e.label},e.value))}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:j?y?"round-robin"===x?`Rotating through all ${t.length} active pools in order. State is in-memory (resets on restart).`:`Picking a random pool from ${t.length} active pools each request.`:"Uses the selected pool above. Set to Round-robin or Random to rotate across all active pools.":"Need at least 2 active proxy pools for rotation."})]})]})}m.propTypes={providerId:i().string.isRequired}},8247:(e,t,a)=>{a.d(t,{HY:()=>i,Kw:()=>l});let r={"perplexity-agent":"perplexity","gitlab-duo":"gitlab","vercel-ai-gateway":"vercel","opencode-zen":"opencode","ollama-search":"ollama"},n=new Set;function s(e){return e&&"string"==typeof e?e.trim().toLowerCase():""}function i(e){let t=function(e){let t=s(e);if(!t||n.has(t))return"";let a=r[t]||t;return n.has(a)?"":a}(e);return t?`/providers/${t}.png`:null}function l(e){let t=s(e);t&&n.add(t);let a=r[t];a&&n.add(a)}},8823:(e,t,a)=>{a.d(t,{default:()=>k});var r=a(95155),n=a(12115),s=a(73321),i=a(98500),l=a.n(i),o=a(14051),d=a.n(o),c=a(57250),u=a(80752),m=a(93308),x=a(38202),p=a(21931);function h(){let[e,t]=(0,n.useState)(!1),[a,s]=(0,n.useState)("en");return(0,n.useEffect)(()=>{s(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${m.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,m.QC)(t)}())},[e]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{onClick:()=>t(!0),className:"flex items-center justify-center p-2 rounded-lg text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5 transition-all",title:"Language","data-i18n-skip":"true",children:(0,r.jsx)("span",{className:"text-lg leading-none",children:x.h[a]||"\uD83C\uDF10"})}),(0,r.jsx)(p.default,{hideTrigger:!0,isOpen:e,onClose:e=>{t(!1),s(e)}})]})}var g=a(38587),f=a(38003),b=a(90620),v=a(88105),j=a(8247),y=a(73006);function k({onMenuClick:e,showMenuButton:t=!0}){let a=(0,s.usePathname)(),[i,o]=(0,n.useState)(""),[d,m]=(0,n.useState)(""),{title:x,description:p,icon:f,breadcrumbs:N}=(0,n.useMemo)(()=>(e=>{if(!e)return{title:"",description:"",breadcrumbs:[]};let t=e.match(/\/media-providers\/([^/]+)\/([^/]+)$/);if(t){let e=t[1],a=t[2],r=v.rj.find(t=>t.id===e),n=v.Q2[a];return{title:n?.name||a,description:"",breadcrumbs:[{label:"Media Providers",href:`/dashboard/media-providers/${e}`},{label:r?.label||e,href:`/dashboard/media-providers/${e}`},{label:n?.name||a,image:(0,j.HY)(a)}]}}let a=e.match(/\/media-providers\/([^/]+)$/);if(a){let e=a[1],t=v.rj.find(t=>t.id===e);return{title:t?.label||e,description:`Manage your ${t?.label||e} providers`,icon:t?.icon||"perm_media",breadcrumbs:[]}}let r=e.match(/\/providers\/([^/]+)$/);if(r){let e=r[1],t=b.zN[e]||b.fg[e];if(t)return{title:t.name,description:"",breadcrumbs:[{label:"Providers",href:"/dashboard/providers"},{label:t.name,image:(0,j.HY)(t.id)}]}}return e.includes("/providers")&&!e.includes("/media-providers")?{title:"Providers",description:"Manage your AI provider connections",icon:"dns",breadcrumbs:[]}:e.includes("/combos")?{title:"Combos",description:"Model combos with fallback",icon:"layers",breadcrumbs:[]}:e.includes("/usage")?{title:"Usage & Analytics",description:"Monitor your API usage, token consumption, and request logs",icon:"bar_chart",breadcrumbs:[]}:e.includes("/auth-files")?{title:"Auth Files",description:"Map provider credentials stored in the local database",icon:"vpn_key",breadcrumbs:[]}:e.includes("/quota")?{title:"Quota Tracker",description:"Track and manage your API quota limits",icon:"data_usage",breadcrumbs:[]}:e.includes("/mitm")?{title:"MITM Proxy",description:"Intercept CLI tool traffic and route through EzRouter",icon:"security",breadcrumbs:[]}:e.includes("/token-saver")?{title:"Token Saver",description:"Compress prompts and outputs to save tokens",icon:"savings",breadcrumbs:[]}:e.includes("/cli-tools")?{title:"CLI Tools",description:"Configure CLI tools",icon:"terminal",breadcrumbs:[]}:e.includes("/proxy-pools")?{title:"Proxy Pools",description:"Manage your proxy pool configurations",icon:"lan",breadcrumbs:[]}:e.includes("/skills")?{title:"Agent Skills",description:"Copy a link and paste to your AI to use EzRouter — no install needed",icon:"extension",breadcrumbs:[]}:e.includes("/endpoint")?{title:"Endpoint",description:"API endpoint configuration",icon:"api",breadcrumbs:[]}:e.includes("/profile")?{title:"Settings",description:"Manage your preferences",icon:"settings",breadcrumbs:[]}:e.includes("/translator")?{title:"Translator",description:"Debug translation flow between formats",icon:"translate",breadcrumbs:[]}:e.includes("/console-log")?{title:"Console Log",description:"Live server console output",icon:"monitor",breadcrumbs:[]}:"/dashboard"===e?{title:"Endpoint",description:"API endpoint configuration",icon:"api",breadcrumbs:[]}:{title:"",description:"",breadcrumbs:[]}})(a),[a]);(0,n.useEffect)(()=>{let e=!1;return async function(){try{let t=await fetch("/api/auth/status",{cache:"no-store"});if(!t.ok)return;let a=await t.json();e||(o(a?.displayName||a?.samlName||a?.samlEmail||a?.oidcName||a?.oidcEmail||""),m(a?.loginMethod||""))}catch{e||(o(""),m(""))}}(),()=>{e=!0}},[]);let C=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&window.location.assign("/login")}catch(e){console.error("Failed to logout:",e)}};return(0,r.jsxs)("header",{className:"shrink-0 flex items-center justify-between gap-3 px-4 lg:px-8 pt-3 pb-2 border-b border-border-subtle bg-surface/60 backdrop-blur-xl lg:bg-transparent lg:backdrop-blur-none z-20",children:[(0,r.jsx)("div",{className:"flex items-center gap-3 lg:hidden shrink-0",children:t&&(0,r.jsx)("button",{onClick:e,className:"text-text-main hover:text-primary transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined",children:"menu"})})}),(0,r.jsx)("div",{className:"flex flex-col min-w-0 flex-1",children:N.length>0?(0,r.jsx)("div",{className:"flex items-center gap-2",children:N.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[t>0&&(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-base",children:"chevron_right"}),e.href?(0,r.jsx)(l(),{href:e.href,className:"text-text-muted hover:text-primary transition-colors",children:e.label}):(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[e.image&&(0,r.jsx)(c.A,{src:e.image,alt:e.label,size:28,className:"object-contain rounded max-w-[28px] max-h-[28px]",fallbackText:e.label.slice(0,2).toUpperCase()}),(0,r.jsx)("h1",{className:"text-base lg:text-2xl font-semibold text-text-main tracking-tight truncate",children:(0,y.Tl)(e.label)})]})]},`${e.label}-${e.href||"current"}`))}):x?(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[f&&(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-xl lg:text-2xl",children:f}),(0,r.jsx)("h1",{className:"text-base lg:text-2xl font-semibold tracking-tight truncate",children:(0,y.Tl)(x)})]}),p&&(0,r.jsx)("p",{className:"hidden lg:block text-sm text-text-muted truncate",children:(0,y.Tl)(p)})]}):null}),(0,r.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[i&&("OIDC"===d||"SAML"===d)&&(0,r.jsxs)("div",{className:"hidden sm:flex items-center max-w-[220px] px-3 py-1.5 rounded-full border border-border bg-surface/70 text-xs text-text-muted truncate",title:i,children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1.5 text-primary",children:"person"}),(0,r.jsx)("span",{className:"truncate",children:i}),(0,r.jsx)("span",{className:"ml-2 shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary",children:d})]}),(0,r.jsx)(w,{}),(0,r.jsxs)("a",{href:"https://www.supportkori.com/golamrabbi",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-3 h-8 rounded-lg border border-pink-500/30 bg-pink-500/10 text-pink-600 dark:text-pink-400 hover:bg-pink-500/20 transition-colors text-sm font-medium","aria-label":"Donate",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"volunteer_activism"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Donate"})]}),(0,r.jsx)(g.default,{}),(0,r.jsx)(h,{}),(0,r.jsx)(u.default,{onLogout:C})]})]})}function w(){let e=(0,f.C)(e=>e.visible),t=(0,f.C)(e=>e.query),a=(0,f.C)(e=>e.placeholder),n=(0,f.C)(e=>e.setQuery);return e?(0,r.jsxs)("div",{className:"relative w-[160px] sm:w-[220px]",children:[(0,r.jsx)("span",{className:"material-symbols-outlined absolute left-2 top-1/2 -translate-y-1/2 text-text-muted text-[16px] pointer-events-none",children:"search"}),(0,r.jsx)("input",{type:"text",value:t,onChange:e=>n(e.target.value),placeholder:a,className:"w-full h-8 pl-7 pr-7 rounded-lg border border-border bg-surface/60 text-sm focus:outline-none focus:border-primary/50 transition-colors"}),t&&(0,r.jsx)("button",{type:"button",onClick:()=>n(""),className:"absolute right-1 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-main p-0.5 rounded","aria-label":"Clear search",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]}):null}k.propTypes={onMenuClick:d().func,showMenuButton:d().bool}},11059:(e,t,a)=>{a.d(t,{C:()=>n});var r=a(12115);function n(e=2e3){let[t,a]=(0,r.useState)(null),s=(0,r.useRef)(null);return{copied:t,copy:(0,r.useCallback)((t,r="default")=>{(async()=>{if(navigator?.clipboard?.writeText)await navigator.clipboard.writeText(t);else{let e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}})(),a(r),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{a(null)},e)},[e])}}},11910:(e,t,a)=>{a.d(t,{default:()=>s});var r=a(95155),n=a(31474);function s({label:e,type:t="text",placeholder:a,value:i,onChange:l,error:o,hint:d,icon:c,disabled:u=!1,required:m=!1,className:x,inputClassName:p,...h}){return(0,r.jsxs)("div",{className:(0,n.cn)("flex flex-col gap-1.5",x),children:[e&&(0,r.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,m&&(0,r.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,r.jsxs)("div",{className:"relative",children:[c&&(0,r.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:c})}),(0,r.jsx)("input",{type:t,placeholder:a,value:i,onChange:l,disabled:u,className:(0,n.cn)("w-full py-2.5 px-3 text-sm text-text-main bg-surface-2 rounded-[10px]","border border-transparent placeholder-text-muted/70","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 ease-out disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",c&&"pl-10",o&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",p),...h})]}),o&&(0,r.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,r.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},21931:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(95155),n=a(12115),s=a(47650),i=a(93308),l=a(73006);let o=e=>({en:{name:"English",flag:"\uD83C\uDDFA\uD83C\uDDF8"},vi:{name:"Tiếng Việt",flag:"\uD83C\uDDFB\uD83C\uDDF3"},"zh-CN":{name:"简体中文",flag:"\uD83C\uDDE8\uD83C\uDDF3"},"zh-TW":{name:"繁體中文",flag:"\uD83C\uDDF9\uD83C\uDDFC"},ja:{name:"日本語",flag:"\uD83C\uDDEF\uD83C\uDDF5"},"pt-BR":{name:"Portugu\xeas (Brasil)",flag:"\uD83C\uDDE7\uD83C\uDDF7"},"pt-PT":{name:"Portugu\xeas (Portugal)",flag:"\uD83C\uDDF5\uD83C\uDDF9"},ko:{name:"한국어",flag:"\uD83C\uDDF0\uD83C\uDDF7"},es:{name:"Espa\xf1ol",flag:"\uD83C\uDDEA\uD83C\uDDF8"},de:{name:"Deutsch",flag:"\uD83C\uDDE9\uD83C\uDDEA"},fr:{name:"Fran\xe7ais",flag:"\uD83C\uDDEB\uD83C\uDDF7"},he:{name:"עברית",flag:"\uD83C\uDDEE\uD83C\uDDF1"},ar:{name:"العربية",flag:"\uD83C\uDDF8\uD83C\uDDE6"},ru:{name:"Русский",flag:"\uD83C\uDDF7\uD83C\uDDFA"},pl:{name:"Polski",flag:"\uD83C\uDDF5\uD83C\uDDF1"},cs:{name:"Čeština",flag:"\uD83C\uDDE8\uD83C\uDDFF"},nl:{name:"Nederlands",flag:"\uD83C\uDDF3\uD83C\uDDF1"},tr:{name:"T\xfcrk\xe7e",flag:"\uD83C\uDDF9\uD83C\uDDF7"},uk:{name:"Українська",flag:"\uD83C\uDDFA\uD83C\uDDE6"},tl:{name:"Tagalog",flag:"\uD83C\uDDF5\uD83C\uDDED"},id:{name:"Indonesia",flag:"\uD83C\uDDEE\uD83C\uDDE9"},th:{name:"ไทย",flag:"\uD83C\uDDF9\uD83C\uDDED"},km:{name:"ខ្មែរ",flag:"\uD83C\uDDF0\uD83C\uDDED"},hi:{name:"हिन्दी",flag:"\uD83C\uDDEE\uD83C\uDDF3"},bn:{name:"বাংলা",flag:"\uD83C\uDDE7\uD83C\uDDE9"},ur:{name:"اردو",flag:"\uD83C\uDDF5\uD83C\uDDF0"},ro:{name:"Rom\xe2nă",flag:"\uD83C\uDDF7\uD83C\uDDF4"},sv:{name:"Svenska",flag:"\uD83C\uDDF8\uD83C\uDDEA"},it:{name:"Italiano",flag:"\uD83C\uDDEE\uD83C\uDDF9"},el:{name:"Ελληνικά",flag:"\uD83C\uDDEC\uD83C\uDDF7"},hu:{name:"Magyar",flag:"\uD83C\uDDED\uD83C\uDDFA"},fi:{name:"Suomi",flag:"\uD83C\uDDEB\uD83C\uDDEE"},da:{name:"Dansk",flag:"\uD83C\uDDE9\uD83C\uDDF0"},no:{name:"Norsk",flag:"\uD83C\uDDF3\uD83C\uDDF4"},fa:{name:"فارسی",flag:"\uD83C\uDDEE\uD83C\uDDF7"}})[e]||{name:e,flag:"\uD83C\uDF10"};function d({className:e="",isOpen:t,onClose:a,hideTrigger:c=!1}){let[u,m]=(0,n.useState)("en"),[x,p]=(0,n.useState)(!1),[h,g]=(0,n.useState)(!1),f=(0,n.useRef)(null),b="boolean"==typeof t,v=b?t:h,j=(e,t=u)=>{b?!e&&a&&a(t):g(e)};(0,n.useEffect)(()=>{m(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${i.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,i.QC)(t)}())},[]),(0,n.useEffect)(()=>{function e(e){f.current&&!f.current.contains(e.target)&&j(!1)}if(v)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[v]);let y=async e=>{if(e!==u&&!x){p(!0);try{await fetch("/api/locale",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:e})}),await (0,l.wn)(),m(e),j(!1,e)}catch(e){console.error("Failed to set locale:",e)}finally{p(!1)}}};return(0,r.jsxs)("div",{className:e,children:[!c&&(0,r.jsxs)("button",{onClick:()=>j(!v),disabled:x,className:"flex items-center gap-2 px-3 py-2 rounded-lg text-text-muted hover:text-text-main hover:bg-surface/60 transition-colors",title:"Language","data-i18n-skip":"true",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"language"}),(0,r.jsx)("span",{className:"text-sm font-medium",children:o(u).name}),(0,r.jsx)("span",{className:"text-lg",children:o(u).flag})]}),v&&(0,s.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4","data-i18n-skip":"true",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:()=>j(!1)}),(0,r.jsxs)("div",{ref:f,className:"relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-2xl flex flex-col max-h-[80vh]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Select Language"}),(0,r.jsx)("button",{onClick:()=>j(!1),className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":"Close",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,r.jsx)("div",{className:"p-6 overflow-y-auto flex-1",children:(0,r.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(100px,1fr))] gap-2",children:i.YZ.map(e=>{let t=u===e,a=o(e);return(0,r.jsxs)("button",{onClick:()=>y(e),disabled:x,className:`flex flex-col items-center justify-start gap-1 px-2 py-3 rounded-lg text-xs font-medium transition-colors w-full ${t?"bg-primary/15 text-primary ring-2 ring-primary":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"} ${x?"opacity-70 cursor-wait":""}`,title:a.name,children:[(0,r.jsx)("span",{className:"text-2xl",children:a.flag}),(0,r.jsx)("span",{className:"text-center leading-tight line-clamp-2 h-8 flex items-center",children:a.name}),t&&(0,r.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check"})]},e)})})})]})]}),document.body)]})}},23615:(e,t,a)=>{a.d(t,{default:()=>i});var r=a(95155),n=a(12115),s=a(84588);function i(){let[e,t]=(0,n.useState)([]),[a,i]=(0,n.useState)(!0),[l,o]=(0,n.useState)(!0);(0,n.useEffect)(()=>{d()},[]),(0,n.useEffect)(()=>{let e;return l&&(e=setInterval(()=>{d(!1)},3e3)),()=>clearInterval(e)},[l]);let d=async(e=!0)=>{e&&i(!0);try{let e=await fetch("/api/usage/request-logs");if(e.ok){let a=await e.json();t(a)}}catch(e){console.error("Failed to fetch logs:",e)}finally{e&&i(!1)}};return(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"Request Logs"}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsxs)("label",{className:"text-sm font-medium text-text-muted flex items-center gap-2 cursor-pointer",children:[(0,r.jsx)("span",{children:"Auto Refresh (3s)"}),(0,r.jsx)("div",{onClick:()=>o(!l),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none ${l?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,r.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${l?"translate-x-5":"translate-x-1"}`})})]})})]}),(0,r.jsx)(s.default,{className:"overflow-hidden bg-black/5 dark:bg-black/20",children:(0,r.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:a&&0===e.length?(0,r.jsx)("div",{className:"p-8 text-center text-text-muted",children:"Loading logs..."}):0===e.length?(0,r.jsx)("div",{className:"p-8 text-center text-text-muted",children:"No logs recorded yet."}):(0,r.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,r.jsx)("thead",{className:"sticky top-0 bg-bg-subtle border-b border-border z-10",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"DateTime"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Model"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Provider"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Account"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"In"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Out"}),(0,r.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,r.jsx)("tbody",{className:"divide-y divide-border/50",children:e.map((e,t)=>{let a=e.split(" | ");if(a.length<7)return null;let n=a[6],s=n.includes("PENDING"),i=n.includes("FAILED"),l=n.includes("OK");return(0,r.jsxs)("tr",{className:`hover:bg-primary/5 transition-colors ${s?"bg-primary/5":""}`,children:[(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-text-muted",children:a[0]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border font-medium",children:a[1]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border",children:(0,r.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-bg-subtle border border-border text-[10px] uppercase font-bold",children:a[2]})}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border truncate max-w-[150px]",title:a[3],children:a[3]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-primary",children:a[4]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-success",children:a[5]}),(0,r.jsx)("td",{className:`px-3 py-1.5 font-bold ${l?"text-success":i?"text-error":"text-primary animate-pulse"}`,children:n})]},t)})})]})})}),(0,r.jsx)("div",{className:"text-[10px] text-text-muted italic",children:"Logs are loaded from the request history database."})]})}},23936:(e,t,a)=>{a.d(t,{default:()=>o});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497);function o({isOpen:e,onSuccess:t,onClose:a}){let[s,i]=(0,n.useState)(""),[d,c]=(0,n.useState)(!1),[u,m]=(0,n.useState)(null),[x,p]=(0,n.useState)(!1),h=async()=>{if(!s.trim())return void m("Please paste your cookie");c(!0),m(null);try{let e=await fetch("/api/oauth/iflow/cookie",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:s.trim()})}),a=await e.json();if(!e.ok)throw Error(a.error||"Authentication failed");p(!0),setTimeout(()=>{t?.(),g()},1500)}catch(e){m(e.message)}finally{c(!1)}},g=()=>{i(""),m(null),p(!1),a?.()};return(0,r.jsx)(l.aF,{isOpen:e,onClose:g,title:"iFlow Cookie Authentication",children:(0,r.jsx)("div",{className:"space-y-4",children:x?(0,r.jsxs)("div",{className:"text-center py-8",children:[(0,r.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,r.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,r.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,r.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,r.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,r.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,r.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,r.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,r.jsx)("li",{children:"Login to your account"}),(0,r.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,r.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,r.jsx)("li",{children:"Paste it below"})]})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,r.jsx)("textarea",{value:s,onChange:e=>i(e.target.value),placeholder:"BXAuth=xxx; ...",className:"w-full px-3 py-2 bg-surface-secondary border border-border rounded-lg text-sm text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-primary resize-none",rows:4,disabled:d})]}),u&&(0,r.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,r.jsx)("p",{className:"text-sm text-error",children:u})}),(0,r.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,r.jsx)(l.$n,{variant:"secondary",onClick:g,disabled:d,fullWidth:!0,children:"Cancel"}),(0,r.jsx)(l.$n,{onClick:h,loading:d,fullWidth:!0,children:"Authenticate"})]})]})})})}o.propTypes={isOpen:i().bool.isRequired,onSuccess:i().func,onClose:i().func}},25086:(e,t,a)=>{a.d(t,{CardSkeleton:()=>o,PageLoading:()=>i,Skeleton:()=>l,Spinner:()=>s,default:()=>d});var r=a(95155),n=a(31474);function s({size:e="md",className:t}){return(0,r.jsx)("span",{className:(0,n.cn)("material-symbols-outlined animate-spin text-brand-500",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[e],t),children:"progress_activity"})}function i({message:e="Loading..."}){return(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,r.jsx)(s,{size:"xl"}),(0,r.jsx)("p",{className:"mt-4 text-text-muted",children:e})]})}function l({className:e,...t}){return(0,r.jsx)("div",{className:(0,n.cn)("animate-pulse rounded-[10px] bg-surface-2",e),...t})}function o(){return(0,r.jsxs)("div",{className:"p-6 rounded-[14px] border border-border-subtle bg-surface shadow-[var(--shadow-soft)]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)(l,{className:"h-4 w-24"}),(0,r.jsx)(l,{className:"size-10 rounded-[10px]"})]}),(0,r.jsx)(l,{className:"h-8 w-16 mb-2"}),(0,r.jsx)(l,{className:"h-3 w-20"})]})}function d({type:e="spinner",...t}){switch(e){case"page":return(0,r.jsx)(i,{...t});case"skeleton":return(0,r.jsx)(l,{...t});case"card":return(0,r.jsx)(o,{...t});default:return(0,r.jsx)(s,{...t})}}},28058:(e,t,a)=>{a.d(t,{default:()=>i});var r=a(95155),n=a(12115),s=a(81127);function i({isOpen:e,onClose:t,onAdd:a,addedNames:l=[]}){let[o,d]=(0,n.useState)([]),[c,u]=(0,n.useState)(!1),[m,x]=(0,n.useState)(""),[p,h]=(0,n.useState)("all"),[g,f]=(0,n.useState)(null),[b,v]=(0,n.useState)(null),[j,y]=(0,n.useState)({}),[k,w]=(0,n.useState)({}),[N,C]=(0,n.useState)({});(0,n.useEffect)(()=>{!e||o.length>0||(u(!0),fetch("/api/cli-tools/cowork-mcp-registry").then(e=>e.json()).then(e=>{e.error?f(e.error):d(e.servers||[])}).catch(e=>f(e.message)).finally(()=>u(!1)))},[e]);let S=(0,n.useMemo)(()=>new Set(l),[l]),O=(0,n.useMemo)(()=>{let e=m.trim().toLowerCase();return o.filter(t=>("authless"!==p||!t.oauth)&&("oauth"!==p||!!t.oauth)&&(!e||(t.title||"").toLowerCase().includes(e)||(t.description||"").toLowerCase().includes(e)||(t.name||"").toLowerCase().includes(e)))},[o,m,p]),F=async e=>{if(!j[e.url]){w(t=>({...t,[e.url]:!0}));try{let t=await fetch("/api/cli-tools/cowork-mcp-tools",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e.url})}),a=await t.json(),r=a.tools||[],n=Array.isArray(e.toolNames)?e.toolNames:[],s=r.length>0?r.map(e=>e.name):n;y(t=>({...t,[e.url]:{tools:r,requiresAuth:!!a.requiresAuth,error:a.error}})),C(t=>({...t,[e.url]:Object.fromEntries(s.map(e=>[e,!0]))}))}catch(t){y(a=>({...a,[e.url]:{tools:[],error:t.message}}))}finally{w(t=>({...t,[e.url]:!1}))}}},I=(e,t)=>{let a=N[e]||{};C(r=>({...r,[e]:Object.fromEntries(Object.keys(a).map(e=>[e,t]))}))};return(0,r.jsx)(s.default,{isOpen:e,onClose:t,title:"Browse MCP Marketplace",size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("input",{type:"text",value:m,onChange:e=>x(e.target.value),placeholder:"Search by name or description...",className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,r.jsxs)("select",{value:p,onChange:e=>h(e.target.value),className:"px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:[(0,r.jsx)("option",{value:"all",children:"All"}),(0,r.jsx)("option",{value:"authless",children:"Authless"}),(0,r.jsx)("option",{value:"oauth",children:"OAuth"})]})]}),g&&(0,r.jsx)("div",{className:"px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:g}),c&&(0,r.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-xs py-4 justify-center",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}),(0,r.jsx)("span",{children:"Loading registry..."})]}),!c&&(0,r.jsxs)("div",{className:"flex flex-col gap-1 max-h-[60vh] overflow-y-auto",children:[0===O.length&&(0,r.jsx)("div",{className:"text-center text-xs text-text-muted py-6",children:"No servers match filter"}),O.map(e=>{let t=S.has(e.slug||e.name),n=b===e.url,s=j[e.url],i=k[e.url],l=N[e.url]||{},o=Object.keys(l),d=Object.values(l).filter(Boolean).length;return(0,r.jsxs)("div",{className:"rounded border border-transparent hover:border-border",children:[(0,r.jsxs)("div",{className:"flex items-start gap-2 px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5",children:[e.iconUrl?(0,r.jsx)("img",{src:e.iconUrl,alt:"",className:"size-7 rounded shrink-0 object-contain",onError:e=>{e.target.style.display="none"},loading:"lazy",decoding:"async"}):(0,r.jsx)("div",{className:"size-7 rounded bg-surface shrink-0"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,r.jsx)("span",{className:"font-medium text-xs",children:e.title}),e.oauth?(0,r.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-amber-500/10 text-amber-600",children:"OAuth"}):(0,r.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-green-500/10 text-green-600",children:"Authless"}),e.toolCount>0&&(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:[e.toolCount," tools"]})]}),e.description&&(0,r.jsx)("p",{className:"text-[10px] text-text-muted line-clamp-2 mt-0.5",children:e.description})]}),(0,r.jsx)("button",{onClick:()=>t?null:void(b===e.url?v(null):(v(e.url),F(e))),disabled:t,className:`shrink-0 px-2 py-1 rounded text-[10px] font-medium transition-colors ${t?"bg-green-500/10 text-green-600 cursor-default":n?"bg-surface border border-border text-text-muted hover:bg-black/5":"bg-primary/10 border border-primary/40 text-primary hover:bg-primary/20"}`,children:t?"Added":n?"Cancel":"+ Add"})]}),n&&(0,r.jsxs)("div",{className:"px-3 py-2 bg-surface/40 border-t border-border flex flex-col gap-2",children:[i&&(0,r.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-[10px] py-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin text-[14px]",children:"progress_activity"}),(0,r.jsx)("span",{children:"Probing server for tools..."})]}),!i&&s?.requiresAuth&&(0,r.jsx)("p",{className:"text-[10px] text-amber-600 bg-amber-500/10 px-2 py-1 rounded",children:"\uD83D\uDD10 OAuth required. Add now and authenticate after Apply; tool list will be discovered after first connect."}),!i&&s?.error&&!s?.requiresAuth&&(0,r.jsxs)("p",{className:"text-[10px] text-red-600 bg-red-500/10 px-2 py-1 rounded",children:["Probe failed: ",s.error]}),!i&&0===o.length&&!s?.requiresAuth&&!s?.error&&(0,r.jsx)("p",{className:"text-[10px] text-text-muted",children:"No tools advertised by server."}),!i&&o.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:[d,"/",o.length," tools enabled"]}),(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)("button",{onClick:()=>I(e.url,!0),className:"text-[10px] text-primary hover:underline",children:"All"}),(0,r.jsx)("span",{className:"text-[10px] text-text-muted",children:"\xb7"}),(0,r.jsx)("button",{onClick:()=>I(e.url,!1),className:"text-[10px] text-primary hover:underline",children:"None"})]})]}),(0,r.jsx)("div",{className:"grid grid-cols-2 gap-1 max-h-40 overflow-y-auto",children:o.map(t=>(0,r.jsxs)("label",{className:"flex items-center gap-1.5 text-[10px] cursor-pointer hover:bg-black/5 dark:hover:bg-white/5 px-1 rounded",children:[(0,r.jsx)("input",{type:"checkbox",checked:!!l[t],onChange:()=>{var a;return a=e.url,void C(e=>({...e,[a]:{...e[a],[t]:!e[a]?.[t]}}))},className:"size-3"}),(0,r.jsx)("span",{className:"truncate",children:t})]},t))})]}),(0,r.jsx)("button",{onClick:()=>{let t,r;return r=Object.keys(t=N[e.url]||{}).filter(e=>t[e]),void(a?.({name:e.slug||e.name,title:e.title,description:e.description,url:e.url,transport:e.transport,oauth:e.oauth,toolNames:r}),v(null))},className:"self-end px-2 py-1 rounded text-[10px] font-medium bg-primary text-white hover:bg-primary/90",children:"✓ Confirm Add"})]})]},e.url)})]}),(0,r.jsxs)("div",{className:"text-[10px] text-text-muted text-right",children:[O.length," of ",o.length," servers"]})]})})}},28067:(e,t,a)=>{a.d(t,{default:()=>s});var r=a(95155),n=a(31474);function s({options:e=[],value:t,onChange:a,size:i="md",className:l}){let o={sm:"h-7 text-xs",md:"h-9 text-sm",lg:"h-11 text-base"};return(0,r.jsx)("div",{className:(0,n.cn)("inline-flex items-center p-1 rounded-[10px] overflow-x-auto","bg-surface-2",l),children:e.map(e=>(0,r.jsxs)("button",{onClick:()=>a(e.value),className:(0,n.cn)("shrink-0 px-4 rounded-[8px] font-medium transition-all",o[i],t===e.value?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[e.icon&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px] mr-1.5",children:e.icon}),e.label]},e.value))})}},28697:(e,t,a)=>{a.d(t,{default:()=>m});var r=a(95155),n=a(12115),s=a(81127),i=a(92542),l=a(11910),o=a(28067),d=a(29366),c=a(929),u=a(11059);function m({isOpen:e,combo:t,onClose:a,strategy:x={}}){let[p,h]=(0,n.useState)(!1),[g,f]=(0,n.useState)("Halo, berikan respon singkat."),[b,v]=(0,n.useState)("fallback"),[j,y]=(0,n.useState)(null),[k,w]=(0,n.useState)(""),{getCaps:N}=(0,c.y)(),{copied:C,copy:S}=(0,u.C)(),O=x.fallbackStrategy||"fallback";if((0,n.useEffect)(()=>{e&&(y(null),w(""))},[e,t]),!t)return null;let F=async()=>{h(!0),w(""),y(null);try{let e=t.id?`/api/combos/${t.id}/test`:"/api/combos/test",a=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t.name,models:t.models,kind:t.kind||"llm",prompt:g.trim()||"Halo, berikan respon singkat.",mode:b})}),r=await a.json();a.ok?y(r):w(r.error||"Failed to execute combo test")}catch(e){console.error("Error testing combo:",e),w("Network or server error during combo test")}finally{h(!1)}},I=j?.steps?.filter(e=>e.fallbackTriggered).length||0;return(0,r.jsx)(s.default,{isOpen:e,onClose:a,title:`Test Combo: ${t.name}`,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"rounded-lg border border-border-subtle bg-surface-2 p-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-lg",children:"layers"}),(0,r.jsx)("code",{className:"font-mono text-sm font-semibold text-text-main",children:t.name}),(0,r.jsxs)("span",{className:"rounded bg-primary/10 px-2 py-0.5 text-[11px] font-medium text-primary capitalize",children:["Strategy: ",O]})]}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:[t.models?.length||0," model(s) in fallback sequence"]})]}),(0,r.jsx)("div",{className:"flex min-w-0 items-center gap-1.5 overflow-x-auto py-1 custom-scrollbar text-xs",children:t.models?.map((e,a)=>(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1 rounded bg-surface border border-border-subtle px-2 py-1 font-mono text-[11px] text-text-main shadow-xs",children:[(0,r.jsxs)("span",{className:"text-[10px] text-text-muted font-bold",children:["#",a+1]}),(0,r.jsx)("span",{className:"truncate max-w-[140px]",children:e}),(0,r.jsx)(d.default,{caps:N?.(e)})]}),a<t.models.length-1&&(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"})]},a))})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 items-end",children:[(0,r.jsx)("div",{className:"sm:col-span-2",children:(0,r.jsx)(l.default,{label:"Test Prompt",value:g,onChange:e=>f(e.target.value),placeholder:"Enter test prompt...",disabled:p})}),(0,r.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,r.jsx)("label",{className:"text-xs font-medium text-text-muted",children:"Execution Mode"}),(0,r.jsx)(o.default,{options:[{value:"fallback",label:"Fallback Mode (Real Request)"},{value:"all",label:"Full Diagnostic (All Models)"}],value:b,onChange:v,disabled:p})]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between pt-1",children:[(0,r.jsx)("p",{className:"text-[11px] text-text-muted",children:"fallback"===b?"Evaluates models in order until one succeeds (simulates real client hit).":"Tests every model in order to verify individual model availability."}),(0,r.jsx)(i.default,{onClick:F,loading:p,disabled:p||!t.models?.length,icon:"play_arrow",size:"sm",children:p?"Running Combo Test...":"Run Test"})]}),k&&(0,r.jsxs)("div",{className:"rounded-lg bg-red-500/10 border border-red-500/20 p-3 text-xs text-red-500 flex items-start gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-lg shrink-0",children:"error"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"font-semibold mb-0.5",children:"Test Error"}),(0,r.jsx)("p",{children:k})]})]}),p&&(0,r.jsxs)("div",{className:"py-8 flex flex-col items-center justify-center gap-3 border border-dashed border-border-subtle rounded-lg bg-surface-2/50",children:[(0,r.jsx)("div",{className:"size-8 rounded-full border-2 border-primary border-t-transparent animate-spin"}),(0,r.jsx)("p",{className:"text-xs font-medium text-text-main animate-pulse",children:"Testing hit to combo models based on sequence..."}),(0,r.jsx)("p",{className:"text-[11px] text-text-muted",children:"Simulating fallbacks if upstream models return errors."})]}),j&&!p&&(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsx)("div",{className:`rounded-lg p-3.5 border ${"success"===j.comboStatus?"bg-emerald-500/10 border-emerald-500/30 text-emerald-600 dark:text-emerald-400":"bg-red-500/10 border-red-500/30 text-red-600 dark:text-red-400"}`,children:(0,r.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-xl",children:"success"===j.comboStatus?"check_circle":"cancel"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"text-sm font-semibold leading-snug",children:"success"===j.comboStatus?"Combo Test Succeeded":"Combo Test Failed"}),(0,r.jsx)("p",{className:"text-xs opacity-90",children:"success"===j.comboStatus?`Served by model #${j.servedStepIndex}: ${j.servingModel}`:"All models in combo failed to respond"})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 text-xs font-medium",children:[I>0&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 rounded bg-amber-500/20 px-2 py-0.5 text-amber-700 dark:text-amber-300",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"swap_calls"}),I," Fallback",I>1?"s":""]}),(0,r.jsxs)("span",{className:"rounded bg-black/10 dark:bg-white/10 px-2 py-0.5",children:["Total: ",j.totalLatencyMs,"ms"]})]})]})}),(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("span",{className:"text-xs font-medium text-text-muted",children:["Fallback Execution Sequence (",j.steps?.length||0," steps)"]}),(0,r.jsxs)("button",{onClick:()=>S((()=>{if(!j)return"";let e=`Combo Test: ${j.comboName}
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5497],{98:(e,t,a)=>{a.d(t,{default:()=>s});var r=a(95155),n=a(31474);function s({label:e,options:t=[],value:a,onChange:i,placeholder:l="Select an option",error:o,hint:d,disabled:c=!1,required:u=!1,className:m,selectClassName:x,...p}){return(0,r.jsxs)("div",{className:(0,n.cn)("flex flex-col gap-1.5",m),children:[e&&(0,r.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,u&&(0,r.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)("select",{value:a,onChange:i,disabled:c,className:(0,n.cn)("w-full py-2.5 px-3 pr-10 text-sm text-text-main","bg-surface-2 border border-transparent rounded-[10px] appearance-none","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",o&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",x),...p,children:[(0,r.jsx)("option",{value:"",disabled:!0,children:l}),t.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,r.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"expand_more"})})]}),o&&(0,r.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,r.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},929:(e,t,a)=>{a.d(t,{y:()=>o});var r=a(12115),n=a(57151);let s=null,i=null;function l(){return s?Promise.resolve(s):i||(i=fetch("/api/models").then(async e=>{if(!e.ok)throw Error(`models ${e.status}`);return s=function(e){let t={},a={};for(let r of e||[])r.caps&&(r.fullModel&&(t[r.fullModel]=r.caps),r.routedModel&&(t[r.routedModel]=r.caps),r.model&&(a[r.model]=r.caps));return{byFull:t,byId:a}}((await e.json()).models)}).catch(()=>({byFull:{},byId:{}})).finally(()=>{i=null}))}function o(){let[e,t]=(0,r.useState)(()=>s?.byFull||{}),[a,i]=(0,r.useState)(()=>s?.byId||{});return(0,r.useEffect)(()=>{let e=!0,a=a=>{e&&(t(a.byFull),i(a.byId))};s?a(s):l().then(a);let r=()=>{s=null,l().then(a)};return window.addEventListener("customModelChanged",r),()=>{e=!1,window.removeEventListener("customModelChanged",r)}},[]),{getCaps:(0,r.useCallback)(t=>(function(e,t,a){if(!a)return null;if(e[a])return e[a];let r=a.includes("/")?a.slice(a.indexOf("/")+1):a;if(t[r])return t[r];let s=a.includes("/")?a.slice(0,a.indexOf("/")):null,i=(0,n.nl)(s,r);return{vision:i.vision,search:i.search,reasoning:i.reasoning,contextWindow:i.contextWindow,maxOutput:i.maxOutput}})(e,a,t),[e,a])}}},1620:(e,t,a)=>{a.d(t,{D:()=>o});var r=a(12115),n=a(90085);function s(e){let t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function i(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function l(){return!1}function o(){let{theme:e,setTheme:t,toggleTheme:a,initTheme:o}=(0,n.A)(),d=(0,r.useSyncExternalStore)(s,i,l);(0,r.useEffect)(()=>{o()},[o]),(0,r.useEffect)(()=>{if("system"!==e)return;let t=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>o();return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e,o]);let c="dark"===e||"system"===e&&d;return{theme:e,setTheme:t,toggleTheme:a,isDark:c}}},2222:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497);let o="https://api.x.ai/v1/videos";function d({isOpen:e,onClose:t,onCreated:a,onSaved:s,node:i}){let c=!!i,[u,m]=(0,n.useState)({name:"",prefix:"",baseUrl:o}),[x,p]=(0,n.useState)(!1),[h,g]=(0,n.useState)(""),[f,b]=(0,n.useState)(!1),[v,j]=(0,n.useState)(null);(0,n.useEffect)(()=>{e&&(j(null),g(""),c?m({name:i.name||"",prefix:i.prefix||"",baseUrl:i.baseUrl||o}):m({name:"",prefix:"",baseUrl:o}))},[e,c,i]);let y=async()=>{if(u.name.trim()&&u.prefix.trim()&&u.baseUrl.trim()){p(!0);try{let e=c?`/api/provider-nodes/${i.id}`:"/api/provider-nodes",t=c?"PUT":"POST",r={name:u.name,prefix:u.prefix,baseUrl:u.baseUrl};c||(r.type="custom-video");let n=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),l=await n.json();n.ok&&(c?s?.(l.node):a?.(l.node))}catch(e){console.log("Error saving custom video node:",e)}finally{p(!1)}}},k=async()=>{b(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:u.baseUrl,apiKey:h,type:"custom-video"})}),t=await e.json();j(t)}catch{j({valid:!1,error:"Network error"})}finally{b(!1)}};return(0,r.jsx)(l.aF,{isOpen:e,title:c?"Edit Custom Video":"Add Custom Video",onClose:t,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(l.pd,{label:"Name",value:u.name,onChange:e=>m({...u,name:e.target.value}),placeholder:"Grok Imagine",hint:"Required. A friendly label for this video provider."}),(0,r.jsx)(l.pd,{label:"Prefix",value:u.prefix,onChange:e=>m({...u,prefix:e.target.value}),placeholder:"grok-video",hint:"Required. Used as the provider prefix for model IDs (e.g. grok-video/grok-imagine-video)."}),(0,r.jsx)(l.pd,{label:"Base URL",value:u.baseUrl,onChange:e=>m({...u,baseUrl:e.target.value}),placeholder:"https://api.x.ai/v1/videos",hint:"xAI-style async job endpoint. POST {base}/generations creates a job; GET {base}/{request_id} polls."}),(0,r.jsx)(l.pd,{label:"API Key (for Check)",type:"password",value:h,onChange:e=>g(e.target.value),hint:"Check probes the endpoint with an empty body — verifies the key is authorized without creating a billable job."}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(l.$n,{onClick:k,disabled:!h||f||!u.baseUrl.trim(),variant:"secondary",children:f?"Checking...":"Check"}),(()=>{if(!v)return null;let{valid:e,error:t}=v;return e?(0,r.jsx)(l.Ex,{variant:"success",children:"Reachable \xb7 Authorized"}):(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)(l.Ex,{variant:"error",children:"Invalid"}),t&&(0,r.jsx)("span",{className:"text-sm text-red-500",children:t})]})})()]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:y,fullWidth:!0,disabled:!u.name.trim()||!u.prefix.trim()||!u.baseUrl.trim()||x,children:x?c?"Saving...":"Creating...":c?"Save":"Create"}),(0,r.jsx)(l.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}d.propTypes={isOpen:i().bool.isRequired,onClose:i().func.isRequired,onCreated:i().func,onSaved:i().func,node:i().shape({id:i().string,name:i().string,prefix:i().string,baseUrl:i().string})}},4823:(e,t,a)=>{a.d(t,{default:()=>m});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(84588),o=a(98),d=a(56061);let c="__none__",u=[{value:"none",label:"None (single pool)"},{value:"round-robin",label:"Round-robin"},{value:"random",label:"Random"}];function m({providerId:e}){let[t,a]=(0,n.useState)([]),[s,i]=(0,n.useState)(c),[x,p]=(0,n.useState)("none"),[h,g]=(0,n.useState)(!1),[f,b]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let t=!1;return Promise.all([fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.ok?e.json():{proxyPools:[]}),fetch("/api/settings",{cache:"no-store"}).then(e=>e.ok?e.json():{})]).then(([r,n])=>{if(t)return;a(r.proxyPools||[]);let s=(n.providerStrategies||{})[e]||{};i(s.proxyPoolId||c),p(s.rotateStrategy||"none")}).catch(()=>{}),()=>{t=!0}},[e]);let v=(0,n.useCallback)(async(t,a)=>{g(!0);try{let r=await fetch("/api/settings",{cache:"no-store"}),n=(r.ok?await r.json():{}).providerStrategies||{},s={...n[e]||{}};t===c?delete s.proxyPoolId:s.proxyPoolId=t,"none"===a?delete s.rotateStrategy:s.rotateStrategy=a;let i={...n};0===Object.keys(s).length?delete i[e]:i[e]=s,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:i})}),b(!0),setTimeout(()=>b(!1),1500)}catch(e){console.log("Save proxy config error:",e)}finally{g(!1)}},[e]),j=t.length>=2,y="none"!==x;return(0,r.jsxs)(l.default,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,r.jsx)("div",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-green-500/10 text-green-500",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"lock_open"})}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"No authentication required"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"This provider is ready to use. Optionally route requests through a proxy pool to bypass IP-based limits."})]}),f&&(0,r.jsx)(d.default,{variant:"success",size:"sm",children:"Saved"})]}),(0,r.jsx)(o.default,{label:"Proxy Pool",value:s,onChange:e=>{var t;i(t=e.target.value),v(t,x)},disabled:h||y,options:[{value:c,label:"None (direct)"},...t.map(e=>({value:e.id,label:e.name}))],hint:y?"Pool selector is ignored when rotation is active — all active pools are used.":void 0}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 mt-4",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-text-main",children:"Rotation Strategy"}),(0,r.jsx)("select",{value:x,onChange:e=>{var t;p(t=e.target.value),v(s,t)},disabled:h,className:"py-2 px-3 text-sm text-text-main bg-white dark:bg-white/5 border border-black/10 dark:border-white/10 rounded-md focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none transition-all disabled:opacity-50",children:u.map(e=>(0,r.jsx)("option",{value:e.value,disabled:"none"!==e.value&&!j,children:e.label},e.value))}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:j?y?"round-robin"===x?`Rotating through all ${t.length} active pools in order. State is in-memory (resets on restart).`:`Picking a random pool from ${t.length} active pools each request.`:"Uses the selected pool above. Set to Round-robin or Random to rotate across all active pools.":"Need at least 2 active proxy pools for rotation."})]})]})}m.propTypes={providerId:i().string.isRequired}},8247:(e,t,a)=>{a.d(t,{HY:()=>i,Kw:()=>l});let r={"perplexity-agent":"perplexity","gitlab-duo":"gitlab","vercel-ai-gateway":"vercel","opencode-zen":"opencode","ollama-search":"ollama"},n=new Set;function s(e){return e&&"string"==typeof e?e.trim().toLowerCase():""}function i(e){let t=function(e){let t=s(e);if(!t||n.has(t))return"";let a=r[t]||t;return n.has(a)?"":a}(e);return t?`/providers/${t}.png`:null}function l(e){let t=s(e);t&&n.add(t);let a=r[t];a&&n.add(a)}},8823:(e,t,a)=>{a.d(t,{default:()=>k});var r=a(95155),n=a(12115),s=a(73321),i=a(98500),l=a.n(i),o=a(14051),d=a.n(o),c=a(57250),u=a(80752),m=a(93308),x=a(38202),p=a(21931);function h(){let[e,t]=(0,n.useState)(!1),[a,s]=(0,n.useState)("en");return(0,n.useEffect)(()=>{s(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${m.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,m.QC)(t)}())},[e]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{onClick:()=>t(!0),className:"flex items-center justify-center p-2 rounded-lg text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5 transition-all",title:"Language","data-i18n-skip":"true",children:(0,r.jsx)("span",{className:"text-lg leading-none",children:x.h[a]||"\uD83C\uDF10"})}),(0,r.jsx)(p.default,{hideTrigger:!0,isOpen:e,onClose:e=>{t(!1),s(e)}})]})}var g=a(38587),f=a(38003),b=a(90620),v=a(88105),j=a(8247),y=a(73006);function k({onMenuClick:e,showMenuButton:t=!0}){let a=(0,s.usePathname)(),[i,o]=(0,n.useState)(""),[d,m]=(0,n.useState)(""),{title:x,description:p,icon:f,breadcrumbs:N}=(0,n.useMemo)(()=>(e=>{if(!e)return{title:"",description:"",breadcrumbs:[]};let t=e.match(/\/media-providers\/([^/]+)\/([^/]+)$/);if(t){let e=t[1],a=t[2],r=v.rj.find(t=>t.id===e),n=v.Q2[a];return{title:n?.name||a,description:"",breadcrumbs:[{label:"Media Providers",href:`/dashboard/media-providers/${e}`},{label:r?.label||e,href:`/dashboard/media-providers/${e}`},{label:n?.name||a,image:(0,j.HY)(a)}]}}let a=e.match(/\/media-providers\/([^/]+)$/);if(a){let e=a[1],t=v.rj.find(t=>t.id===e);return{title:t?.label||e,description:`Manage your ${t?.label||e} providers`,icon:t?.icon||"perm_media",breadcrumbs:[]}}let r=e.match(/\/providers\/([^/]+)$/);if(r){let e=r[1],t=b.zN[e]||b.fg[e];if(t)return{title:t.name,description:"",breadcrumbs:[{label:"Providers",href:"/dashboard/providers"},{label:t.name,image:(0,j.HY)(t.id)}]}}return e.includes("/providers")&&!e.includes("/media-providers")?{title:"Providers",description:"Manage your AI provider connections",icon:"dns",breadcrumbs:[]}:e.includes("/combos")?{title:"Combos",description:"Model combos with fallback",icon:"layers",breadcrumbs:[]}:e.includes("/usage")?{title:"Usage & Analytics",description:"Monitor your API usage, token consumption, and request logs",icon:"bar_chart",breadcrumbs:[]}:e.includes("/auth-files")?{title:"Auth Files",description:"Map provider credentials stored in the local database",icon:"vpn_key",breadcrumbs:[]}:e.includes("/quota")?{title:"Quota Tracker",description:"Track and manage your API quota limits",icon:"data_usage",breadcrumbs:[]}:e.includes("/mitm")?{title:"MITM Proxy",description:"Intercept CLI tool traffic and route through EzRouter",icon:"security",breadcrumbs:[]}:e.includes("/token-saver")?{title:"Token Saver",description:"Compress prompts and outputs to save tokens",icon:"savings",breadcrumbs:[]}:e.includes("/cli-tools")?{title:"CLI Tools",description:"Configure CLI tools",icon:"terminal",breadcrumbs:[]}:e.includes("/proxy-pools")?{title:"Proxy Pools",description:"Manage your proxy pool configurations",icon:"lan",breadcrumbs:[]}:e.includes("/skills")?{title:"Agent Skills",description:"Copy a link and paste to your AI to use EzRouter — no install needed",icon:"extension",breadcrumbs:[]}:e.includes("/endpoint")?{title:"Endpoint",description:"API endpoint configuration",icon:"api",breadcrumbs:[]}:e.includes("/profile")?{title:"Settings",description:"Manage your preferences",icon:"settings",breadcrumbs:[]}:e.includes("/translator")?{title:"Translator",description:"Debug translation flow between formats",icon:"translate",breadcrumbs:[]}:e.includes("/console-log")?{title:"Console Log",description:"Live server console output",icon:"monitor",breadcrumbs:[]}:"/dashboard"===e?{title:"Endpoint",description:"API endpoint configuration",icon:"api",breadcrumbs:[]}:{title:"",description:"",breadcrumbs:[]}})(a),[a]);(0,n.useEffect)(()=>{let e=!1;return async function(){try{let t=await fetch("/api/auth/status",{cache:"no-store"});if(!t.ok)return;let a=await t.json();e||(o(a?.displayName||a?.samlName||a?.samlEmail||a?.oidcName||a?.oidcEmail||""),m(a?.loginMethod||""))}catch{e||(o(""),m(""))}}(),()=>{e=!0}},[]);let C=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&window.location.assign("/login")}catch(e){console.error("Failed to logout:",e)}};return(0,r.jsxs)("header",{className:"shrink-0 flex items-center justify-between gap-3 px-4 lg:px-8 pt-3 pb-2 border-b border-border-subtle bg-surface/60 backdrop-blur-xl lg:bg-transparent lg:backdrop-blur-none z-20",children:[(0,r.jsx)("div",{className:"flex items-center gap-3 lg:hidden shrink-0",children:t&&(0,r.jsx)("button",{onClick:e,className:"text-text-main hover:text-primary transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined",children:"menu"})})}),(0,r.jsx)("div",{className:"flex flex-col min-w-0 flex-1",children:N.length>0?(0,r.jsx)("div",{className:"flex items-center gap-2",children:N.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[t>0&&(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-base",children:"chevron_right"}),e.href?(0,r.jsx)(l(),{href:e.href,className:"text-text-muted hover:text-primary transition-colors",children:e.label}):(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[e.image&&(0,r.jsx)(c.A,{src:e.image,alt:e.label,size:28,className:"object-contain rounded max-w-[28px] max-h-[28px]",fallbackText:e.label.slice(0,2).toUpperCase()}),(0,r.jsx)("h1",{className:"text-base lg:text-2xl font-semibold text-text-main tracking-tight truncate",children:(0,y.Tl)(e.label)})]})]},`${e.label}-${e.href||"current"}`))}):x?(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[f&&(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-xl lg:text-2xl",children:f}),(0,r.jsx)("h1",{className:"text-base lg:text-2xl font-semibold tracking-tight truncate",children:(0,y.Tl)(x)})]}),p&&(0,r.jsx)("p",{className:"hidden lg:block text-sm text-text-muted truncate",children:(0,y.Tl)(p)})]}):null}),(0,r.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[i&&("OIDC"===d||"SAML"===d)&&(0,r.jsxs)("div",{className:"hidden sm:flex items-center max-w-[220px] px-3 py-1.5 rounded-full border border-border bg-surface/70 text-xs text-text-muted truncate",title:i,children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1.5 text-primary",children:"person"}),(0,r.jsx)("span",{className:"truncate",children:i}),(0,r.jsx)("span",{className:"ml-2 shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary",children:d})]}),(0,r.jsx)(w,{}),(0,r.jsxs)("a",{href:"https://www.supportkori.com/golamrabbi",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-3 h-8 rounded-lg border border-pink-500/30 bg-pink-500/10 text-pink-600 dark:text-pink-400 hover:bg-pink-500/20 transition-colors text-sm font-medium","aria-label":"Donate",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"volunteer_activism"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Donate"})]}),(0,r.jsx)(g.default,{}),(0,r.jsx)(h,{}),(0,r.jsx)(u.default,{onLogout:C})]})]})}function w(){let e=(0,f.C)(e=>e.visible),t=(0,f.C)(e=>e.query),a=(0,f.C)(e=>e.placeholder),n=(0,f.C)(e=>e.setQuery);return e?(0,r.jsxs)("div",{className:"relative w-[160px] sm:w-[220px]",children:[(0,r.jsx)("span",{className:"material-symbols-outlined absolute left-2 top-1/2 -translate-y-1/2 text-text-muted text-[16px] pointer-events-none",children:"search"}),(0,r.jsx)("input",{type:"text",value:t,onChange:e=>n(e.target.value),placeholder:a,className:"w-full h-8 pl-7 pr-7 rounded-lg border border-border bg-surface/60 text-sm focus:outline-none focus:border-primary/50 transition-colors"}),t&&(0,r.jsx)("button",{type:"button",onClick:()=>n(""),className:"absolute right-1 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-main p-0.5 rounded","aria-label":"Clear search",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]}):null}k.propTypes={onMenuClick:d().func,showMenuButton:d().bool}},11059:(e,t,a)=>{a.d(t,{C:()=>n});var r=a(12115);function n(e=2e3){let[t,a]=(0,r.useState)(null),s=(0,r.useRef)(null);return{copied:t,copy:(0,r.useCallback)((t,r="default")=>{(async()=>{if(navigator?.clipboard?.writeText)await navigator.clipboard.writeText(t);else{let e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}})(),a(r),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{a(null)},e)},[e])}}},11910:(e,t,a)=>{a.d(t,{default:()=>s});var r=a(95155),n=a(31474);function s({label:e,type:t="text",placeholder:a,value:i,onChange:l,error:o,hint:d,icon:c,disabled:u=!1,required:m=!1,className:x,inputClassName:p,...h}){return(0,r.jsxs)("div",{className:(0,n.cn)("flex flex-col gap-1.5",x),children:[e&&(0,r.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,m&&(0,r.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,r.jsxs)("div",{className:"relative",children:[c&&(0,r.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:c})}),(0,r.jsx)("input",{type:t,placeholder:a,value:i,onChange:l,disabled:u,className:(0,n.cn)("w-full py-2.5 px-3 text-sm text-text-main bg-surface-2 rounded-[10px]","border border-transparent placeholder-text-muted/70","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 ease-out disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",c&&"pl-10",o&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",p),...h})]}),o&&(0,r.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,r.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},21931:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(95155),n=a(12115),s=a(47650),i=a(93308),l=a(73006);let o=e=>({en:{name:"English",flag:"\uD83C\uDDFA\uD83C\uDDF8"},vi:{name:"Tiếng Việt",flag:"\uD83C\uDDFB\uD83C\uDDF3"},"zh-CN":{name:"简体中文",flag:"\uD83C\uDDE8\uD83C\uDDF3"},"zh-TW":{name:"繁體中文",flag:"\uD83C\uDDF9\uD83C\uDDFC"},ja:{name:"日本語",flag:"\uD83C\uDDEF\uD83C\uDDF5"},"pt-BR":{name:"Portugu\xeas (Brasil)",flag:"\uD83C\uDDE7\uD83C\uDDF7"},"pt-PT":{name:"Portugu\xeas (Portugal)",flag:"\uD83C\uDDF5\uD83C\uDDF9"},ko:{name:"한국어",flag:"\uD83C\uDDF0\uD83C\uDDF7"},es:{name:"Espa\xf1ol",flag:"\uD83C\uDDEA\uD83C\uDDF8"},de:{name:"Deutsch",flag:"\uD83C\uDDE9\uD83C\uDDEA"},fr:{name:"Fran\xe7ais",flag:"\uD83C\uDDEB\uD83C\uDDF7"},he:{name:"עברית",flag:"\uD83C\uDDEE\uD83C\uDDF1"},ar:{name:"العربية",flag:"\uD83C\uDDF8\uD83C\uDDE6"},ru:{name:"Русский",flag:"\uD83C\uDDF7\uD83C\uDDFA"},pl:{name:"Polski",flag:"\uD83C\uDDF5\uD83C\uDDF1"},cs:{name:"Čeština",flag:"\uD83C\uDDE8\uD83C\uDDFF"},nl:{name:"Nederlands",flag:"\uD83C\uDDF3\uD83C\uDDF1"},tr:{name:"T\xfcrk\xe7e",flag:"\uD83C\uDDF9\uD83C\uDDF7"},uk:{name:"Українська",flag:"\uD83C\uDDFA\uD83C\uDDE6"},tl:{name:"Tagalog",flag:"\uD83C\uDDF5\uD83C\uDDED"},id:{name:"Indonesia",flag:"\uD83C\uDDEE\uD83C\uDDE9"},th:{name:"ไทย",flag:"\uD83C\uDDF9\uD83C\uDDED"},km:{name:"ខ្មែរ",flag:"\uD83C\uDDF0\uD83C\uDDED"},hi:{name:"हिन्दी",flag:"\uD83C\uDDEE\uD83C\uDDF3"},bn:{name:"বাংলা",flag:"\uD83C\uDDE7\uD83C\uDDE9"},ur:{name:"اردو",flag:"\uD83C\uDDF5\uD83C\uDDF0"},ro:{name:"Rom\xe2nă",flag:"\uD83C\uDDF7\uD83C\uDDF4"},sv:{name:"Svenska",flag:"\uD83C\uDDF8\uD83C\uDDEA"},it:{name:"Italiano",flag:"\uD83C\uDDEE\uD83C\uDDF9"},el:{name:"Ελληνικά",flag:"\uD83C\uDDEC\uD83C\uDDF7"},hu:{name:"Magyar",flag:"\uD83C\uDDED\uD83C\uDDFA"},fi:{name:"Suomi",flag:"\uD83C\uDDEB\uD83C\uDDEE"},da:{name:"Dansk",flag:"\uD83C\uDDE9\uD83C\uDDF0"},no:{name:"Norsk",flag:"\uD83C\uDDF3\uD83C\uDDF4"},fa:{name:"فارسی",flag:"\uD83C\uDDEE\uD83C\uDDF7"}})[e]||{name:e,flag:"\uD83C\uDF10"};function d({className:e="",isOpen:t,onClose:a,hideTrigger:c=!1}){let[u,m]=(0,n.useState)("en"),[x,p]=(0,n.useState)(!1),[h,g]=(0,n.useState)(!1),f=(0,n.useRef)(null),b="boolean"==typeof t,v=b?t:h,j=(e,t=u)=>{b?!e&&a&&a(t):g(e)};(0,n.useEffect)(()=>{m(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${i.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,i.QC)(t)}())},[]),(0,n.useEffect)(()=>{function e(e){f.current&&!f.current.contains(e.target)&&j(!1)}if(v)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[v]);let y=async e=>{if(e!==u&&!x){p(!0);try{await fetch("/api/locale",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:e})}),await (0,l.wn)(),m(e),j(!1,e)}catch(e){console.error("Failed to set locale:",e)}finally{p(!1)}}};return(0,r.jsxs)("div",{className:e,children:[!c&&(0,r.jsxs)("button",{onClick:()=>j(!v),disabled:x,className:"flex items-center gap-2 px-3 py-2 rounded-lg text-text-muted hover:text-text-main hover:bg-surface/60 transition-colors",title:"Language","data-i18n-skip":"true",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"language"}),(0,r.jsx)("span",{className:"text-sm font-medium",children:o(u).name}),(0,r.jsx)("span",{className:"text-lg",children:o(u).flag})]}),v&&(0,s.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4","data-i18n-skip":"true",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:()=>j(!1)}),(0,r.jsxs)("div",{ref:f,className:"relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-2xl flex flex-col max-h-[80vh]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Select Language"}),(0,r.jsx)("button",{onClick:()=>j(!1),className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":"Close",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,r.jsx)("div",{className:"p-6 overflow-y-auto flex-1",children:(0,r.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(100px,1fr))] gap-2",children:i.YZ.map(e=>{let t=u===e,a=o(e);return(0,r.jsxs)("button",{onClick:()=>y(e),disabled:x,className:`flex flex-col items-center justify-start gap-1 px-2 py-3 rounded-lg text-xs font-medium transition-colors w-full ${t?"bg-primary/15 text-primary ring-2 ring-primary":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"} ${x?"opacity-70 cursor-wait":""}`,title:a.name,children:[(0,r.jsx)("span",{className:"text-2xl",children:a.flag}),(0,r.jsx)("span",{className:"text-center leading-tight line-clamp-2 h-8 flex items-center",children:a.name}),t&&(0,r.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check"})]},e)})})})]})]}),document.body)]})}},23615:(e,t,a)=>{a.d(t,{default:()=>i});var r=a(95155),n=a(12115),s=a(84588);function i(){let[e,t]=(0,n.useState)([]),[a,i]=(0,n.useState)(!0),[l,o]=(0,n.useState)(!0);(0,n.useEffect)(()=>{d()},[]),(0,n.useEffect)(()=>{let e;return l&&(e=setInterval(()=>{d(!1)},3e3)),()=>clearInterval(e)},[l]);let d=async(e=!0)=>{e&&i(!0);try{let e=await fetch("/api/usage/request-logs");if(e.ok){let a=await e.json();t(a)}}catch(e){console.error("Failed to fetch logs:",e)}finally{e&&i(!1)}};return(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"Request Logs"}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsxs)("label",{className:"text-sm font-medium text-text-muted flex items-center gap-2 cursor-pointer",children:[(0,r.jsx)("span",{children:"Auto Refresh (3s)"}),(0,r.jsx)("div",{onClick:()=>o(!l),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none ${l?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,r.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${l?"translate-x-5":"translate-x-1"}`})})]})})]}),(0,r.jsx)(s.default,{className:"overflow-hidden bg-black/5 dark:bg-black/20",children:(0,r.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:a&&0===e.length?(0,r.jsx)("div",{className:"p-8 text-center text-text-muted",children:"Loading logs..."}):0===e.length?(0,r.jsx)("div",{className:"p-8 text-center text-text-muted",children:"No logs recorded yet."}):(0,r.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,r.jsx)("thead",{className:"sticky top-0 bg-bg-subtle border-b border-border z-10",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"DateTime"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Model"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Provider"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Account"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"In"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Out"}),(0,r.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,r.jsx)("tbody",{className:"divide-y divide-border/50",children:e.map((e,t)=>{let a=e.split(" | ");if(a.length<7)return null;let n=a[6],s=n.includes("PENDING"),i=n.includes("FAILED"),l=n.includes("OK");return(0,r.jsxs)("tr",{className:`hover:bg-primary/5 transition-colors ${s?"bg-primary/5":""}`,children:[(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-text-muted",children:a[0]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border font-medium",children:a[1]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border",children:(0,r.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-bg-subtle border border-border text-[10px] uppercase font-bold",children:a[2]})}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border truncate max-w-[150px]",title:a[3],children:a[3]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-primary",children:a[4]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-success",children:a[5]}),(0,r.jsx)("td",{className:`px-3 py-1.5 font-bold ${l?"text-success":i?"text-error":"text-primary animate-pulse"}`,children:n})]},t)})})]})})}),(0,r.jsx)("div",{className:"text-[10px] text-text-muted italic",children:"Logs are loaded from the request history database."})]})}},23936:(e,t,a)=>{a.d(t,{default:()=>o});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497);function o({isOpen:e,onSuccess:t,onClose:a}){let[s,i]=(0,n.useState)(""),[d,c]=(0,n.useState)(!1),[u,m]=(0,n.useState)(null),[x,p]=(0,n.useState)(!1),h=async()=>{if(!s.trim())return void m("Please paste your cookie");c(!0),m(null);try{let e=await fetch("/api/oauth/iflow/cookie",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:s.trim()})}),a=await e.json();if(!e.ok)throw Error(a.error||"Authentication failed");p(!0),setTimeout(()=>{t?.(),g()},1500)}catch(e){m(e.message)}finally{c(!1)}},g=()=>{i(""),m(null),p(!1),a?.()};return(0,r.jsx)(l.aF,{isOpen:e,onClose:g,title:"iFlow Cookie Authentication",children:(0,r.jsx)("div",{className:"space-y-4",children:x?(0,r.jsxs)("div",{className:"text-center py-8",children:[(0,r.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,r.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,r.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,r.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,r.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,r.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,r.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,r.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,r.jsx)("li",{children:"Login to your account"}),(0,r.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,r.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,r.jsx)("li",{children:"Paste it below"})]})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,r.jsx)("textarea",{value:s,onChange:e=>i(e.target.value),placeholder:"BXAuth=xxx; ...",className:"w-full px-3 py-2 bg-surface-secondary border border-border rounded-lg text-sm text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-primary resize-none",rows:4,disabled:d})]}),u&&(0,r.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,r.jsx)("p",{className:"text-sm text-error",children:u})}),(0,r.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,r.jsx)(l.$n,{variant:"secondary",onClick:g,disabled:d,fullWidth:!0,children:"Cancel"}),(0,r.jsx)(l.$n,{onClick:h,loading:d,fullWidth:!0,children:"Authenticate"})]})]})})})}o.propTypes={isOpen:i().bool.isRequired,onSuccess:i().func,onClose:i().func}},25086:(e,t,a)=>{a.d(t,{CardSkeleton:()=>o,PageLoading:()=>i,Skeleton:()=>l,Spinner:()=>s,default:()=>d});var r=a(95155),n=a(31474);function s({size:e="md",className:t}){return(0,r.jsx)("span",{className:(0,n.cn)("material-symbols-outlined animate-spin text-brand-500",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[e],t),children:"progress_activity"})}function i({message:e="Loading..."}){return(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,r.jsx)(s,{size:"xl"}),(0,r.jsx)("p",{className:"mt-4 text-text-muted",children:e})]})}function l({className:e,...t}){return(0,r.jsx)("div",{className:(0,n.cn)("animate-pulse rounded-[10px] bg-surface-2",e),...t})}function o(){return(0,r.jsxs)("div",{className:"p-6 rounded-[14px] border border-border-subtle bg-surface shadow-[var(--shadow-soft)]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)(l,{className:"h-4 w-24"}),(0,r.jsx)(l,{className:"size-10 rounded-[10px]"})]}),(0,r.jsx)(l,{className:"h-8 w-16 mb-2"}),(0,r.jsx)(l,{className:"h-3 w-20"})]})}function d({type:e="spinner",...t}){switch(e){case"page":return(0,r.jsx)(i,{...t});case"skeleton":return(0,r.jsx)(l,{...t});case"card":return(0,r.jsx)(o,{...t});default:return(0,r.jsx)(s,{...t})}}},28058:(e,t,a)=>{a.d(t,{default:()=>i});var r=a(95155),n=a(12115),s=a(81127);function i({isOpen:e,onClose:t,onAdd:a,addedNames:l=[]}){let[o,d]=(0,n.useState)([]),[c,u]=(0,n.useState)(!1),[m,x]=(0,n.useState)(""),[p,h]=(0,n.useState)("all"),[g,f]=(0,n.useState)(null),[b,v]=(0,n.useState)(null),[j,y]=(0,n.useState)({}),[k,w]=(0,n.useState)({}),[N,C]=(0,n.useState)({});(0,n.useEffect)(()=>{!e||o.length>0||(u(!0),fetch("/api/cli-tools/cowork-mcp-registry").then(e=>e.json()).then(e=>{e.error?f(e.error):d(e.servers||[])}).catch(e=>f(e.message)).finally(()=>u(!1)))},[e]);let S=(0,n.useMemo)(()=>new Set(l),[l]),O=(0,n.useMemo)(()=>{let e=m.trim().toLowerCase();return o.filter(t=>("authless"!==p||!t.oauth)&&("oauth"!==p||!!t.oauth)&&(!e||(t.title||"").toLowerCase().includes(e)||(t.description||"").toLowerCase().includes(e)||(t.name||"").toLowerCase().includes(e)))},[o,m,p]),F=async e=>{if(!j[e.url]){w(t=>({...t,[e.url]:!0}));try{let t=await fetch("/api/cli-tools/cowork-mcp-tools",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e.url})}),a=await t.json(),r=a.tools||[],n=Array.isArray(e.toolNames)?e.toolNames:[],s=r.length>0?r.map(e=>e.name):n;y(t=>({...t,[e.url]:{tools:r,requiresAuth:!!a.requiresAuth,error:a.error}})),C(t=>({...t,[e.url]:Object.fromEntries(s.map(e=>[e,!0]))}))}catch(t){y(a=>({...a,[e.url]:{tools:[],error:t.message}}))}finally{w(t=>({...t,[e.url]:!1}))}}},W=(e,t)=>{let a=N[e]||{};C(r=>({...r,[e]:Object.fromEntries(Object.keys(a).map(e=>[e,t]))}))};return(0,r.jsx)(s.default,{isOpen:e,onClose:t,title:"Browse MCP Marketplace",size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("input",{type:"text",value:m,onChange:e=>x(e.target.value),placeholder:"Search by name or description...",className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,r.jsxs)("select",{value:p,onChange:e=>h(e.target.value),className:"px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:[(0,r.jsx)("option",{value:"all",children:"All"}),(0,r.jsx)("option",{value:"authless",children:"Authless"}),(0,r.jsx)("option",{value:"oauth",children:"OAuth"})]})]}),g&&(0,r.jsx)("div",{className:"px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:g}),c&&(0,r.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-xs py-4 justify-center",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}),(0,r.jsx)("span",{children:"Loading registry..."})]}),!c&&(0,r.jsxs)("div",{className:"flex flex-col gap-1 max-h-[60vh] overflow-y-auto",children:[0===O.length&&(0,r.jsx)("div",{className:"text-center text-xs text-text-muted py-6",children:"No servers match filter"}),O.map(e=>{let t=S.has(e.slug||e.name),n=b===e.url,s=j[e.url],i=k[e.url],l=N[e.url]||{},o=Object.keys(l),d=Object.values(l).filter(Boolean).length;return(0,r.jsxs)("div",{className:"rounded border border-transparent hover:border-border",children:[(0,r.jsxs)("div",{className:"flex items-start gap-2 px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5",children:[e.iconUrl?(0,r.jsx)("img",{src:e.iconUrl,alt:"",className:"size-7 rounded shrink-0 object-contain",onError:e=>{e.target.style.display="none"},loading:"lazy",decoding:"async"}):(0,r.jsx)("div",{className:"size-7 rounded bg-surface shrink-0"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,r.jsx)("span",{className:"font-medium text-xs",children:e.title}),e.oauth?(0,r.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-amber-500/10 text-amber-600",children:"OAuth"}):(0,r.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-green-500/10 text-green-600",children:"Authless"}),e.toolCount>0&&(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:[e.toolCount," tools"]})]}),e.description&&(0,r.jsx)("p",{className:"text-[10px] text-text-muted line-clamp-2 mt-0.5",children:e.description})]}),(0,r.jsx)("button",{onClick:()=>t?null:void(b===e.url?v(null):(v(e.url),F(e))),disabled:t,className:`shrink-0 px-2 py-1 rounded text-[10px] font-medium transition-colors ${t?"bg-green-500/10 text-green-600 cursor-default":n?"bg-surface border border-border text-text-muted hover:bg-black/5":"bg-primary/10 border border-primary/40 text-primary hover:bg-primary/20"}`,children:t?"Added":n?"Cancel":"+ Add"})]}),n&&(0,r.jsxs)("div",{className:"px-3 py-2 bg-surface/40 border-t border-border flex flex-col gap-2",children:[i&&(0,r.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-[10px] py-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin text-[14px]",children:"progress_activity"}),(0,r.jsx)("span",{children:"Probing server for tools..."})]}),!i&&s?.requiresAuth&&(0,r.jsx)("p",{className:"text-[10px] text-amber-600 bg-amber-500/10 px-2 py-1 rounded",children:"\uD83D\uDD10 OAuth required. Add now and authenticate after Apply; tool list will be discovered after first connect."}),!i&&s?.error&&!s?.requiresAuth&&(0,r.jsxs)("p",{className:"text-[10px] text-red-600 bg-red-500/10 px-2 py-1 rounded",children:["Probe failed: ",s.error]}),!i&&0===o.length&&!s?.requiresAuth&&!s?.error&&(0,r.jsx)("p",{className:"text-[10px] text-text-muted",children:"No tools advertised by server."}),!i&&o.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:[d,"/",o.length," tools enabled"]}),(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)("button",{onClick:()=>W(e.url,!0),className:"text-[10px] text-primary hover:underline",children:"All"}),(0,r.jsx)("span",{className:"text-[10px] text-text-muted",children:"\xb7"}),(0,r.jsx)("button",{onClick:()=>W(e.url,!1),className:"text-[10px] text-primary hover:underline",children:"None"})]})]}),(0,r.jsx)("div",{className:"grid grid-cols-2 gap-1 max-h-40 overflow-y-auto",children:o.map(t=>(0,r.jsxs)("label",{className:"flex items-center gap-1.5 text-[10px] cursor-pointer hover:bg-black/5 dark:hover:bg-white/5 px-1 rounded",children:[(0,r.jsx)("input",{type:"checkbox",checked:!!l[t],onChange:()=>{var a;return a=e.url,void C(e=>({...e,[a]:{...e[a],[t]:!e[a]?.[t]}}))},className:"size-3"}),(0,r.jsx)("span",{className:"truncate",children:t})]},t))})]}),(0,r.jsx)("button",{onClick:()=>{let t,r;return r=Object.keys(t=N[e.url]||{}).filter(e=>t[e]),void(a?.({name:e.slug||e.name,title:e.title,description:e.description,url:e.url,transport:e.transport,oauth:e.oauth,toolNames:r}),v(null))},className:"self-end px-2 py-1 rounded text-[10px] font-medium bg-primary text-white hover:bg-primary/90",children:"✓ Confirm Add"})]})]},e.url)})]}),(0,r.jsxs)("div",{className:"text-[10px] text-text-muted text-right",children:[O.length," of ",o.length," servers"]})]})})}},28067:(e,t,a)=>{a.d(t,{default:()=>s});var r=a(95155),n=a(31474);function s({options:e=[],value:t,onChange:a,size:i="md",className:l}){let o={sm:"h-7 text-xs",md:"h-9 text-sm",lg:"h-11 text-base"};return(0,r.jsx)("div",{className:(0,n.cn)("inline-flex items-center p-1 rounded-[10px] overflow-x-auto","bg-surface-2",l),children:e.map(e=>(0,r.jsxs)("button",{onClick:()=>a(e.value),className:(0,n.cn)("shrink-0 px-4 rounded-[8px] font-medium transition-all",o[i],t===e.value?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[e.icon&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px] mr-1.5",children:e.icon}),e.label]},e.value))})}},28697:(e,t,a)=>{a.d(t,{default:()=>m});var r=a(95155),n=a(12115),s=a(81127),i=a(92542),l=a(11910),o=a(28067),d=a(29366),c=a(929),u=a(11059);function m({isOpen:e,combo:t,onClose:a,strategy:x={}}){let[p,h]=(0,n.useState)(!1),[g,f]=(0,n.useState)("Halo, berikan respon singkat."),[b,v]=(0,n.useState)("fallback"),[j,y]=(0,n.useState)(null),[k,w]=(0,n.useState)(""),{getCaps:N}=(0,c.y)(),{copied:C,copy:S}=(0,u.C)(),O=x.fallbackStrategy||"fallback";if((0,n.useEffect)(()=>{e&&(y(null),w(""))},[e,t]),!t)return null;let F=async()=>{h(!0),w(""),y(null);try{let e=t.id?`/api/combos/${t.id}/test`:"/api/combos/test",a=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t.name,models:t.models,kind:t.kind||"llm",prompt:g.trim()||"Halo, berikan respon singkat.",mode:b})}),r=await a.json();a.ok?y(r):w(r.error||"Failed to execute combo test")}catch(e){console.error("Error testing combo:",e),w("Network or server error during combo test")}finally{h(!1)}},W=j?.steps?.filter(e=>e.fallbackTriggered).length||0;return(0,r.jsx)(s.default,{isOpen:e,onClose:a,title:`Test Combo: ${t.name}`,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"rounded-lg border border-border-subtle bg-surface-2 p-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-lg",children:"layers"}),(0,r.jsx)("code",{className:"font-mono text-sm font-semibold text-text-main",children:t.name}),(0,r.jsxs)("span",{className:"rounded bg-primary/10 px-2 py-0.5 text-[11px] font-medium text-primary capitalize",children:["Strategy: ",O]})]}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:[t.models?.length||0," model(s) in fallback sequence"]})]}),(0,r.jsx)("div",{className:"flex min-w-0 items-center gap-1.5 overflow-x-auto py-1 custom-scrollbar text-xs",children:t.models?.map((e,a)=>(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1 rounded bg-surface border border-border-subtle px-2 py-1 font-mono text-[11px] text-text-main shadow-xs",children:[(0,r.jsxs)("span",{className:"text-[10px] text-text-muted font-bold",children:["#",a+1]}),(0,r.jsx)("span",{className:"truncate max-w-[140px]",children:e}),(0,r.jsx)(d.default,{caps:N?.(e)})]}),a<t.models.length-1&&(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"})]},a))})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 items-end",children:[(0,r.jsx)("div",{className:"sm:col-span-2",children:(0,r.jsx)(l.default,{label:"Test Prompt",value:g,onChange:e=>f(e.target.value),placeholder:"Enter test prompt...",disabled:p})}),(0,r.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,r.jsx)("label",{className:"text-xs font-medium text-text-muted",children:"Execution Mode"}),(0,r.jsx)(o.default,{options:[{value:"fallback",label:"Fallback Mode (Real Request)"},{value:"all",label:"Full Diagnostic (All Models)"}],value:b,onChange:v,disabled:p})]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between pt-1",children:[(0,r.jsx)("p",{className:"text-[11px] text-text-muted",children:"fallback"===b?"Evaluates models in order until one succeeds (simulates real client hit).":"Tests every model in order to verify individual model availability."}),(0,r.jsx)(i.default,{onClick:F,loading:p,disabled:p||!t.models?.length,icon:"play_arrow",size:"sm",children:p?"Running Combo Test...":"Run Test"})]}),k&&(0,r.jsxs)("div",{className:"rounded-lg bg-red-500/10 border border-red-500/20 p-3 text-xs text-red-500 flex items-start gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-lg shrink-0",children:"error"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"font-semibold mb-0.5",children:"Test Error"}),(0,r.jsx)("p",{children:k})]})]}),p&&(0,r.jsxs)("div",{className:"py-8 flex flex-col items-center justify-center gap-3 border border-dashed border-border-subtle rounded-lg bg-surface-2/50",children:[(0,r.jsx)("div",{className:"size-8 rounded-full border-2 border-primary border-t-transparent animate-spin"}),(0,r.jsx)("p",{className:"text-xs font-medium text-text-main animate-pulse",children:"Testing hit to combo models based on sequence..."}),(0,r.jsx)("p",{className:"text-[11px] text-text-muted",children:"Simulating fallbacks if upstream models return errors."})]}),j&&!p&&(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsx)("div",{className:`rounded-lg p-3.5 border ${"success"===j.comboStatus?"bg-emerald-500/10 border-emerald-500/30 text-emerald-600 dark:text-emerald-400":"bg-red-500/10 border-red-500/30 text-red-600 dark:text-red-400"}`,children:(0,r.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-xl",children:"success"===j.comboStatus?"check_circle":"cancel"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"text-sm font-semibold leading-snug",children:"success"===j.comboStatus?"Combo Test Succeeded":"Combo Test Failed"}),(0,r.jsx)("p",{className:"text-xs opacity-90",children:"success"===j.comboStatus?`Served by model #${j.servedStepIndex}: ${j.servingModel}`:"All models in combo failed to respond"})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 text-xs font-medium",children:[W>0&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 rounded bg-amber-500/20 px-2 py-0.5 text-amber-700 dark:text-amber-300",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"swap_calls"}),W," Fallback",W>1?"s":""]}),(0,r.jsxs)("span",{className:"rounded bg-black/10 dark:bg-white/10 px-2 py-0.5",children:["Total: ",j.totalLatencyMs,"ms"]})]})]})}),(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("span",{className:"text-xs font-medium text-text-muted",children:["Fallback Execution Sequence (",j.steps?.length||0," steps)"]}),(0,r.jsxs)("button",{onClick:()=>S((()=>{if(!j)return"";let e=`Combo Test: ${j.comboName}
2
2
  Status: ${j.comboStatus.toUpperCase()}
3
3
  Serving Model: ${j.servingModel||"None"}
4
4
  Total Latency: ${j.totalLatencyMs}ms
@@ -8,10 +8,10 @@ Steps:
8
8
  `:t.ok?e+=`#${t.index} ${t.model}: OK (${t.latencyMs}ms) - SERVED REQUEST
9
9
  Preview: ${t.preview||"N/A"}
10
10
  `:e+=`#${t.index} ${t.model}: FAILED (${t.latencyMs}ms) - ${t.error}
11
- `}),e})(),"combo-test-summary"),className:"text-[11px] text-primary hover:underline flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"combo-test-summary"===C?"check":"content_copy"}),"combo-test-summary"===C?"Copied Summary":"Copy Diagnostic Summary"]})]}),(0,r.jsx)("div",{className:"flex flex-col gap-2 max-h-[320px] overflow-y-auto custom-scrollbar pr-1",children:j.steps?.map(e=>(0,r.jsxs)("div",{className:`rounded-lg border p-3 text-xs transition-all ${e.servedRequest?"border-emerald-500/40 bg-emerald-500/5 dark:bg-emerald-500/10 shadow-xs":e.fallbackTriggered?"border-amber-500/40 bg-amber-500/5 dark:bg-amber-500/10":"border-border-subtle bg-surface-2 opacity-60"}`,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)("span",{className:`size-5 rounded-full flex items-center justify-center font-bold text-[10px] shrink-0 ${e.servedRequest?"bg-emerald-500 text-white":e.fallbackTriggered?"bg-amber-500 text-white":"bg-black/20 dark:bg-white/20 text-text-muted"}`,children:e.index}),(0,r.jsx)("code",{className:"font-mono text-xs font-semibold text-text-main truncate",children:e.model})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[e.servedRequest&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-500/20 text-emerald-700 dark:text-emerald-300 font-semibold px-2 py-0.5 text-[10px]",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"verified"}),"SERVED REQUEST"]}),e.fallbackTriggered&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-amber-500/20 text-amber-700 dark:text-amber-300 font-semibold px-2 py-0.5 text-[10px]",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"warning"}),"FALLBACK TRIGGERED"]}),e.skipped&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-black/10 dark:bg-white/10 text-text-muted font-medium px-2 py-0.5 text-[10px]",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"skip_next"}),"SKIPPED"]}),!e.skipped&&(0,r.jsxs)("span",{className:"font-mono text-[11px] text-text-muted",children:[e.latencyMs,"ms"]})]})]}),e.fallbackTriggered&&(0,r.jsxs)("div",{className:"mt-2 rounded bg-red-500/10 border border-red-500/20 p-2 font-mono text-[11px] text-red-500 break-words",children:[(0,r.jsx)("span",{className:"font-bold",children:"Error: "}),e.error||`HTTP ${e.status}`]}),e.servedRequest&&e.preview&&(0,r.jsxs)("div",{className:"mt-2 rounded bg-surface p-2 border border-emerald-500/30 text-[11px] text-text-main font-mono whitespace-pre-wrap max-h-24 overflow-y-auto custom-scrollbar",children:[(0,r.jsx)("span",{className:"text-[10px] text-emerald-600 dark:text-emerald-400 font-bold block mb-0.5",children:"Output Preview:"}),e.preview]}),e.skipped&&(0,r.jsx)("div",{className:"mt-1 text-[11px] text-text-muted italic",children:e.reason})]},e.index))})]})]})]})})}},28815:(e,t,a)=>{a.d(t,{default:()=>o});var r=a(95155),n=a(12115),s=a(81127),i=a(92542),l=a(11059);function o({isOpen:e,onClose:t,title:a="Manual Configuration",configs:d=[]}){let{copy:c}=(0,l.C)(),[u,m]=(0,n.useState)(null);return(0,r.jsx)(s.default,{isOpen:e,onClose:t,title:a,size:"xl",children:(0,r.jsx)("div",{className:"flex flex-col gap-4",children:d.map((e,t)=>(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-text-main",children:e.filename}),(0,r.jsxs)(i.default,{variant:"ghost",size:"sm",onClick:()=>{var a;return a=e.content,void(c(a,`manualconfig-${t}`),m(t),setTimeout(()=>m(null),2e3))},children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:u===t?"check":"content_copy"}),u===t?"Copied!":"Copy"]})]}),(0,r.jsx)("pre",{className:"px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs overflow-x-auto whitespace-pre-wrap break-all max-h-60 overflow-y-auto border border-border",children:e.content})]},t))})})}},29366:(e,t,a)=>{a.d(t,{default:()=>i});var r=a(95155),n=a(28777),s=a(97677);function i({caps:e,className:t="",colorOverride:a,size:l=16}){if(!e)return null;let o=Object.keys(n.bs).filter(t=>e[t]);return 0===o.length?null:(0,r.jsx)("span",{className:`inline-flex items-center gap-0.5 ${t}`,children:o.map(e=>(0,r.jsx)(s.default,{text:`${n.bs[e].label} — ${n.bs[e].desc}`,children:(0,r.jsx)("span",{className:`material-symbols-outlined leading-none cursor-help ${a||n.bs[e].color}`,style:{fontSize:`${l}px`},children:n.bs[e].icon})},e))})}},30312:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497),o=a(11059);function d({isOpen:e,providerInfo:t,onSuccess:a,onClose:s}){let[i,c]=(0,n.useState)("booting"),[u,m]=(0,n.useState)(null),[x,p]=(0,n.useState)(null),[h,g]=(0,n.useState)(""),[f,b]=(0,n.useState)(null),[v,j]=(0,n.useState)(!1),y=(0,n.useRef)(null),k=(0,n.useRef)({proxyStarted:!1,stopSent:!1}),w=(0,n.useRef)(!1),N=(0,n.useRef)(!1),C=(0,n.useRef)(e),S=(0,n.useRef)(a),O=(0,n.useRef)(s),{copied:F,copy:I}=(0,o.C)();(0,n.useEffect)(()=>{C.current=e,S.current=a,O.current=s});let W=(0,n.useCallback)(()=>{let e=k.current;e.proxyStarted&&!e.stopSent&&(e.stopSent=!0,fetch("/api/oauth/zed/stop-proxy").catch(()=>{}))},[]),P=(0,n.useCallback)(()=>{c("success"),S.current?.(),setTimeout(()=>O.current?.(),600)},[]),T=(0,n.useCallback)(async e=>{if(e?.accessToken&&e?.userId){j(!0),b(null),c("importing");try{let t=await fetch("/api/oauth/zed/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:e.accessToken,userId:e.userId,...e.systemId?{systemId:e.systemId}:{}})}),a=await t.json();if(!t.ok)throw Error(a.error||"Import failed");W(),P()}catch(e){b(e.message),c("ide-found")}finally{j(!1)}}},[P,W]),E=(0,n.useCallback)(async()=>{b(null),p(null),g(""),k.current={proxyStarted:!1,stopSent:!1},N.current=!1;try{let e=await fetch("/api/oauth/zed/start-proxy"),t=await e.json();if(!e.ok||!t.success||!t.callbackUrl)throw Error(t.reason||t.error||"Failed to start Zed callback server");if(k.current.proxyStarted=!0,k.current.stopSent=!1,!C.current)return void W();let a=new URL("/api/oauth/zed/authorize",window.location.origin);a.searchParams.set("redirect_uri",t.callbackUrl);let r=await fetch(a),n=await r.json();if(!r.ok)throw W(),Error(n.error||"Failed to start Zed authorization");if(!C.current)return void W();let s={state:n.state};n.codeVerifier&&(s.codeVerifier=n.codeVerifier),n.systemId&&(s.systemId=n.systemId);let i=await fetch("/api/oauth/zed/register-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),l=null;try{l=await i.json()}catch{l=null}if(!i.ok||l?.success===!1)throw W(),Error(l?.error||"Failed to register Zed login session");if(!C.current)return;p(n),c(e=>"ide-found"===e||"importing"===e?e:"browser"),y.current=window.open(n.authUrl,"oauth_popup_zed","width=600,height=700")}catch(e){if(!C.current)return;b(e.message),c(e=>"ide-found"===e?e:"browser")}},[W]);(0,n.useEffect)(()=>{if(!e||w.current)return;w.current=!0,c("booting"),m(null),p(null),g(""),b(null),j(!1),N.current=!1,k.current={proxyStarted:!1,stopSent:!1};let t=!1;return(async()=>{let e=E();try{let e=await fetch("/api/oauth/zed/auto-import",{signal:AbortSignal.timeout(12e3)}),a=await e.json();if(t||!C.current)return;if(a.found&&a.accessToken&&a.userId){let e={accessToken:a.accessToken,userId:String(a.userId),systemId:a.systemId||""};m(e),await T(e);return}}catch{}!t&&C.current&&(await e,!t&&C.current&&c("browser"))})(),()=>{t=!0}},[e,E,T]),(0,n.useEffect)(()=>{if(!e&&(w.current=!1,N.current=!0,W(),k.current={proxyStarted:!1,stopSent:!1},y.current&&!y.current.closed))try{y.current.close()}catch{}},[e,W]),(0,n.useEffect)(()=>{if(!x?.state||"importing"===i||"success"===i)return;let e=!1,t=0,a=async()=>{if(!e&&!N.current&&C.current){t+=1;try{let t=await fetch(`/api/oauth/zed/poll-status?state=${encodeURIComponent(x.state)}`),a=await t.json();if(e||N.current)return;if("done"===a.status){N.current=!0,W(),P();return}if("error"===a.status){N.current=!0,b(a.error||"Authentication failed"),c("error");return}}catch{}if(t>=200){b("Authentication timeout"),c("error");return}setTimeout(a,1500)}};return setTimeout(a,1500),()=>{e=!0}},[x,i,P,W]);let $=async()=>{let e=h.trim();if(e){j(!0),b(null);try{let t=await fetch("/api/oauth/zed/exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,state:x?.state,...x?.redirectUri?{redirectUri:x.redirectUri}:{},...x?.codeVerifier?{codeVerifier:x.codeVerifier}:{},...x?.systemId?{systemId:x.systemId}:{}})}),a=await t.json();if(!t.ok)throw Error(a.error||"Exchange failed");N.current=!0,W(),P()}catch(e){b(e.message),c("error")}finally{j(!1)}}},_=()=>{N.current=!0,W(),s()},z=`Connect ${t?.name||"Zed"}`;return(0,r.jsx)(l.aF,{isOpen:e,title:z,onClose:_,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[("booting"===i||"importing"===i)&&(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-primary animate-spin",children:"progress_activity"}),(0,r.jsx)("span",{className:"text-sm",children:"importing"===i?"Importing session from Zed IDE…":"Detecting Zed IDE session…"})]}),"ide-found"===i&&u&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,r.jsxs)("p",{className:"text-sm text-green-800 dark:text-green-200",children:["Zed IDE session detected (user ",u.userId,"). Import failed — retry or use browser sign-in below."]})]})}),(0,r.jsx)(l.$n,{onClick:()=>T(u),fullWidth:!0,disabled:v,children:v?"Importing…":"Import from Zed IDE"})]}),"success"===i&&(0,r.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800 text-sm text-green-800 dark:text-green-200",children:"Connected successfully."}),("browser"===i||"error"===i||"ide-found"===i)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-primary animate-spin",children:"progress_activity"}),(0,r.jsx)("span",{className:"text-sm",children:"Waiting for popup authorization…"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 my-1",children:[(0,r.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,r.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wider",children:"Or paste callback URL manually"}),(0,r.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.pd,{value:x?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,r.jsx)(l.$n,{variant:"secondary",icon:"auth_url"===F?"check":"content_copy",onClick:()=>I(x?.authUrl,"auth_url"),disabled:!x?.authUrl,children:"Copy"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser (or the local callback page)."}),(0,r.jsx)(l.pd,{value:h,onChange:e=>g(e.target.value),placeholder:"http://127.0.0.1:.../?user_id=...&access_token=...",className:"font-mono text-xs"})]})]}),f&&(0,r.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,r.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:f})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:$,fullWidth:!0,disabled:v||!h.trim()||!x,children:v?"Connecting…":"Connect"}),(0,r.jsx)(l.$n,{onClick:_,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}d.propTypes={isOpen:i().bool.isRequired,providerInfo:i().object,onSuccess:i().func,onClose:i().func.isRequired}},30815:(e,t,a)=>{a.d(t,{default:()=>o});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497);function o({isOpen:e,onSuccess:t,onClose:a}){let[s,i]=(0,n.useState)(""),[d,c]=(0,n.useState)(""),[u,m]=(0,n.useState)(null),[x,p]=(0,n.useState)(!1),[h,g]=(0,n.useState)(!1),[f,b]=(0,n.useState)(!1),[v,j]=(0,n.useState)(!1),y=async()=>{g(!0),m(null),b(!1),j(!1);try{let e=await fetch("/api/oauth/cursor/auto-import"),t=await e.json();t.found?(i(t.accessToken),c(t.machineId),b(!0)):t.windowsManual?j(!0):m(t.error||"Could not auto-detect tokens")}catch(e){m("Failed to auto-detect tokens")}finally{g(!1)}};(0,n.useEffect)(()=>{e&&y()},[e]);let k=()=>{i(""),c(""),b(!1),m(null),a()},w=async()=>{if(!s.trim())return void m("Please enter an access token");if(!d.trim())return void m("Please enter a machine ID");p(!0),m(null);try{let e=await fetch("/api/oauth/cursor/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:s.trim(),machineId:d.trim()})}),a=await e.json();if(!e.ok)throw Error(a.error||"Import failed");t?.(),k()}catch(e){m(e.message)}finally{p(!1)}};return(0,r.jsx)(l.aF,{isOpen:e,title:"Connect Cursor IDE",onClose:k,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[h&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting tokens..."}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from Cursor IDE database"})]}),!h&&(0,r.jsxs)(r.Fragment,{children:[f&&(0,r.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,r.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Tokens auto-detected from Cursor IDE successfully!"})]})}),v&&(0,r.jsxs)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-3 rounded-lg border border-amber-200 dark:border-amber-800 flex flex-col gap-2",children:[(0,r.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Could not read Cursor database automatically."})]}),(0,r.jsxs)("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Make sure Cursor IDE has been opened at least once, then click ",(0,r.jsx)("strong",{children:"Retry"}),". If the problem persists, paste your tokens manually below."]}),(0,r.jsx)(l.$n,{onClick:y,variant:"outline",fullWidth:!0,children:"Retry"})]}),!f&&!v&&!u&&(0,r.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Cursor IDE not detected. Please paste your tokens manually."})]})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)("textarea",{value:s,onChange:e=>i(e.target.value),placeholder:"Access token will be auto-filled...",rows:3,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-lg bg-background focus:outline-none focus:border-primary resize-none"})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Machine ID ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(l.pd,{value:d,onChange:e=>c(e.target.value),placeholder:"Machine ID will be auto-filled...",className:"font-mono text-sm"})]}),u&&(0,r.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,r.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:u})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:w,fullWidth:!0,disabled:x||!s.trim()||!d.trim(),children:x?"Importing...":"Import Token"}),(0,r.jsx)(l.$n,{onClick:k,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}o.propTypes={isOpen:i().bool.isRequired,onSuccess:i().func,onClose:i().func.isRequired}},35497:(e,t,a)=>{a.d(t,{x0:()=>N.default,fA:()=>C.default,Ex:()=>d.default,$n:()=>r.default,nh:()=>P.default,Zp:()=>i.default,Qv:()=>o.CardSkeleton,CK:()=>p.default,St:()=>T.default,uo:()=>l.ConfirmModal,G9:()=>b.default,wI:()=>w.default,vj:()=>k.default,vE:()=>y.default,pd:()=>n.default,Mh:()=>f.default,uR:()=>x.default,Nf:()=>h.default,aF:()=>l.default,rq:()=>m.default,gw:()=>O.default,LF:()=>u.default,dK:()=>S.default,Wx:()=>W.default,gM:()=>g.default,Iz:()=>F.default,l6:()=>s.default,lM:()=>c.default,m_:()=>I.default,LH:()=>j.default,TE:()=>v.default});var r=a(92542),n=a(11910),s=a(98),i=a(84588),l=a(81127),o=a(25086);a(56319);var d=a(56061),c=a(98542);a(38587),a(21110),a(84130),a(8823),a(92173);var u=a(90882),m=a(72908),x=a(28815),p=a(45455),h=a(28058);a(21931),a(67968),a(80752),a(40197);var g=a(23615);a(85416);var f=a(62899);a(94230);var b=a(30815),v=a(30312),j=a(40684),y=a(23936),k=a(95088),w=a(73579),N=a(96748),C=a(2222),S=a(50378),O=a(4823),F=a(28067),I=a(97677),W=a(51825),P=a(29366),T=a(28697);a(98254),a(91450)},38003:(e,t,a)=>{a.d(t,{C:()=>r});let r=(0,a(1934).v)(e=>({query:"",placeholder:"",visible:!1,setQuery:t=>e({query:t}),register:(t="Search...")=>e({visible:!0,placeholder:t,query:""}),unregister:()=>e({visible:!1,placeholder:"",query:""})}))},38202:(e,t,a)=>{a.d(t,{h:()=>r});let r={en:"\uD83C\uDDFA\uD83C\uDDF8",vi:"\uD83C\uDDFB\uD83C\uDDF3","zh-CN":"\uD83C\uDDE8\uD83C\uDDF3","zh-TW":"\uD83C\uDDF9\uD83C\uDDFC",ja:"\uD83C\uDDEF\uD83C\uDDF5","pt-BR":"\uD83C\uDDE7\uD83C\uDDF7","pt-PT":"\uD83C\uDDF5\uD83C\uDDF9",ko:"\uD83C\uDDF0\uD83C\uDDF7",es:"\uD83C\uDDEA\uD83C\uDDF8",de:"\uD83C\uDDE9\uD83C\uDDEA",fr:"\uD83C\uDDEB\uD83C\uDDF7",he:"\uD83C\uDDEE\uD83C\uDDF1",ar:"\uD83C\uDDF8\uD83C\uDDE6",ru:"\uD83C\uDDF7\uD83C\uDDFA",pl:"\uD83C\uDDF5\uD83C\uDDF1",cs:"\uD83C\uDDE8\uD83C\uDDFF",nl:"\uD83C\uDDF3\uD83C\uDDF1",tr:"\uD83C\uDDF9\uD83C\uDDF7",uk:"\uD83C\uDDFA\uD83C\uDDE6",tl:"\uD83C\uDDF5\uD83C\uDDED",id:"\uD83C\uDDEE\uD83C\uDDE9",th:"\uD83C\uDDF9\uD83C\uDDED",km:"\uD83C\uDDF0\uD83C\uDDED",hi:"\uD83C\uDDEE\uD83C\uDDF3",bn:"\uD83C\uDDE7\uD83C\uDDE9",ur:"\uD83C\uDDF5\uD83C\uDDF0",ro:"\uD83C\uDDF7\uD83C\uDDF4",sv:"\uD83C\uDDF8\uD83C\uDDEA",it:"\uD83C\uDDEE\uD83C\uDDF9",el:"\uD83C\uDDEC\uD83C\uDDF7",hu:"\uD83C\uDDED\uD83C\uDDFA",fi:"\uD83C\uDDEB\uD83C\uDDEE",da:"\uD83C\uDDE9\uD83C\uDDF0",no:"\uD83C\uDDF3\uD83C\uDDF4",fa:"\uD83C\uDDEE\uD83C\uDDF7"}},38587:(e,t,a)=>{a.d(t,{default:()=>i});var r=a(95155),n=a(1620),s=a(31474);function i({className:e,variant:t="default"}){let{isDark:a,toggleTheme:l}=(0,n.D)(),o={default:(0,s.cn)("flex items-center justify-center size-10 rounded-full","text-text-muted hover:text-text-main","hover:bg-surface-2 transition-colors"),card:(0,s.cn)("flex items-center justify-center size-11 rounded-full","bg-surface/60 hover:bg-surface","border border-border","backdrop-blur-md shadow-sm hover:shadow-[var(--shadow-warm)]","text-text-muted hover:text-brand-500","transition-all group")};return(0,r.jsx)("button",{onClick:l,className:(0,s.cn)(o[t],e),"aria-label":`Switch to ${a?"light":"dark"} mode`,title:`Switch to ${a?"light":"dark"} mode`,children:(0,r.jsx)("span",{className:(0,s.cn)("material-symbols-outlined text-[22px]","card"===t&&"transition-transform duration-300 group-hover:rotate-12"),children:a?"light_mode":"dark_mode"})})}},40197:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(95155),n=a(12115),s=a(47650),i=a(14051),l=a.n(i),o=a(90620);function d({isOpen:e,onClose:t}){let[i,l]=(0,n.useState)(""),[c,u]=(0,n.useState)(!1),[m,x]=(0,n.useState)(""),p=(0,n.useRef)(null);return((0,n.useEffect)(()=>{e&&(u(!0),x(""),Promise.all([fetch(o.Nu.changelogUrl,{cache:"no-store"}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.text()}),a.e(9233).then(a.bind(a,9233))]).then(([e,{marked:t}])=>{t.setOptions({gfm:!0,breaks:!0}),l(t.parse(e))}).catch(e=>x(e.message||"Failed to load")).finally(()=>u(!1)))},[e]),(0,n.useEffect)(()=>{let a=e=>{p.current&&!p.current.contains(e.target)&&t()};if(e)return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[e,t]),!e||"u"<typeof document)?null:(0,s.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:t}),(0,r.jsxs)("div",{ref:p,className:"relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-3xl flex flex-col max-h-[85vh]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Change Log"}),(0,r.jsx)("button",{onClick:t,className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":"Close",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,r.jsxs)("div",{className:"p-6 overflow-y-auto flex-1",children:[c&&(0,r.jsxs)("div",{className:"flex items-center justify-center py-10 text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin mr-2",children:"progress_activity"}),"Loading..."]}),m&&(0,r.jsxs)("div",{className:"text-red-500 py-4",children:["Failed to load changelog: ",m]}),!c&&!m&&i&&(0,r.jsx)("div",{className:"changelog-body text-text-main",dangerouslySetInnerHTML:{__html:i}})]})]})]}),document.body)}d.propTypes={isOpen:l().bool.isRequired,onClose:l().func.isRequired}},40684:(e,t,a)=>{a.d(t,{default:()=>c});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497),o=a(73006);let d=[{id:"cn",flag:"\uD83C\uDDE8\uD83C\uDDF3",name:"China (Mainland)",host:"mimo-server-cn"},{id:"sgp",flag:"\uD83C\uDDF8\uD83C\uDDEC",name:"Singapore",host:"mimo-server-sgp"},{id:"ams",flag:"\uD83C\uDDEA\uD83C\uDDFA",name:"Europe \xb7 Amsterdam",host:"mimo-server-ams"},{id:"ru",flag:"\uD83C\uDDF7\uD83C\uDDFA",name:"Russia",host:"mimo-server-ru"},{id:"in",flag:"\uD83C\uDDEE\uD83C\uDDF3",name:"India",host:"mimo-server-in"}];function c({isOpen:e,onSuccess:t,onClose:a}){let[s,i]=(0,n.useState)("detecting"),[u,m]=(0,n.useState)(null),[x,p]=(0,n.useState)(null),[h,g]=(0,n.useState)(null),[f,b]=(0,n.useState)(!1),[v,j]=(0,n.useState)(!1),[y,k]=(0,n.useState)(!1),[w,N]=(0,n.useState)(null),[C,S]=(0,n.useState)(null),[O,F]=(0,n.useState)("cn"),I=(0,n.useRef)(null),W=()=>{I.current&&(clearInterval(I.current),I.current=null),k(!1)};(0,n.useEffect)(()=>()=>W(),[]),(0,n.useEffect)(()=>{e&&(i("detecting"),g(null),m(null),p(null),b(!1),N(null),(async()=>{try{let e=await fetch("/api/oauth/xiaomi-mimo/auto-import",{signal:AbortSignal.timeout(5e3)}),t=await e.json();t.found&&t.apiKey?(m(t),i("found"),fetch("/api/providers",{signal:AbortSignal.timeout(3e3)}).then(e=>e.json()).then(e=>{let a=(e.connections||[]).find(e=>"xiaomi-mimo"===e.provider&&t.uid&&(e.email===`${t.uid}@xiaomi`||e.providerSpecificData?.uid===t.uid||e.providerSpecificData?.mimoUserId===t.uid));a&&p(a)}).catch(()=>{})):i("not-found")}catch{i("not-found")}})())},[e]);let P=async()=>{if(u?.apiKey){i("importing"),g(null);try{let e=await fetch("/api/oauth/xiaomi-mimo/api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:u.apiKey,uid:u.uid,baseUrl:u.baseUrl,mimoPassToken:u.mimoPassToken||null,mimoUserId:u.mimoUserId||null,mimoCUserId:u.mimoCUserId||null})}),r=await e.json();if(!e.ok||!r.success)throw Error(r.error||"Import failed");t?.(r.connection),a()}catch(e){i("found"),g(e.message)}}},T=async e=>{j(!0),N(null),b(!1),F(e);try{let r=await fetch("/api/oauth/xiaomi-mimo/login/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({region:e})}),n=await r.json();if(!r.ok||!n.pageUrl)throw Error(n.error||"Failed to start login");S(n.pageUrl),window.open(n.pageUrl,"mimo-session-login","width=500,height=760"),k(!0);let s=Date.now();I.current=setInterval(async()=>{if(Date.now()-s>84e4){W(),N("Login timed out. Please retry.");return}try{let e=await fetch(`/api/oauth/xiaomi-mimo/login/status?state=${n.state}`),r=await e.json();if("pending"===r.status)return;if(W(),"done"!==r.status)return void N(r.error||"Login session expired — please retry.");let s=await fetch("/api/oauth/xiaomi-mimo/api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:"",uid:r.userId||null,mimoPassToken:r.passToken,mimoUserId:r.userId||null,mimoCUserId:r.cUserId||null,region:r.region||O})}),i=await s.json();if(!s.ok||!i.success)throw Error(i.error||"Failed to save credentials");t?.(i.connection),a()}catch(e){W(),N(e.message)}},2500)}catch(e){N(e.message)}finally{j(!1)}},E=()=>(0,r.jsxs)("div",{className:"bg-card p-3 rounded-lg border border-border flex flex-col gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-base",children:"login"}),(0,r.jsx)("span",{className:"text-xs sm:text-sm font-semibold",children:"Browser Login"}),(0,r.jsx)("span",{className:"text-[11px] text-text-muted",children:"No Desktop required"})]}),(0,r.jsx)("span",{className:"text-[11px] text-text-muted",children:"Weekly quota"})]}),y?(0,r.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,r.jsx)(l.$n,{variant:"outline",size:"sm",fullWidth:!0,disabled:!0,children:"Waiting for login..."}),C&&(0,r.jsx)(l.$n,{onClick:()=>window.open(C,"mimo-session-login","width=500,height=760"),variant:"ghost",size:"sm",fullWidth:!0,children:"Reopen login window"})]}):(0,r.jsx)(l.$n,{onClick:()=>b(!0),variant:"outline",size:"sm",fullWidth:!0,disabled:v,children:v?"Starting...":"Choose cluster & sign in"}),w&&(0,r.jsx)("p",{className:"text-[11px] text-red-500",children:(0,o.Tl)(w)})]});return(0,r.jsx)(l.aF,{isOpen:e,title:(0,o.Tl)("Connect Xiaomi MiMo"),onClose:a,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-3.5",children:["detecting"===s&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-12 mx-auto mb-3 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Reading local MiMo Desktop credentials..."})]}),"importing"===s&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-12 mx-auto mb-3 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("p",{className:"text-sm font-medium",children:"Connecting..."})]}),"found"===s&&u&&(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-semibold text-text-muted px-0.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-sm",children:"desktop_windows"}),(0,r.jsx)("span",{children:"Desktop Plan \xb7 Local credentials"})]}),x?(0,r.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,r.jsxs)("div",{className:"flex gap-2.5 items-start",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400 text-lg mt-0.5",children:"check_circle"}),(0,r.jsxs)("div",{className:"text-sm text-blue-800 dark:text-blue-200",children:[(0,r.jsx)("p",{className:"font-medium",children:"This account is already connected (no need to import again)"}),(0,r.jsxs)("p",{className:"text-xs mt-0.5 opacity-80",children:["UID: ",u.uid||"—"," \xb7 Status: ","active"===x.testStatus?"Active":"Untested"]})]})]})}):(0,r.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,r.jsxs)("div",{className:"flex gap-2.5 items-start",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400 text-lg mt-0.5",children:"check_circle"}),(0,r.jsxs)("div",{className:"text-sm text-green-800 dark:text-green-200",children:[(0,r.jsx)("p",{className:"font-medium",children:"Xiaomi MiMo Desktop credentials found!"}),(0,r.jsxs)("p",{className:"text-xs mt-0.5 opacity-80",children:["UID: ",u.uid||"—"," \xb7 Source: ",u.source?.split(/[\\/]/).pop()]})]})]})}),h&&(0,r.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-2.5 rounded-lg border border-red-200 dark:border-red-800",children:(0,r.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",children:(0,o.Tl)(h)})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:P,variant:x?"outline":"default",fullWidth:!0,children:x?"Re-sync local credentials":"Connect with local credentials"}),(0,r.jsx)(l.$n,{onClick:a,variant:"ghost",fullWidth:!0,children:x?"Close":"Cancel"})]}),(0,r.jsxs)("div",{className:"relative my-1",children:[(0,r.jsx)("div",{className:"absolute inset-0 flex items-center",children:(0,r.jsx)("div",{className:"w-full border-t border-border"})}),(0,r.jsx)("div",{className:"relative flex justify-center text-xs text-text-muted",children:(0,r.jsx)("span",{className:"bg-card px-2",children:"or"})})]}),E()]}),"not-found"===s&&(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-3 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,r.jsxs)("div",{className:"flex gap-2.5 items-start",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400 text-lg mt-0.5",children:"info"}),(0,r.jsxs)("div",{className:"text-sm text-amber-800 dark:text-amber-200",children:[(0,r.jsx)("p",{className:"font-medium",children:"No local Desktop credentials found"}),(0,r.jsx)("p",{className:"text-xs mt-0.5 opacity-80",children:"You can still sign in via browser — no Desktop client needed."})]})]})}),E(),(0,r.jsx)("div",{className:"mt-1",children:(0,r.jsx)(l.$n,{onClick:a,variant:"ghost",fullWidth:!0,children:"Cancel"})})]}),f&&(0,r.jsx)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4 bg-black/60 backdrop-blur-xs animate-in fade-in duration-150",children:(0,r.jsxs)("div",{className:"relative w-full max-w-sm bg-surface border border-border-subtle rounded-[14px] shadow-2xl p-5 flex flex-col gap-3.5 animate-in zoom-in-95 duration-150",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-lg",children:"public"}),(0,r.jsx)("h3",{className:"text-sm font-semibold",children:"Select account cluster"})]}),(0,r.jsx)("button",{type:"button",onClick:()=>b(!1),className:"text-text-muted hover:text-text-primary p-1 rounded-md transition-colors cursor-pointer",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Choose the region cluster of your Xiaomi account:"}),(0,r.jsx)("div",{className:"flex flex-col gap-2",children:d.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>T(e.id),className:"p-3 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-all text-left flex items-start gap-3 group cursor-pointer",children:[(0,r.jsx)("span",{className:"text-2xl mt-0.5",children:e.flag}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("div",{className:"text-sm font-semibold group-hover:text-primary transition-colors",children:e.name}),(0,r.jsx)("div",{className:"text-xs text-text-muted mt-0.5",children:e.host})]})]},e.id))}),(0,r.jsx)(l.$n,{onClick:()=>b(!1),variant:"ghost",size:"sm",fullWidth:!0,children:"Cancel"})]})})]})})}c.propTypes={isOpen:i().bool.isRequired,onSuccess:i().func,onClose:i().func.isRequired}},45455:(e,t,a)=>{a.d(t,{default:()=>u});var r=a(95155),n=a(12115),s=a(81127),i=a(11910),l=a(92542),o=a(72908);let d=/^[a-zA-Z0-9_.\-]+$/;function c({index:e,model:t,isFirst:a,isLast:s,onEdit:i,onMoveUp:l,onMoveDown:o,onRemove:d}){let[u,m]=(0,n.useState)(!1),[x,p]=(0,n.useState)(t),h=()=>{let e=x.trim();e&&e!==t?i(e):p(t),m(!1)};return(0,r.jsxs)("div",{className:"group flex min-w-0 items-center gap-1.5 rounded-md bg-black/[0.02] px-2 py-1 transition-colors hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04]",children:[(0,r.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:e+1}),u?(0,r.jsx)("input",{autoFocus:!0,value:x,onChange:e=>p(e.target.value),onBlur:h,onKeyDown:e=>{"Enter"===e.key&&h(),"Escape"===e.key&&(p(t),m(!1))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-white px-1.5 py-0.5 font-mono text-xs text-text-main outline-none dark:bg-black/20"}):(0,r.jsx)("div",{className:"min-w-0 flex-1 cursor-text truncate rounded px-1.5 py-0.5 font-mono text-xs text-text-main hover:bg-black/5 dark:hover:bg-white/5",onClick:()=>m(!0),title:"Click to edit",children:t}),(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,r.jsx)("button",{onClick:l,disabled:a,className:`p-0.5 rounded ${a?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,r.jsx)("button",{onClick:o,disabled:s,className:`p-0.5 rounded ${s?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,r.jsx)("button",{onClick:d,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function u({isOpen:e,combo:t,onClose:a,onSave:m,activeProviders:x,kindFilter:p=null,forcePrefix:h="",title:g}){let f=t?.name?h&&t.name.startsWith(h)?t.name.slice(h.length):t.name:"",[b,v]=(0,n.useState)(f),[j,y]=(0,n.useState)(t?.models||[]),[k,w]=(0,n.useState)(!1),[N,C]=(0,n.useState)(!1),[S,O]=(0,n.useState)(""),[F,I]=(0,n.useState)({});(0,n.useEffect)(()=>{e&&fetch("/api/models/alias").then(e=>e.ok?e.json():null).then(e=>e&&I(e.aliases||{})).catch(()=>{})},[e]);let W=e=>{if(!e.trim())return O("Name is required"),!1;let t=h+e;return d.test(t)?(O(""),!0):(O("Only letters, numbers, -, _ and . allowed"),!1)},P=e=>{let t=e.target.value;h&&t.startsWith(h)&&(t=t.slice(h.length)),v(t),t?W(t):O("")},T=async()=>{W(b)&&(C(!0),await m({name:h+b.trim(),models:j}),C(!1))},E=!!t;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.default,{isOpen:e,onClose:a,title:g||(E?"Edit Combo":"Create Combo"),children:(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsxs)("div",{children:[h?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("label",{className:"text-sm font-medium mb-1 block",children:"Combo Name"}),(0,r.jsxs)("div",{className:"flex items-stretch",children:[(0,r.jsx)("span",{className:"inline-flex items-center px-2 rounded-l border border-r-0 border-black/10 dark:border-white/10 bg-black/[0.04] dark:bg-white/[0.04] text-text-muted font-mono text-sm",children:h}),(0,r.jsx)("input",{value:b,onChange:P,placeholder:"my-combo",className:"flex-1 min-w-0 rounded-r border border-black/10 dark:border-white/10 bg-white dark:bg-black/20 px-2 py-1.5 font-mono text-sm outline-none focus:border-primary"})]}),S&&(0,r.jsx)("p",{className:"text-[11px] text-red-500 mt-0.5",children:S})]}):(0,r.jsx)(i.default,{label:"Combo Name",value:b,onChange:P,placeholder:"my-combo",error:S}),(0,r.jsxs)("p",{className:"text-[10px] text-text-muted mt-0.5",children:[h?`Auto-prefixed with "${h}". `:"","Only letters, numbers, -, _ and . allowed"]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===j.length?(0,r.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,r.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:j.map((e,t)=>(0,r.jsx)(c,{index:t,model:e,isFirst:0===t,isLast:t===j.length-1,onEdit:e=>{let a=[...j];a[t]=e,y(a)},onMoveUp:()=>(e=>{if(0===e)return;let t=[...j];[t[e-1],t[e]]=[t[e],t[e-1]],y(t)})(t),onMoveDown:()=>(e=>{if(e===j.length-1)return;let t=[...j];[t[e],t[e+1]]=[t[e+1],t[e]],y(t)})(t),onRemove:()=>y(j.filter((e,a)=>a!==t))},t))}),(0,r.jsxs)("button",{onClick:()=>w(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-primary font-medium hover:text-primary hover:border-primary/50 transition-colors flex items-center justify-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,r.jsx)(l.default,{onClick:a,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,r.jsx)(l.default,{onClick:T,fullWidth:!0,size:"sm",disabled:!b.trim()||!!S||N,children:N?"Saving...":E?"Save":"Create"})]})]})}),k&&(0,r.jsx)(o.default,{isOpen:k,onClose:()=>w(!1),onSelect:e=>{j.includes(e.value)||y([...j,e.value])},onDeselect:e=>{y(j.filter(t=>t!==e.value))},activeProviders:x,modelAliases:F,title:"Add Model to Combo",kindFilter:p,addedModelValues:j,closeOnSelect:!1})]})}},50378:(e,t,a)=>{a.d(t,{default:()=>o});var r=a(95155),n=a(12115),s=a(31474),i=a(92542),l=a(28067);function o({currentPage:e,pageSize:t,totalItems:a,onPageChange:d,onPageSizeChange:c,className:u,pageSizeOptions:m=[10,20,50],allowCustomPageSize:x=!1,maxPageSize:p=500}){let[h,g]=(0,n.useState)(!1),[f,b]=(0,n.useState)(String(t)),v=()=>{let e=Number.parseInt(f,10);if(!Number.isFinite(e))return void b(String(t));let a=Math.min(p,Math.max(1,e));b(String(a)),a!==t&&c(a)},j=Math.ceil(a/t),y=a>0?(e-1)*t+1:0,k=Math.min(e*t,a),w=(()=>{let t=[],a=Math.max(1,e-2),r=Math.min(j,a+5-1);r-a+1<5&&(a=Math.max(1,r-5+1));for(let e=a;e<=r;e++)t.push(e);return t})();return(0,r.jsxs)("div",{className:(0,s.cn)("flex flex-col gap-2 py-4 px-2",u),children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 sm:gap-4",children:[a>0&&(0,r.jsxs)("div",{className:"whitespace-nowrap text-sm text-text-muted",children:["Showing ",(0,r.jsx)("span",{className:"font-medium text-text-main",children:y})," to"," ",(0,r.jsx)("span",{className:"font-medium text-text-main",children:k})," of"," ",(0,r.jsx)("span",{className:"font-medium text-text-main",children:a})," results"]}),c&&(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-sm text-text-muted",children:"Rows:"}),(0,r.jsx)(l.default,{size:"sm",value:h&&x?"__custom__":String(t),options:[...m.map(e=>({value:String(e),label:String(e)})),...x?[{value:"__custom__",label:"Custom"}]:[]],onChange:e=>{if("__custom__"===e){g(!0),b(String(t));return}g(!1),c(Number(e))}}),h&&x&&(0,r.jsx)("input",{type:"number",min:"1",max:String(p),value:f,onChange:e=>b(e.target.value),onBlur:v,onKeyDown:e=>{"Enter"===e.key&&v()},className:(0,s.cn)("h-7 w-20 rounded-[8px] border border-border bg-surface-2","px-2 text-xs text-text-main focus:outline-none focus:ring-2 focus:ring-brand-500/30","transition-all"),style:{colorScheme:"auto"},"aria-label":"Custom accounts per page"})]})]}),j>1&&(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(i.default,{variant:"outline",size:"sm",onClick:()=>d(e-1),disabled:1===e,className:"w-9 px-0","aria-label":"Go to previous page",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_left"})}),(0,r.jsxs)("span",{className:"px-2 text-sm text-text-muted sm:hidden",children:["Page ",(0,r.jsx)("span",{className:"font-medium text-text-main",children:e})," of"," ",(0,r.jsx)("span",{className:"font-medium text-text-main",children:j})]}),(0,r.jsxs)("div",{className:"hidden items-center gap-1 sm:flex",children:[w[0]>1&&(0,r.jsx)(i.default,{variant:"ghost",size:"sm",onClick:()=>d(1),className:"w-9 px-0","aria-label":"Go to first page",children:"1"}),w[0]>2&&(0,r.jsx)(i.default,{variant:"ghost",size:"sm",onClick:()=>d(Math.max(1,e-5)),className:"w-9 px-0","aria-label":"Jump 5 pages back",children:"..."}),w.map(t=>{let a=e===t;return(0,r.jsx)(i.default,{variant:a?"primary":"ghost",size:"sm",onClick:()=>d(t),className:"w-9 px-0","aria-label":`Go to page ${t}`,"aria-current":a?"page":void 0,children:t},t)}),w[w.length-1]<j-1&&(0,r.jsx)(i.default,{variant:"ghost",size:"sm",onClick:()=>d(Math.min(j,e+5)),className:"w-9 px-0","aria-label":"Jump 5 pages forward",children:"..."}),w[w.length-1]<j&&(0,r.jsx)(i.default,{variant:"ghost",size:"sm",onClick:()=>d(j),className:"w-9 px-0","aria-label":"Go to last page",children:j})]}),(0,r.jsx)(i.default,{variant:"outline",size:"sm",onClick:()=>d(e+1),disabled:e===j,className:"w-9 px-0","aria-label":"Go to next page",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_right"})})]})})]})}},51825:(e,t,a)=>{a.d(t,{default:()=>i});var r=a(95155),n=a(84588);let s={mode:{label:"Mode",format:e=>e},defaultModel:{label:"Model",format:e=>e,mono:!0},baseUrl:{label:"Endpoint",format:e=>e,isLink:!0,mono:!0},costPerQuery:{label:"Cost / call",format:e=>0===e?"Free":`$${e.toFixed(4)}`},pricingUrl:{label:"Pricing",format:()=>"View pricing",isLink:!0},freeTier:{label:"Free tier",format:e=>e},freeMonthlyQuota:{label:"Free quota",format:e=>0===e?"—":e>=999999?"Unlimited":`${e.toLocaleString()} / mo`},searchTypes:{label:"Types",format:e=>e.join(", ")},formats:{label:"Formats",format:e=>e.join(", ")},maxMaxResults:{label:"Max results",format:e=>e},maxCharacters:{label:"Max chars",format:e=>e.toLocaleString()}};function i({config:e,provider:t,title:a="Provider Info"}){if(!e)return null;let l=Object.entries(s).filter(([t])=>void 0!==e[t]&&null!==e[t]&&""!==e[t]).map(([t,a])=>({key:t,label:a.label,value:a.format(e[t]),isLink:a.isLink,mono:a.mono,raw:e[t]})),o=t?.notice?.apiKeyUrl||t?.website,d=t?.notice?.text;return(0,r.jsxs)(n.default,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:a}),o&&(0,r.jsxs)("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),"Get API Key"]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-2",children:[l.map(e=>(0,r.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,r.jsx)("span",{className:"text-xs text-text-muted w-28 shrink-0",children:e.label}),e.isLink?(0,r.jsx)("a",{href:e.raw,target:"_blank",rel:"noopener noreferrer",className:`text-sm text-primary hover:underline truncate ${e.mono?"font-mono":""}`,children:e.value}):(0,r.jsx)("span",{className:`text-sm text-text-main truncate ${e.mono?"font-mono":""}`,children:e.value})]},e.key)),d&&(0,r.jsxs)("div",{className:"flex items-start gap-3 min-w-0 sm:col-span-2",children:[(0,r.jsx)("span",{className:"text-xs text-text-muted w-28 shrink-0 mt-0.5",children:"Notice"}),(0,r.jsx)("span",{className:"text-sm text-text-main leading-relaxed",children:d})]})]})]})}},56061:(e,t,a)=>{a.d(t,{default:()=>l});var r=a(95155),n=a(31474);let s={default:"bg-surface-2 text-text-muted",primary:"bg-brand-500/10 text-brand-600 dark:text-brand-300",success:"bg-green-500/10 text-green-600 dark:text-green-400",warning:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",error:"bg-red-500/10 text-red-600 dark:text-red-400",info:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},i={sm:"px-2 py-0.5 text-[10px]",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1.5 text-sm"};function l({children:e,variant:t="default",size:a="md",dot:o=!1,icon:d,className:c}){return(0,r.jsxs)("span",{className:(0,n.cn)("inline-flex items-center gap-1.5 rounded-full font-semibold",s[t],i[a],c),children:[o&&(0,r.jsx)("span",{className:(0,n.cn)("size-1.5 rounded-full","success"===t&&"bg-green-500","warning"===t&&"bg-yellow-500","error"===t&&"bg-red-500","info"===t&&"bg-blue-500","primary"===t&&"bg-brand-500","default"===t&&"bg-gray-500")}),d&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:d}),e]})}},56319:(e,t,a)=>{a.d(t,{default:()=>s});var r=a(95155),n=a(31474);function s({src:e,alt:t="Avatar",name:a,size:i="md",className:l}){let o={xs:"size-6 text-xs",sm:"size-8 text-sm",md:"size-10 text-base",lg:"size-12 text-lg",xl:"size-16 text-xl"};return e?(0,r.jsx)("div",{className:(0,n.cn)("rounded-full bg-cover bg-center bg-no-repeat","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[i],l),style:{backgroundImage:`url(${e})`},role:"img","aria-label":t}):(0,r.jsx)("div",{className:(0,n.cn)("rounded-full flex items-center justify-center font-semibold text-white","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[i],(e=>{if(!e)return"bg-primary";let t=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],a=e.charCodeAt(0)%t.length;return t[a]})(a),l),role:"img","aria-label":t,children:(e=>{if(!e)return"?";let t=e.split(" ");return t.length>=2?`${t[0][0]}${t[1][0]}`.toUpperCase():e.substring(0,2).toUpperCase()})(a)})}},57151:(e,t,a)=>{a.d(t,{Q5:()=>function e(t,a=null,r=null,n=0){if(!t?.length||n>6)return null;let s=t.map(t=>{let s="string"==typeof t?t.trim():String(t?.model||t?.id||"").trim();if(!s)return null;if(!s.includes("/")&&a?.[s])return e(a[s],a,r,n+1)??r?.(s)??N(null,s);let i=s.indexOf("/"),l=N(-1===i?null:s.slice(0,i),-1===i?s:s.slice(i+1)),o=r?.(s);return o?{...l,...o}:l}).filter(Boolean);if(!s.length)return null;let i=s[0];return{vision:s.some(e=>e.vision),pdf:s.some(e=>e.pdf),audioInput:s.some(e=>e.audioInput),videoInput:s.some(e=>e.videoInput),imageOutput:s.some(e=>e.imageOutput),audioOutput:s.some(e=>e.audioOutput),search:s.some(e=>e.search),tools:s.every(e=>e.tools),reasoning:i.reasoning,thinkingFormat:i.thinkingFormat,thinkingCanDisable:i.thinkingCanDisable,thinkingRange:i.thinkingRange,contextWindow:Math.min(...s.map(e=>e.contextWindow)),maxOutput:Math.max(...s.map(e=>e.maxOutput))}},nl:()=>N});var r=a(47224);let n="[-_/:.]",s=RegExp(`(^|${n})(image|img)(${n}|$)|stable-image|gen[0-9]_image|nanobanana|imagine|t2v|i2v|flux|dall|sdxl|diffusion|embed|rerank|guard|moderation|tts|stt|whisper|voice|speech|audio`,"i"),i=RegExp(`(^|${n})(vision|vl|vlm|multimodal|omni|visual)(${n}|$)|[0-9]\\.[0-9]+v(${n}|$)|(^|${n})glm-[0-9]+v(${n}|$)|(^|[-_/:.])(llava|pixtral|internvl|cogvlm|minicpm-v|moondream|idefics|fuyu)`,"i"),l={vision:!1,pdf:!1,audioInput:!1,videoInput:!1,imageOutput:!1,audioOutput:!1,search:!1,tools:!0,reasoning:!1,thinkingFormat:null,thinkingLevels:null,thinkingCanDisable:!0,thinkingRange:null,thinkingEffortSupported:!1,contextWindow:2e5,maxOutput:64e3},o={"claude-fable-5-1":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},"claude-opus-5.5":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5.5-thinking":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5.5-agentic":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5.5-thinking-agentic":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-thinking":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-agentic":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-thinking-agentic":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.6":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.7":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-7":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.8":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-6":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-8":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.8-thinking":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-8-thinking":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-4.6":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-4-6":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5-5":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-sonnet-5":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5-thinking":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5-agentic":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5-thinking-agentic":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"gpt-image-1":{imageOutput:!0,tools:!1},"glm-5.3-flash":{vision:!0,videoInput:!0,pdf:!0,reasoning:!0,thinkingFormat:"zai",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:131072},"glm-4.6v":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"zai",contextWindow:128e3,maxOutput:32768},"glm-4.5v":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"zai",contextWindow:64e3,maxOutput:16384},"glm-5.2":{reasoning:!0,thinkingFormat:"zai",thinkingEffortSupported:!0,thinkingCanDisable:!1,contextWindow:1e6,maxOutput:131072},"deepseek-v4.1-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-v4-1-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:128e3,maxOutput:64e3},"deepseek-v4-flash-vision-exp":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"vision-model":{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6},"coder-model":{reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6},"x-preview-f-free":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"opencode",contextWindow:1e6,maxOutput:131072},"big-pickle":{reasoning:!0,thinkingFormat:"opencode",contextWindow:2e5,maxOutput:32e3},"muse-spark-1.2":{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"opencode",contextWindow:1048576,maxOutput:131072},"muse-spark-1.2-contributor-free":{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"opencode",contextWindow:1048576,maxOutput:131072},"mimo-v2.5-free":{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"opencode",contextWindow:2e5,maxOutput:32e3},"kimi-k3":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072},k3:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072},"kimi-for-coding":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"kimi-for-coding-highspeed":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"kimi-k2.7-code":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"kimi-k2.7-code-highspeed":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"muse-spark-1.2-contributor-free":{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:131072},"muse-spark-1.3-contributor-free":{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:131072},"muse-spark-1.3-contributor":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072},"union-alpha":{vision:!0,contextWindow:262144,maxOutput:131072}},d={vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:272e3,maxOutput:128e3},c=["minimal","low","medium","high","xhigh","max","ultra"],u={vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",thinkingCanDisable:!1,thinkingLevels:c,contextWindow:372e3,maxOutput:128e3},m={vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",thinkingCanDisable:!1,thinkingLevels:c,contextWindow:272e3,maxOutput:128e3},x={vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",thinkingCanDisable:!1,thinkingLevels:["minimal","low","medium","high","xhigh","max"],contextWindow:272e3,maxOutput:128e3},p={...x,contextWindow:872e3},h={vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:128e3},g={reasoning:!0,thinkingFormat:"qoder",thinkingCanDisable:!0,maxOutput:64e3},f={...g,vision:!0},b={auto:f,qmodel_preview:f,qmodel_latest:f,qmodel:f,q36fmodel:f,dmodel:f,dfmodel:{...f,reasoning:!1},gm51model:f,kmodel:f,mmodel:{reasoning:!1,vision:!1,thinkingFormat:"openai",thinkingCanDisable:!0,maxOutput:64e3},gmodel:f,gfmodel:f,kmodel_latest:f,qfmodel:f,qmodel_38max:f,ultimate:g,performance:g,efficient:g,lite:g},v={qoder:b,"qoderwork-cn":b,deepseek:{"deepseek-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-v4-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-v4-flash-vision-exp":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3}},nvidia:{"minimaxai/minimax-m3":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:512e3,maxOutput:131072},"z-ai/glm-5.2":{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:128e3},"deepseek-ai/deepseek-v4-flash-0731":{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:65536}},codex:{"gpt-6-astra":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:272e3,maxOutput:128e3},"gpt-6-sol":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:272e3,maxOutput:128e3},"gpt-6-luna":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:272e3,maxOutput:128e3},"gpt-6-astra[1m]":p,"gpt-6-sol[1m]":p,"gpt-6-luna[1m]":p,"gpt-5.6-sol[1m]":p,"gpt-5.6-terra[1m]":p,"gpt-5.6-luna[1m]":p,"gpt-5.6-sol":u,"gpt-5.6-sol-review":u,"gpt-5.6-terra":m,"gpt-5.6-terra-review":m,"gpt-5.6-luna":x,"gpt-5.6-luna-review":x},kiro:{"gpt-5.6-sol":d,"gpt-5.6-terra":d,"gpt-5.6-luna":d,"gpt-5.6-sol-thinking":d,"gpt-5.6-terra-thinking":d,"gpt-5.6-luna-thinking":d,"gpt-5.6-sol-agentic":d,"gpt-5.6-terra-agentic":d,"gpt-5.6-luna-agentic":d,"gpt-5.6-sol-thinking-agentic":d,"gpt-5.6-terra-thinking-agentic":d,"gpt-5.6-luna-thinking-agentic":d},"devin-cli":{"gpt-5.4-high":h,"gpt-5.4-medium":h,"gpt-5.4-low":h,"gpt-5.5-xhigh":h,"gpt-5.5-high":h,"gpt-5.5-medium":h,"gpt-5.5-low":h},"codebuddy-cn":{"glm-5.2":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:48e3},"glm-5.1":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:48e3},"glm-5v-turbo":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:38e3},"minimax-m3":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:512e3,maxOutput:48e3},"kimi-k2.7":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:256e3,maxOutput:32e3},"kimi-k2.6":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:256e3,maxOutput:32e3},"kimi-k2.5":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:164e3,maxOutput:32e3},"hy3-preview":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:192e3,maxOutput:64e3},"deepseek-v4-flash":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:5e4},"deepseek-v3-2-volc":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:96e3,maxOutput:32e3},hy3:{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:192e3,maxOutput:64e3},"hy4-preview":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:64e3},"glm-5.3":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:48e3},"glm-5.3-flash":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:32e3},"kimi-k3-1":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:32e3},"deepseek-v4-pro":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:5e4},"deepseek-v4.1-flash":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:128e3}},"codebuddy-intl":{"deepseek-v4.1-flash":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:128e3}},poolside:{"laguna-s-2.1":{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:32e3},"laguna-xs-2.1":{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:32e3}},nous:{"nousresearch/hermes-4-70b":{tools:!1,reasoning:!0,thinkingFormat:"nous",contextWindow:131072,maxOutput:32e3},"nousresearch/hermes-4-405b":{tools:!1,reasoning:!0,thinkingFormat:"nous",contextWindow:131072,maxOutput:32e3}},meta:{"muse-spark-1.2-contributor":{reasoning:!0,thinkingFormat:"meta",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:64e3},"muse-spark-1.2":{reasoning:!0,thinkingFormat:"meta",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:64e3},"muse-spark-1.1":{reasoning:!0,thinkingFormat:"meta",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:64e3}},ollama:{"deepseek-v4.1-flash:cloud":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3}}};v["qoder-cn"]=v.qoder,v.cx=v.codex,v.dv=v["devin-cli"],v.devin=v["devin-cli"],v.ds=v.deepseek;let j=[{pattern:"*qoder*",caps:g},{pattern:"*claude*opus-5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*sonnet-5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*opus-4.6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*opus-4.7*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*opus-4.8*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*sonnet-4.6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*sonnet-4.7*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*haiku*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*opus*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*sonnet*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*fable*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*mythos*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude-3*",caps:{vision:!0}},{pattern:"*claude*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*gemini*image*",caps:{vision:!0,imageOutput:!0,contextWindow:1048576}},{pattern:"*gemini-4*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-3.8*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-3.7*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-3*pro*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65535}},{pattern:"*gemini-3*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-2.5*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-budget",thinkingRange:{min:0,max:24576},contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-2*",caps:{vision:!0,audioInput:!0,videoInput:!0,search:!0,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini*",caps:{vision:!0,search:!0,contextWindow:1048576}},{pattern:"*gemma*",caps:{vision:!0,contextWindow:128e3}},{pattern:"*nanobanana*",caps:{vision:!0,imageOutput:!0}},{pattern:"*gpt-6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:105e4,maxOutput:128e3}},{pattern:"*gpt-5*image*",caps:{imageOutput:!0}},{pattern:"*gpt-5*codex*",caps:{reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:4e5,maxOutput:128e3}},{pattern:"*gpt-5.4-mini*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:4e5,maxOutput:128e3}},{pattern:"*gpt-5.4-nano*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:4e5,maxOutput:128e3}},{pattern:"*gpt-5.4*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:105e4,maxOutput:128e3}},{pattern:"*gpt-5.5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:105e4,maxOutput:128e3}},{pattern:"*gpt-5.6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:105e4,maxOutput:128e3}},{pattern:"*gpt-5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:4e5,maxOutput:128e3}},{pattern:"*gpt-4o*",caps:{vision:!0,search:!0,contextWindow:128e3,maxOutput:16384}},{pattern:"*gpt-4.1*",caps:{vision:!0,contextWindow:1e6,maxOutput:32768}},{pattern:"*gpt-4-turbo*",caps:{vision:!0,contextWindow:128e3}},{pattern:"*gpt-4*",caps:{contextWindow:128e3}},{pattern:"*gpt-3.5*",caps:{contextWindow:16385,maxOutput:4096}},{pattern:"*gpt-oss*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:128e3}},{pattern:"*solar-pro*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:32e3}},{pattern:"*longcat*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:32e3}},{pattern:"*o1-mini*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:128e3}},{pattern:"*o1*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:1e5}},{pattern:"*o3*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:1e5}},{pattern:"*o4*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:1e5}},{pattern:"*grok*image*",caps:{imageOutput:!0}},{pattern:"*grok-code*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:256e3}},{pattern:"*grok-4.6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:5e5,maxOutput:5e5}},{pattern:"*grok-4.5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:5e5,maxOutput:64e3}},{pattern:"*grok-4*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:256e3}},{pattern:"*grok-3*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:131072}},{pattern:"*grok*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:256e3}},{pattern:"*qwen*vl*",caps:{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*qwen*omni*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:262144,maxOutput:65536}},{pattern:"*qwen*coder*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6}},{pattern:"*qwen3.8-2.4t*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*qwen3.8*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen*max*",caps:{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.5*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.6*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.7*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.8*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen*plus*",caps:{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen*235b*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*qwq*",caps:{reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:131072}},{pattern:"*qwen*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*longcat-2.5*",caps:{reasoning:!0,contextWindow:65e4}},{pattern:"*kimi*k3*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*kimi*for-coding*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536}},{pattern:"*kimi*k2.7*code*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536}},{pattern:"*kimi*k2*",caps:{vision:!0,reasoning:!0,thinkingFormat:"kimi",contextWindow:262144,maxOutput:262144}},{pattern:"*kimi*",caps:{reasoning:!0,thinkingFormat:"kimi",contextWindow:262144}},{pattern:"*glm-5.3-flash*",caps:{vision:!0,videoInput:!0,pdf:!0,reasoning:!0,thinkingFormat:"zai",thinkingEffortSupported:!0,thinkingCanDisable:!1,contextWindow:1e6,maxOutput:131072}},{pattern:"*glm-5.3*",caps:{reasoning:!0,thinkingFormat:"zai",thinkingEffortSupported:!0,contextWindow:2e5,maxOutput:128e3}},{pattern:"*glm-5.2*",caps:{reasoning:!0,thinkingFormat:"zai",thinkingEffortSupported:!0,contextWindow:2e5,maxOutput:128e3}},{pattern:"*glm-5*",caps:{reasoning:!0,thinkingFormat:"zai",contextWindow:2e5,maxOutput:128e3}},{pattern:"*glm-4.7*",caps:{reasoning:!0,thinkingFormat:"zai",contextWindow:2e5,maxOutput:128e3}},{pattern:"*glm-4*",caps:{reasoning:!0,thinkingFormat:"zai",contextWindow:2e5}},{pattern:"*glm*",caps:{reasoning:!0,thinkingFormat:"zai",contextWindow:2e5}},{pattern:"*deepseek-v4*vision*",caps:{vision:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:384e3}},{pattern:"*deepseek-v4.1*",caps:{vision:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:128e3}},{pattern:"*deepseek-v4*",caps:{reasoning:!0,thinkingFormat:"deepseek",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:384e3}},{pattern:"*reasoner*",caps:{reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:128e3}},{pattern:"*deepseek-r*",caps:{reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:128e3}},{pattern:"*deepseek-chat*",caps:{contextWindow:128e3}},{pattern:"*deepseek*",caps:{reasoning:!0,thinkingFormat:"deepseek",contextWindow:128e3}},{pattern:"*minimax*image*",caps:{imageOutput:!0}},{pattern:"*minimax-m3*",caps:{vision:!0,reasoning:!0,thinkingFormat:"minimax",contextWindow:1e6,maxOutput:131072}},{pattern:"*minimax-m2.7*",caps:{vision:!0,reasoning:!0,thinkingFormat:"minimax",thinkingCanDisable:!1,contextWindow:204800,maxOutput:131072}},{pattern:"*minimax-m2.5*",caps:{vision:!0,reasoning:!0,thinkingFormat:"minimax",thinkingCanDisable:!1,contextWindow:204800,maxOutput:131072}},{pattern:"*minimax*",caps:{reasoning:!0,thinkingFormat:"minimax",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:131072}},{pattern:"*mimo*v2.6*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*mimo*v2.5*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*mimo*omni*",caps:{vision:!0,audioInput:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:262144,maxOutput:131072}},{pattern:"*mimo*",caps:{vision:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:262144,maxOutput:131072}},{pattern:"*llama-4*",caps:{vision:!0,contextWindow:1e6}},{pattern:"*llama*",caps:{contextWindow:128e3}},{pattern:"*codestral*",caps:{contextWindow:256e3}},{pattern:"*mistral-large*",caps:{vision:!0,contextWindow:256e3}},{pattern:"*mistral*",caps:{contextWindow:128e3}},{pattern:"*command-a-vision*",caps:{vision:!0,contextWindow:128e3}},{pattern:"*command*",caps:{contextWindow:128e3}},{pattern:"*sonar*",caps:{search:!0,contextWindow:128e3}},{pattern:"*pplx*",caps:{search:!0,contextWindow:128e3}},{pattern:"*perplexity*",caps:{search:!0,contextWindow:128e3}},{pattern:"*laguna-s-2.1*free*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:32e3}},{pattern:"*laguna-s-2.1*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:32e3}},{pattern:"*laguna*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:32e3}},{pattern:"*muse-spark*free*",caps:{vision:!0,videoInput:!0,audioInput:!0,reasoning:!0,search:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1048576,maxOutput:131072}},{pattern:"*muse-spark*",caps:{vision:!0,videoInput:!0,audioInput:!0,reasoning:!0,search:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*muse*spark*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:131072}},{pattern:"*muse-glimmer*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:128e3}},{pattern:"*muse*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:128e3}},{pattern:"*hunyuan*",caps:{reasoning:!0,thinkingFormat:"hunyuan",contextWindow:262144,maxOutput:262144}},{pattern:"hy3*",caps:{reasoning:!0,thinkingFormat:"hunyuan",contextWindow:262144,maxOutput:262144}},{pattern:"*step-3.7*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"step",contextWindow:262144,maxOutput:65536}},{pattern:"*step-*",caps:{reasoning:!0,thinkingFormat:"step",contextWindow:128e3}},{pattern:"*nemotron*",caps:{reasoning:!0,contextWindow:128e3}},{pattern:"*ling-*",caps:{reasoning:!0,contextWindow:128e3}}],y=["vision","pdf","audioInput","videoInput"];function k(e,t,a){let r={...l,...e},n="u"<typeof globalThis?null:globalThis.__9rCatalogSource||null;if(n){let e=n.getModalities(t,a);if(e)for(let t of y)!0===e[t]&&(r[t]=!0);let s=n.getLimits(t,a);s&&(s.contextWindow>0&&(r.contextWindow=s.contextWindow),s.maxOutput>0&&(r.maxOutput=s.maxOutput))}return!r.vision&&function(e){if(!e)return!1;let t=String(e).toLowerCase();return!s.test(t)&&i.test(t)}(a)&&(r.vision=!0),r}let w=new Set(["deepseek/deepseek-v4-pro","deepseek/deepseek-v4-flash","deepseek/deepseek-v4-flash-fast","zai-org/glm-5.3","zai-org/glm-5.2","zai-org/glm-5.2-fast","zai-org/glm-5.1","zai-org/glm-5","minimaxai/minimax-m2.7","minimax/minimax-m2.7-free","minimaxai/minimax-m2.5","xiaomi/mimo-v2.5-pro","qwen/qwen3.6-max-preview","qwen/qwen3.7-max","meituan/longcat-2.0:free","stepfun/step-3.5-flash","tencent/hy4-preview","tencent/hy3","tencent/hy3-paid","nvidia/nemotron-3-ultra-550b-a55b","poolside/laguna-s-2.1-free","inclusionai/ling-3.0-flash-free","inclusionai/ling-3.0-flash-sante:free"]);function N(e,t){if(!t)return{...l};let a=t.includes("/")?t.split("/").pop():t;if("commandcode"===e||"cmc"===e){let e=v.commandcode;return e?.[t]?{...l,...e[t]}:e?.[a]?{...l,...e[a]}:{...l,reasoning:!0,thinkingFormat:"commandcode",thinkingEffortSupported:!0,vision:!function(e){let t=String(e||"").toLowerCase();if(w.has(t))return!0;for(let e of w){let a=e.includes("/")?e.slice(e.lastIndexOf("/")+1):e;if(t===a||t.endsWith("/"+a))return!0}return!1}(t),contextWindow:1e6,maxOutput:384e3}}if(e){let r=v[e];if(r?.[t])return{...l,...r[t]};if(r?.[a])return{...l,...r[a]}}if(o[a])return k(o[a],e,t);if(o[t])return k(o[t],e,t);for(let{pattern:n,caps:s}of j)if((0,r.gH)(n,a)||(0,r.gH)(n,t))return k(s,e,t);return k(null,e,t)}},57250:(e,t,a)=>{a.d(t,{A:()=>o});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(8247);function o({src:e,providerId:t,alt:a,size:s=32,className:i="",fallbackText:d="?",fallbackColor:c}){let u=function(e,t){if(t)return(0,l.HY)(t);if(!e)return null;let a=String(e).match(/^\/providers\/([^/]+)\.png$/i);return a?(0,l.HY)(a[1]):e}(e,t),[m,x]=(0,n.useState)(!1);return!u||m?(0,r.jsx)("span",{className:`inline-flex items-center justify-center font-bold rounded-lg ${i}`.trim(),style:{width:s,height:s,color:c,fontSize:Math.max(10,Math.floor(.38*s))},children:d}):(0,r.jsx)("img",{src:u,alt:a,width:s,height:s,className:i,loading:"lazy",decoding:"async",onError:()=>{let e=u.match(/^\/providers\/([^/]+)\.png$/i);e&&(0,l.Kw)(e[1]),t&&(0,l.Kw)(t),x(!0)}})}o.propTypes={src:i().string,providerId:i().string,alt:i().string,size:i().number,className:i().string,fallbackText:i().string,fallbackColor:i().string}},62899:(e,t,a)=>{a.d(t,{default:()=>c});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(90882),o=a(85416),d=a(94230);function c({isOpen:e,providerInfo:t,onSuccess:a,onClose:s}){let[i,u]=(0,n.useState)(null),[m,x]=(0,n.useState)(null),[p,h]=(0,n.useState)(null),g=(0,n.useCallback)((e,t)=>{"builder-id"===e?u("builder-id"):"idc"===e?(u("idc"),h(t)):"social"===e?(u("social"),x(t.provider)):("import"===e||"import-cli-proxy"===e||"api-key"===e)&&a?.()},[a]),f=()=>{u(null),x(null),h(null)};return i?"builder-id"===i||"idc"===i?(0,r.jsx)(l.default,{isOpen:e,provider:"kiro",providerInfo:t,onSuccess:()=>{u(null),h(null),a?.(),s?.()},onClose:f,idcConfig:p}):"social"===i&&m?(0,r.jsx)(d.default,{isOpen:e,provider:m,onSuccess:()=>{u(null),x(null),a?.(),s?.()},onClose:f}):null:(0,r.jsx)(o.default,{isOpen:e,onMethodSelect:g,onClose:s})}c.propTypes={isOpen:i().bool.isRequired,providerInfo:i().shape({name:i().string}),onSuccess:i().func,onClose:i().func.isRequired}},65921:(e,t,a)=>{a.d(t,{i:()=>s});var r=a(1934);let n=0,s=(0,r.v)((e,t)=>({notifications:[],addNotification:a=>{let r=++n,s={id:r,type:a.type||"info",message:a.message,title:a.title||null,duration:a.duration??5e3,dismissible:a.dismissible??!0,createdAt:Date.now()};return e(e=>({notifications:[...e.notifications,s]})),s.duration>0&&setTimeout(()=>t().removeNotification(r),s.duration),r},removeNotification:t=>{e(e=>({notifications:e.notifications.filter(e=>e.id!==t)}))},clearAll:()=>e({notifications:[]}),success:(e,a)=>t().addNotification({type:"success",message:e,title:a}),error:(e,a)=>t().addNotification({type:"error",message:e,title:a,duration:8e3}),warning:(e,a)=>t().addNotification({type:"warning",message:e,title:a}),info:(e,a)=>t().addNotification({type:"info",message:e,title:a})}))},67968:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(95155),n=a(12115),s=a(47650);let i=[{icon:"terminal",label:"Terminal",desc:"Full shell access"},{icon:"cast",label:"Desktop",desc:"Screen sharing"},{icon:"folder_open",label:"Files",desc:"Browse & edit files"}],l=[{icon:"qr_code_scanner",text:"Scan QR to connect instantly"},{icon:"wifi_off",text:"No port forwarding needed"},{icon:"devices",text:"Works on any device"}];function o({isOpen:e,onClose:t}){return((0,n.useEffect)(()=>{if(!e)return;document.body.style.overflow="hidden";let a=e=>{"Escape"===e.key&&t()};return document.addEventListener("keydown",a),()=>{document.body.style.overflow="",document.removeEventListener("keydown",a)}},[e,t]),e)?(0,s.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:t}),(0,r.jsxs)("div",{className:"relative w-full max-w-sm rounded-[14px] overflow-hidden shadow-[var(--shadow-elev)] fade-in flex flex-col bg-surface border border-border-subtle",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border-subtle",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-7 h-7 rounded-[8px] flex items-center justify-center bg-primary",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-white text-base",children:"terminal"})}),(0,r.jsx)("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-mono",children:"9Remote"})]}),(0,r.jsx)("button",{onClick:t,className:"p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-base",children:"close"})})]}),(0,r.jsxs)("div",{className:"px-7 py-7 pb-9 flex flex-col gap-6",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center mt-2",children:[(0,r.jsx)("div",{className:"w-14 h-14 rounded-[14px] flex items-center justify-center mb-1 bg-primary shadow-[var(--shadow-warm)]",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-white text-[30px]",children:"terminal"})}),(0,r.jsx)("h1",{className:"text-lg font-bold text-text-main tracking-tight",children:"9Remote"}),(0,r.jsx)("p",{className:"text-xs text-text-muted leading-5 max-w-[220px]",children:"Access your terminal, desktop & files from anywhere"})]}),(0,r.jsx)("div",{className:"flex gap-2 w-full",children:i.map(({icon:e,label:t,desc:a})=>(0,r.jsxs)("div",{className:"flex-1 flex flex-col items-center gap-1.5 py-4 px-1 rounded-[10px] border border-border-subtle bg-surface-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-[22px]",children:e}),(0,r.jsx)("p",{className:"text-xs font-semibold text-text-main",children:t}),(0,r.jsx)("p",{className:"text-[10px] text-text-muted text-center leading-4",children:a})]},t))}),(0,r.jsx)("div",{className:"flex flex-col gap-3 w-full",children:l.map(({icon:e,text:t})=>(0,r.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined flex-shrink-0 text-primary text-[16px]",children:e}),(0,r.jsx)("span",{className:"text-xs text-text-muted",children:t})]},e))}),(0,r.jsxs)("button",{onClick:()=>window.open("https://9remote.cc","_blank"),className:"w-full py-3 flex items-center justify-center gap-2 text-sm font-semibold text-white rounded-[10px] bg-primary hover:bg-primary-hover shadow-[var(--shadow-warm)] active:scale-[0.98] transition-all",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base",children:"open_in_new"}),"Get 9Remote"]})]})]})]}),document.body):null}function d(){let[e,t]=(0,n.useState)(!1);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{onClick:()=>t(!0),className:"relative flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg transition-all text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5",title:"9Remote",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"computer"}),(0,r.jsx)("span",{className:"text-xs font-medium",children:"Remote"})]}),(0,r.jsx)(o,{isOpen:e,onClose:()=>t(!1)})]})}},72767:(e,t,a)=>{a.d(t,{A:()=>i});var r=a(1934),n=a(90620);let s=null,i=(0,r.v)((e,t)=>({settings:null,loading:!1,error:null,lastFetched:0,invalidate:()=>e({lastFetched:0}),fetchSettings:async({force:a=!1}={})=>{let{lastFetched:r,settings:i}=t();return!a&&i&&Date.now()-r<n.U5?i:s||(e({loading:!0,error:null}),s=(async()=>{try{let t=await fetch("/api/settings"),a=await t.json();if(t.ok)return e({settings:a,loading:!1,lastFetched:Date.now()}),a;e({error:a.error,loading:!1})}catch(t){e({error:"Failed to fetch settings",loading:!1})}finally{s=null}return null})())},patchSettings:async a=>{try{let r=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!r.ok)return null;let n=await r.json();return e({settings:{...t().settings,...n},lastFetched:Date.now()}),n}catch{return null}}}))},72908:(e,t,a)=>{a.d(t,{default:()=>f});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(81127),o=a(57250),d=a(29366),c=a(929),u=a(28777),m=a(88105);let x=[...Object.keys(m.zN),...Object.keys(m.IS),...Object.keys(m.nJ),...Object.keys(m.fg)],p=Object.keys(m.IS).filter(e=>m.IS[e].noAuth),h=["cursor","cline","clinepass","zed"];function g(e,t,a){let[r,s]=(0,n.useState)([]),i=(t??[]).join("|");return(0,n.useEffect)(()=>{let t=i?i.split("|"):[];if(!e||0===t.length)return void s([]);let r=!1;return Promise.all(t.map(async e=>{let t=await fetch(`/api/providers/${e}/models`,{cache:"no-store"});if(!t.ok)return[];let a=await t.json();return Array.isArray(a.models)?a.models:[]})).then(e=>{if(r)return;let t=new Set;s(e.flat().filter(e=>!(!e?.id||t.has(e.id))&&(t.add(e.id),!0)))}).catch(e=>{console.warn(`Unable to load ${a} models for selector:`,e),r||s([])}),()=>{r=!0}},[e,i,a]),r}function f({isOpen:e,onClose:t,onSelect:a,onDeselect:s,selectedModel:i,activeProviders:b=[],title:v="Select Model",modelAliases:j={},kindFilter:y=null,capFilter:k=null,addedModelValues:w=[],closeOnSelect:N=!0,comboContext:C=null}){let S=(0,n.useMemo)(()=>b.filter(e=>{if(!1===e.isActive||m.Q2[e.provider]?.hidden)return!1;if(!y)return!0;let t=m.Q2[e.provider];return(t?.serviceKinds||["llm"]).includes(y)}),[b,y]),{getCaps:O}=(0,c.y)(),[F,I]=(0,n.useState)(""),[W,P]=(0,n.useState)([]),[T,E]=(0,n.useState)([]),[$,_]=(0,n.useState)([]),[z,A]=(0,n.useState)({}),R=(0,n.useMemo)(()=>{let e=Object.fromEntries(h.map(e=>[e,[]]));for(let t of S)t?.id&&Object.prototype.hasOwnProperty.call(e,t.provider)&&e[t.provider].push(t.id);return e},[S]),D=R.cursor,U=R.cline,L=R.clinepass,q=R.zed,M=g(e,D,"Cursor"),V=g(e,U,"Cline"),K=g(e,L,"ClinePass"),J=g(e,q,"Zed"),B=async()=>{try{let e=await fetch("/api/combos");if(!e.ok)throw Error(`Failed to fetch combos: ${e.status}`);let t=await e.json();P(t.combos||[])}catch(e){console.error("Error fetching combos:",e),P([])}};(0,n.useEffect)(()=>{e&&B()},[e]);let G=async()=>{try{let e=await fetch("/api/provider-nodes");if(!e.ok)throw Error(`Failed to fetch provider nodes: ${e.status}`);let t=await e.json();E(t.nodes||[])}catch(e){console.error("Error fetching provider nodes:",e),E([])}};(0,n.useEffect)(()=>{e&&G()},[e]);let Q=async()=>{try{let e=await fetch("/api/models/custom");if(!e.ok)throw Error(`Failed to fetch custom models: ${e.status}`);let t=await e.json();_(t.models||[])}catch(e){console.error("Error fetching custom models:",e),_([])}};(0,n.useEffect)(()=>{e&&Q()},[e]);let H=async()=>{try{let e=await fetch("/api/models/disabled");if(!e.ok)throw Error(`Failed to fetch disabled models: ${e.status}`);let t=await e.json();A(t.disabled||{})}catch(e){console.error("Error fetching disabled models:",e),A({})}};(0,n.useEffect)(()=>{e&&H()},[e]);let Y=(0,n.useMemo)(()=>({...m.zN,...m.IS,...m.nJ,...m.fg}),[]),Z=(0,n.useMemo)(()=>{let e={},t=new Set(["webSearch","webFetch"]),a=new Set(["image","tts","stt","embedding","imageToText"]),r=new Set(["tts","image","webFetch"]);return[...new Set([...S.map(e=>e.provider),...y?p.filter(e=>(m.Q2[e]?.serviceKinds||["llm"]).includes(y)):p])].sort((e,t)=>{let a=x.indexOf(e),r=x.indexOf(t);return(-1===a?999:a)-(-1===r?999:r)}).forEach(n=>{if(m.Q2[n]?.hidden)return;let s=(0,m.wG)(n),i=Y[n]||{name:n,color:"#666"},l=(0,m.mq)(n)||(0,m.gb)(n);if(y&&t.has(y)){e[n]={name:i.name,alias:s,color:i.color,models:[{id:n,name:i.name,value:n}]};return}if(i.passthroughModels){let t=Object.entries(j).filter(([,e])=>e.startsWith(`${s}/`)).map(([e,t])=>({id:t.replace(`${s}/`,""),name:e,value:t})),l=$.filter(e=>e.providerAlias===s).map(e=>({id:e.id,name:e.name||e.id,value:`${s}/${e.id}`,kind:(0,u.CP)(e),isCustom:!0})),o=t;if(y&&a.has(y)){let e=l.filter(e=>(0,u.CP)(e)===y);0===(o=[...e,...(0,u.KC)(n).filter(e=>(0,u.CP)(e)===y).map(e=>({id:e.id,name:e.name,value:`${s}/${e.id}`,kind:(0,u.CP)(e)})).filter(t=>!e.some(e=>e.value===t.value))]).length&&r.has(y)&&(i.serviceKinds||["llm"]).includes(y)&&(o=[{id:n,name:i.name,value:s}])}else{let e=l.filter(e=>!(0,u.CP)(e)||"llm"===(0,u.CP)(e)),a=new Set([...t,...e].map(e=>e.value)),r=(0,u.KC)(n).filter(e=>!(0,u.CP)(e)||"llm"===(0,u.CP)(e)).map(e=>({id:e.id,name:e.name,value:`${s}/${e.id}`,kind:(0,u.CP)(e)})).filter(e=>!a.has(e.value));o=[...e,...t.filter(t=>!e.some(e=>e.value===t.value)),...r]}if(o.length>0){let t=T.find(e=>e.id===n),a=t?.name||i.name;e[n]={name:a,alias:s,color:i.color,models:o}}}else if(l){if(y&&a.has(y))return;let t=S.find(e=>e.provider===n),r=T.find(e=>e.id===n),s=r?.name||t?.name||i.name,l=t?.providerSpecificData?.prefix||r?.prefix||n,o=Object.entries(j).filter(([,e])=>e.startsWith(`${n}/`)).map(([e,t])=>({id:t.replace(`${n}/`,""),name:e,value:`${l}/${t.replace(`${n}/`,"")}`})),d=$.filter(e=>e.providerAlias===n).map(e=>({id:e.id,name:e.name||e.id,value:`${l}/${e.id}`,isCustom:!0})),c=new Set(o.map(e=>e.value)),u=[...o,...d.filter(e=>!c.has(e.value))],m=u.length>0?u:[{id:`__placeholder__${n}`,name:`${l}/model-id`,value:`${l}/model-id`,isPlaceholder:!0}];e[n]={name:s,alias:l,color:i.color,models:m,isCustom:!0,hasModels:u.length>0}}else{var o;let t="cursor"===n?M:"cline"===n?V:"clinepass"===n?K:"zed"===n?J:[],l=t.length>0?t:(0,u.KC)(n),d=new Set(l.map(e=>e.id)),c=l.length>0,m=Object.entries(j).filter(([e,t])=>t.startsWith(`${s}/`)&&(!c||e===t.replace(`${s}/`,""))&&!d.has(t.replace(`${s}/`,""))).map(([e,t])=>({id:t.replace(`${s}/`,""),name:e,value:t,isCustom:!0})),x=new Set(m.map(e=>e.id)),p=$.filter(e=>e.providerAlias===s&&!d.has(e.id)&&!x.has(e.id)).map(e=>({id:e.id,name:e.name||e.id,value:`${s}/${e.id}`,isCustom:!0})),h=[...l.map(e=>({id:e.id,name:e.name,value:`${s}/${e.id}`,kind:(0,u.CP)(e)})),...m,...p],g=new Set,f=(o=h.filter(e=>!g.has(e.value)&&(g.add(e.value),!0)),y?a.has(y)?o.filter(e=>e.isPlaceholder||(0,u.CP)(e)===y):o:o.filter(e=>e.isPlaceholder||e.isCustom||!(0,u.CP)(e)||"llm"===(0,u.CP)(e)));0===f.length&&y&&r.has(y)&&(i.serviceKinds||["llm"]).includes(y)&&(f=[{id:n,name:i.name,value:s}]),f.length>0&&(e[n]={name:i.name,alias:s,color:i.color,models:f})}}),Object.entries(e).forEach(([t,a])=>{let r=new Set([...z[(0,m.wG)(t)]||[],...z[t]||[]]);0!==r.size&&(a.models=a.models.filter(e=>!r.has(e.id)),0===a.models.length&&delete e[t])}),e},[S,j,Y,T,$,z,y,M,V,K]),X=(0,n.useMemo)(()=>{if(y||k)return[];if(!F.trim())return W;let e=F.toLowerCase();return W.filter(t=>t.name.toLowerCase().includes(e))},[W,F,y]),ee=function(e,t){let a=t?.name?.trim(),r=t?.id;if(!a&&!r)return new Set;let n=new Map(e.filter(e=>e.id!==r).map(e=>[e.name,Array.isArray(e.models)?e.models:[]])),s=(e,t=new Set)=>{if(a&&e===a)return!0;if(t.has(e))return!1;let r=n.get(e);if(!r)return!1;t.add(e);let i=r.some(e=>s(e,t));return t.delete(e),i};return new Set(e.filter(e=>e.id===r||s(e.name)).map(e=>e.name))}(W,C),et=(0,n.useMemo)(()=>{let e=F.trim().toLowerCase(),t={};return Object.entries(Z).forEach(([a,r])=>{var n;let s=r.models;if(!k||0!==(s=s.filter(e=>O(e.value)?.[k]===!0)).length){if(e){let t=r.name.toLowerCase().includes(e);if(0===(s=s.filter(t=>t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e))).length&&!t)return}t[a]={...r,models:[...(n=s).filter(e=>w.includes(e.value)).sort((e,t)=>e.name.localeCompare(t.name)),...n.filter(e=>!w.includes(e.value)).sort((e,t)=>e.name.localeCompare(t.name))]}}}),t},[Z,F,w]),ea=e=>{let r=e?.value||e?.name||e;w.includes(r)&&s?s(e):a(e),N&&(t(),I(""))};return(0,r.jsxs)(l.default,{isOpen:e,onClose:()=>{t(),I("")},title:v,size:"md",className:"p-4!",footer:null,children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-3 px-2.5 py-2 bg-primary/8 border border-primary/20 rounded-lg text-xs text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary shrink-0",style:{fontSize:"14px"},children:"info"}),(0,r.jsx)("span",{children:"Click to add, click again to remove. Changes are saved automatically."})]}),(0,r.jsx)("div",{className:"mb-3",children:(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("span",{className:"material-symbols-outlined absolute left-2.5 top-1/2 -translate-y-1/2 text-text-muted text-[16px]",children:"search"}),(0,r.jsx)("input",{type:"text",placeholder:"Search...",value:F,onChange:e=>I(e.target.value),className:"w-full pl-8 pr-3 py-1.5 bg-surface border border-border rounded text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"})]})}),(0,r.jsxs)("div",{className:"max-h-[400px] overflow-y-auto space-y-3",children:[X.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-[14px]",children:"layers"}),(0,r.jsx)("span",{className:"text-xs font-medium text-primary",children:"Combos"}),(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",X.length,")"]})]}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:X.map(e=>{let t=i===e.name,a=w.includes(e.name),n=!a&&ee.has(e.name);return(0,r.jsxs)("button",{disabled:n,onClick:()=>ea({id:e.name,name:e.name,value:e.name}),title:n?"Selecting this combo would create a circular reference":void 0,className:`
11
+ `}),e})(),"combo-test-summary"),className:"text-[11px] text-primary hover:underline flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"combo-test-summary"===C?"check":"content_copy"}),"combo-test-summary"===C?"Copied Summary":"Copy Diagnostic Summary"]})]}),(0,r.jsx)("div",{className:"flex flex-col gap-2 max-h-[320px] overflow-y-auto custom-scrollbar pr-1",children:j.steps?.map(e=>(0,r.jsxs)("div",{className:`rounded-lg border p-3 text-xs transition-all ${e.servedRequest?"border-emerald-500/40 bg-emerald-500/5 dark:bg-emerald-500/10 shadow-xs":e.fallbackTriggered?"border-amber-500/40 bg-amber-500/5 dark:bg-amber-500/10":"border-border-subtle bg-surface-2 opacity-60"}`,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)("span",{className:`size-5 rounded-full flex items-center justify-center font-bold text-[10px] shrink-0 ${e.servedRequest?"bg-emerald-500 text-white":e.fallbackTriggered?"bg-amber-500 text-white":"bg-black/20 dark:bg-white/20 text-text-muted"}`,children:e.index}),(0,r.jsx)("code",{className:"font-mono text-xs font-semibold text-text-main truncate",children:e.model})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[e.servedRequest&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-500/20 text-emerald-700 dark:text-emerald-300 font-semibold px-2 py-0.5 text-[10px]",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"verified"}),"SERVED REQUEST"]}),e.fallbackTriggered&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-amber-500/20 text-amber-700 dark:text-amber-300 font-semibold px-2 py-0.5 text-[10px]",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"warning"}),"FALLBACK TRIGGERED"]}),e.skipped&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-black/10 dark:bg-white/10 text-text-muted font-medium px-2 py-0.5 text-[10px]",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"skip_next"}),"SKIPPED"]}),!e.skipped&&(0,r.jsxs)("span",{className:"font-mono text-[11px] text-text-muted",children:[e.latencyMs,"ms"]})]})]}),e.fallbackTriggered&&(0,r.jsxs)("div",{className:"mt-2 rounded bg-red-500/10 border border-red-500/20 p-2 font-mono text-[11px] text-red-500 break-words",children:[(0,r.jsx)("span",{className:"font-bold",children:"Error: "}),e.error||`HTTP ${e.status}`]}),e.servedRequest&&e.preview&&(0,r.jsxs)("div",{className:"mt-2 rounded bg-surface p-2 border border-emerald-500/30 text-[11px] text-text-main font-mono whitespace-pre-wrap max-h-24 overflow-y-auto custom-scrollbar",children:[(0,r.jsx)("span",{className:"text-[10px] text-emerald-600 dark:text-emerald-400 font-bold block mb-0.5",children:"Output Preview:"}),e.preview]}),e.skipped&&(0,r.jsx)("div",{className:"mt-1 text-[11px] text-text-muted italic",children:e.reason})]},e.index))})]})]})]})})}},28815:(e,t,a)=>{a.d(t,{default:()=>o});var r=a(95155),n=a(12115),s=a(81127),i=a(92542),l=a(11059);function o({isOpen:e,onClose:t,title:a="Manual Configuration",configs:d=[]}){let{copy:c}=(0,l.C)(),[u,m]=(0,n.useState)(null);return(0,r.jsx)(s.default,{isOpen:e,onClose:t,title:a,size:"xl",children:(0,r.jsx)("div",{className:"flex flex-col gap-4",children:d.map((e,t)=>(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-text-main",children:e.filename}),(0,r.jsxs)(i.default,{variant:"ghost",size:"sm",onClick:()=>{var a;return a=e.content,void(c(a,`manualconfig-${t}`),m(t),setTimeout(()=>m(null),2e3))},children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:u===t?"check":"content_copy"}),u===t?"Copied!":"Copy"]})]}),(0,r.jsx)("pre",{className:"px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs overflow-x-auto whitespace-pre-wrap break-all max-h-60 overflow-y-auto border border-border",children:e.content})]},t))})})}},29366:(e,t,a)=>{a.d(t,{default:()=>i});var r=a(95155),n=a(28777),s=a(97677);function i({caps:e,className:t="",colorOverride:a,size:l=16}){if(!e)return null;let o=Object.keys(n.bs).filter(t=>e[t]);return 0===o.length?null:(0,r.jsx)("span",{className:`inline-flex items-center gap-0.5 ${t}`,children:o.map(e=>(0,r.jsx)(s.default,{text:`${n.bs[e].label} — ${n.bs[e].desc}`,children:(0,r.jsx)("span",{className:`material-symbols-outlined leading-none cursor-help ${a||n.bs[e].color}`,style:{fontSize:`${l}px`},children:n.bs[e].icon})},e))})}},30312:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497),o=a(11059);function d({isOpen:e,providerInfo:t,onSuccess:a,onClose:s}){let[i,c]=(0,n.useState)("booting"),[u,m]=(0,n.useState)(null),[x,p]=(0,n.useState)(null),[h,g]=(0,n.useState)(""),[f,b]=(0,n.useState)(null),[v,j]=(0,n.useState)(!1),y=(0,n.useRef)(null),k=(0,n.useRef)({proxyStarted:!1,stopSent:!1}),w=(0,n.useRef)(!1),N=(0,n.useRef)(!1),C=(0,n.useRef)(e),S=(0,n.useRef)(a),O=(0,n.useRef)(s),{copied:F,copy:W}=(0,o.C)();(0,n.useEffect)(()=>{C.current=e,S.current=a,O.current=s});let I=(0,n.useCallback)(()=>{let e=k.current;e.proxyStarted&&!e.stopSent&&(e.stopSent=!0,fetch("/api/oauth/zed/stop-proxy").catch(()=>{}))},[]),P=(0,n.useCallback)(()=>{c("success"),S.current?.(),setTimeout(()=>O.current?.(),600)},[]),T=(0,n.useCallback)(async e=>{if(e?.accessToken&&e?.userId){j(!0),b(null),c("importing");try{let t=await fetch("/api/oauth/zed/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:e.accessToken,userId:e.userId,...e.systemId?{systemId:e.systemId}:{}})}),a=await t.json();if(!t.ok)throw Error(a.error||"Import failed");I(),P()}catch(e){b(e.message),c("ide-found")}finally{j(!1)}}},[P,I]),E=(0,n.useCallback)(async()=>{b(null),p(null),g(""),k.current={proxyStarted:!1,stopSent:!1},N.current=!1;try{let e=await fetch("/api/oauth/zed/start-proxy"),t=await e.json();if(!e.ok||!t.success||!t.callbackUrl)throw Error(t.reason||t.error||"Failed to start Zed callback server");if(k.current.proxyStarted=!0,k.current.stopSent=!1,!C.current)return void I();let a=new URL("/api/oauth/zed/authorize",window.location.origin);a.searchParams.set("redirect_uri",t.callbackUrl);let r=await fetch(a),n=await r.json();if(!r.ok)throw I(),Error(n.error||"Failed to start Zed authorization");if(!C.current)return void I();let s={state:n.state};n.codeVerifier&&(s.codeVerifier=n.codeVerifier),n.systemId&&(s.systemId=n.systemId);let i=await fetch("/api/oauth/zed/register-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),l=null;try{l=await i.json()}catch{l=null}if(!i.ok||l?.success===!1)throw I(),Error(l?.error||"Failed to register Zed login session");if(!C.current)return;p(n),c(e=>"ide-found"===e||"importing"===e?e:"browser"),y.current=window.open(n.authUrl,"oauth_popup_zed","width=600,height=700")}catch(e){if(!C.current)return;b(e.message),c(e=>"ide-found"===e?e:"browser")}},[I]);(0,n.useEffect)(()=>{if(!e||w.current)return;w.current=!0,c("booting"),m(null),p(null),g(""),b(null),j(!1),N.current=!1,k.current={proxyStarted:!1,stopSent:!1};let t=!1;return(async()=>{let e=E();try{let e=await fetch("/api/oauth/zed/auto-import",{signal:AbortSignal.timeout(12e3)}),a=await e.json();if(t||!C.current)return;if(a.found&&a.accessToken&&a.userId){let e={accessToken:a.accessToken,userId:String(a.userId),systemId:a.systemId||""};m(e),await T(e);return}}catch{}!t&&C.current&&(await e,!t&&C.current&&c("browser"))})(),()=>{t=!0}},[e,E,T]),(0,n.useEffect)(()=>{if(!e&&(w.current=!1,N.current=!0,I(),k.current={proxyStarted:!1,stopSent:!1},y.current&&!y.current.closed))try{y.current.close()}catch{}},[e,I]),(0,n.useEffect)(()=>{if(!x?.state||"importing"===i||"success"===i)return;let e=!1,t=0,a=async()=>{if(!e&&!N.current&&C.current){t+=1;try{let t=await fetch(`/api/oauth/zed/poll-status?state=${encodeURIComponent(x.state)}`),a=await t.json();if(e||N.current)return;if("done"===a.status){N.current=!0,I(),P();return}if("error"===a.status){N.current=!0,b(a.error||"Authentication failed"),c("error");return}}catch{}if(t>=200){b("Authentication timeout"),c("error");return}setTimeout(a,1500)}};return setTimeout(a,1500),()=>{e=!0}},[x,i,P,I]);let $=async()=>{let e=h.trim();if(e){j(!0),b(null);try{let t=await fetch("/api/oauth/zed/exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,state:x?.state,...x?.redirectUri?{redirectUri:x.redirectUri}:{},...x?.codeVerifier?{codeVerifier:x.codeVerifier}:{},...x?.systemId?{systemId:x.systemId}:{}})}),a=await t.json();if(!t.ok)throw Error(a.error||"Exchange failed");N.current=!0,I(),P()}catch(e){b(e.message),c("error")}finally{j(!1)}}},_=()=>{N.current=!0,I(),s()},z=`Connect ${t?.name||"Zed"}`;return(0,r.jsx)(l.aF,{isOpen:e,title:z,onClose:_,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[("booting"===i||"importing"===i)&&(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-primary animate-spin",children:"progress_activity"}),(0,r.jsx)("span",{className:"text-sm",children:"importing"===i?"Importing session from Zed IDE…":"Detecting Zed IDE session…"})]}),"ide-found"===i&&u&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,r.jsxs)("p",{className:"text-sm text-green-800 dark:text-green-200",children:["Zed IDE session detected (user ",u.userId,"). Import failed — retry or use browser sign-in below."]})]})}),(0,r.jsx)(l.$n,{onClick:()=>T(u),fullWidth:!0,disabled:v,children:v?"Importing…":"Import from Zed IDE"})]}),"success"===i&&(0,r.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800 text-sm text-green-800 dark:text-green-200",children:"Connected successfully."}),("browser"===i||"error"===i||"ide-found"===i)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-primary animate-spin",children:"progress_activity"}),(0,r.jsx)("span",{className:"text-sm",children:"Waiting for popup authorization…"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 my-1",children:[(0,r.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,r.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wider",children:"Or paste callback URL manually"}),(0,r.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.pd,{value:x?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,r.jsx)(l.$n,{variant:"secondary",icon:"auth_url"===F?"check":"content_copy",onClick:()=>W(x?.authUrl,"auth_url"),disabled:!x?.authUrl,children:"Copy"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser (or the local callback page)."}),(0,r.jsx)(l.pd,{value:h,onChange:e=>g(e.target.value),placeholder:"http://127.0.0.1:.../?user_id=...&access_token=...",className:"font-mono text-xs"})]})]}),f&&(0,r.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,r.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:f})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:$,fullWidth:!0,disabled:v||!h.trim()||!x,children:v?"Connecting…":"Connect"}),(0,r.jsx)(l.$n,{onClick:_,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}d.propTypes={isOpen:i().bool.isRequired,providerInfo:i().object,onSuccess:i().func,onClose:i().func.isRequired}},30815:(e,t,a)=>{a.d(t,{default:()=>o});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497);function o({isOpen:e,onSuccess:t,onClose:a}){let[s,i]=(0,n.useState)(""),[d,c]=(0,n.useState)(""),[u,m]=(0,n.useState)(null),[x,p]=(0,n.useState)(!1),[h,g]=(0,n.useState)(!1),[f,b]=(0,n.useState)(!1),[v,j]=(0,n.useState)(!1),y=async()=>{g(!0),m(null),b(!1),j(!1);try{let e=await fetch("/api/oauth/cursor/auto-import"),t=await e.json();t.found?(i(t.accessToken),c(t.machineId),b(!0)):t.windowsManual?j(!0):m(t.error||"Could not auto-detect tokens")}catch(e){m("Failed to auto-detect tokens")}finally{g(!1)}};(0,n.useEffect)(()=>{e&&y()},[e]);let k=()=>{i(""),c(""),b(!1),m(null),a()},w=async()=>{if(!s.trim())return void m("Please enter an access token");if(!d.trim())return void m("Please enter a machine ID");p(!0),m(null);try{let e=await fetch("/api/oauth/cursor/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:s.trim(),machineId:d.trim()})}),a=await e.json();if(!e.ok)throw Error(a.error||"Import failed");t?.(),k()}catch(e){m(e.message)}finally{p(!1)}};return(0,r.jsx)(l.aF,{isOpen:e,title:"Connect Cursor IDE",onClose:k,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[h&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting tokens..."}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from Cursor IDE database"})]}),!h&&(0,r.jsxs)(r.Fragment,{children:[f&&(0,r.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,r.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Tokens auto-detected from Cursor IDE successfully!"})]})}),v&&(0,r.jsxs)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-3 rounded-lg border border-amber-200 dark:border-amber-800 flex flex-col gap-2",children:[(0,r.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Could not read Cursor database automatically."})]}),(0,r.jsxs)("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Make sure Cursor IDE has been opened at least once, then click ",(0,r.jsx)("strong",{children:"Retry"}),". If the problem persists, paste your tokens manually below."]}),(0,r.jsx)(l.$n,{onClick:y,variant:"outline",fullWidth:!0,children:"Retry"})]}),!f&&!v&&!u&&(0,r.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Cursor IDE not detected. Please paste your tokens manually."})]})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)("textarea",{value:s,onChange:e=>i(e.target.value),placeholder:"Access token will be auto-filled...",rows:3,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-lg bg-background focus:outline-none focus:border-primary resize-none"})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Machine ID ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(l.pd,{value:d,onChange:e=>c(e.target.value),placeholder:"Machine ID will be auto-filled...",className:"font-mono text-sm"})]}),u&&(0,r.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,r.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:u})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:w,fullWidth:!0,disabled:x||!s.trim()||!d.trim(),children:x?"Importing...":"Import Token"}),(0,r.jsx)(l.$n,{onClick:k,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}o.propTypes={isOpen:i().bool.isRequired,onSuccess:i().func,onClose:i().func.isRequired}},35497:(e,t,a)=>{a.d(t,{x0:()=>N.default,fA:()=>C.default,Ex:()=>d.default,$n:()=>r.default,nh:()=>P.default,Zp:()=>i.default,Qv:()=>o.CardSkeleton,CK:()=>p.default,St:()=>T.default,uo:()=>l.ConfirmModal,G9:()=>b.default,wI:()=>w.default,vj:()=>k.default,vE:()=>y.default,pd:()=>n.default,Mh:()=>f.default,uR:()=>x.default,Nf:()=>h.default,aF:()=>l.default,rq:()=>m.default,gw:()=>O.default,LF:()=>u.default,dK:()=>S.default,Wx:()=>I.default,gM:()=>g.default,Iz:()=>F.default,l6:()=>s.default,lM:()=>c.default,m_:()=>W.default,LH:()=>j.default,TE:()=>v.default});var r=a(92542),n=a(11910),s=a(98),i=a(84588),l=a(81127),o=a(25086);a(56319);var d=a(56061),c=a(98542);a(38587),a(21110),a(84130),a(8823),a(92173);var u=a(90882),m=a(72908),x=a(28815),p=a(45455),h=a(28058);a(21931),a(67968),a(80752),a(40197);var g=a(23615);a(85416);var f=a(62899);a(94230);var b=a(30815),v=a(30312),j=a(40684),y=a(23936),k=a(95088),w=a(73579),N=a(96748),C=a(2222),S=a(50378),O=a(4823),F=a(28067),W=a(97677),I=a(51825),P=a(29366),T=a(28697);a(98254),a(91450)},38003:(e,t,a)=>{a.d(t,{C:()=>r});let r=(0,a(1934).v)(e=>({query:"",placeholder:"",visible:!1,setQuery:t=>e({query:t}),register:(t="Search...")=>e({visible:!0,placeholder:t,query:""}),unregister:()=>e({visible:!1,placeholder:"",query:""})}))},38202:(e,t,a)=>{a.d(t,{h:()=>r});let r={en:"\uD83C\uDDFA\uD83C\uDDF8",vi:"\uD83C\uDDFB\uD83C\uDDF3","zh-CN":"\uD83C\uDDE8\uD83C\uDDF3","zh-TW":"\uD83C\uDDF9\uD83C\uDDFC",ja:"\uD83C\uDDEF\uD83C\uDDF5","pt-BR":"\uD83C\uDDE7\uD83C\uDDF7","pt-PT":"\uD83C\uDDF5\uD83C\uDDF9",ko:"\uD83C\uDDF0\uD83C\uDDF7",es:"\uD83C\uDDEA\uD83C\uDDF8",de:"\uD83C\uDDE9\uD83C\uDDEA",fr:"\uD83C\uDDEB\uD83C\uDDF7",he:"\uD83C\uDDEE\uD83C\uDDF1",ar:"\uD83C\uDDF8\uD83C\uDDE6",ru:"\uD83C\uDDF7\uD83C\uDDFA",pl:"\uD83C\uDDF5\uD83C\uDDF1",cs:"\uD83C\uDDE8\uD83C\uDDFF",nl:"\uD83C\uDDF3\uD83C\uDDF1",tr:"\uD83C\uDDF9\uD83C\uDDF7",uk:"\uD83C\uDDFA\uD83C\uDDE6",tl:"\uD83C\uDDF5\uD83C\uDDED",id:"\uD83C\uDDEE\uD83C\uDDE9",th:"\uD83C\uDDF9\uD83C\uDDED",km:"\uD83C\uDDF0\uD83C\uDDED",hi:"\uD83C\uDDEE\uD83C\uDDF3",bn:"\uD83C\uDDE7\uD83C\uDDE9",ur:"\uD83C\uDDF5\uD83C\uDDF0",ro:"\uD83C\uDDF7\uD83C\uDDF4",sv:"\uD83C\uDDF8\uD83C\uDDEA",it:"\uD83C\uDDEE\uD83C\uDDF9",el:"\uD83C\uDDEC\uD83C\uDDF7",hu:"\uD83C\uDDED\uD83C\uDDFA",fi:"\uD83C\uDDEB\uD83C\uDDEE",da:"\uD83C\uDDE9\uD83C\uDDF0",no:"\uD83C\uDDF3\uD83C\uDDF4",fa:"\uD83C\uDDEE\uD83C\uDDF7"}},38587:(e,t,a)=>{a.d(t,{default:()=>i});var r=a(95155),n=a(1620),s=a(31474);function i({className:e,variant:t="default"}){let{isDark:a,toggleTheme:l}=(0,n.D)(),o={default:(0,s.cn)("flex items-center justify-center size-10 rounded-full","text-text-muted hover:text-text-main","hover:bg-surface-2 transition-colors"),card:(0,s.cn)("flex items-center justify-center size-11 rounded-full","bg-surface/60 hover:bg-surface","border border-border","backdrop-blur-md shadow-sm hover:shadow-[var(--shadow-warm)]","text-text-muted hover:text-brand-500","transition-all group")};return(0,r.jsx)("button",{onClick:l,className:(0,s.cn)(o[t],e),"aria-label":`Switch to ${a?"light":"dark"} mode`,title:`Switch to ${a?"light":"dark"} mode`,children:(0,r.jsx)("span",{className:(0,s.cn)("material-symbols-outlined text-[22px]","card"===t&&"transition-transform duration-300 group-hover:rotate-12"),children:a?"light_mode":"dark_mode"})})}},40197:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(95155),n=a(12115),s=a(47650),i=a(14051),l=a.n(i),o=a(90620);function d({isOpen:e,onClose:t}){let[i,l]=(0,n.useState)(""),[c,u]=(0,n.useState)(!1),[m,x]=(0,n.useState)(""),p=(0,n.useRef)(null);return((0,n.useEffect)(()=>{e&&(u(!0),x(""),Promise.all([fetch(o.Nu.changelogUrl,{cache:"no-store"}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.text()}),a.e(9233).then(a.bind(a,9233))]).then(([e,{marked:t}])=>{t.setOptions({gfm:!0,breaks:!0}),l(t.parse(e))}).catch(e=>x(e.message||"Failed to load")).finally(()=>u(!1)))},[e]),(0,n.useEffect)(()=>{let a=e=>{p.current&&!p.current.contains(e.target)&&t()};if(e)return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[e,t]),!e||"u"<typeof document)?null:(0,s.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:t}),(0,r.jsxs)("div",{ref:p,className:"relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-3xl flex flex-col max-h-[85vh]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Change Log"}),(0,r.jsx)("button",{onClick:t,className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":"Close",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,r.jsxs)("div",{className:"p-6 overflow-y-auto flex-1",children:[c&&(0,r.jsxs)("div",{className:"flex items-center justify-center py-10 text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin mr-2",children:"progress_activity"}),"Loading..."]}),m&&(0,r.jsxs)("div",{className:"text-red-500 py-4",children:["Failed to load changelog: ",m]}),!c&&!m&&i&&(0,r.jsx)("div",{className:"changelog-body text-text-main",dangerouslySetInnerHTML:{__html:i}})]})]})]}),document.body)}d.propTypes={isOpen:l().bool.isRequired,onClose:l().func.isRequired}},40684:(e,t,a)=>{a.d(t,{default:()=>c});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497),o=a(73006);let d=[{id:"cn",flag:"\uD83C\uDDE8\uD83C\uDDF3",name:"China (Mainland)",host:"mimo-server-cn"},{id:"sgp",flag:"\uD83C\uDDF8\uD83C\uDDEC",name:"Singapore",host:"mimo-server-sgp"},{id:"ams",flag:"\uD83C\uDDEA\uD83C\uDDFA",name:"Europe \xb7 Amsterdam",host:"mimo-server-ams"},{id:"ru",flag:"\uD83C\uDDF7\uD83C\uDDFA",name:"Russia",host:"mimo-server-ru"},{id:"in",flag:"\uD83C\uDDEE\uD83C\uDDF3",name:"India",host:"mimo-server-in"}];function c({isOpen:e,onSuccess:t,onClose:a}){let[s,i]=(0,n.useState)("detecting"),[u,m]=(0,n.useState)(null),[x,p]=(0,n.useState)(null),[h,g]=(0,n.useState)(null),[f,b]=(0,n.useState)(!1),[v,j]=(0,n.useState)(!1),[y,k]=(0,n.useState)(!1),[w,N]=(0,n.useState)(null),[C,S]=(0,n.useState)(null),[O,F]=(0,n.useState)("cn"),W=(0,n.useRef)(null),I=()=>{W.current&&(clearInterval(W.current),W.current=null),k(!1)};(0,n.useEffect)(()=>()=>I(),[]),(0,n.useEffect)(()=>{e&&(i("detecting"),g(null),m(null),p(null),b(!1),N(null),(async()=>{try{let e=await fetch("/api/oauth/xiaomi-mimo/auto-import",{signal:AbortSignal.timeout(5e3)}),t=await e.json();t.found&&t.apiKey?(m(t),i("found"),fetch("/api/providers",{signal:AbortSignal.timeout(3e3)}).then(e=>e.json()).then(e=>{let a=(e.connections||[]).find(e=>"xiaomi-mimo"===e.provider&&t.uid&&(e.email===`${t.uid}@xiaomi`||e.providerSpecificData?.uid===t.uid||e.providerSpecificData?.mimoUserId===t.uid));a&&p(a)}).catch(()=>{})):i("not-found")}catch{i("not-found")}})())},[e]);let P=async()=>{if(u?.apiKey){i("importing"),g(null);try{let e=await fetch("/api/oauth/xiaomi-mimo/api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:u.apiKey,uid:u.uid,baseUrl:u.baseUrl,mimoPassToken:u.mimoPassToken||null,mimoUserId:u.mimoUserId||null,mimoCUserId:u.mimoCUserId||null})}),r=await e.json();if(!e.ok||!r.success)throw Error(r.error||"Import failed");t?.(r.connection),a()}catch(e){i("found"),g(e.message)}}},T=async e=>{j(!0),N(null),b(!1),F(e);try{let r=await fetch("/api/oauth/xiaomi-mimo/login/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({region:e})}),n=await r.json();if(!r.ok||!n.pageUrl)throw Error(n.error||"Failed to start login");S(n.pageUrl),window.open(n.pageUrl,"mimo-session-login","width=500,height=760"),k(!0);let s=Date.now();W.current=setInterval(async()=>{if(Date.now()-s>84e4){I(),N("Login timed out. Please retry.");return}try{let e=await fetch(`/api/oauth/xiaomi-mimo/login/status?state=${n.state}`),r=await e.json();if("pending"===r.status)return;if(I(),"done"!==r.status)return void N(r.error||"Login session expired — please retry.");let s=await fetch("/api/oauth/xiaomi-mimo/api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:"",uid:r.userId||null,mimoPassToken:r.passToken,mimoUserId:r.userId||null,mimoCUserId:r.cUserId||null,region:r.region||O})}),i=await s.json();if(!s.ok||!i.success)throw Error(i.error||"Failed to save credentials");t?.(i.connection),a()}catch(e){I(),N(e.message)}},2500)}catch(e){N(e.message)}finally{j(!1)}},E=()=>(0,r.jsxs)("div",{className:"bg-card p-3 rounded-lg border border-border flex flex-col gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-base",children:"login"}),(0,r.jsx)("span",{className:"text-xs sm:text-sm font-semibold",children:"Browser Login"}),(0,r.jsx)("span",{className:"text-[11px] text-text-muted",children:"No Desktop required"})]}),(0,r.jsx)("span",{className:"text-[11px] text-text-muted",children:"Weekly quota"})]}),y?(0,r.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,r.jsx)(l.$n,{variant:"outline",size:"sm",fullWidth:!0,disabled:!0,children:"Waiting for login..."}),C&&(0,r.jsx)(l.$n,{onClick:()=>window.open(C,"mimo-session-login","width=500,height=760"),variant:"ghost",size:"sm",fullWidth:!0,children:"Reopen login window"})]}):(0,r.jsx)(l.$n,{onClick:()=>b(!0),variant:"outline",size:"sm",fullWidth:!0,disabled:v,children:v?"Starting...":"Choose cluster & sign in"}),w&&(0,r.jsx)("p",{className:"text-[11px] text-red-500",children:(0,o.Tl)(w)})]});return(0,r.jsx)(l.aF,{isOpen:e,title:(0,o.Tl)("Connect Xiaomi MiMo"),onClose:a,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-3.5",children:["detecting"===s&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-12 mx-auto mb-3 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Reading local MiMo Desktop credentials..."})]}),"importing"===s&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-12 mx-auto mb-3 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("p",{className:"text-sm font-medium",children:"Connecting..."})]}),"found"===s&&u&&(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-semibold text-text-muted px-0.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-sm",children:"desktop_windows"}),(0,r.jsx)("span",{children:"Desktop Plan \xb7 Local credentials"})]}),x?(0,r.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,r.jsxs)("div",{className:"flex gap-2.5 items-start",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400 text-lg mt-0.5",children:"check_circle"}),(0,r.jsxs)("div",{className:"text-sm text-blue-800 dark:text-blue-200",children:[(0,r.jsx)("p",{className:"font-medium",children:"This account is already connected (no need to import again)"}),(0,r.jsxs)("p",{className:"text-xs mt-0.5 opacity-80",children:["UID: ",u.uid||"—"," \xb7 Status: ","active"===x.testStatus?"Active":"Untested"]})]})]})}):(0,r.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,r.jsxs)("div",{className:"flex gap-2.5 items-start",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400 text-lg mt-0.5",children:"check_circle"}),(0,r.jsxs)("div",{className:"text-sm text-green-800 dark:text-green-200",children:[(0,r.jsx)("p",{className:"font-medium",children:"Xiaomi MiMo Desktop credentials found!"}),(0,r.jsxs)("p",{className:"text-xs mt-0.5 opacity-80",children:["UID: ",u.uid||"—"," \xb7 Source: ",u.source?.split(/[\\/]/).pop()]})]})]})}),h&&(0,r.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-2.5 rounded-lg border border-red-200 dark:border-red-800",children:(0,r.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",children:(0,o.Tl)(h)})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:P,variant:x?"outline":"default",fullWidth:!0,children:x?"Re-sync local credentials":"Connect with local credentials"}),(0,r.jsx)(l.$n,{onClick:a,variant:"ghost",fullWidth:!0,children:x?"Close":"Cancel"})]}),(0,r.jsxs)("div",{className:"relative my-1",children:[(0,r.jsx)("div",{className:"absolute inset-0 flex items-center",children:(0,r.jsx)("div",{className:"w-full border-t border-border"})}),(0,r.jsx)("div",{className:"relative flex justify-center text-xs text-text-muted",children:(0,r.jsx)("span",{className:"bg-card px-2",children:"or"})})]}),E()]}),"not-found"===s&&(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-3 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,r.jsxs)("div",{className:"flex gap-2.5 items-start",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400 text-lg mt-0.5",children:"info"}),(0,r.jsxs)("div",{className:"text-sm text-amber-800 dark:text-amber-200",children:[(0,r.jsx)("p",{className:"font-medium",children:"No local Desktop credentials found"}),(0,r.jsx)("p",{className:"text-xs mt-0.5 opacity-80",children:"You can still sign in via browser — no Desktop client needed."})]})]})}),E(),(0,r.jsx)("div",{className:"mt-1",children:(0,r.jsx)(l.$n,{onClick:a,variant:"ghost",fullWidth:!0,children:"Cancel"})})]}),f&&(0,r.jsx)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4 bg-black/60 backdrop-blur-xs animate-in fade-in duration-150",children:(0,r.jsxs)("div",{className:"relative w-full max-w-sm bg-surface border border-border-subtle rounded-[14px] shadow-2xl p-5 flex flex-col gap-3.5 animate-in zoom-in-95 duration-150",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-lg",children:"public"}),(0,r.jsx)("h3",{className:"text-sm font-semibold",children:"Select account cluster"})]}),(0,r.jsx)("button",{type:"button",onClick:()=>b(!1),className:"text-text-muted hover:text-text-primary p-1 rounded-md transition-colors cursor-pointer",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Choose the region cluster of your Xiaomi account:"}),(0,r.jsx)("div",{className:"flex flex-col gap-2",children:d.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>T(e.id),className:"p-3 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-all text-left flex items-start gap-3 group cursor-pointer",children:[(0,r.jsx)("span",{className:"text-2xl mt-0.5",children:e.flag}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("div",{className:"text-sm font-semibold group-hover:text-primary transition-colors",children:e.name}),(0,r.jsx)("div",{className:"text-xs text-text-muted mt-0.5",children:e.host})]})]},e.id))}),(0,r.jsx)(l.$n,{onClick:()=>b(!1),variant:"ghost",size:"sm",fullWidth:!0,children:"Cancel"})]})})]})})}c.propTypes={isOpen:i().bool.isRequired,onSuccess:i().func,onClose:i().func.isRequired}},45455:(e,t,a)=>{a.d(t,{default:()=>u});var r=a(95155),n=a(12115),s=a(81127),i=a(11910),l=a(92542),o=a(72908);let d=/^[a-zA-Z0-9_.\-]+$/;function c({index:e,model:t,isFirst:a,isLast:s,onEdit:i,onMoveUp:l,onMoveDown:o,onRemove:d}){let[u,m]=(0,n.useState)(!1),[x,p]=(0,n.useState)(t),h=()=>{let e=x.trim();e&&e!==t?i(e):p(t),m(!1)};return(0,r.jsxs)("div",{className:"group flex min-w-0 items-center gap-1.5 rounded-md bg-black/[0.02] px-2 py-1 transition-colors hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04]",children:[(0,r.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:e+1}),u?(0,r.jsx)("input",{autoFocus:!0,value:x,onChange:e=>p(e.target.value),onBlur:h,onKeyDown:e=>{"Enter"===e.key&&h(),"Escape"===e.key&&(p(t),m(!1))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-white px-1.5 py-0.5 font-mono text-xs text-text-main outline-none dark:bg-black/20"}):(0,r.jsx)("div",{className:"min-w-0 flex-1 cursor-text truncate rounded px-1.5 py-0.5 font-mono text-xs text-text-main hover:bg-black/5 dark:hover:bg-white/5",onClick:()=>m(!0),title:"Click to edit",children:t}),(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,r.jsx)("button",{onClick:l,disabled:a,className:`p-0.5 rounded ${a?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,r.jsx)("button",{onClick:o,disabled:s,className:`p-0.5 rounded ${s?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,r.jsx)("button",{onClick:d,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function u({isOpen:e,combo:t,onClose:a,onSave:m,activeProviders:x,kindFilter:p=null,forcePrefix:h="",title:g}){let f=t?.name?h&&t.name.startsWith(h)?t.name.slice(h.length):t.name:"",[b,v]=(0,n.useState)(f),[j,y]=(0,n.useState)(t?.models||[]),[k,w]=(0,n.useState)(!1),[N,C]=(0,n.useState)(!1),[S,O]=(0,n.useState)(""),[F,W]=(0,n.useState)({});(0,n.useEffect)(()=>{e&&fetch("/api/models/alias").then(e=>e.ok?e.json():null).then(e=>e&&W(e.aliases||{})).catch(()=>{})},[e]);let I=e=>{if(!e.trim())return O("Name is required"),!1;let t=h+e;return d.test(t)?(O(""),!0):(O("Only letters, numbers, -, _ and . allowed"),!1)},P=e=>{let t=e.target.value;h&&t.startsWith(h)&&(t=t.slice(h.length)),v(t),t?I(t):O("")},T=async()=>{I(b)&&(C(!0),await m({name:h+b.trim(),models:j}),C(!1))},E=!!t;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.default,{isOpen:e,onClose:a,title:g||(E?"Edit Combo":"Create Combo"),children:(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsxs)("div",{children:[h?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("label",{className:"text-sm font-medium mb-1 block",children:"Combo Name"}),(0,r.jsxs)("div",{className:"flex items-stretch",children:[(0,r.jsx)("span",{className:"inline-flex items-center px-2 rounded-l border border-r-0 border-black/10 dark:border-white/10 bg-black/[0.04] dark:bg-white/[0.04] text-text-muted font-mono text-sm",children:h}),(0,r.jsx)("input",{value:b,onChange:P,placeholder:"my-combo",className:"flex-1 min-w-0 rounded-r border border-black/10 dark:border-white/10 bg-white dark:bg-black/20 px-2 py-1.5 font-mono text-sm outline-none focus:border-primary"})]}),S&&(0,r.jsx)("p",{className:"text-[11px] text-red-500 mt-0.5",children:S})]}):(0,r.jsx)(i.default,{label:"Combo Name",value:b,onChange:P,placeholder:"my-combo",error:S}),(0,r.jsxs)("p",{className:"text-[10px] text-text-muted mt-0.5",children:[h?`Auto-prefixed with "${h}". `:"","Only letters, numbers, -, _ and . allowed"]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===j.length?(0,r.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,r.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:j.map((e,t)=>(0,r.jsx)(c,{index:t,model:e,isFirst:0===t,isLast:t===j.length-1,onEdit:e=>{let a=[...j];a[t]=e,y(a)},onMoveUp:()=>(e=>{if(0===e)return;let t=[...j];[t[e-1],t[e]]=[t[e],t[e-1]],y(t)})(t),onMoveDown:()=>(e=>{if(e===j.length-1)return;let t=[...j];[t[e],t[e+1]]=[t[e+1],t[e]],y(t)})(t),onRemove:()=>y(j.filter((e,a)=>a!==t))},t))}),(0,r.jsxs)("button",{onClick:()=>w(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-primary font-medium hover:text-primary hover:border-primary/50 transition-colors flex items-center justify-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,r.jsx)(l.default,{onClick:a,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,r.jsx)(l.default,{onClick:T,fullWidth:!0,size:"sm",disabled:!b.trim()||!!S||N,children:N?"Saving...":E?"Save":"Create"})]})]})}),k&&(0,r.jsx)(o.default,{isOpen:k,onClose:()=>w(!1),onSelect:e=>{j.includes(e.value)||y([...j,e.value])},onDeselect:e=>{y(j.filter(t=>t!==e.value))},activeProviders:x,modelAliases:F,title:"Add Model to Combo",kindFilter:p,addedModelValues:j,closeOnSelect:!1})]})}},50378:(e,t,a)=>{a.d(t,{default:()=>o});var r=a(95155),n=a(12115),s=a(31474),i=a(92542),l=a(28067);function o({currentPage:e,pageSize:t,totalItems:a,onPageChange:d,onPageSizeChange:c,className:u,pageSizeOptions:m=[10,20,50],allowCustomPageSize:x=!1,maxPageSize:p=500}){let[h,g]=(0,n.useState)(!1),[f,b]=(0,n.useState)(String(t)),v=()=>{let e=Number.parseInt(f,10);if(!Number.isFinite(e))return void b(String(t));let a=Math.min(p,Math.max(1,e));b(String(a)),a!==t&&c(a)},j=Math.ceil(a/t),y=a>0?(e-1)*t+1:0,k=Math.min(e*t,a),w=(()=>{let t=[],a=Math.max(1,e-2),r=Math.min(j,a+5-1);r-a+1<5&&(a=Math.max(1,r-5+1));for(let e=a;e<=r;e++)t.push(e);return t})();return(0,r.jsxs)("div",{className:(0,s.cn)("flex flex-col gap-2 py-4 px-2",u),children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 sm:gap-4",children:[a>0&&(0,r.jsxs)("div",{className:"whitespace-nowrap text-sm text-text-muted",children:["Showing ",(0,r.jsx)("span",{className:"font-medium text-text-main",children:y})," to"," ",(0,r.jsx)("span",{className:"font-medium text-text-main",children:k})," of"," ",(0,r.jsx)("span",{className:"font-medium text-text-main",children:a})," results"]}),c&&(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-sm text-text-muted",children:"Rows:"}),(0,r.jsx)(l.default,{size:"sm",value:h&&x?"__custom__":String(t),options:[...m.map(e=>({value:String(e),label:String(e)})),...x?[{value:"__custom__",label:"Custom"}]:[]],onChange:e=>{if("__custom__"===e){g(!0),b(String(t));return}g(!1),c(Number(e))}}),h&&x&&(0,r.jsx)("input",{type:"number",min:"1",max:String(p),value:f,onChange:e=>b(e.target.value),onBlur:v,onKeyDown:e=>{"Enter"===e.key&&v()},className:(0,s.cn)("h-7 w-20 rounded-[8px] border border-border bg-surface-2","px-2 text-xs text-text-main focus:outline-none focus:ring-2 focus:ring-brand-500/30","transition-all"),style:{colorScheme:"auto"},"aria-label":"Custom accounts per page"})]})]}),j>1&&(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(i.default,{variant:"outline",size:"sm",onClick:()=>d(e-1),disabled:1===e,className:"w-9 px-0","aria-label":"Go to previous page",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_left"})}),(0,r.jsxs)("span",{className:"px-2 text-sm text-text-muted sm:hidden",children:["Page ",(0,r.jsx)("span",{className:"font-medium text-text-main",children:e})," of"," ",(0,r.jsx)("span",{className:"font-medium text-text-main",children:j})]}),(0,r.jsxs)("div",{className:"hidden items-center gap-1 sm:flex",children:[w[0]>1&&(0,r.jsx)(i.default,{variant:"ghost",size:"sm",onClick:()=>d(1),className:"w-9 px-0","aria-label":"Go to first page",children:"1"}),w[0]>2&&(0,r.jsx)(i.default,{variant:"ghost",size:"sm",onClick:()=>d(Math.max(1,e-5)),className:"w-9 px-0","aria-label":"Jump 5 pages back",children:"..."}),w.map(t=>{let a=e===t;return(0,r.jsx)(i.default,{variant:a?"primary":"ghost",size:"sm",onClick:()=>d(t),className:"w-9 px-0","aria-label":`Go to page ${t}`,"aria-current":a?"page":void 0,children:t},t)}),w[w.length-1]<j-1&&(0,r.jsx)(i.default,{variant:"ghost",size:"sm",onClick:()=>d(Math.min(j,e+5)),className:"w-9 px-0","aria-label":"Jump 5 pages forward",children:"..."}),w[w.length-1]<j&&(0,r.jsx)(i.default,{variant:"ghost",size:"sm",onClick:()=>d(j),className:"w-9 px-0","aria-label":"Go to last page",children:j})]}),(0,r.jsx)(i.default,{variant:"outline",size:"sm",onClick:()=>d(e+1),disabled:e===j,className:"w-9 px-0","aria-label":"Go to next page",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_right"})})]})})]})}},51825:(e,t,a)=>{a.d(t,{default:()=>i});var r=a(95155),n=a(84588);let s={mode:{label:"Mode",format:e=>e},defaultModel:{label:"Model",format:e=>e,mono:!0},baseUrl:{label:"Endpoint",format:e=>e,isLink:!0,mono:!0},costPerQuery:{label:"Cost / call",format:e=>0===e?"Free":`$${e.toFixed(4)}`},pricingUrl:{label:"Pricing",format:()=>"View pricing",isLink:!0},freeTier:{label:"Free tier",format:e=>e},freeMonthlyQuota:{label:"Free quota",format:e=>0===e?"—":e>=999999?"Unlimited":`${e.toLocaleString()} / mo`},searchTypes:{label:"Types",format:e=>e.join(", ")},formats:{label:"Formats",format:e=>e.join(", ")},maxMaxResults:{label:"Max results",format:e=>e},maxCharacters:{label:"Max chars",format:e=>e.toLocaleString()}};function i({config:e,provider:t,title:a="Provider Info"}){if(!e)return null;let l=Object.entries(s).filter(([t])=>void 0!==e[t]&&null!==e[t]&&""!==e[t]).map(([t,a])=>({key:t,label:a.label,value:a.format(e[t]),isLink:a.isLink,mono:a.mono,raw:e[t]})),o=t?.notice?.apiKeyUrl||t?.website,d=t?.notice?.text;return(0,r.jsxs)(n.default,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:a}),o&&(0,r.jsxs)("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),"Get API Key"]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-2",children:[l.map(e=>(0,r.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,r.jsx)("span",{className:"text-xs text-text-muted w-28 shrink-0",children:e.label}),e.isLink?(0,r.jsx)("a",{href:e.raw,target:"_blank",rel:"noopener noreferrer",className:`text-sm text-primary hover:underline truncate ${e.mono?"font-mono":""}`,children:e.value}):(0,r.jsx)("span",{className:`text-sm text-text-main truncate ${e.mono?"font-mono":""}`,children:e.value})]},e.key)),d&&(0,r.jsxs)("div",{className:"flex items-start gap-3 min-w-0 sm:col-span-2",children:[(0,r.jsx)("span",{className:"text-xs text-text-muted w-28 shrink-0 mt-0.5",children:"Notice"}),(0,r.jsx)("span",{className:"text-sm text-text-main leading-relaxed",children:d})]})]})]})}},56061:(e,t,a)=>{a.d(t,{default:()=>l});var r=a(95155),n=a(31474);let s={default:"bg-surface-2 text-text-muted",primary:"bg-brand-500/10 text-brand-600 dark:text-brand-300",success:"bg-green-500/10 text-green-600 dark:text-green-400",warning:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",error:"bg-red-500/10 text-red-600 dark:text-red-400",info:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},i={sm:"px-2 py-0.5 text-[10px]",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1.5 text-sm"};function l({children:e,variant:t="default",size:a="md",dot:o=!1,icon:d,className:c}){return(0,r.jsxs)("span",{className:(0,n.cn)("inline-flex items-center gap-1.5 rounded-full font-semibold",s[t],i[a],c),children:[o&&(0,r.jsx)("span",{className:(0,n.cn)("size-1.5 rounded-full","success"===t&&"bg-green-500","warning"===t&&"bg-yellow-500","error"===t&&"bg-red-500","info"===t&&"bg-blue-500","primary"===t&&"bg-brand-500","default"===t&&"bg-gray-500")}),d&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:d}),e]})}},56319:(e,t,a)=>{a.d(t,{default:()=>s});var r=a(95155),n=a(31474);function s({src:e,alt:t="Avatar",name:a,size:i="md",className:l}){let o={xs:"size-6 text-xs",sm:"size-8 text-sm",md:"size-10 text-base",lg:"size-12 text-lg",xl:"size-16 text-xl"};return e?(0,r.jsx)("div",{className:(0,n.cn)("rounded-full bg-cover bg-center bg-no-repeat","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[i],l),style:{backgroundImage:`url(${e})`},role:"img","aria-label":t}):(0,r.jsx)("div",{className:(0,n.cn)("rounded-full flex items-center justify-center font-semibold text-white","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[i],(e=>{if(!e)return"bg-primary";let t=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],a=e.charCodeAt(0)%t.length;return t[a]})(a),l),role:"img","aria-label":t,children:(e=>{if(!e)return"?";let t=e.split(" ");return t.length>=2?`${t[0][0]}${t[1][0]}`.toUpperCase():e.substring(0,2).toUpperCase()})(a)})}},57151:(e,t,a)=>{a.d(t,{Q5:()=>function e(t,a=null,r=null,n=0){if(!t?.length||n>6)return null;let s=t.map(t=>{let s="string"==typeof t?t.trim():String(t?.model||t?.id||"").trim();if(!s)return null;if(!s.includes("/")&&a?.[s])return e(a[s],a,r,n+1)??r?.(s)??N(null,s);let i=s.indexOf("/"),l=N(-1===i?null:s.slice(0,i),-1===i?s:s.slice(i+1)),o=r?.(s);return o?{...l,...o}:l}).filter(Boolean);if(!s.length)return null;let i=s[0];return{vision:s.some(e=>e.vision),pdf:s.some(e=>e.pdf),audioInput:s.some(e=>e.audioInput),videoInput:s.some(e=>e.videoInput),imageOutput:s.some(e=>e.imageOutput),audioOutput:s.some(e=>e.audioOutput),search:s.some(e=>e.search),tools:s.every(e=>e.tools),reasoning:i.reasoning,thinkingFormat:i.thinkingFormat,thinkingCanDisable:i.thinkingCanDisable,thinkingRange:i.thinkingRange,contextWindow:Math.min(...s.map(e=>e.contextWindow)),maxOutput:Math.max(...s.map(e=>e.maxOutput))}},nl:()=>N});var r=a(47224);let n="[-_/:.]",s=RegExp(`(^|${n})(image|img)(${n}|$)|stable-image|gen[0-9]_image|nanobanana|imagine|t2v|i2v|flux|dall|sdxl|diffusion|embed|rerank|guard|moderation|tts|stt|whisper|voice|speech|audio`,"i"),i=RegExp(`(^|${n})(vision|vl|vlm|multimodal|omni|visual)(${n}|$)|[0-9]\\.[0-9]+v(${n}|$)|(^|${n})glm-[0-9]+v(${n}|$)|(^|[-_/:.])(llava|pixtral|internvl|cogvlm|minicpm-v|moondream|idefics|fuyu)`,"i"),l={vision:!1,pdf:!1,audioInput:!1,videoInput:!1,imageOutput:!1,audioOutput:!1,search:!1,tools:!0,reasoning:!1,thinkingFormat:null,thinkingLevels:null,thinkingCanDisable:!0,thinkingRange:null,thinkingEffortSupported:!1,contextWindow:2e5,maxOutput:64e3},o={"claude-fable-5-1":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},"claude-opus-5.5":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5.5-thinking":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5.5-agentic":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5.5-thinking-agentic":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-5":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-5-thinking":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-5-high":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-5-medium":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-5-low":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-thinking":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-agentic":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-thinking-agentic":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.6":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.7":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-7":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.8":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-6":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-8":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.8-thinking":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-8-thinking":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-4.6":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-4-6":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5-5":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-sonnet-5-5-thinking":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-sonnet-5-5-high":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-sonnet-5-5-medium":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-sonnet-5-5-low":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-sonnet-5":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5-thinking":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5-agentic":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5-thinking-agentic":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"gpt-image-1":{imageOutput:!0,tools:!1},"glm-5.3-flash":{vision:!0,videoInput:!0,pdf:!0,reasoning:!0,thinkingFormat:"zai",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:131072},"glm-4.6v":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"zai",contextWindow:128e3,maxOutput:32768},"glm-4.5v":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"zai",contextWindow:64e3,maxOutput:16384},"glm-5.2":{reasoning:!0,thinkingFormat:"zai",thinkingEffortSupported:!0,thinkingCanDisable:!1,contextWindow:1e6,maxOutput:131072},"deepseek-v4.1-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-v4-1-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:128e3,maxOutput:64e3},"deepseek-v4-flash-vision-exp":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"vision-model":{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6},"coder-model":{reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6},"x-preview-f-free":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"opencode",contextWindow:1e6,maxOutput:131072},"big-pickle":{reasoning:!0,thinkingFormat:"opencode",contextWindow:2e5,maxOutput:32e3},"muse-spark-1.2":{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"opencode",contextWindow:1048576,maxOutput:131072},"muse-spark-1.2-contributor-free":{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"opencode",contextWindow:1048576,maxOutput:131072},"mimo-v2.5-free":{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"opencode",contextWindow:2e5,maxOutput:32e3},"kimi-k3":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072},k3:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072},"kimi-for-coding":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"kimi-for-coding-highspeed":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"kimi-k2.7-code":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"kimi-k2.7-code-highspeed":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"muse-spark-1.2-contributor-free":{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:131072},"muse-spark-1.3-contributor-free":{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:131072},"muse-spark-1.3-contributor":{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:131072},"union-alpha":{vision:!0,contextWindow:262144,maxOutput:131072}},d={vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:272e3,maxOutput:128e3},c=["minimal","low","medium","high","xhigh","max","ultra"],u={vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",thinkingCanDisable:!1,thinkingLevels:c,contextWindow:372e3,maxOutput:128e3},m={vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",thinkingCanDisable:!1,thinkingLevels:c,contextWindow:272e3,maxOutput:128e3},x={vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",thinkingCanDisable:!1,thinkingLevels:["minimal","low","medium","high","xhigh","max"],contextWindow:272e3,maxOutput:128e3},p={...x,contextWindow:872e3},h={vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:128e3},g={reasoning:!0,thinkingFormat:"qoder",thinkingCanDisable:!0,maxOutput:64e3},f={...g,vision:!0},b={auto:f,qmodel_preview:f,qmodel_latest:f,qmodel:f,q36fmodel:f,dmodel:f,dfmodel:{...f,reasoning:!1},gm51model:f,kmodel:f,mmodel:{reasoning:!1,vision:!1,thinkingFormat:"openai",thinkingCanDisable:!0,maxOutput:64e3},gmodel:f,gfmodel:f,kmodel_latest:f,qfmodel:f,qmodel_38max:f,ultimate:g,performance:g,efficient:g,lite:g},v={qoder:b,"qoderwork-cn":b,deepseek:{"deepseek-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-v4-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-v4-flash-vision-exp":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3}},nvidia:{"minimaxai/minimax-m3":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:512e3,maxOutput:131072},"z-ai/glm-5.2":{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:128e3},"deepseek-ai/deepseek-v4-flash-0731":{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:65536}},codex:{"gpt-6-astra":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:272e3,maxOutput:128e3},"gpt-6-sol":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:272e3,maxOutput:128e3},"gpt-6.1-sol":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:872e3,maxOutput:128e3},"gpt-6-luna":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:272e3,maxOutput:128e3},"gpt-6-astra[1m]":p,"gpt-6-sol[1m]":p,"gpt-6-luna[1m]":p,"gpt-5.6-sol[1m]":p,"gpt-5.6-terra[1m]":p,"gpt-5.6-luna[1m]":p,"gpt-5.6-sol":u,"gpt-5.6-sol-review":u,"gpt-5.6-terra":m,"gpt-5.6-terra-review":m,"gpt-5.6-luna":x,"gpt-5.6-luna-review":x},kiro:{"gpt-5.6-sol":d,"gpt-5.6-terra":d,"gpt-5.6-luna":d,"gpt-5.6-sol-thinking":d,"gpt-5.6-terra-thinking":d,"gpt-5.6-luna-thinking":d,"gpt-5.6-sol-agentic":d,"gpt-5.6-terra-agentic":d,"gpt-5.6-luna-agentic":d,"gpt-5.6-sol-thinking-agentic":d,"gpt-5.6-terra-thinking-agentic":d,"gpt-5.6-luna-thinking-agentic":d},"devin-cli":{"gpt-5.4-high":h,"gpt-5.4-medium":h,"gpt-5.4-low":h,"gpt-5.5-xhigh":h,"gpt-5.5-high":h,"gpt-5.5-medium":h,"gpt-5.5-low":h},"codebuddy-cn":{"glm-5.2":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:48e3},"glm-5.1":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:48e3},"glm-5v-turbo":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:38e3},"minimax-m3":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:512e3,maxOutput:48e3},"kimi-k2.7":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:256e3,maxOutput:32e3},"kimi-k2.6":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:256e3,maxOutput:32e3},"kimi-k2.5":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:164e3,maxOutput:32e3},"hy3-preview":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:192e3,maxOutput:64e3},"deepseek-v4-flash":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:5e4},"deepseek-v3-2-volc":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:96e3,maxOutput:32e3},hy3:{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:192e3,maxOutput:64e3},"hy4-preview":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:64e3},"glm-5.3":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:48e3},"glm-5.3-flash":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:32e3},"kimi-k3-1":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:32e3},"deepseek-v4-pro":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:5e4},"deepseek-v4.1-flash":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:128e3}},"codebuddy-intl":{"deepseek-v4.1-flash":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:128e3}},poolside:{"laguna-s-2.1":{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:32e3},"laguna-xs-2.1":{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:32e3}},nous:{"nousresearch/hermes-4-70b":{tools:!1,reasoning:!0,thinkingFormat:"nous",contextWindow:131072,maxOutput:32e3},"nousresearch/hermes-4-405b":{tools:!1,reasoning:!0,thinkingFormat:"nous",contextWindow:131072,maxOutput:32e3}},meta:{"muse-spark-1.2-contributor":{reasoning:!0,thinkingFormat:"meta",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:64e3},"muse-spark-1.2":{reasoning:!0,thinkingFormat:"meta",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:64e3},"muse-spark-1.1":{reasoning:!0,thinkingFormat:"meta",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:64e3}},ollama:{"deepseek-v4.1-flash:cloud":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3}}};v["qoder-cn"]=v.qoder,v.cx=v.codex,v.dv=v["devin-cli"],v.devin=v["devin-cli"],v.ds=v.deepseek;let j=[{pattern:"*qoder*",caps:g},{pattern:"*claude*opus-5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*sonnet-5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*opus-4.6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*opus-4.7*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*opus-4.8*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*sonnet-4.6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*sonnet-4.7*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*haiku*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*opus*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*sonnet*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*fable*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*mythos*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude-3*",caps:{vision:!0}},{pattern:"*claude*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*gemini*image*",caps:{vision:!0,imageOutput:!0,contextWindow:1048576}},{pattern:"*gemini-4*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-3.8*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-3.7*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-3*pro*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65535}},{pattern:"*gemini-3*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-2.5*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-budget",thinkingRange:{min:0,max:24576},contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-2*",caps:{vision:!0,audioInput:!0,videoInput:!0,search:!0,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini*",caps:{vision:!0,search:!0,contextWindow:1048576}},{pattern:"*gemma*",caps:{vision:!0,contextWindow:128e3}},{pattern:"*nanobanana*",caps:{vision:!0,imageOutput:!0}},{pattern:"*gpt-6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:105e4,maxOutput:128e3}},{pattern:"*gpt-5*image*",caps:{imageOutput:!0}},{pattern:"*gpt-5*codex*",caps:{reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:4e5,maxOutput:128e3}},{pattern:"*gpt-5.4-mini*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:4e5,maxOutput:128e3}},{pattern:"*gpt-5.4-nano*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:4e5,maxOutput:128e3}},{pattern:"*gpt-5.4*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:105e4,maxOutput:128e3}},{pattern:"*gpt-5.5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:105e4,maxOutput:128e3}},{pattern:"*gpt-5.6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:105e4,maxOutput:128e3}},{pattern:"*gpt-5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:4e5,maxOutput:128e3}},{pattern:"*gpt-4o*",caps:{vision:!0,search:!0,contextWindow:128e3,maxOutput:16384}},{pattern:"*gpt-4.1*",caps:{vision:!0,contextWindow:1e6,maxOutput:32768}},{pattern:"*gpt-4-turbo*",caps:{vision:!0,contextWindow:128e3}},{pattern:"*gpt-4*",caps:{contextWindow:128e3}},{pattern:"*gpt-3.5*",caps:{contextWindow:16385,maxOutput:4096}},{pattern:"*gpt-oss*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:128e3}},{pattern:"*solar-pro*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:32e3}},{pattern:"*longcat*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:32e3}},{pattern:"*o1-mini*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:128e3}},{pattern:"*o1*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:1e5}},{pattern:"*o3*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:1e5}},{pattern:"*o4*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:1e5}},{pattern:"*grok*image*",caps:{imageOutput:!0}},{pattern:"*grok-code*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:256e3}},{pattern:"*grok-4.6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:5e5,maxOutput:5e5}},{pattern:"*grok-4.5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:5e5,maxOutput:64e3}},{pattern:"*grok-4*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:256e3}},{pattern:"*grok-3*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:131072}},{pattern:"*grok*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:256e3}},{pattern:"*qwen*vl*",caps:{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*qwen*omni*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:262144,maxOutput:65536}},{pattern:"*qwen*coder*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6}},{pattern:"*qwen3.8-2.4t*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*qwen3.8*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen*max*",caps:{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.5*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.6*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.7*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.8*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen*plus*",caps:{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen*235b*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*qwq*",caps:{reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:131072}},{pattern:"*qwen*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*longcat-2.5*",caps:{reasoning:!0,contextWindow:65e4}},{pattern:"*kimi*k3*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*kimi*for-coding*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536}},{pattern:"*kimi*k2.7*code*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536}},{pattern:"*kimi*k2*",caps:{vision:!0,reasoning:!0,thinkingFormat:"kimi",contextWindow:262144,maxOutput:262144}},{pattern:"*kimi*",caps:{reasoning:!0,thinkingFormat:"kimi",contextWindow:262144}},{pattern:"*glm-5.3-flash*",caps:{vision:!0,videoInput:!0,pdf:!0,reasoning:!0,thinkingFormat:"zai",thinkingEffortSupported:!0,thinkingCanDisable:!1,contextWindow:1e6,maxOutput:131072}},{pattern:"*glm-5.3*",caps:{reasoning:!0,thinkingFormat:"zai",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:128e3}},{pattern:"*glm-5.2*",caps:{reasoning:!0,thinkingFormat:"zai",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:128e3}},{pattern:"*glm-5*",caps:{reasoning:!0,thinkingFormat:"zai",contextWindow:2e5,maxOutput:128e3}},{pattern:"*glm-4.7*",caps:{reasoning:!0,thinkingFormat:"zai",contextWindow:2e5,maxOutput:128e3}},{pattern:"*glm-4*",caps:{reasoning:!0,thinkingFormat:"zai",contextWindow:2e5}},{pattern:"*glm*",caps:{reasoning:!0,thinkingFormat:"zai",contextWindow:2e5}},{pattern:"*deepseek-v4*vision*",caps:{vision:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:384e3}},{pattern:"*deepseek-v4.1*",caps:{vision:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:128e3}},{pattern:"*deepseek-v4*",caps:{reasoning:!0,thinkingFormat:"deepseek",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:384e3}},{pattern:"*reasoner*",caps:{reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:128e3}},{pattern:"*deepseek-r*",caps:{reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:128e3}},{pattern:"*deepseek-chat*",caps:{contextWindow:128e3}},{pattern:"*deepseek*",caps:{reasoning:!0,thinkingFormat:"deepseek",contextWindow:128e3}},{pattern:"*minimax*image*",caps:{imageOutput:!0}},{pattern:"*minimax-m3*",caps:{vision:!0,reasoning:!0,thinkingFormat:"minimax",contextWindow:1e6,maxOutput:131072}},{pattern:"*minimax-m2.7*",caps:{vision:!0,reasoning:!0,thinkingFormat:"minimax",thinkingCanDisable:!1,contextWindow:204800,maxOutput:131072}},{pattern:"*minimax-m2.5*",caps:{vision:!0,reasoning:!0,thinkingFormat:"minimax",thinkingCanDisable:!1,contextWindow:204800,maxOutput:131072}},{pattern:"*minimax*",caps:{reasoning:!0,thinkingFormat:"minimax",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:131072}},{pattern:"*mimo*v2.6*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*mimo*v2.5*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*mimo*omni*",caps:{vision:!0,audioInput:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:262144,maxOutput:131072}},{pattern:"*mimo*",caps:{vision:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:262144,maxOutput:131072}},{pattern:"*llama-4*",caps:{vision:!0,contextWindow:1e6}},{pattern:"*llama*",caps:{contextWindow:128e3}},{pattern:"*codestral*",caps:{contextWindow:256e3}},{pattern:"*mistral-large*",caps:{vision:!0,contextWindow:256e3}},{pattern:"*mistral*",caps:{contextWindow:128e3}},{pattern:"*command-a-vision*",caps:{vision:!0,contextWindow:128e3}},{pattern:"*command*",caps:{contextWindow:128e3}},{pattern:"*sonar*",caps:{search:!0,contextWindow:128e3}},{pattern:"*pplx*",caps:{search:!0,contextWindow:128e3}},{pattern:"*perplexity*",caps:{search:!0,contextWindow:128e3}},{pattern:"*laguna-s-2.1*free*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:32e3}},{pattern:"*laguna-s-2.1*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:32e3}},{pattern:"*laguna*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:32e3}},{pattern:"*muse-spark*",caps:{vision:!0,videoInput:!0,audioInput:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:131072}},{pattern:"*muse*spark*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:131072}},{pattern:"*muse-glimmer*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:128e3}},{pattern:"*muse*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:128e3}},{pattern:"*hunyuan*",caps:{reasoning:!0,thinkingFormat:"hunyuan",contextWindow:262144,maxOutput:262144}},{pattern:"hy3*",caps:{reasoning:!0,thinkingFormat:"hunyuan",contextWindow:262144,maxOutput:262144}},{pattern:"*step-3.7*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"step",contextWindow:262144,maxOutput:65536}},{pattern:"*step-*",caps:{reasoning:!0,thinkingFormat:"step",contextWindow:128e3}},{pattern:"*nemotron*",caps:{reasoning:!0,contextWindow:128e3}},{pattern:"*ling-*",caps:{reasoning:!0,contextWindow:128e3}}],y=["vision","pdf","audioInput","videoInput"];function k(e,t,a){let r={...l,...e},n="u"<typeof globalThis?null:globalThis.__9rCatalogSource||null;if(n){let e=n.getModalities(t,a);if(e)for(let t of y)!0===e[t]&&(r[t]=!0);let s=n.getLimits(t,a);s&&(s.contextWindow>0&&(r.contextWindow=s.contextWindow),s.maxOutput>0&&(r.maxOutput=s.maxOutput))}return!r.vision&&function(e){if(!e)return!1;let t=String(e).toLowerCase();return!s.test(t)&&i.test(t)}(a)&&(r.vision=!0),r}let w=new Set(["deepseek/deepseek-v4-pro","deepseek/deepseek-v4-flash","deepseek/deepseek-v4-flash-fast","zai-org/glm-5.3","zai-org/glm-5.2","zai-org/glm-5.2-fast","zai-org/glm-5.1","zai-org/glm-5","minimaxai/minimax-m2.7","minimax/minimax-m2.7-free","minimaxai/minimax-m2.5","xiaomi/mimo-v2.5-pro","qwen/qwen3.6-max-preview","qwen/qwen3.7-max","meituan/longcat-2.0:free","stepfun/step-3.5-flash","tencent/hy4-preview","tencent/hy3","tencent/hy3-paid","nvidia/nemotron-3-ultra-550b-a55b","poolside/laguna-s-2.1-free","inclusionai/ling-3.0-flash-free","inclusionai/ling-3.0-flash-sante:free"]);function N(e,t){if(!t)return{...l};let a=t.includes("/")?t.split("/").pop():t;if("commandcode"===e||"cmc"===e){let e=v.commandcode;return e?.[t]?{...l,...e[t]}:e?.[a]?{...l,...e[a]}:{...l,reasoning:!0,thinkingFormat:"commandcode",thinkingEffortSupported:!0,vision:!function(e){let t=String(e||"").toLowerCase();if(w.has(t))return!0;for(let e of w){let a=e.includes("/")?e.slice(e.lastIndexOf("/")+1):e;if(t===a||t.endsWith("/"+a))return!0}return!1}(t),contextWindow:1e6,maxOutput:384e3}}if(e){let r=v[e];if(r?.[t])return{...l,...r[t]};if(r?.[a])return{...l,...r[a]}}if(o[a])return k(o[a],e,t);if(o[t])return k(o[t],e,t);for(let{pattern:n,caps:s}of j)if((0,r.gH)(n,a)||(0,r.gH)(n,t))return k(s,e,t);return k(null,e,t)}},57250:(e,t,a)=>{a.d(t,{A:()=>o});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(8247);function o({src:e,providerId:t,alt:a,size:s=32,className:i="",fallbackText:d="?",fallbackColor:c}){let u=function(e,t){if(t)return(0,l.HY)(t);if(!e)return null;let a=String(e).match(/^\/providers\/([^/]+)\.png$/i);return a?(0,l.HY)(a[1]):e}(e,t),[m,x]=(0,n.useState)(!1);return!u||m?(0,r.jsx)("span",{className:`inline-flex items-center justify-center font-bold rounded-lg ${i}`.trim(),style:{width:s,height:s,color:c,fontSize:Math.max(10,Math.floor(.38*s))},children:d}):(0,r.jsx)("img",{src:u,alt:a,width:s,height:s,className:i,loading:"lazy",decoding:"async",onError:()=>{let e=u.match(/^\/providers\/([^/]+)\.png$/i);e&&(0,l.Kw)(e[1]),t&&(0,l.Kw)(t),x(!0)}})}o.propTypes={src:i().string,providerId:i().string,alt:i().string,size:i().number,className:i().string,fallbackText:i().string,fallbackColor:i().string}},62899:(e,t,a)=>{a.d(t,{default:()=>c});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(90882),o=a(85416),d=a(94230);function c({isOpen:e,providerInfo:t,onSuccess:a,onClose:s}){let[i,u]=(0,n.useState)(null),[m,x]=(0,n.useState)(null),[p,h]=(0,n.useState)(null),g=(0,n.useCallback)((e,t)=>{"builder-id"===e?u("builder-id"):"idc"===e?(u("idc"),h(t)):"social"===e?(u("social"),x(t.provider)):("import"===e||"import-cli-proxy"===e||"api-key"===e)&&a?.()},[a]),f=()=>{u(null),x(null),h(null)};return i?"builder-id"===i||"idc"===i?(0,r.jsx)(l.default,{isOpen:e,provider:"kiro",providerInfo:t,onSuccess:()=>{u(null),h(null),a?.(),s?.()},onClose:f,idcConfig:p}):"social"===i&&m?(0,r.jsx)(d.default,{isOpen:e,provider:m,onSuccess:()=>{u(null),x(null),a?.(),s?.()},onClose:f}):null:(0,r.jsx)(o.default,{isOpen:e,onMethodSelect:g,onClose:s})}c.propTypes={isOpen:i().bool.isRequired,providerInfo:i().shape({name:i().string}),onSuccess:i().func,onClose:i().func.isRequired}},65921:(e,t,a)=>{a.d(t,{i:()=>s});var r=a(1934);let n=0,s=(0,r.v)((e,t)=>({notifications:[],addNotification:a=>{let r=++n,s={id:r,type:a.type||"info",message:a.message,title:a.title||null,duration:a.duration??5e3,dismissible:a.dismissible??!0,createdAt:Date.now()};return e(e=>({notifications:[...e.notifications,s]})),s.duration>0&&setTimeout(()=>t().removeNotification(r),s.duration),r},removeNotification:t=>{e(e=>({notifications:e.notifications.filter(e=>e.id!==t)}))},clearAll:()=>e({notifications:[]}),success:(e,a)=>t().addNotification({type:"success",message:e,title:a}),error:(e,a)=>t().addNotification({type:"error",message:e,title:a,duration:8e3}),warning:(e,a)=>t().addNotification({type:"warning",message:e,title:a}),info:(e,a)=>t().addNotification({type:"info",message:e,title:a})}))},67968:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(95155),n=a(12115),s=a(47650);let i=[{icon:"terminal",label:"Terminal",desc:"Full shell access"},{icon:"cast",label:"Desktop",desc:"Screen sharing"},{icon:"folder_open",label:"Files",desc:"Browse & edit files"}],l=[{icon:"qr_code_scanner",text:"Scan QR to connect instantly"},{icon:"wifi_off",text:"No port forwarding needed"},{icon:"devices",text:"Works on any device"}];function o({isOpen:e,onClose:t}){return((0,n.useEffect)(()=>{if(!e)return;document.body.style.overflow="hidden";let a=e=>{"Escape"===e.key&&t()};return document.addEventListener("keydown",a),()=>{document.body.style.overflow="",document.removeEventListener("keydown",a)}},[e,t]),e)?(0,s.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:t}),(0,r.jsxs)("div",{className:"relative w-full max-w-sm rounded-[14px] overflow-hidden shadow-[var(--shadow-elev)] fade-in flex flex-col bg-surface border border-border-subtle",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border-subtle",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-7 h-7 rounded-[8px] flex items-center justify-center bg-primary",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-white text-base",children:"terminal"})}),(0,r.jsx)("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-mono",children:"9Remote"})]}),(0,r.jsx)("button",{onClick:t,className:"p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-base",children:"close"})})]}),(0,r.jsxs)("div",{className:"px-7 py-7 pb-9 flex flex-col gap-6",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center mt-2",children:[(0,r.jsx)("div",{className:"w-14 h-14 rounded-[14px] flex items-center justify-center mb-1 bg-primary shadow-[var(--shadow-warm)]",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-white text-[30px]",children:"terminal"})}),(0,r.jsx)("h1",{className:"text-lg font-bold text-text-main tracking-tight",children:"9Remote"}),(0,r.jsx)("p",{className:"text-xs text-text-muted leading-5 max-w-[220px]",children:"Access your terminal, desktop & files from anywhere"})]}),(0,r.jsx)("div",{className:"flex gap-2 w-full",children:i.map(({icon:e,label:t,desc:a})=>(0,r.jsxs)("div",{className:"flex-1 flex flex-col items-center gap-1.5 py-4 px-1 rounded-[10px] border border-border-subtle bg-surface-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-[22px]",children:e}),(0,r.jsx)("p",{className:"text-xs font-semibold text-text-main",children:t}),(0,r.jsx)("p",{className:"text-[10px] text-text-muted text-center leading-4",children:a})]},t))}),(0,r.jsx)("div",{className:"flex flex-col gap-3 w-full",children:l.map(({icon:e,text:t})=>(0,r.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined flex-shrink-0 text-primary text-[16px]",children:e}),(0,r.jsx)("span",{className:"text-xs text-text-muted",children:t})]},e))}),(0,r.jsxs)("button",{onClick:()=>window.open("https://9remote.cc","_blank"),className:"w-full py-3 flex items-center justify-center gap-2 text-sm font-semibold text-white rounded-[10px] bg-primary hover:bg-primary-hover shadow-[var(--shadow-warm)] active:scale-[0.98] transition-all",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base",children:"open_in_new"}),"Get 9Remote"]})]})]})]}),document.body):null}function d(){let[e,t]=(0,n.useState)(!1);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{onClick:()=>t(!0),className:"relative flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg transition-all text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5",title:"9Remote",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"computer"}),(0,r.jsx)("span",{className:"text-xs font-medium",children:"Remote"})]}),(0,r.jsx)(o,{isOpen:e,onClose:()=>t(!1)})]})}},72767:(e,t,a)=>{a.d(t,{A:()=>i});var r=a(1934),n=a(90620);let s=null,i=(0,r.v)((e,t)=>({settings:null,loading:!1,error:null,lastFetched:0,invalidate:()=>e({lastFetched:0}),fetchSettings:async({force:a=!1}={})=>{let{lastFetched:r,settings:i}=t();return!a&&i&&Date.now()-r<n.U5?i:s||(e({loading:!0,error:null}),s=(async()=>{try{let t=await fetch("/api/settings"),a=await t.json();if(t.ok)return e({settings:a,loading:!1,lastFetched:Date.now()}),a;e({error:a.error,loading:!1})}catch(t){e({error:"Failed to fetch settings",loading:!1})}finally{s=null}return null})())},patchSettings:async a=>{try{let r=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!r.ok)return null;let n=await r.json();return e({settings:{...t().settings,...n},lastFetched:Date.now()}),n}catch{return null}}}))},72908:(e,t,a)=>{a.d(t,{default:()=>f});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(81127),o=a(57250),d=a(29366),c=a(929),u=a(28777),m=a(88105);let x=[...Object.keys(m.zN),...Object.keys(m.IS),...Object.keys(m.nJ),...Object.keys(m.fg)],p=Object.keys(m.IS).filter(e=>m.IS[e].noAuth),h=["cursor","cline","clinepass","zed"];function g(e,t,a){let[r,s]=(0,n.useState)([]),i=(t??[]).join("|");return(0,n.useEffect)(()=>{let t=i?i.split("|"):[];if(!e||0===t.length)return void s([]);let r=!1;return Promise.all(t.map(async e=>{let t=await fetch(`/api/providers/${e}/models`,{cache:"no-store"});if(!t.ok)return[];let a=await t.json();return Array.isArray(a.models)?a.models:[]})).then(e=>{if(r)return;let t=new Set;s(e.flat().filter(e=>!(!e?.id||t.has(e.id))&&(t.add(e.id),!0)))}).catch(e=>{console.warn(`Unable to load ${a} models for selector:`,e),r||s([])}),()=>{r=!0}},[e,i,a]),r}function f({isOpen:e,onClose:t,onSelect:a,onDeselect:s,selectedModel:i,activeProviders:b=[],title:v="Select Model",modelAliases:j={},kindFilter:y=null,capFilter:k=null,addedModelValues:w=[],closeOnSelect:N=!0,comboContext:C=null}){let S=(0,n.useMemo)(()=>b.filter(e=>{if(!1===e.isActive||m.Q2[e.provider]?.hidden)return!1;if(!y)return!0;let t=m.Q2[e.provider];return(t?.serviceKinds||["llm"]).includes(y)}),[b,y]),{getCaps:O}=(0,c.y)(),[F,W]=(0,n.useState)(""),[I,P]=(0,n.useState)([]),[T,E]=(0,n.useState)([]),[$,_]=(0,n.useState)([]),[z,A]=(0,n.useState)({}),R=(0,n.useMemo)(()=>{let e=Object.fromEntries(h.map(e=>[e,[]]));for(let t of S)t?.id&&Object.prototype.hasOwnProperty.call(e,t.provider)&&e[t.provider].push(t.id);return e},[S]),D=R.cursor,U=R.cline,L=R.clinepass,q=R.zed,M=g(e,D,"Cursor"),V=g(e,U,"Cline"),K=g(e,L,"ClinePass"),J=g(e,q,"Zed"),B=async()=>{try{let e=await fetch("/api/combos");if(!e.ok)throw Error(`Failed to fetch combos: ${e.status}`);let t=await e.json();P(t.combos||[])}catch(e){console.error("Error fetching combos:",e),P([])}};(0,n.useEffect)(()=>{e&&B()},[e]);let G=async()=>{try{let e=await fetch("/api/provider-nodes");if(!e.ok)throw Error(`Failed to fetch provider nodes: ${e.status}`);let t=await e.json();E(t.nodes||[])}catch(e){console.error("Error fetching provider nodes:",e),E([])}};(0,n.useEffect)(()=>{e&&G()},[e]);let Q=async()=>{try{let e=await fetch("/api/models/custom");if(!e.ok)throw Error(`Failed to fetch custom models: ${e.status}`);let t=await e.json();_(t.models||[])}catch(e){console.error("Error fetching custom models:",e),_([])}};(0,n.useEffect)(()=>{e&&Q()},[e]);let H=async()=>{try{let e=await fetch("/api/models/disabled");if(!e.ok)throw Error(`Failed to fetch disabled models: ${e.status}`);let t=await e.json();A(t.disabled||{})}catch(e){console.error("Error fetching disabled models:",e),A({})}};(0,n.useEffect)(()=>{e&&H()},[e]);let Y=(0,n.useMemo)(()=>({...m.zN,...m.IS,...m.nJ,...m.fg}),[]),Z=(0,n.useMemo)(()=>{let e={},t=new Set(["webSearch","webFetch"]),a=new Set(["image","tts","stt","embedding","imageToText"]),r=new Set(["tts","image","webFetch"]);return[...new Set([...S.map(e=>e.provider),...y?p.filter(e=>(m.Q2[e]?.serviceKinds||["llm"]).includes(y)):p])].sort((e,t)=>{let a=x.indexOf(e),r=x.indexOf(t);return(-1===a?999:a)-(-1===r?999:r)}).forEach(n=>{if(m.Q2[n]?.hidden)return;let s=(0,m.wG)(n),i=Y[n]||{name:n,color:"#666"},l=(0,m.mq)(n)||(0,m.gb)(n);if(y&&t.has(y)){e[n]={name:i.name,alias:s,color:i.color,models:[{id:n,name:i.name,value:n}]};return}if(i.passthroughModels){let t=Object.entries(j).filter(([,e])=>e.startsWith(`${s}/`)).map(([e,t])=>({id:t.replace(`${s}/`,""),name:e,value:t})),l=$.filter(e=>e.providerAlias===s).map(e=>({id:e.id,name:e.name||e.id,value:`${s}/${e.id}`,kind:(0,u.CP)(e),isCustom:!0})),o=t;if(y&&a.has(y)){let e=l.filter(e=>(0,u.CP)(e)===y);0===(o=[...e,...(0,u.KC)(n).filter(e=>(0,u.CP)(e)===y).map(e=>({id:e.id,name:e.name,value:`${s}/${e.id}`,kind:(0,u.CP)(e)})).filter(t=>!e.some(e=>e.value===t.value))]).length&&r.has(y)&&(i.serviceKinds||["llm"]).includes(y)&&(o=[{id:n,name:i.name,value:s}])}else{let e=l.filter(e=>!(0,u.CP)(e)||"llm"===(0,u.CP)(e)),a=new Set([...t,...e].map(e=>e.value)),r=(0,u.KC)(n).filter(e=>!(0,u.CP)(e)||"llm"===(0,u.CP)(e)).map(e=>({id:e.id,name:e.name,value:`${s}/${e.id}`,kind:(0,u.CP)(e)})).filter(e=>!a.has(e.value));o=[...e,...t.filter(t=>!e.some(e=>e.value===t.value)),...r]}if(o.length>0){let t=T.find(e=>e.id===n),a=t?.name||i.name;e[n]={name:a,alias:s,color:i.color,models:o}}}else if(l){if(y&&a.has(y))return;let t=S.find(e=>e.provider===n),r=T.find(e=>e.id===n),s=r?.name||t?.name||i.name,l=t?.providerSpecificData?.prefix||r?.prefix||n,o=Object.entries(j).filter(([,e])=>e.startsWith(`${n}/`)).map(([e,t])=>({id:t.replace(`${n}/`,""),name:e,value:`${l}/${t.replace(`${n}/`,"")}`})),d=$.filter(e=>e.providerAlias===n).map(e=>({id:e.id,name:e.name||e.id,value:`${l}/${e.id}`,isCustom:!0})),c=new Set(o.map(e=>e.value)),u=[...o,...d.filter(e=>!c.has(e.value))],m=u.length>0?u:[{id:`__placeholder__${n}`,name:`${l}/model-id`,value:`${l}/model-id`,isPlaceholder:!0}];e[n]={name:s,alias:l,color:i.color,models:m,isCustom:!0,hasModels:u.length>0}}else{var o;let t="cursor"===n?M:"cline"===n?V:"clinepass"===n?K:"zed"===n?J:[],l=t.length>0?t:(0,u.KC)(n),d=new Set(l.map(e=>e.id)),c=l.length>0,m=Object.entries(j).filter(([e,t])=>t.startsWith(`${s}/`)&&(!c||e===t.replace(`${s}/`,""))&&!d.has(t.replace(`${s}/`,""))).map(([e,t])=>({id:t.replace(`${s}/`,""),name:e,value:t,isCustom:!0})),x=new Set(m.map(e=>e.id)),p=$.filter(e=>e.providerAlias===s&&!d.has(e.id)&&!x.has(e.id)).map(e=>({id:e.id,name:e.name||e.id,value:`${s}/${e.id}`,isCustom:!0})),h=[...l.map(e=>({id:e.id,name:e.name,value:`${s}/${e.id}`,kind:(0,u.CP)(e)})),...m,...p],g=new Set,f=(o=h.filter(e=>!g.has(e.value)&&(g.add(e.value),!0)),y?a.has(y)?o.filter(e=>e.isPlaceholder||(0,u.CP)(e)===y):o:o.filter(e=>e.isPlaceholder||e.isCustom||!(0,u.CP)(e)||"llm"===(0,u.CP)(e)));0===f.length&&y&&r.has(y)&&(i.serviceKinds||["llm"]).includes(y)&&(f=[{id:n,name:i.name,value:s}]),f.length>0&&(e[n]={name:i.name,alias:s,color:i.color,models:f})}}),Object.entries(e).forEach(([t,a])=>{let r=new Set([...z[(0,m.wG)(t)]||[],...z[t]||[]]);0!==r.size&&(a.models=a.models.filter(e=>!r.has(e.id)),0===a.models.length&&delete e[t])}),e},[S,j,Y,T,$,z,y,M,V,K]),X=(0,n.useMemo)(()=>{if(y||k)return[];if(!F.trim())return I;let e=F.toLowerCase();return I.filter(t=>t.name.toLowerCase().includes(e))},[I,F,y]),ee=function(e,t){let a=t?.name?.trim(),r=t?.id;if(!a&&!r)return new Set;let n=new Map(e.filter(e=>e.id!==r).map(e=>[e.name,Array.isArray(e.models)?e.models:[]])),s=(e,t=new Set)=>{if(a&&e===a)return!0;if(t.has(e))return!1;let r=n.get(e);if(!r)return!1;t.add(e);let i=r.some(e=>s(e,t));return t.delete(e),i};return new Set(e.filter(e=>e.id===r||s(e.name)).map(e=>e.name))}(I,C),et=(0,n.useMemo)(()=>{let e=F.trim().toLowerCase(),t={};return Object.entries(Z).forEach(([a,r])=>{var n;let s=r.models;if(!k||0!==(s=s.filter(e=>O(e.value)?.[k]===!0)).length){if(e){let t=r.name.toLowerCase().includes(e);if(0===(s=s.filter(t=>t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e))).length&&!t)return}t[a]={...r,models:[...(n=s).filter(e=>w.includes(e.value)).sort((e,t)=>e.name.localeCompare(t.name)),...n.filter(e=>!w.includes(e.value)).sort((e,t)=>e.name.localeCompare(t.name))]}}}),t},[Z,F,w]),ea=e=>{let r=e?.value||e?.name||e;w.includes(r)&&s?s(e):a(e),N&&(t(),W(""))};return(0,r.jsxs)(l.default,{isOpen:e,onClose:()=>{t(),W("")},title:v,size:"md",className:"p-4!",footer:null,children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-3 px-2.5 py-2 bg-primary/8 border border-primary/20 rounded-lg text-xs text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary shrink-0",style:{fontSize:"14px"},children:"info"}),(0,r.jsx)("span",{children:"Click to add, click again to remove. Changes are saved automatically."})]}),(0,r.jsx)("div",{className:"mb-3",children:(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("span",{className:"material-symbols-outlined absolute left-2.5 top-1/2 -translate-y-1/2 text-text-muted text-[16px]",children:"search"}),(0,r.jsx)("input",{type:"text",placeholder:"Search...",value:F,onChange:e=>W(e.target.value),className:"w-full pl-8 pr-3 py-1.5 bg-surface border border-border rounded text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"})]})}),(0,r.jsxs)("div",{className:"max-h-[400px] overflow-y-auto space-y-3",children:[X.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-[14px]",children:"layers"}),(0,r.jsx)("span",{className:"text-xs font-medium text-primary",children:"Combos"}),(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",X.length,")"]})]}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:X.map(e=>{let t=i===e.name,a=w.includes(e.name),n=!a&&ee.has(e.name);return(0,r.jsxs)("button",{disabled:n,onClick:()=>ea({id:e.name,name:e.name,value:e.name}),title:n?"Selecting this combo would create a circular reference":void 0,className:`
12
12
  px-2 py-1 rounded-xl text-xs font-medium transition-all border flex items-center gap-1
13
13
  ${n?"bg-surface border-border text-text-muted opacity-50 cursor-not-allowed":t?"bg-primary text-white border-primary":a?"bg-primary border-primary text-white hover:bg-primary-hover":"bg-surface border-border text-text-main hover:border-primary/50 hover:bg-primary/5 hover:cursor-pointer"}
14
14
  `,children:[n?(0,r.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"block"}):a&&(0,r.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),e.name]},e.id)})})]}),Object.entries(et).map(([e,t])=>(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,r.jsx)(o.A,{src:`/providers/${e}.png`,alt:t.name,size:14,fallbackText:(t.name||e).slice(0,2).toUpperCase(),fallbackColor:t.color}),(0,r.jsx)("span",{className:"text-xs font-medium text-primary",children:t.name}),(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",t.models.length,")"]})]}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:t.models.map(e=>{let t=i===e.value,a=e.isPlaceholder;return(0,r.jsx)("button",{onClick:()=>ea(e),title:a?"Select to pre-fill, then edit model ID in the input":void 0,className:`
15
15
  px-2 py-1 rounded-xl text-xs font-medium transition-all border hover:cursor-pointer
16
16
  ${a?"border-dashed border-border text-text-muted hover:border-primary/50 hover:text-primary bg-surface italic":t?"bg-primary text-white border-primary":w.includes(e.value)?"bg-primary border-primary text-white hover:bg-primary-hover":"bg-surface border-border text-text-main hover:border-primary/50 hover:bg-primary/5"}
17
- `,children:(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[w.includes(e.value)&&!a&&(0,r.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),a?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"edit"}),e.name]}):(0,r.jsxs)(r.Fragment,{children:[e.value,(0,r.jsx)(d.default,{caps:O(e.value)})]})]})},e.value)})})]},e)),0===Object.keys(et).length&&0===X.length&&(0,r.jsxs)("div",{className:"text-center py-4 text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1 block",children:"search_off"}),(0,r.jsx)("p",{className:"text-xs",children:"No models found"})]})]})]})}f.propTypes={isOpen:i().bool.isRequired,onClose:i().func.isRequired,onSelect:i().func.isRequired,onDeselect:i().func,selectedModel:i().string,activeProviders:i().arrayOf(i().shape({provider:i().string.isRequired})),title:i().string,modelAliases:i().object,kindFilter:i().string,addedModelValues:i().arrayOf(i().string),closeOnSelect:i().bool,comboContext:i().shape({id:i().string,name:i().string})}},73147:(e,t,a)=>{a.d(t,{BM:()=>m,MY:()=>i,TJ:()=>u,eK:()=>o,yM:()=>x,zV:()=>l});let r="9router:lastSeenVersion",n="9router:updateFromVersion";function s(e,t){if(!e&&!t)return 0;if(!e)return -1;if(!t)return 1;let a=e=>String(e).trim().replace(/^v/i,"").split(/[.+-]/).map(e=>{let t=parseInt(e,10);return Number.isFinite(t)?t:0}),r=a(e),n=a(t),s=Math.max(r.length,n.length);for(let e=0;e<s;e++){let t=r[e]||0,a=n[e]||0;if(t>a)return 1;if(t<a)return -1}return 0}function i(e){let t;if(!e||"string"!=typeof e)return[];let a=/^#\s+v?(\d+\.\d+\.\d+[^\s)]*)\s*([^\n]*)/gm,r=[];for(;null!==(t=a.exec(e));)r.push({version:t[1].trim(),heading:t[0].replace(/^#\s+/,"").trim(),index:t.index,headerEnd:t.index+t[0].length});return 0===r.length?[]:r.map((t,a)=>{let n=t.headerEnd,s=a+1<r.length?r[a+1].index:e.length,i=e.slice(n,s).trim(),l=i.split(/\r?\n/).map(e=>e.trim()).filter(e=>/^[-*]\s+/.test(e)).map(e=>e.replace(/^[-*]\s+/,"").trim()).filter(Boolean);return{version:t.version,heading:t.heading,body:i,bullets:l}})}function l(e,t,a=null){let r=i(e);return 0===r.length?[]:r.filter(e=>!(a&&s(e.version,a)>0||t&&0>=s(e.version,t))&&(!!t||!!a&&0===s(e.version,a)))}function o(e,{maxBullets:t=10}={}){let a=[],r=[];for(let t of e)for(let e of(a.includes(t.version)||a.push(t.version),t.bullets)){var n;r.push({text:(n=e)?String(n).replace(/\*\*(.+?)\*\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").trim():"",version:t.version})}let s=r.length>t;return{bullets:r.slice(0,t),truncated:s,versions:a}}function d(e){try{if("u"<typeof localStorage)return null;return localStorage.getItem(e)}catch{return null}}function c(e,t){try{if("u"<typeof localStorage)return;localStorage.setItem(e,t)}catch{}}function u(e){e&&c(n,String(e).replace(/^v/i,""))}function m(e){let t=String(e||"").replace(/^v/i,"");if(!t)return{show:!1,fromVersion:null,toVersion:t};let a=d(n),i=d(r);return i||a?a&&s(t,a)>0?{show:!0,fromVersion:a,toVersion:t}:i&&s(t,i)>0?{show:!0,fromVersion:i,toVersion:t}:(i&&0===s(t,i)||c(r,t),{show:!1,fromVersion:null,toVersion:t}):(c(r,t),{show:!1,fromVersion:null,toVersion:t})}function x(e){let t=String(e||"").replace(/^v/i,"");t&&c(r,t),function(e){try{if("u"<typeof localStorage)return;localStorage.removeItem(e)}catch{}}(n)}},73579:(e,t,a)=>{a.d(t,{default:()=>h});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(81127),o=a(11910),d=a(98),c=a(92542),u=a(56061),m=a(88105),x=a(78177);function p({connection:e,thresholds:t,onChange:a}){let n=(0,x.XD)(e),s=e?.lastQuotaSnapshot?.windows||[];return(0,r.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1 text-sm",children:"Quota Safety Buffer"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-3",children:"Pause this account when a quota window's remaining % drops to/below its value. Set a window to 0 to disable it."}),n.eligible?0===s.length?(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"No quota windows known yet. Open the Quota Tracker to fetch usage first, then set per-window buffers here."}):(0,r.jsx)("div",{className:"flex flex-col gap-2",children:s.map(e=>{let n=Number(t[e.key])||0;return(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"flex-1 min-w-0 truncate text-sm",title:e.key,children:e.key}),(0,r.jsx)("span",{className:"text-xs text-text-muted tabular-nums w-14 text-right",children:"number"==typeof e.remainingPercentage?`${e.remainingPercentage}%`:"—"}),(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"≤"}),(0,r.jsx)("input",{type:"number",min:0,max:100,value:n,onChange:t=>a(e.key,Number.parseInt(t.target.value,10)||0),className:"w-16 px-2 py-1 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"%"})]},e.key)})}):(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Usage tracking isn't available for this account type, so the buffer can't be applied."})]})}function h({isOpen:e,connection:t,proxyPools:a,onSave:s,onClose:i}){let[x,g]=(0,n.useState)({name:"",priority:1,apiKey:"",cx:""}),[f,b]=(0,n.useState)({}),[v,j]=(0,n.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[y,k]=(0,n.useState)({accountId:""}),[w,N]=(0,n.useState)(""),[C,S]=(0,n.useState)({location:"global",reasoningEffort:"high"}),[O,F]=(0,n.useState)(!1),[I,W]=(0,n.useState)(null),[P,T]=(0,n.useState)(!1),[E,$]=(0,n.useState)(null),[_,z]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(t){g({name:t.name||"",priority:t.priority||1,apiKey:"",cx:t.providerSpecificData?.cx||""}),"azure"===t.provider&&t.providerSpecificData&&j({azureEndpoint:t.providerSpecificData.azureEndpoint||"",apiVersion:t.providerSpecificData.apiVersion||"2024-10-01-preview",deployment:t.providerSpecificData.deployment||"",organization:t.providerSpecificData.organization||""}),"cloudflare-ai"===t.provider&&t.providerSpecificData&&k({accountId:t.providerSpecificData.accountId||""});let e=m.Q2?.[t.provider];e?.regions&&N(t.providerSpecificData?.region||e.defaultRegion||e.regions[0]?.id||""),("vertex"===t.provider||"vertex-partner"===t.provider)&&t.providerSpecificData&&S({location:t.providerSpecificData.location||"global",reasoningEffort:t.providerSpecificData.reasoningEffort||"high"}),W(null),$(null),b(t.quotaPauseThresholds&&"object"==typeof t.quotaPauseThresholds?{...t.quotaPauseThresholds}:{})}},[t]);let A=t?.provider==="google-pse",R=A&&!x.cx.trim(),D=A?{...t.providerSpecificData,cx:x.cx.trim()}:void 0,U=t?.authType==="oauth",L=t?.provider==="azure",q=t?.provider==="cloudflare-ai",M=t?.provider==="vertex"||t?.provider==="vertex-partner",V=!!t&&((0,m.mq)(t.provider)||(0,m.gb)(t.provider)),K=t&&m.Q2?.[t.provider]?.regions||null,J=()=>{if(K&&w)return{...t?.providerSpecificData||{},region:w}},B=async()=>{if(t?.provider){F(!0),W(null);try{let e=await fetch(`/api/providers/${t.id}/test`,{method:"POST"}),a=await e.json();W(a.valid?"success":"failed")}catch{W("failed")}finally{F(!1)}}},G=async()=>{if(t?.provider&&x.apiKey&&!R){T(!0),$(null);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:x.apiKey,...L?{providerSpecificData:v}:{},...q?{providerSpecificData:y}:{},...A?{providerSpecificData:D}:{},...K?{providerSpecificData:J()}:{},...M?{providerSpecificData:C}:{}})}),a=await e.json();$(a.valid?"success":"failed")}catch{$("failed")}finally{T(!1)}}},Q=async()=>{if(t&&!R){z(!0);try{let e={name:x.name,priority:x.priority,quotaPauseThresholds:{...f}};if(A&&(e.providerSpecificData=D,D.cx!==t.providerSpecificData?.cx&&(e.testStatus="unknown")),!U&&x.apiKey){e.apiKey=x.apiKey;let a="success"===E;if(!a)try{T(!0),$(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:x.apiKey,...L?{providerSpecificData:v}:{},...q?{providerSpecificData:y}:{},...A?{providerSpecificData:D}:{},...K?{providerSpecificData:J()}:{},...M?{providerSpecificData:C}:{}})});a=!!(await e.json()).valid,$(a?"success":"failed")}catch{$("failed")}finally{T(!1)}a&&(e.testStatus="active",e.lastError=null,e.lastErrorAt=null)}L&&(e.providerSpecificData={azureEndpoint:v.azureEndpoint,apiVersion:v.apiVersion,deployment:v.deployment,organization:v.organization}),q&&(e.providerSpecificData={accountId:y.accountId}),K&&w&&(e.providerSpecificData=J()),M&&(e.providerSpecificData={location:C.location||"global",reasoningEffort:C.reasoningEffort||"high"}),await s(e)}finally{z(!1)}}};return t?(0,r.jsx)(l.default,{isOpen:e,title:"Edit Connection",onClose:i,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(o.default,{label:"Name",value:x.name,onChange:e=>g({...x,name:e.target.value}),placeholder:U?"Account name":"Production Key"}),U&&t.email&&(0,r.jsxs)("div",{className:"bg-sidebar/50 p-3 rounded-lg",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted mb-1",children:"Email"}),(0,r.jsx)("p",{className:"font-medium",children:t.email})]}),(0,r.jsx)(o.default,{label:"Priority",type:"number",value:x.priority,onChange:e=>g({...x,priority:Number.parseInt(e.target.value,10)||1})}),(0,r.jsx)(p,{thresholds:f,onChange:(e,t)=>b(a=>({...a,[e]:t})),connection:t}),!U&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(o.default,{label:"API Key",type:"password",value:x.apiKey,onChange:e=>g({...x,apiKey:e.target.value}),placeholder:"Enter new API key",hint:"Leave blank to keep the current API key.",className:"flex-1"}),(0,r.jsx)("div",{className:"pt-6",children:(0,r.jsx)(c.default,{onClick:G,disabled:!x.apiKey||R||P||_,variant:"secondary",children:P?"Checking...":"Check"})})]}),E&&(0,r.jsx)(u.default,{variant:"success"===E?"success":"error",children:"success"===E?"Valid":"Invalid"})]}),A&&(0,r.jsx)(o.default,{label:"Search Engine ID (cx)",value:x.cx,onChange:e=>{g({...x,cx:e.target.value}),$(null),W(null)},hint:"Save changes before testing the stored connection."}),L&&(0,r.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,r.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsx)(o.default,{label:"Azure Endpoint",value:v.azureEndpoint,onChange:e=>j({...v,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com",hint:"Your Azure OpenAI resource endpoint URL"}),(0,r.jsx)(o.default,{label:"Deployment Name",value:v.deployment,onChange:e=>j({...v,deployment:e.target.value}),placeholder:"gpt-4",hint:"The deployment name in your Azure resource"}),(0,r.jsx)(o.default,{label:"API Version",value:v.apiVersion,onChange:e=>j({...v,apiVersion:e.target.value}),placeholder:"2024-10-01-preview",hint:"Azure OpenAI API version to use"}),(0,r.jsx)(o.default,{label:"Organization",value:v.organization,onChange:e=>j({...v,organization:e.target.value}),placeholder:"Organization ID",hint:"Required for billing"})]})]}),K&&(0,r.jsx)(d.default,{label:"Region",value:w,onChange:e=>N(e.target.value),options:K.map(e=>({value:e.id,label:e.label}))}),M&&(0,r.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,r.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Vertex AI Configuration"}),(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsx)(d.default,{label:"Location",value:C.location,onChange:e=>S({...C,location:e.target.value}),options:[{value:"global",label:"global (recommended for Gemini 3.x)"},{value:"us-central1",label:"us-central1"},{value:"us-east4",label:"us-east4"},{value:"europe-west1",label:"europe-west1"},{value:"europe-west4",label:"europe-west4"},{value:"asia-east1",label:"asia-east1"},{value:"asia-northeast1",label:"asia-northeast1"}]}),(0,r.jsx)(d.default,{label:"Reasoning Effort (default)",value:C.reasoningEffort,onChange:e=>S({...C,reasoningEffort:e.target.value}),options:[{value:"high",label:"high (32k tokens — default for Pro)"},{value:"medium",label:"medium (8k tokens)"},{value:"low",label:"low (1k tokens)"},{value:"",label:"none (let model decide)"}]}),(0,r.jsxs)("p",{className:"text-xs text-text-muted",children:["Location ",(0,r.jsx)("code",{children:"global"})," is required for Gemini 3.1 Pro Preview."]})]})]}),!V&&!L&&!q&&!M&&(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(c.default,{onClick:B,variant:"secondary",disabled:O,children:O?"Testing...":"Test Connection"}),I&&(0,r.jsx)(u.default,{variant:"success"===I?"success":"error",children:"success"===I?"Valid":"Failed"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(c.default,{onClick:Q,fullWidth:!0,disabled:_||R,children:_?"Saving...":"Save"}),(0,r.jsx)(c.default,{onClick:i,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}p.propTypes={connection:i().object,thresholds:i().object.isRequired,onChange:i().func.isRequired},h.propTypes={isOpen:i().bool.isRequired,connection:i().shape({id:i().string,name:i().string,email:i().string,priority:i().number,authType:i().string,provider:i().string,providerSpecificData:i().object}),proxyPools:i().arrayOf(i().shape({id:i().string,name:i().string})),onSave:i().func.isRequired,onClose:i().func.isRequired}},78177:(e,t,a)=>{a.d(t,{XD:()=>l});var r=a(88105);function n(e){if(!e)return!1;let t="oauth"===e.authType,a=("apikey"===e.authType||"api_key"===e.authType)&&r.jO.includes(e.provider);return t||a}function s(e){let t=e?.quotaPauseThresholds;return t&&"object"==typeof t?t:{}}function i(e){let t=Number(e);return!Number.isFinite(t)||t<=0||t>100?0:t}function l(e){let t=s(e),a=e?.lastQuotaSnapshot?.windows||[],r=Object.values(t).some(e=>i(e)>0),l=function(e){if(!n(e))return null;let t=s(e),a=e?.lastQuotaSnapshot?.windows;if(!a||!Array.isArray(a)||0===a.length)return null;let r=null;for(let e of a){if(!e||!0===e.unlimited)continue;let a=i(t[e.key]);if(!a)continue;let n=Number(e.remainingPercentage);Number.isFinite(n)&&n<=a&&(null===r||n<Number(r.remainingPercentage))&&(r={key:e.key,remainingPercentage:n,threshold:a})}return r}(e);return{enabled:r,paused:null!==l,triggered:l,eligible:n(e),windows:a.map(e=>{let a=i(t[e.key]),r=Number(e.remainingPercentage);return{key:e.key,remainingPercentage:Number.isFinite(r)?r:null,threshold:a,configured:a>0,paused:a>0&&!e.unlimited&&Number.isFinite(r)&&r<=a}})}}},80752:(e,t,a)=>{a.d(t,{default:()=>u});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(1620),o=a(40197),d=a(81127);function c({icon:e,label:t,onClick:a,trailing:n,danger:s}){return(0,r.jsxs)("button",{onClick:a,className:`flex items-center gap-3 w-full px-4 py-2.5 text-sm transition-colors ${s?"text-red-500 hover:bg-red-500/10":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"}`,children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[20px] ${s?"":"text-text-muted"}`,children:e}),(0,r.jsx)("span",{className:"flex-1 text-left",children:t}),n&&(0,r.jsx)("span",{className:"text-base",children:n})]})}function u({onLogout:e}){let[t,a]=(0,n.useState)(!1),[s,i]=(0,n.useState)(!1),[m,x]=(0,n.useState)(!1),[p,h]=(0,n.useState)(!1),{toggleTheme:g,isDark:f}=(0,l.D)(),b=(0,n.useRef)(null),v=async()=>{h(!0);try{await fetch("/api/version/shutdown",{method:"POST"})}catch(e){}h(!1),x(!1)};return(0,n.useEffect)(()=>{let e=e=>{b.current&&!b.current.contains(e.target)&&a(!1)};if(t)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[t]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"relative",ref:b,children:[(0,r.jsx)("button",{onClick:()=>a(e=>!e),className:"flex items-center justify-center p-2 rounded-lg text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5 transition-all",title:"Menu",children:(0,r.jsx)("span",{className:"material-symbols-outlined",children:"grid_view"})}),t&&(0,r.jsxs)("div",{className:"absolute right-0 top-full mt-2 w-60 bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl z-50 animate-in fade-in zoom-in-95 duration-150 overflow-hidden py-1",children:[(0,r.jsx)(c,{icon:"history",label:"Change Log",onClick:()=>{a(!1),i(!0)}}),(0,r.jsx)(c,{icon:f?"light_mode":"dark_mode",label:"Theme",onClick:()=>{g(),a(!1)}}),(0,r.jsx)(c,{icon:"power_settings_new",label:"Shutdown",danger:!0,onClick:()=>{a(!1),x(!0)}}),(0,r.jsx)(c,{icon:"logout",label:"Logout",danger:!0,onClick:()=>{a(!1),e()}})]})]}),(0,r.jsx)(o.default,{isOpen:s,onClose:()=>i(!1)}),(0,r.jsx)(d.ConfirmModal,{isOpen:m,onClose:()=>x(!1),onConfirm:v,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:p})]})}c.propTypes={icon:i().string.isRequired,label:i().string.isRequired,onClick:i().func.isRequired,trailing:i().node,danger:i().bool},u.propTypes={onLogout:i().func.isRequired}},81127:(e,t,a)=>{a.d(t,{ConfirmModal:()=>d,default:()=>o});var r=a(95155),n=a(12115),s=a(31474),i=a(92542),l=a(97677);function o({isOpen:e,onClose:t,title:a,children:i,footer:d,size:c="md",closeOnOverlay:u=!0,showTrafficLights:m=!0,allowFullscreen:x=!0,className:p}){let[h,g]=(0,n.useState)(!1);return((0,n.useEffect)(()=>(e?document.body.style.overflow="hidden":(document.body.style.overflow="",g(!1)),()=>{document.body.style.overflow=""}),[e]),(0,n.useEffect)(()=>{let a=a=>{"Escape"===a.key&&e&&t()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,t]),e)?(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:u?t:void 0}),(0,r.jsxs)("div",{className:(0,s.cn)("relative w-full bg-surface","border border-border-subtle","rounded-[14px] shadow-[var(--shadow-elev)]","fade-in transition-all duration-150",h?"max-w-[95vw] w-[95vw] h-[90vh] max-h-[90vh] flex flex-col":({sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"})[c],p),children:[(a||m)&&(0,r.jsxs)("div",{className:"flex items-center justify-between p-2 border-b border-border-subtle select-none cursor-default",onDoubleClick:()=>x&&g(e=>!e),children:[(0,r.jsxs)("div",{className:"flex items-center",children:[m&&(0,r.jsxs)("div",{className:"hidden md:flex items-center gap-2 mr-4 ml-2",children:[(0,r.jsx)(l.default,{text:"Close",position:"top",color:"#FF5F56",children:(0,r.jsx)("button",{onClick:t,"aria-label":"Close",title:"Close",className:"w-4 h-4 rounded-full bg-[#FF5F56] hover:brightness-90 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,r.jsx)("span",{className:"text-[9px] font-bold text-white opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:"✕"})})}),(0,r.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"}),x?(0,r.jsx)(l.default,{text:h?"Restore":"Maximize",position:"top",color:"#28C840",children:(0,r.jsx)("button",{type:"button",onClick:()=>g(e=>!e),"aria-label":h?"Restore":"Maximize",title:h?"Restore":"Maximize (Full screen)",className:"w-4 h-4 rounded-full bg-[#28C840] border border-[#1AAB29] hover:brightness-90 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,r.jsx)("span",{className:"text-[10px] font-bold text-[#004d11] opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:h?"⤡":"⤢"})})}):(0,r.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"})]}),a&&(0,r.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:a})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[x&&(0,r.jsx)("button",{type:"button",onClick:()=>g(e=>!e),"aria-label":h?"Restore":"Full Screen",title:h?"Restore":"Full Screen",className:"hidden md:flex p-1.5 rounded-[10px] text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors cursor-pointer",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:h?"close_fullscreen":"open_in_full"})}),(0,r.jsx)("button",{onClick:t,"aria-label":"Close",className:"md:hidden p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]})]}),(0,r.jsx)("div",{className:(0,s.cn)("p-6 overflow-y-auto custom-scrollbar",h?"flex-1 min-h-0":"max-h-[calc(85vh-100px)]"),children:i}),d&&(0,r.jsx)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-border-subtle",children:d})]})]}):null}function d({isOpen:e,onClose:t,onConfirm:a,title:n="Confirm",message:s,confirmText:l="Confirm",cancelText:c="Cancel",variant:u="danger",loading:m=!1}){return(0,r.jsx)(o,{isOpen:e,onClose:t,title:n,size:"sm",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.default,{variant:"ghost",onClick:t,disabled:m,children:c}),(0,r.jsx)(i.default,{variant:u,onClick:a,loading:m,children:l})]}),children:(0,r.jsx)("p",{className:"text-text-muted",children:s})})}},84130:(e,t,a)=>{a.d(t,{default:()=>N});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(98500),o=a.n(l),d=a(73321),c=a(31474),u=a(90620),m=a(88105),x=a(11059),p=a(72767),h=a(92542),g=a(40197),f=a(73147);function b({currentVersion:e,latestVersion:t,installCmd:a,onClose:s}){let[i,l]=(0,n.useState)("auto"),[o,d]=(0,n.useState)("idle"),[c,m]=(0,n.useState)(null),[x,p]=(0,n.useState)(null),[v,j]=(0,n.useState)(!1),[y,k]=(0,n.useState)(0),[w,N]=(0,n.useState)(!1),[C,S]=(0,n.useState)({bullets:[],truncated:!1,loading:!0,error:null,versions:[]}),[O,F]=(0,n.useState)(!1),I=(0,n.useRef)(null),W=(0,n.useRef)(null),P=(0,n.useRef)(!1),T=(0,n.useCallback)(()=>{I.current&&(clearInterval(I.current),I.current=null),W.current&&(clearInterval(W.current),W.current=null)},[]);(0,n.useEffect)(()=>()=>{P.current=!0,T()},[T]),(0,n.useEffect)(()=>{let a=!1;return S(e=>({...e,loading:!0,error:null})),fetch(u.Nu.changelogUrl,{cache:"no-store"}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.text()}).then(r=>{if(a)return;let n=(0,f.zV)(r,e,t);if(0===n.length&&t&&(n=(0,f.zV)(r,null,t)),0===n.length&&e&&(n=(0,f.zV)(r,e,null).slice(0,2)),0===n.length){let e=(0,f.MY)(r);e.length>0&&(n=[e[0]])}let{bullets:s,truncated:i,versions:l}=(0,f.eK)(n,{maxBullets:10});S({bullets:s,truncated:i,loading:!1,error:null,versions:l})}).catch(e=>{a||S({bullets:[],truncated:!1,loading:!1,error:e.message||"Failed to load release notes",versions:[]})}),()=>{a=!0}},[e,t]);let E=(0,n.useCallback)(()=>{(0,f.TJ)(e)},[e]),$=(0,n.useCallback)(()=>{T();let e=function(e=u.h0.statusPort){return`http://127.0.0.1:${e}/update/status`}(),t=async()=>{if(!P.current)try{let t=await fetch(e,{cache:"no-store"});if(!t.ok)return;let a=await t.json();if(P.current)return;(m(a),d("running"),a&&a.done&&a.success)?(d("success"),W.current||(W.current=setInterval(()=>{globalThis.location.reload()},2e3),setTimeout(()=>{try{globalThis.location.reload()}catch{}},2500)),I.current&&(clearInterval(I.current),I.current=null)):a&&("error"===a.phase||a.done&&!a.success)&&(d("failed"),p(a.error||"Install failed"),l("manual"),I.current&&(clearInterval(I.current),I.current=null))}catch{}};t(),I.current=setInterval(t,u.h0.statusPollIntervalMs)},[T]),_=(0,n.useCallback)(async()=>{p(null),m(null),d("starting"),P.current=!1,E();try{let e=await fetch("/api/version/update",{method:"POST"}),t=await e.json().catch(()=>({}));if(!e.ok){p(t.message||`Auto-update unavailable (${e.status})`),d("failed"),l("manual");return}d("running"),$()}catch(e){d("running"),$(),e?.message&&p(null)}},[$,E]),z=async()=>{E();try{await navigator.clipboard.writeText(a)}catch{}j(!0);let e=u.h0.shutdownCountdownSec;k(e);let t=setInterval(()=>{k(e-=1),e<=0&&(clearInterval(t),fetch("/api/version/shutdown",{method:"POST"}).catch(()=>{}),N(!0))},1e3)},A=function(e){if(!e||"object"!=typeof e)return 5;let{phase:t,attempt:a=0,maxRetries:r=u.h0.installRetries,done:n,success:s}=e;if(n&&s)return 100;if("error"===t||n&&!s)return 90;switch(t){case"starting":return 8;case"waitingForExit":return 22;case"installing":{let e=Math.max(1,r);return Math.round(35+Math.min(a,e)/e*50)}case"done":return 100;default:return 5}}(c||{phase:"starting"===o?"starting":null}),R="starting"===o?"Contacting updater…":"success"===o?"Update complete — reloading when app is ready…":function(e,t={}){let a=t.attempt||0,r=t.maxRetries||u.h0.installRetries;switch(e){case"starting":return"Starting updater…";case"waitingForExit":return"Stopping current app (releasing file locks)…";case"installing":return a>0?`Installing package (attempt ${a}/${r})…`:"Installing package…";case"done":return"Update complete — restarting app…";case"error":return"Update failed";default:return e?String(e):"Preparing…"}}(c?.phase,{attempt:c?.attempt,maxRetries:c?.maxRetries}),D=Array.isArray(c?.logTail)?c.logTail:[],U="starting"===o||"running"===o||"success"===o,L=`Update EzRouter${t?` to v${t}`:""}`,q=(0,r.jsxs)("div",{className:"mb-4 rounded-lg border border-white/10 bg-white/5 p-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-2",children:[(0,r.jsxs)("p",{className:"text-xs font-semibold text-white/90",children:["What's new",t?(0,r.jsxs)("span",{className:"font-normal text-white/50",children:[" ",e?`v${e} → `:"","v",t]}):null]}),(0,r.jsx)("button",{type:"button",onClick:()=>F(!0),className:"text-[10px] text-white/50 hover:text-white/80 transition-colors shrink-0",children:"Full changelog"})]}),C.loading&&(0,r.jsxs)("p",{className:"text-[11px] text-white/50 flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] animate-spin",children:"progress_activity"}),"Loading release notes…"]}),!C.loading&&C.error&&(0,r.jsxs)("p",{className:"text-[11px] text-white/50",children:["Couldn't load release notes (",C.error,"). You can still update."]}),!C.loading&&!C.error&&0===C.bullets.length&&(0,r.jsx)("p",{className:"text-[11px] text-white/50",children:"No release notes found for this range yet. Check the full changelog after updating."}),!C.loading&&C.bullets.length>0&&(0,r.jsxs)("ul",{className:"max-h-40 overflow-y-auto space-y-1 text-[11px] text-white/75 list-disc list-inside",children:[C.bullets.map((e,t)=>(0,r.jsxs)("li",{className:"leading-snug",title:e.text,children:[(0,r.jsxs)("span",{className:"text-white/40 mr-1",children:["v",e.version]}),e.text]},`${e.version}-${t}`)),C.truncated&&(0,r.jsx)("li",{className:"list-none text-white/40 pl-0",children:"…more in full changelog"})]})]});if("auto"===i)return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"w-full max-w-xl rounded-xl bg-neutral-900/95 border border-white/10 p-6 text-white",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-11 rounded-full bg-green-500/20 text-green-400",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[24px]",children:"success"===o?"check_circle":"system_update"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:L}),(0,r.jsx)("p",{className:"text-xs text-white/60",children:"One-click install. The app will stop, update, and restart automatically."})]})]}),"idle"===o&&(0,r.jsxs)(r.Fragment,{children:[q,(0,r.jsxs)("ul",{className:"text-xs text-white/70 space-y-1.5 list-disc list-inside mb-4",children:[(0,r.jsxs)("li",{children:["Works with the production ",(0,r.jsx)("code",{className:"px-1 rounded bg-white/10",children:"ezrouter"})," CLI install"]}),(0,r.jsx)("li",{children:"Takes about 1–2 minutes (npm global install + restart)"}),(0,r.jsx)("li",{children:"You can switch to manual install if auto fails"})]}),(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,r.jsx)(h.default,{variant:"secondary",onClick:s,className:"sm:w-auto",children:"Cancel"}),(0,r.jsx)(h.default,{variant:"primary",fullWidth:!0,onClick:_,children:"Update & Restart"})]}),(0,r.jsx)("button",{type:"button",onClick:()=>l("manual"),className:"mt-3 w-full text-center text-[11px] text-white/50 hover:text-white/80 transition-colors",children:"Prefer manual install instead?"})]}),U&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"mb-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs mb-1.5",children:[(0,r.jsx)("span",{className:"text-white/80",children:R}),(0,r.jsxs)("span",{className:"text-white/50 tabular-nums",children:[A,"%"]})]}),(0,r.jsx)("div",{className:"h-1.5 rounded-full bg-white/10 overflow-hidden",children:(0,r.jsx)("div",{className:"h-full bg-green-500 transition-all duration-500",style:{width:`${Math.min(100,A)}%`}})})]}),D.length>0&&(0,r.jsx)("div",{className:"mb-3 max-h-32 overflow-y-auto rounded bg-black/40 px-2 py-1.5 font-mono text-[10px] text-white/60 space-y-0.5",children:D.map((e,t)=>(0,r.jsx)("div",{className:"truncate",children:e},`${t}-${e.slice(0,24)}`))}),"success"===o?(0,r.jsx)("p",{className:"text-xs text-green-400/90 mb-3",children:"Install succeeded. Waiting for the app to come back, then reloading…"}):(0,r.jsx)("p",{className:"text-xs text-white/50 mb-3",children:"Keep this tab open. Do not close the browser until the update finishes."}),"success"!==o&&(0,r.jsx)("button",{type:"button",onClick:()=>{T(),l("manual"),d("failed")},className:"w-full text-center text-[11px] text-white/50 hover:text-white/80 transition-colors",children:"Stuck? Switch to manual install"})]}),"failed"===o&&"auto"===i&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mb-3 rounded border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-300",children:x||"Auto-update failed."}),(0,r.jsx)(h.default,{variant:"primary",fullWidth:!0,onClick:()=>l("manual"),children:"Open manual install"})]})]}),(0,r.jsx)(g.default,{isOpen:O,onClose:()=>F(!1)})]});let M=y>0;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"w-full max-w-xl rounded-xl bg-neutral-900/95 border border-white/10 p-6 text-white",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-11 rounded-full bg-amber-500/20 text-amber-400",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[24px]",children:"content_copy"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:L}),(0,r.jsx)("p",{className:"text-xs text-white/60",children:w?"Server stopped. Paste the command into a terminal to install.":M?`Command copied. Server will stop in ${y}s...`:x?"Auto-update unavailable — install manually.":"Copy the install command, stop the server, then re-run ezrouter."})]})]}),!w&&!M&&q,x&&(0,r.jsx)("div",{className:"mb-3 rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-200",children:x}),(0,r.jsx)("p",{className:"text-sm text-white/80 mb-2",children:"Install command:"}),(0,r.jsx)("div",{className:"w-full px-3 py-2 rounded bg-white/5 mb-4",children:(0,r.jsx)("code",{className:"text-xs font-mono text-amber-400 break-all",children:a})}),(0,r.jsxs)("ol",{className:"text-xs text-white/70 space-y-1 list-decimal list-inside mb-4",children:[(0,r.jsxs)("li",{children:["Click ",(0,r.jsx)("strong",{children:"Copy & Shutdown"})," below."]}),(0,r.jsx)("li",{children:"Paste the command into your terminal and press Enter."}),(0,r.jsxs)("li",{children:["Run ",(0,r.jsx)("code",{className:"px-1 rounded bg-white/10 text-green-400",children:"ezrouter"})," again after install."]})]}),w?(0,r.jsx)(h.default,{variant:"secondary",fullWidth:!0,onClick:()=>globalThis.location.reload(),children:"Reload Page"}):(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,r.jsx)(h.default,{variant:"secondary",onClick:()=>{U||s()},disabled:M,className:"sm:w-auto",children:"Cancel"}),(0,r.jsx)(h.default,{variant:"primary",fullWidth:!0,onClick:z,disabled:M,children:v?"✓ Copied — shutting down...":M?`Shutting down in ${y}s`:"Copy & Shutdown"})]}),!w&&!M&&(0,r.jsx)("button",{type:"button",onClick:()=>{l("auto"),d("idle"),p(null),m(null)},className:"mt-3 w-full text-center text-[11px] text-white/50 hover:text-white/80 transition-colors",children:"Try automatic update instead"})]}),(0,r.jsx)(g.default,{isOpen:O,onClose:()=>F(!1)})]})}b.propTypes={currentVersion:i().string,latestVersion:i().string,installCmd:i().string.isRequired,onClose:i().func.isRequired};let v=["embedding","image","video","tts","stt","systemone"],j="/dashboard/media-providers/web",y=[{href:"/dashboard/endpoint",label:"Endpoint & Key",icon:"api"},{href:"/dashboard/providers",label:"Providers",icon:"dns"},{href:"/dashboard/combos",label:"Combo & Vision Adapter",icon:"layers"},{href:"/dashboard/usage",label:"Usage",icon:"bar_chart"},{href:"/dashboard/quota",label:"Quota Tracker",icon:"data_usage"},{href:"/dashboard/routing-health",label:"Routing Health",icon:"speed"},{href:"/dashboard/token-saver",label:"Token Saver",icon:"savings"},{href:"/dashboard/convoy",label:"Input Guard",icon:"filter_alt"},{href:"/dashboard/cli-tools",label:"CLI Tools",icon:"terminal"},{href:"/dashboard/mcp-gateway",label:"MCP Gateway",icon:"hub"}],k=[{href:"/dashboard/console-log",label:"Console Log",icon:"terminal"},{href:"/dashboard/error-log",label:"Error Log",icon:"error"},{href:"/dashboard/translator",label:"Translator",icon:"translate"}],w=[{href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"lan"},{href:"/dashboard/skills",label:"Skills",icon:"extension"}];function N({onClose:e}){let t=(0,d.usePathname)(),[a,s]=(0,n.useState)(!1),[i,l]=(0,n.useState)(null),[h,g]=(0,n.useState)(!1),[f,C]=(0,n.useState)(!1),{copied:S,copy:O}=(0,x.C)(2e3),F=u.h0.installCmdLatest;(0,n.useEffect)(()=>{p.A.getState().fetchSettings().then(e=>{e?.enableTranslator&&C(!0)})},[]),(0,n.useEffect)(()=>{let e=setTimeout(()=>{fetch("/api/version").then(e=>e.json()).then(e=>{e.hasUpdate&&l(e)}).catch(()=>{})},2500);return()=>clearTimeout(e)},[]);let I=e=>"/dashboard/endpoint"===e?"/dashboard"===t||t.startsWith("/dashboard/endpoint"):t.startsWith(e);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("aside",{className:"flex w-72 flex-col border-r border-border-subtle bg-vibrancy backdrop-blur-xl transition-colors duration-300 min-h-full",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-6 pt-5 pb-2",children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FF5F56]"}),(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]"}),(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]"})]}),(0,r.jsxs)("div",{className:"px-6 py-4 flex flex-col gap-2",children:[(0,r.jsxs)(o(),{href:"/dashboard",className:"flex items-center gap-3",children:[(0,r.jsx)("img",{src:"/logo.png",alt:"EzRouter",className:"size-9 rounded-[10px] object-contain shadow-[var(--shadow-warm)]",onError:e=>{e.currentTarget.onerror=null,e.currentTarget.src="/favicon.svg"}}),(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("h1",{className:"text-lg font-semibold tracking-tight text-text-main",children:u.vQ.name}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:["v",u.vQ.version]})]})]}),i&&(0,r.jsxs)("div",{className:"flex flex-col gap-1.5 rounded p-1 -m-1",children:[(0,r.jsxs)("span",{className:"text-xs font-semibold text-green-600 dark:text-amber-500",children:["↑ New version available: v",i.latestVersion]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{onClick:()=>g(!0),className:"px-2 py-1 rounded bg-green-600 hover:bg-green-700 dark:bg-amber-500 dark:hover:bg-amber-600 text-white text-[11px] font-semibold transition-colors cursor-pointer",children:"Update now"}),(0,r.jsx)("button",{onClick:()=>O(F),title:"Copy install command",className:"flex-1 text-left hover:opacity-80 transition-opacity cursor-pointer min-w-0",children:(0,r.jsx)("code",{className:"block text-[10px] text-green-600/80 dark:text-amber-400/70 font-mono truncate",children:S?"✓ copied!":F})})]})]})]}),(0,r.jsxs)("nav",{className:"flex-1 px-4 py-2 space-y-0.5 overflow-y-auto custom-scrollbar",children:[y.map(t=>(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",I(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",I(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href)),(0,r.jsxs)("div",{className:"pt-3 mt-2 space-y-0.5",children:[(0,r.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"System"}),(0,r.jsxs)("button",{onClick:()=>s(e=>!e),className:(0,c.cn)("w-full flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",t.startsWith("/dashboard/media-providers")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"perm_media"}),(0,r.jsx)("span",{className:"text-[13px] font-medium flex-1 text-left",children:"Media Providers"}),(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] transition-transform",style:{transform:a?"rotate(180deg)":"rotate(0deg)"},children:"expand_more"})]}),a&&(0,r.jsxs)("div",{className:"pl-4",children:[m.rj.filter(e=>v.includes(e.id)).map(a=>(0,r.jsxs)(o(),{href:`/dashboard/media-providers/${a.id}`,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-1 rounded-lg transition-all group",t.startsWith(`/dashboard/media-providers/${a.id}`)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:a.icon}),(0,r.jsx)("span",{className:"text-sm",children:a.label})]},a.id)),(0,r.jsxs)(o(),{href:j,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-1 rounded-lg transition-all group",t.startsWith(j)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"travel_explore"}),(0,r.jsx)("span",{className:"text-sm",children:"Web Fetch & Search"})]},"web")]}),w.map(t=>(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",I(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",I(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href)),k.map(t=>"/dashboard/translator"!==t.href||f?(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",I(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",I(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href):null),(0,r.jsxs)(o(),{href:"/dashboard/profile",onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",I("/dashboard/profile")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",I("/dashboard/profile")?"fill-1":"group-hover:text-primary transition-colors"),children:"settings"}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:"Settings"})]})]})]})]}),h&&(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm p-6",children:(0,r.jsx)(b,{currentVersion:i?.currentVersion||u.vQ.version,latestVersion:i?.latestVersion,installCmd:F,onClose:()=>g(!1)})})]})}N.propTypes={onClose:i().func}},85416:(e,t,a)=>{a.d(t,{default:()=>c});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497);let o="auto",d=[{value:o,label:"Auto-detect (recommended)"},{value:"us-east-1",label:"US East (N. Virginia)"},{value:"eu-central-1",label:"Europe (Frankfurt)"}];function c({isOpen:e,onMethodSelect:t,onClose:a}){let[s,i]=(0,n.useState)(null),[u,m]=(0,n.useState)(""),[x,p]=(0,n.useState)("us-east-1"),[h,g]=(0,n.useState)(""),[f,b]=(0,n.useState)(""),[v,j]=(0,n.useState)(""),[y,k]=(0,n.useState)(o),[w,N]=(0,n.useState)(null),[C,S]=(0,n.useState)(!1),[O,F]=(0,n.useState)(!1),[I,W]=(0,n.useState)(!1),[P,T]=(0,n.useState)(null);(0,n.useEffect)(()=>{"import"===s&&e&&(async()=>{F(!0),N(null),W(!1),T(null);try{let e=await fetch("/api/oauth/kiro/auto-import"),t=await e.json();t.found?(g(t.refreshToken),W(!0),t.clientId&&t.clientSecret&&T({clientId:t.clientId,clientSecret:t.clientSecret,region:t.region,authMethod:t.authMethod,profileArn:t.profileArn})):N(t.error||"Could not auto-detect token")}catch(e){N("Failed to auto-detect token")}finally{F(!1)}})()},[s,e]);let E=e=>{i(e),N(null)},$=()=>{i(null),N(null)},_=()=>{i(null),m(""),g(""),b(""),j(""),T(null),W(!1),N(null)},z=async()=>{if(!h.trim())return void N("Please enter a refresh token");S(!0),N(null);try{let e=await fetch("/api/oauth/kiro/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:h.trim(),...P||{}})}),a=await e.json();if(!e.ok)throw Error(a.error||"Import failed");_(),t("import")}catch(e){N(e.message)}finally{S(!1)}},A=async()=>{if(!f.trim())return void N("Please paste CLIProxyAPI auth JSON");S(!0),N(null);try{let e=await fetch("/api/oauth/kiro/import-cli-proxy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({json:f.trim()})}),a=await e.json();if(!e.ok)throw Error(a.error||"CLIProxyAPI import failed");_(),t("import-cli-proxy")}catch(e){N(e.message)}finally{S(!1)}},R=async()=>{if(!v.trim())return void N("Please enter an API key");S(!0),N(null);try{let e=await fetch("/api/oauth/kiro/api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:v.trim(),region:y})}),a=await e.json();if(!e.ok)throw Error(a.error||"Import failed");_(),t("api-key")}catch(e){N(e.message)}finally{S(!1)}},D=e=>{t("social",{provider:e})};return(0,r.jsx)(l.aF,{isOpen:e,title:"Connect Kiro",onClose:()=>{_(),a()},size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[!s&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Choose your authentication method:"}),(0,r.jsx)("button",{onClick:()=>t("builder-id"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"shield"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"AWS Builder ID"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Recommended for most users. Free AWS account required."})]})]})}),(0,r.jsx)("button",{onClick:()=>E("idc"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"business"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"AWS IAM Identity Center"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"For enterprise users with custom AWS IAM Identity Center."})]})]})}),(0,r.jsx)("button",{onClick:()=>E("api-key"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"key"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"API Key"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Use a long-lived Kiro/CodeWhisperer API key (headless auth)."})]})]})}),(0,r.jsx)("button",{onClick:()=>E("social-google"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"account_circle"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"Google Account"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your Google account (manual callback)."})]})]})}),(0,r.jsx)("button",{onClick:()=>E("social-github"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"code"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"GitHub Account"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your GitHub account (manual callback)."})]})]})}),(0,r.jsx)("button",{onClick:()=>E("import"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"file_upload"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"Import Token"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Paste refresh token from Kiro IDE."})]})]})}),(0,r.jsx)("button",{onClick:()=>E("import-cli-proxy"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"data_object"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"Import CLIProxyAPI JSON"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Paste external_idp auth JSON from CLIProxyAPI/Kiro Microsoft login."})]})]})})]}),"idc"===s&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["IDC Start URL ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(l.pd,{value:u,onChange:e=>m(e.target.value),placeholder:"https://your-org.awsapps.com/start",className:"font-mono text-sm"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Your organization's AWS IAM Identity Center URL"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium mb-2",children:"AWS Region"}),(0,r.jsx)(l.pd,{value:x,onChange:e=>p(e.target.value),placeholder:"us-east-1",className:"font-mono text-sm"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"AWS region for your Identity Center (default: us-east-1)"})]}),w&&(0,r.jsx)("p",{className:"text-sm text-red-600",children:w}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:()=>{u.trim()?t("idc",{startUrl:u.trim(),region:x}):N("Please enter your IDC start URL")},fullWidth:!0,children:"Continue"}),(0,r.jsx)(l.$n,{onClick:$,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"api-key"===s&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Paste a long-lived Kiro/CodeWhisperer API key. It is validated against AWS and stored directly as a bearer credential (no refresh)."})]})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["API Key ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(l.pd,{value:v,onChange:e=>j(e.target.value),placeholder:"Paste your Kiro API key...",className:"font-mono text-sm"})]}),(0,r.jsx)(l.l6,{label:"AWS Region",value:y,onChange:e=>k(e.target.value),options:d}),w&&(0,r.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,r.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:w})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:R,fullWidth:!0,disabled:C||!v.trim(),children:C?"Validating...":"Add API Key"}),(0,r.jsx)(l.$n,{onClick:$,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-google"===s&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,r.jsxs)("div",{className:"flex-1 text-sm",children:[(0,r.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,r.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:()=>D("google"),fullWidth:!0,children:"Continue with Google"}),(0,r.jsx)(l.$n,{onClick:$,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-github"===s&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,r.jsxs)("div",{className:"flex-1 text-sm",children:[(0,r.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,r.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:()=>D("github"),fullWidth:!0,children:"Continue with GitHub"}),(0,r.jsx)(l.$n,{onClick:$,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"import"===s&&(0,r.jsxs)("div",{className:"space-y-4",children:[O&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting token..."}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from AWS SSO cache"})]}),!O&&(0,r.jsxs)(r.Fragment,{children:[I&&(0,r.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,r.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Token auto-detected from Kiro IDE successfully!"})]})}),!I&&!w&&(0,r.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Kiro IDE not detected. Please paste your refresh token manually."})]})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Refresh Token ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(l.pd,{value:h,onChange:e=>g(e.target.value),placeholder:"Token will be auto-filled...",className:"font-mono text-sm"})]}),w&&(0,r.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,r.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:w})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:z,fullWidth:!0,disabled:C||!h.trim(),children:C?"Importing...":"Import Token"}),(0,r.jsx)(l.$n,{onClick:$,variant:"ghost",fullWidth:!0,children:"Back"})]})]})]}),"import-cli-proxy"===s&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Paste the Kiro CLIProxyAPI auth JSON containing auth_method=external_idp. Only Microsoft login token endpoints are accepted."})]})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["CLIProxyAPI Auth JSON ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)("textarea",{value:f,onChange:e=>b(e.target.value),placeholder:'{"auth_method":"external_idp","access_token":"...","refresh_token":"...","client_id":"...","token_endpoint":"https://login.microsoftonline.com/.../oauth2/v2.0/token","profile_arn":"...","scopes":"..."}',className:"min-h-40 w-full rounded-md border border-border bg-background p-3 font-mono text-sm outline-none focus:border-primary"})]}),w&&(0,r.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,r.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:w})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:A,fullWidth:!0,disabled:C||!f.trim(),children:C?"Importing...":"Import CLIProxyAPI JSON"}),(0,r.jsx)(l.$n,{onClick:$,variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})})}c.propTypes={isOpen:i().bool.isRequired,onMethodSelect:i().func.isRequired,onClose:i().func.isRequired}},90882:(e,t,a)=>{a.d(t,{default:()=>u});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497),o=a(11059);let d=new Set(["trae","windsurf","zed"]),c={trae:{label:"Cloud-IDE-JWT",instructions:"Sign in at trae.ai (or solo.trae.ai), open DevTools → Network, copy the Cloud-IDE-JWT token from any request's Authorization header (~14-day lifetime).",placeholder:"Paste Cloud-IDE-JWT here...",ideName:"Trae",ideOptional:!0},windsurf:{label:"Windsurf API key",instructions:'In the Windsurf/VS Code IDE, run the "Windsurf: Provide Auth Token" command, then copy the displayed sk-ws-... key.',placeholder:"Paste sk-ws-... key here...",ideName:"Windsurf",ideOptional:!1}};function u({isOpen:e,provider:t,providerInfo:a,onSuccess:s,onClose:i,oauthMeta:m,idcConfig:x}){let[p,h]=(0,n.useState)("waiting"),[g,f]=(0,n.useState)(null),[b,v]=(0,n.useState)(""),[j,y]=(0,n.useState)(null),[k,w]=(0,n.useState)(!1),[N,C]=(0,n.useState)(null),[S,O]=(0,n.useState)(!1),[F,I]=(0,n.useState)("browser"),[W,P]=(0,n.useState)(""),[T,E]=(0,n.useState)(null),[$,_]=(0,n.useState)(!1),z=(0,n.useRef)(null),A=(0,n.useRef)(!1),R=(0,n.useRef)(!1),D=(0,n.useRef)({proxyStarted:!1,proxyProvider:null,stopSent:!1}),U=(0,n.useRef)(s),L=(0,n.useRef)(i),q=(0,n.useRef)(e),M=(0,n.useRef)(null),{copied:V,copy:K}=(0,o.C)(),[J,B]=(0,n.useState)(!1),[G,Q]=(0,n.useState)("/callback?code=..."),H=(0,n.useRef)(!1);(0,n.useEffect)(()=>{B("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname),Q(`${window.location.origin}/callback?code=...`)},[]);let Y=(0,n.useCallback)(async(e,a)=>{try{_(!0),y(null);let r=g?.redirectUri||`${window.location.origin}/callback`,n=g?.codeVerifier||null,s=a||g?.state||null,i=await fetch(`/api/oauth/${t}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,redirectUri:r,codeVerifier:n,state:s,...g?.systemId?{systemId:g.systemId}:{},...m?{meta:m}:{}})}),l=await i.json();if(!i.ok||l?.success===!1)throw Error(l.error||"Token exchange failed");h("success"),U.current?.()}catch(e){y(e.message),h("error")}finally{_(!1)}},[g,t,m]),Z=(0,n.useCallback)(async e=>{if(g?.state)try{let t=await fetch("/api/oauth/xai/manual-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,state:g.state})}),a=await t.json();if(!t.ok)throw Error(a.error);h("success"),U.current?.()}catch(e){y(e.message),h("error")}},[g]),X=(0,n.useCallback)(async(e,a,r,n,s)=>{A.current=!1,O(!0);let i=Date.now()+(Number.isFinite(s)&&s>0?s:12e4);for(;Date.now()<i;){if(A.current){console.log("[OAuthModal] Polling aborted"),O(!1);return}if(await new Promise(e=>setTimeout(e,1e3*r)),A.current){console.log("[OAuthModal] Polling aborted after sleep"),O(!1);return}try{let s=await fetch(`/api/oauth/${t}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:e,codeVerifier:a,extraData:n,..."cursor"===t?{state:e}:{}})}),i=await s.json();if(i.success){A.current=!0,h("success"),O(!1),U.current?.();return}if("expired_token"===i.error||"access_denied"===i.error||i.fatal)throw Error(i.errorDescription||i.error);"slow_down"===i.error&&(r=Math.min(r+5,30))}catch(e){y(e.message),h("error"),O(!1);return}}y("Authorization timeout"),h("error"),O(!1)},[t]),ee=(0,n.useCallback)(()=>{let e=D.current;e.proxyStarted&&!e.stopSent&&e.proxyProvider&&(e.stopSent=!0,fetch(`/api/oauth/${e.proxyProvider}/stop-proxy`).catch(()=>{}))},[]),et=(0,n.useCallback)(async e=>{let t=await fetch(`/api/oauth/${e}/start-proxy`),a=await t.json();if(!t.ok||!a.success||!a.callbackUrl)throw Error(a.reason||a.error||`Failed to start ${e} callback server`);if(D.current.proxyStarted=!0,D.current.proxyProvider=e,D.current.stopSent=!1,!q.current)return void ee();let r=new URL(`/api/oauth/${e}/authorize`,window.location.origin);r.searchParams.set("redirect_uri",a.callbackUrl);let n=await fetch(r),s=await n.json();if(!n.ok)throw ee(),Error(s.error);if(!q.current)return void ee();let i={state:s.state};s.codeVerifier&&(i.codeVerifier=s.codeVerifier),s.systemId&&(i.systemId=s.systemId);let l=await fetch(`/api/oauth/${e}/register-session`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}),o=null;try{o=await l.json()}catch{o=null}if(!l.ok||o?.success===!1)throw ee(),Error(o?.error||"Failed to register login session; please retry");q.current&&(f({...s,proxyProvider:e}),h("waiting"),z.current=window.open(s.authUrl,"oauth_popup","width=600,height=700"),z.current||h("input"))},[ee]),ea=async()=>{if(t)try{let e;if(y(null),"cursor"===t){w(!0),h("waiting");let e=await fetch(`/api/oauth/cursor/authorize?redirect_uri=${encodeURIComponent(window.location.origin+"/callback")}`),t=await e.json();if(!e.ok)throw Error(t.error);f(t),C({verification_uri:t.authUrl,user_code:""}),t.authUrl&&window.open(t.authUrl,"_blank","noopener,noreferrer"),X(t.state,null,2,null,1e3*(t.expiresIn||300));return}if("zed"===t&&"browser"===F&&"localhost"!==window.location.hostname&&"127.0.0.1"!==window.location.hostname){let e=await fetch("/api/oauth/zed/authorize"),t=await e.json();if(!e.ok)throw Error(t.error||"Failed to start Zed sign-in");if(!t.authUrl)throw Error("No authorization URL returned from OAuth provider");if(!q.current)return;f(t),h("input"),window.open(t.authUrl,"_blank","noopener,noreferrer");return}if(d.has(t)&&"browser"===F)return void await et(t);if(["github","qwen","kiro","kimi","kimi-coding","kilocode","codebuddy-cn","qoder","qoder-cn","grok-cli","frontier-for-all","muse","glm"].includes(t)){w(!0),h("waiting");let e=new URL(`/api/oauth/${t}/device-code`,window.location.origin);"kiro"===t&&x?.startUrl&&(e.searchParams.set("start_url",x.startUrl),x.region&&e.searchParams.set("region",x.region),e.searchParams.set("auth_method","idc"));let a=await fetch(e.toString()),r=await a.json();if(!a.ok)throw Error(r.error);C(r);let n=r.verification_uri_complete||r.verification_uri;n&&window.open(n,"_blank","noopener,noreferrer");let s="kiro"===t?{_clientId:r._clientId,_clientSecret:r._clientSecret,_region:r._region,_authMethod:r._authMethod,_startUrl:r._startUrl}:"qoder"===t||"qoder-cn"===t?{_qoderNonce:r._qoderNonce,_qoderMachineId:r._qoderMachineId,_qoderVerifier:r.codeVerifier}:"kimi"===t||"kimi-coding"===t?{_kimiDeviceId:r._kimiDeviceId}:"glm"===t?{_zcodePollToken:r._zcodePollToken}:null;X(r.device_code,r.codeVerifier,r.interval||5,s,Number.isFinite(r.expires_in)&&r.expires_in>0?1e3*r.expires_in:void 0);return}let a=window.location.port||("https:"===window.location.protocol?"443":"80");e="codex"===t?"http://localhost:1455/auth/callback":"xai"===t?"http://127.0.0.1:56121/callback":`${window.location.origin}/callback`;let r=new URL(`/api/oauth/${t}/authorize`,window.location.origin);r.searchParams.set("redirect_uri",e),m&&Object.entries(m).forEach(([e,t])=>{t&&r.searchParams.set(e,t)});let n=await fetch(r.toString()),s=await n.json();if(!n.ok)throw Error(s.error);let i=!1,l=!1;if("codex"===t)try{let t=new URL("/api/oauth/codex/start-proxy",window.location.origin);t.searchParams.set("app_port",a),t.searchParams.set("state",s.state),t.searchParams.set("code_verifier",s.codeVerifier),t.searchParams.set("redirect_uri",e);let r=await fetch(t.toString()),n=await r.json();i=n.success,l=!!n.serverSide}catch{i=!1}let o=!1,c=!1;if("xai"===t)try{let t=new URL("/api/oauth/xai/start-proxy",window.location.origin);t.searchParams.set("app_port",a),t.searchParams.set("state",s.state),t.searchParams.set("code_verifier",s.codeVerifier),t.searchParams.set("redirect_uri",e);let r=await fetch(t.toString()),n=await r.json();if(o=n.success,c=!!n.serverSide,!o&&"port_busy"===n.reason)throw Error("Port 56121 in use; close the conflicting process and retry")}catch(e){if(e?.message)throw e;o=!1}if(f({...s,redirectUri:e,codexServerSide:l,xaiServerSide:c}),("codex"===t&&i||"xai"===t&&o)&&(D.current.proxyStarted=!0,D.current.proxyProvider=t,D.current.stopSent=!1),!s.authUrl){if("device_code"===s.flowType)throw Error(`Provider ${t} uses device-code login but is not wired in the OAuth modal device-code list`);throw Error("No authorization URL returned from OAuth provider")}"codex"===t&&i||"xai"===t&&o||J&&"codex"!==t&&"xai"!==t?(h("waiting"),z.current=window.open(s.authUrl,"oauth_popup","width=600,height=700"),z.current||h("input")):(h("input"),window.open(s.authUrl,"_blank"))}catch(e){y(e.message),h("error")}};(0,n.useEffect)(()=>{U.current=s,L.current=i,q.current=e,M.current=ea}),(0,n.useEffect)(()=>{e&&t&&(R.current||(R.current=!0,f(null),v(""),y(null),w(!1),C(null),O(!1),I("browser"),P(""),E(null),A.current=!1,D.current={proxyStarted:!1,proxyProvider:null,stopSent:!1},c[t]&&fetch(`/api/oauth/${t}/ide-status`).then(e=>e.json()).then(e=>E(e)).catch(()=>E({installed:!1,path:null})),M.current()))},[e,t]),(0,n.useEffect)(()=>{e||(A.current=!0,R.current=!1,ee(),D.current={proxyStarted:!1,proxyProvider:null,stopSent:!1})},[e,t,ee]),(0,n.useEffect)(()=>{if(!g?.state||!t)return;let e=!1,a=0,r=async()=>{if(!e){a+=1;try{let a=await fetch(`/api/oauth/${t}/poll-status?state=${encodeURIComponent(g.state)}`),r=await a.json();if(e)return;if("done"===r.status){H.current=!0,h("success"),U.current?.();return}if("error"===r.status){H.current=!0,y(r.error||"Authentication failed"),h("error");return}}catch{}if(a>=300){H.current=!0,y("Authentication timeout"),h("error");return}e||setTimeout(r,1e3)}},n=setTimeout(r,1e3);return()=>{e=!0,clearTimeout(n)}},[g,t]),(0,n.useEffect)(()=>{let e;if(!g)return;H.current=!1;let t=async e=>{let{code:t,token:a,state:r,error:n,errorDescription:s,fullUrl:i}=e;if(i?v(i):t&&v(`${window.location.origin}/callback?state=${encodeURIComponent(r||"")}&code=${encodeURIComponent(t)}`),!H.current){if(n){H.current=!0,y(s||n),h("error");return}(a||t)&&(H.current=!0,await Y(a||t,r))}},a=e=>{let a=e.origin.includes("localhost")||e.origin.includes("127.0.0.1"),r=e.origin===window.location.origin;(a||r)&&e.data?.type==="oauth_callback"&&t(e.data.data)};window.addEventListener("message",a);try{(e=new BroadcastChannel("oauth_callback")).onmessage=e=>t(e.data)}catch(e){console.log("BroadcastChannel not supported")}let r=e=>{if("oauth_callback"===e.key&&e.newValue)try{let a=JSON.parse(e.newValue);t(a),localStorage.removeItem("oauth_callback")}catch(e){console.log("Failed to parse localStorage data")}};window.addEventListener("storage",r);try{let e=localStorage.getItem("oauth_callback");if(e){let a=JSON.parse(e);a.timestamp&&Date.now()-a.timestamp<3e4&&t(a),localStorage.removeItem("oauth_callback")}}catch{}return()=>{window.removeEventListener("message",a),window.removeEventListener("storage",r),e&&e.close()}},[g,Y]);let er=async()=>{try{if(y(null),"paste-token"===F&&c[t]){let e=W.trim();if(!e)throw Error("Missing token");let a=await fetch(`/api/oauth/${t}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e})}),r=await a.json();if(!a.ok)throw Error(r.error);h("success"),U.current?.();return}let e=b.trim();if(!e)return;if(_(!0),d.has(t)&&e){let a=await fetch(`/api/oauth/${t}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,state:g?.state,...g?.redirectUri?{redirectUri:g.redirectUri}:{},...g?.codeVerifier?{codeVerifier:g.codeVerifier}:{},...g?.systemId?{systemId:g.systemId}:{}})}),r=await a.json();if(!a.ok)throw Error(r.error);h("success"),U.current?.();return}if(e.startsWith("eyJ")&&e.includes("."))return void await Y(e,null);if("xai"===t&&e&&!e.includes("://")&&!e.includes("?")&&!e.includes("code="))return void await Z(e);if("kimchi"===t&&e&&!e.includes("://")&&!e.includes("?"))return void await Y(e,null);let a=null,r=null,n=null,s=null;if(e.includes("://")||e.startsWith("/")||e.startsWith("?")){let t=e.startsWith("/")||e.startsWith("?")?`http://localhost${e.startsWith("?")?"":"/"}${e}`:e;try{let e=new URL(t);if(a=e.searchParams.get("code"),r=e.searchParams.get("token"),n=e.searchParams.get("state"),s=e.searchParams.get("error"))throw Error(e.searchParams.get("error_description")||s)}catch(t){if(s)throw t;a=e}}else a=e;if(!a&&!r)throw Error("xai"===t?"Paste the callback URL or copied xAI code":"kimchi"===t?"No Kimchi token found in URL":"No authorization code found in URL");await Y(r||a,n)}catch(e){y(e.message),h("error")}finally{_(!1)}},en=(0,n.useCallback)(()=>{ee(),"codex"===t?fetch("/api/oauth/codex/stop-proxy").catch(()=>{}):"xai"===t&&fetch("/api/oauth/xai/stop-proxy").catch(()=>{}),L.current?.()},[ee,t]);if(!t||!a)return null;let es="xai"===t,ei="kimchi"===t,el="zed"===t&&"browser"===F&&"localhost"!==window.location.hostname&&"127.0.0.1"!==window.location.hostname,eo=!!c[t],ed=N?.verification_uri_complete||N?.verification_uri||"",ec=es?"Connect Grok Build OAuth":`Connect ${a.name}`,eu=es?"http://127.0.0.1:56121/callback?code=... or copied code":ei?`${G.replace("code=...","token=...")} or copied token`:G;return(0,r.jsx)(l.aF,{isOpen:e,title:ec,onClose:en,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[d.has(t)&&("waiting"===p||"input"===p||"error"===p)&&(0,r.jsxs)(r.Fragment,{children:[eo&&(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{type:"button",onClick:()=>{I("browser"),y(null),h("waiting"),ea()},className:`flex-1 rounded-lg border px-3 py-2 text-sm transition-colors ${"browser"===F?"border-primary bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:"\uD83C\uDF10 Sign in with browser"}),(0,r.jsx)("button",{type:"button",onClick:()=>{I("paste-token"),y(null),h("input")},className:`flex-1 rounded-lg border px-3 py-2 text-sm transition-colors ${"paste-token"===F?"border-primary bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:"\uD83D\uDD11 Paste token"})]}),"browser"===F&&(0,r.jsxs)(r.Fragment,{children:["waiting"===p&&!el&&(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-primary animate-spin",children:"progress_activity"}),(0,r.jsx)("span",{className:"text-sm",children:"Waiting for browser authorization…"})]}),"input"===p&&el&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Sign in at Zed in your browser"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"A Zed sign-in tab was opened. Complete the sign-in there — Zed will land on a 127.0.0.1 address that only your own computer can see, which is expected."}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.pd,{value:g?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,r.jsx)(l.$n,{variant:"secondary",icon:"auth_url"===V?"check":"content_copy",onClick:()=>K(g?.authUrl,"auth_url"),disabled:!g?.authUrl,children:"Copy"}),(0,r.jsx)(l.$n,{variant:"secondary",icon:"open_in_new",onClick:()=>g?.authUrl&&window.open(g.authUrl,"_blank","noopener,noreferrer"),disabled:!g?.authUrl,children:"Open"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL from your browser here"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Copy the full 127.0.0.1 URL from your browser's address bar (it contains your user_id and an encrypted token, which is decrypted on the server)."}),(0,r.jsx)(l.pd,{value:b,onChange:e=>v(e.target.value),placeholder:"http://127.0.0.1:58443/?user_id=...&access_token=...",className:"font-mono text-xs"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:er,fullWidth:!0,disabled:!b,children:"Connect"}),(0,r.jsx)(l.$n,{onClick:en,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"input"===p&&!el&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Popup was blocked. After authorizing in the browser, paste the full callback URL here:"}),(0,r.jsx)(l.pd,{value:b,onChange:e=>v(e.target.value),placeholder:"http://127.0.0.1:.../callback?...",className:"font-mono text-xs"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:er,fullWidth:!0,disabled:!b,children:"Connect"}),(0,r.jsx)(l.$n,{onClick:en,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]}),"paste-token"===F&&eo&&(0,r.jsxs)("div",{className:"space-y-3",children:[T&&!T.installed&&(0,r.jsxs)("div",{className:`px-3 py-2 rounded-lg text-sm ${c[t].ideOptional?"bg-blue-500/10 text-blue-700 dark:text-blue-300":"bg-yellow-500/10 text-yellow-700 dark:text-yellow-300"}`,children:[c[t].ideName," IDE not detected.",c[t].ideOptional?" You can still grab the token from DevTools.":` Install ${c[t].ideName} IDE to get the token, or use "Sign in with browser".`]}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:c[t].instructions}),(0,r.jsx)(l.pd,{value:W,onChange:e=>P(e.target.value),placeholder:c[t].placeholder,className:"font-mono text-xs"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:er,fullWidth:!0,disabled:!W,children:"Connect"}),(0,r.jsx)(l.$n,{onClick:en,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]}),("waiting"===p||"input"===p)&&!k&&!d.has(t)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-primary animate-spin",children:"progress_activity"}),(0,r.jsx)("span",{className:"text-sm",children:es?"Waiting for Grok Build OAuth…":"Waiting for popup authorization…"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 my-1",children:[(0,r.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,r.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wider",children:"Or paste callback URL manually"}),(0,r.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-sm font-medium mb-2",children:["Step 1: Open this ",es?"Grok Build OAuth URL":"URL"," in your browser"]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.pd,{value:g?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,r.jsx)(l.$n,{variant:"secondary",icon:"auth_url"===V?"check":"content_copy",onClick:()=>K(g?.authUrl,"auth_url"),disabled:!g?.authUrl,children:"Copy"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-sm font-medium mb-2",children:["Step 2: Paste the ","xai"===t?"callback URL or copied code":ei?"callback URL or copied token":"callback URL"," here"]}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"xai"===t?"If xAI shows a code instead of redirecting, paste that code here.":ei?"After authorization, copy the full callback URL or token from your browser.":"After authorization, copy the full URL from your browser."}),(0,r.jsx)(l.pd,{value:b,onChange:e=>v(e.target.value),placeholder:eu,className:"font-mono text-xs"})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:er,fullWidth:!0,disabled:!b.trim()||$,children:$?"Connecting...":"Connect"}),(0,r.jsx)(l.$n,{onClick:en,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"waiting"===p&&k&&N&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"text-center py-4",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Visit the login URL below and authorize:"}),(0,r.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[(0,r.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Login URL"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("code",{className:"flex-1 text-sm break-all",children:ed}),(0,r.jsx)(l.$n,{size:"sm",variant:"ghost",icon:"login_url"===V?"check":"content_copy",onClick:()=>K(ed,"login_url"),disabled:!ed}),(0,r.jsx)(l.$n,{size:"sm",variant:"ghost",icon:"open_in_new",onClick:()=>window.open(ed,"_blank","noopener,noreferrer"),disabled:!ed,children:"Open"})]})]}),N.user_code&&(0,r.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[(0,r.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Your Code"}),(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:N.user_code}),(0,r.jsx)(l.$n,{size:"sm",variant:"ghost",icon:"user_code"===V?"check":"content_copy",onClick:()=>K(N.user_code,"user_code")})]})]})]}),S&&(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),"Waiting for authorization..."]})]}),"success"===p&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,r.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your ",a.name," account has been connected."]}),(0,r.jsx)(l.$n,{onClick:en,fullWidth:!0,children:"Done"})]}),"error"===p&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,r.jsx)("p",{className:"text-sm text-red-600 mb-4",children:j}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:ea,variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,r.jsx)(l.$n,{onClick:en,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}u.propTypes={isOpen:i().bool.isRequired,provider:i().string,providerInfo:i().shape({name:i().string}),onSuccess:i().func,onClose:i().func.isRequired,oauthMeta:i().object,idcConfig:i().shape({startUrl:i().string,region:i().string})}},91450:(e,t,a)=>{a.d(t,{default:()=>l});var r=a(95155),n=a(14051),s=a.n(n),i=a(38587);function l({children:e}){return(0,r.jsxs)("div",{className:"min-h-screen flex flex-col relative bg-bg transition-colors duration-500 overflow-x-hidden selection:bg-primary/20 selection:text-primary",children:[(0,r.jsx)("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-primary/5 dark:bg-primary/5 rounded-full blur-[100px] pointer-events-none z-0"}),(0,r.jsx)("div",{className:"fixed bottom-0 right-0 w-[600px] h-[600px] bg-orange-200/20 dark:bg-orange-900/10 rounded-full blur-[120px] pointer-events-none z-0 translate-y-1/3 translate-x-1/3"}),(0,r.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,r.jsx)(i.default,{variant:"card"})}),(0,r.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:e})]})}l.propTypes={children:s().node.isRequired}},92173:(e,t,a)=>{a.d(t,{default:()=>c});var r=a(95155),n=a(98500),s=a.n(n),i=a(90620);let l=[{label:"Features",href:"#features"},{label:"Pricing",href:"#pricing"},{label:"Changelog",href:"#"}],o=[{label:"Documentation",href:"#"},{label:"API Reference",href:"#"},{label:"Help Center",href:"#"}],d=[{label:"About",href:"#"},{label:"Blog",href:"#"},{label:"Contact",href:"#"}];function c(){return(0,r.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,r.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[(0,r.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-10 mb-12",children:[(0,r.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,r.jsx)("div",{className:"size-6 text-primary",children:(0,r.jsx)("svg",{className:"w-full h-full",fill:"currentColor",viewBox:"0 0 48 48",children:(0,r.jsx)("path",{clipRule:"evenodd",d:"M12.0799 24L4 19.2479L9.95537 8.75216L18.04 13.4961L18.0446 4H29.9554L29.96 13.4961L38.0446 8.75216L44 19.2479L35.92 24L44 28.7521L38.0446 39.2479L29.96 34.5039L29.9554 44H18.0446L18.04 34.5039L9.95537 39.2479L4 28.7521L12.0799 24Z",fillRule:"evenodd"})})}),(0,r.jsx)("span",{className:"text-xl font-bold text-text-main",children:i.vQ.name})]}),(0,r.jsx)("p",{className:"text-text-muted mb-6 max-w-sm font-light",children:"The unified interface for modern AI infrastructure. Secure, observable, and scalable."}),(0,r.jsxs)("div",{className:"flex gap-4",children:[(0,r.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"Twitter",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z"})})}),(0,r.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})})})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Product"}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:l.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(s(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Resources"}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:o.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(s(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Company"}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:d.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(s(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]})]}),(0,r.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["\xa9 ",new Date().getFullYear()," ",i.vQ.name," Inc. All rights reserved."]}),(0,r.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[(0,r.jsx)(s(),{href:"#",className:"hover:text-primary transition-colors",children:"Privacy Policy"}),(0,r.jsx)(s(),{href:"#",className:"hover:text-primary transition-colors",children:"Terms of Service"})]})]})]})})}},92542:(e,t,a)=>{a.d(t,{default:()=>l});var r=a(95155),n=a(31474);let s={primary:"bg-brand-500 hover:bg-brand-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",secondary:"bg-surface-2 hover:bg-surface-3 text-text-main border border-border disabled:opacity-50",outline:"border border-border text-text-main hover:bg-surface-2 hover:border-brand-500/40",ghost:"text-text-muted hover:bg-surface-2 hover:text-text-main",danger:"bg-red-500 hover:bg-red-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",success:"bg-green-600 hover:bg-green-700 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted"},i={sm:"h-7 px-3 text-xs rounded-[8px]",md:"h-9 px-4 text-sm rounded-[10px]",lg:"h-11 px-6 text-sm rounded-[10px]"};function l({children:e,variant:t="primary",size:a="md",icon:o,iconRight:d,disabled:c=!1,loading:u=!1,fullWidth:m=!1,className:x,...p}){return(0,r.jsxs)("button",{className:(0,n.cn)("inline-flex items-center justify-center gap-2 font-semibold transition-all duration-150 ease-out cursor-pointer","active:scale-[0.97] disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100",s[t],i[a],m&&"w-full",x),disabled:c||u,...p,children:[u?(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}):o?(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:o}):null,e,d&&!u&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:d})]})}},94230:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497),o=a(11059);function d({isOpen:e,provider:t,onSuccess:a,onClose:s}){let[i,c]=(0,n.useState)("loading"),[u,m]=(0,n.useState)(""),[x,p]=(0,n.useState)(null),[h,g]=(0,n.useState)(""),[f,b]=(0,n.useState)(null),{copied:v,copy:j}=(0,o.C)(),y=(0,n.useRef)(!1);(0,n.useEffect)(()=>{e||(y.current=!1)},[e]),(0,n.useEffect)(()=>{e&&t&&(async()=>{try{b(null),c("loading");let e=await fetch(`/api/oauth/kiro/social-authorize?provider=${t}`),a=await e.json();if(!e.ok)throw Error(a.error);p(a),m(a.authUrl),c("input"),y.current||(y.current=!0,window.open(a.authUrl,"_blank"))}catch(e){b(e.message),c("error")}})()},[e,t]);let k=async()=>{try{let e;b(null);try{e=new URL(h)}catch(e){throw Error("Invalid callback URL format")}let r=e.searchParams.get("code");e.searchParams.get("state");let n=e.searchParams.get("error");if(n)throw Error(e.searchParams.get("error_description")||n);if(!r)throw Error("No authorization code found in URL");let s=await fetch("/api/oauth/kiro/social-exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:r,codeVerifier:x.codeVerifier,provider:t})}),i=await s.json();if(!s.ok)throw Error(i.error);c("success"),a?.()}catch(e){b(e.message),c("error")}},w="google"===t?"Google":"GitHub";return(0,r.jsx)(l.aF,{isOpen:e,title:`Connect Kiro via ${w}`,onClose:s,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:["loading"===i&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Initializing..."}),(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["Setting up ",w," authentication"]})]}),"input"===i&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.pd,{value:u,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,r.jsx)(l.$n,{variant:"secondary",icon:"auth_url"===v?"check":"content_copy",onClick:()=>j(u,"auth_url"),children:"Copy"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser address bar."}),(0,r.jsx)(l.pd,{value:h,onChange:e=>g(e.target.value),placeholder:"kiro://kiro.kiroAgent/authenticate-success?code=...",className:"font-mono text-xs"})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:k,fullWidth:!0,disabled:!h,children:"Connect"}),(0,r.jsx)(l.$n,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===i&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,r.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your Kiro account via ",w," has been connected."]}),(0,r.jsx)(l.$n,{onClick:s,fullWidth:!0,children:"Done"})]}),"error"===i&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,r.jsx)("p",{className:"text-sm text-red-600 mb-4",children:f}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:()=>c("input"),variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,r.jsx)(l.$n,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}d.propTypes={isOpen:i().bool.isRequired,provider:i().oneOf(["google","github"]).isRequired,onSuccess:i().func,onClose:i().func.isRequired}},95088:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497);let o="https://gitlab.com";function d({isOpen:e,providerInfo:t,onSuccess:a,onClose:s}){let i,[c,u]=(0,n.useState)(null),[m,x]=(0,n.useState)(o),[p,h]=(0,n.useState)(""),[g,f]=(0,n.useState)(""),[b,v]=(0,n.useState)(""),[j,y]=(0,n.useState)(!1),[k,w]=(0,n.useState)(null),[N,C]=(0,n.useState)(!1),[S,O]=(0,n.useState)(null),F=()=>{u(null),x(o),h(""),f(""),v(""),w(null),y(!1),C(!1),O(null),s()},I=async()=>{if(!b.trim())return void w("Personal Access Token is required");y(!0),w(null);try{let e=await fetch("/api/oauth/gitlab/pat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:b.trim(),baseUrl:m.trim()||o})}),t=await e.json();if(!e.ok)throw Error(t.error||"Authentication failed");a?.(),F()}catch(e){w(e.message)}finally{y(!1)}};return e?N&&S?(0,r.jsx)(l.LF,{isOpen:!0,provider:"gitlab",providerInfo:t,oauthMeta:S,onSuccess:()=>{a?.(),F()},onClose:()=>{C(!1),O(null)}}):(0,r.jsx)(l.aF,{isOpen:e,title:"Connect GitLab Duo",onClose:F,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[!c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Choose how to authenticate with GitLab Duo:"}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("button",{onClick:()=>u("oauth"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary",children:"lock_open"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"OAuth App"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab OAuth application"})]})]}),(0,r.jsxs)("button",{onClick:()=>u("pat"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary",children:"key"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"Personal Access Token"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab PAT with api scope"})]})]})]})]}),"oauth"===c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:"text-xs text-text-muted",children:["Create an OAuth app at"," ",(0,r.jsx)("a",{href:`${m.trim()||o}/-/profile/applications`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Applications"})," ","with redirect URI"," ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:(i=window.location.port||("https:"===window.location.protocol?"443":"80"),`http://localhost:${i}/callback`)})]}),(0,r.jsx)(l.pd,{label:"GitLab Base URL",value:m,onChange:e=>x(e.target.value),placeholder:o}),(0,r.jsx)(l.pd,{label:"Client ID",value:p,onChange:e=>h(e.target.value),placeholder:"Your OAuth application client ID"}),(0,r.jsx)(l.pd,{label:"Client Secret (optional for PKCE)",value:g,onChange:e=>f(e.target.value),placeholder:"Leave empty for public PKCE app"}),k&&(0,r.jsx)("p",{className:"text-sm text-red-500",children:k}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:()=>{p.trim()?(w(null),O({baseUrl:m.trim()||o,clientId:p.trim(),clientSecret:g.trim()}),C(!0)):w("Client ID is required")},fullWidth:!0,disabled:!p.trim(),children:"Authorize"}),(0,r.jsx)(l.$n,{onClick:()=>{u(null),w(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"pat"===c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:"text-xs text-text-muted",children:["Create a PAT at"," ",(0,r.jsx)("a",{href:`${m.trim()||o}/-/user_settings/personal_access_tokens`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Access Tokens"})," ","with scopes: ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"api"}),","," ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"read_user"}),", and"," ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"ai_features"}),"."]}),(0,r.jsx)(l.pd,{label:"GitLab Base URL",value:m,onChange:e=>x(e.target.value),placeholder:o}),(0,r.jsx)(l.pd,{label:"Personal Access Token",value:b,onChange:e=>v(e.target.value),placeholder:"glpat-****************",type:"password"}),k&&(0,r.jsx)("p",{className:"text-sm text-red-500",children:k}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:I,fullWidth:!0,disabled:!b.trim()||j,loading:j,children:"Connect"}),(0,r.jsx)(l.$n,{onClick:()=>{u(null),w(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})}):null}d.propTypes={isOpen:i().bool.isRequired,providerInfo:i().shape({name:i().string}),onSuccess:i().func,onClose:i().func.isRequired}},96748:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497);let o="https://api.openai.com/v1";function d({isOpen:e,onClose:t,onCreated:a,onSaved:s,node:i}){let c=!!i,[u,m]=(0,n.useState)({name:"",prefix:"",baseUrl:o}),[x,p]=(0,n.useState)(!1),[h,g]=(0,n.useState)(""),[f,b]=(0,n.useState)(""),[v,j]=(0,n.useState)(!1),[y,k]=(0,n.useState)(null);(0,n.useEffect)(()=>{e&&(k(null),g(""),b(""),c?m({name:i.name||"",prefix:i.prefix||"",baseUrl:i.baseUrl||o}):m({name:"",prefix:"",baseUrl:o}))},[e,c,i]);let w=async()=>{if(u.name.trim()&&u.prefix.trim()&&u.baseUrl.trim()){p(!0);try{let e=c?`/api/provider-nodes/${i.id}`:"/api/provider-nodes",t=c?"PUT":"POST",r={name:u.name,prefix:u.prefix,baseUrl:u.baseUrl};c||(r.type="custom-embedding");let n=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),l=await n.json();n.ok&&(c?s?.(l.node):a?.(l.node))}catch(e){console.log("Error saving custom embedding node:",e)}finally{p(!1)}}},N=async()=>{j(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:u.baseUrl,apiKey:h,type:"custom-embedding",modelId:f.trim()||void 0})}),t=await e.json();k(t)}catch{k({valid:!1,error:"Network error"})}finally{j(!1)}};return(0,r.jsx)(l.aF,{isOpen:e,title:c?"Edit Custom Embedding":"Add Custom Embedding",onClose:t,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(l.pd,{label:"Name",value:u.name,onChange:e=>m({...u,name:e.target.value}),placeholder:"Voyage AI",hint:"Required. A friendly label for this embedding provider."}),(0,r.jsx)(l.pd,{label:"Prefix",value:u.prefix,onChange:e=>m({...u,prefix:e.target.value}),placeholder:"voyage",hint:"Required. Used as the provider prefix for model IDs (e.g. voyage/voyage-3)."}),(0,r.jsx)(l.pd,{label:"Base URL",value:u.baseUrl,onChange:e=>m({...u,baseUrl:e.target.value}),placeholder:"https://api.voyageai.com/v1",hint:"Most embedding APIs are OpenAI-compatible: Voyage, Cohere, Jina, Mistral, Together..."}),(0,r.jsx)(l.pd,{label:"API Key (for Check)",type:"password",value:h,onChange:e=>g(e.target.value)}),(0,r.jsx)(l.pd,{label:"Model ID (for Check)",value:f,onChange:e=>b(e.target.value),placeholder:"e.g. voyage-3, embed-english-v3.0, text-embedding-3-small",hint:"Required for validation. Will send a test embeddings request."}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(l.$n,{onClick:N,disabled:!h||!f.trim()||v||!u.baseUrl.trim(),variant:"secondary",children:v?"Checking...":"Check"}),(()=>{if(!y)return null;let{valid:e,error:t,dimensions:a}=y;return e?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.Ex,{variant:"success",children:"Valid"}),a&&(0,r.jsxs)("span",{className:"text-sm text-text-muted",children:[a," dims"]})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)(l.Ex,{variant:"error",children:"Invalid"}),t&&(0,r.jsx)("span",{className:"text-sm text-red-500",children:t})]})})()]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:w,fullWidth:!0,disabled:!u.name.trim()||!u.prefix.trim()||!u.baseUrl.trim()||x,children:x?c?"Saving...":"Creating...":c?"Save":"Create"}),(0,r.jsx)(l.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}d.propTypes={isOpen:i().bool.isRequired,onClose:i().func.isRequired,onCreated:i().func,onSaved:i().func,node:i().shape({id:i().string,name:i().string,prefix:i().string,baseUrl:i().string})}},97677:(e,t,a)=>{a.d(t,{default:()=>n});var r=a(95155);function n({text:e,children:t,position:a="top",color:s}){let i=s?"":"bg-gray-900";return(0,r.jsxs)("div",{className:"relative inline-flex group/tt",children:[t,(0,r.jsx)("div",{className:`pointer-events-none absolute ${{top:"bottom-full left-1/2 -translate-x-1/2 mb-1.5",bottom:"top-full left-1/2 -translate-x-1/2 mt-1.5",left:"right-full top-1/2 -translate-y-1/2 mr-1.5",right:"left-full top-1/2 -translate-y-1/2 ml-1.5"}[a]} z-50 w-max max-w-56 rounded px-2 py-1 text-[11px] leading-snug ${i} text-white opacity-0 group-hover/tt:opacity-100 transition-opacity duration-150 whitespace-normal`,style:s?{backgroundColor:s}:{},children:e})]})}},98254:(e,t,a)=>{a.d(t,{default:()=>x});var r=a(95155),n=a(12115),s=a(73321),i=a(65921),l=a(84130),o=a(8823),d=a(90620),c=a(73147),u=a(40197);function m(){let[e,t]=(0,n.useState)(!1),[a,s]=(0,n.useState)(null),[i,l]=(0,n.useState)(null),[o,m]=(0,n.useState)([]),[x,p]=(0,n.useState)(!1),[h,g]=(0,n.useState)(!1),[f,b]=(0,n.useState)(!1);return((0,n.useEffect)(()=>{let e=(0,c.BM)(d.vQ.version);if(!e.show)return;t(!0),s(e.fromVersion),l(e.toVersion);let a=!1;return fetch(d.Nu.changelogUrl,{cache:"no-store"}).then(e=>e.ok?e.text():Promise.reject(Error(`HTTP ${e.status}`))).then(t=>{if(a)return;let r=(0,c.zV)(t,e.fromVersion,e.toVersion),n=r.length>0?r:(0,c.zV)(t,null,e.toVersion),{bullets:s,truncated:i}=(0,c.eK)(n.length?n:[],{maxBullets:6});m(s),p(i)}).catch(()=>{}),()=>{a=!0}},[]),e)?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"pointer-events-auto w-full rounded-lg border border-green-500/30 bg-green-500/10 text-green-800 dark:text-green-200 shadow-lg backdrop-blur-sm px-3 py-2.5",children:(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px] leading-5 text-green-600 dark:text-green-400 shrink-0",children:"celebration"}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("p",{className:"text-xs font-semibold",children:["Updated to v",i,a?(0,r.jsxs)("span",{className:"font-normal opacity-80",children:[" (from v",a,")"]}):null]}),!f&&0===o.length&&(0,r.jsx)("p",{className:"text-[11px] opacity-80 mt-0.5",children:"You're on the latest install."}),f&&o.length>0&&(0,r.jsxs)("ul",{className:"mt-1.5 space-y-0.5 text-[11px] opacity-90 list-disc list-inside",children:[o.map((e,t)=>(0,r.jsx)("li",{className:"truncate",title:e.text,children:e.text},`${e.version}-${t}`)),x&&(0,r.jsx)("li",{className:"list-none opacity-70 pl-0",children:"…and more"})]}),(0,r.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-2",children:[o.length>0&&(0,r.jsx)("button",{type:"button",onClick:()=>b(e=>!e),className:"text-[11px] font-medium underline-offset-2 hover:underline",children:f?"Hide changes":"See what changed"}),(0,r.jsx)("button",{type:"button",onClick:()=>g(!0),className:"text-[11px] font-medium underline-offset-2 hover:underline opacity-80",children:"Full changelog"})]})]}),(0,r.jsx)("button",{type:"button",onClick:()=>{(0,c.yM)(d.vQ.version),t(!1)},className:"text-current/70 hover:text-current shrink-0","aria-label":"Dismiss",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]})}),(0,r.jsx)(u.default,{isOpen:h,onClose:()=>g(!1)})]}):null}function x({children:e}){let[t,d]=(0,n.useState)(!1),c=(0,s.usePathname)(),u=(0,i.i)(e=>e.notifications),p=(0,i.i)(e=>e.removeNotification);return(0,n.useEffect)(()=>{let e=()=>{a.e(6808).then(a.bind(a,6808)).catch(()=>{}),Promise.all([a.e(3842),a.e(9495),a.e(1649),a.e(124)]).then(a.bind(a,10124)).catch(()=>{}),Promise.all([a.e(3842),a.e(9495),a.e(8569),a.e(2435)]).then(a.bind(a,82435)).catch(()=>{}),Promise.all([a.e(3842),a.e(9495),a.e(8569),a.e(5462)]).then(a.bind(a,65462)).catch(()=>{})};{if("requestIdleCallback"in window){let t=window.requestIdleCallback(e,{timeout:4e3});return()=>window.cancelIdleCallback(t)}let t=setTimeout(e,2500);return()=>clearTimeout(t)}},[]),(0,r.jsxs)("div",{className:"flex h-screen w-full overflow-hidden bg-bg",children:[(0,r.jsxs)("div",{className:"fixed top-4 right-4 z-[80] flex w-[min(92vw,380px)] flex-col gap-2",children:[(0,r.jsx)(m,{}),u.map(e=>{var t;let a="success"===(t=e.type)?{wrapper:"border-green-500/30 bg-green-500/10 text-green-600 dark:text-green-400",icon:"check_circle"}:"error"===t?{wrapper:"border-red-500/30 bg-red-500/10 text-red-600 dark:text-red-400",icon:"error"}:"warning"===t?{wrapper:"border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400",icon:"warning"}:{wrapper:"border-blue-500/30 bg-blue-500/10 text-blue-600 dark:text-blue-400",icon:"info"};return(0,r.jsx)("div",{className:`rounded-lg border px-3 py-2 shadow-lg backdrop-blur-sm ${a.wrapper}`,children:(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px] leading-5",children:a.icon}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[e.title?(0,r.jsx)("p",{className:"text-xs font-semibold mb-0.5",children:e.title}):null,(0,r.jsx)("p",{className:"text-xs whitespace-pre-wrap break-words",children:e.message})]}),e.dismissible?(0,r.jsx)("button",{type:"button",onClick:()=>p(e.id),className:"text-current/70 hover:text-current","aria-label":"Dismiss notification",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})}):null]})},e.id)})]}),t&&(0,r.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20 lg:hidden",onClick:()=>d(!1)}),(0,r.jsx)("div",{className:"hidden lg:flex",children:(0,r.jsx)(l.default,{})}),(0,r.jsx)("div",{className:`fixed inset-y-0 left-0 z-50 transform lg:hidden transition-transform duration-300 ease-in-out ${t?"translate-x-0":"-translate-x-full"}`,children:(0,r.jsx)(l.default,{onClose:()=>d(!1)})}),(0,r.jsxs)("main",{className:"flex flex-col flex-1 h-full min-w-0 relative transition-colors duration-300 isolate",children:[(0,r.jsx)("div",{className:"landing-grid absolute inset-0 pointer-events-none -z-10","aria-hidden":"true"}),(0,r.jsx)(o.default,{onMenuClick:()=>d(!0)},c),(0,r.jsx)("div",{className:`flex-1 overflow-y-auto custom-scrollbar ${"/dashboard/basic-chat"===c?"":"p-6 lg:p-10"} ${"/dashboard/basic-chat"===c?"flex flex-col overflow-hidden":""}`,children:(0,r.jsx)("div",{className:`${"/dashboard/basic-chat"===c?"flex-1 w-full h-full flex flex-col":"max-w-7xl mx-auto"}`,children:e})})]})]})}m.propTypes={}},98542:(e,t,a)=>{a.d(t,{default:()=>s});var r=a(95155),n=a(31474);function s({checked:e=!1,onChange:t,label:a,description:i,disabled:l=!1,size:o="md",className:d}){let c={sm:{track:"w-8 h-4",thumb:"size-3",translate:"translate-x-4"},md:{track:"w-11 h-6",thumb:"size-5",translate:"translate-x-5"},lg:{track:"w-14 h-7",thumb:"size-6",translate:"translate-x-7"}};return(0,r.jsxs)("div",{className:(0,n.cn)("flex items-center gap-3",l&&"opacity-50 cursor-not-allowed",d),children:[(0,r.jsx)("button",{type:"button",role:"switch","aria-checked":e,disabled:l,onClick:()=>{!l&&t&&t(!e)},className:(0,n.cn)("relative inline-flex shrink-0 cursor-pointer rounded-full","transition-colors duration-200 ease-in-out","focus:outline-none focus:ring-2 focus:ring-brand-500/30",e?"bg-brand-500":"bg-surface-3",c[o].track,l&&"cursor-not-allowed"),children:(0,r.jsx)("span",{className:(0,n.cn)("pointer-events-none inline-block rounded-full bg-white shadow-sm","transform transition duration-200 ease-in-out",e?c[o].translate:"translate-x-0.5",c[o].thumb,"mt-0.5")})}),(a||i)&&(0,r.jsxs)("div",{className:"flex flex-col",children:[a&&(0,r.jsx)("span",{className:"text-sm font-medium text-text-main",children:a}),i&&(0,r.jsx)("span",{className:"text-xs text-text-muted",children:i})]})]})}}}]);
17
+ `,children:(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[w.includes(e.value)&&!a&&(0,r.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),a?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"edit"}),e.name]}):(0,r.jsxs)(r.Fragment,{children:[e.value,(0,r.jsx)(d.default,{caps:O(e.value)})]})]})},e.value)})})]},e)),0===Object.keys(et).length&&0===X.length&&(0,r.jsxs)("div",{className:"text-center py-4 text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1 block",children:"search_off"}),(0,r.jsx)("p",{className:"text-xs",children:"No models found"})]})]})]})}f.propTypes={isOpen:i().bool.isRequired,onClose:i().func.isRequired,onSelect:i().func.isRequired,onDeselect:i().func,selectedModel:i().string,activeProviders:i().arrayOf(i().shape({provider:i().string.isRequired})),title:i().string,modelAliases:i().object,kindFilter:i().string,addedModelValues:i().arrayOf(i().string),closeOnSelect:i().bool,comboContext:i().shape({id:i().string,name:i().string})}},73147:(e,t,a)=>{a.d(t,{BM:()=>m,MY:()=>i,TJ:()=>u,eK:()=>o,yM:()=>x,zV:()=>l});let r="9router:lastSeenVersion",n="9router:updateFromVersion";function s(e,t){if(!e&&!t)return 0;if(!e)return -1;if(!t)return 1;let a=e=>String(e).trim().replace(/^v/i,"").split(/[.+-]/).map(e=>{let t=parseInt(e,10);return Number.isFinite(t)?t:0}),r=a(e),n=a(t),s=Math.max(r.length,n.length);for(let e=0;e<s;e++){let t=r[e]||0,a=n[e]||0;if(t>a)return 1;if(t<a)return -1}return 0}function i(e){let t;if(!e||"string"!=typeof e)return[];let a=/^#\s+v?(\d+\.\d+\.\d+[^\s)]*)\s*([^\n]*)/gm,r=[];for(;null!==(t=a.exec(e));)r.push({version:t[1].trim(),heading:t[0].replace(/^#\s+/,"").trim(),index:t.index,headerEnd:t.index+t[0].length});return 0===r.length?[]:r.map((t,a)=>{let n=t.headerEnd,s=a+1<r.length?r[a+1].index:e.length,i=e.slice(n,s).trim(),l=i.split(/\r?\n/).map(e=>e.trim()).filter(e=>/^[-*]\s+/.test(e)).map(e=>e.replace(/^[-*]\s+/,"").trim()).filter(Boolean);return{version:t.version,heading:t.heading,body:i,bullets:l}})}function l(e,t,a=null){let r=i(e);return 0===r.length?[]:r.filter(e=>!(a&&s(e.version,a)>0||t&&0>=s(e.version,t))&&(!!t||!!a&&0===s(e.version,a)))}function o(e,{maxBullets:t=10}={}){let a=[],r=[];for(let t of e)for(let e of(a.includes(t.version)||a.push(t.version),t.bullets)){var n;r.push({text:(n=e)?String(n).replace(/\*\*(.+?)\*\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").trim():"",version:t.version})}let s=r.length>t;return{bullets:r.slice(0,t),truncated:s,versions:a}}function d(e){try{if("u"<typeof localStorage)return null;return localStorage.getItem(e)}catch{return null}}function c(e,t){try{if("u"<typeof localStorage)return;localStorage.setItem(e,t)}catch{}}function u(e){e&&c(n,String(e).replace(/^v/i,""))}function m(e){let t=String(e||"").replace(/^v/i,"");if(!t)return{show:!1,fromVersion:null,toVersion:t};let a=d(n),i=d(r);return i||a?a&&s(t,a)>0?{show:!0,fromVersion:a,toVersion:t}:i&&s(t,i)>0?{show:!0,fromVersion:i,toVersion:t}:(i&&0===s(t,i)||c(r,t),{show:!1,fromVersion:null,toVersion:t}):(c(r,t),{show:!1,fromVersion:null,toVersion:t})}function x(e){let t=String(e||"").replace(/^v/i,"");t&&c(r,t),function(e){try{if("u"<typeof localStorage)return;localStorage.removeItem(e)}catch{}}(n)}},73579:(e,t,a)=>{a.d(t,{default:()=>h});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(81127),o=a(11910),d=a(98),c=a(92542),u=a(56061),m=a(88105),x=a(78177);function p({connection:e,thresholds:t,onChange:a}){let n=(0,x.XD)(e),s=e?.lastQuotaSnapshot?.windows||[];return(0,r.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1 text-sm",children:"Quota Safety Buffer"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-3",children:"Pause this account when a quota window's remaining % drops to/below its value. Set a window to 0 to disable it."}),n.eligible?0===s.length?(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"No quota windows known yet. Open the Quota Tracker to fetch usage first, then set per-window buffers here."}):(0,r.jsx)("div",{className:"flex flex-col gap-2",children:s.map(e=>{let n=Number(t[e.key])||0;return(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"flex-1 min-w-0 truncate text-sm",title:e.key,children:e.key}),(0,r.jsx)("span",{className:"text-xs text-text-muted tabular-nums w-14 text-right",children:"number"==typeof e.remainingPercentage?`${e.remainingPercentage}%`:"—"}),(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"≤"}),(0,r.jsx)("input",{type:"number",min:0,max:100,value:n,onChange:t=>a(e.key,Number.parseInt(t.target.value,10)||0),className:"w-16 px-2 py-1 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"%"})]},e.key)})}):(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Usage tracking isn't available for this account type, so the buffer can't be applied."})]})}function h({isOpen:e,connection:t,proxyPools:a,onSave:s,onClose:i}){let[x,g]=(0,n.useState)({name:"",priority:1,apiKey:"",cx:""}),[f,b]=(0,n.useState)({}),[v,j]=(0,n.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[y,k]=(0,n.useState)({accountId:""}),[w,N]=(0,n.useState)(""),[C,S]=(0,n.useState)({location:"global",reasoningEffort:"high"}),[O,F]=(0,n.useState)(!1),[W,I]=(0,n.useState)(null),[P,T]=(0,n.useState)(!1),[E,$]=(0,n.useState)(null),[_,z]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(t){g({name:t.name||"",priority:t.priority||1,apiKey:"",cx:t.providerSpecificData?.cx||""}),"azure"===t.provider&&t.providerSpecificData&&j({azureEndpoint:t.providerSpecificData.azureEndpoint||"",apiVersion:t.providerSpecificData.apiVersion||"2024-10-01-preview",deployment:t.providerSpecificData.deployment||"",organization:t.providerSpecificData.organization||""}),"cloudflare-ai"===t.provider&&t.providerSpecificData&&k({accountId:t.providerSpecificData.accountId||""});let e=m.Q2?.[t.provider];e?.regions&&N(t.providerSpecificData?.region||e.defaultRegion||e.regions[0]?.id||""),("vertex"===t.provider||"vertex-partner"===t.provider)&&t.providerSpecificData&&S({location:t.providerSpecificData.location||"global",reasoningEffort:t.providerSpecificData.reasoningEffort||"high"}),I(null),$(null),b(t.quotaPauseThresholds&&"object"==typeof t.quotaPauseThresholds?{...t.quotaPauseThresholds}:{})}},[t]);let A=t?.provider==="google-pse",R=A&&!x.cx.trim(),D=A?{...t.providerSpecificData,cx:x.cx.trim()}:void 0,U=t?.authType==="oauth",L=t?.provider==="azure",q=t?.provider==="cloudflare-ai",M=t?.provider==="vertex"||t?.provider==="vertex-partner",V=!!t&&((0,m.mq)(t.provider)||(0,m.gb)(t.provider)),K=t&&m.Q2?.[t.provider]?.regions||null,J=()=>{if(K&&w)return{...t?.providerSpecificData||{},region:w}},B=async()=>{if(t?.provider){F(!0),I(null);try{let e=await fetch(`/api/providers/${t.id}/test`,{method:"POST"}),a=await e.json();I(a.valid?"success":"failed")}catch{I("failed")}finally{F(!1)}}},G=async()=>{if(t?.provider&&x.apiKey&&!R){T(!0),$(null);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:x.apiKey,...L?{providerSpecificData:v}:{},...q?{providerSpecificData:y}:{},...A?{providerSpecificData:D}:{},...K?{providerSpecificData:J()}:{},...M?{providerSpecificData:C}:{}})}),a=await e.json();$(a.valid?"success":"failed")}catch{$("failed")}finally{T(!1)}}},Q=async()=>{if(t&&!R){z(!0);try{let e={name:x.name,priority:x.priority,quotaPauseThresholds:{...f}};if(A&&(e.providerSpecificData=D,D.cx!==t.providerSpecificData?.cx&&(e.testStatus="unknown")),!U&&x.apiKey){e.apiKey=x.apiKey;let a="success"===E;if(!a)try{T(!0),$(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:x.apiKey,...L?{providerSpecificData:v}:{},...q?{providerSpecificData:y}:{},...A?{providerSpecificData:D}:{},...K?{providerSpecificData:J()}:{},...M?{providerSpecificData:C}:{}})});a=!!(await e.json()).valid,$(a?"success":"failed")}catch{$("failed")}finally{T(!1)}a&&(e.testStatus="active",e.lastError=null,e.lastErrorAt=null)}L&&(e.providerSpecificData={azureEndpoint:v.azureEndpoint,apiVersion:v.apiVersion,deployment:v.deployment,organization:v.organization}),q&&(e.providerSpecificData={accountId:y.accountId}),K&&w&&(e.providerSpecificData=J()),M&&(e.providerSpecificData={location:C.location||"global",reasoningEffort:C.reasoningEffort||"high"}),await s(e)}finally{z(!1)}}};return t?(0,r.jsx)(l.default,{isOpen:e,title:"Edit Connection",onClose:i,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(o.default,{label:"Name",value:x.name,onChange:e=>g({...x,name:e.target.value}),placeholder:U?"Account name":"Production Key"}),U&&t.email&&(0,r.jsxs)("div",{className:"bg-sidebar/50 p-3 rounded-lg",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted mb-1",children:"Email"}),(0,r.jsx)("p",{className:"font-medium",children:t.email})]}),(0,r.jsx)(o.default,{label:"Priority",type:"number",value:x.priority,onChange:e=>g({...x,priority:Number.parseInt(e.target.value,10)||1})}),(0,r.jsx)(p,{thresholds:f,onChange:(e,t)=>b(a=>({...a,[e]:t})),connection:t}),!U&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(o.default,{label:"API Key",type:"password",value:x.apiKey,onChange:e=>g({...x,apiKey:e.target.value}),placeholder:"Enter new API key",hint:"Leave blank to keep the current API key.",className:"flex-1"}),(0,r.jsx)("div",{className:"pt-6",children:(0,r.jsx)(c.default,{onClick:G,disabled:!x.apiKey||R||P||_,variant:"secondary",children:P?"Checking...":"Check"})})]}),E&&(0,r.jsx)(u.default,{variant:"success"===E?"success":"error",children:"success"===E?"Valid":"Invalid"})]}),A&&(0,r.jsx)(o.default,{label:"Search Engine ID (cx)",value:x.cx,onChange:e=>{g({...x,cx:e.target.value}),$(null),I(null)},hint:"Save changes before testing the stored connection."}),L&&(0,r.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,r.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsx)(o.default,{label:"Azure Endpoint",value:v.azureEndpoint,onChange:e=>j({...v,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com",hint:"Your Azure OpenAI resource endpoint URL"}),(0,r.jsx)(o.default,{label:"Deployment Name",value:v.deployment,onChange:e=>j({...v,deployment:e.target.value}),placeholder:"gpt-4",hint:"The deployment name in your Azure resource"}),(0,r.jsx)(o.default,{label:"API Version",value:v.apiVersion,onChange:e=>j({...v,apiVersion:e.target.value}),placeholder:"2024-10-01-preview",hint:"Azure OpenAI API version to use"}),(0,r.jsx)(o.default,{label:"Organization",value:v.organization,onChange:e=>j({...v,organization:e.target.value}),placeholder:"Organization ID",hint:"Required for billing"})]})]}),K&&(0,r.jsx)(d.default,{label:"Region",value:w,onChange:e=>N(e.target.value),options:K.map(e=>({value:e.id,label:e.label}))}),M&&(0,r.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,r.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Vertex AI Configuration"}),(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsx)(d.default,{label:"Location",value:C.location,onChange:e=>S({...C,location:e.target.value}),options:[{value:"global",label:"global (recommended for Gemini 3.x)"},{value:"us-central1",label:"us-central1"},{value:"us-east4",label:"us-east4"},{value:"europe-west1",label:"europe-west1"},{value:"europe-west4",label:"europe-west4"},{value:"asia-east1",label:"asia-east1"},{value:"asia-northeast1",label:"asia-northeast1"}]}),(0,r.jsx)(d.default,{label:"Reasoning Effort (default)",value:C.reasoningEffort,onChange:e=>S({...C,reasoningEffort:e.target.value}),options:[{value:"high",label:"high (32k tokens — default for Pro)"},{value:"medium",label:"medium (8k tokens)"},{value:"low",label:"low (1k tokens)"},{value:"",label:"none (let model decide)"}]}),(0,r.jsxs)("p",{className:"text-xs text-text-muted",children:["Location ",(0,r.jsx)("code",{children:"global"})," is required for Gemini 3.1 Pro Preview."]})]})]}),!V&&!L&&!q&&!M&&(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(c.default,{onClick:B,variant:"secondary",disabled:O,children:O?"Testing...":"Test Connection"}),W&&(0,r.jsx)(u.default,{variant:"success"===W?"success":"error",children:"success"===W?"Valid":"Failed"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(c.default,{onClick:Q,fullWidth:!0,disabled:_||R,children:_?"Saving...":"Save"}),(0,r.jsx)(c.default,{onClick:i,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}p.propTypes={connection:i().object,thresholds:i().object.isRequired,onChange:i().func.isRequired},h.propTypes={isOpen:i().bool.isRequired,connection:i().shape({id:i().string,name:i().string,email:i().string,priority:i().number,authType:i().string,provider:i().string,providerSpecificData:i().object}),proxyPools:i().arrayOf(i().shape({id:i().string,name:i().string})),onSave:i().func.isRequired,onClose:i().func.isRequired}},78177:(e,t,a)=>{a.d(t,{XD:()=>l});var r=a(88105);function n(e){if(!e)return!1;let t="oauth"===e.authType,a=("apikey"===e.authType||"api_key"===e.authType)&&r.jO.includes(e.provider);return t||a}function s(e){let t=e?.quotaPauseThresholds;return t&&"object"==typeof t?t:{}}function i(e){let t=Number(e);return!Number.isFinite(t)||t<=0||t>100?0:t}function l(e){let t=s(e),a=e?.lastQuotaSnapshot?.windows||[],r=Object.values(t).some(e=>i(e)>0),l=function(e){if(!n(e))return null;let t=s(e),a=e?.lastQuotaSnapshot?.windows;if(!a||!Array.isArray(a)||0===a.length)return null;let r=null;for(let e of a){if(!e||!0===e.unlimited)continue;let a=i(t[e.key]);if(!a)continue;let n=Number(e.remainingPercentage);Number.isFinite(n)&&n<=a&&(null===r||n<Number(r.remainingPercentage))&&(r={key:e.key,remainingPercentage:n,threshold:a})}return r}(e);return{enabled:r,paused:null!==l,triggered:l,eligible:n(e),windows:a.map(e=>{let a=i(t[e.key]),r=Number(e.remainingPercentage);return{key:e.key,remainingPercentage:Number.isFinite(r)?r:null,threshold:a,configured:a>0,paused:a>0&&!e.unlimited&&Number.isFinite(r)&&r<=a}})}}},80752:(e,t,a)=>{a.d(t,{default:()=>u});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(1620),o=a(40197),d=a(81127);function c({icon:e,label:t,onClick:a,trailing:n,danger:s}){return(0,r.jsxs)("button",{onClick:a,className:`flex items-center gap-3 w-full px-4 py-2.5 text-sm transition-colors ${s?"text-red-500 hover:bg-red-500/10":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"}`,children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[20px] ${s?"":"text-text-muted"}`,children:e}),(0,r.jsx)("span",{className:"flex-1 text-left",children:t}),n&&(0,r.jsx)("span",{className:"text-base",children:n})]})}function u({onLogout:e}){let[t,a]=(0,n.useState)(!1),[s,i]=(0,n.useState)(!1),[m,x]=(0,n.useState)(!1),[p,h]=(0,n.useState)(!1),{toggleTheme:g,isDark:f}=(0,l.D)(),b=(0,n.useRef)(null),v=async()=>{h(!0);try{await fetch("/api/version/shutdown",{method:"POST"})}catch(e){}h(!1),x(!1)};return(0,n.useEffect)(()=>{let e=e=>{b.current&&!b.current.contains(e.target)&&a(!1)};if(t)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[t]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"relative",ref:b,children:[(0,r.jsx)("button",{onClick:()=>a(e=>!e),className:"flex items-center justify-center p-2 rounded-lg text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5 transition-all",title:"Menu",children:(0,r.jsx)("span",{className:"material-symbols-outlined",children:"grid_view"})}),t&&(0,r.jsxs)("div",{className:"absolute right-0 top-full mt-2 w-60 bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl z-50 animate-in fade-in zoom-in-95 duration-150 overflow-hidden py-1",children:[(0,r.jsx)(c,{icon:"history",label:"Change Log",onClick:()=>{a(!1),i(!0)}}),(0,r.jsx)(c,{icon:f?"light_mode":"dark_mode",label:"Theme",onClick:()=>{g(),a(!1)}}),(0,r.jsx)(c,{icon:"power_settings_new",label:"Shutdown",danger:!0,onClick:()=>{a(!1),x(!0)}}),(0,r.jsx)(c,{icon:"logout",label:"Logout",danger:!0,onClick:()=>{a(!1),e()}})]})]}),(0,r.jsx)(o.default,{isOpen:s,onClose:()=>i(!1)}),(0,r.jsx)(d.ConfirmModal,{isOpen:m,onClose:()=>x(!1),onConfirm:v,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:p})]})}c.propTypes={icon:i().string.isRequired,label:i().string.isRequired,onClick:i().func.isRequired,trailing:i().node,danger:i().bool},u.propTypes={onLogout:i().func.isRequired}},81127:(e,t,a)=>{a.d(t,{ConfirmModal:()=>d,default:()=>o});var r=a(95155),n=a(12115),s=a(31474),i=a(92542),l=a(97677);function o({isOpen:e,onClose:t,title:a,children:i,footer:d,size:c="md",closeOnOverlay:u=!0,showTrafficLights:m=!0,allowFullscreen:x=!0,className:p}){let[h,g]=(0,n.useState)(!1);return((0,n.useEffect)(()=>(e?document.body.style.overflow="hidden":(document.body.style.overflow="",g(!1)),()=>{document.body.style.overflow=""}),[e]),(0,n.useEffect)(()=>{let a=a=>{"Escape"===a.key&&e&&t()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,t]),e)?(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:u?t:void 0}),(0,r.jsxs)("div",{className:(0,s.cn)("relative w-full bg-surface","border border-border-subtle","rounded-[14px] shadow-[var(--shadow-elev)]","fade-in transition-all duration-150",h?"max-w-[95vw] w-[95vw] h-[90vh] max-h-[90vh] flex flex-col":({sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"})[c],p),children:[(a||m)&&(0,r.jsxs)("div",{className:"flex items-center justify-between p-2 border-b border-border-subtle select-none cursor-default",onDoubleClick:()=>x&&g(e=>!e),children:[(0,r.jsxs)("div",{className:"flex items-center",children:[m&&(0,r.jsxs)("div",{className:"hidden md:flex items-center gap-2 mr-4 ml-2",children:[(0,r.jsx)(l.default,{text:"Close",position:"top",color:"#FF5F56",children:(0,r.jsx)("button",{onClick:t,"aria-label":"Close",title:"Close",className:"w-4 h-4 rounded-full bg-[#FF5F56] hover:brightness-90 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,r.jsx)("span",{className:"text-[9px] font-bold text-white opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:"✕"})})}),(0,r.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"}),x?(0,r.jsx)(l.default,{text:h?"Restore":"Maximize",position:"top",color:"#28C840",children:(0,r.jsx)("button",{type:"button",onClick:()=>g(e=>!e),"aria-label":h?"Restore":"Maximize",title:h?"Restore":"Maximize (Full screen)",className:"w-4 h-4 rounded-full bg-[#28C840] border border-[#1AAB29] hover:brightness-90 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,r.jsx)("span",{className:"text-[10px] font-bold text-[#004d11] opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:h?"⤡":"⤢"})})}):(0,r.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"})]}),a&&(0,r.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:a})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[x&&(0,r.jsx)("button",{type:"button",onClick:()=>g(e=>!e),"aria-label":h?"Restore":"Full Screen",title:h?"Restore":"Full Screen",className:"hidden md:flex p-1.5 rounded-[10px] text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors cursor-pointer",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:h?"close_fullscreen":"open_in_full"})}),(0,r.jsx)("button",{onClick:t,"aria-label":"Close",className:"md:hidden p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]})]}),(0,r.jsx)("div",{className:(0,s.cn)("p-6 overflow-y-auto custom-scrollbar",h?"flex-1 min-h-0":"max-h-[calc(85vh-100px)]"),children:i}),d&&(0,r.jsx)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-border-subtle",children:d})]})]}):null}function d({isOpen:e,onClose:t,onConfirm:a,title:n="Confirm",message:s,confirmText:l="Confirm",cancelText:c="Cancel",variant:u="danger",loading:m=!1}){return(0,r.jsx)(o,{isOpen:e,onClose:t,title:n,size:"sm",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.default,{variant:"ghost",onClick:t,disabled:m,children:c}),(0,r.jsx)(i.default,{variant:u,onClick:a,loading:m,children:l})]}),children:(0,r.jsx)("p",{className:"text-text-muted",children:s})})}},84130:(e,t,a)=>{a.d(t,{default:()=>N});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(98500),o=a.n(l),d=a(73321),c=a(31474),u=a(90620),m=a(88105),x=a(11059),p=a(72767),h=a(92542),g=a(40197),f=a(73147);function b({currentVersion:e,latestVersion:t,installCmd:a,onClose:s}){let[i,l]=(0,n.useState)("auto"),[o,d]=(0,n.useState)("idle"),[c,m]=(0,n.useState)(null),[x,p]=(0,n.useState)(null),[v,j]=(0,n.useState)(!1),[y,k]=(0,n.useState)(0),[w,N]=(0,n.useState)(!1),[C,S]=(0,n.useState)({bullets:[],truncated:!1,loading:!0,error:null,versions:[]}),[O,F]=(0,n.useState)(!1),W=(0,n.useRef)(null),I=(0,n.useRef)(null),P=(0,n.useRef)(!1),T=(0,n.useCallback)(()=>{W.current&&(clearInterval(W.current),W.current=null),I.current&&(clearInterval(I.current),I.current=null)},[]);(0,n.useEffect)(()=>()=>{P.current=!0,T()},[T]),(0,n.useEffect)(()=>{let a=!1;return S(e=>({...e,loading:!0,error:null})),fetch(u.Nu.changelogUrl,{cache:"no-store"}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.text()}).then(r=>{if(a)return;let n=(0,f.zV)(r,e,t);if(0===n.length&&t&&(n=(0,f.zV)(r,null,t)),0===n.length&&e&&(n=(0,f.zV)(r,e,null).slice(0,2)),0===n.length){let e=(0,f.MY)(r);e.length>0&&(n=[e[0]])}let{bullets:s,truncated:i,versions:l}=(0,f.eK)(n,{maxBullets:10});S({bullets:s,truncated:i,loading:!1,error:null,versions:l})}).catch(e=>{a||S({bullets:[],truncated:!1,loading:!1,error:e.message||"Failed to load release notes",versions:[]})}),()=>{a=!0}},[e,t]);let E=(0,n.useCallback)(()=>{(0,f.TJ)(e)},[e]),$=(0,n.useCallback)(()=>{T();let e=function(e=u.h0.statusPort){return`http://127.0.0.1:${e}/update/status`}(),t=async()=>{if(!P.current)try{let t=await fetch(e,{cache:"no-store"});if(!t.ok)return;let a=await t.json();if(P.current)return;(m(a),d("running"),a&&a.done&&a.success)?(d("success"),I.current||(I.current=setInterval(()=>{globalThis.location.reload()},2e3),setTimeout(()=>{try{globalThis.location.reload()}catch{}},2500)),W.current&&(clearInterval(W.current),W.current=null)):a&&("error"===a.phase||a.done&&!a.success)&&(d("failed"),p(a.error||"Install failed"),l("manual"),W.current&&(clearInterval(W.current),W.current=null))}catch{}};t(),W.current=setInterval(t,u.h0.statusPollIntervalMs)},[T]),_=(0,n.useCallback)(async()=>{p(null),m(null),d("starting"),P.current=!1,E();try{let e=await fetch("/api/version/update",{method:"POST"}),t=await e.json().catch(()=>({}));if(!e.ok){p(t.message||`Auto-update unavailable (${e.status})`),d("failed"),l("manual");return}d("running"),$()}catch(e){d("running"),$(),e?.message&&p(null)}},[$,E]),z=async()=>{E();try{await navigator.clipboard.writeText(a)}catch{}j(!0);let e=u.h0.shutdownCountdownSec;k(e);let t=setInterval(()=>{k(e-=1),e<=0&&(clearInterval(t),fetch("/api/version/shutdown",{method:"POST"}).catch(()=>{}),N(!0))},1e3)},A=function(e){if(!e||"object"!=typeof e)return 5;let{phase:t,attempt:a=0,maxRetries:r=u.h0.installRetries,done:n,success:s}=e;if(n&&s)return 100;if("error"===t||n&&!s)return 90;switch(t){case"starting":return 8;case"waitingForExit":return 22;case"installing":{let e=Math.max(1,r);return Math.round(35+Math.min(a,e)/e*50)}case"done":return 100;default:return 5}}(c||{phase:"starting"===o?"starting":null}),R="starting"===o?"Contacting updater…":"success"===o?"Update complete — reloading when app is ready…":function(e,t={}){let a=t.attempt||0,r=t.maxRetries||u.h0.installRetries;switch(e){case"starting":return"Starting updater…";case"waitingForExit":return"Stopping current app (releasing file locks)…";case"installing":return a>0?`Installing package (attempt ${a}/${r})…`:"Installing package…";case"done":return"Update complete — restarting app…";case"error":return"Update failed";default:return e?String(e):"Preparing…"}}(c?.phase,{attempt:c?.attempt,maxRetries:c?.maxRetries}),D=Array.isArray(c?.logTail)?c.logTail:[],U="starting"===o||"running"===o||"success"===o,L=`Update EzRouter${t?` to v${t}`:""}`,q=(0,r.jsxs)("div",{className:"mb-4 rounded-lg border border-white/10 bg-white/5 p-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-2",children:[(0,r.jsxs)("p",{className:"text-xs font-semibold text-white/90",children:["What's new",t?(0,r.jsxs)("span",{className:"font-normal text-white/50",children:[" ",e?`v${e} → `:"","v",t]}):null]}),(0,r.jsx)("button",{type:"button",onClick:()=>F(!0),className:"text-[10px] text-white/50 hover:text-white/80 transition-colors shrink-0",children:"Full changelog"})]}),C.loading&&(0,r.jsxs)("p",{className:"text-[11px] text-white/50 flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] animate-spin",children:"progress_activity"}),"Loading release notes…"]}),!C.loading&&C.error&&(0,r.jsxs)("p",{className:"text-[11px] text-white/50",children:["Couldn't load release notes (",C.error,"). You can still update."]}),!C.loading&&!C.error&&0===C.bullets.length&&(0,r.jsx)("p",{className:"text-[11px] text-white/50",children:"No release notes found for this range yet. Check the full changelog after updating."}),!C.loading&&C.bullets.length>0&&(0,r.jsxs)("ul",{className:"max-h-40 overflow-y-auto space-y-1 text-[11px] text-white/75 list-disc list-inside",children:[C.bullets.map((e,t)=>(0,r.jsxs)("li",{className:"leading-snug",title:e.text,children:[(0,r.jsxs)("span",{className:"text-white/40 mr-1",children:["v",e.version]}),e.text]},`${e.version}-${t}`)),C.truncated&&(0,r.jsx)("li",{className:"list-none text-white/40 pl-0",children:"…more in full changelog"})]})]});if("auto"===i)return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"w-full max-w-xl rounded-xl bg-neutral-900/95 border border-white/10 p-6 text-white",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-11 rounded-full bg-green-500/20 text-green-400",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[24px]",children:"success"===o?"check_circle":"system_update"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:L}),(0,r.jsx)("p",{className:"text-xs text-white/60",children:"One-click install. The app will stop, update, and restart automatically."})]})]}),"idle"===o&&(0,r.jsxs)(r.Fragment,{children:[q,(0,r.jsxs)("ul",{className:"text-xs text-white/70 space-y-1.5 list-disc list-inside mb-4",children:[(0,r.jsxs)("li",{children:["Works with the production ",(0,r.jsx)("code",{className:"px-1 rounded bg-white/10",children:"ezrouter"})," CLI install"]}),(0,r.jsx)("li",{children:"Takes about 1–2 minutes (npm global install + restart)"}),(0,r.jsx)("li",{children:"You can switch to manual install if auto fails"})]}),(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,r.jsx)(h.default,{variant:"secondary",onClick:s,className:"sm:w-auto",children:"Cancel"}),(0,r.jsx)(h.default,{variant:"primary",fullWidth:!0,onClick:_,children:"Update & Restart"})]}),(0,r.jsx)("button",{type:"button",onClick:()=>l("manual"),className:"mt-3 w-full text-center text-[11px] text-white/50 hover:text-white/80 transition-colors",children:"Prefer manual install instead?"})]}),U&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"mb-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs mb-1.5",children:[(0,r.jsx)("span",{className:"text-white/80",children:R}),(0,r.jsxs)("span",{className:"text-white/50 tabular-nums",children:[A,"%"]})]}),(0,r.jsx)("div",{className:"h-1.5 rounded-full bg-white/10 overflow-hidden",children:(0,r.jsx)("div",{className:"h-full bg-green-500 transition-all duration-500",style:{width:`${Math.min(100,A)}%`}})})]}),D.length>0&&(0,r.jsx)("div",{className:"mb-3 max-h-32 overflow-y-auto rounded bg-black/40 px-2 py-1.5 font-mono text-[10px] text-white/60 space-y-0.5",children:D.map((e,t)=>(0,r.jsx)("div",{className:"truncate",children:e},`${t}-${e.slice(0,24)}`))}),"success"===o?(0,r.jsx)("p",{className:"text-xs text-green-400/90 mb-3",children:"Install succeeded. Waiting for the app to come back, then reloading…"}):(0,r.jsx)("p",{className:"text-xs text-white/50 mb-3",children:"Keep this tab open. Do not close the browser until the update finishes."}),"success"!==o&&(0,r.jsx)("button",{type:"button",onClick:()=>{T(),l("manual"),d("failed")},className:"w-full text-center text-[11px] text-white/50 hover:text-white/80 transition-colors",children:"Stuck? Switch to manual install"})]}),"failed"===o&&"auto"===i&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mb-3 rounded border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-300",children:x||"Auto-update failed."}),(0,r.jsx)(h.default,{variant:"primary",fullWidth:!0,onClick:()=>l("manual"),children:"Open manual install"})]})]}),(0,r.jsx)(g.default,{isOpen:O,onClose:()=>F(!1)})]});let M=y>0;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"w-full max-w-xl rounded-xl bg-neutral-900/95 border border-white/10 p-6 text-white",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-11 rounded-full bg-amber-500/20 text-amber-400",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[24px]",children:"content_copy"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:L}),(0,r.jsx)("p",{className:"text-xs text-white/60",children:w?"Server stopped. Paste the command into a terminal to install.":M?`Command copied. Server will stop in ${y}s...`:x?"Auto-update unavailable — install manually.":"Copy the install command, stop the server, then re-run ezrouter."})]})]}),!w&&!M&&q,x&&(0,r.jsx)("div",{className:"mb-3 rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-200",children:x}),(0,r.jsx)("p",{className:"text-sm text-white/80 mb-2",children:"Install command:"}),(0,r.jsx)("div",{className:"w-full px-3 py-2 rounded bg-white/5 mb-4",children:(0,r.jsx)("code",{className:"text-xs font-mono text-amber-400 break-all",children:a})}),(0,r.jsxs)("ol",{className:"text-xs text-white/70 space-y-1 list-decimal list-inside mb-4",children:[(0,r.jsxs)("li",{children:["Click ",(0,r.jsx)("strong",{children:"Copy & Shutdown"})," below."]}),(0,r.jsx)("li",{children:"Paste the command into your terminal and press Enter."}),(0,r.jsxs)("li",{children:["Run ",(0,r.jsx)("code",{className:"px-1 rounded bg-white/10 text-green-400",children:"ezrouter"})," again after install."]})]}),w?(0,r.jsx)(h.default,{variant:"secondary",fullWidth:!0,onClick:()=>globalThis.location.reload(),children:"Reload Page"}):(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,r.jsx)(h.default,{variant:"secondary",onClick:()=>{U||s()},disabled:M,className:"sm:w-auto",children:"Cancel"}),(0,r.jsx)(h.default,{variant:"primary",fullWidth:!0,onClick:z,disabled:M,children:v?"✓ Copied — shutting down...":M?`Shutting down in ${y}s`:"Copy & Shutdown"})]}),!w&&!M&&(0,r.jsx)("button",{type:"button",onClick:()=>{l("auto"),d("idle"),p(null),m(null)},className:"mt-3 w-full text-center text-[11px] text-white/50 hover:text-white/80 transition-colors",children:"Try automatic update instead"})]}),(0,r.jsx)(g.default,{isOpen:O,onClose:()=>F(!1)})]})}b.propTypes={currentVersion:i().string,latestVersion:i().string,installCmd:i().string.isRequired,onClose:i().func.isRequired};let v=["embedding","image","video","tts","stt","systemone"],j="/dashboard/media-providers/web",y=[{href:"/dashboard/endpoint",label:"Endpoint & Key",icon:"api"},{href:"/dashboard/providers",label:"Providers",icon:"dns"},{href:"/dashboard/combos",label:"Combo & Vision Adapter",icon:"layers"},{href:"/dashboard/usage",label:"Usage",icon:"bar_chart"},{href:"/dashboard/quota",label:"Quota Tracker",icon:"data_usage"},{href:"/dashboard/routing-health",label:"Routing Health",icon:"speed"},{href:"/dashboard/token-saver",label:"Token Saver",icon:"savings"},{href:"/dashboard/convoy",label:"Input Guard",icon:"filter_alt"},{href:"/dashboard/cli-tools",label:"CLI Tools",icon:"terminal"},{href:"/dashboard/mcp-gateway",label:"MCP Gateway",icon:"hub"}],k=[{href:"/dashboard/console-log",label:"Console Log",icon:"terminal"},{href:"/dashboard/error-log",label:"Error Log",icon:"error"},{href:"/dashboard/translator",label:"Translator",icon:"translate"}],w=[{href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"lan"},{href:"/dashboard/skills",label:"Skills",icon:"extension"}];function N({onClose:e}){let t=(0,d.usePathname)(),[a,s]=(0,n.useState)(!1),[i,l]=(0,n.useState)(null),[h,g]=(0,n.useState)(!1),[f,C]=(0,n.useState)(!1),{copied:S,copy:O}=(0,x.C)(2e3),F=u.h0.installCmdLatest;(0,n.useEffect)(()=>{p.A.getState().fetchSettings().then(e=>{e?.enableTranslator&&C(!0)})},[]),(0,n.useEffect)(()=>{let e=setTimeout(()=>{fetch("/api/version").then(e=>e.json()).then(e=>{e.hasUpdate&&l(e)}).catch(()=>{})},2500);return()=>clearTimeout(e)},[]);let W=e=>"/dashboard/endpoint"===e?"/dashboard"===t||t.startsWith("/dashboard/endpoint"):t.startsWith(e);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("aside",{className:"flex w-72 flex-col border-r border-border-subtle bg-vibrancy backdrop-blur-xl transition-colors duration-300 min-h-full",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-6 pt-5 pb-2",children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FF5F56]"}),(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]"}),(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]"})]}),(0,r.jsxs)("div",{className:"px-6 py-4 flex flex-col gap-2",children:[(0,r.jsxs)(o(),{href:"/dashboard",className:"flex items-center gap-3",children:[(0,r.jsx)("img",{src:"/logo.png",alt:"EzRouter",className:"size-9 rounded-[10px] object-contain shadow-[var(--shadow-warm)]",onError:e=>{e.currentTarget.onerror=null,e.currentTarget.src="/favicon.svg"}}),(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("h1",{className:"text-lg font-semibold tracking-tight text-text-main",children:u.vQ.name}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:["v",u.vQ.version]})]})]}),i&&(0,r.jsxs)("div",{className:"flex flex-col gap-1.5 rounded p-1 -m-1",children:[(0,r.jsxs)("span",{className:"text-xs font-semibold text-green-600 dark:text-amber-500",children:["↑ New version available: v",i.latestVersion]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{onClick:()=>g(!0),className:"px-2 py-1 rounded bg-green-600 hover:bg-green-700 dark:bg-amber-500 dark:hover:bg-amber-600 text-white text-[11px] font-semibold transition-colors cursor-pointer",children:"Update now"}),(0,r.jsx)("button",{onClick:()=>O(F),title:"Copy install command",className:"flex-1 text-left hover:opacity-80 transition-opacity cursor-pointer min-w-0",children:(0,r.jsx)("code",{className:"block text-[10px] text-green-600/80 dark:text-amber-400/70 font-mono truncate",children:S?"✓ copied!":F})})]})]})]}),(0,r.jsxs)("nav",{className:"flex-1 px-4 py-2 space-y-0.5 overflow-y-auto custom-scrollbar",children:[y.map(t=>(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",W(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",W(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href)),(0,r.jsxs)("div",{className:"pt-3 mt-2 space-y-0.5",children:[(0,r.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"System"}),(0,r.jsxs)("button",{onClick:()=>s(e=>!e),className:(0,c.cn)("w-full flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",t.startsWith("/dashboard/media-providers")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"perm_media"}),(0,r.jsx)("span",{className:"text-[13px] font-medium flex-1 text-left",children:"Media Providers"}),(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] transition-transform",style:{transform:a?"rotate(180deg)":"rotate(0deg)"},children:"expand_more"})]}),a&&(0,r.jsxs)("div",{className:"pl-4",children:[m.rj.filter(e=>v.includes(e.id)).map(a=>(0,r.jsxs)(o(),{href:`/dashboard/media-providers/${a.id}`,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-1 rounded-lg transition-all group",t.startsWith(`/dashboard/media-providers/${a.id}`)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:a.icon}),(0,r.jsx)("span",{className:"text-sm",children:a.label})]},a.id)),(0,r.jsxs)(o(),{href:j,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-1 rounded-lg transition-all group",t.startsWith(j)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"travel_explore"}),(0,r.jsx)("span",{className:"text-sm",children:"Web Fetch & Search"})]},"web")]}),w.map(t=>(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",W(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",W(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href)),k.map(t=>"/dashboard/translator"!==t.href||f?(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",W(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",W(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href):null),(0,r.jsxs)(o(),{href:"/dashboard/profile",onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",W("/dashboard/profile")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",W("/dashboard/profile")?"fill-1":"group-hover:text-primary transition-colors"),children:"settings"}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:"Settings"})]})]})]})]}),h&&(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm p-6",children:(0,r.jsx)(b,{currentVersion:i?.currentVersion||u.vQ.version,latestVersion:i?.latestVersion,installCmd:F,onClose:()=>g(!1)})})]})}N.propTypes={onClose:i().func}},85416:(e,t,a)=>{a.d(t,{default:()=>c});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497);let o="auto",d=[{value:o,label:"Auto-detect (recommended)"},{value:"us-east-1",label:"US East (N. Virginia)"},{value:"eu-central-1",label:"Europe (Frankfurt)"}];function c({isOpen:e,onMethodSelect:t,onClose:a}){let[s,i]=(0,n.useState)(null),[u,m]=(0,n.useState)(""),[x,p]=(0,n.useState)("us-east-1"),[h,g]=(0,n.useState)(""),[f,b]=(0,n.useState)(""),[v,j]=(0,n.useState)(""),[y,k]=(0,n.useState)(o),[w,N]=(0,n.useState)(null),[C,S]=(0,n.useState)(!1),[O,F]=(0,n.useState)(!1),[W,I]=(0,n.useState)(!1),[P,T]=(0,n.useState)(null);(0,n.useEffect)(()=>{"import"===s&&e&&(async()=>{F(!0),N(null),I(!1),T(null);try{let e=await fetch("/api/oauth/kiro/auto-import"),t=await e.json();t.found?(g(t.refreshToken),I(!0),t.clientId&&t.clientSecret&&T({clientId:t.clientId,clientSecret:t.clientSecret,region:t.region,authMethod:t.authMethod,profileArn:t.profileArn})):N(t.error||"Could not auto-detect token")}catch(e){N("Failed to auto-detect token")}finally{F(!1)}})()},[s,e]);let E=e=>{i(e),N(null)},$=()=>{i(null),N(null)},_=()=>{i(null),m(""),g(""),b(""),j(""),T(null),I(!1),N(null)},z=async()=>{if(!h.trim())return void N("Please enter a refresh token");S(!0),N(null);try{let e=await fetch("/api/oauth/kiro/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:h.trim(),...P||{}})}),a=await e.json();if(!e.ok)throw Error(a.error||"Import failed");_(),t("import")}catch(e){N(e.message)}finally{S(!1)}},A=async()=>{if(!f.trim())return void N("Please paste CLIProxyAPI auth JSON");S(!0),N(null);try{let e=await fetch("/api/oauth/kiro/import-cli-proxy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({json:f.trim()})}),a=await e.json();if(!e.ok)throw Error(a.error||"CLIProxyAPI import failed");_(),t("import-cli-proxy")}catch(e){N(e.message)}finally{S(!1)}},R=async()=>{if(!v.trim())return void N("Please enter an API key");S(!0),N(null);try{let e=await fetch("/api/oauth/kiro/api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:v.trim(),region:y})}),a=await e.json();if(!e.ok)throw Error(a.error||"Import failed");_(),t("api-key")}catch(e){N(e.message)}finally{S(!1)}},D=e=>{t("social",{provider:e})};return(0,r.jsx)(l.aF,{isOpen:e,title:"Connect Kiro",onClose:()=>{_(),a()},size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[!s&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Choose your authentication method:"}),(0,r.jsx)("button",{onClick:()=>t("builder-id"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"shield"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"AWS Builder ID"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Recommended for most users. Free AWS account required."})]})]})}),(0,r.jsx)("button",{onClick:()=>E("idc"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"business"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"AWS IAM Identity Center"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"For enterprise users with custom AWS IAM Identity Center."})]})]})}),(0,r.jsx)("button",{onClick:()=>E("api-key"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"key"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"API Key"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Use a long-lived Kiro/CodeWhisperer API key (headless auth)."})]})]})}),(0,r.jsx)("button",{onClick:()=>E("social-google"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"account_circle"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"Google Account"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your Google account (manual callback)."})]})]})}),(0,r.jsx)("button",{onClick:()=>E("social-github"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"code"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"GitHub Account"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your GitHub account (manual callback)."})]})]})}),(0,r.jsx)("button",{onClick:()=>E("import"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"file_upload"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"Import Token"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Paste refresh token from Kiro IDE."})]})]})}),(0,r.jsx)("button",{onClick:()=>E("import-cli-proxy"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"data_object"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"Import CLIProxyAPI JSON"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Paste external_idp auth JSON from CLIProxyAPI/Kiro Microsoft login."})]})]})})]}),"idc"===s&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["IDC Start URL ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(l.pd,{value:u,onChange:e=>m(e.target.value),placeholder:"https://your-org.awsapps.com/start",className:"font-mono text-sm"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Your organization's AWS IAM Identity Center URL"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium mb-2",children:"AWS Region"}),(0,r.jsx)(l.pd,{value:x,onChange:e=>p(e.target.value),placeholder:"us-east-1",className:"font-mono text-sm"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"AWS region for your Identity Center (default: us-east-1)"})]}),w&&(0,r.jsx)("p",{className:"text-sm text-red-600",children:w}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:()=>{u.trim()?t("idc",{startUrl:u.trim(),region:x}):N("Please enter your IDC start URL")},fullWidth:!0,children:"Continue"}),(0,r.jsx)(l.$n,{onClick:$,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"api-key"===s&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Paste a long-lived Kiro/CodeWhisperer API key. It is validated against AWS and stored directly as a bearer credential (no refresh)."})]})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["API Key ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(l.pd,{value:v,onChange:e=>j(e.target.value),placeholder:"Paste your Kiro API key...",className:"font-mono text-sm"})]}),(0,r.jsx)(l.l6,{label:"AWS Region",value:y,onChange:e=>k(e.target.value),options:d}),w&&(0,r.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,r.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:w})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:R,fullWidth:!0,disabled:C||!v.trim(),children:C?"Validating...":"Add API Key"}),(0,r.jsx)(l.$n,{onClick:$,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-google"===s&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,r.jsxs)("div",{className:"flex-1 text-sm",children:[(0,r.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,r.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:()=>D("google"),fullWidth:!0,children:"Continue with Google"}),(0,r.jsx)(l.$n,{onClick:$,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-github"===s&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,r.jsxs)("div",{className:"flex-1 text-sm",children:[(0,r.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,r.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:()=>D("github"),fullWidth:!0,children:"Continue with GitHub"}),(0,r.jsx)(l.$n,{onClick:$,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"import"===s&&(0,r.jsxs)("div",{className:"space-y-4",children:[O&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting token..."}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from AWS SSO cache"})]}),!O&&(0,r.jsxs)(r.Fragment,{children:[W&&(0,r.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,r.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Token auto-detected from Kiro IDE successfully!"})]})}),!W&&!w&&(0,r.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Kiro IDE not detected. Please paste your refresh token manually."})]})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Refresh Token ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(l.pd,{value:h,onChange:e=>g(e.target.value),placeholder:"Token will be auto-filled...",className:"font-mono text-sm"})]}),w&&(0,r.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,r.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:w})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:z,fullWidth:!0,disabled:C||!h.trim(),children:C?"Importing...":"Import Token"}),(0,r.jsx)(l.$n,{onClick:$,variant:"ghost",fullWidth:!0,children:"Back"})]})]})]}),"import-cli-proxy"===s&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Paste the Kiro CLIProxyAPI auth JSON containing auth_method=external_idp. Only Microsoft login token endpoints are accepted."})]})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["CLIProxyAPI Auth JSON ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)("textarea",{value:f,onChange:e=>b(e.target.value),placeholder:'{"auth_method":"external_idp","access_token":"...","refresh_token":"...","client_id":"...","token_endpoint":"https://login.microsoftonline.com/.../oauth2/v2.0/token","profile_arn":"...","scopes":"..."}',className:"min-h-40 w-full rounded-md border border-border bg-background p-3 font-mono text-sm outline-none focus:border-primary"})]}),w&&(0,r.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,r.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:w})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:A,fullWidth:!0,disabled:C||!f.trim(),children:C?"Importing...":"Import CLIProxyAPI JSON"}),(0,r.jsx)(l.$n,{onClick:$,variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})})}c.propTypes={isOpen:i().bool.isRequired,onMethodSelect:i().func.isRequired,onClose:i().func.isRequired}},90882:(e,t,a)=>{a.d(t,{default:()=>u});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497),o=a(11059);let d=new Set(["trae","windsurf","zed"]),c={trae:{label:"Cloud-IDE-JWT",instructions:"Sign in at trae.ai (or solo.trae.ai), open DevTools → Network, copy the Cloud-IDE-JWT token from any request's Authorization header (~14-day lifetime).",placeholder:"Paste Cloud-IDE-JWT here...",ideName:"Trae",ideOptional:!0},windsurf:{label:"Windsurf API key",instructions:'In the Windsurf/VS Code IDE, run the "Windsurf: Provide Auth Token" command, then copy the displayed sk-ws-... key.',placeholder:"Paste sk-ws-... key here...",ideName:"Windsurf",ideOptional:!1}};function u({isOpen:e,provider:t,providerInfo:a,onSuccess:s,onClose:i,oauthMeta:m,idcConfig:x}){let[p,h]=(0,n.useState)("waiting"),[g,f]=(0,n.useState)(null),[b,v]=(0,n.useState)(""),[j,y]=(0,n.useState)(null),[k,w]=(0,n.useState)(!1),[N,C]=(0,n.useState)(null),[S,O]=(0,n.useState)(!1),[F,W]=(0,n.useState)("browser"),[I,P]=(0,n.useState)(""),[T,E]=(0,n.useState)(null),[$,_]=(0,n.useState)(!1),z=(0,n.useRef)(null),A=(0,n.useRef)(!1),R=(0,n.useRef)(!1),D=(0,n.useRef)({proxyStarted:!1,proxyProvider:null,stopSent:!1}),U=(0,n.useRef)(s),L=(0,n.useRef)(i),q=(0,n.useRef)(e),M=(0,n.useRef)(null),{copied:V,copy:K}=(0,o.C)(),[J,B]=(0,n.useState)(!1),[G,Q]=(0,n.useState)("/callback?code=..."),H=(0,n.useRef)(!1);(0,n.useEffect)(()=>{B("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname),Q(`${window.location.origin}/callback?code=...`)},[]);let Y=(0,n.useCallback)(async(e,a)=>{try{_(!0),y(null);let r=g?.redirectUri||`${window.location.origin}/callback`,n=g?.codeVerifier||null,s=a||g?.state||null,i=await fetch(`/api/oauth/${t}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,redirectUri:r,codeVerifier:n,state:s,...g?.systemId?{systemId:g.systemId}:{},...m?{meta:m}:{}})}),l=await i.json();if(!i.ok||l?.success===!1)throw Error(l.error||"Token exchange failed");h("success"),U.current?.()}catch(e){y(e.message),h("error")}finally{_(!1)}},[g,t,m]),Z=(0,n.useCallback)(async e=>{if(g?.state)try{let t=await fetch("/api/oauth/xai/manual-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,state:g.state})}),a=await t.json();if(!t.ok)throw Error(a.error);h("success"),U.current?.()}catch(e){y(e.message),h("error")}},[g]),X=(0,n.useCallback)(async(e,a,r,n,s)=>{A.current=!1,O(!0);let i=Date.now()+(Number.isFinite(s)&&s>0?s:12e4);for(;Date.now()<i;){if(A.current){console.log("[OAuthModal] Polling aborted"),O(!1);return}if(await new Promise(e=>setTimeout(e,1e3*r)),A.current){console.log("[OAuthModal] Polling aborted after sleep"),O(!1);return}try{let s=await fetch(`/api/oauth/${t}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:e,codeVerifier:a,extraData:n,..."cursor"===t?{state:e}:{}})}),i=await s.json();if(i.success){A.current=!0,h("success"),O(!1),U.current?.();return}if("expired_token"===i.error||"access_denied"===i.error||i.fatal)throw Error(i.errorDescription||i.error);"slow_down"===i.error&&(r=Math.min(r+5,30))}catch(e){y(e.message),h("error"),O(!1);return}}y("Authorization timeout"),h("error"),O(!1)},[t]),ee=(0,n.useCallback)(()=>{let e=D.current;e.proxyStarted&&!e.stopSent&&e.proxyProvider&&(e.stopSent=!0,fetch(`/api/oauth/${e.proxyProvider}/stop-proxy`).catch(()=>{}))},[]),et=(0,n.useCallback)(async e=>{let t=await fetch(`/api/oauth/${e}/start-proxy`),a=await t.json();if(!t.ok||!a.success||!a.callbackUrl)throw Error(a.reason||a.error||`Failed to start ${e} callback server`);if(D.current.proxyStarted=!0,D.current.proxyProvider=e,D.current.stopSent=!1,!q.current)return void ee();let r=new URL(`/api/oauth/${e}/authorize`,window.location.origin);r.searchParams.set("redirect_uri",a.callbackUrl);let n=await fetch(r),s=await n.json();if(!n.ok)throw ee(),Error(s.error);if(!q.current)return void ee();let i={state:s.state};s.codeVerifier&&(i.codeVerifier=s.codeVerifier),s.systemId&&(i.systemId=s.systemId);let l=await fetch(`/api/oauth/${e}/register-session`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}),o=null;try{o=await l.json()}catch{o=null}if(!l.ok||o?.success===!1)throw ee(),Error(o?.error||"Failed to register login session; please retry");q.current&&(f({...s,proxyProvider:e}),h("waiting"),z.current=window.open(s.authUrl,"oauth_popup","width=600,height=700"),z.current||h("input"))},[ee]),ea=async()=>{if(t)try{let e;if(y(null),"cursor"===t){w(!0),h("waiting");let e=await fetch(`/api/oauth/cursor/authorize?redirect_uri=${encodeURIComponent(window.location.origin+"/callback")}`),t=await e.json();if(!e.ok)throw Error(t.error);f(t),C({verification_uri:t.authUrl,user_code:""}),t.authUrl&&window.open(t.authUrl,"_blank","noopener,noreferrer"),X(t.state,null,2,null,1e3*(t.expiresIn||300));return}if("zed"===t&&"browser"===F&&"localhost"!==window.location.hostname&&"127.0.0.1"!==window.location.hostname){let e=await fetch("/api/oauth/zed/authorize"),t=await e.json();if(!e.ok)throw Error(t.error||"Failed to start Zed sign-in");if(!t.authUrl)throw Error("No authorization URL returned from OAuth provider");if(!q.current)return;f(t),h("input"),window.open(t.authUrl,"_blank","noopener,noreferrer");return}if(d.has(t)&&"browser"===F)return void await et(t);if(["github","qwen","kiro","kimi","kimi-coding","kilocode","codebuddy-cn","qoder","qoder-cn","grok-cli","frontier-for-all","muse","glm"].includes(t)){w(!0),h("waiting");let e=new URL(`/api/oauth/${t}/device-code`,window.location.origin);"kiro"===t&&x?.startUrl&&(e.searchParams.set("start_url",x.startUrl),x.region&&e.searchParams.set("region",x.region),e.searchParams.set("auth_method","idc"));let a=await fetch(e.toString()),r=await a.json();if(!a.ok)throw Error(r.error);C(r);let n=r.verification_uri_complete||r.verification_uri;n&&window.open(n,"_blank","noopener,noreferrer");let s="kiro"===t?{_clientId:r._clientId,_clientSecret:r._clientSecret,_region:r._region,_authMethod:r._authMethod,_startUrl:r._startUrl}:"qoder"===t||"qoder-cn"===t?{_qoderNonce:r._qoderNonce,_qoderMachineId:r._qoderMachineId,_qoderVerifier:r.codeVerifier}:"kimi"===t||"kimi-coding"===t?{_kimiDeviceId:r._kimiDeviceId}:"glm"===t?{_zcodePollToken:r._zcodePollToken}:null;X(r.device_code,r.codeVerifier,r.interval||5,s,Number.isFinite(r.expires_in)&&r.expires_in>0?1e3*r.expires_in:void 0);return}let a=window.location.port||("https:"===window.location.protocol?"443":"80");e="codex"===t?"http://localhost:1455/auth/callback":"xai"===t?"http://127.0.0.1:56121/callback":`${window.location.origin}/callback`;let r=new URL(`/api/oauth/${t}/authorize`,window.location.origin);r.searchParams.set("redirect_uri",e),m&&Object.entries(m).forEach(([e,t])=>{t&&r.searchParams.set(e,t)});let n=await fetch(r.toString()),s=await n.json();if(!n.ok)throw Error(s.error);let i=!1,l=!1;if("codex"===t)try{let t=new URL("/api/oauth/codex/start-proxy",window.location.origin);t.searchParams.set("app_port",a),t.searchParams.set("state",s.state),t.searchParams.set("code_verifier",s.codeVerifier),t.searchParams.set("redirect_uri",e);let r=await fetch(t.toString()),n=await r.json();i=n.success,l=!!n.serverSide}catch{i=!1}let o=!1,c=!1;if("xai"===t)try{let t=new URL("/api/oauth/xai/start-proxy",window.location.origin);t.searchParams.set("app_port",a),t.searchParams.set("state",s.state),t.searchParams.set("code_verifier",s.codeVerifier),t.searchParams.set("redirect_uri",e);let r=await fetch(t.toString()),n=await r.json();if(o=n.success,c=!!n.serverSide,!o&&"port_busy"===n.reason)throw Error("Port 56121 in use; close the conflicting process and retry")}catch(e){if(e?.message)throw e;o=!1}if(f({...s,redirectUri:e,codexServerSide:l,xaiServerSide:c}),("codex"===t&&i||"xai"===t&&o)&&(D.current.proxyStarted=!0,D.current.proxyProvider=t,D.current.stopSent=!1),!s.authUrl){if("device_code"===s.flowType)throw Error(`Provider ${t} uses device-code login but is not wired in the OAuth modal device-code list`);throw Error("No authorization URL returned from OAuth provider")}"codex"===t&&i||"xai"===t&&o||J&&"codex"!==t&&"xai"!==t?(h("waiting"),z.current=window.open(s.authUrl,"oauth_popup","width=600,height=700"),z.current||h("input")):(h("input"),window.open(s.authUrl,"_blank"))}catch(e){y(e.message),h("error")}};(0,n.useEffect)(()=>{U.current=s,L.current=i,q.current=e,M.current=ea}),(0,n.useEffect)(()=>{e&&t&&(R.current||(R.current=!0,f(null),v(""),y(null),w(!1),C(null),O(!1),W("browser"),P(""),E(null),A.current=!1,D.current={proxyStarted:!1,proxyProvider:null,stopSent:!1},c[t]&&fetch(`/api/oauth/${t}/ide-status`).then(e=>e.json()).then(e=>E(e)).catch(()=>E({installed:!1,path:null})),M.current()))},[e,t]),(0,n.useEffect)(()=>{e||(A.current=!0,R.current=!1,ee(),D.current={proxyStarted:!1,proxyProvider:null,stopSent:!1})},[e,t,ee]),(0,n.useEffect)(()=>{if(!g?.state||!t)return;let e=!1,a=0,r=async()=>{if(!e){a+=1;try{let a=await fetch(`/api/oauth/${t}/poll-status?state=${encodeURIComponent(g.state)}`),r=await a.json();if(e)return;if("done"===r.status){H.current=!0,h("success"),U.current?.();return}if("error"===r.status){H.current=!0,y(r.error||"Authentication failed"),h("error");return}}catch{}if(a>=300){H.current=!0,y("Authentication timeout"),h("error");return}e||setTimeout(r,1e3)}},n=setTimeout(r,1e3);return()=>{e=!0,clearTimeout(n)}},[g,t]),(0,n.useEffect)(()=>{let e;if(!g)return;H.current=!1;let t=async e=>{let{code:t,token:a,state:r,error:n,errorDescription:s,fullUrl:i}=e;if(i?v(i):t&&v(`${window.location.origin}/callback?state=${encodeURIComponent(r||"")}&code=${encodeURIComponent(t)}`),!H.current){if(n){H.current=!0,y(s||n),h("error");return}(a||t)&&(H.current=!0,await Y(a||t,r))}},a=e=>{let a=e.origin.includes("localhost")||e.origin.includes("127.0.0.1"),r=e.origin===window.location.origin;(a||r)&&e.data?.type==="oauth_callback"&&t(e.data.data)};window.addEventListener("message",a);try{(e=new BroadcastChannel("oauth_callback")).onmessage=e=>t(e.data)}catch(e){console.log("BroadcastChannel not supported")}let r=e=>{if("oauth_callback"===e.key&&e.newValue)try{let a=JSON.parse(e.newValue);t(a),localStorage.removeItem("oauth_callback")}catch(e){console.log("Failed to parse localStorage data")}};window.addEventListener("storage",r);try{let e=localStorage.getItem("oauth_callback");if(e){let a=JSON.parse(e);a.timestamp&&Date.now()-a.timestamp<3e4&&t(a),localStorage.removeItem("oauth_callback")}}catch{}return()=>{window.removeEventListener("message",a),window.removeEventListener("storage",r),e&&e.close()}},[g,Y]);let er=async()=>{try{if(y(null),"paste-token"===F&&c[t]){let e=I.trim();if(!e)throw Error("Missing token");let a=await fetch(`/api/oauth/${t}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e})}),r=await a.json();if(!a.ok)throw Error(r.error);h("success"),U.current?.();return}let e=b.trim();if(!e)return;if(_(!0),d.has(t)&&e){let a=await fetch(`/api/oauth/${t}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,state:g?.state,...g?.redirectUri?{redirectUri:g.redirectUri}:{},...g?.codeVerifier?{codeVerifier:g.codeVerifier}:{},...g?.systemId?{systemId:g.systemId}:{}})}),r=await a.json();if(!a.ok)throw Error(r.error);h("success"),U.current?.();return}if(e.startsWith("eyJ")&&e.includes("."))return void await Y(e,null);if("xai"===t&&e&&!e.includes("://")&&!e.includes("?")&&!e.includes("code="))return void await Z(e);if("kimchi"===t&&e&&!e.includes("://")&&!e.includes("?"))return void await Y(e,null);let a=null,r=null,n=null,s=null;if(e.includes("://")||e.startsWith("/")||e.startsWith("?")){let t=e.startsWith("/")||e.startsWith("?")?`http://localhost${e.startsWith("?")?"":"/"}${e}`:e;try{let e=new URL(t);if(a=e.searchParams.get("code"),r=e.searchParams.get("token"),n=e.searchParams.get("state"),s=e.searchParams.get("error"))throw Error(e.searchParams.get("error_description")||s)}catch(t){if(s)throw t;a=e}}else a=e;if(!a&&!r)throw Error("xai"===t?"Paste the callback URL or copied xAI code":"kimchi"===t?"No Kimchi token found in URL":"No authorization code found in URL");await Y(r||a,n)}catch(e){y(e.message),h("error")}finally{_(!1)}},en=(0,n.useCallback)(()=>{ee(),"codex"===t?fetch("/api/oauth/codex/stop-proxy").catch(()=>{}):"xai"===t&&fetch("/api/oauth/xai/stop-proxy").catch(()=>{}),L.current?.()},[ee,t]);if(!t||!a)return null;let es="xai"===t,ei="kimchi"===t,el="zed"===t&&"browser"===F&&"localhost"!==window.location.hostname&&"127.0.0.1"!==window.location.hostname,eo=!!c[t],ed=N?.verification_uri_complete||N?.verification_uri||"",ec=es?"Connect Grok Build OAuth":`Connect ${a.name}`,eu=es?"http://127.0.0.1:56121/callback?code=... or copied code":ei?`${G.replace("code=...","token=...")} or copied token`:G;return(0,r.jsx)(l.aF,{isOpen:e,title:ec,onClose:en,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[d.has(t)&&("waiting"===p||"input"===p||"error"===p)&&(0,r.jsxs)(r.Fragment,{children:[eo&&(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{type:"button",onClick:()=>{W("browser"),y(null),h("waiting"),ea()},className:`flex-1 rounded-lg border px-3 py-2 text-sm transition-colors ${"browser"===F?"border-primary bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:"\uD83C\uDF10 Sign in with browser"}),(0,r.jsx)("button",{type:"button",onClick:()=>{W("paste-token"),y(null),h("input")},className:`flex-1 rounded-lg border px-3 py-2 text-sm transition-colors ${"paste-token"===F?"border-primary bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:"\uD83D\uDD11 Paste token"})]}),"browser"===F&&(0,r.jsxs)(r.Fragment,{children:["waiting"===p&&!el&&(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-primary animate-spin",children:"progress_activity"}),(0,r.jsx)("span",{className:"text-sm",children:"Waiting for browser authorization…"})]}),"input"===p&&el&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Sign in at Zed in your browser"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"A Zed sign-in tab was opened. Complete the sign-in there — Zed will land on a 127.0.0.1 address that only your own computer can see, which is expected."}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.pd,{value:g?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,r.jsx)(l.$n,{variant:"secondary",icon:"auth_url"===V?"check":"content_copy",onClick:()=>K(g?.authUrl,"auth_url"),disabled:!g?.authUrl,children:"Copy"}),(0,r.jsx)(l.$n,{variant:"secondary",icon:"open_in_new",onClick:()=>g?.authUrl&&window.open(g.authUrl,"_blank","noopener,noreferrer"),disabled:!g?.authUrl,children:"Open"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL from your browser here"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Copy the full 127.0.0.1 URL from your browser's address bar (it contains your user_id and an encrypted token, which is decrypted on the server)."}),(0,r.jsx)(l.pd,{value:b,onChange:e=>v(e.target.value),placeholder:"http://127.0.0.1:58443/?user_id=...&access_token=...",className:"font-mono text-xs"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:er,fullWidth:!0,disabled:!b,children:"Connect"}),(0,r.jsx)(l.$n,{onClick:en,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"input"===p&&!el&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Popup was blocked. After authorizing in the browser, paste the full callback URL here:"}),(0,r.jsx)(l.pd,{value:b,onChange:e=>v(e.target.value),placeholder:"http://127.0.0.1:.../callback?...",className:"font-mono text-xs"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:er,fullWidth:!0,disabled:!b,children:"Connect"}),(0,r.jsx)(l.$n,{onClick:en,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]}),"paste-token"===F&&eo&&(0,r.jsxs)("div",{className:"space-y-3",children:[T&&!T.installed&&(0,r.jsxs)("div",{className:`px-3 py-2 rounded-lg text-sm ${c[t].ideOptional?"bg-blue-500/10 text-blue-700 dark:text-blue-300":"bg-yellow-500/10 text-yellow-700 dark:text-yellow-300"}`,children:[c[t].ideName," IDE not detected.",c[t].ideOptional?" You can still grab the token from DevTools.":` Install ${c[t].ideName} IDE to get the token, or use "Sign in with browser".`]}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:c[t].instructions}),(0,r.jsx)(l.pd,{value:I,onChange:e=>P(e.target.value),placeholder:c[t].placeholder,className:"font-mono text-xs"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:er,fullWidth:!0,disabled:!I,children:"Connect"}),(0,r.jsx)(l.$n,{onClick:en,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]}),("waiting"===p||"input"===p)&&!k&&!d.has(t)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-primary animate-spin",children:"progress_activity"}),(0,r.jsx)("span",{className:"text-sm",children:es?"Waiting for Grok Build OAuth…":"Waiting for popup authorization…"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 my-1",children:[(0,r.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,r.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wider",children:"Or paste callback URL manually"}),(0,r.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-sm font-medium mb-2",children:["Step 1: Open this ",es?"Grok Build OAuth URL":"URL"," in your browser"]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.pd,{value:g?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,r.jsx)(l.$n,{variant:"secondary",icon:"auth_url"===V?"check":"content_copy",onClick:()=>K(g?.authUrl,"auth_url"),disabled:!g?.authUrl,children:"Copy"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-sm font-medium mb-2",children:["Step 2: Paste the ","xai"===t?"callback URL or copied code":ei?"callback URL or copied token":"callback URL"," here"]}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"xai"===t?"If xAI shows a code instead of redirecting, paste that code here.":ei?"After authorization, copy the full callback URL or token from your browser.":"After authorization, copy the full URL from your browser."}),(0,r.jsx)(l.pd,{value:b,onChange:e=>v(e.target.value),placeholder:eu,className:"font-mono text-xs"})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:er,fullWidth:!0,disabled:!b.trim()||$,children:$?"Connecting...":"Connect"}),(0,r.jsx)(l.$n,{onClick:en,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"waiting"===p&&k&&N&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"text-center py-4",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Visit the login URL below and authorize:"}),(0,r.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[(0,r.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Login URL"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("code",{className:"flex-1 text-sm break-all",children:ed}),(0,r.jsx)(l.$n,{size:"sm",variant:"ghost",icon:"login_url"===V?"check":"content_copy",onClick:()=>K(ed,"login_url"),disabled:!ed}),(0,r.jsx)(l.$n,{size:"sm",variant:"ghost",icon:"open_in_new",onClick:()=>window.open(ed,"_blank","noopener,noreferrer"),disabled:!ed,children:"Open"})]})]}),N.user_code&&(0,r.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[(0,r.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Your Code"}),(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:N.user_code}),(0,r.jsx)(l.$n,{size:"sm",variant:"ghost",icon:"user_code"===V?"check":"content_copy",onClick:()=>K(N.user_code,"user_code")})]})]})]}),S&&(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),"Waiting for authorization..."]})]}),"success"===p&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,r.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your ",a.name," account has been connected."]}),(0,r.jsx)(l.$n,{onClick:en,fullWidth:!0,children:"Done"})]}),"error"===p&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,r.jsx)("p",{className:"text-sm text-red-600 mb-4",children:j}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:ea,variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,r.jsx)(l.$n,{onClick:en,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}u.propTypes={isOpen:i().bool.isRequired,provider:i().string,providerInfo:i().shape({name:i().string}),onSuccess:i().func,onClose:i().func.isRequired,oauthMeta:i().object,idcConfig:i().shape({startUrl:i().string,region:i().string})}},91450:(e,t,a)=>{a.d(t,{default:()=>l});var r=a(95155),n=a(14051),s=a.n(n),i=a(38587);function l({children:e}){return(0,r.jsxs)("div",{className:"min-h-screen flex flex-col relative bg-bg transition-colors duration-500 overflow-x-hidden selection:bg-primary/20 selection:text-primary",children:[(0,r.jsx)("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-primary/5 dark:bg-primary/5 rounded-full blur-[100px] pointer-events-none z-0"}),(0,r.jsx)("div",{className:"fixed bottom-0 right-0 w-[600px] h-[600px] bg-orange-200/20 dark:bg-orange-900/10 rounded-full blur-[120px] pointer-events-none z-0 translate-y-1/3 translate-x-1/3"}),(0,r.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,r.jsx)(i.default,{variant:"card"})}),(0,r.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:e})]})}l.propTypes={children:s().node.isRequired}},92173:(e,t,a)=>{a.d(t,{default:()=>c});var r=a(95155),n=a(98500),s=a.n(n),i=a(90620);let l=[{label:"Features",href:"#features"},{label:"Pricing",href:"#pricing"},{label:"Changelog",href:"#"}],o=[{label:"Documentation",href:"#"},{label:"API Reference",href:"#"},{label:"Help Center",href:"#"}],d=[{label:"About",href:"#"},{label:"Blog",href:"#"},{label:"Contact",href:"#"}];function c(){return(0,r.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,r.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[(0,r.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-10 mb-12",children:[(0,r.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,r.jsx)("div",{className:"size-6 text-primary",children:(0,r.jsx)("svg",{className:"w-full h-full",fill:"currentColor",viewBox:"0 0 48 48",children:(0,r.jsx)("path",{clipRule:"evenodd",d:"M12.0799 24L4 19.2479L9.95537 8.75216L18.04 13.4961L18.0446 4H29.9554L29.96 13.4961L38.0446 8.75216L44 19.2479L35.92 24L44 28.7521L38.0446 39.2479L29.96 34.5039L29.9554 44H18.0446L18.04 34.5039L9.95537 39.2479L4 28.7521L12.0799 24Z",fillRule:"evenodd"})})}),(0,r.jsx)("span",{className:"text-xl font-bold text-text-main",children:i.vQ.name})]}),(0,r.jsx)("p",{className:"text-text-muted mb-6 max-w-sm font-light",children:"The unified interface for modern AI infrastructure. Secure, observable, and scalable."}),(0,r.jsxs)("div",{className:"flex gap-4",children:[(0,r.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"Twitter",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z"})})}),(0,r.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})})})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Product"}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:l.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(s(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Resources"}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:o.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(s(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Company"}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:d.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(s(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]})]}),(0,r.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["\xa9 ",new Date().getFullYear()," ",i.vQ.name," Inc. All rights reserved."]}),(0,r.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[(0,r.jsx)(s(),{href:"#",className:"hover:text-primary transition-colors",children:"Privacy Policy"}),(0,r.jsx)(s(),{href:"#",className:"hover:text-primary transition-colors",children:"Terms of Service"})]})]})]})})}},92542:(e,t,a)=>{a.d(t,{default:()=>l});var r=a(95155),n=a(31474);let s={primary:"bg-brand-500 hover:bg-brand-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",secondary:"bg-surface-2 hover:bg-surface-3 text-text-main border border-border disabled:opacity-50",outline:"border border-border text-text-main hover:bg-surface-2 hover:border-brand-500/40",ghost:"text-text-muted hover:bg-surface-2 hover:text-text-main",danger:"bg-red-500 hover:bg-red-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",success:"bg-green-600 hover:bg-green-700 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted"},i={sm:"h-7 px-3 text-xs rounded-[8px]",md:"h-9 px-4 text-sm rounded-[10px]",lg:"h-11 px-6 text-sm rounded-[10px]"};function l({children:e,variant:t="primary",size:a="md",icon:o,iconRight:d,disabled:c=!1,loading:u=!1,fullWidth:m=!1,className:x,...p}){return(0,r.jsxs)("button",{className:(0,n.cn)("inline-flex items-center justify-center gap-2 font-semibold transition-all duration-150 ease-out cursor-pointer","active:scale-[0.97] disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100",s[t],i[a],m&&"w-full",x),disabled:c||u,...p,children:[u?(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}):o?(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:o}):null,e,d&&!u&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:d})]})}},94230:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497),o=a(11059);function d({isOpen:e,provider:t,onSuccess:a,onClose:s}){let[i,c]=(0,n.useState)("loading"),[u,m]=(0,n.useState)(""),[x,p]=(0,n.useState)(null),[h,g]=(0,n.useState)(""),[f,b]=(0,n.useState)(null),{copied:v,copy:j}=(0,o.C)(),y=(0,n.useRef)(!1);(0,n.useEffect)(()=>{e||(y.current=!1)},[e]),(0,n.useEffect)(()=>{e&&t&&(async()=>{try{b(null),c("loading");let e=await fetch(`/api/oauth/kiro/social-authorize?provider=${t}`),a=await e.json();if(!e.ok)throw Error(a.error);p(a),m(a.authUrl),c("input"),y.current||(y.current=!0,window.open(a.authUrl,"_blank"))}catch(e){b(e.message),c("error")}})()},[e,t]);let k=async()=>{try{let e;b(null);try{e=new URL(h)}catch(e){throw Error("Invalid callback URL format")}let r=e.searchParams.get("code");e.searchParams.get("state");let n=e.searchParams.get("error");if(n)throw Error(e.searchParams.get("error_description")||n);if(!r)throw Error("No authorization code found in URL");let s=await fetch("/api/oauth/kiro/social-exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:r,codeVerifier:x.codeVerifier,provider:t})}),i=await s.json();if(!s.ok)throw Error(i.error);c("success"),a?.()}catch(e){b(e.message),c("error")}},w="google"===t?"Google":"GitHub";return(0,r.jsx)(l.aF,{isOpen:e,title:`Connect Kiro via ${w}`,onClose:s,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:["loading"===i&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Initializing..."}),(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["Setting up ",w," authentication"]})]}),"input"===i&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.pd,{value:u,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,r.jsx)(l.$n,{variant:"secondary",icon:"auth_url"===v?"check":"content_copy",onClick:()=>j(u,"auth_url"),children:"Copy"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser address bar."}),(0,r.jsx)(l.pd,{value:h,onChange:e=>g(e.target.value),placeholder:"kiro://kiro.kiroAgent/authenticate-success?code=...",className:"font-mono text-xs"})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:k,fullWidth:!0,disabled:!h,children:"Connect"}),(0,r.jsx)(l.$n,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===i&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,r.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your Kiro account via ",w," has been connected."]}),(0,r.jsx)(l.$n,{onClick:s,fullWidth:!0,children:"Done"})]}),"error"===i&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,r.jsx)("p",{className:"text-sm text-red-600 mb-4",children:f}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:()=>c("input"),variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,r.jsx)(l.$n,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}d.propTypes={isOpen:i().bool.isRequired,provider:i().oneOf(["google","github"]).isRequired,onSuccess:i().func,onClose:i().func.isRequired}},95088:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497);let o="https://gitlab.com";function d({isOpen:e,providerInfo:t,onSuccess:a,onClose:s}){let i,[c,u]=(0,n.useState)(null),[m,x]=(0,n.useState)(o),[p,h]=(0,n.useState)(""),[g,f]=(0,n.useState)(""),[b,v]=(0,n.useState)(""),[j,y]=(0,n.useState)(!1),[k,w]=(0,n.useState)(null),[N,C]=(0,n.useState)(!1),[S,O]=(0,n.useState)(null),F=()=>{u(null),x(o),h(""),f(""),v(""),w(null),y(!1),C(!1),O(null),s()},W=async()=>{if(!b.trim())return void w("Personal Access Token is required");y(!0),w(null);try{let e=await fetch("/api/oauth/gitlab/pat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:b.trim(),baseUrl:m.trim()||o})}),t=await e.json();if(!e.ok)throw Error(t.error||"Authentication failed");a?.(),F()}catch(e){w(e.message)}finally{y(!1)}};return e?N&&S?(0,r.jsx)(l.LF,{isOpen:!0,provider:"gitlab",providerInfo:t,oauthMeta:S,onSuccess:()=>{a?.(),F()},onClose:()=>{C(!1),O(null)}}):(0,r.jsx)(l.aF,{isOpen:e,title:"Connect GitLab Duo",onClose:F,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[!c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Choose how to authenticate with GitLab Duo:"}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("button",{onClick:()=>u("oauth"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary",children:"lock_open"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"OAuth App"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab OAuth application"})]})]}),(0,r.jsxs)("button",{onClick:()=>u("pat"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary",children:"key"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"Personal Access Token"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab PAT with api scope"})]})]})]})]}),"oauth"===c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:"text-xs text-text-muted",children:["Create an OAuth app at"," ",(0,r.jsx)("a",{href:`${m.trim()||o}/-/profile/applications`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Applications"})," ","with redirect URI"," ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:(i=window.location.port||("https:"===window.location.protocol?"443":"80"),`http://localhost:${i}/callback`)})]}),(0,r.jsx)(l.pd,{label:"GitLab Base URL",value:m,onChange:e=>x(e.target.value),placeholder:o}),(0,r.jsx)(l.pd,{label:"Client ID",value:p,onChange:e=>h(e.target.value),placeholder:"Your OAuth application client ID"}),(0,r.jsx)(l.pd,{label:"Client Secret (optional for PKCE)",value:g,onChange:e=>f(e.target.value),placeholder:"Leave empty for public PKCE app"}),k&&(0,r.jsx)("p",{className:"text-sm text-red-500",children:k}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:()=>{p.trim()?(w(null),O({baseUrl:m.trim()||o,clientId:p.trim(),clientSecret:g.trim()}),C(!0)):w("Client ID is required")},fullWidth:!0,disabled:!p.trim(),children:"Authorize"}),(0,r.jsx)(l.$n,{onClick:()=>{u(null),w(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"pat"===c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:"text-xs text-text-muted",children:["Create a PAT at"," ",(0,r.jsx)("a",{href:`${m.trim()||o}/-/user_settings/personal_access_tokens`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Access Tokens"})," ","with scopes: ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"api"}),","," ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"read_user"}),", and"," ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"ai_features"}),"."]}),(0,r.jsx)(l.pd,{label:"GitLab Base URL",value:m,onChange:e=>x(e.target.value),placeholder:o}),(0,r.jsx)(l.pd,{label:"Personal Access Token",value:b,onChange:e=>v(e.target.value),placeholder:"glpat-****************",type:"password"}),k&&(0,r.jsx)("p",{className:"text-sm text-red-500",children:k}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:W,fullWidth:!0,disabled:!b.trim()||j,loading:j,children:"Connect"}),(0,r.jsx)(l.$n,{onClick:()=>{u(null),w(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})}):null}d.propTypes={isOpen:i().bool.isRequired,providerInfo:i().shape({name:i().string}),onSuccess:i().func,onClose:i().func.isRequired}},96748:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(95155),n=a(12115),s=a(14051),i=a.n(s),l=a(35497);let o="https://api.openai.com/v1";function d({isOpen:e,onClose:t,onCreated:a,onSaved:s,node:i}){let c=!!i,[u,m]=(0,n.useState)({name:"",prefix:"",baseUrl:o}),[x,p]=(0,n.useState)(!1),[h,g]=(0,n.useState)(""),[f,b]=(0,n.useState)(""),[v,j]=(0,n.useState)(!1),[y,k]=(0,n.useState)(null);(0,n.useEffect)(()=>{e&&(k(null),g(""),b(""),c?m({name:i.name||"",prefix:i.prefix||"",baseUrl:i.baseUrl||o}):m({name:"",prefix:"",baseUrl:o}))},[e,c,i]);let w=async()=>{if(u.name.trim()&&u.prefix.trim()&&u.baseUrl.trim()){p(!0);try{let e=c?`/api/provider-nodes/${i.id}`:"/api/provider-nodes",t=c?"PUT":"POST",r={name:u.name,prefix:u.prefix,baseUrl:u.baseUrl};c||(r.type="custom-embedding");let n=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),l=await n.json();n.ok&&(c?s?.(l.node):a?.(l.node))}catch(e){console.log("Error saving custom embedding node:",e)}finally{p(!1)}}},N=async()=>{j(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:u.baseUrl,apiKey:h,type:"custom-embedding",modelId:f.trim()||void 0})}),t=await e.json();k(t)}catch{k({valid:!1,error:"Network error"})}finally{j(!1)}};return(0,r.jsx)(l.aF,{isOpen:e,title:c?"Edit Custom Embedding":"Add Custom Embedding",onClose:t,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(l.pd,{label:"Name",value:u.name,onChange:e=>m({...u,name:e.target.value}),placeholder:"Voyage AI",hint:"Required. A friendly label for this embedding provider."}),(0,r.jsx)(l.pd,{label:"Prefix",value:u.prefix,onChange:e=>m({...u,prefix:e.target.value}),placeholder:"voyage",hint:"Required. Used as the provider prefix for model IDs (e.g. voyage/voyage-3)."}),(0,r.jsx)(l.pd,{label:"Base URL",value:u.baseUrl,onChange:e=>m({...u,baseUrl:e.target.value}),placeholder:"https://api.voyageai.com/v1",hint:"Most embedding APIs are OpenAI-compatible: Voyage, Cohere, Jina, Mistral, Together..."}),(0,r.jsx)(l.pd,{label:"API Key (for Check)",type:"password",value:h,onChange:e=>g(e.target.value)}),(0,r.jsx)(l.pd,{label:"Model ID (for Check)",value:f,onChange:e=>b(e.target.value),placeholder:"e.g. voyage-3, embed-english-v3.0, text-embedding-3-small",hint:"Required for validation. Will send a test embeddings request."}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(l.$n,{onClick:N,disabled:!h||!f.trim()||v||!u.baseUrl.trim(),variant:"secondary",children:v?"Checking...":"Check"}),(()=>{if(!y)return null;let{valid:e,error:t,dimensions:a}=y;return e?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.Ex,{variant:"success",children:"Valid"}),a&&(0,r.jsxs)("span",{className:"text-sm text-text-muted",children:[a," dims"]})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)(l.Ex,{variant:"error",children:"Invalid"}),t&&(0,r.jsx)("span",{className:"text-sm text-red-500",children:t})]})})()]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.$n,{onClick:w,fullWidth:!0,disabled:!u.name.trim()||!u.prefix.trim()||!u.baseUrl.trim()||x,children:x?c?"Saving...":"Creating...":c?"Save":"Create"}),(0,r.jsx)(l.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}d.propTypes={isOpen:i().bool.isRequired,onClose:i().func.isRequired,onCreated:i().func,onSaved:i().func,node:i().shape({id:i().string,name:i().string,prefix:i().string,baseUrl:i().string})}},97677:(e,t,a)=>{a.d(t,{default:()=>n});var r=a(95155);function n({text:e,children:t,position:a="top",color:s}){let i=s?"":"bg-gray-900";return(0,r.jsxs)("div",{className:"relative inline-flex group/tt",children:[t,(0,r.jsx)("div",{className:`pointer-events-none absolute ${{top:"bottom-full left-1/2 -translate-x-1/2 mb-1.5",bottom:"top-full left-1/2 -translate-x-1/2 mt-1.5",left:"right-full top-1/2 -translate-y-1/2 mr-1.5",right:"left-full top-1/2 -translate-y-1/2 ml-1.5"}[a]} z-50 w-max max-w-56 rounded px-2 py-1 text-[11px] leading-snug ${i} text-white opacity-0 group-hover/tt:opacity-100 transition-opacity duration-150 whitespace-normal`,style:s?{backgroundColor:s}:{},children:e})]})}},98254:(e,t,a)=>{a.d(t,{default:()=>x});var r=a(95155),n=a(12115),s=a(73321),i=a(65921),l=a(84130),o=a(8823),d=a(90620),c=a(73147),u=a(40197);function m(){let[e,t]=(0,n.useState)(!1),[a,s]=(0,n.useState)(null),[i,l]=(0,n.useState)(null),[o,m]=(0,n.useState)([]),[x,p]=(0,n.useState)(!1),[h,g]=(0,n.useState)(!1),[f,b]=(0,n.useState)(!1);return((0,n.useEffect)(()=>{let e=(0,c.BM)(d.vQ.version);if(!e.show)return;t(!0),s(e.fromVersion),l(e.toVersion);let a=!1;return fetch(d.Nu.changelogUrl,{cache:"no-store"}).then(e=>e.ok?e.text():Promise.reject(Error(`HTTP ${e.status}`))).then(t=>{if(a)return;let r=(0,c.zV)(t,e.fromVersion,e.toVersion),n=r.length>0?r:(0,c.zV)(t,null,e.toVersion),{bullets:s,truncated:i}=(0,c.eK)(n.length?n:[],{maxBullets:6});m(s),p(i)}).catch(()=>{}),()=>{a=!0}},[]),e)?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"pointer-events-auto w-full rounded-lg border border-green-500/30 bg-green-500/10 text-green-800 dark:text-green-200 shadow-lg backdrop-blur-sm px-3 py-2.5",children:(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px] leading-5 text-green-600 dark:text-green-400 shrink-0",children:"celebration"}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("p",{className:"text-xs font-semibold",children:["Updated to v",i,a?(0,r.jsxs)("span",{className:"font-normal opacity-80",children:[" (from v",a,")"]}):null]}),!f&&0===o.length&&(0,r.jsx)("p",{className:"text-[11px] opacity-80 mt-0.5",children:"You're on the latest install."}),f&&o.length>0&&(0,r.jsxs)("ul",{className:"mt-1.5 space-y-0.5 text-[11px] opacity-90 list-disc list-inside",children:[o.map((e,t)=>(0,r.jsx)("li",{className:"truncate",title:e.text,children:e.text},`${e.version}-${t}`)),x&&(0,r.jsx)("li",{className:"list-none opacity-70 pl-0",children:"…and more"})]}),(0,r.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-2",children:[o.length>0&&(0,r.jsx)("button",{type:"button",onClick:()=>b(e=>!e),className:"text-[11px] font-medium underline-offset-2 hover:underline",children:f?"Hide changes":"See what changed"}),(0,r.jsx)("button",{type:"button",onClick:()=>g(!0),className:"text-[11px] font-medium underline-offset-2 hover:underline opacity-80",children:"Full changelog"})]})]}),(0,r.jsx)("button",{type:"button",onClick:()=>{(0,c.yM)(d.vQ.version),t(!1)},className:"text-current/70 hover:text-current shrink-0","aria-label":"Dismiss",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]})}),(0,r.jsx)(u.default,{isOpen:h,onClose:()=>g(!1)})]}):null}function x({children:e}){let[t,d]=(0,n.useState)(!1),c=(0,s.usePathname)(),u=(0,i.i)(e=>e.notifications),p=(0,i.i)(e=>e.removeNotification);return(0,n.useEffect)(()=>{let e=()=>{a.e(6808).then(a.bind(a,6808)).catch(()=>{}),Promise.all([a.e(3842),a.e(9495),a.e(1649),a.e(124)]).then(a.bind(a,10124)).catch(()=>{}),Promise.all([a.e(3842),a.e(9495),a.e(8569),a.e(2435)]).then(a.bind(a,82435)).catch(()=>{}),Promise.all([a.e(3842),a.e(9495),a.e(8569),a.e(5462)]).then(a.bind(a,65462)).catch(()=>{})};{if("requestIdleCallback"in window){let t=window.requestIdleCallback(e,{timeout:4e3});return()=>window.cancelIdleCallback(t)}let t=setTimeout(e,2500);return()=>clearTimeout(t)}},[]),(0,r.jsxs)("div",{className:"flex h-screen w-full overflow-hidden bg-bg",children:[(0,r.jsxs)("div",{className:"fixed top-4 right-4 z-[80] flex w-[min(92vw,380px)] flex-col gap-2",children:[(0,r.jsx)(m,{}),u.map(e=>{var t;let a="success"===(t=e.type)?{wrapper:"border-green-500/30 bg-green-500/10 text-green-600 dark:text-green-400",icon:"check_circle"}:"error"===t?{wrapper:"border-red-500/30 bg-red-500/10 text-red-600 dark:text-red-400",icon:"error"}:"warning"===t?{wrapper:"border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400",icon:"warning"}:{wrapper:"border-blue-500/30 bg-blue-500/10 text-blue-600 dark:text-blue-400",icon:"info"};return(0,r.jsx)("div",{className:`rounded-lg border px-3 py-2 shadow-lg backdrop-blur-sm ${a.wrapper}`,children:(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px] leading-5",children:a.icon}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[e.title?(0,r.jsx)("p",{className:"text-xs font-semibold mb-0.5",children:e.title}):null,(0,r.jsx)("p",{className:"text-xs whitespace-pre-wrap break-words",children:e.message})]}),e.dismissible?(0,r.jsx)("button",{type:"button",onClick:()=>p(e.id),className:"text-current/70 hover:text-current","aria-label":"Dismiss notification",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})}):null]})},e.id)})]}),t&&(0,r.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20 lg:hidden",onClick:()=>d(!1)}),(0,r.jsx)("div",{className:"hidden lg:flex",children:(0,r.jsx)(l.default,{})}),(0,r.jsx)("div",{className:`fixed inset-y-0 left-0 z-50 transform lg:hidden transition-transform duration-300 ease-in-out ${t?"translate-x-0":"-translate-x-full"}`,children:(0,r.jsx)(l.default,{onClose:()=>d(!1)})}),(0,r.jsxs)("main",{className:"flex flex-col flex-1 h-full min-w-0 relative transition-colors duration-300 isolate",children:[(0,r.jsx)("div",{className:"landing-grid absolute inset-0 pointer-events-none -z-10","aria-hidden":"true"}),(0,r.jsx)(o.default,{onMenuClick:()=>d(!0)},c),(0,r.jsx)("div",{className:`flex-1 overflow-y-auto custom-scrollbar ${"/dashboard/basic-chat"===c?"":"p-6 lg:p-10"} ${"/dashboard/basic-chat"===c?"flex flex-col overflow-hidden":""}`,children:(0,r.jsx)("div",{className:`${"/dashboard/basic-chat"===c?"flex-1 w-full h-full flex flex-col":"max-w-7xl mx-auto"}`,children:e})})]})]})}m.propTypes={}},98542:(e,t,a)=>{a.d(t,{default:()=>s});var r=a(95155),n=a(31474);function s({checked:e=!1,onChange:t,label:a,description:i,disabled:l=!1,size:o="md",className:d}){let c={sm:{track:"w-8 h-4",thumb:"size-3",translate:"translate-x-4"},md:{track:"w-11 h-6",thumb:"size-5",translate:"translate-x-5"},lg:{track:"w-14 h-7",thumb:"size-6",translate:"translate-x-7"}};return(0,r.jsxs)("div",{className:(0,n.cn)("flex items-center gap-3",l&&"opacity-50 cursor-not-allowed",d),children:[(0,r.jsx)("button",{type:"button",role:"switch","aria-checked":e,disabled:l,onClick:()=>{!l&&t&&t(!e)},className:(0,n.cn)("relative inline-flex shrink-0 cursor-pointer rounded-full","transition-colors duration-200 ease-in-out","focus:outline-none focus:ring-2 focus:ring-brand-500/30",e?"bg-brand-500":"bg-surface-3",c[o].track,l&&"cursor-not-allowed"),children:(0,r.jsx)("span",{className:(0,n.cn)("pointer-events-none inline-block rounded-full bg-white shadow-sm","transform transition duration-200 ease-in-out",e?c[o].translate:"translate-x-0.5",c[o].thumb,"mt-0.5")})}),(a||i)&&(0,r.jsxs)("div",{className:"flex flex-col",children:[a&&(0,r.jsx)("span",{className:"text-sm font-medium text-text-main",children:a}),i&&(0,r.jsx)("span",{className:"text-xs text-text-muted",children:i})]})]})}}}]);