@synnaxlabs/pluto 0.49.0 → 0.50.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Animated-Bp6IK3ct.js → Animated-BbeJdao0.js} +3 -3
- package/dist/{Animated-38tdmPR0.js → Animated-C4xrEVd-.js} +50 -50
- package/dist/Animated-Dvm2k_z_.cjs +1 -0
- package/dist/{Animated-Dsn1pmhz.cjs → Animated-umWjgTzy.cjs} +1 -1
- package/dist/{Box-4l6DWG-3.cjs → Box-D27bV7QJ.cjs} +1 -1
- package/dist/{Box-BVyAHr2f.js → Box-DLO7l9hM.js} +9 -9
- package/dist/Button-BSek5HG5.cjs +1 -0
- package/dist/{Button-CoOYEk1J.js → Button-DLtxKGH5.js} +98 -98
- package/dist/{Dialog-JwJQD3xZ.cjs → Dialog-BpjxXSmw.cjs} +1 -1
- package/dist/{Dialog-puVY-0Mt.js → Dialog-BspO7uo8.js} +3 -3
- package/dist/{Editable-DI0-D1K5.cjs → Editable-C-z-stcD.cjs} +1 -1
- package/dist/{Editable-DEbVpi5i.js → Editable-DjQORuR1.js} +3 -3
- package/dist/{Haul-Db9j45Fu.js → Haul-DBy-2ds_.js} +24 -24
- package/dist/Haul-WgPKptr9.cjs +1 -0
- package/dist/{Items-BCG7kyaR.cjs → Items-07R286kW.cjs} +2 -2
- package/dist/{Items-BVKW0udb.js → Items-CX11yLMf.js} +25 -23
- package/dist/Menu-58O-OOPJ.cjs +1 -0
- package/dist/Menu-GBo3ayoP.js +135 -0
- package/dist/Provider-BA3zQVbv.cjs +1 -0
- package/dist/{Provider-DQM7IBoi.js → Provider-BkxUzTWS.js} +399 -320
- package/dist/Tags-DWsEZD9t.cjs +1 -0
- package/dist/{Tags-B8l5Dvw-.js → Tags-V7sNuGZv.js} +187 -182
- package/dist/{Text-DeWvfrdF.cjs → Text-DW5FpCk9.cjs} +1 -1
- package/dist/{Text-90J6p5Uj.js → Text-XeD58Fq8.js} +625 -600
- package/dist/{Video-CLpcYcKf.js → Video-C56z7qvH.js} +1 -1
- package/dist/{Video-Bmg4gwom.cjs → Video-CBPTBLTB.cjs} +1 -1
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/color.cjs +1 -1
- package/dist/color.js +1 -1
- package/dist/{css-bahPRiQI.js → css-BkBrZtKZ.js} +562 -569
- package/dist/{css-BVgFAmaj.cjs → css-D3NdC2sx.cjs} +4 -4
- package/dist/css.cjs +1 -1
- package/dist/css.js +2 -2
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +1 -1
- package/dist/{dimensions-SDA3fM2T.cjs → dimensions-C7b02rFi.cjs} +1 -1
- package/dist/{dimensions-qcyzaTKI.js → dimensions-qj2CkPTy.js} +6 -6
- package/dist/{eraser-Cbfc1frM.cjs → eraser-Bocga8Eb.cjs} +3 -3
- package/dist/{eraser-Dz6nZuPp.js → eraser-DuAfpO0P.js} +38 -38
- package/dist/ether.cjs +1 -1
- package/dist/ether.js +54 -55
- package/dist/{external-CMs_BCc5.cjs → external-5_uHky7w.cjs} +2 -2
- package/dist/{external-m-0q-0os.js → external-B-JsNciM.js} +5 -5
- package/dist/{external-CwYoEhB2.cjs → external-B3o5P8Yw.cjs} +1 -1
- package/dist/{external-Bixqkw5N.cjs → external-B9omdiDK.cjs} +1 -1
- package/dist/{external-kwuGKgyL.cjs → external-BIbdeWQE.cjs} +1 -1
- package/dist/external-BRA_zA83.cjs +1 -0
- package/dist/{external-PA6ulZR9.cjs → external-Bjh6lsVm.cjs} +1 -1
- package/dist/external-BwRkgEyo.cjs +1 -0
- package/dist/{external-TI-6Umwm.js → external-CLQdSLv0.js} +6 -6
- package/dist/{external-DJWZ43k0.js → external-CdHyPhLI.js} +1 -1
- package/dist/{external-CB3VxPJp.js → external-Ct1k30Nd.js} +24 -24
- package/dist/external-Ct2A_YCT.cjs +1 -0
- package/dist/{external-04ve_X21.js → external-DNbIzfVy.js} +45 -44
- package/dist/{external-B3b7kdID.cjs → external-DT82RBon.cjs} +1 -1
- package/dist/{external-Cxojc4yT.js → external-DXWEyk9d.js} +11 -11
- package/dist/{external-D2tzyCDs.cjs → external-DojNoICL.cjs} +1 -1
- package/dist/{external-CnWQzZlQ.js → external-Dp5OkGYV.js} +69 -68
- package/dist/{external-xJ67ivgR.js → external-DxmgAHkn.js} +3 -3
- package/dist/{external-DUVDOJfj.cjs → external-DyTk_hS7.cjs} +1 -1
- package/dist/{external-DP9FiRHq.js → external-MvcifV4O.js} +3 -3
- package/dist/external-PXU0gc_j.cjs +84 -0
- package/dist/{external-CrXS1qj_.js → external-g_vt4Lku.js} +13386 -12955
- package/dist/{external-D2deiHyL.js → external-sYHm9OG8.js} +10 -9
- package/dist/{external-Hhx8JoAS.js → external-xfkS0zGI.js} +12 -12
- package/dist/flex.cjs +1 -1
- package/dist/flex.js +1 -1
- package/dist/{fontString-qfWSw62X.js → fontString-CSWLcJcC.js} +3 -3
- package/dist/{fontString-62eEvw4b.cjs → fontString-TocVNWmy.cjs} +1 -1
- package/dist/header.cjs +1 -1
- package/dist/header.js +1 -1
- package/dist/{hooks-Dh0v1QWQ.js → hooks-BeSuo_di.js} +25 -25
- package/dist/hooks-Eb94kuDd.cjs +1 -0
- package/dist/index.cjs +23 -15
- package/dist/index.js +11147 -10778
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/menu.cjs +1 -1
- package/dist/menu.js +1 -1
- package/dist/pluto.css +1 -1
- package/dist/{provider-ClhgBr_F.js → provider-D0K9E52u.js} +4030 -3699
- package/dist/provider-DksyuJua.cjs +78 -0
- package/dist/src/access/policy/Select.d.ts.map +1 -1
- package/dist/src/access/policy/aether/queries.d.ts.map +1 -1
- package/dist/src/access/policy/queries.d.ts +8 -6
- package/dist/src/access/policy/queries.d.ts.map +1 -1
- package/dist/src/access/role/Select.d.ts +2 -2
- package/dist/src/access/role/Select.d.ts.map +1 -1
- package/dist/src/access/role/queries.d.ts +2 -2
- package/dist/src/access/role/queries.d.ts.map +1 -1
- package/dist/src/aether/aether/aether.d.ts +86 -10
- package/dist/src/aether/aether/aether.d.ts.map +1 -1
- package/dist/src/aether/aether/aether.spec.d.ts.map +1 -1
- package/dist/src/aether/main.d.ts +34 -11
- package/dist/src/aether/main.d.ts.map +1 -1
- package/dist/src/aether/message.d.ts +31 -6
- package/dist/src/aether/message.d.ts.map +1 -1
- package/dist/src/aether/test/index.d.ts +2 -0
- package/dist/src/aether/test/index.d.ts.map +1 -0
- package/dist/src/aether/test/provider.d.ts +4 -0
- package/dist/src/aether/test/provider.d.ts.map +1 -0
- package/dist/src/aether/test/provider.spec.d.ts +2 -0
- package/dist/src/aether/test/provider.spec.d.ts.map +1 -0
- package/dist/src/arc/handle/Base.d.ts +8 -0
- package/dist/src/arc/handle/{Core.d.ts.map → Base.d.ts.map} +1 -1
- package/dist/src/arc/handle/Sink.d.ts +2 -2
- package/dist/src/arc/handle/Source.d.ts +2 -2
- package/dist/src/arc/queries.d.ts +33 -10
- package/dist/src/arc/queries.d.ts.map +1 -1
- package/dist/src/button/Button.d.ts +2 -2
- package/dist/src/button/Button.d.ts.map +1 -1
- package/dist/src/button/Toggle.d.ts.map +1 -1
- package/dist/src/channel/LinePlot.d.ts +7 -6
- package/dist/src/channel/LinePlot.d.ts.map +1 -1
- package/dist/src/channel/Select.d.ts.map +1 -1
- package/dist/src/channel/queries.d.ts +6 -5
- package/dist/src/channel/queries.d.ts.map +1 -1
- package/dist/src/color/BaseSwatch.d.ts.map +1 -1
- package/dist/src/color/Picker.d.ts.map +1 -1
- package/dist/src/color/Swatch.d.ts.map +1 -1
- package/dist/src/component/SelectSize.d.ts.map +1 -1
- package/dist/src/css/bem.d.ts +2 -2
- package/dist/src/css/css.d.ts +1 -1
- package/dist/src/device/Select.d.ts.map +1 -1
- package/dist/src/device/queries.d.ts +8 -8
- package/dist/src/device/queries.d.ts.map +1 -1
- package/dist/src/dialog/Frame.d.ts.map +1 -1
- package/dist/src/direction/Select.d.ts +2 -2
- package/dist/src/direction/Select.d.ts.map +1 -1
- package/dist/src/errors/Boundary.d.ts +29 -0
- package/dist/src/errors/Boundary.d.ts.map +1 -0
- package/dist/src/errors/Fallback.d.ts +32 -0
- package/dist/src/errors/Fallback.d.ts.map +1 -0
- package/dist/src/errors/errors.spec.d.ts +2 -0
- package/dist/src/errors/errors.spec.d.ts.map +1 -0
- package/dist/src/errors/external.d.ts +3 -0
- package/dist/src/errors/external.d.ts.map +1 -0
- package/dist/src/errors/index.d.ts +2 -0
- package/dist/src/errors/index.d.ts.map +1 -0
- package/dist/src/flux/Provider.d.ts +2 -2
- package/dist/src/flux/aether/external.d.ts +4 -4
- package/dist/src/flux/aether/provider.d.ts +7 -7
- package/dist/src/flux/{core → base}/client.d.ts.map +1 -1
- package/dist/src/flux/{core → base}/external.d.ts.map +1 -1
- package/dist/src/flux/base/index.d.ts +2 -0
- package/dist/src/flux/base/index.d.ts.map +1 -0
- package/dist/src/flux/{core → base}/store.d.ts.map +1 -1
- package/dist/src/flux/base/store.spec.d.ts.map +1 -0
- package/dist/src/flux/{core → base}/streamer.d.ts +1 -1
- package/dist/src/flux/{core → base}/streamer.d.ts.map +1 -1
- package/dist/src/flux/base/streamer.spec.d.ts.map +1 -0
- package/dist/src/flux/{core → base}/types.d.ts.map +1 -1
- package/dist/src/flux/external.d.ts +3 -3
- package/dist/src/flux/form.d.ts +13 -13
- package/dist/src/flux/form.d.ts.map +1 -1
- package/dist/src/flux/list.d.ts +11 -11
- package/dist/src/flux/list.d.ts.map +1 -1
- package/dist/src/flux/retrieve.d.ts +20 -20
- package/dist/src/flux/retrieve.d.ts.map +1 -1
- package/dist/src/flux/update.d.ts +23 -22
- package/dist/src/flux/update.d.ts.map +1 -1
- package/dist/src/form/Field.d.ts.map +1 -1
- package/dist/src/form/external.d.ts +0 -1
- package/dist/src/form/external.d.ts.map +1 -1
- package/dist/src/form/useField.d.ts.map +1 -1
- package/dist/src/group/queries.d.ts +5 -5
- package/dist/src/group/queries.d.ts.map +1 -1
- package/dist/src/haul/Haul.d.ts +3 -3
- package/dist/src/haul/Haul.d.ts.map +1 -1
- package/dist/src/header/ButtonTitle.d.ts.map +1 -1
- package/dist/src/icon/Icon.d.ts +1 -1
- package/dist/src/icon/Icon.d.ts.map +1 -1
- package/dist/src/icon/registry.d.ts +5 -0
- package/dist/src/icon/registry.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/input/Boolean.d.ts.map +1 -1
- package/dist/src/input/Date.d.ts.map +1 -1
- package/dist/src/input/DateTime.d.ts.map +1 -1
- package/dist/src/input/DragButton.d.ts.map +1 -1
- package/dist/src/input/HelpText.d.ts.map +1 -1
- package/dist/src/input/Label.d.ts.map +1 -1
- package/dist/src/input/Numeric.d.ts.map +1 -1
- package/dist/src/input/Text.d.ts.map +1 -1
- package/dist/src/input/Time.d.ts.map +1 -1
- package/dist/src/label/Select.d.ts.map +1 -1
- package/dist/src/label/queries.d.ts +3 -3
- package/dist/src/label/queries.d.ts.map +1 -1
- package/dist/src/lineplot/Axis.d.ts.map +1 -1
- package/dist/src/lineplot/Legend.d.ts +2 -2
- package/dist/src/lineplot/Line.d.ts +2 -2
- package/dist/src/lineplot/LinePlot.d.ts +9 -3
- package/dist/src/lineplot/LinePlot.d.ts.map +1 -1
- package/dist/src/lineplot/Viewport.d.ts +2 -2
- package/dist/src/lineplot/aether/LinePlot.d.ts +17 -5
- package/dist/src/lineplot/aether/LinePlot.d.ts.map +1 -1
- package/dist/src/lineplot/aether/XAxis.d.ts +2 -2
- package/dist/src/lineplot/aether/YAxis.d.ts +2 -2
- package/dist/src/lineplot/aether/axis.d.ts +4 -4
- package/dist/src/lineplot/aether/external.d.ts +0 -1
- package/dist/src/lineplot/aether/external.d.ts.map +1 -1
- package/dist/src/lineplot/external.d.ts +0 -1
- package/dist/src/lineplot/external.d.ts.map +1 -1
- package/dist/src/lineplot/queries.d.ts +3 -3
- package/dist/src/lineplot/queries.d.ts.map +1 -1
- package/dist/src/lineplot/range/Annotation.d.ts.map +1 -1
- package/dist/src/lineplot/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/src/list/Frame.d.ts +2 -2
- package/dist/src/list/Frame.d.ts.map +1 -1
- package/dist/src/list/Items.d.ts.map +1 -1
- package/dist/src/list/useKeysData.d.ts.map +1 -1
- package/dist/src/log/Log.d.ts.map +1 -1
- package/dist/src/log/queries.d.ts +3 -3
- package/dist/src/log/queries.d.ts.map +1 -1
- package/dist/src/menu/ContextMenu.d.ts +3 -2
- package/dist/src/menu/ContextMenu.d.ts.map +1 -1
- package/dist/src/menu/Menu.d.ts.map +1 -1
- package/dist/src/mosaic/Mosaic.d.ts.map +1 -1
- package/dist/src/nav/Bar.d.ts +3 -3
- package/dist/src/nav/Drawer.d.ts.map +1 -1
- package/dist/src/notation/Select.d.ts +2 -2
- package/dist/src/notation/Select.d.ts.map +1 -1
- package/dist/src/ontology/aether/queries.d.ts.map +1 -1
- package/dist/src/ontology/queries.d.ts +3 -3
- package/dist/src/ontology/queries.d.ts.map +1 -1
- package/dist/src/pluto/Pluto.d.ts +2 -0
- package/dist/src/pluto/Pluto.d.ts.map +1 -1
- package/dist/src/rack/Select.d.ts.map +1 -1
- package/dist/src/rack/queries.d.ts +2 -2
- package/dist/src/rack/queries.d.ts.map +1 -1
- package/dist/src/ranger/Breadcrumb.d.ts +2 -2
- package/dist/src/ranger/Select.d.ts +2 -2
- package/dist/src/ranger/Select.d.ts.map +1 -1
- package/dist/src/ranger/SelectStage.d.ts.map +1 -1
- package/dist/src/ranger/queries.d.ts +5 -5
- package/dist/src/ranger/queries.d.ts.map +1 -1
- package/dist/src/resize/{Core.d.ts → Base.d.ts} +3 -3
- package/dist/src/resize/{Core.d.ts.map → Base.d.ts.map} +1 -1
- package/dist/src/resize/Single.d.ts +2 -2
- package/dist/src/resize/Single.d.ts.map +1 -1
- package/dist/src/resize/external.d.ts +1 -1
- package/dist/src/schematic/Schematic.d.ts.map +1 -1
- package/dist/src/schematic/edge/paths.d.ts.map +1 -1
- package/dist/src/schematic/queries.d.ts +5 -5
- package/dist/src/schematic/queries.d.ts.map +1 -1
- package/dist/src/schematic/symbol/Primitives.d.ts +5 -5
- package/dist/src/schematic/symbol/Primitives.d.ts.map +1 -1
- package/dist/src/schematic/symbol/SelectOrientation.d.ts +2 -2
- package/dist/src/schematic/symbol/SelectOrientation.d.ts.map +1 -1
- package/dist/src/schematic/symbol/Symbols.d.ts +13 -13
- package/dist/src/schematic/symbol/Symbols.d.ts.map +1 -1
- package/dist/src/schematic/symbol/external.d.ts +1 -0
- package/dist/src/schematic/symbol/external.d.ts.map +1 -1
- package/dist/src/schematic/symbol/queries.d.ts +8 -6
- package/dist/src/schematic/symbol/queries.d.ts.map +1 -1
- package/dist/src/schematic/symbol/registry.d.ts +1 -1
- package/dist/src/select/Button.d.ts +3 -3
- package/dist/src/select/Button.d.ts.map +1 -1
- package/dist/src/select/Dialog.d.ts +3 -3
- package/dist/src/select/Dialog.d.ts.map +1 -1
- package/dist/src/select/Frame.d.ts +1 -1
- package/dist/src/select/Frame.d.ts.map +1 -1
- package/dist/src/select/Multiple.d.ts +3 -3
- package/dist/src/select/Multiple.d.ts.map +1 -1
- package/dist/src/select/MultipleTrigger.d.ts.map +1 -1
- package/dist/src/select/Single.d.ts.map +1 -1
- package/dist/src/select/Static.d.ts.map +1 -1
- package/dist/src/select/flex/Alignment.d.ts.map +1 -1
- package/dist/src/select/text/Level.d.ts +1 -1
- package/dist/src/select/text/Weight.d.ts +1 -1
- package/dist/src/select/use.d.ts.map +1 -1
- package/dist/src/showcase/InputShowcase.d.ts.map +1 -1
- package/dist/src/state/state.d.ts.map +1 -1
- package/dist/src/status/Select.d.ts +2 -2
- package/dist/src/status/Select.d.ts.map +1 -1
- package/dist/src/status/SelectVariant.d.ts +2 -2
- package/dist/src/status/SelectVariant.d.ts.map +1 -1
- package/dist/src/status/aether/aggregator.d.ts +1 -1
- package/dist/src/status/{core → base}/Aggregator.d.ts.map +1 -1
- package/dist/src/status/base/Aggregator.spec.d.ts.map +1 -0
- package/dist/src/status/{core → base}/CreateIcon.d.ts.map +1 -1
- package/dist/src/status/{core → base}/Indicator.d.ts.map +1 -1
- package/dist/src/status/{core → base}/Notification.d.ts.map +1 -1
- package/dist/src/status/base/Notification.spec.d.ts.map +1 -0
- package/dist/src/status/{core → base}/Summary.d.ts.map +1 -1
- package/dist/src/status/{core → base}/colors.d.ts.map +1 -1
- package/dist/src/status/{core → base}/external.d.ts.map +1 -1
- package/dist/src/status/base/index.d.ts.map +1 -0
- package/dist/src/status/external.d.ts +1 -1
- package/dist/src/status/queries.d.ts +3 -3
- package/dist/src/status/queries.d.ts.map +1 -1
- package/dist/src/steps/Steps.d.ts.map +1 -1
- package/dist/src/table/Table.d.ts.map +1 -1
- package/dist/src/table/cells/Forms.d.ts.map +1 -1
- package/dist/src/table/queries.d.ts +3 -3
- package/dist/src/table/queries.d.ts.map +1 -1
- package/dist/src/tabs/Selector.d.ts.map +1 -1
- package/dist/src/tabs/Tabs.d.ts.map +1 -1
- package/dist/src/tag/Tag.d.ts.map +1 -1
- package/dist/src/task/queries.d.ts +7 -6
- package/dist/src/task/queries.d.ts.map +1 -1
- package/dist/src/telem/SelectDataType.d.ts.map +1 -1
- package/dist/src/telem/aether/context.d.ts +2 -2
- package/dist/src/telem/aether/context.d.ts.map +1 -1
- package/dist/src/telem/aether/factory.d.ts +2 -2
- package/dist/src/telem/aether/factory.d.ts.map +1 -1
- package/dist/src/telem/aether/provider.d.ts +4 -14
- package/dist/src/telem/aether/provider.d.ts.map +1 -1
- package/dist/src/telem/aether/remote.d.ts.map +1 -1
- package/dist/src/telem/aether/test/external.d.ts +4 -0
- package/dist/src/telem/aether/test/external.d.ts.map +1 -0
- package/dist/src/telem/aether/test/factory.d.ts +11 -0
- package/dist/src/telem/aether/test/factory.d.ts.map +1 -0
- package/dist/src/telem/aether/test/factory.spec.d.ts +2 -0
- package/dist/src/telem/aether/test/factory.spec.d.ts.map +1 -0
- package/dist/src/telem/aether/test/index.d.ts +2 -0
- package/dist/src/telem/aether/test/index.d.ts.map +1 -0
- package/dist/src/telem/aether/test/sink.d.ts +18 -0
- package/dist/src/telem/aether/test/sink.d.ts.map +1 -0
- package/dist/src/telem/aether/test/sink.spec.d.ts +2 -0
- package/dist/src/telem/aether/test/sink.spec.d.ts.map +1 -0
- package/dist/src/telem/aether/test/source.d.ts +17 -0
- package/dist/src/telem/aether/test/source.d.ts.map +1 -0
- package/dist/src/telem/aether/test/source.spec.d.ts +2 -0
- package/dist/src/telem/aether/test/source.spec.d.ts.map +1 -0
- package/dist/src/telem/client/cache/cache.d.ts.map +1 -1
- package/dist/src/telem/control/Chip.d.ts.map +1 -1
- package/dist/src/telem/control/Controller.d.ts +2 -0
- package/dist/src/telem/control/Controller.d.ts.map +1 -1
- package/dist/src/telem/control/Indicator.d.ts.map +1 -1
- package/dist/src/telem/control/Legend.d.ts +2 -2
- package/dist/src/telem/control/aether/controller.d.ts +17 -6
- package/dist/src/telem/control/aether/controller.d.ts.map +1 -1
- package/dist/src/telem/test/external.d.ts +2 -0
- package/dist/src/telem/test/external.d.ts.map +1 -0
- package/dist/src/telem/test/index.d.ts +2 -0
- package/dist/src/telem/test/index.d.ts.map +1 -0
- package/dist/src/telem/test/wrapper.d.ts +9 -0
- package/dist/src/telem/test/wrapper.d.ts.map +1 -0
- package/dist/src/telem/text/TimeRange.d.ts.map +1 -1
- package/dist/src/text/Text.d.ts +1 -1
- package/dist/src/text/Text.d.ts.map +1 -1
- package/dist/src/text/{core → base}/dimensions.d.ts +5 -5
- package/dist/src/text/{core → base}/dimensions.d.ts.map +1 -1
- package/dist/src/text/base/dimensions.spec.d.ts.map +1 -0
- package/dist/src/text/base/external.d.ts.map +1 -0
- package/dist/src/text/base/index.d.ts.map +1 -0
- package/dist/src/text/{core → base}/types.d.ts.map +1 -1
- package/dist/src/text/external.d.ts +2 -2
- package/dist/src/theming/aether/external.d.ts +2 -2
- package/dist/src/theming/aether/provider.d.ts +64 -1
- package/dist/src/theming/aether/provider.d.ts.map +1 -1
- package/dist/src/theming/{core → base}/fontString.d.ts +1 -1
- package/dist/src/theming/{core → base}/fontString.d.ts.map +1 -1
- package/dist/src/theming/{core → base}/theme.d.ts +39 -0
- package/dist/src/theming/{core → base}/theme.d.ts.map +1 -1
- package/dist/src/theming/css.d.ts +1 -1
- package/dist/src/theming/css.d.ts.map +1 -1
- package/dist/src/theming/external.d.ts +1 -1
- package/dist/src/tooltip/Config.d.ts.map +1 -1
- package/dist/src/tree/Context.d.ts +1 -1
- package/dist/src/tree/Tree.d.ts +1 -1
- package/dist/src/tree/Tree.d.ts.map +1 -1
- package/dist/src/tree/{core.d.ts → base.d.ts} +1 -1
- package/dist/src/tree/{core.d.ts.map → base.d.ts.map} +1 -1
- package/dist/src/tree/base.spec.d.ts +2 -0
- package/dist/src/tree/base.spec.d.ts.map +1 -0
- package/dist/src/tree/external.d.ts +2 -1
- package/dist/src/tree/external.d.ts.map +1 -1
- package/dist/src/triggers/Text.d.ts +2 -2
- package/dist/src/user/queries.d.ts +4 -4
- package/dist/src/user/queries.d.ts.map +1 -1
- package/dist/src/view/index.d.ts +2 -0
- package/dist/src/view/index.d.ts.map +1 -0
- package/dist/src/view/queries.d.ts +35 -0
- package/dist/src/view/queries.d.ts.map +1 -0
- package/dist/src/view/queries.spec.d.ts +2 -0
- package/dist/src/view/queries.spec.d.ts.map +1 -0
- package/dist/src/viewport/Mask.d.ts.map +1 -1
- package/dist/src/viewport/SelectMode.d.ts.map +1 -1
- package/dist/src/vis/button/aether/button.d.ts +15 -6
- package/dist/src/vis/button/aether/button.d.ts.map +1 -1
- package/dist/src/vis/button/aether/button.spec.d.ts +2 -0
- package/dist/src/vis/button/aether/button.spec.d.ts.map +1 -0
- package/dist/src/vis/button/use.d.ts +1 -1
- package/dist/src/vis/button/use.d.ts.map +1 -1
- package/dist/src/vis/diagram/Diagram.d.ts +6 -6
- package/dist/src/vis/diagram/Diagram.d.ts.map +1 -1
- package/dist/src/vis/diagram/aether/types.d.ts +2 -2
- package/dist/src/vis/diagram/align.d.ts.map +1 -1
- package/dist/src/vis/draw2d/canvas.d.ts.map +1 -1
- package/dist/src/vis/draw2d/index.d.ts +1 -1
- package/dist/src/vis/draw2d/index.d.ts.map +1 -1
- package/dist/src/vis/gauge/aether/gauge.d.ts +1 -1
- package/dist/src/vis/gauge/use.d.ts +2 -2
- package/dist/src/vis/input/aether/input.d.ts +11 -6
- package/dist/src/vis/input/aether/input.d.ts.map +1 -1
- package/dist/src/vis/input/use.d.ts.map +1 -1
- package/dist/src/vis/legend/Container.d.ts.map +1 -1
- package/dist/src/vis/legend/Grouped.d.ts.map +1 -1
- package/dist/src/vis/legend/Simple.d.ts.map +1 -1
- package/dist/src/vis/line/Line.d.ts.map +1 -1
- package/dist/src/vis/measure/aether/measure.d.ts +1 -1
- package/dist/src/vis/render/loop.d.ts +1 -1
- package/dist/src/vis/rule/Rule.d.ts.map +1 -1
- package/dist/src/vis/setpoint/aether/setpoint.d.ts +11 -6
- package/dist/src/vis/setpoint/aether/setpoint.d.ts.map +1 -1
- package/dist/src/vis/setpoint/use.d.ts.map +1 -1
- package/dist/src/vis/text/atlas.d.ts.map +1 -1
- package/dist/src/vis/toggle/aether/toggle.d.ts +12 -3
- package/dist/src/vis/toggle/aether/toggle.d.ts.map +1 -1
- package/dist/src/vis/toggle/aether/toggle.spec.d.ts +2 -0
- package/dist/src/vis/toggle/aether/toggle.spec.d.ts.map +1 -0
- package/dist/src/vis/toggle/use.d.ts +1 -1
- package/dist/src/vis/toggle/use.d.ts.map +1 -1
- package/dist/src/vis/value/use.d.ts +2 -2
- package/dist/src/workspace/queries.d.ts +7 -7
- package/dist/src/workspace/queries.d.ts.map +1 -1
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text.cjs +1 -1
- package/dist/text.js +2 -2
- package/dist/theme.css +136 -124
- package/dist/theming.cjs +1 -1
- package/dist/theming.js +2 -2
- package/dist/tree.cjs +1 -1
- package/dist/tree.js +1 -1
- package/dist/triggers.cjs +1 -1
- package/dist/triggers.js +1 -1
- package/dist/types-B5-Tni3G.js +82 -0
- package/dist/types-C0tUDfsz.cjs +1 -0
- package/dist/units-Bd_mf9Ye.cjs +1 -0
- package/dist/{units-CgMHbHoA.js → units-CEfK1L7C.js} +1 -1
- package/dist/{value-CzFrd9p6.js → value-BmuhX6zs.js} +2278 -2285
- package/dist/value-CZfzRi_x.cjs +53 -0
- package/dist/video.cjs +1 -1
- package/dist/video.js +1 -1
- package/package.json +25 -23
- package/dist/Animated-D-pQ3CYh.cjs +0 -1
- package/dist/Button-D5aoG3sV.cjs +0 -1
- package/dist/Haul-9RVCn3cI.cjs +0 -1
- package/dist/Menu-BYca9tGe.cjs +0 -1
- package/dist/Menu-CQsrN_mP.js +0 -134
- package/dist/Provider-DBg-Li_7.cjs +0 -5
- package/dist/Tags-CQFa3kY-.cjs +0 -1
- package/dist/external-DDHknds-.cjs +0 -1
- package/dist/external-DcMOF1Je.cjs +0 -1
- package/dist/external-JpvbclD8.cjs +0 -79
- package/dist/external-RkrrZXG5.cjs +0 -1
- package/dist/hooks-CRSphXSb.cjs +0 -1
- package/dist/provider-DHDqgF1B.cjs +0 -76
- package/dist/src/arc/handle/Core.d.ts +0 -8
- package/dist/src/flux/core/index.d.ts +0 -2
- package/dist/src/flux/core/index.d.ts.map +0 -1
- package/dist/src/flux/core/store.spec.d.ts.map +0 -1
- package/dist/src/flux/core/streamer.spec.d.ts.map +0 -1
- package/dist/src/form/synced.d.ts +0 -26
- package/dist/src/form/synced.d.ts.map +0 -1
- package/dist/src/lineplot/aether/BoundQuerier.d.ts +0 -35
- package/dist/src/lineplot/aether/BoundQuerier.d.ts.map +0 -1
- package/dist/src/lineplot/useBoundQuerier.d.ts +0 -11
- package/dist/src/lineplot/useBoundQuerier.d.ts.map +0 -1
- package/dist/src/observe/index.d.ts +0 -2
- package/dist/src/observe/index.d.ts.map +0 -1
- package/dist/src/observe/use.d.ts +0 -8
- package/dist/src/observe/use.d.ts.map +0 -1
- package/dist/src/status/core/Aggregator.spec.d.ts.map +0 -1
- package/dist/src/status/core/Notification.spec.d.ts.map +0 -1
- package/dist/src/status/core/index.d.ts.map +0 -1
- package/dist/src/testutil/Aether.d.ts +0 -4
- package/dist/src/testutil/Aether.d.ts.map +0 -1
- package/dist/src/text/core/dimensions.spec.d.ts.map +0 -1
- package/dist/src/text/core/external.d.ts.map +0 -1
- package/dist/src/text/core/index.d.ts.map +0 -1
- package/dist/src/tree/core.spec.d.ts +0 -2
- package/dist/src/tree/core.spec.d.ts.map +0 -1
- package/dist/types-8-Mr79SF.cjs +0 -1
- package/dist/types-DGaZ_JZb.js +0 -82
- package/dist/units-InoNiVrK.cjs +0 -1
- package/dist/value-QHhF9WPA.cjs +0 -53
- /package/dist/src/flux/{core → base}/client.d.ts +0 -0
- /package/dist/src/flux/{core → base}/external.d.ts +0 -0
- /package/dist/src/flux/{core → base}/store.d.ts +0 -0
- /package/dist/src/flux/{core → base}/store.spec.d.ts +0 -0
- /package/dist/src/flux/{core → base}/streamer.spec.d.ts +0 -0
- /package/dist/src/flux/{core → base}/types.d.ts +0 -0
- /package/dist/src/status/{core → base}/Aggregator.d.ts +0 -0
- /package/dist/src/status/{core → base}/Aggregator.spec.d.ts +0 -0
- /package/dist/src/status/{core → base}/CreateIcon.d.ts +0 -0
- /package/dist/src/status/{core → base}/Indicator.d.ts +0 -0
- /package/dist/src/status/{core → base}/Notification.d.ts +0 -0
- /package/dist/src/status/{core → base}/Notification.spec.d.ts +0 -0
- /package/dist/src/status/{core → base}/Summary.d.ts +0 -0
- /package/dist/src/status/{core → base}/colors.d.ts +0 -0
- /package/dist/src/status/{core → base}/external.d.ts +0 -0
- /package/dist/src/status/{core → base}/index.d.ts +0 -0
- /package/dist/src/text/{core → base}/dimensions.spec.d.ts +0 -0
- /package/dist/src/text/{core → base}/external.d.ts +0 -0
- /package/dist/src/text/{core → base}/index.d.ts +0 -0
- /package/dist/src/text/{core → base}/types.d.ts +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";const g=require("./provider-DksyuJua.cjs"),r=require("./css-D3NdC2sx.cjs"),d=require("zod"),Z=require("./eraser-Bocga8Eb.cjs"),Ke=require("./fontString-TocVNWmy.cjs"),pe=require("./types-C0tUDfsz.cjs");require("react");const Ks=require("./dimensions-C7b02rFi.cjs");class Mr{entries=new Map;setListeners=new Map;deleteListeners=new Map;handleError;equal;constructor(e,t=()=>!1){this.handleError=e,this.equal=t}setOne(e,t,s,i){const o=this.entries.get(t),a=pe.executeSetter(s,o);if(!(a==null||o!=null&&this.equal(a,o,t)))return this.entries.set(t,a),this.notifySet(e,t,a,i),()=>{o===void 0?(this.entries.delete(t),this.notifyDelete(e,t)):(this.entries.set(t,o),this.notifySet(e,t,o,i))}}set(e,t,s,i){const o=[];if(Array.isArray(t))t.forEach(a=>{const l=this.setOne(e,a.key,a,s);l!=null&&o.push(l)});else if(typeof t=="object"&&"key"in t){const a=t,l=this.setOne(e,a.key,a,s);l!=null&&o.push(l)}else{const a=this.setOne(e,t,s,i);a!=null&&o.push(a)}return()=>o.reverse().forEach(a=>a())}get(e){return typeof e=="function"?Array.from(this.entries.values()).filter(e):Array.isArray(e)?e.map(t=>this.entries.get(t)).filter(t=>t!=null):this.entries.get(e)}list(){return Array.from(this.entries.values())}has(e){return Array.isArray(e)?e.every(t=>this.entries.has(t)):this.entries.has(e)}delete(e,t,s){const i=[];return typeof t=="function"?this.entries.forEach((o,a)=>{t(o,a)&&i.push({key:a,value:o})}):r.du.toArray(t).forEach(o=>{const a=this.entries.get(o);i.push({key:o,value:a})}),i.forEach(({key:o})=>{this.entries.delete(o),this.notifyDelete(e,o)}),()=>i.forEach(({key:o,value:a})=>{a!=null&&(this.entries.set(o,a),this.notifySet(e,o,a,s))})}clear(){this.entries.clear()}onSet(e,t,s){return this.setListeners.set(t,{scope:e,key:s}),()=>this.setListeners.delete(t)}onDelete(e,t,s){return this.deleteListeners.set(t,{scope:e,key:s}),()=>this.deleteListeners.delete(t)}notifySet(e,t,s,i){this.setListeners.forEach((o,a)=>{const l=o.key==null||o.key===t,u=o.scope!==e;l&&u&&this.handleError(async()=>await a(s,i),"Failed to notify set listener")})}notifyDelete(e,t){this.deleteListeners.forEach((s,i)=>{const o=s.key==null||s.key===t,a=s.scope!==e;o&&a&&this.handleError(async()=>await i(t),"Failed to notify delete listener")})}scope(e){return{set:(t,s,i)=>this.set(e,t,s,i),get:(t=>this.get(t)),list:()=>this.list(),has:t=>this.has(t),delete:(t,s)=>this.delete(e,t,s),onSet:(t,s)=>this.onSet(e,t,s),onDelete:(t,s)=>this.onDelete(e,t,s)}}}const Zr=(n,e)=>Object.fromEntries(Object.entries(n).map(([t,{equal:s}])=>[t,new Mr(e,s)])),_n=(n,e)=>Object.fromEntries(Object.entries(n).map(([t])=>[t,n[t].scope(e)])),$o=(n,e,t)=>n.set(e,s=>s==null?void 0:{...s,...t}),Fo=(n,e)=>{const t=n.includes("delete"),s=e.includes("delete");return t&&!s?-1:!t&&s?1:0},qo=async({openStreamer:n,storeConfig:e,handleError:t,client:s,store:i})=>{const o=Object.values(e),a=r.bu.unique(o.flatMap(({listeners:f})=>f.map(({channel:p})=>p))),l={};o.forEach(({listeners:f})=>f.forEach(p=>{const{channel:y}=p;l[y]=[...l[y]||[],p]}));const u=await g.jA.HardenedStreamer.open(n,a),c=new g.jA.ObservableStreamer(u),h=f=>{const p=[...f.uniqueNames];p.sort(Fo),t(async()=>{for(const y of p){const S=f.get(y),b=l[y];if(b!=null)for(const{onChange:E,schema:x}of b)await t(async()=>{let A;S.dataType.equals(r.f.JSON)?A=S.parseJSON(x):A=Array.from(S).map(C=>x.parse(C));for(const C of A)await t(()=>E({changed:C,client:s,store:i}),`Failed to handle streamer change for ${y}`,g.$n)},`Failed to parse streamer change for ${y}`)}},`Failed to handle streamer change for ${r.cl.naturalLanguageJoin(p)}`)};return c.onChange(h),c.close.bind(c)};class Dr{store;streamCloser=null;client;constructor({client:e,openStreamer:t,storeConfig:s,handleError:i,handleAsyncError:o}){this.store=Zr(s,i),this.client=e,e!=null&&(t??=e?.openStreamer.bind(e),this.streamCloser=qo({client:e,storeConfig:s,handleError:o,store:_n(this.store,""),openStreamer:t}))}async awaitInitialized(){this.streamCloser!=null&&await this.streamCloser}scopedStore(e){return _n(this.store,e)}async close(){if(this.streamCloser==null)return;await(await this.streamCloser)()}}const Ho=d.z.object({props:g.Gk.nullable(),state:g.Hk.connectivity.connectionStateZ.nullable()}),hs={client:null};let At=class Nr extends g.Composite{static TYPE="synnax.Provider";static stateZ=Ho;schema=Nr.stateZ;afterUpdate(e){if(e.wasSetPreviously(ds)||En(e,hs),this.state.props==null){this.internal.client!=null&&(this.internal.client?.close(),this.internal.client=null),En(e,this.internal);return}this.prevState.props!=null&&r.Vu.equal(this.state.props,this.prevState.props)&&this.internal.client!=null||(this.internal.client=new g.Hk(this.state.props),En(e,this.internal))}};const ds="pluto-client-context",En=(n,e)=>n.set(ds,e),$e=n=>n.get(ds)?.client??null,Yr={[At.TYPE]:At},jo=Object.freeze(Object.defineProperty({__proto__:null,Provider:At,REGISTRY:Yr,ZERO_CONTEXT_VALUE:hs,use:$e},Symbol.toStringTag,{value:"Module"})),zr=d.object({}),kn="flux-context",fs="flux.Provider",Wo=(n,e)=>n.get(kn).scopedStore(e),Vo=n=>{const e=(t,s)=>{if("client"in n)return n.client;const i=$e(t);return s!=null&&s?.client?.key===i?.key?s:new Dr({client:i,storeConfig:n.storeConfig,handleError:g.useErrorHandler(t),handleAsyncError:g.useAsyncErrorHandler(t)})};return class Ur extends g.Composite{static TYPE=fs;static stateZ=zr;schema=Ur.stateZ;afterUpdate(s){const{internal:i}=this;i.store=e(s,i.store),s.wasSetPreviously(kn)||s.set(kn,i.store)}}},Xo=n=>({[fs]:Vo(n)}),ps="pluto-vis-renderer",tn=(n,e)=>{n.set(ps,e,!1)},nn=n=>n.get(ps),gs=n=>n.getOptional(ps),ie=(n,e)=>nn(n)(e),Go="relationships",Ko="resources",Qo={channel:g.wA.RELATIONSHIP_SET_CHANNEL_NAME,schema:g.wA.relationshipZ,onChange:({store:n,changed:e})=>n.relationships.set(g.wA.relationshipToString(e),e)},Jo={channel:g.wA.RELATIONSHIP_DELETE_CHANNEL_NAME,schema:g.wA.relationshipZ,onChange:({store:n,changed:e})=>{n.relationships.delete(g.wA.relationshipToString(e))}},ea={equal:(n,e)=>g.wA.idsEqual(n.from,e.from)&&g.wA.idsEqual(n.to,e.to)&&n.type===e.type,listeners:[Qo,Jo]},ta={channel:g.wA.RESOURCE_SET_CHANNEL_NAME,schema:g.wA.resourceZ,onChange:async({store:n,changed:e})=>{n.resources.set(e.key,t=>t==null?e:{...t,...e})}},na={channel:g.wA.RESOURCE_DELETE_CHANNEL_NAME,schema:g.wA.idZ,onChange:({store:n,changed:e})=>n.resources.delete(e.key)},sa={equal:(n,e)=>r.Vu.equal(n,e),listeners:[ta,na]},ra="policies",ia={channel:g.SA.policy.SET_CHANNEL_NAME,schema:g.SA.policy.policyZ,onChange:({store:n,changed:e})=>n.policies.set(e.key,e)},oa={channel:g.SA.policy.DELETE_CHANNEL_NAME,schema:g.SA.policy.keyZ,onChange:({store:n,changed:e})=>n.policies.delete(e)},aa={listeners:[ia,oa]},Br=(n,e)=>{const t=n.relationships.get(o=>g.wA.matchRelationship(o,{from:{type:"role"},type:g.wA.PARENT_OF_RELATIONSHIP_TYPE,to:e})),i=n.relationships.get(o=>t.some(a=>g.wA.matchRelationship(o,{from:a.from,type:g.wA.PARENT_OF_RELATIONSHIP_TYPE,to:{type:"policy"}}))).map(o=>o.to.key);return n.policies.get(i)},la=async({client:n,store:e,subject:t})=>{let s=Br(e,t);if(s.length>0)return s;s=await n.access.policies.retrieve({for:t}),e.policies.set(s);for(const i of s)(await n.ontology.retrieveParents([g.SA.policy.ontologyID(i.key)],{types:["role"]})).forEach(a=>{const l={from:a.id,type:g.wA.PARENT_OF_RELATIONSHIP_TYPE,to:g.SA.policy.ontologyID(i.key)};e.relationships.set(g.wA.relationshipToString(l),l);const u={from:a.id,type:g.wA.PARENT_OF_RELATIONSHIP_TYPE,to:t};e.relationships.set(g.wA.relationshipToString(u),u)});return s};function ms(n,e,t){n.prototype=e.prototype=t,t.constructor=n}function $r(n,e){var t=Object.create(n.prototype);for(var s in e)t[s]=e[s];return t}function ct(){}var Qe=.7,Pt=1/Qe,Ae="\\s*([+-]?\\d+)\\s*",Je="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ee="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ca=/^#([0-9a-f]{3,8})$/,ua=new RegExp(`^rgb\\(${Ae},${Ae},${Ae}\\)$`),ha=new RegExp(`^rgb\\(${ee},${ee},${ee}\\)$`),da=new RegExp(`^rgba\\(${Ae},${Ae},${Ae},${Je}\\)$`),fa=new RegExp(`^rgba\\(${ee},${ee},${ee},${Je}\\)$`),pa=new RegExp(`^hsl\\(${Je},${ee},${ee}\\)$`),ga=new RegExp(`^hsla\\(${Je},${ee},${ee},${Je}\\)$`),Qs={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};ms(ct,Le,{copy(n){return Object.assign(new this.constructor,this,n)},displayable(){return this.rgb().displayable()},hex:Js,formatHex:Js,formatHex8:ma,formatHsl:ya,formatRgb:er,toString:er});function Js(){return this.rgb().formatHex()}function ma(){return this.rgb().formatHex8()}function ya(){return Fr(this).formatHsl()}function er(){return this.rgb().formatRgb()}function Le(n){var e,t;return n=(n+"").trim().toLowerCase(),(e=ca.exec(n))?(t=e[1].length,e=parseInt(e[1],16),t===6?tr(e):t===3?new B(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?bt(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?bt(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=ua.exec(n))?new B(e[1],e[2],e[3],1):(e=ha.exec(n))?new B(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=da.exec(n))?bt(e[1],e[2],e[3],e[4]):(e=fa.exec(n))?bt(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=pa.exec(n))?rr(e[1],e[2]/100,e[3]/100,1):(e=ga.exec(n))?rr(e[1],e[2]/100,e[3]/100,e[4]):Qs.hasOwnProperty(n)?tr(Qs[n]):n==="transparent"?new B(NaN,NaN,NaN,0):null}function tr(n){return new B(n>>16&255,n>>8&255,n&255,1)}function bt(n,e,t,s){return s<=0&&(n=e=t=NaN),new B(n,e,t,s)}function ba(n){return n instanceof ct||(n=Le(n)),n?(n=n.rgb(),new B(n.r,n.g,n.b,n.opacity)):new B}function On(n,e,t,s){return arguments.length===1?ba(n):new B(n,e,t,s??1)}function B(n,e,t,s){this.r=+n,this.g=+e,this.b=+t,this.opacity=+s}ms(B,On,$r(ct,{brighter(n){return n=n==null?Pt:Math.pow(Pt,n),new B(this.r*n,this.g*n,this.b*n,this.opacity)},darker(n){return n=n==null?Qe:Math.pow(Qe,n),new B(this.r*n,this.g*n,this.b*n,this.opacity)},rgb(){return this},clamp(){return new B(ge(this.r),ge(this.g),ge(this.b),Lt(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:nr,formatHex:nr,formatHex8:Sa,formatRgb:sr,toString:sr}));function nr(){return`#${de(this.r)}${de(this.g)}${de(this.b)}`}function Sa(){return`#${de(this.r)}${de(this.g)}${de(this.b)}${de((isNaN(this.opacity)?1:this.opacity)*255)}`}function sr(){const n=Lt(this.opacity);return`${n===1?"rgb(":"rgba("}${ge(this.r)}, ${ge(this.g)}, ${ge(this.b)}${n===1?")":`, ${n})`}`}function Lt(n){return isNaN(n)?1:Math.max(0,Math.min(1,n))}function ge(n){return Math.max(0,Math.min(255,Math.round(n)||0))}function de(n){return n=ge(n),(n<16?"0":"")+n.toString(16)}function rr(n,e,t,s){return s<=0?n=e=t=NaN:t<=0||t>=1?n=e=NaN:e<=0&&(n=NaN),new J(n,e,t,s)}function Fr(n){if(n instanceof J)return new J(n.h,n.s,n.l,n.opacity);if(n instanceof ct||(n=Le(n)),!n)return new J;if(n instanceof J)return n;n=n.rgb();var e=n.r/255,t=n.g/255,s=n.b/255,i=Math.min(e,t,s),o=Math.max(e,t,s),a=NaN,l=o-i,u=(o+i)/2;return l?(e===o?a=(t-s)/l+(t<s)*6:t===o?a=(s-e)/l+2:a=(e-t)/l+4,l/=u<.5?o+i:2-o-i,a*=60):l=u>0&&u<1?0:a,new J(a,l,u,n.opacity)}function va(n,e,t,s){return arguments.length===1?Fr(n):new J(n,e,t,s??1)}function J(n,e,t,s){this.h=+n,this.s=+e,this.l=+t,this.opacity=+s}ms(J,va,$r(ct,{brighter(n){return n=n==null?Pt:Math.pow(Pt,n),new J(this.h,this.s,this.l*n,this.opacity)},darker(n){return n=n==null?Qe:Math.pow(Qe,n),new J(this.h,this.s,this.l*n,this.opacity)},rgb(){var n=this.h%360+(this.h<0)*360,e=isNaN(n)||isNaN(this.s)?0:this.s,t=this.l,s=t+(t<.5?t:1-t)*e,i=2*t-s;return new B(Tn(n>=240?n-240:n+120,i,s),Tn(n,i,s),Tn(n<120?n+240:n-120,i,s),this.opacity)},clamp(){return new J(ir(this.h),St(this.s),St(this.l),Lt(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 n=Lt(this.opacity);return`${n===1?"hsl(":"hsla("}${ir(this.h)}, ${St(this.s)*100}%, ${St(this.l)*100}%${n===1?")":`, ${n})`}`}}));function ir(n){return n=(n||0)%360,n<0?n+360:n}function St(n){return Math.max(0,Math.min(1,n||0))}function Tn(n,e,t){return(n<60?e+(t-e)*n/60:n<180?t:n<240?e+(t-e)*(240-n)/60:e)*255}const ys=n=>()=>n;function Ea(n,e){return function(t){return n+t*e}}function Ta(n,e,t){return n=Math.pow(n,t),e=Math.pow(e,t)-n,t=1/t,function(s){return Math.pow(n+s*e,t)}}function wa(n){return(n=+n)==1?qr:function(e,t){return t-e?Ta(e,t,n):ys(isNaN(e)?t:e)}}function qr(n,e){var t=e-n;return t?Ea(n,t):ys(isNaN(n)?e:n)}const In=(function n(e){var t=wa(e);function s(i,o){var a=t((i=On(i)).r,(o=On(o)).r),l=t(i.g,o.g),u=t(i.b,o.b),c=qr(i.opacity,o.opacity);return function(h){return i.r=a(h),i.g=l(h),i.b=u(h),i.opacity=c(h),i+""}}return s.gamma=n,s})(1);function xa(n,e){e||(e=[]);var t=n?Math.min(e.length,n.length):0,s=e.slice(),i;return function(o){for(i=0;i<t;++i)s[i]=n[i]*(1-o)+e[i]*o;return s}}function Ca(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Ra(n,e){var t=e?e.length:0,s=n?Math.min(t,n.length):0,i=new Array(s),o=new Array(t),a;for(a=0;a<s;++a)i[a]=sn(n[a],e[a]);for(;a<t;++a)o[a]=e[a];return function(l){for(a=0;a<s;++a)o[a]=i[a](l);return o}}function Aa(n,e){var t=new Date;return n=+n,e=+e,function(s){return t.setTime(n*(1-s)+e*s),t}}function et(n,e){return n=+n,e=+e,function(t){return n*(1-t)+e*t}}function Pa(n,e){var t={},s={},i;(n===null||typeof n!="object")&&(n={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in n?t[i]=sn(n[i],e[i]):s[i]=e[i];return function(o){for(i in t)s[i]=t[i](o);return s}}var Mn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,wn=new RegExp(Mn.source,"g");function La(n){return function(){return n}}function _a(n){return function(e){return n(e)+""}}function Hr(n,e){var t=Mn.lastIndex=wn.lastIndex=0,s,i,o,a=-1,l=[],u=[];for(n=n+"",e=e+"";(s=Mn.exec(n))&&(i=wn.exec(e));)(o=i.index)>t&&(o=e.slice(t,o),l[a]?l[a]+=o:l[++a]=o),(s=s[0])===(i=i[0])?l[a]?l[a]+=i:l[++a]=i:(l[++a]=null,u.push({i:a,x:et(s,i)})),t=wn.lastIndex;return t<e.length&&(o=e.slice(t),l[a]?l[a]+=o:l[++a]=o),l.length<2?u[0]?_a(u[0].x):La(e):(e=u.length,function(c){for(var h=0,f;h<e;++h)l[(f=u[h]).i]=f.x(c);return l.join("")})}function sn(n,e){var t=typeof e,s;return e==null||t==="boolean"?ys(e):(t==="number"?et:t==="string"?(s=Le(e))?(e=s,In):Hr:e instanceof Le?In:e instanceof Date?Aa:Ca(e)?xa:Array.isArray(e)?Ra:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Pa:et)(n,e)}function ka(n,e){return n=+n,e=+e,function(t){return Math.round(n*(1-t)+e*t)}}class le extends r.tl.Observer{cleanup(){}}class Zn extends le{static TYPE="noop-boolean-sink";set(){}}const rn={type:Zn.TYPE,props:{},variant:"sink",valueType:"boolean"};class Dn extends le{static TYPE="noop-numeric-sink";set(){}}const jr={type:Dn.TYPE,props:{},variant:"sink",valueType:"number"};class Nn extends le{static TYPE="noop-boolean-source";value(){return!1}}const bs={type:Nn.TYPE,props:{},variant:"source",valueType:"boolean"};class Yn extends le{static TYPE="noop-numeric-source";value(){return 0}}const Wr={type:Yn.TYPE,props:{},variant:"source",valueType:"number"};class zn extends le{static TYPE="noop-string-sink";set(){}}const Vr={type:zn.TYPE,props:{},variant:"sink",valueType:"string"};class Un extends le{static TYPE="noop-string-source";value(){return""}}const Ss={type:Un.TYPE,props:{},variant:"source",valueType:"string"};class Bn extends le{static TYPE="noop-status-source";value(){return{key:"noop",name:"noop",variant:"disabled",message:"unknown",time:r.d.now()}}}const vs={type:Bn.TYPE,props:{},variant:"source",valueType:"status"};class $n extends le{static TYPE="noop-color-source";value(){return r.Zu.ZERO}}const ut={type:$n.TYPE,props:{},variant:"source",valueType:"color"};class Fn extends le{static TYPE="noop-series";value(){return[r.Iu.ZERO,new r.Ru([])]}}const Xr={type:Fn.TYPE,props:{},variant:"source",valueType:"series"},Oa={[Zn.TYPE]:Zn,[Dn.TYPE]:Dn,[zn.TYPE]:zn,[Nn.TYPE]:Nn,[Yn.TYPE]:Yn,[Bn.TYPE]:Bn,[$n.TYPE]:$n,[Un.TYPE]:Un,[Fn.TYPE]:Fn};class Gr{type="noop";create(e){const t=Oa[e.type];return t==null?null:new t}}const Ia=d.z.instanceof(ArrayBuffer),ht=d.z.object({type:d.z.string(),variant:d.z.enum(["source","sink","source-transformer","sink-transformer"]),valueType:d.z.string(),props:d.z.any(),transfer:d.z.array(Ia).optional()}),ce=ht.extend({variant:d.z.literal("source")}),dt=ht.extend({variant:d.z.literal("sink")}),Kr=ht.extend({variant:d.z.literal("source-transformer")}),Qr=ht.extend({variant:d.z.literal("sink-transformer")}),_t=ce.extend({valueType:d.z.literal("series")}),Es=ce.extend({valueType:d.z.literal("boolean")}),on=dt.extend({valueType:d.z.literal("boolean")}),Ma=Qr.extend({valueType:d.z.literal("boolean")}),Za=Kr.extend({valueType:d.z.literal("boolean")}),Jr=ce.extend({valueType:d.z.literal("number")}),ei=dt.extend({valueType:d.z.literal("number")}),an=ce.extend({valueType:d.z.literal("color")}),Ts=ce.extend({valueType:d.z.literal("status")}),ln=ce.extend({valueType:d.z.literal("string")}),ti=dt.extend({valueType:d.z.literal("string")});let cn=class extends r.tl.BaseObserver{props_=void 0;uProps_=void 0;constructor(e){super(),this.uProps_=e}get props(){if(this.props_==null){const e=this.schema.safeParse(this.uProps_);if(e.success)this.props_=e.data;else throw new g.W(`[BaseTelem] - expected props to be valid, but found the following errors:
|
|
2
|
+
${e.error.message}`)}return this.props_}cleanup(){}};class j extends cn{}class un extends cn{}class be extends j{source_=void 0;get source(){if(this.source_==null)throw new g.W("[UnarySourceTransformer] - expected source to exist, but none was found.");return this.source_}value(){return this.transform(this.source.value())}onChange(e){return this.source.onChange(()=>{this.shouldNotify(this.source.value())&&e()})}setSources(e){this.source_=Object.values(e)[0]}shouldNotify(e){return!0}}class ni extends j{sources={};value(){const e=Object.fromEntries(Object.entries(this.sources).map(([t,s])=>[t,s.value()]));return this.transform(e)}setSources(e){this.sources={...this.sources,...e}}}class si extends cn{sinks={};get sink(){const[e]=Object.values(this.sinks);if(e==null)throw new g.W("[UnarySinkTransformer] - expected sink to exist, but none was found.");return e}set(...e){return this.sink.set(...this.transform(...e))}setSinks(e){this.sinks={...this.sinks,...e}}}const ws=d.z.object({from:d.z.string(),to:d.z.string()}),xs=d.z.object({connections:d.z.array(ws),outlet:d.z.string(),segments:d.z.record(d.z.string(),ce)});class Cs{type="pipeline";factory;constructor(e){this.factory=e}create(e){switch(e.type){case kt.TYPE:return new kt(e.props,this.factory);case Ot.TYPE:return new Ot(e.props,this.factory);default:return null}}}class kt extends j{static TYPE="source-pipeline";schema=xs;sources={};get outlet(){const{outlet:e}=this.props,t=this.sources[e];if(t==null)throw new g.W(`[SourcePipeline] - expected source to exist at outlet '${e}', but none was found.`);return t}constructor(e,t){super(e);const{connections:s,segments:i}=this.props;Object.entries(i).forEach(([o,a])=>{const l=t.create(a);l!=null&&(this.sources[o]=l)}),s.forEach(({from:o,to:a})=>{const l=this.sources[o],u=this.sources[a];l==null||u==null||"setSources"in u&&u.setSources({[o]:l})})}value(){return this.outlet.value()}onChange(e){return this.outlet.onChange(e)}cleanup(){Object.values(this.sources).forEach(e=>e.cleanup?.())}}const ri=(n,e)=>({variant:"source",props:e,type:kt.TYPE,valueType:n}),Rs=d.z.object({connections:d.z.array(ws),inlet:d.z.string(),segments:d.z.record(d.z.string(),dt)});class Ot extends un{static TYPE="sink-pipeline";schema=Rs;sinks={};get inlet(){const{inlet:e}=this.props,t=this.sinks[e];if(t==null)throw new g.W(`[SinkPipeline] - expected source to exist at inlet '${e}', but none was found.`);return t}constructor(e,t){super(e);const{connections:s,segments:i}=this.props;Object.entries(i).forEach(([o,a])=>{const l=t.create(a);l!=null&&(this.sinks[o]=l)}),s.forEach(({from:o,to:a})=>{const l=this.sinks[o],u=this.sinks[a];l==null||u==null||"setSinks"in l&&l.setSinks({[a]:u})})}set(...e){return this.inlet.set(...e)}cleanup(){Object.values(this.sinks).forEach(e=>e.cleanup?.())}}const ii=(n,e)=>({variant:"sink",props:e,type:Ot.TYPE,valueType:n}),As=d.z.object({channel:d.z.number().or(d.z.string())});class It extends j{static TYPE="stream-channel-value";schema=As;client;removeStreamHandler=null;leadingBuffer=null;valid=!1;onStatusChange;constructor(e,t,s){super(t),this.client=e,this.onStatusChange=s?.onStatusChange}get testingOnlyLeadingBuffer(){return this.leadingBuffer}get testingOnlyValid(){return this.valid}cleanup(){this.removeStreamHandler?.(),this.valid=!1,this.leadingBuffer?.release(),this.leadingBuffer=null,this.removeStreamHandler=null}value(){return r.pu.isZero(this.props.channel)?NaN:(this.valid||this.read(),this.leadingBuffer==null||this.leadingBuffer.length===0?NaN:this.leadingBuffer.at(-1,!0))}async read(){try{this.valid=!0,this.removeStreamHandler?.();const e=await this.client.retrieveChannel(this.props.channel),t=s=>{const i=s.get(e.key);if(i==null)return;const o=i.series.at(-1);o!=null&&(o.acquire(),this.leadingBuffer?.release(),this.leadingBuffer=o),this.notify()};this.removeStreamHandler=await this.client.stream(t,[e.key]),this.notify()}catch(e){this.valid=!1,this.onStatusChange?.(r.ol.fromException(e,"failed to stream channel value"))}}}const oi=async(n,e,t)=>{const s=await n.retrieveChannel(e),i=g.xA.isCalculated(s);if(!t||s.isIndex)return{key:s.key,dataType:s.dataType,virtual:s.virtual,isCalculated:i};if(s.virtual&&!i)throw new g.$n("cannot use virtual channels as a data source");return{key:s.index,dataType:r.f.TIMESTAMP,virtual:!1,isCalculated:i}},Da=d.z.object({timeRange:r.E.z,channel:d.z.number().or(d.z.string()),useIndexOfChannel:d.z.boolean().default(!1)});class Mt extends j{static TYPE="series-source";client;schema=Da;data=new r.Ru;valid=!1;channel=null;onStatusChange;constructor(e,t,s){super(t),this.client=e,this.onStatusChange=s?.onStatusChange}cleanup(){this.data.release(),this.valid=!1,this.channel=null}value(){const{channel:e,timeRange:t}=this.props;if(t.span.isZero||e===0)return[r.Iu.ZERO,this.data];this.valid||this.read();const{channel:s,data:i}=this;if(s==null)return[r.Iu.ZERO,this.data];let o=i.bounds;return s.dataType.equals(r.f.TIMESTAMP)&&(o=r.Iu.min([o,t.numericBounds])),[o,i]}async read(){try{this.valid=!0;const{timeRange:e,channel:t,useIndexOfChannel:s}=this.props;this.channel=await oi(this.client,t,s);const i=await this.client.read(e,this.channel.key);i.acquire(),this.data=i,this.notify()}catch(e){this.valid=!1,this.onStatusChange?.(r.ol.fromException(e,"failed to read channel data"))}}}const Na=d.z.object({channel:d.z.number().or(d.z.string()),useIndexOfChannel:d.z.boolean().default(!1),timeSpan:r.g.z,keepFor:r.g.z.optional()});class Zt extends j{static TYPE="dynamic-series-source";client;data=new r.Ru([]);now;onStatusChange;channel=null;stopStreaming;valid=!1;schema=Na;constructor(e,t,s,i=()=>r.d.now()){super(t),this.client=e,this.now=i,this.onStatusChange=s?.onStatusChange}value(){const{channel:e,timeSpan:t}=this.props;if(e===0)return[r.Iu.ZERO,this.data];this.valid||this.read();const{data:s,channel:i}=this,o=this.now();if(i!=null&&i.dataType.isVariable)return[r.Iu.ZERO,this.data];const a=s.series.filter(u=>u.timeRange.end.after(o.sub(t))).map(u=>u.bounds),l=r.Iu.max(a);return i!=null&&i.dataType.equals(r.f.TIMESTAMP)&&(l.lower=Math.max(l.lower,l.upper-Number(t.valueOf()))),[l,this.data]}async read(){try{this.valid=!0;const{channel:e,useIndexOfChannel:t,timeSpan:s}=this.props;this.channel=await oi(this.client,e,t);const i=this.now().spanRange(-s);if(!this.channel.virtual||this.channel.isCalculated)try{const a=await this.client.read(i,this.channel.key);a.acquire(),this.data.push(a)}catch(a){if(a instanceof Error&&(a.message.includes("cannot open iterator on virtual channel")||a.message.includes("cannot read from free channel")))console.warn("failed to read calculated channel data",a);else throw a}this.stopStreaming?.();const o=a=>{if(this.channel==null)return;const l=a.get(this.channel.key);l!=null&&(l.acquire(),this.data.push(l),this.notify(),this.gcOutOfRangeData())};this.stopStreaming=await this.client.stream(o,[this.channel.key]),this.notify()}catch(e){this.valid=!1,this.onStatusChange?.(r.ol.fromException(e,"failed to stream channel data"))}}gcOutOfRangeData(){const e=this.now().sub(this.props.keepFor??this.props.timeSpan),t=this.data.series.findIndex(s=>s.timeRange.end.before(e));t!==-1&&(this.data.series.splice(t,1).forEach(s=>s.release()),this.gcOutOfRangeData())}cleanup(){this.stopStreaming?.(),this.stopStreaming=void 0,this.data.release(),this.valid=!1}}const Ya={[Mt.TYPE]:Mt,[Zt.TYPE]:Zt,[It.TYPE]:It};class ai{type="remote";client;constructor(e){this.client=e}create(e,t){const s=Ya[e.type];return s==null?null:new s(this.client,e.props,t)}}const li=n=>({type:Mt.TYPE,props:n,variant:"source",valueType:"series"}),ci=n=>({type:Zt.TYPE,props:n,variant:"source",valueType:"series"}),ui=n=>({type:It.TYPE,props:n,variant:"source",valueType:"number"});class hi{type="static";create(e){switch(e.type){case qn.TYPE:return new qn(e.props);case Dt.TYPE:return new Dt(e.props);case Nt.TYPE:return new Nt(e.props);case Yt.TYPE:return new Yt(e.props);case zt.TYPE:return new zt(e.props);default:return null}}}const Ps=d.z.object({data:d.z.array(r.Cu),offsets:d.z.array(d.z.number()).default([])});class qn extends j{data;schema=Ps;static TYPE="static-series";constructor(e){super(e),this.data=this.props.data.map((t,s)=>new r.q({data:t,dataType:r.f.FLOAT32,timeRange:r.E.ZERO,sampleOffset:this.props.offsets[s]??0}))}value(){return[r.Iu.max(this.data.map(t=>t.bounds)),this.data]}}const di=Ps.extend({rate:r.$.z,yOffset:d.z.number().default(0),scroll:d.z.number().default(0),startPosition:d.z.number().default(0),scrollBounds:d.z.boolean().default(!1)});class Dt extends j{static TYPE="iterative-series";schema=di;position;interval;data;constructor(e){super(e),this.position=this.props.startPosition,this.start(this.props.rate),this.data=this.props.data.map((t,s)=>new r.q({data:t,dataType:r.f.FLOAT32,timeRange:r.E.ZERO,sampleOffset:this.props.offsets[s]??0}))}value(){const e=this.data.map(s=>s.slice(0,this.position));if(this.props.scrollBounds){const s=e[0].data[this.position-this.props.scroll<0?0:this.position-this.props.scroll],i=e[0].data[this.position-1];return[{lower:Number(s),upper:Number(i)},new r.Ru(e)]}return[r.Iu.max(e.map(s=>s.bounds)),new r.Ru(e)]}start(e){this.interval!=null&&clearInterval(this.interval),this.interval=setInterval(()=>{this.notify?.(),this.position++},e.period.milliseconds)}cleanup(){clearInterval(this.interval),this.interval=void 0}}const fi=d.z.number();class Nt extends j{static TYPE="static-numeric";schema=fi;value(){return this.props}}const pi=d.z.string();class Yt extends j{static TYPE="static-string";schema=pi;value(){return this.props}}const gi=r.Zu.crudeZ;class zt extends j{static TYPE="static-color";schema=gi;value(){return r.Zu.construct(this.props)}}const za=n=>({type:qn.TYPE,props:n,variant:"source",valueType:"series"}),Ua=n=>({type:Dt.TYPE,props:n,variant:"source",valueType:"series"}),Ba=n=>({type:Nt.TYPE,props:n,variant:"source",valueType:"number"}),$a=n=>({type:Yt.TYPE,props:n,variant:"source",valueType:"string"}),Fa=n=>({type:zt.TYPE,props:n,variant:"source",valueType:"color"});class mi{type="transformer";create(e){switch(e.type){case _e.TYPE:return new _e(e.props);case ke.TYPE:return new ke(e.props);case Oe.TYPE:return new Oe(e.props);case Ie.TYPE:return new Ie(e.props);case Me.TYPE:return new Me(e.props);case Ut.TYPE:return new Ut(e.props);case Ze.TYPE:return new Ze(e.props);case De.TYPE:return new De(e.props)}return null}}const qa=d.z.object({truthy:d.z.number().default(1),falsy:d.z.number().default(0)}),yi=n=>({props:n,type:_e.TYPE,variant:"sink",valueType:"boolean"});class _e extends si{static TYPE="boolean-numeric-converter-sink";static propsZ=qa;schema=_e.propsZ;transform(...e){return e.map(t=>t?this.props.truthy:this.props.falsy)}}const Ls=d.z.object({trueBound:r.Iu.bounds}),bi=n=>({props:n,type:ke.TYPE,variant:"source",valueType:"boolean"});class ke extends be{static TYPE="boolean-source";static propsZ=Ls;schema=ke.propsZ;curr=null;shouldNotify(e){const t=r.Iu.contains(this.props.trueBound,e)!==this.curr;return this.curr=r.Iu.contains(this.props.trueBound,e),t}transform(e){return this.curr=r.Iu.contains(this.props.trueBound,e),this.curr}}const Si=d.z.object({});class Oe extends ni{static TYPE="mean";static propsZ=Si;schema=Oe.propsZ;transform(e){return Object.values(e).reduce((t,s)=>t+s,0)/Object.keys(e).length}}const Ha=n=>({props:n,type:Oe.TYPE,variant:"source",valueType:"boolean"}),vi=d.z.object({trueVariant:r.ol.variantZ.default("success")});class Ie extends be{static TYPE="boolean-status";static propsZ=vi;schema=Ie.propsZ;transform(e){return e.variant===this.props.trueVariant}}const ja=n=>({props:n,type:Ie.TYPE,variant:"source",valueType:"boolean"}),_s=d.z.object({precision:d.z.number().default(2),prefix:d.z.string().default(""),suffix:d.z.string().default(""),notation:r.Qu.notationZ.default("standard")});class Me extends be{static TYPE="stringify-number";static propsZ=_s;schema=Me.propsZ;transform(e){if(isNaN(e))return"";const{precision:t,prefix:s,suffix:i,notation:o}=this.props;return`${s}${r.Qu.stringifyNumber(e,t,o)}${i}`}}const Ei=n=>({props:n,type:Me.TYPE,variant:"source",valueType:"string"}),ks=d.z.object({windowSize:d.z.number().default(5)});class Ut extends be{static TYPE="rolling-average";static propsZ=Si;schema=ks;values=[];transform(e){return this.props.windowSize<2||isNaN(e)?e:this.values.reduce((t,s)=>t+s,0)/this.values.length}shouldNotify(e){return this.props.windowSize<2?!0:(this.values.length>this.props.windowSize&&(this.values=[]),this.values.push(e),this.values.length===this.props.windowSize)}}const Ti=n=>({props:n,type:Ut.TYPE,variant:"source",valueType:"number"}),wi=d.z.object({gradient:r.Zu.gradientZ});class Ze extends be{static TYPE="color-gradient";static propsZ=wi;schema=Ze.propsZ;transform(e){return r.Zu.fromGradient(this.props.gradient,e)}}const xi=n=>({props:n,type:Ze.TYPE,variant:"source",valueType:"color"}),Ci=d.z.object({scale:r.Tu.transform});class De extends be{static TYPE="scale-number";static propsZ=Ci;schema=De.propsZ;transform(e){if(isNaN(e))return e;const{offset:t,scale:s}=this.props.scale;return e*s+t}}const Ri=n=>({props:n,type:De.TYPE,variant:"source",valueType:"number"}),Os=d.z.enum(["average","decimate"]),Wa=d.z.object({mode:Os,windowSize:d.z.number().default(5)}),Va=n=>({props:n,type:tt.TYPE,variant:"source",valueType:"number"}),Ai=(n,e,t)=>{const s=e.length*t;for(let i=s;i<n.length;i+=t){const o=n.sub(i,i+1);o!==void 0&&e.write(o)}},Xa=(n,e,t)=>{const s=e.length*t;for(let i=s;i<n.length&&!(i+t>n.length);i+=t){const o=Math.min(i+t,n.length);let a=0,l=0;for(let u=i;u<o;u++){const c=n.at(u);c!==void 0&&typeof c=="number"&&(a+=c,l++)}l>0&&e.write(new r.q({data:[a/l],dataType:n.dataType}))}},Ga={decimate:Ai,average:Xa};class tt{static TYPE="series-downsampler";_downsample=null;cache=new r.Ru;props;constructor(e){this.props=e}downsample(e){return this._downsample==null&&(e.series[0].sampleOffset!==0?this._downsample=Ai:this._downsample=Ga[this.props.mode]),this._downsample}transform(e){if(this.props.mode==="decimate"||this.props.windowSize<=1)return e;if(e.series.length===0)return this.cache;for(;this.cache.series.length>0&&!this.cache.series[0].key.startsWith(e.series[0].key);)this.cache.series.shift();return e.series.forEach((t,s)=>{let i=this.cache.series.at(s);if(i==null){const o=Math.ceil(t.capacity/this.props.windowSize);i=r.q.alloc({key:t.key+r.Ou.create(),dataType:t.dataType,capacity:o,alignment:t.alignment,alignmentMultiple:BigInt(this.props.windowSize),sampleOffset:t.sampleOffset,timeRange:t.timeRange}),this.cache.push(i)}else if(!i.key.startsWith(t.key))throw new g.St(`[SeriesDownsampler] - expected series with key ${t.key} to be in cache, but found ${i.key}`);this.downsample(e)(t,i,this.props.windowSize)}),this.cache}}const Ka=n=>({props:n,type:tt.TYPE,variant:"source",valueType:"series"});class Is{factories;type="compound";constructor(e){this.factories=e}add(e){this.factories=[...this.factories.filter(t=>t.type!==e.type),e]}create(e,t){for(const s of this.factories){const i=s.create(e,t);if(i!=null)return i}return null}}const Pi=n=>{const e=[new mi,new hi,new Gr],t=new Is(e);return n!=null&&t.add(new ai(n)),t.add(new Cs(t)),t};let Li=class _i{factory;key;parent;constructor(e,t){this.factory=e,this.key=r.Ou.create(),this.parent=t}child(e,t){const s=new Is([...this.factory.factories,...r.du.toArray(e)]);return s.add(new Cs(s)),new _i(s,t)}create(e,t){const s=this.factory.create(e,t);if(s==null)throw new g.St(`Telemetry service could not find a source for type ${e.type}`);return s}};const ft="pluto-telem-context",hn=n=>n.get(ft),ki=(n,e)=>n.set(ft,e),Oi=(n,e,t)=>{const s=hn(n);if(s!=null&&t!=null&&s.key===t?.parent?.key)return t;const i=s.child(e,s);return n.set(ft,i),i};class Ii{spec;wrapped;prevProv;constructor(e,t,s){this.wrapped=e,this.spec=s,this.prevProv=t}shouldUpdate(e,t){return this.prevProv.key!==e.key||!r.Vu.equal(this.spec,t)}}class or extends Ii{value(){return this.wrapped.value()}cleanup(){this.wrapped.cleanup?.()}onChange(e){return this.wrapped.onChange(e)}}class ar extends Ii{set(...e){this.wrapped.set(...e)}cleanup(){this.wrapped.cleanup?.()}}const $=(n,e,t,s)=>{const i=hn(n);if(t instanceof or){if(!t.shouldUpdate(i,e))return t;t.cleanup?.()}return new or(i.create(e,s),i,e)},Fe=(n,e,t,s)=>{const i=hn(n);if(t instanceof ar){if(!t.shouldUpdate(i,e))return t;t.cleanup?.()}return new ar(i.create(e,s),i,e)},Mi=(n,e)=>n.dataType.isVariable||n.dataType.equals(r.f.UINT8)?n:(e==null&&n.dataType.equals(r.f.TIMESTAMP)&&(e=BigInt(n.data[0])),n.convert(r.f.FLOAT32,e)),Qa=n=>n.isVariable||n.equals(r.f.UINT8)?n:r.f.FLOAT32,Zi=()=>({purgedSeries:0,purgedBytes:r.p.bytes(0)}),Di={instrumentation:g.g.NOOP,staleEntryThreshold:r.g.seconds(20)};class Ja{data=[];props;constructor(e){this.props={...Di,...e}}write(e){e.length!==0&&(e.series.forEach(t=>this.writeOne(Mi(t))),this.checkIntegrity(e))}dirtyRead(e){const t=this.data.filter(({data:a})=>a.timeRange.overlapsWith(e)).map(({data:a})=>a);if(t.length===0)return{series:new r.Ru([]),gaps:[e]};const s=t.map((a,l)=>l===0?r.E.ZERO:new r.E(t[l-1].timeRange.end,a.timeRange.start)).filter(a=>!a.span.isZero&&a.isValid),i=new r.E(e.start,t[0].timeRange.start),o=new r.E(t[t.length-1].timeRange.end,e.end);return i.isValid&&!i.span.isZero&&s.unshift(i),o.isValid&&!o.span.isZero&&s.push(o),{series:new r.Ru(t),gaps:s}}gc(){const{staleEntryThreshold:e}=this.props,t=Zi(),s=this.data.filter(i=>{const o=i.data.refCount>0||r.d.since(i.addedAt).lessThan(e);return o||(t.purgedBytes=t.purgedBytes.add(i.data.byteCapacity)),o});return t.purgedSeries=this.data.length-s.length,this.data=s,t}close(){this.data=[]}writeOne(e){const{instrumentation:{L:t}}=this.props;if(e.length===0)return;const s=r.Iu.buildInsertionPlan(this.data.map(u=>u.data.alignmentBounds),e.alignmentBounds);if(s===null)return t.debug("Found no viable insertion plan",{inserting:e.digest,cacheContents:this.data.map(u=>u.data.digest)});const{removeBefore:i,removeAfter:o,insertInto:a,deleteInBetween:l}=s;e=e.slice(i,e.data.length-o),e.length!==0&&this.data.splice(a,l,{data:e,addedAt:r.d.now()})}checkIntegrity(e){const{instrumentation:{L:t}}=this.props,s=this.data.map(o=>o.data.alignmentBounds);if(s.some((o,a)=>s.some((l,u)=>a===u?!1:r.Iu.overlapsWith(o,l))))throw t.debug("Cache is in an invalid state - bounds overlap!",()=>({write:e.series.map(o=>o.digest),cacheContents:this.data.map(o=>o.data.digest)})),new Error("Invalid state")}}const el=100,tl=1e6,nl=1e4,sl=100,rl=40;class il{props;counter=0;curr;avgRate=0;timeOfLastWrite;totalWrites=0;now=()=>r.d.now();constructor(e){this.props=e,this.curr=null,e.now!=null&&(this.now=e.now),this.timeOfLastWrite=this.now()}get length(){return this.curr?.length??0}get leadingBuffer(){return this.curr}write(e){const t=e.series.flatMap(s=>this._write(s));return{flushed:new r.Ru(t.flatMap(s=>s.flushed.series)),allocated:new r.Ru(t.flatMap(s=>s.allocated.series))}}allocate(e,t,s){this.counter++;const i=this.props.dataType.isVariable,o=this.props.dataType.equals(r.f.TIMESTAMP);return r.q.alloc({capacity:i?e*rl:e,dataType:Qa(this.props.dataType),timeRange:s.range(r.d.MAX),sampleOffset:o?s.valueOf():0,glBufferUsage:"dynamic",alignment:t,key:`dynamic-${this.counter}`})}_write(e){const t=this.nextBufferSize(),s={flushed:new r.Ru([]),allocated:new r.Ru([])};if(this.curr==null)this.curr=this.allocate(t,e.alignment,this.now()),s.allocated.push(this.curr);else if(Math.abs(Number(this.curr.alignment+BigInt(this.curr.length)-e.alignment))>1){const u=this.now();this.curr.timeRange.end=u,s.flushed.push(this.curr),this.curr=this.allocate(t,e.alignment,u),s.allocated.push(this.curr)}const i=Mi(e,this.curr.sampleOffset),o=this.curr.write(i);if(o===e.length)return this.updateAvgRate(e),s;const a=this.now();this.curr.timeRange.end=a,s.flushed.push(this.curr),this.curr=this.allocate(t,e.alignment+BigInt(o),a),s.allocated.push(this.curr);const l=this._write(e.slice(o));return s.flushed.push(l.flushed),s.allocated.push(l.allocated),s}updateAvgRate(e){if(typeof this.props.dynamicBufferSize=="number")return;const t=e.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:e}=this.props;if(typeof e=="number")return e;if(this.totalWrites<sl)return nl;const t=r.Nu.roundToNearestMagnitude(this.avgRate*e.seconds);return Math.round(Math.max(Math.min(t,tl),el))}close(){this.curr=null}}class ol{channel;closed=!1;ins;static;dynamic;constructor(e){this.channel=e.channel,this.ins=e.instrumentation??g.g.NOOP,this.static=new Ja(e),this.dynamic=new il({dynamicBufferSize:e.dynamicBufferSize,dataType:this.channel.dataType})}writeDynamic(e){if(this.closed)return this.ins.L.warn(`Ignoring attempted dynamic write to a closed cache for channel ${this.channel.name}`),new r.Ru([]);const{flushed:t,allocated:s}=this.dynamic.write(e);return t.length>0&&this.static.write(t),s}get leadingBuffer(){return this.dynamic.leadingBuffer}writeStatic(e){if(this.closed)return this.ins.L.warn(`Ignoring attempted static write to a closed cache for channel ${this.channel.name}`);this.static.write(e)}read(e){return this.closed?(this.ins.L.warn(`Ignoring attempted dirty read from a closed cache for channel ${this.channel.name}`),{series:new r.Ru([]),gaps:[e]}):this.static.dirtyRead(e)}gc(){return this.closed?(this.ins.L.warn(`Ignoring attempted garbage collection on a closed cache for channel ${this.channel.name}`),{purgedSeries:0,purgedBytes:r.p.bytes(0)}):this.static.gc()}close(){this.closed=!0,this.dynamic.close(),this.static.close()}}const al=g.g$1.seconds(60);class ll{props;cache=new Map;gcInterval;constructor(e){this.props={dynamicBufferSize:al,gcInterval:g.g$1.seconds(30),...Di,...e},this.gcInterval=setInterval(()=>this.gc(),this.props.gcInterval.milliseconds)}async populateMissing(e){const{instrumentation:t,channelRetriever:s,dynamicBufferSize:i}=this.props,o=[];for(const l of e)this.cache.has(l)||o.push(l);if(o.length===0)return;(await s.retrieve(o)).forEach(l=>{if(this.cache.has(l.key))return;const u=new ol({channel:l,dynamicBufferSize:i,instrumentation:t.child(`cache-${l.name}-${l.key}`)});this.cache.set(l.key,u)})}get(e){const t=this.cache.get(e);if(t!=null)return t;throw new g.St(`cache entry for ${e} not found`)}gc(){const{instrumentation:{L:e}}=this.props;e.info("starting garbage collection");const t=Zi();this.cache.forEach(s=>{const i=s.gc();t.purgedSeries+=i.purgedSeries,t.purgedBytes=t.purgedBytes.add(i.purgedBytes)}),e.info("garbage collection complete",{purgedSeries:t.purgedSeries,purgedBytes:t.purgedBytes.toString()},!0)}close(){clearInterval(this.gcInterval),this.cache.forEach(e=>e.close()),this.cache.clear()}}class cl{args;debouncedRead;mu=r.al.newMutex({requests:new Set,closed:!1});constructor(e){this.args={...e,instrumentation:e.instrumentation??g.g.NOOP,batchDebounce:e.batchDebounce??r.g.milliseconds(50),overlapThreshold:e.overlapThreshold??r.g.milliseconds(5)};const t=this.args.batchDebounce.milliseconds;this.debouncedRead=r.Fu(()=>void this.batchRead(),t)}async read(e,t){const{cache:s}=this.args;await s.populateMissing([t]);const i=s.get(t),{series:o,gaps:a}=i.read(e);if(a.length===0)return o;const{mu:l}=this;return await new Promise((u,c)=>{l.runExclusive(async()=>{l.closed||l.requests.add({channel:t,gaps:a,resolve:u,reject:c})}),this.debouncedRead()}),i.read(e).series}async batchRead(){const{readRemote:e,cache:t,overlapThreshold:s}=this.args,{mu:i}=this;await i.runExclusive(async()=>{const o=a=>i.requests.forEach(({resolve:l,reject:u})=>a==null?l():u(a));try{if(i.closed)return o();const a=[];i.requests.forEach(({channel:l,gaps:u})=>u.forEach(c=>{const h=a.find(f=>f.gap.equals(c,s));h==null?a.push({gap:c,channels:new Set([l])}):(h.channels.add(l),h.gap=r.E.max(h.gap,c))})),await Promise.all(a.map(async({gap:l,channels:u})=>{const c=await e(l,Array.from(u));u.forEach(h=>t.get(h).writeStatic(c.get(h)))})),o()}catch(a){o(a)}finally{i.requests.clear()}})}async close(){await this.mu.runExclusive(async()=>{this.mu.closed=!0})}}const ul=new Error("request for lock canceled");var hl=function(n,e,t,s){function i(o){return o instanceof t?o:new t(function(a){a(o)})}return new(t||(t=Promise))(function(o,a){function l(h){try{c(s.next(h))}catch(f){a(f)}}function u(h){try{c(s.throw(h))}catch(f){a(f)}}function c(h){h.done?o(h.value):i(h.value).then(l,u)}c((s=s.apply(n,e||[])).next())})};class dl{constructor(e,t=ul){this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}acquire(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((s,i)=>{const o={resolve:s,reject:i,weight:e,priority:t},a=Ni(this._queue,l=>t<=l.priority);a===-1&&e<=this._value?this._dispatchItem(o):this._queue.splice(a+1,0,o)})}runExclusive(e){return hl(this,arguments,void 0,function*(t,s=1,i=0){const[o,a]=yield this.acquire(s,i);try{return yield t(o)}finally{a()}})}waitForUnlock(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,t)?Promise.resolve():new Promise(s=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),fl(this._weightedWaiters[e-1],{resolve:s,priority:t})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const t=this._weightedWaiters[e-1];t&&(t.forEach(s=>s.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let t=this._value;t>0;t--){const s=this._weightedWaiters[t-1];if(!s)continue;const i=s.findIndex(o=>o.priority<=e);(i===-1?s:s.splice(0,i)).forEach((o=>o.resolve()))}}}_couldLockImmediately(e,t){return(this._queue.length===0||this._queue[0].priority<t)&&e<=this._value}}function fl(n,e){const t=Ni(n,s=>e.priority<=s.priority);n.splice(t+1,0,e)}function Ni(n,e){for(let t=n.length-1;t>=0;t--)if(e(n[t]))return t;return-1}var pl=function(n,e,t,s){function i(o){return o instanceof t?o:new t(function(a){a(o)})}return new(t||(t=Promise))(function(o,a){function l(h){try{c(s.next(h))}catch(f){a(f)}}function u(h){try{c(s.throw(h))}catch(f){a(f)}}function c(h){h.done?o(h.value):i(h.value).then(l,u)}c((s=s.apply(n,e||[])).next())})};class gl{constructor(e){this._semaphore=new dl(1,e)}acquire(){return pl(this,arguments,void 0,function*(e=0){const[,t]=yield this._semaphore.acquire(1,e);return t})}runExclusive(e,t=0){return this._semaphore.runExclusive(()=>e(),1,t)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}const ml=r.g.milliseconds(100).milliseconds,yl=r.$.hz(60).valueOf();class bl{props;mu=new gl;listeners=new Map;debouncedUpdateStreamer;streamerRunLoop=null;streamer=null;closed=!1;constructor(e){this.props={instrumentation:g.g.NOOP,...e,streamUpdateDelay:new r.g(e.streamUpdateDelay??r.g.seconds(5))},this.debouncedUpdateStreamer=r.Fu(()=>void this.updateStreamer(),ml)}async stream(e,t){const{cache:s,instrumentation:i}=this.props;return this.closed?()=>{}:(await s.populateMissing(t),await this.mu.runExclusive(async()=>{i.L.debug("adding stream handler",{keys:t}),this.listeners.set(e,{valid:!0,keys:new Set(t)});const o=new Map(t.map(a=>{const l=s.get(a);return[a,new r.Ru(r.du.toArray(l.leadingBuffer))]}));return e(o),this.debouncedUpdateStreamer(),()=>this.removeStreamHandler(e)}))}removeStreamHandler(e){const{instrumentation:t}=this.props;this.mu.runExclusive(()=>{const s=this.listeners.get(e);s!=null&&(s.valid=!1)}),setTimeout(()=>{this.mu.runExclusive(async()=>{if(t.L.debug("removing stream handler"),this.listeners.delete(e))return this.debouncedUpdateStreamer();t.L.warn("attempted to remove non-existent stream handler")})},this.props.streamUpdateDelay.milliseconds)}async updateStreamer(){if(this.closed)return;const{instrumentation:e}=this.props;try{const t=new Set;if(this.listeners.forEach(o=>o.keys.forEach(a=>t.add(a))),t.size===0){e.L.info("no keys to stream, closing streamer"),this.streamer?.close(),this.streamerRunLoop!=null&&await this.streamerRunLoop,this.streamer=null,e.L.info("streamer closed successfully");return}const s=Array.from(t);if(r.wu.primitiveArrays(s,this.streamer?.keys??[])===r.wu.EQUAL){e.L.debug("streamer keys unchanged",{keys:s});return}this.streamer==null&&(e.L.info("creating new streamer",{keys:s}),this.streamer=await this.props.openStreamer({channels:s,throttleRate:yl}),this.streamerRunLoop=this.runStreamer(this.streamer)),e.L.debug("updating streamer",{prev:this.streamer.keys,next:s}),await this.streamer.update(s)}catch(t){throw e.L.error("failed to update streamer",{error:t}),t}}async runStreamer(e){const{cache:t,instrumentation:s}=this.props;try{for await(const i of e){const o=new Map;for(const a of i.keys){const l=i.get(a),c=t.get(a).writeDynamic(l);o.set(a,c)}o.size!==0&&this.listeners.forEach(({valid:a},l)=>a&&l(o))}}catch(i){throw s.L.error("streamer run loop failed",{error:i},!0),i}}async close(){const{instrumentation:e}=this.props;try{this.streamer?.close(),this.streamerRunLoop!=null&&await this.streamerRunLoop}catch(t){e.L.error("failed to close streamer",{error:t})}this.closed=!0}}class Sl{async retrieveChannel(){throw new g.$n("NoopClient does not support retrieving channels")}async read(){return new r.Ru([])}async stream(){return async()=>{}}async close(){}}class vl{ins;cache;reader;streamer;channelRetriever;constructor({instrumentation:e,core:t}){this.ins=e,this.channelRetriever=t.channels.createDebouncedBatchRetriever(10),this.cache=new ll({channelRetriever:this.channelRetriever,instrumentation:this.ins.child("cache")}),this.reader=new cl({cache:this.cache,readRemote:t.read.bind(t),instrumentation:this.ins.child("reader")}),this.streamer=new bl({cache:this.cache,openStreamer:async s=>g.jA.HardenedStreamer.open(t.openStreamer.bind(t),s),instrumentation:this.ins.child("streamer")})}async retrieveChannel(e){const t=await this.channelRetriever.retrieve([e]);if(t.length===0)throw new g.at(`channel ${e} not found`);return t[0]}async read(e,t){return await this.reader.read(e,t)}async stream(e,t){return await this.streamer.stream(e,t)}async close(){this.ins.L.info("closing client"),await this.streamer.close(),await this.reader.close(),this.cache.close()}}const Ms=d.z.object({}),dn="telem.Provider",Yi=n=>{class e extends g.Composite{static TYPE=dn;static stateZ=Ms;schema=e.stateZ;prevCore=null;client=null;afterUpdate(s){const{internal:i}=this,o=$e(s),a=g.useErrorHandler(s);if(i.instrumentation=Z.useInstrumentation(s,"telem").child("provider"),!(o!==this.prevCore||!s.wasSetPreviously(ft)))return;this.prevCore=o,this.client!=null&&a(async()=>{if(this.client==null)throw new Error("no client to close");await this.client.close()},"failed to close client"),this.client=o==null?new Sl:new vl({core:o,instrumentation:i.instrumentation});const u=n(this.client),c=new Li(u);ki(s,c)}}return e},zi=Yi(Pi),Ui={[dn]:zi},El=Object.freeze(Object.defineProperty({__proto__:null,AbstractSink:un,AbstractSource:j,Base:cn,BooleanStatus:Ie,CONTEXT_KEY:ft,ChannelData:Mt,ColorGradient:Ze,CompoundFactory:Is,Context:Li,FixedColorSource:zt,FixedNumber:Nt,FixedString:Yt,IterativeSeries:Dt,Mean:Oe,MultiSourceTransformer:ni,NoopFactory:Gr,PROVIDER_TYPE:dn,PipelineFactory:Cs,Provider:zi,REGISTRY:Ui,RemoteFactory:ai,RollingAverage:Ut,ScaleNumber:De,SeriesDownsampler:tt,SetPoint:_e,SinkPipeline:Ot,SourcePipeline:kt,StaticFactory:hi,StreamChannelData:Zt,StreamChannelValue:It,StringifyNumber:Me,TransformerFactory:mi,UnarySinkTransformer:si,UnarySourceTransformer:be,WithinBounds:ke,booleanSinkSpecZ:on,booleanSinkTransformerSpecZ:Ma,booleanSourceSpecZ:Es,booleanSourceTransformerSpecZ:Za,booleanStatus:ja,booleanStatusProps:vi,channelData:li,colorGradient:xi,colorGradientProps:wi,colorSourceSpecZ:an,connectionZ:ws,createFactory:Pi,createProvider:Yi,downsampleMode:Va,downsampleModeProps:Wa,downsampleModeZ:Os,fixedArray:za,fixedColor:Fa,fixedColorSourcePropsZ:gi,fixedNumber:Ba,fixedNumberPropsZ:fi,fixedSeriesPropsZ:Ps,fixedString:$a,fixedStringPropsZ:pi,iterativeArray:Ua,iterativeSeriesPropsZ:di,mean:Ha,noopBooleanSinkSpec:rn,noopBooleanSourceSpec:bs,noopColorSourceSpec:ut,noopNumericSinkSpec:jr,noopNumericSourceSpec:Wr,noopSeriesSourceSpec:Xr,noopStatusSourceSpec:vs,noopStringSinkSpec:Vr,noopStringSourceSpec:Ss,numberSinkSpecZ:ei,numberSourceSpecZ:Jr,providerStateZ:Ms,rollingAverage:Ti,rollingAverageProps:ks,scaleNumber:Ri,scaleNumberProps:Ci,seriesDownsampler:Ka,seriesSourceSpecZ:_t,setContext:ki,setpoint:yi,sinkPipeline:ii,sinkPipelinePropsZ:Rs,sinkSpecZ:dt,sinkTransformerSpecZ:Qr,sourcePipeline:ri,sourcePipelinePropsZ:xs,sourceSpecZ:ce,sourceTransformerSpecZ:Kr,specZ:ht,statusSourceSpecZ:Ts,streamChannelData:ci,streamChannelValue:ui,streamChannelValuePropsZ:As,stringSinkSpecZ:ti,stringSourceSpecZ:ln,stringifyNumber:Ei,stringifyNumberProps:_s,useChildContext:Oi,useContext:hn,useSink:Fe,useSource:$,withinBounds:bi,withinBoundsProps:Ls},Symbol.toStringTag,{value:"Module"})),lr=`#version 300 es
|
|
3
|
+
precision lowp float;
|
|
4
|
+
|
|
5
|
+
uniform lowp vec4 u_color;
|
|
6
|
+
out vec4 fragColor;
|
|
7
|
+
|
|
8
|
+
void main(void) {
|
|
9
|
+
fragColor = u_color;
|
|
10
|
+
}
|
|
11
|
+
`,Tl=`#version 300 es
|
|
12
|
+
|
|
13
|
+
// Copyright 2025 Synnax Labs, Inc.
|
|
14
|
+
//
|
|
15
|
+
// Use of this software is governed by the Business Source License included in the file
|
|
16
|
+
// licenses/BSL.txt.
|
|
17
|
+
//
|
|
18
|
+
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
19
|
+
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
20
|
+
// included in the file licenses/APL.txt.
|
|
21
|
+
|
|
22
|
+
in mediump float a_x;
|
|
23
|
+
in mediump float a_y;
|
|
24
|
+
in mediump vec2 a_translate;
|
|
25
|
+
|
|
26
|
+
uniform mediump vec2 u_scale_aggregate;
|
|
27
|
+
uniform mediump vec2 u_offset_aggregate;
|
|
28
|
+
|
|
29
|
+
void main(void) {
|
|
30
|
+
gl_Position = vec4((u_scale_aggregate * vec2(a_x, a_y) + u_offset_aggregate) + a_translate, 0.0, 1.0);
|
|
31
|
+
}
|
|
32
|
+
`,wl=`#version 300 es
|
|
33
|
+
|
|
34
|
+
// Copyright 2025 Synnax Labs, Inc.
|
|
35
|
+
//
|
|
36
|
+
// Use of this software is governed by the Business Source License included in the file
|
|
37
|
+
// licenses/BSL.txt.
|
|
38
|
+
//
|
|
39
|
+
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
40
|
+
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
41
|
+
// included in the file licenses/APL.txt.
|
|
42
|
+
|
|
43
|
+
in mediump float a_x;
|
|
44
|
+
in mediump uint a_y;
|
|
45
|
+
in mediump vec2 a_translate;
|
|
46
|
+
|
|
47
|
+
uniform mediump vec2 u_scale_aggregate;
|
|
48
|
+
uniform mediump vec2 u_offset_aggregate;
|
|
49
|
+
|
|
50
|
+
void main(void) {
|
|
51
|
+
gl_Position = vec4((u_scale_aggregate * vec2(a_x, float(a_y)) + u_offset_aggregate) + a_translate, 0.0, 1.0);
|
|
52
|
+
}
|
|
53
|
+
`,Bi=d.z.object({x:_t,y:_t,label:d.z.string().optional(),color:r.Zu.colorZ,strokeWidth:d.z.number().default(1),downsample:d.z.number().min(1).max(50).default(1),downsampleMode:Os.default("decimate"),visible:d.z.boolean().default(!0)}),xl=(n,e,t)=>n===-1||e===-1||n>=t.series.length?NaN:Number(t.series[n].at(e)),Cl=r.g.milliseconds(2);r.Au.NAN,r.Au.NAN,r.Zu.ZERO,r.Iu.ZERO;const Rl=(n,e)=>e.equals(r.f.UINT8)?n.UNSIGNED_BYTE:n.FLOAT;class cr extends Z.GLProgram{translationBufferCache=new Map;constructor(e,t,s){super(e,t,s),this.translationBufferCache=new Map}bindState({strokeWidth:e,color:t}){return this.uniformColor("u_color",t),this.attrStrokeWidth(e)}bindScale(e,t){const s=r.Au.scale(e.scale,t.scale),i=r.Au.translate(r.Au.scale(t.scale,e.offset),t.offset);this.uniformXY("u_scale_aggregate",s),this.uniformXY("u_offset_aggregate",i)}draw({x:e,y:t,count:s,downsample:i,xOffset:o,yOffset:a},l,u,c){const{gl:h}=this.renderCtx;this.bindAttrBuffer("x",e.glBuffer,i,o,u),this.bindAttrBuffer("y",t.glBuffer,i,a,c),h.drawArraysInstanced(h.LINE_STRIP,0,s/i,l)}bindAttrBuffer(e,t,s,i=0,o){const{gl:a}=this.renderCtx;a.bindBuffer(a.ARRAY_BUFFER,t);const l=a.getAttribLocation(this.prog,`a_${e}`),u=Rl(a,o),c=o.density.valueOf();o.equals(r.f.UINT8)?a.vertexAttribIPointer(l,1,u,c*s,c*i):a.vertexAttribPointer(l,1,u,!1,c*s,c*i),a.enableVertexAttribArray(l)}getAndBindTranslationBuffer(e){const{gl:t}=this.renderCtx,s=`${this.renderCtx.aspect}:${e}`,i=this.translationBufferCache.get(s);if(i!=null)return t.bindBuffer(t.ARRAY_BUFFER,i.glBuffer),i;const o=t.createBuffer();if(o==null)throw new g.St("Failed to create buffer from WebGL context");const a=Pl(this.renderCtx.aspect,e);t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,a,t.DYNAMIC_DRAW);const l={glBuffer:o,jsBuffer:a};return this.translationBufferCache.set(s,l),l}attrStrokeWidth(e){const{gl:t}=this.renderCtx,{jsBuffer:s}=this.getAndBindTranslationBuffer(e),i=t.getAttribLocation(this.prog,"a_translate");return t.vertexAttribPointer(i,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(i),t.vertexAttribDivisor(i,1),s.length/2}}class Pe{static CONTEXT_KEY="pluto-line-gl-program";uint8HybridProgram;float32Program;constructor(e){this.uint8HybridProgram=new cr(e,wl,lr),this.float32Program=new cr(e,Tl,lr)}get gl(){return this.uint8HybridProgram.renderCtx.gl}getProgram(e){return e.equals(r.f.UINT8)?this.uint8HybridProgram:this.float32Program}static create(e,t){const s=new Pe(t);return e.set(Pe.CONTEXT_KEY,s),s}static use(e){const t=e.get(Pe.CONTEXT_KEY);if(t==null)throw new g.St("GLProgram not found");return t}}class Bt extends g.Leaf{static TYPE="line";schema=Bi;afterUpdate(e){const{internal:t}=this,s={onStatusChange:g.useAdder(e)};t.xTelem=$(e,this.state.x,t.xTelem,s),t.yTelem=$(e,this.state.y,t.yTelem,s),t.instrumentation=Z.useInstrumentation(e,"line"),t.lineCtx=Pe.use(e),t.requestRender=nn(e),t.stopListeningXTelem?.(),t.stopListeningYTelem?.(),t.stopListeningXTelem=t.xTelem.onChange(()=>t.requestRender("data")),t.stopListeningYTelem=t.yTelem.onChange(()=>t.requestRender("data")),t.requestRender("layout"),(t.xDownsampler?.props.mode!==this.state.downsampleMode||t.xDownsampler?.props.windowSize!==this.state.downsample)&&(t.xDownsampler=new tt({mode:this.state.downsampleMode,windowSize:this.state.downsample}),t.yDownsampler=new tt({mode:this.state.downsampleMode,windowSize:this.state.downsample}))}afterDelete(){const{internal:e}=this;e.xTelem.cleanup?.(),e.yTelem.cleanup?.(),e.requestRender("layout")}xBounds(){return this.internal.xTelem.value()[0]}yBounds(){return this.internal.yTelem.value()[0]}findByXValue(e,t){const{xTelem:s,yTelem:i}=this.internal;let[,o]=s.value();o=this.internal.xDownsampler.transform(o);let[a,l]=[-1,-1];o.series.find((E,x)=>{const A=E.binarySearch(t),C=A>=0&&A<E.length;return C&&([a,l]=[A,x]),C});const{key:u}=this,{color:c,label:h}=this.state,f={key:u,color:c,label:h,position:{x:0,y:0},value:{x:NaN,y:NaN},bounds:{lower:0,upper:0}};if(a===-1||l===-1||!this.state.visible)return f;const p=o.series[l];f.value.x=xl(l,a,o);let[,y]=i.value();y=this.internal.yDownsampler.transform(y);const S=y.series.find(E=>r.Iu.contains(E.alignmentBounds,p.alignment+BigInt(a)));if(S==null)return f;const b=Number(S.alignment-p.alignment);return f.value.y=Number(S.at(a-b)),f.bounds={...S.bounds},f.position={x:e.dataToDecimalScale.x.pos(f.value.x),y:e.dataToDecimalScale.y.pos(f.value.y)},f}render(e){if(this.deleted||!this.state.visible)return;const{downsample:t}=this.state,{xTelem:s,yTelem:i,lineCtx:o,xDownsampler:a,yDownsampler:l}=this.internal,{dataToDecimalScale:u,exposure:c}=e;let[[,h],[,f]]=[s.value(),i.value()];if(h=a.transform(h),f=l.transform(f),h.updateGLBuffer(o.gl),f.updateGLBuffer(o.gl),h.length===0||f.length===0)return;const p=o.getProgram(f.dataType),y=Ml(h,f,c,t,this.state.downsampleMode,Cl);this.internal.instrumentation.L.debug("render",()=>({key:this.key,downsample:t,scale:u.transform,props:e.region,ops:Zl(y)}));const S=p.setAsActive(),b=p.bindState(this.state),E=p.renderCtx.scaleRegion(e.region).transform;y.forEach(x=>{const A=Ol(u,x).transform;p.bindScale(A,E),p.draw(x,b,h.dataType,f.dataType)}),S()}}const Al=5e3,Pl=(n,e)=>kl(_l(n),e).map((t,s)=>Math.floor(s/Ll)*(1/(Al*n))*t),Ll=5,_l=n=>new Float32Array([0,0,0,n,0,-n,1,0,-1,0]),kl=(n,e)=>{const t=new Float32Array(n.length*e);for(let s=0;s<e;s++)t.set(n,s*n.length);return t},Ol=(n,e)=>n.translate(n.x.dim(Number(e.x.sampleOffset)),n.y.dim(Number(e.y.sampleOffset))),Il={[Bt.TYPE]:Bt},Ml=(n,e,t,s,i,o)=>{if(n.series.length===0||e.series.length===0)return[];const a=[];return n.series.forEach(l=>e.series.forEach(u=>{if(!Dl(l,u,o))return;let c=0n,h=0n;l.alignment<u.alignment?c=u.alignment-l.alignment:u.alignment<l.alignment&&(h=l.alignment-u.alignment);const f=r.Nu.min(r.Iu.span(l.alignmentBounds)-c,r.Iu.span(u.alignmentBounds)-h);if(f===0n)return;let p=r.vo(Math.round(t*4*Number(f)),s,51);i!=="decimate"&&(p=1);const y=Number(f/l.alignmentMultiple),S=Number(c/l.alignmentMultiple),b=Number(h/u.alignmentMultiple);a.push({x:l,y:u,xOffset:S,yOffset:b,count:y,downsample:p})})),a},Zl=n=>n.map(e=>({...e,x:e.x.digest,y:e.y.digest})),Dl=(n,e,t)=>{if(n.alignmentMultiple!==e.alignmentMultiple)return console.warn("encountered two series with different alignment multiples in draw operations",{x:n.digest,y:e.digest}),!1;const s=n.timeRange.overlapsWith(e.timeRange,t),i=r.Iu.overlapsWith(n.alignmentBounds,e.alignmentBounds);return s&&i},Zs=d.z.object({dpr:d.z.number(),region:r.Eu.box,bootstrap:d.z.boolean().default(!1),bootstrapped:d.z.boolean().default(!1),glCanvas:d.z.any().optional(),upper2dCanvas:d.z.any().optional(),lower2dCanvas:d.z.any().optional(),os:r.rl.osZ});class $t extends g.Composite{static TYPE="Canvas";schema=Zs;renderCtx=null;afterUpdate(e){if(this.renderCtx==null){if(!this.state.bootstrap)return;const{glCanvas:t,lower2dCanvas:s,upper2dCanvas:i,os:o}=this.state;if(t==null||s==null||i==null)throw new g.St("[vis.worker.Canvas] - expected render context bootstrap to include all canvases");this.renderCtx=Z.Context.create(e,t,s,i,o),Pe.create(e,this.renderCtx),this.setState(a=>({...a,bootstrap:!1,bootstrapped:!0,glCanvas:void 0,lower2dCanvas:void 0,upper2dCanvas:void 0}))}else this.renderCtx.update(e);this.renderCtx.resize(this.state.region,this.state.dpr)}}const $i={[$t.TYPE]:$t},Nl=Object.freeze(Object.defineProperty({__proto__:null,Canvas:$t,REGISTRY:$i,canvasStateZ:Zs},Symbol.toStringTag,{value:"Module"})),Ds=d.z.object({position:r.Au.xy,zoom:d.z.number(),region:r.Eu.box,clearOverScan:r.Au.crudeZ.default(5),visible:d.z.boolean().default(!0),autoRenderInterval:d.z.number().optional()}),vt=["upper2d","lower2d"];class me extends g.Composite{static TYPE="Diagram";static stateZ=Ds;schema=me.stateZ;afterUpdate(e){this.internal.renderCtx=Z.Context.use(e),this.internal.handleError=g.useErrorHandler(e),r.pu.isNonZero(this.state.autoRenderInterval)&&(this.internal.autoRenderInterval??=setInterval(()=>{this.state.visible&&this.requestRender("low")},this.state.autoRenderInterval)),tn(e,()=>{this.state.visible&&this.requestRender("low")}),!(!this.state.visible&&!this.prevState.visible)&&(this.internal.viewportScale=r.Tu.XY.magnify(r.Au.construct(this.state.zoom)).translate(r.Eu.topLeft(this.state.region)).translate(this.state.position),this.requestRender("high"))}afterDelete(){this.internal.autoRenderInterval!=null&&clearInterval(this.internal.autoRenderInterval),this.requestRender("high")}render(){if(this.deleted)return;const{renderCtx:e,handleError:t,viewportScale:s}=this.internal,i=r.Eu.construct(this.state.region);if(!this.state.visible)return()=>e.erase(i,this.state.clearOverScan,...vt);const o=e.scissor(i,r.Au.ZERO,vt);try{this.children.forEach(l=>l.render?.({viewportScale:s}))}catch(l){t(l,"failed to render diagram")}finally{o()}const a=r.Eu.copy(this.state.region);return()=>{e.lower2d.fillStyle=r.Zu.hex(r.Zu.BLACK),e.lower2d.fillRect(...r.Au.couple(r.Eu.topLeft(a)),r.Eu.width(a),r.Eu.height(a)),e.erase(a,this.state.clearOverScan,...vt)}}requestRender(e){const{renderCtx:t}=this.internal;t.loop.set({key:`${me.TYPE}-${this.key}`,render:this.render.bind(this),priority:e,canvases:vt})}}const Fi={[me.TYPE]:me},Yl=Object.freeze(Object.defineProperty({__proto__:null,Diagram:me,REGISTRY:Fi,diagramStateZ:Ds},Symbol.toStringTag,{value:"Module"}));function Rt(n,e){return n==null||e==null?NaN:n<e?-1:n>e?1:n>=e?0:NaN}function zl(n,e){return n==null||e==null?NaN:e<n?-1:e>n?1:e>=n?0:NaN}function Ns(n){let e,t,s;n.length!==2?(e=Rt,t=(l,u)=>Rt(n(l),u),s=(l,u)=>n(l)-u):(e=n===Rt||n===zl?n:Ul,t=n,s=n);function i(l,u,c=0,h=l.length){if(c<h){if(e(u,u)!==0)return h;do{const f=c+h>>>1;t(l[f],u)<0?c=f+1:h=f}while(c<h)}return c}function o(l,u,c=0,h=l.length){if(c<h){if(e(u,u)!==0)return h;do{const f=c+h>>>1;t(l[f],u)<=0?c=f+1:h=f}while(c<h)}return c}function a(l,u,c=0,h=l.length){const f=i(l,u,c,h-1);return f>c&&s(l[f-1],u)>-s(l[f],u)?f-1:f}return{left:i,center:a,right:o}}function Ul(){return 0}function Bl(n){return n===null?NaN:+n}const $l=Ns(Rt),Fl=$l.right;Ns(Bl).center;const ql=Math.sqrt(50),Hl=Math.sqrt(10),jl=Math.sqrt(2);function Ft(n,e,t){const s=(e-n)/Math.max(0,t),i=Math.floor(Math.log10(s)),o=s/Math.pow(10,i),a=o>=ql?10:o>=Hl?5:o>=jl?2:1;let l,u,c;return i<0?(c=Math.pow(10,-i)/a,l=Math.round(n*c),u=Math.round(e*c),l/c<n&&++l,u/c>e&&--u,c=-c):(c=Math.pow(10,i)*a,l=Math.round(n/c),u=Math.round(e/c),l*c<n&&++l,u*c>e&&--u),u<l&&.5<=t&&t<2?Ft(n,e,t*2):[l,u,c]}function Wl(n,e,t){if(e=+e,n=+n,t=+t,!(t>0))return[];if(n===e)return[n];const s=e<n,[i,o,a]=s?Ft(e,n,t):Ft(n,e,t);if(!(o>=i))return[];const l=o-i+1,u=new Array(l);if(s)if(a<0)for(let c=0;c<l;++c)u[c]=(o-c)/-a;else for(let c=0;c<l;++c)u[c]=(o-c)*a;else if(a<0)for(let c=0;c<l;++c)u[c]=(i+c)/-a;else for(let c=0;c<l;++c)u[c]=(i+c)*a;return u}function Hn(n,e,t){return e=+e,n=+n,t=+t,Ft(n,e,t)[2]}function jn(n,e,t){e=+e,n=+n,t=+t;const s=e<n,i=s?Hn(e,n,t):Hn(n,e,t);return(s?-1:1)*(i<0?1/-i:i)}function qi(n,e){switch(arguments.length){case 0:break;case 1:this.range(n);break;default:this.range(e).domain(n);break}return this}function Vl(n){return function(){return n}}function Xl(n){return+n}var ur=[0,1];function Ce(n){return n}function Wn(n,e){return(e-=n=+n)?function(t){return(t-n)/e}:Vl(isNaN(e)?NaN:.5)}function Gl(n,e){var t;return n>e&&(t=n,n=e,e=t),function(s){return Math.max(n,Math.min(e,s))}}function Kl(n,e,t){var s=n[0],i=n[1],o=e[0],a=e[1];return i<s?(s=Wn(i,s),o=t(a,o)):(s=Wn(s,i),o=t(o,a)),function(l){return o(s(l))}}function Ql(n,e,t){var s=Math.min(n.length,e.length)-1,i=new Array(s),o=new Array(s),a=-1;for(n[s]<n[0]&&(n=n.slice().reverse(),e=e.slice().reverse());++a<s;)i[a]=Wn(n[a],n[a+1]),o[a]=t(e[a],e[a+1]);return function(l){var u=Fl(n,l,1,s)-1;return o[u](i[u](l))}}function Hi(n,e){return e.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function Jl(){var n=ur,e=ur,t=sn,s,i,o,a=Ce,l,u,c;function h(){var p=Math.min(n.length,e.length);return a!==Ce&&(a=Gl(n[0],n[p-1])),l=p>2?Ql:Kl,u=c=null,f}function f(p){return p==null||isNaN(p=+p)?o:(u||(u=l(n.map(s),e,t)))(s(a(p)))}return f.invert=function(p){return a(i((c||(c=l(e,n.map(s),et)))(p)))},f.domain=function(p){return arguments.length?(n=Array.from(p,Xl),h()):n.slice()},f.range=function(p){return arguments.length?(e=Array.from(p),h()):e.slice()},f.rangeRound=function(p){return e=Array.from(p),t=ka,h()},f.clamp=function(p){return arguments.length?(a=p?!0:Ce,h()):a!==Ce},f.interpolate=function(p){return arguments.length?(t=p,h()):t},f.unknown=function(p){return arguments.length?(o=p,f):o},function(p,y){return s=p,i=y,h()}}function ji(){return Jl()(Ce,Ce)}function ec(n){return Math.abs(n=Math.round(n))>=1e21?n.toLocaleString("en").replace(/,/g,""):n.toString(10)}function qt(n,e){if((t=(n=e?n.toExponential(e-1):n.toExponential()).indexOf("e"))<0)return null;var t,s=n.slice(0,t);return[s.length>1?s[0]+s.slice(2):s,+n.slice(t+1)]}function Ne(n){return n=qt(Math.abs(n)),n?n[1]:NaN}function tc(n,e){return function(t,s){for(var i=t.length,o=[],a=0,l=n[0],u=0;i>0&&l>0&&(u+l+1>s&&(l=Math.max(1,s-u)),o.push(t.substring(i-=l,i+l)),!((u+=l+1)>s));)l=n[a=(a+1)%n.length];return o.reverse().join(e)}}function nc(n){return function(e){return e.replace(/[0-9]/g,function(t){return n[+t]})}}var sc=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ht(n){if(!(e=sc.exec(n)))throw new Error("invalid format: "+n);var e;return new Ys({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Ht.prototype=Ys.prototype;function Ys(n){this.fill=n.fill===void 0?" ":n.fill+"",this.align=n.align===void 0?">":n.align+"",this.sign=n.sign===void 0?"-":n.sign+"",this.symbol=n.symbol===void 0?"":n.symbol+"",this.zero=!!n.zero,this.width=n.width===void 0?void 0:+n.width,this.comma=!!n.comma,this.precision=n.precision===void 0?void 0:+n.precision,this.trim=!!n.trim,this.type=n.type===void 0?"":n.type+""}Ys.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 rc(n){e:for(var e=n.length,t=1,s=-1,i;t<e;++t)switch(n[t]){case".":s=i=t;break;case"0":s===0&&(s=t),i=t;break;default:if(!+n[t])break e;s>0&&(s=0);break}return s>0?n.slice(0,s)+n.slice(i+1):n}var Wi;function ic(n,e){var t=qt(n,e);if(!t)return n+"";var s=t[0],i=t[1],o=i-(Wi=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,a=s.length;return o===a?s:o>a?s+new Array(o-a+1).join("0"):o>0?s.slice(0,o)+"."+s.slice(o):"0."+new Array(1-o).join("0")+qt(n,Math.max(0,e+o-1))[0]}function hr(n,e){var t=qt(n,e);if(!t)return n+"";var s=t[0],i=t[1];return i<0?"0."+new Array(-i).join("0")+s:s.length>i+1?s.slice(0,i+1)+"."+s.slice(i+1):s+new Array(i-s.length+2).join("0")}const dr={"%":(n,e)=>(n*100).toFixed(e),b:n=>Math.round(n).toString(2),c:n=>n+"",d:ec,e:(n,e)=>n.toExponential(e),f:(n,e)=>n.toFixed(e),g:(n,e)=>n.toPrecision(e),o:n=>Math.round(n).toString(8),p:(n,e)=>hr(n*100,e),r:hr,s:ic,X:n=>Math.round(n).toString(16).toUpperCase(),x:n=>Math.round(n).toString(16)};function fr(n){return n}var pr=Array.prototype.map,gr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function oc(n){var e=n.grouping===void 0||n.thousands===void 0?fr:tc(pr.call(n.grouping,Number),n.thousands+""),t=n.currency===void 0?"":n.currency[0]+"",s=n.currency===void 0?"":n.currency[1]+"",i=n.decimal===void 0?".":n.decimal+"",o=n.numerals===void 0?fr:nc(pr.call(n.numerals,String)),a=n.percent===void 0?"%":n.percent+"",l=n.minus===void 0?"−":n.minus+"",u=n.nan===void 0?"NaN":n.nan+"";function c(f){f=Ht(f);var p=f.fill,y=f.align,S=f.sign,b=f.symbol,E=f.zero,x=f.width,A=f.comma,C=f.precision,P=f.trim,O=f.type;O==="n"?(A=!0,O="g"):dr[O]||(C===void 0&&(C=12),P=!0,O="g"),(E||p==="0"&&y==="=")&&(E=!0,p="0",y="=");var T=b==="$"?t:b==="#"&&/[boxX]/.test(O)?"0"+O.toLowerCase():"",k=b==="$"?s:/[%p]/.test(O)?a:"",M=dr[O],G=/[defgprs%]/.test(O);C=C===void 0?6:/[gprs]/.test(O)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function W(w){var F=T,N=k,K,ue,te;if(O==="c")N=M(w)+N,w="";else{w=+w;var ne=w<0||1/w<0;if(w=isNaN(w)?u:M(Math.abs(w),C),P&&(w=rc(w)),ne&&+w==0&&S!=="+"&&(ne=!1),F=(ne?S==="("?S:l:S==="-"||S==="("?"":S)+F,N=(O==="s"?gr[8+Wi/3]:"")+N+(ne&&S==="("?")":""),G){for(K=-1,ue=w.length;++K<ue;)if(te=w.charCodeAt(K),48>te||te>57){N=(te===46?i+w.slice(K+1):w.slice(K))+N,w=w.slice(0,K);break}}}A&&!E&&(w=e(w,1/0));var Q=F.length+w.length+N.length,z=Q<x?new Array(x-Q+1).join(p):"";switch(A&&E&&(w=e(z+w,z.length?x-N.length:1/0),z=""),y){case"<":w=F+w+N+z;break;case"=":w=F+z+w+N;break;case"^":w=z.slice(0,Q=z.length>>1)+F+w+N+z.slice(Q);break;default:w=z+F+w+N;break}return o(w)}return W.toString=function(){return f+""},W}function h(f,p){var y=c((f=Ht(f),f.type="f",f)),S=Math.max(-8,Math.min(8,Math.floor(Ne(p)/3)))*3,b=Math.pow(10,-S),E=gr[8+S/3];return function(x){return y(b*x)+E}}return{format:c,formatPrefix:h}}var Et,Vi,Xi;ac({thousands:",",grouping:[3],currency:["$",""]});function ac(n){return Et=oc(n),Vi=Et.format,Xi=Et.formatPrefix,Et}function lc(n){return Math.max(0,-Ne(Math.abs(n)))}function cc(n,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ne(e)/3)))*3-Ne(Math.abs(n)))}function uc(n,e){return n=Math.abs(n),e=Math.abs(e)-n,Math.max(0,Ne(e)-Ne(n))+1}function hc(n,e,t,s){var i=jn(n,e,t),o;switch(s=Ht(s??",f"),s.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(e));return s.precision==null&&!isNaN(o=cc(i,a))&&(s.precision=o),Xi(s,a)}case"":case"e":case"g":case"p":case"r":{s.precision==null&&!isNaN(o=uc(i,Math.max(Math.abs(n),Math.abs(e))))&&(s.precision=o-(s.type==="e"));break}case"f":case"%":{s.precision==null&&!isNaN(o=lc(i))&&(s.precision=o-(s.type==="%")*2);break}}return Vi(s)}function dc(n){var e=n.domain;return n.ticks=function(t){var s=e();return Wl(s[0],s[s.length-1],t??10)},n.tickFormat=function(t,s){var i=e();return hc(i[0],i[i.length-1],t??10,s)},n.nice=function(t){t==null&&(t=10);var s=e(),i=0,o=s.length-1,a=s[i],l=s[o],u,c,h=10;for(l<a&&(c=a,a=l,l=c,c=i,i=o,o=c);h-- >0;){if(c=Hn(a,l,t),c===u)return s[i]=a,s[o]=l,e(s);if(c>0)a=Math.floor(a/c)*c,l=Math.ceil(l/c)*c;else if(c<0)a=Math.ceil(a*c)/c,l=Math.floor(l*c)/c;else break;u=c}return n},n}function Gi(){var n=ji();return n.copy=function(){return Hi(n,Gi())},qi.apply(n,arguments),dc(n)}function fc(n,e){n=n.slice();var t=0,s=n.length-1,i=n[t],o=n[s],a;return o<i&&(a=t,t=s,s=a,a=i,i=o,o=a),n[t]=e.floor(i),n[s]=e.ceil(o),n}const xn=new Date,Cn=new Date;function D(n,e,t,s){function i(o){return n(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(n(o=new Date(+o)),o),i.ceil=o=>(n(o=new Date(o-1)),e(o,1),n(o),o),i.round=o=>{const a=i(o),l=i.ceil(o);return o-a<l-o?a:l},i.offset=(o,a)=>(e(o=new Date(+o),a==null?1:Math.floor(a)),o),i.range=(o,a,l)=>{const u=[];if(o=i.ceil(o),l=l==null?1:Math.floor(l),!(o<a)||!(l>0))return u;let c;do u.push(c=new Date(+o)),e(o,l),n(o);while(c<o&&o<a);return u},i.filter=o=>D(a=>{if(a>=a)for(;n(a),!o(a);)a.setTime(a-1)},(a,l)=>{if(a>=a)if(l<0)for(;++l<=0;)for(;e(a,-1),!o(a););else for(;--l>=0;)for(;e(a,1),!o(a););}),t&&(i.count=(o,a)=>(xn.setTime(+o),Cn.setTime(+a),n(xn),n(Cn),Math.floor(t(xn,Cn))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(s?a=>s(a)%o===0:a=>i.count(0,a)%o===0):i)),i}const jt=D(()=>{},(n,e)=>{n.setTime(+n+e)},(n,e)=>e-n);jt.every=n=>(n=Math.floor(n),!isFinite(n)||!(n>0)?null:n>1?D(e=>{e.setTime(Math.floor(e/n)*n)},(e,t)=>{e.setTime(+e+t*n)},(e,t)=>(t-e)/n):jt);jt.range;const se=1e3,V=se*60,re=V*60,oe=re*24,zs=oe*7,mr=oe*30,Rn=oe*365,Re=D(n=>{n.setTime(n-n.getMilliseconds())},(n,e)=>{n.setTime(+n+e*se)},(n,e)=>(e-n)/se,n=>n.getUTCSeconds());Re.range;const Us=D(n=>{n.setTime(n-n.getMilliseconds()-n.getSeconds()*se)},(n,e)=>{n.setTime(+n+e*V)},(n,e)=>(e-n)/V,n=>n.getMinutes());Us.range;const pc=D(n=>{n.setUTCSeconds(0,0)},(n,e)=>{n.setTime(+n+e*V)},(n,e)=>(e-n)/V,n=>n.getUTCMinutes());pc.range;const Bs=D(n=>{n.setTime(n-n.getMilliseconds()-n.getSeconds()*se-n.getMinutes()*V)},(n,e)=>{n.setTime(+n+e*re)},(n,e)=>(e-n)/re,n=>n.getHours());Bs.range;const gc=D(n=>{n.setUTCMinutes(0,0,0)},(n,e)=>{n.setTime(+n+e*re)},(n,e)=>(e-n)/re,n=>n.getUTCHours());gc.range;const pt=D(n=>n.setHours(0,0,0,0),(n,e)=>n.setDate(n.getDate()+e),(n,e)=>(e-n-(e.getTimezoneOffset()-n.getTimezoneOffset())*V)/oe,n=>n.getDate()-1);pt.range;const $s=D(n=>{n.setUTCHours(0,0,0,0)},(n,e)=>{n.setUTCDate(n.getUTCDate()+e)},(n,e)=>(e-n)/oe,n=>n.getUTCDate()-1);$s.range;const mc=D(n=>{n.setUTCHours(0,0,0,0)},(n,e)=>{n.setUTCDate(n.getUTCDate()+e)},(n,e)=>(e-n)/oe,n=>Math.floor(n/oe));mc.range;function Se(n){return D(e=>{e.setDate(e.getDate()-(e.getDay()+7-n)%7),e.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*V)/zs)}const fn=Se(0),Wt=Se(1),yc=Se(2),bc=Se(3),Ye=Se(4),Sc=Se(5),vc=Se(6);fn.range;Wt.range;yc.range;bc.range;Ye.range;Sc.range;vc.range;function ve(n){return D(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-n)%7),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/zs)}const Ki=ve(0),Vt=ve(1),Ec=ve(2),Tc=ve(3),ze=ve(4),wc=ve(5),xc=ve(6);Ki.range;Vt.range;Ec.range;Tc.range;ze.range;wc.range;xc.range;const Fs=D(n=>{n.setDate(1),n.setHours(0,0,0,0)},(n,e)=>{n.setMonth(n.getMonth()+e)},(n,e)=>e.getMonth()-n.getMonth()+(e.getFullYear()-n.getFullYear())*12,n=>n.getMonth());Fs.range;const Cc=D(n=>{n.setUTCDate(1),n.setUTCHours(0,0,0,0)},(n,e)=>{n.setUTCMonth(n.getUTCMonth()+e)},(n,e)=>e.getUTCMonth()-n.getUTCMonth()+(e.getUTCFullYear()-n.getUTCFullYear())*12,n=>n.getUTCMonth());Cc.range;const ae=D(n=>{n.setMonth(0,1),n.setHours(0,0,0,0)},(n,e)=>{n.setFullYear(n.getFullYear()+e)},(n,e)=>e.getFullYear()-n.getFullYear(),n=>n.getFullYear());ae.every=n=>!isFinite(n=Math.floor(n))||!(n>0)?null:D(e=>{e.setFullYear(Math.floor(e.getFullYear()/n)*n),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t*n)});ae.range;const ye=D(n=>{n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},(n,e)=>{n.setUTCFullYear(n.getUTCFullYear()+e)},(n,e)=>e.getUTCFullYear()-n.getUTCFullYear(),n=>n.getUTCFullYear());ye.every=n=>!isFinite(n=Math.floor(n))||!(n>0)?null:D(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/n)*n),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t*n)});ye.range;function Rc(n,e,t,s,i,o){const a=[[Re,1,se],[Re,5,5*se],[Re,15,15*se],[Re,30,30*se],[o,1,V],[o,5,5*V],[o,15,15*V],[o,30,30*V],[i,1,re],[i,3,3*re],[i,6,6*re],[i,12,12*re],[s,1,oe],[s,2,2*oe],[t,1,zs],[e,1,mr],[e,3,3*mr],[n,1,Rn]];function l(c,h,f){const p=h<c;p&&([c,h]=[h,c]);const y=f&&typeof f.range=="function"?f:u(c,h,f),S=y?y.range(c,+h+1):[];return p?S.reverse():S}function u(c,h,f){const p=Math.abs(h-c)/f,y=Ns(([,,E])=>E).right(a,p);if(y===a.length)return n.every(jn(c/Rn,h/Rn,f));if(y===0)return jt.every(Math.max(jn(c,h,f),1));const[S,b]=a[p/a[y-1][2]<a[y][2]/p?y-1:y];return S.every(b)}return[l,u]}const[Ac,Pc]=Rc(ae,Fs,fn,pt,Bs,Us);function An(n){if(0<=n.y&&n.y<100){var e=new Date(-1,n.m,n.d,n.H,n.M,n.S,n.L);return e.setFullYear(n.y),e}return new Date(n.y,n.m,n.d,n.H,n.M,n.S,n.L)}function Pn(n){if(0<=n.y&&n.y<100){var e=new Date(Date.UTC(-1,n.m,n.d,n.H,n.M,n.S,n.L));return e.setUTCFullYear(n.y),e}return new Date(Date.UTC(n.y,n.m,n.d,n.H,n.M,n.S,n.L))}function qe(n,e,t){return{y:n,m:e,d:t,H:0,M:0,S:0,L:0}}function Lc(n){var e=n.dateTime,t=n.date,s=n.time,i=n.periods,o=n.days,a=n.shortDays,l=n.months,u=n.shortMonths,c=He(i),h=je(i),f=He(o),p=je(o),y=He(a),S=je(a),b=He(l),E=je(l),x=He(u),A=je(u),C={a:ne,A:Q,b:z,B:pn,c:null,d:Tr,e:Tr,f:Qc,g:lu,G:uu,H:Xc,I:Gc,j:Kc,L:Qi,m:Jc,M:eu,p:gn,q:mn,Q:Cr,s:Rr,S:tu,u:nu,U:su,V:ru,w:iu,W:ou,x:null,X:null,y:au,Y:cu,Z:hu,"%":xr},P={a:yn,A:bn,b:Sn,B:yt,c:null,d:wr,e:wr,f:gu,g:Cu,G:Au,H:du,I:fu,j:pu,L:eo,m:mu,M:yu,p:vn,q:Bo,Q:Cr,s:Rr,S:bu,u:Su,U:vu,V:Eu,w:Tu,W:wu,x:null,X:null,y:xu,Y:Ru,Z:Pu,"%":xr},O={a:W,A:w,b:F,B:N,c:K,d:vr,e:vr,f:Hc,g:Sr,G:br,H:Er,I:Er,j:Bc,L:qc,m:Uc,M:$c,p:G,q:zc,Q:Wc,s:Vc,S:Fc,u:Mc,U:Zc,V:Dc,w:Ic,W:Nc,x:ue,X:te,y:Sr,Y:br,Z:Yc,"%":jc};C.x=T(t,C),C.X=T(s,C),C.c=T(e,C),P.x=T(t,P),P.X=T(s,P),P.c=T(e,P);function T(v,R){return function(L){var m=[],U=-1,I=0,q=v.length,H,he,Gs;for(L instanceof Date||(L=new Date(+L));++U<q;)v.charCodeAt(U)===37&&(m.push(v.slice(I,U)),(he=yr[H=v.charAt(++U)])!=null?H=v.charAt(++U):he=H==="e"?" ":"0",(Gs=R[H])&&(H=Gs(L,he)),m.push(H),I=U+1);return m.push(v.slice(I,U)),m.join("")}}function k(v,R){return function(L){var m=qe(1900,void 0,1),U=M(m,v,L+="",0),I,q;if(U!=L.length)return null;if("Q"in m)return new Date(m.Q);if("s"in m)return new Date(m.s*1e3+("L"in m?m.L:0));if(R&&!("Z"in m)&&(m.Z=0),"p"in m&&(m.H=m.H%12+m.p*12),m.m===void 0&&(m.m="q"in m?m.q:0),"V"in m){if(m.V<1||m.V>53)return null;"w"in m||(m.w=1),"Z"in m?(I=Pn(qe(m.y,0,1)),q=I.getUTCDay(),I=q>4||q===0?Vt.ceil(I):Vt(I),I=$s.offset(I,(m.V-1)*7),m.y=I.getUTCFullYear(),m.m=I.getUTCMonth(),m.d=I.getUTCDate()+(m.w+6)%7):(I=An(qe(m.y,0,1)),q=I.getDay(),I=q>4||q===0?Wt.ceil(I):Wt(I),I=pt.offset(I,(m.V-1)*7),m.y=I.getFullYear(),m.m=I.getMonth(),m.d=I.getDate()+(m.w+6)%7)}else("W"in m||"U"in m)&&("w"in m||(m.w="u"in m?m.u%7:"W"in m?1:0),q="Z"in m?Pn(qe(m.y,0,1)).getUTCDay():An(qe(m.y,0,1)).getDay(),m.m=0,m.d="W"in m?(m.w+6)%7+m.W*7-(q+5)%7:m.w+m.U*7-(q+6)%7);return"Z"in m?(m.H+=m.Z/100|0,m.M+=m.Z%100,Pn(m)):An(m)}}function M(v,R,L,m){for(var U=0,I=R.length,q=L.length,H,he;U<I;){if(m>=q)return-1;if(H=R.charCodeAt(U++),H===37){if(H=R.charAt(U++),he=O[H in yr?R.charAt(U++):H],!he||(m=he(v,L,m))<0)return-1}else if(H!=L.charCodeAt(m++))return-1}return m}function G(v,R,L){var m=c.exec(R.slice(L));return m?(v.p=h.get(m[0].toLowerCase()),L+m[0].length):-1}function W(v,R,L){var m=y.exec(R.slice(L));return m?(v.w=S.get(m[0].toLowerCase()),L+m[0].length):-1}function w(v,R,L){var m=f.exec(R.slice(L));return m?(v.w=p.get(m[0].toLowerCase()),L+m[0].length):-1}function F(v,R,L){var m=x.exec(R.slice(L));return m?(v.m=A.get(m[0].toLowerCase()),L+m[0].length):-1}function N(v,R,L){var m=b.exec(R.slice(L));return m?(v.m=E.get(m[0].toLowerCase()),L+m[0].length):-1}function K(v,R,L){return M(v,e,R,L)}function ue(v,R,L){return M(v,t,R,L)}function te(v,R,L){return M(v,s,R,L)}function ne(v){return a[v.getDay()]}function Q(v){return o[v.getDay()]}function z(v){return u[v.getMonth()]}function pn(v){return l[v.getMonth()]}function gn(v){return i[+(v.getHours()>=12)]}function mn(v){return 1+~~(v.getMonth()/3)}function yn(v){return a[v.getUTCDay()]}function bn(v){return o[v.getUTCDay()]}function Sn(v){return u[v.getUTCMonth()]}function yt(v){return l[v.getUTCMonth()]}function vn(v){return i[+(v.getUTCHours()>=12)]}function Bo(v){return 1+~~(v.getUTCMonth()/3)}return{format:function(v){var R=T(v+="",C);return R.toString=function(){return v},R},parse:function(v){var R=k(v+="",!1);return R.toString=function(){return v},R},utcFormat:function(v){var R=T(v+="",P);return R.toString=function(){return v},R},utcParse:function(v){var R=k(v+="",!0);return R.toString=function(){return v},R}}}var yr={"-":"",_:" ",0:"0"},Y=/^\s*\d+/,_c=/^%/,kc=/[\\^$*+?|[\]().{}]/g;function _(n,e,t){var s=n<0?"-":"",i=(s?-n:n)+"",o=i.length;return s+(o<t?new Array(t-o+1).join(e)+i:i)}function Oc(n){return n.replace(kc,"\\$&")}function He(n){return new RegExp("^(?:"+n.map(Oc).join("|")+")","i")}function je(n){return new Map(n.map((e,t)=>[e.toLowerCase(),t]))}function Ic(n,e,t){var s=Y.exec(e.slice(t,t+1));return s?(n.w=+s[0],t+s[0].length):-1}function Mc(n,e,t){var s=Y.exec(e.slice(t,t+1));return s?(n.u=+s[0],t+s[0].length):-1}function Zc(n,e,t){var s=Y.exec(e.slice(t,t+2));return s?(n.U=+s[0],t+s[0].length):-1}function Dc(n,e,t){var s=Y.exec(e.slice(t,t+2));return s?(n.V=+s[0],t+s[0].length):-1}function Nc(n,e,t){var s=Y.exec(e.slice(t,t+2));return s?(n.W=+s[0],t+s[0].length):-1}function br(n,e,t){var s=Y.exec(e.slice(t,t+4));return s?(n.y=+s[0],t+s[0].length):-1}function Sr(n,e,t){var s=Y.exec(e.slice(t,t+2));return s?(n.y=+s[0]+(+s[0]>68?1900:2e3),t+s[0].length):-1}function Yc(n,e,t){var s=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(t,t+6));return s?(n.Z=s[1]?0:-(s[2]+(s[3]||"00")),t+s[0].length):-1}function zc(n,e,t){var s=Y.exec(e.slice(t,t+1));return s?(n.q=s[0]*3-3,t+s[0].length):-1}function Uc(n,e,t){var s=Y.exec(e.slice(t,t+2));return s?(n.m=s[0]-1,t+s[0].length):-1}function vr(n,e,t){var s=Y.exec(e.slice(t,t+2));return s?(n.d=+s[0],t+s[0].length):-1}function Bc(n,e,t){var s=Y.exec(e.slice(t,t+3));return s?(n.m=0,n.d=+s[0],t+s[0].length):-1}function Er(n,e,t){var s=Y.exec(e.slice(t,t+2));return s?(n.H=+s[0],t+s[0].length):-1}function $c(n,e,t){var s=Y.exec(e.slice(t,t+2));return s?(n.M=+s[0],t+s[0].length):-1}function Fc(n,e,t){var s=Y.exec(e.slice(t,t+2));return s?(n.S=+s[0],t+s[0].length):-1}function qc(n,e,t){var s=Y.exec(e.slice(t,t+3));return s?(n.L=+s[0],t+s[0].length):-1}function Hc(n,e,t){var s=Y.exec(e.slice(t,t+6));return s?(n.L=Math.floor(s[0]/1e3),t+s[0].length):-1}function jc(n,e,t){var s=_c.exec(e.slice(t,t+1));return s?t+s[0].length:-1}function Wc(n,e,t){var s=Y.exec(e.slice(t));return s?(n.Q=+s[0],t+s[0].length):-1}function Vc(n,e,t){var s=Y.exec(e.slice(t));return s?(n.s=+s[0],t+s[0].length):-1}function Tr(n,e){return _(n.getDate(),e,2)}function Xc(n,e){return _(n.getHours(),e,2)}function Gc(n,e){return _(n.getHours()%12||12,e,2)}function Kc(n,e){return _(1+pt.count(ae(n),n),e,3)}function Qi(n,e){return _(n.getMilliseconds(),e,3)}function Qc(n,e){return Qi(n,e)+"000"}function Jc(n,e){return _(n.getMonth()+1,e,2)}function eu(n,e){return _(n.getMinutes(),e,2)}function tu(n,e){return _(n.getSeconds(),e,2)}function nu(n){var e=n.getDay();return e===0?7:e}function su(n,e){return _(fn.count(ae(n)-1,n),e,2)}function Ji(n){var e=n.getDay();return e>=4||e===0?Ye(n):Ye.ceil(n)}function ru(n,e){return n=Ji(n),_(Ye.count(ae(n),n)+(ae(n).getDay()===4),e,2)}function iu(n){return n.getDay()}function ou(n,e){return _(Wt.count(ae(n)-1,n),e,2)}function au(n,e){return _(n.getFullYear()%100,e,2)}function lu(n,e){return n=Ji(n),_(n.getFullYear()%100,e,2)}function cu(n,e){return _(n.getFullYear()%1e4,e,4)}function uu(n,e){var t=n.getDay();return n=t>=4||t===0?Ye(n):Ye.ceil(n),_(n.getFullYear()%1e4,e,4)}function hu(n){var e=n.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+_(e/60|0,"0",2)+_(e%60,"0",2)}function wr(n,e){return _(n.getUTCDate(),e,2)}function du(n,e){return _(n.getUTCHours(),e,2)}function fu(n,e){return _(n.getUTCHours()%12||12,e,2)}function pu(n,e){return _(1+$s.count(ye(n),n),e,3)}function eo(n,e){return _(n.getUTCMilliseconds(),e,3)}function gu(n,e){return eo(n,e)+"000"}function mu(n,e){return _(n.getUTCMonth()+1,e,2)}function yu(n,e){return _(n.getUTCMinutes(),e,2)}function bu(n,e){return _(n.getUTCSeconds(),e,2)}function Su(n){var e=n.getUTCDay();return e===0?7:e}function vu(n,e){return _(Ki.count(ye(n)-1,n),e,2)}function to(n){var e=n.getUTCDay();return e>=4||e===0?ze(n):ze.ceil(n)}function Eu(n,e){return n=to(n),_(ze.count(ye(n),n)+(ye(n).getUTCDay()===4),e,2)}function Tu(n){return n.getUTCDay()}function wu(n,e){return _(Vt.count(ye(n)-1,n),e,2)}function xu(n,e){return _(n.getUTCFullYear()%100,e,2)}function Cu(n,e){return n=to(n),_(n.getUTCFullYear()%100,e,2)}function Ru(n,e){return _(n.getUTCFullYear()%1e4,e,4)}function Au(n,e){var t=n.getUTCDay();return n=t>=4||t===0?ze(n):ze.ceil(n),_(n.getUTCFullYear()%1e4,e,4)}function Pu(){return"+0000"}function xr(){return"%"}function Cr(n){return+n}function Rr(n){return Math.floor(+n/1e3)}var we,no;Lu({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 Lu(n){return we=Lc(n),no=we.format,we.parse,we.utcFormat,we.utcParse,we}function _u(n){return new Date(n)}function ku(n){return n instanceof Date?+n:+new Date(+n)}function so(n,e,t,s,i,o,a,l,u,c){var h=ji(),f=h.invert,p=h.domain,y=c(".%L"),S=c(":%S"),b=c("%I:%M"),E=c("%I %p"),x=c("%a %d"),A=c("%b %d"),C=c("%B"),P=c("%Y");function O(T){return(u(T)<T?y:l(T)<T?S:a(T)<T?b:o(T)<T?E:s(T)<T?i(T)<T?x:A:t(T)<T?C:P)(T)}return h.invert=function(T){return new Date(f(T))},h.domain=function(T){return arguments.length?p(Array.from(T,ku)):p().map(_u)},h.ticks=function(T){var k=p();return n(k[0],k[k.length-1],T??10)},h.tickFormat=function(T,k){return k==null?O:c(k)},h.nice=function(T){var k=p();return(!T||typeof T.range!="function")&&(T=e(k[0],k[k.length-1],T??10)),T?p(fc(k,T)):h},h.copy=function(){return Hi(h,so(n,e,t,s,i,o,a,l,u,c))},h}function Ou(){return qi.apply(so(Ac,Pc,ae,Fs,fn,pt,Bs,Us,Re,no).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}const Ar=[r.g.NANOSECOND,r.g.nanoseconds(2),r.g.nanoseconds(5),r.g.nanoseconds(10),r.g.nanoseconds(20),r.g.nanoseconds(50),r.g.nanoseconds(100),r.g.nanoseconds(200),r.g.nanoseconds(500),r.g.MICROSECOND,r.g.microseconds(2),r.g.microseconds(5),r.g.microseconds(10),r.g.microseconds(20),r.g.microseconds(50),r.g.microseconds(100),r.g.microseconds(200),r.g.microseconds(500),r.g.MILLISECOND,r.g.milliseconds(2),r.g.milliseconds(5),r.g.milliseconds(10),r.g.milliseconds(20),r.g.milliseconds(50),r.g.milliseconds(100),r.g.milliseconds(200),r.g.milliseconds(500),r.g.SECOND];class Iu{_domain;_range;_span;constructor(){this._domain=[new r.d(0n),new r.d(1n)],this._range=[0,1],this._span=this._domain[1].span(this._domain[0])}domain(e){return e===void 0?this._domain:(this._domain=[new r.d(e[0]),new r.d(e[1])],this._span=this._domain[1].span(this._domain[0]),this)}range(e){return e===void 0?this._range:(this._range=e,this)}scale(e){const s=new r.d(e).valueOf(),i=this._domain[0].valueOf(),o=this._domain[1].valueOf()-i,a=this._range[1]-this._range[0];return Number(s-i)/Number(o)*a+this._range[0]}ticks(e){const t=this.calculateOptimalStep(e).valueOf(),s=this._domain[0].valueOf(),i=this._domain[1].valueOf(),o=(s+t-1n)/t*t,a=Number((i-o)/t);return Array.from({length:a+1},(l,u)=>{const c=o+BigInt(u)*t;return new r.d(c)}).filter(l=>l.afterEq(this._domain[0])&&l.beforeEq(this._domain[1]))}calculateOptimalStep(e){const t=this._span.valueOf()/BigInt(Math.ceil(e));let s=Ar[0];for(const i of Ar){if(i.valueOf()>t)break;s=i}return s}formatTick(e){return this._span.lessThan(r.g.microseconds(50))?`${e.remainder(r.g.MILLISECOND).microseconds.toString()}µs`:`${e.remainder(r.g.SECOND).milliseconds.toString()}ms`}}const Mu=()=>new Iu,qs=d.z.enum(["linear","time"]),Hs=d.z.object({tickSpacing:d.z.number().default(75),type:qs.default("linear")}),Vn=n=>{const e=Hs.parse(n);return Nu[e.type](e)};class Zu{props;prevScaleSize;prevDomain;currTicks;normalScale;preciseScale;constructor(e){this.props=e,this.normalScale=Ou(),this.preciseScale=Mu(),this.prevScaleSize=0,this.prevDomain=new r.E(new r.d(0),new r.d(0)),this.currTicks=[]}create({decimalToDataScale:e,size:t}){const s=new r.E(new r.d(e.pos(0)),new r.d(e.pos(1)));if(this.prevDomain.equals(s)&&this.prevScaleSize===t)return this.currTicks;if(this.prevDomain=s,this.prevScaleSize!==t){const i=[0,t];this.preciseScale.range(i),this.normalScale.range(i),this.prevScaleSize=t}if(s.span.milliseconds<5){this.preciseScale.domain([s.start,s.end]);const i=Xn(t,this.props.tickSpacing)/2,o=this.preciseScale.ticks(i);this.currTicks=o.map(a=>({label:this.preciseScale.formatTick(a),position:this.preciseScale.scale(a)}))}else{this.normalScale.domain([s.start.date(),s.end.date()]);const i=this.normalScale.ticks(Xn(t,this.props.tickSpacing));this.currTicks=i.map(o=>({label:this.normalTickLabel(o),position:this.normalScale(o)}))}return this.currTicks}normalTickLabel(e){let t=`:${e.getSeconds()}`;const s=e.getMilliseconds();if(s!==0){const i=Math.round(e.getMilliseconds()).toString().padStart(3,"0").replace(/0+$/,"");t+=`.${i}`}return e.getSeconds()===0&&s===0&&(t=`${e.getHours()}:${e.getMinutes().toString().padStart(2,"0")}`),t}}class Du{props;prevDomain;prevScaleSize;currTicks;d3Scale;constructor(e){this.props=e,this.prevDomain=r.Iu.construct(0,0),this.prevScaleSize=0,this.currTicks=[],this.d3Scale=Gi()}create({decimalToDataScale:e,size:t}){const s={lower:e.pos(0),upper:e.pos(1)};if(r.Iu.equals(this.prevDomain,s)&&this.prevScaleSize===t)return this.currTicks;r.Iu.equals(this.prevDomain,s)||(this.d3Scale=this.d3Scale.domain([s.lower,s.upper])),this.prevScaleSize!==t&&(this.d3Scale=this.d3Scale.range([0,t])),this.prevDomain=s,this.prevScaleSize=t;const i=Xn(t,this.props.tickSpacing),o=this.d3Scale.ticks(i);return this.currTicks=o.map(a=>({label:this.tickLabel(a),position:this.d3Scale(a)})),this.currTicks}tickLabel(e){return e.toString()}}const Xn=(n,e)=>{const t=Math.floor(n/e);return t>0?t:1},Nu={linear:n=>new Du(n),time:n=>new Zu(n)},js=Hs.extend({color:r.Zu.colorZ,type:qs.default("linear"),font:d.z.string(),showGrid:d.z.boolean().default(!0),location:r.Mu.outer,gridColor:r.Zu.colorZ}),X=5,nt=6,gt={useAtlas:!0},Yu={bottom:(n,e)=>new io(n,e),top:(n,e)=>new oo(n,e),left:(n,e)=>new zu(n,e),right:(n,e)=>new ao(n,e)},ro=(n,e,t)=>Yu[n](e,t);class Ee{renderCtx;state;tickFactory;constructor(e,t){this.renderCtx=e,this.state=t,this.tickFactory=Vn(this.state)}setState(e){this.state=g.prettyParse(js,e),this.tickFactory=Vn(e)}drawLine(e,t){const{lower2d:s}=this.renderCtx;s.moveTo(...r.Au.couple(e)),s.lineTo(...r.Au.couple(t))}drawTicks(e,t){let s=r.Su.ZERO;return e.forEach(i=>{const o=this.renderCtx.lower2d.textDimensions(i.label,gt);s=r.Su.max([s,o]),t(o,i)}),s}static START_BOUND=r.Iu.construct(-1,1);maybeDrawGrid(e,t,s){const{showGrid:i,gridColor:o}=this.state;if(i){const a=Ee.START_BOUND,l=r.Iu.construct(e-1,e+1),{lower2d:u}=this.renderCtx;u.beginPath(),u.strokeStyle=r.Zu.hex(o),t.forEach(c=>{r.Iu.contains(a,c.position)||r.Iu.contains(l,c.position)||this.drawLine(...s(c))}),u.stroke()}}setColor(e){const t=r.Zu.hex(e);this.renderCtx.lower2d.strokeStyle=t,this.renderCtx.lower2d.fillStyle=t,this.renderCtx.lower2d.font=this.state.font}}class io extends Ee{render(e){const{lower2d:t}=this.renderCtx,{plot:s,position:i}=e,{width:o,height:a}=r.Eu.dims(s),l=this.tickFactory.create({...e,size:o});t.beginPath(),this.setColor(this.state.color),this.drawLine(i,r.Au.translate(i,"x",o));const u=this.drawTicks(l,(c,h)=>{this.drawLine(r.Au.translateX(i,h.position),r.Au.translate(i,{x:h.position,y:X})),t.fillText(h.label,i.x+h.position-c.width/2,i.y+X+c.height+nt,void 0,gt)});return t.stroke(),this.maybeDrawGrid(o,l,c=>[r.Au.translate(i,"x",c.position),r.Au.translate(i,{x:c.position,y:-a})]),{size:u.height+X+nt}}}class oo extends Ee{render(e){const{lower2d:t}=this.renderCtx,{plot:s}=e,{width:i,height:o}=r.Eu.dims(s),a=r.Au.translate(e.position,"y",e.size),l=this.tickFactory.create({...e,size:i});t.beginPath(),this.setColor(this.state.color),this.drawLine(a,r.Au.translate(a,"x",i));const u=this.drawTicks(l,(c,h)=>{this.drawLine(r.Au.translateX(a,h.position),r.Au.translate(a,{x:h.position,y:-X})),t.fillText(h.label,a.x+h.position-c.width/2,a.y-X-c.height-nt,void 0,gt)});return t.stroke(),this.maybeDrawGrid(i,l,c=>[r.Au.translate(a,"x",c.position),r.Au.translate(a,{x:c.position,y:o})]),{size:u.height+X}}}class zu extends Ee{render(e){const{lower2d:t}=this.renderCtx,{plot:s,position:i}=e,{height:o,width:a}=r.Eu.dims(s),l=r.Au.translate(i,"x",e.size),u=this.tickFactory.create({...e,size:o});t.beginPath(),this.setColor(this.state.color),this.drawLine(l,r.Au.translate(l,"y",o));const c=this.drawTicks(u,(h,f)=>{this.drawLine(r.Au.translateY(l,f.position),r.Au.translate(l,{x:-X,y:f.position})),t.fillText(f.label,l.x-h.width-X*2,l.y+f.position+h.height/2,void 0,gt)});return t.stroke(),this.maybeDrawGrid(o,u,h=>[r.Au.translate(l,"y",h.position),r.Au.translate(l,{x:a,y:h.position})]),{size:c.width+X*2}}}class ao extends Ee{render(e){const{lower2d:t}=this.renderCtx,{plot:s,position:i}=e,{height:o,width:a}=r.Eu.dims(s),l=this.tickFactory.create({...e,size:o});t.beginPath(),this.setColor(this.state.color),this.drawLine(i,r.Au.translateY(i,o));const u=this.drawTicks(l,(c,h)=>{this.drawLine(r.Au.translateY(i,h.position),r.Au.translate(i,{x:X,y:h.position})),t.fillText(h.label,i.x+X+nt,i.y+h.position+c.height/2,void 0,gt)});return t.stroke(),this.maybeDrawGrid(o,l,c=>[r.Au.translateY(i,c.position),r.Au.translate(i,{x:-a,y:c.position})]),{size:u.width+X+nt}}}const lo=d.z.object({key:d.z.string(),size:d.z.number(),order:d.z.number(),loc:r.Mu.outer});d.z.record(d.z.string(),lo);const fe=(n,e)=>Object.values(e).filter(({loc:t})=>t===n).sort((t,s)=>s.order-t.order),Uu=(n,e,t)=>{const s=e[n];if(s==null)return r.Au.ZERO;const i=r.Mu.construct(s.loc),o=fe(i,e),a=r.Mu.construct(r.vu.swap(r.Mu.direction(i))),l=fe(a,e),u=o.findIndex(({key:f})=>f===n),c=o.slice(0,u).reduce((f,{size:p})=>f+p,0),h=l.reduce((f,{size:p})=>f+p,0);switch(i){case"left":return r.Au.translate(r.Eu.topLeft(t),[c,h]);case"right":return r.Au.translate(r.Eu.topRight(t),[c-s.size,h]);case"top":return r.Au.translate(r.Eu.topLeft(t),[h,c]);default:return r.Au.translate(r.Eu.bottomLeft(t),[h,-c-s.size])}},Bu=(n,e)=>{const t=fe("left",n),s=fe("right",n),i=fe("top",n),o=fe("bottom",n),a=t.reduce((h,{size:f})=>h+f,0),l=s.reduce((h,{size:f})=>h+f,0),u=i.reduce((h,{size:f})=>h+f,0),c=o.reduce((h,{size:f})=>h+f,0);return r.Eu.construct(r.Au.translate(r.Eu.topLeft(e),{x:a,y:u}),r.Eu.width(e)-a-l,r.Eu.height(e)-u-c)},mt=js.extend({axisKey:d.z.string().optional(),bounds:r.Iu.bounds.optional(),autoBounds:d.z.object({lower:d.z.boolean().default(!0),upper:d.z.boolean().default(!0)}).or(d.z.boolean().default(!0)),autoBoundPadding:d.z.number().optional(),autoBoundUpdateInterval:r.g.z.default(r.g.seconds(10)),size:d.z.number().default(0),label:d.z.string().default(""),labelSize:d.z.number().default(0)}).partial({color:!0,font:!0,gridColor:!0}),$u=2,Fu=7,co=(n,e)=>r.Iu.contains({lower:n-Fu,upper:n+$u},e),qu=r.Iu.DECIMAL,Pr=r.d.now(),Hu={lower:Number(Pr.valueOf()),upper:Number(Pr.add(r.g.HOUR).valueOf())},uo=n=>n==="linear"?qu:Hu,ju=(n,e=.1,t)=>{const s=r.Iu.max(n.filter(r.Iu.isFinite));if(!r.Iu.isFinite(s))return uo(t);const{lower:i,upper:o}=s;if(o===i)return{lower:i-1,upper:o+1};const a=(o-i)*e;return{lower:i-a,upper:o+a}},Wu=.01,Vu=.1;class ho extends g.Composite{afterUpdate(e){const{internal:t}=this,{location:s,autoBoundUpdateInterval:i}=this.state;t.render=Z.Context.use(e);const o=g.use(e),a=r.vu.construct(s);this.state.autoBoundPadding??=a==="x"?Vu:Wu,t.base=ro(s,t.render,{color:o.colors.gray.l10,font:Ke.fontString(o,{level:"small",code:!0}),gridColor:o.colors.gray.l1,...this.state}),ie(e,"layout"),t.updateBounds??=r.zu(l=>this.setState(u=>({...u,bounds:l})),i.milliseconds)}afterDelete(e){ie(e,"layout")}renderAxis(e,t){if(!e.canvases.includes("lower2d"))return;const{base:s}=this.internal,{grid:i,container:o}=e,a=Uu(`${this.type}-${this.key}`,i,o),l={...e,position:a,decimalToDataScale:t,size:this.state.size+this.state.labelSize},{size:u}=s.render(l);co(this.state.size,u)||this.setState(c=>({...c,size:u}))}iBounds(e,t){if(e&&this.internal.boundSnapshot!=null)return[this.internal.boundSnapshot,null];const{lower:s,upper:i}=fo(this.state.autoBounds);if(!s&&!i&&this.state.bounds!=null)return this.internal.boundSnapshot=this.state.bounds,[this.state.bounds,null];const o=c=>({upper:i||this.state.bounds==null?c.upper:this.state.bounds.upper,lower:s||this.state.bounds==null?c.lower:this.state.bounds.lower});let a,l=null;try{const c=t();a=ju(c,this.state.autoBoundPadding,this.state.type)}catch(c){a=uo(this.state.type),l=c}const u=o(a);return this.internal.boundSnapshot=u,(this.state.bounds==null||s&&this.state.bounds.lower!==u.lower||i&&this.state.bounds.upper!==u.upper)&&this.internal.updateBounds?.(u),[u,l]}dataToDecimalScale(e,t,s){const[i,o]=this.iBounds(e,t),a=r.vu.swap(r.vu.construct(this.state.location));return[r.Tu.Scale.scale(i).scale(1).translate(-r.Eu.root(s)[a]).magnify(1/r.Eu.dim(s,a)),o]}}const fo=n=>typeof n=="boolean"?{lower:n,upper:n}:{lower:n?.lower??!0,upper:n?.upper??!0};class Te{canvas;theme;constructor(e,t){this.canvas=e,this.theme=t}rule({direction:e,region:t,position:s,...i}){return e==="x"?this.line({start:r.Au.construct(r.Eu.left(t),s),end:r.Au.construct(r.Eu.right(t),s),...i}):this.line({start:r.Au.construct(s,r.Eu.top(t)),end:r.Au.construct(s,r.Eu.bottom(t)),...i})}line({stroke:e,lineWidth:t,lineDash:s,start:i,end:o}){const a=this.canvas;a.strokeStyle=r.Zu.hex(e),a.lineWidth=t,a.setLineDash([s]),a.beginPath(),a.moveTo(...r.Au.couple(i)),a.lineTo(...r.Au.couple(o)),a.stroke()}circle({fill:e,stroke:t,strokeWidth:s,lineDash:i,radius:o,position:a,angle:l,lineCap:u}){const c=this.canvas;c.beginPath();const h=l?.lower??0,f=l?.upper??2*Math.PI;if(t!=null&&typeof o=="object"){const{inner:p,outer:y}=o,S=(p+y)/2,b=y-p;c.arc(...r.Au.couple(a),S,h,f,!1),c.strokeStyle=r.Zu.hex(t),c.lineWidth=s??b,u&&(c.lineCap=u),i!=null&&c.setLineDash([i]),c.stroke(),i!=null&&c.setLineDash([])}else if(t!=null&&typeof o=="number")c.arc(...r.Au.couple(a),o,h,f,!1),c.strokeStyle=r.Zu.hex(t),c.lineWidth=s??1,u&&(c.lineCap=u),i!=null&&c.setLineDash([i]),c.stroke(),i!=null&&c.setLineDash([]);else if(e!=null)if(c.fillStyle=r.Zu.hex(e),typeof o=="number")c.arc(...r.Au.couple(a),o,h,f),c.fill();else{const{inner:p,outer:y}=o;c.arc(...r.Au.couple(a),y,h,f,!1);const S=a.x+p*Math.cos(f),b=a.y+p*Math.sin(f);c.lineTo(S,b),c.arc(...r.Au.couple(a),p,f,h,!0),c.closePath(),c.fill()}}resolveColor(e,t){return e==null?t==null?this.theme.colors.text:this.resolveColor(t):typeof e=="function"?e(this.theme):r.Zu.construct(e)}border({region:e,color:t,width:s,radius:i,location:o}){const a=this.canvas;a.strokeStyle=r.Zu.hex(this.resolveColor(t,this.theme.colors.border)),a.lineWidth=s??this.theme.sizes.border.width,i??=this.theme.sizes.border.radius,o==null||o===!0?i>0?(a.roundRect(...r.Au.couple(r.Eu.topLeft(e)),...r.Au.couple(r.Eu.dims(e)),i),a.stroke()):(a.rect(...r.Au.couple(r.Eu.topLeft(e)),...r.Au.couple(r.Eu.dims(e))),a.stroke()):r.du.toArray(o).forEach(l=>{const[u,c]=r.Eu.edgePoints(e,l);a.beginPath(),a.moveTo(...r.Au.couple(u)),a.lineTo(...r.Au.couple(c)),a.stroke()})}container({region:e,bordered:t=!0,rounded:s=!0,borderColor:i,borderRadius:o,borderWidth:a,backgroundColor:l}){o??=this.theme.sizes.border.radius,a??=1;const u=this.canvas;u.fillStyle=r.Zu.hex(this.resolveColor(l,this.theme.colors.gray.l1)),u.strokeStyle=r.Zu.hex(this.resolveColor(i,this.theme.colors.border)),u.setLineDash([]),u.lineWidth=1,u.beginPath(),s?u.roundRect(...r.Au.couple(r.Eu.topLeft(e)),...r.Au.couple(r.Eu.dims(e)),o):u.rect(...r.Au.couple(r.Eu.topLeft(e)),...r.Au.couple(r.Eu.dims(e))),u.fill(),t&&this.border({region:e,color:i,radius:o,width:a,location:t})}textContainer(e){const[t,s]=this.spacedTextDrawF(e);t.width+=12,t.height+=12;const{root:i=r.Mu.TOP_LEFT,offset:o=r.Au.ZERO}=e,a={...e.position};i.x==="right"?a.x-=t.width+o.x:a.x+=o.x,i.y==="bottom"?a.y-=t.height+o.y:a.y+=o.y,this.container({region:r.Eu.construct(a,t.width,t.height),...e}),this.canvas.filter="none",s(r.Au.translate(a,[6,6]))}spacedTextDrawF({text:e,direction:t,spacing:s=1,level:i="p"}){const o=Ke.fontString(this.theme,{level:i}),a=e.map(c=>Ks.dimensions(c,o,this.canvas)),l=this.theme.sizes.base*s,u=Math.max(...a.map(c=>c[r.vu.dimension(t)]))+l;return[{[r.vu.dimension(r.vu.swap(t))]:Math.max(...a.map(c=>c[r.vu.dimension(r.vu.swap(t))])),[r.vu.dimension(t)]:u*e.length-l},c=>{const h=Ke.fontString(this.theme,{level:i});this.canvas.font=h,this.canvas.fillStyle=r.Zu.hex(this.theme.colors.text),this.canvas.textBaseline="top",this.canvas.textAlign="start",e.forEach((f,p)=>{this.canvas.fillText(f,c.x,c.y+u*p)})}]}list({length:e,itemHeight:t,width:s,spacing:i=0,position:o,draw:a,root:l=r.Mu.TOP_LEFT,offset:u=r.Au.ZERO,padding:c=r.Au.ZERO}){const h=e*t+c.y*2+i*(e-1),f=s+c.x*2,p={...o};l.x==="right"?p.x-=s+u.x*2:p.x+=u.x,l.y==="top"?p.y-=h+u.y*2:p.y+=u.y,this.container({region:r.Eu.construct(p,{width:f,height:h}),backgroundColor:y=>y.colors.gray.l1});for(let y=0;y<e;y++){const S=r.Eu.construct(r.Au.construct(p.x+c.x,p.y+y*t+c.y+i*y),s,t);a(y,S)}}drawTextInCenter({box:e,text:t,level:s}){const i=Ks.dimensions(t,this.canvas.font,this.canvas),o=r.Eu.positionInCenter(r.Eu.construct(r.Au.ZERO,i),e);return this.text({text:t,position:r.Eu.topLeft(o),level:s})}text({text:e,position:t,level:s="p",weight:i,shade:o,maxWidth:a,code:l,justify:u="left",align:c="top",useAtlas:h,color:f}){this.canvas.font=Ke.fontString(this.theme,{level:s,weight:i,code:l}),f!=null?this.canvas.fillStyle=r.Zu.hex(this.resolveColor(f)):o==null?this.canvas.fillStyle=r.Zu.hex(this.theme.colors.text):this.canvas.fillStyle=r.Zu.hex(this.theme.colors.gray[`l${o}`]),this.canvas.textAlign=u,this.canvas.textBaseline=c;let p;a!=null&&(p=this.canvas.scissor(r.Eu.construct(t,a,1e3))),this.canvas.fillText(e,t.x,t.y,void 0,{useAtlas:h}),p?.()}}const Ws=d.z.object({position:d.z.number().optional(),pixelPosition:d.z.number().optional(),dragging:d.z.boolean(),lineWidth:d.z.number().default(1),lineDash:d.z.number().default(20),color:r.Zu.colorZ}),Xu=3;class st extends g.Leaf{static TYPE="Rule";schema=Ws;lastUpdateRef=null;afterUpdate(e){this.internal.renderCtx=Z.Context.use(e);const t=g.use(e);this.internal.draw=new Te(this.internal.renderCtx.upper2d,t),ie(e,"tool")}afterDelete(e){ie(e,"tool")}updatePositions({decimalToDataScale:e,plot:t}){const s=this.state.dragging,i=this.prevState.dragging&&!s;if((s||i)&&this.state.pixelPosition!=null){if(this.lastUpdateRef??=this.state.pixelPosition,Math.abs(this.state.pixelPosition-this.lastUpdateRef)<Xu&&!i)return this.state.pixelPosition;this.lastUpdateRef=this.state.pixelPosition;const l=e.pos(this.state.pixelPosition/r.Eu.height(t));return this.setState(u=>({...u,position:l})),this.state.pixelPosition}if(this.state.position==null){const a=e.pos(.5);this.setState(l=>({...l,position:a}))}const o=e.reverse().pos(this.state.position)*r.Eu.height(t);if(!isNaN(o)){if(this.state.pixelPosition!=null&&Math.abs(o-this.state.pixelPosition)<1)return this.state.pixelPosition;this.setState(a=>({...a,pixelPosition:o}))}return o}render(e){if(this.deleted)return;const{renderCtx:t}=this.internal,{location:s,plot:i}=e,o=r.Mu.direction(s),{upper2d:a}=t,l=this.internal.draw,u=this.updatePositions(e)+r.Eu.top(e.plot);l.rule({stroke:this.state.color,lineWidth:this.state.lineWidth,lineDash:this.state.lineDash,direction:o,region:i,position:u}),a.fillStyle=r.Zu.hex(this.state.color),a.lineJoin="round",a.lineWidth=3.5,a.lineCap="round",a.beginPath();const c=4;if(s==="left"){const h=r.Eu.left(i)-1;a.moveTo(h,u),a.lineTo(h-c,u-c),a.lineTo(h-c,u+c)}else s==="right"&&(a.moveTo(r.Eu.right(i),u),a.lineTo(r.Eu.right(i)+c,u-c),a.lineTo(r.Eu.right(i)+c,u+c));a.closePath(),a.stroke()}}const po={[st.TYPE]:st},Gu=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:po,Rule:st,ruleStateZ:Ws},Symbol.toStringTag,{value:"Module"})),Ku=mt.extend({location:r.Mu.x.default("left")}),Lr=2,Qu=n=>r.Eu.signedWidth(n)<Lr||r.Eu.signedHeight(n)<Lr;class Xt extends ho{static TYPE="YAxis";schema=mt;xBounds(){return r.Iu.max(this.lines.map(e=>e.xBounds()).filter(e=>r.Iu.isFinite(e)))}bounds(e){const[t,s]=this.iBounds(e,this.dataBounds.bind(this));if(s!=null)throw s;return t}render(e){if(this.deleted)return;const[t,s]=this.dataToDecimalScale(e.hold,this.dataBounds.bind(this),e.viewport),i=t.invert().reverse();if(this.renderAxis(e,i),this.renderLines(e,t),this.renderRules(e,i),s!=null)throw s}renderLines({xDataToDecimalScale:e,plot:t,canvases:s,exposure:i},o){if(!s.includes("gl")||Qu(t))return;const a={region:t,dataToDecimalScale:new r.Tu.XY(e,o),exposure:i};this.lines.forEach(l=>l.render(a))}renderRules({container:e,plot:t,canvases:s},i){if(!s.includes("upper2d"))return;const{location:o}=this.state,{render:a}=this.internal,l=r.Eu.construct(r.Eu.left(e),r.Eu.top(t),r.Eu.width(e),r.Eu.height(t)),u=a.scissor(l,r.Au.ZERO,["upper2d"]),c={container:e,plot:t,decimalToDataScale:i,location:o};this.rules.map(h=>h.render(c)),u()}findByXValue({xDataToDecimalScale:e,plot:t,viewport:s,hold:i,exposure:o},a){const[l,u]=this.dataToDecimalScale(i,this.dataBounds.bind(this),s);if(u!=null)throw u;const c=new r.Tu.XY(e,l),h={region:t,dataToDecimalScale:c,exposure:o};return this.lines.map(f=>({...f.findByXValue(h,a),units:this.state.label}))}dataBounds(){return this.lines.map(e=>e.yBounds())}get lines(){return this.childrenOfType(Bt.TYPE)}get rules(){return this.childrenOfType(st.TYPE)}}const Ju=d.z.object({start:r.d.z,end:r.d.z});class _r extends g.Leaf{static TYPE="range-annotation";schema=Ju;afterUpdate(e){this.internal.render=Z.Context.use(e),this.internal.draw=new Te(this.internal.render.upper2d,g.use(e))}}const eh=g.qA.payloadZ.extend({viewport:r.Iu.bounds}),go=d.z.object({cursor:r.Au.xy.or(d.z.null()),hovered:eh.or(d.z.null()),count:d.z.number()});class Gt extends g.Leaf{static TYPE="range-provider";schema=go;fetchedInitial=r.E.ZERO;afterUpdate(e){const{internal:t}=this;t.render=Z.Context.use(e),t.draw=new Te(t.render.upper2d,g.use(e)),t.requestRender=nn(e),t.runAsync=g.useErrorHandler(e),t.ranges??=new Map;const s=$e(e);if(t.requestRender("tool"),s==null)return;t.client=s;const i=Wo(e,this.key);t.removeListener?.();const o=i.ranges.onSet(l=>{t.client!=null&&(r.Zu.isCrude(l.color)&&t.ranges.set(l.key,t.client.ranges.sugarOne(l)),this.setState(u=>({...u,count:t.ranges.size})),t.requestRender("tool"))}),a=i.ranges.onDelete(async l=>{t.ranges.delete(l),this.setState(u=>({...u,count:t.ranges.size})),t.requestRender("tool")});t.removeListener=()=>{o(),a()}}fetchInitial(e){const{internal:t}=this,{client:s,runAsync:i}=t;s==null||this.fetchedInitial.equals(e,r.g.minutes(1))||(this.fetchedInitial=e,i(async()=>{(await s.ranges.retrieve(e)).forEach(a=>{r.Zu.isCrude(a.color)&&t.ranges.set(a.key,a)}),this.setState(a=>({...a,count:t.ranges.size}))},"failed to fetch initial ranges"))}render(e){const{dataToDecimalScale:t,region:s,viewport:i,timeRange:o}=e;this.fetchInitial(o);const{draw:a,ranges:l}=this.internal,u=t.scale(r.Eu.xBounds(s)),c=this.state.cursor==null?null:this.state.cursor.x;let h=null;const f=a.canvas.scissor(r.Eu.construct({x:r.Eu.left(s),y:r.Eu.top(s)-35},{x:r.Eu.right(s),y:r.Eu.bottom(s)}));l.forEach(p=>{const y=r.Zu.colorZ.safeParse(p.color);if(!y.success)return;const S=y.data;let b=u.pos(Number(p.timeRange.start.valueOf()));const E=u.pos(Number(p.timeRange.end.valueOf()));if(E<r.Eu.left(s)||b>r.Eu.right(s))return;b=r.vo(b,r.Eu.left(s)-2,r.Eu.right(s)-1);let x=!1;c!=null&&(x=r.Iu.contains({lower:b,upper:E},c)),x&&(h={key:p.key,parent:p.parent,name:p.name,color:p.color,labels:p.labels,timeRange:p.timeRange,viewport:{lower:t.scale(r.Eu.xBounds(i)).pos(Number(p.timeRange.start.valueOf())),upper:t.scale(r.Eu.xBounds(i)).pos(Number(p.timeRange.end.valueOf()))}}),a.container({region:r.Eu.construct({x:b,y:r.Eu.top(s)-1},{x:E,y:r.Eu.bottom(s)-1}),backgroundColor:r.Zu.setAlpha(S,.2),bordered:!1});const A=r.Eu.construct({x:b+1,y:r.Eu.top(s)-34},{x:E-1,y:r.Eu.top(s)-12});a.container({region:A,backgroundColor:r.Eu.width(A)<20?r.Zu.setAlpha(S,.4):C=>x?C.colors.gray.l2:C.colors.gray.l0,bordered:!0,borderWidth:1,borderRadius:2,borderColor:r.Zu.setAlpha(S,.8)}),a.text({text:p.name,position:{x:b+8,y:r.Eu.top(s)-30},level:"small",shade:10,weight:500,maxWidth:E-b-16})}),f(),h!=null?this.setState(p=>({...p,hovered:h})):this.state.hovered&&this.setState(p=>({...p,hovered:null}))}}const th={[_r.TYPE]:_r,[Gt.TYPE]:Gt},nh=mt;class Kt extends ho{static TYPE="XAxis";schema=mt;render(e){if(this.deleted)return;const[t,s]=this.dataToDecimalScale(e.hold,this.dataBounds.bind(this),e.viewport);if(this.renderAxis(e,t.reverse()),this.renderYAxes(e,t),this.renderRanges(e,t),s!=null)throw s}findByXDecimal(e,t){const[s,i]=this.dataToDecimalScale(e.hold,this.dataBounds.bind(this),e.viewport);if(i!=null)throw i;return this.findByXValue(e,s.reverse().pos(t))}findByXValue(e,t){const[s,i]=this.dataToDecimalScale(e.hold,this.dataBounds.bind(this),e.viewport);if(i!=null)throw i;const o={...e,xDataToDecimalScale:s};return this.yAxes.map(a=>a.findByXValue(o,t)).flat()}renderYAxes(e,t){const s={...e,xDataToDecimalScale:t};this.yAxes.forEach(i=>i.render(s))}get yAxes(){return this.childrenOfType(Xt.TYPE)}get ranges(){return this.childrenOfType(Gt.TYPE)}bounds(e){const[t,s]=this.iBounds(e,this.dataBounds.bind(this));if(s!=null)throw s;return t}renderRanges(e,t){const s=this.bounds(e.hold),i=r.Iu.min([s,r.E.MAX.numericBounds]),o=new r.E(i.lower,i.upper);this.ranges.forEach(a=>a.render({dataToDecimalScale:t,region:e.plot,viewport:e.viewport,timeRange:o}))}dataBounds(){return this.yAxes.map(e=>e.xBounds())}}const sh=r.Au.construct(12),rh=3,ih=14,oh=r.Au.construct(6),Vs=d.z.object({position:r.Au.xy.or(d.z.null()),textColor:r.Zu.colorZ.default(r.Zu.ZERO),backgroundColor:r.Zu.colorZ.default(r.Zu.ZERO),borderColor:r.Zu.colorZ.default(r.Zu.ZERO),ruleColor:r.Zu.colorZ.default(r.Zu.ZERO),ruleStrokeWidth:d.z.number().default(1),ruleStrokeDash:d.z.number().default(0)});class rt extends g.Leaf{static TYPE="tooltip";schema=Vs;afterUpdate(e){const t=g.use(e);r.Zu.isZero(this.state.textColor)&&(this.state.textColor=t.colors.text),r.Zu.isZero(this.state.backgroundColor)&&(this.state.backgroundColor=t.colors.gray.l1),r.Zu.isZero(this.state.borderColor)&&(this.state.borderColor=t.colors.border),r.Zu.isZero(this.state.ruleColor)&&(this.state.ruleColor=t.colors.gray.l7),this.internal.dotColor=t.colors.text,this.internal.dotColorContrast=t.colors.textInverted,this.internal.render=Z.Context.use(e),this.internal.draw=new Te(this.internal.render.upper2d,t),ie(e,"tool")}afterDelete(e){ie(e,"tool")}render(e){if(this.deleted||this.state.position==null)return;const{region:t}=e,s=r.Tu.XY.scale(r.Eu.DECIMAL).scale(t),i=r.Tu.XY.scale(t).scale(r.Eu.DECIMAL),o=e.findByXDecimal(i.x.pos(this.state.position.x)),a=o.filter(b=>r.Au.isFinite(b.value)),{draw:l}=this.internal,u=a.reduce((b,E)=>b+E.position.x,0)/a.length,c=new r.d(a.reduce((b,E)=>b+E.value.x,0)/a.length),h=s.x.pos(u);if(!r.Iu.contains(r.Eu.xBounds(t),h))return;l.rule({stroke:this.state.ruleColor,lineWidth:this.state.ruleStrokeWidth,lineDash:this.state.ruleStrokeDash,direction:"y",region:t,position:h}),a.forEach(b=>{const E=s.pos(b.position);l.circle({fill:r.Zu.setAlpha(b.color,.5),radius:8,position:E}),l.circle({fill:r.Zu.setAlpha(b.color,.8),radius:5,position:E}),l.circle({fill:r.Zu.pickByContrast(b.color,this.internal.dotColor,this.internal.dotColorContrast),radius:2,position:E})});const f=i.pos(this.state.position),p={...r.Mu.TOP_LEFT};f.x>.6&&(p.x="right"),f.y>.6&&(p.y="bottom");let y=o.reduce((b,E)=>Math.max(b,E.label?.length??0),0);const S=c.toString("preciseDate","local").length;S>y&&(y=S),l.list({root:p,offset:sh,length:a.length+1,padding:oh,itemHeight:ih,spacing:rh,width:y*7+48,position:this.state.position,draw:(b,E)=>{let x="",A="",C=this.state.textColor;if(b===0)x="Time",A=c.toString("preciseDate","local");else{const P=a[b-1];x=P.label??"",A=r.Nu.roundBySpan(P.value.y,P.bounds).toString(),C=P.color}l.text({position:r.Eu.topLeft(E),text:x,level:"small",weight:500,color:C}),l.text({position:r.Au.translateY(r.Eu.topRight(E),-1),text:A,level:"small",justify:"right",code:!0,shade:10})}})}}const mo={[rt.TYPE]:rt},ah=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:mo,Tooltip:rt,tooltipStateZ:Vs},Symbol.toStringTag,{value:"Module"})),yo=d.z.enum(["one","two"]),Xs=d.z.object({one:r.Au.xy.nullable(),two:r.Au.xy.nullable(),hover:r.Au.xy.nullable(),mode:yo.default("one"),color:d.z.union([r.Zu.colorZ,d.z.object({verticalLine:r.Zu.colorZ.default(r.Zu.ZERO),horizontalLine:r.Zu.colorZ.default(r.Zu.ZERO),obliqueLine:r.Zu.colorZ.default(r.Zu.ZERO)})]).optional().default(r.Zu.ZERO),strokeWidth:d.z.number().default(1),strokeDash:d.z.number().default(2)}),lh=n=>n==="one"?"1":"2",ch=n=>n.colors.error.z,uh=n=>n.colors.secondary.z,hh=n=>n.colors.gray.l9,We=6,Ve=14,Xe=8,Tt=8,wt=3,dh=9,fh=8,ph=2,gh=2,mh=8,yh=5,bh=2,Sh=.5,vh=.8,xt=50,Ct=80,Eh=30,Th=30,wh=10,xh=40,Ch=100,Rh=30,xe=15,kr=8,Ah=10;class it extends g.Leaf{static TYPE="measure";schema=Xs;afterUpdate(e){const t=Z.Context.use(e);this.internal.theme=g.use(e),this.internal.renderCtx=t,this.internal.draw=new Te(t.upper2d,this.internal.theme),ie(e,"tool"),this.internal.dotColor=this.internal.theme.colors.text,this.internal.dotColorContrast=this.internal.theme.colors.textInverted}afterDelete(e){ie(e,"layout")}get verticalLineColor(){return r.Zu.isColor(this.state.color)?r.Zu.isZero(this.state.color)?this.internal.theme.colors.gray.l8:this.state.color:r.Zu.isZero(this.state.color.verticalLine)?this.internal.theme.colors.gray.l8:this.state.color.verticalLine}get horizontalLineColor(){return r.Zu.isColor(this.state.color)?r.Zu.isZero(this.state.color)?this.internal.theme.colors.gray.l8:this.state.color:r.Zu.isZero(this.state.color.horizontalLine)?this.internal.theme.colors.gray.l8:this.state.color.horizontalLine}get obliqueLineColor(){return r.Zu.isColor(this.state.color)?r.Zu.isZero(this.state.color)?this.internal.theme.colors.gray.l8:this.state.color:r.Zu.isZero(this.state.color.obliqueLine)?this.internal.theme.colors.gray.l8:this.state.color.obliqueLine}findPoint(e,t,s,i,o){const a=i!=null&&!r.Au.equals(t,i);if(s!=null&&!a){const c=e.findByXValue(s.x).filter(h=>Number.isFinite(h.value.x)&&Number.isFinite(h.value.y));return c.length>0?c.sort((h,f)=>r.Au.distance(s,h.value)-r.Au.distance(s,f.value))[0]:null}const l=o.pos(t),u=e.findByXDecimal(l.x).filter(c=>Number.isFinite(c.value.x)&&Number.isFinite(c.value.y));return u.length===0?null:u.sort((c,h)=>r.Au.distance(l,c.position)-r.Au.distance(l,h.position))[0]}find(e){const{one:t,two:s}=this.state;if(t==null||s==null)return null;const{dataOne:i,dataTwo:o,clickOne:a,clickTwo:l}=this.internal,u=r.Tu.XY.scale(e.region).scale(r.Eu.DECIMAL),c=this.findPoint(e,t,i,a,u);if(c==null)return null;(a==null||!r.Au.equals(t,a))&&(this.internal.dataOne={...c.value},this.internal.clickOne={...t});const h=this.findPoint(e,s,o,l,u);return h==null?null:((l==null||!r.Au.equals(s,l))&&(this.internal.dataTwo={...h.value},this.internal.clickTwo={...s}),[c,h])}drawLabelValue(e,t,s,i){const{draw:o}=this.internal,a=r.Au.construct(We),l=e.length*Xe,u=t.length*Tt,c=l+u+a.x*wt,h=Ve+a.y*2,f=r.Eu.construct(s,c,h);o.container({region:f,backgroundColor:p=>p.colors.gray.l1}),o.text({text:e,position:r.Au.translate(r.Eu.topLeft(f),a),level:"small",weight:500,color:i(this.internal.theme)}),o.text({text:t,position:r.Au.translate(r.Eu.topRight(f),[-a.x-1,a.y-1]),level:"small",justify:"right",code:!0,shade:10})}drawCombinedDeltaLabel(e,t,s,i,o,a){const{draw:l,theme:u}=this.internal,c=r.Au.construct(We),h=Xe*5,f=Math.max(t.length,s.length,i.length),p=h+f*Tt+c.x*wt,y=Ve,S=y*3+c.y*2;let b;if(a){const E=r.Au.translate(e,[-p/2,-S/2]);b=r.Eu.construct(E,p,S)}else if(b=r.Eu.construct(e,p,S),r.Eu.right(b)>r.Eu.right(o)){const E=r.Au.translateX(e,-p-Ct*2);b=r.Eu.construct(E,p,S)}l.container({region:b,backgroundColor:E=>E.colors.gray.l1}),this.drawPointLabelRow({region:b,label:"ΔX",value:t,labelColor:u.colors.error.z,yOffset:0,leftOffset:0}),this.drawPointLabelRow({region:b,label:"ΔY",value:s,labelColor:u.colors.secondary.z,yOffset:y,leftOffset:0}),this.drawPointLabelRow({region:b,label:"Slope",value:i,labelColor:u.colors.gray.l9,yOffset:y*2,leftOffset:0})}drawPointLabelRow(e){const{region:t,label:s,value:i,labelColor:o,yOffset:a,leftOffset:l}=e,{draw:u}=this.internal,c=r.Au.construct(We);u.text({text:s,position:r.Au.translate(r.Eu.topLeft(t),[c.x+l,c.y+a]),level:"small",weight:500,color:o}),u.text({text:i,position:r.Au.translate(r.Eu.topRight(t),[-c.x-1,c.y+a-1]),level:"small",justify:"right",code:!0,shade:10})}drawPointLabel(e){const{pointNumber:t,position:s,value:i,units:o,bounds:a,toTop:l,viewRegion:u,xDist:c}=e,{draw:h,theme:f}=this.internal,p=new r.d(i.x),y=p.toString(p.formatBySpan(c),"local"),S=`${r.Nu.roundBySpan(i.y,a)} ${o??""}`,b=`${t}`,E=b.length*Xe,x=r.Au.construct(We),A=Xe,C=Math.max(y.length,S.length),P=E+kr+A+C*Tt+x.x*wt,O=Ve,T=O*2+x.y*2;let k=l?-(T+xe):xe,M=r.Eu.construct(r.Au.translate(s,[-P/2,k]),P,T);(l&&r.Eu.top(M)<r.Eu.top(u)||!l&&r.Eu.bottom(M)>r.Eu.bottom(u))&&(k=l?xe:-(T+xe),M=r.Eu.construct(r.Au.translate(s,[-P/2,k]),P,T)),h.container({region:M,backgroundColor:W=>W.colors.gray.l1}),h.text({text:b,position:r.Au.translate(r.Eu.topLeft(M),[x.x,x.y]),level:"small",weight:500,color:f.colors.gray.l9});const G=E+kr;this.drawPointLabelRow({region:M,label:"X",value:y,labelColor:f.colors.error.z,yOffset:0,leftOffset:G}),this.drawPointLabelRow({region:M,label:"Y",value:S,labelColor:f.colors.secondary.z,yOffset:O,leftOffset:G})}drawPointMarker(e,t){const{draw:s}=this.internal;s.circle({fill:r.Zu.setAlpha(t,Sh),radius:mh,position:e}),s.circle({fill:r.Zu.setAlpha(t,vh),radius:yh,position:e}),s.circle({fill:r.Zu.pickByContrast(t,this.internal.dotColor,this.internal.dotColorContrast),radius:bh,position:e})}calculateYLabelPosition(e,t,s){return t?r.Au.translateX(e,Eh):s?r.Au.translateX(e,Th):e}calculateXLabelPosition(e,t,s){return t?r.Au.translateY(e,xh):s?r.Au.translateY(e,wh):e}calculateSlopeLabelPosition(e){const{basePos:t,yLabelPos:s,isVeryClose:i,isHorizontal:o,xPixelDist:a,yPixelDist:l}=e;return i?r.Au.translateX(t,Ct):o?r.Au.translateY(t,-35):Math.abs(t.x-s.x)<Ch&&Math.abs(t.y-s.y)<Rh?a<l?r.Au.translateY(t,-35):r.Au.translateX(t,Ct):t}renderHover(e){if(this.state.hover==null)return;const t=this.state.hover,s=r.Tu.XY.scale(e.region).scale(r.Eu.DECIMAL),i=s.pos(t),o=e.findByXDecimal(s.pos(t).x);if(o.length===0)return;const a=o.sort((c,h)=>r.Au.distance(i,c.position)-r.Au.distance(i,h.position))[0],{draw:l}=this.internal,u=s.reverse().pos(a.position);l.circle({stroke:r.Zu.setAlpha(a.color,1),strokeWidth:ph,lineDash:gh,radius:dh,position:u}),l.circle({fill:this.internal.theme.colors.gray.l3,radius:fh,position:u}),l.text({text:lh(this.state.mode),position:u,level:"small",align:"middle",justify:"center"})}render(e){if(this.deleted)return;this.renderHover(e);const t=this.find(e);if(t==null)return;const[s,i]=t,{draw:o}=this.internal,{strokeDash:a,strokeWidth:l}=this.state,u=r.Tu.XY.scale(r.Eu.DECIMAL).scale(e.region),c=u.pos(s.position),h=u.pos(i.position),f=Math.abs(s.value.x-i.value.x),p=i.value.y-s.value.y,y=Math.abs(p);if(!Number.isFinite(f)||!Number.isFinite(y))return;const S=new r.g(f),b=p/S.seconds,E=Math.abs(c.x-h.x),x=Math.abs(c.y-h.y),A=x<xt,C=E<xt,P=E<xt||x<xt;o.line({start:r.Au.construct(c.x,c.y),end:r.Au.construct(c.x,h.y),stroke:this.verticalLineColor,lineDash:a,lineWidth:l}),o.line({start:r.Au.construct(c.x,h.y),end:r.Au.construct(h.x,h.y),stroke:this.horizontalLineColor,lineDash:a,lineWidth:l}),o.line({start:r.Au.construct(c.x,c.y),end:r.Au.construct(h.x,h.y),stroke:this.obliqueLineColor,lineDash:a,lineWidth:l}),this.drawPointMarker(c,s.color),this.drawPointMarker(h,i.color);const O=`${r.Nu.roundBySpan(y,r.Iu.construct(y))} ${s.units??""}`,T=S.lessThan(r.g.milliseconds(Ah))?r.g.MICROSECOND:r.g.MILLISECOND,k=S.truncate(T).toString();let M=r.Nu.roundBySpan(b,r.Iu.construct(Math.abs(b))).toString();if(s.units!=null&&s.units.length>0&&(M+=` ${s.units} / s`),P){const W=r.Au.construct((c.x+h.x)/2,(c.y+h.y)/2),w=Xe*6,F=Math.max(k.length,O.length,M.length),N=We,K=w+F*Tt+N*wt,ue=Ve*3+N*2,te=r.Eu.construct(r.Au.translate(W,[-K/2,-ue/2]),K,ue),ne=c.y<h.y,Q=150,z=Ve*2+N*2,pn=ne?-55:xe,gn=r.Eu.construct(r.Au.translate(c,[-Q/2,pn]),Q,z),mn=ne?xe:-55,yn=r.Eu.construct(r.Au.translate(h,[-Q/2,mn]),Q,z),bn=r.Eu.area(r.Eu.intersection(te,gn))>0,Sn=r.Eu.area(r.Eu.intersection(te,yn))>0,yt=!bn&&!Sn,vn=yt?W:r.Au.construct(Math.max(c.x,h.x)+Ct,(c.y+h.y)/2);this.drawCombinedDeltaLabel(vn,k,O,M,e.region,yt)}else{const W=this.calculateYLabelPosition(r.Au.construct(c.x,(c.y+h.y)/2),P,C);this.drawLabelValue("ΔY",O,W,uh);const w=this.calculateXLabelPosition(r.Au.construct((c.x+h.x)/2,h.y),P,A);this.drawLabelValue("ΔX",k,r.Au.translateX(w,-15),ch);const F=this.calculateSlopeLabelPosition({basePos:r.Au.construct((c.x+h.x)/2,(c.y+h.y)/2),yLabelPos:W,isVeryClose:P,isHorizontal:A,xPixelDist:E,yPixelDist:x});this.drawLabelValue("Slope",M,F,hh)}const G=c.y<h.y;this.drawPointLabel({pointNumber:1,position:c,value:s.value,units:s.units??null,bounds:s.bounds,toTop:G,viewRegion:e.region,xDist:S}),this.drawPointLabel({pointNumber:2,position:h,value:i.value,units:i.units??null,bounds:i.bounds,toTop:!G,viewRegion:e.region,xDist:S})}}const bo={[it.TYPE]:it},Ph=Object.freeze(Object.defineProperty({__proto__:null,Measure:it,REGISTRY:bo,measureStateZ:Xs,modeZ:yo},Symbol.toStringTag,{value:"Module"})),So=d.z.object({container:r.Eu.box,viewport:r.Eu.box,hold:d.z.boolean().default(!1),grid:d.z.record(d.z.string(),lo),visible:d.z.boolean().default(!0),clearOverScan:r.Au.crudeZ.default(r.Au.ZERO)}),Lh=d.z.record(d.z.string(),d.z.object({lower:d.z.number(),upper:d.z.number()})),vo={getBounds:d.z.function({input:d.z.tuple([]),output:Lh})},_h=(n,e)=>{const t=r.Eu.width(n)*Math.sqrt(r.Eu.height(n)),s=r.Eu.width(e)*Math.sqrt(r.Eu.height(e));return t/s},kh=["upper2d","lower2d","gl"],Oh=["upper2d"];class Gn extends g.Composite{static TYPE="LinePlot";schema=So;methods=vo;afterUpdate(e){this.internal.instrumentation=Z.useInstrumentation(e,"lineplot"),this.internal.handleError=g.useErrorHandler(e),this.internal.renderCtx=Z.Context.use(e),tn(e,t=>{this.state.visible&&this.requestRender("low",t)}),!(!this.state.visible&&!this.prevState.visible)&&this.requestRender("high","layout")}afterDelete(e){this.internal.renderCtx=Z.Context.use(e),this.requestRender("high","layout")}findByXDecimal(e){const t={...this.state,plot:this.calculatePlot(),exposure:this.exposure};return this.axes.flatMap(s=>s.findByXDecimal(t,e)).flat()}findByXValue(e){const t={...this.state,plot:this.calculatePlot(),exposure:this.exposure};return this.axes.flatMap(s=>s.findByXValue(t,e)).flat()}get axes(){return this.childrenOfType(Kt.TYPE)}get tooltips(){return this.childrenOfType(rt.TYPE)}get measures(){return this.childrenOfType(it.TYPE)}get exposure(){return _h(this.state.viewport,this.state.container)}renderAxes(e,t){const s={...this.state,plot:e,canvases:t,exposure:this.exposure};this.axes.forEach(i=>i.render(s))}renderTooltips(e,t){const s={findByXDecimal:this.findByXDecimal.bind(this),region:e,canvases:t};this.tooltips.forEach(i=>i.render(s))}getBounds(){const e={};return this.axes.forEach(t=>{const s=t.state.axisKey??t.key;e[s]=t.bounds(this.state.hold),t.yAxes.forEach(i=>{const o=i.state.axisKey??i.key;e[o]=i.bounds(this.state.hold)})}),e}renderMeasures(e){const t={findByXDecimal:this.findByXDecimal.bind(this),findByXValue:this.findByXValue.bind(this),region:e};this.measures.forEach(s=>s.render(t))}calculatePlot(){return Bu(this.state.grid,this.state.container)}render(e){const{instrumentation:t,renderCtx:s,handleError:i}=this.internal;if(this.deleted){t.L.debug("deleted, skipping render",{key:this.key});return}if(!this.state.visible)return t.L.debug("not visible, skipping render",{key:this.key}),({canvases:h})=>s.erase(this.state.container,this.state.clearOverScan,...h);const o=this.calculatePlot();t.L.debug("rendering",{key:this.key,viewport:this.state.viewport,container:this.state.container,grid:this.state.grid,plot:o,canvases:e});const a=r.Au.construct(this.state.clearOverScan),l=s.scissor(this.state.container,a,e.filter(h=>h!=="gl")),u=s.scissor(o,r.Au.ZERO,e.filter(h=>h==="gl"));try{this.renderAxes(o,e),this.renderTooltips(o,e),this.renderMeasures(o)}catch(h){i(h,"failed to render line plot")}finally{l(),u()}t.L.debug("rendered",{key:this.key});const c=r.Eu.copy(this.state.container);return({canvases:h})=>s.erase(c,this.state.clearOverScan,...h)}requestRender(e,t){const{renderCtx:s}=this.internal;let i=kh;t==="tool"&&(i=Oh),s.loop.set({key:`${this.type}-${this.key}`,render:()=>this.render(i),priority:e,canvases:i})}}const Ih={[Gn.TYPE]:Gn,[Kt.TYPE]:Kt,[Xt.TYPE]:Xt},Eo=d.z.object({region:r.Eu.box,wheelPos:d.z.number(),scrolling:d.z.boolean(),empty:d.z.boolean(),visible:d.z.boolean(),telem:_t.default(Xr),font:pe.levelZ.default("p"),color:r.Zu.colorZ.default(r.Zu.ZERO),overshoot:r.Au.xy.default({x:0,y:0})}),Mh=.98,Ge="lower2d",Zh={offset:0n,offsetRef:0n,scrollRef:0};class ot extends g.Leaf{static TYPE="log";static z=Eo;schema=ot.z;values=new r.Ru([]);scrollState=Zh;afterUpdate(e){const{internal:t}=this;t.render=Z.Context.use(e),t.theme=g.use(e),r.Zu.isZero(this.state.color)?this.internal.textColor=t.theme.colors.gray.l11:t.textColor=this.state.color,t.telem=$(e,this.state.telem,t.telem);const{scrolling:s,wheelPos:i}=this.state;if(this.state.scrolling&&!this.prevState.scrolling){const u=this.values.alignmentBounds.upper-1n;this.scrollState={offset:u,offsetRef:u,scrollRef:this.state.wheelPos}}else if(s){const{scrollState:u,values:c}=this,h=Math.ceil((i-this.scrollState.scrollRef)/this.lineHeight);u.offset=this.values.traverseAlignment(u.offsetRef,-BigInt(h)),u.offset<c.alignmentBounds.lower+BigInt(this.visibleLineCount)&&(u.offset=c.alignmentBounds.lower,this.setState(f=>({...f,wheelPos:this.prevState.wheelPos}))),u.offset>=c.alignmentBounds.upper&&this.setState(f=>({...f,scrolling:!1}))}const[a,l]=this.internal.telem.value();this.values=l,this.checkEmpty(),t.stopListeningTelem?.(),t.stopListeningTelem=t.telem.onChange(()=>{const[u,c]=this.internal.telem.value();this.checkEmpty(),this.values=c,this.requestRender()}),!(!this.state.visible&&!this.prevState.visible)&&this.requestRender()}checkEmpty(){const e=this.values.length===0;e!==this.state.empty&&this.setState(t=>({...t,empty:e}))}afterDelete(){const{telem:e,render:t}=this.internal;e.cleanup?.(),t.erase(r.Eu.construct(this.state.region),r.Au.ZERO,Ge)}requestRender(){const{render:e}=this.internal;e.loop.set({key:`${this.type}-${this.key}`,render:()=>this.render(),priority:"high",canvases:[Ge]})}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((r.Eu.height(this.state.region)-12)/this.lineHeight),this.values.length)}render(){const{render:e}=this.internal,t=this.state.region;if(r.Eu.areaIsZero(t))return;if(!this.state.visible)return()=>e.erase(t,r.Au.ZERO,Ge);let s;if(!this.state.scrolling)s=this.values.subIterator(this.values.length-this.visibleLineCount,this.values.length);else{const c=this.values.traverseAlignment(this.scrollState.offset,-BigInt(this.visibleLineCount));s=this.values.subAlignmentSpanIterator(c,this.visibleLineCount)}const i=this.state.region,o=e[Ge],a=new Te(o,this.internal.theme),l=e.scissor(i,r.Au.ZERO,[Ge]);this.renderElements(a,s),this.renderScrollbar(a),l();const u=r.Eu.copy(this.state.region);return({canvases:c})=>e.erase(u,this.state.overshoot,...c)}renderScrollbar(e){const t=this.state.region,s=r.Eu.height(t)/this.totalHeight*r.Eu.height(t);if(s>=r.Eu.height(t)*Mh)return;let i=r.Eu.bottom(t)-s;this.state.scrolling&&(i-=Number(this.values.distance(this.values.alignmentBounds.upper,this.scrollState.offset))/this.values.length*r.Eu.height(t)),i<0&&(i=r.Eu.top(t)),e.container({region:r.Eu.construct({x:r.Eu.right(t)-6,y:i},{width:6,height:s}),bordered:!1,backgroundColor:o=>o.colors.gray.l6})}renderElements(e,t){const s=this.state.region;let i=0;for(const o of t){const a=this.values.dataType.equals(r.f.JSON)?JSON.stringify(o):o.toString();e.text({text:a,level:this.state.font,shade:11,position:r.Au.translate(r.Eu.topLeft(s),{x:6,y:i*this.lineHeight+6}),code:!0}),i++}}}const Dh={[ot.TYPE]:ot},Nh="roles",Yh={channel:g.SA.role.SET_CHANNEL_NAME,schema:g.SA.role.roleZ,onChange:({store:n,changed:e})=>{n.roles.set(e.key,e)}},zh={channel:g.SA.role.DELETE_CHANNEL_NAME,schema:g.SA.role.keyZ,onChange:({store:n,changed:e})=>n.roles.delete(e)},Uh={listeners:[Yh,zh]},Bh="ranges",$h={channel:g.qA.SET_CHANNEL_NAME,schema:g.qA.payloadZ,onChange:async({store:n,changed:e,client:t})=>{const s=t.ranges.sugarOne(e),i=n.ranges.get(e.key);let o;i?.labels==null&&(o=await s.retrieveLabels());let a=null;i?.parent==null&&(a=await s.retrieveParent()),n.ranges.set(e.key,l=>t.ranges.sugarOne({...s.payload,labels:l?.labels??o,parent:l?.parent??a}))}},Fh={channel:g.qA.DELETE_CHANNEL_NAME,schema:g.qA.keyZ,onChange:({store:n,changed:e})=>n.ranges.delete(e)},qh={equal:(n,e)=>r.Vu.equal(n.payload,e.payload),listeners:[$h,Fh]},To=d.z.object({authority:r._u.authorityZ.optional(),valid:d.z.boolean().optional()}).default({authority:void 0,valid:!1}),wo=d.z.object({triggered:d.z.boolean(),status:r.ol.statusZ(To),sink:on.default(rn),source:Ts.default(vs)});class Kn extends g.Leaf{static TYPE="Chip";schema=wo;afterUpdate(e){const{internal:t}=this,{sink:s,source:i}=this.state;t.source=$(e,i,t.source),t.sink=Fe(e,s,t.sink),this.state.triggered&&!this.prevState.triggered&&t.sink.set(this.state.status.details?.authority!==r._u.ABSOLUTE_AUTHORITY),this.updateEnabledState(),t.stopListening?.(),t.stopListening=t.source.onChange(()=>this.updateEnabledState())}updateEnabledState(){const e=this.internal.source.value();r.Vu.equal(e,this.state.status)||this.setState(t=>({...t,status:e,triggered:!1}))}afterDelete(){this.internal.stopListening(),this.internal.source.cleanup?.(),this.internal.sink.cleanup?.()}render(){}}const xo=d.z.object({}),Or="control-state-provider",Co=g.UA.stateZ.extend({subjectColor:r.Zu.colorZ});class at extends g.Composite{static TYPE="StateProvider";schema=xo;colors=new Map;tracker;disconnectTrackerChange;obs=new r.tl.Observer;static use(e){return e.get(Or)}afterUpdate(e){const{internal:t}=this;t.instrumentation=Z.useInstrumentation(e,"control-state");const s=g.use(e);t.palette=s.colors.visualization.palettes.default,t.defaultColor=s.colors.gray.l8;const i=$e(e);if(t.client!=null&&i===t.client)return;t.client=i,e.set(Or,this),g.useErrorHandler(e)(async()=>{await this.maybeCloseTracker(),t.client!=null&&(this.internal.instrumentation.L.debug("starting state tracker"),await this.openTracker(t.client))},"failed to open control state tracker")}async maybeCloseTracker(){this.tracker!=null&&(this.internal.instrumentation.L.debug("stopping state tracker"),this.disconnectTrackerChange?.(),await this.tracker.close(),this.tracker=void 0)}afterDelete(e){g.useErrorHandler(e)(async()=>{await this.maybeCloseTracker()},"failed to close control state tracker")}onChange(e){return this.obs.onChange(e)}get(e){return Array.isArray(e)?r.bu.unique(e).map(t=>this.getOne(t)).filter(t=>t!=null):this.getOne(e)}getOne(e){if(this.tracker==null)return;const t=this.tracker.states.get(e);if(t!=null)return{...t,subjectColor:this.colors.get(t.subject.key)??this.internal.defaultColor}}async openTracker(e){const{internal:t}=this,{instrumentation:s}=t;try{this.tracker=await e.control.openStateTracker()}catch{s.L.error("failed to open state tracker");return}this.disconnectTrackerChange?.(),this.disconnectTrackerChange=this.tracker.onChange(i=>{if(s.L.debug("transfer",{transfers:i.map(o=>g.UA.transferString(o))}),this.tracker==null)throw new g.St("tracker is null inside it's own onChange callback!");this.updateColors(this.tracker),this.obs.notify(i)})}updateColors(e){const t=e.subjects(),s=t.map(a=>a.key),i=Array.from(this.colors.values());this.colors.forEach((a,l)=>!s.includes(l)&&this.colors.delete(l));const{palette:o}=this.internal;t.forEach(a=>{if(this.colors.has(a.key))return;const l=o.find(u=>!i.includes(u))??o[0];this.colors.set(a.key,l),i.push(l)})}}const Ro=d.z.enum(["acquired","released","overridden","failed"]),Ao=d.z.object({name:d.z.string(),authority:d.z.number().default(0),status:Ro.optional(),needsControlOf:g.xA.keyZ.array().default([])}),Qn={acquire:d.z.function({input:d.z.tuple([]),output:d.z.void()}),release:d.z.function({input:d.z.tuple([]),output:d.z.void()})};class Jn extends g.Composite{static TYPE="Controller";static METHODS=Qn;schema=Ao;methods=Qn;registry=new Map;writer;afterUpdate(e){const{internal:t}=this;t.instrumentation=Z.useInstrumentation(e),t.addStatus=g.useAdder(e),t.runAsync=g.useErrorHandler(e);const s=$e(e),i=at.use(e);t.stateProv=i,t.telemCtx=Oi(e,this,t.telemCtx),t.client=s}afterDelete(){const{internal:e}=this;e.runAsync(()=>this.doRelease(),"failed to release control")}async updateNeedsControlOf(){const{client:e}=this.internal;if(e==null)return;const t=new Set([]);for(const i of this.registry.keys())(await i.needsControlOf(e)).forEach(a=>a!==0&&t.add(a));const s=Array.from(t);r.wu.unorderedPrimitiveArrays(this.state.needsControlOf,s)!==r.wu.EQUAL&&this.setState(i=>({...i,needsControlOf:s}))}acquire(){this.internal.runAsync(()=>this.doAcquire(),"failed to acquire control")}release(){this.internal.runAsync(()=>this.doRelease(),"failed to release control")}async doAcquire(){const{client:e,addStatus:t}=this.internal;if(e==null)return t({message:`Cannot acquire control on ${this.state.name} because no Core has been connected.`,variant:"warning"});try{await this.updateNeedsControlOf();const s=this.state.needsControlOf;if(s.length===0)return t({message:`Cannot acquire control on ${this.state.name} because there are no channels to control.`,variant:"warning"});const i=g.w.now().sub(r.g.milliseconds(1));this.writer=await e.openWriter({start:i,channels:s,controlSubject:{key:this.key,name:this.state.name},authorities:this.state.authority}),this.setState(o=>({...o,status:"acquired"}))}catch(s){if(this.setState(i=>({...i,status:"failed"})),!(s instanceof Error))throw s;t({variant:"error",message:`${this.state.name} failed to acquire control`,description:s.message})}}async doRelease(){try{await this.writer?.close()}catch(e){this.internal.addStatus({message:`${this.state.name} failed to release control: ${e.message}`,variant:"error"})}finally{this.setState(e=>({...e,status:"released"})),this.writer=void 0}}async set(e){this.writer==null&&await this.doAcquire(),await this.writer?.write(e)}async setAuthority(e,t){this.writer==null&&await this.doAcquire(),await this.writer?.setAuthority(Object.fromEntries(e.map(s=>[s,t])))}async releaseAuthority(e){this.writer==null&&await this.doAcquire(),await this.writer?.setAuthority(Object.fromEntries(e.map(t=>[t,this.state.authority])))}deleteTelem(e){this.registry.delete(e),this.updateNeedsControlOf()}create(e){const{internal:t}=this,i=(()=>{switch(e.type){case Qt.TYPE:{const o=new Qt(this,t.runAsync,e.props);return this.registry.set(o,null),o}case en.TYPE:{const o=new en(this,this.internal.stateProv,e.props);return this.registry.set(o,null),o}case Jt.TYPE:return new Jt(this,t.runAsync,e.props);default:return null}})();return i!=null&&this.updateNeedsControlOf(),i}}const Po=d.z.object({channel:d.z.number()});class Qt extends un{static TYPE="controlled-numeric-telem-sink";controller;runAsync;schema=Po;constructor(e,t,s){super(s),this.controller=e,this.runAsync=t}invalidate(){}cleanup(){this.controller.deleteTelem(this)}async needsControlOf(e){if(this.props.channel===0)return[];const t=await e.channels.retrieve(this.props.channel),s=[t.key];return t.index!==0&&s.push(t.index),s}set(...e){this.runAsync(async()=>{const{client:t}=this.controller.internal;if(t==null)throw new g.fA("No Core connected");if(this.props.channel===0)throw new g.W("No command channel specified for actuator");const s=await t.channels.retrieve(this.props.channel),i={[s.key]:e};if(s.index!==0){const o=await t.channels.retrieve(s.index),a=g.w.now();i[o.key]=Array.from({length:e.length},(l,u)=>a.add(r.g.nanoseconds(u)))}await this.controller.set(i)},"Failed to command channel")}}const Hh=n=>({type:Qt.TYPE,props:n,variant:"sink",valueType:"number"}),Lo=d.z.object({authority:d.z.number().default(g.UA.ABSOLUTE_AUTHORITY),channel:d.z.number()});class Jt extends un{static TYPE="acquire-channel-control";controller;runAsync;schema=Lo;constructor(e,t,s){super(s),this.controller=e,this.runAsync=t}cleanup(){this.controller.deleteTelem(this)}async needsControlOf(e){const t=await e.channels.retrieve(this.props.channel),s=[t.key];return t.index!==0&&s.push(t.index),s}set(e){this.runAsync(async()=>{const{controller:t}=this,{client:s}=t.internal;if(s==null)return;const i=await s.channels.retrieve(this.props.channel),o=[i.key];i.index!==0&&o.push(i.index),e?await this.controller.setAuthority(o,this.props.authority):await this.controller.releaseAuthority(o)},"failed to set channel authority")}}const jh=n=>({type:Jt.TYPE,props:n,variant:"sink",valueType:"boolean"}),_o=d.z.object({channel:d.z.number()}),Wh=d.z.object({valid:d.z.boolean(),color:r.Zu.colorZ.optional(),authority:d.z.number()});class en extends j{static TYPE="controlled-status-source";prov;valid=!1;stopListening;controller;schema=_o;constructor(e,t,s){super(s),this.prov=t,this.controller=e}async needsControlOf(){return[]}maybeRevalidate(){if(this.valid)return;const{channel:e}=this.props;this.stopListening?.();const t=r._u.filterTransfersByChannelKey(e);this.stopListening=this.prov.onChange(s=>{t(s).length!==0&&this.notify?.()}),this.valid=!0}value(){this.maybeRevalidate();const e=g.w.now();if(this.props.channel===0)return{name:this.controller.key,key:this.controller.key,variant:"disabled",message:"No Channel",time:e,details:{valid:!1,authority:0}};const t=this.prov.get(this.props.channel);return t==null?{name:this.controller.key,key:this.controller.key,variant:"disabled",message:"Uncontrolled",time:e,details:{valid:!0,color:void 0,authority:0}}:{name:this.controller.key,key:t.subject.key,variant:t.subject.key===this.controller.key?"success":"error",message:`Controlled by ${t.subject.name}`,time:e,details:{valid:!0,color:t.subjectColor,authority:t.authority}}}cleanup(){this.controller.deleteTelem(this),this.stopListening?.()}}const Vh=n=>({type:en.TYPE,props:n,variant:"source",valueType:"status"}),ko=d.z.object({color:r.Zu.colorZ.optional()}).default({color:void 0}),Oo=d.z.object({statusSource:Ts.default(vs),colorSource:an.default(ut),status:r.ol.statusZ(ko),color:r.Zu.colorZ.optional()});class es extends g.Leaf{static TYPE="Indicator";schema=Oo;stopListeningStatus;stopListeningColor;afterUpdate(e){const{internal:t}=this,{statusSource:s,colorSource:i}=this.state;t.statusSource=$(e,s,t.statusSource),t.colorSource=$(e,i,t.colorSource),this.updateState(),this.stopListeningStatus?.(),this.stopListeningColor?.(),this.stopListeningStatus=t.statusSource.onChange(this.updateState.bind(this)),this.stopListeningColor=t.colorSource.onChange(this.updateState.bind(this))}afterDelete(){this.internal.statusSource.cleanup?.(),this.internal.colorSource.cleanup?.()}render(){}updateState(){const e=this.internal.colorSource.value(),t=this.internal.statusSource.value();r.Zu.equals(e,this.state.color)&&t.message===this.state.status.message||this.setState(s=>({...s,color:e,status:t}))}}const Io=d.z.object({needsControlOf:g.xA.keyZ.array(),states:Co.array()});class ts extends g.Leaf{static TYPE="Legend";schema=Io;afterUpdate(e){const{internal:t}=this;t.stateProv=at.use(e);const s=this.state.needsControlOf;t.disconnectStateProv?.();const i=r._u.filterTransfersByChannelKey(...s),o=t.stateProv.get(s);this.setState(a=>({...a,states:o})),t.disconnectStateProv=t.stateProv.onChange(a=>{if(i(a).length===0)return;const l=t.stateProv.get(s);this.setState(u=>({...u,states:l}))})}afterDelete(){const{internal:e}=this;e.disconnectStateProv?.()}render(){}}const Xh={[Jn.TYPE]:Jn,[at.TYPE]:at,[es.TYPE]:es,[Kn.TYPE]:Kn,[ts.TYPE]:ts},Mo=["fire","momentary","pulse"],Gh=d.z.enum(Mo),Zo=d.z.object({sink:on.default(rn),mode:Gh.default("fire")}),ns={onMouseDown:d.z.function({input:d.z.tuple([]),output:d.z.void()}),onMouseUp:d.z.function({input:d.z.tuple([]),output:d.z.void()})};class ss extends g.Leaf{static TYPE="Button";static METHODS=ns;schema=Zo;methods=ns;afterUpdate(e){const{sink:t}=this.state;this.internal.sink=Fe(e,t,this.internal.sink)}onMouseDown(){const{mode:e}=this.state;e==="momentary"?this.internal.sink.set(!0):e==="pulse"&&this.internal.sink.set(!0,!1)}onMouseUp(){const{mode:e}=this.state;e==="fire"?this.internal.sink.set(!0):e==="momentary"&&this.internal.sink.set(!1)}afterDelete(){this.internal.sink.cleanup?.()}}const Kh={[ss.TYPE]:ss},Qh=d.z.object({region:r.Eu.box,clearOverScan:r.Au.crudeZ.default(0),visible:d.z.boolean().default(!0),autoRenderInterval:d.z.number().default(1e3)}),Ir=["upper2d","lower2d"];class Ue extends g.Composite{static TYPE="Table";static stateZ=Qh;schema=Ue.stateZ;afterUpdate(e){const{internal:t}=this;t.renderCtx=Z.Context.use(e),t.handleError=g.useErrorHandler(e),t.autoRenderInterval??=setInterval(()=>this.state.visible&&this.requestRender("low"),this.state.autoRenderInterval),tn(e,()=>{this.state.visible&&this.requestRender("low")}),!(!this.state.visible&&!this.prevState.visible)&&this.requestRender("high")}afterDelete(){this.internal.autoRenderInterval!=null&&clearInterval(this.internal.autoRenderInterval),this.requestRender("high")}render(){if(this.deleted)return;const e=r.Eu.copy(this.state.region);if(!this.state.visible)return()=>this.internal.renderCtx.erase(e,this.state.clearOverScan);const{renderCtx:t,handleError:s}=this.internal,i=r.Tu.XY.translate(r.Eu.topLeft(this.state.region)),o=t.scissor(this.state.region,r.Au.construct(this.state.clearOverScan),Ir);try{for(const a of this.children)a.render({viewportScale:i})}catch(a){s(a,"Failed to render table")}finally{o()}return()=>this.internal.renderCtx.erase(e,this.state.clearOverScan)}requestRender(e){const{renderCtx:t}=this.internal;t.loop.set({key:`${Ue.TYPE}-${this.key}`,render:this.render.bind(this),priority:e,canvases:Ir})}}const Jh={[Ue.TYPE]:Ue};d.z.enum(["small","medium","large","huge"]);const ed=d.z.object({box:r.Eu.box,telem:ln.default(Ss),backgroundTelem:an.default(ut),level:pe.levelZ.default("p"),color:r.Zu.colorZ.default(r.Zu.ZERO),precision:d.z.number().default(2),minWidth:d.z.number().default(60),width:d.z.number().optional(),notation:r.Qu.notationZ.default("standard"),location:r.Mu.xy.default({x:"left",y:"center"}),units:d.z.string().default("RPM"),bounds:r.Iu.bounds.default(r.Iu.construct(0,100)),barWidth:d.z.number().default(12)}),td=["upper2d","lower2d"];class lt extends g.Leaf{static TYPE="gauge";static z=ed;schema=lt.z;afterUpdate(e){const{internal:t}=this;t.render=Z.Context.use(e),t.theme=g.use(e),r.Zu.isZero(this.state.color)?t.textColor=t.theme.colors.gray.l8:t.textColor=this.state.color,t.telem=$(e,this.state.telem,t.telem),t.stopListening?.(),t.stopListening=t.telem.onChange(()=>this.requestRender()),t.backgroundTelem=$(e,this.state.backgroundTelem,t.backgroundTelem),t.stopListeningBackground?.(),t.stopListeningBackground=t.backgroundTelem.onChange(()=>this.requestRender()),t.requestRender=gs(e),t.strokeColor=r.Zu.isZero(this.state.color)?t.theme.colors.visualization.palettes.default[0]:this.state.color;const s=this.state.box,i=r.Eu.width(s)/2,{barWidth:o}=this.state;t.outerRadius=i-8,t.innerRadius=t.outerRadius-o;const a=Math.PI/2;t.gaugeStartAngle=3*Math.PI/4,t.gaugeAngleRange=2*Math.PI-a,t.gaugeEndAngle=t.gaugeStartAngle+t.gaugeAngleRange,t.labelRadius=t.outerRadius+12,t.labelInwardShift=12,t.centerPos=r.Eu.center(s);const l=t.centerPos.y+t.labelRadius*Math.sin(t.gaugeStartAngle)+6;t.minLabelPos=r.Au.construct(t.centerPos.x+t.labelRadius*Math.cos(t.gaugeStartAngle)+t.labelInwardShift,l),t.maxLabelPos=r.Au.construct(t.centerPos.x+t.labelRadius*Math.cos(t.gaugeEndAngle)-t.labelInwardShift,l),t.valueTextPos=r.Au.translateY(t.centerPos,-6),t.unitsTextPos=r.Au.translateY(t.centerPos,r.Eu.height(s)/9),t.textLevel=this.state.level,t.labelLevel=pe.downLevel(pe.downLevel(t.textLevel)),this.requestRender()}afterDelete(){const{internal:e}=this;e.stopListening?.(),e.stopListeningBackground?.(),e.telem.cleanup?.(),e.backgroundTelem.cleanup?.(),e.requestRender==null?e.render.erase(r.Eu.construct(this.state.box),r.Au.ZERO,...td):e.requestRender("layout")}requestRender(){const{requestRender:e}=this.internal;e!=null?e("layout"):this.render({})}render({viewportScale:e=r.Tu.XY.IDENTITY}){const{internal:t}=this,s=t.render.upper2d.applyScale(e),i=new Te(s,t.theme),o=t.telem.value(),{lower:a,upper:l}=this.state.bounds,u=Number(o),c=r.Iu.clamp(this.state.bounds,u),h=l-a,f=h===0?0:(c-a)/h,p=t.gaugeStartAngle+f*t.gaugeAngleRange;i.text({text:o,position:t.valueTextPos,shade:10,level:t.textLevel,align:"middle",justify:"center",weight:450,code:!0,useAtlas:!0}),i.text({text:this.state.units,position:t.unitsTextPos,shade:8,level:pe.downLevel(t.textLevel),align:"middle",justify:"center",code:!0,useAtlas:!0}),i.text({text:a.toString(),position:t.minLabelPos,shade:7,level:t.labelLevel,align:"middle",justify:"center",code:!0,useAtlas:!0}),i.text({text:l.toString(),position:t.maxLabelPos,shade:7,level:t.labelLevel,align:"middle",justify:"center",code:!0,useAtlas:!0}),i.circle({stroke:t.theme.colors.gray.l5,radius:{inner:t.innerRadius,outer:t.outerRadius},position:t.centerPos,angle:{lower:t.gaugeStartAngle,upper:t.gaugeEndAngle},lineCap:"round"}),i.circle({stroke:t.strokeColor,radius:{inner:t.innerRadius,outer:t.outerRadius},position:t.centerPos,angle:{lower:t.gaugeStartAngle,upper:p},lineCap:"round"})}}const nd={[lt.TYPE]:lt},Do=d.z.object({sink:ti.default(Vr)}),rs={set:d.z.function({input:d.z.tuple([d.z.string()]),output:d.z.void()})};class is extends g.Leaf{static TYPE="Input";static METHODS=rs;schema=Do;methods=rs;afterUpdate(e){const{sink:t}=this.state;this.internal.sink=Fe(e,t,this.internal.sink)}set(e){this.internal.sink.set(e)}afterDelete(){this.internal.sink.cleanup?.()}}const sd={[is.TYPE]:is},No=d.z.object({enabled:d.z.boolean(),source:Es.default(bs)});class os extends g.Leaf{static TYPE="Light";schema=No;afterUpdate(e){const{internal:t}=this;this.internal.source=$(e,this.state.source,t.source),this.updateEnabledState(),t.stopListening?.(),t.stopListening=t.source.onChange(()=>this.updateEnabledState())}updateEnabledState(){const e=this.internal.source.value();e!==this.state.enabled&&this.setState(t=>({...t,enabled:e}))}afterDelete(){this.internal.stopListening?.(),this.internal.source.cleanup?.()}}const rd={[os.TYPE]:os},Yo=d.z.object({value:d.z.number(),sink:ei.default(jr),source:Jr.default(Wr)}),as={set:d.z.function({input:d.z.tuple([d.z.number()]),output:d.z.void()})};class ls extends g.Leaf{static TYPE="Setpoint";static METHODS=as;schema=Yo;methods=as;afterUpdate(e){const{sink:t,source:s}=this.state,{internal:i}=this;i.source=$(e,s,i.source),i.sink=Fe(e,t,i.sink),this.updateValue(),i.stopListening?.(),i.stopListening=i.source.onChange(()=>this.updateValue())}set(e){this.internal.sink.set(e)}updateValue(){const e=this.internal.source.value();e===this.state.value||isNaN(e)||this.setState(t=>({...t,value:e}))}afterDelete(){const{internal:e}=this;e.stopListening?.(),e.source.cleanup?.(),e.sink.cleanup?.()}}const id={[ls.TYPE]:ls},zo=d.z.object({enabled:d.z.boolean(),sink:on.default(rn),source:Es.default(bs)}),cs={toggle:d.z.function({input:d.z.tuple([]),output:d.z.void()})};class us extends g.Leaf{static TYPE="Toggle";static METHODS=cs;schema=zo;methods=cs;afterUpdate(e){this.internal.addStatus=g.useOptionalAdder(e);const{sink:t,source:s}=this.state,{internal:i}=this;i.source=$(e,s,i.source),i.sink=Fe(e,t,i.sink),this.updateEnabledState(),i.stopListening?.(),i.stopListening=i.source.onChange(()=>this.updateEnabledState())}toggle(){const{enabled:e}=this.state;this.internal.sink.set(!e)}updateEnabledState(){const e=this.internal.source.value();e!==this.state.enabled&&this.setState(t=>({...t,enabled:e}))}afterDelete(){this.internal.stopListening?.(),this.internal.source.cleanup?.(),this.internal.sink.cleanup?.()}}const od={[us.TYPE]:us},Ln={useAtlas:!0},ad=d.z.object({box:r.Eu.box,telem:ln.default(Ss),backgroundTelem:an.default(ut),level:pe.levelZ.default("p"),color:r.Zu.colorZ.default(r.Zu.ZERO),precision:d.z.number().default(2),stalenessTimeout:d.z.number().default(5),stalenessColor:r.Zu.colorZ.default(r.Zu.ZERO),minWidth:d.z.number().default(60),width:d.z.number().optional(),notation:r.Qu.notationZ.default("standard"),location:r.Mu.xy.default({x:"left",y:"center"}),useWidthForBackground:d.z.boolean().default(!1),valueBackgroundShift:r.Au.xy.default(r.Au.ZERO),valueBackgroundOverScan:r.Au.xy.default(r.Au.ZERO)}),ld=["upper2d","lower2d"];class Be extends g.Leaf{static TYPE="value";static z=ad;schema=Be.z;afterUpdate(e){const{internal:t}=this;t.renderCtx=Z.Context.use(e),t.theme=g.use(e),t.telem=$(e,this.state.telem,t.telem),t.stopListening?.(),t.stopListening=t.telem.onChange(()=>{t.lastReceived=performance.now(),this.requestRender()}),t.fontString=Ke.fontString(t.theme,{level:this.state.level,code:!0}),t.backgroundTelem=$(e,this.state.backgroundTelem,t.backgroundTelem),t.stopListeningBackground?.(),t.stopListeningBackground=t.backgroundTelem.onChange(()=>this.requestRender()),t.requestRender=gs(e),this.requestRender()}afterDelete(){const{internal:e}=this;e.stopListening?.(),e.stopListeningBackground?.(),e.telem.cleanup?.(),e.backgroundTelem.cleanup?.(),e.requestRender==null?e.renderCtx.erase(r.Eu.construct(this.state.box),r.Au.ZERO,...ld):e.requestRender("layout")}requestRender(){const{requestRender:e}=this.internal;e!=null?e("layout"):this.render({})}get fontHeight(){const{theme:e}=this.internal;return e.typography[this.state.level].size*e.sizes.base}maybeUpdateWidth(e){const{theme:t}=this.internal,s=e+t.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(i=>({...i,width:Math.max(s,i.minWidth)})):this.state.width-this.fontHeight>s&&this.setState(i=>({...i,width:Math.max(s,i.minWidth)}))}getTextColor(){const{theme:e}=this.internal;return performance.now()-this.internal.lastReceived>this.state.stalenessTimeout*1e3?r.Zu.isZero(this.state.stalenessColor)?e.colors.warning.m1:this.state.stalenessColor:r.Zu.isZero(this.state.color)?r.Zu.pickByContrast(e.colors.border,e.colors.gray.l11,e.colors.gray.l0):r.Zu.pickByContrast(e.colors.border,e.colors.gray.l11,this.state.color)}render({viewportScale:e=r.Tu.XY.IDENTITY}){const{renderCtx:t,telem:s,backgroundTelem:i,fontString:o,requestRender:a}=this.internal,{location:l,box:u}=this.state;if(r.Eu.areaIsZero(u))return;const c=r.Eu.topLeft(u),h=r.Eu.width(u),f=r.Eu.height(u),p=t.lower2d.applyScale(e);let y=s.value();p.font=o;const S=this.fontHeight,b=y[0]=="-";b&&(y=y.slice(1));const{theme:E}=this.internal,x=p.textDimensions(y,Ln),A=x.width+E.sizes.base,C=x.height;a==null&&t.erase(r.Eu.construct(this.prevState.box)),this.maybeUpdateWidth(A);const P={...r.Au.ZERO};l.x==="left"?P.x=6+S*.75:l.x==="center"&&(P.x=h/2-A/2),l.y==="center"&&(P.y=f/2+C/2);const O=r.Au.translate(c,P);if(this.state.backgroundTelem.type!=ut.type){const k=i.value();if(!r.Zu.isZero(k)){p.fillStyle=r.Zu.hex(k);const G=this.state.useWidthForBackground?this.state.width??this.state.minWidth:r.Eu.width(u);p.fillRect(...r.Au.couple(r.Au.translate(c,this.state.valueBackgroundShift)),G+this.state.valueBackgroundOverScan.x,f+this.state.valueBackgroundOverScan.y)}}const T=this.getTextColor();p.fillStyle=r.Zu.hex(T),b&&p.fillText("-",...r.Au.couple(r.Au.translateX(O,-S*.6)),void 0,Ln),p.fillText(y,...r.Au.couple(O),void 0,Ln)}}const Uo={[Be.TYPE]:Be},cd=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:Uo,Value:Be},Symbol.toStringTag,{value:"Module"}));exports.AcquireChannelControl=Jt;exports.AuthoritySource=en;exports.Base=Ee;exports.Bottom=io;exports.Button=ss;exports.Canvas=$t;exports.Chip=Kn;exports.Client=Dr;exports.Controller=Jn;exports.Diagram=Yl;exports.Diagram$1=me;exports.FLUX_STORE_CONFIG=Uh;exports.FLUX_STORE_CONFIG$1=aa;exports.FLUX_STORE_CONFIG$2=qh;exports.FLUX_STORE_KEY=Nh;exports.FLUX_STORE_KEY$1=ra;exports.FLUX_STORE_KEY$2=Bh;exports.Gauge=lt;exports.Indicator=es;exports.Input=is;exports.Legend=ts;exports.Light=os;exports.Line=Bt;exports.LinePlot=Gn;exports.Log=ot;exports.MODES=Mo;exports.Measure=it;exports.PROVIDER_TYPE=fs;exports.PROVIDER_TYPE$1=dn;exports.Provider=At;exports.Provider$1=Gt;exports.REGISTRY=Ih;exports.REGISTRY$1=nd;exports.REGISTRY$10=po;exports.REGISTRY$11=th;exports.REGISTRY$12=bo;exports.REGISTRY$13=Il;exports.REGISTRY$14=rd;exports.REGISTRY$15=sd;exports.REGISTRY$16=Fi;exports.REGISTRY$17=Xh;exports.REGISTRY$18=$i;exports.REGISTRY$19=Kh;exports.REGISTRY$2=Jh;exports.REGISTRY$3=Dh;exports.REGISTRY$4=Uo;exports.REGISTRY$5=mo;exports.REGISTRY$6=od;exports.REGISTRY$7=Ui;exports.REGISTRY$8=Yr;exports.REGISTRY$9=id;exports.RELATIONSHIPS_FLUX_STORE_KEY=Go;exports.RELATIONSHIP_FLUX_STORE_CONFIG=ea;exports.RESOURCES_FLUX_STORE_KEY=Ko;exports.RESOURCE_FLUX_STORE_CONFIG=sa;exports.Right=ao;exports.Rule=st;exports.ScopedUnaryStore=Mr;exports.SetChannelValue=Qt;exports.Setpoint=ls;exports.StateProvider=at;exports.Table=Ue;exports.Toggle=us;exports.Tooltip=rt;exports.Top=oo;exports.Value=Be;exports.XAxis=Kt;exports.YAxis=Xt;exports.ZERO_CONTEXT_VALUE=hs;exports.acquireChannelControl=jh;exports.acquireChannelControlPropsZ=Lo;exports.aether=Gu;exports.authoritySource=Vh;exports.authoritySourceDetailsZ=Wh;exports.authoritySourceProps=_o;exports.axisStateZ=js;exports.baseAxisStateZ=mt;exports.buttonMethodsZ=ns;exports.buttonStateZ=Zo;exports.cachedRetrieveForSubject=Br;exports.canvas=Nl;exports.canvasStateZ=Zs;exports.channelData=li;exports.chipStateZ=wo;exports.chipStatusDetailsZ=To;exports.color=Le;exports.colorGradient=xi;exports.control=tn;exports.controllerMethodsZ=Qn;exports.controllerStateZ=Ao;exports.createRegistry=Xo;exports.createStore=Zr;exports.diagramStateZ=Ds;exports.external=El;exports.indicatorStateZ=Oo;exports.indicatorStatusDetailsZ=ko;exports.interpolate=sn;exports.interpolateNumber=et;exports.interpolateRgb=In;exports.interpolateString=Hr;exports.legendStateZ=Io;exports.linePlotMethodsZ=vo;exports.linePlotStateZ=So;exports.logState=Eo;exports.measure=Ph;exports.measureStateZ=Xs;exports.methodsZ=rs;exports.methodsZ$1=as;exports.newCanvas=ro;exports.newTickFactory=Vn;exports.parseAutoBounds=fo;exports.partialUpdate=$o;exports.provider=jo;exports.providerStateZ=zr;exports.providerStateZ$1=go;exports.providerStateZ$2=Ms;exports.regions=fe;exports.request=ie;exports.retrieveForSubject=la;exports.rollingAverage=Ti;exports.rollingAverageProps=ks;exports.ruleStateZ=Ws;exports.scaleNumber=Ri;exports.scopeStore=_n;exports.setChannelValue=Hh;exports.setChannelValuePropsZ=Po;exports.setpoint=yi;exports.sinkPipeline=ii;exports.sinkPipelinePropsZ=Rs;exports.sourcePipeline=ri;exports.sourcePipelinePropsZ=xs;exports.stateProviderStateZ=xo;exports.stateZ=Bi;exports.stateZ$1=Do;exports.stateZ$2=No;exports.stateZ$3=Yo;exports.statusZ=Ro;exports.streamChannelData=ci;exports.streamChannelValue=ui;exports.streamChannelValuePropsZ=As;exports.stringSourceSpecZ=ln;exports.stringifyNumber=Ei;exports.stringifyNumberProps=_s;exports.sugaredStateZ=Co;exports.tickFactoryProps=Hs;exports.tickType=qs;exports.toggleMethodsZ=cs;exports.toggleStateZ=zo;exports.tooltip=ah;exports.tooltipStateZ=Vs;exports.useOptionalRequestor=gs;exports.useRequestor=nn;exports.value=cd;exports.withinBounds=bi;exports.withinBoundsProps=Ls;exports.withinSizeThreshold=co;exports.xAxisStateZ=nh;exports.yAxisStateZ=Ku;
|
package/dist/video.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Video-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Video-CBPTBLTB.cjs");exports.Video=e.Video;
|
package/dist/video.js
CHANGED
package/package.json
CHANGED
|
@@ -1,55 +1,57 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synnaxlabs/pluto",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@fontsource-variable/inter": "^5.2.8",
|
|
7
7
|
"@fontsource/geist-mono": "^5.2.7",
|
|
8
8
|
"@fontsource/inter": "^5.2.8",
|
|
9
9
|
"@tanstack/react-virtual": "3.13.6",
|
|
10
|
-
"@xyflow/react": "^12.
|
|
10
|
+
"@xyflow/react": "^12.10.0",
|
|
11
11
|
"async-mutex": "^0.5.0",
|
|
12
12
|
"clsx": "^2.1.1",
|
|
13
|
-
"compromise": "^14.14.
|
|
13
|
+
"compromise": "^14.14.5",
|
|
14
14
|
"compromise-dates": "^3.7.1",
|
|
15
15
|
"d3-scale": "^4.0.2",
|
|
16
16
|
"fuse.js": "^7.1.0",
|
|
17
17
|
"mathjs": "^15.1.0",
|
|
18
18
|
"pluralize": "^8.0.0",
|
|
19
19
|
"proxy-memoize": "2.0.3",
|
|
20
|
-
"react": "^19.2.
|
|
20
|
+
"react": "^19.2.3",
|
|
21
21
|
"react-color": "^2.19.3",
|
|
22
|
-
"react-icons": "
|
|
23
|
-
"zod": "^4.1.
|
|
24
|
-
"@synnaxlabs/
|
|
25
|
-
"@synnaxlabs/
|
|
26
|
-
"@synnaxlabs/
|
|
27
|
-
"@synnaxlabs/x": "^0.
|
|
22
|
+
"react-icons": "5.5.0",
|
|
23
|
+
"zod": "^4.1.13",
|
|
24
|
+
"@synnaxlabs/alamos": "^0.50.0",
|
|
25
|
+
"@synnaxlabs/client": "^0.50.0",
|
|
26
|
+
"@synnaxlabs/freighter": "0.50.0",
|
|
27
|
+
"@synnaxlabs/x": "^0.50.0",
|
|
28
|
+
"@synnaxlabs/media": "0.50.0"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@juggle/resize-observer": "^3.4.0",
|
|
31
32
|
"@testing-library/react": "^16.3.0",
|
|
32
33
|
"@testing-library/user-event": "^14.6.1",
|
|
33
34
|
"@types/d3-scale": "^4.0.9",
|
|
35
|
+
"@types/node": "^25.0.2",
|
|
34
36
|
"@types/offscreencanvas": "^2019.7.3",
|
|
35
37
|
"@types/pluralize": "^0.0.33",
|
|
36
|
-
"@types/react": "^19.2.
|
|
38
|
+
"@types/react": "^19.2.7",
|
|
37
39
|
"@types/react-color": "^3.0.13",
|
|
38
|
-
"@types/react-dom": "^19.2.
|
|
39
|
-
"@types/webgl2": "^0.0.
|
|
40
|
-
"@vitejs/plugin-react": "^5.1.
|
|
40
|
+
"@types/react-dom": "^19.2.3",
|
|
41
|
+
"@types/webgl2": "^0.0.12",
|
|
42
|
+
"@vitejs/plugin-react": "^5.1.2",
|
|
41
43
|
"@vitest/coverage-v8": "^3.2.4",
|
|
42
|
-
"eslint": "^9.39.
|
|
43
|
-
"jsdom": "^27.
|
|
44
|
+
"eslint": "^9.39.2",
|
|
45
|
+
"jsdom": "^27.3.0",
|
|
44
46
|
"madge": "^8.0.0",
|
|
45
|
-
"react-dom": "^19.2.
|
|
46
|
-
"typescript": "
|
|
47
|
-
"vite": "^7.
|
|
47
|
+
"react-dom": "^19.2.3",
|
|
48
|
+
"typescript": "5.9.3",
|
|
49
|
+
"vite": "^7.2.7",
|
|
48
50
|
"vitest": "^3.2.4",
|
|
49
|
-
"@synnaxlabs/tsconfig": "^0.
|
|
50
|
-
"@synnaxlabs/vite-plugin": "^0.
|
|
51
|
-
"
|
|
52
|
-
"
|
|
51
|
+
"@synnaxlabs/tsconfig": "^0.50.0",
|
|
52
|
+
"@synnaxlabs/vite-plugin": "^0.50.0",
|
|
53
|
+
"stylelint-config-synnaxlabs": "^0.50.0",
|
|
54
|
+
"eslint-config-synnaxlabs": "^0.50.0"
|
|
53
55
|
},
|
|
54
56
|
"files": [
|
|
55
57
|
"dist"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const q=require("./jsx-runtime-nZSsnGb7.cjs"),e=require("./css-BVgFAmaj.cjs"),d=require("react"),P=require("./Text-DeWvfrdF.cjs"),J=require("./Box-4l6DWG-3.cjs"),L=require("./Editable-DI0-D1K5.cjs"),de=require("./hooks-CRSphXSb.cjs"),fe=require("./types-8-Mr79SF.cjs");require("./Provider-DBg-Li_7.cjs");const Q=({ref:t,onClickOutside:n,exclude:o})=>{const g=L.useSyncedRef(o),r=d.useCallback(i=>{const s=t.current,c=e.vu.construct(window.document.documentElement),a=e.Nu.construct(i),u=g.current;if(u!=null){if(typeof u=="function"){if(u(i))return}else if(u.some(l=>l.current?.contains(i.target)))return}s==null||s.contains(i.target)||e.vu.contains(s,a)||!e.vu.contains(c,a)||n()},[n]);d.useEffect(()=>(document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)),[r])},z=(t,n={})=>{const{triggers:o=[],debounce:g=0,enabled:r=!0}=n,i=d.useRef(e.vu.ZERO),s=d.useRef(null),c=d.useRef(null),a=P.useMemoCompare(()=>o,P.compareArrayDeps,[o]),u=d.useCallback(l=>{c.current!=null&&c.current.disconnect(),i.current??=e.vu.ZERO;const C=e.Zu(()=>{const f=e.vu.construct(l);ge(a,i.current,f)&&(i.current=f,t(f,s.current))},g);c.current=new ResizeObserver(C),c.current.observe(l)},[a,t,g]);return d.useEffect(()=>(s.current!=null&&r&&u(s.current),()=>c.current?.disconnect()),[u,r]),d.useCallback(l=>{s.current=l,l!=null&&r&&u(l)},[u])},ge=(t,n,o)=>t.length===0?!e.vu.equals(o,n):!!(t.includes("x")&&e.vu.width(n)!==e.vu.width(o)||t.includes("y")&&e.vu.height(n)!==e.vu.height(o)),ee=t=>{const n=L.useSyncedRef(t);d.useEffect(()=>{const o=()=>n.current(e.vu.construct(window.innerWidth,window.innerHeight),window.document.documentElement);return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[])},X=e.CSS.BE("dialog","bg"),Ce=({children:t,visible:n,...o})=>q.jsxRuntimeExports.jsx(J.Box$1,{className:e.CSS(X,e.CSS.visible(n)),empty:!0,align:"center",...o,children:t}),O=t=>t==null?{x:void 0,y:void 0}:typeof t!="string"?t:e.xu.isX(t)?{x:t,y:void 0}:{x:void 0,y:t},j=t=>typeof t=="string"||"x"in t||"y"in t?{targetCorner:t,dialogCorner:void 0}:t,Ee=({initial:t,prefer:n=[],disable:o=[]})=>{const g=e.lu.toArray(n).map(j),r=e.lu.toArray(o).map(j),i=[];if(t!=null){const s=j(t),c=O(s.targetCorner),a=O(s.dialogCorner);e.Iu.XY_LOCATIONS.forEach(l=>{e.Iu.xyEquals(l,e.Iu.CENTER)||c.x!=null&&l.x!==c.x||c.y!=null&&l.y!==c.y||e.Iu.XY_LOCATIONS.forEach(C=>{if(e.Iu.xyEquals(C,e.Iu.CENTER)||a.x!=null&&C.x!==a.x||a.y!=null&&C.y!==a.y)return;const f={targetCorner:l,dialogCorner:C};i.push(f)})});const u=i.filter(l=>!F(l,r));return u.length==0?i.slice(0,1):u}return g.forEach(s=>{const c=O(s.targetCorner),a=O(s.dialogCorner);e.Iu.XY_LOCATIONS.forEach(u=>{e.Iu.xyEquals(u,e.Iu.CENTER)||e.Iu.xyMatches(u,c)&&e.Iu.XY_LOCATIONS.forEach(l=>{if(e.Iu.xyEquals(l,e.Iu.CENTER)||!e.Iu.xyMatches(l,a))return;const C={targetCorner:u,dialogCorner:l};!F(C,r)&&!i.some(f=>e.Iu.xyEquals(f.targetCorner,u)&&e.Iu.xyEquals(f.dialogCorner,l))&&i.push(C)})})}),e.Iu.XY_LOCATIONS.forEach(s=>{e.Iu.xyEquals(s,e.Iu.CENTER)||e.Iu.XY_LOCATIONS.forEach(c=>{if(e.Iu.xyEquals(c,e.Iu.CENTER))return;const a={targetCorner:s,dialogCorner:c};!F(a,r)&&!i.some(u=>e.Iu.xyEquals(u.targetCorner,s)&&e.Iu.xyEquals(u.dialogCorner,c))&&i.push(a)})}),i},F=(t,n)=>n.some(o=>{const g=O(o.targetCorner),r=O(o.dialogCorner);return e.Iu.xyEquals(o.dialogCorner,e.Iu.CENTER)?e.Iu.xyMatches(t.targetCorner,g):e.Iu.xyMatches(t.targetCorner,g)&&e.Iu.xyMatches(t.dialogCorner,r)}),te=({container:t,target:n,dialog:o,initial:g,prefer:r,disable:i,offset:s})=>{const c=Ee({initial:g,prefer:r,disable:i}),a=e.vu.construct(t),u=e.vu.construct(n),l=e.vu.construct(o),C=c.reduce((f,x)=>{const T=me({...x,container:a,target:u,dialog:l,offset:s});return T.area>f.area?T:f},{area:-1/0,targetCorner:e.Iu.CENTER,dialogCorner:e.Iu.CENTER,adjustedDialog:l});return{targetCorner:C.targetCorner,dialogCorner:C.dialogCorner,adjustedDialog:C.adjustedDialog}},me=({targetCorner:t,dialogCorner:n,container:o,target:g,dialog:r,offset:i})=>{let s=e.vu.xyLoc(g,t);if(i!=null){const u=e.Nu.construct(i);t.x===n.x&&(u.x=0),t.y===n.y&&(u.y=0),s=e.Nu.translate(s,t,u)}const c=e.vu.constructWithAlternateRoot(s.x,s.y,e.vu.width(r),e.vu.height(r),n,e.Iu.TOP_LEFT);let a=e.vu.area(e.vu.intersection(c,o));return e.vu.area(e.vu.intersection(g,c))!==0&&(a=0),{targetCorner:t,dialogCorner:n,adjustedDialog:c,area:a}},xe=e.CSS.BM("context","selected"),Te=e.CSS.BE("context","target"),ne=e.CSS.B("menu-context"),Ie={targetCorner:e.Iu.BOTTOM_LEFT,dialogCorner:e.Iu.BOTTOM_LEFT,style:{},modalPosition:"base"},[he,ve]=P.create({defaultValue:{close:()=>{},location:e.Iu.BOTTOM_LEFT,open:()=>{},toggle:()=>{},variant:"floating",visible:!1},displayName:"Dialog.Context"}),[ye,Re]=P.create({displayName:"Dialog.InternalContext",providerName:"Dialog.Frame"}),Se=[["Escape"]],Oe=(t,n,o)=>{if(o==null)return!1;const r=Math.abs(e.vu.left(n)-e.vu.left(o))<=1&&Math.abs(e.vu.top(n)-e.vu.top(o))<=1;if(t==="floating")return r;const i=Math.abs(e.vu.width(n)-e.vu.width(o))<=1;return r&&i},K=[{targetCorner:e.Iu.BOTTOM_LEFT,dialogCorner:e.Iu.TOP_LEFT},{targetCorner:e.Iu.TOP_LEFT,dialogCorner:e.Iu.BOTTOM_LEFT},{targetCorner:e.Iu.BOTTOM_RIGHT,dialogCorner:e.Iu.TOP_RIGHT},{targetCorner:e.Iu.TOP_RIGHT,dialogCorner:e.Iu.BOTTOM_RIGHT},{targetCorner:e.Iu.TOP_RIGHT,dialogCorner:e.Iu.TOP_LEFT}],be=(t,n)=>t/n>.8?"slammed":t/n>.6?"shifted":"base",re=({children:t,location:n,onPointerEnter:o,className:g,variant:r="floating",maxHeight:i,zIndex:s,initialVisible:c=!1,visible:a,onVisibleChange:u,modalPosition:l="base",...C})=>{const[f,x]=fe.usePassthrough({initial:c,value:a,onChange:u}),T=d.useCallback(()=>x(!1),[x]),G=d.useCallback(()=>x(!0),[x]),H=d.useCallback(()=>x(E=>!E),[x]),w=L.useSyncedRef(f),p=d.useRef(null),A=d.useRef(void 0),Y=d.useRef(void 0),I=d.useRef(null),[{targetCorner:v,dialogCorner:B,style:V,modalPosition:W},Z]=d.useState({...Ie,modalPosition:l}),D=d.useCallback(()=>{if(p.current==null||I.current==null||!w.current)return;const E=e.vu.construct(p.current);if(e.vu.areaIsZero(E)&&r!=="modal")return x(!1);let m=e.vu.construct(I.current);r==="connected"&&(m=e.vu.resize(m,"x",e.vu.width(E)));const y=e.vu.construct(0,0,window.innerWidth,window.innerHeight);if(r==="modal"){const M=be(e.vu.height(m),e.vu.height(y));return Z(k=>M===k.modalPosition?k:{...k,modalPosition:M})}let R=K;A.current!=null&&(R=[A.current,...K]);const{adjustedDialog:h,...N}=te({target:E,dialog:m,container:y,prefer:R,initial:n,offset:3});A.current=N;const{targetCorner:_,dialogCorner:$}=N,b=e.vu.round(h);if(Oe(r,b,Y.current))return;Y.current=b;const S={};S.left=e.vu.left(b),_.y==="top"&&$.x===_.x?S.bottom=e.vu.height(y)-e.vu.bottom(b):S.top=e.vu.top(b),r==="connected"&&(S.width=e.vu.width(b)),typeof i=="number"&&(S.maxHeight=i),f&&(S.zIndex=s),Z(M=>({...M,targetCorner:_,dialogCorner:$,style:S}))},[n,r]),oe=z(D,{enabled:f}),U=L.useCombinedRefs(I,oe),se=z(D,{enabled:f}),ue=L.useCombinedRefs(p,se);ee(D);const ie=d.useCallback(E=>{if(!w.current||I.current==null||p.current==null)return!0;if(r!=="modal"){const R=I.current.getElementsByClassName(e.CSS.visible(!0));let h=R!=null&&R.length>0;return h||(h=p.current.contains(E.target)),document.getElementsByClassName(ne).length>0&&(h=!0),h||E.stopImmediatePropagation(),h}if(!(E.target instanceof HTMLElement))return!0;let m=E.target;return m.className.includes(X)&&(m=m.children[0]),m!==I.current},[s,w]),ce=d.useCallback(({stage:E})=>{if(E!=="start"||w.current===!1||I.current==null)return;if(r!=="modal")return T();const m=I.current,y=Array.from(document.getElementsByClassName(X)),R=y.findIndex(N=>N.contains(m)),h=m.getElementsByClassName(e.CSS.visible(!0));if(R===y.length-1&&h.length===0)return T()},[T,r]);Q({ref:I,exclude:ie,onClickOutside:T}),de.use({triggers:Se,callback:ce,loose:!0});const le=d.useMemo(()=>({ref:U,targetCorner:v,dialogCorner:B,style:V,modalPosition:W}),[U,v,B,V,W]),ae=d.useMemo(()=>({close:T,open:G,toggle:H,visible:f,onPointerEnter:o,variant:r,location:v}),[T,G,H,f,v]);return q.jsxRuntimeExports.jsx(he,{value:ae,children:q.jsxRuntimeExports.jsx(ye,{value:le,children:q.jsxRuntimeExports.jsx(J.Box$1,{...C,ref:ue,className:e.CSS(g,e.CSS.BE("dialog","frame"),e.CSS.visible(f),e.CSS.M(r),e.CSS.loc(v.x),e.CSS.loc(v.y),e.CSS.BEM("dialog","dialog",B.x),e.CSS.BEM("dialog","dialog",B.y)),y:!0,reverse:v.y==="top",children:t})})})};re.displayName="Dialog.Frame";exports.Background=Ce;exports.CONTEXT_MENU_CLASS=ne;exports.CONTEXT_SELECTED=xe;exports.CONTEXT_TARGET=Te;exports.Frame=re;exports.parseLocationOptions=O;exports.position=te;exports.useClickOutside=Q;exports.useContext=ve;exports.useInternalContext=Re;exports.useResize=z;exports.useWindowResize=ee;
|
package/dist/Button-D5aoG3sV.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const f=require("./jsx-runtime-nZSsnGb7.cjs"),e=require("./css-BVgFAmaj.cjs"),l=require("react"),V=require("./Text-DeWvfrdF.cjs"),D=require("./Editable-DI0-D1K5.cjs"),F=require("./types-8-Mr79SF.cjs"),te=require("./Provider-DBg-Li_7.cjs");require("./provider-DHDqgF1B.cjs");const ne=require("react-dom"),oe=require("./hooks-CRSphXSb.cjs"),[se,U]=V.create({defaultValue:{delay:e.g.milliseconds(750),startAccelerating:()=>{}},displayName:"Tooltip.Context"}),re=({delay:t=e.g.milliseconds(700),accelerate:n=!0,acceleratedDelay:s=e.g.minutes(60),accelerationDelay:u=e.g.seconds(0),children:i})=>{const[c,o]=l.useState(!1),a=l.useRef(null),E=l.useCallback(()=>{c||!n||(o(!0),a.current=setTimeout(()=>{o(!1)},new e.g(u).milliseconds))},[c,u]),g=l.useMemo(()=>c?s:t,[c,s,t]),h=l.useMemo(()=>({delay:g,startAccelerating:E}),[g,E]);return f.jsxRuntimeExports.jsx(se,{value:h,children:i})},ue=t=>({key:n,...s})=>l.createElement(t,{...s,key:n}),$=t=>typeof t=="function",le=150,G=["top","bottom"],Q=["left","right"],W=[...Q,...G],Y=[...W,"center"],ce={[e.Iu.xyToString(e.Iu.TOP_RIGHT)]:(t,n)=>e.Nu.translate(t,"x",-e.vu.width(n)),[e.Iu.xyToString(e.Iu.TOP_LEFT)]:(t,n)=>e.Nu.translate(t,"x",e.vu.width(n)),[e.Iu.xyToString(e.Iu.BOTTOM_RIGHT)]:(t,n)=>e.Nu.translate(t,"x",-e.vu.width(n)),[e.Iu.xyToString(e.Iu.BOTTOM_LEFT)]:(t,n)=>e.Nu.translate(t,"x",e.vu.width(n))},Z=(t,n,s)=>{for(const u of s)if(Math.abs(e.vu.loc(n,u)-e.vu.loc(t,u))>le)return u;return s[0]},J=(t,n,s)=>{const u=e.Iu.location.safeParse(t),i=o=>{let a;return o==="center"?a=W:e.Iu.isX(o)?a=["center",...G]:a=["center",...Q],e.Iu.construct(Z(n,s,a))};if(u.success)return e.Iu.constructXY(u.data,i(u.data));if(t!=null){const o={...t};return o.x==null&&o.y!=null?o.x=i(e.Iu.construct(o.y)):o.y==null&&o.x!=null?o.y=i(e.Iu.construct(o.x)):o.x==null&&o.y==null&&(o.x=Z(n,s,Y),o.y=i(e.Iu.construct(o.x))),e.Iu.constructXY(o)}const c=Z(n,s,Y);return e.Iu.constructXY(c,i(c))},ie=(t,n)=>{let s=t;for(;s!=null;){if(s.id===n)return s;s=s.parentElement}return t},K=({delay:t,children:n,location:s,hide:u=!1})=>{const{startAccelerating:i,delay:c}=U(),o=new e.g(t??c),[a,E,g]=D.useCombinedStateAndRef(null),[h,T]=l.useState(""),v=l.useRef(null),w=l.useId(),x=l.useRef(null),R=l.useRef(null),m=l.useCallback(r=>{r==null&&g.current==null||R.current!=null||(r!=null?(E(r),R.current=setTimeout(()=>{T(e.CSS.M("loaded")),R.current=null},1)):(T(""),R.current=setTimeout(()=>{E(null),R.current=null},500)))},[]),p=l.useCallback((r,k)=>{if(!k||u)return x.current?.(),m(null);i();const d=e.vu.construct(ie(r.target,w));e.vu.contains(d,e.Nu.construct(r))||(x.current?.(),m(null));const y=e.vu.construct(document.documentElement),L=J(s,d,y);let C=e.vu.xyLoc(d,L);const _=ce[e.Iu.xyToString(L)];_!=null&&(C=_(C,d));const N=e.vu.construct(document.body);m({location:L,position:e.Nu.translate(C,e.Nu.scale(e.vu.topLeft(N),-1)),triggerDims:e.vu.dims(d)}),x.current?.();const I=A=>{const B=e.Nu.construct(A);e.vu.contains(d,B)||(m(null),document.removeEventListener("mousemove",I),x.current=null,v.current!=null&&clearTimeout(v.current))};document.addEventListener("mousemove",I),x.current=()=>document.removeEventListener("mousemove",I),document.addEventListener("mousedown",()=>{m(null),x.current?.()},{once:!0})},[i,s,u,w,o.milliseconds]);u&&a!=null&&m(null);const j=l.useCallback(r=>{v.current=setTimeout(()=>p(r,!0),o.milliseconds)},[p,o.milliseconds]),O=l.useCallback(r=>{v.current!=null&&clearTimeout(v.current),p(r,!1)},[p]),[P,M]=n,q=document.body;return f.jsxRuntimeExports.jsxs(f.jsxRuntimeExports.Fragment,{children:[a!=null&&ne.createPortal(f.jsxRuntimeExports.jsx("div",{className:e.CSS(e.CSS.B("tooltip"),e.CSS.loc(a.location.x),e.CSS.loc(a.location.y),h),style:{[e.CSS.var("pos-x")]:e.CSS.px(a.position.x),[e.CSS.var("pos-y")]:e.CSS.px(a.position.y)},children:$(P)?P(a):z(P)},w),q),l.cloneElement(M,{onMouseEnter:r=>{j(r),M.props.onMouseEnter?.(r)},onMouseLeave:r=>{O(r),M.props.onMouseLeave?.(r)},onMouseDown:l.useCallback(r=>{O(r),M.props.onMouseDown?.(r)},[p])})]})},z=t=>typeof t=="string"||typeof t=="number"||!l.isValidElement(t)?f.jsxRuntimeExports.jsx(D.Text,{level:"small",color:11,children:t}):t,ee=t=>{const n=({tooltipDelay:s,tooltip:u,tooltipLocation:i,...c})=>{const o=f.jsxRuntimeExports.jsx(t,{...c});return u==null?o:f.jsxRuntimeExports.jsxs(K,{delay:s,location:i,children:[u,o]})};return n.displayName=`Tooltip.Wrap(${t.displayName??t.name})`,n},b="btn",ae=(t,n)=>{if(t===!0)return n;if(t!=null&&t!==!1)return t},de=({size:t,variant:n="outlined",className:s,disabled:u,preventClick:i,level:c,trigger:o,triggerIndicator:a,onClickDelay:E=0,onClick:g,color:h,status:T,style:v,onMouseDown:w,textColor:x,textVariant:R,tabIndex:m,contrast:p,children:j,defaultEl:O="button",el:P,ghost:M,propagateClick:q=!1,href:r,...k})=>{const d=e.g.fromMilliseconds(E),y=u===!0||T==="loading"||T==="disabled";n==="preview"&&(i=!0),(u||i&&m==null)&&(m=-1);const L=S=>{if(q||S.stopPropagation(),!(y||n==="preview"||i===!0)&&d.isZero)return g?.(S)},C=l.useRef(null),_=S=>{m==-1&&S.preventDefault(),w?.(S),!(y||n==="preview"||d.isZero)&&(document.addEventListener("mouseup",()=>C.current!=null&&clearTimeout(C.current)),C.current=setTimeout(()=>{g?.(S),C.current=null},d.milliseconds))};oe.use({triggers:o,callback:l.useCallback(({stage:S})=>{S!=="end"||y||n==="preview"||L(new MouseEvent("click"))},[L,y])});let N=v;const I=e.Pu.colorZ.safeParse(h),A=I.success&&(n==="filled"||n==="outlined");if(A){const S=te.use();N={...N,[e.CSS.var("btn-color")]:e.Pu.rgbString(I.data),[e.CSS.var("btn-text-color")]:e.Pu.rgbCSS(e.Pu.pickByContrast(I.data,S.colors.text,S.colors.textInverted))}}d.isZero||(N={...N,[e.CSS.var("btn-delay")]:`${d.seconds.toString()}s`}),t==null&&c!=null?t=F.LEVEL_COMPONENT_SIZES[c]:t!=null&&c==null?c=F.COMPONENT_SIZE_LEVELS[t]:O!=="div"&&(t??="medium"),c??="p";const B=T==="loading",X=D.isSquare(j),H=ae(a,o);return f.jsxRuntimeExports.jsxs(D.Text,{el:P,defaultEl:O,direction:"x",className:e.CSS(e.CSS.B(b),p!=null&&e.CSS.BM(b,`contrast-${p}`),i===!0&&e.CSS.BM(b,"prevent-click"),n!=="preview"&&e.CSS.disabled(y),e.CSS.BM(b,n),A&&e.CSS.BM(b,"custom-color"),M&&e.CSS.BM(b,"ghost"),s),size:t,tabIndex:m,onClick:L,onMouseDown:_,style:N,color:x,gap:t==="small"||t==="tiny"?"small":void 0,bordered:n!=="text",level:c,variant:R,square:X,overflow:"nowrap",status:T,href:r,...e.Qu.purgeUndefined(k),children:[(!B||!X)&&j,B&&f.jsxRuntimeExports.jsx(V.Loading,{}),H!=null&&f.jsxRuntimeExports.jsx(V.Text,{className:e.CSS.B("trigger-indicator"),"aria-label":"trigger-indicator",trigger:H,color:9,gap:"tiny",level:F.downLevel(c)})]})},me=ee(de);exports.Button=me;exports.Config=re;exports.Dialog=K;exports.chooseLocation=J;exports.formatTip=z;exports.isRenderProp=$;exports.renderProp=ue;exports.useConfig=U;exports.wrap=ee;
|
package/dist/Haul-9RVCn3cI.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const P=require("./jsx-runtime-nZSsnGb7.cjs"),m=require("./css-BVgFAmaj.cjs"),t=require("react"),f=require("zod"),j=require("./Text-DeWvfrdF.cjs"),T=f.z.object({key:f.z.string().or(f.z.number()),type:f.z.string(),elementID:f.z.string().optional(),data:m.Qu.unknownZ.optional()}),h=f.z.object({source:T,items:f.z.array(T)}),O={key:"",type:""},g={source:O,items:[]},_="file",q={key:"file",type:_},M=new Set(["all","copyLink"]),N=(e,r)=>M.has(e.dataTransfer.effectAllowed)&&r.items.length===0,[H,y]=j.create({defaultValue:null,displayName:"Haul.Context"}),x={...g,onSuccessfulDrop:()=>{}},C=t.memo(({children:e,useState:r=t.useState,onDropOutside:s})=>{const o=y(),[i,n]=r(g),u=t.useRef(x),l=t.useRef(new Set),d=t.useCallback((c,a,k)=>{u.current={source:c,items:a,onSuccessfulDrop:k},n({source:c,items:a})},[n,s]),p=t.useCallback(({target:c,dropped:a})=>{const k=u.current.items;u.current.onSuccessfulDrop?.({target:c,dropped:a,hauled:k}),u.current=x,n(g)},[n]),D=t.useCallback(c=>{let a=null;l.current.forEach(k=>{a==null&&(a=k(u.current,c))}),a!=null&&p(a),u.current=x,n(g)},[n]),E=t.useCallback(c=>(l.current.add(c),()=>l.current.delete(c)),[]),b=t.useMemo(()=>o??{state:i,start:d,end:D,drop:p,bind:E},[i,d,D,p,o]);return P.jsxRuntimeExports.jsx(H,{value:b,children:e})});C.displayName="HaulProvider";const F=()=>{const e=t.useRef(g),r=y();return r==null||(e.current=r.state),e},I=()=>{const e=y();return e==null?g:e.state},v=({type:e,key:r})=>{const s=r??t.useId(),o=t.useMemo(()=>({key:s,type:e}),[s,e]),i=y();if(i==null)return{startDrag:()=>{},onDragEnd:()=>{}};const{start:n,end:u}=i;return{startDrag:t.useCallback((l,d)=>n(o,l,d),[n,o]),onDragEnd:l=>u(m.Nu.construct({x:l.screenX,y:l.screenY}))}},R=({type:e,key:r,canDrop:s,onDrop:o,onDragOver:i})=>{const n=F(),u=y();if(u==null)return{onDragOver:()=>{},onDrop:()=>{}};const{drop:l}=u,d=r??t.useId(),p=t.useMemo(()=>({key:d,type:e}),[d,e]),D=t.useRef({x:-1,y:-1}),E=t.useCallback(c=>{c.preventDefault();const a=m.Nu.construct({x:c.screenX,y:c.screenY});m.Nu.equals(a,D.current)||(D.current=a,s(n.current)&&i?.({event:c,...n.current}))},[n,s]),b=t.useCallback(c=>{s(n.current)&&(c.preventDefault(),l({target:p,dropped:o({...n.current,event:c})}))},[n,o,s,l,p]);return{onDragOver:E,onDrop:b}},A=({type:e,key:r,...s})=>{const o=r??t.useId(),i=t.useMemo(()=>({key:o,type:e}),[o,e]),n=v(i),u=R({...s,...i});return{...n,...u}},z=e=>({items:r})=>r.some(s=>s.type===e),S=(e,r)=>r.filter(s=>s.type===e),L=(e,r,s)=>t.useCallback(o=>r({...o,items:S(e,o.items)}),s),Z=Object.freeze(Object.defineProperty({__proto__:null,FILE:q,FILE_TYPE:_,Provider:C,ZERO_DRAGGING_STATE:g,ZERO_ITEM:O,canDropOfType:z,draggingStateZ:h,filterByType:S,isFileDrag:N,itemZ:T,useContext:y,useDrag:v,useDragAndDrop:A,useDraggingRef:F,useDraggingState:I,useDrop:R,useFilterByTypeCallback:L},Symbol.toStringTag,{value:"Module"}));exports.FILE_TYPE=_;exports.Haul=Z;exports.Provider=C;exports.canDropOfType=z;exports.filterByType=S;exports.useDragAndDrop=A;exports.useDraggingState=I;exports.useDrop=R;exports.useFilterByTypeCallback=L;
|
package/dist/Menu-BYca9tGe.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const d=require("./jsx-runtime-nZSsnGb7.cjs"),t=require("./css-BVgFAmaj.cjs"),a=require("react"),p=require("react-dom"),T=require("./Animated-D-pQ3CYh.cjs"),N=require("./Box-4l6DWG-3.cjs");require("./Button-D5aoG3sV.cjs");const R=require("./Text-DeWvfrdF.cjs");require("./Editable-DI0-D1K5.cjs");require("./types-8-Mr79SF.cjs");require("./Provider-DBg-Li_7.cjs");const f={visible:!1,position:t.Nu.ZERO,cursor:t.Nu.ZERO,keys:[]},x=t.CSS.BE("menu-context","container"),I=n=>{let e=n;for(;!e.classList.contains(T.CONTEXT_TARGET);){if(e.classList.contains(x)||e.parentElement==null)return n;e=e.parentElement}return e.classList.contains(T.CONTEXT_TARGET)?e:n},M=n=>{const e=I(n);if(e==null)return[];const s=Array.from(e.parentElement?.querySelectorAll(`.${T.CONTEXT_SELECTED}`)??[]);return s.includes(e)?s:[e]},_=[{targetCorner:t.Iu.BOTTOM_RIGHT,dialogCorner:t.Iu.TOP_LEFT},{targetCorner:t.Iu.BOTTOM_LEFT,dialogCorner:t.Iu.TOP_RIGHT},{targetCorner:t.Iu.TOP_RIGHT,dialogCorner:t.Iu.BOTTOM_LEFT},{targetCorner:t.Iu.TOP_LEFT,dialogCorner:t.Iu.BOTTOM_RIGHT}],S=()=>{const n=a.useRef(null),[e,s]=a.useState(f),E=a.useCallback((r,u)=>{const o=t.Nu.construct(r);if(typeof r=="object"&&"preventDefault"in r){r.preventDefault(),r.stopPropagation();const l=M(r.target);u??=t.yu.unique(l.map(C=>C.id).filter(C=>C.length>0))}else u=[];s({visible:!0,keys:u,position:o,cursor:o})},[]),c=a.useCallback(r=>{n.current=r,r!=null&&s(u=>{if(!u.visible)return u;const{adjustedDialog:o}=T.position({container:t.vu.construct(0,0,window.innerWidth,window.innerHeight),dialog:t.vu.construct(r),target:t.vu.construct(u.cursor,0,0),prefer:_}),l=t.vu.topLeft(o);return t.Nu.equals(u.position,l)?u:{...u,position:l}})},[]),i=()=>s(f);return T.useClickOutside({ref:n,onClickOutside:i}),{...e,close:i,open:E,ref:c,className:x}},q=({ref:n,menu:e,visible:s,open:E,close:c,position:i,keys:r,className:u,cursor:o,style:l,onClick:C,...O})=>s?p.createPortal(d.jsxRuntimeExports.jsx(N.Box$1,{className:t.CSS(T.CONTEXT_MENU_CLASS,t.CSS.bordered()),ref:n,style:{...t.Nu.css(i),...l},onClick:m=>{c(),C?.(m)},gap:"tiny",...O,children:e?.({keys:r,visible:s,position:i,cursor:o})}),document.body):null,j=({menu:n,children:e,...s})=>d.jsxRuntimeExports.jsxs(d.jsxRuntimeExports.Fragment,{children:[d.jsxRuntimeExports.jsx(q,{menu:n,...s}),e]}),[L,g]=R.create({defaultValue:{onClick:()=>{},selected:""},displayName:"Menu.Context"}),A=({children:n,onChange:e,level:s,gap:E,background:c,value:i=""})=>{const r=a.useCallback(o=>{typeof e=="function"?e(o):e&&o in e&&e[o](o)},[e]),u=a.useMemo(()=>({onClick:r,selected:i,level:s,gap:E,background:c}),[i,r,s,E,c]);return d.jsxRuntimeExports.jsx(L,{value:u,children:n})};exports.ContextMenu=j;exports.Menu=A;exports.useContext=g;exports.useContextMenu=S;
|