switchboard-router 0.6.12 → 0.6.13

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 (379) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +9 -9
  3. package/app/.next-cli-build/build-manifest.json +2 -2
  4. package/app/.next-cli-build/prerender-manifest.json +3 -3
  5. package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page.js +1 -1
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page.js.nft.json +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page_client-reference-manifest.js +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page.js.nft.json +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page_client-reference-manifest.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +3 -3
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page.js +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page.js.nft.json +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page_client-reference-manifest.js +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +3 -3
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page.js +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page.js.nft.json +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page_client-reference-manifest.js +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  75. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  76. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  77. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  78. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  79. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  80. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  81. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  82. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  83. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  84. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  85. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  86. package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  87. package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  88. package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  89. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  90. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  91. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  92. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  93. package/app/.next-cli-build/server/app/_not-found.rsc +3 -3
  94. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
  95. package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  96. package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +3 -3
  97. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  98. package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  99. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  100. package/app/.next-cli-build/server/app/api/agent-library/catalog/route.js.nft.json +1 -1
  101. package/app/.next-cli-build/server/app/api/agent-library/doctor/route.js.nft.json +1 -1
  102. package/app/.next-cli-build/server/app/api/agent-library/export/route.js.nft.json +1 -1
  103. package/app/.next-cli-build/server/app/api/agent-library/mcp/route.js.nft.json +1 -1
  104. package/app/.next-cli-build/server/app/api/agent-library/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/agent-library/skills/route.js.nft.json +1 -1
  106. package/app/.next-cli-build/server/app/api/agent-library/sync/route.js.nft.json +1 -1
  107. package/app/.next-cli-build/server/app/api/agent-library/updates/route.js.nft.json +1 -1
  108. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/cli-tools/aider-settings/route.js +2 -2
  110. package/app/.next-cli-build/server/app/api/cli-tools/aider-settings/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +4 -4
  112. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  114. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  116. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
  117. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  118. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +1 -1
  119. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  120. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
  121. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  122. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
  123. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  124. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
  125. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  126. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  127. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +1 -1
  129. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  130. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
  131. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/cli-tools/gemini-cli-settings/route.js +3 -3
  133. package/app/.next-cli-build/server/app/api/cli-tools/gemini-cli-settings/route.js.nft.json +1 -1
  134. package/app/.next-cli-build/server/app/api/cli-tools/grok-settings/route.js +2 -2
  135. package/app/.next-cli-build/server/app/api/cli-tools/grok-settings/route.js.nft.json +1 -1
  136. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +3 -3
  137. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  138. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
  139. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  140. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  141. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  142. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +1 -1
  143. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  144. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
  145. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  146. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +2 -2
  147. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
  148. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  149. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  151. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  152. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  153. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  154. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  155. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  157. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  158. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  159. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  160. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  161. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  162. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  163. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  164. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  165. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/route.js.nft.json +1 -1
  166. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/strategy/route.js.nft.json +1 -1
  167. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/route.js.nft.json +1 -1
  168. package/app/.next-cli-build/server/app/api/mgmt/v1/health/route.js.nft.json +1 -1
  169. package/app/.next-cli-build/server/app/api/mgmt/v1/providers/route.js.nft.json +1 -1
  170. package/app/.next-cli-build/server/app/api/mgmt/v1/routing/route.js.nft.json +1 -1
  171. package/app/.next-cli-build/server/app/api/mgmt/v1/usage/route.js.nft.json +1 -1
  172. package/app/.next-cli-build/server/app/api/mgmt/v1/version/route.js.nft.json +1 -1
  173. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  175. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  176. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  177. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  179. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  181. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  182. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  183. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  184. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  185. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  186. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  187. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  188. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  189. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  190. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  192. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  194. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  196. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  197. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/batch/route.js.nft.json +1 -1
  198. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/cache/route.js.nft.json +1 -1
  199. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/prepare/route.js.nft.json +1 -1
  200. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/remove-unavailable/route.js.nft.json +1 -1
  201. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/route.js.nft.json +1 -1
  202. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/cancel/route.js +1 -1
  203. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/cancel/route.js.nft.json +1 -1
  204. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/start/route.js +1 -1
  205. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/start/route.js.nft.json +1 -1
  206. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/status/route.js +1 -1
  207. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/status/route.js.nft.json +1 -1
  208. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  209. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  210. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  211. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  212. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  213. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  214. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  215. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  216. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  217. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  218. package/app/.next-cli-build/server/app/api/routing/feedback/route.js.nft.json +1 -1
  219. package/app/.next-cli-build/server/app/api/routing/insights/route.js.nft.json +1 -1
  220. package/app/.next-cli-build/server/app/api/routing/learn/route.js.nft.json +1 -1
  221. package/app/.next-cli-build/server/app/api/routing/stats/route.js.nft.json +1 -1
  222. package/app/.next-cli-build/server/app/api/routing/versions/promote/route.js.nft.json +1 -1
  223. package/app/.next-cli-build/server/app/api/routing/versions/rollback/route.js.nft.json +1 -1
  224. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  225. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  226. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  227. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  228. package/app/.next-cli-build/server/app/api/skills/[id]/route.js.nft.json +1 -1
  229. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  230. package/app/.next-cli-build/server/app/api/token-saver/vault-stats/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  232. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  234. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  236. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  237. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  238. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  239. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  240. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  241. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  242. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  243. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  244. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  245. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  246. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  247. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  248. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  249. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  250. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  251. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  252. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  253. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  254. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  255. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
  256. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  257. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  258. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  259. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  260. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  261. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  262. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  263. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  264. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  265. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  266. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  267. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  268. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  269. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  270. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  271. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  272. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  273. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  274. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  275. package/app/.next-cli-build/server/app/callback.html +1 -1
  276. package/app/.next-cli-build/server/app/callback.rsc +3 -3
  277. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
  278. package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  279. package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +3 -3
  280. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
  281. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  282. package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  283. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  284. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  285. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  286. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
  287. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
  288. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  289. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
  290. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  291. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  292. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  293. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  294. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  295. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  296. package/app/.next-cli-build/server/app/index.html +1 -1
  297. package/app/.next-cli-build/server/app/index.rsc +3 -3
  298. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  299. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
  300. package/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
  301. package/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +3 -3
  302. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
  303. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  304. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  305. package/app/.next-cli-build/server/app/landing.html +1 -1
  306. package/app/.next-cli-build/server/app/landing.rsc +3 -3
  307. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
  308. package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  309. package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +3 -3
  310. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
  311. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  312. package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  313. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  314. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  315. package/app/.next-cli-build/server/app/login.html +1 -1
  316. package/app/.next-cli-build/server/app/login.rsc +3 -3
  317. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +3 -3
  318. package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  319. package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +3 -3
  320. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
  321. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
  322. package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  323. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  324. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  325. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  326. package/app/.next-cli-build/server/app-paths-manifest.json +9 -9
  327. package/app/.next-cli-build/server/chunks/194.js +1 -1
  328. package/app/.next-cli-build/server/chunks/{1062.js → 3787.js} +2 -2
  329. package/app/.next-cli-build/server/chunks/4126.js +1 -1
  330. package/app/.next-cli-build/server/chunks/4746.js +1 -1
  331. package/app/.next-cli-build/server/chunks/5821.js +1 -1
  332. package/app/.next-cli-build/server/chunks/7155.js +1 -1
  333. package/app/.next-cli-build/server/chunks/869.js +1 -1
  334. package/app/.next-cli-build/server/chunks/8998.js +6 -6
  335. package/app/.next-cli-build/server/chunks/9489.js +2 -2
  336. package/app/.next-cli-build/server/chunks/9696.js +5 -5
  337. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  338. package/app/.next-cli-build/server/pages/404.html +1 -1
  339. package/app/.next-cli-build/server/pages/500.html +1 -1
  340. package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  341. package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  342. package/app/.next-cli-build/static/chunks/{1321-3803e2ef7718183d.js → 1321-f614c7c6e5ab4bcc.js} +1 -1
  343. package/app/.next-cli-build/static/chunks/{5497-d866b97bf9a716ba.js → 5497-3d546c1b7aa357b1.js} +5 -5
  344. package/app/.next-cli-build/static/chunks/594-e392353337efef19.js +64 -0
  345. package/app/.next-cli-build/static/chunks/6430-4c528cfc35666c11.js +1 -0
  346. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/agent-library/{page-d720efb4c9d427e6.js → page-62bea7b75b3f2692.js} +1 -1
  347. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/basic-chat/{page-04509a38b9fd3dcf.js → page-1eb380280857cf20.js} +1 -1
  348. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-fa35870caaeabe20.js → page-9aa986f145130c08.js} +1 -1
  349. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-aa9c65a5e73a3f5d.js → page-a09d7692b3ea9179.js} +1 -1
  350. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/{page-a8d77d24b4c71915.js → page-4bf0abe7c7119ac0.js} +1 -1
  351. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/routing/{page-95f09ae849f539d6.js → page-1fc70bcd434deb73.js} +1 -1
  352. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/{page-6678759c536b4008.js → page-fdc5377da12ec933.js} +1 -1
  353. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/page-b48bd39cb03c4985.js +3 -0
  354. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-183cf5498e6d3e42.js → page-9e60537a4b8f5a0c.js} +1 -1
  355. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/{page-b67e7e3b9acaf1cc.js → page-95bf830096d019fd.js} +1 -1
  356. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/{page-a4bad553cba810e7.js → page-45ebe6bb46c9f65e.js} +1 -1
  357. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/{page-0568602ac2385103.js → page-7ac82c8930583633.js} +1 -1
  358. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/web/{page-f6e3507247a819e5.js → page-961013b570bbeac6.js} +1 -1
  359. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/mitm/{page-08fe6612a31239da.js → page-8619928e4b74f46b.js} +1 -1
  360. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/{page-a1ab95a02951c91d.js → page-b5b9038ea28e63b6.js} +1 -1
  361. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-fa1088497ed93ca8.js → page-e023b0417bbc3b44.js} +2 -2
  362. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/new/{page-608cdc11e7047159.js → page-fe7ccc9c117d7d38.js} +1 -1
  363. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/{page-ad84a479883e6cc3.js → page-d3e35265648406f2.js} +1 -1
  364. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/{page-f312c1076859630e.js → page-5ac3900baf3fe9ca.js} +1 -1
  365. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/[id]/{page-90277b8688f387c1.js → page-bb4af1ac9b13a514.js} +1 -1
  366. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/{page-33e127c15efc66a5.js → page-4382c14f28ddfc7f.js} +1 -1
  367. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/token-saver/{page-0f74a450b98fa125.js → page-1b2b6b736fe98698.js} +1 -1
  368. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/translator/{page-ad2eda4b48c9319b.js → page-92fe95bd4e6b3d0a.js} +1 -1
  369. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/{page-025d20cc7b091120.js → page-4c47b9660f3066e2.js} +1 -1
  370. package/app/.next-cli-build/static/chunks/app/(dashboard)/layout-d1fa5b81e1c386ab.js +1 -0
  371. package/app/package.json +1 -1
  372. package/package.json +1 -1
  373. package/app/.next-cli-build/static/chunks/1631-cb80453bf5d4173d.js +0 -1
  374. package/app/.next-cli-build/static/chunks/2176-8ad9ce4b3cb01006.js +0 -1
  375. package/app/.next-cli-build/static/chunks/2280-61262f8359f37a85.js +0 -64
  376. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/page-59e92d48daea1aed.js +0 -3
  377. package/app/.next-cli-build/static/chunks/app/(dashboard)/layout-acc24d6e7d8eb782.js +0 -1
  378. /package/app/.next-cli-build/static/{wG_l24NL6NtH6bKGFC8pf → y86nLCzoD011gXPeccvk9}/_buildManifest.js +0 -0
  379. /package/app/.next-cli-build/static/{wG_l24NL6NtH6bKGFC8pf → y86nLCzoD011gXPeccvk9}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8460],{18964:(e,t,s)=>{"use strict";s.d(t,{default:()=>N});var r=s(95155),a=s(12115),l=s(14051),i=s.n(l),n=s(35497),o=s(57250),d=s(65921),c=s(90620),m=s(88105),p=s(98500),x=s.n(p),u=s(38003);let h={available:{icon:"check_circle",color:"#22c55e",label:"Available"},cooldown:{icon:"schedule",color:"#f59e0b",label:"Cooldown"},unavailable:{icon:"error",color:"#ef4444",label:"Unavailable"},unknown:{icon:"help",color:"#6b7280",label:"Unknown"}};function f(){let[e,t]=(0,a.useState)(null),[s,l]=(0,a.useState)(!0),[i,o]=(0,a.useState)(!1),[c,m]=(0,a.useState)(null),p=(0,a.useRef)(null),x=(0,d.i)(),u=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/availability");if(e.ok){let s=await e.json();t(s)}}catch{}finally{l(!1)}},[]);(0,a.useEffect)(()=>{u();let e=setInterval(u,3e4);return()=>clearInterval(e)},[u]),(0,a.useEffect)(()=>{let e=e=>{p.current&&!p.current.contains(e.target)&&o(!1)};return i&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);let f=async(e,t)=>{m(`${e}:${t}`);try{(await fetch("/api/models/availability",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clearCooldown",provider:e,model:t})})).ok?(x.success(`Cooldown cleared for ${t}`),await u()):x.error("Failed to clear cooldown")}catch{x.error("Failed to clear cooldown")}finally{m(null)}};if(s)return null;let g=e?.models||[],b=0===(e?.unavailableCount||g.filter(e=>"available"!==e.status).length),y={};return g.forEach(e=>{if("available"===e.status)return;let t=e.provider||"unknown";y[t]||(y[t]=[]),y[t].push(e)}),(0,r.jsx)("div",{className:"relative",ref:p,children:i&&(0,r.jsxs)("div",{className:"absolute top-full right-0 mt-2 w-80 bg-surface border border-border rounded-xl shadow-2xl z-50 overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-bg",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",style:{color:b?"#22c55e":"#f59e0b"},children:b?"verified":"warning"}),(0,r.jsx)("span",{className:"text-sm font-semibold text-text-main",children:"Model Status"})]}),(0,r.jsx)("button",{onClick:u,className:"p-1 rounded-lg hover:bg-surface text-text-muted hover:text-text-main transition-colors",title:"Refresh",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"})})]}),(0,r.jsx)("div",{className:"px-4 py-3 max-h-60 overflow-y-auto",children:b?(0,r.jsx)("p",{className:"text-sm text-text-muted text-center py-2",children:"All models are responding normally."}):(0,r.jsx)("div",{className:"flex flex-col gap-2.5",children:Object.entries(y).map(([e,t])=>(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs font-semibold text-text-main mb-1.5 capitalize",children:e}),(0,r.jsx)("div",{className:"flex flex-col gap-1",children:t.map(e=>{let t=h[e.status]||h.unknown,s=c===`${e.provider}:${e.model}`;return(0,r.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5 rounded-lg bg-surface/30",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] shrink-0",style:{color:t.color},children:t.icon}),(0,r.jsx)("span",{className:"font-mono text-xs text-text-main truncate",children:e.model})]}),"cooldown"===e.status&&(0,r.jsx)(n.$n,{size:"sm",variant:"ghost",onClick:()=>f(e.provider,e.model),disabled:s,className:"text-[10px] px-1.5! py-0.5! ml-2",children:s?"...":"Clear"})]},`${e.provider}-${e.model}`)})})]},e))})})]})})}var g=s(78559);let b={openai:{title:"Add OpenAI Compatible",type:"openai-compatible",defaultBaseUrl:"https://api.openai.com/v1",namePlaceholder:"My LiteLLM / OpenRouter / vLLM",baseUrlHint:"Base URL ending in /v1 for your OpenAI-compatible API.",modelIdPlaceholder:"e.g. gpt-4, claude-3-opus",errorLabel:"OpenAI Compatible",hasApiType:!0},anthropic:{title:"Add Anthropic Compatible",type:"anthropic-compatible",defaultBaseUrl:"https://api.anthropic.com/v1",namePlaceholder:"My Claude proxy",baseUrlHint:"Base URL ending in /v1. /messages is appended automatically.",modelIdPlaceholder:"e.g. claude-3-opus",errorLabel:"Anthropic Compatible",hasApiType:!1}},y=[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}];function v({variant:e,isOpen:t,onClose:s,onCreated:l}){let i=b[e],o=()=>({name:"",...i.hasApiType?{apiType:"chat"}:{},baseUrl:i.defaultBaseUrl}),[d,c]=(0,a.useState)(o),[m,p]=(0,a.useState)(!1),[x,u]=(0,a.useState)(""),[h,f]=(0,a.useState)(""),[j,N]=(0,a.useState)(""),[w,k]=(0,a.useState)(!1),[C,T]=(0,a.useState)(null),A=function(e){try{return["http:","https:"].includes(new URL(e).protocol)}catch{return!1}}(d.baseUrl.trim());(0,a.useEffect)(()=>{t&&(c(o()),u(""),f(""),N(""),T(null))},[t,e]),(0,a.useEffect)(()=>{i.hasApiType&&t&&c(e=>({...e,baseUrl:i.defaultBaseUrl}))},[d.apiType]);let I=async()=>{if(!d.name.trim()||!A)return void u("Enter a valid http:// or https:// base URL");p(!0),u("");try{let e=await fetch("/api/provider-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:d.name.trim(),...i.hasApiType?{apiType:d.apiType}:{},baseUrl:d.baseUrl.trim(),type:i.type})}),t=await e.json();e.ok?(l(t.node),c(o()),f(""),T(null)):u(t.error||"Failed to create provider")}catch(e){(0,g.s)(`Error creating ${i.errorLabel} node:`,e),u("Network error")}finally{p(!1)}},E=async()=>{k(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:d.baseUrl,apiKey:h,type:i.type,modelId:j.trim()||void 0})}),t=await e.json();T(t)}catch{T({valid:!1,error:"Network error"})}finally{k(!1)}};return(0,r.jsx)(n.aF,{isOpen:t,title:i.title,onClose:s,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(n.pd,{label:"Name",value:d.name,onChange:e=>c({...d,name:e.target.value}),placeholder:i.namePlaceholder,hint:"Friendly label (e.g. Work LiteLLM)."}),i.hasApiType&&(0,r.jsx)(n.l6,{label:"API Type",options:y,value:d.apiType,onChange:e=>c({...d,apiType:e.target.value})}),(0,r.jsx)(n.pd,{label:"Base URL",value:d.baseUrl,onChange:e=>c({...d,baseUrl:e.target.value}),placeholder:i.defaultBaseUrl,hint:i.baseUrlHint}),(0,r.jsx)(n.pd,{label:"API Key (for Check)",type:"password",autoComplete:"off",value:h,onChange:e=>f(e.target.value)}),(0,r.jsx)(n.pd,{label:"Model ID (optional)",value:j,onChange:e=>N(e.target.value),placeholder:i.modelIdPlaceholder,hint:"If the provider has no /models endpoint, enter a model ID to test chat/completions."}),(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[(0,r.jsx)(n.$n,{onClick:E,disabled:!h||w||!A,variant:"secondary",className:"w-full sm:w-auto",children:w?"Checking...":"Check"}),(()=>{if(!C)return null;let{valid:e,error:t,method:s}=C;return e?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.Ex,{variant:"success",children:"Valid"}),"chat"===s&&(0,r.jsx)("span",{className:"text-sm text-text-muted",children:"(via inference test)"})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)(n.Ex,{variant:"error",children:"Invalid"}),t&&(0,r.jsx)("span",{className:"text-sm text-red-500",children:t})]})})()]}),x?(0,r.jsx)("p",{className:"text-sm text-red-500",children:x}):null,(0,r.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[(0,r.jsx)(n.$n,{onClick:I,fullWidth:!0,disabled:!d.name.trim()||!A||m,children:m?"Creating...":"Create"}),(0,r.jsx)(n.$n,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function j(e,t,s){let a=[];if(e>0&&a.push((0,r.jsxs)(n.Ex,{variant:"success",size:"sm",dot:!0,children:[e," Connected"]},"connected")),t>0){let e=s?`${t} Error (${s})`:`${t} Error`;a.push((0,r.jsx)(n.Ex,{variant:"error",size:"sm",dot:!0,children:e},"error"))}return 0===a.length?(0,r.jsx)("span",{className:"text-text-muted",children:"No connections"}):a}function N({initialData:e}){let[t,s]=(0,a.useState)(e?.connections||[]),[l,i]=(0,a.useState)(e?.nodes||[]),[o,p]=(0,a.useState)(!e),[x,h]=(0,a.useState)(!1),[g,b]=(0,a.useState)(!1),[y,j]=(0,a.useState)(!1),[T,A]=(0,a.useState)(!1),[I,E]=(0,a.useState)(null),[$,R]=(0,a.useState)(null),O=(0,d.i)(),S=(0,u.C)(e=>e.query),P=(0,u.C)(e=>e.register),U=(0,u.C)(e=>e.unregister);(0,a.useEffect)(()=>(P("Search providers..."),()=>U()),[P,U]);let _=e=>!S.trim()||e.toLowerCase().includes(S.trim().toLowerCase()),z=(e,t)=>[...e].sort(([e,s],[r,a])=>{let l=s.priority??999,i=a.priority??999;if(l!==i)return l-i;let n=M(e,t),o=M(r,t),d=+(n.connected>0),c=+(o.connected>0);return d!==c?c-d:(s.name||"").localeCompare(a.name||"")}),L=(0,a.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch("/api/providers"),fetch("/api/provider-nodes")]);if(!e.ok||!t.ok)throw Error("Failed to fetch provider data");let r=await e.json(),a=await t.json();e.ok&&s(r.connections||[]),t.ok&&i(a.nodes||[])}catch(e){O.error("Failed to fetch provider data")}finally{p(!1)}},[O]);(0,a.useEffect)(()=>{e?.connections?p(!1):L()},[e,L]);let M=(e,s)=>{let r=Array.isArray(s)?s:[s],a=t.filter(t=>t.provider===e&&r.includes(t.authType)),l=e=>{let t=Object.entries(e).some(([e,t])=>e.startsWith("modelLock_")&&t&&new Date(t).getTime()>Date.now());return"unavailable"!==e.testStatus||t?e.testStatus:"active"},i=a.filter(e=>{let t=l(e);return"active"===t||"success"===t}).length,n=a.filter(e=>{let t=l(e);return"error"===t||"expired"===t||"unavailable"===t}),o=n.length,d=a.length,c=d>0&&a.every(e=>!1===e.isActive),m=n.sort((e,t)=>new Date(t.lastErrorAt||0)-new Date(e.lastErrorAt||0))[0];return{connected:i,error:o,total:d,errorCode:m?function(e){if(!e)return null;let t=e.lastErrorType;if("runtime_error"===t)return"RUNTIME";if("upstream_auth_error"===t||"auth_missing"===t||"token_refresh_failed"===t||"token_expired"===t)return"AUTH";if("upstream_rate_limited"===t)return"429";if("upstream_unavailable"===t)return"5XX";if("network_error"===t)return"NET";let s=Number(e.errorCode);if(Number.isFinite(s)&&s>=400)return String(s);let r=function(e){if(!e)return null;let t=e.match(/\b([45]\d{2})\b/);return t?t[1]:"ERR"}(e.lastError);if("401"===r||"403"===r)return"AUTH";if(r&&"ERR"!==r)return r;let a=(e.lastError||"").toLowerCase();return a.includes("runtime")||a.includes("not runnable")||a.includes("not installed")?"RUNTIME":a.includes("invalid api key")||a.includes("token invalid")||a.includes("revoked")||a.includes("unauthorized")?"AUTH":"ERR"}(m):null,errorTime:m?.lastErrorAt?function(e){if(!e)return"";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let s=Math.floor(t/60);if(s<24)return`${s}h ago`;let r=Math.floor(s/24);return`${r}d ago`}(m.lastErrorAt):null,allDisabled:c}},q=async(e,r,a)=>{let l=Array.isArray(r)?r:[r],i=t=>t.provider===e&&l.includes(t.authType),n=t.filter(i);s(e=>e.map(e=>i(e)?{...e,isActive:a}:e)),await Promise.allSettled(n.map(e=>fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:a})})))},F=async(e,t=null)=>{if(!I){E("provider"===e?t:e),R(null);try{let s=await fetch("/api/providers/test-batch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e,providerId:t})}),r=await s.json();if(R(r),r.summary){let{passed:e,failed:t,total:s}=r.summary;0===t?O.success(`All ${s} tests passed`):O.warning(`${e}/${s} passed, ${t} failed`)}}catch(e){R({error:"Test request failed"}),O.error("Provider test failed")}finally{E(null)}}},D=l.filter(e=>"openai-compatible"===e.type).map(e=>({id:e.id,name:e.name||"OpenAI Compatible",color:"#10A37F",textIcon:"OC",apiType:e.apiType})).filter(e=>_(e.name)),B=l.filter(e=>"anthropic-compatible"===e.type).map(e=>({id:e.id,name:e.name||"Anthropic Compatible",color:"#D97757",textIcon:"AC"})).filter(e=>_(e.name)),K=z(Object.entries(c.zN).filter(([,e])=>!e.hidden&&_(e.name)),"oauth"),H=Object.entries(m.IS).filter(([,e])=>!e.hidden&&_(e.name)).sort(([,e],[,t])=>!!t.noAuth-!!e.noAuth),J=z(Object.entries(m.nJ).filter(([,e])=>!e.hidden&&_(e.name)&&(e.serviceKinds??["llm"]).includes("llm")),"freeTier").sort(([,e],[,t])=>!!t.noAuth-!!e.noAuth),W=Object.entries(c.fg).filter(([,e])=>!e.hidden&&(e.serviceKinds??["llm"]).includes("llm")&&_(e.name)).sort(([e,t],[s,r])=>{let a=M(e,"apikey").total>0?0:1,l=M(s,"apikey").total>0?0:1;return a!==l?a-l:(t.name||"").localeCompare(r.name||"")}),Q=!!S.trim(),X=Q||x?W:W.slice(0,20),Z=W.length-20;if(o)return(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsx)(n.Qv,{}),(0,r.jsx)(n.Qv,{})]});let V=!S.trim()||K.length>0||H.length>0||J.length>0||W.length>0||D.length>0||B.length>0;return(0,r.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[!V&&(0,r.jsxs)("div",{className:"text-center py-8 border border-dashed border-border rounded-xl",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[32px] text-text-muted mb-2",children:"search_off"}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:"No providers match your search"})]}),K.length>0&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsx)("h2",{className:"text-lg sm:text-xl font-semibold flex items-center gap-2 leading-tight",children:"OAuth Providers"}),(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,r.jsx)(f,{}),(0,r.jsxs)("button",{onClick:()=>F("oauth"),disabled:!!I,className:`flex w-full items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs font-medium transition-colors sm:w-auto sm:py-1.5 ${"oauth"===I?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all OAuth connections","aria-label":"Test all OAuth connections",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px]${"oauth"===I?" animate-spin":""}`,children:"play_arrow"}),"oauth"===I?"Testing...":"Test All"]})]})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4",children:K.map(([e,t])=>(0,r.jsx)(w,{providerId:e,provider:t,stats:M(e,"oauth"),authType:"oauth",onToggle:t=>q(e,"oauth",t)},e))})]}),(H.length>0||J.length>0)&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsx)("h2",{className:"text-lg sm:text-xl font-semibold flex items-center gap-2 leading-tight",children:"Free Tier Providers"}),(0,r.jsxs)("button",{onClick:()=>F("free"),disabled:!!I,className:`flex w-full items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs font-medium transition-colors sm:w-auto sm:py-1.5 ${"free"===I?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all Free connections","aria-label":"Test all Free provider connections",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px]${"free"===I?" animate-spin":""}`,children:"play_arrow"}),"free"===I?"Testing...":"Test All"]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4",children:[H.map(([e,t])=>{let s="kiro"===e?["oauth","apikey","api_key"]:"oauth";return(0,r.jsx)(w,{providerId:e,provider:t,stats:M(e,s),authType:"free",onToggle:t=>q(e,s,t)},e)}),J.map(([e,t])=>(0,r.jsx)(k,{providerId:e,provider:t,stats:M(e,"apikey"),authType:"apikey",onToggle:t=>q(e,"apikey",t)},e))]})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h2",{className:"text-lg sm:text-xl font-semibold flex items-center gap-2 leading-tight",children:"API Key Providers"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Built-in providers plus your own OpenAI- or Anthropic-compatible endpoints."})]}),(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(n.$n,{size:"sm",icon:"add",onClick:()=>A(e=>!e),className:"w-full sm:w-auto",children:"Add custom provider"}),T&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"fixed inset-0 z-40 cursor-default","aria-label":"Close menu",onClick:()=>A(!1)}),(0,r.jsxs)("div",{className:"absolute right-0 top-full z-50 mt-1 w-64 rounded-xl border border-border bg-surface p-1 shadow-xl",children:[(0,r.jsxs)("button",{type:"button",className:"flex w-full items-start gap-2 rounded-lg px-3 py-2.5 text-left text-sm transition-colors hover:bg-bg",onClick:()=>{A(!1),b(!0)},children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary mt-0.5",children:"api"}),(0,r.jsxs)("span",{children:[(0,r.jsx)("span",{className:"block font-medium",children:"OpenAI compatible"}),(0,r.jsx)("span",{className:"block text-xs text-text-muted",children:"Any OpenAI-style base URL + API key"})]})]}),(0,r.jsxs)("button",{type:"button",className:"flex w-full items-start gap-2 rounded-lg px-3 py-2.5 text-left text-sm transition-colors hover:bg-bg",onClick:()=>{A(!1),j(!0)},children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary mt-0.5",children:"psychology"}),(0,r.jsxs)("span",{children:[(0,r.jsx)("span",{className:"block font-medium",children:"Anthropic compatible"}),(0,r.jsx)("span",{className:"block text-xs text-text-muted",children:"Messages API base URL + API key"})]})]})]})]})]}),W.length>0&&(0,r.jsxs)("button",{onClick:()=>F("apikey"),disabled:!!I,className:`flex w-full items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs font-medium transition-colors sm:w-auto sm:py-1.5 ${"apikey"===I?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all API Key connections","aria-label":"Test all API Key connections",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px]${"apikey"===I?" animate-spin":""}`,children:"play_arrow"}),"apikey"===I?"Testing...":"Test All"]})]})]}),(D.length>0||B.length>0)&&(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Your custom providers"}),(0,r.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4",children:[...D,...B].map(e=>(0,r.jsx)(k,{providerId:e.id,provider:e,stats:M(e.id,"apikey"),authType:"compatible",onToggle:t=>q(e.id,"apikey",t)},e.id))})]}),0===D.length&&0===B.length&&0===W.length&&(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 py-8 border border-dashed border-border rounded-xl text-text-muted text-sm",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[28px]",children:"extension"}),(0,r.jsx)("p",{children:"No API key providers yet."}),(0,r.jsx)(n.$n,{size:"sm",icon:"add",onClick:()=>b(!0),children:"Add custom provider"})]}),X.length>0&&(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(D.length>0||B.length>0)&&(0,r.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Built-in providers"}),(0,r.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4",children:X.map(([e,t])=>(0,r.jsx)(k,{providerId:e,provider:t,stats:M(e,"apikey"),authType:"apikey",onToggle:t=>q(e,"apikey",t)},e))})]}),!Q&&!x&&Z>0&&(0,r.jsxs)("button",{onClick:()=>h(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-primary/40 px-3 py-2.5 text-sm font-medium text-primary transition-colors hover:border-primary hover:bg-primary/5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"expand_more"}),"Show all ",W.length," providers"]})]}),(0,r.jsx)(v,{variant:"openai",isOpen:g,onClose:()=>b(!1),onCreated:e=>{i(t=>[...t,e]),b(!1)}}),(0,r.jsx)(v,{variant:"anthropic",isOpen:y,onClose:()=>j(!1),onCreated:e=>{i(t=>[...t,e]),j(!1)}}),$&&(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-start justify-center px-3 pt-[6vh] sm:pt-[10vh]",onClick:()=>R(null),children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),(0,r.jsxs)("div",{className:"relative bg-surface border border-border rounded-xl w-full max-w-[600px] max-h-[86vh] sm:max-h-[80vh] overflow-y-auto shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"sticky top-0 z-10 flex items-center justify-between px-5 py-3 border-b border-border bg-surface/95 backdrop-blur-sm rounded-t-xl",children:[(0,r.jsx)("h3",{className:"font-semibold",children:"Test Results"}),(0,r.jsx)("button",{onClick:()=>R(null),className:"p-1 rounded-lg hover:bg-bg text-text-muted hover:text-text-main transition-colors","aria-label":"Close test results",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]}),(0,r.jsx)("div",{className:"p-5",children:(0,r.jsx)(C,{results:$})})]})]})]})}function w({providerId:e,provider:t,stats:s,authType:a,onToggle:l}){let{connected:i,error:d,errorCode:c,errorTime:m,allDisabled:p}=s,u=!!t.noAuth;return(0,r.jsx)(x(),{href:`/dashboard/providers/${e}`,className:"group min-w-0",children:(0,r.jsx)(n.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${p?"opacity-50":""}`,children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 shrink-0 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color?.length>7?t.color:t.color+"15"}`},children:(0,r.jsx)(o.A,{src:`/providers/${t.id}.png`,alt:t.name,size:30,className:"object-contain rounded-lg max-w-[32px] max-h-[32px]",fallbackText:t.textIcon||t.id.slice(0,2).toUpperCase(),fallbackColor:t.color})}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h3",{className:"truncate font-semibold",children:t.name}),(0,r.jsx)("div",{className:"flex min-w-0 items-center gap-1.5 text-xs flex-wrap",children:p?(0,r.jsx)(n.Ex,{variant:"default",size:"sm",children:(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"pause_circle"}),"Disabled"]})}):u?(0,r.jsx)(n.Ex,{variant:"success",size:"sm",dot:!0,children:"Ready"}):(0,r.jsxs)(r.Fragment,{children:[j(i,d,c),m&&(0,r.jsx)("span",{className:"text-text-muted",children:m})]})})]})]}),(0,r.jsx)("div",{className:"flex shrink-0 items-center gap-2",children:s.total>0&&(0,r.jsx)("div",{className:"opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(!!p)},children:(0,r.jsx)(n.lM,{size:"sm",checked:!p,onChange:()=>{},title:p?"Enable provider":"Disable provider"})})})]})})})}function k({providerId:e,provider:t,stats:s,authType:a,onToggle:l}){let{connected:i,error:d,errorCode:c,errorTime:p,allDisabled:u}=s,h=e.startsWith(m.JH),f=e.startsWith(m.DI);return(0,r.jsx)(x(),{href:`/dashboard/providers/${e}`,className:"group min-w-0",children:(0,r.jsx)(n.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${u?"opacity-50":""}`,children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 shrink-0 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color?.length>7?t.color:t.color+"15"}`},children:(0,r.jsx)(o.A,{src:h?"responses"===t.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":f?"/providers/anthropic-m.png":`/providers/${t.id}.png`,alt:t.name,size:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",fallbackText:t.textIcon||t.id.slice(0,2).toUpperCase(),fallbackColor:t.color})}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h3",{className:"truncate font-semibold",children:t.name}),(0,r.jsx)("div",{className:"flex min-w-0 items-center gap-1.5 text-xs flex-wrap",children:u?(0,r.jsx)(n.Ex,{variant:"default",size:"sm",children:(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"pause_circle"}),"Disabled"]})}):(0,r.jsxs)(r.Fragment,{children:[j(i,d,c),h&&(0,r.jsx)(n.Ex,{variant:"default",size:"sm",children:"responses"===t.apiType?"Responses":"Chat"}),f&&(0,r.jsx)(n.Ex,{variant:"default",size:"sm",children:"Messages"}),p&&(0,r.jsx)("span",{className:"text-text-muted",children:p})]})})]})]}),(0,r.jsx)("div",{className:"flex shrink-0 items-center gap-2",children:s.total>0&&(0,r.jsx)("div",{className:"opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(!!u)},children:(0,r.jsx)(n.lM,{size:"sm",checked:!u,onChange:()=>{},title:u?"Enable provider":"Disable provider"})})})]})})})}function C({results:e}){if(e.error&&!e.results)return(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-red-500 text-[32px] mb-2 block",children:"error"}),(0,r.jsx)("p",{className:"text-sm text-red-400",children:e.error})]});let{summary:t,mode:s}=e,a=e.results||[];return(0,r.jsxs)("div",{className:"flex min-w-0 flex-col gap-3",children:[t&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs mb-1 sm:gap-3",children:[(0,r.jsxs)("span",{className:"text-text-muted",children:[{oauth:"OAuth",free:"Free",apikey:"API Key",provider:"Provider",all:"All"}[s]||s," Test"]}),(0,r.jsxs)("span",{className:"px-2 py-0.5 rounded bg-emerald-500/15 text-emerald-400 font-medium",children:[t.passed," passed"]}),t.failed>0&&(0,r.jsxs)("span",{className:"px-2 py-0.5 rounded bg-red-500/15 text-red-400 font-medium",children:[t.failed," failed"]}),(0,r.jsxs)("span",{className:"text-text-muted sm:ml-auto",children:[t.total," tested"]})]}),a.map((e,t)=>(0,r.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2 rounded-lg bg-black/[0.03] px-3 py-2 text-xs dark:bg-white/[0.03] sm:flex-nowrap",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[16px] ${e.valid?"text-emerald-500":"text-red-500"}`,children:e.valid?"check_circle":"error"}),(0,r.jsxs)("div",{className:"min-w-0 flex-[1_1_160px]",children:[(0,r.jsx)("span",{className:"block truncate font-medium sm:inline",children:e.connectionName}),(0,r.jsxs)("span",{className:"block truncate text-text-muted sm:ml-1.5 sm:inline",children:["(",e.provider,")"]})]}),void 0!==e.latencyMs&&(0,r.jsxs)("span",{className:"shrink-0 text-text-muted font-mono tabular-nums",children:[e.latencyMs,"ms"]}),(0,r.jsx)("span",{className:`shrink-0 text-[10px] uppercase font-bold px-1.5 py-0.5 rounded ${e.valid?"bg-emerald-500/15 text-emerald-400":"bg-red-500/15 text-red-400"}`,children:e.valid?"OK":e.diagnosis?.type||"ERROR"})]},e.connectionId||t)),0===a.length&&(0,r.jsx)("div",{className:"text-center py-4 text-text-muted text-sm",children:"No active connections found for this group."})]})}v.propTypes={variant:i().oneOf(["openai","anthropic"]).isRequired,isOpen:i().bool.isRequired,onClose:i().func.isRequired,onCreated:i().func.isRequired},w.propTypes={providerId:i().string.isRequired,provider:i().shape({id:i().string.isRequired,name:i().string.isRequired,color:i().string,textIcon:i().string}).isRequired,stats:i().shape({connected:i().number,error:i().number,errorCode:i().string,errorTime:i().string}).isRequired,authType:i().string,onToggle:i().func},k.propTypes={providerId:i().string.isRequired,provider:i().shape({id:i().string.isRequired,name:i().string.isRequired,color:i().string,textIcon:i().string,apiType:i().string}).isRequired,stats:i().shape({connected:i().number,error:i().number,errorCode:i().string,errorTime:i().string}).isRequired,authType:i().string,onToggle:i().func},C.propTypes={results:i().shape({mode:i().string,results:i().array,summary:i().shape({total:i().number,passed:i().number,failed:i().number}),error:i().string}).isRequired}},93979:(e,t,s)=>{Promise.resolve().then(s.bind(s,18964))}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=93979)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8460],{18964:(e,t,s)=>{"use strict";s.d(t,{default:()=>N});var r=s(95155),a=s(12115),l=s(14051),i=s.n(l),n=s(35497),o=s(57250),d=s(65921),c=s(90620),m=s(88105),p=s(98500),x=s.n(p),u=s(38003);let h={available:{icon:"check_circle",color:"#22c55e",label:"Available"},cooldown:{icon:"schedule",color:"#f59e0b",label:"Cooldown"},unavailable:{icon:"error",color:"#ef4444",label:"Unavailable"},unknown:{icon:"help",color:"#6b7280",label:"Unknown"}};function f(){let[e,t]=(0,a.useState)(null),[s,l]=(0,a.useState)(!0),[i,o]=(0,a.useState)(!1),[c,m]=(0,a.useState)(null),p=(0,a.useRef)(null),x=(0,d.i)(),u=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/availability");if(e.ok){let s=await e.json();t(s)}}catch{}finally{l(!1)}},[]);(0,a.useEffect)(()=>{u();let e=setInterval(u,3e4);return()=>clearInterval(e)},[u]),(0,a.useEffect)(()=>{let e=e=>{p.current&&!p.current.contains(e.target)&&o(!1)};return i&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);let f=async(e,t)=>{m(`${e}:${t}`);try{(await fetch("/api/models/availability",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clearCooldown",provider:e,model:t})})).ok?(x.success(`Cooldown cleared for ${t}`),await u()):x.error("Failed to clear cooldown")}catch{x.error("Failed to clear cooldown")}finally{m(null)}};if(s)return null;let g=e?.models||[],b=0===(e?.unavailableCount||g.filter(e=>"available"!==e.status).length),y={};return g.forEach(e=>{if("available"===e.status)return;let t=e.provider||"unknown";y[t]||(y[t]=[]),y[t].push(e)}),(0,r.jsx)("div",{className:"relative",ref:p,children:i&&(0,r.jsxs)("div",{className:"absolute top-full right-0 mt-2 w-80 bg-surface border border-border rounded-xl shadow-2xl z-50 overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-bg",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",style:{color:b?"#22c55e":"#f59e0b"},children:b?"verified":"warning"}),(0,r.jsx)("span",{className:"text-sm font-semibold text-text-main",children:"Model Status"})]}),(0,r.jsx)("button",{onClick:u,className:"p-1 rounded-lg hover:bg-surface text-text-muted hover:text-text-main transition-colors",title:"Refresh",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"})})]}),(0,r.jsx)("div",{className:"px-4 py-3 max-h-60 overflow-y-auto",children:b?(0,r.jsx)("p",{className:"text-sm text-text-muted text-center py-2",children:"All models are responding normally."}):(0,r.jsx)("div",{className:"flex flex-col gap-2.5",children:Object.entries(y).map(([e,t])=>(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs font-semibold text-text-main mb-1.5 capitalize",children:e}),(0,r.jsx)("div",{className:"flex flex-col gap-1",children:t.map(e=>{let t=h[e.status]||h.unknown,s=c===`${e.provider}:${e.model}`;return(0,r.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5 rounded-lg bg-surface/30",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] shrink-0",style:{color:t.color},children:t.icon}),(0,r.jsx)("span",{className:"font-mono text-xs text-text-main truncate",children:e.model})]}),"cooldown"===e.status&&(0,r.jsx)(n.$n,{size:"sm",variant:"ghost",onClick:()=>f(e.provider,e.model),disabled:s,className:"text-[10px] px-1.5! py-0.5! ml-2",children:s?"...":"Clear"})]},`${e.provider}-${e.model}`)})})]},e))})})]})})}var g=s(78559);let b={openai:{title:"Add OpenAI Compatible",type:"openai-compatible",defaultBaseUrl:"https://api.openai.com/v1",namePlaceholder:"My LiteLLM / OpenRouter / vLLM",baseUrlHint:"Base URL ending in /v1 for your OpenAI-compatible API.",modelIdPlaceholder:"e.g. gpt-4, claude-3-opus",errorLabel:"OpenAI Compatible",hasApiType:!0},anthropic:{title:"Add Anthropic Compatible",type:"anthropic-compatible",defaultBaseUrl:"https://api.anthropic.com/v1",namePlaceholder:"My Claude proxy",baseUrlHint:"Base URL ending in /v1. /messages is appended automatically.",modelIdPlaceholder:"e.g. claude-3-opus",errorLabel:"Anthropic Compatible",hasApiType:!1}},y=[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}];function v({variant:e,isOpen:t,onClose:s,onCreated:l}){let i=b[e],o=()=>({name:"",...i.hasApiType?{apiType:"chat"}:{},baseUrl:i.defaultBaseUrl}),[d,c]=(0,a.useState)(o),[m,p]=(0,a.useState)(!1),[x,u]=(0,a.useState)(""),[h,f]=(0,a.useState)(""),[j,N]=(0,a.useState)(""),[w,k]=(0,a.useState)(!1),[C,T]=(0,a.useState)(null),A=function(e){try{return["http:","https:"].includes(new URL(e).protocol)}catch{return!1}}(d.baseUrl.trim());(0,a.useEffect)(()=>{t&&(c(o()),u(""),f(""),N(""),T(null))},[t,e]),(0,a.useEffect)(()=>{i.hasApiType&&t&&c(e=>({...e,baseUrl:i.defaultBaseUrl}))},[d.apiType]);let I=async()=>{if(!d.name.trim()||!A)return void u("Enter a valid http:// or https:// base URL");p(!0),u("");try{let e=await fetch("/api/provider-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:d.name.trim(),...i.hasApiType?{apiType:d.apiType}:{},baseUrl:d.baseUrl.trim(),type:i.type})}),t=await e.json();e.ok?(l(t.node),c(o()),f(""),T(null)):u(t.error||"Failed to create provider")}catch(e){(0,g.s)(`Error creating ${i.errorLabel} node:`,e),u("Network error")}finally{p(!1)}},E=async()=>{k(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:d.baseUrl,apiKey:h,type:i.type,modelId:j.trim()||void 0})}),t=await e.json();T(t)}catch{T({valid:!1,error:"Network error"})}finally{k(!1)}};return(0,r.jsx)(n.aF,{isOpen:t,title:i.title,onClose:s,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(n.pd,{label:"Name",value:d.name,onChange:e=>c({...d,name:e.target.value}),placeholder:i.namePlaceholder,hint:"Friendly label (e.g. Work LiteLLM)."}),i.hasApiType&&(0,r.jsx)(n.l6,{label:"API Type",options:y,value:d.apiType,onChange:e=>c({...d,apiType:e.target.value})}),(0,r.jsx)(n.pd,{label:"Base URL",value:d.baseUrl,onChange:e=>c({...d,baseUrl:e.target.value}),placeholder:i.defaultBaseUrl,hint:i.baseUrlHint}),(0,r.jsx)(n.pd,{label:"API Key (for Check)",type:"password",autoComplete:"off",value:h,onChange:e=>f(e.target.value)}),(0,r.jsx)(n.pd,{label:"Model ID (optional)",value:j,onChange:e=>N(e.target.value),placeholder:i.modelIdPlaceholder,hint:"If the provider has no /models endpoint, enter a model ID to test chat/completions."}),(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[(0,r.jsx)(n.$n,{onClick:E,disabled:!h||w||!A,variant:"secondary",className:"w-full sm:w-auto",children:w?"Checking...":"Check"}),(()=>{if(!C)return null;let{valid:e,error:t,method:s}=C;return e?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.Ex,{variant:"success",children:"Valid"}),"chat"===s&&(0,r.jsx)("span",{className:"text-sm text-text-muted",children:"(via inference test)"})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)(n.Ex,{variant:"error",children:"Invalid"}),t&&(0,r.jsx)("span",{className:"text-sm text-red-500",children:t})]})})()]}),x?(0,r.jsx)("p",{className:"text-sm text-red-500",children:x}):null,(0,r.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[(0,r.jsx)(n.$n,{onClick:I,fullWidth:!0,disabled:!d.name.trim()||!A||m,children:m?"Creating...":"Create"}),(0,r.jsx)(n.$n,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function j(e,t,s){let a=[];if(e>0&&a.push((0,r.jsxs)(n.Ex,{variant:"success",size:"sm",dot:!0,children:[e," Connected"]},"connected")),t>0){let e=s?`${t} Error (${s})`:`${t} Error`;a.push((0,r.jsx)(n.Ex,{variant:"error",size:"sm",dot:!0,children:e},"error"))}return 0===a.length?(0,r.jsx)("span",{className:"text-text-muted",children:"No connections"}):a}function N({initialData:e}){let[t,s]=(0,a.useState)(e?.connections||[]),[l,i]=(0,a.useState)(e?.nodes||[]),[o,p]=(0,a.useState)(!e),[x,h]=(0,a.useState)(!1),[g,b]=(0,a.useState)(!1),[y,j]=(0,a.useState)(!1),[T,A]=(0,a.useState)(!1),[I,E]=(0,a.useState)(null),[$,R]=(0,a.useState)(null),O=(0,d.i)(),S=(0,u.C)(e=>e.query),P=(0,u.C)(e=>e.register),U=(0,u.C)(e=>e.unregister);(0,a.useEffect)(()=>(P("Search providers..."),()=>U()),[P,U]);let _=e=>!S.trim()||e.toLowerCase().includes(S.trim().toLowerCase()),z=(e,t)=>[...e].sort(([e,s],[r,a])=>{let l=s.priority??999,i=a.priority??999;if(l!==i)return l-i;let n=M(e,t),o=M(r,t),d=+(n.connected>0),c=+(o.connected>0);return d!==c?c-d:(s.name||"").localeCompare(a.name||"")}),L=(0,a.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch("/api/providers"),fetch("/api/provider-nodes")]);if(!e.ok||!t.ok)throw Error("Failed to fetch provider data");let r=await e.json(),a=await t.json();e.ok&&s(r.connections||[]),t.ok&&i(a.nodes||[])}catch(e){O.error("Failed to fetch provider data")}finally{p(!1)}},[O]);(0,a.useEffect)(()=>{e?.connections?p(!1):L()},[e,L]);let M=(e,s)=>{let r=Array.isArray(s)?s:[s],a=t.filter(t=>t.provider===e&&r.includes(t.authType)),l=e=>{let t=Object.entries(e).some(([e,t])=>e.startsWith("modelLock_")&&t&&new Date(t).getTime()>Date.now());return"unavailable"!==e.testStatus||t?e.testStatus:"active"},i=a.filter(e=>{let t=l(e);return"active"===t||"success"===t}).length,n=a.filter(e=>{let t=l(e);return"error"===t||"expired"===t||"unavailable"===t}),o=n.length,d=a.length,c=d>0&&a.every(e=>!1===e.isActive),m=n.sort((e,t)=>new Date(t.lastErrorAt||0)-new Date(e.lastErrorAt||0))[0];return{connected:i,error:o,total:d,errorCode:m?function(e){if(!e)return null;let t=e.lastErrorType;if("runtime_error"===t)return"RUNTIME";if("upstream_auth_error"===t||"auth_missing"===t||"token_refresh_failed"===t||"token_expired"===t)return"AUTH";if("upstream_rate_limited"===t)return"429";if("upstream_unavailable"===t)return"5XX";if("network_error"===t)return"NET";let s=Number(e.errorCode);if(Number.isFinite(s)&&s>=400)return String(s);let r=function(e){if(!e)return null;let t=e.match(/\b([45]\d{2})\b/);return t?t[1]:"ERR"}(e.lastError);if("401"===r||"403"===r)return"AUTH";if(r&&"ERR"!==r)return r;let a=(e.lastError||"").toLowerCase();return a.includes("runtime")||a.includes("not runnable")||a.includes("not installed")?"RUNTIME":a.includes("invalid api key")||a.includes("token invalid")||a.includes("revoked")||a.includes("unauthorized")?"AUTH":"ERR"}(m):null,errorTime:m?.lastErrorAt?function(e){if(!e)return"";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let s=Math.floor(t/60);if(s<24)return`${s}h ago`;let r=Math.floor(s/24);return`${r}d ago`}(m.lastErrorAt):null,allDisabled:c}},q=async(e,r,a)=>{let l=Array.isArray(r)?r:[r],i=t=>t.provider===e&&l.includes(t.authType),n=t.filter(i);s(e=>e.map(e=>i(e)?{...e,isActive:a}:e)),await Promise.allSettled(n.map(e=>fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:a})})))},F=async(e,t=null)=>{if(!I){E("provider"===e?t:e),R(null);try{let s=await fetch("/api/providers/test-batch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e,providerId:t})}),r=await s.json();if(R(r),r.summary){let{passed:e,failed:t,total:s}=r.summary;0===t?O.success(`All ${s} tests passed`):O.warning(`${e}/${s} passed, ${t} failed`)}}catch(e){R({error:"Test request failed"}),O.error("Provider test failed")}finally{E(null)}}},D=l.filter(e=>"openai-compatible"===e.type).map(e=>({id:e.id,name:e.name||"OpenAI Compatible",color:"#10A37F",textIcon:"OC",apiType:e.apiType})).filter(e=>_(e.name)),B=l.filter(e=>"anthropic-compatible"===e.type).map(e=>({id:e.id,name:e.name||"Anthropic Compatible",color:"#D97757",textIcon:"AC"})).filter(e=>_(e.name)),K=z(Object.entries(c.zN).filter(([,e])=>!e.hidden&&_(e.name)),"oauth"),H=Object.entries(m.IS).filter(([,e])=>!e.hidden&&_(e.name)).sort(([,e],[,t])=>!!t.noAuth-!!e.noAuth),J=z(Object.entries(m.nJ).filter(([,e])=>!e.hidden&&_(e.name)&&(e.serviceKinds??["llm"]).includes("llm")),"freeTier").sort(([,e],[,t])=>!!t.noAuth-!!e.noAuth),W=Object.entries(c.fg).filter(([,e])=>!e.hidden&&(e.serviceKinds??["llm"]).includes("llm")&&_(e.name)).sort(([e,t],[s,r])=>{let a=M(e,"apikey").total>0?0:1,l=M(s,"apikey").total>0?0:1;return a!==l?a-l:(t.name||"").localeCompare(r.name||"")}),Q=!!S.trim(),X=Q||x?W:W.slice(0,20),Z=W.length-20;if(o)return(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsx)(n.Qv,{}),(0,r.jsx)(n.Qv,{})]});let V=!S.trim()||K.length>0||H.length>0||J.length>0||W.length>0||D.length>0||B.length>0;return(0,r.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[!V&&(0,r.jsxs)("div",{className:"text-center py-8 border border-dashed border-border rounded-xl",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[32px] text-text-muted mb-2",children:"search_off"}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:"No providers match your search"})]}),K.length>0&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsx)("h2",{className:"text-lg sm:text-xl font-semibold flex items-center gap-2 leading-tight",children:"OAuth Providers"}),(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,r.jsx)(f,{}),(0,r.jsxs)("button",{onClick:()=>F("oauth"),disabled:!!I,className:`flex w-full items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs font-medium transition-colors sm:w-auto sm:py-1.5 ${"oauth"===I?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all OAuth connections","aria-label":"Test all OAuth connections",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px]${"oauth"===I?" animate-spin":""}`,children:"play_arrow"}),"oauth"===I?"Testing...":"Test All"]})]})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4",children:K.map(([e,t])=>(0,r.jsx)(w,{providerId:e,provider:t,stats:M(e,"oauth"),authType:"oauth",onToggle:t=>q(e,"oauth",t)},e))})]}),(H.length>0||J.length>0)&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsx)("h2",{className:"text-lg sm:text-xl font-semibold flex items-center gap-2 leading-tight",children:"Free Tier Providers"}),(0,r.jsxs)("button",{onClick:()=>F("free"),disabled:!!I,className:`flex w-full items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs font-medium transition-colors sm:w-auto sm:py-1.5 ${"free"===I?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all Free connections","aria-label":"Test all Free provider connections",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px]${"free"===I?" animate-spin":""}`,children:"play_arrow"}),"free"===I?"Testing...":"Test All"]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4",children:[H.map(([e,t])=>{let s="kiro"===e?["oauth","apikey","api_key"]:"oauth";return(0,r.jsx)(w,{providerId:e,provider:t,stats:M(e,s),authType:"free",onToggle:t=>q(e,s,t)},e)}),J.map(([e,t])=>(0,r.jsx)(k,{providerId:e,provider:t,stats:M(e,"apikey"),authType:"apikey",onToggle:t=>q(e,"apikey",t)},e))]})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h2",{className:"text-lg sm:text-xl font-semibold flex items-center gap-2 leading-tight",children:"API Key Providers"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Built-in providers plus your own OpenAI- or Anthropic-compatible endpoints."})]}),(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(n.$n,{size:"sm",icon:"add",onClick:()=>A(e=>!e),className:"w-full sm:w-auto",children:"Add custom provider"}),T&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"fixed inset-0 z-40 cursor-default","aria-label":"Close menu",onClick:()=>A(!1)}),(0,r.jsxs)("div",{className:"absolute right-0 top-full z-50 mt-1 w-64 rounded-xl border border-border bg-surface p-1 shadow-xl",children:[(0,r.jsxs)("button",{type:"button",className:"flex w-full items-start gap-2 rounded-lg px-3 py-2.5 text-left text-sm transition-colors hover:bg-bg",onClick:()=>{A(!1),b(!0)},children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary mt-0.5",children:"api"}),(0,r.jsxs)("span",{children:[(0,r.jsx)("span",{className:"block font-medium",children:"OpenAI compatible"}),(0,r.jsx)("span",{className:"block text-xs text-text-muted",children:"Any OpenAI-style base URL + API key"})]})]}),(0,r.jsxs)("button",{type:"button",className:"flex w-full items-start gap-2 rounded-lg px-3 py-2.5 text-left text-sm transition-colors hover:bg-bg",onClick:()=>{A(!1),j(!0)},children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary mt-0.5",children:"psychology"}),(0,r.jsxs)("span",{children:[(0,r.jsx)("span",{className:"block font-medium",children:"Anthropic compatible"}),(0,r.jsx)("span",{className:"block text-xs text-text-muted",children:"Messages API base URL + API key"})]})]})]})]})]}),W.length>0&&(0,r.jsxs)("button",{onClick:()=>F("apikey"),disabled:!!I,className:`flex w-full items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs font-medium transition-colors sm:w-auto sm:py-1.5 ${"apikey"===I?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all API Key connections","aria-label":"Test all API Key connections",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px]${"apikey"===I?" animate-spin":""}`,children:"play_arrow"}),"apikey"===I?"Testing...":"Test All"]})]})]}),(D.length>0||B.length>0)&&(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Your custom providers"}),(0,r.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4",children:[...D,...B].map(e=>(0,r.jsx)(k,{providerId:e.id,provider:e,stats:M(e.id,"apikey"),authType:"compatible",onToggle:t=>q(e.id,"apikey",t)},e.id))})]}),0===D.length&&0===B.length&&0===W.length&&(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 py-8 border border-dashed border-border rounded-xl text-text-muted text-sm",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[28px]",children:"extension"}),(0,r.jsx)("p",{children:"No API key providers yet."}),(0,r.jsx)(n.$n,{size:"sm",icon:"add",onClick:()=>b(!0),children:"Add custom provider"})]}),X.length>0&&(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(D.length>0||B.length>0)&&(0,r.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Built-in providers"}),(0,r.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4",children:X.map(([e,t])=>(0,r.jsx)(k,{providerId:e,provider:t,stats:M(e,"apikey"),authType:"apikey",onToggle:t=>q(e,"apikey",t)},e))})]}),!Q&&!x&&Z>0&&(0,r.jsxs)("button",{onClick:()=>h(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-primary/40 px-3 py-2.5 text-sm font-medium text-primary transition-colors hover:border-primary hover:bg-primary/5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"expand_more"}),"Show all ",W.length," providers"]})]}),(0,r.jsx)(v,{variant:"openai",isOpen:g,onClose:()=>b(!1),onCreated:e=>{i(t=>[...t,e]),b(!1)}}),(0,r.jsx)(v,{variant:"anthropic",isOpen:y,onClose:()=>j(!1),onCreated:e=>{i(t=>[...t,e]),j(!1)}}),$&&(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-start justify-center px-3 pt-[6vh] sm:pt-[10vh]",onClick:()=>R(null),children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),(0,r.jsxs)("div",{className:"relative bg-surface border border-border rounded-xl w-full max-w-[600px] max-h-[86vh] sm:max-h-[80vh] overflow-y-auto shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"sticky top-0 z-10 flex items-center justify-between px-5 py-3 border-b border-border bg-surface/95 backdrop-blur-sm rounded-t-xl",children:[(0,r.jsx)("h3",{className:"font-semibold",children:"Test Results"}),(0,r.jsx)("button",{onClick:()=>R(null),className:"p-1 rounded-lg hover:bg-bg text-text-muted hover:text-text-main transition-colors","aria-label":"Close test results",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]}),(0,r.jsx)("div",{className:"p-5",children:(0,r.jsx)(C,{results:$})})]})]})]})}function w({providerId:e,provider:t,stats:s,authType:a,onToggle:l}){let{connected:i,error:d,errorCode:c,errorTime:m,allDisabled:p}=s,u=!!t.noAuth;return(0,r.jsx)(x(),{href:`/dashboard/providers/${e}`,className:"group min-w-0",children:(0,r.jsx)(n.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${p?"opacity-50":""}`,children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 shrink-0 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color?.length>7?t.color:t.color+"15"}`},children:(0,r.jsx)(o.A,{src:`/providers/${t.id}.png`,alt:t.name,size:30,className:"object-contain rounded-lg max-w-[32px] max-h-[32px]",fallbackText:t.textIcon||t.id.slice(0,2).toUpperCase(),fallbackColor:t.color})}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h3",{className:"truncate font-semibold",children:t.name}),(0,r.jsx)("div",{className:"flex min-w-0 items-center gap-1.5 text-xs flex-wrap",children:p?(0,r.jsx)(n.Ex,{variant:"default",size:"sm",children:(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"pause_circle"}),"Disabled"]})}):u?(0,r.jsx)(n.Ex,{variant:"success",size:"sm",dot:!0,children:"Ready"}):(0,r.jsxs)(r.Fragment,{children:[j(i,d,c),m&&(0,r.jsx)("span",{className:"text-text-muted",children:m})]})})]})]}),(0,r.jsx)("div",{className:"flex shrink-0 items-center gap-2",children:s.total>0&&(0,r.jsx)("div",{className:"opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(!!p)},children:(0,r.jsx)(n.lM,{size:"sm",checked:!p,onChange:()=>{},title:p?"Enable provider":"Disable provider"})})})]})})})}function k({providerId:e,provider:t,stats:s,authType:a,onToggle:l}){let{connected:i,error:d,errorCode:c,errorTime:p,allDisabled:u}=s,h=e.startsWith(m.JH),f=e.startsWith(m.DI);return(0,r.jsx)(x(),{href:`/dashboard/providers/${e}`,className:"group min-w-0",children:(0,r.jsx)(n.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${u?"opacity-50":""}`,children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 shrink-0 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color?.length>7?t.color:t.color+"15"}`},children:(0,r.jsx)(o.A,{src:h?"responses"===t.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":f?"/providers/anthropic-m.png":`/providers/${t.id}.png`,alt:t.name,size:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",fallbackText:t.textIcon||t.id.slice(0,2).toUpperCase(),fallbackColor:t.color})}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h3",{className:"truncate font-semibold",children:t.name}),(0,r.jsx)("div",{className:"flex min-w-0 items-center gap-1.5 text-xs flex-wrap",children:u?(0,r.jsx)(n.Ex,{variant:"default",size:"sm",children:(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"pause_circle"}),"Disabled"]})}):(0,r.jsxs)(r.Fragment,{children:[j(i,d,c),h&&(0,r.jsx)(n.Ex,{variant:"default",size:"sm",children:"responses"===t.apiType?"Responses":"Chat"}),f&&(0,r.jsx)(n.Ex,{variant:"default",size:"sm",children:"Messages"}),p&&(0,r.jsx)("span",{className:"text-text-muted",children:p})]})})]})]}),(0,r.jsx)("div",{className:"flex shrink-0 items-center gap-2",children:s.total>0&&(0,r.jsx)("div",{className:"opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(!!u)},children:(0,r.jsx)(n.lM,{size:"sm",checked:!u,onChange:()=>{},title:u?"Enable provider":"Disable provider"})})})]})})})}function C({results:e}){if(e.error&&!e.results)return(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-red-500 text-[32px] mb-2 block",children:"error"}),(0,r.jsx)("p",{className:"text-sm text-red-400",children:e.error})]});let{summary:t,mode:s}=e,a=e.results||[];return(0,r.jsxs)("div",{className:"flex min-w-0 flex-col gap-3",children:[t&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs mb-1 sm:gap-3",children:[(0,r.jsxs)("span",{className:"text-text-muted",children:[{oauth:"OAuth",free:"Free",apikey:"API Key",provider:"Provider",all:"All"}[s]||s," Test"]}),(0,r.jsxs)("span",{className:"px-2 py-0.5 rounded bg-emerald-500/15 text-emerald-400 font-medium",children:[t.passed," passed"]}),t.failed>0&&(0,r.jsxs)("span",{className:"px-2 py-0.5 rounded bg-red-500/15 text-red-400 font-medium",children:[t.failed," failed"]}),(0,r.jsxs)("span",{className:"text-text-muted sm:ml-auto",children:[t.total," tested"]})]}),a.map((e,t)=>(0,r.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2 rounded-lg bg-black/[0.03] px-3 py-2 text-xs dark:bg-white/[0.03] sm:flex-nowrap",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[16px] ${e.valid?"text-emerald-500":"text-red-500"}`,children:e.valid?"check_circle":"error"}),(0,r.jsxs)("div",{className:"min-w-0 flex-[1_1_160px]",children:[(0,r.jsx)("span",{className:"block truncate font-medium sm:inline",children:e.connectionName}),(0,r.jsxs)("span",{className:"block truncate text-text-muted sm:ml-1.5 sm:inline",children:["(",e.provider,")"]})]}),void 0!==e.latencyMs&&(0,r.jsxs)("span",{className:"shrink-0 text-text-muted font-mono tabular-nums",children:[e.latencyMs,"ms"]}),(0,r.jsx)("span",{className:`shrink-0 text-[10px] uppercase font-bold px-1.5 py-0.5 rounded ${e.valid?"bg-emerald-500/15 text-emerald-400":"bg-red-500/15 text-red-400"}`,children:e.valid?"OK":e.diagnosis?.type||"ERROR"})]},e.connectionId||t)),0===a.length&&(0,r.jsx)("div",{className:"text-center py-4 text-text-muted text-sm",children:"No active connections found for this group."})]})}v.propTypes={variant:i().oneOf(["openai","anthropic"]).isRequired,isOpen:i().bool.isRequired,onClose:i().func.isRequired,onCreated:i().func.isRequired},w.propTypes={providerId:i().string.isRequired,provider:i().shape({id:i().string.isRequired,name:i().string.isRequired,color:i().string,textIcon:i().string}).isRequired,stats:i().shape({connected:i().number,error:i().number,errorCode:i().string,errorTime:i().string}).isRequired,authType:i().string,onToggle:i().func},k.propTypes={providerId:i().string.isRequired,provider:i().shape({id:i().string.isRequired,name:i().string.isRequired,color:i().string,textIcon:i().string,apiType:i().string}).isRequired,stats:i().shape({connected:i().number,error:i().number,errorCode:i().string,errorTime:i().string}).isRequired,authType:i().string,onToggle:i().func},C.propTypes={results:i().shape({mode:i().string,results:i().array,summary:i().shape({total:i().number,passed:i().number,failed:i().number}),error:i().string}).isRequired}},93979:(e,t,s)=>{Promise.resolve().then(s.bind(s,18964))}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=93979)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3826],{17002:(e,t,r)=>{Promise.resolve().then(r.bind(r,75095)),Promise.resolve().then(r.bind(r,25086))},75095:(e,t,r)=>{"use strict";r.d(t,{default:()=>O});var a=r(95155),s=r(12115),i=r(57250),l=r(97650);let n="quotaCacheData",o="quotaAutoRefresh",d=[10,20,50,100],c=[{value:"all",label:"All accounts"},{value:"active",label:"Active"},{value:"inactive",label:"Turned off"}],u=[{value:"default",label:"Default quota order"},{value:"remaining-asc",label:"% quota: low to high"},{value:"remaining-desc",label:"% quota: high to low"}];function x(e){return e.name?.trim()||e.email?.trim()||e.displayName?.trim()||null}function m(e,t){let r=t[e.id]?.quotas?.[0];return r&&"number"==typeof r.remaining?r.remaining:1/0}function h(e){let t={};return e.forEach(e=>{t[e.id]=!0}),t}function b(e,t){let r=new Set(t.map(e=>e.id));return Object.fromEntries(Object.entries(e).filter(([e])=>r.has(e)))}async function p(e,t){return await e(t)}function g(){try{let e=window.localStorage.getItem(n);return e?JSON.parse(e):{}}catch(e){return console.error("Error reading quota cache:",e),{}}}function f(e,t){try{let r=g();r[e]={...t,cachedAt:new Date().toISOString()},window.localStorage.setItem(n,JSON.stringify(r))}catch(e){console.error("Error writing quota cache:",e)}}function y(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}function v({quotas:e=[],compact:t=!1,sortMode:r="default",showSortLabel:i=!1}){let[l,n]=(0,s.useState)(1),o=(0,s.useMemo)(()=>e.map((e,t)=>({...e,index:t,remaining:e?.remaining!==void 0?Math.max(0,Math.round(e.remaining)):e?.remainingPercentage!==void 0?Math.round(e.remainingPercentage):y(e?.used,e?.total)})),[e]),d=(0,s.useMemo)(()=>"remaining-asc"===r?[...o].sort((e,t)=>e.remaining-t.remaining||e.name.localeCompare(t.name)):"remaining-desc"===r?[...o].sort((e,t)=>t.remaining-e.remaining||e.name.localeCompare(t.name)):o,[o,r]),c=Math.max(1,Math.ceil(d.length/10));if((0,s.useEffect)(()=>{n(1)},[r,e]),(0,s.useEffect)(()=>{n(e=>Math.min(e,c))},[c]),!e||0===e.length)return null;let u=d.slice((l-1)*10,10*l),x=0===d.length?0:(l-1)*10+1,m=Math.min(10*l,d.length),h=t?"py-1 px-1.5":"py-2 px-3",b=t?"text-[11px]":"text-sm",p=t?"text-[11px]":"text-sm",g=t?"text-[10px] leading-tight":"text-xs";return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"text-[10px] text-text-muted",children:[d.length," quota",d.length>1?"s":""]}),i&&(0,a.jsx)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1 text-[10px] text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:"Sorted by account remaining"})]}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsx)("table",{className:"w-full table-fixed text-left",children:(0,a.jsx)("tbody",{children:u.map(e=>{var r;let s=(r=e.remaining)>70?{text:"text-green-600 dark:text-green-400",bg:"bg-green-500",bgLight:"bg-green-500/10",emoji:"\uD83D\uDFE2"}:r>=30?{text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-500",bgLight:"bg-yellow-500/10",emoji:"\uD83D\uDFE1"}:{text:"text-red-600 dark:text-red-400",bg:"bg-red-500",bgLight:"bg-red-500/10",emoji:"\uD83D\uDD34"},i=function(e){if(!e)return"-";try{let t="string"==typeof e?new Date(e):e,r=new Date,a=t-r;if(a<=0)return"-";let s=Math.ceil(a/6e4);if(s<60)return`${s}m`;let i=Math.floor(s/60),l=s%60;if(i<24)return`${i}h ${l}m`;let n=Math.floor(i/24);return`${n}d ${i%24}h ${l}m`}catch(e){return"-"}}(e.resetAt),l=function(e){if(!e)return null;try{let t=new Date(e),r=new Date,a=new Date(r.getFullYear(),r.getMonth(),r.getDate()),s=new Date(a);s.setDate(s.getDate()+1);let i="";i=t>=a&&t<s?"Today":t>=s&&t<new Date(s.getTime()+864e5)?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let l=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${i}, ${l}`}catch{return null}}(e.resetAt),n=!1!==e.recurring?`in ${i}`:`expires in ${i}`;return(0,a.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,a.jsx)("td",{className:`${h} w-[30%]`,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,a.jsx)("span",{className:"text-[10px] shrink-0",children:s.emoji}),(0,a.jsx)("span",{className:`${b} font-medium text-text-primary truncate`,children:e.name})]})}),(0,a.jsx)("td",{className:`${h} w-[45%]`,children:(0,a.jsxs)("div",{className:t?"space-y-1":"space-y-1.5",children:[(0,a.jsx)("div",{className:`${t?"h-1":"h-1.5"} rounded-full overflow-hidden border ${s.bgLight} ${0===e.remaining?"border-black/10 dark:border-white/10":"border-transparent"}`,children:(0,a.jsx)("div",{className:`h-full transition-all duration-300 ${s.bg}`,style:{width:`${Math.min(e.remaining,100)}%`}})}),(0,a.jsxs)("div",{className:`flex items-center justify-between ${t?"text-[10px]":"text-xs"}`,children:[(0,a.jsxs)("span",{className:"text-text-muted",children:[e.used.toLocaleString()," / ",e.total>0?e.total.toLocaleString():"∞"]}),(0,a.jsxs)("span",{className:`font-medium ${s.text}`,children:[e.remaining,"%"]})]})]})}),(0,a.jsx)("td",{className:`${h} w-[25%]`,children:"-"!==i||l?t?(0,a.jsx)("div",{className:`${p} text-text-primary font-medium truncate`,title:l||"",children:"-"!==i?n:l}):(0,a.jsxs)("div",{className:"space-y-0.5",children:["-"!==i&&(0,a.jsx)("div",{className:`${p} text-text-primary font-medium`,children:n}),l&&(0,a.jsx)("div",{className:`${g} text-text-muted`,children:l})]}):(0,a.jsx)("div",{className:`${p} text-text-muted italic`,children:"N/A"})})]},`${e.name}-${e.index}`)})})})}),c>1&&(0,a.jsxs)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1.5 dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 text-[10px] text-text-muted",children:[(0,a.jsxs)("span",{children:["Showing ",x,"-",m," of ",d.length]}),(0,a.jsxs)("span",{children:["Page ",l," / ",c]})]}),(0,a.jsxs)("div",{className:"mt-1.5 flex items-center justify-end gap-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>n(e=>Math.max(1,e-1)),disabled:1===l,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Prev"}),(0,a.jsx)("button",{type:"button",onClick:()=>n(e=>Math.min(c,e+1)),disabled:l===c,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Next"})]})]})]})}var j=r(98542),k=r(97677),w=r(84588),N=r(35497),C=r(88105),S=r(11059),A=r(78559),$=r(77251);let E={"builder-id":"AWS Builder ID",idc:"IAM Identity Center",google:"Google",github:"GitHub",imported:"Imported Token",api_key:"API Key"},q={claude:"claudeAutoPing",codex:"codexAutoPing"},P={claude:"When your 5h quota runs out, auto-sends a request the moment it resets so a new window starts right away.",codex:"Auto-starts the next 5h Codex window after reset by sending a tiny gpt-5.5 request. Consumes a small amount of quota."};function D(e){return e.name?.trim()&&e.email?.trim()&&e.name.trim()!==e.email.trim()?e.email.trim():e.name?.trim()&&e.displayName?.trim()&&e.name.trim()!==e.displayName.trim()?e.displayName.trim():null}function T(e){let t=e.providerSpecificData?.region;if(t)return t;let r=e.providerSpecificData?.profileArn;return("string"==typeof r?r.split(":")[3]:"")||""}function M(e){if(!e)return"N/A";let t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):"N/A"}function O(){let{copied:e,copy:t}=(0,S.C)(),[r,O]=(0,s.useState)([]),[I,_]=(0,s.useState)({}),[F,z]=(0,s.useState)({}),[L,R]=(0,s.useState)({}),[U,J]=(0,s.useState)(!0),[K,G]=(0,s.useState)({claude:{},codex:{}}),[H,B]=(0,s.useState)(null),[V,W]=(0,s.useState)(!1),[Y,Q]=(0,s.useState)(!1),[X,Z]=(0,s.useState)(60),[ee,et]=(0,s.useState)(!0),[er,ea]=(0,s.useState)(null),[es,ei]=(0,s.useState)(null),[el,en]=(0,s.useState)(null),[eo,ed]=(0,s.useState)(null),[ec,eu]=(0,s.useState)(null),[ex,em]=(0,s.useState)(!1),[eh,eb]=(0,s.useState)(null),[ep,eg]=(0,s.useState)("all"),[ef,ey]=(0,s.useState)([]),[ev,ej]=(0,s.useState)("all"),[ek,ew]=(0,s.useState)("default"),[eN,eC]=(0,s.useState)(!1),[eS,eA]=(0,s.useState)(!1),[e$,eE]=(0,s.useState)(!1),[eq,eP]=(0,s.useState)(1),[eD,eT]=(0,s.useState)(20),[eM,eO]=(0,s.useState)(String(20)),[eI,e_]=(0,s.useState)({page:1,pageSize:20,total:0,totalPages:1}),[eF,ez]=(0,s.useState)({eligibleConnections:0,providerFilteredConnections:0}),eL=(0,s.useRef)(null),eR=(0,s.useRef)(null),eU=(0,s.useRef)(0),eJ=(0,s.useCallback)(async(e=eq)=>{try{var t,r;let a=new URLSearchParams({page:String(e),pageSize:String(eD),accountStatus:ev,sort:"priority"});"all"!==ep&&a.set("provider",ep);let s=await fetch(`/api/providers/client?${a.toString()}`);if(!s.ok)throw Error("Failed to fetch connections");let i=await s.json(),l=i.connections||[],n=(t=i.pagination,t||{page:1,pageSize:eD,total:0,totalPages:1}),o=function(e,t=0){return e||{eligibleConnections:t,providerFilteredConnections:t}}(i.totals,l.length);return O(l),ey(i.providerOptions||[]),e_(n),ez(o),eP((r=i.pagination,r?.page||e)),l}catch(e){return(0,A.s)("Error fetching connections:",e),O([]),ey([]),e_({page:1,pageSize:eD,total:0,totalPages:1}),ez({eligibleConnections:0,providerFilteredConnections:0}),[]}},[ev,eq,eD,ep]),eK=(0,s.useCallback)(async(e,t)=>{z(t=>({...t,[e]:!0})),R(t=>({...t,[e]:null}));try{let r=await fetch(`/api/usage/${e}`);if(!r.ok){let a=(await r.json().catch(()=>({}))).error||r.statusText;if(404===r.status)return void(0,A.s)(`[ProviderLimits] Connection not found for ${t}, skipping`);if(401===r.status){(0,A.s)(`[ProviderLimits] Auth error for ${t}:`,a);let r={quotas:[],message:a};_(t=>({...t,[e]:r})),f(e,r);return}throw Error(`HTTP ${r.status}: ${a}`)}let a=await r.json(),s={quotas:function(e,t){if(!t||"object"!=typeof t)return[];let r=[];try{switch(e.toLowerCase()){case"github":default:t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"antigravity":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codex":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,remaining:t.remaining,resetAt:t.resetAt||null})});break;case"kiro":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"qoder":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{("organization"!==e||t&&0!==(Number(t.total)||0))&&r.push({name:"user"===e?"Personal":"organization"===e?"Organization":e,used:t.used||0,total:t.total||0,unit:t.unit,resetAt:t.resetAt||null})});break;case"claude":t.message?r.push({name:"error",used:0,total:0,resetAt:null,message:t.message}):t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"vercel-ai-gateway":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codebuddy-cn":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,recurring:!1!==t.recurring})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}let a=(0,l.KC)(e);if(a.length>0){let e=new Map(a.map((e,t)=>[e.id,t]));r.sort((t,r)=>{let a=t.modelKey||t.name,s=r.modelKey||r.name;return(e.get(a)??999)-(e.get(s)??999)})}return r}(t,a),plan:a.plan||null,message:a.message||null,raw:a};_(t=>({...t,[e]:s})),f(e,s)}catch(r){(0,A.s)(`[ProviderLimits] Error fetching quota for ${t} (${e}):`,r),R(t=>({...t,[e]:r.message||"Failed to fetch quota"}))}finally{z(t=>({...t,[e]:!1}))}},[]),eG=(0,s.useCallback)(async(e,t)=>{await eK(e,t),B(new Date)},[eK]),eH=(0,s.useCallback)(async(e,t)=>{if("codex"===t&&!el){en(e),R(t=>({...t,[e]:null}));try{let r=await fetch(`/api/usage/${e}/codex-reset-credits`,{method:"POST"}),a=await r.json().catch(()=>({}));if(!r.ok)throw Error(a.message||a.error||a.code||"Failed to reset Codex limit");await eK(e,t),B(new Date)}catch(t){R(r=>({...r,[e]:t.message||"Failed to reset Codex limit"}))}finally{en(null)}}},[eK,el]),eB=(0,s.useCallback)(async e=>{eu({connection:e,loading:!0,error:null,data:null});try{let t=await fetch(`/api/usage/${e.id}/codex-reset-credits`,{cache:"no-store"}),r=await t.json().catch(()=>({}));if(!t.ok)throw Error(r.error||r.message||"Failed to load Codex reset credits");let a=Array.isArray(r.credits)?[...r.credits]:[];a.sort((e,t)=>{let r=e.expiresAt?new Date(e.expiresAt).getTime():1/0,a=t.expiresAt?new Date(t.expiresAt).getTime():1/0;return r-a}),eu({connection:e,loading:!1,error:null,data:{...r,credits:a}})}catch(t){eu({connection:e,loading:!1,error:t.message||"Failed to load Codex reset credits",data:null})}},[]),eV=(0,s.useCallback)(async e=>{let t=x(r.find(t=>t.id===e)||{})||e;if(await (0,$.l)({message:`Delete connection “${t}”?`,confirmText:"Continue"})){ea(e);try{if((await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok){_(t=>{let r={...t};return delete r[e],r}),z(t=>{let r={...t};return delete r[e],r}),R(t=>{let r={...t};return delete r[e],r});try{let t=g();t[e]&&(delete t[e],window.localStorage.setItem(n,JSON.stringify(t)))}catch(e){(0,A.s)("Error deleting cache entry:",e)}await p(eJ,eq)}}catch(e){(0,A.s)("Error deleting connection:",e)}finally{ea(null)}}},[r,eJ,eq]),eW=(0,s.useCallback)(async(e,t)=>{ei(e);try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&(_(e=>({...e})),await p(eJ,eq))}catch(e){(0,A.s)("Error updating connection status:",e)}finally{ei(null)}},[eJ,eq]),eY=(0,s.useCallback)(async e=>{if(!eh?.id)return;let t=eh.id,r=eh.provider;try{(await fetch(`/api/providers/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await eJ(),em(!1),eb(null),C.wb.includes(r)&&await eK(t,r))}catch(e){(0,A.s)("Error saving connection:",e)}},[eh,eJ,eK]),eQ=(0,s.useCallback)(async(e=!1)=>{if(Y)return;Q(!0),Z(60);let t=eU.current+=1,r=Math.round(3);try{let a=await eJ(eq);z(h(a)),R(e=>b(e,a)),_(e=>b(e,a)),await Promise.all(a.filter(a=>e||"claude"!==a.provider||t%r==0).map(e=>eK(e.id,e.provider))),B(new Date)}catch(e){(0,A.s)("Error refreshing all providers:",e)}finally{Q(!1)}},[Y,eJ,eK,eq]);(0,s.useEffect)(()=>{(async()=>{et(!0);let e=await eJ(eq);et(!1),z(h(e)),R(t=>b(t,e)),_(t=>b(t,e)),await Promise.all(e.map(e=>eK(e.id,e.provider))),B(new Date)})()},[eJ,eK,eq]),(0,s.useEffect)(()=>{let e=window.localStorage.getItem(o);J(null===e||"true"===e),W(!0)},[]),(0,s.useEffect)(()=>{V&&window.localStorage.setItem(o,String(U))},[U,V]),(0,s.useEffect)(()=>{fetch("/api/settings",{cache:"no-store"}).then(e=>e.ok?e.json():{}).then(e=>G({claude:e?.claudeAutoPing?.connections||{},codex:e?.codexAutoPing?.connections||{}})).catch(()=>{})},[]);let eX=(0,s.useCallback)(async(e,t,r)=>{let a=q[t];if(!a)return;let s={...K[t]||{},[e]:r};G({...K,[t]:s});try{let e=await fetch("/api/settings",{cache:"no-store"}),t={...(e.ok?await e.json():{})[a]||{},connections:s};await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[a]:t})})}catch{G(K)}},[K]);(0,s.useEffect)(()=>{if(!V||!U){eL.current&&(clearInterval(eL.current),eL.current=null),eR.current&&(clearInterval(eR.current),eR.current=null);return}return eL.current=setInterval(()=>{eQ()},6e4),eR.current=setInterval(()=>{Z(e=>e<=1?60:e-1)},1e3),()=>{eL.current&&clearInterval(eL.current),eR.current&&clearInterval(eR.current)}},[U,eQ,V]),(0,s.useEffect)(()=>{let e=()=>{document.hidden?(eL.current&&(clearInterval(eL.current),eL.current=null),eR.current&&(clearInterval(eR.current),eR.current=null)):U&&V&&(eL.current=setInterval(()=>eQ(),6e4),eR.current=setInterval(()=>{Z(e=>e<=1?60:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[U,eQ,V]);let eZ=(0,s.useMemo)(()=>(function(e,t,r,a,s){if("codex"===a&&"default"!==s)return[...e].sort((e,r)=>{let a=m(e,t),i=m(r,t),l="remaining-asc"===s?a-i:i-a;return 0!==l?l:(x(e)||"").localeCompare(x(r)||"")});if(!r)return e;let i=e=>{let r=(t[e.id]?.quotas||[]).map(e=>e.resetAt?new Date(e.resetAt).getTime():1/0).filter(e=>Number.isFinite(e));return r.length>0?Math.min(...r):1/0};return[...e].sort((e,t)=>{let r=i(e)-i(t);return 0!==r?r:(e.provider||"").localeCompare(t.provider||"")||(x(e)||"").localeCompare(x(t)||"")})})(r,I,eN,ep,ek),[r,I,eN,ep,ek]),e0=e=>{let t=I[e.id]?.quotas;return!!t?.length&&t.some(e=>!!e.total&&!(e.total<=0)&&5>=y(e.used,e.total))},e1=(0,s.useCallback)(async(e,t)=>{if(e.length&&!e$){eE(!0);try{await Promise.all(e.map(e=>fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})}))),await p(eJ,eq)}catch(e){(0,A.s)("Error bulk toggling connections:",e)}finally{eE(!1)}}},[e$,eJ,eq]),e5="all"===ep?"All providers":ep,e2=eF.eligibleConnections>0,e3=eZ.length>0,e8=eF.eligibleConnections?eF.providerFilteredConnections?{icon:"filter_alt_off",title:"No Accounts On This Page",description:"Try moving to another page or refreshing the current filters."}:{icon:"filter_alt_off",title:"No Accounts Match Current Filters",description:"all"===ep?"Try changing the account status filter to see more quota trackers.":`No ${"inactive"===ev?"turned off":"active"===ev?"active":"matching"} accounts found for ${ep}.`}:{icon:"cloud_off",title:"No Providers Connected",description:"Connect to providers with OAuth to track your API quota limits and usage."},e4=function(e){var t;let{start:r,end:a}=(t=e).total?{start:(t.page-1)*t.pageSize+1,end:Math.min(t.page*t.pageSize,t.total)}:{start:0,end:0};return`Showing ${r}-${a} of ${e.total}`}(eI),e6=!d.includes(eD);return ee||e2?ee||e3?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-end",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>eA(e=>!e),className:"flex h-8 items-center justify-between gap-1 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-haspopup":"menu","aria-expanded":eS,title:"Filter quota providers",children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:["all"===ep?(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"apps"}):(0,a.jsx)(i.A,{src:`/providers/${ep}.png`,alt:ep,size:18,className:"size-[18px] rounded object-contain",fallbackText:ep.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"truncate capitalize hidden lg:inline",children:e5})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"expand_more"})]}),eS&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"fixed inset-0 z-30 bg-transparent","aria-label":"Close provider filter",onClick:()=>eA(!1)}),(0,a.jsxs)("div",{className:"absolute left-0 z-40 mt-2 w-64 overflow-hidden rounded-2xl border border-black/10 bg-surface/95 p-1.5 shadow-xl shadow-black/10 backdrop-blur dark:border-white/10 dark:bg-surface/95 sm:w-72",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>{"all"!==ep&&eP(1),eg("all"),eA(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${"all"===ep?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[22px]",children:"apps"}),(0,a.jsx)("span",{className:"font-medium",children:"All providers"}),"all"===ep&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]}),(0,a.jsx)("div",{className:"my-1 h-px bg-black/10 dark:bg-white/10"}),(0,a.jsx)("div",{className:"max-h-72 overflow-y-auto pr-1",children:ef.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{ep!==e&&eP(1),eg(e),eA(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${ep===e?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,a.jsx)(i.A,{src:`/providers/${e}.png`,alt:e,size:24,className:"size-6 rounded-md object-contain",fallbackText:e.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"font-medium capitalize",children:e}),ep===e&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]},e))})]})]})]}),(0,a.jsx)("select",{value:ev,onChange:e=>{let t=e.target.value;ev!==t&&eP(1),ej(t)},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Filter accounts by status",children:c.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),"codex"===ep&&(0,a.jsx)("select",{value:ek,onChange:e=>ew(e.target.value),className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Sort Codex quotas by remaining",children:u.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsxs)("button",{type:"button",onClick:()=>eC(e=>!e),"aria-pressed":eN,className:`flex h-8 shrink-0 items-center gap-1 rounded-lg border px-2 text-xs transition-colors ${eN?"border-amber-500/40 bg-amber-500/10 text-amber-500":"border-black/10 text-text-primary hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5"}`,title:"Sort accounts by earliest quota reset time",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"hourglass_top"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Expiring first"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{e1(eZ.filter(e=>(e.isActive??!0)&&e0(e)).map(e=>e.id),!1)},disabled:e$,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-red-500/30 px-2 text-xs text-red-500 transition-colors hover:bg-red-500/10 disabled:opacity-50",title:"Disable connections with depleted quota on the current page",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"block"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Turn off Empty"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{e1(eZ.filter(e=>!(e.isActive??!0)&&!e0(e)).map(e=>e.id),!0)},disabled:e$,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-emerald-500/30 px-2 text-xs text-emerald-500 transition-colors hover:bg-emerald-500/10 disabled:opacity-50",title:"Enable connections that still have quota on the current page",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Turn on Available"})]}),(0,a.jsxs)("button",{onClick:()=>J(e=>!e),className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-black/10 px-2 text-xs transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5",title:U?"Disable auto-refresh":"Enable auto-refresh",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${U?"text-primary":"text-text-muted"}`,children:U?"toggle_on":"toggle_off"}),(0,a.jsx)("span",{className:"hidden text-text-primary sm:inline",children:"Auto-refresh"}),U&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted tabular-nums",children:["(",X,"s)"]})]}),(0,a.jsx)("button",{type:"button",onClick:()=>eQ(!0),disabled:Y,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-black/10 px-2 text-xs text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5 disabled:opacity-50",title:"Refresh all",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${Y?"animate-spin":""}`,children:"refresh"})})]})}),eN&&(0,a.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",children:"Expiring-first currently reorders accounts inside the current page. Cross-page ordering still follows backend pagination."}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:eZ.map(r=>{let s,l,n,o=I[r.id],d=F[r.id],c=L[r.id],u=!1===r.isActive,m="codex"===r.provider,h=Number.isFinite(l="number"==typeof(s=o?.raw?.resetCredits?.availableCount)?s:Number(s))?Math.max(0,l):0,b=el===r.id,p=er===r.id||es===r.id||b;return(0,a.jsxs)(w.default,{padding:"none",className:`min-w-0 ${u?"opacity-60":""}`,children:[(0,a.jsx)("div",{className:"px-3 py-2 border-b border-black/10 dark:border-white/10",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)("div",{className:"w-8 h-8 shrink-0 rounded-md flex items-center justify-center overflow-hidden",children:(0,a.jsx)(i.A,{src:`/providers/${r.provider}.png`,alt:r.provider,size:32,className:"object-contain",fallbackText:r.provider?.slice(0,2).toUpperCase()||"PR"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-primary capitalize truncate",children:r.provider}),x(r)?(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:x(r)}):null,D(r)?(0,a.jsx)("p",{className:"text-[11px] text-text-muted/80 truncate",children:D(r)}):null,"kiro"===r.provider&&(0,a.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[(0,a.jsx)("span",{className:"rounded-full bg-brand-500/10 px-2 py-0.5 text-[10px] font-semibold text-brand-600 dark:text-brand-300",children:(n=r.providerSpecificData?.authMethod)&&E[n]?E[n]:"api_key"===r.authType?"API Key":"OAuth"}),T(r)&&(0,a.jsx)("span",{className:"rounded-full bg-blue-500/10 px-2 py-0.5 text-[10px] font-semibold text-blue-600 dark:text-blue-400",children:T(r)}),(0,a.jsx)("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-semibold ${u?"bg-surface-2 text-text-muted":"active"===r.testStatus||"success"===r.testStatus?"bg-green-500/10 text-green-600 dark:text-green-400":"error"===r.testStatus||"expired"===r.testStatus||"unavailable"===r.testStatus?"bg-red-500/10 text-red-600 dark:text-red-400":"bg-surface-2 text-text-muted"}`,children:u?"disabled":r.testStatus||"unknown"}),r.providerSpecificData?.profileArn&&(0,a.jsxs)("button",{type:"button",onClick:()=>t(r.providerSpecificData.profileArn,r.id),title:r.providerSpecificData.profileArn,className:"inline-flex max-w-full items-center gap-1 rounded-full border border-border-subtle px-2 py-0.5 text-[10px] text-text-muted transition-colors hover:text-primary",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:e===r.id?"check":"content_copy"}),(0,a.jsx)("code",{className:"truncate font-mono",children:r.providerSpecificData.profileArn})]})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[m&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(k.default,{text:h>0?`Use one Codex reset credit. Available: ${h}`:"No Codex reset credits available",children:(0,a.jsxs)("button",{type:"button",onClick:()=>ed({connection:r,resetCreditCount:h}),disabled:h<=0||d||p,"aria-label":h>0?`Use one Codex reset credit. ${h} available.`:"No Codex reset credits available",className:`flex h-8 min-w-10 items-center justify-center gap-1 rounded-lg border px-2 text-[11px] font-medium tabular-nums transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary/60 disabled:cursor-not-allowed disabled:opacity-60 ${h>0?"border-primary/30 bg-primary/5 text-primary hover:bg-primary/10":"border-black/10 bg-black/[0.02] text-text-muted dark:border-white/10 dark:bg-white/[0.03]"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[15px] ${b?"animate-spin":""}`,children:b?"progress_activity":"restart_alt"}),(0,a.jsx)("span",{children:h})]})}),(0,a.jsx)(k.default,{text:"View Codex reset credit expiry",children:(0,a.jsx)("button",{type:"button",onClick:()=>eB(r),disabled:d||p,"aria-label":"View Codex reset credit expiry",className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-text-muted transition-colors hover:bg-black/5 hover:text-primary disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/10 dark:hover:bg-white/5",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"schedule"})})})]}),q[r.provider]&&"oauth"===r.authType&&(0,a.jsx)(k.default,{text:P[r.provider],children:(0,a.jsx)("button",{type:"button",onClick:()=>eX(r.id,r.provider,K[r.provider]?.[r.id]!==!0),"aria-label":"Toggle auto-ping",className:`flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${K[r.provider]?.[r.id]===!0?"text-primary":"text-text-muted"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"})})}),(0,a.jsx)(k.default,{text:"Refresh quota",children:(0,a.jsx)("button",{type:"button",onClick:()=>eG(r.id,r.provider),disabled:d||p,"aria-label":"Refresh quota",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-black/5 dark:hover:bg-white/5 transition-colors disabled:opacity-50",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted ${d?"animate-spin":""}`,children:"refresh"})})}),(0,a.jsx)(k.default,{text:"Edit connection",children:(0,a.jsx)("button",{type:"button",onClick:()=>{eb(r),em(!0)},disabled:p,"aria-label":"Edit connection",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary transition-colors disabled:opacity-50",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})})}),(0,a.jsx)(k.default,{text:"Delete connection",children:(0,a.jsx)("button",{type:"button",onClick:()=>eV(r.id),disabled:p,"aria-label":"Delete connection",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-red-500/10 text-red-500 transition-colors disabled:opacity-50",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] ${er===r.id?"animate-pulse":""}`,children:"delete"})})}),(0,a.jsx)("div",{className:"inline-flex items-center pl-0.5",title:r.isActive??!0?"Disable connection":"Enable connection",children:(0,a.jsx)(j.default,{size:"sm",checked:r.isActive??!0,disabled:p,onChange:e=>eW(r.id,e)})})]})]})}),(0,a.jsx)("div",{className:"px-2 py-1.5",children:d?(0,a.jsx)("div",{className:"text-center py-5 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px] animate-spin",children:"progress_activity"})}):c?(0,a.jsxs)("div",{className:"text-center py-5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px] text-red-500",children:"error"}),(0,a.jsx)("p",{className:"mt-1.5 text-xs text-text-muted",children:c})]}):o?.message?(0,a.jsx)("div",{className:"text-center py-5",children:(0,a.jsx)("p",{className:"text-xs text-text-muted",children:o.message})}):(0,a.jsx)(v,{quotas:o?.quotas,compact:!0,sortMode:"default",showSortLabel:"codex"===r.provider&&"default"!==ek})})]},r.id)})}),(0,a.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:e4}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("select",{value:e6?"custom":String(eD),onChange:e=>{let t=e.target.value;if("custom"===t)return;let r=Number.parseInt(t,10);Number.isFinite(r)&&(eP(1),eT(r),eO(String(r)))},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Accounts per page",children:[d.map(e=>(0,a.jsxs)("option",{value:String(e),children:[e," / page"]},e)),(0,a.jsx)("option",{value:"custom",children:"Custom"})]}),(0,a.jsx)("input",{type:"number",min:"1",max:String(500),inputMode:"numeric",value:eM,onChange:e=>eO(e.target.value),onBlur:()=>{let e=Number.parseInt(eM,10);if(!Number.isFinite(e))return void eO(String(eD));let t=Math.min(500,Math.max(1,e));eP(1),eT(t),eO(String(t))},onKeyDown:e=>{if("Enter"!==e.key)return;let t=Number.parseInt(eM,10);if(!Number.isFinite(t))return void eO(String(eD));let r=Math.min(500,Math.max(1,t));eP(1),eT(r),eO(String(r))},className:"h-8 w-20 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Custom accounts per page",placeholder:"Custom"}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Page ",eI.page," / ",eI.totalPages]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("button",{type:"button",onClick:()=>eP(1),disabled:eI.page<=1||ee||Y,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"First Page"}),(0,a.jsx)("button",{type:"button",onClick:()=>eP(e=>Math.max(1,e-1)),disabled:eI.page<=1||ee||Y,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5","aria-label":"Previous accounts page",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"chevron_left"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eP(e=>Math.min(eI.totalPages,e+1)),disabled:eI.page>=eI.totalPages||ee||Y,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5","aria-label":"Next accounts page",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"chevron_right"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eP(eI.totalPages),disabled:eI.page>=eI.totalPages||ee||Y,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Last Page"})]})]})}),(0,a.jsx)(N.uo,{isOpen:!!eo,onClose:()=>{el||ed(null)},onConfirm:async()=>{let e=eo?.connection;e&&(await eH(e.id,e.provider),ed(null))},title:"Reset Codex limit?",message:`Use 1 Codex reset credit for ${x(eo?.connection||{})||"this account"}. This cannot be undone. Remaining credits: ${eo?.resetCreditCount??0}.`,confirmText:"Reset limit",cancelText:"Cancel",variant:"danger",loading:!!el}),ec&&(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 px-4 backdrop-blur-sm",children:(0,a.jsxs)("div",{className:"w-full max-w-2xl overflow-hidden rounded-2xl border border-black/15 bg-white shadow-2xl ring-1 ring-black/10 dark:border-white/15 dark:bg-neutral-950 dark:ring-white/10",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3 border-b border-black/10 bg-black/[0.03] px-4 py-3 dark:border-white/10 dark:bg-white/[0.04]",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-base font-semibold text-text-primary",children:"Codex Reset Credit Expiry"}),(0,a.jsx)("p",{className:"mt-0.5 truncate text-xs text-text-muted",children:x(ec.connection)||"Codex account"})]}),(0,a.jsx)("button",{type:"button",onClick:()=>eu(null),className:"flex h-8 w-8 items-center justify-center rounded-lg text-text-muted transition-colors hover:bg-black/5 hover:text-text-primary dark:hover:bg-white/5","aria-label":"Close reset credit expiry modal",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),(0,a.jsx)("div",{className:"max-h-[70vh] overflow-auto bg-white p-4 dark:bg-neutral-950",children:ec.loading?(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2 py-10 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[20px]",children:"progress_activity"}),"Loading reset credits..."]}):ec.error?(0,a.jsx)("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-3 py-2 text-sm text-red-600 dark:text-red-300",children:ec.error}):ec.data?.credits?.length?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("span",{children:[ec.data.credits.length," reset credit",1===ec.data.credits.length?"":"s"]}),(0,a.jsxs)("span",{children:[ec.data.availableCount??0," available"]})]}),(0,a.jsx)("div",{className:"overflow-x-auto rounded-xl border border-black/10 dark:border-white/10",children:(0,a.jsxs)("table",{className:"w-full min-w-[560px] text-left text-sm",children:[(0,a.jsx)("thead",{className:"bg-black/[0.03] text-xs uppercase tracking-wide text-text-muted dark:bg-white/[0.04]",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Status"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Granted At"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Expires At"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Remaining"})]})}),(0,a.jsx)("tbody",{children:ec.data.credits.map((e,t)=>(0,a.jsxs)("tr",{className:"border-t border-black/5 dark:border-white/5",children:[(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsx)("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:e.status||"unknown"})}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-muted",children:M(e.grantedAt)}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-primary",children:M(e.expiresAt)}),(0,a.jsx)("td",{className:"px-3 py-2 font-medium text-text-primary",children:function(e){if(!e)return"N/A";let t=new Date(e).getTime()-Date.now();if(!Number.isFinite(t))return"N/A";if(t<=0)return"Expired";let r=Math.ceil(t/36e5),a=Math.floor(r/24),s=r%24;return a>0?`${a}d ${s}h`:`${s}h`}(e.expiresAt)})]},`${e.status}-${e.expiresAt||t}`))})]})})]}):(0,a.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-8 text-center text-sm text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:"No reset credit details returned for this account."})})]})}),(0,a.jsx)(N.wI,{isOpen:ex,connection:eh,onSave:eY,onClose:()=>{em(!1),eb(null)}})]}):(0,a.jsx)(w.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] text-text-muted opacity-20",children:e8.icon}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:e8.title}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:e8.description})]})}):(0,a.jsx)(w.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] text-text-muted opacity-20",children:"cloud_off"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:"No Providers Connected"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:"Connect to providers with OAuth to track your API quota limits and usage."})]})})}}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=17002)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3826],{17002:(e,t,r)=>{Promise.resolve().then(r.bind(r,75095)),Promise.resolve().then(r.bind(r,25086))},75095:(e,t,r)=>{"use strict";r.d(t,{default:()=>O});var a=r(95155),s=r(12115),i=r(57250),l=r(97650);let n="quotaCacheData",o="quotaAutoRefresh",d=[10,20,50,100],c=[{value:"all",label:"All accounts"},{value:"active",label:"Active"},{value:"inactive",label:"Turned off"}],u=[{value:"default",label:"Default quota order"},{value:"remaining-asc",label:"% quota: low to high"},{value:"remaining-desc",label:"% quota: high to low"}];function x(e){return e.name?.trim()||e.email?.trim()||e.displayName?.trim()||null}function m(e,t){let r=t[e.id]?.quotas?.[0];return r&&"number"==typeof r.remaining?r.remaining:1/0}function h(e){let t={};return e.forEach(e=>{t[e.id]=!0}),t}function b(e,t){let r=new Set(t.map(e=>e.id));return Object.fromEntries(Object.entries(e).filter(([e])=>r.has(e)))}async function p(e,t){return await e(t)}function g(){try{let e=window.localStorage.getItem(n);return e?JSON.parse(e):{}}catch(e){return console.error("Error reading quota cache:",e),{}}}function f(e,t){try{let r=g();r[e]={...t,cachedAt:new Date().toISOString()},window.localStorage.setItem(n,JSON.stringify(r))}catch(e){console.error("Error writing quota cache:",e)}}function y(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}function v({quotas:e=[],compact:t=!1,sortMode:r="default",showSortLabel:i=!1}){let[l,n]=(0,s.useState)(1),o=(0,s.useMemo)(()=>e.map((e,t)=>({...e,index:t,remaining:e?.remaining!==void 0?Math.max(0,Math.round(e.remaining)):e?.remainingPercentage!==void 0?Math.round(e.remainingPercentage):y(e?.used,e?.total)})),[e]),d=(0,s.useMemo)(()=>"remaining-asc"===r?[...o].sort((e,t)=>e.remaining-t.remaining||e.name.localeCompare(t.name)):"remaining-desc"===r?[...o].sort((e,t)=>t.remaining-e.remaining||e.name.localeCompare(t.name)):o,[o,r]),c=Math.max(1,Math.ceil(d.length/10));if((0,s.useEffect)(()=>{n(1)},[r,e]),(0,s.useEffect)(()=>{n(e=>Math.min(e,c))},[c]),!e||0===e.length)return null;let u=d.slice((l-1)*10,10*l),x=0===d.length?0:(l-1)*10+1,m=Math.min(10*l,d.length),h=t?"py-1 px-1.5":"py-2 px-3",b=t?"text-[11px]":"text-sm",p=t?"text-[11px]":"text-sm",g=t?"text-[10px] leading-tight":"text-xs";return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"text-[10px] text-text-muted",children:[d.length," quota",d.length>1?"s":""]}),i&&(0,a.jsx)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1 text-[10px] text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:"Sorted by account remaining"})]}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsx)("table",{className:"w-full table-fixed text-left",children:(0,a.jsx)("tbody",{children:u.map(e=>{var r;let s=(r=e.remaining)>70?{text:"text-green-600 dark:text-green-400",bg:"bg-green-500",bgLight:"bg-green-500/10",emoji:"\uD83D\uDFE2"}:r>=30?{text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-500",bgLight:"bg-yellow-500/10",emoji:"\uD83D\uDFE1"}:{text:"text-red-600 dark:text-red-400",bg:"bg-red-500",bgLight:"bg-red-500/10",emoji:"\uD83D\uDD34"},i=function(e){if(!e)return"-";try{let t="string"==typeof e?new Date(e):e,r=new Date,a=t-r;if(a<=0)return"-";let s=Math.ceil(a/6e4);if(s<60)return`${s}m`;let i=Math.floor(s/60),l=s%60;if(i<24)return`${i}h ${l}m`;let n=Math.floor(i/24);return`${n}d ${i%24}h ${l}m`}catch(e){return"-"}}(e.resetAt),l=function(e){if(!e)return null;try{let t=new Date(e),r=new Date,a=new Date(r.getFullYear(),r.getMonth(),r.getDate()),s=new Date(a);s.setDate(s.getDate()+1);let i="";i=t>=a&&t<s?"Today":t>=s&&t<new Date(s.getTime()+864e5)?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let l=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${i}, ${l}`}catch{return null}}(e.resetAt),n=!1!==e.recurring?`in ${i}`:`expires in ${i}`;return(0,a.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,a.jsx)("td",{className:`${h} w-[30%]`,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,a.jsx)("span",{className:"text-[10px] shrink-0",children:s.emoji}),(0,a.jsx)("span",{className:`${b} font-medium text-text-primary truncate`,children:e.name})]})}),(0,a.jsx)("td",{className:`${h} w-[45%]`,children:(0,a.jsxs)("div",{className:t?"space-y-1":"space-y-1.5",children:[(0,a.jsx)("div",{className:`${t?"h-1":"h-1.5"} rounded-full overflow-hidden border ${s.bgLight} ${0===e.remaining?"border-black/10 dark:border-white/10":"border-transparent"}`,children:(0,a.jsx)("div",{className:`h-full transition-all duration-300 ${s.bg}`,style:{width:`${Math.min(e.remaining,100)}%`}})}),(0,a.jsxs)("div",{className:`flex items-center justify-between ${t?"text-[10px]":"text-xs"}`,children:[(0,a.jsxs)("span",{className:"text-text-muted",children:[e.used.toLocaleString()," / ",e.total>0?e.total.toLocaleString():"∞"]}),(0,a.jsxs)("span",{className:`font-medium ${s.text}`,children:[e.remaining,"%"]})]})]})}),(0,a.jsx)("td",{className:`${h} w-[25%]`,children:"-"!==i||l?t?(0,a.jsx)("div",{className:`${p} text-text-primary font-medium truncate`,title:l||"",children:"-"!==i?n:l}):(0,a.jsxs)("div",{className:"space-y-0.5",children:["-"!==i&&(0,a.jsx)("div",{className:`${p} text-text-primary font-medium`,children:n}),l&&(0,a.jsx)("div",{className:`${g} text-text-muted`,children:l})]}):(0,a.jsx)("div",{className:`${p} text-text-muted italic`,children:"N/A"})})]},`${e.name}-${e.index}`)})})})}),c>1&&(0,a.jsxs)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1.5 dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 text-[10px] text-text-muted",children:[(0,a.jsxs)("span",{children:["Showing ",x,"-",m," of ",d.length]}),(0,a.jsxs)("span",{children:["Page ",l," / ",c]})]}),(0,a.jsxs)("div",{className:"mt-1.5 flex items-center justify-end gap-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>n(e=>Math.max(1,e-1)),disabled:1===l,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Prev"}),(0,a.jsx)("button",{type:"button",onClick:()=>n(e=>Math.min(c,e+1)),disabled:l===c,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Next"})]})]})]})}var j=r(98542),k=r(97677),w=r(84588),N=r(35497),C=r(88105),S=r(11059),A=r(78559),$=r(77251);let E={"builder-id":"AWS Builder ID",idc:"IAM Identity Center",google:"Google",github:"GitHub",imported:"Imported Token",api_key:"API Key"},q={claude:"claudeAutoPing",codex:"codexAutoPing"},P={claude:"When your 5h quota runs out, auto-sends a request the moment it resets so a new window starts right away.",codex:"Auto-starts the next 5h Codex window after reset by sending a tiny gpt-5.5 request. Consumes a small amount of quota."};function D(e){return e.name?.trim()&&e.email?.trim()&&e.name.trim()!==e.email.trim()?e.email.trim():e.name?.trim()&&e.displayName?.trim()&&e.name.trim()!==e.displayName.trim()?e.displayName.trim():null}function T(e){let t=e.providerSpecificData?.region;if(t)return t;let r=e.providerSpecificData?.profileArn;return("string"==typeof r?r.split(":")[3]:"")||""}function M(e){if(!e)return"N/A";let t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):"N/A"}function O(){let{copied:e,copy:t}=(0,S.C)(),[r,O]=(0,s.useState)([]),[I,_]=(0,s.useState)({}),[F,z]=(0,s.useState)({}),[L,R]=(0,s.useState)({}),[U,J]=(0,s.useState)(!0),[K,G]=(0,s.useState)({claude:{},codex:{}}),[H,B]=(0,s.useState)(null),[V,W]=(0,s.useState)(!1),[Y,Q]=(0,s.useState)(!1),[X,Z]=(0,s.useState)(60),[ee,et]=(0,s.useState)(!0),[er,ea]=(0,s.useState)(null),[es,ei]=(0,s.useState)(null),[el,en]=(0,s.useState)(null),[eo,ed]=(0,s.useState)(null),[ec,eu]=(0,s.useState)(null),[ex,em]=(0,s.useState)(!1),[eh,eb]=(0,s.useState)(null),[ep,eg]=(0,s.useState)("all"),[ef,ey]=(0,s.useState)([]),[ev,ej]=(0,s.useState)("all"),[ek,ew]=(0,s.useState)("default"),[eN,eC]=(0,s.useState)(!1),[eS,eA]=(0,s.useState)(!1),[e$,eE]=(0,s.useState)(!1),[eq,eP]=(0,s.useState)(1),[eD,eT]=(0,s.useState)(20),[eM,eO]=(0,s.useState)(String(20)),[eI,e_]=(0,s.useState)({page:1,pageSize:20,total:0,totalPages:1}),[eF,ez]=(0,s.useState)({eligibleConnections:0,providerFilteredConnections:0}),eL=(0,s.useRef)(null),eR=(0,s.useRef)(null),eU=(0,s.useRef)(0),eJ=(0,s.useCallback)(async(e=eq)=>{try{var t,r;let a=new URLSearchParams({page:String(e),pageSize:String(eD),accountStatus:ev,sort:"priority"});"all"!==ep&&a.set("provider",ep);let s=await fetch(`/api/providers/client?${a.toString()}`);if(!s.ok)throw Error("Failed to fetch connections");let i=await s.json(),l=i.connections||[],n=(t=i.pagination,t||{page:1,pageSize:eD,total:0,totalPages:1}),o=function(e,t=0){return e||{eligibleConnections:t,providerFilteredConnections:t}}(i.totals,l.length);return O(l),ey(i.providerOptions||[]),e_(n),ez(o),eP((r=i.pagination,r?.page||e)),l}catch(e){return(0,A.s)("Error fetching connections:",e),O([]),ey([]),e_({page:1,pageSize:eD,total:0,totalPages:1}),ez({eligibleConnections:0,providerFilteredConnections:0}),[]}},[ev,eq,eD,ep]),eK=(0,s.useCallback)(async(e,t)=>{z(t=>({...t,[e]:!0})),R(t=>({...t,[e]:null}));try{let r=await fetch(`/api/usage/${e}`);if(!r.ok){let a=(await r.json().catch(()=>({}))).error||r.statusText;if(404===r.status)return void(0,A.s)(`[ProviderLimits] Connection not found for ${t}, skipping`);if(401===r.status){(0,A.s)(`[ProviderLimits] Auth error for ${t}:`,a);let r={quotas:[],message:a};_(t=>({...t,[e]:r})),f(e,r);return}throw Error(`HTTP ${r.status}: ${a}`)}let a=await r.json(),s={quotas:function(e,t){if(!t||"object"!=typeof t)return[];let r=[];try{switch(e.toLowerCase()){case"github":default:t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"antigravity":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codex":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,remaining:t.remaining,resetAt:t.resetAt||null})});break;case"kiro":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"qoder":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{("organization"!==e||t&&0!==(Number(t.total)||0))&&r.push({name:"user"===e?"Personal":"organization"===e?"Organization":e,used:t.used||0,total:t.total||0,unit:t.unit,resetAt:t.resetAt||null})});break;case"claude":t.message?r.push({name:"error",used:0,total:0,resetAt:null,message:t.message}):t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"vercel-ai-gateway":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codebuddy-cn":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,recurring:!1!==t.recurring})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}let a=(0,l.KC)(e);if(a.length>0){let e=new Map(a.map((e,t)=>[e.id,t]));r.sort((t,r)=>{let a=t.modelKey||t.name,s=r.modelKey||r.name;return(e.get(a)??999)-(e.get(s)??999)})}return r}(t,a),plan:a.plan||null,message:a.message||null,raw:a};_(t=>({...t,[e]:s})),f(e,s)}catch(r){(0,A.s)(`[ProviderLimits] Error fetching quota for ${t} (${e}):`,r),R(t=>({...t,[e]:r.message||"Failed to fetch quota"}))}finally{z(t=>({...t,[e]:!1}))}},[]),eG=(0,s.useCallback)(async(e,t)=>{await eK(e,t),B(new Date)},[eK]),eH=(0,s.useCallback)(async(e,t)=>{if("codex"===t&&!el){en(e),R(t=>({...t,[e]:null}));try{let r=await fetch(`/api/usage/${e}/codex-reset-credits`,{method:"POST"}),a=await r.json().catch(()=>({}));if(!r.ok)throw Error(a.message||a.error||a.code||"Failed to reset Codex limit");await eK(e,t),B(new Date)}catch(t){R(r=>({...r,[e]:t.message||"Failed to reset Codex limit"}))}finally{en(null)}}},[eK,el]),eB=(0,s.useCallback)(async e=>{eu({connection:e,loading:!0,error:null,data:null});try{let t=await fetch(`/api/usage/${e.id}/codex-reset-credits`,{cache:"no-store"}),r=await t.json().catch(()=>({}));if(!t.ok)throw Error(r.error||r.message||"Failed to load Codex reset credits");let a=Array.isArray(r.credits)?[...r.credits]:[];a.sort((e,t)=>{let r=e.expiresAt?new Date(e.expiresAt).getTime():1/0,a=t.expiresAt?new Date(t.expiresAt).getTime():1/0;return r-a}),eu({connection:e,loading:!1,error:null,data:{...r,credits:a}})}catch(t){eu({connection:e,loading:!1,error:t.message||"Failed to load Codex reset credits",data:null})}},[]),eV=(0,s.useCallback)(async e=>{let t=x(r.find(t=>t.id===e)||{})||e;if(await (0,$.l)({message:`Delete connection “${t}”?`,confirmText:"Continue"})){ea(e);try{if((await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok){_(t=>{let r={...t};return delete r[e],r}),z(t=>{let r={...t};return delete r[e],r}),R(t=>{let r={...t};return delete r[e],r});try{let t=g();t[e]&&(delete t[e],window.localStorage.setItem(n,JSON.stringify(t)))}catch(e){(0,A.s)("Error deleting cache entry:",e)}await p(eJ,eq)}}catch(e){(0,A.s)("Error deleting connection:",e)}finally{ea(null)}}},[r,eJ,eq]),eW=(0,s.useCallback)(async(e,t)=>{ei(e);try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&(_(e=>({...e})),await p(eJ,eq))}catch(e){(0,A.s)("Error updating connection status:",e)}finally{ei(null)}},[eJ,eq]),eY=(0,s.useCallback)(async e=>{if(!eh?.id)return;let t=eh.id,r=eh.provider;try{(await fetch(`/api/providers/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await eJ(),em(!1),eb(null),C.wb.includes(r)&&await eK(t,r))}catch(e){(0,A.s)("Error saving connection:",e)}},[eh,eJ,eK]),eQ=(0,s.useCallback)(async(e=!1)=>{if(Y)return;Q(!0),Z(60);let t=eU.current+=1,r=Math.round(3);try{let a=await eJ(eq);z(h(a)),R(e=>b(e,a)),_(e=>b(e,a)),await Promise.all(a.filter(a=>e||"claude"!==a.provider||t%r==0).map(e=>eK(e.id,e.provider))),B(new Date)}catch(e){(0,A.s)("Error refreshing all providers:",e)}finally{Q(!1)}},[Y,eJ,eK,eq]);(0,s.useEffect)(()=>{(async()=>{et(!0);let e=await eJ(eq);et(!1),z(h(e)),R(t=>b(t,e)),_(t=>b(t,e)),await Promise.all(e.map(e=>eK(e.id,e.provider))),B(new Date)})()},[eJ,eK,eq]),(0,s.useEffect)(()=>{let e=window.localStorage.getItem(o);J(null===e||"true"===e),W(!0)},[]),(0,s.useEffect)(()=>{V&&window.localStorage.setItem(o,String(U))},[U,V]),(0,s.useEffect)(()=>{fetch("/api/settings",{cache:"no-store"}).then(e=>e.ok?e.json():{}).then(e=>G({claude:e?.claudeAutoPing?.connections||{},codex:e?.codexAutoPing?.connections||{}})).catch(()=>{})},[]);let eX=(0,s.useCallback)(async(e,t,r)=>{let a=q[t];if(!a)return;let s={...K[t]||{},[e]:r};G({...K,[t]:s});try{let e=await fetch("/api/settings",{cache:"no-store"}),t={...(e.ok?await e.json():{})[a]||{},connections:s};await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[a]:t})})}catch{G(K)}},[K]);(0,s.useEffect)(()=>{if(!V||!U){eL.current&&(clearInterval(eL.current),eL.current=null),eR.current&&(clearInterval(eR.current),eR.current=null);return}return eL.current=setInterval(()=>{eQ()},6e4),eR.current=setInterval(()=>{Z(e=>e<=1?60:e-1)},1e3),()=>{eL.current&&clearInterval(eL.current),eR.current&&clearInterval(eR.current)}},[U,eQ,V]),(0,s.useEffect)(()=>{let e=()=>{document.hidden?(eL.current&&(clearInterval(eL.current),eL.current=null),eR.current&&(clearInterval(eR.current),eR.current=null)):U&&V&&(eL.current=setInterval(()=>eQ(),6e4),eR.current=setInterval(()=>{Z(e=>e<=1?60:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[U,eQ,V]);let eZ=(0,s.useMemo)(()=>(function(e,t,r,a,s){if("codex"===a&&"default"!==s)return[...e].sort((e,r)=>{let a=m(e,t),i=m(r,t),l="remaining-asc"===s?a-i:i-a;return 0!==l?l:(x(e)||"").localeCompare(x(r)||"")});if(!r)return e;let i=e=>{let r=(t[e.id]?.quotas||[]).map(e=>e.resetAt?new Date(e.resetAt).getTime():1/0).filter(e=>Number.isFinite(e));return r.length>0?Math.min(...r):1/0};return[...e].sort((e,t)=>{let r=i(e)-i(t);return 0!==r?r:(e.provider||"").localeCompare(t.provider||"")||(x(e)||"").localeCompare(x(t)||"")})})(r,I,eN,ep,ek),[r,I,eN,ep,ek]),e0=e=>{let t=I[e.id]?.quotas;return!!t?.length&&t.some(e=>!!e.total&&!(e.total<=0)&&5>=y(e.used,e.total))},e1=(0,s.useCallback)(async(e,t)=>{if(e.length&&!e$){eE(!0);try{await Promise.all(e.map(e=>fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})}))),await p(eJ,eq)}catch(e){(0,A.s)("Error bulk toggling connections:",e)}finally{eE(!1)}}},[e$,eJ,eq]),e5="all"===ep?"All providers":ep,e2=eF.eligibleConnections>0,e3=eZ.length>0,e8=eF.eligibleConnections?eF.providerFilteredConnections?{icon:"filter_alt_off",title:"No Accounts On This Page",description:"Try moving to another page or refreshing the current filters."}:{icon:"filter_alt_off",title:"No Accounts Match Current Filters",description:"all"===ep?"Try changing the account status filter to see more quota trackers.":`No ${"inactive"===ev?"turned off":"active"===ev?"active":"matching"} accounts found for ${ep}.`}:{icon:"cloud_off",title:"No Providers Connected",description:"Connect to providers with OAuth to track your API quota limits and usage."},e4=function(e){var t;let{start:r,end:a}=(t=e).total?{start:(t.page-1)*t.pageSize+1,end:Math.min(t.page*t.pageSize,t.total)}:{start:0,end:0};return`Showing ${r}-${a} of ${e.total}`}(eI),e6=!d.includes(eD);return ee||e2?ee||e3?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-end",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>eA(e=>!e),className:"flex h-8 items-center justify-between gap-1 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-haspopup":"menu","aria-expanded":eS,title:"Filter quota providers",children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:["all"===ep?(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"apps"}):(0,a.jsx)(i.A,{src:`/providers/${ep}.png`,alt:ep,size:18,className:"size-[18px] rounded object-contain",fallbackText:ep.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"truncate capitalize hidden lg:inline",children:e5})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"expand_more"})]}),eS&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"fixed inset-0 z-30 bg-transparent","aria-label":"Close provider filter",onClick:()=>eA(!1)}),(0,a.jsxs)("div",{className:"absolute left-0 z-40 mt-2 w-64 overflow-hidden rounded-2xl border border-black/10 bg-surface/95 p-1.5 shadow-xl shadow-black/10 backdrop-blur dark:border-white/10 dark:bg-surface/95 sm:w-72",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>{"all"!==ep&&eP(1),eg("all"),eA(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${"all"===ep?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[22px]",children:"apps"}),(0,a.jsx)("span",{className:"font-medium",children:"All providers"}),"all"===ep&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]}),(0,a.jsx)("div",{className:"my-1 h-px bg-black/10 dark:bg-white/10"}),(0,a.jsx)("div",{className:"max-h-72 overflow-y-auto pr-1",children:ef.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{ep!==e&&eP(1),eg(e),eA(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${ep===e?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,a.jsx)(i.A,{src:`/providers/${e}.png`,alt:e,size:24,className:"size-6 rounded-md object-contain",fallbackText:e.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"font-medium capitalize",children:e}),ep===e&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]},e))})]})]})]}),(0,a.jsx)("select",{value:ev,onChange:e=>{let t=e.target.value;ev!==t&&eP(1),ej(t)},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Filter accounts by status",children:c.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),"codex"===ep&&(0,a.jsx)("select",{value:ek,onChange:e=>ew(e.target.value),className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Sort Codex quotas by remaining",children:u.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsxs)("button",{type:"button",onClick:()=>eC(e=>!e),"aria-pressed":eN,className:`flex h-8 shrink-0 items-center gap-1 rounded-lg border px-2 text-xs transition-colors ${eN?"border-amber-500/40 bg-amber-500/10 text-amber-500":"border-black/10 text-text-primary hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5"}`,title:"Sort accounts by earliest quota reset time",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"hourglass_top"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Expiring first"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{e1(eZ.filter(e=>(e.isActive??!0)&&e0(e)).map(e=>e.id),!1)},disabled:e$,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-red-500/30 px-2 text-xs text-red-500 transition-colors hover:bg-red-500/10 disabled:opacity-50",title:"Disable connections with depleted quota on the current page",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"block"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Turn off Empty"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{e1(eZ.filter(e=>!(e.isActive??!0)&&!e0(e)).map(e=>e.id),!0)},disabled:e$,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-emerald-500/30 px-2 text-xs text-emerald-500 transition-colors hover:bg-emerald-500/10 disabled:opacity-50",title:"Enable connections that still have quota on the current page",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Turn on Available"})]}),(0,a.jsxs)("button",{onClick:()=>J(e=>!e),className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-black/10 px-2 text-xs transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5",title:U?"Disable auto-refresh":"Enable auto-refresh",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${U?"text-primary":"text-text-muted"}`,children:U?"toggle_on":"toggle_off"}),(0,a.jsx)("span",{className:"hidden text-text-primary sm:inline",children:"Auto-refresh"}),U&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted tabular-nums",children:["(",X,"s)"]})]}),(0,a.jsx)("button",{type:"button",onClick:()=>eQ(!0),disabled:Y,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-black/10 px-2 text-xs text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5 disabled:opacity-50",title:"Refresh all",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${Y?"animate-spin":""}`,children:"refresh"})})]})}),eN&&(0,a.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",children:"Expiring-first currently reorders accounts inside the current page. Cross-page ordering still follows backend pagination."}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:eZ.map(r=>{let s,l,n,o=I[r.id],d=F[r.id],c=L[r.id],u=!1===r.isActive,m="codex"===r.provider,h=Number.isFinite(l="number"==typeof(s=o?.raw?.resetCredits?.availableCount)?s:Number(s))?Math.max(0,l):0,b=el===r.id,p=er===r.id||es===r.id||b;return(0,a.jsxs)(w.default,{padding:"none",className:`min-w-0 ${u?"opacity-60":""}`,children:[(0,a.jsx)("div",{className:"px-3 py-2 border-b border-black/10 dark:border-white/10",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)("div",{className:"w-8 h-8 shrink-0 rounded-md flex items-center justify-center overflow-hidden",children:(0,a.jsx)(i.A,{src:`/providers/${r.provider}.png`,alt:r.provider,size:32,className:"object-contain",fallbackText:r.provider?.slice(0,2).toUpperCase()||"PR"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-primary capitalize truncate",children:r.provider}),x(r)?(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:x(r)}):null,D(r)?(0,a.jsx)("p",{className:"text-[11px] text-text-muted/80 truncate",children:D(r)}):null,"kiro"===r.provider&&(0,a.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[(0,a.jsx)("span",{className:"rounded-full bg-brand-500/10 px-2 py-0.5 text-[10px] font-semibold text-brand-600 dark:text-brand-300",children:(n=r.providerSpecificData?.authMethod)&&E[n]?E[n]:"api_key"===r.authType?"API Key":"OAuth"}),T(r)&&(0,a.jsx)("span",{className:"rounded-full bg-blue-500/10 px-2 py-0.5 text-[10px] font-semibold text-blue-600 dark:text-blue-400",children:T(r)}),(0,a.jsx)("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-semibold ${u?"bg-surface-2 text-text-muted":"active"===r.testStatus||"success"===r.testStatus?"bg-green-500/10 text-green-600 dark:text-green-400":"error"===r.testStatus||"expired"===r.testStatus||"unavailable"===r.testStatus?"bg-red-500/10 text-red-600 dark:text-red-400":"bg-surface-2 text-text-muted"}`,children:u?"disabled":r.testStatus||"unknown"}),r.providerSpecificData?.profileArn&&(0,a.jsxs)("button",{type:"button",onClick:()=>t(r.providerSpecificData.profileArn,r.id),title:r.providerSpecificData.profileArn,className:"inline-flex max-w-full items-center gap-1 rounded-full border border-border-subtle px-2 py-0.5 text-[10px] text-text-muted transition-colors hover:text-primary",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:e===r.id?"check":"content_copy"}),(0,a.jsx)("code",{className:"truncate font-mono",children:r.providerSpecificData.profileArn})]})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[m&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(k.default,{text:h>0?`Use one Codex reset credit. Available: ${h}`:"No Codex reset credits available",children:(0,a.jsxs)("button",{type:"button",onClick:()=>ed({connection:r,resetCreditCount:h}),disabled:h<=0||d||p,"aria-label":h>0?`Use one Codex reset credit. ${h} available.`:"No Codex reset credits available",className:`flex h-8 min-w-10 items-center justify-center gap-1 rounded-lg border px-2 text-[11px] font-medium tabular-nums transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary/60 disabled:cursor-not-allowed disabled:opacity-60 ${h>0?"border-primary/30 bg-primary/5 text-primary hover:bg-primary/10":"border-black/10 bg-black/[0.02] text-text-muted dark:border-white/10 dark:bg-white/[0.03]"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[15px] ${b?"animate-spin":""}`,children:b?"progress_activity":"restart_alt"}),(0,a.jsx)("span",{children:h})]})}),(0,a.jsx)(k.default,{text:"View Codex reset credit expiry",children:(0,a.jsx)("button",{type:"button",onClick:()=>eB(r),disabled:d||p,"aria-label":"View Codex reset credit expiry",className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-text-muted transition-colors hover:bg-black/5 hover:text-primary disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/10 dark:hover:bg-white/5",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"schedule"})})})]}),q[r.provider]&&"oauth"===r.authType&&(0,a.jsx)(k.default,{text:P[r.provider],children:(0,a.jsx)("button",{type:"button",onClick:()=>eX(r.id,r.provider,K[r.provider]?.[r.id]!==!0),"aria-label":"Toggle auto-ping",className:`flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${K[r.provider]?.[r.id]===!0?"text-primary":"text-text-muted"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"})})}),(0,a.jsx)(k.default,{text:"Refresh quota",children:(0,a.jsx)("button",{type:"button",onClick:()=>eG(r.id,r.provider),disabled:d||p,"aria-label":"Refresh quota",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-black/5 dark:hover:bg-white/5 transition-colors disabled:opacity-50",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted ${d?"animate-spin":""}`,children:"refresh"})})}),(0,a.jsx)(k.default,{text:"Edit connection",children:(0,a.jsx)("button",{type:"button",onClick:()=>{eb(r),em(!0)},disabled:p,"aria-label":"Edit connection",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary transition-colors disabled:opacity-50",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})})}),(0,a.jsx)(k.default,{text:"Delete connection",children:(0,a.jsx)("button",{type:"button",onClick:()=>eV(r.id),disabled:p,"aria-label":"Delete connection",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-red-500/10 text-red-500 transition-colors disabled:opacity-50",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] ${er===r.id?"animate-pulse":""}`,children:"delete"})})}),(0,a.jsx)("div",{className:"inline-flex items-center pl-0.5",title:r.isActive??!0?"Disable connection":"Enable connection",children:(0,a.jsx)(j.default,{size:"sm",checked:r.isActive??!0,disabled:p,onChange:e=>eW(r.id,e)})})]})]})}),(0,a.jsx)("div",{className:"px-2 py-1.5",children:d?(0,a.jsx)("div",{className:"text-center py-5 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px] animate-spin",children:"progress_activity"})}):c?(0,a.jsxs)("div",{className:"text-center py-5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px] text-red-500",children:"error"}),(0,a.jsx)("p",{className:"mt-1.5 text-xs text-text-muted",children:c})]}):o?.message?(0,a.jsx)("div",{className:"text-center py-5",children:(0,a.jsx)("p",{className:"text-xs text-text-muted",children:o.message})}):(0,a.jsx)(v,{quotas:o?.quotas,compact:!0,sortMode:"default",showSortLabel:"codex"===r.provider&&"default"!==ek})})]},r.id)})}),(0,a.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:e4}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("select",{value:e6?"custom":String(eD),onChange:e=>{let t=e.target.value;if("custom"===t)return;let r=Number.parseInt(t,10);Number.isFinite(r)&&(eP(1),eT(r),eO(String(r)))},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Accounts per page",children:[d.map(e=>(0,a.jsxs)("option",{value:String(e),children:[e," / page"]},e)),(0,a.jsx)("option",{value:"custom",children:"Custom"})]}),(0,a.jsx)("input",{type:"number",min:"1",max:String(500),inputMode:"numeric",value:eM,onChange:e=>eO(e.target.value),onBlur:()=>{let e=Number.parseInt(eM,10);if(!Number.isFinite(e))return void eO(String(eD));let t=Math.min(500,Math.max(1,e));eP(1),eT(t),eO(String(t))},onKeyDown:e=>{if("Enter"!==e.key)return;let t=Number.parseInt(eM,10);if(!Number.isFinite(t))return void eO(String(eD));let r=Math.min(500,Math.max(1,t));eP(1),eT(r),eO(String(r))},className:"h-8 w-20 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Custom accounts per page",placeholder:"Custom"}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Page ",eI.page," / ",eI.totalPages]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("button",{type:"button",onClick:()=>eP(1),disabled:eI.page<=1||ee||Y,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"First Page"}),(0,a.jsx)("button",{type:"button",onClick:()=>eP(e=>Math.max(1,e-1)),disabled:eI.page<=1||ee||Y,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5","aria-label":"Previous accounts page",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"chevron_left"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eP(e=>Math.min(eI.totalPages,e+1)),disabled:eI.page>=eI.totalPages||ee||Y,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5","aria-label":"Next accounts page",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"chevron_right"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eP(eI.totalPages),disabled:eI.page>=eI.totalPages||ee||Y,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Last Page"})]})]})}),(0,a.jsx)(N.uo,{isOpen:!!eo,onClose:()=>{el||ed(null)},onConfirm:async()=>{let e=eo?.connection;e&&(await eH(e.id,e.provider),ed(null))},title:"Reset Codex limit?",message:`Use 1 Codex reset credit for ${x(eo?.connection||{})||"this account"}. This cannot be undone. Remaining credits: ${eo?.resetCreditCount??0}.`,confirmText:"Reset limit",cancelText:"Cancel",variant:"danger",loading:!!el}),ec&&(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 px-4 backdrop-blur-sm",children:(0,a.jsxs)("div",{className:"w-full max-w-2xl overflow-hidden rounded-2xl border border-black/15 bg-white shadow-2xl ring-1 ring-black/10 dark:border-white/15 dark:bg-neutral-950 dark:ring-white/10",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3 border-b border-black/10 bg-black/[0.03] px-4 py-3 dark:border-white/10 dark:bg-white/[0.04]",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-base font-semibold text-text-primary",children:"Codex Reset Credit Expiry"}),(0,a.jsx)("p",{className:"mt-0.5 truncate text-xs text-text-muted",children:x(ec.connection)||"Codex account"})]}),(0,a.jsx)("button",{type:"button",onClick:()=>eu(null),className:"flex h-8 w-8 items-center justify-center rounded-lg text-text-muted transition-colors hover:bg-black/5 hover:text-text-primary dark:hover:bg-white/5","aria-label":"Close reset credit expiry modal",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),(0,a.jsx)("div",{className:"max-h-[70vh] overflow-auto bg-white p-4 dark:bg-neutral-950",children:ec.loading?(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2 py-10 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[20px]",children:"progress_activity"}),"Loading reset credits..."]}):ec.error?(0,a.jsx)("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-3 py-2 text-sm text-red-600 dark:text-red-300",children:ec.error}):ec.data?.credits?.length?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("span",{children:[ec.data.credits.length," reset credit",1===ec.data.credits.length?"":"s"]}),(0,a.jsxs)("span",{children:[ec.data.availableCount??0," available"]})]}),(0,a.jsx)("div",{className:"overflow-x-auto rounded-xl border border-black/10 dark:border-white/10",children:(0,a.jsxs)("table",{className:"w-full min-w-[560px] text-left text-sm",children:[(0,a.jsx)("thead",{className:"bg-black/[0.03] text-xs uppercase tracking-wide text-text-muted dark:bg-white/[0.04]",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Status"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Granted At"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Expires At"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Remaining"})]})}),(0,a.jsx)("tbody",{children:ec.data.credits.map((e,t)=>(0,a.jsxs)("tr",{className:"border-t border-black/5 dark:border-white/5",children:[(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsx)("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:e.status||"unknown"})}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-muted",children:M(e.grantedAt)}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-primary",children:M(e.expiresAt)}),(0,a.jsx)("td",{className:"px-3 py-2 font-medium text-text-primary",children:function(e){if(!e)return"N/A";let t=new Date(e).getTime()-Date.now();if(!Number.isFinite(t))return"N/A";if(t<=0)return"Expired";let r=Math.ceil(t/36e5),a=Math.floor(r/24),s=r%24;return a>0?`${a}d ${s}h`:`${s}h`}(e.expiresAt)})]},`${e.status}-${e.expiresAt||t}`))})]})})]}):(0,a.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-8 text-center text-sm text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:"No reset credit details returned for this account."})})]})}),(0,a.jsx)(N.wI,{isOpen:ex,connection:eh,onSave:eY,onClose:()=>{em(!1),eb(null)}})]}):(0,a.jsx)(w.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] text-text-muted opacity-20",children:e8.icon}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:e8.title}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:e8.description})]})}):(0,a.jsx)(w.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] text-text-muted opacity-20",children:"cloud_off"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:"No Providers Connected"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:"Connect to providers with OAuth to track your API quota limits and usage."})]})})}}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=17002)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2838],{23262:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>x});var a=s(95155),i=s(12115),n=s(98500),r=s.n(n),l=s(73321),o=s(35497),d=s(11059),c=s(46453),m=s(23241);function x(){let e=(0,l.useParams)(),t="string"==typeof e?.id?e.id:"",s=c.J3.find(e=>e.id===t),[n,x]=(0,i.useState)(""),[p,h]=(0,i.useState)({}),[u,f]=(0,i.useState)(""),[b,j]=(0,i.useState)(!0),[y,N]=(0,i.useState)(""),{copied:g,copy:k}=(0,d.C)(2e3),w=(0,c.Rz)(t);(0,i.useEffect)(()=>{N(`${window.location.origin}${w}`)},[w]),(0,i.useEffect)(()=>{if(!t)return;let e=!1;return j(!0),f(""),x(""),fetch(w).then(async e=>{if(!e.ok)throw Error((await e.json().catch(()=>({}))).error||`HTTP ${e.status}`);return e.text()}).then(t=>{if(e)return;let{html:s,meta:a}=(0,m.L6)(t);h(a),x(s)}).catch(t=>{e||f(t.message||"Failed to load skill")}).finally(()=>{e||j(!1)}),()=>{e=!0}},[t,w]);let v=s?.name||p.name||t,_=s?.description||p.description||"";return(0,a.jsxs)("div",{className:"max-w-3xl mx-auto space-y-4 pb-10",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)(r(),{href:"/dashboard/skills",className:"text-xs text-text-muted hover:text-primary inline-flex items-center gap-1 mb-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"arrow_back"}),"All skills"]}),(0,a.jsx)("h1",{className:"text-[20px] font-semibold text-text-main tracking-tight",children:v}),_?(0,a.jsx)("p",{className:"text-sm text-text-muted mt-1 leading-relaxed",children:_}):null]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 shrink-0",children:[(0,a.jsxs)(o.$n,{size:"sm",variant:"secondary",onClick:()=>k(y||w),title:y||w,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:g?"check":"content_copy"}),g?"Copied!":"Copy raw URL"]}),(0,a.jsxs)("a",{href:w,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 px-2.5 py-1.5 rounded-md border border-border text-xs text-text-main hover:border-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"open_in_new"}),"Raw markdown"]})]})]}),(y||w)&&!b&&!u?(0,a.jsxs)("div",{className:"rounded-lg border border-border-subtle bg-surface-2 px-3 py-2",children:[(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-text-subtle font-semibold mb-0.5",children:"Agent fetch URL"}),(0,a.jsx)("code",{className:"text-[12px] font-mono text-text-main break-all",children:y||w})]}):null,(0,a.jsxs)(o.Zp,{padding:"lg",className:"overflow-hidden",children:[b&&(0,a.jsxs)("p",{className:"text-sm text-text-muted flex items-center gap-2 py-8 justify-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}),"Loading skill…"]}),u&&(0,a.jsxs)("div",{className:"text-sm text-red-400 py-4",children:[(0,a.jsx)("p",{className:"font-medium",children:"Could not load skill"}),(0,a.jsx)("p",{className:"text-xs mt-1 opacity-80",children:u}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Expected file: ",(0,a.jsxs)("code",{className:"font-mono",children:["skills/",t,"/SKILL.md"]})]})]}),b||u||!n?null:(0,a.jsx)("article",{className:"skill-md",dangerouslySetInnerHTML:{__html:n}})]})]})}},46453:(e,t,s)=>{"use strict";s.d(t,{EV:()=>n,J3:()=>a,Rz:()=>i});let a=[{id:"switchboard",name:"Switchboard (Entry)",description:"Setup, model discovery, combos & Auto routing. Start here — one /v1 endpoint, multi-provider gateway.",endpoint:"/v1",icon:"hub",isEntry:!0},{id:"switchboard-chat",name:"Chat",description:"Chat / code-gen via OpenAI, Anthropic, or Responses formats — streaming, tools, combo as model.",endpoint:"/v1/chat/completions",icon:"chat"}];function i(e){return`/api/skills/${e}`}function n(e){return`/dashboard/skills/${e}`}},98745:(e,t,s)=>{Promise.resolve().then(s.bind(s,23262))}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=98745)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2838],{23262:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>x});var a=s(95155),i=s(12115),n=s(98500),r=s.n(n),l=s(73321),o=s(35497),d=s(11059),c=s(46453),m=s(23241);function x(){let e=(0,l.useParams)(),t="string"==typeof e?.id?e.id:"",s=c.J3.find(e=>e.id===t),[n,x]=(0,i.useState)(""),[p,h]=(0,i.useState)({}),[u,f]=(0,i.useState)(""),[b,j]=(0,i.useState)(!0),[y,N]=(0,i.useState)(""),{copied:g,copy:k}=(0,d.C)(2e3),w=(0,c.Rz)(t);(0,i.useEffect)(()=>{N(`${window.location.origin}${w}`)},[w]),(0,i.useEffect)(()=>{if(!t)return;let e=!1;return j(!0),f(""),x(""),fetch(w).then(async e=>{if(!e.ok)throw Error((await e.json().catch(()=>({}))).error||`HTTP ${e.status}`);return e.text()}).then(t=>{if(e)return;let{html:s,meta:a}=(0,m.L6)(t);h(a),x(s)}).catch(t=>{e||f(t.message||"Failed to load skill")}).finally(()=>{e||j(!1)}),()=>{e=!0}},[t,w]);let v=s?.name||p.name||t,_=s?.description||p.description||"";return(0,a.jsxs)("div",{className:"max-w-3xl mx-auto space-y-4 pb-10",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)(r(),{href:"/dashboard/skills",className:"text-xs text-text-muted hover:text-primary inline-flex items-center gap-1 mb-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"arrow_back"}),"All skills"]}),(0,a.jsx)("h1",{className:"text-[20px] font-semibold text-text-main tracking-tight",children:v}),_?(0,a.jsx)("p",{className:"text-sm text-text-muted mt-1 leading-relaxed",children:_}):null]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 shrink-0",children:[(0,a.jsxs)(o.$n,{size:"sm",variant:"secondary",onClick:()=>k(y||w),title:y||w,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:g?"check":"content_copy"}),g?"Copied!":"Copy raw URL"]}),(0,a.jsxs)("a",{href:w,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 px-2.5 py-1.5 rounded-md border border-border text-xs text-text-main hover:border-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"open_in_new"}),"Raw markdown"]})]})]}),(y||w)&&!b&&!u?(0,a.jsxs)("div",{className:"rounded-lg border border-border-subtle bg-surface-2 px-3 py-2",children:[(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-text-subtle font-semibold mb-0.5",children:"Agent fetch URL"}),(0,a.jsx)("code",{className:"text-[12px] font-mono text-text-main break-all",children:y||w})]}):null,(0,a.jsxs)(o.Zp,{padding:"lg",className:"overflow-hidden",children:[b&&(0,a.jsxs)("p",{className:"text-sm text-text-muted flex items-center gap-2 py-8 justify-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}),"Loading skill…"]}),u&&(0,a.jsxs)("div",{className:"text-sm text-red-400 py-4",children:[(0,a.jsx)("p",{className:"font-medium",children:"Could not load skill"}),(0,a.jsx)("p",{className:"text-xs mt-1 opacity-80",children:u}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Expected file: ",(0,a.jsxs)("code",{className:"font-mono",children:["skills/",t,"/SKILL.md"]})]})]}),b||u||!n?null:(0,a.jsx)("article",{className:"skill-md",dangerouslySetInnerHTML:{__html:n}})]})]})}},46453:(e,t,s)=>{"use strict";s.d(t,{EV:()=>n,J3:()=>a,Rz:()=>i});let a=[{id:"switchboard",name:"Switchboard (Entry)",description:"Setup, model discovery, combos & Auto routing. Start here — one /v1 endpoint, multi-provider gateway.",endpoint:"/v1",icon:"hub",isEntry:!0},{id:"switchboard-chat",name:"Chat",description:"Chat / code-gen via OpenAI, Anthropic, or Responses formats — streaming, tools, combo as model.",endpoint:"/v1/chat/completions",icon:"chat"}];function i(e){return`/api/skills/${e}`}function n(e){return`/dashboard/skills/${e}`}},98745:(e,t,s)=>{Promise.resolve().then(s.bind(s,23262))}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=98745)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9516],{36072:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>x});var n=s(95155),i=s(12115),r=s(35497),a=s(11059),l=s(46453);function o(e,t){return t?/^https?:\/\//i.test(t)?t:`${e||""}${t.startsWith("/")?t:`/${t}`}`:""}function d({value:e,label:t="Copy link"}){let{copied:s,copy:i}=(0,a.C)(2e3);return(0,n.jsxs)("button",{type:"button",onClick:()=>i(e),className:"px-2 py-1 rounded-md bg-primary text-on-primary text-[11px] font-medium hover:bg-primary/90 transition-colors cursor-pointer shrink-0 inline-flex items-center gap-1",title:e,children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:s?"check":"content_copy"}),s?"Copied!":t]})}function c({skill:e,origin:t}){let s=(0,l.Rz)(e.id),i=(0,l.EV)(e.id),a=o(t,s),x=o(t,i);return(0,n.jsxs)("div",{className:`flex items-start gap-3 p-4 rounded-[14px] border shadow-[var(--shadow-soft)] transition-colors ${e.isEntry?"border-brand-500/40 bg-brand-500/5":"border-border-subtle bg-surface hover:bg-surface-2"}`,children:[(0,n.jsx)("div",{className:`size-9 rounded-lg flex items-center justify-center shrink-0 ${e.isEntry?"bg-primary text-on-primary":"bg-primary/10 text-primary"}`,children:(0,n.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:e.icon})}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,n.jsx)("h3",{className:"font-semibold text-sm text-text-main",children:e.name}),e.isEntry&&(0,n.jsx)(r.Ex,{variant:"primary",size:"sm",children:"START HERE"}),e.endpoint&&(0,n.jsx)(r.Ex,{variant:"default",size:"sm",children:(0,n.jsx)("code",{className:"text-[10px]",children:e.endpoint})})]}),(0,n.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:e.description}),(0,n.jsxs)("div",{className:"mt-2 flex flex-col gap-1",children:[(0,n.jsxs)("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] text-primary hover:underline inline-flex items-center gap-1 w-fit",children:["Open skill docs",(0,n.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"open_in_new"})]}),(0,n.jsx)("code",{className:"text-[11px] font-mono text-text-subtle break-all",title:"Paste this URL to an AI agent",children:a||s})]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-1.5 shrink-0 items-end",children:[(0,n.jsx)(d,{value:a||s,label:"Copy agent URL"}),(0,n.jsxs)("a",{href:x||i,target:"_blank",rel:"noopener noreferrer",className:"px-2 py-1 rounded-md border border-border text-[11px] text-text-main hover:border-primary inline-flex items-center gap-1 transition-colors",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"open_in_new"}),"Open"]})]})]})}function x(){let e=function(){let[e,t]=(0,i.useState)("");return(0,i.useEffect)(()=>{t(window.location.origin)},[]),e}(),t=o(e,(0,l.Rz)("switchboard"));return(0,n.jsxs)("div",{className:"max-w-4xl mx-auto space-y-6",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)("h1",{className:"text-[17px] font-semibold text-text-main",children:"Skills"}),(0,n.jsx)("p",{className:"text-xs font-mono text-text-subtle",children:"agent skill links \xb7 not Media providers"})]}),(0,n.jsxs)(r.Zp,{padding:"md",children:[(0,n.jsx)("div",{className:"text-xs text-text-muted mb-2",children:"Paste this to your AI:"}),(0,n.jsxs)("div",{className:"px-3 py-2 rounded bg-surface-2 font-mono text-[12px] text-text-main break-all",children:["Read this skill and use it: ",t||(0,l.Rz)("switchboard")]})]}),(0,n.jsx)("div",{className:"space-y-2",children:l.J3.map(t=>(0,n.jsx)(c,{skill:t,origin:e},t.id))}),(0,n.jsx)(r.Zp,{padding:"md",children:(0,n.jsxs)("p",{className:"text-xs text-text-muted leading-relaxed",children:[(0,n.jsx)("strong",{className:"text-text-main",children:"Open"})," opens a readable docs page in a new tab. ",(0,n.jsx)("strong",{className:"text-text-main",children:"Copy agent URL"})," copies"," ",(0,n.jsx)("code",{className:"text-[11px]",children:"/api/skills/<id>"})," for AI agents to fetch the raw markdown."]})})]})}},46453:(e,t,s)=>{"use strict";s.d(t,{EV:()=>r,J3:()=>n,Rz:()=>i});let n=[{id:"switchboard",name:"Switchboard (Entry)",description:"Setup, model discovery, combos & Auto routing. Start here — one /v1 endpoint, multi-provider gateway.",endpoint:"/v1",icon:"hub",isEntry:!0},{id:"switchboard-chat",name:"Chat",description:"Chat / code-gen via OpenAI, Anthropic, or Responses formats — streaming, tools, combo as model.",endpoint:"/v1/chat/completions",icon:"chat"}];function i(e){return`/api/skills/${e}`}function r(e){return`/dashboard/skills/${e}`}},49137:(e,t,s)=>{Promise.resolve().then(s.bind(s,36072))}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=49137)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9516],{36072:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>x});var n=s(95155),i=s(12115),r=s(35497),a=s(11059),l=s(46453);function o(e,t){return t?/^https?:\/\//i.test(t)?t:`${e||""}${t.startsWith("/")?t:`/${t}`}`:""}function d({value:e,label:t="Copy link"}){let{copied:s,copy:i}=(0,a.C)(2e3);return(0,n.jsxs)("button",{type:"button",onClick:()=>i(e),className:"px-2 py-1 rounded-md bg-primary text-on-primary text-[11px] font-medium hover:bg-primary/90 transition-colors cursor-pointer shrink-0 inline-flex items-center gap-1",title:e,children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:s?"check":"content_copy"}),s?"Copied!":t]})}function c({skill:e,origin:t}){let s=(0,l.Rz)(e.id),i=(0,l.EV)(e.id),a=o(t,s),x=o(t,i);return(0,n.jsxs)("div",{className:`flex items-start gap-3 p-4 rounded-[14px] border shadow-[var(--shadow-soft)] transition-colors ${e.isEntry?"border-brand-500/40 bg-brand-500/5":"border-border-subtle bg-surface hover:bg-surface-2"}`,children:[(0,n.jsx)("div",{className:`size-9 rounded-lg flex items-center justify-center shrink-0 ${e.isEntry?"bg-primary text-on-primary":"bg-primary/10 text-primary"}`,children:(0,n.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:e.icon})}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,n.jsx)("h3",{className:"font-semibold text-sm text-text-main",children:e.name}),e.isEntry&&(0,n.jsx)(r.Ex,{variant:"primary",size:"sm",children:"START HERE"}),e.endpoint&&(0,n.jsx)(r.Ex,{variant:"default",size:"sm",children:(0,n.jsx)("code",{className:"text-[10px]",children:e.endpoint})})]}),(0,n.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:e.description}),(0,n.jsxs)("div",{className:"mt-2 flex flex-col gap-1",children:[(0,n.jsxs)("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] text-primary hover:underline inline-flex items-center gap-1 w-fit",children:["Open skill docs",(0,n.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"open_in_new"})]}),(0,n.jsx)("code",{className:"text-[11px] font-mono text-text-subtle break-all",title:"Paste this URL to an AI agent",children:a||s})]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-1.5 shrink-0 items-end",children:[(0,n.jsx)(d,{value:a||s,label:"Copy agent URL"}),(0,n.jsxs)("a",{href:x||i,target:"_blank",rel:"noopener noreferrer",className:"px-2 py-1 rounded-md border border-border text-[11px] text-text-main hover:border-primary inline-flex items-center gap-1 transition-colors",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"open_in_new"}),"Open"]})]})]})}function x(){let e=function(){let[e,t]=(0,i.useState)("");return(0,i.useEffect)(()=>{t(window.location.origin)},[]),e}(),t=o(e,(0,l.Rz)("switchboard"));return(0,n.jsxs)("div",{className:"max-w-4xl mx-auto space-y-6",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)("h1",{className:"text-[17px] font-semibold text-text-main",children:"Skills"}),(0,n.jsx)("p",{className:"text-xs font-mono text-text-subtle",children:"agent skill links \xb7 not Media providers"})]}),(0,n.jsxs)(r.Zp,{padding:"md",children:[(0,n.jsx)("div",{className:"text-xs text-text-muted mb-2",children:"Paste this to your AI:"}),(0,n.jsxs)("div",{className:"px-3 py-2 rounded bg-surface-2 font-mono text-[12px] text-text-main break-all",children:["Read this skill and use it: ",t||(0,l.Rz)("switchboard")]})]}),(0,n.jsx)("div",{className:"space-y-2",children:l.J3.map(t=>(0,n.jsx)(c,{skill:t,origin:e},t.id))}),(0,n.jsx)(r.Zp,{padding:"md",children:(0,n.jsxs)("p",{className:"text-xs text-text-muted leading-relaxed",children:[(0,n.jsx)("strong",{className:"text-text-main",children:"Open"})," opens a readable docs page in a new tab. ",(0,n.jsx)("strong",{className:"text-text-main",children:"Copy agent URL"})," copies"," ",(0,n.jsx)("code",{className:"text-[11px]",children:"/api/skills/<id>"})," for AI agents to fetch the raw markdown."]})})]})}},46453:(e,t,s)=>{"use strict";s.d(t,{EV:()=>r,J3:()=>n,Rz:()=>i});let n=[{id:"switchboard",name:"Switchboard (Entry)",description:"Setup, model discovery, combos & Auto routing. Start here — one /v1 endpoint, multi-provider gateway.",endpoint:"/v1",icon:"hub",isEntry:!0},{id:"switchboard-chat",name:"Chat",description:"Chat / code-gen via OpenAI, Anthropic, or Responses formats — streaming, tools, combo as model.",endpoint:"/v1/chat/completions",icon:"chat"}];function i(e){return`/api/skills/${e}`}function r(e){return`/dashboard/skills/${e}`}},49137:(e,t,s)=>{Promise.resolve().then(s.bind(s,36072))}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=49137)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9839],{46357:(e,t,a)=>{Promise.resolve().then(a.bind(a,70323))},70323:(e,t,a)=>{"use strict";a.d(t,{default:()=>x});var s=a(95155),r=a(12115),l=a(35497),n=a(11059),i=a(73006);let o=["zh-CN"],d=[{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"},{id:"wenyan-lite",label:"文 Lite",desc:"Classical Chinese, light compression",wenyan:!0},{id:"wenyan",label:"文 Full",desc:"Maximum 文言文, 80-90% reduction",wenyan:!0},{id:"wenyan-ultra",label:"文 Ultra",desc:"Extreme classical compression",wenyan:!0}],c=[{id:"lite",label:"Lite",desc:"Build asked, name lazier option"},{id:"full",label:"Full",desc:"Ladder enforced: stdlib/native first"},{id:"ultra",label:"Ultra",desc:"YAGNI extremist, deletion first"}];var m=a(78559);function x(){let e,[t,a]=(0,r.useState)(!0),[x,h]=(0,r.useState)(!1),[p,u]=(0,r.useState)(8),[f,b]=(0,r.useState)({entries:0,hits:0,bytesSaved:0}),j=(0,r.useRef)({}),[y,v]=(0,r.useState)(!1),[g,N]=(0,r.useState)("http://localhost:8787"),[k,w]=(0,r.useState)({installed:!1,running:!1,python:null,loading:!0}),[C,S]=(0,r.useState)(!1),[E,L]=(0,r.useState)(!1),[B,U]=(0,r.useState)(""),[T,_]=(0,r.useState)(!1),[M,$]=(0,r.useState)("full"),[H,P]=(0,r.useState)(!1),[O,F]=(0,r.useState)("full"),[R,z]=(0,r.useState)("en"),{copied:D,copy:K}=(0,n.C)();(0,r.useEffect)(()=>(z((0,i.kk)()),(0,i.oQ)(()=>z((0,i.kk)()))),[]);let I=o.includes(R),A=I?d:d.filter(e=>!e.wenyan);(0,r.useEffect)(()=>{let e=d.find(e=>e.id===M);e?.wenyan&&!I&&($("ultra"),W({cavemanLevel:"ultra"}))},[I,M]);let W=async e=>{try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(e){(0,m.s)("Error updating setting:",e)}},G=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({rtkEnabled:e})})).ok&&a(e)}catch(e){(0,m.s)("Error updating rtkEnabled:",e)}},J=async()=>{let e=g.trim()||"http://localhost:8787";N(e),await W({headroomUrl:e}),Z()},Y=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/token-saver/vault-stats",{headers:{"Cache-Control":"no-store"}});e.ok&&b(await e.json())}catch{}},[]),Z=(0,r.useCallback)(async()=>{w(e=>({...e,loading:!0}));try{let e=await fetch("/api/headroom/status",{headers:{"Cache-Control":"no-store"}}),t=await e.json();w({...t,loading:!1})}catch{w({installed:!1,running:!1,python:null,loading:!1})}},[]),q=(0,r.useCallback)(async()=>{U(""),L(!0);try{let e=await fetch("/api/headroom/start",{method:"POST"}),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error||"Failed to start proxy");await Z()}catch(e){U(e.message)}finally{L(!1)}},[Z]),Q=(0,r.useCallback)(async()=>{L(!0);try{await fetch("/api/headroom/stop",{method:"POST"}),await Z()}finally{L(!1)}},[Z]);(0,r.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/settings");if(e.ok){let t=await e.json();a(!1!==t.rtkEnabled),j.current=t.tokenSaver&&"object"==typeof t.tokenSaver?t.tokenSaver:{},h(!!t.tokenSaver?.vault),u(t.tokenSaver?.vaultThresholdKB??8),v(!!t.headroomEnabled),N(t.headroomUrl||"http://localhost:8787"),_(!!t.cavemanEnabled),$(t.cavemanLevel||"full"),P(!!t.ponytailEnabled),F(t.ponytailLevel||"full"),Z()}}catch{}})()},[Z]),(0,r.useEffect)(()=>{Y()},[Y]);let V=!!k.running,X=k.loading?"Checking…":V?"Running":!1===k.localUrl||k.installed?!1!==k.localUrl?"Stopped":"External":"Not installed",ee=!1!==k.localUrl,et=!!k.canStart,ea=ee&&!!k.managedPid;return(0,s.jsxs)("div",{className:"space-y-6 p-6",children:[(0,s.jsxs)(l.Zp,{id:"rtk",children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,s.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-primary",children:"bolt"}),"Token Saver"]})}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-2 pb-4 border-b border-border gap-4",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("p",{className:"font-medium",children:["Compress tool output"," ",(0,s.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,s.jsx)("p",{className:"text-sm text-text-muted",children:"git/grep/ls/tree/logs → 60-90% fewer input tokens"})]}),(0,s.jsx)(l.lM,{checked:t,onChange:()=>G(!t)})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between py-4 border-b border-border gap-4 flex-wrap",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,s.jsxs)("p",{className:"font-medium",children:["Compress context"," ",(0,s.jsx)("a",{href:"https://github.com/chopratejas/headroom",target:"_blank",rel:"noreferrer",className:"text-xs font-normal text-primary underline hover:opacity-80",children:"(Headroom)"})]}),(0,s.jsx)("span",{className:`text-xs px-2 py-0.5 rounded ${V?"bg-success/15 text-success":"bg-warning/15 text-warning"}`,children:X}),(0,s.jsx)("button",{type:"button",onClick:()=>S(!0),className:"text-xs text-primary underline hover:opacity-80",children:V?"Manage":"Setup"})]}),(0,s.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Compress prompts via /v1/compress before routing to the model"})]}),(0,s.jsx)(l.lM,{checked:y&&V,disabled:!V,onChange:()=>{var e;let t;return e=!y,void(N(t=g.trim()||"http://localhost:8787"),v(e),W({headroomEnabled:e,headroomUrl:t}))}})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-4 gap-4 flex-wrap",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("p",{className:"font-medium",children:["Compress LLM output"," ",(0,s.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,s.jsx)("p",{className:"text-sm text-text-muted",children:"Terse-style system prompt → ~65% fewer output tokens (up to 87%)"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[T&&(0,s.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,s.jsx)("div",{className:"flex items-center gap-1.5",children:A.map(e=>(0,s.jsx)("button",{onClick:()=>{var t;$(t=e.id),W({cavemanLevel:t})},className:`px-3 py-1.5 rounded text-xs font-medium border transition-colors ${M===e.id?"bg-primary text-on-primary border-primary":"bg-transparent border-border text-text-muted hover:bg-surface-2"}`,title:e.desc,children:e.label},e.id))}),(0,s.jsx)("p",{className:"text-xs text-primary",children:d.find(e=>e.id===M)?.desc})]}),(0,s.jsx)(l.lM,{checked:T,onChange:()=>{var e;_(e=!T),W({cavemanEnabled:e})}})]})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-4 mt-4 border-t border-border gap-4 flex-wrap",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("p",{className:"font-medium",children:["Lazy senior dev"," ",(0,s.jsx)("a",{href:"https://github.com/DietrichGebert/ponytail",target:"_blank",rel:"noreferrer",className:"text-xs font-normal text-primary underline hover:opacity-80",children:"(Ponytail)"})]}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Bias the model toward minimal code: YAGNI, reuse stdlib, deletion over addition"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[H&&(0,s.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,s.jsx)("div",{className:"flex items-center gap-1.5",children:c.map(e=>(0,s.jsx)("button",{onClick:()=>{var t;F(t=e.id),W({ponytailLevel:t})},className:`px-3 py-1.5 rounded text-xs font-medium border transition-colors ${O===e.id?"bg-primary text-on-primary border-primary":"bg-transparent border-border text-text-muted hover:bg-surface-2"}`,title:e.desc,children:e.label},e.id))}),(0,s.jsx)("p",{className:"text-xs text-primary",children:c.find(e=>e.id===O)?.desc})]}),(0,s.jsx)(l.lM,{checked:H,onChange:()=>{var e;P(e=!H),W({ponytailEnabled:e})}})]})]})]}),(0,s.jsxs)(l.Zp,{id:"vault",children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,s.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-primary",children:"inventory_2"}),"Conversation Vault"]})}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-2 pb-4 border-b border-border gap-4",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"font-medium",children:"Externalize large tool results"}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Store full results outside the conversation and search them when needed"})]}),(0,s.jsx)(l.lM,{checked:x,onChange:()=>{var e;let t;return e=!x,t={...j.current,vault:e},void(j.current=t,h(e),W({tokenSaver:t}))}})]}),(0,s.jsx)("div",{className:"py-4 border-b border-border",children:(0,s.jsx)(l.pd,{label:"Externalize tool results larger than (KB)",type:"number",min:7,step:1,value:p,onChange:e=>u(e.target.value),onBlur:()=>{let e=Math.max(7,Number.parseInt(p,10)||8),t={...j.current,vaultThresholdKB:e};j.current=t,u(e),W({tokenSaver:t})},className:"max-w-xs"})}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-4 gap-4 flex-wrap",children:[(0,s.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Entries stored"}),(0,s.jsx)("p",{className:"font-mono font-medium",children:f.entries})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Search hits"}),(0,s.jsx)("p",{className:"font-mono font-medium",children:f.hits})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Bytes saved"}),(0,s.jsx)("p",{className:"font-mono font-medium",children:!Number.isFinite(e=Number(f.bytesSaved))||e<=0?"0 B":e<1024?`${Math.round(e)} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`})]})]}),(0,s.jsx)("button",{type:"button",onClick:Y,className:"text-xs text-primary underline hover:opacity-80",children:"Refresh"})]})]}),(0,s.jsx)(l.aF,{isOpen:C,title:V?"Headroom":"Setup Headroom",onClose:()=>S(!1),children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,s.jsx)("span",{children:"Status"}),(0,s.jsx)("span",{className:V?"text-success":"text-warning",children:X})]}),V&&(0,s.jsx)("a",{href:"/api/headroom/proxy/dashboard",target:"_blank",rel:"noreferrer",className:"w-full rounded border border-border px-4 py-2 text-center text-sm hover:bg-surface-2",children:"Open Headroom Dashboard"}),(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"Proxy URL"}),(0,s.jsx)(l.pd,{value:g,onChange:e=>N(e.target.value),onBlur:J,placeholder:"http://localhost:8787",className:"font-mono text-sm"}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Use a local proxy for Start/Stop, or an external Docker sidecar like http://headroom:8787."})]}),ea?(0,s.jsx)(l.$n,{onClick:Q,variant:"ghost",fullWidth:!0,disabled:E,children:E?"Stopping…":"Stop Headroom"}):V?(0,s.jsx)("p",{className:"text-sm text-success",children:"Headroom proxy is reachable. You can enable the token saver."}):et?(0,s.jsx)(l.$n,{onClick:q,fullWidth:!0,disabled:E,children:E?"Starting…":"Start Headroom"}):ee?k.python?(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"Install then click Start:"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("pre",{className:"flex-1 rounded bg-black/5 dark:bg-white/5 p-2 text-xs font-mono overflow-x-auto",children:'pip install "headroom-ai[proxy]"'}),(0,s.jsx)(l.$n,{size:"sm",variant:"ghost",onClick:()=>K('pip install "headroom-ai[proxy]"'),children:D?"Copied":"Copy"})]})]}):(0,s.jsx)("p",{className:"text-sm text-warning",children:"Python ≥ 3.10 required for local managed mode. Install Python first, or use an external proxy URL."}):(0,s.jsx)("p",{className:"text-sm text-warning",children:"Start Headroom separately at the configured URL, then recheck."}),B&&(0,s.jsx)("p",{className:"text-sm text-warning",children:B}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(l.$n,{onClick:()=>Z(),variant:"ghost",fullWidth:!0,children:"Recheck"}),(0,s.jsx)(l.$n,{onClick:()=>S(!1),fullWidth:!0,children:"Done"})]})]})})]})}}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=46357)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9839],{46357:(e,t,a)=>{Promise.resolve().then(a.bind(a,70323))},70323:(e,t,a)=>{"use strict";a.d(t,{default:()=>x});var s=a(95155),r=a(12115),l=a(35497),n=a(11059),i=a(73006);let o=["zh-CN"],d=[{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"},{id:"wenyan-lite",label:"文 Lite",desc:"Classical Chinese, light compression",wenyan:!0},{id:"wenyan",label:"文 Full",desc:"Maximum 文言文, 80-90% reduction",wenyan:!0},{id:"wenyan-ultra",label:"文 Ultra",desc:"Extreme classical compression",wenyan:!0}],c=[{id:"lite",label:"Lite",desc:"Build asked, name lazier option"},{id:"full",label:"Full",desc:"Ladder enforced: stdlib/native first"},{id:"ultra",label:"Ultra",desc:"YAGNI extremist, deletion first"}];var m=a(78559);function x(){let e,[t,a]=(0,r.useState)(!0),[x,h]=(0,r.useState)(!1),[p,u]=(0,r.useState)(8),[f,b]=(0,r.useState)({entries:0,hits:0,bytesSaved:0}),j=(0,r.useRef)({}),[y,v]=(0,r.useState)(!1),[g,N]=(0,r.useState)("http://localhost:8787"),[k,w]=(0,r.useState)({installed:!1,running:!1,python:null,loading:!0}),[C,S]=(0,r.useState)(!1),[E,L]=(0,r.useState)(!1),[B,U]=(0,r.useState)(""),[T,_]=(0,r.useState)(!1),[M,$]=(0,r.useState)("full"),[H,P]=(0,r.useState)(!1),[O,F]=(0,r.useState)("full"),[R,z]=(0,r.useState)("en"),{copied:D,copy:K}=(0,n.C)();(0,r.useEffect)(()=>(z((0,i.kk)()),(0,i.oQ)(()=>z((0,i.kk)()))),[]);let I=o.includes(R),A=I?d:d.filter(e=>!e.wenyan);(0,r.useEffect)(()=>{let e=d.find(e=>e.id===M);e?.wenyan&&!I&&($("ultra"),W({cavemanLevel:"ultra"}))},[I,M]);let W=async e=>{try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(e){(0,m.s)("Error updating setting:",e)}},G=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({rtkEnabled:e})})).ok&&a(e)}catch(e){(0,m.s)("Error updating rtkEnabled:",e)}},J=async()=>{let e=g.trim()||"http://localhost:8787";N(e),await W({headroomUrl:e}),Z()},Y=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/token-saver/vault-stats",{headers:{"Cache-Control":"no-store"}});e.ok&&b(await e.json())}catch{}},[]),Z=(0,r.useCallback)(async()=>{w(e=>({...e,loading:!0}));try{let e=await fetch("/api/headroom/status",{headers:{"Cache-Control":"no-store"}}),t=await e.json();w({...t,loading:!1})}catch{w({installed:!1,running:!1,python:null,loading:!1})}},[]),q=(0,r.useCallback)(async()=>{U(""),L(!0);try{let e=await fetch("/api/headroom/start",{method:"POST"}),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error||"Failed to start proxy");await Z()}catch(e){U(e.message)}finally{L(!1)}},[Z]),Q=(0,r.useCallback)(async()=>{L(!0);try{await fetch("/api/headroom/stop",{method:"POST"}),await Z()}finally{L(!1)}},[Z]);(0,r.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/settings");if(e.ok){let t=await e.json();a(!1!==t.rtkEnabled),j.current=t.tokenSaver&&"object"==typeof t.tokenSaver?t.tokenSaver:{},h(!!t.tokenSaver?.vault),u(t.tokenSaver?.vaultThresholdKB??8),v(!!t.headroomEnabled),N(t.headroomUrl||"http://localhost:8787"),_(!!t.cavemanEnabled),$(t.cavemanLevel||"full"),P(!!t.ponytailEnabled),F(t.ponytailLevel||"full"),Z()}}catch{}})()},[Z]),(0,r.useEffect)(()=>{Y()},[Y]);let V=!!k.running,X=k.loading?"Checking…":V?"Running":!1===k.localUrl||k.installed?!1!==k.localUrl?"Stopped":"External":"Not installed",ee=!1!==k.localUrl,et=!!k.canStart,ea=ee&&!!k.managedPid;return(0,s.jsxs)("div",{className:"space-y-6 p-6",children:[(0,s.jsxs)(l.Zp,{id:"rtk",children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,s.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-primary",children:"bolt"}),"Token Saver"]})}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-2 pb-4 border-b border-border gap-4",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("p",{className:"font-medium",children:["Compress tool output"," ",(0,s.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,s.jsx)("p",{className:"text-sm text-text-muted",children:"git/grep/ls/tree/logs → 60-90% fewer input tokens"})]}),(0,s.jsx)(l.lM,{checked:t,onChange:()=>G(!t)})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between py-4 border-b border-border gap-4 flex-wrap",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,s.jsxs)("p",{className:"font-medium",children:["Compress context"," ",(0,s.jsx)("a",{href:"https://github.com/chopratejas/headroom",target:"_blank",rel:"noreferrer",className:"text-xs font-normal text-primary underline hover:opacity-80",children:"(Headroom)"})]}),(0,s.jsx)("span",{className:`text-xs px-2 py-0.5 rounded ${V?"bg-success/15 text-success":"bg-warning/15 text-warning"}`,children:X}),(0,s.jsx)("button",{type:"button",onClick:()=>S(!0),className:"text-xs text-primary underline hover:opacity-80",children:V?"Manage":"Setup"})]}),(0,s.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Compress prompts via /v1/compress before routing to the model"})]}),(0,s.jsx)(l.lM,{checked:y&&V,disabled:!V,onChange:()=>{var e;let t;return e=!y,void(N(t=g.trim()||"http://localhost:8787"),v(e),W({headroomEnabled:e,headroomUrl:t}))}})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-4 gap-4 flex-wrap",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("p",{className:"font-medium",children:["Compress LLM output"," ",(0,s.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,s.jsx)("p",{className:"text-sm text-text-muted",children:"Terse-style system prompt → ~65% fewer output tokens (up to 87%)"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[T&&(0,s.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,s.jsx)("div",{className:"flex items-center gap-1.5",children:A.map(e=>(0,s.jsx)("button",{onClick:()=>{var t;$(t=e.id),W({cavemanLevel:t})},className:`px-3 py-1.5 rounded text-xs font-medium border transition-colors ${M===e.id?"bg-primary text-on-primary border-primary":"bg-transparent border-border text-text-muted hover:bg-surface-2"}`,title:e.desc,children:e.label},e.id))}),(0,s.jsx)("p",{className:"text-xs text-primary",children:d.find(e=>e.id===M)?.desc})]}),(0,s.jsx)(l.lM,{checked:T,onChange:()=>{var e;_(e=!T),W({cavemanEnabled:e})}})]})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-4 mt-4 border-t border-border gap-4 flex-wrap",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("p",{className:"font-medium",children:["Lazy senior dev"," ",(0,s.jsx)("a",{href:"https://github.com/DietrichGebert/ponytail",target:"_blank",rel:"noreferrer",className:"text-xs font-normal text-primary underline hover:opacity-80",children:"(Ponytail)"})]}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Bias the model toward minimal code: YAGNI, reuse stdlib, deletion over addition"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[H&&(0,s.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,s.jsx)("div",{className:"flex items-center gap-1.5",children:c.map(e=>(0,s.jsx)("button",{onClick:()=>{var t;F(t=e.id),W({ponytailLevel:t})},className:`px-3 py-1.5 rounded text-xs font-medium border transition-colors ${O===e.id?"bg-primary text-on-primary border-primary":"bg-transparent border-border text-text-muted hover:bg-surface-2"}`,title:e.desc,children:e.label},e.id))}),(0,s.jsx)("p",{className:"text-xs text-primary",children:c.find(e=>e.id===O)?.desc})]}),(0,s.jsx)(l.lM,{checked:H,onChange:()=>{var e;P(e=!H),W({ponytailEnabled:e})}})]})]})]}),(0,s.jsxs)(l.Zp,{id:"vault",children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,s.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-primary",children:"inventory_2"}),"Conversation Vault"]})}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-2 pb-4 border-b border-border gap-4",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"font-medium",children:"Externalize large tool results"}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Store full results outside the conversation and search them when needed"})]}),(0,s.jsx)(l.lM,{checked:x,onChange:()=>{var e;let t;return e=!x,t={...j.current,vault:e},void(j.current=t,h(e),W({tokenSaver:t}))}})]}),(0,s.jsx)("div",{className:"py-4 border-b border-border",children:(0,s.jsx)(l.pd,{label:"Externalize tool results larger than (KB)",type:"number",min:7,step:1,value:p,onChange:e=>u(e.target.value),onBlur:()=>{let e=Math.max(7,Number.parseInt(p,10)||8),t={...j.current,vaultThresholdKB:e};j.current=t,u(e),W({tokenSaver:t})},className:"max-w-xs"})}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-4 gap-4 flex-wrap",children:[(0,s.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Entries stored"}),(0,s.jsx)("p",{className:"font-mono font-medium",children:f.entries})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Search hits"}),(0,s.jsx)("p",{className:"font-mono font-medium",children:f.hits})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Bytes saved"}),(0,s.jsx)("p",{className:"font-mono font-medium",children:!Number.isFinite(e=Number(f.bytesSaved))||e<=0?"0 B":e<1024?`${Math.round(e)} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`})]})]}),(0,s.jsx)("button",{type:"button",onClick:Y,className:"text-xs text-primary underline hover:opacity-80",children:"Refresh"})]})]}),(0,s.jsx)(l.aF,{isOpen:C,title:V?"Headroom":"Setup Headroom",onClose:()=>S(!1),children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,s.jsx)("span",{children:"Status"}),(0,s.jsx)("span",{className:V?"text-success":"text-warning",children:X})]}),V&&(0,s.jsx)("a",{href:"/api/headroom/proxy/dashboard",target:"_blank",rel:"noreferrer",className:"w-full rounded border border-border px-4 py-2 text-center text-sm hover:bg-surface-2",children:"Open Headroom Dashboard"}),(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"Proxy URL"}),(0,s.jsx)(l.pd,{value:g,onChange:e=>N(e.target.value),onBlur:J,placeholder:"http://localhost:8787",className:"font-mono text-sm"}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Use a local proxy for Start/Stop, or an external Docker sidecar like http://headroom:8787."})]}),ea?(0,s.jsx)(l.$n,{onClick:Q,variant:"ghost",fullWidth:!0,disabled:E,children:E?"Stopping…":"Stop Headroom"}):V?(0,s.jsx)("p",{className:"text-sm text-success",children:"Headroom proxy is reachable. You can enable the token saver."}):et?(0,s.jsx)(l.$n,{onClick:q,fullWidth:!0,disabled:E,children:E?"Starting…":"Start Headroom"}):ee?k.python?(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"Install then click Start:"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("pre",{className:"flex-1 rounded bg-black/5 dark:bg-white/5 p-2 text-xs font-mono overflow-x-auto",children:'pip install "headroom-ai[proxy]"'}),(0,s.jsx)(l.$n,{size:"sm",variant:"ghost",onClick:()=>K('pip install "headroom-ai[proxy]"'),children:D?"Copied":"Copy"})]})]}):(0,s.jsx)("p",{className:"text-sm text-warning",children:"Python ≥ 3.10 required for local managed mode. Install Python first, or use an external proxy URL."}):(0,s.jsx)("p",{className:"text-sm text-warning",children:"Start Headroom separately at the configured URL, then recheck."}),B&&(0,s.jsx)("p",{className:"text-sm text-warning",children:B}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(l.$n,{onClick:()=>Z(),variant:"ghost",fullWidth:!0,children:"Recheck"}),(0,s.jsx)(l.$n,{onClick:()=>S(!1),fullWidth:!0,children:"Done"})]})]})})]})}}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=46357)),_N_E=e.O()}]);