@synnaxlabs/pluto 0.40.1 → 0.42.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 (569) hide show
  1. package/dist/{Center-CFEPOi_x.js → Center-CNcAEDgS.js} +3 -3
  2. package/dist/Center-Map6aflE.cjs +1 -0
  3. package/dist/ContextMenu-DmRPxhnI.cjs +1 -0
  4. package/dist/ContextMenu-fLU0wr9S.js +95 -0
  5. package/dist/DateTime-CP3OmEGY.cjs +1 -0
  6. package/dist/{DateTime-Djw6pb3W.js → DateTime-CWAcEwXO.js} +2 -2
  7. package/dist/{Divider-CMyzWvRC.js → Divider-BTLn5ucU.js} +597 -512
  8. package/dist/Divider-Dvb6dsgX.cjs +22 -0
  9. package/dist/Dropdown-CaGzfZRa.cjs +1 -0
  10. package/dist/Dropdown-nw8kRSbl.js +327 -0
  11. package/dist/Haul-B8zGWk0I.cjs +1 -0
  12. package/dist/{Haul-CaLW9ULm.js → Haul-Cnuzk7Z-.js} +34 -35
  13. package/dist/Item-BzrQqxRC.cjs +1 -0
  14. package/dist/Item-FmwC-twg.js +109 -0
  15. package/dist/Keyboard-BfvjkBgh.cjs +1 -0
  16. package/dist/{Keyboard--YA9DHRz.js → Keyboard-Cevv7vrQ.js} +11 -9
  17. package/dist/{Link-Bhto2KVL.cjs → Link-DI7BZ5dL.cjs} +1 -1
  18. package/dist/{Link-BT_Kwmlr.js → Link-Dljdu4e9.js} +1 -1
  19. package/dist/Pack-lJqoOmHx.cjs +1 -0
  20. package/dist/Pack-to0DG2iP.js +48 -0
  21. package/dist/Provider-BlM1x1cF.cjs +1 -0
  22. package/dist/Provider-C_B463cg.js +461 -0
  23. package/dist/Space-C2oZDkE1.js +100 -0
  24. package/dist/Space-DfcVsxz8.cjs +1 -0
  25. package/dist/Text-BXADoWYY.js +137 -0
  26. package/dist/Text-BiYpGaEZ.js +35 -0
  27. package/dist/Text-BjHlLKsp.cjs +1 -0
  28. package/dist/{Text-B7AC8Z1e.js → Text-CWiPrDI1.js} +320 -308
  29. package/dist/Text-DrIBbnml.cjs +1 -0
  30. package/dist/Text-ZJqK1cI3.cjs +4 -0
  31. package/dist/Toggle-CeUVv58o.js +377 -0
  32. package/dist/Toggle-CfwYy9fe.cjs +1 -0
  33. package/dist/{Video-TjJf_tXI.js → Video-BZ1XTEez.js} +1 -1
  34. package/dist/{Video-hdvNT3La.cjs → Video-C7YoF37-.cjs} +1 -1
  35. package/dist/WithIcon-DG7VJxsE.cjs +1 -0
  36. package/dist/WithIcon-pBZ7H9Lq.js +98 -0
  37. package/dist/align.cjs +1 -1
  38. package/dist/align.js +1 -1
  39. package/dist/button.cjs +1 -1
  40. package/dist/button.js +1 -1
  41. package/dist/color.cjs +1 -1
  42. package/dist/color.js +1 -1
  43. package/dist/css-B7c7_G5h.js +4746 -0
  44. package/dist/css-hg3QdDDt.cjs +15 -0
  45. package/dist/css.cjs +1 -1
  46. package/dist/css.js +2 -2
  47. package/dist/deep-B1etRzze.cjs +1 -0
  48. package/dist/deep-BytImVW-.js +102 -0
  49. package/dist/dimensions-Cz-q0Mok.cjs +1 -0
  50. package/dist/dimensions-DcjW7X3n.js +19 -0
  51. package/dist/dropdown.cjs +1 -1
  52. package/dist/dropdown.js +1 -1
  53. package/dist/eraser-BOx6Xhwn.cjs +11 -0
  54. package/dist/eraser-Bsb4kKS3.js +1148 -0
  55. package/dist/ether.cjs +1 -1
  56. package/dist/ether.js +68 -75
  57. package/dist/{external-DTjOTICM.js → external-1KJXZcr9.js} +2 -2
  58. package/dist/{external-dLVcM8tt.cjs → external-BHHC7TQ_.cjs} +1 -1
  59. package/dist/external-BLEs2AYM.cjs +46 -0
  60. package/dist/external-BdVuZd3H.cjs +1 -0
  61. package/dist/external-BiBhgCdz.cjs +1 -0
  62. package/dist/external-C75Z9Zbn.cjs +1 -0
  63. package/dist/external-CEfSeJMr.js +432 -0
  64. package/dist/external-CLTPcWrI.cjs +1 -0
  65. package/dist/{external-C3e9emVy.js → external-CRNR1bD0.js} +29 -28
  66. package/dist/{external-D_21zZAf.cjs → external-Cfj1plcw.cjs} +1 -1
  67. package/dist/{external-B9nbHICv.js → external-Ck1rVwUu.js} +3263 -3285
  68. package/dist/external-Cni9ftkW.cjs +1 -0
  69. package/dist/external-DCcp3sQD.js +28 -0
  70. package/dist/{external-Cs8oKwvw.cjs → external-DCfs7IFi.cjs} +1 -1
  71. package/dist/external-DDD_nc3x.js +400 -0
  72. package/dist/external-DNT-gmZx.cjs +1 -0
  73. package/dist/{external-CcIx4j5m.js → external-DeCeUbqe.js} +18 -17
  74. package/dist/{external-DCflyFdb.js → external-DgSaeiBz.js} +3 -3
  75. package/dist/{external-ClyfPgqG.cjs → external-DhfASB4W.cjs} +37 -37
  76. package/dist/{external-upiAayc4.js → external-bkwgRzLc.js} +29 -29
  77. package/dist/{external-_b4lTCfZ.js → external-hgzjVlDR.js} +2171 -2184
  78. package/dist/external-pUEPQrp_.cjs +1 -0
  79. package/dist/{external-D12g_huj.js → external-qwaFowDe.js} +14 -14
  80. package/dist/{external-JNlv7kxI.js → external-sUHGRdqd.js} +2 -2
  81. package/dist/{font-Bas26Jn-.cjs → font-BFTKtIQk.cjs} +1 -1
  82. package/dist/{font-CcRdsA3n.js → font-Crn-D_ua.js} +2 -2
  83. package/dist/fontString-DQLaRHQV.cjs +1 -0
  84. package/dist/fontString-DjnDxFrE.js +28 -0
  85. package/dist/header.cjs +1 -1
  86. package/dist/header.js +1 -1
  87. package/dist/hooks-CM9HWxYc.js +296 -0
  88. package/dist/hooks-CTKCi-OE.cjs +1 -0
  89. package/dist/index.cjs +7 -7
  90. package/dist/index.js +10618 -9594
  91. package/dist/input.cjs +1 -1
  92. package/dist/input.js +1 -1
  93. package/dist/list.cjs +1 -1
  94. package/dist/list.js +1 -1
  95. package/dist/menu.cjs +1 -1
  96. package/dist/menu.js +1 -1
  97. package/dist/pluto.css +1 -1
  98. package/dist/provider-BDFfcHVT.js +12851 -0
  99. package/dist/provider-XPRFhwnl.cjs +58 -0
  100. package/dist/src/aether/aether/aether.d.ts +17 -18
  101. package/dist/src/aether/aether/aether.d.ts.map +1 -1
  102. package/dist/src/aether/aether/aether.spec.spec.d.ts +1 -5
  103. package/dist/src/aether/aether/aether.spec.spec.d.ts.map +1 -1
  104. package/dist/src/aether/main.d.ts +48 -0
  105. package/dist/src/aether/main.d.ts.map +1 -1
  106. package/dist/src/aether/main.spec.d.ts +1 -5
  107. package/dist/src/aether/main.spec.d.ts.map +1 -1
  108. package/dist/src/aether/message.d.ts +11 -1
  109. package/dist/src/aether/message.d.ts.map +1 -1
  110. package/dist/src/alamos/aether/alamos.d.ts +19 -25
  111. package/dist/src/alamos/aether/alamos.d.ts.map +1 -1
  112. package/dist/src/align/Center.d.ts +2 -2
  113. package/dist/src/align/Center.d.ts.map +1 -1
  114. package/dist/src/align/Pack.d.ts +3 -3
  115. package/dist/src/align/Pack.d.ts.map +1 -1
  116. package/dist/src/align/Space.d.ts +25 -10
  117. package/dist/src/align/Space.d.ts.map +1 -1
  118. package/dist/src/align/Stack.d.ts +7 -0
  119. package/dist/src/align/Stack.d.ts.map +1 -0
  120. package/dist/src/align/external.d.ts +1 -0
  121. package/dist/src/align/external.d.ts.map +1 -1
  122. package/dist/src/breadcrumb/Breadcrumb.d.ts +2 -2
  123. package/dist/src/breadcrumb/Breadcrumb.d.ts.map +1 -1
  124. package/dist/src/button/Button.d.ts +4 -6
  125. package/dist/src/button/Button.d.ts.map +1 -1
  126. package/dist/src/button/Icon.d.ts +4 -1
  127. package/dist/src/button/Icon.d.ts.map +1 -1
  128. package/dist/src/button/Toggle.d.ts +0 -1
  129. package/dist/src/button/Toggle.d.ts.map +1 -1
  130. package/dist/src/button/color.d.ts +2 -2
  131. package/dist/src/button/color.d.ts.map +1 -1
  132. package/dist/src/caret/Animated.d.ts +3 -2
  133. package/dist/src/caret/Animated.d.ts.map +1 -1
  134. package/dist/src/channel/LinePlot.d.ts +5 -5
  135. package/dist/src/channel/LinePlot.d.ts.map +1 -1
  136. package/dist/src/channel/Select.d.ts +3 -3
  137. package/dist/src/channel/Select.d.ts.map +1 -1
  138. package/dist/src/color/BaseSwatch.d.ts +3 -3
  139. package/dist/src/color/BaseSwatch.d.ts.map +1 -1
  140. package/dist/src/color/GradientPicker.d.ts +1 -2
  141. package/dist/src/color/GradientPicker.d.ts.map +1 -1
  142. package/dist/src/color/Picker.d.ts +1 -1
  143. package/dist/src/color/Picker.d.ts.map +1 -1
  144. package/dist/src/color/Provider.d.ts +8 -100
  145. package/dist/src/color/Provider.d.ts.map +1 -1
  146. package/dist/src/color/external.d.ts +0 -4
  147. package/dist/src/color/external.d.ts.map +1 -1
  148. package/dist/src/css/color.d.ts +2 -2
  149. package/dist/src/css/color.d.ts.map +1 -1
  150. package/dist/src/css/css.d.ts +2 -1
  151. package/dist/src/css/css.d.ts.map +1 -1
  152. package/dist/src/divider/Divider.d.ts +6 -5
  153. package/dist/src/divider/Divider.d.ts.map +1 -1
  154. package/dist/src/dropdown/Dropdown.d.ts +2 -1
  155. package/dist/src/dropdown/Dropdown.d.ts.map +1 -1
  156. package/dist/src/ether.d.ts +0 -1
  157. package/dist/src/ether.d.ts.map +1 -1
  158. package/dist/src/form/Form.d.ts +1 -1
  159. package/dist/src/form/Form.d.ts.map +1 -1
  160. package/dist/src/generic/Generic.d.ts +4 -5
  161. package/dist/src/generic/Generic.d.ts.map +1 -1
  162. package/dist/src/hardware/device/Select.d.ts.map +1 -1
  163. package/dist/src/haul/Haul.d.ts +7 -63
  164. package/dist/src/haul/Haul.d.ts.map +1 -1
  165. package/dist/src/hooks/useResize.d.ts.map +1 -1
  166. package/dist/src/icon/Icon.d.ts.map +1 -1
  167. package/dist/src/index.d.ts +1 -0
  168. package/dist/src/index.d.ts.map +1 -1
  169. package/dist/src/input/DateTime.d.ts.map +1 -1
  170. package/dist/src/input/Item.d.ts +1 -1
  171. package/dist/src/input/Item.d.ts.map +1 -1
  172. package/dist/src/input/Text.d.ts +4 -4
  173. package/dist/src/input/Text.d.ts.map +1 -1
  174. package/dist/src/input/types.d.ts +0 -1
  175. package/dist/src/input/types.d.ts.map +1 -1
  176. package/dist/src/list/Column.d.ts +3 -3
  177. package/dist/src/list/Column.d.ts.map +1 -1
  178. package/dist/src/list/Core.d.ts +1 -1
  179. package/dist/src/list/Core.d.ts.map +1 -1
  180. package/dist/src/list/Hover.d.ts +3 -2
  181. package/dist/src/list/Hover.d.ts.map +1 -1
  182. package/dist/src/list/Item.d.ts +1 -1
  183. package/dist/src/list/Item.d.ts.map +1 -1
  184. package/dist/src/main.d.ts.map +1 -1
  185. package/dist/src/menu/ContextMenu.d.ts +5 -3
  186. package/dist/src/menu/ContextMenu.d.ts.map +1 -1
  187. package/dist/src/menu/Item.d.ts.map +1 -1
  188. package/dist/src/menu/Menu.d.ts +3 -2
  189. package/dist/src/menu/Menu.d.ts.map +1 -1
  190. package/dist/src/modal/Modal.d.ts +7 -3
  191. package/dist/src/modal/Modal.d.ts.map +1 -1
  192. package/dist/src/mosaic/Mosaic.d.ts +5 -3
  193. package/dist/src/mosaic/Mosaic.d.ts.map +1 -1
  194. package/dist/src/mosaic/tree.d.ts +4 -3
  195. package/dist/src/mosaic/tree.d.ts.map +1 -1
  196. package/dist/src/mosaic/types.d.ts +6 -66
  197. package/dist/src/mosaic/types.d.ts.map +1 -1
  198. package/dist/src/nav/Bar.d.ts +2 -1
  199. package/dist/src/nav/Bar.d.ts.map +1 -1
  200. package/dist/src/nav/Drawer.d.ts +3 -2
  201. package/dist/src/nav/Drawer.d.ts.map +1 -1
  202. package/dist/src/notation/Select.d.ts +2 -3
  203. package/dist/src/notation/Select.d.ts.map +1 -1
  204. package/dist/src/notation/index.d.ts +1 -1
  205. package/dist/src/notation/index.d.ts.map +1 -1
  206. package/dist/src/os/Controls/Windows.d.ts +1 -1
  207. package/dist/src/os/Controls/Windows.d.ts.map +1 -1
  208. package/dist/src/os/Controls/types.d.ts +2 -0
  209. package/dist/src/os/Controls/types.d.ts.map +1 -1
  210. package/dist/src/pluto/Pluto.d.ts.map +1 -1
  211. package/dist/src/pluto/aether/pluto.d.ts.map +1 -1
  212. package/dist/src/ranger/TimeRangeChip.d.ts +2 -1
  213. package/dist/src/ranger/TimeRangeChip.d.ts.map +1 -1
  214. package/dist/src/resize/Core.d.ts +5 -4
  215. package/dist/src/resize/Core.d.ts.map +1 -1
  216. package/dist/src/resize/Multiple.d.ts.map +1 -1
  217. package/dist/src/resize/Single.d.ts.map +1 -1
  218. package/dist/src/select/Button.d.ts.map +1 -1
  219. package/dist/src/select/List.d.ts.map +1 -1
  220. package/dist/src/select/Multiple.d.ts +2 -3
  221. package/dist/src/select/Multiple.d.ts.map +1 -1
  222. package/dist/src/state/state.d.ts +1 -2
  223. package/dist/src/state/state.d.ts.map +1 -1
  224. package/dist/src/status/Circle.d.ts.map +1 -1
  225. package/dist/src/status/Notification.d.ts.map +1 -1
  226. package/dist/src/status/aether/aggregator.d.ts +34 -96
  227. package/dist/src/status/aether/aggregator.d.ts.map +1 -1
  228. package/dist/src/status/aether/types.d.ts +23 -27
  229. package/dist/src/status/aether/types.d.ts.map +1 -1
  230. package/dist/src/status/colors.d.ts +1 -1
  231. package/dist/src/status/colors.d.ts.map +1 -1
  232. package/dist/src/synnax/Provider.d.ts +4 -0
  233. package/dist/src/synnax/Provider.d.ts.map +1 -1
  234. package/dist/src/synnax/aether/provider.d.ts +54 -388
  235. package/dist/src/synnax/aether/provider.d.ts.map +1 -1
  236. package/dist/src/table/aether/Table.d.ts +58 -418
  237. package/dist/src/table/aether/Table.d.ts.map +1 -1
  238. package/dist/src/table/cells/Cells.d.ts +38 -153
  239. package/dist/src/table/cells/Cells.d.ts.map +1 -1
  240. package/dist/src/table/cells/Forms.d.ts.map +1 -1
  241. package/dist/src/table/cells/registry.d.ts +6 -3
  242. package/dist/src/table/cells/registry.d.ts.map +1 -1
  243. package/dist/src/tabs/Selector.d.ts +5 -2
  244. package/dist/src/tabs/Selector.d.ts.map +1 -1
  245. package/dist/src/tabs/Tabs.d.ts +2 -3
  246. package/dist/src/tabs/Tabs.d.ts.map +1 -1
  247. package/dist/src/tabs/types.d.ts +5 -38
  248. package/dist/src/tabs/types.d.ts.map +1 -1
  249. package/dist/src/tag/Tag.d.ts +3 -4
  250. package/dist/src/tag/Tag.d.ts.map +1 -1
  251. package/dist/src/telem/aether/context.d.ts +8 -8
  252. package/dist/src/telem/aether/context.d.ts.map +1 -1
  253. package/dist/src/telem/aether/factory.d.ts +6 -2
  254. package/dist/src/telem/aether/factory.d.ts.map +1 -1
  255. package/dist/src/telem/aether/noop.d.ts.map +1 -1
  256. package/dist/src/telem/aether/pipeline.d.ts +25 -215
  257. package/dist/src/telem/aether/pipeline.d.ts.map +1 -1
  258. package/dist/src/telem/aether/provider.d.ts +7 -5
  259. package/dist/src/telem/aether/provider.d.ts.map +1 -1
  260. package/dist/src/telem/aether/remote.d.ts +62 -183
  261. package/dist/src/telem/aether/remote.d.ts.map +1 -1
  262. package/dist/src/telem/aether/static.d.ts +21 -74
  263. package/dist/src/telem/aether/static.d.ts.map +1 -1
  264. package/dist/src/telem/aether/telem.d.ts +60 -284
  265. package/dist/src/telem/aether/telem.d.ts.map +1 -1
  266. package/dist/src/telem/aether/transformers.d.ts +79 -321
  267. package/dist/src/telem/aether/transformers.d.ts.map +1 -1
  268. package/dist/src/telem/client/cache/cache.d.ts +1 -1
  269. package/dist/src/telem/client/cache/cache.d.ts.map +1 -1
  270. package/dist/src/telem/client/cache/dynamic.d.ts +5 -5
  271. package/dist/src/telem/client/cache/dynamic.d.ts.map +1 -1
  272. package/dist/src/telem/client/cache/static.d.ts +3 -3
  273. package/dist/src/telem/client/cache/static.d.ts.map +1 -1
  274. package/dist/src/telem/client/cache/unary.d.ts +3 -3
  275. package/dist/src/telem/client/cache/unary.d.ts.map +1 -1
  276. package/dist/src/telem/client/client.d.ts +8 -12
  277. package/dist/src/telem/client/client.d.ts.map +1 -1
  278. package/dist/src/telem/client/external.d.ts +0 -1
  279. package/dist/src/telem/client/external.d.ts.map +1 -1
  280. package/dist/src/telem/client/reader.d.ts +28 -10
  281. package/dist/src/telem/client/reader.d.ts.map +1 -1
  282. package/dist/src/telem/client/reader.spec.d.ts +6 -1
  283. package/dist/src/telem/client/reader.spec.d.ts.map +1 -1
  284. package/dist/src/telem/client/streamer.d.ts +6 -6
  285. package/dist/src/telem/client/streamer.d.ts.map +1 -1
  286. package/dist/src/telem/client/streamer.spec.d.ts +2 -0
  287. package/dist/src/telem/client/streamer.spec.d.ts.map +1 -0
  288. package/dist/src/telem/control/Indicator.d.ts.map +1 -1
  289. package/dist/src/telem/control/aether/chip.d.ts +44 -232
  290. package/dist/src/telem/control/aether/chip.d.ts.map +1 -1
  291. package/dist/src/telem/control/aether/controller.d.ts +36 -73
  292. package/dist/src/telem/control/aether/controller.d.ts.map +1 -1
  293. package/dist/src/telem/control/aether/indicator.d.ts +49 -257
  294. package/dist/src/telem/control/aether/indicator.d.ts.map +1 -1
  295. package/dist/src/telem/control/aether/legend.d.ts +18 -132
  296. package/dist/src/telem/control/aether/legend.d.ts.map +1 -1
  297. package/dist/src/telem/control/aether/state.d.ts +10 -44
  298. package/dist/src/telem/control/aether/state.d.ts.map +1 -1
  299. package/dist/src/text/Editable.d.ts.map +1 -1
  300. package/dist/src/text/Keyboard.d.ts +1 -1
  301. package/dist/src/text/Keyboard.d.ts.map +1 -1
  302. package/dist/src/text/Text.d.ts +5 -4
  303. package/dist/src/text/Text.d.ts.map +1 -1
  304. package/dist/src/text/WithIcon.d.ts +3 -2
  305. package/dist/src/text/WithIcon.d.ts.map +1 -1
  306. package/dist/src/text/core/types.d.ts +17 -14
  307. package/dist/src/text/core/types.d.ts.map +1 -1
  308. package/dist/src/text/dimensions.d.ts +1 -0
  309. package/dist/src/text/dimensions.d.ts.map +1 -1
  310. package/dist/src/theming/Provider.d.ts.map +1 -1
  311. package/dist/src/theming/aether/provider.d.ts +899 -5915
  312. package/dist/src/theming/aether/provider.d.ts.map +1 -1
  313. package/dist/src/theming/core/fontString.d.ts.map +1 -1
  314. package/dist/src/theming/core/theme.d.ts +368 -1860
  315. package/dist/src/theming/core/theme.d.ts.map +1 -1
  316. package/dist/src/theming/css.d.ts +1 -1
  317. package/dist/src/theming/css.d.ts.map +1 -1
  318. package/dist/src/theming/static/generate.d.ts +2 -0
  319. package/dist/src/theming/static/generate.d.ts.map +1 -0
  320. package/dist/src/tooltip/Dialog.d.ts.map +1 -1
  321. package/dist/src/tree/Tree.d.ts +1 -1
  322. package/dist/src/tree/Tree.d.ts.map +1 -1
  323. package/dist/src/tree/core.d.ts +2 -2
  324. package/dist/src/tree/core.d.ts.map +1 -1
  325. package/dist/src/triggers/Provider.d.ts.map +1 -1
  326. package/dist/src/triggers/Text.d.ts.map +1 -1
  327. package/dist/src/triggers/hooks.d.ts +1 -0
  328. package/dist/src/triggers/hooks.d.ts.map +1 -1
  329. package/dist/src/triggers/triggers.d.ts +248 -9
  330. package/dist/src/triggers/triggers.d.ts.map +1 -1
  331. package/dist/src/util/component.d.ts +8 -2
  332. package/dist/src/util/component.d.ts.map +1 -1
  333. package/dist/src/viewport/use.d.ts +8 -1
  334. package/dist/src/viewport/use.d.ts.map +1 -1
  335. package/dist/src/vis/axis/axis.d.ts +17 -48
  336. package/dist/src/vis/axis/axis.d.ts.map +1 -1
  337. package/dist/src/vis/axis/canvas.d.ts +17 -20
  338. package/dist/src/vis/axis/canvas.d.ts.map +1 -1
  339. package/dist/src/vis/axis/preciseTimeScale.d.ts +1 -2
  340. package/dist/src/vis/axis/preciseTimeScale.d.ts.map +1 -1
  341. package/dist/src/vis/axis/ticks.d.ts +11 -11
  342. package/dist/src/vis/axis/ticks.d.ts.map +1 -1
  343. package/dist/src/vis/button/aether/button.d.ts +10 -80
  344. package/dist/src/vis/button/aether/button.d.ts.map +1 -1
  345. package/dist/src/vis/canvas/Canvas.d.ts +2 -2
  346. package/dist/src/vis/canvas/Canvas.d.ts.map +1 -1
  347. package/dist/src/vis/canvas/aether/canvas.d.ts +45 -193
  348. package/dist/src/vis/canvas/aether/canvas.d.ts.map +1 -1
  349. package/dist/src/vis/diagram/Diagram.d.ts.map +1 -1
  350. package/dist/src/vis/diagram/aether/Diagram.d.ts +62 -469
  351. package/dist/src/vis/diagram/aether/Diagram.d.ts.map +1 -1
  352. package/dist/src/vis/diagram/aether/types.d.ts +29 -249
  353. package/dist/src/vis/diagram/aether/types.d.ts.map +1 -1
  354. package/dist/src/vis/diagram/edge/Edge.d.ts +2 -3
  355. package/dist/src/vis/diagram/edge/Edge.d.ts.map +1 -1
  356. package/dist/src/vis/diagram/edge/connector/connector.d.ts +5 -8
  357. package/dist/src/vis/diagram/edge/connector/connector.d.ts.map +1 -1
  358. package/dist/src/vis/diagram/edge/paths.d.ts +3 -4
  359. package/dist/src/vis/diagram/edge/paths.d.ts.map +1 -1
  360. package/dist/src/vis/draw2d/canvas.d.ts +21 -3
  361. package/dist/src/vis/draw2d/canvas.d.ts.map +1 -1
  362. package/dist/src/vis/draw2d/index.d.ts +18 -4
  363. package/dist/src/vis/draw2d/index.d.ts.map +1 -1
  364. package/dist/src/vis/eraser/aether/eraser.d.ts +30 -170
  365. package/dist/src/vis/eraser/aether/eraser.d.ts.map +1 -1
  366. package/dist/src/vis/eraser/use.d.ts +2 -2
  367. package/dist/src/vis/eraser/use.d.ts.map +1 -1
  368. package/dist/src/vis/grid/grid.d.ts +14 -24
  369. package/dist/src/vis/grid/grid.d.ts.map +1 -1
  370. package/dist/src/vis/legend/Container.d.ts +41 -85
  371. package/dist/src/vis/legend/Container.d.ts.map +1 -1
  372. package/dist/src/vis/legend/Simple.d.ts +11 -4
  373. package/dist/src/vis/legend/Simple.d.ts.map +1 -1
  374. package/dist/src/vis/light/aether/light.d.ts +10 -80
  375. package/dist/src/vis/light/aether/light.d.ts.map +1 -1
  376. package/dist/src/vis/line/aether/line.d.ts +19 -101
  377. package/dist/src/vis/line/aether/line.d.ts.map +1 -1
  378. package/dist/src/vis/lineplot/Axis.d.ts.map +1 -1
  379. package/dist/src/vis/lineplot/Legend.d.ts.map +1 -1
  380. package/dist/src/vis/lineplot/LinePlot.d.ts +2 -3
  381. package/dist/src/vis/lineplot/LinePlot.d.ts.map +1 -1
  382. package/dist/src/vis/lineplot/aether/BoundQuerier.d.ts +35 -0
  383. package/dist/src/vis/lineplot/aether/BoundQuerier.d.ts.map +1 -0
  384. package/dist/src/vis/lineplot/aether/LinePlot.d.ts +82 -489
  385. package/dist/src/vis/lineplot/aether/LinePlot.d.ts.map +1 -1
  386. package/dist/src/vis/lineplot/aether/XAxis.d.ts +51 -191
  387. package/dist/src/vis/lineplot/aether/XAxis.d.ts.map +1 -1
  388. package/dist/src/vis/lineplot/aether/YAxis.d.ts +49 -194
  389. package/dist/src/vis/lineplot/aether/YAxis.d.ts.map +1 -1
  390. package/dist/src/vis/lineplot/aether/axis.d.ts +27 -98
  391. package/dist/src/vis/lineplot/aether/axis.d.ts.map +1 -1
  392. package/dist/src/vis/lineplot/aether/external.d.ts +1 -0
  393. package/dist/src/vis/lineplot/aether/external.d.ts.map +1 -1
  394. package/dist/src/vis/lineplot/external.d.ts +1 -0
  395. package/dist/src/vis/lineplot/external.d.ts.map +1 -1
  396. package/dist/src/vis/lineplot/range/Provider.d.ts.map +1 -1
  397. package/dist/src/vis/lineplot/range/aether/annotation.d.ts +15 -52
  398. package/dist/src/vis/lineplot/range/aether/annotation.d.ts.map +1 -1
  399. package/dist/src/vis/lineplot/range/aether/provider.d.ts +43 -294
  400. package/dist/src/vis/lineplot/range/aether/provider.d.ts.map +1 -1
  401. package/dist/src/vis/lineplot/tooltip/aether/tooltip.d.ts +17 -154
  402. package/dist/src/vis/lineplot/tooltip/aether/tooltip.d.ts.map +1 -1
  403. package/dist/src/vis/lineplot/useBoundQuerier.d.ts +11 -0
  404. package/dist/src/vis/lineplot/useBoundQuerier.d.ts.map +1 -0
  405. package/dist/src/vis/log/Log.d.ts.map +1 -1
  406. package/dist/src/vis/log/aether/Log.d.ts +82 -461
  407. package/dist/src/vis/log/aether/Log.d.ts.map +1 -1
  408. package/dist/src/vis/measure/aether/measure.d.ts +24 -249
  409. package/dist/src/vis/measure/aether/measure.d.ts.map +1 -1
  410. package/dist/src/vis/performance/Performance.d.ts +2 -0
  411. package/dist/src/vis/performance/Performance.d.ts.map +1 -0
  412. package/dist/src/vis/performance/aether/index.d.ts +2 -0
  413. package/dist/src/vis/performance/aether/index.d.ts.map +1 -0
  414. package/dist/src/vis/performance/aether/performance.d.ts +15 -0
  415. package/dist/src/vis/performance/aether/performance.d.ts.map +1 -0
  416. package/dist/src/vis/performance/index.d.ts +2 -0
  417. package/dist/src/vis/performance/index.d.ts.map +1 -0
  418. package/dist/src/vis/render/GLProgram.d.ts +1 -2
  419. package/dist/src/vis/render/GLProgram.d.ts.map +1 -1
  420. package/dist/src/vis/render/context.d.ts +1 -0
  421. package/dist/src/vis/render/context.d.ts.map +1 -1
  422. package/dist/src/vis/render/controller.d.ts +7 -12
  423. package/dist/src/vis/render/controller.d.ts.map +1 -1
  424. package/dist/src/vis/render/loop.d.ts +15 -5
  425. package/dist/src/vis/render/loop.d.ts.map +1 -1
  426. package/dist/src/vis/rule/Rule.d.ts +1 -1
  427. package/dist/src/vis/rule/Rule.d.ts.map +1 -1
  428. package/dist/src/vis/rule/aether/aether.d.ts +8 -57
  429. package/dist/src/vis/rule/aether/aether.d.ts.map +1 -1
  430. package/dist/src/vis/schematic/Forms.d.ts +7 -1
  431. package/dist/src/vis/schematic/Forms.d.ts.map +1 -1
  432. package/dist/src/vis/schematic/Symbols.d.ts +57 -9
  433. package/dist/src/vis/schematic/Symbols.d.ts.map +1 -1
  434. package/dist/src/vis/schematic/primitives/Primitives.d.ts +68 -29
  435. package/dist/src/vis/schematic/primitives/Primitives.d.ts.map +1 -1
  436. package/dist/src/vis/schematic/registry.d.ts +96 -1
  437. package/dist/src/vis/schematic/registry.d.ts.map +1 -1
  438. package/dist/src/vis/setpoint/aether/setpoint.d.ts +16 -155
  439. package/dist/src/vis/setpoint/aether/setpoint.d.ts.map +1 -1
  440. package/dist/src/vis/text/atlas.d.ts +32 -0
  441. package/dist/src/vis/text/atlas.d.ts.map +1 -0
  442. package/dist/src/vis/text/index.d.ts +2 -0
  443. package/dist/src/vis/text/index.d.ts.map +1 -0
  444. package/dist/src/vis/toggle/aether/toggle.d.ts +16 -150
  445. package/dist/src/vis/toggle/aether/toggle.d.ts.map +1 -1
  446. package/dist/src/vis/value/Form.d.ts.map +1 -1
  447. package/dist/src/vis/value/aether/value.d.ts +144 -569
  448. package/dist/src/vis/value/aether/value.d.ts.map +1 -1
  449. package/dist/src/vis/value/use.d.ts +55 -199
  450. package/dist/src/vis/value/use.d.ts.map +1 -1
  451. package/dist/state-CjGemC7S.js +88 -0
  452. package/dist/state-_FFrG5nH.cjs +1 -0
  453. package/dist/tabs.cjs +1 -1
  454. package/dist/tabs.js +1 -1
  455. package/dist/text.cjs +1 -1
  456. package/dist/text.js +2 -2
  457. package/dist/theme.css +1600 -0
  458. package/dist/theming.cjs +1 -1
  459. package/dist/theming.js +2 -2
  460. package/dist/{toArray-Dvn9FA_3.js → toArray-B7nD2CTw.js} +1 -1
  461. package/dist/{toArray-DRKOku1s.cjs → toArray-BvVYuN_b.cjs} +1 -1
  462. package/dist/tree.cjs +1 -1
  463. package/dist/tree.js +1 -1
  464. package/dist/triggers.cjs +1 -1
  465. package/dist/triggers.js +1 -1
  466. package/dist/units-CKKNRQlP.cjs +1 -0
  467. package/dist/units-a8CggrTe.js +11 -0
  468. package/dist/{useClickOutside-N6MHxbOe.js → useClickOutside-CKMnqdvH.js} +20 -21
  469. package/dist/useClickOutside-CPAEkvf8.cjs +1 -0
  470. package/dist/{useDebouncedCallback-D4Ec7whQ.js → useDebouncedCallback-Cyd6pZ59.js} +1 -1
  471. package/dist/useDebouncedCallback-DsKlBI86.cjs +1 -0
  472. package/dist/{useMemoCompare-Cq_C2ddc.js → useMemoCompare-B930TM0g.js} +2 -2
  473. package/dist/useMemoCompare-DprA41gC.cjs +1 -0
  474. package/dist/{useVirtualCursorDragWebKit-BBTGd7Xe.js → useVirtualCursorDragWebKit-BrSOJpYY.js} +5 -5
  475. package/dist/useVirtualCursorDragWebKit-Cvp93Pya.cjs +1 -0
  476. package/dist/value-B7u8K1CW.cjs +57 -0
  477. package/dist/value-BdZLWVof.js +5974 -0
  478. package/dist/video.cjs +1 -1
  479. package/dist/video.js +1 -1
  480. package/package.json +22 -19
  481. package/dist/Center-bD2cOjI8.cjs +0 -1
  482. package/dist/ContextMenu-BXNN2_7t.js +0 -101
  483. package/dist/ContextMenu-CNSewKSD.cjs +0 -1
  484. package/dist/DateTime-BfnGq6C2.cjs +0 -1
  485. package/dist/Divider-CJNDIsD4.cjs +0 -22
  486. package/dist/Dropdown-CL7BefC8.cjs +0 -1
  487. package/dist/Dropdown-D-aMufnM.js +0 -261
  488. package/dist/Haul-4OcHX8__.cjs +0 -1
  489. package/dist/Item-CW2A2nuL.js +0 -108
  490. package/dist/Item-CpAZC-dF.cjs +0 -1
  491. package/dist/Keyboard-DHGtnfsf.cjs +0 -1
  492. package/dist/Pack-C4NdZWyf.cjs +0 -1
  493. package/dist/Pack-UzJJ9OhY.js +0 -46
  494. package/dist/Provider-BH1uv6QX.js +0 -436
  495. package/dist/Provider-lJARiq5i.cjs +0 -1
  496. package/dist/Space-BrQoodma.cjs +0 -1
  497. package/dist/Space-I_hidXYi.js +0 -76
  498. package/dist/Text-C-o1z9sP.js +0 -124
  499. package/dist/Text-C_j_F67Q.cjs +0 -1
  500. package/dist/Text-ClTuQXMF.cjs +0 -4
  501. package/dist/Text-DEbr1cmH.cjs +0 -1
  502. package/dist/Text-DVv04lTs.js +0 -32
  503. package/dist/Toggle-CYB9Vt6b.cjs +0 -1
  504. package/dist/Toggle-v77mEVLE.js +0 -356
  505. package/dist/WithIcon-BnDZ-Qu7.js +0 -92
  506. package/dist/WithIcon-tr8ELI3W.cjs +0 -1
  507. package/dist/aggregator-AgOKLWHz.js +0 -83
  508. package/dist/aggregator-QqWwGnYH.cjs +0 -1
  509. package/dist/css-CU7tous7.cjs +0 -1
  510. package/dist/css-rxwBYwM1.js +0 -1194
  511. package/dist/deep-DsH2ji6Z.cjs +0 -1
  512. package/dist/deep-T1-57GfG.js +0 -105
  513. package/dist/dimensions-C9PXLcE0.js +0 -18
  514. package/dist/dimensions-e5IPRZhn.cjs +0 -1
  515. package/dist/eraser-D2I1qgOg.cjs +0 -11
  516. package/dist/eraser-Dmishn8h.js +0 -823
  517. package/dist/external-B1ttDWzy.cjs +0 -1
  518. package/dist/external-BWb18P9x.cjs +0 -46
  519. package/dist/external-BdxbwUpI.js +0 -343
  520. package/dist/external-BpvGU0dZ.cjs +0 -1
  521. package/dist/external-C7Hy9XdI.js +0 -418
  522. package/dist/external-CqhOyYDl.cjs +0 -1
  523. package/dist/external-Csg4_wkz.js +0 -15
  524. package/dist/external-CwvJvXL5.cjs +0 -1
  525. package/dist/external-Cztvb3-K.cjs +0 -1
  526. package/dist/external-DMEzx_kb.cjs +0 -1
  527. package/dist/external-DkQnAvKo.cjs +0 -1
  528. package/dist/fontString-C7H8Imxd.cjs +0 -1
  529. package/dist/fontString-DdV9bi9l.js +0 -12
  530. package/dist/hooks-B7ZV7Hz6.js +0 -293
  531. package/dist/hooks-CJnV8Pt4.cjs +0 -1
  532. package/dist/provider-BrBEjlx5.cjs +0 -53
  533. package/dist/provider-Dq9t3iAH.js +0 -10312
  534. package/dist/src/color/core/color.d.ts +0 -143
  535. package/dist/src/color/core/color.d.ts.map +0 -1
  536. package/dist/src/color/core/color.spec.d.ts +0 -2
  537. package/dist/src/color/core/color.spec.d.ts.map +0 -1
  538. package/dist/src/color/core/external.d.ts +0 -5
  539. package/dist/src/color/core/external.d.ts.map +0 -1
  540. package/dist/src/color/core/gradient.d.ts +0 -58
  541. package/dist/src/color/core/gradient.d.ts.map +0 -1
  542. package/dist/src/color/core/index.d.ts +0 -2
  543. package/dist/src/color/core/index.d.ts.map +0 -1
  544. package/dist/src/color/core/palette.d.ts +0 -74
  545. package/dist/src/color/core/palette.d.ts.map +0 -1
  546. package/dist/src/color/core/transformColorsToHex.d.ts +0 -6
  547. package/dist/src/color/core/transformColorsToHex.d.ts.map +0 -1
  548. package/dist/src/notation/external.d.ts +0 -3
  549. package/dist/src/notation/external.d.ts.map +0 -1
  550. package/dist/src/notation/notation.d.ts +0 -33
  551. package/dist/src/notation/notation.d.ts.map +0 -1
  552. package/dist/src/notation/notation.spec.d.ts +0 -2
  553. package/dist/src/notation/notation.spec.d.ts.map +0 -1
  554. package/dist/src/telem/client/types.d.ts +0 -20
  555. package/dist/src/telem/client/types.d.ts.map +0 -1
  556. package/dist/state-CUPEHHgf.js +0 -2405
  557. package/dist/state-LaBGf4_k.cjs +0 -15
  558. package/dist/transformColorsToHex-B2Bui-Wf.cjs +0 -1
  559. package/dist/transformColorsToHex-B6dG2LA6.js +0 -14
  560. package/dist/units-CvIf5nF_.cjs +0 -1
  561. package/dist/units-D7qkgH-s.js +0 -8
  562. package/dist/useClickOutside-PFl3AvPU.cjs +0 -1
  563. package/dist/useDebouncedCallback-vg2DKTH7.cjs +0 -1
  564. package/dist/useMemoCompare-BGEWpAJU.cjs +0 -1
  565. package/dist/useVirtualCursorDragWebKit-Rnok8Nft.cjs +0 -1
  566. package/dist/value-C6JZdCF2.cjs +0 -57
  567. package/dist/value-Dk2DJbst.js +0 -5911
  568. /package/dist/{Pack-BbwDtaE6.cjs → Stack-BbwDtaE6.cjs} +0 -0
  569. /package/dist/{Pack-D50qN0Vu.js → Stack-D50qN0Vu.js} +0 -0
@@ -1,15 +0,0 @@
1
- "use strict";const S=require("./css-CU7tous7.cjs"),u=require("zod"),oe=require("react"),ue=r=>r!=null&&typeof r=="object"&&!Array.isArray(r);var Ge=Object.defineProperty,Je=(r,e,t)=>e in r?Ge(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,V=(r,e,t)=>Je(r,typeof e!="symbol"?e+"":e,t);let We=class{constructor(){V(this,"contentType","application/json"),V(this,"decoder"),V(this,"encoder"),this.decoder=new TextDecoder,this.encoder=new TextEncoder}encode(e){return this.encoder.encode(this.encodeString(e)).buffer}decode(e,t){return this.decodeString(this.decoder.decode(e),t)}decodeString(e,t){const n=JSON.parse(e),s=S.C(n);return t!=null?t.parse(s):s}encodeString(e){const t=S.k(e);return JSON.stringify(t,(n,s)=>ArrayBuffer.isView(s)?Array.from(s):ue(s)&&"encode_value"in s?typeof s.value=="bigint"?s.value.toString():s.value:typeof s=="bigint"?s.toString():s)}static registerCustomType(){}},He=class{constructor(){V(this,"contentType","text/csv")}encode(e){const t=this.encodeString(e);return new TextEncoder().encode(t).buffer}decode(e,t){const n=new TextDecoder().decode(e);return this.decodeString(n,t)}encodeString(e){if(!Array.isArray(e)||e.length===0||!ue(e[0]))throw new Error("Payload must be an array of objects");const t=Object.keys(e[0]),n=[t.join(",")];return e.forEach(s=>{const a=t.map(l=>JSON.stringify(s[l]??""));n.push(a.join(","))}),n.join(`
2
- `)}decodeString(e,t){const[n,...s]=e.trim().split(`
3
- `).map(m=>m.trim());if(n.length===0)return t!=null?t.parse({}):{};const a=n.split(",").map(m=>m.trim()),l={};return a.forEach(m=>{l[m]=[]}),s.forEach(m=>{const f=m.split(",").map(g=>g.trim());a.forEach((g,v)=>{const c=this.parseValue(f[v]);c!=null&&l[g].push(c)})}),t!=null?t.parse(l):l}parseValue(e){if(e==null||e.length===0)return null;const t=Number(e);return isNaN(t)?e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e:t}static registerCustomType(){}},Ke=class{constructor(){V(this,"contentType","text/plain")}encode(e){return new TextEncoder().encode(e).buffer}decode(e,t){const n=new TextDecoder().decode(e);return t!=null?t.parse(n):n}};const J=new We;new He;new Ke;const te=r=>[...new Set(r)],Xe=(r,e,t=!0)=>{const n=new Map;return r.forEach(s=>{const a=e(s);if(n.has(a)){if(t)return;n.delete(a)}n.set(a,s)}),Array.from(n.values())},Qe=Object.freeze(Object.defineProperty({__proto__:null,by:Xe,unique:te},Symbol.toStringTag,{value:"Module"})),Se=r=>r!=null&&typeof r=="object"&&"toString"in r,_e=r=>{if(Se(r))return(r==null?void 0:r.toString().length)===0;switch(typeof r){case"string":return r.length===0;case"number":return r===0;case"bigint":return r===0n;case"boolean":return!r;case"undefined":return!0;case"object":return r===null}},Q=(r,e=!1)=>{const t=Se(r)?"stringer":typeof r;let n;switch(t){case"string":n=(s,a)=>s.localeCompare(a);break;case"stringer":n=(s,a)=>s.toString().localeCompare(a.toString());break;case"number":n=(s,a)=>Number(s)-Number(a);break;case"bigint":n=(s,a)=>BigInt(s)-BigInt(a)>0n?1:-1;break;case"boolean":n=(s,a)=>Number(s)-Number(a);break;case"undefined":n=()=>0;break;default:return console.warn(`sortFunc: unknown type ${t}`),()=>-1}return e?Ne(n):n},et=(r,e,t)=>{const n=Q(e[r],t);return(s,a)=>n(s[r],a[r])},tt=(r,e)=>r.length!==e.length?r.length-e.length:r.every((t,n)=>t===e[n])?0:-1,ve=(r,e)=>{if(r.length!==e.length)return r.length-e.length;if(r.length===0)return 0;const t=Q(r[0]),n=[...r].sort(t),s=[...e].sort(t);return n.every((a,l)=>a===s[l])?0:-1},rt=(r,e)=>{const t=te(r),n=te(e);return ve(t,n)},nt=(r,e)=>r===e?0:r==="first"&&e==="last"?1:-1,Ne=r=>(e,t)=>r(t,e),D=0,W=-1,H=1,Ie=r=>r<D,Ae=r=>r>D,st=r=>r>=D,Ee=r=>r===D,it=(r,e)=>{const t=/([a-zA-Z]+)|(\d+)/g,n=r.replace(/[\s_.-]+/g,"").match(t),s=e.replace(/[\s_.-]+/g,"").match(t);if(!n||!s)return 0;for(let a=0;a<Math.min(n.length,s.length);a++){const l=n[a],m=s[a];if(isNaN(Number(l))&&isNaN(Number(m))){const f=l.localeCompare(m);if(f!==0)return f}else if(!isNaN(Number(l))&&!isNaN(Number(m))){const f=Number(l)-Number(m);if(f!==0)return f}else return isNaN(Number(l))?-1:1}return n.length-s.length},at=Object.freeze(Object.defineProperty({__proto__:null,EQUAL:D,GREATER_THAN:H,LESS_THAN:W,isEqualTo:Ee,isGreaterThan:Ae,isGreaterThanEqual:st,isLessThan:Ie,newF:Q,newFieldF:et,order:nt,primitiveArrays:tt,reverseF:Ne,stringsWithNumbers:it,uniqueUnorderedPrimitiveArrays:rt,unorderedPrimitiveArrays:ve},Symbol.toStringTag,{value:"Module"}));var ot=Object.defineProperty,ut=(r,e,t)=>e in r?ot(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,i=(r,e,t)=>ut(r,typeof e!="symbol"?e+"":e,t);let lt=(r,e=21)=>(t=e)=>{let n="",s=t|0;for(;s--;)n+=r[Math.random()*r.length|0];return n};const ht="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",ct=lt(ht,11),$e=()=>ct(),ft=Object.freeze(Object.defineProperty({__proto__:null,create:$e},Symbol.toStringTag,{value:"Module"})),dt=u.z.enum(["static","dynamic"]),Me=(r,e)=>{const t=new w(e);if(![O.DAY,O.HOUR,O.MINUTE,O.SECOND,O.MILLISECOND,O.MICROSECOND,O.NANOSECOND].some(s=>s.equals(t)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const n=r.valueOf()%t.valueOf();return r instanceof w?new w(n):new O(n)},y=class h{constructor(e,t="UTC"){if(i(this,"value"),i(this,"encodeValue",!0),e==null)this.value=h.now().valueOf();else if(e instanceof Date)this.value=BigInt(e.getTime())*h.MILLISECOND.valueOf();else if(typeof e=="string")this.value=h.parseDateTimeString(e,t).valueOf();else if(Array.isArray(e))this.value=h.parseDate(e);else{let n=BigInt(0);e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=h.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=h.MAX:e=h.MIN)),this.value=BigInt(e.valueOf())+n}}static parseDate([e=1970,t=1,n=1]){const s=new Date(e,t-1,n,0,0,0,0);return new h(BigInt(s.getTime())*h.MILLISECOND.valueOf()).truncate(h.DAY).valueOf()}encode(){return this.value.toString()}valueOf(){return this.value}static parseTimeString(e,t="UTC"){const[n,s,a]=e.split(":");let l="00",m="00";a!=null&&([l,m]=a.split("."));let f=h.hours(parseInt(n??"00")).add(h.minutes(parseInt(s??"00"))).add(h.seconds(parseInt(l??"00"))).add(h.milliseconds(parseInt(m??"00")));return t==="local"&&(f=f.add(h.utcOffset)),f.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return h.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new h(BigInt(n.getTime())*h.MILLISECOND.valueOf(),t).valueOf()}fString(e="ISO",t="UTC"){switch(e){case"ISODate":return this.toISOString(t).slice(0,10);case"ISOTime":return this.toISOString(t).slice(11,23);case"time":return this.timeString(!1,t);case"preciseTime":return this.timeString(!0,t);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,t)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,t)}`;default:return this.toISOString(t)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(h.utcOffset).date().toISOString()}timeString(e=!1,t="UTC"){const n=this.toISOString(t);return e?n.slice(11,23):n.slice(11,19)}dateString(){const e=this.date(),t=e.toLocaleString("default",{month:"short"}),n=e.toLocaleString("default",{day:"numeric"});return`${t} ${n}`}static get utcOffset(){return new O(BigInt(new Date().getTimezoneOffset())*h.MINUTE.valueOf())}static since(e){return new h().span(e)}date(){return new Date(this.milliseconds)}equals(e){return this.valueOf()===new h(e).valueOf()}span(e){return this.range(e).span}range(e){return new L(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===BigInt(0)}after(e){return this.valueOf()>new h(e).valueOf()}afterEq(e){return this.valueOf()>=new h(e).valueOf()}before(e){return this.valueOf()<new h(e).valueOf()}beforeEq(e){return this.valueOf()<=new h(e).valueOf()}add(e){return new h(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new h(this.valueOf()-BigInt(e.valueOf()))}get hours(){return Number(this.valueOf())/Number(O.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(O.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(O.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(O.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(h.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(h.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getFullYear()}setYear(e){const t=this.date();return t.setFullYear(e),new h(t)}get month(){return this.date().getMonth()}setMonth(e){const t=this.date();return t.setMonth(e),new h(t)}get day(){return this.date().getDate()}setDay(e){const t=this.date();return t.setDate(e),new h(t)}get hour(){return this.date().getHours()}setHour(e){const t=this.date();return t.setHours(e),new h(t)}get minute(){return this.date().getMinutes()}setMinute(e){const t=this.date();return t.setMinutes(e),new h(t)}get second(){return this.date().getSeconds()}setSecond(e){const t=this.date();return t.setSeconds(e),new h(t)}get millisecond(){return this.date().getMilliseconds()}setMillisecond(e){const t=this.date();return t.setMilliseconds(e),new h(t)}toString(){return this.date().toISOString()}remainder(e){return Me(this,e)}get isToday(){return this.truncate(O.DAY).equals(h.now().truncate(O.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new h(new Date)}static max(...e){let t=h.MIN;for(const n of e){const s=new h(n);s.after(t)&&(t=s)}return t}static min(...e){let t=h.MAX;for(const n of e){const s=new h(n);s.before(t)&&(t=s)}return t}static nanoseconds(e){return new h(e)}static microseconds(e){return h.nanoseconds(e*1e3)}static milliseconds(e){return h.microseconds(e*1e3)}static seconds(e){return h.milliseconds(e*1e3)}static minutes(e){return h.seconds(e*60)}static hours(e){return h.minutes(e*60)}static days(e){return h.hours(e*24)}};i(y,"NANOSECOND",y.nanoseconds(1)),i(y,"MICROSECOND",y.microseconds(1)),i(y,"MILLISECOND",y.milliseconds(1)),i(y,"SECOND",y.seconds(1)),i(y,"MINUTE",y.minutes(1)),i(y,"HOUR",y.hours(1)),i(y,"DAY",y.days(1)),i(y,"MAX",new y((1n<<63n)-1n)),i(y,"MIN",new y(0)),i(y,"ZERO",new y(0)),i(y,"z",u.z.union([u.z.object({value:u.z.bigint()}).transform(r=>new y(r.value)),u.z.string().transform(r=>new y(BigInt(r))),u.z.instanceof(Number).transform(r=>new y(r)),u.z.number().transform(r=>new y(r)),u.z.instanceof(y)]));let w=y;const b=class d{constructor(e){i(this,"value"),i(this,"encodeValue",!0),typeof e=="number"&&(e=Math.trunc(e.valueOf())),this.value=BigInt(e.valueOf())}static fromSeconds(e){return e instanceof d?e:e instanceof re?e.period:e instanceof w?new d(e):["number","bigint"].includes(typeof e)?d.seconds(e):new d(e)}static fromMilliseconds(e){return e instanceof d?e:e instanceof re?e.period:e instanceof w?new d(e):["number","bigint"].includes(typeof e)?d.milliseconds(e):new d(e)}encode(){return this.value.toString()}valueOf(){return this.value}lessThan(e){return this.valueOf()<new d(e).valueOf()}greaterThan(e){return this.valueOf()>new d(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new d(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new d(e).valueOf()}remainder(e){return Me(this,e)}truncate(e){return new d(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(d.DAY),t=this.truncate(d.HOUR),n=this.truncate(d.MINUTE),s=this.truncate(d.SECOND),a=this.truncate(d.MILLISECOND),l=this.truncate(d.MICROSECOND),m=this.truncate(d.NANOSECOND),f=e,g=t.sub(e),v=n.sub(t),c=s.sub(n),$=a.sub(s),M=l.sub(a),ce=m.sub(l);let U="";return f.isZero||(U+=`${f.days}d `),g.isZero||(U+=`${g.hours}h `),v.isZero||(U+=`${v.minutes}m `),c.isZero||(U+=`${c.seconds}s `),$.isZero||(U+=`${$.milliseconds}ms `),M.isZero||(U+=`${M.microseconds}µs `),ce.isZero||(U+=`${ce.nanoseconds}ns`),U.trim()}mult(e){return new d(this.valueOf()*BigInt(e))}get days(){return Number(this.valueOf())/Number(d.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(d.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(d.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(d.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(d.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(d.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===BigInt(0)}equals(e){return this.valueOf()===new d(e).valueOf()}add(e){return new d(this.valueOf()+new d(e).valueOf())}sub(e){return new d(this.valueOf()-new d(e).valueOf())}static nanoseconds(e=1){return new d(e)}static microseconds(e=1){return d.nanoseconds(S.M(e,1e3))}static milliseconds(e=1){return d.microseconds(S.M(e,1e3))}static seconds(e=1){return d.milliseconds(S.M(e,1e3))}static minutes(e=1){return d.seconds(S.M(e,60))}static hours(e){return d.minutes(S.M(e,60))}static days(e){return d.hours(S.M(e,24))}};i(b,"NANOSECOND",b.nanoseconds(1)),i(b,"MICROSECOND",b.microseconds(1)),i(b,"MILLISECOND",b.milliseconds(1)),i(b,"SECOND",b.seconds(1)),i(b,"MINUTE",b.minutes(1)),i(b,"HOUR",b.hours(1)),i(b,"DAY",b.days(1)),i(b,"MAX",new b((1n<<63n)-1n)),i(b,"MIN",new b(0)),i(b,"ZERO",new b(0)),i(b,"z",u.z.union([u.z.object({value:u.z.bigint()}).transform(r=>new b(r.value)),u.z.string().transform(r=>new b(BigInt(r))),u.z.instanceof(Number).transform(r=>new b(r)),u.z.number().transform(r=>new b(r)),u.z.instanceof(b)]));let O=b;const C=class K extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new K(e).valueOf()}get period(){return O.seconds(1/this.valueOf())}sampleCount(e){return new O(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new E(t).valueOf()}span(e){return O.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new K(e)}static khz(e){return K.hz(e*1e3)}};i(C,"z",u.z.union([u.z.number().transform(r=>new C(r)),u.z.instanceof(Number).transform(r=>new C(r)),u.z.instanceof(C)]));let re=C;const I=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new Y(e*this.valueOf())}};i(I,"UNKNOWN",new I(0)),i(I,"BIT128",new I(16)),i(I,"BIT64",new I(8)),i(I,"BIT32",new I(4)),i(I,"BIT16",new I(2)),i(I,"BIT8",new I(1)),i(I,"z",u.z.union([u.z.number().transform(r=>new I(r)),u.z.instanceof(Number).transform(r=>new I(r)),u.z.instanceof(I)]));let E=I;const B=class X{constructor(e,t){i(this,"start"),i(this,"end"),typeof e=="object"&&"start"in e?(this.start=new w(e.start),this.end=new w(e.end)):(this.start=new w(e),this.end=new w(t))}get span(){return new O(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}get numeric(){return{start:Number(this.start.valueOf()),end:Number(this.end.valueOf())}}swap(){return new X(this.end,this.start)}equals(e){return this.start.equals(e.start)&&this.end.equals(e.end)}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e,t=O.ZERO){e=e.makeValid();const n=this.makeValid();if(this.equals(e))return!0;if(e.end.equals(n.start)||n.end.equals(e.start))return!1;const s=w.max(n.start,e.start),a=w.min(n.end,e.end);return a.before(s)?!1:new O(a.sub(s)).greaterThanOrEqual(t)}roughlyEquals(e,t){let n=this.start.sub(e.start).valueOf(),s=this.end.sub(e.end).valueOf();return n<0&&(n=-n),s<0&&(s=-s),n<=t.valueOf()&&s<=t.valueOf()}contains(e){return e instanceof X?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new X(this.start,this.end);return e.start.after(this.start)&&(t.start=e.start),e.start.after(this.end)&&(t.end=e.start),e.end.before(this.end)&&(t.end=e.end),e.end.before(this.start)&&(t.start=e.end),t}};i(B,"MAX",new B(w.MIN,w.MAX)),i(B,"MIN",new B(w.MAX,w.MIN)),i(B,"ZERO",new B(w.ZERO,w.ZERO)),i(B,"z",u.z.union([u.z.object({start:w.z,end:w.z}).transform(r=>new B(r.start,r.end)),u.z.instanceof(B)]));let L=B;const o=class T extends String{constructor(e){if(e instanceof T||typeof e=="string"||typeof e.valueOf()=="string"){super(e.valueOf());return}const t=T.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t!=null){super(t.valueOf());return}throw super(T.UNKNOWN.valueOf()),new Error(`unable to find data type for ${e.toString()}`)}get Array(){const e=T.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}matches(...e){return e.some(t=>this.equals(t))}toString(){return this.valueOf()}get isVariable(){return this.equals(T.JSON)||this.equals(T.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(T.UUID)}get isInteger(){const e=this.toString();return e.startsWith("int")||e.startsWith("uint")}get isFloat(){return this.toString().startsWith("float")}get density(){const e=T.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}get isUnsigned(){return this.equals(T.UINT8)||this.equals(T.UINT16)||this.equals(T.UINT32)||this.equals(T.UINT64)}get isSigned(){return this.equals(T.INT8)||this.equals(T.INT16)||this.equals(T.INT32)||this.equals(T.INT64)}canSafelyCastTo(e){return this.equals(e)?!0:!this.isNumeric||!e.isNumeric||this.isVariable||e.isVariable||this.isUnsigned&&e.isSigned?!1:this.isFloat?e.isFloat&&this.density.valueOf()<=e.density.valueOf():this.equals(T.INT32)&&e.equals(T.FLOAT64)||this.equals(T.INT8)&&e.equals(T.FLOAT32)?!0:this.isInteger&&e.isInteger?this.density.valueOf()<=e.density.valueOf()&&this.isUnsigned===e.isUnsigned:!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}checkArray(e){return e.constructor===this.Array}toJSON(){return this.toString()}get usesBigInt(){return T.BIG_INT_TYPES.some(e=>e.equals(this))}};i(o,"UNKNOWN",new o("unknown")),i(o,"FLOAT64",new o("float64")),i(o,"FLOAT32",new o("float32")),i(o,"INT64",new o("int64")),i(o,"INT32",new o("int32")),i(o,"INT16",new o("int16")),i(o,"INT8",new o("int8")),i(o,"UINT64",new o("uint64")),i(o,"UINT32",new o("uint32")),i(o,"UINT16",new o("uint16")),i(o,"UINT8",new o("uint8")),i(o,"BOOLEAN",o.UINT8),i(o,"TIMESTAMP",new o("timestamp")),i(o,"UUID",new o("uuid")),i(o,"STRING",new o("string")),i(o,"JSON",new o("json")),i(o,"ARRAY_CONSTRUCTORS",new Map([[o.UINT8.toString(),Uint8Array],[o.UINT16.toString(),Uint16Array],[o.UINT32.toString(),Uint32Array],[o.UINT64.toString(),BigUint64Array],[o.FLOAT32.toString(),Float32Array],[o.FLOAT64.toString(),Float64Array],[o.INT8.toString(),Int8Array],[o.INT16.toString(),Int16Array],[o.INT32.toString(),Int32Array],[o.INT64.toString(),BigInt64Array],[o.TIMESTAMP.toString(),BigInt64Array],[o.STRING.toString(),Uint8Array],[o.JSON.toString(),Uint8Array],[o.UUID.toString(),Uint8Array]])),i(o,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,o.UINT8],[Uint16Array.name,o.UINT16],[Uint32Array.name,o.UINT32],[BigUint64Array.name,o.UINT64],[Float32Array.name,o.FLOAT32],[Float64Array.name,o.FLOAT64],[Int8Array.name,o.INT8],[Int16Array.name,o.INT16],[Int32Array.name,o.INT32],[BigInt64Array.name,o.INT64]])),i(o,"DENSITIES",new Map([[o.UINT8.toString(),E.BIT8],[o.UINT16.toString(),E.BIT16],[o.UINT32.toString(),E.BIT32],[o.UINT64.toString(),E.BIT64],[o.FLOAT32.toString(),E.BIT32],[o.FLOAT64.toString(),E.BIT64],[o.INT8.toString(),E.BIT8],[o.INT16.toString(),E.BIT16],[o.INT32.toString(),E.BIT32],[o.INT64.toString(),E.BIT64],[o.TIMESTAMP.toString(),E.BIT64],[o.STRING.toString(),E.UNKNOWN],[o.JSON.toString(),E.UNKNOWN],[o.UUID.toString(),E.BIT128]])),i(o,"ALL",[o.UNKNOWN,o.FLOAT64,o.FLOAT32,o.INT64,o.INT32,o.INT16,o.INT8,o.UINT64,o.UINT32,o.UINT16,o.UINT8,o.TIMESTAMP,o.UUID,o.STRING,o.JSON]),i(o,"BIG_INT_TYPES",[o.INT64,o.UINT64,o.TIMESTAMP]),i(o,"z",u.z.union([u.z.string().transform(r=>new o(r)),u.z.instanceof(o)]));let p=o;const A=class N extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return N.bytes(this.valueOf()+e.valueOf())}sub(e){return N.bytes(this.valueOf()-e.valueOf())}truncate(e){return new N(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return N.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/N.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/N.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/N.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/N.TERABYTE.valueOf()}toString(){const e=this.truncate(N.TERABYTE),t=this.truncate(N.GIGABYTE),n=this.truncate(N.MEGABYTE),s=this.truncate(N.KILOBYTE),a=this.truncate(N.BYTE),l=e,m=t.sub(e),f=n.sub(t),g=s.sub(n),v=a.sub(s);let c="";return l.isZero||(c+=`${l.terabytes}TB `),m.isZero||(c+=`${m.gigabytes}GB `),f.isZero||(c+=`${f.megabytes}MB `),g.isZero||(c+=`${g.kilobytes}KB `),(!v.isZero||c==="")&&(c+=`${v.valueOf()}B`),c.trim()}static bytes(e=1){return new N(e)}static kilobytes(e=1){return N.bytes(e.valueOf()*1e3)}static megabytes(e=1){return N.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return N.megabytes(e.valueOf()*1e3)}static terabytes(e){return N.gigabytes(e.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};i(A,"BYTE",new A(1)),i(A,"KILOBYTE",A.kilobytes(1)),i(A,"MEGABYTE",A.megabytes(1)),i(A,"GIGABYTE",A.gigabytes(1)),i(A,"TERABYTE",A.terabytes(1)),i(A,"ZERO",new A(0)),i(A,"z",u.z.union([u.z.number().transform(r=>new A(r)),u.z.instanceof(A)]));let Y=A;const gt=u.z.union([u.z.instanceof(Uint8Array),u.z.instanceof(Uint16Array),u.z.instanceof(Uint32Array),u.z.instanceof(BigUint64Array),u.z.instanceof(Float32Array),u.z.instanceof(Float64Array),u.z.instanceof(Int8Array),u.z.instanceof(Int16Array),u.z.instanceof(Int32Array),u.z.instanceof(BigInt64Array)]),Be=r=>{const e=typeof r;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||r instanceof w||r instanceof O||r instanceof Date},mt=(r,e,t,n=0)=>r.usesBigInt&&!e.usesBigInt?Number(t)-Number(n):!r.usesBigInt&&e.usesBigInt?BigInt(t.valueOf())-BigInt(n.valueOf()):P(t,-n).valueOf(),P=(r,e)=>typeof r=="bigint"&&typeof e=="bigint"||typeof r=="number"&&typeof e=="number"?r+e:e===0?r:r===0?e:Number(r)+Number(e),pt=r=>r==null?!1:Array.isArray(r)||r instanceof ArrayBuffer||ArrayBuffer.isView(r)&&!(r instanceof DataView)||r instanceof ze?!0:Be(r),R=-1,ne={[Symbol.iterator]:()=>ne,next:()=>({done:!0,value:void 0})},yt=u.z.string().transform(r=>new Uint8Array(atob(r).split("").map(e=>e.charCodeAt(0))).buffer),bt=u.z.union([u.z.null(),u.z.undefined()]).transform(()=>new Uint8Array().buffer),se=10,q=class z{constructor(e){i(this,"key",""),i(this,"isSynnaxSeries",!0),i(this,"dataType"),i(this,"sampleOffset"),i(this,"gl"),i(this,"_data"),i(this,"_timeRange"),i(this,"alignment",0n),i(this,"_cachedMin"),i(this,"_cachedMax"),i(this,"writePos",R),i(this,"_refCount",0),i(this,"_cachedLength"),i(this,"_cachedIndexes"),pt(e)&&(e={data:e});const{dataType:t,timeRange:n,sampleOffset:s=0,glBufferUsage:a="static",alignment:l=0n,key:m=$e()}=e,f=e.data??[];if(f instanceof z||typeof f=="object"&&"isSynnaxSeries"in f&&f.isSynnaxSeries===!0){const c=f;this.key=c.key,this.dataType=c.dataType,this.sampleOffset=c.sampleOffset,this.gl=c.gl,this._data=c._data,this._timeRange=c._timeRange,this.alignment=c.alignment,this._cachedMin=c._cachedMin,this._cachedMax=c._cachedMax,this.writePos=c.writePos,this._refCount=c._refCount,this._cachedLength=c._cachedLength;return}const g=Be(f),v=Array.isArray(f);if(t!=null)this.dataType=new p(t);else{if(f instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(v||g){let c=f;if(!g){if(f.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");c=f[0]}if(typeof c=="string")this.dataType=p.STRING;else if(typeof c=="number")this.dataType=p.FLOAT64;else if(typeof c=="bigint")this.dataType=p.INT64;else if(typeof c=="boolean")this.dataType=p.BOOLEAN;else if(c instanceof w||c instanceof Date||c instanceof w)this.dataType=p.TIMESTAMP;else if(typeof c=="object")this.dataType=p.JSON;else throw new Error(`cannot infer data type of ${typeof c} when constructing a Series from a JS array`)}else this.dataType=new p(f)}if(!v&&!g)this._data=f;else{let c=g?[f]:f;const $=c[0];($ instanceof w||$ instanceof Date||$ instanceof O)&&(c=c.map(M=>new w(M).valueOf())),this.dataType.equals(p.STRING)?(this._cachedLength=c.length,this._data=new TextEncoder().encode(`${c.join(`
4
- `)}
5
- `).buffer):this.dataType.equals(p.JSON)?(this._cachedLength=c.length,this._data=new TextEncoder().encode(`${c.map(M=>J.encodeString(M)).join(`
6
- `)}
7
- `).buffer):this.dataType.usesBigInt&&typeof $=="number"?this._data=new this.dataType.Array(c.map(M=>BigInt(Math.round(M)))).buffer:!this.dataType.usesBigInt&&typeof $=="bigint"?this._data=new this.dataType.Array(c.map(M=>Number(M))).buffer:this._data=new this.dataType.Array(c).buffer}this.key=m,this.alignment=l,this.sampleOffset=s??0,this._timeRange=n,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:a}}static alloc({capacity:e,dataType:t,...n}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const s=new new p(t).Array(e),a=new z({data:s.buffer,dataType:t,...n});return a.writePos=0,a}static createTimestamps(e,t,n){const s=n.spanRange(t.span(e)),a=new BigInt64Array(e);for(let l=0;l<e;l++)a[l]=BigInt(n.add(t.span(l)).valueOf());return new z({data:a,dataType:p.TIMESTAMP,timeRange:s})}get refCount(){return this._refCount}static fromStrings(e,t){const n=new TextEncoder().encode(`${e.join(`
8
- `)}
9
- `);return new z({data:n,dataType:p.STRING,timeRange:t})}static fromJSON(e,t){const n=new TextEncoder().encode(`${e.map(s=>J.encodeString(s)).join(`
10
- `)}
11
- `);return new z({data:n,dataType:p.JSON,timeRange:t})}acquire(e){this._refCount++,e!=null&&this.updateGLBuffer(e)}release(){if(this._refCount--,this._refCount===0&&this.gl.control!=null)this.maybeGarbageCollectGLBuffer(this.gl.control);else if(this._refCount<0)throw new Error("cannot release an array with a negative reference count")}write(e){if(!e.dataType.equals(this.dataType))throw new Error("buffer must be of the same type as this array");return this.dataType.isVariable?this.writeVariable(e):this.writeFixed(e)}writeVariable(e){if(this.writePos===R)return 0;const t=this.byteCapacity.valueOf()-this.writePos,n=e.subBytes(0,t);return this.writeToUnderlyingData(n),this.writePos+=n.byteLength.valueOf(),this._cachedLength!=null&&(this._cachedLength+=n.length,this.calculateCachedLength()),n.length}writeFixed(e){if(this.writePos===R)return 0;const t=this.capacity-this.writePos,n=e.sub(0,t);return this.writeToUnderlyingData(n),this._cachedLength=void 0,this.maybeRecomputeMinMax(n),this.writePos+=n.length,n.length}writeToUnderlyingData(e){this.underlyingData.set(e.data,this.writePos)}get buffer(){return typeof this._data=="object"&&"buffer"in this._data?this._data.buffer:this._data}get underlyingData(){return new this.dataType.Array(this._data)}get data(){return this.writePos===R?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){if(!this.dataType.matches(p.STRING,p.UUID))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.underlyingData).split(`
12
- `).slice(0,-1)}toUUIDs(){if(!this.dataType.equals(p.UUID))throw new Error("cannot convert non-uuid series to uuids");const e=p.UUID.density.valueOf(),t=Array(this.length);for(let n=0;n<this.length;n++){const s=this.underlyingData.slice(n*e,(n+1)*e),a=Array.from(new Uint8Array(s.buffer),l=>l.toString(16).padStart(2,"0")).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5");t[n]=a}return t}parseJSON(e){if(!this.dataType.equals(p.JSON))throw new Error("cannot parse non-JSON series as JSON");return new TextDecoder().decode(this.underlyingData).split(`
13
- `).slice(0,-1).map(t=>e.parse(J.decodeString(t)))}get timeRange(){if(this._timeRange==null)throw new Error("time range not set on series");return this._timeRange}get byteCapacity(){return new Y(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===R?this.byteCapacity:this.dataType.isVariable?new Y(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this._cachedLength!=null?this._cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===R?this.data.length:this.writePos}calculateCachedLength(){if(!this.dataType.isVariable)throw new Error("cannot calculate length of a non-variable length data type");let e=0;const t=[0];return this.data.forEach((n,s)=>{n===se&&(e++,t.push(s+1))}),this._cachedIndexes=t,this._cachedLength=e,e}convert(e,t=0){if(this.dataType.equals(e))return this;const n=new e.Array(this.length);for(let s=0;s<this.length;s++)n[s]=mt(this.dataType,e,this.data[s],t);return new z({data:n.buffer,dataType:e,timeRange:this._timeRange,sampleOffset:t,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(p.TIMESTAMP))this._cachedMax=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const e=this.data;this._cachedMax=e.reduce((t,n)=>t>n?t:n)}else{const e=this.data;this._cachedMax=e.reduce((t,n)=>t>n?t:n)}return this._cachedMax}get max(){if(this.dataType.isVariable)throw new Error("cannot calculate maximum on a variable length data type");return this.writePos===0?-1/0:(this._cachedMax??(this._cachedMax=this.calcRawMax()),P(this._cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(p.TIMESTAMP))this._cachedMin=this.data[0];else if(this.dataType.usesBigInt){const e=this.data;this._cachedMin=e.reduce((t,n)=>t<n?t:n)}else{const e=this.data;this._cachedMin=e.reduce((t,n)=>t<n?t:n)}return this._cachedMin}get min(){if(this.dataType.isVariable)throw new Error("cannot calculate minimum on a variable length data type");return this.writePos===0?1/0:(this._cachedMin??(this._cachedMin=this.calcRawMin()),P(this._cachedMin,this.sampleOffset))}get bounds(){return S.i$1(Number(this.min),Number(this.max))}maybeRecomputeMinMax(e){if(this._cachedMin!=null){const t=e._cachedMin??e.calcRawMin();t<this._cachedMin&&(this._cachedMin=t)}if(this._cachedMax!=null){const t=e._cachedMax??e.calcRawMax();t>this._cachedMax&&(this._cachedMax=t)}}enrich(){this.max,this.min}get range(){return P(this.max,-this.min)}atAlignment(e,t){const n=Number(e-this.alignment);if(n<0||n>=this.length){if(t===!0)throw new Error(`[series] - no value at index ${n}`);return}return this.at(n,t)}at(e,t){if(this.dataType.isVariable)return this.atVariable(e,t??!1);e<0&&(e=this.length+e);const n=this.data[e];if(n==null){if(t===!0)throw new Error(`[series] - no value at index ${e}`);return}return P(n,this.sampleOffset)}atVariable(e,t){let n=0,s=0;if(this._cachedIndexes!=null)n=this._cachedIndexes[e],s=this._cachedIndexes[e+1]-1;else{e<0&&(e=this.length+e);for(let l=0;l<this.data.length;l++)if(this.data[l]===se){if(e===0){s=l;break}n=l+1,e--}if(s===0&&(s=this.data.length),n>=s||e>0){if(t)throw new Error(`[series] - no value at index ${e}`);return}}const a=this.data.slice(n,s);return this.dataType.equals(p.STRING)?new TextDecoder().decode(a):S.C(JSON.parse(new TextDecoder().decode(a)))}binarySearch(e){let t=0,n=this.length-1;const s=Q(e);for(;t<=n;){const a=Math.floor((t+n)/2),l=s(this.at(a,!0),e);if(l===0)return a;l<0?t=a+1:n=a-1}return t}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(p.FLOAT32)&&!this.dataType.equals(p.UINT8))throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");const{buffer:t,bufferUsage:n,prevBuffer:s}=this.gl;if(t==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==s)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==R){s===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const a=this.dataType.density.size(s).valueOf(),l=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,a,l.buffer),this.gl.prevBuffer=this.writePos}else e.bufferData(e.ARRAY_BUFFER,this.buffer,n==="static"?e.STATIC_DRAW:e.DYNAMIC_DRAW),this.gl.prevBuffer=R}as(e){if(e==="string"){if(!this.dataType.equals(p.STRING))throw new Error(`cannot convert series of type ${this.dataType.toString()} to string`);return this}if(e==="number"){if(!this.dataType.isNumeric)throw new Error(`cannot convert series of type ${this.dataType.toString()} to number`);return this}if(e==="bigint"){if(!this.dataType.equals(p.INT64))throw new Error(`cannot convert series of type ${this.dataType.toString()} to bigint`);return this}throw new Error(`cannot convert series to ${e}`)}get digest(){var e;return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:we(this.alignmentBounds.lower),upper:we(this.alignmentBounds.upper)},timeRange:(e=this._timeRange)==null?void 0:e.toString(),length:this.length,capacity:this.capacity}}get memInfo(){return{key:this.key,length:this.length,byteLength:this.byteLength,glBuffer:this.gl.buffer!=null}}get alignmentBounds(){return S.i$1(this.alignment,this.alignment+BigInt(this.length))}maybeGarbageCollectGLBuffer(e){this.gl.buffer!=null&&(e.deleteBuffer(this.gl.buffer),this.gl.buffer=null,this.gl.prevBuffer=0,this.gl.control=null)}get glBuffer(){if(this.gl.buffer==null)throw new Error("gl buffer not initialized");return this.gl.prevBuffer!==this.writePos&&console.warn("buffer not updated"),this.gl.buffer}[Symbol.iterator](){if(this.dataType.isVariable){const e=new wt(this);return this.dataType.equals(p.JSON)?new Ot(e):e}return new Tt(this)}slice(e,t){return this.sliceSub(!1,e,t)}sub(e,t){return this.sliceSub(!0,e,t)}subIterator(e,t){return new fe(this,e,t??this.length)}subAlignmentIterator(e,t){return new fe(this,Number(e-this.alignment),Number(t-this.alignment))}subBytes(e,t){if(e>=0&&(t==null||t>=this.byteLength.valueOf()))return this;const n=this.data.subarray(e,t);return new z({data:n,dataType:this.dataType,timeRange:this._timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(e)})}sliceSub(e,t,n){if(t<=0&&(n==null||n>=this.length))return this;let s;return e?s=this.data.subarray(t,n):s=this.data.slice(t,n),new z({data:s,dataType:this.dataType,timeRange:this._timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(t)})}reAlign(e){return new z({data:this.buffer,dataType:this.dataType,timeRange:L.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}};i(q,"crudeZ",u.z.object({timeRange:L.z.optional(),dataType:p.z,alignment:u.z.coerce.bigint().optional(),data:u.z.union([yt,bt,u.z.instanceof(ArrayBuffer),u.z.instanceof(Uint8Array)]),glBufferUsage:dt.optional().default("static").optional()})),i(q,"z",q.crudeZ.transform(r=>new q(r)));let ze=q,fe=class{constructor(e,t,n){i(this,"series"),i(this,"end"),i(this,"index"),this.series=e;const s=S.i$1(0,e.length);this.end=S.T$1(s,n),this.index=S.T$1(s,t)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[Symbol.iterator](){return this}};class wt{constructor(e){if(i(this,"series"),i(this,"index"),i(this,"decoder"),!e.dataType.isVariable)throw new Error("cannot create a variable series iterator for a non-variable series");this.series=e,this.index=0,this.decoder=new TextDecoder}next(){const e=this.index,t=this.series.data;for(;this.index<t.length&&t[this.index]!==se;)this.index++;const n=this.index;return e===n?{done:!0,value:void 0}:(this.index++,{done:!1,value:this.decoder.decode(this.series.buffer.slice(e,n))})}[Symbol.iterator](){return this}}var de,ge;class Ot{constructor(e){i(this,"wrapped"),i(this,de,"JSONSeriesIterator"),this.wrapped=e}next(){const e=this.wrapped.next();return e.done===!0?{done:!0,value:void 0}:{done:!1,value:J.decodeString(e.value)}}[(ge=Symbol.iterator,de=Symbol.toStringTag,ge)](){return this}}var me,pe;class Tt{constructor(e){i(this,"series"),i(this,"index"),i(this,me,"SeriesIterator"),this.series=e,this.index=0}next(){return this.index>=this.series.length?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[(pe=Symbol.iterator,me=Symbol.toStringTag,pe)](){return this}}class St{constructor(e){if(i(this,"series"),e.length!==0){const t=e[0].dataType;for(let n=1;n<e.length;n++)if(!e[n].dataType.equals(t))throw new Error("[multi-series] - series must have the same data type")}this.series=e}as(e){if(!new p(e).equals(this.dataType))throw new Error(`cannot convert series of type ${this.dataType.toString()} to ${e.toString()}`);return this}get dataType(){return this.series.length===0?p.UNKNOWN:this.series[0].dataType}get timeRange(){return this.series.length===0?L.ZERO:new L(this.series[0].timeRange.start,this.series[this.series.length-1].timeRange.end)}get alignment(){return this.series.length===0?0n:this.series[0].alignment}get alignmentBounds(){return this.series.length===0?S.i$1(0n,0n):S.i$1(this.series[0].alignmentBounds.lower,this.series[this.series.length-1].alignmentBounds.upper)}push(e){this.series.push(e)}get length(){return this.series.reduce((e,t)=>e+t.length,0)}atAlignment(e,t){if(this.series.length===0){if(t)throw new Error(`[series] - no value at alignment ${e}`);return}for(const n of this.series)if(S.a(n.alignmentBounds,e))return n.atAlignment(e,t);if(t)throw new Error(`[series] - no value at alignment ${e}`)}at(e,t=!1){e<0&&(e=this.length+e);for(const n of this.series){if(e<n.length)return n.at(e,t);e-=n.length}if(t)throw new Error(`[series] - no value at index ${e}`)}subIterator(e,t){return new _(this,e,t??this.length)}subAlignmentIterator(e,t){if(e>=this.alignmentBounds.upper||t<=this.alignmentBounds.lower)return ne;let n=0;for(let a=0;a<this.series.length;a++){const l=this.series[a];if(e<l.alignment)break;if(e>=l.alignmentBounds.upper)n+=l.length;else if(S.a(l.alignmentBounds,e)){n+=Number(e-l.alignment);break}}let s=0;for(let a=0;a<this.series.length;a++){const l=this.series[a];if(t<l.alignment)break;if(t>=l.alignmentBounds.upper)s+=l.length;else if(S.a(l.alignmentBounds,t)){s+=Number(t-l.alignment);break}}return new _(this,n,s)}subAlignmentSpanIterator(e,t){if(e>=this.alignmentBounds.upper)return ne;let n=0;for(let s=0;s<this.series.length;s++){const a=this.series[s];if(e<a.alignment)break;if(e>=a.alignmentBounds.upper)n+=a.length;else if(S.a(a.alignmentBounds,e)){n+=Number(e-a.alignment);break}}return new _(this,n,n+t)}get byteLength(){return new Y(this.series.reduce((e,t)=>e+t.byteLength.valueOf(),0))}get data(){const e=new this.dataType.Array(this.length);let t=0;for(const n of this.series)e.set(n.data,t),t+=n.length;return new this.dataType.Array(e.buffer)}traverseAlignment(e,t){const n=this.series.map(s=>s.alignmentBounds);return S.U(n,e,t)}distance(e,t){const n=this.series.map(s=>s.alignmentBounds);return S.V(n,e,t)}parseJSON(e){if(!this.dataType.equals(p.JSON))throw new Error("cannot parse non-JSON series as JSON");return this.series.flatMap(t=>t.parseJSON(e))}[Symbol.iterator](){return this.series.length===0?{next(){return{done:!0,value:void 0}}}:new vt(this.series)}}var ye,be;class vt{constructor(e){i(this,"series"),i(this,"seriesIndex"),i(this,"internal"),i(this,ye,"MultiSeriesIterator"),this.series=e,this.seriesIndex=0,this.internal=e[0][Symbol.iterator]()}next(){const e=this.internal.next();return e.done===!1?e:this.seriesIndex===this.series.length-1?{done:!0,value:void 0}:(this.internal=this.series[++this.seriesIndex][Symbol.iterator](),this.next())}[(be=Symbol.iterator,ye=Symbol.toStringTag,be)](){return this}}let _=class{constructor(e,t,n){i(this,"series"),i(this,"index"),i(this,"end"),this.series=e,this.end=n,this.index=t}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[Symbol.iterator](){return this}};const we=r=>{const e=r>>32n,t=r&0xffffffffn;return{domain:e,sample:t}},xe=(r,e,t=".")=>{const n=r.split(t);return n.map((s,a)=>{const l=e(s,a,n);return l==null?null:typeof l=="string"?l:l.join(t)}).filter(s=>s!=null).join(t)},le=(r,e,t={optional:!1,separator:"."})=>{t.separator??(t.separator=".");const{optional:n,getter:s=(m,f)=>m[f]}=t,a=e.split(t.separator);if(a.length===1&&a[0]==="")return r;let l=r;for(const m of a){const f=s(l,m);if(f==null){if(n)return null;throw new Error(`Path ${e} does not exist. ${m} is null`)}l=f}return l},Nt=(r,e,t)=>{const n=e.split(".");let s=r;for(let a=0;a<n.length-1;a++){const l=n[a];s[l]??(s[l]={}),s=s[l]}try{s[n[n.length-1]]=t}catch(a){throw console.error("failed to set value",t,"at path",e,"on object",r),a}},It=(r,e)=>{const t=e.split(".");let n=r;for(let s=0;s<t.length-1;s++){const a=t[s];if(n[a]==null)return;n=n[a]}if(Array.isArray(n)){const s=parseInt(t[t.length-1]);if(isNaN(s))return;n.splice(s,1);return}delete n[t[t.length-1]]},At=(r,e)=>{const t=r.split(".");return e<0?t[t.length+e]:t[e]},Et=(r,e)=>{try{return le(r,e),!0}catch{return!1}},$t=(r,e)=>{if(e.length===0)return!0;const t=r.split("."),n=e.split(".");if(n.length>t.length)return!1;for(let s=0;s<n.length;s++){const a=t[s],l=n[s];if(l!=="*"&&a!==l)return!1}return!0};u.z.object({key:u.z.string(),value:u.z.string()});u.z.record(u.z.union([u.z.number(),u.z.string(),u.z.symbol()]),u.z.unknown());const Ue=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",Mt=Ue(),Re=["macOS","Windows","Linux"],Bt=["macos","windows","linux"],zt={macos:"macOS",windows:"Windows",linux:"Linux"},xt=u.z.enum(Re).or(u.z.enum(Bt).transform(r=>zt[r])),Ut=()=>{if(typeof window>"u")return;const r=window.navigator.userAgent.toLowerCase();if(r.includes("mac"))return"macOS";if(r.includes("win"))return"Windows";if(r.includes("linux"))return"Linux"};let ee;const Rt=(r={})=>{const{force:e,default:t}=r;return e??ee??(ee=Ut(),ee??t)},Lt=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:Re,RUNTIME:Mt,detect:Ue,getOS:Rt,osZ:xt},Symbol.toStringTag,{value:"Module"}));var Dt=Object.defineProperty,Ct=(r,e,t)=>e in r?Dt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,j=(r,e,t)=>Ct(r,typeof e!="symbol"?e+"":e,t);const Pt=(...r)=>r.map(Le).join(""),Le=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),qt=r=>r.endsWith("/")?r.slice(0,-1):r,Oe=class ie{constructor({host:e,port:t,protocol:n="",pathPrefix:s=""}){j(this,"protocol"),j(this,"host"),j(this,"port"),j(this,"path"),this.protocol=n,this.host=e,this.port=t,this.path=Le(s)}replace(e){return new ie({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new ie({...this,pathPrefix:Pt(this.path,e)})}toString(){return qt(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};j(Oe,"UNKNOWN",new Oe({host:"unknown",port:0}));const jt=-128,kt=127,Ft=u.z.number().int().min(jt).max(kt),Vt=-32768,Yt=32767,Zt=u.z.number().int().min(Vt).max(Yt),Gt=-2147483648,Jt=2147483647,Wt=u.z.number().int().min(Gt).max(Jt),Ht=-9223372036854775808n,Kt=9223372036854775807n,Xt=u.z.bigint().min(Ht).max(Kt),Qt=255,_t=u.z.number().int().min(0).max(Qt),er=65535,tr=u.z.number().int().min(0).max(er),rr=4294967295,nr=u.z.number().int().min(0).max(rr),sr=18446744073709551615n,ir=u.z.bigint().min(0n).max(sr),De=r=>xe(r,(e,t,n)=>{const s=t===n.length-1,a=!isNaN(parseInt(e)),l=!isNaN(parseInt(n[t+1]));return a&&(e="element"),s||l?e:[e,"shape"]}),Te=(r,e)=>{if(r==null)return null;const t=r[e];return t==null&&typeof r=="object"&&"sourceType"in r?r.sourceType()[e]:t},ar=(r,e,t)=>le(Te(r,"shape"),De(e),{...t,getter:Te}),or=Object.freeze(Object.defineProperty({__proto__:null,getFieldSchema:ar,getFieldSchemaPath:De,int16:Zt,int32:Wt,int64:Xt,int8:Ft,uint16:tr,uint32:nr,uint64:ir,uint8:_t},Symbol.toStringTag,{value:"Module"}));var ur=Object.defineProperty,lr=(r,e,t)=>e in r?ur(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,k=(r,e,t)=>lr(r,typeof e!="symbol"?e+"":e,t);u.z.object({interval:O.z.optional(),maxRetries:u.z.number().optional(),scale:u.z.number().optional()});const x=class extends Number{};k(x,"ABSOLUTE",255),k(x,"MINIMUM",0),k(x,"BOUNDS",{lower:x.MINIMUM,upper:x.ABSOLUTE+1}),k(x,"z",u.z.union([u.z.instanceof(x),u.z.number().int().min(0).max(255).transform(r=>new x(r)),u.z.instanceof(Number).transform(r=>new x(r))]));let Ce=x;const Pe=u.z.object({name:u.z.string(),key:u.z.string()}),hr=r=>u.z.object({subject:Pe,resource:r,authority:Ce.z}),cr=(...r)=>e=>e.filter(t=>{let n=!1;return t.to!=null&&(n=r.includes(t.to.resource)),t.from!=null&&!n&&(n=r.includes(t.from.resource)),n}),fr=Object.freeze(Object.defineProperty({__proto__:null,Authority:Ce,filterTransfersByChannelKey:cr,stateZ:hr,subjectZ:Pe},Symbol.toStringTag,{value:"Module"})),qe=class F extends Error{constructor(){super(F.MESSAGE)}matches(e){return typeof e=="string"?e.includes(F.MESSAGE):e instanceof F||e.message.includes(F.MESSAGE)}};k(qe,"MESSAGE","canceled");let dr=qe;new dr;const gr=r=>r?-1:1,ae=u.z.string().regex(/^\d+\.\d+\.\d+$/),Z=(r,e,t={})=>{t.checkMajor??(t.checkMajor=!0),t.checkMinor??(t.checkMinor=!0),t.checkPatch??(t.checkPatch=!0);const n=ae.parse(r),s=ae.parse(e),[a,l,m]=n.split(".").map(Number),[f,g,v]=s.split(".").map(Number);if(t.checkMajor){if(a<f)return W;if(a>f)return H}if(t.checkMinor){if(l<g)return W;if(l>g)return H}if(t.checkPatch){if(m<v)return W;if(m>v)return H}return D},mr=(r,e,t={})=>Ee(Z(r,e,t)),je=(r,e,t={})=>Ae(Z(r,e,t)),pr=(r,e,t={})=>Ie(Z(r,e,t)),yr=({name:r,migrate:e})=>t=>{try{const n=e(t);return console.log(`${r} migrated: ${t.version} -> ${n.version}`),n}catch(n){throw console.log(`${r} failed to migrate from ${t.version}`),console.error(n),n}},br=({name:r,migrations:e,targetSchema:t,defaultVersion:n,def:s})=>{const a=Object.keys(e).sort(Z).pop();if(a==null)return g=>{if(g.version??(g.version=n),g.version!==s.version)return console.log(`${r} version ${g.version} is newer than latest version of ${s.version}.
14
- Returning default instead.
15
- `),s;try{return t!=null?t.parse(g):g}catch(v){return console.log(`${r} failed to parse default. Exiting with default`),console.error(v),s}};const l=Object.keys(e).length;let m=!1;const f=g=>{try{if(l===0||je(g.version,a))return console.log(m?`${r} ${g.version} now up to date`:`${r} version ${g.version} is up to date with target version ${s.version}`),g;const v=g.version,c=e[v],$=c(g);return m=!0,f($)}catch(v){return console.log(`${r} failed to migrate from ${g.version} to ${a}`),console.error(v),s}};return g=>{try{if(g.version==null)if(n!=null)console.log(`${r} version is null. Setting version to default of ${n}`),g.version=n;else return console.log(`${r} version is null and no default version set. Exiting with default`),s;return f(g)}catch(v){return console.log(`${r} failed to parse final result. Exiting with default`),console.error(v),s}}},wr=Object.freeze(Object.defineProperty({__proto__:null,compareSemVer:Z,createMigration:yr,migrator:br,semVerNewer:je,semVerOlder:pr,semVerZ:ae,versionsEqual:mr},Symbol.toStringTag,{value:"Module"})),Or=r=>{if(r===void 0||typeof r=="string"||typeof r=="number")return r;if(r.toString===void 0)throw new Error("invalid renderer");return r.toString()},Tr=r=>Array.isArray(r)?[...r]:typeof r=="object"&&r!==null?{...r}:r,ke=["h1","h2","h3","h4","h5","p","small"],Sr=u.z.enum(ke),vr={h1:"h2",h2:"h3",h3:"h4",h4:"h5",h5:"p",p:"small",small:"small"},Nr=r=>vr[r],Ir={h1:"h1",h2:"h1",h3:"h2",h4:"h3",h5:"h4",p:"h5",small:"p"},Ar=r=>Ir[r],Er=["normal","bold","bolder","lighter"],$r=u.z.union([u.z.number(),u.z.enum(Er)]),Mr=u.z.object({size:u.z.number(),weight:u.z.union([u.z.number(),u.z.string()]),lineHeight:u.z.number(),textTransform:u.z.string().optional()}),Br={small:"small",medium:"p",large:"h5",huge:"h2"},zr={h1:"huge",h2:"huge",h3:"huge",h4:"large",h5:"small",p:"medium",small:"small"},he=r=>typeof r=="function",Fe=(r,e)=>he(r)?r(e):r,G=r=>Ve(r)?r():r,Ve=r=>typeof r=="function",Ye=({initial:r,value:e,onChange:t})=>{const[n,s]=oe.useState(G(e??r));return e!=null&&t!=null?[e,t]:[n,s]},Ze=({initial:r,value:e,onChange:t})=>{const[n,s]=oe.useState(G(e??r));return e!=null&&t!=null?[e,t]:[n,s]},xr=(r,e)=>{const[t,n]=oe.useState(()=>{const s=localStorage.getItem(e);return s==null?G(r):JSON.parse(s)});return[t,s=>{n(s),localStorage.setItem(e,JSON.stringify(s))}]},Ur=Object.freeze(Object.defineProperty({__proto__:null,executeInitialSetter:G,executeSetter:Fe,isInitialSetter:Ve,isSetter:he,usePassthrough:Ye,usePersisted:xr,usePurePassthrough:Ze},Symbol.toStringTag,{value:"Module"}));exports.$=re;exports.C=Y;exports.ComponentSizeLevels=Br;exports.F=at;exports.L=or;exports.LEVELS=ke;exports.LevelComponentSizes=zr;exports.Lt=St;exports.Rt=ft;exports.S=Lt;exports.U=L;exports.Y=fr;exports.Z=ze;exports.b=E;exports.c=le;exports.c$1=Qe;exports.downLevel=Nr;exports.executeInitialSetter=G;exports.executeSetter=Fe;exports.f=Nt;exports.g=Et;exports.g$1=p;exports.h=It;exports.isSetter=he;exports.levelZ=Sr;exports.m=w;exports.ne=Or;exports.o=ue;exports.oe=wr;exports.p=At;exports.re=gr;exports.se=Tr;exports.specZ=Mr;exports.state=Ur;exports.u=xe;exports.upLevel=Ar;exports.usePassthrough=Ye;exports.usePurePassthrough=Ze;exports.w=_e;exports.weightZ=$r;exports.xt=gt;exports.y=$t;exports.y$1=O;
@@ -1 +0,0 @@
1
- "use strict";const n=require("./css-CU7tous7.cjs"),t=r=>{if(r instanceof n.Color)return r.hex;if(typeof r=="object"&&r!==null){const e=Array.isArray(r)?[]:{};for(const s of Object.keys(r))e[s]=t(r[s]);return e}return r};exports.transformColorsToHex=t;
@@ -1,14 +0,0 @@
1
- import { a as n } from "./css-rxwBYwM1.js";
2
- const o = (r) => {
3
- if (r instanceof n) return r.hex;
4
- if (typeof r == "object" && r !== null) {
5
- const t = Array.isArray(r) ? [] : {};
6
- for (const e of Object.keys(r))
7
- t[e] = o(r[e]);
8
- return t;
9
- }
10
- return r;
11
- };
12
- export {
13
- o as t
14
- };
@@ -1 +0,0 @@
1
- "use strict";const a=require("./css-CU7tous7.cjs"),c=(t,e,s)=>Object.fromEntries(s.map(r=>[`${t}-${r}`,new a.Color(e).setAlpha(r).hex])),i=(t,e)=>`${t}${e}`;exports.createHexOpacityVariants=c;exports.unitProperty=i;
@@ -1,8 +0,0 @@
1
- import { a as o } from "./css-rxwBYwM1.js";
2
- const c = (t, a, r) => Object.fromEntries(
3
- r.map((e) => [`${t}-${e}`, new o(a).setAlpha(e).hex])
4
- ), n = (t, a) => `${t}${a}`;
5
- export {
6
- c,
7
- n as u
8
- };
@@ -1 +0,0 @@
1
- "use strict";const e=require("./css-CU7tous7.cjs");require("./state-LaBGf4_k.cjs");const E=require("react"),O=require("./Divider-CJNDIsD4.cjs"),b=t=>{if(t==null)return{x:void 0,y:void 0};const o=e.w.safeParse(t);if(o.success)return o.data;const n=e.i.safeParse(t);return n.success?e.t(n.data)==="x"?{x:n.data,y:void 0}:{x:void 0,y:n.data}:t},_=({container:t,target:o,dialog:n,initial:d,prefer:c,alignments:s=["start"],disable:u=[]})=>{const i=b(d);let l=e.$;if(c!=null){const r=c.map(a=>b(a));l=l.slice().sort((a,p)=>{const x=r.findIndex(w=>e.D(a,w)),v=r.findIndex(w=>e.D(p,w));return x>-1&&v>-1?x-v:x>-1?-1:v>-1?1:0})}const f=l.filter(r=>!e.B(r,e.x)&&(i.x==null||r.x===i.x)&&(i.y==null||r.y===i.y)&&!u.some(a=>e.D(r,a))).map(r=>s==null?void 0:s.map(a=>[r,a])).flat(),m=e.c(t),g=e.c(o),D=e.c(n);let P=-1/0;const y={location:e.x,adjustedDialog:D};return f.forEach(([r,a])=>{const[p,x]=j({option:r,alignment:a,container:m,target:g,dialog:D});x>P&&(P=x,y.location=r,y.adjustedDialog=p)}),y},j=({option:t,alignment:o,container:n,target:d,dialog:c})=>{const s=q(t,o),u=e.g$1(d,t),i=e.go(u.x,u.y,e.u(c),e.w$1(c),s,e.T),l=e.mo(e.lo(i,n));return[i,l]},L={start:"left",center:"center",end:"right"},M={start:"bottom",center:"center",end:"top"},q=(t,o)=>{const n={x:"center",y:"center"};if(t.y!=="center"){n.y=e.P(t.y);const d=t.x==="left"?e.P:c=>c;n.x=d(L[o])}else n.x=e.P(t.x),n.y=M[o];return n},R=Object.freeze(Object.defineProperty({__proto__:null,dialog:_,getRoot:q,parseLocationOptions:b},Symbol.toStringTag,{value:"Module"})),$=({ref:t,onClickOutside:o,exclude:n})=>{const d=O.useSyncedRef(n),c=E.useCallback(s=>{const u=t.current,i=e.Mo.construct(window.document.documentElement),l=e.G.construct(s),f=d.current;if(f!=null){if(typeof f=="function"){if(f(s))return}else if(f.some(m=>{var g;return(g=m.current)==null?void 0:g.contains(s.target)}))return}u==null||u.contains(s.target)||e.Mo.contains(u,l)||!e.Mo.contains(i,l)||o()},[o]);E.useEffect(()=>(document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)),[c])};exports.H=R;exports.useClickOutside=$;
@@ -1 +0,0 @@
1
- "use strict";require("./state-LaBGf4_k.cjs");const s=require("react"),a=require("./debounce-heEWeOqL.cjs"),b=(c,e,u)=>s.useCallback(a.o(c,e),[e,...u]);exports.useDebouncedCallback=b;
@@ -1 +0,0 @@
1
- "use strict";const c=require("./state-LaBGf4_k.cjs"),n=require("react"),s=require("./deep-DsH2ji6Z.cjs"),i=(r,e,t)=>{const u=n.useRef(null);return u.current==null?u.current={deps:t,value:r()}:e(u.current.deps,t)||(u.current={deps:t,value:r()}),u.current.value},l=([r],[e])=>c.F.primitiveArrays(r,e)===0,o=r=>{const e=n.useRef(null);return e.current==null?e.current=r:s.I.equal(e.current,r)||(e.current=r),e.current},a=r=>{const e=n.useRef(null);return(e.current==null||c.F.primitiveArrays(e.current,r)!==0)&&(e.current=r),e.current};exports.compareArrayDeps=l;exports.useMemoCompare=i;exports.useMemoDeepEqualProps=o;exports.useMemoPrimitiveArray=a;
@@ -1 +0,0 @@
1
- "use strict";require("./state-LaBGf4_k.cjs");const m=require("react"),g=require("./Divider-CJNDIsD4.cjs"),b=require("./hooks-CJnV8Pt4.cjs");require("./jsx-runtime-CITbqOLs.cjs");const i=require("./css-CU7tous7.cjs");require("./Pack-BbwDtaE6.cjs");var h=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function j(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function w(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var n=e.default;if(typeof n=="function"){var r=function o(){return this instanceof o?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};r.prototype=n.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(o){var l=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,l.get?l:{enumerable:!0,get:function(){return e[o]}})}),r}const O={start:i.G.ZERO,mouseKey:"MouseLeft"},v=({ref:e,onMove:n,onStart:r,onEnd:o})=>{const[l,f]=g.useStateRef(O);m.useEffect(()=>{if(e.current==null)return;const{current:s}=e,p=t=>{const u=i.G.construct(t),{mouseKey:c,start:y}=l.current;n==null||n(i.Mo.construct(y,u),c,t)},a=t=>{s.setPointerCapture(t.pointerId),s.onpointermove=p;const u=i.G.construct(t),c=b.eventKey(t);f({start:u,mouseKey:c}),r==null||r(u,c,t),s.addEventListener("pointerup",d,{once:!0})};s.addEventListener("pointerdown",a);const d=t=>{s.onpointermove=null,s.releasePointerCapture(t.pointerId);const{start:u,mouseKey:c}=l.current;o==null||o(i.Mo.construct(u,i.G.construct(t)),c,t)};return()=>s.removeEventListener("pointerdown",a)},[n,r,o])};exports.commonjsGlobal=h;exports.getAugmentedNamespace=w;exports.getDefaultExportFromCjs=j;exports.useVirtualCursorDragWebKit=v;
@@ -1,57 +0,0 @@
1
- "use strict";var Mi=Object.defineProperty;var Pi=(e,n,t)=>n in e?Mi(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var h=(e,n,t)=>Pi(e,typeof n!="symbol"?n+"":n,t);const g=require("./state-LaBGf4_k.cjs"),f=require("zod"),w=require("./provider-BrBEjlx5.cjs"),X=require("./aggregator-QqWwGnYH.cjs"),l=require("./css-CU7tous7.cjs"),ee=require("./fontString-C7H8Imxd.cjs"),ft=require("./dimensions-e5IPRZhn.cjs"),_=require("./eraser-D2I1qgOg.cjs"),Ps=require("./debounce-heEWeOqL.cjs"),sr=require("./deep-DsH2ji6Z.cjs"),ks=require("./toArray-DRKOku1s.cjs");var ki=Object.defineProperty,Ri=(e,n,t)=>n in e?ki(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,je=(e,n,t)=>Ri(e,typeof n!="symbol"?n+"":n,t);class Yi{constructor(n,t){je(this,"handlers"),je(this,"transform"),je(this,"closer"),this.transform=n,this.handlers=t??new Map}onChange(n){return this.handlers.set(n,null),()=>this.handlers.delete(n)}notify(n){let t=n;if(this.transform!=null){const[r,s]=this.transform(n);if(!s)return;t=r}this.handlers.forEach((r,s)=>s(t))}setCloser(n){this.closer=n}async close(){var n;return await((n=this.closer)==null?void 0:n.call(this))}}class zi{constructor(n){je(this,"handlers"),this.handlers=n??new Map}onChange(n){return this.handlers.set(n,null),()=>this.handlers.delete(n)}notify(n){this.handlers.forEach((t,r)=>r(n))}}const ar=Object.freeze(Object.defineProperty({__proto__:null,BaseObserver:zi,Observer:Yi},Symbol.toStringTag,{value:"Module"})),tt="layout",jn="data",st="tool";var J;let Z=(J=class{constructor(n){h(this,"f");this.f=n}static control(n,t){n.set(J.CONTEXT_KEY,new J(t),!1)}static useRequest(n){return n.get(J.CONTEXT_KEY).f}static useOptionalRequest(n){var t;return((t=n.getOptional(J.CONTEXT_KEY))==null?void 0:t.f)??null}static requestRender(n,t){this.useRequest(n)(t)}},h(J,"CONTEXT_KEY","pluto-vis-renderer"),J);const Oi=f.z.object({props:w.wg.nullable(),state:w.bg.connectivity.connectionStateZ.nullable()}),ir={synnax:null,state:w.bg.connectivity.DEFAULT};var lt;let Ve=(lt=class extends w.Composite{constructor(){super(...arguments);h(this,"schema",lt.stateZ)}async afterUpdate(t){var r;if(t.setPreviously(or)||$n(t,ir),this.state.props==null){this.internal.synnax!=null&&(this.setState(s=>({...s,state:w.bg.connectivity.DEFAULT})),(r=this.internal.synnax)==null||r.close(),this.internal.synnax=null),$n(t,this.internal);return}this.prevState.props!=null&&sr.I.equal(this.state.props,this.prevState.props)&&this.internal.synnax!=null||(this.internal.synnax=new w.bg(this.state.props),this.internal.synnax.connectivity.onChange(s=>this.setState(a=>({...a,state:s}))),$n(t,this.internal))}},h(lt,"TYPE","synnax.Provider"),h(lt,"stateZ",Oi),lt);const or="pluto-client-context",$n=(e,n)=>e.set(or,n),Le=e=>e.get(or).synnax,Rs={[Ve.TYPE]:Ve},Di=Object.freeze(Object.defineProperty({__proto__:null,Provider:Ve,REGISTRY:Rs,ZERO_CONTEXT_VALUE:ir,use:Le},Symbol.toStringTag,{value:"Module"}));class ct extends ar.Observer{async cleanup(){}}class Xe extends ct{async set(){return await Promise.resolve()}}h(Xe,"TYPE","noop-boolean-sink");const Pn={type:Xe.TYPE,props:{},variant:"sink",valueType:"boolean"};class Ke extends ct{async set(){return await Promise.resolve()}}h(Ke,"TYPE","noop-numeric-sink");const Ys={type:Ke.TYPE,props:{},variant:"sink",valueType:"number"};class Je extends ct{async value(){return await Promise.resolve(!1)}}h(Je,"TYPE","noop-boolean-source");const lr={type:Je.TYPE,props:{},variant:"source",valueType:"boolean"};class Qe extends ct{async value(){return 0}}h(Qe,"TYPE","noop-numeric-source");const zs={type:Qe.TYPE,props:{},variant:"source",valueType:"number"};class tn extends ct{async value(){return""}}h(tn,"TYPE","noop-string-source");const Os={type:tn.TYPE,props:{},variant:"source",valueType:"string"};class en extends ct{async value(){return{key:"noop",variant:"disabled",message:"unknown",time:g.m.now()}}}h(en,"TYPE","noop-status-source");const cr={type:en.TYPE,props:{},variant:"source",valueType:"status"};class nn extends ct{async value(){return l.ZERO}}h(nn,"TYPE","noop-color-source");const kn={type:nn.TYPE,props:{},variant:"source",valueType:"color"};class rn extends ct{async value(){return[l.H.ZERO,[]]}}h(rn,"TYPE","noop-series");const Ds={type:rn.TYPE,props:{},variant:"source",valueType:"series"},Li={[Xe.TYPE]:Xe,[Ke.TYPE]:Ke,[Je.TYPE]:Je,[Qe.TYPE]:Qe,[en.TYPE]:en,[nn.TYPE]:nn,[tn.TYPE]:tn,[rn.TYPE]:rn};class Ls{constructor(){h(this,"type","noop")}create(n){const t=Li[n.type];return t==null?null:new t}}const Ai=f.z.instanceof(ArrayBuffer),Ae=f.z.object({type:f.z.string(),variant:f.z.enum(["source","sink","source-transformer","sink-transformer"]),valueType:f.z.string(),props:f.z.any(),transfer:f.z.array(Ai).optional()}),ut=Ae.extend({variant:f.z.literal("source")}),Rn=Ae.extend({variant:f.z.literal("sink")}),As=Ae.extend({variant:f.z.literal("source-transformer")}),$s=Ae.extend({variant:f.z.literal("sink-transformer")}),sn=ut.extend({valueType:f.z.literal("series")}),ur=ut.extend({valueType:f.z.literal("boolean")}),Yn=Rn.extend({valueType:f.z.literal("boolean")}),$i=$s.extend({valueType:f.z.literal("boolean")}),Ni=As.extend({valueType:f.z.literal("boolean")}),Ns=ut.extend({valueType:f.z.literal("number")}),Zs=Rn.extend({valueType:f.z.literal("number")}),hr=ut.extend({valueType:f.z.literal("color")}),dr=ut.extend({valueType:f.z.literal("status")}),fr=ut.extend({valueType:f.z.literal("string")});class zn extends ar.BaseObserver{constructor(t){super();h(this,"props_");h(this,"uProps_");h(this,"schema");this.uProps_=t}get props(){if(this.props_==null){const t=this._schema.safeParse(this.uProps_);if(t.success)this.props_=t.data;else throw new w.L(`[BaseTelem] - expected props to be valid, but found the following errors:
2
- ${t.error.message}`)}return this.props_}get _schema(){if(this.schema==null)throw new w.L(`[BaseTelem] - expected subclass to define props schema, but none was found.
3
- Make sure to define a property 'schema' on the class.`);return this.schema}async cleanup(){}}class H extends zn{}class On extends zn{}class wt extends H{constructor(){super(...arguments);h(this,"sources",{})}get source(){const[t]=Object.values(this.sources);if(t==null)throw new w.L("[UnarySourceTransformer] - expected source to exist, but none was found.");return t}async value(){return this.transform(await this.source.value())}onChange(t){return this.source.onChange(()=>{this.source.value().then(r=>{this.shouldNotify(r)&&t()}).catch(console.error)})}setSources(t){this.sources=t}shouldNotify(t){return!0}transform(t){throw new w.L(`[UnarySourceTransformer] - expected subclass to define transform method, but none was found.
4
- Make sure to define a method 'transform' on the class.`)}}class Is extends H{constructor(){super(...arguments);h(this,"sources",{})}async value(){const t=Object.fromEntries(await Promise.all(Object.entries(this.sources).map(async([r,s])=>[r,await s.value()])));return this.transform(t)}setSources(t){this.sources={...this.sources,...t}}transform(t){throw new w.L(`[MultiSourceTransformer] - expected subclass to define transform method, but none was found.
5
- Make sure to define a method 'transform' on the class.`)}}class Us extends zn{constructor(){super(...arguments);h(this,"sinks",{})}get sink(){const[t]=Object.values(this.sinks);if(t==null)throw new w.L("[UnarySinkTransformer] - expected sink to exist, but none was found.");return t}async set(t){return await this.sink.set(this.transform(t))}setSinks(t){this.sinks={...this.sinks,...t}}transform(t){throw new w.L(`[UnarySinkTransformer] - expected subclass to define transform method, but none was found.
6
- Make sure to define a method 'transform' on the class.`)}}const pr=f.z.object({from:f.z.string(),to:f.z.string()}),gr=f.z.object({connections:f.z.array(pr),outlet:f.z.string(),segments:f.z.record(ut)});class mr{constructor(n){h(this,"type","pipeline");h(this,"factory");this.factory=n}create(n){switch(n.type){case de.TYPE:return new de(n.props,this.factory);case fe.TYPE:return new fe(n.props,this.factory);default:return null}}}class de extends H{constructor(t,r){super(t);h(this,"schema",gr);h(this,"sources",{});const{connections:s,segments:a}=this.props;Object.entries(a).forEach(([i,o])=>{const c=r.create(o);c!=null&&(this.sources[i]=c)}),s.forEach(({from:i,to:o})=>{const c=this.sources[i],u=this.sources[o];c==null||u==null||"setSources"in u&&u.setSources({[i]:c})})}get outlet(){const{outlet:t}=this.props,r=this.sources[t];if(r==null)throw new w.L(`[SourcePipeline] - expected source to exist at outlet '${t}', but none was found.`);return r}async value(){return await this.outlet.value()}onChange(t){return this.outlet.onChange(t)}async cleanup(){await Promise.all(Object.values(this.sources).map(async t=>{var r;return await((r=t.cleanup)==null?void 0:r.call(t))}))}}h(de,"TYPE","source-pipeline");const Bs=(e,n)=>({variant:"source",props:n,type:de.TYPE,valueType:e}),yr=f.z.object({connections:f.z.array(pr),inlet:f.z.string(),segments:f.z.record(Rn)});class fe extends On{constructor(t,r){super(t);h(this,"schema",yr);h(this,"sinks",{});const{connections:s,segments:a}=this.props;Object.entries(a).forEach(([i,o])=>{const c=r.create(o);c!=null&&(this.sinks[i]=c)}),s.forEach(({from:i,to:o})=>{const c=this.sinks[i],u=this.sinks[o];c==null||u==null||"setSinks"in c&&c.setSinks({[o]:u})})}get inlet(){const{inlet:t}=this.props,r=this.sinks[t];if(r==null)throw new w.L(`[SinkPipeline] - expected source to exist at inlet '${t}', but none was found.`);return r}async set(t){return await this.inlet.set(t)}async cleanup(){await Promise.all(Object.values(this.sinks).map(async t=>{var r;return await((r=t.cleanup)==null?void 0:r.call(t))}))}}h(fe,"TYPE","sink-pipeline");const _s=(e,n)=>({variant:"sink",props:n,type:fe.TYPE,valueType:e}),wr=f.z.object({channel:f.z.number().or(f.z.string())});class pe extends H{constructor(t,r){super(r);h(this,"client");h(this,"removeStreamHandler",null);h(this,"channelKey",0);h(this,"schema",wr);h(this,"leadingBuffer",null);h(this,"valid",!1);this.client=t}get testingOnlyLeadingBuffer(){return this.leadingBuffer}get testingOnlyValid(){return this.valid}async cleanup(){var t,r;await((t=this.removeStreamHandler)==null?void 0:t.call(this)),this.valid=!1,(r=this.leadingBuffer)==null||r.release(),this.leadingBuffer=null,this.removeStreamHandler=null}async value(){if(g.w(this.props.channel))return 0;if(this.channelKey===0){const t=await br(this.client,this.props.channel,!1);if(t==null)return 0;this.channelKey=t.key}return this.valid||await this.read(),this.leadingBuffer==null||this.leadingBuffer.length===0?0:this.leadingBuffer.at(-1,!0)}async read(){this.valid=!0,await this.updateStreamHandler()}async updateStreamHandler(){var r;await((r=this.removeStreamHandler)==null?void 0:r.call(this));const t=s=>{var o;const i=s[this.channelKey].data;if(i.length!==0){const c=i[i.length-1];c.acquire(),(o=this.leadingBuffer)==null||o.release(),this.leadingBuffer=c}this.notify()};this.removeStreamHandler=await this.client.stream(t,[this.channelKey])}}h(pe,"TYPE","stream-channel-value");const br=async(e,n,t)=>{let r=await e.retrieveChannel(n);if(r==null)return null;if(!t||r.isIndex)return{key:r.key,dataType:r.dataType,virtual:r.virtual};if(w.Jg.isCalculated(r)){const s=await w.Jg.resolveCalculatedIndex(e.retrieveChannel.bind(e),r);if(s==null)throw new w.L("Cannot resolve calculated index");return r=await e.retrieveChannel(s),r==null?null:{key:r.key,dataType:g.g$1.TIMESTAMP,virtual:!1}}if(r.virtual)throw new w.L("Cannot plot data from virtual channels");return{key:r.index,dataType:g.g$1.TIMESTAMP,virtual:!1}},Zi=f.z.object({timeRange:g.U.z,channel:f.z.number().or(f.z.string()),useIndexOfChannel:f.z.boolean().optional().default(!1)});class ge extends H{constructor(t,r){super(r);h(this,"client");h(this,"data",[]);h(this,"valid",!1);h(this,"schema",Zi);this.client=t}async cleanup(){this.data.forEach(t=>t.release()),this.valid=!1}async value(){const{timeRange:t,channel:r,useIndexOfChannel:s}=this.props;if(t.isZero||r===0)return[l.H.ZERO,[]];const a=await br(this.client,r,s);if(a==null)return[l.H.ZERO,[]];this.valid||await this.readFixed(a.key);let i=l.H.max(this.data.map(o=>o.bounds));return a.dataType.equals(g.g$1.TIMESTAMP)&&(i={upper:Math.min(i.upper,Number(this.props.timeRange.end.valueOf())),lower:Math.max(i.lower,Number(this.props.timeRange.start.valueOf()))}),[i,this.data]}async readFixed(t){const s=(await this.client.read(this.props.timeRange,[t]))[t].data;s.forEach(a=>a.acquire()),this.data=s,this.valid=!0}}h(ge,"TYPE","series-source");const Ii=f.z.object({channel:f.z.number().or(f.z.string()),useIndexOfChannel:f.z.boolean().optional().default(!1),timeSpan:g.y$1.z,keepFor:g.y$1.z.optional()});class me extends H{constructor(t,r){super(r);h(this,"client");h(this,"data",[]);h(this,"stopStreaming");h(this,"valid",!1);h(this,"schema",Ii);this.client=t}async value(){const{channel:t,useIndexOfChannel:r,timeSpan:s}=this.props;if(t===0)return[l.H.ZERO,[]];const a=g.m.now(),i=await br(this.client,t,r);if(i==null)return[l.H.ZERO,[]];if(this.valid||await this.read(i),i.dataType.isVariable)return[l.H.ZERO,this.data];let o=l.H.max(this.data.filter(c=>c.timeRange.end.after(a.sub(s))).map(c=>c.bounds));return i.dataType.equals(g.g$1.TIMESTAMP)&&(o={upper:o.upper,lower:Math.max(o.lower,o.upper-Number(s.valueOf()))}),[o,this.data]}async read({key:t,virtual:r}){const s=g.m.now().spanRange(-this.props.timeSpan);if(!r){const i=(await this.client.read(s,[t]))[t].data;i.forEach(o=>o.acquire()),this.data.push(...i)}await this.updateStreamHandler(t),this.valid=!0}async updateStreamHandler(t){this.stopStreaming!=null&&await this.stopStreaming();const r=s=>{const a=s[t].data;a.forEach(i=>i.acquire()),this.data.push(...a),this.gcOutOfRangeData(),this.notify()};this.stopStreaming=await this.client.stream(r,[t])}gcOutOfRangeData(){const t=g.m.now().sub(this.props.keepFor??this.props.timeSpan),r=this.data.findIndex(s=>s.timeRange.end.before(t));r!==-1&&(this.data.splice(r,1).forEach(s=>s.release()),this.gcOutOfRangeData())}async cleanup(){var t;await((t=this.stopStreaming)==null?void 0:t.call(this)),this.stopStreaming=void 0,this.data.forEach(r=>r.release())}}h(me,"TYPE","dynamic-series-source");const Ui={[ge.TYPE]:ge,[me.TYPE]:me,[pe.TYPE]:pe};class Gs{constructor(n){h(this,"type","remote");h(this,"client");this.client=n}create(n){const t=Ui[n.type];return t==null?null:new t(this.client,n.props)}}const Fs=e=>({type:ge.TYPE,props:e,variant:"source",valueType:"series"}),Hs=e=>({type:me.TYPE,props:e,variant:"source",valueType:"series"}),qs=e=>({type:pe.TYPE,props:e,variant:"source",valueType:"number"});class js{constructor(){h(this,"type","static")}create(n){switch(n.type){case an.TYPE:return new an(n.props);case ye.TYPE:return new ye(n.props);case we.TYPE:return new we(n.props);case be.TYPE:return new be(n.props);case ve.TYPE:return new ve(n.props);default:return null}}}const vr=f.z.object({data:f.z.array(g.xt),offsets:f.z.array(f.z.number()).optional().default([])});class an extends H{constructor(t){super(t);h(this,"data");h(this,"schema",vr);this.data=this.props.data.map((r,s)=>new g.Z({data:r,dataType:g.g$1.FLOAT32,timeRange:g.U.ZERO,sampleOffset:this.props.offsets[s]??0}))}async value(){return[l.H.max(this.data.map(r=>r.bounds)),this.data]}}h(an,"TYPE","static-series");const Ws=vr.extend({rate:g.$.z,yOffset:f.z.number().optional().default(0),scroll:f.z.number().optional().default(0),startPosition:f.z.number().optional().default(0),scrollBounds:f.z.boolean().optional().default(!1)});class ye extends H{constructor(t){super(t);h(this,"schema",Ws);h(this,"position");h(this,"interval");h(this,"data");this.position=this.props.startPosition,this.start(this.props.rate),this.data=this.props.data.map((r,s)=>new g.Z({data:r,dataType:g.g$1.FLOAT32,timeRange:g.U.ZERO,sampleOffset:this.props.offsets[s]??0}))}async value(){const t=this.data.map(s=>s.slice(0,this.position));if(this.props.scrollBounds){const s=t[0].data[this.position-this.props.scroll<0?0:this.position-this.props.scroll],a=t[0].data[this.position-1];return[{lower:Number(s),upper:Number(a)},t]}return[l.H.max(t.map(s=>s.bounds)),t]}start(t){this.interval!=null&&clearInterval(this.interval),this.interval=setInterval(()=>{var r;(r=this.notify)==null||r.call(this),this.position++},t.period.milliseconds)}async cleanup(){clearInterval(this.interval),this.interval=void 0}}h(ye,"TYPE","iterative-series");const Vs=f.z.number();class we extends H{constructor(){super(...arguments);h(this,"schema",Vs)}async value(){return this.props}}h(we,"TYPE","static-numeric");const Xs=f.z.string();class be extends H{constructor(){super(...arguments);h(this,"schema",Xs)}async value(){return this.props}}h(be,"TYPE","static-string");const Ks=l.crudeZ;class ve extends H{constructor(){super(...arguments);h(this,"schema",Ks)}async value(){return new l.Color(this.props)}}h(ve,"TYPE","static-color");const Bi=e=>({type:an.TYPE,props:e,variant:"source",valueType:"series"}),_i=e=>({type:ye.TYPE,props:e,variant:"source",valueType:"series"}),Gi=e=>({type:we.TYPE,props:e,variant:"source",valueType:"number"}),Fi=e=>({type:be.TYPE,props:e,variant:"source",valueType:"string"}),Hi=e=>({type:ve.TYPE,props:e,variant:"source",valueType:"color"}),qi=["standard","scientific","engineering"],Js=f.z.enum(qi),ji=(e,n,t)=>{if(Number.isNaN(e))return"NaN";if(e===1/0)return"∞";if(e===-1/0)return"-∞";if(t==="standard")return e.toFixed(n);if(e===0)return n===0?"0ᴇ0":`0.${"0".repeat(n)}ᴇ0`;let r;return t==="scientific"?r=Math.floor(Math.log10(Math.abs(e))):r=Math.floor(Math.log10(Math.abs(e))/3)*3,`${(e/10**r).toFixed(n)}ᴇ${r}`};class Qs{constructor(){h(this,"type","transformer")}create(n){switch(n.type){case zt.TYPE:return new zt(n.props);case Ot.TYPE:return new Ot(n.props);case Dt.TYPE:return new Dt(n.props);case Lt.TYPE:return new Lt(n.props);case At.TYPE:return new At(n.props);case $t.TYPE:return new $t(n.props);case Nt.TYPE:return new Nt(n.props);case Zt.TYPE:return new Zt(n.props)}return null}}const Wi=f.z.object({truthy:f.z.number().optional().default(1),falsy:f.z.number().optional().default(0)}),ta=e=>({props:e,type:zt.TYPE,variant:"sink",valueType:"boolean"}),ne=class ne extends Us{constructor(){super(...arguments);h(this,"schema",ne.propsZ)}transform(t){return t?this.props.truthy:this.props.falsy}};h(ne,"TYPE","boolean-numeric-converter-sink"),h(ne,"propsZ",Wi);let zt=ne;const xr=f.z.object({trueBound:l.H.bounds}),ea=e=>({props:e,type:Ot.TYPE,variant:"source",valueType:"boolean"}),re=class re extends wt{constructor(){super(...arguments);h(this,"schema",re.propsZ);h(this,"curr",null)}shouldNotify(t){const r=l.H.contains(this.props.trueBound,t)!==this.curr;return this.curr=l.H.contains(this.props.trueBound,t),r}transform(t){return this.curr=l.H.contains(this.props.trueBound,t),this.curr}};h(re,"TYPE","boolean-source"),h(re,"propsZ",xr);let Ot=re;const na=f.z.object({}),se=class se extends Is{constructor(){super(...arguments);h(this,"schema",se.propsZ)}transform(t){return Object.values(t).reduce((r,s)=>r+s,0)/Object.keys(t).length}};h(se,"TYPE","mean"),h(se,"propsZ",na);let Dt=se;const Vi=e=>({props:e,type:Dt.TYPE,variant:"source",valueType:"boolean"}),ra=f.z.object({trueVariant:X.variantZ.optional().default("success")}),ae=class ae extends wt{constructor(){super(...arguments);h(this,"schema",ae.propsZ)}transform(t){return t.variant===this.props.trueVariant}};h(ae,"TYPE","boolean-status"),h(ae,"propsZ",ra);let Lt=ae;const Xi=e=>({props:e,type:Lt.TYPE,variant:"source",valueType:"boolean"}),Tr=f.z.object({precision:f.z.number().optional().default(2),prefix:f.z.string().optional().default(""),suffix:f.z.string().optional().default(""),notation:Js.optional().default("standard")}),ie=class ie extends wt{constructor(){super(...arguments);h(this,"schema",ie.propsZ)}transform(t){return`${this.props.prefix}${ji(t,this.props.precision,this.props.notation)}${this.props.suffix}`}};h(ie,"TYPE","stringify-number"),h(ie,"propsZ",Tr);let At=ie;const sa=e=>({props:e,type:At.TYPE,variant:"source",valueType:"string"}),Sr=f.z.object({windowSize:f.z.number().optional().default(5)});class $t extends wt{constructor(){super(...arguments);h(this,"schema",Sr);h(this,"values",[])}transform(t){return this.props.windowSize<2?t:this.values.reduce((r,s)=>r+s,0)/this.values.length}shouldNotify(t){return this.props.windowSize<2?!0:(this.values.length>this.props.windowSize&&(this.values=[]),this.values.push(t),this.values.length===this.props.windowSize)}}h($t,"TYPE","rolling-average"),h($t,"propsZ",na);const aa=e=>({props:e,type:$t.TYPE,variant:"source",valueType:"number"}),ia=f.z.object({gradient:l.gradientZ}),oe=class oe extends wt{constructor(){super(...arguments);h(this,"schema",oe.propsZ)}transform(t){return l.fromGradient(this.props.gradient,t)}};h(oe,"TYPE","color-gradient"),h(oe,"propsZ",ia);let Nt=oe;const oa=e=>({props:e,type:Nt.TYPE,variant:"source",valueType:"color"}),la=f.z.object({scale:l.b.transform}),le=class le extends wt{constructor(){super(...arguments);h(this,"schema",le.propsZ)}transform(t){const{offset:r,scale:s}=this.props.scale;return t*s+r}};h(le,"TYPE","scale-number"),h(le,"propsZ",la);let Zt=le;const ca=e=>({props:e,type:Zt.TYPE,variant:"source",valueType:"number"});class Cr{constructor(n){h(this,"factories");h(this,"type","compound");this.factories=n}add(n){this.factories=[...this.factories.filter(t=>t.type!==n.type),n]}create(n){for(const t of this.factories){const r=t.create(n);if(r!=null)return r}return null}}const ua=e=>{const n=[new Qs,new js,new Ls],t=new Cr(n);return e!=null&&t.add(new Gs(e)),t.add(new mr(t)),t};let ha=class da{constructor(n,t){h(this,"factory");h(this,"key");h(this,"parent");this.factory=n,this.key=g.Rt.create(),this.parent=t}child(n,t){const r=new Cr([...this.factory.factories,...ks.A(n)]);return r.add(new mr(r)),new da(r,t)}create(n){const t=this.factory.create(n);if(t==null)throw new w.Me(`Telemetry service could not find a source for type ${n.type}`);return t}};const Er="pluto-telem-context",Dn=e=>e.get(Er),fa=(e,n)=>e.set(Er,n),pa=(e,n,t)=>{var a;const r=Dn(e);if(r!=null&&t!=null&&r.key===((a=t==null?void 0:t.parent)==null?void 0:a.key))return t;const s=r.child(n,r);return e.set(Er,s),s};class ga{constructor(n,t,r){h(this,"spec");h(this,"wrapped");h(this,"prevProv");this.wrapped=n,this.spec=r,this.prevProv=t}shouldUpdate(n,t){return this.prevProv.key!==n.key||!sr.I.equal(this.spec,t)}}class qr extends ga{async value(){return await this.wrapped.value()}async cleanup(){var n,t;await((t=(n=this.wrapped).cleanup)==null?void 0:t.call(n))}onChange(n){return this.wrapped.onChange(n)}}class jr extends ga{async set(n){return await this.wrapped.set(n)}async cleanup(){var n,t;await((t=(n=this.wrapped).cleanup)==null?void 0:t.call(n))}}const j=async(e,n,t)=>{var s;const r=Dn(e);if(t instanceof qr){if(!t.shouldUpdate(r,n))return t;await((s=t.cleanup)==null?void 0:s.call(t))}return new qr(r.create(n),r,n)},$e=async(e,n,t)=>{var s;const r=Dn(e);if(t instanceof jr){if(!t.shouldUpdate(r,n))return t;await((s=t.cleanup)==null?void 0:s.call(t))}return new jr(r.create(n),r,n)},ma=f.z.object({include:f.z.string().array().optional(),exclude:f.z.string().array().optional(),level:f.z.enum(w.g.LOG_LEVELS).optional().default("info")}),Wn="alamos-provider";var qn;let Vn=(qn=class extends w.Composite{constructor(){super(...arguments);h(this,"schema",ma)}async afterUpdate(t){if(t.getOptional(Wn)!=null)return;const s=[],{include:a,exclude:i,level:o}=this.state;(a!=null||i!=null)&&s.push(w.g.logLevelKeyFiler({include:a,exclude:i})),o!=null&&s.push(w.g.logThresholdFilter(o)),s.length===0&&s.push(()=>!1),this.internal.ins=new w.g.Instrumentation({key:"aether",logger:new w.g.Logger({filters:s})}),t.set(Wn,this.internal.ins)}},h(qn,"TYPE","alamos.Provider"),qn);const Ne=(e,n)=>{const t=e.get(Wn);if(t==null)throw new Error("No instrumentation provider");return n==null?t:t.child(n)},Ki={[Vn.TYPE]:Vn},ya=(e,n)=>e.dataType.isVariable||e.dataType.equals(g.g$1.UINT8)?e:(n==null&&e.dataType.equals(g.g$1.TIMESTAMP)&&(n=BigInt(e.data[0])),e.convert(g.g$1.FLOAT32,n)),Ji=e=>e.isVariable||e.equals(g.g$1.UINT8)?e:g.g$1.FLOAT32,wa=()=>({purgedSeries:0,purgedBytes:g.C.bytes(0)}),ba={instrumentation:w.g.NOOP,staleEntryThreshold:g.y$1.seconds(20)};class Qi{constructor(n){h(this,"data",[]);h(this,"props");this.props={...ba,...n}}write(n){n.length!==0&&(n.forEach(t=>this.writeOne(ya(t))),this.checkIntegrity(n))}dirtyRead(n){const t=this.data.filter(({data:i})=>i.timeRange.overlapsWith(n)).map(({data:i})=>i);if(t.length===0)return{series:[],gaps:[n]};const r=t.map((i,o)=>o===0?g.U.ZERO:new g.U(t[o-1].timeRange.end,i.timeRange.start)).filter(i=>!i.isZero&&i.isValid),s=new g.U(n.start,t[0].timeRange.start),a=new g.U(t[t.length-1].timeRange.end,n.end);return s.isValid&&!s.isZero&&r.unshift(s),a.isValid&&!a.isZero&&r.push(a),{series:t,gaps:r}}gc(){const{staleEntryThreshold:n}=this.props,t=wa(),r=this.data.filter(s=>{const a=s.data.refCount>0||g.m.since(s.addedAt).lessThan(n);return a||(t.purgedBytes=t.purgedBytes.add(s.data.byteCapacity)),a});return t.purgedSeries=this.data.length-r.length,this.data=r,t}close(){this.data=[]}writeOne(n){const{instrumentation:{L:t}}=this.props;if(n.length===0)return;const r=l.H.buildInsertionPlan(this.data.map(c=>c.data.alignmentBounds),n.alignmentBounds);if(r===null)return t.debug("Found no viable insertion plan",{inserting:n.digest,cacheContents:this.data.map(c=>c.data.digest)});const{removeBefore:s,removeAfter:a,insertInto:i,deleteInBetween:o}=r;n=n.slice(s,n.data.length-Number(a)),n.length!==0&&this.data.splice(i,o,{data:n,addedAt:g.m.now()})}checkIntegrity(n){const{instrumentation:{L:t}}=this.props,r=this.data.map(a=>a.data.alignmentBounds);if(r.some((a,i)=>r.some((o,c)=>i===c?!1:l.H.overlapsWith(a,o))))throw t.debug("Cache is in an invalid state - bounds overlap!",()=>({write:n.map(a=>a.digest),cacheContents:this.data.map(a=>a.data.digest)})),new Error("Invalid state")}}const to=100,eo=1e6,no=1e4,ro=100,so=40;class ao{constructor(n){h(this,"props");h(this,"counter",0);h(this,"curr");h(this,"avgRate",0);h(this,"timeOfLastWrite");h(this,"totalWrites",0);h(this,"now",()=>g.m.now());this.props=n,this.curr=null,n.testingNow!=null&&(this.now=n.testingNow),this.timeOfLastWrite=this.now()}get length(){var n;return((n=this.curr)==null?void 0:n.length)??0}get leadingBuffer(){return this.curr}write(n){const t=n.flatMap(r=>this._write(r));return{flushed:t.flatMap(r=>r.flushed),allocated:t.flatMap(r=>r.allocated)}}allocate(n,t,r){this.counter++;const s=this.props.dataType.isVariable,a=this.props.dataType.equals(g.g$1.TIMESTAMP);return g.Z.alloc({capacity:s?n*so:n,dataType:Ji(this.props.dataType),timeRange:r.range(g.m.MAX),sampleOffset:a?BigInt(r.valueOf()):0,glBufferUsage:"dynamic",alignment:t,key:`dynamic-${this.counter}`})}_write(n){const t=this.nextBufferSize(),r={flushed:[],allocated:[]};if(this.curr==null)this.curr=this.allocate(t,n.alignment,this.now()),r.allocated.push(this.curr);else if(Math.abs(Number(this.curr.alignment+BigInt(this.curr.length)-n.alignment))>1){const c=this.now();this.curr.timeRange.end=c,r.flushed.push(this.curr),this.curr=this.allocate(t,n.alignment,c),r.allocated.push(this.curr)}const s=ya(n,this.curr.sampleOffset),a=this.curr.write(s);if(a===n.length)return this.updateAvgRate(n),r;const i=this.now();this.curr.timeRange.end=i,r.flushed.push(this.curr),this.curr=this.allocate(t,n.alignment+BigInt(a),i),r.allocated.push(this.curr);const o=this._write(n.slice(a));return r.flushed.push(...o.flushed),r.allocated.push(...o.allocated),r}updateAvgRate(n){if(typeof this.props.dynamicBufferSize=="number")return;const t=n.length/this.now().span(this.timeOfLastWrite).seconds;this.totalWrites>0&&isFinite(t)&&t>0&&(this.avgRate=(this.avgRate*(this.totalWrites-1)+t)/this.totalWrites),this.totalWrites++,this.timeOfLastWrite=this.now()}nextBufferSize(){const{dynamicBufferSize:n}=this.props;if(typeof n=="number")return n;if(this.totalWrites<ro)return no;const t=l.G$1.roundToNearestMagnitude(this.avgRate*n.seconds);return Math.round(Math.max(Math.min(t,eo),to))}close(){this.curr=null}}class io{constructor(n){h(this,"channel");h(this,"closed",!1);h(this,"ins");h(this,"static");h(this,"dynamic");this.channel=n.channel,this.ins=n.instrumentation??w.g.NOOP,this.static=new Qi(n),this.dynamic=new ao({dynamicBufferSize:n.dynamicBufferSize,dataType:this.channel.dataType})}writeDynamic(n){if(this.closed)return this.ins.L.warn(`Ignoring attempted dynamic write to a closed cache for channel ${this.channel.name}`),[];const{flushed:t,allocated:r}=this.dynamic.write(n);return t.length>0&&this.static.write(t),r}get leadingBuffer(){return this.dynamic.leadingBuffer}writeStatic(n){if(this.closed)return this.ins.L.warn(`Ignoring attempted static write to a closed cache for channel ${this.channel.name}`);this.static.write(n)}read(n){return this.closed?(this.ins.L.warn(`Ignoring attempted dirty read from a closed cache for channel ${this.channel.name}`),{series:[],gaps:[]}):this.static.dirtyRead(n)}gc(){return this.closed?(this.ins.L.warn(`Ignoring attempted garbage collection on a closed cache for channel ${this.channel.name}`),{purgedSeries:0,purgedBytes:g.C.bytes(0)}):this.static.gc()}close(){this.closed=!0,this.dynamic.close(),this.static.close()}}const oo=w.S.seconds(60);class lo{constructor(n){h(this,"props");h(this,"cache",new Map);h(this,"gcInterval");this.props={dynamicBufferSize:oo,gcInterval:w.S.seconds(30),...ba,...n},this.gcInterval=setInterval(()=>this.gc(),this.props.gcInterval.milliseconds)}async populateMissing(n){const{instrumentation:t,channelRetriever:r,dynamicBufferSize:s}=this.props,a=[];for(const o of n)this.cache.has(o)||a.push(o);if(a.length===0)return;const i=await r.retrieve(a);for(const o of i){const c=new io({channel:o,dynamicBufferSize:s,instrumentation:t.child(`cache-${o.name}-${o.key}`)});this.cache.has(o.key)||this.cache.set(o.key,c)}}get(n){const t=this.cache.get(n);if(t!=null)return t;throw new w.Me(`cache entry for ${n} not found`)}gc(){const{instrumentation:{L:n}}=this.props;n.info("starting garbage collection");const t=wa();this.cache.forEach(r=>{const s=r.gc();t.purgedSeries+=s.purgedSeries,t.purgedBytes=t.purgedBytes.add(s.purgedBytes)}),n.info("garbage collection complete",{purgedSeries:t.purgedSeries,purgedBytes:t.purgedBytes.toString()},!0)}close(){clearInterval(this.gcInterval),this.cache.forEach(n=>n.close()),this.cache.clear()}}class on{constructor(n,t){h(this,"channel");h(this,"data");this.channel=n,this.data=t}get timeRange(){if(this.data.length===0)return w.H.ZERO;const n=this.data[0].timeRange,t=this.data[this.data.length-1].timeRange;return new w.H(n.start,t.end)}get digest(){return{channel:this.channel.key,timeRange:this.timeRange.toPrettyString(),series:this.data.map(n=>n.digest)}}}const Nn=e=>e.map(n=>n.digest);class co{constructor(n){h(this,"props");h(this,"debouncedRead");h(this,"guarded",{mu:new w.Mutex,requests:new Map});this.props={instrumentation:w.g.NOOP,batchDebounce:g.y$1.milliseconds(50),...n},this.debouncedRead=Ps.o(()=>{this.batchRead()},this.props.batchDebounce.milliseconds)}async read(n,t){const{instrumentation:{L:r},cache:s}=this.props;r.debug("starting read",{tr:n.toPrettyString(),channels:t});const a=performance.now(),i=new Map,o={};await s.populateMissing(t);try{for(const d of t){const p=s.get(d),{series:m,gaps:b}=p.read(n);b.length===0&&(o[d]=new on(p.channel,m)),b.forEach(x=>{const S=i.get(x.toString());S==null?i.set(x.toString(),[x,new Set([d])]):i.set(x.toString(),[x,new Set([...S[1],d])])})}if(i.size===0)return r.debug("read satisfied by cache",()=>({tr:n.toPrettyString(),channels:t,responses:Nn(Object.values(o)),time:g.y$1.milliseconds(performance.now()-a).toString()})),o;r.debug("read cache miss",()=>({tr:n.toPrettyString(),channels:t,toFetch:Array.from(i.values()).map(([d,p])=>({timeRange:d.toPrettyString(),channels:p})),responses:Nn(Object.values(o))}));const{mu:c,requests:u}=this.guarded;for(const[,[d,p]]of i)await new Promise((m,b)=>{c.runExclusive(async()=>{u.set([d,p],{resolve:m,reject:b}),this.debouncedRead()})})}catch(c){throw r.error("read failed",{tr:n.toPrettyString(),channels:t,error:c}),c}for(const c of t){const u=s.get(c),{series:d}=u.read(n);o[c]=new on(u.channel,d)}return r.debug("read satisfied by fetch",()=>({tr:n.toPrettyString(),channels:t,responses:Nn(Object.values(o)),time:g.y$1.milliseconds(performance.now()-a).toString()})),o}async batchRead(){const{instrumentation:{L:n},readRemote:t,cache:r}=this.props,{mu:s,requests:a}=this.guarded;await s.runExclusive(async()=>{const i=[];try{a.forEach((o,c)=>{const[u,d]=c,p=i.find(([m])=>m.start.span(u.start).lessThan(g.y$1.milliseconds(5))&&m.end.span(u.end).lessThan(g.y$1.milliseconds(5)));p==null?i.push([u,d]):p[1]=new Set([...p[1],...d])}),n.debug("batch read",{toFetch:i.map(([o,c])=>({timeRange:o.toPrettyString(),channels:c}))});for(const[o,c]of i){const u=Array.from(c),d=await t(o,u);u.forEach(p=>{const m=r.get(p),b=d.get(p);m.writeStatic(b.series)})}a.forEach(o=>o.resolve())}catch(o){n.error("batch read failed",{error:o},!0),a.forEach(c=>c.reject(o))}finally{a.clear()}})}}class uo{constructor(n){h(this,"props");h(this,"mu",new w.Mutex);h(this,"listeners",new Map);h(this,"streamerRunLoop",null);h(this,"streamer",null);h(this,"closed",!1);this.props={instrumentation:w.g.NOOP,...n}}async stream(n,t){const{cache:r,instrumentation:{L:s}}=this.props;return await r.populateMissing(t),await this.mu.runExclusive(async()=>{s.debug("adding stream handler",{keys:t}),this.listeners.set(n,{valid:!0,keys:t});const a={};for(const i of t){const o=r.get(i),c=o.leadingBuffer!=null?[o.leadingBuffer]:[];a[i]=new on(o.channel,c)}return n(a),await this.updateStreamer(),async()=>await this.removeStreamHandler(n)})}async removeStreamHandler(n){const{instrumentation:{L:t}}=this.props;await this.mu.runExclusive(()=>{const r=this.listeners.get(n);r!=null&&(r.valid=!1)}),setTimeout(()=>{this.mu.runExclusive(async()=>{if(t.debug("removing stream handler"),this.listeners.delete(n))return await this.updateStreamer();t.warn("attempted to remove non-existent stream handler")})},5e3)}async updateStreamer(){var a,i;if(this.closed)return;const{instrumentation:{L:n},core:t}=this.props,r=new Set;if(this.listeners.forEach(o=>o.keys.forEach(c=>r.add(c))),r.size===0){n.info("no keys to stream, closing streamer"),(a=this.streamer)==null||a.close(),this.streamerRunLoop!=null&&await this.streamerRunLoop,this.streamer=null,n.info("streamer closed successfully");return}const s=Array.from(r);if(g.F.primitiveArrays(s,((i=this.streamer)==null?void 0:i.keys)??[])===g.F.EQUAL){n.debug("streamer keys unchanged",{keys:s});return}this.streamer==null&&(n.info("creating new streamer",{keys:s}),this.streamer=await t.openStreamer(s),this.streamerRunLoop=this.runStreamer(this.streamer)),n.debug("updating streamer",{prev:this.streamer.keys,next:s});try{await this.streamer.update(s)}catch(o){throw n.error("failed to update streamer",{error:o}),o}}async runStreamer(n){const{cache:t,instrumentation:{L:r}}=this.props;try{for await(const s of n){const a=[];for(const i of s.keys){const o=s.get(i),c=t.get(i),u=c.writeDynamic(o.series);a.push(new on(c.channel,u))}this.listeners.forEach((i,o)=>{if(!i.valid)return;const c=a.filter(d=>i.keys.includes(d.channel.key));if(c.length===0)return;const u=Object.fromEntries(c.map(d=>[d.channel.key,d]));o(u)})}}catch(s){throw r.error("streamer run loop failed",{error:s},!0),s}}async close(){var n;(n=this.streamer)==null||n.close(),this.streamerRunLoop!=null&&await this.streamerRunLoop,this.closed=!0}}class ho{constructor(){h(this,"key",g.Rt.create())}async retrieveChannel(){return null}async read(){return{}}async stream(){return async()=>{}}async close(){}}class fo{constructor({instrumentation:n,core:t}){h(this,"key",g.Rt.create());h(this,"ins");h(this,"cache");h(this,"reader");h(this,"streamer");h(this,"channelRetriever");this.ins=n??w.g.NOOP,this.channelRetriever=t.channels.createDebouncedBatchRetriever(10),this.cache=new lo({channelRetriever:this.channelRetriever,instrumentation:this.ins.child("cache")}),this.reader=new co({cache:this.cache,readRemote:async(r,s)=>await t.read(r,s),instrumentation:this.ins.child("reader")}),this.streamer=new uo({cache:this.cache,core:t,instrumentation:this.ins.child("streamer")})}async retrieveChannel(n){const t=await this.channelRetriever.retrieve([n]);if(t.length===0)throw new w.ie(`channel ${n} not found`);return t[0]}async read(n,t){return await this.reader.read(n,t)}async stream(n,t){return await this.streamer.stream(n,t)}async close(){this.ins.L.info("closing client",{key:this.key}),await this.streamer.close(),this.cache.close()}}const Mr=f.z.object({}),ce=class ce extends w.Composite{constructor(){super(...arguments);h(this,"schema",ce.stateZ);h(this,"prevClient",null)}async afterUpdate(t){const r=Le(t),s=Ne(t,"telem");if(this.internal.instrumentation=s.child("provider"),!(r!==this.prevClient))return;this.prevClient=r;const i=r==null?new ho:new fo({core:r,instrumentation:s}),o=ua(i),c=new ha(o);fa(t,c)}};h(ce,"TYPE","telem.Provider"),h(ce,"stateZ",Mr);let It=ce;const va={[It.TYPE]:It},po=Object.freeze(Object.defineProperty({__proto__:null,AbstractSink:On,AbstractSource:H,Base:zn,BaseProvider:It,BooleanStatus:Lt,ChannelData:ge,ColorGradient:Nt,CompoundTelemFactory:Cr,Context:ha,FixedColorSource:ve,FixedNumber:we,FixedString:be,IterativeSeries:ye,Mean:Dt,MultiSourceTransformer:Is,NoopFactory:Ls,PipelineFactory:mr,REGISTRY:va,RemoteFactory:Gs,RollingAverage:$t,ScaleNumber:Zt,SetPoint:zt,SinkPipeline:fe,SourcePipeline:de,StaticFactory:js,StreamChannelData:me,StreamChannelValue:pe,StringifyNumber:At,TransformerFactory:Qs,UnarySinkTransformer:Us,UnarySourceTransformer:wt,WithinBounds:Ot,booleanSinkSpecZ:Yn,booleanSinkTransformerSpecZ:$i,booleanSourceSpecZ:ur,booleanSourceTransformerSpecZ:Ni,booleanStatus:Xi,booleanStatusProps:ra,channelData:Fs,colorGradient:oa,colorGradientProps:ia,colorSourceSpecZ:hr,connectionZ:pr,createFactory:ua,fixedArray:Bi,fixedColor:Hi,fixedColorSourcePropsZ:Ks,fixedNumber:Gi,fixedNumberPropsZ:Vs,fixedSeriesPropsZ:vr,fixedString:Fi,fixedStringPropsZ:Xs,iterativeArray:_i,iterativeSeriesPropsZ:Ws,mean:Vi,noopBooleanSinkSpec:Pn,noopBooleanSourceSpec:lr,noopColorSourceSpec:kn,noopNumericSinkSpec:Ys,noopNumericSourceSpec:zs,noopSeriesSourceSpec:Ds,noopStatusSourceSpec:cr,noopStringSourceSpec:Os,numberSinkSpecZ:Zs,numberSourceSpecZ:Ns,providerStateZ:Mr,rollingAverage:aa,rollingAverageProps:Sr,scaleNumber:ca,scaleNumberProps:la,seriesSourceSpecZ:sn,setContext:fa,setpoint:ta,sinkPipeline:_s,sinkPipelinePropsZ:yr,sinkSpecZ:Rn,sinkTransformerSpecZ:$s,sourcePipeline:Bs,sourcePipelinePropsZ:gr,sourceSpecZ:ut,sourceTransformerSpecZ:As,specZ:Ae,statusSourceSpecZ:dr,streamChannelData:Hs,streamChannelValue:qs,streamChannelValuePropsZ:wr,stringSourceSpecZ:fr,stringifyNumber:sa,stringifyNumberProps:Tr,useChildContext:pa,useContext:Dn,useSink:$e,useSource:j,withinBounds:ea,withinBoundsProps:xr},Symbol.toStringTag,{value:"Module"})),xa=f.z.object({key:f.z.string(),size:f.z.number(),order:f.z.number(),loc:l.K.outer});f.z.record(xa);const pt=(e,n)=>Object.values(n).filter(({loc:t})=>t===e).sort((t,r)=>r.order-t.order),go=(e,n,t)=>{const r=n[e];if(r==null)return l.G.ZERO;const s=l.K.construct(r.loc),a=pt(s,n),i=l.K.construct(l.g.swap(l.K.direction(s))),o=pt(i,n),c=a.findIndex(({key:p})=>p===e),u=a.slice(0,c).reduce((p,{size:m})=>p+m,0),d=o.reduce((p,{size:m})=>p+m,0);switch(s){case"left":return l.G.translate(l.Mo.topLeft(t),[u,d]);case"right":return l.G.translate(l.Mo.topRight(t),[u-r.size,d]);case"top":return l.G.translate(l.Mo.topLeft(t),[d,u]);default:return l.G.translate(l.Mo.bottomLeft(t),[d,-u-r.size])}},mo=(e,n)=>{const t=pt("left",e),r=pt("right",e),s=pt("top",e),a=pt("bottom",e),i=t.reduce((d,{size:p})=>d+p,0),o=r.reduce((d,{size:p})=>d+p,0),c=s.reduce((d,{size:p})=>d+p,0),u=a.reduce((d,{size:p})=>d+p,0);return l.Mo.construct(l.G.translate(l.Mo.topLeft(n),{x:i,y:c}),l.Mo.width(n)-i-o,l.Mo.height(n)-c-u)};function We(e,n){return e==null||n==null?NaN:e<n?-1:e>n?1:e>=n?0:NaN}function yo(e,n){return e==null||n==null?NaN:n<e?-1:n>e?1:n>=e?0:NaN}function Pr(e){let n,t,r;e.length!==2?(n=We,t=(o,c)=>We(e(o),c),r=(o,c)=>e(o)-c):(n=e===We||e===yo?e:wo,t=e,r=e);function s(o,c,u=0,d=o.length){if(u<d){if(n(c,c)!==0)return d;do{const p=u+d>>>1;t(o[p],c)<0?u=p+1:d=p}while(u<d)}return u}function a(o,c,u=0,d=o.length){if(u<d){if(n(c,c)!==0)return d;do{const p=u+d>>>1;t(o[p],c)<=0?u=p+1:d=p}while(u<d)}return u}function i(o,c,u=0,d=o.length){const p=s(o,c,u,d-1);return p>u&&r(o[p-1],c)>-r(o[p],c)?p-1:p}return{left:s,center:i,right:a}}function wo(){return 0}function bo(e){return e===null?NaN:+e}const vo=Pr(We),xo=vo.right;Pr(bo).center;const To=Math.sqrt(50),So=Math.sqrt(10),Co=Math.sqrt(2);function ln(e,n,t){const r=(n-e)/Math.max(0,t),s=Math.floor(Math.log10(r)),a=r/Math.pow(10,s),i=a>=To?10:a>=So?5:a>=Co?2:1;let o,c,u;return s<0?(u=Math.pow(10,-s)/i,o=Math.round(e*u),c=Math.round(n*u),o/u<e&&++o,c/u>n&&--c,u=-u):(u=Math.pow(10,s)*i,o=Math.round(e/u),c=Math.round(n/u),o*u<e&&++o,c*u>n&&--c),c<o&&.5<=t&&t<2?ln(e,n,t*2):[o,c,u]}function Eo(e,n,t){if(n=+n,e=+e,t=+t,!(t>0))return[];if(e===n)return[e];const r=n<e,[s,a,i]=r?ln(n,e,t):ln(e,n,t);if(!(a>=s))return[];const o=a-s+1,c=new Array(o);if(r)if(i<0)for(let u=0;u<o;++u)c[u]=(a-u)/-i;else for(let u=0;u<o;++u)c[u]=(a-u)*i;else if(i<0)for(let u=0;u<o;++u)c[u]=(s+u)/-i;else for(let u=0;u<o;++u)c[u]=(s+u)*i;return c}function Xn(e,n,t){return n=+n,e=+e,t=+t,ln(e,n,t)[2]}function Kn(e,n,t){n=+n,e=+e,t=+t;const r=n<e,s=r?Xn(n,e,t):Xn(e,n,t);return(r?-1:1)*(s<0?1/-s:s)}function Ta(e,n){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(n).domain(e);break}return this}function kr(e,n,t){e.prototype=n.prototype=t,t.constructor=e}function Sa(e,n){var t=Object.create(e.prototype);for(var r in n)t[r]=n[r];return t}function Ze(){}var xe=.7,cn=1/xe,Yt="\\s*([+-]?\\d+)\\s*",Te="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Q="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Mo=/^#([0-9a-f]{3,8})$/,Po=new RegExp(`^rgb\\(${Yt},${Yt},${Yt}\\)$`),ko=new RegExp(`^rgb\\(${Q},${Q},${Q}\\)$`),Ro=new RegExp(`^rgba\\(${Yt},${Yt},${Yt},${Te}\\)$`),Yo=new RegExp(`^rgba\\(${Q},${Q},${Q},${Te}\\)$`),zo=new RegExp(`^hsl\\(${Te},${Q},${Q}\\)$`),Oo=new RegExp(`^hsla\\(${Te},${Q},${Q},${Te}\\)$`),Wr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};kr(Ze,Ut,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Vr,formatHex:Vr,formatHex8:Do,formatHsl:Lo,formatRgb:Xr,toString:Xr});function Vr(){return this.rgb().formatHex()}function Do(){return this.rgb().formatHex8()}function Lo(){return Ca(this).formatHsl()}function Xr(){return this.rgb().formatRgb()}function Ut(e){var n,t;return e=(e+"").trim().toLowerCase(),(n=Mo.exec(e))?(t=n[1].length,n=parseInt(n[1],16),t===6?Kr(n):t===3?new B(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):t===8?Ge(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):t===4?Ge(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=Po.exec(e))?new B(n[1],n[2],n[3],1):(n=ko.exec(e))?new B(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=Ro.exec(e))?Ge(n[1],n[2],n[3],n[4]):(n=Yo.exec(e))?Ge(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=zo.exec(e))?ts(n[1],n[2]/100,n[3]/100,1):(n=Oo.exec(e))?ts(n[1],n[2]/100,n[3]/100,n[4]):Wr.hasOwnProperty(e)?Kr(Wr[e]):e==="transparent"?new B(NaN,NaN,NaN,0):null}function Kr(e){return new B(e>>16&255,e>>8&255,e&255,1)}function Ge(e,n,t,r){return r<=0&&(e=n=t=NaN),new B(e,n,t,r)}function Ao(e){return e instanceof Ze||(e=Ut(e)),e?(e=e.rgb(),new B(e.r,e.g,e.b,e.opacity)):new B}function Jn(e,n,t,r){return arguments.length===1?Ao(e):new B(e,n,t,r??1)}function B(e,n,t,r){this.r=+e,this.g=+n,this.b=+t,this.opacity=+r}kr(B,Jn,Sa(Ze,{brighter(e){return e=e==null?cn:Math.pow(cn,e),new B(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?xe:Math.pow(xe,e),new B(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new B(mt(this.r),mt(this.g),mt(this.b),un(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Jr,formatHex:Jr,formatHex8:$o,formatRgb:Qr,toString:Qr}));function Jr(){return`#${gt(this.r)}${gt(this.g)}${gt(this.b)}`}function $o(){return`#${gt(this.r)}${gt(this.g)}${gt(this.b)}${gt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Qr(){const e=un(this.opacity);return`${e===1?"rgb(":"rgba("}${mt(this.r)}, ${mt(this.g)}, ${mt(this.b)}${e===1?")":`, ${e})`}`}function un(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function mt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function gt(e){return e=mt(e),(e<16?"0":"")+e.toString(16)}function ts(e,n,t,r){return r<=0?e=n=t=NaN:t<=0||t>=1?e=n=NaN:n<=0&&(e=NaN),new V(e,n,t,r)}function Ca(e){if(e instanceof V)return new V(e.h,e.s,e.l,e.opacity);if(e instanceof Ze||(e=Ut(e)),!e)return new V;if(e instanceof V)return e;e=e.rgb();var n=e.r/255,t=e.g/255,r=e.b/255,s=Math.min(n,t,r),a=Math.max(n,t,r),i=NaN,o=a-s,c=(a+s)/2;return o?(n===a?i=(t-r)/o+(t<r)*6:t===a?i=(r-n)/o+2:i=(n-t)/o+4,o/=c<.5?a+s:2-a-s,i*=60):o=c>0&&c<1?0:i,new V(i,o,c,e.opacity)}function No(e,n,t,r){return arguments.length===1?Ca(e):new V(e,n,t,r??1)}function V(e,n,t,r){this.h=+e,this.s=+n,this.l=+t,this.opacity=+r}kr(V,No,Sa(Ze,{brighter(e){return e=e==null?cn:Math.pow(cn,e),new V(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?xe:Math.pow(xe,e),new V(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,t=this.l,r=t+(t<.5?t:1-t)*n,s=2*t-r;return new B(Zn(e>=240?e-240:e+120,s,r),Zn(e,s,r),Zn(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new V(es(this.h),Fe(this.s),Fe(this.l),un(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=un(this.opacity);return`${e===1?"hsl(":"hsla("}${es(this.h)}, ${Fe(this.s)*100}%, ${Fe(this.l)*100}%${e===1?")":`, ${e})`}`}}));function es(e){return e=(e||0)%360,e<0?e+360:e}function Fe(e){return Math.max(0,Math.min(1,e||0))}function Zn(e,n,t){return(e<60?n+(t-n)*e/60:e<180?t:e<240?n+(t-n)*(240-e)/60:n)*255}const Rr=e=>()=>e;function Zo(e,n){return function(t){return e+t*n}}function Io(e,n,t){return e=Math.pow(e,t),n=Math.pow(n,t)-e,t=1/t,function(r){return Math.pow(e+r*n,t)}}function Uo(e){return(e=+e)==1?Ea:function(n,t){return t-n?Io(n,t,e):Rr(isNaN(n)?t:n)}}function Ea(e,n){var t=n-e;return t?Zo(e,t):Rr(isNaN(e)?n:e)}const Qn=function e(n){var t=Uo(n);function r(s,a){var i=t((s=Jn(s)).r,(a=Jn(a)).r),o=t(s.g,a.g),c=t(s.b,a.b),u=Ea(s.opacity,a.opacity);return function(d){return s.r=i(d),s.g=o(d),s.b=c(d),s.opacity=u(d),s+""}}return r.gamma=e,r}(1);function Bo(e,n){n||(n=[]);var t=e?Math.min(n.length,e.length):0,r=n.slice(),s;return function(a){for(s=0;s<t;++s)r[s]=e[s]*(1-a)+n[s]*a;return r}}function _o(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Go(e,n){var t=n?n.length:0,r=e?Math.min(t,e.length):0,s=new Array(r),a=new Array(t),i;for(i=0;i<r;++i)s[i]=Yr(e[i],n[i]);for(;i<t;++i)a[i]=n[i];return function(o){for(i=0;i<r;++i)a[i]=s[i](o);return a}}function Fo(e,n){var t=new Date;return e=+e,n=+n,function(r){return t.setTime(e*(1-r)+n*r),t}}function Se(e,n){return e=+e,n=+n,function(t){return e*(1-t)+n*t}}function Ho(e,n){var t={},r={},s;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(s in n)s in e?t[s]=Yr(e[s],n[s]):r[s]=n[s];return function(a){for(s in t)r[s]=t[s](a);return r}}var tr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,In=new RegExp(tr.source,"g");function qo(e){return function(){return e}}function jo(e){return function(n){return e(n)+""}}function Ma(e,n){var t=tr.lastIndex=In.lastIndex=0,r,s,a,i=-1,o=[],c=[];for(e=e+"",n=n+"";(r=tr.exec(e))&&(s=In.exec(n));)(a=s.index)>t&&(a=n.slice(t,a),o[i]?o[i]+=a:o[++i]=a),(r=r[0])===(s=s[0])?o[i]?o[i]+=s:o[++i]=s:(o[++i]=null,c.push({i,x:Se(r,s)})),t=In.lastIndex;return t<n.length&&(a=n.slice(t),o[i]?o[i]+=a:o[++i]=a),o.length<2?c[0]?jo(c[0].x):qo(n):(n=c.length,function(u){for(var d=0,p;d<n;++d)o[(p=c[d]).i]=p.x(u);return o.join("")})}function Yr(e,n){var t=typeof n,r;return n==null||t==="boolean"?Rr(n):(t==="number"?Se:t==="string"?(r=Ut(n))?(n=r,Qn):Ma:n instanceof Ut?Qn:n instanceof Date?Fo:_o(n)?Bo:Array.isArray(n)?Go:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?Ho:Se)(e,n)}function Wo(e,n){return e=+e,n=+n,function(t){return Math.round(e*(1-t)+n*t)}}function Vo(e){return function(){return e}}function Xo(e){return+e}var ns=[0,1];function Et(e){return e}function er(e,n){return(n-=e=+e)?function(t){return(t-e)/n}:Vo(isNaN(n)?NaN:.5)}function Ko(e,n){var t;return e>n&&(t=e,e=n,n=t),function(r){return Math.max(e,Math.min(n,r))}}function Jo(e,n,t){var r=e[0],s=e[1],a=n[0],i=n[1];return s<r?(r=er(s,r),a=t(i,a)):(r=er(r,s),a=t(a,i)),function(o){return a(r(o))}}function Qo(e,n,t){var r=Math.min(e.length,n.length)-1,s=new Array(r),a=new Array(r),i=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),n=n.slice().reverse());++i<r;)s[i]=er(e[i],e[i+1]),a[i]=t(n[i],n[i+1]);return function(o){var c=xo(e,o,1,r)-1;return a[c](s[c](o))}}function Pa(e,n){return n.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function tl(){var e=ns,n=ns,t=Yr,r,s,a,i=Et,o,c,u;function d(){var m=Math.min(e.length,n.length);return i!==Et&&(i=Ko(e[0],e[m-1])),o=m>2?Qo:Jo,c=u=null,p}function p(m){return m==null||isNaN(m=+m)?a:(c||(c=o(e.map(r),n,t)))(r(i(m)))}return p.invert=function(m){return i(s((u||(u=o(n,e.map(r),Se)))(m)))},p.domain=function(m){return arguments.length?(e=Array.from(m,Xo),d()):e.slice()},p.range=function(m){return arguments.length?(n=Array.from(m),d()):n.slice()},p.rangeRound=function(m){return n=Array.from(m),t=Wo,d()},p.clamp=function(m){return arguments.length?(i=m?!0:Et,d()):i!==Et},p.interpolate=function(m){return arguments.length?(t=m,d()):t},p.unknown=function(m){return arguments.length?(a=m,p):a},function(m,b){return r=m,s=b,d()}}function ka(){return tl()(Et,Et)}function el(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function hn(e,n){if((t=(e=n?e.toExponential(n-1):e.toExponential()).indexOf("e"))<0)return null;var t,r=e.slice(0,t);return[r.length>1?r[0]+r.slice(2):r,+e.slice(t+1)]}function Bt(e){return e=hn(Math.abs(e)),e?e[1]:NaN}function nl(e,n){return function(t,r){for(var s=t.length,a=[],i=0,o=e[0],c=0;s>0&&o>0&&(c+o+1>r&&(o=Math.max(1,r-c)),a.push(t.substring(s-=o,s+o)),!((c+=o+1)>r));)o=e[i=(i+1)%e.length];return a.reverse().join(n)}}function rl(e){return function(n){return n.replace(/[0-9]/g,function(t){return e[+t]})}}var sl=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function dn(e){if(!(n=sl.exec(e)))throw new Error("invalid format: "+e);var n;return new zr({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}dn.prototype=zr.prototype;function zr(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}zr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function al(e){t:for(var n=e.length,t=1,r=-1,s;t<n;++t)switch(e[t]){case".":r=s=t;break;case"0":r===0&&(r=t),s=t;break;default:if(!+e[t])break t;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(s+1):e}var Ra;function il(e,n){var t=hn(e,n);if(!t)return e+"";var r=t[0],s=t[1],a=s-(Ra=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,i=r.length;return a===i?r:a>i?r+new Array(a-i+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+hn(e,Math.max(0,n+a-1))[0]}function rs(e,n){var t=hn(e,n);if(!t)return e+"";var r=t[0],s=t[1];return s<0?"0."+new Array(-s).join("0")+r:r.length>s+1?r.slice(0,s+1)+"."+r.slice(s+1):r+new Array(s-r.length+2).join("0")}const ss={"%":(e,n)=>(e*100).toFixed(n),b:e=>Math.round(e).toString(2),c:e=>e+"",d:el,e:(e,n)=>e.toExponential(n),f:(e,n)=>e.toFixed(n),g:(e,n)=>e.toPrecision(n),o:e=>Math.round(e).toString(8),p:(e,n)=>rs(e*100,n),r:rs,s:il,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function as(e){return e}var is=Array.prototype.map,os=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ol(e){var n=e.grouping===void 0||e.thousands===void 0?as:nl(is.call(e.grouping,Number),e.thousands+""),t=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",s=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?as:rl(is.call(e.numerals,String)),i=e.percent===void 0?"%":e.percent+"",o=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(p){p=dn(p);var m=p.fill,b=p.align,x=p.sign,S=p.symbol,T=p.zero,Y=p.width,D=p.comma,P=p.precision,O=p.trim,$=p.type;$==="n"?(D=!0,$="g"):ss[$]||(P===void 0&&(P=12),O=!0,$="g"),(T||m==="0"&&b==="=")&&(T=!0,m="0",b="=");var C=S==="$"?t:S==="#"&&/[boxX]/.test($)?"0"+$.toLowerCase():"",N=S==="$"?r:/[%p]/.test($)?i:"",ht=ss[$],An=/[defgprs%]/.test($);P=P===void 0?6:/[gprs]/.test($)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function Be(M){var et=C,I=N,ot,_e,xt;if($==="c")I=ht(M)+I,M="";else{M=+M;var Tt=M<0||1/M<0;if(M=isNaN(M)?c:ht(Math.abs(M),P),O&&(M=al(M)),Tt&&+M==0&&x!=="+"&&(Tt=!1),et=(Tt?x==="("?x:o:x==="-"||x==="("?"":x)+et,I=($==="s"?os[8+Ra/3]:"")+I+(Tt&&x==="("?")":""),An){for(ot=-1,_e=M.length;++ot<_e;)if(xt=M.charCodeAt(ot),48>xt||xt>57){I=(xt===46?s+M.slice(ot+1):M.slice(ot))+I,M=M.slice(0,ot);break}}}D&&!T&&(M=n(M,1/0));var St=et.length+M.length+I.length,W=St<Y?new Array(Y-St+1).join(m):"";switch(D&&T&&(M=n(W+M,W.length?Y-I.length:1/0),W=""),b){case"<":M=et+M+I+W;break;case"=":M=et+W+M+I;break;case"^":M=W.slice(0,St=W.length>>1)+et+M+I+W.slice(St);break;default:M=W+et+M+I;break}return a(M)}return Be.toString=function(){return p+""},Be}function d(p,m){var b=u((p=dn(p),p.type="f",p)),x=Math.max(-8,Math.min(8,Math.floor(Bt(m)/3)))*3,S=Math.pow(10,-x),T=os[8+x/3];return function(Y){return b(S*Y)+T}}return{format:u,formatPrefix:d}}var He,Ya,za;ll({thousands:",",grouping:[3],currency:["$",""]});function ll(e){return He=ol(e),Ya=He.format,za=He.formatPrefix,He}function cl(e){return Math.max(0,-Bt(Math.abs(e)))}function ul(e,n){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Bt(n)/3)))*3-Bt(Math.abs(e)))}function hl(e,n){return e=Math.abs(e),n=Math.abs(n)-e,Math.max(0,Bt(n)-Bt(e))+1}function dl(e,n,t,r){var s=Kn(e,n,t),a;switch(r=dn(r??",f"),r.type){case"s":{var i=Math.max(Math.abs(e),Math.abs(n));return r.precision==null&&!isNaN(a=ul(s,i))&&(r.precision=a),za(r,i)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=hl(s,Math.max(Math.abs(e),Math.abs(n))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=cl(s))&&(r.precision=a-(r.type==="%")*2);break}}return Ya(r)}function fl(e){var n=e.domain;return e.ticks=function(t){var r=n();return Eo(r[0],r[r.length-1],t??10)},e.tickFormat=function(t,r){var s=n();return dl(s[0],s[s.length-1],t??10,r)},e.nice=function(t){t==null&&(t=10);var r=n(),s=0,a=r.length-1,i=r[s],o=r[a],c,u,d=10;for(o<i&&(u=i,i=o,o=u,u=s,s=a,a=u);d-- >0;){if(u=Xn(i,o,t),u===c)return r[s]=i,r[a]=o,n(r);if(u>0)i=Math.floor(i/u)*u,o=Math.ceil(o/u)*u;else if(u<0)i=Math.ceil(i*u)/u,o=Math.floor(o*u)/u;else break;c=u}return e},e}function Oa(){var e=ka();return e.copy=function(){return Pa(e,Oa())},Ta.apply(e,arguments),fl(e)}function pl(e,n){e=e.slice();var t=0,r=e.length-1,s=e[t],a=e[r],i;return a<s&&(i=t,t=r,r=i,i=s,s=a,a=i),e[t]=n.floor(s),e[r]=n.ceil(a),e}const Un=new Date,Bn=new Date;function L(e,n,t,r){function s(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return s.floor=a=>(e(a=new Date(+a)),a),s.ceil=a=>(e(a=new Date(a-1)),n(a,1),e(a),a),s.round=a=>{const i=s(a),o=s.ceil(a);return a-i<o-a?i:o},s.offset=(a,i)=>(n(a=new Date(+a),i==null?1:Math.floor(i)),a),s.range=(a,i,o)=>{const c=[];if(a=s.ceil(a),o=o==null?1:Math.floor(o),!(a<i)||!(o>0))return c;let u;do c.push(u=new Date(+a)),n(a,o),e(a);while(u<a&&a<i);return c},s.filter=a=>L(i=>{if(i>=i)for(;e(i),!a(i);)i.setTime(i-1)},(i,o)=>{if(i>=i)if(o<0)for(;++o<=0;)for(;n(i,-1),!a(i););else for(;--o>=0;)for(;n(i,1),!a(i););}),t&&(s.count=(a,i)=>(Un.setTime(+a),Bn.setTime(+i),e(Un),e(Bn),Math.floor(t(Un,Bn))),s.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?s.filter(r?i=>r(i)%a===0:i=>s.count(0,i)%a===0):s)),s}const fn=L(()=>{},(e,n)=>{e.setTime(+e+n)},(e,n)=>n-e);fn.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?L(n=>{n.setTime(Math.floor(n/e)*e)},(n,t)=>{n.setTime(+n+t*e)},(n,t)=>(t-n)/e):fn);fn.range;const nt=1e3,q=nt*60,rt=q*60,at=rt*24,Or=at*7,ls=at*30,_n=at*365,Mt=L(e=>{e.setTime(e-e.getMilliseconds())},(e,n)=>{e.setTime(+e+n*nt)},(e,n)=>(n-e)/nt,e=>e.getUTCSeconds());Mt.range;const Dr=L(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*nt)},(e,n)=>{e.setTime(+e+n*q)},(e,n)=>(n-e)/q,e=>e.getMinutes());Dr.range;const gl=L(e=>{e.setUTCSeconds(0,0)},(e,n)=>{e.setTime(+e+n*q)},(e,n)=>(n-e)/q,e=>e.getUTCMinutes());gl.range;const Lr=L(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*nt-e.getMinutes()*q)},(e,n)=>{e.setTime(+e+n*rt)},(e,n)=>(n-e)/rt,e=>e.getHours());Lr.range;const ml=L(e=>{e.setUTCMinutes(0,0,0)},(e,n)=>{e.setTime(+e+n*rt)},(e,n)=>(n-e)/rt,e=>e.getUTCHours());ml.range;const Ie=L(e=>e.setHours(0,0,0,0),(e,n)=>e.setDate(e.getDate()+n),(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*q)/at,e=>e.getDate()-1);Ie.range;const Ar=L(e=>{e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n)},(e,n)=>(n-e)/at,e=>e.getUTCDate()-1);Ar.range;const yl=L(e=>{e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n)},(e,n)=>(n-e)/at,e=>Math.floor(e/at));yl.range;function bt(e){return L(n=>{n.setDate(n.getDate()-(n.getDay()+7-e)%7),n.setHours(0,0,0,0)},(n,t)=>{n.setDate(n.getDate()+t*7)},(n,t)=>(t-n-(t.getTimezoneOffset()-n.getTimezoneOffset())*q)/Or)}const Ln=bt(0),pn=bt(1),wl=bt(2),bl=bt(3),_t=bt(4),vl=bt(5),xl=bt(6);Ln.range;pn.range;wl.range;bl.range;_t.range;vl.range;xl.range;function vt(e){return L(n=>{n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-e)%7),n.setUTCHours(0,0,0,0)},(n,t)=>{n.setUTCDate(n.getUTCDate()+t*7)},(n,t)=>(t-n)/Or)}const Da=vt(0),gn=vt(1),Tl=vt(2),Sl=vt(3),Gt=vt(4),Cl=vt(5),El=vt(6);Da.range;gn.range;Tl.range;Sl.range;Gt.range;Cl.range;El.range;const $r=L(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,n)=>{e.setMonth(e.getMonth()+n)},(e,n)=>n.getMonth()-e.getMonth()+(n.getFullYear()-e.getFullYear())*12,e=>e.getMonth());$r.range;const Ml=L(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCMonth(e.getUTCMonth()+n)},(e,n)=>n.getUTCMonth()-e.getUTCMonth()+(n.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Ml.range;const it=L(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n)},(e,n)=>n.getFullYear()-e.getFullYear(),e=>e.getFullYear());it.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:L(n=>{n.setFullYear(Math.floor(n.getFullYear()/e)*e),n.setMonth(0,1),n.setHours(0,0,0,0)},(n,t)=>{n.setFullYear(n.getFullYear()+t*e)});it.range;const yt=L(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n)},(e,n)=>n.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());yt.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:L(n=>{n.setUTCFullYear(Math.floor(n.getUTCFullYear()/e)*e),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},(n,t)=>{n.setUTCFullYear(n.getUTCFullYear()+t*e)});yt.range;function Pl(e,n,t,r,s,a){const i=[[Mt,1,nt],[Mt,5,5*nt],[Mt,15,15*nt],[Mt,30,30*nt],[a,1,q],[a,5,5*q],[a,15,15*q],[a,30,30*q],[s,1,rt],[s,3,3*rt],[s,6,6*rt],[s,12,12*rt],[r,1,at],[r,2,2*at],[t,1,Or],[n,1,ls],[n,3,3*ls],[e,1,_n]];function o(u,d,p){const m=d<u;m&&([u,d]=[d,u]);const b=p&&typeof p.range=="function"?p:c(u,d,p),x=b?b.range(u,+d+1):[];return m?x.reverse():x}function c(u,d,p){const m=Math.abs(d-u)/p,b=Pr(([,,T])=>T).right(i,m);if(b===i.length)return e.every(Kn(u/_n,d/_n,p));if(b===0)return fn.every(Math.max(Kn(u,d,p),1));const[x,S]=i[m/i[b-1][2]<i[b][2]/m?b-1:b];return x.every(S)}return[o,c]}const[kl,Rl]=Pl(it,$r,Ln,Ie,Lr,Dr);function Gn(e){if(0<=e.y&&e.y<100){var n=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return n.setFullYear(e.y),n}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Fn(e){if(0<=e.y&&e.y<100){var n=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return n.setUTCFullYear(e.y),n}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Kt(e,n,t){return{y:e,m:n,d:t,H:0,M:0,S:0,L:0}}function Yl(e){var n=e.dateTime,t=e.date,r=e.time,s=e.periods,a=e.days,i=e.shortDays,o=e.months,c=e.shortMonths,u=Jt(s),d=Qt(s),p=Jt(a),m=Qt(a),b=Jt(i),x=Qt(i),S=Jt(o),T=Qt(o),Y=Jt(c),D=Qt(c),P={a:Tt,A:St,b:W,B:yi,c:null,d:ps,e:ps,f:Ql,g:cc,G:hc,H:Xl,I:Kl,j:Jl,L:La,m:tc,M:ec,p:wi,q:bi,Q:ys,s:ws,S:nc,u:rc,U:sc,V:ac,w:ic,W:oc,x:null,X:null,y:lc,Y:uc,Z:dc,"%":ms},O={a:vi,A:xi,b:Ti,B:Si,c:null,d:gs,e:gs,f:mc,g:Mc,G:kc,H:fc,I:pc,j:gc,L:$a,m:yc,M:wc,p:Ci,q:Ei,Q:ys,s:ws,S:bc,u:vc,U:xc,V:Tc,w:Sc,W:Cc,x:null,X:null,y:Ec,Y:Pc,Z:Rc,"%":ms},$={a:Be,A:M,b:et,B:I,c:ot,d:ds,e:ds,f:ql,g:hs,G:us,H:fs,I:fs,j:_l,L:Hl,m:Bl,M:Gl,p:An,q:Ul,Q:Wl,s:Vl,S:Fl,u:Al,U:$l,V:Nl,w:Ll,W:Zl,x:_e,X:xt,y:hs,Y:us,Z:Il,"%":jl};P.x=C(t,P),P.X=C(r,P),P.c=C(n,P),O.x=C(t,O),O.X=C(r,O),O.c=C(n,O);function C(v,E){return function(k){var y=[],U=-1,z=0,G=v.length,F,dt,Hr;for(k instanceof Date||(k=new Date(+k));++U<G;)v.charCodeAt(U)===37&&(y.push(v.slice(z,U)),(dt=cs[F=v.charAt(++U)])!=null?F=v.charAt(++U):dt=F==="e"?" ":"0",(Hr=E[F])&&(F=Hr(k,dt)),y.push(F),z=U+1);return y.push(v.slice(z,U)),y.join("")}}function N(v,E){return function(k){var y=Kt(1900,void 0,1),U=ht(y,v,k+="",0),z,G;if(U!=k.length)return null;if("Q"in y)return new Date(y.Q);if("s"in y)return new Date(y.s*1e3+("L"in y?y.L:0));if(E&&!("Z"in y)&&(y.Z=0),"p"in y&&(y.H=y.H%12+y.p*12),y.m===void 0&&(y.m="q"in y?y.q:0),"V"in y){if(y.V<1||y.V>53)return null;"w"in y||(y.w=1),"Z"in y?(z=Fn(Kt(y.y,0,1)),G=z.getUTCDay(),z=G>4||G===0?gn.ceil(z):gn(z),z=Ar.offset(z,(y.V-1)*7),y.y=z.getUTCFullYear(),y.m=z.getUTCMonth(),y.d=z.getUTCDate()+(y.w+6)%7):(z=Gn(Kt(y.y,0,1)),G=z.getDay(),z=G>4||G===0?pn.ceil(z):pn(z),z=Ie.offset(z,(y.V-1)*7),y.y=z.getFullYear(),y.m=z.getMonth(),y.d=z.getDate()+(y.w+6)%7)}else("W"in y||"U"in y)&&("w"in y||(y.w="u"in y?y.u%7:"W"in y?1:0),G="Z"in y?Fn(Kt(y.y,0,1)).getUTCDay():Gn(Kt(y.y,0,1)).getDay(),y.m=0,y.d="W"in y?(y.w+6)%7+y.W*7-(G+5)%7:y.w+y.U*7-(G+6)%7);return"Z"in y?(y.H+=y.Z/100|0,y.M+=y.Z%100,Fn(y)):Gn(y)}}function ht(v,E,k,y){for(var U=0,z=E.length,G=k.length,F,dt;U<z;){if(y>=G)return-1;if(F=E.charCodeAt(U++),F===37){if(F=E.charAt(U++),dt=$[F in cs?E.charAt(U++):F],!dt||(y=dt(v,k,y))<0)return-1}else if(F!=k.charCodeAt(y++))return-1}return y}function An(v,E,k){var y=u.exec(E.slice(k));return y?(v.p=d.get(y[0].toLowerCase()),k+y[0].length):-1}function Be(v,E,k){var y=b.exec(E.slice(k));return y?(v.w=x.get(y[0].toLowerCase()),k+y[0].length):-1}function M(v,E,k){var y=p.exec(E.slice(k));return y?(v.w=m.get(y[0].toLowerCase()),k+y[0].length):-1}function et(v,E,k){var y=Y.exec(E.slice(k));return y?(v.m=D.get(y[0].toLowerCase()),k+y[0].length):-1}function I(v,E,k){var y=S.exec(E.slice(k));return y?(v.m=T.get(y[0].toLowerCase()),k+y[0].length):-1}function ot(v,E,k){return ht(v,n,E,k)}function _e(v,E,k){return ht(v,t,E,k)}function xt(v,E,k){return ht(v,r,E,k)}function Tt(v){return i[v.getDay()]}function St(v){return a[v.getDay()]}function W(v){return c[v.getMonth()]}function yi(v){return o[v.getMonth()]}function wi(v){return s[+(v.getHours()>=12)]}function bi(v){return 1+~~(v.getMonth()/3)}function vi(v){return i[v.getUTCDay()]}function xi(v){return a[v.getUTCDay()]}function Ti(v){return c[v.getUTCMonth()]}function Si(v){return o[v.getUTCMonth()]}function Ci(v){return s[+(v.getUTCHours()>=12)]}function Ei(v){return 1+~~(v.getUTCMonth()/3)}return{format:function(v){var E=C(v+="",P);return E.toString=function(){return v},E},parse:function(v){var E=N(v+="",!1);return E.toString=function(){return v},E},utcFormat:function(v){var E=C(v+="",O);return E.toString=function(){return v},E},utcParse:function(v){var E=N(v+="",!0);return E.toString=function(){return v},E}}}var cs={"-":"",_:" ",0:"0"},A=/^\s*\d+/,zl=/^%/,Ol=/[\\^$*+?|[\]().{}]/g;function R(e,n,t){var r=e<0?"-":"",s=(r?-e:e)+"",a=s.length;return r+(a<t?new Array(t-a+1).join(n)+s:s)}function Dl(e){return e.replace(Ol,"\\$&")}function Jt(e){return new RegExp("^(?:"+e.map(Dl).join("|")+")","i")}function Qt(e){return new Map(e.map((n,t)=>[n.toLowerCase(),t]))}function Ll(e,n,t){var r=A.exec(n.slice(t,t+1));return r?(e.w=+r[0],t+r[0].length):-1}function Al(e,n,t){var r=A.exec(n.slice(t,t+1));return r?(e.u=+r[0],t+r[0].length):-1}function $l(e,n,t){var r=A.exec(n.slice(t,t+2));return r?(e.U=+r[0],t+r[0].length):-1}function Nl(e,n,t){var r=A.exec(n.slice(t,t+2));return r?(e.V=+r[0],t+r[0].length):-1}function Zl(e,n,t){var r=A.exec(n.slice(t,t+2));return r?(e.W=+r[0],t+r[0].length):-1}function us(e,n,t){var r=A.exec(n.slice(t,t+4));return r?(e.y=+r[0],t+r[0].length):-1}function hs(e,n,t){var r=A.exec(n.slice(t,t+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),t+r[0].length):-1}function Il(e,n,t){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(t,t+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),t+r[0].length):-1}function Ul(e,n,t){var r=A.exec(n.slice(t,t+1));return r?(e.q=r[0]*3-3,t+r[0].length):-1}function Bl(e,n,t){var r=A.exec(n.slice(t,t+2));return r?(e.m=r[0]-1,t+r[0].length):-1}function ds(e,n,t){var r=A.exec(n.slice(t,t+2));return r?(e.d=+r[0],t+r[0].length):-1}function _l(e,n,t){var r=A.exec(n.slice(t,t+3));return r?(e.m=0,e.d=+r[0],t+r[0].length):-1}function fs(e,n,t){var r=A.exec(n.slice(t,t+2));return r?(e.H=+r[0],t+r[0].length):-1}function Gl(e,n,t){var r=A.exec(n.slice(t,t+2));return r?(e.M=+r[0],t+r[0].length):-1}function Fl(e,n,t){var r=A.exec(n.slice(t,t+2));return r?(e.S=+r[0],t+r[0].length):-1}function Hl(e,n,t){var r=A.exec(n.slice(t,t+3));return r?(e.L=+r[0],t+r[0].length):-1}function ql(e,n,t){var r=A.exec(n.slice(t,t+6));return r?(e.L=Math.floor(r[0]/1e3),t+r[0].length):-1}function jl(e,n,t){var r=zl.exec(n.slice(t,t+1));return r?t+r[0].length:-1}function Wl(e,n,t){var r=A.exec(n.slice(t));return r?(e.Q=+r[0],t+r[0].length):-1}function Vl(e,n,t){var r=A.exec(n.slice(t));return r?(e.s=+r[0],t+r[0].length):-1}function ps(e,n){return R(e.getDate(),n,2)}function Xl(e,n){return R(e.getHours(),n,2)}function Kl(e,n){return R(e.getHours()%12||12,n,2)}function Jl(e,n){return R(1+Ie.count(it(e),e),n,3)}function La(e,n){return R(e.getMilliseconds(),n,3)}function Ql(e,n){return La(e,n)+"000"}function tc(e,n){return R(e.getMonth()+1,n,2)}function ec(e,n){return R(e.getMinutes(),n,2)}function nc(e,n){return R(e.getSeconds(),n,2)}function rc(e){var n=e.getDay();return n===0?7:n}function sc(e,n){return R(Ln.count(it(e)-1,e),n,2)}function Aa(e){var n=e.getDay();return n>=4||n===0?_t(e):_t.ceil(e)}function ac(e,n){return e=Aa(e),R(_t.count(it(e),e)+(it(e).getDay()===4),n,2)}function ic(e){return e.getDay()}function oc(e,n){return R(pn.count(it(e)-1,e),n,2)}function lc(e,n){return R(e.getFullYear()%100,n,2)}function cc(e,n){return e=Aa(e),R(e.getFullYear()%100,n,2)}function uc(e,n){return R(e.getFullYear()%1e4,n,4)}function hc(e,n){var t=e.getDay();return e=t>=4||t===0?_t(e):_t.ceil(e),R(e.getFullYear()%1e4,n,4)}function dc(e){var n=e.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+R(n/60|0,"0",2)+R(n%60,"0",2)}function gs(e,n){return R(e.getUTCDate(),n,2)}function fc(e,n){return R(e.getUTCHours(),n,2)}function pc(e,n){return R(e.getUTCHours()%12||12,n,2)}function gc(e,n){return R(1+Ar.count(yt(e),e),n,3)}function $a(e,n){return R(e.getUTCMilliseconds(),n,3)}function mc(e,n){return $a(e,n)+"000"}function yc(e,n){return R(e.getUTCMonth()+1,n,2)}function wc(e,n){return R(e.getUTCMinutes(),n,2)}function bc(e,n){return R(e.getUTCSeconds(),n,2)}function vc(e){var n=e.getUTCDay();return n===0?7:n}function xc(e,n){return R(Da.count(yt(e)-1,e),n,2)}function Na(e){var n=e.getUTCDay();return n>=4||n===0?Gt(e):Gt.ceil(e)}function Tc(e,n){return e=Na(e),R(Gt.count(yt(e),e)+(yt(e).getUTCDay()===4),n,2)}function Sc(e){return e.getUTCDay()}function Cc(e,n){return R(gn.count(yt(e)-1,e),n,2)}function Ec(e,n){return R(e.getUTCFullYear()%100,n,2)}function Mc(e,n){return e=Na(e),R(e.getUTCFullYear()%100,n,2)}function Pc(e,n){return R(e.getUTCFullYear()%1e4,n,4)}function kc(e,n){var t=e.getUTCDay();return e=t>=4||t===0?Gt(e):Gt.ceil(e),R(e.getUTCFullYear()%1e4,n,4)}function Rc(){return"+0000"}function ms(){return"%"}function ys(e){return+e}function ws(e){return Math.floor(+e/1e3)}var Ct,Za;Yc({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Yc(e){return Ct=Yl(e),Za=Ct.format,Ct.parse,Ct.utcFormat,Ct.utcParse,Ct}function zc(e){return new Date(e)}function Oc(e){return e instanceof Date?+e:+new Date(+e)}function Ia(e,n,t,r,s,a,i,o,c,u){var d=ka(),p=d.invert,m=d.domain,b=u(".%L"),x=u(":%S"),S=u("%I:%M"),T=u("%I %p"),Y=u("%a %d"),D=u("%b %d"),P=u("%B"),O=u("%Y");function $(C){return(c(C)<C?b:o(C)<C?x:i(C)<C?S:a(C)<C?T:r(C)<C?s(C)<C?Y:D:t(C)<C?P:O)(C)}return d.invert=function(C){return new Date(p(C))},d.domain=function(C){return arguments.length?m(Array.from(C,Oc)):m().map(zc)},d.ticks=function(C){var N=m();return e(N[0],N[N.length-1],C??10)},d.tickFormat=function(C,N){return N==null?$:u(N)},d.nice=function(C){var N=m();return(!C||typeof C.range!="function")&&(C=n(N[0],N[N.length-1],C??10)),C?m(pl(N,C)):d},d.copy=function(){return Pa(d,Ia(e,n,t,r,s,a,i,o,c,u))},d}function Dc(){return Ta.apply(Ia(kl,Rl,it,$r,Ln,Ie,Lr,Dr,Mt,Za).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}const bs=[g.y$1.NANOSECOND,g.y$1.nanoseconds(2),g.y$1.nanoseconds(5),g.y$1.nanoseconds(10),g.y$1.nanoseconds(20),g.y$1.nanoseconds(50),g.y$1.nanoseconds(100),g.y$1.nanoseconds(200),g.y$1.nanoseconds(500),g.y$1.MICROSECOND,g.y$1.microseconds(2),g.y$1.microseconds(5),g.y$1.microseconds(10),g.y$1.microseconds(20),g.y$1.microseconds(50),g.y$1.microseconds(100),g.y$1.microseconds(200),g.y$1.microseconds(500),g.y$1.MILLISECOND,g.y$1.milliseconds(2),g.y$1.milliseconds(5),g.y$1.milliseconds(10),g.y$1.milliseconds(20),g.y$1.milliseconds(50),g.y$1.milliseconds(100),g.y$1.milliseconds(200),g.y$1.milliseconds(500),g.y$1.SECOND];class Lc{constructor(){h(this,"_domain");h(this,"_range");h(this,"_span");this._domain=[new g.m(0n),new g.m(1n)],this._range=[0,1],this._span=this._domain[1].span(this._domain[0])}domain(n){return n===void 0?this._domain:(this._domain=[new g.m(n[0]),new g.m(n[1])],this._span=this._domain[1].span(this._domain[0]),this)}range(n){return n===void 0?this._range:(this._range=n,this)}scale(n){const r=new g.m(n).valueOf(),s=this._domain[0].valueOf(),a=this._domain[1].valueOf()-s,i=this._range[1]-this._range[0];return Number(r-s)/Number(a)*i+this._range[0]}ticks(n){const t=this.calculateOptimalStep(n).valueOf(),r=this._domain[0].valueOf(),s=this._domain[1].valueOf(),a=(r+t-1n)/t*t,i=Number((s-a)/t);return Array.from({length:i+1},(o,c)=>{const u=a+BigInt(c)*t;return new g.m(u)}).filter(o=>o.afterEq(this._domain[0])&&o.beforeEq(this._domain[1]))}calculateOptimalStep(n){const t=this._span.valueOf()/BigInt(Math.ceil(n));let r=bs[0];for(const s of bs){if(s.valueOf()>t)break;r=s}return r}formatTick(n){return this._span.lessThan(g.y$1.microseconds(50))?`${n.remainder(g.y$1.MILLISECOND).microseconds.toString()}µs`:`${n.remainder(g.y$1.SECOND).milliseconds.toString()}ms`}}const Ac=()=>new Lc,Nr=f.z.enum(["linear","time"]),Zr=f.z.object({tickSpacing:f.z.number().default(75),type:Nr.optional().default("linear")}),nr=e=>{const n=Zr.parse(e);return Zc[n.type](n)};class $c{constructor(n){h(this,"props");this.props=n}create({decimalToDataScale:n,size:t}){const r=[0,t],s=new g.m(n.pos(0)),a=new g.m(n.pos(1));if(new g.y$1(a.sub(s)).milliseconds<5){const d=[s,a],p=Ac().domain(d).range(r),m=rr(t,this.props.tickSpacing)/2;return p.ticks(m).map(x=>({label:p.formatTick(x),position:p.scale(x)}))}const o=[s.date(),a.date()],c=Dc().domain(o).range(r);return c.ticks(rr(t,this.props.tickSpacing)).map(d=>({label:this.tickLabel(d),position:c(d)}))}tickLabel(n){const t=new g.m(n).date();let r=`:${t.getSeconds()}`;if(t.getMilliseconds()!==0){const a=Math.round(t.getMilliseconds()).toString().padStart(3,"0").replace(/0+$/,"");r+=`.${a}`}return t.getSeconds()===0&&t.getMilliseconds()===0&&(r=`${t.getHours()}:${t.getMinutes().toString().padStart(2,"0")}`),r}}class Nc{constructor(n){h(this,"props");this.props=n}create({decimalToDataScale:n,size:t}){const r=[0,t],s=[n.pos(0),n.pos(1)],a=Oa().domain(s).range(r),i=rr(t,this.props.tickSpacing);return a.ticks(i).map(c=>({label:this.tickLabel(c),position:a(c)}))}tickLabel(n){return n.toString()}}const rr=(e,n)=>{const t=Math.floor(e/n);return t>0?t:1},Zc={linear:e=>new Nc(e),time:e=>new $c(e)},Ir=Zr.extend({color:l.Color.z,type:Nr.optional().default("linear"),font:f.z.string(),showGrid:f.z.boolean().optional().default(!0),location:l.K.outer,gridColor:l.Color.z}),K=4;class vs{constructor(n,t){h(this,"numberDims");h(this,"negativeWidth");h(this,"periodWidth");h(this,"colonWidth");this.numberDims=ft.dimensions("0",t,n),this.negativeWidth=ft.dimensions("-",t,n).width,this.periodWidth=ft.dimensions(".",t,n).width,this.colonWidth=ft.dimensions(":",t,n).width}get(n){const t={width:0,height:this.numberDims.height};let r=n.length;return n.includes(".")&&(t.width+=this.periodWidth,r-=1),n.startsWith("-")&&(t.width+=this.negativeWidth,r-=1),n.includes(":")&&(t.width+=this.colonWidth,r-=1),t.width+=r*this.numberDims.width,t}}let Ua=class{constructor(n,t){h(this,"renderCtx");h(this,"state");h(this,"tickFactory");h(this,"dimensions");this.renderCtx=n,this.state=t,this.tickFactory=nr(this.state),this.dimensions=new vs(n.lower2d,t.font)}setState(n){this.state=w.prettyParse(Ir,n),this.tickFactory=nr(n),this.dimensions=new vs(this.renderCtx.lower2d,this.state.font)}render(n){const{lower2d:t}=this.renderCtx;switch(t.font=this.state.font,t.fillStyle=this.state.color.hex,t.lineWidth=1,this.state.location){case"left":return this.drawLeft(n);case"right":return this.drawRight(n);case"top":return this.drawTop(n);default:return this.drawBottom(n)}}drawBottom(n){const{lower2d:t}=this.renderCtx,{plot:r}=n,s=l.Mo.width(r),a=l.Mo.height(r),i=n.position,o=this.tickFactory.create({...n,size:s});return this.maybeDrawGrid(s,o,u=>[l.G.translate(i,"x",u.position),l.G.translate(i,{x:u.position,y:-a})]),t.strokeStyle=this.state.color.hex,this.drawLine(i,l.G.translate(i,"x",s)),{size:this.drawTicks(o,(u,d)=>{t.moveTo(i.x+d.position,i.y),t.lineTo(i.x+d.position,i.y+K),t.stroke(),t.fillText(d.label,i.x+d.position-u.width/2,i.y+10+u.height)}).height+K+6}}drawTop(n){const{lower2d:t}=this.renderCtx,{plot:r}=n,s=l.Mo.width(r),a=l.Mo.height(r),i=l.G.translate(n.position,"y",n.size),o=this.tickFactory.create({...n,size:s});return this.maybeDrawGrid(s,o,u=>[l.G.translate(i,"x",u.position),l.G.translate(i,{x:u.position,y:a})]),t.strokeStyle=this.state.color.hex,this.drawLine(i,l.G.translate(i,"x",s)),{size:this.drawTicks(o,(u,d)=>{t.moveTo(i.x+d.position,i.y),t.lineTo(i.x+d.position,i.y-K),t.stroke(),t.fillText(d.label,i.x+d.position-u.width/2,i.y-5-u.height)}).height+K}}drawLeft(n){const{lower2d:t}=this.renderCtx,{plot:r}=n,s=l.Mo.height(r),a=l.Mo.width(r),i=l.G.translate(n.position,"x",n.size),o=this.tickFactory.create({...n,size:s});return this.maybeDrawGrid(s,o,u=>[l.G.translate(i,"y",u.position),l.G.translate(i,{x:a,y:u.position})]),t.strokeStyle=this.state.color.hex,this.drawLine(i,l.G.translate(i,"y",s)),{size:this.drawTicks(o,(u,d)=>{t.moveTo(i.x,i.y+d.position),t.lineTo(i.x-K,i.y+d.position),t.stroke(),t.fillText(d.label,i.x-u.width-K*2,i.y+d.position+u.height/3)}).width+K*2}}drawRight(n){const{lower2d:t}=this.renderCtx,{plot:r}=n,s=l.Mo.height(r),a=l.Mo.width(r),i=n.position,o=this.tickFactory.create({...n,size:s});return this.maybeDrawGrid(s,o,u=>[l.G.translate(i,"y",u.position),l.G.translate(i,{x:-a,y:u.position})]),t.strokeStyle=this.state.color.hex,this.drawLine(i,l.G.translate(i,"y",s)),{size:this.drawTicks(o,(u,d)=>{t.moveTo(i.x,i.y+d.position),t.lineTo(i.x+K,i.y+d.position),t.stroke(),t.fillText(d.label,i.x+K+2,i.y+d.position+u.height/3)}).width+K*2}}drawLine(n,t){const{lower2d:r}=this.renderCtx;r.beginPath(),r.moveTo(...l.G.couple(n)),r.lineTo(...l.G.couple(t)),r.stroke()}drawTicks(n,t){let r=l._.ZERO;return n.forEach(s=>{const a=this.dimensions.get(s.label);r=l._.max([r,a]),t(a,s)}),r}maybeDrawGrid(n,t,r){const{showGrid:s,gridColor:a}=this.state;if(s){const i=l.H.construct(-1,1),o=l.H.construct(n-1,n+1);this.renderCtx.lower2d.strokeStyle=a.hex,t.filter(({position:c})=>!l.H.contains(i,c)&&!l.H.contains(o,c)).forEach(c=>this.drawLine(...r(c)))}}};const Ue=Ir.extend({bounds:l.H.bounds.optional(),autoBounds:f.z.object({lower:f.z.boolean().optional().default(!0),upper:f.z.boolean().optional().default(!0)}).or(f.z.boolean().optional().default(!0)),autoBoundPadding:f.z.number().optional(),autoBoundUpdateInterval:g.y$1.z.optional().default(g.y$1.seconds(10)),size:f.z.number().optional().default(0),label:f.z.string().optional().default(""),labelSize:f.z.number().optional().default(0)}).partial({color:!0,font:!0,gridColor:!0}),Ic=2,Uc=7,Ba=(e,n)=>l.H.contains({lower:e-Uc,upper:e+Ic},n),Bc=l.H.DECIMAL,xs=g.m.now(),_c={lower:Number(xs.valueOf()),upper:Number(xs.add(g.y$1.HOUR).valueOf())},_a=e=>e==="linear"?Bc:_c,Gc=(e,n=.1,t)=>{const r=l.H.max(e.filter(l.H.isFinite));if(!l.H.isFinite(r))return _a(t);const{lower:s,upper:a}=r;if(a===s)return{lower:s-1,upper:a+1};const i=(a-s)*n;return{lower:s-i,upper:a+i}},Fc=.01,Hc=.1;class Ga extends w.Composite{async afterUpdate(n){var r,s;this.internal.render=_.Context.use(n);const t=w.use(n);(r=this.state).autoBoundPadding??(r.autoBoundPadding=l.g.construct(this.state.location)==="x"?Hc:Fc),this.internal.core=new Ua(this.internal.render,{color:t.colors.gray.l8,font:ee.fontString(t,{level:"small"}),gridColor:t.colors.gray.l1,...this.state}),Z.requestRender(n,tt),(s=this.internal).updateBounds??(s.updateBounds=Ps.r(a=>this.setState(i=>({...i,bounds:a})),this.state.autoBoundUpdateInterval.milliseconds))}async afterDelete(n){Z.requestRender(n,tt)}renderAxis(n,t){if(!n.canvases.includes("lower2d"))return;const{core:r}=this.internal,{grid:s,container:a}=n,i=go(`${this.type}-${this.key}`,s,a),o={...n,position:i,decimalToDataScale:t,size:this.state.size+this.state.labelSize},{size:c}=r.render(o);Ba(this.state.size,c)||this.setState(u=>({...u,size:c}))}async bounds(n,t){var u,d;if(n&&this.internal.boundSnapshot!=null)return[this.internal.boundSnapshot,null];const{lower:r,upper:s}=Fa(this.state.autoBounds);if(!r&&!s&&this.state.bounds!=null)return this.internal.boundSnapshot=this.state.bounds,[this.state.bounds,null];const a=p=>({upper:s||this.state.bounds==null?p.upper:this.state.bounds.upper,lower:r||this.state.bounds==null?p.lower:this.state.bounds.lower});let i,o=null;try{const p=await t();i=Gc(p,this.state.autoBoundPadding,this.state.type)}catch(p){i=_a(this.state.type),o=p}const c=a(i);return this.internal.boundSnapshot=c,(this.state.bounds==null||r&&this.state.bounds.lower!==c.lower||s&&this.state.bounds.upper!==c.upper)&&((d=(u=this.internal).updateBounds)==null||d.call(u,c)),[c,o]}async dataToDecimalScale(n,t,r){const[s,a]=await this.bounds(n,t),i=l.g.swap(l.g.construct(this.state.location));return[l.b.Scale.scale(s).scale(1).translate(-l.Mo.root(r)[i]).magnify(1/l.Mo.dim(r,i)),a]}}const Fa=e=>typeof e=="boolean"?{lower:e,upper:e}:{lower:(e==null?void 0:e.lower)??!0,upper:(e==null?void 0:e.upper)??!0},Ts=`#version 300 es
7
- precision lowp float;
8
-
9
- uniform lowp vec4 u_color;
10
- out vec4 fragColor;
11
-
12
- void main(void) {
13
- fragColor = u_color;
14
- }
15
- `,qc=`#version 300 es
16
-
17
- // Copyright 2025 Synnax Labs, Inc.
18
- //
19
- // Use of this software is governed by the Business Source License included in the file
20
- // licenses/BSL.txt.
21
- //
22
- // As of the Change Date specified in that file, in accordance with the Business Source
23
- // License, use of this software will be governed by the Apache License, Version 2.0,
24
- // included in the file licenses/APL.txt.
25
-
26
- in mediump float a_x;
27
- in mediump float a_y;
28
- in mediump vec2 a_translate;
29
-
30
- uniform mediump vec2 u_scale_aggregate;
31
- uniform mediump vec2 u_offset_aggregate;
32
-
33
- void main(void) {
34
- gl_Position = vec4((u_scale_aggregate * vec2(a_x, a_y) + u_offset_aggregate) + a_translate, 0.0, 1.0);
35
- }
36
- `,jc=`#version 300 es
37
-
38
- // Copyright 2025 Synnax Labs, Inc.
39
- //
40
- // Use of this software is governed by the Business Source License included in the file
41
- // licenses/BSL.txt.
42
- //
43
- // As of the Change Date specified in that file, in accordance with the Business Source
44
- // License, use of this software will be governed by the Apache License, Version 2.0,
45
- // included in the file licenses/APL.txt.
46
-
47
- in mediump float a_x;
48
- in mediump uint a_y;
49
- in mediump vec2 a_translate;
50
-
51
- uniform mediump vec2 u_scale_aggregate;
52
- uniform mediump vec2 u_offset_aggregate;
53
-
54
- void main(void) {
55
- gl_Position = vec4((u_scale_aggregate * vec2(a_x, float(a_y)) + u_offset_aggregate) + a_translate, 0.0, 1.0);
56
- }
57
- `,Ha=f.z.object({x:sn,y:sn,label:f.z.string().optional(),color:l.Color.z,strokeWidth:f.z.number().default(1),downsample:f.z.number().min(1).max(50).optional().default(1),visible:f.z.boolean().optional().default(!0)}),Wc=(e,n,t)=>e===-1||n===-1||e>=t.length?NaN:Number(t[e].at(n)),Vc=g.y$1.milliseconds(2);l.G.NAN,l.G.NAN;const Xc=(e,n)=>n.equals(g.g$1.UINT8)?e.UNSIGNED_BYTE:e.FLOAT;class Ss extends _.GLProgram{constructor(t,r,s){super(t,r,s);h(this,"translationBufferCache",new Map);this.translationBufferCache=new Map}bindState({strokeWidth:t,color:r}){return this.uniformColor("u_color",r),this.attrStrokeWidth(t)}bindScale(t,r){const s=l.G.scale(t.scale,r.scale),a=l.G.translate(l.G.scale(r.scale,t.offset),r.offset);this.uniformXY("u_scale_aggregate",s),this.uniformXY("u_offset_aggregate",a)}draw({x:t,y:r,count:s,downsample:a,xOffset:i,yOffset:o},c,u,d){const{gl:p}=this.renderCtx;this.bindAttrBuffer("x",t.glBuffer,a,i,u),this.bindAttrBuffer("y",r.glBuffer,a,o,d),p.drawArraysInstanced(p.LINE_STRIP,0,s/a,c)}bindAttrBuffer(t,r,s,a=0,i){const{gl:o}=this.renderCtx;o.bindBuffer(o.ARRAY_BUFFER,r);const c=o.getAttribLocation(this.prog,`a_${t}`),u=Xc(o,i),d=i.density.valueOf();i.equals(g.g$1.UINT8)?o.vertexAttribIPointer(c,1,u,d*s,d*a):o.vertexAttribPointer(c,1,u,!1,d*s,d*a),o.enableVertexAttribArray(c)}getAndBindTranslationBuffer(t){const{gl:r}=this.renderCtx,s=`${this.renderCtx.aspect}:${t}`,a=this.translationBufferCache.get(s);if(a!=null)return r.bindBuffer(r.ARRAY_BUFFER,a.glBuffer),a;const i=r.createBuffer();if(i==null)throw new w.Me("Failed to create buffer from WebGL context");const o=Jc(this.renderCtx.aspect,t);r.bindBuffer(r.ARRAY_BUFFER,i),r.bufferData(r.ARRAY_BUFFER,o,r.DYNAMIC_DRAW);const c={glBuffer:i,jsBuffer:o};return this.translationBufferCache.set(s,c),c}attrStrokeWidth(t){const{gl:r}=this.renderCtx,{jsBuffer:s}=this.getAndBindTranslationBuffer(t),a=r.getAttribLocation(this.prog,"a_translate");return r.vertexAttribPointer(a,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(a),r.vertexAttribDivisor(a,1),s.length/2}}const Pt=class Pt{constructor(n){h(this,"uint8HybridProgram");h(this,"float32Program");this.uint8HybridProgram=new Ss(n,jc,Ts),this.float32Program=new Ss(n,qc,Ts)}get gl(){return this.uint8HybridProgram.renderCtx.gl}getProgram(n){return n.equals(g.g$1.UINT8)?this.uint8HybridProgram:this.float32Program}static create(n,t){const r=new Pt(t);return n.set(Pt.CONTEXT_KEY,r),r}static use(n){const t=n.get(Pt.CONTEXT_KEY);if(t==null)throw new w.Me("GLProgram not found");return t}};h(Pt,"CONTEXT_KEY","pluto-line-gl-program");let mn=Pt;class Ce extends w.Leaf{constructor(){super(...arguments);h(this,"schema",Ha)}async afterUpdate(t){var s,a;if(this.deleted)return;const{internal:r}=this;r.xTelem=await j(t,this.state.x,r.xTelem),r.yTelem=await j(t,this.state.y,r.yTelem),r.instrumentation=Ne(t,"line"),r.ctx=mn.use(t),r.requestRender=Z.useRequest(t),(s=r.stopListeningXTelem)==null||s.call(r),(a=r.stopListeningYTelem)==null||a.call(r),r.stopListeningXTelem=r.xTelem.onChange(()=>r.requestRender(jn)),r.stopListeningYTelem=r.yTelem.onChange(()=>r.requestRender(jn)),r.requestRender(tt)}async afterDelete(){var r,s,a,i;const{internal:t}=this;await((s=(r=t.xTelem).cleanup)==null?void 0:s.call(r)),await((i=(a=t.yTelem).cleanup)==null?void 0:i.call(a)),t.requestRender(tt)}async xBounds(){return(await this.internal.xTelem.value())[0]}async yBounds(){return(await this.internal.yTelem.value())[0]}async findByXValue(t,r){const{xTelem:s,yTelem:a}=this.internal,[,i]=await s.value();let[o,c]=[-1,-1];i.find((Y,D)=>{const P=Y.binarySearch(r),O=P>=0&&P<Y.length;return O&&([o,c]=[P,D]),O});const{key:u}=this,{color:d,label:p}=this.state,m={key:u,color:d,label:p,position:{x:0,y:0},value:{x:NaN,y:NaN}};if(o===-1||c===-1||!this.state.visible)return m;const b=i[c];m.value.x=Wc(c,o,i);const[,x]=await a.value(),S=x.find(Y=>l.H.contains(Y.alignmentBounds,b.alignment+BigInt(o)));if(S==null)return m;const T=Number(S.alignment-b.alignment);return m.value.y=Number(S.at(o-T)),m.position={x:t.dataToDecimalScale.x.pos(m.value.x),y:t.dataToDecimalScale.y.pos(m.value.y)},m}async render(t){if(this.deleted||!this.state.visible)return;const{downsample:r}=this.state,{xTelem:s,yTelem:a,ctx:i}=this.internal,{dataToDecimalScale:o,exposure:c}=t,[[,u],[,d]]=await Promise.all([s.value(),a.value()]);if(u.forEach(T=>T.updateGLBuffer(i.gl)),d.forEach(T=>T.updateGLBuffer(i.gl)),u.length===0||d.length===0)return;const p=i.getProgram(d[0].dataType),m=su(u,d,c,r,Vc);this.internal.instrumentation.L.debug("render",()=>({key:this.key,downsample:r,scale:o.transform,props:t.region,ops:au(m)}));const b=p.setAsActive(),x=p.bindState(this.state),S=p.renderCtx.scaleRegion(t.region).transform;m.forEach(T=>{const Y=nu(o,T).transform;p.bindScale(Y,S),p.draw(T,x,u[0].dataType,d[0].dataType)}),b()}}h(Ce,"TYPE","line");const Kc=5e3,Jc=(e,n)=>eu(tu(e),n).map((t,r)=>Math.floor(r/Qc)*(1/(Kc*e))*t),Qc=5,tu=e=>new Float32Array([0,0,0,e,0,-e,1,0,-1,0]),eu=(e,n)=>{const t=new Float32Array(e.length*n);for(let r=0;r<n;r++)t.set(e,r*e.length);return t},nu=(e,n)=>e.translate(e.x.dim(Number(n.x.sampleOffset)),e.y.dim(Number(n.y.sampleOffset))),ru={[Ce.TYPE]:Ce},su=(e,n,t,r,s)=>{if(e.length===0||n.length===0)return[];const a=[];return e.forEach(i=>n.forEach(o=>{if(!iu(i,o,s))return;let c=0,u=0;i.alignment<o.alignment?c=Number(o.alignment-i.alignment):o.alignment<i.alignment&&(u=Number(i.alignment-o.alignment));const d=Math.min(i.length-c,o.length-u);if(d===0)return;const p=l.Y(Math.round(t*4*d),r,51);a.push({x:i,y:o,xOffset:c,yOffset:u,count:d,downsample:p})})),a},au=e=>e.map(n=>({...n,x:n.x.digest,y:n.y.digest})),iu=(e,n,t)=>{if(!(e._timeRange!=null&&n._timeRange!=null))throw new w.Me(`Encountered series without time range in buildDrawOperations. X series present: ${e._timeRange!=null}, Y series present: ${n._timeRange!=null}`);const s=e.timeRange.overlapsWith(n.timeRange,t),a=l.H.overlapsWith(e.alignmentBounds,n.alignmentBounds);return s&&a};class Xt{constructor(n,t){h(this,"canvas");h(this,"theme");this.canvas=n,this.theme=t}rule({direction:n,region:t,position:r,...s}){return n==="x"?this.line({start:l.G.construct(l.Mo.left(t),r),end:l.G.construct(l.Mo.right(t),r),...s}):this.line({start:l.G.construct(r,l.Mo.top(t)),end:l.G.construct(r,l.Mo.bottom(t)),...s})}line({stroke:n,lineWidth:t,lineDash:r,start:s,end:a}){const i=this.canvas;i.strokeStyle=n.hex,i.lineWidth=t,i.setLineDash([r]),i.beginPath(),i.moveTo(...l.G.couple(s)),i.lineTo(...l.G.couple(a)),i.stroke()}circle({fill:n,radius:t,position:r}){const s=this.canvas;s.fillStyle=n.hex,s.beginPath(),s.arc(...l.G.couple(r),t,0,2*Math.PI),s.fill()}resolveColor(n,t){return n==null?this.resolveColor(t):typeof n=="function"?n(this.theme):new l.Color(n)}border({region:n,color:t,width:r,radius:s,location:a}){const i=this.canvas;i.strokeStyle=this.resolveColor(t,this.theme.colors.border).hex,i.lineWidth=r??this.theme.sizes.border.width,s??(s=this.theme.sizes.border.radius),a==null||a===!0?s>0?(i.roundRect(...l.G.couple(l.Mo.topLeft(n)),...l.G.couple(l.Mo.dims(n)),s),i.stroke()):(i.rect(...l.G.couple(l.Mo.topLeft(n)),...l.G.couple(l.Mo.dims(n))),i.stroke()):ks.A(a).forEach(o=>{const[c,u]=l.Mo.edgePoints(n,o);i.beginPath(),i.moveTo(...l.G.couple(c)),i.lineTo(...l.G.couple(u)),i.stroke()})}container({region:n,bordered:t=!0,rounded:r=!0,borderColor:s,borderRadius:a,borderWidth:i,backgroundColor:o}){a??(a=this.theme.sizes.border.radius),i??(i=1);const c=this.canvas;c.fillStyle=this.resolveColor(o,this.theme.colors.gray.l1).hex,c.strokeStyle=this.resolveColor(s,this.theme.colors.border).hex,c.setLineDash([]),c.lineWidth=1,c.beginPath(),r?c.roundRect(...l.G.couple(l.Mo.topLeft(n)),...l.G.couple(l.Mo.dims(n)),a):c.rect(...l.G.couple(l.Mo.topLeft(n)),...l.G.couple(l.Mo.dims(n))),c.fill(),t&&this.border({region:n,color:s,radius:a,width:i,location:t})}textContainer(n){const[t,r]=this.spacedTextDrawF(n);t.width+=12,t.height+=12;const{root:s=l.K.TOP_LEFT,offset:a=l.G.ZERO}=n,i={...n.position};s.x==="right"?i.x-=t.width+a.x:i.x+=a.x,s.y==="bottom"?i.y-=t.height+a.y:i.y+=a.y,this.container({region:l.Mo.construct(i,t.width,t.height),...n}),this.canvas.filter="none",r(l.G.translate(i,[6,6]))}spacedTextDrawF({text:n,direction:t,spacing:r=1,level:s="p"}){const a=ee.fontString(this.theme,{level:s}),i=n.map(u=>ft.dimensions(u,a,this.canvas)),o=this.theme.sizes.base*r,c=Math.max(...i.map(u=>u[l.g.dimension(t)]))+o;return[{[l.g.dimension(l.g.swap(t))]:Math.max(...i.map(u=>u[l.g.dimension(l.g.swap(t))])),[l.g.dimension(t)]:c*n.length-o},u=>{const d=ee.fontString(this.theme,{level:s});this.canvas.font=d,this.canvas.fillStyle=this.theme.colors.text.hex,this.canvas.textBaseline="top",n.forEach((p,m)=>{this.canvas.fillText(p,u.x,u.y+c*m)})}]}drawTextInCenter({box:n,text:t,level:r}){const s=ft.dimensions(t,this.canvas.font,this.canvas),a=l.Mo.positionInCenter(l.Mo.construct(l.G.ZERO,s),n);return this.text({text:t,position:l.Mo.topLeft(a),level:r})}text({text:n,position:t,level:r="p",weight:s,shade:a,maxWidth:i,code:o}){this.canvas.font=ee.fontString(this.theme,{level:r,weight:s,code:o}),a==null?this.canvas.fillStyle=this.theme.colors.text.hex:this.canvas.fillStyle=this.theme.colors.gray[`l${a}`].hex,this.canvas.textBaseline="top";let c;i!=null&&(c=this.canvas.scissor(l.Mo.construct(t,i,1e3))),this.canvas.fillText(n,t.x,t.y),c==null||c()}}const Ur=f.z.object({position:f.z.number().optional(),pixelPosition:f.z.number().optional(),dragging:f.z.boolean(),lineWidth:f.z.number().optional().default(1),lineDash:f.z.number().optional().default(20),color:l.Color.z}),ou=3;class Ft extends w.Leaf{constructor(){super(...arguments);h(this,"schema",Ur);h(this,"lastUpdateRef",null)}async afterUpdate(t){this.internal.renderCtx=_.Context.use(t);const r=w.use(t);this.internal.draw=new Xt(this.internal.renderCtx.upper2d,r),Z.requestRender(t,st)}async afterDelete(t){Z.requestRender(t,st)}updatePositions({decimalToDataScale:t,plot:r}){const s=this.state.dragging,a=this.prevState.dragging&&!s;if((s||a)&&this.state.pixelPosition!=null){if(this.lastUpdateRef??(this.lastUpdateRef=this.state.pixelPosition),Math.abs(this.state.pixelPosition-this.lastUpdateRef)<ou&&!a)return this.state.pixelPosition;this.lastUpdateRef=this.state.pixelPosition;const c=t.pos(this.state.pixelPosition/l.Mo.height(r));return this.setState(u=>({...u,position:c})),this.state.pixelPosition}if(this.state.position==null){const o=t.pos(.5);this.setState(c=>({...c,position:o}))}const i=t.reverse().pos(this.state.position)*l.Mo.height(r);if(!isNaN(i)){if(this.state.pixelPosition!=null&&Math.abs(i-this.state.pixelPosition)<1)return this.state.pixelPosition;this.setState(o=>({...o,pixelPosition:i}))}return i}async render(t){if(this.deleted)return;const{renderCtx:r}=this.internal,{location:s,plot:a}=t,i=l.K.direction(s),{upper2d:o}=r,c=this.internal.draw,u=this.updatePositions(t)+l.Mo.top(t.plot);c.rule({stroke:this.state.color,lineWidth:this.state.lineWidth,lineDash:this.state.lineDash,direction:i,region:a,position:u}),o.fillStyle=this.state.color.hex,o.lineJoin="round",o.lineWidth=3.5,o.lineCap="round",o.beginPath();const d=4;if(s==="left"){const p=l.Mo.left(a)-1;o.moveTo(p,u),o.lineTo(p-d,u-d),o.lineTo(p-d,u+d)}else s==="right"&&(o.moveTo(l.Mo.right(a),u),o.lineTo(l.Mo.right(a)+d,u-d),o.lineTo(l.Mo.right(a)+d,u+d));o.closePath(),o.stroke()}}h(Ft,"TYPE","Rule");const qa={[Ft.TYPE]:Ft},lu=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:qa,Rule:Ft,ruleStateZ:Ur},Symbol.toStringTag,{value:"Module"})),cu=Ue.extend({location:l.K.x.optional().default("left")}),Cs=2,uu=e=>l.Mo.signedWidth(e)<Cs||l.Mo.signedHeight(e)<Cs;class Ee extends Ga{constructor(){super(...arguments);h(this,"schema",Ue)}async xBounds(){return l.H.max((await Promise.all(this.lines.map(async t=>await t.xBounds()))).filter(t=>l.H.isFinite(t)))}async render(t){if(this.deleted)return;const[r,s]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport),a=r.invert().reverse();if(this.renderAxis(t,a),await this.renderLines(t,r),await this.renderRules(t,a),s!=null)throw s}async renderLines({xDataToDecimalScale:t,plot:r,canvases:s,exposure:a},i){if(!s.includes("gl")||uu(r))return;const o={region:r,dataToDecimalScale:new l.b.XY(t,i),exposure:a};await Promise.all(this.lines.map(async c=>await c.render(o)))}async renderRules({container:t,plot:r,canvases:s},a){if(!s.includes("upper2d"))return;const{location:i}=this.state,{render:o}=this.internal,c=l.Mo.construct(l.Mo.left(t),l.Mo.top(r),l.Mo.width(t),l.Mo.height(r)),u=o.scissor(c,l.G.ZERO,["upper2d"]),d={container:t,plot:r,decimalToDataScale:a,location:i};await Promise.all(this.rules.map(async p=>await p.render(d))),u()}async findByXValue({xDataToDecimalScale:t,plot:r,viewport:s,hold:a,exposure:i},o){const[c,u]=await this.dataToDecimalScale(a,this.dataBounds.bind(this),s);if(u!=null)throw u;const d=new l.b.XY(t,c),p={region:r,dataToDecimalScale:d,exposure:i};return(await Promise.all(this.lines.map(async m=>await m.findByXValue(p,o)))).map(m=>({...m,units:this.state.label}))}async dataBounds(){return await Promise.all(this.lines.map(async t=>await t.yBounds()))}get lines(){return this.childrenOfType(Ce.TYPE)}get rules(){return this.childrenOfType(Ft.TYPE)}}h(Ee,"TYPE","YAxis");const ja=f.z.object({start:g.m.z,end:g.m.z});class yn extends w.Leaf{constructor(){super(...arguments);h(this,"schema",ja)}async afterUpdate(t){this.internal.render=_.Context.use(t),this.internal.draw=new Xt(this.internal.render.upper2d,w.use(t))}async render(){}}h(yn,"TYPE","range-annotation");const hu=w.bm.payloadZ.extend({viewport:l.H.bounds}),Es=e=>l.Color.z.safeParse(e).success,Wa=f.z.object({cursor:l.G.xy.or(f.z.null()),hovered:hu.or(f.z.null()),count:f.z.number()});class Me extends w.Leaf{constructor(){super(...arguments);h(this,"schema",Wa);h(this,"fetchedInitial",g.U.ZERO)}async afterUpdate(t){const{internal:r}=this;r.render=_.Context.use(t),r.draw=new Xt(r.render.upper2d,w.use(t)),r.ranges??(r.ranges=new Map);const s=Le(t);s!=null&&(r.client=s,r.tracker==null&&(r.tracker=await r.client.ranges.openTracker(),r.tracker.onChange(a=>{a.forEach(i=>{i.variant==="delete"?r.ranges.delete(i.key):Es(i.value.color)&&r.ranges.set(i.key,i.value)}),Z.requestRender(t,st),this.setState(i=>({...i,count:r.ranges.size}))}),Z.requestRender(t,st)))}async fetchInitial(t){const{internal:r}=this;if(r.client==null||this.fetchedInitial.roughlyEquals(t,g.y$1.minutes(1)))return;this.fetchedInitial=t,(await r.client.ranges.retrieve(t)).forEach(a=>{Es(a.color)&&r.ranges.set(a.key,a)}),this.setState(a=>({...a,count:r.ranges.size}))}async render(t){const{dataToDecimalScale:r,region:s,viewport:a,timeRange:i}=t;await this.fetchInitial(i);const{draw:o,ranges:c}=this.internal,u=r.scale(l.Mo.xBounds(s)),d=this.state.cursor==null?null:this.state.cursor.x;let p=null;const m=o.canvas.scissor(l.Mo.construct({x:l.Mo.left(s),y:l.Mo.top(s)-35},{x:l.Mo.right(s),y:l.Mo.bottom(s)}));c.forEach(b=>{const x=l.Color.z.safeParse(b.color);if(!x.success)return;const S=x.data;let T=u.pos(Number(b.timeRange.start.valueOf()));const Y=u.pos(Number(b.timeRange.end.valueOf()));if(Y<l.Mo.left(s)||T>l.Mo.right(s))return;T=l.Y(T,l.Mo.left(s)-2,l.Mo.right(s)-1);let D=!1;d!=null&&(D=l.H.contains({lower:T,upper:Y},d)),D&&(p={key:b.key,name:b.name,color:b.color,timeRange:b.timeRange,viewport:{lower:r.scale(l.Mo.xBounds(a)).pos(Number(b.timeRange.start.valueOf())),upper:r.scale(l.Mo.xBounds(a)).pos(Number(b.timeRange.end.valueOf()))}}),o.container({region:l.Mo.construct({x:T,y:l.Mo.top(s)-1},{x:Y,y:l.Mo.bottom(s)-1}),backgroundColor:S.setAlpha(.2),bordered:!1});const P=l.Mo.construct({x:T+1,y:l.Mo.top(s)-34},{x:Y-1,y:l.Mo.top(s)-12});o.container({region:P,backgroundColor:l.Mo.width(P)<20?S.setAlpha(.4):O=>D?O.colors.gray.l2:O.colors.gray.l0,bordered:!0,borderWidth:1,borderRadius:2,borderColor:S.setAlpha(.8)}),o.text({text:b.name,position:{x:T+8,y:l.Mo.top(s)-30},level:"small",shade:8,weight:500,maxWidth:Y-T-16})}),m(),p!=null?this.setState(b=>({...b,hovered:p})):this.state.hovered&&this.setState(b=>({...b,hovered:null}))}}h(Me,"TYPE","range-provider");const du={[yn.TYPE]:yn,[Me.TYPE]:Me},fu=Ue;class Pe extends Ga{constructor(){super(...arguments);h(this,"schema",Ue)}async render(t){if(this.deleted)return;const[r,s]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport);if(this.renderAxis(t,r.reverse()),await this.renderYAxes(t,r),await this.renderRangeAnnotations(t,r),s!=null)throw s}async findByXDecimal(t,r){const[s,a]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport);if(a!=null)throw a;return await this.findByXValue(t,s.reverse().pos(r))}async findByXValue(t,r){const[s,a]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport);if(a!=null)throw a;const i={...t,xDataToDecimalScale:s},o=this.yAxes.map(async c=>await c.findByXValue(i,r));return(await Promise.all(o)).flat()}async renderYAxes(t,r){const s={...t,xDataToDecimalScale:r};await Promise.all(this.yAxes.map(async a=>await a.render(s)))}get yAxes(){return this.childrenOfType(Ee.TYPE)}get rangeAnnotations(){return this.childrenOfType(Me.TYPE)}async renderRangeAnnotations(t,r){const[s,a]=await this.bounds(t.hold,this.dataBounds.bind(this));if(a!=null)throw a;await Promise.all(this.rangeAnnotations.map(async i=>await i.render({dataToDecimalScale:r,region:t.plot,viewport:t.viewport,timeRange:new g.U(s.lower,s.upper)})))}async dataBounds(){return await Promise.all(this.yAxes.map(async t=>await t.xBounds()))}}h(Pe,"TYPE","XAxis");const Br=f.z.object({position:l.G.xy.or(f.z.null()),textColor:l.Color.z.optional().default(l.ZERO),backgroundColor:l.Color.z.optional().default(l.ZERO),borderColor:l.Color.z.optional().default(l.ZERO),ruleColor:l.Color.z.optional().default(l.ZERO),ruleStrokeWidth:f.z.number().optional().default(1),ruleStrokeDash:f.z.number().default(0)});class Ht extends w.Leaf{constructor(){super(...arguments);h(this,"schema",Br)}async afterUpdate(t){const r=w.use(t);this.state.textColor.isZero&&(this.state.textColor=r.colors.text),this.state.backgroundColor.isZero&&(this.state.backgroundColor=r.colors.gray.l1),this.state.borderColor.isZero&&(this.state.borderColor=r.colors.border),this.state.ruleColor.isZero&&(this.state.ruleColor=r.colors.gray.l5),this.internal.dotColor=r.colors.text,this.internal.dotColorContrast=r.colors.textInverted,this.internal.render=_.Context.use(t),this.internal.draw=new Xt(this.internal.render.upper2d,r),Z.requestRender(t,st)}async afterDelete(t){Z.requestRender(t,st)}async render(t){if(this.deleted||this.state.position==null)return;const{region:r}=t,s=l.b.XY.scale(l.Mo.DECIMAL).scale(r),a=l.b.XY.scale(r).scale(l.Mo.DECIMAL),i=await t.findByXDecimal(a.x.pos(this.state.position.x)),o=i.filter(S=>l.G.isFinite(S.value)),{draw:c}=this.internal,u=o.reduce((S,T)=>S+T.position.x,0)/o.length,d=new g.m(o.reduce((S,T)=>S+T.value.x,0)/o.length),p=s.x.pos(u);if(!l.H.contains(l.Mo.xBounds(r),p))return;c.rule({stroke:this.state.ruleColor,lineWidth:this.state.ruleStrokeWidth,lineDash:this.state.ruleStrokeDash,direction:"y",region:r,position:p}),o.forEach(S=>{const T=s.pos(S.position);c.circle({fill:S.color.setAlpha(.5),radius:8,position:T}),c.circle({fill:S.color.setAlpha(.8),radius:5,position:T}),c.circle({fill:S.color.pickByContrast(this.internal.dotColor,this.internal.dotColorContrast),radius:2,position:T})});const m=i.map(S=>`${S.label??""}: ${S.value.y.toFixed(2)}`),b=new g.y$1(d).remainder(g.y$1.SECOND).milliseconds;m.unshift(`Time: ${d.fString("dateTime","local")} ${b.toString().slice(0,7)} ms`);const x=a.pos(this.state.position);c.textContainer({text:m,backgroundColor:this.state.backgroundColor,borderColor:this.state.borderColor,position:this.state.position,direction:"y",level:"small",spacing:.5,offset:{x:12,y:12},root:{x:x.x>.8?"right":"left",y:x.y>.8?"top":"bottom"}})}}h(Ht,"TYPE","tooltip");const Va={[Ht.TYPE]:Ht},pu=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:Va,Tooltip:Ht,tooltipStateZ:Br},Symbol.toStringTag,{value:"Module"})),_r=f.z.object({one:l.G.xy.nullable(),two:l.G.xy.nullable(),hover:l.G.xy.nullable(),color:f.z.union([l.Color.z,f.z.object({verticalLine:l.Color.z.optional().default(l.ZERO),horizontalLine:l.Color.z.optional().default(l.ZERO),obliqueLine:l.Color.z.optional().default(l.ZERO)})]).optional().default(l.ZERO),strokeWidth:f.z.number().optional().default(1),strokeDash:f.z.number().optional().default(2)});class qt extends w.Leaf{constructor(){super(...arguments);h(this,"schema",_r)}async afterUpdate(t){const r=_.Context.use(t);this.internal.theme=w.use(t),this.internal.renderCtx=r,this.internal.draw=new Xt(r.upper2d,this.internal.theme),Z.requestRender(t,st)}async afterDelete(t){Z.requestRender(t,tt)}get verticalLineColor(){return this.state.color instanceof l.Color?this.state.color.isZero?this.internal.theme.colors.gray.l6:this.state.color:this.state.color.verticalLine.isZero?this.internal.theme.colors.gray.l6:this.state.color.verticalLine}get horizontalLineColor(){return this.state.color instanceof l.Color?this.state.color.isZero?this.internal.theme.colors.gray.l6:this.state.color:this.state.color.horizontalLine.isZero?this.internal.theme.colors.gray.l6:this.state.color.horizontalLine}get obliqueLineColor(){return this.state.color instanceof l.Color?this.state.color.isZero?this.internal.theme.colors.gray.l6:this.state.color:this.state.color.obliqueLine.isZero?this.internal.theme.colors.gray.l6:this.state.color.obliqueLine}async find(t){const{one:r,two:s}=this.state;if(r==null||s==null)return null;const{one:a,two:i}=this.prevState,{dataOne:o,dataTwo:c}=this.internal;if(a!=null&&l.G.equals(r,a)&&i!=null&&l.G.equals(s,i)&&o!=null&&c!=null){const[T,Y]=[await t.findByXValue(o.x),await t.findByXValue(c.x)];return T.length===0||Y.length===0?null:[T.sort((D,P)=>l.G.distance(o,D.value)-l.G.distance(o,P.value))[0],Y.sort((D,P)=>l.G.distance(c,D.value)-l.G.distance(c,P.value))[0]]}const u=l.b.XY.scale(t.region).scale(l.Mo.DECIMAL),[d,p]=[u.pos(r),u.pos(s)],[m,b]=[await t.findByXDecimal(d.x),await t.findByXDecimal(p.x)];if(m.length===0||b.length===0)return null;const[x,S]=[m.sort((T,Y)=>l.G.distance(d,T.position)-l.G.distance(d,Y.position))[0],b.sort((T,Y)=>l.G.distance(p,T.position)-l.G.distance(p,Y.position))[0]];return this.internal.dataOne=x.value,this.internal.dataTwo=S.value,[x,S]}async renderHover(t){if(this.state.hover==null)return;const r=this.state.hover,s=l.b.XY.scale(t.region).scale(l.Mo.DECIMAL),a=s.pos(r),i=await t.findByXDecimal(s.pos(r).x);if(i.length===0)return;const o=i.sort((u,d)=>l.G.distance(a,u.position)-l.G.distance(a,d.position))[0],{draw:c}=this.internal;c.circle({fill:o.color.setAlpha(.5),radius:9,position:s.reverse().pos(o.position)})}async render(t){if(this.deleted)return;await this.renderHover(t);const r=await this.find(t);if(r==null)return;const[s,a]=r,{draw:i}=this.internal,{strokeDash:o,strokeWidth:c}=this.state,u=l.b.XY.scale(l.Mo.DECIMAL).scale(t.region),d=u.pos(s.position),p=u.pos(a.position),m=new g.y$1(Math.abs(s.value.x-a.value.x)),b=Math.abs(s.value.y-a.value.y),x=b/m.seconds;i.line({start:l.G.construct(d.x,d.y),end:l.G.construct(d.x,p.y),stroke:this.verticalLineColor,lineDash:o,lineWidth:c}),i.textContainer({text:[`${b.toFixed(2)} ${s.units??""}`],direction:"x",position:l.G.construct(d.x,(d.y+p.y)/2),level:"small"}),i.line({start:l.G.construct(d.x,p.y),end:l.G.construct(p.x,p.y),stroke:this.horizontalLineColor,lineDash:o,lineWidth:c}),i.textContainer({text:[m.truncate(g.y$1.MILLISECOND).toString()],direction:"x",position:l.G.construct((d.x+p.x)/2,p.y),level:"small"}),i.line({start:l.G.construct(d.x,d.y),end:l.G.construct(p.x,p.y),stroke:this.obliqueLineColor,lineDash:o,lineWidth:c}),i.textContainer({text:[`${x.toFixed(2)} ${s.units??""} / S`],direction:"x",position:l.G.construct((d.x+p.x)/2,(d.y+p.y)/2),level:"small"}),i.circle({fill:s.color.setAlpha(.5),radius:8,position:d}),i.circle({fill:s.color.setAlpha(.8),radius:5,position:d}),i.circle({fill:new l.Color("#ffffff"),radius:2,position:d}),i.circle({fill:a.color.setAlpha(.5),radius:8,position:p}),i.circle({fill:a.color.setAlpha(.8),radius:5,position:p}),i.circle({fill:new l.Color("#ffffff"),radius:2,position:p})}}h(qt,"TYPE","measure");const Xa={[qt.TYPE]:qt},gu=Object.freeze(Object.defineProperty({__proto__:null,Measure:qt,REGISTRY:Xa,measureStateZ:_r},Symbol.toStringTag,{value:"Module"})),Ka=f.z.object({container:l.Mo.box,viewport:l.Mo.box,hold:f.z.boolean().optional().default(!1),grid:f.z.record(xa),visible:f.z.boolean().optional().default(!0),clearOverScan:l.G.crudeZ.optional().default(l.G.ZERO)}),mu=(e,n)=>{const t=l.Mo.width(e)*Math.sqrt(l.Mo.height(e)),r=l.Mo.width(n)*Math.sqrt(l.Mo.height(n));return t/r};class wn extends w.Composite{constructor(){super(...arguments);h(this,"schema",Ka)}async afterUpdate(t){this.internal.instrumentation=Ne(t,"lineplot"),this.internal.aggregate=X.useAdder(t),this.internal.renderCtx=_.Context.use(t),Z.control(t,r=>this.requestRender("low",r)),this.requestRender("high",tt)}async afterDelete(t){this.internal.renderCtx=_.Context.use(t),this.requestRender("high",tt)}async findByXDecimal(t){const r={...this.state,plot:this.calculatePlot(),exposure:this.exposure},s=this.axes.flatMap(async a=>await a.findByXDecimal(r,t));return(await Promise.all(s)).flat()}async findByXValue(t){const r={...this.state,plot:this.calculatePlot(),exposure:this.exposure},s=this.axes.flatMap(async a=>await a.findByXValue(r,t));return(await Promise.all(s)).flat()}get axes(){return this.childrenOfType(Pe.TYPE)}get tooltips(){return this.childrenOfType(Ht.TYPE)}get measures(){return this.childrenOfType(qt.TYPE)}get exposure(){return mu(this.state.viewport,this.state.container)}async renderAxes(t,r){const s={...this.state,plot:t,canvases:r,exposure:this.exposure};await Promise.all(this.axes.map(async a=>await a.render(s)))}async renderTooltips(t,r){const s={findByXDecimal:this.findByXDecimal.bind(this),region:t,canvases:r};await Promise.all(this.tooltips.map(async a=>await a.render(s)))}async renderMeasures(t){const r={findByXDecimal:this.findByXDecimal.bind(this),findByXValue:this.findByXValue.bind(this),region:t};await Promise.all(this.measures.map(async s=>await s.render(r)))}calculatePlot(){return mo(this.state.grid,this.state.container)}async render(t){const{renderCtx:r}=this.internal,{instrumentation:s}=this.internal;if(this.deleted){s.L.debug("deleted, skipping render",{key:this.key});return}if(!this.state.visible)return s.L.debug("not visible, skipping render",{key:this.key}),async({canvases:d})=>r.erase(this.state.container,this.state.clearOverScan,...d);const a=this.calculatePlot();s.L.debug("rendering",{key:this.key,viewport:this.state.viewport,container:this.state.container,grid:this.state.grid,plot:a,canvases:t});const i=l.G.construct(this.state.clearOverScan),o=r.scissor(this.state.container,i,t.filter(d=>d!=="gl")),c=r.scissor(a,l.G.ZERO,t.filter(d=>d==="gl"));try{await this.renderAxes(a,t),await this.renderTooltips(a,t),await this.renderMeasures(a),r.gl.finish(),r.gl.flush(),r.gl.finish()}catch(d){if(d.message.toLowerCase().includes("bigint"))return;this.internal.aggregate({key:`${this.type}-${this.key}`,variant:"error",message:d.message})}finally{o(),c()}s.L.debug("rendered",{key:this.key});const u=l.Mo.copy(this.state.container);return async({canvases:d})=>r.erase(u,this.state.clearOverScan,...d)}requestRender(t,r){const{renderCtx:s}=this.internal;let a=["upper2d","lower2d","gl"];r===st&&(a=["upper2d"]),s.loop.set({key:`${this.type}-${this.key}`,render:async()=>await this.render(a),priority:t,canvases:a})}}h(wn,"TYPE","LinePlot");const yu={[wn.TYPE]:wn,[Pe.TYPE]:Pe,[Ee.TYPE]:Ee},Gr=f.z.object({dpr:f.z.number(),region:l.Mo.box,bootstrap:f.z.boolean().optional().default(!1),bootstrapped:f.z.boolean().optional().default(!1),glCanvas:f.z.any().optional(),upper2dCanvas:f.z.any().optional(),lower2dCanvas:f.z.any().optional(),os:g.S.osZ});class ke extends w.Composite{constructor(){super(...arguments);h(this,"schema",Gr);h(this,"renderCtx",null)}async afterUpdate(t){if(this.renderCtx==null){if(!this.state.bootstrap)return;const{glCanvas:r,lower2dCanvas:s,upper2dCanvas:a,os:i}=this.state;if(r==null||s==null||a==null)throw new w.Me("[vis.worker.Canvas] - expected render context bootstrap to include all canvases");this.renderCtx=_.Context.create(t,r,s,a,i),mn.create(t,this.renderCtx),this.setState(o=>({...o,bootstrap:!1,bootstrapped:!0,glCanvas:void 0,lower2dCanvas:void 0,upper2dCanvas:void 0}))}else this.renderCtx.update(t);this.renderCtx.resize(this.state.region,this.state.dpr)}}h(ke,"TYPE","Canvas");const Ja={[ke.TYPE]:ke},wu=Object.freeze(Object.defineProperty({__proto__:null,Canvas:ke,REGISTRY:Ja,canvasStateZ:Gr},Symbol.toStringTag,{value:"Module"})),Qa=f.z.object({triggered:f.z.boolean(),status:X.specZ,sink:Yn.optional().default(Pn),source:dr.optional().default(cr)});class bn extends w.Leaf{constructor(){super(...arguments);h(this,"schema",Qa)}async afterUpdate(t){var a,i,o;const{sink:r,source:s}=this.state;this.internal.source=await j(t,s,this.internal.source),this.internal.sink=await $e(t,r,this.internal.sink),this.state.triggered&&!this.prevState.triggered&&await this.internal.sink.set(((a=this.state.status.data)==null?void 0:a.authority)!==w.Am.ABSOLUTE),await this.updateEnabledState(),(o=(i=this.internal).stopListening)==null||o.call(i),this.internal.stopListening=this.internal.source.onChange(()=>{this.updateEnabledState()})}async updateEnabledState(){const t=await this.internal.source.value();sr.I.equal(t,this.state.status)||this.setState(r=>({...r,status:t,triggered:!1}))}async afterDelete(){var t,r,s,a;this.internal.stopListening(),await((r=(t=this.internal.source).cleanup)==null?void 0:r.call(t)),await((a=(s=this.internal.sink).cleanup)==null?void 0:a.call(s))}render(){}}h(bn,"TYPE","Chip");const ti=f.z.object({}),Ms="control-state-provider",ei=w.im.stateZ.extend({subjectColor:l.Color.z});class jt extends w.Composite{constructor(){super(...arguments);h(this,"schema",ti);h(this,"colors",new Map);h(this,"tracker");h(this,"disconnectTrackerChange");h(this,"obs",new ar.Observer)}static use(t){return t.get(Ms)}async afterUpdate(t){const{internal:r}=this;r.instrumentation=Ne(t,"control-state");const s=w.use(t);r.palette=s.colors.visualization.palettes.default,r.defaultColor=s.colors.gray.l6;const a=Le(t);r.client!=null&&a===r.client||(r.client=a,t.set(Ms,this),await this.maybeCloseTracker(),r.client!=null&&(this.internal.instrumentation.L.debug("starting state tracker"),await this.openTracker(r.client)))}async maybeCloseTracker(){var t;this.tracker!=null&&(this.internal.instrumentation.L.debug("stopping state tracker"),(t=this.disconnectTrackerChange)==null||t.call(this),await this.tracker.close(),this.tracker=void 0)}async afterDelete(){await this.maybeCloseTracker()}onChange(t){return this.obs.onChange(t)}get(t){return Array.isArray(t)?g.c$1.unique(t).map(r=>this.getOne(r)).filter(r=>r!=null):this.getOne(t)}getOne(t){if(this.tracker==null)return;const r=this.tracker.states.get(t);if(r!=null)return{...r,subjectColor:this.colors.get(r.subject.key)??this.internal.defaultColor}}async openTracker(t){var a;const{internal:r}=this,{instrumentation:s}=r;try{this.tracker=await t.control.openStateTracker()}catch{s.L.error("failed to open state tracker");return}(a=this.disconnectTrackerChange)==null||a.call(this),this.disconnectTrackerChange=this.tracker.onChange(i=>{if(s.L.debug("transfer",{transfers:i.map(o=>w.im.transferString(o))}),this.tracker==null)throw new w.Me("tracker is null inside it's own onChange callback!");this.updateColors(this.tracker),this.obs.notify(i)})}updateColors(t){const r=t.subjects(),s=r.map(o=>o.key),a=Array.from(this.colors.values());this.colors.forEach((o,c)=>!s.includes(c)&&this.colors.delete(c));const{palette:i}=this.internal;r.forEach(o=>{if(this.colors.has(o.key))return;const c=i.find(u=>!a.includes(u))??i[0];this.colors.set(o.key,c),a.push(c)})}}h(jt,"TYPE","StateProvider");const ni=["acquired","released","overridden","failed"],ri=f.z.enum(ni),si=f.z.object({name:f.z.string(),authority:f.z.number().default(0),acquireTrigger:f.z.number(),status:ri.optional(),needsControlOf:w.Jg.keyZ.array().optional().default([])});class vn extends w.Composite{constructor(){super(...arguments);h(this,"schema",si);h(this,"registry",new Map);h(this,"writer")}async afterUpdate(t){const{internal:r}=this;r.instrumentation=Ne(t),(r.prevTrigger==null||Math.abs(this.state.acquireTrigger-r.prevTrigger)>1)&&(r.prevTrigger=this.state.acquireTrigger);const s=Le(t),a=jt.use(t);r.client=s,r.client==null&&await this.release(),r.stateProv=a,r.telemCtx=pa(t,this,r.telemCtx),r.addStatus=X.useAdder(t),this.state.acquireTrigger>r.prevTrigger?await this.acquire():this.state.acquireTrigger<r.prevTrigger&&await this.release()}async afterDelete(){await this.release()}async updateNeedsControlOf(){const{client:t}=this.internal;if(t==null)return;const r=new Set([]);for(const a of this.registry.keys())(await a.needsControlOf(t)).forEach(o=>o!==0&&r.add(o));const s=Array.from(r);g.F.unorderedPrimitiveArrays(this.state.needsControlOf,s)!==g.F.EQUAL&&this.setState(a=>({...a,needsControlOf:s}))}async acquire(){this.internal.prevTrigger=this.state.acquireTrigger;const{client:t,addStatus:r}=this.internal;if(t==null)return r({message:`Cannot acquire control on ${this.state.name} because no cluster has been connected.`,variant:"warning"});try{await this.updateNeedsControlOf();const s=this.state.needsControlOf;if(s.length===0)return r({message:`Cannot acquire control on ${this.state.name} because there are no channels to control.`,variant:"warning"});const a=w.k.now().sub(g.y$1.milliseconds(1));this.writer=await t.openWriter({start:a,channels:s,controlSubject:{key:this.key,name:this.state.name},authorities:this.state.authority,enableAutoCommit:!0}),this.setState(i=>({...i,status:"acquired"}))}catch(s){if(this.setState(a=>({...a,status:"failed"})),!(s instanceof Error))throw s;r({variant:"error",message:`${this.state.name} failed to acquire control`,description:s.message})}}async release(){var t;this.internal.prevTrigger=this.state.acquireTrigger;try{await((t=this.writer)==null?void 0:t.close())}catch(r){this.internal.addStatus({message:`${this.state.name} failed to release control: ${r.message}`,variant:"error"})}finally{this.setState(r=>({...r,status:"released"})),this.writer=void 0}}async set(t){var r;this.writer==null&&await this.acquire(),await((r=this.writer)==null?void 0:r.write(t))}async setAuthority(t,r){var s;this.writer==null&&await this.acquire(),await((s=this.writer)==null?void 0:s.setAuthority(Object.fromEntries(t.map(a=>[a,r]))))}async releaseAuthority(t){var r;this.writer==null&&await this.acquire(),await((r=this.writer)==null?void 0:r.setAuthority(Object.fromEntries(t.map(s=>[s,this.state.authority]))))}deleteTelem(t){this.registry.delete(t),this.updateNeedsControlOf()}create(t){const s=(()=>{switch(t.type){case Re.TYPE:{const a=new Re(this,t.props);return this.registry.set(a,null),a}case ze.TYPE:{const a=new ze(this,this.internal.stateProv,t.props);return this.registry.set(a,null),a}case Ye.TYPE:return new Ye(this,t.props);default:return null}})();return s!=null&&this.updateNeedsControlOf(),s}}h(vn,"TYPE","Controller");const ai=f.z.object({channel:f.z.number()});class Re extends On{constructor(t,r){super(r);h(this,"controller");h(this,"schema",ai);this.controller=t}invalidate(){}async cleanup(){this.controller.deleteTelem(this)}async needsControlOf(t){if(this.props.channel===0)return[];const r=await t.channels.retrieve(this.props.channel),s=[r.key];return r.index!==0&&s.push(r.index),s}async set(t){const{client:r}=this.controller.internal;if(r==null)return;const s=await r.channels.retrieve(this.props.channel),a={[s.key]:t};if(s.index!==0){const i=await r.channels.retrieve(s.index);a[i.key]=w.k.now()}await this.controller.set(a)}}h(Re,"TYPE","controlled-numeric-telem-sink");const bu=e=>({type:Re.TYPE,props:e,variant:"sink",valueType:"number"}),ii=f.z.object({authority:f.z.number().default(w.im.Authority.ABSOLUTE),channel:f.z.number()});class Ye extends On{constructor(t,r){super(r);h(this,"controller");h(this,"schema",ii);this.controller=t}async cleanup(){this.controller.deleteTelem(this)}async needsControlOf(t){const r=await t.channels.retrieve(this.props.channel),s=[r.key];return r.index!==0&&s.push(r.index),s}async set(t){const{controller:r}=this,{client:s}=r.internal;if(s==null)return;const a=await s.channels.retrieve(this.props.channel),i=[a.key];a.index!==0&&i.push(a.index),t?await this.controller.setAuthority(i,this.props.authority):await this.controller.releaseAuthority(i)}}h(Ye,"TYPE","acquire-channel-control");const vu=e=>({type:Ye.TYPE,props:e,variant:"sink",valueType:"boolean"}),oi=f.z.object({channel:f.z.number()});class ze extends H{constructor(t,r,s){super(s);h(this,"prov");h(this,"valid",!1);h(this,"stopListening");h(this,"controller");h(this,"schema",oi);this.prov=r,this.controller=t}async needsControlOf(){return[]}maybeRevalidate(){var s;if(this.valid)return;const{channel:t}=this.props;(s=this.stopListening)==null||s.call(this);const r=g.Y.filterTransfersByChannelKey(t);this.stopListening=this.prov.onChange(a=>{var i;r(a).length!==0&&((i=this.notify)==null||i.call(this))}),this.valid=!0}async value(){this.maybeRevalidate();const t=w.k.now();if(this.props.channel===0)return{key:this.controller.key,variant:"disabled",message:"No Channel",time:t,data:{valid:!1,authority:0}};const r=this.prov.get(this.props.channel);return r==null?{key:this.controller.key,variant:"disabled",message:"Uncontrolled",time:t,data:{valid:!0,color:void 0,authority:0}}:{key:r.subject.key,variant:r.subject.key===this.controller.key?"success":"error",message:`Controlled by ${r.subject.name}`,time:t,data:{valid:!0,color:r.subjectColor,authority:r.authority}}}async cleanup(){var t;this.controller.deleteTelem(this),(t=this.stopListening)==null||t.call(this)}}h(ze,"TYPE","controlled-status-source");const xu=e=>({type:ze.TYPE,props:e,variant:"source",valueType:"status"}),li=f.z.object({statusSource:dr.optional().default(cr),colorSource:hr.optional().default(kn),status:X.specZ,color:l.Color.z.optional()});class xn extends w.Leaf{constructor(){super(...arguments);h(this,"schema",li);h(this,"stopListeningStatus");h(this,"stopListeningColor")}async afterUpdate(t){var i,o;const{internal:r}=this,{statusSource:s,colorSource:a}=this.state;r.statusSource=await j(t,s,r.statusSource),r.colorSource=await j(t,a,r.colorSource),await this.updateState(),(i=this.stopListeningStatus)==null||i.call(this),this.stopListeningStatus=r.statusSource.onChange(()=>{this.updateState()}),(o=this.stopListeningColor)==null||o.call(this),this.stopListeningColor=r.colorSource.onChange(()=>{this.updateState()})}async afterDelete(){var t,r,s,a;await((r=(t=this.internal.statusSource).cleanup)==null?void 0:r.call(t)),await((a=(s=this.internal.colorSource).cleanup)==null?void 0:a.call(s))}async render(){}async updateState(){const t=await this.internal.colorSource.value(),r=await this.internal.statusSource.value();t.equals(this.state.color)&&r.message===this.state.status.message||this.setState(s=>({...s,color:t,status:r}))}}h(xn,"TYPE","Indicator");const ci=f.z.object({needsControlOf:w.Jg.keyZ.array(),states:ei.array()});class Tn extends w.Leaf{constructor(){super(...arguments);h(this,"schema",ci)}async afterUpdate(t){var o;const{internal:r}=this;r.stateProv=jt.use(t);const s=this.state.needsControlOf;(o=r.disconnectStateProv)==null||o.call(r);const a=g.Y.filterTransfersByChannelKey(...s),i=r.stateProv.get(s);this.setState(c=>({...c,states:i})),r.disconnectStateProv=r.stateProv.onChange(c=>{if(a(c).length===0)return;const u=r.stateProv.get(s);this.setState(d=>({...d,states:u}))})}async afterDelete(){var r;const{internal:t}=this;(r=t.disconnectStateProv)==null||r.call(t)}async render(){}}h(Tn,"TYPE","Legend");const Tu={[vn.TYPE]:vn,[jt.TYPE]:jt,[xn.TYPE]:xn,[bn.TYPE]:bn,[Tn.TYPE]:Tn},Su=f.z.object({region:l.Mo.box,clearOverScan:l.G.crudeZ.optional().default(0),visible:f.z.boolean().optional().default(!0)}),Hn=["upper2d","lower2d"],kt=class kt extends w.Composite{constructor(){super(...arguments);h(this,"schema",kt.stateZ)}async afterUpdate(t){const{internal:r}=this;r.renderCtx=_.Context.use(t),r.handleError=X.useErrorHandler(t),Z.control(t,()=>this.requestRender("low")),this.requestRender("high")}async afterDelete(){this.requestRender("high")}async render(){if(this.deleted)return;const t=l.Mo.copy(this.state.region);if(!this.state.visible)return async()=>this.internal.renderCtx.erase(this.state.region,this.state.clearOverScan,...Hn);const{renderCtx:r,handleError:s}=this.internal,a=l.b.XY.translate(l.Mo.topLeft(this.state.region)),i=r.scissor(this.state.region,l.G.construct(this.state.clearOverScan),Hn);try{for(const o of this.children)await o.render({viewportScale:a})}catch(o){s(o,"Failed to render table")}finally{i()}return async()=>{this.internal.renderCtx.erase(t,this.state.clearOverScan)}}requestRender(t){const{renderCtx:r}=this.internal;r.loop.set({key:`${kt.TYPE}-${this.key}`,render:this.render.bind(this),priority:t,canvases:Hn})}};h(kt,"TYPE","Table"),h(kt,"stateZ",Su);let Oe=kt;const Cu={[Oe.TYPE]:Oe},ui=f.z.object({trigger:f.z.number(),sink:Yn.optional().default(Pn)});class Sn extends w.Leaf{constructor(){super(...arguments);h(this,"schema",ui)}async afterUpdate(t){var a;const{sink:r}=this.state;(a=this.internal).prevTrigger??(a.prevTrigger=this.state.trigger),this.internal.sink=await $e(t,r,this.internal.sink);const s=this.internal.prevTrigger;this.internal.prevTrigger=this.state.trigger,!(this.state.trigger<=s)&&await this.internal.sink.set(!0)}render(){}async afterDelete(){await this.internalAfterDelete()}async internalAfterDelete(){var r,s;const{internal:t}=this;await((s=(r=t.sink).cleanup)==null?void 0:s.call(r))}}h(Sn,"TYPE","Button");const Eu={[Sn.TYPE]:Sn},Fr=f.z.object({position:l.G.xy,zoom:f.z.number(),region:l.Mo.box,clearOverScan:l.G.crudeZ.optional().default(10),visible:f.z.boolean().optional().default(!0)}),qe=["upper2d","lower2d"],Rt=class Rt extends w.Composite{constructor(){super(...arguments);h(this,"schema",Rt.stateZ)}async afterUpdate(t){this.internal.renderCtx=_.Context.use(t),this.internal.addStatus=X.useAdder(t),Z.control(t,()=>this.requestRender("low")),this.requestRender("high")}async afterDelete(){this.requestRender("high")}async render(){if(this.deleted)return;const{renderCtx:t,addStatus:r}=this.internal,{zoom:s,position:a}=this.state,i=l.Mo.construct(this.state.region);if(!this.state.visible)return async()=>t.erase(i,this.state.clearOverScan,...qe);const o=t.scissor(i,l.G.ZERO,qe),c=l.b.XY.magnify(l.G.construct(s)).translate(l.Mo.topLeft(i)).translate(a);try{await Promise.all(this.children.map(async d=>await d.render({viewportScale:c})))}catch(d){if(!(d instanceof Error))throw d;r({variant:"error",message:"Failed to render diagram",description:d.message})}finally{o()}const u=l.Mo.copy(this.state.region);return async()=>{this.internal.renderCtx.erase(u,this.state.clearOverScan,...qe)}}requestRender(t){const{renderCtx:r}=this.internal;r.loop.set({key:`${Rt.TYPE}-${this.key}`,render:this.render.bind(this),priority:t,canvases:qe})}};h(Rt,"TYPE","Diagram"),h(Rt,"stateZ",Fr);let Wt=Rt;const hi={[Wt.TYPE]:Wt},Mu=Object.freeze(Object.defineProperty({__proto__:null,Diagram:Wt,REGISTRY:hi,diagramStateZ:Fr},Symbol.toStringTag,{value:"Module"})),di=f.z.object({enabled:f.z.boolean(),source:ur.optional().default(lr)});class Cn extends w.Leaf{constructor(){super(...arguments);h(this,"schema",di)}async afterUpdate(t){var a;this.internal.addStatus=X.useOptionalAdder(t);const{source:r}=this.state,{internal:s}=this;this.internal.source=await j(t,r,this.internal.source),await this.updateEnabledState(),(a=s.stopListening)==null||a.call(s),s.stopListening=s.source.onChange(()=>{this.updateEnabledState().catch(this.reportError.bind(this))})}reportError(t){this.internal.addStatus({key:this.key,variant:"error",message:`Failed to update Light: ${t.message}`})}async updateEnabledState(){const t=await this.internal.source.value();t!==this.state.enabled&&this.setState(r=>({...r,enabled:t}))}async afterDelete(){await this.internalAfterDelete()}async internalAfterDelete(){var t,r;this.internal.stopListening(),await((r=(t=this.internal.source).cleanup)==null?void 0:r.call(t))}async render(){}}h(Cn,"TYPE","Light");const Pu={[Cn.TYPE]:Cn},fi=f.z.object({region:l.Mo.box,wheelPos:f.z.number(),scrolling:f.z.boolean(),empty:f.z.boolean(),visible:f.z.boolean(),telem:sn.optional().default(Ds),font:g.levelZ.optional().default("p"),color:l.Color.z.optional().default(l.ZERO),overshoot:l.G.xy.optional().default({x:0,y:0})}),ku=.98,te="lower2d",Ru={offset:0n,offsetRef:0n,scrollRef:0},ue=class ue extends w.Leaf{constructor(){super(...arguments);h(this,"schema",ue.z);h(this,"values",new g.Lt([]));h(this,"scrollState",Ru)}async afterUpdate(t){var d;const{internal:r}=this;r.render=_.Context.use(t),r.theme=w.use(t),this.state.color.isZero?this.internal.textColor=r.theme.colors.gray.l8:r.textColor=this.state.color,r.telem=await j(t,this.state.telem,r.telem);const s=X.useErrorHandler(t),{scrolling:a,wheelPos:i}=this.state;if(this.state.scrolling&&!this.prevState.scrolling){const p=this.values.alignmentBounds.upper-1n;this.scrollState={offset:p,offsetRef:p,scrollRef:this.state.wheelPos}}else if(a){const{scrollState:p,values:m}=this,b=Math.ceil((i-this.scrollState.scrollRef)/this.lineHeight);p.offset=this.values.traverseAlignment(p.offsetRef,-BigInt(b)),p.offset<m.alignmentBounds.lower+BigInt(this.visibleLineCount)&&(p.offset=m.alignmentBounds.lower,this.setState(x=>({...x,wheelPos:this.prevState.wheelPos}))),p.offset>=m.alignmentBounds.upper&&this.setState(x=>({...x,scrolling:!1}))}const[c,u]=await this.internal.telem.value();this.values=new g.Lt(u),this.checkEmpty(),(d=r.stopListeningTelem)==null||d.call(r),r.stopListeningTelem=r.telem.onChange(()=>{this.internal.telem.value().then(([p,m])=>{this.checkEmpty(),this.values=new g.Lt(m),this.requestRender()}).catch(p=>s(p,"Failed to update log"))}),this.requestRender()}checkEmpty(){const t=this.values.length===0;t!==this.state.empty&&this.setState(r=>({...r,empty:t}))}async afterDelete(){var s;const{telem:t,render:r}=this.internal;await((s=t.cleanup)==null?void 0:s.call(t)),r.erase(l.Mo.construct(this.state.region),l.G.ZERO,te)}async requestRender(){const{render:t}=this.internal;await t.loop.set({key:`${this.type}-${this.key}`,render:async()=>await this.render(),priority:"high",canvases:[te]})}get lineHeight(){return this.internal.theme.typography[this.state.font].size*this.internal.theme.sizes.base}get totalHeight(){return Math.ceil(this.values.length*this.lineHeight)}get visibleLineCount(){return Math.min(Math.floor((l.Mo.height(this.state.region)-12)/this.lineHeight),this.values.length)}async render(){const{render:t}=this.internal,r=this.state.region;if(l.Mo.areaIsZero(r))return;if(!this.state.visible)return async()=>t.erase(r,l.G.ZERO,te);let s;if(!this.state.scrolling)s=this.values.subIterator(this.values.length-this.visibleLineCount,this.values.length);else{const d=this.values.traverseAlignment(this.scrollState.offset,-BigInt(this.visibleLineCount));s=this.values.subAlignmentSpanIterator(d,this.visibleLineCount)}const a=this.state.region,i=t[te],o=new Xt(i,this.internal.theme),c=t.scissor(a,l.G.ZERO,[te]);this.renderElements(o,s),this.renderScrollbar(o),c();const u=l.Mo.copy(this.state.region);return async({canvases:d})=>t.erase(u,this.state.overshoot,...d)}renderScrollbar(t){const r=this.state.region,s=l.Mo.height(r)/this.totalHeight*l.Mo.height(r);if(s>=l.Mo.height(r)*ku)return;let a=l.Mo.bottom(r)-s;this.state.scrolling&&(a-=Number(this.values.distance(this.values.alignmentBounds.upper,this.scrollState.offset))/this.values.length*l.Mo.height(r)),a<0&&(a=l.Mo.top(r)),t.container({region:l.Mo.construct({x:l.Mo.right(r)-6,y:a},{width:6,height:s}),bordered:!1,backgroundColor:i=>i.colors.gray.l4})}renderElements(t,r){const s=this.state.region;let a=0;for(const i of r){const o=this.values.dataType.equals(g.g$1.JSON)?JSON.stringify(i):i.toString();t.text({text:o,level:this.state.font,shade:9,position:l.G.translate(l.Mo.topLeft(s),{x:6,y:a*this.lineHeight+6}),code:!0}),a++}}};h(ue,"TYPE","log"),h(ue,"z",fi);let De=ue;const Yu={[De.TYPE]:De},pi=f.z.object({trigger:f.z.number(),command:f.z.number().optional(),value:f.z.number(),sink:Zs.optional().default(Ys),source:Ns.optional().default(zs)});class En extends w.Leaf{constructor(){super(...arguments);h(this,"schema",pi)}async afterUpdate(t){this.internal.handleError=X.useAsyncErrorHandler(t);const{sink:r,source:s,trigger:a,command:i}=this.state,{internal:o}=this;o.prevTrigger??(o.prevTrigger=a),await o.handleError(async()=>{var u;this.internal.source=await j(t,s,this.internal.source),o.sink=await $e(t,r,o.sink);const c=o.prevTrigger;o.prevTrigger=a,a>c&&i!=null&&await this.internal.sink.set(i),await this.updateValue(),(u=o.stopListening)==null||u.call(o),o.stopListening=o.source.onChange(()=>void o.handleError(async()=>await this.updateValue()))},"Failed to update Setpoint")}async updateValue(){const t=await this.internal.source.value();t!==this.state.value&&this.setState(r=>({...r,value:t,triggered:!1}))}async afterDelete(){var r,s,a,i;const{internal:t}=this;t.stopListening(),await((s=(r=t.source).cleanup)==null?void 0:s.call(r)),await((i=(a=t.sink).cleanup)==null?void 0:i.call(a))}async render(){}}h(En,"TYPE","Setpoint");const zu={[En.TYPE]:En},gi=f.z.object({triggered:f.z.boolean(),enabled:f.z.boolean(),sink:Yn.optional().default(Pn),source:ur.optional().default(lr)});class Mn extends w.Leaf{constructor(){super(...arguments);h(this,"schema",gi)}async afterUpdate(t){var u;this.internal.addStatus=X.useOptionalAdder(t);const{sink:r,source:s,triggered:a,enabled:i}=this.state,{triggered:o}=this.prevState,{internal:c}=this;c.source=await j(t,s,c.source),c.sink=await $e(t,r,c.sink),a&&!o&&await c.sink.set(!i),await this.updateEnabledState(),(u=c.stopListening)==null||u.call(c),c.stopListening=c.source.onChange(()=>{this.updateEnabledState().catch(this.reportError.bind(this))})}reportError(t){this.internal.addStatus({key:this.key,variant:"error",message:`Failed to update Toggle: ${t.message}`})}async updateEnabledState(){const t=await this.internal.source.value();t!==this.state.enabled&&this.setState(r=>({...r,enabled:t,triggered:!1}))}async afterDelete(){await this.internalAfterDelete()}async internalAfterDelete(){var t,r,s,a;this.internal.stopListening(),await((r=(t=this.internal.source).cleanup)==null?void 0:r.call(t)),await((a=(s=this.internal.sink).cleanup)==null?void 0:a.call(s))}async render(){}}h(Mn,"TYPE","Toggle");const Ou={[Mn.TYPE]:Mn},Du=f.z.object({box:l.Mo.box,telem:fr.optional().default(Os),backgroundTelem:hr.optional().default(kn),level:g.levelZ.optional().default("p"),color:l.Color.z.optional().default(l.ZERO),precision:f.z.number().optional().default(2),minWidth:f.z.number().optional().default(60),width:f.z.number().optional(),notation:Js.optional().default("standard"),location:l.K.xy.optional().default({x:"left",y:"center"})}),Lu=["upper2d","lower2d"],he=class he extends w.Leaf{constructor(){super(...arguments);h(this,"schema",he.z)}async afterUpdate(t){var s,a;const{internal:r}=this;r.renderCtx=_.Context.use(t),r.theme=w.use(t),this.state.color.isZero?this.internal.textColor=r.theme.colors.gray.l8:r.textColor=this.state.color,r.telem=await j(t,this.state.telem,r.telem),(s=r.stopListening)==null||s.call(r),r.stopListening=this.internal.telem.onChange(()=>this.requestRender()),r.backgroundTelem=await j(t,this.state.backgroundTelem,r.backgroundTelem),(a=r.stopListeningBackground)==null||a.call(r),r.stopListeningBackground=this.internal.backgroundTelem.onChange(()=>this.requestRender()),this.internal.requestRender=Z.useOptionalRequest(t),this.requestRender()}async afterDelete(){var r,s,a,i,o,c;const{internal:t}=this;(r=t.stopListening)==null||r.call(t),(s=t.stopListeningBackground)==null||s.call(t),await((i=(a=t.telem).cleanup)==null?void 0:i.call(a)),await((c=(o=t.backgroundTelem).cleanup)==null?void 0:c.call(o)),t.requestRender==null?t.renderCtx.erase(l.Mo.construct(this.state.box),l.G.ZERO,...Lu):t.requestRender(tt)}requestRender(){const{requestRender:t}=this.internal;t!=null?t(tt):this.render({})}get fontHeight(){const{theme:t}=this.internal;return t.typography[this.state.level].size*t.sizes.base}maybeUpdateWidth(t){const{theme:r}=this.internal,s=t+r.sizes.base+this.fontHeight;this.state.width==null||this.state.width+this.fontHeight*.5<s||this.state.minWidth>s&&this.state.width!==this.state.minWidth?this.setState(a=>({...a,width:Math.max(s,a.minWidth)})):this.state.width-this.fontHeight>s&&this.setState(a=>({...a,width:Math.max(s,a.minWidth)}))}async render({viewportScale:t=l.b.XY.IDENTITY}){const{renderCtx:r,telem:s,backgroundTelem:a}=this.internal,i=l.Mo.construct(this.state.box);if(l.Mo.areaIsZero(i))return;const{location:o}=this.state,c=r.lower2d.applyScale(t);let u=await s.value();const d=ee.fontString(this.internal.theme,{level:this.state.level,code:!0});c.font=d;const p=this.fontHeight,m=u[0]=="-";m&&(u=u.slice(1));const{theme:b}=this.internal,x=ft.dimensions(u,d,c).width+b.sizes.base;this.internal.requestRender==null&&r.erase(l.Mo.construct(this.prevState.box)),this.maybeUpdateWidth(x);const S={...l.G.ZERO};o.x==="left"&&(S.x=6+p*.75),o.x==="center"&&(S.x=l.Mo.width(i)/2-x/2),o.y==="center"&&(S.y=l.Mo.height(i)/2);const T=l.G.translate(l.Mo.topLeft(i),S),Y=c.scissor(i,void 0);let D=!0;if(this.state.backgroundTelem.type!=kn.type){const P=r.lower2d.applyScale(t),O=await a.value();D=O.isZero,O.isZero||(P.fillStyle=O.hex,P.rect(...l.G.couple(l.Mo.topLeft(i)),l.Mo.width(i),l.Mo.height(i)),P.fill(),c.fillStyle=O.pickByContrast(b.colors.gray.l0,b.colors.gray.l9).hex)}D&&(c.fillStyle=this.internal.textColor.hex),c.textBaseline="middle",m&&c.fillText("-",...l.G.couple(l.G.translateX(T,-p*.6))),c.fillText(u,...l.G.couple(T)),Y()}};h(he,"TYPE","value"),h(he,"z",Du);let Vt=he;const mi={[Vt.TYPE]:Vt},Au=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:mi,Value:Vt},Symbol.toStringTag,{value:"Module"}));exports.AcquireChannelControl=Ye;exports.Annotation=yn;exports.AuthoritySource=ze;exports.BaseProvider=It;exports.Button=Sn;exports.Canvas=Ua;exports.Canvas$1=ke;exports.Chip=bn;exports.Controller=Z;exports.Controller$1=vn;exports.Diagram=Mu;exports.Diagram$1=Wt;exports.Indicator=xn;exports.Legend=Tn;exports.Light=Cn;exports.Line=Ce;exports.LinePlot=wn;exports.Log=De;exports.Measure=qt;exports.Provider=Ve;exports.Provider$1=Me;exports.Provider$2=Vn;exports.REASON_DATA=jn;exports.REASON_LAYOUT=tt;exports.REASON_TOOL=st;exports.REGISTRY=yu;exports.REGISTRY$1=Cu;exports.REGISTRY$10=du;exports.REGISTRY$11=Xa;exports.REGISTRY$12=ru;exports.REGISTRY$13=Pu;exports.REGISTRY$14=hi;exports.REGISTRY$15=Tu;exports.REGISTRY$16=Ja;exports.REGISTRY$17=Eu;exports.REGISTRY$18=Ki;exports.REGISTRY$2=Yu;exports.REGISTRY$3=mi;exports.REGISTRY$4=Va;exports.REGISTRY$5=Ou;exports.REGISTRY$6=va;exports.REGISTRY$7=Rs;exports.REGISTRY$8=zu;exports.REGISTRY$9=qa;exports.Rule=Ft;exports.STATUSES=ni;exports.SetChannelValue=Re;exports.Setpoint=En;exports.StateProvider=jt;exports.Table=Oe;exports.Toggle=Mn;exports.Tooltip=Ht;exports.Value=Vt;exports.XAxis=Pe;exports.YAxis=Ee;exports.ZERO_CONTEXT_VALUE=ir;exports.acquireChannelControl=vu;exports.acquireChannelControlPropsZ=ii;exports.aether=lu;exports.annotationStateZ=ja;exports.authoritySource=xu;exports.authoritySourceProps=oi;exports.axisStateZ=Ir;exports.buttonStateZ=ui;exports.canvas=wu;exports.canvasStateZ=Gr;exports.channelData=Fs;exports.chipStateZ=Qa;exports.color=Ut;exports.colorGradient=oa;exports.controllerStateZ=si;exports.coreAxisStateZ=Ue;exports.diagramStateZ=Fr;exports.external=po;exports.indicatorStateZ=li;exports.interpolateNumber=Se;exports.interpolateRgb=Qn;exports.interpolateString=Ma;exports.legendStateZ=ci;exports.lightStateZ=di;exports.linePlotStateZ=Ka;exports.logState=fi;exports.measure=gu;exports.measureStateZ=_r;exports.newTickFactory=nr;exports.parseAutoBounds=Fa;exports.provider=Di;exports.providerStateZ=Wa;exports.providerStateZ$1=ma;exports.providerStateZ$2=Mr;exports.regions=pt;exports.rollingAverage=aa;exports.rollingAverageProps=Sr;exports.ruleStateZ=Ur;exports.scaleNumber=ca;exports.setChannelValue=bu;exports.setChannelValuePropsZ=ai;exports.setpoint=ta;exports.setpointStateZ=pi;exports.sinkPipeline=_s;exports.sinkPipelinePropsZ=yr;exports.sourcePipeline=Bs;exports.sourcePipelinePropsZ=gr;exports.stateProviderStateZ=ti;exports.stateZ=Ha;exports.statusZ=ri;exports.streamChannelData=Hs;exports.streamChannelValue=qs;exports.streamChannelValuePropsZ=wr;exports.stringSourceSpecZ=fr;exports.stringifyNumber=sa;exports.stringifyNumberProps=Tr;exports.sugaredStateZ=ei;exports.tickFactoryProps=Zr;exports.tickType=Nr;exports.toggleStateZ=gi;exports.tooltip=pu;exports.tooltipStateZ=Br;exports.value=Au;exports.withinBounds=ea;exports.withinBoundsProps=xr;exports.withinSizeThreshold=Ba;exports.xAxisStateZ=fu;exports.yAxisStateZ=cu;