switchboard-router 0.9.61 → 0.9.62

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 (410) hide show
  1. package/app/.next/static/chunks/1321-5586527eb9770b48.js +1 -0
  2. package/app/.next/static/chunks/4601-44deee06e6597c34.js +1 -0
  3. package/app/.next/static/chunks/app/(dashboard)/dashboard/agent-library/{page-fa24110e606e19b6.js → page-5099a8abbc816db2.js} +1 -1
  4. package/app/{.next-cli-build/static/chunks/app/(dashboard)/dashboard/basic-chat/page-7b00fb83303d1d11.js → .next/static/chunks/app/(dashboard)/dashboard/basic-chat/page-f19524e912fe1985.js} +1 -1
  5. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-e59f3822e2167ab7.js → page-5ffac5b1a7f569eb.js} +1 -1
  6. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-d994adf3e0ce78c1.js → page-e88926cdf34f51b4.js} +1 -1
  7. package/app/{.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-99d3be5c7da63d57.js → .next/static/chunks/app/(dashboard)/dashboard/combos/page-f18e04dca95f62e1.js} +1 -1
  8. package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/routing/{page-650dc0927f999aaf.js → page-0fbb282f4f13b383.js} +1 -1
  9. package/app/.next/static/chunks/app/(dashboard)/dashboard/console-log/{page-eefda4a8f32e649e.js → page-a6d96961aa96c6f6.js} +1 -1
  10. package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/{page-adba2750c4fbf61e.js → page-57222cb64d90dbc5.js} +1 -1
  11. package/app/{.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-e6fc3a5c25ce1247.js → .next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-b538f94596e78384.js} +1 -1
  12. package/app/{.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-078eb5d8bfc3f4d1.js → .next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-e5f3c1f8be627058.js} +1 -1
  13. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/{page-7dfde081613f35f3.js → page-3b278b46c2e9b047.js} +1 -1
  14. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/{page-1d63cfd88010b65f.js → page-768e0fe3ec5c50cb.js} +1 -1
  15. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/web/{page-281c93713fd1e960.js → page-932db86bb9b65c82.js} +1 -1
  16. package/app/.next/static/chunks/app/(dashboard)/dashboard/mitm/{page-f44e14a7efc8f81a.js → page-77d678509c4b9807.js} +1 -1
  17. package/app/.next/static/chunks/app/(dashboard)/dashboard/profile/{page-0e0047609d5634c9.js → page-be26ebe2eb5fe86f.js} +1 -1
  18. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-7650a3a5ee2467f7.js +10 -0
  19. package/app/{.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/new/page-604dae851964c441.js → .next/static/chunks/app/(dashboard)/dashboard/providers/new/page-40b58bbd9ed53384.js} +1 -1
  20. package/app/{.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-e1c9f4ce8466e3ad.js → .next/static/chunks/app/(dashboard)/dashboard/providers/page-62fb355a1fda21fb.js} +1 -1
  21. package/app/.next/static/chunks/app/(dashboard)/dashboard/pxpipe/{page-6ca234b58c5e9feb.js → page-da3416bfce941d67.js} +1 -1
  22. package/app/.next/static/chunks/app/(dashboard)/dashboard/quota/{page-cf70f587dc7ab205.js → page-c9a257b85e05472a.js} +1 -1
  23. package/app/.next/static/chunks/app/(dashboard)/dashboard/skills/[id]/{page-ea262b6192d5a92c.js → page-2141fe25b428c1a8.js} +1 -1
  24. package/app/{.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/page-36d107b083ad3a43.js → .next/static/chunks/app/(dashboard)/dashboard/skills/page-459447066f6cd1d5.js} +1 -1
  25. package/app/.next/static/chunks/app/(dashboard)/dashboard/token-saver/{page-14e5599c720c645b.js → page-93ce8e180c126dcc.js} +1 -1
  26. package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/{page-687e09f904b04cea.js → page-b6c5cc339e7a5ef3.js} +1 -1
  27. package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/{page-195bdcbea10136e1.js → page-492962969724f559.js} +1 -1
  28. package/app/.next/static/chunks/app/(dashboard)/{layout-6dfa9d7deb27d461.js → layout-c0725f0b6b7f0bea.js} +1 -1
  29. package/app/.next/static/chunks/app/dashboard/settings/pricing/page-e08a7bfc3255b9c7.js +1 -0
  30. package/app/.next/static/chunks/app/layout-5fa07c6e20da16ba.js +1 -0
  31. package/app/.next/static/chunks/app/login/{page-f326e6c17a8b0e04.js → page-df9fdce0e38e5f58.js} +1 -1
  32. package/app/.next/static/media/catalog.b2c6512a.json +38874 -0
  33. package/app/.next-cli-build/BUILD_ID +1 -1
  34. package/app/.next-cli-build/app-path-routes-manifest.json +13 -13
  35. package/app/.next-cli-build/build-manifest.json +2 -2
  36. package/app/.next-cli-build/prerender-manifest.json +3 -3
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page.js.nft.json +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page_client-reference-manifest.js +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page.js.nft.json +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page_client-reference-manifest.js +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page.js.nft.json +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page_client-reference-manifest.js +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +3 -3
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  75. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  76. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
  77. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  78. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  79. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  80. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page.js.nft.json +1 -1
  81. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page_client-reference-manifest.js +1 -1
  82. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  83. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  84. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  85. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  86. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  87. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  88. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  89. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  90. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  91. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  92. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  93. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  94. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  95. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  96. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  97. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  98. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  99. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  100. package/app/.next-cli-build/server/app/_not-found.rsc +3 -3
  101. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
  102. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
  103. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  104. package/app/.next-cli-build/server/app/api/agent-library/catalog/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/agent-library/doctor/route.js.nft.json +1 -1
  106. package/app/.next-cli-build/server/app/api/agent-library/export/route.js.nft.json +1 -1
  107. package/app/.next-cli-build/server/app/api/agent-library/mcp/route.js.nft.json +1 -1
  108. package/app/.next-cli-build/server/app/api/agent-library/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/agent-library/skills/route.js.nft.json +1 -1
  110. package/app/.next-cli-build/server/app/api/agent-library/sync/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/agent-library/updates/route.js.nft.json +1 -1
  112. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  114. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/cli-tools/aider-settings/route.js +2 -2
  116. package/app/.next-cli-build/server/app/api/cli-tools/aider-settings/route.js.nft.json +1 -1
  117. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +6 -6
  118. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  119. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  120. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  121. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  122. package/app/.next-cli-build/server/app/api/cli-tools/claude-full-catalog/route.js.nft.json +1 -1
  123. package/app/.next-cli-build/server/app/api/cli-tools/claude-picker-labels/route.js.nft.json +1 -1
  124. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
  126. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  127. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
  128. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +2 -2
  130. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  131. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
  132. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  133. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +2 -2
  134. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +1 -1
  136. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  137. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
  138. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  139. package/app/.next-cli-build/server/app/api/cli-tools/fx-settings/manual-configs/route.js.nft.json +1 -1
  140. package/app/.next-cli-build/server/app/api/cli-tools/fx-settings/route.js +1 -1
  141. package/app/.next-cli-build/server/app/api/cli-tools/fx-settings/route.js.nft.json +1 -1
  142. package/app/.next-cli-build/server/app/api/cli-tools/gemini-cli-settings/route.js +3 -3
  143. package/app/.next-cli-build/server/app/api/cli-tools/gemini-cli-settings/route.js.nft.json +1 -1
  144. package/app/.next-cli-build/server/app/api/cli-tools/grok-settings/route.js +2 -2
  145. package/app/.next-cli-build/server/app/api/cli-tools/grok-settings/route.js.nft.json +1 -1
  146. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +2 -2
  147. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  148. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
  149. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +1 -1
  151. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  152. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  153. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  154. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
  155. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/manual-configs/route.js.nft.json +1 -1
  157. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +2 -2
  158. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
  159. package/app/.next-cli-build/server/app/api/cli-tools/picker-labels/route.js.nft.json +1 -1
  160. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  161. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  162. package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
  163. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  164. package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
  165. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  166. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  167. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  168. package/app/.next-cli-build/server/app/api/health/live/route.js.nft.json +1 -1
  169. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  170. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  171. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  172. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  173. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  175. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  176. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  177. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  179. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/route.js.nft.json +1 -1
  181. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/strategy/route.js.nft.json +1 -1
  182. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/route.js.nft.json +1 -1
  183. package/app/.next-cli-build/server/app/api/mgmt/v1/health/route.js.nft.json +1 -1
  184. package/app/.next-cli-build/server/app/api/mgmt/v1/metrics/route.js.nft.json +1 -1
  185. package/app/.next-cli-build/server/app/api/mgmt/v1/providers/route.js.nft.json +1 -1
  186. package/app/.next-cli-build/server/app/api/mgmt/v1/routing/route.js.nft.json +1 -1
  187. package/app/.next-cli-build/server/app/api/mgmt/v1/usage/route.js.nft.json +1 -1
  188. package/app/.next-cli-build/server/app/api/mgmt/v1/version/route.js.nft.json +1 -1
  189. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  190. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  192. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/models/routable/route.js.nft.json +1 -1
  194. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  196. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  197. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  198. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  199. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  200. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  201. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  202. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  203. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  204. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  205. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  206. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  207. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  208. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  209. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  210. package/app/.next-cli-build/server/app/api/pricing/defaults/route.js.nft.json +1 -1
  211. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  212. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  213. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  214. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  215. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/batch/route.js.nft.json +1 -1
  216. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/cache/route.js.nft.json +1 -1
  217. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/prepare/route.js.nft.json +1 -1
  218. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/remove-unavailable/route.js.nft.json +1 -1
  219. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/route.js.nft.json +1 -1
  220. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/cancel/route.js.nft.json +1 -1
  221. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/start/route.js.nft.json +1 -1
  222. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/status/route.js.nft.json +1 -1
  223. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  224. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  225. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  226. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  227. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  228. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  229. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  230. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  232. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
  234. package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
  236. package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
  237. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
  238. package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
  239. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
  240. package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
  241. package/app/.next-cli-build/server/app/api/routing/feedback/route.js.nft.json +1 -1
  242. package/app/.next-cli-build/server/app/api/routing/insights/route.js.nft.json +1 -1
  243. package/app/.next-cli-build/server/app/api/routing/learn/route.js.nft.json +1 -1
  244. package/app/.next-cli-build/server/app/api/routing/stats/route.js.nft.json +1 -1
  245. package/app/.next-cli-build/server/app/api/routing/versions/promote/route.js.nft.json +1 -1
  246. package/app/.next-cli-build/server/app/api/routing/versions/rollback/route.js.nft.json +1 -1
  247. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  248. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  249. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  250. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  251. package/app/.next-cli-build/server/app/api/skills/[id]/route.js.nft.json +1 -1
  252. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  253. package/app/.next-cli-build/server/app/api/token-saver/vault-stats/route.js.nft.json +1 -1
  254. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  255. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  256. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  257. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  258. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  259. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  260. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  261. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  262. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  263. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  264. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  265. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  266. package/app/.next-cli-build/server/app/api/usage/request-details/[id]/route.js.nft.json +1 -1
  267. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  268. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  269. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  270. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  271. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  272. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  273. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  274. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  275. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  276. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  277. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  278. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  279. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  280. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  281. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  282. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  283. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  284. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  285. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  286. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  287. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
  288. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
  289. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
  290. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
  291. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  292. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  293. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  294. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  295. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  296. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  297. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  298. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  299. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  300. package/app/.next-cli-build/server/app/callback.html +1 -1
  301. package/app/.next-cli-build/server/app/callback.rsc +3 -3
  302. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
  303. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
  304. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +3 -3
  305. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  306. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  307. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  308. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
  309. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
  310. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  311. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +4 -4
  312. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  313. package/app/.next-cli-build/server/app/index.html +1 -1
  314. package/app/.next-cli-build/server/app/index.rsc +3 -3
  315. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  316. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
  317. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
  318. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  319. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  320. package/app/.next-cli-build/server/app/landing.html +1 -1
  321. package/app/.next-cli-build/server/app/landing.rsc +3 -3
  322. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
  323. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
  324. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +3 -3
  325. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  326. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  327. package/app/.next-cli-build/server/app/login.html +1 -1
  328. package/app/.next-cli-build/server/app/login.rsc +4 -4
  329. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
  330. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
  331. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +4 -4
  332. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  333. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  334. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  335. package/app/.next-cli-build/server/app-paths-manifest.json +13 -13
  336. package/app/.next-cli-build/server/chunks/1350.js +1 -1
  337. package/app/.next-cli-build/server/chunks/2847.js +1 -1
  338. package/app/.next-cli-build/server/chunks/3464.js +1 -1
  339. package/app/.next-cli-build/server/chunks/3904.js +1 -1
  340. package/app/.next-cli-build/server/chunks/4454.js +1 -1
  341. package/app/.next-cli-build/server/chunks/4646.js +1 -1
  342. package/app/.next-cli-build/server/chunks/5139.js +1 -1
  343. package/app/.next-cli-build/server/chunks/7662.js +1 -1
  344. package/app/.next-cli-build/server/chunks/7757.js +1 -1
  345. package/app/.next-cli-build/server/chunks/869.js +1 -1
  346. package/app/.next-cli-build/server/chunks/8998.js +7 -7
  347. package/app/.next-cli-build/server/chunks/static/media/catalog.b2c6512a.json +38874 -0
  348. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  349. package/app/.next-cli-build/server/pages/404.html +1 -1
  350. package/app/.next-cli-build/server/pages/500.html +1 -1
  351. package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  352. package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  353. package/app/.next-cli-build/static/chunks/1321-5586527eb9770b48.js +1 -0
  354. package/app/.next-cli-build/static/chunks/4601-44deee06e6597c34.js +1 -0
  355. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/agent-library/{page-fa24110e606e19b6.js → page-5099a8abbc816db2.js} +1 -1
  356. package/app/{.next/static/chunks/app/(dashboard)/dashboard/basic-chat/page-7b00fb83303d1d11.js → .next-cli-build/static/chunks/app/(dashboard)/dashboard/basic-chat/page-f19524e912fe1985.js} +1 -1
  357. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-e59f3822e2167ab7.js → page-5ffac5b1a7f569eb.js} +1 -1
  358. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-d994adf3e0ce78c1.js → page-e88926cdf34f51b4.js} +1 -1
  359. package/app/{.next/static/chunks/app/(dashboard)/dashboard/combos/page-99d3be5c7da63d57.js → .next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-f18e04dca95f62e1.js} +1 -1
  360. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/routing/{page-650dc0927f999aaf.js → page-0fbb282f4f13b383.js} +1 -1
  361. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/{page-eefda4a8f32e649e.js → page-a6d96961aa96c6f6.js} +1 -1
  362. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/{page-adba2750c4fbf61e.js → page-57222cb64d90dbc5.js} +1 -1
  363. package/app/{.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-e6fc3a5c25ce1247.js → .next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-b538f94596e78384.js} +1 -1
  364. package/app/{.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-078eb5d8bfc3f4d1.js → .next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-e5f3c1f8be627058.js} +1 -1
  365. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/{page-7dfde081613f35f3.js → page-3b278b46c2e9b047.js} +1 -1
  366. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/{page-1d63cfd88010b65f.js → page-768e0fe3ec5c50cb.js} +1 -1
  367. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/web/{page-281c93713fd1e960.js → page-932db86bb9b65c82.js} +1 -1
  368. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/mitm/{page-f44e14a7efc8f81a.js → page-77d678509c4b9807.js} +1 -1
  369. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/{page-0e0047609d5634c9.js → page-be26ebe2eb5fe86f.js} +1 -1
  370. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-7650a3a5ee2467f7.js +10 -0
  371. package/app/{.next/static/chunks/app/(dashboard)/dashboard/providers/new/page-604dae851964c441.js → .next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/new/page-40b58bbd9ed53384.js} +1 -1
  372. package/app/{.next/static/chunks/app/(dashboard)/dashboard/providers/page-e1c9f4ce8466e3ad.js → .next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-62fb355a1fda21fb.js} +1 -1
  373. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/pxpipe/{page-6ca234b58c5e9feb.js → page-da3416bfce941d67.js} +1 -1
  374. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/{page-cf70f587dc7ab205.js → page-c9a257b85e05472a.js} +1 -1
  375. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/[id]/{page-ea262b6192d5a92c.js → page-2141fe25b428c1a8.js} +1 -1
  376. package/app/{.next/static/chunks/app/(dashboard)/dashboard/skills/page-36d107b083ad3a43.js → .next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/page-459447066f6cd1d5.js} +1 -1
  377. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/token-saver/{page-14e5599c720c645b.js → page-93ce8e180c126dcc.js} +1 -1
  378. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/translator/{page-687e09f904b04cea.js → page-b6c5cc339e7a5ef3.js} +1 -1
  379. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/{page-195bdcbea10136e1.js → page-492962969724f559.js} +1 -1
  380. package/app/.next-cli-build/static/chunks/app/(dashboard)/{layout-6dfa9d7deb27d461.js → layout-c0725f0b6b7f0bea.js} +1 -1
  381. package/app/.next-cli-build/static/chunks/app/dashboard/settings/pricing/page-e08a7bfc3255b9c7.js +1 -0
  382. package/app/.next-cli-build/static/chunks/app/layout-5fa07c6e20da16ba.js +1 -0
  383. package/app/.next-cli-build/static/chunks/app/login/{page-f326e6c17a8b0e04.js → page-df9fdce0e38e5f58.js} +1 -1
  384. package/app/.next-cli-build/static/media/catalog.b2c6512a.json +38874 -0
  385. package/app/open-sse/identity/tls/bin/darwin/arm64/switchboard-claude-tls +0 -0
  386. package/app/open-sse/identity/tls/bin/darwin/x64/switchboard-claude-tls +0 -0
  387. package/app/open-sse/identity/tls/bin/linux/arm64/switchboard-claude-tls +0 -0
  388. package/app/open-sse/identity/tls/bin/linux/x64/switchboard-claude-tls +0 -0
  389. package/app/open-sse/identity/tls/bin/win32/arm64/switchboard-claude-tls.exe +0 -0
  390. package/app/open-sse/identity/tls/bin/win32/x64/switchboard-claude-tls.exe +0 -0
  391. package/app/open-sse/providers/generated/catalog.json +37152 -0
  392. package/app/package.json +3 -2
  393. package/package.json +1 -1
  394. package/app/.next/static/chunks/1321-8f2bc21e3e1510f8.js +0 -1
  395. package/app/.next/static/chunks/4707-8ea6ba647d0a40c9.js +0 -1
  396. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-9bc17a08bc8f466c.js +0 -10
  397. package/app/.next/static/chunks/app/dashboard/settings/pricing/page-423a4c1e078872dd.js +0 -1
  398. package/app/.next/static/chunks/app/layout-26e1615874db4cd7.js +0 -1
  399. package/app/.next/static/media/catalog.fb7b1b70.json +0 -1722
  400. package/app/.next-cli-build/server/chunks/static/media/catalog.fb7b1b70.json +0 -1722
  401. package/app/.next-cli-build/static/chunks/1321-8f2bc21e3e1510f8.js +0 -1
  402. package/app/.next-cli-build/static/chunks/4707-8ea6ba647d0a40c9.js +0 -1
  403. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-9bc17a08bc8f466c.js +0 -10
  404. package/app/.next-cli-build/static/chunks/app/dashboard/settings/pricing/page-423a4c1e078872dd.js +0 -1
  405. package/app/.next-cli-build/static/chunks/app/layout-26e1615874db4cd7.js +0 -1
  406. package/app/.next-cli-build/static/media/catalog.fb7b1b70.json +0 -1722
  407. /package/app/.next/static/{buFm6Q9XY8OxLsQzoorjq → cd9DZQ978U7eW2QFBhfwd}/_buildManifest.js +0 -0
  408. /package/app/.next/static/{buFm6Q9XY8OxLsQzoorjq → cd9DZQ978U7eW2QFBhfwd}/_ssgManifest.js +0 -0
  409. /package/app/.next-cli-build/static/{buFm6Q9XY8OxLsQzoorjq → cd9DZQ978U7eW2QFBhfwd}/_buildManifest.js +0 -0
  410. /package/app/.next-cli-build/static/{buFm6Q9XY8OxLsQzoorjq → cd9DZQ978U7eW2QFBhfwd}/_ssgManifest.js +0 -0
@@ -0,0 +1,10 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{7687:(e,t,a)=>{Promise.resolve().then(a.bind(a,37445))},37445:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>ea});var s=a(95155),r=a(12115),i=a(73321),l=a(98500),n=a.n(l),o=a(5772),d=a(35497),c=a(88105),m=a(28777),u=a(16600),p=a(47224),x=a(34591);let h={glm:["zai","zai-coding-plan"],zai:["zai","zai-coding-plan"],"z-ai":["zai","zai-coding-plan"],opencode:["opencode","opencode-go"],"opencode-go":["opencode-go","opencode"]},f=["none","low","medium","high"],b=["none","thinking"],g=["none","low","medium","high","max"],y={openai:["none","minimal","low","medium","high","xhigh"],"claude-adaptive":g,"claude-budget":["none","low","medium","high","xhigh","max"],"gemini-level":["minimal","low","medium","high"],"gemini-budget":f,zai:b,qwen:f,kimi:g,deepseek:["none","high","max"],minimax:b,hunyuan:f,step:f},v=[{pattern:"*codex*",levels:["low","medium","high","xhigh"]}];function j(e,t){let a=(0,u.nl)(e,t);if(!a.reasoning)return null;let s=v.find(e=>(0,p.gH)(e.pattern,t)),r=s?.levels||null,i=null;if(!r){let s=y[a.thinkingFormat]||f;s===b&&(i=function(e,t){try{return function(e,t,a){let s;if(!e||"object"!=typeof e||!a)return null;let r=(s=String(a||""),String((s.includes("/")?s.split("/").pop():s)||"").split(":")[0].toLowerCase());if(!r)return null;let i=String(a).toLowerCase(),l=String(t||"").toLowerCase();for(let t of[l,...h[l]||[]].filter(Boolean)){if(e[`${t}/${i}`])return e[`${t}/${i}`];if(e[`${t}/${r}`])return e[`${t}/${r}`]}return e[r]||e[i]||null}((0,x.CQ)(),e,t)}catch{return null}}(e,t),Array.isArray(i?.levels)&&i.levels.length>0&&(r=["none",...i.levels])),r||(r=s)}return(!1===a.thinkingCanDisable||i?.mandatory===!0)&&(r=r.filter(e=>"none"!==e)),r}var w=a(11059),k=a(929),N=a(73006);let C=new Map;async function S(e){if(!e?.url||!e?.type||e.requiresAuth)return[];let t=C.get(e.url);if(t&&Date.now()<t.expiresAt)return t.data;try{let t=new URLSearchParams({url:e.url,type:e.type}),a=await fetch(`/api/providers/suggested-models?${t}`);if(!a.ok)return[];let s=(await a.json()).data??[];return C.set(e.url,{data:s,expiresAt:Date.now()+6e5}),s}catch{return[]}}var $=a(81231),A=a(68501),T=a(14051),O=a.n(T);function E({model:e,fullModel:t,alias:a,copied:r,onCopy:i,testStatus:l,isCustom:n,isFree:o,onDeleteAlias:c,onTest:m,isTesting:u,onDisable:p,caps:x,thinkingSuffix:h,latencyMs:f,probeState:b}){let g=h?`${t}(${h})`:t,y="ok"===l||"ok"===b,v="error"===l||"dead"===b,j="retry"===b||u||"testing"===b;return(0,s.jsx)("div",{className:`group relative w-full min-w-0 max-w-full rounded-xl border bg-surface/50 p-3 transition-all hover:bg-surface/80 hover:shadow-soft ${y?"border-green-500/30 hover:border-green-500/50":v?"border-red-500/30 hover:border-red-500/50":j?"border-amber-500/30 hover:border-amber-500/50":"border-border/60 hover:border-primary/40"}`,children:(0,s.jsxs)("div",{className:"flex min-w-0 items-start justify-between gap-2.5",children:[(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2.5",children:[(0,s.jsx)("div",{className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg bg-surface-2 border border-border/40 text-text-muted",children:u||"testing"===b?(0,s.jsx)("span",{className:"material-symbols-outlined shrink-0 animate-spin text-[15px] text-primary",title:"Testing model...",children:"progress_activity"}):y?(0,s.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[16px] text-green-500",title:"Model reachable",children:"check_circle"}):v?(0,s.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[16px] text-red-500",title:"Model unavailable",children:"cancel"}):"retry"===b?(0,s.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[16px] text-amber-500",title:"Retry later",children:"schedule"}):(0,s.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[16px]","aria-hidden":"true",children:"smart_toy"})}),(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,s.jsx)("code",{className:"max-w-[70vw] truncate rounded-md bg-surface-2 border border-border/40 px-2 py-0.5 font-mono text-xs font-medium text-text-main sm:max-w-[340px]",children:g}),n&&(0,s.jsx)("span",{className:"rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary",children:"Custom"})]}),(0,s.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-xs",children:[e.name&&(0,s.jsx)("span",{className:"truncate text-xs text-text-muted",children:e.name}),Number.isFinite(f)&&(0,s.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-[11px] font-medium text-text-muted tabular-nums",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[12px] text-primary",children:"bolt"}),Math.round(f),"ms"]}),(0,s.jsx)(d.nh,{caps:x,colorOverride:"text-text-muted/80",size:13})]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[m&&(0,s.jsx)("button",{onClick:m,disabled:u,"aria-label":u?`Testing ${g}`:`Test ${g}`,title:u?"Testing...":"Test model",className:`rounded-lg p-1 text-text-muted transition-all hover:bg-surface-2 hover:text-primary ${u?"opacity-100":"opacity-70 group-hover:opacity-100"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",style:u?{animation:"spin 1s linear infinite"}:void 0,children:u?"progress_activity":"science"})}),(0,s.jsx)("button",{onClick:()=>i(g,`model-${e.id}`),"aria-label":r===`model-${e.id}`?`Copied ${g}`:`Copy ${g}`,title:r===`model-${e.id}`?"Copied!":"Copy model name",className:"rounded-lg p-1 text-text-muted transition-all hover:bg-surface-2 hover:text-primary opacity-70 group-hover:opacity-100",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:r===`model-${e.id}`?"check":"content_copy"})}),n?(0,s.jsx)("button",{onClick:c,className:"rounded-lg p-1 text-text-muted transition-all hover:bg-red-500/10 hover:text-red-400 opacity-60 hover:opacity-100","aria-label":`Remove custom model ${g}`,title:"Remove custom model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"close"})}):p?(0,s.jsx)("button",{onClick:p,className:"rounded-lg p-1 text-text-muted transition-all hover:bg-red-500/10 hover:text-red-400 opacity-60 hover:opacity-100","aria-label":`Disable ${g}`,title:"Disable this model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"close"})}):null]})]})})}E.propTypes={model:O().shape({id:O().string.isRequired}).isRequired,fullModel:O().string.isRequired,alias:O().string,copied:O().string,onCopy:O().func.isRequired,testStatus:O().oneOf(["ok","error"]),isCustom:O().bool,isFree:O().bool,onDeleteAlias:O().func,onTest:O().func,isTesting:O().bool,onDisable:O().func,caps:O().object,thinkingSuffix:O().string,latencyMs:O().number,probeState:O().string};var R=a(78559);O().string.isRequired,O().string.isRequired,O().string,O().func.isRequired,O().func.isRequired,O().func,O().oneOf(["ok","error"]),O().bool,O().string.isRequired,O().object.isRequired,O().arrayOf(O().object),O().string,O().func.isRequired,O().func.isRequired,O().func.isRequired,O().func.isRequired;var I=a(68308);function D({modelId:e,fullModel:t,copied:a,onCopy:r,onDeleteAlias:i,onTest:l,testStatus:n,isTesting:o}){let d="ok"===n?"#22c55e":"error"===n?"#ef4444":void 0;return(0,s.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===n?"border-green-500/40":"error"===n?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",style:d?{color:d}:void 0,children:"ok"===n?"check_circle":"error"===n?"cancel":"smart_toy"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,s.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,s.jsxs)("div",{className:"relative group/btn",children:[(0,s.jsx)("button",{onClick:()=>r(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:a===`model-${e}`?"check":"content_copy"})}),(0,s.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:a===`model-${e}`?"Copied!":"Copy"})]}),l&&(0,s.jsxs)("div",{className:"relative group/btn",children:[(0,s.jsx)("button",{onClick:l,disabled:o,className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",style:o?{animation:"spin 1s linear infinite"}:void 0,children:o?"progress_activity":"science"})}),(0,s.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:o?"Testing...":"Test"})]})]})]}),(0,s.jsx)("button",{onClick:i,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function P({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:a,customModels:i,copied:l,onCopy:n,onDeleteAlias:o,onAddCustomModel:c,onDeleteCustomModel:m,onRefreshModels:u,connections:p,isAnthropic:x,disabledModelIds:h=[],onEnableModel:f}){let[b,g]=(0,r.useState)(""),[y,v]=(0,r.useState)(!1),[j,w]=(0,r.useState)(!1),[k,N]=(0,r.useState)(""),[C,S]=(0,r.useState)(null),[A,T]=(0,r.useState)({}),O=async t=>{if(!C){S(t);try{let a=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${e}/${t}`})}),s=await a.json();T(e=>({...e,[t]:s.ok?"ok":"error"}))}catch{T(e=>({...e,[t]:"error"}))}finally{S(null)}}},E=(0,$.Iz)(h,e),M=[...E],z=(0,$.R3)({customModels:i,modelAliases:a,providerAlias:e,type:"llm"}),U=z.filter(t=>!(0,$.uJ)(E,t.id,e)),q=async()=>{if(!b.trim()||y)return;let t=b.trim();if(U.some(e=>e.id===t))return void(0,R.s)("Model already exists for this provider.");v(!0);try{if((0,$.uJ)(E,t,e)){let e=await f?.(t);if(!1===e)throw Error("Failed to enable removed model")}await c(t),g("")}catch(e){(0,R.s)("Error adding model:",e)}finally{v(!1)}},_=async()=>{if(j)return;let t=p.find(e=>!1!==e.isActive);if(t){w(!0),N("");try{let a=await fetch(`/api/providers/${t.id}/models`),s=await a.json().catch(()=>({}));if(!a.ok)return void(0,R.s)(s.error||"Failed to import models");let r=s.models||[];if(0===r.length)return void(0,R.s)("No models returned from /models.");let i=new Set(z.map(e=>e.id)),l=[],n=new Set;for(let t of r){let a=String(t.id||t.name||t.model||"").trim();if(!a||i.has(a)||n.has(a)||(0,$.uJ)(E,a,e))continue;n.add(a);let s=(0,I.J$)(t);l.push({providerAlias:e,id:a,type:"llm",name:t.display_name||t.displayName||t.name||a,...s?{reasoning:s}:{}})}if(0===l.length)return void N("All models already in list");let o=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({models:l})}),d=await o.json().catch(()=>({}));if(!o.ok){let e=0;for(let t of l)await c(t.id),e+=1;N(e?`Imported ${e} model(s)`:"No new models were added");return}N(`Imported ${d.added??l.length} model(s)`),"function"==typeof u?await u():window.dispatchEvent(new CustomEvent("customModelChanged"))}catch(e){(0,R.s)("Error importing models:",e),(0,R.s)(e?.message||"Import failed")}finally{w(!1)}}},F=p.some(e=>!1!==e.isActive);return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",x?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,s.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,s.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,s.jsx)("input",{id:"new-compatible-model-input",type:"text",value:b,onChange:e=>g(e.target.value),onKeyDown:e=>"Enter"===e.key&&q(),placeholder:x?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,s.jsx)(d.$n,{size:"sm",icon:"add",onClick:q,disabled:!b.trim()||y,children:y?"Adding...":"Add"}),(0,s.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"cloud_download",onClick:_,disabled:!F||j,children:j?"Importing...":"Import models"})]}),!F&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),k&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:k}),U.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-3",children:U.map(({id:a,alias:r,source:i})=>(0,s.jsx)(D,{modelId:a,fullModel:`${t}/${a}`,copied:l,onCopy:n,onDeleteAlias:()=>"custom"===i?m(a):o(r),onTest:p.length>0?()=>O(a):void 0,testStatus:A[a],isTesting:C===a},`${i}-${e}/${a}`))}),M.length>0&&(0,s.jsxs)("details",{className:"rounded-lg border border-border bg-surface/30 p-3",children:[(0,s.jsxs)("summary",{className:"cursor-pointer text-sm font-medium text-text-main",children:["Removed models (",M.length,")"]}),(0,s.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Enable a model to make it available for import and selection again."}),(0,s.jsx)("div",{className:"mt-3 flex max-h-56 flex-col gap-1.5 overflow-y-auto",children:M.map(e=>(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded border border-border bg-background px-2 py-1.5",children:[(0,s.jsx)("code",{className:"min-w-0 flex-1 truncate text-xs",title:e,children:e}),(0,s.jsx)(d.$n,{size:"sm",variant:"secondary",onClick:()=>f?.(e),children:"Enable"})]},e))})]})]})}P.propTypes={providerStorageAlias:O().string.isRequired,providerDisplayAlias:O().string.isRequired,modelAliases:O().object.isRequired,customModels:O().arrayOf(O().object),copied:O().string,onCopy:O().func.isRequired,onDeleteAlias:O().func.isRequired,onAddCustomModel:O().func.isRequired,onDeleteCustomModel:O().func.isRequired,onRefreshModels:O().func,connections:O().arrayOf(O().shape({id:O().string,isActive:O().bool})).isRequired,isAnthropic:O().bool,disabledModelIds:O().arrayOf(O().string),onEnableModel:O().func};var M=a(70217);function z({until:e}){let[t,a]=(0,r.useState)("");return((0,r.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void a("");let s=Math.floor(t/1e3);if(s<60)a(`${s}s`);else if(s<3600)a(`${Math.floor(s/60)}m ${s%60}s`);else{let e=Math.floor(s/3600),t=Math.floor(s%3600/60);a(`${e}h ${t}m`)}};t();let s=setInterval(t,1e3);return()=>clearInterval(s)},[e]),t)?(0,s.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function U({connection:e,isOAuth:t,isFirst:a,isLast:i,onMoveUp:l,onMoveDown:n,onToggleActive:o,onEdit:c,onDelete:m,onAllowlistHost:u=null,oneByOneStatus:p=null,autoPing:x=null}){let h=e.authType||(t?"oauth":"apikey"),f="oauth"===h,b="cookie"===h,g=e.name?.trim()||e.email?.trim()||e.displayName?.trim()||(f?"OAuth Account":b?"Cookie Account":"API Key"),y=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,v=/SSRF blocked|Blocked URL: (private IP|internal host)/i.test(e.lastError||""),j=(e=>{if(!e)return null;let t=String(e).trim();try{let e=t.match(/\{[\s\S]*\}$/);if(e){let a=JSON.parse(e[0]),s=a?.error?.message||a?.message||a?.error;"string"==typeof s&&s.trim()&&(t=s.trim())}}catch{}return(t=t.replace(/^\[\d+\]:\s*/,""),/not have a valid license|license of this product|license required/i.test(t))?{type:"license",title:"License Required",message:"No active Gemini Code Assist or Antigravity license found for this Google account. Visit antigravity.google to activate, or reconnect.",action:f?"reconnect":null}:/invalid_grant|token expired|credentials expired|expired or revoked|session expired/i.test(t)?{type:"auth",title:"Session Expired",message:"OAuth token expired or was revoked. Please reconnect.",action:f?"reconnect":null}:/rate limit|quota|429|resource has been exhausted/i.test(t)?{type:"quota",title:"Rate Limited",message:t||"Upstream rate limit reached.",action:null}:v?{type:"ssrf",title:"Network Guard",message:"SSRF guard blocked local/private IP address.",action:"allowlist"}:{type:"error",title:"Error",message:t,action:f?"reconnect":null}})(e.lastError),w=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,k=w?`Proxy: ${e.providerSpecificData?.connectionProxyUrl}`:"",N=x?.provider==="codex"?"Auto-starts the next 5h Codex window after reset by sending a tiny gpt-5.5 request. Consumes a small amount of quota.":"When your 5h quota runs out, auto-sends a request the moment it resets so a new window starts right away.",C="";if(e.providerSpecificData?.connectionProxyUrl){let t=e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);C=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{C=t}}let S=e.providerSpecificData?.connectionNoProxy||"",$=w?"success":"default",[A,T]=(0,r.useState)(!1),O=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>!!e).sort()[0]||null;(0,r.useEffect)(()=>{let t=()=>{T(!!Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>e&&new Date(e).getTime()>Date.now()).sort()[0])};t();let a=O?setInterval(t,1e3):null;return()=>{a&&clearInterval(a)}},[e,O]);let E="unavailable"!==e.testStatus||A?e.testStatus:"active",R=()=>p?"queued"===p.state?"queued":"testing"===p.state?"testing":"success"===p.state?"success":"failed"===p.state?p.error?`failed: ${p.error}`:"failed":null:null;return(0,s.jsx)("div",{className:`group flex min-w-0 flex-col gap-3 rounded-xl border border-border/60 bg-surface/40 p-3 transition-all hover:border-border hover:bg-surface/70 ${!1===e.isActive?"opacity-60":""}`,children:(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-2.5",children:[(0,s.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,s.jsx)("button",{onClick:l,disabled:a,"aria-label":`Move ${g} up`,title:`Move ${g} up`,className:`p-0.5 rounded ${a?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm","aria-hidden":"true",children:"keyboard_arrow_up"})}),(0,s.jsx)("button",{onClick:n,disabled:i,"aria-label":`Move ${g} down`,title:`Move ${g} down`,className:`p-0.5 rounded ${i?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm","aria-hidden":"true",children:"keyboard_arrow_down"})})]}),(0,s.jsx)("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-2 border border-border/40 text-text-muted",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]","aria-hidden":"true",children:b?"cookie":f?"lock":"key"})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-text-main truncate",children:g}),y&&(0,s.jsx)("p",{className:"text-xs text-text-muted truncate",children:y})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[x&&(0,s.jsx)(d.m_,{text:N,children:(0,s.jsxs)("button",{onClick:()=>x.onToggle(!x.on),className:`flex items-center gap-1 rounded-lg px-2 py-1 text-xs transition-colors hover:bg-white/5 ${x.on?"text-primary bg-primary/10 font-medium":"text-text-muted hover:text-primary"}`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"bolt"}),(0,s.jsx)("span",{className:"hidden sm:inline text-xs",children:"Auto-ping"})]})}),(0,s.jsxs)("button",{onClick:c,className:"flex items-center gap-1 rounded-lg px-2.5 py-1 text-xs text-text-muted hover:bg-white/5 hover:text-primary transition-colors",title:"Edit connection",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"edit"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"Edit"})]}),(0,s.jsxs)("button",{onClick:m,className:"flex items-center gap-1 rounded-lg px-2.5 py-1 text-xs text-red-400 hover:bg-red-500/10 transition-colors",title:"Delete connection",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"delete"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"Delete"})]})]}),(0,s.jsx)("div",{className:"h-4 w-px bg-border/60 mx-1"}),(0,s.jsx)(d.lM,{size:"sm",checked:e.isActive??!0,onChange:o,title:e.isActive??!0?"Disable connection":"Enable connection"})]})]}),(0,s.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5 pl-0 sm:pl-10",children:[(0,s.jsx)(d.Ex,{variant:(0,M.g)(e.isActive,E),size:"sm",dot:!0,children:!1===e.isActive?"disabled":E||"Unknown"}),(0,s.jsx)(d.Ex,{variant:"default",size:"sm",children:f?"OAuth":b?"Cookie":"API Key"}),w&&(0,s.jsx)(d.Ex,{variant:$,size:"sm",children:"Proxy"}),A&&!1!==e.isActive&&(0,s.jsx)(z,{until:O}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]}),R()&&(0,s.jsx)(d.Ex,{variant:p?"success"===p.state?"success":"failed"===p.state?"error":"testing"===p.state?"primary":"default":"default",size:"sm",children:R()})]}),j&&!1!==e.isActive&&(0,s.jsxs)("div",{className:"mt-1.5 flex min-w-0 flex-col sm:flex-row sm:items-center justify-between gap-2 rounded-lg border border-red-500/25 bg-red-500/8 px-3 py-2 text-xs text-red-600 dark:text-red-400 sm:ml-10",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-start sm:items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[16px] text-red-500 mt-0.5 sm:mt-0",children:"license"===j.type?"workspace_premium":"auth"===j.type?"key_off":"error"}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("span",{className:"font-semibold",children:[j.title,": "]}),(0,s.jsx)("span",{className:"break-words",children:j.message})]})]}),"reconnect"===j.action&&(0,s.jsxs)("button",{onClick:c,className:"inline-flex shrink-0 items-center justify-center gap-1 rounded-md bg-red-500/15 hover:bg-red-500/25 px-2.5 py-1 text-xs font-medium text-red-600 dark:text-red-300 transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"}),"Reconnect"]}),"allowlist"===j.action&&u&&(0,s.jsxs)("button",{onClick:u,className:"inline-flex shrink-0 items-center justify-center gap-1 rounded-md border border-amber-500/40 bg-amber-500/10 px-2.5 py-1 text-xs font-medium text-amber-600 dark:text-amber-300 hover:bg-amber-500/20 transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"verified_user"}),"Add to allow list"]})]}),w&&(0,s.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap sm:ml-10",children:[(0,s.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:k,children:k}),C&&(0,s.jsx)("code",{className:"max-w-full truncate rounded bg-black/5 px-1 py-0.5 font-mono text-[10px] text-text-muted dark:bg-white/5 sm:max-w-[260px]",children:C}),S&&(0,s.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:S,children:["no_proxy: ",S]})]})]})})}z.propTypes={until:O().string.isRequired},U.propTypes={connection:O().shape({id:O().string,name:O().string,email:O().string,displayName:O().string,modelLockUntil:O().string,testStatus:O().string,isActive:O().bool,lastError:O().string,priority:O().number,globalPriority:O().number,providerSpecificData:O().object}).isRequired,isOAuth:O().bool.isRequired,isFirst:O().bool.isRequired,isLast:O().bool.isRequired,onMoveUp:O().func.isRequired,onMoveDown:O().func.isRequired,onToggleActive:O().func.isRequired,onEdit:O().func.isRequired,onDelete:O().func.isRequired,onAllowlistHost:O().func,oneByOneStatus:O().shape({state:O().string,error:O().string}),autoPing:O().shape({on:O().bool,onToggle:O().func,provider:O().string})};let q=`name1|sk-key1
2
+ name2|sk-key2
3
+ sk-key-only-auto-named`;function _({isOpen:e,provider:t,providerName:a,isCompatible:i,isAnthropic:l,authType:n,authHint:o,website:m,error:u,onSave:p,onBulkDone:x,onClose:h}){let f="ollama-local"===t,b=t.startsWith("selfhosted-"),g="cookie"===n,y="xai"===t&&!g,v=g?"Cookie Value":"API Key",j=g?"grok-web"===t?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":y?"xai-...":"",w="azure"===t,k="cloudflare-ai"===t,N=c.Q2?.[t]?.regions||null,C=c.Q2?.[t]?.defaultRegion||N?.[0]?.id||"",[S,$]=(0,r.useState)({name:"",apiKey:"",defaultModel:"",priority:1,ollamaHostUrl:"",baseUrl:""}),[A,T]=(0,r.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[O,E]=(0,r.useState)({accountId:""}),[R,I]=(0,r.useState)(C),[D,P]=(0,r.useState)(!1),[M,z]=(0,r.useState)(null),[U,F]=(0,r.useState)(!1),[L,J]=(0,r.useState)("single"),[K,B]=(0,r.useState)(""),[W,H]=(0,r.useState)(null),V=S.name.trim().length>0,G=S.apiKey.trim().length>0,Z=()=>b?{baseUrl:S.baseUrl.trim()}:f&&S.ollamaHostUrl.trim()?{baseUrl:S.ollamaHostUrl.trim()}:w?{azureEndpoint:A.azureEndpoint,apiVersion:A.apiVersion,deployment:A.deployment,organization:A.organization}:k?{accountId:O.accountId}:N&&R?{region:R}:void 0,Q=async()=>{let e=S.apiKey.trim();if(e){P(!0);try{let a=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:e,providerSpecificData:Z()})}),s=await a.json();z(s.valid?"success":"failed")}catch{z("failed")}finally{P(!1)}}},Y=async()=>{if(!t)return;let e=S.name.trim(),a=S.apiKey.trim();if((f||b||a)&&(!b||S.baseUrl.trim())&&(f||e)&&(!i||S.defaultModel.trim())){F(!0);try{let s=!1;try{P(!0),z(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:a,providerSpecificData:Z()})});s=!!(await e.json()).valid,z(s?"success":"failed")}catch{z("failed")}finally{P(!1)}await p({name:e||(f?"Ollama Local":""),apiKey:a,defaultModel:i?S.defaultModel.trim():void 0,priority:S.priority,testStatus:s?"active":"unknown",providerSpecificData:Z()})}finally{F(!1)}}},X=async()=>{let e=K.split("\n").map(e=>e.trim()).filter(Boolean);if(!e.length)return;F(!0),H(null);let a=0,s=0;for(let r=0;r<e.length;r++){let i=e[r].split("|"),l=i.length>=2?i.slice(1).join("|").trim():i[0].trim();if(!l){s++;continue}let n=i.length>=2&&i[0].trim()||"Key",o=`${n} ${r+1}`;try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:l,name:o,priority:1,testStatus:"unknown"})})).ok?a++:s++}catch{s++}}F(!1),H({success:a,failed:s}),a>0&&x&&x()};return t?(0,s.jsx)(d.aF,{isOpen:e,title:`Add ${a||t} ${v}`,onClose:h,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[!b&&(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.$n,{size:"sm",variant:"single"===L?"primary":"ghost",onClick:()=>{J("single"),H(null)},children:"Single"}),(0,s.jsx)(d.$n,{size:"sm",variant:"bulk"===L?"primary":"ghost",onClick:()=>{J("bulk"),H(null)},children:"Bulk Add"})]}),"bulk"===L&&!b&&(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("p",{className:"text-xs text-text-muted",children:["One key per line. Format: ",(0,s.jsx)("code",{children:"name|apiKey"})," or just ",(0,s.jsx)("code",{children:"apiKey"})," (auto-named by index)."]}),(0,s.jsx)("textarea",{className:"w-full rounded border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[140px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:q,value:K,onChange:e=>B(e.target.value)}),W&&(0,s.jsxs)("div",{className:`text-sm font-medium ${W.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",W.success," added",W.failed>0?`, ✗ ${W.failed} failed`:""]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.$n,{onClick:X,fullWidth:!0,disabled:U||!K.trim(),children:U?"Adding...":"Add All Keys"}),(0,s.jsx)(d.$n,{onClick:h,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),("single"===L||b)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.pd,{label:"Name",value:S.name,onChange:e=>$({...S,name:e.target.value}),placeholder:f?"Ollama Local":"Production Key"}),b&&(0,s.jsx)(d.pd,{label:"Base URL",value:S.baseUrl,onChange:e=>$({...S,baseUrl:e.target.value}),placeholder:"selfhosted-stt"===t?"http://localhost:8080/v1/audio/transcriptions":"selfhosted-tts"===t?"http://localhost:8880":"http://localhost:8080/v1"}),f&&(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.pd,{label:"Ollama Host URL",value:S.ollamaHostUrl,onChange:e=>$({...S,ollamaHostUrl:e.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(d.$n,{onClick:Q,disabled:D||U,variant:"secondary",children:D?"Checking...":"Check"})})]}),!f&&(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.pd,{label:b?"API Key (optional)":v,type:g?"text":"password",autoComplete:"off",value:S.apiKey,onChange:e=>$({...S,apiKey:e.target.value}),placeholder:j,className:"flex-1"}),!b&&(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(d.$n,{onClick:Q,disabled:!S.apiKey||D||U,variant:"secondary",children:D?"Checking...":"Check"})})]}),y&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Use a direct xAI API key from console.x.ai. This is separate from Grok Build OAuth."}),g&&o&&(0,s.jsxs)("p",{className:"text-xs text-text-muted",children:[o,m&&(0,s.jsxs)(s.Fragment,{children:[" ",(0,s.jsxs)("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",m.replace(/^https?:\/\//,"")]})]})]}),N&&(0,s.jsx)(d.l6,{label:"Region",value:R,onChange:e=>I(e.target.value),options:N.map(e=>({value:e.id,label:e.label}))}),i&&(0,s.jsx)(d.pd,{label:"Default Model",value:S.defaultModel,onChange:e=>$({...S,defaultModel:e.target.value}),placeholder:l?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),f&&(0,s.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,s.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,s.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),M&&(0,s.jsx)(d.Ex,{variant:"success"===M?"success":"error",children:"success"===M?"Valid":"Invalid"}),u&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:u}),i&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Enter the model ID exactly as your compatible endpoint expects it. This model will be saved as the connection default."}),k&&(0,s.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,s.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,s.jsx)(d.pd,{label:"Account ID",value:O.accountId,onChange:e=>E({...O,accountId:e.target.value}),placeholder:"abc123def456..."}),(0,s.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Find your Account ID in the right sidebar of ",(0,s.jsx)("a",{href:"https://dash.cloudflare.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"dash.cloudflare.com"})]})]}),w&&(0,s.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,s.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsx)(d.pd,{label:"Azure Endpoint",value:A.azureEndpoint,onChange:e=>T({...A,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,s.jsx)(d.pd,{label:"Deployment Name",value:A.deployment,onChange:e=>T({...A,deployment:e.target.value}),placeholder:"gpt-4"}),(0,s.jsx)(d.pd,{label:"API Version",value:A.apiVersion,onChange:e=>T({...A,apiVersion:e.target.value}),placeholder:"2024-10-01-preview"}),(0,s.jsx)(d.pd,{label:"Organization",value:A.organization,onChange:e=>T({...A,organization:e.target.value}),placeholder:"Organization ID"})]})]}),(0,s.jsx)(d.pd,{label:"Priority",type:"number",min:1,value:S.priority,onChange:e=>$({...S,priority:Number.parseInt(e.target.value)||1})}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.$n,{onClick:Y,fullWidth:!0,disabled:U||!f&&!b&&(!V||!G)||b&&(!V||!S.baseUrl.trim())||i&&!S.defaultModel.trim()||w&&(!A.azureEndpoint||!A.deployment||!A.organization)||k&&!O.accountId,children:U?"Saving...":"Save"}),(0,s.jsx)(d.$n,{onClick:h,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function F({isOpen:e,node:t,onSave:a,onClose:i,isAnthropic:l}){let[n,o]=(0,r.useState)({name:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[c,m]=(0,r.useState)(!1),[u,p]=(0,r.useState)(""),[x,h]=(0,r.useState)(""),[f,b]=(0,r.useState)(!1),[g,y]=(0,r.useState)(null),v=function(e){try{return["http:","https:"].includes(new URL(e).protocol)}catch{return!1}}(n.baseUrl.trim());(0,r.useEffect)(()=>{t&&(o({name:t.name||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(l?"https://api.anthropic.com/v1":"https://api.openai.com/v1")}),y(null),p(""),h(""))},[t,l]);let j=async()=>{if(n.name.trim()&&v){m(!0);try{let e={name:n.name.trim(),baseUrl:n.baseUrl.trim()};l||(e.apiType=n.apiType),await a(e)}finally{m(!1)}}},w=async()=>{b(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:n.baseUrl,apiKey:u,type:l?"anthropic-compatible":"openai-compatible",modelId:x.trim()||void 0})}),t=await e.json();y(t.valid?"success":"failed")}catch{y("failed")}finally{b(!1)}};return t?(0,s.jsx)(d.aF,{isOpen:e,title:`Edit ${l?"Anthropic":"OpenAI"} Compatible`,onClose:i,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(d.pd,{label:"Name",value:n.name,onChange:e=>o({...n,name:e.target.value}),placeholder:`${l?"Anthropic":"OpenAI"} Compatible`,hint:"Friendly label for this provider."}),!l&&(0,s.jsx)(d.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:n.apiType,onChange:e=>o({...n,apiType:e.target.value})}),(0,s.jsx)(d.pd,{label:"Base URL",value:n.baseUrl,onChange:e=>o({...n,baseUrl:e.target.value}),placeholder:l?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Base URL ending in /v1 for your ${l?"Anthropic":"OpenAI"}-compatible API.`}),t.prefix?(0,s.jsxs)("p",{className:"text-xs text-text-muted",children:["Model IDs use prefix ",(0,s.jsx)("code",{className:"bg-sidebar px-1 rounded font-mono",children:t.prefix})," ","(auto-assigned; stable so combos keep working)."]}):null,(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.pd,{label:"API Key (for Check)",type:"password",autoComplete:"off",value:u,onChange:e=>p(e.target.value),className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(d.$n,{onClick:w,disabled:!u||f||!v,variant:"secondary",children:f?"Checking...":"Check"})})]}),(0,s.jsx)(d.pd,{label:"Model ID (optional)",value:x,onChange:e=>h(e.target.value),placeholder:"e.g. my-model-id",hint:"If the provider has no /models endpoint, test with a model ID."}),g&&(0,s.jsx)(d.Ex,{variant:"success"===g?"success":"error",children:"success"===g?"Valid":"Invalid"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.$n,{onClick:j,fullWidth:!0,disabled:!n.name.trim()||!v||c,children:c?"Saving...":"Save"}),(0,s.jsx)(d.$n,{onClick:i,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function L({isOpen:e,providerAlias:t,providerDisplayAlias:a,onSave:i,onClose:l}){let[n,o]=(0,r.useState)(""),[c,m]=(0,r.useState)(null),[u,p]=(0,r.useState)(""),[x,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{e&&(o(""),m(null),p(""))},[e]);let f=e=>{let a=`${t}/`;return e.startsWith(a)?e.slice(a.length):e},b=async()=>{let e=f(n.trim());if(e){m("testing"),p("");try{let a=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${t}/${e}`})}),s=await a.json();m(s.ok?"ok":"error"),p(s.error||"")}catch(e){m("error"),p(e.message)}}},g=async()=>{let e=f(n.trim());if(e&&!x){h(!0);try{await i(e)}finally{h(!1)}}};return(0,s.jsx)(d.aF,{isOpen:e,onClose:l,title:"Add Custom Model",children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{type:"text",value:n,onChange:e=>{o(e.target.value),m(null),p("")},onKeyDown:e=>{"Enter"===e.key&&b()},placeholder:"e.g. claude-opus-4-5",className:"flex-1 px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",autoFocus:!0}),(0,s.jsx)(d.$n,{variant:"secondary",icon:"science",loading:"testing"===c,onClick:b,disabled:!n.trim()||"testing"===c,children:"testing"===c?"Testing...":"Test"})]}),(0,s.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,s.jsx)("code",{className:"font-mono bg-sidebar px-1 rounded",children:f(n.trim())||"model-id"})]})]}),"ok"===c&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base",children:"check_circle"}),"Model is reachable"]}),"error"===c&&(0,s.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",children:"cancel"}),(0,s.jsx)("span",{children:u||"Model not reachable"})]}),(0,s.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,s.jsx)(d.$n,{onClick:l,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,s.jsx)(d.$n,{onClick:g,fullWidth:!0,size:"sm",disabled:!n.trim()||x,children:x?"Adding...":"Add Model"})]})]})})}_.propTypes={isOpen:O().bool.isRequired,provider:O().string,providerName:O().string,isCompatible:O().bool,isAnthropic:O().bool,authType:O().string,authHint:O().string,website:O().string,error:O().string,onSave:O().func.isRequired,onBulkDone:O().func,onClose:O().func.isRequired},F.propTypes={isOpen:O().bool.isRequired,node:O().shape({id:O().string,name:O().string,prefix:O().string,apiType:O().string,baseUrl:O().string}),onSave:O().func.isRequired,onClose:O().func.isRequired,isAnthropic:O().bool},L.propTypes={isOpen:O().bool.isRequired,providerAlias:O().string.isRequired,providerDisplayAlias:O().string.isRequired,onSave:O().func.isRequired,onClose:O().func.isRequired};let J=`[
4
+ {
5
+ "accessToken": "eyJhbGc...",
6
+ "refreshToken": "rt_...",
7
+ "idToken": "eyJhbGc...",
8
+ "email": "user@example.com"
9
+ }
10
+ ]`;function K({isOpen:e,onClose:t,onSuccess:a}){let[i,l]=(0,r.useState)(""),[n,o]=(0,r.useState)(!1),[c,m]=(0,r.useState)(""),[u,p]=(0,r.useState)(null),x=()=>{n||(l(""),m(""),p(null),t())},h=async()=>{var e;let t;m(""),p(null);let s=i.trim();if(!s)return;try{t=JSON.parse(s)}catch(e){m(`${(0,N.Tl)("Invalid JSON")}: ${e.message}`);return}let r=Array.isArray(e=t)?e:e&&"object"==typeof e?Array.isArray(e.accounts)?e.accounts:[e]:null;if(!r||0===r.length)return void m((0,N.Tl)("No accounts found in input"));o(!0);try{let e=await fetch("/api/oauth/codex/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:r})}),t=await e.json();if(!e.ok)return void m(t?.error||`Request failed: ${e.status}`);p(t),t.success>0&&"function"==typeof a&&a()}catch(e){m(e.message||(0,N.Tl)("Request failed"))}finally{o(!1)}},f=u?.results?.filter(e=>!e.ok)||[];return(0,s.jsx)(d.aF,{isOpen:e,title:(0,N.Tl)("Bulk Add Codex Accounts"),onClose:x,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)("p",{className:"text-xs text-text-muted",children:(0,N.Tl)("Paste an array of codex account JSON objects. Each must include accessToken (and ideally refreshToken, idToken).")}),(0,s.jsx)("textarea",{className:"w-full rounded border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[240px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:J,value:i,onChange:e=>l(e.target.value),disabled:n}),c&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:c}),u&&(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:`text-sm font-medium ${u.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",u.success," ",(0,N.Tl)("added"),u.failed>0?`, ✗ ${u.failed} ${(0,N.Tl)("failed")}`:""]}),f.length>0&&(0,s.jsx)("ul",{className:"rounded border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:f.map(e=>(0,s.jsxs)("li",{className:"text-red-400",children:["[",e.index,"] ",e.error]},e.index))})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.$n,{onClick:h,fullWidth:!0,disabled:n||!i.trim(),children:n?(0,N.Tl)("Importing..."):(0,N.Tl)("Import All")}),(0,s.jsx)(d.$n,{onClick:x,variant:"ghost",fullWidth:!0,disabled:n,children:(0,N.Tl)("Close")})]})]})})}K.propTypes={isOpen:O().bool.isRequired,onClose:O().func.isRequired,onSuccess:O().func};var B=a(77251);function W({connectionId:e,providerAlias:t,models:a,jobSnapshot:i,onComplete:l,onStarted:n,onClose:o}){let[c,m]=(0,r.useState)(4),[u,p]=(0,r.useState)(50),[x,h]=(0,r.useState)(Math.round(20)),[f,b]=(0,r.useState)(!1),[g,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[w,k]=(0,r.useState)(""),[N,C]=(0,r.useState)(""),[S,$]=(0,r.useState)(""),A=(0,r.useRef)({onComplete:l,onStarted:n}),T=(0,r.useRef)(null),O=(0,r.useRef)(e),E=(0,r.useRef)(null),R=a?.length||0,I=(0,r.useMemo)(()=>`max concurrency 16 \xb7 batch 200 \xb7 timeout ${60}s`,[]);function D(e){if(e){if("idle"===e.status){E.current=null,b(!1);return}if(y({done:e.done||0,total:e.total||0,ok:e.ok||0,dead:e.dead||0,retryable:e.retryable||0,skippedDead:e.skippedDead||0,skippedDup:e.skippedDup||0}),"running"===e.status&&(E.current=e.connectionId||O.current,T.current=null,b(!0)),e.currentRange&&C(`Probing ${e.currentRange.from}–${e.currentRange.to} of ${e.total}…`),e.error&&k(e.error),"done"===e.status||"cancelled"===e.status||"error"===e.status){E.current=null,b(!1);let t={ok:e.ok||0,dead:e.dead||0,retryable:e.retryable||0,tested:e.done||0,skippedDead:e.skippedDead||0,skippedDup:e.skippedDup||0,cancelled:"cancelled"===e.status,retryableAuthOnly:!0===e.retryableAuthOnly};j(t),C("cancelled"===e.status?"Cancelled (partial results saved).":"error"===e.status?"Stopped.":"Done.");let a=`${e.startedAt||"unknown"}:${e.status}`;T.current!==a&&(T.current=a,A.current.onComplete?.(t))}}}async function P(){if(f||!e||0===R)return;b(!0),k(""),j(null),C("Starting…");let s={concurrency:Math.max(1,Math.min(16,Number(c)||4)),batchSize:Math.max(1,Math.min(200,Number(u)||50)),timeoutMs:Math.max(1e3,Math.min(6e4,1e3*(Number(x)||20)))};E.current=e;try{let r=await fetch(`/api/providers/${e}/model-probes/verify/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({models:a,providerAlias:t,...s,timeoutMs:s.timeoutMs})}),i=await r.json().catch(()=>({}));if(O.current!==e){E.current=null,b(!1);return}if(!r.ok){E.current=null,k(i.error||"Failed to start"),b(!1);return}A.current.onStarted?.(i),D(i),"running"!==i.status&&b(!1)}catch(e){E.current=null,k(e?.message||"Verify failed"),b(!1)}}async function M(){let t=E.current||e;await fetch(`/api/providers/${t}/model-probes/verify/cancel`,{method:"POST"}).catch(()=>{})}async function z(a){if(!e)return;let s="retryable"===a,r=s?Number(v?.retryable||0):Number(v?.dead||0);if(!s||await (0,B.l)({title:"Remove retry-failed models?",message:`Review ${r} retryable result(s) and remove the eligible models? Timeouts, rate limits, network failures, and provider errors may be temporary. Credential failures are kept. Removed models can be enabled or imported again later.`,confirmText:"Remove eligible"})){$(a),k(""),C(`Removing ${s?"retry-failed":"dead"} models…`);try{let r=await fetch(`/api/providers/${e}/model-probes/remove-unavailable`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:t,kind:"llm",status:a})}),i=await r.json().catch(()=>({}));if(!r.ok)return void k(i.error||"Remove failed");let l=Number(i.removed||0),n=Number(i.kept||0),o=v?{...v,[s?"retryable":"dead"]:n,...s?{retryableAuthOnly:n>0}:{}}:v;j(o),C(`Removed ${l} ${s?"retry-failed":"dead"} model(s).`+(n>0?` Kept ${n} credential failure(s).`:"")),A.current.onComplete?.({...o||{},removed:l,kept:n,removedStatus:a})}catch(e){k(e?.message||"Remove failed")}finally{$("")}}}async function U(){if(!e)return;let t=await fetch(`/api/providers/${e}/model-probes/cache`,{method:"DELETE"}),a=await t.json().catch(()=>({}));t.ok?(C(`Cleared probe cache (${a.cleared||0} rows). Next verify will re-test everything.`),j(null),y(null),A.current.onComplete?.({cacheCleared:!0,cleared:a.cleared||0})):k(a.error||"Clear cache failed")}(0,r.useEffect)(()=>{A.current={onComplete:l,onStarted:n},O.current=e}),(0,r.useEffect)(()=>{D(i)},[i]);let q=g?.total?Math.min(100,Math.round(g.done/g.total*100)):0;return(0,s.jsxs)("div",{className:"mb-4 rounded-lg border border-border bg-sidebar/40 p-3 space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:"Verify models"}),(0,s.jsxs)("p",{className:"text-[11px] text-text-muted mt-0.5",children:["Batch-ping availability and latency. Dead = permanently unavailable (missing, blocked, or deprecated) and can be removed; retry = transient (timeout/429/5xx). Known-dead models are skipped until you Clear cache. Caps: ",I,"."]})]}),o&&(0,s.jsx)("button",{type:"button",onClick:o,className:"p-1 text-text-muted hover:text-text-main rounded",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-3 items-end",children:[(0,s.jsxs)("label",{className:"text-xs text-text-muted",children:["Concurrency",(0,s.jsx)("input",{type:"number",min:1,max:16,value:c,disabled:f,onChange:e=>m(e.target.value),className:"mt-1 block w-20 rounded-md border border-border bg-background px-2 py-1 text-xs"})]}),(0,s.jsxs)("label",{className:"text-xs text-text-muted",children:["Batch size",(0,s.jsx)("input",{type:"number",min:1,max:200,value:u,disabled:f,onChange:e=>p(e.target.value),className:"mt-1 block w-20 rounded-md border border-border bg-background px-2 py-1 text-xs"})]}),(0,s.jsxs)("label",{className:"text-xs text-text-muted",children:["Timeout (s)",(0,s.jsx)("input",{type:"number",min:1,max:60,value:x,disabled:f,onChange:e=>h(e.target.value),className:"mt-1 block w-20 rounded-md border border-border bg-background px-2 py-1 text-xs"})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[f?(0,s.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"stop",onClick:M,children:"Cancel"}):(0,s.jsx)(d.$n,{size:"sm",icon:"science",onClick:P,disabled:!e||0===R,children:"Start"}),(0,s.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete_sweep",onClick:U,disabled:f,children:"Clear cache"})]})]}),g&&(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{className:"h-1.5 w-full rounded-full bg-border overflow-hidden",children:(0,s.jsx)("div",{className:"h-full bg-primary transition-all",style:{width:`${q}%`}})}),(0,s.jsxs)("p",{className:"text-[11px] text-text-muted flex flex-wrap gap-x-2",children:[(0,s.jsxs)("span",{title:"Models probed this run",children:[g.done,"/",g.total," tested"]}),(0,s.jsxs)("span",{title:"Reachable",children:["\xb7 ok ",g.ok]}),(0,s.jsxs)("span",{title:"Permanently unavailable this run (missing, blocked, or deprecated)",children:["\xb7 dead ",g.dead]}),(0,s.jsxs)("span",{title:"Transient failure this run (timeout / 429 / 5xx / network); re-testable",children:["\xb7 retry ",g.retryable]}),g.skippedDead?(0,s.jsxs)("span",{title:"Not probed — cache already marks them dead. Clear cache to re-test.",children:["\xb7 skipped known-dead ",g.skippedDead]}):null,g.skippedDup?(0,s.jsxs)("span",{title:"Duplicate ids collapsed",children:["\xb7 dupes ",g.skippedDup]}):null]})]}),N&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:N}),w&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:w}),v&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[(0,s.jsxs)("span",{className:"text-xs text-text-main",children:["Summary: ",v.ok," ok \xb7 ",v.dead," dead \xb7 ",v.retryable," retry",v.skippedDead?` \xb7 ${v.skippedDead} skipped known-dead`:"",v.cancelled?" \xb7 cancelled":""]}),v.dead>0&&(0,s.jsxs)(d.$n,{size:"sm",variant:"primary",icon:"delete_sweep",onClick:()=>z("dead"),disabled:f||!!S,loading:"dead"===S,children:["Remove ",v.dead," dead"]}),v.retryable>0&&!v.retryableAuthOnly&&(0,s.jsxs)(d.$n,{size:"sm",variant:"danger",icon:"delete_sweep",onClick:()=>z("retryable"),disabled:f||!!S,loading:"retryable"===S,children:["Remove ",v.retryable," retry failures"]})]})]})}W.propTypes={connectionId:O().string,providerAlias:O().string,models:O().arrayOf(O().object),jobSnapshot:O().object,onComplete:O().func,onStarted:O().func,onClose:O().func};var H=a(68875);let V=["UTC","America/Los_Angeles","America/Denver","America/Chicago","America/New_York","America/Sao_Paulo","Europe/London","Europe/Berlin","Europe/Moscow","Asia/Kolkata","Asia/Shanghai","Asia/Tokyo","Asia/Singapore","Australia/Sydney"],G=(()=>{let e=[];try{e=Intl.supportedValuesOf?.("timeZone")||[]}catch{e=[]}try{let e=Intl.DateTimeFormat().resolvedOptions().timeZone;e&&!V.includes(e)&&V.unshift(e)}catch{}return[...new Set([...V,...e.filter(e=>!V.includes(e))])]})(),Z={mon:"Mo",tue:"Tu",wed:"We",thu:"Th",fri:"Fr",sat:"Sa",sun:"Su"};function Q({providerId:e,scheduleKey:t}){let a=t||e,i=(0,r.useId)(),[l,n]=(0,r.useState)(!1),[o,c]=(0,r.useState)(!1),[m,u]=(0,r.useState)("UTC"),[p,x]=(0,r.useState)("offPeak"),[h,f]=(0,r.useState)([]),[b,g]=(0,r.useState)(!1),[y,v]=(0,r.useState)(""),[j,w]=(0,r.useState)(0),[,k]=(0,r.useState)(0),N=(0,r.useCallback)(e=>{let t=H.Z9.find(t=>t.id===e);t&&(u(t.config.timezone||"UTC"),x("peak"===t.config.defaultState?"peak":"offPeak"),f(t.config.windows.map(e=>({type:e.type,start:e.start,end:e.end,days:Array.isArray(e.days)&&e.days.length?[...e.days]:[...H.de]}))),w(0))},[]);(0,r.useEffect)(()=>{let e=!1;return c(!1),u("UTC"),x("offPeak"),f([]),w(0),v(""),fetch("/api/settings",{cache:"no-store"}).then(e=>e.ok?e.json():{}).then(t=>{if(e)return;let s=(t.providerSchedules||{})[a];s&&Array.isArray(s.windows)&&s.windows.length&&(c(!0),u(s.timezone||"UTC"),x("peak"===s.defaultState?"peak":"offPeak"),f(s.windows.map(e=>({type:"offPeak"===e.type?"offPeak":"peak",start:e.start||"09:00",end:e.end||"17:00",days:Array.isArray(e.days)&&e.days.length?[...e.days]:[...H.de]})))),n(!0)}).catch(()=>{e||n(!0)}),()=>{e=!0}},[a]),(0,r.useEffect)(()=>{let e=setInterval(()=>k(e=>e+1),3e4);return()=>clearInterval(e)},[]);let C=(0,r.useMemo)(()=>o?{timezone:m,defaultState:p,windows:h}:null,[o,m,p,h]),S=(0,H.yW)(C),$="unscheduled"===S?null:(0,H.bC)(C),A=(0,r.useCallback)((e,t)=>{f(a=>a.map((a,s)=>s===e?{...a,...t}:a)),w(0)},[]),T=(0,r.useCallback)((e,t)=>{f(a=>a.map((a,s)=>{if(s!==e)return a;let r=a.days.includes(t)?a.days.filter(e=>e!==t):[...a.days,t];return{...a,days:r.length?r:a.days}})),w(0)},[]),O=async()=>{v("");let t=o?(0,H.v2)({timezone:m,defaultState:p,windows:h},e):null;if(o&&t.error)return void v(t.error);g(!0);try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerSchedules:{[a]:o?t.value:null}})});if(!e.ok){let t=await e.json().catch(()=>({}));v(t.error||`Failed to save peak hours (${e.status})`);return}w(Date.now())}catch{v("Failed to save peak hours")}finally{g(!1)}};return l?(0,s.jsxs)(d.Zp,{children:[(0,s.jsxs)("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Peak hours"}),"unscheduled"!==S&&(0,s.jsxs)("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium ${"peak"===S?"bg-red-500/10 text-red-600 dark:text-red-400":"bg-green-500/10 text-green-600 dark:text-green-400"}`,title:$?`Changes at ${function(e,t){try{return new Intl.DateTimeFormat("en-US",{timeZone:t,weekday:"short",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(new Date(e))}catch{return e}}(new Date($).toISOString(),m)}`:void 0,children:[(0,s.jsx)("span",{className:`size-1.5 rounded-full ${"peak"===S?"bg-red-500":"bg-green-500"}`}),"peak"===S?"Peak now":"Off-peak now",$?` \xb7 ${(0,H.zt)($-Date.now())} left`:""]})]}),(0,s.jsx)(d.lM,{checked:o,onChange:e=>{c(e),w(0),e&&!h.length&&(u("UTC"),x("offPeak"),f([{type:"peak",start:"09:00",end:"17:00",days:[...H.de]}]))},label:"Enable peak / off-peak hours",size:"sm"})]}),(0,s.jsx)("p",{className:"mb-3 text-xs text-text-muted leading-relaxed",children:"Optional. Some providers (e.g. DeepSeek) charge less outside peak hours. Define this provider's windows once, then mark models in a combo as peak-only or off-peak-only to skip them at the wrong hours."}),o&&(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,s.jsx)("label",{htmlFor:i,className:"text-sm font-medium text-text-main",children:"Timezone"}),(0,s.jsx)("input",{id:i,list:`${i}-zones`,value:m,onChange:e=>{u(e.target.value),w(0)},placeholder:"UTC — type to search IANA zones",className:"rounded-md border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary",autoComplete:"off"}),(0,s.jsx)("datalist",{id:`${i}-zones`,children:G.map(e=>(0,s.jsx)("option",{value:e},e))}),(0,s.jsx)("p",{className:"text-[10px] text-text-muted",children:"Windows are wall-clock in this zone (provider docs usually quote UTC)"})]}),(0,s.jsx)(d.l6,{label:"Outside all windows is",options:[{value:"offPeak",label:"Off-peak (peak is the exception)"},{value:"peak",label:"Peak (off-peak discount is the exception)"}],value:p,onChange:e=>{x(e.target.value),w(0)}})]}),(0,s.jsx)(d.l6,{label:"Load a preset",options:H.Z9.map(e=>({value:e.id,label:e.label})),value:"",onChange:e=>N(e.target.value),placeholder:"Choose a known provider policy…",hint:"Fills the editor below — review the provider's current pricing page, then Save"}),(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[h.map((e,t)=>(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-md border border-border bg-black/[0.02] px-2 py-2 dark:bg-white/[0.02]",children:[(0,s.jsxs)("select",{value:e.type,onChange:e=>A(t,{type:e.target.value}),className:"rounded-md border border-border bg-background px-2 py-1 text-xs","aria-label":`Window ${t+1} type`,children:[(0,s.jsx)("option",{value:"peak",children:"Peak"}),(0,s.jsx)("option",{value:"offPeak",children:"Off-peak"})]}),(0,s.jsx)("input",{type:"time",value:e.start,onChange:e=>A(t,{start:e.target.value}),className:"rounded-md border border-border bg-background px-2 py-1 text-xs","aria-label":`Window ${t+1} start`}),(0,s.jsx)("span",{className:"text-xs text-text-muted",children:"→"}),(0,s.jsx)("input",{type:"time",value:e.end,onChange:e=>A(t,{end:e.target.value}),className:"rounded-md border border-border bg-background px-2 py-1 text-xs","aria-label":`Window ${t+1} end`}),(0,s.jsx)("div",{className:"flex items-center gap-1",children:H.de.map(a=>(0,s.jsx)("button",{type:"button",onClick:()=>T(t,a),className:`size-6 rounded text-[10px] font-medium transition-colors ${e.days.includes(a)?"bg-primary/15 text-primary":"text-text-muted hover:bg-black/5 dark:hover:bg-white/5"}`,title:a,children:Z[a]},a))}),(0,s.jsx)("button",{type:"button",onClick:()=>{f(e=>e.filter((e,a)=>a!==t)),w(0)},className:"ml-auto rounded p-1 text-text-muted transition-colors hover:bg-red-500/10 hover:text-red-500",title:"Remove window","aria-label":`Remove window ${t+1}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},t)),(0,s.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,s.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"add",onClick:()=>{f(e=>[...e,{type:"peak",start:"09:00",end:"17:00",days:[...H.de]}]),w(0)},children:"Add window"})})]})]}),y&&(0,s.jsx)("p",{className:"mt-2 text-xs text-red-500",children:y}),j>0&&!y&&(0,s.jsx)("p",{className:"mt-2 text-xs text-green-600 dark:text-green-400",children:"Saved"}),(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)(d.$n,{size:"sm",onClick:O,disabled:b,children:b?"Saving...":o?"Save peak hours":"Save (disable schedule)"})})]}):null}var Y=a(36861),X=a(48874),ee=a(53578);let et={claude:"claudeAutoPing",codex:"codexAutoPing"};function ea(){let e,t,a,l=(0,i.useParams)(),u=(0,i.useRouter)(),p=l.id,{getCaps:x}=(0,k.y)(),[h,f]=(0,r.useState)([]),[b,g]=(0,r.useState)([]),[y,v]=(0,r.useState)(!0),[C,T]=(0,r.useState)(null),[O,I]=(0,r.useState)(!1),[D,M]=(0,r.useState)(!1),[z,q]=(0,r.useState)(!1),[J,B]=(0,r.useState)(""),[H,V]=(0,r.useState)(!1),[G,Z]=(0,r.useState)(!1),[ea,es]=(0,r.useState)(!1),[er,ei]=(0,r.useState)(null),[el,en]=(0,r.useState)({}),[eo,ed]=(0,r.useState)([]),[ec,em]=(0,r.useState)(!1),[eu,ep]=(0,r.useState)({}),[ex,eh]=(0,r.useState)(""),[ef,eb]=(0,r.useState)(()=>new Set),[eg,ey]=(0,r.useState)(!1),[ev,ej]=(0,r.useState)(null),[ew,ek]=(0,r.useState)(""),[eN,eC]=(0,r.useState)(!1),[eS,e$]=(0,r.useState)("30"),[eA,eT]=(0,r.useState)("auto"),[eO,eE]=(0,r.useState)({enabled:!1,connections:{}}),[eR,eI]=(0,r.useState)([]),[eD,eP]=(0,r.useState)([]),[eM,ez]=(0,r.useState)([]),[eU,eq]=(0,r.useState)([]),[e_,eF]=(0,r.useState)(null),[eL,eJ]=(0,r.useState)(!1),[eK,eB]=(0,r.useState)(!1),[eW,eH]=(0,r.useState)(!1),[eV,eG]=(0,r.useState)(null),[eZ,eQ]=(0,r.useState)({}),[eY,eX]=(0,r.useState)(null),e0=(0,r.useRef)(!1),e1=(0,r.useRef)(null),e2=(0,r.useRef)(0),e5=(0,r.useRef)(0),[e3,e4]=(0,r.useState)(!1),[e6,e7]=(0,r.useState)(""),[e8,e9]=(0,r.useState)(!1),[te,tt]=(0,r.useState)(null),[ta,ts]=(0,r.useState)({}),[tr,ti]=(0,r.useState)({}),[tl,tn]=(0,r.useState)("all"),{copied:to,copy:td}=(0,w.C)(),tc="ag_risk_confirmed",tm=C?{id:C.id,name:C.name||("anthropic-compatible"===C.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===C.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===C.type?"AC":"OC",apiType:C.apiType,baseUrl:C.baseUrl,type:C.type}:c.zN[p]||c.fg[p]||c.IS[p]||c.nJ[p]||c.br[p],tu=tm?.authModes||[],tp=!!c.zN[p]||!!c.IS[p]||tu.includes("oauth"),tx=!!c.fg[p]||tu.includes("apikey"),th=!!c.IS[p]?.noAuth,tf=(0,m.KC)(p),tb=(()=>{let e=new Map(tf.map(e=>[e.id,e]));for(let t of eD)t?.id&&e.set(t.id,{...e.get(t.id),...t});return[...e.values()]})(),tg=(0,c.wG)(p),ty=(0,c.mq)(p),tv=(0,c.gb)(p),tj=ty||tv,tw=h.some(e=>!1!==e.isActive),tk=function({isCompatible:e,hasActiveConnection:t}){let a=!e,s=!e;return{showToolbar:a||t||s,showImport:a,showVerify:t,showBulkControls:s}}({isCompatible:tj,hasActiveConnection:tw}),tN=!tj&&tp&&tx,tC="xai"===p?"Grok Build OAuth":"OAuth",tS="xai"===p?"xAI API Key":"API Key",t$=()=>{I(!0)},tA=()=>{"antigravity"===p&&"true"!==window.localStorage.getItem(tc)?eJ(!0):tp?t$():(B(""),q(!0))},tT=()=>{B(""),q(!0)},tO=()=>{tp?tA():tT()},tE=e=>{if(!eA||"auto"===eA)return null;let t=j(p,e);return t&&t.includes(eA)?eA:null},tR=(()=>{let e=new Set;for(let t of tb){let a=j(p,t.id);a&&a.forEach(t=>{"none"!==t&&e.add(t)})}return e.size?["auto",...e]:null})(),tI=tj?p:tg,tD=tj?C?.prefix||p:tg,tP=(0,$.Iz)(eU,tI),tM=e=>(0,$.uJ)(tP,e,tI),tz=(0,r.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tI)}`,{cache:"no-store"}),t=await e.json();e.ok&&eq(t.ids||[])}catch(e){(0,R.s)("Error fetching disabled models:",e)}},[tI]),tU=async e=>{try{await (0,X.x)("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tI,ids:[e]})}),await tz()}catch(e){(0,R.s)("Error disabling model:",e)}},tq=async e=>{try{return await (0,X.x)(`/api/models/disabled?providerAlias=${encodeURIComponent(tI)}&id=${encodeURIComponent(e)}`,{method:"DELETE"}),await tz(),!0}catch(e){return(0,R.s)("Error enabling model:",e),!1}},t_=async e=>{e.length&&eF({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{eF(null);try{await (0,X.x)("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tI,ids:e})}),await tz()}catch(e){(0,R.s)("Error disabling all models:",e)}}})},tF=async()=>{try{await (0,X.x)(`/api/models/disabled?providerAlias=${encodeURIComponent(tI)}`,{method:"DELETE"}),await tz()}catch(e){(0,R.s)("Error enabling all models:",e)}},tL=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&en(t.aliases||{})}catch(e){(0,R.s)("Error fetching aliases:",e)}},[]),tJ=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&ed(t.models||[])}catch(e){(0,R.s)("Error fetching custom models:",e)}},[]);(0,r.useEffect)(()=>{"kilocode"===p&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&ez(e.models)}).catch(()=>{})},[p]);let tK=(0,r.useCallback)(async()=>{try{let[e,t,a]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),s=await e.json(),r=await t.json(),i=a.ok?await a.json():{};if(e.ok){let e=(s.connections||[]).filter(e=>e.provider===p);f(e)}let l=(i.providerStrategies||{})[p]||{};ej(l.fallbackStrategy||null),ek(null!=l.stickyRoundRobinLimit?String(l.stickyRoundRobinLimit):"1");let n=l.accountScheduler||{};eC(!0===n.enabled),e$(String(Math.max(1,Math.round((n.sessionAffinityTtlSeconds||1800)/60))));let o=(i.providerThinking||{})[p]||{};eT(o.mode||"auto");let d=et[p],c=d&&i[d]||{};if(eE({enabled:!0===c.enabled,connections:c.connections||{}}),t.ok){let e=(r.nodes||[]).find(e=>e.id===p)||null;if(!e&&tj)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===p)||null))break}T(e)}}catch(e){(0,R.s)("Error fetching connections:",e)}finally{v(!1)}},[p,tj]),tB=(0,r.useCallback)(async(e=null)=>{let t=++e5.current,a=e?h.find(t=>t.id===e&&!1!==t.isActive):h.find(e=>b.includes(e.id)&&!1!==e.isActive)||h.find(e=>!1!==e.isActive);if(!a){ti({}),ts({});return}try{let e=await fetch(`/api/providers/${a.id}/model-probes`,{cache:"no-store"});if(!e.ok)return;let s=await e.json().catch(()=>({})),r={},i={};for(let e of s.probes||[])r[e.modelId]="ok"===e.status?"ok":"dead"===e.status?"dead":"retry",null!=e.latencyMs&&(i[e.modelId]=e.latencyMs);if(t!==e5.current)return;ti(r),ts(i)}catch{}},[h,b]),tW=async e=>{try{let t=await fetch(`/api/provider-nodes/${p}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),a=await t.json();t.ok?(T(a.node),await tK(),es(!1)):(0,R.s)(a?.error||"Failed to update provider node")}catch(e){(0,R.s)("Error updating provider node:",e)}},tH=async(e,t)=>{try{return await (0,ee.T)(p,a=>{let s={...a};return e?s.fallbackStrategy=e:delete s.fallbackStrategy,"round-robin"===e&&""!==t?s.stickyRoundRobinLimit=Number(t)||3:e||delete s.stickyRoundRobinLimit,s}),!0}catch(e){return(0,R.s)("Error saving provider strategy:",e),!1}},tV=async(e,t)=>{let a=Math.min(1440,Math.max(1,Number.parseInt(t,10)||30));try{return await (0,ee.T)(p,t=>({...t,accountScheduler:{...t.accountScheduler||{},enabled:e,sessionAffinityTtlSeconds:60*a}})),!0}catch(e){return(0,R.s)("Error saving balanced scheduler:",e),!1}},tG=async e=>{let t=e?"round-robin":null,a=e?ew||"1":ew;await tH(t,a)&&(e&&!ew&&ek("1"),ej(t))},tZ=async e=>{await tH("round-robin",e)&&ek(e)},tQ=async e=>{await tV(e,eS)&&eC(e)},tY=async e=>{await tV(eN,e)&&e$(e)},tX=async e=>{try{let t=await fetch("/api/settings",{cache:"no-store"}),a={...(t.ok?await t.json():{}).providerThinking||{}};e&&"auto"!==e?a[p]={mode:e}:delete a[p],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:a})})}catch(e){(0,R.s)("Error saving thinking config:",e)}},t0=async e=>{let t=et[p];if(t){eE(e);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[t]:e})})}catch(e){(0,R.s)("Error saving auto-ping config:",e)}}};(0,r.useEffect)(()=>{tK(),tL(),tJ(),tz()},[tK,tL,tJ,tz]),(0,r.useEffect)(()=>{tB()},[tB]),(0,r.useEffect)(()=>{if(tj)return;let e=h.find(e=>!1!==e.isActive);if(!e)return void eP([]);let t=!1;return fetch(`/api/providers/${e.id}/models`,{cache:"no-store"}).then(e=>e.json().catch(()=>({}))).then(e=>{!t&&Array.isArray(e.models)&&e.models.length>0&&eP(e.models)}).catch(()=>{}),()=>{t=!0}},[h,tj]),(0,r.useEffect)(()=>{let e=(c.zN[p]||c.fg[p]||c.IS[p]||c.nJ[p])?.modelsFetcher;e&&S(e).then(eI)},[p]);let t1=(0,r.useCallback)(e=>{let t=++e2.current;e1.current&&(clearTimeout(e1.current),e1.current=null);let a=async()=>{try{let s=await fetch(`/api/providers/${e}/model-probes/verify/status`,{cache:"no-store"}),r=await s.json().catch(()=>null);if(t!==e2.current)return;if(!s.ok||!r?.status)throw Error("Verify status temporarily unavailable");tt(r&&r.status?r:null),r?.status==="running"?e1.current=setTimeout(a,1500):(e1.current=null,await tB(e))}catch{t===e2.current&&(e1.current=setTimeout(a,1500))}};e1.current=setTimeout(a,0)},[tB]);(0,r.useEffect)(()=>{let e=h.find(e=>b.includes(e.id)&&!1!==e.isActive)||h.find(e=>!1!==e.isActive);return e?(t1(e.id),()=>{e2.current+=1,e1.current&&(clearTimeout(e1.current),e1.current=null)}):void tt(null)},[h,b,t1]);let t2=async(e,t,a=tg)=>{let s=`${a}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:s,alias:t})});if(e.ok)await tL();else{let t=await e.json();(0,R.s)(t.error||"Failed to set alias")}}catch(e){(0,R.s)("Error setting alias:",e)}},t5=async e=>{try{await (0,X.x)(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"}),await tL()}catch(e){(0,R.s)("Error deleting alias:",e)}},t3=async(e,t="llm",a=tI)=>{try{let s=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:a,id:e,type:t})});if(s.ok)await tJ(),window.dispatchEvent(new CustomEvent("customModelChanged"));else{let e=await s.json();(0,R.s)(e.error||"Failed to add custom model")}}catch(e){(0,R.s)("Error adding custom model:",e)}},t4=async(e,t="llm",a=tI)=>{try{let s=new URLSearchParams({providerAlias:a,id:e,type:t});await (0,X.x)(`/api/models/custom?${s}`,{method:"DELETE"}),await tJ(),window.dispatchEvent(new CustomEvent("customModelChanged"))}catch(e){(0,R.s)("Error deleting custom model:",e)}},t6=async()=>{if(e3)return;let e=h.find(e=>b.includes(e.id)&&!1!==e.isActive)||h.find(e=>!1!==e.isActive);if(!e)return void(0,R.s)((0,N.Tl)("Add an active connection first"));e4(!0),e7("");try{let t=await fetch(`/api/providers/${e.id}/models`),a=await t.json().catch(()=>({}));if(!t.ok)return void(0,R.s)(a.error||(0,N.Tl)("Failed to fetch models"));let s=a.models||[];if(0===s.length)return void(0,R.s)(a.warning||(0,N.Tl)("No models returned"));let r=new Set;try{let t=await fetch(`/api/providers/${e.id}/model-probes`,{cache:"no-store"});for(let e of(await t.json().catch(()=>({}))).probes||[])"dead"===e.status&&r.add(e.modelId)}catch{}let i=0,l=new Set(tb.map(e=>e.id)),n=[],o=[],d=new Set;for(let e of s){let t=(0,A.R2)(e,tI);if(!t)continue;let{id:a,name:s,type:c}=t;if(r.has((0,Y.v)(a,tI))){i+=1;continue}let m=`${c}|${a}`;if(d.has(m))continue;if(d.add(m),l.has(a)){tM(a)&&o.push(a);continue}if(eo.some(e=>e.providerAlias===tI&&e.id===a&&(0,A.ki)(e.kind||e.type||"llm")===c))continue;let u=`${tI}/${a}`;Object.values(el).includes(u)||n.push({providerAlias:tI,id:a,type:c,name:s,...t.reasoning?{reasoning:t.reasoning}:{}})}let c=0;if(o.length>0)try{for(let e of o)(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tI)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&(c+=1);await tz()}catch{}let m=0;if(n.length>0){let e=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({models:n})}),t=await e.json().catch(()=>({}));if(!e.ok)return void(0,R.s)(t.error||(0,N.Tl)("Failed to save models"));m=t.added??n.length,await tJ(),window.dispatchEvent(new CustomEvent("customModelChanged"))}let u=n.filter(e=>"llm"!==e.type).length,p=[];if(m>0&&p.push(`${m} new`),c>0&&p.push(`${c} re-enabled`),0===p.length)e7((0,N.Tl)("All models already in list"));else{let e=`Imported ${p.join(" \xb7 ")} (${s.length} from provider)`;u>0&&(e+=" \xb7 non-chat types stored for media pages"),a.warning&&(e+=` \xb7 ${a.warning}`),e7(e)}if(i>0&&e7(e=>`${e} \xb7 ${i} skipped (known dead)`),m>0||c>0)try{let t=[...tb,...n.map(e=>({id:e.id,name:e.name,kind:e.type}))],a=await fetch(`/api/providers/${e.id}/model-probes/verify/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({models:t,providerAlias:tI})}),s=await a.json().catch(()=>({}));if(!a.ok)throw Error(s.error||"Failed to start auto-verify");tt(s&&s.status?s:null),t1(e.id)}catch(e){e7(t=>`${t} \xb7 auto-verify failed: ${e?.message||e}`)}}catch(e){(0,R.s)("Error importing models:",e),(0,R.s)((0,N.Tl)("Error fetching models")+": "+(e?.message||e))}finally{e4(!1)}},t7=async()=>{if(eK||0===h.length)return;let e=Object.fromEntries(h.map(e=>[e.id,{state:"queued",error:null}]));e0.current=!1,eB(!0),eH(!1),eG(null),eQ(e),eX({total:h.length,completed:0,passed:0,failed:0,stopped:!1});let t=0,a=0;try{for(let e=0;e<h.length;e+=1){if(e0.current){eX({total:h.length,completed:e,passed:t,failed:a,stopped:!0});break}let s=h[e];eG(s.id),eQ(e=>({...e,[s.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${s.id}/test`,{method:"POST"}),r=await e.json(),i=!!r.valid;i?t+=1:a+=1,eQ(e=>({...e,[s.id]:{state:i?"success":"failed",error:i?null:r.error||null}}))}catch(e){a+=1,eQ(t=>({...t,[s.id]:{state:"failed",error:e.message||"Test failed"}}))}eX({total:h.length,completed:e+1,passed:t,failed:a,stopped:!1}),e<h.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{eG(null),eB(!1),eH(!1),e0.current=!1}},t8=async e=>{let t=h.find(t=>t.id===e),a=t?.name?.trim()||t?.email?.trim()||e;eF({title:"Delete Connection",message:`Delete connection “${a}”?`,onConfirm:async()=>{eF(null);try{await (0,X.x)(`/api/providers/${e}`,{method:"DELETE"}),f(t=>t.filter(t=>t.id!==e))}catch(e){(0,R.s)("Error deleting connection:",e)}}})},t9=()=>{tK(),I(!1)},ae=async e=>{B("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:p,...e})}),a=null;try{a=await t.json()}catch{a=null}if(t.ok){await tK(),q(!1);return}B(a?.error||"Failed to save connection")}catch(e){(0,R.s)("Error saving connection:",e),B("Failed to save connection")}},at=async e=>{try{await (0,X.x)(`/api/providers/${er.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),await tK(),Z(!1)}catch(e){(0,R.s)("Error updating connection:",e)}},aa=async(e,t)=>{try{await (0,X.x)(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})}),f(a=>a.map(a=>a.id===e?{...a,isActive:t}:a))}catch(e){(0,R.s)("Error updating connection status:",e)}},as=async e=>{let t,a=e?.providerSpecificData?.baseUrl;if(a){try{t=new URL(a).hostname.toLowerCase().replace(/^\[|\]$/g,"")}catch{(0,R.s)("Cannot allow-list: invalid base URL",a);return}try{let e=await fetch("/api/settings",{cache:"no-store"});if(!e.ok)throw Error(`Failed to load settings (${e.status})`);let a=await e.json(),s=[...new Set([...a.ssrfAllowHosts||[],t])],r=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ssrfAllowHosts:s})});if(!r.ok)throw Error(`Failed to update allow list (${r.status})`);await tK()}catch(e){(0,R.s)("Error adding host to allow list:",e)}}},ar=async(e,t)=>{let a=[...h];[a[e],a[t]]=[a[t],a[e]],f(a);try{if((await Promise.all([fetch(`/api/providers/${a[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${a[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])).some(e=>!e.ok))throw Error("Failed to reorder connections")}catch(e){(0,R.s)("Error swapping priority:",e),await tK()}},ai=h.length>0&&b.length===h.length,al=(0,s.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:h.map((e,t)=>(0,s.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,s.jsx)("div",{className:"flex shrink-0 items-center pl-1 sm:pl-2",children:(0,s.jsx)("input",{type:"checkbox",checked:b.includes(e.id),onChange:()=>{var t;return t=e.id,void g(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"})}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsx)(U,{connection:e,isOAuth:tp,isFirst:0===t,isLast:t===h.length-1,onMoveUp:()=>ar(t,t-1),onMoveDown:()=>ar(t,t+1),onToggleActive:t=>aa(e.id,t),autoPing:et[p]&&"oauth"===e.authType?{on:!0===eO.connections[e.id],onToggle:t=>{var a;return a=e.id,void t0({...eO,connections:{...eO.connections,[a]:t}})},provider:p}:null,onEdit:()=>{ei(e),Z(!0)},onDelete:()=>t8(e.id),onAllowlistHost:()=>as(e),oneByOneStatus:eZ[e.id]||null})})]},e.id))}),an=async e=>{if(!ef.has(e)){eb(t=>new Set(t).add(e));try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${tI}/${e}`})}),a=await t.json();ep(t=>({...t,[e]:a.ok?"ok":"error"})),eh(a.ok?"":a.error||"Model not reachable")}catch{ep(t=>({...t,[e]:"error"})),eh("Network error")}finally{eb(t=>{let a=new Set(t);return a.delete(e),a})}}};return y?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsx)(d.Qv,{}),(0,s.jsx)(d.Qv,{})]}):tm?(0,s.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)(n(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,s.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${tm.color}15`},children:ec?(0,s.jsx)("span",{className:"text-sm font-bold",style:{color:tm.color},children:tm.textIcon||tm.id.slice(0,2).toUpperCase()}):(0,s.jsx)(o.default,{src:ty&&tm.apiType?"responses"===tm.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":tv?"/providers/anthropic-m.png":`/providers/${tm.id}.png`,alt:tm.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>em(!0)})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,s.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:tm.name}),(tm.notice?.apiKeyUrl||tm.notice?.signupUrl||tm.website)&&(0,s.jsxs)("a",{href:tm.notice?.apiKeyUrl||tm.notice?.signupUrl||tm.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),tm.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,s.jsxs)("p",{className:"text-text-muted",children:[h.length," connection",1===h.length?"":"s"]})]})]})]}),tm.deprecated&&(0,s.jsxs)("div",{className:"flex items-start gap-3 rounded-xl border border-amber-500/25 bg-amber-500/8 px-4 py-3 text-xs text-amber-600 dark:text-amber-400",children:[(0,s.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base text-amber-500 mt-0.5",children:"warning"}),(0,s.jsx)("p",{className:"leading-relaxed font-normal",children:String(tm.deprecationNotice).replace(/^⚠️\s*⚠️?\s*/,"")})]}),tm.notice?.text&&!tm.deprecated&&(0,s.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,s.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:tm.notice.text}),tm.notice.apiKeyUrl&&(0,s.jsx)("a",{href:tm.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),tj&&C&&(0,s.jsx)(d.Zp,{children:(0,s.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:tv?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,s.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[tv?"Messages API":"responses"===C.apiType?"Responses API":"Chat Completions"," \xb7 ",(C.baseUrl||"").replace(/\/$/,""),"/",tv?"messages":"responses"===C.apiType?"responses":"chat/completions"]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,s.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>{B(""),q(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,s.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>es(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,s.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{eF({title:"Delete Compatible Node",message:`Delete this ${tv?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{eF(null);try{await (0,X.x)(`/api/provider-nodes/${p}`,{method:"DELETE"}),u.push("/dashboard/providers")}catch(e){(0,R.s)("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),th?(0,s.jsx)(d.gw,{providerId:p}):(0,s.jsxs)(d.Zp,{children:[(0,s.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[h.length>0&&(0,s.jsxs)(s.Fragment,{children:[b.length>0&&(0,s.jsxs)(d.$n,{size:"sm",variant:"danger",icon:"delete",onClick:()=>{let e=b.length;0!==e&&eF({title:`Delete ${e} Connection${e>1?"s":""}`,message:`Delete ${e} connection${e>1?"s":""}? This cannot be undone.`,onConfirm:async()=>{eF(null);let e=0,t=[...b],a=[];for(let s of t)try{(await fetch(`/api/providers/${s}`,{method:"DELETE"})).ok?a.push(s):e+=1}catch(t){(0,R.s)("Error deleting connection:",t),e+=1}f(e=>e.filter(e=>!a.includes(e.id))),g([]),e>0&&(0,R.s)(`Deleted ${t.length-e} connection(s), ${e} failed.`)}})},children:["Delete Selected (",b.length,")"]}),(0,s.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:t7,disabled:eK,children:eK?"Testing Connection One-by-One...":"Test Connection One-by-One"}),eK&&(0,s.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{eK&&(e0.current=!0,eH(!0))},disabled:eW,children:eW?"Stopping...":"Stop"})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border/60 bg-surface-2/40 p-3",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-xs font-medium text-text-main",children:"Balanced Scheduler"}),(0,s.jsx)(d.m_,{text:"Process-local least-inflight scheduling with fresh quota signals. Sessions stay on one account and rebind on failure, cooldown, or cap.",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[15px] text-text-muted cursor-help",children:"info"})})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[eN&&(0,s.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:["Affinity",(0,s.jsx)("input",{"aria-label":"Session affinity minutes",type:"number",min:1,max:1440,value:eS,onChange:e=>tY(e.target.value),className:"w-14 px-2 py-0.5 text-xs border border-border rounded-md bg-background text-text-main focus:outline-none focus:border-primary"}),(0,s.jsx)("span",{className:"text-[11px]",children:"min"})]}),(0,s.jsx)(d.lM,{checked:eN,onChange:tQ,"aria-label":"Balanced scheduler"})]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 pt-2 border-t border-border/40",title:eN?"Saved and used again when balanced scheduling is off":void 0,children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-xs font-medium text-text-main",children:"Round Robin"}),(0,s.jsx)(d.m_,{text:"Cycles through connections sequentially in round-robin fashion.",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[15px] text-text-muted cursor-help",children:"info"})})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:["round-robin"===ev&&(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,s.jsx)("input",{type:"number",min:1,value:ew,onChange:e=>tZ(e.target.value),placeholder:"1",disabled:eN,title:eN?"Saved and used again when balanced scheduling is off":void 0,className:"w-14 px-2 py-0.5 text-xs border border-border rounded-md bg-background text-text-main focus:outline-none focus:border-primary disabled:cursor-not-allowed disabled:opacity-50"})]}),(0,s.jsx)(d.lM,{checked:"round-robin"===ev,onChange:tG,"aria-label":"Round Robin",disabled:eN,title:eN?"Saved and used again when balanced scheduling is off":void 0})]})]})]})]})]}),0===h.length?(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:tp?"lock":"key"})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),tN&&(0,s.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",tC," or ",tS,"."]})]})]}),(0,s.jsx)("div",{className:"flex gap-2",children:tN?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:tA,children:tC}),(0,s.jsx)(d.$n,{size:"sm",icon:"key",onClick:tT,children:tS})]}):(0,s.jsxs)(s.Fragment,{children:[!tj&&"iflow"===p&&(0,s.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>M(!0),children:"Cookie"}),"codex"===p&&(0,s.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>V(!0),children:(0,N.Tl)("Bulk Add")}),(0,s.jsx)(d.$n,{size:"sm",icon:"add",onClick:tO,children:tj?"Add API Key":"iflow"===p?"OAuth":"Add Connection"})]})})]}):(0,s.jsxs)(s.Fragment,{children:[eY&&(0,s.jsx)("div",{className:"mb-4 rounded-lg 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,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,s.jsxs)("span",{children:["Total: ",eY.total]}),(0,s.jsxs)("span",{children:["Completed: ",eY.completed]}),(0,s.jsxs)("span",{children:["Passed: ",eY.passed]}),(0,s.jsxs)("span",{children:["Failed: ",eY.failed]}),eY.stopped&&(0,s.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),eK&&eV&&(0,s.jsxs)("span",{children:["Running: ",h.find(e=>e.id===eV)?.name||eV]})]})}),h.length>0&&(0,s.jsx)("div",{className:"mb-3 flex items-center gap-2 border-b border-black/[0.03] pb-2 dark:border-white/[0.03]",children:(0,s.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-xs text-text-muted hover:text-primary",children:[(0,s.jsx)("input",{type:"checkbox",checked:ai,onChange:()=>{ai?g([]):g(h.map(e=>e.id))},className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Select All"]})}),al,!tj&&(0,s.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===p&&(0,s.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>M(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codex"===p&&(0,s.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>V(!0),title:(0,N.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,N.Tl)("Bulk Add")}),tN?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:tA,className:"w-full sm:w-auto",children:tC}),(0,s.jsx)(d.$n,{size:"sm",icon:"key",onClick:tT,className:"w-full sm:w-auto",children:tS})]}):(0,s.jsx)(d.$n,{size:"sm",icon:"add",onClick:tO,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,s.jsx)(Q,{providerId:p,scheduleKey:tD},p),(0,s.jsxs)(d.Zp,{children:[(0,s.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),tR&&(0,s.jsx)("select",{value:eA,onChange:e=>{var t;eT(t=e.target.value),tX(t)},title:"Appends (level) suffix to copied model names",className:"rounded-md border border-border bg-background px-2 py-1 text-xs focus:border-primary focus:outline-none",children:tR.map(e=>(0,s.jsx)("option",{value:e,children:`Thinking: ${e.charAt(0).toUpperCase()+e.slice(1)}`},e))})]}),tk.showToolbar&&(e=(tk.showBulkControls?[...tb,...eM.filter(e=>!tb.some(t=>t.id===e.id))].filter(e=>{let t=(0,m.CP)(e);return!t||"llm"===t}).map(e=>e.id):[]).filter(e=>!tM(e)),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[tk.showImport&&(0,s.jsx)(d.$n,{size:"sm",variant:"secondary",icon:e3?"progress_activity":"cloud_download",onClick:t6,disabled:e3||!tw,title:tw?"Import models from the active connection":"Add an active connection to import models",children:e3?"Importing...":"Import models"}),tk.showVerify&&(0,s.jsx)(d.$n,{size:"sm",variant:"secondary",icon:te?.status==="running"?"progress_activity":"science",onClick:()=>e9(e=>!e),children:te?.status==="running"?`Verifying ${te.done}/${te.total}`:e8?"Hide verify":"Verify models"}),tk.showBulkControls&&eU.length>0&&(0,s.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:tF,children:"Active All"}),tk.showBulkControls&&e.length>0&&(0,s.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>t_(e),children:"Disable All"})]}))]}),!!ex&&(0,s.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:ex}),e6&&(0,s.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-2 rounded-xl border border-primary/30 bg-primary/10 px-3.5 py-2 text-xs font-medium text-text-main",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"info"}),(0,s.jsx)("span",{children:e6})]}),(0,s.jsx)("button",{onClick:()=>e7(""),className:"text-text-muted hover:text-text-main p-0.5 rounded",title:"Dismiss",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})})]}),e8&&(t=h.find(e=>b.includes(e.id)&&!1!==e.isActive)||h.find(e=>!1!==e.isActive),a=[...(0,$.R3)({customModels:eo,modelAliases:el,providerAlias:tI,builtInModels:tb,type:"llm"}).filter(e=>!tM(e.id)).map(e=>({id:e.id,name:e.name||e.id,kind:"llm"})),...tb.filter(e=>{let t=(0,m.CP)(e);return(!t||"llm"===t)&&!tM(e.id)}).map(e=>({id:e.id,name:e.name||e.id,kind:"llm"}))],(0,s.jsx)(W,{connectionId:t?.id,providerAlias:tI,models:a,jobSnapshot:te,onClose:()=>e9(!1),onStarted:e=>{tt(e&&e.status?e:null);let a=e?.connectionId||t?.id;a&&t1(a)},onComplete:async e=>{e?.removedStatus&&tt(t=>t?{...t,dead:Number(e.dead??t.dead??0),retryable:Number(e.retryable??t.retryable??0),retryableAuthOnly:!0===e.retryableAuthOnly}:t),e?.removed>0&&await tJ(),e?.removed>0&&await tz(),(e?.removed>0||e?.cacheCleared)&&await tB(t?.id)}})),(()=>{let e,t,a;if(tj)return(0,s.jsx)(P,{providerStorageAlias:tI,providerDisplayAlias:tD,modelAliases:el,customModels:eo,copied:to,onCopy:td,onSetAlias:t2,onDeleteAlias:t5,onAddCustomModel:e=>t3(e,"llm",tI),onDeleteCustomModel:e=>t4(e,"llm",tI),onRefreshModels:tJ,connections:h,isAnthropic:tv,disabledModelIds:eU,onEnableModel:tq});let r=[...tb,...eM.filter(e=>!tb.some(t=>t.id===e.id))].filter(e=>{let t=(0,m.CP)(e);return!t||"llm"===t}),i=r.filter(e=>!tM(e.id)),l=r.filter(e=>tM(e.id)),n=(0,$.R3)({customModels:eo,modelAliases:el,providerAlias:tI,builtInModels:tb,type:"llm"}),o=n.filter(e=>!tM(e.id)&&("all"===tl||(tr[(0,Y.v)(e.id,tI)]||null)===tl)),d=i.filter(e=>"all"===tl||(tr[(0,Y.v)(e.id,tI)]||null)===tl);return(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsx)("div",{className:"mb-2 flex flex-wrap items-center gap-1.5 text-xs",children:[{id:"all",label:"All",count:i.length+n.filter(e=>!tM(e.id)).length},{id:"ok",label:"Reachable",count:[...i,...n].filter(e=>!tM(e.id)&&("ok"===tr[(0,Y.v)(e.id,tI)]||"ok"===eu[e.id])).length},{id:"dead",label:"Dead",count:[...i,...n].filter(e=>!tM(e.id)&&("dead"===tr[(0,Y.v)(e.id,tI)]||"error"===eu[e.id])).length},{id:"retry",label:"Retry",count:[...i,...n].filter(e=>!tM(e.id)&&"retry"===tr[(0,Y.v)(e.id,tI)]).length}].map(e=>(0,s.jsxs)("button",{onClick:()=>tn(e.id),className:`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1 text-xs font-medium transition-all ${tl===e.id?"bg-primary text-black font-semibold shadow-sm":"bg-surface-2/60 border border-border/40 text-text-muted hover:border-border hover:text-text-main"}`,children:[(0,s.jsx)("span",{children:e.label}),(0,s.jsx)("span",{className:`rounded-full px-1.5 py-0.2 text-[10px] tabular-nums ${tl===e.id?"bg-black/20 text-black font-bold":"bg-black/10 dark:bg-white/10 text-text-muted"}`,children:e.count})]},e.id))}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-3",children:[o.map(e=>{let t=(0,Y.v)(e.id,tI);return(0,s.jsx)(E,{model:{id:e.id,name:e.name},fullModel:`${tD}/${e.id}`,alias:e.alias,copied:to,onCopy:td,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===e.source?t4(e.id,"llm",tI):t5(e.alias)},testStatus:eu[e.id],onTest:h.length>0||th?()=>an(e.id):void 0,isTesting:ef.has(e.id),isCustom:!0,isFree:!1,caps:x(`${p}/${e.id}`),thinkingSuffix:tE(e.id),latencyMs:ta[e.id]??ta[t],probeState:te?.status==="running"&&te?.perModel?.[t]?te.perModel[t]:tr[t]||null},`${e.source}-${e.fullModel}`)}),d.map(e=>{let t=`${tI}/${e.id}`,a=`${p}/${e.id}`,r=Object.entries(el).find(([,e])=>e===t||e===a)?.[0],i=(0,Y.v)(e.id,tI);return(0,s.jsx)(E,{model:e,fullModel:`${tD}/${e.id}`,alias:r,copied:to,onSetAlias:t=>t2(e.id,t,tI),onCopy:td,onDeleteAlias:()=>t5(r),testStatus:eu[e.id],onTest:h.length>0||th?()=>an(e.id):void 0,isTesting:ef.has(e.id),isFree:e.isFree,onDisable:()=>tU(e.id),caps:x(`${p}/${e.id}`),thinkingSuffix:tE(e.id),latencyMs:ta[e.id]??ta[i],probeState:te?.status==="running"&&te?.perModel?.[i]?te.perModel[i]:tr[i]||null},e.id)}),(0,s.jsxs)("button",{onClick:()=>ey(!0),className:"flex min-h-[58px] min-w-[200px] flex-1 items-center justify-center gap-2 rounded-xl border border-dashed border-primary/40 bg-primary/5 px-4 py-3 text-xs font-medium text-primary transition-all hover:border-primary hover:bg-primary/10 hover:shadow-soft sm:flex-none",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"add_circle"}),"Add Custom Model"]}),eR.length>0&&(e=new Set([...Object.values(el),...n.map(e=>e.fullModel)]),t=new Set(tb.map(e=>e.id)),0===(a=eR.filter(a=>!e.has(`${tI}/${a.id}`)&&!t.has(a.id))).length?null:(0,s.jsxs)("div",{className:"w-full mt-2",children:[(0,s.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(e=>(0,s.jsxs)("button",{onClick:async()=>{await t3(e.id,"llm",tI)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:`${e.name} \xb7 ${(e.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]})),l.length>0&&(0,s.jsxs)("div",{className:"w-full mt-2",children:[(0,s.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",l.length,"):"]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:l.map(e=>(0,s.jsxs)("button",{onClick:()=>tq(e.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:"Restore model",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id]},e.id))})]})]})]})})()]}),"kiro"===p?(0,s.jsx)(d.Mh,{isOpen:O,providerInfo:tm,onSuccess:t9,onClose:()=>I(!1)}):"cursor"===p?(0,s.jsx)(d.G9,{isOpen:O,onSuccess:t9,onClose:()=>I(!1)}):"gitlab"===p?(0,s.jsx)(d.vj,{isOpen:O,providerInfo:tm,onSuccess:t9,onClose:()=>I(!1)}):(0,s.jsx)(d.LF,{isOpen:O,provider:p,providerInfo:tm,onSuccess:t9,onClose:()=>I(!1)}),"iflow"===p&&(0,s.jsx)(d.vE,{isOpen:D,onSuccess:()=>{tK(),M(!1)},onClose:()=>M(!1)}),(0,s.jsx)(_,{isOpen:z,provider:p,providerName:tm.name,isCompatible:tj,isAnthropic:tv,authType:tm?.authType,authHint:tm?.authHint,website:tm?.website,error:J,onSave:ae,onBulkDone:tK,onClose:()=>{B(""),q(!1)}}),(0,s.jsx)(d.wI,{isOpen:G,connection:er,onSave:at,onClose:()=>Z(!1)}),tj&&(0,s.jsx)(F,{isOpen:ea,node:C,onSave:tW,onClose:()=>es(!1),isAnthropic:tv}),!tj&&(0,s.jsx)(L,{isOpen:eg,providerAlias:tI,providerDisplayAlias:tD,onSave:async e=>{await t3(e,"llm",tI),ey(!1)},onClose:()=>ey(!1)}),"codex"===p&&(0,s.jsx)(K,{isOpen:H,onClose:()=>V(!1),onSuccess:tK}),(0,s.jsx)(d.uo,{isOpen:eL,onClose:()=>eJ(!1),onConfirm:()=>{(window.localStorage.setItem(tc,"true"),eJ(!1),tp)?t$():tT()},title:"Risk Notice",message:tm?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,s.jsx)(d.uo,{isOpen:!!e_,onClose:()=>eF(null),onConfirm:e_?.onConfirm,title:e_?.title||"Confirm",message:e_?.message,variant:"danger"})]}):(0,s.jsxs)("div",{className:"text-center py-20",children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,s.jsx)(n(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}},48874:(e,t,a)=>{"use strict";async function s(e,t){let a=await fetch(e,{...t,headers:{"Content-Type":"application/json",...t?.headers||{}},credentials:"same-origin"}),s=null;try{s=await a.json()}catch{s=null}if(!a.ok){let e=s&&(s.error||s.message)||`Request failed (${a.status})`,t=Error("string"==typeof e?e:"Request failed");throw t.status=a.status,t.data=s,t}return s}a.d(t,{x:()=>s})},53578:(e,t,a)=>{"use strict";a.d(t,{T:()=>i});let s=Symbol("delete-provider-strategy"),r=Promise.resolve();async function i(e,t,a=fetch){let s=r.then(()=>l(e,t,a));return r=s.catch(()=>{}),s}async function l(e,t,a){let r=await a("/api/settings",{cache:"no-store"});if(!r.ok)throw Error(`Failed to load settings (${r.status})`);let i=(await r.json()).providerStrategies||{},l=i[e]||{},n=t(l);if(void 0===n)return console.warn(`[patchProviderStrategy] updater for "${e}" returned undefined; keeping previous entry`),l;let o={...i};n===s?delete o[e]:n&&Object.keys(n).length>0?o[e]=n:delete o[e];let d=await a("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:o})});if(!d.ok)throw Error(`Failed to save settings (${d.status})`);return n===s?void 0:n}},70217:(e,t,a)=>{"use strict";function s(e){return"error"===e||"expired"===e||"unavailable"===e||"reauth_required"===e||"invalid"===e}function r(e,t){return!1===e?"default":"active"===t||"success"===t?"success":s(t)?"error":"default"}a.d(t,{g:()=>r,t:()=>s})}},e=>{e.O(0,[2574,3862,782,8500,594,4601,1321,1330,979,8441,3794,7358],()=>e(e.s=7687)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9089],{15615:(e,a,r)=>{"use strict";r.r(a),r.d(a,{default:()=>h,validateProviderForm:()=>p});var t=r(95155),l=r(12115),i=r(73321),s=r(98500),d=r.n(s),o=r(35497),n=r(90620);let c=Object.values(n.Q2).map(e=>({value:e.id,label:e.name})),u=Object.values(n.MA).map(e=>({value:e.id,label:e.name}));function p(e){let a={};return e.provider||(a.provider="Please select a provider"),"apikey"!==e.authMethod&&"cookie"!==e.authMethod||e.apiKey.trim()||(a.apiKey="API Key is required"),a}function h(){let e=(0,i.useRouter)(),[a,r]=(0,l.useState)(!1),[s,h]=(0,l.useState)({provider:"",authMethod:"apikey",apiKey:"",displayName:"",isActive:!0}),[m,x]=(0,l.useState)({}),f=(e,a)=>{h(r=>({...r,[e]:a})),m[e]&&x(a=>({...a,[e]:null}))},v=async a=>{let t;if(a.preventDefault(),x(t=p(s)),0===Object.keys(t).length){r(!0);try{let a=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,apiKey:s.apiKey.trim()})});if(a.ok)e.push("/dashboard/providers");else{let e=await a.json();x({submit:e.error||"Failed to create provider"})}}catch(e){x({submit:"An error occurred. Please try again."})}finally{r(!1)}}},y=n.Q2[s.provider];return(0,t.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsxs)(d(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,t.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:"Add New Provider"}),(0,t.jsx)("p",{className:"text-text-muted mt-2",children:"Configure a new AI provider to use with your applications."})]}),(0,t.jsx)(o.Zp,{children:(0,t.jsxs)("form",{onSubmit:v,className:"flex flex-col gap-6",children:[(0,t.jsx)(o.l6,{label:"Provider",options:c,value:s.provider,onChange:e=>f("provider",e.target.value),placeholder:"Select a provider",error:m.provider,required:!0}),y&&(0,t.jsxs)(o.Zp.Section,{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"size-10 rounded-lg flex items-center justify-center bg-bg border border-border",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:y.color},children:y.icon})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:y.name}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:"Selected provider"})]})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,t.jsxs)("span",{id:"new-provider-auth-method-label",className:"text-sm font-medium",children:["Authentication Method ",(0,t.jsx)("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),(0,t.jsx)("div",{className:"flex gap-3",role:"radiogroup","aria-labelledby":"new-provider-auth-method-label",children:u.map(e=>(0,t.jsxs)("button",{type:"button",role:"radio","aria-checked":s.authMethod===e.value,onClick:()=>f("authMethod",e.value),className:`flex-1 flex items-center justify-center gap-2 p-4 rounded-lg border transition-all ${s.authMethod===e.value?"border-primary bg-primary/5 text-primary":"border-border hover:border-primary/50"}`,children:[(0,t.jsx)("span",{className:"material-symbols-outlined","aria-hidden":"true",children:"apikey"===e.value?"key":"cookie"===e.value?"cookie":"lock"}),(0,t.jsx)("span",{className:"font-medium",children:e.label})]},e.value))})]}),"apikey"===s.authMethod&&(0,t.jsx)(o.pd,{label:"API Key",type:"password",autoComplete:"off",placeholder:"Enter your API key",value:s.apiKey,onChange:e=>f("apiKey",e.target.value),error:m.apiKey,hint:y?.notice?.apiKeyUrl?(0,t.jsxs)("span",{children:["Your key is encrypted and stored locally."," ",(0,t.jsxs)("a",{href:y.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline inline-flex items-center gap-0.5",children:["Get API Key ",(0,t.jsx)("span",{className:"material-symbols-outlined text-xs",children:"open_in_new"})]})]}):"Your API key will be encrypted and stored securely.",required:!0}),"cookie"===s.authMethod&&(0,t.jsx)(o.pd,{label:"Session Cookie / Token",type:"password",autoComplete:"off",placeholder:"Paste your session cookie or token",value:s.apiKey,onChange:e=>f("apiKey",e.target.value),error:m.apiKey,hint:"Your cookie credential will be encrypted and stored securely.",required:!0}),"oauth"===s.authMethod&&(0,t.jsxs)("div",{className:"p-4 rounded-lg bg-surface-2 border border-border text-sm text-text-muted flex items-start gap-3",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-primary text-lg mt-0.5",children:"lock_open"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("p",{className:"font-medium text-text-main",children:"OAuth Authentication"}),(0,t.jsxs)("p",{className:"text-xs text-text-muted mt-0.5",children:["OAuth authorization for ",y?.name||"this provider"," will launch via official browser sign-in on the Provider Settings page."]})]})]}),(0,t.jsx)(o.pd,{label:"Display Name",placeholder:"e.g., Production API, Dev Environment",value:s.displayName,onChange:e=>f("displayName",e.target.value),hint:"Optional. A friendly name to identify this configuration."}),(0,t.jsx)(o.lM,{checked:s.isActive,onChange:e=>f("isActive",e),label:"Active",description:"Enable this provider for use in your applications"}),m.submit&&(0,t.jsx)("div",{role:"alert",className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-600 dark:text-red-400 text-sm",children:m.submit}),(0,t.jsxs)("div",{className:"flex gap-3 pt-4 border-t border-border",children:[(0,t.jsx)(d(),{href:"/dashboard/providers",className:"flex-1",children:(0,t.jsx)(o.$n,{type:"button",variant:"ghost",fullWidth:!0,children:"Cancel"})}),(0,t.jsx)(o.$n,{type:"submit",loading:a,fullWidth:!0,className:"flex-1",children:"Create Provider"})]})]})})]})}},35497:(e,a,r)=>{"use strict";r.d(a,{x0:()=>k.default,Ex:()=>n.default,$n:()=>t.default,nh:()=>P.default,Zp:()=>s.default,Qv:()=>o.CardSkeleton,CK:()=>m.default,uo:()=>d.ConfirmModal,G9:()=>b.default,wI:()=>N.default,vj:()=>g.default,vE:()=>j.default,pd:()=>l.default,Mh:()=>y.default,uR:()=>h.default,Nf:()=>x.default,aF:()=>d.default,rq:()=>p.default,gw:()=>w.default,LF:()=>u.default,Wx:()=>K.default,gM:()=>v.default,Iz:()=>A.default,l6:()=>i.default,lM:()=>c.default,m_:()=>C.default,jK:()=>f.default});var t=r(92542),l=r(11910),i=r(98),s=r(84588),d=r(81127),o=r(25086);r(56319);var n=r(56061),c=r(98542);r(61929),r(21110),r(92622),r(8823),r(92173);var u=r(90882),p=r(72908),h=r(28815),m=r(45455),x=r(28058),f=r(4809);r(21931),r(80752),r(40197);var v=r(23615);r(44736);var y=r(62899);r(94230);var b=r(30815),j=r(23936),g=r(95088),N=r(73579),k=r(96748),w=r(4823),A=r(28067),C=r(97677),K=r(51825),P=r(29366);r(76361),r(91450)},80800:(e,a,r)=>{Promise.resolve().then(r.bind(r,15615))}},e=>{e.O(0,[2574,3862,782,8500,594,1321,4707,1330,8441,3794,7358],()=>e(e.s=80800)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9089],{15615:(e,a,r)=>{"use strict";r.r(a),r.d(a,{default:()=>h,validateProviderForm:()=>p});var t=r(95155),l=r(12115),i=r(73321),s=r(98500),d=r.n(s),o=r(35497),n=r(90620);let c=Object.values(n.Q2).map(e=>({value:e.id,label:e.name})),u=Object.values(n.MA).map(e=>({value:e.id,label:e.name}));function p(e){let a={};return e.provider||(a.provider="Please select a provider"),"apikey"!==e.authMethod&&"cookie"!==e.authMethod||e.apiKey.trim()||(a.apiKey="API Key is required"),a}function h(){let e=(0,i.useRouter)(),[a,r]=(0,l.useState)(!1),[s,h]=(0,l.useState)({provider:"",authMethod:"apikey",apiKey:"",displayName:"",isActive:!0}),[m,x]=(0,l.useState)({}),f=(e,a)=>{h(r=>({...r,[e]:a})),m[e]&&x(a=>({...a,[e]:null}))},v=async a=>{let t;if(a.preventDefault(),x(t=p(s)),0===Object.keys(t).length){r(!0);try{let a=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,apiKey:s.apiKey.trim()})});if(a.ok)e.push("/dashboard/providers");else{let e=await a.json();x({submit:e.error||"Failed to create provider"})}}catch(e){x({submit:"An error occurred. Please try again."})}finally{r(!1)}}},y=n.Q2[s.provider];return(0,t.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsxs)(d(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,t.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:"Add New Provider"}),(0,t.jsx)("p",{className:"text-text-muted mt-2",children:"Configure a new AI provider to use with your applications."})]}),(0,t.jsx)(o.Zp,{children:(0,t.jsxs)("form",{onSubmit:v,className:"flex flex-col gap-6",children:[(0,t.jsx)(o.l6,{label:"Provider",options:c,value:s.provider,onChange:e=>f("provider",e.target.value),placeholder:"Select a provider",error:m.provider,required:!0}),y&&(0,t.jsxs)(o.Zp.Section,{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"size-10 rounded-lg flex items-center justify-center bg-bg border border-border",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:y.color},children:y.icon})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:y.name}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:"Selected provider"})]})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,t.jsxs)("span",{id:"new-provider-auth-method-label",className:"text-sm font-medium",children:["Authentication Method ",(0,t.jsx)("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),(0,t.jsx)("div",{className:"flex gap-3",role:"radiogroup","aria-labelledby":"new-provider-auth-method-label",children:u.map(e=>(0,t.jsxs)("button",{type:"button",role:"radio","aria-checked":s.authMethod===e.value,onClick:()=>f("authMethod",e.value),className:`flex-1 flex items-center justify-center gap-2 p-4 rounded-lg border transition-all ${s.authMethod===e.value?"border-primary bg-primary/5 text-primary":"border-border hover:border-primary/50"}`,children:[(0,t.jsx)("span",{className:"material-symbols-outlined","aria-hidden":"true",children:"apikey"===e.value?"key":"cookie"===e.value?"cookie":"lock"}),(0,t.jsx)("span",{className:"font-medium",children:e.label})]},e.value))})]}),"apikey"===s.authMethod&&(0,t.jsx)(o.pd,{label:"API Key",type:"password",autoComplete:"off",placeholder:"Enter your API key",value:s.apiKey,onChange:e=>f("apiKey",e.target.value),error:m.apiKey,hint:y?.notice?.apiKeyUrl?(0,t.jsxs)("span",{children:["Your key is encrypted and stored locally."," ",(0,t.jsxs)("a",{href:y.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline inline-flex items-center gap-0.5",children:["Get API Key ",(0,t.jsx)("span",{className:"material-symbols-outlined text-xs",children:"open_in_new"})]})]}):"Your API key will be encrypted and stored securely.",required:!0}),"cookie"===s.authMethod&&(0,t.jsx)(o.pd,{label:"Session Cookie / Token",type:"password",autoComplete:"off",placeholder:"Paste your session cookie or token",value:s.apiKey,onChange:e=>f("apiKey",e.target.value),error:m.apiKey,hint:"Your cookie credential will be encrypted and stored securely.",required:!0}),"oauth"===s.authMethod&&(0,t.jsxs)("div",{className:"p-4 rounded-lg bg-surface-2 border border-border text-sm text-text-muted flex items-start gap-3",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-primary text-lg mt-0.5",children:"lock_open"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("p",{className:"font-medium text-text-main",children:"OAuth Authentication"}),(0,t.jsxs)("p",{className:"text-xs text-text-muted mt-0.5",children:["OAuth authorization for ",y?.name||"this provider"," will launch via official browser sign-in on the Provider Settings page."]})]})]}),(0,t.jsx)(o.pd,{label:"Display Name",placeholder:"e.g., Production API, Dev Environment",value:s.displayName,onChange:e=>f("displayName",e.target.value),hint:"Optional. A friendly name to identify this configuration."}),(0,t.jsx)(o.lM,{checked:s.isActive,onChange:e=>f("isActive",e),label:"Active",description:"Enable this provider for use in your applications"}),m.submit&&(0,t.jsx)("div",{role:"alert",className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-600 dark:text-red-400 text-sm",children:m.submit}),(0,t.jsxs)("div",{className:"flex gap-3 pt-4 border-t border-border",children:[(0,t.jsx)(d(),{href:"/dashboard/providers",className:"flex-1",children:(0,t.jsx)(o.$n,{type:"button",variant:"ghost",fullWidth:!0,children:"Cancel"})}),(0,t.jsx)(o.$n,{type:"submit",loading:a,fullWidth:!0,className:"flex-1",children:"Create Provider"})]})]})})]})}},35497:(e,a,r)=>{"use strict";r.d(a,{x0:()=>k.default,Ex:()=>n.default,$n:()=>t.default,nh:()=>P.default,Zp:()=>s.default,Qv:()=>o.CardSkeleton,CK:()=>m.default,uo:()=>d.ConfirmModal,G9:()=>b.default,wI:()=>N.default,vj:()=>g.default,vE:()=>j.default,pd:()=>l.default,Mh:()=>y.default,uR:()=>h.default,Nf:()=>x.default,aF:()=>d.default,rq:()=>p.default,gw:()=>w.default,LF:()=>u.default,Wx:()=>K.default,gM:()=>v.default,Iz:()=>A.default,l6:()=>i.default,lM:()=>c.default,m_:()=>C.default,jK:()=>f.default});var t=r(92542),l=r(11910),i=r(98),s=r(84588),d=r(81127),o=r(25086);r(56319);var n=r(56061),c=r(98542);r(61929),r(21110),r(92622),r(8823),r(92173);var u=r(90882),p=r(72908),h=r(28815),m=r(45455),x=r(28058),f=r(4809);r(21931),r(80752),r(40197);var v=r(23615);r(44736);var y=r(62899);r(94230);var b=r(30815),j=r(23936),g=r(95088),N=r(73579),k=r(96748),w=r(4823),A=r(28067),C=r(97677),K=r(51825),P=r(29366);r(76361),r(91450)},80800:(e,a,r)=>{Promise.resolve().then(r.bind(r,15615))}},e=>{e.O(0,[2574,3862,782,8500,594,4601,1321,1330,8441,3794,7358],()=>e(e.s=80800)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8460],{18964:(e,t,s)=>{"use strict";s.d(t,{default:()=>k});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(70217),h=s(38003);let f={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 g(){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 h=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=e?.unavailableCount||g.filter(e=>"available"!==e.status).length,v=0===b,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.jsxs)("div",{className:"relative",ref:p,children:[(0,r.jsxs)("button",{onClick:()=>o(!i),"aria-expanded":i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-all ${v?"bg-emerald-500/10 border-emerald-500/20 text-emerald-500 hover:bg-emerald-500/15":"bg-amber-500/10 border-amber-500/20 text-amber-500 hover:bg-amber-500/15"}`,children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:v?"verified":"warning"}),v?"All models operational":`${b} model${1!==b?"s":""} with issues`]}),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:v?"#22c55e":"#f59e0b"},children:v?"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:v?(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=f[e.status]||f.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:()=>h(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 b=s(78559);let v={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 j({variant:e,isOpen:t,onClose:s,onCreated:l}){let i=v[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)(""),[g,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,b.s)(`Error creating ${i.errorLabel} node:`,e),u("Network error")}finally{p(!1)}},$=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:g.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:g,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:$,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 N(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 w(e){return e?.allDisabled?2:e?.connected>0?0:1}function k({initialData:e}){let[t,s]=(0,a.useState)(e?.connections||[]),[l,i]=(0,a.useState)(e?.nodes||[]),[o,p]=(0,a.useState)(!e),[x,f]=(0,a.useState)(!1),[b,v]=(0,a.useState)(!1),[y,N]=(0,a.useState)(!1),[I,$]=(0,a.useState)(!1),[E,R]=(0,a.useState)(null),[S,O]=(0,a.useState)(null),P=(0,d.i)(),U=(0,h.C)(e=>e.query),_=(0,h.C)(e=>e.register),z=(0,h.C)(e=>e.unregister);(0,a.useEffect)(()=>(_("Search providers..."),()=>z()),[_,z]);let L=e=>!U.trim()||e.toLowerCase().includes(U.trim().toLowerCase()),M=(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=q(e,t),o=q(r,t),d=+(n.connected>0),c=+(o.connected>0);return d!==c?c-d:(s.name||"").localeCompare(a.name||"")}),F=(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){P.error("Failed to fetch provider data")}finally{p(!1)}},[P]);(0,a.useEffect)(()=>{e?.connections?p(!1):F()},[e,F]);let q=(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=>(0,u.t)(l(e))),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}},D=async(e,r,a)=>{let l=Array.isArray(r)?r:[r],i=t=>t.provider===e&&l.includes(t.authType),n=t.filter(i),o=new Map(n.map(e=>[e.id,e.isActive]));s(e=>e.map(e=>i(e)?{...e,isActive:a}:e));let d=(await Promise.allSettled(n.map(e=>fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:a})})))).filter(e=>"rejected"===e.status||!e.value?.ok).length;d>0&&(s(e=>e.map(e=>o.has(e.id)?{...e,isActive:o.get(e.id)}:e)),P.error(`Failed to ${a?"enable":"disable"} ${d} connection${1===d?"":"s"}`))},K=async(e,t=null)=>{if(!E){R("provider"===e?t:e),O(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(O(r),r.summary){let{passed:e,failed:t,total:s}=r.summary;0===t?P.success(`All ${s} tests passed`):P.warning(`${e}/${s} passed, ${t} failed`)}}catch(e){O({error:"Test request failed"}),P.error("Provider test failed")}finally{R(null)}}},B=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=>L(e.name)),H=l.filter(e=>"anthropic-compatible"===e.type).map(e=>({id:e.id,name:e.name||"Anthropic Compatible",color:"#D97757",textIcon:"AC"})).filter(e=>L(e.name)),J=M(Object.entries(c.zN).filter(([,e])=>!e.hidden&&L(e.name)),"oauth"),W=Object.entries(m.IS).filter(([,e])=>!e.hidden&&L(e.name)).sort(([,e],[,t])=>!!t.noAuth-!!e.noAuth),Q=M(Object.entries(m.nJ).filter(([,e])=>!e.hidden&&L(e.name)&&(e.serviceKinds??["llm"]).includes("llm")),"freeTier").sort(([,e],[,t])=>!!t.noAuth-!!e.noAuth),Z=Object.entries(c.fg).filter(([,e])=>!e.hidden&&(e.serviceKinds??["llm"]).includes("llm")&&L(e.name)).sort(([e,t],[s,r])=>{let a=w(q(e,"apikey")),l=w(q(s,"apikey"));return a!==l?a-l:(t.name||"").localeCompare(r.name||"")}),X=!!U.trim(),G=X||x?Z:Z.slice(0,20),V=Z.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 Y=!U.trim()||J.length>0||W.length>0||Q.length>0||Z.length>0||B.length>0||H.length>0;return(0,r.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[!Y&&(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"})]}),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:"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)(g,{}),(0,r.jsxs)("button",{onClick:()=>K("oauth"),disabled:!!E,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"===E?"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"===E?" animate-spin":""}`,children:"play_arrow"}),"oauth"===E?"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:J.map(([e,t])=>(0,r.jsx)(C,{providerId:e,provider:t,stats:q(e,"oauth"),authType:"oauth",onToggle:t=>D(e,"oauth",t)},e))})]}),(W.length>0||Q.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:()=>K("free"),disabled:!!E,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"===E?"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"===E?" animate-spin":""}`,children:"play_arrow"}),"free"===E?"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:[W.map(([e,t])=>{let s="kiro"===e?["oauth","apikey","api_key"]:"oauth";return(0,r.jsx)(C,{providerId:e,provider:t,stats:q(e,s),authType:"free",onToggle:t=>D(e,s,t)},e)}),Q.map(([e,t])=>(0,r.jsx)(T,{providerId:e,provider:t,stats:q(e,"apikey"),authType:"apikey",onToggle:t=>D(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:()=>$(e=>!e),className:"w-full sm:w-auto",children:"Add custom provider"}),I&&(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:()=>$(!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:()=>{$(!1),v(!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:()=>{$(!1),N(!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"})]})]})]})]})]}),Z.length>0&&(0,r.jsxs)("button",{onClick:()=>K("apikey"),disabled:!!E,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"===E?"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"===E?" animate-spin":""}`,children:"play_arrow"}),"apikey"===E?"Testing...":"Test All"]})]})]}),(B.length>0||H.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:[...B,...H].map(e=>(0,r.jsx)(T,{providerId:e.id,provider:e,stats:q(e.id,"apikey"),authType:"compatible",onToggle:t=>D(e.id,"apikey",t)},e.id))})]}),0===B.length&&0===H.length&&0===Z.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:()=>v(!0),children:"Add custom provider"})]}),G.length>0&&(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(B.length>0||H.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:G.map(([e,t])=>(0,r.jsx)(T,{providerId:e,provider:t,stats:q(e,"apikey"),authType:"apikey",onToggle:t=>D(e,"apikey",t)},e))})]}),!X&&!x&&V>0&&(0,r.jsxs)("button",{onClick:()=>f(!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 ",Z.length," providers"]})]}),(0,r.jsx)(j,{variant:"openai",isOpen:b,onClose:()=>v(!1),onCreated:e=>{i(t=>[...t,e]),v(!1)}}),(0,r.jsx)(j,{variant:"anthropic",isOpen:y,onClose:()=>N(!1),onCreated:e=>{i(t=>[...t,e]),N(!1)}}),S&&(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-start justify-center px-3 pt-[6vh] sm:pt-[10vh]",onClick:()=>O(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:()=>O(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)(A,{results:S})})]})]})]})}function C({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:[N(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 T({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:[N(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 A({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."})]})}j.propTypes={variant:i().oneOf(["openai","anthropic"]).isRequired,isOpen:i().bool.isRequired,onClose:i().func.isRequired,onCreated:i().func.isRequired},C.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},T.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},A.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}},35497:(e,t,s)=>{"use strict";s.d(t,{x0:()=>w.default,Ex:()=>d.default,$n:()=>r.default,nh:()=>I.default,Zp:()=>i.default,Qv:()=>o.CardSkeleton,CK:()=>u.default,uo:()=>n.ConfirmModal,G9:()=>v.default,wI:()=>N.default,vj:()=>j.default,vE:()=>y.default,pd:()=>a.default,Mh:()=>b.default,uR:()=>x.default,Nf:()=>h.default,aF:()=>n.default,rq:()=>p.default,gw:()=>k.default,LF:()=>m.default,Wx:()=>A.default,gM:()=>g.default,Iz:()=>C.default,l6:()=>l.default,lM:()=>c.default,m_:()=>T.default,jK:()=>f.default});var r=s(92542),a=s(11910),l=s(98),i=s(84588),n=s(81127),o=s(25086);s(56319);var d=s(56061),c=s(98542);s(61929),s(21110),s(92622),s(8823),s(92173);var m=s(90882),p=s(72908),x=s(28815),u=s(45455),h=s(28058),f=s(4809);s(21931),s(80752),s(40197);var g=s(23615);s(44736);var b=s(62899);s(94230);var v=s(30815),y=s(23936),j=s(95088),N=s(73579),w=s(96748),k=s(4823),C=s(28067),T=s(97677),A=s(51825),I=s(29366);s(76361),s(91450)},70217:(e,t,s)=>{"use strict";function r(e){return"error"===e||"expired"===e||"unavailable"===e||"reauth_required"===e||"invalid"===e}function a(e,t){return!1===e?"default":"active"===t||"success"===t?"success":r(t)?"error":"default"}s.d(t,{g:()=>a,t:()=>r})},93979:(e,t,s)=>{Promise.resolve().then(s.bind(s,18964))}},e=>{e.O(0,[2574,3862,782,8500,594,1321,4707,1330,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:()=>k});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(70217),h=s(38003);let f={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 g(){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 h=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=e?.unavailableCount||g.filter(e=>"available"!==e.status).length,v=0===b,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.jsxs)("div",{className:"relative",ref:p,children:[(0,r.jsxs)("button",{onClick:()=>o(!i),"aria-expanded":i,className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-all ${v?"bg-emerald-500/10 border-emerald-500/20 text-emerald-500 hover:bg-emerald-500/15":"bg-amber-500/10 border-amber-500/20 text-amber-500 hover:bg-amber-500/15"}`,children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:v?"verified":"warning"}),v?"All models operational":`${b} model${1!==b?"s":""} with issues`]}),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:v?"#22c55e":"#f59e0b"},children:v?"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:v?(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=f[e.status]||f.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:()=>h(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 b=s(78559);let v={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 j({variant:e,isOpen:t,onClose:s,onCreated:l}){let i=v[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)(""),[g,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,b.s)(`Error creating ${i.errorLabel} node:`,e),u("Network error")}finally{p(!1)}},$=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:g.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:g,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:$,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 N(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 w(e){return e?.allDisabled?2:e?.connected>0?0:1}function k({initialData:e}){let[t,s]=(0,a.useState)(e?.connections||[]),[l,i]=(0,a.useState)(e?.nodes||[]),[o,p]=(0,a.useState)(!e),[x,f]=(0,a.useState)(!1),[b,v]=(0,a.useState)(!1),[y,N]=(0,a.useState)(!1),[I,$]=(0,a.useState)(!1),[E,R]=(0,a.useState)(null),[S,O]=(0,a.useState)(null),P=(0,d.i)(),U=(0,h.C)(e=>e.query),_=(0,h.C)(e=>e.register),z=(0,h.C)(e=>e.unregister);(0,a.useEffect)(()=>(_("Search providers..."),()=>z()),[_,z]);let L=e=>!U.trim()||e.toLowerCase().includes(U.trim().toLowerCase()),M=(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=q(e,t),o=q(r,t),d=+(n.connected>0),c=+(o.connected>0);return d!==c?c-d:(s.name||"").localeCompare(a.name||"")}),F=(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){P.error("Failed to fetch provider data")}finally{p(!1)}},[P]);(0,a.useEffect)(()=>{e?.connections?p(!1):F()},[e,F]);let q=(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=>(0,u.t)(l(e))),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}},D=async(e,r,a)=>{let l=Array.isArray(r)?r:[r],i=t=>t.provider===e&&l.includes(t.authType),n=t.filter(i),o=new Map(n.map(e=>[e.id,e.isActive]));s(e=>e.map(e=>i(e)?{...e,isActive:a}:e));let d=(await Promise.allSettled(n.map(e=>fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:a})})))).filter(e=>"rejected"===e.status||!e.value?.ok).length;d>0&&(s(e=>e.map(e=>o.has(e.id)?{...e,isActive:o.get(e.id)}:e)),P.error(`Failed to ${a?"enable":"disable"} ${d} connection${1===d?"":"s"}`))},K=async(e,t=null)=>{if(!E){R("provider"===e?t:e),O(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(O(r),r.summary){let{passed:e,failed:t,total:s}=r.summary;0===t?P.success(`All ${s} tests passed`):P.warning(`${e}/${s} passed, ${t} failed`)}}catch(e){O({error:"Test request failed"}),P.error("Provider test failed")}finally{R(null)}}},B=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=>L(e.name)),H=l.filter(e=>"anthropic-compatible"===e.type).map(e=>({id:e.id,name:e.name||"Anthropic Compatible",color:"#D97757",textIcon:"AC"})).filter(e=>L(e.name)),J=M(Object.entries(c.zN).filter(([,e])=>!e.hidden&&L(e.name)),"oauth"),W=Object.entries(m.IS).filter(([,e])=>!e.hidden&&L(e.name)).sort(([,e],[,t])=>!!t.noAuth-!!e.noAuth),Q=M(Object.entries(m.nJ).filter(([,e])=>!e.hidden&&L(e.name)&&(e.serviceKinds??["llm"]).includes("llm")),"freeTier").sort(([,e],[,t])=>!!t.noAuth-!!e.noAuth),Z=Object.entries(c.fg).filter(([,e])=>!e.hidden&&(e.serviceKinds??["llm"]).includes("llm")&&L(e.name)).sort(([e,t],[s,r])=>{let a=w(q(e,"apikey")),l=w(q(s,"apikey"));return a!==l?a-l:(t.name||"").localeCompare(r.name||"")}),X=!!U.trim(),G=X||x?Z:Z.slice(0,20),V=Z.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 Y=!U.trim()||J.length>0||W.length>0||Q.length>0||Z.length>0||B.length>0||H.length>0;return(0,r.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[!Y&&(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"})]}),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:"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)(g,{}),(0,r.jsxs)("button",{onClick:()=>K("oauth"),disabled:!!E,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"===E?"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"===E?" animate-spin":""}`,children:"play_arrow"}),"oauth"===E?"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:J.map(([e,t])=>(0,r.jsx)(C,{providerId:e,provider:t,stats:q(e,"oauth"),authType:"oauth",onToggle:t=>D(e,"oauth",t)},e))})]}),(W.length>0||Q.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:()=>K("free"),disabled:!!E,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"===E?"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"===E?" animate-spin":""}`,children:"play_arrow"}),"free"===E?"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:[W.map(([e,t])=>{let s="kiro"===e?["oauth","apikey","api_key"]:"oauth";return(0,r.jsx)(C,{providerId:e,provider:t,stats:q(e,s),authType:"free",onToggle:t=>D(e,s,t)},e)}),Q.map(([e,t])=>(0,r.jsx)(T,{providerId:e,provider:t,stats:q(e,"apikey"),authType:"apikey",onToggle:t=>D(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:()=>$(e=>!e),className:"w-full sm:w-auto",children:"Add custom provider"}),I&&(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:()=>$(!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:()=>{$(!1),v(!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:()=>{$(!1),N(!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"})]})]})]})]})]}),Z.length>0&&(0,r.jsxs)("button",{onClick:()=>K("apikey"),disabled:!!E,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"===E?"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"===E?" animate-spin":""}`,children:"play_arrow"}),"apikey"===E?"Testing...":"Test All"]})]})]}),(B.length>0||H.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:[...B,...H].map(e=>(0,r.jsx)(T,{providerId:e.id,provider:e,stats:q(e.id,"apikey"),authType:"compatible",onToggle:t=>D(e.id,"apikey",t)},e.id))})]}),0===B.length&&0===H.length&&0===Z.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:()=>v(!0),children:"Add custom provider"})]}),G.length>0&&(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(B.length>0||H.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:G.map(([e,t])=>(0,r.jsx)(T,{providerId:e,provider:t,stats:q(e,"apikey"),authType:"apikey",onToggle:t=>D(e,"apikey",t)},e))})]}),!X&&!x&&V>0&&(0,r.jsxs)("button",{onClick:()=>f(!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 ",Z.length," providers"]})]}),(0,r.jsx)(j,{variant:"openai",isOpen:b,onClose:()=>v(!1),onCreated:e=>{i(t=>[...t,e]),v(!1)}}),(0,r.jsx)(j,{variant:"anthropic",isOpen:y,onClose:()=>N(!1),onCreated:e=>{i(t=>[...t,e]),N(!1)}}),S&&(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-start justify-center px-3 pt-[6vh] sm:pt-[10vh]",onClick:()=>O(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:()=>O(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)(A,{results:S})})]})]})]})}function C({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:[N(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 T({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:[N(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 A({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."})]})}j.propTypes={variant:i().oneOf(["openai","anthropic"]).isRequired,isOpen:i().bool.isRequired,onClose:i().func.isRequired,onCreated:i().func.isRequired},C.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},T.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},A.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}},35497:(e,t,s)=>{"use strict";s.d(t,{x0:()=>w.default,Ex:()=>d.default,$n:()=>r.default,nh:()=>I.default,Zp:()=>i.default,Qv:()=>o.CardSkeleton,CK:()=>u.default,uo:()=>n.ConfirmModal,G9:()=>v.default,wI:()=>N.default,vj:()=>j.default,vE:()=>y.default,pd:()=>a.default,Mh:()=>b.default,uR:()=>x.default,Nf:()=>h.default,aF:()=>n.default,rq:()=>p.default,gw:()=>k.default,LF:()=>m.default,Wx:()=>A.default,gM:()=>g.default,Iz:()=>C.default,l6:()=>l.default,lM:()=>c.default,m_:()=>T.default,jK:()=>f.default});var r=s(92542),a=s(11910),l=s(98),i=s(84588),n=s(81127),o=s(25086);s(56319);var d=s(56061),c=s(98542);s(61929),s(21110),s(92622),s(8823),s(92173);var m=s(90882),p=s(72908),x=s(28815),u=s(45455),h=s(28058),f=s(4809);s(21931),s(80752),s(40197);var g=s(23615);s(44736);var b=s(62899);s(94230);var v=s(30815),y=s(23936),j=s(95088),N=s(73579),w=s(96748),k=s(4823),C=s(28067),T=s(97677),A=s(51825),I=s(29366);s(76361),s(91450)},70217:(e,t,s)=>{"use strict";function r(e){return"error"===e||"expired"===e||"unavailable"===e||"reauth_required"===e||"invalid"===e}function a(e,t){return!1===e?"default":"active"===t||"success"===t?"success":r(t)?"error":"default"}s.d(t,{g:()=>a,t:()=>r})},93979:(e,t,s)=>{Promise.resolve().then(s.bind(s,18964))}},e=>{e.O(0,[2574,3862,782,8500,594,4601,1321,1330,8441,3794,7358],()=>e(e.s=93979)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7414],{35497:(e,t,s)=>{"use strict";s.d(t,{x0:()=>k.default,Ex:()=>n.default,$n:()=>a.default,nh:()=>$.default,Zp:()=>d.default,Qv:()=>o.CardSkeleton,CK:()=>h.default,uo:()=>i.ConfirmModal,G9:()=>b.default,wI:()=>v.default,vj:()=>y.default,vE:()=>N.default,pd:()=>l.default,Mh:()=>j.default,uR:()=>p.default,Nf:()=>u.default,aF:()=>i.default,rq:()=>m.default,gw:()=>w.default,LF:()=>c.default,Wx:()=>E.default,gM:()=>g.default,Iz:()=>P.default,l6:()=>r.default,lM:()=>x.default,m_:()=>S.default,jK:()=>f.default});var a=s(92542),l=s(11910),r=s(98),d=s(84588),i=s(81127),o=s(25086);s(56319);var n=s(56061),x=s(98542);s(61929),s(21110),s(92622),s(8823),s(92173);var c=s(90882),m=s(72908),p=s(28815),h=s(45455),u=s(28058),f=s(4809);s(21931),s(80752),s(40197);var g=s(23615);s(44736);var j=s(62899);s(94230);var b=s(30815),N=s(23936),y=s(95088),v=s(73579),k=s(96748),w=s(4823),P=s(28067),S=s(97677),E=s(51825),$=s(29366);s(76361),s(91450)},71470:(e,t,s)=>{"use strict";s.d(t,{default:()=>b});var a=s(95155),l=s(12115),r=s(21742),d=s(90639),i=s(28408),o=s(32539),n=s(59656),x=s(84420),c=s(19538),m=s(98500),p=s.n(m),h=s(35497);let u=e=>e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e||0),f=[{id:"today",label:"Today"},{id:"yesterday",label:"Yesterday"},{id:"last7d",label:"7 days"},{id:"last30d",label:"30 days"},{id:"all",label:"All time"}],g={applied:"Prompt exceeded threshold",below_threshold:"Below size threshold",not_profitable:"Compression not profitable",below_min_chars:"Below minimum chars",below_min_tokens:"Below minimum tokens",unsupported_model:"Model not in allowlist",unsupported_format:"Non-Claude request format",timeout:"Compression timed out",transform_error:"Transform error",passthrough:"Passthrough",disabled:"Disabled",not_installed:"Not installed"};function j({label:e,value:t,sub:s,tone:l}){return(0,a.jsxs)(h.Zp,{className:"p-4",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted uppercase tracking-wide",children:e}),(0,a.jsx)("p",{className:`text-xl font-semibold mt-1 ${l||""}`,children:t}),s&&(0,a.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:s})]})}function b(){let[e,t]=(0,l.useState)(null),[s,m]=(0,l.useState)(null),[b,N]=(0,l.useState)(null),[y,v]=(0,l.useState)(null),[k,w]=(0,l.useState)("last7d"),[P,S]=(0,l.useState)(!0),[E,$]=(0,l.useState)(""),C=(0,l.useCallback)(async()=>{S(!0);try{let[e,s,a]=await Promise.all([fetch("/api/pxpipe/status",{headers:{"Cache-Control":"no-store"}}),fetch("/api/pxpipe/stats"),fetch("/api/pxpipe/logs?limit=50")]);if(!e.ok||!s.ok||!a.ok)throw Error(`Failed to load PXPIPE data (HTTP ${e.status}/${s.status}/${a.status})`);t(await e.json()),N(await s.json()),v(await a.json());let l=await fetch("/api/pxpipe/health",{method:"POST"});if(!l.ok)throw Error(`PXPIPE health check failed (HTTP ${l.status})`);m(await l.json()),$("")}catch(e){$(e?.message||"Failed to load PXPIPE data"),t(null),N(null),v(null),m(null)}finally{S(!1)}},[]);(0,l.useEffect)(()=>{C()},[C]);let _=b?.windows?.[k],M=e?e.installed?s?.healthy?"Healthy":e.running?"Running":"Stopped":"Not installed":"—";return(0,a.jsxs)("div",{className:"space-y-6 p-6",children:[E&&(0,a.jsx)("div",{role:"alert",className:"border border-red-300 bg-red-500/10 rounded-lg px-3 py-2 text-sm text-red-600 dark:text-red-400",children:E}),(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"image"}),"PXPIPE Dashboard"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(p(),{href:"/dashboard/token-saver",className:"text-xs text-primary underline hover:opacity-80",children:"Token Saver settings"}),(0,a.jsx)(h.$n,{size:"sm",variant:"ghost",onClick:C,disabled:P,children:P?"Refreshing…":"Refresh"})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:[(0,a.jsx)(j,{label:"Status",value:M,tone:s?.healthy?"text-success":e?.installed?"text-warning":"text-text-muted",sub:e?.enabled?"Enabled in pipeline":"Disabled in pipeline"}),(0,a.jsx)(j,{label:"Version",value:e?.version?`v${e.version}`:"—",sub:"pxpipe-proxy"}),(0,a.jsx)(j,{label:"Uptime",value:(e=>{if(!e||e<=0)return"—";let t=Math.floor(e/6e4),s=Math.floor(t/60);return s>0?`${s}h${String(t%60).padStart(2,"0")}m`:`${t}m`})(e?.uptimeMs),sub:"module loaded"}),(0,a.jsx)(j,{label:"Requests",value:_?_.requests.toLocaleString():"—"}),(0,a.jsx)(j,{label:"Compressed",value:_?_.compressed.toLocaleString():"—",tone:"text-success"}),(0,a.jsx)(j,{label:"Bypassed",value:_?_.bypassed.toLocaleString():"—"})]}),(0,a.jsxs)(h.Zp,{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3 mb-4",children:[(0,a.jsx)("h3",{className:"font-medium",children:"Token savings (estimated)"}),(0,a.jsx)("div",{className:"flex items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1",children:f.map(e=>(0,a.jsx)("button",{onClick:()=>w(e.id),className:`px-3 py-1 rounded-md text-xs font-medium transition-colors ${k===e.id?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:e.label},e.id))})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-center",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Original tokens"}),(0,a.jsx)("p",{className:"text-lg font-semibold",children:_?u(_.tokensBeforeEst):"—"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"After PXPIPE"}),(0,a.jsx)("p",{className:"text-lg font-semibold",children:_?u(_.tokensAfterEst):"—"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Saved"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-success",children:_?u(_.tokensSavedEst):"—"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Reduction"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-success",children:_?`${_.savedPct}%`:"—"})]})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-3",children:["Estimates from body size before/after imaging; billed usage per request (recorded on the Usage page) remains the ground truth. Images generated:"," ",_?_.imagesGenerated.toLocaleString():"—"," \xb7 avg compression time:"," ",_?`${_.avgCompressionMs}ms`:"—"," \xb7 errors: ",_?_.errors:"—"]})]}),(0,a.jsxs)(h.Zp,{className:"p-4",children:[(0,a.jsx)("h3",{className:"font-medium mb-3",children:"Tokens saved — last 30 days"}),b?.timeline?.some(e=>e.tokensSavedEst>0)?(0,a.jsx)(r.u,{width:"100%",height:220,children:(0,a.jsxs)(d.Q,{data:b.timeline,margin:{top:4,right:8,left:0,bottom:0},children:[(0,a.jsx)("defs",{children:(0,a.jsxs)("linearGradient",{id:"gradPxpipe",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"5%",stopColor:"#10b981",stopOpacity:.25}),(0,a.jsx)("stop",{offset:"95%",stopColor:"#10b981",stopOpacity:0})]})}),(0,a.jsx)(i.d,{strokeDasharray:"3 3",strokeOpacity:.2}),(0,a.jsx)(o.W,{dataKey:"date",tick:{fontSize:11},tickFormatter:e=>e.slice(5)}),(0,a.jsx)(n.h,{tick:{fontSize:11},tickFormatter:u,width:48}),(0,a.jsx)(x.m,{formatter:e=>[u(e),"Tokens saved"],labelFormatter:e=>e}),(0,a.jsx)(c.Gk,{type:"monotone",dataKey:"tokensSavedEst",stroke:"#10b981",fill:"url(#gradPxpipe)",strokeWidth:2})]})}):(0,a.jsx)("div",{className:"h-32 flex items-center justify-center text-text-muted text-sm",children:"No savings recorded yet — enable PXPIPE in the Token Saver and route a large Claude-format request."})]}),(0,a.jsxs)(h.Zp,{className:"p-4",children:[(0,a.jsx)("h3",{className:"font-medium mb-3",children:"History"}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"text-left text-xs text-text-muted border-b border-border",children:[(0,a.jsx)("th",{className:"py-2 pr-3",children:"Time"}),(0,a.jsx)("th",{className:"py-2 pr-3",children:"Model"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"Original"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"Compressed"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"Saved"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"%"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"Duration"}),(0,a.jsx)("th",{className:"py-2",children:"Status"})]})}),(0,a.jsxs)("tbody",{children:[(b?.recent||[]).slice(0,50).map((e,t)=>(0,a.jsxs)("tr",{className:"border-b border-border/50",children:[(0,a.jsx)("td",{className:"py-1.5 pr-3 whitespace-nowrap text-text-muted",children:new Date(e.ts).toLocaleString()}),(0,a.jsx)("td",{className:"py-1.5 pr-3 font-mono text-xs",children:e.provider?`${e.provider}/${e.model}`:e.model||"—"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs",children:e.applied?u(e.tokensBeforeEst||0):"—"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs",children:e.applied?u(e.tokensAfterEst||0):"—"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs text-success",children:e.applied?u(e.tokensSavedEst||0):"—"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs",children:e.applied?`${e.savedPct}%`:"—"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs",children:null!=e.durationMs?`${e.durationMs}ms`:"—"}),(0,a.jsx)("td",{className:"py-1.5",children:(0,a.jsx)("span",{className:`text-xs px-2 py-0.5 rounded ${e.applied?"bg-success/15 text-success":"transform_error"===e.reason||"timeout"===e.reason?"bg-danger/15 text-danger":"bg-warning/15 text-warning"}`,title:e.detail||"",children:e.applied?"Compressed":g[e.reason]||e.reason||"Skipped"})})]},`${e.ts}-${t}`)),(!b?.recent||0===b.recent.length)&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:8,className:"py-6 text-center text-text-muted text-sm",children:"No PXPIPE activity yet"})})]})]})})]}),(0,a.jsxs)(h.Zp,{className:"p-4",id:"logs",children:[(0,a.jsx)("h3",{className:"font-medium mb-3",children:"PXPIPE Logs"}),y?.installLog?(0,a.jsx)("pre",{className:"rounded bg-black/5 dark:bg-white/5 p-3 text-xs font-mono overflow-x-auto max-h-64 overflow-y-auto whitespace-pre-wrap",children:y.installLog}):(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No install log yet."})]})]})}},91710:(e,t,s)=>{Promise.resolve().then(s.bind(s,71470))}},e=>{e.O(0,[2574,3862,782,8500,594,1321,4707,1330,8441,3794,7358],()=>e(e.s=91710)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7414],{35497:(e,t,s)=>{"use strict";s.d(t,{x0:()=>k.default,Ex:()=>n.default,$n:()=>a.default,nh:()=>$.default,Zp:()=>d.default,Qv:()=>o.CardSkeleton,CK:()=>h.default,uo:()=>i.ConfirmModal,G9:()=>b.default,wI:()=>v.default,vj:()=>y.default,vE:()=>N.default,pd:()=>l.default,Mh:()=>j.default,uR:()=>p.default,Nf:()=>u.default,aF:()=>i.default,rq:()=>m.default,gw:()=>w.default,LF:()=>c.default,Wx:()=>E.default,gM:()=>g.default,Iz:()=>P.default,l6:()=>r.default,lM:()=>x.default,m_:()=>S.default,jK:()=>f.default});var a=s(92542),l=s(11910),r=s(98),d=s(84588),i=s(81127),o=s(25086);s(56319);var n=s(56061),x=s(98542);s(61929),s(21110),s(92622),s(8823),s(92173);var c=s(90882),m=s(72908),p=s(28815),h=s(45455),u=s(28058),f=s(4809);s(21931),s(80752),s(40197);var g=s(23615);s(44736);var j=s(62899);s(94230);var b=s(30815),N=s(23936),y=s(95088),v=s(73579),k=s(96748),w=s(4823),P=s(28067),S=s(97677),E=s(51825),$=s(29366);s(76361),s(91450)},71470:(e,t,s)=>{"use strict";s.d(t,{default:()=>b});var a=s(95155),l=s(12115),r=s(21742),d=s(90639),i=s(28408),o=s(32539),n=s(59656),x=s(84420),c=s(19538),m=s(98500),p=s.n(m),h=s(35497);let u=e=>e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e||0),f=[{id:"today",label:"Today"},{id:"yesterday",label:"Yesterday"},{id:"last7d",label:"7 days"},{id:"last30d",label:"30 days"},{id:"all",label:"All time"}],g={applied:"Prompt exceeded threshold",below_threshold:"Below size threshold",not_profitable:"Compression not profitable",below_min_chars:"Below minimum chars",below_min_tokens:"Below minimum tokens",unsupported_model:"Model not in allowlist",unsupported_format:"Non-Claude request format",timeout:"Compression timed out",transform_error:"Transform error",passthrough:"Passthrough",disabled:"Disabled",not_installed:"Not installed"};function j({label:e,value:t,sub:s,tone:l}){return(0,a.jsxs)(h.Zp,{className:"p-4",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted uppercase tracking-wide",children:e}),(0,a.jsx)("p",{className:`text-xl font-semibold mt-1 ${l||""}`,children:t}),s&&(0,a.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:s})]})}function b(){let[e,t]=(0,l.useState)(null),[s,m]=(0,l.useState)(null),[b,N]=(0,l.useState)(null),[y,v]=(0,l.useState)(null),[k,w]=(0,l.useState)("last7d"),[P,S]=(0,l.useState)(!0),[E,$]=(0,l.useState)(""),C=(0,l.useCallback)(async()=>{S(!0);try{let[e,s,a]=await Promise.all([fetch("/api/pxpipe/status",{headers:{"Cache-Control":"no-store"}}),fetch("/api/pxpipe/stats"),fetch("/api/pxpipe/logs?limit=50")]);if(!e.ok||!s.ok||!a.ok)throw Error(`Failed to load PXPIPE data (HTTP ${e.status}/${s.status}/${a.status})`);t(await e.json()),N(await s.json()),v(await a.json());let l=await fetch("/api/pxpipe/health",{method:"POST"});if(!l.ok)throw Error(`PXPIPE health check failed (HTTP ${l.status})`);m(await l.json()),$("")}catch(e){$(e?.message||"Failed to load PXPIPE data"),t(null),N(null),v(null),m(null)}finally{S(!1)}},[]);(0,l.useEffect)(()=>{C()},[C]);let _=b?.windows?.[k],M=e?e.installed?s?.healthy?"Healthy":e.running?"Running":"Stopped":"Not installed":"—";return(0,a.jsxs)("div",{className:"space-y-6 p-6",children:[E&&(0,a.jsx)("div",{role:"alert",className:"border border-red-300 bg-red-500/10 rounded-lg px-3 py-2 text-sm text-red-600 dark:text-red-400",children:E}),(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"image"}),"PXPIPE Dashboard"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(p(),{href:"/dashboard/token-saver",className:"text-xs text-primary underline hover:opacity-80",children:"Token Saver settings"}),(0,a.jsx)(h.$n,{size:"sm",variant:"ghost",onClick:C,disabled:P,children:P?"Refreshing…":"Refresh"})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:[(0,a.jsx)(j,{label:"Status",value:M,tone:s?.healthy?"text-success":e?.installed?"text-warning":"text-text-muted",sub:e?.enabled?"Enabled in pipeline":"Disabled in pipeline"}),(0,a.jsx)(j,{label:"Version",value:e?.version?`v${e.version}`:"—",sub:"pxpipe-proxy"}),(0,a.jsx)(j,{label:"Uptime",value:(e=>{if(!e||e<=0)return"—";let t=Math.floor(e/6e4),s=Math.floor(t/60);return s>0?`${s}h${String(t%60).padStart(2,"0")}m`:`${t}m`})(e?.uptimeMs),sub:"module loaded"}),(0,a.jsx)(j,{label:"Requests",value:_?_.requests.toLocaleString():"—"}),(0,a.jsx)(j,{label:"Compressed",value:_?_.compressed.toLocaleString():"—",tone:"text-success"}),(0,a.jsx)(j,{label:"Bypassed",value:_?_.bypassed.toLocaleString():"—"})]}),(0,a.jsxs)(h.Zp,{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3 mb-4",children:[(0,a.jsx)("h3",{className:"font-medium",children:"Token savings (estimated)"}),(0,a.jsx)("div",{className:"flex items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1",children:f.map(e=>(0,a.jsx)("button",{onClick:()=>w(e.id),className:`px-3 py-1 rounded-md text-xs font-medium transition-colors ${k===e.id?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:e.label},e.id))})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-center",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Original tokens"}),(0,a.jsx)("p",{className:"text-lg font-semibold",children:_?u(_.tokensBeforeEst):"—"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"After PXPIPE"}),(0,a.jsx)("p",{className:"text-lg font-semibold",children:_?u(_.tokensAfterEst):"—"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Saved"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-success",children:_?u(_.tokensSavedEst):"—"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Reduction"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-success",children:_?`${_.savedPct}%`:"—"})]})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-3",children:["Estimates from body size before/after imaging; billed usage per request (recorded on the Usage page) remains the ground truth. Images generated:"," ",_?_.imagesGenerated.toLocaleString():"—"," \xb7 avg compression time:"," ",_?`${_.avgCompressionMs}ms`:"—"," \xb7 errors: ",_?_.errors:"—"]})]}),(0,a.jsxs)(h.Zp,{className:"p-4",children:[(0,a.jsx)("h3",{className:"font-medium mb-3",children:"Tokens saved — last 30 days"}),b?.timeline?.some(e=>e.tokensSavedEst>0)?(0,a.jsx)(r.u,{width:"100%",height:220,children:(0,a.jsxs)(d.Q,{data:b.timeline,margin:{top:4,right:8,left:0,bottom:0},children:[(0,a.jsx)("defs",{children:(0,a.jsxs)("linearGradient",{id:"gradPxpipe",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"5%",stopColor:"#10b981",stopOpacity:.25}),(0,a.jsx)("stop",{offset:"95%",stopColor:"#10b981",stopOpacity:0})]})}),(0,a.jsx)(i.d,{strokeDasharray:"3 3",strokeOpacity:.2}),(0,a.jsx)(o.W,{dataKey:"date",tick:{fontSize:11},tickFormatter:e=>e.slice(5)}),(0,a.jsx)(n.h,{tick:{fontSize:11},tickFormatter:u,width:48}),(0,a.jsx)(x.m,{formatter:e=>[u(e),"Tokens saved"],labelFormatter:e=>e}),(0,a.jsx)(c.Gk,{type:"monotone",dataKey:"tokensSavedEst",stroke:"#10b981",fill:"url(#gradPxpipe)",strokeWidth:2})]})}):(0,a.jsx)("div",{className:"h-32 flex items-center justify-center text-text-muted text-sm",children:"No savings recorded yet — enable PXPIPE in the Token Saver and route a large Claude-format request."})]}),(0,a.jsxs)(h.Zp,{className:"p-4",children:[(0,a.jsx)("h3",{className:"font-medium mb-3",children:"History"}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"text-left text-xs text-text-muted border-b border-border",children:[(0,a.jsx)("th",{className:"py-2 pr-3",children:"Time"}),(0,a.jsx)("th",{className:"py-2 pr-3",children:"Model"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"Original"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"Compressed"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"Saved"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"%"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"Duration"}),(0,a.jsx)("th",{className:"py-2",children:"Status"})]})}),(0,a.jsxs)("tbody",{children:[(b?.recent||[]).slice(0,50).map((e,t)=>(0,a.jsxs)("tr",{className:"border-b border-border/50",children:[(0,a.jsx)("td",{className:"py-1.5 pr-3 whitespace-nowrap text-text-muted",children:new Date(e.ts).toLocaleString()}),(0,a.jsx)("td",{className:"py-1.5 pr-3 font-mono text-xs",children:e.provider?`${e.provider}/${e.model}`:e.model||"—"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs",children:e.applied?u(e.tokensBeforeEst||0):"—"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs",children:e.applied?u(e.tokensAfterEst||0):"—"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs text-success",children:e.applied?u(e.tokensSavedEst||0):"—"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs",children:e.applied?`${e.savedPct}%`:"—"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs",children:null!=e.durationMs?`${e.durationMs}ms`:"—"}),(0,a.jsx)("td",{className:"py-1.5",children:(0,a.jsx)("span",{className:`text-xs px-2 py-0.5 rounded ${e.applied?"bg-success/15 text-success":"transform_error"===e.reason||"timeout"===e.reason?"bg-danger/15 text-danger":"bg-warning/15 text-warning"}`,title:e.detail||"",children:e.applied?"Compressed":g[e.reason]||e.reason||"Skipped"})})]},`${e.ts}-${t}`)),(!b?.recent||0===b.recent.length)&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:8,className:"py-6 text-center text-text-muted text-sm",children:"No PXPIPE activity yet"})})]})]})})]}),(0,a.jsxs)(h.Zp,{className:"p-4",id:"logs",children:[(0,a.jsx)("h3",{className:"font-medium mb-3",children:"PXPIPE Logs"}),y?.installLog?(0,a.jsx)("pre",{className:"rounded bg-black/5 dark:bg-white/5 p-3 text-xs font-mono overflow-x-auto max-h-64 overflow-y-auto whitespace-pre-wrap",children:y.installLog}):(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No install log yet."})]})]})}},91710:(e,t,s)=>{Promise.resolve().then(s.bind(s,71470))}},e=>{e.O(0,[2574,3862,782,8500,594,4601,1321,1330,8441,3794,7358],()=>e(e.s=91710)),_N_E=e.O()}]);