9router 0.4.49 → 0.4.50

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 (354) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +7 -7
  3. package/app/.next-cli-build/build-manifest.json +2 -2
  4. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  5. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  25. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  26. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  27. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  28. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  29. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  30. package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  31. package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  32. package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  33. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  34. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  35. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  36. package/app/.next-cli-build/server/app/_not-found.rsc +3 -3
  37. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
  38. package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  39. package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +3 -3
  40. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  41. package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  42. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  43. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  44. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  45. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  46. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  47. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  48. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  49. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  50. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  51. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  52. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  53. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  54. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  55. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  56. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  57. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  58. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  59. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  60. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  61. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  62. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  63. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  64. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  65. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  66. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  67. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  68. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  69. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  70. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  71. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  72. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  73. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  74. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  75. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  76. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  77. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  78. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  79. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  80. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  81. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  82. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  83. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  84. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  85. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  86. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  87. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  88. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  89. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  90. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  91. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  92. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  93. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  94. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  95. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  96. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  97. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  98. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  99. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
  100. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  101. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  102. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  103. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  104. package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  106. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  107. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  108. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/tunnel/tailscale-login/route.js.nft.json +1 -1
  110. package/app/.next-cli-build/server/app/api/tunnel/tailscale-start-daemon/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  112. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  114. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  116. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  117. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  118. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  119. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  120. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  121. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  122. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  123. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  124. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  126. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  127. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  130. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  131. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  133. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  134. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  135. package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  136. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  137. package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  138. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  139. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  140. package/app/.next-cli-build/server/app/callback.html +1 -1
  141. package/app/.next-cli-build/server/app/callback.rsc +3 -3
  142. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
  143. package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  144. package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +3 -3
  145. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
  146. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  147. package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  148. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  149. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +5 -5
  150. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  151. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  152. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  153. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  154. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +5 -5
  155. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  156. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +3 -3
  157. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
  158. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  159. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +5 -5
  160. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  161. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  162. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  163. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  164. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +5 -5
  165. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  166. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +3 -3
  167. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
  168. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  169. package/app/.next-cli-build/server/app/dashboard/combos.rsc +5 -5
  170. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  171. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  172. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  173. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  174. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +5 -5
  175. package/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  176. package/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +3 -3
  177. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
  178. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  179. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +5 -5
  180. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  181. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  182. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  183. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  184. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +5 -5
  185. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  186. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +3 -3
  187. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
  188. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  189. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +5 -5
  190. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  191. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
  192. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
  193. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  194. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  195. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +5 -5
  196. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
  197. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +3 -3
  198. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
  199. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  200. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +5 -5
  201. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  202. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  203. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  204. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  205. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +5 -5
  206. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  207. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +3 -3
  208. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
  209. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  210. package/app/.next-cli-build/server/app/dashboard/profile.rsc +5 -5
  211. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  212. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  213. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  214. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  215. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +5 -5
  216. package/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  217. package/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +3 -3
  218. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
  219. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  220. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +5 -5
  221. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  222. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  223. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  224. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  225. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  226. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +5 -5
  227. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  228. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +3 -3
  229. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
  230. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  231. package/app/.next-cli-build/server/app/dashboard/providers.rsc +5 -5
  232. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  233. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  234. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  235. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  236. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +5 -5
  237. package/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  238. package/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +3 -3
  239. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
  240. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  241. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +5 -5
  242. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  243. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  244. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  245. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  246. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +5 -5
  247. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  248. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +3 -3
  249. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
  250. package/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
  251. package/app/.next-cli-build/server/app/dashboard/quota.rsc +6 -6
  252. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  253. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  254. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  255. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  256. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +6 -6
  257. package/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  258. package/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +3 -3
  259. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
  260. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  261. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  262. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
  263. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
  264. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  265. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
  266. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  267. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  268. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  269. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  270. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  271. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  272. package/app/.next-cli-build/server/app/dashboard/skills.rsc +5 -5
  273. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
  274. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
  275. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  276. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  277. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +5 -5
  278. package/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
  279. package/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +3 -3
  280. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
  281. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  282. package/app/.next-cli-build/server/app/dashboard/translator.rsc +5 -5
  283. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  284. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  285. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  286. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  287. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +5 -5
  288. package/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  289. package/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +3 -3
  290. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
  291. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  292. package/app/.next-cli-build/server/app/dashboard/usage.rsc +5 -5
  293. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  294. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  295. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  296. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  297. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
  298. package/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  299. package/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +3 -3
  300. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
  301. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  302. package/app/.next-cli-build/server/app/dashboard.rsc +5 -5
  303. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  304. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  305. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  306. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +5 -5
  307. package/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
  308. package/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +3 -3
  309. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  310. package/app/.next-cli-build/server/app/index.html +1 -1
  311. package/app/.next-cli-build/server/app/index.rsc +3 -3
  312. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  313. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
  314. package/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
  315. package/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +3 -3
  316. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
  317. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  318. package/app/.next-cli-build/server/app/landing.html +1 -1
  319. package/app/.next-cli-build/server/app/landing.rsc +3 -3
  320. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
  321. package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  322. package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +3 -3
  323. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
  324. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  325. package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  326. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  327. package/app/.next-cli-build/server/app/login.html +1 -1
  328. package/app/.next-cli-build/server/app/login.rsc +4 -4
  329. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
  330. package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  331. package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +3 -3
  332. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
  333. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  334. package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  335. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  336. package/app/.next-cli-build/server/app-paths-manifest.json +7 -7
  337. package/app/.next-cli-build/server/chunks/1795.js +1 -1
  338. package/app/.next-cli-build/server/chunks/450.js +1 -1
  339. package/app/.next-cli-build/server/chunks/6263.js +1 -1
  340. package/app/.next-cli-build/server/chunks/6283.js +1 -1
  341. package/app/.next-cli-build/server/chunks/6634.js +1 -1
  342. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  343. package/app/.next-cli-build/server/pages/404.html +1 -1
  344. package/app/.next-cli-build/server/pages/500.html +1 -1
  345. package/app/.next-cli-build/static/chunks/{4156-f729a06a738f7c32.js → 4156-464d430895a9e111.js} +1 -1
  346. package/app/.next-cli-build/static/chunks/{505-83cc69808ab384cd.js → 505-46eb141bcb8efa6b.js} +1 -1
  347. package/app/cli/.build-home/.9router/db/backups/upgrade-0.4.49-to-0.4.50-0.4.50-20260516-134729/data.sqlite +0 -0
  348. package/app/cli/.build-home/.9router/db/data.sqlite +0 -0
  349. package/app/package.json +1 -1
  350. package/app/public/i18n/literals/vi.json +2 -2
  351. package/cli.js +30 -11
  352. package/package.json +1 -1
  353. /package/app/.next-cli-build/static/{xMfWDbY_wYdb3eqNxiWRB → 4hJhKmQNjYDMpsel-dmHu}/_buildManifest.js +0 -0
  354. /package/app/.next-cli-build/static/{xMfWDbY_wYdb3eqNxiWRB → 4hJhKmQNjYDMpsel-dmHu}/_ssgManifest.js +0 -0
@@ -4,4 +4,4 @@
4
4
  `,children:[g.includes(e.name)&&(0,r.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),e.name]},e.id)})})]}),Object.entries(z).map(([e,t])=>(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,r.jsx)(o.A,{src:`/providers/${e}.png`,alt:t.name,size:14,fallbackText:(t.name||e).slice(0,2).toUpperCase(),fallbackColor:t.color}),(0,r.jsx)("span",{className:"text-xs font-medium text-primary",children:t.name}),(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",t.models.length,")"]})]}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:t.models.map(e=>{let t=n===e.value,s=e.isPlaceholder;return(0,r.jsx)("button",{onClick:()=>q(e),title:s?"Select to pre-fill, then edit model ID in the input":void 0,className:`
5
5
  px-2 py-1 rounded-xl text-xs font-medium transition-all border hover:cursor-pointer
6
6
  ${s?"border-dashed border-border text-text-muted hover:border-primary/50 hover:text-primary bg-surface italic":t?"bg-primary text-white border-primary":g.includes(e.value)?"bg-primary border-primary text-white hover:bg-primary-hover":"bg-surface border-border text-text-main hover:border-primary/50 hover:bg-primary/5"}
7
- `,children:(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[g.includes(e.value)&&!s&&(0,r.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"edit"}),e.name]}):e.isCustom?(0,r.jsxs)(r.Fragment,{children:[e.name,(0,r.jsx)("span",{className:"text-[9px] opacity-60 font-normal",children:"custom"})]}):e.name]})},e.value)})})]},e)),0===Object.keys(z).length&&0===_.length&&(0,r.jsxs)("div",{className:"text-center py-4 text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1 block",children:"search_off"}),(0,r.jsx)("p",{className:"text-xs",children:"No models found"})]})]})]})}u.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onSelect:n().func.isRequired,onDeselect:n().func,selectedModel:n().string,activeProviders:n().arrayOf(n().shape({provider:n().string.isRequired})),title:n().string,modelAliases:n().object,kindFilter:n().string,addedModelValues:n().arrayOf(n().string),closeOnSelect:n().bool}},26066:(e,t,s)=>{s.d(t,{default:()=>n});var r=s(73365),a=s(1521),l=s(66911);function n({isOpen:e,onClose:t,onAdd:s,addedNames:i=[]}){let[o,d]=(0,a.useState)([]),[c,m]=(0,a.useState)(!1),[x,u]=(0,a.useState)(""),[p,h]=(0,a.useState)("all"),[f,b]=(0,a.useState)(null),[g,j]=(0,a.useState)(null),[v,y]=(0,a.useState)({}),[N,w]=(0,a.useState)({}),[k,C]=(0,a.useState)({});(0,a.useEffect)(()=>{!e||o.length>0||(m(!0),fetch("/api/cli-tools/cowork-mcp-registry").then(e=>e.json()).then(e=>{e.error?b(e.error):d(e.servers||[])}).catch(e=>b(e.message)).finally(()=>m(!1)))},[e]);let S=(0,a.useMemo)(()=>new Set(i),[i]),T=(0,a.useMemo)(()=>{let e=x.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,x,p]),$=async e=>{if(!v[e.url]){w(t=>({...t,[e.url]:!0}));try{let t=await fetch("/api/cli-tools/cowork-mcp-tools",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e.url})}),s=await t.json(),r=s.tools||[],a=Array.isArray(e.toolNames)?e.toolNames:[],l=r.length>0?r.map(e=>e.name):a;y(t=>({...t,[e.url]:{tools:r,requiresAuth:!!s.requiresAuth,error:s.error}})),C(t=>({...t,[e.url]:Object.fromEntries(l.map(e=>[e,!0]))}))}catch(t){y(s=>({...s,[e.url]:{tools:[],error:t.message}}))}finally{w(t=>({...t,[e.url]:!1}))}}},O=(e,t)=>{let s=k[e]||{};C(r=>({...r,[e]:Object.fromEntries(Object.keys(s).map(e=>[e,t]))}))};return(0,r.jsx)(l.default,{isOpen:e,onClose:t,title:"Browse MCP Marketplace",size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("input",{type:"text",value:x,onChange:e=>u(e.target.value),placeholder:"Search by name or description...",className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,r.jsxs)("select",{value:p,onChange:e=>h(e.target.value),className:"px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:[(0,r.jsx)("option",{value:"all",children:"All"}),(0,r.jsx)("option",{value:"authless",children:"Authless"}),(0,r.jsx)("option",{value:"oauth",children:"OAuth"})]})]}),f&&(0,r.jsx)("div",{className:"px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:f}),c&&(0,r.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-xs py-4 justify-center",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}),(0,r.jsx)("span",{children:"Loading registry..."})]}),!c&&(0,r.jsxs)("div",{className:"flex flex-col gap-1 max-h-[60vh] overflow-y-auto",children:[0===T.length&&(0,r.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=v[e.url],n=N[e.url],i=k[e.url]||{},o=Object.keys(i),d=Object.values(i).filter(Boolean).length;return(0,r.jsxs)("div",{className:"rounded border border-transparent hover:border-border",children:[(0,r.jsxs)("div",{className:"flex items-start gap-2 px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5",children:[e.iconUrl?(0,r.jsx)("img",{src:e.iconUrl,alt:"",className:"size-7 rounded shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}):(0,r.jsx)("div",{className:"size-7 rounded bg-surface shrink-0"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,r.jsx)("span",{className:"font-medium text-xs",children:e.title}),e.oauth?(0,r.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-amber-500/10 text-amber-600",children:"OAuth"}):(0,r.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-green-500/10 text-green-600",children:"Authless"}),e.toolCount>0&&(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:[e.toolCount," tools"]})]}),e.description&&(0,r.jsx)("p",{className:"text-[10px] text-text-muted line-clamp-2 mt-0.5",children:e.description})]}),(0,r.jsx)("button",{onClick:()=>t?null:void(g===e.url?j(null):(j(e.url),$(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,r.jsxs)("div",{className:"px-3 py-2 bg-surface/40 border-t border-border flex flex-col gap-2",children:[n&&(0,r.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-[10px] py-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin text-[14px]",children:"progress_activity"}),(0,r.jsx)("span",{children:"Probing server for tools..."})]}),!n&&l?.requiresAuth&&(0,r.jsx)("p",{className:"text-[10px] text-amber-600 bg-amber-500/10 px-2 py-1 rounded",children:"\uD83D\uDD10 OAuth required. Add now and authenticate after Apply; tool list will be discovered after first connect."}),!n&&l?.error&&!l?.requiresAuth&&(0,r.jsxs)("p",{className:"text-[10px] text-red-600 bg-red-500/10 px-2 py-1 rounded",children:["Probe failed: ",l.error]}),!n&&0===o.length&&!l?.requiresAuth&&!l?.error&&(0,r.jsx)("p",{className:"text-[10px] text-text-muted",children:"No tools advertised by server."}),!n&&o.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:[d,"/",o.length," tools enabled"]}),(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)("button",{onClick:()=>O(e.url,!0),className:"text-[10px] text-primary hover:underline",children:"All"}),(0,r.jsx)("span",{className:"text-[10px] text-text-muted",children:"\xb7"}),(0,r.jsx)("button",{onClick:()=>O(e.url,!1),className:"text-[10px] text-primary hover:underline",children:"None"})]})]}),(0,r.jsx)("div",{className:"grid grid-cols-2 gap-1 max-h-40 overflow-y-auto",children:o.map(t=>(0,r.jsxs)("label",{className:"flex items-center gap-1.5 text-[10px] cursor-pointer hover:bg-black/5 dark:hover:bg-white/5 px-1 rounded",children:[(0,r.jsx)("input",{type:"checkbox",checked:!!i[t],onChange:()=>{var s;return s=e.url,void C(e=>({...e,[s]:{...e[s],[t]:!e[s]?.[t]}}))},className:"size-3"}),(0,r.jsx)("span",{className:"truncate",children:t})]},t))})]}),(0,r.jsx)("button",{onClick:()=>{let t,r;return r=Object.keys(t=k[e.url]||{}).filter(e=>t[e]),void(s?.({name:e.slug||e.name,title:e.title,description:e.description,url:e.url,transport:e.transport,oauth:e.oauth,toolNames:r}),j(null))},className:"self-end px-2 py-1 rounded text-[10px] font-medium bg-primary text-white hover:bg-primary/90",children:"✓ Confirm Add"})]})]},e.url)})]}),(0,r.jsxs)("div",{className:"text-[10px] text-text-muted text-right",children:[T.length," of ",o.length," servers"]})]})})}},26125:(e,t,s)=>{s.d(t,{default:()=>c});var r=s(73365),a=s(1521),l=s(98196),n=s(86447),i=s.n(n),o=s(30721),d=s(43202);function c({isOpen:e,onClose:t}){let[s,n]=(0,a.useState)(""),[i,m]=(0,a.useState)(!1),[x,u]=(0,a.useState)(""),p=(0,a.useRef)(null);return((0,a.useEffect)(()=>{e&&!s&&(m(!0),u(""),fetch(d.Nu.changelogUrl).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.text()}).then(e=>n(o.xI.parse(e))).catch(e=>u(e.message||"Failed to load")).finally(()=>m(!1)))},[e,s]),(0,a.useEffect)(()=>{let s=e=>{p.current&&!p.current.contains(e.target)&&t()};if(e)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[e,t]),!e||"u"<typeof document)?null:(0,l.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:t}),(0,r.jsxs)("div",{ref:p,className:"relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-3xl flex flex-col max-h-[85vh]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Change Log"}),(0,r.jsx)("button",{onClick:t,className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":"Close",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,r.jsxs)("div",{className:"p-6 overflow-y-auto flex-1",children:[i&&(0,r.jsxs)("div",{className:"flex items-center justify-center py-10 text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin mr-2",children:"progress_activity"}),"Loading..."]}),x&&(0,r.jsxs)("div",{className:"text-red-500 py-4",children:["Failed to load changelog: ",x]}),!i&&!x&&s&&(0,r.jsx)("div",{className:"changelog-body text-text-main",dangerouslySetInnerHTML:{__html:s}})]})]})]}),document.body)}o.xI.setOptions({gfm:!0,breaks:!0}),c.propTypes={isOpen:i().bool.isRequired,onClose:i().func.isRequired}},32135:(e,t,s)=>{s.d(t,{default:()=>n});var r=s(73365),a=s(1521),l=s(292);function n(){let[e,t]=(0,a.useState)([]),[s,n]=(0,a.useState)(!0),[i,o]=(0,a.useState)(!0);(0,a.useEffect)(()=>{d()},[]),(0,a.useEffect)(()=>{let e;return i&&(e=setInterval(()=>{d(!1)},3e3)),()=>clearInterval(e)},[i]);let d=async(e=!0)=>{e&&n(!0);try{let e=await fetch("/api/usage/request-logs");if(e.ok){let s=await e.json();t(s)}}catch(e){console.error("Failed to fetch logs:",e)}finally{e&&n(!1)}};return(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"Request Logs"}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsxs)("label",{className:"text-sm font-medium text-text-muted flex items-center gap-2 cursor-pointer",children:[(0,r.jsx)("span",{children:"Auto Refresh (3s)"}),(0,r.jsx)("div",{onClick:()=>o(!i),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none ${i?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,r.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${i?"translate-x-5":"translate-x-1"}`})})]})})]}),(0,r.jsx)(l.default,{className:"overflow-hidden bg-black/5 dark:bg-black/20",children:(0,r.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:s&&0===e.length?(0,r.jsx)("div",{className:"p-8 text-center text-text-muted",children:"Loading logs..."}):0===e.length?(0,r.jsx)("div",{className:"p-8 text-center text-text-muted",children:"No logs recorded yet."}):(0,r.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,r.jsx)("thead",{className:"sticky top-0 bg-bg-subtle border-b border-border z-10",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"DateTime"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Model"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Provider"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Account"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"In"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Out"}),(0,r.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,r.jsx)("tbody",{className:"divide-y divide-border/50",children:e.map((e,t)=>{let s=e.split(" | ");if(s.length<7)return null;let a=s[6],l=a.includes("PENDING"),n=a.includes("FAILED"),i=a.includes("OK");return(0,r.jsxs)("tr",{className:`hover:bg-primary/5 transition-colors ${l?"bg-primary/5":""}`,children:[(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-text-muted",children:s[0]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border font-medium",children:s[1]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border",children:(0,r.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-bg-subtle border border-border text-[10px] uppercase font-bold",children:s[2]})}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border truncate max-w-[150px]",title:s[3],children:s[3]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-primary",children:s[4]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-success",children:s[5]}),(0,r.jsx)("td",{className:`px-3 py-1.5 font-bold ${i?"text-success":n?"text-error":"text-primary animate-pulse"}`,children:a})]},t)})})]})})}),(0,r.jsx)("div",{className:"text-[10px] text-text-muted italic",children:"Logs are loaded from the request history database."})]})}},35045:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(73365),a=s(87706);let l={default:"bg-surface-2 text-text-muted",primary:"bg-brand-500/10 text-brand-600 dark:text-brand-300",success:"bg-green-500/10 text-green-600 dark:text-green-400",warning:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",error:"bg-red-500/10 text-red-600 dark:text-red-400",info:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},n={sm:"px-2 py-0.5 text-[10px]",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1.5 text-sm"};function i({children:e,variant:t="default",size:s="md",dot:o=!1,icon:d,className:c}){return(0,r.jsxs)("span",{className:(0,a.cn)("inline-flex items-center gap-1.5 rounded-full font-semibold",l[t],n[s],c),children:[o&&(0,r.jsx)("span",{className:(0,a.cn)("size-1.5 rounded-full","success"===t&&"bg-green-500","warning"===t&&"bg-yellow-500","error"===t&&"bg-red-500","info"===t&&"bg-blue-500","primary"===t&&"bg-brand-500","default"===t&&"bg-gray-500")}),d&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:d}),e]})}},37066:(e,t,s)=>{s.d(t,{default:()=>l});var r=s(73365),a=s(87706);function l({label:e,options:t=[],value:s,onChange:n,placeholder:i="Select an option",error:o,hint:d,disabled:c=!1,required:m=!1,className:x,selectClassName:u,...p}){return(0,r.jsxs)("div",{className:(0,a.cn)("flex flex-col gap-1.5",x),children:[e&&(0,r.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,m&&(0,r.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)("select",{value:s,onChange:n,disabled:c,className:(0,a.cn)("w-full py-2.5 px-3 pr-10 text-sm text-text-main","bg-surface-2 border border-transparent rounded-[10px] appearance-none","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",o&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",u),...p,children:[(0,r.jsx)("option",{value:"",disabled:!0,children:i}),t.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,r.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"expand_more"})})]}),o&&(0,r.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,r.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},38230:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(73365),a=s(87706);let l={primary:"bg-brand-500 hover:bg-brand-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",secondary:"bg-surface-2 hover:bg-surface-3 text-text-main border border-border disabled:opacity-50",outline:"border border-border text-text-main hover:bg-surface-2 hover:border-brand-500/40",ghost:"text-text-muted hover:bg-surface-2 hover:text-text-main",danger:"bg-red-500 hover:bg-red-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",success:"bg-green-600 hover:bg-green-700 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted"},n={sm:"h-7 px-3 text-xs rounded-[8px]",md:"h-9 px-4 text-sm rounded-[10px]",lg:"h-11 px-6 text-sm rounded-[10px]"};function i({children:e,variant:t="primary",size:s="md",icon:o,iconRight:d,disabled:c=!1,loading:m=!1,fullWidth:x=!1,className:u,...p}){return(0,r.jsxs)("button",{className:(0,a.cn)("inline-flex items-center justify-center gap-2 font-semibold transition-all duration-150 ease-out cursor-pointer","active:scale-[0.97] disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100",l[t],n[s],x&&"w-full",u),disabled:c||m,...p,children:[m?(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}):o?(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:o}):null,e,d&&!m&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:d})]})}},44156:(e,t,s)=>{s.d(t,{A:()=>o});var r=s(73365),a=s(1521),l=s(98196);let n=[{icon:"terminal",label:"Terminal",desc:"Full shell access"},{icon:"cast",label:"Desktop",desc:"Screen sharing"},{icon:"folder_open",label:"Files",desc:"Browse & edit files"}],i=[{icon:"qr_code_scanner",text:"Scan QR to connect instantly"},{icon:"wifi_off",text:"No port forwarding needed"},{icon:"devices",text:"Works on any device"}];function o({isOpen:e,onClose:t}){return((0,a.useEffect)(()=>{if(!e)return;document.body.style.overflow="hidden";let s=e=>{"Escape"===e.key&&t()};return document.addEventListener("keydown",s),()=>{document.body.style.overflow="",document.removeEventListener("keydown",s)}},[e,t]),e)?(0,l.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:t}),(0,r.jsxs)("div",{className:"relative w-full max-w-sm rounded-[14px] overflow-hidden shadow-[var(--shadow-elev)] fade-in flex flex-col bg-surface border border-border-subtle",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border-subtle",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-7 h-7 rounded-[8px] flex items-center justify-center bg-primary",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-white text-base",children:"terminal"})}),(0,r.jsx)("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-mono",children:"9Remote"})]}),(0,r.jsx)("button",{onClick:t,className:"p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-base",children:"close"})})]}),(0,r.jsxs)("div",{className:"px-7 py-7 pb-9 flex flex-col gap-6",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center mt-2",children:[(0,r.jsx)("div",{className:"w-14 h-14 rounded-[14px] flex items-center justify-center mb-1 bg-primary shadow-[var(--shadow-warm)]",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-white text-[30px]",children:"terminal"})}),(0,r.jsx)("h1",{className:"text-lg font-bold text-text-main tracking-tight",children:"9Remote"}),(0,r.jsx)("p",{className:"text-xs text-text-muted leading-5 max-w-[220px]",children:"Access your terminal, desktop & files from anywhere"})]}),(0,r.jsx)("div",{className:"flex gap-2 w-full",children:n.map(({icon:e,label:t,desc:s})=>(0,r.jsxs)("div",{className:"flex-1 flex flex-col items-center gap-1.5 py-4 px-1 rounded-[10px] border border-border-subtle bg-surface-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-[22px]",children:e}),(0,r.jsx)("p",{className:"text-xs font-semibold text-text-main",children:t}),(0,r.jsx)("p",{className:"text-[10px] text-text-muted text-center leading-4",children:s})]},t))}),(0,r.jsx)("div",{className:"flex flex-col gap-3 w-full",children:i.map(({icon:e,text:t})=>(0,r.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined flex-shrink-0 text-primary text-[16px]",children:e}),(0,r.jsx)("span",{className:"text-xs text-text-muted",children:t})]},e))}),(0,r.jsxs)("button",{onClick:()=>window.open("https://9remote.cc","_blank"),className:"w-full py-3 flex items-center justify-center gap-2 text-sm font-semibold text-white rounded-[10px] bg-primary hover:bg-primary-hover shadow-[var(--shadow-warm)] active:scale-[0.98] transition-all",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base",children:"open_in_new"}),"Get 9Remote"]})]})]})]}),document.body):null}},50136:(e,t,s)=>{s.d(t,{default:()=>d});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156);let o="https://gitlab.com";function d({isOpen:e,providerInfo:t,onSuccess:s,onClose:l}){let n,[c,m]=(0,a.useState)(null),[x,u]=(0,a.useState)(o),[p,h]=(0,a.useState)(""),[f,b]=(0,a.useState)(""),[g,j]=(0,a.useState)(""),[v,y]=(0,a.useState)(!1),[N,w]=(0,a.useState)(null),[k,C]=(0,a.useState)(!1),[S,T]=(0,a.useState)(null),$=()=>{m(null),u(o),h(""),b(""),j(""),w(null),y(!1),C(!1),T(null),l()},O=async()=>{if(!g.trim())return void w("Personal Access Token is required");y(!0),w(null);try{let e=await fetch("/api/oauth/gitlab/pat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:g.trim(),baseUrl:x.trim()||o})}),t=await e.json();if(!e.ok)throw Error(t.error||"Authentication failed");s?.(),$()}catch(e){w(e.message)}finally{y(!1)}};return e?k&&S?(0,r.jsx)(i.LF,{isOpen:!0,provider:"gitlab",providerInfo:t,oauthMeta:S,onSuccess:()=>{s?.(),$()},onClose:()=>{C(!1),T(null)}}):(0,r.jsx)(i.aF,{isOpen:e,title:"Connect GitLab Duo",onClose:$,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[!c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Choose how to authenticate with GitLab Duo:"}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("button",{onClick:()=>m("oauth"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary",children:"lock_open"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"OAuth App"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab OAuth application"})]})]}),(0,r.jsxs)("button",{onClick:()=>m("pat"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary",children:"key"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"Personal Access Token"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab PAT with api scope"})]})]})]})]}),"oauth"===c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:"text-xs text-text-muted",children:["Create an OAuth app at"," ",(0,r.jsx)("a",{href:`${x.trim()||o}/-/profile/applications`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Applications"})," ","with redirect URI"," ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:(n=window.location.port||("https:"===window.location.protocol?"443":"80"),`http://localhost:${n}/callback`)})]}),(0,r.jsx)(i.pd,{label:"GitLab Base URL",value:x,onChange:e=>u(e.target.value),placeholder:o}),(0,r.jsx)(i.pd,{label:"Client ID",value:p,onChange:e=>h(e.target.value),placeholder:"Your OAuth application client ID"}),(0,r.jsx)(i.pd,{label:"Client Secret (optional for PKCE)",value:f,onChange:e=>b(e.target.value),placeholder:"Leave empty for public PKCE app"}),N&&(0,r.jsx)("p",{className:"text-sm text-red-500",children:N}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>{p.trim()?(w(null),T({baseUrl:x.trim()||o,clientId:p.trim(),clientSecret:f.trim()}),C(!0)):w("Client ID is required")},fullWidth:!0,disabled:!p.trim(),children:"Authorize"}),(0,r.jsx)(i.$n,{onClick:()=>{m(null),w(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"pat"===c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:"text-xs text-text-muted",children:["Create a PAT at"," ",(0,r.jsx)("a",{href:`${x.trim()||o}/-/user_settings/personal_access_tokens`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Access Tokens"})," ","with scopes: ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"api"}),","," ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"read_user"}),", and"," ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"ai_features"}),"."]}),(0,r.jsx)(i.pd,{label:"GitLab Base URL",value:x,onChange:e=>u(e.target.value),placeholder:o}),(0,r.jsx)(i.pd,{label:"Personal Access Token",value:g,onChange:e=>j(e.target.value),placeholder:"glpat-xxxxxxxxxxxxxxxxxxxx",type:"password"}),N&&(0,r.jsx)("p",{className:"text-sm text-red-500",children:N}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:O,fullWidth:!0,disabled:!g.trim()||v,loading:v,children:"Connect"}),(0,r.jsx)(i.$n,{onClick:()=>{m(null),w(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})}):null}d.propTypes={isOpen:n().bool.isRequired,providerInfo:n().shape({name:n().string}),onSuccess:n().func,onClose:n().func.isRequired}},51454:(e,t,s)=>{s.d(t,{default:()=>d});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156),o=s(96459);function d({isOpen:e,provider:t,onSuccess:s,onClose:l}){let[n,c]=(0,a.useState)("loading"),[m,x]=(0,a.useState)(""),[u,p]=(0,a.useState)(null),[h,f]=(0,a.useState)(""),[b,g]=(0,a.useState)(null),{copied:j,copy:v}=(0,o.C)();(0,a.useEffect)(()=>{e&&t&&(async()=>{try{g(null),c("loading");let e=await fetch(`/api/oauth/kiro/social-authorize?provider=${t}`),s=await e.json();if(!e.ok)throw Error(s.error);p(s),x(s.authUrl),c("input"),window.open(s.authUrl,"_blank")}catch(e){g(e.message),c("error")}})()},[e,t]);let y=async()=>{try{let e;g(null);try{e=new URL(h)}catch(e){throw Error("Invalid callback URL format")}let r=e.searchParams.get("code");e.searchParams.get("state");let a=e.searchParams.get("error");if(a)throw Error(e.searchParams.get("error_description")||a);if(!r)throw Error("No authorization code found in URL");let l=await fetch("/api/oauth/kiro/social-exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:r,codeVerifier:u.codeVerifier,provider:t})}),n=await l.json();if(!l.ok)throw Error(n.error);c("success"),s?.()}catch(e){g(e.message),c("error")}},N="google"===t?"Google":"GitHub";return(0,r.jsx)(i.aF,{isOpen:e,title:`Connect Kiro via ${N}`,onClose:l,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:["loading"===n&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Initializing..."}),(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["Setting up ",N," authentication"]})]}),"input"===n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.pd,{value:m,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,r.jsx)(i.$n,{variant:"secondary",icon:"auth_url"===j?"check":"content_copy",onClick:()=>v(m,"auth_url"),children:"Copy"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser address bar."}),(0,r.jsx)(i.pd,{value:h,onChange:e=>f(e.target.value),placeholder:"kiro://kiro.kiroAgent/authenticate-success?code=...",className:"font-mono text-xs"})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:y,fullWidth:!0,disabled:!h,children:"Connect"}),(0,r.jsx)(i.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===n&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,r.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your Kiro account via ",N," has been connected."]}),(0,r.jsx)(i.$n,{onClick:l,fullWidth:!0,children:"Done"})]}),"error"===n&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,r.jsx)("p",{className:"text-sm text-red-600 mb-4",children:b}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>c("input"),variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,r.jsx)(i.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}d.propTypes={isOpen:n().bool.isRequired,provider:n().oneOf(["google","github"]).isRequired,onSuccess:n().func,onClose:n().func.isRequired}},52327:(e,t,s)=>{s.d(t,{default:()=>m});var r=s(73365),a=s(1521),l=s(66911),n=s(53038),i=s(38230),o=s(24372);let d=/^[a-zA-Z0-9_.\-]+$/;function c({index:e,model:t,isFirst:s,isLast:l,onEdit:n,onMoveUp:i,onMoveDown:o,onRemove:d}){let[m,x]=(0,a.useState)(!1),[u,p]=(0,a.useState)(t),h=()=>{let e=u.trim();e&&e!==t?n(e):p(t),x(!1)};return(0,r.jsxs)("div",{className:"group flex min-w-0 items-center gap-1.5 rounded-md bg-black/[0.02] px-2 py-1 transition-colors hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04]",children:[(0,r.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:e+1}),m?(0,r.jsx)("input",{autoFocus:!0,value:u,onChange:e=>p(e.target.value),onBlur:h,onKeyDown:e=>{"Enter"===e.key&&h(),"Escape"===e.key&&(p(t),x(!1))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-white px-1.5 py-0.5 font-mono text-xs text-text-main outline-none dark:bg-black/20"}):(0,r.jsx)("div",{className:"min-w-0 flex-1 cursor-text truncate rounded px-1.5 py-0.5 font-mono text-xs text-text-main hover:bg-black/5 dark:hover:bg-white/5",onClick:()=>x(!0),title:"Click to edit",children:t}),(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,r.jsx)("button",{onClick:i,disabled:s,className:`p-0.5 rounded ${s?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,r.jsx)("button",{onClick:o,disabled:l,className:`p-0.5 rounded ${l?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,r.jsx)("button",{onClick:d,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function m({isOpen:e,combo:t,onClose:s,onSave:x,activeProviders:u,kindFilter:p=null,forcePrefix:h="",title:f}){let b=t?.name?h&&t.name.startsWith(h)?t.name.slice(h.length):t.name:"",[g,j]=(0,a.useState)(b),[v,y]=(0,a.useState)(t?.models||[]),[N,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(!1),[S,T]=(0,a.useState)(""),[$,O]=(0,a.useState)({});(0,a.useEffect)(()=>{e&&fetch("/api/models/alias").then(e=>e.ok?e.json():null).then(e=>e&&O(e.aliases||{})).catch(()=>{})},[e]);let R=e=>{if(!e.trim())return T("Name is required"),!1;let t=h+e;return d.test(t)?(T(""),!0):(T("Only letters, numbers, -, _ and . allowed"),!1)},P=e=>{let t=e.target.value;h&&t.startsWith(h)&&(t=t.slice(h.length)),j(t),t?R(t):T("")},E=async()=>{R(g)&&(C(!0),await x({name:h+g.trim(),models:v}),C(!1))},I=!!t;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.default,{isOpen:e,onClose:s,title:f||(I?"Edit Combo":"Create Combo"),children:(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsxs)("div",{children:[h?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("label",{className:"text-sm font-medium mb-1 block",children:"Combo Name"}),(0,r.jsxs)("div",{className:"flex items-stretch",children:[(0,r.jsx)("span",{className:"inline-flex items-center px-2 rounded-l border border-r-0 border-black/10 dark:border-white/10 bg-black/[0.04] dark:bg-white/[0.04] text-text-muted font-mono text-sm",children:h}),(0,r.jsx)("input",{value:g,onChange:P,placeholder:"my-combo",className:"flex-1 min-w-0 rounded-r border border-black/10 dark:border-white/10 bg-white dark:bg-black/20 px-2 py-1.5 font-mono text-sm outline-none focus:border-primary"})]}),S&&(0,r.jsx)("p",{className:"text-[11px] text-red-500 mt-0.5",children:S})]}):(0,r.jsx)(n.default,{label:"Combo Name",value:g,onChange:P,placeholder:"my-combo",error:S}),(0,r.jsxs)("p",{className:"text-[10px] text-text-muted mt-0.5",children:[h?`Auto-prefixed with "${h}". `:"","Only letters, numbers, -, _ and . allowed"]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===v.length?(0,r.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,r.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:v.map((e,t)=>(0,r.jsx)(c,{index:t,model:e,isFirst:0===t,isLast:t===v.length-1,onEdit:e=>{let s=[...v];s[t]=e,y(s)},onMoveUp:()=>(e=>{if(0===e)return;let t=[...v];[t[e-1],t[e]]=[t[e],t[e-1]],y(t)})(t),onMoveDown:()=>(e=>{if(e===v.length-1)return;let t=[...v];[t[e],t[e+1]]=[t[e+1],t[e]],y(t)})(t),onRemove:()=>y(v.filter((e,s)=>s!==t))},t))}),(0,r.jsxs)("button",{onClick:()=>w(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-primary font-medium hover:text-primary hover:border-primary/50 transition-colors flex items-center justify-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,r.jsx)(i.default,{onClick:s,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,r.jsx)(i.default,{onClick:E,fullWidth:!0,size:"sm",disabled:!g.trim()||!!S||k,children:k?"Saving...":I?"Save":"Create"})]})]})}),(0,r.jsx)(o.default,{isOpen:N,onClose:()=>w(!1),onSelect:e=>{v.includes(e.value)||y([...v,e.value])},onDeselect:e=>{y(v.filter(t=>t!==e.value))},activeProviders:u,modelAliases:$,title:"Add Model to Combo",kindFilter:p,addedModelValues:v,closeOnSelect:!1})]})}},53038:(e,t,s)=>{s.d(t,{default:()=>l});var r=s(73365),a=s(87706);function l({label:e,type:t="text",placeholder:s,value:n,onChange:i,error:o,hint:d,icon:c,disabled:m=!1,required:x=!1,className:u,inputClassName:p,...h}){return(0,r.jsxs)("div",{className:(0,a.cn)("flex flex-col gap-1.5",u),children:[e&&(0,r.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,x&&(0,r.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,r.jsxs)("div",{className:"relative",children:[c&&(0,r.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:c})}),(0,r.jsx)("input",{type:t,placeholder:s,value:n,onChange:i,disabled:m,className:(0,a.cn)("w-full py-2.5 px-3 text-sm text-text-main bg-surface-2 rounded-[10px]","border border-transparent placeholder-text-muted/70","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 ease-out disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",c&&"pl-10",o&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",p),...h})]}),o&&(0,r.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,r.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},54546:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(73365),a=s(86447),l=s.n(a),n=s(84675);function i({children:e}){return(0,r.jsxs)("div",{className:"min-h-screen flex flex-col relative bg-bg transition-colors duration-500 overflow-x-hidden selection:bg-primary/20 selection:text-primary",children:[(0,r.jsx)("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-primary/5 dark:bg-primary/5 rounded-full blur-[100px] pointer-events-none z-0"}),(0,r.jsx)("div",{className:"fixed bottom-0 right-0 w-[600px] h-[600px] bg-orange-200/20 dark:bg-orange-900/10 rounded-full blur-[120px] pointer-events-none z-0 translate-y-1/3 translate-x-1/3"}),(0,r.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,r.jsx)(n.default,{variant:"card"})}),(0,r.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:e})]})}i.propTypes={children:l().node.isRequired}},56550:(e,t,s)=>{s.d(t,{default:()=>y});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(99568),o=s.n(i),d=s(29717),c=s(87706),m=s(43202),x=s(82495),u=s(96459),p=s(38230),h=s(66911);let f=["embedding","image","tts","stt"],b="/dashboard/media-providers/web",g=[{href:"/dashboard/endpoint",label:"Endpoint",icon:"api"},{href:"/dashboard/providers",label:"Providers",icon:"dns"},{href:"/dashboard/combos",label:"Combos",icon:"layers"},{href:"/dashboard/usage",label:"Usage",icon:"bar_chart"},{href:"/dashboard/quota",label:"Quota Tracker",icon:"data_usage"},{href:"/dashboard/mitm",label:"MITM",icon:"security"},{href:"/dashboard/cli-tools",label:"CLI Tools",icon:"terminal"}],j=[{href:"/dashboard/console-log",label:"Console Log",icon:"terminal"},{href:"/dashboard/translator",label:"Translator",icon:"translate"}],v=[{href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"lan"},{href:"/dashboard/skills",label:"Skills",icon:"extension"}];function y({onClose:e}){let t=(0,d.usePathname)(),[s,l]=(0,a.useState)(!1),[n,i]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(!1),[T,$]=(0,a.useState)(null),[O,R]=(0,a.useState)(!1),[P,E]=(0,a.useState)(!1),[I,M]=(0,a.useState)(0),[A,L]=(0,a.useState)(!1),{copied:_,copy:z}=(0,u.C)(2e3),q=m.h0.installCmdLatest;(0,a.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{e.enableTranslator&&L(!0)}).catch(()=>{})},[]),(0,a.useEffect)(()=>{fetch("/api/version").then(e=>e.json()).then(e=>{e.hasUpdate&&$(e)}).catch(()=>{})},[]);let U=e=>"/dashboard/endpoint"===e?"/dashboard"===t||t.startsWith("/dashboard/endpoint"):t.startsWith(e),F=async()=>{try{await navigator.clipboard.writeText(q)}catch{}z(q);let e=m.h0.shutdownCountdownSec;M(e);let t=setInterval(()=>{M(e-=1),e<=0&&(clearInterval(t),fetch("/api/version/shutdown",{method:"POST"}).catch(()=>{}),S(!0))},1e3)},D=async()=>{k(!0);try{await fetch("/api/shutdown",{method:"POST"})}catch(e){}k(!1),i(!1),S(!0)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("aside",{className:"flex w-72 flex-col border-r border-border-subtle bg-vibrancy backdrop-blur-xl transition-colors duration-300 min-h-full",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-6 pt-5 pb-2",children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FF5F56]"}),(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]"}),(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]"})]}),(0,r.jsxs)("div",{className:"px-6 py-4 flex flex-col gap-2",children:[(0,r.jsxs)(o(),{href:"/dashboard",className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-9 rounded-[10px] bg-gradient-to-br from-brand-500 to-brand-700 shadow-[var(--shadow-warm)]",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-white text-[20px]",children:"hub"})}),(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("h1",{className:"text-lg font-semibold tracking-tight text-text-main",children:m.vQ.name}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:["v",m.vQ.version]})]})]}),T&&(0,r.jsxs)("div",{className:"flex flex-col gap-1.5 rounded p-1 -m-1",children:[(0,r.jsxs)("span",{className:"text-xs font-semibold text-green-600 dark:text-amber-500",children:["↑ New version available: v",T.latestVersion]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{onClick:()=>R(!0),className:"px-2 py-1 rounded bg-green-600 hover:bg-green-700 dark:bg-amber-500 dark:hover:bg-amber-600 text-white text-[11px] font-semibold transition-colors cursor-pointer",children:"Update now"}),(0,r.jsx)("button",{onClick:()=>z(q),title:"Copy install command",className:"flex-1 text-left hover:opacity-80 transition-opacity cursor-pointer min-w-0",children:(0,r.jsx)("code",{className:"block text-[10px] text-green-600/80 dark:text-amber-400/70 font-mono truncate",children:_?"✓ copied!":q})})]})]})]}),(0,r.jsxs)("nav",{className:"flex-1 px-4 py-2 space-y-0.5 overflow-y-auto custom-scrollbar",children:[g.map(t=>(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",U(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",U(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href)),(0,r.jsxs)("div",{className:"pt-3 mt-2 space-y-0.5",children:[(0,r.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"System"}),(0,r.jsxs)("button",{onClick:()=>l(e=>!e),className:(0,c.cn)("w-full flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",t.startsWith("/dashboard/media-providers")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"perm_media"}),(0,r.jsx)("span",{className:"text-[13px] font-medium flex-1 text-left",children:"Media Providers"}),(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"},children:"expand_more"})]}),s&&(0,r.jsxs)("div",{className:"pl-4",children:[x.rj.filter(e=>f.includes(e.id)).map(s=>(0,r.jsxs)(o(),{href:`/dashboard/media-providers/${s.id}`,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-1 rounded-lg transition-all group",t.startsWith(`/dashboard/media-providers/${s.id}`)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:s.icon}),(0,r.jsx)("span",{className:"text-sm",children:s.label})]},s.id)),(0,r.jsxs)(o(),{href:b,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-1 rounded-lg transition-all group",t.startsWith(b)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"travel_explore"}),(0,r.jsx)("span",{className:"text-sm",children:"Web Fetch & Search"})]},"web")]}),v.map(t=>(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",U(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",U(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href)),j.map(t=>"/dashboard/translator"!==t.href||A?(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",U(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",U(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href):null),(0,r.jsxs)(o(),{href:"/dashboard/profile",onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",U("/dashboard/profile")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",U("/dashboard/profile")?"fill-1":"group-hover:text-primary transition-colors"),children:"settings"}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:"Settings"})]})]})]}),(0,r.jsx)("div",{className:"p-3 border-t border-border-subtle",children:(0,r.jsx)(p.default,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>i(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"})})]}),(0,r.jsx)(h.ConfirmModal,{isOpen:n,onClose:()=>i(!1),onConfirm:D,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:w}),(0,r.jsx)(h.ConfirmModal,{isOpen:O,onClose:()=>R(!1),onConfirm:()=>{R(!1),E(!0)},title:"Update 9Router",message:`Show install command for v${T?.latestVersion||""}? You can copy it and shutdown to install manually.`,confirmText:"Show Command",cancelText:"Cancel",variant:"primary"}),(C||P)&&(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm p-6",children:P?(0,r.jsx)(N,{latestVersion:T?.latestVersion,installCmd:q,copied:_,onCopyAndShutdown:F,onCancel:()=>{E(!1),M(0)},countdown:I,isDisconnected:C}):(0,r.jsxs)("div",{className:"text-center p-8",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-16 rounded-full bg-red-500/20 text-red-500 mx-auto mb-4",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"power_off"})}),(0,r.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Server Disconnected"}),(0,r.jsx)("p",{className:"text-text-muted mb-6",children:"The proxy server has been stopped."}),(0,r.jsx)(p.default,{variant:"secondary",onClick:()=>globalThis.location.reload(),children:"Reload Page"})]})})]})}function N({latestVersion:e,installCmd:t,copied:s,onCopyAndShutdown:a,onCancel:l,countdown:n,isDisconnected:i}){let o=n>0;return(0,r.jsxs)("div",{className:"w-full max-w-lg rounded-xl bg-neutral-900/95 border border-white/10 p-6 text-white",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-11 rounded-full bg-amber-500/20 text-amber-400",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[24px]",children:"content_copy"})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("h2",{className:"text-lg font-semibold",children:["Update 9Router",e?` to v${e}`:""]}),(0,r.jsx)("p",{className:"text-xs text-white/60",children:i?"Server stopped. Paste the command into a terminal to install.":o?`Command copied. Server will stop in ${n}s...`:"Click the button below to copy the install command and shutdown."})]})]}),(0,r.jsx)("p",{className:"text-sm text-white/80 mb-2",children:"Install command:"}),(0,r.jsx)("div",{className:"w-full px-3 py-2 rounded bg-white/5 mb-4",children:(0,r.jsx)("code",{className:"text-xs font-mono text-amber-400 break-all",children:t})}),(0,r.jsxs)("ol",{className:"text-xs text-white/70 space-y-1 list-decimal list-inside mb-4",children:[(0,r.jsxs)("li",{children:["Click ",(0,r.jsx)("strong",{children:"Copy & Shutdown"})," below."]}),(0,r.jsx)("li",{children:"Paste the command into your terminal and press Enter."}),(0,r.jsxs)("li",{children:["Run ",(0,r.jsx)("code",{className:"px-1 rounded bg-white/10 text-green-400",children:"9router"})," again after install."]})]}),i?(0,r.jsx)(p.default,{variant:"secondary",fullWidth:!0,onClick:()=>globalThis.location.reload(),children:"Reload Page"}):(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(p.default,{variant:"secondary",onClick:l,disabled:o,children:"Cancel"}),(0,r.jsx)(p.default,{variant:"primary",fullWidth:!0,onClick:a,disabled:o,children:s?"✓ Copied — shutting down...":o?`Shutting down in ${n}s`:"Copy & Shutdown"})]})]})}y.propTypes={onClose:n().func},N.propTypes={latestVersion:n().string,installCmd:n().string.isRequired,copied:n().bool,onCopyAndShutdown:n().func.isRequired,onCancel:n().func.isRequired,countdown:n().number,isDisconnected:n().bool}},63380:(e,t,s)=>{s.d(t,{default:()=>o});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156);function o({isOpen:e,onMethodSelect:t,onClose:s}){let[l,n]=(0,a.useState)(null),[d,c]=(0,a.useState)(""),[m,x]=(0,a.useState)("us-east-1"),[u,p]=(0,a.useState)(""),[h,f]=(0,a.useState)(null),[b,g]=(0,a.useState)(!1),[j,v]=(0,a.useState)(!1),[y,N]=(0,a.useState)(!1);(0,a.useEffect)(()=>{"import"===l&&e&&(async()=>{v(!0),f(null),N(!1);try{let e=await fetch("/api/oauth/kiro/auto-import"),t=await e.json();t.found?(p(t.refreshToken),N(!0)):f(t.error||"Could not auto-detect token")}catch(e){f("Failed to auto-detect token")}finally{v(!1)}})()},[l,e]);let w=e=>{n(e),f(null)},k=()=>{n(null),f(null)},C=async()=>{if(!u.trim())return void f("Please enter a refresh token");g(!0),f(null);try{let e=await fetch("/api/oauth/kiro/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:u.trim()})}),s=await e.json();if(!e.ok)throw Error(s.error||"Import failed");t("import")}catch(e){f(e.message)}finally{g(!1)}},S=e=>{t("social",{provider:e})};return(0,r.jsx)(i.aF,{isOpen:e,title:"Connect Kiro",onClose:s,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[!l&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Choose your authentication method:"}),(0,r.jsx)("button",{onClick:()=>t("builder-id"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"shield"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"AWS Builder ID"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Recommended for most users. Free AWS account required."})]})]})}),(0,r.jsx)("button",{onClick:()=>w("idc"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"business"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"AWS IAM Identity Center"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"For enterprise users with custom AWS IAM Identity Center."})]})]})}),(0,r.jsx)("button",{onClick:()=>w("social-google"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"account_circle"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"Google Account"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your Google account (manual callback)."})]})]})}),(0,r.jsx)("button",{onClick:()=>w("social-github"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"code"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"GitHub Account"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your GitHub account (manual callback)."})]})]})}),(0,r.jsx)("button",{onClick:()=>w("import"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"file_upload"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"Import Token"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Paste refresh token from Kiro IDE."})]})]})})]}),"idc"===l&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["IDC Start URL ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(i.pd,{value:d,onChange:e=>c(e.target.value),placeholder:"https://your-org.awsapps.com/start",className:"font-mono text-sm"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Your organization's AWS IAM Identity Center URL"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium mb-2",children:"AWS Region"}),(0,r.jsx)(i.pd,{value:m,onChange:e=>x(e.target.value),placeholder:"us-east-1",className:"font-mono text-sm"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"AWS region for your Identity Center (default: us-east-1)"})]}),h&&(0,r.jsx)("p",{className:"text-sm text-red-600",children:h}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>{d.trim()?t("idc",{startUrl:d.trim(),region:m}):f("Please enter your IDC start URL")},fullWidth:!0,children:"Continue"}),(0,r.jsx)(i.$n,{onClick:k,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-google"===l&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,r.jsxs)("div",{className:"flex-1 text-sm",children:[(0,r.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,r.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>S("google"),fullWidth:!0,children:"Continue with Google"}),(0,r.jsx)(i.$n,{onClick:k,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-github"===l&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,r.jsxs)("div",{className:"flex-1 text-sm",children:[(0,r.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,r.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>S("github"),fullWidth:!0,children:"Continue with GitHub"}),(0,r.jsx)(i.$n,{onClick:k,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"import"===l&&(0,r.jsxs)("div",{className:"space-y-4",children:[j&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting token..."}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from AWS SSO cache"})]}),!j&&(0,r.jsxs)(r.Fragment,{children:[y&&(0,r.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,r.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Token auto-detected from Kiro IDE successfully!"})]})}),!y&&!h&&(0,r.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Kiro IDE not detected. Please paste your refresh token manually."})]})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Refresh Token ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(i.pd,{value:u,onChange:e=>p(e.target.value),placeholder:"Token will be auto-filled...",className:"font-mono text-sm"})]}),h&&(0,r.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,r.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:h})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:C,fullWidth:!0,disabled:b||!u.trim(),children:b?"Importing...":"Import Token"}),(0,r.jsx)(i.$n,{onClick:k,variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})]})})}o.propTypes={isOpen:n().bool.isRequired,onMethodSelect:n().func.isRequired,onClose:n().func.isRequired}},66911:(e,t,s)=>{s.d(t,{ConfirmModal:()=>d,default:()=>o});var r=s(73365),a=s(1521),l=s(87706),n=s(38230),i=s(13333);function o({isOpen:e,onClose:t,title:s,children:n,footer:d,size:c="md",closeOnOverlay:m=!0,showTrafficLights:x=!0,className:u}){return((0,a.useEffect)(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),(0,a.useEffect)(()=>{let s=s=>{"Escape"===s.key&&e&&t()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,t]),e)?(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:m?t:void 0}),(0,r.jsxs)("div",{className:(0,l.cn)("relative w-full bg-surface","border border-border-subtle","rounded-[14px] shadow-[var(--shadow-elev)]","fade-in",{sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"}[c],u),children:[(s||x)&&(0,r.jsxs)("div",{className:"flex items-center justify-between p-2 border-b border-border-subtle",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[x&&(0,r.jsxs)("div",{className:"hidden md:flex items-center gap-2 mr-4 ml-2",children:[(0,r.jsx)(i.default,{text:"Close",position:"top",color:"#FF5F56",children:(0,r.jsx)("button",{onClick:t,"aria-label":"Close",title:"Close",className:"w-4 h-4 rounded-full bg-[#FF5F56] hover:brightness-90 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,r.jsx)("span",{className:"text-[9px] font-bold text-white opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:"✕"})})}),(0,r.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"}),(0,r.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"})]}),s&&(0,r.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:s})]}),(0,r.jsx)("button",{onClick:t,"aria-label":"Close",className:"md:hidden p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,r.jsx)("div",{className:"p-6 max-h-[calc(85vh-100px)] overflow-y-auto custom-scrollbar",children:n}),d&&(0,r.jsx)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-border-subtle",children:d})]})]}):null}function d({isOpen:e,onClose:t,onConfirm:s,title:a="Confirm",message:l,confirmText:i="Confirm",cancelText:c="Cancel",variant:m="danger",loading:x=!1}){return(0,r.jsx)(o,{isOpen:e,onClose:t,title:a,size:"sm",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.default,{variant:"ghost",onClick:t,disabled:x,children:c}),(0,r.jsx)(n.default,{variant:m,onClick:s,loading:x,children:i})]}),children:(0,r.jsx)("p",{className:"text-text-muted",children:l})})}},67692:(e,t,s)=>{s.d(t,{default:()=>n});var r=s(73365),a=s(1521),l=s(44156);function n(){let[e,t]=(0,a.useState)(!1);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{onClick:()=>t(!0),className:"relative flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg transition-all text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5",title:"9Remote",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"computer"}),(0,r.jsx)("span",{className:"text-xs font-medium",children:"Remote"})]}),(0,r.jsx)(l.A,{isOpen:e,onClose:()=>t(!1)})]})}},68266:(e,t,s)=>{s.d(t,{A:()=>i});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l);function i({src:e,alt:t,size:s=32,className:l="",fallbackText:n="?",fallbackColor:o}){let[d,c]=(0,a.useState)(!1);return!e||d?(0,r.jsx)("span",{className:`inline-flex items-center justify-center font-bold rounded-lg ${l}`.trim(),style:{width:s,height:s,color:o,fontSize:Math.max(10,Math.floor(.38*s))},children:n}):(0,r.jsx)("img",{src:e,alt:t,width:s,height:s,className:l,onError:()=>c(!0)})}i.propTypes={src:n().string,alt:n().string,size:n().number,className:n().string,fallbackText:n().string,fallbackColor:n().string}},68600:(e,t,s)=>{s.d(t,{default:()=>o});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156);function o({isOpen:e,onSuccess:t,onClose:s}){let[l,n]=(0,a.useState)(""),[d,c]=(0,a.useState)(!1),[m,x]=(0,a.useState)(null),[u,p]=(0,a.useState)(!1),h=async()=>{if(!l.trim())return void x("Please paste your cookie");c(!0),x(null);try{let e=await fetch("/api/oauth/iflow/cookie",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:l.trim()})}),s=await e.json();if(!e.ok)throw Error(s.error||"Authentication failed");p(!0),setTimeout(()=>{t?.(),f()},1500)}catch(e){x(e.message)}finally{c(!1)}},f=()=>{n(""),x(null),p(!1),s?.()};return(0,r.jsx)(i.aF,{isOpen:e,onClose:f,title:"iFlow Cookie Authentication",children:(0,r.jsx)("div",{className:"space-y-4",children:u?(0,r.jsxs)("div",{className:"text-center py-8",children:[(0,r.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,r.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,r.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,r.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,r.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,r.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,r.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,r.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,r.jsx)("li",{children:"Login to your account"}),(0,r.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,r.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,r.jsx)("li",{children:"Paste it below"})]})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,r.jsx)("textarea",{value:l,onChange:e=>n(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})]}),m&&(0,r.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,r.jsx)("p",{className:"text-sm text-error",children:m})}),(0,r.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,r.jsx)(i.$n,{variant:"secondary",onClick:f,disabled:d,fullWidth:!0,children:"Cancel"}),(0,r.jsx)(i.$n,{onClick:h,loading:d,fullWidth:!0,children:"Authenticate"})]})]})})})}o.propTypes={isOpen:n().bool.isRequired,onSuccess:n().func,onClose:n().func}},70391:(e,t,s)=>{s.d(t,{default:()=>o});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156);function o({isOpen:e,onSuccess:t,onClose:s}){let[l,n]=(0,a.useState)(""),[d,c]=(0,a.useState)(""),[m,x]=(0,a.useState)(null),[u,p]=(0,a.useState)(!1),[h,f]=(0,a.useState)(!1),[b,g]=(0,a.useState)(!1),[j,v]=(0,a.useState)(!1),y=async()=>{f(!0),x(null),g(!1),v(!1);try{let e=await fetch("/api/oauth/cursor/auto-import"),t=await e.json();t.found?(n(t.accessToken),c(t.machineId),g(!0)):t.windowsManual?v(!0):x(t.error||"Could not auto-detect tokens")}catch(e){x("Failed to auto-detect tokens")}finally{f(!1)}};(0,a.useEffect)(()=>{e&&y()},[e]);let N=async()=>{if(!l.trim())return void x("Please enter an access token");if(!d.trim())return void x("Please enter a machine ID");p(!0),x(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()})}),r=await e.json();if(!e.ok)throw Error(r.error||"Import failed");t?.(),s()}catch(e){x(e.message)}finally{p(!1)}};return(0,r.jsx)(i.aF,{isOpen:e,title:"Connect Cursor IDE",onClose:s,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[h&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting tokens..."}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from Cursor IDE database"})]}),!h&&(0,r.jsxs)(r.Fragment,{children:[b&&(0,r.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,r.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Tokens auto-detected from Cursor IDE successfully!"})]})}),j&&(0,r.jsxs)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-3 rounded-lg border border-amber-200 dark:border-amber-800 flex flex-col gap-2",children:[(0,r.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Could not read Cursor database automatically."})]}),(0,r.jsxs)("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Make sure Cursor IDE has been opened at least once, then click ",(0,r.jsx)("strong",{children:"Retry"}),". If the problem persists, paste your tokens manually below."]}),(0,r.jsx)(i.$n,{onClick:y,variant:"outline",fullWidth:!0,children:"Retry"})]}),!b&&!j&&!m&&(0,r.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Cursor IDE not detected. Please paste your tokens manually."})]})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)("textarea",{value:l,onChange:e=>n(e.target.value),placeholder:"Access token will be auto-filled...",rows:3,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-lg bg-background focus:outline-none focus:border-primary resize-none"})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Machine ID ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(i.pd,{value:d,onChange:e=>c(e.target.value),placeholder:"Machine ID will be auto-filled...",className:"font-mono text-sm"})]}),m&&(0,r.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,r.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:m})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:N,fullWidth:!0,disabled:u||!l.trim()||!d.trim(),children:u?"Importing...":"Import Token"}),(0,r.jsx)(i.$n,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}o.propTypes={isOpen:n().bool.isRequired,onSuccess:n().func,onClose:n().func.isRequired}},70789:(e,t,s)=>{s.d(t,{default:()=>c});var r=s(73365),a=s(99568),l=s.n(a),n=s(43202);let i=[{label:"Features",href:"#features"},{label:"Pricing",href:"#pricing"},{label:"Changelog",href:"#"}],o=[{label:"Documentation",href:"#"},{label:"API Reference",href:"#"},{label:"Help Center",href:"#"}],d=[{label:"About",href:"#"},{label:"Blog",href:"#"},{label:"Contact",href:"#"}];function c(){return(0,r.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,r.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[(0,r.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-10 mb-12",children:[(0,r.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,r.jsx)("div",{className:"size-6 text-primary",children:(0,r.jsx)("svg",{className:"w-full h-full",fill:"currentColor",viewBox:"0 0 48 48",children:(0,r.jsx)("path",{clipRule:"evenodd",d:"M12.0799 24L4 19.2479L9.95537 8.75216L18.04 13.4961L18.0446 4H29.9554L29.96 13.4961L38.0446 8.75216L44 19.2479L35.92 24L44 28.7521L38.0446 39.2479L29.96 34.5039L29.9554 44H18.0446L18.04 34.5039L9.95537 39.2479L4 28.7521L12.0799 24Z",fillRule:"evenodd"})})}),(0,r.jsx)("span",{className:"text-xl font-bold text-text-main",children:n.vQ.name})]}),(0,r.jsx)("p",{className:"text-text-muted mb-6 max-w-sm font-light",children:"The unified interface for modern AI infrastructure. Secure, observable, and scalable."}),(0,r.jsxs)("div",{className:"flex gap-4",children:[(0,r.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"Twitter",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z"})})}),(0,r.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})})})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Product"}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:i.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Resources"}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:o.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Company"}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:d.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]})]}),(0,r.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["\xa9 ",new Date().getFullYear()," ",n.vQ.name," Inc. All rights reserved."]}),(0,r.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[(0,r.jsx)(l(),{href:"#",className:"hover:text-primary transition-colors",children:"Privacy Policy"}),(0,r.jsx)(l(),{href:"#",className:"hover:text-primary transition-colors",children:"Terms of Service"})]})]})]})})}},73531:(e,t,s)=>{s.d(t,{default:()=>c});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(3242),o=s(63380),d=s(51454);function c({isOpen:e,providerInfo:t,onSuccess:s,onClose:l}){let[n,m]=(0,a.useState)(null),[x,u]=(0,a.useState)(null),[p,h]=(0,a.useState)(null),f=(0,a.useCallback)((e,t)=>{"builder-id"===e?m("builder-id"):"idc"===e?(m("idc"),h(t)):"social"===e?(m("social"),u(t.provider)):"import"===e&&s?.()},[s]),b=()=>{m(null),u(null),h(null)};return n?"builder-id"===n||"idc"===n?(0,r.jsx)(i.default,{isOpen:e,provider:"kiro",providerInfo:t,onSuccess:()=>{m(null),h(null),s?.(),l?.()},onClose:b,idcConfig:p}):"social"===n&&x?(0,r.jsx)(d.default,{isOpen:e,provider:x,onSuccess:()=>{m(null),u(null),s?.(),l?.()},onClose:b}):null:(0,r.jsx)(o.default,{isOpen:e,onMethodSelect:f,onClose:l})}c.propTypes={isOpen:n().bool.isRequired,providerInfo:n().shape({name:n().string}),onSuccess:n().func,onClose:n().func.isRequired}},74156:(e,t,s)=>{s.d(t,{x0:()=>w.default,Ex:()=>d.default,$n:()=>r.default,Zp:()=>n.default,Qv:()=>o.CardSkeleton,CK:()=>p.default,uo:()=>i.ConfirmModal,G9:()=>j.default,wI:()=>N.default,vj:()=>y.default,vE:()=>v.default,pd:()=>a.default,Mh:()=>g.default,uR:()=>u.default,Nf:()=>h.default,aF:()=>i.default,rq:()=>x.default,gw:()=>k.default,LF:()=>m.default,Wx:()=>T.default,gM:()=>b.default,Iz:()=>C.default,l6:()=>l.default,lM:()=>c.default,m_:()=>S.default,jK:()=>f.default});var r=s(38230),a=s(53038),l=s(37066),n=s(292),i=s(66911),o=s(91494);s(82455);var d=s(35045),c=s(14406);s(84675),s(98814),s(56550),s(19067),s(70789);var m=s(3242),x=s(24372),u=s(5671),p=s(52327),h=s(26066),f=s(3412);s(12003),s(67692),s(80600),s(26125);var b=s(32135);s(63380);var g=s(73531);s(51454);var j=s(70391),v=s(68600),y=s(50136),N=s(90163),w=s(12820),k=s(99775),C=s(1755),S=s(13333),T=s(8569);s(13048),s(54546)},80600:(e,t,s)=>{s.d(t,{default:()=>p});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(55348),o=s(89036),d=s(26125),c=s(44156),m=s(12003);let x={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 (BR)",flag:"\uD83C\uDDE7\uD83C\uDDF7"},"pt-PT":{name:"Portugu\xeas (PT)",flag:"\uD83C\uDDF5\uD83C\uDDF9"},ko:{name:"한국어",flag:"\uD83C\uDDF0\uD83C\uDDF7"},es:{name:"Espa\xf1ol",flag:"\uD83C\uDDEA\uD83C\uDDF8"},de:{name:"Deutsch",flag:"\uD83C\uDDE9\uD83C\uDDEA"},fr:{name:"Fran\xe7ais",flag:"\uD83C\uDDEB\uD83C\uDDF7"},he:{name:"עברית",flag:"\uD83C\uDDEE\uD83C\uDDF1"},ar:{name:"العربية",flag:"\uD83C\uDDF8\uD83C\uDDE6"},ru:{name:"Русский",flag:"\uD83C\uDDF7\uD83C\uDDFA"},pl:{name:"Polski",flag:"\uD83C\uDDF5\uD83C\uDDF1"},cs:{name:"Čeština",flag:"\uD83C\uDDE8\uD83C\uDDFF"},nl:{name:"Nederlands",flag:"\uD83C\uDDF3\uD83C\uDDF1"},tr:{name:"T\xfcrk\xe7e",flag:"\uD83C\uDDF9\uD83C\uDDF7"},uk:{name:"Українська",flag:"\uD83C\uDDFA\uD83C\uDDE6"},tl:{name:"Tagalog",flag:"\uD83C\uDDF5\uD83C\uDDED"},id:{name:"Indonesia",flag:"\uD83C\uDDEE\uD83C\uDDE9"},th:{name:"ไทย",flag:"\uD83C\uDDF9\uD83C\uDDED"},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"}};function u({icon:e,label:t,onClick:s,trailing:a,danger:l}){return(0,r.jsxs)("button",{onClick:s,className:`flex items-center gap-3 w-full px-4 py-2.5 text-sm transition-colors ${l?"text-red-500 hover:bg-red-500/10":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"}`,children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[20px] ${l?"":"text-text-muted"}`,children:e}),(0,r.jsx)("span",{className:"flex-1 text-left",children:t}),a&&(0,r.jsx)("span",{className:"text-base",children:a})]})}function p({onLogout:e}){let[t,s]=(0,a.useState)(!1),[l,n]=(0,a.useState)(!1),[h,f]=(0,a.useState)(!1),[b,g]=(0,a.useState)(!1),[j,v]=(0,a.useState)("en"),{toggleTheme:y,isDark:N}=(0,o.D)(),w=(0,a.useRef)(null);return(0,a.useEffect)(()=>{v(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)}())},[b]),(0,a.useEffect)(()=>{let e=e=>{w.current&&!w.current.contains(e.target)&&s(!1)};if(t)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[t]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"relative",ref:w,children:[(0,r.jsx)("button",{onClick:()=>s(e=>!e),className:"flex items-center justify-center p-2 rounded-lg text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5 transition-all",title:"Menu",children:(0,r.jsx)("span",{className:"material-symbols-outlined",children:"grid_view"})}),t&&(0,r.jsxs)("div",{className:"absolute right-0 top-full mt-2 w-60 bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl z-50 animate-in fade-in zoom-in-95 duration-150 overflow-hidden py-1",children:[(0,r.jsx)(u,{icon:"history",label:"Change Log",onClick:()=>{s(!1),n(!0)}}),(0,r.jsx)(u,{icon:"language",label:x[j]?.name||j,trailing:x[j]?.flag||"\uD83C\uDF10",onClick:()=>{s(!1),g(!0)}}),(0,r.jsx)(u,{icon:N?"light_mode":"dark_mode",label:"Theme",onClick:()=>{y(),s(!1)}}),(0,r.jsx)(u,{icon:"computer",label:"Remote",onClick:()=>{s(!1),f(!0)}}),(0,r.jsx)(u,{icon:"logout",label:"Logout",danger:!0,onClick:()=>{s(!1),e()}})]})]}),(0,r.jsx)(d.default,{isOpen:l,onClose:()=>n(!1)}),(0,r.jsx)(c.A,{isOpen:h,onClose:()=>f(!1)}),(0,r.jsx)(m.default,{hideTrigger:!0,isOpen:b,onClose:()=>g(!1)})]})}u.propTypes={icon:n().string.isRequired,label:n().string.isRequired,onClick:n().func.isRequired,trailing:n().node,danger:n().bool},p.propTypes={onLogout:n().func.isRequired}},82455:(e,t,s)=>{s.d(t,{default:()=>l});var r=s(73365),a=s(87706);function l({src:e,alt:t="Avatar",name:s,size:n="md",className:i}){let o={xs:"size-6 text-xs",sm:"size-8 text-sm",md:"size-10 text-base",lg:"size-12 text-lg",xl:"size-16 text-xl"};return e?(0,r.jsx)("div",{className:(0,a.cn)("rounded-full bg-cover bg-center bg-no-repeat","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[n],i),style:{backgroundImage:`url(${e})`},role:"img","aria-label":t}):(0,r.jsx)("div",{className:(0,a.cn)("rounded-full flex items-center justify-center font-semibold text-white","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[n],(e=>{if(!e)return"bg-primary";let t=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],s=e.charCodeAt(0)%t.length;return t[s]})(s),i),role:"img","aria-label":t,children:(e=>{if(!e)return"?";let t=e.split(" ");return t.length>=2?`${t[0][0]}${t[1][0]}`.toUpperCase():e.substring(0,2).toUpperCase()})(s)})}},84675:(e,t,s)=>{s.d(t,{default:()=>n});var r=s(73365),a=s(89036),l=s(87706);function n({className:e,variant:t="default"}){let{isDark:s,toggleTheme:i}=(0,a.D)(),o={default:(0,l.cn)("flex items-center justify-center size-10 rounded-full","text-text-muted hover:text-text-main","hover:bg-surface-2 transition-colors"),card:(0,l.cn)("flex items-center justify-center size-11 rounded-full","bg-surface/60 hover:bg-surface","border border-border","backdrop-blur-md shadow-sm hover:shadow-[var(--shadow-warm)]","text-text-muted hover:text-brand-500","transition-all group")};return(0,r.jsx)("button",{onClick:i,className:(0,l.cn)(o[t],e),"aria-label":`Switch to ${s?"light":"dark"} mode`,title:`Switch to ${s?"light":"dark"} mode`,children:(0,r.jsx)("span",{className:(0,l.cn)("material-symbols-outlined text-[22px]","card"===t&&"transition-transform duration-300 group-hover:rotate-12"),children:s?"light_mode":"dark_mode"})})}},84907:(e,t,s)=>{s.d(t,{C:()=>r});let r=(0,s(2074).v)(e=>({query:"",placeholder:"",visible:!1,setQuery:t=>e({query:t}),register:(t="Search...")=>e({visible:!0,placeholder:t,query:""}),unregister:()=>e({visible:!1,placeholder:"",query:""})}))},87706:(e,t,s)=>{s.d(t,{cn:()=>r});function r(...e){return e.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}},89036:(e,t,s)=>{s.d(t,{D:()=>o});var r=s(1521),a=s(83789);function l(e){let t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function n(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function i(){return!1}function o(){let{theme:e,setTheme:t,toggleTheme:s,initTheme:o}=(0,a.A)(),d=(0,r.useSyncExternalStore)(l,n,i);(0,r.useEffect)(()=>{o()},[o]),(0,r.useEffect)(()=>{if("system"!==e)return;let t=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>o();return t.addEventListener("change",s),()=>t.removeEventListener("change",s)},[e,o]);let c="dark"===e||"system"===e&&d;return{theme:e,setTheme:t,toggleTheme:s,isDark:c}}},90163:(e,t,s)=>{s.d(t,{default:()=>x});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(66911),o=s(53038),d=s(38230),c=s(35045),m=s(82495);function x({isOpen:e,connection:t,proxyPools:s,onSave:l,onClose:n}){let[u,p]=(0,a.useState)({name:"",priority:1,apiKey:""}),[h,f]=(0,a.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[b,g]=(0,a.useState)({accountId:""}),[j,v]=(0,a.useState)(!1),[y,N]=(0,a.useState)(null),[w,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(null),[T,$]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&(p({name:t.name||"",priority:t.priority||1,apiKey:""}),"azure"===t.provider&&t.providerSpecificData&&f({azureEndpoint:t.providerSpecificData.azureEndpoint||"",apiVersion:t.providerSpecificData.apiVersion||"2024-10-01-preview",deployment:t.providerSpecificData.deployment||"",organization:t.providerSpecificData.organization||""}),"cloudflare-ai"===t.provider&&t.providerSpecificData&&g({accountId:t.providerSpecificData.accountId||""}),N(null),S(null))},[t]);let O=t?.authType==="oauth",R=t?.provider==="azure",P=t?.provider==="cloudflare-ai",E=!!t&&((0,m.mq)(t.provider)||(0,m.gb)(t.provider)),I=async()=>{if(t?.provider){v(!0),N(null);try{let e=await fetch(`/api/providers/${t.id}/test`,{method:"POST"}),s=await e.json();N(s.valid?"success":"failed")}catch{N("failed")}finally{v(!1)}}},M=async()=>{if(t?.provider&&u.apiKey){k(!0),S(null);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:u.apiKey,...R?{providerSpecificData:h}:{},...P?{providerSpecificData:b}:{}})}),s=await e.json();S(s.valid?"success":"failed")}catch{S("failed")}finally{k(!1)}}},A=async()=>{if(t){$(!0);try{let e={name:u.name,priority:u.priority};if(!O&&u.apiKey){e.apiKey=u.apiKey;let s="success"===C;if(!s)try{k(!0),S(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:u.apiKey,...R?{providerSpecificData:h}:{},...P?{providerSpecificData:b}:{}})});s=!!(await e.json()).valid,S(s?"success":"failed")}catch{S("failed")}finally{k(!1)}s&&(e.testStatus="active",e.lastError=null,e.lastErrorAt=null)}R&&(e.providerSpecificData={azureEndpoint:h.azureEndpoint,apiVersion:h.apiVersion,deployment:h.deployment,organization:h.organization}),P&&(e.providerSpecificData={accountId:b.accountId}),await l(e)}finally{$(!1)}}};return t?(0,r.jsx)(i.default,{isOpen:e,title:"Edit Connection",onClose:n,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(o.default,{label:"Name",value:u.name,onChange:e=>p({...u,name:e.target.value}),placeholder:O?"Account name":"Production Key"}),O&&t.email&&(0,r.jsxs)("div",{className:"bg-sidebar/50 p-3 rounded-lg",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted mb-1",children:"Email"}),(0,r.jsx)("p",{className:"font-medium",children:t.email})]}),(0,r.jsx)(o.default,{label:"Priority",type:"number",value:u.priority,onChange:e=>p({...u,priority:Number.parseInt(e.target.value,10)||1})}),!O&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(o.default,{label:"API Key",type:"password",value:u.apiKey,onChange:e=>p({...u,apiKey:e.target.value}),placeholder:"Enter new API key",hint:"Leave blank to keep the current API key.",className:"flex-1"}),(0,r.jsx)("div",{className:"pt-6",children:(0,r.jsx)(d.default,{onClick:M,disabled:!u.apiKey||w||T,variant:"secondary",children:w?"Checking...":"Check"})})]}),C&&(0,r.jsx)(c.default,{variant:"success"===C?"success":"error",children:"success"===C?"Valid":"Invalid"})]}),R&&(0,r.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,r.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsx)(o.default,{label:"Azure Endpoint",value:h.azureEndpoint,onChange:e=>f({...h,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com",hint:"Your Azure OpenAI resource endpoint URL"}),(0,r.jsx)(o.default,{label:"Deployment Name",value:h.deployment,onChange:e=>f({...h,deployment:e.target.value}),placeholder:"gpt-4",hint:"The deployment name in your Azure resource"}),(0,r.jsx)(o.default,{label:"API Version",value:h.apiVersion,onChange:e=>f({...h,apiVersion:e.target.value}),placeholder:"2024-10-01-preview",hint:"Azure OpenAI API version to use"}),(0,r.jsx)(o.default,{label:"Organization",value:h.organization,onChange:e=>f({...h,organization:e.target.value}),placeholder:"Organization ID",hint:"Required for billing"})]})]}),!E&&!R&&!P&&(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(d.default,{onClick:I,variant:"secondary",disabled:j,children:j?"Testing...":"Test Connection"}),y&&(0,r.jsx)(c.default,{variant:"success"===y?"success":"error",children:"success"===y?"Valid":"Failed"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(d.default,{onClick:A,fullWidth:!0,disabled:T,children:T?"Saving...":"Save"}),(0,r.jsx)(d.default,{onClick:n,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}x.propTypes={isOpen:n().bool.isRequired,connection:n().shape({id:n().string,name:n().string,email:n().string,priority:n().number,authType:n().string,provider:n().string,providerSpecificData:n().object}),proxyPools:n().arrayOf(n().shape({id:n().string,name:n().string})),onSave:n().func.isRequired,onClose:n().func.isRequired}},91494:(e,t,s)=>{s.d(t,{CardSkeleton:()=>o,PageLoading:()=>n,Skeleton:()=>i,Spinner:()=>l,default:()=>d});var r=s(73365),a=s(87706);function l({size:e="md",className:t}){return(0,r.jsx)("span",{className:(0,a.cn)("material-symbols-outlined animate-spin text-brand-500",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[e],t),children:"progress_activity"})}function n({message:e="Loading..."}){return(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,r.jsx)(l,{size:"xl"}),(0,r.jsx)("p",{className:"mt-4 text-text-muted",children:e})]})}function i({className:e,...t}){return(0,r.jsx)("div",{className:(0,a.cn)("animate-pulse rounded-[10px] bg-surface-2",e),...t})}function o(){return(0,r.jsxs)("div",{className:"p-6 rounded-[14px] border border-border-subtle bg-surface shadow-[var(--shadow-soft)]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)(i,{className:"h-4 w-24"}),(0,r.jsx)(i,{className:"size-10 rounded-[10px]"})]}),(0,r.jsx)(i,{className:"h-8 w-16 mb-2"}),(0,r.jsx)(i,{className:"h-3 w-20"})]})}function d({type:e="spinner",...t}){switch(e){case"page":return(0,r.jsx)(n,{...t});case"skeleton":return(0,r.jsx)(i,{...t});case"card":return(0,r.jsx)(o,{...t});default:return(0,r.jsx)(l,{...t})}}},96459:(e,t,s)=>{s.d(t,{C:()=>a});var r=s(1521);function a(e=2e3){let[t,s]=(0,r.useState)(null),l=(0,r.useRef)(null);return{copied:t,copy:(0,r.useCallback)((t,r="default")=>{(async()=>{if(navigator?.clipboard?.writeText)await navigator.clipboard.writeText(t);else{let e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}})(),s(r),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{s(null)},e)},[e])}}},99775:(e,t,s)=>{s.d(t,{default:()=>m});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(292),o=s(37066),d=s(35045);let c="__none__";function m({providerId:e}){let[t,s]=(0,a.useState)([]),[l,n]=(0,a.useState)(c),[x,u]=(0,a.useState)(!1),[p,h]=(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(([r,a])=>{t||(s(r.proxyPools||[]),n(((a.providerStrategies||{})[e]||{}).proxyPoolId||c))}).catch(()=>{}),()=>{t=!0}},[e]);let f=async t=>{n(t),u(!0);try{let s=await fetch("/api/settings",{cache:"no-store"}),r=(s.ok?await s.json():{}).providerStrategies||{},a={...r[e]||{}};t===c?delete a.proxyPoolId:a.proxyPoolId=t;let l={...r};0===Object.keys(a).length?delete l[e]:l[e]=a,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:l})}),h(!0),setTimeout(()=>h(!1),1500)}catch(e){console.log("Save proxyPoolId error:",e)}finally{u(!1)}};return(0,r.jsxs)(i.default,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,r.jsx)("div",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-green-500/10 text-green-500",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"lock_open"})}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"No authentication required"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"This provider is ready to use. Optionally route requests through a proxy pool to bypass IP-based limits."})]}),p&&(0,r.jsx)(d.default,{variant:"success",size:"sm",children:"Saved"})]}),(0,r.jsx)(o.default,{label:"Proxy Pool",value:l,onChange:e=>f(e.target.value),disabled:x,options:[{value:c,label:"None (direct)"},...t.map(e=>({value:e.id,label:e.name}))]})]})}m.propTypes={providerId:n().string.isRequired}}}]);
7
+ `,children:(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[g.includes(e.value)&&!s&&(0,r.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"edit"}),e.name]}):e.isCustom?(0,r.jsxs)(r.Fragment,{children:[e.name,(0,r.jsx)("span",{className:"text-[9px] opacity-60 font-normal",children:"custom"})]}):e.name]})},e.value)})})]},e)),0===Object.keys(z).length&&0===_.length&&(0,r.jsxs)("div",{className:"text-center py-4 text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1 block",children:"search_off"}),(0,r.jsx)("p",{className:"text-xs",children:"No models found"})]})]})]})}u.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onSelect:n().func.isRequired,onDeselect:n().func,selectedModel:n().string,activeProviders:n().arrayOf(n().shape({provider:n().string.isRequired})),title:n().string,modelAliases:n().object,kindFilter:n().string,addedModelValues:n().arrayOf(n().string),closeOnSelect:n().bool}},26066:(e,t,s)=>{s.d(t,{default:()=>n});var r=s(73365),a=s(1521),l=s(66911);function n({isOpen:e,onClose:t,onAdd:s,addedNames:i=[]}){let[o,d]=(0,a.useState)([]),[c,m]=(0,a.useState)(!1),[x,u]=(0,a.useState)(""),[p,h]=(0,a.useState)("all"),[f,b]=(0,a.useState)(null),[g,j]=(0,a.useState)(null),[v,y]=(0,a.useState)({}),[N,w]=(0,a.useState)({}),[k,C]=(0,a.useState)({});(0,a.useEffect)(()=>{!e||o.length>0||(m(!0),fetch("/api/cli-tools/cowork-mcp-registry").then(e=>e.json()).then(e=>{e.error?b(e.error):d(e.servers||[])}).catch(e=>b(e.message)).finally(()=>m(!1)))},[e]);let S=(0,a.useMemo)(()=>new Set(i),[i]),T=(0,a.useMemo)(()=>{let e=x.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,x,p]),$=async e=>{if(!v[e.url]){w(t=>({...t,[e.url]:!0}));try{let t=await fetch("/api/cli-tools/cowork-mcp-tools",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e.url})}),s=await t.json(),r=s.tools||[],a=Array.isArray(e.toolNames)?e.toolNames:[],l=r.length>0?r.map(e=>e.name):a;y(t=>({...t,[e.url]:{tools:r,requiresAuth:!!s.requiresAuth,error:s.error}})),C(t=>({...t,[e.url]:Object.fromEntries(l.map(e=>[e,!0]))}))}catch(t){y(s=>({...s,[e.url]:{tools:[],error:t.message}}))}finally{w(t=>({...t,[e.url]:!1}))}}},O=(e,t)=>{let s=k[e]||{};C(r=>({...r,[e]:Object.fromEntries(Object.keys(s).map(e=>[e,t]))}))};return(0,r.jsx)(l.default,{isOpen:e,onClose:t,title:"Browse MCP Marketplace",size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("input",{type:"text",value:x,onChange:e=>u(e.target.value),placeholder:"Search by name or description...",className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,r.jsxs)("select",{value:p,onChange:e=>h(e.target.value),className:"px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:[(0,r.jsx)("option",{value:"all",children:"All"}),(0,r.jsx)("option",{value:"authless",children:"Authless"}),(0,r.jsx)("option",{value:"oauth",children:"OAuth"})]})]}),f&&(0,r.jsx)("div",{className:"px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:f}),c&&(0,r.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-xs py-4 justify-center",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}),(0,r.jsx)("span",{children:"Loading registry..."})]}),!c&&(0,r.jsxs)("div",{className:"flex flex-col gap-1 max-h-[60vh] overflow-y-auto",children:[0===T.length&&(0,r.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=v[e.url],n=N[e.url],i=k[e.url]||{},o=Object.keys(i),d=Object.values(i).filter(Boolean).length;return(0,r.jsxs)("div",{className:"rounded border border-transparent hover:border-border",children:[(0,r.jsxs)("div",{className:"flex items-start gap-2 px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5",children:[e.iconUrl?(0,r.jsx)("img",{src:e.iconUrl,alt:"",className:"size-7 rounded shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}):(0,r.jsx)("div",{className:"size-7 rounded bg-surface shrink-0"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,r.jsx)("span",{className:"font-medium text-xs",children:e.title}),e.oauth?(0,r.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-amber-500/10 text-amber-600",children:"OAuth"}):(0,r.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-green-500/10 text-green-600",children:"Authless"}),e.toolCount>0&&(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:[e.toolCount," tools"]})]}),e.description&&(0,r.jsx)("p",{className:"text-[10px] text-text-muted line-clamp-2 mt-0.5",children:e.description})]}),(0,r.jsx)("button",{onClick:()=>t?null:void(g===e.url?j(null):(j(e.url),$(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,r.jsxs)("div",{className:"px-3 py-2 bg-surface/40 border-t border-border flex flex-col gap-2",children:[n&&(0,r.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-[10px] py-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin text-[14px]",children:"progress_activity"}),(0,r.jsx)("span",{children:"Probing server for tools..."})]}),!n&&l?.requiresAuth&&(0,r.jsx)("p",{className:"text-[10px] text-amber-600 bg-amber-500/10 px-2 py-1 rounded",children:"\uD83D\uDD10 OAuth required. Add now and authenticate after Apply; tool list will be discovered after first connect."}),!n&&l?.error&&!l?.requiresAuth&&(0,r.jsxs)("p",{className:"text-[10px] text-red-600 bg-red-500/10 px-2 py-1 rounded",children:["Probe failed: ",l.error]}),!n&&0===o.length&&!l?.requiresAuth&&!l?.error&&(0,r.jsx)("p",{className:"text-[10px] text-text-muted",children:"No tools advertised by server."}),!n&&o.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:[d,"/",o.length," tools enabled"]}),(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)("button",{onClick:()=>O(e.url,!0),className:"text-[10px] text-primary hover:underline",children:"All"}),(0,r.jsx)("span",{className:"text-[10px] text-text-muted",children:"\xb7"}),(0,r.jsx)("button",{onClick:()=>O(e.url,!1),className:"text-[10px] text-primary hover:underline",children:"None"})]})]}),(0,r.jsx)("div",{className:"grid grid-cols-2 gap-1 max-h-40 overflow-y-auto",children:o.map(t=>(0,r.jsxs)("label",{className:"flex items-center gap-1.5 text-[10px] cursor-pointer hover:bg-black/5 dark:hover:bg-white/5 px-1 rounded",children:[(0,r.jsx)("input",{type:"checkbox",checked:!!i[t],onChange:()=>{var s;return s=e.url,void C(e=>({...e,[s]:{...e[s],[t]:!e[s]?.[t]}}))},className:"size-3"}),(0,r.jsx)("span",{className:"truncate",children:t})]},t))})]}),(0,r.jsx)("button",{onClick:()=>{let t,r;return r=Object.keys(t=k[e.url]||{}).filter(e=>t[e]),void(s?.({name:e.slug||e.name,title:e.title,description:e.description,url:e.url,transport:e.transport,oauth:e.oauth,toolNames:r}),j(null))},className:"self-end px-2 py-1 rounded text-[10px] font-medium bg-primary text-white hover:bg-primary/90",children:"✓ Confirm Add"})]})]},e.url)})]}),(0,r.jsxs)("div",{className:"text-[10px] text-text-muted text-right",children:[T.length," of ",o.length," servers"]})]})})}},26125:(e,t,s)=>{s.d(t,{default:()=>c});var r=s(73365),a=s(1521),l=s(98196),n=s(86447),i=s.n(n),o=s(30721),d=s(43202);function c({isOpen:e,onClose:t}){let[s,n]=(0,a.useState)(""),[i,m]=(0,a.useState)(!1),[x,u]=(0,a.useState)(""),p=(0,a.useRef)(null);return((0,a.useEffect)(()=>{e&&!s&&(m(!0),u(""),fetch(d.Nu.changelogUrl).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.text()}).then(e=>n(o.xI.parse(e))).catch(e=>u(e.message||"Failed to load")).finally(()=>m(!1)))},[e,s]),(0,a.useEffect)(()=>{let s=e=>{p.current&&!p.current.contains(e.target)&&t()};if(e)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[e,t]),!e||"u"<typeof document)?null:(0,l.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:t}),(0,r.jsxs)("div",{ref:p,className:"relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-3xl flex flex-col max-h-[85vh]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Change Log"}),(0,r.jsx)("button",{onClick:t,className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":"Close",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,r.jsxs)("div",{className:"p-6 overflow-y-auto flex-1",children:[i&&(0,r.jsxs)("div",{className:"flex items-center justify-center py-10 text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin mr-2",children:"progress_activity"}),"Loading..."]}),x&&(0,r.jsxs)("div",{className:"text-red-500 py-4",children:["Failed to load changelog: ",x]}),!i&&!x&&s&&(0,r.jsx)("div",{className:"changelog-body text-text-main",dangerouslySetInnerHTML:{__html:s}})]})]})]}),document.body)}o.xI.setOptions({gfm:!0,breaks:!0}),c.propTypes={isOpen:i().bool.isRequired,onClose:i().func.isRequired}},32135:(e,t,s)=>{s.d(t,{default:()=>n});var r=s(73365),a=s(1521),l=s(292);function n(){let[e,t]=(0,a.useState)([]),[s,n]=(0,a.useState)(!0),[i,o]=(0,a.useState)(!0);(0,a.useEffect)(()=>{d()},[]),(0,a.useEffect)(()=>{let e;return i&&(e=setInterval(()=>{d(!1)},3e3)),()=>clearInterval(e)},[i]);let d=async(e=!0)=>{e&&n(!0);try{let e=await fetch("/api/usage/request-logs");if(e.ok){let s=await e.json();t(s)}}catch(e){console.error("Failed to fetch logs:",e)}finally{e&&n(!1)}};return(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"Request Logs"}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsxs)("label",{className:"text-sm font-medium text-text-muted flex items-center gap-2 cursor-pointer",children:[(0,r.jsx)("span",{children:"Auto Refresh (3s)"}),(0,r.jsx)("div",{onClick:()=>o(!i),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none ${i?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,r.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${i?"translate-x-5":"translate-x-1"}`})})]})})]}),(0,r.jsx)(l.default,{className:"overflow-hidden bg-black/5 dark:bg-black/20",children:(0,r.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:s&&0===e.length?(0,r.jsx)("div",{className:"p-8 text-center text-text-muted",children:"Loading logs..."}):0===e.length?(0,r.jsx)("div",{className:"p-8 text-center text-text-muted",children:"No logs recorded yet."}):(0,r.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,r.jsx)("thead",{className:"sticky top-0 bg-bg-subtle border-b border-border z-10",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"DateTime"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Model"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Provider"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Account"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"In"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Out"}),(0,r.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,r.jsx)("tbody",{className:"divide-y divide-border/50",children:e.map((e,t)=>{let s=e.split(" | ");if(s.length<7)return null;let a=s[6],l=a.includes("PENDING"),n=a.includes("FAILED"),i=a.includes("OK");return(0,r.jsxs)("tr",{className:`hover:bg-primary/5 transition-colors ${l?"bg-primary/5":""}`,children:[(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-text-muted",children:s[0]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border font-medium",children:s[1]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border",children:(0,r.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-bg-subtle border border-border text-[10px] uppercase font-bold",children:s[2]})}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border truncate max-w-[150px]",title:s[3],children:s[3]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-primary",children:s[4]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-success",children:s[5]}),(0,r.jsx)("td",{className:`px-3 py-1.5 font-bold ${i?"text-success":n?"text-error":"text-primary animate-pulse"}`,children:a})]},t)})})]})})}),(0,r.jsx)("div",{className:"text-[10px] text-text-muted italic",children:"Logs are loaded from the request history database."})]})}},35045:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(73365),a=s(87706);let l={default:"bg-surface-2 text-text-muted",primary:"bg-brand-500/10 text-brand-600 dark:text-brand-300",success:"bg-green-500/10 text-green-600 dark:text-green-400",warning:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",error:"bg-red-500/10 text-red-600 dark:text-red-400",info:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},n={sm:"px-2 py-0.5 text-[10px]",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1.5 text-sm"};function i({children:e,variant:t="default",size:s="md",dot:o=!1,icon:d,className:c}){return(0,r.jsxs)("span",{className:(0,a.cn)("inline-flex items-center gap-1.5 rounded-full font-semibold",l[t],n[s],c),children:[o&&(0,r.jsx)("span",{className:(0,a.cn)("size-1.5 rounded-full","success"===t&&"bg-green-500","warning"===t&&"bg-yellow-500","error"===t&&"bg-red-500","info"===t&&"bg-blue-500","primary"===t&&"bg-brand-500","default"===t&&"bg-gray-500")}),d&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:d}),e]})}},37066:(e,t,s)=>{s.d(t,{default:()=>l});var r=s(73365),a=s(87706);function l({label:e,options:t=[],value:s,onChange:n,placeholder:i="Select an option",error:o,hint:d,disabled:c=!1,required:m=!1,className:x,selectClassName:u,...p}){return(0,r.jsxs)("div",{className:(0,a.cn)("flex flex-col gap-1.5",x),children:[e&&(0,r.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,m&&(0,r.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)("select",{value:s,onChange:n,disabled:c,className:(0,a.cn)("w-full py-2.5 px-3 pr-10 text-sm text-text-main","bg-surface-2 border border-transparent rounded-[10px] appearance-none","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",o&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",u),...p,children:[(0,r.jsx)("option",{value:"",disabled:!0,children:i}),t.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,r.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"expand_more"})})]}),o&&(0,r.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,r.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},38230:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(73365),a=s(87706);let l={primary:"bg-brand-500 hover:bg-brand-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",secondary:"bg-surface-2 hover:bg-surface-3 text-text-main border border-border disabled:opacity-50",outline:"border border-border text-text-main hover:bg-surface-2 hover:border-brand-500/40",ghost:"text-text-muted hover:bg-surface-2 hover:text-text-main",danger:"bg-red-500 hover:bg-red-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",success:"bg-green-600 hover:bg-green-700 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted"},n={sm:"h-7 px-3 text-xs rounded-[8px]",md:"h-9 px-4 text-sm rounded-[10px]",lg:"h-11 px-6 text-sm rounded-[10px]"};function i({children:e,variant:t="primary",size:s="md",icon:o,iconRight:d,disabled:c=!1,loading:m=!1,fullWidth:x=!1,className:u,...p}){return(0,r.jsxs)("button",{className:(0,a.cn)("inline-flex items-center justify-center gap-2 font-semibold transition-all duration-150 ease-out cursor-pointer","active:scale-[0.97] disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100",l[t],n[s],x&&"w-full",u),disabled:c||m,...p,children:[m?(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}):o?(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:o}):null,e,d&&!m&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:d})]})}},44156:(e,t,s)=>{s.d(t,{A:()=>o});var r=s(73365),a=s(1521),l=s(98196);let n=[{icon:"terminal",label:"Terminal",desc:"Full shell access"},{icon:"cast",label:"Desktop",desc:"Screen sharing"},{icon:"folder_open",label:"Files",desc:"Browse & edit files"}],i=[{icon:"qr_code_scanner",text:"Scan QR to connect instantly"},{icon:"wifi_off",text:"No port forwarding needed"},{icon:"devices",text:"Works on any device"}];function o({isOpen:e,onClose:t}){return((0,a.useEffect)(()=>{if(!e)return;document.body.style.overflow="hidden";let s=e=>{"Escape"===e.key&&t()};return document.addEventListener("keydown",s),()=>{document.body.style.overflow="",document.removeEventListener("keydown",s)}},[e,t]),e)?(0,l.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:t}),(0,r.jsxs)("div",{className:"relative w-full max-w-sm rounded-[14px] overflow-hidden shadow-[var(--shadow-elev)] fade-in flex flex-col bg-surface border border-border-subtle",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border-subtle",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-7 h-7 rounded-[8px] flex items-center justify-center bg-primary",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-white text-base",children:"terminal"})}),(0,r.jsx)("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-mono",children:"9Remote"})]}),(0,r.jsx)("button",{onClick:t,className:"p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-base",children:"close"})})]}),(0,r.jsxs)("div",{className:"px-7 py-7 pb-9 flex flex-col gap-6",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center mt-2",children:[(0,r.jsx)("div",{className:"w-14 h-14 rounded-[14px] flex items-center justify-center mb-1 bg-primary shadow-[var(--shadow-warm)]",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-white text-[30px]",children:"terminal"})}),(0,r.jsx)("h1",{className:"text-lg font-bold text-text-main tracking-tight",children:"9Remote"}),(0,r.jsx)("p",{className:"text-xs text-text-muted leading-5 max-w-[220px]",children:"Access your terminal, desktop & files from anywhere"})]}),(0,r.jsx)("div",{className:"flex gap-2 w-full",children:n.map(({icon:e,label:t,desc:s})=>(0,r.jsxs)("div",{className:"flex-1 flex flex-col items-center gap-1.5 py-4 px-1 rounded-[10px] border border-border-subtle bg-surface-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-[22px]",children:e}),(0,r.jsx)("p",{className:"text-xs font-semibold text-text-main",children:t}),(0,r.jsx)("p",{className:"text-[10px] text-text-muted text-center leading-4",children:s})]},t))}),(0,r.jsx)("div",{className:"flex flex-col gap-3 w-full",children:i.map(({icon:e,text:t})=>(0,r.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined flex-shrink-0 text-primary text-[16px]",children:e}),(0,r.jsx)("span",{className:"text-xs text-text-muted",children:t})]},e))}),(0,r.jsxs)("button",{onClick:()=>window.open("https://9remote.cc","_blank"),className:"w-full py-3 flex items-center justify-center gap-2 text-sm font-semibold text-white rounded-[10px] bg-primary hover:bg-primary-hover shadow-[var(--shadow-warm)] active:scale-[0.98] transition-all",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base",children:"open_in_new"}),"Get 9Remote"]})]})]})]}),document.body):null}},50136:(e,t,s)=>{s.d(t,{default:()=>d});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156);let o="https://gitlab.com";function d({isOpen:e,providerInfo:t,onSuccess:s,onClose:l}){let n,[c,m]=(0,a.useState)(null),[x,u]=(0,a.useState)(o),[p,h]=(0,a.useState)(""),[f,b]=(0,a.useState)(""),[g,j]=(0,a.useState)(""),[v,y]=(0,a.useState)(!1),[N,w]=(0,a.useState)(null),[k,C]=(0,a.useState)(!1),[S,T]=(0,a.useState)(null),$=()=>{m(null),u(o),h(""),b(""),j(""),w(null),y(!1),C(!1),T(null),l()},O=async()=>{if(!g.trim())return void w("Personal Access Token is required");y(!0),w(null);try{let e=await fetch("/api/oauth/gitlab/pat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:g.trim(),baseUrl:x.trim()||o})}),t=await e.json();if(!e.ok)throw Error(t.error||"Authentication failed");s?.(),$()}catch(e){w(e.message)}finally{y(!1)}};return e?k&&S?(0,r.jsx)(i.LF,{isOpen:!0,provider:"gitlab",providerInfo:t,oauthMeta:S,onSuccess:()=>{s?.(),$()},onClose:()=>{C(!1),T(null)}}):(0,r.jsx)(i.aF,{isOpen:e,title:"Connect GitLab Duo",onClose:$,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[!c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Choose how to authenticate with GitLab Duo:"}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("button",{onClick:()=>m("oauth"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary",children:"lock_open"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"OAuth App"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab OAuth application"})]})]}),(0,r.jsxs)("button",{onClick:()=>m("pat"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary",children:"key"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"Personal Access Token"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab PAT with api scope"})]})]})]})]}),"oauth"===c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:"text-xs text-text-muted",children:["Create an OAuth app at"," ",(0,r.jsx)("a",{href:`${x.trim()||o}/-/profile/applications`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Applications"})," ","with redirect URI"," ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:(n=window.location.port||("https:"===window.location.protocol?"443":"80"),`http://localhost:${n}/callback`)})]}),(0,r.jsx)(i.pd,{label:"GitLab Base URL",value:x,onChange:e=>u(e.target.value),placeholder:o}),(0,r.jsx)(i.pd,{label:"Client ID",value:p,onChange:e=>h(e.target.value),placeholder:"Your OAuth application client ID"}),(0,r.jsx)(i.pd,{label:"Client Secret (optional for PKCE)",value:f,onChange:e=>b(e.target.value),placeholder:"Leave empty for public PKCE app"}),N&&(0,r.jsx)("p",{className:"text-sm text-red-500",children:N}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>{p.trim()?(w(null),T({baseUrl:x.trim()||o,clientId:p.trim(),clientSecret:f.trim()}),C(!0)):w("Client ID is required")},fullWidth:!0,disabled:!p.trim(),children:"Authorize"}),(0,r.jsx)(i.$n,{onClick:()=>{m(null),w(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"pat"===c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:"text-xs text-text-muted",children:["Create a PAT at"," ",(0,r.jsx)("a",{href:`${x.trim()||o}/-/user_settings/personal_access_tokens`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Access Tokens"})," ","with scopes: ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"api"}),","," ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"read_user"}),", and"," ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"ai_features"}),"."]}),(0,r.jsx)(i.pd,{label:"GitLab Base URL",value:x,onChange:e=>u(e.target.value),placeholder:o}),(0,r.jsx)(i.pd,{label:"Personal Access Token",value:g,onChange:e=>j(e.target.value),placeholder:"glpat-xxxxxxxxxxxxxxxxxxxx",type:"password"}),N&&(0,r.jsx)("p",{className:"text-sm text-red-500",children:N}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:O,fullWidth:!0,disabled:!g.trim()||v,loading:v,children:"Connect"}),(0,r.jsx)(i.$n,{onClick:()=>{m(null),w(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})}):null}d.propTypes={isOpen:n().bool.isRequired,providerInfo:n().shape({name:n().string}),onSuccess:n().func,onClose:n().func.isRequired}},51454:(e,t,s)=>{s.d(t,{default:()=>d});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156),o=s(96459);function d({isOpen:e,provider:t,onSuccess:s,onClose:l}){let[n,c]=(0,a.useState)("loading"),[m,x]=(0,a.useState)(""),[u,p]=(0,a.useState)(null),[h,f]=(0,a.useState)(""),[b,g]=(0,a.useState)(null),{copied:j,copy:v}=(0,o.C)();(0,a.useEffect)(()=>{e&&t&&(async()=>{try{g(null),c("loading");let e=await fetch(`/api/oauth/kiro/social-authorize?provider=${t}`),s=await e.json();if(!e.ok)throw Error(s.error);p(s),x(s.authUrl),c("input"),window.open(s.authUrl,"_blank")}catch(e){g(e.message),c("error")}})()},[e,t]);let y=async()=>{try{let e;g(null);try{e=new URL(h)}catch(e){throw Error("Invalid callback URL format")}let r=e.searchParams.get("code");e.searchParams.get("state");let a=e.searchParams.get("error");if(a)throw Error(e.searchParams.get("error_description")||a);if(!r)throw Error("No authorization code found in URL");let l=await fetch("/api/oauth/kiro/social-exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:r,codeVerifier:u.codeVerifier,provider:t})}),n=await l.json();if(!l.ok)throw Error(n.error);c("success"),s?.()}catch(e){g(e.message),c("error")}},N="google"===t?"Google":"GitHub";return(0,r.jsx)(i.aF,{isOpen:e,title:`Connect Kiro via ${N}`,onClose:l,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:["loading"===n&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Initializing..."}),(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["Setting up ",N," authentication"]})]}),"input"===n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.pd,{value:m,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,r.jsx)(i.$n,{variant:"secondary",icon:"auth_url"===j?"check":"content_copy",onClick:()=>v(m,"auth_url"),children:"Copy"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser address bar."}),(0,r.jsx)(i.pd,{value:h,onChange:e=>f(e.target.value),placeholder:"kiro://kiro.kiroAgent/authenticate-success?code=...",className:"font-mono text-xs"})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:y,fullWidth:!0,disabled:!h,children:"Connect"}),(0,r.jsx)(i.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===n&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,r.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your Kiro account via ",N," has been connected."]}),(0,r.jsx)(i.$n,{onClick:l,fullWidth:!0,children:"Done"})]}),"error"===n&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,r.jsx)("p",{className:"text-sm text-red-600 mb-4",children:b}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>c("input"),variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,r.jsx)(i.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}d.propTypes={isOpen:n().bool.isRequired,provider:n().oneOf(["google","github"]).isRequired,onSuccess:n().func,onClose:n().func.isRequired}},52327:(e,t,s)=>{s.d(t,{default:()=>m});var r=s(73365),a=s(1521),l=s(66911),n=s(53038),i=s(38230),o=s(24372);let d=/^[a-zA-Z0-9_.\-]+$/;function c({index:e,model:t,isFirst:s,isLast:l,onEdit:n,onMoveUp:i,onMoveDown:o,onRemove:d}){let[m,x]=(0,a.useState)(!1),[u,p]=(0,a.useState)(t),h=()=>{let e=u.trim();e&&e!==t?n(e):p(t),x(!1)};return(0,r.jsxs)("div",{className:"group flex min-w-0 items-center gap-1.5 rounded-md bg-black/[0.02] px-2 py-1 transition-colors hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04]",children:[(0,r.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:e+1}),m?(0,r.jsx)("input",{autoFocus:!0,value:u,onChange:e=>p(e.target.value),onBlur:h,onKeyDown:e=>{"Enter"===e.key&&h(),"Escape"===e.key&&(p(t),x(!1))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-white px-1.5 py-0.5 font-mono text-xs text-text-main outline-none dark:bg-black/20"}):(0,r.jsx)("div",{className:"min-w-0 flex-1 cursor-text truncate rounded px-1.5 py-0.5 font-mono text-xs text-text-main hover:bg-black/5 dark:hover:bg-white/5",onClick:()=>x(!0),title:"Click to edit",children:t}),(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,r.jsx)("button",{onClick:i,disabled:s,className:`p-0.5 rounded ${s?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,r.jsx)("button",{onClick:o,disabled:l,className:`p-0.5 rounded ${l?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,r.jsx)("button",{onClick:d,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function m({isOpen:e,combo:t,onClose:s,onSave:x,activeProviders:u,kindFilter:p=null,forcePrefix:h="",title:f}){let b=t?.name?h&&t.name.startsWith(h)?t.name.slice(h.length):t.name:"",[g,j]=(0,a.useState)(b),[v,y]=(0,a.useState)(t?.models||[]),[N,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(!1),[S,T]=(0,a.useState)(""),[$,O]=(0,a.useState)({});(0,a.useEffect)(()=>{e&&fetch("/api/models/alias").then(e=>e.ok?e.json():null).then(e=>e&&O(e.aliases||{})).catch(()=>{})},[e]);let R=e=>{if(!e.trim())return T("Name is required"),!1;let t=h+e;return d.test(t)?(T(""),!0):(T("Only letters, numbers, -, _ and . allowed"),!1)},P=e=>{let t=e.target.value;h&&t.startsWith(h)&&(t=t.slice(h.length)),j(t),t?R(t):T("")},E=async()=>{R(g)&&(C(!0),await x({name:h+g.trim(),models:v}),C(!1))},I=!!t;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.default,{isOpen:e,onClose:s,title:f||(I?"Edit Combo":"Create Combo"),children:(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsxs)("div",{children:[h?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("label",{className:"text-sm font-medium mb-1 block",children:"Combo Name"}),(0,r.jsxs)("div",{className:"flex items-stretch",children:[(0,r.jsx)("span",{className:"inline-flex items-center px-2 rounded-l border border-r-0 border-black/10 dark:border-white/10 bg-black/[0.04] dark:bg-white/[0.04] text-text-muted font-mono text-sm",children:h}),(0,r.jsx)("input",{value:g,onChange:P,placeholder:"my-combo",className:"flex-1 min-w-0 rounded-r border border-black/10 dark:border-white/10 bg-white dark:bg-black/20 px-2 py-1.5 font-mono text-sm outline-none focus:border-primary"})]}),S&&(0,r.jsx)("p",{className:"text-[11px] text-red-500 mt-0.5",children:S})]}):(0,r.jsx)(n.default,{label:"Combo Name",value:g,onChange:P,placeholder:"my-combo",error:S}),(0,r.jsxs)("p",{className:"text-[10px] text-text-muted mt-0.5",children:[h?`Auto-prefixed with "${h}". `:"","Only letters, numbers, -, _ and . allowed"]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===v.length?(0,r.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,r.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:v.map((e,t)=>(0,r.jsx)(c,{index:t,model:e,isFirst:0===t,isLast:t===v.length-1,onEdit:e=>{let s=[...v];s[t]=e,y(s)},onMoveUp:()=>(e=>{if(0===e)return;let t=[...v];[t[e-1],t[e]]=[t[e],t[e-1]],y(t)})(t),onMoveDown:()=>(e=>{if(e===v.length-1)return;let t=[...v];[t[e],t[e+1]]=[t[e+1],t[e]],y(t)})(t),onRemove:()=>y(v.filter((e,s)=>s!==t))},t))}),(0,r.jsxs)("button",{onClick:()=>w(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-primary font-medium hover:text-primary hover:border-primary/50 transition-colors flex items-center justify-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,r.jsx)(i.default,{onClick:s,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,r.jsx)(i.default,{onClick:E,fullWidth:!0,size:"sm",disabled:!g.trim()||!!S||k,children:k?"Saving...":I?"Save":"Create"})]})]})}),(0,r.jsx)(o.default,{isOpen:N,onClose:()=>w(!1),onSelect:e=>{v.includes(e.value)||y([...v,e.value])},onDeselect:e=>{y(v.filter(t=>t!==e.value))},activeProviders:u,modelAliases:$,title:"Add Model to Combo",kindFilter:p,addedModelValues:v,closeOnSelect:!1})]})}},53038:(e,t,s)=>{s.d(t,{default:()=>l});var r=s(73365),a=s(87706);function l({label:e,type:t="text",placeholder:s,value:n,onChange:i,error:o,hint:d,icon:c,disabled:m=!1,required:x=!1,className:u,inputClassName:p,...h}){return(0,r.jsxs)("div",{className:(0,a.cn)("flex flex-col gap-1.5",u),children:[e&&(0,r.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,x&&(0,r.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,r.jsxs)("div",{className:"relative",children:[c&&(0,r.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:c})}),(0,r.jsx)("input",{type:t,placeholder:s,value:n,onChange:i,disabled:m,className:(0,a.cn)("w-full py-2.5 px-3 text-sm text-text-main bg-surface-2 rounded-[10px]","border border-transparent placeholder-text-muted/70","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 ease-out disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",c&&"pl-10",o&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",p),...h})]}),o&&(0,r.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,r.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},54546:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(73365),a=s(86447),l=s.n(a),n=s(84675);function i({children:e}){return(0,r.jsxs)("div",{className:"min-h-screen flex flex-col relative bg-bg transition-colors duration-500 overflow-x-hidden selection:bg-primary/20 selection:text-primary",children:[(0,r.jsx)("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-primary/5 dark:bg-primary/5 rounded-full blur-[100px] pointer-events-none z-0"}),(0,r.jsx)("div",{className:"fixed bottom-0 right-0 w-[600px] h-[600px] bg-orange-200/20 dark:bg-orange-900/10 rounded-full blur-[120px] pointer-events-none z-0 translate-y-1/3 translate-x-1/3"}),(0,r.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,r.jsx)(n.default,{variant:"card"})}),(0,r.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:e})]})}i.propTypes={children:l().node.isRequired}},56550:(e,t,s)=>{s.d(t,{default:()=>y});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(99568),o=s.n(i),d=s(29717),c=s(87706),m=s(43202),x=s(82495),u=s(96459),p=s(38230),h=s(66911);let f=["embedding","image","tts","stt"],b="/dashboard/media-providers/web",g=[{href:"/dashboard/endpoint",label:"Endpoint",icon:"api"},{href:"/dashboard/providers",label:"Providers",icon:"dns"},{href:"/dashboard/combos",label:"Combos",icon:"layers"},{href:"/dashboard/usage",label:"Usage",icon:"bar_chart"},{href:"/dashboard/quota",label:"Quota Tracker",icon:"data_usage"},{href:"/dashboard/mitm",label:"MITM",icon:"security"},{href:"/dashboard/cli-tools",label:"CLI Tools",icon:"terminal"}],j=[{href:"/dashboard/console-log",label:"Console Log",icon:"terminal"},{href:"/dashboard/translator",label:"Translator",icon:"translate"}],v=[{href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"lan"},{href:"/dashboard/skills",label:"Skills",icon:"extension"}];function y({onClose:e}){let t=(0,d.usePathname)(),[s,l]=(0,a.useState)(!1),[n,i]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(!1),[T,$]=(0,a.useState)(null),[O,R]=(0,a.useState)(!1),[P,E]=(0,a.useState)(!1),[I,M]=(0,a.useState)(0),[A,L]=(0,a.useState)(!1),{copied:_,copy:z}=(0,u.C)(2e3),q=m.h0.installCmdLatest;(0,a.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{e.enableTranslator&&L(!0)}).catch(()=>{})},[]),(0,a.useEffect)(()=>{fetch("/api/version").then(e=>e.json()).then(e=>{e.hasUpdate&&$(e)}).catch(()=>{})},[]);let U=e=>"/dashboard/endpoint"===e?"/dashboard"===t||t.startsWith("/dashboard/endpoint"):t.startsWith(e),F=async()=>{try{await navigator.clipboard.writeText(q)}catch{}z(q);let e=m.h0.shutdownCountdownSec;M(e);let t=setInterval(()=>{M(e-=1),e<=0&&(clearInterval(t),fetch("/api/version/shutdown",{method:"POST"}).catch(()=>{}),S(!0))},1e3)},D=async()=>{k(!0);try{await fetch("/api/version/shutdown",{method:"POST"})}catch(e){}k(!1),i(!1),S(!0)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("aside",{className:"flex w-72 flex-col border-r border-border-subtle bg-vibrancy backdrop-blur-xl transition-colors duration-300 min-h-full",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-6 pt-5 pb-2",children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FF5F56]"}),(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]"}),(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]"})]}),(0,r.jsxs)("div",{className:"px-6 py-4 flex flex-col gap-2",children:[(0,r.jsxs)(o(),{href:"/dashboard",className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-9 rounded-[10px] bg-gradient-to-br from-brand-500 to-brand-700 shadow-[var(--shadow-warm)]",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-white text-[20px]",children:"hub"})}),(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("h1",{className:"text-lg font-semibold tracking-tight text-text-main",children:m.vQ.name}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:["v",m.vQ.version]})]})]}),T&&(0,r.jsxs)("div",{className:"flex flex-col gap-1.5 rounded p-1 -m-1",children:[(0,r.jsxs)("span",{className:"text-xs font-semibold text-green-600 dark:text-amber-500",children:["↑ New version available: v",T.latestVersion]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{onClick:()=>R(!0),className:"px-2 py-1 rounded bg-green-600 hover:bg-green-700 dark:bg-amber-500 dark:hover:bg-amber-600 text-white text-[11px] font-semibold transition-colors cursor-pointer",children:"Update now"}),(0,r.jsx)("button",{onClick:()=>z(q),title:"Copy install command",className:"flex-1 text-left hover:opacity-80 transition-opacity cursor-pointer min-w-0",children:(0,r.jsx)("code",{className:"block text-[10px] text-green-600/80 dark:text-amber-400/70 font-mono truncate",children:_?"✓ copied!":q})})]})]})]}),(0,r.jsxs)("nav",{className:"flex-1 px-4 py-2 space-y-0.5 overflow-y-auto custom-scrollbar",children:[g.map(t=>(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",U(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",U(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href)),(0,r.jsxs)("div",{className:"pt-3 mt-2 space-y-0.5",children:[(0,r.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"System"}),(0,r.jsxs)("button",{onClick:()=>l(e=>!e),className:(0,c.cn)("w-full flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",t.startsWith("/dashboard/media-providers")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"perm_media"}),(0,r.jsx)("span",{className:"text-[13px] font-medium flex-1 text-left",children:"Media Providers"}),(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"},children:"expand_more"})]}),s&&(0,r.jsxs)("div",{className:"pl-4",children:[x.rj.filter(e=>f.includes(e.id)).map(s=>(0,r.jsxs)(o(),{href:`/dashboard/media-providers/${s.id}`,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-1 rounded-lg transition-all group",t.startsWith(`/dashboard/media-providers/${s.id}`)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:s.icon}),(0,r.jsx)("span",{className:"text-sm",children:s.label})]},s.id)),(0,r.jsxs)(o(),{href:b,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-1 rounded-lg transition-all group",t.startsWith(b)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"travel_explore"}),(0,r.jsx)("span",{className:"text-sm",children:"Web Fetch & Search"})]},"web")]}),v.map(t=>(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",U(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",U(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href)),j.map(t=>"/dashboard/translator"!==t.href||A?(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",U(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",U(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href):null),(0,r.jsxs)(o(),{href:"/dashboard/profile",onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",U("/dashboard/profile")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",U("/dashboard/profile")?"fill-1":"group-hover:text-primary transition-colors"),children:"settings"}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:"Settings"})]})]})]}),(0,r.jsx)("div",{className:"p-3 border-t border-border-subtle",children:(0,r.jsx)(p.default,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>i(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"})})]}),(0,r.jsx)(h.ConfirmModal,{isOpen:n,onClose:()=>i(!1),onConfirm:D,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:w}),(0,r.jsx)(h.ConfirmModal,{isOpen:O,onClose:()=>R(!1),onConfirm:()=>{R(!1),E(!0)},title:"Update 9Router",message:`Show install command for v${T?.latestVersion||""}? You can copy it and shutdown to install manually.`,confirmText:"Show Command",cancelText:"Cancel",variant:"primary"}),(C||P)&&(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm p-6",children:P?(0,r.jsx)(N,{latestVersion:T?.latestVersion,installCmd:q,copied:_,onCopyAndShutdown:F,onCancel:()=>{E(!1),M(0)},countdown:I,isDisconnected:C}):(0,r.jsxs)("div",{className:"text-center p-8",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-16 rounded-full bg-red-500/20 text-red-500 mx-auto mb-4",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"power_off"})}),(0,r.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Server Disconnected"}),(0,r.jsx)("p",{className:"text-text-muted mb-6",children:"The proxy server has been stopped."}),(0,r.jsx)(p.default,{variant:"secondary",onClick:()=>globalThis.location.reload(),children:"Reload Page"})]})})]})}function N({latestVersion:e,installCmd:t,copied:s,onCopyAndShutdown:a,onCancel:l,countdown:n,isDisconnected:i}){let o=n>0;return(0,r.jsxs)("div",{className:"w-full max-w-lg rounded-xl bg-neutral-900/95 border border-white/10 p-6 text-white",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-11 rounded-full bg-amber-500/20 text-amber-400",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[24px]",children:"content_copy"})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("h2",{className:"text-lg font-semibold",children:["Update 9Router",e?` to v${e}`:""]}),(0,r.jsx)("p",{className:"text-xs text-white/60",children:i?"Server stopped. Paste the command into a terminal to install.":o?`Command copied. Server will stop in ${n}s...`:"Click the button below to copy the install command and shutdown."})]})]}),(0,r.jsx)("p",{className:"text-sm text-white/80 mb-2",children:"Install command:"}),(0,r.jsx)("div",{className:"w-full px-3 py-2 rounded bg-white/5 mb-4",children:(0,r.jsx)("code",{className:"text-xs font-mono text-amber-400 break-all",children:t})}),(0,r.jsxs)("ol",{className:"text-xs text-white/70 space-y-1 list-decimal list-inside mb-4",children:[(0,r.jsxs)("li",{children:["Click ",(0,r.jsx)("strong",{children:"Copy & Shutdown"})," below."]}),(0,r.jsx)("li",{children:"Paste the command into your terminal and press Enter."}),(0,r.jsxs)("li",{children:["Run ",(0,r.jsx)("code",{className:"px-1 rounded bg-white/10 text-green-400",children:"9router"})," again after install."]})]}),i?(0,r.jsx)(p.default,{variant:"secondary",fullWidth:!0,onClick:()=>globalThis.location.reload(),children:"Reload Page"}):(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(p.default,{variant:"secondary",onClick:l,disabled:o,children:"Cancel"}),(0,r.jsx)(p.default,{variant:"primary",fullWidth:!0,onClick:a,disabled:o,children:s?"✓ Copied — shutting down...":o?`Shutting down in ${n}s`:"Copy & Shutdown"})]})]})}y.propTypes={onClose:n().func},N.propTypes={latestVersion:n().string,installCmd:n().string.isRequired,copied:n().bool,onCopyAndShutdown:n().func.isRequired,onCancel:n().func.isRequired,countdown:n().number,isDisconnected:n().bool}},63380:(e,t,s)=>{s.d(t,{default:()=>o});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156);function o({isOpen:e,onMethodSelect:t,onClose:s}){let[l,n]=(0,a.useState)(null),[d,c]=(0,a.useState)(""),[m,x]=(0,a.useState)("us-east-1"),[u,p]=(0,a.useState)(""),[h,f]=(0,a.useState)(null),[b,g]=(0,a.useState)(!1),[j,v]=(0,a.useState)(!1),[y,N]=(0,a.useState)(!1);(0,a.useEffect)(()=>{"import"===l&&e&&(async()=>{v(!0),f(null),N(!1);try{let e=await fetch("/api/oauth/kiro/auto-import"),t=await e.json();t.found?(p(t.refreshToken),N(!0)):f(t.error||"Could not auto-detect token")}catch(e){f("Failed to auto-detect token")}finally{v(!1)}})()},[l,e]);let w=e=>{n(e),f(null)},k=()=>{n(null),f(null)},C=async()=>{if(!u.trim())return void f("Please enter a refresh token");g(!0),f(null);try{let e=await fetch("/api/oauth/kiro/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:u.trim()})}),s=await e.json();if(!e.ok)throw Error(s.error||"Import failed");t("import")}catch(e){f(e.message)}finally{g(!1)}},S=e=>{t("social",{provider:e})};return(0,r.jsx)(i.aF,{isOpen:e,title:"Connect Kiro",onClose:s,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[!l&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Choose your authentication method:"}),(0,r.jsx)("button",{onClick:()=>t("builder-id"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"shield"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"AWS Builder ID"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Recommended for most users. Free AWS account required."})]})]})}),(0,r.jsx)("button",{onClick:()=>w("idc"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"business"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"AWS IAM Identity Center"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"For enterprise users with custom AWS IAM Identity Center."})]})]})}),(0,r.jsx)("button",{onClick:()=>w("social-google"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"account_circle"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"Google Account"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your Google account (manual callback)."})]})]})}),(0,r.jsx)("button",{onClick:()=>w("social-github"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"code"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"GitHub Account"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your GitHub account (manual callback)."})]})]})}),(0,r.jsx)("button",{onClick:()=>w("import"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"file_upload"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"Import Token"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Paste refresh token from Kiro IDE."})]})]})})]}),"idc"===l&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["IDC Start URL ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(i.pd,{value:d,onChange:e=>c(e.target.value),placeholder:"https://your-org.awsapps.com/start",className:"font-mono text-sm"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Your organization's AWS IAM Identity Center URL"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium mb-2",children:"AWS Region"}),(0,r.jsx)(i.pd,{value:m,onChange:e=>x(e.target.value),placeholder:"us-east-1",className:"font-mono text-sm"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"AWS region for your Identity Center (default: us-east-1)"})]}),h&&(0,r.jsx)("p",{className:"text-sm text-red-600",children:h}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>{d.trim()?t("idc",{startUrl:d.trim(),region:m}):f("Please enter your IDC start URL")},fullWidth:!0,children:"Continue"}),(0,r.jsx)(i.$n,{onClick:k,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-google"===l&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,r.jsxs)("div",{className:"flex-1 text-sm",children:[(0,r.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,r.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>S("google"),fullWidth:!0,children:"Continue with Google"}),(0,r.jsx)(i.$n,{onClick:k,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-github"===l&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,r.jsxs)("div",{className:"flex-1 text-sm",children:[(0,r.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,r.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>S("github"),fullWidth:!0,children:"Continue with GitHub"}),(0,r.jsx)(i.$n,{onClick:k,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"import"===l&&(0,r.jsxs)("div",{className:"space-y-4",children:[j&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting token..."}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from AWS SSO cache"})]}),!j&&(0,r.jsxs)(r.Fragment,{children:[y&&(0,r.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,r.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Token auto-detected from Kiro IDE successfully!"})]})}),!y&&!h&&(0,r.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Kiro IDE not detected. Please paste your refresh token manually."})]})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Refresh Token ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(i.pd,{value:u,onChange:e=>p(e.target.value),placeholder:"Token will be auto-filled...",className:"font-mono text-sm"})]}),h&&(0,r.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,r.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:h})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:C,fullWidth:!0,disabled:b||!u.trim(),children:b?"Importing...":"Import Token"}),(0,r.jsx)(i.$n,{onClick:k,variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})]})})}o.propTypes={isOpen:n().bool.isRequired,onMethodSelect:n().func.isRequired,onClose:n().func.isRequired}},66911:(e,t,s)=>{s.d(t,{ConfirmModal:()=>d,default:()=>o});var r=s(73365),a=s(1521),l=s(87706),n=s(38230),i=s(13333);function o({isOpen:e,onClose:t,title:s,children:n,footer:d,size:c="md",closeOnOverlay:m=!0,showTrafficLights:x=!0,className:u}){return((0,a.useEffect)(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),(0,a.useEffect)(()=>{let s=s=>{"Escape"===s.key&&e&&t()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,t]),e)?(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:m?t:void 0}),(0,r.jsxs)("div",{className:(0,l.cn)("relative w-full bg-surface","border border-border-subtle","rounded-[14px] shadow-[var(--shadow-elev)]","fade-in",{sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"}[c],u),children:[(s||x)&&(0,r.jsxs)("div",{className:"flex items-center justify-between p-2 border-b border-border-subtle",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[x&&(0,r.jsxs)("div",{className:"hidden md:flex items-center gap-2 mr-4 ml-2",children:[(0,r.jsx)(i.default,{text:"Close",position:"top",color:"#FF5F56",children:(0,r.jsx)("button",{onClick:t,"aria-label":"Close",title:"Close",className:"w-4 h-4 rounded-full bg-[#FF5F56] hover:brightness-90 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,r.jsx)("span",{className:"text-[9px] font-bold text-white opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:"✕"})})}),(0,r.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"}),(0,r.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"})]}),s&&(0,r.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:s})]}),(0,r.jsx)("button",{onClick:t,"aria-label":"Close",className:"md:hidden p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,r.jsx)("div",{className:"p-6 max-h-[calc(85vh-100px)] overflow-y-auto custom-scrollbar",children:n}),d&&(0,r.jsx)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-border-subtle",children:d})]})]}):null}function d({isOpen:e,onClose:t,onConfirm:s,title:a="Confirm",message:l,confirmText:i="Confirm",cancelText:c="Cancel",variant:m="danger",loading:x=!1}){return(0,r.jsx)(o,{isOpen:e,onClose:t,title:a,size:"sm",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.default,{variant:"ghost",onClick:t,disabled:x,children:c}),(0,r.jsx)(n.default,{variant:m,onClick:s,loading:x,children:i})]}),children:(0,r.jsx)("p",{className:"text-text-muted",children:l})})}},67692:(e,t,s)=>{s.d(t,{default:()=>n});var r=s(73365),a=s(1521),l=s(44156);function n(){let[e,t]=(0,a.useState)(!1);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{onClick:()=>t(!0),className:"relative flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg transition-all text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5",title:"9Remote",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"computer"}),(0,r.jsx)("span",{className:"text-xs font-medium",children:"Remote"})]}),(0,r.jsx)(l.A,{isOpen:e,onClose:()=>t(!1)})]})}},68266:(e,t,s)=>{s.d(t,{A:()=>i});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l);function i({src:e,alt:t,size:s=32,className:l="",fallbackText:n="?",fallbackColor:o}){let[d,c]=(0,a.useState)(!1);return!e||d?(0,r.jsx)("span",{className:`inline-flex items-center justify-center font-bold rounded-lg ${l}`.trim(),style:{width:s,height:s,color:o,fontSize:Math.max(10,Math.floor(.38*s))},children:n}):(0,r.jsx)("img",{src:e,alt:t,width:s,height:s,className:l,onError:()=>c(!0)})}i.propTypes={src:n().string,alt:n().string,size:n().number,className:n().string,fallbackText:n().string,fallbackColor:n().string}},68600:(e,t,s)=>{s.d(t,{default:()=>o});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156);function o({isOpen:e,onSuccess:t,onClose:s}){let[l,n]=(0,a.useState)(""),[d,c]=(0,a.useState)(!1),[m,x]=(0,a.useState)(null),[u,p]=(0,a.useState)(!1),h=async()=>{if(!l.trim())return void x("Please paste your cookie");c(!0),x(null);try{let e=await fetch("/api/oauth/iflow/cookie",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:l.trim()})}),s=await e.json();if(!e.ok)throw Error(s.error||"Authentication failed");p(!0),setTimeout(()=>{t?.(),f()},1500)}catch(e){x(e.message)}finally{c(!1)}},f=()=>{n(""),x(null),p(!1),s?.()};return(0,r.jsx)(i.aF,{isOpen:e,onClose:f,title:"iFlow Cookie Authentication",children:(0,r.jsx)("div",{className:"space-y-4",children:u?(0,r.jsxs)("div",{className:"text-center py-8",children:[(0,r.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,r.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,r.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,r.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,r.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,r.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,r.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,r.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,r.jsx)("li",{children:"Login to your account"}),(0,r.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,r.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,r.jsx)("li",{children:"Paste it below"})]})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,r.jsx)("textarea",{value:l,onChange:e=>n(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})]}),m&&(0,r.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,r.jsx)("p",{className:"text-sm text-error",children:m})}),(0,r.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,r.jsx)(i.$n,{variant:"secondary",onClick:f,disabled:d,fullWidth:!0,children:"Cancel"}),(0,r.jsx)(i.$n,{onClick:h,loading:d,fullWidth:!0,children:"Authenticate"})]})]})})})}o.propTypes={isOpen:n().bool.isRequired,onSuccess:n().func,onClose:n().func}},70391:(e,t,s)=>{s.d(t,{default:()=>o});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156);function o({isOpen:e,onSuccess:t,onClose:s}){let[l,n]=(0,a.useState)(""),[d,c]=(0,a.useState)(""),[m,x]=(0,a.useState)(null),[u,p]=(0,a.useState)(!1),[h,f]=(0,a.useState)(!1),[b,g]=(0,a.useState)(!1),[j,v]=(0,a.useState)(!1),y=async()=>{f(!0),x(null),g(!1),v(!1);try{let e=await fetch("/api/oauth/cursor/auto-import"),t=await e.json();t.found?(n(t.accessToken),c(t.machineId),g(!0)):t.windowsManual?v(!0):x(t.error||"Could not auto-detect tokens")}catch(e){x("Failed to auto-detect tokens")}finally{f(!1)}};(0,a.useEffect)(()=>{e&&y()},[e]);let N=async()=>{if(!l.trim())return void x("Please enter an access token");if(!d.trim())return void x("Please enter a machine ID");p(!0),x(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()})}),r=await e.json();if(!e.ok)throw Error(r.error||"Import failed");t?.(),s()}catch(e){x(e.message)}finally{p(!1)}};return(0,r.jsx)(i.aF,{isOpen:e,title:"Connect Cursor IDE",onClose:s,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[h&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting tokens..."}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from Cursor IDE database"})]}),!h&&(0,r.jsxs)(r.Fragment,{children:[b&&(0,r.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,r.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Tokens auto-detected from Cursor IDE successfully!"})]})}),j&&(0,r.jsxs)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-3 rounded-lg border border-amber-200 dark:border-amber-800 flex flex-col gap-2",children:[(0,r.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Could not read Cursor database automatically."})]}),(0,r.jsxs)("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Make sure Cursor IDE has been opened at least once, then click ",(0,r.jsx)("strong",{children:"Retry"}),". If the problem persists, paste your tokens manually below."]}),(0,r.jsx)(i.$n,{onClick:y,variant:"outline",fullWidth:!0,children:"Retry"})]}),!b&&!j&&!m&&(0,r.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Cursor IDE not detected. Please paste your tokens manually."})]})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)("textarea",{value:l,onChange:e=>n(e.target.value),placeholder:"Access token will be auto-filled...",rows:3,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-lg bg-background focus:outline-none focus:border-primary resize-none"})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Machine ID ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(i.pd,{value:d,onChange:e=>c(e.target.value),placeholder:"Machine ID will be auto-filled...",className:"font-mono text-sm"})]}),m&&(0,r.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,r.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:m})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:N,fullWidth:!0,disabled:u||!l.trim()||!d.trim(),children:u?"Importing...":"Import Token"}),(0,r.jsx)(i.$n,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}o.propTypes={isOpen:n().bool.isRequired,onSuccess:n().func,onClose:n().func.isRequired}},70789:(e,t,s)=>{s.d(t,{default:()=>c});var r=s(73365),a=s(99568),l=s.n(a),n=s(43202);let i=[{label:"Features",href:"#features"},{label:"Pricing",href:"#pricing"},{label:"Changelog",href:"#"}],o=[{label:"Documentation",href:"#"},{label:"API Reference",href:"#"},{label:"Help Center",href:"#"}],d=[{label:"About",href:"#"},{label:"Blog",href:"#"},{label:"Contact",href:"#"}];function c(){return(0,r.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,r.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[(0,r.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-10 mb-12",children:[(0,r.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,r.jsx)("div",{className:"size-6 text-primary",children:(0,r.jsx)("svg",{className:"w-full h-full",fill:"currentColor",viewBox:"0 0 48 48",children:(0,r.jsx)("path",{clipRule:"evenodd",d:"M12.0799 24L4 19.2479L9.95537 8.75216L18.04 13.4961L18.0446 4H29.9554L29.96 13.4961L38.0446 8.75216L44 19.2479L35.92 24L44 28.7521L38.0446 39.2479L29.96 34.5039L29.9554 44H18.0446L18.04 34.5039L9.95537 39.2479L4 28.7521L12.0799 24Z",fillRule:"evenodd"})})}),(0,r.jsx)("span",{className:"text-xl font-bold text-text-main",children:n.vQ.name})]}),(0,r.jsx)("p",{className:"text-text-muted mb-6 max-w-sm font-light",children:"The unified interface for modern AI infrastructure. Secure, observable, and scalable."}),(0,r.jsxs)("div",{className:"flex gap-4",children:[(0,r.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"Twitter",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z"})})}),(0,r.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})})})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Product"}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:i.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Resources"}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:o.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Company"}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:d.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]})]}),(0,r.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["\xa9 ",new Date().getFullYear()," ",n.vQ.name," Inc. All rights reserved."]}),(0,r.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[(0,r.jsx)(l(),{href:"#",className:"hover:text-primary transition-colors",children:"Privacy Policy"}),(0,r.jsx)(l(),{href:"#",className:"hover:text-primary transition-colors",children:"Terms of Service"})]})]})]})})}},73531:(e,t,s)=>{s.d(t,{default:()=>c});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(3242),o=s(63380),d=s(51454);function c({isOpen:e,providerInfo:t,onSuccess:s,onClose:l}){let[n,m]=(0,a.useState)(null),[x,u]=(0,a.useState)(null),[p,h]=(0,a.useState)(null),f=(0,a.useCallback)((e,t)=>{"builder-id"===e?m("builder-id"):"idc"===e?(m("idc"),h(t)):"social"===e?(m("social"),u(t.provider)):"import"===e&&s?.()},[s]),b=()=>{m(null),u(null),h(null)};return n?"builder-id"===n||"idc"===n?(0,r.jsx)(i.default,{isOpen:e,provider:"kiro",providerInfo:t,onSuccess:()=>{m(null),h(null),s?.(),l?.()},onClose:b,idcConfig:p}):"social"===n&&x?(0,r.jsx)(d.default,{isOpen:e,provider:x,onSuccess:()=>{m(null),u(null),s?.(),l?.()},onClose:b}):null:(0,r.jsx)(o.default,{isOpen:e,onMethodSelect:f,onClose:l})}c.propTypes={isOpen:n().bool.isRequired,providerInfo:n().shape({name:n().string}),onSuccess:n().func,onClose:n().func.isRequired}},74156:(e,t,s)=>{s.d(t,{x0:()=>w.default,Ex:()=>d.default,$n:()=>r.default,Zp:()=>n.default,Qv:()=>o.CardSkeleton,CK:()=>p.default,uo:()=>i.ConfirmModal,G9:()=>j.default,wI:()=>N.default,vj:()=>y.default,vE:()=>v.default,pd:()=>a.default,Mh:()=>g.default,uR:()=>u.default,Nf:()=>h.default,aF:()=>i.default,rq:()=>x.default,gw:()=>k.default,LF:()=>m.default,Wx:()=>T.default,gM:()=>b.default,Iz:()=>C.default,l6:()=>l.default,lM:()=>c.default,m_:()=>S.default,jK:()=>f.default});var r=s(38230),a=s(53038),l=s(37066),n=s(292),i=s(66911),o=s(91494);s(82455);var d=s(35045),c=s(14406);s(84675),s(98814),s(56550),s(19067),s(70789);var m=s(3242),x=s(24372),u=s(5671),p=s(52327),h=s(26066),f=s(3412);s(12003),s(67692),s(80600),s(26125);var b=s(32135);s(63380);var g=s(73531);s(51454);var j=s(70391),v=s(68600),y=s(50136),N=s(90163),w=s(12820),k=s(99775),C=s(1755),S=s(13333),T=s(8569);s(13048),s(54546)},80600:(e,t,s)=>{s.d(t,{default:()=>p});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(55348),o=s(89036),d=s(26125),c=s(44156),m=s(12003);let x={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 (BR)",flag:"\uD83C\uDDE7\uD83C\uDDF7"},"pt-PT":{name:"Portugu\xeas (PT)",flag:"\uD83C\uDDF5\uD83C\uDDF9"},ko:{name:"한국어",flag:"\uD83C\uDDF0\uD83C\uDDF7"},es:{name:"Espa\xf1ol",flag:"\uD83C\uDDEA\uD83C\uDDF8"},de:{name:"Deutsch",flag:"\uD83C\uDDE9\uD83C\uDDEA"},fr:{name:"Fran\xe7ais",flag:"\uD83C\uDDEB\uD83C\uDDF7"},he:{name:"עברית",flag:"\uD83C\uDDEE\uD83C\uDDF1"},ar:{name:"العربية",flag:"\uD83C\uDDF8\uD83C\uDDE6"},ru:{name:"Русский",flag:"\uD83C\uDDF7\uD83C\uDDFA"},pl:{name:"Polski",flag:"\uD83C\uDDF5\uD83C\uDDF1"},cs:{name:"Čeština",flag:"\uD83C\uDDE8\uD83C\uDDFF"},nl:{name:"Nederlands",flag:"\uD83C\uDDF3\uD83C\uDDF1"},tr:{name:"T\xfcrk\xe7e",flag:"\uD83C\uDDF9\uD83C\uDDF7"},uk:{name:"Українська",flag:"\uD83C\uDDFA\uD83C\uDDE6"},tl:{name:"Tagalog",flag:"\uD83C\uDDF5\uD83C\uDDED"},id:{name:"Indonesia",flag:"\uD83C\uDDEE\uD83C\uDDE9"},th:{name:"ไทย",flag:"\uD83C\uDDF9\uD83C\uDDED"},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"}};function u({icon:e,label:t,onClick:s,trailing:a,danger:l}){return(0,r.jsxs)("button",{onClick:s,className:`flex items-center gap-3 w-full px-4 py-2.5 text-sm transition-colors ${l?"text-red-500 hover:bg-red-500/10":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"}`,children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[20px] ${l?"":"text-text-muted"}`,children:e}),(0,r.jsx)("span",{className:"flex-1 text-left",children:t}),a&&(0,r.jsx)("span",{className:"text-base",children:a})]})}function p({onLogout:e}){let[t,s]=(0,a.useState)(!1),[l,n]=(0,a.useState)(!1),[h,f]=(0,a.useState)(!1),[b,g]=(0,a.useState)(!1),[j,v]=(0,a.useState)("en"),{toggleTheme:y,isDark:N}=(0,o.D)(),w=(0,a.useRef)(null);return(0,a.useEffect)(()=>{v(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)}())},[b]),(0,a.useEffect)(()=>{let e=e=>{w.current&&!w.current.contains(e.target)&&s(!1)};if(t)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[t]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"relative",ref:w,children:[(0,r.jsx)("button",{onClick:()=>s(e=>!e),className:"flex items-center justify-center p-2 rounded-lg text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5 transition-all",title:"Menu",children:(0,r.jsx)("span",{className:"material-symbols-outlined",children:"grid_view"})}),t&&(0,r.jsxs)("div",{className:"absolute right-0 top-full mt-2 w-60 bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl z-50 animate-in fade-in zoom-in-95 duration-150 overflow-hidden py-1",children:[(0,r.jsx)(u,{icon:"history",label:"Change Log",onClick:()=>{s(!1),n(!0)}}),(0,r.jsx)(u,{icon:"language",label:x[j]?.name||j,trailing:x[j]?.flag||"\uD83C\uDF10",onClick:()=>{s(!1),g(!0)}}),(0,r.jsx)(u,{icon:N?"light_mode":"dark_mode",label:"Theme",onClick:()=>{y(),s(!1)}}),(0,r.jsx)(u,{icon:"computer",label:"Remote",onClick:()=>{s(!1),f(!0)}}),(0,r.jsx)(u,{icon:"logout",label:"Logout",danger:!0,onClick:()=>{s(!1),e()}})]})]}),(0,r.jsx)(d.default,{isOpen:l,onClose:()=>n(!1)}),(0,r.jsx)(c.A,{isOpen:h,onClose:()=>f(!1)}),(0,r.jsx)(m.default,{hideTrigger:!0,isOpen:b,onClose:()=>g(!1)})]})}u.propTypes={icon:n().string.isRequired,label:n().string.isRequired,onClick:n().func.isRequired,trailing:n().node,danger:n().bool},p.propTypes={onLogout:n().func.isRequired}},82455:(e,t,s)=>{s.d(t,{default:()=>l});var r=s(73365),a=s(87706);function l({src:e,alt:t="Avatar",name:s,size:n="md",className:i}){let o={xs:"size-6 text-xs",sm:"size-8 text-sm",md:"size-10 text-base",lg:"size-12 text-lg",xl:"size-16 text-xl"};return e?(0,r.jsx)("div",{className:(0,a.cn)("rounded-full bg-cover bg-center bg-no-repeat","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[n],i),style:{backgroundImage:`url(${e})`},role:"img","aria-label":t}):(0,r.jsx)("div",{className:(0,a.cn)("rounded-full flex items-center justify-center font-semibold text-white","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[n],(e=>{if(!e)return"bg-primary";let t=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],s=e.charCodeAt(0)%t.length;return t[s]})(s),i),role:"img","aria-label":t,children:(e=>{if(!e)return"?";let t=e.split(" ");return t.length>=2?`${t[0][0]}${t[1][0]}`.toUpperCase():e.substring(0,2).toUpperCase()})(s)})}},84675:(e,t,s)=>{s.d(t,{default:()=>n});var r=s(73365),a=s(89036),l=s(87706);function n({className:e,variant:t="default"}){let{isDark:s,toggleTheme:i}=(0,a.D)(),o={default:(0,l.cn)("flex items-center justify-center size-10 rounded-full","text-text-muted hover:text-text-main","hover:bg-surface-2 transition-colors"),card:(0,l.cn)("flex items-center justify-center size-11 rounded-full","bg-surface/60 hover:bg-surface","border border-border","backdrop-blur-md shadow-sm hover:shadow-[var(--shadow-warm)]","text-text-muted hover:text-brand-500","transition-all group")};return(0,r.jsx)("button",{onClick:i,className:(0,l.cn)(o[t],e),"aria-label":`Switch to ${s?"light":"dark"} mode`,title:`Switch to ${s?"light":"dark"} mode`,children:(0,r.jsx)("span",{className:(0,l.cn)("material-symbols-outlined text-[22px]","card"===t&&"transition-transform duration-300 group-hover:rotate-12"),children:s?"light_mode":"dark_mode"})})}},84907:(e,t,s)=>{s.d(t,{C:()=>r});let r=(0,s(2074).v)(e=>({query:"",placeholder:"",visible:!1,setQuery:t=>e({query:t}),register:(t="Search...")=>e({visible:!0,placeholder:t,query:""}),unregister:()=>e({visible:!1,placeholder:"",query:""})}))},87706:(e,t,s)=>{s.d(t,{cn:()=>r});function r(...e){return e.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}},89036:(e,t,s)=>{s.d(t,{D:()=>o});var r=s(1521),a=s(83789);function l(e){let t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function n(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function i(){return!1}function o(){let{theme:e,setTheme:t,toggleTheme:s,initTheme:o}=(0,a.A)(),d=(0,r.useSyncExternalStore)(l,n,i);(0,r.useEffect)(()=>{o()},[o]),(0,r.useEffect)(()=>{if("system"!==e)return;let t=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>o();return t.addEventListener("change",s),()=>t.removeEventListener("change",s)},[e,o]);let c="dark"===e||"system"===e&&d;return{theme:e,setTheme:t,toggleTheme:s,isDark:c}}},90163:(e,t,s)=>{s.d(t,{default:()=>x});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(66911),o=s(53038),d=s(38230),c=s(35045),m=s(82495);function x({isOpen:e,connection:t,proxyPools:s,onSave:l,onClose:n}){let[u,p]=(0,a.useState)({name:"",priority:1,apiKey:""}),[h,f]=(0,a.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[b,g]=(0,a.useState)({accountId:""}),[j,v]=(0,a.useState)(!1),[y,N]=(0,a.useState)(null),[w,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(null),[T,$]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&(p({name:t.name||"",priority:t.priority||1,apiKey:""}),"azure"===t.provider&&t.providerSpecificData&&f({azureEndpoint:t.providerSpecificData.azureEndpoint||"",apiVersion:t.providerSpecificData.apiVersion||"2024-10-01-preview",deployment:t.providerSpecificData.deployment||"",organization:t.providerSpecificData.organization||""}),"cloudflare-ai"===t.provider&&t.providerSpecificData&&g({accountId:t.providerSpecificData.accountId||""}),N(null),S(null))},[t]);let O=t?.authType==="oauth",R=t?.provider==="azure",P=t?.provider==="cloudflare-ai",E=!!t&&((0,m.mq)(t.provider)||(0,m.gb)(t.provider)),I=async()=>{if(t?.provider){v(!0),N(null);try{let e=await fetch(`/api/providers/${t.id}/test`,{method:"POST"}),s=await e.json();N(s.valid?"success":"failed")}catch{N("failed")}finally{v(!1)}}},M=async()=>{if(t?.provider&&u.apiKey){k(!0),S(null);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:u.apiKey,...R?{providerSpecificData:h}:{},...P?{providerSpecificData:b}:{}})}),s=await e.json();S(s.valid?"success":"failed")}catch{S("failed")}finally{k(!1)}}},A=async()=>{if(t){$(!0);try{let e={name:u.name,priority:u.priority};if(!O&&u.apiKey){e.apiKey=u.apiKey;let s="success"===C;if(!s)try{k(!0),S(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:u.apiKey,...R?{providerSpecificData:h}:{},...P?{providerSpecificData:b}:{}})});s=!!(await e.json()).valid,S(s?"success":"failed")}catch{S("failed")}finally{k(!1)}s&&(e.testStatus="active",e.lastError=null,e.lastErrorAt=null)}R&&(e.providerSpecificData={azureEndpoint:h.azureEndpoint,apiVersion:h.apiVersion,deployment:h.deployment,organization:h.organization}),P&&(e.providerSpecificData={accountId:b.accountId}),await l(e)}finally{$(!1)}}};return t?(0,r.jsx)(i.default,{isOpen:e,title:"Edit Connection",onClose:n,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(o.default,{label:"Name",value:u.name,onChange:e=>p({...u,name:e.target.value}),placeholder:O?"Account name":"Production Key"}),O&&t.email&&(0,r.jsxs)("div",{className:"bg-sidebar/50 p-3 rounded-lg",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted mb-1",children:"Email"}),(0,r.jsx)("p",{className:"font-medium",children:t.email})]}),(0,r.jsx)(o.default,{label:"Priority",type:"number",value:u.priority,onChange:e=>p({...u,priority:Number.parseInt(e.target.value,10)||1})}),!O&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(o.default,{label:"API Key",type:"password",value:u.apiKey,onChange:e=>p({...u,apiKey:e.target.value}),placeholder:"Enter new API key",hint:"Leave blank to keep the current API key.",className:"flex-1"}),(0,r.jsx)("div",{className:"pt-6",children:(0,r.jsx)(d.default,{onClick:M,disabled:!u.apiKey||w||T,variant:"secondary",children:w?"Checking...":"Check"})})]}),C&&(0,r.jsx)(c.default,{variant:"success"===C?"success":"error",children:"success"===C?"Valid":"Invalid"})]}),R&&(0,r.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,r.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsx)(o.default,{label:"Azure Endpoint",value:h.azureEndpoint,onChange:e=>f({...h,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com",hint:"Your Azure OpenAI resource endpoint URL"}),(0,r.jsx)(o.default,{label:"Deployment Name",value:h.deployment,onChange:e=>f({...h,deployment:e.target.value}),placeholder:"gpt-4",hint:"The deployment name in your Azure resource"}),(0,r.jsx)(o.default,{label:"API Version",value:h.apiVersion,onChange:e=>f({...h,apiVersion:e.target.value}),placeholder:"2024-10-01-preview",hint:"Azure OpenAI API version to use"}),(0,r.jsx)(o.default,{label:"Organization",value:h.organization,onChange:e=>f({...h,organization:e.target.value}),placeholder:"Organization ID",hint:"Required for billing"})]})]}),!E&&!R&&!P&&(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(d.default,{onClick:I,variant:"secondary",disabled:j,children:j?"Testing...":"Test Connection"}),y&&(0,r.jsx)(c.default,{variant:"success"===y?"success":"error",children:"success"===y?"Valid":"Failed"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(d.default,{onClick:A,fullWidth:!0,disabled:T,children:T?"Saving...":"Save"}),(0,r.jsx)(d.default,{onClick:n,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}x.propTypes={isOpen:n().bool.isRequired,connection:n().shape({id:n().string,name:n().string,email:n().string,priority:n().number,authType:n().string,provider:n().string,providerSpecificData:n().object}),proxyPools:n().arrayOf(n().shape({id:n().string,name:n().string})),onSave:n().func.isRequired,onClose:n().func.isRequired}},91494:(e,t,s)=>{s.d(t,{CardSkeleton:()=>o,PageLoading:()=>n,Skeleton:()=>i,Spinner:()=>l,default:()=>d});var r=s(73365),a=s(87706);function l({size:e="md",className:t}){return(0,r.jsx)("span",{className:(0,a.cn)("material-symbols-outlined animate-spin text-brand-500",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[e],t),children:"progress_activity"})}function n({message:e="Loading..."}){return(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,r.jsx)(l,{size:"xl"}),(0,r.jsx)("p",{className:"mt-4 text-text-muted",children:e})]})}function i({className:e,...t}){return(0,r.jsx)("div",{className:(0,a.cn)("animate-pulse rounded-[10px] bg-surface-2",e),...t})}function o(){return(0,r.jsxs)("div",{className:"p-6 rounded-[14px] border border-border-subtle bg-surface shadow-[var(--shadow-soft)]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)(i,{className:"h-4 w-24"}),(0,r.jsx)(i,{className:"size-10 rounded-[10px]"})]}),(0,r.jsx)(i,{className:"h-8 w-16 mb-2"}),(0,r.jsx)(i,{className:"h-3 w-20"})]})}function d({type:e="spinner",...t}){switch(e){case"page":return(0,r.jsx)(n,{...t});case"skeleton":return(0,r.jsx)(i,{...t});case"card":return(0,r.jsx)(o,{...t});default:return(0,r.jsx)(l,{...t})}}},96459:(e,t,s)=>{s.d(t,{C:()=>a});var r=s(1521);function a(e=2e3){let[t,s]=(0,r.useState)(null),l=(0,r.useRef)(null);return{copied:t,copy:(0,r.useCallback)((t,r="default")=>{(async()=>{if(navigator?.clipboard?.writeText)await navigator.clipboard.writeText(t);else{let e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}})(),s(r),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{s(null)},e)},[e])}}},99775:(e,t,s)=>{s.d(t,{default:()=>m});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(292),o=s(37066),d=s(35045);let c="__none__";function m({providerId:e}){let[t,s]=(0,a.useState)([]),[l,n]=(0,a.useState)(c),[x,u]=(0,a.useState)(!1),[p,h]=(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(([r,a])=>{t||(s(r.proxyPools||[]),n(((a.providerStrategies||{})[e]||{}).proxyPoolId||c))}).catch(()=>{}),()=>{t=!0}},[e]);let f=async t=>{n(t),u(!0);try{let s=await fetch("/api/settings",{cache:"no-store"}),r=(s.ok?await s.json():{}).providerStrategies||{},a={...r[e]||{}};t===c?delete a.proxyPoolId:a.proxyPoolId=t;let l={...r};0===Object.keys(a).length?delete l[e]:l[e]=a,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:l})}),h(!0),setTimeout(()=>h(!1),1500)}catch(e){console.log("Save proxyPoolId error:",e)}finally{u(!1)}};return(0,r.jsxs)(i.default,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,r.jsx)("div",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-green-500/10 text-green-500",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"lock_open"})}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"No authentication required"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"This provider is ready to use. Optionally route requests through a proxy pool to bypass IP-based limits."})]}),p&&(0,r.jsx)(d.default,{variant:"success",size:"sm",children:"Saved"})]}),(0,r.jsx)(o.default,{label:"Proxy Pool",value:l,onChange:e=>f(e.target.value),disabled:x,options:[{value:c,label:"None (direct)"},...t.map(e=>({value:e.id,label:e.name}))]})]})}m.propTypes={providerId:n().string.isRequired}}}]);