@cartanova/qgrid-cli 2.10.10 → 2.11.0

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 (313) hide show
  1. package/bundle/dist/_virtual/_rolldown/runtime.js +1 -10
  2. package/bundle/dist/application/monit/log-buffer.js +12 -6
  3. package/bundle/dist/application/monit/monit.frame.js +11 -3
  4. package/bundle/dist/application/monit/monit.types.js +1 -1
  5. package/bundle/dist/application/qgrid/conv-routing.js +9 -6
  6. package/bundle/dist/application/qgrid/expired-token-reminder.js +2 -2
  7. package/bundle/dist/application/qgrid/oauth.js +31 -4
  8. package/bundle/dist/application/qgrid/qgrid-image-generation.js +1 -1
  9. package/bundle/dist/application/qgrid/qgrid-response-format.js +21 -19
  10. package/bundle/dist/application/qgrid/qgrid-run-lifecycle.js +40 -33
  11. package/bundle/dist/application/qgrid/qgrid.dispatcher.js +128 -93
  12. package/bundle/dist/application/qgrid/qgrid.frame.js +930 -49
  13. package/bundle/dist/application/qgrid/qgrid.types.js +212 -5
  14. package/bundle/dist/application/qgrid/schema-prompt.js +75 -48
  15. package/bundle/dist/application/qgrid/slack-user-map.js +1 -1
  16. package/bundle/dist/application/qgrid/token-death.js +1 -1
  17. package/bundle/dist/application/qgrid/token-subscriber.js +83 -30
  18. package/bundle/dist/application/qgrid/token-trigger-setup.js +1 -1
  19. package/bundle/dist/application/qgrid/token-window-keepalive.js +8 -6
  20. package/bundle/dist/application/qgrid/tool-emulation-schema.js +13 -13
  21. package/bundle/dist/application/qgrid/tool-emulation.js +19 -15
  22. package/bundle/dist/application/request-log/json-schema-type-text.js +29 -12
  23. package/bundle/dist/application/request-log/request-log.model.js +83 -70
  24. package/bundle/dist/application/request-log/request-log.types.js +1 -1
  25. package/bundle/dist/application/request-log/zod-code-format.js +1 -1
  26. package/bundle/dist/application/request-log-step/request-log-step.model.js +1 -1
  27. package/bundle/dist/application/request-log-step/request-log-step.types.js +1 -1
  28. package/bundle/dist/application/setting/setting.constant.js +1 -1
  29. package/bundle/dist/application/setting/setting.model.js +2 -2
  30. package/bundle/dist/application/setting/setting.store.js +2 -2
  31. package/bundle/dist/application/setting/setting.types.js +1 -1
  32. package/bundle/dist/application/sonamu.generated.js +32 -16
  33. package/bundle/dist/application/sonamu.generated.sso.js +1 -1
  34. package/bundle/dist/application/token/token.model.js +26 -9
  35. package/bundle/dist/application/token/token.types.js +20 -3
  36. package/bundle/dist/i18n/en.js +15 -1
  37. package/bundle/dist/i18n/ko.js +15 -1
  38. package/bundle/dist/i18n/sd.generated.js +1 -1
  39. package/bundle/dist/migrations/20260807133553_manual__backfill_request_log_cost.js +8 -6
  40. package/bundle/dist/server-bootstrap.js +4 -2
  41. package/bundle/dist/server-error-handler.js +1 -1
  42. package/bundle/dist/sonamu.config.js +37 -8
  43. package/bundle/dist/startup-migrations.js +17 -7
  44. package/bundle/dist/testing/global.js +1 -1
  45. package/bundle/dist/testing/schema-bench.js +0 -0
  46. package/bundle/dist/testing/test-database-name.js +1 -1
  47. package/bundle/dist/utils/providers/anthropic/anthropic-constants.js +1 -1
  48. package/bundle/dist/utils/providers/anthropic/anthropic-dispatcher.js +11 -5
  49. package/bundle/dist/utils/providers/anthropic/anthropic-quota.js +4 -4
  50. package/bundle/dist/utils/providers/anthropic/anthropic-thinking.js +1 -1
  51. package/bundle/dist/utils/providers/anthropic/claude-session.js +20 -19
  52. package/bundle/dist/utils/providers/anthropic/fence-strip.js +1 -1
  53. package/bundle/dist/utils/providers/anthropic/stream-json-adapter.js +49 -23
  54. package/bundle/dist/utils/providers/common/credentials.js +5 -1
  55. package/bundle/dist/utils/providers/common/effort.js +3 -3
  56. package/bundle/dist/utils/providers/common/model-cost.js +69 -14
  57. package/bundle/dist/utils/providers/common/provider-types.js +29 -1
  58. package/bundle/dist/utils/providers/common/schema-validation.js +78 -40
  59. package/bundle/dist/utils/providers/common/smooth-weighted-round-robin.js +1 -1
  60. package/bundle/dist/utils/providers/common/strictifier.js +62 -43
  61. package/bundle/dist/utils/providers/common/thinking.js +3 -2
  62. package/bundle/dist/utils/providers/common/ttft.js +1 -1
  63. package/bundle/dist/utils/providers/grok/grok-backend-protocol.js +427 -0
  64. package/bundle/dist/utils/providers/grok/grok-constants.js +55 -0
  65. package/bundle/dist/utils/providers/grok/grok-direct-client.js +196 -0
  66. package/bundle/dist/utils/providers/grok/grok-dispatcher.js +1313 -0
  67. package/bundle/dist/utils/providers/grok/grok-headers.js +118 -0
  68. package/bundle/dist/utils/providers/grok/grok-media-client.js +420 -0
  69. package/bundle/dist/utils/providers/grok/grok-models.js +114 -0
  70. package/bundle/dist/utils/providers/grok/grok-oauth.js +455 -0
  71. package/bundle/dist/utils/providers/grok/grok-quota.js +119 -0
  72. package/bundle/dist/utils/providers/grok/grok-refresh.js +192 -0
  73. package/bundle/dist/utils/providers/grok/grok-types.js +186 -0
  74. package/bundle/dist/utils/providers/grok/grok-voice-client.js +199 -0
  75. package/bundle/dist/utils/providers/grok/index.js +11 -0
  76. package/bundle/dist/utils/providers/openai/openai-backend-protocol.js +111 -83
  77. package/bundle/dist/utils/providers/openai/openai-callback-relay.js +3 -2
  78. package/bundle/dist/utils/providers/openai/openai-constants.js +1 -1
  79. package/bundle/dist/utils/providers/openai/openai-direct-client.js +23 -7
  80. package/bundle/dist/utils/providers/openai/openai-dispatcher.js +143 -106
  81. package/bundle/dist/utils/providers/openai/openai-image-generation.js +48 -33
  82. package/bundle/dist/utils/providers/openai/openai-oauth.js +28 -13
  83. package/bundle/dist/utils/providers/openai/openai-quota.js +38 -27
  84. package/bundle/dist/utils/providers/openai/openai-refresh.js +17 -9
  85. package/bundle/dist/utils/providers/openai/openai-sse.js +1 -1
  86. package/bundle/dist/utils/providers/openai/openai-transport-config.js +1 -1
  87. package/bundle/dist/utils/quiet-hours.js +1 -1
  88. package/bundle/dist/utils/slack-notify.js +14 -8
  89. package/bundle/dist/utils/subset-loaders.js +4 -5
  90. package/bundle/src/application/monit/log-buffer.ts +23 -9
  91. package/bundle/src/application/monit/monit.frame.ts +22 -5
  92. package/bundle/src/application/monit/monit.types.ts +6 -0
  93. package/bundle/src/application/qgrid/conv-routing.test.ts +76 -4
  94. package/bundle/src/application/qgrid/conv-routing.ts +35 -9
  95. package/bundle/src/application/qgrid/expired-token-reminder.ts +9 -1
  96. package/bundle/src/application/qgrid/oauth.ts +51 -15
  97. package/bundle/src/application/qgrid/qgrid-image-generation.ts +9 -0
  98. package/bundle/src/application/qgrid/qgrid-response-format.ts +50 -25
  99. package/bundle/src/application/qgrid/qgrid-run-lifecycle.test.ts +19 -0
  100. package/bundle/src/application/qgrid/qgrid-run-lifecycle.ts +84 -40
  101. package/bundle/src/application/qgrid/qgrid.dispatcher.test.ts +97 -0
  102. package/bundle/src/application/qgrid/qgrid.dispatcher.ts +274 -126
  103. package/bundle/src/application/qgrid/qgrid.frame.test.ts +1013 -3
  104. package/bundle/src/application/qgrid/qgrid.frame.ts +1415 -60
  105. package/bundle/src/application/qgrid/qgrid.types.ts +335 -0
  106. package/bundle/src/application/qgrid/schema-prompt.ts +105 -41
  107. package/bundle/src/application/qgrid/slack-user-map.ts +5 -0
  108. package/bundle/src/application/qgrid/token-death.ts +4 -0
  109. package/bundle/src/application/qgrid/token-subscriber.test.ts +21 -19
  110. package/bundle/src/application/qgrid/token-subscriber.ts +186 -53
  111. package/bundle/src/application/qgrid/token-trigger-setup.ts +2 -0
  112. package/bundle/src/application/qgrid/token-window-keepalive.ts +49 -6
  113. package/bundle/src/application/qgrid/tool-emulation-schema.ts +33 -29
  114. package/bundle/src/application/qgrid/tool-emulation.ts +52 -27
  115. package/bundle/src/application/request-log/json-schema-type-text.test.ts +5 -5
  116. package/bundle/src/application/request-log/json-schema-type-text.ts +81 -26
  117. package/bundle/src/application/request-log/request-log.model.test.ts +111 -4
  118. package/bundle/src/application/request-log/request-log.model.ts +277 -146
  119. package/bundle/src/application/request-log/request-log.types.ts +6 -0
  120. package/bundle/src/application/request-log/zod-code-format.ts +11 -0
  121. package/bundle/src/application/request-log-step/request-log-step.model.ts +1 -0
  122. package/bundle/src/application/request-log-step/request-log-step.types.ts +2 -0
  123. package/bundle/src/application/setting/setting.constant.ts +9 -0
  124. package/bundle/src/application/setting/setting.model.ts +12 -2
  125. package/bundle/src/application/setting/setting.store.ts +5 -1
  126. package/bundle/src/application/setting/setting.types.ts +8 -0
  127. package/bundle/src/application/sonamu.generated.http +133 -0
  128. package/bundle/src/application/sonamu.generated.sso.ts +2 -0
  129. package/bundle/src/application/sonamu.generated.ts +15 -0
  130. package/bundle/src/application/token/token.identity.test.ts +20 -0
  131. package/bundle/src/application/token/token.model.ts +66 -7
  132. package/bundle/src/application/token/token.types.ts +24 -1
  133. package/bundle/src/i18n/en.ts +19 -0
  134. package/bundle/src/i18n/ko.ts +21 -0
  135. package/bundle/src/i18n/sd.generated.ts +23 -2
  136. package/bundle/src/migrations/20260807133553_manual__backfill_request_log_cost.ts +16 -8
  137. package/bundle/src/server-bootstrap.ts +4 -2
  138. package/bundle/src/server-error-handler.ts +1 -0
  139. package/bundle/src/sonamu.config.ts +69 -7
  140. package/bundle/src/startup-migrations.ts +27 -9
  141. package/bundle/src/testing/global.ts +20 -0
  142. package/bundle/src/testing/schema-bench.ts +105 -30
  143. package/bundle/src/testing/test-database-name.ts +2 -0
  144. package/bundle/src/utils/providers/anthropic/anthropic-constants.ts +8 -0
  145. package/bundle/src/utils/providers/anthropic/anthropic-dispatcher.ts +41 -6
  146. package/bundle/src/utils/providers/anthropic/anthropic-quota.ts +7 -3
  147. package/bundle/src/utils/providers/anthropic/anthropic-thinking.ts +6 -0
  148. package/bundle/src/utils/providers/anthropic/claude-session.ts +58 -24
  149. package/bundle/src/utils/providers/anthropic/fence-strip.ts +11 -0
  150. package/bundle/src/utils/providers/anthropic/stream-json-adapter.ts +110 -45
  151. package/bundle/src/utils/providers/common/credentials.ts +8 -0
  152. package/bundle/src/utils/providers/common/effort.ts +9 -2
  153. package/bundle/src/utils/providers/common/model-cost.test.ts +48 -1
  154. package/bundle/src/utils/providers/common/model-cost.ts +259 -158
  155. package/bundle/src/utils/providers/common/provider-dispatcher.ts +98 -2
  156. package/bundle/src/utils/providers/common/provider-types.ts +46 -3
  157. package/bundle/src/utils/providers/common/schema-validation.test.ts +5 -1
  158. package/bundle/src/utils/providers/common/schema-validation.ts +124 -56
  159. package/bundle/src/utils/providers/common/smooth-weighted-round-robin.ts +4 -0
  160. package/bundle/src/utils/providers/common/strictifier.ts +185 -59
  161. package/bundle/src/utils/providers/common/thinking.ts +2 -2
  162. package/bundle/src/utils/providers/common/ttft.ts +4 -2
  163. package/bundle/src/utils/providers/grok/__fixtures__/golden-responses-1.0.60.json +164 -0
  164. package/bundle/src/utils/providers/grok/grok-backend-protocol.test.ts +325 -0
  165. package/bundle/src/utils/providers/grok/grok-backend-protocol.ts +721 -0
  166. package/bundle/src/utils/providers/grok/grok-constants.ts +105 -0
  167. package/bundle/src/utils/providers/grok/grok-direct-client.test.ts +179 -0
  168. package/bundle/src/utils/providers/grok/grok-direct-client.ts +313 -0
  169. package/bundle/src/utils/providers/grok/grok-dispatcher.test.ts +1395 -0
  170. package/bundle/src/utils/providers/grok/grok-dispatcher.ts +2105 -0
  171. package/bundle/src/utils/providers/grok/grok-headers.test.ts +149 -0
  172. package/bundle/src/utils/providers/grok/grok-headers.ts +199 -0
  173. package/bundle/src/utils/providers/grok/grok-media-client.test.ts +446 -0
  174. package/bundle/src/utils/providers/grok/grok-media-client.ts +703 -0
  175. package/bundle/src/utils/providers/grok/grok-models.test.ts +96 -0
  176. package/bundle/src/utils/providers/grok/grok-models.ts +161 -0
  177. package/bundle/src/utils/providers/grok/grok-oauth.test.ts +406 -0
  178. package/bundle/src/utils/providers/grok/grok-oauth.ts +771 -0
  179. package/bundle/src/utils/providers/grok/grok-quota.test.ts +142 -0
  180. package/bundle/src/utils/providers/grok/grok-quota.ts +198 -0
  181. package/bundle/src/utils/providers/grok/grok-refresh.test.ts +239 -0
  182. package/bundle/src/utils/providers/grok/grok-refresh.ts +325 -0
  183. package/bundle/src/utils/providers/grok/grok-types.test.ts +252 -0
  184. package/bundle/src/utils/providers/grok/grok-types.ts +374 -0
  185. package/bundle/src/utils/providers/grok/grok-voice-client.test.ts +321 -0
  186. package/bundle/src/utils/providers/grok/grok-voice-client.ts +284 -0
  187. package/bundle/src/utils/providers/grok/index.ts +20 -0
  188. package/bundle/src/utils/providers/openai/openai-backend-protocol.ts +221 -137
  189. package/bundle/src/utils/providers/openai/openai-callback-relay.ts +12 -1
  190. package/bundle/src/utils/providers/openai/openai-constants.ts +2 -0
  191. package/bundle/src/utils/providers/openai/openai-direct-client.ts +111 -21
  192. package/bundle/src/utils/providers/openai/openai-dispatcher.ts +322 -169
  193. package/bundle/src/utils/providers/openai/openai-image-generation.ts +116 -36
  194. package/bundle/src/utils/providers/openai/openai-oauth.ts +48 -20
  195. package/bundle/src/utils/providers/openai/openai-quota.ts +77 -46
  196. package/bundle/src/utils/providers/openai/openai-refresh.ts +42 -18
  197. package/bundle/src/utils/providers/openai/openai-sse.ts +27 -3
  198. package/bundle/src/utils/providers/openai/openai-transport-config.ts +2 -0
  199. package/bundle/src/utils/quiet-hours.ts +12 -1
  200. package/bundle/src/utils/slack-notify.ts +44 -13
  201. package/bundle/src/utils/subset-loaders.ts +7 -7
  202. package/bundle/web-dist/client/assets/clsx-5XM_pHvN.js +1 -0
  203. package/bundle/web-dist/client/assets/index-BA7uQ-6c.js +31 -0
  204. package/bundle/web-dist/client/assets/index-Be2qCZmI.css +1 -0
  205. package/bundle/web-dist/client/assets/logs-C47OJGEI.js +1 -0
  206. package/bundle/web-dist/client/assets/monit-BS9no0dU.js +4 -0
  207. package/bundle/web-dist/client/assets/plus-sdACTfH0.js +1 -0
  208. package/bundle/web-dist/client/assets/refresh-cw-CY8o_1cT.js +1 -0
  209. package/bundle/web-dist/client/assets/request-model-BRtFuZvj.js +1 -0
  210. package/bundle/web-dist/client/assets/routes-kqgkUxE8.js +5 -0
  211. package/bundle/web-dist/client/assets/{services.generated-NP-ValHd.js → services.generated-CefiDXEv.js} +5 -5
  212. package/bundle/web-dist/client/assets/settings-DNDvFGSw.js +1 -0
  213. package/bundle/web-dist/client/assets/show-u8Np69q3.js +2 -0
  214. package/bundle/web-dist/client/assets/tokens-QvP410NW.js +1 -0
  215. package/bundle/web-dist/client/assets/total-cost-MnfKU8IN.js +1 -0
  216. package/bundle/web-dist/client/assets/use-oauth-login-flow-Bzdh28Ws.js +1 -0
  217. package/bundle/web-dist/client/assets/use-update-token-mutation-CfJKaxmR.js +1 -0
  218. package/bundle/web-dist/client/assets/vendor-react-CUFFrVN9.js +244 -0
  219. package/bundle/web-dist/client/assets/vendor-tanstack-Bf_jag9G.js +1 -0
  220. package/bundle/web-dist/client/index.html +6 -6
  221. package/bundle/web-dist/server/assets/clsx-D_N5PN_2.js +16 -0
  222. package/bundle/web-dist/server/assets/{lazyRouteComponent-CgBdabgd.js → lazyRouteComponent-D8iTIHyn.js} +129 -2
  223. package/bundle/web-dist/server/assets/logs-B3OTd9hy.js +825 -0
  224. package/bundle/web-dist/server/assets/{monit-ZPt66W5M.js → monit-B2hqorPe.js} +385 -126
  225. package/bundle/web-dist/server/assets/plus-DwG7h9kq.js +28 -0
  226. package/bundle/web-dist/server/assets/{react-dom-Ds75e4Jl.js → react-dom-BIYQzBqG.js} +2 -129
  227. package/bundle/web-dist/server/assets/refresh-cw-mMBkwOq0.js +44 -0
  228. package/bundle/web-dist/server/assets/{request-model-DjGldb-h.js → request-model-I6OdODSH.js} +15 -6
  229. package/bundle/web-dist/server/assets/{routes-Ct-k7nBA.js → routes-B95YlUv2.js} +760 -213
  230. package/bundle/web-dist/server/assets/{services.generated-BA4AcAf5.js → services.generated-DQATJ6qf.js} +12820 -12194
  231. package/bundle/web-dist/server/assets/settings-C3gbGk0m.js +830 -0
  232. package/bundle/web-dist/server/assets/{show-LSFIzvO2.js → show-Bxaj3rhH.js} +1350 -418
  233. package/bundle/web-dist/server/assets/tokens-CZjH3cB7.js +1038 -0
  234. package/bundle/web-dist/server/assets/total-cost-fTE9Xy82.js +18 -0
  235. package/bundle/web-dist/server/assets/use-oauth-login-flow-CKDHgc3U.js +2379 -0
  236. package/bundle/web-dist/server/assets/{use-update-token-mutation-pkArIzCP.js → use-update-token-mutation-BEbgOzaa.js} +1 -1
  237. package/bundle/web-dist/server/entry-server.generated.js +4295 -22810
  238. package/dist/cli.js +9 -9
  239. package/package.json +4 -11
  240. package/postinstall.mjs +12 -0
  241. package/skills/qgrid/SKILL.md +1 -0
  242. package/skills/qgrid/references/cli-env-and-server-boot.md +4 -1
  243. package/skills/qgrid/references/decision-rationale.md +23 -0
  244. package/skills/qgrid/references/grok-runtime.md +89 -0
  245. package/skills/qgrid/references/provider-runtime-differences.md +30 -29
  246. package/skills/qgrid/references/repo-map.md +10 -0
  247. package/skills/qgrid/references/token-auth-quota-lifecycle.md +56 -3
  248. package/bundle/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +0 -406
  249. package/bundle/dist/node_modules/.pnpm/@vitest_expect@4.1.10/node_modules/@vitest/expect/dist/index.js +0 -1507
  250. package/bundle/dist/node_modules/.pnpm/@vitest_pretty-format@4.1.10/node_modules/@vitest/pretty-format/dist/index.js +0 -887
  251. package/bundle/dist/node_modules/.pnpm/@vitest_runner@4.1.10/node_modules/@vitest/runner/dist/chunk-artifact.js +0 -2756
  252. package/bundle/dist/node_modules/.pnpm/@vitest_runner@4.1.10/node_modules/@vitest/runner/dist/index.js +0 -8
  253. package/bundle/dist/node_modules/.pnpm/@vitest_runner@4.1.10/node_modules/@vitest/runner/dist/utils.js +0 -8
  254. package/bundle/dist/node_modules/.pnpm/@vitest_snapshot@4.1.10/node_modules/@vitest/snapshot/dist/index.js +0 -922
  255. package/bundle/dist/node_modules/.pnpm/@vitest_spy@4.1.10/node_modules/@vitest/spy/dist/index.js +0 -386
  256. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js +0 -121
  257. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/constants.js +0 -51
  258. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/diff.js +0 -1317
  259. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/display.js +0 -561
  260. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/error.js +0 -40
  261. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/helpers.js +0 -272
  262. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/offset.js +0 -27
  263. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/serialize.js +0 -77
  264. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/source-map.js +0 -381
  265. package/bundle/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/timers.js +0 -51
  266. package/bundle/dist/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.js +0 -2986
  267. package/bundle/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/branding.js +0 -10
  268. package/bundle/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/index.js +0 -109
  269. package/bundle/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/messages.js +0 -10
  270. package/bundle/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/overloads.js +0 -10
  271. package/bundle/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/utils.js +0 -10
  272. package/bundle/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.js +0 -1126
  273. package/bundle/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.js +0 -21
  274. package/bundle/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +0 -432
  275. package/bundle/dist/node_modules/.pnpm/tinybench@2.9.0/node_modules/tinybench/dist/index.js +0 -517
  276. package/bundle/dist/node_modules/.pnpm/tinyrainbow@3.1.0/node_modules/tinyrainbow/dist/index.js +0 -101
  277. package/bundle/dist/node_modules/.pnpm/vite@8.0.3_@emnapi_core@1.11.2_@emnapi_runtime@1.11.2_@types_node@25.0.7_esbuild@0.27.4_5b35fc1fb85d2af4d105e0d74f940f50/node_modules/vite/dist/node/module-runner.js +0 -1265
  278. package/bundle/dist/node_modules/.pnpm/vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js +0 -9
  279. package/bundle/dist/node_modules/.pnpm/vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618/node_modules/vitest/dist/chunks/benchmark.CX_oY03V.js +0 -41
  280. package/bundle/dist/node_modules/.pnpm/vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618/node_modules/vitest/dist/chunks/evaluatedModules.Dg1zASAC.js +0 -19
  281. package/bundle/dist/node_modules/.pnpm/vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618/node_modules/vitest/dist/chunks/index.Chj8NDwU.js +0 -202
  282. package/bundle/dist/node_modules/.pnpm/vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618/node_modules/vitest/dist/chunks/index.DdgEv5B1.js +0 -46
  283. package/bundle/dist/node_modules/.pnpm/vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618/node_modules/vitest/dist/chunks/rpc.MzXet3jl.js +0 -119
  284. package/bundle/dist/node_modules/.pnpm/vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618/node_modules/vitest/dist/chunks/test.DNmyFkvJ.js +0 -3044
  285. package/bundle/dist/node_modules/.pnpm/vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.js +0 -59
  286. package/bundle/dist/node_modules/.pnpm/vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618/node_modules/vitest/dist/index.js +0 -28
  287. package/bundle/dist/testing/setup-mocks.js +0 -16
  288. package/bundle/src/testing/setup-mocks.ts +0 -44
  289. package/bundle/web-dist/client/assets/index-Bw2s88Ot.css +0 -1
  290. package/bundle/web-dist/client/assets/index-DZwzUfI-.js +0 -106
  291. package/bundle/web-dist/client/assets/logs-Cog79DU5.js +0 -1
  292. package/bundle/web-dist/client/assets/monit-2auznBys.js +0 -1
  293. package/bundle/web-dist/client/assets/plus-B62CuqT8.js +0 -1
  294. package/bundle/web-dist/client/assets/refresh-cw-NNcU0Cmq.js +0 -1
  295. package/bundle/web-dist/client/assets/request-model-CojtinqK.js +0 -1
  296. package/bundle/web-dist/client/assets/routes-B0lTeLK-.js +0 -5
  297. package/bundle/web-dist/client/assets/settings-D8ZxZGSJ.js +0 -1
  298. package/bundle/web-dist/client/assets/show-CFSERlnM.js +0 -2
  299. package/bundle/web-dist/client/assets/tokens-CZXUyI7O.js +0 -1
  300. package/bundle/web-dist/client/assets/use-oauth-login-flow-hboOs3wG.js +0 -1
  301. package/bundle/web-dist/client/assets/use-update-token-mutation-BQHS0byG.js +0 -1
  302. package/bundle/web-dist/client/assets/vendor-react-DH4kUfK2.js +0 -9
  303. package/bundle/web-dist/client/assets/vendor-tanstack-DJRQAbrY.js +0 -1
  304. package/bundle/web-dist/server/assets/logs-BMyR98rU.js +0 -509
  305. package/bundle/web-dist/server/assets/plus-BZ9I0VgC.js +0 -19
  306. package/bundle/web-dist/server/assets/refresh-cw-CztCFis-.js +0 -23
  307. package/bundle/web-dist/server/assets/settings-CBUZ47Xx.js +0 -461
  308. package/bundle/web-dist/server/assets/tokens-DxrBW512.js +0 -448
  309. package/bundle/web-dist/server/assets/use-oauth-login-flow-Gn8flMK5.js +0 -178
  310. package/dist/cli.d.ts +0 -10
  311. /package/bundle/web-dist/client/assets/{cost-DH2jZbrw.js → cost-DB3HbU7T.js} +0 -0
  312. /package/bundle/web-dist/client/assets/{preload-helper-ca-nBW7U.js → preload-helper-DWTEM3RW.js} +0 -0
  313. /package/bundle/web-dist/server/assets/{cost-eEHeTRT5.js → cost-BC9yzyA9.js} +0 -0
@@ -1 +0,0 @@
1
- import"./rolldown-runtime-Dw2cE7zH.js";import{l as e,u as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,r}from"./vendor-react-DH4kUfK2.js";import{C as i,S as a,n as o,o as s,r as c}from"./services.generated-NP-ValHd.js";import{i as l,n as u,r as d}from"./index-DZwzUfI-.js";import{i as f,r as p,t as m}from"./cost-DH2jZbrw.js";import{t as h}from"./refresh-cw-NNcU0Cmq.js";import{n as g,t as _}from"./request-model-CojtinqK.js";n();var v=r(),y=e=>(0,v.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,v.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m15 18l-6-6l6-6`})}),b=e=>(0,v.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,v.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m9 18l6-6l-6-6`})}),x=50,S=`__unassigned__`;function C(e){let t=new Date(e);return`${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function w(e){return e.toLocaleString()}function T(e){let t=Math.round(e/1e3),n=Math.floor(t/60),r=t%60;return n>0?`${n}m ${r}s`:`${r}s`}function E({status:e,requestedModel:t,servedModel:n,imageCostMethod:r,fallbackCount:i}){if(e===`running`)return(0,v.jsx)(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-blue-100 text-blue-600 font-medium whitespace-nowrap`,children:`실행 중`});let a=_({status:e,requestedModel:t,servedModel:n,imageCostMethod:r}),o=t!==null&&n===null;return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:`text-xs text-sand-500`,children:a.label}),o&&(0,v.jsx)(`span`,{className:`ml-1 text-[9px] text-sand-400`,children:`요청`}),(i??0)>0&&(0,v.jsxs)(`span`,{className:`ml-1 text-[9px] text-caution-500`,children:[`×`,i]})]})}function D(e){return e<=0?`—`:e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}var O=[{label:`ID`,align:`left`,width:`w-12`,sortKey:`id`},{label:`Date`,align:`left`,width:`w-20`,sortKey:`created_at`},{label:`Project`,align:`left`,width:`w-20`},{label:`Token`,align:`left`,width:`w-24`},{label:`Model`,align:`left`,width:`w-20`},{label:`Fmt`,align:`left`,width:`w-12`},{label:`TTFT`,align:`right`,width:`w-16`,sortKey:`ttft_ms`},{label:`Duration`,align:`right`,width:`w-20`,sortKey:`duration_ms`},{label:`In`,align:`right`,width:`w-16`,sortKey:`input_tokens`},{label:`Out`,align:`right`,width:`w-20`,sortKey:`output_tokens`},{label:`C.Read`,align:`right`,width:`w-20`,sortKey:`cache_read_tokens`},{label:`C.Write`,align:`right`,width:`w-20`,sortKey:`cache_creation_tokens`},{label:`Hit`,align:`right`,width:`w-14`},{label:`Tools`,align:`right`,width:`w-14`},{label:`$`,align:`right`,width:`w-20`,sortKey:`cost_usd`}];function k({search:n,onSearchChange:r}){let i=t(),a=n.page??1,u=n.token??``,d=n.project??``,_=n.model??``,{data:k}=s.useTokens(`A`),A=(k?.rows??[]).map(e=>e.name).filter(Boolean),{data:j}=o.useProjectNames(),M=j?.names??[],{data:N}=o.useModelNames(),P=N?.names??[],F=d===S?{project_name_is_null:!0}:d?{project_name:d}:{},I={...u?{token_name:u}:{},...F,..._?{model_name:_}:{}},L=n.sort??`id-desc`,R=L.lastIndexOf(`-`),z=L.slice(0,R),B=L.slice(R+1)===`asc`?`asc`:`desc`,{data:V,isLoading:H,isError:U,refresh:W,isRefreshing:G}=c.useRequestLogs(`P`,{num:x,page:a,orderBy:L,...I}),{data:K,isError:q,refresh:J}=o.useTotalCost({num:0,page:1,...I}),Y=V?.rows??[],X=V?.total??0,Z=Math.ceil(X/x),Q=e=>{r({...n,...e,page:1})};return(0,v.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,v.jsxs)(`div`,{className:`panel-header flex items-center gap-2 px-3 py-2.5 flex-wrap sm:gap-3 sm:px-5`,children:[(0,v.jsxs)(`select`,{value:u,onChange:e=>Q({token:e.target.value||void 0}),disabled:A.length===0,className:`border border-sand-200/80 rounded-lg px-2.5 py-1.5 text-[11px] text-sand-700 bg-sand-50/50 focus:outline-none focus:border-sienna-300 disabled:text-sand-300 disabled:cursor-not-allowed`,children:[(0,v.jsx)(`option`,{value:``,children:A.length>0?`All Tokens`:`Tokens —`}),A.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))]}),(0,v.jsxs)(`select`,{value:d,onChange:e=>Q({project:e.target.value||void 0}),className:`border border-sand-200/80 rounded-lg px-2.5 py-1.5 text-[11px] text-sand-700 bg-sand-50/50 focus:outline-none focus:border-sienna-300`,children:[(0,v.jsx)(`option`,{value:``,children:`All Projects`}),(0,v.jsx)(`option`,{value:S,children:`(unassigned)`}),M.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))]}),(0,v.jsxs)(`select`,{value:_,onChange:e=>Q({model:e.target.value||void 0}),disabled:P.length===0,className:`border border-sand-200/80 rounded-lg px-2.5 py-1.5 text-[11px] text-sand-700 bg-sand-50/50 focus:outline-none focus:border-sienna-300 disabled:text-sand-300 disabled:cursor-not-allowed`,children:[(0,v.jsx)(`option`,{value:``,children:P.length>0?`All Models`:`Models —`}),P.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))]}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>void Promise.all([W(),J()]),disabled:G,"aria-label":`Reload`,title:`Reload`,className:`p-1 rounded text-sand-400 hover:text-sand-600 disabled:opacity-30 transition-colors`,children:(0,v.jsx)(h,{className:G?`size-3.5 animate-spin`:`size-3.5`})}),(0,v.jsx)(`div`,{className:`flex-1`}),(0,v.jsxs)(`span`,{className:`text-[11px] text-sand-400`,children:[U||!V?`—`:X,` results`]}),q?(0,v.jsx)(`span`,{role:`alert`,className:`text-[11px] text-danger-500`,children:`Failed to load total cost.`}):(0,v.jsx)(`span`,{className:`text-[11px] tabular-nums font-medium text-sienna-600`,children:K?f(K.usd):`—`})]}),U?(0,v.jsx)(`div`,{role:`alert`,className:`text-danger-500 text-center py-12 text-sm`,children:`Failed to load request logs.`}):H?(0,v.jsx)(`div`,{className:`space-y-2`,children:Array.from({length:5}).map((e,t)=>(0,v.jsx)(`div`,{className:`h-8 bg-sand-100 rounded animate-pulse`},`skel-${t}`))}):Y.length===0?(0,v.jsx)(`div`,{className:`text-sand-400 text-center py-12 text-sm`,children:`No requests yet.`}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:`overflow-x-auto px-3 py-3 sm:px-5`,children:(0,v.jsxs)(`table`,{className:`w-full min-w-[900px] text-[13px]`,children:[(0,v.jsx)(`thead`,{children:(0,v.jsxs)(`tr`,{className:`border-b border-sand-100/60`,children:[O.map(e=>{let t=e.label===`Duration`?`pl-5 pr-3`:e.width?`px-4`:`px-3`,n=e.sortKey===z;return(0,v.jsx)(`th`,{className:`${e.align===`right`?`text-right`:`text-left`} ${e.width??``} ${e.width?`whitespace-nowrap`:``} ${t} py-1.5 text-[10px] uppercase font-medium ${n?`text-sienna-600`:`text-sand-400`}`,children:e.sortKey?(0,v.jsxs)(`button`,{type:`button`,onClick:()=>Q({sort:l.parse(`${e.sortKey}-${n&&B===`desc`?`asc`:`desc`}`)}),className:`inline-flex items-center gap-0.5 text-[10px] uppercase font-medium hover:text-sienna-500 transition-colors duration-150 ${e.align===`right`?`justify-end w-full`:``}`,children:[e.label,(0,v.jsx)(`span`,{className:n?``:`text-sand-300`,children:n?B===`desc`?`↓`:`↑`:`↕`})]}):e.label},e.label)}),(0,v.jsx)(`th`,{className:`w-8`})]})}),(0,v.jsx)(`tbody`,{className:`divide-y divide-sand-100/60`,children:Y.map(t=>(0,v.jsxs)(`tr`,{className:`transition-colors duration-150 hover:bg-sand-100/60 cursor-pointer`,onClick:e=>{if(e.metaKey||e.ctrlKey){window.open(`/requests/show?id=${t.id}`,`_blank`);return}i({to:`/requests/show`,search:{id:t.id}})},children:[(0,v.jsx)(`td`,{className:`px-4 py-1.5 whitespace-nowrap`,children:(0,v.jsx)(e,{to:`/requests/show`,search:{id:t.id},onClick:e=>e.stopPropagation(),className:`text-xs text-sand-500 tabular-nums hover:text-sienna-500`,children:t.id})}),(0,v.jsx)(`td`,{className:`px-4 py-1.5 whitespace-nowrap`,children:(0,v.jsx)(`span`,{className:`text-xs text-sand-400 tabular-nums`,children:C(t.created_at)})}),(0,v.jsx)(`td`,{className:`px-4 py-1.5 whitespace-nowrap`,children:(0,v.jsx)(`span`,{className:`text-xs text-sand-600`,children:t.project_name??`—`})}),(0,v.jsx)(`td`,{className:`px-4 py-1.5 whitespace-nowrap`,children:(0,v.jsx)(`span`,{className:`text-xs text-sand-500`,children:t.token_name})}),(0,v.jsxs)(`td`,{className:`px-4 py-1.5 whitespace-nowrap`,children:[(0,v.jsx)(E,{status:t.status,requestedModel:t.requested_model_name,servedModel:t.model_name,imageCostMethod:t.image_cost_method,fallbackCount:t.fallback_count}),t.service_tier===`fast`&&(0,v.jsx)(`span`,{title:`Fast 모드`,className:`ml-1 inline-flex align-middle`,children:(0,v.jsx)(g,{"aria-label":`Fast 모드`,className:`size-3 text-[#1877F2] [&_path]:fill-current`})}),t.response_json_ok===!1&&(0,v.jsx)(`span`,{title:`structured 요청의 응답이 JSON 파싱에 실패했습니다`,className:`ml-1.5 rounded-full bg-caution-400/15 px-1.5 py-0.5 text-[9px] font-semibold text-caution-500`,children:`broken`})]}),(0,v.jsx)(`td`,{className:`px-4 py-1.5 whitespace-nowrap`,children:t.is_image_generation?(0,v.jsx)(`span`,{className:`rounded bg-sage-100 px-1.5 py-0.5 font-mono text-[10px] text-sage-700`,children:`img`}):t.is_structured?(0,v.jsx)(`span`,{className:`rounded bg-sienna-100 px-1.5 py-0.5 font-mono text-[10px] text-sienna-700`,children:`json`}):(0,v.jsx)(`span`,{className:`font-mono text-[10px] text-sand-400`,children:`text`})}),(0,v.jsx)(`td`,{className:`px-4 py-1.5 text-right tabular-nums text-sand-500 whitespace-nowrap`,children:D(t.ttft_ms)}),(0,v.jsx)(`td`,{className:`pl-5 pr-3 py-1.5 text-right tabular-nums text-sand-500 whitespace-nowrap`,children:T(t.duration_ms)}),(0,v.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-700`,children:w(t.input_tokens)}),(0,v.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-700`,children:w(t.output_tokens)}),(0,v.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-700`,children:w(t.cache_read_tokens)}),(0,v.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-700`,children:w(t.cache_creation_tokens)}),(0,v.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-700`,children:m(t)}),(0,v.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-500`,children:t.tool_call_count>0?t.tool_call_count:`—`}),(0,v.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-700 whitespace-nowrap`,children:p(t)}),(0,v.jsx)(`td`,{className:`px-2 py-1.5`,children:(0,v.jsx)(b,{className:`size-4 text-sand-400`})})]},t.id))})]})}),Z>1&&(0,v.jsxs)(`div`,{className:`flex items-center justify-center gap-3 px-5 py-2.5 border-t border-sand-100/60`,children:[(0,v.jsx)(`button`,{type:`button`,className:`p-1 rounded text-sand-400 hover:text-sand-600 disabled:opacity-30 transition-colors`,disabled:a===1,onClick:()=>r({...n,page:a-1}),children:(0,v.jsx)(y,{className:`size-4`})}),(0,v.jsxs)(`span`,{className:`text-[11px] text-sand-400 tabular-nums`,children:[a,` / `,Z]}),(0,v.jsx)(`button`,{type:`button`,className:`p-1 rounded text-sand-400 hover:text-sand-600 disabled:opacity-30 transition-colors`,disabled:a===Z,onClick:()=>r({...n,page:a+1}),children:(0,v.jsx)(b,{className:`size-4`})})]})]})]})}a({token:i().optional(),project:i().optional(),model:i().optional(),sort:l.optional(),page:d.shape.page.default(1)});function A(){let e=u.useSearch(),t=u.useNavigate();return(0,v.jsx)(`div`,{className:`max-w-[100rem] mx-auto`,children:(0,v.jsx)(k,{search:e,onSearchChange:e=>t({search:e})})})}export{A as component};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{_ as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,n as r,r as i}from"./vendor-react-DH4kUfK2.js";import{S as a,h as o,t as s}from"./services.generated-NP-ValHd.js";import{a as c,s as l}from"./index-DZwzUfI-.js";import{t as u}from"./cost-DH2jZbrw.js";import{t as d}from"./refresh-cw-NNcU0Cmq.js";var f=e(n(),1),p=e(r(),1);function m(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function h(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function g(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var _=(e,t)=>Math.abs(e-t)<1.01,v=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},y,b=()=>{if(y!==void 0)return y;if(typeof navigator>`u`)return y=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return y=!0;let e=navigator.maxTouchPoints;return y=navigator.platform===`MacIntel`&&e!==void 0&&e>0},x=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},S=e=>e,C=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},w=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(x(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(x(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},T={passive:!0},E=typeof window>`u`?!0:`onscrollend`in window,D=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&E,o=0,s=a?null:v(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,T),a&&r.addEventListener(`scrollend`,u,T),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},O=(e,t)=>D(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),k=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},A=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},j=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:S,rangeExtractor:C,onChange:()=>{},measureElement:k,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=e.start+t;n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=h(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!b()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,T),e.addEventListener(`touchend`,n,T),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(b()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=h(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.getMeasurements=h(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._flatMeasurements;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e,this._flatMeasurements=a}let o;if(u===0)o=t+n;else{let e=u-1;o=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t),n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=o,a[t*2+1]=i,o+=i+s}let c=m(e,a,r);return this.measurementsCache=c,c}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),h=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&h++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,m,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];m=r?r.end+s:t+n}else if(h===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,m=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,m=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=m+v;d[i]={index:i,start:m,size:v,end:y,key:e,lane:u},f[u]===void 0&&h++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=h(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=P(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=h(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(e<0||e>=this.options.count)return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=t-(this.itemSizeCache.get(i)??n);if(o!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,s=a?this.getTotalSize():0,c=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?r<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(i)||this.scrollDirection!==`backward`):this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},o,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++,a?this.applyScrollAdjustment(this.getTotalSize()-s):c&&this.applyScrollAdjustment(o),this.notify(!1)}},this.getVirtualItems=h(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return g(t[M(0,t.length-1,r?e=>n[e*2]:e=>g(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t);this.scrollState={index:null,align:t,behavior:n,startedAt:this.now(),lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e;this.scrollState={index:null,align:`start`,behavior:t,startedAt:this.now(),lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){e!==0&&(b()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&_(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},M=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function N(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function P(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=N(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=M(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var F=typeof document<`u`?f.useLayoutEffect:f.useEffect;function I({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=f.useReducer(e=>e+1,0)[1],a=f.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}let r=!!e.options.horizontal,i=t.mode===`transform`,o=r?`left`:`top`,s=e.options.scrollMargin,c=e.getVirtualItems();for(let n of c){let a=n.start-s,c=e.elementsCache.get(n.key);c&&t.lastPositions.get(c)!==a&&(t.lastPositions.set(c,a),i?c.style.transform=r?`translate3d(${a}px, 0, 0)`:`translate3d(0, ${a}px, 0)`:c.style[o]=`${a}px`)}},s={...r,onChange:(t,n)=>{var s;let c=a.current,l=!0;if(c.enabled){o(t);let e=t.range,n=c.prevRange;l=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,l&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}l&&(e&&n?(0,p.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[c]=f.useState(()=>{let e=new j(s);return Object.assign(e,{containerRef:t=>{let n=a.current;if(n.container=t,n.lastSize=null,t&&n.enabled){let r=e.getTotalSize();n.lastSize=r;let i=e.options.horizontal?`width`:`height`;t.style[i]=`${r}px`}}})});return c.setOptions(s),F(()=>c._didMount(),[]),F(()=>c._willUpdate()),F(()=>{o(c)}),c}function L(e){return I({observeElementRect:w,observeElementOffset:O,scrollToFn:A,...e})}var R=i(),z=1e3,B=5e3,V=4e3,H={trace:0,debug:1,info:2,warning:3,error:4,fatal:5},U={trace:`TRC`,debug:`DBG`,info:`INF`,warning:`WRN`,error:`ERR`,fatal:`FTL`},W=new Intl.DateTimeFormat(`en-GB`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1});function G(e){return W.format(new Date(e))}function K(e){return e.join(`·`)}var q=120;function J(e,t){e.push(t),e.length>q&&e.shift()}var Y=56,X=14;function Z({values:e}){if(e.length<2)return null;let t=Y,n=X,r=Math.max(...e,1),i=t/(q-1),a=t-(e.length-1)*i,o=e.map((e,t)=>{let o=a+t*i,s=n-1-e/r*(n-2);return`${o.toFixed(1)},${s.toFixed(1)}`}).join(` `);return(0,R.jsx)(`svg`,{width:t,height:n,viewBox:`0 0 ${t} ${n}`,className:`shrink-0`,"aria-hidden":`true`,children:(0,R.jsx)(`polyline`,{points:o,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinejoin:`round`,strokeLinecap:`round`,className:`text-sand-300`})})}function Q({usedPercent:e,threshold:t,blocked:n}){if(e===null)return null;let r=Math.max(0,Math.min(e,100)),i=n||t!==null&&e>=t;return(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,R.jsxs)(`span`,{className:`relative inline-block h-[4px] w-9 overflow-hidden rounded-full bg-sand-100`,children:[(0,R.jsx)(`span`,{className:l(`absolute inset-y-0 left-0 rounded-full`,i?`bg-caution-500`:`bg-sand-400`),style:{width:`${r}%`}}),t!==null&&(0,R.jsx)(`span`,{className:`absolute inset-y-0 w-px bg-sand-500`,style:{left:`${Math.min(t,100)}%`}})]}),(0,R.jsxs)(`span`,{className:l(`font-mono text-[10px] tabular-nums`,i?`font-semibold text-caution-500`:`text-sand-500`),children:[Math.round(e),`%`]})]})}function $({search:e,onSearchChange:n}){let[r,i]=(0,f.useState)([]),a=(0,f.useRef)(void 0),o=(0,f.useRef)(void 0),c=(0,f.useRef)(0),[p,m]=(0,f.useState)(()=>Date.now()),h=t({queryKey:[`Monit`,`monitLogs`],queryFn:()=>s.monitLogs(a.current),refetchInterval:z,retry:!1}),g=t({...s.monitInfoQueryOptions(),staleTime:1/0}).data,_=h.data?.vitals,v=t({...s.monitStatsQueryOptions(),refetchInterval:3e4,retry:!1}).data,y=(0,f.useRef)([]);(0,f.useEffect)(()=>{_&&J(y.current,_.openaiInFlight)},[_]),(0,f.useEffect)(()=>{let e=h.data;e&&b(e)},[h.data]);function b(e){let t=()=>++c.current;i(n=>{let r=n,i=[];o.current!==void 0&&e.processStartedAt!==o.current?(r=[],i.push({kind:`restart`,key:t(),processStartedAt:e.processStartedAt})):e.dropped>0&&i.push({kind:`dropped`,key:t(),count:e.dropped}),o.current=e.processStartedAt,a.current=e.nextCursor;let s=r.findLast(e=>e.kind===`log`)?.entry.seq;for(let n of e.entries)s!==void 0&&n.seq<=s||i.push({kind:`log`,key:t(),entry:n});if(i.length===0)return n;let c=[...r,...i];return c.length>V?c.slice(-V):c})}(0,f.useEffect)(()=>{let e=window.setInterval(()=>m(Date.now()),2e3);return()=>window.clearInterval(e)},[]);let x=r.length>0&&(h.isRefetchError||h.dataUpdatedAt>0&&p-h.dataUpdatedAt>B),S=(0,f.useMemo)(()=>r.filter(t=>{if(t.kind!==`log`)return!0;switch(e.level){case`warn`:return(H[t.entry.level]??2)>=3;case`error`:return(H[t.entry.level]??2)>=4;default:return!0}}),[r,e.level]),C=(0,f.useRef)(null),w=L({count:S.length,getScrollElement:()=>C.current,estimateSize:()=>20,getItemKey:e=>S[e].key,anchorTo:`end`,followOnAppend:!0,scrollEndThreshold:80,overscan:12}),T=w.isAtEnd(),E=h.dataUpdatedAt>0,D=!E&&h.isError;return(0,R.jsxs)(`section`,{className:`panel overflow-hidden`,children:[(0,R.jsxs)(`header`,{className:`panel-header flex min-h-11 flex-wrap items-center gap-x-3 gap-y-2 px-4 py-2 sm:px-5`,children:[(0,R.jsx)(`h2`,{className:`text-[13px] font-semibold tracking-[-0.01em] text-sand-800`,children:`Server logs`}),(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[11px] font-medium text-sand-700`,children:[(0,R.jsx)(`span`,{className:l(`size-1.5 rounded-full`,x||D?`bg-danger-400`:`bg-sienna-500 motion-safe:animate-pulse`)}),D?`Disconnected`:x?`Stale`:E?`Live`:`…`]}),o.current!==void 0&&(0,R.jsxs)(`span`,{className:`text-[11px] text-sand-500`,children:[`ephemeral · resets on restart · since `,G(o.current)]}),(0,R.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:(0,R.jsx)(`div`,{className:`segmented-control inline-flex`,role:`tablist`,"aria-label":`Log filter`,children:[{value:`all`,label:`All`},{value:`warn`,label:`Warn+`},{value:`error`,label:`Err+`}].map(t=>(0,R.jsx)(`button`,{type:`button`,"data-active":e.level===t.value,onClick:()=>n({...e,level:t.value}),className:`rounded-[6px] px-2.5 py-1 text-[11px] font-medium text-sand-500 transition-colors hover:text-sand-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sienna-300 data-[active=true]:text-sand-900`,children:t.label},t.value))})})]}),g&&(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-5 gap-y-1 border-b border-sand-100 bg-sand-50/60 px-4 py-2 text-[11px] text-sand-600 sm:px-5`,children:[(0,R.jsxs)(`span`,{children:[`server `,(0,R.jsx)(`span`,{className:`font-mono text-sand-800`,children:g.serverUrl})]}),(0,R.jsxs)(`span`,{children:[`db`,` `,(0,R.jsxs)(`span`,{className:`font-mono text-sand-800`,children:[g.dbHost,`/`,g.dbName]})]}),(0,R.jsxs)(`span`,{children:[`openai transport`,` `,(0,R.jsx)(`span`,{className:`font-mono text-sand-800`,children:g.openai.transport})]}),_&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`openai in-flight`,` `,(0,R.jsx)(`span`,{className:`font-mono text-sand-800`,children:_.openaiInFlight}),(0,R.jsx)(Z,{values:y.current})]}),_.anthropicTokenCount>0&&(0,R.jsxs)(`span`,{children:[`anthropic running`,` `,(0,R.jsx)(`span`,{className:`font-mono text-sand-800`,children:_.anthropicInFlight})]})]}),v?.providers.map(e=>(0,R.jsxs)(`span`,{className:`text-sand-500`,children:[`1h `,e.provider,` `,(0,R.jsx)(`span`,{className:`font-mono text-sand-700`,children:e.requests}),` req`,e.errors>0&&(0,R.jsxs)(R.Fragment,{children:[` · `,(0,R.jsx)(`span`,{className:`font-mono font-semibold text-caution-500`,children:e.errors}),` err`]}),` · hit `,(0,R.jsx)(`span`,{className:`font-mono text-sand-700`,children:u({input_tokens:e.inputTokens,cache_read_tokens:e.cacheReadTokens})})]},e.provider))]}),_&&(_.openaiQuotaByToken.length>0||_.anthropicTokenNames.length>0)&&(0,R.jsxs)(`div`,{className:`space-y-1.5 border-b border-sand-100 px-4 py-2.5 sm:px-5`,children:[_.openaiQuotaByToken.length>0&&(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`w-[4.5rem] shrink-0 text-[10px] font-medium uppercase tracking-[0.08em] text-sand-400`,children:`openai`}),_.openaiQuotaByToken.map(e=>{let t=e.usedPercent===null?`quota not sampled yet`:`quota ${Math.round(e.usedPercent)}%${e.threshold===null?``:` / threshold ${e.threshold}%`}${e.resetsAt?` · resets ${G(e.resetsAt)}`:``}`;return(0,R.jsxs)(`span`,{title:`${e.name} · ${t}`,className:`inline-flex items-center gap-1.5 rounded-md border border-sand-200 bg-white px-2 py-1`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[11px] text-sand-600`,children:e.name.split(`/`).pop()}),(0,R.jsx)(Q,{usedPercent:e.usedPercent,threshold:e.threshold,blocked:e.blocked}),e.blocked&&(0,R.jsx)(`span`,{className:`rounded-full bg-caution-500/10 px-1.5 py-0.5 text-[9px] font-semibold text-caution-500`,children:`quota`})]},e.name)})]}),_.anthropicTokenNames.length>0&&(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`w-[4.5rem] shrink-0 text-[10px] font-medium uppercase tracking-[0.08em] text-sand-400`,children:`anthropic`}),_.anthropicTokenNames.map(e=>(0,R.jsx)(`span`,{title:e,className:`inline-flex items-baseline rounded-md border border-sand-200 bg-white px-2 py-1 font-mono text-[11px] text-sand-600`,children:e.split(`/`).pop()},e))]})]}),(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(`div`,{ref:C,role:`log`,"aria-label":`Server process logs`,tabIndex:0,className:`main-scroll h-[calc(100vh-232px)] min-h-[320px] overflow-y-auto bg-sand-900 px-4 py-3 font-mono text-[12px] leading-[1.6] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-sienna-400`,children:D?(0,R.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 text-sand-400`,children:[(0,R.jsxs)(`p`,{className:`text-[12px]`,children:[`Could not reach the qgrid server — is it running?`,h.error instanceof Error&&(0,R.jsx)(`span`,{className:`block text-center text-[11px] text-sand-500`,children:h.error.message})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void h.refetch(),className:`inline-flex items-center gap-1.5 rounded-md border border-sand-600 px-2.5 py-1.5 text-[11px] font-medium text-sand-300 transition-colors hover:bg-sand-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sienna-400`,children:[(0,R.jsx)(d,{className:`size-3`}),`Retry now`]})]}):E?S.length===0?(0,R.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-sand-500`,children:r.length===0?`No log lines yet — waiting for activity since ${o.current===void 0?`startup`:G(o.current)}.`:`No lines match the current filters.`}):(0,R.jsx)(`div`,{className:`relative w-full`,style:{height:`${w.getTotalSize()}px`},children:w.getVirtualItems().map(e=>{let t=S[e.index];return(0,R.jsx)(`div`,{ref:w.measureElement,"data-index":e.index,className:`absolute left-0 top-0 w-full`,style:{transform:`translateY(${e.start}px)`},children:(0,R.jsx)(ee,{item:t})},e.key)})}):(0,R.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-sand-500`,children:`Connecting to server logs…`})}),E&&!D&&!T&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>w.scrollToEnd(),className:`absolute bottom-4 right-5 inline-flex items-center gap-1.5 rounded-full border border-sand-600 bg-sand-800/90 px-3 py-1.5 text-[11px] font-medium text-sand-200 shadow-lg backdrop-blur transition-colors hover:bg-sand-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sienna-400`,children:`↓ Jump to live`})]})]})}function ee({item:e}){if(e.kind===`restart`)return(0,R.jsxs)(`div`,{className:`py-1 text-center text-[11px] text-caution-400`,children:[`── process restarted · `,G(e.processStartedAt),` ──`]});if(e.kind===`dropped`)return(0,R.jsxs)(`div`,{className:`py-1 text-center text-[11px] italic text-sand-500`,children:[`── `,e.count,` lines dropped (buffer overflow) ──`]});let{entry:t}=e;return(0,R.jsxs)(`div`,{className:`whitespace-pre-wrap break-words text-sand-200`,children:[(0,R.jsx)(`span`,{className:`text-sand-500`,children:G(t.timestamp)}),` `,(0,R.jsx)(`span`,{className:l(`font-semibold`,t.level===`fatal`||t.level===`error`?`text-danger-400`:t.level===`warning`?`text-caution-400`:`text-sand-400`),children:U[t.level]??t.level.slice(0,3).toUpperCase()}),` `,(0,R.jsx)(`span`,{className:`text-sienna-300`,children:K(t.category)}),` `,(0,R.jsx)(`span`,{children:t.text})]})}a({level:o([`all`,`warn`,`error`]).optional().default(`all`).catch(()=>`all`)});function te(){let e=c.useSearch(),t=c.useNavigate();return(0,R.jsx)(`div`,{className:`max-w-[100rem] mx-auto`,children:(0,R.jsx)($,{search:e,onSearchChange:e=>t({search:e,replace:!0})})})}export{te as component};
@@ -1 +0,0 @@
1
- import"./rolldown-runtime-Dw2cE7zH.js";import{i as e,r as t}from"./vendor-react-DH4kUfK2.js";e();var n=t(),r=e=>(0,n.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,n.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M5 12h14m-7-7v14`})});export{r as t};
@@ -1 +0,0 @@
1
- import"./rolldown-runtime-Dw2cE7zH.js";import{i as e,r as t}from"./vendor-react-DH4kUfK2.js";e();var n=t(),r=e=>(0,n.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,n.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,n.jsx)(`path`,{d:`M3 12a9 9 0 0 1 9-9a9.75 9.75 0 0 1 6.74 2.74L21 8`}),(0,n.jsx)(`path`,{d:`M21 3v5h-5m5 4a9 9 0 0 1-9 9a9.75 9.75 0 0 1-6.74-2.74L3 16`}),(0,n.jsx)(`path`,{d:`M8 16H3v5`})]})});export{r as t};
@@ -1 +0,0 @@
1
- import"./rolldown-runtime-Dw2cE7zH.js";import{i as e,r as t}from"./vendor-react-DH4kUfK2.js";e();var n=t(),r=e=>(0,n.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,n.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`})});function i({status:e,requestedModel:t,servedModel:n,imageCostMethod:r}){if(e===`running`)return{label:`실행 중`};let i=/^(?:assumed|estimated):(gpt-image-[^:]+):/.exec(r??``)?.[1],a=n?.startsWith(`openai/gpt-image-`)?n:i?`openai/${i}`:null;if(a){let e=t??n;return{label:e&&e!==a?`${e} → ${a}`:a}}return{label:t&&n&&t!==n?`${t} → ${n}`:n??t??`—`}}export{r as n,i as t};
@@ -1,5 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{y as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,n as r,r as i}from"./vendor-react-DH4kUfK2.js";import{n as a,o}from"./services.generated-NP-ValHd.js";import{o as s}from"./index-DZwzUfI-.js";import{i as c}from"./cost-DH2jZbrw.js";import{t as l}from"./use-update-token-mutation-BQHS0byG.js";import{n as u,t as d}from"./use-oauth-login-flow-hboOs3wG.js";var f=e(r()),p=e(n());function m(){var e=[...arguments];return(0,p.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var h=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function g(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function _(e){return`nodeType`in e}function v(e){return e?g(e)?e:_(e)?e.ownerDocument?.defaultView??window:window:window}function y(e){let{Document:t}=v(e);return e instanceof t}function b(e){return g(e)?!1:e instanceof v(e).HTMLElement}function x(e){return e instanceof v(e).SVGElement}function S(e){return e?g(e)?e.document:_(e)?y(e)?e:b(e)||x(e)?e.ownerDocument:document:document:document}var C=h?p.useLayoutEffect:p.useEffect;function w(e){let t=(0,p.useRef)(e);return C(()=>{t.current=e}),(0,p.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function T(){let e=(0,p.useRef)(null);return[(0,p.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,p.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function E(e,t){let n=(0,p.useRef)();return(0,p.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function ee(e){let t=w(e),n=(0,p.useRef)(null);return[n,(0,p.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}var D={};function O(e,t){return(0,p.useMemo)(()=>{if(t)return t;let n=D[e]==null?0:D[e]+1;return D[e]=n,e+`-`+n},[e,t])}function k(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var A=k(1),te=k(-1);function j(e){return`clientX`in e&&`clientY`in e}function M(e){if(!e)return!1;let{KeyboardEvent:t}=v(e.target);return t&&e instanceof t}function ne(e){if(!e)return!1;let{TouchEvent:t}=v(e.target);return t&&e instanceof t}function re(e){if(ne(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return j(e)?{x:e.clientX,y:e.clientY}:null}var N=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[N.Translate.toString(e),N.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),ie={display:`none`};function P(e){let{id:t,value:n}=e;return p.createElement(`div`,{id:t,style:ie},n)}function F(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return p.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function ae(){let[e,t]=(0,p.useState)(``);return{announce:(0,p.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var oe={draggable:`
2
- To pick up a draggable item, press the space bar.
3
- While dragging, use the arrow keys to move the item.
4
- Press space again to drop the item in its new position, or press escape to cancel.
5
- `},I={onDragStart(e){return`Picked up draggable item ${e}.`},onDragOver(e,t){return t?`Draggable item ${e} was moved over droppable area ${t}.`:`Draggable item ${e} is no longer over a droppable area.`},onDragEnd(e,t){return t?`Draggable item ${e} was dropped over droppable area ${t}`:`Draggable item ${e} was dropped.`},onDragCancel(e){return`Dragging was cancelled. Draggable item ${e} was dropped.`}},L;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(L||={});function R(...e){}var z=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(({disabled:e})=>!e)}getNodeFor(e){return this.get(e)?.node.current??void 0}},se=(0,p.createContext)({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:``},containerNodeRect:null,dispatch:R,draggableNodes:{},droppableRects:new Map,droppableContainers:new z,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:R},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:R,windowRect:null,willRecomputeLayouts:!1});function ce(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new z}}}function le(e,t){switch(t.type){case L.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case L.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case L.DragEnd:case L.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case L.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new z(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case L.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new z(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case L.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new z(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}var ue=(0,p.createContext)({type:null,event:null});function de({onDragStart:e,onDragMove:t,onDragOver:n,onDragEnd:r,onDragCancel:i}){let a=(0,p.useContext)(ue),o=(0,p.useRef)(a);(0,p.useEffect)(()=>{if(a!==o.current){let{type:s,event:c}=a;switch(s){case L.DragStart:e?.(c);break;case L.DragMove:t?.(c);break;case L.DragOver:n?.(c);break;case L.DragCancel:i?.(c);break;case L.DragEnd:r?.(c);break}o.current=a}},[a,e,t,n,r,i])}function fe({announcements:e=I,hiddenTextDescribedById:t,screenReaderInstructions:n}){let{announce:r,announcement:i}=ae(),a=O(`DndLiveRegion`),[o,s]=(0,p.useState)(!1);return(0,p.useEffect)(()=>{s(!0)},[]),de((0,p.useMemo)(()=>({onDragStart({active:t}){r(e.onDragStart(t.id))},onDragMove({active:t,over:n}){e.onDragMove&&r(e.onDragMove(t.id,n?.id))},onDragOver({active:t,over:n}){r(e.onDragOver(t.id,n?.id))},onDragEnd({active:t,over:n}){r(e.onDragEnd(t.id,n?.id))},onDragCancel({active:t}){r(e.onDragCancel(t.id))}}),[r,e])),o?(0,f.createPortal)(p.createElement(p.Fragment,null,p.createElement(P,{id:t,value:n.draggable}),p.createElement(F,{id:a,announcement:i})),document.body):null}var B=Object.freeze({x:0,y:0});function V(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function pe(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+e.width*.5,y:n+e.height*.5}}var me=({collisionRect:e,droppableContainers:t})=>{let n=pe(e,e.left,e.top),r=1/0,i=null;for(let e of t){let{rect:{current:t}}=e;if(t){let a=V(pe(t),n);a<r&&(r=a,i=e.id)}}return i};function he(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function ge(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:B}function _e(e){return function(t,...n){return n.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x,offsetLeft:t.offsetLeft+e*n.x,offsetTop:t.offsetTop+e*n.y}),{...t})}}var ve=_e(1);function H(e,t=window.getComputedStyle(e)){return t.position===`fixed`}function ye(e,t=window.getComputedStyle(e)){let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].find(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})!=null}function U(e){let t=[];function n(e){if(!e)return t;if(y(e)&&e.scrollingElement!=null&&!t.includes(e.scrollingElement))return t.push(e.scrollingElement),t;if(!b(e)||x(e)||t.includes(e))return t;let r=window.getComputedStyle(e);return ye(e,r)&&t.push(e),H(e,r)?t:n(e.parentNode)}return e?n(e.parentNode):t}function W(e){return!h||!e?null:g(e)?e:_(e)?y(e)||e===S(e).scrollingElement?window:b(e)?e:null:null}function be(e){return g(e)?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var G;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(G||={});function xe(e){let t={x:0,y:0},n={x:e.scrollWidth-e.clientWidth,y:e.scrollHeight-e.clientHeight};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=n.y,isRight:e.scrollLeft>=n.x,maxScroll:n,minScroll:t}}function Se(e){return!h||!e?!1:e===document.scrollingElement}var K={x:.2,y:.2};function q(e,t,{top:n,left:r,right:i,bottom:a},o=10,s=K){let{clientHeight:c,clientWidth:l}=e,u=Se(e)?{top:0,left:0,right:l,bottom:c,width:l,height:c}:t,{isTop:d,isBottom:f,isLeft:p,isRight:m}=xe(e),h={x:0,y:0},g={x:0,y:0},_={height:u.height*s.y,width:u.width*s.x};return!d&&n<=u.top+_.height?(h.y=G.Backward,g.y=o*Math.abs((u.top+_.height-n)/_.height)):!f&&a>=u.bottom-_.height&&(h.y=G.Forward,g.y=o*Math.abs((u.bottom-_.height-a)/_.height)),!m&&i>=u.right-_.width?(h.x=G.Forward,g.x=o*Math.abs((u.right-_.width-i)/_.width)):!p&&r<=u.left+_.width&&(h.x=G.Backward,g.x=o*Math.abs((u.left+_.width-r)/_.width)),{direction:h,speed:g}}function Ce(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function we(e){return e.reduce((e,t)=>A(e,be(t)),B)}function J(e,t,n=B){if(!e||!b(e))return n;let r={x:n.x+e.offsetLeft,y:n.y+e.offsetTop};return e.offsetParent===t?r:J(e.offsetParent,t,r)}function Y(e){let{offsetWidth:t,offsetHeight:n}=e,{x:r,y:i}=J(e,null);return{width:t,height:n,offsetTop:i,offsetLeft:r}}function Te(e){if(g(e)){let e=window.innerWidth,t=window.innerHeight;return{top:0,left:0,right:e,bottom:t,width:e,height:t,offsetTop:0,offsetLeft:0}}let{offsetTop:t,offsetLeft:n}=Y(e),{width:r,height:i,top:a,bottom:o,left:s,right:c}=e.getBoundingClientRect();return{width:r,height:i,top:a,bottom:o,right:c,left:s,offsetTop:t,offsetLeft:n}}function Ee(e){let{width:t,height:n,offsetTop:r,offsetLeft:i}=Y(e),a=we(U(e)),o=r-a.y,s=i-a.x;return{width:t,height:n,top:o,bottom:o+n,right:s+t,left:s,offsetTop:r,offsetLeft:i}}function De(e,t){let n=Math.max(t.top,e.offsetTop),r=Math.max(t.left,e.offsetLeft),i=Math.min(t.left+t.width,e.offsetLeft+e.width),a=Math.min(t.top+t.height,e.offsetTop+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var Oe=({collisionRect:e,droppableContainers:t})=>{let n=0,r=null;for(let i of t){let{rect:{current:t}}=i;if(t){let a=De(t,e);a>n&&(n=a,r=i.id)}}return r},X;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(X||={});var ke;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(ke||={});function Ae({acceleration:e,activator:t=X.Pointer,canScroll:n,draggingRect:r,enabled:i,interval:a=5,order:o=ke.TreeOrder,pointerCoordinates:s,scrollableAncestors:c,scrollableAncestorRects:l,threshold:u}){let[d,f]=T(),m=(0,p.useRef)({x:1,y:1}),h=(0,p.useMemo)(()=>{switch(t){case X.Pointer:return s?{top:s.y,bottom:s.y,left:s.x,right:s.x}:null;case X.DraggableRect:return r}return null},[t,r,s]),g=(0,p.useRef)(B),_=(0,p.useRef)(null),v=(0,p.useCallback)(()=>{let e=_.current;if(!e)return;let t=m.current.x*g.current.x,n=m.current.y*g.current.y;e.scrollBy(t,n)},[]),y=(0,p.useMemo)(()=>o===ke.TreeOrder?[...c].reverse():c,[o,c]);(0,p.useEffect)(()=>{if(!i||!c.length||!h){f();return}for(let t of y){if(n?.(t)===!1)continue;let r=l[c.indexOf(t)];if(!r)continue;let{direction:i,speed:o}=q(t,r,h,e,u);if(o.x>0||o.y>0){f(),_.current=t,d(v,a),m.current=o,g.current=i;return}}m.current={x:0,y:0},g.current={x:0,y:0},f()},[e,v,n,f,i,a,JSON.stringify(h),d,c,y,l,JSON.stringify(u)])}function je(e,t){let n=t===null?void 0:e[t],r=n?n.node.current:null;return E(e=>t===null?null:r??e??null,[r,t])}function Me(e,t){return(0,p.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}function Ne(e){let t=(0,p.useRef)(e);return C(()=>{t.current!==e&&(t.current=e)},[e]),t}var Pe;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(Pe||={});var Fe;(function(e){e.Optimized=`optimized`})(Fe||={});var Ie=new Map,Le={measure:Y,strategy:Pe.WhileDragging,frequency:Fe.Optimized};function Re(e,{dragging:t,dependencies:n,config:r}){let[i,a]=(0,p.useState)(!1),{frequency:o,measure:s,strategy:c}={...Le,...r},l=(0,p.useRef)(e),u=(0,p.useCallback)(()=>a(!0),[]),d=(0,p.useRef)(null),f=h(),m=E(n=>{if(f&&!t)return Ie;if(!n||n===Ie||l.current!==e||i){for(let t of e)t&&(t.rect.current=t.node.current?s(t.node.current):null);return ze(e)}return n},[e,t,f,s,i]);return(0,p.useEffect)(()=>{l.current=e},[e]),(0,p.useEffect)(()=>{i&&a(!1)},[i]),(0,p.useEffect)(function(){f||requestAnimationFrame(u)},[t,f]),(0,p.useEffect)(function(){f||typeof o!=`number`||d.current!==null||(d.current=setTimeout(()=>{u(),d.current=null},o))},[o,f,u,...n]),{layoutRectMap:m,recomputeLayouts:u,willRecomputeLayouts:i};function h(){switch(c){case Pe.Always:return!1;case Pe.BeforeDragging:return t;default:return!t}}}function ze(e){let t=new Map;if(e)for(let n of e){if(!n)continue;let{id:e,rect:r}=n;r.current!=null&&t.set(e,r.current)}return t}function Be(e){let[t,n]=(0,p.useState)(null),r=(0,p.useRef)(e),i=(0,p.useCallback)(e=>{let t=W(e.target);t&&n(e=>e?(e.set(t,be(t)),new Map(e)):null)},[]);return(0,p.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=W(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,be(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{W(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,p.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>A(e,t),B):we(e):B,[e,t])}var Ve=[];function He(e){let t=(0,p.useRef)(e),n=E(n=>e?n&&e&&t.current&&e.parentNode===t.current.parentNode?n:U(e):Ve,[e]);return(0,p.useEffect)(()=>{t.current=e},[e]),n}function Ue(e){(0,p.useEffect)(()=>{if(!h)return;let t=e.map(({sensor:e})=>e.setup==null?void 0:e.setup());return()=>{for(let e of t)e?.()}},e.map(({sensor:e})=>e))}function We(e,t){return(0,p.useMemo)(()=>e.reduce((e,{eventName:n,handler:r})=>(e[n]=e=>{r(e,t)},e),{}),[e,t])}var Ge=Je(Te),Ke=Ye(Te);function qe(e,t,n){let r=(0,p.useRef)(e);return E(i=>e?n||!i&&e||e!==r.current?b(e)&&e.parentNode==null?null:t(e):i??null:null,[e,n,t])}function Je(e){return(t,n)=>qe(t,e,n)}function Ye(e){let t=[];return function(n,r){let i=(0,p.useRef)(n);return E(a=>n.length?r||!a&&n.length||n!==i.current?n.map(t=>e(t)):a??t:t,[n,r])}}function Xe(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return b(t)?t:e}function Ze(e){let{width:t,height:n,offsetLeft:r,offsetTop:i}=Y(e);return{top:i,bottom:i+n,left:r,right:r+t,width:t,height:n,offsetTop:i,offsetLeft:r}}var Qe=Je(Ze);function $e({disabled:e,forceRecompute:t}){let[n,r]=ee(),i=Qe(e?null:Xe(n.current),t);return(0,p.useMemo)(()=>({nodeRef:n,rect:i,setRef:r}),[i,n,r])}function et(e,t){return(0,p.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function tt(...e){return(0,p.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var nt=class{constructor(e){this.target=e,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))}}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function rt(e){let{EventTarget:t}=v(e);return e instanceof t?e:S(e)}function it(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var Z;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Z||={});function at(e){e.preventDefault()}function ot(e){e.stopPropagation()}var Q;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`})(Q||={});var st={start:[Q.Space,Q.Enter],cancel:[Q.Esc],end:[Q.Space,Q.Enter]},ct=(e,{currentCoordinates:t})=>{switch(e.code){case Q.Right:return{...t,x:t.x+25};case Q.Left:return{...t,x:t.x-25};case Q.Down:return{...t,y:t.y+25};case Q.Up:return{...t,y:t.y-25}}},lt=class{constructor(e){this.props=e,this.autoScrollEnabled=!1,this.coordinates=B;let{event:{target:t}}=e;this.props=e,this.listeners=new nt(S(t)),this.windowListeners=new nt(v(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Z.Resize,this.handleCancel),this.windowListeners.add(Z.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Z.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props;if(!e.node.current)throw Error(`Active draggable node is undefined`);let n=Te(e.node.current),r={x:n.left,y:n.top};this.coordinates=r,t(r)}handleKeyDown(e){if(M(e)){let{coordinates:t}=this,{active:n,context:r,options:i}=this.props,{keyboardCodes:a=st,coordinateGetter:o=ct,scrollBehavior:s=`smooth`}=i,{code:c}=e;if(a.end.includes(c)){this.handleEnd(e);return}if(a.cancel.includes(c)){this.handleCancel(e);return}let l=o(e,{active:n,context:r.current,currentCoordinates:t});if(l){let n={x:0,y:0},{scrollableAncestors:i}=r.current;for(let r of i){let i=e.code,a=te(l,t),{isTop:o,isRight:c,isLeft:u,isBottom:d,maxScroll:f,minScroll:p}=xe(r),m=Ce(r),h={x:Math.min(i===Q.Right?m.right-m.width/2:m.right,Math.max(i===Q.Right?m.left:m.left+m.width/2,l.x)),y:Math.min(i===Q.Down?m.bottom-m.height/2:m.bottom,Math.max(i===Q.Down?m.top:m.top+m.height/2,l.y))},g=i===Q.Right&&!c||i===Q.Left&&!u,_=i===Q.Down&&!d||i===Q.Up&&!o;if(g&&h.x!==l.x){if(i===Q.Right&&r.scrollLeft+a.x<=f.x||i===Q.Left&&r.scrollLeft+a.x>=p.x){r.scrollBy({left:a.x,behavior:s});return}n.x=i===Q.Right?r.scrollLeft-f.x:r.scrollLeft-p.x,r.scrollBy({left:-n.x,behavior:s});break}else if(_&&h.y!==l.y){if(i===Q.Down&&r.scrollTop+a.y<=f.y||i===Q.Up&&r.scrollTop+a.y>=p.y){r.scrollBy({top:a.y,behavior:s});return}n.y=i===Q.Down?r.scrollTop-f.y:r.scrollTop-p.y,r.scrollBy({top:-n.y,behavior:s});break}}this.handleMove(e,A(l,n))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t),this.coordinates=t}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};lt.activators=[{eventName:`onKeyDown`,handler:(e,{keyboardCodes:t=st,onActivation:n})=>{let{code:r}=e.nativeEvent;return t.start.includes(r)?(e.preventDefault(),n?.({event:e.nativeEvent}),!0):!1}}];function ut(e){return!!(e&&`distance`in e)}function dt(e){return!!(e&&`delay`in e)}var ft=class{constructor(e,t,n=rt(e.event.target)){this.props=e,this.events=t,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=S(i),this.documentListeners=new nt(this.document),this.listeners=new nt(n),this.windowListeners=new nt(v(i)),this.initialCoordinates=re(r),this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(Z.Resize,this.handleCancel),this.windowListeners.add(Z.DragStart,at),this.windowListeners.add(Z.VisibilityChange,this.handleCancel),this.windowListeners.add(Z.ContextMenu,at),this.documentListeners.add(Z.Keydown,this.handleKeydown),t){if(ut(t))return;if(dt(t)){this.timeoutId=setTimeout(this.handleStart,t.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Z.Click,ot,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Z.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=re(e),s=te(n,o);if(!t&&a){if(dt(a))return it(s,a.tolerance)?this.handleCancel():void 0;if(ut(a))return a.tolerance!=null&&it(s,a.tolerance)?this.handleCancel():it(s,a.distance)?this.handleStart():void 0}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onEnd:e}=this.props;this.detach(),e()}handleCancel(){let{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===Q.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},pt={move:{name:`pointermove`},end:{name:`pointerup`}},mt=class extends ft{constructor(e){let{event:t}=e,n=S(t.target);super(e,pt,n)}};mt.activators=[{eventName:`onPointerDown`,handler:({nativeEvent:e},{onActivation:t})=>!e.isPrimary||e.button!==0?!1:(t?.({event:e}),!0)}];var ht={move:{name:`mousemove`},end:{name:`mouseup`}},gt;(function(e){e[e.RightClick=2]=`RightClick`})(gt||={});var _t=class extends ft{constructor(e){super(e,ht,S(e.event.target))}};_t.activators=[{eventName:`onMouseDown`,handler:({nativeEvent:e},{onActivation:t})=>e.button===gt.RightClick?!1:(t?.({event:e}),!0)}];var vt={move:{name:`touchmove`},end:{name:`touchend`}},yt=class extends ft{constructor(e){super(e,vt)}static setup(){return window.addEventListener(vt.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(vt.move.name,e)};function e(){}}};yt.activators=[{eventName:`onTouchStart`,handler:({nativeEvent:e},{onActivation:t})=>{let{touches:n}=e;return n.length>1?!1:(t?.({event:e}),!0)}}];function bt(e,{transform:t,...n}){return e?.length?e.reduce((e,t)=>t({transform:e,...n}),t):t}var xt=[{sensor:mt,options:{}},{sensor:lt,options:{}}],St={current:{}},Ct=(0,p.createContext)({...B,scaleX:1,scaleY:1}),wt=(0,p.memo)(function({id:e,autoScroll:t=!0,announcements:n,children:r,sensors:i=xt,collisionDetection:a=Oe,measuring:o,modifiers:s,screenReaderInstructions:c=oe,...l}){let[u,d]=(0,p.useReducer)(le,void 0,ce),[m,h]=(0,p.useState)(()=>({type:null,event:null})),[g,_]=(0,p.useState)(!1),{draggable:{active:v,nodes:y,translate:b},droppable:{containers:x}}=u,S=v?y[v]:null,w=(0,p.useRef)({initial:null,translated:null}),T=(0,p.useMemo)(()=>v==null?null:{id:v,data:S?.data??St,rect:w},[v,S]),E=(0,p.useRef)(null),[ee,D]=(0,p.useState)(null),[k,te]=(0,p.useState)(null),j=(0,p.useRef)(l),M=O(`DndDescribedBy`,e),ne=(0,p.useMemo)(()=>x.getEnabled(),[x]),{layoutRectMap:N,recomputeLayouts:ie,willRecomputeLayouts:P}=Re(ne,{dragging:g,dependencies:[b.x,b.y],config:o?.droppable}),F=je(y,v),ae=k?re(k):null,I=qe(F,o?.draggable?.measure??Ee),R=Ge(F),z=(0,p.useRef)(null),de=z.current,V=(0,p.useRef)({active:null,activeNode:F,collisionRect:null,droppableRects:N,draggableNodes:y,draggingNodeRect:null,droppableContainers:x,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null,translatedRect:null}),pe=x.getNodeFor(V.current.over?.id),me=Ge(F?F.ownerDocument.defaultView:null),_e=Ge(F?F.parentElement:null),H=He(v?pe??F:null),ye=Ke(H),U=$e({disabled:v==null,forceRecompute:P}),W=U.rect??I,be=W===I?ge(I,de):B,G=bt(s,{transform:{x:b.x-be.x,y:b.y-be.y,scaleX:1,scaleY:1},activatorEvent:k,active:T,activeNodeRect:R,containerNodeRect:_e,draggingNodeRect:W,over:V.current.over,overlayNodeRect:U.rect,scrollableAncestors:H,scrollableAncestorRects:ye,windowRect:me}),xe=ae?A(ae,b):null,Se=Be(H),K=A(G,Se),q=W?ve(W,G):null,Ce=q?ve(q,Se):null,we=T&&Ce?a({active:T,collisionRect:Ce,droppableContainers:ne}):null,[J,Y]=(0,p.useState)(null),Te=he(G,J?.rect??null,I),De=(0,p.useCallback)((e,{sensor:t,options:n})=>{if(!E.current)return;let r=y[E.current];if(!r)return;let i=new t({active:E.current,activeNode:r,event:e.nativeEvent,options:n,context:V,onStart(e){let t=E.current;if(!t)return;let n=y[t];if(!n)return;let{onDragStart:r}=j.current,i={active:{id:t,data:n.data,rect:w}};(0,f.unstable_batchedUpdates)(()=>{d({type:L.DragStart,initialCoordinates:e,active:t}),h({type:L.DragStart,event:i})}),r?.(i)},onMove(e){d({type:L.DragMove,coordinates:e})},onEnd:a(L.DragEnd),onCancel:a(L.DragCancel)});(0,f.unstable_batchedUpdates)(()=>{D(i),te(e.nativeEvent)});function a(e){return async function(){let{active:t,over:n,scrollAdjustedTranslate:r}=V.current,i=null;if(t&&r){let{cancelDrop:a}=j.current;i={active:t,delta:r,over:n},e===L.DragEnd&&typeof a==`function`&&await Promise.resolve(a(i))&&(e=L.DragCancel)}if(E.current=null,(0,f.unstable_batchedUpdates)(()=>{d({type:e}),Y(null),_(!1),D(null),te(null),i&&h({type:e,event:i})}),i){let{onDragCancel:t,onDragEnd:n}=j.current;(e===L.DragEnd?n:t)?.(i)}}}},[d,y]),X=Me(i,(0,p.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent;E.current!==null||i.dndKit||i.defaultPrevented||e(n,t.options)===!0&&(i.dndKit={capturedBy:t.sensor},E.current=r,De(n,t))},[De]));Ue(i),C(()=>{j.current=l},Object.values(l)),(0,p.useEffect)(()=>{v!=null&&_(!0)},[v]),(0,p.useEffect)(()=>{T||(z.current=null),T&&I&&!z.current&&(z.current=I)},[I,T]),(0,p.useEffect)(()=>{let{onDragMove:e}=j.current,{active:t,over:n}=V.current;if(!t)return;let r={active:t,delta:{x:K.x,y:K.y},over:n};h({type:L.DragMove,event:r}),e?.(r)},[K.x,K.y]),(0,p.useEffect)(()=>{let{active:e,droppableContainers:t,scrollAdjustedTranslate:n}=V.current;if(!e||!E.current||!n)return;let{onDragOver:r}=j.current,i=t.get(we),a=i&&i.rect.current?{id:i.id,rect:i.rect.current,data:i.data,disabled:i.disabled}:null,o={active:e,delta:{x:n.x,y:n.y},over:a};(0,f.unstable_batchedUpdates)(()=>{Y(a),h({type:L.DragOver,event:o}),r?.(o)})},[we]),C(()=>{V.current={active:T,activeNode:F,collisionRect:Ce,droppableRects:N,draggableNodes:y,draggingNodeRect:W,droppableContainers:x,over:J,scrollableAncestors:H,scrollAdjustedTranslate:K,translatedRect:q},w.current={initial:W,translated:q}},[T,F,Ce,y,W,N,x,J,H,K,q]),Ae({...Ne(),draggingRect:q,pointerCoordinates:xe,scrollableAncestors:H,scrollableAncestorRects:ye});let ke=(0,p.useMemo)(()=>({active:T,activeNode:F,activeNodeRect:I,activeNodeClientRect:R,activatorEvent:k,activators:X,ariaDescribedById:{draggable:M},containerNodeRect:_e,dispatch:d,dragOverlay:U,draggableNodes:y,droppableContainers:x,droppableRects:N,over:J,recomputeLayouts:ie,scrollableAncestors:H,scrollableAncestorRects:ye,willRecomputeLayouts:P,windowRect:me}),[T,F,R,I,k,X,_e,U,d,y,M,x,N,J,ie,H,ye,P,me]);return p.createElement(ue.Provider,{value:m},p.createElement(se.Provider,{value:ke},p.createElement(Ct.Provider,{value:Te},r)),p.createElement(fe,{announcements:n,hiddenTextDescribedById:M,screenReaderInstructions:c}));function Ne(){let e=ee?.autoScrollEnabled===!1,n=typeof t==`object`?t.enabled===!1:t===!1,r=!e&&!n;return typeof t==`object`?{...t,enabled:r}:{enabled:r}}}),Tt=(0,p.createContext)(null),Et=`button`,Dt=`Droppable`;function Ot({id:e,data:t,disabled:n=!1,attributes:r}){let i=O(Dt),{active:a,activeNodeRect:o,activatorEvent:s,ariaDescribedById:c,draggableNodes:l,droppableRects:u,activators:d,over:f}=(0,p.useContext)(se),{role:m=Et,roleDescription:h=`draggable`,tabIndex:g=0}=r??{},_=a?.id===e,v=(0,p.useContext)(_?Ct:Tt),[y,b]=ee(),x=We(d,e),S=Ne(t);return(0,p.useEffect)(()=>(l[e]={id:e,key:i,node:y,data:S},()=>{let t=l[e];t&&t.key===i&&delete l[e]}),[l,e]),{active:a,activeNodeRect:o,activatorEvent:s,attributes:(0,p.useMemo)(()=>({role:m,tabIndex:g,"aria-pressed":_&&m===Et?!0:void 0,"aria-roledescription":h,"aria-describedby":c.draggable}),[m,g,_,h,c.draggable]),droppableRects:u,isDragging:_,listeners:n?void 0:x,node:y,over:f,setNodeRef:b,transform:v}}function kt(){return(0,p.useContext)(se)}var At=`Droppable`;function jt({data:e,disabled:t=!1,id:n}){let r=O(At),{active:i,dispatch:a,over:o}=(0,p.useContext)(se),s=(0,p.useRef)(null),[c,l]=ee(),u=Ne(e);return C(()=>(a({type:L.RegisterDroppable,element:{id:n,key:r,disabled:t,node:c,rect:s,data:u}}),()=>a({type:L.UnregisterDroppable,key:r,id:n})),[n]),(0,p.useEffect)(()=>{a({type:L.SetDroppableDisabled,id:n,key:r,disabled:t})},[t]),{active:i,rect:s,isOver:o?.id===n,node:c,over:o,setNodeRef:l}}function Mt(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Nt(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function Pt(e){return e!==null&&e>=0}var Ft=({layoutRects:e,activeIndex:t,overIndex:n,index:r})=>{let i=Mt(e,n,t),a=e[r],o=i[r];return!o||!a?null:{x:o.offsetLeft-a.offsetLeft,y:o.offsetTop-a.offsetTop,scaleX:o.width/a.width,scaleY:o.height/a.height}},It=`Sortable`,Lt=p.createContext({activeIndex:-1,containerId:It,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Ft,wasDragging:{current:!1}});function Rt({children:e,id:t,items:n,strategy:r=Ft}){let{active:i,dragOverlay:a,droppableRects:o,over:s,recomputeLayouts:c,willRecomputeLayouts:l}=kt(),u=O(It,t),d=a.rect!==null,f=(0,p.useMemo)(()=>n.map(e=>typeof e==`string`?e:e.id),[n]),m=i!=null,h=(0,p.useRef)(!1),g=i?f.indexOf(i.id):-1,_=g!==-1,v=s?f.indexOf(s.id):-1,y=(0,p.useRef)(f),b=Nt(f,o),x=!zt(f,y.current),S=v!==-1&&g===-1||x;C(()=>{x&&_&&!l&&c()},[x,_,c,l]),(0,p.useEffect)(()=>{y.current=f},[f]),(0,p.useEffect)(()=>{let e=setTimeout(()=>{h.current=m},100);return()=>clearTimeout(e)},[m]);let w=(0,p.useMemo)(()=>({activeIndex:g,containerId:u,disableTransforms:S,items:f,overIndex:v,useDragOverlay:d,sortedRects:b,strategy:r,wasDragging:h}),[g,u,S,f,v,b,d,r,h]);return p.createElement(Lt.Provider,{value:w},e)}function zt(e,t){return e.join()===t.join()}var Bt=({id:e,items:t,activeIndex:n,overIndex:r})=>Mt(t,n,r).indexOf(e),Vt=({containerId:e,isSorting:t,wasDragging:n,index:r,items:i,newIndex:a,previousItems:o,previousContainerId:s,transition:c})=>!c||!n||o!==i&&r===a?!1:t?!0:a!==r&&e===s,Ht={duration:200,easing:`ease`},Ut=`transform`,Wt=N.Transition.toString({property:Ut,duration:0,easing:`linear`}),Gt={roleDescription:`sortable`};function Kt({disabled:e,index:t,node:n,rect:r}){let[i,a]=(0,p.useState)(null),o=(0,p.useRef)(t);return C(()=>{if(!e&&t!==o.current&&n.current){let e=r.current;if(e){let t=Te(n.current),r={x:e.offsetLeft-t.offsetLeft,y:e.offsetTop-t.offsetTop,scaleX:e.width/t.width,scaleY:e.height/t.height};(r.x||r.y)&&a(r)}}t!==o.current&&(o.current=t)},[e,t,n,r]),(0,p.useEffect)(()=>{i&&requestAnimationFrame(()=>{a(null)})},[i]),i}function qt({animateLayoutChanges:e=Vt,attributes:t,disabled:n,data:r,getNewIndex:i=Bt,id:a,strategy:o,transition:s=Ht}){let{items:c,containerId:l,activeIndex:u,disableTransforms:d,sortedRects:f,overIndex:h,useDragOverlay:g,strategy:_,wasDragging:v}=(0,p.useContext)(Lt),y=c.indexOf(a),b=(0,p.useMemo)(()=>({sortable:{containerId:l,index:y,items:c},...r}),[l,r,y,c]),{rect:x,node:S,setNodeRef:C}=jt({id:a,data:b}),{active:w,activeNodeRect:T,activatorEvent:E,attributes:ee,setNodeRef:D,listeners:O,isDragging:k,over:A,transform:te}=Ot({id:a,data:b,attributes:{...Gt,...t},disabled:n}),j=m(C,D),M=!!w,ne=M&&v.current&&!d&&Pt(u)&&Pt(h),re=!g&&k,ie=ne?(re&&ne?te:null)??(o??_)({layoutRects:f,activeNodeRect:T,activeIndex:u,overIndex:h,index:y}):null,P=Pt(u)&&Pt(h)?i({id:a,items:c,activeIndex:u,overIndex:h}):y,F=(0,p.useRef)(c),ae=c!==F.current,oe=(0,p.useRef)(P),I=(0,p.useRef)(l),L=e({active:w,containerId:l,isDragging:k,isSorting:M,id:a,index:y,items:c,newIndex:oe.current,previousItems:F.current,previousContainerId:I.current,transition:s,wasDragging:v.current}),R=Kt({disabled:!L,index:y,node:S,rect:x});return(0,p.useEffect)(()=>{M&&oe.current!==P&&(oe.current=P),l!==I.current&&(I.current=l),c!==F.current&&(F.current=c)},[M,P,l,c]),{active:w,attributes:ee,activatorEvent:E,rect:x,index:y,isSorting:M,isDragging:k,listeners:O,node:S,overIndex:h,over:A,setNodeRef:j,setDroppableNodeRef:C,setDraggableNodeRef:D,transform:R??ie,transition:z()};function z(){if(R||ae&&oe.current===y)return Wt;if(!(re||!s)&&(M||L))return N.Transition.toString({...s,property:Ut})}}Q.Down,Q.Right,Q.Up,Q.Left;var $=i(),Jt=e=>(0,$.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,$.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m12 14l4-4M3.34 19a10 10 0 1 1 17.32 0`})}),Yt=e=>(0,$.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,$.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,$.jsx)(`circle`,{cx:9,cy:12,r:1}),(0,$.jsx)(`circle`,{cx:9,cy:5,r:1}),(0,$.jsx)(`circle`,{cx:9,cy:19,r:1}),(0,$.jsx)(`circle`,{cx:15,cy:12,r:1}),(0,$.jsx)(`circle`,{cx:15,cy:5,r:1}),(0,$.jsx)(`circle`,{cx:15,cy:19,r:1})]})}),Xt=new Set([`anthropic`,`openai`]);function Zt(e){let t=e.trim();if(t===``)return{ok:!0,value:null};if(!/^\d+$/.test(t))return{ok:!1,error:`정수만 입력하세요 (0–100)`};let n=Number(t);return n>100?{ok:!1,error:`100 이하여야 합니다`}:{ok:!0,value:n===0?null:n}}function Qt(e){let t=e.trim();if(!/^\d+$/.test(t))return{ok:!1,error:`1–100 사이 정수를 입력하세요`};let n=Number(t);return n<1||n>100?{ok:!1,error:`1–100 사이 정수를 입력하세요`}:{ok:!0,value:n}}var $t={openai:{stripe:`bg-openai-400`,bar:`bg-openai-bar`,badge:`bg-openai-50 text-openai-600`,cost:`text-openai-600`},anthropic:{stripe:`bg-anthropic-400`,bar:`bg-anthropic-400`,badge:`bg-anthropic-50 text-anthropic-600`,cost:`text-anthropic-600`},google:{stripe:`bg-google-400`,bar:`bg-google-400`,badge:`bg-google-50 text-google-600`,cost:`text-google-600`}},en={stripe:`bg-sand-400`,bar:`bg-sienna-400`,badge:`bg-sand-200 text-sand-500`,cost:`text-sienna-600`};function tn(e){return $t[e]??en}function nn(e,t){return e>=95?`bg-danger-400`:e>=80?`bg-caution-400`:t.bar}function rn(e){if(!e)return``;let t=new Date(e).getTime()-Date.now();if(t<=0)return`resetting...`;let n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);return n>0?`resets ${n}h ${r}m`:`resets ${r}m`}function an(e,t){if(!t||t<=0)return e;let n=t/60;return n>=24?`${Math.round(n/24)}d`:`${Math.round(n)}h`}function on({label:e,utilization:t,resetsAt:n,windowDurationMins:r,theme:i,threshold:a}){let o=t??0,s=a!=null;return(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs text-sand-600 w-7 shrink-0`,children:an(e,r)}),(0,$.jsxs)(`div`,{className:`relative flex-1 min-w-0 h-2 bg-sand-200 rounded-full overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`h-full rounded-full transition-all duration-300 ${nn(o,i)}`,style:{width:`${Math.min(o,100)}%`}}),s&&(0,$.jsx)(`div`,{className:`absolute top-[-2px] bottom-[-2px] w-0.5 bg-sienna-500 rounded-full`,style:{left:`calc(${Math.min(a,100)}% - 1px)`}})]}),(0,$.jsxs)(`span`,{className:`text-xs tabular-nums text-sand-700 w-9 text-right shrink-0`,children:[o,`%`]}),(0,$.jsx)(`span`,{className:`hidden sm:inline text-[10px] text-sand-400 w-24 text-right shrink-0`,title:rn(n),children:rn(n)})]})}function sn({token:e,theme:n}){let r=t(),{data:i,isLoading:o,dataUpdatedAt:s}=a.useUsage(e.id);if((0,p.useEffect)(()=>{i?.error&&r.invalidateQueries({queryKey:[`Token`]})},[i?.error,s,r]),e.reauth_required)return(0,$.jsxs)(`div`,{className:`py-1`,children:[(0,$.jsx)(`p`,{className:`text-[11px] text-amber-600`,children:`Session expired`}),(0,$.jsx)(`p`,{className:`text-[10px] text-sand-400 mt-0.5`,children:`Please re-login via OAuth`})]});if(o)return(0,$.jsxs)(`div`,{className:`animate-pulse space-y-2 py-2`,children:[(0,$.jsx)(`div`,{className:`h-2 w-full bg-sand-200 rounded-full`}),(0,$.jsx)(`div`,{className:`h-2 w-3/4 bg-sand-200 rounded-full`})]});if(i?.error)return(0,$.jsxs)(`div`,{className:`py-1`,children:[(0,$.jsx)(`p`,{className:`text-[11px] text-amber-600`,children:`Unavailable`}),(0,$.jsx)(`p`,{className:`text-[10px] text-sand-400 mt-0.5`,children:i.error})]});if(!i?.fiveHour&&!i?.sevenDay)return(0,$.jsx)(`p`,{className:`text-[11px] text-sand-400 py-1`,children:`No usage data`});let c=Xt.has(e.provider)?e.quota_threshold:null;return(0,$.jsxs)(`div`,{className:`space-y-1.5 py-1`,children:[i.fiveHour&&(0,$.jsx)(on,{label:`5h`,utilization:i.fiveHour.utilization,resetsAt:i.fiveHour.resetsAt,windowDurationMins:i.fiveHour.windowDurationMins,theme:n,threshold:c}),i.sevenDay&&(0,$.jsx)(on,{label:`7d`,utilization:i.sevenDay.utilization,resetsAt:i.sevenDay.resetsAt,windowDurationMins:i.sevenDay.windowDurationMins,theme:n})]})}function cn({token:e}){let[n,r]=(0,p.useState)(null),[i,a]=(0,p.useState)(``),o=(0,p.useRef)(null),c=t(),u=l(),d=Xt.has(e.provider),f=n!==null,m=Zt(i),h=()=>{let t=o.current?.getBoundingClientRect();if(!t)return;let n=Math.min(Math.max(t.right-240,8),Math.max(window.innerWidth-240-8,8)),i=t.top-6-150,s=t.bottom+6;r({left:n,top:Math.min(Math.max(i>=8?i:s,8),Math.max(window.innerHeight-150-8,8))}),a(String(e.quota_threshold??100))},g=()=>r(null);if(!d)return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md text-[10px] text-sand-300 border border-sand-100`,title:`Quota threshold는 이 provider에서 지원되지 않습니다`,children:[(0,$.jsx)(Jt,{className:`size-3`}),`n/a`]});let _=e=>{let t=/^\d+$/.test(i.trim())?Number(i.trim()):0,n=Math.min(Math.max(t+e,0),100);a(String(n))};return(0,$.jsxs)(`div`,{className:`inline-flex`,children:[(0,$.jsxs)(`button`,{ref:o,type:`button`,title:`사용률 제한 설정`,onClick:f?g:h,className:`flex items-center gap-1 px-1.5 py-0.5 rounded-md text-[10px] border border-sand-200/80 text-sand-400 hover:text-sand-600 hover:border-sand-300 transition-colors duration-150`,children:[(0,$.jsx)(Jt,{className:`size-3`}),`Set limit`]}),f&&n&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`fixed inset-0 z-40`,onPointerDown:g}),(0,$.jsxs)(`div`,{className:`fixed z-50 w-60 panel shadow-xl p-3`,style:{top:n.top,left:n.left},children:[(0,$.jsx)(`label`,{htmlFor:`threshold-${e.id}`,className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`사용률 제한`}),(0,$.jsxs)(`div`,{className:`mt-1 flex items-center gap-2`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>_(-10),className:`size-9 shrink-0 rounded-md border border-sand-200 text-sand-600 text-base leading-none hover:bg-sand-100 transition-colors duration-150`,children:`−`}),(0,$.jsx)(s,{id:`threshold-${e.id}`,value:i,onChange:e=>a(e.target.value),inputMode:`numeric`,className:`h-9 w-14 border rounded-md text-center text-sm text-sand-900 bg-white tabular-nums focus:outline-none ${m.ok?`border-sand-200 focus:border-sienna-300`:`border-red-300 focus:border-red-400`}`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>_(10),className:`size-9 shrink-0 rounded-md border border-sand-200 text-sand-600 text-base leading-none hover:bg-sand-100 transition-colors duration-150`,children:`+`}),(0,$.jsx)(`span`,{className:`text-sm text-sand-500`,children:`%`})]}),m.ok?(0,$.jsx)(`p`,{className:`mt-1.5 text-[11px] text-sand-500 leading-snug`,children:m.value===null?`제한 없음 — 사용률과 무관하게 항상 사용합니다.`:`기준 사용률이 임계치에 달하면 해당 토큰을 건너뜁니다.`}):(0,$.jsx)(`p`,{className:`mt-1.5 text-[11px] text-red-500`,children:m.error}),(0,$.jsxs)(`div`,{className:`mt-2 flex items-center justify-end gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,className:`px-2 py-1 text-[11px] font-medium rounded-md border border-sand-200 text-sand-600 hover:bg-sand-100 transition-colors duration-150`,onClick:g,children:`Cancel`}),(0,$.jsx)(`button`,{type:`button`,className:`px-2 py-1 text-[11px] font-medium rounded-md bg-sienna-400 text-white hover:bg-sienna-500 disabled:opacity-50 transition-colors duration-150`,disabled:u.isPending||!m.ok,onClick:async()=>{m.ok&&(await u.mutateAsync({id:e.id,quotaThreshold:m.value}),await Promise.all([c.invalidateQueries({queryKey:[`Token`]}),c.invalidateQueries({queryKey:[`Qgrid`]})]),g())},children:u.isPending?`Saving...`:`Save`})]})]})]})]})}function ln({token:e}){let[n,r]=(0,p.useState)(null),[i,a]=(0,p.useState)(``),o=(0,p.useRef)(null),c=t(),u=l(),d=Qt(i),f=()=>{let t=o.current?.getBoundingClientRect();if(!t)return;let n=Math.min(Math.max(t.right-240,8),Math.max(window.innerWidth-240-8,8)),i=t.top-6-150,s=Math.min(Math.max(i>=8?i:t.bottom+6,8),Math.max(window.innerHeight-150-8,8));a(String(e.weight)),r({left:n,top:s})},m=()=>r(null),h=e=>{let t=/^\d+$/.test(i.trim())?Number(i.trim()):1;a(String(Math.min(Math.max(t+e,1),100)))};return(0,$.jsxs)(`div`,{className:`inline-flex`,children:[(0,$.jsxs)(`button`,{ref:o,type:`button`,title:`라우팅 가중치 설정`,onClick:n?m:f,className:`flex items-center gap-1 px-1.5 py-0.5 rounded-md text-[10px] border border-sand-200/80 text-sand-400 hover:text-sand-600 hover:border-sand-300 transition-colors duration-150`,children:[`Weight `,e.weight]}),n&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`fixed inset-0 z-40`,onPointerDown:m}),(0,$.jsxs)(`div`,{className:`fixed z-50 w-60 panel shadow-xl p-3`,style:n,children:[(0,$.jsx)(`label`,{htmlFor:`weight-${e.id}`,className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`라우팅 가중치`}),(0,$.jsxs)(`div`,{className:`mt-1 flex items-center gap-2`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>h(-1),className:`size-9 shrink-0 rounded-md border border-sand-200 text-sand-600`,children:`−`}),(0,$.jsx)(s,{id:`weight-${e.id}`,value:i,onChange:e=>a(e.target.value),inputMode:`numeric`,className:`h-9 w-16 border rounded-md text-center text-sm tabular-nums ${d.ok?`border-sand-200`:`border-red-300`}`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>h(1),className:`size-9 shrink-0 rounded-md border border-sand-200 text-sand-600`,children:`+`})]}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[11px] ${d.ok?`text-sand-500`:`text-red-500`}`,children:d.ok?`새 요청의 상대 배정 비율입니다.`:d.error}),(0,$.jsxs)(`div`,{className:`mt-2 flex items-center justify-end gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:m,className:`px-2 py-1 text-[11px]`,children:`Cancel`}),(0,$.jsx)(`button`,{type:`button`,onClick:async()=>{d.ok&&(await u.mutateAsync({id:e.id,weight:d.value}),await Promise.all([c.invalidateQueries({queryKey:[`Token`]}),c.invalidateQueries({queryKey:[`Qgrid`]})]),m())},disabled:u.isPending||!d.ok,className:`px-2 py-1 text-[11px] rounded-md bg-sienna-400 text-white disabled:opacity-50`,children:u.isPending?`Saving...`:`Save`})]})]})]})]})}function un({token:e}){let t=d(),n=async e=>{await t.submitCode(e)&&t.reset()};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{type:`button`,title:`기존 이름으로 다시 로그인`,disabled:t.loadingProvider!==null,onClick:()=>void t.start(e.provider,e.name??``),className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium border border-sienna-300 text-sienna-600 hover:bg-sienna-50 disabled:opacity-50 transition-colors duration-150`,children:t.loadingProvider===e.provider?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`size-2.5 border-2 border-sienna-400 border-t-transparent rounded-full animate-spin`}),`로그인 대기`]}):`재로그인`}),t.codeEntryProvider&&(0,$.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,$.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:t.reset,onKeyDown:()=>{}}),(0,$.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-md mx-4`,children:[(0,$.jsx)(`div`,{className:`px-5 py-4 border-b border-sand-100/60`,children:(0,$.jsx)(`h3`,{className:`text-base font-medium text-sand-900`,children:`재로그인`})}),(0,$.jsx)(`div`,{className:`px-5 py-4`,children:(0,$.jsx)(u,{provider:t.codeEntryProvider,isPending:t.completeMutation.isPending,isError:t.completeMutation.isError,onSubmit:e=>void n(e),onRestart:t.reset})})]})]})]})}function dn({token:e}){let{attributes:t,listeners:n,setNodeRef:r,transform:i,transition:o,isDragging:s}=qt({id:String(e.id),transition:{duration:200,easing:`ease`}}),{data:l}=a.useTotalCost({num:0,page:1,...e.name?{token_name:e.name}:{}},{enabled:!!e.name}),u=tn(e.provider);return(0,$.jsxs)(`div`,{ref:r,style:{transform:N.Translate.toString(i),transition:o,opacity:s?.5:1,zIndex:s?10:void 0},className:`relative rounded-lg bg-white border border-sand-200/80 overflow-hidden shadow-sm hover:shadow-md transition-shadow duration-200`,children:[(0,$.jsx)(`div`,{className:`absolute inset-y-0 left-0 w-1 ${u.stripe}`}),(0,$.jsxs)(`div`,{className:`pl-4 pr-3 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`순서 변경 핸들`,...t,...n,className:`shrink-0 -m-1 p-1 text-sand-300 hover:text-sand-500 cursor-grab active:cursor-grabbing touch-none`,children:(0,$.jsx)(Yt,{className:`size-3.5`})}),(0,$.jsx)(`span`,{className:`text-[13px] font-medium text-sand-800 truncate select-none`,children:e.name??`Unnamed`})]}),(0,$.jsx)(`span`,{className:`text-[11px] tabular-nums font-medium shrink-0 ${u.cost}`,children:c(l?.usd??0)})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 mb-2`,children:[(0,$.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full uppercase ${u.badge}`,children:e.provider}),(0,$.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full ${e.active?`bg-sage-100 text-sage-600`:`bg-sand-200 text-sand-500`}`,children:e.active?`Active`:`Inactive`}),Xt.has(e.provider)&&e.quota_threshold!==null&&(0,$.jsxs)(`span`,{className:`px-1.5 py-0.5 rounded-full bg-sienna-50 text-[10px] tabular-nums font-medium text-sienna-600`,title:`사용률 ${e.quota_threshold}% 이상이면 이 토큰 제외`,children:[`≤ `,e.quota_threshold,`%`]})]}),(0,$.jsx)(sn,{token:e,theme:u}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[e.reauth_required&&(0,$.jsx)(un,{token:e}),(0,$.jsx)(`div`,{className:`flex-1`}),(0,$.jsx)(ln,{token:e}),(0,$.jsx)(cn,{token:e})]})]})]})}var fn=[`all`,`openai`,`anthropic`];function pn(){let{data:e,isLoading:n}=o.useTokens(`A`,{orderBy:`ord-asc`}),r=t(),i=o.useReorderMutation(),[a,s]=(0,p.useState)([]),[c,l]=(0,p.useState)(`all`);(0,p.useEffect)(()=>{e?.rows&&s(e.rows)},[e?.rows]);let u=tt(et(mt,{activationConstraint:{distance:5}})),d=t=>{let{active:n,over:c}=t;if(!c||n.id===c.id)return;let l=Number(n.id),u=Number(c.id),d=a.findIndex(e=>e.id===l),f=a.findIndex(e=>e.id===u);if(d===-1||f===-1)return;let p=Mt(a,d,f);s(p);let m=o.getTokensQueryOptions(`A`,{orderBy:`ord-asc`}).queryKey,h=r.getQueryData(m);r.setQueryData(m,e=>e&&{...e,rows:p}),i.mutate({ids:p.map(e=>e.id)},{onError:()=>{r.setQueryData(m,h),e?.rows&&s(e.rows)},onSettled:()=>{Promise.all([r.invalidateQueries({queryKey:[`Token`]}),r.invalidateQueries({queryKey:[`Qgrid`]})])}})};if(n)return(0,$.jsx)(`div`,{className:`panel p-5`,children:(0,$.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:Array.from({length:4}).map((e,t)=>(0,$.jsxs)(`div`,{className:`rounded-lg bg-sand-50 px-4 py-3 animate-pulse`,children:[(0,$.jsx)(`div`,{className:`h-3 w-16 bg-sand-200 rounded mb-3`}),(0,$.jsx)(`div`,{className:`h-2 w-full bg-sand-200 rounded-full`})]},`skel-${t}`))})});if(a.length===0)return(0,$.jsx)(`div`,{className:`panel px-5 py-10`,children:(0,$.jsx)(`p`,{className:`text-sand-400 text-[13px] text-center`,children:`No tokens registered`})});let f=c===`all`?a:a.filter(e=>e.provider===c);return(0,$.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,$.jsxs)(`div`,{className:`panel-header flex items-center justify-between px-5 py-2.5`,children:[(0,$.jsx)(`span`,{className:`text-[13px] font-medium text-sand-700`,children:`Token Usage`}),(0,$.jsx)(`div`,{className:`segmented-control flex gap-0.5`,children:fn.map(e=>(0,$.jsx)(`button`,{type:`button`,"data-active":c===e,className:`px-2.5 py-[3px] text-[11px] font-medium rounded-[6px] transition-all duration-150 ${c===e?`text-sand-800`:`text-sand-500 hover:text-sand-700`}`,onClick:()=>l(e),children:e===`all`?`All`:e===`openai`?`OpenAI`:`Anthropic`},e))})]}),(0,$.jsx)(`div`,{className:`p-4`,children:(0,$.jsx)(wt,{sensors:u,collisionDetection:me,onDragEnd:d,children:(0,$.jsx)(Rt,{items:f.map(e=>String(e.id)),strategy:Ft,children:(0,$.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:f.map(e=>(0,$.jsx)(dn,{token:e},e.id))})})})})]})}function mn(){return(0,$.jsx)(`div`,{className:`max-w-6xl mx-auto`,children:(0,$.jsx)(pn,{})})}export{mn as component};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{y as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,r}from"./vendor-react-DH4kUfK2.js";import{a as i,o as a}from"./services.generated-NP-ValHd.js";import{l as o}from"./index-DZwzUfI-.js";import{t as s}from"./use-update-token-mutation-BQHS0byG.js";import{t as c}from"./plus-B62CuqT8.js";var l=e(n()),u=r(),d=e=>(0,u.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,u.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,u.jsx)(`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0`}),(0,u.jsx)(`circle`,{cx:12,cy:12,r:3})]})}),f=e=>(0,u.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,u.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,u.jsx)(`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575a1 1 0 0 1 0 .696a10.8 10.8 0 0 1-1.444 2.49m-6.41-.679a3 3 0 0 1-4.242-4.242`}),(0,u.jsx)(`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 4.446-5.143M2 2l20 20`})]})}),p=e=>(0,u.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,u.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M5 12h14`})}),m={qgrid:`Qgrid`,slack:`Slack 알림`,slackConnection:`Slack 연결`};function h(e){return e?e.length<=12?`•`.repeat(e.length):`${e.slice(0,8)}${`•`.repeat(12)}${e.slice(-4)}`:``}function g({value:e,min:t,max:n,step:r,disabled:i,onChange:a}){let o=Number(e),s=Number.isFinite(o),l=t??-1/0,d=n??1/0,f=e=>{let n=Math.min(Math.max((s?o:t??0)+e,l),d);a(String(Number(n.toFixed(2))))};return(0,u.jsxs)(`div`,{className:`inline-flex items-center rounded-lg border border-sand-200/80 bg-white overflow-hidden`,children:[(0,u.jsx)(`button`,{type:`button`,"aria-label":`감소`,onClick:()=>f(-r),disabled:i||s&&o<=l,className:`size-7 grid place-items-center text-sand-500 hover:bg-sand-100 disabled:opacity-30 disabled:hover:bg-transparent transition-colors duration-150`,children:(0,u.jsx)(p,{className:`size-3`})}),(0,u.jsx)(`input`,{value:e,onChange:e=>a(e.target.value),disabled:i,inputMode:`decimal`,className:`w-12 text-center text-[12px] tabular-nums text-sand-800 bg-transparent border-x border-sand-200/80 py-1 focus:outline-none focus:bg-sand-50`}),(0,u.jsx)(`button`,{type:`button`,"aria-label":`증가`,onClick:()=>f(r),disabled:i||s&&o>=d,className:`size-7 grid place-items-center text-sand-500 hover:bg-sand-100 disabled:opacity-30 disabled:hover:bg-transparent transition-colors duration-150`,children:(0,u.jsx)(c,{className:`size-3`})})]})}function _({value:e,presets:t,disabled:n,onChange:r}){let i=Number(e);return(0,u.jsx)(`div`,{className:`segmented-control inline-flex`,children:t.map(e=>(0,u.jsx)(`button`,{type:`button`,disabled:n,"data-active":i===e,onClick:()=>r(String(e)),className:`rounded-[6px] px-2.5 py-1 text-[11px] font-medium tabular-nums text-sand-500 transition-colors hover:text-sand-800 disabled:opacity-50 data-[active=true]:text-sand-900`,children:e>=60?`${e/60}시간`:`${e}분`},e))})}function v({source:e}){return(0,u.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded ${e===`db`?`bg-sienna-50 text-sienna-600`:`bg-sand-100 text-sand-500`}`,children:e===`db`?`저장값`:e===`env`?`환경변수`:`기본값`})}function y({on:e,disabled:t,onChange:n}){return(0,u.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,disabled:t,onClick:()=>n(!e),className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors duration-200 disabled:opacity-50 ${e?`bg-sage-400`:`bg-sand-300`}`,children:(0,u.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform duration-200 ${e?`translate-x-4.5`:`translate-x-0.5`}`})})}function b({item:e,disabled:n=!1}){let[r,a]=(0,l.useState)(null),[s,c]=(0,l.useState)(!1),[p,m]=(0,l.useState)(null),b=t(),x=i.useUpdateSettingMutation(),S=i.useResetSettingMutation(),C=n||x.isPending||S.isPending,w=r??e.value,T=r!==null&&r!==e.value,E=()=>b.invalidateQueries({queryKey:i.getSettingListQueryOptions().queryKey}),D=async t=>{m(null);try{await x.mutateAsync({key:e.key,value:t}),await E(),a(null)}catch(e){m(e.message)}},O=async()=>{m(null);try{await S.mutateAsync({key:e.key}),await E(),a(null)}catch(e){m(e.message)}},k=e.kind===`secret`;return(0,u.jsxs)(`div`,{className:`px-4 py-3 sm:px-5`,children:[(0,u.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[13px] text-sand-800`,children:e.label}),(0,u.jsx)(v,{source:e.source}),e.applies===`restart`&&(0,u.jsx)(`span`,{className:`text-[10px] text-caution-500`,title:`저장해도 다음 재시작부터 반영됩니다`,children:`재시작 필요`})]}),e.help&&(0,u.jsx)(`p`,{className:`mt-0.5 text-[11px] text-sand-500`,children:e.help})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[e.kind===`boolean`&&(0,u.jsx)(y,{on:w===`true`,disabled:C,onChange:e=>void D(String(e))}),e.kind===`preset`&&(0,u.jsx)(_,{value:w,presets:e.presets,disabled:C,onChange:e=>void D(e)}),(e.kind===`integer`||e.kind===`number`)&&(0,u.jsx)(g,{value:w,min:e.min,max:e.max,step:e.kind===`integer`?1:.5,disabled:C,onChange:a}),(e.kind===`string`||k)&&(0,u.jsxs)(`div`,{className:`relative`,children:[(0,u.jsx)(`input`,{value:k&&!s?h(w):w,onChange:e=>a(e.target.value),onFocus:()=>k&&c(!0),disabled:C,className:`w-48 sm:w-64 rounded-lg border border-sand-200/80 bg-white py-1.5 pl-2.5 text-[12px] text-sand-800 focus:outline-none focus:border-sienna-300 ${k?`pr-8 font-mono`:`pr-2.5`}`}),k&&(0,u.jsx)(`button`,{type:`button`,"aria-label":s?`값 숨기기`:`값 보기`,onClick:()=>c(e=>!e),className:`absolute right-1.5 top-1/2 -translate-y-1/2 size-6 grid place-items-center text-sand-400 hover:text-sand-600 transition-colors duration-150`,children:s?(0,u.jsx)(f,{className:`size-3.5`}):(0,u.jsx)(d,{className:`size-3.5`})})]}),T&&(0,u.jsx)(`button`,{type:`button`,onClick:()=>void D(w),disabled:C,className:`px-2.5 py-1.5 text-[11px] font-medium rounded-lg bg-sienna-400 text-white hover:bg-sienna-500 disabled:opacity-50 transition-colors duration-150`,children:x.isPending?`저장 중`:`저장`}),!T&&e.source===`db`&&(0,u.jsx)(`button`,{type:`button`,title:`저장값을 지웁니다 — 환경변수 또는 기본값으로 돌아갑니다`,onClick:()=>void O(),disabled:C,className:`size-7 grid place-items-center rounded-lg text-sand-400 hover:text-sand-600 hover:bg-sand-100 disabled:opacity-50 transition-colors duration-150`,children:(0,u.jsx)(o,{className:`size-3.5`})})]})]}),p&&(0,u.jsx)(`p`,{className:`mt-1.5 text-[11px] text-red-500`,children:p})]})}function x({runnerEnabled:e}){let n=t(),[r,i]=(0,l.useState)(null),o=a.useTokens(`A`,{orderBy:`ord-asc`,num:100}),c=s(),d=(o.data?.rows??[]).filter(e=>e.provider===`anthropic`),f=async(e,t)=>{i(null);try{await c.mutateAsync({id:e,keepaliveEnabled:t}),await n.invalidateQueries({queryKey:[`Token`,`getTokens`]})}catch(e){i(e.message)}};return(0,u.jsxs)(`div`,{className:`border-t border-sand-100/80 bg-sand-50/40 px-4 py-3 sm:px-5`,children:[(0,u.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`p`,{className:`text-[11px] font-medium text-sand-600`,children:`토큰별 keepalive`}),(0,u.jsx)(`p`,{className:`mt-0.5 text-[10px] text-sand-400`,children:e?`켜진 활성 Anthropic 토큰만 5시간 윈도우를 유지합니다`:`이 인스턴스는 keepalive runner로 지정되지 않았습니다`})]}),(0,u.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-0.5 text-[10px] ${e?`bg-sage-50 text-sage-600`:`bg-sand-100 text-sand-500`}`,children:e?`runner`:`실행 안 함`})]}),o.isLoading?(0,u.jsx)(`p`,{className:`py-2 text-[11px] text-sand-400`,children:`토큰을 불러오는 중…`}):d.length===0?(0,u.jsx)(`p`,{className:`py-2 text-[11px] text-sand-400`,children:`등록된 Anthropic 토큰이 없습니다`}):(0,u.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-sand-200/70 bg-white`,children:d.map(t=>(0,u.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-b border-sand-100/80 px-3 py-2 last:border-b-0`,children:[(0,u.jsxs)(`div`,{className:`min-w-0`,children:[(0,u.jsx)(`span`,{className:`block truncate text-[12px] text-sand-700`,children:t.name}),!t.active&&(0,u.jsx)(`span`,{className:`text-[10px] text-sand-400`,children:`토큰 비활성`})]}),(0,u.jsx)(y,{on:t.keepalive_enabled,disabled:!e||c.isPending,onChange:e=>void f(t.id,e)})]},t.id))}),r&&(0,u.jsx)(`p`,{className:`mt-2 text-[11px] text-red-500`,children:r})]})}function S(){let[e,t]=(0,l.useState)(null),n=i.useTriggerExpiryReminderMutation(),r=async()=>{t(null);try{let{sent:e}=await n.mutateAsync();t(e===0?`재로그인이 필요한 토큰이 없습니다`:`${e}건 발송`)}catch(e){t(e.message)}};return(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e&&(0,u.jsx)(`span`,{className:`text-[11px] text-sand-500`,children:e}),(0,u.jsx)(`button`,{type:`button`,onClick:()=>void r(),disabled:n.isPending,className:`px-2 py-1 text-[11px] rounded-lg border border-sand-200/80 text-sand-600 hover:bg-sand-100 disabled:opacity-50 transition-colors duration-150`,children:n.isPending?`보내는 중`:`지금 보내기`})]})}function C(){let e=i.useSettingList(),{data:t,isLoading:n}=e;if(n)return(0,u.jsx)(`div`,{className:`space-y-4`,children:[0,1].map(e=>(0,u.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,u.jsx)(`div`,{className:`panel-header px-4 py-2.5 sm:px-5`,children:(0,u.jsx)(`div`,{className:`h-3 w-24 rounded bg-sand-200 animate-pulse`})}),(0,u.jsx)(`div`,{className:`divide-y divide-sand-100/80`,children:[0,1,2].map(e=>(0,u.jsxs)(`div`,{className:`px-4 py-3 sm:px-5 flex items-center justify-between gap-4`,children:[(0,u.jsx)(`div`,{className:`h-3 w-40 rounded bg-sand-100 animate-pulse`}),(0,u.jsx)(`div`,{className:`h-7 w-24 rounded-lg bg-sand-100 animate-pulse`})]},e))})]},e))});if(e.isError&&!t)return(0,u.jsxs)(`div`,{className:`panel px-5 py-6 text-center`,children:[(0,u.jsx)(`p`,{className:`text-[13px] font-medium text-sand-800`,children:`설정을 불러오지 못했습니다`}),(0,u.jsx)(`p`,{className:`mt-1 text-[11px] text-red-500`,children:e.error.message}),(0,u.jsx)(`button`,{type:`button`,onClick:()=>void e.refetch(),disabled:e.isFetching,className:`mt-3 px-3 py-1.5 text-[12px] rounded-lg border border-sand-200 text-sand-600 hover:bg-sand-100 disabled:opacity-50`,children:e.isFetching?`다시 불러오는 중`:`다시 시도`})]});let r=t?.settings??[],a=t?.runtime??[],o=[...new Set(r.map(e=>e.group))];return(0,u.jsxs)(`div`,{className:`space-y-4`,children:[(0,u.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,u.jsxs)(`div`,{className:`panel-header flex items-center justify-between px-4 py-2.5 sm:px-5`,children:[(0,u.jsx)(`span`,{className:`text-[13px] font-medium text-sand-700`,children:`환경`}),(0,u.jsx)(`span`,{className:`text-[11px] text-sand-400`,children:`기동 시점 값`})]}),(0,u.jsx)(`dl`,{className:`px-4 py-3 sm:px-5 grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-1.5`,children:a.map(e=>(0,u.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 min-w-0`,children:[(0,u.jsx)(`dt`,{className:`text-[11px] text-sand-500 shrink-0`,children:e.label}),(0,u.jsx)(`dd`,{className:`text-[12px] font-mono text-sand-700 truncate`,children:e.value})]},e.label))})]}),o.map(e=>{let n=r.filter(t=>t.group===e);return(0,u.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,u.jsxs)(`div`,{className:`panel-header flex items-center justify-between px-4 py-2.5 sm:px-5`,children:[(0,u.jsx)(`span`,{className:`text-[13px] font-medium text-sand-700`,children:m[e]??e}),e===`slack`&&(0,u.jsx)(S,{})]}),(0,u.jsx)(`div`,{className:`divide-y divide-sand-100/80`,children:n.map(e=>(0,u.jsxs)(`div`,{children:[(0,u.jsx)(b,{item:e,disabled:e.key===`qgrid.tokenWindowKeepaliveEnabled`&&!t?.keepaliveRunnerEnabled}),e.key===`qgrid.tokenWindowKeepaliveEnabled`&&(0,u.jsx)(x,{runnerEnabled:t?.keepaliveRunnerEnabled??!1})]},e.key))})]},e)})]})}function w(){return(0,u.jsx)(`div`,{className:`max-w-4xl mx-auto`,children:(0,u.jsx)(C,{})})}export{w as component};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{_ as t,l as n}from"./vendor-tanstack-DJRQAbrY.js";import{i as r,r as i}from"./vendor-react-DH4kUfK2.js";import{i as a,r as o,u as s}from"./services.generated-NP-ValHd.js";import{c,d as l,t as u,u as d}from"./index-DZwzUfI-.js";import{n as f,t as p}from"./cost-DH2jZbrw.js";import{n as m,t as h}from"./request-model-CojtinqK.js";function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},g.apply(null,arguments)}function _(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var v=e(r()),y=i(),b={},x=(0,v.createContext)(b),S=(e,t)=>g({},e,t),C=()=>(0,v.useContext)(x),w=(0,v.createContext)(()=>{});w.displayName=`JVR.DispatchShowTools`;function T(){return(0,v.useReducer)(S,b)}function E(){return(0,v.useContext)(w)}var D=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,y.jsx)(x.Provider,{value:t,children:(0,y.jsx)(w.Provider,{value:n,children:r})})};D.displayName=`JVR.ShowTools`;var ee={},te=(0,v.createContext)(ee),ne=(e,t)=>g({},e,t),O=()=>(0,v.useContext)(te),k=(0,v.createContext)(()=>{});k.displayName=`JVR.DispatchExpands`;function re(){return(0,v.useReducer)(ne,ee)}function ie(){return(0,v.useContext)(k)}var ae=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,y.jsx)(te.Provider,{value:t,children:(0,y.jsx)(k.Provider,{value:n,children:r})})};ae.displayName=`JVR.Expands`;var oe={Str:{as:`span`,"data-type":`string`,style:{color:`var(--w-rjv-type-string-color, #cb4b16)`},className:`w-rjv-type`,children:`string`},Url:{as:`a`,style:{color:`var(--w-rjv-type-url-color, #0969da)`},"data-type":`url`,className:`w-rjv-type`,children:`url`},Undefined:{style:{color:`var(--w-rjv-type-undefined-color, #586e75)`},as:`span`,"data-type":`undefined`,className:`w-rjv-type`,children:`undefined`},Null:{style:{color:`var(--w-rjv-type-null-color, #d33682)`},as:`span`,"data-type":`null`,className:`w-rjv-type`,children:`null`},Map:{style:{color:`var(--w-rjv-type-map-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`map`,className:`w-rjv-type`,children:`Map`},Nan:{style:{color:`var(--w-rjv-type-nan-color, #859900)`},as:`span`,"data-type":`nan`,className:`w-rjv-type`,children:`NaN`},Bigint:{style:{color:`var(--w-rjv-type-bigint-color, #268bd2)`},as:`span`,"data-type":`bigint`,className:`w-rjv-type`,children:`bigint`},Int:{style:{color:`var(--w-rjv-type-int-color, #268bd2)`},as:`span`,"data-type":`int`,className:`w-rjv-type`,children:`int`},Set:{style:{color:`var(--w-rjv-type-set-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`set`,className:`w-rjv-type`,children:`Set`},Float:{style:{color:`var(--w-rjv-type-float-color, #859900)`},as:`span`,"data-type":`float`,className:`w-rjv-type`,children:`float`},True:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},False:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},Date:{style:{color:`var(--w-rjv-type-date-color, #268bd2)`},as:`span`,"data-type":`date`,className:`w-rjv-type`,children:`date`}},se=(0,v.createContext)(oe),ce=(e,t)=>g({},e,t),A=()=>(0,v.useContext)(se),le=(0,v.createContext)(()=>{});le.displayName=`JVR.DispatchTypes`;function ue(){return(0,v.useReducer)(ce,oe)}function de(){return(0,v.useContext)(le)}function fe(e){var{initial:t,dispatch:n,children:r}=e;return(0,y.jsx)(se.Provider,{value:t,children:(0,y.jsx)(le.Provider,{value:n,children:r})})}fe.displayName=`JVR.Types`;var pe=[`style`];function me(e){var{style:t}=e,n=_(e,pe);return(0,y.jsx)(`svg`,g({viewBox:`0 0 24 24`,fill:`var(--w-rjv-arrow-color, currentColor)`,style:g({cursor:`pointer`,height:`1em`,width:`1em`,userSelect:`none`,display:`inline-flex`},t)},n,{children:(0,y.jsx)(`path`,{d:`M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z`})}))}me.displayName=`JVR.TriangleArrow`;var he={Arrow:{as:`span`,className:`w-rjv-arrow`,style:{transform:`rotate(0deg)`,transition:`all 0.3s`},children:(0,y.jsx)(me,{})},Colon:{as:`span`,style:{color:`var(--w-rjv-colon-color, var(--w-rjv-color))`,marginLeft:0,marginRight:2},className:`w-rjv-colon`,children:`:`},Quote:{as:`span`,style:{color:`var(--w-rjv-quotes-color, #236a7c)`},className:`w-rjv-quotes`,children:`"`},ValueQuote:{as:`span`,style:{color:`var(--w-rjv-quotes-string-color, #cb4b16)`},className:`w-rjv-quotes`,children:`"`},BracketsLeft:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-start`,children:`[`},BracketsRight:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-end`,children:`]`},BraceLeft:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-start`,children:`{`},BraceRight:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-end`,children:`}`}},ge=(0,v.createContext)(he),_e=(e,t)=>g({},e,t),j=()=>(0,v.useContext)(ge),M=(0,v.createContext)(()=>{});M.displayName=`JVR.DispatchSymbols`;function ve(){return(0,v.useReducer)(_e,he)}function ye(){return(0,v.useContext)(M)}var be=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,y.jsx)(ge.Provider,{value:t,children:(0,y.jsx)(M.Provider,{value:n,children:r})})};be.displayName=`JVR.Symbols`;var xe={Copied:{className:`w-rjv-copied`,style:{height:`1em`,width:`1em`,cursor:`pointer`,verticalAlign:`middle`,marginLeft:5}},CountInfo:{as:`span`,className:`w-rjv-object-size`,style:{color:`var(--w-rjv-info-color, #0000004d)`,paddingLeft:8,fontStyle:`italic`}},CountInfoExtra:{as:`span`,className:`w-rjv-object-extra`,style:{paddingLeft:8}},Ellipsis:{as:`span`,style:{cursor:`pointer`,color:`var(--w-rjv-ellipsis-color, #cb4b16)`,userSelect:`none`},className:`w-rjv-ellipsis`,children:`...`},Row:{as:`div`,className:`w-rjv-line`},KeyName:{as:`span`,className:`w-rjv-object-key`}},Se=(0,v.createContext)(xe),Ce=(e,t)=>g({},e,t),N=()=>(0,v.useContext)(Se),P=(0,v.createContext)(()=>{});P.displayName=`JVR.DispatchSection`;function we(){return(0,v.useReducer)(Ce,xe)}function Te(){return(0,v.useContext)(P)}var Ee=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,y.jsx)(Se.Provider,{value:t,children:(0,y.jsx)(P.Provider,{value:n,children:r})})};Ee.displayName=`JVR.Section`;var De={objectSortKeys:!1,indentWidth:15},F=(0,v.createContext)(De);F.displayName=`JVR.Context`;var Oe=(0,v.createContext)(()=>{});Oe.displayName=`JVR.DispatchContext`;function ke(e,t){return g({},e,t)}var I=()=>(0,v.useContext)(F),Ae=e=>{var{children:t,initialState:n,initialTypes:r}=e,[i,a]=(0,v.useReducer)(ke,Object.assign({},De,n)),[o,s]=T(),[c,l]=re(),[u,d]=ue(),[f,p]=ve(),[m,h]=we();return(0,v.useEffect)(()=>a(g({},n)),[n]),(0,y.jsx)(F.Provider,{value:i,children:(0,y.jsx)(Oe.Provider,{value:a,children:(0,y.jsx)(D,{initial:o,dispatch:s,children:(0,y.jsx)(ae,{initial:c,dispatch:l,children:(0,y.jsx)(fe,{initial:g({},u,r),dispatch:d,children:(0,y.jsx)(be,{initial:f,dispatch:p,children:(0,y.jsx)(Ee,{initial:m,dispatch:h,children:t})})})})})})})};Ae.displayName=`JVR.Provider`;function je(e){if(e==null)throw TypeError(`Cannot destructure `+e)}var Me=[`isNumber`,`value`,`parentValue`,`keyName`,`keys`],Ne=[`as`,`render`],Pe=[`as`,`render`],Fe=[`as`,`render`],Ie=[`as`,`style`,`render`],Le=[`as`,`render`],Re=[`as`,`render`],ze=[`as`,`render`],Be=[`as`,`render`],Ve=e=>{var{Quote:t={}}=j(),{isNumber:n,value:r,parentValue:i,keyName:a,keys:o}=e,s=_(e,Me);if(n)return null;var{as:c,render:l}=t,u=_(t,Ne),d=c||`span`,f=g({},s,u);return typeof f.children==`string`&&(f.children=f.children.trim()||void 0),l&&typeof l==`function`&&l(f,{value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])})||(0,y.jsx)(d,g({},f))};Ve.displayName=`JVR.Quote`;var L=e=>{var{ValueQuote:t={}}=j(),n=g({},(je(e),e)),{as:r,render:i}=t,a=_(t,Pe),o=r||`span`,s=g({},n,a);return i&&typeof i==`function`&&i(s,{})||(0,y.jsx)(o,g({},s))};L.displayName=`JVR.ValueQuote`;var He=e=>{var{value:t,parentValue:n,keyName:r,keys:i}=e,{Colon:a={}}=j(),{as:o,render:s}=a,c=_(a,Fe),l=o||`span`;return s&&typeof s==`function`&&s(c,{value:t,parentValue:n,keyName:r,keys:i||(r?[r]:[])})||(0,y.jsx)(l,g({},c))};He.displayName=`JVR.Colon`;var Ue=e=>{var{Arrow:t={}}=j(),n=O(),{expandKey:r,style:i,value:a,parentValue:o,keyName:s,keys:c}=e,l=!!n[r],{as:u,style:d,render:f}=t,p=_(t,Ie),m=u||`span`,h=f&&typeof f==`function`,v=g({},p,{"data-expanded":l,style:g({},d,i)});return h&&f(v,{value:a,parentValue:o,keyName:s,keys:c||(s?[s]:[])})||(0,y.jsx)(m,g({},p,{style:g({},d,i)}))};Ue.displayName=`JVR.Arrow`;var We=e=>{var{isBrackets:t,value:n,parentValue:r,keyName:i,keys:a}=e,{BracketsLeft:o={},BraceLeft:s={}}=j(),c={value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])};if(t){var{as:l,render:u}=o,d=_(o,Le),f=l||`span`;return u&&typeof u==`function`&&u(d,c)||(0,y.jsx)(f,g({},d))}var{as:p,render:m}=s,h=_(s,Re),v=p||`span`;return m&&typeof m==`function`&&m(h,c)||(0,y.jsx)(v,g({},h))};We.displayName=`JVR.BracketsOpen`;var Ge=e=>{var{isBrackets:t,isVisiable:n,value:r,parentValue:i,keyName:a,keys:o}=e,s={value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])};if(!n)return null;var{BracketsRight:c={},BraceRight:l={}}=j();if(t){var{as:u,render:d}=c,f=_(c,ze),p=u||`span`;return d&&typeof d==`function`&&d(f,s)||(0,y.jsx)(p,g({},f))}var{as:m,render:h}=l,v=_(l,Be),b=m||`span`;return h&&typeof h==`function`&&h(v,s)||(0,y.jsx)(b,g({},v))};Ge.displayName=`JVR.BracketsClose`;var Ke=e=>{var{keyName:t,value:n,expandKey:r,parentValue:i,level:a,keys:o=[]}=e,s=O(),{collapsed:c,shouldExpandNodeInitially:l}=I(),u=typeof c==`boolean`?c:typeof c==`number`?a>c:!1,d=s[r]??(l?!1:u),f=l&&l(!d,{value:n,keys:o,level:a,keyName:t,parentValue:i});if(l&&c===!1){if(s[r]===void 0&&!f)return null}else if(s[r]===void 0&&f)return null;var p=Object.keys(n).length;if(d||p===0)return null;var m={paddingLeft:4},h={keyName:t,value:n,keys:o,parentValue:i},_=Array.isArray(n),v=n instanceof Set;return(0,y.jsx)(`div`,{style:m,children:(0,y.jsx)(Ge,g({isBrackets:_||v},h,{isVisiable:!0}))})};Ke.displayName=`JVR.NestedClose`;var qe=[`as`,`render`],Je=[`as`,`render`],Ye=[`as`,`render`],Xe=[`as`,`render`],Ze=[`as`,`render`],Qe=[`as`,`render`],$e=[`as`,`render`],et=[`as`,`render`],tt=[`as`,`render`],nt=[`as`,`render`],rt=[`as`,`render`],it=[`as`,`render`],at=[`as`,`render`],ot=e=>{if(e===void 0)return`0n`;if(typeof e==`string`)try{e=BigInt(e)}catch{return`0n`}return e?e.toString()+`n`:`0n`},st=e=>{var{value:t,keyName:n}=e,{Set:r={},displayDataTypes:i}=A();if(!(t instanceof Set)||!i)return null;var{as:a,render:o}=r,s=_(r,qe);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,y.jsx)(a||`span`,g({},s))};st.displayName=`JVR.SetComp`;var ct=e=>{var{value:t,keyName:n}=e,{Map:r={},displayDataTypes:i}=A();if(!(t instanceof Map)||!i)return null;var{as:a,render:o}=r,s=_(r,Je);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,y.jsx)(a||`span`,g({},s))};ct.displayName=`JVR.MapComp`;var R={opacity:.75,paddingRight:4},lt=e=>{var{children:t=``,keyName:n,keys:r}=e,{Str:i={},displayDataTypes:a}=A(),{shortenTextAfterLength:o=30,stringEllipsis:s=`...`}=I(),{as:c,render:l}=i,u=_(i,Ye),d=t,[f,p]=(0,v.useState)(o&&d.length>o);(0,v.useEffect)(()=>p(o&&d.length>o),[o]);var m=c||`span`,h=g({},R,i.style||{});o>0&&(u.style=g({},u.style,{cursor:d.length<=o?`initial`:`pointer`}),d.length>o&&(u.onClick=()=>{p(!f)}));var b=f?``+d.slice(0,o)+s:d,x=l&&typeof l==`function`,S=x&&l(g({},u,{style:h}),{type:`type`,value:t,keyName:n,keys:r}),C=f?`w-rjv-value w-rjv-value-short`:`w-rjv-value`,w=x&&l(g({},u,{children:b,className:C}),{type:`value`,value:t,keyName:n,keys:r});return(0,y.jsxs)(v.Fragment,{children:[a&&(S||(0,y.jsx)(m,g({},u,{style:h}))),w||(0,y.jsxs)(v.Fragment,{children:[(0,y.jsx)(L,{}),(0,y.jsx)(m,g({},u,{className:C,children:b})),(0,y.jsx)(L,{})]})]})};lt.displayName=`JVR.TypeString`;var ut=e=>{var{children:t,keyName:n,keys:r}=e,{True:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=_(i,Xe),l=o||`span`,u=g({},R,i.style||{}),d=s&&typeof s==`function`,f=d&&s(g({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(g({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,y.jsxs)(v.Fragment,{children:[a&&(f||(0,y.jsx)(l,g({},c,{style:u}))),p||(0,y.jsx)(l,g({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};ut.displayName=`JVR.TypeTrue`;var dt=e=>{var{children:t,keyName:n,keys:r}=e,{False:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=_(i,Ze),l=o||`span`,u=g({},R,i.style||{}),d=s&&typeof s==`function`,f=d&&s(g({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(g({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,y.jsxs)(v.Fragment,{children:[a&&(f||(0,y.jsx)(l,g({},c,{style:u}))),p||(0,y.jsx)(l,g({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};dt.displayName=`JVR.TypeFalse`;var ft=e=>{var{children:t,keyName:n,keys:r}=e,{Float:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=_(i,Qe),l=o||`span`,u=g({},R,i.style||{}),d=s&&typeof s==`function`,f=d&&s(g({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(g({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,y.jsxs)(v.Fragment,{children:[a&&(f||(0,y.jsx)(l,g({},c,{style:u}))),p||(0,y.jsx)(l,g({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};ft.displayName=`JVR.TypeFloat`;var pt=e=>{var{children:t,keyName:n,keys:r}=e,{Int:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=_(i,$e),l=o||`span`,u=g({},R,i.style||{}),d=s&&typeof s==`function`,f=d&&s(g({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(g({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,y.jsxs)(v.Fragment,{children:[a&&(f||(0,y.jsx)(l,g({},c,{style:u}))),p||(0,y.jsx)(l,g({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};pt.displayName=`JVR.TypeInt`;var mt=e=>{var{children:t,keyName:n,keys:r}=e,{Bigint:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=_(i,et),l=o||`span`,u=g({},R,i.style||{}),d=s&&typeof s==`function`,f=d&&s(g({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(g({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,y.jsxs)(v.Fragment,{children:[a&&(f||(0,y.jsx)(l,g({},c,{style:u}))),p||(0,y.jsx)(l,g({},c,{className:`w-rjv-value`,children:ot(t?.toString())}))]})};mt.displayName=`JVR.TypeFloat`;var ht=e=>{var{children:t,keyName:n,keys:r}=e,{Url:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=_(i,tt),l=o||`span`,u=g({},R,i.style),d=s&&typeof s==`function`,f=d&&s(g({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(g({},c,{children:t?.href,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,y.jsxs)(v.Fragment,{children:[a&&(f||(0,y.jsx)(l,g({},c,{style:u}))),p||(0,y.jsxs)(`a`,g({href:t?.href,target:`_blank`},c,{className:`w-rjv-value`,children:[(0,y.jsx)(L,{}),t?.href,(0,y.jsx)(L,{})]}))]})};ht.displayName=`JVR.TypeUrl`;var gt=e=>{var{children:t,keyName:n,keys:r}=e,{Date:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=_(i,nt),l=o||`span`,u=g({},R,i.style||{}),d=s&&typeof s==`function`,f=d&&s(g({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=t instanceof Date?t.toLocaleString():t,m=d&&s(g({},c,{children:p,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,y.jsxs)(v.Fragment,{children:[a&&(f||(0,y.jsx)(l,g({},c,{style:u}))),m||(0,y.jsx)(l,g({},c,{className:`w-rjv-value`,children:p}))]})};gt.displayName=`JVR.TypeDate`;var _t=e=>{var{children:t,keyName:n,keys:r}=e,{Undefined:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=_(i,rt),l=o||`span`,u=g({},R,i.style||{}),d=s&&typeof s==`function`,f=d&&s(g({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(g({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,y.jsxs)(v.Fragment,{children:[a&&(f||(0,y.jsx)(l,g({},c,{style:u}))),p]})};_t.displayName=`JVR.TypeUndefined`;var vt=e=>{var{children:t,keyName:n,keys:r}=e,{Null:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=_(i,it),l=o||`span`,u=g({},R,i.style||{}),d=s&&typeof s==`function`,f=d&&s(g({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(g({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,y.jsxs)(v.Fragment,{children:[a&&(f||(0,y.jsx)(l,g({},c,{style:u}))),p]})};vt.displayName=`JVR.TypeNull`;var yt=e=>{var{children:t,keyName:n,keys:r}=e,{Nan:i={},displayDataTypes:a}=A(),{as:o,render:s}=i,c=_(i,at),l=o||`span`,u=g({},R,i.style||{}),d=s&&typeof s==`function`,f=d&&s(g({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(g({},c,{children:t?.toString(),className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,y.jsxs)(v.Fragment,{children:[a&&(f||(0,y.jsx)(l,g({},c,{style:u}))),p]})};yt.displayName=`JVR.TypeNan`;var bt=e=>Number(e)===e&&e%1!=0||isNaN(e),xt=e=>{var{value:t,keyName:n,keys:r}=e,i={keyName:n,keys:r};return t instanceof URL?(0,y.jsx)(ht,g({},i,{children:t})):typeof t==`string`?(0,y.jsx)(lt,g({},i,{children:t})):t===!0?(0,y.jsx)(ut,g({},i,{children:t})):t===!1?(0,y.jsx)(dt,g({},i,{children:t})):t===null?(0,y.jsx)(vt,g({},i,{children:t})):t===void 0?(0,y.jsx)(_t,g({},i,{children:t})):t instanceof Date?(0,y.jsx)(gt,g({},i,{children:t})):typeof t==`number`&&isNaN(t)?(0,y.jsx)(yt,g({},i,{children:t})):typeof t==`number`&&bt(t)?(0,y.jsx)(ft,g({},i,{children:t})):typeof t==`bigint`?(0,y.jsx)(mt,g({},i,{children:t})):typeof t==`number`?(0,y.jsx)(pt,g({},i,{children:t})):null};xt.displayName=`JVR.Value`;function z(e,t,n){var r=ye(),i=g({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:g({},e.style,t.style),children:t.children||e.children});(0,v.useEffect)(()=>r({[n]:i}),[t])}function B(e,t,n){var r=de(),i=g({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:g({},e.style,t.style),children:t.children||e.children});(0,v.useEffect)(()=>r({[n]:i}),[t])}function V(e,t,n){var r=Te(),i=g({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:g({},e.style,t.style),children:t.children||e.children});(0,v.useEffect)(()=>r({[n]:i}),[t])}var St=[`as`,`render`],Ct=e=>{var{KeyName:t={}}=N();return V(t,e,`KeyName`),null};Ct.displayName=`JVR.KeyName`;var wt=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o={color:typeof t==`number`?`var(--w-rjv-key-number, #268bd2)`:`var(--w-rjv-key-string, #002b36)`},{KeyName:s={}}=N(),{as:c,render:l}=s,u=_(s,St);u.style=g({},u.style,o);var d=c||`span`;return l&&typeof l==`function`&&l(g({},u,{children:t}),{value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])})||(0,y.jsx)(d,g({},u,{children:t}))};wt.displayName=`JVR.KeyNameComp`;var Tt=[`children`,`value`,`parentValue`,`keyName`,`keys`],Et=[`as`,`render`,`children`],Dt=e=>{var{Row:t={}}=N();return V(t,e,`Row`),null};Dt.displayName=`JVR.Row`;var Ot=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o=_(e,Tt),{Row:s={}}=N(),{as:c,render:l}=s,u=_(s,Et),d=c||`div`;return l&&typeof l==`function`&&l(g({},o,u,{children:t}),{value:n,keyName:i,parentValue:r,keys:a})||(0,y.jsx)(d,g({},o,u,{children:t}))};Ot.displayName=`JVR.RowComp`;function kt(e){var t=(0,v.useRef)();return(0,v.useEffect)(()=>{t.current=e}),t.current}function At(e){var{value:t,highlightUpdates:n,highlightContainer:r}=e,i=kt(t),a=(0,v.useMemo)(()=>{if(!n||i===void 0)return!1;if(typeof t!=typeof i)return!0;if(typeof t==`number`)return isNaN(t)&&isNaN(i)?!1:t!==i;if(Array.isArray(t)!==Array.isArray(i))return!0;if(typeof t==`object`||typeof t==`function`)return!1;if(t!==i)return!0},[n,t]);(0,v.useEffect)(()=>{r&&r.current&&a&&`animate`in r.current&&r.current.animate([{backgroundColor:`var(--w-rjv-update-color, #ebcb8b)`},{backgroundColor:``}],{duration:1e3,easing:`ease-in`})},[a,t,r])}var jt=[`keyName`,`value`,`parentValue`,`expandKey`,`keys`,`beforeCopy`],Mt=[`as`,`render`],H=e=>{var{keyName:t,value:n,parentValue:r,expandKey:i,keys:a,beforeCopy:o}=e,s=_(e,jt),{onCopied:c,enableClipboard:l,beforeCopy:u}=I(),d=C()[i],[f,p]=(0,v.useState)(!1),{Copied:m={}}=N(),h=m?.beforeCopy;if(l===!1||!d)return null;var b={style:{display:`inline-flex`},fill:f?`var(--w-rjv-copied-success-color, #28a745)`:`var(--w-rjv-copied-color, currentColor)`,onClick:e=>{e.stopPropagation();var s=``;s=typeof n==`number`&&n===1/0?`Infinity`:typeof n==`number`&&isNaN(n)?`NaN`:typeof n==`bigint`?ot(n):n instanceof Date?n.toLocaleString():JSON.stringify(n,(e,t)=>typeof t==`bigint`?ot(t):t,2);var l=o||h||u;l&&typeof l==`function`&&(s=l(s,t,n,r,i,a)),c&&c(s,n),p(!0),(navigator.clipboard||{writeText(e){return new Promise((t,n)=>{var r=document.createElement(`textarea`);r.style.position=`absolute`,r.style.opacity=`0`,r.style.left=`-99999999px`,r.value=e,document.body.appendChild(r),r.select(),document.execCommand(`copy`)?t():n(),r.remove()})}}).writeText(s).then(()=>{var e=setTimeout(()=>{p(!1),clearTimeout(e)},3e3)}).catch(e=>{})}},{render:x}=m,S=_(m,Mt),w=g({},S,s,b,{style:g({},S.style,s.style,b.style)});return x&&typeof x==`function`&&x(g({},w,{"data-copied":f}),{value:n,keyName:t,keys:a,parentValue:r})||(f?(0,y.jsx)(`svg`,g({viewBox:`0 0 32 36`},w,{children:(0,y.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,15.2249049 C29.1403264,13.8627542 29.9736597,13.1778155 30,13.1700887 C30,11.9705278 30,10.0804982 30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,26.1114493 L27.5,28.4926435 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M28.5589286,16 L32,19.6 L21.0160714,30.5382252 L13.5303571,24.2571429 L17.1303571,20.6571429 L21.0160714,24.5428571 L28.5589286,16 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})):(0,y.jsx)(`svg`,g({viewBox:`0 0 32 36`},w,{children:(0,y.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,20 L30,20 L30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,29 L27.5,29 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M22.5,21.5 L22.5,16.5 L12.5,24 L22.5,31.5 L22.5,26.5 L32,26.5 L32,21.5 L22.5,21.5 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})))};H.displayName=`JVR.Copied`;function Nt(){var e=(0,v.useRef)(null);return e.current===null&&(e.current=`custom-id-`+Math.random().toString(36).substr(2,9)),e.current}var Pt=e=>{var{keyName:t,value:n,expandKey:r=``,level:i,keys:a=[],parentValue:o}=e,s=O(),{objectSortKeys:c,indentWidth:l,collapsed:u,shouldExpandNodeInitially:d}=I(),f=typeof u==`boolean`?u:typeof u==`number`?i>u:!1,p=s[r]??(d?!1:f),m=d&&d(!p,{value:n,keys:a,level:i,keyName:t,parentValue:o});if(d&&u===!1){if(s[r]===void 0&&!m)return null}else if(s[r]===void 0&&m)return null;if(p)return null;var h=Array.isArray(n)?Object.entries(n).map(e=>[Number(e[0]),e[1]]):Object.entries(n);return c&&(h=c===!0?h.sort((e,t)=>{var[n]=e,[r]=t;return typeof n==`string`&&typeof r==`string`?n.localeCompare(r):0}):h.sort((e,t)=>{var[n,r]=e,[i,a]=t;return typeof n==`string`&&typeof i==`string`?c(n,i,r,a):0})),(0,y.jsx)(`div`,{className:`w-rjv-wrap`,style:{borderLeft:`var(--w-rjv-border-left-width, 1px) var(--w-rjv-line-style, solid) var(--w-rjv-line-color, #ebebeb)`,paddingLeft:l,marginLeft:6},children:h.map((e,t)=>{var[r,o]=e;return(0,y.jsx)(Ft,{parentValue:n,keyName:r,keys:[...a,r],value:o,level:i},t)})})};Pt.displayName=`JVR.KeyValues`;var U=e=>{var{keyName:t,parentValue:n,keys:r,value:i}=e,{highlightUpdates:a}=I(),o=typeof t==`number`,s=(0,v.useRef)(null);At({value:i,highlightUpdates:a,highlightContainer:s});var c={keyName:t,value:i,keys:r,parentValue:n};return(0,y.jsxs)(v.Fragment,{children:[(0,y.jsxs)(`span`,{ref:s,children:[(0,y.jsx)(Ve,g({isNumber:o,"data-placement":`left`},c)),(0,y.jsx)(wt,g({},c,{children:t})),(0,y.jsx)(Ve,g({isNumber:o,"data-placement":`right`},c))]}),(0,y.jsx)(He,g({},c))]})};U.displayName=`JVR.KayName`;var Ft=e=>{var{keyName:t,value:n,parentValue:r,level:i=0,keys:a=[]}=e,o=E(),s=Nt(),c=Array.isArray(n),l=n instanceof Set,u=n instanceof Map,d=n instanceof Date,f=n instanceof URL;return n&&typeof n==`object`&&!c&&!l&&!u&&!d&&!f||c||l||u?(0,y.jsx)(W,{keyName:t,value:l?Array.from(n):u?Object.fromEntries(n):n,parentValue:r,initialValue:n,keys:a,level:i+1}):(0,y.jsxs)(Ot,g({className:`w-rjv-line`,value:n,keyName:t,keys:a,parentValue:r},{onMouseEnter:()=>o({[s]:!0}),onMouseLeave:()=>o({[s]:!1})},{children:[(0,y.jsx)(U,{keyName:t,value:n,keys:a,parentValue:r}),(0,y.jsx)(xt,{keyName:t,value:n,keys:a}),(0,y.jsx)(H,{keyName:t,value:n,keys:a,parentValue:r,expandKey:s})]}))};Ft.displayName=`JVR.KeyValuesItem`;var It=[`value`,`keyName`],Lt=[`as`,`render`],Rt=e=>{var{CountInfoExtra:t={}}=N();return V(t,e,`CountInfoExtra`),null};Rt.displayName=`JVR.CountInfoExtra`;var zt=e=>{var{value:t={},keyName:n}=e,r=_(e,It),{CountInfoExtra:i={}}=N(),{as:a,render:o}=i,s=_(i,Lt);if(!o&&!s.children)return null;var c=a||`span`,l=o&&typeof o==`function`,u=g({},s,r);return l&&o(u,{value:t,keyName:n})||(0,y.jsx)(c,g({},u))};zt.displayName=`JVR.CountInfoExtraComps`;var Bt=[`value`,`keyName`],Vt=[`as`,`render`],Ht=e=>{var{CountInfo:t={}}=N();return V(t,e,`CountInfo`),null};Ht.displayName=`JVR.CountInfo`;var Ut=e=>{var{value:t={},keyName:n}=e,r=_(e,Bt),{displayObjectSize:i}=I(),{CountInfo:a={}}=N();if(!i)return null;var{as:o,render:s}=a,c=_(a,Vt),l=o||`span`;c.style=g({},c.style,e.style);var u=Object.keys(t).length;c.children||=u+` item`+(u===1?``:`s`);var d=g({},c,r);return s&&typeof s==`function`&&s(g({},d,{"data-length":u}),{value:t,keyName:n})||(0,y.jsx)(l,g({},d))};Ut.displayName=`JVR.CountInfoComp`;var Wt=[`as`,`render`],Gt=e=>{var{Ellipsis:t={}}=N();return V(t,e,`Ellipsis`),null};Gt.displayName=`JVR.Ellipsis`;var Kt=e=>{var{isExpanded:t,value:n,keyName:r}=e,{Ellipsis:i={}}=N(),{as:a,render:o}=i,s=_(i,Wt),c=a||`span`;return o&&typeof o==`function`&&o(g({},s,{"data-expanded":t}),{value:n,keyName:r})||(!t||typeof n==`object`&&Object.keys(n).length==0?null:(0,y.jsx)(c,g({},s)))};Kt.displayName=`JVR.EllipsisComp`;var qt=e=>{var{keyName:t,expandKey:n,keys:r=[],initialValue:i,value:a,parentValue:o,level:s}=e,c=O(),l=ie(),{onExpand:u,collapsed:d,shouldExpandNodeInitially:f}=I(),p=typeof d==`boolean`?d:typeof d==`number`?s>d:!1,m=c[n]??(f?!1:p),h=f&&f(!m,{value:a,keys:r,level:s,keyName:t,parentValue:o});c[n]===void 0&&f&&(m=!h);var _=()=>{var e={expand:!m,value:a,keyid:n,keyName:t};u&&u(e),l({[n]:e.expand})},v={display:`inline-flex`,alignItems:`center`},b={transform:`rotate(`+(m?`-90`:`0`)+`deg)`,transition:`all 0.3s`},x=Object.keys(a).length,S=typeof a==`object`,C=Array.isArray(a),w=a instanceof Set,T=x!==0&&(C||w||S),E={style:v};T&&(E.onClick=_);var D={keyName:t,value:a,keys:r,parentValue:o};return(0,y.jsxs)(`span`,g({},E,{children:[T&&(0,y.jsx)(Ue,g({style:b,expandKey:n},D)),(t||typeof t==`number`)&&(0,y.jsx)(U,g({},D)),(0,y.jsx)(st,{value:i,keyName:t}),(0,y.jsx)(ct,{value:i,keyName:t}),(0,y.jsx)(We,g({isBrackets:C||w},D)),(0,y.jsx)(Kt,{keyName:t,value:a,isExpanded:m}),(0,y.jsx)(Ge,g({isVisiable:m||!T,isBrackets:C||w},D)),(0,y.jsx)(Ut,{value:a,keyName:t}),(0,y.jsx)(zt,{value:a,keyName:t}),(0,y.jsx)(H,{keyName:t,value:a,expandKey:n,parentValue:o,keys:r})]}))};qt.displayName=`JVR.NestedOpen`;var Jt=[`className`,`children`,`parentValue`,`keyid`,`level`,`value`,`initialValue`,`keys`,`keyName`],W=(0,v.forwardRef)((e,t)=>{var{className:n=``,parentValue:r,level:i=1,value:a,initialValue:o,keys:s,keyName:c}=e,l=_(e,Jt),u=E(),d=Nt();return(0,y.jsxs)(`div`,g({className:[n,`w-rjv-inner`].filter(Boolean).join(` `),ref:t},l,{onMouseEnter:()=>u({[d]:!0}),onMouseLeave:()=>u({[d]:!1})},{children:[(0,y.jsx)(qt,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c,initialValue:o}),(0,y.jsx)(Pt,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c}),(0,y.jsx)(Ke,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c})]}))});W.displayName=`JVR.Container`;var Yt=e=>{var{BraceLeft:t={}}=j();return z(t,e,`BraceLeft`),null};Yt.displayName=`JVR.BraceLeft`;var Xt=e=>{var{BraceRight:t={}}=j();return z(t,e,`BraceRight`),null};Xt.displayName=`JVR.BraceRight`;var Zt=e=>{var{BracketsLeft:t={}}=j();return z(t,e,`BracketsLeft`),null};Zt.displayName=`JVR.BracketsLeft`;var Qt=e=>{var{BracketsRight:t={}}=j();return z(t,e,`BracketsRight`),null};Qt.displayName=`JVR.BracketsRight`;var $t=e=>{var{Arrow:t={}}=j();return z(t,e,`Arrow`),null};$t.displayName=`JVR.Arrow`;var en=e=>{var{Colon:t={}}=j();return z(t,e,`Colon`),null};en.displayName=`JVR.Colon`;var tn=e=>{var{Quote:t={}}=j();return z(t,e,`Quote`),null};tn.displayName=`JVR.Quote`;var nn=e=>{var{ValueQuote:t={}}=j();return z(t,e,`ValueQuote`),null};nn.displayName=`JVR.ValueQuote`;var rn=e=>{var{Bigint:t={}}=A();return B(t,e,`Bigint`),null};rn.displayName=`JVR.Bigint`;var an=e=>{var{Date:t={}}=A();return B(t,e,`Date`),null};an.displayName=`JVR.Date`;var on=e=>{var{False:t={}}=A();return B(t,e,`False`),null};on.displayName=`JVR.False`;var sn=e=>{var{Float:t={}}=A();return B(t,e,`Float`),null};sn.displayName=`JVR.Float`;var cn=e=>{var{Int:t={}}=A();return B(t,e,`Int`),null};cn.displayName=`JVR.Int`;var ln=e=>{var{Map:t={}}=A();return B(t,e,`Map`),null};ln.displayName=`JVR.Map`;var un=e=>{var{Nan:t={}}=A();return B(t,e,`Nan`),null};un.displayName=`JVR.Nan`;var dn=e=>{var{Null:t={}}=A();return B(t,e,`Null`),null};dn.displayName=`JVR.Null`;var fn=e=>{var{Set:t={}}=A();return B(t,e,`Set`),null};fn.displayName=`JVR.Set`;var pn=e=>{var{Str:t={}}=A();return B(t,e,`Str`),null};pn.displayName=`JVR.StringText`;var mn=e=>{var{True:t={}}=A();return B(t,e,`True`),null};mn.displayName=`JVR.True`;var hn=e=>{var{Undefined:t={}}=A();return B(t,e,`Undefined`),null};hn.displayName=`JVR.Undefined`;var gn=e=>{var{Url:t={}}=A();return B(t,e,`Url`),null};gn.displayName=`JVR.Url`;var _n=e=>{var{Copied:t={}}=N();return V(t,e,`Copied`),null};_n.displayName=`JVR.Copied`;var vn=[`className`,`style`,`value`,`children`,`collapsed`,`shouldExpandNodeInitially`,`indentWidth`,`displayObjectSize`,`shortenTextAfterLength`,`stringEllipsis`,`highlightUpdates`,`enableClipboard`,`displayDataTypes`,`objectSortKeys`,`onExpand`,`onCopied`,`beforeCopy`],G=(0,v.forwardRef)((e,t)=>{var{className:n=``,style:r,value:i,children:a,collapsed:o=!1,shouldExpandNodeInitially:s,indentWidth:c=15,displayObjectSize:l=!0,shortenTextAfterLength:u=30,stringEllipsis:d,highlightUpdates:f=!0,enableClipboard:p=!0,displayDataTypes:m=!0,objectSortKeys:h=!1,onExpand:v,onCopied:b,beforeCopy:x}=e,S=_(e,vn),C=g({lineHeight:1.4,fontFamily:`var(--w-rjv-font-family, Menlo, monospace)`,color:`var(--w-rjv-color, #002b36)`,backgroundColor:`var(--w-rjv-background-color, #00000000)`,fontSize:13},r),w=[`w-json-view-container`,`w-rjv`,n].filter(Boolean).join(` `);return(0,y.jsxs)(Ae,{initialState:{value:i,objectSortKeys:h,indentWidth:c,shouldExpandNodeInitially:o===!1?s:void 0,displayObjectSize:l,collapsed:o,enableClipboard:p,shortenTextAfterLength:u,stringEllipsis:d,highlightUpdates:f,onCopied:b,onExpand:v,beforeCopy:x},initialTypes:{displayDataTypes:m},children:[(0,y.jsx)(W,g({value:i},S,{ref:t,className:w,style:C})),a]})});G.Bigint=rn,G.Date=an,G.False=on,G.Float=sn,G.Int=cn,G.Map=ln,G.Nan=un,G.Null=dn,G.Set=fn,G.String=pn,G.True=mn,G.Undefined=hn,G.Url=gn,G.ValueQuote=nn,G.Arrow=$t,G.Colon=en,G.Quote=tn,G.Ellipsis=Gt,G.BraceLeft=Yt,G.BraceRight=Xt,G.BracketsLeft=Zt,G.BracketsRight=Qt,G.Copied=_n,G.CountInfo=Ht,G.CountInfoExtra=Rt,G.KeyName=Ct,G.Row=Dt,G.displayName=`JVR.JsonView`;var yn={"--w-rjv-font-family":`monospace`,"--w-rjv-color":`#002b36`,"--w-rjv-key-string":`#002b36`,"--w-rjv-background-color":`#ffffff`,"--w-rjv-line-color":`#ebebeb`,"--w-rjv-arrow-color":`var(--w-rjv-color)`,"--w-rjv-edit-color":`var(--w-rjv-color)`,"--w-rjv-info-color":`#0000004d`,"--w-rjv-update-color":`#ebcb8b`,"--w-rjv-copied-color":`#002b36`,"--w-rjv-copied-success-color":`#28a745`,"--w-rjv-curlybraces-color":`#236a7c`,"--w-rjv-colon-color":`#002b36`,"--w-rjv-brackets-color":`#236a7c`,"--w-rjv-quotes-color":`var(--w-rjv-key-string)`,"--w-rjv-quotes-string-color":`var(--w-rjv-type-string-color)`,"--w-rjv-type-string-color":`#cb4b16`,"--w-rjv-type-int-color":`#268bd2`,"--w-rjv-type-float-color":`#859900`,"--w-rjv-type-bigint-color":`#268bd2`,"--w-rjv-type-boolean-color":`#2aa198`,"--w-rjv-type-date-color":`#586e75`,"--w-rjv-type-url-color":`#0969da`,"--w-rjv-type-null-color":`#d33682`,"--w-rjv-type-nan-color":`#859900`,"--w-rjv-type-undefined-color":`#586e75`},bn=e=>(0,y.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,y.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m12 19l-7-7l7-7m7 7H5`})}),xn=e=>(0,y.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,y.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M20 6L9 17l-5-5`})}),K=e=>(0,y.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,y.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m6 9l6 6l6-6`})}),Sn=e=>(0,y.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,y.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,y.jsx)(`rect`,{width:14,height:14,x:8,y:8,rx:2,ry:2}),(0,y.jsx)(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})]})});function Cn(){let{id:e}=u.useSearch();return(0,y.jsx)(ur,{id:e})}function q(e){return e.toLocaleString()}var wn=new Set;function Tn(e){try{return{ok:!0,value:JSON.parse(e)}}catch{return{ok:!1}}}function J(e){if(!e)return{};try{return JSON.parse(e)}catch{return e}}function Y({text:e,dark:t}){let[n,r]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>r(!1),1500);return()=>clearTimeout(e)},[n]),(0,y.jsx)(`button`,{type:`button`,className:`absolute top-2 right-2 p-1 rounded transition-colors ${t?`text-sand-500 hover:text-sand-300`:`text-sand-400 hover:text-sand-600`}`,onClick:()=>{navigator.clipboard.writeText(e),r(!0)},children:n?(0,y.jsx)(xn,{className:`size-3.5 text-sage-500`}):(0,y.jsx)(Sn,{className:`size-3.5`})})}var En=/<img\s+[^>]*src=["'](data:image\/[^"']+;base64,[^"']+)["'][^>]*(?:alt=["']([^"']*)["'][^>]*)?\/?>/gi;function Dn(e){let t=[],n=0;for(let r of e.matchAll(En)){let i=r.index??0;i>n&&t.push({type:`text`,text:e.slice(n,i)}),t.push({type:`image`,src:r[1],alt:r[2]??`generated image`}),n=i+r[0].length}return n<e.length&&t.push({type:`text`,text:e.slice(n)}),t.filter(e=>e.type===`image`||e.text.trim().length>0)}function On({text:e,markdown:t}){let[n,r]=(0,v.useState)(null),i=Dn(e);return i.some(e=>e.type===`image`)?(0,y.jsxs)(`div`,{className:`space-y-3`,children:[i.map((e,n)=>e.type===`text`?t?(0,y.jsx)(`div`,{className:`prose prose-sm prose-qgrid max-w-none`,children:(0,y.jsx)(l,{remarkPlugins:[d],children:e.text})},`text-${n}`):(0,y.jsx)(`pre`,{className:`text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed`,children:e.text},`text-${n}`):(0,y.jsx)(`button`,{type:`button`,className:`block max-w-full rounded-md border border-sand-200 overflow-hidden bg-white hover:border-sienna-300 transition-colors`,onClick:()=>r(e.src),title:`Open image`,children:(0,y.jsx)(`img`,{src:e.src,alt:e.alt,className:`max-h-[520px] max-w-full object-contain`,loading:`lazy`})},`image-${n}`)),n&&(0,y.jsxs)(`div`,{className:`fixed inset-0 z-50 bg-black/70 p-4 flex items-center justify-center`,onClick:()=>r(null),children:[(0,y.jsx)(`button`,{type:`button`,className:`absolute top-4 right-4 p-2 rounded-full bg-white/90 text-sand-700 hover:bg-white`,onClick:()=>r(null),title:`Close image`,children:(0,y.jsx)(c,{className:`size-5`})}),(0,y.jsx)(`img`,{src:n,alt:`generated preview`,className:`max-h-full max-w-full object-contain rounded-md bg-white`,onClick:e=>e.stopPropagation()})]})]}):t?(0,y.jsx)(`div`,{className:`prose prose-sm prose-qgrid max-w-none`,children:(0,y.jsx)(l,{remarkPlugins:[d],children:e})}):(0,y.jsx)(`pre`,{className:`text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed`,children:e})}function X({text:e,markdown:t}){let n=Tn(e),[r,i]=(0,v.useState)(`pretty`),a=n.ok&&n.value!==null&&(Array.isArray(n.value)||typeof n.value==`object`);return!n.ok||!a?t?(0,y.jsx)(On,{text:e,markdown:!0}):(0,y.jsx)(On,{text:n.ok?JSON.stringify(n.value,null,2):e}):(0,y.jsxs)(`div`,{children:[(0,y.jsxs)(`div`,{className:`flex gap-1 mb-2`,children:[(0,y.jsx)(`button`,{type:`button`,className:`px-2 py-0.5 text-[10px] rounded-md transition-colors ${r===`plain`?`bg-sand-200 text-sand-700`:`text-sand-400 hover:text-sand-600`}`,onClick:()=>i(`plain`),children:`Plain`}),(0,y.jsx)(`button`,{type:`button`,className:`px-2 py-0.5 text-[10px] rounded-md transition-colors ${r===`pretty`?`bg-sand-200 text-sand-700`:`text-sand-400 hover:text-sand-600`}`,onClick:()=>i(`pretty`),children:`Pretty`})]}),r===`pretty`?(0,y.jsx)(G,{value:n.value,style:yn,displayDataTypes:!1,enableClipboard:!0,collapsed:!1}):(0,y.jsx)(`pre`,{className:`text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed`,children:JSON.stringify(n.value,null,2)})]})}function Z({title:e,defaultOpen:t=!0,headerMetadata:n,onOpenChange:r,children:i}){let[a,o]=(0,v.useState)(t);return(0,y.jsxs)(`details`,{open:a,className:`group panel overflow-hidden`,onToggle:e=>{let t=e.currentTarget.open;o(t),r?.(t)},children:[(0,y.jsxs)(`summary`,{className:`panel-header flex min-w-0 items-center gap-1.5 whitespace-nowrap cursor-pointer select-none list-none px-4 py-2.5`,children:[(0,y.jsx)(K,{className:`size-3.5 shrink-0 text-sand-400 transition-transform group-open:rotate-0 -rotate-90`}),(0,y.jsx)(`span`,{className:`shrink-0 text-[11px] uppercase tracking-wider text-sand-500 font-medium`,children:e}),n&&(0,y.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden whitespace-nowrap text-[11px] normal-case text-sand-400`,children:n})]}),(0,y.jsx)(`div`,{className:`p-4`,children:i})]})}function Q({label:e,value:t}){return(0,y.jsxs)(`div`,{className:`min-w-0`,children:[(0,y.jsx)(`dt`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium truncate`,children:e}),(0,y.jsx)(`dd`,{className:`text-[15px] font-semibold text-sand-800 tabular-nums mt-0.5 truncate`,children:t})]})}var kn={running:`bg-blue-100 text-blue-600`,succeeded:`bg-sage-100 text-sage-600`,error:`bg-red-100 text-red-600`,aborted:`bg-caution-400/15 text-caution-500`};function An({message:e}){return(0,y.jsxs)(`div`,{className:`panel overflow-hidden border border-red-200 bg-red-50/60`,children:[(0,y.jsx)(`div`,{className:`px-4 py-2.5 border-b border-red-100 flex items-center gap-1.5`,children:(0,y.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-red-600 font-medium`,children:`Error`})}),(0,y.jsx)(`div`,{className:`p-4`,children:(0,y.jsx)(`pre`,{className:`text-[12px] text-red-700 whitespace-pre-wrap break-words font-mono leading-relaxed max-h-80 overflow-auto`,children:e})})]})}function jn({data:e}){let t=e.status===`running`,n=h({status:e.status,requestedModel:e.requested_model_name,servedModel:e.model_name,imageCostMethod:e.image_cost_method}),r=!t&&e.requested_model_name!==null&&e.model_name===null;return(0,y.jsxs)(`div`,{className:`panel overflow-hidden px-4 py-3 flex flex-wrap items-center gap-x-2 gap-y-1.5 sm:px-5`,children:[(0,y.jsx)(`span`,{className:`text-[15px] font-semibold text-sand-900 break-all`,children:n.label===`—`?`Unknown model`:n.label}),r&&(0,y.jsx)(`span`,{className:`text-[10px] text-sand-400`,children:`요청`}),e.service_tier===`fast`&&(0,y.jsx)(`span`,{title:`Fast 모드`,className:`inline-flex shrink-0`,children:(0,y.jsx)(m,{"aria-label":`Fast 모드`,className:`size-3.5 text-[#1877F2] [&_path]:fill-current`})}),!t&&(e.fallback_count??0)>0&&(0,y.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-caution-400/15 text-caution-500 font-medium uppercase`,children:[`fallback ×`,e.fallback_count]}),!t&&e.status!==`succeeded`&&(0,y.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full font-medium uppercase ${kn[e.status]??`bg-sand-100 text-sand-500`}`,children:e.status}),e.response_json_ok===!1&&(0,y.jsx)(`span`,{title:`structured 요청의 응답이 JSON 파싱에 실패했습니다`,className:`text-[10px] px-1.5 py-0.5 rounded-full bg-caution-400/15 text-caution-500 font-medium uppercase`,children:`broken json`}),e.effort&&(0,y.jsxs)(`span`,{className:`text-[11px] px-1.5 py-0.5 rounded-md bg-sand-100 text-sand-500 font-mono`,children:[`effort=`,e.effort]}),e.project_name&&(0,y.jsxs)(`span`,{className:`text-[12px] text-sand-400`,children:[`· project=`,e.project_name]}),(0,y.jsx)(`span`,{className:`ml-auto text-[11px] text-sand-400`,children:e.token_name})]})}function Mn({data:e,toolCallCount:t}){let n=In(e);return(0,y.jsxs)(`div`,{className:`panel overflow-hidden px-5 py-3 space-y-3`,children:[(0,y.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-x-6 gap-y-3`,children:[(0,y.jsx)(Q,{label:`Duration`,value:`${(e.duration_ms/1e3).toFixed(1)}s`}),(0,y.jsx)(Q,{label:`TTFT`,value:Pn(e.ttft_ms)}),(0,y.jsx)(Q,{label:`Tokens/sec`,value:Ln(e.output_tokens,e.duration_ms,e.ttft_ms,n)}),(0,y.jsx)(Q,{label:`Driver`,value:e.cost_usd===null?`—`:f(e.cost_usd)}),(0,y.jsx)(Q,{label:`Image`,value:e.image_cost_usd===null?`—`:f(e.image_cost_usd)}),(0,y.jsx)(Q,{label:`Tool Calls`,value:`${t}회`})]}),(0,y.jsxs)(`div`,{className:`border-t border-sand-100/60 pt-3 grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-x-6 gap-y-3`,children:[(0,y.jsx)(Q,{label:`Input`,value:q(e.input_tokens)}),(0,y.jsx)(Q,{label:`Output`,value:q(e.output_tokens)}),(0,y.jsx)(Q,{label:`Cache Read`,value:q(e.cache_read_tokens)}),(0,y.jsx)(Q,{label:`Cache Write`,value:q(e.cache_creation_tokens)}),(0,y.jsx)(Q,{label:`Cache Write (5m)`,value:e.cache_creation_5m_tokens===null?`—`:q(e.cache_creation_5m_tokens)}),(0,y.jsx)(Q,{label:`Cache Write (1h)`,value:e.cache_creation_1h_tokens===null?`—`:q(e.cache_creation_1h_tokens)}),(0,y.jsx)(Q,{label:`Cache Hit`,value:p(e)})]})]})}function Nn(e){return e==null?`—`:e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function Pn(e){return e==null||e<=0?`—`:Nn(e)}function Fn(e){let t=e.model_name?.trim().toLowerCase();if(t){let e=t.includes(`/`)?t.split(`/`).pop():t;if(e.startsWith(`claude-`))return`anthropic`;if(/^(gpt-|codex-|o\d)/.test(e))return`openai`}let n=e.token_name?.trim().toLowerCase();return n?.startsWith(`anthropic/`)?`anthropic`:n?.startsWith(`openai/`)?`openai`:null}function In(e){let t=Fn(e);return t!==null&&wn.has(t)}function Ln(e,t,n,r){if(!r||e==null||t==null||n==null||n<=0)return`—`;let i=t-n;return e<=0||i<=0?`—`:`${Math.round(e/(i/1e3)).toLocaleString()} tok/s`}function $({label:e,value:t}){return(0,y.jsxs)(`div`,{className:`min-w-0 self-end`,children:[e&&(0,y.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium truncate`,children:e}),(0,y.jsx)(`div`,{className:`mt-0.5 text-[13px] font-semibold text-sand-800 tabular-nums truncate`,children:t})]})}function Rn(e){if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e.inputImages;return Array.isArray(t)?t:void 0}function zn(e){return(Rn(e)??[]).filter(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.url==`string`&&t.url.length>0||typeof t.data==`string`&&t.data.length>0})}function Bn(e){if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e,n=Rn(t);return n?{...t,inputImages:n.map(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e,n=typeof t.url==`string`&&t.url.toLowerCase().startsWith(`data:`)?`[data-url ${t.url.length} chars]`:t.url;return{mediaType:t.mediaType,byteSize:t.byteSize,...n?{url:n}:{},...t.data?{data:`[base64 ${t.data.length} chars]`}:{}}})}:e}function Vn({images:e}){let t=e.map((e,t)=>{let n=e.url&&!e.url.startsWith(`[`)?e.url:void 0,r=e.data?`data:${e.mediaType??`image/png`};base64,${e.data}`:``,i=n??r;return i?{image:e,index:t,src:i}:null}).filter(e=>e!==null);return t.length===0?null:(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium px-2`,children:`Input Images`}),(0,y.jsx)(`div`,{className:`mt-1 grid grid-cols-1 sm:grid-cols-2 gap-2`,children:t.map(({image:e,index:t,src:n})=>(0,y.jsxs)(`div`,{className:`rounded-md border border-sand-200 bg-white overflow-hidden`,children:[(0,y.jsx)(`img`,{src:n,alt:`reference ${t+1}`,className:`max-h-64 w-full object-contain bg-white`,loading:`lazy`}),(0,y.jsxs)(`div`,{className:`px-2 py-1 text-[10px] text-sand-500 font-mono border-t border-sand-100`,children:[e.mediaType??`image`,` ·`,` `,e.byteSize===void 0?`url`:`${e.byteSize.toLocaleString()} bytes`]})]},`${e.mediaType??`image`}-${t}`))})]})}function Hn({images:e,stepId:t}){let{data:n}=a.useRequestLogStep(`I`,t??0,{enabled:e===null&&t!==null}),r=n?J(n.tool_args):null;return(0,y.jsx)(Vn,{images:e??zn(r)})}function Un({entry:e}){let t=!!e.error,[n,r]=(0,v.useState)(!1),{data:i}=a.useRequestLogStep(`A`,e.id,{enabled:n}),o=Bn(i?J(i.tool_args):null),s=i?J(i.tool_result):null,c=i?.error??e.error;return(0,y.jsxs)(`details`,{className:`group/tool`,onToggle:e=>r(e.currentTarget.open),children:[(0,y.jsxs)(`summary`,{className:`flex items-center gap-2 px-3 py-2 cursor-pointer select-none list-none hover:bg-sand-50 transition-colors rounded-md`,children:[(0,y.jsx)(K,{className:`size-3 text-sand-400 transition-transform group-open/tool:rotate-0 -rotate-90 shrink-0`}),(0,y.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-sand-100 text-sand-500 font-mono shrink-0`,children:[`call `,e.callIndex+1]}),(0,y.jsx)(`span`,{className:`text-[13px] font-medium text-sand-800 font-mono truncate`,children:e.toolName}),t&&(0,y.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-red-100 text-red-600 font-medium uppercase shrink-0`,children:`error`}),(0,y.jsx)(`span`,{className:`ml-auto text-[11px] text-sand-400 tabular-nums shrink-0`,children:Nn(e.durationMs)})]}),n&&(0,y.jsxs)(`div`,{className:`mt-1 mx-1 mb-3 space-y-2`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium px-2`,children:`Request`}),(0,y.jsx)(`div`,{className:`mt-1 rounded-md bg-sand-50 p-3 overflow-auto`,children:(0,y.jsx)(X,{text:i?JSON.stringify(o):`Loading...`})})]}),c&&(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-red-500 font-medium px-2`,children:`Error`}),(0,y.jsx)(`div`,{className:`mt-1 rounded-md bg-red-50 border border-red-100 p-3 overflow-auto`,children:(0,y.jsx)(X,{text:c})})]}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium px-2`,children:`Response`}),(0,y.jsx)(`div`,{className:`mt-1 rounded-md bg-sand-50 p-3 overflow-auto`,children:(0,y.jsx)(X,{text:i?typeof s==`string`?s:JSON.stringify(s):`Loading...`,markdown:!0})})]})]})]})}function Wn({stepId:e}){let[t,n]=(0,v.useState)(!1),{data:r}=a.useRequestLogStep(`A`,e,{enabled:t}),i=r?.reasoning_text??null;return(0,y.jsxs)(`details`,{className:`group/reason mt-3`,onToggle:e=>n(e.currentTarget.open),children:[(0,y.jsxs)(`summary`,{className:`flex items-center gap-2 cursor-pointer select-none list-none`,children:[(0,y.jsx)(K,{className:`size-3 text-sand-400 transition-transform group-open/reason:rotate-0 -rotate-90 shrink-0`}),(0,y.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`Reasoning`})]}),t&&(0,y.jsx)(`div`,{className:`mt-2 rounded-md bg-white/70 border border-sand-100 p-3 overflow-auto`,children:i?(0,y.jsx)(X,{text:i,markdown:!0}):r?(0,y.jsx)(`p`,{className:`text-sm text-sand-400`,children:`No reasoning text captured.`}):(0,y.jsx)(`p`,{className:`text-sm text-sand-400`,children:`Loading...`})})]})}function Gn({entry:e,tokensPerSecEnabled:t}){let n=e.generate,r=n!==null&&n.reasoningTokens!==null&&n.reasoningTokens!==void 0&&n.reasoningTokens>0,i=e.toolCalls.filter(e=>e.error).length;return(0,y.jsxs)(`details`,{open:!0,className:`group/step border-l border-sand-200 pl-3`,children:[(0,y.jsxs)(`summary`,{className:`flex items-center gap-2 py-2 cursor-pointer select-none list-none`,children:[(0,y.jsx)(K,{className:`size-3.5 text-sand-400 transition-transform group-open/step:rotate-0 -rotate-90 shrink-0`}),(0,y.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-sienna-100 text-sienna-700 font-mono shrink-0`,children:[`step `,e.stepIndex+1]}),(0,y.jsx)(`span`,{className:`text-[13px] font-semibold text-sand-900`,children:`LLM call`}),n?.finishReason&&(0,y.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-sand-100 text-sand-500 font-mono shrink-0`,children:n.finishReason}),n&&(n.fallbackCount??0)>0&&(0,y.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-caution-400/15 text-caution-500 font-medium uppercase shrink-0`,children:[n.requestedModelName,` → `,n.modelName]}),r&&(0,y.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-blue-100 text-blue-600 font-medium shrink-0`,children:`reasoning`}),i>0&&(0,y.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-red-100 text-red-600 font-medium uppercase shrink-0`,children:[i,` error`]}),(0,y.jsxs)(`span`,{className:`ml-auto text-[11px] text-sand-400 tabular-nums shrink-0`,children:[e.toolCalls.length,` tools`]})]}),(0,y.jsxs)(`div`,{className:`ml-4 mb-4 space-y-3`,children:[n&&(0,y.jsxs)(`div`,{className:`rounded-md border border-sand-100 bg-sand-50/70 p-3`,children:[(0,y.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 xl:grid-cols-8 gap-x-4 gap-y-3`,children:[(0,y.jsx)($,{label:`Duration`,value:Nn(n.durationMs)}),(0,y.jsx)($,{label:`TTFT`,value:Pn(n.ttftMs)}),(0,y.jsx)($,{label:`Tokens/sec`,value:Ln(n.outputTokens,n.durationMs,n.ttftMs,t)}),(0,y.jsx)($,{label:`Input`,value:q(n.inputTokens??0)}),(0,y.jsx)($,{label:`Output`,value:q(n.outputTokens??0)}),(0,y.jsx)($,{label:`Cache Read`,value:q(n.cacheReadTokens??0)}),(0,y.jsx)($,{label:`Cache Write`,value:q(n.cacheCreationTokens??0)}),(0,y.jsx)($,{label:`Cache 5m / 1h`,value:`${n.cacheCreation5mTokens===null?`—`:q(n.cacheCreation5mTokens)} / ${n.cacheCreation1hTokens===null?`—`:q(n.cacheCreation1hTokens)}`}),(0,y.jsx)($,{value:n.costUsd===null?`—`:f(n.costUsd)}),(0,y.jsx)($,{label:`Reasoning`,value:n.reasoningTokens!==null&&n.reasoningTokens!==void 0?q(n.reasoningTokens):`—`})]}),r&&(0,y.jsx)(Wn,{stepId:n.id})]}),e.toolCalls.length>0&&(0,y.jsx)(`div`,{className:`space-y-0.5`,children:e.toolCalls.map(e=>(0,y.jsx)(Un,{entry:e},`${e.stepIndex}-${e.callIndex}-${e.toolCallId}`))})]})]})}function Kn({steps:e,tokensPerSecEnabled:t}){let n=e.reduce((e,t)=>e+t.toolCalls.length,0);return(0,y.jsx)(Z,{title:`Steps (${e.length} steps · ${n} tool calls)`,defaultOpen:!0,children:(0,y.jsx)(`div`,{className:`space-y-1`,children:e.map(e=>(0,y.jsx)(Gn,{entry:e,tokensPerSecEnabled:t},e.stepIndex))})})}function qn(e){let t=new Map;function n(e){let n=t.get(e);if(n)return n;let r={stepIndex:e,generate:null,toolCalls:[]};return t.set(e,r),r}for(let t of e){let e=n(t.step_index);if(t.type===`generate`){e.generate={id:t.id,stepIndex:t.step_index,modelName:t.model_name,requestedModelName:t.requested_model_name,fallbackCount:t.fallback_count,inputTokens:t.input_tokens,outputTokens:t.output_tokens,cacheReadTokens:t.cache_read_tokens,cacheCreationTokens:t.cache_creation_tokens,cacheCreation5mTokens:t.cache_creation_5m_tokens,cacheCreation1hTokens:t.cache_creation_1h_tokens,costUsd:t.cost_usd,durationMs:t.duration_ms,ttftMs:t.ttft_ms,finishReason:t.finish_reason,reasoningTokens:t.reasoning_tokens};continue}t.type===`tool_call`&&e.toolCalls.push({id:t.id,stepIndex:t.step_index,callIndex:t.tool_call_index??e.toolCalls.length,toolCallId:t.tool_call_id??``,toolName:t.tool_name??``,durationMs:t.tool_duration_ms??0,error:t.error})}return[...t.values()].map(e=>({...e,toolCalls:e.toolCalls.toSorted((e,t)=>e.callIndex-t.callIndex)})).toSorted((e,t)=>e.stepIndex-t.stepIndex)}function Jn(e){return e.type===`function_call`||e.type===`function_call_output`?`bg-caution-400/10`:e.role===`assistant`?`bg-sage-50`:`bg-sand-50`}function Yn(e){return e.type===`function_call`?`fn: ${e.name??`unknown`}`:e.type===`function_call_output`?`fn result`:e.role??e.type}function Xn(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>typeof e==`object`&&e&&`text`in e?e.text:JSON.stringify(e)).join(`
2
- `):JSON.stringify(e)}function Zn({className:e,children:t}){return(0,y.jsx)(`pre`,{className:`text-[12px] text-sand-700 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed max-h-40 overflow-auto ${e??``}`,children:t})}function Qn({history:e}){return(0,y.jsx)(Z,{title:`History`,defaultOpen:!1,children:(0,y.jsx)(`div`,{className:`space-y-1.5`,children:e.map((e,t)=>(0,y.jsxs)(`div`,{className:`rounded-md px-3 py-2 ${Jn(e)}`,children:[(0,y.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium mb-1`,children:Yn(e)}),e.content!==null&&e.content!==void 0&&(0,y.jsx)(Zn,{children:Xn(e.content)}),e.arguments&&(0,y.jsx)(Zn,{children:e.arguments}),e.output&&(0,y.jsx)(Zn,{children:e.output})]},`hist-${t}`))})})}var $n=60,er=30,tr=18;function nr(e,t=$n){let n=[];for(let r of e){if([...n,r.name].join(`, `).length>t)break;n.push(r.name)}return{names:n,omittedCount:e.length-n.length}}function rr({tools:e}){let t=nr(e),n=nr(e,er),r=nr(e,tr);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`shrink-0`,children:`·`}),t.names.length>0&&(0,y.jsx)(`span`,{className:`hidden shrink-0 xl:inline`,children:t.names.join(`, `)}),t.omittedCount>0&&(0,y.jsxs)(`span`,{className:`hidden shrink-0 xl:inline`,children:[`+`,t.omittedCount]}),n.names.length>0&&(0,y.jsx)(`span`,{className:`hidden shrink-0 sm:inline xl:hidden`,children:n.names.join(`, `)}),n.omittedCount>0&&(0,y.jsxs)(`span`,{className:`hidden shrink-0 sm:inline xl:hidden`,children:[`+`,n.omittedCount]}),r.names.length>0&&(0,y.jsx)(`span`,{className:`shrink-0 sm:hidden`,children:r.names.join(`, `)}),r.omittedCount>0&&(0,y.jsxs)(`span`,{className:`shrink-0 sm:hidden`,children:[`+`,r.omittedCount]})]})}function ir({code:e,fullCode:t}){let n=(0,v.useMemo)(()=>cr(e),[e]);return(0,y.jsx)(`pre`,{"data-zod-parameter-shape":!0,className:`max-h-64 overflow-auto rounded-md bg-sand-900 px-3 py-2.5 font-mono text-[11px] leading-relaxed whitespace-pre text-sand-200 ${t?`cursor-help outline-none focus-visible:ring-2 focus-visible:ring-sienna-300`:``}`,tabIndex:t?0:void 0,title:t,children:t?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{"aria-hidden":`true`,children:n}),(0,y.jsx)(`span`,{className:`sr-only`,children:t})]}):n})}function ar({tool:e}){return(0,y.jsxs)(`div`,{className:`min-w-0 rounded-md border border-sand-100 bg-sand-50/70 p-3`,children:[(0,y.jsx)(`div`,{className:`break-all font-mono text-[13px] font-semibold text-sand-900`,children:e.name}),e.description&&(0,y.jsx)(`p`,{className:`mt-2 text-[12px] leading-relaxed text-sand-700`,children:e.description}),(0,y.jsxs)(`div`,{className:`mt-3`,children:[(0,y.jsxs)(`div`,{className:`mb-1.5 text-[10px] font-medium uppercase tracking-wider text-sand-400`,children:[`Parameters (`,e.parameterCount,`)`]}),(0,y.jsx)(ir,{code:e.inputZod,fullCode:e.fullInputZod})]})]})}function or({id:e,tools:n}){let[r,i]=(0,v.useState)(!1),a=t({...o.toolsViewQueryOptions(e),enabled:r,staleTime:e=>e.state.data&&e.state.data.length>0?1/0:0,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),s=a.data!==void 0&&a.data.length>0;return(0,y.jsx)(Z,{title:`Tools (${n.length})`,defaultOpen:!1,headerMetadata:(0,y.jsx)(rr,{tools:n}),onOpenChange:i,children:a.isFetching&&!s?(0,y.jsx)(`p`,{className:`text-[12px] text-sand-400`,children:`Loading tool contracts…`}):a.isError||!s?(0,y.jsx)(`p`,{className:`text-[12px] text-sand-400`,children:`Tool contracts could not be loaded.`}):(0,y.jsx)(`div`,{className:`space-y-2`,children:a.data.map((e,t)=>(0,y.jsx)(ar,{tool:e},`${e.name}-${t}`))})})}var sr=/("(?:[^"\\]|\\.)*")|(\b\d+(?:\.\d+)?\b)|(\btype\b|\bz\b(?=\.))|(\b(?:string|number|boolean|null|unknown|Record)\b)|([{}[\]()<>|?:,.=])|([A-Za-z_$][\w$]*)|(\s+|.)/g;function cr(e){let t=[],n=!1;for(let r of e.matchAll(sr)){let[e,i,a,o,s,c,l]=r,u=`${r.index}-${e}`;i||a?t.push((0,y.jsx)(`span`,{className:`text-sage-400`,children:e},u)):o?(n=e===`type`,t.push((0,y.jsx)(`span`,{className:`text-sienna-400`,children:e},u))):s?t.push((0,y.jsx)(`span`,{className:`text-blue-300`,children:e},u)):c?t.push((0,y.jsx)(`span`,{className:`text-sand-500`,children:e},u)):l&&n?(n=!1,t.push((0,y.jsx)(`span`,{className:`font-semibold text-sand-50`,children:e},u))):t.push(e)}return t}function lr({id:e}){let{data:t}=o.useResponseTypeTs(e),[n,r]=(0,v.useState)(`zod`),{zod:i=null,typescript:a=null}=t??{},s=n===`zod`?i??a:a??i,c=(0,v.useMemo)(()=>s===null?null:cr(s),[s]);return!t||s===null||c===null?null:(0,y.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,y.jsxs)(`div`,{className:`panel-header flex items-center px-4 py-2`,children:[(0,y.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-sand-500 font-medium`,children:`Response Type`}),(0,y.jsx)(`div`,{className:`ml-auto flex gap-1`,children:[{value:`zod`,label:`zod`,available:i!==null},{value:`ts`,label:`ts`,available:a!==null}].map(e=>(0,y.jsx)(`button`,{type:`button`,disabled:!e.available,className:`px-3 py-1 text-[12px] font-mono rounded-md transition-colors ${n===e.value?`bg-sand-200 text-sand-700`:`text-sand-400 hover:text-sand-600 disabled:text-sand-300 disabled:cursor-not-allowed`}`,onClick:()=>r(e.value),children:e.label},e.value))})]}),(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(Y,{text:s,dark:!0}),(0,y.jsx)(`pre`,{className:`bg-sand-900 px-4 py-3 text-[12px] text-sand-200 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed max-h-64 overflow-auto`,children:c})]})]})}function ur({id:e}){let{data:t,isLoading:r,error:i,isError:c}=o.useRequestLog(`A`,e),{data:l,isLoading:u,isError:d}=a.useRequestLogSteps(`T`,{request_log_id:e,num:0,page:1,orderBy:`id-asc`}),f=qn(l?.rows??[]);if(r||u)return(0,y.jsxs)(`div`,{className:`max-w-6xl mx-auto space-y-4`,children:[(0,y.jsx)(`div`,{className:`h-4 w-32 bg-sand-200 rounded animate-pulse`}),(0,y.jsx)(`div`,{className:`h-40 panel animate-pulse`}),(0,y.jsx)(`div`,{className:`h-32 panel animate-pulse`})]});if(c||d||!t)return(0,y.jsxs)(`div`,{className:`max-w-6xl mx-auto`,children:[(0,y.jsxs)(n,{to:`/logs`,className:`flex items-center gap-1 text-[13px] text-sand-500 hover:text-sienna-500 mb-4`,children:[(0,y.jsx)(bn,{className:`size-3.5`}),`Back to Logs`]}),(0,y.jsx)(`p`,{role:`alert`,className:`text-danger-500 text-sm`,children:c?s(i)&&i.code===404?`Request not found.`:`Failed to load request.`:d?`Failed to load request steps.`:`Request not found.`})]});let p=f.flatMap(e=>e.toolCalls),m=p.find(e=>e.toolName===`image_generation`)?.id??null,h=f.length>0,g=In(t),_=t.history??null,v=_!==null&&_.length>0,b=t.tools??null,x=b!==null&&b.length>0,S=t.is_structured?(0,y.jsx)(lr,{id:e}):null,C=(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsx)(Z,{title:`System`,children:(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(Y,{text:t.system_prompt??`null`}),(0,y.jsx)(X,{text:t.system_prompt??`null`,markdown:!0})]})}),(0,y.jsx)(Z,{title:`User`,children:(0,y.jsxs)(`div`,{className:`space-y-3`,children:[(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(Y,{text:t.user_prompt??`null`}),(0,y.jsx)(X,{text:t.user_prompt??`null`,markdown:!0})]}),(0,y.jsx)(Hn,{images:t.input_images,stepId:m})]})})]});return(0,y.jsxs)(`div`,{className:`mx-auto space-y-4 ${h?`max-w-[120rem]`:`max-w-6xl`}`,children:[(0,y.jsxs)(n,{to:`/logs`,className:`inline-flex items-center gap-1 text-[13px] text-sand-500 hover:text-sienna-500 transition-colors`,children:[(0,y.jsx)(bn,{className:`size-3.5`}),`Back to Logs`]}),(0,y.jsx)(jn,{data:t}),t.error_message&&(0,y.jsx)(An,{message:t.error_message}),v&&(0,y.jsx)(Qn,{history:_}),h?(0,y.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-4 items-stretch lg:items-start`,children:[(0,y.jsxs)(`div`,{className:`order-1 lg:order-2 flex-1 min-w-0 space-y-4`,children:[S,x&&(0,y.jsx)(or,{id:e,tools:b}),(0,y.jsx)(Kn,{steps:f,tokensPerSecEnabled:g})]}),(0,y.jsx)(`div`,{className:`order-2 lg:order-1 flex-1 min-w-0`,children:C})]}):(0,y.jsxs)(y.Fragment,{children:[S,x&&(0,y.jsx)(or,{id:e,tools:b}),C]}),(0,y.jsx)(Z,{title:`Response`,children:(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(Y,{text:t.response}),(0,y.jsx)(X,{text:t.response,markdown:!0})]})}),(0,y.jsx)(Mn,{data:t,toolCallCount:p.length}),(0,y.jsx)(`div`,{className:`pb-8`})]})}export{Cn as component};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{y as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,r}from"./vendor-react-DH4kUfK2.js";import{n as i,o as a}from"./services.generated-NP-ValHd.js";import{f as o,o as s}from"./index-DZwzUfI-.js";import{t as c}from"./use-update-token-mutation-BQHS0byG.js";import{n as l,t as u}from"./use-oauth-login-flow-hboOs3wG.js";import{t as d}from"./plus-B62CuqT8.js";var f=e(n(),1),p=r();function m(){let[e,t]=(0,f.useState)(!1),[n,r]=(0,f.useState)(``),i=u(),a=()=>{t(!1),r(``),i.reset()},c=async e=>{await i.submitCode(e)&&a()};return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`button`,{type:`button`,className:`px-3.5 py-1.5 text-[12px] font-medium rounded-lg bg-sienna-500 text-white hover:bg-sienna-600 disabled:opacity-50 transition-all duration-150 active:scale-[0.97] flex items-center gap-1.5 shadow-sm`,onClick:()=>t(!0),children:[(0,p.jsx)(d,{className:`size-3.5`}),`Add Token`]}),e&&(0,p.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,p.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:a,onKeyDown:()=>{}}),(0,p.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-md mx-4`,children:[(0,p.jsx)(`div`,{className:`px-5 py-4 border-b border-sand-100/50`,children:(0,p.jsx)(`h2`,{className:`text-base font-medium text-sand-900`,children:`Add Token`})}),(0,p.jsxs)(`div`,{className:`px-5 py-4 space-y-4`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{htmlFor:`token-name`,className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`Name *`}),(0,p.jsx)(s,{value:n,onChange:e=>r(e.target.value),placeholder:`e.g. your-token-name`,className:`mt-1 w-full border border-sand-200 rounded-md px-3 py-2 text-sm text-sand-900 bg-white placeholder:text-sand-300 focus:outline-none focus:border-sienna-300`})]}),i.codeEntryProvider?(0,p.jsx)(l,{provider:i.codeEntryProvider,isPending:i.completeMutation.isPending,isError:i.completeMutation.isError,onSubmit:e=>void c(e),onRestart:i.reset}):(0,p.jsxs)(`div`,{className:`space-y-2`,children:[(0,p.jsx)(`button`,{type:`button`,className:`w-full py-2.5 text-sm font-medium rounded-md bg-sand-900 text-white hover:bg-sand-800 disabled:opacity-50 transition-colors duration-150 flex items-center justify-center gap-2`,disabled:!n.trim()||i.loadingProvider!==null,onClick:()=>void i.start(`openai`,n),children:i.loadingProvider===`openai`?(0,p.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,p.jsx)(`span`,{className:`w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin`}),`Waiting for login...`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o,{className:`size-4`}),`Login with OpenAI`]})}),(0,p.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,p.jsx)(`div`,{className:`flex-1 h-px bg-sand-200`}),(0,p.jsx)(`span`,{className:`text-[10px] text-sand-400 uppercase`,children:`or`}),(0,p.jsx)(`div`,{className:`flex-1 h-px bg-sand-200`})]}),(0,p.jsx)(`button`,{type:`button`,className:`w-full py-2.5 text-sm font-medium rounded-md border border-sand-300 text-sand-700 hover:bg-sand-100 disabled:opacity-50 transition-colors duration-150 flex items-center justify-center gap-2`,disabled:!n.trim()||i.loadingProvider!==null,onClick:()=>void i.start(`anthropic`,n),children:i.loadingProvider===`anthropic`?(0,p.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,p.jsx)(`span`,{className:`w-3.5 h-3.5 border-2 border-sand-400 border-t-transparent rounded-full animate-spin`}),`Waiting for login...`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o,{className:`size-4`}),`Login with Claude`]})})]})]}),(0,p.jsx)(`div`,{className:`px-5 py-3 border-t border-sand-100/50 flex items-center justify-end gap-2`,children:(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md border border-sand-200 text-sand-600 hover:bg-sand-100 transition-colors duration-150`,onClick:a,children:`Cancel`})})]})]})]})}var h=e=>(0,p.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,p.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497zM15 5l4 4`})}),g=e=>(0,p.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,p.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M10 11v6m4-6v6m5-11v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})});function _(e){if(!e||typeof e!=`object`)return`—`;if(`authSource`in e&&e.authSource===`system-keychain`)return`System Keychain`;let t=`accessToken`in e?e.accessToken:void 0;return typeof t!=`string`||!t?`—`:t.length<=12?t:`${t.slice(0,8)}...${t.slice(-4)}`}function v(e){let t=e.credentials;return`expiresAt`in t&&typeof t.expiresAt==`number`?t.expiresAt:`accessTokenExpiresAt`in t&&typeof t.accessTokenExpiresAt==`number`?t.accessTokenExpiresAt:null}function y(e){if(!e)return{text:``,color:``};let t=e-Date.now();if(t<=0)return{text:`expired`,color:`text-red-500`};let n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4),i=n>0?`${n}h ${r}m`:`${r}m`;return t<36e5?{text:i,color:`text-amber-500`}:{text:i,color:`text-sand-400`}}function b({data:e,isLoading:n}){let[r,a]=(0,f.useState)(null),[o,l]=(0,f.useState)(null),[u,d]=(0,f.useState)(``),m=t(),b=i.useRemoveTokenMutation(),x=c(),S=i.useToggleTokenMutation(),C=()=>Promise.all([m.invalidateQueries({queryKey:[`Token`]}),m.invalidateQueries({queryKey:[`Qgrid`]})]),w=async e=>{await S.mutateAsync({id:e.id}),await C()},T=async()=>{r&&(await b.mutateAsync({id:r.id}),await C(),a(null))},E=e=>{l(e),d(e.name??``)},D=async()=>{o&&(await x.mutateAsync({id:o.id,name:u.trim()}),await C(),l(null))};if(n)return(0,p.jsx)(`div`,{className:`space-y-2`,children:Array.from({length:3}).map((e,t)=>(0,p.jsx)(`div`,{className:`h-12 bg-sand-100 rounded-md animate-pulse`},`skeleton-${t}`))});let O=e??[];return O.length===0?(0,p.jsxs)(`div`,{className:`text-sand-400 text-center py-16 text-sm`,children:[`No tokens registered. Click `,(0,p.jsx)(`strong`,{className:`text-sand-600`,children:`Add Token`}),` to get started.`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{className:`panel overflow-hidden`,children:(0,p.jsx)(`div`,{className:`overflow-x-auto`,children:(0,p.jsxs)(`table`,{className:`w-full min-w-[640px] text-[13px]`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{className:`panel-header`,children:[(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Provider`}),(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Name`}),(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Token`}),(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Status`}),(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Expires`}),(0,p.jsx)(`th`,{className:`w-20 px-3 py-2.5`})]})}),(0,p.jsx)(`tbody`,{className:`divide-y divide-sand-100/80`,children:O.map(e=>{let t=y(v(e));return(0,p.jsxs)(`tr`,{className:`transition-colors duration-150 hover:bg-sand-100/60 ${e.active?``:`opacity-50`}`,children:[(0,p.jsx)(`td`,{className:`px-5 py-3`,children:(0,p.jsx)(`span`,{className:`text-xs font-medium text-sand-500 uppercase`,children:e.provider})}),(0,p.jsx)(`td`,{className:`px-5 py-3`,children:e.name?(0,p.jsx)(`span`,{className:`text-sm text-sand-700`,children:e.name}):(0,p.jsx)(`span`,{className:`text-[11px] text-sand-400`,children:`—`})}),(0,p.jsx)(`td`,{className:`px-5 py-3`,children:(0,p.jsx)(`code`,{className:`text-[13px] font-mono text-sand-800`,children:_(e.credentials)})}),(0,p.jsx)(`td`,{className:`px-5 py-3`,children:(0,p.jsx)(`button`,{type:`button`,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors duration-200 ${e.active?`bg-sage-400`:`bg-sand-300`}`,onClick:()=>w(e),disabled:S.isPending||!e.active&&e.reauth_required,title:!e.active&&e.reauth_required?`재로그인이 필요한 토큰입니다`:void 0,children:(0,p.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform duration-200 ${e.active?`translate-x-4.5`:`translate-x-0.5`}`})})}),(0,p.jsx)(`td`,{className:`px-5 py-3`,children:t.text&&(0,p.jsx)(`span`,{className:`text-xs ${t.color}`,children:t.text})}),(0,p.jsx)(`td`,{className:`px-3 py-3`,children:(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,p.jsx)(`button`,{type:`button`,className:`p-1 rounded text-sand-400 hover:text-sienna-500 transition-colors duration-150`,onClick:()=>E(e),children:(0,p.jsx)(h,{className:`size-4`})}),(0,p.jsx)(`button`,{type:`button`,className:`p-1 rounded text-sand-400 hover:text-red-500 transition-colors duration-150`,onClick:()=>a(e),children:(0,p.jsx)(g,{className:`size-4`})})]})})]},e.id)})})]})})}),o&&(0,p.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,p.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:()=>l(null),onKeyDown:()=>{}}),(0,p.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-sm mx-4`,children:[(0,p.jsx)(`div`,{className:`px-5 py-4 border-b border-sand-100/60`,children:(0,p.jsx)(`h3`,{className:`text-base font-medium text-sand-900`,children:`Edit Token`})}),(0,p.jsx)(`div`,{className:`px-5 py-4 space-y-3`,children:(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{htmlFor:`token-name`,className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`Name`}),(0,p.jsx)(s,{value:u,onChange:e=>d(e.target.value),placeholder:`e.g. prod, dev, team-a`,className:`mt-1 w-full border border-sand-200 rounded-md px-3 py-2 text-sm text-sand-900 bg-white placeholder:text-sand-300 focus:outline-none focus:border-sienna-300`})]})}),(0,p.jsxs)(`div`,{className:`px-5 py-3 border-t border-sand-100/60 flex items-center justify-end gap-2`,children:[(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md border border-sand-200 text-sand-600 hover:bg-sand-100 transition-colors duration-150`,onClick:()=>l(null),children:`Cancel`}),(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md bg-sienna-400 text-white hover:bg-sienna-500 disabled:opacity-50 transition-colors duration-150`,disabled:x.isPending,onClick:D,children:x.isPending?`Saving...`:`Save`})]})]})]}),r&&(0,p.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,p.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:()=>a(null),onKeyDown:()=>{}}),(0,p.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-sm mx-4`,children:[(0,p.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,p.jsx)(`h3`,{className:`text-base font-medium text-sand-900`,children:`Remove Token`}),(0,p.jsxs)(`p`,{className:`text-sm text-sand-700 mt-2`,children:[`Are you sure you want to remove`,` `,(0,p.jsx)(`code`,{className:`text-[13px] font-mono text-sand-800`,children:_(r.credentials)}),r.name&&(0,p.jsxs)(`span`,{className:`text-sand-500`,children:[` (`,r.name,`)`]}),`?`]})]}),(0,p.jsxs)(`div`,{className:`px-5 py-3 border-t border-sand-100/60 flex items-center justify-end gap-2`,children:[(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md border border-sand-200 text-sand-600 hover:bg-sand-100 transition-colors duration-150`,onClick:()=>a(null),children:`Cancel`}),(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 transition-colors duration-150`,disabled:b.isPending,onClick:T,children:b.isPending?`Removing...`:`Remove`})]})]})]})]})}function x(){let{data:e,isLoading:t}=a.useTokens(`A`);return(0,p.jsxs)(`div`,{className:`max-w-6xl mx-auto space-y-4`,children:[(0,p.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,p.jsx)(m,{})}),(0,p.jsx)(b,{data:e?.rows,isLoading:t})]})}export{x as component};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{y as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,r}from"./vendor-react-DH4kUfK2.js";import{n as i,o as a}from"./services.generated-NP-ValHd.js";import{o}from"./index-DZwzUfI-.js";var s=e(n(),1),c=r();function l({provider:e,isPending:t,isError:n,onSubmit:r,onRestart:i}){let[a,l]=(0,s.useState)(``),u=e===`openai`;return(0,c.jsxs)(`div`,{className:`space-y-2`,children:[(0,c.jsx)(`p`,{className:`text-[12px] text-sand-600 leading-relaxed`,children:u?`새 탭에서 OpenAI 로그인을 완료한 뒤 연결 실패 화면이 나타나면, 주소창의 전체 URL을 아래에 붙여넣으세요.`:`새 탭에서 Claude 로그인을 완료하면 코드가 표시됩니다. 코드 전체를 아래에 붙여넣으세요.`}),(0,c.jsx)(o,{value:a,onChange:e=>l(e.target.value),placeholder:u?`http://localhost:1455/auth/callback?code=...&state=...`:`code#state`,className:`w-full border border-sand-200 rounded-md px-3 py-2 text-sm font-mono text-sand-900 bg-white placeholder:text-sand-300 focus:outline-none focus:border-sienna-300`}),n&&(0,c.jsx)(`p`,{className:`text-[11px] text-red-500`,children:`인증 결과 확인에 실패했습니다 — 전체 값을 다시 붙여넣거나 로그인을 다시 시작하세요.`}),(0,c.jsx)(`button`,{type:`button`,className:`w-full py-2.5 text-sm font-medium rounded-md bg-sand-900 text-white hover:bg-sand-800 disabled:opacity-50 transition-colors duration-150 flex items-center justify-center gap-2`,disabled:!a.trim()||t,onClick:()=>r(a),children:t?(0,c.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,c.jsx)(`span`,{className:`w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin`}),`Verifying...`]}):`Complete login`}),(0,c.jsx)(`button`,{type:`button`,className:`w-full py-1.5 text-[12px] text-sand-500 hover:text-sand-700 transition-colors duration-150`,onClick:()=>{l(``),i()},children:`처음부터 다시 시작`})]})}var u=3e3,d=3e5;async function f(e,t){let{rows:n}=await a.getTokens(`A`,{num:0,queryMode:`list`});return new Set(n.filter(n=>n.provider===e&&n.name===t).map(e=>e.id))}function p(){let[e,n]=(0,s.useState)(null),[r,a]=(0,s.useState)(null),o=t(),c=i.useOauthStartMutation(),l=i.useOauthStartOpenAIMutation(),p=i.useOauthCompleteMutation(),m=(0,s.useRef)({}),h=(0,s.useRef)(0),g=()=>{h.current+=1,m.current.interval!==void 0&&clearInterval(m.current.interval),m.current.timeout!==void 0&&clearTimeout(m.current.timeout),m.current={}};(0,s.useEffect)(()=>g,[]);let _=()=>Promise.all([o.invalidateQueries({queryKey:[`Token`]}),o.invalidateQueries({queryKey:[`Qgrid`]})]);return{loadingProvider:e,codeEntryProvider:r,start:async(e,t)=>{let r=t.trim();if(!r)return;g();let i=h.current,o=window.open(`about:blank`,`_blank`);n(e);try{if(e===`openai`){let t=await f(e,r);if(i!==h.current){o?.close();return}let{authUrl:s,mode:c}=await l.mutateAsync({name:r});if(i!==h.current){o?.close();return}if(o?o.location.href=s:window.open(s,`_blank`),c===`code`){a(e),n(null);return}m.current.interval=window.setInterval(()=>{f(e,r).then(e=>{i===h.current&&[...e].some(e=>!t.has(e))&&(g(),n(null),_())}).catch(()=>{})},u),m.current.timeout=window.setTimeout(()=>{i===h.current&&(g(),n(null))},d);return}let{authUrl:t,mode:s}=await c.mutateAsync({name:r});if(i!==h.current){o?.close();return}s===`code`?(o?o.location.href=t:window.open(t,`_blank`),a(e),n(null)):(o?.close(),window.location.href=t)}catch(e){if(o?.close(),i!==h.current)return;console.error(`OAuth start failed:`,e),n(null)}},submitCode:async e=>{let t=e.trim();if(!t)return!1;try{await p.mutateAsync({pastedCode:t})}catch(e){return console.error(`OAuth complete failed:`,e),!1}return await _(),!0},reset:()=>{g(),n(null),a(null),p.reset()},completeMutation:p}}export{l as n,p as t};
@@ -1 +0,0 @@
1
- import{m as e}from"./vendor-tanstack-DJRQAbrY.js";import{n as t}from"./services.generated-NP-ValHd.js";function n(){return e({mutationFn:({id:e,name:n,quotaThreshold:r,weight:i,keepaliveEnabled:a})=>t.updateToken(e,n,r,i,a)})}export{n as t};