@yina-npm/openrouterx 0.4.11 → 0.4.19

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 (640) hide show
  1. package/app/.next/BUILD_ID +1 -1
  2. package/app/.next/app-path-routes-manifest.json +6 -1
  3. package/app/.next/build-manifest.json +2 -2
  4. package/app/.next/routes-manifest.json +35 -3
  5. package/app/.next/server/app/(dashboard)/dashboard/admin/keys/page.js +2 -2
  6. package/app/.next/server/app/(dashboard)/dashboard/admin/keys/page.js.nft.json +1 -1
  7. package/app/.next/server/app/(dashboard)/dashboard/admin/keys/page_client-reference-manifest.js +1 -1
  8. package/app/.next/server/app/(dashboard)/dashboard/admin/users/page.js +2 -2
  9. package/app/.next/server/app/(dashboard)/dashboard/admin/users/page.js.nft.json +1 -1
  10. package/app/.next/server/app/(dashboard)/dashboard/admin/users/page_client-reference-manifest.js +1 -1
  11. package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page.js +2 -2
  12. package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  13. package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  14. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +2 -2
  15. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  16. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  17. package/app/.next/server/app/(dashboard)/dashboard/combos/page.js +2 -2
  18. package/app/.next/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  19. package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  20. package/app/.next/server/app/(dashboard)/dashboard/console-log/page.js +2 -2
  21. package/app/.next/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  22. package/app/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  23. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js +2 -2
  24. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  25. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  26. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +23 -17
  27. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  28. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  29. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +2 -2
  30. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  31. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  32. package/app/.next/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +5 -0
  33. package/app/.next/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -0
  34. package/app/.next/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -0
  35. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page.js +2 -2
  36. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  37. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  38. package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js +2 -2
  39. package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  40. package/app/.next/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  41. package/app/.next/server/app/(dashboard)/dashboard/page.js +2 -2
  42. package/app/.next/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  43. package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  44. package/app/.next/server/app/(dashboard)/dashboard/profile/page.js +2 -2
  45. package/app/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  46. package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  47. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
  48. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  49. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  50. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js +2 -2
  51. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  52. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  53. package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +2 -2
  54. package/app/.next/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  55. package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  56. package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js +5 -3
  57. package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  58. package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  59. package/app/.next/server/app/(dashboard)/dashboard/quota/page.js +2 -2
  60. package/app/.next/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  61. package/app/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  62. package/app/.next/server/app/(dashboard)/dashboard/skills/page.js +2 -0
  63. package/app/.next/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -0
  64. package/app/.next/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -0
  65. package/app/.next/server/app/(dashboard)/dashboard/translator/page.js +2 -2
  66. package/app/.next/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  67. package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  68. package/app/.next/server/app/(dashboard)/dashboard/usage/page.js +2 -2
  69. package/app/.next/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  70. package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  71. package/app/.next/server/app/(dashboard)/dashboard/user/page.js +3 -3
  72. package/app/.next/server/app/(dashboard)/dashboard/user/page.js.nft.json +1 -1
  73. package/app/.next/server/app/(dashboard)/dashboard/user/page_client-reference-manifest.js +1 -1
  74. package/app/.next/server/app/_global-error/page.js +3 -3
  75. package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  76. package/app/.next/server/app/_global-error.html +1 -1
  77. package/app/.next/server/app/_global-error.rsc +1 -1
  78. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  79. package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  80. package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  81. package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  82. package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  83. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  84. package/app/.next/server/app/_not-found/page.js +2 -2
  85. package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
  86. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  87. package/app/.next/server/app/_not-found.html +1 -1
  88. package/app/.next/server/app/_not-found.rsc +4 -4
  89. package/app/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
  90. package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  91. package/app/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
  92. package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  93. package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  94. package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  95. package/app/.next/server/app/api/auth/login/route.js +1 -1
  96. package/app/.next/server/app/api/auth/logout/route.js +1 -1
  97. package/app/.next/server/app/api/auth/me/route.js +1 -1
  98. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +1 -1
  99. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  100. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +1 -1
  101. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  102. package/app/.next/server/app/api/cli-tools/claude-settings/route.js +1 -1
  103. package/app/.next/server/app/api/cli-tools/codex-settings/route.js +2 -2
  104. package/app/.next/server/app/api/cli-tools/copilot-settings/route.js +2 -2
  105. package/app/.next/server/app/api/cli-tools/cowork-settings/route.js +2 -0
  106. package/app/.next/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -0
  107. package/app/.next/server/app/api/cli-tools/cowork-settings/route_client-reference-manifest.js +1 -0
  108. package/app/.next/server/app/api/cli-tools/droid-settings/route.js +2 -2
  109. package/app/.next/server/app/api/cli-tools/hermes-settings/route.js +1 -1
  110. package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +1 -1
  111. package/app/.next/server/app/api/cli-tools/opencode-settings/route.js +1 -1
  112. package/app/.next/server/app/api/cloud/auth/route.js +1 -1
  113. package/app/.next/server/app/api/cloud/credentials/update/route.js +1 -1
  114. package/app/.next/server/app/api/cloud/model/resolve/route.js +1 -1
  115. package/app/.next/server/app/api/cloud/models/alias/route.js +1 -1
  116. package/app/.next/server/app/api/combos/[id]/route.js +1 -1
  117. package/app/.next/server/app/api/combos/route.js +1 -1
  118. package/app/.next/server/app/api/health/route.js +1 -1
  119. package/app/.next/server/app/api/init/route.js +1 -1
  120. package/app/.next/server/app/api/init/route.js.nft.json +1 -1
  121. package/app/.next/server/app/api/keys/[id]/route.js +1 -1
  122. package/app/.next/server/app/api/keys/route.js +1 -1
  123. package/app/.next/server/app/api/locale/route.js +1 -1
  124. package/app/.next/server/app/api/media-providers/tts/deepgram/voices/route.js +1 -1
  125. package/app/.next/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  126. package/app/.next/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  127. package/app/.next/server/app/api/media-providers/tts/inworld/voices/route.js +1 -1
  128. package/app/.next/server/app/api/media-providers/tts/voices/route.js +1 -1
  129. package/app/.next/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  130. package/app/.next/server/app/api/models/alias/route.js +1 -1
  131. package/app/.next/server/app/api/models/availability/route.js +1 -1
  132. package/app/.next/server/app/api/models/custom/route.js +1 -1
  133. package/app/.next/server/app/api/models/disabled/route.js +1 -0
  134. package/app/.next/server/app/api/models/disabled/route.js.nft.json +1 -0
  135. package/app/.next/server/app/api/models/disabled/route_client-reference-manifest.js +1 -0
  136. package/app/.next/server/app/api/models/route.js +1 -1
  137. package/app/.next/server/app/api/models/test/route.js +1 -1
  138. package/app/.next/server/app/api/oauth/[provider]/[action]/route.js +6 -1
  139. package/app/.next/server/app/api/oauth/cursor/auto-import/route.js +2 -2
  140. package/app/.next/server/app/api/oauth/cursor/import/route.js +1 -1
  141. package/app/.next/server/app/api/oauth/gitlab/pat/route.js +1 -1
  142. package/app/.next/server/app/api/oauth/iflow/cookie/route.js +1 -1
  143. package/app/.next/server/app/api/oauth/kiro/auto-import/route.js +1 -1
  144. package/app/.next/server/app/api/oauth/kiro/import/route.js +1 -1
  145. package/app/.next/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
  146. package/app/.next/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  147. package/app/.next/server/app/api/pricing/route.js +1 -1
  148. package/app/.next/server/app/api/provider-nodes/[id]/route.js +1 -1
  149. package/app/.next/server/app/api/provider-nodes/route.js +1 -1
  150. package/app/.next/server/app/api/provider-nodes/validate/route.js +1 -1
  151. package/app/.next/server/app/api/providers/[id]/models/route.js +1 -1
  152. package/app/.next/server/app/api/providers/[id]/route.js +1 -1
  153. package/app/.next/server/app/api/providers/[id]/test/route.js +1 -1
  154. package/app/.next/server/app/api/providers/[id]/test-models/route.js +1 -1
  155. package/app/.next/server/app/api/providers/client/route.js +1 -1
  156. package/app/.next/server/app/api/providers/kilo/free-models/route.js +1 -1
  157. package/app/.next/server/app/api/providers/route.js +1 -1
  158. package/app/.next/server/app/api/providers/suggested-models/route.js +1 -1
  159. package/app/.next/server/app/api/providers/test-batch/route.js +1 -1
  160. package/app/.next/server/app/api/providers/validate/route.js +1 -1
  161. package/app/.next/server/app/api/proxy-pools/[id]/route.js +1 -1
  162. package/app/.next/server/app/api/proxy-pools/[id]/test/route.js +1 -1
  163. package/app/.next/server/app/api/proxy-pools/route.js +1 -1
  164. package/app/.next/server/app/api/proxy-pools/vercel-deploy/route.js +2 -2
  165. package/app/.next/server/app/api/settings/database/route.js +1 -1
  166. package/app/.next/server/app/api/settings/proxy-test/route.js +1 -1
  167. package/app/.next/server/app/api/settings/require-login/route.js +1 -1
  168. package/app/.next/server/app/api/settings/route.js +1 -1
  169. package/app/.next/server/app/api/shutdown/route.js +1 -1
  170. package/app/.next/server/app/api/tags/route.js +1 -1
  171. package/app/.next/server/app/api/translator/console-logs/route.js +1 -1
  172. package/app/.next/server/app/api/translator/console-logs/stream/route.js +4 -4
  173. package/app/.next/server/app/api/translator/load/route.js +1 -1
  174. package/app/.next/server/app/api/translator/save/route.js +1 -1
  175. package/app/.next/server/app/api/translator/send/route.js +1 -1
  176. package/app/.next/server/app/api/translator/translate/route.js +1 -1
  177. package/app/.next/server/app/api/translator/translate/route.js.nft.json +1 -1
  178. package/app/.next/server/app/api/tunnel/disable/route.js +1 -1
  179. package/app/.next/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  180. package/app/.next/server/app/api/tunnel/enable/route.js +1 -1
  181. package/app/.next/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  182. package/app/.next/server/app/api/tunnel/status/route.js +1 -1
  183. package/app/.next/server/app/api/tunnel/status/route.js.nft.json +1 -1
  184. package/app/.next/server/app/api/tunnel/tailscale-check/route.js +1 -23
  185. package/app/.next/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  186. package/app/.next/server/app/api/tunnel/tailscale-disable/route.js +1 -1
  187. package/app/.next/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  188. package/app/.next/server/app/api/tunnel/tailscale-enable/route.js +1 -1
  189. package/app/.next/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  190. package/app/.next/server/app/api/tunnel/tailscale-install/route.js +2 -2
  191. package/app/.next/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  192. package/app/.next/server/app/api/tunnel/tailscale-login/route.js +1 -23
  193. package/app/.next/server/app/api/tunnel/tailscale-login/route.js.nft.json +1 -1
  194. package/app/.next/server/app/api/tunnel/tailscale-start-daemon/route.js +2 -2
  195. package/app/.next/server/app/api/tunnel/tailscale-start-daemon/route.js.nft.json +1 -1
  196. package/app/.next/server/app/api/usage/[connectionId]/route.js +1 -1
  197. package/app/.next/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  198. package/app/.next/server/app/api/usage/api-keys/route.js +1 -1
  199. package/app/.next/server/app/api/usage/chart/route.js +1 -1
  200. package/app/.next/server/app/api/usage/history/route.js +1 -1
  201. package/app/.next/server/app/api/usage/logs/route.js +1 -1
  202. package/app/.next/server/app/api/usage/providers/route.js +1 -1
  203. package/app/.next/server/app/api/usage/request-details/route.js +1 -1
  204. package/app/.next/server/app/api/usage/request-logs/route.js +1 -1
  205. package/app/.next/server/app/api/usage/stats/route.js +1 -1
  206. package/app/.next/server/app/api/usage/stream/route.js +2 -2
  207. package/app/.next/server/app/api/users/[id]/route.js +1 -1
  208. package/app/.next/server/app/api/users/route.js +1 -1
  209. package/app/.next/server/app/api/v1/api/chat/route.js +1 -1
  210. package/app/.next/server/app/api/v1/audio/speech/route.js +1 -1
  211. package/app/.next/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  212. package/app/.next/server/app/api/v1/audio/transcriptions/route.js +1 -0
  213. package/app/.next/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -0
  214. package/app/.next/server/app/api/v1/audio/transcriptions/route_client-reference-manifest.js +1 -0
  215. package/app/.next/server/app/api/v1/chat/completions/route.js +1 -1
  216. package/app/.next/server/app/api/v1/embeddings/route.js +1 -1
  217. package/app/.next/server/app/api/v1/images/generations/route.js +3 -3
  218. package/app/.next/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  219. package/app/.next/server/app/api/v1/messages/count_tokens/route.js +1 -1
  220. package/app/.next/server/app/api/v1/messages/route.js +1 -1
  221. package/app/.next/server/app/api/v1/models/[kind]/route.js +1 -0
  222. package/app/.next/server/app/api/v1/models/[kind]/route.js.nft.json +1 -0
  223. package/app/.next/server/app/api/v1/models/[kind]/route_client-reference-manifest.js +1 -0
  224. package/app/.next/server/app/api/v1/models/route.js +1 -1
  225. package/app/.next/server/app/api/v1/models/route.js.nft.json +1 -1
  226. package/app/.next/server/app/api/v1/responses/compact/route.js +1 -1
  227. package/app/.next/server/app/api/v1/responses/route.js +1 -1
  228. package/app/.next/server/app/api/v1/route.js +1 -1
  229. package/app/.next/server/app/api/v1/route.js.nft.json +1 -1
  230. package/app/.next/server/app/api/v1/search/route.js +1 -1
  231. package/app/.next/server/app/api/v1/web/fetch/route.js +1 -1
  232. package/app/.next/server/app/api/v1beta/models/[...path]/route.js +1 -1
  233. package/app/.next/server/app/api/v1beta/models/route.js +1 -1
  234. package/app/.next/server/app/api/version/route.js +1 -1
  235. package/app/.next/server/app/api/version/update/route.js +1 -1
  236. package/app/.next/server/app/callback/page.js +2 -2
  237. package/app/.next/server/app/callback/page.js.nft.json +1 -1
  238. package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  239. package/app/.next/server/app/callback.html +1 -1
  240. package/app/.next/server/app/callback.rsc +4 -4
  241. package/app/.next/server/app/callback.segments/_full.segment.rsc +4 -4
  242. package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
  243. package/app/.next/server/app/callback.segments/_index.segment.rsc +4 -4
  244. package/app/.next/server/app/callback.segments/_tree.segment.rsc +2 -2
  245. package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  246. package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
  247. package/app/.next/server/app/dashboard/settings/pricing/page.js +2 -2
  248. package/app/.next/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  249. package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  250. package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
  251. package/app/.next/server/app/dashboard/settings/pricing.rsc +5 -5
  252. package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +5 -5
  253. package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  254. package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
  255. package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  256. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +2 -2
  257. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  258. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  259. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  260. package/app/.next/server/app/favicon.ico/route.js +1 -1
  261. package/app/.next/server/app/index.html +1 -1
  262. package/app/.next/server/app/index.rsc +4 -4
  263. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  264. package/app/.next/server/app/index.segments/_full.segment.rsc +4 -4
  265. package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
  266. package/app/.next/server/app/index.segments/_index.segment.rsc +4 -4
  267. package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  268. package/app/.next/server/app/landing/page.js +2 -2
  269. package/app/.next/server/app/landing/page.js.nft.json +1 -1
  270. package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  271. package/app/.next/server/app/landing.html +1 -1
  272. package/app/.next/server/app/landing.rsc +4 -4
  273. package/app/.next/server/app/landing.segments/_full.segment.rsc +4 -4
  274. package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
  275. package/app/.next/server/app/landing.segments/_index.segment.rsc +4 -4
  276. package/app/.next/server/app/landing.segments/_tree.segment.rsc +2 -2
  277. package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  278. package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
  279. package/app/.next/server/app/login/page.js +2 -2
  280. package/app/.next/server/app/login/page.js.nft.json +1 -1
  281. package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
  282. package/app/.next/server/app/login.html +1 -1
  283. package/app/.next/server/app/login.rsc +5 -5
  284. package/app/.next/server/app/login.segments/_full.segment.rsc +5 -5
  285. package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
  286. package/app/.next/server/app/login.segments/_index.segment.rsc +4 -4
  287. package/app/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  288. package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  289. package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
  290. package/app/.next/server/app/manifest.webmanifest/route.js +2 -2
  291. package/app/.next/server/app/page.js +2 -2
  292. package/app/.next/server/app/page.js.nft.json +1 -1
  293. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  294. package/app/.next/server/app-paths-manifest.json +6 -1
  295. package/app/.next/server/chunks/1256.js +1 -1
  296. package/app/.next/server/chunks/1263.js +2 -2
  297. package/app/.next/server/chunks/2238.js +23 -0
  298. package/app/.next/server/chunks/2343.js +1 -0
  299. package/app/.next/server/chunks/2549.js +1 -1
  300. package/app/.next/server/chunks/3245.js +1 -1
  301. package/app/.next/server/chunks/3855.js +1 -1
  302. package/app/.next/server/chunks/412.js +3 -3
  303. package/app/.next/server/chunks/4122.js +1 -1
  304. package/app/.next/server/chunks/4664.js +1 -1
  305. package/app/.next/server/chunks/4989.js +2 -2
  306. package/app/.next/server/chunks/5434.js +1 -0
  307. package/app/.next/server/chunks/5627.js +15 -0
  308. package/app/.next/server/chunks/5681.js +1 -1
  309. package/app/.next/server/chunks/6182.js +15 -0
  310. package/app/.next/server/chunks/7595.js +1 -1
  311. package/app/.next/server/chunks/7937.js +9 -43
  312. package/app/.next/server/chunks/8590.js +1 -1
  313. package/app/.next/server/chunks/8760.js +1 -1
  314. package/app/.next/server/chunks/8895.js +42 -2
  315. package/app/.next/server/chunks/9489.js +1 -1
  316. package/app/.next/server/chunks/9609.js +1 -1
  317. package/app/.next/server/chunks/9718.js +1 -1
  318. package/app/.next/server/functions-config-manifest.json +3 -0
  319. package/app/.next/server/middleware-build-manifest.js +1 -1
  320. package/app/.next/server/middleware.js +1 -1
  321. package/app/.next/server/pages/404.html +1 -1
  322. package/app/.next/server/pages/500.html +1 -1
  323. package/app/.next/server/server-reference-manifest.js +1 -1
  324. package/app/.next/server/server-reference-manifest.json +1 -1
  325. package/app/.next/static/NtU3O4mCJYjlmlBWGF7gX/_buildManifest.js +1 -0
  326. package/app/.next/static/chunks/1321-7e9aeddc67afb663.js +1 -0
  327. package/app/.next/static/chunks/4295-fbaece639df900b6.js +23 -0
  328. package/app/.next/static/chunks/5497-54ae9c6ec04c2fb1.js +7 -0
  329. package/app/.next/static/chunks/5555-9189a6eb2a8e87a5.js +3 -0
  330. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-ba226c8b3c01dd8d.js +1 -0
  331. package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-cee4e0a7455b73ca.js +1 -0
  332. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-e8660483a85aed9d.js +59 -0
  333. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-9ff3dee6ea964428.js +1 -0
  334. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/page-28a10e3cb86b9581.js +4 -0
  335. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/web/page-eefae72167c9579c.js +1 -0
  336. package/app/.next/static/chunks/app/(dashboard)/dashboard/mitm/page-99260106103e6a4e.js +1 -0
  337. package/app/.next/static/chunks/app/(dashboard)/dashboard/profile/page-6289612ce5f7c181.js +1 -0
  338. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-08a8f17b396ac1f4.js +1 -0
  339. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-7dac10f6360f52df.js +1 -0
  340. package/app/.next/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-abd7d942ceae9293.js +4 -0
  341. package/app/.next/static/chunks/app/(dashboard)/dashboard/quota/page-52fbe722ba5c5393.js +1 -0
  342. package/app/.next/static/chunks/app/(dashboard)/dashboard/skills/page-d4518d92737b2728.js +1 -0
  343. package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-badb7034e478a358.js +1 -0
  344. package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-2ae01d48c665f7b4.js +1 -0
  345. package/app/.next/static/chunks/app/_global-error/page-badb7034e478a358.js +1 -0
  346. package/app/.next/static/chunks/app/api/auth/login/route-badb7034e478a358.js +1 -0
  347. package/app/.next/static/chunks/app/api/auth/logout/route-badb7034e478a358.js +1 -0
  348. package/app/.next/static/chunks/app/api/auth/me/route-badb7034e478a358.js +1 -0
  349. package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/alias/route-badb7034e478a358.js +1 -0
  350. package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/route-badb7034e478a358.js +1 -0
  351. package/app/.next/static/chunks/app/api/cli-tools/claude-settings/route-badb7034e478a358.js +1 -0
  352. package/app/.next/static/chunks/app/api/cli-tools/codex-settings/route-badb7034e478a358.js +1 -0
  353. package/app/.next/static/chunks/app/api/cli-tools/copilot-settings/route-badb7034e478a358.js +1 -0
  354. package/app/.next/static/chunks/app/api/cli-tools/cowork-settings/route-badb7034e478a358.js +1 -0
  355. package/app/.next/static/chunks/app/api/cli-tools/droid-settings/route-badb7034e478a358.js +1 -0
  356. package/app/.next/static/chunks/app/api/cli-tools/hermes-settings/route-badb7034e478a358.js +1 -0
  357. package/app/.next/static/chunks/app/api/cli-tools/openclaw-settings/route-badb7034e478a358.js +1 -0
  358. package/app/.next/static/chunks/app/api/cli-tools/opencode-settings/route-badb7034e478a358.js +1 -0
  359. package/app/.next/static/chunks/app/api/cloud/auth/route-badb7034e478a358.js +1 -0
  360. package/app/.next/static/chunks/app/api/cloud/credentials/update/route-badb7034e478a358.js +1 -0
  361. package/app/.next/static/chunks/app/api/cloud/model/resolve/route-badb7034e478a358.js +1 -0
  362. package/app/.next/static/chunks/app/api/cloud/models/alias/route-badb7034e478a358.js +1 -0
  363. package/app/.next/static/chunks/app/api/combos/[id]/route-badb7034e478a358.js +1 -0
  364. package/app/.next/static/chunks/app/api/combos/route-badb7034e478a358.js +1 -0
  365. package/app/.next/static/chunks/app/api/health/route-badb7034e478a358.js +1 -0
  366. package/app/.next/static/chunks/app/api/init/route-badb7034e478a358.js +1 -0
  367. package/app/.next/static/chunks/app/api/keys/[id]/route-badb7034e478a358.js +1 -0
  368. package/app/.next/static/chunks/app/api/keys/route-badb7034e478a358.js +1 -0
  369. package/app/.next/static/chunks/app/api/locale/route-badb7034e478a358.js +1 -0
  370. package/app/.next/static/chunks/app/api/media-providers/tts/deepgram/voices/route-badb7034e478a358.js +1 -0
  371. package/app/.next/static/chunks/app/api/media-providers/tts/elevenlabs/voices/route-badb7034e478a358.js +1 -0
  372. package/app/.next/static/chunks/app/api/media-providers/tts/inworld/voices/route-badb7034e478a358.js +1 -0
  373. package/app/.next/static/chunks/app/api/media-providers/tts/voices/route-badb7034e478a358.js +1 -0
  374. package/app/.next/static/chunks/app/api/models/alias/route-badb7034e478a358.js +1 -0
  375. package/app/.next/static/chunks/app/api/models/availability/route-badb7034e478a358.js +1 -0
  376. package/app/.next/static/chunks/app/api/models/custom/route-badb7034e478a358.js +1 -0
  377. package/app/.next/static/chunks/app/api/models/disabled/route-badb7034e478a358.js +1 -0
  378. package/app/.next/static/chunks/app/api/models/route-badb7034e478a358.js +1 -0
  379. package/app/.next/static/chunks/app/api/models/test/route-badb7034e478a358.js +1 -0
  380. package/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-badb7034e478a358.js +1 -0
  381. package/app/.next/static/chunks/app/api/oauth/cursor/auto-import/route-badb7034e478a358.js +1 -0
  382. package/app/.next/static/chunks/app/api/oauth/cursor/import/route-badb7034e478a358.js +1 -0
  383. package/app/.next/static/chunks/app/api/oauth/gitlab/pat/route-badb7034e478a358.js +1 -0
  384. package/app/.next/static/chunks/app/api/oauth/iflow/cookie/route-badb7034e478a358.js +1 -0
  385. package/app/.next/static/chunks/app/api/oauth/kiro/auto-import/route-badb7034e478a358.js +1 -0
  386. package/app/.next/static/chunks/app/api/oauth/kiro/import/route-badb7034e478a358.js +1 -0
  387. package/app/.next/static/chunks/app/api/oauth/kiro/social-authorize/route-badb7034e478a358.js +1 -0
  388. package/app/.next/static/chunks/app/api/oauth/kiro/social-exchange/route-badb7034e478a358.js +1 -0
  389. package/app/.next/static/chunks/app/api/pricing/route-badb7034e478a358.js +1 -0
  390. package/app/.next/static/chunks/app/api/provider-nodes/[id]/route-badb7034e478a358.js +1 -0
  391. package/app/.next/static/chunks/app/api/provider-nodes/route-badb7034e478a358.js +1 -0
  392. package/app/.next/static/chunks/app/api/provider-nodes/validate/route-badb7034e478a358.js +1 -0
  393. package/app/.next/static/chunks/app/api/providers/[id]/models/route-badb7034e478a358.js +1 -0
  394. package/app/.next/static/chunks/app/api/providers/[id]/route-badb7034e478a358.js +1 -0
  395. package/app/.next/static/chunks/app/api/providers/[id]/test/route-badb7034e478a358.js +1 -0
  396. package/app/.next/static/chunks/app/api/providers/[id]/test-models/route-badb7034e478a358.js +1 -0
  397. package/app/.next/static/chunks/app/api/providers/client/route-badb7034e478a358.js +1 -0
  398. package/app/.next/static/chunks/app/api/providers/kilo/free-models/route-badb7034e478a358.js +1 -0
  399. package/app/.next/static/chunks/app/api/providers/route-badb7034e478a358.js +1 -0
  400. package/app/.next/static/chunks/app/api/providers/suggested-models/route-badb7034e478a358.js +1 -0
  401. package/app/.next/static/chunks/app/api/providers/test-batch/route-badb7034e478a358.js +1 -0
  402. package/app/.next/static/chunks/app/api/providers/validate/route-badb7034e478a358.js +1 -0
  403. package/app/.next/static/chunks/app/api/proxy-pools/[id]/route-badb7034e478a358.js +1 -0
  404. package/app/.next/static/chunks/app/api/proxy-pools/[id]/test/route-badb7034e478a358.js +1 -0
  405. package/app/.next/static/chunks/app/api/proxy-pools/route-badb7034e478a358.js +1 -0
  406. package/app/.next/static/chunks/app/api/proxy-pools/vercel-deploy/route-badb7034e478a358.js +1 -0
  407. package/app/.next/static/chunks/app/api/settings/database/route-badb7034e478a358.js +1 -0
  408. package/app/.next/static/chunks/app/api/settings/proxy-test/route-badb7034e478a358.js +1 -0
  409. package/app/.next/static/chunks/app/api/settings/require-login/route-badb7034e478a358.js +1 -0
  410. package/app/.next/static/chunks/app/api/settings/route-badb7034e478a358.js +1 -0
  411. package/app/.next/static/chunks/app/api/shutdown/route-badb7034e478a358.js +1 -0
  412. package/app/.next/static/chunks/app/api/tags/route-badb7034e478a358.js +1 -0
  413. package/app/.next/static/chunks/app/api/translator/console-logs/route-badb7034e478a358.js +1 -0
  414. package/app/.next/static/chunks/app/api/translator/console-logs/stream/route-badb7034e478a358.js +1 -0
  415. package/app/.next/static/chunks/app/api/translator/load/route-badb7034e478a358.js +1 -0
  416. package/app/.next/static/chunks/app/api/translator/save/route-badb7034e478a358.js +1 -0
  417. package/app/.next/static/chunks/app/api/translator/send/route-badb7034e478a358.js +1 -0
  418. package/app/.next/static/chunks/app/api/translator/translate/route-badb7034e478a358.js +1 -0
  419. package/app/.next/static/chunks/app/api/tunnel/disable/route-badb7034e478a358.js +1 -0
  420. package/app/.next/static/chunks/app/api/tunnel/enable/route-badb7034e478a358.js +1 -0
  421. package/app/.next/static/chunks/app/api/tunnel/status/route-badb7034e478a358.js +1 -0
  422. package/app/.next/static/chunks/app/api/tunnel/tailscale-check/route-badb7034e478a358.js +1 -0
  423. package/app/.next/static/chunks/app/api/tunnel/tailscale-disable/route-badb7034e478a358.js +1 -0
  424. package/app/.next/static/chunks/app/api/tunnel/tailscale-enable/route-badb7034e478a358.js +1 -0
  425. package/app/.next/static/chunks/app/api/tunnel/tailscale-install/route-badb7034e478a358.js +1 -0
  426. package/app/.next/static/chunks/app/api/tunnel/tailscale-login/route-badb7034e478a358.js +1 -0
  427. package/app/.next/static/chunks/app/api/tunnel/tailscale-start-daemon/route-badb7034e478a358.js +1 -0
  428. package/app/.next/static/chunks/app/api/usage/[connectionId]/route-badb7034e478a358.js +1 -0
  429. package/app/.next/static/chunks/app/api/usage/api-keys/route-badb7034e478a358.js +1 -0
  430. package/app/.next/static/chunks/app/api/usage/chart/route-badb7034e478a358.js +1 -0
  431. package/app/.next/static/chunks/app/api/usage/history/route-badb7034e478a358.js +1 -0
  432. package/app/.next/static/chunks/app/api/usage/logs/route-badb7034e478a358.js +1 -0
  433. package/app/.next/static/chunks/app/api/usage/providers/route-badb7034e478a358.js +1 -0
  434. package/app/.next/static/chunks/app/api/usage/request-details/route-badb7034e478a358.js +1 -0
  435. package/app/.next/static/chunks/app/api/usage/request-logs/route-badb7034e478a358.js +1 -0
  436. package/app/.next/static/chunks/app/api/usage/stats/route-badb7034e478a358.js +1 -0
  437. package/app/.next/static/chunks/app/api/usage/stream/route-badb7034e478a358.js +1 -0
  438. package/app/.next/static/chunks/app/api/users/[id]/route-badb7034e478a358.js +1 -0
  439. package/app/.next/static/chunks/app/api/users/route-badb7034e478a358.js +1 -0
  440. package/app/.next/static/chunks/app/api/v1/api/chat/route-badb7034e478a358.js +1 -0
  441. package/app/.next/static/chunks/app/api/v1/audio/speech/route-badb7034e478a358.js +1 -0
  442. package/app/.next/static/chunks/app/api/v1/audio/transcriptions/route-badb7034e478a358.js +1 -0
  443. package/app/.next/static/chunks/app/api/v1/chat/completions/route-badb7034e478a358.js +1 -0
  444. package/app/.next/static/chunks/app/api/v1/embeddings/route-badb7034e478a358.js +1 -0
  445. package/app/.next/static/chunks/app/api/v1/images/generations/route-badb7034e478a358.js +1 -0
  446. package/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-badb7034e478a358.js +1 -0
  447. package/app/.next/static/chunks/app/api/v1/messages/route-badb7034e478a358.js +1 -0
  448. package/app/.next/static/chunks/app/api/v1/models/[kind]/route-badb7034e478a358.js +1 -0
  449. package/app/.next/static/chunks/app/api/v1/models/route-badb7034e478a358.js +1 -0
  450. package/app/.next/static/chunks/app/api/v1/responses/compact/route-badb7034e478a358.js +1 -0
  451. package/app/.next/static/chunks/app/api/v1/responses/route-badb7034e478a358.js +1 -0
  452. package/app/.next/static/chunks/app/api/v1/route-badb7034e478a358.js +1 -0
  453. package/app/.next/static/chunks/app/api/v1/search/route-badb7034e478a358.js +1 -0
  454. package/app/.next/static/chunks/app/api/v1/web/fetch/route-badb7034e478a358.js +1 -0
  455. package/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-badb7034e478a358.js +1 -0
  456. package/app/.next/static/chunks/app/api/v1beta/models/route-badb7034e478a358.js +1 -0
  457. package/app/.next/static/chunks/app/api/version/route-badb7034e478a358.js +1 -0
  458. package/app/.next/static/chunks/app/api/version/update/route-badb7034e478a358.js +1 -0
  459. package/app/.next/static/chunks/app/dashboard/settings/pricing/page-ac222da48f591dee.js +1 -0
  460. package/app/.next/static/chunks/app/login/page-163a87388cf383cc.js +1 -0
  461. package/app/.next/static/chunks/app/manifest.webmanifest/route-badb7034e478a358.js +1 -0
  462. package/app/.next/static/chunks/app/page-badb7034e478a358.js +1 -0
  463. package/app/.next/static/chunks/next/dist/client/components/builtin/app-error-badb7034e478a358.js +1 -0
  464. package/app/.next/static/chunks/next/dist/client/components/builtin/forbidden-badb7034e478a358.js +1 -0
  465. package/app/.next/static/chunks/next/dist/client/components/builtin/not-found-badb7034e478a358.js +1 -0
  466. package/app/.next/static/chunks/next/dist/client/components/builtin/unauthorized-badb7034e478a358.js +1 -0
  467. package/app/.next/static/css/326fa3d6432d4810.css +1 -0
  468. package/app/package.json +1 -1
  469. package/app/public/i18n/literals/zh-CN.json +397 -120
  470. package/app/public/providers/alicode-intl.png +0 -0
  471. package/app/public/providers/alicode.png +0 -0
  472. package/app/public/providers/aws-polly.png +0 -0
  473. package/app/public/providers/black-forest-labs.png +0 -0
  474. package/app/public/providers/byteplus.png +0 -0
  475. package/app/public/providers/cloudflare-ai.png +0 -0
  476. package/app/public/providers/fal-ai.png +0 -0
  477. package/app/public/providers/jina-ai.png +0 -0
  478. package/app/public/providers/nebius.png +0 -0
  479. package/app/public/providers/nvidia.png +0 -0
  480. package/app/public/providers/ollama-local.png +0 -0
  481. package/app/public/providers/ollama.png +0 -0
  482. package/app/public/providers/recraft.png +0 -0
  483. package/app/public/providers/runwayml.png +0 -0
  484. package/app/public/providers/stability-ai.png +0 -0
  485. package/app/public/providers/topaz.png +0 -0
  486. package/app/public/providers/vertex-partner.png +0 -0
  487. package/app/public/providers/vertex.png +0 -0
  488. package/app/public/providers/volcengine-ark.png +0 -0
  489. package/app/public/providers/xiaomi-mimo.png +0 -0
  490. package/app/src/mitm/dns/dnsConfig.js +77 -32
  491. package/app/src/mitm/manager.js +109 -28
  492. package/app/src/mitm/server.js +9 -8
  493. package/app/src/mitm/winElevated.js +8 -6
  494. package/app/src/shared/constants/mitmToolHosts.js +1 -0
  495. package/package.json +1 -1
  496. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/combo/[id]/page.js +0 -5
  497. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/combo/[id]/page.js.nft.json +0 -1
  498. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/combo/[id]/page_client-reference-manifest.js +0 -1
  499. package/app/.next/server/chunks/5599.js +0 -23
  500. package/app/.next/server/chunks/6555.js +0 -1
  501. package/app/.next/server/chunks/9501.js +0 -37
  502. package/app/.next/static/chunks/1321-e040e8704e8038e6.js +0 -1
  503. package/app/.next/static/chunks/5497-4da88480a15dec4c.js +0 -7
  504. package/app/.next/static/chunks/5555-91932fc7b159e521.js +0 -3
  505. package/app/.next/static/chunks/698-64c9bb7a1ba1f521.js +0 -23
  506. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-4a745b1296f08667.js +0 -1
  507. package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-842b00e6db9de7ae.js +0 -1
  508. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-0494f10cf7d2cae0.js +0 -53
  509. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-521aecf4ccb7b03e.js +0 -1
  510. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/web/combo/[id]/page-d594f315360645f3.js +0 -4
  511. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/web/page-ec14043bae22768d.js +0 -1
  512. package/app/.next/static/chunks/app/(dashboard)/dashboard/mitm/page-f8681cfb4c894f96.js +0 -1
  513. package/app/.next/static/chunks/app/(dashboard)/dashboard/profile/page-f0bbe6b3b1bfb85e.js +0 -1
  514. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-7985e45ad78144eb.js +0 -1
  515. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-d6d08994d9d6d690.js +0 -1
  516. package/app/.next/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-b2443c6d810b0207.js +0 -2
  517. package/app/.next/static/chunks/app/(dashboard)/dashboard/quota/page-fae4c95586692227.js +0 -1
  518. package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-24023a32c248257e.js +0 -1
  519. package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-48fc1f090d936818.js +0 -1
  520. package/app/.next/static/chunks/app/_global-error/page-24023a32c248257e.js +0 -1
  521. package/app/.next/static/chunks/app/api/auth/login/route-24023a32c248257e.js +0 -1
  522. package/app/.next/static/chunks/app/api/auth/logout/route-24023a32c248257e.js +0 -1
  523. package/app/.next/static/chunks/app/api/auth/me/route-24023a32c248257e.js +0 -1
  524. package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/alias/route-24023a32c248257e.js +0 -1
  525. package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/route-24023a32c248257e.js +0 -1
  526. package/app/.next/static/chunks/app/api/cli-tools/claude-settings/route-24023a32c248257e.js +0 -1
  527. package/app/.next/static/chunks/app/api/cli-tools/codex-settings/route-24023a32c248257e.js +0 -1
  528. package/app/.next/static/chunks/app/api/cli-tools/copilot-settings/route-24023a32c248257e.js +0 -1
  529. package/app/.next/static/chunks/app/api/cli-tools/droid-settings/route-24023a32c248257e.js +0 -1
  530. package/app/.next/static/chunks/app/api/cli-tools/hermes-settings/route-24023a32c248257e.js +0 -1
  531. package/app/.next/static/chunks/app/api/cli-tools/openclaw-settings/route-24023a32c248257e.js +0 -1
  532. package/app/.next/static/chunks/app/api/cli-tools/opencode-settings/route-24023a32c248257e.js +0 -1
  533. package/app/.next/static/chunks/app/api/cloud/auth/route-24023a32c248257e.js +0 -1
  534. package/app/.next/static/chunks/app/api/cloud/credentials/update/route-24023a32c248257e.js +0 -1
  535. package/app/.next/static/chunks/app/api/cloud/model/resolve/route-24023a32c248257e.js +0 -1
  536. package/app/.next/static/chunks/app/api/cloud/models/alias/route-24023a32c248257e.js +0 -1
  537. package/app/.next/static/chunks/app/api/combos/[id]/route-24023a32c248257e.js +0 -1
  538. package/app/.next/static/chunks/app/api/combos/route-24023a32c248257e.js +0 -1
  539. package/app/.next/static/chunks/app/api/health/route-24023a32c248257e.js +0 -1
  540. package/app/.next/static/chunks/app/api/init/route-24023a32c248257e.js +0 -1
  541. package/app/.next/static/chunks/app/api/keys/[id]/route-24023a32c248257e.js +0 -1
  542. package/app/.next/static/chunks/app/api/keys/route-24023a32c248257e.js +0 -1
  543. package/app/.next/static/chunks/app/api/locale/route-24023a32c248257e.js +0 -1
  544. package/app/.next/static/chunks/app/api/media-providers/tts/deepgram/voices/route-24023a32c248257e.js +0 -1
  545. package/app/.next/static/chunks/app/api/media-providers/tts/elevenlabs/voices/route-24023a32c248257e.js +0 -1
  546. package/app/.next/static/chunks/app/api/media-providers/tts/inworld/voices/route-24023a32c248257e.js +0 -1
  547. package/app/.next/static/chunks/app/api/media-providers/tts/voices/route-24023a32c248257e.js +0 -1
  548. package/app/.next/static/chunks/app/api/models/alias/route-24023a32c248257e.js +0 -1
  549. package/app/.next/static/chunks/app/api/models/availability/route-24023a32c248257e.js +0 -1
  550. package/app/.next/static/chunks/app/api/models/custom/route-24023a32c248257e.js +0 -1
  551. package/app/.next/static/chunks/app/api/models/route-24023a32c248257e.js +0 -1
  552. package/app/.next/static/chunks/app/api/models/test/route-24023a32c248257e.js +0 -1
  553. package/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-24023a32c248257e.js +0 -1
  554. package/app/.next/static/chunks/app/api/oauth/cursor/auto-import/route-24023a32c248257e.js +0 -1
  555. package/app/.next/static/chunks/app/api/oauth/cursor/import/route-24023a32c248257e.js +0 -1
  556. package/app/.next/static/chunks/app/api/oauth/gitlab/pat/route-24023a32c248257e.js +0 -1
  557. package/app/.next/static/chunks/app/api/oauth/iflow/cookie/route-24023a32c248257e.js +0 -1
  558. package/app/.next/static/chunks/app/api/oauth/kiro/auto-import/route-24023a32c248257e.js +0 -1
  559. package/app/.next/static/chunks/app/api/oauth/kiro/import/route-24023a32c248257e.js +0 -1
  560. package/app/.next/static/chunks/app/api/oauth/kiro/social-authorize/route-24023a32c248257e.js +0 -1
  561. package/app/.next/static/chunks/app/api/oauth/kiro/social-exchange/route-24023a32c248257e.js +0 -1
  562. package/app/.next/static/chunks/app/api/pricing/route-24023a32c248257e.js +0 -1
  563. package/app/.next/static/chunks/app/api/provider-nodes/[id]/route-24023a32c248257e.js +0 -1
  564. package/app/.next/static/chunks/app/api/provider-nodes/route-24023a32c248257e.js +0 -1
  565. package/app/.next/static/chunks/app/api/provider-nodes/validate/route-24023a32c248257e.js +0 -1
  566. package/app/.next/static/chunks/app/api/providers/[id]/models/route-24023a32c248257e.js +0 -1
  567. package/app/.next/static/chunks/app/api/providers/[id]/route-24023a32c248257e.js +0 -1
  568. package/app/.next/static/chunks/app/api/providers/[id]/test/route-24023a32c248257e.js +0 -1
  569. package/app/.next/static/chunks/app/api/providers/[id]/test-models/route-24023a32c248257e.js +0 -1
  570. package/app/.next/static/chunks/app/api/providers/client/route-24023a32c248257e.js +0 -1
  571. package/app/.next/static/chunks/app/api/providers/kilo/free-models/route-24023a32c248257e.js +0 -1
  572. package/app/.next/static/chunks/app/api/providers/route-24023a32c248257e.js +0 -1
  573. package/app/.next/static/chunks/app/api/providers/suggested-models/route-24023a32c248257e.js +0 -1
  574. package/app/.next/static/chunks/app/api/providers/test-batch/route-24023a32c248257e.js +0 -1
  575. package/app/.next/static/chunks/app/api/providers/validate/route-24023a32c248257e.js +0 -1
  576. package/app/.next/static/chunks/app/api/proxy-pools/[id]/route-24023a32c248257e.js +0 -1
  577. package/app/.next/static/chunks/app/api/proxy-pools/[id]/test/route-24023a32c248257e.js +0 -1
  578. package/app/.next/static/chunks/app/api/proxy-pools/route-24023a32c248257e.js +0 -1
  579. package/app/.next/static/chunks/app/api/proxy-pools/vercel-deploy/route-24023a32c248257e.js +0 -1
  580. package/app/.next/static/chunks/app/api/settings/database/route-24023a32c248257e.js +0 -1
  581. package/app/.next/static/chunks/app/api/settings/proxy-test/route-24023a32c248257e.js +0 -1
  582. package/app/.next/static/chunks/app/api/settings/require-login/route-24023a32c248257e.js +0 -1
  583. package/app/.next/static/chunks/app/api/settings/route-24023a32c248257e.js +0 -1
  584. package/app/.next/static/chunks/app/api/shutdown/route-24023a32c248257e.js +0 -1
  585. package/app/.next/static/chunks/app/api/tags/route-24023a32c248257e.js +0 -1
  586. package/app/.next/static/chunks/app/api/translator/console-logs/route-24023a32c248257e.js +0 -1
  587. package/app/.next/static/chunks/app/api/translator/console-logs/stream/route-24023a32c248257e.js +0 -1
  588. package/app/.next/static/chunks/app/api/translator/load/route-24023a32c248257e.js +0 -1
  589. package/app/.next/static/chunks/app/api/translator/save/route-24023a32c248257e.js +0 -1
  590. package/app/.next/static/chunks/app/api/translator/send/route-24023a32c248257e.js +0 -1
  591. package/app/.next/static/chunks/app/api/translator/translate/route-24023a32c248257e.js +0 -1
  592. package/app/.next/static/chunks/app/api/tunnel/disable/route-24023a32c248257e.js +0 -1
  593. package/app/.next/static/chunks/app/api/tunnel/enable/route-24023a32c248257e.js +0 -1
  594. package/app/.next/static/chunks/app/api/tunnel/status/route-24023a32c248257e.js +0 -1
  595. package/app/.next/static/chunks/app/api/tunnel/tailscale-check/route-24023a32c248257e.js +0 -1
  596. package/app/.next/static/chunks/app/api/tunnel/tailscale-disable/route-24023a32c248257e.js +0 -1
  597. package/app/.next/static/chunks/app/api/tunnel/tailscale-enable/route-24023a32c248257e.js +0 -1
  598. package/app/.next/static/chunks/app/api/tunnel/tailscale-install/route-24023a32c248257e.js +0 -1
  599. package/app/.next/static/chunks/app/api/tunnel/tailscale-login/route-24023a32c248257e.js +0 -1
  600. package/app/.next/static/chunks/app/api/tunnel/tailscale-start-daemon/route-24023a32c248257e.js +0 -1
  601. package/app/.next/static/chunks/app/api/usage/[connectionId]/route-24023a32c248257e.js +0 -1
  602. package/app/.next/static/chunks/app/api/usage/api-keys/route-24023a32c248257e.js +0 -1
  603. package/app/.next/static/chunks/app/api/usage/chart/route-24023a32c248257e.js +0 -1
  604. package/app/.next/static/chunks/app/api/usage/history/route-24023a32c248257e.js +0 -1
  605. package/app/.next/static/chunks/app/api/usage/logs/route-24023a32c248257e.js +0 -1
  606. package/app/.next/static/chunks/app/api/usage/providers/route-24023a32c248257e.js +0 -1
  607. package/app/.next/static/chunks/app/api/usage/request-details/route-24023a32c248257e.js +0 -1
  608. package/app/.next/static/chunks/app/api/usage/request-logs/route-24023a32c248257e.js +0 -1
  609. package/app/.next/static/chunks/app/api/usage/stats/route-24023a32c248257e.js +0 -1
  610. package/app/.next/static/chunks/app/api/usage/stream/route-24023a32c248257e.js +0 -1
  611. package/app/.next/static/chunks/app/api/users/[id]/route-24023a32c248257e.js +0 -1
  612. package/app/.next/static/chunks/app/api/users/route-24023a32c248257e.js +0 -1
  613. package/app/.next/static/chunks/app/api/v1/api/chat/route-24023a32c248257e.js +0 -1
  614. package/app/.next/static/chunks/app/api/v1/audio/speech/route-24023a32c248257e.js +0 -1
  615. package/app/.next/static/chunks/app/api/v1/chat/completions/route-24023a32c248257e.js +0 -1
  616. package/app/.next/static/chunks/app/api/v1/embeddings/route-24023a32c248257e.js +0 -1
  617. package/app/.next/static/chunks/app/api/v1/images/generations/route-24023a32c248257e.js +0 -1
  618. package/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-24023a32c248257e.js +0 -1
  619. package/app/.next/static/chunks/app/api/v1/messages/route-24023a32c248257e.js +0 -1
  620. package/app/.next/static/chunks/app/api/v1/models/route-24023a32c248257e.js +0 -1
  621. package/app/.next/static/chunks/app/api/v1/responses/compact/route-24023a32c248257e.js +0 -1
  622. package/app/.next/static/chunks/app/api/v1/responses/route-24023a32c248257e.js +0 -1
  623. package/app/.next/static/chunks/app/api/v1/route-24023a32c248257e.js +0 -1
  624. package/app/.next/static/chunks/app/api/v1/search/route-24023a32c248257e.js +0 -1
  625. package/app/.next/static/chunks/app/api/v1/web/fetch/route-24023a32c248257e.js +0 -1
  626. package/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-24023a32c248257e.js +0 -1
  627. package/app/.next/static/chunks/app/api/v1beta/models/route-24023a32c248257e.js +0 -1
  628. package/app/.next/static/chunks/app/api/version/route-24023a32c248257e.js +0 -1
  629. package/app/.next/static/chunks/app/api/version/update/route-24023a32c248257e.js +0 -1
  630. package/app/.next/static/chunks/app/dashboard/settings/pricing/page-5744fe42b927e4e1.js +0 -1
  631. package/app/.next/static/chunks/app/login/page-f8fd97681568bf8f.js +0 -1
  632. package/app/.next/static/chunks/app/manifest.webmanifest/route-24023a32c248257e.js +0 -1
  633. package/app/.next/static/chunks/app/page-24023a32c248257e.js +0 -1
  634. package/app/.next/static/chunks/next/dist/client/components/builtin/app-error-24023a32c248257e.js +0 -1
  635. package/app/.next/static/chunks/next/dist/client/components/builtin/forbidden-24023a32c248257e.js +0 -1
  636. package/app/.next/static/chunks/next/dist/client/components/builtin/not-found-24023a32c248257e.js +0 -1
  637. package/app/.next/static/chunks/next/dist/client/components/builtin/unauthorized-24023a32c248257e.js +0 -1
  638. package/app/.next/static/css/733bbed45c0f373c.css +0 -1
  639. package/app/.next/static/kSw7ik2y0Lphlofn8QbuF/_buildManifest.js +0 -1
  640. /package/app/.next/static/{kSw7ik2y0Lphlofn8QbuF → NtU3O4mCJYjlmlBWGF7gX}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- exports.id=1263,exports.ids=[1263],exports.modules={4501:(a,b,c)=>{Promise.resolve().then(c.bind(c,43173))},14229:(a,b,c)=>{Promise.resolve().then(c.bind(c,51747))},43173:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412),i=c(50377);let j=[{icon:"public",title:"Access Anywhere",desc:"Use your API from any network"},{icon:"group",title:"Share Endpoint",desc:"Share URL with team members"},{icon:"code",title:"Use in Cursor/Cline",desc:"Connect AI tools remotely"},{icon:"lock",title:"Encrypted",desc:"End-to-end TLS via Cloudflare"}];function k({machineId:a}){let[b,c]=(0,e.useState)([]),[f,g]=(0,e.useState)(!0),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(""),[t,u]=(0,e.useState)(null),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(!0),[z,A]=(0,e.useState)(!0),[B,C]=(0,e.useState)(!1),[D,E]=(0,e.useState)(!0),[F,G]=(0,e.useState)(!0),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(""),[L,M]=(0,e.useState)(""),[N,O]=(0,e.useState)(!1),[P,Q]=(0,e.useState)(""),[R,S]=(0,e.useState)(null),[T,U]=(0,e.useState)(!1),[V,W]=(0,e.useState)(!1),[X,Y]=(0,e.useState)(!1),[Z,$]=(0,e.useState)(""),[_,aa]=(0,e.useState)(!1),[ab,ac]=(0,e.useState)(""),[ad,ae]=(0,e.useState)(null),[af,ag]=(0,e.useState)(null),[ah,ai]=(0,e.useState)(!1),[aj,ak]=(0,e.useState)([]),[al,am]=(0,e.useState)(""),[an,ao]=(0,e.useState)(!1),[ap,aq]=(0,e.useState)(!1),[ar,as]=(0,e.useState)(!1),at=(0,e.useRef)(null),[au,av]=(0,e.useState)(new Set),{copied:aw,copy:ax}=(0,i.C)(),ay=async a=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tunnelDashboardAccess:a})})).ok&&C(a)}catch(a){console.log("Error updating tunnelDashboardAccess:",a)}},az=async a=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireApiKey:a})})).ok&&w(a)}catch(a){console.log("Error updating requireApiKey:",a)}},aA=async a=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({rtkEnabled:a})})).ok&&E(a)}catch(a){console.log("Error updating rtkEnabled:",a)}},aB=async()=>{try{let a=await fetch("/api/keys"),b=await a.json();a.ok&&c(b.keys||[])}catch(a){console.log("Error fetching data:",a)}finally{g(!1)}},aC=async a=>{O(!0),Q("Waiting for tunnel ready...");let b=`${a}/api/health`,c=Date.now();for(;Date.now()-c<3e5;){await new Promise(a=>setTimeout(a,2e3));try{let a=await fetch(b,{mode:"no-cors",cache:"no-store"});if(a.ok||"opaque"===a.type)return I(!0),O(!1),Q(""),!0}catch{}if((Date.now()-c)%1e4<2e3)try{let a=await fetch("/api/tunnel/status");if(a.ok){let b=await a.json();if(!b.tunnel?.enabled)return S({type:"error",message:"Tunnel process stopped unexpectedly."}),O(!1),Q(""),!1}}catch{}}return S({type:"error",message:"Tunnel created but not reachable. Please try again."}),O(!1),Q(""),!1},aD=async()=>{U(!1),O(!0),S(null),Q("Creating tunnel...");let a=!0;(async()=>{for(;a;){try{let b=await fetch("/api/tunnel/status");if(b.ok){let c=await b.json();c.download?.downloading?Q(`Downloading cloudflared... ${c.download.progress}%`):a&&Q("Creating tunnel...")}}catch{}await new Promise(a=>setTimeout(a,1e3))}})();try{let b=await fetch("/api/tunnel/enable",{method:"POST"});a=!1;let c=await b.json();if(!b.ok)return void S({type:"error",message:c.error||"Failed to enable tunnel"});let d=c.publicUrl||c.tunnelUrl;if(!d)return void S({type:"error",message:"No tunnel URL returned"});K(c.tunnelUrl||""),M(c.publicUrl||""),await aC(d)}catch(a){S({type:"error",message:a.message})}finally{a=!1,O(!1),Q("")}},aE=async()=>{O(!0),S(null);try{let a=await fetch("/api/tunnel/disable",{method:"POST"}),b=await a.json();a.ok?(I(!1),K(""),M(""),W(!1),S({type:"success",message:"Tunnel disabled"})):S({type:"error",message:b.error||"Failed to disable tunnel"})}catch(a){S({type:"error",message:a.message})}finally{O(!1)}},aF=async()=>{ag(null);try{let a=await fetch("/api/tunnel/tailscale-check");if(a.ok){let b=await a.json();return ag(b.installed),b}}catch{}return ag(!1),{installed:!1}},aG=async()=>{ai(!0),ae(null),ak([]);try{let a=await fetch("/api/tunnel/tailscale-install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:al})});am("");let b=a.body.getReader(),c=new TextDecoder,d="";for(;;){let{done:a,value:e}=await b.read();if(a)break;let f=(d+=c.decode(e,{stream:!0})).split("\n\n");for(let a of(d=f.pop()||"",f)){let b=a.split("\n"),c="progress",d=null;for(let a of b)if(a.startsWith("event: ")&&(c=a.slice(7).trim()),a.startsWith("data: "))try{d=JSON.parse(a.slice(6))}catch{}if(d)if("progress"===c)ak(a=>[...a.slice(-50),d.message]);else if("done"===c){ag(!0),ai(!1);return}else"error"===c&&ae({type:"error",message:d.error||"Install failed"})}}}catch(a){ae({type:"error",message:a.message})}finally{ai(!1)}},aH=async a=>{ac("Waiting for Tailscale ready...");let b=`${a}/api/health`,c=Date.now();for(;Date.now()-c<3e5;){await new Promise(a=>setTimeout(a,2e3));try{let a=await fetch(b,{mode:"no-cors",cache:"no-store"});if(a.ok||"opaque"===a.type)return!0}catch{}}return!1},aI=async a=>{let b=a||null;aq(!1),ao(!0),aa(!0),ae(null),ac("Connecting...");try{let a=await fetch("/api/tunnel/tailscale-enable",{method:"POST"}),c=await a.json();if(a.ok&&c.success){b&&b.close(),$(c.tunnelUrl||""),await aH(c.tunnelUrl)?(Y(!0),ae(null)):(Y(!0),ae({type:"warning",message:"Connected but not reachable yet."}));return}if(c.needsLogin&&c.authUrl){b?b.location.href=c.authUrl:window.open(c.authUrl,"tailscale_auth","width=600,height=700"),ac("Waiting for login...");for(let a=0;a<40;a++){await new Promise(a=>setTimeout(a,3e3));try{let a=await fetch("/api/tunnel/tailscale-check");if(a.ok&&(await a.json()).loggedIn){ac("Starting funnel...");let a=await fetch("/api/tunnel/tailscale-enable",{method:"POST"}),c=await a.json();a.ok&&c.success?(b&&b.close(),$(c.tunnelUrl||""),await aH(c.tunnelUrl)?(Y(!0),ae(null)):(Y(!0),ae({type:"warning",message:"Connected but not reachable yet."}))):c.funnelNotEnabled&&c.enableUrl?await aJ(c.enableUrl,b):ae({type:"error",message:c.error||"Failed to start funnel"});return}}catch{}}ae({type:"error",message:"Login timed out. Please try again."});return}if(c.funnelNotEnabled&&c.enableUrl)return void await aJ(c.enableUrl,b);b&&b.close(),ae({type:"error",message:c.error||"Failed to connect"})}catch(a){b&&b.close(),ae({type:"error",message:a.message})}finally{aa(!1),ao(!1),ac("")}},aJ=async(a,b)=>{b?b.location.href=a:window.open(a,"tailscale_auth","width=600,height=700"),ac("Enable Funnel in browser, waiting...");for(let a=0;a<40;a++){await new Promise(a=>setTimeout(a,3e3));try{let a=await fetch("/api/tunnel/tailscale-enable",{method:"POST"}),c=await a.json();if(a.ok&&c.success){b&&b.close(),$(c.tunnelUrl||""),await aH(c.tunnelUrl)?(Y(!0),ae(null)):(Y(!0),ae({type:"warning",message:"Connected but not reachable yet."}));return}if(c.funnelNotEnabled)continue;if(c.error)return void ae({type:"error",message:c.error})}catch{}}ae({type:"error",message:"Timed out waiting for Funnel to be enabled."})},aK=async()=>{aa(!0),ae(null);try{let a=await fetch("/api/tunnel/tailscale-disable",{method:"POST"}),b=await a.json();a.ok?(Y(!1),$(""),as(!1),ae({type:"success",message:"Tailscale disabled"})):ae({type:"error",message:b.error||"Failed to disable Tailscale"})}catch(a){ae({type:"error",message:a.message})}finally{aa(!1)}},aL=async()=>{ae(null),ak([]),aq(!0),await aF()},aM=async()=>{if(r.trim())try{let a=await fetch("/api/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r})}),b=await a.json();a.ok&&(u(b.key),await aB(),s(""),q(!1))}catch(a){console.log("Error creating key:",a)}},aN=async a=>{if(confirm("Delete this API key?"))try{(await fetch(`/api/keys/${a}`,{method:"DELETE"})).ok&&(c(b.filter(b=>b.id!==a)),av(b=>{let c=new Set(b);return c.delete(a),c}))}catch(a){console.log("Error deleting key:",a)}},aO=async(a,b)=>{try{(await fetch(`/api/keys/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:b})})).ok&&c(c=>c.map(c=>c.id===a?{...c,isActive:b}:c))}catch(a){console.log("Error toggling key:",a)}},[aP,aQ]=(0,e.useState)("/v1");return f?(0,d.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,d.jsx)(h.Qv,{}),(0,d.jsx)(h.Qv,{})]}):(0,d.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,d.jsxs)(h.Zp,{children:[(0,d.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"API Endpoint"}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsx)(l,{label:"Local",url:aP,copyId:"local_url",copied:aw,onCopy:ax}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`text-xs font-mono px-1.5 py-0.5 rounded shrink-0 min-w-[68px] text-center ${H?"bg-orange-100 dark:bg-orange-900/30 text-orange-600 dark:text-orange-400":"bg-sidebar text-text-muted"}`,children:"Tunnel"}),H&&!N?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.pd,{value:`${L||J}/v1`,readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,d.jsx)("button",{onClick:()=>ax(`${L||J}/v1`,"tunnel_url"),className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary transition-colors shrink-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"tunnel_url"===aw?"check":"content_copy"})}),(0,d.jsx)("button",{onClick:()=>W(!0),className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Disable Tunnel",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):N?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-border bg-input text-sm text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),P||"Creating tunnel..."]}),(0,d.jsx)("button",{onClick:()=>{O(!1),Q("")},className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Stop",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):R?.type==="error"?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-red-300 dark:border-red-800 bg-red-500/5 text-sm text-red-600 dark:text-red-400",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"error"}),R.message]}),(0,d.jsx)(h.$n,{size:"sm",icon:"cloud_upload",onClick:()=>U(!0),children:"Enable"})]}):F?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-border bg-input text-sm text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"Checking..."]}),(0,d.jsx)("button",{onClick:()=>G(!1),className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Stop",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):(0,d.jsx)(h.$n,{size:"sm",icon:"cloud_upload",onClick:()=>{v?U(!0):S({type:"error",message:'Security required: Enable "Require API key" before activating the tunnel.'})},className:"bg-linear-to-r from-primary to-blue-500 hover:from-primary-hover hover:to-blue-600 text-white!",children:"Enable"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`text-xs font-mono px-1.5 py-0.5 rounded shrink-0 min-w-[68px] text-center ${X?"bg-purple-100 dark:bg-purple-900/30 text-purple-600 dark:text-purple-400":"bg-sidebar text-text-muted"}`,children:"Tailscale"}),X&&!_?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.pd,{value:`${Z}/v1`,readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,d.jsx)("button",{onClick:()=>ax(`${Z}/v1`,"ts_url"),className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary transition-colors shrink-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"ts_url"===aw?"check":"content_copy"})}),(0,d.jsx)("button",{onClick:()=>as(!0),className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Disable Tailscale",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):_||an?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-border bg-input text-sm text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),ab||"Connecting..."]}),(0,d.jsx)("button",{onClick:()=>{aa(!1),ao(!1),ac("")},className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Stop",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):ad?.type==="error"?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-red-300 dark:border-red-800 bg-red-500/5 text-sm text-red-600 dark:text-red-400",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"error"}),ad.message]}),(0,d.jsx)(h.$n,{size:"sm",icon:"vpn_lock",onClick:aL,children:"Enable"})]}):(0,d.jsx)(h.$n,{size:"sm",icon:"vpn_lock",onClick:aL,className:"bg-linear-to-r from-indigo-500 to-purple-500 hover:from-indigo-600 hover:to-purple-600 text-white!",children:"Enable"})]})]}),(H||X)&&(0,d.jsxs)("div",{className:"mt-4 flex flex-col gap-2",children:[!v&&(0,d.jsx)(o,{message:"Require API key is disabled — your endpoint is publicly accessible without authentication.",action:{label:"Enable",href:"#require-api-key"}}),(!x||!z)&&(0,d.jsx)(o,{message:x?"Dashboard uses the default password — change it in Profile settings.":"Require login is disabled — anyone can access your dashboard via tunnel.",action:{label:x?"Change password":"Enable",href:"/dashboard/profile"}})]}),(H||X)&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex items-center gap-3",children:[(0,d.jsx)(h.lM,{checked:B,onChange:()=>ay(!B)}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("p",{className:"font-medium text-sm",children:"Allow dashboard access via tunnel"}),(0,d.jsx)(n,{text:"When enabled, the dashboard can be accessed through your tunnel or Tailscale URL (login still required). When disabled, dashboard access via tunnel/Tailscale is completely blocked."})]})]})]}),(0,d.jsxs)(h.Zp,{id:"rtk",children:[(0,d.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,d.jsx)("h2",{className:"text-lg font-semibold",children:"Token Saver"})}),(0,d.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,d.jsxs)("div",{className:"pr-4",children:[(0,d.jsx)("p",{className:"font-medium",children:"Compress tool output"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Auto-compress tool output (git diff/grep/ls/tree/logs) before sending to LLM to save tokens. Disable if you see issues."})]}),(0,d.jsx)(h.lM,{checked:D,onChange:()=>aA(!D)})]})]}),(0,d.jsxs)(h.Zp,{id:"require-api-key",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold",children:"API Keys"}),(0,d.jsx)(h.$n,{icon:"add",onClick:()=>q(!0),children:"Create Key"})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between pb-4 mb-4 border-b border-border",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium",children:"Require API key"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Requests without a valid key will be rejected"})]}),(0,d.jsx)(h.lM,{checked:v,onChange:()=>az(!v)})]}),0===b.length?(0,d.jsxs)("div",{className:"text-center py-12",children:[(0,d.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"vpn_key"})}),(0,d.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No API keys yet"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Create your first API key to get started"}),(0,d.jsx)(h.$n,{icon:"add",onClick:()=>q(!0),children:"Create Key"})]}):(0,d.jsx)("div",{className:"flex flex-col",children:b.map(a=>{var b;return(0,d.jsxs)("div",{className:`group flex items-center justify-between py-3 border-b border-black/[0.03] dark:border-white/[0.03] last:border-b-0 ${!1===a.isActive?"opacity-60":""}`,children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:a.name}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,d.jsx)("code",{className:"text-xs text-text-muted font-mono",children:au.has(a.id)?a.key:(b=a.key)?b.length>8?b.slice(0,8)+"...":b:""}),(0,d.jsx)("button",{onClick:()=>{var b;return b=a.id,void av(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary opacity-0 group-hover:opacity-100 transition-all",title:au.has(a.id)?"Hide key":"Show key",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:au.has(a.id)?"visibility_off":"visibility"})}),(0,d.jsx)("button",{onClick:()=>ax(a.key,a.id),className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary opacity-0 group-hover:opacity-100 transition-all",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:aw===a.id?"check":"content_copy"})})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Created ",new Date(a.createdAt).toLocaleDateString()]}),!1===a.isActive&&(0,d.jsx)("p",{className:"text-xs text-orange-500 mt-1",children:"Paused"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(h.lM,{size:"sm",checked:a.isActive??!0,onChange:b=>{a.isActive&&!b?confirm(`Pause API key "${a.name}"?
1
+ exports.id=1263,exports.ids=[1263],exports.modules={4501:(a,b,c)=>{Promise.resolve().then(c.bind(c,43173))},14229:(a,b,c)=>{Promise.resolve().then(c.bind(c,51747))},43173:(a,b,c)=>{"use strict";c.d(b,{default:()=>l});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412),i=c(50377);let j=[{icon:"public",title:"Access Anywhere",desc:"Use your API from any network"},{icon:"group",title:"Share Endpoint",desc:"Share URL with team members"},{icon:"code",title:"Use in Cursor/Cline",desc:"Connect AI tools remotely"},{icon:"lock",title:"Encrypted",desc:"End-to-end TLS via Cloudflare"}],k=[{id:"lite",label:"Lite",desc:"Drop filler, keep grammar"},{id:"full",label:"Full",desc:"Drop articles, fragments OK"},{id:"ultra",label:"Ultra",desc:"Telegraphic, max compression"}];function l({machineId:a}){let[b,c]=(0,e.useState)([]),[f,g]=(0,e.useState)(!0),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(""),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(!0),[A,B]=(0,e.useState)(!0),[C,D]=(0,e.useState)(!1),[E,F]=(0,e.useState)(!0),[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)("full"),[K,L]=(0,e.useState)(!0),[M,N]=(0,e.useState)(!1),[O,P]=(0,e.useState)(""),[Q,R]=(0,e.useState)(""),[S,T]=(0,e.useState)(!1),[U,V]=(0,e.useState)(""),[W,X]=(0,e.useState)(null),[Y,Z]=(0,e.useState)(!1),[$,_]=(0,e.useState)(!1),[aa,ab]=(0,e.useState)(!1),[ac,ad]=(0,e.useState)(""),[ae,af]=(0,e.useState)(!1),[ag,ah]=(0,e.useState)(""),[ai,aj]=(0,e.useState)(null),[ak,al]=(0,e.useState)(null),[am,an]=(0,e.useState)(!1),[ao,ap]=(0,e.useState)([]),[aq,ar]=(0,e.useState)(""),[as,at]=(0,e.useState)(!1),[au,av]=(0,e.useState)(!1),[aw,ax]=(0,e.useState)(!1),ay=(0,e.useRef)(null),[az,aA]=(0,e.useState)(new Set),{copied:aB,copy:aC}=(0,i.C)(),aD=async a=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tunnelDashboardAccess:a})})).ok&&D(a)}catch(a){console.log("Error updating tunnelDashboardAccess:",a)}},aE=async a=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireApiKey:a})})).ok&&x(a)}catch(a){console.log("Error updating requireApiKey:",a)}},aF=async a=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({rtkEnabled:a})})).ok&&F(a)}catch(a){console.log("Error updating rtkEnabled:",a)}},aG=async a=>{try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})}catch(a){console.log("Error updating setting:",a)}},aH=async()=>{try{let a=await fetch("/api/keys"),b=await a.json();a.ok&&c(b.keys||[])}catch(a){console.log("Error fetching data:",a)}finally{g(!1)}},aI=async a=>{T(!0),V("Waiting for tunnel ready...");let b=`${a}/api/health`,c=Date.now();for(;Date.now()-c<3e5;){await new Promise(a=>setTimeout(a,2e3));try{let a=await fetch(b,{mode:"no-cors",cache:"no-store"});if(a.ok||"opaque"===a.type)return N(!0),T(!1),V(""),!0}catch{}if((Date.now()-c)%1e4<2e3)try{let a=await fetch("/api/tunnel/status");if(a.ok){let b=await a.json();if(!b.tunnel?.enabled)return X({type:"error",message:"Tunnel process stopped unexpectedly."}),T(!1),V(""),!1}}catch{}}return X({type:"error",message:"Tunnel created but not reachable. Please try again."}),T(!1),V(""),!1},aJ=async()=>{Z(!1),T(!0),X(null),V("Creating tunnel...");let a=!0;(async()=>{for(;a;){try{let b=await fetch("/api/tunnel/status");if(b.ok){let c=await b.json();c.download?.downloading?V(`Downloading cloudflared... ${c.download.progress}%`):a&&V("Creating tunnel...")}}catch{}await new Promise(a=>setTimeout(a,1e3))}})();try{let b=await fetch("/api/tunnel/enable",{method:"POST"});a=!1;let c=await b.json();if(!b.ok)return void X({type:"error",message:c.error||"Failed to enable tunnel"});let d=c.publicUrl||c.tunnelUrl;if(!d)return void X({type:"error",message:"No tunnel URL returned"});P(c.tunnelUrl||""),R(c.publicUrl||""),await aI(d)}catch(a){X({type:"error",message:a.message})}finally{a=!1,T(!1),V("")}},aK=async()=>{T(!0),X(null);try{let a=await fetch("/api/tunnel/disable",{method:"POST"}),b=await a.json();a.ok?(N(!1),P(""),R(""),_(!1),X({type:"success",message:"Tunnel disabled"})):X({type:"error",message:b.error||"Failed to disable tunnel"})}catch(a){X({type:"error",message:a.message})}finally{T(!1)}},aL=async()=>{al(null);try{let a=await fetch("/api/tunnel/tailscale-check");if(a.ok){let b=await a.json();return al(b.installed),b}}catch{}return al(!1),{installed:!1}},aM=async()=>{an(!0),aj(null),ap([]);try{let a=await fetch("/api/tunnel/tailscale-install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:aq})});ar("");let b=a.body.getReader(),c=new TextDecoder,d="";for(;;){let{done:a,value:e}=await b.read();if(a)break;let f=(d+=c.decode(e,{stream:!0})).split("\n\n");for(let a of(d=f.pop()||"",f)){let b=a.split("\n"),c="progress",d=null;for(let a of b)if(a.startsWith("event: ")&&(c=a.slice(7).trim()),a.startsWith("data: "))try{d=JSON.parse(a.slice(6))}catch{}if(d)if("progress"===c)ap(a=>[...a.slice(-50),d.message]);else if("done"===c){al(!0),an(!1);return}else"error"===c&&aj({type:"error",message:d.error||"Install failed"})}}}catch(a){aj({type:"error",message:a.message})}finally{an(!1)}},aN=async a=>{ah("Waiting for Tailscale ready...");let b=`${a}/api/health`,c=Date.now();for(;Date.now()-c<3e5;){await new Promise(a=>setTimeout(a,2e3));try{let a=await fetch(b,{mode:"no-cors",cache:"no-store"});if(a.ok||"opaque"===a.type)return!0}catch{}}return!1},aO=async a=>{let b=a||null;av(!1),at(!0),af(!0),aj(null),ah("Connecting...");try{let a=await fetch("/api/tunnel/tailscale-enable",{method:"POST"}),c=await a.json();if(a.ok&&c.success){b&&b.close(),ad(c.tunnelUrl||""),await aN(c.tunnelUrl)?(ab(!0),aj(null)):(ab(!0),aj({type:"warning",message:"Connected but not reachable yet."}));return}if(c.needsLogin&&c.authUrl){b?b.location.href=c.authUrl:window.open(c.authUrl,"tailscale_auth","width=600,height=700"),ah("Waiting for login...");for(let a=0;a<40;a++){await new Promise(a=>setTimeout(a,3e3));try{let a=await fetch("/api/tunnel/tailscale-check");if(a.ok&&(await a.json()).loggedIn){ah("Starting funnel...");let a=await fetch("/api/tunnel/tailscale-enable",{method:"POST"}),c=await a.json();a.ok&&c.success?(b&&b.close(),ad(c.tunnelUrl||""),await aN(c.tunnelUrl)?(ab(!0),aj(null)):(ab(!0),aj({type:"warning",message:"Connected but not reachable yet."}))):c.funnelNotEnabled&&c.enableUrl?await aP(c.enableUrl,b):aj({type:"error",message:c.error||"Failed to start funnel"});return}}catch{}}aj({type:"error",message:"Login timed out. Please try again."});return}if(c.funnelNotEnabled&&c.enableUrl)return void await aP(c.enableUrl,b);b&&b.close(),aj({type:"error",message:c.error||"Failed to connect"})}catch(a){b&&b.close(),aj({type:"error",message:a.message})}finally{af(!1),at(!1),ah("")}},aP=async(a,b)=>{b?b.location.href=a:window.open(a,"tailscale_auth","width=600,height=700"),ah("Enable Funnel in browser, waiting...");for(let a=0;a<40;a++){await new Promise(a=>setTimeout(a,3e3));try{let a=await fetch("/api/tunnel/tailscale-enable",{method:"POST"}),c=await a.json();if(a.ok&&c.success){b&&b.close(),ad(c.tunnelUrl||""),await aN(c.tunnelUrl)?(ab(!0),aj(null)):(ab(!0),aj({type:"warning",message:"Connected but not reachable yet."}));return}if(c.funnelNotEnabled)continue;if(c.error)return void aj({type:"error",message:c.error})}catch{}}aj({type:"error",message:"Timed out waiting for Funnel to be enabled."})},aQ=async()=>{af(!0),aj(null);try{let a=await fetch("/api/tunnel/tailscale-disable",{method:"POST"}),b=await a.json();a.ok?(ab(!1),ad(""),ax(!1),aj({type:"success",message:"Tailscale disabled"})):aj({type:"error",message:b.error||"Failed to disable Tailscale"})}catch(a){aj({type:"error",message:a.message})}finally{af(!1)}},aR=async()=>{aj(null),ap([]),av(!0),await aL()},aS=async()=>{if(s.trim())try{let a=await fetch("/api/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s})}),b=await a.json();a.ok&&(v(b.key),await aH(),t(""),r(!1))}catch(a){console.log("Error creating key:",a)}},aT=async a=>{if(confirm("Delete this API key?"))try{(await fetch(`/api/keys/${a}`,{method:"DELETE"})).ok&&(c(b.filter(b=>b.id!==a)),aA(b=>{let c=new Set(b);return c.delete(a),c}))}catch(a){console.log("Error deleting key:",a)}},aU=async(a,b)=>{try{(await fetch(`/api/keys/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:b})})).ok&&c(c=>c.map(c=>c.id===a?{...c,isActive:b}:c))}catch(a){console.log("Error toggling key:",a)}},[aV,aW]=(0,e.useState)("/v1");return f?(0,d.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,d.jsx)(h.Qv,{}),(0,d.jsx)(h.Qv,{})]}):(0,d.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,d.jsxs)(h.Zp,{children:[(0,d.jsxs)("h2",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary",children:"api"}),"API Endpoint"]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsx)(m,{label:"Local",url:aV,copyId:"local_url",copied:aB,onCopy:aC}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`text-xs font-mono px-1.5 py-0.5 rounded shrink-0 min-w-[88px] text-center ${M?"bg-primary/10 text-primary":"bg-surface-2 text-text-muted"}`,children:"Tunnel"}),M&&!S?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.pd,{value:`${Q||O}/v1`,readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,d.jsx)("button",{onClick:()=>aC(`${Q||O}/v1`,"tunnel_url"),className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary transition-colors shrink-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"tunnel_url"===aB?"check":"content_copy"})}),(0,d.jsx)("button",{onClick:()=>_(!0),className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Disable Tunnel",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):S?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-border bg-input text-sm text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),U||"Creating tunnel..."]}),(0,d.jsx)("button",{onClick:()=>{T(!1),V("")},className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Stop",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):W?.type==="error"?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-red-300 dark:border-red-800 bg-red-500/5 text-sm text-red-600 dark:text-red-400",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"error"}),W.message]}),(0,d.jsx)(h.$n,{size:"sm",icon:"cloud_upload",onClick:()=>Z(!0),children:"Enable"})]}):K?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-border bg-input text-sm text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"Checking..."]}),(0,d.jsx)("button",{onClick:()=>L(!1),className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Stop",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):(0,d.jsx)(h.$n,{size:"sm",icon:"cloud_upload",onClick:()=>{w?Z(!0):X({type:"error",message:'Security required: Enable "Require API key" before activating the tunnel.'})},children:"Enable"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`text-xs font-mono px-1.5 py-0.5 rounded shrink-0 min-w-[88px] text-center ${aa?"bg-primary/10 text-primary":"bg-surface-2 text-text-muted"}`,children:"Tailscale"}),aa&&!ae?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.pd,{value:`${ac}/v1`,readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,d.jsx)("button",{onClick:()=>aC(`${ac}/v1`,"ts_url"),className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary transition-colors shrink-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"ts_url"===aB?"check":"content_copy"})}),(0,d.jsx)("button",{onClick:()=>ax(!0),className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Disable Tailscale",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):ae||as?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-border bg-input text-sm text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),ag||"Connecting..."]}),(0,d.jsx)("button",{onClick:()=>{af(!1),at(!1),ah("")},className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Stop",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):ai?.type==="error"?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-red-300 dark:border-red-800 bg-red-500/5 text-sm text-red-600 dark:text-red-400",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"error"}),ai.message]}),(0,d.jsx)(h.$n,{size:"sm",icon:"vpn_lock",onClick:aR,children:"Enable"})]}):(0,d.jsx)(h.$n,{size:"sm",icon:"vpn_lock",onClick:aR,className:"bg-linear-to-r from-indigo-500 to-purple-500 hover:from-indigo-600 hover:to-purple-600 text-white!",children:"Enable"})]})]}),(M||aa)&&(0,d.jsxs)("div",{className:"mt-4 flex flex-col gap-2",children:[!w&&(0,d.jsx)(p,{message:"Require API key is disabled — your endpoint is publicly accessible without authentication.",action:{label:"Enable",href:"#require-api-key"}}),(!y||!A)&&(0,d.jsx)(p,{message:y?"Dashboard uses the default password — change it in Profile settings.":"Require login is disabled — anyone can access your dashboard via tunnel.",action:{label:y?"Change password":"Enable",href:"/dashboard/profile"}})]}),(M||aa)&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex items-center gap-3",children:[(0,d.jsx)(h.lM,{checked:C,onChange:()=>aD(!C)}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("p",{className:"font-medium text-sm",children:"Allow dashboard access via tunnel"}),(0,d.jsx)(o,{text:"When enabled, the dashboard can be accessed through your tunnel or Tailscale URL (login still required). When disabled, dashboard access via tunnel/Tailscale is completely blocked."})]})]})]}),(0,d.jsxs)(h.Zp,{id:"rtk",children:[(0,d.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,d.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary",children:"bolt"}),"Token Saver"]})}),(0,d.jsxs)("div",{className:"flex items-center justify-between pt-2 pb-4 border-b border-border gap-4",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("p",{className:"font-medium",children:["Compress tool output"," ",(0,d.jsx)("a",{href:"https://github.com/rtk-ai/rtk",target:"_blank",rel:"noreferrer",className:"text-xs font-normal text-primary underline hover:opacity-80",children:"(RTK)"})]}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"git/grep/ls/tree/logs → 60-90% fewer input tokens"})]}),(0,d.jsx)(h.lM,{checked:E,onChange:()=>aF(!E)})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between pt-4 gap-4 flex-wrap",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("p",{className:"font-medium",children:["Compress LLM output"," ",(0,d.jsx)("a",{href:"https://github.com/JuliusBrussee/caveman",target:"_blank",rel:"noreferrer",className:"text-xs font-normal text-primary underline hover:opacity-80",children:"(Caveman)"})]}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Terse-style system prompt → ~65% fewer output tokens (up to 87%)"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[G&&(0,d.jsx)("div",{className:"flex items-center gap-1.5",children:k.map(a=>(0,d.jsx)("button",{onClick:()=>{var b;J(b=a.id),aG({cavemanLevel:b})},className:`px-3 py-1.5 rounded text-xs font-medium border transition-colors ${I===a.id?"bg-primary text-white border-primary":"bg-transparent border-border text-text-muted hover:bg-surface-2"}`,title:a.desc,children:a.label},a.id))}),(0,d.jsx)(h.lM,{checked:G,onChange:()=>{var a;H(a=!G),aG({cavemanEnabled:a})}})]})]})]}),(0,d.jsxs)(h.Zp,{id:"require-api-key",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary",children:"vpn_key"}),"API Keys"]}),(0,d.jsx)(h.$n,{icon:"add",onClick:()=>r(!0),children:"Create Key"})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between pb-4 mb-4 border-b border-border",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium",children:"Require API key"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Requests without a valid key will be rejected"})]}),(0,d.jsx)(h.lM,{checked:w,onChange:()=>aE(!w)})]}),0===b.length?(0,d.jsxs)("div",{className:"text-center py-12",children:[(0,d.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"vpn_key"})}),(0,d.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No API keys yet"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Create your first API key to get started"}),(0,d.jsx)(h.$n,{icon:"add",onClick:()=>r(!0),children:"Create Key"})]}):(0,d.jsx)("div",{className:"flex flex-col",children:b.map(a=>{var b;return(0,d.jsxs)("div",{className:`group flex items-center justify-between py-3 border-b border-black/[0.03] dark:border-white/[0.03] last:border-b-0 ${!1===a.isActive?"opacity-60":""}`,children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:a.name}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,d.jsx)("code",{className:"text-xs text-text-muted font-mono",children:az.has(a.id)?a.key:(b=a.key)?b.length>8?b.slice(0,8)+"...":b:""}),(0,d.jsx)("button",{onClick:()=>{var b;return b=a.id,void aA(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary opacity-0 group-hover:opacity-100 transition-all",title:az.has(a.id)?"Hide key":"Show key",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:az.has(a.id)?"visibility_off":"visibility"})}),(0,d.jsx)("button",{onClick:()=>aC(a.key,a.id),className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary opacity-0 group-hover:opacity-100 transition-all",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:aB===a.id?"check":"content_copy"})})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Created ",new Date(a.createdAt).toLocaleDateString()]}),!1===a.isActive&&(0,d.jsx)("p",{className:"text-xs text-orange-500 mt-1",children:"Paused"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(h.lM,{size:"sm",checked:a.isActive??!0,onChange:b=>{a.isActive&&!b?confirm(`Pause API key "${a.name}"?
2
2
 
3
- This key will stop working immediately but can be resumed later.`)&&aO(a.id,b):aO(a.id,b)},title:a.isActive?"Pause key":"Resume key"}),(0,d.jsx)("button",{onClick:()=>aN(a.id),className:"p-2 hover:bg-red-500/10 rounded text-red-500 opacity-0 group-hover:opacity-100 transition-all",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]},a.id)})})]}),(0,d.jsx)(h.aF,{isOpen:p,title:"Create API Key",onClose:()=>{q(!1),s("")},children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(h.pd,{label:"Key Name",value:r,onChange:a=>s(a.target.value),placeholder:"Production Key"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:aM,fullWidth:!0,disabled:!r.trim(),children:"Create"}),(0,d.jsx)(h.$n,{onClick:()=>{q(!1),s("")},variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}),(0,d.jsx)(h.aF,{isOpen:!!t,title:"API Key Created",onClose:()=>u(null),children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[(0,d.jsx)("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 mb-2 font-medium",children:"Save this key now!"}),(0,d.jsx)("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:"This is the only time you will see this key. Store it securely."})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.pd,{value:t||"",readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,d.jsx)(h.$n,{variant:"secondary",icon:"created_key"===aw?"check":"content_copy",onClick:()=>ax(t,"created_key"),children:"created_key"===aw?"Copied!":"Copy"})]}),(0,d.jsx)(h.$n,{onClick:()=>u(null),fullWidth:!0,children:"Done"})]})}),(0,d.jsx)(h.aF,{isOpen:T,title:"Enable Tunnel",onClose:()=>U(!1),children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"cloud_upload"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200 font-medium mb-1",children:"Cloudflare Tunnel"}),(0,d.jsx)("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:"Expose your local 9Router to the internet. No port forwarding, no static IP needed. Share endpoint URL with your team or use it in Cursor, Cline, and other AI tools from anywhere."})]})]})}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-3",children:j.map(a=>(0,d.jsxs)("div",{className:"flex flex-col items-center text-center p-3 rounded-lg bg-sidebar/50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-xl text-primary mb-1",children:a.icon}),(0,d.jsx)("p",{className:"text-xs font-semibold",children:a.title}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:a.desc})]},a.title))}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Requires outbound port 7844 (TCP/UDP). Connection may take 10-30s."}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:aD,fullWidth:!0,className:"bg-linear-to-r from-primary to-blue-500 hover:from-primary-hover hover:to-blue-600 text-white!",children:"Start Tunnel"}),(0,d.jsx)(h.$n,{onClick:()=>U(!1),variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}),(0,d.jsx)(h.aF,{isOpen:V,title:"Disable Tunnel",onClose:()=>!N&&W(!1),children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"The Cloudflare tunnel will be disconnected. Remote access via tunnel URL will stop working."}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:aE,fullWidth:!0,disabled:N,className:"bg-red-500! hover:bg-red-600! text-white!",children:N?"Disabling...":"Disable"}),(0,d.jsx)(h.$n,{onClick:()=>W(!1),variant:"ghost",fullWidth:!0,disabled:N,children:"Cancel"})]})]})}),(0,d.jsx)(h.aF,{isOpen:ap,title:"Tailscale Funnel",onClose:()=>{ah||(aq(!1),am(""),ae(null))},children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[null===af&&(0,d.jsxs)("p",{className:"text-sm text-text-muted flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"Checking..."]}),!1===af&&!ah&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Tailscale is not installed. Install it to enable Funnel."}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:aG,fullWidth:!0,className:"bg-linear-to-r from-indigo-500 to-purple-500 hover:from-indigo-600 hover:to-purple-600 text-white!",children:"Install Tailscale"}),(0,d.jsx)(h.$n,{onClick:()=>aq(!1),variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),ah&&(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"Installing Tailscale..."]}),aj.length>0&&(0,d.jsx)("div",{ref:at,className:"bg-black/5 dark:bg-white/5 rounded p-2 max-h-40 overflow-y-auto font-mono text-xs text-text-muted",children:aj.map((a,b)=>(0,d.jsx)("div",{children:a},b))})]}),!0===af&&!ah&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"check_circle"}),"Tailscale installed"]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:()=>{let a=window.open("","tailscale_auth","width=600,height=700");a&&a.document.write("<p style='font-family:sans-serif;text-align:center;margin-top:40px'>Connecting to Tailscale...</p>"),aI(a)},fullWidth:!0,className:"bg-linear-to-r from-indigo-500 to-purple-500 hover:from-indigo-600 hover:to-purple-600 text-white!",children:"Connect"}),(0,d.jsx)(h.$n,{onClick:()=>aq(!1),variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),ad&&(0,d.jsx)(m,{status:ad})]})}),(0,d.jsx)(h.aF,{isOpen:ar,title:"Disable Tailscale",onClose:()=>!_&&as(!1),children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Tailscale Funnel will be stopped. Remote access via Tailscale URL will stop working."}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:aK,fullWidth:!0,disabled:_,className:"bg-red-500! hover:bg-red-600! text-white!",children:_?"Disabling...":"Disable"}),(0,d.jsx)(h.$n,{onClick:()=>as(!1),variant:"ghost",fullWidth:!0,disabled:_,children:"Cancel"})]})]})})]})}function l({label:a,url:b,copyId:c,copied:e,onCopy:f,badge:g,actions:i}){return(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`text-xs font-mono px-1.5 py-0.5 rounded shrink-0 min-w-[68px] text-center ${"CF"===g?"bg-orange-100 dark:bg-orange-900/30 text-orange-600 dark:text-orange-400":"TS"===g?"bg-purple-100 dark:bg-purple-900/30 text-purple-600 dark:text-purple-400":"bg-sidebar text-text-muted"}`,children:a}),(0,d.jsx)(h.pd,{value:b,readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,d.jsx)("button",{onClick:()=>f(b,c),className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary transition-colors shrink-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:e===c?"check":"content_copy"})}),i]})}function m({status:a,className:b=""}){return(0,d.jsx)("div",{className:`p-2 rounded text-sm ${b} ${"success"===a.type?"bg-green-500/10 text-green-600 dark:text-green-400":"warning"===a.type?"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400":"info"===a.type?"bg-blue-500/10 text-blue-600 dark:text-blue-400":"bg-red-500/10 text-red-600 dark:text-red-400"}`,children:a.message.split(/(https?:\/\/[^\s]+)/g).map((a,b)=>/^https?:\/\//.test(a)?(0,d.jsx)("a",{href:a,target:"_blank",rel:"noreferrer",className:"underline font-medium",children:a},b):a)})}function n({text:a}){return(0,d.jsxs)("span",{className:"relative group inline-flex items-center",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted cursor-help",children:"help"}),(0,d.jsx)("span",{className:"pointer-events-none absolute left-5 top-1/2 -translate-y-1/2 z-50 w-64 rounded bg-gray-900 dark:bg-gray-800 text-white text-xs px-2.5 py-1.5 opacity-0 group-hover:opacity-100 transition-opacity shadow-lg",children:a})]})}function o({message:a,action:b}){return(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-amber-500/10 border border-amber-500/20 text-amber-700 dark:text-amber-400",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] shrink-0 mt-0.5",children:"warning"}),(0,d.jsx)("p",{className:"text-xs flex-1",children:a}),b&&(0,d.jsx)("a",{href:b.href,className:"text-xs font-medium underline shrink-0 hover:opacity-80",onClick:b.href.startsWith("#")?a=>{a.preventDefault(),document.getElementById(b.href.slice(1))?.scrollIntoView({behavior:"smooth"})}:void 0,children:b.label})]})}k.propTypes={machineId:g().string.isRequired}},51747:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/Users/bytedance/Documents/9router/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.js\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/bytedance/Documents/9router/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.js","default")},54603:(a,b,c)=>{"use strict";c.d(b,{Xj:()=>e});var d=c(19713);async function e(a=null){let b=a||process.env.MACHINE_ID_SALT||"endpoint-proxy-salt";try{let a=(0,d.machineIdSync)();return(await Promise.resolve().then(c.t.bind(c,55511,23))).createHash("sha256").update(a+b).digest("hex").substring(0,16)}catch(a){return console.log("Error getting machine ID:",a),crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){let b=16*Math.random()|0;return("x"==a?b:3&b|8).toString(16)})}}},69614:(a,b,c)=>{"use strict";c.d(b,{V:()=>p});var d=c(88888),e=c(91356),f=c(99129),g=c(73575),h=c(41570),i=c(19035),j=c(24762),k=c(80308),l=c(55956);async function m(a,b,c){if(!(0,i.Gv)(a))throw new f.Ye("Flattened JWS must be an object");if(void 0===a.protected&&void 0===a.header)throw new f.Ye('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==a.protected&&"string"!=typeof a.protected)throw new f.Ye("JWS Protected Header incorrect type");if(void 0===a.payload)throw new f.Ye("JWS Payload missing");if("string"!=typeof a.signature)throw new f.Ye("JWS Signature missing or incorrect type");if(void 0!==a.header&&!(0,i.Gv)(a.header))throw new f.Ye("JWS Unprotected Header incorrect type");let m={};if(a.protected)try{let b=(0,d.D)(a.protected);m=JSON.parse(g.D0.decode(b))}catch{throw new f.Ye("JWS Protected Header is invalid")}if(!(0,i.fz)(m,a.header))throw new f.Ye("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let n={...m,...a.header},o=(0,k.n)(f.Ye,new Map([["b64",!0]]),c?.crit,m,n),p=!0;if(o.has("b64")&&"boolean"!=typeof(p=m.b64))throw new f.Ye('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:q}=n;if("string"!=typeof q||!q)throw new f.Ye('JWS "alg" (Algorithm) Header Parameter missing or invalid');let r=c&&function(a,b){if(void 0!==b&&(!Array.isArray(b)||b.some(a=>"string"!=typeof a)))throw TypeError(`"${a}" option must be an array of strings`);if(b)return new Set(b)}("algorithms",c.algorithms);if(r&&!r.has(q))throw new f.Rb('"alg" (Algorithm) Header Parameter value not allowed');if(p){if("string"!=typeof a.payload)throw new f.Ye("JWS Payload must be a string")}else if("string"!=typeof a.payload&&!(a.payload instanceof Uint8Array))throw new f.Ye("JWS Payload must be a string or an Uint8Array instance");let s=!1;"function"==typeof b&&(b=await b(m,a),s=!0),(0,j.y)(q,b,"verify");let t=(0,g.xW)(void 0!==a.protected?(0,g.lF)(a.protected):new Uint8Array,(0,g.lF)("."),"string"==typeof a.payload?p?(0,g.lF)(a.payload):g.Rd.encode(a.payload):a.payload),u=(0,h.h2)(a.signature,"signature",f.Ye),v=await (0,l.l)(b,q);if(!await (0,e.MX)(q,v,u,t))throw new f.h2;let w={payload:p?(0,h.h2)(a.payload,"payload",f.Ye):"string"==typeof a.payload?g.Rd.encode(a.payload):a.payload};return(void 0!==a.protected&&(w.protectedHeader=m),void 0!==a.header&&(w.unprotectedHeader=a.header),s)?{...w,key:v}:w}async function n(a,b,c){if(a instanceof Uint8Array&&(a=g.D0.decode(a)),"string"!=typeof a)throw new f.Ye("Compact JWS must be a string or Uint8Array");let{0:d,1:e,2:h,length:i}=a.split(".");if(3!==i)throw new f.Ye("Invalid Compact JWS");let j=await m({payload:e,protected:d,signature:h},b,c),k={payload:j.payload,protectedHeader:j.protectedHeader};return"function"==typeof b?{...k,key:j.key}:k}var o=c(17347);async function p(a,b,c){let d=await n(a,b,c);if(d.protectedHeader.crit?.includes("b64")&&!1===d.protectedHeader.b64)throw new f.Dp("JWTs MUST NOT use unencoded payload");let e={payload:(0,o.k6)(d.protectedHeader,d.payload,c),protectedHeader:d.protectedHeader};return"function"==typeof b?{...e,key:d.key}:e}},87250:(a,b,c)=>{"use strict";c.d(b,{D1:()=>e});var d=c(54603);async function e(){return await (0,d.Xj)()}}};
3
+ This key will stop working immediately but can be resumed later.`)&&aU(a.id,b):aU(a.id,b)},title:a.isActive?"Pause key":"Resume key"}),(0,d.jsx)("button",{onClick:()=>aT(a.id),className:"p-2 hover:bg-red-500/10 rounded text-red-500 opacity-0 group-hover:opacity-100 transition-all",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]},a.id)})})]}),(0,d.jsx)(h.aF,{isOpen:q,title:"Create API Key",onClose:()=>{r(!1),t("")},children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(h.pd,{label:"Key Name",value:s,onChange:a=>t(a.target.value),placeholder:"Production Key"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:aS,fullWidth:!0,disabled:!s.trim(),children:"Create"}),(0,d.jsx)(h.$n,{onClick:()=>{r(!1),t("")},variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}),(0,d.jsx)(h.aF,{isOpen:!!u,title:"API Key Created",onClose:()=>v(null),children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[(0,d.jsx)("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 mb-2 font-medium",children:"Save this key now!"}),(0,d.jsx)("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:"This is the only time you will see this key. Store it securely."})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.pd,{value:u||"",readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,d.jsx)(h.$n,{variant:"secondary",icon:"created_key"===aB?"check":"content_copy",onClick:()=>aC(u,"created_key"),children:"created_key"===aB?"Copied!":"Copy"})]}),(0,d.jsx)(h.$n,{onClick:()=>v(null),fullWidth:!0,children:"Done"})]})}),(0,d.jsx)(h.aF,{isOpen:Y,title:"Enable Tunnel",onClose:()=>Z(!1),children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)("div",{className:"bg-surface-2 border border-border-subtle rounded-lg p-4",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary",children:"cloud_upload"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm text-text-main font-medium mb-1",children:"Cloudflare Tunnel"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Expose your local 9Router to the internet. No port forwarding, no static IP needed. Share endpoint URL with your team or use it in Cursor, Cline, and other AI tools from anywhere."})]})]})}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-3",children:j.map(a=>(0,d.jsxs)("div",{className:"flex flex-col items-center text-center p-3 rounded-lg bg-sidebar/50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-xl text-primary mb-1",children:a.icon}),(0,d.jsx)("p",{className:"text-xs font-semibold",children:a.title}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:a.desc})]},a.title))}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Requires outbound port 7844 (TCP/UDP). Connection may take 10-30s."}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:aJ,fullWidth:!0,children:"Start Tunnel"}),(0,d.jsx)(h.$n,{onClick:()=>Z(!1),variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}),(0,d.jsx)(h.aF,{isOpen:$,title:"Disable Tunnel",onClose:()=>!S&&_(!1),children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"The Cloudflare tunnel will be disconnected. Remote access via tunnel URL will stop working."}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:aK,fullWidth:!0,disabled:S,variant:"danger",children:S?"Disabling...":"Disable"}),(0,d.jsx)(h.$n,{onClick:()=>_(!1),variant:"ghost",fullWidth:!0,disabled:S,children:"Cancel"})]})]})}),(0,d.jsx)(h.aF,{isOpen:au,title:"Tailscale Funnel",onClose:()=>{am||(av(!1),ar(""),aj(null))},children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[null===ak&&(0,d.jsxs)("p",{className:"text-sm text-text-muted flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"Checking..."]}),!1===ak&&!am&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Tailscale is not installed. Install it to enable Funnel."}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:aM,fullWidth:!0,children:"Install Tailscale"}),(0,d.jsx)(h.$n,{onClick:()=>av(!1),variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),am&&(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"Installing Tailscale..."]}),ao.length>0&&(0,d.jsx)("div",{ref:ay,className:"bg-black/5 dark:bg-white/5 rounded p-2 max-h-40 overflow-y-auto font-mono text-xs text-text-muted",children:ao.map((a,b)=>(0,d.jsx)("div",{children:a},b))})]}),!0===ak&&!am&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"check_circle"}),"Tailscale installed"]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:()=>{let a=window.open("","tailscale_auth","width=600,height=700");a&&a.document.write("<p style='font-family:sans-serif;text-align:center;margin-top:40px'>Connecting to Tailscale...</p>"),aO(a)},fullWidth:!0,children:"Connect"}),(0,d.jsx)(h.$n,{onClick:()=>av(!1),variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),ai&&(0,d.jsx)(n,{status:ai})]})}),(0,d.jsx)(h.aF,{isOpen:aw,title:"Disable Tailscale",onClose:()=>!ae&&ax(!1),children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Tailscale Funnel will be stopped. Remote access via Tailscale URL will stop working."}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:aQ,fullWidth:!0,disabled:ae,variant:"danger",children:ae?"Disabling...":"Disable"}),(0,d.jsx)(h.$n,{onClick:()=>ax(!1),variant:"ghost",fullWidth:!0,disabled:ae,children:"Cancel"})]})]})})]})}function m({label:a,url:b,copyId:c,copied:e,onCopy:f,badge:g,actions:i}){return(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`text-xs font-mono px-1.5 py-0.5 rounded shrink-0 min-w-[88px] text-center ${"CF"===g||"TS"===g?"bg-primary/10 text-primary":"bg-surface-2 text-text-muted"}`,children:a}),(0,d.jsx)(h.pd,{value:b,readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,d.jsx)("button",{onClick:()=>f(b,c),className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary transition-colors shrink-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:e===c?"check":"content_copy"})}),i]})}function n({status:a,className:b=""}){return(0,d.jsx)("div",{className:`p-2 rounded text-sm ${b} ${"success"===a.type?"bg-green-500/10 text-green-600 dark:text-green-400":"warning"===a.type?"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400":"info"===a.type?"bg-blue-500/10 text-blue-600 dark:text-blue-400":"bg-red-500/10 text-red-600 dark:text-red-400"}`,children:a.message.split(/(https?:\/\/[^\s]+)/g).map((a,b)=>/^https?:\/\//.test(a)?(0,d.jsx)("a",{href:a,target:"_blank",rel:"noreferrer",className:"underline font-medium",children:a},b):a)})}function o({text:a}){return(0,d.jsxs)("span",{className:"relative group inline-flex items-center",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted cursor-help",children:"help"}),(0,d.jsx)("span",{className:"pointer-events-none absolute left-5 top-1/2 -translate-y-1/2 z-50 w-64 rounded bg-gray-900 dark:bg-gray-800 text-white text-xs px-2.5 py-1.5 opacity-0 group-hover:opacity-100 transition-opacity shadow-lg",children:a})]})}function p({message:a,action:b}){return(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-amber-500/10 border border-amber-500/20 text-amber-700 dark:text-amber-400",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] shrink-0 mt-0.5",children:"warning"}),(0,d.jsx)("p",{className:"text-xs flex-1",children:a}),b&&(0,d.jsx)("a",{href:b.href,className:"text-xs font-medium underline shrink-0 hover:opacity-80",onClick:b.href.startsWith("#")?a=>{a.preventDefault(),document.getElementById(b.href.slice(1))?.scrollIntoView({behavior:"smooth"})}:void 0,children:b.label})]})}l.propTypes={machineId:g().string.isRequired}},51747:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/Users/bytedance/Documents/9router/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.js\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/bytedance/Documents/9router/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.js","default")},54603:(a,b,c)=>{"use strict";c.d(b,{Xj:()=>e});var d=c(19713);async function e(a=null){let b=a||process.env.MACHINE_ID_SALT||"endpoint-proxy-salt";try{let a=(0,d.machineIdSync)();return(await Promise.resolve().then(c.t.bind(c,55511,23))).createHash("sha256").update(a+b).digest("hex").substring(0,16)}catch(a){return console.log("Error getting machine ID:",a),crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){let b=16*Math.random()|0;return("x"==a?b:3&b|8).toString(16)})}}},69614:(a,b,c)=>{"use strict";c.d(b,{V:()=>p});var d=c(88888),e=c(91356),f=c(99129),g=c(73575),h=c(41570),i=c(19035),j=c(24762),k=c(80308),l=c(55956);async function m(a,b,c){if(!(0,i.Gv)(a))throw new f.Ye("Flattened JWS must be an object");if(void 0===a.protected&&void 0===a.header)throw new f.Ye('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==a.protected&&"string"!=typeof a.protected)throw new f.Ye("JWS Protected Header incorrect type");if(void 0===a.payload)throw new f.Ye("JWS Payload missing");if("string"!=typeof a.signature)throw new f.Ye("JWS Signature missing or incorrect type");if(void 0!==a.header&&!(0,i.Gv)(a.header))throw new f.Ye("JWS Unprotected Header incorrect type");let m={};if(a.protected)try{let b=(0,d.D)(a.protected);m=JSON.parse(g.D0.decode(b))}catch{throw new f.Ye("JWS Protected Header is invalid")}if(!(0,i.fz)(m,a.header))throw new f.Ye("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let n={...m,...a.header},o=(0,k.n)(f.Ye,new Map([["b64",!0]]),c?.crit,m,n),p=!0;if(o.has("b64")&&"boolean"!=typeof(p=m.b64))throw new f.Ye('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:q}=n;if("string"!=typeof q||!q)throw new f.Ye('JWS "alg" (Algorithm) Header Parameter missing or invalid');let r=c&&function(a,b){if(void 0!==b&&(!Array.isArray(b)||b.some(a=>"string"!=typeof a)))throw TypeError(`"${a}" option must be an array of strings`);if(b)return new Set(b)}("algorithms",c.algorithms);if(r&&!r.has(q))throw new f.Rb('"alg" (Algorithm) Header Parameter value not allowed');if(p){if("string"!=typeof a.payload)throw new f.Ye("JWS Payload must be a string")}else if("string"!=typeof a.payload&&!(a.payload instanceof Uint8Array))throw new f.Ye("JWS Payload must be a string or an Uint8Array instance");let s=!1;"function"==typeof b&&(b=await b(m,a),s=!0),(0,j.y)(q,b,"verify");let t=(0,g.xW)(void 0!==a.protected?(0,g.lF)(a.protected):new Uint8Array,(0,g.lF)("."),"string"==typeof a.payload?p?(0,g.lF)(a.payload):g.Rd.encode(a.payload):a.payload),u=(0,h.h2)(a.signature,"signature",f.Ye),v=await (0,l.l)(b,q);if(!await (0,e.MX)(q,v,u,t))throw new f.h2;let w={payload:p?(0,h.h2)(a.payload,"payload",f.Ye):"string"==typeof a.payload?g.Rd.encode(a.payload):a.payload};return(void 0!==a.protected&&(w.protectedHeader=m),void 0!==a.header&&(w.unprotectedHeader=a.header),s)?{...w,key:v}:w}async function n(a,b,c){if(a instanceof Uint8Array&&(a=g.D0.decode(a)),"string"!=typeof a)throw new f.Ye("Compact JWS must be a string or Uint8Array");let{0:d,1:e,2:h,length:i}=a.split(".");if(3!==i)throw new f.Ye("Invalid Compact JWS");let j=await m({payload:e,protected:d,signature:h},b,c),k={payload:j.payload,protectedHeader:j.protectedHeader};return"function"==typeof b?{...k,key:j.key}:k}var o=c(17347);async function p(a,b,c){let d=await n(a,b,c);if(d.protectedHeader.crit?.includes("b64")&&!1===d.protectedHeader.b64)throw new f.Dp("JWTs MUST NOT use unencoded payload");let e={payload:(0,o.k6)(d.protectedHeader,d.payload,c),protectedHeader:d.protectedHeader};return"function"==typeof b?{...e,key:d.key}:e}},87250:(a,b,c)=>{"use strict";c.d(b,{D1:()=>e});var d=c(54603);async function e(){return await (0,d.Xj)()}}};
@@ -0,0 +1,23 @@
1
+ "use strict";exports.id=2238,exports.ids=[2238],exports.modules={4455:(a,b,c)=>{c.d(b,{Tk:()=>j,Ah:()=>k,Q6:()=>x,a7:()=>r,ZM:()=>m,RF:()=>p,gY:()=>E,tA:()=>z,kn:()=>B,yZ:()=>n,qO:()=>s});var d=c(48249),e=c(67484),f=c(50412),g=c(81220);function h({baseUrl:a,apiKey:b,onBaseUrlChange:c,onApiKeyChange:f}){let[g,i]=(0,e.useState)([]),[j,k]=(0,e.useState)(""),l=(0,e.useMemo)(()=>g.find(a=>a.name===j)||null,[g,j]);return(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Preset"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsxs)("select",{value:j,onChange:a=>{var b;let d;return k(b=a.target.value),void((d=g.find(a=>a.name===b))&&(c(d.baseUrl),f(d.apiKey)))},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",children:[(0,d.jsx)("option",{value:"",children:"Manual / current endpoint"}),g.map(a=>{var b;return(0,d.jsxs)("option",{value:a.name,children:[a.name," - ",a.baseUrl," (",(b=a.apiKey)?b.length<=12?`${b.slice(0,4)}...`:`${b.slice(0,8)}...${b.slice(-4)}`:"No API key",")"]},a.name)})]}),(0,d.jsx)("button",{type:"button",onClick:()=>{let c=(a||"").trim(),d=(b||"").trim();if(!c||!d)return;let e=l?.name||c;try{e=l?.name||new URL(c).host}catch{e=l?.name||c}let f=window.prompt("Preset name",e);if(!f?.trim())return;let h={name:f.trim(),baseUrl:c,apiKey:d},j=[...g.filter(a=>a.name!==h.name),h].sort((a,b)=>a.name.localeCompare(b.name));i(j),k(h.name)},disabled:!a||!b,className:"px-2 py-1.5 rounded border text-xs bg-surface border-border text-text-main hover:border-primary disabled:opacity-50 disabled:cursor-not-allowed shrink-0",title:"Save current Base URL and API key as a browser-local preset",children:"Save"}),l&&(0,d.jsx)("button",{type:"button",onClick:()=>{if(!l)return;let a=g.filter(a=>a.name!==l.name);i(a),k("")},className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Delete selected preset",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"delete"})})]})}let i="https://9router.com";function j({tool:a,isExpanded:b,onToggle:c,activeProviders:k,modelMappings:l,onModelMappingChange:m,baseUrl:n,hasActiveProviders:o,apiKeys:p,cloudEnabled:q,initialStatus:r,manualOnly:s=!1}){let t,u,[v,w]=(0,e.useState)(null),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)(!1),[D,E]=(0,e.useState)(null),[F,G]=(0,e.useState)(!1),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(null),[L,M]=(0,e.useState)(""),[N,O]=(0,e.useState)({}),[P,Q]=(0,e.useState)(!1),[R,S]=(0,e.useState)(""),[T,U]=(0,e.useState)(!1);(0,e.useRef)(!1);let V=v||r||null,W=V?.settings?.env?.ANTHROPIC_AUTH_TOKEN||"",X=W&&p?.some(a=>a.key===W),Y=L||(X?W:"")||p?.[0]?.key||"",Z=(()=>{if(!V?.installed)return null;let a=V.settings?.env?.ANTHROPIC_BASE_URL;if(!a)return"not_configured";let b=a.includes("localhost")||a.includes("127.0.0.1"),c=q&&i&&a.startsWith(i),d=n&&a.startsWith(n);return b||c||d?"configured":"other"})(),$=async a=>{let b=a.target.checked;U(b),await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ccFilterNaming:b})}).catch(()=>{})},_=()=>{let a=R||n;return a.endsWith("/v1")?a:`${a}/v1`},aa=()=>{let a=R||n;return a.endsWith("/v1")?a:`${a}/v1`};L&&p.some(a=>a.key===L);let ab=async()=>{A(!0),E(null);try{let b={ANTHROPIC_BASE_URL:_()},c=Y?.trim()||(p?.length>0?p[0].key:null)||(q?null:"sk_openrouterx");c&&(b.ANTHROPIC_AUTH_TOKEN=c),a.defaultModels.forEach(a=>{let c=l[a.alias];c&&a.envKey&&(b[a.envKey]=c)});let d=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:b})}),e=await d.json();d.ok?(E({type:"success",text:"Settings applied successfully!"}),w(a=>({...a,hasBackup:!0,settings:{...a?.settings,env:b}}))):E({type:"error",text:e.error||"Failed to apply settings"})}catch(a){E({type:"error",text:a.message})}finally{A(!1)}},ac=async()=>{C(!0),E(null);try{let b=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),c=await b.json();b.ok?(E({type:"success",text:"Settings reset successfully!"}),a.defaultModels.forEach(a=>m(a.alias,a.defaultValue||"")),M("")):E({type:"error",text:c.error||"Failed to reset settings"})}catch(a){E({type:"error",text:a.message})}finally{C(!1)}};return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:c,children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:"/providers/claude.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===Z&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===Z&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===Z&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[x&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Claude CLI..."})]}),!x&&v&&!v.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if OpenRouterX is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(f.$n,{variant:"secondary",size:"sm",onClick:()=>Q(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),!s&&(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:()=>G(!F),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:F?"expand_less":"help"}),F?"Hide":"How to Install"]})]})]}),!s&&F&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,d.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @anthropic-ai/claude-code"})]}),(0,d.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!x&&V?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[V?.settings?.env?.ANTHROPIC_BASE_URL&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:V.settings.env.ANTHROPIC_BASE_URL})]}),(0,d.jsx)(h,{baseUrl:aa(),apiKey:L,onBaseUrlChange:S,onApiKeyChange:M}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Base URL"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:aa(),onChange:a=>S(a.target.value),placeholder:"https://.../v1",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),!s&&R&&R!==n&&(0,d.jsx)("button",{onClick:()=>S(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),p.length>0?(0,d.jsx)("select",{value:Y,onChange:a=>M(a.target.value),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",children:p.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id))}):(0,d.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:q?"No API keys - Create one in Keys page":"sk_openrouterx (default)"})]}),a.defaultModels.map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:a.name}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:l[a.alias]||"",onChange:b=>m(a.alias,b.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,d.jsx)("button",{onClick:()=>{K(a.alias),I(!0)},disabled:!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),!s&&l[a.alias]&&(0,d.jsx)("button",{onClick:()=>m(a.alias,""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},a.alias)),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Filter naming"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,d.jsx)("input",{type:"checkbox",checked:T,onChange:$,className:"w-3.5 h-3.5 accent-primary cursor-pointer"}),(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"Filter naming requests"})]}),(0,d.jsx)(f.m_,{text:"Intercepts Claude Code's topic-naming requests and returns a fake response locally, saving API tokens.",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]}),D&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===D.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===D.type?"check_circle":"error"}),(0,d.jsx)("span",{children:D.text})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[!s&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:ab,disabled:!o,loading:z,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:ac,disabled:!V?.hasOpenRouterX,loading:B,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]})]}),(0,d.jsxs)(f.$n,{variant:"ghost",size:"sm",onClick:()=>Q(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(f.rq,{isOpen:H,onClose:()=>I(!1),onSelect:a=>{J&&m(J,a.value)},selectedModel:J?l[J]:null,activeProviders:k,modelAliases:N,title:`Select model for ${J}`}),(0,d.jsx)(f.uR,{isOpen:P,onClose:()=>Q(!1),title:"Claude CLI - Manual Configuration",configs:(t=Y&&Y.trim()?Y:q?"<API_KEY_FROM_DASHBOARD>":"sk_openrouterx",u={ANTHROPIC_BASE_URL:_(),ANTHROPIC_AUTH_TOKEN:t},a.defaultModels.forEach(a=>{let b=l[a.alias];b&&a.envKey&&(u[a.envKey]=b)}),[{filename:"~/.claude/settings.json",content:JSON.stringify({hasCompletedOnboarding:!0,env:u},null,2)}])})]})}function k({tool:a,isExpanded:b,onToggle:c,baseUrl:i,apiKeys:j,activeProviders:l,cloudEnabled:m,initialStatus:n,manualOnly:o=!1}){let p,q,r,s,[t,u]=(0,e.useState)(null),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)(null),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)(""),[H,I]=(0,e.useState)(""),[J,K]=(0,e.useState)(""),[L,M]=(0,e.useState)(!1),[N,O]=(0,e.useState)(!1),[P,Q]=(0,e.useState)({}),[R,S]=(0,e.useState)(!1),[T,U]=(0,e.useState)(""),V=t||n||null,W=V?.config?.match(/^model\s*=\s*"([^"]+)"/m)?.[1]||"",X=V?.config?.match(/\[agents\.subagent\]\s*\n\s*model\s*=\s*"([^"]+)"/m)?.[1]||"",Y=F||j?.[0]?.key||"",Z=H||W,$=J||X;async function _(){w(!0);try{let a=await fetch("/api/cli-tools/codex-settings"),b=await a.json();u(b)}catch(a){u({installed:!1,error:a.message})}finally{w(!1)}}let aa=V?.installed?V.config?V.config.includes(i)||V.config.includes("localhost")||V.config.includes("127.0.0.1")?"configured":"other":"not_configured":null,ab=()=>{let a=T||`${i}/v1`;return a.endsWith("/v1")?a:`${a}/v1`},ac=()=>T||`${i}/v1`;F&&j.some(a=>a.key===F);let ad=async()=>{y(!0),C(null);try{let a=Y&&Y.trim()||m?Y:"sk_openrouterx",b=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:ab(),apiKey:a,model:Z,subagentModel:$||Z})}),c=await b.json();b.ok?(C({type:"success",text:"Settings applied successfully!"}),_()):C({type:"error",text:c.error||"Failed to apply settings"})}catch(a){C({type:"error",text:a.message})}finally{y(!1)}},ae=async()=>{A(!0),C(null);try{let a=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),b=await a.json();a.ok?(C({type:"success",text:"Settings reset successfully!"}),I(""),K(""),_()):C({type:"error",text:b.error||"Failed to reset settings"})}catch(a){C({type:"error",text:a.message})}finally{A(!1)}};return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:c,children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:"/providers/codex.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===aa&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===aa&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===aa&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[v&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Codex CLI..."})]}),!v&&t&&!t.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Codex CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if OpenRouterX is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(f.$n,{variant:"secondary",size:"sm",onClick:()=>S(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),!o&&(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:()=>E(!D),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:D?"expand_less":"help"}),D?"Hide":"How to Install"]})]})]}),!o&&D&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,d.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @openai/codex"})]}),(0,d.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"codex"})," to verify."]}),(0,d.jsx)("div",{className:"pt-2 border-t border-border",children:(0,d.jsxs)("p",{className:"text-text-muted text-xs",children:["Codex uses ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"~/.codex/auth.json"})," with ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"OPENAI_API_KEY"}),'. Click "Apply" to auto-configure.']})})]})]})]}),!v&&V?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[V?.config&&((q=(p=V.config.match(/base_url\s*=\s*"([^"]+)"/))?p[1]:null)?(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:q})]}):null),(0,d.jsx)(h,{baseUrl:ac(),apiKey:F,onBaseUrlChange:U,onApiKeyChange:G}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Base URL"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:ac(),onChange:a=>U(a.target.value),placeholder:"https://.../v1",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),!o&&T&&T!==`${i}/v1`&&(0,d.jsx)("button",{onClick:()=>U(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),j.length>0?(0,d.jsx)("select",{value:Y,onChange:a=>G(a.target.value),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",children:j.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id))}):(0,d.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:m?"No API keys - Create one in Keys page":"sk_openrouterx (default)"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:Z,onChange:a=>I(a.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,d.jsx)("button",{onClick:()=>M(!0),disabled:!l?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${l?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),!o&&Z&&(0,d.jsx)("button",{onClick:()=>I(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Subagent Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:$,onChange:a=>K(a.target.value),placeholder:Z||"provider/model-id (defaults to main model)",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,d.jsx)("button",{onClick:()=>O(!0),disabled:!l?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${l?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),!o&&$&&(0,d.jsx)("button",{onClick:()=>K(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear (will use main model)",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),B&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===B.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===B.type?"check_circle":"error"}),(0,d.jsx)("span",{children:B.text})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[!o&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:ad,disabled:!F&&m&&j.length>0||!H,loading:x,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:ae,disabled:z,loading:z,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]})]}),(0,d.jsxs)(f.$n,{variant:"ghost",size:"sm",onClick:()=>S(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(f.rq,{isOpen:L,onClose:()=>M(!1),onSelect:a=>{I(a.value),J||K(a.value),M(!1)},selectedModel:H,activeProviders:l,modelAliases:P,title:"Select Model for Codex"}),(0,d.jsx)(f.rq,{isOpen:N,onClose:()=>O(!1),onSelect:a=>{K(a.value),O(!1)},selectedModel:J,activeProviders:l,modelAliases:P,title:"Select Subagent Model for Codex"}),(0,d.jsx)(f.uR,{isOpen:R,onClose:()=>S(!1),title:"Codex CLI - Manual Configuration",configs:(r=Y&&Y.trim()?Y:m?"<API_KEY_FROM_DASHBOARD>":"sk_openrouterx",s=J||Z,[{filename:"~/.codex/config.toml",content:`# OpenRouterX Configuration for Codex CLI
2
+ model = "${Z}"
3
+ model_provider = "openrouterx"
4
+
5
+ [model_providers.openrouterx]
6
+ name = "OpenRouterX"
7
+ base_url = "${ab()}"
8
+ wire_api = "responses"
9
+
10
+ [agents.subagent]
11
+ model = "${s}"
12
+ `},{filename:"~/.codex/auth.json",content:JSON.stringify({auth_mode:"apikey",OPENAI_API_KEY:r},null,2)}])})]})}let l="https://9router.com";function m({tool:a,isExpanded:b,onToggle:c,baseUrl:i,hasActiveProviders:j,apiKeys:k,activeProviders:n,cloudEnabled:o,initialStatus:p,manualOnly:q=!1}){let r,s,t,[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)(null),[E,F]=(0,e.useState)(""),[G,H]=(0,e.useState)([]),[I,J]=(0,e.useState)(""),[K,L]=(0,e.useState)(!1),[M,N]=(0,e.useState)({}),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)(!1),[S,T]=(0,e.useState)(""),U=u||p||null,V=(()=>{let a=(U?.settings?.customModels||[]).filter(a=>a.id?.startsWith("custom:openrouterx")).sort((a,b)=>(a.index||0)-(b.index||0)).map(a=>a.model).filter(Boolean);if(a.length>0)return a;let b=U?.settings?.customModels?.find(a=>"custom:openrouterx-0"===a.id);return b?.model?[b.model]:[]})(),W=G.length>0?G:V,X=E||k?.[0]?.key||"",Y=(()=>{if(!U?.installed)return null;let a=U.settings?.customModels?.find(a=>a.id?.startsWith("custom:openrouterx"));if(!a)return"not_configured";let b=a.baseUrl?.includes("localhost")||a.baseUrl?.includes("127.0.0.1"),c=o&&l&&a.baseUrl?.startsWith(l),d=i&&a.baseUrl?.startsWith(i);return b||c||d?"configured":"other"})(),Z=async()=>{x(!0);try{let a=await fetch("/api/cli-tools/droid-settings"),b=await a.json();v(b)}catch(a){v({installed:!1,error:a.message})}finally{x(!1)}},$=()=>{let a=S||i;return a.endsWith("/v1")?a:`${a}/v1`},_=()=>{let a=S||i;return a.endsWith("/v1")?a:`${a}/v1`};E&&k.some(a=>a.key===E);let aa=()=>{let a=I.trim();!a||G.includes(a)||(H(b=>[...b,a]),J(""))},ab=async()=>{z(!0),D(null);try{let a=X?.trim()||(k?.length>0?k[0].key:null)||(o?null:"sk_openrouterx"),b=await fetch("/api/cli-tools/droid-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:$(),apiKey:a,models:W,activeModel:W[0]||""})}),c=await b.json();b.ok?(D({type:"success",text:"Settings applied successfully!"}),Z()):D({type:"error",text:c.error||"Failed to apply settings"})}catch(a){D({type:"error",text:a.message})}finally{z(!1)}},ac=async()=>{B(!0),D(null);try{let a=await fetch("/api/cli-tools/droid-settings",{method:"DELETE"}),b=await a.json();a.ok?(D({type:"success",text:"Settings reset successfully!"}),H([]),Z()):D({type:"error",text:b.error||"Failed to reset settings"})}catch(a){D({type:"error",text:a.message})}finally{B(!1)}};return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:c,children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:"/providers/droid.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===Y&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===Y&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===Y&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[w&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Factory Droid CLI..."})]}),!w&&U&&!U.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Factory Droid CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if OpenRouterX is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(f.$n,{variant:"secondary",size:"sm",onClick:()=>P(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),!q&&(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:()=>R(!Q),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:Q?"expand_less":"help"}),Q?"Hide":"How to Install"]})]})]}),!q&&Q&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,d.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"curl -fsSL https://app.factory.ai/cli | sh"})]}),(0,d.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"droid"})," to verify."]})]})]})]}),!w&&U?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[U?.settings?.customModels?.find(a=>a.id?.startsWith("custom:openrouterx"))?.baseUrl&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:U.settings.customModels.find(a=>a.id?.startsWith("custom:openrouterx")).baseUrl})]}),(0,d.jsx)(h,{baseUrl:_(),apiKey:E,onBaseUrlChange:T,onApiKeyChange:F}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Base URL"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:_(),onChange:a=>T(a.target.value),placeholder:"https://.../v1",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),!q&&S&&S!==i&&(0,d.jsx)("button",{onClick:()=>T(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),k.length>0?(0,d.jsx)("select",{value:X,onChange:a=>F(a.target.value),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",children:k.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id))}):(0,d.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:o?"No API keys - Create one in Keys page":"sk_openrouterx (default)"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:["Models ",W.length>0&&(0,d.jsxs)("span",{className:"text-primary",children:["(",W.length,")"]})]}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col gap-1",children:[W.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-0.5 mb-1",children:W.map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-bg-secondary rounded border border-border",children:[(0,d.jsx)("span",{className:"flex-1 text-xs font-mono truncate",children:a}),(0,d.jsx)("button",{onClick:()=>H(b=>b.filter(b=>b!==a)),className:"text-text-muted hover:text-red-500 transition-colors shrink-0",title:"Remove",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},a))}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("input",{type:"text",value:I,onChange:a=>J(a.target.value),onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),aa())},placeholder:"provider/model-id",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),(0,d.jsx)("button",{onClick:()=>L(!0),disabled:!j,className:`px-2 py-1.5 rounded border text-xs shrink-0 ${j?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),(0,d.jsx)("button",{onClick:aa,disabled:!I.trim(),className:"px-2 py-1.5 rounded border bg-surface border-border hover:border-primary text-xs shrink-0 disabled:opacity-50",title:"Add model",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"add"})})]})]})]})]}),C&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===C.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===C.type?"check_circle":"error"}),(0,d.jsx)("span",{children:C.text})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[!q&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:ab,disabled:0===W.length,loading:y,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:ac,disabled:!U?.hasOpenRouterX,loading:A,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]})]}),(0,d.jsxs)(f.$n,{variant:"ghost",size:"sm",onClick:()=>P(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(f.rq,{isOpen:K,onClose:()=>L(!1),onSelect:a=>{!a.value||G.includes(a.value)||(H(b=>[...b,a.value]),L(!1))},selectedModel:null,activeProviders:n,modelAliases:M,title:"Select Model for Factory Droid"}),(0,d.jsx)(f.uR,{isOpen:O,onClose:()=>P(!1),title:"Factory Droid - Manual Configuration",configs:(r=X&&X.trim()?X:o?"<API_KEY_FROM_DASHBOARD>":"sk_openrouterx",s={customModels:W.map((a,b)=>({model:a,id:`custom:openrouterx-${b}`,index:b,baseUrl:$(),apiKey:r,displayName:a,maxOutputTokens:131072,noImageSupport:!1,provider:"openai"}))},t="u">typeof navigator&&navigator.platform,[{filename:t?.toLowerCase().includes("win")?"%USERPROFILE%\\.factory\\settings.json":"~/.factory/settings.json",content:JSON.stringify(s,null,2)}])})]})}function n({tool:a,isExpanded:b,onToggle:c,baseUrl:i,hasActiveProviders:j,apiKeys:k,activeProviders:l,cloudEnabled:m,initialStatus:o,manualOnly:p=!1}){let q,r,[s,t]=(0,e.useState)(o||null),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(null),[C,D]=(0,e.useState)(""),[E,F]=(0,e.useState)(""),[G,H]=(0,e.useState)({}),[I,J]=(0,e.useState)(null),[K,L]=(0,e.useState)(!1),[M,N]=(0,e.useState)({}),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)("");(0,e.useRef)(!1);let S=(()=>{if(!s?.installed)return null;let a=s.settings?.models?.providers?.openrouterx;if(!a)return"not_configured";let b=a.baseUrl?.includes("localhost")||a.baseUrl?.includes("127.0.0.1")||a.baseUrl?.includes("0.0.0.0"),c=i&&a.baseUrl?.startsWith(i);return b||c?"configured":"other"})(),T=async()=>{v(!0);try{let a=await fetch("/api/cli-tools/openclaw-settings"),b=await a.json();t(b)}catch(a){t({installed:!1,error:a.message})}finally{v(!1)}},U=()=>{let a=Q||"http://127.0.0.1:20128";return a.endsWith("/v1")?a:`${a}/v1`},V=()=>{let a=Q||"http://127.0.0.1:20128";return a.endsWith("/v1")?a:`${a}/v1`},W=C&&!k.some(a=>a.key===C),X=async()=>{x(!0),B(null);try{let a=C?.trim()||(k?.length>0?k[0].key:null)||(m?null:"sk_openrouterx"),b=await fetch("/api/cli-tools/openclaw-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:U(),apiKey:a,model:E,agentModels:G})}),c=await b.json();b.ok?(B({type:"success",text:"Settings applied successfully!"}),T()):B({type:"error",text:c.error||"Failed to apply settings"})}catch(a){B({type:"error",text:a.message})}finally{x(!1)}},Y=async()=>{z(!0),B(null);try{let a=await fetch("/api/cli-tools/openclaw-settings",{method:"DELETE"}),b=await a.json();a.ok?(B({type:"success",text:"Settings reset successfully!"}),F(""),D(""),T()):B({type:"error",text:b.error||"Failed to reset settings"})}catch(a){B({type:"error",text:a.message})}finally{z(!1)}};return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:c,children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:"/providers/openclaw.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===S&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===S&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===S&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[u&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Open Claw CLI..."})]}),!u&&s&&!s.installed&&(0,d.jsx)("div",{className:"flex flex-col gap-4",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Open Claw CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if OpenRouterX is deployed on a remote server."})]})]}),(0,d.jsx)("div",{className:"flex items-center gap-2 pl-9",children:(0,d.jsxs)(f.$n,{variant:"secondary",size:"sm",onClick:()=>P(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!u&&s?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[s?.settings?.models?.providers?.openrouterx?.baseUrl&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:s.settings?.models?.providers?.openrouterx?.baseUrl})]}),(0,d.jsx)(h,{baseUrl:V(),apiKey:C,onBaseUrlChange:R,onApiKeyChange:D}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Base URL"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:V(),onChange:a=>R(a.target.value),placeholder:"https://.../v1",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),!p&&Q&&Q!==i&&(0,d.jsx)("button",{onClick:()=>R(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),k.length>0||C?(0,d.jsxs)("select",{value:C,onChange:a=>D(a.target.value),className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[W&&(0,d.jsx)("option",{value:C,children:C}),k.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id))]}):(0,d.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:m?"No API keys - Create one in Keys page":"sk_openrouterx (default)"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Default Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:E,onChange:a=>F(a.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,d.jsx)("button",{onClick:()=>{J(null),L(!0)},disabled:!j,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${j?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),!p&&E&&(0,d.jsx)("button",{onClick:()=>F(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(s.agents||[]).filter(a=>a.agentDir).map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-4",children:[(0,d.jsxs)("span",{className:"w-32 shrink-0 text-xs text-primary text-right truncate",title:a.name||a.id,children:["Agent ",a.name||a.id]}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:G[a.id]||"",onChange:b=>H(c=>({...c,[a.id]:b.target.value})),placeholder:`default (${E||"provider/model-id"})`,className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,d.jsx)("button",{onClick:()=>{J(a.id),L(!0)},disabled:p||!j,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${!p&&j?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),!p&&G[a.id]&&(0,d.jsx)("button",{onClick:()=>H(b=>({...b,[a.id]:""})),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},a.id))]}),A&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===A.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===A.type?"check_circle":"error"}),(0,d.jsx)("span",{children:A.text})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[!p&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:X,disabled:!E,loading:w,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:Y,disabled:!s?.hasOpenRouterX,loading:y,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]})]}),(0,d.jsxs)(f.$n,{variant:"ghost",size:"sm",onClick:()=>P(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(f.rq,{isOpen:K,onClose:()=>L(!1),onSelect:a=>{I?(H(b=>({...b,[I]:a.value})),J(null)):F(a.value),L(!1)},selectedModel:E,activeProviders:l,modelAliases:M,title:"Select Model for Open Claw"}),(0,d.jsx)(f.uR,{isOpen:O,onClose:()=>P(!1),title:"Open Claw - Manual Configuration",configs:(r=(q=C||k?.[0]?.key||"")&&q.trim()?q:m?"<API_KEY_FROM_DASHBOARD>":"sk_openrouterx",[{filename:"~/.openclaw/openclaw.json",content:JSON.stringify({agents:{defaults:{model:{primary:`openrouterx/${E||"provider/model-id"}`}}},models:{providers:{openrouterx:{baseUrl:U(),apiKey:r,api:"openai-completions",models:[{id:E||"provider/model-id",name:(E||"provider/model-id").split("/").pop()}]}}}},null,2)}])})]})}let o="/api/cli-tools/hermes-settings";function p({tool:a,isExpanded:b,onToggle:c,baseUrl:i,hasActiveProviders:j,apiKeys:k,activeProviders:l,cloudEnabled:m,initialStatus:n,manualOnly:q=!1}){let r,[s,t]=(0,e.useState)(n||null),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(null),[C,D]=(0,e.useState)(""),[E,F]=(0,e.useState)(""),[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)({}),[K,L]=(0,e.useState)(!1),[M,N]=(0,e.useState)("");(0,e.useRef)(!1);let O=(()=>{if(!s?.installed)return null;let a=s.settings?.model;if(!a?.base_url)return"not_configured";let b=/localhost|127\.0\.0\.1|0\.0\.0\.0/.test(a.base_url),c=i&&a.base_url.startsWith(i);return b||c?"configured":"other"})(),P=async()=>{v(!0);try{let a=await fetch(o),b=await a.json();t(b)}catch(a){t({installed:!1,error:a.message})}finally{v(!1)}},Q=()=>{let a=M||"http://127.0.0.1:20128";return a.endsWith("/v1")?a:`${a}/v1`},R=C&&!k.some(a=>a.key===C),S=async()=>{x(!0),B(null);try{let a=C?.trim()||(k?.length>0?k[0].key:null)||(m?null:"sk_openrouterx"),b=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:Q(),apiKey:a,model:E})}),c=await b.json();b.ok?(B({type:"success",text:"Settings applied successfully!"}),P()):B({type:"error",text:c.error||"Failed to apply settings"})}catch(a){B({type:"error",text:a.message})}finally{x(!1)}},T=async()=>{z(!0),B(null);try{let a=await fetch(o,{method:"DELETE"}),b=await a.json();a.ok?(B({type:"success",text:"Settings reset successfully!"}),F(""),P()):B({type:"error",text:b.error||"Failed to reset settings"})}catch(a){B({type:"error",text:a.message})}finally{z(!1)}};return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:c,children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:"/providers/hermes.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===O&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===O&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===O&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[u&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Hermes Agent..."})]}),!u&&s&&!s.installed&&(0,d.jsx)("div",{className:"flex flex-col gap-4",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Hermes Agent not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Install: curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash"})]})]}),(0,d.jsx)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 pl-0 sm:pl-9",children:(0,d.jsxs)(f.$n,{variant:"secondary",size:"sm",onClick:()=>L(!0),className:"w-full sm:w-auto !bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!u&&s?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[s?.settings?.model?.base_url&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:s.settings.model.base_url})]}),(0,d.jsx)(h,{baseUrl:Q(),apiKey:C,onBaseUrlChange:N,onApiKeyChange:D}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Base URL"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:Q(),onChange:a=>N(a.target.value),placeholder:"https://.../v1",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),!q&&M&&M!==i&&(0,d.jsx)("button",{onClick:()=>N(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),k.length>0||C?(0,d.jsxs)("select",{value:C,onChange:a=>D(a.target.value),className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[R&&(0,d.jsx)("option",{value:C,children:C}),k.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id))]}):(0,d.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:m?"No API keys - Create one in Keys page":"sk_openrouterx (default)"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Default Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:E,onChange:a=>F(a.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,d.jsx)("button",{onClick:()=>H(!0),disabled:!j,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${j?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),!q&&E&&(0,d.jsx)("button",{onClick:()=>F(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),A&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===A.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===A.type?"check_circle":"error"}),(0,d.jsx)("span",{children:A.text})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[!q&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:S,disabled:!E,loading:w,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:T,disabled:!s?.hasOpenRouterX,loading:y,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]})]}),(0,d.jsxs)(f.$n,{variant:"ghost",size:"sm",onClick:()=>L(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(f.rq,{isOpen:G,onClose:()=>H(!1),onSelect:a=>{F(a.value),H(!1)},selectedModel:E,activeProviders:l,modelAliases:I,title:"Select Model for Hermes Agent"}),(0,d.jsx)(f.uR,{isOpen:K,onClose:()=>L(!1),title:"Hermes Agent - Manual Configuration",configs:(r=C&&C.trim()?C:m?"<API_KEY_FROM_DASHBOARD>":"sk_openrouterx",[{filename:"~/.hermes/config.yaml",content:`model:
13
+ default: "${E||"provider/model-id"}"
14
+ provider: "custom"
15
+ base_url: "${Q()}"
16
+ `},{filename:"~/.hermes/.env",content:`OPENAI_API_KEY=${r}
17
+ `}])})]})}var q=c(50377);function r({toolId:a,tool:b,isExpanded:c,onToggle:h,baseUrl:i,apiKeys:j,activeProviders:k=[],cloudEnabled:l=!1,tunnelEnabled:m=!1}){let[n,o]=(0,e.useState)(null),[p,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(""),[v,w]=(0,e.useState)(()=>j?.length>0?j[0].key:""),x=a=>{let b=v&&v.trim()?v:l?"your-api-key":"sk_openrouterx",c=i||"http://localhost:20128",d=c.endsWith("/v1")?c:`${c}/v1`;return a.replace(/\{\{baseUrl\}\}/g,d).replace(/\{\{apiKey\}\}/g,b).replace(/\{\{model\}\}/g,t||"provider/model-id")},{copy:y}=(0,q.C)(),z=async(a,b)=>{await y(x(a),`toolcard-${b}`),o(b),setTimeout(()=>o(null),2e3)},A=k.length>0,B=()=>(!b.requiresExternalUrl||!!l||!!m)&&(!b.requiresCloud||!!l);return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden overflow-x-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:h,children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:b.image?(0,d.jsx)(g.default,{src:b.image,alt:b.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}}):b.icon?(0,d.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:b.color},children:b.icon}):(0,d.jsx)(g.default,{src:`/providers/${a}.png`,alt:b.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:b.name}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:b.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${c?"rotate-180":""}`,children:"expand_more"})]}),c&&(0,d.jsx)("div",{className:"mt-6 pt-6 border-t border-border",children:b.guideSteps?(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[b.notes&&0!==b.notes.length?(0,d.jsx)("div",{className:"flex flex-col gap-2 mb-4",children:b.notes.map((a,b)=>{if("cloudCheck"===a.type&&(l||m))return null;let c="warning"===a.type,e="cloudCheck"===a.type&&!l&&!m,f="bg-blue-500/10 border-blue-500/30",g="text-blue-600 dark:text-blue-400",h="text-blue-500",i="info";return c?(f="bg-yellow-500/10 border-yellow-500/30",g="text-yellow-600 dark:text-yellow-400",h="text-yellow-500",i="warning"):e&&(f="bg-red-500/10 border-red-500/30",g="text-red-600 dark:text-red-400",h="text-red-500",i="error"),(0,d.jsxs)("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${f}`,children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-lg ${h}`,children:i}),(0,d.jsx)("p",{className:`text-sm ${g}`,children:a.text})]},b)})}):null,B()&&b.guideSteps.map(a=>(0,d.jsxs)("div",{className:"flex items-start gap-4",children:[(0,d.jsx)("div",{className:"size-8 rounded-full flex items-center justify-center shrink-0 text-sm font-semibold text-white",style:{backgroundColor:b.color},children:a.step}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"font-medium text-text",children:a.title}),a.desc&&(0,d.jsx)("p",{className:"text-sm text-text-muted mt-0.5",children:a.desc}),"apiKeySelector"===a.type&&(0,d.jsx)("div",{className:"mt-2 flex flex-col sm:flex-row sm:items-center gap-2",children:j&&j.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("select",{value:v,onChange:a=>w(a.target.value),className:"w-full sm:w-auto flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:j.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id))}),(0,d.jsx)("button",{onClick:()=>z(v,"apiKey"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:"apiKey"===n?"check":"content_copy"})})]}):(0,d.jsx)("span",{className:"text-sm text-text-muted",children:l?"No API keys - Create one in Keys page":"sk_openrouterx"})}),"modelSelector"===a.type&&(0,d.jsxs)("div",{className:"mt-2 flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,d.jsx)("input",{type:"text",value:t,onChange:a=>u(a.target.value),placeholder:"provider/model-id",className:"w-full sm:w-auto flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,d.jsx)("button",{onClick:()=>s(!0),disabled:!A,className:`shrink-0 px-3 py-2 rounded-lg border text-sm transition-colors ${A?"bg-bg-secondary border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),t&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{onClick:()=>z(t,"model"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:"model"===n?"check":"content_copy"})}),(0,d.jsx)("button",{onClick:()=>u(""),className:"p-2 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]})]}),a.value&&(0,d.jsxs)("div",{className:"mt-2 flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,d.jsx)("code",{className:"w-full sm:w-auto flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm font-mono border border-border truncate",children:x(a.value)}),a.copyable&&(0,d.jsx)("button",{onClick:()=>z(a.value,`${a.step}-${a.title}`),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:n===`${a.step}-${a.title}`?"check":"content_copy"})})]})]})]},a.step)),B()&&b.codeBlock&&(0,d.jsxs)("div",{className:"mt-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wide",children:b.codeBlock.language}),(0,d.jsxs)("button",{onClick:()=>z(b.codeBlock.code,"codeblock"),className:"flex items-center gap-1 px-2 py-1 text-xs bg-bg-secondary hover:bg-bg-tertiary rounded border border-border transition-colors",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"codeblock"===n?"check":"content_copy"}),"codeblock"===n?"Copied!":"Copy"]})]}),(0,d.jsx)("pre",{className:"p-4 bg-bg-secondary rounded-lg border border-border overflow-x-auto",children:(0,d.jsx)("code",{className:"text-sm font-mono whitespace-pre",children:x(b.codeBlock.code)})})]})]}):(0,d.jsx)("p",{className:"text-text-muted text-sm",children:"Coming soon..."})}),(0,d.jsx)(f.rq,{isOpen:p,onClose:()=>s(!1),onSelect:a=>{u(a.value)},selectedModel:t,activeProviders:k,title:"Select Model"})]})}function s({tool:a,isExpanded:b,onToggle:c,baseUrl:i,apiKeys:j,activeProviders:k,cloudEnabled:l,initialStatus:m,manualOnly:n=!1}){let o,p,q,r,t,[u,v]=(0,e.useState)(m||null),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)(null),[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)(""),[I,J]=(0,e.useState)(""),[K,L]=(0,e.useState)(""),[M,N]=(0,e.useState)(!1),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)({}),[S,T]=(0,e.useState)(!1),[U,V]=(0,e.useState)(""),[W,X]=(0,e.useState)([]),[Y,Z]=(0,e.useState)(""),$=G||j?.[0]?.key||"",_=(()=>{if(!u?.installed)return null;if(!u.config)return"not_configured";let a=u.config?.provider?.openrouterx,b=a?.options?.baseURL||"",c=b.includes("localhost")||b.includes("127.0.0.1");return u.hasOpenRouterX&&(c||b.includes(i))?"configured":u.hasOpenRouterX?"other":"not_configured"})(),aa=()=>{let a=U||i;return a.endsWith("/v1")?a:`${a}/v1`},ab=()=>U||`${i}/v1`,ac=G&&!j.some(a=>a.key===G),ad=async()=>{x(!0);try{let a=await fetch("/api/cli-tools/opencode-settings"),b=await a.json();v(b)}catch(a){v({installed:!1,error:a.message})}finally{x(!1)}},ae=async()=>{z(!0),D(null);try{let a=G&&G.trim()?G:l?$:"sk_openrouterx",b=await fetch("/api/cli-tools/opencode-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:aa(),apiKey:a,models:W,activeModel:""===Y?"":Y||W[0],subagentModel:K})}),c=await b.json();b.ok?(D({type:"success",text:"Settings applied successfully!"}),ad()):D({type:"error",text:c.error||"Failed to apply settings"})}catch(a){D({type:"error",text:a.message})}finally{z(!1)}},af=async()=>{B(!0),D(null);try{let a=await fetch("/api/cli-tools/opencode-settings",{method:"DELETE"}),b=await a.json();a.ok?(D({type:"success",text:"Settings reset successfully!"}),J(""),L(""),X([]),Z(""),ad()):D({type:"error",text:b.error||"Failed to reset settings"})}catch(a){D({type:"error",text:a.message})}finally{B(!1)}};return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:c,children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:"/providers/opencode.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===_&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===_&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===_&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[w&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking OpenCode CLI..."})]}),!w&&u&&!u.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"OpenCode CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if OpenRouterX is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(f.$n,{variant:"secondary",size:"sm",onClick:()=>T(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),!n&&(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:()=>F(!E),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:E?"expand_less":"help"}),E?"Hide":"How to Install"]})]})]}),!n&&E&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux:"}),(0,d.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g opencode-ai"})]}),(0,d.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"opencode"})," to verify."]})]})]})]}),!w&&u?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[u?.config?.provider?.openrouterx?.options?.baseURL&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:u.config?.provider?.openrouterx?.options?.baseURL})]}),(0,d.jsx)(h,{baseUrl:ab(),apiKey:G,onBaseUrlChange:V,onApiKeyChange:H}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Base URL"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:ab(),onChange:a=>V(a.target.value),placeholder:"https://.../v1",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),!n&&U&&U!==`${i}/v1`&&(0,d.jsx)("button",{onClick:()=>V(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),j.length>0||G?(0,d.jsxs)("select",{value:G,onChange:a=>H(a.target.value),className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[ac&&(0,d.jsx)("option",{value:G,children:G}),j.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id))]}):(0,d.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:l?"No API keys - Create one in Keys page":"sk_openrouterx (default)"})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-start sm:gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right pt-1",children:"Models"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] mt-1.5",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5 min-h-[28px] px-2 py-1.5 bg-surface rounded border border-border",children:0===W.length?(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"No models selected yet. Click Select Model."}):W.map(a=>(0,d.jsxs)("span",{onClick:async()=>{if(a===Y)try{(await fetch("/api/cli-tools/opencode-settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({clearActiveModel:!0})})).ok&&(Z(""),ad())}catch(a){console.log("Error clearing active model:",a)}else Z(a)},className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs cursor-pointer transition-colors ${a===Y?"bg-primary/10 text-primary border border-primary":"bg-black/5 dark:bg-white/5 text-text-muted border border-transparent hover:border-border"}`,title:a===Y?"Click to clear active model":"Click to set as active",children:[a===Y&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[10px]",children:"star"}),a,(0,d.jsx)("button",{onClick:async b=>{b.stopPropagation();try{if((await fetch(`/api/cli-tools/opencode-settings?model=${encodeURIComponent(a)}`,{method:"DELETE"})).ok){let b=W.filter(b=>b!==a);X(b),Y===a&&Z(""),ad()}}catch(a){console.log("Error removing model:",a)}},className:"ml-0.5 hover:text-red-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},a))}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("button",{onClick:()=>N(!0),disabled:!k?.length,className:`px-2 py-1 rounded border text-xs transition-colors ${k?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),(0,d.jsx)("span",{className:"text-xs text-text-muted",children:W.length>0&&Y?(0,d.jsxs)(d.Fragment,{children:["Active: ",(0,d.jsx)("span",{className:"text-primary",children:Y})]}):W.length>0?(0,d.jsx)("span",{className:"text-yellow-500",children:"Click a model to set/clear active"}):"Click Select Model to choose one"})]})]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Subagent Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:K,onChange:a=>L(a.target.value),placeholder:I||"provider/model-id (defaults to main model)",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),(0,d.jsx)("button",{onClick:()=>P(!0),disabled:!k?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${k?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),!n&&K&&(0,d.jsx)("button",{onClick:()=>L(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear (will use main model)",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),C&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===C.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===C.type?"check_circle":"error"}),(0,d.jsx)("span",{children:C.text})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[!n&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:ae,disabled:0===W.length,loading:y,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:af,disabled:!u.hasOpenRouterX,loading:A,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]})]}),(0,d.jsxs)(f.$n,{variant:"ghost",size:"sm",onClick:()=>T(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(f.rq,{isOpen:M,onClose:()=>N(!1),onSelect:a=>{!W.includes(a.value)&&(X([...W,a.value]),Y||Z(a.value)),N(!1)},selectedModel:null,activeProviders:k,modelAliases:Q,title:"Select Model for OpenCode"}),(0,d.jsx)(f.rq,{isOpen:O,onClose:()=>P(!1),onSelect:a=>{L(a.value),P(!1)},selectedModel:K,activeProviders:k,modelAliases:Q,title:"Select Subagent Model for OpenCode"}),(0,d.jsx)(f.uR,{isOpen:S,onClose:()=>T(!1),title:"OpenCode - Manual Configuration",configs:(o=$&&$.trim()?$:l?"<API_KEY_FROM_DASHBOARD>":"sk_openrouterx",p=W.length>0?W:["provider/model-id"],q=Y||W[0]||p[0],r=K||q,t={},p.forEach(a=>{t[a]={name:a}}),[{filename:"~/.config/opencode/opencode.json",content:JSON.stringify({provider:{openrouterx:{npm:"@ai-sdk/openai-compatible",options:{baseURL:aa(),apiKey:o},models:t}},model:`openrouterx/${q}`,agent:{explorer:{description:"Fast explorer subagent for codebase exploration",mode:"subagent",model:`openrouterx/${r}`}}},null,2)}])})]})}let t="/api/cli-tools/cowork-settings",u=a=>/localhost|127\.0\.0\.1|0\.0\.0\.0/i.test(a||""),v=a=>(a||"").replace(/\/v1\/?$/,""),w=a=>{let b=(a||"").replace(/\/+$/,"");return b?/\/v1$/.test(b)?b:`${b}/v1`:""};function x({tool:a,isExpanded:b,onToggle:c,baseUrl:h,apiKeys:i,activeProviders:j,hasActiveProviders:k,cloudEnabled:l,cloudUrl:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q,initialStatus:r}){let s,y,[z,A]=(0,e.useState)(r||null),[B,C]=(0,e.useState)(!1),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)(!1),[H,I]=(0,e.useState)(null),[J,K]=(0,e.useState)(""),[L,M]=(0,e.useState)([]),[N,O]=(0,e.useState)(!1),[P,Q]=(0,e.useState)({}),[R,S]=(0,e.useState)(!1),[T,U]=(0,e.useState)("custom"),[V,W]=(0,e.useState)(""),X=(0,e.useMemo)(()=>{let a=[];return n&&o&&a.push({value:"tunnel",label:`Tunnel - ${o}`,url:w(o)}),p&&q&&a.push({value:"tailscale",label:`Tailscale - ${q}`,url:w(q)}),l&&m&&a.push({value:"cloud",label:`Cloud - ${m}`,url:w(m)}),a.push({value:"custom",label:"Custom URL (VPS / public host)",url:""}),a},[n,o,p,q,l,m]),Y=async()=>{C(!0);try{let a=await fetch(t),b=await a.json();A(b)}catch(a){A({installed:!1,error:a.message})}finally{C(!1)}},Z=(()=>{if(!z?.installed)return null;let a=z?.cowork?.baseUrl;return a?u(a)?"invalid":z.has9Router?"configured":"other":"not_configured"})(),$=J&&!i.some(a=>a.key===J),_=async()=>{I(null);let a=w(V);if(u(a))return void I({type:"error",text:"Localhost is not allowed. Enable Tunnel/Tailscale or use VPS."});if(0===L.length)return void I({type:"error",text:"Please select at least one model"});E(!0);try{let b=J?.trim()||(i?.length>0?i[0].key:null)||(l?null:"sk_9router"),c=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:a,apiKey:b,models:L})}),d=await c.json();c.ok?(I({type:"success",text:"Settings applied. Quit & reopen Claude Desktop to load."}),Y()):I({type:"error",text:d.error||"Failed to apply settings"})}catch(a){I({type:"error",text:a.message})}finally{E(!1)}},aa=async()=>{G(!0),I(null);try{let a=await fetch(t,{method:"DELETE"}),b=await a.json();a.ok?(I({type:"success",text:"Settings reset successfully"}),M([]),Y()):I({type:"error",text:b.error||"Failed to reset"})}catch(a){I({type:"error",text:a.message})}finally{G(!1)}};return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:c,children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:a.image,alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===Z&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===Z&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"invalid"===Z&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-red-500/10 text-red-600 dark:text-red-400 rounded-full",children:"Localhost (invalid)"}),"other"===Z&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2 p-3 bg-blue-500/10 border border-blue-500/30 rounded-lg text-xs text-blue-700 dark:text-blue-300",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] mt-0.5",children:"info"}),(0,d.jsxs)("span",{children:["Claude Cowork runs in a sandboxed VM and ",(0,d.jsx)("b",{children:"cannot reach localhost"}),". Use Tunnel, Tailscale, or VPS public URL."]})]}),B&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Claude Cowork..."})]}),!B&&z&&!z.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude Desktop (Cowork mode) not detected"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Open Claude Desktop → Help → Troubleshooting → Enable Developer mode → Configure third-party inference, then return here."})]})]}),(0,d.jsx)("div",{className:"pl-9",children:(0,d.jsxs)(f.$n,{variant:"secondary",size:"sm",onClick:()=>S(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]}),!B&&z?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[z?.cowork?.baseUrl&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:z.cowork.baseUrl})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Endpoint Mode"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("select",{value:T,onChange:a=>{var b;let c;return U(b=a.target.value),c=X.find(a=>a.value===b),void(c?.url?W(v(c.url)):W(""))},className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:X.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Base URL"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:w(V),onChange:a=>W(v(a.target.value)),placeholder:"https://your-host.com/v1",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),i.length>0||J?(0,d.jsxs)("select",{value:J,onChange:a=>K(a.target.value),className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[$&&(0,d.jsx)("option",{value:J,children:J}),i.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id))]}):(0,d.jsx)("span",{className:"min-w-0 rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:l?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-start sm:gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right pt-1",children:"Models"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] mt-1.5",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5 min-h-[28px] px-2 py-1.5 bg-surface rounded border border-border",children:0===L.length?(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"No models selected"}):L.map(a=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs bg-black/5 dark:bg-white/5 text-text-muted border border-transparent hover:border-border",children:[a,(0,d.jsx)("button",{onClick:()=>M(b=>b.filter(b=>b!==a)),className:"ml-0.5 hover:text-red-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},a))}),(0,d.jsx)("button",{onClick:()=>O(!0),disabled:!k,className:`self-start px-2 py-1 rounded border text-xs transition-colors ${k?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Add Model"})]})]})]}),H&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===H.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===H.type?"check_circle":"error"}),(0,d.jsx)("span",{children:H.text})]}),(0,d.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:_,disabled:0===L.length,loading:D,className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:aa,disabled:!z.has9Router,loading:F,className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(f.$n,{variant:"ghost",size:"sm",onClick:()=>S(!0),className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(f.rq,{isOpen:N,onClose:()=>O(!1),onSelect:a=>{L.includes(a.value)||M([...L,a.value]),O(!1)},selectedModel:null,activeProviders:j,modelAliases:P,title:"Add Model for Claude Cowork"}),(0,d.jsx)(f.uR,{isOpen:R,onClose:()=>S(!1),title:"Claude Cowork - Manual Configuration",configs:(s=J&&J.trim()?J:l?"<API_KEY_FROM_DASHBOARD>":"sk_9router",y=L.length>0?L:["provider/model-id"],[{filename:"~/Library/Application Support/Claude-3p/configLibrary/<appliedId>.json",content:JSON.stringify({inferenceProvider:"gateway",inferenceGatewayBaseUrl:w(V)||"https://your-public-host/v1",inferenceGatewayApiKey:s,inferenceModels:y.map(a=>({name:a}))},null,2)}])})]})}let y="http://localhost:20128";function z({apiKeys:a,cloudEnabled:b,onStatusChange:c}){let[g,h]=(0,e.useState)(null),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(()=>a?.[0]?.key||""),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(y),[A,B]=(0,e.useState)(null),C=g?.isWin===!0,D=C||g?.hasCachedPassword||g?.needsSudoPassword===!1,E=g?.isAdmin!==!1;!E&&(C||g?.hasCachedPassword||g?.needsSudoPassword);let F=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/cli-tools/antigravity-mitm");if(a.ok){let b=await a.json();h(b),b.mitmRouterBaseUrl&&x(b.mitmRouterBaseUrl),c?.(b)}}catch{h({running:!1,certExists:!1,dnsStatus:{}})}},[c]),G=a=>{v(null),g&&(D?H(a,""):(r(a),l(!0),t(null)))},H=async(c,d,e=!1)=>{j(!0),v(null);try{let f;if("trust-cert"===c)f=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"trust-cert",sudoPassword:d})});else if("start"===c){let c=o?.trim()||(a?.length>0?a[0].key:null)||(b?null:"sk_openrouterx");f=await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:c,sudoPassword:d,mitmRouterBaseUrl:w.trim()||y,forceKillPort443:e})})}else f=await fetch("/api/cli-tools/antigravity-mitm",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:d})});if(!f.ok){let a=await f.json().catch(()=>({}));if("PORT_443_BUSY"===a.code&&a.portOwner){l(!1),B({owner:a.portOwner,password:d});return}v(a.error||`Failed to ${c} MITM server`);return}l(!1),n(""),B(null),await F()}catch(a){v(a.message||"Network error")}finally{j(!1),r(null)}},I=()=>{m.trim()?H(q,m):t("Sudo password is required")},J=g?.running;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.Zp,{padding:"sm",className:"border-primary/20 bg-primary/5",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"security"}),(0,d.jsx)("span",{className:"font-semibold text-sm text-text-main",children:"MITM Server"}),J?(0,d.jsx)(f.Ex,{variant:"success",size:"sm",children:"Running"}):(0,d.jsx)(f.Ex,{variant:"default",size:"sm",children:"Stopped"})]}),(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-1 text-xs text-text-muted","data-i18n-skip":"true",children:[{label:"Cert",ok:g?.certExists},{label:"Trusted",ok:g?.certTrusted},{label:"Server",ok:J}].map(({label:a,ok:b})=>(0,d.jsxs)("span",{className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded ${b?"text-green-600":"text-text-muted"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:b?"check_circle":"cancel"}),a]},a))})]}),(0,d.jsxs)("div",{className:"px-2 py-2 rounded-lg bg-surface/50 border border-border/50 flex flex-col gap-2",children:[(0,d.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,d.jsx)("span",{className:"font-medium text-text-main",children:"Purpose:"})," Use Antigravity IDE & GitHub Copilot → with ANY provider/model from OpenRouterX"]}),(0,d.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,d.jsx)("span",{className:"font-medium text-text-main",children:"How it works:"})," Antigravity/Copilot IDE request → DNS redirect to localhost:443 → MITM proxy intercepts → OpenRouterX → response to Antigravity/Copilot"]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"OpenRouterX Base URL"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:w,onChange:a=>x(a.target.value),placeholder:y,disabled:J,className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50 disabled:opacity-50"})]}),!J&&(0,d.jsxs)("div",{className:"grid gap-1 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",list:"mitm-api-keys",value:o,onChange:a=>p(a.target.value),placeholder:b?"Enter or pick API key":"sk_openrouterx (default)",className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50"}),a?.length>0&&(0,d.jsx)("datalist",{id:"mitm-api-keys",children:a.map(a=>(0,d.jsx)("option",{value:a.key,children:a.name||a.key},a.id))})]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center","data-i18n-skip":"true",children:[g?.certExists&&!g?.certTrusted&&(0,d.jsxs)("button",{onClick:()=>G("trust-cert"),disabled:i,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-yellow-500/30 bg-yellow-500/10 px-4 py-2 text-xs font-medium text-yellow-600 transition-colors hover:bg-yellow-500/20 disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"verified_user"}),"Trust Cert"]}),J?(0,d.jsxs)("button",{onClick:()=>G("stop"),disabled:i,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-xs font-medium text-red-500 transition-colors hover:bg-red-500/20 disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop Server"]}):(0,d.jsxs)("button",{onClick:()=>G("start"),disabled:i||!g||C&&!E,title:C&&!E?"Administrator required":void 0,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-primary/30 bg-primary/10 px-4 py-2 text-xs font-medium text-primary transition-colors hover:bg-primary/20 disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start Server"]}),J&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Enable DNS per tool below to activate interception"})]}),u&&(0,d.jsxs)("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mt-0.5 shrink-0",children:"error"}),(0,d.jsx)("span",{children:u})]}),C&&!E&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 border border-red-500/20",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"shield_lock"}),(0,d.jsx)("span",{children:"Administrator required — restart OpenRouterX as Administrator to use MITM"})]})]})}),k&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,d.jsxs)("div",{className:"mx-4 flex w-full max-w-sm flex-col gap-4 rounded-xl border border-border bg-surface p-5 shadow-xl sm:p-6",children:[(0,d.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,d.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Required for SSL certificate and server startup"})]}),(0,d.jsx)(f.pd,{type:"password",placeholder:"Enter sudo password",value:m,onChange:a=>n(a.target.value),onKeyDown:a=>{"Enter"!==a.key||i||I()}}),s&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,d.jsx)("span",{children:s})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,d.jsx)(f.$n,{variant:"ghost",size:"sm",onClick:()=>{l(!1),n(""),t(null)},disabled:i,children:"Cancel"}),(0,d.jsx)(f.$n,{variant:"primary",size:"sm",onClick:I,loading:i,children:"Confirm"})]})]})}),A&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,d.jsxs)("div",{className:"mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border border-border bg-surface p-5 shadow-xl sm:p-6",children:[(0,d.jsx)("h3",{className:"font-semibold text-text-main",children:"Port 443 Already In Use"}),(0,d.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,d.jsxs)("div",{className:"flex flex-col gap-1 text-xs text-text-muted",children:[(0,d.jsx)("p",{children:"Port 443 đang bị process kh\xe1c chiếm:"}),(0,d.jsxs)("p",{className:"font-mono text-text-main","data-i18n-skip":"true",children:[A.owner.name," (PID ",A.owner.pid,")"]}),(0,d.jsx)("p",{children:"Kill process n\xe0y để chạy MITM Server?"})]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,d.jsx)(f.$n,{variant:"ghost",size:"sm",onClick:()=>{B(null),j(!1)},disabled:i,children:"Cancel"}),(0,d.jsx)(f.$n,{variant:"primary",size:"sm",onClick:()=>{H("start",A?.password||"",!0)},loading:i,children:"Kill & Start"})]})]})})]})}var A=c(36811);function B({tool:a,isExpanded:b,onToggle:c,serverRunning:h,dnsActive:i,hasCachedPassword:j,needsSudoPassword:k,isWin:l,apiKeys:m,activeProviders:n,hasActiveProviders:o,modelAliases:p={},cloudEnabled:q,onDnsChange:r}){let[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(""),[C,D]=(0,e.useState)(null),[E,F]=(0,e.useState)(null),[G,H]=(0,e.useState)({}),[I,J]=(0,e.useState)(!1),[K,L]=(0,e.useState)(null),M=A.TOOL_HOSTS[a.id]??[],N=l||j||!1===k,O=(0,e.useCallback)(async b=>{try{await fetch("/api/cli-tools/antigravity-mitm/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:a.id,mappings:b})})}catch{}},[a.id]),P=(a,b)=>{H(c=>({...c,[a]:b}))},Q=()=>{if(!h)return;let a=i?"disable":"enable";N?R(a,""):(D(a),x(!0),F(null))},R=async(b,c)=>{t(!0),v(null);try{let d=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:a.id,action:b,sudoPassword:c})}),e=await d.json();if(!d.ok)throw Error(e.error||"Failed to toggle DNS");"enable"===b&&v(`Restart ${a.name} to apply changes`),x(!1),z(""),r?.(e)}catch{}finally{t(!1),D(null)}},S=()=>{y.trim()?R(C,y):F("Sudo password is required")};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:c,children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:a.image,alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),h?i?(0,d.jsx)(f.Ex,{variant:"success",size:"sm",children:"Active"}):(0,d.jsx)(f.Ex,{variant:"warning",size:"sm",children:"DNS off"}):(0,d.jsx)(f.Ex,{variant:"default",size:"sm",children:"Server off"})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted sm:truncate",children:["Intercept ",a.name," requests via MITM proxy"]})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[M.length>0&&(0,d.jsxs)("div",{className:"mt-2 rounded-md border border-border bg-surface/50 px-2 py-1.5",children:[(0,d.jsx)("p",{className:"text-[10px] font-medium tracking-wide text-text-main/80 mb-1",children:"Edit hosts file manually to add the following entries:"}),(0,d.jsx)("ul",{className:"list-none space-y-0.5 font-mono text-[10px] text-text-muted break-all",children:M.map(a=>(0,d.jsxs)("li",{children:["127.0.0.1 ",a]},a))})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-0.5 text-[11px] text-text-muted px-1",children:[(0,d.jsxs)("p",{children:["Toggle DNS to redirect ",a.name," traffic through OpenRouterX via MITM."]}),!i&&(0,d.jsx)("p",{className:"text-amber-600 text-[10px] mt-1",children:"⚠️ Enable DNS to edit model mappings"})]}),a.defaultModels?.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-2",children:a.defaultModels.map(a=>(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[9rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right",children:a.name}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:G[a.alias]||"",onChange:b=>P(a.alias,b.target.value),onBlur:b=>{var c,d;return c=a.alias,d=b.target.value,void O({...G,[c]:d})},placeholder:"provider/model-id",disabled:!i,className:`w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5 ${!i?"opacity-50 cursor-not-allowed":""}`}),G[a.alias]&&(0,d.jsx)("button",{onClick:()=>{P(a.alias,""),O({...G,[a.alias]:""})},className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{onClick:()=>{L(a.alias),J(!0)},disabled:!o||!i,className:`rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 ${o&&i?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]},a.alias))}),a.defaultModels?.length===0&&(0,d.jsx)("p",{className:"text-xs text-text-muted px-1",children:"Model mappings will be available soon."}),(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:items-start",children:[i?(0,d.jsxs)("button",{onClick:Q,disabled:!h||s,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-xs font-medium text-red-500 transition-colors hover:bg-red-500/20 disabled:cursor-not-allowed disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop DNS"]}):(0,d.jsxs)("button",{onClick:Q,disabled:!h||s,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-primary/30 bg-primary/10 px-4 py-2 text-xs font-medium text-primary transition-colors hover:bg-primary/20 disabled:cursor-not-allowed disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start DNS"]}),u&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs text-amber-500",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"warning"}),(0,d.jsx)("span",{children:u})]})]})]})]}),w&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,d.jsxs)("div",{className:"mx-4 flex w-full max-w-sm flex-col gap-4 rounded-xl border border-border bg-surface p-5 shadow-xl sm:p-6",children:[(0,d.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,d.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Required to modify /etc/hosts and flush DNS cache"})]}),(0,d.jsx)(f.pd,{type:"password",placeholder:"Enter sudo password",value:y,onChange:a=>z(a.target.value),onKeyDown:a=>{"Enter"!==a.key||s||S()}}),E&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,d.jsx)("span",{children:E})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,d.jsx)(f.$n,{variant:"ghost",size:"sm",onClick:()=>{x(!1),z(""),F(null)},disabled:s,children:"Cancel"}),(0,d.jsx)(f.$n,{variant:"primary",size:"sm",onClick:S,loading:s,children:"Confirm"})]})]})}),(0,d.jsx)(f.rq,{isOpen:I,onClose:()=>J(!1),onSelect:a=>{if(!K||a.isPlaceholder)return;let b={...G,[K]:a.value};H(b),O(b)},selectedModel:K?G[K]:null,activeProviders:n,modelAliases:p,title:`Select model for ${K}`})]})}var C=c(2116),D=c.n(C);function E({tool:a}){return(0,d.jsx)(D(),{href:"/dashboard/mitm",className:"block",children:(0,d.jsx)(f.Zp,{padding:"sm",className:"overflow-hidden hover:border-primary/50 transition-colors cursor-pointer",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:a.image,alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-purple-500/10 text-purple-600 dark:text-purple-400 rounded-full",children:"MITM"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[20px]",children:"chevron_right"})]})})})}},36811:a=>{a.exports={TOOL_HOSTS:{antigravity:["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com"],copilot:["api.individual.githubcopilot.com"],kiro:["q.us-east-1.amazonaws.com","codewhisperer.us-east-1.amazonaws.com"],cursor:["api2.cursor.sh"],openrouter:["openrouter.ai","api.openrouter.ai"]}}},62911:(a,b,c)=>{c.d(b,{dM:()=>e,wn:()=>d});let d={antigravity:{id:"antigravity",name:"Antigravity",image:"/providers/antigravity.png",color:"#4285F4",description:"Google Antigravity IDE with MITM",configType:"mitm",mitmDomain:"daily-cloudcode-pa.googleapis.com",modelAliases:["claude-opus-4-6-thinking","claude-sonnet-4-6","gemini-3-flash","gpt-oss-120b-medium","gemini-3-pro-high","gemini-3-pro-low"],defaultModels:[{id:"gemini-3.1-pro-high",name:"Gemini 3.1 Pro High",alias:"gemini-3.1-pro-high"},{id:"gemini-3.1-pro-low",name:"Gemini 3.1 Pro Low",alias:"gemini-3.1-pro-low"},{id:"gemini-3-flash",name:"Gemini 3 Flash / Default",alias:"gemini-3-flash"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",alias:"claude-sonnet-4-6"},{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking",alias:"claude-opus-4-6-thinking"},{id:"gpt-oss-120b-medium",name:"GPT OSS 120B Medium",alias:"gpt-oss-120b-medium"}]},copilot:{id:"copilot",name:"GitHub Copilot",image:"/providers/copilot.png",color:"#1F6FEB",description:"GitHub Copilot IDE with MITM",configType:"mitm",mitmDomain:"api.individual.githubcopilot.com",modelAliases:["gpt-4o-mini","claude-haiku-4.5","gpt-4o","gpt-5-mini"],defaultModels:[{id:"gpt-4o",name:"GPT-4o",alias:"gpt-4o"},{id:"gpt-4.1",name:"GPT-4.1",alias:"gpt-4.1"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",alias:"claude-haiku-4.5"}]},kiro:{id:"kiro",name:"Kiro",image:"/providers/kiro.png",color:"#FF6B00",description:"Kiro IDE with MITM",configType:"mitm",mitmDomain:"q.us-east-1.amazonaws.com",defaultModels:[{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",alias:"claude-sonnet-4.5"},{id:"claude-sonnet-4",name:"Claude Sonnet 4",alias:"claude-sonnet-4"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",alias:"claude-haiku-4.5"},{id:"deepseek-3.2",name:"DeepSeek 3.2",alias:"deepseek-3.2"},{id:"minimax-m2.1",name:"MiniMax M2.1",alias:"minimax-m2.1"},{id:"simple-task",name:"Qwen3 Coder Next",alias:"simple-task"}]},openrouter:{id:"openrouter",name:"OpenRouter",image:"/providers/openrouter.png",color:"#8B5CF6",description:"OpenRouter with MITM",configType:"mitm",mitmDomain:"openrouter.ai",modelAliases:["openai/gpt-5.4","openai/gpt-5.5","anthropic/claude-sonnet-4.6","anthropic/claude-sonnet-4.7"],defaultModels:[{id:"openai/gpt-5.4",name:"OpenAI: GPT-5.4",alias:"openai/gpt-5.4"},{id:"openai/gpt-5.5",name:"OpenAI: GPT-5.5",alias:"openai/gpt-5.5"},{id:"anthropic/claude-sonnet-4.6",name:"Anthropic: Claude-Sonnet-4.6",alias:"anthropic/claude-sonnet-4.6"},{id:"anthropic/claude-sonnet-4.7",name:"Anthropic: Claude Sonnet 4.7",alias:"anthropic/claude-sonnet-4.7"}]}},e={claude:{id:"claude",name:"Claude Code",icon:"terminal",color:"#D97757",description:"Anthropic Claude Code CLI",configType:"env",envVars:{baseUrl:"ANTHROPIC_BASE_URL",model:"ANTHROPIC_MODEL",opusModel:"ANTHROPIC_DEFAULT_OPUS_MODEL",sonnetModel:"ANTHROPIC_DEFAULT_SONNET_MODEL",haikuModel:"ANTHROPIC_DEFAULT_HAIKU_MODEL"},modelAliases:["default","sonnet","opus","haiku","opusplan"],settingsFile:"~/.claude/settings.json",defaultModels:[{id:"opus",name:"Claude Opus",alias:"opus",envKey:"ANTHROPIC_DEFAULT_OPUS_MODEL",defaultValue:"cc/claude-opus-4-6"},{id:"sonnet",name:"Claude Sonnet",alias:"sonnet",envKey:"ANTHROPIC_DEFAULT_SONNET_MODEL",defaultValue:"cc/claude-sonnet-4-6"},{id:"haiku",name:"Claude Haiku",alias:"haiku",envKey:"ANTHROPIC_DEFAULT_HAIKU_MODEL",defaultValue:"cc/claude-haiku-4-5-20251001"}]},openclaw:{id:"openclaw",name:"Open Claw",image:"/providers/openclaw.png",color:"#FF6B35",description:"Open Claw AI Assistant",configType:"custom"},codex:{id:"codex",name:"OpenAI Codex CLI",image:"/providers/codex.png",color:"#10A37F",description:"OpenAI Codex CLI",configType:"custom"},opencode:{id:"opencode",name:"OpenCode",image:"/providers/opencode.png",color:"#E87040",description:"OpenCode AI Terminal Assistant",configType:"custom"},cowork:{id:"cowork",name:"Claude Cowork",image:"/providers/claude.png",color:"#D97757",description:"Claude Desktop Cowork (third-party inference)",configType:"custom"},hermes:{id:"hermes",name:"Hermes Agent",image:"/providers/hermes.png",color:"#8B5CF6",description:"Nous Research self-improving AI agent",configType:"custom"},droid:{id:"droid",name:"Factory Droid",image:"/providers/droid.png",color:"#00D4FF",description:"Factory Droid AI Assistant",configType:"custom"},cursor:{id:"cursor",name:"Cursor",image:"/providers/cursor.png",color:"#000000",description:"Cursor AI Code Editor",configType:"guide",requiresExternalUrl:!0,notes:[{type:"warning",text:"Requires Cursor Pro account to use this feature."},{type:"cloudCheck",text:"Cursor routes requests through its own server, so local endpoint is not supported. Please enable Tunnel or Cloud Endpoint in Settings."}],guideSteps:[{step:1,title:"Open Settings",desc:"Go to Settings → Models"},{step:2,title:"Enable OpenAI API",desc:'Enable "OpenAI API key" option'},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Add Custom Model",desc:'Click "View All Model" → "Add Custom Model"'},{step:6,title:"Select Model",type:"modelSelector"}]},cline:{id:"cline",name:"Cline",image:"/providers/cline.png",color:"#00D1B2",description:"Cline AI Coding Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Cline Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → OpenAI Compatible"},{step:3,title:"Base URL",value:"{{baseUrl}}/v1",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},kilo:{id:"kilo",name:"Kilo Code",image:"/providers/kilocode.png",color:"#FF6B6B",description:"Kilo Code AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Kilo Code Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → OpenAI Compatible"},{step:3,title:"Base URL",value:"{{baseUrl}}/v1",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},roo:{id:"roo",name:"Roo",image:"/providers/roo.png",color:"#FF6B6B",description:"Roo AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Roo Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → Ollama"},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},continue:{id:"continue",name:"Continue",image:"/providers/continue.png",color:"#7C3AED",description:"Continue AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Config",desc:"Open Continue configuration file"},{step:2,title:"API Key",type:"apiKeySelector"},{step:3,title:"Select Model",type:"modelSelector"},{step:4,title:"Add Model Config",desc:"Add the following configuration to your models array:"}],codeBlock:{language:"json",code:`{
18
+ "apiBase": "{{baseUrl}}",
19
+ "title": "{{model}}",
20
+ "model": "{{model}}",
21
+ "provider": "openai",
22
+ "apiKey": "{{apiKey}}"
23
+ }`}}}}};