cartethyia 2.4.5 → 2.4.6

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 (303) hide show
  1. package/.env.example +4 -1
  2. package/README.md +18 -0
  3. package/dist/dashboard/assets/AccountCooldown-ChpdzxRH.js.gz +0 -0
  4. package/dist/dashboard/assets/{BannedPage-DUrXpp-X.js → BannedPage-QhvbJB9o.js} +1 -1
  5. package/dist/dashboard/assets/BannedPage-QhvbJB9o.js.gz +0 -0
  6. package/dist/dashboard/assets/{CliToolDetailPage-BzGevuql.js → CliToolDetailPage-Bcy150Jo.js} +1 -1
  7. package/dist/dashboard/assets/CliToolDetailPage-Bcy150Jo.js.gz +0 -0
  8. package/dist/dashboard/assets/{CliToolsPage-BaRM_7We.js → CliToolsPage-DyNXefph.js} +1 -1
  9. package/dist/dashboard/assets/CliToolsPage-DyNXefph.js.gz +0 -0
  10. package/dist/dashboard/assets/CombosPage-Cak0ljnO.js +1 -0
  11. package/dist/dashboard/assets/CombosPage-Cak0ljnO.js.gz +0 -0
  12. package/dist/dashboard/assets/ConsoleLogPage-CATpAEOz.js +1 -0
  13. package/dist/dashboard/assets/ConsoleLogPage-CATpAEOz.js.gz +0 -0
  14. package/dist/dashboard/assets/{CustomizationPage-DqUGcoH0.js → CustomizationPage-D6jEU7nL.js} +1 -1
  15. package/dist/dashboard/assets/CustomizationPage-D6jEU7nL.js.gz +0 -0
  16. package/dist/dashboard/assets/HealthEventsModal-CZkpn0a7.js +1 -0
  17. package/dist/dashboard/assets/HealthEventsModal-CZkpn0a7.js.gz +0 -0
  18. package/dist/dashboard/assets/{LoginPage-DbhTGfhb.js → LoginPage-BJlMVN4U.js} +1 -1
  19. package/dist/dashboard/assets/LoginPage-BJlMVN4U.js.gz +0 -0
  20. package/dist/dashboard/assets/ModelPicker-Br3CXEau.js +1 -0
  21. package/dist/dashboard/assets/ModelPicker-Br3CXEau.js.gz +0 -0
  22. package/dist/dashboard/assets/{OverviewPage-C3NIzsDx.js → OverviewPage-CQxXbo2g.js} +1 -1
  23. package/dist/dashboard/assets/OverviewPage-CQxXbo2g.js.gz +0 -0
  24. package/dist/dashboard/assets/ProviderDetailPage--0RBNh99.js +3 -0
  25. package/dist/dashboard/assets/ProviderDetailPage--0RBNh99.js.gz +0 -0
  26. package/dist/dashboard/assets/ProviderIcon-paOCq8I0.js.gz +0 -0
  27. package/dist/dashboard/assets/ProvidersPage-1M-C3mbu.js +1 -0
  28. package/dist/dashboard/assets/ProvidersPage-1M-C3mbu.js.gz +0 -0
  29. package/dist/dashboard/assets/ProxyPage-CXiumA53.js +7 -0
  30. package/dist/dashboard/assets/ProxyPage-CXiumA53.js.gz +0 -0
  31. package/dist/dashboard/assets/QuotaPage-BGDIfIYP.js +1 -0
  32. package/dist/dashboard/assets/QuotaPage-BGDIfIYP.js.gz +0 -0
  33. package/dist/dashboard/assets/{SettingsPage-YxRml8AT.js → SettingsPage-BHW4Zt06.js} +1 -1
  34. package/dist/dashboard/assets/SettingsPage-BHW4Zt06.js.gz +0 -0
  35. package/dist/dashboard/assets/SetupPage-VOYC_lIa.js +1 -0
  36. package/dist/dashboard/assets/SetupPage-VOYC_lIa.js.gz +0 -0
  37. package/dist/dashboard/assets/SortableList-DpOTnGuH.js +1 -0
  38. package/dist/dashboard/assets/SortableList-DpOTnGuH.js.gz +0 -0
  39. package/dist/dashboard/assets/StudioPage-BNIDLiU6.js +31 -0
  40. package/dist/dashboard/assets/StudioPage-BNIDLiU6.js.gz +0 -0
  41. package/dist/dashboard/assets/ToolIcon-K1ckcDKg.js.gz +0 -0
  42. package/dist/dashboard/assets/{UsagePage-Djes-Epy.js → UsagePage-BAFaSDQV.js} +14 -14
  43. package/dist/dashboard/assets/UsagePage-BAFaSDQV.js.gz +0 -0
  44. package/dist/dashboard/assets/api-keys-BETfaMYZ.js +1 -0
  45. package/dist/dashboard/assets/api-keys-BETfaMYZ.js.gz +0 -0
  46. package/dist/dashboard/assets/app-BLCvGdzb.css +2 -0
  47. package/dist/dashboard/assets/app-BLCvGdzb.css.gz +0 -0
  48. package/dist/dashboard/assets/{app-BDJWMThu.js → app-Cjq7nrwu.js} +3 -3
  49. package/dist/dashboard/assets/app-Cjq7nrwu.js.gz +0 -0
  50. package/dist/dashboard/assets/arrow-left-CpBxkoxI.js.gz +0 -0
  51. package/dist/dashboard/assets/arrow-right-Dl5yKnp8.js.gz +0 -0
  52. package/dist/dashboard/assets/{assert-Bwh6DJTK.js → assert-7J6_LVD3.js} +1 -1
  53. package/dist/dashboard/assets/assert-7J6_LVD3.js.gz +0 -0
  54. package/dist/dashboard/assets/backup-file-gdKIlg8U.js.gz +0 -0
  55. package/dist/dashboard/assets/{badge-BwmwEOgA.js → badge-BTyGk_DL.js} +1 -1
  56. package/dist/dashboard/assets/badge-BTyGk_DL.js.gz +0 -0
  57. package/dist/dashboard/assets/{banner-BKBfKTqn.js → banner-bujTWYM4.js} +1 -1
  58. package/dist/dashboard/assets/banner-bujTWYM4.js.gz +0 -0
  59. package/dist/dashboard/assets/brain-Cwed_72z.js.gz +0 -0
  60. package/dist/dashboard/assets/{card-BTdbRFFg.js → card-B0Bnx5CA.js} +1 -1
  61. package/dist/dashboard/assets/card-B0Bnx5CA.js.gz +0 -0
  62. package/dist/dashboard/assets/check-D69FzdvC.js.gz +0 -0
  63. package/dist/dashboard/assets/chevron-right-BXIy5l3h.js.gz +0 -0
  64. package/dist/dashboard/assets/circle-alert-CntYHV5v.js.gz +0 -0
  65. package/dist/dashboard/assets/circle-check-BU3v_mFW.js.gz +0 -0
  66. package/dist/dashboard/assets/cli-tools-DE2ug812.js +1 -0
  67. package/dist/dashboard/assets/cli-tools-DE2ug812.js.gz +0 -0
  68. package/dist/dashboard/assets/clipboard-button-R_rArH8S.js +1 -0
  69. package/dist/dashboard/assets/clipboard-button-R_rArH8S.js.gz +0 -0
  70. package/dist/dashboard/assets/cog-CdWhsajs.js.gz +0 -0
  71. package/dist/dashboard/assets/copy-ngmQ9zcZ.js.gz +0 -0
  72. package/dist/dashboard/assets/{dialog-iocKA3jr.js → dialog-BWIP_EvW.js} +1 -1
  73. package/dist/dashboard/assets/dialog-BWIP_EvW.js.gz +0 -0
  74. package/dist/dashboard/assets/dialog-actions-B1axpEg7.js.gz +0 -0
  75. package/dist/dashboard/assets/download-A0SW9OCW.js.gz +0 -0
  76. package/dist/dashboard/assets/download-dRFo5_Wu.js.gz +0 -0
  77. package/dist/dashboard/assets/{drawer-CDKOTZdY.js → drawer-BKcgVugF.js} +1 -1
  78. package/dist/dashboard/assets/drawer-BKcgVugF.js.gz +0 -0
  79. package/dist/dashboard/assets/entry-7dpgvpJ3.js +4 -0
  80. package/dist/dashboard/assets/entry-7dpgvpJ3.js.gz +0 -0
  81. package/dist/dashboard/assets/entry-CcWkGR4a.js +1 -0
  82. package/dist/dashboard/assets/entry-CcWkGR4a.js.gz +0 -0
  83. package/dist/dashboard/assets/entry-kTiTFrvh.js +1 -0
  84. package/dist/dashboard/assets/entry-kTiTFrvh.js.gz +0 -0
  85. package/dist/dashboard/assets/eye-C_hawfH4.js.gz +0 -0
  86. package/dist/dashboard/assets/eye-off-Bk5g2luF.js.gz +0 -0
  87. package/dist/dashboard/assets/fingerprint-pattern-BWuHtbW4.js.gz +0 -0
  88. package/dist/dashboard/assets/gauge-BbIMy7MB.js.gz +0 -0
  89. package/dist/dashboard/assets/github-badge-Booc5mNe.js +1 -0
  90. package/dist/dashboard/assets/github-badge-Booc5mNe.js.gz +0 -0
  91. package/dist/dashboard/assets/image-BPaouViG.js.gz +0 -0
  92. package/dist/dashboard/assets/{index-C4hXfAMs.js → index-D70pChfn.js} +2 -2
  93. package/dist/dashboard/assets/index-D70pChfn.js.gz +0 -0
  94. package/dist/dashboard/assets/{inline-DCejSLlA.js → inline-D1TCqM2D.js} +1 -1
  95. package/dist/dashboard/assets/inline-D1TCqM2D.js.gz +0 -0
  96. package/dist/dashboard/assets/{input-Bn4_kNav.js → input-B9oyU93y.js} +1 -1
  97. package/dist/dashboard/assets/input-B9oyU93y.js.gz +0 -0
  98. package/dist/dashboard/assets/jsx-runtime-CXUMngI_.js.gz +0 -0
  99. package/dist/dashboard/assets/key-round-UkavsGxp.js.gz +0 -0
  100. package/dist/dashboard/assets/layers-2-glBbjl.js.gz +0 -0
  101. package/dist/dashboard/assets/{layout-Bv-NxqZ5.js → layout-BArzXirQ.js} +1 -1
  102. package/dist/dashboard/assets/layout-BArzXirQ.js.gz +0 -0
  103. package/dist/dashboard/assets/{list-row-BLA0sldD.js → list-row-BVZzaoHF.js} +1 -1
  104. package/dist/dashboard/assets/list-row-BVZzaoHF.js.gz +0 -0
  105. package/dist/dashboard/assets/{live-YlifPYox.js → live-EmuIayqp.js} +1 -1
  106. package/dist/dashboard/assets/live-EmuIayqp.js.gz +0 -0
  107. package/dist/dashboard/assets/log-in-BmRjy60c.js.gz +0 -0
  108. package/dist/dashboard/assets/message-circle-CCxGwRvv.js.gz +0 -0
  109. package/dist/dashboard/assets/{model-bans-CVvHZ-qz.js → model-bans-CSPQ9xB0.js} +1 -1
  110. package/dist/dashboard/assets/model-bans-CSPQ9xB0.js.gz +0 -0
  111. package/dist/dashboard/assets/mutation-BkoLM5Ba.js +1 -0
  112. package/dist/dashboard/assets/mutation-BkoLM5Ba.js.gz +0 -0
  113. package/dist/dashboard/assets/numbers-CFL4_Dqc.js.gz +0 -0
  114. package/dist/dashboard/assets/pencil-768ysRAr.js.gz +0 -0
  115. package/dist/dashboard/assets/plus-DIdX_g-x.js.gz +0 -0
  116. package/dist/dashboard/assets/power-off-Yjw9GMJh.js +1 -0
  117. package/dist/dashboard/assets/power-off-Yjw9GMJh.js.gz +0 -0
  118. package/dist/dashboard/assets/privacy-mode-GM8bej85.js +1 -0
  119. package/dist/dashboard/assets/privacy-mode-GM8bej85.js.gz +0 -0
  120. package/dist/dashboard/assets/providers/agentrouter.svg.gz +0 -0
  121. package/dist/dashboard/assets/providers/aihubmix.svg.gz +0 -0
  122. package/dist/dashboard/assets/providers/alibaba-coding-plan.svg.gz +0 -0
  123. package/dist/dashboard/assets/providers/alibaba.svg.gz +0 -0
  124. package/dist/dashboard/assets/providers/antigravity.svg.gz +0 -0
  125. package/dist/dashboard/assets/providers/bai.svg.gz +0 -0
  126. package/dist/dashboard/assets/providers/blackbox.svg.gz +0 -0
  127. package/dist/dashboard/assets/providers/claude-code.svg.gz +0 -0
  128. package/dist/dashboard/assets/providers/exa.svg.gz +0 -0
  129. package/dist/dashboard/assets/providers/gmi-cloud.svg.gz +0 -0
  130. package/dist/dashboard/assets/providers/inferhub.svg.gz +0 -0
  131. package/dist/dashboard/assets/providers/muse.svg.gz +0 -0
  132. package/dist/dashboard/assets/providers/nous-research.svg.gz +0 -0
  133. package/dist/dashboard/assets/providers/openai-light.svg.gz +0 -0
  134. package/dist/dashboard/assets/providers/parallel.svg.gz +0 -0
  135. package/dist/dashboard/assets/providers/tokenharbor.svg.gz +0 -0
  136. package/dist/dashboard/assets/providers/zai-coding-plan.svg.gz +0 -0
  137. package/dist/dashboard/assets/{query-keys-ROf-g1Wi.js → query-keys-D7wX2vM5.js} +1 -1
  138. package/dist/dashboard/assets/query-keys-D7wX2vM5.js.gz +0 -0
  139. package/dist/dashboard/assets/quota-DZGyp0N5.js.gz +0 -0
  140. package/dist/dashboard/assets/refresh-cw-BqJFk4sU.js.gz +0 -0
  141. package/dist/dashboard/assets/rotate-ccw-CufcqITi.js.gz +0 -0
  142. package/dist/dashboard/assets/route-CNSNj9Zm.js.gz +0 -0
  143. package/dist/dashboard/assets/{routing-jntw9-Ui.js → routing-BExgxxBU.js} +1 -1
  144. package/dist/dashboard/assets/routing-BExgxxBU.js.gz +0 -0
  145. package/dist/dashboard/assets/scaling-nWE4Cx8f.js.gz +0 -0
  146. package/dist/dashboard/assets/search-JOKus9rb.js.gz +0 -0
  147. package/dist/dashboard/assets/{select-CGUuTQmj.js → select-C9mMoEpJ.js} +1 -1
  148. package/dist/dashboard/assets/select-C9mMoEpJ.js.gz +0 -0
  149. package/dist/dashboard/assets/settings-C4_Gn_wq.js +1 -0
  150. package/dist/dashboard/assets/settings-C4_Gn_wq.js.gz +0 -0
  151. package/dist/dashboard/assets/shield-check-DVS0Foqh.js.gz +0 -0
  152. package/dist/dashboard/assets/sliders-horizontal-ClG7dBeJ.js.gz +0 -0
  153. package/dist/dashboard/assets/sparkles-BRaRUxAU.js.gz +0 -0
  154. package/dist/dashboard/assets/{stack-C1kTcOmP.js → stack-Ca5HxI5i.js} +1 -1
  155. package/dist/dashboard/assets/stack-Ca5HxI5i.js.gz +0 -0
  156. package/dist/dashboard/assets/{state-DHKdg-pm.js → state-CzUPfLXo.js} +1 -1
  157. package/dist/dashboard/assets/state-CzUPfLXo.js.gz +0 -0
  158. package/dist/dashboard/assets/stream-retry-5QnVuSSo.js.gz +0 -0
  159. package/dist/dashboard/assets/{switch-DIDeAiz9.js → switch-DOUIky_i.js} +1 -1
  160. package/dist/dashboard/assets/switch-DOUIky_i.js.gz +0 -0
  161. package/dist/dashboard/assets/terminal-Bd4ee8TA.js +1 -0
  162. package/dist/dashboard/assets/terminal-Bd4ee8TA.js.gz +0 -0
  163. package/dist/dashboard/assets/toast-C76WrMhc.js +2 -0
  164. package/dist/dashboard/assets/toast-C76WrMhc.js.gz +0 -0
  165. package/dist/dashboard/assets/tokens-DDxMbSRL.js.gz +0 -0
  166. package/dist/dashboard/assets/trash-Cppn5c3R.js.gz +0 -0
  167. package/dist/dashboard/assets/use-clipboard-B0Sy03fE.js.gz +0 -0
  168. package/dist/dashboard/assets/use-presence-BSZEBx7U.js.gz +0 -0
  169. package/dist/dashboard/assets/use-reduced-motion-C4B0R6Sz.js.gz +0 -0
  170. package/dist/dashboard/assets/use-timeout-BwcBBRrT.js.gz +0 -0
  171. package/dist/dashboard/assets/{useMutation-DVmwOKU-.js → useMutation-D87FZwH0.js} +1 -1
  172. package/dist/dashboard/assets/useMutation-D87FZwH0.js.gz +0 -0
  173. package/dist/dashboard/assets/wrench-B6E1oEuY.js.gz +0 -0
  174. package/dist/dashboard/index.html +1 -1
  175. package/dist/dashboard/index.html.gz +0 -0
  176. package/dist/dashboard/precompressed-assets.json +123 -0
  177. package/migrations/full-postgres/0013_add_providers_tenant_id_index.sql +22 -0
  178. package/migrations/full-postgres/0014_add_provider_accounts_tenant_id_index.sql +21 -0
  179. package/migrations/lite-sqlite3/0000_baseline.sql +4 -2
  180. package/migrations/lite-sqlite3/0013_add_providers_tenant_id_index.sql +4 -0
  181. package/migrations/lite-sqlite3/0014_add_provider_accounts_tenant_id_index.sql +4 -0
  182. package/package.json +25 -30
  183. package/scripts/cli/{carte-launcher.cjs → bin/carte.cjs} +8 -8
  184. package/scripts/cli/{cli-launcher.cjs → bin/cartethyia.cjs} +167 -134
  185. package/scripts/cli/command/admin.ts +65 -0
  186. package/scripts/cli/command/console-menu.ts +227 -0
  187. package/scripts/cli/{doctor.ts → command/doctor.ts} +257 -258
  188. package/scripts/cli/{setup.ts → command/setup.ts} +8 -12
  189. package/scripts/cli/command/start.ts +13 -0
  190. package/scripts/cli/command/tray.ts +165 -0
  191. package/scripts/cli/command/update.ts +23 -0
  192. package/scripts/cli/{runtime-state.ts → gateway/drain-token.ts} +78 -78
  193. package/scripts/cli/gateway/spawn.ts +101 -0
  194. package/scripts/cli/gateway/stop.ts +51 -0
  195. package/scripts/cli/main.ts +94 -0
  196. package/scripts/cli/support/bun.ts +27 -0
  197. package/scripts/cli/support/env.ts +99 -0
  198. package/scripts/cli/support/platform.ts +64 -0
  199. package/scripts/cli/support/services.ts +88 -0
  200. package/scripts/cli/support/startup-signal.ts +23 -0
  201. package/scripts/cli/{version.ts → support/version.ts} +1 -1
  202. package/scripts/cli/tray/hidden-window.vbs +28 -0
  203. package/scripts/cli/{tray.ts → tray/index.ts} +3 -3
  204. package/scripts/cli/{tray.ps1 → tray/windows.ps1} +107 -98
  205. package/scripts/cli/ui/background.ts +49 -0
  206. package/src/boot/app.ts +3 -1
  207. package/src/boot/dependencies.ts +36 -13
  208. package/src/config/providers.ts +27 -1
  209. package/src/config/spec.ts +11 -0
  210. package/src/console/backup/routes.ts +8 -0
  211. package/src/console/cli-tools/contracts.ts +6 -6
  212. package/src/console/console-router.ts +5 -3
  213. package/src/console/dashboard-assets.ts +81 -11
  214. package/src/console/observability/contracts.ts +54 -22
  215. package/src/console/observability/routes.ts +31 -6
  216. package/src/console/observability/store.ts +68 -28
  217. package/src/console/providers/catalog/public-model-store.ts +91 -60
  218. package/src/console/providers/catalog/store.ts +5 -1
  219. package/src/console/quota/account-quota-tenant.ts +9 -6
  220. package/src/console/response-compression.ts +69 -2
  221. package/src/console/routing/pools/probe-verdict.ts +72 -0
  222. package/src/console/share/share-router.ts +7 -4
  223. package/src/console/share/share-stats.ts +12 -5
  224. package/src/console/shared/read-through-cache.ts +133 -7
  225. package/src/console/updates/repository-updates.ts +39 -34
  226. package/src/network/outbound-fetch.ts +113 -25
  227. package/src/network/tls/bun-client-hello.ts +112 -0
  228. package/src/observability/event-log.ts +29 -8
  229. package/src/observability/metrics.ts +40 -13
  230. package/src/observability/runtime-metrics.ts +7 -0
  231. package/src/persistence/schema.ts +40 -2
  232. package/src/protocol/response/codex.ts +9 -75
  233. package/src/protocol/tool-identity.ts +43 -9
  234. package/src/providers/authentication/jwt-validator.ts +130 -187
  235. package/src/providers/authentication/oauth-flow-store.ts +16 -9
  236. package/src/providers/default-registry.ts +4 -0
  237. package/src/providers/discovery/catalog/catalog-format.ts +20 -0
  238. package/src/providers/discovery/models-dev-catalog.ts +39 -22
  239. package/src/providers/discovery/probe-wire.ts +29 -5
  240. package/src/providers/integrations/buddy/buddy-catalog-shared.ts +3 -2
  241. package/src/providers/integrations/buddy/buddy-cli-headers.ts +88 -0
  242. package/src/providers/integrations/buddy/buddy-conversation-headers.ts +4 -0
  243. package/src/providers/integrations/buddy/buddy-discovery-shared.ts +33 -1
  244. package/src/providers/integrations/buddy/buddy-identity.ts +46 -0
  245. package/src/providers/integrations/buddy/buddy-oauth-shared.ts +37 -1
  246. package/src/providers/integrations/buddy/buddy-usage-store.ts +40 -5
  247. package/src/providers/integrations/buddy/codebuddy/provider.ts +2 -2
  248. package/src/providers/integrations/buddy/codebuddy/shared.ts +106 -73
  249. package/src/providers/integrations/buddy/workbuddy/cn-provider.ts +5 -2
  250. package/src/providers/integrations/buddy/workbuddy/quota.ts +172 -159
  251. package/src/providers/integrations/buddy/workbuddy/shared.ts +200 -171
  252. package/src/providers/integrations/codex/codex.ts +5 -8
  253. package/src/providers/integrations/factory/factory-oauth.ts +7 -11
  254. package/src/providers/integrations/opencode/opencode-go-quota.ts +130 -0
  255. package/src/providers/integrations/opencode/provider.ts +42 -3
  256. package/src/providers/integrations/qoder/qoder-oauth.ts +3 -9
  257. package/src/providers/integrations/shared/install-id.ts +29 -2
  258. package/src/providers/operations/client-versions.ts +11 -1
  259. package/src/providers/operations/model-catalog-cache.ts +18 -3
  260. package/src/providers/operations/provider-catalog-service.ts +76 -0
  261. package/src/transport/dispatch/attempt-finalize.ts +7 -1
  262. package/src/transport/dispatch/attempt-loop.ts +9 -7
  263. package/src/transport/dispatch/empty-stream.ts +17 -26
  264. package/src/transport/failure-policy.ts +20 -0
  265. package/src/transport/routing/route-catalog.ts +42 -3
  266. package/src/transport/surface/chat/encode.ts +18 -31
  267. package/src/transport/surface/messages/stream.ts +3 -2
  268. package/src/transport/translation/tool-repair.ts +37 -16
  269. package/src/workers/account-identity-sweep.ts +14 -12
  270. package/src/workers/daily-checkin.ts +62 -0
  271. package/src/workers/quota-refresh-sweep.ts +27 -2
  272. package/dist/dashboard/assets/CombosPage-B7ETkfVH.js +0 -1
  273. package/dist/dashboard/assets/ConsoleLogPage-AisQzCI1.js +0 -1
  274. package/dist/dashboard/assets/HealthEventsModal-BNflDm_f.js +0 -1
  275. package/dist/dashboard/assets/ModelPicker-CAiPR5Vd.js +0 -1
  276. package/dist/dashboard/assets/ProviderDetailPage-BK8i5B5X.js +0 -3
  277. package/dist/dashboard/assets/ProvidersPage-CvCVgm1e.js +0 -1
  278. package/dist/dashboard/assets/ProxyPage-DjabkuzP.js +0 -7
  279. package/dist/dashboard/assets/QuotaPage-Dxe0B0iu.js +0 -1
  280. package/dist/dashboard/assets/SetupPage-BaD4P_jW.js +0 -1
  281. package/dist/dashboard/assets/SortableList-Bol1ASmI.js +0 -1
  282. package/dist/dashboard/assets/StudioPage-CLP4le3U.js +0 -31
  283. package/dist/dashboard/assets/api-keys-CjIGQhe7.js +0 -1
  284. package/dist/dashboard/assets/app-Cjgo4-Lf.css +0 -2
  285. package/dist/dashboard/assets/cli-tools-DccaOfhX.js +0 -1
  286. package/dist/dashboard/assets/clipboard-button-DQmMikNQ.js +0 -1
  287. package/dist/dashboard/assets/entry-Cpi0rph1.js +0 -4
  288. package/dist/dashboard/assets/entry-Dm3PpDCO.js +0 -1
  289. package/dist/dashboard/assets/entry-keNDZ_Wz.js +0 -1
  290. package/dist/dashboard/assets/github-badge-BuAJr8oU.js +0 -1
  291. package/dist/dashboard/assets/mutation-BIizFZav.js +0 -1
  292. package/dist/dashboard/assets/privacy-mode-CQjbZ3xk.js +0 -1
  293. package/dist/dashboard/assets/settings-BAS6QbmJ.js +0 -1
  294. package/dist/dashboard/assets/terminal-C9mZ4Ugm.js +0 -1
  295. package/dist/dashboard/assets/toast-DKAdP2mo.js +0 -2
  296. package/scripts/cli/cli.ts +0 -771
  297. package/scripts/operations/probe-egress.ts +0 -335
  298. package/scripts/operations/restart.ts +0 -120
  299. package/scripts/shared/env.ts +0 -269
  300. /package/{tray-assets → scripts/cli/tray/assets}/cartethyia.ico +0 -0
  301. /package/{tray-assets → scripts/cli/tray/assets}/cartethyia.png +0 -0
  302. /package/scripts/cli/{menu.ts → ui/prompt.ts} +0 -0
  303. /package/scripts/cli/{wordmark.ts → ui/wordmark.ts} +0 -0
@@ -0,0 +1 @@
1
+ import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CXUMngI_.js";import{a as i}from"./app-Cjq7nrwu.js";import{n as a,t as o}from"./brain-Cwed_72z.js";import{t as s}from"./chevron-right-BXIy5l3h.js";import{t as c}from"./circle-check-BU3v_mFW.js";import{_ as l,c as u,d,h as ee,l as f,m as te,n as ne,p as re,r as p,s as ie,t as m,u as ae,v as h,y as oe}from"./toast-C76WrMhc.js";import{t as g}from"./eye-C_hawfH4.js";import{n as se,t as ce}from"./github-badge-Booc5mNe.js";import{n as le,r as ue,t as de}from"./state-CzUPfLXo.js";import{t as fe}from"./key-round-UkavsGxp.js";import{n as pe,r as me,t as _}from"./clipboard-button-R_rArH8S.js";import{t as he}from"./scaling-nWE4Cx8f.js";import{t as v}from"./wrench-B6E1oEuY.js";import{n as y,t as b}from"./card-B0Bnx5CA.js";import{n as ge}from"./download-dRFo5_Wu.js";import{a as x,l as S,m as C,o as w,s as T}from"./tokens-DDxMbSRL.js";import{a as E}from"./numbers-CFL4_Dqc.js";import{t as D}from"./stream-retry-5QnVuSSo.js";var O=e(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),_e=e(`heart`,[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}]]),k=t(n(),1),A=i();function j(e){if(e===`link_expired_or_used`)return`This enrollment link has expired or has already been used.`;if(e===`key_unavailable`)return`The shared access template is no longer available.`;if(e===`link_not_found`)return`This enrollment link is unavailable.`;if(e===`link_disabled`)return`This share link's API key is paused. Ask whoever shared this link to re-enable it.`;if(e===`link_expired`)return`This share link has expired.`;if(e===`link_revoked`)return`This share link has been revoked.`}function M(e,t){let n=e.error;return j(typeof n==`string`?n:n?.code)??(typeof n==`string`?n:n?.message)??e.message??t}function N(e){let t=e.error;return(typeof t==`string`?t:t?.code)??null}function ve(e,t){let n=t?.streamEvent,[r,i]=(0,k.useState)({data:null,error:null,code:null,loading:!0});return(0,k.useEffect)(()=>{let t=!0,r=new AbortController,a,o,s=e=>{i({data:e,error:null,code:null,loading:!1})};if(n===void 0)return fetch(e,{signal:r.signal,credentials:`same-origin`,cache:`no-store`,referrerPolicy:`no-referrer`}).then(async e=>{let n=await e.json();if(t){if(!e.ok){i({data:null,error:M(n,`This enrollment link is unavailable.`),code:N(n),loading:!1});return}s(n)}}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||t&&i({data:null,error:`Unable to reach the Cartethyia gateway.`,code:null,loading:!1})}),()=>{t=!1,r.abort()};let c=!1,l=()=>{if(!t)return;let r=new EventSource(e);a=r,r.addEventListener(n,e=>{if(t)try{s(JSON.parse(e.data))}catch{}}),r.addEventListener(`error`,()=>{r.close(),t&&(c||(c=!0,i(e=>e.data===null?{...e,loading:!1}:e)),o=setTimeout(l,D))})};return l(),()=>{t=!1,a?.close(),clearTimeout(o)}},[e,n]),r}var P=r(),F=`max-h-168 w-full min-w-0 overflow-x-auto overflow-y-auto touch-pan-x touch-pan-y [&_thead_th]:sticky [&_thead_th]:top-0 [&_thead_th]:z-card [&_thead_th]:bg-surface-2`,I=`w-full border-collapse text-caption [&_th]:border-b [&_th]:border-inner-border [&_th]:px-5 [&_th]:py-3 [&_th]:text-left [&_th]:font-mono [&_th]:text-micro [&_th]:font-bold [&_th]:uppercase [&_th]:tracking-label [&_th]:text-text-tertiary [&_td]:border-b [&_td]:border-surface-muted [&_td]:px-5 [&_td]:py-4 [&_td]:text-text-secondary [&_tr:last-child_td]:border-b-0 [&_code]:overflow-hidden [&_code]:text-ellipsis [&_code]:whitespace-nowrap`,L=(0,k.createContext)({data:null,loading:!0,unit:x,cycleUnit:()=>void 0}),R=`cartethyia:share-token-unit`;function z(){try{let e=window.localStorage.getItem(R);if(e===null)return x;if(e===`auto`)return-1;let t=Number(e);return Number.isInteger(t)&&t>=0&&t<=x?t:x}catch{return x}}function B(e){return e===-1?0:e>=x?-1:e+1}function V(e){return e===-1?`auto`:e>=x?`raw`:w[e]?.suffix??`auto`}function ye({path:e,children:t}){let n=ve(e,{streamEvent:`stats`}),[r,i]=(0,k.useState)(()=>typeof window>`u`?x:z()),a=(0,k.useCallback)(()=>{i(e=>{let t=B(e);try{window.localStorage.setItem(R,t===-1?`auto`:String(t))}catch{}return t})},[]);return(0,P.jsx)(L.Provider,{value:{data:n.data,loading:n.loading,unit:r,cycleUnit:a},children:t})}function H(){let{unit:e,cycleUnit:t}=(0,k.useContext)(L),n=V(e),r=V(B(e));return(0,P.jsxs)(`button`,{type:`button`,className:`ml-auto inline-flex min-h-6 items-center gap-1 rounded-chip border border-inner-border bg-surface-2 px-2 text-text-secondary font-mono text-micro font-bold uppercase tracking-[0.04em] cursor-pointer hover:border-accent hover:text-text-primary`,"aria-label":`Token unit: currently ${n}, switch to ${r}`,title:`Show ${r}`,onClick:t,children:[(0,P.jsx)(he,{size:11,"aria-hidden":`true`}),n]})}function be({policy:e}){let{data:t}=(0,k.useContext)(L);return(0,P.jsx)(Y,{policy:e,stats:t})}function xe(){let{data:e,loading:t}=(0,k.useContext)(L);return(0,P.jsx)(Q,{stats:e,loading:t})}function U(){let{unit:e}=(0,k.useContext)(L);return(0,k.useCallback)(t=>C(t,e),[e])}function W(e){return Number.isFinite(e)?Math.max(0,Math.round(e)).toLocaleString():`—`}function G(e){return e===null||!Number.isFinite(e)||e<=0?`—`:`${Number(e.toFixed(1))} t/s`}function K(e){return e===null||!Number.isFinite(e)||e<=0?`—`:e>=1e3?`${Number((e/1e3).toFixed(1))}s`:`${Math.round(e)}ms`}function q(e){if(!e)return`—`;let t=new Date(e).getTime();if(!Number.isFinite(t))return`—`;let n=Math.max(0,Math.round((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.round(n/60);if(r<60)return`${r} min ago`;let i=Math.round(r/60);return i<24?`${i} h ago`:new Date(e).toLocaleDateString()}function J(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:00`}function Y({policy:e,stats:t}){let n=U(),r=[{label:`Lifetime`,used:t?.totals?.totalTokens??0,limit:e.oneTimeLimit},{label:`Daily`,used:t?.totals?.todayTokens??0,limit:e.dailyLimit},{label:`Monthly`,used:t?.totals?.monthTokens??0,limit:e.monthlyLimit}],i=t?.recipients;return(0,P.jsxs)(`div`,{className:`mt-5 flex flex-col gap-6 border-t border-inner-border pt-9`,children:[r.map(e=>{let t=e.limit!==null&&e.limit>0,r=t?Math.min(1,e.used/e.limit):1;return(0,P.jsxs)(`div`,{className:`flex items-center gap-6 max-sm:flex-col max-sm:items-stretch max-sm:gap-3`,children:[(0,P.jsx)(`span`,{className:`w-39 shrink-0 text-text-secondary font-mono text-micro uppercase tracking-label max-sm:w-auto`,children:e.label}),(0,P.jsx)(`div`,{className:`relative h-4 flex-1 overflow-hidden rounded-tiny bg-teal max-sm:flex-none`,title:t?`${n(e.used)} of ${n(e.limit)} used`:`${n(e.used)} used (no limit set)`,children:t?(0,P.jsx)(`div`,{className:`h-full rounded-tiny bg-red transition-[width] duration-200`,style:{width:`${Math.round(r*100)}%`}}):null}),(0,P.jsxs)(`span`,{className:`whitespace-nowrap text-text-secondary font-mono text-micro [&>strong]:text-text-primary [&>strong]:font-semibold max-sm:self-start`,children:[(0,P.jsx)(`strong`,{children:n(e.used)}),t?` / ${n(e.limit)}`:` used`]})]},e.label)}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsxs)(`span`,{className:`inline-flex min-h-14 items-center gap-3.5 rounded-pill border border-inner-border bg-surface-2 px-5 py-2.5 text-text-secondary font-mono text-badge leading-[1.3]`,children:[`RPM `,e.requestsPerMinute??`unlimited`]}),(0,P.jsxs)(`span`,{className:`inline-flex min-h-14 items-center gap-3.5 rounded-pill border border-inner-border bg-surface-2 px-5 py-2.5 text-text-secondary font-mono text-badge leading-[1.3]`,children:[`Concurrent `,e.maxConcurrentRequests??`unlimited`]}),i?(0,P.jsxs)(`span`,{className:`inline-flex min-h-14 items-center gap-3.5 rounded-pill border border-inner-border bg-surface-2 px-5 py-2.5 text-text-secondary font-mono text-badge leading-[1.3]`,children:[i.active,` / `,i.total,` recipients active`]}):null,(0,P.jsx)(H,{})]})]})}function X({hourly:e}){let t=U(),n=Math.max(1,...e.map(e=>e.requests)),r=e.length*10,[i,a]=(0,k.useState)(null),o=(t,n)=>{let r=t.getBoundingClientRect();if(r.width===0||e.length===0)return null;let i=Math.floor((n-r.left)/r.width*e.length);return i>=0&&i<e.length?i:null},s=i===null?void 0:e[i];return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`mb-2 flex min-h-9 items-baseline gap-4 text-text-tertiary font-mono text-badge [&>strong]:text-text-primary [&>strong]:font-head [&>strong]:text-body-lg [&>strong]:font-semibold`,"aria-live":`polite`,children:s?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`strong`,{children:t(s.tokens)}),(0,P.jsxs)(`span`,{children:[J(s.hour),` · `,W(s.requests),` req`]})]}):(0,P.jsx)(`span`,{children:`drag a bar`})}),(0,P.jsx)(`div`,{className:`cursor-crosshair touch-none`,onPointerEnter:e=>a(o(e.currentTarget,e.clientX)),onPointerMove:e=>a(o(e.currentTarget,e.clientX)),onPointerLeave:()=>a(null),children:(0,P.jsx)(`svg`,{className:`h-22 w-full`,viewBox:`0 0 ${r} 44`,preserveAspectRatio:`none`,role:`img`,"aria-label":`Requests per hour over the last 24 hours`,children:e.map((e,r)=>{let a=Math.round(e.requests/n*40);return(0,P.jsx)(`rect`,{className:`${e.requests===0?`fill-track`:`fill-teal`}${r===i?` fill-text-primary`:``}`,x:r*10+1,y:44-Math.max(2,a),width:7,height:Math.max(2,a),rx:1.5,children:(0,P.jsx)(`title`,{children:`${t(e.tokens)} tokens · ${W(e.requests)} requests`})},e.hour)})})}),(0,P.jsxs)(`div`,{className:`mt-1.5 flex justify-between text-text-tertiary font-mono text-micro`,children:[(0,P.jsx)(`span`,{children:e.length?J(e[0].hour):``}),(0,P.jsx)(`span`,{children:`last 24h`}),(0,P.jsx)(`span`,{children:e.length?J(e[e.length-1].hour):``})]})]})}function Z({value:e,max:t,label:n}){let r=t>0?Math.min(1,e/t):0;return(0,P.jsxs)(`div`,{className:`flex min-w-55 items-center gap-4 max-sm:min-w-32`,children:[(0,P.jsx)(`div`,{className:`h-3 min-w-0 flex-1 overflow-hidden rounded-tiny bg-surface-muted`,children:(0,P.jsx)(`div`,{className:`h-full rounded-tiny bg-teal`,style:{width:`${Math.round(r*100)}%`}})}),(0,P.jsx)(`span`,{className:`min-w-8 text-right font-mono text-micro text-text-secondary`,children:n})]})}function Q({stats:e,loading:t}){let[n,r]=(0,k.useState)(!1),i=U(),a=e?.totals,o=e?.models??[],c=e?.clientIps??[],u=Math.max(1,...o.map(e=>e.tokens)),d=Math.max(1,...c.map(e=>e.requests));return(0,P.jsxs)(b,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg p-5 backdrop-blur-md backdrop-saturate-150`,children:[(0,P.jsxs)(`button`,{type:`button`,className:`group flex w-full cursor-pointer items-center gap-3 bg-transparent p-0 text-left`,"aria-expanded":n,onClick:()=>r(e=>!e),children:[(0,P.jsx)(s,{size:14,className:`shrink-0 text-text-secondary transition-transform duration-200${n?` rotate-90`:``}`,"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`text-text-secondary font-mono text-badge font-bold tracking-label transition-colors duration-150 group-hover:text-text-primary`,children:`STATS & ACTIVITY`}),(0,P.jsxs)(`span`,{className:`ml-auto flex flex-wrap items-center gap-2 text-text-tertiary font-mono text-micro max-medium:hidden`,children:[(0,P.jsxs)(`span`,{children:[c.length,` IPs`]}),(0,P.jsx)(`span`,{children:`·`}),(0,P.jsxs)(`span`,{children:[o.length,` models`]}),(0,P.jsx)(`span`,{children:`·`}),(0,P.jsxs)(`span`,{children:[W(a?.requests??0),` req`]})]})]}),n?(0,P.jsx)(`div`,{className:`mt-5 flex flex-col gap-5`,children:t&&!e?(0,P.jsx)(`p`,{className:`py-9 text-center text-text-tertiary text-caption`,children:`Loading activity…`}):e?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`grid grid-cols-4 gap-5 max-wide:grid-cols-2 max-narrow:grid-cols-1`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-panel border border-inner-border bg-surface-2 px-7 py-6`,children:[(0,P.jsx)(`span`,{className:`text-text-tertiary font-mono text-micro uppercase tracking-label`,children:`Requests`}),(0,P.jsx)(`span`,{className:`font-head text-display font-semibold tracking-tight`,children:W(a?.requests??0)}),(0,P.jsxs)(`span`,{className:`text-text-secondary text-micro`,children:[W(a?.errors??0),` errors`]})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-panel border border-inner-border bg-surface-2 px-7 py-6`,children:[(0,P.jsx)(`span`,{className:`text-text-tertiary font-mono text-micro uppercase tracking-label`,children:`Tokens`}),(0,P.jsx)(`span`,{className:`font-head text-display font-semibold tracking-tight`,children:i(a?.totalTokens??0)}),(0,P.jsx)(`span`,{className:`text-text-secondary text-micro`,children:`all time`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-panel border border-inner-border bg-surface-2 px-7 py-6`,children:[(0,P.jsx)(`span`,{className:`text-text-tertiary font-mono text-micro uppercase tracking-label`,children:`Last hour`}),(0,P.jsx)(`span`,{className:`font-head text-display font-semibold tracking-tight`,children:W(a?.lastHourRequests??0)}),(0,P.jsx)(`span`,{className:`text-text-secondary text-micro`,children:`requests in 60 min`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-panel border border-inner-border bg-surface-2 px-7 py-6`,children:[(0,P.jsx)(`span`,{className:`text-text-tertiary font-mono text-micro uppercase tracking-label`,children:`Models`}),(0,P.jsx)(`span`,{className:`font-head text-display font-semibold tracking-tight`,children:o.length}),(0,P.jsx)(`span`,{className:`text-text-secondary text-micro`,children:`in use`})]})]}),(0,P.jsx)(X,{hourly:e.hourly}),(0,P.jsxs)(`section`,{"aria-label":`Top models`,children:[(0,P.jsx)(`div`,{className:`flex items-center justify-between gap-6`,children:(0,P.jsxs)(`h3`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-badge font-bold tracking-label transition-colors duration-150`,children:[(0,P.jsx)(O,{size:13,"aria-hidden":`true`}),` TOP MODELS`]})}),o.length===0?(0,P.jsx)(`p`,{className:`py-9 text-center text-text-tertiary text-caption`,children:`No model traffic yet.`}):(0,P.jsx)(`div`,{className:F,children:(0,P.jsxs)(`table`,{className:I,children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`th`,{scope:`col`,"aria-label":`Rank`}),(0,P.jsx)(`th`,{scope:`col`,children:`Model`}),(0,P.jsx)(`th`,{scope:`col`,className:`text-right`,children:`Req`}),(0,P.jsx)(`th`,{scope:`col`,className:`text-right`,title:`Average output tokens per second`,children:`Avg t/s`}),(0,P.jsx)(`th`,{scope:`col`,className:`text-right`,title:`Average time to first token`,children:`TTFT`}),(0,P.jsx)(`th`,{scope:`col`,children:`Tokens`})]})}),(0,P.jsx)(`tbody`,{children:o.map((e,t)=>(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`td`,{className:`w-13 font-mono text-micro text-text-tertiary`,children:t+1}),(0,P.jsx)(`td`,{children:(0,P.jsx)(`span`,{className:`flex min-w-0 flex-col gap-1 [&_code]:overflow-hidden [&_code]:text-ellipsis [&_code]:whitespace-nowrap [&_code]:text-text-primary [&_code]:text-caption [&_span]:font-mono [&_span]:text-micro [&_span]:text-text-tertiary`,children:(0,P.jsx)(`code`,{title:e.modelId,children:e.modelId})})}),(0,P.jsx)(`td`,{className:`text-right`,children:W(e.requests)}),(0,P.jsx)(`td`,{className:`text-right`,children:G(e.avgTokensPerSec)}),(0,P.jsx)(`td`,{className:`text-right`,children:K(e.avgTtfbMs)}),(0,P.jsx)(`td`,{children:(0,P.jsx)(Z,{value:e.tokens,max:u,label:i(e.tokens)})})]},e.modelId))})]})})]}),(0,P.jsxs)(`section`,{"aria-label":`Client IPs`,children:[(0,P.jsx)(`div`,{className:`flex items-center justify-between gap-6`,children:(0,P.jsxs)(`h3`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-badge font-bold tracking-label transition-colors duration-150`,children:[(0,P.jsx)(l,{size:13,"aria-hidden":`true`}),` CLIENT IPS`]})}),c.length===0?(0,P.jsx)(`p`,{className:`py-9 text-center text-text-tertiary text-caption`,children:`No client addresses recorded yet.`}):(0,P.jsx)(`div`,{className:F,children:(0,P.jsxs)(`table`,{className:I,children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`th`,{scope:`col`,children:`Address`}),(0,P.jsx)(`th`,{scope:`col`,children:`Client`}),(0,P.jsx)(`th`,{scope:`col`,className:`text-right`,children:`Req`}),(0,P.jsx)(`th`,{scope:`col`,children:`Tokens`}),(0,P.jsx)(`th`,{scope:`col`,children:`Last seen`})]})}),(0,P.jsx)(`tbody`,{children:c.map(e=>(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`td`,{children:(0,P.jsx)(`code`,{children:e.ip})}),(0,P.jsx)(`td`,{children:e.clientType?(0,P.jsx)(`span`,{className:`inline-block max-w-full overflow-hidden text-ellipsis whitespace-nowrap rounded-pill border border-inner-border bg-surface-2 px-3 py-px font-mono text-micro text-text-secondary`,children:e.clientType}):(0,P.jsx)(`span`,{className:`inline-block max-w-full overflow-hidden text-ellipsis whitespace-nowrap rounded-pill border border-inner-border bg-surface-2 px-3 py-px font-mono text-micro italic text-text-tertiary`,children:`unknown`})}),(0,P.jsx)(`td`,{className:`text-right`,children:W(e.requests)}),(0,P.jsx)(`td`,{children:(0,P.jsx)(Z,{value:e.requests,max:d,label:i(e.tokens)})}),(0,P.jsx)(`td`,{children:q(e.lastSeenAt)})]},e.ip))})]})})]})]}):(0,P.jsx)(`p`,{className:`py-9 text-center text-text-tertiary text-caption`,children:`Activity is unavailable right now.`})}):null]})}var Se=`cartethyia-share-keys`,$=`issued-keys`,Ce=1;function we(){return new Promise((e,t)=>{if(typeof indexedDB>`u`){t(Error(`IndexedDB is unavailable`));return}let n=indexedDB.open(Se,Ce);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains($)||n.result.createObjectStore($)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error??Error(`Could not open share-key storage`))})}function Te(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.key==`string`&&typeof t.keyId==`string`&&typeof t.keyPrefix==`string`&&typeof t.createdAt==`string`}async function Ee(e){let t=await we();return await new Promise((n,r)=>{let i=t.transaction($,`readonly`).objectStore($).get(e);i.onsuccess=()=>n(Te(i.result)?i.result:null),i.onerror=()=>r(i.error??Error(`Could not read share-key storage`))})}async function De(e,t){let n=await we();await new Promise((r,i)=>{let a=n.transaction($,`readwrite`);a.objectStore($).put(t,e),a.oncomplete=()=>r(),a.onerror=()=>i(a.error??Error(`Could not save share key in this browser`)),a.onabort=()=>i(a.error??Error(`Could not save share key in this browser`))})}async function Oe(e){let t=await we();await new Promise((n,r)=>{let i=t.transaction($,`readwrite`);i.objectStore($).delete(e),i.oncomplete=()=>n(),i.onerror=()=>r(i.error??Error(`Could not clear share-key storage`)),i.onabort=()=>r(i.error??Error(`Could not clear share-key storage`))})}function ke(e){return typeof e.error==`string`?e.error:e.error?.message??e.message??`Unable to generate an API key.`}function Ae(e){let t=e.replace(/\/$/,``);return t.slice(t.lastIndexOf(`/`)+1)}var je=20;function Me({id:e,label:t,info:n,canProbe:r,probing:i,onProbe:s,result:u}){let d=(n?.capabilities?.input??[]).some(e=>e===`image`||e===`vision`);return(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2.5 rounded-control border border-inner-border bg-surface-2 p-3`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,P.jsx)(`span`,{className:`inline-flex size-13 shrink-0 items-center justify-center rounded-lg bg-teal-soft text-teal`,"aria-hidden":`true`,children:(0,P.jsx)(a,{size:14})}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-caption font-semibold leading-[1.35] text-text-primary`,title:e,children:t})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-text-secondary text-badge`,children:[(0,P.jsxs)(`span`,{className:`inline-flex gap-1 [&>span]:inline-flex`,children:[n?.reasoning?(0,P.jsx)(`span`,{title:`Reasoning`,"aria-label":`Reasoning`,className:`text-purple`,children:(0,P.jsx)(o,{size:12})}):null,d?(0,P.jsx)(`span`,{title:`Vision`,"aria-label":`Vision`,className:`text-status-info`,children:(0,P.jsx)(g,{size:12})}):null,n?.toolCall?(0,P.jsx)(`span`,{title:`Tool calling`,"aria-label":`Tool calling`,className:`text-orange`,children:(0,P.jsx)(v,{size:12})}):null,n?.webSearch?(0,P.jsx)(`span`,{title:`Web search`,"aria-label":`Web search`,className:`text-teal`,children:(0,P.jsx)(l,{size:12})}):null]}),(0,P.jsxs)(`span`,{className:`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,children:[n?.contextLength==null?(0,P.jsx)(`span`,{title:T,className:`cursor-help`,children:`n/a ctx`}):`${S(n.contextLength)} ctx`,` · `,n?.maxOutputTokens==null?(0,P.jsx)(`span`,{title:T,className:`cursor-help`,children:`n/a out`}):`${S(n.maxOutputTokens)} out`]})]}),u?.ok?(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 font-mono text-badge text-text-secondary [&>strong]:font-sans [&>strong]:text-green`,role:`status`,children:[(0,P.jsx)(`strong`,{children:`OK`}),(0,P.jsxs)(`span`,{children:[`TTFT `,E(u.ttftMs)]}),(0,P.jsxs)(`span`,{children:[`Done `,E(u.totalMs)]})]}):null,(0,P.jsxs)(`div`,{className:`mt-auto grid min-w-0 grid-cols-2 items-center gap-4 [&>*]:w-full [&>*]:min-w-0 [&_.btn]:w-full [&_.btn]:min-w-0`,children:[r?(0,P.jsx)(p,{variant:`secondary`,size:`sm`,icon:u?.ok?(0,P.jsx)(`span`,{className:`inline-flex text-green`,children:(0,P.jsx)(c,{size:13})}):(0,P.jsx)(h,{size:13}),loading:i,disabled:i,onClick:()=>s(e),title:u?.ok?`Last test passed in ${E(u.totalMs)} — click to re-test`:u?`Last test failed${u.status===null?``:` with HTTP ${u.status}`} — click to re-test`:`Test this model using the shared API key`,children:i?`Testing…`:u?.ok?`Done ${E(u.totalMs)}`:u?`Failed${u.status===null?``:` ${u.status}`}`:`Test`}):null,(0,P.jsx)(_,{value:e,size:`sm`,variant:`secondary`,label:`Copy`,copiedLabel:`Copied`,"aria-label":`Copy ${e}`,title:`Copy ${e}`})]})]})}function Ne(){let e=typeof window>`u`?`/share`:window.location.pathname.replace(/\/$/,``),t=`${e}/data`,n=`${e}/issue`,r=typeof window>`u`?``:Ae(e),i=typeof window>`u`?``:window.location.origin,o=ve(t),[s,c]=(0,k.useState)(null),[d,h]=(0,k.useState)(null),[g,he]=(0,k.useState)(``),[v,x]=(0,k.useState)(null),[S,C]=(0,k.useState)(!1),[w,T]=(0,k.useState)(null),[E,D]=(0,k.useState)(()=>new Set),[O,A]=(0,k.useState)(()=>new Map),j=(0,k.useRef)(new Map),[M,N]=(0,k.useState)(!1),F=(0,k.useRef)(null),I=(0,k.useRef)(null);ne({open:M,mounted:M,panelRef:F,onClose:()=>N(!1)});let[L,R]=(0,k.useState)(()=>f(`dark`)),[z,B]=(0,k.useState)(!1),[V,H]=(0,k.useState)(`raw`);(0,k.useEffect)(()=>{let e=()=>B(window.scrollY>24);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),(0,k.useEffect)(()=>{document.title=`Cartethyia — Shared access`,R(f(`dark`)),ie(f(`dark`))},[]);let U=o.data?.kind===`enroll`?o.data:null;(0,k.useEffect)(()=>{let e=!0;if(c(null),h(null),x(null),!r||!U){o.error&&Oe(r).catch(()=>void 0);return}return Ee(r).then(t=>{e&&t&&(h(t),c(null))}).catch(()=>{e&&x(`This browser could not read the stored key. Issue a new key only if this enrollment permits one.`)}),()=>{e=!1}},[r,U,o.error]);let W=async()=>{C(!0),T(null),x(null);try{let e=await fetch(n,{method:`POST`,credentials:`same-origin`,cache:`no-store`,referrerPolicy:`no-referrer`,headers:{"content-type":`application/json`},body:JSON.stringify(g.trim()?{nameHint:g.trim().slice(0,je)}:{})}),t=await e.json();if(!e.ok){T(ke(t));return}let i=t;if(h(null),c(i),!r)return;try{await De(r,{key:i.key,keyId:i.keyId,keyPrefix:i.keyPrefix,createdAt:i.createdAt}),h({key:i.key,keyId:i.keyId,keyPrefix:i.keyPrefix,createdAt:i.createdAt}),c(null)}catch{x(`Your key was issued, but this browser could not save it. Copy it now: refreshing will not restore it.`)}}catch{T(`Unable to reach the Cartethyia gateway. Please try again.`)}finally{C(!1)}},G=d??s,K=o.data,q=K?.kind===`handoff`?!!K.key:!!G?.key,J=()=>{let e=I.current;e&&(e.scrollIntoView({behavior:`smooth`,block:`center`}),e.focus({preventScroll:!0}))},Y=async e=>{let t=K?.kind===`handoff`?K.key:(d??s)?.key;if(E.has(e))return;if(!t){m.error(`Create your API key first`,`Generate a key in the API key panel before testing a model.`),J();return}let n=new AbortController;j.current.set(e,n),D(t=>new Set(t).add(e));let r=performance.now(),a=null;try{let o=await fetch(`${i}/v1/chat/completions`,{method:`POST`,headers:{Authorization:`Bearer ${t}`,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify({model:e,messages:[{role:`user`,content:`Reply with exactly: OK`}],stream:!0,max_tokens:16}),cache:`no-store`,referrerPolicy:`no-referrer`,signal:n.signal});if(!o.ok||!o.body){A(t=>new Map(t).set(e,{ok:!1,status:o.status})),m.error(`Model probe failed`,`Request failed with HTTP ${o.status}`);return}let s=o.body.getReader();try{for(;;){let e=await s.read();if(e.value&&e.value.byteLength>0&&a===null&&(a=performance.now()),e.done)break}}finally{s.releaseLock()}let c=Math.round(performance.now()-r),l=Math.round((a??performance.now())-r);A(t=>new Map(t).set(e,{ok:!0,ttftMs:l,totalMs:c})),m.success(`Model test complete`,`${e} · TTFT ${l} ms · Done ${c} ms`)}catch(t){t instanceof DOMException&&t.name===`AbortError`||(A(t=>new Map(t).set(e,{ok:!1,status:null})),m.error(`Model probe failed`,t instanceof Error?t.message:`The request could not be completed.`))}finally{j.current.get(e)===n&&j.current.delete(e),D(t=>{let n=new Set(t);return n.delete(e),n})}};(0,k.useEffect)(()=>()=>{for(let e of j.current.values())e.abort()},[]);let X=!!U?.canIssue&&!G,Z=K?.kind===`handoff`?K.key:null,Q=new Map;for(let e of K?.models??[]){let t=e.indexOf(`/`),n=t>0?e.slice(0,t):`Other`,r=Q.get(n)??[];r.push(e),Q.set(n,r)}return(0,P.jsx)(ye,{path:`${e}/stats/stream`,children:(0,P.jsxs)(`div`,{className:`min-h-screen text-text-primary font-sans`,children:[(0,P.jsx)(`div`,{className:`share-backdrop`,"aria-hidden":`true`}),(0,P.jsx)(`header`,{className:`share-header`,"data-scrolled":z,children:(0,P.jsxs)(`div`,{className:`share-header-inner`,"data-scrolled":z,children:[(0,P.jsxs)(`a`,{className:`inline-flex items-center gap-5 font-head text-lead tracking-[-0.03em] text-text-primary no-underline`,href:`/`,children:[(0,P.jsx)(`span`,{className:`grid size-17 place-items-center overflow-hidden rounded-control border border-inner-border bg-accent-soft text-accent`,"aria-hidden":`true`,children:(0,P.jsx)(`img`,{className:`block size-full object-cover`,src:`/assets/brand/favicon.jpg`,alt:``,width:34,height:34})}),(0,P.jsx)(`b`,{children:`Cartethyia`})]}),(0,P.jsxs)(`div`,{className:`inline-flex items-center gap-4 max-narrow:gap-3`,children:[(0,P.jsx)(ce,{className:`max-narrow:[&_.github-badge-metric]:hidden max-narrow:[&_.github-badge]:px-2.5`}),(0,P.jsx)(`button`,{type:`button`,className:`grid size-17 cursor-pointer place-items-center rounded-pill border border-inner-border bg-surface-2 text-text-secondary hover:border-border-strong hover:text-text-primary focus-visible:outline-2 focus-visible:outline-focus-ring focus-visible:outline-offset-2`,onClick:()=>{let e=u(L)?`light`:`dark`;R(e),ae(e)},"aria-label":`Toggle theme`,"aria-pressed":u(L),title:u(L)?`Switch to light mode`:`Switch to dark mode`,children:u(L)?(0,P.jsx)(te,{size:15}):(0,P.jsx)(ee,{size:15})}),(0,P.jsxs)(`a`,{href:`/`,className:`inline-flex min-h-17 items-center gap-3 rounded-pill border border-inner-border bg-surface-2 px-6 text-badge font-semibold text-text-secondary no-underline hover:border-border-strong hover:text-text-primary max-narrow:px-5`,children:[(0,P.jsx)(se,{size:13,"aria-hidden":`true`}),` Home`]})]})]})}),(0,P.jsx)(`main`,{className:`relative z-1 mx-auto flex w-full max-w-480 flex-col gap-8 px-12 pb-24 pt-40 max-narrow:gap-6 max-narrow:px-6 max-narrow:pb-16 max-narrow:pt-36`,children:o.loading?(0,P.jsx)(b,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:(0,P.jsx)(y,{children:(0,P.jsx)(ue,{label:`Loading enrollment policy…`})})}):o.error?(0,P.jsx)(b,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:(0,P.jsx)(y,{children:(0,P.jsx)(le,{title:o.code===`link_disabled`?`Key paused`:`Link not available`,message:o.error,onRetry:()=>window.location.reload()})})}):K?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(b,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-7 max-sm:p-5`,children:[(0,P.jsxs)(`p`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-micro font-bold tracking-label leading-normal`,children:[K.kind===`handoff`?(0,P.jsx)(fe,{size:13,"aria-hidden":`true`}):(0,P.jsx)(me,{size:13,"aria-hidden":`true`}),K.kind===`handoff`?`SHARED ACCESS / KEY`:`SHARED ACCESS / ENROLLMENT`]}),(0,P.jsx)(`h1`,{children:K.name||`Shared API access`}),K.kind===`handoff`?(0,P.jsx)(`p`,{className:`mt-2.5 text-text-secondary text-body leading-[1.55]`,children:`The API key for this gateway, provided through a share link. It is subject to the limits below.`}):null,(0,P.jsx)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:K.expiresAt?(0,P.jsxs)(`span`,{className:`inline-flex min-h-7 items-center gap-1.5 rounded-chip border border-inner-border bg-surface-2 px-2.5 py-1 text-text-secondary font-mono text-micro leading-[1.3]`,children:[(0,P.jsx)(oe,{size:12,"aria-hidden":`true`}),`Link expires `,new Date(K.expiresAt).toLocaleString()]}):null}),(0,P.jsx)(be,{policy:K})]}),(0,P.jsxs)(`div`,{className:`grid grid-cols-2 gap-8 max-md:grid-cols-1`,children:[(0,P.jsxs)(b,{surface:`muted`,className:`flex min-w-0 flex-col items-start gap-6 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:[(0,P.jsxs)(`h2`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-micro font-bold tracking-label leading-normal`,children:[(0,P.jsx)(l,{size:13,"aria-hidden":`true`}),` BASE URL`]}),(0,P.jsxs)(`div`,{className:`flex w-full min-w-0 items-center gap-4 [&>code]:block [&>code]:min-w-0 [&>code]:flex-1 [&>code]:overflow-hidden [&>code]:text-ellipsis [&>code]:whitespace-nowrap [&>code]:rounded-inset [&>code]:border [&>code]:border-inner-border [&>code]:bg-code-surface [&>code]:p-5 [&>code]:text-text-primary [&>code]:font-mono [&>code]:text-caption [&>code]:leading-normal [&>button]:shrink-0`,children:[(0,P.jsxs)(`code`,{children:[i,`/v1`]}),(0,P.jsx)(_,{value:`${i}/v1`,size:`sm`,variant:`secondary`,label:`Copy URL`,copiedLabel:`Copied`,"aria-label":`Copy Base URL`})]}),(0,P.jsx)(`p`,{className:`text-caption leading-[1.55] text-text-secondary`,children:`Point your SDK, Opencode, Claude Code, Droid, and any other CLI`}),K.sharePopup.enabled?(0,P.jsxs)(`button`,{type:`button`,className:`flex w-full min-w-0 cursor-pointer items-center gap-6 rounded-panel border border-orange/30 bg-gradient-to-br from-orange-soft to-surface-2 p-6 text-left text-text-primary transition-transform duration-150 ease-spring hover:-translate-y-px hover:border-orange`,onClick:()=>N(!0),"aria-haspopup":`dialog`,"aria-label":`Open popup`,children:[(0,P.jsx)(`span`,{className:`grid size-19 flex-none place-items-center rounded-control bg-orange-soft text-orange`,"aria-hidden":`true`,children:(0,P.jsx)(_e,{size:16})}),(0,P.jsx)(`span`,{className:`grid min-w-0 gap-1.5`,children:(0,P.jsx)(`strong`,{className:`text-caption`,children:K.sharePopup.title||`More information`})}),(0,P.jsx)(`span`,{className:`ml-auto text-lead text-orange`,"aria-hidden":`true`,children:`↗`})]}):null]}),(0,P.jsx)(`div`,{ref:I,tabIndex:-1,children:(0,P.jsxs)(b,{surface:`muted`,className:`flex min-w-0 flex-col items-start gap-6 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:[(0,P.jsxs)(`h2`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-micro font-bold tracking-label leading-normal`,children:[(0,P.jsx)(fe,{size:13,"aria-hidden":`true`}),` YOUR API KEY`]}),K.kind===`handoff`?Z?(0,P.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-5`,role:`status`,children:[(0,P.jsx)(`p`,{className:`font-mono text-micro font-bold tracking-label text-orange`,children:`REVEALED BY THE LINK OWNER`}),(0,P.jsx)(`code`,{className:`block min-w-0 flex-1 overflow-hidden rounded-inset border border-inner-border bg-code-surface p-5 font-mono text-caption leading-normal text-text-primary [overflow-wrap:anywhere] [user-select:all]`,children:Z}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5 [&>span]:font-mono [&>span]:text-micro [&>span]:text-text-tertiary`,children:[(0,P.jsx)(_,{value:Z,size:`sm`,variant:`primary`,label:`Copy key`,copiedLabel:`Copied`}),(0,P.jsx)(p,{variant:`secondary`,size:`sm`,onClick:()=>ge(`cartethyia-api-key.txt`,`Cartethyia API key\n\n${Z}\n\nKeep this secret.\n`,`text/plain;charset=utf-8`),children:`Save this key`}),(0,P.jsxs)(`span`,{children:[`Prefix `,K.keyPrefix??`—`]})]}),(0,P.jsx)(`p`,{className:`text-caption leading-[1.55] text-text-secondary`,children:`This link reveals the key itself, so anyone holding the URL can read it. Keep the URL private; the link owner regenerates it to replace this key.`})]}):(0,P.jsx)(`p`,{className:`text-caption leading-normal text-text-secondary`,children:`This link can no longer reveal its key. Ask the link owner to regenerate it.`}):G?(0,P.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-5`,role:`status`,children:[(0,P.jsx)(`p`,{className:`font-mono text-micro font-bold tracking-[0.06em] text-orange`,children:`GENERATED ONCE · COPY AND KEEP IT`}),(0,P.jsx)(`code`,{className:`block min-w-0 flex-1 overflow-hidden rounded-inset border border-inner-border bg-code-surface p-5 font-mono text-caption leading-normal text-text-primary [overflow-wrap:anywhere] [user-select:all]`,children:G.key}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5 [&>span]:font-mono [&>span]:text-micro [&>span]:text-text-tertiary`,children:[(0,P.jsx)(_,{value:G.key,size:`sm`,variant:`primary`,label:`Copy key`,copiedLabel:`Copied`}),(0,P.jsx)(p,{variant:`secondary`,size:`sm`,onClick:()=>ge(`cartethyia-api-key.txt`,`Cartethyia API key\n\n${G.key}\n\nKeep this secret.\n`,`text/plain;charset=utf-8`),children:`Save this key`}),(0,P.jsxs)(`span`,{children:[`Key ID `,G.keyId.slice(0,12),`…`]})]}),(0,P.jsx)(`p`,{className:`text-caption leading-[1.55] text-text-secondary`,children:`Saved in this browser while this enrollment link remains valid. It is not shown again from another browser, and an expired, revoked, or unavailable link does not restore a local copy.`})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`p`,{className:`text-caption leading-normal text-text-secondary`,children:X?`Issue a personal key to use the shared endpoint.`:`No key is available in this browser.`}),X?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`label`,{className:`flex w-full flex-col gap-1.5 text-text-secondary text-micro font-bold [&>input]:w-full [&>input]:min-h-11 [&>input]:rounded-control [&>input]:border [&>input]:border-inner-border [&>input]:bg-surface-1 [&>input]:px-3 [&>input]:text-text-primary [&>input]:text-body [&>input]:font-medium [&>input]:focus-visible:outline-2 [&>input]:focus-visible:outline-focus-ring [&>input]:focus-visible:outline-offset-2`,children:[(0,P.jsx)(`span`,{children:`Your name`}),(0,P.jsx)(`input`,{type:`text`,value:g,required:!0,maxLength:je,autoComplete:`nickname`,onChange:e=>he(e.target.value)}),(0,P.jsx)(`span`,{className:`text-text-tertiary text-micro font-normal leading-normal`,children:`Shown on your key (best kept to ~5 letters) — the gateway appends its own code.`})]}),(0,P.jsx)(`p`,{className:`-mt-3 text-text-tertiary text-micro font-normal leading-normal`,children:`Enter your name to generate a personal key.`}),(0,P.jsx)(p,{variant:`primary`,size:`sm`,loading:S,disabled:S||!g.trim(),onClick:()=>void W(),children:S?`Generating…`:`Generate API Key`})]}):null]}),K.kind===`enroll`&&!X&&!G?(0,P.jsx)(`p`,{role:`status`,className:`w-full rounded-inset border border-orange-soft bg-orange-soft px-5 py-4 text-badge leading-normal text-orange`,children:w??`This enrollment link is not currently accepting key requests.`}):null,w&&X?(0,P.jsx)(`p`,{role:`alert`,className:`form-error`,children:w}):null,v?(0,P.jsx)(`p`,{role:`alert`,className:`form-error`,children:v}):null]})})]}),M&&K.sharePopup.enabled?(0,P.jsx)(`div`,{className:`fixed inset-0 z-drawer grid place-items-center overflow-y-auto bg-black/70 p-10 backdrop-blur max-sm:place-items-end max-sm:p-5`,role:`presentation`,onClick:e=>{e.target===e.currentTarget&&N(!1)},children:(0,P.jsxs)(`section`,{ref:F,tabIndex:-1,className:`relative grid max-h-[min(calc(var(--spacing)*340),calc(100dvh-var(--spacing)*20))] w-full max-w-380 grid-cols-2 overflow-auto rounded-hero border border-glass-border-2 bg-surface-1 shadow-popout max-sm:max-h-[calc(100dvh-var(--spacing)*10)] max-sm:w-full max-sm:max-w-240 max-sm:grid-cols-1 max-sm:rounded-card`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`share-support-title`,children:[(0,P.jsx)(`button`,{type:`button`,className:`absolute top-6 right-6 z-card grid size-18 place-items-center rounded-pill border border-inner-border bg-surface-1 text-text-secondary focus-visible:outline-2 focus-visible:outline-focus-ring focus-visible:outline-offset-2`,onClick:()=>N(!1),"aria-label":`Close popup`,children:(0,P.jsx)(re,{size:18,"aria-hidden":`true`})}),K.sharePopup.hasImage?(0,P.jsx)(`img`,{className:`h-full min-h-180 w-full object-cover max-sm:h-auto max-sm:max-h-[min(52dvh,calc(var(--spacing)*210))] max-sm:min-h-0 max-sm:object-contain`,src:`/share/${r}/popup-image`,alt:``}):(0,P.jsx)(`div`,{className:`grid h-full min-h-180 w-full place-items-center bg-gradient-to-br from-orange-soft to-surface-2 text-7xl text-orange max-sm:h-[clamp(calc(var(--spacing)*85),34dvh,calc(var(--spacing)*130))] max-sm:min-h-85 max-sm:max-h-130`,"aria-hidden":`true`,children:(0,P.jsx)(`span`,{children:`♡`})}),(0,P.jsxs)(`div`,{className:`flex flex-col justify-center gap-7 p-[clamp(calc(var(--spacing)*12),5vw,calc(var(--spacing)*22))] max-sm:gap-6 max-sm:p-11`,children:[(0,P.jsx)(`h2`,{id:`share-support-title`,className:`pr-10 font-head text-display leading-tight tracking-tight wrap-anywhere`,children:K.sharePopup.title||`More information`}),K.sharePopup.body?(0,P.jsx)(`p`,{id:`share-support-message`,className:`text-body leading-loose whitespace-pre-wrap text-text-secondary wrap-anywhere`,children:K.sharePopup.body}):null,(0,P.jsx)(`div`,{className:`mt-4 flex flex-wrap items-center gap-5 [&>*]:flex-auto`,children:(0,P.jsx)(`button`,{type:`button`,className:`inline-flex min-h-21 items-center justify-center rounded-pill border border-inner-border bg-surface-2 px-8 text-caption font-bold text-text-primary no-underline hover:brightness-110 focus-visible:outline-2 focus-visible:outline-focus-ring focus-visible:outline-offset-2`,onClick:()=>N(!1),children:`Close`})})]})]})}):null,K.notes.title||K.notes.subtitle||K.notes.body?(0,P.jsxs)(b,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:[(0,P.jsxs)(`h2`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-micro font-bold tracking-label leading-normal`,children:[(0,P.jsx)(pe,{size:13,"aria-hidden":`true`}),` NOTES`]}),K.notes.title?(0,P.jsx)(`h3`,{className:`mt-5 font-head text-title font-semibold`,children:K.notes.title}):null,K.notes.subtitle?(0,P.jsx)(`p`,{className:`mt-3 text-caption font-semibold text-text-secondary`,children:K.notes.subtitle}):null,K.notes.body?(0,P.jsx)(`p`,{className:`mt-5 text-body leading-loose whitespace-pre-wrap text-text-secondary`,children:K.notes.body}):null]}):null,(0,P.jsx)(xe,{}),(0,P.jsxs)(b,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`p`,{className:`inline-flex items-center gap-3 text-text-secondary font-mono text-micro font-bold tracking-label leading-normal`,children:[(0,P.jsx)(a,{size:13,"aria-hidden":`true`}),` MODEL ACCESS`]}),(0,P.jsx)(`h2`,{className:`mt-3 font-head text-lead font-semibold tracking-tight`,children:`Allowed models`})]}),(0,P.jsxs)(`div`,{className:`inline-flex items-center gap-4`,children:[(0,P.jsxs)(`div`,{className:`inline-flex rounded-pill border border-inner-border bg-surface-2 p-1`,role:`tablist`,"aria-label":`Allowed model layout`,children:[(0,P.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":V===`raw`,className:`min-h-13 cursor-pointer rounded-pill border-0 bg-transparent px-5 font-mono text-micro font-bold tracking-label text-text-secondary uppercase hover:text-text-primary${V===`raw`?` bg-accent text-accent-foreground`:``}`,onClick:()=>H(`raw`),children:`Raw`}),(0,P.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":V===`grouped`,className:`min-h-13 cursor-pointer rounded-pill border-0 bg-transparent px-5 font-mono text-micro font-bold tracking-label text-text-secondary uppercase hover:text-text-primary${V===`grouped`?` bg-accent text-accent-foreground`:``}`,onClick:()=>H(`grouped`),children:`Grouped`})]}),K.models.length?(0,P.jsx)(_,{value:K.models.join(`, `),size:`sm`,variant:`secondary`,label:`Copy all`,copiedLabel:`Copied`,"aria-label":`Copy all granted models`}):null]})]}),Q.size?V===`raw`?(0,P.jsx)(`div`,{className:`mt-8 grid grid-cols-3 gap-4 max-wide:grid-cols-2 max-narrow:grid-cols-1`,children:K.models.map(e=>(0,P.jsx)(Me,{id:e,label:e,info:K.modelInfo?.[e],canProbe:q,probing:E.has(e),onProbe:Y,result:O.get(e)},e))}):(0,P.jsx)(`div`,{className:`mt-8 grid grid-cols-2 gap-6 min-extra-wide:grid-cols-3 max-medium:grid-cols-1`,children:[...Q].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>(0,P.jsxs)(`section`,{className:`min-w-0 overflow-hidden rounded-panel border border-inner-border bg-surface-2`,"aria-label":`${e} models`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-6 border-b border-inner-border px-6 py-5`,children:[(0,P.jsx)(`h3`,{className:`font-mono text-badge font-bold text-text-primary wrap-anywhere`,children:e}),(0,P.jsx)(`span`,{className:`rounded-pill bg-accent-soft px-4 py-1 font-mono text-micro font-bold text-accent`,children:t.length})]}),(0,P.jsx)(`div`,{className:`mt-0 grid max-h-150 grid-cols-1 gap-3 overflow-y-auto p-4`,children:t.map(t=>(0,P.jsx)(Me,{id:t,label:e===`Other`?t:t.slice(e.length+1),info:K.modelInfo?.[t],canProbe:q,probing:E.has(t),onProbe:Y,result:O.get(t)},t))})]},e))}):(0,P.jsx)(`p`,{className:`mt-8 rounded-control border border-inner-border bg-surface-2 p-7 text-caption text-text-secondary`,children:`Model access follows the share template policy.`}),K.modelPrefix?(0,P.jsxs)(`p`,{className:`mt-6 text-badge leading-normal text-text-secondary wrap-anywhere`,children:[`Required model prefix: `,K.modelPrefix]}):null]})]}):(0,P.jsx)(b,{surface:`muted`,className:`min-w-0 border-glass-border-2 bg-glass-bg backdrop-blur-md backdrop-saturate-150 p-5`,children:(0,P.jsx)(y,{children:(0,P.jsx)(de,{title:`No enrollment data`,message:`This enrollment link did not return usable policy data.`})})})})]})})}var Pe=document.getElementById(`root`);if(Pe===null)throw Error(`Share root element is missing`);(0,A.createRoot)(Pe).render((0,P.jsxs)(k.StrictMode,{children:[(0,P.jsx)(Ne,{}),(0,P.jsx)(d,{position:`top-right`,offset:{top:`1rem`,right:`1rem`},mobileOffset:{top:`1rem`,left:`1rem`,right:`1rem`},visibleToasts:2,toastOptions:{className:`toast-surface select-text`,style:{background:`var(--glass-bg-2)`,border:`1px solid var(--glass-border-2)`,color:`var(--text-primary)`,fontSize:`12.5px`},classNames:{title:`select-text`,description:`select-text`},actionButtonStyle:{background:`var(--accent)`,color:`var(--accent-foreground)`},cancelButtonStyle:{background:`var(--surface-muted)`,color:`var(--text-primary)`}}})]}));
@@ -0,0 +1 @@
1
+ import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CXUMngI_.js";import{i,n as a,r as o}from"./app-Cjq7nrwu.js";var s=e(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),c=t(n(),1),l=r(),u=`https://img.shields.io`;function d(e,t){let n=new URLSearchParams({style:`flat-square`,labelColor:`0b1220`,color:t});return`${u}/github/${e}/${a}?${n.toString()}`}function f({size:e=16}){return(0,l.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,l.jsx)(`path`,{d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z`})})}function p({size:e=15}){return(0,l.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,l.jsx)(`path`,{d:`M0 0v16h16V0H0Zm13 13h-2V5H8v8H3V3h10v10Z`})})}function m({size:e=15}){return(0,l.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,l.jsx)(`path`,{d:`m15.5 6.3-.02-.06-2.14-5.58a.56.56 0 0 0-.22-.26.57.57 0 0 0-.65.03.57.57 0 0 0-.19.29l-1.45 4.42H5.17L3.72.72A.57.57 0 0 0 3.53.43a.57.57 0 0 0-.65-.03.56.56 0 0 0-.22.26L.52 6.24l-.02.06a3.97 3.97 0 0 0 1.32 4.59l.01.01.02.02 3.25 2.44 1.61 1.22.98.74a.67.67 0 0 0 .81 0l.98-.74 1.61-1.22 3.26-2.45.01-.01a3.97 3.97 0 0 0 1.32-4.59Z`})})}function h({size:e=15}){return(0,l.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,l.jsx)(`path`,{d:`M13.55 3.02A12.6 12.6 0 0 0 10.5 2.1a8.9 8.9 0 0 0-.4.83 11.7 11.7 0 0 0-3.2 0 8.6 8.6 0 0 0-.41-.83 12.6 12.6 0 0 0-3.05.92C1.3 5.75.85 8.4 1.07 11.01a12.7 12.7 0 0 0 3.74 1.9c.3-.41.57-.85.8-1.31-.44-.17-.86-.37-1.26-.6l.31-.24a9 9 0 0 0 7.68 0l.31.24c-.4.23-.82.43-1.26.6.23.46.5.9.8 1.31a12.7 12.7 0 0 0 3.74-1.9c.26-3.03-.44-5.66-1.98-7.99ZM5.68 9.4c-.73 0-1.33-.67-1.33-1.49s.59-1.49 1.33-1.49c.74 0 1.34.68 1.33 1.49 0 .82-.59 1.49-1.33 1.49Zm4.64 0c-.73 0-1.33-.67-1.33-1.49s.59-1.49 1.33-1.49c.74 0 1.34.68 1.33 1.49 0 .82-.59 1.49-1.33 1.49Z`})})}function g({id:e,size:t}){return e===`npm`?(0,l.jsx)(p,{size:t}):e===`gitlab`?(0,l.jsx)(m,{size:t}):e===`discord`?(0,l.jsx)(h,{size:t}):(0,l.jsx)(f,{size:t})}function _({className:e=``}){let[t,n]=(0,c.useState)(!1),r=(0,c.useRef)(null),a=(0,c.useId)(),s=(0,c.useCallback)(()=>n(!1),[]);return(0,c.useEffect)(()=>{if(!t)return;let e=e=>{r.current!==null&&!r.current.contains(e.target)&&s()},n=e=>{e.key===`Escape`&&s()};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,n)}},[t,s]),(0,l.jsx)(`div`,{className:e,ref:r,children:(0,l.jsxs)(`div`,{className:`github-split`,children:[(0,l.jsxs)(`a`,{className:`github-badge`,href:o,target:`_blank`,rel:`noreferrer`,"aria-label":`Cartethyia on GitHub`,children:[(0,l.jsx)(f,{size:15}),(0,l.jsx)(`img`,{className:`github-badge-metric`,src:d(`stars`,`2ea043`),alt:`GitHub stars`,height:20,loading:`lazy`,decoding:`async`}),(0,l.jsx)(`img`,{className:`github-badge-metric`,src:d(`forks`,`1f6feb`),alt:`GitHub forks`,height:20,loading:`lazy`,decoding:`async`})]}),(0,l.jsx)(`button`,{type:`button`,className:`github-split-toggle`,"aria-haspopup":`menu`,"aria-expanded":t,"aria-controls":a,"aria-label":`More ways to get Cartethyia`,onClick:()=>n(e=>!e),children:(0,l.jsx)(`svg`,{width:12,height:12,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,l.jsx)(`path`,{d:`M8 11 3 5h10l-5 6Z`})})}),t?(0,l.jsx)(`div`,{className:`github-split-menu`,id:a,role:`menu`,"aria-label":`Source and package links`,children:i.map(e=>(0,l.jsxs)(`a`,{className:`github-split-item`,href:e.href,target:`_blank`,rel:`noreferrer`,role:`menuitem`,onClick:s,children:[(0,l.jsx)(g,{id:e.id,size:14}),(0,l.jsxs)(`span`,{className:`github-split-item-text`,children:[(0,l.jsx)(`span`,{className:`github-split-item-label`,children:e.label}),(0,l.jsx)(`span`,{className:`github-split-item-hint`,children:e.hint})]})]},e.id))}):null]})})}export{s as n,_ as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/entry-Cpi0rph1.js","assets/jsx-runtime-CXUMngI_.js","assets/app-BDJWMThu.js","assets/app-Cjgo4-Lf.css","assets/terminal-C9mZ4Ugm.js","assets/toast-DKAdP2mo.js","assets/dialog-iocKA3jr.js","assets/use-presence-BSZEBx7U.js","assets/assert-Bwh6DJTK.js","assets/query-keys-ROf-g1Wi.js","assets/mutation-BIizFZav.js","assets/useMutation-DVmwOKU-.js","assets/dialog-actions-B1axpEg7.js","assets/entry-Dm3PpDCO.js","assets/brain-Cwed_72z.js","assets/chevron-right-BXIy5l3h.js","assets/circle-check-BU3v_mFW.js","assets/eye-C_hawfH4.js","assets/github-badge-BuAJr8oU.js","assets/state-DHKdg-pm.js","assets/key-round-UkavsGxp.js","assets/clipboard-button-DQmMikNQ.js","assets/check-D69FzdvC.js","assets/copy-ngmQ9zcZ.js","assets/use-clipboard-B0Sy03fE.js","assets/scaling-nWE4Cx8f.js","assets/wrench-B6E1oEuY.js","assets/card-BTdbRFFg.js","assets/download-dRFo5_Wu.js","assets/tokens-DDxMbSRL.js","assets/numbers-CFL4_Dqc.js","assets/stream-retry-5QnVuSSo.js","assets/entry-keNDZ_Wz.js","assets/arrow-right-Dl5yKnp8.js","assets/message-circle-CCxGwRvv.js","assets/shield-check-DVS0Foqh.js","assets/sparkles-BRaRUxAU.js","assets/use-reduced-motion-C4B0R6Sz.js"])))=>i.map(i=>d[i]);
2
- (function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function e(e){return e===`/share`||e.startsWith(`/share/`)?`share`:e===`/console`||e.startsWith(`/console/`)?`console`:`landing`}var t=`modulepreload`,n=function(e){return`/`+e},r={},i=function(e,i,a){let o=Promise.resolve();if(i&&i.length>0){let e=document.getElementsByTagName(`link`),s=document.querySelector(`meta[property=csp-nonce]`),c=s?.nonce||s?.getAttribute(`nonce`);function l(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function u(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}o=l(i.map(i=>{if(i=n(i,a),i=u(i),i in r)return;r[i]=!0;let o=i.endsWith(`.css`);for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.href===i&&(!o||n.rel===`stylesheet`))return}let s=document.createElement(`link`);if(s.rel=o?`stylesheet`:t,o||(s.as=`script`),s.crossOrigin=``,s.href=i,c&&s.setAttribute(`nonce`,c),document.head.appendChild(s),o)return new Promise((e,t)=>{s.addEventListener(`load`,e),s.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${i}`)))})}))}function s(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return o.then(t=>{for(let e of t||[])e.status===`rejected`&&s(e.reason);return e().catch(s)})},a=document.getElementById(`root`);if(a===null)throw Error(`Dashboard root element is missing`);var o=e(window.location.pathname);o===`console`?i(async()=>{let{mountConsole:e}=await import(`./entry-Cpi0rph1.js`);return{mountConsole:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(({mountConsole:e})=>e(a)):o===`share`?i(()=>import(`./entry-Dm3PpDCO.js`).then(()=>void 0),__vite__mapDeps([13,1,2,3,14,15,16,5,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31])):i(async()=>{let{mountLanding:e}=await import(`./entry-keNDZ_Wz.js`);return{mountLanding:e}},__vite__mapDeps([32,1,2,3,4,33,18,34,35,36,37])).then(({mountLanding:e})=>e(a));export{i as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/entry-7dpgvpJ3.js","assets/jsx-runtime-CXUMngI_.js","assets/app-Cjq7nrwu.js","assets/app-BLCvGdzb.css","assets/terminal-Bd4ee8TA.js","assets/toast-C76WrMhc.js","assets/dialog-BWIP_EvW.js","assets/use-presence-BSZEBx7U.js","assets/assert-7J6_LVD3.js","assets/query-keys-D7wX2vM5.js","assets/mutation-BkoLM5Ba.js","assets/useMutation-D87FZwH0.js","assets/dialog-actions-B1axpEg7.js","assets/entry-kTiTFrvh.js","assets/brain-Cwed_72z.js","assets/chevron-right-BXIy5l3h.js","assets/circle-check-BU3v_mFW.js","assets/eye-C_hawfH4.js","assets/github-badge-Booc5mNe.js","assets/state-CzUPfLXo.js","assets/key-round-UkavsGxp.js","assets/clipboard-button-R_rArH8S.js","assets/check-D69FzdvC.js","assets/copy-ngmQ9zcZ.js","assets/use-clipboard-B0Sy03fE.js","assets/scaling-nWE4Cx8f.js","assets/wrench-B6E1oEuY.js","assets/card-B0Bnx5CA.js","assets/download-dRFo5_Wu.js","assets/tokens-DDxMbSRL.js","assets/numbers-CFL4_Dqc.js","assets/stream-retry-5QnVuSSo.js","assets/entry-CcWkGR4a.js","assets/arrow-right-Dl5yKnp8.js","assets/log-in-BmRjy60c.js","assets/message-circle-CCxGwRvv.js","assets/shield-check-DVS0Foqh.js","assets/sparkles-BRaRUxAU.js","assets/use-reduced-motion-C4B0R6Sz.js"])))=>i.map(i=>d[i]);
2
+ (function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function e(e){return e===`/share`||e.startsWith(`/share/`)?`share`:e===`/console`||e.startsWith(`/console/`)?`console`:`landing`}var t=`modulepreload`,n=function(e){return`/`+e},r={},i=function(e,i,a){let o=Promise.resolve();if(i&&i.length>0){let e=document.getElementsByTagName(`link`),s=document.querySelector(`meta[property=csp-nonce]`),c=s?.nonce||s?.getAttribute(`nonce`);function l(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function u(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}o=l(i.map(i=>{if(i=n(i,a),i=u(i),i in r)return;r[i]=!0;let o=i.endsWith(`.css`);for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.href===i&&(!o||n.rel===`stylesheet`))return}let s=document.createElement(`link`);if(s.rel=o?`stylesheet`:t,o||(s.as=`script`),s.crossOrigin=``,s.href=i,c&&s.setAttribute(`nonce`,c),document.head.appendChild(s),o)return new Promise((e,t)=>{s.addEventListener(`load`,e),s.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${i}`)))})}))}function s(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return o.then(t=>{for(let e of t||[])e.status===`rejected`&&s(e.reason);return e().catch(s)})},a=document.getElementById(`root`);if(a===null)throw Error(`Dashboard root element is missing`);var o=e(window.location.pathname);o===`console`?i(async()=>{let{mountConsole:e}=await import(`./entry-7dpgvpJ3.js`);return{mountConsole:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(({mountConsole:e})=>e(a)):o===`share`?i(()=>import(`./entry-kTiTFrvh.js`).then(()=>void 0),__vite__mapDeps([13,1,2,3,14,15,16,5,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31])):i(async()=>{let{mountLanding:e}=await import(`./entry-CcWkGR4a.js`);return{mountLanding:e}},__vite__mapDeps([32,1,2,3,4,33,18,34,35,36,37,38])).then(({mountLanding:e})=>e(a));export{i as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-CXUMngI_.js";import{i as t}from"./toast-DKAdP2mo.js";import{r as n}from"./stack-C1kTcOmP.js";var r=e(),i={center:`items-center`,start:`items-start`,end:`items-end`,"flex-start":`items-start`,"flex-end":`items-end`,baseline:`items-baseline`,stretch:`items-stretch`},a={center:`justify-center`,start:`justify-start`,end:`justify-end`,"flex-start":`justify-start`,"flex-end":`justify-end`,"space-between":`justify-between`,"space-around":`justify-around`,"space-evenly":`justify-evenly`};function o({children:e,gap:t=3,gapRaw:n,align:i=`center`,justify:a,wrap:o=!0,style:c,className:l=``}){return(0,r.jsx)(s,{gap:t,gapRaw:n,align:i,justify:a,wrap:o,style:c,className:l,children:e})}function s({children:e,gap:o=4,gapRaw:s,align:c=`center`,justify:l,wrap:u=!1,style:d,className:f=``}){let p=n(o,4);return(0,r.jsx)(`div`,{className:t(`flex flex-row`,i[c??``]??``,a[l??``]??``,u&&`flex-wrap`,s===void 0?p:null,f),style:s===void 0?d:{gap:s,...d},children:e})}export{s as n,o as t};
1
+ import{t as e}from"./jsx-runtime-CXUMngI_.js";import{a as t}from"./toast-C76WrMhc.js";import{r as n}from"./stack-Ca5HxI5i.js";var r=e(),i={center:`items-center`,start:`items-start`,end:`items-end`,"flex-start":`items-start`,"flex-end":`items-end`,baseline:`items-baseline`,stretch:`items-stretch`},a={center:`justify-center`,start:`justify-start`,end:`justify-end`,"flex-start":`justify-start`,"flex-end":`justify-end`,"space-between":`justify-between`,"space-around":`justify-around`,"space-evenly":`justify-evenly`};function o({children:e,gap:t=3,gapRaw:n,align:i=`center`,justify:a,wrap:o=!0,style:c,className:l=``}){return(0,r.jsx)(s,{gap:t,gapRaw:n,align:i,justify:a,wrap:o,style:c,className:l,children:e})}function s({children:e,gap:o=4,gapRaw:s,align:c=`center`,justify:l,wrap:u=!1,style:d,className:f=``}){let p=n(o,4);return(0,r.jsx)(`div`,{className:t(`flex flex-row`,i[c??``]??``,a[l??``]??``,u&&`flex-wrap`,s===void 0?p:null,f),style:s===void 0?d:{gap:s,...d},children:e})}export{s as n,o as t};
@@ -1 +1 @@
1
- import{o as e,r as t,t as n}from"./jsx-runtime-CXUMngI_.js";import{i as r}from"./toast-DKAdP2mo.js";import{t as i}from"./eye-off-Bk5g2luF.js";import{t as a}from"./eye-C_hawfH4.js";var o=e(t(),1),s=n(),c=`w-full rounded-control border border-inner-border bg-surface-2 text-text-primary px-6 py-4 text-body outline-none transition-[border-color,box-shadow] duration-(--dur-micro) ease-spring focus:border-accent focus:shadow-focus`,l=(0,o.forwardRef)(({label:e,hint:t,error:n,id:l,type:u,className:d=``,showPasswordToggle:f,...p},m)=>{let h=u===`password`,g=h||f,[_,v]=(0,o.useState)(!1);return(0,s.jsxs)(`div`,{className:`form-group flex w-full flex-col gap-3`,children:[e?(0,s.jsxs)(`label`,{htmlFor:l,className:`form-label flex items-center justify-between text-caption font-semibold text-text-primary`,children:[(0,s.jsx)(`span`,{children:e}),t?(0,s.jsx)(`span`,{className:`form-hint text-badge font-normal text-text-tertiary`,children:t}):null]}):null,(0,s.jsxs)(`div`,{className:`relative flex items-center w-full`,children:[(0,s.jsx)(`input`,{ref:m,id:l,type:h?_?`text`:`password`:u,className:r(`form-input`,c,g&&`pr-18`,d),...p}),g?(0,s.jsx)(`button`,{type:`button`,onClick:()=>v(e=>!e),"aria-label":_?`Hide password`:`Show password`,"aria-pressed":_,className:`absolute right-5 bg-transparent border-none text-text-tertiary cursor-pointer p-1 inline-flex items-center justify-center`,children:_?(0,s.jsx)(i,{size:16}):(0,s.jsx)(a,{size:16})}):null]}),n?(0,s.jsx)(`p`,{className:`form-error mt-2 text-badge text-red`,role:`alert`,children:n}):null]})});l.displayName=`Input`;var u=(0,o.forwardRef)(({className:e,...t},n)=>(0,s.jsx)(`input`,{ref:n,type:`file`,className:r(`form-file-input box-border min-w-0 h-16 flex-auto cursor-pointer rounded-control border border-inner-border bg-surface-2 py-0 pl-0 pr-2 font-sans text-badge text-text-secondary transition-colors duration-(--dur-micro) ease-standard enabled:hover:border-border-strong focus-visible:outline-2 focus-visible:outline-focus-ring focus-visible:outline-offset-1 disabled:cursor-not-allowed disabled:opacity-60`,`file:h-full file:mr-4 file:px-5 file:py-0 file:rounded-l-control file:rounded-r-none file:border-0 file:border-r file:border-inner-border file:bg-surface-1 file:font-sans file:text-badge file:font-semibold file:text-text-primary file:cursor-pointer disabled:file:cursor-not-allowed file:hover:bg-surface-hover`,e),...t}));u.displayName=`FileInput`;var d=(0,o.forwardRef)(({label:e,hint:t,error:n,id:i,className:a=``,...o},l)=>(0,s.jsxs)(`div`,{className:`form-group flex w-full flex-col gap-3`,children:[e?(0,s.jsxs)(`label`,{htmlFor:i,className:`form-label flex items-center justify-between text-caption font-semibold text-text-primary`,children:[(0,s.jsx)(`span`,{children:e}),t?(0,s.jsx)(`span`,{className:`form-hint text-badge font-normal text-text-tertiary`,children:t}):null]}):null,(0,s.jsx)(`textarea`,{ref:l,id:i,className:r(`form-textarea`,c,a),...o}),n?(0,s.jsx)(`p`,{className:`form-error mt-2 text-badge text-red`,role:`alert`,children:n}):null]}));d.displayName=`Textarea`;export{l as n,d as r,u as t};
1
+ import{o as e,r as t,t as n}from"./jsx-runtime-CXUMngI_.js";import{a as r}from"./toast-C76WrMhc.js";import{t as i}from"./eye-off-Bk5g2luF.js";import{t as a}from"./eye-C_hawfH4.js";var o=e(t(),1),s=n(),c=`w-full rounded-control border border-inner-border bg-surface-2 text-text-primary px-6 py-4 text-body outline-none transition-[border-color,box-shadow] duration-(--dur-micro) ease-spring focus:border-accent focus:shadow-focus`,l=(0,o.forwardRef)(({label:e,hint:t,error:n,id:l,type:u,className:d=``,showPasswordToggle:f,...p},m)=>{let h=u===`password`,g=h||f,[_,v]=(0,o.useState)(!1);return(0,s.jsxs)(`div`,{className:`form-group flex w-full flex-col gap-3`,children:[e?(0,s.jsxs)(`label`,{htmlFor:l,className:`form-label flex items-center justify-between text-caption font-semibold text-text-primary`,children:[(0,s.jsx)(`span`,{children:e}),t?(0,s.jsx)(`span`,{className:`form-hint text-badge font-normal text-text-tertiary`,children:t}):null]}):null,(0,s.jsxs)(`div`,{className:`relative flex items-center w-full`,children:[(0,s.jsx)(`input`,{ref:m,id:l,type:h?_?`text`:`password`:u,className:r(`form-input`,c,g&&`pr-18`,d),...p}),g?(0,s.jsx)(`button`,{type:`button`,onClick:()=>v(e=>!e),"aria-label":_?`Hide password`:`Show password`,"aria-pressed":_,className:`absolute right-5 bg-transparent border-none text-text-tertiary cursor-pointer p-1 inline-flex items-center justify-center`,children:_?(0,s.jsx)(i,{size:16}):(0,s.jsx)(a,{size:16})}):null]}),n?(0,s.jsx)(`p`,{className:`form-error mt-2 text-badge text-red`,role:`alert`,children:n}):null]})});l.displayName=`Input`;var u=(0,o.forwardRef)(({className:e,...t},n)=>(0,s.jsx)(`input`,{ref:n,type:`file`,className:r(`form-file-input box-border min-w-0 h-16 flex-auto cursor-pointer rounded-control border border-inner-border bg-surface-2 py-0 pl-0 pr-2 font-sans text-badge text-text-secondary transition-colors duration-(--dur-micro) ease-standard enabled:hover:border-border-strong focus-visible:outline-2 focus-visible:outline-focus-ring focus-visible:outline-offset-1 disabled:cursor-not-allowed disabled:opacity-60`,`file:h-full file:mr-4 file:px-5 file:py-0 file:rounded-l-control file:rounded-r-none file:border-0 file:border-r file:border-inner-border file:bg-surface-1 file:font-sans file:text-badge file:font-semibold file:text-text-primary file:cursor-pointer disabled:file:cursor-not-allowed file:hover:bg-surface-hover`,e),...t}));u.displayName=`FileInput`;var d=(0,o.forwardRef)(({label:e,hint:t,error:n,id:i,className:a=``,...o},l)=>(0,s.jsxs)(`div`,{className:`form-group flex w-full flex-col gap-3`,children:[e?(0,s.jsxs)(`label`,{htmlFor:i,className:`form-label flex items-center justify-between text-caption font-semibold text-text-primary`,children:[(0,s.jsx)(`span`,{children:e}),t?(0,s.jsx)(`span`,{className:`form-hint text-badge font-normal text-text-tertiary`,children:t}):null]}):null,(0,s.jsx)(`textarea`,{ref:l,id:i,className:r(`form-textarea`,c,a),...o}),n?(0,s.jsx)(`p`,{className:`form-error mt-2 text-badge text-red`,role:`alert`,children:n}):null]}));d.displayName=`Textarea`;export{l as n,d as r,u as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-CXUMngI_.js";import{i as t}from"./toast-DKAdP2mo.js";var n=e();function r({eyebrow:e,title:r,description:i,action:a,icon:o,level:s=2}){let c=!!(e||r||i),l=s===1?`h1`:s===3?`h3`:`h2`;return(0,n.jsxs)(`div`,{className:t(`section-header flex items-center justify-between gap-6 max-small:flex-col max-small:items-start max-small:gap-4`,c?void 0:`justify-end`),children:[c?(0,n.jsxs)(`div`,{className:`section-header-text min-w-0`,children:[e?(0,n.jsx)(`p`,{className:`text-badge font-bold uppercase tracking-label text-text-tertiary mb-1`,children:e}):null,r?(0,n.jsx)(l,{className:`font-head text-title font-bold tracking-[-0.02em] text-text-primary`,children:r}):null,i?(0,n.jsx)(`p`,{className:`mt-1 text-caption text-text-secondary`,children:i}):null]}):null,o?(0,n.jsx)(`div`,{className:`card-header-icon grid size-14 shrink-0 place-items-center rounded-pill bg-accent-soft text-accent [&_svg]:size-7.5`,children:o}):null,a?(0,n.jsx)(`div`,{className:`section-header-action max-small:w-full max-small:[&_button]:w-full`,children:a}):null]})}function i({label:e,value:r,detail:i,icon:a,tone:o,status:s,valueColor:c,action:l,size:u=`default`}){let d={teal:`text-teal`,purple:`text-accent`,green:`text-green`,orange:`text-orange`,red:`text-red`,accent:`text-accent`}[o||(s===`cooldown`?`orange`:s===`disabled`?`red`:`accent`)]??`text-accent`;return(0,n.jsxs)(`div`,{className:t(`stat-card min-w-0 border border-inner-border rounded-card bg-surface-2`,u===`roomy`?`p-9`:`p-6`),children:[(0,n.jsxs)(`div`,{className:t(`flex items-center justify-between gap-4 font-bold uppercase tracking-label`,u===`roomy`?`text-caption`:`text-micro`,d),children:[(0,n.jsxs)(`span`,{className:`inline-flex items-center gap-4 min-w-0`,children:[a,(0,n.jsx)(`span`,{children:e})]}),l?(0,n.jsx)(`span`,{className:`shrink-0`,children:l}):null]}),(0,n.jsx)(`p`,{className:t(`font-mono tabular-nums font-bold leading-[1.15] mb-0`,u===`roomy`?`text-hero mt-4`:`text-display mt-1`),style:c?{color:c}:void 0,children:r}),(0,n.jsx)(`span`,{className:t(`stat-card-detail line-clamp-2 wrap-anywhere text-text-secondary`,u===`roomy`?`mt-2 text-body`:`text-badge`),children:i})]})}function a({headers:e,children:r,maxHeight:i,onScroll:a,sortKey:o,sortDirection:s,onSort:c,scrollRegion:l=!1,dense:u=!1}){return(0,n.jsx)(`div`,{className:t(`data-table-container`,l&&`scroll-region`),style:i?{maxHeight:i,overflowY:`auto`}:void 0,onScroll:a,children:(0,n.jsxs)(`table`,{className:t(`data-table text-caption`,u&&`text-badge [&_th]:px-4 [&_th]:py-2.5 [&_td]:px-4 [&_td]:py-2.5 [&_th]:text-text-secondary [&_th]:font-semibold [&_th]:normal-case [&_th]:tracking-normal [&_td]:tabular-nums`),children:[(0,n.jsx)(`thead`,{children:(0,n.jsx)(`tr`,{children:e.map(e=>{let r=typeof e==`string`?e:e.key,i=typeof e==`string`?e:e.label,a=typeof e!=`string`&&e.sortable===!0&&c!==void 0,l=o===r;return(0,n.jsx)(`th`,{scope:`col`,"aria-sort":l?s===`asc`?`ascending`:`descending`:void 0,children:a?(0,n.jsxs)(`button`,{type:`button`,onClick:()=>c(r),title:`Sort by ${i}`,className:`inline-flex items-center gap-2 cursor-pointer`,children:[(0,n.jsx)(`span`,{children:i}),(0,n.jsx)(`span`,{"aria-hidden":`true`,className:t(`text-micro`,l?`opacity-100`:`opacity-[0.35]`),children:l?s===`asc`?`▲`:`▼`:`△`})]}):i},r)})})}),(0,n.jsx)(`tbody`,{children:r})]})})}export{r as n,i as r,a as t};
1
+ import{t as e}from"./jsx-runtime-CXUMngI_.js";import{a as t}from"./toast-C76WrMhc.js";var n=e();function r({eyebrow:e,title:r,description:i,action:a,icon:o,level:s=2}){let c=!!(e||r||i),l=s===1?`h1`:s===3?`h3`:`h2`;return(0,n.jsxs)(`div`,{className:t(`section-header flex items-center justify-between gap-6 max-small:flex-col max-small:items-start max-small:gap-4`,c?void 0:`justify-end`),children:[c?(0,n.jsxs)(`div`,{className:`section-header-text min-w-0`,children:[e?(0,n.jsx)(`p`,{className:`text-badge font-bold uppercase tracking-label text-text-tertiary mb-1`,children:e}):null,r?(0,n.jsx)(l,{className:`font-head text-title font-bold tracking-[-0.02em] text-text-primary`,children:r}):null,i?(0,n.jsx)(`p`,{className:`mt-1 text-caption text-text-secondary`,children:i}):null]}):null,o?(0,n.jsx)(`div`,{className:`card-header-icon grid size-14 shrink-0 place-items-center rounded-pill bg-accent-soft text-accent [&_svg]:size-7.5`,children:o}):null,a?(0,n.jsx)(`div`,{className:`section-header-action max-small:w-full max-small:[&_button]:w-full`,children:a}):null]})}function i({label:e,value:r,detail:i,icon:a,tone:o,status:s,valueColor:c,action:l,size:u=`default`}){let d={teal:`text-teal`,purple:`text-accent`,green:`text-green`,orange:`text-orange`,red:`text-red`,accent:`text-accent`}[o||(s===`cooldown`?`orange`:s===`disabled`?`red`:`accent`)]??`text-accent`;return(0,n.jsxs)(`div`,{className:t(`stat-card min-w-0 border border-inner-border rounded-card bg-surface-2`,u===`roomy`?`p-9`:`p-6`),children:[(0,n.jsxs)(`div`,{className:t(`flex items-center justify-between gap-4 font-bold uppercase tracking-label`,u===`roomy`?`text-caption`:`text-micro`,d),children:[(0,n.jsxs)(`span`,{className:`inline-flex items-center gap-4 min-w-0`,children:[a,(0,n.jsx)(`span`,{children:e})]}),l?(0,n.jsx)(`span`,{className:`shrink-0`,children:l}):null]}),(0,n.jsx)(`p`,{className:t(`font-mono tabular-nums font-bold leading-[1.15] mb-0`,u===`roomy`?`text-hero mt-4`:`text-display mt-1`),style:c?{color:c}:void 0,children:r}),(0,n.jsx)(`span`,{className:t(`stat-card-detail line-clamp-2 wrap-anywhere text-text-secondary`,u===`roomy`?`mt-2 text-body`:`text-badge`),children:i})]})}function a({headers:e,children:r,maxHeight:i,onScroll:a,sortKey:o,sortDirection:s,onSort:c,scrollRegion:l=!1,dense:u=!1}){return(0,n.jsx)(`div`,{className:t(`data-table-container`,l&&`scroll-region`),style:i?{maxHeight:i,overflowY:`auto`}:void 0,onScroll:a,children:(0,n.jsxs)(`table`,{className:t(`data-table text-caption`,u&&`text-badge [&_th]:px-4 [&_th]:py-2.5 [&_td]:px-4 [&_td]:py-2.5 [&_th]:text-text-secondary [&_th]:font-semibold [&_th]:normal-case [&_th]:tracking-normal [&_td]:tabular-nums`),children:[(0,n.jsx)(`thead`,{children:(0,n.jsx)(`tr`,{children:e.map(e=>{let r=typeof e==`string`?e:e.key,i=typeof e==`string`?e:e.label,a=typeof e!=`string`&&e.sortable===!0&&c!==void 0,l=o===r;return(0,n.jsx)(`th`,{scope:`col`,"aria-sort":l?s===`asc`?`ascending`:`descending`:void 0,children:a?(0,n.jsxs)(`button`,{type:`button`,onClick:()=>c(r),title:`Sort by ${i}`,className:`inline-flex items-center gap-2 cursor-pointer`,children:[(0,n.jsx)(`span`,{children:i}),(0,n.jsx)(`span`,{"aria-hidden":`true`,className:t(`text-micro`,l?`opacity-100`:`opacity-[0.35]`),children:l?s===`asc`?`▲`:`▼`:`△`})]}):i},r)})})}),(0,n.jsx)(`tbody`,{children:r})]})})}export{r as n,i as r,a as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-CXUMngI_.js";import{i as t}from"./toast-DKAdP2mo.js";var n=e();function r({children:e,leading:r,actions:i,density:a=`default`,className:o=``,...s}){return(0,n.jsxs)(`div`,{className:t(`list-row flex items-center gap-6 rounded-control border border-inner-border bg-surface-2 min-w-0 px-7 py-5`,a===`compact`&&`list-row-compact px-5 py-3 rounded-inset gap-4`,o),...s,children:[r?(0,n.jsx)(`div`,{className:`list-row-leading shrink-0`,children:r}):null,(0,n.jsx)(`div`,{className:`list-row-body flex-1 min-w-0 flex flex-col gap-2`,children:e}),i?(0,n.jsx)(`div`,{className:`list-row-actions flex items-center gap-2 shrink-0 flex-wrap`,children:i}):null]})}export{r as t};
1
+ import{t as e}from"./jsx-runtime-CXUMngI_.js";import{a as t}from"./toast-C76WrMhc.js";var n=e();function r({children:e,leading:r,actions:i,density:a=`default`,className:o=``,...s}){return(0,n.jsxs)(`div`,{className:t(`list-row flex items-center gap-6 rounded-control border border-inner-border bg-surface-2 min-w-0 px-7 py-5`,a===`compact`&&`list-row-compact px-5 py-3 rounded-inset gap-4`,o),...s,children:[r?(0,n.jsx)(`div`,{className:`list-row-leading shrink-0`,children:r}):null,(0,n.jsx)(`div`,{className:`list-row-body flex-1 min-w-0 flex flex-col gap-2`,children:e}),i?(0,n.jsx)(`div`,{className:`list-row-actions flex items-center gap-2 shrink-0 flex-wrap`,children:i}):null]})}export{r as t};
@@ -1 +1 @@
1
- import{o as e,r as t}from"./jsx-runtime-CXUMngI_.js";import{w as n}from"./assert-Bwh6DJTK.js";import{a as r,l as i,t as a}from"./query-keys-ROf-g1Wi.js";import{t as o}from"./stream-retry-5QnVuSSo.js";var s=e(t(),1);function c(e){if(!i(e)||typeof e.inFlight!=`number`||!Number.isFinite(e.inFlight))return null;let t=Math.max(0,Math.floor(e.inFlight));return{count:t,uniqueIps:typeof e.uniqueIps==`number`&&Number.isFinite(e.uniqueIps)?Math.max(0,Math.min(t,Math.floor(e.uniqueIps))):t}}function l(){let[e,t]=(0,s.useState)(null),[n,i]=(0,s.useState)(null),[a,l]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let e=!1,n,a,s=0,u=async()=>{let d=++s;try{let f=await r(`/live/in-flight`);if(e||d!==s)return;let p=c(f);p!==null&&(t(p.count),i(p.uniqueIps));let m=new EventSource(`/console/api/live/in-flight/stream`);n=m,m.addEventListener(`count`,n=>{if(!(e||d!==s))try{let e=c(JSON.parse(n.data));e!==null&&(t(e.count),i(e.uniqueIps),l(!0))}catch{}}),m.onerror=()=>{e||d!==s||(m.close(),n===m&&(n=void 0),l(!1),a=setTimeout(()=>{e||u()},o))}}catch{!e&&d===s&&(l(!1),a=setTimeout(()=>{e||u()},o))}};return u(),()=>{e=!0,s+=1,a!==void 0&&clearTimeout(a),n?.close()}},[]),{count:e,uniqueIps:n,live:a}}function u(e){if(!i(e)||!Array.isArray(e.pools))return null;let t=[];for(let n of e.pools){if(!i(n)||typeof n.poolId!=`string`)continue;let e=typeof n.currentInflight==`number`&&Number.isFinite(n.currentInflight)?Math.max(0,Math.floor(n.currentInflight)):0,r=e=>typeof e==`number`&&Number.isFinite(e)&&e>0?Math.floor(e):0;t.push({poolId:n.poolId,currentInflight:e,bytesSent:r(n.bytesSent),bytesReceived:r(n.bytesReceived)})}return t}function d(e){for(;e.size>500;){let t=e.keys().next().value;if(t===void 0)break;e.delete(t)}}function f(e,t){let n=new Set,r=[];for(let i of t){n.add(i.poolId);let t=e.get(i.poolId),a=t?{poolId:i.poolId,currentInflight:i.currentInflight,bytesSent:Math.max(t.bytesSent,i.bytesSent),bytesReceived:Math.max(t.bytesReceived,i.bytesReceived)}:i;e.set(i.poolId,a),r.push(a)}d(e);for(let[t,i]of e)n.has(t)||r.push(i);return r}function p(){let e=n(),[t,i]=(0,s.useState)(null),[c,l]=(0,s.useState)(!1),d=(0,s.useState)(()=>new Map)[0];return(0,s.useEffect)(()=>{let t=!1,n,s,c=()=>{n=new EventSource(`/console/api/live/pools/stream`),n.addEventListener(`pools`,e=>{if(!t)try{let t=u(JSON.parse(e.data));t!==null&&(i(f(d,t)),l(!0))}catch{}}),n.addEventListener(`health`,()=>{t||e.invalidateQueries({queryKey:a.network.pools})}),n.onerror=()=>{n?.close(),!t&&(l(!1),s=setTimeout(()=>{t||p()},o))}},p=async()=>{try{let e=await r(`/live/pools`);if(t)return;let n=u(e);n!==null&&i(f(d,n)),c()}catch{}};return p(),()=>{t=!0,s!==void 0&&clearTimeout(s),n?.close()}},[e]),{pools:t,live:c}}export{p as n,l as t};
1
+ import{o as e,r as t}from"./jsx-runtime-CXUMngI_.js";import{w as n}from"./assert-7J6_LVD3.js";import{o as r,t as i,u as a}from"./query-keys-D7wX2vM5.js";import{t as o}from"./stream-retry-5QnVuSSo.js";var s=e(t(),1);function c(e){if(!a(e)||typeof e.inFlight!=`number`||!Number.isFinite(e.inFlight))return null;let t=Math.max(0,Math.floor(e.inFlight));return{count:t,uniqueIps:typeof e.uniqueIps==`number`&&Number.isFinite(e.uniqueIps)?Math.max(0,Math.min(t,Math.floor(e.uniqueIps))):t}}function l(){let[e,t]=(0,s.useState)(null),[n,i]=(0,s.useState)(null),[a,l]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let e=!1,n,a,s=0,u=async()=>{let d=++s;try{let f=await r(`/live/in-flight`);if(e||d!==s)return;let p=c(f);p!==null&&(t(p.count),i(p.uniqueIps));let m=new EventSource(`/console/api/live/in-flight/stream`);n=m,m.addEventListener(`count`,n=>{if(!(e||d!==s))try{let e=c(JSON.parse(n.data));e!==null&&(t(e.count),i(e.uniqueIps),l(!0))}catch{}}),m.onerror=()=>{e||d!==s||(m.close(),n===m&&(n=void 0),l(!1),a=setTimeout(()=>{e||u()},o))}}catch{!e&&d===s&&(l(!1),a=setTimeout(()=>{e||u()},o))}};return u(),()=>{e=!0,s+=1,a!==void 0&&clearTimeout(a),n?.close()}},[]),{count:e,uniqueIps:n,live:a}}function u(e){if(!a(e)||!Array.isArray(e.pools))return null;let t=[];for(let n of e.pools){if(!a(n)||typeof n.poolId!=`string`)continue;let e=typeof n.currentInflight==`number`&&Number.isFinite(n.currentInflight)?Math.max(0,Math.floor(n.currentInflight)):0,r=e=>typeof e==`number`&&Number.isFinite(e)&&e>0?Math.floor(e):0;t.push({poolId:n.poolId,currentInflight:e,bytesSent:r(n.bytesSent),bytesReceived:r(n.bytesReceived)})}return t}function d(e){for(;e.size>500;){let t=e.keys().next().value;if(t===void 0)break;e.delete(t)}}function f(e,t){let n=new Set,r=[];for(let i of t){n.add(i.poolId);let t=e.get(i.poolId),a=t?{poolId:i.poolId,currentInflight:i.currentInflight,bytesSent:Math.max(t.bytesSent,i.bytesSent),bytesReceived:Math.max(t.bytesReceived,i.bytesReceived)}:i;e.set(i.poolId,a),r.push(a)}d(e);for(let[t,i]of e)n.has(t)||r.push(i);return r}function p(){let e=n(),[t,a]=(0,s.useState)(null),[c,l]=(0,s.useState)(!1),d=(0,s.useState)(()=>new Map)[0];return(0,s.useEffect)(()=>{let t=!1,n,s,c=()=>{n=new EventSource(`/console/api/live/pools/stream`),n.addEventListener(`pools`,e=>{if(!t)try{let t=u(JSON.parse(e.data));t!==null&&(a(f(d,t)),l(!0))}catch{}}),n.addEventListener(`health`,()=>{t||e.invalidateQueries({queryKey:i.network.pools})}),n.onerror=()=>{n?.close(),!t&&(l(!1),s=setTimeout(()=>{t||p()},o))}},p=async()=>{try{let e=await r(`/live/pools`);if(t)return;let n=u(e);n!==null&&a(f(d,n)),c()}catch{}};return p(),()=>{t=!0,s!==void 0&&clearTimeout(s),n?.close()}},[e]),{pools:t,live:c}}export{p as n,l as t};
@@ -1 +1 @@
1
- import{n as e}from"./jsx-runtime-CXUMngI_.js";import{S as t,_ as n,a as r,w as i}from"./assert-Bwh6DJTK.js";import{a,n as o,r as s,t as c}from"./query-keys-ROf-g1Wi.js";import{t as l}from"./useMutation-DVmwOKU-.js";var u=e(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),d=e(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),f=e(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]);function p(e){return t({queryKey:c.modelBans.all,queryFn:e=>a(`/model-bans`,{signal:n(e)}).then(r),enabled:e,...s})}function m(){let e=i();return l({mutationFn:e=>a(`/model-bans`,{method:`DELETE`,body:JSON.stringify({identity:e})}),...o,onSuccess:async()=>{await e.invalidateQueries({queryKey:c.modelBans.all})}})}function h(){let e=i();return l({mutationFn:e=>a(`/model-bans`,{method:`POST`,body:JSON.stringify({ip:e})}),...o,onSuccess:async()=>{await e.invalidateQueries({queryKey:c.modelBans.all})}})}export{d as a,f as i,p as n,u as o,m as r,h as t};
1
+ import{n as e}from"./jsx-runtime-CXUMngI_.js";import{S as t,_ as n,a as r,w as i}from"./assert-7J6_LVD3.js";import{i as a,o,r as s,t as c}from"./query-keys-D7wX2vM5.js";import{t as l}from"./useMutation-D87FZwH0.js";var u=e(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),d=e(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),f=e(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]);function p(e){return t({queryKey:c.modelBans.all,queryFn:e=>o(`/model-bans`,{signal:n(e)}).then(r),enabled:e,...a})}function m(){let e=i();return l({mutationFn:e=>o(`/model-bans`,{method:`DELETE`,body:JSON.stringify({identity:e})}),...s,onSuccess:async()=>{await e.invalidateQueries({queryKey:c.modelBans.all})}})}function h(){let e=i();return l({mutationFn:e=>o(`/model-bans`,{method:`POST`,body:JSON.stringify({ip:e})}),...s,onSuccess:async()=>{await e.invalidateQueries({queryKey:c.modelBans.all})}})}export{d as a,f as i,p as n,u as o,m as r,h as t};
@@ -0,0 +1 @@
1
+ import{h as e,m as t,v as n}from"./query-keys-D7wX2vM5.js";var r=class extends t{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||i(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(t){let n=()=>{this.#i({type:`continue`})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},i=this.#r=e({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),a=this.state.status===`pending`,o=!i.canStart();try{if(a)n();else{this.#i({type:`pending`,variables:t,isPaused:o}),this.#n.config.onMutate&&await this.#n.config.onMutate(t,this,r);let e=await this.options.onMutate?.(t,r);e!==this.state.context&&this.#i({type:`pending`,context:e,variables:t,isPaused:o})}let e=await i.start();return await this.#n.config.onSuccess?.(e,t,this.state.context,this,r),await this.options.onSuccess?.(e,t,this.state.context,r),await this.#n.config.onSettled?.(e,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(e,null,t,this.state.context,r),this.#i({type:`success`,data:e}),e}catch(e){try{await this.#n.config.onError?.(e,t,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onError?.(e,t,this.state.context,r)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,e,this.state.variables,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,e,t,this.state.context,r)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:e}),e}finally{this.#r===i&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),n.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function i(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}export{i as n,r as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./jsx-runtime-CXUMngI_.js";var t=e(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{o as e,r as t}from"./jsx-runtime-CXUMngI_.js";var n=e(t(),1);function r(e,t){let r=()=>localStorage.getItem(e)===`1`,[i,a]=(0,n.useState)(r);return(0,n.useEffect)(()=>{let e=()=>a(r());return window.addEventListener(t,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(t,e),window.removeEventListener(`storage`,e)}},[]),{enabled:i,setEnabled:n=>{try{localStorage.setItem(e,n?`1`:`0`)}catch{}window.dispatchEvent(new Event(t))}}}function i(){return r(`cartethyia.privacy-mode`,`cartethyia:privacy-mode`)}var a=`cartethyia.mysterious-accounts`,o=`cartethyia:mysterious-accounts`;function s(){try{let e=localStorage.getItem(a);if(!e)return new Set;let t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(e=>typeof e==`string`&&e.length>0)):new Set}catch{return new Set}}function c(e){let[t,r]=(0,n.useState)(s);return(0,n.useEffect)(()=>{let e=()=>r(s());return window.addEventListener(o,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(o,e),window.removeEventListener(`storage`,e)}},[]),{enabled:t.has(e),setEnabled:t=>{let n=s();t?n.add(e):n.delete(e),localStorage.setItem(a,JSON.stringify([...n])),window.dispatchEvent(new Event(o))}}}function l(){return r(`cartethyia.mask-ip`,`cartethyia:mask-ip`)}function u(){return r(`cartethyia.hide-unconfigured-providers`,`cartethyia:hide-unconfigured-providers`)}export{i,l as n,c as r,u as t};
@@ -1 +1 @@
1
- var e={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},t=new class{#e=e;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function n(e){setTimeout(e,0)}var r=typeof window>`u`||`Deno`in globalThis;function i(){}function a(e,t){return typeof e==`function`?e(t):e}function o(e){return typeof e==`number`&&e>=0&&e!==1/0}function s(e,t){return Math.max(e+(t||0)-Date.now(),0)}function c(e,t){return typeof e==`function`?e(t):e}function l(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==d(o,t.options))return!1}else if(!p(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function u(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(f(t.options.mutationKey)!==f(a))return!1}else if(!p(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function d(e,t){return(t?.queryKeyHashFn||f)(e)}function f(e){return JSON.stringify(e,(e,t)=>v(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function p(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!p(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!p(e[r],t[r]))return!1;return!0}return!1}var m=Object.prototype.hasOwnProperty;function h(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=_(e)&&_(t);if(!r&&!(v(e)&&v(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:m.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=h(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function g(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function _(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function v(e){if(!y(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!y(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function y(e){return Object.prototype.toString.call(e)===`[object Object]`}function ee(e){return new Promise(n=>{t.setTimeout(n,e)})}function b(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:h(e,t)}function te(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function x(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var S=Symbol();function C(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===S?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ne(e,t){return typeof e==`function`?e(...t):!!e}function w(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var T=()=>r,E=()=>T(),D=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},O=new class extends D{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},re=n;function ie(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=re,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var k=ie(),A=new class extends D{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function ae(e){return Math.min(1e3*2**e,3e4)}function j(e){return(e??`online`)!==`online`||A.isOnline()}var M=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function N(e){return e instanceof M}function P(e){let t=!1,n=0,r,a=`pending`,o,s,c=new Promise((e,t)=>{o=e,s=t});c.catch(i);let l=()=>a!==`pending`,u=t=>{if(!l()){let n=new M(t);g(n),e.onCancel?.(n)}},d=()=>{t=!0},f=()=>{t=!1},p=()=>O.isFocused()&&(e.networkMode===`always`||A.isOnline())&&e.canRun(),m=()=>j(e.networkMode)&&e.canRun(),h=e=>{l()||(r?.(),a=`resolved`,o(e))},g=e=>{l()||(r?.(),a=`rejected`,s(e))},_=()=>new Promise(t=>{r=e=>{(l()||p())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,l()||e.onContinue?.()}),v=()=>{if(l())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(h).catch(r=>{if(l())return;let i=e.retry??(E()?0:3),a=e.retryDelay??ae,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){g(r);return}n++,e.onFail?.(n,r),ee(o).then(()=>p()?void 0:_()).then(()=>{t?g(r):v()})})};return{promise:c,status:()=>a,cancel:u,continue:()=>(r?.(),c),cancelRetry:d,continueRetry:f,canStart:m,start:()=>(m()?v():_().then(v),c)}}var F=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),o(this.gcTime)&&(this.#e=t.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(E()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(t.clearTimeout(this.#e),this.#e=void 0)}};function oe(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{w(e,()=>t.signal,()=>n=!0)},u=C(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?x:te;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?se:I,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:I(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function I(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function se(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var ce=class extends F{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=z(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=z(this.options);e.data!==void 0&&(this.setState(R(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=b(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(i).catch(i):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>c(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===S||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>c(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!s(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=C(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?oe(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=P({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof M&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof M){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...L(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...R(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),k.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function L(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:j(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function R(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function z(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var B=new Set([`GET`,`HEAD`,`OPTIONS`]),V=new Set([`/auth/login`,`/auth/setup`]),H=`csrf_token`;function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function W(e,t){return`${t===`upstream`||t===void 0&&e>=500?`Upstream`:t===`network`?`Network`:`Console`} request failed (${e})`}function le(e,t){if(U(e)){if(typeof e.message==`string`)return e.message;if(typeof e.error==`string`)return e.error;if(U(e.error)&&typeof e.error.message==`string`)return e.error.message}return W(t,K(e))}function G(e){if(U(e)){if(typeof e.code==`string`)return e.code;if(U(e.error)&&typeof e.error.code==`string`)return e.error.code}}function K(e){if(!U(e))return;let t=typeof e.origin==`string`?e.origin:U(e.error)&&typeof e.error.origin==`string`?e.error.origin:void 0;return t===`cartethyia`||t===`upstream`||t===`network`?t:void 0}function ue(e){if(U(e))return U(e.details)?e.details:U(e.error)&&U(e.error.details)?e.error.details:void 0}async function q(e){try{return await e.json()}catch{throw{status:e.status,code:`invalid_response`,message:`Upstream returned a non-JSON response (${e.status})`}}}function J(e,t){let n=G(e),r=K(e),i=ue(e);throw{status:t,message:le(e,t),...n?{code:n}:{},...r?{origin:r}:{},...i?{details:i}:{}}}function Y(){if(!(typeof document>`u`||typeof document.cookie!=`string`))for(let e of document.cookie.split(`;`)){let t=e.indexOf(`=`);if(t!==-1&&e.slice(0,t).trim()===H){let n=e.slice(t+1).trim();return n.length>0?n:void 0}}}function de(e,t,n){return n.csrf===!1||B.has(t)?!1:!V.has(e)}var fe=new Set([`/auth/login`,`/auth/setup`,`/auth/setup/restore`,`/auth/session`,`/auth/first-boot`]),pe=new Set([`insufficient_scope`,`tenant_required`,`provider_is_builtin`,`invalid_scope`,`invalid_request`,`not_authorized`]),X;function me(e){X=e}function Z(e){X?.(e)}function Q(e,t,n){if(fe.has(e)||t!==401&&t!==403||K(n)===`upstream`||K(n)===`network`)return;if(t===401){Z(`expired`);return}let r=G(n);r!==void 0&&pe.has(r)||Z(`banned`)}async function $(e,t={}){let n=(t.method??`GET`).toUpperCase(),r=new Headers(t.headers);if(r.has(`Accept`)||r.set(`Accept`,`application/json`),t.body!=null&&!(t.body instanceof FormData)&&!r.has(`Content-Type`)&&r.set(`Content-Type`,`application/json`),de(e,n,t)&&!r.has(`X-CSRF-Token`)){let e=Y();e&&r.set(`X-CSRF-Token`,e)}let{csrf:i,...a}=t,o=await fetch(`/console/api${e}`,{...a,method:n,credentials:`same-origin`,headers:r}),s=await q(o);return o.ok||(Q(e,o.status,s),J(s,o.status)),s}async function he(e,t,n){let r=new TextEncoder().encode(t).byteLength,i=await new Promise((i,a)=>{let o=new XMLHttpRequest;o.open(`POST`,`/console/api${e}`),o.withCredentials=!0,o.setRequestHeader(`Content-Type`,`application/json`),o.setRequestHeader(`Accept`,`application/json`);let s=Y();s&&o.setRequestHeader(`X-CSRF-Token`,s),o.upload.onprogress=e=>{n?.({loaded:e.loaded,total:e.lengthComputable?e.total:r})},o.onload=()=>i(new Response(o.responseText,{status:o.status})),o.onerror=()=>a(Error(`Network request failed`)),o.send(t)}),a=await q(i);return i.ok||(Q(e,i.status,a),J(a,i.status)),a}async function ge(){let e=await $(`/auth/session`);return e.status===`authenticated`?{id:e.user_id,username:e.username,email:e.email,displayName:e.display_name,isFirstBoot:e.is_first_boot,sessionExpiresAt:e.session_expires_at,isPlatformAdmin:e.is_platform_admin}:null}function _e(e,t=`Request failed`){return ve(e)&&e.message.trim().length>0||e instanceof Error&&e.message.trim().length>0?e.message:t}function ve(e){return typeof e==`object`&&!!e&&`message`in e&&typeof e.message==`string`}var ye={staleTime:1e4,gcTime:12e4,retry:!1,refetchOnWindowFocus:!1},be={retry:0},xe={warming:2e3,live:5e3,status:1e4,catalog:6e4},Se={session:{current:[`console`,`session`]},system:{health:[`console`,`system`,`health`]},releases:{githubLatest:[`console`,`releases`,`github-latest`]},usageAnalytics:{summary:e=>[`console`,`usage`,`summary`,e],chart:e=>[`console`,`usage`,`chart`,e],by:(e,t)=>[`console`,`usage`,`by`,e,t],requests:(e,t,n)=>[`console`,`usage`,`requests`,e,t,n??`all`],requestDetail:e=>[`console`,`usage`,`requests`,e]},providers:{all:[`console`,`providers`],detail:e=>[`console`,`providers`,e],models:e=>[`console`,`providers`,e,`models`],flatAll:[`console`,`providers`,`models-flat-all`],accounts:e=>[`console`,`providers`,e,`accounts`],routing:e=>[`console`,`providers`,e,`routing`],accountInflight:e=>[`console`,`providers`,e,`account-inflight`],healthEvents:(e,t)=>[`console`,`providers`,e,`accounts`,t,`health-events`]},modelRouting:{all:[`console`,`model-routing`],aliases:[`console`,`model-routing`,`aliases`],combos:[`console`,`model-routing`,`combos`]},network:{pools:[`console`,`network`,`pools`],poolStrategy:[`console`,`network`,`pool-strategy`]},apiKeys:{all:[`console`,`api-keys`],shareLink:e=>[`console`,`api-keys`,e,`share`],sharedKeys:e=>[`console`,`api-keys`,e,`shared-keys`],sharedKeyActivity:(e,t)=>[`console`,`api-keys`,e,`shared-keys`,t,`activity`]},modelBans:{all:[`console`,`model-bans`]},settings:{runtime:[`console`,`settings`,`runtime`]},cliTools:{registry:[`console`,`cli-tools`,`registry`],statuses:[`console`,`cli-tools`,`statuses`],mappings:(e,t)=>[`console`,`cli-tools`,e,t,`mappings`]},audit:{list:e=>[`console`,`audit`,`list`,e]},quota:{all:[`console`,`quota`],account:e=>[`console`,`quota`,`account`,e],resets:e=>[`console`,`quota`,`account`,e,`resets`]}};export{c as A,d as C,i as D,l as E,t as F,ne as M,S as N,p as O,s as P,f as S,u as T,k as _,$ as a,E as b,_e as c,ce as d,L as f,A as g,N as h,xe as i,g as j,b as k,U as l,P as m,be as n,he as o,F as p,ye as r,ge as s,Se as t,me as u,O as v,o as w,a as x,D as y};
1
+ var e={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},t=new class{#e=e;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function n(e){setTimeout(e,0)}var r=typeof window>`u`||`Deno`in globalThis;function i(){}function a(e,t){return typeof e==`function`?e(t):e}function o(e){return typeof e==`number`&&e>=0&&e!==1/0}function s(e,t){return Math.max(e+(t||0)-Date.now(),0)}function c(e,t){return typeof e==`function`?e(t):e}function l(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==d(o,t.options))return!1}else if(!p(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function u(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(f(t.options.mutationKey)!==f(a))return!1}else if(!p(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function d(e,t){return(t?.queryKeyHashFn||f)(e)}function f(e){return JSON.stringify(e,(e,t)=>v(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function p(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!p(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!p(e[r],t[r]))return!1;return!0}return!1}var m=Object.prototype.hasOwnProperty;function h(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=_(e)&&_(t);if(!r&&!(v(e)&&v(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:m.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=h(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function g(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function _(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function v(e){if(!y(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!y(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function y(e){return Object.prototype.toString.call(e)===`[object Object]`}function ee(e){return new Promise(n=>{t.setTimeout(n,e)})}function b(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:h(e,t)}function te(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function x(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var S=Symbol();function C(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===S?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ne(e,t){return typeof e==`function`?e(...t):!!e}function w(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var T=()=>r,E=()=>T(),D=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},O=new class extends D{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},re=n;function ie(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=re,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var k=ie(),A=new class extends D{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function ae(e){return Math.min(1e3*2**e,3e4)}function j(e){return(e??`online`)!==`online`||A.isOnline()}var M=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function N(e){return e instanceof M}function P(e){let t=!1,n=0,r,a=`pending`,o,s,c=new Promise((e,t)=>{o=e,s=t});c.catch(i);let l=()=>a!==`pending`,u=t=>{if(!l()){let n=new M(t);g(n),e.onCancel?.(n)}},d=()=>{t=!0},f=()=>{t=!1},p=()=>O.isFocused()&&(e.networkMode===`always`||A.isOnline())&&e.canRun(),m=()=>j(e.networkMode)&&e.canRun(),h=e=>{l()||(r?.(),a=`resolved`,o(e))},g=e=>{l()||(r?.(),a=`rejected`,s(e))},_=()=>new Promise(t=>{r=e=>{(l()||p())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,l()||e.onContinue?.()}),v=()=>{if(l())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(h).catch(r=>{if(l())return;let i=e.retry??(E()?0:3),a=e.retryDelay??ae,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){g(r);return}n++,e.onFail?.(n,r),ee(o).then(()=>p()?void 0:_()).then(()=>{t?g(r):v()})})};return{promise:c,status:()=>a,cancel:u,continue:()=>(r?.(),c),cancelRetry:d,continueRetry:f,canStart:m,start:()=>(m()?v():_().then(v),c)}}var F=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),o(this.gcTime)&&(this.#e=t.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(E()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(t.clearTimeout(this.#e),this.#e=void 0)}};function oe(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{w(e,()=>t.signal,()=>n=!0)},u=C(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?x:te;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?se:I,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:I(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function I(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function se(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var ce=class extends F{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=z(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=z(this.options);e.data!==void 0&&(this.setState(R(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=b(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(i).catch(i):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>c(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===S||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>c(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!s(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=C(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?oe(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=P({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof M&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof M){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...L(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...R(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),k.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function L(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:j(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function R(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function z(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var B=new Set([`GET`,`HEAD`,`OPTIONS`]),V=new Set([`/auth/login`,`/auth/setup`]),H=`csrf_token`;function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function W(e,t){return`${t===`upstream`||t===void 0&&e>=500?`Upstream`:t===`network`?`Network`:`Console`} request failed (${e})`}function le(e,t){if(U(e)){if(typeof e.message==`string`)return e.message;if(typeof e.error==`string`)return e.error;if(U(e.error)&&typeof e.error.message==`string`)return e.error.message}return W(t,K(e))}function G(e){if(U(e)){if(typeof e.code==`string`)return e.code;if(U(e.error)&&typeof e.error.code==`string`)return e.error.code}}function K(e){if(!U(e))return;let t=typeof e.origin==`string`?e.origin:U(e.error)&&typeof e.error.origin==`string`?e.error.origin:void 0;return t===`cartethyia`||t===`upstream`||t===`network`?t:void 0}function ue(e){if(U(e))return U(e.details)?e.details:U(e.error)&&U(e.error.details)?e.error.details:void 0}async function q(e){try{return await e.json()}catch{throw{status:e.status,code:`invalid_response`,message:`Upstream returned a non-JSON response (${e.status})`}}}function J(e,t){let n=G(e),r=K(e),i=ue(e);throw{status:t,message:le(e,t),...n?{code:n}:{},...r?{origin:r}:{},...i?{details:i}:{}}}function Y(){if(!(typeof document>`u`||typeof document.cookie!=`string`))for(let e of document.cookie.split(`;`)){let t=e.indexOf(`=`);if(t!==-1&&e.slice(0,t).trim()===H){let n=e.slice(t+1).trim();return n.length>0?n:void 0}}}function de(e,t,n){return n.csrf===!1||B.has(t)?!1:!V.has(e)}var fe=new Set([`/auth/login`,`/auth/setup`,`/auth/setup/restore`,`/auth/session`,`/auth/first-boot`]),pe=new Set([`insufficient_scope`,`tenant_required`,`provider_is_builtin`,`invalid_scope`,`invalid_request`,`not_authorized`]),X;function me(e){X=e}function Z(e){X?.(e)}function Q(e,t,n){if(fe.has(e)||t!==401&&t!==403||K(n)===`upstream`||K(n)===`network`)return;if(t===401){Z(`expired`);return}let r=G(n);r!==void 0&&pe.has(r)||Z(`banned`)}async function $(e,t={}){let n=(t.method??`GET`).toUpperCase(),r=new Headers(t.headers);if(r.has(`Accept`)||r.set(`Accept`,`application/json`),t.body!=null&&!(t.body instanceof FormData)&&!r.has(`Content-Type`)&&r.set(`Content-Type`,`application/json`),de(e,n,t)&&!r.has(`X-CSRF-Token`)){let e=Y();e&&r.set(`X-CSRF-Token`,e)}let{csrf:i,...a}=t,o=await fetch(`/console/api${e}`,{...a,method:n,credentials:`same-origin`,headers:r}),s=await q(o);return o.ok||(Q(e,o.status,s),J(s,o.status)),s}async function he(e,t,n){let r=new TextEncoder().encode(t).byteLength,i=await new Promise((i,a)=>{let o=new XMLHttpRequest;o.open(`POST`,`/console/api${e}`),o.withCredentials=!0,o.setRequestHeader(`Content-Type`,`application/json`),o.setRequestHeader(`Accept`,`application/json`);let s=Y();s&&o.setRequestHeader(`X-CSRF-Token`,s),o.upload.onprogress=e=>{n?.({loaded:e.loaded,total:e.lengthComputable?e.total:r})},o.onload=()=>i(new Response(o.responseText,{status:o.status})),o.onerror=()=>a(Error(`Network request failed`)),o.send(t)}),a=await q(i);return i.ok||(Q(e,i.status,a),J(a,i.status)),a}async function ge(){let e=await $(`/auth/session`);return e.status===`authenticated`?{id:e.user_id,username:e.username,email:e.email,displayName:e.display_name,isFirstBoot:e.is_first_boot,sessionExpiresAt:e.session_expires_at,isPlatformAdmin:e.is_platform_admin}:null}function _e(e,t=`Request failed`){return ve(e)&&e.message.trim().length>0||e instanceof Error&&e.message.trim().length>0?e.message:t}function ve(e){return typeof e==`object`&&!!e&&`message`in e&&typeof e.message==`string`}var ye={staleTime:6e4,gcTime:12e4,retry:!1,refetchOnWindowFocus:!1},be={retry:0},xe={effectivelyImmutable:3e5},Se={warming:2e3,live:5e3,status:1e4,catalog:6e4},Ce={session:{current:[`console`,`session`]},system:{health:[`console`,`system`,`health`]},releases:{githubLatest:[`console`,`releases`,`github-latest`]},usageAnalytics:{summary:e=>[`console`,`usage`,`summary`,e],chart:e=>[`console`,`usage`,`chart`,e],by:(e,t)=>[`console`,`usage`,`by`,e,t],requests:(e,t,n)=>[`console`,`usage`,`requests`,e,t,n??`all`],requestDetail:e=>[`console`,`usage`,`requests`,e]},providers:{all:[`console`,`providers`],detail:e=>[`console`,`providers`,e],models:e=>[`console`,`providers`,e,`models`],flatAll:[`console`,`providers`,`models-flat-all`],accounts:e=>[`console`,`providers`,e,`accounts`],routing:e=>[`console`,`providers`,e,`routing`],accountInflight:e=>[`console`,`providers`,e,`account-inflight`],healthEvents:(e,t)=>[`console`,`providers`,e,`accounts`,t,`health-events`]},modelRouting:{all:[`console`,`model-routing`],aliases:[`console`,`model-routing`,`aliases`],combos:[`console`,`model-routing`,`combos`]},network:{pools:[`console`,`network`,`pools`],poolStrategy:[`console`,`network`,`pool-strategy`]},apiKeys:{all:[`console`,`api-keys`],shareLink:e=>[`console`,`api-keys`,e,`share`],sharedKeys:e=>[`console`,`api-keys`,e,`shared-keys`],sharedKeyActivity:(e,t)=>[`console`,`api-keys`,e,`shared-keys`,t,`activity`]},modelBans:{all:[`console`,`model-bans`]},settings:{runtime:[`console`,`settings`,`runtime`]},cliTools:{registry:[`console`,`cli-tools`,`registry`],statuses:[`console`,`cli-tools`,`statuses`],mappings:(e,t)=>[`console`,`cli-tools`,e,t,`mappings`]},audit:{list:e=>[`console`,`audit`,`list`,e]},quota:{all:[`console`,`quota`],account:e=>[`console`,`quota`,`account`,e],resets:e=>[`console`,`quota`,`account`,e,`resets`]}};export{b as A,f as C,l as D,u as E,s as F,t as I,g as M,ne as N,i as O,S as P,a as S,o as T,A as _,Se as a,D as b,ge as c,me as d,ce as f,N as g,P as h,ye as i,c as j,p as k,_e as l,F as m,xe as n,$ as o,L as p,be as r,he as s,Ce as t,U as u,k as v,d as w,E as x,O as y};
@@ -1 +1 @@
1
- import{S as e,_ as t,i as n,l as r,o as i,w as a}from"./assert-Bwh6DJTK.js";import{a as o,i as s,r as c,t as l}from"./query-keys-ROf-g1Wi.js";import{t as u}from"./useMutation-DVmwOKU-.js";function d(){return e({queryKey:l.modelRouting.aliases,queryFn:e=>o(`/routing/aliases`,{signal:t(e)}).then(n),...c})}function f(){return e({queryKey:l.modelRouting.combos,queryFn:e=>o(`/routing/combos`,{signal:t(e)}).then(i),...c})}function p(n){return e({queryKey:l.providers.routing(n),queryFn:e=>o(`/providers/${encodeURIComponent(n??``)}/routing`,{signal:t(e)}).then(r),enabled:n!==void 0&&n.length>0,...c})}function m(n){return e({queryKey:l.providers.accountInflight(n),queryFn:async e=>{let r=await o(`/providers/${encodeURIComponent(n??``)}/account-inflight`,{signal:t(e)});if(!Array.isArray(r))throw{status:500,code:`invalid_response`,message:`Invalid account inflight response`};let i=new Map;for(let e of r){if(typeof e!=`object`||!e)continue;let t=e;typeof t.accountId==`string`&&typeof t.inflight==`number`&&i.set(t.accountId,Math.max(0,Math.floor(t.inflight)))}return i},enabled:n!==void 0&&n.length>0,refetchInterval:s.live,refetchIntervalInBackground:!1})}function h(){let e=a();return u({mutationFn:e=>o(`/routing/aliases`,{method:`POST`,body:JSON.stringify(e)}),onSuccess:async()=>{await e.invalidateQueries({queryKey:l.modelRouting.aliases})}})}function g(){let e=a();return u({mutationFn:({id:e,request:t})=>o(`/routing/aliases/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),onSuccess:async()=>{await e.invalidateQueries({queryKey:l.modelRouting.aliases})}})}function _(){let e=a();return u({mutationFn:e=>o(`/routing/aliases/${encodeURIComponent(e)}`,{method:`DELETE`}),onSuccess:async()=>{await e.invalidateQueries({queryKey:l.modelRouting.aliases})}})}function v(){let e=a();return u({mutationFn:e=>o(`/routing/aliases/reorder`,{method:`POST`,body:JSON.stringify({ids:e})}),onSuccess:async()=>{await e.invalidateQueries({queryKey:l.modelRouting.aliases})}})}function y(){let e=a();return u({mutationFn:e=>o(`/routing/combos/reorder`,{method:`POST`,body:JSON.stringify({ids:e})}),onSuccess:async()=>{await e.invalidateQueries({queryKey:l.modelRouting.combos})}})}function b(){let e=a();return u({mutationFn:e=>o(`/routing/combos`,{method:`POST`,body:JSON.stringify(e)}),onSuccess:async()=>{await e.invalidateQueries({queryKey:l.modelRouting.combos})}})}function x(){let e=a();return u({mutationFn:e=>o(`/routing/combos/${encodeURIComponent(e)}/clone`,{method:`POST`}),onSuccess:async()=>{await e.invalidateQueries({queryKey:l.modelRouting.combos})}})}function S(){let e=a();return u({mutationFn:({id:e,request:t})=>o(`/routing/combos/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),onSuccess:async()=>{await e.invalidateQueries({queryKey:l.modelRouting.combos})}})}function C(){let e=a();return u({mutationFn:e=>o(`/routing/combos/${encodeURIComponent(e)}`,{method:`DELETE`}),onSuccess:async()=>{await e.invalidateQueries({queryKey:l.modelRouting.combos})}})}function w(){let e=a();return u({mutationFn:({providerId:e,request:t})=>o(`/providers/${encodeURIComponent(e)}/routing`,{method:`PATCH`,body:JSON.stringify(t)}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:l.providers.routing(n.providerId)}),await e.invalidateQueries({queryKey:l.providers.all})}})}export{C as a,m as c,y as d,g as f,_ as i,p as l,w as m,h as n,d as o,S as p,b as r,f as s,x as t,v as u};
1
+ import{S as e,_ as t,i as n,l as r,o as i,w as a}from"./assert-7J6_LVD3.js";import{a as o,i as s,o as c,t as l}from"./query-keys-D7wX2vM5.js";import{t as u}from"./useMutation-D87FZwH0.js";function d(){return e({queryKey:l.modelRouting.aliases,queryFn:e=>c(`/routing/aliases`,{signal:t(e)}).then(n),...s})}function f(){return e({queryKey:l.modelRouting.combos,queryFn:e=>c(`/routing/combos`,{signal:t(e)}).then(i),...s})}function p(n){return e({queryKey:l.providers.routing(n),queryFn:e=>c(`/providers/${encodeURIComponent(n??``)}/routing`,{signal:t(e)}).then(r),enabled:n!==void 0&&n.length>0,...s})}function m(n){return e({queryKey:l.providers.accountInflight(n),queryFn:async e=>{let r=await c(`/providers/${encodeURIComponent(n??``)}/account-inflight`,{signal:t(e)});if(!Array.isArray(r))throw{status:500,code:`invalid_response`,message:`Invalid account inflight response`};let i=new Map;for(let e of r){if(typeof e!=`object`||!e)continue;let t=e;typeof t.accountId==`string`&&typeof t.inflight==`number`&&i.set(t.accountId,Math.max(0,Math.floor(t.inflight)))}return i},enabled:n!==void 0&&n.length>0,refetchInterval:o.live,refetchIntervalInBackground:!1})}function h(){let e=a();return u({mutationFn:e=>c(`/routing/aliases`,{method:`POST`,body:JSON.stringify(e)}),onSuccess:async()=>{await e.invalidateQueries({queryKey:l.modelRouting.aliases})}})}function g(){let e=a();return u({mutationFn:({id:e,request:t})=>c(`/routing/aliases/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),onSuccess:async()=>{await e.invalidateQueries({queryKey:l.modelRouting.aliases})}})}function _(){let e=a();return u({mutationFn:e=>c(`/routing/aliases/${encodeURIComponent(e)}`,{method:`DELETE`}),onSuccess:async()=>{await e.invalidateQueries({queryKey:l.modelRouting.aliases})}})}function v(){let e=a();return u({mutationFn:e=>c(`/routing/aliases/reorder`,{method:`POST`,body:JSON.stringify({ids:e})}),onSuccess:async()=>{await e.invalidateQueries({queryKey:l.modelRouting.aliases})}})}function y(){let e=a();return u({mutationFn:e=>c(`/routing/combos/reorder`,{method:`POST`,body:JSON.stringify({ids:e})}),onSuccess:async()=>{await e.invalidateQueries({queryKey:l.modelRouting.combos})}})}function b(){let e=a();return u({mutationFn:e=>c(`/routing/combos`,{method:`POST`,body:JSON.stringify(e)}),onSuccess:async()=>{await e.invalidateQueries({queryKey:l.modelRouting.combos})}})}function x(){let e=a();return u({mutationFn:e=>c(`/routing/combos/${encodeURIComponent(e)}/clone`,{method:`POST`}),onSuccess:async()=>{await e.invalidateQueries({queryKey:l.modelRouting.combos})}})}function S(){let e=a();return u({mutationFn:({id:e,request:t})=>c(`/routing/combos/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),onSuccess:async()=>{await e.invalidateQueries({queryKey:l.modelRouting.combos})}})}function C(){let e=a();return u({mutationFn:e=>c(`/routing/combos/${encodeURIComponent(e)}`,{method:`DELETE`}),onSuccess:async()=>{await e.invalidateQueries({queryKey:l.modelRouting.combos})}})}function w(){let e=a();return u({mutationFn:({providerId:e,request:t})=>c(`/providers/${encodeURIComponent(e)}/routing`,{method:`PATCH`,body:JSON.stringify(t)}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:l.providers.routing(n.providerId)}),await e.invalidateQueries({queryKey:l.providers.all})}})}export{C as a,m as c,y as d,g as f,_ as i,p as l,w as m,h as n,d as o,S as p,b as r,f as s,x as t,v as u};