zevairouter 1.1.71 → 1.1.72

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 (239) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/cli/app/.next-cli-build/BUILD_ID +1 -1
  3. package/cli/app/.next-cli-build/app-path-routes-manifest.json +31 -31
  4. package/cli/app/.next-cli-build/build-manifest.json +2 -2
  5. package/cli/app/.next-cli-build/prerender-manifest.json +3 -3
  6. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page_client-reference-manifest.js +1 -1
  7. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  8. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  9. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  10. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  11. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  12. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page_client-reference-manifest.js +1 -1
  13. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  14. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  15. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  16. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  17. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  18. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  19. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  20. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
  21. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  22. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  23. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  24. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  25. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  26. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  27. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  28. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  29. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  30. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page_client-reference-manifest.js +1 -1
  31. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  32. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  33. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  34. package/cli/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  35. package/cli/app/.next-cli-build/server/app/_global-error.html +1 -1
  36. package/cli/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  37. package/cli/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  38. package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  39. package/cli/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  40. package/cli/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  41. package/cli/app/.next-cli-build/server/app/_not-found.html +1 -1
  42. package/cli/app/.next-cli-build/server/app/_not-found.rsc +4 -4
  43. package/cli/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +4 -4
  44. package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +4 -4
  45. package/cli/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  46. package/cli/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
  47. package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  48. package/cli/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
  49. package/cli/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +1 -1
  50. package/cli/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js +1 -1
  51. package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
  52. package/cli/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
  53. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
  54. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
  55. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  56. package/cli/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js +2 -2
  57. package/cli/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +2 -2
  58. package/cli/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js +2 -2
  59. package/cli/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
  60. package/cli/app/.next-cli-build/server/app/api/cli-tools/dsh-settings/route.js +1 -1
  61. package/cli/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js +3 -3
  62. package/cli/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +2 -2
  63. package/cli/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +2 -2
  64. package/cli/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +1 -1
  65. package/cli/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  66. package/cli/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js +2 -2
  67. package/cli/app/.next-cli-build/server/app/api/cli-tools/openbot-settings/route.js +2 -2
  68. package/cli/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  69. package/cli/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
  70. package/cli/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +2 -2
  71. package/cli/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js +2 -2
  72. package/cli/app/.next-cli-build/server/app/api/models/route.js +1 -1
  73. package/cli/app/.next-cli-build/server/app/api/providers/opencode/discover-models/route.js +1 -1
  74. package/cli/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  75. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  76. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
  77. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +2 -2
  78. package/cli/app/.next-cli-build/server/app/api/version/route.js +1 -1
  79. package/cli/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  80. package/cli/app/.next-cli-build/server/app/callback.html +1 -1
  81. package/cli/app/.next-cli-build/server/app/callback.rsc +4 -4
  82. package/cli/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +4 -4
  83. package/cli/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  84. package/cli/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +4 -4
  85. package/cli/app/.next-cli-build/server/app/dashboard/automation.html +1 -1
  86. package/cli/app/.next-cli-build/server/app/dashboard/automation.rsc +4 -4
  87. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation/__PAGE__.segment.rsc +4 -4
  88. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_full.segment.rsc +4 -4
  89. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_tree.segment.rsc +2 -2
  90. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  91. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +4 -4
  92. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +4 -4
  93. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +4 -4
  94. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
  95. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  96. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +4 -4
  97. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +4 -4
  98. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +4 -4
  99. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  100. package/cli/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  101. package/cli/app/.next-cli-build/server/app/dashboard/combos.rsc +4 -4
  102. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +4 -4
  103. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +4 -4
  104. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  105. package/cli/app/.next-cli-build/server/app/dashboard/context.html +1 -1
  106. package/cli/app/.next-cli-build/server/app/dashboard/context.rsc +4 -4
  107. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context/__PAGE__.segment.rsc +4 -4
  108. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_full.segment.rsc +4 -4
  109. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_tree.segment.rsc +2 -2
  110. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  111. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.rsc +4 -4
  112. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +4 -4
  113. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +4 -4
  114. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  115. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  116. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +4 -4
  117. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +4 -4
  118. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +4 -4
  119. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
  120. package/cli/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  121. package/cli/app/.next-cli-build/server/app/dashboard/mitm.rsc +4 -4
  122. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +4 -4
  123. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +4 -4
  124. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  125. package/cli/app/.next-cli-build/server/app/dashboard/playground.html +1 -1
  126. package/cli/app/.next-cli-build/server/app/dashboard/playground.rsc +4 -4
  127. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground/__PAGE__.segment.rsc +4 -4
  128. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_full.segment.rsc +4 -4
  129. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_tree.segment.rsc +2 -2
  130. package/cli/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  131. package/cli/app/.next-cli-build/server/app/dashboard/profile.rsc +4 -4
  132. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +4 -4
  133. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +4 -4
  134. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  135. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  136. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.rsc +4 -4
  137. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +4 -4
  138. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +4 -4
  139. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  140. package/cli/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  141. package/cli/app/.next-cli-build/server/app/dashboard/providers.rsc +4 -4
  142. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +4 -4
  143. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +4 -4
  144. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  145. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  146. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +4 -4
  147. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +4 -4
  148. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +4 -4
  149. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  150. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  151. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +4 -4
  152. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +4 -4
  153. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +4 -4
  154. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +2 -2
  155. package/cli/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
  156. package/cli/app/.next-cli-build/server/app/dashboard/quota.rsc +4 -4
  157. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +4 -4
  158. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +4 -4
  159. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  160. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  161. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
  162. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing/__PAGE__.segment.rsc +4 -4
  163. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
  164. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  165. package/cli/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  166. package/cli/app/.next-cli-build/server/app/dashboard/skills.rsc +4 -4
  167. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +4 -4
  168. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +4 -4
  169. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
  170. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  171. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.rsc +4 -4
  172. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +4 -4
  173. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +4 -4
  174. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +2 -2
  175. package/cli/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  176. package/cli/app/.next-cli-build/server/app/dashboard/translator.rsc +4 -4
  177. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +4 -4
  178. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +4 -4
  179. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  180. package/cli/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  181. package/cli/app/.next-cli-build/server/app/dashboard/usage.rsc +4 -4
  182. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +4 -4
  183. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +4 -4
  184. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  185. package/cli/app/.next-cli-build/server/app/dashboard.html +1 -1
  186. package/cli/app/.next-cli-build/server/app/dashboard.rsc +4 -4
  187. package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +4 -4
  188. package/cli/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +4 -4
  189. package/cli/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  190. package/cli/app/.next-cli-build/server/app/index.html +1 -1
  191. package/cli/app/.next-cli-build/server/app/index.rsc +4 -4
  192. package/cli/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +4 -4
  193. package/cli/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +4 -4
  194. package/cli/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  195. package/cli/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  196. package/cli/app/.next-cli-build/server/app/landing.html +1 -1
  197. package/cli/app/.next-cli-build/server/app/landing.rsc +4 -4
  198. package/cli/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +4 -4
  199. package/cli/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
  200. package/cli/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +4 -4
  201. package/cli/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  202. package/cli/app/.next-cli-build/server/app/login.html +1 -1
  203. package/cli/app/.next-cli-build/server/app/login.rsc +4 -4
  204. package/cli/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
  205. package/cli/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
  206. package/cli/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +4 -4
  207. package/cli/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  208. package/cli/app/.next-cli-build/server/app-paths-manifest.json +31 -31
  209. package/cli/app/.next-cli-build/server/chunks/1350.js +1 -1
  210. package/cli/app/.next-cli-build/server/chunks/1757.js +1 -1
  211. package/cli/app/.next-cli-build/server/chunks/24.js +1 -1
  212. package/cli/app/.next-cli-build/server/chunks/267.js +1 -1
  213. package/cli/app/.next-cli-build/server/chunks/3184.js +188 -8
  214. package/cli/app/.next-cli-build/server/chunks/412.js +1 -1
  215. package/cli/app/.next-cli-build/server/chunks/4128.js +1 -1
  216. package/cli/app/.next-cli-build/server/chunks/4177.js +1 -1
  217. package/cli/app/.next-cli-build/server/chunks/5626.js +1 -1
  218. package/cli/app/.next-cli-build/server/chunks/5744.js +1 -1
  219. package/cli/app/.next-cli-build/server/chunks/6166.js +1 -1
  220. package/cli/app/.next-cli-build/server/chunks/7135.js +1 -1
  221. package/cli/app/.next-cli-build/server/chunks/7319.js +191 -11
  222. package/cli/app/.next-cli-build/server/chunks/7364.js +1 -1
  223. package/cli/app/.next-cli-build/server/chunks/9548.js +1 -1
  224. package/cli/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  225. package/cli/app/.next-cli-build/server/pages/404.html +1 -1
  226. package/cli/app/.next-cli-build/server/pages/500.html +1 -1
  227. package/cli/app/.next-cli-build/server/preview-props.json +3 -3
  228. package/cli/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  229. package/cli/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  230. package/cli/app/.next-cli-build/static/chunks/{5497-4d168d9cd210bd34.js → 5497-71a02c6639ddb92b.js} +1 -1
  231. package/cli/app/.next-cli-build/static/chunks/{620-45fd6acdac66cff7.js → 620-8a41eb30d7d6d733.js} +1 -1
  232. package/cli/app/.next-cli-build/static/css/a0638083939bf113.css +1 -0
  233. package/cli/app/CHANGELOG.md +6 -0
  234. package/cli/app/package.json +1 -1
  235. package/cli/package.json +1 -1
  236. package/package.json +1 -1
  237. package/cli/app/.next-cli-build/static/css/7a10846ca034238f.css +0 -1
  238. /package/cli/app/.next-cli-build/static/{tpHxuRs-vEIWrvVD8nkv3 → L0x5Ks4CQl7b_2QKBRbOP}/_buildManifest.js +0 -0
  239. /package/cli/app/.next-cli-build/static/{tpHxuRs-vEIWrvVD8nkv3 → L0x5Ks4CQl7b_2QKBRbOP}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5497],{98:(e,t,r)=>{r.d(t,{default:()=>i});var s=r(95155),a=r(12115),l=r(31474);function i({label:e,options:t=[],value:r,onChange:n,placeholder:o="Select an option",error:d,hint:c,disabled:u=!1,required:m=!1,className:x,selectClassName:p,...h}){let b=(0,a.useId)(),f=h.id||b,g=`${f}-error`,v=`${f}-hint`,j=[h["aria-describedby"],d&&g,c&&v].filter(Boolean).join(" ")||void 0;return(0,s.jsxs)("div",{className:(0,l.cn)("flex flex-col gap-1.5",x),children:[e&&(0,s.jsxs)("label",{htmlFor:f,className:"text-sm font-medium text-text-main",children:[e,m&&(0,s.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsxs)("select",{id:f,value:r,onChange:n,disabled:u,required:m,"aria-invalid":!!d||void 0,"aria-describedby":j,className:(0,l.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:border-brand-500/40 focus-visible:ring-2 focus-visible:ring-brand-500/30","transition-[border-color,box-shadow,background-color] duration-150 disabled:opacity-50 disabled:cursor-not-allowed motion-reduce:transition-none","text-[16px] sm:text-sm",d&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",p),...h,children:[(0,s.jsx)("option",{value:"",disabled:!0,children:o}),t.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,s.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"expand_more"})})]}),d&&(0,s.jsxs)("p",{id:g,role:"alert",className:"text-xs text-red-500 flex items-center gap-1",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[14px]",children:"error"}),d]}),c&&!d&&(0,s.jsx)("p",{id:v,className:"text-xs text-text-muted",children:c})]})}},929:(e,t,r)=>{r.d(t,{y:()=>d});var s=r(12115),a=r(67899),l=r(1791);let i=null,n=null;function o(){return i?Promise.resolve(i):n||(n=fetch("/api/models").then(async e=>{if(!e.ok)throw Error(`models ${e.status}`);return i=function(e){let t={},r={};for(let s of e||[])s.caps&&(s.fullModel&&(t[s.fullModel]=s.caps),s.routedModel&&(t[s.routedModel]=s.caps),s.model&&(r[s.model]=s.caps));return{byFull:t,byId:r}}((await e.json()).models)}).catch(()=>({byFull:{},byId:{}})).finally(()=>{n=null}))}function d(){let[e,t]=(0,s.useState)(()=>i?.byFull||{}),[r,n]=(0,s.useState)(()=>i?.byId||{});return(0,s.useEffect)(()=>{let e=!0,r=r=>{e&&(t(r.byFull||{}),n(r.byId||{}))};i?r(i):o().then(r);let s=()=>{i=null,o().then(r)};return window.addEventListener("customModelChanged",s),()=>{e=!1,window.removeEventListener("customModelChanged",s)}},[]),{getCaps:(0,s.useCallback)(t=>(function(e,t,r){if(!r)return null;if(e[r])return e[r];let s=r.includes("/")?r.slice(r.indexOf("/")+1):r;if(t[s])return t[s];let i=r.includes("/")?r.slice(0,r.indexOf("/")):null,n=i?l.js[i]||i:null,o=(0,a.nl)(n,s);return{vision:o.vision,pdf:o.pdf,audioInput:o.audioInput,videoInput:o.videoInput,search:o.search,reasoning:o.reasoning,contextWindow:o.contextWindow,maxOutput:o.maxOutput,thinkingFormat:o.thinkingFormat}})(e,r,t),[e,r])}}},1620:(e,t,r)=>{r.d(t,{D:()=>o});var s=r(12115),a=r(90085);function l(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 n(){return!1}function o(){let{theme:e,setTheme:t,toggleTheme:r,initTheme:o}=(0,a.A)(),d=(0,s.useSyncExternalStore)(l,i,n);(0,s.useEffect)(()=>{o()},[o]),(0,s.useEffect)(()=>{if("system"!==e)return;let t=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>o();return t.addEventListener("change",r),()=>t.removeEventListener("change",r)},[e,o]);let c="dark"===e||"system"===e&&d;return{theme:e,setTheme:t,toggleTheme:r,isDark:c}}},4823:(e,t,r)=>{r.d(t,{default:()=>m});var s=r(95155),a=r(12115),l=r(14051),i=r.n(l),n=r(84588),o=r(98),d=r(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,r]=(0,a.useState)([]),[l,i]=(0,a.useState)(c),[x,p]=(0,a.useState)("none"),[h,b]=(0,a.useState)(!1),[f,g]=(0,a.useState)(!1);(0,a.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(([s,a])=>{if(t)return;r(s.proxyPools||[]);let l=(a.providerStrategies||{})[e]||{};i(l.proxyPoolId||c),p(l.rotateStrategy||"none")}).catch(()=>{}),()=>{t=!0}},[e]);let v=(0,a.useCallback)(async(t,r)=>{b(!0);try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},l={...a[e]||{}};t===c?delete l.proxyPoolId:l.proxyPoolId=t,"none"===r?delete l.rotateStrategy:l.rotateStrategy=r;let i={...a};0===Object.keys(l).length?delete i[e]:i[e]=l,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:i})}),g(!0),setTimeout(()=>g(!1),1500)}catch(e){console.log("Save proxy config error:",e)}finally{b(!1)}},[e]),j=t.length>=2,y="none"!==x;return(0,s.jsxs)(n.default,{children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,s.jsx)("div",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-green-500/10 text-green-500",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"lock_open"})}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"No authentication required"}),(0,s.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,s.jsx)(d.default,{variant:"success",size:"sm",children:"Saved"})]}),(0,s.jsx)(o.default,{label:"Proxy Pool",value:l,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,s.jsxs)("div",{className:"flex flex-col gap-2 mt-4",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-text-main",children:"Rotation Strategy"}),(0,s.jsx)("select",{value:x,onChange:e=>{var t;p(t=e.target.value),v(l,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,s.jsx)("option",{value:e.value,disabled:"none"!==e.value&&!j,children:e.label},e.value))}),(0,s.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}},7648:(e,t,r)=>{r.d(t,{default:()=>c});var s=r(95155),a=r(12115),l=r(73321),i=r(65921),n=r(92622),o=r(8823),d=r(91852);function c({children:e}){let[t,r]=(0,a.useState)(!1),u=(0,a.useRef)(null),m=(0,a.useRef)(null),x=(0,l.usePathname)(),p=(0,i.i)(e=>e.notifications),h=(0,i.i)(e=>e.removeNotification),b="/dashboard/playground"===x||"/dashboard/basic-chat"===x,f="/dashboard/terminal"===x,g=b||f;return(0,a.useEffect)(()=>{if(!t)return;let e=m.current;u.current?.focus();let s=e=>{if("Escape"===e.key)return void r(!1);if("Tab"!==e.key||!u.current)return;let t=[...u.current.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')],s=t[0],a=t[t.length-1];s?e.shiftKey&&(document.activeElement===s||document.activeElement===u.current)?(e.preventDefault(),a.focus()):e.shiftKey||document.activeElement!==a||(e.preventDefault(),s.focus()):e.preventDefault()};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),e?.focus()}},[t]),(0,s.jsxs)("div",{className:"dashboard-shell relative isolate flex h-screen w-full overflow-hidden bg-bg",children:[(0,s.jsx)(d.A,{quiet:!0}),(0,s.jsx)("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-[100] focus:rounded-lg focus:bg-surface focus:px-4 focus:py-2 focus:text-text-main focus:shadow-lg",children:"Skip to main content"}),(0,s.jsx)("div",{"aria-live":"polite","aria-relevant":"additions text",className:"fixed top-3 right-3 z-[80] flex w-[min(calc(100vw-1.5rem),380px)] flex-col gap-2 sm:top-4 sm:right-4",children:p.map(e=>{var t;let r="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,s.jsx)("div",{role:"error"===e.type?"alert":"status",className:`rounded-lg border px-3 py-2 shadow-lg backdrop-blur-sm ${r.wrapper}`,children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[18px] leading-5",children:r.icon}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[e.title?(0,s.jsx)("p",{className:"text-xs font-semibold mb-0.5",children:e.title}):null,(0,s.jsx)("p",{className:"text-xs whitespace-pre-wrap break-words",children:e.message})]}),e.dismissible?(0,s.jsx)("button",{type:"button",onClick:()=>h(e.id),className:"-m-2 grid size-11 shrink-0 place-items-center rounded-lg text-current/70 transition-colors hover:bg-current/10 hover:text-current focus:outline-none focus-visible:ring-2 focus-visible:ring-current/40 sm:-m-1 sm:size-9","aria-label":"Dismiss notification",children:(0,s.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[16px]",children:"close"})}):null]})},e.id)})}),t&&(0,s.jsx)("button",{type:"button",className:"fixed inset-0 z-40 bg-black/30 backdrop-blur-[1px] lg:hidden",onClick:()=>r(!1),"aria-label":"Close dashboard navigation"}),(0,s.jsx)("div",{className:"hidden lg:flex",children:(0,s.jsx)(n.default,{})}),t&&(0,s.jsx)("div",{ref:u,role:"dialog","aria-modal":"true","aria-label":"Dashboard navigation",tabIndex:-1,className:"fixed inset-y-0 left-0 z-50 h-dvh min-h-0 max-h-dvh lg:hidden focus:outline-none",children:(0,s.jsx)(n.default,{onClose:()=>r(!1)})}),(0,s.jsxs)("main",{id:"main-content",tabIndex:-1,className:"flex flex-col flex-1 h-full min-w-0 relative transition-colors duration-300 isolate",children:[g?(0,s.jsxs)("div",{className:"lg:hidden shrink-0 flex min-h-12 items-center gap-2 px-2 py-1 border-b border-border-subtle bg-surface/60",children:[(0,s.jsx)("button",{ref:m,type:"button",onClick:()=>r(!0),className:"flex size-11 shrink-0 items-center justify-center rounded-lg text-text-main hover:bg-surface-2 focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40","aria-label":"Open dashboard navigation",children:(0,s.jsx)("span",{className:"material-symbols-outlined",children:"menu"})}),(0,s.jsx)("span",{className:"text-sm font-semibold",children:f?"Terminal":"Playground"})]}):(0,s.jsx)(o.default,{menuButtonRef:m,onMenuClick:()=>r(!0)},x),(0,s.jsx)("div",{className:`dashboard-content-gutter flex-1 overflow-y-auto custom-scrollbar ${g?"":"px-3 py-4 sm:px-6 sm:py-7 lg:px-10 lg:py-8"} ${g?"flex flex-col overflow-hidden":""}`,children:(0,s.jsx)("div",{className:`${g?"flex-1 w-full h-full flex flex-col min-h-0":"w-full min-w-0 max-w-6xl mx-auto"}`,children:e})})]})]})}},8823:(e,t,r)=>{r.d(t,{default:()=>y});var s=r(95155),a=r(12115),l=r(73321),i=r(98500),n=r.n(i),o=r(14051),d=r.n(o),c=r(57250),u=r(80752),m=r(93308),x=r(38202),p=r(21931);function h(){let[e,t]=(0,a.useState)(!1),[r,l]=(0,a.useState)("en");return(0,a.useEffect)(()=>{l(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,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{onClick:()=>t(!0),className:"flex size-11 items-center justify-center rounded-xl text-text-muted transition-all hover:bg-black/5 hover:text-text-main dark:hover:bg-white/5 sm:size-10 sm:rounded-lg",title:"Language","aria-label":"Change language","data-i18n-skip":"true",children:(0,s.jsx)("span",{className:"text-lg leading-none",children:x.h[r]||"\uD83C\uDF10"})}),(0,s.jsx)(p.default,{hideTrigger:!0,isOpen:e,onClose:e=>{t(!1),l(e)}})]})}var b=r(38587),f=r(38003),g=r(90620),v=r(1791),j=r(73006);function y({onMenuClick:e,showMenuButton:t=!0,menuButtonRef:r}){let i=(0,l.usePathname)(),o=(0,l.useRouter)(),[d,m]=(0,a.useState)(""),[x,p]=(0,a.useState)(""),{title:f,description:k,icon:w,breadcrumbs:C}=(0,a.useMemo)(()=>(e=>{if(!e)return{title:"",description:"",breadcrumbs:[]};let t=e.match(/\/media-providers\/([^/]+)\/([^/]+)$/);if(t){let e=t[1],r=t[2],s=v.rj.find(t=>t.id===e),a=v.Q2[r];return{title:a?.name||r,description:"",breadcrumbs:[{label:"Media Providers",href:`/dashboard/media-providers/${e}`},{label:s?.label||e,href:`/dashboard/media-providers/${e}`},{label:a?.name||r,image:`/providers/${r}.png`}]}}let r=e.match(/\/media-providers\/([^/]+)$/);if(r){let e=r[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 s=e.match(/\/providers\/([^/]+)$/);if(s){let e=s[1],t=g.zN[e]||g.fg[e];if(t)return{title:t.name,description:"",breadcrumbs:[{label:"Providers",href:"/dashboard/providers"},{label:t.name,image:`/providers/${t.id}.png`}]}}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 ZevaiRouter",icon:"security",breadcrumbs:[]}:e.includes("/cli-tools")?{title:"CLI Tools",description:"Configure CLI tools",icon:"handyman",breadcrumbs:[]}:e.includes("/terminal")?{title:"Terminal",description:"Host web shell — requires a second password",icon:"terminal",breadcrumbs:[]}:e.includes("/automation")?{title:"Automation",description:"Bulk account and workflow automation",icon:"automation",breadcrumbs:[]}:e.includes("/token-saver")?{title:"Token Saver",description:"Reduce prompt tokens before they hit providers",icon:"savings",breadcrumbs:[]}:e.includes("/context")?{title:"Context Inject",description:"Inject shared context into routed requests",icon:"psychology",breadcrumbs:[]}:e.includes("/pxpipe")?{title:"PxPipe",description:"Proxy pipeline status and controls",icon:"cable",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 ZevaiRouter — no install needed",icon:"extension",breadcrumbs:[]}:e.includes("/endpoint")?{title:"Endpoint",description:"API endpoint configuration",icon:"terminal",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:[]}:e.includes("/playground")||e.includes("/basic-chat")?{title:"Playground",description:"Chat with any connected model through ZevaiRouter",icon:"forum",breadcrumbs:[]}:"/dashboard"===e?{title:"Endpoint",description:"API endpoint configuration",icon:"terminal",breadcrumbs:[]}:{title:"",description:"",breadcrumbs:[]}})(i),[i]);(0,a.useEffect)(()=>{let e=!1;return async function(){try{let t=await fetch("/api/auth/status",{cache:"no-store"});if(!t.ok)return;let r=await t.json();e||(m(r?.displayName||r?.oidcName||r?.oidcEmail||""),p(r?.loginMethod||""))}catch{e||(m(""),p(""))}}(),()=>{e=!0}},[]);let S=async()=>{try{await fetch("/api/auth/logout",{method:"POST"})}catch(e){console.error("Failed to logout:",e)}o.push("/login"),o.refresh()};return(0,s.jsxs)("header",{className:"dashboard-topbar relative z-20 shrink-0 flex min-h-16 flex-wrap items-center justify-between gap-2 border-b border-border-subtle bg-surface/90 px-3 py-2.5 shadow-[0_12px_35px_-34px_rgba(15,23,42,0.8)] backdrop-blur-sm sm:gap-3 sm:px-4 sm:py-3 lg:min-h-[76px] lg:px-8",children:[(0,s.jsx)("div",{className:"flex items-center gap-2 lg:hidden shrink-0",children:t&&(0,s.jsx)("button",{ref:r,type:"button",onClick:e,className:"flex size-11 items-center justify-center rounded-xl text-text-main transition-colors hover:bg-surface-2 hover:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 sm:size-10 sm:rounded-lg","aria-label":"Open dashboard navigation",children:(0,s.jsx)("span",{className:"material-symbols-outlined",children:"menu"})})}),(0,s.jsx)("div",{className:"flex flex-col min-w-0 flex-1",children:C.length>0?(0,s.jsx)("div",{className:"flex items-center gap-2",children:C.map((e,t)=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[t>0&&(0,s.jsx)("span",{className:"material-symbols-outlined text-text-muted text-base",children:"chevron_right"}),e.href?(0,s.jsx)(n(),{href:e.href,className:"text-text-muted hover:text-primary transition-colors",children:e.label}):(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[e.image&&(0,s.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,s.jsx)("h1",{className:"text-base lg:text-2xl font-semibold text-text-main tracking-tight truncate",children:(0,j.Tl)(e.label)})]})]},`${e.label}-${e.href||"current"}`))}):f?(0,s.jsx)("div",{className:"flex items-center gap-3",children:(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[w&&(0,s.jsx)("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-[10px] bg-primary/10 text-primary ring-1 ring-primary/15 lg:size-10 lg:rounded-xl",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-lg lg:text-[22px]",children:w})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("h1",{className:"truncate text-base font-semibold tracking-tight lg:text-[22px]",children:(0,j.Tl)(f)}),k&&(0,s.jsx)("p",{className:"hidden truncate text-sm text-text-muted lg:block",children:(0,j.Tl)(k)})]})]})}):null}),(0,s.jsxs)("div",{className:"dashboard-header-actions order-2 flex shrink-0 flex-wrap items-center justify-end gap-0.5 sm:order-none sm:gap-1 lg:rounded-xl lg:border lg:border-border-subtle lg:bg-surface-2/60 lg:p-1",children:[d&&"OIDC"===x&&(0,s.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",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1.5 text-primary",children:"person"}),(0,s.jsx)("span",{className:"truncate",children:d}),(0,s.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:"OIDC"})]}),(0,s.jsx)(b.default,{className:"size-11 sm:size-10"}),(0,s.jsx)(h,{}),(0,s.jsx)(u.default,{onLogout:S})]}),(0,s.jsx)(N,{})]})}function N(){let e=(0,f.C)(e=>e.visible),t=(0,f.C)(e=>e.query),r=(0,f.C)(e=>e.placeholder),a=(0,f.C)(e=>e.setQuery);return e?(0,s.jsxs)("div",{className:"relative order-3 w-full sm:order-none sm:w-[220px]",children:[(0,s.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,s.jsx)("input",{type:"text",value:t,onChange:e=>a(e.target.value),placeholder:r,"aria-label":r||"Search",className:"h-11 w-full rounded-xl border border-border bg-surface/80 pl-9 pr-11 text-sm shadow-sm transition-colors focus:border-primary/50 focus:outline-none focus:ring-2 focus:ring-primary/10 sm:h-9 sm:pl-8 sm:pr-8"}),t&&(0,s.jsx)("button",{type:"button",onClick:()=>a(""),className:"absolute right-0 top-1/2 flex size-11 -translate-y-1/2 items-center justify-center rounded-xl text-text-muted hover:text-text-main sm:right-0.5 sm:size-8 sm:rounded-lg","aria-label":"Clear search",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]}):null}y.propTypes={onMenuClick:d().func,showMenuButton:d().bool,menuButtonRef:d().shape({current:d().object})}},11059:(e,t,r)=>{r.d(t,{C:()=>a});var s=r(12115);function a(e=2e3){let[t,r]=(0,s.useState)(null),l=(0,s.useRef)(null),i=(0,s.useRef)(!0);function n(e){let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t);try{return t.select(),document.execCommand("copy")}finally{document.body.removeChild(t)}}return(0,s.useEffect)(()=>(i.current=!0,()=>{i.current=!1,l.current&&clearTimeout(l.current)}),[]),{copied:t,copy:(0,s.useCallback)(async(t,s="default")=>{let a=!1;try{navigator?.clipboard?.writeText?(await navigator.clipboard.writeText(t),a=!0):a=n(t)}catch{try{a=n(t)}catch{a=!1}}return a&&i.current&&(r(s),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{i.current&&r(null)},e)),a},[e])}}},11910:(e,t,r)=>{r.d(t,{default:()=>i});var s=r(95155),a=r(12115),l=r(31474);function i({label:e,type:t="text",placeholder:r,value:n,onChange:o,error:d,hint:c,icon:u,disabled:m=!1,required:x=!1,className:p,inputClassName:h,...b}){let f=(0,a.useId)(),g=b.id||f,v=`${g}-error`,j=`${g}-hint`,y=[b["aria-describedby"],d&&v,c&&j].filter(Boolean).join(" ")||void 0;return(0,s.jsxs)("div",{className:(0,l.cn)("flex flex-col gap-1.5",p),children:[e&&(0,s.jsxs)("label",{htmlFor:g,className:"text-sm font-medium text-text-main",children:[e,x&&(0,s.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,s.jsxs)("div",{className:"relative",children:[u&&(0,s.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:u})}),(0,s.jsx)("input",{id:g,type:t,placeholder:r,value:n,onChange:o,disabled:m,required:x,"aria-invalid":!!d||void 0,"aria-describedby":y,className:(0,l.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:border-brand-500/40 focus-visible:ring-2 focus-visible:ring-brand-500/30","transition-[border-color,box-shadow,background-color] duration-150 ease-out disabled:opacity-50 disabled:cursor-not-allowed motion-reduce:transition-none","text-[16px] sm:text-sm",u&&"pl-10",d&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",h),...b})]}),d&&(0,s.jsxs)("p",{id:v,role:"alert",className:"text-xs text-red-500 flex items-center gap-1",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[14px]",children:"error"}),d]}),c&&!d&&(0,s.jsx)("p",{id:j,className:"text-xs text-text-muted",children:c})]})}},12252:(e,t,r)=>{r.d(t,{F:()=>a});var s=r(12115);function a(e){let[t,r]=(0,s.useState)([]);return(0,s.useEffect)(()=>{if(!e)return;let t=new AbortController;return fetch("/api/providers/kiro/models",{cache:"no-store",signal:t.signal}).then(e=>e.ok?e.json():{models:[]}).then(e=>r(Array.isArray(e?.models)?e.models:[])).catch(e=>{e?.name!=="AbortError"&&r([])}),()=>t.abort()},[e]),e?t:[]}},21110:(e,t,r)=>{r.d(t,{ThemeProvider:()=>i});var s=r(95155),a=r(12115),l=r(90085);function i({children:e}){let{initTheme:t}=(0,l.A)();return(0,a.useEffect)(()=>{t()},[t]),(0,s.jsx)(s.Fragment,{children:e})}},21286:(e,t,r)=>{r.d(t,{default:()=>o});var s=r(95155),a=r(12115),l=r(14051),i=r.n(l),n=r(35497);function o({isOpen:e,connectionIds:t,onSuccess:r,onClose:l,endpoint:i="/api/oauth/codebuddy/quota-cookie"}){let[d,c]=(0,a.useState)(""),[u,m]=(0,a.useState)(!1),[x,p]=(0,a.useState)(""),[h,b]=(0,a.useState)(!1),f=async()=>{if(!d.trim())return void p("Paste your CodeBuddy web cookie first.");m(!0),p("");try{let e=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:d.trim(),connectionIds:t})}),s=await e.json().catch(()=>({}));if(!e.ok)throw Error(s.error||"Failed to save CodeBuddy quota cookie.");b(!0),setTimeout(()=>{r?.(),g()},900)}catch(e){p(e.message||"Failed to save CodeBuddy quota cookie.")}finally{m(!1)}},g=()=>{c(""),p(""),b(!1),l?.()};return(0,s.jsx)(n.aF,{isOpen:e,onClose:g,title:"CodeBuddy Quota Cookie",children:(0,s.jsx)("div",{className:"space-y-4",children:h?(0,s.jsxs)("div",{className:"py-6 text-center",children:[(0,s.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Quota cookie saved."}),(0,s.jsx)("p",{className:"mt-2 text-sm text-text-muted",children:"Quota Tracker can now read CodeBuddy credits for the selected connection."})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"space-y-2 text-sm text-text-muted",children:[(0,s.jsx)("p",{children:"Paste the cookie string from a logged-in CodeBuddy web session. This is only used for the quota endpoint; your existing OAuth token still handles chat."}),(0,s.jsx)("div",{className:"rounded-lg bg-surface-secondary p-3 text-xs",children:"Open codebuddy.ai, sign in, then copy the request cookie from DevTools Network for a request to codebuddy.ai."})]}),(0,s.jsx)("textarea",{value:d,onChange:e=>c(e.target.value),placeholder:"session=...; AUTH_SESSION_ID=...; ...",className:"h-28 w-full resize-none rounded-lg border border-border bg-surface-secondary px-3 py-2 text-sm text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-primary",disabled:u}),x&&(0,s.jsx)("div",{className:"rounded-lg border border-error/20 bg-error/10 p-3",children:(0,s.jsx)("p",{className:"text-sm text-error",children:x})}),(0,s.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,s.jsx)(n.$n,{variant:"secondary",onClick:g,disabled:u,fullWidth:!0,children:"Cancel"}),(0,s.jsx)(n.$n,{onClick:f,loading:u,fullWidth:!0,children:"Save Cookie"})]})]})})})}o.propTypes={isOpen:i().bool.isRequired,connectionIds:i().arrayOf(i().string).isRequired,onSuccess:i().func,onClose:i().func,endpoint:i().string}},21931:(e,t,r)=>{r.d(t,{default:()=>d});var s=r(95155),a=r(12115),l=r(47650),i=r(93308),n=r(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"},km:{name:"ខ្មែរ",flag:"\uD83C\uDDF0\uD83C\uDDED"},th:{name:"ไทย",flag:"\uD83C\uDDF9\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:r,hideTrigger:c=!1}){let[u,m]=(0,a.useState)("en"),[x,p]=(0,a.useState)(!1),[h,b]=(0,a.useState)(!1),f=(0,a.useRef)(null),g="boolean"==typeof t,v=g?t:h,j=e=>{g?!e&&r&&r(u):b(e)};(0,a.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,a.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),j(!1);try{let t=await fetch("/api/locale",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:e})});if(!t.ok)throw Error(`Locale change rejected (${t.status})`);await (0,n.wn)(),m(e)}catch(e){console.error("Failed to set locale:",e)}finally{p(!1)}}};return(0,s.jsxs)("div",{className:e,children:[!c&&(0,s.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,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"language"}),(0,s.jsx)("span",{className:"text-sm font-medium",children:o(u).name}),(0,s.jsx)("span",{className:"text-lg",children:o(u).flag})]}),v&&(0,l.createPortal)((0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4","data-i18n-skip":"true",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:()=>j(!1)}),(0,s.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,s.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Select Language"}),(0,s.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,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,s.jsx)("div",{className:"p-6 overflow-y-auto flex-1",children:(0,s.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(100px,1fr))] gap-2",children:i.YZ.map(e=>{let t=u===e,r=o(e);return(0,s.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:r.name,children:[(0,s.jsx)("span",{className:"text-2xl",children:r.flag}),(0,s.jsx)("span",{className:"text-center leading-tight line-clamp-2 h-8 flex items-center",children:r.name}),t&&(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check"})]},e)})})})]})]}),document.body)]})}},22942:(e,t,r)=>{function s(e,t,r){let s=r.height-e.bottom,a=s<(t+1)*34+8&&e.top>s;return{position:"fixed",right:r.width-e.right,...a?{bottom:r.height-e.top+4,maxHeight:Math.max(e.top-8,120)}:{top:e.bottom+4,maxHeight:Math.max(s-8,120)}}}function a(e,t,r){let s=e.left+e.width/2,a=e.top+e.height/2;return"bottom"===t?{position:"fixed",top:e.bottom+6,left:s,transform:"translateX(-50%)"}:"left"===t?{position:"fixed",right:r.width-e.left+6,top:a,transform:"translateY(-50%)"}:"right"===t?{position:"fixed",left:e.right+6,top:a,transform:"translateY(-50%)"}:{position:"fixed",bottom:r.height-e.top+6,left:s,transform:"translateX(-50%)"}}r.d(t,{Z:()=>a,x:()=>s})},23615:(e,t,r)=>{r.d(t,{default:()=>i});var s=r(95155),a=r(12115),l=r(84588);function i(){let[e,t]=(0,a.useState)([]),[r,i]=(0,a.useState)(!0),[n,o]=(0,a.useState)(!0);(0,a.useEffect)(()=>{d()},[]),(0,a.useEffect)(()=>{let e;return n&&(e=setInterval(()=>{d(!1)},3e3)),()=>clearInterval(e)},[n]);let d=async(e=!0)=>{e&&i(!0);try{let e=await fetch("/api/usage/request-logs");if(e.ok){let r=await e.json();t(r)}}catch(e){console.error("Failed to fetch logs:",e)}finally{e&&i(!1)}};return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("h2",{className:"text-xl font-semibold",children:"Request Logs"}),(0,s.jsx)("div",{className:"flex items-center gap-2",children:(0,s.jsxs)("label",{className:"text-sm font-medium text-text-muted flex items-center gap-2 cursor-pointer",children:[(0,s.jsx)("span",{children:"Auto Refresh (3s)"}),(0,s.jsx)("div",{onClick:()=>o(!n),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none ${n?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,s.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${n?"translate-x-5":"translate-x-1"}`})})]})})]}),(0,s.jsx)(l.default,{className:"overflow-hidden bg-black/5 dark:bg-black/20",children:(0,s.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:r&&0===e.length?(0,s.jsx)("div",{className:"p-8 text-center text-text-muted",children:"Loading logs..."}):0===e.length?(0,s.jsx)("div",{className:"p-8 text-center text-text-muted",children:"No logs recorded yet."}):(0,s.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,s.jsx)("thead",{className:"sticky top-0 bg-bg-subtle border-b border-border z-10",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"DateTime"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Model"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Provider"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Account"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"In"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Out"}),(0,s.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-border/50",children:e.map((e,t)=>{let r=e.split(" | ");if(r.length<7)return null;let a=r[6],l=a.includes("PENDING"),i=a.includes("FAILED"),n=a.includes("OK");return(0,s.jsxs)("tr",{className:`hover:bg-primary/5 transition-colors ${l?"bg-primary/5":""}`,children:[(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-text-muted",children:r[0]}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border font-medium",children:r[1]}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border",children:(0,s.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-bg-subtle border border-border text-[10px] uppercase font-bold",children:r[2]})}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border truncate max-w-[150px]",title:r[3],children:r[3]}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-primary",children:r[4]}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-success",children:r[5]}),(0,s.jsx)("td",{className:`px-3 py-1.5 font-bold ${n?"text-success":i?"text-error":"text-primary animate-pulse"}`,children:a})]},t)})})]})})}),(0,s.jsx)("div",{className:"text-[10px] text-text-muted italic",children:"Logs are loaded from the request history database."})]})}},23936:(e,t,r)=>{r.d(t,{default:()=>o});var s=r(95155),a=r(12115),l=r(14051),i=r.n(l),n=r(35497);function o({isOpen:e,onSuccess:t,onClose:r}){let[l,i]=(0,a.useState)(""),[d,c]=(0,a.useState)(!1),[u,m]=(0,a.useState)(null),[x,p]=(0,a.useState)(!1),h=async()=>{if(!l.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:l.trim()})}),r=await e.json();if(!e.ok)throw Error(r.error||"Authentication failed");p(!0),setTimeout(()=>{t?.(),b()},1500)}catch(e){m(e.message)}finally{c(!1)}},b=()=>{i(""),m(null),p(!1),r?.()};return(0,s.jsx)(n.aF,{isOpen:e,onClose:b,title:"iFlow Cookie Authentication",children:(0,s.jsx)("div",{className:"space-y-4",children:x?(0,s.jsxs)("div",{className:"text-center py-8",children:[(0,s.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,s.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,s.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,s.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,s.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,s.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,s.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,s.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,s.jsx)("li",{children:"Login to your account"}),(0,s.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,s.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,s.jsx)("li",{children:"Paste it below"})]})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,s.jsx)("textarea",{value:l,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,s.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,s.jsx)("p",{className:"text-sm text-error",children:u})}),(0,s.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,s.jsx)(n.$n,{variant:"secondary",onClick:b,disabled:d,fullWidth:!0,children:"Cancel"}),(0,s.jsx)(n.$n,{onClick:h,loading:d,fullWidth:!0,children:"Authenticate"})]})]})})})}o.propTypes={isOpen:i().bool.isRequired,onSuccess:i().func,onClose:i().func}},25086:(e,t,r)=>{r.d(t,{CardSkeleton:()=>o,DataListSkeleton:()=>d,PageLoading:()=>i,Skeleton:()=>n,Spinner:()=>l,default:()=>c});var s=r(95155),a=r(31474);function l({size:e="md",className:t}){return(0,s.jsx)("span",{className:(0,a.cn)("material-symbols-outlined animate-spin text-brand-500 motion-reduce:animate-none",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[e],t),children:"progress_activity"})}function i({message:e="Loading..."}){return(0,s.jsxs)("div",{role:"status","aria-live":"polite","aria-label":e,className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,s.jsx)(l,{size:"xl"}),(0,s.jsx)("p",{className:"mt-4 text-text-muted",children:e})]})}function n({className:e,...t}){return(0,s.jsx)("div",{className:(0,a.cn)("animate-pulse rounded-[10px] bg-surface-2 motion-reduce:animate-none",e),...t})}function o({className:e}){return(0,s.jsxs)("div",{"aria-hidden":"true",className:(0,a.cn)("rounded-[14px] border border-border-subtle bg-surface p-6 shadow-[var(--shadow-soft)]",e),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)(n,{className:"h-4 w-24"}),(0,s.jsx)(n,{className:"size-10 rounded-[10px]"})]}),(0,s.jsx)(n,{className:"h-8 w-16 mb-2"}),(0,s.jsx)(n,{className:"h-3 w-20"})]})}function d({rows:e=4,label:t="Loading data",className:r}){return(0,s.jsx)("div",{role:"status","aria-label":t,className:(0,a.cn)("divide-y divide-border-subtle",r),children:Array.from({length:e},(e,t)=>(0,s.jsxs)("div",{"aria-hidden":"true",className:"grid grid-cols-[minmax(6rem,0.7fr)_minmax(0,1.3fr)] gap-4 py-4",children:[(0,s.jsx)(n,{className:"h-4 w-24 max-w-full"}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n,{className:"h-4 w-2/3"}),(0,s.jsx)(n,{className:"h-3 w-1/3"})]})]},t))})}function c({type:e="spinner",...t}){switch(e){case"page":return(0,s.jsx)(i,{...t});case"skeleton":return(0,s.jsx)(n,{...t});case"card":return(0,s.jsx)(o,{...t});default:return(0,s.jsx)(l,{...t})}}},28058:(e,t,r)=>{r.d(t,{default:()=>i});var s=r(95155),a=r(12115),l=r(81127);function i({isOpen:e,onClose:t,onAdd:r,addedNames:n=[]}){let[o,d]=(0,a.useState)([]),[c,u]=(0,a.useState)(!1),[m,x]=(0,a.useState)(""),[p,h]=(0,a.useState)("all"),[b,f]=(0,a.useState)(null),[g,v]=(0,a.useState)(null),[j,y]=(0,a.useState)({}),[N,k]=(0,a.useState)({}),[w,C]=(0,a.useState)({});(0,a.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,o.length]);let S=(0,a.useMemo)(()=>new Set(n),[n]),T=(0,a.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]),I=async e=>{if(!j[e.url]){k(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})}),r=await t.json(),s=r.tools||[],a=Array.isArray(e.toolNames)?e.toolNames:[],l=s.length>0?s.map(e=>e.name):a;y(t=>({...t,[e.url]:{tools:s,requiresAuth:!!r.requiresAuth,error:r.error}})),C(t=>({...t,[e.url]:Object.fromEntries(l.map(e=>[e,!0]))}))}catch(t){y(r=>({...r,[e.url]:{tools:[],error:t.message}}))}finally{k(t=>({...t,[e.url]:!1}))}}},$=(e,t)=>{let r=w[e]||{};C(s=>({...s,[e]:Object.fromEntries(Object.keys(r).map(e=>[e,t]))}))};return(0,s.jsx)(l.default,{isOpen:e,onClose:t,title:"Browse MCP Marketplace",size:"lg",children:(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.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,s.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,s.jsx)("option",{value:"all",children:"All"}),(0,s.jsx)("option",{value:"authless",children:"Authless"}),(0,s.jsx)("option",{value:"oauth",children:"OAuth"})]})]}),b&&(0,s.jsx)("div",{className:"px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:b}),c&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-xs py-4 justify-center",children:[(0,s.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}),(0,s.jsx)("span",{children:"Loading registry..."})]}),!c&&(0,s.jsxs)("div",{className:"flex flex-col gap-1 max-h-[60vh] overflow-y-auto",children:[0===T.length&&(0,s.jsx)("div",{className:"text-center text-xs text-text-muted py-6",children:"No servers match filter"}),T.map(e=>{let t=S.has(e.slug||e.name),a=g===e.url,l=j[e.url],i=N[e.url],n=w[e.url]||{},o=Object.keys(n),d=Object.values(n).filter(Boolean).length;return(0,s.jsxs)("div",{className:"rounded border border-transparent hover:border-border",children:[(0,s.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,s.jsx)("img",{src:e.iconUrl,alt:"",className:"size-7 rounded shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}):(0,s.jsx)("div",{className:"size-7 rounded bg-surface shrink-0"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,s.jsx)("span",{className:"font-medium text-xs",children:e.title}),e.oauth?(0,s.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-amber-500/10 text-amber-600",children:"OAuth"}):(0,s.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-green-500/10 text-green-600",children:"Authless"}),e.toolCount>0&&(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:[e.toolCount," tools"]})]}),e.description&&(0,s.jsx)("p",{className:"text-[10px] text-text-muted line-clamp-2 mt-0.5",children:e.description})]}),(0,s.jsx)("button",{onClick:()=>t?null:void(g===e.url?v(null):(v(e.url),I(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":a?"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":a?"Cancel":"+ Add"})]}),a&&(0,s.jsxs)("div",{className:"px-3 py-2 bg-surface/40 border-t border-border flex flex-col gap-2",children:[i&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-[10px] py-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined animate-spin text-[14px]",children:"progress_activity"}),(0,s.jsx)("span",{children:"Probing server for tools..."})]}),!i&&l?.requiresAuth&&(0,s.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&&l?.error&&!l?.requiresAuth&&(0,s.jsxs)("p",{className:"text-[10px] text-red-600 bg-red-500/10 px-2 py-1 rounded",children:["Probe failed: ",l.error]}),!i&&0===o.length&&!l?.requiresAuth&&!l?.error&&(0,s.jsx)("p",{className:"text-[10px] text-text-muted",children:"No tools advertised by server."}),!i&&o.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:[d,"/",o.length," tools enabled"]}),(0,s.jsxs)("div",{className:"flex gap-1",children:[(0,s.jsx)("button",{onClick:()=>$(e.url,!0),className:"text-[10px] text-primary hover:underline",children:"All"}),(0,s.jsx)("span",{className:"text-[10px] text-text-muted",children:"\xb7"}),(0,s.jsx)("button",{onClick:()=>$(e.url,!1),className:"text-[10px] text-primary hover:underline",children:"None"})]})]}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-1 max-h-40 overflow-y-auto",children:o.map(t=>(0,s.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,s.jsx)("input",{type:"checkbox",checked:!!n[t],onChange:()=>{var r;return r=e.url,void C(e=>({...e,[r]:{...e[r],[t]:!e[r]?.[t]}}))},className:"size-3"}),(0,s.jsx)("span",{className:"truncate",children:t})]},t))})]}),(0,s.jsx)("button",{onClick:()=>{let t,s;return s=Object.keys(t=w[e.url]||{}).filter(e=>t[e]),void(r?.({name:e.slug||e.name,title:e.title,description:e.description,url:e.url,transport:e.transport,oauth:e.oauth,toolNames:s}),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,s.jsxs)("div",{className:"text-[10px] text-text-muted text-right",children:[T.length," of ",o.length," servers"]})]})})}},28067:(e,t,r)=>{r.d(t,{default:()=>l});var s=r(95155),a=r(31474);function l({options:e=[],value:t,onChange:r,size:i="md",className:n,...o}){let d={sm:"h-9 text-xs sm:h-7",md:"h-10 text-sm sm:h-9",lg:"h-11 text-base"};return(0,s.jsx)("div",{role:"group",...o,className:(0,a.cn)("inline-flex items-center p-1 rounded-[10px] overflow-x-auto","bg-surface-2",n),children:e.map(e=>(0,s.jsxs)("button",{type:"button","aria-pressed":t===e.value,onClick:()=>r(e.value),className:(0,a.cn)("shrink-0 px-4 rounded-[8px] font-medium transition-all",d[i],t===e.value?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[e.icon&&(0,s.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[16px] mr-1.5",children:e.icon}),e.label]},e.value))})}},28815:(e,t,r)=>{r.d(t,{default:()=>o});var s=r(95155),a=r(12115),l=r(81127),i=r(92542),n=r(11059);function o({isOpen:e,onClose:t,title:r="Manual Configuration",description:d="",requirements:c=[],configs:u=[],instructions:m=[],note:x=""}){let{copy:p}=(0,n.C)(),[h,b]=(0,a.useState)(null);return(0,s.jsx)(l.default,{isOpen:e,onClose:t,title:r,size:"xl",children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[d&&(0,s.jsx)("p",{className:"text-sm leading-6 text-text-muted",children:d}),c.length>0&&(0,s.jsx)("div",{className:"rounded-lg border border-yellow-500/30 bg-yellow-500/10 px-3 py-2.5",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-[17px] text-yellow-600 dark:text-yellow-400",children:"warning"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-yellow-700 dark:text-yellow-300",children:"Configuration is not copy-ready yet"}),(0,s.jsx)("ul",{className:"mt-1 list-disc space-y-1 pl-4 text-xs leading-5 text-text-muted",children:c.map(e=>(0,s.jsx)("li",{children:e},e))})]})]})}),u.map((e,t)=>(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"break-words text-sm font-medium text-text-main",children:e.label||e.filename}),e.label&&e.filename&&(0,s.jsx)("p",{className:"mt-0.5 break-all font-mono text-[11px] text-text-muted",children:e.filename}),e.description&&(0,s.jsx)("p",{className:"mt-1 text-xs leading-5 text-text-muted",children:e.description})]}),(0,s.jsxs)(i.default,{variant:"ghost",size:"sm",onClick:()=>{var r;return r=e.content,void(p(r,`manualconfig-${t}`),b(t),setTimeout(()=>b(null),2e3))},className:"shrink-0",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:h===t?"check":"content_copy"}),h===t?"Copied!":"Copy"]})]}),(0,s.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})]},e.id||e.filename||t)),m.length>0&&(0,s.jsxs)("div",{className:"rounded-lg border border-border bg-surface/40 px-3 py-3",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-text-main",children:"Finish setup"}),(0,s.jsx)("ol",{className:"mt-2 list-decimal space-y-1.5 pl-5 text-xs leading-5 text-text-muted",children:m.map(e=>(0,s.jsx)("li",{children:e},e))})]}),x&&(0,s.jsx)("p",{className:"text-xs leading-5 text-text-muted",children:x})]})})}},29366:(e,t,r)=>{r.d(t,{A:()=>o});var s=r(95155),a=r(14051),l=r.n(a),i=r(28777),n=r(97677);function o({caps:e,className:t="",colorOverride:r,size:a=16}){if(!e)return null;let l=Object.keys(i.bs).filter(t=>e[t]);return 0===l.length?null:(0,s.jsx)("span",{className:`inline-flex items-center gap-0.5 ${t}`,children:l.map(e=>(0,s.jsx)(n.default,{text:`${i.bs[e].label} — ${i.bs[e].desc}`,children:(0,s.jsx)("span",{className:`material-symbols-outlined leading-none cursor-help ${r||i.bs[e].color}`,style:{fontSize:`${a}px`},children:i.bs[e].icon})},e))})}o.propTypes={caps:l().object,className:l().string,colorOverride:l().string,size:l().number}},30815:(e,t,r)=>{r.d(t,{default:()=>o});var s=r(95155),a=r(12115),l=r(14051),i=r.n(l),n=r(35497);function o({isOpen:e,onSuccess:t,onClose:r}){let[l,i]=(0,a.useState)(""),[d,c]=(0,a.useState)(""),[u,m]=(0,a.useState)(null),[x,p]=(0,a.useState)(!1),[h,b]=(0,a.useState)(!1),[f,g]=(0,a.useState)(!1),[v,j]=(0,a.useState)(!1),y=(0,a.useRef)(0),N=(0,a.useCallback)(async()=>{let e=++y.current;b(!0),m(null),g(!1),j(!1);try{let t=await fetch("/api/oauth/cursor/auto-import"),r=await t.json();if(y.current!==e)return;r.found?(i(r.accessToken),c(r.machineId),g(!0)):r.windowsManual?j(!0):m(r.error||"Could not auto-detect tokens")}catch(t){y.current===e&&m("Failed to auto-detect tokens")}finally{y.current===e&&b(!1)}},[]);(0,a.useEffect)(()=>{e?(i(""),c(""),m(null),g(!1),j(!1),N()):y.current++},[e,N]);let k=async()=>{if(!l.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:l.trim(),machineId:d.trim()})}),s=await e.json();if(!e.ok)throw Error(s.error||"Import failed");t?.(),r()}catch(e){m(e.message)}finally{p(!1)}};return(0,s.jsx)(n.aF,{isOpen:e,title:"Connect Cursor IDE",onClose:r,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[h&&(0,s.jsxs)("div",{className:"text-center py-6",children:[(0,s.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,s.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting tokens..."}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from Cursor IDE database"})]}),!h&&(0,s.jsxs)(s.Fragment,{children:[f&&(0,s.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,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,s.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Tokens auto-detected from Cursor IDE successfully!"})]})}),v&&(0,s.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,s.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,s.jsx)("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Could not read Cursor database automatically."})]}),(0,s.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,s.jsx)("strong",{children:"Retry"}),". If the problem persists, paste your tokens manually below."]}),(0,s.jsx)(n.$n,{onClick:N,variant:"outline",fullWidth:!0,children:"Retry"})]}),!f&&!v&&!u&&(0,s.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,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,s.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Cursor IDE not detected. Please paste your tokens manually."})]})}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsx)("textarea",{value:l,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,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Machine ID ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsx)(n.pd,{value:d,onChange:e=>c(e.target.value),placeholder:"Machine ID will be auto-filled...",className:"font-mono text-sm"})]}),u&&(0,s.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,s.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:u})}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(n.$n,{onClick:k,fullWidth:!0,disabled:x||!l.trim()||!d.trim(),children:x?"Importing...":"Import Token"}),(0,s.jsx)(n.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}o.propTypes={isOpen:i().bool.isRequired,onSuccess:i().func,onClose:i().func.isRequired}},31474:(e,t,r)=>{r.d(t,{cn:()=>s});function s(...e){return e.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}},33315:(e,t,r)=>{r.d(t,{o:()=>a});let s="[redacted]";function a(e,t=[]){if("string"!=typeof e)return"";let r=e.replace(/\s+/g," ").trim();if(!r)return"";let l=(Array.isArray(t)?t:[t]).filter(e=>"string"==typeof e&&e.trim()),i=new Set;for(let e of l){let t=e.trim();for(let e of(t.length>=4&&i.add(t),t.split(/[\s"'`;,:=&?{}[\]()<>]+/)))e.length>=8&&i.add(e)}for(let e of[...i].sort((e,t)=>t.length-e.length))r=r.replace(RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),s);return(r=r.replace(/([?&](?:key|api_key|token|access_token)=)[^&\s]+/gi,`$1${s}`)).length>240?`${r.slice(0,239)}…`:r}},35497:(e,t,r)=>{r.d(t,{x0:()=>I.default,Ex:()=>d.default,Go:()=>c.default,$n:()=>s.default,Zp:()=>i.default,Qv:()=>o.CardSkeleton,zE:()=>w.default,xl:()=>k.default,CK:()=>b.default,uo:()=>n.ConfirmModal,mz:()=>x.default,G9:()=>y.default,i5:()=>P.DashboardToolbar,wI:()=>T.default,pp:()=>P.EmptyState,Gi:()=>P.FeedbackPanel,vj:()=>C.default,vE:()=>N.default,pd:()=>a.default,Mh:()=>j.default,uR:()=>h.default,Nf:()=>f.default,aF:()=>n.default,rq:()=>p.default,gw:()=>$.default,LF:()=>m.default,dK:()=>E.default,Wx:()=>R.default,gM:()=>v.default,w:()=>P.SectionHeading,Iz:()=>A.default,l6:()=>l.default,lM:()=>u.default,m_:()=>O.default,jK:()=>g.default,LH:()=>S.default});var s=r(92542),a=r(11910),l=r(98),i=r(84588),n=r(81127),o=r(25086);r(56319);var d=r(56061),c=r(39835),u=r(98542);r(38587),r(21110),r(92622),r(8823),r(92173);var m=r(90882),x=r(67597),p=r(37384),h=r(28815),b=r(45455),f=r(28058),g=r(55060);r(21931),r(80752),r(40197);var v=r(23615);r(61500);var j=r(62899);r(94230);var y=r(30815),N=r(23936),k=r(21286),w=r(65428),C=r(95088),S=r(40684),T=r(73579),I=r(96748),$=r(4823),A=r(28067),O=r(97677),R=r(51825),E=r(50378),P=r(58041);r(7648),r(91450)},37384:(e,t,r)=>{r.d(t,{default:()=>w});var s=r(95155),a=r(12115),l=r(14051),i=r.n(l),n=r(81127),o=r(57250),d=r(28777),c=r(1791),u=r(12252),m=r(40671);function x(){return{raw:"",isEmpty:!0,isRegex:!1,regex:null,positiveTerms:[],negativeTerms:[]}}function p(e){if(!e||"string"!=typeof e)return x();let t=e.trim();if(!t)return x();if(t.startsWith("/")){let e=t.match(/^\/(.+)\/([a-z]*)$/i);try{if(e)return{raw:t,isEmpty:!1,isRegex:!0,regex:new RegExp(e[1],e[2]||"i"),positiveTerms:[],negativeTerms:[]};if(t.length>1)return{raw:t,isEmpty:!1,isRegex:!0,regex:RegExp(t.slice(1),"i"),positiveTerms:[],negativeTerms:[]}}catch{}}let r=[],s=[];for(let e of t.split(/\s+/))e&&((e.startsWith("!")||e.startsWith("-"))&&e.length>1?s.push(e.slice(1).toLowerCase()):r.push(e.toLowerCase()));return{raw:t,isEmpty:0===r.length&&0===s.length,isRegex:!1,regex:null,positiveTerms:r,negativeTerms:s}}function h(e,t){return e.lastIndex=0,e.test(t)}function b(e,t){let r="string"!=typeof t&&t?t:p(t);if(r.isEmpty)return!0;let s=[];if("string"==typeof e?s=[e]:Array.isArray(e)?s=e.filter(e=>"string"==typeof e):e&&"object"==typeof e&&(s=[e.name,e.id,e.value,e.alias,e.provider].filter(e=>"string"==typeof e)),0===s.length)return!1;if(r.isRegex&&r.regex){let e=s.join(" ");return/\(\?!|\(\?<!/.test(r.raw)?h(r.regex,e):s.some(e=>h(r.regex,e))||h(r.regex,e)}let a=s.map(e=>e.toLowerCase());return!r.negativeTerms.some(e=>a.some(t=>t.includes(e)))&&r.positiveTerms.every(e=>a.some(t=>t.includes(e)))}var f=r(929),g=r(29366);function v(e){return(0,c.mq)(e)||(0,c.gb)(e)}var j=r(70217);let y=[...Object.keys(c.zN),...Object.keys(c.IS),...Object.keys(c.nJ),...Object.keys(c.fg)],N=Object.keys(c.IS).filter(e=>c.IS[e].noAuth);function k({isOpen:e,onClose:t,onSelect:r,onDeselect:l,onSelectBatch:i,onDeselectBatch:x,selectedModel:h,activeProviders:w=[],title:C="Select Model",modelAliases:S={},kindFilter:T=null,addedModelValues:I=[],closeOnSelect:$=!0,includeCombos:A=!0,capFilter:O=null}){let{getCaps:R}=(0,f.y)(),E=(0,a.useMemo)(()=>T?w.filter(e=>{let t=c.Q2[e.provider];return(t?.serviceKinds||["llm"]).includes(T)}):w,[w,T]),[P,_]=(0,a.useState)(""),[M,z]=(0,a.useState)([]),[q,L]=(0,a.useState)([]),[U,D]=(0,a.useState)([]),[F,W]=(0,a.useState)({}),[B,K]=(0,a.useState)(null),J=(0,u.F)(e&&w.some(e=>"kiro"===e.provider)),V=(0,m.M)(e&&w.some(e=>"aistudio"===e.provider)),G=async e=>{try{let t=await fetch("/api/combos",{signal:e});if(!t.ok)throw Error(`Failed to fetch combos: ${t.status}`);let r=await t.json();z(r.combos||[])}catch(e){if(e?.name==="AbortError")return;console.error("Error fetching combos:",e),z([])}},H=async e=>{try{let t=await fetch("/api/provider-nodes",{signal:e});if(!t.ok)throw Error(`Failed to fetch provider nodes: ${t.status}`);let r=await t.json();L(r.nodes||[])}catch(e){if(e?.name==="AbortError")return;console.error("Error fetching provider nodes:",e),L([])}},Q=async e=>{try{let t=await fetch("/api/models/custom",{signal:e});if(!t.ok)throw Error(`Failed to fetch custom models: ${t.status}`);let r=await t.json();D(r.models||[])}catch(e){if(e?.name==="AbortError")return;console.error("Error fetching custom models:",e),D([])}},X=async e=>{try{let t=await fetch("/api/models/disabled",{signal:e});if(!t.ok)throw Error(`Failed to fetch disabled models: ${t.status}`);let r=await t.json();W(r.disabled||{})}catch(e){if(e?.name==="AbortError")return;console.error("Error fetching disabled models:",e),W({})}},Z=async e=>{try{let t=await fetch("/api/providers",{signal:e,cache:"no-store"});if(!t.ok)throw Error(`Failed to fetch providers: ${t.status}`);let r=await t.json();K(r.connections||[])}catch(e){if(e?.name==="AbortError")return;console.error("Error fetching providers in ModelSelectModal:",e),K([])}};(0,a.useEffect)(()=>{if(!e)return;let t=new AbortController;return Z(t.signal),()=>t.abort()},[e]);let Y=null!==B?B:w||[],ee=(0,a.useMemo)(()=>(0,j.io)(Y),[Y]);(0,a.useEffect)(()=>{let e=new AbortController;return Promise.all([G(e.signal),H(e.signal),Q(e.signal),X(e.signal)]),()=>e.abort()},[]);let et=(0,a.useMemo)(()=>({...c.zN,...c.IS,...c.nJ,...c.fg}),[]),er=(0,a.useMemo)(()=>{let t={};if(!e)return t;let r=new Set(["webSearch","webFetch"]),s=new Set(["image","tts","stt","embedding","imageToText","systemone"]),a=new Set(["tts","image","webFetch"]);return[...new Set([...E.map(e=>e.provider),...T?N.filter(e=>(c.Q2[e]?.serviceKinds||["llm"]).includes(T)):N,...(function({kindFilter:e=null,providerNodes:t=[],customModels:r=[],modelAliases:s={}}={}){if(e)return[];let a=new Set((t||[]).map(e=>e?.id).filter(Boolean)),l=new Set;for(let e of r||[]){let t=e?.providerAlias;a.has(t)&&v(t)&&l.add(t)}for(let e of Object.values(s||{})){let t=String(e||"").split("/")[0];a.has(t)&&v(t)&&l.add(t)}return[...l]})({kindFilter:T,providerNodes:q,customModels:U,modelAliases:S}).filter(e=>!ee.has(e))].filter(e=>!ee.has(e)))].sort((e,t)=>{let r=y.indexOf(e),s=y.indexOf(t);return(-1===r?999:r)-(-1===s?999:s)}).forEach(e=>{let l=(0,c.wG)(e),i=et[e]||{name:e,color:"#666"},n=(0,c.mq)(e)||(0,c.gb)(e);if(T&&r.has(T)){t[e]={name:i.name,alias:l,color:i.color,models:[{id:e,name:i.name,value:e}]};return}if(i.passthroughModels){let r=Object.entries(S).filter(([,e])=>e.startsWith(`${l}/`)).map(([e,t])=>({id:t.replace(`${l}/`,""),name:e,value:t}));if(T&&s.has(T)&&0===(r=(0,d.KC)(e).filter(e=>e.type===T).map(e=>({id:e.id,name:e.name,value:`${l}/${e.id}`,type:e.type}))).length&&a.has(T)&&(i.serviceKinds||["llm"]).includes(T)&&(r=[{id:e,name:i.name,value:l}]),r.length>0){let s=q.find(t=>t.id===e),a=s?.name||i.name;t[e]={name:a,alias:l,color:i.color,models:r}}}else if(n){if(T&&s.has(T))return;let r=w.find(t=>t.provider===e),a=q.find(t=>t.id===e),l=r?.name||a?.name||i.name,n=r?.providerSpecificData?.prefix||a?.prefix||e,o=function({providerId:e,nodePrefix:t,modelAliases:r={},customModels:s=[]}){let a=t||e,l=Object.entries(r).filter(([,t])=>String(t||"").startsWith(`${e}/`)).map(([t,r])=>{let s=String(r).slice(e.length+1);return{id:s,name:t,value:`${a}/${s}`}}),i=new Set(l.map(e=>e.value));return[...l,...(s||[]).filter(t=>t?.providerAlias===e&&t?.id).map(e=>({id:e.id,name:e.name||e.id,value:`${a}/${e.id}`,isCustom:!0})).filter(e=>!i.has(e.value))]}({providerId:e,nodePrefix:n,modelAliases:S,customModels:U}),d=o.length>0?o:[{id:`__placeholder__${e}`,name:`${n}/model-id`,value:`${n}/model-id`,isPlaceholder:!0}];t[e]={name:l,alias:n,color:i.color,models:d,isCustom:!0,hasModels:o.length>0}}else{var o;let r="kiro"===e?J:(0,m.Q)(e,V,(0,d.KC)(e)),n=new Set(r.map(e=>e.id)),c=r.length>0,u=Object.entries(S).filter(([e,t])=>t.startsWith(`${l}/`)&&(!c||e===t.replace(`${l}/`,""))&&!n.has(t.replace(`${l}/`,""))).map(([e,t])=>({id:t.replace(`${l}/`,""),name:e,value:t,isCustom:!0})),x=new Set(u.map(e=>e.id)),p=U.filter(e=>e.providerAlias===l&&!n.has(e.id)&&!x.has(e.id)).map(e=>({id:e.id,name:e.name||e.id,value:`${l}/${e.id}`,isCustom:!0})),h=[...r.map(e=>({id:e.id,name:e.name,value:`${l}/${e.id}`,type:e.type})),...u,...p],b=new Set,f=(o=h.filter(e=>!b.has(e.value)&&(b.add(e.value),!0)),T?s.has(T)?o.filter(e=>e.isPlaceholder||e.type===T):o:o.filter(e=>e.isPlaceholder||!e.type||"llm"===e.type));0===f.length&&T&&a.has(T)&&(i.serviceKinds||["llm"]).includes(T)&&(f=[{id:e,name:i.name,value:l}]),f.length>0&&(t[e]={name:i.name,alias:l,color:i.color,models:f})}}),Object.entries(t).forEach(([e,r])=>{let s=new Set([...F[(0,c.wG)(e)]||[],...F[e]||[]]);0!==s.size&&(r.models=r.models.filter(e=>!s.has(e.id)),0===r.models.length&&delete t[e])}),t},[e,E,S,et,q,U,F,T,w,J,V,ee]),es=(0,a.useMemo)(()=>p(P),[P]),ea=(0,a.useMemo)(()=>T||O||!1===A?[]:es.isEmpty?M:M.filter(e=>b(e.name,es)),[M,es,T,O,A]),el=(0,a.useMemo)(()=>{let e={};return Object.entries(er).forEach(([t,r])=>{var s;let a=r.models;if(!O||0!==(a=a.filter(e=>R(e.value)?.[O]===!0)).length){if(!es.isEmpty){let e=b(r.name,es),s=b(r.alias,es)||b(t,es)||b(`${r.alias}/*`,es);if(0===(a=a.filter(t=>!!b(t,es)||(!!e||!!s)&&(!(es.negativeTerms.length>0)||b(t,{...es,positiveTerms:[]})))).length)return}e[t]={...r,models:[...(s=a).filter(e=>I.includes(e.value)).sort((e,t)=>e.name.localeCompare(t.name)),...s.filter(e=>!I.includes(e.value)).sort((e,t)=>e.name.localeCompare(t.name))]}}}),e},[er,es,I,O,R]),ei=(0,a.useMemo)(()=>{let e=[];return Object.values(el).forEach(t=>{t.models.forEach(t=>{t.isPlaceholder||e.push(t)})}),e},[el]),en=ei.filter(e=>!I.includes(e.value)),eo=ei.filter(e=>I.includes(e.value)),ed=e=>{let s=e?.value||e?.name||e;I.includes(s)&&l?l(e):r(e),$&&(t(),_(""))};return(0,s.jsxs)(n.default,{isOpen:e,onClose:()=>{t(),_("")},title:C,size:"md",className:"p-4!",footer:null,children:[(0,s.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,s.jsx)("span",{className:"material-symbols-outlined text-primary shrink-0",style:{fontSize:"14px"},children:"info"}),(0,s.jsx)("span",{children:"Click to add, click again to remove. Search supports exclusions and /regex/."})]}),(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.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,s.jsx)("input",{type:"text",placeholder:"Search models (e.g. claude -haiku, !embed, /regex/)...",value:P,onChange:e=>_(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"})]}),!$&&ei.length>0&&(0,s.jsxs)("div",{className:"mt-2 flex items-center justify-between px-1 text-[11px] text-text-muted",children:[(0,s.jsxs)("span",{children:[ei.length," models"]}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[en.length>0&&(0,s.jsxs)("button",{type:"button",onClick:()=>{0!==en.length&&(i?i(en):en.forEach(e=>r(e)))},className:"cursor-pointer rounded bg-primary/10 px-2 py-0.5 font-medium text-primary",children:["Select All (",en.length,")"]}),eo.length>0&&l&&(0,s.jsxs)("button",{type:"button",onClick:()=>{0!==eo.length&&l&&(x?x(eo):eo.forEach(e=>l(e)))},className:"cursor-pointer rounded bg-border/40 px-2 py-0.5 font-medium text-text-muted",children:["Deselect All (",eo.length,")"]})]})]})]}),(0,s.jsxs)("div",{className:"max-h-[400px] overflow-y-auto space-y-3",children:[ea.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-primary text-[14px]",children:"layers"}),(0,s.jsx)("span",{className:"text-xs font-medium text-primary",children:"Combos"}),(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",ea.length,")"]})]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:ea.map(e=>{let t=h===e.name;return(0,s.jsxs)("button",{onClick:()=>ed({id:e.name,name:e.name,value:e.name}),className:`
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5497],{98:(e,t,r)=>{r.d(t,{default:()=>i});var s=r(95155),a=r(12115),l=r(31474);function i({label:e,options:t=[],value:r,onChange:n,placeholder:o="Select an option",error:d,hint:c,disabled:u=!1,required:m=!1,className:x,selectClassName:p,...h}){let b=(0,a.useId)(),f=h.id||b,g=`${f}-error`,v=`${f}-hint`,j=[h["aria-describedby"],d&&g,c&&v].filter(Boolean).join(" ")||void 0;return(0,s.jsxs)("div",{className:(0,l.cn)("flex flex-col gap-1.5",x),children:[e&&(0,s.jsxs)("label",{htmlFor:f,className:"text-sm font-medium text-text-main",children:[e,m&&(0,s.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsxs)("select",{id:f,value:r,onChange:n,disabled:u,required:m,"aria-invalid":!!d||void 0,"aria-describedby":j,className:(0,l.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:border-brand-500/40 focus-visible:ring-2 focus-visible:ring-brand-500/30","transition-[border-color,box-shadow,background-color] duration-150 disabled:opacity-50 disabled:cursor-not-allowed motion-reduce:transition-none","text-[16px] sm:text-sm",d&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",p),...h,children:[(0,s.jsx)("option",{value:"",disabled:!0,children:o}),t.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,s.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"expand_more"})})]}),d&&(0,s.jsxs)("p",{id:g,role:"alert",className:"text-xs text-red-500 flex items-center gap-1",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[14px]",children:"error"}),d]}),c&&!d&&(0,s.jsx)("p",{id:v,className:"text-xs text-text-muted",children:c})]})}},929:(e,t,r)=>{r.d(t,{y:()=>d});var s=r(12115),a=r(67899),l=r(1791);let i=null,n=null;function o(){return i?Promise.resolve(i):n||(n=fetch("/api/models").then(async e=>{if(!e.ok)throw Error(`models ${e.status}`);return i=function(e){let t={},r={};for(let s of e||[])s.caps&&(s.fullModel&&(t[s.fullModel]=s.caps),s.routedModel&&(t[s.routedModel]=s.caps),s.model&&(r[s.model]=s.caps));return{byFull:t,byId:r}}((await e.json()).models)}).catch(()=>({byFull:{},byId:{}})).finally(()=>{n=null}))}function d(){let[e,t]=(0,s.useState)(()=>i?.byFull||{}),[r,n]=(0,s.useState)(()=>i?.byId||{});return(0,s.useEffect)(()=>{let e=!0,r=r=>{e&&(t(r.byFull||{}),n(r.byId||{}))};i?r(i):o().then(r);let s=()=>{i=null,o().then(r)};return window.addEventListener("customModelChanged",s),()=>{e=!1,window.removeEventListener("customModelChanged",s)}},[]),{getCaps:(0,s.useCallback)(t=>(function(e,t,r){if(!r)return null;if(e[r])return e[r];let s=r.includes("/")?r.slice(r.indexOf("/")+1):r;if(t[s])return t[s];let i=r.includes("/")?r.slice(0,r.indexOf("/")):null,n=i?l.js[i]||i:null,o=(0,a.nl)(n,s);return{vision:o.vision,pdf:o.pdf,audioInput:o.audioInput,videoInput:o.videoInput,search:o.search,reasoning:o.reasoning,contextWindow:o.contextWindow,maxOutput:o.maxOutput,thinkingFormat:o.thinkingFormat}})(e,r,t),[e,r])}}},1620:(e,t,r)=>{r.d(t,{D:()=>o});var s=r(12115),a=r(90085);function l(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 n(){return!1}function o(){let{theme:e,setTheme:t,toggleTheme:r,initTheme:o}=(0,a.A)(),d=(0,s.useSyncExternalStore)(l,i,n);(0,s.useEffect)(()=>{o()},[o]),(0,s.useEffect)(()=>{if("system"!==e)return;let t=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>o();return t.addEventListener("change",r),()=>t.removeEventListener("change",r)},[e,o]);let c="dark"===e||"system"===e&&d;return{theme:e,setTheme:t,toggleTheme:r,isDark:c}}},4823:(e,t,r)=>{r.d(t,{default:()=>x});var s=r(95155),a=r(12115),l=r(14051),i=r.n(l),n=r(84588),o=r(98),d=r(56061),c=r(98542);let u="__none__",m=[{value:"none",label:"None (single pool)"},{value:"round-robin",label:"Round-robin"},{value:"random",label:"Random"}];function x({providerId:e}){let[t,r]=(0,a.useState)([]),[l,i]=(0,a.useState)(u),[p,h]=(0,a.useState)("none"),[b,f]=(0,a.useState)(!1),[g,v]=(0,a.useState)(!1),[j,y]=(0,a.useState)(!1);(0,a.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(([s,a])=>{if(t)return;r(s.proxyPools||[]);let l=(a.providerStrategies||{})[e]||{};i(l.proxyPoolId||u),h(l.rotateStrategy||"none"),f(!0===l.freeWarpMode)}).catch(()=>{}),()=>{t=!0}},[e]);let N=(0,a.useCallback)(async(t,r,s)=>{v(!0);try{let a=await fetch("/api/settings",{cache:"no-store"}),l=(a.ok?await a.json():{}).providerStrategies||{},i={...l[e]||{}};t===u?delete i.proxyPoolId:i.proxyPoolId=t,"none"===r?delete i.rotateStrategy:i.rotateStrategy=r,s?i.freeWarpMode=!0:delete i.freeWarpMode;let n={...l};0===Object.keys(i).length?delete n[e]:n[e]=i,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:n})}),y(!0),setTimeout(()=>y(!1),1500)}catch(e){console.log("Save proxy config error:",e)}finally{v(!1)}},[e]),k=t.length>=2,w="none"!==p;return(0,s.jsxs)(n.default,{children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,s.jsx)("div",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-green-500/10 text-green-500",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"lock_open"})}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"No authentication required"}),(0,s.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."})]}),j&&(0,s.jsx)(d.default,{variant:"success",size:"sm",children:"Saved"})]}),"opencode"===e&&(0,s.jsx)("div",{className:"mb-4 rounded-lg border border-emerald-500/30 bg-emerald-500/5 p-3.5",children:(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsx)(c.default,{checked:b,onChange:e=>{f(e),N(l,p,e)},disabled:g,label:"Free WARP IPv6 Auto-Mint Mode ($0 Zero-Proxy Anti-429)",description:"100% Single-Model Lock (no model ping-pong). Uses Direct IP + auto-minted Cloudflare WARP /128 IPv6 tunnels (wgcf + wireproxy) on macOS, Ubuntu/Linux, and Windows whenever 429 hits — no paid proxy needed."}),b&&(0,s.jsx)(d.default,{variant:"success",size:"sm",children:"Active \xb7 Free IPv6"})]})}),(0,s.jsx)(o.default,{label:"Proxy Pool",value:l,onChange:e=>{var t;i(t=e.target.value),N(t,p,b)},disabled:g||w||b,options:[{value:u,label:"None (direct)"},...t.map(e=>({value:e.id,label:e.name}))],hint:w?"Pool selector is ignored when rotation is active — all active pools are used.":void 0}),(0,s.jsxs)("div",{className:"flex flex-col gap-2 mt-4",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-text-main",children:"Rotation Strategy"}),(0,s.jsx)("select",{value:p,onChange:e=>{var t;h(t=e.target.value),N(l,t,b)},disabled:g,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:m.map(e=>(0,s.jsx)("option",{value:e.value,disabled:"none"!==e.value&&!k,children:e.label},e.value))}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:k?w?"round-robin"===p?`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."})]})]})}x.propTypes={providerId:i().string.isRequired}},7648:(e,t,r)=>{r.d(t,{default:()=>c});var s=r(95155),a=r(12115),l=r(73321),i=r(65921),n=r(92622),o=r(8823),d=r(91852);function c({children:e}){let[t,r]=(0,a.useState)(!1),u=(0,a.useRef)(null),m=(0,a.useRef)(null),x=(0,l.usePathname)(),p=(0,i.i)(e=>e.notifications),h=(0,i.i)(e=>e.removeNotification),b="/dashboard/playground"===x||"/dashboard/basic-chat"===x,f="/dashboard/terminal"===x,g=b||f;return(0,a.useEffect)(()=>{if(!t)return;let e=m.current;u.current?.focus();let s=e=>{if("Escape"===e.key)return void r(!1);if("Tab"!==e.key||!u.current)return;let t=[...u.current.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')],s=t[0],a=t[t.length-1];s?e.shiftKey&&(document.activeElement===s||document.activeElement===u.current)?(e.preventDefault(),a.focus()):e.shiftKey||document.activeElement!==a||(e.preventDefault(),s.focus()):e.preventDefault()};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),e?.focus()}},[t]),(0,s.jsxs)("div",{className:"dashboard-shell relative isolate flex h-screen w-full overflow-hidden bg-bg",children:[(0,s.jsx)(d.A,{quiet:!0}),(0,s.jsx)("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-[100] focus:rounded-lg focus:bg-surface focus:px-4 focus:py-2 focus:text-text-main focus:shadow-lg",children:"Skip to main content"}),(0,s.jsx)("div",{"aria-live":"polite","aria-relevant":"additions text",className:"fixed top-3 right-3 z-[80] flex w-[min(calc(100vw-1.5rem),380px)] flex-col gap-2 sm:top-4 sm:right-4",children:p.map(e=>{var t;let r="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,s.jsx)("div",{role:"error"===e.type?"alert":"status",className:`rounded-lg border px-3 py-2 shadow-lg backdrop-blur-sm ${r.wrapper}`,children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[18px] leading-5",children:r.icon}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[e.title?(0,s.jsx)("p",{className:"text-xs font-semibold mb-0.5",children:e.title}):null,(0,s.jsx)("p",{className:"text-xs whitespace-pre-wrap break-words",children:e.message})]}),e.dismissible?(0,s.jsx)("button",{type:"button",onClick:()=>h(e.id),className:"-m-2 grid size-11 shrink-0 place-items-center rounded-lg text-current/70 transition-colors hover:bg-current/10 hover:text-current focus:outline-none focus-visible:ring-2 focus-visible:ring-current/40 sm:-m-1 sm:size-9","aria-label":"Dismiss notification",children:(0,s.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[16px]",children:"close"})}):null]})},e.id)})}),t&&(0,s.jsx)("button",{type:"button",className:"fixed inset-0 z-40 bg-black/30 backdrop-blur-[1px] lg:hidden",onClick:()=>r(!1),"aria-label":"Close dashboard navigation"}),(0,s.jsx)("div",{className:"hidden lg:flex",children:(0,s.jsx)(n.default,{})}),t&&(0,s.jsx)("div",{ref:u,role:"dialog","aria-modal":"true","aria-label":"Dashboard navigation",tabIndex:-1,className:"fixed inset-y-0 left-0 z-50 h-dvh min-h-0 max-h-dvh lg:hidden focus:outline-none",children:(0,s.jsx)(n.default,{onClose:()=>r(!1)})}),(0,s.jsxs)("main",{id:"main-content",tabIndex:-1,className:"flex flex-col flex-1 h-full min-w-0 relative transition-colors duration-300 isolate",children:[g?(0,s.jsxs)("div",{className:"lg:hidden shrink-0 flex min-h-12 items-center gap-2 px-2 py-1 border-b border-border-subtle bg-surface/60",children:[(0,s.jsx)("button",{ref:m,type:"button",onClick:()=>r(!0),className:"flex size-11 shrink-0 items-center justify-center rounded-lg text-text-main hover:bg-surface-2 focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40","aria-label":"Open dashboard navigation",children:(0,s.jsx)("span",{className:"material-symbols-outlined",children:"menu"})}),(0,s.jsx)("span",{className:"text-sm font-semibold",children:f?"Terminal":"Playground"})]}):(0,s.jsx)(o.default,{menuButtonRef:m,onMenuClick:()=>r(!0)},x),(0,s.jsx)("div",{className:`dashboard-content-gutter flex-1 overflow-y-auto custom-scrollbar ${g?"":"px-3 py-4 sm:px-6 sm:py-7 lg:px-10 lg:py-8"} ${g?"flex flex-col overflow-hidden":""}`,children:(0,s.jsx)("div",{className:`${g?"flex-1 w-full h-full flex flex-col min-h-0":"w-full min-w-0 max-w-6xl mx-auto"}`,children:e})})]})]})}},8823:(e,t,r)=>{r.d(t,{default:()=>y});var s=r(95155),a=r(12115),l=r(73321),i=r(98500),n=r.n(i),o=r(14051),d=r.n(o),c=r(57250),u=r(80752),m=r(93308),x=r(38202),p=r(21931);function h(){let[e,t]=(0,a.useState)(!1),[r,l]=(0,a.useState)("en");return(0,a.useEffect)(()=>{l(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,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{onClick:()=>t(!0),className:"flex size-11 items-center justify-center rounded-xl text-text-muted transition-all hover:bg-black/5 hover:text-text-main dark:hover:bg-white/5 sm:size-10 sm:rounded-lg",title:"Language","aria-label":"Change language","data-i18n-skip":"true",children:(0,s.jsx)("span",{className:"text-lg leading-none",children:x.h[r]||"\uD83C\uDF10"})}),(0,s.jsx)(p.default,{hideTrigger:!0,isOpen:e,onClose:e=>{t(!1),l(e)}})]})}var b=r(38587),f=r(38003),g=r(90620),v=r(1791),j=r(73006);function y({onMenuClick:e,showMenuButton:t=!0,menuButtonRef:r}){let i=(0,l.usePathname)(),o=(0,l.useRouter)(),[d,m]=(0,a.useState)(""),[x,p]=(0,a.useState)(""),{title:f,description:k,icon:w,breadcrumbs:C}=(0,a.useMemo)(()=>(e=>{if(!e)return{title:"",description:"",breadcrumbs:[]};let t=e.match(/\/media-providers\/([^/]+)\/([^/]+)$/);if(t){let e=t[1],r=t[2],s=v.rj.find(t=>t.id===e),a=v.Q2[r];return{title:a?.name||r,description:"",breadcrumbs:[{label:"Media Providers",href:`/dashboard/media-providers/${e}`},{label:s?.label||e,href:`/dashboard/media-providers/${e}`},{label:a?.name||r,image:`/providers/${r}.png`}]}}let r=e.match(/\/media-providers\/([^/]+)$/);if(r){let e=r[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 s=e.match(/\/providers\/([^/]+)$/);if(s){let e=s[1],t=g.zN[e]||g.fg[e];if(t)return{title:t.name,description:"",breadcrumbs:[{label:"Providers",href:"/dashboard/providers"},{label:t.name,image:`/providers/${t.id}.png`}]}}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 ZevaiRouter",icon:"security",breadcrumbs:[]}:e.includes("/cli-tools")?{title:"CLI Tools",description:"Configure CLI tools",icon:"handyman",breadcrumbs:[]}:e.includes("/terminal")?{title:"Terminal",description:"Host web shell — requires a second password",icon:"terminal",breadcrumbs:[]}:e.includes("/automation")?{title:"Automation",description:"Bulk account and workflow automation",icon:"automation",breadcrumbs:[]}:e.includes("/token-saver")?{title:"Token Saver",description:"Reduce prompt tokens before they hit providers",icon:"savings",breadcrumbs:[]}:e.includes("/context")?{title:"Context Inject",description:"Inject shared context into routed requests",icon:"psychology",breadcrumbs:[]}:e.includes("/pxpipe")?{title:"PxPipe",description:"Proxy pipeline status and controls",icon:"cable",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 ZevaiRouter — no install needed",icon:"extension",breadcrumbs:[]}:e.includes("/endpoint")?{title:"Endpoint",description:"API endpoint configuration",icon:"terminal",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:[]}:e.includes("/playground")||e.includes("/basic-chat")?{title:"Playground",description:"Chat with any connected model through ZevaiRouter",icon:"forum",breadcrumbs:[]}:"/dashboard"===e?{title:"Endpoint",description:"API endpoint configuration",icon:"terminal",breadcrumbs:[]}:{title:"",description:"",breadcrumbs:[]}})(i),[i]);(0,a.useEffect)(()=>{let e=!1;return async function(){try{let t=await fetch("/api/auth/status",{cache:"no-store"});if(!t.ok)return;let r=await t.json();e||(m(r?.displayName||r?.oidcName||r?.oidcEmail||""),p(r?.loginMethod||""))}catch{e||(m(""),p(""))}}(),()=>{e=!0}},[]);let S=async()=>{try{await fetch("/api/auth/logout",{method:"POST"})}catch(e){console.error("Failed to logout:",e)}o.push("/login"),o.refresh()};return(0,s.jsxs)("header",{className:"dashboard-topbar relative z-20 shrink-0 flex min-h-16 flex-wrap items-center justify-between gap-2 border-b border-border-subtle bg-surface/90 px-3 py-2.5 shadow-[0_12px_35px_-34px_rgba(15,23,42,0.8)] backdrop-blur-sm sm:gap-3 sm:px-4 sm:py-3 lg:min-h-[76px] lg:px-8",children:[(0,s.jsx)("div",{className:"flex items-center gap-2 lg:hidden shrink-0",children:t&&(0,s.jsx)("button",{ref:r,type:"button",onClick:e,className:"flex size-11 items-center justify-center rounded-xl text-text-main transition-colors hover:bg-surface-2 hover:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 sm:size-10 sm:rounded-lg","aria-label":"Open dashboard navigation",children:(0,s.jsx)("span",{className:"material-symbols-outlined",children:"menu"})})}),(0,s.jsx)("div",{className:"flex flex-col min-w-0 flex-1",children:C.length>0?(0,s.jsx)("div",{className:"flex items-center gap-2",children:C.map((e,t)=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[t>0&&(0,s.jsx)("span",{className:"material-symbols-outlined text-text-muted text-base",children:"chevron_right"}),e.href?(0,s.jsx)(n(),{href:e.href,className:"text-text-muted hover:text-primary transition-colors",children:e.label}):(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[e.image&&(0,s.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,s.jsx)("h1",{className:"text-base lg:text-2xl font-semibold text-text-main tracking-tight truncate",children:(0,j.Tl)(e.label)})]})]},`${e.label}-${e.href||"current"}`))}):f?(0,s.jsx)("div",{className:"flex items-center gap-3",children:(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[w&&(0,s.jsx)("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-[10px] bg-primary/10 text-primary ring-1 ring-primary/15 lg:size-10 lg:rounded-xl",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-lg lg:text-[22px]",children:w})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("h1",{className:"truncate text-base font-semibold tracking-tight lg:text-[22px]",children:(0,j.Tl)(f)}),k&&(0,s.jsx)("p",{className:"hidden truncate text-sm text-text-muted lg:block",children:(0,j.Tl)(k)})]})]})}):null}),(0,s.jsxs)("div",{className:"dashboard-header-actions order-2 flex shrink-0 flex-wrap items-center justify-end gap-0.5 sm:order-none sm:gap-1 lg:rounded-xl lg:border lg:border-border-subtle lg:bg-surface-2/60 lg:p-1",children:[d&&"OIDC"===x&&(0,s.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",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1.5 text-primary",children:"person"}),(0,s.jsx)("span",{className:"truncate",children:d}),(0,s.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:"OIDC"})]}),(0,s.jsx)(b.default,{className:"size-11 sm:size-10"}),(0,s.jsx)(h,{}),(0,s.jsx)(u.default,{onLogout:S})]}),(0,s.jsx)(N,{})]})}function N(){let e=(0,f.C)(e=>e.visible),t=(0,f.C)(e=>e.query),r=(0,f.C)(e=>e.placeholder),a=(0,f.C)(e=>e.setQuery);return e?(0,s.jsxs)("div",{className:"relative order-3 w-full sm:order-none sm:w-[220px]",children:[(0,s.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,s.jsx)("input",{type:"text",value:t,onChange:e=>a(e.target.value),placeholder:r,"aria-label":r||"Search",className:"h-11 w-full rounded-xl border border-border bg-surface/80 pl-9 pr-11 text-sm shadow-sm transition-colors focus:border-primary/50 focus:outline-none focus:ring-2 focus:ring-primary/10 sm:h-9 sm:pl-8 sm:pr-8"}),t&&(0,s.jsx)("button",{type:"button",onClick:()=>a(""),className:"absolute right-0 top-1/2 flex size-11 -translate-y-1/2 items-center justify-center rounded-xl text-text-muted hover:text-text-main sm:right-0.5 sm:size-8 sm:rounded-lg","aria-label":"Clear search",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]}):null}y.propTypes={onMenuClick:d().func,showMenuButton:d().bool,menuButtonRef:d().shape({current:d().object})}},11059:(e,t,r)=>{r.d(t,{C:()=>a});var s=r(12115);function a(e=2e3){let[t,r]=(0,s.useState)(null),l=(0,s.useRef)(null),i=(0,s.useRef)(!0);function n(e){let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t);try{return t.select(),document.execCommand("copy")}finally{document.body.removeChild(t)}}return(0,s.useEffect)(()=>(i.current=!0,()=>{i.current=!1,l.current&&clearTimeout(l.current)}),[]),{copied:t,copy:(0,s.useCallback)(async(t,s="default")=>{let a=!1;try{navigator?.clipboard?.writeText?(await navigator.clipboard.writeText(t),a=!0):a=n(t)}catch{try{a=n(t)}catch{a=!1}}return a&&i.current&&(r(s),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{i.current&&r(null)},e)),a},[e])}}},11910:(e,t,r)=>{r.d(t,{default:()=>i});var s=r(95155),a=r(12115),l=r(31474);function i({label:e,type:t="text",placeholder:r,value:n,onChange:o,error:d,hint:c,icon:u,disabled:m=!1,required:x=!1,className:p,inputClassName:h,...b}){let f=(0,a.useId)(),g=b.id||f,v=`${g}-error`,j=`${g}-hint`,y=[b["aria-describedby"],d&&v,c&&j].filter(Boolean).join(" ")||void 0;return(0,s.jsxs)("div",{className:(0,l.cn)("flex flex-col gap-1.5",p),children:[e&&(0,s.jsxs)("label",{htmlFor:g,className:"text-sm font-medium text-text-main",children:[e,x&&(0,s.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,s.jsxs)("div",{className:"relative",children:[u&&(0,s.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:u})}),(0,s.jsx)("input",{id:g,type:t,placeholder:r,value:n,onChange:o,disabled:m,required:x,"aria-invalid":!!d||void 0,"aria-describedby":y,className:(0,l.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:border-brand-500/40 focus-visible:ring-2 focus-visible:ring-brand-500/30","transition-[border-color,box-shadow,background-color] duration-150 ease-out disabled:opacity-50 disabled:cursor-not-allowed motion-reduce:transition-none","text-[16px] sm:text-sm",u&&"pl-10",d&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",h),...b})]}),d&&(0,s.jsxs)("p",{id:v,role:"alert",className:"text-xs text-red-500 flex items-center gap-1",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[14px]",children:"error"}),d]}),c&&!d&&(0,s.jsx)("p",{id:j,className:"text-xs text-text-muted",children:c})]})}},12252:(e,t,r)=>{r.d(t,{F:()=>a});var s=r(12115);function a(e){let[t,r]=(0,s.useState)([]);return(0,s.useEffect)(()=>{if(!e)return;let t=new AbortController;return fetch("/api/providers/kiro/models",{cache:"no-store",signal:t.signal}).then(e=>e.ok?e.json():{models:[]}).then(e=>r(Array.isArray(e?.models)?e.models:[])).catch(e=>{e?.name!=="AbortError"&&r([])}),()=>t.abort()},[e]),e?t:[]}},21110:(e,t,r)=>{r.d(t,{ThemeProvider:()=>i});var s=r(95155),a=r(12115),l=r(90085);function i({children:e}){let{initTheme:t}=(0,l.A)();return(0,a.useEffect)(()=>{t()},[t]),(0,s.jsx)(s.Fragment,{children:e})}},21286:(e,t,r)=>{r.d(t,{default:()=>o});var s=r(95155),a=r(12115),l=r(14051),i=r.n(l),n=r(35497);function o({isOpen:e,connectionIds:t,onSuccess:r,onClose:l,endpoint:i="/api/oauth/codebuddy/quota-cookie"}){let[d,c]=(0,a.useState)(""),[u,m]=(0,a.useState)(!1),[x,p]=(0,a.useState)(""),[h,b]=(0,a.useState)(!1),f=async()=>{if(!d.trim())return void p("Paste your CodeBuddy web cookie first.");m(!0),p("");try{let e=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:d.trim(),connectionIds:t})}),s=await e.json().catch(()=>({}));if(!e.ok)throw Error(s.error||"Failed to save CodeBuddy quota cookie.");b(!0),setTimeout(()=>{r?.(),g()},900)}catch(e){p(e.message||"Failed to save CodeBuddy quota cookie.")}finally{m(!1)}},g=()=>{c(""),p(""),b(!1),l?.()};return(0,s.jsx)(n.aF,{isOpen:e,onClose:g,title:"CodeBuddy Quota Cookie",children:(0,s.jsx)("div",{className:"space-y-4",children:h?(0,s.jsxs)("div",{className:"py-6 text-center",children:[(0,s.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Quota cookie saved."}),(0,s.jsx)("p",{className:"mt-2 text-sm text-text-muted",children:"Quota Tracker can now read CodeBuddy credits for the selected connection."})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"space-y-2 text-sm text-text-muted",children:[(0,s.jsx)("p",{children:"Paste the cookie string from a logged-in CodeBuddy web session. This is only used for the quota endpoint; your existing OAuth token still handles chat."}),(0,s.jsx)("div",{className:"rounded-lg bg-surface-secondary p-3 text-xs",children:"Open codebuddy.ai, sign in, then copy the request cookie from DevTools Network for a request to codebuddy.ai."})]}),(0,s.jsx)("textarea",{value:d,onChange:e=>c(e.target.value),placeholder:"session=...; AUTH_SESSION_ID=...; ...",className:"h-28 w-full resize-none rounded-lg border border-border bg-surface-secondary px-3 py-2 text-sm text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-primary",disabled:u}),x&&(0,s.jsx)("div",{className:"rounded-lg border border-error/20 bg-error/10 p-3",children:(0,s.jsx)("p",{className:"text-sm text-error",children:x})}),(0,s.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,s.jsx)(n.$n,{variant:"secondary",onClick:g,disabled:u,fullWidth:!0,children:"Cancel"}),(0,s.jsx)(n.$n,{onClick:f,loading:u,fullWidth:!0,children:"Save Cookie"})]})]})})})}o.propTypes={isOpen:i().bool.isRequired,connectionIds:i().arrayOf(i().string).isRequired,onSuccess:i().func,onClose:i().func,endpoint:i().string}},21931:(e,t,r)=>{r.d(t,{default:()=>d});var s=r(95155),a=r(12115),l=r(47650),i=r(93308),n=r(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"},km:{name:"ខ្មែរ",flag:"\uD83C\uDDF0\uD83C\uDDED"},th:{name:"ไทย",flag:"\uD83C\uDDF9\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:r,hideTrigger:c=!1}){let[u,m]=(0,a.useState)("en"),[x,p]=(0,a.useState)(!1),[h,b]=(0,a.useState)(!1),f=(0,a.useRef)(null),g="boolean"==typeof t,v=g?t:h,j=e=>{g?!e&&r&&r(u):b(e)};(0,a.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,a.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),j(!1);try{let t=await fetch("/api/locale",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:e})});if(!t.ok)throw Error(`Locale change rejected (${t.status})`);await (0,n.wn)(),m(e)}catch(e){console.error("Failed to set locale:",e)}finally{p(!1)}}};return(0,s.jsxs)("div",{className:e,children:[!c&&(0,s.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,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"language"}),(0,s.jsx)("span",{className:"text-sm font-medium",children:o(u).name}),(0,s.jsx)("span",{className:"text-lg",children:o(u).flag})]}),v&&(0,l.createPortal)((0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4","data-i18n-skip":"true",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:()=>j(!1)}),(0,s.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,s.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Select Language"}),(0,s.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,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,s.jsx)("div",{className:"p-6 overflow-y-auto flex-1",children:(0,s.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(100px,1fr))] gap-2",children:i.YZ.map(e=>{let t=u===e,r=o(e);return(0,s.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:r.name,children:[(0,s.jsx)("span",{className:"text-2xl",children:r.flag}),(0,s.jsx)("span",{className:"text-center leading-tight line-clamp-2 h-8 flex items-center",children:r.name}),t&&(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check"})]},e)})})})]})]}),document.body)]})}},22942:(e,t,r)=>{function s(e,t,r){let s=r.height-e.bottom,a=s<(t+1)*34+8&&e.top>s;return{position:"fixed",right:r.width-e.right,...a?{bottom:r.height-e.top+4,maxHeight:Math.max(e.top-8,120)}:{top:e.bottom+4,maxHeight:Math.max(s-8,120)}}}function a(e,t,r){let s=e.left+e.width/2,a=e.top+e.height/2;return"bottom"===t?{position:"fixed",top:e.bottom+6,left:s,transform:"translateX(-50%)"}:"left"===t?{position:"fixed",right:r.width-e.left+6,top:a,transform:"translateY(-50%)"}:"right"===t?{position:"fixed",left:e.right+6,top:a,transform:"translateY(-50%)"}:{position:"fixed",bottom:r.height-e.top+6,left:s,transform:"translateX(-50%)"}}r.d(t,{Z:()=>a,x:()=>s})},23615:(e,t,r)=>{r.d(t,{default:()=>i});var s=r(95155),a=r(12115),l=r(84588);function i(){let[e,t]=(0,a.useState)([]),[r,i]=(0,a.useState)(!0),[n,o]=(0,a.useState)(!0);(0,a.useEffect)(()=>{d()},[]),(0,a.useEffect)(()=>{let e;return n&&(e=setInterval(()=>{d(!1)},3e3)),()=>clearInterval(e)},[n]);let d=async(e=!0)=>{e&&i(!0);try{let e=await fetch("/api/usage/request-logs");if(e.ok){let r=await e.json();t(r)}}catch(e){console.error("Failed to fetch logs:",e)}finally{e&&i(!1)}};return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("h2",{className:"text-xl font-semibold",children:"Request Logs"}),(0,s.jsx)("div",{className:"flex items-center gap-2",children:(0,s.jsxs)("label",{className:"text-sm font-medium text-text-muted flex items-center gap-2 cursor-pointer",children:[(0,s.jsx)("span",{children:"Auto Refresh (3s)"}),(0,s.jsx)("div",{onClick:()=>o(!n),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none ${n?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,s.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${n?"translate-x-5":"translate-x-1"}`})})]})})]}),(0,s.jsx)(l.default,{className:"overflow-hidden bg-black/5 dark:bg-black/20",children:(0,s.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:r&&0===e.length?(0,s.jsx)("div",{className:"p-8 text-center text-text-muted",children:"Loading logs..."}):0===e.length?(0,s.jsx)("div",{className:"p-8 text-center text-text-muted",children:"No logs recorded yet."}):(0,s.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,s.jsx)("thead",{className:"sticky top-0 bg-bg-subtle border-b border-border z-10",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"DateTime"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Model"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Provider"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Account"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"In"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Out"}),(0,s.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-border/50",children:e.map((e,t)=>{let r=e.split(" | ");if(r.length<7)return null;let a=r[6],l=a.includes("PENDING"),i=a.includes("FAILED"),n=a.includes("OK");return(0,s.jsxs)("tr",{className:`hover:bg-primary/5 transition-colors ${l?"bg-primary/5":""}`,children:[(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-text-muted",children:r[0]}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border font-medium",children:r[1]}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border",children:(0,s.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-bg-subtle border border-border text-[10px] uppercase font-bold",children:r[2]})}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border truncate max-w-[150px]",title:r[3],children:r[3]}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-primary",children:r[4]}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-success",children:r[5]}),(0,s.jsx)("td",{className:`px-3 py-1.5 font-bold ${n?"text-success":i?"text-error":"text-primary animate-pulse"}`,children:a})]},t)})})]})})}),(0,s.jsx)("div",{className:"text-[10px] text-text-muted italic",children:"Logs are loaded from the request history database."})]})}},23936:(e,t,r)=>{r.d(t,{default:()=>o});var s=r(95155),a=r(12115),l=r(14051),i=r.n(l),n=r(35497);function o({isOpen:e,onSuccess:t,onClose:r}){let[l,i]=(0,a.useState)(""),[d,c]=(0,a.useState)(!1),[u,m]=(0,a.useState)(null),[x,p]=(0,a.useState)(!1),h=async()=>{if(!l.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:l.trim()})}),r=await e.json();if(!e.ok)throw Error(r.error||"Authentication failed");p(!0),setTimeout(()=>{t?.(),b()},1500)}catch(e){m(e.message)}finally{c(!1)}},b=()=>{i(""),m(null),p(!1),r?.()};return(0,s.jsx)(n.aF,{isOpen:e,onClose:b,title:"iFlow Cookie Authentication",children:(0,s.jsx)("div",{className:"space-y-4",children:x?(0,s.jsxs)("div",{className:"text-center py-8",children:[(0,s.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,s.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,s.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,s.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,s.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,s.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,s.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,s.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,s.jsx)("li",{children:"Login to your account"}),(0,s.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,s.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,s.jsx)("li",{children:"Paste it below"})]})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,s.jsx)("textarea",{value:l,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,s.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,s.jsx)("p",{className:"text-sm text-error",children:u})}),(0,s.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,s.jsx)(n.$n,{variant:"secondary",onClick:b,disabled:d,fullWidth:!0,children:"Cancel"}),(0,s.jsx)(n.$n,{onClick:h,loading:d,fullWidth:!0,children:"Authenticate"})]})]})})})}o.propTypes={isOpen:i().bool.isRequired,onSuccess:i().func,onClose:i().func}},25086:(e,t,r)=>{r.d(t,{CardSkeleton:()=>o,DataListSkeleton:()=>d,PageLoading:()=>i,Skeleton:()=>n,Spinner:()=>l,default:()=>c});var s=r(95155),a=r(31474);function l({size:e="md",className:t}){return(0,s.jsx)("span",{className:(0,a.cn)("material-symbols-outlined animate-spin text-brand-500 motion-reduce:animate-none",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[e],t),children:"progress_activity"})}function i({message:e="Loading..."}){return(0,s.jsxs)("div",{role:"status","aria-live":"polite","aria-label":e,className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,s.jsx)(l,{size:"xl"}),(0,s.jsx)("p",{className:"mt-4 text-text-muted",children:e})]})}function n({className:e,...t}){return(0,s.jsx)("div",{className:(0,a.cn)("animate-pulse rounded-[10px] bg-surface-2 motion-reduce:animate-none",e),...t})}function o({className:e}){return(0,s.jsxs)("div",{"aria-hidden":"true",className:(0,a.cn)("rounded-[14px] border border-border-subtle bg-surface p-6 shadow-[var(--shadow-soft)]",e),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)(n,{className:"h-4 w-24"}),(0,s.jsx)(n,{className:"size-10 rounded-[10px]"})]}),(0,s.jsx)(n,{className:"h-8 w-16 mb-2"}),(0,s.jsx)(n,{className:"h-3 w-20"})]})}function d({rows:e=4,label:t="Loading data",className:r}){return(0,s.jsx)("div",{role:"status","aria-label":t,className:(0,a.cn)("divide-y divide-border-subtle",r),children:Array.from({length:e},(e,t)=>(0,s.jsxs)("div",{"aria-hidden":"true",className:"grid grid-cols-[minmax(6rem,0.7fr)_minmax(0,1.3fr)] gap-4 py-4",children:[(0,s.jsx)(n,{className:"h-4 w-24 max-w-full"}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n,{className:"h-4 w-2/3"}),(0,s.jsx)(n,{className:"h-3 w-1/3"})]})]},t))})}function c({type:e="spinner",...t}){switch(e){case"page":return(0,s.jsx)(i,{...t});case"skeleton":return(0,s.jsx)(n,{...t});case"card":return(0,s.jsx)(o,{...t});default:return(0,s.jsx)(l,{...t})}}},28058:(e,t,r)=>{r.d(t,{default:()=>i});var s=r(95155),a=r(12115),l=r(81127);function i({isOpen:e,onClose:t,onAdd:r,addedNames:n=[]}){let[o,d]=(0,a.useState)([]),[c,u]=(0,a.useState)(!1),[m,x]=(0,a.useState)(""),[p,h]=(0,a.useState)("all"),[b,f]=(0,a.useState)(null),[g,v]=(0,a.useState)(null),[j,y]=(0,a.useState)({}),[N,k]=(0,a.useState)({}),[w,C]=(0,a.useState)({});(0,a.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,o.length]);let S=(0,a.useMemo)(()=>new Set(n),[n]),T=(0,a.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]),I=async e=>{if(!j[e.url]){k(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})}),r=await t.json(),s=r.tools||[],a=Array.isArray(e.toolNames)?e.toolNames:[],l=s.length>0?s.map(e=>e.name):a;y(t=>({...t,[e.url]:{tools:s,requiresAuth:!!r.requiresAuth,error:r.error}})),C(t=>({...t,[e.url]:Object.fromEntries(l.map(e=>[e,!0]))}))}catch(t){y(r=>({...r,[e.url]:{tools:[],error:t.message}}))}finally{k(t=>({...t,[e.url]:!1}))}}},$=(e,t)=>{let r=w[e]||{};C(s=>({...s,[e]:Object.fromEntries(Object.keys(r).map(e=>[e,t]))}))};return(0,s.jsx)(l.default,{isOpen:e,onClose:t,title:"Browse MCP Marketplace",size:"lg",children:(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.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,s.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,s.jsx)("option",{value:"all",children:"All"}),(0,s.jsx)("option",{value:"authless",children:"Authless"}),(0,s.jsx)("option",{value:"oauth",children:"OAuth"})]})]}),b&&(0,s.jsx)("div",{className:"px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:b}),c&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-xs py-4 justify-center",children:[(0,s.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}),(0,s.jsx)("span",{children:"Loading registry..."})]}),!c&&(0,s.jsxs)("div",{className:"flex flex-col gap-1 max-h-[60vh] overflow-y-auto",children:[0===T.length&&(0,s.jsx)("div",{className:"text-center text-xs text-text-muted py-6",children:"No servers match filter"}),T.map(e=>{let t=S.has(e.slug||e.name),a=g===e.url,l=j[e.url],i=N[e.url],n=w[e.url]||{},o=Object.keys(n),d=Object.values(n).filter(Boolean).length;return(0,s.jsxs)("div",{className:"rounded border border-transparent hover:border-border",children:[(0,s.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,s.jsx)("img",{src:e.iconUrl,alt:"",className:"size-7 rounded shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}):(0,s.jsx)("div",{className:"size-7 rounded bg-surface shrink-0"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,s.jsx)("span",{className:"font-medium text-xs",children:e.title}),e.oauth?(0,s.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-amber-500/10 text-amber-600",children:"OAuth"}):(0,s.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-green-500/10 text-green-600",children:"Authless"}),e.toolCount>0&&(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:[e.toolCount," tools"]})]}),e.description&&(0,s.jsx)("p",{className:"text-[10px] text-text-muted line-clamp-2 mt-0.5",children:e.description})]}),(0,s.jsx)("button",{onClick:()=>t?null:void(g===e.url?v(null):(v(e.url),I(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":a?"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":a?"Cancel":"+ Add"})]}),a&&(0,s.jsxs)("div",{className:"px-3 py-2 bg-surface/40 border-t border-border flex flex-col gap-2",children:[i&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-[10px] py-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined animate-spin text-[14px]",children:"progress_activity"}),(0,s.jsx)("span",{children:"Probing server for tools..."})]}),!i&&l?.requiresAuth&&(0,s.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&&l?.error&&!l?.requiresAuth&&(0,s.jsxs)("p",{className:"text-[10px] text-red-600 bg-red-500/10 px-2 py-1 rounded",children:["Probe failed: ",l.error]}),!i&&0===o.length&&!l?.requiresAuth&&!l?.error&&(0,s.jsx)("p",{className:"text-[10px] text-text-muted",children:"No tools advertised by server."}),!i&&o.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:[d,"/",o.length," tools enabled"]}),(0,s.jsxs)("div",{className:"flex gap-1",children:[(0,s.jsx)("button",{onClick:()=>$(e.url,!0),className:"text-[10px] text-primary hover:underline",children:"All"}),(0,s.jsx)("span",{className:"text-[10px] text-text-muted",children:"\xb7"}),(0,s.jsx)("button",{onClick:()=>$(e.url,!1),className:"text-[10px] text-primary hover:underline",children:"None"})]})]}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-1 max-h-40 overflow-y-auto",children:o.map(t=>(0,s.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,s.jsx)("input",{type:"checkbox",checked:!!n[t],onChange:()=>{var r;return r=e.url,void C(e=>({...e,[r]:{...e[r],[t]:!e[r]?.[t]}}))},className:"size-3"}),(0,s.jsx)("span",{className:"truncate",children:t})]},t))})]}),(0,s.jsx)("button",{onClick:()=>{let t,s;return s=Object.keys(t=w[e.url]||{}).filter(e=>t[e]),void(r?.({name:e.slug||e.name,title:e.title,description:e.description,url:e.url,transport:e.transport,oauth:e.oauth,toolNames:s}),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,s.jsxs)("div",{className:"text-[10px] text-text-muted text-right",children:[T.length," of ",o.length," servers"]})]})})}},28067:(e,t,r)=>{r.d(t,{default:()=>l});var s=r(95155),a=r(31474);function l({options:e=[],value:t,onChange:r,size:i="md",className:n,...o}){let d={sm:"h-9 text-xs sm:h-7",md:"h-10 text-sm sm:h-9",lg:"h-11 text-base"};return(0,s.jsx)("div",{role:"group",...o,className:(0,a.cn)("inline-flex items-center p-1 rounded-[10px] overflow-x-auto","bg-surface-2",n),children:e.map(e=>(0,s.jsxs)("button",{type:"button","aria-pressed":t===e.value,onClick:()=>r(e.value),className:(0,a.cn)("shrink-0 px-4 rounded-[8px] font-medium transition-all",d[i],t===e.value?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[e.icon&&(0,s.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[16px] mr-1.5",children:e.icon}),e.label]},e.value))})}},28815:(e,t,r)=>{r.d(t,{default:()=>o});var s=r(95155),a=r(12115),l=r(81127),i=r(92542),n=r(11059);function o({isOpen:e,onClose:t,title:r="Manual Configuration",description:d="",requirements:c=[],configs:u=[],instructions:m=[],note:x=""}){let{copy:p}=(0,n.C)(),[h,b]=(0,a.useState)(null);return(0,s.jsx)(l.default,{isOpen:e,onClose:t,title:r,size:"xl",children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[d&&(0,s.jsx)("p",{className:"text-sm leading-6 text-text-muted",children:d}),c.length>0&&(0,s.jsx)("div",{className:"rounded-lg border border-yellow-500/30 bg-yellow-500/10 px-3 py-2.5",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-[17px] text-yellow-600 dark:text-yellow-400",children:"warning"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-yellow-700 dark:text-yellow-300",children:"Configuration is not copy-ready yet"}),(0,s.jsx)("ul",{className:"mt-1 list-disc space-y-1 pl-4 text-xs leading-5 text-text-muted",children:c.map(e=>(0,s.jsx)("li",{children:e},e))})]})]})}),u.map((e,t)=>(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"break-words text-sm font-medium text-text-main",children:e.label||e.filename}),e.label&&e.filename&&(0,s.jsx)("p",{className:"mt-0.5 break-all font-mono text-[11px] text-text-muted",children:e.filename}),e.description&&(0,s.jsx)("p",{className:"mt-1 text-xs leading-5 text-text-muted",children:e.description})]}),(0,s.jsxs)(i.default,{variant:"ghost",size:"sm",onClick:()=>{var r;return r=e.content,void(p(r,`manualconfig-${t}`),b(t),setTimeout(()=>b(null),2e3))},className:"shrink-0",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:h===t?"check":"content_copy"}),h===t?"Copied!":"Copy"]})]}),(0,s.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})]},e.id||e.filename||t)),m.length>0&&(0,s.jsxs)("div",{className:"rounded-lg border border-border bg-surface/40 px-3 py-3",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-text-main",children:"Finish setup"}),(0,s.jsx)("ol",{className:"mt-2 list-decimal space-y-1.5 pl-5 text-xs leading-5 text-text-muted",children:m.map(e=>(0,s.jsx)("li",{children:e},e))})]}),x&&(0,s.jsx)("p",{className:"text-xs leading-5 text-text-muted",children:x})]})})}},29366:(e,t,r)=>{r.d(t,{A:()=>o});var s=r(95155),a=r(14051),l=r.n(a),i=r(28777),n=r(97677);function o({caps:e,className:t="",colorOverride:r,size:a=16}){if(!e)return null;let l=Object.keys(i.bs).filter(t=>e[t]);return 0===l.length?null:(0,s.jsx)("span",{className:`inline-flex items-center gap-0.5 ${t}`,children:l.map(e=>(0,s.jsx)(n.default,{text:`${i.bs[e].label} — ${i.bs[e].desc}`,children:(0,s.jsx)("span",{className:`material-symbols-outlined leading-none cursor-help ${r||i.bs[e].color}`,style:{fontSize:`${a}px`},children:i.bs[e].icon})},e))})}o.propTypes={caps:l().object,className:l().string,colorOverride:l().string,size:l().number}},30815:(e,t,r)=>{r.d(t,{default:()=>o});var s=r(95155),a=r(12115),l=r(14051),i=r.n(l),n=r(35497);function o({isOpen:e,onSuccess:t,onClose:r}){let[l,i]=(0,a.useState)(""),[d,c]=(0,a.useState)(""),[u,m]=(0,a.useState)(null),[x,p]=(0,a.useState)(!1),[h,b]=(0,a.useState)(!1),[f,g]=(0,a.useState)(!1),[v,j]=(0,a.useState)(!1),y=(0,a.useRef)(0),N=(0,a.useCallback)(async()=>{let e=++y.current;b(!0),m(null),g(!1),j(!1);try{let t=await fetch("/api/oauth/cursor/auto-import"),r=await t.json();if(y.current!==e)return;r.found?(i(r.accessToken),c(r.machineId),g(!0)):r.windowsManual?j(!0):m(r.error||"Could not auto-detect tokens")}catch(t){y.current===e&&m("Failed to auto-detect tokens")}finally{y.current===e&&b(!1)}},[]);(0,a.useEffect)(()=>{e?(i(""),c(""),m(null),g(!1),j(!1),N()):y.current++},[e,N]);let k=async()=>{if(!l.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:l.trim(),machineId:d.trim()})}),s=await e.json();if(!e.ok)throw Error(s.error||"Import failed");t?.(),r()}catch(e){m(e.message)}finally{p(!1)}};return(0,s.jsx)(n.aF,{isOpen:e,title:"Connect Cursor IDE",onClose:r,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[h&&(0,s.jsxs)("div",{className:"text-center py-6",children:[(0,s.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,s.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting tokens..."}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from Cursor IDE database"})]}),!h&&(0,s.jsxs)(s.Fragment,{children:[f&&(0,s.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,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,s.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Tokens auto-detected from Cursor IDE successfully!"})]})}),v&&(0,s.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,s.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,s.jsx)("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Could not read Cursor database automatically."})]}),(0,s.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,s.jsx)("strong",{children:"Retry"}),". If the problem persists, paste your tokens manually below."]}),(0,s.jsx)(n.$n,{onClick:N,variant:"outline",fullWidth:!0,children:"Retry"})]}),!f&&!v&&!u&&(0,s.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,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,s.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Cursor IDE not detected. Please paste your tokens manually."})]})}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsx)("textarea",{value:l,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,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Machine ID ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsx)(n.pd,{value:d,onChange:e=>c(e.target.value),placeholder:"Machine ID will be auto-filled...",className:"font-mono text-sm"})]}),u&&(0,s.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,s.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:u})}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(n.$n,{onClick:k,fullWidth:!0,disabled:x||!l.trim()||!d.trim(),children:x?"Importing...":"Import Token"}),(0,s.jsx)(n.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}o.propTypes={isOpen:i().bool.isRequired,onSuccess:i().func,onClose:i().func.isRequired}},31474:(e,t,r)=>{r.d(t,{cn:()=>s});function s(...e){return e.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}},33315:(e,t,r)=>{r.d(t,{o:()=>a});let s="[redacted]";function a(e,t=[]){if("string"!=typeof e)return"";let r=e.replace(/\s+/g," ").trim();if(!r)return"";let l=(Array.isArray(t)?t:[t]).filter(e=>"string"==typeof e&&e.trim()),i=new Set;for(let e of l){let t=e.trim();for(let e of(t.length>=4&&i.add(t),t.split(/[\s"'`;,:=&?{}[\]()<>]+/)))e.length>=8&&i.add(e)}for(let e of[...i].sort((e,t)=>t.length-e.length))r=r.replace(RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),s);return(r=r.replace(/([?&](?:key|api_key|token|access_token)=)[^&\s]+/gi,`$1${s}`)).length>240?`${r.slice(0,239)}…`:r}},35497:(e,t,r)=>{r.d(t,{x0:()=>I.default,Ex:()=>d.default,Go:()=>c.default,$n:()=>s.default,Zp:()=>i.default,Qv:()=>o.CardSkeleton,zE:()=>w.default,xl:()=>k.default,CK:()=>b.default,uo:()=>n.ConfirmModal,mz:()=>x.default,G9:()=>y.default,i5:()=>P.DashboardToolbar,wI:()=>T.default,pp:()=>P.EmptyState,Gi:()=>P.FeedbackPanel,vj:()=>C.default,vE:()=>N.default,pd:()=>a.default,Mh:()=>j.default,uR:()=>h.default,Nf:()=>f.default,aF:()=>n.default,rq:()=>p.default,gw:()=>$.default,LF:()=>m.default,dK:()=>E.default,Wx:()=>R.default,gM:()=>v.default,w:()=>P.SectionHeading,Iz:()=>A.default,l6:()=>l.default,lM:()=>u.default,m_:()=>O.default,jK:()=>g.default,LH:()=>S.default});var s=r(92542),a=r(11910),l=r(98),i=r(84588),n=r(81127),o=r(25086);r(56319);var d=r(56061),c=r(39835),u=r(98542);r(38587),r(21110),r(92622),r(8823),r(92173);var m=r(90882),x=r(67597),p=r(37384),h=r(28815),b=r(45455),f=r(28058),g=r(55060);r(21931),r(80752),r(40197);var v=r(23615);r(61500);var j=r(62899);r(94230);var y=r(30815),N=r(23936),k=r(21286),w=r(65428),C=r(95088),S=r(40684),T=r(73579),I=r(96748),$=r(4823),A=r(28067),O=r(97677),R=r(51825),E=r(50378),P=r(58041);r(7648),r(91450)},37384:(e,t,r)=>{r.d(t,{default:()=>w});var s=r(95155),a=r(12115),l=r(14051),i=r.n(l),n=r(81127),o=r(57250),d=r(28777),c=r(1791),u=r(12252),m=r(40671);function x(){return{raw:"",isEmpty:!0,isRegex:!1,regex:null,positiveTerms:[],negativeTerms:[]}}function p(e){if(!e||"string"!=typeof e)return x();let t=e.trim();if(!t)return x();if(t.startsWith("/")){let e=t.match(/^\/(.+)\/([a-z]*)$/i);try{if(e)return{raw:t,isEmpty:!1,isRegex:!0,regex:new RegExp(e[1],e[2]||"i"),positiveTerms:[],negativeTerms:[]};if(t.length>1)return{raw:t,isEmpty:!1,isRegex:!0,regex:RegExp(t.slice(1),"i"),positiveTerms:[],negativeTerms:[]}}catch{}}let r=[],s=[];for(let e of t.split(/\s+/))e&&((e.startsWith("!")||e.startsWith("-"))&&e.length>1?s.push(e.slice(1).toLowerCase()):r.push(e.toLowerCase()));return{raw:t,isEmpty:0===r.length&&0===s.length,isRegex:!1,regex:null,positiveTerms:r,negativeTerms:s}}function h(e,t){return e.lastIndex=0,e.test(t)}function b(e,t){let r="string"!=typeof t&&t?t:p(t);if(r.isEmpty)return!0;let s=[];if("string"==typeof e?s=[e]:Array.isArray(e)?s=e.filter(e=>"string"==typeof e):e&&"object"==typeof e&&(s=[e.name,e.id,e.value,e.alias,e.provider].filter(e=>"string"==typeof e)),0===s.length)return!1;if(r.isRegex&&r.regex){let e=s.join(" ");return/\(\?!|\(\?<!/.test(r.raw)?h(r.regex,e):s.some(e=>h(r.regex,e))||h(r.regex,e)}let a=s.map(e=>e.toLowerCase());return!r.negativeTerms.some(e=>a.some(t=>t.includes(e)))&&r.positiveTerms.every(e=>a.some(t=>t.includes(e)))}var f=r(929),g=r(29366);function v(e){return(0,c.mq)(e)||(0,c.gb)(e)}var j=r(70217);let y=[...Object.keys(c.zN),...Object.keys(c.IS),...Object.keys(c.nJ),...Object.keys(c.fg)],N=Object.keys(c.IS).filter(e=>c.IS[e].noAuth);function k({isOpen:e,onClose:t,onSelect:r,onDeselect:l,onSelectBatch:i,onDeselectBatch:x,selectedModel:h,activeProviders:w=[],title:C="Select Model",modelAliases:S={},kindFilter:T=null,addedModelValues:I=[],closeOnSelect:$=!0,includeCombos:A=!0,capFilter:O=null}){let{getCaps:R}=(0,f.y)(),E=(0,a.useMemo)(()=>T?w.filter(e=>{let t=c.Q2[e.provider];return(t?.serviceKinds||["llm"]).includes(T)}):w,[w,T]),[P,_]=(0,a.useState)(""),[M,z]=(0,a.useState)([]),[q,L]=(0,a.useState)([]),[U,D]=(0,a.useState)([]),[F,W]=(0,a.useState)({}),[B,K]=(0,a.useState)(null),J=(0,u.F)(e&&w.some(e=>"kiro"===e.provider)),V=(0,m.M)(e&&w.some(e=>"aistudio"===e.provider)),G=async e=>{try{let t=await fetch("/api/combos",{signal:e});if(!t.ok)throw Error(`Failed to fetch combos: ${t.status}`);let r=await t.json();z(r.combos||[])}catch(e){if(e?.name==="AbortError")return;console.error("Error fetching combos:",e),z([])}},H=async e=>{try{let t=await fetch("/api/provider-nodes",{signal:e});if(!t.ok)throw Error(`Failed to fetch provider nodes: ${t.status}`);let r=await t.json();L(r.nodes||[])}catch(e){if(e?.name==="AbortError")return;console.error("Error fetching provider nodes:",e),L([])}},Q=async e=>{try{let t=await fetch("/api/models/custom",{signal:e});if(!t.ok)throw Error(`Failed to fetch custom models: ${t.status}`);let r=await t.json();D(r.models||[])}catch(e){if(e?.name==="AbortError")return;console.error("Error fetching custom models:",e),D([])}},X=async e=>{try{let t=await fetch("/api/models/disabled",{signal:e});if(!t.ok)throw Error(`Failed to fetch disabled models: ${t.status}`);let r=await t.json();W(r.disabled||{})}catch(e){if(e?.name==="AbortError")return;console.error("Error fetching disabled models:",e),W({})}},Z=async e=>{try{let t=await fetch("/api/providers",{signal:e,cache:"no-store"});if(!t.ok)throw Error(`Failed to fetch providers: ${t.status}`);let r=await t.json();K(r.connections||[])}catch(e){if(e?.name==="AbortError")return;console.error("Error fetching providers in ModelSelectModal:",e),K([])}};(0,a.useEffect)(()=>{if(!e)return;let t=new AbortController;return Z(t.signal),()=>t.abort()},[e]);let Y=null!==B?B:w||[],ee=(0,a.useMemo)(()=>(0,j.io)(Y),[Y]);(0,a.useEffect)(()=>{let e=new AbortController;return Promise.all([G(e.signal),H(e.signal),Q(e.signal),X(e.signal)]),()=>e.abort()},[]);let et=(0,a.useMemo)(()=>({...c.zN,...c.IS,...c.nJ,...c.fg}),[]),er=(0,a.useMemo)(()=>{let t={};if(!e)return t;let r=new Set(["webSearch","webFetch"]),s=new Set(["image","tts","stt","embedding","imageToText","systemone"]),a=new Set(["tts","image","webFetch"]);return[...new Set([...E.map(e=>e.provider),...T?N.filter(e=>(c.Q2[e]?.serviceKinds||["llm"]).includes(T)):N,...(function({kindFilter:e=null,providerNodes:t=[],customModels:r=[],modelAliases:s={}}={}){if(e)return[];let a=new Set((t||[]).map(e=>e?.id).filter(Boolean)),l=new Set;for(let e of r||[]){let t=e?.providerAlias;a.has(t)&&v(t)&&l.add(t)}for(let e of Object.values(s||{})){let t=String(e||"").split("/")[0];a.has(t)&&v(t)&&l.add(t)}return[...l]})({kindFilter:T,providerNodes:q,customModels:U,modelAliases:S}).filter(e=>!ee.has(e))].filter(e=>!ee.has(e)))].sort((e,t)=>{let r=y.indexOf(e),s=y.indexOf(t);return(-1===r?999:r)-(-1===s?999:s)}).forEach(e=>{let l=(0,c.wG)(e),i=et[e]||{name:e,color:"#666"},n=(0,c.mq)(e)||(0,c.gb)(e);if(T&&r.has(T)){t[e]={name:i.name,alias:l,color:i.color,models:[{id:e,name:i.name,value:e}]};return}if(i.passthroughModels){let r=Object.entries(S).filter(([,e])=>e.startsWith(`${l}/`)).map(([e,t])=>({id:t.replace(`${l}/`,""),name:e,value:t}));if(T&&s.has(T)&&0===(r=(0,d.KC)(e).filter(e=>e.type===T).map(e=>({id:e.id,name:e.name,value:`${l}/${e.id}`,type:e.type}))).length&&a.has(T)&&(i.serviceKinds||["llm"]).includes(T)&&(r=[{id:e,name:i.name,value:l}]),r.length>0){let s=q.find(t=>t.id===e),a=s?.name||i.name;t[e]={name:a,alias:l,color:i.color,models:r}}}else if(n){if(T&&s.has(T))return;let r=w.find(t=>t.provider===e),a=q.find(t=>t.id===e),l=r?.name||a?.name||i.name,n=r?.providerSpecificData?.prefix||a?.prefix||e,o=function({providerId:e,nodePrefix:t,modelAliases:r={},customModels:s=[]}){let a=t||e,l=Object.entries(r).filter(([,t])=>String(t||"").startsWith(`${e}/`)).map(([t,r])=>{let s=String(r).slice(e.length+1);return{id:s,name:t,value:`${a}/${s}`}}),i=new Set(l.map(e=>e.value));return[...l,...(s||[]).filter(t=>t?.providerAlias===e&&t?.id).map(e=>({id:e.id,name:e.name||e.id,value:`${a}/${e.id}`,isCustom:!0})).filter(e=>!i.has(e.value))]}({providerId:e,nodePrefix:n,modelAliases:S,customModels:U}),d=o.length>0?o:[{id:`__placeholder__${e}`,name:`${n}/model-id`,value:`${n}/model-id`,isPlaceholder:!0}];t[e]={name:l,alias:n,color:i.color,models:d,isCustom:!0,hasModels:o.length>0}}else{var o;let r="kiro"===e?J:(0,m.Q)(e,V,(0,d.KC)(e)),n=new Set(r.map(e=>e.id)),c=r.length>0,u=Object.entries(S).filter(([e,t])=>t.startsWith(`${l}/`)&&(!c||e===t.replace(`${l}/`,""))&&!n.has(t.replace(`${l}/`,""))).map(([e,t])=>({id:t.replace(`${l}/`,""),name:e,value:t,isCustom:!0})),x=new Set(u.map(e=>e.id)),p=U.filter(e=>e.providerAlias===l&&!n.has(e.id)&&!x.has(e.id)).map(e=>({id:e.id,name:e.name||e.id,value:`${l}/${e.id}`,isCustom:!0})),h=[...r.map(e=>({id:e.id,name:e.name,value:`${l}/${e.id}`,type:e.type})),...u,...p],b=new Set,f=(o=h.filter(e=>!b.has(e.value)&&(b.add(e.value),!0)),T?s.has(T)?o.filter(e=>e.isPlaceholder||e.type===T):o:o.filter(e=>e.isPlaceholder||!e.type||"llm"===e.type));0===f.length&&T&&a.has(T)&&(i.serviceKinds||["llm"]).includes(T)&&(f=[{id:e,name:i.name,value:l}]),f.length>0&&(t[e]={name:i.name,alias:l,color:i.color,models:f})}}),Object.entries(t).forEach(([e,r])=>{let s=new Set([...F[(0,c.wG)(e)]||[],...F[e]||[]]);0!==s.size&&(r.models=r.models.filter(e=>!s.has(e.id)),0===r.models.length&&delete t[e])}),t},[e,E,S,et,q,U,F,T,w,J,V,ee]),es=(0,a.useMemo)(()=>p(P),[P]),ea=(0,a.useMemo)(()=>T||O||!1===A?[]:es.isEmpty?M:M.filter(e=>b(e.name,es)),[M,es,T,O,A]),el=(0,a.useMemo)(()=>{let e={};return Object.entries(er).forEach(([t,r])=>{var s;let a=r.models;if(!O||0!==(a=a.filter(e=>R(e.value)?.[O]===!0)).length){if(!es.isEmpty){let e=b(r.name,es),s=b(r.alias,es)||b(t,es)||b(`${r.alias}/*`,es);if(0===(a=a.filter(t=>!!b(t,es)||(!!e||!!s)&&(!(es.negativeTerms.length>0)||b(t,{...es,positiveTerms:[]})))).length)return}e[t]={...r,models:[...(s=a).filter(e=>I.includes(e.value)).sort((e,t)=>e.name.localeCompare(t.name)),...s.filter(e=>!I.includes(e.value)).sort((e,t)=>e.name.localeCompare(t.name))]}}}),e},[er,es,I,O,R]),ei=(0,a.useMemo)(()=>{let e=[];return Object.values(el).forEach(t=>{t.models.forEach(t=>{t.isPlaceholder||e.push(t)})}),e},[el]),en=ei.filter(e=>!I.includes(e.value)),eo=ei.filter(e=>I.includes(e.value)),ed=e=>{let s=e?.value||e?.name||e;I.includes(s)&&l?l(e):r(e),$&&(t(),_(""))};return(0,s.jsxs)(n.default,{isOpen:e,onClose:()=>{t(),_("")},title:C,size:"md",className:"p-4!",footer:null,children:[(0,s.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,s.jsx)("span",{className:"material-symbols-outlined text-primary shrink-0",style:{fontSize:"14px"},children:"info"}),(0,s.jsx)("span",{children:"Click to add, click again to remove. Search supports exclusions and /regex/."})]}),(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.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,s.jsx)("input",{type:"text",placeholder:"Search models (e.g. claude -haiku, !embed, /regex/)...",value:P,onChange:e=>_(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"})]}),!$&&ei.length>0&&(0,s.jsxs)("div",{className:"mt-2 flex items-center justify-between px-1 text-[11px] text-text-muted",children:[(0,s.jsxs)("span",{children:[ei.length," models"]}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[en.length>0&&(0,s.jsxs)("button",{type:"button",onClick:()=>{0!==en.length&&(i?i(en):en.forEach(e=>r(e)))},className:"cursor-pointer rounded bg-primary/10 px-2 py-0.5 font-medium text-primary",children:["Select All (",en.length,")"]}),eo.length>0&&l&&(0,s.jsxs)("button",{type:"button",onClick:()=>{0!==eo.length&&l&&(x?x(eo):eo.forEach(e=>l(e)))},className:"cursor-pointer rounded bg-border/40 px-2 py-0.5 font-medium text-text-muted",children:["Deselect All (",eo.length,")"]})]})]})]}),(0,s.jsxs)("div",{className:"max-h-[400px] overflow-y-auto space-y-3",children:[ea.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-primary text-[14px]",children:"layers"}),(0,s.jsx)("span",{className:"text-xs font-medium text-primary",children:"Combos"}),(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",ea.length,")"]})]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:ea.map(e=>{let t=h===e.name;return(0,s.jsxs)("button",{onClick:()=>ed({id:e.name,name:e.name,value:e.name}),className:`
2
2
  px-2 py-1 rounded-xl text-xs font-medium transition-all border hover:cursor-pointer flex items-center gap-1
3
3
  ${t?"bg-primary text-white border-primary":I.includes(e.name)?"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"}
4
4
  `,children:[I.includes(e.name)&&(0,s.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),e.name]},e.id)})})]}),Object.entries(el).map(([e,t])=>(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,s.jsx)(o.A,{src:`/providers/${e}.png`,alt:t.name,size:14,fallbackText:(t.name||e).slice(0,2).toUpperCase(),fallbackColor:t.color}),(0,s.jsx)("span",{className:"text-xs font-medium text-primary",children:t.name}),(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",t.models.length,")"]})]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:t.models.map(e=>{let t=h===e.value,r=e.isPlaceholder;return(0,s.jsx)("button",{onClick:()=>ed(e),title:r?"Select to pre-fill, then edit model ID in the input":void 0,className:`