@cartanova/qgrid-cli 2.11.1 → 2.13.1

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 (217) hide show
  1. package/README.ko.md +1 -1
  2. package/README.md +1 -1
  3. package/bundle/dist/_virtual/{_@oxc-project_runtime@0.140.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/decorate.js +1 -1
  4. package/bundle/dist/_virtual/{_@oxc-project_runtime@0.140.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/decorateMetadata.js +1 -1
  5. package/bundle/dist/_virtual/_rolldown/runtime.js +2 -2
  6. package/bundle/dist/application/monit/monit.frame.js +2 -2
  7. package/bundle/dist/application/qgrid/qgrid-response-format.js +9 -1
  8. package/bundle/dist/application/qgrid/qgrid-run-lifecycle.js +30 -6
  9. package/bundle/dist/application/qgrid/qgrid.dispatcher.js +7 -4
  10. package/bundle/dist/application/qgrid/qgrid.frame.js +30 -9
  11. package/bundle/dist/application/qgrid/qgrid.types.js +8 -8
  12. package/bundle/dist/application/qgrid/token-death.js +3 -2
  13. package/bundle/dist/application/qgrid/token-subscriber.js +2 -2
  14. package/bundle/dist/application/qgrid/token-window-keepalive.js +2 -2
  15. package/bundle/dist/application/qgrid/tool-emulation-schema.js +5 -3
  16. package/bundle/dist/application/qgrid/tool-emulation.js +2 -2
  17. package/bundle/dist/application/request-log/request-log.model.js +13 -7
  18. package/bundle/dist/application/request-log-step/request-log-step.model.js +11 -7
  19. package/bundle/dist/application/setting/setting.model.js +11 -7
  20. package/bundle/dist/application/token/token.model.js +15 -11
  21. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js +1 -1
  22. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js +1 -1
  23. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/index.js +1 -1
  24. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/scope.js +1 -1
  25. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/errors.js +1 -1
  26. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +1 -1
  27. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/names.js +1 -1
  28. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/ref_error.js +1 -1
  29. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js +7 -5
  30. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js +1 -1
  31. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/util.js +1 -1
  32. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js +1 -1
  33. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js +1 -1
  34. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +1 -1
  35. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js +1 -1
  36. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js +1 -1
  37. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js +1 -1
  38. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/subschema.js +1 -1
  39. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +1 -1
  40. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/data.js +1 -1
  41. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +1 -1
  42. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.js +1 -1
  43. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.js +1 -1
  44. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.js +1 -1
  45. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.js +1 -1
  46. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.js +1 -1
  47. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.js +1 -1
  48. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.js +1 -1
  49. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/schema.js +1 -1
  50. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js +1 -1
  51. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js +1 -1
  52. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js +1 -1
  53. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/validation_error.js +1 -1
  54. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +1 -1
  55. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +1 -1
  56. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js +1 -1
  57. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +1 -1
  58. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js +1 -1
  59. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +1 -1
  60. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +1 -1
  61. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js +1 -1
  62. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js +1 -1
  63. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js +1 -1
  64. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +1 -1
  65. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js +1 -1
  66. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +1 -1
  67. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +1 -1
  68. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +1 -1
  69. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +1 -1
  70. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +1 -1
  71. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +1 -1
  72. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/code.js +1 -1
  73. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/id.js +1 -1
  74. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js +1 -1
  75. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js +15 -11
  76. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +1 -1
  77. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/types.js +1 -1
  78. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft2020.js +1 -1
  79. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +1 -1
  80. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +1 -1
  81. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/index.js +1 -1
  82. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +1 -1
  83. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +1 -1
  84. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js +1 -1
  85. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/index.js +1 -1
  86. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/metadata.js +1 -1
  87. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/next.js +1 -1
  88. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/index.js +1 -1
  89. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +1 -1
  90. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +1 -1
  91. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js +1 -1
  92. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +1 -1
  93. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js +1 -1
  94. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js +1 -1
  95. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitContains.js +1 -1
  96. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js +1 -1
  97. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js +1 -1
  98. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +1 -1
  99. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +1 -1
  100. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +1 -1
  101. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +1 -1
  102. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js +1 -1
  103. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +1 -1
  104. package/bundle/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +1 -1
  105. package/bundle/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js +18 -12
  106. package/bundle/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js +1 -1
  107. package/bundle/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js +16 -13
  108. package/bundle/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js +1 -1
  109. package/bundle/dist/sonamu.config.js +11 -11
  110. package/bundle/dist/startup-migrations.js +1 -1
  111. package/bundle/dist/utils/providers/anthropic/anthropic-dispatcher.js +9 -3
  112. package/bundle/dist/utils/providers/anthropic/anthropic-thinking.js +5 -2
  113. package/bundle/dist/utils/providers/anthropic/claude-session.js +10 -2
  114. package/bundle/dist/utils/providers/anthropic/stream-json-adapter.js +9 -7
  115. package/bundle/dist/utils/providers/common/model-cost.js +7 -5
  116. package/bundle/dist/utils/providers/common/schema-validation.js +3 -3
  117. package/bundle/dist/utils/providers/grok/grok-backend-protocol.js +1 -1
  118. package/bundle/dist/utils/providers/grok/grok-constants.js +1 -1
  119. package/bundle/dist/utils/providers/grok/grok-dispatcher.js +47 -14
  120. package/bundle/dist/utils/providers/grok/grok-media-client.js +4 -4
  121. package/bundle/dist/utils/providers/grok/grok-oauth.js +2 -2
  122. package/bundle/dist/utils/providers/grok/grok-types.js +2 -2
  123. package/bundle/dist/utils/providers/openai/openai-dispatcher.js +16 -8
  124. package/bundle/dist/utils/providers/openai/openai-image-generation.js +4 -4
  125. package/bundle/src/application/qgrid/qgrid-response-format.ts +9 -0
  126. package/bundle/src/application/qgrid/qgrid-run-lifecycle.test.ts +63 -0
  127. package/bundle/src/application/qgrid/qgrid-run-lifecycle.ts +49 -7
  128. package/bundle/src/application/qgrid/qgrid.dispatcher.ts +6 -0
  129. package/bundle/src/application/qgrid/qgrid.frame.test.ts +12 -4
  130. package/bundle/src/application/qgrid/qgrid.frame.ts +39 -3
  131. package/bundle/src/application/qgrid/qgrid.types.ts +5 -5
  132. package/bundle/src/application/request-log/request-log.model.ts +12 -1
  133. package/bundle/src/sonamu.config.ts +14 -14
  134. package/bundle/src/utils/providers/anthropic/anthropic-dispatcher.ts +2 -0
  135. package/bundle/src/utils/providers/anthropic/claude-session.ts +15 -1
  136. package/bundle/src/utils/providers/common/model-cost.ts +8 -6
  137. package/bundle/src/utils/providers/common/provider-dispatcher.ts +10 -0
  138. package/bundle/src/utils/providers/grok/grok-backend-protocol.ts +6 -1
  139. package/bundle/src/utils/providers/grok/grok-constants.ts +7 -8
  140. package/bundle/src/utils/providers/grok/grok-dispatcher.test.ts +74 -3
  141. package/bundle/src/utils/providers/grok/grok-dispatcher.ts +66 -18
  142. package/bundle/src/utils/providers/grok/grok-quota.test.ts +18 -0
  143. package/bundle/src/utils/providers/grok/grok-types.ts +2 -1
  144. package/bundle/src/utils/providers/openai/openai-dispatcher.test.ts +18 -0
  145. package/bundle/src/utils/providers/openai/openai-dispatcher.ts +10 -2
  146. package/bundle/web-dist/client/assets/clsx-DB0hHKMi.js +1 -0
  147. package/bundle/web-dist/client/assets/cost-CZzlCFS2.js +1 -0
  148. package/bundle/web-dist/client/assets/index-DLo1QCw7.css +1 -0
  149. package/bundle/web-dist/client/assets/index-DplV-wqZ.js +104 -0
  150. package/bundle/web-dist/client/assets/logs-st46aRba.js +1 -0
  151. package/bundle/web-dist/client/assets/monit-BMXR2tY2.js +1 -0
  152. package/bundle/web-dist/client/assets/plus-Bab0ACnC.js +1 -0
  153. package/bundle/web-dist/client/assets/refresh-cw-BtYoFHVw.js +1 -0
  154. package/bundle/web-dist/client/assets/request-model-Dl31cZdf.js +1 -0
  155. package/bundle/web-dist/client/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  156. package/bundle/web-dist/client/assets/routes-BWPjgvhg.js +5 -0
  157. package/bundle/web-dist/client/assets/settings-DTXZjDAw.js +1 -0
  158. package/bundle/web-dist/client/assets/show-CdWNFPyS.js +2 -0
  159. package/bundle/web-dist/client/assets/tokens-eA34Gw5f.js +1 -0
  160. package/bundle/web-dist/client/assets/use-oauth-login-flow-CcUdLsa7.js +1 -0
  161. package/bundle/web-dist/client/assets/use-update-token-mutation-D2r5K5Bz.js +1 -0
  162. package/bundle/web-dist/client/assets/vendor-react-8xo7RSum.js +9 -0
  163. package/bundle/web-dist/client/assets/vendor-tanstack-6B86itGS.js +2 -0
  164. package/bundle/web-dist/client/index.html +5 -7
  165. package/bundle/web-dist/server/assets/{logs-B7QmGJq3.js → logs-C0md5rmp.js} +67 -37
  166. package/bundle/web-dist/server/assets/monit-YVvwJuAF.js +479 -0
  167. package/bundle/web-dist/server/assets/plus-z5Hy__3C.js +26 -0
  168. package/bundle/web-dist/server/assets/refresh-cw-CNm0CERy.js +30 -0
  169. package/bundle/web-dist/server/assets/request-model-DIuPZZwu.js +38 -0
  170. package/bundle/web-dist/server/assets/{routes-_Y-PJfgO.js → routes-CjWxvHAO.js} +1745 -1120
  171. package/bundle/web-dist/server/assets/{services.generated-CMJ8AHbO.js → services.generated-CqS8DCjT.js} +11973 -6081
  172. package/bundle/web-dist/server/assets/{settings-JwJKxn2e.js → settings-CXwnKiMG.js} +40 -19
  173. package/bundle/web-dist/server/assets/{show-BEv6z1v_.js → show-G1t8dOEh.js} +274 -213
  174. package/bundle/web-dist/server/assets/{tokens-CNT4mI-f.js → tokens-C4D67FBX.js} +41 -18
  175. package/bundle/web-dist/server/assets/{use-oauth-login-flow-jkAkT3X6.js → use-oauth-login-flow-CFzShQtp.js} +1569 -38
  176. package/bundle/web-dist/server/assets/{use-update-token-mutation-Sm6kh02m.js → use-update-token-mutation-oH0O0n-g.js} +1 -1
  177. package/bundle/web-dist/server/entry-server.generated.js +11641 -5075
  178. package/dist/cli.js +20 -11
  179. package/package.json +24 -24
  180. package/skills/qgrid/references/ai-sdk-provider-contract.md +5 -5
  181. package/skills/qgrid/references/cli-env-and-server-boot.md +4 -3
  182. package/skills/qgrid/references/decision-rationale.md +5 -1
  183. package/skills/qgrid/references/grok-runtime.md +7 -1
  184. package/skills/qgrid/references/repo-map.md +2 -0
  185. package/skills/qgrid/references/request-log-run-lifecycle.md +6 -1
  186. package/skills/qgrid/references/tool-calling-and-multiturn.md +2 -2
  187. package/skills/qgrid/references/verification-and-debugging.md +24 -5
  188. package/bundle/web-dist/client/assets/clsx-5XM_pHvN.js +0 -1
  189. package/bundle/web-dist/client/assets/cost-DB3HbU7T.js +0 -1
  190. package/bundle/web-dist/client/assets/index-Be2qCZmI.css +0 -1
  191. package/bundle/web-dist/client/assets/index-C96h3feE.js +0 -32
  192. package/bundle/web-dist/client/assets/logs-DBM6U0QD.js +0 -1
  193. package/bundle/web-dist/client/assets/monit-BBjXa7vB.js +0 -1
  194. package/bundle/web-dist/client/assets/plus-BsQdY7PS.js +0 -1
  195. package/bundle/web-dist/client/assets/preload-helper-DWTEM3RW.js +0 -1
  196. package/bundle/web-dist/client/assets/refresh-cw-D9IUmT23.js +0 -1
  197. package/bundle/web-dist/client/assets/request-model-Bpp_rkK8.js +0 -1
  198. package/bundle/web-dist/client/assets/rolldown-runtime-Dw2cE7zH.js +0 -1
  199. package/bundle/web-dist/client/assets/routes-Crz_PQzi.js +0 -5
  200. package/bundle/web-dist/client/assets/services.generated-B5lc3aIC.js +0 -51
  201. package/bundle/web-dist/client/assets/settings-Cdwm3OBB.js +0 -1
  202. package/bundle/web-dist/client/assets/show-DBUhALT1.js +0 -2
  203. package/bundle/web-dist/client/assets/tokens-CVQAVJTo.js +0 -1
  204. package/bundle/web-dist/client/assets/total-cost-MnfKU8IN.js +0 -1
  205. package/bundle/web-dist/client/assets/use-oauth-login-flow-BfxYI4Oh.js +0 -1
  206. package/bundle/web-dist/client/assets/use-update-token-mutation-qKBC2sn7.js +0 -1
  207. package/bundle/web-dist/client/assets/vendor-react-DH4kUfK2.js +0 -9
  208. package/bundle/web-dist/client/assets/vendor-tanstack-DRPs09ai.js +0 -1
  209. package/bundle/web-dist/server/assets/lazyRouteComponent-AKiHfZWp.js +0 -1983
  210. package/bundle/web-dist/server/assets/monit-DFt7x3bh.js +0 -1652
  211. package/bundle/web-dist/server/assets/plus-DaYQRpBt.js +0 -19
  212. package/bundle/web-dist/server/assets/react-dom-Cv23mm1K.js +0 -335
  213. package/bundle/web-dist/server/assets/refresh-cw-BpXNsAy-.js +0 -23
  214. package/bundle/web-dist/server/assets/request-model-eHE6YbaF.js +0 -31
  215. package/bundle/web-dist/server/assets/total-cost-fTE9Xy82.js +0 -18
  216. /package/bundle/web-dist/server/assets/{clsx-D_N5PN_2.js → clsx-DgIEfj3H.js} +0 -0
  217. /package/bundle/web-dist/server/assets/{cost-BC9yzyA9.js → cost-oNK0T4Jo.js} +0 -0
@@ -1,1652 +0,0 @@
1
- import { $ as __toESM, M as require_jsx_runtime, N as require_react, k as useQuery, m as _enum, t as MonitService, w as object } from "./services.generated-CMJ8AHbO.js";
2
- import { t as require_react_dom } from "./react-dom-Cv23mm1K.js";
3
- import { t as clsx } from "./clsx-D_N5PN_2.js";
4
- import { a as Route } from "../entry-server.generated.js";
5
- import { t as cacheHitRate } from "./cost-BC9yzyA9.js";
6
- import { t as lucideRefreshCw } from "./refresh-cw-BpXNsAy-.js";
7
- //#region ../../node_modules/.pnpm/@tanstack+virtual-core@3.17.4/node_modules/@tanstack/virtual-core/dist/esm/lazy-measurements.js
8
- var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
9
- var import_react_dom = /* @__PURE__ */ __toESM(require_react_dom(), 1);
10
- function createLazyMeasurementsView(count, flat, getItemKey) {
11
- const cache = new Array(count);
12
- return new Proxy(cache, { get(target, prop, receiver) {
13
- if (typeof prop === "string") {
14
- const c = prop.charCodeAt(0);
15
- if (c >= 48 && c <= 57) {
16
- const i = +prop;
17
- if (Number.isInteger(i) && i >= 0 && i < count) {
18
- let v = target[i];
19
- if (!v) {
20
- const s = flat[i * 2];
21
- v = target[i] = {
22
- index: i,
23
- key: getItemKey(i),
24
- start: s,
25
- size: flat[i * 2 + 1],
26
- end: s + flat[i * 2 + 1],
27
- lane: 0
28
- };
29
- }
30
- return v;
31
- }
32
- }
33
- if (prop === "length") return count;
34
- }
35
- return Reflect.get(target, prop, receiver);
36
- } });
37
- }
38
- //#endregion
39
- //#region ../../node_modules/.pnpm/@tanstack+virtual-core@3.17.4/node_modules/@tanstack/virtual-core/dist/esm/utils.js
40
- function memo(getDeps, fn, opts) {
41
- let deps = opts.initialDeps ?? [];
42
- let result;
43
- let isInitial = true;
44
- function memoizedFunction() {
45
- var _a;
46
- const debugEnabled = process.env.NODE_ENV !== "production" && !!opts.key && !!((_a = opts.debug) == null ? void 0 : _a.call(opts));
47
- let depTime = 0;
48
- if (debugEnabled) depTime = Date.now();
49
- const newDeps = getDeps();
50
- if (!(newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep))) return result;
51
- deps = newDeps;
52
- let resultTime = 0;
53
- if (debugEnabled) resultTime = Date.now();
54
- result = fn(...newDeps);
55
- if (debugEnabled) {
56
- const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
57
- const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
58
- const resultFpsPercentage = resultEndTime / 16;
59
- const pad = (str, num) => {
60
- str = String(str);
61
- while (str.length < num) str = " " + str;
62
- return str;
63
- };
64
- console.info(`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, `
65
- font-size: .6rem;
66
- font-weight: bold;
67
- color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts == null ? void 0 : opts.key);
68
- }
69
- if ((opts == null ? void 0 : opts.onChange) && !(isInitial && opts.skipInitialOnChange)) opts.onChange(result);
70
- isInitial = false;
71
- return result;
72
- }
73
- memoizedFunction.updateDeps = (newDeps) => {
74
- deps = newDeps;
75
- };
76
- return memoizedFunction;
77
- }
78
- function notUndefined(value, msg) {
79
- if (value === void 0) throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ""}`);
80
- else return value;
81
- }
82
- var approxEqual = (a, b) => Math.abs(a - b) < 1.01;
83
- var debounce = (targetWindow, fn, ms) => {
84
- let timeoutId;
85
- return function(...args) {
86
- targetWindow.clearTimeout(timeoutId);
87
- timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
88
- };
89
- };
90
- //#endregion
91
- //#region ../../node_modules/.pnpm/@tanstack+virtual-core@3.17.4/node_modules/@tanstack/virtual-core/dist/esm/index.js
92
- var _isIOSResult;
93
- var isIOSWebKit = () => {
94
- if (_isIOSResult !== void 0) return _isIOSResult;
95
- if (typeof navigator === "undefined") return _isIOSResult = false;
96
- if (/iP(hone|od|ad)/.test(navigator.userAgent)) return _isIOSResult = true;
97
- const mtp = navigator.maxTouchPoints;
98
- return _isIOSResult = navigator.platform === "MacIntel" && mtp !== void 0 && mtp > 0;
99
- };
100
- var getRect = (element) => {
101
- const { offsetWidth, offsetHeight } = element;
102
- return {
103
- width: offsetWidth,
104
- height: offsetHeight
105
- };
106
- };
107
- var defaultKeyExtractor = (index) => index;
108
- var defaultRangeExtractor = (range) => {
109
- const start = Math.max(range.startIndex - range.overscan, 0);
110
- const len = Math.min(range.endIndex + range.overscan, range.count - 1) - start + 1;
111
- const arr = new Array(len);
112
- for (let i = 0; i < len; i++) arr[i] = start + i;
113
- return arr;
114
- };
115
- var observeElementRect = (instance, cb) => {
116
- const element = instance.scrollElement;
117
- if (!element) return;
118
- const targetWindow = instance.targetWindow;
119
- if (!targetWindow) return;
120
- const handler = (rect) => {
121
- const { width, height } = rect;
122
- cb({
123
- width: Math.round(width),
124
- height: Math.round(height)
125
- });
126
- };
127
- handler(getRect(element));
128
- if (!targetWindow.ResizeObserver) return () => {};
129
- const observer = new targetWindow.ResizeObserver((entries) => {
130
- const run = () => {
131
- const entry = entries[0];
132
- if (entry == null ? void 0 : entry.borderBoxSize) {
133
- const box = entry.borderBoxSize[0];
134
- if (box) {
135
- handler({
136
- width: box.inlineSize,
137
- height: box.blockSize
138
- });
139
- return;
140
- }
141
- }
142
- handler(getRect(element));
143
- };
144
- instance.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
145
- });
146
- observer.observe(element, { box: "border-box" });
147
- return () => {
148
- observer.unobserve(element);
149
- };
150
- };
151
- var addEventListenerOptions = { passive: true };
152
- var supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
153
- var observeOffset = (instance, cb, readOffset) => {
154
- const element = instance.scrollElement;
155
- if (!element) return;
156
- const targetWindow = instance.targetWindow;
157
- if (!targetWindow) return;
158
- const registerScrollendEvent = instance.options.useScrollendEvent && supportsScrollend;
159
- let offset = 0;
160
- const fallback = registerScrollendEvent ? null : debounce(targetWindow, () => cb(offset, false), instance.options.isScrollingResetDelay);
161
- const createHandler = (isScrolling) => () => {
162
- offset = readOffset(element);
163
- fallback?.();
164
- cb(offset, isScrolling);
165
- };
166
- const handler = createHandler(true);
167
- const endHandler = createHandler(false);
168
- element.addEventListener("scroll", handler, addEventListenerOptions);
169
- if (registerScrollendEvent) element.addEventListener("scrollend", endHandler, addEventListenerOptions);
170
- return () => {
171
- element.removeEventListener("scroll", handler);
172
- if (registerScrollendEvent) element.removeEventListener("scrollend", endHandler);
173
- };
174
- };
175
- var observeElementOffset = (instance, cb) => observeOffset(instance, cb, (el) => {
176
- const { horizontal, isRtl } = instance.options;
177
- return horizontal ? el.scrollLeft * (isRtl && -1 || 1) : el.scrollTop;
178
- });
179
- var measureElement = (element, entry, instance) => {
180
- if (instance.options.useCachedMeasurements) {
181
- const index = instance.indexFromElement(element);
182
- const key = instance.options.getItemKey(index);
183
- return instance.itemSizeCache.get(key) ?? instance.options.estimateSize(index);
184
- }
185
- if (entry == null ? void 0 : entry.borderBoxSize) {
186
- const box = entry.borderBoxSize[0];
187
- if (box) return Math.round(box[instance.options.horizontal ? "inlineSize" : "blockSize"]);
188
- }
189
- if (!entry) {
190
- const index = instance.indexFromElement(element);
191
- const key = instance.options.getItemKey(index);
192
- const cachedSize = instance.itemSizeCache.get(key);
193
- if (cachedSize !== void 0) return cachedSize;
194
- }
195
- return element[instance.options.horizontal ? "offsetWidth" : "offsetHeight"];
196
- };
197
- var scrollWithAdjustments = (offset, { adjustments = 0, behavior }, instance) => {
198
- var _a, _b;
199
- (_b = (_a = instance.scrollElement) == null ? void 0 : _a.scrollTo) == null || _b.call(_a, {
200
- [instance.options.horizontal ? "left" : "top"]: offset + adjustments,
201
- behavior
202
- });
203
- };
204
- var elementScroll = scrollWithAdjustments;
205
- var Virtualizer = class {
206
- constructor(opts) {
207
- this.unsubs = [];
208
- this.scrollElement = null;
209
- this.targetWindow = null;
210
- this.isScrolling = false;
211
- this.scrollState = null;
212
- this.measurementsCache = [];
213
- this._flatMeasurements = null;
214
- this.itemSizeCache = /* @__PURE__ */ new Map();
215
- this.itemSizeCacheVersion = 0;
216
- this.laneAssignments = /* @__PURE__ */ new Map();
217
- this.pendingMin = null;
218
- this.prevLanes = void 0;
219
- this.lanesChangedFlag = false;
220
- this.lanesSettling = false;
221
- this.pendingScrollAnchor = null;
222
- this.scrollRect = null;
223
- this.scrollOffset = null;
224
- this.scrollDirection = null;
225
- this.scrollAdjustments = 0;
226
- this._iosDeferredAdjustment = 0;
227
- this._iosTouching = false;
228
- this._iosJustTouchEnded = false;
229
- this._iosTouchEndTimerId = null;
230
- this._intendedScrollOffset = null;
231
- this.elementsCache = /* @__PURE__ */ new Map();
232
- this.now = () => {
233
- var _a, _b, _c;
234
- return ((_c = (_b = (_a = this.targetWindow) == null ? void 0 : _a.performance) == null ? void 0 : _b.now) == null ? void 0 : _c.call(_b)) ?? Date.now();
235
- };
236
- this.observer = /* @__PURE__ */ (() => {
237
- let _ro = null;
238
- const get = () => {
239
- if (_ro) return _ro;
240
- if (!this.targetWindow || !this.targetWindow.ResizeObserver) return null;
241
- return _ro = new this.targetWindow.ResizeObserver((entries) => {
242
- entries.forEach((entry) => {
243
- const run = () => {
244
- const node = entry.target;
245
- const index = this.indexFromElement(node);
246
- if (!node.isConnected) {
247
- this.observer.unobserve(node);
248
- for (const [cacheKey, cachedNode] of this.elementsCache) if (cachedNode === node) {
249
- this.elementsCache.delete(cacheKey);
250
- break;
251
- }
252
- return;
253
- }
254
- if (this.shouldMeasureDuringScroll(index)) this.resizeItem(index, this.options.measureElement(node, entry, this));
255
- };
256
- this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
257
- });
258
- });
259
- };
260
- return {
261
- disconnect: () => {
262
- var _a;
263
- (_a = get()) == null || _a.disconnect();
264
- _ro = null;
265
- },
266
- observe: (target) => {
267
- var _a;
268
- return (_a = get()) == null ? void 0 : _a.observe(target, { box: "border-box" });
269
- },
270
- unobserve: (target) => {
271
- var _a;
272
- return (_a = get()) == null ? void 0 : _a.unobserve(target);
273
- }
274
- };
275
- })();
276
- this.range = null;
277
- this.setOptions = (opts2) => {
278
- var _a, _b;
279
- const merged = {
280
- debug: false,
281
- initialOffset: 0,
282
- overscan: 1,
283
- paddingStart: 0,
284
- paddingEnd: 0,
285
- scrollPaddingStart: 0,
286
- scrollPaddingEnd: 0,
287
- horizontal: false,
288
- getItemKey: defaultKeyExtractor,
289
- rangeExtractor: defaultRangeExtractor,
290
- onChange: () => {},
291
- measureElement,
292
- initialRect: {
293
- width: 0,
294
- height: 0
295
- },
296
- scrollMargin: 0,
297
- gap: 0,
298
- indexAttribute: "data-index",
299
- initialMeasurementsCache: [],
300
- lanes: 1,
301
- anchorTo: "start",
302
- followOnAppend: false,
303
- scrollEndThreshold: 1,
304
- isScrollingResetDelay: 150,
305
- enabled: true,
306
- isRtl: false,
307
- useScrollendEvent: false,
308
- useAnimationFrameWithResizeObserver: false,
309
- laneAssignmentMode: "estimate",
310
- useCachedMeasurements: false
311
- };
312
- for (const key in opts2) {
313
- const v = opts2[key];
314
- if (v !== void 0) merged[key] = v;
315
- }
316
- const prevOptions = this.options;
317
- let anchor = null;
318
- let followOnAppend = null;
319
- let edgeKeysChanged = false;
320
- if (prevOptions !== void 0 && prevOptions.enabled && merged.enabled && merged.anchorTo === "end" && this.scrollElement !== null) {
321
- const prevCount = prevOptions.count;
322
- const nextCount = merged.count;
323
- const measurements = this.getMeasurements();
324
- const prevFirstKey = prevCount > 0 ? ((_a = measurements[0]) == null ? void 0 : _a.key) ?? prevOptions.getItemKey(0) : null;
325
- const prevLastKey = prevCount > 0 ? ((_b = measurements[prevCount - 1]) == null ? void 0 : _b.key) ?? prevOptions.getItemKey(prevCount - 1) : null;
326
- if (nextCount !== prevCount || prevCount > 0 && nextCount > 0 && (merged.getItemKey(0) !== prevFirstKey || merged.getItemKey(nextCount - 1) !== prevLastKey)) {
327
- edgeKeysChanged = true;
328
- const item = prevCount > 0 ? this.getVirtualItemForOffset(this.getScrollOffset()) ?? measurements[0] : null;
329
- if (item) anchor = [item.key, this.getScrollOffset() - item.start];
330
- const behavior = merged.followOnAppend === true ? "auto" : merged.followOnAppend || null;
331
- if (behavior && nextCount > prevCount && this.isAtEnd(prevOptions.scrollEndThreshold) && (prevCount === 0 || merged.getItemKey(nextCount - 1) !== prevLastKey)) followOnAppend = behavior;
332
- }
333
- }
334
- this.options = merged;
335
- if (edgeKeysChanged) {
336
- this.pendingMin = 0;
337
- this.itemSizeCacheVersion++;
338
- }
339
- let anchorResolved = false;
340
- let anchorDelta = 0;
341
- if (anchor && this.scrollOffset !== null) {
342
- const [anchorKey, anchorOffset] = anchor;
343
- const newMeasurements = this.getMeasurements();
344
- const { count, getItemKey } = this.options;
345
- let idx = 0;
346
- while (idx < count && getItemKey(idx) !== anchorKey) idx++;
347
- if (idx < count) {
348
- const anchorItem = newMeasurements[idx];
349
- if (anchorItem) {
350
- const newOffset = anchorItem.start + anchorOffset;
351
- if (newOffset !== this.scrollOffset) {
352
- anchorDelta = newOffset - this.scrollOffset;
353
- this.scrollOffset = newOffset;
354
- anchorResolved = true;
355
- }
356
- }
357
- }
358
- }
359
- if (anchorResolved || followOnAppend) this.pendingScrollAnchor = [
360
- anchorResolved ? anchor[0] : null,
361
- anchorResolved ? anchor[1] : 0,
362
- followOnAppend,
363
- anchorDelta
364
- ];
365
- };
366
- this.notify = (sync) => {
367
- var _a, _b;
368
- (_b = (_a = this.options).onChange) == null || _b.call(_a, this, sync);
369
- };
370
- this.maybeNotify = memo(() => {
371
- this.calculateRange();
372
- return [
373
- this.isScrolling,
374
- this.range ? this.range.startIndex : null,
375
- this.range ? this.range.endIndex : null
376
- ];
377
- }, (isScrolling) => {
378
- this.notify(isScrolling);
379
- }, {
380
- key: process.env.NODE_ENV !== "production" && "maybeNotify",
381
- debug: () => this.options.debug,
382
- initialDeps: [
383
- this.isScrolling,
384
- this.range ? this.range.startIndex : null,
385
- this.range ? this.range.endIndex : null
386
- ]
387
- });
388
- this.cleanup = () => {
389
- this.unsubs.filter(Boolean).forEach((d) => d());
390
- this.unsubs = [];
391
- this.observer.disconnect();
392
- if (this.rafId != null && this.targetWindow) {
393
- this.targetWindow.cancelAnimationFrame(this.rafId);
394
- this.rafId = null;
395
- }
396
- this.scrollState = null;
397
- this._iosDeferredAdjustment = 0;
398
- this._iosTouching = false;
399
- this._iosJustTouchEnded = false;
400
- this.scrollElement = null;
401
- this.targetWindow = null;
402
- };
403
- this._didMount = () => {
404
- return () => {
405
- this.cleanup();
406
- };
407
- };
408
- this._willUpdate = () => {
409
- var _a;
410
- const scrollElement = this.options.enabled ? this.options.getScrollElement() : null;
411
- if (this.scrollElement !== scrollElement) {
412
- this.cleanup();
413
- if (!scrollElement) {
414
- this.maybeNotify();
415
- return;
416
- }
417
- this.scrollElement = scrollElement;
418
- if (this.scrollElement && "ownerDocument" in this.scrollElement) this.targetWindow = this.scrollElement.ownerDocument.defaultView;
419
- else this.targetWindow = ((_a = this.scrollElement) == null ? void 0 : _a.window) ?? null;
420
- this.elementsCache.forEach((cached) => {
421
- this.observer.observe(cached);
422
- });
423
- this.unsubs.push(this.options.observeElementRect(this, (rect) => {
424
- this.scrollRect = rect;
425
- this.maybeNotify();
426
- }));
427
- this.unsubs.push(this.options.observeElementOffset(this, (offset, isScrolling) => {
428
- if (isScrolling && this._intendedScrollOffset === null && offset === this.scrollOffset) return;
429
- if (this._intendedScrollOffset !== null && Math.abs(offset - this._intendedScrollOffset) < 1.5) offset = this._intendedScrollOffset;
430
- this._intendedScrollOffset = null;
431
- this.scrollAdjustments = 0;
432
- const prevOffset = this.getScrollOffset();
433
- this.scrollDirection = isScrolling ? prevOffset === offset ? this.scrollDirection : prevOffset < offset ? "forward" : "backward" : null;
434
- this.scrollOffset = offset;
435
- this.isScrolling = isScrolling;
436
- this._flushIosDeferredIfReady();
437
- if (this.scrollState) this.scheduleScrollReconcile();
438
- this.maybeNotify();
439
- }));
440
- if ("addEventListener" in this.scrollElement) {
441
- const scrollEl = this.scrollElement;
442
- const onTouchStart = () => {
443
- this._iosTouching = true;
444
- this._iosJustTouchEnded = false;
445
- if (this._iosTouchEndTimerId !== null && this.targetWindow != null) {
446
- this.targetWindow.clearTimeout(this._iosTouchEndTimerId);
447
- this._iosTouchEndTimerId = null;
448
- }
449
- };
450
- const onTouchEnd = () => {
451
- this._iosTouching = false;
452
- if (!isIOSWebKit() || this.targetWindow == null) return;
453
- this._iosJustTouchEnded = true;
454
- this._iosTouchEndTimerId = this.targetWindow.setTimeout(() => {
455
- this._iosJustTouchEnded = false;
456
- this._iosTouchEndTimerId = null;
457
- this._flushIosDeferredIfReady();
458
- }, 150);
459
- };
460
- scrollEl.addEventListener("touchstart", onTouchStart, addEventListenerOptions);
461
- scrollEl.addEventListener("touchend", onTouchEnd, addEventListenerOptions);
462
- this.unsubs.push(() => {
463
- scrollEl.removeEventListener("touchstart", onTouchStart);
464
- scrollEl.removeEventListener("touchend", onTouchEnd);
465
- if (this._iosTouchEndTimerId !== null && this.targetWindow != null) {
466
- this.targetWindow.clearTimeout(this._iosTouchEndTimerId);
467
- this._iosTouchEndTimerId = null;
468
- }
469
- });
470
- }
471
- this._scrollToOffset(this.getScrollOffset(), {
472
- adjustments: void 0,
473
- behavior: void 0
474
- });
475
- }
476
- const anchor = this.pendingScrollAnchor;
477
- this.pendingScrollAnchor = null;
478
- if (anchor && this.scrollElement && this.options.enabled) {
479
- const [key, _offset, followOnAppend, anchorDelta] = anchor;
480
- if (key !== null && !followOnAppend) if (isIOSWebKit() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded)) {
481
- if (anchorDelta !== 0) this._iosDeferredAdjustment += anchorDelta;
482
- } else this._scrollToOffset(this.getScrollOffset(), {
483
- adjustments: void 0,
484
- behavior: void 0
485
- });
486
- if (followOnAppend) this.scrollToEnd({ behavior: followOnAppend });
487
- }
488
- };
489
- this._flushIosDeferredIfReady = () => {
490
- if (this._iosDeferredAdjustment === 0) return;
491
- if (this.isScrolling) return;
492
- if (this._iosTouching) return;
493
- if (this._iosJustTouchEnded) return;
494
- const cur = this.getScrollOffset();
495
- const max = this.getMaxScrollOffset();
496
- if (cur < 0 || cur > max) return;
497
- const delta = this._iosDeferredAdjustment;
498
- this._iosDeferredAdjustment = 0;
499
- this._scrollToOffset(cur, {
500
- adjustments: this.scrollAdjustments += delta,
501
- behavior: void 0
502
- });
503
- };
504
- this.rafId = null;
505
- this.getSize = () => {
506
- if (!this.options.enabled) {
507
- this.scrollRect = null;
508
- return 0;
509
- }
510
- this.scrollRect = this.scrollRect ?? this.options.initialRect;
511
- return this.scrollRect[this.options.horizontal ? "width" : "height"];
512
- };
513
- this.getScrollOffset = () => {
514
- if (!this.options.enabled) {
515
- this.scrollOffset = null;
516
- return 0;
517
- }
518
- this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset);
519
- return this.scrollOffset;
520
- };
521
- this.getMeasurementOptions = memo(() => [
522
- this.options.count,
523
- this.options.paddingStart,
524
- this.options.scrollMargin,
525
- this.options.getItemKey,
526
- this.options.enabled,
527
- this.options.lanes,
528
- this.options.laneAssignmentMode,
529
- this.options.gap
530
- ], (count, paddingStart, scrollMargin, getItemKey, enabled, lanes, laneAssignmentMode, gap) => {
531
- if (this.prevLanes !== void 0 && this.prevLanes !== lanes) this.lanesChangedFlag = true;
532
- this.prevLanes = lanes;
533
- this.pendingMin = null;
534
- return {
535
- count,
536
- paddingStart,
537
- scrollMargin,
538
- getItemKey,
539
- enabled,
540
- lanes,
541
- laneAssignmentMode,
542
- gap
543
- };
544
- }, { key: false });
545
- this.getMeasurements = memo(() => [this.getMeasurementOptions(), this.itemSizeCacheVersion], ({ count, paddingStart, scrollMargin, getItemKey, enabled, lanes, laneAssignmentMode, gap }, _itemSizeCacheVersion) => {
546
- const itemSizeCache = this.itemSizeCache;
547
- if (!enabled) {
548
- this.measurementsCache = [];
549
- this.itemSizeCache.clear();
550
- this.laneAssignments.clear();
551
- return [];
552
- }
553
- if (this.laneAssignments.size > count) {
554
- for (const index of this.laneAssignments.keys()) if (index >= count) this.laneAssignments.delete(index);
555
- }
556
- if (this.lanesChangedFlag) {
557
- this.lanesChangedFlag = false;
558
- this.lanesSettling = true;
559
- this.measurementsCache = [];
560
- this.itemSizeCache.clear();
561
- this.laneAssignments.clear();
562
- this.pendingMin = null;
563
- }
564
- if (this.measurementsCache.length === 0 && !this.lanesSettling) {
565
- this.measurementsCache = this.options.initialMeasurementsCache;
566
- this.measurementsCache.forEach((item) => {
567
- this.itemSizeCache.set(item.key, item.size);
568
- });
569
- }
570
- const min = this.lanesSettling ? 0 : this.pendingMin ?? 0;
571
- this.pendingMin = null;
572
- if (this.lanesSettling && this.measurementsCache.length === count) this.lanesSettling = false;
573
- if (lanes === 1) {
574
- const need = count * 2;
575
- let flat = this._flatMeasurements;
576
- if (!flat || flat.length < need) {
577
- const next = new Float64Array(need);
578
- if (flat && min > 0) next.set(flat.subarray(0, min * 2));
579
- flat = next;
580
- this._flatMeasurements = flat;
581
- }
582
- let runningStart;
583
- if (min === 0) runningStart = paddingStart + scrollMargin;
584
- else {
585
- const prevIdx = min - 1;
586
- runningStart = flat[prevIdx * 2] + flat[prevIdx * 2 + 1] + gap;
587
- }
588
- for (let i = min; i < count; i++) {
589
- const key = getItemKey(i);
590
- const measuredSize = itemSizeCache.get(key);
591
- const size = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
592
- flat[i * 2] = runningStart;
593
- flat[i * 2 + 1] = size;
594
- runningStart += size + gap;
595
- }
596
- const view = createLazyMeasurementsView(count, flat, getItemKey);
597
- this.measurementsCache = view;
598
- return view;
599
- }
600
- const measurements = this.measurementsCache.slice(0, min);
601
- const laneLastIndex = new Array(lanes).fill(void 0);
602
- const laneEnds = new Float64Array(lanes);
603
- let filledLanes = 0;
604
- for (let m = 0; m < min; m++) {
605
- const item = measurements[m];
606
- if (item) {
607
- if (laneLastIndex[item.lane] === void 0) filledLanes++;
608
- laneLastIndex[item.lane] = m;
609
- laneEnds[item.lane] = item.end;
610
- }
611
- }
612
- for (let i = min; i < count; i++) {
613
- const key = getItemKey(i);
614
- const cachedLane = this.laneAssignments.get(i);
615
- let lane;
616
- let start;
617
- const shouldCacheLane = laneAssignmentMode === "estimate" || itemSizeCache.has(key);
618
- if (cachedLane !== void 0 && this.options.lanes > 1) {
619
- lane = cachedLane;
620
- const prevIndex = laneLastIndex[lane];
621
- const prevInLane = prevIndex !== void 0 ? measurements[prevIndex] : void 0;
622
- start = prevInLane ? prevInLane.end + gap : paddingStart + scrollMargin;
623
- } else if (filledLanes === lanes) {
624
- let bestLane = 0;
625
- let bestEnd = laneEnds[0];
626
- let bestIdx = laneLastIndex[0];
627
- for (let l = 1; l < lanes; l++) {
628
- const e = laneEnds[l];
629
- if (e < bestEnd || e === bestEnd && laneLastIndex[l] < bestIdx) {
630
- bestLane = l;
631
- bestEnd = e;
632
- bestIdx = laneLastIndex[l];
633
- }
634
- }
635
- lane = bestLane;
636
- start = bestEnd + gap;
637
- if (shouldCacheLane) this.laneAssignments.set(i, lane);
638
- } else {
639
- lane = i % this.options.lanes;
640
- start = paddingStart + scrollMargin;
641
- if (shouldCacheLane) this.laneAssignments.set(i, lane);
642
- }
643
- const measuredSize = itemSizeCache.get(key);
644
- const size = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
645
- const end = start + size;
646
- measurements[i] = {
647
- index: i,
648
- start,
649
- size,
650
- end,
651
- key,
652
- lane
653
- };
654
- if (laneLastIndex[lane] === void 0) filledLanes++;
655
- laneLastIndex[lane] = i;
656
- laneEnds[lane] = end;
657
- }
658
- this.measurementsCache = measurements;
659
- return measurements;
660
- }, {
661
- key: process.env.NODE_ENV !== "production" && "getMeasurements",
662
- debug: () => this.options.debug
663
- });
664
- this.calculateRange = memo(() => [
665
- this.getMeasurements(),
666
- this.getSize(),
667
- this.getScrollOffset(),
668
- this.options.lanes
669
- ], (measurements, outerSize, scrollOffset, lanes) => {
670
- if (measurements.length === 0 || outerSize === 0) {
671
- this.range = null;
672
- return null;
673
- }
674
- this.range = calculateRangeImpl(measurements, outerSize, scrollOffset, lanes, lanes === 1 && this._flatMeasurements != null ? this._flatMeasurements : null);
675
- return this.range;
676
- }, {
677
- key: process.env.NODE_ENV !== "production" && "calculateRange",
678
- debug: () => this.options.debug
679
- });
680
- this.getVirtualIndexes = memo(() => {
681
- let startIndex = null;
682
- let endIndex = null;
683
- const range = this.calculateRange();
684
- if (range) {
685
- startIndex = range.startIndex;
686
- endIndex = range.endIndex;
687
- }
688
- this.maybeNotify.updateDeps([
689
- this.isScrolling,
690
- startIndex,
691
- endIndex
692
- ]);
693
- return [
694
- this.options.rangeExtractor,
695
- this.options.overscan,
696
- this.options.count,
697
- startIndex,
698
- endIndex
699
- ];
700
- }, (rangeExtractor, overscan, count, startIndex, endIndex) => {
701
- return startIndex === null || endIndex === null ? [] : rangeExtractor({
702
- startIndex,
703
- endIndex,
704
- overscan,
705
- count
706
- });
707
- }, {
708
- key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
709
- debug: () => this.options.debug
710
- });
711
- this.indexFromElement = (node) => {
712
- const attributeName = this.options.indexAttribute;
713
- const indexStr = node.getAttribute(attributeName);
714
- if (!indexStr) {
715
- console.warn(`Missing attribute name '${attributeName}={index}' on measured element.`);
716
- return -1;
717
- }
718
- return parseInt(indexStr, 10);
719
- };
720
- this.shouldMeasureDuringScroll = (index) => {
721
- var _a;
722
- if (!this.scrollState || this.scrollState.behavior !== "smooth") return true;
723
- const scrollIndex = this.scrollState.index ?? ((_a = this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)) == null ? void 0 : _a.index);
724
- if (scrollIndex !== void 0 && this.range) {
725
- const bufferSize = Math.max(this.options.overscan, Math.ceil((this.range.endIndex - this.range.startIndex) / 2));
726
- const minIndex = Math.max(0, scrollIndex - bufferSize);
727
- const maxIndex = Math.min(this.options.count - 1, scrollIndex + bufferSize);
728
- return index >= minIndex && index <= maxIndex;
729
- }
730
- return true;
731
- };
732
- this.measureElement = (node) => {
733
- if (!node) {
734
- this.elementsCache.forEach((cached, key2) => {
735
- if (!cached.isConnected) {
736
- this.observer.unobserve(cached);
737
- this.elementsCache.delete(key2);
738
- }
739
- });
740
- return;
741
- }
742
- const index = this.indexFromElement(node);
743
- const key = this.options.getItemKey(index);
744
- const prevNode = this.elementsCache.get(key);
745
- if (prevNode !== node) {
746
- if (prevNode) this.observer.unobserve(prevNode);
747
- this.observer.observe(node);
748
- this.elementsCache.set(key, node);
749
- }
750
- if ((!this.isScrolling || this.scrollState) && this.shouldMeasureDuringScroll(index)) this.resizeItem(index, this.options.measureElement(node, void 0, this));
751
- };
752
- this.resizeItem = (index, size) => {
753
- var _a, _b;
754
- if (index < 0 || index >= this.options.count) return;
755
- let cachedSize;
756
- let itemStart;
757
- let key;
758
- const flat = this._flatMeasurements;
759
- if (this.options.lanes === 1 && flat !== null) {
760
- key = this.options.getItemKey(index);
761
- itemStart = flat[index * 2];
762
- cachedSize = flat[index * 2 + 1];
763
- } else {
764
- const item = this.measurementsCache[index];
765
- if (!item) return;
766
- key = item.key;
767
- itemStart = item.start;
768
- cachedSize = item.size;
769
- }
770
- const delta = size - (this.itemSizeCache.get(key) ?? cachedSize);
771
- if (delta !== 0) {
772
- const wasAtEnd = this.options.anchorTo === "end" && ((_a = this.scrollState) == null ? void 0 : _a.behavior) !== "smooth" && this.getVirtualDistanceFromEnd() <= this.options.scrollEndThreshold;
773
- const prevTotalSize = wasAtEnd ? this.getTotalSize() : 0;
774
- const shouldAdjustScroll = ((_b = this.scrollState) == null ? void 0 : _b.behavior) !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[index] ?? {
775
- index,
776
- key,
777
- start: itemStart,
778
- size: cachedSize,
779
- end: itemStart + cachedSize,
780
- lane: 0
781
- }, delta, this) : itemStart < this.getScrollOffset() + this.scrollAdjustments && (!this.itemSizeCache.has(key) || this.scrollDirection !== "backward"));
782
- if (this.pendingMin === null || index < this.pendingMin) this.pendingMin = index;
783
- this.itemSizeCache.set(key, size);
784
- this.itemSizeCacheVersion++;
785
- if (wasAtEnd) this.applyScrollAdjustment(this.getTotalSize() - prevTotalSize);
786
- else if (shouldAdjustScroll) this.applyScrollAdjustment(delta);
787
- this.notify(false);
788
- }
789
- };
790
- this.getVirtualItems = memo(() => [this.getVirtualIndexes(), this.getMeasurements()], (indexes, measurements) => {
791
- const virtualItems = [];
792
- for (let k = 0, len = indexes.length; k < len; k++) {
793
- const measurement = measurements[indexes[k]];
794
- virtualItems.push(measurement);
795
- }
796
- return virtualItems;
797
- }, {
798
- key: process.env.NODE_ENV !== "production" && "getVirtualItems",
799
- debug: () => this.options.debug
800
- });
801
- this.getVirtualItemForOffset = (offset) => {
802
- const measurements = this.getMeasurements();
803
- if (measurements.length === 0) return;
804
- const flat = this._flatMeasurements;
805
- const useFlat = this.options.lanes === 1 && flat != null;
806
- return notUndefined(measurements[findNearestBinarySearch(0, measurements.length - 1, useFlat ? (i) => flat[i * 2] : (i) => notUndefined(measurements[i]).start, offset)]);
807
- };
808
- this.getMaxScrollOffset = () => {
809
- if (!this.scrollElement) return 0;
810
- if ("scrollHeight" in this.scrollElement) return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
811
- else {
812
- const doc = this.scrollElement.document.documentElement;
813
- return this.options.horizontal ? doc.scrollWidth - this.scrollElement.innerWidth : doc.scrollHeight - this.scrollElement.innerHeight;
814
- }
815
- };
816
- this.getVirtualDistanceFromEnd = () => {
817
- return Math.max(this.getTotalSize() - this.getSize() - this.getScrollOffset(), 0);
818
- };
819
- this.getDistanceFromEnd = () => {
820
- return Math.max(this.getMaxScrollOffset() - this.getScrollOffset(), 0);
821
- };
822
- this.isAtEnd = (threshold = this.options.scrollEndThreshold) => {
823
- return this.getDistanceFromEnd() <= threshold;
824
- };
825
- this.getOffsetForAlignment = (toOffset, align, itemSize = 0) => {
826
- if (!this.scrollElement) return 0;
827
- const size = this.getSize();
828
- const scrollOffset = this.getScrollOffset();
829
- if (align === "auto") align = toOffset >= scrollOffset + size ? "end" : "start";
830
- if (align === "center") toOffset += (itemSize - size) / 2;
831
- else if (align === "end") toOffset -= size;
832
- const maxOffset = this.getMaxScrollOffset();
833
- return Math.max(Math.min(maxOffset, toOffset), 0);
834
- };
835
- this.getOffsetForIndex = (index, align = "auto") => {
836
- index = Math.max(0, Math.min(index, this.options.count - 1));
837
- const size = this.getSize();
838
- const scrollOffset = this.getScrollOffset();
839
- const item = this.measurementsCache[index];
840
- if (!item) return;
841
- if (align === "auto") if (item.end >= scrollOffset + size - this.options.scrollPaddingEnd) align = "end";
842
- else if (item.start <= scrollOffset + this.options.scrollPaddingStart) align = "start";
843
- else return [scrollOffset, align];
844
- if (align === "end" && index === this.options.count - 1) return [this.getMaxScrollOffset(), align];
845
- const toOffset = align === "end" ? item.end + this.options.scrollPaddingEnd : item.start - this.options.scrollPaddingStart;
846
- return [this.getOffsetForAlignment(toOffset, align, item.size), align];
847
- };
848
- this.scrollToOffset = (toOffset, { align = "start", behavior = "auto" } = {}) => {
849
- const offset = this.getOffsetForAlignment(toOffset, align);
850
- this.scrollState = {
851
- index: null,
852
- align,
853
- behavior,
854
- startedAt: this.now(),
855
- lastTargetOffset: offset,
856
- stableFrames: 0
857
- };
858
- this._scrollToOffset(offset, {
859
- adjustments: void 0,
860
- behavior
861
- });
862
- this.scheduleScrollReconcile();
863
- };
864
- this.scrollToIndex = (index, { align: initialAlign = "auto", behavior = "auto" } = {}) => {
865
- index = Math.max(0, Math.min(index, this.options.count - 1));
866
- const offsetInfo = this.getOffsetForIndex(index, initialAlign);
867
- if (!offsetInfo) return;
868
- const [offset, align] = offsetInfo;
869
- const now = this.now();
870
- this.scrollState = {
871
- index,
872
- align,
873
- behavior,
874
- startedAt: now,
875
- lastTargetOffset: offset,
876
- stableFrames: 0
877
- };
878
- this._scrollToOffset(offset, {
879
- adjustments: void 0,
880
- behavior
881
- });
882
- this.scheduleScrollReconcile();
883
- };
884
- this.scrollBy = (delta, { behavior = "auto" } = {}) => {
885
- const offset = this.getScrollOffset() + delta;
886
- this.scrollState = {
887
- index: null,
888
- align: "start",
889
- behavior,
890
- startedAt: this.now(),
891
- lastTargetOffset: offset,
892
- stableFrames: 0
893
- };
894
- this._scrollToOffset(offset, {
895
- adjustments: void 0,
896
- behavior
897
- });
898
- this.scheduleScrollReconcile();
899
- };
900
- this.scrollToEnd = ({ behavior = "auto" } = {}) => {
901
- if (this.options.count > 0) {
902
- this.scrollToIndex(this.options.count - 1, {
903
- align: "end",
904
- behavior
905
- });
906
- return;
907
- }
908
- this.scrollToOffset(Math.max(this.getTotalSize() - this.getSize(), 0), { behavior });
909
- };
910
- this.getTotalSize = () => {
911
- var _a;
912
- const measurements = this.getMeasurements();
913
- let end;
914
- if (measurements.length === 0) end = this.options.paddingStart;
915
- else if (this.options.lanes === 1) {
916
- const lastIdx = measurements.length - 1;
917
- const flat = this._flatMeasurements;
918
- if (flat != null) end = flat[lastIdx * 2] + flat[lastIdx * 2 + 1];
919
- else end = ((_a = measurements[lastIdx]) == null ? void 0 : _a.end) ?? 0;
920
- } else {
921
- const endByLane = Array(this.options.lanes).fill(null);
922
- let endIndex = measurements.length - 1;
923
- while (endIndex >= 0 && endByLane.some((val) => val === null)) {
924
- const item = measurements[endIndex];
925
- if (endByLane[item.lane] === null) endByLane[item.lane] = item.end;
926
- endIndex--;
927
- }
928
- end = Math.max(...endByLane.filter((val) => val !== null));
929
- }
930
- return Math.max(end - this.options.scrollMargin + this.options.paddingEnd, 0);
931
- };
932
- this.takeSnapshot = () => {
933
- const snapshot = [];
934
- if (this.itemSizeCache.size === 0) return snapshot;
935
- const m = this.getMeasurements();
936
- for (const item of m) if (item && this.itemSizeCache.has(item.key)) snapshot.push({
937
- index: item.index,
938
- key: item.key,
939
- start: item.start,
940
- size: item.size,
941
- end: item.end,
942
- lane: item.lane
943
- });
944
- return snapshot;
945
- };
946
- this._scrollToOffset = (offset, { adjustments, behavior }) => {
947
- this._intendedScrollOffset = offset + (adjustments ?? 0);
948
- this.options.scrollToFn(offset, {
949
- behavior,
950
- adjustments
951
- }, this);
952
- };
953
- this.measure = () => {
954
- this.pendingMin = null;
955
- this.itemSizeCache.clear();
956
- this.laneAssignments.clear();
957
- this.itemSizeCacheVersion++;
958
- this.notify(false);
959
- };
960
- this.setOptions(opts);
961
- }
962
- applyScrollAdjustment(delta, behavior) {
963
- if (delta === 0) return;
964
- if (process.env.NODE_ENV !== "production" && this.options.debug) console.info("correction", delta);
965
- if (isIOSWebKit() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded)) this._iosDeferredAdjustment += delta;
966
- else {
967
- this._scrollToOffset(this.getScrollOffset(), {
968
- adjustments: this.scrollAdjustments += delta,
969
- behavior
970
- });
971
- if (this.scrollOffset !== null) {
972
- this.scrollOffset += this.scrollAdjustments;
973
- this.scrollAdjustments = 0;
974
- }
975
- }
976
- }
977
- scheduleScrollReconcile() {
978
- if (!this.targetWindow) {
979
- this.scrollState = null;
980
- return;
981
- }
982
- if (this.rafId != null) return;
983
- this.rafId = this.targetWindow.requestAnimationFrame(() => {
984
- this.rafId = null;
985
- this.reconcileScroll();
986
- });
987
- }
988
- reconcileScroll() {
989
- if (!this.scrollState) return;
990
- if (!this.scrollElement) return;
991
- if (this.now() - this.scrollState.startedAt > 5e3) {
992
- this.scrollState = null;
993
- return;
994
- }
995
- const offsetInfo = this.scrollState.index != null ? this.getOffsetForIndex(this.scrollState.index, this.scrollState.align) : void 0;
996
- const targetOffset = offsetInfo ? offsetInfo[0] : this.scrollState.lastTargetOffset;
997
- const STABLE_FRAMES = 1;
998
- const targetChanged = targetOffset !== this.scrollState.lastTargetOffset;
999
- if (!targetChanged && approxEqual(targetOffset, this.getScrollOffset())) {
1000
- this.scrollState.stableFrames++;
1001
- if (this.scrollState.stableFrames >= STABLE_FRAMES) {
1002
- if (this.getScrollOffset() !== targetOffset) this._scrollToOffset(targetOffset, {
1003
- adjustments: void 0,
1004
- behavior: "auto"
1005
- });
1006
- this.scrollState = null;
1007
- return;
1008
- }
1009
- } else {
1010
- this.scrollState.stableFrames = 0;
1011
- if (targetChanged) {
1012
- const viewport = this.getSize() || 600;
1013
- const distance = Math.abs(targetOffset - this.getScrollOffset());
1014
- const keepSmooth = this.scrollState.behavior === "smooth" && distance > viewport;
1015
- this.scrollState.lastTargetOffset = targetOffset;
1016
- if (!keepSmooth) this.scrollState.behavior = "auto";
1017
- this._scrollToOffset(targetOffset, {
1018
- adjustments: void 0,
1019
- behavior: keepSmooth ? "smooth" : "auto"
1020
- });
1021
- }
1022
- }
1023
- this.scheduleScrollReconcile();
1024
- }
1025
- };
1026
- var findNearestBinarySearch = (low, high, getCurrentValue, value) => {
1027
- while (low <= high) {
1028
- const middle = (low + high) / 2 | 0;
1029
- const currentValue = getCurrentValue(middle);
1030
- if (currentValue < value) low = middle + 1;
1031
- else if (currentValue > value) high = middle - 1;
1032
- else return middle;
1033
- }
1034
- if (low > 0) return low - 1;
1035
- else return 0;
1036
- };
1037
- function findNearestBinarySearchFlat(flat, high, value) {
1038
- let low = 0;
1039
- while (low <= high) {
1040
- const middle = (low + high) / 2 | 0;
1041
- const currentValue = flat[middle * 2];
1042
- if (currentValue < value) low = middle + 1;
1043
- else if (currentValue > value) high = middle - 1;
1044
- else return middle;
1045
- }
1046
- return low > 0 ? low - 1 : 0;
1047
- }
1048
- function calculateRangeImpl(measurements, outerSize, scrollOffset, lanes, flat) {
1049
- const lastIndex = measurements.length - 1;
1050
- if (measurements.length <= lanes) return {
1051
- startIndex: 0,
1052
- endIndex: lastIndex
1053
- };
1054
- if (lanes === 1 && flat !== null) {
1055
- const startIndex2 = findNearestBinarySearchFlat(flat, lastIndex, scrollOffset);
1056
- let endIndex2 = startIndex2;
1057
- const limit = scrollOffset + outerSize;
1058
- while (endIndex2 < lastIndex && flat[endIndex2 * 2] + flat[endIndex2 * 2 + 1] < limit) endIndex2++;
1059
- return {
1060
- startIndex: startIndex2,
1061
- endIndex: endIndex2
1062
- };
1063
- }
1064
- const getStart = (index) => measurements[index].start;
1065
- let startIndex = findNearestBinarySearch(0, lastIndex, getStart, scrollOffset);
1066
- let endIndex = startIndex;
1067
- if (lanes === 1) while (endIndex < lastIndex && measurements[endIndex].end < scrollOffset + outerSize) endIndex++;
1068
- else if (lanes > 1) {
1069
- const endPerLane = Array(lanes).fill(0);
1070
- while (endIndex < lastIndex && endPerLane.some((pos) => pos < scrollOffset + outerSize)) {
1071
- const item = measurements[endIndex];
1072
- endPerLane[item.lane] = item.end;
1073
- endIndex++;
1074
- }
1075
- const startPerLane = Array(lanes).fill(scrollOffset + outerSize);
1076
- while (startIndex >= 0 && startPerLane.some((pos) => pos >= scrollOffset)) {
1077
- const item = measurements[startIndex];
1078
- startPerLane[item.lane] = item.start;
1079
- startIndex--;
1080
- }
1081
- startIndex = Math.max(0, startIndex - startIndex % lanes);
1082
- endIndex = Math.min(lastIndex, endIndex + (lanes - 1 - endIndex % lanes));
1083
- }
1084
- return {
1085
- startIndex,
1086
- endIndex
1087
- };
1088
- }
1089
- //#endregion
1090
- //#region ../../node_modules/.pnpm/@tanstack+react-virtual@3.14.6_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@tanstack/react-virtual/dist/esm/index.js
1091
- var useIsomorphicLayoutEffect = typeof document !== "undefined" ? import_react.useLayoutEffect : import_react.useEffect;
1092
- function useVirtualizerBase({ useFlushSync = true, directDomUpdates = false, directDomUpdatesMode = "transform", ...options }) {
1093
- const rerender = import_react.useReducer((x) => x + 1, 0)[1];
1094
- const directRef = import_react.useRef({
1095
- enabled: directDomUpdates,
1096
- mode: directDomUpdatesMode,
1097
- container: null,
1098
- lastSize: null,
1099
- lastPositions: /* @__PURE__ */ new WeakMap(),
1100
- prevRange: null
1101
- });
1102
- directRef.current.enabled = directDomUpdates;
1103
- directRef.current.mode = directDomUpdatesMode;
1104
- const applyDirectStyles = (instance2) => {
1105
- const state = directRef.current;
1106
- if (!state.enabled || !state.container) return;
1107
- const totalSize = instance2.getTotalSize();
1108
- if (totalSize !== state.lastSize) {
1109
- state.lastSize = totalSize;
1110
- const sizeAxis = instance2.options.horizontal ? "width" : "height";
1111
- state.container.style[sizeAxis] = `${totalSize}px`;
1112
- }
1113
- const horizontal = !!instance2.options.horizontal;
1114
- const useTransform = state.mode === "transform";
1115
- const posAxis = horizontal ? "left" : "top";
1116
- const scrollMargin = instance2.options.scrollMargin;
1117
- const items = instance2.getVirtualItems();
1118
- for (const item of items) {
1119
- const next = item.start - scrollMargin;
1120
- const el = instance2.elementsCache.get(item.key);
1121
- if (!el) continue;
1122
- if (state.lastPositions.get(el) === next) continue;
1123
- state.lastPositions.set(el, next);
1124
- if (useTransform) el.style.transform = horizontal ? `translate3d(${next}px, 0, 0)` : `translate3d(0, ${next}px, 0)`;
1125
- else el.style[posAxis] = `${next}px`;
1126
- }
1127
- };
1128
- const resolvedOptions = {
1129
- ...options,
1130
- onChange: (instance2, sync) => {
1131
- var _a;
1132
- const state = directRef.current;
1133
- let shouldRerender = true;
1134
- if (state.enabled) {
1135
- applyDirectStyles(instance2);
1136
- const range = instance2.range;
1137
- const prev = state.prevRange;
1138
- shouldRerender = !prev || prev.isScrolling !== instance2.isScrolling || prev.startIndex !== (range == null ? void 0 : range.startIndex) || prev.endIndex !== (range == null ? void 0 : range.endIndex);
1139
- if (shouldRerender) state.prevRange = range ? {
1140
- startIndex: range.startIndex,
1141
- endIndex: range.endIndex,
1142
- isScrolling: instance2.isScrolling
1143
- } : null;
1144
- }
1145
- if (shouldRerender) if (useFlushSync && sync) (0, import_react_dom.flushSync)(rerender);
1146
- else rerender();
1147
- (_a = options.onChange) == null || _a.call(options, instance2, sync);
1148
- }
1149
- };
1150
- const [instance] = import_react.useState(() => {
1151
- const v = new Virtualizer(resolvedOptions);
1152
- return Object.assign(v, { containerRef: (node) => {
1153
- const state = directRef.current;
1154
- state.container = node;
1155
- state.lastSize = null;
1156
- if (node && state.enabled) {
1157
- const total = v.getTotalSize();
1158
- state.lastSize = total;
1159
- const axis = v.options.horizontal ? "width" : "height";
1160
- node.style[axis] = `${total}px`;
1161
- }
1162
- } });
1163
- });
1164
- instance.setOptions(resolvedOptions);
1165
- useIsomorphicLayoutEffect(() => {
1166
- return instance._didMount();
1167
- }, []);
1168
- useIsomorphicLayoutEffect(() => {
1169
- return instance._willUpdate();
1170
- });
1171
- useIsomorphicLayoutEffect(() => {
1172
- applyDirectStyles(instance);
1173
- });
1174
- return instance;
1175
- }
1176
- function useVirtualizer(options) {
1177
- return useVirtualizerBase({
1178
- observeElementRect,
1179
- observeElementOffset,
1180
- scrollToFn: elementScroll,
1181
- ...options
1182
- });
1183
- }
1184
- //#endregion
1185
- //#region src/components/qgrid/MonitConsole.tsx
1186
- var import_jsx_runtime = require_jsx_runtime();
1187
- var POLL_INTERVAL_MS = 1e3;
1188
- var STALE_AFTER_MS = 5e3;
1189
- var MIRROR_CAP = 4e3;
1190
- var LEVEL_RANK = new Map(Object.entries({
1191
- trace: 0,
1192
- debug: 1,
1193
- info: 2,
1194
- warning: 3,
1195
- error: 4,
1196
- fatal: 5
1197
- }));
1198
- var LEVEL_LABEL = new Map(Object.entries({
1199
- trace: "TRC",
1200
- debug: "DBG",
1201
- info: "INF",
1202
- warning: "WRN",
1203
- error: "ERR",
1204
- fatal: "FTL"
1205
- }));
1206
- var TIME_FORMATTER = new Intl.DateTimeFormat("en-GB", {
1207
- hour: "2-digit",
1208
- minute: "2-digit",
1209
- second: "2-digit",
1210
- hour12: false
1211
- });
1212
- function formatTime(epochMs) {
1213
- return TIME_FORMATTER.format(new Date(epochMs));
1214
- }
1215
- function categoryLabel(category) {
1216
- return category.join("·");
1217
- }
1218
- var SPARK_CAP = 120;
1219
- function pushSample(buffer, value) {
1220
- buffer.push(value);
1221
- if (buffer.length > SPARK_CAP) buffer.shift();
1222
- }
1223
- var SPARK_WIDTH = 56;
1224
- var SPARK_HEIGHT = 14;
1225
- function Sparkline({ values }) {
1226
- if (values.length < 2) return null;
1227
- const width = SPARK_WIDTH;
1228
- const height = SPARK_HEIGHT;
1229
- const max = Math.max(...values, 1);
1230
- const step = width / (SPARK_CAP - 1);
1231
- const startX = width - (values.length - 1) * step;
1232
- const points = values.map((v, i) => {
1233
- const x = startX + i * step;
1234
- const y = height - 1 - v / max * (height - 2);
1235
- return `${x.toFixed(1)},${y.toFixed(1)}`;
1236
- }).join(" ");
1237
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
1238
- width,
1239
- height,
1240
- viewBox: `0 0 ${width} ${height}`,
1241
- className: "shrink-0",
1242
- "aria-hidden": "true",
1243
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("polyline", {
1244
- points,
1245
- fill: "none",
1246
- stroke: "currentColor",
1247
- strokeWidth: "1.5",
1248
- strokeLinejoin: "round",
1249
- strokeLinecap: "round",
1250
- className: "text-sand-300"
1251
- })
1252
- });
1253
- }
1254
- function QuotaGauge({ usedPercent, threshold, blocked }) {
1255
- if (usedPercent === null) return null;
1256
- const clamped = Math.max(0, Math.min(usedPercent, 100));
1257
- const over = blocked || threshold !== null && usedPercent >= threshold;
1258
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1259
- className: "inline-flex items-center gap-1",
1260
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1261
- className: "relative inline-block h-[4px] w-9 overflow-hidden rounded-full bg-sand-100",
1262
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1263
- className: clsx("absolute inset-y-0 left-0 rounded-full", over ? "bg-caution-500" : "bg-sand-400"),
1264
- style: { width: `${clamped}%` }
1265
- }), threshold !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1266
- className: "absolute inset-y-0 w-px bg-sand-500",
1267
- style: { left: `${Math.min(threshold, 100)}%` }
1268
- })]
1269
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1270
- className: clsx("font-mono text-[10px] tabular-nums", over ? "font-semibold text-caution-500" : "text-sand-500"),
1271
- children: [Math.round(usedPercent), "%"]
1272
- })]
1273
- });
1274
- }
1275
- function MonitConsole({ search, onSearchChange }) {
1276
- const [items, setItems] = (0, import_react.useState)([]);
1277
- const cursorRef = (0, import_react.useRef)(void 0);
1278
- const epochRef = (0, import_react.useRef)(void 0);
1279
- const keyRef = (0, import_react.useRef)(0);
1280
- const [clock, setClock] = (0, import_react.useState)(() => Date.now());
1281
- const query = useQuery({
1282
- queryKey: ["Monit", "monitLogs"],
1283
- queryFn: () => MonitService.monitLogs(cursorRef.current),
1284
- refetchInterval: POLL_INTERVAL_MS,
1285
- retry: false
1286
- });
1287
- const info = useQuery({
1288
- ...MonitService.monitInfoQueryOptions(),
1289
- staleTime: Infinity
1290
- }).data;
1291
- const vitals = query.data?.vitals;
1292
- const stats = useQuery({
1293
- ...MonitService.monitStatsQueryOptions(),
1294
- refetchInterval: 3e4,
1295
- retry: false
1296
- }).data;
1297
- const inFlightSparkRef = (0, import_react.useRef)([]);
1298
- (0, import_react.useEffect)(() => {
1299
- if (!vitals) return;
1300
- pushSample(inFlightSparkRef.current, vitals.openaiInFlight);
1301
- }, [vitals]);
1302
- (0, import_react.useEffect)(() => {
1303
- const chunk = query.data;
1304
- if (!chunk) return;
1305
- applyChunk(chunk);
1306
- }, [query.data]);
1307
- function applyChunk(chunk) {
1308
- const nextKey = () => ++keyRef.current;
1309
- setItems((prev) => {
1310
- let base = prev;
1311
- const appended = [];
1312
- if (epochRef.current !== void 0 && chunk.processStartedAt !== epochRef.current) {
1313
- base = [];
1314
- appended.push({
1315
- kind: "restart",
1316
- key: nextKey(),
1317
- processStartedAt: chunk.processStartedAt
1318
- });
1319
- } else if (chunk.dropped > 0) appended.push({
1320
- kind: "dropped",
1321
- key: nextKey(),
1322
- count: chunk.dropped
1323
- });
1324
- epochRef.current = chunk.processStartedAt;
1325
- cursorRef.current = chunk.nextCursor;
1326
- const lastSeq = base.findLast((item) => item.kind === "log")?.entry.seq;
1327
- for (const entry of chunk.entries) {
1328
- if (lastSeq !== void 0 && entry.seq <= lastSeq) continue;
1329
- appended.push({
1330
- kind: "log",
1331
- key: nextKey(),
1332
- entry
1333
- });
1334
- }
1335
- if (appended.length === 0) return prev;
1336
- const next = [...base, ...appended];
1337
- return next.length > MIRROR_CAP ? next.slice(-MIRROR_CAP) : next;
1338
- });
1339
- }
1340
- (0, import_react.useEffect)(() => {
1341
- const timer = window.setInterval(() => setClock(Date.now()), 2e3);
1342
- return () => window.clearInterval(timer);
1343
- }, []);
1344
- const isStale = items.length > 0 && (query.isRefetchError || query.dataUpdatedAt > 0 && clock - query.dataUpdatedAt > STALE_AFTER_MS);
1345
- const visible = (0, import_react.useMemo)(() => {
1346
- return items.filter((item) => {
1347
- if (item.kind !== "log") return true;
1348
- switch (search.level) {
1349
- case "warn": return (LEVEL_RANK.get(item.entry.level) ?? 2) >= 3;
1350
- case "error": return (LEVEL_RANK.get(item.entry.level) ?? 2) >= 4;
1351
- default: return true;
1352
- }
1353
- });
1354
- }, [items, search.level]);
1355
- const parentRef = (0, import_react.useRef)(null);
1356
- const virtualizer = useVirtualizer({
1357
- count: visible.length,
1358
- getScrollElement: () => parentRef.current,
1359
- estimateSize: () => 20,
1360
- getItemKey: (index) => visible[index].key,
1361
- anchorTo: "end",
1362
- followOnAppend: true,
1363
- scrollEndThreshold: 80,
1364
- overscan: 12
1365
- });
1366
- const atEnd = virtualizer.isAtEnd();
1367
- const hasFirstData = query.dataUpdatedAt > 0;
1368
- const firstLoadFailed = !hasFirstData && query.isError;
1369
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
1370
- className: "panel overflow-hidden",
1371
- children: [
1372
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", {
1373
- className: "panel-header flex min-h-11 flex-wrap items-center gap-x-3 gap-y-2 px-4 py-2 sm:px-5",
1374
- children: [
1375
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", {
1376
- className: "text-[13px] font-semibold tracking-[-0.01em] text-sand-800",
1377
- children: "Server logs"
1378
- }),
1379
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1380
- className: "inline-flex items-center gap-1.5 text-[11px] font-medium text-sand-700",
1381
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: clsx("size-1.5 rounded-full", isStale || firstLoadFailed ? "bg-danger-400" : "bg-sienna-500 motion-safe:animate-pulse") }), firstLoadFailed ? "Disconnected" : isStale ? "Stale" : hasFirstData ? "Live" : "…"]
1382
- }),
1383
- epochRef.current !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1384
- className: "text-[11px] text-sand-500",
1385
- children: ["ephemeral · resets on restart · since ", formatTime(epochRef.current)]
1386
- }),
1387
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1388
- className: "ml-auto flex flex-wrap items-center gap-2",
1389
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1390
- className: "segmented-control inline-flex",
1391
- role: "tablist",
1392
- "aria-label": "Log filter",
1393
- children: [
1394
- {
1395
- value: "all",
1396
- label: "All"
1397
- },
1398
- {
1399
- value: "warn",
1400
- label: "Warn+"
1401
- },
1402
- {
1403
- value: "error",
1404
- label: "Err+"
1405
- }
1406
- ].map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
1407
- type: "button",
1408
- "data-active": search.level === option.value,
1409
- onClick: () => onSearchChange({
1410
- ...search,
1411
- level: option.value
1412
- }),
1413
- 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",
1414
- children: option.label
1415
- }, option.value))
1416
- })
1417
- })
1418
- ]
1419
- }),
1420
- info && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1421
- 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",
1422
- children: [
1423
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: ["server ", /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1424
- className: "font-mono text-sand-800",
1425
- children: info.serverUrl
1426
- })] }),
1427
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
1428
- "db",
1429
- " ",
1430
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1431
- className: "font-mono text-sand-800",
1432
- children: [
1433
- info.dbHost,
1434
- "/",
1435
- info.dbName
1436
- ]
1437
- })
1438
- ] }),
1439
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
1440
- "openai transport",
1441
- " ",
1442
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1443
- className: "font-mono text-sand-800",
1444
- children: info.openai.transport
1445
- })
1446
- ] }),
1447
- vitals && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1448
- className: "inline-flex items-center gap-1.5",
1449
- children: [
1450
- "openai in-flight",
1451
- " ",
1452
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1453
- className: "font-mono text-sand-800",
1454
- children: vitals.openaiInFlight
1455
- }),
1456
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sparkline, { values: inFlightSparkRef.current })
1457
- ]
1458
- }), vitals.anthropicTokenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
1459
- "anthropic running",
1460
- " ",
1461
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1462
- className: "font-mono text-sand-800",
1463
- children: vitals.anthropicInFlight
1464
- })
1465
- ] })] }),
1466
- stats?.providers.map((p) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1467
- className: "text-sand-500",
1468
- children: [
1469
- "1h ",
1470
- p.provider,
1471
- " ",
1472
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1473
- className: "font-mono text-sand-700",
1474
- children: p.requests
1475
- }),
1476
- " req",
1477
- p.errors > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1478
- " · ",
1479
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1480
- className: "font-mono font-semibold text-caution-500",
1481
- children: p.errors
1482
- }),
1483
- " err"
1484
- ] }),
1485
- " · hit ",
1486
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1487
- className: "font-mono text-sand-700",
1488
- children: cacheHitRate({
1489
- input_tokens: p.inputTokens,
1490
- cache_read_tokens: p.cacheReadTokens
1491
- })
1492
- })
1493
- ]
1494
- }, p.provider))
1495
- ]
1496
- }),
1497
- vitals && (vitals.openaiQuotaByToken.length > 0 || vitals.anthropicTokenNames.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1498
- className: "space-y-1.5 border-b border-sand-100 px-4 py-2.5 sm:px-5",
1499
- children: [vitals.openaiQuotaByToken.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1500
- className: "flex flex-wrap items-center gap-2",
1501
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1502
- className: "w-[4.5rem] shrink-0 text-[10px] font-medium uppercase tracking-[0.08em] text-sand-400",
1503
- children: "openai"
1504
- }), vitals.openaiQuotaByToken.map((quota) => {
1505
- const quotaTitle = quota.usedPercent === null ? "quota not sampled yet" : `quota ${Math.round(quota.usedPercent)}%${quota.threshold !== null ? ` / threshold ${quota.threshold}%` : ""}${quota.resetsAt ? ` · resets ${formatTime(quota.resetsAt)}` : ""}`;
1506
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1507
- title: `${quota.name} · ${quotaTitle}`,
1508
- className: "inline-flex items-center gap-1.5 rounded-md border border-sand-200 bg-white px-2 py-1",
1509
- children: [
1510
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1511
- className: "font-mono text-[11px] text-sand-600",
1512
- children: quota.name.split("/").pop()
1513
- }),
1514
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QuotaGauge, {
1515
- usedPercent: quota.usedPercent,
1516
- threshold: quota.threshold,
1517
- blocked: quota.blocked
1518
- }),
1519
- quota.blocked && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1520
- className: "rounded-full bg-caution-500/10 px-1.5 py-0.5 text-[9px] font-semibold text-caution-500",
1521
- children: "quota"
1522
- })
1523
- ]
1524
- }, quota.name);
1525
- })]
1526
- }), vitals.anthropicTokenNames.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1527
- className: "flex flex-wrap items-center gap-2",
1528
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1529
- className: "w-[4.5rem] shrink-0 text-[10px] font-medium uppercase tracking-[0.08em] text-sand-400",
1530
- children: "anthropic"
1531
- }), vitals.anthropicTokenNames.map((name) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1532
- title: name,
1533
- className: "inline-flex items-baseline rounded-md border border-sand-200 bg-white px-2 py-1 font-mono text-[11px] text-sand-600",
1534
- children: name.split("/").pop()
1535
- }, name))]
1536
- })]
1537
- }),
1538
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1539
- className: "relative",
1540
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1541
- ref: parentRef,
1542
- role: "log",
1543
- "aria-label": "Server process logs",
1544
- tabIndex: 0,
1545
- 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",
1546
- children: firstLoadFailed ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1547
- className: "flex h-full flex-col items-center justify-center gap-3 text-sand-400",
1548
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
1549
- className: "text-[12px]",
1550
- children: ["Could not reach the qgrid server — is it running?", query.error instanceof Error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1551
- className: "block text-center text-[11px] text-sand-500",
1552
- children: query.error.message
1553
- })]
1554
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
1555
- type: "button",
1556
- onClick: () => void query.refetch(),
1557
- 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",
1558
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(lucideRefreshCw, { className: "size-3" }), "Retry now"]
1559
- })]
1560
- }) : !hasFirstData ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1561
- className: "flex h-full items-center justify-center text-[12px] text-sand-500",
1562
- children: "Connecting to server logs…"
1563
- }) : visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1564
- className: "flex h-full items-center justify-center text-[12px] text-sand-500",
1565
- children: items.length === 0 ? `No log lines yet — waiting for activity since ${epochRef.current !== void 0 ? formatTime(epochRef.current) : "startup"}.` : "No lines match the current filters."
1566
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1567
- className: "relative w-full",
1568
- style: { height: `${virtualizer.getTotalSize()}px` },
1569
- children: virtualizer.getVirtualItems().map((virtualRow) => {
1570
- const item = visible[virtualRow.index];
1571
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1572
- ref: virtualizer.measureElement,
1573
- "data-index": virtualRow.index,
1574
- className: "absolute left-0 top-0 w-full",
1575
- style: { transform: `translateY(${virtualRow.start}px)` },
1576
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LogLine, { item })
1577
- }, virtualRow.key);
1578
- })
1579
- })
1580
- }), hasFirstData && !firstLoadFailed && !atEnd && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
1581
- type: "button",
1582
- onClick: () => virtualizer.scrollToEnd(),
1583
- 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",
1584
- children: "↓ Jump to live"
1585
- })]
1586
- })
1587
- ]
1588
- });
1589
- }
1590
- function LogLine({ item }) {
1591
- if (item.kind === "restart") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1592
- className: "py-1 text-center text-[11px] text-caution-400",
1593
- children: [
1594
- "── process restarted · ",
1595
- formatTime(item.processStartedAt),
1596
- " ──"
1597
- ]
1598
- });
1599
- if (item.kind === "dropped") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1600
- className: "py-1 text-center text-[11px] italic text-sand-500",
1601
- children: [
1602
- "── ",
1603
- item.count,
1604
- " lines dropped (buffer overflow) ──"
1605
- ]
1606
- });
1607
- const { entry } = item;
1608
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1609
- className: "whitespace-pre-wrap break-words text-sand-200",
1610
- children: [
1611
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1612
- className: "text-sand-500",
1613
- children: formatTime(entry.timestamp)
1614
- }),
1615
- " ",
1616
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1617
- className: clsx("font-semibold", entry.level === "fatal" || entry.level === "error" ? "text-danger-400" : entry.level === "warning" ? "text-caution-400" : "text-sand-400"),
1618
- children: LEVEL_LABEL.get(entry.level) ?? entry.level.slice(0, 3).toUpperCase()
1619
- }),
1620
- " ",
1621
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1622
- className: "text-sienna-300",
1623
- children: categoryLabel(entry.category)
1624
- }),
1625
- " ",
1626
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: entry.text })
1627
- ]
1628
- });
1629
- }
1630
- //#endregion
1631
- //#region src/routes/monit.tsx?tsr-split=component
1632
- object({ level: _enum([
1633
- "all",
1634
- "warn",
1635
- "error"
1636
- ]).optional().default("all").catch(() => "all") });
1637
- function MonitPage() {
1638
- const search = Route.useSearch();
1639
- const navigate = Route.useNavigate();
1640
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1641
- className: "max-w-[100rem] mx-auto",
1642
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MonitConsole, {
1643
- search,
1644
- onSearchChange: (next) => navigate({
1645
- search: next,
1646
- replace: true
1647
- })
1648
- })
1649
- });
1650
- }
1651
- //#endregion
1652
- export { MonitPage as component };