@toclocoinc/lattice-grid 1.110.2 → 1.110.3
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/angular/package.json +1 -1
- package/docs/API.html +4 -4
- package/docs/api/adapters.html +1 -1
- package/docs/api/ai.html +1 -1
- package/docs/api/alarms.html +1 -1
- package/docs/api/calendar.html +1 -1
- package/docs/api/charts.html +1 -1
- package/docs/api/dashboard.html +1 -1
- package/docs/api/data-router.html +1 -1
- package/docs/api/dataview.html +1 -1
- package/docs/api/deckgl.html +1 -1
- package/docs/api/designer.html +1 -1
- package/docs/api/form.html +1 -1
- package/docs/api/gantt.html +1 -1
- package/docs/api/geometry.html +1 -1
- package/docs/api/grid.html +2 -2
- package/docs/api/index.html +1 -1
- package/docs/api/kanban.html +1 -1
- package/docs/api/kpi.html +1 -1
- package/docs/api/layout.html +1 -1
- package/docs/api/leaflet.html +1 -1
- package/docs/api/list.html +1 -1
- package/docs/api/listview.html +1 -1
- package/docs/api/mapview.html +1 -1
- package/docs/api/mock-socket.html +1 -1
- package/docs/api/presets.html +1 -1
- package/docs/api/scheduler.html +1 -1
- package/docs/api/shell.html +1 -1
- package/docs/api/tabs.html +1 -1
- package/docs/api/tree.html +1 -1
- package/docs/api/types.html +1 -1
- package/docs/api-detail.html +4 -4
- package/docs/warnings.json +1 -1
- package/lattice-grid.d.ts +1 -1
- package/lattice-grid.esm.min.js +2 -2
- package/lattice-grid.min.cjs +2 -2
- package/lattice-grid.min.js +2 -2
- package/locales/all.d.ts +1 -1
- package/locales/all.esm.min.js +1 -1
- package/locales/all.min.cjs +1 -1
- package/locales/all.min.js +1 -1
- package/locales/ar.d.ts +1 -1
- package/locales/ar.esm.min.js +1 -1
- package/locales/ar.min.cjs +1 -1
- package/locales/ar.min.js +1 -1
- package/locales/cs-CZ.d.ts +1 -1
- package/locales/cs-CZ.esm.min.js +1 -1
- package/locales/cs-CZ.min.cjs +1 -1
- package/locales/cs-CZ.min.js +1 -1
- package/locales/da-DK.d.ts +1 -1
- package/locales/da-DK.esm.min.js +1 -1
- package/locales/da-DK.min.cjs +1 -1
- package/locales/da-DK.min.js +1 -1
- package/locales/de-DE.d.ts +1 -1
- package/locales/de-DE.esm.min.js +1 -1
- package/locales/de-DE.min.cjs +1 -1
- package/locales/de-DE.min.js +1 -1
- package/locales/el-GR.d.ts +1 -1
- package/locales/el-GR.esm.min.js +1 -1
- package/locales/el-GR.min.cjs +1 -1
- package/locales/el-GR.min.js +1 -1
- package/locales/en-US.d.ts +1 -1
- package/locales/en-US.esm.min.js +1 -1
- package/locales/en-US.min.cjs +1 -1
- package/locales/en-US.min.js +1 -1
- package/locales/es-ES.d.ts +1 -1
- package/locales/es-ES.esm.min.js +1 -1
- package/locales/es-ES.min.cjs +1 -1
- package/locales/es-ES.min.js +1 -1
- package/locales/fi-FI.d.ts +1 -1
- package/locales/fi-FI.esm.min.js +1 -1
- package/locales/fi-FI.min.cjs +1 -1
- package/locales/fi-FI.min.js +1 -1
- package/locales/fr-CA.d.ts +1 -1
- package/locales/fr-CA.esm.min.js +1 -1
- package/locales/fr-CA.min.cjs +1 -1
- package/locales/fr-CA.min.js +1 -1
- package/locales/fr-FR.d.ts +1 -1
- package/locales/fr-FR.esm.min.js +1 -1
- package/locales/fr-FR.min.cjs +1 -1
- package/locales/fr-FR.min.js +1 -1
- package/locales/hu-HU.d.ts +1 -1
- package/locales/hu-HU.esm.min.js +1 -1
- package/locales/hu-HU.min.cjs +1 -1
- package/locales/hu-HU.min.js +1 -1
- package/locales/it-IT.d.ts +1 -1
- package/locales/it-IT.esm.min.js +1 -1
- package/locales/it-IT.min.cjs +1 -1
- package/locales/it-IT.min.js +1 -1
- package/locales/ja-JP.d.ts +1 -1
- package/locales/ja-JP.esm.min.js +1 -1
- package/locales/ja-JP.min.cjs +1 -1
- package/locales/ja-JP.min.js +1 -1
- package/locales/nb-NO.d.ts +1 -1
- package/locales/nb-NO.esm.min.js +1 -1
- package/locales/nb-NO.min.cjs +1 -1
- package/locales/nb-NO.min.js +1 -1
- package/locales/nl-NL.d.ts +1 -1
- package/locales/nl-NL.esm.min.js +1 -1
- package/locales/nl-NL.min.cjs +1 -1
- package/locales/nl-NL.min.js +1 -1
- package/locales/pl-PL.d.ts +1 -1
- package/locales/pl-PL.esm.min.js +1 -1
- package/locales/pl-PL.min.cjs +1 -1
- package/locales/pl-PL.min.js +1 -1
- package/locales/pt-BR.d.ts +1 -1
- package/locales/pt-BR.esm.min.js +1 -1
- package/locales/pt-BR.min.cjs +1 -1
- package/locales/pt-BR.min.js +1 -1
- package/locales/ro-RO.d.ts +1 -1
- package/locales/ro-RO.esm.min.js +1 -1
- package/locales/ro-RO.min.cjs +1 -1
- package/locales/ro-RO.min.js +1 -1
- package/locales/sv-SE.d.ts +1 -1
- package/locales/sv-SE.esm.min.js +1 -1
- package/locales/sv-SE.min.cjs +1 -1
- package/locales/sv-SE.min.js +1 -1
- package/locales/uk-UA.d.ts +1 -1
- package/locales/uk-UA.esm.min.js +1 -1
- package/locales/uk-UA.min.cjs +1 -1
- package/locales/uk-UA.min.js +1 -1
- package/modules/ai.d.ts +1 -1
- package/modules/ai.esm.min.js +1 -1
- package/modules/ai.min.cjs +1 -1
- package/modules/ai.min.js +1 -1
- package/modules/alarms.d.ts +1 -1
- package/modules/alarms.esm.min.js +1 -1
- package/modules/alarms.min.cjs +1 -1
- package/modules/alarms.min.js +1 -1
- package/modules/angular.d.ts +1 -1
- package/modules/angular.esm.min.js +1 -1
- package/modules/angular.min.cjs +1 -1
- package/modules/angular.min.js +1 -1
- package/modules/calendar.d.ts +1 -1
- package/modules/calendar.esm.min.js +1 -1
- package/modules/calendar.min.cjs +1 -1
- package/modules/calendar.min.js +1 -1
- package/modules/chart-alluvial.d.ts +1 -1
- package/modules/chart-alluvial.esm.min.js +1 -1
- package/modules/chart-alluvial.min.cjs +1 -1
- package/modules/chart-alluvial.min.js +1 -1
- package/modules/chart-arc.d.ts +1 -1
- package/modules/chart-arc.esm.min.js +1 -1
- package/modules/chart-arc.min.cjs +1 -1
- package/modules/chart-arc.min.js +1 -1
- package/modules/chart-barrace.d.ts +1 -1
- package/modules/chart-barrace.esm.min.js +1 -1
- package/modules/chart-barrace.min.cjs +1 -1
- package/modules/chart-barrace.min.js +1 -1
- package/modules/chart-bubblemap.d.ts +1 -1
- package/modules/chart-bubblemap.esm.min.js +1 -1
- package/modules/chart-bubblemap.min.cjs +1 -1
- package/modules/chart-bubblemap.min.js +1 -1
- package/modules/chart-bump.d.ts +1 -1
- package/modules/chart-bump.esm.min.js +1 -1
- package/modules/chart-bump.min.cjs +1 -1
- package/modules/chart-bump.min.js +1 -1
- package/modules/chart-calendar.d.ts +1 -1
- package/modules/chart-calendar.esm.min.js +1 -1
- package/modules/chart-calendar.min.cjs +1 -1
- package/modules/chart-calendar.min.js +1 -1
- package/modules/chart-choropleth.d.ts +1 -1
- package/modules/chart-choropleth.esm.min.js +1 -1
- package/modules/chart-choropleth.min.cjs +1 -1
- package/modules/chart-choropleth.min.js +1 -1
- package/modules/chart-decomposition.d.ts +1 -1
- package/modules/chart-decomposition.esm.min.js +1 -1
- package/modules/chart-decomposition.min.cjs +1 -1
- package/modules/chart-decomposition.min.js +1 -1
- package/modules/chart-diverging.d.ts +1 -1
- package/modules/chart-diverging.esm.min.js +1 -1
- package/modules/chart-diverging.min.cjs +1 -1
- package/modules/chart-diverging.min.js +1 -1
- package/modules/chart-dumbbell.d.ts +1 -1
- package/modules/chart-dumbbell.esm.min.js +1 -1
- package/modules/chart-dumbbell.min.cjs +1 -1
- package/modules/chart-dumbbell.min.js +1 -1
- package/modules/chart-fan.d.ts +1 -1
- package/modules/chart-fan.esm.min.js +1 -1
- package/modules/chart-fan.min.cjs +1 -1
- package/modules/chart-fan.min.js +1 -1
- package/modules/chart-forcetree.d.ts +1 -1
- package/modules/chart-forcetree.esm.min.js +1 -1
- package/modules/chart-forcetree.min.cjs +1 -1
- package/modules/chart-forcetree.min.js +1 -1
- package/modules/chart-hexbin.d.ts +1 -1
- package/modules/chart-hexbin.esm.min.js +1 -1
- package/modules/chart-hexbin.min.cjs +1 -1
- package/modules/chart-hexbin.min.js +1 -1
- package/modules/chart-hexmap.d.ts +1 -1
- package/modules/chart-hexmap.esm.min.js +1 -1
- package/modules/chart-hexmap.min.cjs +1 -1
- package/modules/chart-hexmap.min.js +1 -1
- package/modules/chart-icicle.d.ts +1 -1
- package/modules/chart-icicle.esm.min.js +1 -1
- package/modules/chart-icicle.min.cjs +1 -1
- package/modules/chart-icicle.min.js +1 -1
- package/modules/chart-markermap.d.ts +1 -1
- package/modules/chart-markermap.esm.min.js +1 -1
- package/modules/chart-markermap.min.cjs +1 -1
- package/modules/chart-markermap.min.js +1 -1
- package/modules/chart-motion.d.ts +1 -1
- package/modules/chart-motion.esm.min.js +1 -1
- package/modules/chart-motion.min.cjs +1 -1
- package/modules/chart-motion.min.js +1 -1
- package/modules/chart-pack.d.ts +1 -1
- package/modules/chart-pack.esm.min.js +1 -1
- package/modules/chart-pack.min.cjs +1 -1
- package/modules/chart-pack.min.js +1 -1
- package/modules/chart-parallel.d.ts +1 -1
- package/modules/chart-parallel.esm.min.js +1 -1
- package/modules/chart-parallel.min.cjs +1 -1
- package/modules/chart-parallel.min.js +1 -1
- package/modules/chart-pictorial.d.ts +1 -1
- package/modules/chart-pictorial.esm.min.js +1 -1
- package/modules/chart-pictorial.min.cjs +1 -1
- package/modules/chart-pictorial.min.js +1 -1
- package/modules/chart-polararea.d.ts +1 -1
- package/modules/chart-polararea.esm.min.js +1 -1
- package/modules/chart-polararea.min.cjs +1 -1
- package/modules/chart-polararea.min.js +1 -1
- package/modules/chart-polarscatter.d.ts +1 -1
- package/modules/chart-polarscatter.esm.min.js +1 -1
- package/modules/chart-polarscatter.min.cjs +1 -1
- package/modules/chart-polarscatter.min.js +1 -1
- package/modules/chart-pyramid.d.ts +1 -1
- package/modules/chart-pyramid.esm.min.js +1 -1
- package/modules/chart-pyramid.min.cjs +1 -1
- package/modules/chart-pyramid.min.js +1 -1
- package/modules/chart-radialbar.d.ts +1 -1
- package/modules/chart-radialbar.esm.min.js +1 -1
- package/modules/chart-radialbar.min.cjs +1 -1
- package/modules/chart-radialbar.min.js +1 -1
- package/modules/chart-ridgeline.d.ts +1 -1
- package/modules/chart-ridgeline.esm.min.js +1 -1
- package/modules/chart-ridgeline.min.cjs +1 -1
- package/modules/chart-ridgeline.min.js +1 -1
- package/modules/chart-roc.d.ts +1 -1
- package/modules/chart-roc.esm.min.js +1 -1
- package/modules/chart-roc.min.cjs +1 -1
- package/modules/chart-roc.min.js +1 -1
- package/modules/chart-scatter3d.d.ts +1 -1
- package/modules/chart-scatter3d.esm.min.js +1 -1
- package/modules/chart-scatter3d.min.cjs +1 -1
- package/modules/chart-scatter3d.min.js +1 -1
- package/modules/chart-serpentine.d.ts +1 -1
- package/modules/chart-serpentine.esm.min.js +1 -1
- package/modules/chart-serpentine.min.cjs +1 -1
- package/modules/chart-serpentine.min.js +1 -1
- package/modules/chart-slope.d.ts +1 -1
- package/modules/chart-slope.esm.min.js +1 -1
- package/modules/chart-slope.min.cjs +1 -1
- package/modules/chart-slope.min.js +1 -1
- package/modules/chart-spiral.d.ts +1 -1
- package/modules/chart-spiral.esm.min.js +1 -1
- package/modules/chart-spiral.min.cjs +1 -1
- package/modules/chart-spiral.min.js +1 -1
- package/modules/chart-splom.d.ts +1 -1
- package/modules/chart-splom.esm.min.js +1 -1
- package/modules/chart-splom.min.cjs +1 -1
- package/modules/chart-splom.min.js +1 -1
- package/modules/chart-tree.d.ts +1 -1
- package/modules/chart-tree.esm.min.js +1 -1
- package/modules/chart-tree.min.cjs +1 -1
- package/modules/chart-tree.min.js +1 -1
- package/modules/chart-venn.d.ts +1 -1
- package/modules/chart-venn.esm.min.js +1 -1
- package/modules/chart-venn.min.cjs +1 -1
- package/modules/chart-venn.min.js +1 -1
- package/modules/chart-voronoi.d.ts +1 -1
- package/modules/chart-voronoi.esm.min.js +1 -1
- package/modules/chart-voronoi.min.cjs +1 -1
- package/modules/chart-voronoi.min.js +1 -1
- package/modules/chart-waffle.d.ts +1 -1
- package/modules/chart-waffle.esm.min.js +1 -1
- package/modules/chart-waffle.min.cjs +1 -1
- package/modules/chart-waffle.min.js +1 -1
- package/modules/chart-wordcloud.d.ts +1 -1
- package/modules/chart-wordcloud.esm.min.js +1 -1
- package/modules/chart-wordcloud.min.cjs +1 -1
- package/modules/chart-wordcloud.min.js +1 -1
- package/modules/charts.d.ts +1 -1
- package/modules/charts.esm.min.js +1 -1
- package/modules/charts.min.cjs +1 -1
- package/modules/charts.min.js +1 -1
- package/modules/contextmenu.d.ts +1 -1
- package/modules/contextmenu.esm.min.js +1 -1
- package/modules/contextmenu.min.cjs +1 -1
- package/modules/contextmenu.min.js +1 -1
- package/modules/dashboard.d.ts +1 -1
- package/modules/dashboard.esm.min.js +1 -1
- package/modules/dashboard.min.cjs +1 -1
- package/modules/dashboard.min.js +1 -1
- package/modules/data-router.d.ts +1 -1
- package/modules/data-router.esm.min.js +1 -1
- package/modules/data-router.min.cjs +1 -1
- package/modules/data-router.min.js +1 -1
- package/modules/dataview.d.ts +1 -1
- package/modules/dataview.esm.min.js +1 -1
- package/modules/dataview.min.cjs +1 -1
- package/modules/dataview.min.js +1 -1
- package/modules/deckgl.d.ts +1 -1
- package/modules/deckgl.esm.min.js +1 -1
- package/modules/deckgl.min.cjs +1 -1
- package/modules/deckgl.min.js +1 -1
- package/modules/designer.d.ts +1 -1
- package/modules/designer.esm.min.js +1 -1
- package/modules/designer.min.cjs +1 -1
- package/modules/designer.min.js +1 -1
- package/modules/devtools.d.ts +1 -1
- package/modules/devtools.esm.min.js +1 -1
- package/modules/devtools.min.cjs +1 -1
- package/modules/devtools.min.js +1 -1
- package/modules/dhtmlx-compat.d.ts +1 -1
- package/modules/dhtmlx-compat.esm.min.js +1 -1
- package/modules/dhtmlx-compat.min.cjs +1 -1
- package/modules/dhtmlx-compat.min.js +1 -1
- package/modules/form.d.ts +1 -1
- package/modules/form.esm.min.js +1 -1
- package/modules/form.min.cjs +1 -1
- package/modules/form.min.js +1 -1
- package/modules/gantt.d.ts +1 -1
- package/modules/gantt.esm.min.js +1 -1
- package/modules/gantt.min.cjs +1 -1
- package/modules/gantt.min.js +1 -1
- package/modules/geo-europe-nuts.d.ts +1 -1
- package/modules/geo-europe-nuts.esm.min.js +1 -1
- package/modules/geo-europe-nuts.min.cjs +1 -1
- package/modules/geo-europe-nuts.min.js +1 -1
- package/modules/geo-uk.d.ts +1 -1
- package/modules/geo-uk.esm.min.js +1 -1
- package/modules/geo-uk.min.cjs +1 -1
- package/modules/geo-uk.min.js +1 -1
- package/modules/geo-us-states.d.ts +1 -1
- package/modules/geo-us-states.esm.min.js +1 -1
- package/modules/geo-us-states.min.cjs +1 -1
- package/modules/geo-us-states.min.js +1 -1
- package/modules/geo-world-110m.d.ts +1 -1
- package/modules/geo-world-110m.esm.min.js +1 -1
- package/modules/geo-world-110m.min.cjs +1 -1
- package/modules/geo-world-110m.min.js +1 -1
- package/modules/geo-world-50m.d.ts +1 -1
- package/modules/geo-world-50m.esm.min.js +1 -1
- package/modules/geo-world-50m.min.cjs +1 -1
- package/modules/geo-world-50m.min.js +1 -1
- package/modules/geometry.d.ts +1 -1
- package/modules/geometry.esm.min.js +1 -1
- package/modules/geometry.min.cjs +1 -1
- package/modules/geometry.min.js +1 -1
- package/modules/htmx.d.ts +1 -1
- package/modules/htmx.esm.min.js +2 -2
- package/modules/htmx.min.cjs +2 -2
- package/modules/htmx.min.js +2 -2
- package/modules/htmx.shared.esm.min.js +1 -1
- package/modules/htmx.shared.min.cjs +1 -1
- package/modules/htmx.shared.min.js +1 -1
- package/modules/kanban.d.ts +1 -1
- package/modules/kanban.esm.min.js +1 -1
- package/modules/kanban.min.cjs +1 -1
- package/modules/kanban.min.js +1 -1
- package/modules/kpi.d.ts +1 -1
- package/modules/kpi.esm.min.js +1 -1
- package/modules/kpi.min.cjs +1 -1
- package/modules/kpi.min.js +1 -1
- package/modules/layout.d.ts +1 -1
- package/modules/layout.esm.min.js +1 -1
- package/modules/layout.min.cjs +1 -1
- package/modules/layout.min.js +1 -1
- package/modules/leaflet.d.ts +1 -1
- package/modules/leaflet.esm.min.js +1 -1
- package/modules/leaflet.min.cjs +1 -1
- package/modules/leaflet.min.js +1 -1
- package/modules/list.d.ts +1 -1
- package/modules/list.esm.min.js +1 -1
- package/modules/list.min.cjs +1 -1
- package/modules/list.min.js +1 -1
- package/modules/listview.d.ts +1 -1
- package/modules/listview.esm.min.js +1 -1
- package/modules/listview.min.cjs +1 -1
- package/modules/listview.min.js +1 -1
- package/modules/mapview.d.ts +1 -1
- package/modules/mapview.esm.min.js +55 -55
- package/modules/mapview.esm.min.js.map +2 -2
- package/modules/mapview.min.cjs +55 -55
- package/modules/mapview.min.js +55 -55
- package/modules/mapview.min.js.map +2 -2
- package/modules/mock-socket.d.ts +1 -1
- package/modules/mock-socket.esm.min.js +1 -1
- package/modules/mock-socket.min.cjs +1 -1
- package/modules/mock-socket.min.js +1 -1
- package/modules/presets.d.ts +1 -1
- package/modules/presets.esm.min.js +1 -1
- package/modules/presets.min.cjs +1 -1
- package/modules/presets.min.js +1 -1
- package/modules/react.d.ts +1 -1
- package/modules/react.esm.min.js +1 -1
- package/modules/react.min.cjs +1 -1
- package/modules/react.min.js +1 -1
- package/modules/recordeditor.d.ts +1 -1
- package/modules/recordeditor.esm.min.js +1 -1
- package/modules/recordeditor.min.cjs +1 -1
- package/modules/recordeditor.min.js +1 -1
- package/modules/scheduler.d.ts +1 -1
- package/modules/scheduler.esm.min.js +1 -1
- package/modules/scheduler.min.cjs +1 -1
- package/modules/scheduler.min.js +1 -1
- package/modules/shell.d.ts +1 -1
- package/modules/shell.esm.min.js +1 -1
- package/modules/shell.min.cjs +1 -1
- package/modules/shell.min.js +1 -1
- package/modules/sidebar.d.ts +1 -1
- package/modules/sidebar.esm.min.js +1 -1
- package/modules/sidebar.min.cjs +1 -1
- package/modules/sidebar.min.js +1 -1
- package/modules/svelte.d.ts +1 -1
- package/modules/svelte.esm.min.js +1 -1
- package/modules/svelte.min.cjs +1 -1
- package/modules/svelte.min.js +1 -1
- package/modules/tabs.d.ts +1 -1
- package/modules/tabs.esm.min.js +1 -1
- package/modules/tabs.min.cjs +1 -1
- package/modules/tabs.min.js +1 -1
- package/modules/toolbar.d.ts +1 -1
- package/modules/toolbar.esm.min.js +1 -1
- package/modules/toolbar.min.cjs +1 -1
- package/modules/toolbar.min.js +1 -1
- package/modules/tree.d.ts +1 -1
- package/modules/tree.esm.min.js +1 -1
- package/modules/tree.min.cjs +1 -1
- package/modules/tree.min.js +1 -1
- package/modules/vue.d.ts +1 -1
- package/modules/vue.esm.min.js +1 -1
- package/modules/vue.min.cjs +1 -1
- package/modules/vue.min.js +1 -1
- package/modules/webcomponent.d.ts +1 -1
- package/modules/webcomponent.esm.min.js +2 -2
- package/modules/webcomponent.min.cjs +2 -2
- package/modules/webcomponent.min.js +2 -2
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.110.
|
|
2
|
+
* Lattice Grid 1.110.3, webcomponent module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
6
6
|
var Nr=Object.create(null),Mr=Object.create(null);function Be(e,D){Nr[e]=D}function sr(e){var D=Mr[e];if(D)return D;var re=Object.create(null);Mr[e]=re;var M=Nr[e];if(!M)throw new Error("[lattice] missing module: "+e);return M(re,sr),re}Be("packages/core/src/internal/predicates.js",function(e,D){"use strict";Object.defineProperty(e,"isObject",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"isFunction",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"isNil",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"isBlank",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"isCtor",{enumerable:!0,get:function(){return x}});function re(q){return q!==null&&typeof q=="object"&&!Array.isArray(q)}function M(q){return typeof q=="function"}function G(q){return q==null}function F(q){return q==null||q===""}function x(q){return typeof q!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(q))?!0:!!(q.prototype&&Object.getOwnPropertyNames(q.prototype).length>1)}}),Be("packages/core/src/internal/warn.js",function(e,D){"use strict";Object.defineProperty(e,"reportedWarnings",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"warnOnce",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"infoOnce",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"resetWarnings",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"fail",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"invariant",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"DEV",{enumerable:!0,get:function(){return g}});const re=new Set,M=2e3;function G(i){if(re.add(i),re.size>M){const t=re.values().next().value;t!==void 0&&re.delete(t)}}const F=[],x=500;function q(i,t,o){F.push({key:i,level:t,message:o.map(c=>typeof c=="string"?c:W(c)).join(" "),at:Date.now()}),F.length>x&&F.shift()}function W(i){if(i instanceof Error)return i.message;try{return JSON.stringify(i)}catch{return String(i)}}function I(){return F.map(i=>({...i}))}function K(i){if(i.length===0||typeof i[0]!="string")return i;const t=i[0].replace(/^\[lattice\]\s*/,"");return t===i[0]?i:[t,...i.slice(1)]}function R(i,...t){if(re.has(i))return;G(i);const o=K(t);q(i,"warn",o),console.warn("[lattice]",...o)}function S(i,...t){if(re.has(i))return;G(i);const o=K(t);q(i,"info",o),console.info("[lattice]",...o)}function k(){re.clear(),F.length=0}function y(i,t){const o=new Error(`[lattice] ${i}`);throw t!==void 0&&(o.cause=t),o}function l(i,t){i||y(t)}const g=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})()}),Be("packages/core/src/formatting/rules.js",function(e,D){"use strict";Object.defineProperty(e,"RULE_OPS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DISTRIBUTION_OPS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"DISTRIBUTION_LABELS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"testRule",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"mixColour",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"summariseColumn",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"quantileOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"needsDistribution",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"resolveDistribution",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ICON_SETS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"compileRules",{enumerable:!0,get:function(){return _}});const M=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce,x=Object.freeze(["eq","ne","gt","gte","lt","lte","between","outside","contains","notContains","startsWith","endsWith","blank","notBlank","true","false"]),q=Object.freeze(["topPercent","bottomPercent","topN","bottomN","aboveMean","belowMean","aboveMedian","belowMedian","zAbove","zBelow","outlier"]),W=Object.freeze({topPercent:"In the top %",bottomPercent:"In the bottom %",topN:"In the top N",bottomN:"In the bottom N",aboveMean:"Above average",belowMean:"Below average",aboveMedian:"Above the median",belowMedian:"Below the median",zAbove:"Standard deviations above the mean",zBelow:"Standard deviations below the mean",outlier:"An outlier"});function I(E,O){const N=Number(E),T=Number(O);if(E!==null&&E!==""&&O!==null&&O!==""&&Number.isFinite(N)&&Number.isFinite(T))return N<T?-1:N>T?1:0;const B=String(E??"").toLowerCase(),z=String(O??"").toLowerCase();return B<z?-1:B>z?1:0}function K(E){return E==null||E===""}function R(E,O){if(!O||typeof O!="object")return!1;const{op:N}=O,T=O.value,C=O.value2;switch(N){case"blank":return K(E);case"notBlank":return!K(E);case"true":return E===!0;case"false":return E===!1;default:break}if(K(E))return!1;switch(N){case"eq":return I(E,T)===0;case"ne":return I(E,T)!==0;case"gt":return I(E,T)>0;case"gte":return I(E,T)>=0;case"lt":return I(E,T)<0;case"lte":return I(E,T)<=0;case"between":return I(E,T)>=0&&I(E,C)<=0;case"outside":return I(E,T)<0||I(E,C)>0;case"contains":return String(E).toLowerCase().includes(String(T??"").toLowerCase());case"notContains":return!String(E).toLowerCase().includes(String(T??"").toLowerCase());case"startsWith":return String(E).toLowerCase().startsWith(String(T??"").toLowerCase());case"endsWith":return String(E).toLowerCase().endsWith(String(T??"").toLowerCase());default:return!1}}function S(E,O,N){const T=ee=>{const te=String(ee).replace("#",""),se=te.length===3?te.split("").map(ne=>ne+ne).join(""):te;return[0,2,4].map(ne=>parseInt(se.slice(ne,ne+2),16)||0)},[C,B,z]=T(E),[X,Q,H]=T(O),L=Math.max(0,Math.min(1,N)),Z=(ee,te)=>Math.round(ee+(te-ee)*L);return`#${[Z(C,X),Z(B,Q),Z(z,H)].map(ee=>ee.toString(16).padStart(2,"0")).join("")}`}function k(E){const O=[];for(const X of E||[]){if(X==null||X==="")continue;const Q=X instanceof Date?X.getTime():Number(X);Number.isFinite(Q)&&O.push(Q)}if(!O.length)return null;O.sort((X,Q)=>X-Q);let N=0,T=0,C=0;for(const X of O){N++;const Q=X-T;T+=Q/N,C+=Q*(X-T)}const B=y(O,.25),z=y(O,.75);return{n:O.length,min:O[0],max:O[O.length-1],mean:T,stddev:O.length>1?Math.sqrt(C/(O.length-1)):0,median:y(O,.5),q1:B,q3:z,iqr:z-B,sorted:O}}function y(E,O){if(!E.length)return 0;const N=(E.length-1)*Math.max(0,Math.min(1,O)),T=Math.floor(N),C=Math.ceil(N);return T===C?E[T]:E[T]+(N-T)*(E[C]-E[T])}function l(E){for(const O of Array.isArray(E)?E:[])if(!(!O||typeof O!="object")&&(O.when&&q.includes(O.when.op)||O.scale&&O.scale.from||O.dataBar&&!(Number.isFinite(Number(O.dataBar.min))&&Number.isFinite(Number(O.dataBar.max)))||O.iconSet&&!Array.isArray(O.iconSet.thresholds)))return!0;return!1}function g(E,O){const N=Number(E.value),T=C=>y(O.sorted,C);switch(E.op){case"topPercent":{const C=i(N,10);return{op:"gte",value:T(1-C)}}case"bottomPercent":{const C=i(N,10);return{op:"lte",value:T(C)}}case"topN":{const C=Math.max(1,Math.floor(N)||1),B=Math.max(0,O.sorted.length-C);return{op:"gte",value:O.sorted[B]}}case"bottomN":{const C=Math.max(1,Math.floor(N)||1),B=Math.min(O.sorted.length-1,C-1);return{op:"lte",value:O.sorted[B]}}case"aboveMean":return{op:"gt",value:O.mean};case"belowMean":return{op:"lt",value:O.mean};case"aboveMedian":return{op:"gt",value:O.median};case"belowMedian":return{op:"lt",value:O.median};case"zAbove":return O.stddev?{op:"gte",value:O.mean+(Number.isFinite(N)?N:2)*O.stddev}:null;case"zBelow":return O.stddev?{op:"lte",value:O.mean-(Number.isFinite(N)?N:2)*O.stddev}:null;case"outlier":{const C=(Number.isFinite(N)&&N>0?N:1.5)*O.iqr;return O.iqr?{op:"outside",value:O.q1-C,value2:O.q3+C}:null}default:return null}}function i(E,O){const N=Number.isFinite(E)?E:O,T=N>1?N/100:N;return Math.max(0,Math.min(1,T))}function t(E,O){if(E.from==="minmax")return{...E,min:O.min,max:O.max};if(E.from==="quantile")return{...E,min:y(O.sorted,i(Number(E.low),5)),max:y(O.sorted,i(Number(E.high),95))};if(E.from==="stddev"){const N=Number.isFinite(Number(E.deviations))?Number(E.deviations):2;return{...E,min:O.mean-N*O.stddev,max:O.mean+N*O.stddev}}return E}function o(E,O){const N=Array.isArray(E)?E:[];return!O||!O.n?N.map(T=>T&&l([T])?{...T,enabled:!1}:T):N.map(T=>{if(!T||typeof T!="object")return T;if(T.scale&&T.scale.from)return{...T,scale:t(T.scale,O)};if(T.dataBar)return{...T,dataBar:c(T.dataBar,O)};if(T.iconSet)return{...T,iconSet:f(T.iconSet,O)};if(!T.when||!q.includes(T.when.op))return T;const C=g(T.when,O);return C?{...T,when:C}:{...T,enabled:!1}})}function c(E,O){const N=Number.isFinite(Number(E.min))?Number(E.min):void 0,T=Number.isFinite(Number(E.max))?Number(E.max):void 0;if(N!==void 0&&T!==void 0)return{...E,min:N,max:T};if(E.from==="quantile")return{...E,min:N??y(O.sorted,i(Number(E.low),5)),max:T??y(O.sorted,i(Number(E.high),95))};if(E.from==="stddev"){const C=Number.isFinite(Number(E.deviations))?Number(E.deviations):2;return{...E,min:N??O.mean-C*O.stddev,max:T??O.mean+C*O.stddev}}return{...E,min:N??O.min,max:T??O.max}}function f(E,O){if(Array.isArray(E.thresholds))return E;const N=n(E),T=[];for(let C=1;C<N;C++)T.push(y(O.sorted,C/N));return{...E,thresholds:T}}function n(E){if(Array.isArray(E.icons)&&E.icons.length>=2)return E.icons.length;if(Number.isFinite(Number(E.count))&&Number(E.count)>=2)return Math.floor(Number(E.count));const O=b[E.set];return O?O.length:3}function m(E){return`url("data:image/svg+xml,${encodeURIComponent(E)}")`}function r(E){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="${E}"/></svg>`}function s(E,O){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><polygon points="${O==="up"?"8,2 14,13 2,13":O==="down"?"2,3 14,3 8,14":"4,2 14,8 4,14"}" fill="${E}"/></svg>`}function d(E,O){const N="M8 1l1.9 3.9 4.3.6-3.1 3 .7 4.3L8 13.8 4.2 15.8l.7-4.3-3.1-3 4.3-.6z";let T=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${O*16} 16">`;for(let C=0;C<O;C++){const B=C<E?"#f5a623":"#d0d0d0";T+=`<path transform="translate(${C*16},0)" d="${N}" fill="${B}"/>`}return`${T}</svg>`}const p=Object.freeze([s("#c0392b","down"),s("#e0a800","right"),s("#2e7d32","up")]),u=Object.freeze([r("#d13438"),r("#f5a623"),r("#2e9e44")]),b=Object.freeze({arrows:p,trafficLights:u,ratings:Object.freeze([1,2,3,4,5].map(E=>d(E,5)))}),a=Object.freeze({arrows:"Arrows",trafficLights:"Traffic lights",ratings:"Ratings"});function h(E){if(Array.isArray(E.icons)&&E.icons.length>=2)return E.icons.map(T=>/^\s*(url\(|data:|<)/.test(String(T))&&String(T).trim().startsWith("<")?m(String(T)):String(T));const O=E.set||"arrows";if(O==="ratings"){const T=n(E),C=[];for(let B=1;B<=T;B++)C.push(m(d(B,T)));return C}const N=b[O];return N?N.map(m):(F(`iconSet:${O}`,`unknown icon set '${O}'; falling back to arrows.`),p.map(m))}function w(E){const O=Number(E.min),T=Number(E.max)-O,C=E.colour||E.color||"#5b9bd5",B=E.negativeColour||E.negativeColor||"#d13438",z=E.direction==="rtl"?"left":"right",X=H=>Math.max(0,Math.min(1,(H-O)/T))*100,Q=T?Math.max(0,Math.min(100,(0-O)/T*100)):0;return H=>{if(K(H))return null;const L=Number(H);if(!Number.isFinite(L)||!T)return null;const Z=X(L),ee=Math.min(Z,Q),te=Math.max(Z,Q),se=L>=0?C:B;return{backgroundImage:`linear-gradient(to ${z}, transparent ${ee}%, ${se} ${ee}%, ${se} ${te}%, transparent ${te}%)`,backgroundRepeat:"no-repeat",backgroundPosition:"0 0"}}}function v(E){const O=h(E),N=E.reverse?[...O].reverse():O,T=(Array.isArray(E.thresholds)?E.thresholds:[]).map(Number).filter(Number.isFinite),C=Number.isFinite(Number(E.size))?Number(E.size):16,B=E.set==="ratings"?C*n(E):C;return z=>{if(K(z))return null;const X=Number(z);if(!Number.isFinite(X))return null;let Q=0;for(const L of T)X>=L&&Q++;const H=N[Math.min(Q,N.length-1)];return H?{backgroundImage:H,backgroundRepeat:"no-repeat",backgroundPosition:"left center",backgroundSize:`${B}px ${C}px`,paddingLeft:`${B+4}px`}:null}}function A(E){const O=Array.isArray(E.colours)&&E.colours.length>=2?E.colours:["#f8f9fa","#1a6bc7"],N=Number(E.min),T=Number(E.max),C=T-N,B=O.length-1,z=[];for(let Q=0;Q<=B;Q++)z.push(B?Q/B:0);const X=Number(E.mid);if(E.mid!==void 0&&E.mid!==null)if(O.length%2===0)F("formatting.scale.mid.even",`a scale's "mid" needs an odd number of colours (a middle stop to pin); ${O.length} were given, so "mid" was ignored.`);else if(Number.isFinite(X)&&C&&X>Math.min(N,T)&&X<Math.max(N,T)){const Q=B/2,H=Math.max(0,Math.min(1,(X-N)/C));for(let L=0;L<=B;L++)z[L]=L<=Q?Q?L/Q*H:H:H+(L-Q)/(B-Q)*(1-H)}else Number.isFinite(X)&&F("formatting.scale.mid.range",`a scale's "mid" (${X}) is outside its min..max range, so it was ignored.`);return Q=>{const H=Number(Q);if(!Number.isFinite(H)||!C)return null;const L=Math.max(0,Math.min(1,(H-N)/C));let Z=0;for(;Z<B-1&&L>z[Z+1];)Z++;const ee=z[Z+1]-z[Z],te=ee>0?(L-z[Z])/ee:0;return{background:S(O[Z],O[Z+1],Math.max(0,Math.min(1,te)))}}}function _(E,O=null){const N=l(E)?o(E,O):E,T=(Array.isArray(N)?N:[]).filter(z=>z&&typeof z=="object");if(!T.length)return()=>null;const C=T.map(z=>z.scale?{scale:A(z.scale),enabled:z.enabled!==!1}:z.dataBar?{scale:w(z.dataBar),enabled:z.enabled!==!1}:z.iconSet?{scale:v(z.iconSet),enabled:z.enabled!==!1}:{when:z.when,style:z.style,stop:z.stopIfTrue!==!1,enabled:z.enabled!==!1}),B=V(C)?j():null;return(z,X)=>{const Q=z?z.value:void 0;let H=null;X&&(X.mode=0);for(const L of C){if(!L.enabled)continue;if(L.scale){const te=L.scale(Q);te&&(H={...H||{},...te});continue}if(!R(Q,L.when))continue;let Z;const ee=M(L.style);if(ee?X&&B?(Z=L.style(B.enter(z)),B.mode>X.mode&&(X.mode=B.mode)):Z=L.style(z):Z=L.style,Z&&(H=H?{...H,...Z}:ee?Z:{...Z}),L.stop)break}return H}}function V(E){return E.some(O=>O.enabled&&!O.scale&&M(O.style))}const Y=new Set(["value","colId","column"]),$=new Set(["row","data","index"]);function j(){let E={};const O={mode:0,enter(C){return E=C||{},O.mode=0,T}},N=C=>{if(Y.has(C))return;const B=$.has(C)?1:2;B>O.mode&&(O.mode=B)},T=new Proxy({},{get(C,B){return N(B),E[B]},has(C,B){return N(B),B in E},set(C,B,z){return O.mode=2,E[B]=z,!0},ownKeys(){return O.mode=2,Reflect.ownKeys(E)},getOwnPropertyDescriptor(C,B){O.mode=2;const z=Object.getOwnPropertyDescriptor(E,B);return z?{value:E[B],enumerable:z.enumerable,configurable:!0,writable:!0}:void 0}});return O}}),Be("packages/core/src/formula/parse.js",function(e,D){"use strict";Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return o}});const re="num",M="str",G="ref",F="name",x="op",q="end",W=["<=",">=","<>","!="],I="+-*/^%(),<>=";class K extends Error{constructor(f,n){super(f),this.name="FormulaError",this.at=n}}function R(c){const f=[];let n=0;for(;n<c.length;){const m=c[n];if(m===" "||m===" "||m===`
|
|
7
|
-
`||m==="\r"){n++;continue}if(m>="0"&&m<="9"){n=k(c,n,f);continue}if(m==="."&&c[n+1]>="0"&&c[n+1]<="9"){n=k(c,n,f);continue}if(m==='"'||m==="'"){n=y(c,n,f);continue}if(m==="["){const s=c.indexOf("]",n+1);if(s<0)throw new K("a [column reference] was opened and never closed",n);f.push({kind:G,value:c.slice(n+1,s).trim(),at:n}),n=s+1;continue}if(S(m)){n=l(c,n,f);continue}const r=c.slice(n,n+2);if(W.includes(r)){f.push({kind:x,value:r==="!="?"<>":r,at:n}),n+=2;continue}if(I.includes(m)){f.push({kind:x,value:m,at:n}),n++;continue}throw new K(`unexpected character ${JSON.stringify(m)}`,n)}return f.push({kind:q,value:null,at:c.length}),f}function S(c){return/[A-Za-z_À-]/.test(c)}function k(c,f,n){let m=f,r=!1;for(;m<c.length;){const s=c[m];if(s>="0"&&s<="9"){m++;continue}if(s==="."&&!r){r=!0,m++;continue}if((s==="e"||s==="E")&&/[0-9+-]/.test(c[m+1]||"")){for(m+=2;m<c.length&&c[m]>="0"&&c[m]<="9";)m++;break}break}return n.push({kind:re,value:Number(c.slice(f,m)),at:f}),m}function y(c,f,n){const m=c[f];let r=f+1,s="";for(;r<c.length;){if(c[r]===m){if(c[r+1]===m){s+=m,r+=2;continue}return n.push({kind:M,value:s,at:f}),r+1}s+=c[r],r++}throw new K("a string was opened and never closed",f)}function l(c,f,n){let m=f;for(;m<c.length&&/[A-Za-z0-9_.À-]/.test(c[m]);)m++;const r=c.slice(f,m);let s=m;for(;s<c.length&&c[s]===" ";)s++;return n.push({kind:c[s]==="("?F:G,value:r,at:f}),m}const g={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function i(c){const f=String(c??"").replace(/^\s*=/,"");if(!f.trim())throw new K("the formula is empty");const n=R(f);let m=0;const r=()=>n[m],s=()=>n[m++],d=v=>{const A=r();if(A.kind!==x||A.value!==v)throw new K(`expected ${JSON.stringify(v)}`,A.at);m++},p=v=>{let A=u();for(;;){const _=r();if(_.kind!==x)break;const V=g[_.value];if(!V||V<v)break;m++;const Y=p(_.value==="^"?V:V+1);A={kind:"bin",op:_.value,left:A,right:Y}}return A},u=()=>{const v=r();return v.kind===x&&(v.value==="-"||v.value==="+")?(m++,{kind:"unary",op:v.value,arg:u()}):b()},b=()=>{let v=a();for(;r().kind===x&&r().value==="%";)m++,v={kind:"unary",op:"%",arg:v};return v},a=()=>{const v=s();if(v.kind===re)return{kind:"num",value:v.value};if(v.kind===M)return{kind:"str",value:v.value};if(v.kind===G)return{kind:"ref",name:v.value};if(v.kind===F){d("(");const A=[];if(!(r().kind===x&&r().value===")"))for(;;){if(A.push(p(1)),r().kind===x&&r().value===","){m++;continue}break}return d(")"),{kind:"call",name:String(v.value).toUpperCase(),args:A}}if(v.kind===x&&v.value==="("){const A=p(1);return d(")"),A}throw v.kind===q?new K("the formula ends unexpectedly",v.at):new K(`unexpected ${JSON.stringify(v.value)}`,v.at)},h=p(1),w=r();if(w.kind!==q)throw new K(`unexpected ${JSON.stringify(w.value)}: is an operator missing?`,w.at);return h}function t(c){const f=new Set,n=m=>{if(!(!m||typeof m!="object")){if(m.kind==="ref"){f.add(String(m.name));return}if(m.kind==="bin"){n(m.left),n(m.right);return}if(m.kind==="unary"){n(m.arg);return}if(m.kind==="call")for(const r of m.args)n(r)}};return n(c),[...f]}function o(c){return typeof c=="string"&&/^\s*=/.test(c)&&c.trim()!=="="}}),Be("packages/core/src/formula/evaluate.js",function(e,D){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return k}});const M=D("packages/core/src/formula/parse.js").FormulaError;function G(y){if(y==null||y==="")return 0;if(typeof y=="boolean")return y?1:0;if(y instanceof Date)return y.getTime();const l=typeof y=="number"?y:Number(String(y).replace(/[,\s]/g,""));if(!Number.isFinite(l))throw new M(`${JSON.stringify(y)} is not a number`);return l}function F(y){return y==null?"":String(y)}function x(y){if(typeof y=="boolean")return y;if(y==null||y==="")return!1;if(typeof y=="number")return y!==0;const l=String(y).trim().toLowerCase();return l==="false"||l==="no"||l==="0"?!1:l!==""}function q(y){const l=[];for(const g of y){if(Array.isArray(g)){for(const i of g)i!=null&&i!==""&&l.push(G(i));continue}g==null||g===""||l.push(G(g))}return l}function W(y,l){const g=10**l,i=y*g;return Math.sign(i)*Math.round(Math.abs(i)+Number.EPSILON*Math.abs(i))/g}function I(y,l){if(!y.length)return 0;const g=y.slice().sort((c,f)=>c-f),i=(g.length-1)*Math.min(1,Math.max(0,l)),t=Math.floor(i),o=Math.ceil(i);return t===o?g[t]:g[t]+(i-t)*(g[o]-g[t])}function K(y,l){let g=0,i=0,t=0;for(const c of y){g++;const f=c-i;i+=f/g,t+=f*(c-i)}const o=l?g-1:g;return o>0?Math.sqrt(t/o):0}const R={SUM:y=>q(y).reduce((l,g)=>l+g,0),AVERAGE:y=>{const l=q(y);return l.length?l.reduce((g,i)=>g+i,0)/l.length:0},MIN:y=>{const l=q(y);return l.length?Math.min(...l):0},MAX:y=>{const l=q(y);return l.length?Math.max(...l):0},COUNT:y=>q(y).length,PRODUCT:y=>q(y).reduce((l,g)=>l*g,1),ROUND:y=>W(G(y[0]),y.length>1?G(y[1]):0),ROUNDDOWN:y=>{const l=10**(y.length>1?G(y[1]):0),g=G(y[0])*l;return(g<0?Math.ceil(g):Math.floor(g))/l},ROUNDUP:y=>{const l=10**(y.length>1?G(y[1]):0),g=G(y[0])*l;return(g<0?Math.floor(g):Math.ceil(g))/l},ABS:y=>Math.abs(G(y[0])),FLOOR:y=>Math.floor(G(y[0])),CEILING:y=>Math.ceil(G(y[0])),SQRT:y=>Math.sqrt(G(y[0])),POWER:y=>G(y[0])**G(y[1]),MOD:y=>{const l=G(y[1]);if(l===0)throw new M("MOD by zero");return(G(y[0])%l+l)%l},IF:y=>x(y[0])?y[1]:y.length>2?y[2]:!1,AND:y=>y.every(x),OR:y=>y.some(x),NOT:y=>!x(y[0]),COALESCE:y=>y.find(l=>l!=null&&l!=="")??null,CONCAT:y=>y.map(F).join(""),LEN:y=>F(y[0]).length,UPPER:y=>F(y[0]).toUpperCase(),LOWER:y=>F(y[0]).toLowerCase(),TRIM:y=>F(y[0]).trim(),LEFT:y=>F(y[0]).slice(0,y.length>1?G(y[1]):1),RIGHT:y=>{const l=y.length>1?G(y[1]):1;return l<=0?"":F(y[0]).slice(-l)},MEDIAN:y=>I(q(y),.5),PERCENTILE:y=>{const l=G(y[y.length-1]);return I(q(y.slice(0,-1)),l>1?l/100:l)},QUARTILE1:y=>I(q(y),.25),QUARTILE3:y=>I(q(y),.75),STDEV:y=>K(q(y),!0),STDEVP:y=>K(q(y),!1),VAR:y=>{const l=K(q(y),!0);return l*l},VARP:y=>{const l=K(q(y),!1);return l*l},COUNTDISTINCT:y=>{const l=new Set;for(const g of y){const i=Array.isArray(g)?g:[g];for(const t of i)t!=null&&t!==""&&l.add(t)}return l.size},IQR:y=>{const l=q(y);return I(l,.75)-I(l,.25)}};R.AVG=R.AVERAGE,R.CEIL=R.CEILING,R.POW=R.POWER,R.STDEVS=R.STDEV,R.PERCENTILEINC=R.PERCENTILE;function S(y,l){const g=Number(y),i=Number(l);if(y!==null&&y!==""&&l!==null&&l!==""&&Number.isFinite(g)&&Number.isFinite(i))return g<i?-1:g>i?1:0;const o=F(y).toLowerCase(),c=F(l).toLowerCase();return o<c?-1:o>c?1:0}function k(y,l={}){const g=typeof l.lookup=="function"?l.lookup:null,i=l.functions?{...R,...l.functions}:R,t=o=>{switch(o.kind){case"num":return o.value;case"str":return o.value;case"ref":{if(!g)throw new M(`there is no column called ${JSON.stringify(o.name)} here`);const c=g(String(o.name));if(c===void 0)throw new M(`there is no column called ${JSON.stringify(o.name)}`);return c}case"unary":{if(o.op==="%")return G(t(o.arg))/100;const c=G(t(o.arg));return o.op==="-"?-c:c}case"bin":{const c=o.op;if(c==="=")return S(t(o.left),t(o.right))===0;if(c==="<>")return S(t(o.left),t(o.right))!==0;if(c==="<")return S(t(o.left),t(o.right))<0;if(c==="<=")return S(t(o.left),t(o.right))<=0;if(c===">")return S(t(o.left),t(o.right))>0;if(c===">=")return S(t(o.left),t(o.right))>=0;const f=G(t(o.left)),n=G(t(o.right));if(c==="+")return f+n;if(c==="-")return f-n;if(c==="*")return f*n;if(c==="^")return f**n;if(c==="/"){if(n===0)throw new M("division by zero");return f/n}throw new M(`unknown operator ${JSON.stringify(c)}`)}case"call":{const c=l.lazy&&l.lazy[o.name];if(typeof c=="function")return c(o.args,t,l);const f=i[o.name];if(typeof f!="function")throw new M(`there is no function called ${o.name}`);return f(o.args.map(t),l)}default:throw new M("the formula could not be read")}};return t(y)}}),Be("packages/core/src/formula/index.js",function(e,D){"use strict";Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return S}});const re=D("packages/core/src/formula/parse.js"),M=re.parseFormula,G=re.referencesOf,F=re.looksLikeFormula,x=re.FormulaError,q=re.tokenise,W=D("packages/core/src/formula/evaluate.js"),I=W.evaluateAst,K=W.FUNCTIONS;function R(k){const{grid:y,row:l,data:g}=k||{},i=n=>String(n).toLowerCase().replace(/[\s_-]/g,""),t=y&&y.columns&&typeof y.columns.all=="function"?y.columns.all():[],o=y&&y.permissions,c=o&&typeof o.isReadable=="function"?n=>o.isReadable(n):()=>!0,f=new Set;for(const n of t)c(n)||(f.add(i(n.id)),n.field&&f.add(i(n.field)),n.title&&f.add(i(n.title)));return n=>{const m=i(n);if(f.has(m))throw new x(`"${n}" cannot be read`);for(const r of t)if(i(r.id)===m||r.field&&i(r.field)===m||r.title&&i(r.title)===m)return l&&y.rows&&typeof y.rows.value=="function"?y.rows.value(l.key,r.id):g?g[r.field||r.id]:void 0;if(g&&typeof g=="object"){for(const r of Object.keys(g))if(i(r)===m){if(!c(r))throw new x(`"${n}" cannot be read`);return g[r]}}}}function S(k,y={}){try{const l=M(k);return{ok:!0,value:I(l,{lookup:R(y),functions:y.formulaFunctions}),references:G(l)}}catch(l){return{ok:!1,error:l instanceof x?l.message:"the formula could not be read",at:l instanceof x?l.at:void 0}}}}),Be("packages/core/src/internal/version.js",function(e,D){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return G}});const re="1.110.2";async function M(){return re}const G="1.110.2"}),Be("packages/core/src/internal/merge.js",function(e,D){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"mergeRow",{enumerable:!0,get:function(){return W}});const M=D("packages/core/src/internal/predicates.js").isObject;function G(I,K,R){if(I!==void 0)return I===!0?{enabled:!0,...R}:I===!1?{enabled:!1}:M(I)?I:{[K]:I,enabled:!0}}function F(I){return I==null?[]:Array.isArray(I)?I:[I]}const x=Object.freeze(new Set(["__proto__","constructor","prototype"]));function q(I,K){if(!M(I))return M(K)?{...K}:K;if(!M(K))return K===void 0?I:K;const R={...I};for(const S of Object.keys(K)){if(x.has(S))continue;const k=K[S];k!==void 0&&(R[S]=M(k)&&M(R[S])?q(R[S],k):k)}return R}function W(I,K){if(!M(I)||!M(K)||I===K)return K;const R=Object.create(Object.getPrototypeOf(I));return Object.assign(R,I,K),R}}),Be("packages/core/src/internal/schedule.js",function(e,D){"use strict";Object.defineProperty(e,"now",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"nextFrame",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return W}});function re(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const M=typeof requestAnimationFrame=="function";function G(I){return M?requestAnimationFrame(I):setTimeout(()=>I(re()),16)}function F(I){I!=null&&(M?cancelAnimationFrame(I):clearTimeout(I))}function x(I){let K=null,R=null;const S=()=>{K=null;const y=R;R=null,I(...y||[])},k=(...y)=>{R=y,K===null&&(K=G(S))};return k.cancel=()=>{F(K),K=null,R=null},k.flush=()=>{K!==null&&(F(K),S())},k}function q(I,K){let R=null,S=null;const k=()=>{if(R=null,S===null)return;const g=S;S=null,I(...g),y()},y=()=>{R=setTimeout(k,K),typeof R?.unref=="function"&&R.unref()},l=(...g)=>{R===null?(I(...g),y()):(S=g,clearTimeout(R),y())};return l.flush=()=>{if(R!==null&&clearTimeout(R),R=null,S===null)return;const g=S;S=null,I(...g)},l.cancel=()=>{R!==null&&clearTimeout(R),R=null,S=null},l.pending=()=>R!==null||S!==null,l}function W(I,K=50){return typeof requestIdleCallback=="function"?requestIdleCallback(I,{timeout:K}):setTimeout(()=>I({timeRemaining:()=>0,didTimeout:!0}),1)}}),Be("packages/core/src/internal/paths.js",function(e,D){"use strict";Object.defineProperty(e,"pathGetter",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"pathSetter",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"getPath",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return q}});const re=new Map;function M(W){let I=re.get(W);if(I)return I;if(!W.includes("."))I=K=>K?.[W];else{const K=W.split("."),R=K.length;I=S=>{let k=S;for(let y=0;y<R;y++){if(k==null)return;k=k[K[y]]}return k}}return re.set(W,I),I}const G=new Map;function F(W){let I=G.get(W);if(I)return I;if(!W.includes("."))I=(K,R)=>{K!=null&&(K[W]=R)};else{const K=W.split("."),R=K.length-1;I=(S,k)=>{let y=S;for(let l=0;l<R;l++){if(y==null)return;const g=K[l];y[g]==null&&(y[g]={}),y=y[g]}y!=null&&(y[K[R]]=k)}}return G.set(W,I),I}function x(W,I){return M(I)(W)}function q(W,I,K){F(I)(W,K)}}),Be("packages/core/src/internal/compare.js",function(e,D){"use strict";Object.defineProperty(e,"collator",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"defaultCompare",{enumerable:!0,get:function(){return G}});const re=new Map;function M(F,x){const q=`${F||""}|${x?JSON.stringify(x):""}`;let W=re.get(q);return W||(W=new Intl.Collator(F||void 0,{numeric:!0,sensitivity:"variant",...x}),re.set(q,W)),W}function G(F,x){if(F===x)return 0;if(F==null)return 1;if(x==null)return-1;if(typeof F=="number"&&typeof x=="number")return Number.isNaN(F)?Number.isNaN(x)?0:1:Number.isNaN(x)||F<x?-1:F>x?1:0;const q=String(F),W=String(x);return q<W?-1:q>W?1:0}}),Be("packages/core/src/defaults.js",function(e,D){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return S}});const M=D("packages/core/src/internal/predicates.js").isObject,F=D("packages/core/src/internal/merge.js").merge,q=D("packages/core/src/internal/warn.js").warnOnce;let W=null;class I extends Error{}function K(k,y=new Set){if(Array.isArray(k)){if(y.has(k))throw new I;y.add(k);const g=k.map(i=>K(i,y));return y.delete(k),g}if(!M(k)||Object.getPrototypeOf(k)!==Object.prototype&&Object.getPrototypeOf(k)!==null)return k;if(y.has(k))throw new I;y.add(k);const l={};for(const[g,i]of Object.entries(k))l[g]=K(i,y);return y.delete(k),l}function R(k){if(k===void 0)return K(W??{});if(k===null)return W=null,{};if(!M(k))return q("defaults:type",`defaults() expects a configuration object, or null to clear it, but got ${Array.isArray(k)?"an array":typeof k}. The call was ignored and the defaults are unchanged.`),K(W??{});try{W=K(k)}catch(y){if(!(y instanceof I))throw y;return q("defaults:cyclic","defaults() expects a configuration object with no circular references, but the object passed refers back to itself. The call was ignored and the defaults are unchanged."),K(W??{})}return K(W)}function S(k){return W===null?k:F(K(W),k)}}),Be("packages/core/src/internal/uid.js",function(e,D){"use strict";Object.defineProperty(e,"uid",{enumerable:!0,get:function(){return M}});let re=0;function M(G="l"){return`${G}${(++re).toString(36)}`}}),Be("packages/core/src/events/names.js",function(e,D){"use strict";Object.defineProperty(e,"EVENT_NAMES",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"isKnownEvent",{enumerable:!0,get:function(){return G}});const re=Object.freeze(["ready","destroy","render:first","render:done","config:changed","licence:changed","model:changed","rows:changed","rows:queued","rows:deferred","rows:paused","rows:resumed","row:received","row:sent","row:copied","row:moved","source:error","source:total","stream:chunk","stream:end","stream:evicted","rowDrag:started","rowDrag:moved","rowDrag:left","rowDrag:ended","beforeRowDrop","rowDrop:cancelled","rowDrop","cell:changed","cell:pending","cell:confirmed","cell:reverted","cell:conflict","cell:clicked","cell:dblclicked","cell:contextmenu","cell:mouseover","cell:mouseout","cell:mousedown","cell:mouseup","cell:edit:start","cell:edit:end","row:edit:start","row:edit:end","row:clicked","row:dblclicked","row:pending","row:confirmed","row:reverted","row:conflict","form:opened","form:closed","form:saved","form:error","sort:changed","filter:changed","group:toggled","facet:computed","facet:filtered","facet:expanded","facet:failed","column:moved","column:resized","column:visible","column:pinned","column:grouped","column:pivoted","column:filter:open","column:profile:open","column:compareGroups:open","column:menu:open","explain:open","columns:changed","columns:tagged","columngroup:changed","header:contextmenu","totals:contextmenu","pivot:drill","selection:changed","range:changed","clipboard:copy","page:changed","scroll","scroll:end","size:changed","detail:toggled","detail:cell:edit:start","detail:cell:edit:end","detail:row:edit:start","detail:row:edit:end","detail:cell:changed","toolpanel:focus","highlight:changed","find:changed","tree:loading","tree:loaded","tree:loadFailed","tree:loadAborted","state:changed","state:reset","history:changed","history:applied","views:changed","view:applied","view:saved","view:removed","view:renamed","view:default","validation:failed","validation:cleared","formatting:changed","redaction:changed","permissions:changed","presentation:changed","presentation:started","presentation:ended","presentation:view","presentation:scale","presentation:spotlight","presentation:captured","comment:added","comment:edited","comment:deleted","comment:failed","comment:resolved","comment:unresolved","comment:threadOpened","comment:threadClosed","comment:indexLoaded","presence:published","presence:joined","presence:updated","presence:left","presence:failed","presence:lockRefused","diff:changed","diff:swapped","timeline:attached","timeline:detached","timeline:seek","timeline:seeking","annotation:changed","export:progress","export:request","export:done","shortcuts:opened","shortcuts:closed","print:before","print:after","beforeEdit","beforeSort","beforeFilter","beforeColumnMove","beforeColumnResize","beforeColumnHide","beforeSelect","beforeRowAdd","beforeDelete","beforeRowMove","beforeGroup","beforeRowReceive","edit:cancelled","sort:cancelled","filter:cancelled","columnMove:cancelled","columnResize:cancelled","columnHide:cancelled","selection:cancelled","rowAdd:cancelled","delete:cancelled","rowMove:cancelled","group:cancelled","rowReceive:cancelled"]),M=new Set(re);function G(F){return F==="*"||M.has(F)}}),Be("packages/core/src/events/bus.js",function(e,D){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return g}});const re=D("packages/core/src/internal/warn.js"),M=re.warnOnce,G=re.DEV,x=D("packages/core/src/internal/uid.js").uid,W=D("packages/core/src/events/names.js").isKnownEvent,I="*";function K(i,t){!G||W(t)||M(`bus.unknown:${t}`,`${i}('${t}') subscribes to an event the grid never raises, so the handler will never fire. Check the name against the EventName list — a common cause is a near miss such as 'row:click' for 'row:clicked'.`)}const R=new Set(["api","user","init","ai"]),S=new WeakMap;function k(i){let t=S.get(i);return t||(t=x("h"),S.set(i,t)),t}function y(){return typeof performance=="object"&&performance?performance.now():Date.now()}function l(i){if(!i||typeof i!="object")return{};const t={};for(const[o,c]of Object.entries(i))o!=="grid"&&(c==null?t[o]=String(c):Array.isArray(c)?t[o]=`[${c.length}]`:typeof c=="object"?t[o]=c.key?`row ${c.key}`:"{…}":typeof c=="function"?t[o]="[function]":t[o]=String(c).slice(0,60));return t}class g{#e=new Map;#t=!1;#n=[];#r=200;#i=new Map;#s=null;#o=!1;#l=0;constructor(t=null){this.#s=t}attach(t){this.#s=t}get grid(){return this.#s}get destroyed(){return this.#o}on(t,o){if(typeof o!="function")return M(`bus.handler:${t}`,`on('${t}') needs a function; ignored.`),()=>{};K("on",t);let c=this.#e.get(t);return c||(c=[],this.#e.set(t,c)),c.push(o),()=>this.off(t,o)}once(t,o){if(typeof o!="function")return M(`bus.handler:${t}`,`once('${t}') needs a function; ignored.`),()=>{};K("once",t);const c=f=>{this.off(t,o),o(f)};return this.#i.set(o,c),this.on(t,c)}off(t,o){if(o===void 0){this.#e.delete(t);return}const c=this.#e.get(t);if(!c)return;const f=this.#i.get(o),n=f&&c.includes(f)?f:o,m=c.indexOf(n);m>=0&&c.splice(m,1),f&&n===f&&this.#i.delete(o),c.length===0&&this.#e.delete(t)}count(t){const o=this.#e.get(t),c=t===I?null:this.#e.get(I);return(o?o.length:0)+(c?c.length:0)}#a(t,o,c,f,n){this.#n.push({type:t,origin:o,listeners:(f?f.length:0)+(n?n.length:0),payload:l(c),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(t,o){this.#t=!!t,Number.isFinite(o)&&o>0&&(this.#r=Math.floor(o)),t||(this.#n=[])}eventLog(){return this.#n.map(t=>({...t}))}clearEventLog(){this.#n=[]}counts(){const t={};for(const[o,c]of this.#e)t[o]=c.length;return t}emit(t,o,c){const f=c??(o&&o.origin),n=R.has(f)?f:"api",m={...o||null,type:t,origin:n,grid:this.#s};if(this.#o)return m;const r=this.#e.get(t),s=t===I?void 0:this.#e.get(I);if(this.#t&&this.#a(t,n,o,r,s),!r&&!s)return m;const d=this.#t?y():0;this.#l++;try{r&&this.#c(r.slice(),m,t),s&&this.#c(s.slice(),m,I)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=y()-d)}return m}emitBefore(t,o,c){const f=c??(o&&o.origin),n=R.has(f)?f:"user";let m=!1,r=null;const s=h=>{m=!0,h!=null&&r===null&&(r=String(h))},d={...o||null,type:t,origin:n,grid:this.#s,get defaultPrevented(){return m},get reason(){return r},preventDefault(h){s(h)}};if(this.#o)return!0;const p=this.#e.get(t);this.#t&&this.#a(t,n,o,p,void 0);const u=p?p.slice():[];if(u.length===0)return!0;const b=()=>(m&&r===null&&(r="prevented"),m&&o&&typeof o=="object"&&(o.reason=r),!m),a=[];for(const h of u)try{const w=h(d);w&&typeof w.then=="function"?a.push(w):w===!1&&s("prevented")}catch(w){s("error"),M(`bus.beforeThrow:${t}:${k(h)}`,`a '${t}' before-handler threw; the action was cancelled.`,w)}return a.length===0?b():Promise.allSettled(a).then(h=>{for(const w of h)w.status==="rejected"?(s("error"),M(`bus.beforeReject:${t}`,`a '${t}' before-handler rejected; the action was cancelled.`,w.reason)):w.value===!1&&s("prevented");return b()})}#c(t,o,c){for(let f=0;f<t.length;f++)try{t[f](o)}catch(n){M(`bus.throw:${c}:${k(t[f])}`,`a '${c}' handler threw; other handlers were unaffected.`,n)}}clear(){this.#e.clear(),this.#i.clear()}destroy(){this.clear(),this.#o=!0,this.#s=null}}}),Be("packages/core/src/registry/free-tier-notice.js",function(e,D){"use strict";Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"WATERMARK_TEXT",{enumerable:!0,get:function(){return M}});const re="Free for non-commercial use: latticegrid.dev/free",M="Unlicensed: Lattice Grid trial"}),Be("packages/core/src/registry/licence.js",function(e,D){"use strict";Object.defineProperty(e,"PRODUCT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"LICENCE_VERSION",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"fromBase64Url",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"toBase64Url",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"asciiBytes",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"parseLicence",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"hasEd25519",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"verifyLicence",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"isLocalHost",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"currentHost",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"matchesDomain",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LicenceHolder",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"setLicence",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return j}});const M=D("packages/core/src/internal/warn.js").warnOnce,G=D("packages/core/src/registry/free-tier-notice.js"),F=G.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return G.FREE_TIER_NOTICE}});const x="lattice-grid",q=1,W="LG1",I=64,K="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",R="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",S=(()=>{const E=new Int16Array(128).fill(-1);for(let O=0;O<R.length;O++)E[R.charCodeAt(O)]=O;return E[43]=62,E[47]=63,E})();function k(E){if(typeof E!="string")return null;let O="";for(let X=0;X<E.length;X++){const Q=E.charCodeAt(X);if(Q!==61){if(Q>127||S[Q]<0)return null;O+=E[X]}}const N=O.length;if(N%4===1)return null;const T=new Uint8Array(Math.floor(N*3/4));let C=0,B=0,z=0;for(let X=0;X<N;X++)C=C<<6|S[O.charCodeAt(X)],B+=6,B>=8&&(B-=8,T[z++]=C>>B&255);return z===T.length?T:T.subarray(0,z)}function y(E){let O="",N=0;for(;N+2<E.length;N+=3){const C=E[N]<<16|E[N+1]<<8|E[N+2];O+=R[C>>18&63]+R[C>>12&63]+R[C>>6&63]+R[C&63]}const T=E.length-N;if(T===1){const C=E[N]<<16;O+=R[C>>18&63]+R[C>>12&63]}else if(T===2){const C=E[N]<<16|E[N+1]<<8;O+=R[C>>18&63]+R[C>>12&63]+R[C>>6&63]}return O}function l(E){const O=new Uint8Array(E.length);for(let N=0;N<E.length;N++)O[N]=E.charCodeAt(N)&127;return O}function g(E){if(typeof TextDecoder=="function")return new TextDecoder().decode(E);let O="";for(let N=0;N<E.length;N++)O+=String.fromCharCode(E[N]);return O}function i(E){const O={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof E=="string"?E:""};if(typeof E!="string"||E.length===0)return{...O,reason:"missing"};const N=E.trim(),T=N.split(".");if(T.length!==3)return O;const[C,B,z]=T;if(C!==W)return{...O,reason:"prefix"};const X=k(B),Q=k(z);if(!X||!Q)return O;let H;try{H=JSON.parse(g(X))}catch{return O}return H===null||typeof H!="object"?O:{ok:!0,reason:null,product:typeof H.p=="string"?H.p:null,issuedTo:typeof H.t=="string"?H.t:null,expires:typeof H.e=="string"?H.e:null,terms:typeof H.terms=="string"?H.terms:null,features:Array.isArray(H.f)?H.f.slice():[],deployments:Array.isArray(H.d)?H.d.slice():[],version:typeof H.v=="number"?H.v:0,message:l(B),signature:Q,raw:N}}function t(E,O){if(!E)return!1;const N=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(E)?`${E}T23:59:59.999Z`:E);return Number.isNaN(N)?!0:O>N}function o(E){return E==="non-commercial"?"non-commercial":"commercial"}let c=null,f=null,n=null;function m(){const E=globalThis.crypto;return E&&E.subtle?E.subtle:null}async function r(E){if(c&&f===E)return c;const O=m();if(!O)return null;const N=k(E);if(!N)return null;try{const T=await O.importKey("raw",N,{name:"Ed25519"},!1,["verify"]);return c=T,f=E,T}catch{return null}}async function s(){return n!==null||(n=await r(K)!==null),n}async function d(E,O={}){const N=O.warn!==!1,T=O.product||x,C=O.publicKey||K,B=O.now??Date.now(),z=O.host??u(),X=p(z)?"":` ${F}`,Q=i(E);if(!Q.ok){const te=Q.reason==="missing"?"missing":"malformed";return N&&M(`licence.${te}`,te==="missing"?`no licence key supplied. The grid renders in full and carries a trial watermark on any host other than localhost. Get a key at latticegrid.dev.${X}`:`licence key could not be read. The grid will render with a watermark.${X}`),{valid:!1,reason:te,terms:"commercial"}}const H={product:Q.product||void 0,issuedTo:Q.issuedTo||void 0,expires:Q.expires||void 0,terms:o(Q.terms)};if(Q.product!==T)return N&&M("licence.product",`licence key is for '${Q.product}', not '${T}'. The grid will render with a watermark.`),{valid:!1,...H,reason:"product"};if(t(Q.expires,B))return N&&M("licence.expired",`licence expired on ${Q.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,...H,reason:"expired"};const L=Q.deployments||[];if(L.length&&z&&!p(z)&&!b(z,L))return N&&M("licence.domain",`licence key is not valid for ${z}; it covers ${L.join(", ")}. The grid will render with a watermark.`),{valid:!1,...H,reason:"domain"};const Z=await r(C);if(!Z){const te=!!Q.signature&&Q.signature.length===I;return N&&M("licence.algorithm","this host does not provide crypto.subtle Ed25519, so the licence signature could not be verified. A structural check was used instead."),te?{valid:!0,...H,reason:"unverified"}:{valid:!1,...H,reason:"signature"}}let ee=!1;try{ee=await m().verify({name:"Ed25519"},Z,Q.signature,Q.message)}catch{ee=!1}return ee?{valid:!0,...H}:(N&&M("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...H,reason:"signature"})}function p(E){const O=String(E??u()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!O||O==="localhost"||O.endsWith(".localhost")||O==="::1"||O==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(O)}function u(){const E=globalThis.location;return E&&typeof E.hostname=="string"?E.hostname:null}function b(E,O){const N=a(E);return!N||!Array.isArray(O)?!1:O.some(T=>{const C=a(T);if(!C)return!1;if(C==="*")return!0;if(C.startsWith("*.")){const B=C.slice(2);return N===B||N.endsWith(`.${B}`)}return N===C})}function a(E){return String(E??"").trim().toLowerCase().replace(/\.$/,"")}class h{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#i;#s=new Set;constructor(O={}){this.#i=O}set(O){this.#e=typeof O=="string"?O.trim():"";const N=i(this.#e);return this.#t=N.ok?{valid:!t(N.expires,Date.now())&&N.product===(this.#i.product||x),product:N.product||void 0,issuedTo:N.issuedTo||void 0,expires:N.expires||void 0,terms:o(N.terms),reason:"pending"}:{valid:!1,reason:N.reason||"malformed",terms:"commercial"},this.#n=null,this.#e&&this.verify(),this.#t}verify(){if(this.#n)return this.#n;const O=this.#e;return this.#n=d(O,this.#i).then(N=>{if(this.#e===O){this.#t=N;for(const T of this.#s)T(N)}return N}),this.#n}onSettled(O){return this.#s.add(O),()=>this.#s.delete(O)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!p(this.#r)}setHost(O){this.#r=O}state(){return this.#t.valid?"licensed":p(this.#r)?"localhost":"trial"}reset(){this.#e="",this.#t={valid:!1,reason:"missing",terms:"commercial"},this.#n=null,this.#s.clear()}}const w=Symbol.for("lattice-grid/licence/holder");function v(){const E=globalThis,O=E&&E[w];if(O&&typeof O.set=="function"&&typeof O.watermark=="function")return O;const N=new h;if(E)try{E[w]=N}catch{}return N}const A=v();function _(E){return A.set(E)}function V(){return A.info()}function Y(){return A.watermark()}function $(){return A.state()}function j(){return A}}),Be("packages/core/src/registry/registry.js",function(e,D){"use strict";Object.defineProperty(e,"KINDS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"REGIONS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return c}});const re=D("packages/core/src/internal/warn.js"),M=re.warnOnce,G=re.DEV,x=D("packages/core/src/internal/predicates.js").isFunction,q=D("packages/core/src/registry/licence.js"),W=q.LicenceHolder,I=q.sharedLicence,K=["renderer","editor","filter","dataType","totalFn","pipe","component"],R=["all","header","body","totals","panels"];class S{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#i;#s=null;#o=null;#l=new Set;#a=new Map;constructor(n={}){for(const m of K)this.#t.set(m,new Map);this.#i=n.holder||I(),this.#o=n.grid??null,this.#s=this.#i.onSettled(()=>{this.#f({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),n.licence&&this.setLicence(n.licence)}registerModules(n,m={}){m.licence&&this.setLicence(m.licence),m.grid!==void 0&&(this.#o=m.grid);const r=Array.isArray(n)?n:[n],s=[];for(const d of r){if(!d||typeof d!="object"||typeof d.name!="string"||!d.name){M("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(d.name)){G&&this.#u(this.#e.get(d.name),d);continue}if(!x(d.install)){M(`registry.module.install:${d.name}`,`module '${d.name}' has no install() and was ignored.`);continue}const p={registry:this,grid:this.#o};try{d.install(p)}catch(u){M(`registry.module.throw:${d.name}`,`module '${d.name}' threw during install; it was not registered.`,u);continue}this.#e.set(d.name,d);for(const u of k(d))this.#n.add(u);s.push(d.name),this.#f({reason:"module",name:d.name,capabilities:this.capabilities(),regions:g(d)})}return s}unregisterModule(n){const m=this.#e.get(n);if(!m)return!1;if(x(m.uninstall))try{m.uninstall({registry:this,grid:this.#o})}catch(r){M(`registry.module.uninstall:${n}`,`module '${n}' threw during uninstall.`,r)}return this.#e.delete(n),this.#c(),this.#f({reason:"unmodule",name:n,capabilities:this.capabilities(),regions:g(m)}),!0}modules(){return[...this.#e.values()]}has(n){return this.#e.has(n)}#c(){this.#n.clear();for(const n of this.#e.values())for(const m of k(n))this.#n.add(m)}#u(n,m){!n||n===m||y(n,m)||M(`registry.module.reconfigure:${m.name}`,`module '${m.name}' was re-registered with different options; the first registration is kept and this call was ignored. Unregister it first if you mean to replace it.`)}capabilities(){return[...this.#n].sort()}can(n){return this.#n.has(n)}onChange(n){return x(n)?(this.#r.add(n),this.#a.set(n,this.#o),()=>{this.#r.delete(n),this.#a.delete(n)}):()=>{}}#f(n){for(const m of[...this.#r])try{m(n)}catch(r){M("registry.onChange.throw","a registry change handler threw.",r)}}register(n,m,r){const s=this.#t.get(n);if(!s){M(`registry.kind:${n}`,`unknown registry kind '${n}'; expected one of ${K.join(", ")}.`);return}if(!m||typeof m!="string"){M(`registry.name:${n}`,`register('${n}', ...) needs a name.`);return}s.has(m)&&s.get(m)!==r&&M(`registry.replace:${n}:${m}`,`'${m}' was already registered as a ${n} and has been replaced.`),s.set(m,r),this.#f({reason:"register",name:m,kind:n,capabilities:this.capabilities(),regions:i(n)})}registerAll(n,m){if(m)for(const r of Object.keys(m))this.register(n,r,m[r])}get(n,m){const r=this.#t.get(n);return r?r.get(m):void 0}names(n){const m=this.#t.get(n);return m?[...m.keys()]:[]}#d(n,m){const r=this.#t.get(n).get(m);return r!==void 0?r:this.#t.get("component").get(m)}renderer(n){return this.#d("renderer",n)}editor(n){return this.#d("editor",n)}filter(n){return this.#d("filter",n)}dataType(n){return this.get("dataType",n)}totalFn(n){return this.get("totalFn",n)}pipe(n){return this.get("pipe",n)}setLicence(n){return this.#i.set(n)}licence(){return this.#i.info()}licenceVerified(){return this.#i.verify()}watermark(){return this.#i.watermark()}attach(n){n!=null&&(this.#l.add(n),this.#o=n)}detach(n){if(n!=null){this.#l.delete(n);for(const[m,r]of[...this.#a])r===n&&(this.#r.delete(m),this.#a.delete(m));if(this.#o===n){const m=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#o=m}this.#l.size===0&&this.#s&&(this.#s(),this.#s=null)}}destroy(n){if(n!=null){this.detach(n);return}for(const m of[...this.#e.keys()])this.unregisterModule(m);this.#r.clear(),this.#a.clear(),this.#l.clear(),this.#s&&this.#s(),this.#s=null,this.#o=null}}function k(f){const n=f.capabilities,m=Array.isArray(n)?n.filter(r=>typeof r=="string"):[];return[f.name,...m]}function y(f,n){return f.install!==n.install||f.uninstall!==n.uninstall||(f.version||"")!==(n.version||"")?!1:l(k(f),k(n))&&l(g(f),g(n))}function l(f,n){const m=new Set(f),r=new Set(n);if(m.size!==r.size)return!1;for(const s of m)if(!r.has(s))return!1;return!0}function g(f){const n=f.regions;return!Array.isArray(n)||n.length===0?["all"]:n.filter(m=>R.includes(m))}function i(f){switch(f){case"filter":return["header"];case"totalFn":return["totals"];case"renderer":case"editor":case"pipe":return["body"];default:return["all"]}}const t=new S;function o(){return t}function c(f,n={}){return t.registerModules(f,n)}}),Be("packages/core/src/internal/text.js",function(e,D){"use strict";Object.defineProperty(e,"humanise",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"escapeHtml",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return F}});function re(x){return x?(x.includes(".")?x.slice(x.lastIndexOf(".")+1):x).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,W=>W.toUpperCase()):""}const M={"&":"&","<":"<",">":">",'"':""","'":"'"};function G(x){const q=x==null?"":String(x);return/[&<>"']/.test(q)?q.replace(/[&<>"']/g,W=>M[W]):q}function F(x){return String(x).replace(/\w\S*/g,q=>q[0].toUpperCase()+q.slice(1).toLowerCase())}}),Be("packages/core/src/format/mask.js",function(e,D){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return q}});const re=new Set(["0","#","?",",","."]),M="\0";function G(I){const K=[];let R="",S=!1;for(let k=0;k<I.length;k++){const y=I[k];if(y==="\\"){R+=y+(I[k+1]??""),k+=1;continue}if(y==='"'){S=!S,R+=y;continue}if(y===";"&&!S){K.push(R),R="";continue}R+=y}return K.push(R),K}function F(I){let K="",R="",S="",k=1,y=!1,l=!1;const g=s=>{l?R+=s:K+=s};for(let s=0;s<I.length;s++){const d=I[s];if(d==="\\"){g(I[s+1]??""),s+=1;continue}if(d==='"'){const p=I.indexOf('"',s+1);g(p===-1?I.slice(s+1):I.slice(s+1,p)),s=p===-1?I.length:p;continue}if(d==="%"){k*=100,g("%");continue}if(d==="@"){y=!0,g("\0");continue}if(re.has(d)){S+=d,l=!0;continue}g(d)}let i=-1;for(let s=S.length-1;s>=0;s--){const d=S[s];if(d==="0"||d==="#"||d==="?"){i=s;break}}let t=!1,o="";for(let s=0;s<S.length;s++){const d=S[s];if(d===","){s>i?k/=1e3:t=!0;continue}o+=d}const c=o.indexOf("."),f=c===-1?o:o.slice(0,c),n=c===-1?"":o.slice(c+1);let m=0;for(const s of f)s==="0"&&(m+=1);let r=0;for(const s of n)s==="0"&&(r+=1);return{prefix:K,suffix:R,minInt:m,minDec:r,maxDec:n.length,grouping:t,scale:k,hasNumber:i!==-1,isText:y}}function x(I,K){const R=new Intl.NumberFormat(K,{minimumIntegerDigits:Math.max(I.minInt,1),minimumFractionDigits:I.minDec,maximumFractionDigits:Math.max(I.maxDec,I.minDec),useGrouping:I.grouping}),{prefix:S,suffix:k,scale:y,hasNumber:l}=I;return g=>{if(!l)return S+k;const i=y===1?g:g*y;return S+R.format(i)+k}}function q(I,K){const S=G(String(I)).map(F),k=S.map(o=>x(o,K)),y=0,l=S.length>1?1:-1,g=S.length>2?2:-1,i=S.length>3?3:-1,t=o=>{if(o==null||o==="")return"";if(typeof o!="number"||Number.isNaN(o)){const c=Number(o);if(Number.isNaN(c))return i===-1?String(o):(S[i].prefix+S[i].suffix).split("\0").join(String(o));o=c}return o===0&&g!==-1?k[g](0):o<0&&l!==-1?k[l](-o):k[y](o)};return t.spec={mask:I},{format:t,ooxml:W(String(I))}}function W(I){return I.trim()}}),Be("packages/core/src/format/pattern.js",function(e,D){"use strict";Object.defineProperty(e,"parseNumberPattern",{enumerable:!0,get:function(){return x}});const M=D("packages/core/src/format/mask.js").splitSections;function G(q){let W="",I="",K="",R="",S=!1,k=!1,y=!1,l=!1;const g=t=>{y?I+=t:W+=t};for(let t=0;t<q.length;t++){const o=q[t];if(o==="\\"){g(q[t+1]??""),t+=1;continue}if(o==='"'){const c=q.indexOf('"',t+1);g(c===-1?q.slice(t+1):q.slice(t+1,c)),t=c===-1?q.length:c;continue}if(o==="%"){k=!0;continue}if(o==="0"||o==="#"){y=!0,l?R+=o:K+=o;continue}if(o===","){l||(S=!0);continue}if(o==="."&&!l){l=!0;continue}g(o)}if(!y)return{hasDigit:!1,prefix:W,suffix:I,minDec:0,maxDec:0,grouping:!1,percent:k};let i=0;for(const t of R)t==="0"&&(i+=1);return{hasDigit:!0,prefix:W,suffix:I,minDec:i,maxDec:R.length,grouping:S,percent:k}}function F(q,W){const I=W.trim(),K=q.trim();return I.startsWith("(")&&I.endsWith(")")&&I.slice(1,-1).trim()===K?"parentheses":I.endsWith("-")?"suffix":"minus"}function x(q){if(typeof q!="string")return null;const W=M(q);if(W.length===0)return null;const I=G(W[0]);if(!I.hasDigit)return null;const K={style:I.percent?"percent":"decimal",prefix:I.prefix,suffix:I.suffix,minDecimals:I.minDec,maxDecimals:Math.max(I.maxDec,I.minDec),thousandsSeparator:I.grouping?void 0:!1};if(W.length>1&&(K.negative=F(W[0],W[1])),W.length>2){const R=G(W[2]);R.hasDigit||(K.zeroDisplay=R.prefix+R.suffix)}return K}}),Be("packages/core/src/format/number.js",function(e,D){"use strict";Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return W}});const M=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/warn.js").warnOnce,q=D("packages/core/src/format/pattern.js").parseNumberPattern;function W(I,K){const R=typeof I=="string"?{pattern:I}:I||{};let S=R;if(typeof R.pattern=="string"){const v=q(R.pattern);if(v){const{pattern:A,..._}=R;S={...v,..._}}else F(`format:pattern:${R.pattern}`,`invalid number format pattern "${R.pattern}"; the value will use the default number format`)}const k=S.locale||K||void 0,y=S.style||"decimal",l=typeof S.scale=="number"?S.scale:1,g=S.nullDisplay??"",i=S.zeroDisplay,t=S.prefix||"",o=S.suffix||"",c=S.negative||"minus",f=S.signed===!0,n={style:y,notation:S.notation||"standard"};y==="currency"&&(n.currency=S.currency||"USD",S.currencyDisplay&&(n.currencyDisplay=S.currencyDisplay)),typeof S.decimals=="number"?(n.minimumFractionDigits=S.decimals,n.maximumFractionDigits=S.decimals):(typeof S.minDecimals=="number"&&(n.minimumFractionDigits=S.minDecimals),typeof S.maxDecimals=="number"&&(n.maximumFractionDigits=S.maxDecimals),n.minimumFractionDigits>(n.maximumFractionDigits??20)&&(n.maximumFractionDigits=n.minimumFractionDigits)),S.thousandsSeparator===!1&&(n.useGrouping=!1),n.notation==="compact"&&(n.compactDisplay=S.compactDisplay||"short");const m=new Intl.NumberFormat(k,n),r=typeof S.thousandsSeparator=="string"?S.thousandsSeparator:null,s=typeof S.decimalSeparator=="string"?S.decimalSeparator:null;let d=",",p=".";if(r||s)for(const v of m.formatToParts(12345.6))v.type==="group"?d=v.value:v.type==="decimal"&&(p=v.value);const u=v=>{let A=v;return r&&(A=A.split(d).join("")),s&&(A=A.split(p).join("")),r&&(A=A.split("").join(r)),s&&(A=A.split("").join(s)),A},b=!!(r||s),a=t!==""&&y==="currency",h=v=>{let A;if(a){const _=m.formatToParts(v);let V=!1;A="";for(const Y of _)A+=Y.value,!V&&Y.type==="currency"&&(A+=t,V=!0);V||(A=t+A)}else A=t+m.format(v);return b&&(A=u(A)),A+o},w=v=>{if(M(v)||v==="")return g;const A=typeof v=="number"?v:Number(v);if(Number.isNaN(A))return g;const _=l===1?A:A*l;return _===0&&i!==void 0?i:_<0?c==="parentheses"?`(${h(-_)})`:c==="suffix"?`${h(-_)}-`:h(_):f&&_>0?`+${h(_)}`:h(_)};return w.negativeClass=S.negativeClass||null,w.spec=S,w}}),Be("packages/core/src/format/date.js",function(e,D){"use strict";Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return o}});const M=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/warn.js").warnOnce,x=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function q(c){const f=[];let n=0,m="";const r=()=>{m&&(f.push({token:null,text:m}),m="")};for(;n<c.length;){const s=c[n];if(s==="'"){if(c[n+1]==="'"){m+="'",n+=2;continue}const p=c.indexOf("'",n+1);if(p===-1){m+=c.slice(n+1),n=c.length;continue}m+=c.slice(n+1,p),n=p+1;continue}const d=x.find(p=>c.startsWith(p,n));if(d){r(),f.push({token:d,text:d}),n+=d.length;continue}/[A-Za-z]/.test(s)&&F(`date.pattern.token:${s}`,`the date pattern "${c}" contains '${s}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${x.join(" ")}.`),m+=s,n+=1}return r(),f}const W=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function I(c){if(M(c)||c==="")return null;if(c instanceof Date)return Number.isNaN(c.getTime())?null:c;if(typeof c=="number")return Number.isNaN(c)?null:new Date(c);if(typeof c=="string"){const f=W.exec(c.trim());if(f){const[,m,r,s,d="0",p="0",u="0"]=f;return new Date(+m,+r-1,+s,+d,+p,+u)}const n=new Date(c);return Number.isNaN(n.getTime())?null:n}return null}function K(c,f){return String(c).padStart(f,"0")}function R(c){if(!c)return m=>({year:m.getFullYear(),month:m.getMonth()+1,day:m.getDate(),hour:m.getHours(),minute:m.getMinutes(),second:m.getSeconds(),ms:m.getMilliseconds(),weekday:m.getDay()});const f=new Intl.DateTimeFormat("en-US",{timeZone:c,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"short"}),n={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return m=>{const r={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:m.getMilliseconds(),weekday:0};for(const s of f.formatToParts(m))switch(s.type){case"year":r.year=Number(s.value);break;case"month":r.month=Number(s.value);break;case"day":r.day=Number(s.value);break;case"hour":r.hour=Number(s.value)%24;break;case"minute":r.minute=Number(s.value);break;case"second":r.second=Number(s.value);break;case"weekday":r.weekday=n[s.value]??0;break;default:break}return r}}function S(c,f,n){const m=q(c),r=R(n),s=new Set(m.filter(a=>a.token).map(a=>a.token)),d=s.has("MMM")?new Intl.DateTimeFormat(f,{month:"short",timeZone:n}):null,p=s.has("MMMM")?new Intl.DateTimeFormat(f,{month:"long",timeZone:n}):null,u=s.has("EEE")?new Intl.DateTimeFormat(f,{weekday:"short",timeZone:n}):null,b=s.has("EEEE")?new Intl.DateTimeFormat(f,{weekday:"long",timeZone:n}):null;return a=>{const h=r(a);let w="";for(const v of m){if(!v.token){w+=v.text;continue}switch(v.token){case"yyyy":w+=K(h.year,4);break;case"yy":w+=K(h.year%100,2);break;case"MMMM":w+=p.format(a);break;case"MMM":w+=d.format(a);break;case"MM":w+=K(h.month,2);break;case"M":w+=String(h.month);break;case"dd":w+=K(h.day,2);break;case"d":w+=String(h.day);break;case"EEEE":w+=b.format(a);break;case"EEE":w+=u.format(a);break;case"HH":w+=K(h.hour,2);break;case"H":w+=String(h.hour);break;case"hh":w+=K(h.hour%12===0?12:h.hour%12,2);break;case"h":w+=String(h.hour%12===0?12:h.hour%12);break;case"mm":w+=K(h.minute,2);break;case"m":w+=String(h.minute);break;case"ss":w+=K(h.second,2);break;case"s":w+=String(h.second);break;case"SSS":w+=K(h.ms,3);break;case"a":w+=h.hour<12?"AM":"PM";break;default:w+=v.text;break}}return w}}const k=[["year",365*24*36e5],["month",720*36e5],["week",168*36e5],["day",24*36e5],["hour",36e5],["minute",6e4],["second",1e3]];function y(c,f){const n=c||{},m=n.locale||f||void 0,r=n.nullDisplay??"",s=n.timeZone;let d;if(n.pattern)d=S(n.pattern,m,s);else if(n.dateStyle||n.timeStyle){const h={timeZone:s};n.dateStyle&&(h.dateStyle=n.dateStyle),n.timeStyle&&(h.timeStyle=n.timeStyle);const w=new Intl.DateTimeFormat(m,h);d=v=>w.format(v)}else{const h=new Intl.DateTimeFormat(m,{dateStyle:"medium",timeZone:s});d=w=>h.format(w)}const p=n.relative?new Intl.RelativeTimeFormat(m,{numeric:"auto"}):null,b=(typeof n.relative=="object"&&n.relative?n.relative.threshold??7:7)*24*36e5,a=(h,w)=>{const v=I(h);if(!v)return r;if(p){const A=w&&typeof w.now=="number"?w.now:Date.now(),_=v.getTime()-A;if(Math.abs(_)<b){for(const[V,Y]of k)if(Math.abs(_)>=Y||V==="second")return p.format(Math.round(_/Y),V)}}return d(v)};return a.spec=n,a}function l(c){if(M(c)||c==="")return null;if(typeof c=="string"){const m=/^(\d{4}-\d{2}-\d{2})/.exec(c.trim());if(m)return m[1];const r=I(c);return r?l(r):null}const f=I(c);if(!f)return null;const n=m=>String(m).padStart(2,"0");return`${f.getFullYear()}-${n(f.getMonth()+1)}-${n(f.getDate())}`}function g(c,f){if(M(c)||c==="")return null;if(typeof c=="string"){const m=c.trim();if(i.test(m)){const d=I(m);return d?t(d,f):null}const r=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(m);if(r){const[,d,p,u,b]=r;return`${d}T${p}:${u}${b&&b!=="00"?`:${b}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(m))return`${m}T00:00`;const s=I(m);return s?g(s):null}const n=I(c);return n?t(n,f):null}const i=/(?:Z|[+-]\d{2}:?\d{2})$/i;function t(c,f){const n=d=>String(d).padStart(2,"0");if(f)try{const d=new Intl.DateTimeFormat("en-CA",{timeZone:f,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(c).reduce((b,a)=>(a.type!=="literal"&&(b[a.type]=a.value),b),{}),p=d.hour==="24"?"00":d.hour,u=Number(d.second);return`${d.year}-${d.month}-${d.day}T${p}:${d.minute}`+(u?`:${d.second}`:"")}catch{}const m=`${c.getFullYear()}-${n(c.getMonth()+1)}-${n(c.getDate())}`,r=c.getSeconds(),s=`${n(c.getHours())}:${n(c.getMinutes())}${r?`:${n(r)}`:""}`;return`${m}T${s}`}function o(c,f){const n=M(c)||c===""?null:String(c),m=M(f)||f===""?null:String(f);return n===null?m===null?0:1:m===null||n<m?-1:n>m?1:0}}),Be("packages/core/src/format/boolean.js",function(e,D){"use strict";Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return q}});const M=D("packages/core/src/internal/predicates.js").isNil,G={true:"☑",false:"☐",null:""},F={true:"◉",false:"◯",null:""};function x(W){if(M(W)||W==="")return null;if(typeof W=="boolean")return W;if(typeof W=="number")return W!==0;const I=String(W).trim().toLowerCase();return I==="true"||I==="yes"||I==="y"||I==="1"?!0:I==="false"||I==="no"||I==="n"||I==="0"?!1:null}function q(W,I){const K=W||{},R=K.display||"text",S=K.trueLabel??"Yes",k=K.falseLabel??"No",y=K.nullLabel??"";let l=S,g=k;const i=y;R==="checkbox"?(l=G.true,g=G.false):R==="switch"?(l=F.true,g=F.false):R==="icon"&&(l=K.trueIcon??S,g=K.falseIcon??k);const t=o=>{const c=x(o);return c===null?i:c?l:g};return t.display=R,t.labels={true:S,false:k,null:y},t.locale=I,t.spec=K,t}}),Be("packages/core/src/format/text.js",function(e,D){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return x}});const M=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/text.js").titleCase;function x(q,W){const I=q||{},K=I.locale||W||void 0,R=I.nullDisplay??"",S=I.emptyDisplay??"",k=I.transform||"none",y=typeof I.truncate=="number"?{chars:I.truncate}:I.truncate||null,l=y?y.chars:0,g=y?y.ellipsis??"…":"",i=o=>{switch(k){case"upper":return K?o.toLocaleUpperCase(K):o.toUpperCase();case"lower":return K?o.toLocaleLowerCase(K):o.toLowerCase();case"title":return F(o);default:return o}},t=o=>{if(M(o))return R;let c=typeof o=="string"?o:String(o);return c===""?S:(k!=="none"&&(c=i(c)),l>0&&c.length>l&&(c=c.slice(0,l)+g),c)};return t.spec=I,t}}),Be("packages/core/src/format/shorthand.js",function(e,D){"use strict";Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return W}});const re=["currency","number","percent","date","boolean","text","relative"],M=/[#0?@;"\\]/,G=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function F(I){return typeof I!="string"||I===""||q(I)?!1:M.test(I)}function x(I){return typeof I!="string"||I===""||q(I)?!1:G.test(I)}function q(I){const K=I.indexOf(":"),R=K===-1?I:I.slice(0,K);return re.includes(R)?R:null}function W(I){const K=q(I);if(!K)return null;const R=I.indexOf(":"),S=R===-1?"":I.slice(R+1),k=S===""?[]:S.split(":");switch(K){case"currency":{const y={type:"number",style:"currency",currency:k[0]||"USD"};return k[1]!==void 0&&k[1]!==""&&(y.decimals=Number(k[1])),y}case"number":{const y={type:"number",style:"decimal"};return k[0]!==void 0&&k[0]!==""&&(y.decimals=Number(k[0])),y}case"percent":{const y={type:"number",style:"percent"};return k[0]!==void 0&&k[0]!==""&&(y.decimals=Number(k[0])),y}case"date":return{type:"date",pattern:S||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const y=S.split("/"),l={type:"boolean",display:"text"};return y[0]!==void 0&&y[0]!==""&&(l.trueLabel=y[0]),y[1]!==void 0&&y[1]!==""&&(l.falseLabel=y[1]),y[2]!==void 0&&(l.nullLabel=y[2]),l}case"text":{const y={type:"text"};return k[0]&&(y.transform=k[0]),k[1]!==void 0&&k[1]!==""&&(y.truncate=Number(k[1])),y}default:return null}}}),Be("packages/core/src/format/index.js",function(e,D){"use strict";Object.defineProperty(e,"compileFormat",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"specToOoxml",{enumerable:!0,get:function(){return A}});const re=D("packages/core/src/internal/predicates.js"),M=re.isFunction,G=re.isObject,x=D("packages/core/src/internal/warn.js").warnOnce,q=D("packages/core/src/format/number.js"),W=q.compileNumber,I=D("packages/core/src/format/date.js"),K=I.compileDate,R=I.scanPattern,S=D("packages/core/src/format/boolean.js"),k=S.compileBoolean,y=D("packages/core/src/format/text.js"),l=y.compileText,g=D("packages/core/src/format/mask.js"),i=g.compileMask,t=D("packages/core/src/format/shorthand.js"),o=t.parseShorthand,c=t.looksLikeMask,f=t.looksLikeDatePattern,m=D("packages/core/src/format/pattern.js").parseNumberPattern;Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return q.compileNumber}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return I.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return I.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return I.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return I.toDate}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return S.compileBoolean}}),Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return S.toTriState}}),Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return y.compileText}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return g.compileMask}}),Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return g.splitSections}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return g.parseSection}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return t.parseShorthand}}),Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return t.looksLikeMask}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return t.looksLikeDatePattern}});const r=new Set(["decimal","currency","percent","unit"]),s=new Set(["type","locale"]),d={number:new Set(["style","currency","currencyDisplay","decimals","minDecimals","maxDecimals","thousandsSeparator","decimalSeparator","notation","compactDisplay","negative","negativeClass","signed","prefix","suffix","zeroDisplay","nullDisplay","messages","scale","pattern"]),date:new Set(["pattern","dateStyle","timeStyle","timeZone","relative","nullDisplay"]),boolean:new Set(["display","trueLabel","falseLabel","nullLabel","trueIcon","falseIcon"]),text:new Set(["transform","truncate","nullDisplay","emptyDisplay"])},p=new Set(["number","date","boolean","text"]);function u($,j){const E=$.type;if(E===void 0||p.has(E)||!r.has(String(E)))return;const O=j?`"${j}"`:"with no id";x(`format:unknown-style-key:${j||""}:${E}`,`column ${O} has format: { type: "${E}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${E}" instead?`)}function b($,j,E){const O=d[j],N=E?`"${E}"`:"with no id";for(const T of $){if(s.has(T)||O.has(T))continue;const C=Object.keys(d).find(B=>B!==j&&d[B].has(T));C?x(`format:inapplicable:${E||""}:${T}`,`column ${N} has format key "${T}", which applies to a ${C} column, not the ${j} column it was applied to; it is ignored.`):x(`format:unknown:${E||""}:${T}`,`column ${N} has an unrecognised format key "${T}" for its ${j} format; it is ignored.`)}}function a($){if($.type==="number"||$.type==="date"||$.type==="boolean"||$.type==="text")return!0;const j=r.has(String($.style));return!!($.pattern||$.dateStyle||$.timeStyle||$.relative||$.timeZone||$.trueLabel||$.falseLabel||$.display||$.trueIcon||$.falseIcon||$.transform||$.truncate||$.emptyDisplay||j||$.currency||$.decimals!==void 0||$.minDecimals!==void 0||$.maxDecimals!==void 0||$.notation||$.negative||$.scale!==void 0||$.prefix||$.suffix||$.zeroDisplay!==void 0)}function h($,j){if($.type==="number"||$.type==="date"||$.type==="boolean"||$.type==="text")return $.type;if($.pattern){if(c($.pattern))return"number";if(f($.pattern))return"date"}if($.dateStyle||$.timeStyle||$.relative||$.timeZone)return"date";if($.trueLabel||$.falseLabel||$.display||$.trueIcon||$.falseIcon)return"boolean";if($.transform||$.truncate||$.emptyDisplay)return"text";if($.style||$.currency||$.decimals!==void 0||$.minDecimals!==void 0||$.maxDecimals!==void 0||$.notation||$.negative||$.scale!==void 0||$.prefix||$.suffix||$.zeroDisplay!==void 0)return"number";const E=j&&j.base;return E==="number"?"number":E==="date"||E==="dateString"?"date":E==="boolean"?"boolean":"text"}function w($,j=null,E=void 0,O=void 0,N=void 0){if($==null||$==="")return null;const T=G($)?Object.keys($):null;if(typeof $=="function"){const z=(X,Q)=>String($({...Q||{},value:X,locale:E})??"");return z.ooxml=j&&j.excel||"General",z}if(typeof $=="string"){if(c($)){const{format:X,ooxml:Q}=i($,E);return X.ooxml=Q,X}const z=o($)||(f($)?{type:"date",pattern:$}:null);return z?w(z,j,E,O,N):(x(`format:${$}`,`unrecognised format string "${$}"; the value will be stringified`),null)}if(!G($))return x("format:shape","format must be a spec object or a string; ignoring",$),null;if(j&&M(j.format)&&!a($)||j&&M(j.format)&&Array.isArray(j.formatPatterns)&&$.type===void 0)return null;const C=h($,j);C==="date"&&O&&$.timeZone===void 0&&($={...$,timeZone:O}),u($,N),b(T||Object.keys($),C,N);let B;switch(C){case"number":B=W($,E);break;case"date":B=K($,E);break;case"boolean":B=k($,E);break;default:B=l($,E);break}return B.ooxml=A($,C,E,j),B.kind=C,B}const v={yyyy:"yyyy",yy:"yy",MMMM:"mmmm",MMM:"mmm",MM:"mm",M:"m",dd:"dd",d:"d",EEEE:"dddd",EEE:"ddd",HH:"hh",H:"h",hh:"hh",h:"h",mm:"mm",m:"m",ss:"ss",s:"s",SSS:"000",a:"AM/PM"};function A($,j,E=void 0,O=null){if(j==="date"){if($.pattern){let z="";for(const X of R($.pattern))z+=X.token?v[X.token]??X.text:X.text;return z}return O&&O.excel||"yyyy-mm-dd"}if(j==="boolean")return"General";if(j==="text")return"@";if(typeof $.pattern=="string"&&m($.pattern))return String($.pattern).trim();if($.notation==="compact"||$.notation==="scientific")return"General";const N=typeof $.decimals=="number"?$.decimals:typeof $.minDecimals=="number"?$.minDecimals:$.style==="currency"?2:0;let C=`${$.thousandsSeparator===!1?"":"#,#"}#0${N>0?`.${"0".repeat(N)}`:""}`,B="";return $.style==="currency"&&(B+=_(Y($.currency||"USD",E))),$.prefix&&(B+=_($.prefix)),C=B+C,$.style==="percent"&&(C=`${C}%`),$.suffix&&(C+=_($.suffix)),$.negative==="parentheses"?`${C};(${C})`:$.negative==="suffix"?`${C};${C}-`:C}function _($){return`"${String($).split('"').join("")}"`}const V=new Map;function Y($,j){const E=`${$}|${j||""}`;let O=V.get(E);if(O!==void 0)return O;O=$;try{const T=new Intl.NumberFormat(j,{style:"currency",currency:$}).formatToParts(0).find(C=>C.type==="currency");T&&(O=T.value)}catch{}return V.set(E,O),O}}),Be("packages/core/src/columns/types/temporal.js",function(e,D){"use strict";Object.defineProperty(e,"MS_SECOND",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"MS_MINUTE",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"MS_HOUR",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"MS_DAY",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"MS_WEEK",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"toTimeMs",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"zonedParts",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"zoneOffsetAt",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"instantFromParts",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"toEpochMs",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"toDurationMs",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return le}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return he}}),Object.defineProperty(e,"resolveZoneName",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"zoneLabel",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(e,"formatInstant",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"timestampGroupProjector",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(e,"TEMPORAL_INFERENCE_ORDER",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Me}});const re=D("packages/core/src/internal/predicates.js"),M=re.isNil,G=re.isFunction,F=D("packages/core/src/format/date.js"),x=F.toDate,q=F.compilePattern,W=F.compileDate,I=F.toIsoDateTime,K=F.compareIso,R=864e5,S=Object.freeze({}),k=1e3,y=60*k,l=60*y,g=24*l,i=7*g,t=new WeakMap;function o(je,_e){const Pe=je&&je.locale||"",Se=je&&je.column;if(!Se)return Pe?{locale:Pe}:S;const Fe=t.get(Se);if(Fe&&Fe.locale===Pe)return Fe.bag;const We=Se.typeOptions||Se[_e]||(c(Se.format)?Se.format:null),He={...We||S,locale:We&&We.locale||Pe||void 0};return t.set(Se,{locale:Pe,bag:He}),He}function c(je){return je!==null&&typeof je=="object"&&!Array.isArray(je)&&!(je instanceof Date)}function f(je,_e){const Pe=je===null||Number.isNaN(je)?null:je,Se=_e===null||Number.isNaN(_e)?null:_e;return Pe===null?Se===null?0:1:Se===null||Pe<Se?-1:Pe>Se?1:0}const n=/^(\d{1,2})(?:\s*[:.h]\s*(\d{1,2})(?:\s*[:.]\s*(\d{1,2})(?:[.,](\d{1,3}))?)?)?\s*(a\.?m\.?|p\.?m\.?|a|p)?$/i,m=/^(\d{3,6})$/;function r(je,_e,Pe,Se){return!(je>=0&&je<=23)||!(_e>=0&&_e<=59)||!(Pe>=0&&Pe<=59)||!(Se>=0&&Se<=999)?null:je*l+_e*y+Pe*k+Se}function s(je){if(M(je))return null;const _e=String(je).trim();if(_e==="")return null;const Pe=m.exec(_e);if(Pe){const lt=Pe[1];if(lt.length===5)return null;const ot=lt.length===3?1:2;return r(Number(lt.slice(0,ot)),Number(lt.slice(ot,ot+2)),Number(lt.slice(ot+2,ot+4)||0),0)}const Se=n.exec(_e);if(!Se)return null;let Fe=Number(Se[1]);const We=Number(Se[2]||0),He=Number(Se[3]||0),Ye=Se[4]?Number(Se[4].padEnd(3,"0")):0,Qe=Se[5]?Se[5][0].toLowerCase():null;if(Qe){if(Fe<1||Fe>12)return null;Fe=Fe%12,Qe==="p"&&(Fe+=12)}return r(Fe,We,He,Ye)}function d(je){return M(je)||je===""?null:typeof je=="number"?Number.isFinite(je)?(je%g+g)%g:null:je instanceof Date?Number.isNaN(je.getTime())?null:je.getHours()*l+je.getMinutes()*y+je.getSeconds()*k+je.getMilliseconds():s(je)}const p=new Map;function u(je){const _e=je.pattern||"",Pe=je.timeStyle||(je.seconds?"medium":"short"),Se=`${je.locale||""}|${_e}|${Pe}`;let Fe=p.get(Se);if(Fe)return Fe;if(_e)Fe=q(_e,je.locale||void 0,"UTC");else{const We=new Intl.DateTimeFormat(je.locale||void 0,{timeStyle:Pe,timeZone:"UTC"});Fe=He=>We.format(He)}return p.set(Se,Fe),Fe}function b(je,_e){const Pe=_e||S;if(je==null||typeof je!="number"||!Number.isFinite(je))return Pe.nullDisplay??"";const Se=(je%g+g)%g;return u(Pe)(new Date(Se))}function a(je){return je instanceof Date?!Number.isNaN(je.getTime()):typeof je=="number"?Number.isFinite(je)&&je>=0&&je<g:typeof je!="string"||!je.includes(":")?!1:s(je)!==null}function h(je){const _e=d(je);return _e==null?"":b(_e,{pattern:_e%k===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const w=new Map;function v(je){const _e=je||"";let Pe=w.get(_e);return Pe||(Pe=new Intl.DateTimeFormat("en-GB",{timeZone:je||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),w.set(_e,Pe)),Pe}function A(je,_e){const Pe={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const Se of v(_e).formatToParts(new Date(je)))Se.type==="year"?Pe.year=Number(Se.value):Se.type==="month"?Pe.month=Number(Se.value):Se.type==="day"?Pe.day=Number(Se.value):Se.type==="hour"?Pe.hour=Number(Se.value)%24:Se.type==="minute"?Pe.minute=Number(Se.value):Se.type==="second"&&(Pe.second=Number(Se.value));return Pe}function _(je,_e){const Pe=A(je,_e);return Date.UTC(Pe.year,Pe.month-1,Pe.day,Pe.hour,Pe.minute,Pe.second,0)-Math.floor(je/1e3)*1e3}function V(je,_e){const Pe=je.hour||0,Se=je.minute||0,Fe=je.second||0,We=je.ms||0;if(!_e)return new Date(je.year,je.month-1,je.day,Pe,Se,Fe,We).getTime();const He=Date.UTC(je.year,je.month-1,je.day,Pe,Se,Fe,We);let Ye=He-_(He,_e);return Ye=He-_(Ye,_e),Ye}const Y=/(?:Z|[+-]\d{2}:?\d{2})$/i,$=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function j(je,_e){if(M(je))return null;const Pe=String(je).trim();if(Pe==="")return null;const Se=_e&&_e.timeZone||void 0;if(!Y.test(Pe)){const Fe=$.exec(Pe);if(Fe){const We=(Fe[4]||"").trim(),He=We===""?0:s(We);if(He===null)return null;const Ye=V({year:Number(Fe[1]),month:Number(Fe[2]),day:Number(Fe[3]),hour:Math.floor(He/l),minute:Math.floor(He/y)%60,second:Math.floor(He/k)%60,ms:He%k},Se);return Number.isNaN(Ye)?null:new Date(Ye)}}return x(Pe)}function E(je){if(typeof je=="number")return Number.isFinite(je)?je:null;const _e=x(je);return _e?_e.getTime():null}const O=new Map;function N(je){const _e=[je.locale||"",je.pattern||"",je.dateStyle||"",je.timeStyle||"",je.timeZone||"",je.seconds?"1":""].join("|");let Pe=O.get(_e);if(Pe)return Pe;const Se=je.pattern?{type:"date",pattern:je.pattern,timeZone:je.timeZone}:{type:"date",dateStyle:je.dateStyle||"medium",timeStyle:je.timeStyle||(je.seconds?"medium":"short"),timeZone:je.timeZone};return Pe=W(Se,je.locale||void 0),O.set(_e,Pe),Pe}function T(je,_e){const Pe=_e||S,Se=E(je);return Se==null?Pe.nullDisplay??"":N(Pe)(Se)}function C(je){return je instanceof Date?!Number.isNaN(je.getTime()):typeof je!="string"||!$.test(je.trim())?!1:j(je)!==null}const B=Object.freeze([{key:"w",ms:i,intl:"week",long:["week","weeks"],names:["w","wk","wks","week","weeks"]},{key:"d",ms:g,intl:"day",long:["day","days"],names:["d","dy","day","days"]},{key:"h",ms:l,intl:"hour",long:["hour","hours"],names:["h","hr","hrs","hour","hours"]},{key:"m",ms:y,intl:"minute",long:["minute","minutes"],names:["m","min","mins","minute","minutes"]},{key:"s",ms:k,intl:"second",long:["second","seconds"],names:["s","sec","secs","second","seconds"]},{key:"ms",ms:1,intl:"millisecond",long:["millisecond","milliseconds"],names:["ms","msec","msecs","milli","millis","millisecond","milliseconds"]}]),z=new Map;for(const je of B)for(const _e of je.names)z.set(_e,je);const X=Object.freeze(B.filter(je=>je.key!=="w")),Q=/^(\d+(?:\.\d+)?)\s*([a-z]+)\s*(?:,\s*)?/,H=/^\d+(?:\.\d+)?$/,L=/^(\d+):([0-5]?\d)(?::([0-5]?\d))?(?:\.(\d{1,3}))?$/;function Z(je){const _e=je&&je.defaultUnit?z.get(String(je.defaultUnit).toLowerCase()):null;return _e?_e.ms:y}function ee(je){return(je&&je.defaultUnit?z.get(String(je.defaultUnit).toLowerCase()):null)||z.get("m")}function te(je,_e){if(M(je))return null;let Pe=String(je).trim().toLowerCase();if(Pe==="")return null;let Se=1;if(Pe[0]==="-"?(Se=-1,Pe=Pe.slice(1).trim()):Pe[0]==="+"&&(Pe=Pe.slice(1).trim()),Pe==="")return null;const Fe=L.exec(Pe);if(Fe){const Qe=Fe[3]!==void 0,lt=Number(Fe[1])*l+Number(Fe[2])*y+(Qe?Number(Fe[3])*k:0)+(Fe[4]?Number(Fe[4].padEnd(3,"0")):0);return Se*lt}if(H.test(Pe))return Math.round(Se*Number(Pe)*Z(_e||S));let We=Pe,He=0,Ye=0;for(;We!=="";){const Qe=Q.exec(We);if(!Qe)return null;const lt=z.get(Qe[2]);if(!lt)return null;He+=Number(Qe[1])*lt.ms,We=We.slice(Qe[0].length),Ye++}return Ye===0?null:Math.round(Se*He)}function se(je){return M(je)||je===""?null:typeof je=="number"?Number.isFinite(je)?je:null:te(je)}const ne=new Map;function ae(je,_e,Pe){const Se=`${Pe||""}|${_e.intl}`;let Fe=ne.get(Se);if(Fe===void 0){try{Fe=new Intl.NumberFormat(Pe||void 0,{style:"unit",unit:_e.intl,unitDisplay:"long"})}catch{Fe=null}ne.set(Se,Fe)}return Fe?Fe.format(je):`${je} ${je===1?_e.long[0]:_e.long[1]}`}function de(je,_e){return String(je).padStart(_e,"0")}function le(je,_e){const Pe=_e||S;if(je==null||typeof je!="number"||!Number.isFinite(je))return Pe.nullDisplay??"";const Se=Pe.style||"short",Fe=je<0;let We=Math.round(Math.abs(je));const He=Fe?"-":"";if(We===0&&Pe.zeroDisplay!=null)return Pe.zeroDisplay;if(Se==="clock"){const ot=Math.floor(We/l),yt=Math.floor(We/y)%60,Ct=Math.floor(We/k)%60;return`${He}${de(ot,2)}:${de(yt,2)}:${de(Ct,2)}`}if(We===0){const ot=ee(Pe);return Se==="long"?ae(0,ot,Pe.locale):`0${ot.key}`}const Ye=Pe.weeks===!0?B:X,Qe=typeof Pe.maxUnits=="number"&&Pe.maxUnits>0?Pe.maxUnits:Pe.maxUnits===void 0?2:1/0,lt=[];for(const ot of Ye){if(lt.length>=Qe)break;const yt=Math.floor(We/ot.ms);yt!==0&&(We-=yt*ot.ms,lt.push(Se==="long"?ae(yt,ot,Pe.locale):`${yt}${ot.key}`))}return He+lt.join(" ")}function be(je){if(typeof je!="string")return!1;const _e=je.trim();return _e===""||L.test(_e)||!/[a-z]/i.test(_e)?!1:te(_e)!==null}const Ce=Date.UTC(1899,11,30),Ne=new Map;function he(je,_e){const Pe=je||"";let Se=Ne.get(Pe);Se||(Se=new Intl.DateTimeFormat("en-GB",{timeZone:je||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),Ne.set(Pe,Se));const Fe=typeof _e=="number"?_e:Date.now();for(const We of Se.formatToParts(new Date(Fe)))if(We.type==="timeZoneName")return We.value;return""}function ie(je){if(je)return je;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function ue(je,_e){const Pe=ie(je),Se=he(je,_e);return Se?`${Pe} (${Se})`:Pe}function ge(je,_e){if(je&&je.timeZone)return je.timeZone;const Pe=_e&&_e.grid;return(Pe&&G(Pe.get)?Pe.get("timeZone"):void 0)||void 0}function pe(je,_e){const Pe=_e||S,Se=E(je);if(Se==null)return Pe.nullDisplay??"";const Fe=N(Pe)(Se);if(!Pe.showOrigin)return Fe;const We=Pe.originZone;return We?We===(Pe.timeZone||ie(Pe.timeZone))?Fe:`${Fe} (${ue(We,Se)})`:`${Fe} (no origin recorded)`}function Oe(je,_e,Pe,Se){if(_e==="instant"||!_e)return je;const Fe=A(je,Pe);if(_e==="month")return V({year:Fe.year,month:Fe.month,day:1},Pe);if(_e==="week"){const We=Se>=1&&Se<=7?Se:1,Ye=((new Date(Date.UTC(Fe.year,Fe.month-1,Fe.day)).getUTCDay()+6)%7+1-We+7)%7,Qe=new Date(Date.UTC(Fe.year,Fe.month-1,Fe.day-Ye));return V({year:Qe.getUTCFullYear(),month:Qe.getUTCMonth()+1,day:Qe.getUTCDate()},Pe)}return V({year:Fe.year,month:Fe.month,day:Fe.day},Pe)}function ve(je,_e){const Pe=je&&je.group,Se=Pe&&Pe.granularity||"day";if(Se==="instant")return null;const Fe=Pe&&Pe.weekStart;return We=>typeof We=="number"?Oe(We,Se,_e,Fe):We}const ye={time:{base:"number",storage:"float64",matches:a,format:je=>b(d(je.value),o(je,"time")),parse:je=>s(je.text),compare:(je,_e)=>f(d(je),d(_e)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:je=>{const _e=d(je);return _e===null?null:_e/R},toStorage:je=>d(je),toClipboard:h,fromClipboard:s},datetime:{base:"dateString",storage:"dictionary",matches:C,format:je=>T(je.value,o(je,"datetime")),parse:je=>I(j(je.text,o(je,"datetime"))??je.text),compare:K,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(je,_e)=>I(je,_e&&_e.timeZone),toClipboard:je=>M(je)?"":String(je),fromClipboard:je=>I(je)},duration:{base:"number",storage:"float64",matches:be,format:je=>le(se(je.value),o(je,"duration")),parse:je=>te(je.text,o(je,"duration")),compare:(je,_e)=>f(se(je),se(_e)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:je=>{const _e=se(je);return _e===null?null:_e/R},toStorage:je=>se(je),toClipboard:je=>le(se(je),{style:"short",maxUnits:-1}),fromClipboard:je=>te(je)},timestamp:{base:"number",storage:"float64",format:je=>{const _e=o(je,"timestamp");return pe(je.value,{..._e,timeZone:ge(_e,je)})},parse:je=>{const _e=o(je,"timestamp"),Pe=j(je.text,{timeZone:ge(_e,je)});return Pe?Pe.getTime():null},compare:(je,_e)=>f(E(je),E(_e)),groupProjector:(je,_e)=>ve(je,_e),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(je,_e)=>{const Pe=E(je);if(Pe==null)return null;const Se=A(Pe,_e&&_e.timeZone||void 0);return(Date.UTC(Se.year,Se.month-1,Se.day,Se.hour,Se.minute,Se.second)-Ce)/R},toStorage:je=>E(je),toClipboard:je=>{const _e=E(je);return _e==null?"":new Date(_e).toISOString()},fromClipboard:je=>E(je)}},Ae=["datetime","time","duration"],Me=ye}),Be("packages/core/src/internal/lru.js",function(e,D){"use strict";Object.defineProperty(e,"Lru",{enumerable:!0,get:function(){return re}});class re{#e;#t=new Map;#n;constructor(G=256,F=null){this.#e=G,this.#n=F}get size(){return this.#t.size}get max(){return this.#e}set max(G){this.#e=G,this.#r()}has(G){return this.#t.has(G)}get(G){const F=this.#t;if(!F.has(G))return;const x=F.get(G);return F.delete(G),F.set(G,x),x}peek(G){return this.#t.get(G)}set(G,F){const x=this.#t;return x.has(G)&&x.delete(G),x.set(G,F),this.#r(),F}delete(G){const F=this.#t.get(G);return this.#t.delete(G)&&this.#n&&this.#n(F,G),F}clear(){if(this.#n)for(const[G,F]of this.#t)this.#n(F,G);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const G=this.#t;for(;G.size>this.#e;){const F=G.keys().next().value,x=G.get(F);G.delete(F),this.#n&&this.#n(x,F)}}}}),Be("packages/core/src/columns/types/network.js",function(e,D){"use strict";Object.defineProperty(e,"toUint32",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"compareIpv4",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"packCidr",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"cidrParts",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isCidr",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"compareCidr",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"netmask",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"addressCount",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ipv6Groups",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return E}});const M=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/lru.js").Lru,x=4294967295,q=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function W(O){if(M(O))return null;if(typeof O=="string")return I(O);const N=Number(O);return Number.isFinite(N)?N<0?N<-2147483648?null:N>>>0:N>x?null:Math.trunc(N)>>>0:null}function I(O){if(M(O))return null;const N=String(O).trim();if(N==="")return null;const T=q.exec(N);if(!T)return null;let C=0;for(let B=1;B<=4;B++){const z=T[B];if(z.length>1&&z.charCodeAt(0)===48)return null;const X=Number(z);if(X>255)return null;C=C*256+X}return C}function K(O){const N=W(O);return N===null?"":`${N>>>24&255}.${N>>>16&255}.${N>>>8&255}.${N&255}`}function R(O){return typeof O=="string"&&I(O)!==null}function S(O,N){const T=W(O),C=W(N);return T===null?C===null?0:1:C===null||T<C?-1:T>C?1:0}const k=64,y=x*k+32,l=/^(?:0|[1-9]\d?)$/;function g(O,N){return O*k+N}function i(O){if(M(O))return null;if(typeof O=="string"){const C=t(O);return C===null?null:i(C)}if(typeof O=="object"){const C=W(O.address),B=Number(O.prefix);return C===null||!Number.isInteger(B)||B<0||B>32?null:{address:C,prefix:B}}const N=Number(O);if(!Number.isInteger(N)||N<0||N>y)return null;const T=N%k;return T>32?null:{address:(N-T)/k,prefix:T}}function t(O){if(M(O))return null;const N=String(O).trim();if(N==="")return null;const T=N.indexOf("/");if(T<0)return null;const C=I(N.slice(0,T));if(C===null)return null;const B=N.slice(T+1).trim();if(!l.test(B))return null;const z=Number(B);return z>32?null:g(C,z)}function o(O){const N=i(O);return N?`${K(N.address)}/${N.prefix}`:""}function c(O){return typeof O=="string"&&t(O)!==null}function f(O,N){const T=i(O),C=i(N);return T?C?T.address!==C.address?T.address<C.address?-1:1:T.prefix-C.prefix:-1:C?1:0}function n(O){return O===0?0:4294967295<<32-O>>>0}function m(O){const N=i(O);return N?(N.address&n(N.prefix))>>>0:null}function r(O){const N=i(O);return N?(N.address&n(N.prefix)|~n(N.prefix)>>>0)>>>0:null}function s(O){const N=i(O);return N?2**(32-N.prefix):null}function d(O){const N=i(O);return N?N.prefix===32?1:N.prefix===31?2:2**(32-N.prefix)-2:null}function p(O,N){const T=i(O);if(!T)return!1;const C=W(N);if(C===null)return!1;const B=n(T.prefix);return(C&B)>>>0===(T.address&B)>>>0}function u(O,N){const T=m(O),C=m(N);return T===null||C===null?!1:T<=r(N)&&C<=r(O)}const b=/^[0-9a-fA-F]{1,4}$/,a=new F(512);function h(O){if(M(O))return null;let N=String(O).trim();if(N==="")return null;const T=N.indexOf("%");if(T>=0&&(N=N.slice(0,T)),N==="")return null;if(N.indexOf(".")>=0){const H=N.lastIndexOf(":");if(H<0)return null;const L=I(N.slice(H+1));if(L===null)return null;N=`${N.slice(0,H+1)}${(L>>>16&65535).toString(16)}:${(L&65535).toString(16)}`}const C=N.split("::");if(C.length>2)return null;const B=w(C[0]);if(B===null)return null;if(C.length===1)return B.length===8?B:null;const z=w(C[1]);if(z===null)return null;const X=8-B.length-z.length;if(X<1)return null;const Q=B.slice();for(let H=0;H<X;H++)Q.push(0);for(const H of z)Q.push(H);return Q}function w(O){if(O==="")return[];const N=[];for(const T of O.split(":")){if(!b.test(T))return null;N.push(parseInt(T,16))}return N}function v(O){if(typeof O!="string")return h(O);if(a.has(O))return a.get(O);const N=h(O);return a.set(O,N),N}function A(O){if(O[0]===0&&O[1]===0&&O[2]===0&&O[3]===0&&O[4]===0&&O[5]===65535)return`::ffff:${K((O[6]<<16|O[7])>>>0)}`;let N=-1,T=0,C=-1,B=0;for(let Q=0;Q<8;Q++)O[Q]===0?(C<0?(C=Q,B=1):B++,B>T&&(T=B,N=C)):(C=-1,B=0);if(T<2)return O.map(Q=>Q.toString(16)).join(":");const z=O.slice(0,N).map(Q=>Q.toString(16)).join(":"),X=O.slice(N+T).map(Q=>Q.toString(16)).join(":");return`${z}::${X}`}function _(O){const N=h(O);return N===null?null:A(N)}function V(O){return _(O)??""}function Y(O){return typeof O=="string"&&O.indexOf(":")>=0&&h(O)!==null}function $(O,N){const T=v(O),C=v(N);if(!T)return C?1:0;if(!C)return-1;for(let B=0;B<8;B++)if(T[B]!==C[B])return T[B]<C[B]?-1:1;return 0}const j=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:R,parse:O=>I(O.text),compare:S,format:O=>K(O.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:O=>W(O),toClipboard:O=>K(O),fromClipboard:O=>I(O)},cidr:{base:"number",storage:"float64",matches:c,parse:O=>t(O.text),compare:f,format:O=>o(O.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:O=>{const N=i(O);return N===null?null:g(N.address,N.prefix)},toClipboard:O=>o(O),fromClipboard:O=>t(O)},ipv6:{base:"text",storage:"dictionary",matches:Y,parse:O=>_(O.text),compare:$,format:O=>V(O.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:O=>_(O),toClipboard:O=>V(O),fromClipboard:O=>_(O)}}),E=j}),Be("packages/core/src/i18n/catalogue.js",function(e,D){"use strict";Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return x}});const re=D("packages/core/src/registry/free-tier-notice.js"),M=re.FREE_TIER_NOTICE,G=re.WATERMARK_TEXT,F=Object.freeze({"count.rows":{one:"{count} row",other:"{count} rows"},"count.comments":{one:"{count} comment",other:"{count} comments"},"comments.someUnresolved":"{comments}, {unresolved} unresolved","comments.allResolved":"{comments}, all resolved","count.unresolvedComments":{one:"{count} unresolved comment",other:"{count} unresolved comments"},"count.items":{one:"{count} item",other:"{count} items"},"count.keys":{one:"{count} key",other:"{count} keys"},"count.values":{one:"value",other:"values"},"count.waiting":{one:"{count} waiting",other:"{count} waiting"},"count.rowsAdded":{one:"{count} row added",other:"{count} rows added"},"count.rowsRemoved":{one:"{count} row removed",other:"{count} rows removed"},"value.empty":"empty","a11y.sort.cleared":"Sort cleared","a11y.sort.by":"Sorted by {columns}","a11y.sort.column":"{column} {direction}","a11y.sort.ascending":"ascending","a11y.sort.descending":"descending","a11y.filter.cleared":"Filter cleared, {rows}","a11y.filter.applied":"Filtered to {shown} of {total}","a11y.find.count":{one:"{current} of {count} match",other:"{current} of {count} matches"},"a11y.find.countLoaded":{one:"{current} of {count} match in loaded rows",other:"{current} of {count} matches in loaded rows"},"a11y.find.none":"No matches","a11y.find.noneLoaded":"No matches in loaded rows","a11y.selection.cleared":"Selection cleared","a11y.selection.count":{one:"{count} row selected",other:"{count} rows selected"},"tabs.tablist":"Tabs","a11y.tabs.selected":"{label} tab selected","a11y.scrollbar.horizontal":"Horizontal scrollbar","a11y.scrollbar.vertical":"Vertical scrollbar","designer.canvas":"Dashboard canvas","designer.chrome":"Designer tools","designer.page":"Page {n}","a11y.designer.edit":"Edit mode","a11y.designer.view":"View mode","layout.region":"Dashboard layout","layout.move":"Move {title}","layout.resize":"Resize {title}","layout.close":"Close {title}","a11y.layout.grabbed":"{title} grabbed, column {x} of {columns}, row {y}","a11y.layout.position":"{title}, column {x} of {columns}, row {y}","a11y.layout.dropped":"{title} dropped, column {x} of {columns}, row {y}","a11y.layout.cancelled":"{title} move cancelled","a11y.layout.resizeCancelled":"{title} resize cancelled","a11y.layout.reverted":"{title} returned to column {x}, row {y}","a11y.layout.resizeGrabbed":"{title} resize grabbed, {w} by {h} cells","a11y.layout.resizeStep":"{title}, {w} by {h} cells","a11y.layout.resized":"{title} resized to {w} by {h} cells","a11y.layout.closed":"{title} closed","layout.maximise":"Maximise {title}","layout.minimise":"Minimise {title}","layout.restore":"Restore {title}","a11y.layout.maximised":"{title} maximised, filling the dashboard; press Escape to restore it","a11y.layout.minimised":"{title} minimised","a11y.layout.restored":"{title} restored to column {x}, row {y}","a11y.group.cleared":"Grouping cleared","a11y.group.by":"Grouped by {columns}","a11y.group.expanded":"{label} expanded, {rows} shown","a11y.group.collapsed":"{label} collapsed, {rows} shown","a11y.page.position":"Page {page} of {pages}","a11y.updates.paused":"Updates paused","a11y.updates.resumed":"Updates resumed","a11y.edit.refusedOne":"Edit to {column} was refused and put back to {value}{reason}","a11y.edit.refusedMany":{one:"{count} edit was refused and put back{reason}",other:"{count} edits were refused and put back{reason}"},"a11y.edit.reason":", {reason}","a11y.history.undo":"Undid {label}","a11y.history.redo":"Redid {label}","a11y.history.undoLast":"Undid the last change","a11y.history.redoLast":"Redid the last change","a11y.column.cannotResize":"{column} cannot be resized","a11y.column.resized":"{column} is {width} pixels wide","a11y.column.atMinimum":"{column} is at its narrowest, {width} pixels","a11y.column.atMaximum":"{column} is at its widest, {width} pixels","a11y.column.cannotMove":"{column} cannot be moved","a11y.column.alreadyFirst":"{column} is already first in its group","a11y.column.alreadyLast":"{column} is already last in its group","a11y.column.cannotMoveThere":"{column} cannot be moved there","a11y.column.moved":"{column} moved to position {at} of {of}","a11y.group.formed":"{column} grouped with {other} in a new band","a11y.group.dissolved":"band {group} dissolved","a11y.group.renamed":"band renamed to {group}","a11y.group.moved":"band {group} moved to position {at} of {of}","a11y.column.addedToGroup":"{column} added to band {group}","a11y.column.removedFromGroup":"{column} removed from its band","a11y.column.notInGroup":"{column} is not in a band","a11y.column.cannotGroup":"{column} cannot be grouped","a11y.group.cannotMove":"band {group} cannot be moved there","columngroup.newGroup":"New group","columngroup.rename":"Rename band","columngroup.dissolve":"Dissolve band","columngroup.group":"Group with adjacent column","columngroup.untitled":"Untitled band","panel.bandCollapse":"Collapse band {band}","panel.bandExpand":"Expand band {band}","panel.bandVisible":"Show or hide every column in band {band}","panel.bandRenameFor":"Rename band {band}","panel.bandDissolveFor":"Dissolve band {band}","header.filter":"Filter {column}","header.menu":"Column menu for {column}","header.toggleGroup":"Toggle {group}","header.dragHint":"Drag {column} to reorder, or onto another column to group","header.dragRole":"draggable column header","header.group":"group","header.selectAllRows":"Select all rows","header.clearSelection":"Clear selection","cell.selectRow":"Select row","cell.detail.show":"Show detail","cell.detail.hide":"Hide detail","cell.detail.showInPane":"Show in the detail pane","cell.detail.showingInPane":"Showing in the detail pane","cell.group.expand":"Expand","cell.group.collapse":"Collapse","cell.delta.up":"up","cell.delta.down":"down","cell.delta.unchanged":"unchanged","cell.delta.moved":"{direction} {magnitude}","cell.delta.describedUnchanged":"{label}, unchanged","cell.delta.described":"{label}, {direction} by {magnitude}","cell.qr.of":"QR code for {text}","cell.qr.empty":"No QR code","cell.barcode.of":"Barcode for {text}","cell.barcode.empty":"No barcode","cell.barcode.invalid":"Invalid value for this barcode","cell.rating.of":"{rating} of {max}","cell.rating.empty":"Not rated","cell.stage.of":"Stage {current} of {total}: {label}","cell.stage.empty":"No stage","a11y.panel.cannotMove":"{column} cannot be moved","a11y.panel.alreadyFirst":"{column} is already first","a11y.panel.alreadyLast":"{column} is already last","a11y.panel.moved":"{column} moved to position {at} of {of}","a11y.panel.removedFrom":"{column} removed from {list}","a11y.panel.addedTo":"{column} added to {list}","a11y.panel.cannotAddTo":"{column} cannot be added to {list}","a11y.annotate.erased":"Annotation removed","a11y.annotate.noMarks":"No annotations to erase","a11y.annotate.focusedMark":"Mark {at} of {of} selected","a11y.annotate.confirmClear":"Clear all annotations? Choose Clear or Keep.","a11y.annotate.cleared":"All annotations cleared","a11y.range.written":{one:"{count} cell updated",other:"{count} cells updated"},"a11y.range.cleared":{one:"{count} cell cleared",other:"{count} cells cleared"},"paste.preview.title":"Review paste","paste.preview.summary":{one:"{changes} cell will change, {rejected} rejected.",other:"{changes} cells will change, {rejected} rejected."},"paste.preview.changesHeading":{one:"{count} change",other:"{count} changes"},"paste.preview.rejectedHeading":{one:"{count} rejected",other:"{count} rejected"},"paste.preview.colOld":"Current","paste.preview.colNew":"New","paste.preview.colCell":"Cell","paste.preview.colReason":"Reason","paste.preview.empty":"This paste would change nothing.","paste.preview.confirm":"Apply","paste.preview.cancel":"Cancel","paste.preview.reason.permission":"Not permitted","paste.preview.reason.readOnly":"Read-only","paste.preview.reason.validation":"Invalid value","paste.preview.reason.locked":"Being edited","paste.preview.reason.missing":"No such cell","a11y.paste.previewOpened":{one:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel.",other:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel."},"a11y.paste.cancelled":"Paste cancelled; nothing changed","status.total":"{rows}","status.counting":"Counting rows…","status.shownOfTotal":"{shown} of {total}","status.selected":"{count} selected","status.selectedAcrossSource":"{count} selected across the source","status.selectedAcrossSourceCounting":"All matching rows selected, counting…","status.count":"Count {count}","status.loading":"Loading {count}…","status.loadingOf":"Loading {loaded} of {total} ({percent}%)","status.stat.sum":"Sum","status.stat.min":"Min","status.stat.max":"Max","status.stat.avg":"Avg","status.paused":"Paused","status.pausedWaiting":"Paused · {waiting}","status.coalesced":"{count} coalesced","status.hiddenComments":"{comments} on hidden rows","pagination.label":"Pagination","pagination.first":"First page","pagination.previous":"Previous page","pagination.next":"Next page","pagination.last":"Last page","pagination.page":"Page","pagination.ofPages":"of {pages}","pagination.summary":"{from}–{to} of {total}","pagination.pageSize":"Rows per page","pagination.range":"{from}–{to}","pagination.counting":"{from}–{to}, counting…","pagination.jump":"Page number, press Enter to jump","pagination.jumpBounded":"Page number, 1 to {pages}, press Enter to jump","panel.columns":"Columns","panel.filters":"Filters","panel.views":"Views","panel.quickFilter":"Quick filter","find.label":"Find in grid","find.placeholder":"Find in grid","find.next":"Next match","find.previous":"Previous match","find.close":"Close find","find.matchCase":"Match case","find.wholeCell":"Whole cell","find.columnScope":"Search in","find.allColumns":"All columns","find.count":"{current} of {total}","find.countPartial":"{current} of {total} so far","find.none":"No matches","find.searching":"Searching…","find.loadedRows":"in loaded rows","panel.formatting":"Formatting","panel.statistics":"Statistics","stat.noData":"No data","stat.tone.good":"good","stat.tone.bad":"bad","stat.tone.flat":"flat","panel.regression":"Regression","panel.compare":"Compare","panel.insights":"Insights","panel.compareGroups":"Compare groups","panel.explain":"Explain","insights.subset":"Filtered subset vs whole","insights.dataset":"This grid vs another dataset","insights.groups":"Group comparison","insights.noFilter":"Filter the grid to compare the subset against the whole.","insights.by":"Group by","insights.test":"Test","insights.effect":"Effect size","insights.interval":"Confidence interval","insights.pValue":"p-value","insights.smallSample":"small sample — interpret with care","insights.needGroups":"Choose two columns with groups to compare.","compareGroups.noTest":"Not enough readings, or no variation, in at least one group.","insights.empty":"No columns to analyse.","insights.anomalies":"Anomalies","insights.anomalyCount":"{count} flagged of {n}","insights.anomalyMethod":"Method","insights.anomalyThreshold":"Threshold","anomaly.chip":"{count} anomalies flagged","anomaly.chipActive":"Showing {count} anomalies — clear","compare.first":"First column","compare.second":"Second column","compare.needTwo":"Two numeric columns are needed to compare","compare.noPairs":"No rows have a value in both","compare.pairs":"{count} pairs","compare.pearson":"Correlation (Pearson)","compare.spearman":"Rank correlation (Spearman)","compare.kendall":"Kendall’s tau","compare.covariance":"Covariance","compare.slope":"Slope","compare.intercept":"Intercept","compare.r2":"R²","compare.stdError":"Standard error","compare.weighted":"Weighted average","panel.zone.group":"row groups","panel.zone.values":"values","panel.zone.pivot":"pivot columns","groupZone.label":"Row groups","groupZone.title":"Group by","groupZone.hint":"Drag a column here to group rows by its values","groupZone.chip":"{column}, group {at} of {of}","groupZone.remove":"Stop grouping by {column}","groupZone.add":"Add a group","total.sum":"Sum","total.avg":"Average","total.min":"Min","total.max":"Max","total.count":"Count","total.countValues":"Count of values","total.first":"First","total.last":"Last","total.custom":"Total","total.median":"Median","total.p25":"25th percentile","total.p75":"75th percentile","total.p90":"90th percentile","total.p95":"95th percentile","total.p99":"99th percentile","total.iqr":"Interquartile range","total.mad":"Median absolute deviation","total.variance":"Variance","total.varianceP":"Variance (population)","total.stddev":"Standard deviation","total.stddevP":"Standard deviation (population)","total.range":"Range","total.distinct":"Distinct","total.mode":"Mode","total.skewness":"Skewness","total.kurtosis":"Kurtosis","total.geomean":"Geometric mean","total.harmean":"Harmonic mean","total.sumSquares":"Sum of squares","total.weightedAvg":"Weighted average","total.argmin":"Lowest by","total.argmax":"Highest by","total.hhi":"Concentration (HHI)","total.entropy":"Entropy","total.evenness":"Evenness","total.top3Share":"Top 3 share","total.top10Share":"Top 10 share","total.gini":"Gini coefficient","total.trimmedMean":"Trimmed mean","total.winsorizedMean":"Winsorized mean","total.robustOutliers":"Outliers (robust)","total.jarqueBera":"Jarque–Bera","total.passRate":"Pass rate","total.failureCount":"Failures","stats.column":"Column","stats.choose":"Choose a column to profile","stats.noColumns":"No numeric columns to profile","stats.noValues":"Nothing numeric in this column","stats.count":"Count","stats.present":"Present","stats.missing":"Missing","stats.distinct":"Distinct","stats.min":"Minimum","stats.max":"Maximum","stats.mean":"Mean","stats.median":"Median","stats.q1":"Lower quartile","stats.q3":"Upper quartile","stats.iqr":"Interquartile range","stats.stddev":"Standard deviation","stats.outliers":"Outliers","stats.distribution":"Distribution","stats.distribution.detail":"Distribution: rows per range","stats.bin":"{count} between {from} and {to}","stats.topValues":"Top values","stats.section.shape":"Shape","stats.section.robust":"Robust","stats.section.concentration":"Concentration","stats.section.capability":"Capability","stats.cp":"Cp","stats.cpk":"Cpk","stats.pp":"Pp","stats.ppk":"Ppk","stats.outOfSpec":"Out of specification","stats.filtered":"Over the {count} filtered rows","stats.unavailable":"Not computed by the source: {stats}.","stats.unavailable.notPlain":"`{column}` is not a plain column the engine can name","stats.unavailable.where":"a `where` predicate is in force ({list}), which only the browser can run","stats.unavailable.filter":"the grid's filter did not fully push to the engine","stats.unavailable.quick":"the quick search did not push to the engine","stats.unavailable.client":'the source did not compute "{fn}" in the engine ({reason}); set the pushdown source\'s `{setting}`',"stats.unavailable.outliers":"the count of values outside Tukey's fences is not an engine aggregate","stats.unavailable.histogram":"the shape of the column is not an engine aggregate","stats.unavailable.topValues":"the source did not answer a grouped count in the engine","explain.column":"Value","explain.by":"Break down by","explain.byRow":"Each row","explain.noColumns":"No numeric columns to explain","explain.unavailable":"Nothing to explain in this column","explain.total":"{fn}: {total}","explain.weighted":"weighted effects","explain.single":"one contributor","explain.delta":"was {before}, now {after} (Δ {delta})","explain.breakdown":"Contributors","explain.contributor":"Contributor","explain.count":"Rows","explain.value":"Value","explain.contribution":"Contribution","explain.share":"Share","explain.change":"Change","explain.before":"Before","explain.after":"After","explain.effect":"Effect","explain.kind.new":"New","explain.kind.dropped":"Dropped","explain.kind.changed":"Changed","explain.narrative":"Explanation","explain.narrative.lead":"{top} accounts for {share}; the {fn} is {total}.","explain.narrative.next":"{next} follows at {share}.","explain.narrative.driver":"The change of {delta} was driven most by {top} ({effect}).","explain.narrative.driverNext":"{next} ({kind}) moved it {effect}.","explain.narrative.none":"Nothing contributed to this total.","explain.narrative.noChange":"Nothing changed between the two states.","regression.noModel":"No model configured. Set predictors and a response on the panel.","regression.cannotFit":"The model cannot be fitted over the current rows.","regression.observations":"Fitted over {count} rows","regression.r2":"R²","regression.adjR2":"Adjusted R²","regression.coefficients":"Coefficients","regression.term":"Term","regression.estimate":"Estimate ± SE","regression.stdError":"Std error","regression.t":"t","regression.p":"p","regression.vif":"Variance inflation (VIF)","regression.heteroscedasticity":"Heteroscedasticity (Breusch–Pagan)","regression.heteroscedastic":"Heteroscedastic: BP {statistic}, p {p}","regression.homoscedastic":"No heteroscedasticity detected: BP {statistic}, p {p}","menu.sortAscending":"Sort ascending","menu.sortDescending":"Sort descending","menu.clearSort":"Clear sort","menu.groupBy":"Group by this column","menu.ungroup":"Stop grouping by this column","menu.hideColumn":"Hide column","menu.pinStart":"Pin to start","menu.pinEnd":"Pin to end","menu.unpin":"Unpin","menu.autosize":"Fit to content","ai.valuesNotAmongOptions":'{values} {shown} not among the options for "{column}"',"menu.clearCells":{one:"Clear cell",other:"Clear {count} cells"},"menu.fillDown":"Fill down","menu.copy":"Copy","menu.copyWithHeaders":"Copy with headers","menu.paste":"Paste","menu.filterEllipsis":"Filter…","menu.columnStatistics":"Column statistics","menu.compareGroups":"Compare groups","menu.explain":"Explain this number","menu.pinColumn":"Pin column","menu.sizeToFit":"Size to fit content","menu.sizeAllToFit":"Size all columns to fit","menu.width":"Width","menu.narrower":"Narrower","menu.wider":"Wider","menu.moveColumn":"Move column","menu.moveLeft":"Move left","menu.moveRight":"Move right","menu.moveToStart":"Move to start","menu.moveToEnd":"Move to end","menu.unpivot":"Remove from pivot","menu.pivotBy":"Pivot by this column","menu.stopTotalling":"Stop totalling","menu.totalColumn":"Total this column","menu.aggregate":"Aggregate","menu.aggregateNone":"None","menu.aggregateGroup":"Group subtotals","menu.aggregateGrand":"Grand total","menu.aggregateSame":"Same as total","menu.redactColumn":"Redact column","menu.stopRedacting":"Stop redacting","menu.stopRedactingAll":"Stop redacting everything","menu.sortGroupsAscending":"Sort groups ascending","menu.sortGroupsDescending":"Sort groups descending","menu.filterGroups":"Filter groups…","menu.expandAll":"Expand all","menu.collapseAll":"Collapse all","menu.clearGrouping":"Clear grouping","menu.colour":"Colour","menu.importCsv":"Import rows from CSV…","import.title":"Import rows","import.clipboard":"the clipboard","import.summary":{one:"{count} row from {name}",other:"{count} rows from {name}"},"import.opened":{one:"Import preview open, {count} row",other:"Import preview open, {count} rows"},"import.done":{one:"{count} row imported",other:"{count} rows imported"},"import.confirm":"Import","import.cancel":"Cancel","import.colSource":"Column","import.colField":"Maps to","import.colType":"Type","import.skip":"— skip —","import.mapLabel":'Map "{source}" to a field',"import.modeLabel":"On import","import.sheetLabel":"Sheet","import.append":"Add to existing rows","import.replace":"Replace all rows","menu.deleteRow":{one:"Delete row",other:"Delete {count} rows"},"toolbar.undo":"Undo","toolbar.redo":"Redo","toolbar.undoLabelled":"Undo {label}","toolbar.redoLabelled":"Redo {label}","toolbar.exportCsv":"Export to CSV","toolbar.exportExcel":"Export to Excel","toolbar.clipboard":"Copy visible rows to the clipboard","toolbar.print":"Print","toolbar.pause":"Hold incoming updates","toolbar.resume":"Resume updates","toolbar.applyHeld":{one:"Apply {count} held update",other:"Apply {count} held updates"},"toolbar.restoreView":"Restore the default view","toolbar.maximiseGrid":"Maximise the grid to fill the window","toolbar.restoreSize":"Restore the grid to the page (Esc)","toolbar.annotate.pen":"Draw freehand","toolbar.annotate.arrow":"Draw an arrow","toolbar.annotate.rect":"Draw a rectangle","toolbar.annotate.highlight":"Highlight","toolbar.annotate.erase":"Erase","toolbar.annotate.clearAll":"Clear all annotations","toolbar.annotate.clearAllConfirm":"Clear","toolbar.annotate.clearAllKeep":"Keep","overlay.noRows":"No rows to show","overlay.noResults":"No rows match the current filters","overlay.loading":"Loading…","overlay.error":"Something went wrong","overlay.loadingRows":"Loading rows {from} to {to}","overlay.rowError":"Failed to load","comments.panel":"Cell comments","comments.close":"Close comments","comments.write":"Write a comment","comments.post":"Comment","comments.delete":"Delete","comments.valueMoved":"Written when the value was {was}: it is now {now}.","comments.resolve":"Resolve","comments.reopen":"Reopen","comments.loading":"Loading…","comments.empty":"No comments yet.","comments.unknownAuthor":"Unknown","comments.edited":"{time} (edited)","comments.cellTitle":"{column}: {row}","presence.hidden":{one:"{count} not in view",other:"{count} not in view"},"presence.someoneElse":"someone else","a11y.presence.refused":"This cell is being edited by {name}","presence.peer":"{name}: jump to their cursor","presence.peerIdle":"{name}, idle: jump to their cursor","presence.peerHidden":"{name}, not in the current view","facets.filter":"{column} distribution filter","header.totalOf":"{total} of {column}","diff.before":"Was: {value}","diff.empty":"(empty)","kanban.columnCards":{one:"{title}, {count} card",other:"{title}, {count} cards"},"kanban.laneCards":{one:"{lane}, {title}, {count} card",other:"{lane}, {title}, {count} cards"},"kanban.blocked":"Blocked","kanban.ready":"Ready","kanban.blockedBy":{one:"blocked by {count} card",other:"blocked by {count} cards"},"kanban.card.assignedTo":"Assigned to {names}","kanban.card.overdue":"Overdue","kanban.card.dueSoon":"Due soon","kanban.card.progress":"{percent}% complete","kanban.card.checklist":"{done} of {total} done","gantt.lag":"+{days}d","gantt.lead":"{days}d","gantt.a11y.moved":"{name} moved to {date}","gantt.a11y.day":"day {day}","gantt.a11y.resized":"{name} resized to {days} days","gantt.a11y.linkFrom":"Linking from {name}. Focus the successor and press L.","gantt.a11y.linked":"Linked {from} to {to}, finish to start.","gantt.a11y.linkCancelled":"Link cancelled.","gantt.a11y.deleted":"{name} deleted.","gantt.a11y.readOnly":"Read-only.","gantt.row.moveHandle":"Drag to reorder or re-parent {name}","gantt.a11y.rowMoved":"{name} moved.","gantt.a11y.rowReparented":"{name} moved under {parent}.","gantt.a11y.rowPromoted":"{name} moved to the top level.","gantt.a11y.rowMoveCancelled":"Move cancelled.","gantt.a11y.copied":"{count} tasks copied.","gantt.a11y.cut":"{count} tasks cut.","gantt.a11y.pasted":"{count} tasks pasted.","gantt.task.newName":"New task","gantt.a11y.taskAdded":"{name} added.","gantt.menu.addAbove":"Add task above","gantt.menu.addBelow":"Add task below","gantt.menu.addChild":"Add subtask","gantt.menu.addSuccessor":"Add successor","gantt.menu.addPredecessor":"Add predecessor","gantt.menu.toMilestone":"Convert to milestone","gantt.menu.toTask":"Convert to task","gantt.menu.delete":"Delete task","gantt.a11y.linkCycle":"Linking {from} to {to} would create a cycle; link not created.","gantt.a11y.linkCreated":"{from} linked to {to}, {type}.","gantt.a11y.linkDeleted":"Link from {from} to {to} deleted.","gantt.a11y.linkLabel":"Link, {from} to {to}, {type}","gantt.linkEditor.title":"Edit link from {from} to {to}","gantt.linkEditor.type":"Link type","gantt.linkEditor.lag":"Lag, in days","gantt.linkEditor.apply":"Apply","gantt.linkEditor.delete":"Delete link","gantt.linkEditor.cancel":"Cancel","gantt.a11y.undone":"Undone.","gantt.a11y.redone":"Redone.","gantt.a11y.nothingToUndo":"Nothing to undo.","gantt.a11y.nothingToRedo":"Nothing to redo.","gantt.workload.title":"Resource workload","gantt.workload.resource":"Resource","gantt.workload.total":"Total","gantt.workload.unassigned":"Unassigned","gantt.workload.ungrouped":"No group","gantt.workload.cell":"{hours} h from {date}","gantt.workload.over":"{hours} h from {date}, over a capacity of {capacity} h","gantt.workload.expand":"Show {name}’s tasks","gantt.workload.collapse":"Hide {name}’s tasks","gantt.workload.expandGroup":"Show the {name} group","gantt.workload.collapseGroup":"Hide the {name} group","gantt.workload.unitToggle":"Hours / % / Cost","gantt.workload.unitHours":"Showing hours","gantt.workload.unitPercent":"Showing percent of capacity","gantt.workload.unitCost":"Showing cost","gantt.workload.cellPercent":"{percent}% from {date}","gantt.workload.overPercent":"{percent}% from {date}, over capacity","gantt.workload.cellNoCapacity":"No available hours from {date}","gantt.workload.cellCost":"{cost} from {date}","gantt.workload.otherProjectLabel":"{name} (other project)","gantt.workload.external":"External booking","gantt.a11y.hoursSet":"{name}: {hours} h from {date}","gantt.a11y.hoursCleared":"{name}: no hours from {date}","gantt.a11y.hoursRefused":"{date} is not a working day; {name} was not changed.","gantt.histogram.title":"Resource histogram","gantt.histogram.tableTitle":"Resource histogram data","gantt.histogram.resource":"Resource","gantt.histogram.period":"Period","gantt.histogram.hours":"Hours","gantt.histogram.percent":"Percent of capacity","gantt.histogram.cost":"Cost","gantt.histogram.capacity":"Capacity","gantt.histogram.overAllocated":"Over-allocated","gantt.histogram.yes":"Yes","gantt.histogram.no":"No","gantt.histogram.tip":"{name}, {from} to {to}: {value}{capacity}{tasks}","gantt.histogram.tipHours":"{hours} h","gantt.histogram.tipPercent":"{percent}% of capacity","gantt.histogram.tipCost":"{cost}","gantt.histogram.tipCapacity":", capacity {hours} h","gantt.histogram.tipTasks":" ({tasks})","gantt.histogram.tipOver":", over capacity","gantt.histogram.tipNoCapacity":"no available hours","gantt.picker.title":"Assign resources to {name}","gantt.picker.open":"Edit assignments for {name}","gantt.picker.search":"Search resources","gantt.picker.list":"Resources","gantt.picker.selected":"Assigned resources","gantt.picker.load":"{load}% booked of {capacity}% over these dates","gantt.picker.none":"No matching resources","gantt.picker.units":"{name}, units in percent","gantt.picker.remove":"Remove {name}","gantt.picker.apply":"Apply","gantt.picker.cancel":"Cancel","gantt.picker.warn":"{name} would be over-allocated: {load}% booked of {capacity}%","gantt.picker.ok":"No resource would be over-allocated","gantt.picker.assign":"Assign","gantt.col.effort":"Effort","gantt.col.units":"Units","gantt.unscheduled":"Unscheduled","gantt.col.unscheduled":"Unscheduled","gantt.inactive":"Inactive","gantt.col.inactive":"Inactive","gantt.col.slack":"Slack","gantt.col.deadline":"Deadline","gantt.col.constraint":"Constraint","gantt.col.constraintDate":"Constraint date","gantt.col.earlyStart":"Early start","gantt.col.lateStart":"Late start","gantt.col.lateFinish":"Late finish","gantt.col.baselineStart":"Baseline start","gantt.col.baselineEnd":"Baseline finish","gantt.col.variance":"Variance","gantt.col.note":"Note","gantt.col.sequence":"#","gantt.col.predecessors":"Predecessors","gantt.col.successors":"Successors","gantt.link.invalid":"Cannot read “{token}” as a link. Write a task number, a type and a lag, like 3FS+2; links not changed.","gantt.link.unknownRef":"No task is numbered “{token}”; links not changed.","gantt.link.self":"“{token}” links a task to itself; links not changed.","gantt.link.duplicate":"“{token}” repeats a link already listed; links not changed.","gantt.link.cycle":"“{token}” would create a cycle; links not changed.","gantt.constraint.ASAP":"As soon as possible","gantt.constraint.MSO":"Must start on","gantt.constraint.MFO":"Must finish on","gantt.constraint.ALAP":"As late as possible","gantt.constraint.SNET":"Start no earlier than","gantt.constraint.SNLT":"Start no later than","gantt.constraint.FNET":"Finish no earlier than","gantt.constraint.FNLT":"Finish no later than","gantt.row.ancestor":"Shown because a task inside it matches the filter","gantt.progress.handle":"Drag to set the progress of {name}","gantt.a11y.progress":"{name} {percent}% complete","gantt.col.name":"Task name","gantt.col.start":"Start","gantt.col.end":"Finish","gantt.col.duration":"Duration","gantt.col.assignee":"Assignee","gantt.col.progress":"%","gantt.col.wbs":"WBS","gantt.zoom.label":"Zoom","gantt.zoom.day":"Day","gantt.zoom.week":"Week","gantt.zoom.month":"Month","gantt.zoom.quarter":"Quarter","gantt.zoom.fit":"Fit to plan","gantt.tip.range":"{from} to {to}","gantt.tip.duration":"{days}d","gantt.tip.slack":"slack {days}d","gantt.tip.effort":"{hours}h","gantt.tip.row":"{label}: {value}","gantt.tip.start":"Start","gantt.tip.end":"End","gantt.tip.date":"Date","gantt.tip.durationLabel":"Duration","gantt.tip.durationValue":"{days} days","gantt.tip.complete":"Complete","gantt.tip.effortLabel":"Effort","gantt.tip.effortValue":"{hours} h","gantt.tip.assigned":"Assigned","gantt.tip.cost":"Cost","gantt.tip.slackLabel":"Slack","gantt.tip.slackValue":"{days} days","gantt.tip.deadline":"Deadline","gantt.mode.fixedDuration":"Fixed duration","gantt.mode.fixedEffort":"Fixed effort","gantt.mode.fixedUnits":"Fixed units","gantt.scurve.spi":"SPI {index}","gantt.scurve.cpi":"CPI {index}","gantt.print.page":"Page {page} of {pages}","gantt.print.printed":"Printed {date}","gantt.dataBand.title":"Data band","gantt.dataBand.name":"Task","gantt.dataBand.resource":"Resource","gantt.dataBand.total":"Total","gantt.dataBand.unassigned":"Unassigned","gantt.dataBand.collapse":"Collapse {name}","gantt.dataBand.expand":"Expand {name}","gantt.dataBand.cell":"{name}, {date}: {value}","gantt.issues.title":"Scheduling conflicts","gantt.issues.empty":"No scheduling conflicts","gantt.issues.count":"{count} scheduling conflicts","gantt.issues.toggle":"Toggle the conflicts panel","gantt.issues.cycle":"Circular dependency: {tasks}","gantt.issues.constraint":"{task} cannot meet its {constraint} constraint of {date}","gantt.issues.lock":"{task} is locked but a dependency would move it","gantt.issues.deadline":"{task} finishes after its deadline of {date}","gantt.issues.fixRemoveLink":"Remove link","gantt.issues.fixAsap":"Set as soon as possible","gantt.issues.fixUnlock":"Unlock task","gantt.issues.fixClearDeadline":"Clear deadline","gantt.resize.startHandle":"Drag to change the start of {name}","gantt.a11y.resizedStart":"{name} start moved to {date}, now {days} days","gantt.a11y.startEdge":"Start edge can be resized: drag the left edge, or press Ctrl+Shift+Left or Right.","gantt.a11y.chain":"Dependency chain highlighted: {preds} predecessors, {succs} successors.","timeline.scrub":"Scrub through recent changes","timeline.goLive":"Go live","timeline.returnToPresent":"Return to the present","a11y.fillHandle":"Drag to fill","panel.icons":"Icons","value.tooLong":"Too long","dataview.label":"Items","dataview.empty":"No items","dataview.reorder.sorted":"Items cannot be reordered while the view is sorted","dataview.reorder.filtered":"Items cannot be reordered while a filter is applied","shortcuts.title":"Keyboard shortcuts","shortcuts.close":"Close keyboard shortcuts","shortcuts.hint":"Press Escape to close.","shortcuts.or":"or","a11y.reorder.moved":"Moved to position {position} of {total}","a11y.reorder.sorted":"Rows cannot be reordered while the grid is sorted","a11y.reorder.filtered":"Rows cannot be reordered while a filter is applied","a11y.reorder.grouped":"Rows cannot be reordered while the grid is grouped","a11y.reorder.grab":"Reorder row","a11y.reorder.sortedManual":"Rows cannot be reordered while the grid is sorted. Press Alt+Shift+M, or the Manual order button in the heading, to order them by hand","a11y.reorder.groupDerived":"The row cannot join that group: the group is worked out from the value, so there is no single value to give it","a11y.reorder.groupReadOnly":"The row cannot join that group: its grouping value cannot be edited","a11y.reorder.invalid":"The row cannot join that group: the new value was not valid","a11y.reorder.vetoed":"The move was declined; the row stays where it was","a11y.reorder.vetoedBecause":"The move was declined ({reason}); the row stays where it was","a11y.reorder.refused":"The row cannot be moved there","a11y.reorder.regrouped":"Moved into {group}","a11y.tree.dropRefusedDescendant":"A row cannot be dropped into one of its own descendants; the row stays where it was","a11y.rowOrder.entered":"Manual order: the rows keep their places and can be moved by hand","a11y.rowOrder.exited":"Manual order ended; the rows follow the sort","rowOrder.button":"Manual order","rowOrder.enter":"Order the rows by hand instead of by the sort","rowOrder.exit":"Return to the sorted order","a11y.transfer.moved":"Row moved to the other grid","a11y.transfer.copied":"Row copied to the other grid","a11y.transfer.refused":"That grid does not accept this row","a11y.transfer.declined":"The drop was declined; the row stays where it was","a11y.transfer.stale":"The drop target changed while it was being confirmed; the row stays where it was","shortcuts.group.grid":"In the data","shortcuts.group.header":"On a column heading","shortcuts.group.panel":"In the column list","shortcut.moveCell":"Move the focused cell","shortcut.rowEnds":"First / last cell of the row","shortcut.gridEnds":"First cell of the first row / last cell of the last row","shortcut.pageRows":"Move one viewport of rows","shortcut.nextCell":"Leave the grid for the next / previous focusable element (arrows move between cells)","shortcut.undo":"Undo the last edit, paste, fill or clear","shortcut.redo":"Redo the step that was undone","shortcut.startEdit":"Start editing the focused cell","shortcut.toggleRow":"Toggle selection of the focused row","shortcut.cancel":"Cancel the current edit or drag","shortcut.expandCollapse":"Expand / collapse a group or tree row","shortcut.focusHeader":"Move focus to the column header","shortcut.focusPanel":"Move focus to the tool panel","shortcut.explain":"Explain the focused column","shortcut.contextMenu":"Open the context menu for the focused cell","shortcut.moveRow":"Move the focused row, when row reorder is enabled","shortcut.manualOrder":"Order the rows by hand, or return to the sort, when row reorder allows a manual order","shortcut.headingMove":"Move between headings","shortcut.headingEnds":"First / last heading","shortcut.headingSort":"Sort by the column, Shift to add to the sort","shortcut.headingResize":"Resize the column, Ctrl for a coarse step","shortcut.headingAutosize":"Size the column to its content","shortcut.headingReorder":"Move the column","shortcut.headingMenu":"Open the column menu","shortcut.headingExit":"Return focus to the data","shortcut.listGroup":"Group by the column, or stop grouping by it","shortcut.listValues":"Add the column to values, or take it out","shortcut.listPivot":"Pivot by the column, or stop pivoting by it","shortcut.listMove":"Move the column","shortcut.find":"Find in the grid","tags.label":"Show columns","tags.all":"All columns","tags.showing":"Showing {tag}","form.title":"Edit row","form.save":"Save","form.cancel":"Cancel","form.loading":"Loading…","form.loadFailed":"Could not load this record.","form.loadTimeout":"The record did not arrive in time.","form.retry":"Try again","form.choose":"Choose…","form.newTitle":"New row","form.createFailed":"Could not add this record.","form.grid.cellInvalid":"Row {row}, {column}: {message}","form.grid.required":"Add at least one row.","form.grid.addRow":"Add row","form.grid.deleteRow":"Delete row","form.grid.total":"Total","form.grid.rowControls":"Row controls","presentation.cards":"Showing records as cards","presentation.table":"Showing records as a table","editor.format":"Format","editor.codeHint":"Tab indents · Esc cancels · Ctrl+Enter saves","editor.colours":"Colours","editor.customColour":"Custom colour","editor.hexValue":"Hex value","editor.hexPlaceholder":"#rrggbb","editor.clearColour":"Clear colour","editor.time":"Time","editor.noIcon":"No icon","editor.selectAll":"Select all","editor.passwordHint":"Enter the value twice to save it.","editor.clearRating":"Clear rating","editor.clear":"Clear","editor.value":"Value","editor.currency":"Currency","editor.richtext.formatting":"Formatting","editor.richtext.richText":"Rich text","editor.richtext.placeholder":"Start writing…","editor.richtext.linkLabel":"Link address","editor.richtext.linkPlaceholder":"https://","editor.richtext.linkAdd":"Add link","editor.richtext.bold":"Bold (Ctrl+B)","editor.richtext.italic":"Italic (Ctrl+I)","editor.richtext.underline":"Underline (Ctrl+U)","editor.richtext.strike":"Strikethrough","editor.richtext.heading":"Paragraph style","editor.richtext.alignLeft":"Align left","editor.richtext.alignCenter":"Align centre","editor.richtext.alignRight":"Align right","editor.richtext.ul":"Bulleted list","editor.richtext.ol":"Numbered list","editor.richtext.color":"Text colour","editor.richtext.link":"Link (Ctrl+K)","editor.richtext.image":"Insert image","editor.richtext.clear":"Clear formatting","editor.richtext.source":"HTML source","editor.richtext.undo":"Undo (Ctrl+Z)","editor.richtext.redo":"Redo (Ctrl+Y)","formatting.format":"Format","formatting.noRules":"No rules yet. The first one that matches a cell wins.","formatting.clearAll":"Clear all","formatting.addRule":"Add rule","formatting.condition":"Condition","formatting.value":"Value","formatting.secondValue":"Second value","formatting.moveEarlier":"Move earlier","formatting.moveLater":"Move later","formatting.ruleKind":"Rule type","formatting.aCondition":"A condition","formatting.aColourScale":"A colour scale","formatting.compare":"Compare a value","formatting.distribution":"By the distribution","formatting.colourScale":"Colour scale","formatting.scaleBounds":"Scale bounds","formatting.preview":"Preview","formatting.livePreview":"Live preview","history.title":"History","history.show":"Show history","history.empty":"Nothing to undo yet.","prompt.ask":"Ask","prompt.apply":"Apply","prompt.discard":"Discard","panel.searchColumns":"Search columns","panel.searchColumnsPlaceholder":"Search columns…","panel.searchColumnsToFilter":"Search columns to filter","panel.showAll":"Show all","panel.hideAll":"Hide all","panel.clearAll":"Clear all","panel.clear":"Clear","panel.filterAllColumns":"Filter all columns","panel.columnFiltered":"This column is filtered","panel.clearFilterOn":"Clear the filter on {column}","panel.clearFilter":"Clear this filter","panel.filterEmptyNoMatch":"No column matches “{query}”.","panel.filterEmptyNone":"No column on this grid can be filtered.","panel.filterSummaryActive":"{active} of {total} columns filtered","panel.filterSummaryNone":"No filters · {total} columns available","panel.filterBy":"Filter by {column}","panel.filteredBy":"Filtered by {column}","panel.columnDragHint":"Drag {column} into a zone above, or onto another column to reorder","panel.gridActions":"Grid actions","panel.tabActiveCount":{one:"{title}, {count} active",other:"{title}, {count} active"},"panel.tabActive":"{title}, active","views.default":"Default","views.namePlaceholder":"Name this view…","views.nameLabel":"Name for the current layout","views.save":"Save view","licence.watermark":G,"licence.watermark.free":M,"filter.op.contains":"Contains","filter.op.notContains":"Does not contain","filter.op.equals":"Equals","filter.op.notEqual":"Does not equal","filter.op.startsWith":"Starts with","filter.op.endsWith":"Ends with","filter.op.blank":"Is blank","filter.op.notBlank":"Is not blank","filter.op.lessThan":"Less than","filter.op.lessThanOrEqual":"Less than or equal","filter.op.greaterThan":"Greater than","filter.op.greaterThanOrEqual":"Greater than or equal","filter.op.inRange":"In range","filter.op.matches":"Matches","filter.op.before":"Before","filter.op.after":"After","filter.op.relative":"Relative to today","filter.rel.today":"Today","filter.rel.yesterday":"Yesterday","filter.rel.tomorrow":"Tomorrow","filter.rel.lastNDays":"Last N days","filter.rel.nextNDays":"Next N days","filter.rel.thisWeek":"This week","filter.rel.lastWeek":"Last week","filter.rel.thisMonth":"This month","filter.rel.lastMonth":"Last month","filter.rel.thisQuarter":"This quarter","filter.rel.quarterToDate":"Quarter to date","filter.rel.thisYear":"This year","filter.rel.yearToDate":"Year to date","filter.operator":"Operator","filter.join":"Join","filter.value":"Value","filter.from":"From","filter.to":"To","filter.addCondition":"Add condition","filter.noConditions":"No conditions","filter.removeCondition":"Remove condition","filter.search":"Search","filter.searchValues":"Search values","filter.noMatches":"No values match","filter.selectAll":"Select all","filter.clear":"Clear","filter.all":"All","filter.allExcept":"All but {count}","filter.loadingValues":"Loading values…","filter.topValues":"Top {shown} of {total} values","filter.valuesFailed":"Values could not be loaded: {error}","filter.valuesUnsupported":"This source cannot list the values of {column}; filter by condition instead.","filter.true":"True","filter.false":"False","filter.expression":"Filter expression","filter.column":"Column","filter.relativePeriod":"Relative period","filter.days":"Number of days","filter.tab.set":"Values","filter.tab.text":"Text","filter.tab.number":"Number","filter.tab.date":"Date","filter.tab.advanced":"Advanced","filterRow.label":"Filter row","filterRow.conditions":{one:"{count} condition",other:"{count} conditions"},"chart.empty":"Nothing to chart","chart.summary":"{type} chart of {measure} by {dimension}","chart.summaryShare":"{type} chart of {measure}","chart.summaryType":"{type} chart","chart.summaryGauge":"{type} chart of {measure}, {fn}: {value}","chart.waterfallTotal":"Total","chart.summaryEngine":"Figures computed by the data engine over every matching row","chart.summaryEngineViewport":"{count} points in this view, fetched from the data engine","chart.summaryEngineDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells counted by the data engine","chart.summaryClientDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells computed in the browser","chart.viewportOverCap":"{count} rows in this view, more than the {cap} this map draws; zoom in or narrow the filter","chart.dataTable":"Chart data","chart.viewportFilter.label":"Map view","chart.annotate.rail":"Drawing tools","chart.annotate.select":"Select and move a drawing","chart.annotate.trendLine":"Trend line","chart.annotate.horizontalLine":"Horizontal line","chart.annotate.verticalLine":"Vertical line","chart.annotate.channel":"Parallel channel","chart.annotate.fibonacci":"Fibonacci retracement","chart.annotate.arrow":"Arrow","chart.annotate.pen":"Freehand pen","chart.annotate.pen.described":"Freehand drawing from {from} to {to}","chart.annotate.measure-x":"Date range","chart.annotate.measure-y":"Price range","chart.annotate.measure-xy":"Date and price range","chart.annotate.measure.bars":{one:"{count} bar",other:"{count} bars"},"chart.annotate.measure.points":{one:"{count} point",other:"{count} points"},"chart.annotate.measure.volume":"Vol {value}","chart.annotate.measure.seconds":"{count}s","chart.annotate.measure.minutes":"{count}m","chart.annotate.measure.hours":"{count}h","chart.annotate.measure.days":"{count}d","chart.annotate.measure.weeks":"{count}w","chart.annotate.measure.months":"{count}mo","chart.annotate.measure.years":"{count}y","chart.annotate.measure":"Measure","chart.annotate.measure.dx":"Δx {value}","chart.annotate.measure.dy":"Δy {value}","chart.annotate.measure.pct":"{value}%","chart.annotate.measure.categories":{one:"{count} category",other:"{count} categories"},"chart.annotate.measure.slope.perDay":"Slope {value} per day","chart.annotate.measure.slope.perCategory":"Slope {value} per category","chart.annotate.measure.slope.perUnit":"Slope {value} per unit","chart.annotate.measure.dur.d":"{count} d","chart.annotate.measure.dur.h":"{count} h","chart.annotate.measure.dur.min":"{count} min","chart.annotate.measure.dur.s":"{count} s","chart.annotate.measure.dur.ms":"{count} ms","chart.annotate.measure.announce":"Measurement: {readout}","chart.annotate.measure.start":"Measure start: {x}, {y}","chart.annotate.text":"Text","chart.annotate.callout":"Callout","chart.annotate.note":"Note","chart.annotate.delete":"Delete the selected drawing","chart.annotate.editLabel":"Annotation text","chart.zoom.toolbar":"Zoom controls","chart.zoom.in":"Zoom in","chart.zoom.out":"Zoom out","chart.zoom.left":"Pan left","chart.zoom.right":"Pan right","chart.zoom.reset":"Reset the zoom","chart.legendMore":{one:"+{count} more",other:"+{count} more"},"chart.type.line":"Line","chart.type.area":"Area","chart.type.bar":"Bar","chart.type.pie":"Pie","chart.type.donut":"Donut","chart.type.sunburst":"Sunburst","chart.type.scatter":"Scatter","chart.type.step":"Step","chart.type.rangeArea":"Range","chart.type.horizontalBar":"Horizontal bar","chart.type.waterfall":"Waterfall","chart.type.floatingBar":"Floating bar","chart.type.horizontalFloatingBar":"Horizontal floating bar","chart.type.populationPyramid":"Population pyramid","chart.type.bullet":"Bullet","chart.type.bubble":"Bubble","chart.type.histogram":"Histogram","chart.type.boxplot":"Box plot","chart.type.forest":"Forest plot","chart.type.qq":"QQ plot","chart.type.ecdf":"ECDF","chart.type.lorenz":"Lorenz","chart.type.correlogram":"Correlogram","chart.type.control":"Control","chart.type.capability":"Capability","chart.type.movingRange":"Moving range","chart.type.treemap":"Treemap","chart.type.combo":"Combination","chart.type.pareto":"Pareto","chart.type.heatmap":"Heat map","chart.type.radar":"Radar","chart.type.gauge":"Gauge","chart.type.funnel":"Funnel","chart.type.candlestick":"Candlestick","chart.type.ohlc":"OHLC","chart.type.polarArea":"Polar area","chart.type.nightingale":"Nightingale rose","chart.type.rose":"Rose","chart.type.radialBar":"Radial bar","chart.type.polarScatter":"Polar scatter","chart.type.geomap":"Map","chart.type.sankey":"Sankey","chart.type.chord":"Chord","chart.type.pyramid":"Pyramid","chart.type.pictorial":"Pictorial","chart.type.serpentine":"Serpentine timeline","chart.type.spiral":"Spiral timeline","chart.edit.aggregated":"This value is a total of several rows, so it cannot be dragged.","chart.edit.refused":"That change was not applied.","chart.edit.refusedWhy":"That change was not applied: {reason}","chart.type.network":"Network","chart.type.stream":"Stream","chart.type.marimekko":"Marimekko","chart.type.violin":"Violin","chart.type.gantt":"Gantt","chart.type.forceTree":"Force-directed tree","chart.type.pack":"Packed circles","chart.type.tree":"Tree","chart.type.voronoiTreemap":"Voronoi treemap","chart.type.alluvial":"Alluvial","chart.type.arc":"Arc diagram","chart.type.barRace":"Bar chart race","chart.type.bubblemap":"Bubble map","chart.type.bump":"Bump chart","chart.type.calendar":"Calendar heat map","chart.type.choropleth":"Choropleth map","chart.type.decomposition":"Decomposition tree","chart.type.diverging":"Diverging bar","chart.type.dumbbell":"Dumbbell","chart.type.fan":"Fan chart","chart.type.hexbin":"Hexagonal bin","chart.type.hexmap":"Hex map","chart.type.icicle":"Icicle","chart.type.markermap":"Marker map","chart.type.motion":"Motion chart","chart.type.parallel":"Parallel coordinates","chart.type.ridgeline":"Ridgeline","chart.type.roc":"ROC curve","chart.type.scatter3d":"3D scatter","chart.type.slope":"Slope chart","chart.type.splom":"Scatter plot matrix","chart.type.venn":"Venn diagram","chart.type.waffle":"Waffle","chart.type.wordCloud":"Word cloud","chart.tasksDropped":{one:"{count} more task not shown",other:"{count} more tasks not shown"},"chart.geoUnmatched":{one:"{count} row could not be placed on the map",other:"{count} rows could not be placed on the map"},"chart.r2":"R² {value}","ai.insights":"Insights","ai.explainView":"Explain this view","ai.explain":"Explain","ai.ask":"Ask","ai.apply":"Apply","ai.discard":"Discard","ai.propose":"Propose","ai.approve":"Approve","ai.thinking":"Thinking…","ai.applying":"Applying…","ai.applied":"Applied: {what}","ai.couldNotApply":"Could not apply: {why}","ai.applyFailed":"it failed","ai.discarded":"Discarded.","ai.discardedNothingWritten":"Discarded. Nothing was written.","ai.nothingWritten":"Nothing was written.","ai.nothingWrittenVetoed":"Nothing was written — a before-handler vetoed it.","ai.scope":"Scope: {scope}","ai.unsafeQuery":"I could not turn that into a safe query: {why}","ai.nothingToDo":"nothing to do","ai.insightsFailed":"Could not generate insights right now. The grid is unaffected.","ai.modelUnreachable":"Could not reach the model right now. The grid is unaffected.","ai.flagged":{one:"{count} unverified figure was removed as ungrounded.",other:"{count} unverified figures were removed as ungrounded."},"ai.askPlaceholder":"Ask your data: “EMEA deals over 50k, biggest first”","ai.askLabel":"Ask your data","ai.actorPlaceholder":"Ask AI to change data: “set the Network Upgrade project to In Progress”","ai.actorLabel":"Ask AI to change data","editor.password.show":"Show value","editor.password.hide":"Hide value","editor.password.showField":"Show {column}","editor.password.hideField":"Hide {column}","facets.computing":"Computing…","facets.suppressed.cardinality":"Too many distinct values to chart","facets.suppressed.rows":"Too many rows to chart","facets.suppressed.streaming":"Paused while live data is streaming","facets.suppressed.noProvider":"No distribution available for this data source","facets.suppressed.type":"This column has no chartable distribution","facets.bucketOf":"{count} of {whole} rows","history.undo":"Undo","history.redo":"Redo","history.described":"{action} {label}","history.nothingToUndo":"Nothing to undo","history.nothingToRedo":"Nothing to redo","history.undoDisabled":"Undo (nothing to undo)","history.redoDisabled":"Redo (nothing to redo)","a11y.presence.joined":"{name} joined","a11y.presence.left":"{name} left","prompt.asking":"Asking…","prompt.moreNotes":{one:"and {count} more",other:"and {count} more"},"shortcuts.key.cmd":"Cmd","timeline.live":"Live","timeline.recording":"recording…","panel.zoneHint.group":"Drag a column here to group rows by its values","panel.zoneHint.values":"Drag a column here to total it","panel.zoneHint.pivot":"Drag a column here to pivot across its values","panel.zoneHint.any":"Drag a column here","panel.rowsOf":"{shown} of {total} rows","views.empty":"No saved views yet. Set the grid up as you want it, then save it below.","views.applied":"Applied","views.matchesGrid":"Matches the grid as it is","views.delete":"Delete","views.confirmDelete":"Delete {name}?","views.confirmDeleteLabel":"Confirm deleting {name}","views.shared":"View copied to the clipboard","views.sharedDownload":"Clipboard unavailable; the view was downloaded as {name}","views.sharedFailed":"The view could not be copied or downloaded","views.rename":"Rename","views.ownedBy":"Owned by {name}","views.ownerOnlyReason":"Only {name} or an admin can do that","views.noOwnerReason":"Only an admin can do that — this view has no recorded owner","views.unshare":"Unshare","views.unshareTitle":"Stop sharing {name}","views.duplicate":"Duplicate","views.duplicateTitle":"Duplicate {name}","views.copyName":"{name} (copy)","gantt.row.expand":"Expand {name}","gantt.row.collapse":"Collapse {name}","gantt.resource.over":"{name} — over-allocated","kanban.board":"Board","kanban.requiredTitle":"Required fields","kanban.requiredSave":"Save","kanban.requiredCancel":"Cancel","kanban.moveRefused":'Move refused: a card in "{from}" cannot move to "{to}".',"kpi.status.good":"good","kpi.status.warn":"warn","kpi.status.critical":"critical","kpi.status.unknown":"No data","kpi.node.item":"{count} item","kpi.node.items":"{count} items","kpi.node.worst":"worst status {status}","kpi.node.unknown":"{count} unknown","sidebar.nav":"Main navigation","sidebar.search":"Search","sidebar.collapse":"Collapse sidebar","sidebar.expand":"Expand sidebar","toolbar.more":"More"}),x=Object.freeze(Object.keys(F))}),Be("packages/core/src/i18n/format.js",function(e,D){"use strict";Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"formatMessage",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return k}});const M=D("packages/core/src/internal/predicates.js").isFunction,G=/\{(\w+)\}/g,F=new Map,x=new Map;function q(y){const l=y||"";if(F.has(l))return F.get(l);let g=null;try{g=new Intl.PluralRules(y||void 0)}catch{g=null}return F.set(l,g),g}function W(y,l,g="conjunction"){const i=Array.isArray(y)?y.filter(c=>c!=null&&c!==""):[];if(i.length===0)return"";if(i.length===1)return String(i[0]);const t=`${l||""}|${g}`;let o=x.get(t);if(o===void 0){try{o=new Intl.ListFormat(l||void 0,{style:"long",type:g})}catch{o=null}x.set(t,o)}return o?o.format(i.map(String)):i.map(String).join(", ")}function I(y,l){return y==null?"":typeof y=="number"?Number.isFinite(y)?y.toLocaleString(l||void 0,{maximumFractionDigits:20}):"":String(y)}function K(y,l,g){if(typeof y=="string")return y;if(!y||typeof y!="object")return"";const i=l&&typeof l.count=="number"?l.count:null;if(i===null)return y.other??"";const t=q(g),o=t?t.select(i):i===1?"one":"other";return y[o]??y.other??""}function R(y,l={},g){const i=K(y,l,g);return i?i.replace(G,(t,o)=>Object.prototype.hasOwnProperty.call(l,o)?I(l[o],g):t):""}function S(y,l,g="en-GB"){return typeof y=="string"&&y?y:typeof l=="string"&&l?l:g}function k(y,l){const g=y?y[l]:void 0;return g==null||M(g)?l:g}}),Be("packages/core/src/i18n/registry.js",function(e,D){"use strict";Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"localeCatalogue",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return q}});const M=D("packages/core/src/i18n/catalogue.js").EN_GB,G=new Map([["en-gb",M]]);function F(W,I){const K=typeof W=="string"?W.toLowerCase():"";return!K||!I||typeof I!="object"?!1:(G.set(K,I),!0)}function x(W){if(typeof W!="string"||!W)return null;const I=W.toLowerCase(),K=G.get(I);if(K)return K;const R=I.split("-")[0],S=G.get(R);if(S)return S;for(const[k,y]of G)if(k.split("-")[0]===R)return y;return null}function q(){return[...G.keys()]}}),Be("packages/core/src/i18n/index.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"Messages",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"defaultMessages",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return f}});const re=D("packages/core/src/i18n/catalogue.js"),M=re.EN_GB,G=re.MESSAGE_KEYS,F=D("packages/core/src/i18n/format.js"),x=F.formatMessage,q=F.formatList,W=F.lookup,I=F.resolveLocale,R=D("packages/core/src/internal/predicates.js").isFunction,k=D("packages/core/src/internal/warn.js").warnOnce,y=D("packages/core/src/i18n/registry.js"),l=y.registerLocale,g=y.localeCatalogue;Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return re.EN_GB}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return re.MESSAGE_KEYS}}),Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return F.formatList}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return F.resolveLocale}}),Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return y.registerLocale}});const i="en-GB";class t{#e=i;#t=M;constructor(m={}){this.configure(m)}configure(m={}){this.#e=I(m.locale,m.declared,i);const r=m.messages,s=g(this.#e);if(!s&&this.#e.toLowerCase()!=="en-gb"&&(!r||typeof r!="object")&&k(`i18n:locale:not-loaded:${this.#e.toLowerCase()}`,`locale "${this.#e}" is not loaded: import "@toclocoinc/lattice-grid/locales/${this.#e}" to add its text; English is used until then.`),!r||typeof r!="object"){this.#t=s?{...M,...s}:M;return}const p=Object.keys(r).filter(u=>!(u in M));p.length&&k(`i18n:unknown:${p[0]}`,`message keys not in the catalogue and so ignored: ${p.slice(0,5).join(", ")}${p.length>5?`, and ${p.length-5} more`:""}`),this.#t={...M,...s||{},...r}}get locale(){return this.#e}t(m,r){return x(W(this.#t,m),r||{},this.#e)}list(m,r){return q(m,this.#e,r)}number(m,r){const s=Number(m);return Number.isFinite(s)?s.toLocaleString(this.#e,r||{maximumFractionDigits:20}):""}}const o=new t;function c(n){return n instanceof t?n:new t(n||{})}function f(n){const m=n&&typeof n=="object"?n:{},r=G.filter(d=>{const p=m[d];return p==null||p===""||R(p)}),s=Object.keys(m).filter(d=>!(d in M));return{missing:r,unknown:s}}}),Be("packages/core/src/columns/types/structured.js",function(e,D){"use strict";Object.defineProperty(e,"MASK_DEFAULTS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"parseJsonText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return i}});const re=D("packages/core/src/internal/predicates.js"),M=re.isNil,G=re.isObject,x=D("packages/core/src/i18n/index.js").defaultMessages,q=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function W(t,o){const c=o||{},f=c.emptyDisplay??q.emptyDisplay;if(M(t)||t==="")return f;const m=[...typeof c.char=="string"&&c.char!==""?c.char:q.char][0]||q.char,r=c.fixedLength??q.fixedLength,s=Number.isFinite(c.length)&&Number(c.length)>0?Math.floor(Number(c.length)):q.length,d=typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):null;let p=0;if(d!==null){const u=Number.isFinite(c.lastVisible)?Math.floor(Number(c.lastVisible)):q.lastVisible,b=[...d];if(p=u>0&&u<b.length?u:0,p>0){const a=b.slice(b.length-p).join(""),h=Math.max(1,(r?s:b.length)-p);return m.repeat(h)+a}return m.repeat(r?s:Math.max(1,b.length))}return m.repeat(s)}const I=48;function K(t){try{const o=JSON.stringify(t);return o===void 0?null:o}catch{return null}}function R(t,o){if(M(t))return"";const c=Number.isFinite(o&&o.inlineLimit)?Number(o.inlineLimit):I;if(typeof t=="string")return t.length>c?`${t.slice(0,c-1)}…`:t;if(typeof t!="object")return String(t);const f=K(t);if(f!==null&&f.length<=c)return f;if(Array.isArray(t)){const m=t.length;return`[${x.t("count.items",{count:m})}]`}const n=Object.keys(t).length;return`{${x.t("count.keys",{count:n})}}`}function S(t,o){if(t==null)return"null";const c=typeof t;if(c==="number"||c==="boolean"||c==="bigint")return String(t);if(c==="string")return JSON.stringify(t);if(c!=="object")return JSON.stringify(String(t));const f=o||new WeakSet;return f.has(t)?'"[circular]"':(f.add(t),t instanceof Date?JSON.stringify(t.toISOString()):Array.isArray(t)?`[${t.map(r=>S(r,f)).join(",")}]`:`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${S(t[r],f)}`).join(",")}}`)}function k(t,o){if(M(t))return M(o)?0:1;if(M(o))return-1;const c=S(t),f=S(o);return c<f?-1:c>f?1:0}function y(t){if(M(t))return null;const o=String(t);if(o.trim()==="")return null;try{return JSON.parse(o)}catch{return o}}function l(t){const o=t&&t.cell&&t.cell.props;return G(o)?o:{}}const g=Object.freeze({json:{base:"object",storage:"object",format:t=>R(t&&t.value,l(t&&t.column)),parse:t=>y(t&&t.text),compare:k,defaults:{editor:"code",filter:"text",align:"start"},excel:"@",toClipboard:t=>{if(M(t))return"";if(typeof t=="string")return t;try{const o=JSON.stringify(t,null,2);return o===void 0?String(t):o}catch{return String(t)}},fromClipboard:t=>y(t)},secret:{base:"text",storage:"object",format:t=>W(t&&t.value,l(t&&t.column)),parse:t=>{const o=t&&t.text;return M(o)||String(o)===""?null:String(o)},compare:(t,o)=>{const c=M(t)||t==="",f=M(o)||o==="";return c===f?0:c?1:-1},defaults:{editor:"password",filter:"none",align:"start"},excel:"@",export:{csv:!1,excel:!1},toClipboard:t=>W(t),fromClipboard:t=>M(t)||String(t)===""?null:String(t)}}),i=g}),Be("packages/core/src/columns/types/unit.js",function(e,D){"use strict";Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return C}});const M=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/warn.js").warnOnce;function x(B,z,X,Q){return Object.freeze({symbol:B,factor:z,aliases:Object.freeze(X||[]),binary:!!(Q&&Q.binary),prefix:Q&&Q.prefix||null,auto:!(Q&&Q.auto===!1)})}function q(B,z,X,Q){return x(B,z,X,Q)}const W=Object.freeze({data:Object.freeze([x("B",1,["byte","bytes"]),x("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),x("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),x("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),x("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),x("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),x("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),x("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),x("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),x("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([x("bps",1,["bit","bits","bit/s","b/s"]),x("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),x("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),x("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),x("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([x("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),x("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),x("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),x("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),x("in",.0254,["inch","inches"],{auto:!1}),x("ft",.3048,["foot","feet"],{auto:!1}),x("yd",.9144,["yard","yards"],{auto:!1}),x("m",1,["metre","metres","meter","meters"]),x("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),x("mi",1609.344,["mile","miles"],{auto:!1}),x("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([x("mg",.001,["milligram","milligrams"]),x("g",1,["gram","grams"]),x("oz",28.349523125,["ounce","ounces"],{auto:!1}),x("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),x("kg",1e3,["kilogram","kilograms"]),x("st",6350.29318,["stone"],{auto:!1}),x("t",1e6,["tonne","tonnes","ton"],{auto:!1}),x("ton (US)",907184.74,["ton","shortton"],{auto:!1}),x("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([x("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),x("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),x("ms",.001,["msec","msecs","millisecond","milliseconds"]),x("s",1,["sec","secs","second","seconds"]),x("m",60,["min","mins","minute","minutes"]),x("h",3600,["hr","hrs","hour","hours"]),x("d",86400,["day","days"])]),speed:Object.freeze([x("mm/s",.001,["millimetre/s","millimeter/s"]),x("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),x("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),x("mph",.44704,["mile/h","miles/h"],{auto:!1}),x("kn",1852/3600,["knot","knots"],{auto:!1}),x("m/s",1,["metre/s","meter/s","mps"]),x("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([x("mm/s²",.001,["mm/s2"]),x("ft/s²",.3048,["ft/s2"],{auto:!1}),x("m/s²",1,["m/s2","metre/s2","meter/s2"]),x("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([x("mm²",1e-6,["mm2"]),x("cm²",1e-4,["cm2"]),x("in²",64516e-8,["in2","sqin"],{auto:!1}),x("ft²",.09290304,["ft2","sqft"],{auto:!1}),x("yd²",.83612736,["yd2","sqyd"],{auto:!1}),x("m²",1,["m2","sqm"]),x("ha",1e4,["hectare","hectares"],{auto:!1}),x("ac",4046.8564224,["acre","acres"],{auto:!1}),x("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([x("µL",1e-6,["ul","microlitre","microliter"]),x("mL",.001,["millilitre","milliliter"]),x("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),x("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),x("L",1,["litre","litres","liter","liters"]),x("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),x("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),x("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),x("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([x("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),x("J",1,["joule","joules"]),x("cal",4.184,["calorie","calories"],{auto:!1}),x("kJ",1e3,["kilojoule","kilojoules"]),x("BTU",1055.05585262,["btu"],{auto:!1}),x("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),x("MJ",1e6,["megajoule","megajoules"]),x("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),x("GJ",1e9,["gigajoule","gigajoules"]),x("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([x("mW",.001,["milliwatt","milliwatts"]),x("W",1,["watt","watts"]),x("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),x("kW",1e3,["kilowatt","kilowatts"]),x("hp",745.6998715822702,["horsepower"],{auto:!1}),x("MW",1e6,["megawatt","megawatts"]),x("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([x("mN",.001,["millinewton","millinewtons"]),x("N",1,["newton","newtons"]),x("lbf",4.4482216152605,["poundforce"],{auto:!1}),x("kgf",9.80665,["kilogramforce"],{auto:!1}),x("kN",1e3,["kilonewton","kilonewtons"]),x("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([x("Pa",1,["pascal","pascals"]),x("mbar",100,["millibar"],{auto:!1}),x("inH₂O",249.0889,["inh2o"],{auto:!1}),x("mmHg",133.322387415,["torr"],{auto:!1}),x("kPa",1e3,["kilopascal","kilopascals"]),x("inHg",3386.388640341,["inhg"],{auto:!1}),x("psi",6894.757293168361,["lbf/in2"],{auto:!1}),x("bar",1e5,[],{auto:!1}),x("atm",101325,["atmosphere","atmospheres"],{auto:!1}),x("MPa",1e6,["megapascal","megapascals"]),x("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([x("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),x("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),x("kN·m",1e3,["knm","kn.m"],{auto:!1}),x("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([x("kg/m³",1,["kg/m3"]),x("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),x("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),x("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([x("L/min",1/6e4,["lpm","l/min"],{auto:!1}),x("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),x("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),x("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),x("cfm",.0004719474432,["ft3/min"],{auto:!1}),x("L/s",.001,["lps","l/s"],{auto:!1}),x("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([x("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),x("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),x("mrad",.001,["milliradian","milliradians"],{auto:!1}),x("mil",Math.PI/3200,["nato-mil"],{auto:!1}),x("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),x("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),x("rad",1,["radian","radians"]),x("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([x("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),x("rad/s",1,["radps","radians/s"]),x("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),x("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([x("ppt",1e-12,["partspertrillion"],{auto:!1}),x("ppb",1e-9,["partsperbillion"]),x("ppm",1e-6,["partspermillion"]),x("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),x("‰",.001,["permille","permil"],{auto:!1}),x("%",.01,["pct","percent"]),x("×",1,["x","ratio","times"])]),molarity:Object.freeze([x("pM",1e-12,["picomolar","picomolarity"]),x("nM",1e-9,["nanomolar","nanomolarity"]),x("µM",1e-6,["um-molar","micromolar","micromolarity"]),x("mM",.001,["millimolar","millimolarity"]),x("M",1,["molar","mol/l","mol/L","molarity"]),x("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([x("mg/s",1e-6,["milligrams/s"]),x("g/s",.001,["grams/s"]),x("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),x("kg/s",1,["kilograms/s","kgps"]),x("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),x("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),x("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([x("µPa·s",1e-6,["upas","micropascalsecond"]),x("cP",.001,["centipoise"],{auto:!1}),x("mPa·s",.001,["mpas","millipascalsecond"]),x("P",.1,["poise"],{auto:!1}),x("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([x("cSt",1e-6,["centistokes","centistoke"]),x("mm²/s",1e-6,["mm2/s"],{auto:!1}),x("St",1e-4,["stokes","stoke"],{auto:!1}),x("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([x("mW/(m·K)",.001,["mw/mk"]),x("W/(m·K)",1,["w/mk","wmk"]),x("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),x("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([x("J/(kg·K)",1,["j/kgk","jkgk"]),x("kJ/(kg·K)",1e3,["kj/kgk"]),x("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([x("nSv/h",1e-9,["nsvh"]),x("µSv/h",1e-6,["usv/h","usvh"]),x("mSv/h",.001,["msvh"]),x("Sv/h",1,["svh"]),x("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),I=Symbol("ambiguous"),K=new Map,R=new Map;function S(B,z){const X=String(B||"").trim();if(!X)throw new Error("[lattice] a unit system needs a name");if(W[X]||R.has(X))throw new Error(`[lattice] unit system "${X}" already exists`);const Q=[...z||[]];if(!Q.length)throw new Error(`[lattice] unit system "${X}" has no units`);if(!Q.some(L=>L.factor===1))throw new Error(`[lattice] unit system "${X}" has no base unit (none with factor 1)`);const H=new Set;for(const L of Q){if(H.has(L.symbol))throw new Error(`[lattice] unit system "${X}" declares "${L.symbol}" twice`);H.add(L.symbol)}return R.set(X,Object.freeze(Q)),K.delete(X),X}function k(){return[...Object.keys(W),...R.keys()]}function y(B){const z=l(B);return z?z.units:[]}function l(B){const z=String(B||""),X=K.get(z);if(X!==void 0)return X;const Q=W[z]||R.get(z);if(!Q)return K.set(z,null),null;const H=Object.freeze([...Q].sort((se,ne)=>se.factor-ne.factor)),L=new Map,Z=new Map,ee=(se,ne)=>{const ae=L.get(se);ae===void 0?L.set(se,ne):ae!==ne&&L.set(se,I)};for(const se of H){ee(se.symbol.toLowerCase(),se);for(const ne of se.aliases)ee(ne.toLowerCase(),se);if(se.prefix){const ne=Z.get(se.prefix)||[];ne.push(se),Z.set(se.prefix,ne)}}const te={units:H,byToken:L,byPrefix:Z,decimal:H.filter(se=>!se.binary&&se.auto),binary:H.some(se=>se.binary)?H.filter(se=>(se.binary||se.factor===1)&&se.auto):null};return K.set(z,te),te}function g(B,z){return z&&B.binary||B.decimal}function i(B,z){const X=l(B);if(!X||M(z))return null;const Q=X.units.find(L=>L.symbol===String(z));if(Q)return Q;const H=X.byToken.get(String(z).trim().toLowerCase());return H&&H!==I?H:null}const t=new WeakMap;function o(B){const z=B||{};if(typeof z=="object"&&z!==null){const L=t.get(z);if(L!==void 0)return L}const X=z.system||"data",Q=l(X);let H=null;if(!Q)F(`unit:system:${X}`,`unknown unit system "${X}"; known systems are ${k().join(", ")}`);else{let L=z.unit?i(X,z.unit):null;L||(z.unit&&F(`unit:unit:${X}:${z.unit}`,`unknown unit "${z.unit}" in system "${X}"; falling back to ${Q.units[0].symbol}`),L=Q.units.find(Z=>Z.factor===1)||Q.units[0]),H={index:Q,base:L,binary:z.binary===!0}}return typeof z=="object"&&z!==null&&t.set(z,H),H}const c=new WeakMap;function f(B,z){if(!B||!z||!Array.isArray(B.compound)||B.compound.length===0)return null;const X=c.get(B);if(X!==void 0)return X;const Q=new Set,H=[];for(const Z of B.compound){const ee=i(B.system||"data",Z);if(!ee){F(`unit:compound:${B.system}:${Z}`,`unknown compound unit "${Z}" in system "${B.system||"data"}"; ignoring it`);continue}Q.has(ee.symbol)||(Q.add(ee.symbol),H.push(ee))}H.sort((Z,ee)=>ee.factor-Z.factor);const L=H.length>=2?H:null;return c.set(B,L),L}function n(B,z,X){return z===X||z.factor===X.factor?B:B*z.factor/X.factor}const m=new Map;function r(B){const z=B||"",X=m.get(z);if(X)return X;const Q={group:",",decimal:"."};try{for(const H of new Intl.NumberFormat(B||void 0).formatToParts(12345.6))H.type==="group"?Q.group=H.value:H.type==="decimal"&&(Q.decimal=H.value)}catch{}return m.set(z,Q),Q}const s=/[\s ]/g,d=/^[+-]?[\d '’ .,]*(?:[eE][+-]?\d+)?/,p=/^[^\d+\-(.,\s]+\s*/,u=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function b(B,z){const{group:X,decimal:Q}=r(z);let H=String(B).replace(s,"");if(H==="")return null;const L=Q?H.indexOf(Q):-1;if(X&&X!==Q){if(L>=0&&H.indexOf(X,L+Q.length)>=0)return null;H=H.split(X).join("")}if(Q&&Q!=="."&&(H=H.split(Q).join(".")),!u.test(H))return null;const Z=Number(H);return Number.isFinite(Z)?Z:null}function a(B,z,X){const Q=String(B).trim().replace(/\.$/,"");if(Q==="")return null;const H=z.units.find(ne=>ne.symbol===Q);if(H)return H;const L=Q.toLowerCase(),Z=z.byToken.get(L);if(Z===I)return null;if(Z)return Z;const ee=z.byPrefix.get(L);if(!ee||!ee.length)return null;const te=g(z,X),se=ee.filter(ne=>te.includes(ne));return se.length===1?se[0]:null}function h(B,z,X,Q){let H=B,L=0,Z=!1,ee=!1;for(;H!=="";){const te=d.exec(H)[0];if(te==="")return null;const se=b(te,Q&&Q.locale);if(se===null)return null;H=H.slice(te.length).trim();const ne=H.search(/[+-]?[\d]/),ae=(ne>=0?H.slice(0,ne):H).trim();if(H=ne>=0?H.slice(ne).trim():"",ae===""){if(Z)return null;ee=!0,L+=n(se,X[0],z.base)}else{const de=a(ae,z.index,z.binary);if(!de)return null;L+=n(se,de,z.base)}if(Z=!0,ee&&H!=="")return null}return Z?L:null}function w(B,z){if(M(B))return null;if(typeof B=="number")return Number.isFinite(B)?B:null;const X=o(z);if(!X)return null;let Q=String(B).trim();if(Q==="")return null;let H=!1;Q.startsWith("(")&&Q.endsWith(")")&&(H=!0,Q=Q.slice(1,-1).trim());const L=f(z,X);if(L){Q.startsWith("-")&&(H=!0,Q=Q.slice(1).trim());const le=h(Q,X,L,z);return le===null?null:H?-le:le}let Z=null;const ee=p.exec(Q);if(ee&&ee[0]){const le=a(ee[0].trim(),X.index,X.binary);le&&(Z=le,Q=Q.slice(ee[0].length).trim())}const te=d.exec(Q)[0],se=b(te,z&&z.locale);if(se===null)return null;const ne=Q.slice(te.length).trim();if(Z&&ne!=="")return null;const ae=Z||(ne===""?X.base:a(ne,X.index,X.binary));if(!ae)return null;const de=n(se,ae,X.base);return H?-de:de}const v=new Map;function A(B,z,X,Q){const H=`${B||""}|${z}|${X}|${Q?1:0}`;let L=v.get(H);return L||(L=new Intl.NumberFormat(B||void 0,{minimumFractionDigits:z,maximumFractionDigits:X,useGrouping:Q}),v.set(H,L)),L}function _(B,z){if(!Number.isFinite(B)||B===0)return Math.max(0,z-1);const X=Math.floor(Math.log10(Math.abs(B)));return Math.min(20,Math.max(0,z-1-X))}function V(B,z){if(!Number.isFinite(B)||B===0)return B;const X=Math.ceil(Math.log10(Math.abs(B))),Q=10**(z-X);return Math.round(B*Q)/Q}function Y(B,z,X){if(!X||X===z.base.symbol)return z.base;if(X!=="auto")return $(z,X);if(B===0||!Number.isFinite(B))return z.base;const Q=Math.abs(B)*z.base.factor,H=g(z.index,z.binary);let L=H[0];for(const te of H)Q>=te.factor&&(L=te);if(Q>=L.factor)return L;let Z=L;for(const te of z.index.units)te.binary!==z.binary&&te.factor!==1||te.factor<=Q&&te.factor>(Z===L?0:Z.factor)&&(Z=te);if(Z!==L)return Z;let ee=L;for(const te of z.index.units)te.binary!==z.binary&&te.factor!==1||te.factor<ee.factor&&(ee=te);return ee.factor<z.base.factor?ee:z.base}function $(B,z){const X=B.index.units.find(H=>H.symbol===z);if(X)return X;const Q=B.index.byToken.get(String(z).toLowerCase());return Q&&Q!==I?Q:(F(`unit:display:${z}`,`unknown display unit "${z}"; rendering in ${B.base.symbol}`),B.base)}function j(B,z,X,Q){const H=B<0;let L=Math.abs(B)*z.base.factor;const Z=typeof Q.decimals=="number"?Q.decimals:Q.minDecimals??0,ee=typeof Q.decimals=="number"?Q.decimals:Q.maxDecimals??Math.max(Z,2),te=Q.space??" ",se=[];for(let ae=0;ae<X.length;ae++){const de=X[ae],le=ae===X.length-1;let be=le?L/de.factor:Math.floor(L/de.factor);if(L-=be*de.factor,le){const Ne=10**ee;be=Math.round(be*Ne)/Ne+0}const Ce=le?A(Q.locale,Z,ee,Q.group!==!1):A(Q.locale,0,0,Q.group!==!1);se.push(`${Ce.format(be)}${te}${de.symbol}`)}const ne=se.join(" ");return H?`-${ne}`:ne}function E(B,z){const X=z||{},Q=X.nullDisplay??"";if(M(B)||B==="")return Q;const H=typeof B=="number"?B:Number(B);if(!Number.isFinite(H))return Q;const L=o(X);if(!L)return String(H);const Z=f(X,L);if(Z)return j(H,L,Z,X);const ee=typeof X.significantFigures=="number"&&X.significantFigures>0?X.significantFigures:0,te=ee?V(H,ee):H,se=Y(te,L,X.display),ne=n(te,L.base,se);let ae=typeof X.decimals=="number"?X.decimals:X.minDecimals??0,de=typeof X.decimals=="number"?X.decimals:X.maxDecimals??Math.max(ae,2);ee&&(ae=_(ne,ee),de=ae);const le=A(X.locale,ae,de,X.group!==!1).format(ne),be=X.space??" ";return X.placement==="prefix"?`${se.symbol}${X.space??""}${le}`:`${le}${be}${se.symbol}`}function O(B,z){const X=M(B)||Number.isNaN(B)?null:Number(B),Q=M(z)||Number.isNaN(z)?null:Number(z);return X===null||Number.isNaN(X)?Q===null||Number.isNaN(Q)?0:1:Q===null||Number.isNaN(Q)||X<Q?-1:X>Q?1:0}function N(B){const z=typeof B.decimals=="number"&&B.decimals>0?`.${"0".repeat(B.decimals)}`:"";return`${typeof B.decimals=="number"?`#,##0${z}`:"#,##0.##"}" ${B.symbol}"`}function T(B){const z={system:"data",...B||{}},X=o(z),Q=X?X.base.symbol:String(z.unit||""),H=Object.freeze({...z,unit:Q}),L=Object.freeze({...H,display:Q,decimals:void 0,minDecimals:0,maxDecimals:20,group:!1}),Z=new Map([[H.locale||"",H]]),ee=te=>{const se=te||"";let ne=Z.get(se);return ne||(ne=Object.freeze({...H,locale:te||void 0}),Z.set(se,ne)),ne};return{base:"number",extends:"number",storage:"float64",unitConfig:H,format:te=>E(te.value,te.locale?ee(te.locale):H),parse:te=>w(te.text,te.locale?ee(te.locale):H),compare:O,defaults:{filter:"number",editor:"unit",align:"end",total:z.total||"sum"},...z.totals?{totals:z.totals}:{},excel:z.excel||N({decimals:z.decimals,symbol:Q}),toStorage:te=>typeof te=="number"?Number.isFinite(te)?te:null:typeof te=="string"?w(te,H):M(te)?null:w(String(te),H),toClipboard:te=>E(te,L),fromClipboard:te=>w(te,H)}}const C=T}),Be("packages/core/src/columns/types/engineering.js",function(e,D){"use strict";Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return x}});const M=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/columns/types/unit.js").createUnitType;function x(I){const K=2*Math.PI/I;return R=>{let S=0,k=0,y=0;for(const g of R||[]){if(M(g))continue;const i=Number(g);Number.isFinite(i)&&(S+=Math.cos(i*K),k+=Math.sin(i*K),y+=1)}return!y||Math.hypot(S,k)/y<1e-12?null:(Math.atan2(k,S)/K%I+I)%I}}function q(I){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:x(I)}}}const W=Object.freeze({metres:F({system:"length",unit:"m",display:"auto",maxDecimals:3}),millimetres:F({system:"length",unit:"mm",maxDecimals:2}),kilometres:F({system:"length",unit:"km",maxDecimals:3}),grams:F({system:"mass",unit:"g",display:"auto",maxDecimals:3}),kilograms:F({system:"mass",unit:"kg",maxDecimals:3}),tonnes:F({system:"mass",unit:"t",maxDecimals:3}),seconds:F({system:"duration",unit:"s",display:"auto",maxDecimals:3}),milliseconds:F({system:"duration",unit:"ms",maxDecimals:3}),hours:F({system:"duration",unit:"h",maxDecimals:2}),speed:F({system:"speed",unit:"m/s",display:"auto",maxDecimals:2}),kph:F({system:"speed",unit:"km/h",maxDecimals:1}),mph:F({system:"speed",unit:"mph",maxDecimals:1}),knots:F({system:"speed",unit:"kn",maxDecimals:1}),acceleration:F({system:"acceleration",unit:"m/s²",maxDecimals:3}),area:F({system:"area",unit:"m²",display:"auto",maxDecimals:2}),hectares:F({system:"area",unit:"ha",maxDecimals:4}),volume:F({system:"volume",unit:"L",display:"auto",maxDecimals:3}),cubicMetres:F({system:"volume",unit:"m³",maxDecimals:3}),energy:F({system:"energy",unit:"J",display:"auto",maxDecimals:3}),kilowattHours:F({system:"energy",unit:"kWh",maxDecimals:2}),power:F({system:"power",unit:"W",display:"auto",maxDecimals:2}),kilowatts:F({system:"power",unit:"kW",maxDecimals:2}),force:F({system:"force",unit:"N",display:"auto",maxDecimals:2}),pressure:F({system:"pressure",unit:"Pa",display:"auto",maxDecimals:2}),bar:F({system:"pressure",unit:"bar",maxDecimals:3}),psi:F({system:"pressure",unit:"psi",maxDecimals:1}),torque:F({system:"torque",unit:"N·m",maxDecimals:2}),density:F({system:"density",unit:"kg/m³",maxDecimals:2}),flow:F({system:"flow",unit:"m³/s",maxDecimals:4}),litresPerMinute:F({system:"flow",unit:"L/min",maxDecimals:1}),radians:F({system:"angle",unit:"rad",maxDecimals:4,totals:q(2*Math.PI)}),degrees:F({system:"angle",unit:"°",maxDecimals:2,totals:q(360)}),rpm:F({system:"angularVelocity",unit:"rpm",maxDecimals:0}),angularVelocity:F({system:"angularVelocity",unit:"rad/s",maxDecimals:3}),ppm:F({system:"fraction",unit:"ppm",maxDecimals:2}),ppb:F({system:"fraction",unit:"ppb",maxDecimals:2}),basisPoints:F({system:"fraction",unit:"bp",maxDecimals:1}),molarity:F({system:"molarity",unit:"M",display:"auto",maxDecimals:3}),massFlow:F({system:"massFlow",unit:"kg/s",maxDecimals:3}),tonnesPerHour:F({system:"massFlow",unit:"t/h",maxDecimals:2}),viscosity:F({system:"viscosity",unit:"Pa·s",display:"auto",maxDecimals:3}),kinematicViscosity:F({system:"kinematicViscosity",unit:"cSt",maxDecimals:2}),thermalConductivity:F({system:"thermalConductivity",unit:"W/(m·K)",maxDecimals:3}),specificHeat:F({system:"specificHeat",unit:"J/(kg·K)",maxDecimals:1}),doseRate:F({system:"doseRate",unit:"µSv/h",display:"auto",maxDecimals:2})})}),Be("packages/core/src/columns/types/si.js",function(e,D){"use strict";Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return S}});const re=D("packages/core/src/columns/types/unit.js"),M=re.defineUnit,G=re.registerUnitSystem,F=re.createUnitType,x=Object.freeze([Object.freeze({symbol:"f",name:"femto",factor:1e-15}),Object.freeze({symbol:"p",name:"pico",factor:1e-12}),Object.freeze({symbol:"n",name:"nano",factor:1e-9}),Object.freeze({symbol:"µ",name:"micro",factor:1e-6}),Object.freeze({symbol:"m",name:"milli",factor:.001}),Object.freeze({symbol:"c",name:"centi",factor:.01}),Object.freeze({symbol:"",name:"",factor:1}),Object.freeze({symbol:"k",name:"kilo",factor:1e3}),Object.freeze({symbol:"M",name:"mega",factor:1e6}),Object.freeze({symbol:"G",name:"giga",factor:1e9}),Object.freeze({symbol:"T",name:"tera",factor:1e12}),Object.freeze({symbol:"P",name:"peta",factor:1e15})]),q=Object.freeze(["p","n","µ","m","","k","M","G"]);function W(k){const y=String(k.base),l=new Set([...k.prefixes||q,""]),g=[];for(const i of x){if(!l.has(i.symbol))continue;const t=`${i.symbol}${y}`,o=[];if(k.name){o.push(`${i.name}${k.name}`,`${i.name}${k.name}s`);const c=i.name.slice(-1);if(c&&k.name.startsWith(c)){const f=`${i.name.slice(0,-1)}${k.name}`;o.push(f,`${f}s`)}}i.symbol==="µ"&&o.push(`u${y}`),i.factor===1&&k.aliases&&o.push(...k.aliases),g.push(M(t,i.factor,o))}for(const i of k.extra||[])g.push(i);return g}function I(k,y){const l=W(y);return G(k,l)}function K(k,y,l){return I(k,y),F({system:k,unit:y.base,display:"auto",maxDecimals:3,...l||{}})}const R=Object.freeze({voltage:K("voltage",{base:"V",name:"volt"}),current:K("current",{base:"A",name:"amp",aliases:["ampere","amperes"]}),resistance:K("resistance",{base:"Ω",name:"ohm",aliases:["ohm","ohms","R"],prefixes:["m","","k","M","G"]}),capacitance:K("capacitance",{base:"F",name:"farad",prefixes:["f","p","n","µ","m",""]}),inductance:K("inductance",{base:"H",name:"henry",prefixes:["p","n","µ","m",""]}),charge:K("charge",{base:"C",name:"coulomb",prefixes:["p","n","µ","m",""],extra:[M("mAh",3.6,["milliamphour","milliamphours"],{auto:!1}),M("Ah",3600,["amphour","amphours"],{auto:!1})]}),conductance:K("conductance",{base:"S",name:"siemens",prefixes:["n","µ","m","","k"]}),fluxDensity:K("fluxDensity",{base:"T",name:"tesla",prefixes:["n","µ","m",""],extra:[M("G",1e-4,["gauss"],{auto:!1})]}),luminousFlux:K("luminousFlux",{base:"lm",name:"lumen",prefixes:["m","","k"]}),illuminance:K("illuminance",{base:"lx",name:"lux",prefixes:["m","","k"]}),luminousIntensity:K("luminousIntensity",{base:"cd",name:"candela",prefixes:["m","","k"]}),substance:K("substance",{base:"mol",name:"mole",prefixes:["n","µ","m","","k"]}),absorbedDose:K("absorbedDose",{base:"Gy",name:"gray",prefixes:["µ","m",""]}),equivalentDose:K("equivalentDose",{base:"Sv",name:"sievert",prefixes:["n","µ","m",""]}),radioactivity:K("radioactivity",{base:"Bq",name:"becquerel",prefixes:["","k","M","G","T"],extra:[M("Ci",37e9,["curie","curies"],{auto:!1})]}),frequency:K("frequency",{base:"Hz",name:"hertz",prefixes:["m","","k","M","G","T"]})}),S=K}),Be("packages/core/src/columns/types/temperature.js",function(e,D){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});const M=D("packages/core/src/internal/predicates.js").isNil,G=Object.freeze({C:Object.freeze({symbol:"°C",aliases:["c","°c","celsius","centigrade"],toKelvin:g=>g+273.15,fromKelvin:g=>g-273.15}),F:Object.freeze({symbol:"°F",aliases:["f","°f","fahrenheit"],toKelvin:g=>(g+459.67)*(5/9),fromKelvin:g=>g*(9/5)-459.67}),K:Object.freeze({symbol:"K",aliases:["k","kelvin"],toKelvin:g=>g,fromKelvin:g=>g}),R:Object.freeze({symbol:"°R",aliases:["r","°r","rankine"],toKelvin:g=>g*(5/9),fromKelvin:g=>g*(9/5)})});function F(g){if(M(g))return null;const i=String(g).trim();if(i==="")return null;for(const[o,c]of Object.entries(G))if(i===o||i===c.symbol)return{key:o,scale:c};const t=i.toLowerCase();for(const[o,c]of Object.entries(G))if(c.aliases.includes(t))return{key:o,scale:c};return null}function x(g,i,t){const o=F(i),c=F(t);return!o||!c||!Number.isFinite(Number(g))?null:o.key===c.key?Number(g):c.scale.fromKelvin(o.scale.toKelvin(Number(g)))}const q=new Map;function W(g,i,t){const o=`${g||""}|${i}|${t}`;let c=q.get(o);return c||(c=new Intl.NumberFormat(g||void 0,{minimumFractionDigits:i,maximumFractionDigits:t}),q.set(o,c)),c}function I(g,i){const t=i||{},o=t.nullDisplay??"";if(M(g)||g==="")return o;const c=Number(g);if(!Number.isFinite(c))return o;const f=F(t.scale||"C");if(!f)return String(c);const n=F(t.display||t.scale||"C")||f,m=n.key===f.key?c:n.scale.fromKelvin(f.scale.toKelvin(c)),r=typeof t.decimals=="number"?t.decimals:null,s=r??t.minDecimals??0,d=r??t.maxDecimals??1;return`${W(t.locale,s,d).format(m)}${t.space??" "}${n.scale.symbol}`}const K=/^[+-]?[\d\s., ]*\d/;function R(g,i){const t=String(g).trim();if(t==="")return null;const o=new Intl.NumberFormat(i||void 0).formatToParts(1.1).find(m=>m.type==="decimal")?.value||".",c=o===","?".":",",f=t.split(c).join("").split(/[\s ]/).join("").replace(o,"."),n=Number(f);return Number.isFinite(n)?n:null}function S(g,i){if(M(g))return null;const t=i||{},o=F(t.scale||"C");if(!o)return null;if(typeof g=="number")return Number.isFinite(g)?g:null;let c=String(g).trim();if(c==="")return null;let f=!1;c.startsWith("(")&&c.endsWith(")")&&(f=!0,c=c.slice(1,-1).trim());const n=K.exec(c);if(!n)return null;const m=R(n[0],t.locale);if(m===null)return null;const r=c.slice(n[0].length).trim();if(r==="")return f?-m:m;const s=F(r);if(!s)return null;const d=s.key===o.key?m:o.scale.fromKelvin(s.scale.toKelvin(m));return f?-d:d}function k(g){const i=Object.freeze({scale:"C",...g||{}}),o=(F(i.scale)||F("C")).scale.symbol,c=Object.freeze({...i,display:i.scale,decimals:void 0,minDecimals:0,maxDecimals:20}),f=new Map([[i.locale||"",i]]),n=m=>{const r=m||"";let s=f.get(r);return s||(s=Object.freeze({...i,locale:m||void 0}),f.set(r,s)),s};return{base:"number",extends:"number",storage:"float64",temperatureConfig:i,format:m=>I(m.value,m.locale?n(m.locale):i),parse:m=>S(m.text,m.locale?n(m.locale):i),defaults:{filter:"number",editor:"temperature",align:"end",total:"avg"},totals:{supported:["avg","min","max","count","countValues"]},excel:i.excel||`#,##0${typeof i.decimals=="number"&&i.decimals>0?`.${"0".repeat(i.decimals)}`:".#"}" ${o}"`,toStorage:m=>typeof m=="number"?Number.isFinite(m)?m:null:typeof m=="string"?S(m,i):M(m)?null:S(String(m),i),toClipboard:m=>I(m,c),fromClipboard:m=>S(m,i)}}const y=Object.freeze({celsius:k({scale:"C"}),fahrenheit:k({scale:"F"}),kelvin:k({scale:"K"})}),l=k}),Be("packages/core/src/columns/types/radix.js",function(e,D){"use strict";Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"digitsForWidth",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"radixRange",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"radixName",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"normaliseRadixOptions",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"compileRadixFormat",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"compileRadixParse",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"parseRadixResult",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return j}});const M=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/warn.js").warnOnce,x=Object.freeze({2:2,8:8,16:16,bin:2,binary:2,base2:2,oct:8,octal:8,base8:8,hex:16,hexadecimal:16,base16:16}),q=Object.freeze({2:1,8:3,16:4}),W=Object.freeze({2:"0b",8:"0o",16:"0x"}),I=Object.freeze({2:4,8:3,16:2}),K=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),R=Object.freeze({2:"binary",8:"octal",16:"hexadecimal"}),S=Object.freeze([[/^0x/i,16],[/^0b/i,2],[/^0o/i,8],[/^#/,16]]),k=/[\s\u00a0\u202f_,']/g,y=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,l=Object.freeze([8,16,32,53]),g=new WeakSet,i=new WeakMap,t=new Map,o=new WeakMap,c=new WeakMap,f=Object.freeze({hex:Object.freeze({radix:16}),hex8:Object.freeze({radix:16,bitWidth:8,pad:!0,signed:!1}),hex16:Object.freeze({radix:16,bitWidth:16,pad:!0,signed:!1}),hex32:Object.freeze({radix:16,bitWidth:32,pad:!0,signed:!1}),binary:Object.freeze({radix:2}),binary8:Object.freeze({radix:2,bitWidth:8,pad:!0,signed:!1,group:4}),octal:Object.freeze({radix:8})});function n(E){if(E==null)return 16;const O=typeof E=="string"?E.toLowerCase():E,N=x[O];return N||(F(`radix:base:${String(E)}`,`unsupported radix ${String(E)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function m(E,O){return Math.ceil(E/q[O])}function r(E,O){if(!E)return O?{min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}:{min:0,max:Number.MAX_SAFE_INTEGER};if(!O)return{min:0,max:2**E-1};const N=2**(E-1);return{min:-N,max:N-1}}function s(E){return R[E]||"hexadecimal"}function d(E){if(typeof E=="string"){const O=f[E];return O||F(`radix:preset:${E}`,`unknown radix preset "${E}"; known presets are ${Object.keys(f).join(", ")}`),{...O||{}}}if(E&&typeof E.preset=="string"){const O=f[E.preset];return O||F(`radix:preset:${E.preset}`,`unknown radix preset "${E.preset}"; known presets are ${Object.keys(f).join(", ")}`),{...O||{},...E}}return E||{}}function p(E){const O=d(E),N=n(O.radix),T=q[N];let C=null;if(O.bitWidth!==void 0&&O.bitWidth!==null&&O.bitWidth!==!1){const te=Number(O.bitWidth);l.includes(te)?C=te:F(`radix:width:${String(O.bitWidth)}`,`unsupported bitWidth ${String(O.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let B=O.signed!==!1;!B&&C===null&&(F("radix:unsigned:width","signed: false needs a bitWidth to render a two's-complement pattern; defaulting to 32"),C=32);const z=O.prefix===void 0||O.prefix===!0?W[N]:O.prefix===!1?"":String(O.prefix);let X=0;O.pad===!0?X=C?m(C,N):0:typeof O.pad=="number"&&O.pad>0&&(X=Math.floor(O.pad));let Q=0;O.group===!0?Q=I[N]:typeof O.group=="number"&&O.group>0&&(Q=Math.floor(O.group));const H=r(C,B),L=typeof O.min=="number"?Math.max(H.min,O.min):H.min,Z=typeof O.max=="number"?Math.min(H.max,O.max):H.max,ee=Object.freeze({radix:N,bits:T,prefix:z,uppercase:O.uppercase!==!1,pad:X,group:Q,groupSeparator:typeof O.groupSeparator=="string"?O.groupSeparator:" ",bitWidth:C,signed:B,min:L,max:Z<L?L:Z,nullDisplay:typeof O.nullDisplay=="string"?O.nullDisplay:"",name:s(N)});return g.add(ee),ee}function u(E){if(E&&g.has(E))return E;if(typeof E=="string"){let O=t.get(E);return O||(O=p(E),t.set(E,O)),O}if(E&&typeof E=="object"){let O=i.get(E);return O||(O=p(E),i.set(E,O)),O}return u("hex")}function b(E){return E<0?-Math.round(-E):Math.round(E)}function a(E,O,N){if(O<=0||E.length<=O)return E;const T=E.length%O||O,C=[E.slice(0,T)];for(let B=T;B<E.length;B+=O)C.push(E.slice(B,B+O));return C.join(N)}function h(E){const O=u(E),{radix:N,prefix:T,uppercase:C,pad:B,group:z,groupSeparator:X,signed:Q,bitWidth:H,nullDisplay:L}=O,Z=H?2**H:0,ee=te=>{if(M(te)||te==="")return L;const se=typeof te=="number"?te:Number(te);if(!Number.isFinite(se))return L;const ne=b(se);let ae="",de=ne;ne<0&&(Q?(ae="-",de=-ne):de=(ne%Z+Z)%Z);let le=de.toString(N);return le=C?le.toUpperCase():le.toLowerCase(),B>0&&le.length<B&&(le=le.padStart(B,"0")),z>0&&(le=a(le,z,X)),ae+T+le};return ee.options=O,ee}function w(E,O){const N=u(O);let T=o.get(N);return T||(T=h(N),o.set(N,T)),T(E)}function v(E){const O=u(E),{radix:N,groupSeparator:T,signed:C,min:B,max:z}=O,X=K[N],Q=H=>{if(M(H))return{ok:!0,value:null,reason:"blank"};let L=String(H);if(T&&T!==""&&(L=L.split(T).join("")),L=L.replace(k,""),L==="")return{ok:!0,value:null,reason:"blank"};let Z=!1;if((L[0]==="-"||L[0]==="+")&&(Z=L[0]==="-",L=L.slice(1)),L==="")return{ok:!1,value:null,reason:"digits"};let ee=null;for(const[se,ne]of S){const ae=se.exec(L);if(!ae)continue;const de=L.slice(ae[0].length);if(de==="")break;if(!K[ne].test(de))return{ok:!1,value:null,reason:"digits"};ee=parseInt(de,ne);break}if(ee===null)if(X.test(L))ee=parseInt(L,N);else if(y.test(L))ee=Number(L);else return{ok:!1,value:null,reason:"digits"};if(!Number.isFinite(ee))return{ok:!1,value:null,reason:"digits"};const te=b(Z?-ee:ee);return!C&&te<0?{ok:!1,value:te,reason:"negative"}:te<B||te>z?{ok:!1,value:te,reason:"range"}:{ok:!0,value:te,reason:"ok"}};return Q.options=O,Q}function A(E,O){const N=u(O);let T=c.get(N);return T||(T=v(N),c.set(N,T)),T(E)}function _(E,O){const N=A(E,O);return N.ok?N.value:null}function V(E,O){const N=M(E)||Number.isNaN(E)?null:Number(E),T=M(O)||Number.isNaN(O)?null:Number(O);return N===null?T===null?0:1:T===null||N<T?-1:N>T?1:0}function Y(E){const O=E.min>=-2147483648&&E.max<=2147483647;return E.bitWidth&&O?"int32":"float64"}function $(E){const O=p(E),N=h(O),T=v(O);return{base:"number",extends:"number",storage:Y(O),matches:null,format:C=>N(C.value),parse:C=>{const B=T(C.text);return B.ok?B.value:null},compare:V,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:C=>N(C),fromClipboard:C=>{const B=T(C);return B.ok?B.value:null},radix:O,formatValue:N,parseText:T}}const j=$}),Be("packages/core/src/columns/types/aggregable.js",function(e,D){"use strict";Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"weightedMean",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"logarithmicSum",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"logarithmicMean",{enumerable:!0,get:function(){return x}});const M=D("packages/core/src/internal/predicates.js").isNil;function G(R){const S=[];for(const k of R||[]){if(M(k))continue;const y=Number(k);Number.isFinite(y)&&S.push(y)}return S}function F(R){return S=>{const k=G(S);if(!k.length)return null;let y=0;for(const l of k)y+=10**(l/R);return R*Math.log10(y)}}function x(R){return S=>{const k=G(S);if(!k.length)return null;let y=0;for(const l of k)y+=10**(l/R);return R*Math.log10(y/k.length)}}function q(R,S){const k=S&&S.column,l=(k&&k.typeOptions||{}).weight,g=S&&S.valueAt;if(!l||typeof g!="function")return null;let i=0,t=0;for(let o=0;o<R.length;o++){if(M(R[o]))continue;const c=Number(R[o]);if(!Number.isFinite(c))continue;const f=g(l,o);if(M(f))continue;const n=Number(f);!Number.isFinite(n)||n<=0||(i+=c*n,t+=n)}return t===0?null:i/t}function W(R={}){const S=R.factor===20?20:10,k=typeof R.suffix=="string"?R.suffix:"",y=Number.isInteger(R.decimals)?R.decimals:1;return{base:"number",storage:"float64",name:R.name||"logarithmic",format:l=>{const g=l&&l.value;return M(g)||!Number.isFinite(Number(g))?"":`${Number(g).toFixed(y)}${k}`},parse:l=>{const g=String((l&&l.text)??"").replace(k,"").trim();if(!g)return null;const i=Number(g);return Number.isFinite(i)?i:null},defaults:{align:"end",filter:"number"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:{sum:F(S),avg:x(S)}}}}function I(R={}){const S=Number.isInteger(R.decimals)?R.decimals:1,k=R.percent===!0;return{base:"number",storage:"float64",name:R.name||"ratio",format:y=>{const l=y&&y.value;return M(l)||!Number.isFinite(Number(l))?"":k?`${Number(l).toFixed(S)}%`:Number(l).toFixed(S)},parse:y=>{const l=String((y&&y.text)??"").replace("%","").trim();if(!l)return null;const g=Number(l);return Number.isFinite(g)?g:null},defaults:{align:"end",filter:"number"},totals:{supported:["avg","min","max","count","countValues"],implement:{avg:q}}}}const K=Object.freeze({decibel:W({name:"decibel",factor:10,suffix:" dB"}),decibelAmplitude:W({name:"decibelAmplitude",factor:20,suffix:" dB"}),ratio:I({name:"ratio"}),percentRate:I({name:"percentRate",percent:!0})})}),Be("packages/core/src/columns/types/currency.js",function(e,D){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"moneyToText",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});const M=D("packages/core/src/internal/predicates.js").isNil,G="⚠ no rate";function F(m){if(M(m))return null;const r=String(m).trim().toUpperCase();return r===""?null:r}function x(m){if(M(m))return null;if(typeof m=="object"&&!Array.isArray(m)){const r=Number(m.amount),s=F(m.code);return!s||!Number.isFinite(r)?null:{amount:r,code:s}}if(Array.isArray(m)&&m.length===2){const r=Number(m[0]),s=F(m[1]);return!s||!Number.isFinite(r)?null:{amount:r,code:s}}return null}const q=Object.freeze({$:"USD","€":"EUR","£":"GBP","¥":"JPY","₹":"INR","₩":"KRW","₽":"RUB","₺":"TRY","₴":"UAH","₪":"ILS"}),W=Object.freeze({USD:"$",EUR:"€",GBP:"£",JPY:"¥",INR:"₹",KRW:"₩",RUB:"₽",TRY:"₺",UAH:"₴",ILS:"₪"}),I=/[+-]?[\d\s., ]*\d/;function K(m,r){const s=String(m).trim();if(s==="")return null;const d=new Intl.NumberFormat(r||void 0).formatToParts(1.1).find(a=>a.type==="decimal")?.value||".",p=d===","?".":",",u=s.split(p).join("").split(/[\s ]/).join("").replace(d,"."),b=Number(u);return Number.isFinite(b)?b:null}function R(m,r){const s=r||{},d=F(s.code);if(M(m))return null;const p=x(m);if(p)return p;if(typeof m=="number")return Number.isFinite(m)&&d?{amount:m,code:d}:null;let u=String(m).trim();if(u==="")return null;let b=!1;u.startsWith("(")&&u.endsWith(")")&&(b=!0,u=u.slice(1,-1).trim());let a=null;for(const[V,Y]of Object.entries(q)){if(u.startsWith(V)){a=Y,u=u.slice(V.length).trim();break}if(u.endsWith(V)){a=Y,u=u.slice(0,-V.length).trim();break}}const h=I.exec(u);if(!h)return null;const w=K(h[0],s.locale);if(w===null)return null;const v=(u.slice(0,h.index)+" "+u.slice(h.index+h[0].length)).trim();!a&&v!==""&&(a=F(v));const A=a||d;return A?{amount:b?-w:w,code:A}:null}function S(m,r){if(typeof m=="function")return(s,d)=>{if(s===d)return 1;const p=m(s,d);return typeof p=="number"&&Number.isFinite(p)&&p>0?p:null};if(m&&typeof m=="object"){const s=m;return(d,p)=>{if(d===p)return 1;const u=Number(s[d]),b=Number(s[p]);return!Number.isFinite(u)||!Number.isFinite(b)||u<=0||b<=0?null:b/u}}return(s,d)=>s===d?1:null}function k(m,r,s){if(!m)return null;if(m.code===r)return m.amount;const d=s(m.code,r);return d===null?null:m.amount*d}const y=new Map;function l(m,r,s){const d=`${m||""}|${r}|${s??""}`;let p=y.get(d);if(!p){const u={style:"currency",currency:r};typeof s=="number"&&(u.minimumFractionDigits=s,u.maximumFractionDigits=s);try{p={fmt:new Intl.NumberFormat(m||void 0,u),currency:!0}}catch{p={fmt:new Intl.NumberFormat(m||void 0,typeof s=="number"?{minimumFractionDigits:s,maximumFractionDigits:s}:{}),currency:!1}}y.set(d,p)}return p}function g(m,r){const s=r||{},d=s.nullDisplay??"",p=x(m);if(!p)return d;const u=F(s.display)||p.code;let b=p.amount,a=p.code;if(u!==p.code){const v=s.rateFn||S(s.rates,s.rateBase),A=k(p,u,v);if(A===null)return`${s.missingRate??G} ${p.code}→${u}`;b=A,a=u}const{fmt:h,currency:w}=l(s.locale,a,s.decimals);return w?h.format(b):`${h.format(b)} ${a}`}function i(m){const r=x(m);return r?`${r.amount} ${r.code}`:""}function t(m){const r=m||{},s=F(r.display),d=r.rateFn||S(r.rates,r.rateBase);return(p,u)=>{const b=x(p),a=x(u);if(!b&&!a)return 0;if(!b)return 1;if(!a)return-1;if(s){const h=k(b,s,d),w=k(a,s,d);if(h!==null&&w!==null)return h===w?0:h<w?-1:1}return b.code===a.code?b.amount===a.amount?0:b.amount<a.amount?-1:1:b.code<a.code?-1:1}}function o(m){const r=m||{},s=(p,u)=>{const b=[];for(const A of p||[]){const _=x(A);_&&b.push(_)}if(!b.length)return null;if(new Set(b.map(A=>A.code)).size===1){const A=b[0].code;return{amount:u(b.map(_=>_.amount)),code:A}}const h=F(r.display);if(!h)return`${r.missingRate??G}: mixed currencies, no display currency set`;const w=r.rateFn||S(r.rates,r.rateBase),v=[];for(const A of b){const _=k(A,h,w);if(_===null)return`${r.missingRate??G}: ${A.code}→${h}`;v.push(_)}return{amount:u(v),code:h}},d=p=>p.reduce((u,b)=>u+b,0);return{sum:p=>s(p,d),avg:p=>s(p,u=>d(u)/u.length),min:p=>s(p,u=>Math.min(...u)),max:p=>s(p,u=>Math.max(...u))}}function c(m){const r=Object.freeze({code:"USD",...m||{}}),s=S(r.rates,r.rateBase),d=Object.freeze({...r,rateFn:s}),p=o(d),u=t(d),b=new Map([[r.locale||"",d]]),a=v=>{const A=v||"";let _=b.get(A);return _||(_=Object.freeze({...d,locale:v||void 0}),b.set(A,_)),_},h=W[F(r.display||r.code)]||"",w=typeof r.decimals=="number"&&r.decimals>0?`.${"0".repeat(r.decimals)}`:".00";return{base:"object",extends:"object",storage:"object",name:"currency",currencyConfig:d,format:v=>g(v.value,v.locale?a(v.locale):d),parse:v=>R(v.text,v.locale?a(v.locale):d),compare:u,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:p},excel:r.excel||(h?`"${h}"#,##0${w}`:`#,##0${w}`),toStorage:v=>{const A=x(v);return A||(typeof v=="string"||typeof v=="number"?R(v,d):null)},toClipboard:v=>i(v),fromClipboard:v=>R(v,d)}}const f=Object.freeze({currency:c({code:"USD"}),usd:c({code:"USD"}),eur:c({code:"EUR"}),gbp:c({code:"GBP"}),jpy:c({code:"JPY",decimals:0})}),n=c}),Be("packages/core/src/columns/types/index.js",function(e,D){"use strict";Object.defineProperty(e,"EXTENDED_TYPES",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return V}});const re=D("packages/core/src/columns/types/temporal.js"),M=re.TEMPORAL_TYPES,G=D("packages/core/src/columns/types/network.js"),F=G.NETWORK_TYPES,x=D("packages/core/src/columns/types/structured.js"),q=x.STRUCTURED_TYPES,W=D("packages/core/src/columns/types/unit.js"),I=W.createUnitType,K=W.UNIT_SYSTEMS,R=W.parseUnit,S=W.formatUnit,k=W.registerUnitSystem,y=W.unitSystemNames,l=W.unitsOf,g=W.defineUnit,i=D("packages/core/src/columns/types/engineering.js"),t=i.ENGINEERING_TYPES,o=D("packages/core/src/columns/types/si.js"),c=o.SI_TYPES,f=o.createSiType,n=o.createSiSystem,m=o.siUnits,r=o.SI_PREFIXES,s=D("packages/core/src/columns/types/temperature.js"),d=s.TEMPERATURE_TYPES,p=s.createTemperatureType,u=s.convertTemperature,b=s.formatTemperature,a=s.parseTemperature,h=s.TEMPERATURE_SCALES,w=D("packages/core/src/columns/types/radix.js"),v=w.createRadixType,A=w.RADIX_PRESETS,_=w.parseRadix,V=w.formatRadix,Y=D("packages/core/src/columns/types/aggregable.js"),$=Y.AGGREGABLE_TYPES,j=D("packages/core/src/columns/types/currency.js"),E=j.CURRENCY_TYPES,O=j.createCurrencyType,N=j.parseMoney,T=j.formatMoney,C=j.convertMoney,B=j.toMoney,z=j.rateFunction,X=j.moneyComparator,Q=j.normaliseCode,H=j.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return W.findUnit}}),Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return i.ENGINEERING_TYPES}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return i.circularMean}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return s.TEMPERATURE_TYPES}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return s.createTemperatureType}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return s.convertTemperature}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return s.formatTemperature}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return s.parseTemperature}}),Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return s.TEMPERATURE_SCALES}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return s.findScale}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return j.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return j.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return j.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return j.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return j.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return j.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return j.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return j.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return j.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return j.MISSING_RATE}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return re.TEMPORAL_TYPES}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return G.NETWORK_TYPES}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return x.STRUCTURED_TYPES}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return Y.AGGREGABLE_TYPES}}),Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return Y.createLogarithmicType}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return Y.createRatioType}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return re.parseTime}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return re.formatTime}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return re.parseDateTime}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return re.formatDateTime}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return re.parseDuration}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return re.formatDuration}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return G.parseIpv4}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return G.formatIpv4}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return G.parseCidr}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return G.formatCidr}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return G.parseIpv6}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return G.formatIpv6}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return G.networkAddress}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return G.broadcastAddress}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return G.hostCount}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return G.containsAddress}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return G.overlaps}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return x.maskValue}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return x.summariseJson}});const L=Object.freeze({...M,...F,...q,...$,hex:v(A.hex),hex8:v(A.hex8),hex16:v(A.hex16),hex32:v(A.hex32),binary:v(A.binary),binary8:v(A.binary8),octal:v(A.octal),bytes:I({system:"data",unit:"B",display:"auto"}),megabytes:I({system:"data",unit:"MB"}),gigabytes:I({system:"data",unit:"GB"}),bitrate:I({system:"bitrate",unit:"Mbps"}),gigabits:I({system:"bitrate",unit:"Gbps"}),...t,...c,...d,...E});{const Z=new Set;for(const ee of[M,F,q,$,t,c,d,E])for(const te of Object.keys(ee)){if(Z.has(te))throw new Error(`[lattice] data type "${te}" is declared twice`);Z.add(te)}}}),Be("packages/core/src/compute/handle.js",function(e,D){"use strict";Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return c}});const re=D("packages/core/src/internal/compare.js"),M=re.collator,G=re.defaultCompare,x=D("packages/core/src/internal/warn.js").warnOnce;function q(f){const n=new Uint32Array(f);for(let m=0;m<f;m++)n[m]=m;return n}function W(f,n){if(n&&typeof n.count=="number")return n.count;if(!f)return 0;if(typeof f.count=="number")return f.count;if(typeof f.length=="number")return f.length;const m=f.values;return f.kind==="multi"&&f.offsets?Math.max(0,f.offsets.length-1):m?f.kind==="bitset"?typeof m.size=="number"?m.size:f.presence&&typeof f.presence.size=="number"?f.presence.size:(x(`count:${f.id}`,`column "${f.id}" is bitset-backed with no declared row count; assuming ${m.length*8}`),m.length*8):m.length:f.presence&&typeof f.presence.size=="number"?f.presence.size:0}const I=new WeakMap;function K(f){const n=f.constructor;if(!n)return"unknown";const m=I.get(n);if(m)return m;let r="unknown";try{let s=null;typeof n.from=="function"?s=n.from([!1,!0]):(s=new n(8),s.set(1));const d=s&&s.words;d&&d.length&&(d[0]===2?r="lsb":d[0]===64&&(r="msb"))}catch{r="unknown"}return I.set(n,r),r}function R(f){if(!f)return()=>0;const n=f instanceof Uint8Array?f:f.words;if(n instanceof Uint8Array){const m=f instanceof Uint8Array?"lsb":K(f);if(m==="lsb")return r=>n[r>>>3]>>>(r&7)&1;if(m==="msb")return r=>n[r>>>3]>>>7-(r&7)&1}return typeof f.get=="function"?m=>f.get(m)?1:0:()=>0}function S(f){return!f||!f.presence?null:R(f.presence)}function k(f){return f?typeof f.size=="number"?f.size:typeof f.values=="function"?f.values().length:0:0}function y(f,n){return f?typeof f.valueOf=="function"?f.valueOf(n):typeof f.values=="function"?f.values()[n]:null:null}function l(f,n){const m=f.offsets,r=f.values;if(!m||!r)return[];const s=m[n],d=m[n+1];if(!(d>s))return[];const p=f.dict,u=new Array(d-s);for(let b=s;b<d;b++)u[b-s]=p?y(p,r[b]):r[b];return u}function g(f){if(!f)return()=>{};const n=f.values,m=S(f),r=f.kind;if(r==="dictionary"){const s=f.dict;return m?d=>m(d)?y(s,n[d]):null:d=>y(s,n[d])}if(r==="bitset"){const s=R(n);return m?d=>m(d)?s(d)===1:null:d=>s(d)===1}if(r==="multi")return m?s=>m(s)?l(f,s):null:s=>l(f,s);if(!n&&typeof f.get=="function"){const s=f.get.bind(f);return d=>{const p=s(d);return p===void 0?null:p}}return m?s=>{if(!m(s))return null;const d=n[s];return d===void 0?null:d}:s=>{const d=n[s];return d===void 0?null:d}}function i(f,n){if(f<n)return-1;if(f>n)return 1;if(f===n){const s=Object.is(f,-0),d=Object.is(n,-0);return s===d?0:s?-1:1}const m=Number.isNaN(f),r=Number.isNaN(n);return m&&r?0:m?1:-1}function t(f){const n=M(f);return(m,r)=>{if(m===r)return 0;const s=typeof m,d=typeof r;if(s==="string"&&d==="string")return n.compare(m,r);if(s==="number"&&d==="number")return i(m,r);if(s==="boolean"&&d==="boolean")return m===r?0:m?1:-1;if(m instanceof Date||r instanceof Date){const p=m instanceof Date?m.getTime():Number(m),u=r instanceof Date?r.getTime():Number(r);return i(p,u)}return G(m,r)}}function o(f,n){if(f&&typeof f.ranks=="function")return f.ranks(n);const m=f&&typeof f.values=="function"?f.values():[],r=m.length,s=t(n),d=new Array(r);for(let u=0;u<r;u++)d[u]=u;d.sort((u,b)=>s(m[u],m[b])||u-b);const p=new Uint32Array(r);for(let u=0;u<r;u++)p[d[u]]=u;return p}function c(f){return f==null||typeof f=="number"&&Number.isNaN(f)}}),Be("packages/core/src/compute/filter.js",function(e,D){"use strict";Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"wallMs",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return de}});const M=D("packages/core/src/internal/predicates.js").isBlank,F=D("packages/core/src/internal/merge.js").toArray,q=D("packages/core/src/internal/warn.js").warnOnce,W=D("packages/core/src/format/date.js"),I=W.toDate,K=W.toIsoDate,R=D("packages/core/src/compute/handle.js"),S=R.bitReader,k=R.dictSize,y=R.dictValue,l=R.presenceReader,g=R.valueComparator,i=R.valueReader,t=/^\d{4}-\d{2}-\d{2}$/,o="\0null\0";function c(le,be){const Ce=le&&le.pool;if(Ce){const Ne=Ce.mask||Ce.acquireMask||Ce.acquire||Ce.take;if(typeof Ne=="function"){const he=Ne.call(Ce,be);if(he&&he.length>=be)return he}}return new Uint8Array(be)}function f(le,be){const Ce=le&&le.pool;if(!Ce||!be)return;const Ne=Ce.release||Ce.releaseMask||Ce.free||Ce.recycle;typeof Ne=="function"&&Ne.call(Ce,be)}function n(le,be,Ce){return le.fill(Ce,0,be),le}function m(le){return le==null||typeof le=="number"&&Number.isNaN(le)}function r(le,be){if(le==null)return le;if(be==="number")return typeof le=="number"?le:Number(le);if(be==="date"||be==="dateString"){const Ce=K(le);return Ce===null?s(le):Ce}return be==="boolean"?typeof le=="boolean"?le:le==="true"||le===1?!0:le==="false"||le===0?!1:!!le:le}function s(le){return le instanceof Date?le.getTime():typeof le=="number"?le:Date.parse(String(le))}function d(le){return typeof le=="number"?le:le instanceof Date?le.getTime():le==null||le===""?NaN:Number(le)}function p(le,be){const Ce=typeof le=="string"?le:String(le);return be?Ce:Ce.toLowerCase()}function u(le,be){return le==null?o:typeof le=="string"?be?le:le.toLowerCase():le instanceof Date?le.getTime():le}function b(le,be,Ce){const Ne=new Set;for(const he of F(le)){const ie=r(he,Ce);Ne.add(u(ie,be)),typeof ie=="string"&&ie!==""&&Number.isFinite(Number(ie))?Ne.add(Number(ie)):typeof ie=="number"&&Number.isFinite(ie)&&Ne.add(u(String(ie),be))}return Ne}function a(le,be,Ce){if(le==null||be===null||be===void 0)return le==null&&be==null;const Ne=typeof le,he=typeof be;return Ne==="string"&&he==="string"?Ce?le===be:le.toLowerCase()===be.toLowerCase():le instanceof Date||be instanceof Date?s(le)===s(be):Ne==="number"&&he==="number"?le===be||Number.isNaN(le)&&Number.isNaN(be):Ne==="number"&&he==="string"?le===Number(be):Ne==="string"&&he==="number"?Number(le)===be:Ne==="boolean"||he==="boolean"?le===be:Array.isArray(le)&&Array.isArray(be)?le.length===be.length&&le.every((ie,ue)=>a(ie,be[ue],Ce)):le===be}function h(le,be){try{if(le instanceof RegExp){const Ce=le.flags.replace(/[gy]/g,"");return new RegExp(le.source,be||Ce.includes("i")?Ce:`${Ce}i`)}return new RegExp(String(le),be?"":"i")}catch(Ce){return q(`regex:${String(le)}`,`filter operator "matches" received an invalid pattern: ${String(le)}`,Ce),null}}function w(le,be){if(le&&le.type==="datetime"&&v.has(le.op))return $(le,be);const Ce=j(le,be),Ne=le&&le.type;return Ne!=="date"&&Ne!=="dateString"?Ce:he=>Ce(typeof he=="string"&&t.test(he)?he:K(he)??he)}const v=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn"]),A=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3})\d*)?)?)?$/,_=new Map;function V(le,be){let Ce=_.get(be);if(Ce===void 0){try{Ce=new Intl.DateTimeFormat("en-CA",{timeZone:be,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{Ce=null}_.set(be,Ce)}if(!Ce)return null;const Ne={};for(const he of Ce.formatToParts(le))he.type!=="literal"&&(Ne[he.type]=he.value);return Ne}function Y(le,be){if(le==null||le==="")return null;if(typeof le=="string"){const ie=A.exec(le.trim());if(ie)return Date.UTC(+ie[1],+ie[2]-1,+ie[3],+(ie[4]||0),+(ie[5]||0),+(ie[6]||0),+(ie[7]||"0").padEnd(3,"0"))}const Ce=I(le);if(!Ce)return null;const Ne=Ce.getUTCMilliseconds(),he=be?V(Ce,be):null;return he?Date.UTC(+he.year,+he.month-1,+he.day,he.hour==="24"?0:+he.hour,+he.minute,+he.second,Ne):Date.UTC(Ce.getFullYear(),Ce.getMonth(),Ce.getDate(),Ce.getHours(),Ce.getMinutes(),Ce.getSeconds(),Ne)}function $(le,be){const Ce=typeof le.timeZone=="string"&&le.timeZone?le.timeZone:void 0,Ne=ue=>Y(ue,Ce),he=Array.isArray(le.value)?le.value.map(Ne):Ne(le.value),ie=j({...le,type:"number",value:he},be);return ue=>ie(Y(ue))}function j(le,be){const Ce=le&&le.op,Ne=!!(le&&le.caseSensitive),he=le&&le.type,ie=g(be),ue=ge=>pe=>!ge(pe);switch(Ce){case"eq":{const ge=r(le.value,he);return pe=>a(pe,ge,Ne)}case"ne":{const ge=r(le.value,he);return pe=>!a(pe,ge,Ne)}case"lt":case"lte":case"gt":case"gte":{const ge=r(le.value,he);if(m(ge))return()=>!1;const pe=Ce==="lt"?-1:Ce==="lte"?0:Ce==="gt"?1:2;return Oe=>{if(m(Oe))return!1;const ve=ie(Oe,ge);return pe===-1?ve<0:pe===0?ve<=0:pe===1?ve>0:ve>=0}}case"between":case"notBetween":{const ge=F(le.value),pe=r(ge[0],he),Oe=r(ge[1],he),ve=le.bounds||"[]",ye=ve.charAt(0)!=="(",Ae=ve.charAt(1)!==")";if(m(pe)||m(Oe))return Ce==="between"?()=>!1:()=>!0;const Me=je=>{if(m(je))return!1;const _e=ie(je,pe),Pe=ie(je,Oe);return(ye?_e>=0:_e>0)&&(Ae?Pe<=0:Pe<0)};return Ce==="between"?Me:ue(Me)}case"in":case"notIn":{const ge=b(le.value,Ne,he),pe=Oe=>ge.has(u(Oe,Ne));return Ce==="in"?pe:ue(pe)}case"contains":case"notContains":{const ge=p(r(le.value,he),Ne),pe=Oe=>Oe==null?!1:p(Oe,Ne).includes(ge);return Ce==="contains"?pe:ue(pe)}case"startsWith":{const ge=p(r(le.value,he),Ne);return pe=>pe==null?!1:p(pe,Ne).startsWith(ge)}case"endsWith":{const ge=p(r(le.value,he),Ne);return pe=>pe==null?!1:p(pe,Ne).endsWith(ge)}case"matches":{const ge=h(le.value,Ne);return ge?pe=>pe==null?!1:ge.test(String(pe)):()=>!1}case"blank":case"notBlank":{const ge=le.trim===!0,pe=Oe=>M(Oe)||Array.isArray(Oe)&&Oe.length===0||ge&&typeof Oe=="string"&&Oe.trim()==="";return Ce==="blank"?pe:Oe=>!pe(Oe)}case"containsAny":case"containsNone":{const ge=b(le.value,Ne,he),pe=Oe=>{const ve=Oe==null?[]:F(Oe);for(let ye=0;ye<ve.length;ye++)if(ge.has(u(ve[ye],Ne)))return!0;return!1};return Ce==="containsAny"?pe:ue(pe)}case"containsAll":{const ge=F(le.value).map(pe=>u(r(pe,he),Ne));return pe=>{const Oe=pe==null?[]:F(pe);if(ge.length===0)return!0;const ve=new Set(Oe.map(ye=>u(ye,Ne)));for(let ye=0;ye<ge.length;ye++)if(!ve.has(ge[ye]))return!1;return!0}}default:{const ge=de(Ce);return ge?ge.compile(le.value):(q(`op:${String(Ce)}`,`unknown filter operator "${String(Ce)}"; the condition is refused rather than matching every row`),()=>!1)}}}function E(le,be,Ce){return w(be,Ce)(le)}const O=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),N=new Set(["containsAny","containsAll","containsNone"]);function T(le,be,Ce){const Ne=le&&le.op,he=O[Ne]||Ne,ie=w({...le,op:he,type:be.type},Ce),ue=be.items,ge=pe=>{const Oe=ue(pe);if(!Oe)return!1;for(let ve=0;ve<Oe.length;ve++)if(ie(Oe[ve]))return!0;return!1};return O[Ne]?pe=>!ge(pe):ge}function C(le,be,Ce,Ne,he){const ie=he?null:l(le);if(ie){const pe=be?1:0;for(let Oe=0;Oe<Ne;Oe++)Ce[Oe]=ie(Oe)===pe?1:0;return Ce}const ue=le.kind;if(ue==="float64"||ue==="int32"||ue==="bitset")return n(Ce,Ne,be?1:0);const ge=i(le);for(let pe=0;pe<Ne;pe++){const Oe=ge(pe),ve=M(Oe)||Array.isArray(Oe)&&Oe.length===0||he&&typeof Oe=="string"&&Oe.trim()==="";Ce[pe]=ve===be?0:1}return Ce}function B(le,be,Ce,Ne){const he=le.dict,ie=k(he),ue=new Uint8Array(ie);for(let ve=0;ve<ie;ve++)ue[ve]=be(y(he,ve))?1:0;const ge=le.values,pe=l(le);if(!pe){for(let ve=0;ve<Ne;ve++)Ce[ve]=ue[ge[ve]];return Ce}const Oe=be(null)?1:0;for(let ve=0;ve<Ne;ve++)Ce[ve]=pe(ve)===1?ue[ge[ve]]:Oe;return Ce}function z(le,be,Ce,Ne){const he=S(le.values),ie=be(!0)?1:0,ue=be(!1)?1:0,ge=l(le);if(!ge){for(let Oe=0;Oe<Ne;Oe++)Ce[Oe]=he(Oe)===1?ie:ue;return Ce}const pe=be(null)?1:0;for(let Oe=0;Oe<Ne;Oe++)Ce[Oe]=ge(Oe)===0?pe:he(Oe)===1?ie:ue;return Ce}function X(le,be,Ce,Ne,he){const ie=le.values,ue=be.type,ge=be.op;let pe=!0;switch(ge){case"eq":case"ne":{const ve=d(r(be.value,ue)),ye=typeof be.value=="number"&&Number.isNaN(be.value),Ae=ge==="ne"?1:0;if(ye)for(let Me=0;Me<he;Me++)Ne[Me]=(Number.isNaN(ie[Me])?1:0)^Ae;else for(let Me=0;Me<he;Me++)Ne[Me]=(ie[Me]===ve?1:0)^Ae;break}case"lt":{const ve=d(r(be.value,ue));for(let ye=0;ye<he;ye++)Ne[ye]=ie[ye]<ve?1:0;break}case"lte":{const ve=d(r(be.value,ue));for(let ye=0;ye<he;ye++)Ne[ye]=ie[ye]<=ve?1:0;break}case"gt":{const ve=d(r(be.value,ue));for(let ye=0;ye<he;ye++)Ne[ye]=ie[ye]>ve?1:0;break}case"gte":{const ve=d(r(be.value,ue));for(let ye=0;ye<he;ye++)Ne[ye]=ie[ye]>=ve?1:0;break}case"between":case"notBetween":{const ve=F(be.value),ye=d(r(ve[0],ue)),Ae=d(r(ve[1],ue)),Me=be.bounds||"[]",je=Me.charAt(0)!=="(",_e=Me.charAt(1)!==")",Pe=ge==="notBetween"?1:0;if(je&&_e)for(let Se=0;Se<he;Se++)Ne[Se]=(ie[Se]>=ye&ie[Se]<=Ae?1:0)^Pe;else if(je)for(let Se=0;Se<he;Se++)Ne[Se]=(ie[Se]>=ye&ie[Se]<Ae?1:0)^Pe;else if(_e)for(let Se=0;Se<he;Se++)Ne[Se]=(ie[Se]>ye&ie[Se]<=Ae?1:0)^Pe;else for(let Se=0;Se<he;Se++)Ne[Se]=(ie[Se]>ye&ie[Se]<Ae?1:0)^Pe;break}case"in":case"notIn":{const ve=new Set;for(const Ae of F(be.value)){const Me=d(r(Ae,ue));Number.isNaN(Me)||ve.add(Me)}const ye=ge==="notIn"?1:0;for(let Ae=0;Ae<he;Ae++)Ne[Ae]=(ve.has(ie[Ae])?1:0)^ye;break}default:pe=!1;break}if(!pe)return!1;const Oe=l(le);if(Oe){const ve=Ce(null)?1:0;for(let ye=0;ye<he;ye++)Oe(ye)===0&&(Ne[ye]=ve)}return!0}function Q(le,be,Ce,Ne){const he=i(le);for(let ie=0;ie<Ne;ie++)Ce[ie]=be(he(ie))?1:0;return Ce}function H(le,be,Ce){const Ne=be.count|0,he=Ce||c(be,Ne);if(!le)return n(he,Ne,1);const ie=typeof be.handle=="function"?be.handle(le.col):void 0,ue=typeof be.custom=="function"?be.custom:null;if(!ie){if(ue){for(let ve=0;ve<Ne;ve++)he[ve]=ue(le,ve)?1:0;return he}return q(`filter:col:${String(le.col)}`,`filter references unknown column "${String(le.col)}"; the condition is refused rather than matching every row`),n(he,Ne,0)}const ge=le.op;if(ge==="blank"||ge==="notBlank")return C(ie,ge==="notBlank",he,Ne,le.trim===!0);const pe=typeof be.itemwise=="function"?be.itemwise(le.col):null;if(pe&&!de(ge)&&!N.has(ge))return Q(ie,T(le,pe,be.locale),he,Ne);const Oe=w(le,be.locale);switch(ie.kind){case"dictionary":return B(ie,Oe,he,Ne);case"bitset":return z(ie,Oe,he,Ne);case"float64":case"int32":return X(ie,le,Oe,he,Ne)?he:Q(ie,Oe,he,Ne);default:return Q(ie,Oe,he,Ne)}}function L(le,be,Ce){if(!le)return n(c(be,Ce),Ce,1);if(Array.isArray(le.conditions)){const Ne=le.conditions.filter(ue=>ue!=null),he=le.op==="or"?"or":le.op==="not"?"not":"and";if(Ne.length===0)return n(c(be,Ce),Ce,1);const ie=L(Ne[0],be,Ce);for(let ue=1;ue<Ne.length;ue++){const ge=L(Ne[ue],be,Ce);if(he==="or")for(let pe=0;pe<Ce;pe++)ie[pe]|=ge[pe];else for(let pe=0;pe<Ce;pe++)ie[pe]&=ge[pe];f(be,ge)}if(he==="not")for(let ue=0;ue<Ce;ue++)ie[ue]^=1;return ie}return H(le,be,c(be,Ce))}function Z(le,be){return L(le,be,be.count|0)}function ee(le,be){if(!le||!be)return le||null;const Ce=le;if(Array.isArray(Ce.conditions)){if((Ce.op==="or"?"or":Ce.op==="not"?"not":"and")!=="and")return te(Ce,be)?null:le;const he=[];for(const ie of Ce.conditions){const ue=ee(ie,be);ue&&he.push(ue)}return he.length?{...Ce,op:"and",conditions:he}:null}return Ce.col===be?null:le}function te(le,be){if(!le||typeof le!="object")return!1;const Ce=le;if(Ce.col===be)return!0;if(Array.isArray(Ce.conditions)){for(const Ne of Ce.conditions)if(te(Ne,be))return!0}return!1}function se(le,be,Ce){if(Ce&&Ce.length>=be){let ue=0;for(let ge=0;ge<be;ge++)le[ge]&&(Ce[ue++]=ge);return Ce.subarray(0,ue)}let Ne=0;for(let ue=0;ue<be;ue++)Ne+=le[ue]?1:0;const he=new Uint32Array(Ne);let ie=0;for(let ue=0;ue<be;ue++)le[ue]&&(he[ie++]=ue);return he}const ne=new Map;function ae(le){if(!(!le||typeof le!="object"))for(const[be,Ce]of Object.entries(le))Ce&&typeof Ce.compile=="function"&&ne.set(be,Ce)}function de(le){return typeof le=="string"?ne.get(le):void 0}}),Be("packages/core/src/columns/datatypes.js",function(e,D){"use strict";Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"parseNumberText",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"BUILTIN_TYPES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return T}});const re=D("packages/core/src/internal/compare.js"),M=re.collator,G=re.defaultCompare,F=D("packages/core/src/internal/predicates.js"),x=F.isNil,q=F.isObject,W=F.isFunction,K=D("packages/core/src/internal/warn.js").fail,S=D("packages/core/src/internal/text.js").titleCase,k=D("packages/core/src/format/date.js"),y=k.toDate,l=k.toIsoDate,g=k.compareIso,t=D("packages/core/src/format/boolean.js").toTriState,c=D("packages/core/src/columns/types/index.js").EXTENDED_TYPES,f=D("packages/core/src/formula/index.js"),n=f.evaluateFormula,m=f.looksLikeFormula,s=D("packages/core/src/compute/filter.js").declareOperators,d=/^\d{4}-\d{2}-\d{2}$/;function p(C){return C.getHours()===0&&C.getMinutes()===0&&C.getSeconds()===0&&C.getMilliseconds()===0}const u=new Map;function b(C){const B=C||"",z=u.get(B);if(z)return z;const X={group:",",decimal:"."};try{for(const Q of new Intl.NumberFormat(C||void 0).formatToParts(12345.6))Q.type==="group"?X.group=Q.value:Q.type==="decimal"&&(X.decimal=Q.value)}catch{}return u.set(B,X),X}const a=/\d\s*[*/^]\s*[\d.(]/;function h(C,B){if(x(C))return null;let z=String(C).trim();if(z===""||z.startsWith("=")||a.test(z))return null;let X=1;z.startsWith("(")&&z.endsWith(")")&&(X=-1,z=z.slice(1,-1));const Q=z.endsWith("%"),{group:H,decimal:L}=b(B);if(z=z.replace(/[\s\u00a0\u202f\u2009']/g,""),H&&H!=="."&&H!==","&&(z=z.split(H).join("")),z=z.replace(/[^0-9eE+\-.,]/g,""),L===","?z=z.split(".").join("").replace(",","."):z=z.split(",").join(""),z===""||z==="-"||z==="+")return null;const Z=Number(z);return Number.isNaN(Z)?null:X*(Q?Z/100:Z)}function w(C,B){const z=x(C)||Number.isNaN(C)?null:Number(C),X=x(B)||Number.isNaN(B)?null:Number(B);return z===null?X===null?0:1:X===null||z<X?-1:z>X?1:0}function v(C,B){const z=t(C),X=t(B);return z===null?X===null?0:1:X===null?-1:z===X?0:z?1:-1}function A(C,B){const z=y(C),X=y(B);if(!z)return X?1:0;if(!X)return-1;const Q=z.getTime(),H=X.getTime();return Q<H?-1:Q>H?1:0}const _=new Map;function V(C){const B=y(C.value);if(!B)return"";const z=C.locale||"";let X=_.get(z);return X||(X=new Intl.DateTimeFormat(C.locale||void 0,{dateStyle:"medium"}),_.set(z,X)),X.format(B)}const Y={boolean:{base:"boolean",storage:"bitset",matches:C=>typeof C=="boolean",parse:C=>t(C.text),compare:v,format:C=>t(C.value)===null?"":t(C.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:C=>t(C)===null?"":String(t(C)),fromClipboard:C=>t(C)},number:{base:"number",storage:"float64",matches:C=>typeof C=="number"&&!Number.isNaN(C),parse:C=>{if(m(C.text)){const B=n(C.text,C);if(!B.ok)return null;const z=Number(B.value);return Number.isFinite(z)?z:null}return h(C.text,C.locale)},compare:w,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:C=>x(C)?"":String(C),fromClipboard:(C,B)=>h(C,B&&B.locale)},date:{base:"dateString",storage:"dictionary",matches:C=>typeof C=="string"&&d.test(C)&&!Number.isNaN(Date.parse(C))||C instanceof Date&&!Number.isNaN(C.getTime())&&p(C),parse:C=>l(C.text),compare:g,format:V,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:C=>l(C),toClipboard:C=>x(C)?"":String(C),fromClipboard:C=>l(C)},dateString:{base:"dateString",storage:"dictionary",matches:C=>typeof C=="string"&&d.test(C)&&!Number.isNaN(Date.parse(C)),parse:C=>l(C.text),compare:g,format:V,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:C=>l(C),toClipboard:C=>x(C)?"":String(C),fromClipboard:C=>l(C)},text:{base:"text",storage:"dictionary",matches:C=>typeof C=="string",parse:C=>C.text===""?null:String(C.text),compare:(C,B)=>x(C)?x(B)?0:1:x(B)?-1:M().compare(String(C),String(B)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:C=>x(C)?"":String(C),fromClipboard:C=>C},image:{base:"text",storage:"dictionary",parse:C=>C.text===""||C.text==null?null:String(C.text).trim(),compare:(C,B)=>x(C)?x(B)?0:1:x(B)?-1:M().compare(String(C),String(B)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:C=>x(C)?"":String(C),fromClipboard:C=>C},lookup:{base:"text",storage:"dictionary",parse:C=>{if(C.text===""||C.text==null)return null;const B=C.column&&C.column.lookup,z=B&&W(B.options)?B.options():null;if(!z)return C.text;const X=String(C.text),Q=z.find(Z=>String(Z.id)===X);if(Q)return Q.id;const H=X.trim().toLowerCase(),L=z.find(Z=>String(Z.label).toLowerCase()===H);return L?L.id:C.text},compare:G,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:C=>x(C)?"":String(C),fromClipboard:C=>C},object:{base:"object",storage:"object",matches:C=>C!==null&&typeof C=="object"&&!(C instanceof Date),parse:C=>{try{return C.text===""?null:JSON.parse(C.text)}catch{return C.text}},compare:(C,B)=>G(C,B),format:C=>{const B=C.value;if(x(B))return"";if(typeof B=="string")return B;try{return JSON.stringify(B)}catch{return String(B)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:C=>x(C)?"":typeof C=="string"?C:JSON.stringify(C),fromClipboard:C=>C}},$=["boolean","number","date","dateString","datetime","text","object"];function j(C,B,z,X){const Q=z.get(C);if(Q)return Q;X.includes(C)&&K(`circular data type extends chain: ${[...X,C].join(" → ")}`);const H=B[C];H||K(`unknown data type "${C}"`);let L=null;H.extends&&(L=j(H.extends,B,z,[...X,C]));const Z={...L||{},...H,name:C,defaults:{...L&&L.defaults||{},...H.defaults||{}}};return Z.base||(Z.base=L&&L.base||"text"),Z.storage||(Z.storage=L&&L.storage||"object"),z.set(C,Z),Z}function E(C,B){const z={...Y,...c};if(B&&typeof B.dataType=="function"&&typeof B.names=="function")for(const Q of B.names("dataType")){const H=B.dataType(Q);H&&(z[Q]=H)}if(q(C))for(const[Q,H]of Object.entries(C))z[Q]=H;const X=new Map;for(const Q of $)j(Q,z,X,[]);j("lookup",z,X,[]);for(const Q of Object.keys(z))j(Q,z,X,[]);for(const Q of X.values())s(Q.operators);return X}function O(C,B){if(C.base==="text"&&(!C.compare||C.compare===Y.text.compare)){const z=M(B);return(X,Q)=>x(X)?x(Q)?0:1:x(Q)?-1:z.compare(String(X),String(Q))}return C.compare||G}function N(C,B){return B?C.multiStorage||"multi":C.storage||"object"}function T(C){return S(String(C).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),Be("packages/core/src/columns/infer.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_SAMPLE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"inferFromValues",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return W}});const M=D("packages/core/src/internal/warn.js").infoOnce,F=D("packages/core/src/internal/predicates.js").isNil,x=100;function q(I,K,R={}){const S=R.sampleSize??x,k=[];for(let y=0;y<I.length&&k.length<S;y++){const l=I[y];F(l)||typeof l=="number"&&Number.isNaN(l)||k.push(l)}if(k.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[y,l]of K){if(typeof l.matches!="function")continue;let g=!0;for(let i=0;i<k.length;i++)if(!l.matches(k[i])){g=!1;break}if(g)return{type:y,unanimous:!0,sampled:k.length}}return R.quiet||M(`infer:${R.colId||"?"}`,`column "${R.colId||"?"}" has mixed or ambiguous values and was inferred as "text". Declare \`type\` on the column to get correct sorting, filtering and export.`),{type:"text",unanimous:!1,sampled:k.length}}function W(I,K,R,S,k={}){const y=k.sampleSize??x,l=[];for(let g=0;g<K.length&&l.length<y;g++){const i=R(K[g]);F(i)||typeof i=="number"&&Number.isNaN(i)||l.push(i)}return q(l,S,{...k,colId:I}).type}}),Be("packages/core/src/columns/graph.js",function(e,D){"use strict";Object.defineProperty(e,"WHOLE_ROW",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"declarationOf",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return S}});const re=D("packages/core/src/internal/warn.js"),M=re.DEV,G=re.fail,F=re.warnOnce,q=D("packages/core/src/internal/predicates.js").isFunction,W="*";function I(k){const y=k.value||{};if(!q(y.compute))return{computed:!1,wholeRow:!1,deps:[],pure:!0};const g=y.pure!==!1;return y.deps===W?{computed:!0,wholeRow:!0,deps:[],pure:g}:Array.isArray(y.deps)?{computed:!0,wholeRow:!1,deps:y.deps.slice(),pure:g}:(F(`deps:missing:${k.id}`,`computed column "${k.id}" declares no \`value.deps\`; treating it as \`deps: '*'\` (a whole-row dependency). Declare the dependencies to get precise invalidation.`),{computed:!0,wholeRow:!0,deps:[],pure:g})}function K(k){const y=new Map;for(const d of k)y.set(d.id,d);const l=new Map,g=new Map,i=new Set,t=new Set,o=new Set,c=new Set;for(const d of k){const p=I(d);if(!p.computed){l.set(d.id,[]);continue}t.add(d.id),(p.pure?o:c).add(d.id),p.wholeRow&&i.add(d.id);const u=[],b=[];for(const a of p.deps)(y.has(a)?u:b).push(a);l.set(d.id,u),b.length&&g.set(d.id,b)}for(const d of o)for(const p of l.get(d))c.has(p)&&G(`pure computed column "${d}" depends on impure column "${p}". Mark it \`value.pure: false\` or make the dependency pure.`);const f=[],n=new Map,m=[],r=d=>{const p=n.get(d);if(p!=="done"){if(p==="open"){const u=m.indexOf(d);G(`circular column dependency: ${[...m.slice(u),d].join(" → ")}`)}n.set(d,"open"),m.push(d);for(const u of l.get(d)||[])y.has(u)&&r(u);m.pop(),n.set(d,"done"),f.push(d)}};for(const d of k)r(d.id);const s=new Map;for(const d of k)s.set(d.id,[]);for(const d of k)for(const p of l.get(d.id)||[]){const u=s.get(p);u&&!u.includes(d.id)&&u.push(d.id)}if(i.size)for(const d of k){if(t.has(d.id))continue;const p=s.get(d.id);for(const u of i)p.includes(u)||p.push(u)}return{order:f,dependents:s,pure:o,impure:c,computed:t,deps:l,wholeRow:i,external:g,index:y}}function R(k,y){const l=Array.isArray(y)?y:[y],g=new Set,i=[...l];for(;i.length;){const t=i.shift();for(const o of k.dependents.get(t)||[])g.has(o)||(g.add(o),i.push(o))}for(const t of l)g.delete(t);return k.order.filter(t=>g.has(t))}function S(k,y,l){if(!M)return k;const g=y instanceof Set?y:new Set(y);return new Proxy(k,{get(i,t){return typeof t=="string"&&!g.has(t)&&!Object.hasOwn(i,t)&&F(`undeclared:${l}:${t}`,`computed column "${l}" read undeclared dependency "${t}". Add it to \`value.deps\` or the value will go stale.`),i[t]}})}}),Be("packages/core/src/model/rowkey.js",function(e,D){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"compositeKey",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"createRowKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"warnMissingKeys",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"groupPathKey",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"splitPathKey",{enumerable:!0,get:function(){return t}});const M=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/internal/paths.js").pathGetter,x=D("packages/core/src/internal/predicates.js"),q=x.isFunction,W=x.isBlank,I=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],K="";function R(o){if(o===null)return"\0n";if(o===void 0)return"\0u";const c=typeof o;if(c==="string")return o;if(c==="number"||c==="bigint"||c==="boolean")return String(o);if(o instanceof Date)return`\0d${o.getTime()}`;try{return`\0o${JSON.stringify(o)}`}catch{return"\0o?"}}function S(o){if(o.length===1)return R(o[0]);let c="";for(let f=0;f<o.length;f++)f&&(c+=K),c+=R(o[f]);return c}function k(o,c={}){const f=c.warn!==!1;if(q(o)){const n=o;return{stable:!0,fields:[],disabled:[],key(m,r){try{const s=n(m);return Array.isArray(s)?S(s):R(s)}catch(s){return M("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",s),`#${r??-1}`}},keyEmpty(m){try{const r=n(m);return Array.isArray(r)?r.length===0||r.some(W):W(r)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(o)&&o.length>0){const n=o.filter(s=>typeof s=="string"),m=n.map(s=>F(s)),r=m.length;return{stable:!0,fields:n,disabled:[],key(s){const d=new Array(r);for(let p=0;p<r;p++)d[p]=m[p](s);return S(d)},keyEmpty(s){for(let d=0;d<r;d++)if(W(m[d](s)))return!0;return!1},missingFields(s){const d=[];for(let p=0;p<r;p++)W(m[p](s))&&d.push(n[p]);return d}}}if(typeof o=="string"&&o.length>0){const n=F(o);return{stable:!0,fields:[o],disabled:[],key(m){return R(n(m))},keyEmpty(m){return W(n(m))},missingFields(m){return W(n(m))?[o]:[]}}}return f&&M("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${I.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:I.slice(),key(n,m){if(n===null||typeof n!="object")return`#${m??0}:${String(n)}`;let r=y.get(n);return r===void 0&&(r=`#${l++}`,y.set(n,r)),r}}}const y=new WeakMap;let l=0;function g(o,c){if(!o||o.stable===!1||!q(o.keyEmpty)||!Array.isArray(c)||c.length===0)return;let f=0,n=null,m;for(let p=0;p<c.length;p++){const u=c[p];o.keyEmpty(u)&&(f++,n===null&&(n=q(o.missingFields)?o.missingFields(u):[],m=u))}if(f===0)return;const r=o.fields.length?o.fields.join(","):"(function)",s=n&&n.length?n.join(", "):o.fields.length?o.fields.join(", "):"the rowKey function",d=m!==null&&typeof m=="object"?Object.keys(m).join(", ")||"(no fields)":String(m);M(`rowKey.emptyValue:${r}`,`rowKey ${s} is missing on ${f} of ${c.length} rows; the first such row has: ${d}. Rows without a key value collapse onto one key, so selection, edits and rows.apply updates land on whichever row now shares it. Set rowKey to a field present on every row, or fix the source data.`)}function i(o){return S(o)}function t(o){return o.split(K)}}),Be("packages/core/src/columns/lookup.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_SEPARATOR",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"normaliseOption",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"Lookup",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"toValueArray",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createLookup",{enumerable:!0,get:function(){return o}});const re=D("packages/core/src/internal/compare.js"),M=re.collator,G=re.defaultCompare,F=D("packages/core/src/internal/predicates.js"),x=F.isFunction,q=F.isNil,I=D("packages/core/src/internal/warn.js").warnOnce,R=D("packages/core/src/model/rowkey.js").compositeKey,S=", ",k="";function y(c,f,n,m){if(c===null||typeof c!="object")return{id:c,label:c==null?"":String(c)};const r=c[f],s=c[n],d={id:r,label:s==null?String(r??""):String(s)};c.disabled&&(d.disabled=!0),c.variant&&(d.variant=c.variant),c.icon&&(d.icon=c.icon);const p=m?c[m]:c.group;return p!==void 0&&(d.group=p),d}function l(c,f,n=0,m=[],r=[]){for(const s of c||[]){const d=s&&typeof s=="object"?s[f]:null;if(r.push({raw:s,depth:n,path:m}),Array.isArray(d)&&d.length){const p=String(s&&typeof s=="object"?s.label??s.name??s.id??"":s);l(d,f,n+1,[...m,p],r)}}return r}function g(c){return!!c&&typeof c=="object"&&!Array.isArray(c)&&x(c.router&&c.router.subscribe)}class i{#e;#t;#n;#r;#i=[];#s=new Map;#o=new Map;#l=0;#a="idle";#c=null;#u;#f=null;#d=new Map;constructor(f,n={}){this.#e=f||{},this.#t=n.colId||"?",this.#n=n.locale,this.#r=n.onChange||null,this.#u=M(this.#n),Array.isArray(this.#e.options)?this.#h(this.#e.options):this.#e.options===void 0&&(this.#a="ready")}get colId(){return this.#t}get version(){return this.#l}get state(){return this.#a}get ready(){return this.#a==="ready"}get multiple(){return this.#e.multiple===!0}get separator(){return this.#e.separator??S}get allowCustom(){return this.#e.allowCustom===!0}get sortBy(){return this.#e.sortBy||"label"}get spec(){return this.#e}options(){return this.#i}setLocale(f){this.#n=f,this.#u=M(f)}#h(f){const n=this.#e,m=n.valueKey||"id",r=n.labelKey||"label",s=n.childrenKey||"children";this.#i=l(f,s).map(d=>{const p=y(d.raw,m,r,n.groupKey);return d.depth&&(p.depth=d.depth,p.path=d.path),p}),this.#s=new Map,this.#o=new Map,this.#i.forEach((d,p)=>{this.#s.set(d.id,d),this.#o.set(d.id,p)}),this.#a="ready",this.#l+=1}load(){if(this.#c)return this.#c;const f=this.#e.options;if(Array.isArray(f)||f===void 0)return this.#c=Promise.resolve(this.#i),this.#c;if(g(f))return this.#c=this.#p(f),this.#c;if(!x(f))return I(`lookup:options:${this.#t}`,`column "${this.#t}" has an invalid \`lookup.options\`; expected an array, a function, or a router route`),this.#a="ready",this.#c=Promise.resolve([]),this.#c;this.#a="loading";let n;try{n=f()}catch(m){return this.#a="error",I(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,m),this.#c=Promise.resolve([]),this.#c}return!n||!x(n.then)?(this.#h(n),this.#c=Promise.resolve(this.#i),this.#r&&this.#r(this),this.#c):(this.#c=n.then(m=>(this.#h(m),this.#r&&this.#r(this),this.#i),m=>(this.#a="error",I(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,m),[])),this.#c)}refresh(){return this.#c=null,Array.isArray(this.#e.options)?(this.#h(this.#e.options),this.#r&&this.#r(this),Promise.resolve(this.#i)):this.load()}#p(f){if(this.#f)return Promise.resolve(this.#i);const n=this.#e,m=n.valueKey||"id",r=n.labelKey||"label",s=n.groupKey,d=x(f.map)?f.map:null,p=b=>y(d?d(b):b,m,r,s).id,u=b=>this.#m(b,d,m,r,s);return f.router.subscribe(f.predicate,u,{rowKey:p}),this.#f=()=>{x(f.router.detach)&&f.router.detach(u)},this.#a="ready",Promise.resolve(this.#i)}#m(f,n,m,r,s){const d=f&&f.add||[],p=f&&f.update||[],u=f&&f.remove||[];if(!(!d.length&&!p.length&&!u.length)){for(const b of d)this.#g(b,n,m,r,s);for(const b of p)this.#g(b,n,m,r,s);for(const b of u){if(!this.#d.has(b))continue;const a=this.#d.get(b);this.#d.delete(b),this.#s.delete(a);const h=this.#i.findIndex(w=>w.id===a);h>=0&&this.#i.splice(h,1)}this.#o=new Map(this.#i.map((b,a)=>[b.id,a])),this.#a="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(f,n,m,r,s){const d=y(n?n(f):f,m,r,s);this.#d.set(R([d.id]),d.id);const p=this.#i.findIndex(u=>u.id===d.id);p>=0?this.#i[p]=d:this.#i.push(d),this.#s.set(d.id,d)}destroy(){this.#f&&(this.#f(),this.#f=null)}search(f,n){const m=this.#e;if(!x(m.search)){const d=String(f||"").toLowerCase();return Promise.resolve(d===""?this.#i:this.#i.filter(p=>p.label.toLowerCase().includes(d)))}const r=m.valueKey||"id",s=m.labelKey||"label";return Promise.resolve(m.search(f,n)).then(d=>(d||[]).map(p=>y(p,r,s,m.groupKey)))}option(f){return this.#s.get(f)}has(f){return this.#s.has(f)}label(f){if(q(f)||f==="")return"";const n=this.#s.get(f);if(n)return n.label;if(this.#a==="loading"||this.#a==="idle")return"";this.allowCustom||I(`lookup:unknown:${this.#t}`,`column "${this.#t}" holds value ${JSON.stringify(f)} which is not in its lookup options. Showing the raw value; set \`lookup.unknownLabel\` or \`lookup.allowCustom\` to change that.`);const m=this.#e.unknownLabel;return x(m)?String(m(f)??""):typeof m=="string"?m:String(f)}text(f){if(this.multiple){const n=t(f);return n.length===0?"":n.map(m=>this.label(m)).join(this.separator)}return this.label(f)}dictionary(){return this.#i.map(f=>f.id)}sorted(){const f=this.sortBy;if(f==="optionOrder"||f==="count")return this.#i.slice();if(f==="value")return this.#i.slice().sort((m,r)=>G(m.id,r.id));const n=this.#u;return this.#i.slice().sort((m,r)=>n.compare(m.label,r.label))}comparator(){const f=this.sortBy,n=this.multiple,m=this.#u,r=this.#o;if(n&&f==="count")return(d,p)=>t(d).length-t(p).length;const s=n?d=>t(d)[0]:d=>d;return f==="value"?(d,p)=>G(s(d),s(p)):f==="optionOrder"?(d,p)=>{const u=r.has(s(d))?r.get(s(d)):Number.MAX_SAFE_INTEGER,b=r.has(s(p))?r.get(s(p)):Number.MAX_SAFE_INTEGER;return u-b}:(d,p)=>{const u=s(d),b=s(p);return q(u)?q(b)?0:1:q(b)?-1:m.compare(this.label(u),this.label(b))}}groupKey(f){return this.multiple?t(f).map(m=>String(m)).sort().join(k):q(f)?"":String(f)}countValues(f){return this.multiple?t(f).length:q(f)?0:1}contains(f,n,m){const r=this.multiple?t(f):q(f)?[]:[f],s=Array.isArray(n)?n:[n];switch(m){case"containsAll":return s.every(d=>r.includes(d));case"containsNone":return!s.some(d=>r.includes(d));default:return s.some(d=>r.includes(d))}}exportText(f,n="label"){return n==="value"?this.multiple?t(f).join(this.separator):q(f)?"":String(f):this.text(f)}exportColumns(){const f=this.multiple;return this.#i.map(n=>({id:n.id,label:n.label,has:m=>f?t(m).includes(n.id):m===n.id}))}}function t(c){return Array.isArray(c)?c:q(c)||c===""?[]:[c]}function o(c,f={}){const n=c.lookup;if(!n)return null;const m=new i(n,{colId:c.id,locale:f.locale,onChange:f.onChange});return!Array.isArray(n.options)&&n.options!==void 0&&m.load(),m}}),Be("packages/core/src/columns/value.js",function(e,D){"use strict";Object.defineProperty(e,"compileDisplay",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"warnImpureUse",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"ValuePipeline",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return i}});const M=D("packages/core/src/internal/paths.js").getPath,G=D("packages/core/src/internal/predicates.js"),F=G.isFunction,x=G.isNil,W=D("packages/core/src/internal/lru.js").Lru,K=D("packages/core/src/internal/warn.js").warnOnce,S=D("packages/core/src/columns/graph.js").depsProxy,k="\0";function y(f,n={}){const m=n.locale,r=n.grid??null,s=n.context,d=f.value&&f.value.format,p=f.formatter||null,u=f.dataType&&f.dataType.format,b=f.lookup||null,a=(h,w,v)=>({value:h,data:v,row:w,column:f,colId:f.id,grid:r,context:s,locale:m});if(F(d))return(h,w,v)=>{const A=d(a(h,w,v));return A==null?"":String(A)};if(p){if(b){const h=p.kind==="text";return(w,v,A)=>p(h?b.text(w):w,a(w,v,A))}return(h,w,v)=>p(h,a(h,w,v))}return F(u)?(h,w,v)=>{const A=u(a(h,w,v));return A==null?"":String(A)}:b?h=>b.text(h):h=>x(h)?"":typeof h=="string"?h:String(h)}function l(f,n){!f||!f.value||f.value.pure!==!1||K(`impure:${n}:${f.id}`,`column "${f.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${n}. The result is not stable across passes.`)}class g{#e;#t;#n;#r;#i;#s;#o=new W(4096);constructor(n){this.#e=n.columns instanceof Map?n.columns:new Map((n.columns||[]).map(m=>[m.id,m])),this.#t=n.graph,this.#n=n.grid??null,this.#r=n.context,this.#s=n.stored||null,this.#i=n.rowKey||i}get graph(){return this.#t}setGraph(n){this.#t=n,this.#o.clear()}beginPass(){this.#o.clear()}endPass(){this.#o.clear()}invalidate(n){if(this.#o.size===0)return;const m=n&&n.rows?new Set([...n.rows].map(String)):null,r=n&&n.columns?[...n.columns]:null;if(!m&&!r){this.#o.clear();return}const s=r?this.#l(r):null;for(const d of[...this.#o.keys()]){const p=String(d).split(k);p.length===3&&(m&&!m.has(p[0])||s&&!s.has(p[2])||this.#o.delete(d))}}#l(n){const m=new Set,r=this.#t,s=[...n];for(;s.length;){const d=s.pop();if(!m.has(d)){m.add(d);for(const p of r?r.dependents.get(d)||[]:[])s.push(p)}}return m}value(n,m,r){const s=typeof n=="string"?this.#e.get(n):n;if(!s)return;if(!s.computed)return this.#c(s,m,r);if(s.value.pure!==!1&&this.#s&&r&&r.physical!=null&&this.#s.has(s.id))return this.#s.get(s.id,r.physical);if(s.volatile)return this.compute(s,m,r);if(s.value.pure===!1)return this.compute(s,m,r);const d=`${this.#a(m,r)}${k}${s.id}`;if(this.#o.has(d))return this.#o.get(d);const p=this.compute(s,m,r);return this.#o.set(d,p),p}#a(n,m){return`${this.#i(n,m)}${k}${t(n)}`}#c(n,m,r){if(this.#s&&r&&r.physical!=null&&this.#s.has(n.id))return this.#s.get(n.id,r.physical);if(n.field)return n.read?n.read(m):M(m,n.field)}compute(n,m,r){const s=this.#t,d=s&&s.wholeRow.has(n.id);let p;if(d)p=m??{};else{p={};const b=s&&s.deps.get(n.id)||[];for(const h of b)p[h]=this.value(h,m,r);const a=s&&s.external.get(n.id)||[];for(const h of a)p[h]=M(m,h);p=S(p,[...b,...a],n.id)}const u={data:m,row:r,column:n,grid:this.#n,context:this.#r};return n.value.compute(p,u)}values(n,m){const r={},s=this.#t?this.#t.order:[...this.#e.keys()];for(const d of s)r[d]=this.value(d,n,m);return r}text(n,m,r){const s=typeof n=="string"?this.#e.get(n):n;return s?s.formatValue(this.value(s,m,r),r,m):""}key(n,m,r){const s=typeof n=="string"?this.#e.get(n):n;if(!s)return"";const d=this.value(s,m,r);return F(s.value.key)?String(s.value.key(this.#u(s,d,m,r))):s.lookup?s.lookup.groupKey(d):x(d)?"":String(d)}quickFilterText(n,m,r){const s=typeof n=="string"?this.#e.get(n):n;if(!s)return"";if(F(s.value.quickFilterText)){const d=this.value(s,m,r);return String(s.value.quickFilterText(this.#u(s,d,m,r))??"")}return this.text(s,m,r)}#u(n,m,r,s){return{value:m,data:r,row:s,column:n,colId:n.id,grid:this.#n,context:this.#r}}parse(n,m,r,s){const d=typeof n=="string"?this.#e.get(n):n;if(!d)return m;const p={text:m,value:this.value(d,r,s),data:r,row:s,column:d,grid:this.#n,context:this.#r,locale:this.#n&&F(this.#n.get)?this.#n.get("locale"):void 0,formulaFunctions:this.#n&&F(this.#n.get)?this.#n.get("formulaFunctions"):void 0};return F(d.value.parse)?d.value.parse(p):d.dataType&&F(d.dataType.parse)?d.dataType.parse(p):m}validate(n,m,r,s,d){const p=typeof n=="string"?this.#e.get(n):n;if(!p||!F(p.edit.validate))return!0;const u=p.edit.validate({value:m,oldValue:r,data:s,row:d,column:p,grid:this.#n,context:this.#r});return u===!0||u===void 0?!0:String(u)}apply(n,m,r,s){const d=typeof n=="string"?this.#e.get(n):n;if(!d)return!1;const p=this.value(d,r,s);if(F(d.value.apply)){const u=d.value.apply({value:m,oldValue:p,data:r,row:s,column:d,grid:this.#n,context:this.#r});return this.#f(d,r,s),u!==!1}return d.field?p===m?!1:(d.write(r,m),this.#f(d,r,s),!0):(K(`apply:${d.id}`,`column "${d.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(n,m,r,s){const d=typeof n=="string"?this.#e.get(n):n;if(!d)return{ok:!1,value:void 0,oldValue:void 0,changed:!1,error:"unknown column"};const p=this.value(d,r,s),u=this.parse(d,m,r,s),b=this.validate(d,u,p,r,s);if(b!==!0)return{ok:!1,value:u,oldValue:p,changed:!1,error:b};const a=this.apply(d,u,r,s);return{ok:!0,value:u,oldValue:p,changed:a}}#f(n,m,r){if(this.#o.size===0)return;const s=this.#a(m,r);this.#o.delete(`${s}${k}${n.id}`);for(const d of this.#t?this.#t.dependents.get(n.id)||[]:[])this.#o.delete(`${s}${k}${d}`)}}function i(f,n){return n&&n.key!=null?String(n.key):t(f)}function t(f){if(f&&typeof f=="object"){let n=o.get(f);return n===void 0&&(n=`#${c++}`,o.set(f,n)),n}return String(f)}const o=new WeakMap;let c=0}),Be("packages/core/src/model/shadow.js",function(e,D){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"HISTORY_TICK_MAX_MS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"HISTORY_TICK_MIN_MS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"CLUSTER_SHADOW_KINDS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"DEFAULT_ANOMALY_THRESHOLD",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"SPEC_STATUS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"POSITIONAL_KINDS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"SHADOW_LABELS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"specStatusOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ShadowTracker",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"shadowsIn",{enumerable:!0,get:function(){return s}});const M=D("packages/core/src/internal/warn.js").warnOnce,G=2e5,F=20,x=1e3,q=50;function W(d){return Math.min(x,Math.max(q,Math.floor(d)))}const I=Object.freeze(["updates","updatedAt","sinceUpdate","delta","deltaPercent","rate","history","firstValue","streak","rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag","specStatus","rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta","fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD","cluster","clusterDistance"]),K=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),R=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),S=Object.freeze(["cluster","clusterDistance"]),k=.6745,y=3.5,l=Object.freeze({PASS:"PASS",WARN:"WARN",FAIL:"FAIL"}),g=Object.freeze(["rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag"]),i=Object.freeze({updates:"Updates",updatedAt:"Updated at",sinceUpdate:"Since update",delta:"Change",deltaPercent:"Change %",rate:"Rate of change",history:"History",firstValue:"Baseline",streak:"Streak",rank:"Rank",rankAsc:"Rank, ascending",rankChange:"Rank change",percentile:"Percentile",quartile:"Quartile",zScore:"Z-score",shareOfTotal:"Share of total",anomalyScore:"Anomaly score",anomalyFlag:"Anomaly",specStatus:"Spec status",rollingSum:"Rolling sum",rollingAvg:"Rolling average",rollingMin:"Rolling minimum",rollingMax:"Rolling maximum",windowCoverage:"Window coverage",cumulativeToDate:"Cumulative to date",periodOverPeriod:"Period over period",rollingQuantile:"Rolling quantile",windowApproximate:"Window approximate",tsTrend:"Trend",tsSeasonal:"Seasonal",tsResidual:"Seasonal residual",tsCoverage:"Decomposition coverage",tsSmoothed:"Smoothed",tsSmoothingAlpha:"Smoothing α",tsSmoothingBeta:"Smoothing β",fitPredicted:"Predicted",fitResidual:"Residual",fitInfluence:"Influence",fitStdResidual:"Std. residual",fitLeverage:"Leverage",fitCooksD:"Cook's D",cluster:"Cluster",clusterDistance:"Cluster distance"});function t(d,p){if(!p)return null;const u=Number.isFinite(Number(p.lower))?Number(p.lower):null,b=Number.isFinite(Number(p.upper))?Number(p.upper):null;if(u===null&&b===null||!Number.isFinite(d))return null;if(u!==null&&d<u||b!==null&&d>b)return l.FAIL;const a=Number.isFinite(Number(p.warnLower))?Number(p.warnLower):null,h=Number.isFinite(Number(p.warnUpper))?Number(p.warnUpper):null;return a!==null&&d<a||h!==null&&d>h?l.WARN:l.PASS}function o(d,p,u){if(!p||typeof p!="object")return null;if(p.kind!=="time")return p.kind!==void 0&&M(`shadow.history.window.kind:${d}`,`a 'history' shadow's 'window' only accepts {kind: 'time', span}; '${p.kind}' is not honoured (a plain count is already what 'depth' means, and a session has no span to divide into buckets), so it reported the original, unwindowed history.`),null;const b=p.minutes!=null?Number(p.minutes)*6e4:Number(p.span);if(!(b>0))return M(`shadow.history.window.span:${d}`,"a 'history' shadow's time window needs a positive 'span' (ms) or 'minutes'; it had none, so it reported the original, unwindowed history."),null;const a=Math.max(2,Math.floor(u)||F);return{span:b,bucketMs:Math.max(1,Math.floor(b/a))}}class c{#e;#t=new Map;#n=new Map;#r=new Map;#i=new Map;#s=new Map;#o=new Map;#l=0;#a;#c;#u;#f;#d=new Map;#h=null;#p=null;#m=null;constructor(p){this.#e=p.colId,this.#a=Math.max(2,p.depth||F),this.#c=Math.max(1,p.max||G),this.#u=p.now||(()=>Date.now()),this.#f=o(this.#e,p.historyWindow,this.#a),this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#f}observe(p,u){const b=r(u);if(b===null)return;if(!this.#n.has(p)){this.#p=null,this.#m=null,this.#g(),this.#t.set(p,b),this.#n.set(p,b),this.#r.set(p,0),this.#i.set(p,this.#u()),this.#s.set(p,[b]),this.#f&&this.#d.set(p,[b]),this.#o.set(p,0);return}const a=this.#n.get(p);if(a===b)return;this.#p=null,this.#m=null,this.#n.set(p,b),this.#r.set(p,(this.#r.get(p)||0)+1),this.#i.set(p,this.#u());const h=this.#s.get(p)||[];h.push(b),h.length>this.#a&&h.splice(0,h.length-this.#a),this.#s.set(p,h);const w=Math.sign(b-a),v=this.#o.get(p)||0;this.#o.set(p,Math.sign(v)===w?v+w:w)}#g(){if(this.#n.size<this.#c)return;const p=this.#n.keys().next().value;p!==void 0&&(this.#t.delete(p),this.#n.delete(p),this.#r.delete(p),this.#i.delete(p),this.#s.delete(p),this.#d.delete(p),this.#o.delete(p),this.#l++)}rebase(){for(const[p,u]of this.#n)this.#t.set(p,u);this.#p=null,this.#m=null}reset(){this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#i.clear(),this.#s.clear(),this.#d.clear(),this.#o.clear(),this.#l=0,this.#p=null,this.#m=null,this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}retain(p){const u=p instanceof Set?p:new Set(p);let b=0;for(const a of[...this.#n.keys()])u.has(a)||(this.#t.delete(a),this.#n.delete(a),this.#r.delete(a),this.#i.delete(a),this.#s.delete(a),this.#d.delete(a),this.#o.delete(a),b++);return b&&(this.#p=null,this.#m=null),b}advanceHistoryWindow(p=this.#u()){const u=this.#f;if(!u)return 0;const b=Math.floor(p/u.bucketMs),a=b-this.#h;if(!(a>0))return 0;const h=Math.min(a,this.#a);for(const[w,v]of this.#d){const A=this.#n.get(w);for(let _=0;_<h;_++)v.push(A);v.length>this.#a&&v.splice(0,v.length-this.#a)}return this.#h=b,a}read(p,u,b,a){switch(p){case"updates":return this.#r.has(u)?this.#r.get(u):0;case"updatedAt":{const h=this.#i.get(u);return h===void 0?null:new Date(h)}case"sinceUpdate":{const h=this.#i.get(u);return h===void 0?null:this.#u()-h}case"firstValue":return this.#t.has(u)?this.#t.get(u):null;case"delta":return this.#n.has(u)?this.#n.get(u)-this.#t.get(u):null;case"deltaPercent":{if(!this.#n.has(u))return null;const h=this.#t.get(u);return h?(this.#n.get(u)-h)/Math.abs(h)*100:null}case"rate":{const h=this.#s.get(u),w=this.#i.get(u);if(!h||h.length<2||w===void 0)return null;const v=this.#u()-w,A=h[h.length-1]-h[h.length-2];return v>0?A/v*1e3:A}case"history":return this.#f?this.#d.has(u)?[...this.#d.get(u)]:null:this.#s.has(u)?[...this.#s.get(u)]:null;case"streak":return this.#o.has(u)?this.#o.get(u):0;case"specStatus":return this.#n.has(u)?t(this.#n.get(u),a):null;default:return g.includes(p)?this.#O(p,u,b,a):null}}#b(p){if(p){if(this.#m&&this.#m.only===p)return this.#m.view;const u=this.#y(p);return this.#m={only:p,view:u},u}return this.#p?this.#p:(this.#p=this.#y(null),this.#p)}#y(p){const u=[];for(const[$,j]of this.#n)p&&!p.has($)||u.push(j);const b=u.sort(($,j)=>$-j);let a=0,h=0,w=0,v=0;for(const $ of b){v+=$,a++;const j=$-h;h+=j/a,w+=j*($-h)}const A=[];for(const[$,j]of this.#t)p&&!p.has($)||A.push(j);const _=a?f(b):0,V=b.map($=>Math.abs($-_)).sort(($,j)=>$-j),Y=a?f(V):0;return{sorted:b,baseline:A.sort(($,j)=>$-j),sum:v,mean:a?h:0,sd:a>1?Math.sqrt(w/(a-1)):0,median:_,mad:Y}}#O(p,u,b,a){if(!this.#n.has(u)||b&&!b.has(u))return null;const h=this.#n.get(u),w=this.#b(b),v=w.sorted.length;if(!v)return null;switch(p){case"rank":return v-m(w.sorted,h)+1;case"rankAsc":return n(w.sorted,h)+1;case"rankChange":{if(!this.#t.has(u)||!w.baseline.length)return null;const A=w.baseline.length-m(w.baseline,this.#t.get(u))+1,_=v-m(w.sorted,h)+1;return A-_}case"percentile":return m(w.sorted,h)/v*100;case"quartile":{const A=m(w.sorted,h)/v;return Math.min(4,Math.max(1,Math.ceil(A*4)))}case"zScore":return w.sd?(h-w.mean)/w.sd:null;case"anomalyScore":return w.mad?k*(h-w.median)/w.mad:null;case"anomalyFlag":{if(!w.mad)return null;const A=a&&Number.isFinite(Number(a.threshold))?Number(a.threshold):y;return Math.abs(k*(h-w.median)/w.mad)>A}case"shareOfTotal":return w.sum?h/w.sum*100:null;default:return null}}}function f(d){const p=d.length;if(!p)return 0;const u=(p-1)*.5,b=Math.floor(u),a=Math.ceil(u);return b===a?d[b]:d[b]+(u-b)*(d[a]-d[b])}function n(d,p){let u=0,b=d.length;for(;u<b;){const a=u+b>>1;d[a]<p?u=a+1:b=a}return u}function m(d,p){let u=0,b=d.length;for(;u<b;){const a=u+b>>1;d[a]<=p?u=a+1:b=a}return u}function r(d){if(d==null||d==="")return null;if(d instanceof Date){const u=d.getTime();return Number.isFinite(u)?u:null}const p=typeof d=="number"?d:Number(d);return Number.isFinite(p)?p:null}function s(d){const p=[];for(const u of d||[]){const b=u.shadow;if(!b)continue;const a=typeof b=="string"?{kind:b}:b,h=a.kind;I.includes(h)&&(K.includes(h)||R.includes(h)||S.includes(h)||p.push({colId:u.id||u.field,of:a.of||u.field||u.id,kind:h,depth:a.depth,historyWindow:h==="history"?a.window:void 0}))}return p}}),Be("packages/core/src/columns/model.js",function(e,D){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return Ce}});const re=D("packages/core/src/internal/merge.js"),M=re.expand,G=re.merge,F=re.toArray,x=D("packages/core/src/internal/warn.js"),q=x.fail,W=x.warnOnce,I=D("packages/core/src/internal/paths.js"),K=I.getPath,R=I.pathGetter,S=I.pathSetter,y=D("packages/core/src/internal/text.js").humanise,l=D("packages/core/src/internal/predicates.js"),g=l.isFunction,i=l.isObject,o=D("packages/core/src/internal/uid.js").uid,f=D("packages/core/src/format/index.js").compileFormat,n=D("packages/core/src/columns/datatypes.js"),m=n.comparatorFor,r=n.createTypeRegistry,s=n.storageKind,d=D("packages/core/src/columns/infer.js"),p=d.inferColumnType,u=d.DEFAULT_SAMPLE,b=D("packages/core/src/columns/graph.js"),a=b.buildGraph,h=b.affectedBy,v=D("packages/core/src/columns/lookup.js").createLookup,A=D("packages/core/src/columns/value.js"),_=A.compileDisplay,V=A.ValuePipeline,Y=A.warnImpureUse,$=D("packages/core/src/model/shadow.js"),j=$.FIT_SHADOW_KINDS,E=$.CLUSTER_SHADOW_KINDS,O=Object.freeze({geometry:"geometry",list:"list"}),N={value:{pure:!0},cell:{},edit:{enabled:!1},sort:{enabled:!0,direction:null,order:0,nullsFirst:!1},filter:{enabled:!0,type:"text"},group:{enabled:!1,index:-1,explode:!1},pivot:{enabled:!1,index:-1},total:null,layout:{width:150,min:40,max:null,flex:0,pin:null,hidden:!1,resizable:!0,movable:!0,lockVisible:!1,lockPosition:!1},header:{},facet:{},export:{lookup:"label",csv:!0,excel:!0},allowGroup:!0,allowPivot:!0,allowTotal:!0,nullable:!0,quickFilter:!0},T={centre:"center"},C=new Set(["start","center","end","left","right"]);function B(he){if(typeof he!="string")return;const ie=he.toLowerCase();return T[ie]?T[ie]:C.has(ie)?ie:void 0}function z(he){if(typeof he!="string")return;const ie=he.toLowerCase();return ie==="center"||ie==="centre"?"middle":ie==="top"||ie==="middle"||ie==="bottom"?ie:void 0}const X=["cell","layout","header"];function Q(he){if(!i(he))return{};const ie={...he},ue=(ge,pe)=>{if(he[ge]===void 0)return;const Oe=M(he[ge],pe);Oe&&X.includes(ge)&&!i(he[ge])&&delete Oe.enabled,ie[ge]=Oe};return ue("sort","direction"),ue("filter","type"),ue("cell","render"),ue("edit","editor"),ue("layout","width"),ue("group","index"),ue("pivot","index"),ue("header","render"),ue("facet","strategy"),ie}function H(he,ie){const ue={...he||{}},ge=i(ie)&&i(ie.layout)&&ie.layout.width!==void 0;return ue.fit==="content"&&!ge&&delete ue.width,ue}const L=new Set(["allowGroup","allowPivot","allowTotal","cell","colSpan","contextMenu","diff","edit","export","facet","field","filter","filterRow","format","grandTotal","group","groupTotal","header","headerControls","id","layout","lookup","nullable","pivot","preset","quickFilter","rowSpan","running","shadow","showWhen","sort","spec","tags","title","total","type","typeOptions","validation","value","verticalAlign"]),Z=new Set(["collapsible","columns","facet","header","id","marryChildren","openByDefault","showWhen","title"]);function ee(he,ie,ue,ge){const pe=ue==="columnGroup"?"column group":"column";for(const Oe of Object.keys(he))if(!ie.has(Oe)){if(Oe==="timeZone"&&ue==="column"){W("column.timeZone",`\`timeZone\` is not a column option, so it had no effect on column "${ge}". A date column stores, displays, sorts and filters in the grid-level \`timeZone\` (else the viewer's); set \`timeZone\` on the grid, not the column.`);continue}W(`${ue}.unknown:${Oe}`,`'${Oe}' is not a configuration key this grid recognises, so it had no effect on ${pe} "${ge}". Check the spelling against the reference.`)}}function te(he){i(he.cell)&&he.cell.autoHeight!==void 0&&W("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${he.id||he.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function se(he,ie){const ue=ie&&g(he.defaultsFor)?he.defaultsFor(ie):null,ge={...he.defaults||{},...i(ue)?ue:{}},pe={};return ge.align&&(pe.align=ge.align,pe.cell={align:ge.align},pe.header={align:ge.align}),ge.filter&&(pe.filter=ge.filter==="none"?{enabled:!1,type:"none"}:{enabled:!0,type:ge.filter}),ge.editor&&(pe.edit=ge.editor==="none"?{editor:null}:{editor:ge.editor}),ge.total&&(pe.total=ge.total),ge.render&&(pe.cell={...pe.cell||{},render:ge.render}),he.export&&(pe.export={...he.export}),pe}function ne(he){if(typeof he=="string")return he.trim()?[he.trim()]:[];if(!Array.isArray(he))return[];const ie=[];for(const ue of he){if(typeof ue!="string")continue;const ge=ue.trim();ge&&!ie.includes(ge)&&ie.push(ge)}return ie}class ae{#e=new Map;#t=[];#n=[];#r=new WeakMap;#i;#s;#o;#l;#a;#c;#u(ie,ue,ge){const pe=this.#f(ie,ue,ge);if(typeof pe!="string"||!this.#d)return pe??null;const Oe=ue&&ue.totals&&ue.totals.implement;if(Oe&&g(Oe[pe])){const ye=Oe[pe];return ye.totalName=pe,ye}const ve=this.#d.totalFn?.(pe);return g(ve)?ve:pe}#f(ie,ue,ge){if(typeof ie!="string")return ie;const pe=ue&&ue.totals&&ue.totals.supported;if(!Array.isArray(pe)||pe.includes(ie))return ie;const Oe=pe.length?pe.join(", "):"none";return q(`column "${ge}" is typed ${ue.name||"a type"}, for which the total "${ie}" is not meaningful. Supported: ${Oe}. Aggregating it anyway would produce a confident wrong number.`),ie}#d;#h;#p;#m;#g;#b;#y=!1;#O;#w;constructor(ie={}){this.#s=Q(ie.columnDefaults||{}),this.#o=ie.columnPresets||{},this.#a=ie.locale,this.#l=ie.timeZone,this.#c=z(ie.verticalAlign),this.#d=ie.registry||null,this.#h=ie.grid||null,this.#p=ie.context,this.#O=ie.sampleSize??u,this.#w=ie.onChange||null,this.#b=g(ie.rowKey)?ie.rowKey:void 0,this.#i=r(ie.dataTypes,this.#d);const{leaves:ue,groups:ge}=Ce(ie.columns||[]);this.#n=ge;for(const pe of ue){pe.facet!==void 0&&this.#r.set(pe.def,pe.facet);const Oe=this.#A(pe.def,null);if(Oe.groupPath=pe.path,this.#e.has(Oe.id)){W(`columns.duplicate:${Oe.id}`,`two columns resolve to the id '${Oe.id}', so the second is ignored. An id defaults to the column's field, so declare an explicit \`id\` when two columns read the same field.`);continue}pe.column=Oe,this.#e.set(Oe.id,Oe),this.#t.push(Oe.id)}this.#P(ie.stored||null)}#A(ie,ue){ee(ie,L,"column",ie.id||ie.field||"(unnamed)"),te(ie);const ge=Q(ie),pe=F(ie.preset),Oe=pe.map(He=>{const Ye=this.#o[He];return Ye?Q(Ye):(W(`preset:${He}`,`unknown column preset "${He}"; ignoring`),{})}),ve=this.#S(ge,Oe,ue),ye=this.#i.get(ve)||this.#i.get("text");if(!this.#i.has(ve)&&ie.type){const He=O[ve];W(`type:${ve}`,`unknown data type "${ve}"; falling back to "text"`+(He?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${He}'.`:""))}const Ae=g(ye.items)?this.#C(ge,Oe,ie.id||ie.field||"(unnamed)"):null;let Me=N;Me=G(Me,this.#s),ie.type!==!1&&(Me=G(Me,se(ye,Ae)));for(const He of Oe)Me=G(Me,He);this.#r.has(ie)&&(Me=G(Me,Q({facet:this.#r.get(ie)}))),Me=G(Me,ge);const je=Me.edit;je&&je.editor&&je.enabled!==!0&&!g(je.enabled)&&(ie.edit||{}).editor&&W(`column.editor-not-enabled:${ie.id||ie.field}`,`column '${ie.id||ie.field}' names the editor '${je.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const _e=ie.id||ie.field||o("col");if(ie.shadow&&!g(Me.value&&Me.value.compute)){const He=typeof ie.shadow=="string"?{kind:ie.shadow}:ie.shadow,Ye=He.of||ie.field||_e,Qe=j.includes(He.kind),lt=E.includes(He.kind),ot=Qe?He.model||He:null,yt=Qe&&ot?[...Array.isArray(ot.predictors)?ot.predictors:[],ot.response].filter(Boolean):null,Ct=lt?(Array.isArray(He.columns)?He.columns:[]).filter(Boolean):null;Me.value={...Me.value||{},deps:Ct&&Ct.length?Ct:yt&&yt.length?yt:He.orderBy&&He.orderBy!==Ye?[Ye,He.orderBy]:[Ye],pure:!1,compute:(Nt,dt)=>{const at=dt.grid&&dt.grid.statistics;if(!at)return null;const bt=dt.row&&dt.row.key||at.keyOf(dt.data);if(!bt)return null;if(Qe){if(!g(at.fitShadow))return null;const Tt=He.model?{...He.model,threshold:He.threshold}:He;return at.fitShadow(He.kind,bt,Tt)}return lt?g(at.clusterShadow)?at.clusterShadow(He.kind,bt,He):null:at.shadow(Ye,He.kind,bt,He.scope,He)}}}if(ie.running&&!g(Me.value&&Me.value.compute)){const He=typeof ie.running=="string"?{kind:ie.running}:ie.running,Ye=He.of||ie.field||_e;Me.value={...Me.value||{},deps:[Ye],pure:!1,compute:(Qe,lt)=>{const ot=lt.grid&<.grid.statistics;if(!ot||!g(ot.running))return null;const yt=lt.row&<.row.key||ot.keyOf(lt.data);return yt?ot.running(Ye,He.kind||"total",yt):null}},ie.sort===void 0&&(Me.sort={...Me.sort||{},enabled:!1})}const Pe=ie.field??(g(Me.value&&Me.value.compute)?null:ie.id??null),Se=g(Me.value&&Me.value.compute),Fe={id:_e,field:Pe,shadow:ie.shadow||null,running:ie.running||null,spec:ie.spec||null,validation:ie.validation||null,volatile:!!(ie.shadow||ie.running),title:Me.title??y(Pe||_e),type:ye.name,dataType:ye,itemType:Ae,nullable:Me.nullable!==!1,align:B(ge.cell&&ge.cell.align||ge.align||Me.cell&&Me.cell.align||Me.align||ye.defaults&&ye.defaults.align)||"start",verticalAlign:z(ge.cell&&ge.cell.verticalAlign||ge.verticalAlign||Me.cell&&Me.cell.verticalAlign||Me.verticalAlign)||this.#c,rowSpan:g(Me.rowSpan)?Me.rowSpan:null,colSpan:g(Me.colSpan)?Me.colSpan:null,value:{pure:!0,...Me.value||{}},cell:{...Me.cell||{}},edit:{...Me.edit||{}},sort:{...Me.sort||{}},filter:{...Me.filter||{}},group:{enabled:!1,index:-1,explode:!1,...Me.group||{}},pivot:{enabled:!1,index:-1,...Me.pivot||{}},total:this.#u(Me.total,ye,ie.id||ie.field||"(unnamed)"),groupTotal:Me.groupTotal===void 0?null:this.#u(Me.groupTotal,ye,ie.id||ie.field||"(unnamed)"),grandTotal:Me.grandTotal===void 0?null:this.#u(Me.grandTotal,ye,ie.id||ie.field||"(unnamed)"),tags:ne(Me.tags),typeOptions:Me.typeOptions??null,...i(Me[ve])?{[ve]:Me[ve]}:{},layout:H(Me.layout,ge),header:{...Me.header||{}},contextMenu:Me.contextMenu===void 0?null:Me.contextMenu,facet:{...Me.facet||{}},export:{...Me.export||{}},allowGroup:Me.allowGroup!==!1,allowPivot:Me.allowPivot!==!1,allowTotal:Me.allowTotal!==!1,quickFilter:Me.quickFilter!==!1,def:ie,format:Me.format,presets:pe,inferred:ue!=null&&!ie.type,computed:Se,diff:ie.diff===void 0?void 0:!!ie.diff,read:Pe?R(Pe):null,write:Pe?S(Pe):null};Fe.cell.align=B(ge.cell&&ge.cell.align)||Fe.align,Fe.header.align=B(ge.header&&ge.header.align)||Fe.align;const We=Me.lookup||null;return Fe.lookup=We?v({id:_e,lookup:We},{locale:this.#a,onChange:()=>{this.#w&&this.#w("lookup",{colId:_e})}}):null,Fe.group.explode&&Fe.lookup&&Fe.lookup.multiple&&W(`explode:${_e}`,`column "${_e}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(Fe),Fe}#v(ie){ie.formatter=f(ie.format,ie.dataType,this.#a,this.#l,ie.id),ie.formatValue=_(ie,{locale:this.#a,grid:this.#h,context:this.#p}),ie.itemCompare=ie.itemType?m(ie.itemType,this.#a):null,ie.compare=g(ie.value.compare)?ie.value.compare:ie.lookup?ie.lookup.comparator():g(ie.dataType.compareFor)?ie.dataType.compareFor(ie):m(ie.dataType,this.#a),ie.excel=ie.formatter&&ie.formatter.ooxml||ie.dataType&&ie.dataType.excel||"General",ie.storeKind=s(ie.dataType,!!(ie.lookup&&ie.lookup.multiple))}#C(ie,ue,ge){let pe=i(ie.typeOptions)?ie.typeOptions:null;for(let Ae=ue.length-1;!pe&&Ae>=0;Ae--)i(ue[Ae].typeOptions)&&(pe=ue[Ae].typeOptions);!pe&&i(this.#s.typeOptions)&&(pe=this.#s.typeOptions);const Oe=pe&&pe.of!==void 0?pe.of:"text",ve=typeof Oe=="string"?this.#i.get(Oe):void 0;return ve&&!g(ve.items)&&ve.storage!=="object"?ve:(W(`type:of:${String(Oe)}`,`column "${ge}" names "${String(Oe)}" as its item type (typeOptions.of), which is not ${ve?"a scalar data type":"a known data type"}; its items are read as text.`),this.#i.get("text"))}#S(ie,ue,ge){if(ie.type===!1)return"text";if(ie.type)return ie.type;for(let pe=ue.length-1;pe>=0;pe--)if(ue[pe].type)return ue[pe].type;if(this.#s.type)return this.#s.type;if(ie.shadow){const pe=typeof ie.shadow=="string"?ie.shadow:ie.shadow.kind;if(pe==="fitInfluence")return"boolean";if(pe==="fitPredicted"||pe==="fitResidual"||pe==="fitStdResidual"||pe==="fitLeverage"||pe==="fitCooksD"||pe==="tsTrend"||pe==="tsSeasonal"||pe==="tsResidual"||pe==="tsCoverage"||pe==="tsSmoothed"||pe==="tsSmoothingAlpha"||pe==="tsSmoothingBeta"||pe==="cluster"||pe==="clusterDistance")return"number"}return ge||(ie.lookup?"lookup":"text")}#P(ie){const ue=this.all();this.#m=a(ue),this.#g?this.#g.setGraph(this.#m):this.#g=new V({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:ie||null,rowKey:this.#b});const ge=this.#g;for(const pe of ue)pe.getValue=(Oe,ve)=>ge.value(pe,Oe,ve)}all(){return this.#t.map(ie=>this.#e.get(ie))}visible(){return this.all().filter(ie=>!ie.layout.hidden)}get(ie){return this.#e.get(ie)}groups(){const ie=ue=>{const ge=[];for(const pe of ue)Array.isArray(pe.columns)?ge.push({...pe,columns:ie(pe.columns)}):pe.column&&ge.push(pe.column);return ge};return ie(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#i}affectedBy(ie){return h(this.#m,ie)}value(ie,ue,ge){return this.#g.value(ie,ue,ge)}text(ie,ue,ge){return this.#g.text(ie,ue,ge)}checkImpure(ie,ue){Y(this.#e.get(ie),ue)}setLocale(ie){this.#a=ie;for(const ue of this.all())ue.lookup&&ue.lookup.setLocale(ie),this.#v(ue);this.#w&&this.#w("locale",{locale:ie})}infer(ie){const ue={};if(this.#y||!Array.isArray(ie)||ie.length===0)return ue;this.#y=!0;let ge=!1;for(const pe of this.all()){const Oe=pe.def;if(Oe.type!==void 0||!pe.field||pe.computed||pe.lookup||this.#E(pe))continue;const ve=pe.read||(Me=>K(Me,pe.field)),ye=p(pe.id,ie,ve,this.#i,{sampleSize:this.#O});if(ye===pe.type)continue;ue[pe.id]=ye;const Ae=this.#A(Oe,ye);Ae.groupPath=pe.groupPath,Ae.layout={...Ae.layout,...de(pe.layout)},this.#e.set(pe.id,Ae),Ne(this.#n,pe.id,Ae),ge=!0}return ge&&this.#P(null),ue}redecorate(ie,ue,ge={}){const pe=this.#e.get(ie);if(!pe){W(`redecorate:${ie}`,`columns.decorate('${ie}', …): no column with id '${ie}'.`);return}const Oe=pe.def||{},ve={...i(Oe.cell)?Oe.cell:{}};ve.decoration=ue??void 0,ge&&"variant"in ge&&(ve.variant=ge.variant);const ye={...Oe,cell:ve};this.#r.has(Oe)&&this.#r.set(ye,this.#r.get(Oe));const Ae=this.#A(ye,pe.type);return Ae.groupPath=pe.groupPath,Ae.layout={...Ae.layout,...de(pe.layout)},pe.lookup&&pe.lookup!==Ae.lookup&&g(pe.lookup.destroy)&&pe.lookup.destroy(),this.#e.set(ie,Ae),Ne(this.#n,ie,Ae),this.#P(null),this.#w&&this.#w("decorate",{colId:ie}),Ae}destroy(){for(const ie of this.#e.values())ie.lookup&&g(ie.lookup.destroy)&&ie.lookup.destroy()}#E(ie){for(const ue of ie.presets){const ge=this.#o[ue];if(ge&&ge.type)return!0}return!!this.#s.type}#T(ie){return!ie.computed&&g(ie.dataType&&ie.dataType.toStorage)}storeReader(ie){if(ie.computed)return ue=>this.#g.value(ie,ue,null);if(this.#T(ie)){const ue=ie.dataType.toStorage,ge={timeZone:this.#l,colId:ie.id,itemType:ie.itemType||null};return pe=>ue(ie.read(pe),ge)}return ie.read}storeValue(ie,ue){if(!(!ie||ie.computed)&&g(ie.read))return this.storeReader(ie)(ue)}storeSchema(){const ie=[];for(const ue of this.all()){if(ue.computed&&ue.value.pure===!1||!ue.computed&&!ue.field)continue;const ge=this.storeReader(ue);let pe=null;!ue.computed&&!this.#T(ue)&&typeof ue.field=="string"&&!ue.lookup&&(pe=ue.field);const Oe={id:ue.id,kind:ue.storeKind,nullable:ue.nullable,read:ge};pe!==null&&(Oe.field=pe),ue.lookup&&(Oe.dictionary=ue.lookup.dictionary()),ie.push(Oe)}return ie}state(){return this.all().map(ie=>({id:ie.id,width:ie.layout.width,flex:ie.layout.flex||void 0,hidden:!!ie.layout.hidden,headerWrap:ie.header?.wrap===!0?!0:void 0,headerOrientation:ie.header?.orientation==="vertical"?"vertical":void 0,pin:ie.layout.pin??null,sort:ie.sort.direction??null,sortIndex:ie.sort.direction?ie.sort.order??0:null,groupIndex:ie.group.enabled?ie.group.index??0:null,pivotIndex:ie.pivot.enabled?ie.pivot.index??0:null,total:typeof ie.total=="string"?ie.total:null,groupTotal:typeof ie.groupTotal=="string"?ie.groupTotal:void 0,grandTotal:typeof ie.grandTotal=="string"?ie.grandTotal:void 0,decoration:ie.cell&&ie.cell.decoration!=null?le(ie.cell.decoration):void 0,variant:ie.cell&&ie.cell.variant!=null?le(ie.cell.variant):void 0}))}applyState(ie,ue={}){const ge={applied:[],skipped:[]},pe=Array.isArray(ie)?ie:ie&&ie.columns||[],Oe=!Array.isArray(ie)&&ie&&ie.columnOrder||null;for(const ye of pe){if(!ye||!ye.id){ge.skipped.push({key:"?",reason:"no id"});continue}let Ae=this.#e.get(ye.id);if(!Ae){ge.skipped.push({key:ye.id,reason:"unknown column"});continue}if(Object.hasOwn(ye,"decoration")||Object.hasOwn(ye,"variant")){const Me=Ae.cell?Ae.cell.decoration:void 0,je=ye.decoration??null,_e=Object.hasOwn(ye,"variant"),Pe=_e&&!be(Ae.cell?Ae.cell.variant:void 0,ye.variant);(!be(Me,je)||Pe)&&(this.redecorate(ye.id,je,_e?{variant:ye.variant??void 0}:{}),Ae=this.#e.get(ye.id)||Ae)}ye.width!=null&&(Ae.layout.width=ye.width),ye.flex!=null&&(Ae.layout.flex=ye.flex),ye.hidden!=null&&(Ae.layout.hidden=!!ye.hidden),ye.headerWrap!==void 0&&(Ae.header.wrap=!!ye.headerWrap),ye.headerOrientation!==void 0&&(Ae.header.orientation=ye.headerOrientation==="vertical"?"vertical":"horizontal"),ye.pin!==void 0&&(Ae.layout.pin=ye.pin),ye.sort!==void 0&&(Ae.sort.direction=ye.sort),ye.sortIndex!=null&&(Ae.sort.order=ye.sortIndex),ye.groupIndex!=null&&(Ae.group.enabled=!0,Ae.group.index=ye.groupIndex),ye.pivotIndex!=null&&(Ae.pivot.enabled=!0,Ae.pivot.index=ye.pivotIndex),ye.total!==void 0&&(Ae.total=ye.total),ye.groupTotal!==void 0&&(Ae.groupTotal=ye.groupTotal),ye.grandTotal!==void 0&&(Ae.grandTotal=ye.grandTotal),ge.applied.push(ye.id)}const ve=Oe||(ue&&ue.keepOrder?[]:pe.map(ye=>ye&&ye.id).filter(Boolean));if(ve.length){const ye=ve.filter(Me=>this.#e.has(Me)),Ae=this.#t.filter(Me=>!ye.includes(Me));this.#t=[...ye,...Ae]}return this.#w&&this.#w("state",ge),ge}move(ie,ue){this.#M(ie,ue)&&(this.#R(),this.#w&&this.#w("move",{id:ie,to:ue}))}reorder(ie){const ue={applied:[],skipped:[]},ge=[];let pe=0;for(const Oe of Array.isArray(ie)?ie:[]){const ve=pe++;this.#M(Oe,ve)&&(ue.applied.push(Oe),ge.push({id:Oe,to:ve}))}if(!ge.length)return ue;if(this.#R(),this.#w)for(const Oe of ge)this.#w("move",Oe);return ue}#M(ie,ue){const ge=this.#t.indexOf(ie);if(ge===-1||Math.max(0,Math.min(Number(ue)||0,this.#t.length-1))===ge)return!1;const Oe=this.#e.get(ie);if(Oe.layout.movable===!1||Oe.layout.lockPosition)return W(`move:${ie}`,`column "${ie}" is not movable; the move was ignored`),!1;const ve=this.#N(ie,ue);return ve?(W(`move.married:${ve}`,`band "${ve}" declares marryChildren, so its columns stay together; the move was ignored`),!1):(this.#t.splice(ge,1),this.#t.splice(Math.max(0,Math.min(ue,this.#t.length)),0,ie),!0)}#N(ie,ue){if(!this.#n||!this.#n.length)return null;const ge=this.#t.filter(ye=>ye!==ie),pe=Math.max(0,Math.min(ue,ge.length)),Oe=(ye,Ae)=>{if(Array.isArray(ye.columns)){for(const je of ye.columns)Oe(je,Ae);return Ae}const Me=ye.column?ye.column.id:ye.id;return Me&&Ae.push(Me),Ae},ve=ye=>{for(const Ae of ye){if(!Array.isArray(Ae.columns))continue;if(Ae.marryChildren===!0){const je=Oe(Ae,[]),_e=je.includes(ie),Pe=je.map(Se=>ge.indexOf(Se)).filter(Se=>Se>=0);if(Pe.length){const Se=Math.min(...Pe),Fe=Math.max(...Pe);if(_e?pe<Se||pe>Fe+1:pe>Se&&pe<=Fe)return Ae.id}}const Me=ve(Ae.columns);if(Me)return Me}return null};return ve(this.#n)}#R(){const ie=new Map(this.#t.map((pe,Oe)=>[pe,Oe])),ue=pe=>{if(!Array.isArray(pe.columns)){const ve=pe.column?pe.column.id:pe.id;return ie.has(ve)?ie.get(ve):1/0}let Oe=1/0;for(const ve of pe.columns)Oe=Math.min(Oe,ue(ve));return Oe},ge=pe=>{pe.sort((Oe,ve)=>ue(Oe)-ue(ve));for(const Oe of pe)Array.isArray(Oe.columns)&&ge(Oe.columns)};ge(this.#n)}#F(ie){const ue=ge=>{for(let pe=0;pe<ge.length;pe++){const Oe=ge[pe];if(Array.isArray(Oe.columns)){const ve=ue(Oe.columns);if(ve)return ve}else if(Oe.column&&Oe.column.id===ie)return ge.splice(pe,1)[0]}return null};return ue(this.#n)}#V(ie){const ue=[];for(let ge=ie.length-1;ge>=0;ge--){const pe=ie[ge];Array.isArray(pe.columns)&&(ue.push(...this.#V(pe.columns)),pe.columns.length===0&&(ue.push(pe.id),ie.splice(ge,1)))}return ue}#W(){const ie=(ue,ge,pe)=>{for(const Oe of ue)Array.isArray(Oe.columns)?ie(Oe.columns,[...ge,Oe.id]):Oe.column&&(Oe.column.groupPath=ge)};ie(this.#n,[])}#L(ie){const ue=new Set(ie),ge=this.#t.filter(ye=>ue.has(ye));if(!ge.length)return;const pe=Math.min(...ge.map(ye=>this.#t.indexOf(ye))),Oe=this.#t.slice(0,pe).filter(ye=>!ue.has(ye)),ve=this.#t.slice(pe).filter(ye=>!ue.has(ye));this.#t=[...Oe,...ge,...ve]}#q(ie){const ue=[],ge=pe=>{if(Array.isArray(pe.columns))for(const Oe of pe.columns)ge(Oe);else pe.column&&ue.push(pe.column.id)};return ge(ie),ue}#B(ie){const ue=ge=>{for(const pe of ge){if(!Array.isArray(pe.columns))continue;if(pe.id===ie)return{node:pe,parent:ge};const Oe=ue(pe.columns);if(Oe)return Oe}return null};return ue(this.#n)}groupColumns(ie,ue={}){const ge=F(ie).filter(Ae=>this.#e.has(Ae));if(!ge.length)return W("columns.group.empty","groupColumns was given no known column ids; nothing was grouped."),null;for(const Ae of ge)if(this.#e.get(Ae).layout.lockPosition)return W(`columns.group.locked:${Ae}`,`column "${Ae}" is position-locked and cannot be grouped.`),null;const pe=ue.groupId?this.#B(ue.groupId):null;if(ue.groupId&&!pe)return W(`columns.group.unknown:${ue.groupId}`,`no band "${ue.groupId}" to add to; nothing was grouped.`),null;let Oe=null;if(!pe&&ue.id!=null&&(Oe=String(ue.id),this.#B(Oe)||this.#e.has(Oe)))return W(`columns.group.idtaken:${Oe}`,`band id "${Oe}" is already in use; nothing was grouped.`),null;const ve=ge.map(Ae=>this.#F(Ae)).filter(Boolean);if(!ve.length)return null;let ye;if(pe)pe.node.columns.push(...ve),ye=pe.node.id;else{const Ae={id:Oe||o("grp"),title:ue.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:ve},Me=Number.isInteger(ue.at)?Math.max(0,Math.min(ue.at,this.#n.length)):this.#n.length;this.#n.splice(Me,0,Ae),ye=Ae.id}return this.#V(this.#n),this.#L(ge),this.#W(),this.#R(),this.#w&&this.#w("columngroup",{action:"formed",groupId:ye,ids:ge}),ye}ungroupColumn(ie){const ue=this.#e.get(ie);if(!ue){W(`columns.ungroup.unknown:${ie}`,`no column "${ie}" to ungroup.`);return}const ge=ue.groupPath||[];if(!ge.length)return;const pe=ge[ge.length-1],Oe=this.#B(pe);if(!Oe)return;const ve=this.#F(ie);if(!ve)return;const ye=Oe.parent.indexOf(Oe.node);Oe.parent.splice(ye+1,0,ve);const Ae=this.#V(this.#n),Me=this.#q(Oe.node);if(Me.length){this.#L(Me);const je=Math.max(...Me.map(Pe=>this.#t.indexOf(Pe))),_e=this.#t.filter(Pe=>Pe!==ie);_e.splice(je+1,0,ie),this.#t=_e}this.#W(),this.#R(),this.#w&&this.#w("columngroup",{action:"removed",id:ie,dissolved:Ae})}renameGroup(ie,ue){const ge=this.#B(ie);if(!ge){W(`columns.group.rename:${ie}`,`no band "${ie}" to rename.`);return}ge.node.title=String(ue??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:ie,title:ge.node.title})}dissolveGroup(ie){const ue=this.#B(ie);if(!ue){W(`columns.group.dissolve:${ie}`,`no band "${ie}" to dissolve.`);return}const ge=ue.parent.indexOf(ue.node);ue.parent.splice(ge,1,...ue.node.columns),this.#W(),this.#R(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:ie})}moveGroup(ie,ue){const ge=this.#B(ie);if(!ge){W(`columns.group.move:${ie}`,`no band "${ie}" to move.`);return}const pe=ge.parent,Oe=pe.indexOf(ge.node);Oe!==-1&&(pe.splice(Oe,1),pe.splice(Math.max(0,Math.min(ue,pe.length)),0,ge.node),this.#Y(),this.#W(),this.#w&&this.#w("columngroup",{action:"moved",groupId:ie,to:ue}))}#Y(){const ie=[],ue=pe=>{for(const Oe of pe)Array.isArray(Oe.columns)?ue(Oe.columns):Oe.column&&ie.push(Oe.column.id)};ue(this.#n);const ge=new Set(ie);this.#t=[...ie,...this.#t.filter(pe=>!ge.has(pe))]}groupTree(){const ie=ge=>ge.map(pe=>Array.isArray(pe.columns)?{id:pe.id,title:pe.title||"",collapsible:!!pe.collapsible,openByDefault:pe.openByDefault!==!1,columns:ie(pe.columns)}:pe.column?pe.column.id:null).filter(pe=>pe!==null),ue=ie(this.#n);return ue.some(ge=>ge&&typeof ge=="object")?ue:[]}applyGroupTree(ie){if(!Array.isArray(ie))return;const ue=new Set,ge=Oe=>{const ve=[];for(const ye of Oe)if(ye&&typeof ye=="object"&&Array.isArray(ye.columns)){const Ae=ge(ye.columns);if(!Ae.length)continue;ve.push({id:ye.id||o("grp"),title:ye.title||"",collapsible:ye.collapsible===!0,openByDefault:ye.openByDefault!==!1,showWhen:"always",marryChildren:!1,header:{},def:{},columns:Ae})}else if(typeof ye=="string"){const Ae=this.#e.get(ye);Ae&&!ue.has(ye)&&(ue.add(ye),ve.push({column:Ae,path:[]}))}return ve},pe=ge(ie);for(const Oe of this.#t){if(ue.has(Oe))continue;const ve=this.#e.get(Oe);ve&&pe.push({column:ve,path:[]})}this.#n=pe,this.#W(),this.#R(),this.#w&&this.#w("columngroup",{action:"applied"})}show(ie){this.#G(ie,!1)}hide(ie){this.#G(ie,!0)}#G(ie,ue){const ge=[];for(const pe of F(ie)){const Oe=this.#e.get(pe);if(Oe){if(ue&&Oe.layout.lockVisible){W(`lockVisible:${pe}`,`column "${pe}" is \`layout.lockVisible\` and cannot be hidden`);continue}Oe.layout.hidden!==ue&&(Oe.layout.hidden=ue,ge.push(pe))}}ge.length&&this.#w&&this.#w("visible",{ids:ge,hidden:ue})}pin(ie,ue){const ge=this.#e.get(ie);ge&&(ge.layout.pin=ue??null,this.#w&&this.#w("pin",{id:ie,side:ge.layout.pin}))}pinMany(ie){const ue={};for(const[pe,Oe]of ie){const ve=this.#e.get(pe);ve&&(ve.layout.pin=Oe??null,ue[pe]=ve.layout.pin)}const ge=Object.keys(ue);ge.length&&this.#w&&this.#w("pin",{ids:ge,pins:ue})}#D(ie,ue){const ge=ie.layout.min??0,pe=ie.layout.max;let Oe=Math.max(ge,ue);return pe!=null&&(Oe=Math.min(pe,Oe)),ie.layout.width=Oe,ie.layout.flex=0,Oe}resize(ie,ue){const ge=this.#e.get(ie);if(!ge)return;if(ge.layout.resizable===!1){W(`resize:${ie}`,`column "${ie}" is not resizable; the resize was ignored`);return}const pe=this.#D(ge,ue);this.#w&&this.#w("resize",{id:ie,width:pe})}resizeMany(ie){const ue={};for(const[pe,Oe]of ie){const ve=this.#e.get(pe);if(ve){if(ve.layout.resizable===!1){W(`resize:${pe}`,`column "${pe}" is not resizable; the resize was ignored`);continue}ue[pe]=this.#D(ve,Oe)}}const ge=Object.keys(ue);ge.length&&this.#w&&this.#w("resize",{ids:ge,widths:ue})}}function de(he){const ie={};return he.width!=null&&(ie.width=he.width),he.hidden!=null&&(ie.hidden=he.hidden),he.pin!==void 0&&(ie.pin=he.pin),ie}function le(he){if(he===null||typeof he!="object")return he;try{return structuredClone(he)}catch{}try{return JSON.parse(JSON.stringify(he))}catch{return he}}function be(he,ie){const ue=he??null,ge=ie??null;if(ue===ge)return!0;if(ue===null||ge===null)return!1;if(typeof ue!="object"||typeof ge!="object")return ue===ge;try{return JSON.stringify(ue)===JSON.stringify(ge)}catch{return!1}}function Ce(he){const ie=[],ue=(pe,Oe,ve)=>{const ye=[];for(const Ae of pe){if(!i(Ae)){q("a column definition must be an object");continue}if(Array.isArray(Ae.columns)){ee(Ae,Z,"columnGroup",Ae.title||Ae.id||"(unnamed)");const Me={id:Ae.id||o("grp"),title:Ae.title||"",collapsible:Ae.collapsible===!0,openByDefault:Ae.openByDefault!==!1,showWhen:Ae.showWhen||"always",marryChildren:Ae.marryChildren===!0,header:Ae.header||{},def:Ae,columns:[]};Me.columns=ue(Ae.columns,[...Oe,Me.id],Ae.facet!==void 0?Ae.facet:ve),ye.push(Me)}else{const Me={def:Ae,path:Oe,facet:ve};ie.push(Me),ye.push(Me)}}return ye},ge=ue(he,[],void 0);return{leaves:ie,groups:ge}}function Ne(he,ie,ue){for(const ge of he){if(ge.columns){if(Ne(ge.columns,ie,ue))return!0;continue}if(ge.column&&ge.column.id===ie)return ge.column=ue,!0}return!1}}),Be("packages/core/src/columns/autogroup.js",function(e,D){"use strict";Object.defineProperty(e,"AUTO_GROUP_ID",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createAutoGroupColumn",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"warnOnAbsurdGrouping",{enumerable:!0,get:function(){return K}});const M=D("packages/core/src/internal/warn.js").warnOnce,G="__lattice_group",F=240,x=.5;function q(R){const S=R.def&&R.def.layout;return(typeof S=="number"||S&&S.width!=null||R.def&&R.def.width!=null)&&Number.isFinite(R.layout.width)?R.layout.width:null}function W(R){const S=R.def&&R.def.layout;return!!(S&&S.min!=null)||R.def&&R.def.minWidth!=null}function I(R){const{columns:S,groupBy:k}=R,y=k.map(c=>S.get(c)).filter(Boolean),l=y.length?y.map(c=>c.title||c.id).join(" > "):"Group",g=y.find(c=>q(c)!=null),i=R.config&&R.config.autoGroupColumnWidth||(g?q(g):F);let t=g&&W(g)?g.layout.min:120;g&&!W(g)&&(t=Math.min(t,i));const o=g&&g.layout.max!=null?g.layout.max:null;return{id:G,field:null,title:l,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group"},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!0},groupedIds:k.slice(),group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:i,min:t,max:o,pin:R.config&&R.config.autoGroupColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(c,f){return f&&f.group?f.groupValue:null},formatValue(c,f){if(!f||!f.group)return"";if(f.grandTotal)return R.config&&R.config.grandTotalLabel||"Total";const n=y[Math.min(f.level||0,y.length-1)];return n&&typeof n.formatValue=="function"?n.formatValue(c,f):c==null?"":String(c)}}}function K(R,S,k){!R.length||k<100||S<k*x||M(`grouping.cardinality:${R.join(",")}`,`grouping by ${R.join(", ")} produced ${S} groups for ${k} rows: nearly one group per row. Grouping a continuous value such as a percentage or a timestamp rarely reads usefully; consider a computed banding column.`)}}),Be("packages/core/src/columns/selectcolumn.js",function(e,D){"use strict";Object.defineProperty(e,"SELECT_COLUMN_ID",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"createSelectionColumn",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return F}});const re="__lattice_select",M=44;function G(x){const q=x.selection||{},W=x.config&&x.config.selectionColumnWidth||M;return{id:re,field:null,title:"",type:"boolean",dataType:{base:"boolean"},nullable:!1,align:"center",generated:!0,control:!0,value:{pure:!0},cell:{render:"checkbox",props:{mode:"selection"},align:"center"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:W,min:W,max:W,pin:x.config&&x.config.selectionColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,headerCheckbox:q.headerCheckbox===!0,def:{},getValue(I,K){return K?K.selected:!1},formatValue(){return""}}}const F=G}),Be("packages/core/src/columns/rownumbercolumn.js",function(e,D){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createRowNumberColumn",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return K}});const M=D("packages/core/src/internal/predicates.js").isFunction,G="__lattice_rownumber",F=40,x=9,q=22;function W(R){const S=String(Math.max(1,Math.trunc(Math.abs(R))||1)).length;return Math.max(F,S*x+q)}function I(R){const S=R.rowNumbers,k=S&&typeof S=="object"?S:{},y=Number.isFinite(k.start)?k.start:1,l=Number.isFinite(k.width)?k.width:W((R.maxNumber||0)+y),g=M(R.rank)?R.rank:()=>null;return{id:G,field:null,title:typeof k.title=="string"?k.title:"",type:"number",dataType:{base:"number"},nullable:!0,align:"end",generated:!0,control:!0,value:{pure:!0},cell:{align:"end"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:l,min:l,max:l,pin:"start",hidden:!1,resizable:k.width==null,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(i,t){const o=g(t);return o==null?null:o-1+y},formatValue(i){return i==null?"":String(i)}}}const K=I}),Be("packages/core/src/model/detail.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_DETAIL_HEIGHT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DEFAULT_CACHE_LIMIT",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"DetailModel",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return K}});const M=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce,x=240,q=10;function W(R){if(!R)return null;const S=R===!0?{}:R;return S.enabled===!1?null:!M(S.rows)&&!S.render?(F("detail.rows","detail is enabled but neither `rows` nor `render` was supplied; expanding a master would show an empty region, so it stays off."),null):{render:S.render||null,config:S.config||null,rows:M(S.rows)?S.rows:null,height:S.height??x,maxHeight:S.maxHeight??null,cacheLimit:Number.isFinite(S.cacheLimit)?Math.max(0,S.cacheLimit):q,isMaster:M(S.isMaster)?S.isMaster:null,target:S.target||null,onCreate:M(S.onCreate)?S.onCreate:null,path:typeof S.path=="string"?S.path:null}}class I{#e;#t=new Set;#n;#r=0;constructor(S){this.#e=S.config,this.#n=M(S.onChange)?S.onChange:()=>{}}get config(){return this.#e}get inline(){return!this.#e.target}isMaster(S){if(!S||S.group||S.detail)return!1;const k=this.#e.isMaster;return k?!!k(S.data,S):!0}isOpen(S){return this.#t.has(S)}keys(){return[...this.#t]}activeKey(){for(const S of this.#t)return S;return null}heightOf(S){const k=this.#e.height;return M(k)?Number(k(S))||x:k==="auto"?x:Number(k)||x}open(S){return this.#t.has(S)?!1:(this.inline||this.#t.clear(),this.#t.add(S),this.#i(),!0)}close(S){return this.#t.delete(S)?(this.#i(),!0):!1}toggle(S){return this.#t.has(S)?(this.close(S),!1):(this.open(S),!0)}closeAll(){this.#t.size&&(this.#t.clear(),this.#i())}prune(S){if(!this.#t.size||!M(S))return;let k=!1;for(const y of[...this.#t])S(y)||(this.#t.delete(y),k=!0);k&&this.#i()}signature(){return`${this.#r}`}set(S){this.#t.clear();const k=Array.isArray(S)?S:[];for(const y of this.inline?k:k.slice(0,1))this.#t.add(y);this.#i()}#i(){this.#r++,this.#n()}}const K=I}),Be("packages/core/src/compute/special.js",function(e,D){"use strict";Object.defineProperty(e,"logGamma",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"incompleteBeta",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"normalQuantile",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"normalCdf",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"studentT",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"chiSquareUpperTail",{enumerable:!0,get:function(){return i}});const re=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),M=3e-12,G=1e-300;function F(t){if(t<.5)return Math.log(Math.PI/Math.sin(Math.PI*t))-F(1-t);const o=t-1;let c=.9999999999998099;const f=o+7.5;for(let n=0;n<re.length;n++)c+=re[n]/(o+n+1);return .5*Math.log(2*Math.PI)+(o+.5)*Math.log(f)-f+Math.log(c)}function x(t,o,c){const f=t+o,n=t+1,m=t-1;let r=1,s=1-f*c/n;Math.abs(s)<G&&(s=G),s=1/s;let d=s;for(let p=1;p<=300;p++){const u=2*p;let b=p*(o-p)*c/((m+u)*(t+u));s=1+b*s,Math.abs(s)<G&&(s=G),r=1+b/r,Math.abs(r)<G&&(r=G),s=1/s,d*=s*r,b=-(t+p)*(f+p)*c/((t+u)*(n+u)),s=1+b*s,Math.abs(s)<G&&(s=G),r=1+b/r,Math.abs(r)<G&&(r=G),s=1/s;const a=s*r;if(d*=a,Math.abs(a-1)<M)break}return d}function q(t,o,c){if(!(t>0)||!(o>0)||!Number.isFinite(c))return Number.NaN;if(c<=0)return 0;if(c>=1)return 1;const f=Math.exp(F(t+o)-F(t)-F(o)+t*Math.log(c)+o*Math.log(1-c));return c<(t+1)/(t+o+2)?f*x(t,o,c)/t:1-f*x(o,t,1-c)/o}function W(t){if(!(t>0)||!(t<1))return t===0?-1/0:t===1?1/0:Number.NaN;const o=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],c=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],f=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],n=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],m=.02425;let r,s,d;t<m?(r=Math.sqrt(-2*Math.log(t)),d=(((((f[0]*r+f[1])*r+f[2])*r+f[3])*r+f[4])*r+f[5])/((((n[0]*r+n[1])*r+n[2])*r+n[3])*r+1)):t<=1-m?(r=t-.5,s=r*r,d=(((((o[0]*s+o[1])*s+o[2])*s+o[3])*s+o[4])*s+o[5])*r/(((((c[0]*s+c[1])*s+c[2])*s+c[3])*s+c[4])*s+1)):(r=Math.sqrt(-2*Math.log(1-t)),d=-(((((f[0]*r+f[1])*r+f[2])*r+f[3])*r+f[4])*r+f[5])/((((n[0]*r+n[1])*r+n[2])*r+n[3])*r+1));const u=(.5*I(-d/Math.SQRT2)-t)*Math.sqrt(2*Math.PI)*Math.exp(d*d/2);return d-u/(1+d*u/2)}function I(t){const o=Math.abs(t),c=2/(2+o),f=4*c-2,n=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,15626441722e-18,-85238095915e-18,6529054439e-18,5059343495e-18,-991364156e-18,-227365122e-18,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18];let m=0,r=0,s;for(let p=n.length-1;p>0;p--)s=r,r=f*r-m+n[p],m=s;const d=c*Math.exp(-o*o+.5*(n[0]+f*r)-m);return t>=0?d:2-d}function K(t){return .5*I(-t/Math.SQRT2)}function R(t,o){if(!(o>0)||!Number.isFinite(t))return Number.NaN;const c=.5*q(o/2,.5,o/(o+t*t));return t>0?1-c:c}function S(t,o){if(!(t>0)||!(t<1)||!(o>0))return Number.NaN;if(o>1e7)return W(t);let c=-1e4,f=1e4,n=W(t);const m=F(o/2)+F(.5)-F((o+1)/2);for(let r=0;r<60;r++){const s=R(n,o);s<t?c=n:f=n;const d=Math.exp(-((o+1)/2)*Math.log(1+n*n/o)-m)/Math.sqrt(o),p=d>0?(s-t)/d:0;if(Math.abs(p)<1e-12)break;const u=n-p;if(n=u>c&&u<f&&Number.isFinite(u)?u:(c+f)/2,f-c<1e-12)break}return n}function k(t,o){let c=t,f=1/t,n=f;for(let m=0;m<300&&(c+=1,n*=o/c,f+=n,!(Math.abs(n)<Math.abs(f)*M));m++);return f*Math.exp(-o+t*Math.log(o)-F(t))}function y(t,o){let c=o+1-t,f=1/G,n=1/c,m=n;for(let r=1;r<=300;r++){const s=-r*(r-t);c+=2,n=s*n+c,Math.abs(n)<G&&(n=G),f=c+s/f,Math.abs(f)<G&&(f=G),n=1/n;const d=n*f;if(m*=d,Math.abs(d-1)<M)break}return Math.exp(-o+t*Math.log(o)-F(t))*m}function l(t,o){return!(t>0)||!(o>=0)||!Number.isFinite(o)?Number.NaN:o===0?0:o<t+1?k(t,o):1-y(t,o)}function g(t,o){return o>0?l(o/2,t/2):Number.NaN}function i(t,o){const c=g(t,o);return Number.isNaN(c)?Number.NaN:Math.min(1,Math.max(0,1-c))}}),Be("packages/core/src/compute/linalg.js",function(e,D){"use strict";Object.defineProperty(e,"cholesky",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"choleskySolve",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"choleskyInverse",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"normalEquations",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return q}});function re(W){const I=W.length,K=Array.from({length:I},()=>new Array(I).fill(0));for(let R=0;R<I;R++)for(let S=0;S<=R;S++){let k=W[R][S];for(let y=0;y<S;y++)k-=K[R][y]*K[S][y];if(R===S){if(!(k>0))return null;K[R][S]=Math.sqrt(k)}else K[R][S]=k/K[S][S]}return K}function M(W,I){const K=W.length,R=new Array(K).fill(0);for(let k=0;k<K;k++){let y=I[k];for(let l=0;l<k;l++)y-=W[k][l]*R[l];R[k]=y/W[k][k]}const S=new Array(K).fill(0);for(let k=K-1;k>=0;k--){let y=R[k];for(let l=k+1;l<K;l++)y-=W[l][k]*S[l];S[k]=y/W[k][k]}return S}function G(W){const I=W.length,K=Array.from({length:I},()=>new Array(I).fill(0));for(let R=0;R<I;R++){const S=new Array(I).fill(0);S[R]=1;const k=M(W,S);for(let y=0;y<I;y++)K[y][R]=k[y]}return K}function F(W,I,K){const R=W.length,S=R?W[0].length:0,k=Array.from({length:S},()=>new Array(S).fill(0)),y=new Array(S).fill(0);for(let l=0;l<R;l++){const g=K?K[l]:1,i=W[l];for(let t=0;t<S;t++){const o=g*i[t];y[t]+=o*I[l];for(let c=t;c<S;c++)k[t][c]+=o*i[c]}}for(let l=0;l<S;l++)for(let g=0;g<l;g++)k[l][g]=k[g][l];return{xtwx:k,xtwy:y}}function x(W,I){return W.map(K=>K.reduce((R,S,k)=>R+S*I[k],0))}function q(W,I){let K=0;for(let R=0;R<W.length;R++){let S=0;for(let k=0;k<W.length;k++)S+=I[R][k]*W[k];K+=W[R]*S}return K}}),Be("packages/core/src/compute/sketch.js",function(e,D){"use strict";Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return k}});class re{#e=0;#t=0;#n=0;static get errorBound(){return Object.freeze({kind:"exact",metric:"none",value:0,statement:"mean and variance match a full recompute to float rounding"})}get count(){return this.#e}add(l){if(!Number.isFinite(l))return;this.#e++;const g=l-this.#t;this.#t+=g/this.#e,this.#n+=g*(l-this.#t)}merge(l){if(l.#e===0)return;if(this.#e===0){this.#e=l.#e,this.#t=l.#t,this.#n=l.#n;return}const g=this.#e+l.#e,i=l.#t-this.#t;this.#t+=i*(l.#e/g),this.#n+=l.#n+i*i*(this.#e*l.#e/g),this.#e=g}mean(){return this.#e?this.#t:null}variance(){return this.#e>1?this.#n/(this.#e-1):null}varianceP(){return this.#e?this.#n/this.#e:null}stddev(){const l=this.variance();return l===null?null:Math.sqrt(l)}stddevP(){const l=this.varianceP();return l===null?null:Math.sqrt(l)}}class M{#e=[];#t=0;#n;#r;constructor(l,g=Math.random){if(!(l>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(l),this.#r=g}static get errorBound(){return Object.freeze({kind:"probabilistic",metric:"none",value:0,statement:"uniform sample: each element included with probability capacity/n; sample statistics are unbiased estimators"})}get seen(){return this.#t}get size(){return this.#e.length}add(l){if(!Number.isFinite(l))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(l);return}const g=Math.floor(this.#r()*this.#t);g<this.#n&&(this.#e[g]=l)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let l=0;for(const g of this.#e)l+=g;return l/this.#e.length}quantile(l){const g=this.#e.length;if(!g)return null;const i=this.#e.slice().sort((f,n)=>f-n);if(g===1)return i[0];const t=(g-1)*Math.min(1,Math.max(0,l)),o=Math.floor(t),c=Math.ceil(t);return o===c?i[o]:i[o]+(t-o)*(i[c]-i[o])}}function G(y){return y^=y>>>16,y=Math.imul(y,2246822507),y^=y>>>13,y=Math.imul(y,3266489909),y^=y>>>15,y>>>0}function F(y){if(typeof y=="number"){const i=new DataView(new ArrayBuffer(8));return i.setFloat64(0,y===0?0:y),G(i.getUint32(0)^i.getUint32(4))}const l=typeof y=="string"?y:String(y);let g=2166136261;for(let i=0;i<l.length;i++)g^=l.charCodeAt(i),g=Math.imul(g,16777619);return G(g)}class x{#e;#t;#n;constructor(l=14){const g=Math.floor(l);if(g<4||g>16)throw new RangeError("HLL precision must be 4..16");this.#e=g,this.#t=1<<g,this.#n=new Uint8Array(this.#t)}static errorBoundFor(l=14){const g=1<<Math.floor(l),i=1.04/Math.sqrt(g);return Object.freeze({kind:"probabilistic",metric:"relative",value:i,statement:`distinct count within ~${(i*100).toFixed(2)}% relative standard error (m=${g} buckets)`})}errorBound(){return x.errorBoundFor(this.#e)}add(l){const g=F(l),i=g&this.#t-1,t=g>>>this.#e|1<<32-this.#e;let o=1,c=t;for(;(c&1)===0;)o++,c>>>=1;o>this.#n[i]&&(this.#n[i]=o)}count(){const l=this.#t,g=32-this.#e,i=new Float64Array(g+2);for(let c=0;c<l;c++)i[this.#n[c]]++;let t=l*I(1-i[g+1]/l);for(let c=g;c>=1;c--)t=.5*(t+i[c]);t+=l*W(i[0]/l);const o=q*l*l/t;return Math.round(o)}}const q=.5/Math.log(2);function W(y){if(y===1)return 1/0;let l=1,g=y,i;do y*=y,i=g,g+=y*l,l+=l;while(g!==i);return g}function I(y){if(y===0||y===1)return 0;let l=1,g=1-y,i;do y=Math.sqrt(y),i=g,l*=.5,g-=(1-y)**2*l;while(g!==i);return g/3}class K{#e=new Map;#t;#n=0;constructor(l){if(!(l>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(l)}errorBoundFor(l){const g=l/this.#t;return Object.freeze({kind:"deterministic",metric:"absolute",value:g,statement:`each count overestimates the truth by at most N/m = ${g.toFixed(2)} (N=${l}, m=${this.#t})`})}get seen(){return this.#n}add(l){this.#n++;const g=this.#e.get(l);if(g){g.count++;return}if(this.#e.size<this.#t){this.#e.set(l,{count:1,error:0});return}let i,t=1/0;for(const[o,c]of this.#e)c.count<t&&(t=c.count,i=o);this.#e.delete(i),this.#e.set(l,{count:t+1,error:t})}top(l=this.#t){return[...this.#e.entries()].map(([i,t])=>({item:i,count:t.count,error:t.error})).sort((i,t)=>t.count-i.count).slice(0,Math.max(0,Math.floor(l)))}}class R{#e;#t=[[]];#n=0;#r;#i;constructor(l=200,g=Math.random){this.#e=Math.max(8,Math.floor(l)),this.#r=g,this.#i=2/3}static errorBoundFor(l=200){const g=1/Math.max(8,Math.floor(l));return Object.freeze({kind:"probabilistic",metric:"rank",value:g,statement:`queried quantile's true rank within ~${(g*100).toFixed(2)}% of N of the requested rank (k=${l})`})}errorBound(){return R.errorBoundFor(this.#e)}get count(){return this.#n}#s(l){const i=this.#t.length-1-l,t=Math.ceil(this.#e*this.#i**i);return Math.max(2,t)}add(l){Number.isFinite(l)&&(this.#n++,this.#t[0].push(l),this.#t[0].length>=this.#s(0)&&this.#o(0))}#o(l){const g=this.#t[l];g.sort((o,c)=>o-c),l+1>=this.#t.length&&this.#t.push([]);const i=this.#t[l+1],t=this.#r()<.5?0:1;for(let o=t;o<g.length;o+=2)i.push(g[o]);this.#t[l]=[];for(let o=0;o<this.#t.length;o++)if(this.#t[o].length>=this.#s(o)){this.#o(o);return}}#l(){const l=[];for(let g=0;g<this.#t.length;g++){const i=1<<g;for(const t of this.#t[g])l.push({v:t,w:i})}return l}quantile(l){const g=this.#l();if(!g.length)return null;g.sort((c,f)=>c.v-f.v);let i=0;for(const c of g)i+=c.w;const t=Math.min(1,Math.max(0,l))*i;let o=0;for(const c of g)if(o+=c.w,o>=t)return c.v;return g[g.length-1].v}rank(l){let g=0;for(let i=0;i<this.#t.length;i++){const t=1<<i;for(const o of this.#t[i])o<=l&&(g+=t)}return g}}const S=Object.freeze({distinct:x.errorBoundFor(14),median:R.errorBoundFor(200),p25:R.errorBoundFor(200),p75:R.errorBoundFor(200),p90:R.errorBoundFor(200),p95:R.errorBoundFor(200),p99:R.errorBoundFor(200),iqr:R.errorBoundFor(200),topK:Object.freeze({kind:"deterministic",metric:"absolute",value:0,statement:"each count overestimates the truth by at most N/m; top-K exact when the K-th item exceeds N/m"})}),k={Welford:re,Reservoir:M,HyperLogLog:x,SpaceSaving:K,KLL:R,hash32:F,SKETCH_BOUNDS:S}}),Be("packages/core/src/compute/statistics.js",function(e,D){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"numbers",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"frequencies",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"herfindahl",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"entropy",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"evenness",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"topShare",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"gini",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"moments",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"quantileSorted",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"quantile",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"STAT_FNS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"modifiedZOutliers",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"jarqueBera",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"weightedQuantile",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"covariance",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return be}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return he}}),Object.defineProperty(e,"autocorrelations",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"spearman",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(e,"kendall",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"seriesStats",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(e,"D2_N2",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"D4_N2",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"movingRanges",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(e,"withinSigma",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(e,"countOutside",{enumerable:!0,get:function(){return We}}),Object.defineProperty(e,"histogram",{enumerable:!0,get:function(){return He}}),Object.defineProperty(e,"DEFAULT_CONFIDENCE",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(e,"meanInterval",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(e,"proportionInterval",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(e,"slopeInterval",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(e,"capabilityInterval",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(e,"standardizedMeanDifference",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(e,"normalTotalVariation",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(e,"frequencyMap",{enumerable:!0,get:function(){return at}}),Object.defineProperty(e,"categoricalDistance",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(e,"SUBSET_RELIABILITY_FLOOR",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(e,"compareColumn",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(e,"isNumericColumn",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"populationRead",{enumerable:!0,get:function(){return $e}});const re=D("packages/core/src/compute/handle.js"),M=re.presenceReader,G=re.valueReader,F=D("packages/core/src/compute/special.js"),x=F.studentTQuantile,q=F.studentT,W=F.normalQuantile,I=F.normalCdf,K=F.chiSquareUpperTail,R=D("packages/core/src/compute/linalg.js"),S=R.cholesky,k=R.choleskySolve,y=R.choleskyInverse,l=R.normalEquations,g=R.quadForm,t=D("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,o=5e3,c=Object.freeze({variance:"rescan",varianceP:"rescan",stddev:"rescan",stddevP:"rescan",sumSquares:"rescan",weightedAvg:"rescan",median:"rescan",p25:"rescan",p75:"rescan",p90:"rescan",p95:"rescan",p99:"rescan",iqr:"rescan",mode:"rescan",distinct:"rescan",range:"rescan",skewness:"rescan",kurtosis:"rescan",geomean:"rescan",harmean:"rescan",mad:"rescan",argmin:"rescan",argmax:"rescan",hhi:"rescan",entropy:"rescan",evenness:"rescan",top3Share:"rescan",top10Share:"rescan",gini:"rescan",trimmedMean:"rescan",winsorizedMean:"rescan",robustOutliers:"rescan",jarqueBera:"rescan",passRate:"rescan",failureCount:"rescan"}),f=Object.freeze({distinct:Object.freeze({sketch:"HyperLogLog",bound:t.distinct}),median:Object.freeze({sketch:"KLL",bound:t.median}),p25:Object.freeze({sketch:"KLL",bound:t.p25}),p75:Object.freeze({sketch:"KLL",bound:t.p75}),p90:Object.freeze({sketch:"KLL",bound:t.p90}),p95:Object.freeze({sketch:"KLL",bound:t.p95}),p99:Object.freeze({sketch:"KLL",bound:t.p99}),iqr:Object.freeze({sketch:"KLL",bound:t.iqr}),top3Share:Object.freeze({sketch:"SpaceSaving",bound:t.topK}),top10Share:Object.freeze({sketch:"SpaceSaving",bound:t.topK})});function n(me){const Ee=me==="sum"||me==="avg"||me==="countValues"||me==="min"||me==="max"?"maintained":Object.prototype.hasOwnProperty.call(c,me)?c[me]:null,we=Object.prototype.hasOwnProperty.call(f,me)?f[me]:null;return{stat:me,exact:Ee,approximate:we}}function m(me,Ee){const we=Ee.length,Te=new Float64Array(we);let Le=0;if(me&&(me.kind==="float64"||me.kind==="int32")){const ze=me.values,Ge=M(me);for(let tt=0;tt<we;tt++){const it=Ee[tt];if(Ge&&Ge(it)!==1)continue;const ut=ze[it];Number.isNaN(ut)||(Te[Le++]=ut)}return Te.subarray(0,Le)}const Ue=G(me);for(let ze=0;ze<we;ze++){const Ge=Ue(Ee[ze]);if(Ge==null||Ge==="")continue;const tt=typeof Ge=="number"?Ge:Number(Ge);Number.isFinite(tt)&&(Te[Le++]=tt)}return Te.subarray(0,Le)}function r(me,Ee){const we=new Map,Te=G(me);let Le=0;for(let Ue=0;Ue<Ee.length;Ue++){const ze=Te(Ee[Ue]);if(ze==null||ze===""||typeof ze=="number"&&Number.isNaN(ze))continue;const Ge=typeof ze=="object"?String(ze):ze;we.set(Ge,(we.get(Ge)||0)+1),Le++}const xe=[...we.values()].sort((Ue,ze)=>ze-Ue);return{counts:xe,total:Le,distinct:xe.length}}function s(me){return me.total>0?me.counts.map(Ee=>Ee/me.total):[]}function d(me,Ee){const we=r(me,Ee);if(!we.total)return null;let Te=0;for(const Le of s(we))Te+=Le*Le;return Te}function p(me,Ee){const we=r(me,Ee);if(!we.total)return null;let Te=0;for(const Le of s(we))Le>0&&(Te-=Le*Math.log2(Le));return Te}function u(me,Ee){const we=r(me,Ee);if(!we.total||we.distinct<2)return we.total?1:null;let Te=0;for(const Le of s(we))Le>0&&(Te-=Le*Math.log2(Le));return Te/Math.log2(we.distinct)}function b(me,Ee,we=3){const Te=r(me,Ee);if(!Te.total)return null;const Le=Math.max(1,Math.floor(we));let xe=0;for(let Ue=0;Ue<Math.min(Le,Te.counts.length);Ue++)xe+=Te.counts[Ue];return xe/Te.total}function a(me,Ee){const we=m(me,Ee),Te=we.length;if(!Te)return null;const Le=we.slice().sort();if(Le[0]<0)return null;let xe=0,Ue=0;for(let ze=0;ze<Te;ze++)xe+=Le[ze],Ue+=(ze+1)*Le[ze];return xe===0?0:2*Ue/(Te*xe)-(Te+1)/Te}function h(me){let Ee=0,we=0,Te=0;for(let Le=0;Le<me.length;Le++){const xe=me[Le];Ee++;const Ue=xe-we;we+=Ue/Ee,Te+=Ue*(xe-we)}return{n:Ee,mean:we,m2:Te}}function w(me,Ee){const we=me.length;if(!we)return NaN;if(we===1)return me[0];const Te=(we-1)*Math.min(1,Math.max(0,Ee)),Le=Math.floor(Te),xe=Math.ceil(Te);return Le===xe?me[Le]:me[Le]+(Te-Le)*(me[xe]-me[Le])}function v(me,Ee){if(!me.length)return NaN;const we=me.slice().sort();return w(we,Ee)}function A(me,Ee){const we=G(me);let Te=0,Le=0,xe=0;for(let Ue=0;Ue<Ee.length;Ue++){const ze=we(Ee[Ue]);if(ze==null||ze==="")continue;const Ge=String(ze).toUpperCase();Ge==="PASS"?Te++:Ge==="FAIL"?Le++:Ge==="WARN"&&xe++}return{pass:Te+xe,fail:Le,warn:xe,judged:Te+xe+Le}}const _=Object.freeze({hhi:(me,Ee)=>d(me,Ee),entropy:(me,Ee)=>p(me,Ee),evenness:(me,Ee)=>u(me,Ee),top3Share:(me,Ee)=>b(me,Ee,3),top10Share:(me,Ee)=>b(me,Ee,10),gini:(me,Ee)=>a(me,Ee),trimmedMean:(me,Ee)=>E(m(me,Ee),.1),winsorizedMean:(me,Ee)=>O(m(me,Ee),.1),robustOutliers:(me,Ee)=>N(m(me,Ee),3.5),jarqueBera:(me,Ee)=>T(m(me,Ee)),variance:(me,Ee)=>{const{n:we,m2:Te}=h(m(me,Ee));return we>1?Te/(we-1):null},varianceP:(me,Ee)=>{const{n:we,m2:Te}=h(m(me,Ee));return we>0?Te/we:null},stddev:(me,Ee)=>{const{n:we,m2:Te}=h(m(me,Ee));return we>1?Math.sqrt(Te/(we-1)):null},stddevP:(me,Ee)=>{const{n:we,m2:Te}=h(m(me,Ee));return we>0?Math.sqrt(Te/we):null},median:(me,Ee)=>{const we=m(me,Ee);return we.length?v(we,.5):null},p25:(me,Ee)=>{const we=m(me,Ee);return we.length?v(we,.25):null},p75:(me,Ee)=>{const we=m(me,Ee);return we.length?v(we,.75):null},p90:(me,Ee)=>{const we=m(me,Ee);return we.length?v(we,.9):null},p95:(me,Ee)=>{const we=m(me,Ee);return we.length?v(we,.95):null},p99:(me,Ee)=>{const we=m(me,Ee);return we.length?v(we,.99):null},iqr:(me,Ee)=>{const we=m(me,Ee);if(!we.length)return null;const Te=we.slice().sort();return w(Te,.75)-w(Te,.25)},mad:(me,Ee)=>{const we=m(me,Ee);if(!we.length)return null;const Te=v(we,.5),Le=new Float64Array(we.length);for(let xe=0;xe<we.length;xe++)Le[xe]=Math.abs(we[xe]-Te);return v(Le,.5)},range:(me,Ee)=>{const we=m(me,Ee);if(!we.length)return null;let Te=1/0,Le=-1/0;for(let xe=0;xe<we.length;xe++)we[xe]<Te&&(Te=we[xe]),we[xe]>Le&&(Le=we[xe]);return Le-Te},distinct:(me,Ee)=>{const we=G(me),Te=new Set;for(let Le=0;Le<Ee.length;Le++){const xe=we(Ee[Le]);xe==null||xe===""||Te.add(xe instanceof Date?xe.getTime():xe)}return Te.size},mode:(me,Ee)=>{const we=G(me),Te=new Map;for(let Ue=0;Ue<Ee.length;Ue++){const ze=we(Ee[Ue]);if(ze==null||ze==="")continue;const Ge=ze instanceof Date?ze.getTime():ze;Te.set(Ge,(Te.get(Ge)||0)+1)}let Le=null,xe=1;for(const[Ue,ze]of Te)ze>xe&&(xe=ze,Le=Ue);return Le},skewness:(me,Ee)=>{const we=m(me,Ee),{n:Te,mean:Le,m2:xe}=h(we);if(Te<3||xe<=0)return null;const Ue=Math.sqrt(xe/(Te-1));let ze=0;for(let Ge=0;Ge<we.length;Ge++)ze+=((we[Ge]-Le)/Ue)**3;return Te/((Te-1)*(Te-2))*ze},kurtosis:(me,Ee)=>{const we=m(me,Ee),{n:Te,mean:Le,m2:xe}=h(we);if(Te<4||xe<=0)return null;const Ue=Math.sqrt(xe/(Te-1));let ze=0;for(let it=0;it<we.length;it++)ze+=((we[it]-Le)/Ue)**4;const Ge=Te*(Te+1)/((Te-1)*(Te-2)*(Te-3)),tt=3*(Te-1)**2/((Te-2)*(Te-3));return Ge*ze-tt},geomean:(me,Ee)=>{const we=m(me,Ee);if(!we.length)return null;let Te=0;for(let Le=0;Le<we.length;Le++){if(we[Le]<=0)return null;Te+=Math.log(we[Le])}return Math.exp(Te/we.length)},harmean:(me,Ee)=>{const we=m(me,Ee);if(!we.length)return null;let Te=0;for(let Le=0;Le<we.length;Le++){if(we[Le]===0)return null;Te+=1/we[Le]}return we.length/Te},sumSquares:(me,Ee)=>{const we=m(me,Ee);let Te=0;for(let Le=0;Le<we.length;Le++)Te+=we[Le]*we[Le];return Te},passRate:(me,Ee)=>{const{pass:we,judged:Te}=A(me,Ee);return Te?we/Te:null},failureCount:(me,Ee)=>A(me,Ee).fail}),V=Object.freeze({hhi:"Concentration (HHI)",entropy:"Entropy",evenness:"Evenness",top3Share:"Top 3 share",top10Share:"Top 10 share",gini:"Gini coefficient",trimmedMean:"Trimmed mean",winsorizedMean:"Winsorized mean",robustOutliers:"Outliers (robust)",jarqueBera:"Jarque–Bera",median:"Median",p25:"25th percentile",p75:"75th percentile",p90:"90th percentile",p95:"95th percentile",p99:"99th percentile",iqr:"Interquartile range",mad:"Median absolute deviation",variance:"Variance",varianceP:"Variance (population)",stddev:"Standard deviation",stddevP:"Standard deviation (population)",range:"Range",distinct:"Distinct",mode:"Mode",skewness:"Skewness",kurtosis:"Kurtosis",geomean:"Geometric mean",harmean:"Harmonic mean",sumSquares:"Sum of squares",weightedAvg:"Weighted average",argmin:"Lowest by",argmax:"Highest by",passRate:"Pass rate",failureCount:"Failures"});function Y(me,Ee,we){const Te=G(me),Le=G(Ee);let xe=0,Ue=0;for(let ze=0;ze<we.length;ze++){const Ge=we[ze],tt=Number(Te(Ge)),it=Number(Le(Ge));!Number.isFinite(tt)||!Number.isFinite(it)||(xe+=tt*it,Ue+=it)}return Ue===0?null:xe/Ue}function $(me,Ee,we){const Te=G(me);let Le=null,xe=we?-1/0:1/0;for(let Ue=0;Ue<Ee.length;Ue++){const ze=Ee[Ue],Ge=Number(Te(ze));Number.isFinite(Ge)&&(we?Ge>xe:Ge<xe)&&(xe=Ge,Le=ze)}return Le}function j(me,Ee,we){const Te=G(me),Le=G(Ee);let xe=0,Ue=0,ze=0,Ge=0,tt=0,it=0;for(let Ve=0;Ve<we.length;Ve++){const Je=we[Ve],st=Number(Te(Je)),et=Number(Le(Je));!Number.isFinite(st)||!Number.isFinite(et)||(xe++,Ue+=st,ze+=et,Ge+=st*st,tt+=et*et,it+=st*et)}if(xe<2)return null;const ut=xe*it-Ue*ze,wt=Math.sqrt((xe*Ge-Ue*Ue)*(xe*tt-ze*ze));if(wt===0)return null;const jt=ut/wt;return Math.max(-1,Math.min(1,jt))}function E(me,Ee=.1){const we=me.length;if(!we)return null;const Te=Array.from(me).sort((ze,Ge)=>ze-Ge),Le=Math.floor(we*Math.min(.49,Math.max(0,Ee))),xe=Te.slice(Le,we-Le);if(!xe.length)return w(Te,.5);let Ue=0;for(const ze of xe)Ue+=ze;return Ue/xe.length}function O(me,Ee=.1){const we=me.length;if(!we)return null;const Te=Array.from(me).sort((Ge,tt)=>Ge-tt),Le=Math.floor(we*Math.min(.49,Math.max(0,Ee))),xe=Te[Le],Ue=Te[we-1-Le];let ze=0;for(const Ge of Te)ze+=Math.min(Ue,Math.max(xe,Ge));return ze/we}function N(me,Ee=3.5){if(!me.length)return null;const Te=Array.from(me).sort((Ge,tt)=>Ge-tt),Le=w(Te,.5),xe=Te.map(Ge=>Math.abs(Ge-Le)).sort((Ge,tt)=>Ge-tt),Ue=w(xe,.5);if(Ue===0)return null;let ze=0;for(const Ge of Te)Math.abs(.6745*(Ge-Le)/Ue)>Ee&&ze++;return ze}function T(me){const Ee=me.length;if(Ee<8)return null;let we=0;for(const Ge of me)we+=Ge;we/=Ee;let Te=0,Le=0,xe=0;for(const Ge of me){const tt=Ge-we;Te+=tt*tt,Le+=tt*tt*tt,xe+=tt*tt*tt*tt}if(Te/=Ee,Le/=Ee,xe/=Ee,Te===0)return null;const Ue=Le/Te**1.5,ze=xe/(Te*Te)-3;return Ee/6*(Ue*Ue+ze*ze/4)}function C(me,Ee,we){const Te=[];let Le=0;for(let Ge=0;Ge<me.length;Ge++){const tt=Number(me[Ge]),it=Number(Ee[Ge]);!Number.isFinite(tt)||!Number.isFinite(it)||it<=0||(Te.push([tt,it]),Le+=it)}if(!Te.length||Le<=0)return null;if(Te.sort((Ge,tt)=>Ge[0]-tt[0]),Te.length===1)return Te[0][0];const xe=[];let Ue=0;for(const[,Ge]of Te)xe.push((Ue+Ge/2)/Le),Ue+=Ge;const ze=Math.max(0,Math.min(1,we));if(ze<=xe[0])return Te[0][0];if(ze>=xe[xe.length-1])return Te[Te.length-1][0];for(let Ge=1;Ge<xe.length;Ge++){if(ze>xe[Ge])continue;const tt=xe[Ge]-xe[Ge-1],it=tt>0?(ze-xe[Ge-1])/tt:0;return Te[Ge-1][0]+(Te[Ge][0]-Te[Ge-1][0])*it}return Te[Te.length-1][0]}function B(me,Ee,we){const Te=G(me),Le=G(Ee),xe=new Float64Array(we.length),Ue=new Float64Array(we.length);let ze=0;for(let Ge=0;Ge<we.length;Ge++){const tt=we[Ge],it=Number(Te(tt)),ut=Number(Le(tt));!Number.isFinite(it)||!Number.isFinite(ut)||(xe[ze]=it,Ue[ze]=ut,ze++)}return{xs:xe.subarray(0,ze),ys:Ue.subarray(0,ze),n:ze}}function z(me,Ee,we,Te=!1){const{xs:Le,ys:xe,n:Ue}=B(me,Ee,we);if(Ue<2)return null;let ze=0,Ge=0;for(let it=0;it<Ue;it++)ze+=Le[it],Ge+=xe[it];ze/=Ue,Ge/=Ue;let tt=0;for(let it=0;it<Ue;it++)tt+=(Le[it]-ze)*(xe[it]-Ge);return tt/(Te?Ue:Ue-1)}function X(me,Ee,we){const{xs:Te,ys:Le,n:xe}=B(me,Ee,we);if(xe<2)return null;let Ue=0,ze=0;for(let st=0;st<xe;st++)Ue+=Te[st],ze+=Le[st];Ue/=xe,ze/=xe;let Ge=0,tt=0,it=0;for(let st=0;st<xe;st++){const et=Te[st]-Ue,ft=Le[st]-ze;Ge+=et*et,tt+=et*ft,it+=ft*ft}if(Ge===0)return null;const ut=tt/Ge,wt=ze-ut*Ue,jt=it===0?1:Math.max(0,Math.min(1,tt*tt/(Ge*it))),Ve=Math.max(0,it-ut*tt),Je=xe>2?Math.sqrt(Ve/(xe-2)/Ge):0;return{slope:ut,intercept:wt,r2:jt,stdError:Je,n:xe}}const Q=new Set(["ols","wls","robust"]),H=new Set(["quantile"]),L=new Set(["ridge","lasso","elasticnet","mixed","gls"]),Z=1.345;function ee(me,Ee,we){const{xtwx:Te,xtwy:Le}=l(me,Ee,we),xe=S(Te);if(!xe)return null;const Ue=k(xe,Le),ze=y(xe),Ge=te(me,Ue),tt=Ee.map((it,ut)=>it-Ge[ut]);return{beta:Ue,cov:ze,fitted:Ge,residuals:tt}}function te(me,Ee){return me.map(we=>we.reduce((Te,Le,xe)=>Te+Le*Ee[xe],0))}function se(me,Ee){const we=me.length,Te=me.map(tt=>tt[Ee]),Le=me.map(tt=>[1,...tt.filter((it,ut)=>ut!==Ee)]),xe=ee(Le,Te,null);if(!xe)return 1;const Ue=Te.reduce((tt,it)=>tt+it,0)/we;let ze=0,Ge=0;for(let tt=0;tt<we;tt++)ze+=xe.residuals[tt]**2,Ge+=(Te[tt]-Ue)**2;return Ge===0?1:Math.max(0,Math.min(1,1-ze/Ge))}function ne(me){const Ee=[...me].sort((Le,xe)=>Le-xe),we=ae(Ee),Te=me.map(Le=>Math.abs(Le-we)).sort((Le,xe)=>Le-xe);return ae(Te)/.6745}function ae(me){const Ee=me.length;if(!Ee)return 0;const we=Math.floor(Ee/2);return Ee%2?me[we]:(me[we-1]+me[we])/2}function de(me,Ee,we={}){const Te=we.method||"ols";if(L.has(Te))throw new Error(`[lattice] regression method "${Te}" is out of scope; use ols, wls or robust.`);if(H.has(Te))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!Q.has(Te))throw new Error(`[lattice] unknown regression method "${Te}"; use ols, wls or robust.`);const Le=Array.isArray(Ee)?Ee.length:0,xe=Le&&Array.isArray(me[0])?me[0].length:0,Ue=xe+1;if(!(Le>Ue))return null;for(let It=0;It<Le;It++){if(!Number.isFinite(Ee[It])||!Array.isArray(me[It])||me[It].length!==xe)return null;for(let Vt=0;Vt<xe;Vt++)if(!Number.isFinite(me[It][Vt]))return null}let ze=null;if(Te==="wls"){if(ze=we.weights,!Array.isArray(ze)||ze.length!==Le)return null;for(let It=0;It<Le;It++)if(!(ze[It]>0)||!Number.isFinite(ze[It]))return null}const Ge=me.map(It=>[1,...It]);let tt,it=null;if(Te==="robust"){if(tt=ee(Ge,Ee,null),!tt)return null;for(let It=0;It<50;It++){const Vt=ne(tt.residuals);if(!(Vt>0))break;const qt=tt.residuals.map(Gt=>{const nn=Math.abs(Gt/Vt);return nn<=Z?1:Z/nn}),Jt=ee(Ge,Ee,qt);if(!Jt)return null;const rn=Jt.beta.reduce((Gt,nn,an)=>Math.max(Gt,Math.abs(nn-tt.beta[an])),0);if(tt=Jt,it=qt,rn<1e-10)break}}else if(tt=ee(Ge,Ee,ze),!tt)return null;const ut=Te==="robust"?it:ze,{beta:wt,cov:jt,fitted:Ve,residuals:Je}=tt;let st=0,et=0,ft=0;for(let It=0;It<Le;It++){const Vt=ut?ut[It]:1;st+=Vt*Je[It]**2,et+=Vt,ft+=Vt*Ee[It]}const At=ft/et;let Et=0;for(let It=0;It<Le;It++){const Vt=ut?ut[It]:1;Et+=Vt*(Ee[It]-At)**2}const Rt=Le-Ue,xt=st/Rt,Ft=Et===0?1:Math.max(0,Math.min(1,1-st/Et)),Ht=1-(1-Ft)*(Le-1)/Rt,qe=Array.isArray(we.names)&&we.names.length===xe?we.names:me[0].map((It,Vt)=>`x${Vt+1}`),ct=Qe(we.confidence),pt=Rt>0?x(1-(1-ct)/2,Rt):1/0,Ot=wt.map((It,Vt)=>{const qt=Math.sqrt(Math.max(0,xt*jt[Vt][Vt])),Jt=qt>0?It/qt:It===0?0:1/0,rn=Number.isFinite(Jt)?2*(1-q(Math.abs(Jt),Rt)):0,Gt=Number.isFinite(pt)?pt*qt:null;return{name:Vt===0?"(intercept)":qe[Vt-1],estimate:It,stdError:qt,t:Jt,p:Math.max(0,Math.min(1,rn)),lower:Gt===null?null:It-Gt,upper:Gt===null?null:It+Gt}}),Lt=new Array(Le),$t=new Array(Le);for(let It=0;It<Le;It++){const Vt=ut?ut[It]:1,qt=Math.max(0,Math.min(1,Vt*g(Ge[It],jt)));Lt[It]=qt;const Jt=(1-qt)**2;$t[It]=Jt>0&&xt>0?Je[It]**2/(Ue*xt)*(qt/Jt):null}const kt=me[0].map((It,Vt)=>{if(xe<2)return 1;const qt=se(me,Vt);return qt>=1?1/0:1/(1-qt)});let Dt=null;{const It=Je.map(qt=>qt*qt),Vt=ee(Ge,It,null);if(Vt){const qt=It.reduce((sn,bn)=>sn+bn,0)/Le;let Jt=0,rn=0;for(let sn=0;sn<Le;sn++)Jt+=Vt.residuals[sn]**2,rn+=(It[sn]-qt)**2;const Gt=rn===0?0:Math.max(0,Math.min(1,1-Jt/rn)),nn=Le*Gt,an=K(nn,xe);Dt={statistic:nn,df:xe,p:an,heteroscedastic:an<.05}}}let Wt=null;if(xe===1){const It=me.map((Vt,qt)=>qt).sort((Vt,qt)=>me[Vt][0]-me[qt][0]);Wt={confidence:ct,points:It.map(Vt=>{const qt=Ge[Vt],Jt=Math.sqrt(Math.max(0,xt*g(qt,jt)));return{x:me[Vt][0],yhat:Ve[Vt],lower:Ve[Vt]-pt*Jt,upper:Ve[Vt]+pt*Jt}})}}return{method:Te,coefficients:Ot,r2:Ft,adjR2:Ht,n:Le,df:Rt,sigma2:xt,fitted:Ve,residuals:Je,leverage:Lt,cooksD:$t,vif:kt,heteroscedasticity:Dt,band:Wt,weights:ut?[...ut]:null}}function le(me){const Ee=me.length,we=Array.from({length:Ee},(xe,Ue)=>Ue).sort((xe,Ue)=>me[xe]-me[Ue]),Te=new Float64Array(Ee);let Le=0;for(;Le<Ee;){let xe=Le;for(;xe+1<Ee&&me[we[xe+1]]===me[we[Le]];)xe++;const Ue=(Le+xe)/2+1;for(let ze=Le;ze<=xe;ze++)Te[we[ze]]=Ue;Le=xe+1}return Te}const be=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function Ce(me){const Ee=[.01,.05,.1],we=[be["1%"],be["5%"],be["10%"]];if(me<=we[0]){const xe=(Math.log(Ee[1])-Math.log(Ee[0]))/(we[1]-we[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(Ee[0])+xe*(me-we[0]))))}if(me>=we[2]){const xe=(Math.log(Ee[2])-Math.log(Ee[1]))/(we[2]-we[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(Ee[2])+xe*(me-we[2]))))}const Te=me<we[1]?0:1,Le=(me-we[Te])/(we[Te+1]-we[Te]);return Math.exp(Math.log(Ee[Te])+Le*(Math.log(Ee[Te+1])-Math.log(Ee[Te])))}function Ne(me,Ee,we,Te){const Le=we-Te,xe=Te+3,Ue=new Array(Le),ze=new Array(Le);let Ge=!0,tt=Te;for(let Ve=0;Ve<Le;Ve++){const Je=Te+Ve,st=new Float64Array(xe);st[0]=1,st[1]=Ve+1,st[2]=me[Je];for(let et=1;et<=Te;et++)st[2+et]=Ee[Je-et];for(let et=1;et<xe;et++)Number.isFinite(st[et])||(tt=Math.min(tt,et-3));Ue[Ve]=st,ze[Ve]=Ee[Je],Number.isFinite(ze[Ve])||(Ge=!1)}if(!Ge)return 0;const{xtwx:it,xtwy:ut}=l(Ue,ze,null);let wt=0,jt=1/0;for(let Ve=0;Ve<=tt;Ve++){const Je=Ve+3;if(!(Le>Je))continue;const st=new Array(Je);for(let Ft=0;Ft<Je;Ft++)st[Ft]=it[Ft].slice(0,Je);const et=S(st);if(!et)continue;const ft=k(et,ut.slice(0,Je));let At=0;for(let Ft=0;Ft<Le;Ft++){const Ht=Ue[Ft];let qe=0;for(let ct=0;ct<Je;ct++)qe+=Ht[ct]*ft[ct];At+=(ze[Ft]-qe)**2}const Rt=At/(Le-Je)*(Le-Je);if(!(Rt>0))continue;const xt=Le*Math.log(Rt/Le)+2*Je;xt<jt&&(jt=xt,wt=Ve)}return wt}function he(me,Ee={}){const we=[];for(let jt=0;jt<me.length;jt++){const Ve=Number(me[jt]);Number.isFinite(Ve)&&we.push(Ve)}const Te=we.length,Le=Te-1;if(Te<8||Le<6)return null;const xe=new Array(Le);for(let jt=0;jt<Le;jt++)xe[jt]=we[jt+1]-we[jt];let Ue=Number.isFinite(Ee.maxlag)?Math.floor(Ee.maxlag):Math.ceil(12*(Te/100)**.25);Ue=Math.max(0,Math.min(Ue,Math.floor((Le-5)/2)));const ze=(jt,Ve)=>{const Je=[],st=[];for(let et=Ve;et<Le;et++){const ft=[et-Ve+1,we[et]];for(let At=1;At<=jt;At++)ft.push(xe[et-At]);Je.push(ft),st.push(xe[et])}return de(Je,st,{method:"ols"})},Ge=Ne(we,xe,Le,Ue),tt=ze(Ge,Ge);if(!tt||!tt.coefficients[2])return null;const it=tt.coefficients[2].t,ut=Ce(it),wt=it<be["5%"];return{statistic:it,usedLag:Ge,nobs:Le-Ge,criticalValues:{...be},pValue:ut,pApproximate:!0,stationary:wt,verdict:wt?"stationary":"non-stationary",regression:"ct"}}function ie(me,Ee={}){const we=[];for(let wt=0;wt<me.length;wt++){const jt=Number(me[wt]);Number.isFinite(jt)&&we.push(jt)}const Te=we.length;if(Te<3)return null;let Le=Number.isFinite(Ee.maxlag)?Math.floor(Ee.maxlag):Math.min(10,Te-1);Le=Math.max(1,Math.min(Le,Te-1));let xe=0;for(const wt of we)xe+=wt;xe/=Te;const Ue=we.map(wt=>wt-xe);let ze=0;for(const wt of Ue)ze+=wt*wt;ze/=Te;const Ge=new Array(Le+1).fill(0);Ge[0]=1;for(let wt=1;wt<=Le;wt++){let jt=0;for(let Ve=wt;Ve<Te;Ve++)jt+=Ue[Ve]*Ue[Ve-wt];Ge[wt]=ze>0?jt/Te/ze:0}const tt=new Array(Le+1).fill(0);tt[0]=1;let it=[];for(let wt=1;wt<=Le;wt++){let jt=Ge[wt];for(let et=1;et<wt;et++)jt-=it[et-1]*Ge[wt-et];let Ve=1;for(let et=1;et<wt;et++)Ve-=it[et-1]*Ge[et];const Je=Ve!==0?jt/Ve:0,st=new Array(wt);for(let et=1;et<wt;et++)st[et-1]=it[et-1]-Je*it[wt-1-et];st[wt-1]=Je,tt[wt]=Je,it=st}const ut=1.96/Math.sqrt(Te);return{acf:Ge,pacf:tt,bounds:{upper:ut,lower:-ut},n:Te,nlags:Le,approximate:!0}}function ue(me,Ee,we){const{xs:Te,ys:Le,n:xe}=B(me,Ee,we);if(xe<2)return null;const Ue=le(Te),ze=le(Le);let Ge=0,tt=0;for(let jt=0;jt<xe;jt++)Ge+=Ue[jt],tt+=ze[jt];Ge/=xe,tt/=xe;let it=0,ut=0,wt=0;for(let jt=0;jt<xe;jt++){const Ve=Ue[jt]-Ge,Je=ze[jt]-tt;it+=Ve*Je,ut+=Ve*Ve,wt+=Je*Je}return ut===0||wt===0?null:Math.max(-1,Math.min(1,it/Math.sqrt(ut*wt)))}function ge(me,Ee,we){const{xs:Te,ys:Le,n:xe}=B(me,Ee,we);if(xe<2||xe>o)return null;let Ue=0,ze=0,Ge=0,tt=0;for(let wt=0;wt<xe;wt++)for(let jt=wt+1;jt<xe;jt++){const Ve=Math.sign(Te[wt]-Te[jt]),Je=Math.sign(Le[wt]-Le[jt]),st=Ve*Je;st>0?Ue++:st<0?ze++:Ve===0&&Je===0||(Ve===0?Ge++:tt++)}const it=Ue+ze+tt,ut=Ue+ze+Ge;return it===0||ut===0?null:(Ue-ze)/Math.sqrt(it*ut)}function pe(me,Ee={}){const we=me.length;if(we<2)return null;const Te=me[0],Le=me[we-1],xe=[];for(let et=1;et<we;et++){const ft=me[et-1];ft!==0&&xe.push((me[et]-ft)/Math.abs(ft))}let Ue=null;if(xe.length>1){let et=0;for(const At of xe)et+=At;et/=xe.length;let ft=0;for(const At of xe)ft+=(At-et)**2;Ue=Math.sqrt(ft/(xe.length-1))}const ze=Number(Ee.periodsPerYear)>0?Number(Ee.periodsPerYear):null;let Ge=me[0],tt=0,it=0,ut=0,wt=0;for(let et=1;et<we;et++){if(me[et]>Ge){Ge=me[et],tt=et;continue}if(Ge<=0)continue;const ft=(Ge-me[et])/Ge;ft>it&&(it=ft,ut=tt,wt=et)}let jt=null;if(we>2){let et=0;for(let Et=0;Et<we;Et++)et+=me[Et];et/=we;let ft=0,At=0;for(let Et=0;Et<we;Et++){const Rt=me[Et]-et;At+=Rt*Rt,Et>0&&(ft+=Rt*(me[Et-1]-et))}jt=At>0?ft/At:null}let Ve=0,Je=0;for(const et of xe)et>0?Ve++:et<0&&Je++;let st=null;if(Te>0&&Le>0){const et=(Le/Te)**(1/(we-1))-1;st=ze?(1+et)**ze-1:et}return{n:we,first:Te,last:Le,change:Le-Te,changePercent:Te===0?null:(Le-Te)/Math.abs(Te)*100,volatility:Ue,annualisedVolatility:Ue!==null&&ze?Ue*Math.sqrt(ze):null,growth:st,maxDrawdown:it,maxDrawdownFrom:ut,maxDrawdownTo:wt,autocorrelation:jt,upDays:Ve,downDays:Je}}const Oe=1.128,ve=3.267;function ye(me){const Ee=me.length;if(Ee<2)return null;const we=[];for(let Le=1;Le<Ee;Le++)we.push(Math.abs(me[Le]-me[Le-1]));const Te=we.reduce((Le,xe)=>Le+xe,0)/we.length;return{ranges:we,centre:Te,upper:ve*Te,lower:0}}function Ae(me){const Ee=me.length;if(Ee<2)return null;let we=0;for(let Le=1;Le<Ee;Le++)we+=Math.abs(me[Le]-me[Le-1]);const Te=we/(Ee-1);return{sigma:Te/Oe,meanRange:Te}}function Me(me,Ee){const we=me.length;if(we<2||!Ee)return null;const Te=Number.isFinite(Number(Ee.lower))?Number(Ee.lower):null,Le=Number.isFinite(Number(Ee.upper))?Number(Ee.upper):null;if(Te===null&&Le===null)return null;let xe=0;for(let Ve=0;Ve<we;Ve++)xe+=me[Ve];xe/=we;let Ue=0;for(let Ve=0;Ve<we;Ve++)Ue+=(me[Ve]-xe)**2;const ze=Math.sqrt(Ue/(we-1)),Ge=Ae(me),tt=Ge?Ge.sigma:null,it=Ve=>{if(!Ve||Ve<=0)return{index:null,k:null};const st=Te!==null&&Le!==null?(Le-Te)/(6*Ve):null,et=Le!==null?(Le-xe)/(3*Ve):1/0,ft=Te!==null?(xe-Te)/(3*Ve):1/0;return{index:st,k:Math.min(et,ft)}},ut=it(tt),wt=it(ze);let jt=0;for(let Ve=0;Ve<we;Ve++){if(Te!==null&&me[Ve]<Te){jt++;continue}Le!==null&&me[Ve]>Le&&jt++}return{n:we,mean:xe,lower:Te,upper:Le,target:Number.isFinite(Number(Ee.target))?Number(Ee.target):null,sigmaWithin:tt,sigmaOverall:ze,cp:ut.index,cpk:ut.k,pp:wt.index,ppk:wt.k,outOfSpec:jt,defectRate:we?jt/we:null}}function je(me){const Ee=me.length;if(Ee<2)return null;const we=Ae(me);if(!we||!(we.sigma>0))return null;let Te=0;for(let Le=0;Le<Ee;Le++)Te+=me[Le];return Te/=Ee,{centre:Te,sigma:we.sigma,upper:Te+3*we.sigma,lower:Te-3*we.sigma}}function _e(me,Ee){if(!Ee||!(Ee.sigma>0))return[];const we=me.length,{centre:Te,sigma:Le}=Ee,xe=ze=>(me[ze]-Te)/Le,Ue=[];for(let ze=0;ze<we;ze++){if(Math.abs(xe(ze))>3&&Ue.push({index:ze,rule:1,description:"beyond three sigma"}),ze>=2)for(const Ge of[1,-1]){let tt=0;for(let it=ze-2;it<=ze;it++)xe(it)*Ge>2&&tt++;if(tt>=2){Ue.push({index:ze,rule:2,description:"two of three past two sigma"});break}}if(ze>=4)for(const Ge of[1,-1]){let tt=0;for(let it=ze-4;it<=ze;it++)xe(it)*Ge>1&&tt++;if(tt>=4){Ue.push({index:ze,rule:3,description:"four of five past one sigma"});break}}if(ze>=7)for(const Ge of[1,-1]){let tt=!0;for(let it=ze-7;it<=ze;it++)if(xe(it)*Ge<=0){tt=!1;break}if(tt){Ue.push({index:ze,rule:4,description:"eight in a row on one side"});break}}}return Ue}function Pe(me,Ee){if(!Ee||!(Ee.sigma>0))return[];const we=me.length,{centre:Te,sigma:Le}=Ee,xe=Ge=>(me[Ge]-Te)/Le,Ue=(Ge,tt,it,ut)=>{for(const wt of[1,-1]){let jt=0;for(let Ve=Ge;Ve<=tt;Ve++)xe(Ve)*wt>it&&jt++;if(jt>=ut)return!0}return!1},ze=[];for(let Ge=0;Ge<we;Ge++){if(Math.abs(xe(Ge))>3&&ze.push({index:Ge,rule:1,description:"beyond three sigma"}),Ge>=8)for(const tt of[1,-1]){let it=!0;for(let ut=Ge-8;ut<=Ge;ut++)if(xe(ut)*tt<=0){it=!1;break}if(it){ze.push({index:Ge,rule:2,description:"nine in a row on one side"});break}}if(Ge>=5)for(const tt of[1,-1]){let it=!0;for(let ut=Ge-4;ut<=Ge;ut++)if((me[ut]-me[ut-1])*tt<=0){it=!1;break}if(it){ze.push({index:Ge,rule:3,description:tt>0?"six rising":"six falling"});break}}if(Ge>=13){let tt=!0;for(let it=Ge-12;it<=Ge;it++){const ut=me[it]-me[it-1],wt=me[it+1<=Ge?it+1:it]-me[it];if(it+1>Ge)break;if(ut===0||wt===0||ut>0==wt>0){tt=!1;break}}tt&&ze.push({index:Ge,rule:4,description:"fourteen alternating"})}if(Ge>=2&&Ue(Ge-2,Ge,2,2)&&ze.push({index:Ge,rule:5,description:"two of three past two sigma"}),Ge>=4&&Ue(Ge-4,Ge,1,4)&&ze.push({index:Ge,rule:6,description:"four of five past one sigma"}),Ge>=14){let tt=!0;for(let it=Ge-14;it<=Ge;it++)if(Math.abs(xe(it))>=1){tt=!1;break}tt&&ze.push({index:Ge,rule:7,description:"fifteen within one sigma"})}if(Ge>=7){let tt=!0;for(let it=Ge-7;it<=Ge;it++)if(Math.abs(xe(it))<=1){tt=!1;break}tt&&ze.push({index:Ge,rule:8,description:"eight beyond one sigma"})}}return ze}const Se=Object.freeze(["westernElectric","nelson"]);function Fe(me,Ee,we="westernElectric"){return String(we)==="nelson"?Pe(me,Ee):_e(me,Ee)}function We(me,Ee,we){let Te=0;for(let Le=0;Le<me.length;Le++)(me[Le]<Ee||me[Le]>we)&&Te++;return Te}function He(me,Ee,we,Te=20){const Le=me.length;if(!Le)return[];const xe=me[0],Ue=me[Le-1];if(Ue===xe)return[{from:xe,to:Ue,count:Le}];const ze=we-Ee,Ge=1.5*ze;let tt=ze>0?Math.max(xe,Ee-Ge):xe,it=ze>0?Math.min(Ue,we+Ge):Ue;it>tt||(tt=xe,it=Ue);const ut=ze>0?2*ze/Math.cbrt(Le):(it-tt)/(Math.ceil(Math.log2(Le))+1),wt=ut>0?Math.min(Te,Math.max(1,Math.ceil((it-tt)/ut))):1,jt=(it-tt)/wt,Ve=[];for(let Je=0;Je<wt;Je++)Ve.push({from:tt+Je*jt,to:tt+(Je+1)*jt,count:0});for(let Je=0;Je<Le;Je++){const st=Math.min(wt-1,Math.max(0,Math.floor((me[Je]-tt)/jt)));Ve[st].count++}return Ve[0].from=xe,Ve[wt-1].to=Ue,Ve}const Ye=.95;function Qe(me){const Ee=Number(me);return Number.isFinite(Ee)&&Ee>0&&Ee<1?Ee:Ye}function lt(me,Ee=Ye){const we=me.length;if(we<2)return null;let Te=0;for(let it=0;it<we;it++)Te+=me[it];const Le=Te/we;let xe=0;for(let it=0;it<we;it++){const ut=me[it]-Le;xe+=ut*ut}const Ue=Math.sqrt(xe/(we-1)),ze=Qe(Ee),tt=x(1-(1-ze)/2,we-1)*Ue/Math.sqrt(we);return{mean:Le,lower:Le-tt,upper:Le+tt,margin:tt,n:we,confidence:ze}}function ot(me,Ee,we=Ye){const Te=Number(me),Le=Number(Ee);if(!(Le>0)||!(Te>=0)||Te>Le)return null;const xe=Qe(we),Ue=W(1-(1-xe)/2),ze=Te/Le,Ge=Ue*Ue,tt=1+Ge/Le,it=(ze+Ge/(2*Le))/tt,ut=Ue/tt*Math.sqrt(ze*(1-ze)/Le+Ge/(4*Le*Le));return{proportion:ze,lower:Math.max(0,it-ut),upper:Math.min(1,it+ut),n:Le,confidence:xe}}function yt(me,Ee=Ye){if(!me||!(me.n>2)||!Number.isFinite(me.stdError))return null;const we=Qe(Ee),Le=x(1-(1-we)/2,me.n-2)*me.stdError;return{slope:me.slope,lower:me.slope-Le,upper:me.slope+Le,margin:Le,confidence:we}}function Ct(me,Ee,we=Ye){const Te=Number(me),Le=Number(Ee);if(!Number.isFinite(Te)||!(Le>1))return null;const xe=Qe(we),ze=W(1-(1-xe)/2)*Math.sqrt(1/(9*Le)+Te*Te/(2*(Le-1)));return{index:Te,lower:Te-ze,upper:Te+ze,margin:ze,n:Le,confidence:xe}}function Nt(me,Ee){return!me||!(me.sd>0)||!Number.isFinite(Ee)||!Number.isFinite(me.mean)?null:(Ee-me.mean)/me.sd}function dt(me){return Number.isFinite(me)?Math.min(1,Math.max(0,2*I(Math.abs(me)/2)-1)):0}function at(me,Ee){const we=new Map,Te=G(me);let Le=0;for(let xe=0;xe<Ee.length;xe++){const Ue=Te(Ee[xe]);if(Ue==null||Ue===""||typeof Ue=="number"&&Number.isNaN(Ue))continue;const ze=Ue instanceof Date?Ue.getTime():typeof Ue=="object"?String(Ue):Ue;we.set(ze,(we.get(ze)||0)+1),Le++}return{map:we,total:Le}}function bt(me,Ee,we,Te){if(!(Ee>0)||!(Te>0))return null;let Le=0;const xe=new Set(me.keys());for(const Ue of we.keys())xe.add(Ue);for(const Ue of xe){const ze=(me.get(Ue)||0)/Ee,Ge=(we.get(Ue)||0)/Te;Le+=Math.abs(ze-Ge)}return Le/2}const Tt=10;function ht(me,Ee,we){if(we&&we.numeric){const ze=m(me,Ee),{n:Ge,mean:tt}=h(ze),it=Ge>0?Nt({mean:we.mean,sd:we.sd},tt):null;return{measure:"standardizedMeanDifference",magnitude:it,distance:it===null?0:dt(it),direction:it===null?0:Math.sign(it),subsetN:Ge,populationN:we.n||0,reliable:Ge>=Tt}}const{map:Le,total:xe}=at(me,Ee),Ue=bt(Le,xe,we.map,we.total);return{measure:"categoricalTotalVariation",magnitude:Ue,distance:Ue===null?0:Ue,direction:0,subsetN:xe,populationN:we.total||0,reliable:xe>=Tt}}function ke(me,Ee){if(me&&(me.kind==="float64"||me.kind==="int32"))return!0;const we=G(me);let Te=0,Le=0;for(let xe=0;xe<Ee.length&&Te<200;xe++){const Ue=we(Ee[xe]);if(Ue==null||Ue==="")continue;if(Ue instanceof Date)return!1;Te++;const ze=typeof Ue=="number"?Ue:Number(Ue);Number.isFinite(ze)&&Le++}return Te===0?!1:Le/Te>=.9}function $e(me,Ee){if(ke(me,Ee)){const Le=m(me,Ee),{n:xe,mean:Ue,m2:ze}=h(Le);return{numeric:!0,mean:Ue,sd:xe>0?Math.sqrt(ze/xe):0,n:xe}}const{map:we,total:Te}=at(me,Ee);return{numeric:!1,map:we,total:Te}}}),Be("packages/core/src/compute/total.js",function(e,D){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"aggregatesFor",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"aggregateAllowed",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return h}});const M=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce,x=D("packages/core/src/compute/handle.js"),q=x.presenceReader,W=x.valueComparator,I=x.valueReader,K=D("packages/core/src/compute/statistics.js"),R=K.STAT_FNS,S=K.STAT_LABELS;function k(w){return!!w&&(w.kind==="float64"||w.kind==="int32")}function y(w,v){const A=v.length;let _=0;if(k(w)){const Y=w.values,$=q(w);if(!$){for(let j=0;j<A;j++){const E=Y[v[j]];Number.isNaN(E)||(_+=E)}return _}for(let j=0;j<A;j++){const E=v[j];if($(E)===1){const O=Y[E];Number.isNaN(O)||(_+=O)}}return _}const V=I(w);for(let Y=0;Y<A;Y++){const $=m(V(v[Y]));$!==null&&(_+=$)}return _}y.kernel=!0;function l(w,v){const A=v.length;let _=0;if(k(w)){const Y=w.values,$=q(w);if(!$){for(let j=0;j<A;j++)Number.isNaN(Y[v[j]])||_++;return _}for(let j=0;j<A;j++){const E=v[j];$(E)===1&&!Number.isNaN(Y[E])&&_++}return _}const V=I(w);for(let Y=0;Y<A;Y++){const $=V(v[Y]);$!=null&&!(typeof $=="number"&&Number.isNaN($))&&_++}return _}l.kernel=!0;function g(w,v){return v.length}g.kernel=!0;function i(w,v){const A=l(w,v);return A===0?null:y(w,v)/A}i.kernel=!0;function t(w,v,A,_){const V=v.length;if(k(w)){const E=w.values,O=q(w);let N=null;if(!O){for(let T=0;T<V;T++){const C=E[v[T]];Number.isNaN(C)||(N===null||(A<0?C<N:C>N))&&(N=C)}return N}for(let T=0;T<V;T++){const C=v[T];if(O(C)===0)continue;const B=E[C];Number.isNaN(B)||(N===null||(A<0?B<N:B>N))&&(N=B)}return N}const Y=I(w),$=W(_);let j=null;for(let E=0;E<V;E++){const O=Y(v[E]);O==null||typeof O=="number"&&Number.isNaN(O)||(j===null||(A<0?$(O,j)<0:$(O,j)>0))&&(j=O)}return j}function o(w,v,A){return t(w,v,-1,A&&A.locale)}o.kernel=!0;function c(w,v,A){return t(w,v,1,A&&A.locale)}c.kernel=!0;function f(w,v){return v.length===0?null:I(w)(v[0])}f.kernel=!0;function n(w,v){return v.length===0?null:I(w)(v[v.length-1])}n.kernel=!0;function m(w){if(typeof w=="number")return Number.isNaN(w)?null:w;if(w==null||w===""||typeof w=="boolean")return null;if(w instanceof Date)return w.getTime();const v=Number(w);return Number.isNaN(v)?null:v}const r={sum:y,min:o,max:c,avg:i,count:g,first:f,last:n,countValues:l,...R},s=Object.freeze({...S,sum:"Sum",avg:"Average",min:"Min",max:"Max",count:"Count",countValues:"Count of values",first:"First",last:"Last"});function d(w){return w?typeof w=="string"?s[w]||w:"Total":""}const p=Object.freeze(["sum","avg","min","max","count","countValues","first","last"]);function u(w){const v=w&&w.dataType&&w.dataType.totals&&w.dataType.totals.supported;if(Array.isArray(v))return v.slice();const A=p.filter(_=>_ in r);for(const _ of Object.keys(r))A.includes(_)||A.push(_);return A}function b(w,v){return typeof v!="string"?!0:u(w).includes(v)}function a(w,v){const A=I(w),_=[];for(let V=0;V<v.length;V++){const Y=A(v[V]);Y!=null&&_.push(Y)}return _}function h(w,v,A,_){const V=v||[];if(typeof A=="string"){const Y=r[A];return Y?Y(w,V,_):(F(`total:${A}`,`unknown total function "${A}"; register it in config.totalFns`),null)}return M(A)?A.kernel===!0?A(w,V,_):A(a(w,V),_||{}):null}}),Be("packages/core/src/compute/windowed.js",function(e,D){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return q}});const M=D("packages/core/src/compute/sketch.js").Welford;class G{#e;#t;#n=[];#r;#i;constructor(I,K=0,R=Date.now){if(I!=="count"&&I!=="time"&&I!=="session")throw new RangeError(`unknown window kind: ${I}`);if((I==="count"||I==="time")&&!(K>0))throw new RangeError(`a ${I} window needs a positive span`);this.#e=I,this.#t=Math.floor(K),this.#r=R,this.#i=R()}get size(){return this.#n.length}push(I,K=this.#r()){Number.isFinite(I)&&(this.#n.push({t:K,v:I}),this.#s(K))}#s(I){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const K=I-this.#t;for(;this.#n.length&&this.#n[0].t<K;)this.#n.shift()}}spec(){const I=this.#e==="session"?this.#r()-this.#i:this.#t;return{kind:this.#e,span:I,size:this.#n.length}}values(){return this.#n.map(I=>I.v)}aggregate(){const I=this.spec();if(!this.#n.length)return{over:I,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const K=new M;let R=0,S=1/0,k=-1/0;for(const{v:y}of this.#n)R+=y,y<S&&(S=y),y>k&&(k=y),K.add(y);return{over:I,count:this.#n.length,sum:R,mean:K.mean(),min:S,max:k,variance:K.variance(),stddev:K.stddev()}}reduce(I){const K=this.aggregate(),R={sum:K.sum,avg:K.mean,mean:K.mean,min:K.min,max:K.max,count:K.count,variance:K.variance,stddev:K.stddev};if(!(I in R))throw new RangeError(`unknown windowed aggregate: ${I}`);return{value:R[I],over:K.over}}}const F=Object.freeze(["count","time","session"]);function x(W,I=Date.now){const K=W.kind==="time"&&W.minutes!=null?W.minutes*6e4:W.span??0;return new G(W.kind,K,I)}const q={Window:G,WINDOW_KINDS:F,openWindow:x}}),Be("packages/core/src/compute/rolling.js",function(e,D){"use strict";Object.defineProperty(e,"ROLLING_WINDOW_FIELDS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"rollingWindow",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"rollingQuantile",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"seasonalDecompose",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"exponentialSmoothing",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return m}});const M=D("packages/core/src/compute/windowed.js").openWindow,F=D("packages/core/src/compute/sketch.js").KLL,x=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function q(r,s,d,p){if(r.kind==="count"){const u=Math.max(1,Math.floor(r.span||0));return{coverage:Math.min(1,s/u),partial:s<u}}if(r.kind==="time"){const u=r.minutes!=null?r.minutes*6e4:r.span||0;if(!(u>0))return{coverage:1,partial:!1};const b=d-p;return{coverage:Math.min(1,b/u),partial:b<u}}return{coverage:null,partial:!1}}function W(r,s){const d=M(s),p=new Map,u=r.length?r[0].at:0;for(let b=0;b<r.length;b++){const{key:a,at:h,value:w}=r[b];Number.isFinite(w)&&d.push(w,h);const v=d.aggregate(),A=q(s,v.count,h,u);a!=null&&p.set(String(a),{sum:v.sum,avg:v.mean,min:v.min,max:v.max,count:v.count,coverage:A.coverage,partial:A.partial})}return p}function I(r){const s=new Map;let d=0;for(const{key:p,value:u}of r)Number.isFinite(u)&&(d+=u),p!=null&&s.set(String(p),d);return s}function K(r,s=1){const d=new Map,p=Math.max(1,Math.floor(s));for(let u=0;u<r.length;u++){const{key:b,value:a}=r[u];if(b==null)continue;const h=u>=p?r[u-p].value:null,w=Number.isFinite(a)?a:null,v=Number.isFinite(h)?h:null;d.set(String(b),w!==null&&v!==null?w-v:null)}return d}const R=4096;function S(r){let s=r>>>0;return()=>{s+=1831565813;let d=s;return d=Math.imul(d^d>>>15,d|1),d^=d+Math.imul(d^d>>>7,d|61),((d^d>>>14)>>>0)/4294967296}}function k(r,s){const d=r.length;if(d===1)return r[0];const p=(d-1)*s,u=Math.floor(p),b=Math.ceil(p);return u===b?r[u]:r[u]+(p-u)*(r[b]-r[u])}function y(r,s,d={}){const p=Math.min(1,Math.max(0,d.q==null?.5:d.q)),u=Math.max(1,Math.floor(d.cap==null?R:d.cap)),b=S(d.seed==null?2654435769:d.seed),a=new Map,h=r.length?r[0].at:0;if(s.kind==="session"){const v=new F(200,b);let A=0;for(const{key:_,value:V}of r)Number.isFinite(V)&&(v.add(V),A++),_!=null&&a.set(String(_),{value:A?v.quantile(p):null,approx:A>0,count:A,coverage:null,partial:!1});return a}const w=M(s);for(const{key:v,at:A,value:_}of r){Number.isFinite(_)&&w.push(_,A);const V=w.values(),Y=V.length;let $=null,j=!1;if(Y)if(Y<=u)$=k([...V].sort((O,N)=>O-N),p);else{const O=new F(200,b);for(const N of V)O.add(N);$=O.quantile(p),j=!0}const E=q(s,Y,A,h);v!=null&&a.set(String(v),{value:$,approx:j,count:Y,coverage:E.coverage,partial:E.partial})}return a}function l(r,s){const d=r.length,p=new Array(d).fill(null),u=Math.floor(s/2),b=s%2===0;for(let a=0;a<d;a++){if(a-u<0||a+u>=d)continue;let h=0,w=!0;if(b)for(let v=-u;v<=u;v++){const A=r[a+v];if(!Number.isFinite(A)){w=!1;break}h+=v===-u||v===u?A*.5:A}else for(let v=-u;v<=u;v++){const A=r[a+v];if(!Number.isFinite(A)){w=!1;break}h+=A}w&&(p[a]=h/s)}return p}function g(r,s){const d=new Map,p=Math.floor(Number(s&&s.period));if(!(p>=2))return d;const u=s&&s.model==="multiplicative",b=r.length,a=r.map(j=>Number.isFinite(j.value)?j.value:null),h=l(a,p),w=new Array(b).fill(null);for(let j=0;j<b;j++){const E=h[j],O=a[j];E===null||O===null||(u?E!==0&&(w[j]=O/E):w[j]=O-E)}const v=new Array(p).fill(0),A=new Array(p).fill(0);for(let j=0;j<b;j++){if(w[j]===null)continue;const E=j%p;v[E]+=w[j],A[E]+=1}const _=u?1:0,V=v.map((j,E)=>A[E]?j/A[E]:_),Y=V.reduce((j,E)=>j+E,0)/p,$=u?V.map(j=>Y!==0?j/Y:1):V.map(j=>j-Y);for(let j=0;j<b;j++){const{key:E}=r[j];if(E==null)continue;const O=h[j],N=$[j%p],T=a[j];let C=null;O!==null&&T!==null&&(C=u?O*N!==0?T/(O*N):null:T-O-N),d.set(String(E),{trend:O,seasonal:T===null?null:N,residual:C,coverage:O===null?0:1,partial:O===null})}return d}function i(r,s,d,p=80){const u=(Math.sqrt(5)-1)/2;let b=s,a=d,h=a-u*(a-b),w=b+u*(a-b),v=r(h),A=r(w);for(let _=0;_<p;_++)v<A?(a=w,w=h,A=v,h=a-u*(a-b),v=r(h)):(b=h,h=w,v=A,w=b+u*(a-b),A=r(w));return(b+a)/2}const t=1e-4,o=1-1e-4;function c(r,s){const d=r.length,p=new Array(d).fill(null),u=new Array(d).fill(null);let b=null,a=0;for(let h=0;h<d;h++){const w=r[h];if(!Number.isFinite(w)){b!==null&&(u[h]=b,p[h]=b);continue}if(b===null){b=w,u[h]=w,p[h]=w;continue}u[h]=b,a+=(w-b)**2,b=s*w+(1-s)*b,p[h]=b}return{smoothed:p,fitted:u,sse:a}}function f(r,s,d){const p=r.length,u=new Array(p).fill(null),b=new Array(p).fill(null);let a=null,h=null,w=0;for(let v=0;v<p;v++){const A=r[v];if(!Number.isFinite(A)){a!==null&&(a+=h,u[v]=a);continue}if(a===null){a=A,u[v]=A;continue}if(h===null){h=A-a;const Y=a+h;b[v]=Y,w+=(A-Y)**2;const $=a;a=s*A+(1-s)*($+h),h=d*(a-$)+(1-d)*h,u[v]=a;continue}const _=a+h;b[v]=_,w+=(A-_)**2;const V=a;a=s*A+(1-s)*(V+h),h=d*(a-V)+(1-d)*h,u[v]=a}return{smoothed:u,fitted:b,sse:w}}function n(r,s={}){const d=new Map,p=s.method==="holt",u=r.map(_=>Number.isFinite(_.value)?_.value:null),b=u.filter(_=>_!==null).length,a=_=>Math.min(o,Math.max(t,_)),h=()=>{for(const{key:_}of r)_!=null&&d.set(String(_),{smoothed:null,fitted:null,alpha:null,beta:null,sse:null});return d};if(b<(p?2:1))return h();let w=Number.isFinite(s.alpha)?a(s.alpha):null,v=p&&Number.isFinite(s.beta)?a(s.beta):null;if(p){if(w===null||v===null){let _=w===null?.5:w,V=v===null?.5:v;for(let Y=0;Y<6;Y++)w===null&&(_=i($=>f(u,$,V).sse,t,o)),v===null&&(V=i($=>f(u,_,$).sse,t,o));w=w===null?_:w,v=v===null?V:v}}else w===null&&(w=i(_=>c(u,_).sse,t,o));const A=p?f(u,w,v):c(u,w);for(let _=0;_<r.length;_++){const{key:V}=r[_];V!=null&&d.set(String(V),{smoothed:A.smoothed[_],fitted:A.fitted[_],alpha:w,beta:p?v:null,sse:A.sse})}return d}const m={ROLLING_WINDOW_FIELDS:x,QUANTILE_SPAN_CAP:R,rollingWindow:W,rollingQuantile:y,cumulativeToDate:I,periodOverPeriod:K,seasonalDecompose:g,exponentialSmoothing:n}}),Be("packages/core/src/compute/cluster.js",function(e,D){"use strict";Object.defineProperty(e,"CLUSTER_ROW_CAP",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"DBSCAN_ROW_CAP",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"DEFAULT_K",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"DEFAULT_MIN_POINTS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"orderByCentre",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"kmeans",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"dbscan",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"autoK",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"standardise",{enumerable:!0,get:function(){return t}});const re=1e5,M=2e4,G=3,F=5,x=100;function q(o){let c=o>>>0;return function(){c=c+1831565813|0;let n=Math.imul(c^c>>>15,1|c);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}function W(o,c){let f=0;for(let n=0;n<o.length;n++){const m=o[n]-c[n];f+=m*m}return f}function I(o,c){return Math.sqrt(W(o,c))}function K(o,c){let f=-1,n=1/0;for(let m=0;m<c.length;m++){const r=W(o,c[m]);r<n&&(n=r,f=m)}return f}function R(o,c,f){const n=q(f),m=o.length,r=[Array.from(o[Math.floor(n()*m)])],s=new Float64Array(m).fill(1/0);for(let d=1;d<c;d++){let p=0;for(let h=0;h<m;h++){const w=W(o[h],r[r.length-1]);w<s[h]&&(s[h]=w),p+=s[h]}const u=n()*(p||m);let b=0,a=m-1;for(let h=0;h<m;h++)if(b+=p?s[h]:1,b>=u){a=h;break}r.push(Array.from(o[a]))}return r}function S(o,c){for(let f=0;f<o.length;f++){const n=o[f]-c[f];if(n!==0)return n}return 0}function k(o,c,f,n){const m=c.map((s,d)=>({centre:s,i:d})).sort((s,d)=>S(s.centre,d.centre)),r=new Int32Array(c.length);for(let s=0;s<m.length;s++)r[m[s].i]=s;for(let s=0;s<o.length;s++)o[s]>=0&&(o[s]=r[o[s]]);return{assignments:o,centres:m.map(s=>s.centre),sizes:m.map(s=>f[s.i]),distances:n}}function y(o,c={}){const f=o.length,n=f?o[0].length:0,m=Math.floor(c.k||G);if(!(f>=m)||m<1||n<1)return null;let r=R(o,m,c.seed===void 0?1:c.seed);const s=new Int32Array(f);let d=!0;for(let a=0;a<x&&d;a++){d=!1;for(let v=0;v<f;v++){const A=K(o[v],r);s[v]!==A&&(s[v]=A,d=!0)}const h=r.map(()=>new Float64Array(n)),w=new Array(m).fill(0);for(let v=0;v<f;v++){const A=s[v];for(let _=0;_<n;_++)h[A][_]+=o[v][_];w[A]++}for(let v=0;v<m;v++)if(w[v])for(let A=0;A<n;A++)r[v][A]=h[v][A]/w[v];else{let A=0,_=-1/0;for(let V=0;V<f;V++){const Y=W(o[V],r[v]);Y>_&&(_=Y,A=V)}r[v]=Array.from(o[A]),d=!0}}const p=new Array(m).fill(0),u=new Float64Array(f);let b=0;for(let a=0;a<f;a++){const h=s[a];p[h]++;const w=W(o[a],r[h]);u[a]=Math.sqrt(w),b+=w}return{assignments:s,centres:r,sizes:p,inertia:b,distances:u}}function l(o,c={}){const f=o.length,n=f?o[0].length:0,m=Number(c.eps),r=Math.max(1,Math.floor(c.minPoints||F));if(!(m>0)||f===0||n<1)return null;const s=new Array(f);for(let w=0;w<f;w++){const v=[];for(let A=0;A<f;A++)w!==A&&I(o[w],o[A])<=m&&v.push(A);s[w]=v}const d=new Int32Array(f).fill(-1);let p=0;for(let w=0;w<f;w++){if(d[w]!==-1||s[w].length<r)continue;d[w]=p;const v=[...s[w]];for(let A=0;A<v.length;A++){const _=v[A];d[_]===-1&&(d[_]=p,s[_].length>=r&&v.push(...s[_]))}p++}if(!p)return{assignments:d,centres:[],sizes:[],distances:new Float64Array(f).fill(NaN)};const u=[],b=new Array(p).fill(0),a=Array.from({length:p},()=>new Float64Array(n));for(let w=0;w<f;w++){const v=d[w];if(!(v<0)){b[v]++;for(let A=0;A<n;A++)a[v][A]+=o[w][A]}}for(let w=0;w<p;w++){const v=new Array(n);for(let A=0;A<n;A++)v[A]=a[w][A]/b[w];u.push(v)}const h=new Float64Array(f).fill(NaN);for(let w=0;w<f;w++){const v=d[w];v>=0&&(h[w]=I(o[w],u[v]))}return{assignments:d,centres:u,sizes:b,distances:h}}function g(o,c,f){const n=o.length;if(n===0)return 0;const m=new Int32Array(f);for(let s=0;s<n;s++)m[c[s]]++;let r=0;for(let s=0;s<n;s++){const d=c[s],p=new Float64Array(f);for(let a=0;a<n;a++)s!==a&&(p[c[a]]+=I(o[s],o[a]));const u=m[d]>1?p[d]/(m[d]-1):0;let b=1/0;for(let a=0;a<f;a++){if(a===d||m[a]===0)continue;const h=p[a]/m[a];h<b&&(b=h)}b!==1/0&&(r+=(b-u)/Math.max(u,b))}return r/n}function i(o,c={}){const f=o.length;if(!f)return null;const n=c.criterion==="silhouette"?"silhouette":"elbow",m=Math.max(2,Math.floor(c.maxK||8)),r=c.seed===void 0?1:c.seed;if(n==="silhouette"){const w=[],v=[];for(let _=2;_<=Math.min(m,f);_++){const V=y(o,{k:_,seed:r});V&&(w.push(_),v.push(g(o,V.assignments,_)))}if(!w.length)return null;let A=0;for(let _=1;_<v.length;_++)v[_]>v[A]&&(A=_);return{k:w[A],criterion:n,scores:v,ks:w}}const s=[],d=[];for(let w=1;w<=Math.min(m,f);w++){const v=y(o,{k:w,seed:r});v&&(s.push(w),d.push(v.inertia))}if(d.length<2)return null;const p={k:s[0],y:d[0]},u={k:s[s.length-1],y:d[d.length-1]},b=Math.hypot(u.k-p.k,u.y-p.y)||1;let a=0,h=-1/0;for(let w=0;w<d.length;w++){const v=Math.abs((u.k-p.k)*(p.y-d[w])-(p.k-s[w])*(u.y-p.y))/b;v>h&&(h=v,a=w)}return{k:s[a],criterion:n,scores:d,ks:s}}function t(o){const c=o.length,f=c?o[0].length:0;if(!c||!f)return null;const n=new Array(f).fill(0);for(let r=0;r<c;r++)for(let s=0;s<f;s++)n[s]+=o[r][s];for(let r=0;r<f;r++)n[r]/=c;const m=new Array(f).fill(0);for(let r=0;r<c;r++)for(let s=0;s<f;s++){const d=o[r][s]-n[s];m[s]+=d*d}for(let r=0;r<f;r++)m[r]=c>1?Math.sqrt(m[r]/(c-1)):0;for(let r=0;r<c;r++)for(let s=0;s<f;s++)m[s]>0?o[r][s]=(o[r][s]-n[s])/m[s]:o[r][s]=o[r][s]-n[s];return{mean:n,sd:m}}}),Be("packages/core/src/compute/compare.js",function(e,D){"use strict";Object.defineProperty(e,"COMPARE_MEASURES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"pooledStandardMeanDifference",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"numericSummary",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"bothNumeric",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"compareColumnAcross",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"compareDatasets",{enumerable:!0,get:function(){return l}});const re=D("packages/core/src/compute/statistics.js"),M=re.numbers,G=re.moments,F=re.frequencyMap,x=re.categoricalDistance,q=re.normalTotalVariation,W=re.isNumericColumn,I=re.SUBSET_RELIABILITY_FLOOR,K=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function R(g,i){if(!g||!i||!(g.n>0)||!(i.n>0)||!Number.isFinite(g.mean)||!Number.isFinite(i.mean))return null;const t=(g.n*g.sd*g.sd+i.n*i.sd*i.sd)/(g.n+i.n);return t>0?(g.mean-i.mean)/Math.sqrt(t):null}function S(g,i){const t=M(g,i),{n:o,mean:c,m2:f}=G(t),n=o>0?Math.sqrt(f/o):0;return{mean:c,sd:n,n:o}}function k(g,i,t,o){return W(g,i)&&W(t,o)}function y(g,i,t,o){if(k(g,i,t,o)){const m=S(g,i),r=S(t,o),s=R(m,r);return{measure:K.numeric,magnitude:s,distance:s===null?0:q(s),direction:s===null?0:Math.sign(s),nA:m.n,nB:r.n,meanA:m.mean,meanB:r.mean,reliable:m.n>=I&&r.n>=I}}const c=F(g,i),f=F(t,o),n=x(c.map,c.total,f.map,f.total);return{measure:K.categorical,magnitude:n,distance:n===null?0:n,direction:0,nA:c.total,nB:f.total,meanA:null,meanB:null,reliable:c.total>=I&&f.total>=I}}function l(g,i,t={}){const o=new Set(g.columns),c=new Set(i.columns),f=g.columns.filter(d=>c.has(d)),n=Array.isArray(t.columns)&&t.columns.length?f.filter(d=>t.columns.includes(d)):f,m=g.indices(),r=i.indices(),s=[];for(const d of n){const p=g.handle(d),u=i.handle(d);if(!p||!u)continue;const b=y(p,m,u,r);s.push({column:d,name:g.name&&g.name(d)||i.name&&i.name(d)||d,measure:b.measure,magnitude:b.magnitude,distance:b.distance,direction:b.direction,nA:b.nA,nB:b.nB,meanA:b.meanA,meanB:b.meanB,reliable:b.reliable})}return s.sort((d,p)=>p.distance-d.distance||Math.abs(p.magnitude||0)-Math.abs(d.magnitude||0)),{ranked:s,nA:m.length,nB:r.length,unmatched:{onlyA:g.columns.filter(d=>!c.has(d)),onlyB:i.columns.filter(d=>!o.has(d))},measures:K}}}),Be("packages/core/src/compute/anomaly.js",function(e,D){"use strict";Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DEFAULT_MODIFIED_Z_THRESHOLD",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return m}});const M=D("packages/core/src/compute/statistics.js").quantileSorted,F=D("packages/core/src/compute/special.js").logGamma,x=.6745,q=3.5,W=1.5,I=.975,K=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function R(r){if(!r.length)return null;const d=Array.from(r,Number).sort((a,h)=>a-h),p=M(d,.5),u=d.map(a=>Math.abs(a-p)).sort((a,h)=>a-h),b=M(u,.5);return{median:p,mad:b}}function S(r,s={}){const d=Number.isFinite(s.threshold)?s.threshold:q,p=r.length,u=new Array(p).fill(null),b=new Array(p).fill(!1),a=[];for(let v=0;v<p;v++){const A=Number(r[v]);Number.isFinite(A)&&a.push(A)}if(!a.length)return{median:null,mad:null,threshold:d,scores:u,flags:b,flagged:0};const h=R(a);if(h.mad===0)return{median:h.median,mad:0,threshold:d,scores:u,flags:b,flagged:0};let w=0;for(let v=0;v<p;v++){const A=Number(r[v]);if(!Number.isFinite(A))continue;const _=x*(A-h.median)/h.mad;u[v]=_,Math.abs(_)>d&&(b[v]=!0,w++)}return{median:h.median,mad:h.mad,threshold:d,scores:u,flags:b,flagged:w}}function k(r,s={}){const d=Number.isFinite(s.k)?s.k:W,p=[];for(let w=0;w<r.length;w++){const v=Number(r[w]);Number.isFinite(v)&&p.push(v)}if(!p.length)return null;const u=p.sort((w,v)=>w-v),b=M(u,.25),a=M(u,.75),h=a-b;return{q1:b,q3:a,iqr:h,lower:b-d*h,upper:a+d*h,k:d}}function y(r,s){if(s<=0)return 0;const d=F(r);if(s<r+1){let v=r,A=1/r,_=A;for(let V=0;V<1e3&&(v+=1,_*=s/v,A+=_,!(Math.abs(_)<Math.abs(A)*1e-15));V++);return A*Math.exp(-s+r*Math.log(s)-d)}const p=1e-300;let u=s+1-r,b=1/p,a=1/u,h=a;for(let v=1;v<1e3;v++){const A=-v*(v-r);u+=2,a=A*a+u,Math.abs(a)<p&&(a=p),b=u+A/b,Math.abs(b)<p&&(b=p),a=1/a;const _=a*b;if(h*=_,Math.abs(_-1)<1e-15)break}return 1-Math.exp(-s+r*Math.log(s)-d)*h}function l(r,s){return r<=0?0:y(s/2,r/2)}function g(r,s=I){if(!(s>0)||!(s<1))return NaN;let d=0,p=Math.max(1,r);for(;l(p,r)<s;)p*=2;for(let u=0;u<200;u++){const b=(d+p)/2;if(l(b,r)<s?d=b:p=b,p-d<1e-10)break}return(d+p)/2}function i(r){const s=r.length,d=r.map((p,u)=>{const b=p.slice();for(let a=0;a<s;a++)b.push(u===a?1:0);return b});for(let p=0;p<s;p++){let u=p;for(let a=p+1;a<s;a++)Math.abs(d[a][p])>Math.abs(d[u][p])&&(u=a);if(Math.abs(d[u][p])<1e-12)return null;if(u!==p){const a=d[u];d[u]=d[p],d[p]=a}const b=d[p][p];for(let a=0;a<2*s;a++)d[p][a]/=b;for(let a=0;a<s;a++){if(a===p)continue;const h=d[a][p];if(h!==0)for(let w=0;w<2*s;w++)d[a][w]-=h*d[p][w]}}return d.map(p=>p.slice(s))}function t(r,s){const d=r.length,p=new Array(s).fill(0);for(const a of r)for(let h=0;h<s;h++)p[h]+=a[h];for(let a=0;a<s;a++)p[a]/=d;const u=Array.from({length:s},()=>new Array(s).fill(0));for(const a of r)for(let h=0;h<s;h++){const w=a[h]-p[h];for(let v=h;v<s;v++)u[h][v]+=w*(a[v]-p[v])}const b=d>1?d-1:1;for(let a=0;a<s;a++)for(let h=a;h<s;h++)u[a][h]/=b,u[h][a]=u[a][h];return{mean:p,cov:u}}function o(r,s={}){const d=Number.isFinite(s.p)?s.p:I,p=Number.isFinite(s.ridge)?s.ridge:1e-6,u=r.length;if(!u)return null;const b=r[0].length;if(!b)return null;const a=new Array(u).fill(null),h=new Array(u).fill(null),w=new Array(u).fill(!1),v=[],A=[];for(let N=0;N<u;N++){const T=r[N];let C=T.length===b;const B=new Array(b);for(let z=0;C&&z<b;z++){const X=Number(T[z]);Number.isFinite(X)?B[z]=X:C=!1}C&&(v.push(N),A.push(B))}const _=b,V=g(_,d);if(A.length<=b)return{center:[],df:_,cutoff:V,singular:!0,used:A.length,distances:a,squared:h,flags:w,flagged:0};const{mean:Y,cov:$}=t(A,b);let j=i($),E=!1;if(!j){E=!0;let N=0;for(let B=0;B<b;B++)N+=$[B][B];const T=N/b*p||p,C=$.map((B,z)=>B.map((X,Q)=>z===Q?X+T:X));if(j=i(C),!j)return{center:Y,df:_,cutoff:V,singular:!0,used:A.length,distances:a,squared:h,flags:w,flagged:0}}let O=0;for(let N=0;N<A.length;N++){const T=A[N],C=new Array(b);for(let X=0;X<b;X++)C[X]=T[X]-Y[X];let B=0;for(let X=0;X<b;X++){let Q=0;for(let H=0;H<b;H++)Q+=j[X][H]*C[H];B+=C[X]*Q}B<0&&(B=0);const z=v[N];h[z]=B,a[z]=Math.sqrt(B),B>V&&(w[z]=!0,O++)}return{center:Y,df:_,cutoff:V,singular:E,used:A.length,distances:a,squared:h,flags:w,flagged:O}}const c=20,f=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function n(r,s={}){const d=s.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",p=Number.isFinite(s.windowLen)&&s.windowLen>=1?Math.floor(s.windowLen):c,u=Number.isFinite(s.threshold)?s.threshold:q,b=Number.isFinite(s.k)?s.k:W,a=Number.isFinite(s.minPeriods)&&s.minPeriods>=1?Math.floor(s.minPeriods):p,h=r.length,w=new Array(h).fill(null),v=new Array(h).fill(!1);let A=0;for(let _=0;_<h;_++){const V=Number(r[_]);if(!Number.isFinite(V))continue;const Y=Math.max(0,_-p+1),$=[];for(let j=Y;j<=_;j++){const E=Number(r[j]);Number.isFinite(E)&&$.push(E)}if(!($.length<a))if(d==="rollingIqr"){const j=k($,{k:b});if(!j)continue;(V<j.lower||V>j.upper)&&(v[_]=!0,A++)}else{const j=R($);if(!j||j.mad===0)continue;const E=x*(V-j.median)/j.mad;w[_]=E,Math.abs(E)>u&&(v[_]=!0,A++)}}return{method:d,windowLen:p,minPeriods:a,threshold:u,k:b,scores:w,flags:v,flagged:A}}function m(r={}){const s=r||{},d=s.field;if(typeof d!="string"||!d)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const p=s.method||"modifiedZScore";if(!(K.includes(p)||f.includes(p))||p==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${p}'`);const b=typeof s.orderBy=="string"?s.orderBy:null,a=s.latest===!0,h=f.includes(p),w=v=>Number(v==null?NaN:v[d]);return v=>{const A=Array.isArray(v)?v.slice():[...v];b&&A.sort((j,E)=>{const O=j?.[b],N=E?.[b];return O===N?0:O==null?-1:N==null?1:O<N?-1:1});const _=A.map(w);let V,Y;if(h)({flags:V,scores:Y}=n(_,{method:p,windowLen:s.windowLen,threshold:s.threshold,k:s.k,minPeriods:s.minPeriods}));else if(p==="iqr"){const j=k(_,{k:s.k});V=_.map(E=>j?Number.isFinite(E)&&(E<j.lower||E>j.upper):!1),Y=_.map(()=>null)}else({flags:V,scores:Y}=S(_,{threshold:s.threshold}));if(a){const j=V.length-1;return j<0||!V[j]?!1:{method:p,field:d,flagged:[{row:A[j],score:Y[j]}]}}const $=[];for(let j=0;j<V.length;j++)V[j]&&$.push({row:A[j],score:Y[j]});return $.length?{method:p,field:d,flagged:$}:!1}}}),Be("packages/core/src/compute/forecast.js",function(e,D){"use strict";Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r}});const re=D("packages/core/src/compute/special.js"),M=re.normalQuantile,G=re.studentTQuantile,x=D("packages/core/src/internal/warn.js").warnOnce,q=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),W=1e-4,I=1-1e-4;function K(s){const d=[];for(let p=0;p<s.length;p++){const u=s[p];if(u!==null&&typeof u=="object"){const b=Number.isFinite(u.at)?u.at:p,a=Number.isFinite(u.value)?u.value:null;d.push({at:b,value:a})}else d.push({at:p,value:Number.isFinite(u)?Number(u):null})}return d}function R(s){const d=s.filter(h=>h.value!==null),p=d[0],u=d[d.length-1],b=u.at-p.at,a=d.length>1&&b>0?b/(d.length-1):1;return{lastAt:u.at,step:a}}function S(s){return Math.min(I,Math.max(W,s))}function k(s,d=W,p=I,u=80){const b=(Math.sqrt(5)-1)/2;let a=d,h=p,w=h-b*(h-a),v=a+b*(h-a),A=s(w),_=s(v);for(let V=0;V<u;V++)A<_?(h=v,v=w,_=A,w=h-b*(h-a),A=s(w)):(a=w,w=v,A=_,v=a+b*(h-a),_=s(v));return(a+h)/2}function y(s,d){let p=null,u=0,b=0;for(let a=0;a<s.length;a++){const h=s[a];if(h!==null){if(p===null){p=h;continue}u+=(h-p)**2,b+=1,p=d*h+(1-d)*p}}return{level:p,sse:u,m:b}}function l(s,d,p){let u=null,b=null,a=0,h=0;for(let w=0;w<s.length;w++){const v=s[w];if(v===null){u!==null&&b!==null&&(u+=b);continue}if(u===null){u=v;continue}b===null&&(b=v-u);const A=u+b;a+=(v-A)**2,h+=1;const _=u;u=d*v+(1-d)*(_+b),b=p*(u-_)+(1-p)*b}return{level:u,trend:b,sse:a,m:h}}function g(s,d,p,u,b){const a=s.length;if(a<2*d)return null;const h=E=>{let O=0,N=0;for(let T=E;T<E+d&&T<a;T++)s[T]!==null&&(O+=s[T],N+=1);return N?O/N:null},w=h(0),v=h(d);if(w===null||v===null)return null;let A=w,_=(v-w)/d;const V=new Array(d).fill(0);for(let E=0;E<d;E++)V[E]=s[E]===null?0:s[E]-A;const Y=V.reduce((E,O)=>E+O,0)/d;for(let E=0;E<d;E++)V[E]-=Y;let $=0,j=0;for(let E=d;E<a;E++){const O=E%d,N=V[O],T=s[E];if(T===null){A+=_;continue}const C=A+_+N;$+=(T-C)**2,j+=1;const B=A;A=p*(T-N)+(1-p)*(A+_),_=u*(A-B)+(1-u)*_,V[O]=b*(T-A)+(1-b)*N}return{level:A,trend:_,season:V,phase:(a-1)%d,sse:$,count:j}}function i(s,d,p){let u=1;for(const a of d)u+=a*a;const b=Math.sqrt(s*u);return{se:b,margin:p*b}}function t(s,d={}){if(!s||typeof s.length!="number"||s.length===0)return null;const p=q.includes(d.method)?d.method:"linear",u=Math.max(1,Math.floor(Number(d.horizon)||1)),b=Number.isFinite(d.confidence)&&d.confidence>0&&d.confidence<1?d.confidence:.95,a=1-(1-b)/2,h=K(s),w=h.map($=>$.value),v=w.filter($=>$!==null),A=v.length,{lastAt:_,step:V}=A?R(h):{lastAt:0,step:1},Y=$=>_+$*V;return p==="linear"?o(h,A,u,b,a,Y):p==="movingAverage"?c(v,A,u,b,a,d,Y):p==="ses"?f(w,A,u,b,a,d,Y):p==="holt"?n(w,A,u,b,a,d,Y):m(w,A,u,b,a,d,Y)}function o(s,d,p,u,b,a){if(d<2)return null;let h=0,w=0;for(const T of s)T.value!==null&&(h+=T.at,w+=T.value);h/=d,w/=d;let v=0,A=0,_=0;for(const T of s){if(T.value===null)continue;const C=T.at-h,B=T.value-w;v+=C*C,A+=C*B,_+=B*B}if(v===0)return null;const V=A/v,Y=w-V*h,$=_===0?1:Math.max(0,Math.min(1,A*A/(v*_))),j=Math.max(0,_-V*A),E=d>2?Math.sqrt(j/(d-2)):null,O=d>2?G(b,d-2):null,N=[];for(let T=1;T<=p;T++){const C=a(T),B=Y+V*C;let z=null,X=null,Q=null,H=null,L=null;if(E!==null){const Z=1/d+(C-h)**2/v,ee=E*Math.sqrt(1+Z),te=E*Math.sqrt(Z);L=ee,z=B-O*ee,X=B+O*ee,Q=B-O*te,H=B+O*te}N.push({step:T,at:C,mean:B,lower:z,upper:X,lowerMean:Q,upperMean:H,se:L})}return{method:"linear",horizon:p,confidence:u,n:d,sigma:E,r2:$,params:{slope:V,intercept:Y},points:N}}function c(s,d,p,u,b,a,h){if(d<1)return null;const w=Math.max(1,Math.min(d,Math.floor(Number(a.windowLen)||d))),v=s.slice(d-w);let A=0;for(const E of v)A+=E;const _=A/w;let V=null,Y=null;if(w>1){let E=0;for(const N of v)E+=(N-_)**2;V=Math.sqrt(E/(w-1))*Math.sqrt(1+1/w),Y=G(b,w-1)}const $=V===null?null:Y*V,j=[];for(let E=1;E<=p;E++)j.push({step:E,at:h(E),mean:_,lower:$===null?null:_-$,upper:$===null?null:_+$,se:V});return{method:"movingAverage",horizon:p,confidence:u,n:d,sigma:V===null?null:V,params:{windowLen:w},points:j}}function f(s,d,p,u,b,a,h){if(d<1)return null;let w=Number.isFinite(a.alpha)?S(a.alpha):null;w===null&&(w=k(Y=>y(s,Y).sse));const v=y(s,w),A=M(b),_=v.m>0?v.sse/v.m:null,V=[];for(let Y=1;Y<=p;Y++){const $=v.level;let j=null,E=null,O=null;if(_!==null){const N=[];for(let C=1;C<Y;C++)N.push(w);const T=i(_,N,A);O=T.se,j=$-T.margin,E=$+T.margin}V.push({step:Y,at:h(Y),mean:$,lower:j,upper:E,se:O})}return{method:"ses",horizon:p,confidence:u,n:d,sigma:_===null?null:Math.sqrt(_),params:{alpha:w},points:V}}function n(s,d,p,u,b,a,h){if(d<2)return null;let w=Number.isFinite(a.alpha)?S(a.alpha):null,v=Number.isFinite(a.beta)?S(a.beta):null;if(w===null||v===null){let j=w===null?.5:w,E=v===null?.5:v;for(let O=0;O<6;O++)w===null&&(j=k(N=>l(s,N,E).sse)),v===null&&(E=k(N=>l(s,j,N).sse));w=w===null?j:w,v=v===null?E:v}const A=l(s,w,v),_=M(b),V=A.m>0?A.sse/A.m:null,Y=w*v,$=[];for(let j=1;j<=p;j++){const E=A.level+j*A.trend;let O=null,N=null,T=null;if(V!==null){const C=[];for(let z=1;z<j;z++)C.push(w+z*Y);const B=i(V,C,_);T=B.se,O=E-B.margin,N=E+B.margin}$.push({step:j,at:h(j),mean:E,lower:O,upper:N,se:T})}return{method:"holt",horizon:p,confidence:u,n:d,sigma:V===null?null:Math.sqrt(V),params:{alpha:w,beta:v},points:$}}function m(s,d,p,u,b,a,h){const w=Math.floor(Number(a.period));if(!(w>=2))return x("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(d<2*w)return null;let v=Number.isFinite(a.alpha)?S(a.alpha):null,A=Number.isFinite(a.beta)?S(a.beta):null,_=Number.isFinite(a.gamma)?S(a.gamma):null;const V=(T,C,B)=>{const z=g(s,w,T,C,B);return z?z.sse:1/0};if(v===null||A===null||_===null){let T=v===null?.5:v,C=A===null?.5:A,B=_===null?.5:_;for(let z=0;z<8;z++)v===null&&(T=k(X=>V(X,C,B))),A===null&&(C=k(X=>V(T,X,B))),_===null&&(B=k(X=>V(T,C,X)));v=v===null?T:v,A=A===null?C:A,_=_===null?B:_}const Y=g(s,w,v,A,_);if(!Y)return null;const $=M(b),j=Y.count>0?Y.sse/Y.count:null,E=v*A,O=_*(1-v),N=[];for(let T=1;T<=p;T++){const C=Y.season[(Y.phase+T)%w],B=Y.level+T*Y.trend+C;let z=null,X=null,Q=null;if(j!==null){const H=[];for(let Z=1;Z<T;Z++)H.push(v+Z*E+(Z%w===0?O:0));const L=i(j,H,$);Q=L.se,z=B-L.margin,X=B+L.margin}N.push({step:T,at:h(T),mean:B,lower:z,upper:X,se:Q})}return{method:"holtWinters",horizon:p,confidence:u,n:d,sigma:j===null?null:Math.sqrt(j),params:{alpha:v,beta:A,gamma:_,period:w},points:N}}const r={FORECAST_METHODS:q,forecast:t}}),Be("packages/core/src/compute/hypothesis.js",function(e,D){"use strict";Object.defineProperty(e,"GROUP_TESTS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"NORMALITY_ALPHA",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"HL_PAIR_LIMIT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"welchTTest",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"mannWhitneyUTest",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"chiSquareTest",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return $}});const M=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/compute/handle.js").valueReader,x=D("packages/core/src/compute/statistics.js"),q=x.numbers,W=x.moments,I=x.frequencyMap,K=x.categoricalDistance,R=x.isNumericColumn,S=x.jarqueBera,k=x.proportionInterval,y=x.SUBSET_RELIABILITY_FLOOR,g=D("packages/core/src/compute/compare.js").pooledStandardMeanDifference,i=D("packages/core/src/compute/special.js"),t=i.studentT,o=i.studentTQuantile,c=i.normalCdf,f=i.normalQuantile,n=i.chiSquareUpperTail,m=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),r=.05,s=2e6;function d(j){const E=Number(j);return Number.isFinite(E)&&E>0&&E<1?E:.95}function p(j){const{n:E,mean:O,m2:N}=W(j);return{mean:O,sd:E>0?Math.sqrt(N/E):0,n:E}}function u(j,E){const O=j.length;if(O<2)return 0;let N=0;for(let T=0;T<O;T++){const C=j[T]-E;N+=C*C}return N/(O-1)}function b(j,E){return{name:"pooledStandardMeanDifference",value:g(p(j),p(E))}}function a(j,E,O){const N=j.length,T=E.length;if(N<2||T<2)return null;const C=d(O),{mean:B}=W(j),{mean:z}=W(E),X=u(j,B),Q=u(E,z),H=X/N+Q/T;if(!(H>0))return null;const L=Math.sqrt(H),Z=(B-z)/L,ee=X/N*(X/N)/(N-1),te=Q/T*(Q/T)/(T-1),se=H*H/(ee+te),ne=Math.min(1,Math.max(0,2*(1-t(Math.abs(Z),se)))),ae=B-z,de=o(1-(1-C)/2,se)*L;return{test:m.WELCH,statistic:Z,statisticName:"t",df:se,pValue:ne,interval:{estimate:ae,lower:ae-de,upper:ae+de,confidence:C,method:"welch-t (difference of means)"},effectSize:b(j,E),nA:N,nB:T,reliable:N>=y&&T>=y,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function h(j){const E=j.length;if(E===0)return Number.NaN;const O=E>>1;return E%2?j[O]:(j[O-1]+j[O])/2}function w(j,E,O){const N=j.length,T=E.length,C=N*T;if(C===0||C>s)return null;const B=new Float64Array(C);let z=0;for(let ee=0;ee<N;ee++)for(let te=0;te<T;te++)B[z++]=j[ee]-E[te];B.sort();const X=h(B),Q=Math.sqrt(N*T*(N+T+1)/12),H=f(1-(1-O)/2);let L=Math.round(C/2-H*Q);L>=0||(L=0);const Z=Math.floor((C-1)/2);return L>Z&&(L=Z),{estimate:X,lower:B[L],upper:B[C-1-L],confidence:O,method:"hodges-lehmann (normal approximation)"}}function v(j,E,O){const N=j.length,T=E.length;if(N<1||T<1)return null;const C=d(O),B=N+T,z=new Array(B);for(let ne=0;ne<N;ne++)z[ne]={v:j[ne],g:0};for(let ne=0;ne<T;ne++)z[N+ne]={v:E[ne],g:1};z.sort((ne,ae)=>ne.v-ae.v);let X=0,Q=0,H=0;for(;H<B;){let ne=H;for(;ne<B&&z[ne].v===z[H].v;)ne++;const ae=ne-H,de=(H+1+ne)/2;for(let le=H;le<ne;le++)z[le].g===0&&(X+=de);Q+=ae*ae*ae-ae,H=ne}const L=X-N*(N+1)/2,Z=N*T/2,ee=N*T/12*(B+1-Q/(B*(B-1)));let te=1;if(ee>0){const ne=Math.max(0,Math.abs(L-Z)-.5);te=Math.min(1,2*c(-ne/Math.sqrt(ee)))}const se=w(j,E,C);return{test:m.MANN_WHITNEY,statistic:L,statisticName:"U",df:null,pValue:te,interval:se,effectSize:b(j,E),nA:N,nB:T,reliable:N>=y&&T>=y,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function A(j,E,O,N,T){const C=k(j,E,T),B=k(O,N,T);if(!C||!B)return null;const z=C.proportion-B.proportion,X=z-Math.sqrt((C.proportion-C.lower)**2+(B.upper-B.proportion)**2),Q=z+Math.sqrt((C.upper-C.proportion)**2+(B.proportion-B.lower)**2);return{lower:X,upper:Q}}function _(j,E,O,N,T,C={}){if(!(E>0)||!(N>0))return null;const B=new Set([...j.keys(),...O.keys()]),z=B.size;if(z<2)return null;const X=E+N;let Q=0;for(const te of B){const se=j.get(te)||0,ne=O.get(te)||0,ae=se+ne,de=E*ae/X,le=N*ae/X;de>0&&(Q+=(se-de)*(se-de)/de),le>0&&(Q+=(ne-le)*(ne-le)/le)}const H=z-1,L=n(Q,H);let Z=null;C.category!==void 0&&B.has(C.category)?Z=C.category:z===2&&([Z]=[...B]);let ee=null;if(Z!==null){const te=A(j.get(Z)||0,E,O.get(Z)||0,N,d(T));te&&(ee={estimate:(j.get(Z)||0)/E-(O.get(Z)||0)/N,lower:te.lower,upper:te.upper,confidence:d(T),method:"newcombe (difference in this category's share)",category:Z})}return{test:m.CHI_SQUARE,statistic:Q,statisticName:"chiSquare",df:H,pValue:L,interval:ee,effectSize:{name:"categoricalTotalVariation",value:K(j,E,O,N)},nA:E,nB:N,reliable:E>=y&&N>=y,method:"Pearson chi-square test of independence (2×k, no continuity correction)"}}function V(j){return j==null||j===""||typeof j=="number"&&Number.isNaN(j)?null:j instanceof Date?j.getTime():typeof j=="object"?String(j):j}function Y(j,E,O){if(O===m.WELCH||O===m.MANN_WHITNEY)return{test:O,chosenBy:"override",reason:`caller override: ${O}`};const N=S(j),T=S(E),C=N===null?null:Math.exp(-N/2),B=T===null?null:Math.exp(-T/2);return C!==null&&C<r||B!==null&&B<r?{test:m.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${r})`}:{test:m.WELCH,chosenBy:"auto",reason:C!==null||B!==null?"column family: numeric, no departure from normality detected":"column family: numeric (too few rows to screen normality)"}}function $(j,E,O,N={}){if(!j||!E)return null;const T=d(N.confidence),C=F(E);let B;if(Array.isArray(N.groups)&&N.groups.length===2)B=[V(N.groups[0]),V(N.groups[1])];else{const{map:ne}=I(E,O),ae=[...ne.entries()].sort((de,le)=>le[1]-de[1]).slice(0,2).map(de=>de[0]);if(ae.length<2)return M("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;B=ae}const[z,X]=B;if(z===null||X===null||z===X)return M("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const Q=[],H=[];for(let ne=0;ne<O.length;ne++){const ae=V(C(O[ne]));ae===z?Q.push(O[ne]):ae===X&&H.push(O[ne])}if(Q.length===0||H.length===0)return M("compareGroups:empty","[lattice] compareGroups: one of the two groups has no rows in the current set."),null;const L=N.test&&N.test!=="auto"?String(N.test):null,Z=R(j,Q.concat(H));let ee,te,se;if(L===m.CHI_SQUARE||!L&&!Z){te=L?"override":"auto",se=L?"caller override: chiSquare":"column family: categorical";const ne=I(j,Q),ae=I(j,H);ee=_(ne.map,ne.total,ae.map,ae.total,T,{category:N.category})}else{if((L===m.WELCH||L===m.MANN_WHITNEY)&&!Z)return M("compareGroups:numeric-override",`[lattice] compareGroups: ${L} needs a numeric column, but the column is not numeric.`),null;const ne=q(j,Q),ae=q(j,H),de=Y(ne,ae,L);te=de.chosenBy,se=de.reason,ee=de.test===m.MANN_WHITNEY?v(ne,ae,T):a(ne,ae,T)}return ee?{...ee,chosenBy:te,reason:se,groups:[z,X]}:(M("compareGroups:degenerate","[lattice] compareGroups: the chosen test had too little to work with (too few values, or no variation)."),null)}}),Be("packages/core/src/compute/significance.js",function(e,D){"use strict";Object.defineProperty(e,"COMPARE_TESTS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"compare",{enumerable:!0,get:function(){return be}});const M=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/compute/handle.js").valueReader,x=D("packages/core/src/compute/statistics.js"),q=x.numbers,W=x.moments,I=x.frequencyMap,K=x.isNumericColumn,R=x.jarqueBera,S=x.proportionInterval,k=D("packages/core/src/compute/special.js"),y=k.studentT,l=k.studentTQuantile,g=k.normalCdf,i=k.normalQuantile,t=k.chiSquareUpperTail,o=k.incompleteBeta,c=Object.freeze({T:"t",WELCH:"welch",MANN_WHITNEY:"mannWhitney",ANOVA:"anova",KRUSKAL:"kruskal",CHI_SQUARE:"chiSquare",PROPORTIONS:"proportions"}),f=new Set([c.T,c.WELCH,c.MANN_WHITNEY]),n=new Set([c.ANOVA,c.KRUSKAL]),m=new Set([c.CHI_SQUARE,c.PROPORTIONS]),r=.05,s=[.2,.5,.8],d=[.147,.33,.474],p=[.01,.06,.14],u=[[.1,.3,.5],[.07,.21,.35],[.06,.17,.29],[.05,.15,.25]];function b(he){const ie=Number(he);return Number.isFinite(ie)&&ie>0&&ie<1?ie:.05}function a(he){return he==null||he===""||typeof he=="number"&&Number.isNaN(he)?null:he instanceof Date?he.getTime():typeof he=="object"?String(he):he}function h(he,ie){const ue=F(he),ge=[],pe=new Map;for(let Oe=0;Oe<ie.length;Oe++){const ve=a(ue(ie[Oe]));if(ve===null)continue;let ye=pe.get(ve);ye||(ye={value:ve,rows:[]},pe.set(ve,ye),ge.push(ye)),ye.rows.push(ie[Oe])}return ge}function w(he){const{n:ie,mean:ue,m2:ge}=W(he),pe=ie>1?ge/(ie-1):0;return{n:ie,mean:ue,sd:Math.sqrt(pe),variance:pe}}function v(he,ie,ue){if(!(ie>0)||!(ue>0)||!(he>=0)||!Number.isFinite(he))return Number.NaN;if(he===0)return 1;const ge=ie*he/(ie*he+ue);return 1-o(ie/2,ue/2,ge)}function A(he,ie){const ue=Math.abs(he);return Number.isFinite(ue)?ue>=ie[2]?"large":ue>=ie[1]?"medium":ue>=ie[0]?"small":"negligible":"negligible"}function _(he,ie,ue){if(he==="cohensD")return A(ie,s);if(he==="cliffsDelta")return A(ie,d);if(he==="etaSquared")return A(ie,p);const ge=Math.max(1,Math.min(u.length,Math.floor(ue||1)));return A(ie,u[ge-1])}function V(he,ie){if(!(he.n>1)||!(ie.n>1))return null;const ue=((he.n-1)*he.variance+(ie.n-1)*ie.variance)/(he.n+ie.n-2);return ue>0?(he.mean-ie.mean)/Math.sqrt(ue):null}function Y(he,ie){const ue=he.length,ge=ie.length;if(!ue||!ge)return null;const pe=Array.from(ie).sort((ye,Ae)=>ye-Ae);let Oe=0,ve=0;for(let ye=0;ye<ue;ye++){const Ae=he[ye];let Me=0,je=ge;for(;Me<je;){const Fe=Me+je>>1;pe[Fe]<Ae?Me=Fe+1:je=Fe}const _e=Me;let Pe=Me;for(;Pe<ge&&pe[Pe]===Ae;)Pe++;const Se=Pe-Me;Oe+=_e,ve+=ge-Pe}return(Oe-ve)/(ue*ge)}function $(he,ie,ue,ge){const pe=Math.min(ue-1,ge-1);return!(ie>0)||!(pe>0)?null:Math.sqrt(he/(ie*pe))}function j(he){return Number.isFinite(he)?he<.001?"p < 0.001":he>=.995?"p > 0.995":`p = ${he.toFixed(3)}`:"p = —"}function E(he){if(!Number.isFinite(he))return"0";const ie=Math.abs(he);return ie===0?"0":ie>=1e3?String(Math.round(he)):ie>=100?String(Number(he.toFixed(0))):ie>=10?String(Number(he.toFixed(1))):ie>=1?String(Number(he.toFixed(2))):String(Number(he.toPrecision(2)))}const O=new Set(["cohensD","cliffsDelta"]);function N(he){if(he.difference!=null&&Math.abs(he.difference)>=1e-12)return Math.sign(he.difference);const ie=he.effectSize;if(ie&&O.has(ie.name)&&Number.isFinite(ie.value)&&Math.abs(ie.value)>=1e-12)return Math.sign(ie.value);const[ue,ge]=he.groups;return Number.isFinite(ue.mean)&&Number.isFinite(ge.mean)&&ue.mean!==ge.mean?Math.sign(ue.mean-ge.mean):0}function T(he){const ie=he.measureName||"values";return{subject:ie.charAt(0).toUpperCase()+ie.slice(1),be:ie==="values"?"are":"is",name:ie}}function C(he,ie){const ue=ie.unit?` ${ie.unit}`:"",{subject:ge,be:pe}=T(ie),Oe=he.groups[0].label,ve=he.groups[1].label,ye=he.effectSize?he.effectSize.label:"negligible",Ae=he.pValue<he.alpha,Me=Ae?"unlikely to be chance":"consistent with chance";if(!Ae&&ye==="negligible")return`${ge} ${pe} essentially the same for ${Oe} and ${ve} (${j(he.pValue)}); the effect is ${ye}.`;const je=N(he),_e=`the difference is ${Me} (${j(he.pValue)}) and the effect is ${ye}.`;if(je===0)return`${ge} ${pe} different between ${Oe} and ${ve}; ${_e}`;const Pe=je>0?Oe:ve,Se=je>0?ve:Oe,We=he.difference!=null&&Math.abs(he.difference)>=1e-12?` by about ${E(Math.abs(he.difference))}${ue}`:"";return`${ge} ${pe} higher for ${Pe} than for ${Se}${We}; ${_e}`}function B(he,ie){const{name:ue}=T(ie),ge=he.effectSize?he.effectSize.label:"negligible",pe=j(he.pValue);return he.pValue<he.alpha?`The groups differ in ${ue}; the difference is unlikely to be chance (${pe}) and the effect is ${ge}.`:ge==="negligible"?`The groups are essentially the same in ${ue} (${pe}); the effect is ${ge}.`:`The groups show a ${ge} effect in ${ue}, but the difference is consistent with chance (${pe}).`}function z(he,ie){const ue=he.length;if(ue<2)return null;const{mean:ge,m2:pe}=W(he),Oe=pe/(ue-1);if(!(Oe>0))return null;const ve=Math.sqrt(Oe),ye=ve/Math.sqrt(ue),Ae=ge/ye,Me=ue-1,je=Math.min(1,Math.max(0,2*(1-y(Math.abs(Ae),Me)))),_e=l(1-ie/2,Me)*ye,Pe=ge/ve;return{test:c.T,statistic:Ae,statisticName:"t",df:Me,pValue:je,difference:ge,interval:{estimate:ge,lower:ge-_e,upper:ge+_e,confidence:1-ie,method:"paired-t (mean of the pair differences)"},effectSize:{name:"cohensD",label:A(Pe,s),value:Pe}}}function X(he,ie){const ue=Array.from(he).filter(We=>We!==0),ge=ue.length;if(!ge)return null;const pe=Array.from({length:ge},(We,He)=>He).sort((We,He)=>Math.abs(ue[We])-Math.abs(ue[He])),Oe=new Array(ge);let ve=0;for(;ve<ge;){let We=ve;for(;We+1<ge&&Math.abs(ue[pe[We+1]])===Math.abs(ue[pe[ve]]);)We++;const He=(ve+We)/2+1;for(let Ye=ve;Ye<=We;Ye++)Oe[pe[Ye]]=He;ve=We+1}let ye=0,Ae=0;for(let We=0;We<ge;We++)Ae+=Oe[We],ue[We]>0&&(ye+=Oe[We]);const Me=Ae-ye,je=ge*(ge+1)/4,_e=Math.sqrt(ge*(ge+1)*(2*ge+1)/24),Pe=_e>0?(Math.abs(ye-je)-.5)/_e:0,Se=Math.min(1,Math.max(0,2*g(-Math.max(0,Pe)))),Fe=Ae>0?(ye-Me)/Ae:0;return{test:c.MANN_WHITNEY,statistic:ye,statisticName:"W",df:null,pValue:Se,difference:null,interval:null,effectSize:{name:"cliffsDelta",label:A(Fe,d),value:Fe}}}function Q(he,ie,ue){const ge=w(he),pe=w(ie);if(ge.n<2||pe.n<2)return null;const Oe=((ge.n-1)*ge.variance+(pe.n-1)*pe.variance)/(ge.n+pe.n-2);if(!(Oe>0))return null;const ve=Math.sqrt(Oe*(1/ge.n+1/pe.n)),ye=(ge.mean-pe.mean)/ve,Ae=ge.n+pe.n-2,Me=Math.min(1,Math.max(0,2*(1-y(Math.abs(ye),Ae)))),je=ge.mean-pe.mean,_e=l(1-ue/2,Ae)*ve,Pe=V(ge,pe);return{test:c.T,statistic:ye,statisticName:"t",df:Ae,pValue:Me,difference:je,interval:{estimate:je,lower:je-_e,upper:je+_e,confidence:1-ue,method:"student-t (pooled variance, difference of means)"},effectSize:{name:"cohensD",label:A(Pe,s),value:Pe},summaries:[ge,pe]}}function H(he,ie,ue){const ge=w(he),pe=w(ie);if(ge.n<2||pe.n<2)return null;const Oe=ge.variance/ge.n+pe.variance/pe.n;if(!(Oe>0))return null;const ve=Math.sqrt(Oe),ye=(ge.mean-pe.mean)/ve,Ae=ge.variance/ge.n*(ge.variance/ge.n)/(ge.n-1),Me=pe.variance/pe.n*(pe.variance/pe.n)/(pe.n-1),je=Oe*Oe/(Ae+Me),_e=Math.min(1,Math.max(0,2*(1-y(Math.abs(ye),je)))),Pe=ge.mean-pe.mean,Se=l(1-ue/2,je)*ve,Fe=V(ge,pe);return{test:c.WELCH,statistic:ye,statisticName:"t",df:je,pValue:_e,difference:Pe,interval:{estimate:Pe,lower:Pe-Se,upper:Pe+Se,confidence:1-ue,method:"welch-t (unequal variances, difference of means)"},effectSize:{name:"cohensD",label:A(Fe,s),value:Fe},summaries:[ge,pe]}}function L(he,ie,ue){const ge=he.length,pe=ie.length;if(ge<1||pe<1)return null;const Oe=w(he),ve=w(ie),ye=ge+pe,Ae=new Array(ye);for(let Ye=0;Ye<ge;Ye++)Ae[Ye]={v:he[Ye],g:0};for(let Ye=0;Ye<pe;Ye++)Ae[ge+Ye]={v:ie[Ye],g:1};Ae.sort((Ye,Qe)=>Ye.v-Qe.v);let Me=0,je=0,_e=0;for(;_e<ye;){let Ye=_e;for(;Ye<ye&&Ae[Ye].v===Ae[_e].v;)Ye++;const Qe=(_e+1+Ye)/2;for(let ot=_e;ot<Ye;ot++)Ae[ot].g===0&&(Me+=Qe);const lt=Ye-_e;je+=lt*lt*lt-lt,_e=Ye}const Pe=Me-ge*(ge+1)/2,Se=ge*pe/2,Fe=ge*pe/12*(ye+1-je/(ye*(ye-1)));let We=1;if(Fe>0){const Ye=Math.max(0,Math.abs(Pe-Se)-.5);We=Math.min(1,2*g(-Ye/Math.sqrt(Fe)))}const He=Y(he,ie);return{test:c.MANN_WHITNEY,statistic:Pe,statisticName:"U",df:null,pValue:We,difference:null,interval:Z(he,ie,1-ue),effectSize:{name:"cliffsDelta",label:A(He,d),value:He},summaries:[Oe,ve]}}function Z(he,ie,ue){const ge=he.length,pe=ie.length,Oe=ge*pe;if(Oe===0||Oe>2e6)return null;const ve=new Float64Array(Oe);let ye=0;for(let Fe=0;Fe<ge;Fe++)for(let We=0;We<pe;We++)ve[ye++]=he[Fe]-ie[We];ve.sort();const Ae=Oe>>1,Me=Oe%2?ve[Ae]:(ve[Ae-1]+ve[Ae])/2,je=Math.sqrt(ge*pe*(ge+pe+1)/12),_e=i(1-(1-ue)/2);let Pe=Math.round(Oe/2-_e*je);Pe>=0||(Pe=0);const Se=Math.floor((Oe-1)/2);return Pe>Se&&(Pe=Se),{estimate:Me,lower:ve[Pe],upper:ve[Oe-1-Pe],confidence:ue,method:"hodges-lehmann (location shift)"}}function ee(he,ie){const ue=he.length,ge=he.map(w);if(ge.some(We=>We.n<2))return null;const pe=ge.reduce((We,He)=>We+He.n,0),Oe=ge.reduce((We,He)=>We+He.mean*He.n,0)/pe;let ve=0,ye=0;for(let We=0;We<ue;We++)ve+=ge[We].n*(ge[We].mean-Oe)**2,ye+=(ge[We].n-1)*ge[We].variance;const Ae=ue-1,Me=pe-ue;if(!(ye>0)||Me<1)return null;const je=ve/Ae,_e=ye/Me,Pe=je/_e,Se=Math.min(1,Math.max(0,v(Pe,Ae,Me))),Fe=ve/(ve+ye);return{test:c.ANOVA,statistic:Pe,statisticName:"F",df:{between:Ae,within:Me},pValue:Se,difference:null,interval:null,effectSize:{name:"etaSquared",label:A(Fe,p),value:Fe},summaries:ge}}function te(he,ie){const ue=he.length,ge=he.map(w);if(ue<2)return null;const pe=ge.reduce((He,Ye)=>He+Ye.n,0),Oe=[];for(let He=0;He<ue;He++)for(let Ye=0;Ye<he[He].length;Ye++)Oe.push({v:he[He][Ye],g:He});Oe.sort((He,Ye)=>He.v-Ye.v);const ve=new Array(Oe.length);let ye=0,Ae=0;for(;Ae<Oe.length;){let He=Ae;for(;He<Oe.length&&Oe[He].v===Oe[Ae].v;)He++;const Ye=(Ae+1+He)/2;for(let lt=Ae;lt<He;lt++)ve[lt]=Ye;const Qe=He-Ae;ye+=Qe*Qe*Qe-Qe,Ae=He}const Me=new Array(ue).fill(0);for(let He=0;He<Oe.length;He++)Me[Oe[He].g]+=ve[He];let je=0;for(let He=0;He<ue;He++)je+=Me[He]*Me[He]/ge[He].n;je=12/(pe*(pe+1))*je-3*(pe+1);const _e=1-ye/(pe*pe*pe-pe),Pe=_e>0?je/_e:je,Se=ue-1,Fe=Math.min(1,Math.max(0,t(Pe,Se))),We=(Pe-ue+1)/(pe-ue);return{test:c.KRUSKAL,statistic:Pe,statisticName:"H",df:Se,pValue:Fe,difference:null,interval:null,effectSize:{name:"etaSquared",label:A(We,p),value:Math.max(0,We)},summaries:ge}}function se(he,ie,ue,ge,pe){const Oe=S(he,ie,pe),ve=S(ue,ge,pe);if(!Oe||!ve)return null;const ye=Oe.proportion-ve.proportion,Ae=ye-Math.sqrt((Oe.proportion-Oe.lower)**2+(ve.upper-ve.proportion)**2),Me=ye+Math.sqrt((Oe.upper-Oe.proportion)**2+(ve.proportion-ve.lower)**2);return{estimate:ye,lower:Ae,upper:Me}}function ne(he,ie,ue,ge){const pe=F(ie),Oe=new Set,ve=[];for(const Ye of he){const Qe=new Map;let lt=0;for(const ot of Ye.rows){const yt=a(pe(ot));yt!==null&&(Qe.set(yt,(Qe.get(yt)||0)+1),lt++,Oe.add(yt))}ve.push(Qe),Ye.total=lt}const ye=[...Oe];if(ye.length<2)return null;const Ae=he.reduce((Ye,Qe)=>Ye+Qe.total,0);if(!(Ae>0))return null;let Me=0;for(const Ye of he)for(const Qe of ye){const lt=ve[he.indexOf(Ye)].get(Qe)||0,ot=he.reduce((Ct,Nt)=>Ct+(ve[he.indexOf(Nt)].get(Qe)||0),0),yt=Ye.total*ot/Ae;yt>0&&(Me+=(lt-yt)*(lt-yt)/yt)}const je=he.length,_e=ye.length,Pe=(je-1)*(_e-1),Se=Math.min(1,Math.max(0,t(Me,Pe))),Fe=$(Me,Ae,je,_e);let We=null;if(je===2&&_e===2){const[Ye]=ye,Qe=ve[0].get(Ye)||0,lt=ve[1].get(Ye)||0,ot=se(Qe,he[0].total,lt,he[1].total,ge);ot&&(We={...ot,confidence:ge,method:"newcombe (difference in this category's share)",category:Ye})}const He=he.map((Ye,Qe)=>{const lt={};for(const ot of ye)lt[String(ot)]=(ve[Qe].get(ot)||0)/Ye.total;return lt});return{test:c.CHI_SQUARE,statistic:Me,statisticName:"chiSquare",df:Pe,pValue:Se,difference:null,interval:We,effectSize:{name:"cramersV",label:_("cramersV",Fe,Math.min(je-1,_e-1)),value:Fe},proportions:He}}function ae(he,ie,ue,ge){const pe=F(ie),Oe=new Set;for(const ot of he)for(const yt of ot.rows){const Ct=a(pe(yt));Ct!==null&&Oe.add(Ct)}if(Oe.size!==2)return null;const[ve]=[...Oe],ye=he[0].rows.reduce((ot,yt)=>ot+(a(pe(yt))===ve?1:0),0),Ae=he[1].rows.reduce((ot,yt)=>ot+(a(pe(yt))===ve?1:0),0),Me=he[0].rows.length,je=he[1].rows.length;if(!(Me>0)||!(je>0))return null;const _e=ye/Me,Pe=Ae/je,Se=(ye+Ae)/(Me+je);if(!(Se>0)||!(Se<1))return null;const Fe=Math.sqrt(Se*(1-Se)*(1/Me+1/je)),We=(_e-Pe)/Fe,He=Math.min(1,Math.max(0,2*g(-Math.abs(We)))),Ye=_e-Pe,Qe=se(ye,Me,Ae,je,ge),lt=$(We*We,Me+je,2,2);return{test:c.PROPORTIONS,statistic:We,statisticName:"z",df:null,pValue:He,difference:Ye,interval:Qe?{...Qe,confidence:ge,method:"newcombe (difference in proportions)",category:ve}:null,effectSize:{name:"cramersV",label:_("cramersV",lt,1),value:lt},proportions:[{[String(ve)]:_e},{[String(ve)]:Pe}],focalCategory:ve}}function de(he,ie,ue,ge){if(ue&&f.has(ue))return{test:ue,reason:`caller override: ${ue}`};const pe=R(he),Oe=R(ie),ve=pe===null?null:Math.exp(-pe/2),ye=Oe===null?null:Math.exp(-Oe/2);if(ve!==null&&ve<r||ye!==null&&ye<r)return{test:c.MANN_WHITNEY,reason:"two numeric groups, non-normal by Jarque-Bera"};const Ae=w(he),Me=w(ie);if(Ae.n>=3&&Me.n>=3&&Ae.variance>0&&Me.variance>0){const je=Math.max(Ae.variance,Me.variance)/Math.min(Ae.variance,Me.variance),_e=Ae.variance>=Me.variance?Ae.n-1:Me.n-1,Pe=Ae.variance>=Me.variance?Me.n-1:Ae.n-1;if(2*Math.min(v(je,_e,Pe),1-v(je,_e,Pe))<ge)return{test:c.WELCH,reason:"two numeric groups, unequal variances (F-test)"}}return{test:c.T,reason:ve!==null||ye!==null?"two numeric groups, equal variances and no departure from normality":"two numeric groups (too few rows to screen normality)"}}function le(he,ie){if(ie&&n.has(ie))return{test:ie,reason:`caller override: ${ie}`};for(const ue of he){const ge=R(ue),pe=ge===null?null:Math.exp(-ge/2);if(pe!==null&&pe<r)return{test:c.KRUSKAL,reason:"three or more numeric groups, non-normal by Jarque-Bera"}}return{test:c.ANOVA,reason:"three or more numeric groups, no departure from normality detected"}}function be(he,ie,ue,ge={},pe=null){if(!he||!ie)return null;const Oe=b(ge.alpha),ve=1-Oe,ye=ge.test&&ge.test!=="auto"?String(ge.test):null,Ae=h(ie,ue);if(Ae.length<2)return M("compare:groups",'[lattice] statistics.compare: the "by" column has fewer than two distinct values to group by.'),null;let Me;if(Array.isArray(ge.groups)&&ge.groups.length===2){const Qe=[a(ge.groups[0]),a(ge.groups[1])];if(Qe[0]===null||Qe[1]===null||Qe[0]===Qe[1])return M("compare:distinct","[lattice] statistics.compare: the two groups must be two distinct, present values."),null;if(Me=Ae.filter(lt=>lt.value===Qe[0]||lt.value===Qe[1]),Me.length!==2)return M("compare:empty","[lattice] statistics.compare: one of the two groups has no rows in the current set."),null;Me.sort((lt,ot)=>lt.value===Qe[0]?-1:1)}else Ae.length===2||ye&&f.has(ye)||ye&&m.has(ye)?Me=Ae.slice(0,2):(ye&&n.has(ye),Me=Ae);const _e=K(he,ue),Pe=!!ge.paired&&pe&&Me.length===2&&_e;let Se,Fe,We;if(_e)if(Me.length===2&&!(ye&&n.has(ye))){const Qe=q(he,Me[0].rows),lt=q(he,Me[1].rows);if(Qe.length<3||lt.length<3)return M("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;if(w(Qe).variance===0||w(lt).variance===0)return M("compare:zero-variance","[lattice] statistics.compare: a group has zero variance, so the difference has no scale to test."),null;if(Pe){const yt=Ne(he,pe,Me[0].rows,Me[1].rows);return yt?(Fe=ye?"override":"auto",We=ye?`caller override: ${ye} (paired)`:"two numeric groups, paired",Se=ye===c.MANN_WHITNEY?X(yt.diffs,Oe):z(yt.diffs,Oe),Se?(Se.paired=!0,Se.chosenBy=Fe,Se.reason=We,Se.groups=[{value:Me[0].value,label:String(Me[0].value),n:yt.n},{value:Me[1].value,label:String(Me[1].value),n:yt.n}],Se.alpha=Oe,Se.method=Se.test===c.MANN_WHITNEY?"Wilcoxon signed-rank test (paired)":"Student's paired t-test (difference of pairs)",Se.verdict=C(Se,ge),Se.categorical=!1,Se):(M("compare:degenerate","[lattice] statistics.compare: the paired test had too little to work with."),null)):(M("compare:paired","[lattice] statistics.compare: not enough matched pairs to run a paired test."),null)}const ot=de(Qe,lt,ye,Oe);Fe=ye?"override":"auto",We=ot.reason,ot.test===c.MANN_WHITNEY?Se=L(Qe,lt,Oe):ot.test===c.WELCH?Se=H(Qe,lt,Oe):Se=Q(Qe,lt,Oe),Se&&Se.interval&&Se.difference===null&&(Se.difference=Se.interval.estimate)}else{const Qe=Me.map(ot=>q(he,ot.rows));if(Qe.some(ot=>ot.length<3))return M("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;const lt=le(Qe,ye);Fe=ye?"override":"auto",We=lt.reason,Se=lt.test===c.KRUSKAL?te(Qe,Oe):ee(Qe,Oe)}else if(Me.length===2){const Qe=Ce(he,Me).size===2;if(ye===c.PROPORTIONS||Qe&&!ye)Fe=ye?"override":"auto",We=ye?"caller override: proportions":"categorical measure with two categories (binary)",Se=ae(Me,he,Oe,ve);else if(ye===c.CHI_SQUARE||!Qe&&!ye)Fe=ye?"override":"auto",We=ye?"caller override: chiSquare":`categorical measure with ${Ce(he,Me).size} categories`,Se=ne(Me,he,Oe,ve);else return M("compare:numeric-needed",`[lattice] statistics.compare: ${ye} needs a numeric measure, but the column is categorical.`),null}else Fe=ye?"override":"auto",We=ye?`caller override: ${ye}`:`categorical measure with ${Ce(he,Me).size} categories`,Se=ne(Me,he,Oe,ve);if(!Se)return M("compare:degenerate","[lattice] statistics.compare: the chosen test had too little to work with (too few values, or no variation)."),null;const He=Se.summaries,Ye=Se.proportions;return{test:Se.test,chosenBy:Fe,reason:We,statistic:Se.statistic,statisticName:Se.statisticName,df:Se.df===void 0?null:Se.df,pValue:Se.pValue,alpha:Oe,paired:!1,interval:Se.interval||null,effectSize:Se.effectSize,groups:Me.map((Qe,lt)=>({value:Qe.value,label:String(Qe.value),n:He?He[lt].n:Qe.total,...He?{mean:He[lt].mean,sd:He[lt].sd}:{},...Ye?{proportions:Ye[lt]}:{}})),difference:Se.difference===void 0?null:Se.difference,method:Se.test,categorical:!_e,verdict:Me.length===2?C({...Se,alpha:Oe,groups:[{value:Me[0].value,label:String(Me[0].value),mean:He?He[0].mean:void 0},{value:Me[1].value,label:String(Me[1].value),mean:He?He[1].mean:void 0}],categorical:!_e,difference:Se.difference===void 0?null:Se.difference},ge):B({...Se,alpha:Oe},ge)}}function Ce(he,ie){const ue=F(he),ge=new Set;for(const pe of ie)for(const Oe of pe.rows){const ve=a(ue(Oe));ve!==null&&ge.add(ve)}return ge}function Ne(he,ie,ue,ge){const pe=F(ie),Oe=F(he),ve=new Map;for(const Ae of ge){const Me=a(pe(Ae));Me!==null&&ve.set(Me,Oe(Ae))}const ye=[];for(const Ae of ue){const Me=a(pe(Ae));if(Me===null||!ve.has(Me))continue;const je=Number(Oe(Ae)),_e=Number(ve.get(Me));!Number.isFinite(je)||!Number.isFinite(_e)||ye.push(je-_e)}return ye.length<2?null:{diffs:Float64Array.from(ye),n:ye.length}}}),Be("packages/core/src/columns/detailcolumn.js",function(e,D){"use strict";Object.defineProperty(e,"DETAIL_COLUMN_ID",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"createDetailColumn",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return F}});const re="__lattice_detail",M=36;function G(x){const q=x.config&&x.config.detailColumnWidth||M;return{id:re,field:null,title:"",type:"text",dataType:{base:"text"},nullable:!0,align:"center",generated:!0,control:!0,detailExpander:!0,value:{pure:!0},cell:{render:"detailExpander",align:"center"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:q,min:q,max:q,pin:x.config&&x.config.detailColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(W,I){return!!(I&&I.expanded)},formatValue(){return""}}}const F=G}),Be("packages/core/src/columns/treecolumn.js",function(e,D){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createTreeColumn",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return q}});const M=D("packages/core/src/internal/predicates.js").isFunction,G="__lattice_tree",F=260;function x(W){const I=W.tree||{},K=W.config&&W.config.treeColumnWidth||F,R=!!(W.config&&W.config.treeColumnFlex),S=()=>(W.columns&&M(W.columns.visible)?W.columns.visible():[]).find(g=>!g.generated)||null,k=(l,g)=>{if(g&&g.group)return g.groupValue;if(M(I.label))return I.label(l,g);if(typeof I.label=="string")return l==null?null:l[I.label];const i=S();return i&&M(i.getValue)?i.getValue(l,g):null},y=()=>{if(I.title)return I.title;const l=typeof I.label=="string"?W.columns&&M(W.columns.get)?W.columns.get(I.label):null:S();return l&&(l.title||l.id)||"Hierarchy"};return{id:G,get title(){return y()},field:null,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group",props:{icon:I.icon,iconClass:I.iconClass,content:I.content,checkbox:I.checkbox,onCheck:I.onCheck}},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:R?{flex:1,min:0,pin:W.config&&W.config.treeColumnPin||null,hidden:!1,resizable:!1,movable:!1,lockPosition:!0}:{width:K,min:140,pin:W.config&&W.config.treeColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(l,g){return k(l,g)},formatValue(l,g){if(g&&g.grandTotal)return W.config&&W.config.grandTotalLabel||"Total";if(l==null)return"";if(!I.label){const i=S();if(i&&M(i.formatValue))return i.formatValue(l,g)}return String(l)}}}const q=x}),Be("packages/core/src/columns/pivotcolumns.js",function(e,D){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return x}});const M=D("packages/core/src/internal/warn.js").warnOnce,G="__lattice_pivot",F=500;function x(K){const{pivot:R,valueColumns:S,config:k}=K,y=R&&R.paths||[],l=K.separator||k&&k.pivot&&k.pivot.separator||" | ",g=k&&k.pivot&&k.pivot.maxColumns||F;if(!y.length||!S.length)return{tree:[],leaves:[],error:null};const i=q(k),t=y.length*S.length+(i?S.length:0);if(t>g){const f=`pivot would generate ${t} columns, above the limit of ${g}. Pivot on a lower-cardinality column, or raise pivot.maxColumns.`;return M(`pivot.maxColumns:${t}`,f),{tree:[],leaves:[],error:f}}const o=[],c=[];for(const f of y){const n=[];for(const m of S){const r=I(f,m,l);n.push(r),c.push(r)}n.length===1?(n[0].title=String(f),o.push(n[0])):o.push({id:`${G}:group:${f}`,title:String(f),columns:n,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(i){const f=S.map(m=>W(m,k));c.push(...f);const n=k&&k.pivot&&k.pivot.totalsLabel||"Total";if(f.length===1)f[0].title=n,i==="before"?o.unshift(f[0]):o.push(f[0]);else{const m={id:`${G}:group:__totals`,title:n,columns:f,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};i==="before"?o.unshift(m):o.push(m)}}return{tree:o,leaves:c,error:null}}function q(K){const R=K&&K.pivot&&K.pivot.groupTotals;return R==="before"||R==="after"?R:null}function W(K,R){return{id:`${G}:__total${R&&R.pivot&&R.pivot.separator||" | "}${K.id}`,field:null,title:K.title||K.id,type:K.type,dataType:K.dataType,nullable:!0,align:K.align,generated:!0,pivot:{enabled:!1,index:0,sourceId:K.id,total:!0},value:{pure:!0},cell:{align:K.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:K.total,lookup:null,layout:{width:K.layout&&K.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(S,k){const y=k&&k.totals;return y&&Object.hasOwn(y,K.id)?y[K.id]:null},formatValue(S,k){return S==null?"":K.formatValue?K.formatValue(S,k):String(S)}}}function I(K,R,S){return{id:`${G}:${K}${S}${R.id}`,field:null,title:R.title||R.id,type:R.type,dataType:R.dataType,nullable:!0,align:R.align,generated:!0,pivot:{enabled:!1,index:0,path:K,sourceId:R.id},value:{pure:!0},cell:{align:R.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:R.total,lookup:null,layout:{width:R.layout&&R.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(){return null},formatValue(k,y){return k==null?"":R.formatValue?R.formatValue(k,y):String(k)}}}}),Be("packages/core/src/compute/group.js",function(e,D){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return k}});const re=D("packages/core/src/compute/handle.js"),M=re.dictSize,G=re.identity,F=re.presenceReader,x=re.rowCount,q=re.valueReader,W="",I="\0",K=1<<20;function R(y,l,g,i){const t=y.length,o=y.map(s=>q(s)),c=Array.isArray(i)&&i.some(Boolean),f=c?o.map((s,d)=>i[d]?p=>i[d](s(p)):s):o;if(!c&&t>0&&y.every(s=>s&&s.kind==="dictionary"&&s.dict)){const s=y.map(p=>M(p.dict)+1);let d=1;for(let p=0;p<t;p++)d*=s[p];if(d<=Number.MAX_SAFE_INTEGER){const p=y.map(h=>h.values),u=y.map(h=>F(h)),b=h=>{let w=0;for(let v=0;v<t;v++){const A=u[v],_=A&&A(h)===0?s[v]-1:p[v][h];w=w*s[v]+_}return w},a=new Float64Array(g);for(let h=0;h<g;h++)a[h]=b(l[h]);return{packed:a,strings:null,product:d,readers:f,keyOf:b}}}const m=s=>{let d="";for(let p=0;p<t;p++){const u=f[p](s);d+=(p===0?"":W)+(u==null?I:String(u))}return d},r=new Array(g);for(let s=0;s<g;s++)r[s]=m(l[s]);return{packed:null,strings:r,product:1/0,readers:f,keyOf:m}}function S(y,l,g,i){const t=new Uint32Array(i+1);for(let n=0;n<g;n++)t[l[n]+1]++;for(let n=0;n<i;n++)t[n+1]+=t[n];const o=new Uint32Array(g),c=t.slice(0,i);for(let n=0;n<g;n++)o[c[l[n]]++]=y[n];const f=new Array(i);for(let n=0;n<i;n++)f[n]=o.subarray(t[n],t[n+1]);return f}function k(y,l,g={}){const i=y||[],t=l||G(x(i[0],g)),o=t.length;if(i.length===0||o===0)return{keys:[],buckets:[]};const{packed:c,strings:f,product:n,readers:m}=R(i,t,o,g.project),r=new Uint32Array(o);let s=0,d=null;if(c&&n<=Math.max(1024,Math.min(K,o*4))){const a=n,h=new Int32Array(a).fill(-1);for(let w=0;w<o;w++)h[c[w]]=0;for(let w=0;w<a;w++)h[w]===0&&(h[w]=s++);for(let w=0;w<o;w++)r[w]=h[c[w]];d=new Float64Array(s);for(let w=0;w<a;w++)h[w]>=0&&(d[h[w]]=w)}else if(c){const a=new Map;for(let h=0;h<o;h++){const w=c[h];let v=a.get(w);v===void 0&&(v=s++,a.set(w,v)),r[h]=v}d=new Float64Array(s);for(const[h,w]of a)d[w]=h}else{const a=new Map;for(let h=0;h<o;h++){const w=f[h];let v=a.get(w);v===void 0&&(v=s++,a.set(w,v)),r[h]=v}}const p=S(t,r,o,s),u=new Array(s);for(let a=0;a<s;a++){const h=p[a][0],w=new Array(m.length);for(let v=0;v<m.length;v++)w[v]=m[v](h);u[a]=w}const b={keys:u,buckets:p};return d&&(b.packed=d),b}}),Be("packages/core/src/compute/pivot.js",function(e,D){"use strict";Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return o}});const M=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/compute/handle.js").valueComparator,q=D("packages/core/src/compute/group.js").packKeys,I=D("packages/core/src/compute/total.js").total,K="|",R="/",S=2e3;function k(n,m,r){return`${n}${K}${m}${K}${r}`}function y(n,m){let r="";for(let s=0;s<n.length;s++){const d=n[s];r+=(s===0?"":m)+(d==null?"":String(d))}return r}function l(n,m,r={}){const s=r.separator||R,d=m.length,{keyOf:p,readers:u}=q(n,m,0),b=new Map,a=[],h=[];for(let $=0;$<d;$++){const j=m[$],E=p(j);if(b.has(E))continue;b.set(E,a.length),h.push(E);const O=new Array(u.length);for(let N=0;N<u.length;N++)O[N]=u[N](j);a.push(O)}const w=F(r.locale),v=a.map(($,j)=>j);v.sort(($,j)=>{const E=a[$],O=a[j];for(let N=0;N<E.length;N++){const T=g(E[N],O[N],w);if(T!==0)return T}return $-j});const A=new Array(v.length),_=new Array(v.length),V=new Map;for(let $=0;$<v.length;$++){const j=v[$];A[$]=a[j],_[$]=y(a[j],s),V.set(h[j],$)}return{keys:A,paths:_,idOf:$=>{const j=V.get(p($));return j===void 0?-1:j}}}function g(n,m,r){const s=n==null,d=m==null;return s||d?s&&d?0:s?1:-1:r(n,m)}function i(n){const m=n.values||n.totals||[];if(m.length&&typeof m[0]=="object"&&m[0]!==null)return m.filter(p=>p&&p.handle);const r=typeof n.handle=="function"?n.handle:null;if(!r)return m.length&&M("pivot:handles","pivot was given total column ids but no handle(colId) resolver, so no cell values were reduced. Pass values: [{ colId, handle, fn }] or opts.handle."),[];const s=typeof n.totalOf=="function"?n.totalOf:null,d=[];for(const p of m){const u=r(p);u&&d.push({colId:p,handle:u,fn:s?s(p):"sum"})}return d}function t(n,m,r){if(Array.isArray(n)){const s=r||{};return{...s,pivotHandles:n,order:m||null,groups:s.groups||null}}return n||{}}function o(n,m,r){const s=t(n,m,r),d=s.separator||R,p=i(s),u=s.maxColumns===void 0?S:s.maxColumns,b=s.groups&&s.groups.buckets?s.groups:null,a=b?b.buckets:[s.order||new Uint32Array(0)],h=s.groupPaths||(b?b.keys.map(E=>y(E,d)):[""]),w=f(a),{keys:v,paths:A,idOf:_}=l(s.pivotHandles||[],w,s),V=A.length*Math.max(1,p.length),Y=c(A,p,d);if(u&&V>u){const E=new Map;return{keys:v,paths:A,fields:Y,groupPaths:h,columns:V,values:E,cells:E,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${V} columns, above pivot.maxColumns of ${u}. Narrow the pivot columns or raise the limit.`,columns:V,maxColumns:u}}}const $=new Map,j=A.length;for(let E=0;E<a.length;E++){const O=a[E],N=h[E]===void 0?"":h[E],T=O.length;if(T===0)continue;const C=new Int32Array(T),B=new Uint32Array(j+1);for(let Q=0;Q<T;Q++){const H=_(O[Q]);C[Q]=H,H>=0&&B[H+1]++}for(let Q=0;Q<j;Q++)B[Q+1]+=B[Q];const z=new Uint32Array(T),X=B.slice(0,j);for(let Q=0;Q<T;Q++){const H=C[Q];H>=0&&(z[X[H]++]=O[Q])}for(let Q=0;Q<j;Q++){const H=B[Q],L=B[Q+1];if(L===H)continue;const Z=z.subarray(H,L);for(let ee=0;ee<p.length;ee++){const te=p[ee],se=I(te.handle,Z,te.fn,s.totalContext||{locale:s.locale});$.set(k(N,A[Q],te.colId),se)}}}return{keys:v,paths:A,fields:Y,groupPaths:h,columns:V,values:$,cells:$,error:null}}function c(n,m,r){if(m.length===0)return n.slice();const s=[];for(const d of n)for(const p of m)s.push(`${d}${r}${p.colId}`);return s}function f(n){if(n.length===1)return n[0]||new Uint32Array(0);let m=0;for(const d of n)m+=d?d.length:0;const r=new Uint32Array(m);let s=0;for(const d of n)!d||d.length===0||(r.set(d,s),s+=d.length);return r}}),Be("packages/core/src/compute/explain.js",function(e,D){"use strict";Object.defineProperty(e,"explainContributors",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"explainChange",{enumerable:!0,get:function(){return k}});const M=D("packages/core/src/compute/total.js").total,F=D("packages/core/src/compute/group.js").groupByColumns,x=new Set(["sum","count","countValues"]),q=new Set(["min","max"]),W=new Set(["avg"]);function I(y){return typeof y=="string"?y:typeof y=="function"&&y.totalName?y.totalName:null}function K(y,l,g,i){return M(y,l,g,i||{})}function R(y,l){if(l)try{return l(y)}catch{}return y==null?"":String(y)}function S(y){const{handle:l,fn:g,leaves:i,by:t,labelOf:o,rowLabel:c}=y,f={locale:y.locale},n=i&&i.length?i:[],m=I(g),r=K(l,n,g,f),s=q.has(m);let d;if(s){let b=-1;for(let a=0;a<n.length;a++){const h=K(l,[n[a]],g,f);if(Object.is(h,r)){b=n[a];break}}d=b<0?[]:[{key:b,indices:[b],label:c?c(b):String(b)}]}else if(t){const b=F([t],n);d=b.keys.map((a,h)=>({key:a[0],indices:b.buckets[h],label:R(a[0],o)}))}else d=Array.from({length:n.length},(b,a)=>{const h=n[a];return{key:h,indices:[h],label:c?c(h):String(h)}});const p=n.length,u=[];for(const b of d){const a=K(l,b.indices,g,f),h=b.indices.length;let w,v;if(m==="avg")w=((typeof a=="number"?a:0)-(typeof r=="number"?r:0))*h,v=p?h/p:0;else if(s)w=typeof a=="number"?a:0,v=1;else{w=typeof a=="number"?a:0;const A=typeof r=="number"?r:0;v=A?w/A:0}u.push({key:b.key,label:b.label,count:h,value:a,contribution:w,share:v})}return u.sort((b,a)=>Math.abs(a.contribution)-Math.abs(b.contribution)||(b.label<a.label?-1:b.label>a.label?1:0)),{total:r,fn:m,weighted:W.has(m),single:s,contributors:u}}function k(y){const l=S({...y,leaves:y.after}),g=S({...y,leaves:y.before}),i=typeof l.total=="number"?l.total:0,t=typeof g.total=="number"?g.total:0,o=new Map;for(const n of l.contributors)o.set(n.key,n);const c=[],f=new Set;for(const n of g.contributors){f.add(n.key);const m=o.get(n.key);if(m===void 0)c.push({key:n.key,label:n.label,before:n.value,after:null,effect:-n.contribution,kind:"dropped",count:n.count});else{const r=m.contribution-n.contribution;r!==0&&c.push({key:n.key,label:n.label,before:n.value,after:m.value,effect:r,kind:"changed",count:m.count})}}for(const n of l.contributors)f.has(n.key)||c.push({key:n.key,label:n.label,before:null,after:n.value,effect:n.contribution,kind:"new",count:n.count});return c.sort((n,m)=>Math.abs(m.effect)-Math.abs(n.effect)||(n.label<m.label?-1:n.label>m.label?1:0)),{before:g.total,after:l.total,delta:i-t,weighted:l.weighted||g.weighted,single:l.single||g.single,drivers:c}}}),Be("packages/core/src/store/bitset.js",function(e,D){"use strict";Object.defineProperty(e,"Bitset",{enumerable:!0,get:function(){return M}});const re=8;class M{static#e=new Uint8Array(256);static{for(let F=1;F<256;F++)M.#e[F]=M.#e[F>>1]+(F&1)}#t;#n;constructor(F=0){const x=Math.max(0,F|0);this.#n=x,this.#t=new Uint8Array(Math.ceil(x/re))}get size(){return this.#n}get words(){return this.#t}get bytes(){return this.#t?this.#t.byteLength:0}get(F){return F<0||F>=this.#n?0:this.#t[F>>3]>>(F&7)&1}set(F){return F>=0&&F<this.#n&&(this.#t[F>>3]|=1<<(F&7)),this}clear(F){return F>=0&&F<this.#n&&(this.#t[F>>3]&=~(1<<(F&7))),this}assign(F,x){return x?this.set(F):this.clear(F)}fill(F=!1){return this.#t.fill(F?255:0),F&&this.#r(),this}grow(F){const x=Math.max(0,F|0);if(x<=this.#n)return this;const q=Math.ceil(x/re);if(q>this.#t.length){const W=new Uint8Array(q);W.set(this.#t),this.#t=W}return this.#n=x,this}count(){const F=this.#t,x=M.#e;let q=0;for(let W=0;W<F.length;W++)q+=x[F[W]];return q}and(F){const x=F instanceof M?F.words:F,q=this.#t,W=Math.min(q.length,x.length);for(let I=0;I<W;I++)q[I]&=x[I];for(let I=W;I<q.length;I++)q[I]=0;return this}or(F){const x=F instanceof M?F.words:F,q=this.#t,W=Math.min(q.length,x.length);for(let I=0;I<W;I++)q[I]|=x[I];return this}not(){const F=this.#t;for(let x=0;x<F.length;x++)F[x]=~F[x]&255;return this.#r(),this}clone(){const F=new M(this.#n);return F.words.set(this.#t.subarray(0,F.words.length)),F}release(){this.#t=new Uint8Array(0),this.#n=0}#r(){const F=this.#n&7;if(F===0)return;const x=this.#n>>3;x<this.#t.length&&(this.#t[x]&=(1<<F)-1)}static from(F){const x=Array.isArray(F)?F:Array.from(F),q=new M(x.length);for(let W=0;W<x.length;W++)x[W]&&q.set(W);return q}}}),Be("packages/core/src/store/dictionary.js",function(e,D){"use strict";Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return F}});const re=D("packages/core/src/internal/compare.js"),M=re.collator,G=re.defaultCompare;class F{#e;#t=new Map;#n=0;#r=null;#i=-1;#s="\0";constructor(q=[]){this.#e=[];for(let W=0;W<q.length;W++){const I=q[W];this.#t.has(I)||(this.#t.set(I,this.#e.length),this.#e.push(I))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let q=this.#e.length*8;for(let W=0;W<this.#e.length;W++){const I=this.#e[W];typeof I=="string"&&(q+=I.length*2),q+=16}return q}codeOf(q){const W=this.#t.get(q);if(W!==void 0)return W;const I=this.#e.length;return this.#e.push(q),this.#t.set(q,I),this.#n++,I}lookup(q){const W=this.#t.get(q);return W===void 0?-1:W}has(q){return this.#t.has(q)}valueOf(q){return this.#e[q]}values(){return this.#e}ranks(q){const W=q||"";if(this.#r&&this.#i===this.#n&&this.#s===W)return this.#r;const I=this.#e.length,K=new Array(I);for(let y=0;y<I;y++)K[y]=y;const R=M(q).compare,S=this.#e;K.sort((y,l)=>this.#o(S[y],S[l],R));const k=new Uint32Array(I);for(let y=0;y<I;y++)k[K[y]]=y;return this.#r=k,this.#i=this.#n,this.#s=W,k}#o(q,W,I){return typeof q=="string"&&typeof W=="string"?I(q,W):G(q,W)}}}),Be("packages/core/src/store/multivalue.js",function(e,D){"use strict";Object.defineProperty(e,"MultiValue",{enumerable:!0,get:function(){return re}});class re{#e;#t;#n=0;#r=0;constructor(G={}){const F=Math.max(1,G.rows??16),x=Math.max(1,G.values??F);this.#e=new Int32Array(x),this.#t=new Uint32Array(F+1)}get values(){return this.#e}get offsets(){return this.#t}get rows(){return this.#n}get length(){return this.#r}get bytes(){return this.#e.byteLength+this.#t.byteLength}count(G){return G<0||G>=this.#n?0:this.#t[G+1]-this.#t[G]}at(G){return G<0||G>=this.#n?this.#e.subarray(0,0):this.#e.subarray(this.#t[G],this.#t[G+1])}has(G,F){if(G<0||G>=this.#n)return!1;const x=this.#e,q=this.#t[G+1];for(let W=this.#t[G];W<q;W++)if(x[W]===F)return!0;return!1}hasAny(G,F){for(let x=0;x<F.length;x++)if(this.has(G,F[x]))return!0;return!1}hasAll(G,F){for(let x=0;x<F.length;x++)if(!this.has(G,F[x]))return!1;return!0}hasNone(G,F){return!this.hasAny(G,F)}push(G){const F=this.#n,x=G.length;this.#i(F+1),this.#s(this.#r+x);const q=this.#r;for(let W=0;W<x;W++)this.#e[q+W]=G[W]|0;return this.#r+=x,this.#n=F+1,this.#t[F]=q,this.#t[F+1]=this.#r,F}write(G,F){if(G===this.#n){this.push(F);return}if(G<0||G>this.#n)return;const x=this.#t[G],q=this.#t[G+1],W=F.length;if(q-x===W){for(let I=0;I<W;I++)this.#e[x+I]=F[I]|0;return}this.#o(G,F)}compact(G,F,x){const q=this.#e,W=this.#t,I=this.#n,K=new Int32Array(Math.max(1,this.#r)),R=new Uint32Array(F+1);let S=0;for(let k=0;k<I;k++){if(G[k]===x)continue;const y=W[k],l=W[k+1];R[G[k]]=S;for(let g=y;g<l;g++)K[S++]=q[g];R[G[k]+1]=S}this.#e=K,this.#t=R,this.#n=F,this.#r=S}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#i(G){if(G+1<=this.#t.length)return;let F=this.#t.length-1;for(;F<G;)F=F*2||16;const x=new Uint32Array(F+1);x.set(this.#t),this.#t=x}#s(G){if(G<=this.#e.length)return;let F=this.#e.length;for(;F<G;)F=F*2||16;const x=new Int32Array(F);x.set(this.#e),this.#e=x}#o(G,F){const x=this.#e,q=this.#t,W=this.#n,I=F.length-(q[G+1]-q[G]),K=new Int32Array(Math.max(1,this.#r+I)),R=new Uint32Array(q.length);let S=0;for(let k=0;k<W;k++){if(R[k]=S,k===G)for(let y=0;y<F.length;y++)K[S++]=F[y]|0;else for(let y=q[k];y<q[k+1];y++)K[S++]=x[y];R[k+1]=S}this.#e=K,this.#t=R,this.#r=S}}}),Be("packages/core/src/compute/sort.js",function(e,D){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return j}});const re=D("packages/core/src/compute/handle.js"),M=re.bitReader,G=re.dictRanks,F=re.dictSize,x=re.identity,q=re.isMissing,W=re.presenceReader,I=re.rowCount,K=re.valueComparator,R=re.valueReader,S=new Uint32Array(0),k=new ArrayBuffer(8),y=new Float64Array(k),l=new Uint32Array(k),g=(y[0]=-1,(l[1]&2147483648)!==0?1:0),i=g===1?0:1;function t(O,N){y[0]=O;let T=l[g],C=l[i];(T&2147483648)!==0?(T=~T>>>0,C=~C>>>0):T=(T^2147483648)>>>0,N[0]=C,N[1]=T}function o(O,N,T,C){if(C<2)return O;const B=new Uint32Array(256*8);for(let te=0;te<C;te++){const se=N[te],ne=T[te];B[se&255]++,B[256+(se>>>8&255)]++,B[512+(se>>>16&255)]++,B[768+(se>>>24&255)]++,B[1024+(ne&255)]++,B[1280+(ne>>>8&255)]++,B[1536+(ne>>>16&255)]++,B[1792+(ne>>>24&255)]++}let z=O,X=N,Q=T,H=new Uint32Array(C),L=new Uint32Array(C),Z=new Uint32Array(C);const ee=new Uint32Array(256);for(let te=0;te<8;te++){const se=te<<8,ne=(te&3)<<3,ae=te>=4;let de=!1;for(let Ce=0;Ce<256;Ce++)if(B[se+Ce]===C){de=!0;break}if(de)continue;let le=0;for(let Ce=0;Ce<256;Ce++)ee[Ce]=le,le+=B[se+Ce];for(let Ce=0;Ce<C;Ce++){const Ne=X[Ce],he=Q[Ce],ie=(ae?he:Ne)>>>ne&255,ue=ee[ie]++;H[ue]=z[Ce],L[ue]=Ne,Z[ue]=he}let be=z;z=H,H=be,be=X,X=L,L=be,be=Q,Q=Z,Z=be}return z}function c(O,N,T){if(T<2)return O;const C=new Uint32Array(256*4);for(let L=0;L<T;L++){const Z=N[L];C[Z&255]++,C[256+(Z>>>8&255)]++,C[512+(Z>>>16&255)]++,C[768+(Z>>>24&255)]++}let B=O,z=N,X=new Uint32Array(T),Q=new Uint32Array(T);const H=new Uint32Array(256);for(let L=0;L<4;L++){const Z=L<<8,ee=L<<3;let te=!1;for(let ae=0;ae<256;ae++)if(C[Z+ae]===T){te=!0;break}if(te)continue;let se=0;for(let ae=0;ae<256;ae++)H[ae]=se,se+=C[Z+ae];for(let ae=0;ae<T;ae++){const de=z[ae],le=H[de>>>ee&255]++;X[le]=B[ae],Q[le]=de}let ne=B;B=X,X=ne,ne=z,z=Q,Q=ne}return B}function f(O,N,T,C){const B=new Uint32Array(C+1);for(let Q=0;Q<T;Q++)B[N[Q]]++;let z=0;for(let Q=0;Q<=C;Q++){const H=B[Q];B[Q]=z,z+=H}const X=new Uint32Array(T);for(let Q=0;Q<T;Q++)X[B[N[Q]]++]=O[Q];return X}function n(O,N,T,C){return T<2?O:C<=65536||C<=T*2?f(O,N,T,C):c(O,N,T)}function m(O,N){return O.length===N&&O.byteOffset===0?O:Uint32Array.prototype.slice.call(O,0,N)}function r(O,N,T=!1){const C=N||x(O.length),B=C.length;if(B<2)return Uint32Array.from(C);const z=new Uint32Array(B),X=new Uint32Array(B),Q=new Uint32Array(B),H=new Uint32Array(B),L=new Uint32Array(2);let Z=0,ee=0;for(let ne=0;ne<B;ne++){const ae=C[ne],de=O[ae];if(Number.isNaN(de)){H[ee++]=ae;continue}t(de,L),T?(X[Z]=~L[0]>>>0,Q[Z]=~L[1]>>>0):(X[Z]=L[0],Q[Z]=L[1]),z[Z++]=ae}const te=o(z.subarray(0,Z),X.subarray(0,Z),Q.subarray(0,Z),Z);if(ee===0)return m(te,Z);const se=new Uint32Array(B);return se.set(te.subarray(0,Z),0),se.set(H.subarray(0,ee),Z),se}function s(O,N,T=!1){const C=N||x(O.length),B=C.length;if(B<2)return Uint32Array.from(C);const z=Uint32Array.from(C),X=new Uint32Array(B);for(let Q=0;Q<B;Q++){const H=(O[z[Q]]^2147483648)>>>0;X[Q]=T?~H>>>0:H}return m(c(z,X,B),B)}function d(O,N,T={}){const C=N||x(I(O,T)),B=C.length;if(B<2)return Uint32Array.from(C);const z=G(O.dict,T.locale),X=O.values,Q=W(O),H=Math.max(F(O.dict),z.length),L=H,Z=Uint32Array.from(C),ee=new Uint32Array(B),te=!!T.descending;for(let se=0;se<B;se++){const ne=Z[se];let ae=Q&&Q(ne)===0?L:z[X[ne]];ae===void 0&&(ae=L),ee[se]=te?L-ae:ae}return m(n(Z,ee,B,H+1),B)}function p(O,N,T){const C=N.length;let B=Uint32Array.from(N);if(C<2)return B;let z=new Uint32Array(C);for(let X=1;X<C;X<<=1){for(let H=0;H<C;H+=X<<1){const L=Math.min(H+X,C),Z=Math.min(H+(X<<1),C);let ee=H,te=L,se=H;for(;ee<L&&te<Z;)z[se++]=T(O[B[ee]],O[B[te]])<=0?B[ee++]:B[te++];for(;ee<L;)z[se++]=B[ee++];for(;te<Z;)z[se++]=B[te++]}const Q=B;B=z,z=Q}return B}function u(O,N,T){const C=M(O.values),B=N.length,z=new Uint32Array(B),X=T?1:0;let Q=0;for(let H=0;H<B;H++)C(N[H])===X&&(z[Q++]=N[H]);for(let H=0;H<B;H++)C(N[H])!==X&&(z[Q++]=N[H]);return z}function b(O,N){const T=O.values,C=O.kind;if((C==="object"||C===void 0)&&(Array.isArray(T)||ArrayBuffer.isView(T))&&!O.presence)return T;const z=R(O),X=new Array(I(O)||0);for(let Q=0;Q<N.length;Q++){const H=N[Q];X[H]=z(H)}return X}function a(O,N){for(let T=0;T<N.length;T++)if(typeof O[N[T]]!="string")return!1;return!0}function h(O,N,T,C,B){const z=O.length,X=Uint32Array.from(O);if(z<2||C<1)return X;const Q=new Uint32Array(z),H=C-1;for(let L=0;L<z;L++){const Z=T[N[L]];Q[L]=B?H-Z:Z}return m(n(X,Q,z,C),z)}function w(O,N,T){const C=K(T),B=new Array(N);for(let X=0;X<N;X++)B[X]=X;B.sort((X,Q)=>C(O[X],O[Q])||X-Q);const z=new Uint32Array(N);for(let X=0;X<N;X++)z[B[X]]=X;return z}function v(O,N,T){const C=N.length,B=new Map,z=[],X=new Uint32Array(C);for(let L=0;L<C;L++){const Z=O[N[L]];let ee=B.get(Z);ee===void 0&&(ee=z.length,B.set(Z,ee),z.push(Z)),X[L]=ee}const Q=z.length,H=w(z,Q,T.locale);return h(N,X,H,Q,!!T.descending)}function A(O,N,T){const C=b(O,N);if(N.length>=2&&a(C,N)){const X=O.stringRank;return X&&X.version===O.version&&X.usable(N,C,T.locale)?X.sort(N,T):v(C,N,T)}const B=K(T.locale),z=T.descending?(X,Q)=>B(Q,X):B;return p(C,N,z)}function _(O,N,T){const C=b(O,N),B=T.compare,X=!!T.descending?(Q,H)=>-B(Q,H,void 0,void 0,!0):(Q,H)=>B(Q,H,void 0,void 0,!1);return p(C,N,X)}function V(O,N){const T=N.length,C=W(O),B=O.values,z=O.kind==="float64"&&!!B,X=O.kind==="object"||O.kind==="multi"||O.kind===void 0;if(!C&&!z&&!X)return{present:N,absent:S};const Q=new Uint32Array(T),H=new Uint32Array(T);let L=0,Z=0;if(C&&z)for(let ee=0;ee<T;ee++){const te=N[ee];C(te)===1&&!Number.isNaN(B[te])?Q[L++]=te:H[Z++]=te}else if(z&&!C)for(let ee=0;ee<T;ee++){const te=N[ee];Number.isNaN(B[te])?H[Z++]=te:Q[L++]=te}else if(C&&!X)for(let ee=0;ee<T;ee++){const te=N[ee];C(te)===1?Q[L++]=te:H[Z++]=te}else{const ee=R(O);for(let te=0;te<T;te++){const se=N[te];q(ee(se))?H[Z++]=se:Q[L++]=se}}return Z===0?{present:N,absent:S}:{present:Q.subarray(0,L),absent:H.subarray(0,Z)}}function Y(O,N,T){if(N.length===0)return O;const C=new Uint32Array(O.length+N.length);return T?(C.set(N,0),C.set(O,N.length)):(C.set(O,0),C.set(N,O.length)),C}function $(O,N,T={}){const C=N||x(I(O,T));if(!O||C.length<2)return Uint32Array.from(C);const{present:B,absent:z}=V(O,C);if(B.length===0)return Uint32Array.from(C);const X=!!T.descending;let Q;if(typeof T.compare=="function")Q=_(O,B,T);else switch(O.kind){case"float64":Q=r(O.values,B,X);break;case"int32":Q=s(O.values,B,X);break;case"dictionary":Q=d(O,B,T);break;case"bitset":Q=u(O,B,X);break;default:Q=A(O,B,T);break}return Y(Q,z,!!T.nullsFirst)}function j(O,N,T,C={}){const B=N||[],z=B.length&&(B[0].handle||E(O,B[0].col))||O&&O[0];let X=T||x(I(z,C));for(let Q=B.length-1;Q>=0;Q--){const H=B[Q],L=H.handle||E(O,H.col)||O&&O[Q];L&&(X=$(L,X,{descending:H.descending!==void 0?!!H.descending:H.dir==="desc",nullsFirst:!!H.nullsFirst,locale:H.locale!==void 0?H.locale:C.locale,compare:H.compare}))}return X instanceof Uint32Array?X:Uint32Array.from(X)}function E(O,N){if(!(!O||N===void 0)){for(let T=0;T<O.length;T++)if(O[T]&&O[T].id===N)return O[T]}}}),Be("packages/core/src/store/stringrank.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_MAX_DISTINCT",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"StringRankIndex",{enumerable:!0,get:function(){return x}});const re=D("packages/core/src/compute/sort.js"),M=re.collateStringRanks,G=re.rankSortStrings,F=1e5;class x{#e=[];#t=new Map;#n;#r=0;#i=0;#s=-1;#o;#l=!1;#a=null;#c=-1;#u="\0";constructor(W=F){this.#o=W>0?W:F,this.#n=new Uint32Array(0)}get version(){return this.#s}set version(W){this.#s=W}get generation(){return this.#i}get size(){return this.#e.length}get capped(){return this.#l}get length(){return this.#r}get bytes(){let W=this.#n.byteLength;const I=this.#e;for(let K=0;K<I.length;K++)W+=I[K].length*2+24;return W}#f(W,I){const K=this.#t.get(W);if(K!==void 0)return K;if(this.#l)return-1;if(I&&this.#e.length>=this.#o)return this.#l=!0,-1;const R=this.#e.length;return this.#e.push(W),this.#t.set(W,R),this.#i++,R}build(W,I){const K=I|0;this.#e=[],this.#t=new Map,this.#i=0,this.#l=!1,this.#a=null,this.#c=-1,this.#n=new Uint32Array(K);for(let R=0;R<K;R++){const S=W[R],k=typeof S=="string"?this.#f(S,!1):-1;this.#n[R]=k<0?0:k}this.#r=K}append(W,I,K){const R=(I|0)+(K|0);if(R>this.#n.length){const S=new Uint32Array(R);S.set(this.#n.subarray(0,this.#r)),this.#n=S}for(let S=I|0;S<R;S++){const k=W[S],y=typeof k=="string"?this.#f(k,!0):-1;this.#n[S]=y<0?0:y}this.#r=Math.max(this.#r,R)}ranks(W){const I=W||"";if(this.#a&&this.#c===this.#i&&this.#u===I)return this.#a;const K=M(this.#e,this.#e.length,W);return this.#a=K,this.#c=this.#i,this.#u=I,K}usable(W,I,K){if(this.#l||this.#e.length===0)return!1;const R=this.#n,S=this.#e,k=this.#r;for(let y=0;y<W.length;y++){const l=W[y];if(l>=k||S[R[l]]!==I[l])return!1}return!0}sort(W,I){const K=this.ranks(I.locale),R=this.#e.length,S=W.length,k=new Uint32Array(S),y=this.#n;for(let l=0;l<S;l++)k[l]=y[W[l]];return G(W,k,K,R,!!I.descending)}}}),Be("packages/core/src/store/columnstore.js",function(e,D){"use strict";Object.defineProperty(e,"REMOVED",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"toFloat",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ColumnHandle",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"ColumnStore",{enumerable:!0,get:function(){return u}});const M=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/internal/predicates.js").isFunction,q=D("packages/core/src/internal/paths.js").pathGetter,I=D("packages/core/src/store/bitset.js").Bitset,R=D("packages/core/src/store/dictionary.js").Dictionary,k=D("packages/core/src/store/multivalue.js").MultiValue,l=D("packages/core/src/store/stringrank.js").StringRankIndex,g=4294967295,i=1024,t=5e3,o=.2,c=new Set(["float64","int32","bitset","dictionary","object","multi"]);function f(b){return b==null}function n(b){if(typeof b=="number")return b;if(b instanceof Date)return b.getTime();if(typeof b=="boolean")return b?1:0;const a=Number(b);return Number.isNaN(a)&&typeof b=="string"?Date.parse(b):a}function m(b){const a=n(b);return Number.isFinite(a)?a|0:0}function r(b){return f(b)?[]:Array.isArray(b)?b:[b]}function s(b,a){switch(b.kind){case"float64":case"int32":return b.buf[a];case"bitset":return b.bits.get(a)===1;case"dictionary":return b.dict.valueOf(b.buf[a]);case"multi":{const h=b.mv.at(a),w=new Array(h.length);for(let v=0;v<h.length;v++)w[v]=b.dict.valueOf(h[v]);return w}default:return b.buf[a]}}function d(b,a){switch(b.kind){case"float64":case"int32":return b.values[a];case"bitset":return(b.values[a>>3]&1<<(a&7))!==0;case"dictionary":return(b.table||[])[b.values[a]];case"multi":{const h=b.offsets[a],w=b.offsets[a+1],v=b.table||[],A=new Array(w-h);for(let _=h;_<w;_++)A[_-h]=v[b.values[_]];return A}default:return b.values[a]}}class p{#e;#t;#n;#r;#i;#s;#o;#l=!1;#a=null;#c=null;#u=null;#f=null;#d=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#O=null;#w=null;#A=!1;constructor(a,h){this.#e=a.id;const w=c.has(a.kind)?a.kind:"object";a.kind&&!c.has(a.kind)&&M(`store.kind.${a.id}`,`column "${a.id}" declares unknown storage kind "${a.kind}"; falling back to object`),this.#n=w,this.#t=w,this.#r=a.nullable!==!1,this.#o=a.dictionary??null,this.#s=h,this.#i=F(a.read)?a.read:q(a.field||a.id),this.#h=a.stringRankIndex!=="off",this.#p=typeof a.stringRankMaxDistinct=="number"?a.stringRankMaxDistinct:0,this.#O=new Map}get id(){return this.#e}get kind(){return this.#l?this.#t:"object"}get target(){return this.#n}get nullable(){return this.#r}get values(){return this.#A?null:this.#l?this.#t==="bitset"?this.#c.words:this.#t==="multi"?this.#u.values:this.#a:this.#T().values}get presence(){return this.#A||!this.#r?null:this.#l?this.#g:this.#T().presence}get dict(){return this.#A||!this.#l?null:this.#t==="dictionary"||this.#t==="multi"?this.#f:null}get stringRank(){if(this.#A||!this.#h||this.kind!=="object")return null;const a=this.values,h=this.#s.physical();if(!a||h===0)return null;if(this.#d===null){if(typeof a[0]!="string")return null;const w=new l(this.#v());return w.build(a,h),w.version=this.#y,this.#d=w,this.#m=this.#y,w.capped?null:w}return this.#d.length<h&&this.#d.append(a,this.#d.length,h-this.#d.length),this.#d.version=this.#y,this.#m=this.#y,this.#d.capped?null:this.#d}#v(){return this.#p}#C(){this.#d=null,this.#m=-1}get offsets(){return this.#A||!this.#l||this.#t!=="multi"?null:this.#u.offsets}get version(){return this.#y}get bytes(){let a=0;return this.#a&&(a+=this.#a.byteLength??this.#a.length*8),this.#c&&(a+=this.#c.bytes),this.#u&&(a+=this.#u.bytes),this.#g&&(a+=this.#g.bytes),this.#f&&(a+=this.#f.bytes),this.#O&&(a+=this.#O.size*24),a}get(a){if(!this.#A&&!(a<0||a>=this.#s.physical())){if(!this.#l)return this.#E(a);if(this.#r&&this.#g.get(a)===0)return null;switch(this.#t){case"float64":case"int32":return this.#a[a];case"bitset":return this.#c.get(a)===1;case"dictionary":return this.#f.valueOf(this.#a[a]);case"multi":{const h=this.#u.at(a),w=new Array(h.length);for(let v=0;v<h.length;v++)w[v]=this.#f.valueOf(h[v]);return w}default:return this.#a[a]}}}set(a,h){this.#A||(this.#l?this.#P(a,h):this.#O.set(a,h===void 0?null:h),this.#d&&this.#C(),this.#y++)}read(a){return this.#i(a)}appendColumn(a,h,w){if(this.#A||w<=0)return;if(!this.#l){this.#y++;return}const v=this.#i,A=this.#r,_=this.#g;let V=!1;switch(this.#t){case"float64":{const Y=this.#a;for(let $=0;$<w;$++){const j=v(a[$]);if(typeof j=="number"){A&&_.set(h+$),Y[h+$]=j;continue}const E=j==null;A?_.assign(h+$,!E):E&&(V=!0),Y[h+$]=E?NaN:n(j)}break}case"int32":{const Y=this.#a;for(let $=0;$<w;$++){const j=v(a[$]),E=j==null;A?_.assign(h+$,!E):E&&(V=!0),Y[h+$]=E?0:m(j)}break}case"bitset":{const Y=this.#c;for(let $=0;$<w;$++){const j=v(a[$]),E=j==null;A?_.assign(h+$,!E):E&&(V=!0),Y.assign(h+$,!E&&!!j)}break}case"dictionary":{const Y=this.#a,$=this.#f;for(let j=0;j<w;j++){const E=v(a[j]),O=E==null;A?_.assign(h+j,!O):O&&(V=!0),Y[h+j]=O?0:$.codeOf(E)}break}case"multi":{const Y=this.#u,$=this.#f;for(let j=0;j<w;j++){const E=v(a[j]),O=E==null;A?_.assign(h+j,!O):O&&(V=!0);const N=r(E),T=new Array(N.length);for(let C=0;C<N.length;C++)T[C]=$.codeOf(N[C]);Y.write(h+j,T)}break}default:{const Y=this.#a;for(let $=0;$<w;$++){const j=v(a[$]),E=j==null;A?_.assign(h+$,!E):E&&(V=!0),Y[h+$]=E?null:j}break}}V&&M(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#d&&this.#t==="object"&&(this.#d.append(this.#a,h,w),this.#d.version=this.#y+1,this.#m=this.#y+1),this.#y++}appendPacked(a,h,w){if(this.#A||w<=0||!a)return;if(!this.#l){this.#y++;return}const v=this.#g,A=a.presence;if(v)if(A)for(let V=0;V<w;V++)v.assign(h+V,(A[V>>3]&1<<(V&7))!==0);else for(let V=0;V<w;V++)v.set(h+V);const _=a.kind===this.#t;if(_&&(this.#t==="float64"||this.#t==="int32")){this.#a.set(a.values,h),this.#y++;return}if(_&&this.#t==="bitset"){const V=a.values;for(let Y=0;Y<w;Y++)this.#c.assign(h+Y,(V[Y>>3]&1<<(Y&7))!==0);this.#y++;return}if(_&&this.#t==="dictionary"){const V=a.table||[],Y=new Uint32Array(V.length);for(let O=0;O<V.length;O++)Y[O]=this.#f.codeOf(V[O]);const $=a.values,j=this.#a,E=v;for(let O=0;O<w;O++){if(E&&(A&&(A[O>>3]&1<<(O&7))===0)){j[h+O]=0;continue}j[h+O]=Y[$[O]]??0}this.#y++;return}if(_&&this.#t==="multi"){const V=a.table||[],Y=new Uint32Array(V.length);for(let E=0;E<V.length;E++)Y[E]=this.#f.codeOf(V[E]);const $=a.values,j=a.offsets;for(let E=0;E<w;E++){const O=j[E],N=j[E+1],T=new Array(N-O);for(let C=O;C<N;C++)T[C-O]=Y[$[C]]??0;this.#u.write(h+E,T)}this.#y++;return}for(let V=0;V<w;V++){const Y=A?(A[V>>3]&1<<(V&7))===0:a.kind==="object"?a.values[V]===null:!1;this.#P(h+V,Y?null:d(a,V))}this.#y++}touch(){this.#y++}columnarise(a,h){if(this.#l||this.#A)return;const w=new Array(h);for(let v=0;v<h;v++)w[v]=this.#E(v);this.#t=this.#n,this.#l=!0,this.#S(a);for(let v=0;v<h;v++)this.#P(v,w[v]);this.#O.clear(),this.#w=null,this.#C(),this.#y++}grow(a){if(!(!this.#l||this.#A||a<=this.#b)){switch(this.#t){case"float64":case"int32":case"dictionary":{const h=new this.#a.constructor(a);h.set(this.#a),this.#a=h;break}case"bitset":this.#c.grow(a);break;case"multi":break;default:this.#a.length=a;break}this.#g&&this.#g.grow(a),this.#b=a,this.#y++}}convert(a){if(this.#A||!c.has(a)||(this.#n=a,!this.#l||a===this.#t))return!1;const h={kind:this.#t,buf:this.#a,bits:this.#c,mv:this.#u,dict:this.#f},w=this.#s.physical(),v=this.#g;this.#t=a,this.#S(this.#b);for(let A=0;A<w;A++){const _=v!==null&&v.get(A)===0;_&&a!=="multi"||this.#P(A,_?null:s(h,A))}return this.#C(),this.#y++,!0}compact(a,h,w){if(!this.#A){if(this.#C(),!this.#l){const v=this.#O;if(v.size){const A=new Map;for(const[_,V]of v)a[_]!==g&&A.set(a[_],V);this.#O=A}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const v=this.#a;for(let A=0;A<h;A++)a[A]!==g&&(v[a[A]]=v[A]);if(this.#t==="object")for(let A=w;A<h;A++)v[A]=void 0;break}case"bitset":{const v=this.#c;for(let A=0;A<h;A++)a[A]!==g&&v.assign(a[A],v.get(A)===1);for(let A=w;A<h;A++)v.clear(A);break}case"multi":this.#u.compact(a,w,g);break;default:break}if(this.#g){const v=this.#g;for(let A=0;A<h;A++)a[A]!==g&&v.assign(a[A],v.get(A)===1);for(let A=w;A<h;A++)v.clear(A)}this.#y++}}release(){this.#A||(this.#A=!0,this.#a=null,this.#c&&this.#c.release(),this.#c=null,this.#u&&this.#u.release(),this.#u=null,this.#g&&this.#g.release(),this.#g=null,this.#f=null,this.#d=null,this.#O=new Map,this.#w=null,this.#b=0,this.#y++)}#S(a){const h=Math.max(1,a);switch(this.#a=null,this.#c=null,this.#u=null,this.#t){case"float64":this.#a=new Float64Array(h);break;case"int32":this.#a=new Int32Array(h);break;case"bitset":this.#c=new I(h);break;case"dictionary":this.#a=new Uint32Array(h),this.#f=this.#f??new R(this.#o??[]);break;case"multi":this.#u=new k({rows:h,values:h}),this.#f=this.#f??new R(this.#o??[]);break;default:this.#a=new Array(h);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#f=null),this.#r&&(this.#g?this.#g.grow(h):this.#g=new I(h)),this.#b=h}#P(a,h){const w=f(h);switch(this.#r?this.#g.assign(a,!w):w&&M(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#t){case"float64":this.#a[a]=w?NaN:n(h);break;case"int32":this.#a[a]=w?0:m(h);break;case"bitset":this.#c.assign(a,!w&&!!h);break;case"dictionary":this.#a[a]=w?0:this.#f.codeOf(h);break;case"multi":{const v=r(h),A=new Array(v.length);for(let _=0;_<v.length;_++)A[_]=this.#f.codeOf(v[_]);this.#u.write(a,A);break}default:this.#a[a]=w?null:h;break}}#E(a){if(this.#O.has(a))return this.#O.get(a);const h=this.#i(this.#s.rowAt(a));return h===void 0?null:h}#T(){if(this.#w&&this.#w.version===this.#y)return this.#w;const a=this.#s.physical(),h=new Array(a),w=this.#r?new I(a):null;for(let v=0;v<a;v++){const A=this.#E(v);h[v]=A,w&&!f(A)&&w.set(v)}return this.#w={version:this.#y,values:h,presence:w},this.#w}}class u{#e;#t=new Map;#n=[];#r=[];#i=0;#s=0;#o=0;#l=0;#a=new I(0);#c=!1;#u=!0;#f;#d;#h;#p=!1;constructor(a,h={}){this.#e=Array.isArray(a)?a:[],this.#d=Math.max(1,h.initialCapacity??i),this.#u=h.retainSource!==!1,this.#f=this.#u?h.columnarBelow??t:0,this.#h=h.compactRatio??o;const w={rowAt:v=>this.#r[v],physical:()=>this.#i};for(const v of this.#e){if(!v||!v.id)continue;if(this.#t.has(v.id)){M(`store.dup.${v.id}`,`duplicate column id "${v.id}" in the store schema; ignoring the second`);continue}const A=new p(v,w);this.#t.set(v.id,A),this.#n.push(A)}this.#f<=0&&this.#b()}get count(){return this.#o}get physical(){return this.#i}get capacity(){return this.#c?this.#s:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let a=this.#a.bytes+this.#r.length*8;for(const h of this.#n)a+=h.bytes;return a}append(a){const h=this.#i;if(this.#p||!a)return{from:h,to:h};const w=a.length|0;if(w===0)return{from:h,to:h};if(this.#u)for(let A=0;A<w;A++)this.#r[h+A]=a[A];if(this.#i=h+w,this.#o+=w,this.#a.grow(this.#i),!this.#c){if(this.#i>=this.#f)this.#b();else for(const A of this.#n)A.touch();return{from:h,to:this.#i}}this.#m(this.#i);const v=this.#n;for(let A=0;A<v.length;A++)v[A].appendColumn(a,h,w);return{from:h,to:this.#i}}appendPacked(a,h){const w=this.#i;if(this.#p||!a)return{from:w,to:w};const v=a.count|0;if(v===0)return{from:w,to:w};if(this.#u&&h)for(let _=0;_<v;_++)this.#r[w+_]=h[_];this.#i=w+v,this.#o+=v,this.#a.grow(this.#i),this.#c||this.#b(),this.#m(this.#i);const A=new Map;for(const _ of a.columns)A.set(_.id,_);for(const _ of this.#n){const V=A.get(_.id);V?_.appendPacked(V,w,v):_.grow(this.#s)}return{from:w,to:this.#i}}source(a){if(this.#u)return this.#r[a];if(!(a<0||a>=this.#i))return this.#g(a)}setSource(a,h){this.#p||a<0||a>=this.#i||this.#u&&(this.#r[a]=h)}get(a,h){const w=this.#t.get(a);return w?w.get(h):void 0}set(a,h,w){if(this.#p||h<0||h>=this.#i)return;const v=this.#t.get(a);if(!v){M(`store.set.${a}`,`set() on unknown column "${a}"`);return}v.set(h,w)}remove(a){return this.#p||a<0||a>=this.#i||this.#a.get(a)===1?!1:(this.#a.set(a),this.#l++,this.#o--,!0)}live(a){return a<0||a>=this.#i?!1:this.#a.get(a)===0}compact(a={}){if(this.#p||this.#l===0||!a.force&&this.#l/this.#i<this.#h)return null;const h=this.#i,w=new Uint32Array(h);let v=0;for(let A=0;A<h;A++)w[A]=this.#a.get(A)===1?g:v++;for(const A of this.#n)A.compact(w,h,v);if(this.#u){const A=this.#r;for(let _=0;_<h;_++)w[_]!==g&&(A[w[_]]=A[_]);A.length=v}return this.#i=v,this.#o=v,this.#l=0,this.#a=new I(Math.max(this.#s,v)),w}column(a){return this.#t.get(a)}columns(){return this.#n.slice()}liveIndices(){const a=new Uint32Array(this.#o);if(this.#l===0){for(let w=0;w<this.#i;w++)a[w]=w;return a}let h=0;for(let w=0;w<this.#i;w++)this.#a.get(w)===0&&(a[h++]=w);return a}convert(a,h){const w=this.#t.get(a);return w?w.convert(h):!1}destroy(){if(!this.#p){this.#p=!0;for(const a of this.#n)a.release();this.#t.clear(),this.#n.length=0,this.#r.length=0,this.#a.release(),this.#i=0,this.#o=0,this.#l=0,this.#s=0}}#m(a){if(a<=this.#s)return;let h=this.#s||this.#d;for(;h<a;)h*=2;for(const w of this.#n)w.grow(h);this.#a.grow(h),this.#s=h}#g(a){const h={};for(const w of this.#n)h[w.id]=w.get(a);return h}#b(){if(this.#c)return;let a=this.#d;for(;a<this.#i;)a*=2;this.#c=!0,this.#s=a,this.#a.grow(a);for(const h of this.#n)h.columnarise(a,this.#i)}}}),Be("packages/core/src/store/pool.js",function(e,D){"use strict";Object.defineProperty(e,"MaskPool",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"sharedPool",{enumerable:!0,get:function(){return x}});const re=64,M=8;function G(W){let I=re;for(;I<W;)I*=2;return I}class F{#e=new Map;#t=new WeakSet;#n;#r=0;#i={acquired:0,reused:0,released:0};constructor(I={}){this.#n=I.limit??M}get bytes(){return this.#r}mask(I){const K=new Uint8Array(this.#s(I),0,I);return K.fill(0),K}indices(I){return new Uint32Array(this.#s(I*4),0,I)}release(I){if(!I||!I.buffer)return!1;const K=I.buffer;if(!this.#t.has(K))return!1;this.#t.delete(K),this.#i.released++;const R=K.byteLength;let S=this.#e.get(R);return S||this.#e.set(R,S=[]),S.length>=this.#n||(S.push(K),this.#r+=R),!0}releaseAll(I){for(const K of I)this.release(K)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#i,retained:this.#r}}#s(I){const K=G(I),R=this.#e.get(K);this.#i.acquired++;let S;return R&&R.length?(S=R.pop(),this.#r-=K,this.#i.reused++):S=new ArrayBuffer(K),this.#t.add(S),S}}function x(){return q??=new F,q}let q=null}),Be("packages/core/src/compute/sortspec.js",function(e,D){"use strict";Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return x}});function re(q){return{locale:q===void 0?void 0:String(q),numeric:!0,sensitivity:"variant"}}function M(q){return!!q&&typeof q.compare!="function"}function G(q){if(!q)return!0;for(let W=0;W<q.length;W++)if(!M(q[W]))return!1;return!0}function F(q,W){const I=q.col!==void 0?q.col:q.handle&&q.handle.id,K=q.locale!==void 0?q.locale:W;return{col:I,descending:q.descending!==void 0?!!q.descending:q.dir==="desc",nullsFirst:!!q.nullsFirst,collation:re(K)}}function x(q,W){const I=q||[],K=new Array(I.length);for(let R=0;R<I.length;R++)K[R]=F(I[R],W);return K}}),Be("packages/core/src/compute/facet.js",function(e,D){"use strict";Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"orderedReader",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"toNumeric",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return w}});const re=D("packages/core/src/compute/handle.js"),M=re.presenceReader,G=re.valueReader,F=re.dictSize,x=re.dictValue,q=Object.freeze(["equal","quantile","log"]),W=Object.freeze(["hour","day","week","month","quarter","year"]),I=20,K=50,R=1e4;function S(v,A){if(!v)return"none";const _=A;if(_&&(_.multi===!0||typeof _.items=="function"))return"category";const V=A&&A.base;if(V==="date"||V==="datetime"||V==="time"||V==="dateString")return"date";switch(v.kind){case"bitset":return"boolean";case"float64":case"int32":return"numeric";case"dictionary":return"category";case"multi":return"category";default:return V==="number"?"numeric":V==="boolean"?"boolean":V==="text"?"category":"none"}}function k(v){const A=v.values,_=v.kind;if((_==="float64"||_==="int32")&&A)return Y=>A[Y];const V=G(v);return Y=>y(V(Y))}function y(v){if(typeof v=="number")return v;if(v instanceof Date)return v.getTime();if(v==null||v==="")return NaN;if(typeof v=="boolean")return v?1:0;if(typeof v=="string"){const A=Number(v);if(Number.isFinite(A))return A;const _=Date.parse(v);return Number.isFinite(_)?_:NaN}return NaN}function l(v,A,_,V=K){if(!v)return{cardinality:0,exact:!0};if(v.dict)return{cardinality:F(v.dict),exact:!0};if(v.kind==="bitset")return{cardinality:2,exact:!0};const Y=G(v),$=A?A.length:_,j=new Set;for(let E=0;E<$;E++){const O=Y(A?A[E]:E);if(O!=null&&(j.add(O),j.size>V))return{cardinality:j.size,exact:!1}}return{cardinality:j.size,exact:!0}}const g=36e5,i=864e5;function t(v,A=I){const _=Number.isFinite(v)&&v>0?v:0,V=Math.max(1,A)*2;return _/g<=V?"hour":_/i<=V?"day":_/(7*i)<=V?"week":_/(30*i)<=V?"month":_/(91*i)<=V?"quarter":"year"}function o(v,A){if(!Number.isFinite(v))return NaN;const _=new Date(v);switch(A){case"hour":return _.setMinutes(0,0,0),_.getTime();case"day":return _.setHours(0,0,0,0),_.getTime();case"week":{_.setHours(0,0,0,0);const V=(_.getDay()+6)%7;return _.setDate(_.getDate()-V),_.getTime()}case"month":return _.setDate(1),_.setHours(0,0,0,0),_.getTime();case"quarter":return _.setMonth(Math.floor(_.getMonth()/3)*3,1),_.setHours(0,0,0,0),_.getTime();default:return _.setMonth(0,1),_.setHours(0,0,0,0),_.getTime()}}function c(v,A){const _=new Date(v);switch(A){case"hour":_.setHours(_.getHours()+1);break;case"day":_.setDate(_.getDate()+1);break;case"week":_.setDate(_.getDate()+7);break;case"month":_.setMonth(_.getMonth()+1);break;case"quarter":_.setMonth(_.getMonth()+3);break;default:_.setFullYear(_.getFullYear()+1);break}return _.getTime()}function f(v,A,_){const V=k(v),Y=M(v),$=A?A.length:_;let j=1/0,E=-1/0,O=0,N=0;for(let T=0;T<$;T++){const C=A?A[T]:T;if(Y&&!Y(C)){O++;continue}const B=V(C);if(!Number.isFinite(B)){O++;continue}B<j&&(j=B),B>E&&(E=B),N++}return{min:j,max:E,nulls:O,finite:N}}function n(v,A,_,V){const Y=k(v),$=M(v),j=A?A.length:_,E=j>V?j/V:1,O=[];for(let T=0;T<j;T+=E){const C=A?A[Math.floor(T)]:Math.floor(T);if($&&!$(C))continue;const B=Y(C);Number.isFinite(B)&&O.push(B)}const N=Float64Array.from(O);return N.sort(),N}function m(v,A,_,V={}){const Y=V.kind||S(v,V.type);return Y==="none"||!v?{kind:"none",buckets:[],suppressed:"type"}:Y==="boolean"?r(v,A,_):Y==="category"?s(v,A,_,V):p(v,A,_,Y,V)}function r(v,A,_){const V=M(v);let Y=0;if(V){const j=A?A.length:_;for(let E=0;E<j;E++)V(A?A[E]:E)||Y++}const $=[{value:!1,label:"false"},{value:!0,label:"true"}];return Y>0&&$.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:$}}function s(v,A,_,V){const Y=V.cardinalityLimit??K,{cardinality:$}=l(v,A,_,Y);if($>Y&&(V.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:$};const j=G(v),E=A?A.length:_,O=new Map;let N=0;for(let X=0;X<E;X++){const Q=j(A?A[X]:X);if(Q==null||Q===""){N++;continue}if(Array.isArray(Q)){if(!Q.length){N++;continue}for(const H of Q)O.set(H,(O.get(H)||0)+1);continue}O.set(Q,(O.get(Q)||0)+1)}let T=[...O.entries()];V.order==="alpha"?T.sort((X,Q)=>String(X[0]).localeCompare(String(Q[0]))):T.sort((X,Q)=>Q[1]-X[1]);let C=0,B=0;if(T.length>Y){B=T.length-Y;for(let X=Y;X<T.length;X++)C+=T[X][1];T=T.slice(0,Y)}const z=T.map(([X])=>({value:X,label:String(X)}));return C>0&&z.push({remainder:!0,label:`Other (${B} values)`}),N>0&&z.push({null:!0,label:"Empty"}),{kind:"category",buckets:z,cardinality:$}}function d(v,A,_,V,Y){const $=n(v,A,_,R),j=$.length;if(j<100)return null;const E=$[Math.floor(.01*j)],O=$[Math.ceil(.99*j)-1];return!(O>E)||Y-V<=2*(O-E)?null:{lo:E,hi:O}}function p(v,A,_,V,Y){const{min:$,max:j,nulls:E,finite:O}=f(v,A,_);if(!O)return{kind:V,buckets:E?[{null:!0,label:"Empty"}]:[],empty:!0};const N=Math.max(1,Math.floor(Y.buckets||I));let T=[];if(V==="date"){const B=W.includes(Y.granularity)?Y.granularity:t(j-$,N);let z=o($,B);for(;z<=j&&T.length<4096;){const X=c(z,B);if(!(X>z))break;T.push({from:z,to:X}),z=X}return{kind:V,buckets:u(T,E),granularity:B}}const C=q.includes(Y.strategy)?Y.strategy:"equal";if(C==="quantile"){const B=n(v,A,_,R);if(B.length){const z=[B[0]];for(let X=1;X<N;X++){const Q=B[Math.min(B.length-1,Math.floor(X/N*B.length))];Q>z[z.length-1]&&z.push(Q)}z.push(j);for(let X=0;X<z.length-1;X++)T.push({from:z[X],to:z[X+1]})}}else if(C==="log"&&$>0){const B=Math.log10($),X=(Math.log10(j)-B)/N||1;for(let Q=0;Q<N;Q++)T.push({from:10**(B+Q*X),to:10**(B+(Q+1)*X)})}if(!T.length&&C==="equal"){const B=d(v,A,_,$,j);if(B){const z=(B.hi-B.lo)/N;B.lo>$&&T.push({from:$,to:B.lo,overflow:"low"});for(let X=0;X<N;X++)T.push({from:B.lo+X*z,to:B.lo+(X+1)*z});T[T.length-1].to=B.hi,B.hi<j&&T.push({from:B.hi,to:j,overflow:"high"})}}if(!T.length){const B=(j-$)/N||1;for(let z=0;z<N;z++)T.push({from:$+z*B,to:$+(z+1)*B})}return T[T.length-1].to=j,{kind:V,buckets:u(T,E),strategy:C,min:$,max:j}}function u(v,A){return A>0?[...v,{null:!0,label:"Empty"}]:v}function b(v,A,_,V,Y){const $=V&&V.buckets||[],j=Y&&Y.length>=$.length?Y.subarray(0,$.length):new Uint32Array($.length);if(j.fill(0),!v||!$.length)return j;const E=$.length-1,O=!!$[E]&&$[E].null===!0,N=A?A.length:_;if(V.kind==="boolean"){const X=G(v);for(let Q=0;Q<N;Q++){const H=X(A?A[Q]:Q);if(H==null){O&&j[E]++;continue}j[H?1:0]++}return j}if(V.kind==="category"){const X=new Map;for(let L=0;L<$.length;L++)!$[L].null&&!$[L].remainder&&X.set($[L].value,L);const Q=$.findIndex(L=>L.remainder),H=G(v);for(let L=0;L<N;L++){const Z=H(A?A[L]:L);if(Z==null||Z===""){O&&j[E]++;continue}if(Array.isArray(Z)){if(!Z.length){O&&j[E]++;continue}for(const te of Z){const se=X.get(te);se!==void 0?j[se]++:Q>=0&&j[Q]++}continue}const ee=X.get(Z);ee!==void 0?j[ee]++:Q>=0&&j[Q]++}return j}const T=O?$.length-1:$.length,C=new Float64Array(T+1);for(let X=0;X<T;X++)C[X]=$[X].from;C[T]=T?$[T-1].to:0;const B=k(v),z=M(v);for(let X=0;X<N;X++){const Q=A?A[X]:X;if(z&&!z(Q)){O&&j[E]++;continue}const H=B(Q);if(!Number.isFinite(H)){O&&j[E]++;continue}const L=a(C,T,H);L>=0&&j[L]++}return j}function a(v,A,_){if(!A||_<v[0])return-1;if(_>=v[A])return _===v[A]?A-1:-1;let V=0,Y=A-1;for(;V<Y;){const $=V+Y+1>>>1;_>=v[$]?V=$:Y=$-1}return V}function h(v,A,_,V={}){const Y=V.bounds||m(v,V.boundsIndices??A,_,V);return{bounds:Y,counts:b(v,A,_,Y)}}const w=h}),Be("packages/core/src/compute/pivotmatrix.js",function(e,D){"use strict";Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return o}});const M=D("packages/core/src/compute/handle.js").valueComparator,F=D("packages/core/src/compute/total.js").total,q=D("packages/core/src/compute/group.js").packKeys,W=D("packages/core/src/compute/pivot.js"),I=W.joinPath,K=W.DEFAULT_PATH_SEPARATOR,R=W.DEFAULT_MAX_COLUMNS,S="";function k(c,f,n={}){const m=n.separator||K,r=c||[],s=f instanceof Uint32Array?f:Uint32Array.from(f||[]),d=s.length;if(r.length===0)return{tuples:[[]],paths:[S],buckets:[s]};const{keyOf:p,readers:u}=q(r,s,0),b=new Map,a=[],h=[],w=[];for(let $=0;$<d;$++){const j=s[$],E=p(j);let O=b.get(E);if(O===void 0){O=a.length,b.set(E,O),h.push(E);const N=new Array(u.length);for(let T=0;T<u.length;T++)N[T]=u[T](j);a.push(N),w.push([])}w[O].push(j)}const v=M(n.locale),A=a.map(($,j)=>j);A.sort(($,j)=>{const E=a[$],O=a[j];for(let N=0;N<E.length;N++){const T=y(E[N],O[N],v);if(T!==0)return T}return $-j});const _=new Array(A.length),V=new Array(A.length),Y=new Array(A.length);for(let $=0;$<A.length;$++){const j=A[$];_[$]=a[j],V[$]=I(a[j],m),Y[$]=Uint32Array.from(w[j])}return{tuples:_,paths:V,buckets:Y}}function y(c,f,n){const m=c==null,r=f==null;return m||r?m&&r?0:m?1:-1:n(c,f)}function l(c,f,n){const m=[];for(let r=0;r<c.length;r++)n.has(c[r])&&m.push(c[r]);return Uint32Array.from(m)}function g(c,f,n,m){return{value:f.length?F(c,f,n,m):null,leaves:f,count:f.length}}function i(c){const f=c&&c.opts||{},n=f.separator||K,m=f.totalContext||{locale:f.locale},r=(c.measures||[]).filter(V=>V&&V.handle),s=c.leaves instanceof Uint32Array?c.leaves:Uint32Array.from(c.leaves||[]),d=k(c.rowHandles||[],s,{...f,separator:n}),p=k(c.columnHandles||[],s,{...f,separator:n}),u=f.maxColumns===void 0?R:f.maxColumns,b=p.paths.length*Math.max(1,r.length),a=new Map;if(u&&b>u)return{rowAxis:d,columnAxis:p,measures:r.map(V=>({colId:V.colId,fn:V.fn})),body:a,rowMargin:a,columnMargin:a,grand:a,columns:b,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${b} columns, above pivot.maxColumns of ${u}. Narrow the pivot columns or raise the limit.`,columns:b,maxColumns:u}};const h=new Map,w=new Map,v=new Map,A=new Map,_=p.buckets.map(V=>new Set(V));for(let V=0;V<p.paths.length;V++){const Y=p.buckets[V],$=p.paths[V];for(const j of r)v.set(o($,j.colId),g(j.handle,Y,j.fn,m))}for(let V=0;V<d.paths.length;V++){const Y=d.buckets[V],$=d.paths[V];for(const j of r)w.set(o($,j.colId),g(j.handle,Y,j.fn,m));for(let j=0;j<p.paths.length;j++){const E=l(Y,p.buckets[j],_[j]);if(E.length===0)continue;const O=p.paths[j];for(const N of r)h.set(t($,O,N.colId),g(N.handle,E,N.fn,m))}}for(const V of r)A.set(V.colId,g(V.handle,s,V.fn,m));return{rowAxis:d,columnAxis:p,measures:r.map(V=>({colId:V.colId,fn:V.fn})),body:h,rowMargin:w,columnMargin:v,grand:A,columns:b,error:null}}function t(c,f,n){return`${c}\0${f}\0${n}`}function o(c,f){return`${c}\0${f}`}}),Be("packages/core/src/compute/reference.js",function(e,D){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return i}});const M=D("packages/core/src/internal/paths.js").getPath,G=D("packages/core/src/compute/handle.js"),F=G.isMissing,x=G.valueComparator,W=D("packages/core/src/compute/filter.js").testValue,I="",K="\0";function R(c,f){const n=f.includes(".")?M(c,f):c?.[f];return n===void 0?null:n}function S(c,f,n={}){const m=f||[];let r=c.map((s,d)=>d);if(m.length===0)return r;for(let s=m.length-1;s>=0;s--)r=k(c,r,m[s],n);return r}function k(c,f,n,m){const r=n.locale!==void 0?n.locale:m.locale,s=x(r),d=n.descending!==void 0?!!n.descending:n.dir==="desc",p=[],u=[];for(const h of f){const w=R(c[h],n.col);F(w)?u.push(h):p.push(h)}const b=new Map;for(let h=0;h<p.length;h++)b.set(p[h],h);const a=(h,w)=>{const v=R(c[h],n.col),A=R(c[w],n.col);let _;return typeof n.compare=="function"?(_=n.compare(v,A,c[h],c[w],d),d&&(_=-_)):_=d?s(A,v):s(v,A),_!==0?_:b.get(h)-b.get(w)};return p.sort(a),n.nullsFirst?u.concat(p):p.concat(u)}function y(c,f,n={}){const m=[];for(let r=0;r<c.length;r++)l(c[r],f,n,r)&&m.push(r);return m}function l(c,f,n,m){if(!f)return!0;if(Array.isArray(f.conditions)){const r=f.conditions.filter(d=>d!=null);if(r.length===0)return!0;if(f.op==="or")return r.some(d=>l(c,d,n,m));const s=r.every(d=>l(c,d,n,m));return f.op==="not"?!s:s}return f.col===void 0&&typeof n.custom=="function"?!!n.custom(f,c,m):W(R(c,f.col),f,n.locale)}function g(c,f,n,m){const r=n||c.map((u,b)=>b),s=new Map,d=[],p=[];for(const u of r){const b=f.map((w,v)=>{const A=R(c[u],w);return m&&m[v]?m[v](A):A}),a=b.map(w=>w==null?K:String(w)).join(I);let h=s.get(a);h===void 0&&(h=d.length,s.set(a,h),d.push(b),p.push([])),p[h].push(u)}return{keys:d,buckets:p}}function i(c,f,n={}){const m=x(n.locale),r=c.filter(d=>!F(d)),s=r.map(t).filter(d=>d!==null);switch(f){case"count":return c.length;case"countValues":return r.length;case"sum":return s.reduce((d,p)=>d+p,0);case"avg":return r.length===0?null:s.reduce((d,p)=>d+p,0)/r.length;case"min":return r.length===0?null:r.reduce((d,p)=>m(p,d)<0?p:d);case"max":return r.length===0?null:r.reduce((d,p)=>m(p,d)>0?p:d);case"first":return c.length===0?null:o(c[0]);case"last":return c.length===0?null:o(c[c.length-1]);default:return null}}function t(c){if(typeof c=="number")return Number.isNaN(c)?null:c;if(c==null||c===""||typeof c=="boolean")return null;if(c instanceof Date)return c.getTime();const f=Number(c);return Number.isNaN(f)?null:f}function o(c){return c===void 0?null:c}}),Be("packages/core/src/compute/index.js",function(e,D){"use strict";const re=D("packages/core/src/compute/sort.js");Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return re.sortColumn}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return re.sortMulti}}),Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return re.radixSortFloat64}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return re.radixSortInt32}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return re.rankSortDictionary}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return re.mergeSortComparator}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return re.collateStringRanks}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return re.rankSortStrings}});const M=D("packages/core/src/compute/sortspec.js");Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return M.collationDescriptor}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return M.isPortableSort}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return M.isPortableSortSet}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return M.describeSortEntry}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return M.describeSort}});const G=D("packages/core/src/compute/filter.js");Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return G.evaluateFilters}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return G.evaluateCondition}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return G.compact}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return G.testValue}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return G.compilePredicate}}),Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return G.releaseMask}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return G.pruneColumn}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return G.mentionsColumn}});const F=D("packages/core/src/compute/group.js");Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return F.groupByColumns}}),Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return F.packKeys}});const x=D("packages/core/src/compute/facet.js");Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return x.facet}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return x.computeBounds}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return x.countInto}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return x.bucketOf}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return x.facetKind}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return x.cardinalityOf}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return x.pickGranularity}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return x.floorTo}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return x.advance}}),Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return x.STRATEGIES}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return x.GRANULARITIES}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return x.DEFAULT_BUCKETS}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return x.DEFAULT_CARDINALITY_LIMIT}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return x.QUANTILE_SAMPLE}});const q=D("packages/core/src/compute/total.js");Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return q.TOTAL_FNS}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return q.TOTAL_LABELS}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return q.totalLabel}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return q.total}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return q.collectValues}});const W=D("packages/core/src/compute/pivot.js");Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return W.pivot}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return W.resolvePivotKeys}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return W.pivotKey}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return W.joinPath}}),Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return W.KEY_DELIMITER}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return W.DEFAULT_PATH_SEPARATOR}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return W.DEFAULT_MAX_COLUMNS}});const I=D("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return I.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return I.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return I.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return I.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return I.GRAND_PATH}});const K=D("packages/core/src/compute/reference.js");Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return K.referenceSort}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return K.referenceFilter}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return K.referenceGroup}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return K.referenceTotal}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return K.referencePasses}}),Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return K.referenceValue}});const R=D("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return R.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return R.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return R.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return R.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return R.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return R.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return R.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return R.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return R.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return R.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return R.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return R.isMissing}});const S=D("packages/core/src/compute/sketch.js");Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return S.Welford}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return S.Reservoir}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return S.HyperLogLog}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return S.SpaceSaving}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return S.KLL}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return S.hash32}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return S.SKETCH_BOUNDS}});const k=D("packages/core/src/compute/windowed.js");Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return k.Window}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return k.WINDOW_KINDS}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return k.openWindow}});const y=D("packages/core/src/compute/statistics.js");Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return y.MAINTENANCE}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return y.APPROXIMATE}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return y.maintenanceOf}});const l=D("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return l.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return l.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return l.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return l.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return l.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return l.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return l.anomalyCondition}});const g=D("packages/core/src/compute/forecast.js");Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return g.FORECAST_METHODS}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return g.forecast}})}),Be("packages/core/src/source/rows.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_ROW_HEIGHT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"KEY_SEP",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"groupPrefixKeys",{enumerable:!0,get:function(){return g}});const M=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/internal/predicates.js").isFunction,x=32,q="\0";function W(i){return new I(i)}class I{#e;#t;constructor(t){this.#e=F(t&&t.rowKey)?t.rowKey:null;const o=t&&t.config?t.config.rowHeight:void 0;this.#t=typeof o=="number"||F(o)?o:x}get keyed(){return this.#e!==null}keyOf(t,o){if(this.#e){const c=this.#e(t);if(c!=null)return String(c)}else M("source.rowKey.missing","no config.rowKey; falling back to index identity.","Row changes, streaming dedupe, selection persistence and remote reload are disabled.");return`#${o}`}heightOf(t){return F(this.#t)?Number(this.#t(t))||x:this.#t}leaf(t,o,c=0,f=null){const n={key:this.keyOf(t,o),data:t,level:c,parent:f,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:o};return n.height=this.heightOf(n),n}group(t){const o={key:l(t.keyPath||t.path),data:null,level:t.level,parent:t.parent||null,children:[],group:!0,expanded:t.expanded!==!1,leafCount:t.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:t.column,groupValue:t.value,groupPath:t.path,hasChildren:t.hasChildren!==!1};return t.totals&&(o.totals=t.totals),o.height=this.heightOf(o),o}footer(t){const o={key:`${t.key}${q}footer`,data:null,level:t.level,parent:t,group:!0,footer:!0,expanded:!1,leafCount:t.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:t.groupColumn,groupValue:t.groupValue,groupPath:t.groupPath,hasChildren:!1,totals:t.totals};return o.height=this.heightOf(o),o}detail(t,o){return{key:`${t.key}${q}detail`,data:t.data,level:t.level+1,parent:t,group:!1,detail:!0,expanded:!1,leafCount:0,height:o,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:t.key}}grandTotal(t,o){const c={key:`${q}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:o,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:t};return c.height=this.heightOf(c),c}skeleton(t,o=0,c=!1){const f={key:`${q}pending${q}${t}`,data:null,level:o,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:t,selected:!1,physical:null,pending:!0};return c&&(f.loadError=!0),f.height=this.heightOf(f),f}}function K(i,t,o,c){return{key:`${q}pinned${q}${o}${q}${t}`,data:i,level:0,parent:null,group:!1,expanded:!1,leafCount:0,height:c,index:null,selected:!1,physical:null,hasChildren:!1,pinned:o}}function R(i,t){return new Proxy([],{get(o,c,f){if(c==="length")return i();if(typeof c=="string"){const n=Number(c);if(Number.isInteger(n)&&n>=0)return t(n)}return Reflect.get(o,c,f)},has(o,c){if(typeof c=="string"){const f=Number(c);if(Number.isInteger(f)&&f>=0)return f<i()}return Reflect.has(o,c)}})}function S(i){return i==null?"":String(i)}const k="";function y(i){if(i==null)return k;const t=String(i);return t.startsWith(k)?k+t:t}function l(i){const t=i||[];let o="g";for(let c=0;c<t.length;c++)o+=q+y(t[c]);return o}function g(i){const t=new Array(i.length),o=[];for(let c=0;c<i.length;c++)o.push(i[c]),t[c]=l(o);return t}}),Be("packages/core/src/source/handles.js",function(e,D){"use strict";Object.defineProperty(e,"HandleProvider",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"createHandleProvider",{enumerable:!0,get:function(){return q}});const M=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce;class x{#e;#t;#n;#r=new Map;#i=0;constructor(I,K,R){this.#e=I,this.#t=K,this.#n=M(R)?R:()=>!1}get store(){const I=this.#e.store;return I&&M(I.column)?I:null}invalidate(){this.#i++}handle(I){const K=this.store;if(K){const y=K.column(I);if(y)return y}const R=this.#r.get(I);if(R&&R.builtAt===this.#i)return R.handle;const S=this.#s(I);if(!S)return;if(K&&this.#n()){F(`source.dropped.${I}`,`column "${I}" cannot be served under ingest.dropSourceRows: it is an impure computed column (a shadow or a positional/rank column) that is never stored, so it can only be read from the caller's row objects — which dropSourceRows has released. Do not sort, filter, group or total on such a column with dropSourceRows enabled.`);return}const k=this.#o(S);return this.#r.set(I,{handle:k,builtAt:this.#i}),k}#s(I){const K=this.#e.columns;return K&&M(K.get)?K.get(I):void 0}#o(I){const K=this.#t()||[],R=K.length,S=new Array(R),k=M(I.getValue)?l=>I.getValue(l):l=>l?.[I.field||I.id];for(let l=0;l<R;l++)S[l]=K[l]===void 0?void 0:k(K[l]);const y=this.#i;return{id:I.id,kind:"object",nullable:!1,values:S,presence:null,dict:null,offsets:null,get(l){return S[l]},version:y}}}function q(W,I,K){return new x(W,I,K)}}),Be("packages/core/src/compute/incremental.js",function(e,D){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return K}});const M=D("packages/core/src/store/columnstore.js").toFloat,G=Object.freeze(["sum","avg","countValues","min","max"]),F=Object.freeze(["float64"]),x=1e15;function q(R,S){return typeof R!="string"||!G.includes(R)?!1:!!S&&F.includes(S.kind)}function W(R){if(R==null)return null;const S=M(R);return Number.isNaN(S)?null:S}class I{#e;#t=0;#n=0;#r=0;#i=1/0;#s=-1/0;#o=!1;#l=!1;constructor(S){this.#e=S}get valid(){return this.#o&&!this.#l}get fn(){return this.#e}seed(S){this.#a();for(let k=0;k<S.length;k++){const y=W(S[k]);y!==null&&this.#c(y)}this.#o=!0}seedColumn(S,k,y){this.#a();for(let l=0;l<y.length;l++){const g=y[l];if(k&&k(g)===0)continue;const i=S[g];Number.isNaN(i)||this.#c(i)}this.#o=!0}#a(){this.#t=0,this.#n=0,this.#r=0,this.#i=1/0,this.#s=-1/0,this.#l=!1}#c(S){if(!Number.isFinite(S)){this.#l=!0;return}const k=this.#t+S;this.#n+=Math.abs(this.#t)>=Math.abs(S)?this.#t-k+S:S-k+this.#t,this.#t=k,this.#r++,S<this.#i&&(this.#i=S),S>this.#s&&(this.#s=S)}#u(S){const k=this.#t-S;this.#n+=Math.abs(this.#t)>=Math.abs(S)?this.#t-k-S:-S-k+this.#t,this.#t=k,this.#r--}update(S,k){if(!this.#o)return!1;const y=W(S),l=W(k);return y===null&&l===null?!0:y!==null&&!Number.isFinite(y)||l!==null&&!Number.isFinite(l)?!1:this.#e==="min"||this.#e==="max"?y===null||l===null?!1:this.#e==="min"?l<this.#i?(this.#i=l,!0):y>this.#i:l>this.#s?(this.#s=l,!0):y<this.#s:Math.abs(this.#t)>x?!1:(y!==null&&this.#u(y),l!==null&&this.#c(l),!0)}value(){switch(this.#e){case"countValues":return this.#r;case"avg":return this.#r?(this.#t+this.#n)/this.#r:null;case"min":return this.#r?this.#i:null;case"max":return this.#r?this.#s:null;default:return this.#t+this.#n}}invalidate(){this.#o=!1}}const K=I}),Be("packages/core/src/source/filterwire.js",function(e,D){"use strict";Object.defineProperty(e,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"resolveRelativeRange",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"relativeTokenOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"relativeTokenHelp",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"isResolvableRelative",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"resolveRelativeCondition",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"forEachCondition",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"mapConditions",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"normaliseFilterSet",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"buildFilterSet",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"wireFilters",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"querySignature",{enumerable:!0,get:function(){return v}});const M=D("packages/core/src/internal/warn.js").warnOnce,G="source.remote.hostFilter",F="source.where.pageRelative";function x(V,Y){!Array.isArray(V)||!V.length||M(F,`filters.where (${V.join(", ")}) runs over the rows the ${Y} source fetched,`,"not the whole dataset: match counts and totals are page-relative.","Give the predicate a { condition } twin so the engine can narrow the fetch itself.")}function q(V){const Y=(V||{}).config;!Y||!Y.hostFilter||M(G,"config.hostFilter is not sent to a server-delegated source (paged/remote) and is not applied:","filtering only the fetched window would give wrong counts and totals.","Express the filter as a FilterSet condition, or send it through config.context.")}const W="source.where.notApplied";function I(V,Y){M(`${W}:${V}`,`filters.where("${V}") is registered but the ${Y} source holds only its fetched window`,"and cannot run the predicate over it: the predicate is not applied there, and rows it would","exclude stay on screen.","Give it a { condition } twin so the engine can narrow the fetch itself — that is the","supported route for a paged or remote source.")}const K="source.where.overThreshold";function R(V,Y,$,j){!Array.isArray(V)||!V.length||M(`${K}:${Y}`,`filters.where (${V.join(", ")}) is not applied to the ${Y} pushdown source:`,$===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${$.toLocaleString()} rows, at or past the whereRowLimit of ${j.toLocaleString()}.`,"Running the predicate needs every matching row fetched and held here, which is the whole","download a pushdown source exists to avoid, so it is refused and the rows the predicate","would exclude stay on screen.","Give the predicate a { condition } twin so the engine narrows the fetch itself — that is the","route that works at any size — or raise `whereRowLimit` on the source config if you want the","download.")}const S=new Map;function k(V){let Y=S.get(V);return Y||(Y=new Intl.DateTimeFormat("en-US",{timeZone:V,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),S.set(V,Y)),Y}function y(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function l(V,Y){const $=k(Y).formatToParts(new Date(V)),j={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const E of $)E.type==="year"?j.y=+E.value:E.type==="month"?j.m=+E.value:E.type==="day"?j.d=+E.value:E.type==="hour"?j.h=+E.value%24:E.type==="minute"?j.mi=+E.value:E.type==="second"&&(j.s=+E.value);return j}function g(V,Y){const $=l(V,Y);return Date.UTC($.y,$.m-1,$.d,$.h,$.mi,$.s)-Math.floor(V/1e3)*1e3}function i(V,Y,$,j){const E=Date.UTC(V,Y-1,$),O=E-g(E,j);return E-g(O,j)}function t(V,Y,$){const j=new Date(Date.UTC(V.y,V.m-1,V.d+Y));return i(j.getUTCFullYear(),j.getUTCMonth()+1,j.getUTCDate(),$)}const o=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function c(V,Y){if(typeof V!="string")return null;const $=V.trim().toLowerCase().replace(/[\s_-]+/g,""),j=/^last(\d*|n)days?$/.exec($);if(j){const E=j[1]==="n"?"":j[1],O=Number(E||Y);return!Number.isFinite(O)||O<=0?null:{kind:"lastNDays",n:Math.floor(O)}}switch($){case"today":return{kind:"today",n:0};case"yesterday":return{kind:"yesterday",n:0};case"thisweek":return{kind:"thisWeek",n:0};case"thismonth":return{kind:"thisMonth",n:0};case"thisquarter":return{kind:"thisQuarter",n:0};case"thisyear":return{kind:"thisYear",n:0};case"quartertodate":case"qtd":return{kind:"quarterToDate",n:0};case"yeartodate":case"ytd":return{kind:"yearToDate",n:0};default:return null}}function f(V,Y={}){const $=c(V,Y.n);if(!$)return null;const j=Y.tz||y(),E=Y.now instanceof Date?Y.now.getTime():typeof Y.now=="number"?Y.now:Date.now(),O=l(E,j),N=i(O.y,O.m,O.d,j),T=t(O,1,j);let C=N,B=T;switch($.kind){case"today":break;case"yesterday":C=t(O,-1,j),B=N;break;case"lastNDays":B=Y.includeToday?T:N,C=t(O,Y.includeToday?-($.n-1):-$.n,j);break;case"thisWeek":{const z=Number.isFinite(Y.weekStartsOn)?Number(Y.weekStartsOn):1,Q=(new Date(Date.UTC(O.y,O.m-1,O.d)).getUTCDay()-z+7)%7;C=t(O,-Q,j),B=t(O,-Q+7,j);break}case"thisMonth":C=i(O.y,O.m,1,j),B=i(O.m===12?O.y+1:O.y,O.m===12?1:O.m+1,1,j);break;case"thisQuarter":case"quarterToDate":{const z=Math.floor((O.m-1)/3)*3+1;C=i(O.y,z,1,j),B=$.kind==="quarterToDate"?T:z===10?i(O.y+1,1,1,j):i(O.y,z+3,1,j);break}case"thisYear":case"yearToDate":C=i(O.y,1,1,j),B=$.kind==="yearToDate"?T:i(O.y+1,1,1,j);break;default:return null}return{from:new Date(C).toISOString(),to:new Date(B).toISOString(),bounds:"[)",tz:j,relative:$.kind==="lastNDays"?`last${$.n}Days`:$.kind,n:$.n}}function n(V){if(!V||typeof V!="object")return null;const Y=V.value;if(Y&&typeof Y=="object"&&!Array.isArray(Y)&&"relative"in Y)return{token:String(Y.relative),n:typeof Y.n=="number"?Y.n:void 0};if(V.op==="relative"&&typeof V.value=="string")return{token:V.value,n:void 0};const $=V.meta;return $&&typeof $.relative=="string"&&V.value===void 0?{token:$.relative,n:typeof $.n=="number"?$.n:void 0}:null}function m(){return`Known tokens: ${o.filter(Y=>Y!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function r(V){const Y=n(V);return Y?c(Y.token,Y.n)!==null:!1}function s(V,Y={}){const $=n(V);if(!$)return V;const j=f($.token,{...Y,n:$.n});return j?{...V,type:V.type||"date",op:"between",value:[j.from,j.to],bounds:V.bounds||j.bounds,meta:{...V.meta||{},relative:j.relative,tz:j.tz}}:(M(`source.relative.${$.token}`,`unknown relative date token "${$.token}"; sending the condition unresolved.`,m()),V)}function d(V){return!!V&&typeof V=="object"&&Array.isArray(V.conditions)}function p(V,Y){if(V){if(d(V)){for(const $ of V.conditions)p($,Y);return}Y(V)}}function u(V,Y){if(!V)return null;if(!d(V))return Y(V);const $=V;let j=!1;const E=[];for(const O of $.conditions){const N=u(O,Y);N!==O&&(j=!0),N&&E.push(N)}return!j&&E.length===$.conditions.length?V:E.length?{...$,conditions:E}:null}function b(V){if(!V)return null;if(!d(V))return V;const Y=V,$=[];for(const j of Y.conditions){const E=b(j);E&&$.push(E)}return $.length?{op:Y.op,conditions:$}:null}function a(V){const Y=b(V);return Y?d(Y)&&Y.op==="and"?Y:{op:"and",conditions:[Y]}:null}function h(V){const Y=(V||[]).filter(Boolean);return Y.length?{op:"and",conditions:Y}:null}function w(V,Y={}){const $=u(V,j=>s(j,Y));return a($)}function v(V){const Y=A(V.filters??null);return JSON.stringify([Y,V.sort??null,V.quick??"",V.groupBy??null,V.pivotBy??null,_(V.context)])}function A(V){if(!V)return null;if(d(V)){const j=V;return{op:j.op,conditions:j.conditions.map(A)}}const Y=V,$=Y.meta&&typeof Y.meta.relative=="string"?Y.meta.relative:n(Y)?.token;return{col:Y.col,op:Y.op,bounds:Y.bounds??null,caseSensitive:Y.caseSensitive??!1,value:$?`rel:${$}`:Y.value??null}}function _(V){if(V==null)return null;try{return JSON.parse(JSON.stringify(V))}catch{return M("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),Be("packages/core/src/source/tree.js",function(e,D){"use strict";Object.defineProperty(e,"SYNTHETIC",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"buildFromPath",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"assignLevels",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"resolveTree",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"buildTree",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"indexTree",{enumerable:!0,get:function(){return l}});const M=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce,x="",q="\0tree:";function W(g,i){return{physical:g,key:i,level:0,children:[],value:void 0}}function I(g,i){const t=[],o=new Map;for(let c=0;c<g.length;c++){const f=g[c],n=i.pathOf(f),m=Array.isArray(n)?n.map(s=>String(s)):[];if(!m.length){const s=W(f,i.keyOf(f));t.push(s);continue}let r=null;for(let s=0;s<m.length;s++){const d=m.slice(0,s+1).join(x),p=s===m.length-1;let u=o.get(d);u&&p&&u.physical===-1&&(u.physical=f,u.key=i.keyOf(f)),u||(u=W(p?f:-1,p?i.keyOf(f):q+d),u.level=s,u.value=m[s],o.set(d,u),r?r.children.push(u):t.push(u)),r=u}}return{roots:t,nodes:o}}function K(g,i){const t=new Map,o=[];for(let m=0;m<g.length;m++){const r=g[m],s=i.keyOf(r),d=W(r,s);t.set(s,d);const p=i.parentOf(r);p!=null&&p!==""&&o.push({node:d,parent:String(p)})}let c=null;const f=new Map;for(const{node:m,parent:r}of o){const s=t.get(r);if(s){f.set(m.key,s);continue}i.orphans&&i.orphans!=="root"&&(c||(c=W(-1,`${q}orphans`),c.value=i.orphans),f.set(m.key,c))}const n=[];for(const m of t.values()){const r=f.get(m.key);r?r.children.push(m):n.push(m)}return c&&c.children.length&&n.push(c),{roots:R(n,t,i.orphans,c),nodes:t}}function R(g,i,t,o){const c=new Set,f=[...g];for(;f.length;){const d=f.pop();if(!c.has(d.key)){c.add(d.key);for(const p of d.children)f.push(p)}}const n=[];for(const d of i.values())c.has(d.key)||n.push(d);if(!n.length)return g;const m=!!t&&t!=="root";F("tree.cycle",`tree.parentKey produced ${n.length} row(s) inside a parent cycle; `+(m?`they are shown under "${t}".`:"they are shown at the root."));for(const d of n)d.children=d.children.filter(p=>c.has(p.key));if(!m)return[...g,...n];let r=o;const s=[...g];return r||(r=W(-1,`${q}orphans`),r.value=t,s.push(r)),r.children.push(...n),s}function S(g){let i=0;const t=(o,c)=>{for(const f of o)f.level=c,c>i&&(i=c),f.children.length&&t(f.children,c+1)};return t(g,0),i}function k(g,i){if(!g||typeof g!="object")return null;const t=g.path,o=g.parentKey,c=M(g.hasChildren)?f=>!!g.hasChildren(i.dataAt(f)):null;if(M(t))return{mode:"path",pathOf:f=>t(i.dataAt(f)),keyOf:i.keyOf,declaresChildren:c};if(o!=null){const f=M(o)?o:n=>n?.[o];return{mode:"parentKey",parentOf:n=>f(i.dataAt(n)),keyOf:i.keyOf,orphans:g.orphans||"root",declaresChildren:c}}return F("tree.shape","tree is configured with neither `path` nor `parentKey`; rows stay flat."),null}function y(g,i){const t=i.mode==="path"?I(g,i):K(g,i),o=S(t.roots);return{...t,depth:o}}function l(g,i){const t=new Map,o=c=>{for(let f=0;f<c.length;f++){const n=c[f];if(n.physical>=0){const m=i?i(n.physical):!1,r=m&&n.children.length===0;t.set(n.physical,{level:n.level,posinset:f+1,setsize:c.length,hasChildren:n.children.length>0||m,lazy:r})}n.children.length&&o(n.children)}};return o(g),t}}),Be("packages/core/src/source/settle.js",function(e,D){"use strict";Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return M}});const re=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function M(G){const F=G&&typeof G=="object"?G.reason:null;return typeof F=="string"&&re.includes(F)}}),Be("packages/core/src/source/memory.js",function(e,D){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"quickMatcher",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"MemorySource",{enumerable:!0,get:function(){return Q}});const M=D("packages/core/src/internal/lru.js").Lru,G=D("packages/core/src/internal/warn.js"),F=G.warnOnce,x=G.fail,W=D("packages/core/src/internal/predicates.js").isFunction,K=D("packages/core/src/internal/compare.js").defaultCompare,S=D("packages/core/src/internal/merge.js").mergeRow,k=D("packages/core/src/source/rows.js"),y=k.createRowFactory,l=k.groupKey,g=k.groupPathElement,i=k.groupPrefixKeys,t=k.lazyRowView,c=D("packages/core/src/source/handles.js").createHandleProvider,f=D("packages/core/src/compute/incremental.js"),n=f.RunningTotal,m=f.isIncremental,s=D("packages/core/src/compute/handle.js").presenceReader,d=D("packages/core/src/source/filterwire.js"),p=d.querySignature,u=d.mapConditions,b=d.resolveRelativeCondition,a=D("packages/core/src/source/tree.js"),h=a.buildTree,w=a.resolveTree,v=a.indexTree,A=D("packages/core/src/source/settle.js"),_=A.PIPELINE_SETTLE_REASONS,V=A.isPipelineSettle,Y=Object.freeze(["filter","sort","group","total","pivot","flatten"]),$=Object.freeze([]);function j(H,L){if(!H)return null;const Z=L==="grand"?H.grandTotal:H.groupTotal;return Z??H.total}function E(H){return!!H&&!H.running}function O(H){if(H)return H.value&&W(H.value.compare)?H.value.compare:W(H.compare)?H.compare:void 0}function N(H){const L=H&&H.dataType;return!L||!W(L.items)?null:{items:L.items,type:H.itemType&&H.itemType.name||"text"}}function T(H){return!!H&&(typeof H=="object"||typeof H=="function")&&W(H.then)}const C=new Uint32Array(0),B=4096;function z(H,L){return new Q(H,L)}function X(H,L){if(L==="regex")try{const Z=new RegExp(H,"iu");return ee=>Z.test(ee)}catch{return Z=>Z.includes(H)}if(L==="fuzzy"){const Z=[...H].filter(ee=>ee!==" ");return Z.length?ee=>{let te=0;for(let se=0;se<ee.length&&te<Z.length;se++)ee[se]===Z[te]&&te++;return te===Z.length}:()=>!0}if(L==="words"){const Z=H.split(/\s+/).filter(Boolean);return Z.length?ee=>Z.every(te=>ee.includes(te)):()=>!0}return Z=>Z.includes(H)}class Q{mode="memory";#e;#t;#n;#r=!1;#i=null;#s;#o;#l=new Map;#a=!1;#c=0;#u=0;#f=new Map;#d=new Map;#h;#p=null;#m=Q.#g();static#g(){return{slots:[],groupHeadings:$,unnumbered:$,pivot:null,inlineLeaves:null,matchCount:0,grand:null,grandLeaves:0,groupLeaves:null}}#b=new Map;#y=null;#O=new Map;#w=-1;#A=[];#v=new Map;#C=-1;#S=[];#P=null;#E=null;#T=null;#M=null;#N=null;#R=null;#F=null;#V=null;#W=Symbol("unset");#L=new Map;#q=null;get#B(){return this.#m.slots}set#B(L){this.#m.slots=L}get#Y(){return this.#m.inlineLeaves}set#Y(L){this.#m.inlineLeaves=L}get#G(){return this.#m.groupHeadings}set#G(L){this.#m.groupHeadings=L}get#D(){return this.#m.unnumbered}set#D(L){this.#m.unnumbered=L}get#_(){return this.#m.pivot}set#_(L){this.#m.pivot=L}constructor(L,Z){this.#t=L||{mode:"memory"},this.#e=Z||{};const ee=this.#e.config||{};this.#n=this.#t.rows||ee.rows||[],this.#s=y(this.#e),this.#o=c(this.#e,()=>this.#n,()=>this.#r),this.#h=new M(Number(ee.rowCacheSize)||B);for(const te of Y)this.#l.set(te,{key:null,result:null,id:0,computed:!1})}count(){this.#U();const L=this.#ye();return L?L.length:this.#B.length}#ye(){const L=Number(this.#z("pageSize",0))||0;if(L<=0)return null;const Z=this.#B.length,ee=Math.max(1,Math.ceil(Z/L)),se=Math.min(Math.max(0,Number(this.#z("page",0))||0),ee-1)*L;return{offset:se,length:Math.max(0,Math.min(L,Z-se))}}pageInfo(){this.#U();const L=Number(this.#z("pageSize",0))||0,Z=this.#B.length;if(L<=0)return{page:0,pageSize:0,total:Z,pageCount:1};const ee=Math.max(1,Math.ceil(Z/L));return{page:Math.min(Math.max(0,Number(this.#z("page",0))||0),ee-1),pageSize:L,total:Z,pageCount:ee}}totalCount(){return this.#j().length}matchCount(){return this.#U(),this.#m.matchCount}at(L){this.#U();const Z=this.#ye();if(Z)return L<0||L>=Z.length?void 0:this.#Ee(Z.offset+L,L);if(!(L<0||L>=this.#B.length))return this.#Ee(L,L)}byKey(L){this.#U(),this.#p||this.#ie();const Z=this.#p.get(L);if(Z!==void 0)return this.#ae(Z);for(let ee=0;ee<this.#B.length;ee++){const te=this.#B[ee];if(typeof te!="number"&&te&&te.key===L)return this.#Ee(ee)}}loaded(L){return L>=0&&L<this.count()}hint(L,Z){}display(){return this.#U(),this.#q||(this.#q=this.#Fe()),this.#q}invalidateQuickText(){this.#L.clear(),this.invalidate("filter")}invalidate(L){const Z=Y.indexOf(L);Z<0&&x(`unknown pipeline stage "${L}"; expected one of ${Y.join(", ")}`);for(let ee=Z;ee<Y.length;ee++){const te=this.#l.get(Y[ee]);te.key=null,te.computed=!1}this.#q=null}apply(L){const Z=[],ee={added:[],updated:[],removed:[],rejected:Z};if(!L)return ee;let te=!1;const se=new Set;if(L.remove&&L.remove.length)for(const ne of L.remove){const ae=this.#xe(ne);if(ae===void 0){Z.push({operation:"remove",id:this.#me(ne),reason:"unknown-id"});continue}ee.removed.push(this.#s.keyOf(this.#r?this.#Ce(ae):this.#n[ae],ae)),this.#r||(this.#n[ae]=void 0),this.#h.delete(ae),this.#L.delete(ae),te=!0}if(L.update&&L.update.length){const ne=this.#O.size||this.#vt()?this.#Ge():null,ae=this.#v.size?this.#lt():null,de=ae&&ae.length?this.#Ge():null;for(const le of L.update){const be=this.#xe(le);if(be===void 0){Z.push({operation:"update",id:this.#Me(le),reason:"unknown-id"});continue}const Ce=this.#r?this.#i&&this.#i.has(be)?this.#i.get(be):this.#Ce(be):this.#n[be],Ne=S(Ce,le);for(const he of this.#$e(Ce,Ne))se.add(he);if(this.#r||(this.#n[be]=Ne),ne&&this.#Je(ne,be,Ce,Ne),de&&this.#yt(ae,de,be,Ce,Ne),this.#p){const he=this.#s.keyOf(Ce,be),ie=this.#s.keyOf(Ne,be);he!==ie&&(this.#p.delete(he),this.#p.set(ie,be))}this.#h.delete(be),this.#L.delete(be),ee.updated.push(this.#ae(be))}}if(L.add&&L.add.length&&this.#r){typeof L.at=="number"&&L.at<this.#ct()&&(this.#h.clear(),this.#L.clear()),this.#p=null;for(const ne of L.add){const ae=this.#je(this.#Me(ne));ae!==void 0&&ee.added.push(this.#ae(ae))}te=!0}else if(L.add&&L.add.length){let ne=typeof L.at=="number"?L.at:this.#n.length;if(ne<this.#n.length){let le=0;for(let be=0;be<this.#n.length;be++)this.#n[be]!==void 0&&le++;if(le!==this.#n.length){let be=0;for(let Ce=0;Ce<this.#n.length;Ce++)this.#n[Ce]!==void 0&&(this.#n[be++]=this.#n[Ce]);this.#n.length=be,this.#p=null,this.#h.clear(),this.#L.clear()}}const ae=this.#n.length;ne=Math.max(0,ne);let de=L.add===this.#n?L.add.slice():L.add;if(this.#s.keyed){const le=[];for(const be of de){const Ce=this.#Me(be);if(this.#xe(Ce)!==void 0){Z.push({operation:"add",id:Ce,reason:"duplicate-id"});continue}le.push(be)}le.length!==de.length&&(de=le)}if(!de.length)return ee;if(ne>=ae)for(let le=0;le<de.length;le++)this.#n.push(de[le]);else this.#n.splice(ne,0,...de),this.#h.clear(),this.#L.clear();for(let le=0;le<de.length;le++)ee.added.push(this.#ae(ne>=ae?ae+le:ne+le));te=!0}return this.#c++,te&&(this.#p=null,this.#Ze()),this.#o.invalidate(),this.#q=null,te||this.#H(se)?(this.#u++,this.invalidate("filter")):this.invalidate("total"),this.#ut("rows:changed",{companion:!0,added:ee.added.length,updated:ee.updated.length,removed:ee.removed.length}),this.#i=null,ee}groupHeadingsAt(L){this.#U();const Z=this.#G;if(!Z.length||!Number.isInteger(L)||L<0)return $;let ee=0,te=Z.length-1,se=-1;for(;ee<=te;){const ae=ee+te>>1;Z[ae].at<=L?(se=ae,ee=ae+1):te=ae-1}if(se<0)return $;const ne=[];for(let ae=Z[se].row;ae;ae=ae.parent)ne.push(ae);return ne.reverse(),ne}unnumberedRowCount(L){this.#U();const Z=this.#D;if(!Z.length||!Number.isInteger(L)||L<0)return 0;let ee=0,te=Z.length-1,se=-1;for(;ee<=te;){const ne=ee+te>>1;Z[ne].at<=L?(se=ne,ee=ne+1):te=ne-1}return se+1}moveRow(L,Z){if(this.#r)return F("source.moveRow.dropped","rows.move() is not supported under ingest.dropSourceRows: the source objects have been released and the store cannot reorder its columns in place. Enable retainSource (leave dropSourceRows off) to reorder rows."),!1;const ee=this.#n;if(!Number.isInteger(L)||!Number.isInteger(Z))return!1;let te=0;for(let ae=0;ae<ee.length;ae++)ee[ae]!==void 0&&te++;if(L<0||L>=te)return!1;const se=Math.max(0,Math.min(te-1,Z));if(se===L)return!1;if(te!==ee.length){let ae=0;for(let de=0;de<ee.length;de++)ee[de]!==void 0&&(ee[ae++]=ee[de]);ee.length=ae}const[ne]=ee.splice(L,1);return ee.splice(se,0,ne),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#L.clear(),this.#Ze(),this.#o.invalidate(),this.#q=null,this.invalidate("filter"),this.#ut("rows:changed",{companion:!0,added:0,updated:0,removed:0,moved:1}),!0}reload(L){this.#ce(),this.#c++,this.#u++,this.#p=null,this.#L.clear(),this.#h.clear(),this.#Ze(),this.#o.invalidate(),this.invalidate("filter"),this.#ut("model:changed",{reason:"reload"})}destroy(){this.#ce(),this.#h.clear(),this.#L.clear(),this.#p=null,this.#B=[],this.#Y=null,this.#q=null,this.#Ze();for(const L of Y)this.#l.set(L,{key:null,result:null,id:0,computed:!1})}#ce(){for(const{controller:L}of this.#b.values())try{L.abort()}catch{}this.#b.clear()}setRows(L){this.#n=L||[],this.#r=!1,this.#c++,this.#u++,this.#p=null,this.#L.clear(),this.#h.clear(),this.#Ze(),this.#o.invalidate(),this.invalidate("filter")}notePriorRows(L){this.#i=L||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#L.clear(),this.#o.invalidate()}data(){if(!this.#r)return this.#n;const L=this.#e.store;if(!L||!W(L.source))return this.#n;const Z=L.physical||0,ee=new Array(Z);for(let te=0;te<Z;te++)ee[te]=L.live&&!L.live(te)?void 0:L.source(te);return ee}#ue(){const L=this.#z("detail",null);return!L||!W(L.isOpen)||L.inline===!1?null:L}#Ne(){const L=(this.#e.config||{}).tree;return this.#W!==L&&(this.#W=L,this.#V=w(L,{dataAt:Z=>this.#Ce(Z),keyOf:Z=>this.#s.keyOf(this.#Ce(Z),Z)})),this.#V}#se(){return(this.#e.config||{}).grandTotalRow==="bottom"}grandTotalRow(){if(!this.#se())return null;this.#U();const L=this.#m.grand;return L?this.#s.grandTotal(L,this.#qe(this.#m.grandLeaves)):null}pivot(){return this.#U(),this.#_}pivotMatrix(){this.#U();const L=this.#m.groupLeaves,Z=(this.#e.compute||{}).pivotMatrix;if(!W(Z))return null;const ee=this.#z("groupBy",[]),te=this.#z("pivotBy",[]);if(!ee.length&&!te.length)return F("pivotView.no-dimension","pivotView is on but the grid has no pivot dimension, so there is no matrix to draw. Put a column on the pivot (its `pivot` setting, or `pivotBy` in the query) for the columns across the top, and group by a column for the rows down the side."),null;const se=this.#Ge().map(ae=>({colId:ae.id,handle:this.#o.handle(ae.id),fn:j(ae,"group")})).filter(ae=>ae.handle&&ae.fn),ne=this.#e.config||{};return Z({rowHandles:ee.map(ae=>this.#o.handle(ae)).filter(Boolean),columnHandles:te.map(ae=>this.#o.handle(ae)).filter(Boolean),measures:se,leaves:L||new Uint32Array(0),opts:{locale:ne.locale,separator:(ne.pivot||{}).separator,maxColumns:(ne.pivot||{}).maxColumns}})}keysForLeaves(L){const Z=[];if(!L)return Z;for(let ee=0;ee<L.length;ee++){const te=this.#ae(L[ee]);te&&te.key!=null&&Z.push(String(te.key))}return Z}leavesOf(L){this.#U();const Z=this.#l.get("group"),ee=Z&&Z.result;if(!ee||!ee.nodes)return[];const te=ee.nodes.get(L);if(!te)return[];const se=[],ne=ae=>{const de=ae.row&&ae.row.children;if(de&&de.length){for(const le of de){const be=ee.nodes.get(le.key);be&&ne(be)}return}if(ae.leaves)for(let le=0;le<ae.leaves.length;le++)se.push(this.#ae(ae.leaves[le]))};return ne(te),se}#me(L){return typeof L=="string"?L:this.#Me(L)}#Me(L){try{return this.#s.keyOf(L,-1)}catch{return"(unkeyed)"}}#xe(L){if(typeof L=="string")return this.#je(L);if(this.#s.keyed){const ee=this.#s.keyOf(L,-1),te=this.#je(ee);if(te!==void 0)return te}if(this.#r)return;const Z=this.#n.indexOf(L);return Z>=0?Z:void 0}#je(L){return this.#p||this.#ie(),this.#p.get(L)}#ie(){this.#p=new Map;const L=this.#ct(),Z=this.#e.store,ee=Z&&W(Z.live)?te=>Z.live(te):null;for(let te=0;te<L;te++){if(ee&&!ee(te))continue;const se=this.#Ce(te);se!==void 0&&this.#p.set(this.#s.keyOf(se,te),te)}}#$e(L,Z){const ee=[];for(const te of this.#Q())this.#Ke(te)&&this.#oe(te,L,Z,new Set)&&ee.push(te);return ee}#oe(L,Z,ee,te){if(te.has(L))return!1;te.add(L);const se=this.#Ke(L);if(!se)return!1;const ne=se.value&&se.value.deps;return Array.isArray(ne)&&ne.length?ne.some(ae=>this.#oe(String(ae),Z,ee,te)):W(se.getValue)?!Object.is(se.getValue(Z),se.getValue(ee)):!1}#Q(){const L=new Set;for(const ee of this.#z("sort",[]))L.add(ee.col);for(const ee of this.#z("groupBy",[]))L.add(ee);const Z=ee=>{if(ee){if(Array.isArray(ee.conditions)){ee.conditions.forEach(Z);return}ee.col&&L.add(ee.col)}};return Z(this.#z("filters",null)),[...L]}#H(L){if(!L.size)return!1;if(this.#z("quick",""))return!0;for(const Z of this.#Q())if(L.has(Z))return!0;return!1}#U(){if(!this.#a){this.#a=!0;try{this.#J()}finally{this.#a=!1}}}pipelineRunning(){return this.#a}#J(){const L=this.#pe("filter",()=>this.#Z(),()=>this.#k()),Z=this.#fe(L),ee=this.#pe("group",()=>this.#K(),()=>this.#Ve(Z)),te=this.#pe("total",()=>this.#I(),()=>this.#Xe(ee));this.#pe("pivot",()=>this.#ve(),()=>this.#kt(ee)),this.#pe("flatten",()=>this.#Ae(),()=>this.#Mt(ee)),this.#he(ee,te)}#fe(L){const Z=this.#l.get("sort"),ee=this.#ne();if(Z.computed&&Z.key===ee&&!this.#b.has("sort"))return Z.result;const te=this.#b.get("sort");return te&&te.key===ee?Z.result:Z.result&&this.#ge(L)?(this.#ke(L,ee),Z.result):this.#pe("sort",()=>ee,()=>this.#Pe(L))}#le(){if(this.#y===null){const L=this.#e.pipelineWorker,Z=W(L)?L():null;this.#y=Z||!1}return this.#y||null}#we(){const L=this.#z("sort",[]);if(!Array.isArray(L)||!L.length)return null;const Z=(this.#e.config||{}).locale,ee=[],te=[];for(const se of L){const ne=this.#Ke(se.col);if(ne&&ne.running)continue;if(ne&&ne.value&&W(ne.value.compare))return null;const ae=this.#o.handle(se.col);if(!ae)return null;ee.push({col:se.col,descending:se.dir==="desc",nullsFirst:!!se.nullsFirst,locale:Z}),te.push(ae)}return ee.length?{entries:ee,handles:te,locale:Z}:null}#ge(L){if(this.#re())return!1;const Z=this.#le();if(!Z)return!1;const ee=Number(Z.threshold);return Number.isFinite(ee)&&L.length<ee?!1:!!this.#we()}#ke(L,Z){const ee=this.#le(),te=ee&&this.#we();if(!te){this.#pe("sort",()=>Z,()=>this.#Pe(L));return}const se=new AbortController;this.#b.set("sort",{key:Z,controller:se});const ne=te.entries.length===1?ee.sortColumn(te.handles[0],L,{descending:te.entries[0].descending,nullsFirst:te.entries[0].nullsFirst,locale:te.locale,signal:se.signal,key:"sort"}):ee.sortMulti(te.handles,te.entries.map((ae,de)=>({...ae,handle:te.handles[de]})),L,{signal:se.signal,key:"sort"});if(!T(ne)){this.#b.delete("sort"),this.#pe("sort",()=>Z,()=>ne);return}ne.then(ae=>this.#Ie(Z,ae),ae=>this.#de("sort",Z,ae))}#Ie(L,Z){const ee=this.#b.get("sort");if(!(!ee||ee.key!==L)){if(this.#ne()!==L){this.#b.delete("sort");return}this.#b.delete("sort"),this.#pe("sort",()=>L,()=>Z),this.#q=null,this.#U(),this.#ut("model:changed",{reason:_[0]})}}#de(L,Z,ee){const te=this.#b.get(L);if(!(!te||te.key!==Z)&&(this.#b.delete(L),!(ee&&ee.name==="AbortError")&&L==="sort"&&this.#ne()===Z)){const se=this.#pe("filter",()=>this.#Z(),()=>this.#k());this.#pe("sort",()=>Z,()=>this.#Pe(se)),this.#q=null,this.#U(),F("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",ee),this.#ut("model:changed",{reason:_[1]})}}#he(L,Z){const ee=L&&L.leaves?L.leaves.length:this.#m.slots.length;this.#m.matchCount=ee,this.#m.grand=Z&&Z.grand||null,this.#m.grandLeaves=L&&L.leaves?L.leaves.length:0,this.#m.groupLeaves=L&&L.leaves?L.leaves:null}#pe(L,Z,ee){const te=this.#l.get(L),se=Z();return te.computed&&te.key===se||(te.result=ee(),te.key=se,te.computed=!0,te.id++,L==="flatten"&&(this.#q=null)),te.result}#$(L){return this.#l.get(L).id}#Z(){const L=(this.#e.config||{}).hostFilter,Z=L&&W(L.active)&&L.active()?1:0,ee=this.#z("where",null),te=ee?ee.version:0,se=this.#Pt("filter.sig",`${this.#nt()}`,()=>p({filters:this.#z("filters",null),quick:this.#z("quick",""),quickMode:this.#z("quickMode","contains")}));return`${this.#u}|${se}|${Z}|${te}`}#ne(){const L=this.#re();return`${this.#$("filter")}|${JSON.stringify(this.#z("sort",[]))}`+(L?`|manual:${L.version}`:"")}#re(){const L=this.#z("rowOrder",null);return L&&Array.isArray(L.keys)?L:null}#Be(L,Z){this.#p||this.#ie();const ee=this.#p,te=this.#ct(),se=Z.keys.length,ne=new Float64Array(te);for(let ae=0;ae<te;ae++)ne[ae]=se+ae;for(let ae=0;ae<se;ae++){const de=ee.get(Z.keys[ae]);de!==void 0&&(ne[de]=ae)}return Uint32Array.from(L).sort((ae,de)=>ne[ae]-ne[de])}orderedKeys(){this.#p||this.#ie();const L=this.#p,Z=new Map;for(const[ae,de]of L)Z.set(de,ae);const ee=Uint32Array.from([...Z.keys()]).sort(),te=this.#re(),se=te?this.#Be(ee,te):this.#Pe(ee),ne=new Array(se.length);for(let ae=0;ae<se.length;ae++)ne[ae]=Z.get(se[ae]);return ne}#K(){const L=this.#z("pivotBy",[]).length>0?"p":"u";return`${this.#$("sort")}|${JSON.stringify(this.#z("groupBy",[]))}|${L}`}#I(){const L=this.#te()?"f":"a",Z=(this.#e.config||{}).totalOnlyChangedColumns?"n":"w";return`${this.#$("group")}|${JSON.stringify(this.#z("totals",[]))}|${L}${Z}|${this.#c}`}#ve(){return`${this.#$("group")}|${JSON.stringify(this.#z("pivotBy",[]))}`}#Ae(){const Z=this.#He()||!this.#se()?this.#$("total"):"x",ee=`${this.#nt()}`,te=this.#Pt("flatten.keys",ee,()=>{const ne=this.#z("expanded",null);return ne?[...ne].sort().join(""):"*"}),se=this.#Pt("flatten.detail",ee,()=>{const ne=this.#z("detail",null);return ne&&W(ne.signature)?ne.signature():""});return`${Z}|${this.#$("pivot")}|${te}|${se}`}#He(){const L=this.#z("groupBy",[]);return Array.isArray(L)&&L.length>0}stageState(){const L=[];for(const[Z,ee]of this.#l){const te=ee.result;L.push({stage:Z,materialised:!!ee.computed,bytes:te&&typeof te.byteLength=="number"?te.byteLength:null,rows:te&&typeof te.length=="number"?te.length:null,rebuilds:ee.id})}return L}facetIndices(L){return this.#k(L||null)}facetRows(L){const Z=this.facetIndices(L),ee=[];for(let te=0;te<Z.length;te++){const se=this.#ae(Z[te]);se&&ee.push(se)}return ee}invalidateRows(){this.#h.clear(),this.#L.clear(),this.#q=null}invalidateHandles(){this.#o.invalidate()}rows(){return this.#n}unfilteredIndices(){return this.#j()}filteredIndices(){const L=this.#l.get("filter");if(L&&L.computed&&L.key===this.#Z())return L.result||this.#j();this.#U();const Z=this.#l.get("filter");return(Z&&Z.computed?Z.result:null)||this.#j()}unfilteredRows(){const L=this.#j(),Z=[];for(let ee=0;ee<L.length;ee++){const te=this.#ae(L[ee]);te&&Z.push(te)}return Z}#k(L=null){const Z=this.#j(),ee=this.#z("filters",null),te=L?this.#rt("pruneColumn")(ee,L):ee,se=this.#Rt(te),ne=String(this.#z("quick","")||"").trim().toLowerCase(),ae=ne?X(ne,String(this.#z("quickMode","contains")||"contains")):null,de=(this.#e.config||{}).hostFilter,le=!!(de&&W(de.active)&&de.active()),be=this.#z("where",null),Ce=!!(be&&be.active);if(!se&&!ne&&!le&&!Ce)return Z;let Ne=null;se&&(Ne=this.#rt("evaluateFilters")(se,{handle:ge=>this.#o.handle(ge),count:this.#ct(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:ge=>N(this.#Ke(ge))}));const he=new Uint32Array(Z.length);let ie=0;for(let ue=0;ue<Z.length;ue++){const ge=Z[ue];if(!(Ne&&!Ne[ge])&&!(ae&&!this.#ot(ge,ae))){if(le||Ce){const pe=this.#ae(ge);if(le&&!de.passes(pe)||Ce&&!be.passes(pe.data,pe.key))continue}he[ie++]=ge}}if(Ne){const ue=(this.#e.compute||{}).releaseMask;W(ue)&&ue({pool:this.#e.pool},Ne)}return he.subarray(0,ie)}handleFor(L){return this.#o.handle(L)}#Pe(L){const Z=this.#re();if(Z)return this.#Be(L,Z);const ee=this.#z("sort",[]).filter(ne=>{const ae=this.#Ke(ne.col);return!ae||!ae.running?!0:(F(`source.sort.running.${ne.col}`,`sort ignores "${ne.col}": a running total is a function of the sort order, so it cannot also decide it. Sort by the column it runs over instead.`),!1)});if(!ee.length)return L;const te=(this.#e.config||{}).locale;if(ee.length===1){const ne=ee[0],ae=this.#o.handle(ne.col);if(!ae)return F(`source.sort.${ne.col}`,`sort ignores unknown column "${ne.col}".`),L;const de=this.#Ke(ne.col);return this.#rt("sortColumn")(ae,L,{descending:ne.dir==="desc",nullsFirst:ne.nullsFirst,locale:te,compare:O(de)})}const se=[];for(const ne of ee){const ae=this.#o.handle(ne.col);if(!ae){F(`source.sort.${ne.col}`,`sort ignores unknown column "${ne.col}".`);continue}se.push({handle:ae,descending:ne.dir==="desc",nullsFirst:ne.nullsFirst,locale:te,compare:O(this.#Ke(ne.col))})}return se.length?this.#rt("sortMulti")(se.map(ne=>ne.handle),se,L):L}#Ve(L){const Z=this.#z("groupBy",[]),ee=this.#Ne();if(ee&&!Z.length){const ue=h(L,ee);return this.#R=v(ue.roots,ee.declaresChildren),{roots:null,leaves:L,nodes:new Map,tree:ue}}if(this.#R=null,ee&&Z.length&&F("tree.grouped","grouping is active on a grid configured with `tree`; the grouping wins and the hierarchy is not shown."),!Z.length)return{roots:null,leaves:L,nodes:new Map};const te=(this.#e.config||{}).timeZone,se=[],ne=[];let ae=!1;for(const ue of Z){const ge=this.#o.handle(ue);if(!ge){F(`source.group.${ue}`,`grouping ignores unknown column "${ue}".`);continue}se.push(ge);const pe=this.#Ke(ue),Oe=pe&&pe.dataType;if(Oe&&W(Oe.groupProjector)){const ve=pe.typeOptions&&pe.typeOptions.timeZone||te||void 0,ye=Oe.groupProjector(pe,ve);ne.push(ye||null),ye&&(ae=!0)}else ne.push(null)}if(!se.length)return{roots:null,leaves:L,nodes:new Map};const{keys:de,buckets:le}=this.#rt("groupByColumns")(se,L,{locale:(this.#e.config||{}).locale,project:ae?ne:void 0}),be=this.#z("pivotBy",[]).length>0,Ce=[],Ne=new Map;for(let ue=0;ue<le.length;ue++){const ge=de[ue];let pe=null;const Oe=[];for(let ve=0;ve<ge.length;ve++){Oe.push(g(ge[ve]));const ye=l(Oe),Ae=ve===ge.length-1;let Me=Ne.get(ye);if(!Me){const je=this.#s.group({path:[...Oe],column:Z[ve],value:ge[ve],level:ve,parent:pe,expanded:be&&Ae?!1:this.#tt(ye,{key:ye,column:Z[ve],value:ge[ve],level:ve,path:[...Oe]}),hasChildren:!(be&&Ae)});Me={row:je,leaves:null},Ne.set(ye,Me),pe?pe.children.push(je):Ce.push(je)}Me.row.leafCount+=le[ue].length,ve===ge.length-1&&(Me.leaves=le[ue]),pe=Me.row}}const he=this.#z("sort",[])||[],ie=(ue,ge)=>{if(!ue||ue.length<2){if(ue)for(const ye of ue)ie(ye.children,ge+1);return}const pe=Z[ge],Oe=he.find(ye=>ye.col===pe),ve=Oe&&Oe.dir==="desc"?-1:1;ue.sort((ye,Ae)=>ve*K(ye.groupValue,Ae.groupValue));for(const ye of ue)ie(ye.children,ge+1)};return ie(Ce,0),{roots:Ce,leaves:L,nodes:Ne,keys:de,buckets:le}}#Ye(L,Z){const ee=new Map,te=new Map,se=ne=>{const ae=ne.physical>=0?[ne.physical]:[];for(const de of ne.children)ae.push(...se(de));if(ne.children.length){const de=this.#Qe(Z,Uint32Array.from(ae),null);ne.physical>=0?ee.set(ne.physical,de):te.set(ne.key,de)}return ae};for(const ne of L.roots)se(ne);return{byPhysical:ee,byKey:te}}#Xe(L){const Z=this.#Ge();if(!Z.length)return this.#E=null,this.#T=null,{grand:null};const ee={id:this.#$("group"),columns:Z.map(he=>he.id).join("")},te=this.#E&&this.#E.id===ee.id&&this.#E.columns===ee.columns,se=this.#vt()&&te?this.#P:null,ne=se?Z.filter(he=>se.has(he.id)):Z,ae=te?this.#T:null,de=this.#te()?null:this.#wt(),le=this.#Oe(Z),be=he=>{const ie=L.nodes.get(he.key);let ue=ie&&ie.leaves?ie.leaves:null;if(he.children&&he.children.length){const Oe=he.children.map(be);let ve=0;for(const Me of Oe)ve+=Me.length;const ye=new Uint32Array(ve);let Ae=0;for(const Me of Oe)ye.set(Me,Ae),Ae+=Me.length;ue=ye}ue=ue||new Uint32Array(0);const ge=de?de.get(he.key)||C:ue,pe=this.#ft(he,se?ne:Z,ge,le);return he.totals=se?{...he.totals,...pe}:pe,ue};if(L.roots&&ne.length)for(const he of L.roots)be(he);if(this.#F=L.tree?this.#Ye(L.tree,Z):null,this.#E=ee,this.#P=this.#vt()?new Set:null,!(this.#e.config||{}).grandTotalRow)return this.#A.length=0,this.#T=null,{grand:null};const Ne=de?this.#dt():L.leaves;return this.#T=this.#Ue(Z,Ne,se,ae),{grand:this.#T}}#Ue(L,Z,ee,te){const se={},ne=this.#$("group");ne!==this.#w&&(this.#ht(),this.#w=ne);const ae=this.#A;this.#A=[];for(const de of L){if(!E(de))continue;const le=this.#o.handle(de.id);if(!le)continue;const be=j(de,"grand");if(!m(be,le)){if(ee&&!ee.has(de.id)&&te&&de.id in te){se[de.id]=te[de.id];continue}se[de.id]=this.#Qe([de],Z,null,"grand")[de.id];continue}let Ce=this.#O.get(de.id);if((!Ce||Ce.fn!==be)&&(Ce=new n(be),this.#O.set(de.id,Ce)),Ce.valid){let Ne=!0;for(const he of ae)if(he.colId===de.id&&!Ce.update(he.before,he.after)){Ne=!1;break}if(Ne){se[de.id]=Ce.value();continue}Ce.invalidate()}Ce.seedColumn(le.values,s(le),Z),se[de.id]=Ce.valid?Ce.value():this.#Qe([de],Z,null,"grand")[de.id]}return se}#Oe(L){const Z=this.#$("group");Z!==this.#C&&(this.#v.clear(),this.#C=Z);const ee=new Map;for(const se of L){if(!E(se))continue;const ne=this.#o.handle(se.id),ae=j(se,"group");m(ae,ne)&&ee.set(se.id,{fn:ae})}if(!ee.size)return this.#S.length=0,ee;const te=this.#S;this.#S=[];for(const se of te){const{beforeKeys:ne,afterKeys:ae,colDeltas:de}=se,le=ne.length?new Set(ne):null,be=ae.length?new Set(ae):null;for(const{colId:Ce,before:Ne,after:he}of de)if(ee.has(Ce)){for(const ie of ne)be&&be.has(ie)||this.#Se(ie,Ce,Ne,null);for(const ie of ae)le&&le.has(ie)||this.#Se(ie,Ce,null,he);for(const ie of ne)be&&!be.has(ie)||this.#Se(ie,Ce,Ne,he)}}return ee}#Se(L,Z,ee,te){const se=this.#v.get(L),ne=se&&se.get(Z);!ne||!ne.valid||ne.update(ee,te)||ne.invalidate()}#ft(L,Z,ee,te){if(!te||!te.size)return this.#Qe(Z,ee,L);const se={};let ne=null,ae=this.#v.get(L.key);for(const de of Z){const le=te.get(de.id);if(!le){(ne||(ne=[])).push(de);continue}const be=this.#o.handle(de.id);if(!be)continue;ae||(ae=new Map,this.#v.set(L.key,ae));let Ce=ae.get(de.id);if((!Ce||Ce.fn!==le.fn)&&(Ce=new n(le.fn),ae.set(de.id,Ce)),Ce.valid||Ce.seedColumn(be.values,s(be),ee),Ce.valid){se[de.id]=Ce.value();continue}(ne||(ne=[])).push(de)}return ne&&Object.assign(se,this.#Qe(ne,ee,L)),se}#Je(L,Z,ee,te){const se=!this.#te()||this.#et(Z);for(const ne of L){const ae=ne.getValue;if(!W(ae))continue;const de=ae(ee),le=ae(te);Object.is(de,le)||(this.#P&&this.#P.add(ne.id),se&&this.#O.has(ne.id)&&this.#A.push({colId:ne.id,before:de,after:le}))}}#lt(){const L=this.#z("groupBy",[]),Z=[];for(const ee of L){const te=this.#Ke(ee);te&&Z.push(te)}return Z}#We(L,Z){const ee=new Array(L.length);for(let te=0;te<L.length;te++){const se=L[te].getValue;ee[te]=g(W(se)?se(Z):void 0)}return ee}#yt(L,Z,ee,te,se){if(this.#te()&&!this.#et(ee))return;const ne=i(this.#We(L,te)),ae=i(this.#We(L,se)),de=ne.length!==ae.length||ne.some((be,Ce)=>be!==ae[Ce]),le=[];for(const be of Z){const Ce=be.getValue;if(!W(Ce))continue;const Ne=Ce(te),he=Ce(se);!de&&Object.is(Ne,he)||le.push({colId:be.id,before:Ne,after:he})}!le.length&&!de||this.#S.push({beforeKeys:ne,afterKeys:ae,colDeltas:le})}#et(L){const Z=this.#l.get("filter"),ee=Z&&Z.computed?Z.result:null;if(!ee)return!0;let te=0,se=ee.length-1;for(;te<=se;){const ne=te+se>>1,ae=ee[ne];if(ae===L)return!0;ae<L?te=ne+1:se=ne-1}return!1}#te(){return(this.#e.config||{}).totalFilteredOnly!==!1}#qe(L){return this.#te()?L:this.#dt().length}#dt(){return(!this.#M||this.#M.version!==this.#u)&&(this.#M={version:this.#u,indices:this.#j()}),this.#M.indices}#wt(){const L=this.#z("groupBy",[]),Z=`${this.#u}|${JSON.stringify(L)}`;if(this.#N&&this.#N.key===Z)return this.#N.map;const ee=new Map,te=[];for(const se of L){const ne=this.#o.handle(se);ne&&te.push(ne)}if(te.length){const se=this.#dt(),{keys:ne,buckets:ae}=this.#rt("groupByColumns")(te,se,{locale:(this.#e.config||{}).locale}),de=new Map;for(let le=0;le<ae.length;le++){const be=ne[le],Ce=[];for(let Ne=0;Ne<be.length;Ne++){Ce.push(g(be[Ne]));const he=l(Ce);let ie=de.get(he);ie||(ie=[],de.set(he,ie));for(let ue=0;ue<ae[le].length;ue++)ie.push(ae[le][ue])}}for(const[le,be]of de)ee.set(le,Uint32Array.from(be))}return this.#N={key:Z,map:ee},ee}#vt(){return!!(this.#e.config||{}).totalOnlyChangedColumns}#Ze(){this.#ht(),this.#ze(),this.#P=null,this.#E=null,this.#T=null}#ht(){this.#O.clear(),this.#A.length=0,this.#w=-1}#ze(){this.#v.clear(),this.#S.length=0,this.#C=-1}#kt(L){const Z=this.#z("pivotBy",[]);if(!Z.length)return this.#_=null,null;const ee=(this.#e.compute||{}).pivot;if(!W(ee))return F("source.pivot.kernel","pivot requested but ctx.compute.pivot is not available; showing unpivoted rows."),this.#_=null,null;const te=Z.map(ne=>this.#o.handle(ne)).filter(Boolean),se=this.#Ge();return this.#_=ee(te,L.leaves,{groups:L.keys&&L.buckets?{keys:L.keys,buckets:L.buckets}:null,totals:se.map(ne=>ne.id),handle:ne=>this.#o.handle(ne),totalOf:ne=>j(se.find(ae=>ae.id===ne),"group"),separator:((this.#e.config||{}).pivot||{}).separator,maxColumns:((this.#e.config||{}).pivot||{}).maxColumns})||null,this.#_}#Mt(L){const Z=this.#l.get("total").result,ee=!!(this.#e.config||{}).groupFooter,te=this.#ue();if(L.tree)return this.#Re(L,Z,te);if(!L.roots&&!te){if(Z&&Z.grand&&!this.#se()){const be=this.#s.grandTotal(Z.grand,this.#qe(L.leaves.length));if(this.#Y===L.leaves&&Array.isArray(this.#B))this.#B[this.#B.length-1]=be;else{const Ce=Array.from(L.leaves);Ce.push(be),this.#B=Ce,this.#Y=L.leaves}this.#D=[{at:this.#B.length-1}]}else this.#Y=null,this.#B=L.leaves,this.#D=$;return this.#G=$,this.#B}const se=[],ne=[],ae=[],de=be=>{if(se.push(be),!te)return;const Ce=this.#ae(be);!Ce||!te.isOpen(Ce.key)||(Ce.master=!0,Ce.expanded=!0,ae.push({at:se.length}),se.push(this.#s.detail(Ce,te.heightOf(Ce))))};if(!L.roots){for(let be=0;be<L.leaves.length;be++)de(L.leaves[be]);return Z&&Z.grand&&!this.#se()&&(ae.push({at:se.length}),se.push(this.#s.grandTotal(Z.grand,this.#qe(L.leaves.length)))),this.#Y=null,this.#G=$,this.#D=ae.length?ae:$,this.#B=se,se}const le=(be,Ce,Ne)=>{if(be.expanded=be.hasChildren===!1?!1:this.#tt(be.key,{key:be.key,column:be.groupColumn,value:be.groupValue,level:be.level,path:be.groupPath}),be.posinset=Ce+1,be.setsize=Ne,ne.push({at:se.length,row:be}),ae.push({at:se.length}),se.push(be),!!be.expanded){if(be.children&&be.children.length)for(let he=0;he<be.children.length;he++)le(be.children[he],he,be.children.length);else{const he=L.nodes.get(be.key),ie=he&&he.leaves?he.leaves:null;if(ie)for(let ue=0;ue<ie.length;ue++)de(ie[ue])}ee&&be.totals&&(ae.push({at:se.length}),se.push(this.#s.footer(be)))}};for(let be=0;be<L.roots.length;be++)le(L.roots[be],be,L.roots.length);return Z&&Z.grand&&!this.#se()&&(ae.push({at:se.length}),se.push(this.#s.grandTotal(Z.grand,this.#qe(L.leaves.length)))),this.#G=ne,this.#D=ae,this.#B=se,se}#j(){const L=this.#e.store;if(L&&W(L.liveIndices))return L.liveIndices();const Z=new Uint32Array(this.#n.length);let ee=0;for(let te=0;te<this.#n.length;te++)this.#n[te]!==void 0&&(Z[ee++]=te);return Z.subarray(0,ee)}#ct(){const L=this.#e.store;return L&&typeof L.physical=="number"?L.physical:this.#n.length}#Ce(L){const Z=this.#e.store;return Z&&W(Z.source)?Z.source(L):this.#n[L]}#Ee(L,Z=L){const ee=this.#B[L];if(typeof ee!="number")return ee.index=Z,ee;const te=this.#ae(ee);return te.index=Z,te}#ae(L){let Z=this.#h.get(L);Z||(Z=this.#s.leaf(this.#Ce(L),L),this.#h.set(L,Z));const ee=this.#R?this.#R.get(L):null;if(ee){Z.level=ee.level,Z.posinset=ee.posinset,Z.setsize=ee.setsize,Z.hasChildren=ee.hasChildren,Z.expanded=ee.hasChildren&&!ee.lazy&&this.#tt(Z.key);const te=this.#F?this.#F.byPhysical.get(L):void 0;te?Z.totals=te:Z.totals&&(Z.totals=null)}else Z.hasChildren&&(Z.level=0,Z.hasChildren=!1,Z.expanded=!1,Z.posinset=void 0,Z.setsize=void 0);return Z}#Re(L,Z,ee){const te=[],se=[],ne=de=>{if(de.leafCount!==void 0)return de.leafCount;let le=de.physical>=0?1:0;for(const be of de.children)le+=ne(be);return de.leafCount=le,le},ae=de=>{const le=this.#tt(de.key);if(de.physical>=0){if(te.push(de.physical),ee&&ee.isOpen(this.#ae(de.physical).key)){const be=this.#ae(de.physical);se.push({at:te.length}),te.push(this.#s.detail(be,ee.heightOf(be)))}}else te.push(this.#s.group({path:[de.key],column:null,value:de.value,level:de.level,parent:null,expanded:le,hasChildren:de.children.length>0,leafCount:ne(de),totals:this.#F?this.#F.byKey.get(de.key):void 0}));if(le)for(const be of de.children)ae(be)};for(const de of L.tree.roots)ae(de);return Z&&Z.grand&&!this.#se()&&(se.push({at:te.length}),te.push(this.#s.grandTotal(Z.grand,this.#qe(L.leaves.length)))),this.#Y=null,this.#G=$,this.#D=se.length?se:$,this.#B=te,te}#Fe(){return t(()=>this.count(),L=>this.at(L))}#ot(L,Z){let ee=this.#L.get(L);if(ee===void 0){const te=this.#Ce(L),se=this.#mt(),ne=[],ae=this.#e.columnHidden;for(const de of se){if(de.quickFilter===!1||W(ae)&&ae(de.id))continue;const le=de.value&&W(de.value.quickFilterText)?de.value.quickFilterText({value:void 0,data:te,row:null,column:de,colId:de.id,grid:null,context:this.#z("context",null)}):null,be=le??(W(de.formatValue)?de.formatValue(W(de.getValue)?de.getValue(te):void 0):"");be!=null&&be!==""&&ne.push(String(be))}ee=ne.join(" ").toLowerCase(),this.#L.set(L,ee)}return Z(ee)}#Ge(){const L=this.#z("totals",[]),Z=L&&L.length?new Set(L):null;return this.#mt().filter(ee=>Z?Z.has(ee.id):!!(ee.total||ee.groupTotal||ee.grandTotal))}#Qe(L,Z,ee,te="group"){const se={},ne=(this.#e.compute||{}).total;for(const ae of L){if(!E(ae))continue;const de=this.#o.handle(ae.id);if(!de)continue;const le=j(ae,te);if(le)if(W(le)){const be=new Array(Z.length);for(let Ce=0;Ce<Z.length;Ce++)be[Ce]=de.get(Z[Ce]);se[ae.id]=le(be,{row:ee,column:ae,grid:this.#e.grid||null,context:this.#z("context",null),valueAt:(Ce,Ne)=>{const he=this.#o.handle(Ce);return he&&Ne>=0&&Ne<Z.length?he.get(Z[Ne]):null}})}else W(ne)&&(se[ae.id]=ne(de,Z,le))}return se}#Rt(L){if(!L)return L;const Z=this.#e.config||{},ee={tz:Z.timeZone,weekStartsOn:Z.weekStartsOn};return u(L,te=>{const se=b(te,ee),ne=this.#Ke(se&&se.col),ae=ne&&ne.type==="datetime";if(se&&se.type)return se.type==="datetime"&&!se.timeZone&&ne?{...se,timeZone:Z.timeZone||void 0}:se;if(ae)return{...se,type:"datetime",timeZone:Z.timeZone||void 0};const de=ne&&(ne.dataType?.base||ne.type);return de?{...se,type:de}:se})}#tt(L,Z){const ee=this.#z("expanded",null);return ee?W(ee.has)?ee.has(L,Z):Array.prototype.includes.call(ee,L):!0}#z(L,Z){if(L==="context"||!W(this.#e.stateVersion))return this.#jt(L,Z);const ee=this.#pt(L),te=this.#f.get(L);if(te&&te.version===ee)return te.value;const se=this.#jt(L,Z);return this.#f.set(L,{version:ee,value:se}),se}#jt(L,Z){const ee=this.#e.state;if(ee&&W(ee[L])){const te=ee[L]();return te??Z}return Z}#nt(){const L=this.#e.stateVersion;return W(L)?L():0}#Dt(){const L=this.#e.columnsVersion,Z=this.#e.permissionsVersion;return`${W(L)?L():0}|${W(Z)?Z():0}`}#pt(L){return L==="totals"?this.#Dt():`${this.#nt()}`}#Pt(L,Z,ee){if(!W(this.#e.stateVersion))return ee();const te=this.#d.get(L);if(te&&te.version===Z)return te.key;const se=ee();return this.#d.set(L,{version:Z,key:se}),se}#rt(L){const Z=(this.#e.compute||{})[L];return W(Z)||x(`ctx.compute.${L} is required by the memory source pipeline`),Z}#mt(){const L=this.#e.columns;return L&&W(L.all)?L.all():[]}#Ke(L){const Z=this.#e.columns;return Z&&W(Z.get)?Z.get(L):void 0}#ut(L,Z){const ee=this.#e.emit;W(ee)&&ee(L,Z)}}}),Be("packages/core/src/source/abort.js",function(e,D){"use strict";Object.defineProperty(e,"SupersededError",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"RequestToken",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"AbortScope",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createAbortScope",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return x}});class re extends Error{constructor(W,I="superseded"){super(`[lattice] request ${W?`"${W}" `:""}${I}`),this.name="SupersededError",this.superseded=!0,this.key=W}}class M{#e;constructor(W,I,K,R){this.#e=W,this.key=I,this.controller=K,this.signal=K.signal,this.seq=R}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(W){this.signal.aborted||this.controller.abort(new re(this.key,W)),this.#e.settle(this)}}class G{#e=new Map;#t=0;begin(W="",I="superseded"){const K=this.#e.get(W);K&&!K.signal.aborted&&K.controller.abort(new re(W,I));const R=new M(this,W,new AbortController,++this.#t);return this.#e.set(W,R),R}tokenFor(W){return this.#e.get(W)}pending(W=""){const I=this.#e.get(W);return!!I&&!I.signal.aborted}get size(){return this.#e.size}settle(W){this.#e.get(W.key)===W&&this.#e.delete(W.key)}abort(W="",I="superseded"){const K=this.#e.get(W);K&&K.abort(I)}abortAll(W="superseded"){for(const I of[...this.#e.values()])I.abort(W);this.#e.clear()}}function F(){return new G}function x(q){if(!q||typeof q!="object")return!1;const W=q;return W.superseded===!0||W.name==="AbortError"||W.name==="SupersededError"}}),Be("packages/core/src/source/blockcache.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_PAGE_SIZE",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"DEFAULT_MAX_CACHED_PAGES",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"BlockCache",{enumerable:!0,get:function(){return F}});const re=100,M=32;class G{constructor(q){this.id=q,this.rows=null,this.state="pending",this.token=null,this.error=null}}class F{#e=new Map;#t;#n;#r=0;#i=-1;constructor(q={}){this.#t=Math.max(1,Math.floor(Number(q.pageSize)||re)),this.#n=Math.max(1,Math.floor(Number(q.maxCachedPages)||M))}get pageSize(){return this.#t}get maxBlocks(){return this.#n}get size(){return this.#e.size}blockOf(q){return Math.floor(q/this.#t)}rangeOf(q){return{start:q*this.#t,end:(q+1)*this.#t}}has(q){return this.#e.has(q)}pending(q){const W=this.#e.get(q);return!!W&&W.state==="pending"}loaded(q){const W=this.#e.get(q);return!!W&&W.state==="loaded"}begin(q,W){let I=this.#e.get(q);return I||(I=new G(q)),I.state="pending",I.token=W,I.error=null,this.#s(q,I),I}fill(q,W){const I=this.#e.get(q)||new G(q);I.rows=W,I.state="loaded",I.token=null,this.#s(q,I)}failed(q,W){const I=this.#e.get(q)||new G(q);I.state="error",I.error=W,I.token=null,this.#s(q,I)}delete(q){return this.#e.delete(q)}rowAt(q){const W=this.blockOf(q),I=this.#e.get(W);if(!(!I||I.state!=="loaded"||!I.rows))return this.#s(W,I),I.rows[q-W*this.#t]}rowLoaded(q){const W=this.blockOf(q),I=this.#e.get(W);return!!I&&I.state==="loaded"&&!!I.rows&&q-W*this.#t<I.rows.length}erroredAt(q){const W=this.#e.get(this.blockOf(q));return!!W&&W.state==="error"}loadedExtent(){let q=0;for(const W of this.#e.values()){if(W.state!=="loaded"||!W.rows)continue;const I=W.id*this.#t+W.rows.length;I>q&&(q=I)}return q}fillOf(q){const W=this.#e.get(q);return W&&W.state==="loaded"&&W.rows?W.rows.length:null}protect(q,W){this.#r=this.blockOf(Math.max(0,q)),this.#i=this.blockOf(Math.max(0,W))}evict(){const q=[];if(this.#e.size<=this.#n)return q;for(const[W,I]of this.#e){if(this.#e.size-q.length<=this.#n)break;W>=this.#r&&W<=this.#i||I.state!=="pending"&&q.push(W)}for(const W of q)this.#e.delete(W);return q}ids(){return[...this.#e.keys()]}clear(){this.#e.clear()}#s(q,W){this.#e.delete(q),this.#e.set(q,W)}}}),Be("packages/core/src/source/pagewindow.js",function(e,D){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return re}});function re(M,G,F,x){const q=Math.floor(Number(M)||0);if(q<=0)return null;const W=Math.max(0,Math.floor(Number(G)||0)),I=Math.max(0,Math.floor(Number(F)||0));if(x){const K=Math.max(1,Math.ceil(I/q)),R=Math.min(W,K-1),S=R*q;return{page:R,pageSize:q,offset:S,length:Math.max(0,Math.min(q,I-S)),pageCount:K,total:I}}return{page:W,pageSize:q,offset:W*q,length:q,pageCount:Math.max(W+2,Math.ceil(I/q)),total:null}}}),Be("packages/core/src/source/paged.js",function(e,D){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"PagedSource",{enumerable:!0,get:function(){return p}});const M=D("packages/core/src/internal/lru.js").Lru,F=D("packages/core/src/internal/predicates.js").isFunction,q=D("packages/core/src/internal/warn.js").warnOnce,I=D("packages/core/src/internal/schedule.js").settleDebounce,K=D("packages/core/src/source/abort.js"),R=K.createAbortScope,S=K.isAbortError,k=D("packages/core/src/source/blockcache.js"),y=k.BlockCache,l=k.DEFAULT_PAGE_SIZE,g=k.DEFAULT_MAX_CACHED_PAGES,t=D("packages/core/src/source/rows.js").createRowFactory,o=D("packages/core/src/source/filterwire.js"),c=o.wireFilters,f=o.querySignature,n=o.warnHostFilterNotApplied,r=D("packages/core/src/source/pagewindow.js").pageWindow,s=120;function d(u,b){return new p(u,b)}class p{mode="paged";#e;#t;#n;#r=R();#i;#s;#o=new Map;#l=null;#a=null;#c=!1;#u=0;#f="";#d={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(b,a){this.#e=b||{mode:"paged"},this.#t=a||{},this.#n=new y({pageSize:this.#e.pageSize||l,maxCachedPages:this.#e.maxCachedPages||g}),this.#i=t(this.#t),this.#s=new M(this.#n.pageSize*4),this.#h=I((h,w)=>this.#w(h,w),s),this.#f=this.#P(),F(this.#e.fetch)||q("source.paged.fetch",'source.mode "paged" requires a fetch function; the grid will stay empty.'),n(this.#t)}count(){const b=this.#y();return b?b.length:this.#b()}#b(){if(this.#C(),this.#l!==null)return this.#l;const b=Math.max(this.#u,this.#n.loadedExtent());return this.#c?b:b+this.#n.pageSize}matchCount(){return this.#b()}totalCount(){return this.#b()}pageInfo(){const b=this.#y();if(!b){const a=this.#b();return{page:0,pageSize:0,total:this.exact()?a:null,pageCount:1,counting:!1}}return{page:b.page,pageSize:b.pageSize,total:b.total,pageCount:b.pageCount,counting:b.total===null&&this.#r.size>0&&this.#u===0&&this.#n.loadedExtent()===0}}#y(){const b=this.#b(),a=r(this.#T("pageSize",0),this.#T("page",0),b,this.exact());if(!a)return this.#g="",null;const h=`${this.#m}:${a.offset}:${a.length}`;if(h!==this.#g&&!this.#p&&(this.#g=h,a.length>0)){const w=a.offset+a.length-1;this.#d={start:a.offset,end:w},this.#w(a.offset,w)}return a}at(b){const a=this.#y();if(a){if(b<0||b>=a.length)return;const h=this.#O(a.offset+b);return h&&(h.index=b),h}return this.#O(b)}#O(b){if(b<0||b>=this.#b())return;const a=this.#s.get(b);if(a&&(a.data!==null||!this.#n.rowLoaded(b)))return a;const h=this.#n.rowAt(b);if(h===void 0){const v=this.#i.skeleton(b,0,this.#n.erroredAt(b));return this.#s.set(b,v),v}const w=this.#i.leaf(h,b);return w.index=b,this.#s.set(b,w),this.#o.set(w.key,b),w}byKey(b){const a=this.#o.get(b);return a===void 0?void 0:this.#O(a)}loaded(b){const a=this.#y();return a?b>=0&&b<a.length&&this.#n.rowLoaded(a.offset+b):this.#n.rowLoaded(b)}loadedCount(){this.#C();let b=0;for(const a of this.#n.ids()){if(!this.#n.loaded(a))continue;const h=this.#n.fillOf(a);typeof h=="number"&&(b+=h)}return b}residentRows(){this.#C();const b=this.#y(),a=b?b.offset:0,h=b?b.offset+b.length:1/0,w=[],v=this.#n.ids().sort((A,_)=>A-_);for(const A of v){if(!this.#n.loaded(A))continue;const{start:_}=this.#n.rangeOf(A),V=this.#n.fillOf(A)||0;for(let Y=_;Y<_+V;Y++){if(Y<a||Y>=h)continue;const $=this.#s.peek(Y);if($&&$.data!==null&&$.data!==void 0){w.push($);continue}const j=this.#n.rowAt(Y);if(j===void 0)continue;const E=this.#i.leaf(j,Y);E.index=Y,this.#s.set(Y,E),this.#o.set(E.key,Y),w.push(E)}}return w}hint(b,a){if(this.#p)return;const h=this.#C();let w=Math.max(0,Math.floor(b)),v=Math.max(w,Math.floor(a));const A=this.#y();if(A){if(A.length===0)return;w=A.offset,v=A.offset+A.length-1}this.#d={start:w,end:v},this.#n.protect(w,v);for(const _ of this.#n.evict())this.#v(_);this.#h(w,v),h&&this.#h.flush()}#w(b,a){if(this.#p)return;this.#n.protect(b,a);const h=this.#n.blockOf(b),w=this.#n.blockOf(a);for(let v=h;v<=w&&!(this.#l!==null&&v*this.#n.pageSize>=this.#l);v++)this.#n.has(v)||this.#A(v)}apply(b){const a={added:[],updated:[],removed:[]};if(!b)return a;if(b.update)for(const h of b.update){const w=this.#i.keyOf(h,-1),v=this.#o.get(w);if(v===void 0)continue;const A=this.#i.leaf(h,v);A.index=v,this.#s.set(v,A),a.updated.push(A)}return(b.add&&b.add.length||b.remove&&b.remove.length)&&this.reload(),a}reload(b){this.#S("reload"),this.#h.cancel(),this.hint(this.#d.start,this.#d.end)}destroy(){this.#p=!0,this.#h.cancel(),this.#r.abortAll("destroyed"),this.#n.clear(),this.#s.clear(),this.#o.clear()}exact(){return this.#l!==null||this.#c}pending(){return this.#r.size}async#A(b){if(!F(this.#e.fetch))return;const a=this.#r.begin(`block:${b}`);this.#n.begin(b,a);const{start:h,end:w}=this.#n.rangeOf(b),v=this.#f;try{const A=await this.#e.fetch({range:{start:h,end:w},sort:this.#T("sort",[]),filters:c(this.#T("filters",null),this.#E()),quick:this.#T("quick","")||void 0,context:this.#T("context",null),signal:a.signal});if(!a.current||v!==this.#f||this.#p)return;a.settle();const _=A&&A.rows||[];this.#n.fill(b,_);for(let Y=0;Y<_.length;Y++)this.#s.delete(h+Y);const V=A&&typeof A.total=="number"?A.total:A&&typeof A.count=="number"?A.count:null;V!==null?(this.#l=V,this.#c=!0):_.length<this.#n.pageSize?(this.#c=!0,this.#l=h+_.length):this.#u=Math.max(this.#u,h+_.length),this.#M("model:changed",{reason:"page",block:b,from:h,to:h+_.length}),this.#M("rows:changed",{companion:!0,reason:"page",block:b,from:h,to:h+_.length}),this.#l!==null&&this.#l!==this.#a&&(this.#a=this.#l,this.#M("source:total",{total:this.#l,groupPath:[]}))}catch(A){if(a.settle(),S(A))return;this.#n.failed(b,A);for(let _=h;_<w;_++)this.#s.delete(_);this.#M("model:changed",{reason:"page-error",block:b,range:{start:h,end:w}}),this.#M("source:error",{error:A,block:b,range:{start:h,end:w}})}}#v(b){const{start:a,end:h}=this.#n.rangeOf(b);for(let w=a;w<h;w++){const v=this.#s.peek(w);v&&this.#o.delete(v.key),this.#s.delete(w)}}#C(){const b=this.#P();return b===this.#f?!1:(this.#f=b,this.#S("query"),!0)}#S(b){this.#r.abortAll(b),this.#n.clear(),this.#s.clear(),this.#o.clear(),this.#l=null,this.#a=null,this.#c=!1,this.#u=0,this.#m++,this.#M("model:changed",{reason:b})}#P(){return f({filters:this.#T("filters",null),sort:this.#T("sort",[]),quick:this.#T("quick",""),context:this.#T("context",null)})}#E(){const b=this.#t.config||{};return{tz:b.timeZone,weekStartsOn:b.weekStartsOn}}#T(b,a){const h=this.#t.state;if(h&&F(h[b])){const w=h[b]();return w??a}return a}#M(b,a){const h=this.#t.emit;F(h)&&h(b,a)}}}),Be("packages/core/src/source/aggregates.js",function(e,D){"use strict";Object.defineProperty(e,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"pushableAggregates",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"fillAggregateSql",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"routeAggregate",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"resolveAggregatePlan",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"groupKeysPushable",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"pushdownDocRows",{enumerable:!0,get:function(){return K}});const re=Object.freeze({sum:{pushable:!0,class:"identical",sql:"sum(%c)"},avg:{pushable:!0,class:"identical",sql:"avg(%c)"},min:{pushable:!0,class:"identical",sql:"min(%c)"},max:{pushable:!0,class:"identical",sql:"max(%c)"},count:{pushable:!0,class:"identical",sql:"count(*)"},countValues:{pushable:!0,class:"identical",sql:"count(%c)",blankAware:!0},range:{pushable:!0,class:"identical",sql:"(max(%c) - min(%c))"},variance:{pushable:!0,class:"identical",sql:"var_samp(%c)"},varianceP:{pushable:!0,class:"identical",sql:"var_pop(%c)"},stddev:{pushable:!0,class:"identical",sql:"stddev_samp(%c)"},stddevP:{pushable:!0,class:"identical",sql:"stddev_pop(%c)"},sumSquares:{pushable:!0,class:"identical",sql:"sum(%c * %c)"},median:{pushable:!0,class:"identical",sql:"median(%c)"},p25:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.25)"},p75:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.75)"},p90:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.9)"},p95:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.95)"},p99:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.99)"},iqr:{pushable:!0,class:"identical",sql:"(quantile_cont(%c, 0.75) - quantile_cont(%c, 0.25))"},mad:{pushable:!0,class:"identical",sql:"mad(%c)"},distinct:{pushable:!0,class:"identical",sql:"count(DISTINCT %c)",blankAware:!0},skewness:{pushable:!0,class:"identical",sql:"skewness(%c)"},kurtosis:{pushable:!0,class:"identical",sql:"kurtosis(%c)"},geomean:{pushable:!0,class:"identical",sql:"exp(avg(ln(%c)))"},harmean:{pushable:!0,class:"identical",sql:"(count(%c) / sum(1.0 / %c))"},entropy:{pushable:!0,class:"identical",sql:"entropy(%c)",blankAware:!0},correlation:{pushable:!0,class:"identical",sql:"corr(%w, %c)",twoColumn:!0},hhi:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_transform(map_values(histogram(%c)), lambda v: (v::DOUBLE/count(%c))*(v::DOUBLE/count(%c)))) END"},evenness:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL WHEN count(DISTINCT %c)<2 THEN 1.0 ELSE entropy(%c)/log2(count(DISTINCT %c)) END"},top3Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,3))::DOUBLE/count(%c) END"},top10Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,10))::DOUBLE/count(%c) END"},gini:{pushable:!0,class:"identical",sql:"CASE WHEN list_min(list(%c) FILTER (WHERE isfinite(%c)))<0 THEN NULL WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL WHEN list_sum(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN 0 ELSE 2.0*list_sum(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v, i: i*v))/(len(list(%c) FILTER (WHERE isfinite(%c)))*list_sum(list(%c) FILTER (WHERE isfinite(%c))))-(len(list(%c) FILTER (WHERE isfinite(%c)))+1.0)/len(list(%c) FILTER (WHERE isfinite(%c))) END"},trimmedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_slice(list_sort(list(%c) FILTER (WHERE isfinite(%c))), floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1, len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT)) END"},winsorizedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v: least(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT], greatest(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1], v)))) END"},robustOutliers:{pushable:!0,class:"identical",sql:"(SELECT CASE WHEN len(d.a)=0 THEN NULL WHEN d.mad=0 THEN NULL ELSE len(list_filter(d.a, lambda v: abs(0.6745*(v-d.med)/d.mad)>3.5)) END FROM (SELECT xs AS a, list_median(xs) AS med, list_median(list_transform(xs, lambda w: abs(w-list_median(xs)))) AS mad FROM (SELECT list(%c) FILTER (WHERE isfinite(%c)) AS xs)) d)"},jarqueBera:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))<8 THEN NULL WHEN list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2)))=0 THEN NULL ELSE (len(list(%c) FILTER (WHERE isfinite(%c)))/6.0)*(power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),3)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),1.5),2)+power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),4)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),2)-3,2)/4.0) END"},weightedAvg:{pushable:!0,class:"identical",twoColumn:!0,sql:"sum(%c*%w) FILTER (WHERE isfinite(%c) AND isfinite(%w))/nullif(sum(%w) FILTER (WHERE isfinite(%c) AND isfinite(%w)),0)"},mode:{pushable:!0,class:"may-differ",sql:"mode(%c)",note:"DuckDB returns a modal value even for an all-distinct column; the grid returns null. Tie-breaking can also differ, and on a text column an empty string counts as a value. Under pushdown you will see a value."},weightedQuantile:{pushable:!1,class:"fallback",note:"No SQL equivalent for the grid's weighted-quantile midpoint convention; always computed client-side (needs a full-dataset pull for a correct figure over a remote source)."}});function M(){const R=new Set;for(const[S,k]of Object.entries(re))k.pushable&&R.add(S);return R}function G(R,S,k){let y=R.split("%c").join(S);return k!==void 0&&(y=y.split("%w").join(k)),y}function F(R){const S=R||{},k=S.default==="engine"||S.default==="engine-if-identical"?S.default:"client",y={};if(S.overrides&&typeof S.overrides=="object")for(const[l,g]of Object.entries(S.overrides))(g==="engine"||g==="client")&&(y[l]=g);return{default:k,overrides:y}}function x(R,S){const k=re[R];if(!k||!k.pushable)return"client";const y=S.overrides[R];return y==="engine"||y==="client"?y:S.default==="client"?"client":S.default==="engine-if-identical"?k.class==="identical"?"engine":"client":"engine"}function q(R,S){const k=F(S),y=[],l=[];for(const g of R||[]){const i=re[g.fn],t=x(g.fn,k),o={id:g.id,col:g.col,fn:g.fn,class:i?i.class:"fallback"};g.weight!==void 0&&(o.weight=g.weight),g.params!==void 0&&(o.params=g.params),t==="engine"?y.push(o):(o.reason=i&&!i.pushable?i.note||"the engine cannot express this stat":"client by config",l.push(o))}return{engine:y,client:l,config:k}}const W=/^[A-Za-z_][A-Za-z0-9_$]*$/;function I(R,S=[]){return(R||[]).every(y=>{if(typeof y=="string")return W.test(y);if(!y||typeof y!="object")return!1;const l=y;return Array.isArray(S)&&S.includes(l.bucket)&&typeof l.col=="string"&&W.test(l.col)&&typeof l.size=="number"&&Number.isFinite(l.size)&&l.size>0})}function K(){return Object.entries(re).map(([R,S])=>({stat:R,class:S.class,sql:S.sql?G(S.sql,"col",S.twoColumn?"weight":void 0):"",note:S.note||(S.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),Be("packages/core/src/source/pushdown.js",function(e,D){"use strict";Object.defineProperty(e,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"NO_CAPABILITIES",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"capabilitiesOf",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"splitFilters",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"applyResidual",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"createPushdownSource",{enumerable:!0,get:function(){return H}});const M=D("packages/core/src/internal/compare.js").defaultCompare,F=D("packages/core/src/internal/predicates.js").isFunction,q=D("packages/core/src/internal/merge.js").toArray,I=D("packages/core/src/internal/warn.js").warnOnce,K=D("packages/core/src/source/filterwire.js"),R=K.isGroup,S=K.warnWherePageRelative,k=K.warnWhereOverThreshold,y=K.wireFilters,l=D("packages/core/src/source/aggregates.js"),g=l.resolveAggregatePlan,i=l.groupKeysPushable,t=l.STAT_PUSHDOWN,c=D("packages/core/src/source/abort.js").SupersededError,f=1e3;function n(L){const Z=L&&L.signal;if(!Z||!Z.aborted)return;const ee=Z.reason;throw ee instanceof Error?ee:new c("","superseded before it was sent")}const m=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function r(L){if(!L||typeof L!="object")return!1;const Z=L.returning==="row"||L.returning==="key"?L.returning:"none";return{append:L.append===!0,update:L.update===!0,delete:L.delete===!0,returning:Z}}function s(L,Z){if(!L||typeof Z!="string")return;if(!Z.includes("."))return L[Z];let ee=L;for(const te of Z.split(".")){if(ee===null||typeof ee!="object")return;ee=ee[te]}return ee}function d(L){if(L===!0)return!0;if(!L||typeof L!="object")return!1;const Z=L;return Z.enabled===!1?!1:Z.enabled===!0||F(Z.commit)}function p(L){const Z={...m,...L||{}};return Z.operators=new Set(Z.operators||[]),Z.mutate=r(Z.mutate),Z}function u(L,Z){return!L||!L.op||!Z.operators.size?!1:Z.operators.has(L.op)}function b(L,Z){if(!L)return{pushed:null,residual:null};if(!Z.filter)return{pushed:null,residual:L};if(Z.filter==="term"){if(R(L)){const ne=L.conditions||[];if(String(L.op)!=="and")return{pushed:null,residual:L};const ae=ne.findIndex(le=>!R(le)&&u(le,Z));if(ae<0)return{pushed:null,residual:L};const de=ne.filter((le,be)=>be!==ae);return{pushed:ne[ae],residual:de.length?{op:"and",conditions:de}:null}}return u(L,Z)?{pushed:L,residual:null}:{pushed:null,residual:L}}if(!R(L))return u(L,Z)?{pushed:L,residual:null}:{pushed:null,residual:L};if(String(L.op)!=="and")return(L.conditions||[]).every(ae=>R(ae)?b(ae,Z).residual===null:u(ae,Z))?{pushed:L,residual:null}:{pushed:null,residual:L};const ee=[],te=[];for(const ne of L.conditions||[]){if(R(ne)){if(Z.filter==="flat"){te.push(ne);continue}const ae=b(ne,Z);ae.pushed&&ee.push(ae.pushed),ae.residual&&te.push(ae.residual);continue}(u(ne,Z)?ee:te).push(ne)}const se=ne=>ne.length===0?null:ne.length===1?ne[0]:{op:"and",conditions:ne};return{pushed:se(ee),residual:se(te)}}const a="__lattice_leaves";function h(L){return L.aggregates?L.aggregates instanceof Set?L.aggregates:new Set(q(L.aggregates)):new Set}function w(L){const Z=h(L);return Z.size?Z.has("count")?L.filter!=="tree"||!L.operators||!L.operators.has("eq")?"the adapter does not declare the `group` capability, and cannot narrow a group's rows by its key (that needs a `tree` filter with the `eq` operator)":"":"the adapter does not declare the `group` capability, and its declared aggregates have no `count` to give each group its row count":"the adapter does not declare the `group` capability"}function v(L,Z,ee,te,se,ne,ae){const de=Array.isArray(L.groupBy)?L.groupBy:[],le=Array.isArray(L.groupPath)?L.groupPath:[],be=Array.isArray(L.groupValues)?L.groupValues:null;if(!Z.group){const Ce=w(Z);if(Ce)return Ce}return i(de)?ee.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":te?se?ne?"a host `where` predicate can only run in the browser, over rows the engine grouped":ae?"fullDataset holds the whole matching set, so the grid groups it itself":!be||be.length!==le.length?"the request carries no typed `groupValues` for its group path, and the string `groupPath` cannot be compared against a typed column":"":"a quick search did not push, so the engine would group unsearched rows":"the sort did not push, so the engine would order the groups differently":"a grouping key is not a plain column the engine can name in a GROUP BY"}const A="pushdown:pivot-unsupported",_="pushdown:group-unsupported",V=Symbol("lattice.remote.ungroupedLevel");function Y(L,Z,ee,te,se,ne){const ae=Array.isArray(L.pivotBy)?L.pivotBy:[],de=Array.isArray(L.groupBy)?L.groupBy:[],le=Array.isArray(L.groupPath)?L.groupPath:[],be=Array.isArray(L.groupValues)?L.groupValues:null;return Z.pivot?i(ae)?de.length&&!i(de)?"a grouping key is not a plain column the engine can name in a GROUP BY":ee.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":te?se?ne?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!be||be.length!==le.length?"the request carries no typed `groupValues` for its group path, and the string `groupPath` cannot be compared against a typed column":"":"a quick search did not push, so the engine would pivot unsearched rows":"the sort did not push, so the engine would order the rows differently":"a pivot column is not a plain column the engine can name in a GROUP BY":"the adapter does not declare the `pivot` capability"}function $(L,Z,ee=!1){const te=b(L.filters||null,Z),se=[];te.residual&&se.push("filter");const ne=L.sort||[],ae=ne.length===0||Z.sort==="multi"&&ne.length>=1||Z.sort==="single"&&ne.length===1;!ae&&ne.length&&se.push("sort");const de=L.quick?String(L.quick):"",le=!de||!!Z.quick;le||se.push("quick");const be=L.where&&L.where.active?L.where:null;be&&se.push("where");const Ce={filters:te.residual,sort:ae?null:ne,quick:le?"":de,where:be},Ne=!!ee,he=Array.isArray(L.groupBy)&&L.groupBy.length>0,ie=he?v(L,Z,te,ae,le,be,Ne):"",ue=L.pivotMode!==!1&&Array.isArray(L.pivotBy)&&L.pivotBy.length>0,ge=ue?Y(L,Z,te,ae,le,be):"",pe=ue&&ge==="";ue&&!pe&&se.push("pivot");const Oe=ue?pe&&he:he&&ie==="";he&&!ue&&!Oe&&se.push("group");const ve=(Oe||pe)&&Array.isArray(L.groupValues)?L.groupValues.length:0,ye=Oe||ue?!1:Ne||!!(Ce.filters||Ce.sort||Ce.quick||Ce.where)||!Z.range;return{pushed:{...L,filters:te.pushed,sort:ae?ne:[],quick:le?de:"",range:ye?null:L.range},residual:Ce,needsAll:ye,unpushed:se,full:Ne,grouped:Oe,groupLevel:ve,groupReason:ue?"":ie,pivoted:pe,pivotReason:ge}}function j(L){const Z=Array.isArray(L.totals)?L.totals:[],ee=L.totalFns&&typeof L.totalFns=="object"?L.totalFns:{},te=[],se=[];for(const ne of Z){const ae=String(ne),de=typeof ee[ae]=="string"?ee[ae]:null,le=de?t[de]:null;de?!le||!le.pushable||!le.sql?se.push({id:ae,fn:de,class:le?le.class:"fallback",reason:le&&le.note?le.note:`the pushdown map cannot express "${de}"`}):le.twoColumn?se.push({id:ae,fn:de,class:le.class,reason:`"${de}" reduces two columns, and a grouped request carries no weight column`}):te.push({id:ae,col:ae,fn:de,class:le.class}):se.push({id:ae,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:te,client:se}}const E=Object.freeze({items:L=>L==null?[]:Array.isArray(L)?L:[L]});function O(L,Z,ee){if(!Z)return L;let te=L;if(Z.filters&&F(ee.evaluateFilters)){const se=te,ne={count:te.length,handle:le=>({id:le,get:be=>s(se[be],le)}),itemwise:le=>se.some(be=>Array.isArray(s(be,le)))?E:null},ae=ee.evaluateFilters(Z.filters,ne),de=[];for(let le=0;le<te.length;le++)ae[le]&&de.push(te[le]);te=de}if(Z.where&&Z.where.active&&(Z.whole||S(Z.where.names,"pushdown"),te=te.filter(se=>Z.where.passes(se))),Z.quick){const se=Z.quick.toLowerCase();te=te.filter(ne=>{if(!ne||typeof ne!="object")return!1;for(const ae of Object.values(ne))if(ae!=null&&String(ae).toLowerCase().includes(se))return!0;return!1})}if(Z.sort&&Z.sort.length&&F(ee.sortMulti)){const se=[...new Set(Z.sort.map(le=>le.col))],ne=te,ae=se.map(le=>({id:le,get:be=>s(ne[be],le)})),de=ee.sortMulti(ae,Z.sort.map(le=>({col:le.col,dir:le.dir})),Uint32Array.from({length:te.length},(le,be)=>be),{});te=Array.from(de,le=>ne[le])}return te}function N(L){return JSON.stringify({filters:L.filters||null,sort:L.sort||[],quick:L.quick||"",groupBy:L.groupBy||[],groupPath:L.groupPath||[],context:L.context??null})}function T(L){if(!L||typeof L!="object")return 16;let Z="";try{Z=JSON.stringify(L)}catch{return 200}return Z.length*2+64}function C(L){const Z=L||{};return{enabled:!!Z.enabled,maxRows:Number.isFinite(Z.maxRows)?Z.maxRows:1e6,maxBytesEstimate:Number.isFinite(Z.maxBytesEstimate)?Z.maxBytesEstimate:512*1024*1024}}const B=5e4;function z(L){return Number.isFinite(L)&&L>=0?L:B}function X(L){return!!L&&F(L.then)}async function Q(L){if(!L||L.total!==void 0||!X(L.pendingTotal))return L;const Z=await L.pendingTotal,{pendingTotal:ee,...te}=L;return typeof Z=="number"?{...te,total:Z}:te}function H(L={}){const Z=L.adapter;if(!Z||!F(Z.execute))return I("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...L,mode:"remote",fetch:async()=>({rows:[],total:0})};const ee=p(Z.capabilities),te=Z.capabilities&&Object.getOwnPropertyDescriptor(Z.capabilities,"operators");te&&F(te.get)&&Object.defineProperty(ee,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(Z.capabilities.operators||[]),set:()=>{}});const se=Z.name||"adapter";let ne=null;const ae=()=>F(Z.ready)?(ne||(ne=Promise.resolve(Z.ready()).then(()=>{Object.assign(ee,p(Z.capabilities))},we=>{throw ne=null,we})),ne):null,de=C(L.fullDataset),le=!!L.allowPartialResults,be=z(L.whereRowLimit);let Ce=null;const Ne=L.aggregates;let he=null,ie=null,ue=null,ge=null,pe=null,Oe,ve=null,ye=0,Ae=null;const Me=()=>!de.enabled||!he?null:(Ae!==he.key&&(ye++,Ae=he.key),{rows:he.rows,version:ye}),je=async we=>{const Te=we.where&&we.where.active?we.where:null;if(!Te)return{request:we,probe:null};const{where:Le,...xe}=we,Ue=$(xe,ee,de.enabled);if(Ue.needsAll)return{request:we,probe:null};const ze=N(Ue.pushed);let Ge=null;return(!Ce||Ce.key!==ze)&&(ee.total?(n(we),Ge=await Q(await Z.execute(Ue.pushed,we)),Ce={key:ze,size:Ge&&typeof Ge.total=="number"?Ge.total:null}):Ce={key:ze,size:null}),Ce.size!==null&&Ce.size<be?{request:we,probe:null}:(k(Te.names,se,Ce.size,be),{request:xe,probe:Ge})},_e=async(we,Te)=>{ve=null;const Le=j(we.pushed);ue={engine:Le.engine,client:Le.client,groupBy:we.pushed.groupBy},Le.client.length&&I(`source.pushdown.group.totals.${se}.${Le.client.map(ze=>ze.id).join(".")}`,`the ${se} adapter cannot compute the group subtotal for ${Le.client.map(ze=>`"${ze.id}" (${ze.reason})`).join(", ")}, so those group rows carry no value for that column. A figure computed over anything other than the group would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const xe=await Z.executeGroupLevel(we.pushed,Le.engine,Te)||{};let Ue=xe.rows||[];return!ee.range&&Te.range&&(Ue=Ue.slice(Te.range.start,Te.range.end)),We(xe),xe.total===void 0?{rows:Ue}:{rows:Ue,total:xe.total}},Pe=new Map,Se=64,Fe=async(we,Te)=>{ve=null;const Le=we.pushed,xe=Le.groupBy,Ue=Array.isArray(Le.groupValues)?Le.groupValues:[],ze=Ue.length,Ge=[...Le.filters?[Le.filters]:[],...xe.slice(0,ze).map((ct,pt)=>({col:ct,op:"eq",value:Ue[pt]===void 0?null:Ue[pt],caseSensitive:!0}))],tt=Ge.length===0?null:Ge.length===1?Ge[0]:{op:"and",conditions:Ge},it=Te.range?Te.range.start:0;if(ze>=xe.length){const ct={...Le,filters:tt,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},pt=await Q(await Z.execute(ct,Te))||{};let Ot=pt.rows||[];return!ee.range&&Te.range&&(Ot=Ot.slice(Te.range.start,Te.range.end)),typeof pt.total=="number"?{rows:Ot,total:pt.total}:{rows:Ot}}const ut=xe[ze],wt=j(Le),jt=h(ee),Ve=wt.engine.filter(ct=>jt.has(ct.fn)),Je=[...wt.engine.filter(ct=>!jt.has(ct.fn)).map(ct=>({id:ct.id,fn:ct.fn,class:ct.class,reason:`the ${se} adapter does not compute "${ct.fn}"`})),...wt.client];ue={engine:Ve,client:Je,groupBy:xe},Je.length&&I(`source.pushdown.group.totals.${se}.${Je.map(ct=>ct.id).join(".")}`,`the ${se} adapter cannot compute the group subtotal for ${Je.map(ct=>`"${ct.id}" (${ct.reason})`).join(", ")}, so those group rows carry no value for that column. A figure computed over anything other than the group would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const st=[...Ve.map(ct=>({id:ct.id,col:ct.col,fn:ct.fn})),{id:a,col:ut,fn:"count"}],et={...Le,filters:tt,range:null},ft=JSON.stringify([N(et),Ue,ut,st]);let At=it>0?Pe.get(ft):void 0;if(!At){for(At=Promise.resolve(Z.executeGroupedAggregates(et,[ut],st)),Pe.delete(ft),Pe.set(ft,At);Pe.size>Se;)Pe.delete(Pe.keys().next().value);At.catch(()=>{Pe.get(ft)===At&&Pe.delete(ft)})}const Et=await At||[];n(Te);const Rt=ct=>{const pt={};for(const Ot of Ve)pt[Ot.id]=ct?ct[Ot.id]:void 0;return pt},xt=(Le.sort||[]).find(ct=>ct&&ct.col===ut),Ft=xt&&xt.dir==="desc"?-1:1,Ht=Et.filter(ct=>ct&&ct.level===1).map(ct=>({[ut]:ct.keys[0]===void 0?null:ct.keys[0],leafCount:Number(ct.values&&ct.values[a])||0,totals:Rt(ct.values)})).sort((ct,pt)=>Ft*M(ct[ut],pt[ut]));if(ze===0){const ct=Et.find(Ot=>Ot&&Ot.level===0),pt=ct?Number(ct.values&&ct.values[a]):NaN;We({matchCount:Number.isFinite(pt)?pt:Ht.reduce((Ot,Lt)=>Ot+Lt.leafCount,0),...ct?{grand:Rt(ct.values)}:{}})}const qe=Te.range?Te.range.end:Ht.length;return{rows:Ht.slice(it,qe),total:Ht.length}},We=we=>{typeof we.matchCount=="number"&&(ge=we.matchCount,pe=we.grand?{totals:we.grand,leafCount:we.matchCount}:null,Oe===void 0&&F(Z.unfilteredCount)&&(Oe=null,Promise.resolve(Z.unfilteredCount()).then(Te=>{Oe=typeof Te=="number"?Te:null}).catch(Te=>{I(`source.pushdown.group.unfiltered.${se}`,`the ${se} adapter could not count the unfiltered set (${Te&&Te.message?Te.message:Te}), so "N of M" falls back to the display count for its denominator.`)})))},He=async(we,Te)=>{ve=null;const Le=j(we.pushed);ue={engine:Le.engine,client:Le.client,groupBy:we.pushed.groupBy,pivotBy:we.pushed.pivotBy},Le.client.length&&I(`source.pushdown.pivot.totals.${se}.${Le.client.map(tt=>tt.id).join(".")}`,`the ${se} adapter cannot compute the pivot cells for ${Le.client.map(tt=>`"${tt.id}" (${tt.reason})`).join(", ")}, so those cells are empty. A figure computed over anything other than the cell would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const xe=await Z.executePivotLevel(we.pushed,Le.engine,Te)||{};let Ue=xe.rows||[];!ee.range&&Te.range&&(Ue=Ue.slice(Te.range.start,Te.range.end)),We(xe);const ze=xe.pivot&&typeof xe.pivot=="object"?xe.pivot:{},Ge={cells:Array.isArray(ze.cells)?ze.cells:[],...Array.isArray(ze.axis)?{axis:ze.axis}:{}};return xe.total===void 0?{rows:Ue,pivot:Ge}:{rows:Ue,total:xe.total,pivot:Ge}},Ye=we=>{I(`source.pushdown.pivot.${se}.${we}`,`pushdown:pivot-unsupported: the ${se} adapter cannot pivot this query because ${we}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const Te=new Error(`[lattice] ${A}: the ${se} adapter cannot pivot this query because ${we}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw Te.code=A,Te.reason=we,Te},Qe=(we,Te)=>{const Le={key:Te,state:"pending",value:null};return ve=Le,we.then(xe=>(ve===Le&&(ve={key:Te,state:"settled",value:typeof xe=="number"?xe:null}),xe),xe=>{throw ve===Le&&(ve={key:Te,state:"failed",value:null}),xe})};let lt=0,ot=[];const yt=()=>lt===0?null:new Promise(we=>{const Te=setTimeout(we,f);ot.push(()=>{clearTimeout(Te),we()})});let Ct;const Nt=async we=>{const Te=ae();Te&&await Te;const xe=we&&we.pivotMode!==!1&&Array.isArray(we.pivotBy)&&we.pivotBy.length>0?{request:we,probe:null}:await je(we);n(we);let Ue=$(xe.request,ee,de.enabled);if(ee.group&&Ue.grouped&&!Ue.pivoted&&!F(Z.executeGroupLevel)&&(I(`source.pushdown.group.method.${se}`,`the ${se} adapter declares the \`group\` capability but has no \`executeGroupLevel(query, aggregates, request)\`, so grouping is not pushed and the grid stays ungrouped unless it holds the whole matching set. Implement the method or drop the capability.`),Ue=$(xe.request,{...ee,group:!1,aggregates:null},de.enabled)),Ue.pivoted&&!F(Z.executePivotLevel)&&(Ue=$(xe.request,{...ee,pivot:!1},de.enabled),Ue.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Ue.grouped&&!Ue.pivoted&&!ee.group&&!F(Z.executeGroupedAggregates)&&(I(`source.pushdown.group.aggregates.method.${se}`,`the ${se} adapter declares \`aggregates\` but has no \`executeGroupedAggregates(query, groupBy, aggregates)\`, so the grouped view cannot be built from grouped aggregates and the grid stays ungrouped unless it holds the whole matching set. Implement the method, or declare \`group\` and implement \`executeGroupLevel\`.`),Ue=$(xe.request,{...ee,aggregates:null},de.enabled)),ie=Ue,Ue.pivoted)return He(Ue,we);if(Ue.pivotReason&&Ye(Ue.pivotReason),Ue.grouped)return ee.group?_e(Ue,we):Fe(Ue,we);const Ge=!!Ue.groupReason&&!Ue.full;Ge?I(`source.pushdown.group-unsupported.${se}.${Ue.groupReason}`,`pushdown:group-unsupported: the ${se} adapter was not asked to group this query because ${Ue.groupReason}, so the grid stays ungrouped rather than building group rows, counts and subtotals from a window of leaf rows. \`lastPlan().groupReason\` says the same.`):Ue.groupReason&&I(`source.pushdown.group.${se}.${Ue.groupReason}`,`the ${se} adapter was not asked to group this query because ${Ue.groupReason}. The engine returns rows and the grouping is the grid's to do, which needs every matching row in the browser — correct where the grid holds them, and wrong-looking where it holds a window. \`lastPlan().unpushed\` names it.`);const tt=st=>Ge?{...st,[V]:!0}:st;if(!Ue.needsAll){const st=xe.probe||await Z.execute(Ue.pushed,we),et=st.rows||[];return X(st.pendingTotal)&&st.total===void 0?tt({rows:et,pendingTotal:Qe(st.pendingTotal,N(Ue.pushed))}):(ve=null,!ee.total&&st.total===void 0?tt({rows:et}):tt({rows:et,total:st.total??et.length}))}Ue.unpushed.length&&I(`source.pushdown.residual.${se}.${Ue.unpushed.join(".")}`,`the ${se} adapter cannot push ${Ue.unpushed.join(" or ")}, so every matching row is fetched and the rest is applied in the browser. Correct, and slower than it needs to be: widening the adapter is the fix.`);const it=N(Ue.pushed);if(!he||he.key!==it){const st=await Q(await Z.execute(Ue.pushed,we));ve=null;const et=st.rows||[];if(Ue.full){const ft=typeof st.total=="number"?Math.max(st.total,et.length):et.length;if(ft>de.maxRows)throw new Error(`[lattice] fullDataset refused: the ${se} adapter's matching set is ${ft.toLocaleString()} rows, past the configured maxRows of ${de.maxRows.toLocaleString()}. The whole set cannot be held client-side, so it is refused rather than truncated — a fraction shown as the whole would make every total and statistic silently wrong. Narrow the filter or raise maxRows.`);const At=et.length*T(et[0]);if(At>de.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${se} adapter's matching set is an estimated ${Math.round(At/(1024*1024)).toLocaleString()} MB across ${et.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(de.maxBytesEstimate/(1024*1024)).toLocaleString()} MB. The whole set cannot be held client-side, so it is refused rather than truncated. Narrow the filter or raise maxBytesEstimate.`)}if(typeof st.total=="number"&&et.length<st.total){const ft=!!(Ue.residual.filters||Ue.residual.quick||Ue.residual.sort&&Ue.residual.sort.length);if(ft&&!le)throw new Error(`[lattice] the ${se} adapter returned ${et.length} of ${st.total} matching rows when asked for the whole result, and the query has residual ${Ue.unpushed.join(" and ")||"work"} to finish in the browser. Filtering or sorting a fraction of the result would return wrong rows, so the result is refused. Fix the adapter to follow the engine's own paging before returning, hold the data in memory, or set \`allowPartialResults: true\` on the source config to accept this knowingly.`);ft?I(`source.pushdown.partial.residual.${se}`,`the ${se} adapter returned ${et.length} of ${st.total} matching rows when asked for the whole result, and residual work will run over that fraction. allowPartialResults is set, so the result is used as-is — it may be wrong. The adapter must follow the engine's own paging to be correct.`):I(`source.pushdown.partial.${se}`,`the ${se} adapter returned ${et.length} of ${st.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}he={key:it,rows:et,total:typeof st.total=="number"?st.total:null}}let ut=Ue;if(Ue.residual.where){const st=he.total??he.rows.length;if(st>=be){k(Ue.residual.where.names,se,st,be);const{where:et,...ft}=xe.request;ut=$(ft,ee,de.enabled),ie=ut}}const wt=he.total!==null&&he.rows.length>=he.total,jt=O(he.rows,{...ut.residual,whole:wt},L.compute||{}),Ve=we.range?we.range.start:0,Je=we.range?we.range.end:jt.length;return tt({rows:jt.slice(Ve,Je),total:jt.length})},dt=async(we,Te,Le)=>{const Ue=Le&&Le.waitForPage&&Ct&&F(Ct.pageForegroundIdle)?Ct.pageForegroundIdle():yt();Ue&&await Ue;const ze=ae();ze&&await ze;const Ge=$(we,ee,de.enabled);ie=Ge;const tt=g(Te,Ne),it=Array.isArray(we.groupBy)?we.groupBy:[],ut=it.length>0,wt=!Ge.residual.filters&&!Ge.residual.quick,jt=!ut||i(it,ee.buckets);let Ve=tt.engine,Je=tt.client;if(ee.aggregates&&Ve.length){const At=ee.aggregates instanceof Set?ee.aggregates:new Set(q(ee.aggregates)),Et=Ve.filter(Rt=>!At.has(Rt.fn));Et.length&&(Ve=Ve.filter(Rt=>At.has(Rt.fn)),Je=[...Et.map(Rt=>({...Rt,reason:`the ${se} adapter does not compute "${Rt.fn}"`})),...Je])}const st=At=>{Je=[...Ve.map(Et=>({...Et,reason:At})),...Je],Ve=[]};Ve.length&&!wt?st(Ge.residual.quick&&!Ge.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):Ve.length&&!jt&&st("a grouping key the engine cannot form forces all-client (no mixed provenance)");let et={},ft;return Ve.length&&(F(ut?Z.executeGroupedAggregates:Z.executeAggregates)?ut?ft=await Z.executeGroupedAggregates(Ge.pushed,it,Ve)||[]:et=await Z.executeAggregates(Ge.pushed,Ve)||{}:(I(`source.pushdown.aggregates.${se}${ut?".grouped":""}`,`the ${se} adapter cannot compute ${ut?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),st(`adapter cannot compute ${ut?"grouped ":""}aggregates`))),ue={engine:Ve,client:Je,...ut?{groupBy:it}:{}},{values:et,engine:Ve,client:Je,...ft!==void 0?{groups:ft}:{}}},at=async we=>{lt++;try{return await Nt(we)}finally{if(lt--,lt===0&&ot.length){const Te=ot;ot=[];for(const Le of Te)Le()}}},bt=d(L.edit),Tt=L.edit&&typeof L.edit=="object"&&F(L.edit.commit);let ht=L.edit;if(bt&&!Tt)if(ee.mutate&&ee.mutate.update){const we=Te=>{if(!ee.mutate||!ee.mutate.update)throw new Error(`[lattice] the ${se} adapter cannot update rows (mutate.update is not declared), so this edit cannot be persisted. The cell is reverted rather than left looking saved.`);const Le={kind:"update",key:String(Te.key),patch:{[Te.colId]:Te.value}};return Z.mutate(Le,Te.request||{})};ht={...L.edit===!0?{}:L.edit,commit:we}}else I(`source.pushdown.readonly.${se}`,`edit is enabled but the ${se} adapter declares mutate: ${ee.mutate?"without update":"false"} (read-only by declaration), so no commit is synthesised and the grid stays read-only. Declare \`mutate: { update: true }\` on the adapter to allow cell edits.`);const ke=bt&&ee.mutate&&(ee.mutate.append||ee.mutate.delete)?{append:ee.mutate.append===!0,remove:ee.mutate.delete===!0,returning:ee.mutate.returning,mutate:(we,Te)=>Z.mutate(we,Te||{})}:null,$e=async we=>{const Te=ae();Te&&await Te;const{range:Le,signal:xe,export:Ue,...ze}=we||{},Ge={...ze,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:$(Ge,ee,de.enabled),signal:xe}};async function*me(we,Te={}){const{plan:Le,signal:xe}=await $e(we),Ue=Math.max(1,Math.floor(Number(Te.pageSize))||5e3),ze={signal:xe,stream:!0},Ge=we&&we.range&&Number.isFinite(Number(we.range.start))&&Number.isFinite(Number(we.range.end))?{start:Math.max(0,Number(we.range.start)),end:Math.max(0,Number(we.range.end))}:null;if(!Le.needsAll){const ut=Ge?Ge.start:0,wt=Ge?Ge.end:1/0;for(let jt=ut;jt<wt;jt+=Ue){n(ze);const Ve=Math.min(jt+Ue,wt),Je=await Z.execute({...Le.pushed,range:{start:jt,end:Ve}},ze);Je&&X(Je.pendingTotal)&&Je.pendingTotal.then(null,()=>{});const st=Je&&Je.rows||[];if(st.length&&(yield st),st.length<Ve-jt)return}return}n(ze);const tt=await Q(await Z.execute({...Le.pushed,range:void 0},ze));let it=O(tt&&tt.rows||[],{...Le.residual,whole:!0},L.compute||{});Ge&&(it=it.slice(Ge.start,Ge.end));for(let ut=0;ut<it.length;ut+=Ue)yield it.slice(ut,ut+Ue)}return Ct={...L,edit:ht,rowMutate:ke,mode:"remote",fetch:at,foregroundIdle:yt,aggregate:dt,countMatching:async we=>{const{plan:Te,signal:Le}=await $e(we);if(!Te.needsAll&&ee.total){n({signal:Le});const Ue=await Q(await Z.execute({...Te.pushed,range:{start:0,end:0}},{signal:Le}));if(Ue&&typeof Ue.total=="number")return Ue.total}let xe=0;for await(const Ue of me({...we,range:void 0}))xe+=Ue.length;return xe},streamMatching:me,capabilitiesOf:p,planQuery:$,wireFilters:y,resolveAggregatePlan:we=>g(we,Ne),STAT_PUSHDOWN:t,lastPlan:()=>ie?{...ie,...ue?{aggregates:ue}:{},...ve?{total:{deferred:!0,state:ve.state,value:ve.value}}:{}}:null,fullFrame:Me,counts:()=>({match:ge,total:Oe??null,pending:!!ve&&ve.state==="pending"}),grandTotals:()=>pe},Ct}}),Be("packages/core/src/source/remote.js",function(e,D){"use strict";Object.defineProperty(e,"PROTOCOL",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return N}});const M=D("packages/core/src/internal/lru.js").Lru,F=D("packages/core/src/internal/predicates.js").isFunction,q=D("packages/core/src/internal/warn.js").warnOnce,I=D("packages/core/src/internal/schedule.js").settleDebounce,K=D("packages/core/src/source/abort.js"),R=K.createAbortScope,S=K.isAbortError,k=D("packages/core/src/source/blockcache.js"),y=k.BlockCache,l=k.DEFAULT_PAGE_SIZE,g=k.DEFAULT_MAX_CACHED_PAGES,i=D("packages/core/src/source/rows.js"),t=i.createRowFactory,o=i.groupKey,c=D("packages/core/src/source/filterwire.js"),f=c.wireFilters,n=c.querySignature,m=c.warnHostFilterNotApplied,s=D("packages/core/src/source/pagewindow.js").pageWindow,p=D("packages/core/src/source/memory.js").MemorySource,b=D("packages/core/src/compute/handle.js").valueComparator,a=D("packages/core/src/compute/pivot.js"),h=a.pivotKey,w=a.joinPath,v=a.DEFAULT_PATH_SEPARATOR,_=D("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,V=1,Y=120,$=1e3;function j(T,C,B){for(let z=0;z<Math.max(T.length,C.length);z++){const X=T[z],Q=C[z],H=X==null,L=Q==null;if(H||L){if(H&&L)continue;return H?1:-1}const Z=B(X,Q);if(Z!==0)return Z}return 0}function E(T,C){return new N(T,C)}class O{constructor(C,B,z,X){this.path=C,this.keyPath=X||C,this.values=[],this.level=B,this.key=o(this.keyPath),this.cache=new y(z),this.count=null,this.complete=!1,this.announced=null,this.counting=!1,this.failed=!1,this.children=new Map,this.row=null,this.flat=!1}}class N{mode="remote";#e;#t;#n;#r;#i=new Map;#s=new Set;#o=R();#l;#a;#c=new Map;#u=[];#f=null;#d="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#O="";#w=null;#A=-1;constructor(C,B){this.#e=C||{mode:"remote"},this.#t=B||{},F(this.#e.fullFrame)&&(this.filteredIndices=()=>this.#F(),this.unfilteredIndices=()=>this.#V(),this.handleFor=L=>this.#W(L),this.display=()=>this.#L(),this.grandTotalRow=()=>this.#B(),this.unfilteredRows=()=>this.#D(),this.facetIndices=L=>this.#q(L));const z=this.#e.counts;F(z)&&(this.matchCount=()=>this.#Y("match"),this.totalCount=()=>this.#Y("total"));const X=this.#e.grandTotals;F(X)&&(this.grandTotalRow=()=>this.#G());const Q=this.#e.foregroundIdle;F(Q)&&(this.foregroundIdle=()=>this.#me(Q),this.#e.pageForegroundIdle=()=>this.#b?this.#me(Q):null);const H=this.#e;F(H.countMatching)&&F(H.streamMatching)&&(this.selectionQuery=()=>this.#_(),this.countMatching=L=>H.countMatching(L),this.streamMatching=(L,Z)=>H.streamMatching(L,Z),this.loadedRows=()=>this.#ye(),this.resident=()=>this.#N()!==null),this.#n={pageSize:this.#e.pageSize||l,maxCachedPages:this.#e.maxCachedPages||g},this.#l=t(this.#t),this.#a=new M(this.#n.pageSize*4),this.#h=I((L,Z)=>this.#T(L,Z),Y),this.#r=new O([],0,this.#n),this.#i.set(this.#r.key,this.#r),this.#d=this.#we(),F(this.#e.fetch)||q("source.remote.fetch",'source.mode "remote" requires a fetch function; the grid will stay empty.'),this.#he()}count(){const C=this.#S();return C?C.length:this.#v()}#v(){const C=this.#N();return C?C.count():(this.#fe(),this.#$e(this.#r))}#C(){if(this.#N())return!0;const C=B=>{if(B.count===null&&!B.complete)return!1;for(const z of B.children.values())if(this.#ge(z.key)&&!C(z))return!1;return!0};return C(this.#r)}pageInfo(){const C=this.#S(),B=this.totalPending();if(!C){const z=this.#v();return{page:0,pageSize:0,total:this.#C()?z:null,pageCount:1,counting:B}}return{page:C.page,pageSize:C.pageSize,total:C.total,pageCount:C.pageCount,counting:B||C.total===null&&this.#o.size>0&&this.#r.cache.loadedExtent()===0}}#S(){const C=this.#v(),B=s(this.#$("pageSize",0),this.#$("page",0),C,this.#C());if(!B)return this.#O="",null;const z=`${this.#y}:${B.offset}:${B.length}`;return z!==this.#O&&!this.#p&&(this.#O=z,B.length>0&&!this.#N()&&this.#T(B.offset,B.offset+B.length-1)),B}at(C){const B=this.#S();if(B){if(C<0||C>=B.length)return;const z=this.#P(B.offset+C);return z&&(z.index=C),z}return this.#P(C)}#P(C){const B=this.#N();if(B)return B.at(C);if(this.#fe(),C<0||C>=this.#v())return;const z=this.#Q(this.#r,C);if(!z)return;const X=this.#H(z.node,z.local);return X&&(X.index=C),X||this.#l.skeleton(C,z.node.level,z.node.cache.erroredAt(z.local))}byKey(C){const B=this.#N();if(B)return B.byKey(C);const z=this.#c.get(C);if(!z)return;const X=z.lastIndexOf(":"),Q=this.#i.get(z.slice(0,X));return Q&&this.#H(Q,Number(z.slice(X+1)))||void 0}loaded(C){const B=this.#S();if(B){if(C<0||C>=B.length)return!1;C+=B.offset}const z=this.#N();if(z)return z.loaded(C);if(C<0||C>=this.#v())return!1;const X=this.#Q(this.#r,C);return!!X&&X.node.cache.rowLoaded(X.local)}hint(C,B){if(this.#p)return;this.#b=!0;const z=this.#fe();let X=Math.max(0,Math.floor(C)),Q=Math.max(X,Math.floor(B));const H=this.#S();if(H){if(H.length===0)return;X=H.offset,Q=H.offset+H.length-1}for(const[L,Z]of this.#E(X,Q)){L.cache.protect(Z.min,Z.max);for(const ee of L.cache.evict())this.#J(L,ee)}this.#h(X,Q),z&&this.#h.flush()}#E(C,B){const z=this.#v(),X=new Map;for(let Q=C;Q<=B&&Q<z;Q++){const H=this.#Q(this.#r,Q);if(!H)continue;const L=X.get(H.node);L?(L.min=Math.min(L.min,H.local),L.max=Math.max(L.max,H.local)):X.set(H.node,{min:H.local,max:H.local})}return X.size||X.set(this.#r,{min:C,max:C}),X}#T(C,B){if(!this.#p)for(const[z,X]of this.#E(C,B)){z.cache.protect(X.min,X.max);const Q=z.cache.blockOf(X.min),H=z.cache.blockOf(X.max);for(let L=Q;L<=H&&!(z.count!==null&&L*z.cache.pageSize>=z.count);L++)z.cache.has(L)||this.#ue(z,L)}}apply(C){const B={added:[],updated:[],removed:[]};if(!C)return B;if(C.update)for(const z of C.update){const X=this.#c.get(this.#l.keyOf(z,-1));if(!X)continue;this.#a.delete(X);const Q=X.lastIndexOf(":"),H=this.#i.get(X.slice(0,Q));if(!H)continue;const L=Number(X.slice(Q+1)),Z=H.cache.blockOf(L);if(!H.cache.loaded(Z))continue;const{start:ee}=H.cache.rangeOf(Z),te=[];for(let ne=ee;ne<ee+H.cache.pageSize;ne++){const ae=H.cache.rowAt(ne);if(ae===void 0)break;te.push(ne===L?z:ae)}H.cache.fill(Z,te);const se=this.#H(H,L);se&&B.updated.push(se)}return(C.add&&C.add.length||C.remove&&C.remove.length)&&this.reload({keepExpanded:!0}),B}reload(C){this.#o.abortAll("reload"),this.#h.cancel(),C&&C.keepExpanded===!1&&this.#s.clear(),this.#le(),this.#Z("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#o.abortAll("destroyed"),this.#le(),this.#i.clear(),this.#s.clear(),this.#w&&F(this.#w.destroy)&&this.#w.destroy(),this.#w=null}expand(C){this.#s.has(C)||(this.#s.add(C),this.#Z("group:toggled",{key:C,expanded:!0}),this.#Z("model:changed",{reason:"expand",key:C}))}collapse(C){this.#s.delete(C)&&(this.#Z("group:toggled",{key:C,expanded:!1}),this.#Z("model:changed",{reason:"collapse",key:C}))}expandedKeys(){return[...this.#s]}pivotFields(){return this.#u}pivot(){this.#fe();const C=this.#f;if(!C||!C.keys.size||!this.#$("pivotBy",[]).length)return null;if(!C.result){const B=b((this.#t.config||{}).locale),z=[...C.keys.entries()].sort((Q,H)=>j(Q[1],H[1],B)),X=z.map(([Q])=>Q);C.result={keys:z.map(([,Q])=>Q),paths:X,fields:this.#je(X),groupPaths:[],columns:X.length*Math.max(1,this.#ke().length),values:C.cells,cells:C.cells,error:null}}return C.result}invalidateHandles(){this.#w&&(F(this.#w.invalidateHandles)&&this.#w.invalidateHandles(),F(this.#w.invalidate)&&this.#w.invalidate("filter"))}#M(){const C=this.#e.fullFrame;return F(C)?C():null}#N(){const C=this.#M();return C?(this.#w||(this.#w=new p({mode:"memory"},this.#R())),C.version!==this.#A&&(this.#w.setRows(C.rows),this.#A=C.version),this.#w):null}#R(){const C=this.#t,B=C.state||{};return{...C,state:{...B,page:()=>0,pageSize:()=>0}}}#F(){const C=this.#N();return C?C.filteredIndices():new Uint32Array(0)}#V(){const C=this.#N();return C?C.unfilteredIndices():new Uint32Array(0)}#W(C){const B=this.#N();return B?B.handleFor(C):void 0}#L(){const C=this.#N();return C?C.display():[]}#q(C){const B=this.#N();return B&&F(B.facetIndices)?B.facetIndices(C):new Uint32Array(0)}#B(){const C=this.#N();return C&&F(C.grandTotalRow)?C.grandTotalRow():null}#Y(C){const B=this.#N();if(B){const H=C==="match"?B.matchCount:B.totalCount;if(F(H))return H.call(B)}const z=this.#e.counts,X=F(z)?z():null,Q=X?X[C]:null;return typeof Q=="number"?Q:this.#v()}#G(){const C=this.#N();if(C&&F(C.grandTotalRow))return C.grandTotalRow();if((this.#t.config||{}).grandTotalRow!=="bottom")return null;const z=this.#e.grandTotals,X=F(z)?z():null;return!X||!X.totals?null:this.#l.grandTotal(X.totals,X.leafCount||0)}#D(){const C=this.#N();if(C&&F(C.unfilteredRows))return C.unfilteredRows();const B=[],z=this.count();for(let X=0;X<z;X++){const Q=this.at(X);Q&&B.push(Q)}return B}#_(){const C=this.#$("quick",""),B={protocol:V,groupPath:[],groupValues:[],groupBy:[],totals:[],totalFns:{},pivotBy:[],pivotMode:!1,filters:f(this.#$("filters",null),this.#pe()),sort:this.#$("sort",[]),context:this.#$("context",null)};C&&(B.quick=C);const z=this.#$("where",null);return z&&z.active&&(B.where=z),B}#ye(){const C=this.#$("groupBy",[]).length,B=[];for(const z of this.#i.values())if(!(z.level!==C&&!z.flat))for(const X of z.cache.ids()){if(!z.cache.loaded(X))continue;const{start:Q,end:H}=z.cache.rangeOf(X);for(let L=Q;L<H&&z.cache.rowLoaded(L);L++){const Z=this.#H(z,L);Z&&!Z.group&&B.push(Z)}}return B}loadedCount(){const C=this.#N();if(C){const X=C.matchCount();return typeof X=="number"?X:C.count()}this.#fe();const B=this.#$("groupBy",[]).length;let z=0;for(const X of this.#i.values())if(!(X.level!==B&&!X.flat))for(const Q of X.cache.ids()){if(!X.cache.loaded(Q))continue;const H=X.cache.fillOf(Q);typeof H=="number"&&(z+=H)}return z}residentRows(){const C=this.#N();return C?C.display():this.#$("groupBy",[]).length>0?null:(this.#fe(),this.#ye())}#ce(C,B,z){const{start:X,end:Q}=C.cache.rangeOf(B),H=this.#$("groupBy",[]),L=this.#$("pivotBy",[]),Z=this.#$("quick",""),ee=this.#ke(),te={protocol:V,range:{start:X,end:Q},groupPath:C.path,groupValues:C.values,groupBy:H,totals:ee,totalFns:this.#Ie(ee),pivotBy:L,pivotMode:L.length>0,filters:f(this.#$("filters",null),this.#pe()),sort:this.#$("sort",[]),context:this.#$("context",null),signal:z};Z&&(te.quick=Z);const se=this.#$("where",null);return se&&se.active&&(te.where=se),te}async#ue(C,B){if(!F(this.#e.fetch))return;if(!this.#m){this.#m=!0;const H=this.#g;this.#g=[],queueMicrotask(()=>{for(const L of H)L()})}const z=this.#o.begin(`${C.key}:${B}`);C.cache.begin(B,z);const X=this.#d,{start:Q}=C.cache.rangeOf(B);try{const H=await this.#e.fetch(this.#ce(C,B,z.signal));if(!z.current||X!==this.#d||this.#p)return;z.settle();const L=H&&H.rows||[];if(!!(H&&H[_])&&!C.flat){C.flat=!0,C.children.clear();for(const[se,ne]of[...this.#c])ne.startsWith(`${C.key}:`)&&(this.#a.delete(ne),this.#c.delete(se))}C.cache.fill(B,L),C.failed=!1;for(let se=0;se<L.length;se++)this.#a.delete(`${C.key}:${Q+se}`);const ee=H&&typeof H.count=="number"?H.count:H&&typeof H.total=="number"?H.total:null,te=H&&F(H.pendingTotal?.then)?H.pendingTotal:null;ee!==null?(C.count=ee,C.complete=!0):L.length<C.cache.pageSize?(C.count=Q+L.length,C.complete=!0):te&&(C.counting=!0,C.announced=null),H&&Array.isArray(H.pivotFields)&&this.#Me(H.pivotFields),H&&H.pivot&&typeof H.pivot=="object"&&this.#ie(H.pivot),this.#Z("model:changed",{reason:"page",groupPath:C.path,block:B}),this.#Z("rows:changed",{companion:!0,reason:"page",groupPath:C.path,block:B}),this.#se(C),te&&this.#Ne(C,te,X)}catch(H){if(z.settle(),S(H))return;C.cache.failed(B,H),C.failed=!0;const{end:L}=C.cache.rangeOf(B);for(let Z=Q;Z<L;Z++)this.#a.delete(`${C.key}:${Z}`);this.#Z("model:changed",{reason:"page-error",groupPath:C.path,block:B}),this.#Z("source:error",{error:H,groupPath:C.path,block:B})}}async#Ne(C,B,z){let X;try{X=await B}catch(Q){if(z!==this.#d||this.#p)return;C.counting=!1,S(Q)||(C.failed=!0),S(Q)||this.#Z("source:error",{error:Q,groupPath:C.path});return}z!==this.#d||this.#p||(C.counting=!1,typeof X=="number"&&(C.count=X,C.complete=!0,this.#se(C),this.#Z("model:changed",{reason:"total",count:X,groupPath:C.path})))}#se(C){typeof C.count!="number"||!C.complete||C.announced!==C.count&&(C.announced=C.count,this.#Z("source:total",{total:C.count,groupPath:C.path}))}#me(C){if(this.#p)return null;this.#fe();const B=this.#m?null:new Promise(L=>{this.#g.push(L),setTimeout(L,$)}),z=C();if(!B&&!z)return null;const X=(async()=>{B&&await B;for(let L=C();L;L=C())await L})();let Q;const H=new Promise(L=>{Q=setTimeout(L,$)});return Promise.race([X,H]).then(()=>clearTimeout(Q))}totalPending(){if(this.#r.failed)return!1;if(this.#r.counting===!0)return!0;if(this.#N())return!1;this.#fe();const C=this.#r;return C.count===null&&!C.complete&&C.cache.loadedExtent()===0}totalFailed(){return this.#r.failed===!0}#Me(C){C.length===this.#u.length&&C.every((B,z)=>B===this.#u[z])||(this.#u=C,this.#Z("column:pivoted",{pivotFields:C,remote:!0}))}#xe(){const C=this.#t.config||{};return C.pivot&&C.pivot.separator||v}#je(C){const B=this.#xe(),z=this.#ke();if(!z.length)return C.slice();const X=[];for(const Q of C)for(const H of z)X.push(`${Q}${B}${H}`);return X}#ie(C){const B=this.#xe();this.#f||(this.#f={keys:new Map,cells:new Map,result:null});const z=this.#f;let X=!1;const Q=L=>{const Z=Array.isArray(L)?L:[L],ee=w(Z,B);return z.keys.has(ee)||(z.keys.set(ee,Z),X=!0),ee},H=this.#$("groupBy",[]).length>0;for(const L of Array.isArray(C.axis)?C.axis:[])Q(L);for(const L of Array.isArray(C.cells)?C.cells:[]){if(!L||typeof L!="object")continue;const Z=Q(L.pivot);if(H&&!(Array.isArray(L.group)&&L.group.length))continue;const ee=w(Array.isArray(L.group)?L.group:[],B);for(const[te,se]of Object.entries(L.values||{}))z.cells.set(h(ee,Z,te),se)}z.result=null,X&&this.#Me((this.pivot()||{fields:[]}).fields)}#$e(C){let B=this.#oe(C);for(const z of C.children.values())this.#ge(z.key)&&(B+=this.#$e(z));return B}#oe(C){if(C.count!==null)return C.count;const B=C.cache.loadedExtent();return C.complete?B:C.row&&C.row.leafCount>0?C.level>=this.#$("groupBy",[]).length?Math.max(B,C.row.leafCount):B===0?1:Math.min(B+C.cache.pageSize,Math.max(B,C.row.leafCount)):B+C.cache.pageSize}#Q(C,B){let z=B,X=0;const Q=[...C.children.entries()].filter(([,L])=>this.#ge(L.key)).sort((L,Z)=>L[0]-Z[0]);for(const[L,Z]of Q){const ee=L-X+1;if(z<ee)return{node:C,local:X+z};z-=ee,X=L+1;const te=this.#$e(Z);if(z<te)return this.#Q(Z,z);z-=te}const H=this.#oe(C);return X+z<H?{node:C,local:X+z}:null}#H(C,B){const z=`${C.key}:${B}`,X=this.#a.get(z);if(X)return X;const Q=C.cache.rowAt(B);if(Q===void 0)return null;const H=this.#$("groupBy",[]);let L;if(C.level<H.length&&!C.flat){const Z=H[C.level],ee=this.#f!==null&&C.level===H.length-1&&this.#$("pivotBy",[]).length>0,te=this.#de(Q,Z),se=te==null,ne=[...C.path,se?"":String(te)],ae=[...C.keyPath,se?null:String(te)];if(L=this.#l.group({path:ne,keyPath:ae,column:Z,value:te,level:C.level,parent:C.row,leafCount:Number(Q.leafCount)||0,expanded:ee?!1:this.#ge(o(ae)),...ee?{hasChildren:!1}:{}}),L.totals=this.#U(Q),L.data=Q,!ee){let de=this.#i.get(L.key);de?de.row=L:(de=new O(ne,C.level+1,this.#n,ae),de.row=L,this.#i.set(de.key,de)),de.values=[...C.values,te],C.children.set(B,de)}}else L=this.#l.leaf(Q,B,C.level,C.row);return this.#a.set(z,L),this.#c.set(L.key,z),L}#U(C){const B=C||{};if(B.totals&&typeof B.totals=="object")return B.totals;const z={};for(const X of this.#ke())Object.hasOwn(B,X)&&(z[X]=B[X]);return z}#J(C,B){const{start:z,end:X}=C.cache.rangeOf(B);for(let Q=z;Q<X;Q++){const H=`${C.key}:${Q}`,L=this.#a.peek(H);L&&this.#c.delete(L.key),this.#a.delete(H)}}#fe(){const C=this.#we();return C===this.#d?!1:(this.#d=C,this.#o.abortAll("query"),this.#le(),this.#m=!1,this.#Z("model:changed",{reason:"query"}),!0)}#le(){for(const C of this.#i.values())C.cache.clear(),C.count=null,C.complete=!1,C.announced=null,C.counting=!1,C.failed=!1,C.children.clear(),C.flat=!1;this.#a.clear(),this.#c.clear(),this.#y++,this.#f=null}#we(){const C=this.#$("where",null);return`${n({filters:this.#$("filters",null),sort:this.#$("sort",[]),quick:this.#$("quick",""),groupBy:this.#$("groupBy",[]),pivotBy:this.#$("pivotBy",[]),context:this.#$("context",null)})}|${C?C.version:0}`}#ge(C){const B=this.#$("expanded",null);return B?F(B.has)?B.has(C):Array.prototype.includes.call(B,C):this.#s.has(C)}#ke(){const C=this.#$("totals",[]);if(C&&C.length)return[...C];const B=this.#t.columns;return!B||!F(B.all)?[]:B.all().filter(z=>!!z.total).map(z=>z.id)}#Ie(C){const B=this.#t.columns,z={};if(!B||!F(B.get))return z;for(const X of C){const Q=B.get(X);if(!Q)continue;const H=Q.groupTotal!=null?Q.groupTotal:Q.total;typeof H=="string"&&(z[X]=H)}return z}#de(C,B){const z=this.#t.columns,X=z&&F(z.get)?z.get(B):void 0;return X&&F(X.getValue)?X.getValue(C):C?.[B]}#he(){m(this.#t)}#pe(){const C=this.#t.config||{};return{tz:C.timeZone,weekStartsOn:C.weekStartsOn}}#$(C,B){const z=this.#t.state;if(z&&F(z[C])){const X=z[C]();return X??B}return B}#Z(C,B){const z=this.#t.emit;F(z)&&z(C,B)}}}),Be("packages/core/src/source/gapbuffer.js",function(e,D){"use strict";Object.defineProperty(e,"GapBuffer",{enumerable:!0,get:function(){return M}});const re=64;class M{#e;#t=0;#n=0;constructor(F=re){this.#e=new Uint32Array(Math.max(1,F)),this.#n=this.#e.length}static from(F,x=re){const q=new M(F.length+Math.max(1,x));return q.#e.set(F,0),q.#t=F.length,q.#n=q.#e.length,q}get length(){return this.#t+(this.#e.length-this.#n)}get capacity(){return this.#e.length}at(F){return F<0||F>=this.length?0:F<this.#t?this.#e[F]:this.#e[F+(this.#n-this.#t)]}insert(F,x){const q=F<0?0:F>this.length?this.length:F;this.#r(q),this.#t===this.#n&&this.#i(),this.#e[this.#t++]=x}push(F){this.insert(this.length,F)}removeAt(F){return!Number.isInteger(F)||F<0||F>=this.length?!1:(this.#r(F),this.#n++,!0)}toArray(){const F=new Uint32Array(this.length);return F.set(this.#e.subarray(0,this.#t),0),F.set(this.#e.subarray(this.#n),this.#t),F}clear(){this.#t=0,this.#n=this.#e.length}#r(F){if(F!==this.#t)if(F<this.#t){const x=this.#t-F;this.#e.copyWithin(this.#n-x,F,this.#t),this.#t=F,this.#n-=x}else{const x=F-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+x),this.#t=F,this.#n+=x}}#i(){const F=this.#e.length-this.#n,x=new Uint32Array(Math.max(this.#e.length*2,this.#e.length+re));x.set(this.#e.subarray(0,this.#t),0),x.set(this.#e.subarray(this.#n),x.length-F),this.#e=x,this.#n=x.length-F}}}),Be("packages/core/src/store/ingest.js",function(e,D){"use strict";Object.defineProperty(e,"INGEST_DEFAULTS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"inferKind",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"decideText",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"createReaders",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"Ingest",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return f}});const re=D("packages/core/src/internal/schedule.js"),M=re.now,G=re.nextFrame,F=D("packages/core/src/internal/warn.js"),x=F.infoOnce,q=F.warnOnce,I=D("packages/core/src/internal/predicates.js").isFunction,R=D("packages/core/src/internal/paths.js").pathGetter,k=D("packages/core/src/store/columnstore.js").ColumnStore,y=Object.freeze({chunkMs:8,chunkRows:512,sampleSize:100,dictionaryRatio:.1,columnarBelow:5e3,initialCapacity:1024});function l(n,m={}){if(m.multi)return"multi";if(n.length===0)return"object";let r=0,s=0,d=0,p=0,u=0;for(let a=0;a<n.length;a++){const h=n[a];typeof h=="number"?r++:typeof h=="boolean"?s++:typeof h=="string"?d++:h instanceof Date?p++:Array.isArray(h)&&u++}const b=n.length;return r===b?"float64":s===b?"bitset":p===b?"float64":d===b?"text":u===b?"multi":"object"}function g(n,m,r){return m<=0||n<r*m?"dictionary":"object"}function i(n,m,r){const s=new Map,d=new Map;for(const V of n){if(V.computed)continue;const Y=I(V.read)?V.read:R(V.field||V.id);d.set(V.id,Y),s.set(V.id,Y)}const p=m?.order??[],u=m?.fns??{},b=m?.deps??{},a=m?.wrapDeps??null,h=p.filter(V=>I(u[V])),w=h.some(V=>b[V]==="*");let v=new WeakMap;const A=V=>{const Y={};if(w)for(const[$,j]of d)Y[$]=j(V);for(const $ of h){const j=b[$];let E;if(j==="*")E=Y;else{E={};const O=j||[];for(let N=0;N<O.length;N++){const T=O[N];E[T]=T in Y?Y[T]:d.get(T)?.(V)}}Y[$]=u[$](a?a(E,$):E,{data:V,row:null,column:null,grid:null,context:r})}return Y},_=V=>{if(V===null||typeof V!="object"&&typeof V!="function")return A(V);let Y=v.get(V);return Y===void 0&&(Y=A(V),v.set(V,Y)),Y};for(const V of h)s.set(V,Y=>_(Y)[V]);return{readers:s,reset(){v=new WeakMap}}}class t{spec;read;kind;inferred;nullable;candidate=!1;distinct=null;change=null;reason="";constructor(m,r){this.spec=m,this.read=r,this.kind="object",this.inferred=!1,this.nullable=m.nullable!==!1}}class o{#e;#t=[];#n=null;#r;#i=0;#s;#o=!1;#l=!1;#a=0;#c;constructor(m,r={},s={}){this.#e=Array.isArray(m)?m:Array.from(m||[]),this.#s={...y,...s};const d=r.columns??[];this.#r=i(d,r.computed??null,r.context),this.#c=this.#e.length>=this.#s.columnarBelow,this.#u(d,r.computed??null),this.#n=new k(this.#t.map(p=>({id:p.spec.id,kind:p.kind,nullable:p.nullable,read:p.read,dictionary:p.spec.dictionary})),{initialCapacity:this.#s.initialCapacity,columnarBelow:this.#s.columnarBelow})}get store(){return this.#n}get done(){return this.#o||this.#l}get progress(){return this.#i}slice(){if(this.done)return!1;if(this.#s.signal?.aborted)return this.#l=!0,!1;const m=M(),{chunkMs:r,chunkRows:s}=this.#s,d=this.#e.length;do{const p=Math.min(this.#i+s,d);this.#n.append(this.#e.slice(this.#i,p)),this.#f(this.#i,p),this.#i=p,this.#r.reset(),this.#h(!1)}while(this.#i<d&&M()-m<r);return this.#a+=M()-m,this.#s.onProgress?.({loaded:this.#i,total:d}),this.#i>=d?(this.#h(!0),this.#o=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(m=>({id:m.spec.id,kind:m.kind,nullable:m.nullable,read:m.read,dictionary:m.spec.dictionary})),decisions:this.#t.map(m=>({id:m.spec.id,kind:m.kind,nullable:m.nullable,inferred:m.inferred,distinct:m.candidate||m.change?this.#d(m):null,change:m.change,reason:m.reason})),count:this.#n.count,elapsed:this.#a,cancelled:this.#l}}#u(m,r){const s=this.#e,d=Math.min(this.#s.sampleSize,s.length),p=this.#s.dictionaryRatio,u=r?.pure instanceof Set?r.pure:new Set(r?.pure??r?.order??[]);for(const b of m){if(!b||!b.id)continue;if(b.computed&&(b.pure===!1||r&&!u.has(b.id))){q(`ingest.impure.${b.id}`,`column "${b.id}" is an impure computed column and is not materialised into the store`);continue}const a=this.#r.readers.get(b.id)??(I(b.read)?b.read:R(b.field||b.id)),h=new t(b,a);if(b.kind)h.kind=b.kind,h.reason="declared by the caller";else if(b.dictionary)h.kind=b.multi?"multi":"dictionary",h.reason="value table supplied (lookup column)";else{const w=[];for(let A=0;A<d&&w.length<this.#s.sampleSize;A++){const _=a(s[A]);_!=null&&w.push(_)}h.inferred=!0;const v=l(w,{multi:b.multi});if(v==="text"){const A=new Set(w).size;h.kind=g(A,w.length,p),h.candidate=this.#c,h.reason=`sampled ${A} distinct in ${w.length}`}else h.kind=v,h.reason=`inferred from ${w.length} sampled values`,v==="object"&&w.length&&x(`ingest.mixed.${b.id}`,`column "${b.id}" holds mixed or unrecognised value types; storing as an object array. Declare a type to avoid this.`);h.kind==="object"&&h.candidate&&(h.distinct=new Set(w))}this.#t.push(h)}}#f(m,r){const s=this.#e;for(const d of this.#t){if(!d.candidate||!d.distinct)continue;const p=d.distinct;for(let u=m;u<r;u++){const b=d.read(s[u]);b!=null&&p.add(b)}}}#d(m){if(m.distinct)return m.distinct.size;const r=this.#n.column(m.spec.id);return r?.dict?r.dict.size:0}#h(m){const r=this.#s.dictionaryRatio,s=this.#e.length;for(const d of this.#t){if(!d.candidate)continue;const p=this.#d(d);if(d.kind==="dictionary"&&p>=r*s){const u=this.#n.column(d.spec.id);d.distinct=new Set(u?.dict?u.dict.values():[]),this.#n.convert(d.spec.id,"object"),d.kind="object",d.change="demoted",d.reason=`${p} distinct values is at or above ${r*100}% of ${s} rows`;continue}if(d.kind==="object"&&p>=r*s){d.candidate=!1,d.distinct=null,d.reason=`${p} distinct values is at or above ${r*100}% of ${s} rows`;continue}m&&d.kind==="object"&&p<r*s&&(this.#n.convert(d.spec.id,"dictionary"),d.kind="dictionary",d.change=d.change==="demoted"?null:"promoted",d.reason=`${p} distinct values is below ${r*100}% of ${s} rows`,d.distinct=null),m&&(d.candidate=!1)}}}async function c(n,m={},r={}){const s=new o(n,m,r),d=r.scheduler?.frame??G;for(;s.slice();)await new Promise(p=>{d(p)});return s.result()}function f(n,m={},r={}){const s=new o(n,m,{...r,chunkMs:1/0});for(;s.slice(););return s.result()}}),Be("packages/core/src/store/columnpack.js",function(e,D){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return g}});const M=D("packages/core/src/internal/paths.js").pathGetter,G=D("packages/core/src/store/ingest.js"),F=G.inferKind,x=G.decideText,q=G.INGEST_DEFAULTS,I=D("packages/core/src/store/columnstore.js").toFloat,K=new Set(["float64","int32","bitset","dictionary","object","multi"]);function R(i){if(!Array.isArray(i)||i.length===0)return!1;for(const t of i)if(!t||typeof t.id!="string"||typeof t.field!="string"||t.field===""||t.kind&&!K.has(t.kind))return!1;return!0}function S(i){const t=I(i);return Number.isFinite(t)?t|0:0}function k(i){return i==null?[]:Array.isArray(i)?i:[i]}function y(i,t,o,c){if(i.kind)return i.kind;const f=[];for(let r=0;r<t.length&&f.length<q.sampleSize;r++){const s=t[r];s!=null&&f.push(s)}const n=F(f,{multi:i.multi});if(n!=="text")return n;const m=new Set(f).size;return x(m,f.length,c)}function l(i,t,o={}){const c=t.length|0,f=o.dictionaryRatio??q.dictionaryRatio,n=[];for(const m of i){const r=M(m.field||m.id),s=m.nullable!==!1,d=new Array(c);for(let h=0;h<c;h++){const w=r(t[h]);d[h]=w===void 0?null:w}const p=y(m,d,c,f),u=s?new Uint8Array(c+7>>3):null,b=h=>{u&&(u[h>>3]|=1<<(h&7))};let a;switch(p){case"float64":{const h=new Float64Array(c);for(let w=0;w<c;w++){const v=d[w],A=v===null;A||b(w),h[w]=A?NaN:I(v)}a={id:m.id,kind:p,nullable:s,values:h,presence:u,offsets:null,table:null};break}case"int32":{const h=new Int32Array(c);for(let w=0;w<c;w++){const v=d[w],A=v===null;A||b(w),h[w]=A?0:S(v)}a={id:m.id,kind:p,nullable:s,values:h,presence:u,offsets:null,table:null};break}case"bitset":{const h=new Uint8Array(c+7>>3);for(let w=0;w<c;w++){const v=d[w],A=v===null;A||b(w),!A&&v&&(h[w>>3]|=1<<(w&7))}a={id:m.id,kind:p,nullable:s,values:h,presence:u,offsets:null,table:null};break}case"dictionary":{const h=new Uint32Array(c),w=[],v=new Map;for(let A=0;A<c;A++){const _=d[A];if(_===null){h[A]=0;continue}b(A);let V=v.get(_);V===void 0&&(V=w.length,w.push(_),v.set(_,V)),h[A]=V}a={id:m.id,kind:p,nullable:s,values:h,presence:u,offsets:null,table:w};break}case"multi":{const h=[],w=new Map,v=new Uint32Array(c+1),A=[];for(let _=0;_<c;_++){const V=d[_];v[_]=A.length,V===null||b(_);const $=k(V);for(let j=0;j<$.length;j++){const E=$[j];let O=w.get(E);O===void 0&&(O=h.length,h.push(E),w.set(E,O)),A.push(O)}}v[c]=A.length,a={id:m.id,kind:p,nullable:s,values:Int32Array.from(A),presence:u,offsets:v,table:h};break}default:{const h=new Array(c);for(let w=0;w<c;w++){const v=d[w];v!==null&&b(w),h[w]=v}a={id:m.id,kind:"object",nullable:s,values:h,presence:u,offsets:null,table:null};break}}n.push(a)}return{count:c,columns:n}}function g(i){const t=[];if(!i||!Array.isArray(i.columns))return t;const o=c=>{ArrayBuffer.isView(c)&&c.buffer&&!t.includes(c.buffer)&&t.push(c.buffer)};for(const c of i.columns)o(c.values),o(c.presence),o(c.offsets);return t}}),Be("packages/core/src/source/stream.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_PROMOTE_BELOW",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"createStreamSource",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return O}});const M=D("packages/core/src/internal/lru.js").Lru,F=D("packages/core/src/internal/predicates.js").isFunction,x=D("packages/core/src/internal/schedule.js"),q=x.now,W=x.nextFrame,I=x.cancelFrame,K=x.whenIdle,S=D("packages/core/src/internal/compare.js").defaultCompare,k=D("packages/core/src/internal/warn.js"),y=k.warnOnce,l=k.infoOnce,i=D("packages/core/src/internal/paths.js").getPath,t=D("packages/core/src/source/abort.js"),o=t.createAbortScope,c=t.isAbortError,f=D("packages/core/src/source/rows.js"),n=f.createRowFactory,m=f.lazyRowView,s=D("packages/core/src/source/gapbuffer.js").GapBuffer,p=D("packages/core/src/source/memory.js").createMemorySource,b=D("packages/core/src/source/filterwire.js").querySignature,h=D("packages/core/src/store/columnpack.js").isPortableSchema,w=25e4,v=Symbol("lattice.stream.storeBacked"),A=8,_=.1,V=1e3,Y=50;function $(N){return Math.min(V,Math.max(Y,Math.floor(N/4)))}function j(N){if(N instanceof Date)return N.getTime();if(typeof N=="number")return Number.isFinite(N)?N:NaN;if(typeof N=="string"){const T=N.trim();if(!T)return NaN;const C=Date.parse(T);return Number.isNaN(C)?Number(T):C}return NaN}function E(N,T){return new O(N,T)}class O{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#i=[];#s=null;#o;#l;#a=new Map;#c=o();#u={loaded:0,estimated:void 0};#f=null;#d=0;#h=0;#p=0;#m=0;#g=null;#b=null;#y=null;#O=!1;#w=!1;#A=!1;#v=!1;#C="";#S=0;#P=0;#E=0;#T=null;#M=1/0;#N=!1;#R=null;#F=null;#V=null;#W=null;#L=!1;#q=0;#B=0;#Y=!1;constructor(T,C){this.#e=T||{mode:"stream"},this.#t=C||{},this.#o=n(this.#t),this.#l=new M(4096),this.#C=this.#Ue();const B=(this.#t.config||{}).ingest;this.#L=!!B&&B.retainSource===!1,F(this.#e.open)||y("source.stream.open",'source.mode "stream" requires an open function; the grid will stay empty.'),this.#e.autoStart!==!1&&queueMicrotask(()=>this.start());const z=Number(this.#e.poll);Number.isFinite(z)&&z>0&&(this.#W=setInterval(()=>{this.#v||this.reload()},z),this.#W&&F(this.#W.unref)&&this.#W.unref()),this.#D()}#G(){const T=Number(this.#e.maxAge);return Number.isFinite(T)&&T>0?T:0}#D(){const T=this.#G();if(!T)return;const C=this.#e.ageBy;F(C)?this.#F=C:typeof C=="string"&&C?this.#F=B=>i(B,C):this.#F=null,this.#T=[],this.#R=setInterval(()=>{this.#v||this.#_()&&(this.#fe(),this.#re())},$(T)),this.#R&&F(this.#R.unref)&&this.#R.unref()}#_(){const T=this.#G();return!T||!this.#T?!1:this.#N?!0:this.#M<Date.now()-T*(1+_)}#ye(T,C){if(!this.#T)return;const B=this.#F?j(this.#F(C)):Date.now();this.#T[T]=B,Number.isNaN(B)||(B<this.#M&&(this.#M=B),B<Date.now()-this.#G()&&(this.#N=!0))}#ce(){return this.#Oe("groupBy",[]).length>0?!0:!!this.#Oe("pivotMode",!1)&&this.#Oe("pivotBy",[]).length>0}#ue(){if(this.#g||this.#v)return;const T=this.#ce();if(T&&!this.#b){this.#b=p({mode:"memory",rows:this.#n},this.#Ne()),this.#O=!1;return}!T&&this.#b&&(this.#b.destroy(),this.#b=null)}#Ne(){if(this.#y)return this.#y;const T=this,C={liveIndices:()=>T.#se(),live:B=>T.#n[B]!==void 0,source:B=>T.#Ae(B),get physical(){return T.#n.length}};return this.#L&&(C.column=B=>{const z=T.#t.store;return z&&F(z.column)?z.column(B):void 0}),this.#y=Object.create(this.#t,{store:{value:C,enumerable:!0,configurable:!0}}),this.#y}#se(){const T=new Uint32Array(this.#n.length);let C=0;for(let B=0;B<this.#n.length;B++)this.#n[B]!==void 0&&(T[C++]=B);return T.subarray(0,C)}#me(){return this.#g?this.#g:this.#b?(this.#O&&(this.#O=!1,this.#b.setRows(this.#n)),this.#b):null}invalidate(T="filter"){if(this.#g){this.#g.invalidate(T);return}this.#ue(),this.#b&&this.#b.invalidate(T),(T==="filter"||T==="sort")&&this.#ke()}count(){const T=this.#me();return T?T.count():this.#r?this.#r.length:this.#S}matchCount(){const T=this.#me();return T&&F(T.matchCount)?T.matchCount():this.#r?this.#r.length:this.#S}totalCount(){const T=this.#me();return T&&F(T.totalCount)?T.totalCount():this.#S}unfilteredRows(){const T=this.#me();if(T&&F(T.unfilteredRows))return T.unfilteredRows();const C=[];for(let B=0;B<this.#n.length;B++){if(!this.#n[B])continue;const z=this.#k(B);z&&C.push(z)}return C}at(T){const C=this.#me();if(C)return C.at(T);if(T<0||T>=this.count())return;const B=this.#r?this.#r.at(T):T,z=this.#k(B);return z.index=T,z}byKey(T){const C=this.#me();if(C)return C.byKey(T);const B=this.#a.get(T);return B===void 0?void 0:this.#k(B)}leavesOf(T){const C=this.#me();return C&&F(C.leavesOf)?C.leavesOf(T):[]}loaded(T){return T>=0&&T<this.count()}hint(T,C){if(this.#g){this.#g.hint(T,C);return}this.#Me(),this.#p=Math.max(0,Math.floor(T))}#Me(){this.#v||this.#Ue()===this.#C||this.reload()}display(){const T=this.#me();return T?T.display():m(()=>this.count(),C=>this.at(C))}apply(T){if(this.#g)return this.#g.apply(T);const C={added:[],updated:[],removed:[]};if(!T)return C;if(T.update){let B=!1;for(const z of T.update){const X=this.#a.get(this.#o.keyOf(z,-1));if(X===void 0)continue;const Q=this.#he(X);this.#L?this.#He(X,z):this.#n[X]=z,this.#l.delete(X),this.#pe(X,Q),this.#T&&(this.#ye(X,z),B=!0),this.#O=!0,C.updated.push(this.#k(X))}B&&this.#fe()}if(T.add&&T.add.length){const B=this.#U(T.add);for(const z of B)C.added.push(this.#k(z))}return T.remove&&T.remove.length&&y("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#re(),C}reload(T){this.#c.abortAll("reload"),this.#Xe(),this.#b&&(this.#b.destroy(),this.#b=null),this.#O=!1,this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear(),this.#g=null,this.#S=0,this.#P=0,this.#E=0,this.#T&&(this.#T=[]),this.#M=1/0,this.#N=!1,this.#w=!1,this.#A=!1,this.#u={loaded:0,estimated:void 0},this.#C=this.#Ue(),this.#Se("model:changed",{reason:"reload"}),this.start()}destroy(){this.#v=!0,this.#W!==null&&(clearInterval(this.#W),this.#W=null),this.#R!==null&&(clearInterval(this.#R),this.#R=null),this.#T=null,this.#c.abortAll("destroyed"),this.#Xe(),this.#f!==null&&(this.#ve(this.#f),this.#f=null),this.#b&&(this.#b.destroy(),this.#b=null),this.#g&&this.#g.destroy(),this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear()}async start(){if(this.#A||this.#v||!F(this.#e.open))return;this.#A=!0;const T=this.#c.begin("stream");this.#ke(),this.#ue();let C;try{C=this.#e.open({sort:this.#Oe("sort",[]),filters:this.#Oe("filters",null),quick:this.#Oe("quick","")||void 0,context:this.#Oe("context",null),signal:T.signal})}catch(z){this.#Se("source:error",{error:z});return}const B=F(C[Symbol.asyncIterator])?C[Symbol.asyncIterator]():C[Symbol.iterator]();this.#V=B;try{for(;;){const z=await B.next();if(!T.current||this.#v)return;if(z.done){this.#ne();return}if(await this.#xe(z.value,T),!T.current||this.#v)return;if(z.value&&z.value.done){this.#ne();return}if(await this.#Be(),!T.current||this.#v)return}}catch(z){if(c(z))return;this.#Se("source:error",{error:z})}finally{T.settle()}}progress(){return{loaded:this.#u.loaded,estimated:this.#u.estimated,done:this.#w,live:this.#S,evicted:this.#P}}promoted(){return this.#g!==null}memorySource(){return this.#g}invalidateHandles(){const T=this.#me();T&&(F(T.invalidateHandles)&&T.invalidateHandles(),F(T.invalidate)&&T.invalidate("sort"))}renderCount(){return this.#d}ingestStats(){return{worker:this.#q,inline:this.#B,storeBacked:this.#L}}#xe(T,C){if(!T)return;const B=T.rows;if(B&&B.length&&this.#ie(B))return this.#oe(T,C);const z=q();B&&B.length&&(this.#U(B),this.#B++),this.#je(T),this.#h+=q()-z,this.#re()}#je(T){this.#u.loaded=T.progress&&typeof T.progress.loaded=="number"?T.progress.loaded:this.#n.length,T.progress&&typeof T.progress.estimated=="number"&&(this.#u.estimated=T.progress.estimated)}#ie(T){if(this.#Y||this.#g)return!1;const C=this.#Q();if(!C)return!1;const B=this.#t.store;if(!B||!F(B.appendPacked))return!1;const z=this.#H();return!z||!h(z)?(this.#Y=!0,l("source.stream.ingest-worker","stream ingest.useWorker is on but a column reads through a closure (a computed or date column); columnizing on the main thread instead."),!1):T.length<C.threshold?!1:!this.#$e(T)}#$e(T){if(!this.#o.keyed)return!1;const C=new Set;for(let B=0;B<T.length;B++){const z=this.#o.keyOf(T[B],this.#n.length+B);if(z!=null){if(C.has(z)||this.#a.has(z))return!0;C.add(z)}}return!1}async#oe(T,C){const B=T.rows,z=this.#Q(),X=this.#H();let Q;try{Q=await z.columnize(X,B,{key:"ingest:stream",signal:C&&C.signal})}catch(te){if(c(te)||(y("source.stream.columnize","worker columnization failed; columnizing on the main thread",te),this.#Y=!0,C&&(!C.current||this.#v)))return;this.#U(B),this.#B++,this.#je(T),this.#re();return}if(C&&(!C.current||this.#v))return;const H=this.#t.store,L=this.#L?void 0:B,{from:Z}=H.appendPacked(Q,L),ee=Q.count|0;for(let te=0;te<ee;te++){const se=Z+te,ne=B[te],ae=this.#o.keyed?this.#o.keyOf(ne,se):null;if(this.#n[se]=this.#L?v:ne,this.#S++,this.#ye(se,ne),ae!==null&&this.#a.set(ae,se),!this.#r||!this.#Ie(se))continue;const de=this.#$(se);this.#r.insert(de,se),de<=this.#p&&this.#m++}this.#O=!0,this.#fe(),this.#q++,this.#je(T),this.#re()}#Q(){const T=this.#t.ingestWorker;return F(T)?T():null}#H(){const T=this.#t.storeSchema;return F(T)?T():null}#U(T){const C=[],B=this.#t.store,z=new Array(T.length),X=[],Q=new Set;for(let L=0;L<T.length;L++){const Z=this.#o.keyed?this.#o.keyOf(T[L],this.#n.length+X.length):null;z[L]=Z,!(Z!==null&&(this.#a.has(Z)||Q.has(Z)))&&(Z!==null&&Q.add(Z),X.push(T[L]))}let H=X.length&&B&&F(B.append)?B.append(X).from:this.#n.length;for(let L=0;L<T.length;L++){const Z=T[L],ee=z[L];if(ee!==null&&this.#a.has(ee)){const ne=this.#a.get(ee),ae=this.#he(ne);this.#L||(this.#n[ne]=Z,B&&F(B.setSource)&&B.setSource(ne,Z)),this.#He(ne,Z),this.#l.delete(ne),this.#ye(ne,Z),this.#pe(ne,ae);continue}const te=H++;if(this.#n[te]=this.#L?v:Z,this.#S++,this.#ye(te,Z),ee!==null&&this.#a.set(ee,te),C.push(te),!this.#r||!this.#Ie(te))continue;const se=this.#$(te);this.#r.insert(se,te),se<=this.#p&&this.#m++}return this.#O=!0,this.#fe(),C}#J(T){const C=this.#n[T];let B=!1;if(this.#r){const H=this.#ge(T);H>=0&&H<=this.#p&&(B=!0)}else T<=this.#p&&(B=!0);const z=C===v?this.#Ae(T):C,X=this.#o.keyed?this.#o.keyOf(z,T):null;X!==null&&this.#a.get(X)===T&&this.#a.delete(X),this.#n[T]=void 0,this.#T&&(this.#T[T]=NaN),this.#l.delete(T);const Q=this.#t.store;return Q&&F(Q.remove)&&Q.remove(T),this.#S--,B}#fe(){let T=0,C=0;const B=this.#we();T+=B.dropped,C+=B.aboveAnchor;const z=this.#le();T+=z.dropped,C+=z.aboveAnchor,T&&(this.#O=!0,this.#P+=T,this.#ke(),this.#m-=C,this.#Se("stream:evicted",{evicted:T,total:this.#P,live:this.#S}))}#le(){const T=this.#e.maxRows;if(!Number.isFinite(T)||T<=0||this.#S<=T)return{dropped:0,aboveAnchor:0};const C=Math.max(1,Math.floor(T*(1-_)));let B=0,z=0;for(;this.#S>C&&this.#E<this.#n.length;){const X=this.#E++;this.#n[X]!==void 0&&(this.#J(X)&&z++,B++)}return{dropped:B,aboveAnchor:z}}#we(){const T=this.#G();if(!T||!this.#T||!this.#_())return{dropped:0,aboveAnchor:0};const C=Date.now()-T;let B=0,z=0,X=1/0;for(let Q=this.#E;Q<this.#n.length;Q++){if(this.#n[Q]===void 0)continue;const H=this.#T[Q];if(!(Number.isNaN(H)||H===void 0)){if(H>=C){H<X&&(X=H);continue}this.#J(Q)&&z++,B++}}for(this.#M=X,this.#N=!1;this.#E<this.#n.length&&this.#n[this.#E]===void 0;)this.#E++;return{dropped:B,aboveAnchor:z}}#ge(T){if(!this.#r)return T;for(let C=0;C<this.#r.length;C++)if(this.#r.at(C)===T)return C;return-1}#ke(){this.#i=this.#Oe("sort",[]),this.#s=this.#Oe("filters",null);const T=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#G()>0,C=this.#Oe("where",null),B=(this.#t.config||{}).hostFilter,z=!!(C&&C.active)||!!(B&&F(B.active)&&B.active());if(!(T||this.#i.length>0||!!this.#s||!!this.#Oe("quick","")||z)){this.#r=null;return}this.#r=new s(Math.max(64,this.#n.length+64));for(let Q=0;Q<this.#n.length;Q++)this.#n[Q]!==void 0&&this.#Ie(Q)&&this.#r.insert(this.#$(Q),Q)}#Ie(T){const C=this.#Ae(T);if(this.#s&&!this.#de(this.#s,C))return!1;const B=String(this.#Oe("quick","")||"").toLowerCase();if(B&&!this.#Ve(C).includes(B))return!1;const z=(this.#t.config||{}).hostFilter;if(z&&F(z.active)&&z.active()&&!z.passes(this.#k(T)))return!1;const X=this.#Oe("where",null);if(X&&X.active){const Q=this.#k(T);if(!X.passes(Q.data,Q.key))return!1}return!0}#de(T,C){if(!T)return!0;const B=T;if(Array.isArray(B.conditions))return B.op==="or"?B.conditions.some(Q=>this.#de(Q,C)):B.op==="not"?!B.conditions.some(Q=>this.#de(Q,C)):B.conditions.every(Q=>this.#de(Q,C));const z=T,X=(this.#t.compute||{}).testValue;return F(X)?!!X(this.#Pe(C,z.col),z,(this.#t.config||{}).locale):(y("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#he(T){if(!this.#r)return-1;if(!this.#i.length)return this.#ge(T);let C=0,B=this.#r.length;for(;C<B;){const z=C+B>>>1;this.#Z(this.#r.at(z),T)<0?C=z+1:B=z}for(let z=C;z<this.#r.length;z++){const X=this.#r.at(z);if(X===T)return z;if(this.#Z(X,T)>0)break}return this.#ge(T)}#pe(T,C){if(!this.#r||!this.#i.length)return;const B=this.#Ie(T);if(C>=0&&this.#r.at(C)===T)this.#r.removeAt(C),C<=this.#p&&this.#m--;else if(C>=0)return;if(!B)return;const z=this.#$(T);this.#r.insert(z,T),z<=this.#p&&this.#m++}#$(T){if(!this.#r||!this.#i.length)return this.#r?this.#r.length:0;let C=0,B=this.#r.length;for(;C<B;){const z=C+B>>>1;this.#Z(T,this.#r.at(z))<0?B=z:C=z+1}return C}#Z(T,C){const B=this.#Ae(T),z=this.#Ae(C);for(const X of this.#i){const Q=this.#Ye(X.col),H=this.#Pe(B,X.col),L=this.#Pe(z,X.col),ee=(Q&&Q.value&&F(Q.value.compare)?Q.value.compare:S)(H,L);if(ee!==0)return X.dir==="desc"?-ee:ee}return 0}#ne(){this.#w=!0,this.#u.loaded=this.#u.loaded||this.#n.length;const T=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:w;!this.#L&&this.#n.length<T&&(this.#g=p({mode:"memory",rows:this.#n},this.#t),this.#R!==null&&(clearInterval(this.#R),this.#R=null),this.#b&&(this.#b.destroy(),this.#b=null)),this.#re(),this.#Se("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:T})}#re(){this.#f!==null||this.#v||(this.#f=this.#I(()=>{this.#f=null,this.#d++;const T=this.#m;this.#m=0,this.#h=0,this.#Se("stream:chunk",{loaded:this.#u.loaded,estimated:this.#u.estimated,count:this.count(),renders:this.#d}),this.#Se("model:changed",{reason:"stream",shiftAboveViewport:T,anchor:this.#p}),this.#Se("rows:changed",{companion:!0,reason:"stream"})}))}#Be(){return this.#d===0||this.#h<this.#K()?Promise.resolve():(this.#h=0,new Promise(T=>{const C=(this.#t.scheduler||{}).idle;F(C)?C(()=>T()):K(()=>T())}))}#K(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:A}#I(T){const C=this.#t.scheduler||{};return F(C.frame)?C.frame(T):W(T)}#ve(T){const C=this.#t.scheduler||{};F(C.cancel)?C.cancel(T):I(T)}#Ae(T){const C=this.#n[T];if(C!==void 0&&C!==v)return C;if(C===void 0)return;const B=this.#t.store;return B&&F(B.source)?B.source(T):void 0}#He(T,C){const B=this.#t.store;if(!B||!F(B.set))return;const z=this.#H();if(Array.isArray(z))for(const X of z){if(!X||!X.id)continue;const Q=F(X.read)?X.read:H=>i(H,X.field||X.id);B.set(X.id,T,Q(C))}}#k(T){let C=this.#l.get(T);return C||(C=this.#o.leaf(this.#Ae(T),T),this.#l.set(T,C)),C}#Pe(T,C){const B=this.#Ye(C);return B&&F(B.getValue)?B.getValue(T):T?.[C]}#Ve(T){const C=this.#t.columns,B=C&&F(C.all)?C.all():[],z=[];for(const X of B){const Q=F(X.getValue)?X.getValue(T):void 0;Q!=null&&Q!==""&&z.push(String(Q))}return z.join(" ").toLowerCase()}#Ye(T){const C=this.#t.columns;return C&&F(C.get)?C.get(T):void 0}#Xe(){const T=this.#V;if(this.#V=null,T&&F(T.return))try{T.return()}catch{}}#Ue(){return b({context:this.#Oe("context",null)})}#Oe(T,C){const B=this.#t.state;if(B&&F(B[T])){const z=B[T]();return z??C}return C}#Se(T,C){const B=this.#t.emit;F(B)&&B(T,C)}}}),Be("packages/core/src/source/url.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return y}});const M=D("packages/core/src/internal/warn.js").warnOnce,G=D("packages/core/src/internal/predicates.js"),F=G.isObject,x=G.isFunction,W=D("packages/core/src/internal/paths.js").getPath,K=D("packages/core/src/source/abort.js").isAbortError,R=500,S=new Set(["application/x-ndjson","application/ndjson","application/jsonlines","application/jsonl","application/x-jsonlines","text/x-ndjson"]),k=Symbol("lattice.url.skip");function y(u,b={}){const a=F(b)?b:{},h=x(a.fetch)?a.fetch:typeof globalThis<"u"&&x(globalThis.fetch)?globalThis.fetch:null,w=a.format==="json"||a.format==="ndjson"?a.format:void 0,v=typeof a.rowsPath=="string"&&a.rowsPath?a.rowsPath:void 0,A=x(a.map)?a.map:void 0,_=F(a.headers)?a.headers:void 0,V=Number.isFinite(a.batchSize)&&a.batchSize>0?Math.floor(a.batchSize):R,Y=a.lenient===!0,$=Number.isFinite(a.poll)&&a.poll>0?Math.floor(a.poll):void 0,j=typeof u=="string"&&u.length>0;j||M("source.url.url","createUrlSource needs a URL string; the grid will stay empty.");async function*E(N={}){if(!j)return;if(!h)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const T=N&&N.signal;let C;try{C=await h(u,_?{signal:T,headers:_}:{signal:T})}catch(X){throw K(X)?X:new Error(`[lattice] createUrlSource: request to ${u} failed — ${X&&X.message||X}`)}if(!C||!C.ok){const X=C?C.status:"no response";throw new Error(`[lattice] createUrlSource: ${X} for ${u}`)}const B=l(u,w,C),z=C.body&&x(C.body.getReader)?C.body.getReader():null;try{if(!z){const H=await C.text();(B||t(H,u))==="ndjson"?yield*r(null,null,H,0,C,u,V,Y):yield*m(H,u,v,A);return}const X=new TextDecoder("utf-8");if(B==="json"){yield*m(await n(z,X,""),u,v,A);return}if(B==="ndjson"){yield*r(z,X,"",0,C,u,V,Y);return}const Q=await o(z,X,u);Q.format==="json"?yield*m(await n(z,X,Q.seed),u,v,A):yield*r(z,X,Q.seed,Q.bytes,C,u,V,Y)}finally{if(z&&x(z.cancel))try{await z.cancel()}catch{}}}const O={mode:"stream",open:E,autoStart:a.autoStart!==!1};return $!==void 0&&(O.poll=$),Number.isFinite(a.maxRows)&&(O.maxRows=a.maxRows),Number.isFinite(a.maxAge)&&(O.maxAge=a.maxAge),(typeof a.ageBy=="string"||x(a.ageBy))&&(O.ageBy=a.ageBy),Number.isFinite(a.coalesceMs)&&(O.coalesceMs=a.coalesceMs),Number.isFinite(a.promoteToMemoryBelow)&&(O.promoteToMemoryBelow=a.promoteToMemoryBelow),O}function l(u,b,a){if(b)return b;const h=g(u);if(h)return h;const w=a&&a.headers&&x(a.headers.get)?a.headers.get("content-type"):null;return i(w)}function g(u){const b=String(u).split(/[?#]/)[0].toLowerCase();if(b.endsWith(".ndjson")||b.endsWith(".jsonl"))return"ndjson";if(b.endsWith(".json"))return"json"}function i(u){if(!u)return;const b=u.split(";")[0].trim().toLowerCase();if(S.has(b))return"ndjson";if(b==="application/json"||b==="text/json"||b.endsWith("+json"))return"json"}function t(u,b){const a=u.replace(/^\s+/,""),h=c(a);if(h==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${b} — pass opts.format: 'json' | 'ndjson'.`);return h}async function o(u,b,a){let h="",w=0;for(;;){const{value:A,done:_}=await u.read();if(A&&(w+=A.byteLength,h+=b.decode(A,{stream:!0})),_){h+=b.decode();break}const V=h.replace(/^\s+/,"");if(V){if(V[0]==="[")return{format:"json",seed:h,bytes:w};if(V[0]!=="{"||h.indexOf(`
|
|
7
|
+
`||m==="\r"){n++;continue}if(m>="0"&&m<="9"){n=k(c,n,f);continue}if(m==="."&&c[n+1]>="0"&&c[n+1]<="9"){n=k(c,n,f);continue}if(m==='"'||m==="'"){n=y(c,n,f);continue}if(m==="["){const s=c.indexOf("]",n+1);if(s<0)throw new K("a [column reference] was opened and never closed",n);f.push({kind:G,value:c.slice(n+1,s).trim(),at:n}),n=s+1;continue}if(S(m)){n=l(c,n,f);continue}const r=c.slice(n,n+2);if(W.includes(r)){f.push({kind:x,value:r==="!="?"<>":r,at:n}),n+=2;continue}if(I.includes(m)){f.push({kind:x,value:m,at:n}),n++;continue}throw new K(`unexpected character ${JSON.stringify(m)}`,n)}return f.push({kind:q,value:null,at:c.length}),f}function S(c){return/[A-Za-z_À-]/.test(c)}function k(c,f,n){let m=f,r=!1;for(;m<c.length;){const s=c[m];if(s>="0"&&s<="9"){m++;continue}if(s==="."&&!r){r=!0,m++;continue}if((s==="e"||s==="E")&&/[0-9+-]/.test(c[m+1]||"")){for(m+=2;m<c.length&&c[m]>="0"&&c[m]<="9";)m++;break}break}return n.push({kind:re,value:Number(c.slice(f,m)),at:f}),m}function y(c,f,n){const m=c[f];let r=f+1,s="";for(;r<c.length;){if(c[r]===m){if(c[r+1]===m){s+=m,r+=2;continue}return n.push({kind:M,value:s,at:f}),r+1}s+=c[r],r++}throw new K("a string was opened and never closed",f)}function l(c,f,n){let m=f;for(;m<c.length&&/[A-Za-z0-9_.À-]/.test(c[m]);)m++;const r=c.slice(f,m);let s=m;for(;s<c.length&&c[s]===" ";)s++;return n.push({kind:c[s]==="("?F:G,value:r,at:f}),m}const g={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function i(c){const f=String(c??"").replace(/^\s*=/,"");if(!f.trim())throw new K("the formula is empty");const n=R(f);let m=0;const r=()=>n[m],s=()=>n[m++],d=v=>{const A=r();if(A.kind!==x||A.value!==v)throw new K(`expected ${JSON.stringify(v)}`,A.at);m++},p=v=>{let A=u();for(;;){const _=r();if(_.kind!==x)break;const V=g[_.value];if(!V||V<v)break;m++;const Y=p(_.value==="^"?V:V+1);A={kind:"bin",op:_.value,left:A,right:Y}}return A},u=()=>{const v=r();return v.kind===x&&(v.value==="-"||v.value==="+")?(m++,{kind:"unary",op:v.value,arg:u()}):b()},b=()=>{let v=a();for(;r().kind===x&&r().value==="%";)m++,v={kind:"unary",op:"%",arg:v};return v},a=()=>{const v=s();if(v.kind===re)return{kind:"num",value:v.value};if(v.kind===M)return{kind:"str",value:v.value};if(v.kind===G)return{kind:"ref",name:v.value};if(v.kind===F){d("(");const A=[];if(!(r().kind===x&&r().value===")"))for(;;){if(A.push(p(1)),r().kind===x&&r().value===","){m++;continue}break}return d(")"),{kind:"call",name:String(v.value).toUpperCase(),args:A}}if(v.kind===x&&v.value==="("){const A=p(1);return d(")"),A}throw v.kind===q?new K("the formula ends unexpectedly",v.at):new K(`unexpected ${JSON.stringify(v.value)}`,v.at)},h=p(1),w=r();if(w.kind!==q)throw new K(`unexpected ${JSON.stringify(w.value)}: is an operator missing?`,w.at);return h}function t(c){const f=new Set,n=m=>{if(!(!m||typeof m!="object")){if(m.kind==="ref"){f.add(String(m.name));return}if(m.kind==="bin"){n(m.left),n(m.right);return}if(m.kind==="unary"){n(m.arg);return}if(m.kind==="call")for(const r of m.args)n(r)}};return n(c),[...f]}function o(c){return typeof c=="string"&&/^\s*=/.test(c)&&c.trim()!=="="}}),Be("packages/core/src/formula/evaluate.js",function(e,D){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return k}});const M=D("packages/core/src/formula/parse.js").FormulaError;function G(y){if(y==null||y==="")return 0;if(typeof y=="boolean")return y?1:0;if(y instanceof Date)return y.getTime();const l=typeof y=="number"?y:Number(String(y).replace(/[,\s]/g,""));if(!Number.isFinite(l))throw new M(`${JSON.stringify(y)} is not a number`);return l}function F(y){return y==null?"":String(y)}function x(y){if(typeof y=="boolean")return y;if(y==null||y==="")return!1;if(typeof y=="number")return y!==0;const l=String(y).trim().toLowerCase();return l==="false"||l==="no"||l==="0"?!1:l!==""}function q(y){const l=[];for(const g of y){if(Array.isArray(g)){for(const i of g)i!=null&&i!==""&&l.push(G(i));continue}g==null||g===""||l.push(G(g))}return l}function W(y,l){const g=10**l,i=y*g;return Math.sign(i)*Math.round(Math.abs(i)+Number.EPSILON*Math.abs(i))/g}function I(y,l){if(!y.length)return 0;const g=y.slice().sort((c,f)=>c-f),i=(g.length-1)*Math.min(1,Math.max(0,l)),t=Math.floor(i),o=Math.ceil(i);return t===o?g[t]:g[t]+(i-t)*(g[o]-g[t])}function K(y,l){let g=0,i=0,t=0;for(const c of y){g++;const f=c-i;i+=f/g,t+=f*(c-i)}const o=l?g-1:g;return o>0?Math.sqrt(t/o):0}const R={SUM:y=>q(y).reduce((l,g)=>l+g,0),AVERAGE:y=>{const l=q(y);return l.length?l.reduce((g,i)=>g+i,0)/l.length:0},MIN:y=>{const l=q(y);return l.length?Math.min(...l):0},MAX:y=>{const l=q(y);return l.length?Math.max(...l):0},COUNT:y=>q(y).length,PRODUCT:y=>q(y).reduce((l,g)=>l*g,1),ROUND:y=>W(G(y[0]),y.length>1?G(y[1]):0),ROUNDDOWN:y=>{const l=10**(y.length>1?G(y[1]):0),g=G(y[0])*l;return(g<0?Math.ceil(g):Math.floor(g))/l},ROUNDUP:y=>{const l=10**(y.length>1?G(y[1]):0),g=G(y[0])*l;return(g<0?Math.floor(g):Math.ceil(g))/l},ABS:y=>Math.abs(G(y[0])),FLOOR:y=>Math.floor(G(y[0])),CEILING:y=>Math.ceil(G(y[0])),SQRT:y=>Math.sqrt(G(y[0])),POWER:y=>G(y[0])**G(y[1]),MOD:y=>{const l=G(y[1]);if(l===0)throw new M("MOD by zero");return(G(y[0])%l+l)%l},IF:y=>x(y[0])?y[1]:y.length>2?y[2]:!1,AND:y=>y.every(x),OR:y=>y.some(x),NOT:y=>!x(y[0]),COALESCE:y=>y.find(l=>l!=null&&l!=="")??null,CONCAT:y=>y.map(F).join(""),LEN:y=>F(y[0]).length,UPPER:y=>F(y[0]).toUpperCase(),LOWER:y=>F(y[0]).toLowerCase(),TRIM:y=>F(y[0]).trim(),LEFT:y=>F(y[0]).slice(0,y.length>1?G(y[1]):1),RIGHT:y=>{const l=y.length>1?G(y[1]):1;return l<=0?"":F(y[0]).slice(-l)},MEDIAN:y=>I(q(y),.5),PERCENTILE:y=>{const l=G(y[y.length-1]);return I(q(y.slice(0,-1)),l>1?l/100:l)},QUARTILE1:y=>I(q(y),.25),QUARTILE3:y=>I(q(y),.75),STDEV:y=>K(q(y),!0),STDEVP:y=>K(q(y),!1),VAR:y=>{const l=K(q(y),!0);return l*l},VARP:y=>{const l=K(q(y),!1);return l*l},COUNTDISTINCT:y=>{const l=new Set;for(const g of y){const i=Array.isArray(g)?g:[g];for(const t of i)t!=null&&t!==""&&l.add(t)}return l.size},IQR:y=>{const l=q(y);return I(l,.75)-I(l,.25)}};R.AVG=R.AVERAGE,R.CEIL=R.CEILING,R.POW=R.POWER,R.STDEVS=R.STDEV,R.PERCENTILEINC=R.PERCENTILE;function S(y,l){const g=Number(y),i=Number(l);if(y!==null&&y!==""&&l!==null&&l!==""&&Number.isFinite(g)&&Number.isFinite(i))return g<i?-1:g>i?1:0;const o=F(y).toLowerCase(),c=F(l).toLowerCase();return o<c?-1:o>c?1:0}function k(y,l={}){const g=typeof l.lookup=="function"?l.lookup:null,i=l.functions?{...R,...l.functions}:R,t=o=>{switch(o.kind){case"num":return o.value;case"str":return o.value;case"ref":{if(!g)throw new M(`there is no column called ${JSON.stringify(o.name)} here`);const c=g(String(o.name));if(c===void 0)throw new M(`there is no column called ${JSON.stringify(o.name)}`);return c}case"unary":{if(o.op==="%")return G(t(o.arg))/100;const c=G(t(o.arg));return o.op==="-"?-c:c}case"bin":{const c=o.op;if(c==="=")return S(t(o.left),t(o.right))===0;if(c==="<>")return S(t(o.left),t(o.right))!==0;if(c==="<")return S(t(o.left),t(o.right))<0;if(c==="<=")return S(t(o.left),t(o.right))<=0;if(c===">")return S(t(o.left),t(o.right))>0;if(c===">=")return S(t(o.left),t(o.right))>=0;const f=G(t(o.left)),n=G(t(o.right));if(c==="+")return f+n;if(c==="-")return f-n;if(c==="*")return f*n;if(c==="^")return f**n;if(c==="/"){if(n===0)throw new M("division by zero");return f/n}throw new M(`unknown operator ${JSON.stringify(c)}`)}case"call":{const c=l.lazy&&l.lazy[o.name];if(typeof c=="function")return c(o.args,t,l);const f=i[o.name];if(typeof f!="function")throw new M(`there is no function called ${o.name}`);return f(o.args.map(t),l)}default:throw new M("the formula could not be read")}};return t(y)}}),Be("packages/core/src/formula/index.js",function(e,D){"use strict";Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return S}});const re=D("packages/core/src/formula/parse.js"),M=re.parseFormula,G=re.referencesOf,F=re.looksLikeFormula,x=re.FormulaError,q=re.tokenise,W=D("packages/core/src/formula/evaluate.js"),I=W.evaluateAst,K=W.FUNCTIONS;function R(k){const{grid:y,row:l,data:g}=k||{},i=n=>String(n).toLowerCase().replace(/[\s_-]/g,""),t=y&&y.columns&&typeof y.columns.all=="function"?y.columns.all():[],o=y&&y.permissions,c=o&&typeof o.isReadable=="function"?n=>o.isReadable(n):()=>!0,f=new Set;for(const n of t)c(n)||(f.add(i(n.id)),n.field&&f.add(i(n.field)),n.title&&f.add(i(n.title)));return n=>{const m=i(n);if(f.has(m))throw new x(`"${n}" cannot be read`);for(const r of t)if(i(r.id)===m||r.field&&i(r.field)===m||r.title&&i(r.title)===m)return l&&y.rows&&typeof y.rows.value=="function"?y.rows.value(l.key,r.id):g?g[r.field||r.id]:void 0;if(g&&typeof g=="object"){for(const r of Object.keys(g))if(i(r)===m){if(!c(r))throw new x(`"${n}" cannot be read`);return g[r]}}}}function S(k,y={}){try{const l=M(k);return{ok:!0,value:I(l,{lookup:R(y),functions:y.formulaFunctions}),references:G(l)}}catch(l){return{ok:!1,error:l instanceof x?l.message:"the formula could not be read",at:l instanceof x?l.at:void 0}}}}),Be("packages/core/src/internal/version.js",function(e,D){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return G}});const re="1.110.3";async function M(){return re}const G="1.110.3"}),Be("packages/core/src/internal/merge.js",function(e,D){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"mergeRow",{enumerable:!0,get:function(){return W}});const M=D("packages/core/src/internal/predicates.js").isObject;function G(I,K,R){if(I!==void 0)return I===!0?{enabled:!0,...R}:I===!1?{enabled:!1}:M(I)?I:{[K]:I,enabled:!0}}function F(I){return I==null?[]:Array.isArray(I)?I:[I]}const x=Object.freeze(new Set(["__proto__","constructor","prototype"]));function q(I,K){if(!M(I))return M(K)?{...K}:K;if(!M(K))return K===void 0?I:K;const R={...I};for(const S of Object.keys(K)){if(x.has(S))continue;const k=K[S];k!==void 0&&(R[S]=M(k)&&M(R[S])?q(R[S],k):k)}return R}function W(I,K){if(!M(I)||!M(K)||I===K)return K;const R=Object.create(Object.getPrototypeOf(I));return Object.assign(R,I,K),R}}),Be("packages/core/src/internal/schedule.js",function(e,D){"use strict";Object.defineProperty(e,"now",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"nextFrame",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return W}});function re(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const M=typeof requestAnimationFrame=="function";function G(I){return M?requestAnimationFrame(I):setTimeout(()=>I(re()),16)}function F(I){I!=null&&(M?cancelAnimationFrame(I):clearTimeout(I))}function x(I){let K=null,R=null;const S=()=>{K=null;const y=R;R=null,I(...y||[])},k=(...y)=>{R=y,K===null&&(K=G(S))};return k.cancel=()=>{F(K),K=null,R=null},k.flush=()=>{K!==null&&(F(K),S())},k}function q(I,K){let R=null,S=null;const k=()=>{if(R=null,S===null)return;const g=S;S=null,I(...g),y()},y=()=>{R=setTimeout(k,K),typeof R?.unref=="function"&&R.unref()},l=(...g)=>{R===null?(I(...g),y()):(S=g,clearTimeout(R),y())};return l.flush=()=>{if(R!==null&&clearTimeout(R),R=null,S===null)return;const g=S;S=null,I(...g)},l.cancel=()=>{R!==null&&clearTimeout(R),R=null,S=null},l.pending=()=>R!==null||S!==null,l}function W(I,K=50){return typeof requestIdleCallback=="function"?requestIdleCallback(I,{timeout:K}):setTimeout(()=>I({timeRemaining:()=>0,didTimeout:!0}),1)}}),Be("packages/core/src/internal/paths.js",function(e,D){"use strict";Object.defineProperty(e,"pathGetter",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"pathSetter",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"getPath",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return q}});const re=new Map;function M(W){let I=re.get(W);if(I)return I;if(!W.includes("."))I=K=>K?.[W];else{const K=W.split("."),R=K.length;I=S=>{let k=S;for(let y=0;y<R;y++){if(k==null)return;k=k[K[y]]}return k}}return re.set(W,I),I}const G=new Map;function F(W){let I=G.get(W);if(I)return I;if(!W.includes("."))I=(K,R)=>{K!=null&&(K[W]=R)};else{const K=W.split("."),R=K.length-1;I=(S,k)=>{let y=S;for(let l=0;l<R;l++){if(y==null)return;const g=K[l];y[g]==null&&(y[g]={}),y=y[g]}y!=null&&(y[K[R]]=k)}}return G.set(W,I),I}function x(W,I){return M(I)(W)}function q(W,I,K){F(I)(W,K)}}),Be("packages/core/src/internal/compare.js",function(e,D){"use strict";Object.defineProperty(e,"collator",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"defaultCompare",{enumerable:!0,get:function(){return G}});const re=new Map;function M(F,x){const q=`${F||""}|${x?JSON.stringify(x):""}`;let W=re.get(q);return W||(W=new Intl.Collator(F||void 0,{numeric:!0,sensitivity:"variant",...x}),re.set(q,W)),W}function G(F,x){if(F===x)return 0;if(F==null)return 1;if(x==null)return-1;if(typeof F=="number"&&typeof x=="number")return Number.isNaN(F)?Number.isNaN(x)?0:1:Number.isNaN(x)||F<x?-1:F>x?1:0;const q=String(F),W=String(x);return q<W?-1:q>W?1:0}}),Be("packages/core/src/defaults.js",function(e,D){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return S}});const M=D("packages/core/src/internal/predicates.js").isObject,F=D("packages/core/src/internal/merge.js").merge,q=D("packages/core/src/internal/warn.js").warnOnce;let W=null;class I extends Error{}function K(k,y=new Set){if(Array.isArray(k)){if(y.has(k))throw new I;y.add(k);const g=k.map(i=>K(i,y));return y.delete(k),g}if(!M(k)||Object.getPrototypeOf(k)!==Object.prototype&&Object.getPrototypeOf(k)!==null)return k;if(y.has(k))throw new I;y.add(k);const l={};for(const[g,i]of Object.entries(k))l[g]=K(i,y);return y.delete(k),l}function R(k){if(k===void 0)return K(W??{});if(k===null)return W=null,{};if(!M(k))return q("defaults:type",`defaults() expects a configuration object, or null to clear it, but got ${Array.isArray(k)?"an array":typeof k}. The call was ignored and the defaults are unchanged.`),K(W??{});try{W=K(k)}catch(y){if(!(y instanceof I))throw y;return q("defaults:cyclic","defaults() expects a configuration object with no circular references, but the object passed refers back to itself. The call was ignored and the defaults are unchanged."),K(W??{})}return K(W)}function S(k){return W===null?k:F(K(W),k)}}),Be("packages/core/src/internal/uid.js",function(e,D){"use strict";Object.defineProperty(e,"uid",{enumerable:!0,get:function(){return M}});let re=0;function M(G="l"){return`${G}${(++re).toString(36)}`}}),Be("packages/core/src/events/names.js",function(e,D){"use strict";Object.defineProperty(e,"EVENT_NAMES",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"isKnownEvent",{enumerable:!0,get:function(){return G}});const re=Object.freeze(["ready","destroy","render:first","render:done","config:changed","licence:changed","model:changed","rows:changed","rows:queued","rows:deferred","rows:paused","rows:resumed","row:received","row:sent","row:copied","row:moved","source:error","source:total","stream:chunk","stream:end","stream:evicted","rowDrag:started","rowDrag:moved","rowDrag:left","rowDrag:ended","beforeRowDrop","rowDrop:cancelled","rowDrop","cell:changed","cell:pending","cell:confirmed","cell:reverted","cell:conflict","cell:clicked","cell:dblclicked","cell:contextmenu","cell:mouseover","cell:mouseout","cell:mousedown","cell:mouseup","cell:edit:start","cell:edit:end","row:edit:start","row:edit:end","row:clicked","row:dblclicked","row:pending","row:confirmed","row:reverted","row:conflict","form:opened","form:closed","form:saved","form:error","sort:changed","filter:changed","group:toggled","facet:computed","facet:filtered","facet:expanded","facet:failed","column:moved","column:resized","column:visible","column:pinned","column:grouped","column:pivoted","column:filter:open","column:profile:open","column:compareGroups:open","column:menu:open","explain:open","columns:changed","columns:tagged","columngroup:changed","header:contextmenu","totals:contextmenu","pivot:drill","selection:changed","range:changed","clipboard:copy","page:changed","scroll","scroll:end","size:changed","detail:toggled","detail:cell:edit:start","detail:cell:edit:end","detail:row:edit:start","detail:row:edit:end","detail:cell:changed","toolpanel:focus","highlight:changed","find:changed","tree:loading","tree:loaded","tree:loadFailed","tree:loadAborted","state:changed","state:reset","history:changed","history:applied","views:changed","view:applied","view:saved","view:removed","view:renamed","view:default","validation:failed","validation:cleared","formatting:changed","redaction:changed","permissions:changed","presentation:changed","presentation:started","presentation:ended","presentation:view","presentation:scale","presentation:spotlight","presentation:captured","comment:added","comment:edited","comment:deleted","comment:failed","comment:resolved","comment:unresolved","comment:threadOpened","comment:threadClosed","comment:indexLoaded","presence:published","presence:joined","presence:updated","presence:left","presence:failed","presence:lockRefused","diff:changed","diff:swapped","timeline:attached","timeline:detached","timeline:seek","timeline:seeking","annotation:changed","export:progress","export:request","export:done","shortcuts:opened","shortcuts:closed","print:before","print:after","beforeEdit","beforeSort","beforeFilter","beforeColumnMove","beforeColumnResize","beforeColumnHide","beforeSelect","beforeRowAdd","beforeDelete","beforeRowMove","beforeGroup","beforeRowReceive","edit:cancelled","sort:cancelled","filter:cancelled","columnMove:cancelled","columnResize:cancelled","columnHide:cancelled","selection:cancelled","rowAdd:cancelled","delete:cancelled","rowMove:cancelled","group:cancelled","rowReceive:cancelled"]),M=new Set(re);function G(F){return F==="*"||M.has(F)}}),Be("packages/core/src/events/bus.js",function(e,D){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return g}});const re=D("packages/core/src/internal/warn.js"),M=re.warnOnce,G=re.DEV,x=D("packages/core/src/internal/uid.js").uid,W=D("packages/core/src/events/names.js").isKnownEvent,I="*";function K(i,t){!G||W(t)||M(`bus.unknown:${t}`,`${i}('${t}') subscribes to an event the grid never raises, so the handler will never fire. Check the name against the EventName list — a common cause is a near miss such as 'row:click' for 'row:clicked'.`)}const R=new Set(["api","user","init","ai"]),S=new WeakMap;function k(i){let t=S.get(i);return t||(t=x("h"),S.set(i,t)),t}function y(){return typeof performance=="object"&&performance?performance.now():Date.now()}function l(i){if(!i||typeof i!="object")return{};const t={};for(const[o,c]of Object.entries(i))o!=="grid"&&(c==null?t[o]=String(c):Array.isArray(c)?t[o]=`[${c.length}]`:typeof c=="object"?t[o]=c.key?`row ${c.key}`:"{…}":typeof c=="function"?t[o]="[function]":t[o]=String(c).slice(0,60));return t}class g{#e=new Map;#t=!1;#n=[];#r=200;#i=new Map;#s=null;#o=!1;#l=0;constructor(t=null){this.#s=t}attach(t){this.#s=t}get grid(){return this.#s}get destroyed(){return this.#o}on(t,o){if(typeof o!="function")return M(`bus.handler:${t}`,`on('${t}') needs a function; ignored.`),()=>{};K("on",t);let c=this.#e.get(t);return c||(c=[],this.#e.set(t,c)),c.push(o),()=>this.off(t,o)}once(t,o){if(typeof o!="function")return M(`bus.handler:${t}`,`once('${t}') needs a function; ignored.`),()=>{};K("once",t);const c=f=>{this.off(t,o),o(f)};return this.#i.set(o,c),this.on(t,c)}off(t,o){if(o===void 0){this.#e.delete(t);return}const c=this.#e.get(t);if(!c)return;const f=this.#i.get(o),n=f&&c.includes(f)?f:o,m=c.indexOf(n);m>=0&&c.splice(m,1),f&&n===f&&this.#i.delete(o),c.length===0&&this.#e.delete(t)}count(t){const o=this.#e.get(t),c=t===I?null:this.#e.get(I);return(o?o.length:0)+(c?c.length:0)}#a(t,o,c,f,n){this.#n.push({type:t,origin:o,listeners:(f?f.length:0)+(n?n.length:0),payload:l(c),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(t,o){this.#t=!!t,Number.isFinite(o)&&o>0&&(this.#r=Math.floor(o)),t||(this.#n=[])}eventLog(){return this.#n.map(t=>({...t}))}clearEventLog(){this.#n=[]}counts(){const t={};for(const[o,c]of this.#e)t[o]=c.length;return t}emit(t,o,c){const f=c??(o&&o.origin),n=R.has(f)?f:"api",m={...o||null,type:t,origin:n,grid:this.#s};if(this.#o)return m;const r=this.#e.get(t),s=t===I?void 0:this.#e.get(I);if(this.#t&&this.#a(t,n,o,r,s),!r&&!s)return m;const d=this.#t?y():0;this.#l++;try{r&&this.#c(r.slice(),m,t),s&&this.#c(s.slice(),m,I)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=y()-d)}return m}emitBefore(t,o,c){const f=c??(o&&o.origin),n=R.has(f)?f:"user";let m=!1,r=null;const s=h=>{m=!0,h!=null&&r===null&&(r=String(h))},d={...o||null,type:t,origin:n,grid:this.#s,get defaultPrevented(){return m},get reason(){return r},preventDefault(h){s(h)}};if(this.#o)return!0;const p=this.#e.get(t);this.#t&&this.#a(t,n,o,p,void 0);const u=p?p.slice():[];if(u.length===0)return!0;const b=()=>(m&&r===null&&(r="prevented"),m&&o&&typeof o=="object"&&(o.reason=r),!m),a=[];for(const h of u)try{const w=h(d);w&&typeof w.then=="function"?a.push(w):w===!1&&s("prevented")}catch(w){s("error"),M(`bus.beforeThrow:${t}:${k(h)}`,`a '${t}' before-handler threw; the action was cancelled.`,w)}return a.length===0?b():Promise.allSettled(a).then(h=>{for(const w of h)w.status==="rejected"?(s("error"),M(`bus.beforeReject:${t}`,`a '${t}' before-handler rejected; the action was cancelled.`,w.reason)):w.value===!1&&s("prevented");return b()})}#c(t,o,c){for(let f=0;f<t.length;f++)try{t[f](o)}catch(n){M(`bus.throw:${c}:${k(t[f])}`,`a '${c}' handler threw; other handlers were unaffected.`,n)}}clear(){this.#e.clear(),this.#i.clear()}destroy(){this.clear(),this.#o=!0,this.#s=null}}}),Be("packages/core/src/registry/free-tier-notice.js",function(e,D){"use strict";Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"WATERMARK_TEXT",{enumerable:!0,get:function(){return M}});const re="Free for non-commercial use: latticegrid.dev/free",M="Unlicensed: Lattice Grid trial"}),Be("packages/core/src/registry/licence.js",function(e,D){"use strict";Object.defineProperty(e,"PRODUCT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"LICENCE_VERSION",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"fromBase64Url",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"toBase64Url",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"asciiBytes",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"parseLicence",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"hasEd25519",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"verifyLicence",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"isLocalHost",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"currentHost",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"matchesDomain",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LicenceHolder",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"setLicence",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return j}});const M=D("packages/core/src/internal/warn.js").warnOnce,G=D("packages/core/src/registry/free-tier-notice.js"),F=G.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return G.FREE_TIER_NOTICE}});const x="lattice-grid",q=1,W="LG1",I=64,K="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",R="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",S=(()=>{const E=new Int16Array(128).fill(-1);for(let O=0;O<R.length;O++)E[R.charCodeAt(O)]=O;return E[43]=62,E[47]=63,E})();function k(E){if(typeof E!="string")return null;let O="";for(let X=0;X<E.length;X++){const Q=E.charCodeAt(X);if(Q!==61){if(Q>127||S[Q]<0)return null;O+=E[X]}}const N=O.length;if(N%4===1)return null;const T=new Uint8Array(Math.floor(N*3/4));let C=0,B=0,z=0;for(let X=0;X<N;X++)C=C<<6|S[O.charCodeAt(X)],B+=6,B>=8&&(B-=8,T[z++]=C>>B&255);return z===T.length?T:T.subarray(0,z)}function y(E){let O="",N=0;for(;N+2<E.length;N+=3){const C=E[N]<<16|E[N+1]<<8|E[N+2];O+=R[C>>18&63]+R[C>>12&63]+R[C>>6&63]+R[C&63]}const T=E.length-N;if(T===1){const C=E[N]<<16;O+=R[C>>18&63]+R[C>>12&63]}else if(T===2){const C=E[N]<<16|E[N+1]<<8;O+=R[C>>18&63]+R[C>>12&63]+R[C>>6&63]}return O}function l(E){const O=new Uint8Array(E.length);for(let N=0;N<E.length;N++)O[N]=E.charCodeAt(N)&127;return O}function g(E){if(typeof TextDecoder=="function")return new TextDecoder().decode(E);let O="";for(let N=0;N<E.length;N++)O+=String.fromCharCode(E[N]);return O}function i(E){const O={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof E=="string"?E:""};if(typeof E!="string"||E.length===0)return{...O,reason:"missing"};const N=E.trim(),T=N.split(".");if(T.length!==3)return O;const[C,B,z]=T;if(C!==W)return{...O,reason:"prefix"};const X=k(B),Q=k(z);if(!X||!Q)return O;let H;try{H=JSON.parse(g(X))}catch{return O}return H===null||typeof H!="object"?O:{ok:!0,reason:null,product:typeof H.p=="string"?H.p:null,issuedTo:typeof H.t=="string"?H.t:null,expires:typeof H.e=="string"?H.e:null,terms:typeof H.terms=="string"?H.terms:null,features:Array.isArray(H.f)?H.f.slice():[],deployments:Array.isArray(H.d)?H.d.slice():[],version:typeof H.v=="number"?H.v:0,message:l(B),signature:Q,raw:N}}function t(E,O){if(!E)return!1;const N=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(E)?`${E}T23:59:59.999Z`:E);return Number.isNaN(N)?!0:O>N}function o(E){return E==="non-commercial"?"non-commercial":"commercial"}let c=null,f=null,n=null;function m(){const E=globalThis.crypto;return E&&E.subtle?E.subtle:null}async function r(E){if(c&&f===E)return c;const O=m();if(!O)return null;const N=k(E);if(!N)return null;try{const T=await O.importKey("raw",N,{name:"Ed25519"},!1,["verify"]);return c=T,f=E,T}catch{return null}}async function s(){return n!==null||(n=await r(K)!==null),n}async function d(E,O={}){const N=O.warn!==!1,T=O.product||x,C=O.publicKey||K,B=O.now??Date.now(),z=O.host??u(),X=p(z)?"":` ${F}`,Q=i(E);if(!Q.ok){const te=Q.reason==="missing"?"missing":"malformed";return N&&M(`licence.${te}`,te==="missing"?`no licence key supplied. The grid renders in full and carries a trial watermark on any host other than localhost. Get a key at latticegrid.dev.${X}`:`licence key could not be read. The grid will render with a watermark.${X}`),{valid:!1,reason:te,terms:"commercial"}}const H={product:Q.product||void 0,issuedTo:Q.issuedTo||void 0,expires:Q.expires||void 0,terms:o(Q.terms)};if(Q.product!==T)return N&&M("licence.product",`licence key is for '${Q.product}', not '${T}'. The grid will render with a watermark.`),{valid:!1,...H,reason:"product"};if(t(Q.expires,B))return N&&M("licence.expired",`licence expired on ${Q.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,...H,reason:"expired"};const L=Q.deployments||[];if(L.length&&z&&!p(z)&&!b(z,L))return N&&M("licence.domain",`licence key is not valid for ${z}; it covers ${L.join(", ")}. The grid will render with a watermark.`),{valid:!1,...H,reason:"domain"};const Z=await r(C);if(!Z){const te=!!Q.signature&&Q.signature.length===I;return N&&M("licence.algorithm","this host does not provide crypto.subtle Ed25519, so the licence signature could not be verified. A structural check was used instead."),te?{valid:!0,...H,reason:"unverified"}:{valid:!1,...H,reason:"signature"}}let ee=!1;try{ee=await m().verify({name:"Ed25519"},Z,Q.signature,Q.message)}catch{ee=!1}return ee?{valid:!0,...H}:(N&&M("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...H,reason:"signature"})}function p(E){const O=String(E??u()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!O||O==="localhost"||O.endsWith(".localhost")||O==="::1"||O==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(O)}function u(){const E=globalThis.location;return E&&typeof E.hostname=="string"?E.hostname:null}function b(E,O){const N=a(E);return!N||!Array.isArray(O)?!1:O.some(T=>{const C=a(T);if(!C)return!1;if(C==="*")return!0;if(C.startsWith("*.")){const B=C.slice(2);return N===B||N.endsWith(`.${B}`)}return N===C})}function a(E){return String(E??"").trim().toLowerCase().replace(/\.$/,"")}class h{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#i;#s=new Set;constructor(O={}){this.#i=O}set(O){this.#e=typeof O=="string"?O.trim():"";const N=i(this.#e);return this.#t=N.ok?{valid:!t(N.expires,Date.now())&&N.product===(this.#i.product||x),product:N.product||void 0,issuedTo:N.issuedTo||void 0,expires:N.expires||void 0,terms:o(N.terms),reason:"pending"}:{valid:!1,reason:N.reason||"malformed",terms:"commercial"},this.#n=null,this.#e&&this.verify(),this.#t}verify(){if(this.#n)return this.#n;const O=this.#e;return this.#n=d(O,this.#i).then(N=>{if(this.#e===O){this.#t=N;for(const T of this.#s)T(N)}return N}),this.#n}onSettled(O){return this.#s.add(O),()=>this.#s.delete(O)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!p(this.#r)}setHost(O){this.#r=O}state(){return this.#t.valid?"licensed":p(this.#r)?"localhost":"trial"}reset(){this.#e="",this.#t={valid:!1,reason:"missing",terms:"commercial"},this.#n=null,this.#s.clear()}}const w=Symbol.for("lattice-grid/licence/holder");function v(){const E=globalThis,O=E&&E[w];if(O&&typeof O.set=="function"&&typeof O.watermark=="function")return O;const N=new h;if(E)try{E[w]=N}catch{}return N}const A=v();function _(E){return A.set(E)}function V(){return A.info()}function Y(){return A.watermark()}function $(){return A.state()}function j(){return A}}),Be("packages/core/src/registry/registry.js",function(e,D){"use strict";Object.defineProperty(e,"KINDS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"REGIONS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return c}});const re=D("packages/core/src/internal/warn.js"),M=re.warnOnce,G=re.DEV,x=D("packages/core/src/internal/predicates.js").isFunction,q=D("packages/core/src/registry/licence.js"),W=q.LicenceHolder,I=q.sharedLicence,K=["renderer","editor","filter","dataType","totalFn","pipe","component"],R=["all","header","body","totals","panels"];class S{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#i;#s=null;#o=null;#l=new Set;#a=new Map;constructor(n={}){for(const m of K)this.#t.set(m,new Map);this.#i=n.holder||I(),this.#o=n.grid??null,this.#s=this.#i.onSettled(()=>{this.#f({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),n.licence&&this.setLicence(n.licence)}registerModules(n,m={}){m.licence&&this.setLicence(m.licence),m.grid!==void 0&&(this.#o=m.grid);const r=Array.isArray(n)?n:[n],s=[];for(const d of r){if(!d||typeof d!="object"||typeof d.name!="string"||!d.name){M("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(d.name)){G&&this.#u(this.#e.get(d.name),d);continue}if(!x(d.install)){M(`registry.module.install:${d.name}`,`module '${d.name}' has no install() and was ignored.`);continue}const p={registry:this,grid:this.#o};try{d.install(p)}catch(u){M(`registry.module.throw:${d.name}`,`module '${d.name}' threw during install; it was not registered.`,u);continue}this.#e.set(d.name,d);for(const u of k(d))this.#n.add(u);s.push(d.name),this.#f({reason:"module",name:d.name,capabilities:this.capabilities(),regions:g(d)})}return s}unregisterModule(n){const m=this.#e.get(n);if(!m)return!1;if(x(m.uninstall))try{m.uninstall({registry:this,grid:this.#o})}catch(r){M(`registry.module.uninstall:${n}`,`module '${n}' threw during uninstall.`,r)}return this.#e.delete(n),this.#c(),this.#f({reason:"unmodule",name:n,capabilities:this.capabilities(),regions:g(m)}),!0}modules(){return[...this.#e.values()]}has(n){return this.#e.has(n)}#c(){this.#n.clear();for(const n of this.#e.values())for(const m of k(n))this.#n.add(m)}#u(n,m){!n||n===m||y(n,m)||M(`registry.module.reconfigure:${m.name}`,`module '${m.name}' was re-registered with different options; the first registration is kept and this call was ignored. Unregister it first if you mean to replace it.`)}capabilities(){return[...this.#n].sort()}can(n){return this.#n.has(n)}onChange(n){return x(n)?(this.#r.add(n),this.#a.set(n,this.#o),()=>{this.#r.delete(n),this.#a.delete(n)}):()=>{}}#f(n){for(const m of[...this.#r])try{m(n)}catch(r){M("registry.onChange.throw","a registry change handler threw.",r)}}register(n,m,r){const s=this.#t.get(n);if(!s){M(`registry.kind:${n}`,`unknown registry kind '${n}'; expected one of ${K.join(", ")}.`);return}if(!m||typeof m!="string"){M(`registry.name:${n}`,`register('${n}', ...) needs a name.`);return}s.has(m)&&s.get(m)!==r&&M(`registry.replace:${n}:${m}`,`'${m}' was already registered as a ${n} and has been replaced.`),s.set(m,r),this.#f({reason:"register",name:m,kind:n,capabilities:this.capabilities(),regions:i(n)})}registerAll(n,m){if(m)for(const r of Object.keys(m))this.register(n,r,m[r])}get(n,m){const r=this.#t.get(n);return r?r.get(m):void 0}names(n){const m=this.#t.get(n);return m?[...m.keys()]:[]}#d(n,m){const r=this.#t.get(n).get(m);return r!==void 0?r:this.#t.get("component").get(m)}renderer(n){return this.#d("renderer",n)}editor(n){return this.#d("editor",n)}filter(n){return this.#d("filter",n)}dataType(n){return this.get("dataType",n)}totalFn(n){return this.get("totalFn",n)}pipe(n){return this.get("pipe",n)}setLicence(n){return this.#i.set(n)}licence(){return this.#i.info()}licenceVerified(){return this.#i.verify()}watermark(){return this.#i.watermark()}attach(n){n!=null&&(this.#l.add(n),this.#o=n)}detach(n){if(n!=null){this.#l.delete(n);for(const[m,r]of[...this.#a])r===n&&(this.#r.delete(m),this.#a.delete(m));if(this.#o===n){const m=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#o=m}this.#l.size===0&&this.#s&&(this.#s(),this.#s=null)}}destroy(n){if(n!=null){this.detach(n);return}for(const m of[...this.#e.keys()])this.unregisterModule(m);this.#r.clear(),this.#a.clear(),this.#l.clear(),this.#s&&this.#s(),this.#s=null,this.#o=null}}function k(f){const n=f.capabilities,m=Array.isArray(n)?n.filter(r=>typeof r=="string"):[];return[f.name,...m]}function y(f,n){return f.install!==n.install||f.uninstall!==n.uninstall||(f.version||"")!==(n.version||"")?!1:l(k(f),k(n))&&l(g(f),g(n))}function l(f,n){const m=new Set(f),r=new Set(n);if(m.size!==r.size)return!1;for(const s of m)if(!r.has(s))return!1;return!0}function g(f){const n=f.regions;return!Array.isArray(n)||n.length===0?["all"]:n.filter(m=>R.includes(m))}function i(f){switch(f){case"filter":return["header"];case"totalFn":return["totals"];case"renderer":case"editor":case"pipe":return["body"];default:return["all"]}}const t=new S;function o(){return t}function c(f,n={}){return t.registerModules(f,n)}}),Be("packages/core/src/internal/text.js",function(e,D){"use strict";Object.defineProperty(e,"humanise",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"escapeHtml",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return F}});function re(x){return x?(x.includes(".")?x.slice(x.lastIndexOf(".")+1):x).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,W=>W.toUpperCase()):""}const M={"&":"&","<":"<",">":">",'"':""","'":"'"};function G(x){const q=x==null?"":String(x);return/[&<>"']/.test(q)?q.replace(/[&<>"']/g,W=>M[W]):q}function F(x){return String(x).replace(/\w\S*/g,q=>q[0].toUpperCase()+q.slice(1).toLowerCase())}}),Be("packages/core/src/format/mask.js",function(e,D){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return q}});const re=new Set(["0","#","?",",","."]),M="\0";function G(I){const K=[];let R="",S=!1;for(let k=0;k<I.length;k++){const y=I[k];if(y==="\\"){R+=y+(I[k+1]??""),k+=1;continue}if(y==='"'){S=!S,R+=y;continue}if(y===";"&&!S){K.push(R),R="";continue}R+=y}return K.push(R),K}function F(I){let K="",R="",S="",k=1,y=!1,l=!1;const g=s=>{l?R+=s:K+=s};for(let s=0;s<I.length;s++){const d=I[s];if(d==="\\"){g(I[s+1]??""),s+=1;continue}if(d==='"'){const p=I.indexOf('"',s+1);g(p===-1?I.slice(s+1):I.slice(s+1,p)),s=p===-1?I.length:p;continue}if(d==="%"){k*=100,g("%");continue}if(d==="@"){y=!0,g("\0");continue}if(re.has(d)){S+=d,l=!0;continue}g(d)}let i=-1;for(let s=S.length-1;s>=0;s--){const d=S[s];if(d==="0"||d==="#"||d==="?"){i=s;break}}let t=!1,o="";for(let s=0;s<S.length;s++){const d=S[s];if(d===","){s>i?k/=1e3:t=!0;continue}o+=d}const c=o.indexOf("."),f=c===-1?o:o.slice(0,c),n=c===-1?"":o.slice(c+1);let m=0;for(const s of f)s==="0"&&(m+=1);let r=0;for(const s of n)s==="0"&&(r+=1);return{prefix:K,suffix:R,minInt:m,minDec:r,maxDec:n.length,grouping:t,scale:k,hasNumber:i!==-1,isText:y}}function x(I,K){const R=new Intl.NumberFormat(K,{minimumIntegerDigits:Math.max(I.minInt,1),minimumFractionDigits:I.minDec,maximumFractionDigits:Math.max(I.maxDec,I.minDec),useGrouping:I.grouping}),{prefix:S,suffix:k,scale:y,hasNumber:l}=I;return g=>{if(!l)return S+k;const i=y===1?g:g*y;return S+R.format(i)+k}}function q(I,K){const S=G(String(I)).map(F),k=S.map(o=>x(o,K)),y=0,l=S.length>1?1:-1,g=S.length>2?2:-1,i=S.length>3?3:-1,t=o=>{if(o==null||o==="")return"";if(typeof o!="number"||Number.isNaN(o)){const c=Number(o);if(Number.isNaN(c))return i===-1?String(o):(S[i].prefix+S[i].suffix).split("\0").join(String(o));o=c}return o===0&&g!==-1?k[g](0):o<0&&l!==-1?k[l](-o):k[y](o)};return t.spec={mask:I},{format:t,ooxml:W(String(I))}}function W(I){return I.trim()}}),Be("packages/core/src/format/pattern.js",function(e,D){"use strict";Object.defineProperty(e,"parseNumberPattern",{enumerable:!0,get:function(){return x}});const M=D("packages/core/src/format/mask.js").splitSections;function G(q){let W="",I="",K="",R="",S=!1,k=!1,y=!1,l=!1;const g=t=>{y?I+=t:W+=t};for(let t=0;t<q.length;t++){const o=q[t];if(o==="\\"){g(q[t+1]??""),t+=1;continue}if(o==='"'){const c=q.indexOf('"',t+1);g(c===-1?q.slice(t+1):q.slice(t+1,c)),t=c===-1?q.length:c;continue}if(o==="%"){k=!0;continue}if(o==="0"||o==="#"){y=!0,l?R+=o:K+=o;continue}if(o===","){l||(S=!0);continue}if(o==="."&&!l){l=!0;continue}g(o)}if(!y)return{hasDigit:!1,prefix:W,suffix:I,minDec:0,maxDec:0,grouping:!1,percent:k};let i=0;for(const t of R)t==="0"&&(i+=1);return{hasDigit:!0,prefix:W,suffix:I,minDec:i,maxDec:R.length,grouping:S,percent:k}}function F(q,W){const I=W.trim(),K=q.trim();return I.startsWith("(")&&I.endsWith(")")&&I.slice(1,-1).trim()===K?"parentheses":I.endsWith("-")?"suffix":"minus"}function x(q){if(typeof q!="string")return null;const W=M(q);if(W.length===0)return null;const I=G(W[0]);if(!I.hasDigit)return null;const K={style:I.percent?"percent":"decimal",prefix:I.prefix,suffix:I.suffix,minDecimals:I.minDec,maxDecimals:Math.max(I.maxDec,I.minDec),thousandsSeparator:I.grouping?void 0:!1};if(W.length>1&&(K.negative=F(W[0],W[1])),W.length>2){const R=G(W[2]);R.hasDigit||(K.zeroDisplay=R.prefix+R.suffix)}return K}}),Be("packages/core/src/format/number.js",function(e,D){"use strict";Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return W}});const M=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/warn.js").warnOnce,q=D("packages/core/src/format/pattern.js").parseNumberPattern;function W(I,K){const R=typeof I=="string"?{pattern:I}:I||{};let S=R;if(typeof R.pattern=="string"){const v=q(R.pattern);if(v){const{pattern:A,..._}=R;S={...v,..._}}else F(`format:pattern:${R.pattern}`,`invalid number format pattern "${R.pattern}"; the value will use the default number format`)}const k=S.locale||K||void 0,y=S.style||"decimal",l=typeof S.scale=="number"?S.scale:1,g=S.nullDisplay??"",i=S.zeroDisplay,t=S.prefix||"",o=S.suffix||"",c=S.negative||"minus",f=S.signed===!0,n={style:y,notation:S.notation||"standard"};y==="currency"&&(n.currency=S.currency||"USD",S.currencyDisplay&&(n.currencyDisplay=S.currencyDisplay)),typeof S.decimals=="number"?(n.minimumFractionDigits=S.decimals,n.maximumFractionDigits=S.decimals):(typeof S.minDecimals=="number"&&(n.minimumFractionDigits=S.minDecimals),typeof S.maxDecimals=="number"&&(n.maximumFractionDigits=S.maxDecimals),n.minimumFractionDigits>(n.maximumFractionDigits??20)&&(n.maximumFractionDigits=n.minimumFractionDigits)),S.thousandsSeparator===!1&&(n.useGrouping=!1),n.notation==="compact"&&(n.compactDisplay=S.compactDisplay||"short");const m=new Intl.NumberFormat(k,n),r=typeof S.thousandsSeparator=="string"?S.thousandsSeparator:null,s=typeof S.decimalSeparator=="string"?S.decimalSeparator:null;let d=",",p=".";if(r||s)for(const v of m.formatToParts(12345.6))v.type==="group"?d=v.value:v.type==="decimal"&&(p=v.value);const u=v=>{let A=v;return r&&(A=A.split(d).join("")),s&&(A=A.split(p).join("")),r&&(A=A.split("").join(r)),s&&(A=A.split("").join(s)),A},b=!!(r||s),a=t!==""&&y==="currency",h=v=>{let A;if(a){const _=m.formatToParts(v);let V=!1;A="";for(const Y of _)A+=Y.value,!V&&Y.type==="currency"&&(A+=t,V=!0);V||(A=t+A)}else A=t+m.format(v);return b&&(A=u(A)),A+o},w=v=>{if(M(v)||v==="")return g;const A=typeof v=="number"?v:Number(v);if(Number.isNaN(A))return g;const _=l===1?A:A*l;return _===0&&i!==void 0?i:_<0?c==="parentheses"?`(${h(-_)})`:c==="suffix"?`${h(-_)}-`:h(_):f&&_>0?`+${h(_)}`:h(_)};return w.negativeClass=S.negativeClass||null,w.spec=S,w}}),Be("packages/core/src/format/date.js",function(e,D){"use strict";Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return o}});const M=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/warn.js").warnOnce,x=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function q(c){const f=[];let n=0,m="";const r=()=>{m&&(f.push({token:null,text:m}),m="")};for(;n<c.length;){const s=c[n];if(s==="'"){if(c[n+1]==="'"){m+="'",n+=2;continue}const p=c.indexOf("'",n+1);if(p===-1){m+=c.slice(n+1),n=c.length;continue}m+=c.slice(n+1,p),n=p+1;continue}const d=x.find(p=>c.startsWith(p,n));if(d){r(),f.push({token:d,text:d}),n+=d.length;continue}/[A-Za-z]/.test(s)&&F(`date.pattern.token:${s}`,`the date pattern "${c}" contains '${s}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${x.join(" ")}.`),m+=s,n+=1}return r(),f}const W=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function I(c){if(M(c)||c==="")return null;if(c instanceof Date)return Number.isNaN(c.getTime())?null:c;if(typeof c=="number")return Number.isNaN(c)?null:new Date(c);if(typeof c=="string"){const f=W.exec(c.trim());if(f){const[,m,r,s,d="0",p="0",u="0"]=f;return new Date(+m,+r-1,+s,+d,+p,+u)}const n=new Date(c);return Number.isNaN(n.getTime())?null:n}return null}function K(c,f){return String(c).padStart(f,"0")}function R(c){if(!c)return m=>({year:m.getFullYear(),month:m.getMonth()+1,day:m.getDate(),hour:m.getHours(),minute:m.getMinutes(),second:m.getSeconds(),ms:m.getMilliseconds(),weekday:m.getDay()});const f=new Intl.DateTimeFormat("en-US",{timeZone:c,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"short"}),n={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return m=>{const r={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:m.getMilliseconds(),weekday:0};for(const s of f.formatToParts(m))switch(s.type){case"year":r.year=Number(s.value);break;case"month":r.month=Number(s.value);break;case"day":r.day=Number(s.value);break;case"hour":r.hour=Number(s.value)%24;break;case"minute":r.minute=Number(s.value);break;case"second":r.second=Number(s.value);break;case"weekday":r.weekday=n[s.value]??0;break;default:break}return r}}function S(c,f,n){const m=q(c),r=R(n),s=new Set(m.filter(a=>a.token).map(a=>a.token)),d=s.has("MMM")?new Intl.DateTimeFormat(f,{month:"short",timeZone:n}):null,p=s.has("MMMM")?new Intl.DateTimeFormat(f,{month:"long",timeZone:n}):null,u=s.has("EEE")?new Intl.DateTimeFormat(f,{weekday:"short",timeZone:n}):null,b=s.has("EEEE")?new Intl.DateTimeFormat(f,{weekday:"long",timeZone:n}):null;return a=>{const h=r(a);let w="";for(const v of m){if(!v.token){w+=v.text;continue}switch(v.token){case"yyyy":w+=K(h.year,4);break;case"yy":w+=K(h.year%100,2);break;case"MMMM":w+=p.format(a);break;case"MMM":w+=d.format(a);break;case"MM":w+=K(h.month,2);break;case"M":w+=String(h.month);break;case"dd":w+=K(h.day,2);break;case"d":w+=String(h.day);break;case"EEEE":w+=b.format(a);break;case"EEE":w+=u.format(a);break;case"HH":w+=K(h.hour,2);break;case"H":w+=String(h.hour);break;case"hh":w+=K(h.hour%12===0?12:h.hour%12,2);break;case"h":w+=String(h.hour%12===0?12:h.hour%12);break;case"mm":w+=K(h.minute,2);break;case"m":w+=String(h.minute);break;case"ss":w+=K(h.second,2);break;case"s":w+=String(h.second);break;case"SSS":w+=K(h.ms,3);break;case"a":w+=h.hour<12?"AM":"PM";break;default:w+=v.text;break}}return w}}const k=[["year",365*24*36e5],["month",720*36e5],["week",168*36e5],["day",24*36e5],["hour",36e5],["minute",6e4],["second",1e3]];function y(c,f){const n=c||{},m=n.locale||f||void 0,r=n.nullDisplay??"",s=n.timeZone;let d;if(n.pattern)d=S(n.pattern,m,s);else if(n.dateStyle||n.timeStyle){const h={timeZone:s};n.dateStyle&&(h.dateStyle=n.dateStyle),n.timeStyle&&(h.timeStyle=n.timeStyle);const w=new Intl.DateTimeFormat(m,h);d=v=>w.format(v)}else{const h=new Intl.DateTimeFormat(m,{dateStyle:"medium",timeZone:s});d=w=>h.format(w)}const p=n.relative?new Intl.RelativeTimeFormat(m,{numeric:"auto"}):null,b=(typeof n.relative=="object"&&n.relative?n.relative.threshold??7:7)*24*36e5,a=(h,w)=>{const v=I(h);if(!v)return r;if(p){const A=w&&typeof w.now=="number"?w.now:Date.now(),_=v.getTime()-A;if(Math.abs(_)<b){for(const[V,Y]of k)if(Math.abs(_)>=Y||V==="second")return p.format(Math.round(_/Y),V)}}return d(v)};return a.spec=n,a}function l(c){if(M(c)||c==="")return null;if(typeof c=="string"){const m=/^(\d{4}-\d{2}-\d{2})/.exec(c.trim());if(m)return m[1];const r=I(c);return r?l(r):null}const f=I(c);if(!f)return null;const n=m=>String(m).padStart(2,"0");return`${f.getFullYear()}-${n(f.getMonth()+1)}-${n(f.getDate())}`}function g(c,f){if(M(c)||c==="")return null;if(typeof c=="string"){const m=c.trim();if(i.test(m)){const d=I(m);return d?t(d,f):null}const r=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(m);if(r){const[,d,p,u,b]=r;return`${d}T${p}:${u}${b&&b!=="00"?`:${b}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(m))return`${m}T00:00`;const s=I(m);return s?g(s):null}const n=I(c);return n?t(n,f):null}const i=/(?:Z|[+-]\d{2}:?\d{2})$/i;function t(c,f){const n=d=>String(d).padStart(2,"0");if(f)try{const d=new Intl.DateTimeFormat("en-CA",{timeZone:f,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(c).reduce((b,a)=>(a.type!=="literal"&&(b[a.type]=a.value),b),{}),p=d.hour==="24"?"00":d.hour,u=Number(d.second);return`${d.year}-${d.month}-${d.day}T${p}:${d.minute}`+(u?`:${d.second}`:"")}catch{}const m=`${c.getFullYear()}-${n(c.getMonth()+1)}-${n(c.getDate())}`,r=c.getSeconds(),s=`${n(c.getHours())}:${n(c.getMinutes())}${r?`:${n(r)}`:""}`;return`${m}T${s}`}function o(c,f){const n=M(c)||c===""?null:String(c),m=M(f)||f===""?null:String(f);return n===null?m===null?0:1:m===null||n<m?-1:n>m?1:0}}),Be("packages/core/src/format/boolean.js",function(e,D){"use strict";Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return q}});const M=D("packages/core/src/internal/predicates.js").isNil,G={true:"☑",false:"☐",null:""},F={true:"◉",false:"◯",null:""};function x(W){if(M(W)||W==="")return null;if(typeof W=="boolean")return W;if(typeof W=="number")return W!==0;const I=String(W).trim().toLowerCase();return I==="true"||I==="yes"||I==="y"||I==="1"?!0:I==="false"||I==="no"||I==="n"||I==="0"?!1:null}function q(W,I){const K=W||{},R=K.display||"text",S=K.trueLabel??"Yes",k=K.falseLabel??"No",y=K.nullLabel??"";let l=S,g=k;const i=y;R==="checkbox"?(l=G.true,g=G.false):R==="switch"?(l=F.true,g=F.false):R==="icon"&&(l=K.trueIcon??S,g=K.falseIcon??k);const t=o=>{const c=x(o);return c===null?i:c?l:g};return t.display=R,t.labels={true:S,false:k,null:y},t.locale=I,t.spec=K,t}}),Be("packages/core/src/format/text.js",function(e,D){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return x}});const M=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/text.js").titleCase;function x(q,W){const I=q||{},K=I.locale||W||void 0,R=I.nullDisplay??"",S=I.emptyDisplay??"",k=I.transform||"none",y=typeof I.truncate=="number"?{chars:I.truncate}:I.truncate||null,l=y?y.chars:0,g=y?y.ellipsis??"…":"",i=o=>{switch(k){case"upper":return K?o.toLocaleUpperCase(K):o.toUpperCase();case"lower":return K?o.toLocaleLowerCase(K):o.toLowerCase();case"title":return F(o);default:return o}},t=o=>{if(M(o))return R;let c=typeof o=="string"?o:String(o);return c===""?S:(k!=="none"&&(c=i(c)),l>0&&c.length>l&&(c=c.slice(0,l)+g),c)};return t.spec=I,t}}),Be("packages/core/src/format/shorthand.js",function(e,D){"use strict";Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return W}});const re=["currency","number","percent","date","boolean","text","relative"],M=/[#0?@;"\\]/,G=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function F(I){return typeof I!="string"||I===""||q(I)?!1:M.test(I)}function x(I){return typeof I!="string"||I===""||q(I)?!1:G.test(I)}function q(I){const K=I.indexOf(":"),R=K===-1?I:I.slice(0,K);return re.includes(R)?R:null}function W(I){const K=q(I);if(!K)return null;const R=I.indexOf(":"),S=R===-1?"":I.slice(R+1),k=S===""?[]:S.split(":");switch(K){case"currency":{const y={type:"number",style:"currency",currency:k[0]||"USD"};return k[1]!==void 0&&k[1]!==""&&(y.decimals=Number(k[1])),y}case"number":{const y={type:"number",style:"decimal"};return k[0]!==void 0&&k[0]!==""&&(y.decimals=Number(k[0])),y}case"percent":{const y={type:"number",style:"percent"};return k[0]!==void 0&&k[0]!==""&&(y.decimals=Number(k[0])),y}case"date":return{type:"date",pattern:S||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const y=S.split("/"),l={type:"boolean",display:"text"};return y[0]!==void 0&&y[0]!==""&&(l.trueLabel=y[0]),y[1]!==void 0&&y[1]!==""&&(l.falseLabel=y[1]),y[2]!==void 0&&(l.nullLabel=y[2]),l}case"text":{const y={type:"text"};return k[0]&&(y.transform=k[0]),k[1]!==void 0&&k[1]!==""&&(y.truncate=Number(k[1])),y}default:return null}}}),Be("packages/core/src/format/index.js",function(e,D){"use strict";Object.defineProperty(e,"compileFormat",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"specToOoxml",{enumerable:!0,get:function(){return A}});const re=D("packages/core/src/internal/predicates.js"),M=re.isFunction,G=re.isObject,x=D("packages/core/src/internal/warn.js").warnOnce,q=D("packages/core/src/format/number.js"),W=q.compileNumber,I=D("packages/core/src/format/date.js"),K=I.compileDate,R=I.scanPattern,S=D("packages/core/src/format/boolean.js"),k=S.compileBoolean,y=D("packages/core/src/format/text.js"),l=y.compileText,g=D("packages/core/src/format/mask.js"),i=g.compileMask,t=D("packages/core/src/format/shorthand.js"),o=t.parseShorthand,c=t.looksLikeMask,f=t.looksLikeDatePattern,m=D("packages/core/src/format/pattern.js").parseNumberPattern;Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return q.compileNumber}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return I.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return I.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return I.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return I.toDate}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return S.compileBoolean}}),Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return S.toTriState}}),Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return y.compileText}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return g.compileMask}}),Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return g.splitSections}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return g.parseSection}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return t.parseShorthand}}),Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return t.looksLikeMask}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return t.looksLikeDatePattern}});const r=new Set(["decimal","currency","percent","unit"]),s=new Set(["type","locale"]),d={number:new Set(["style","currency","currencyDisplay","decimals","minDecimals","maxDecimals","thousandsSeparator","decimalSeparator","notation","compactDisplay","negative","negativeClass","signed","prefix","suffix","zeroDisplay","nullDisplay","messages","scale","pattern"]),date:new Set(["pattern","dateStyle","timeStyle","timeZone","relative","nullDisplay"]),boolean:new Set(["display","trueLabel","falseLabel","nullLabel","trueIcon","falseIcon"]),text:new Set(["transform","truncate","nullDisplay","emptyDisplay"])},p=new Set(["number","date","boolean","text"]);function u($,j){const E=$.type;if(E===void 0||p.has(E)||!r.has(String(E)))return;const O=j?`"${j}"`:"with no id";x(`format:unknown-style-key:${j||""}:${E}`,`column ${O} has format: { type: "${E}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${E}" instead?`)}function b($,j,E){const O=d[j],N=E?`"${E}"`:"with no id";for(const T of $){if(s.has(T)||O.has(T))continue;const C=Object.keys(d).find(B=>B!==j&&d[B].has(T));C?x(`format:inapplicable:${E||""}:${T}`,`column ${N} has format key "${T}", which applies to a ${C} column, not the ${j} column it was applied to; it is ignored.`):x(`format:unknown:${E||""}:${T}`,`column ${N} has an unrecognised format key "${T}" for its ${j} format; it is ignored.`)}}function a($){if($.type==="number"||$.type==="date"||$.type==="boolean"||$.type==="text")return!0;const j=r.has(String($.style));return!!($.pattern||$.dateStyle||$.timeStyle||$.relative||$.timeZone||$.trueLabel||$.falseLabel||$.display||$.trueIcon||$.falseIcon||$.transform||$.truncate||$.emptyDisplay||j||$.currency||$.decimals!==void 0||$.minDecimals!==void 0||$.maxDecimals!==void 0||$.notation||$.negative||$.scale!==void 0||$.prefix||$.suffix||$.zeroDisplay!==void 0)}function h($,j){if($.type==="number"||$.type==="date"||$.type==="boolean"||$.type==="text")return $.type;if($.pattern){if(c($.pattern))return"number";if(f($.pattern))return"date"}if($.dateStyle||$.timeStyle||$.relative||$.timeZone)return"date";if($.trueLabel||$.falseLabel||$.display||$.trueIcon||$.falseIcon)return"boolean";if($.transform||$.truncate||$.emptyDisplay)return"text";if($.style||$.currency||$.decimals!==void 0||$.minDecimals!==void 0||$.maxDecimals!==void 0||$.notation||$.negative||$.scale!==void 0||$.prefix||$.suffix||$.zeroDisplay!==void 0)return"number";const E=j&&j.base;return E==="number"?"number":E==="date"||E==="dateString"?"date":E==="boolean"?"boolean":"text"}function w($,j=null,E=void 0,O=void 0,N=void 0){if($==null||$==="")return null;const T=G($)?Object.keys($):null;if(typeof $=="function"){const z=(X,Q)=>String($({...Q||{},value:X,locale:E})??"");return z.ooxml=j&&j.excel||"General",z}if(typeof $=="string"){if(c($)){const{format:X,ooxml:Q}=i($,E);return X.ooxml=Q,X}const z=o($)||(f($)?{type:"date",pattern:$}:null);return z?w(z,j,E,O,N):(x(`format:${$}`,`unrecognised format string "${$}"; the value will be stringified`),null)}if(!G($))return x("format:shape","format must be a spec object or a string; ignoring",$),null;if(j&&M(j.format)&&!a($)||j&&M(j.format)&&Array.isArray(j.formatPatterns)&&$.type===void 0)return null;const C=h($,j);C==="date"&&O&&$.timeZone===void 0&&($={...$,timeZone:O}),u($,N),b(T||Object.keys($),C,N);let B;switch(C){case"number":B=W($,E);break;case"date":B=K($,E);break;case"boolean":B=k($,E);break;default:B=l($,E);break}return B.ooxml=A($,C,E,j),B.kind=C,B}const v={yyyy:"yyyy",yy:"yy",MMMM:"mmmm",MMM:"mmm",MM:"mm",M:"m",dd:"dd",d:"d",EEEE:"dddd",EEE:"ddd",HH:"hh",H:"h",hh:"hh",h:"h",mm:"mm",m:"m",ss:"ss",s:"s",SSS:"000",a:"AM/PM"};function A($,j,E=void 0,O=null){if(j==="date"){if($.pattern){let z="";for(const X of R($.pattern))z+=X.token?v[X.token]??X.text:X.text;return z}return O&&O.excel||"yyyy-mm-dd"}if(j==="boolean")return"General";if(j==="text")return"@";if(typeof $.pattern=="string"&&m($.pattern))return String($.pattern).trim();if($.notation==="compact"||$.notation==="scientific")return"General";const N=typeof $.decimals=="number"?$.decimals:typeof $.minDecimals=="number"?$.minDecimals:$.style==="currency"?2:0;let C=`${$.thousandsSeparator===!1?"":"#,#"}#0${N>0?`.${"0".repeat(N)}`:""}`,B="";return $.style==="currency"&&(B+=_(Y($.currency||"USD",E))),$.prefix&&(B+=_($.prefix)),C=B+C,$.style==="percent"&&(C=`${C}%`),$.suffix&&(C+=_($.suffix)),$.negative==="parentheses"?`${C};(${C})`:$.negative==="suffix"?`${C};${C}-`:C}function _($){return`"${String($).split('"').join("")}"`}const V=new Map;function Y($,j){const E=`${$}|${j||""}`;let O=V.get(E);if(O!==void 0)return O;O=$;try{const T=new Intl.NumberFormat(j,{style:"currency",currency:$}).formatToParts(0).find(C=>C.type==="currency");T&&(O=T.value)}catch{}return V.set(E,O),O}}),Be("packages/core/src/columns/types/temporal.js",function(e,D){"use strict";Object.defineProperty(e,"MS_SECOND",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"MS_MINUTE",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"MS_HOUR",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"MS_DAY",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"MS_WEEK",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"toTimeMs",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"zonedParts",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"zoneOffsetAt",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"instantFromParts",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"toEpochMs",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"toDurationMs",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return le}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return he}}),Object.defineProperty(e,"resolveZoneName",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"zoneLabel",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(e,"formatInstant",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"timestampGroupProjector",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(e,"TEMPORAL_INFERENCE_ORDER",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Me}});const re=D("packages/core/src/internal/predicates.js"),M=re.isNil,G=re.isFunction,F=D("packages/core/src/format/date.js"),x=F.toDate,q=F.compilePattern,W=F.compileDate,I=F.toIsoDateTime,K=F.compareIso,R=864e5,S=Object.freeze({}),k=1e3,y=60*k,l=60*y,g=24*l,i=7*g,t=new WeakMap;function o(je,_e){const Pe=je&&je.locale||"",Se=je&&je.column;if(!Se)return Pe?{locale:Pe}:S;const Fe=t.get(Se);if(Fe&&Fe.locale===Pe)return Fe.bag;const We=Se.typeOptions||Se[_e]||(c(Se.format)?Se.format:null),He={...We||S,locale:We&&We.locale||Pe||void 0};return t.set(Se,{locale:Pe,bag:He}),He}function c(je){return je!==null&&typeof je=="object"&&!Array.isArray(je)&&!(je instanceof Date)}function f(je,_e){const Pe=je===null||Number.isNaN(je)?null:je,Se=_e===null||Number.isNaN(_e)?null:_e;return Pe===null?Se===null?0:1:Se===null||Pe<Se?-1:Pe>Se?1:0}const n=/^(\d{1,2})(?:\s*[:.h]\s*(\d{1,2})(?:\s*[:.]\s*(\d{1,2})(?:[.,](\d{1,3}))?)?)?\s*(a\.?m\.?|p\.?m\.?|a|p)?$/i,m=/^(\d{3,6})$/;function r(je,_e,Pe,Se){return!(je>=0&&je<=23)||!(_e>=0&&_e<=59)||!(Pe>=0&&Pe<=59)||!(Se>=0&&Se<=999)?null:je*l+_e*y+Pe*k+Se}function s(je){if(M(je))return null;const _e=String(je).trim();if(_e==="")return null;const Pe=m.exec(_e);if(Pe){const lt=Pe[1];if(lt.length===5)return null;const ot=lt.length===3?1:2;return r(Number(lt.slice(0,ot)),Number(lt.slice(ot,ot+2)),Number(lt.slice(ot+2,ot+4)||0),0)}const Se=n.exec(_e);if(!Se)return null;let Fe=Number(Se[1]);const We=Number(Se[2]||0),He=Number(Se[3]||0),Ye=Se[4]?Number(Se[4].padEnd(3,"0")):0,Qe=Se[5]?Se[5][0].toLowerCase():null;if(Qe){if(Fe<1||Fe>12)return null;Fe=Fe%12,Qe==="p"&&(Fe+=12)}return r(Fe,We,He,Ye)}function d(je){return M(je)||je===""?null:typeof je=="number"?Number.isFinite(je)?(je%g+g)%g:null:je instanceof Date?Number.isNaN(je.getTime())?null:je.getHours()*l+je.getMinutes()*y+je.getSeconds()*k+je.getMilliseconds():s(je)}const p=new Map;function u(je){const _e=je.pattern||"",Pe=je.timeStyle||(je.seconds?"medium":"short"),Se=`${je.locale||""}|${_e}|${Pe}`;let Fe=p.get(Se);if(Fe)return Fe;if(_e)Fe=q(_e,je.locale||void 0,"UTC");else{const We=new Intl.DateTimeFormat(je.locale||void 0,{timeStyle:Pe,timeZone:"UTC"});Fe=He=>We.format(He)}return p.set(Se,Fe),Fe}function b(je,_e){const Pe=_e||S;if(je==null||typeof je!="number"||!Number.isFinite(je))return Pe.nullDisplay??"";const Se=(je%g+g)%g;return u(Pe)(new Date(Se))}function a(je){return je instanceof Date?!Number.isNaN(je.getTime()):typeof je=="number"?Number.isFinite(je)&&je>=0&&je<g:typeof je!="string"||!je.includes(":")?!1:s(je)!==null}function h(je){const _e=d(je);return _e==null?"":b(_e,{pattern:_e%k===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const w=new Map;function v(je){const _e=je||"";let Pe=w.get(_e);return Pe||(Pe=new Intl.DateTimeFormat("en-GB",{timeZone:je||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),w.set(_e,Pe)),Pe}function A(je,_e){const Pe={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const Se of v(_e).formatToParts(new Date(je)))Se.type==="year"?Pe.year=Number(Se.value):Se.type==="month"?Pe.month=Number(Se.value):Se.type==="day"?Pe.day=Number(Se.value):Se.type==="hour"?Pe.hour=Number(Se.value)%24:Se.type==="minute"?Pe.minute=Number(Se.value):Se.type==="second"&&(Pe.second=Number(Se.value));return Pe}function _(je,_e){const Pe=A(je,_e);return Date.UTC(Pe.year,Pe.month-1,Pe.day,Pe.hour,Pe.minute,Pe.second,0)-Math.floor(je/1e3)*1e3}function V(je,_e){const Pe=je.hour||0,Se=je.minute||0,Fe=je.second||0,We=je.ms||0;if(!_e)return new Date(je.year,je.month-1,je.day,Pe,Se,Fe,We).getTime();const He=Date.UTC(je.year,je.month-1,je.day,Pe,Se,Fe,We);let Ye=He-_(He,_e);return Ye=He-_(Ye,_e),Ye}const Y=/(?:Z|[+-]\d{2}:?\d{2})$/i,$=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function j(je,_e){if(M(je))return null;const Pe=String(je).trim();if(Pe==="")return null;const Se=_e&&_e.timeZone||void 0;if(!Y.test(Pe)){const Fe=$.exec(Pe);if(Fe){const We=(Fe[4]||"").trim(),He=We===""?0:s(We);if(He===null)return null;const Ye=V({year:Number(Fe[1]),month:Number(Fe[2]),day:Number(Fe[3]),hour:Math.floor(He/l),minute:Math.floor(He/y)%60,second:Math.floor(He/k)%60,ms:He%k},Se);return Number.isNaN(Ye)?null:new Date(Ye)}}return x(Pe)}function E(je){if(typeof je=="number")return Number.isFinite(je)?je:null;const _e=x(je);return _e?_e.getTime():null}const O=new Map;function N(je){const _e=[je.locale||"",je.pattern||"",je.dateStyle||"",je.timeStyle||"",je.timeZone||"",je.seconds?"1":""].join("|");let Pe=O.get(_e);if(Pe)return Pe;const Se=je.pattern?{type:"date",pattern:je.pattern,timeZone:je.timeZone}:{type:"date",dateStyle:je.dateStyle||"medium",timeStyle:je.timeStyle||(je.seconds?"medium":"short"),timeZone:je.timeZone};return Pe=W(Se,je.locale||void 0),O.set(_e,Pe),Pe}function T(je,_e){const Pe=_e||S,Se=E(je);return Se==null?Pe.nullDisplay??"":N(Pe)(Se)}function C(je){return je instanceof Date?!Number.isNaN(je.getTime()):typeof je!="string"||!$.test(je.trim())?!1:j(je)!==null}const B=Object.freeze([{key:"w",ms:i,intl:"week",long:["week","weeks"],names:["w","wk","wks","week","weeks"]},{key:"d",ms:g,intl:"day",long:["day","days"],names:["d","dy","day","days"]},{key:"h",ms:l,intl:"hour",long:["hour","hours"],names:["h","hr","hrs","hour","hours"]},{key:"m",ms:y,intl:"minute",long:["minute","minutes"],names:["m","min","mins","minute","minutes"]},{key:"s",ms:k,intl:"second",long:["second","seconds"],names:["s","sec","secs","second","seconds"]},{key:"ms",ms:1,intl:"millisecond",long:["millisecond","milliseconds"],names:["ms","msec","msecs","milli","millis","millisecond","milliseconds"]}]),z=new Map;for(const je of B)for(const _e of je.names)z.set(_e,je);const X=Object.freeze(B.filter(je=>je.key!=="w")),Q=/^(\d+(?:\.\d+)?)\s*([a-z]+)\s*(?:,\s*)?/,H=/^\d+(?:\.\d+)?$/,L=/^(\d+):([0-5]?\d)(?::([0-5]?\d))?(?:\.(\d{1,3}))?$/;function Z(je){const _e=je&&je.defaultUnit?z.get(String(je.defaultUnit).toLowerCase()):null;return _e?_e.ms:y}function ee(je){return(je&&je.defaultUnit?z.get(String(je.defaultUnit).toLowerCase()):null)||z.get("m")}function te(je,_e){if(M(je))return null;let Pe=String(je).trim().toLowerCase();if(Pe==="")return null;let Se=1;if(Pe[0]==="-"?(Se=-1,Pe=Pe.slice(1).trim()):Pe[0]==="+"&&(Pe=Pe.slice(1).trim()),Pe==="")return null;const Fe=L.exec(Pe);if(Fe){const Qe=Fe[3]!==void 0,lt=Number(Fe[1])*l+Number(Fe[2])*y+(Qe?Number(Fe[3])*k:0)+(Fe[4]?Number(Fe[4].padEnd(3,"0")):0);return Se*lt}if(H.test(Pe))return Math.round(Se*Number(Pe)*Z(_e||S));let We=Pe,He=0,Ye=0;for(;We!=="";){const Qe=Q.exec(We);if(!Qe)return null;const lt=z.get(Qe[2]);if(!lt)return null;He+=Number(Qe[1])*lt.ms,We=We.slice(Qe[0].length),Ye++}return Ye===0?null:Math.round(Se*He)}function se(je){return M(je)||je===""?null:typeof je=="number"?Number.isFinite(je)?je:null:te(je)}const ne=new Map;function ae(je,_e,Pe){const Se=`${Pe||""}|${_e.intl}`;let Fe=ne.get(Se);if(Fe===void 0){try{Fe=new Intl.NumberFormat(Pe||void 0,{style:"unit",unit:_e.intl,unitDisplay:"long"})}catch{Fe=null}ne.set(Se,Fe)}return Fe?Fe.format(je):`${je} ${je===1?_e.long[0]:_e.long[1]}`}function de(je,_e){return String(je).padStart(_e,"0")}function le(je,_e){const Pe=_e||S;if(je==null||typeof je!="number"||!Number.isFinite(je))return Pe.nullDisplay??"";const Se=Pe.style||"short",Fe=je<0;let We=Math.round(Math.abs(je));const He=Fe?"-":"";if(We===0&&Pe.zeroDisplay!=null)return Pe.zeroDisplay;if(Se==="clock"){const ot=Math.floor(We/l),yt=Math.floor(We/y)%60,Ct=Math.floor(We/k)%60;return`${He}${de(ot,2)}:${de(yt,2)}:${de(Ct,2)}`}if(We===0){const ot=ee(Pe);return Se==="long"?ae(0,ot,Pe.locale):`0${ot.key}`}const Ye=Pe.weeks===!0?B:X,Qe=typeof Pe.maxUnits=="number"&&Pe.maxUnits>0?Pe.maxUnits:Pe.maxUnits===void 0?2:1/0,lt=[];for(const ot of Ye){if(lt.length>=Qe)break;const yt=Math.floor(We/ot.ms);yt!==0&&(We-=yt*ot.ms,lt.push(Se==="long"?ae(yt,ot,Pe.locale):`${yt}${ot.key}`))}return He+lt.join(" ")}function be(je){if(typeof je!="string")return!1;const _e=je.trim();return _e===""||L.test(_e)||!/[a-z]/i.test(_e)?!1:te(_e)!==null}const Ce=Date.UTC(1899,11,30),Ne=new Map;function he(je,_e){const Pe=je||"";let Se=Ne.get(Pe);Se||(Se=new Intl.DateTimeFormat("en-GB",{timeZone:je||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),Ne.set(Pe,Se));const Fe=typeof _e=="number"?_e:Date.now();for(const We of Se.formatToParts(new Date(Fe)))if(We.type==="timeZoneName")return We.value;return""}function ie(je){if(je)return je;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function ue(je,_e){const Pe=ie(je),Se=he(je,_e);return Se?`${Pe} (${Se})`:Pe}function ge(je,_e){if(je&&je.timeZone)return je.timeZone;const Pe=_e&&_e.grid;return(Pe&&G(Pe.get)?Pe.get("timeZone"):void 0)||void 0}function pe(je,_e){const Pe=_e||S,Se=E(je);if(Se==null)return Pe.nullDisplay??"";const Fe=N(Pe)(Se);if(!Pe.showOrigin)return Fe;const We=Pe.originZone;return We?We===(Pe.timeZone||ie(Pe.timeZone))?Fe:`${Fe} (${ue(We,Se)})`:`${Fe} (no origin recorded)`}function Oe(je,_e,Pe,Se){if(_e==="instant"||!_e)return je;const Fe=A(je,Pe);if(_e==="month")return V({year:Fe.year,month:Fe.month,day:1},Pe);if(_e==="week"){const We=Se>=1&&Se<=7?Se:1,Ye=((new Date(Date.UTC(Fe.year,Fe.month-1,Fe.day)).getUTCDay()+6)%7+1-We+7)%7,Qe=new Date(Date.UTC(Fe.year,Fe.month-1,Fe.day-Ye));return V({year:Qe.getUTCFullYear(),month:Qe.getUTCMonth()+1,day:Qe.getUTCDate()},Pe)}return V({year:Fe.year,month:Fe.month,day:Fe.day},Pe)}function ve(je,_e){const Pe=je&&je.group,Se=Pe&&Pe.granularity||"day";if(Se==="instant")return null;const Fe=Pe&&Pe.weekStart;return We=>typeof We=="number"?Oe(We,Se,_e,Fe):We}const ye={time:{base:"number",storage:"float64",matches:a,format:je=>b(d(je.value),o(je,"time")),parse:je=>s(je.text),compare:(je,_e)=>f(d(je),d(_e)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:je=>{const _e=d(je);return _e===null?null:_e/R},toStorage:je=>d(je),toClipboard:h,fromClipboard:s},datetime:{base:"dateString",storage:"dictionary",matches:C,format:je=>T(je.value,o(je,"datetime")),parse:je=>I(j(je.text,o(je,"datetime"))??je.text),compare:K,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(je,_e)=>I(je,_e&&_e.timeZone),toClipboard:je=>M(je)?"":String(je),fromClipboard:je=>I(je)},duration:{base:"number",storage:"float64",matches:be,format:je=>le(se(je.value),o(je,"duration")),parse:je=>te(je.text,o(je,"duration")),compare:(je,_e)=>f(se(je),se(_e)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:je=>{const _e=se(je);return _e===null?null:_e/R},toStorage:je=>se(je),toClipboard:je=>le(se(je),{style:"short",maxUnits:-1}),fromClipboard:je=>te(je)},timestamp:{base:"number",storage:"float64",format:je=>{const _e=o(je,"timestamp");return pe(je.value,{..._e,timeZone:ge(_e,je)})},parse:je=>{const _e=o(je,"timestamp"),Pe=j(je.text,{timeZone:ge(_e,je)});return Pe?Pe.getTime():null},compare:(je,_e)=>f(E(je),E(_e)),groupProjector:(je,_e)=>ve(je,_e),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(je,_e)=>{const Pe=E(je);if(Pe==null)return null;const Se=A(Pe,_e&&_e.timeZone||void 0);return(Date.UTC(Se.year,Se.month-1,Se.day,Se.hour,Se.minute,Se.second)-Ce)/R},toStorage:je=>E(je),toClipboard:je=>{const _e=E(je);return _e==null?"":new Date(_e).toISOString()},fromClipboard:je=>E(je)}},Ae=["datetime","time","duration"],Me=ye}),Be("packages/core/src/internal/lru.js",function(e,D){"use strict";Object.defineProperty(e,"Lru",{enumerable:!0,get:function(){return re}});class re{#e;#t=new Map;#n;constructor(G=256,F=null){this.#e=G,this.#n=F}get size(){return this.#t.size}get max(){return this.#e}set max(G){this.#e=G,this.#r()}has(G){return this.#t.has(G)}get(G){const F=this.#t;if(!F.has(G))return;const x=F.get(G);return F.delete(G),F.set(G,x),x}peek(G){return this.#t.get(G)}set(G,F){const x=this.#t;return x.has(G)&&x.delete(G),x.set(G,F),this.#r(),F}delete(G){const F=this.#t.get(G);return this.#t.delete(G)&&this.#n&&this.#n(F,G),F}clear(){if(this.#n)for(const[G,F]of this.#t)this.#n(F,G);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const G=this.#t;for(;G.size>this.#e;){const F=G.keys().next().value,x=G.get(F);G.delete(F),this.#n&&this.#n(x,F)}}}}),Be("packages/core/src/columns/types/network.js",function(e,D){"use strict";Object.defineProperty(e,"toUint32",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"compareIpv4",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"packCidr",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"cidrParts",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isCidr",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"compareCidr",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"netmask",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"addressCount",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ipv6Groups",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return E}});const M=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/lru.js").Lru,x=4294967295,q=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function W(O){if(M(O))return null;if(typeof O=="string")return I(O);const N=Number(O);return Number.isFinite(N)?N<0?N<-2147483648?null:N>>>0:N>x?null:Math.trunc(N)>>>0:null}function I(O){if(M(O))return null;const N=String(O).trim();if(N==="")return null;const T=q.exec(N);if(!T)return null;let C=0;for(let B=1;B<=4;B++){const z=T[B];if(z.length>1&&z.charCodeAt(0)===48)return null;const X=Number(z);if(X>255)return null;C=C*256+X}return C}function K(O){const N=W(O);return N===null?"":`${N>>>24&255}.${N>>>16&255}.${N>>>8&255}.${N&255}`}function R(O){return typeof O=="string"&&I(O)!==null}function S(O,N){const T=W(O),C=W(N);return T===null?C===null?0:1:C===null||T<C?-1:T>C?1:0}const k=64,y=x*k+32,l=/^(?:0|[1-9]\d?)$/;function g(O,N){return O*k+N}function i(O){if(M(O))return null;if(typeof O=="string"){const C=t(O);return C===null?null:i(C)}if(typeof O=="object"){const C=W(O.address),B=Number(O.prefix);return C===null||!Number.isInteger(B)||B<0||B>32?null:{address:C,prefix:B}}const N=Number(O);if(!Number.isInteger(N)||N<0||N>y)return null;const T=N%k;return T>32?null:{address:(N-T)/k,prefix:T}}function t(O){if(M(O))return null;const N=String(O).trim();if(N==="")return null;const T=N.indexOf("/");if(T<0)return null;const C=I(N.slice(0,T));if(C===null)return null;const B=N.slice(T+1).trim();if(!l.test(B))return null;const z=Number(B);return z>32?null:g(C,z)}function o(O){const N=i(O);return N?`${K(N.address)}/${N.prefix}`:""}function c(O){return typeof O=="string"&&t(O)!==null}function f(O,N){const T=i(O),C=i(N);return T?C?T.address!==C.address?T.address<C.address?-1:1:T.prefix-C.prefix:-1:C?1:0}function n(O){return O===0?0:4294967295<<32-O>>>0}function m(O){const N=i(O);return N?(N.address&n(N.prefix))>>>0:null}function r(O){const N=i(O);return N?(N.address&n(N.prefix)|~n(N.prefix)>>>0)>>>0:null}function s(O){const N=i(O);return N?2**(32-N.prefix):null}function d(O){const N=i(O);return N?N.prefix===32?1:N.prefix===31?2:2**(32-N.prefix)-2:null}function p(O,N){const T=i(O);if(!T)return!1;const C=W(N);if(C===null)return!1;const B=n(T.prefix);return(C&B)>>>0===(T.address&B)>>>0}function u(O,N){const T=m(O),C=m(N);return T===null||C===null?!1:T<=r(N)&&C<=r(O)}const b=/^[0-9a-fA-F]{1,4}$/,a=new F(512);function h(O){if(M(O))return null;let N=String(O).trim();if(N==="")return null;const T=N.indexOf("%");if(T>=0&&(N=N.slice(0,T)),N==="")return null;if(N.indexOf(".")>=0){const H=N.lastIndexOf(":");if(H<0)return null;const L=I(N.slice(H+1));if(L===null)return null;N=`${N.slice(0,H+1)}${(L>>>16&65535).toString(16)}:${(L&65535).toString(16)}`}const C=N.split("::");if(C.length>2)return null;const B=w(C[0]);if(B===null)return null;if(C.length===1)return B.length===8?B:null;const z=w(C[1]);if(z===null)return null;const X=8-B.length-z.length;if(X<1)return null;const Q=B.slice();for(let H=0;H<X;H++)Q.push(0);for(const H of z)Q.push(H);return Q}function w(O){if(O==="")return[];const N=[];for(const T of O.split(":")){if(!b.test(T))return null;N.push(parseInt(T,16))}return N}function v(O){if(typeof O!="string")return h(O);if(a.has(O))return a.get(O);const N=h(O);return a.set(O,N),N}function A(O){if(O[0]===0&&O[1]===0&&O[2]===0&&O[3]===0&&O[4]===0&&O[5]===65535)return`::ffff:${K((O[6]<<16|O[7])>>>0)}`;let N=-1,T=0,C=-1,B=0;for(let Q=0;Q<8;Q++)O[Q]===0?(C<0?(C=Q,B=1):B++,B>T&&(T=B,N=C)):(C=-1,B=0);if(T<2)return O.map(Q=>Q.toString(16)).join(":");const z=O.slice(0,N).map(Q=>Q.toString(16)).join(":"),X=O.slice(N+T).map(Q=>Q.toString(16)).join(":");return`${z}::${X}`}function _(O){const N=h(O);return N===null?null:A(N)}function V(O){return _(O)??""}function Y(O){return typeof O=="string"&&O.indexOf(":")>=0&&h(O)!==null}function $(O,N){const T=v(O),C=v(N);if(!T)return C?1:0;if(!C)return-1;for(let B=0;B<8;B++)if(T[B]!==C[B])return T[B]<C[B]?-1:1;return 0}const j=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:R,parse:O=>I(O.text),compare:S,format:O=>K(O.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:O=>W(O),toClipboard:O=>K(O),fromClipboard:O=>I(O)},cidr:{base:"number",storage:"float64",matches:c,parse:O=>t(O.text),compare:f,format:O=>o(O.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:O=>{const N=i(O);return N===null?null:g(N.address,N.prefix)},toClipboard:O=>o(O),fromClipboard:O=>t(O)},ipv6:{base:"text",storage:"dictionary",matches:Y,parse:O=>_(O.text),compare:$,format:O=>V(O.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:O=>_(O),toClipboard:O=>V(O),fromClipboard:O=>_(O)}}),E=j}),Be("packages/core/src/i18n/catalogue.js",function(e,D){"use strict";Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return x}});const re=D("packages/core/src/registry/free-tier-notice.js"),M=re.FREE_TIER_NOTICE,G=re.WATERMARK_TEXT,F=Object.freeze({"count.rows":{one:"{count} row",other:"{count} rows"},"count.comments":{one:"{count} comment",other:"{count} comments"},"comments.someUnresolved":"{comments}, {unresolved} unresolved","comments.allResolved":"{comments}, all resolved","count.unresolvedComments":{one:"{count} unresolved comment",other:"{count} unresolved comments"},"count.items":{one:"{count} item",other:"{count} items"},"count.keys":{one:"{count} key",other:"{count} keys"},"count.values":{one:"value",other:"values"},"count.waiting":{one:"{count} waiting",other:"{count} waiting"},"count.rowsAdded":{one:"{count} row added",other:"{count} rows added"},"count.rowsRemoved":{one:"{count} row removed",other:"{count} rows removed"},"value.empty":"empty","a11y.sort.cleared":"Sort cleared","a11y.sort.by":"Sorted by {columns}","a11y.sort.column":"{column} {direction}","a11y.sort.ascending":"ascending","a11y.sort.descending":"descending","a11y.filter.cleared":"Filter cleared, {rows}","a11y.filter.applied":"Filtered to {shown} of {total}","a11y.find.count":{one:"{current} of {count} match",other:"{current} of {count} matches"},"a11y.find.countLoaded":{one:"{current} of {count} match in loaded rows",other:"{current} of {count} matches in loaded rows"},"a11y.find.none":"No matches","a11y.find.noneLoaded":"No matches in loaded rows","a11y.selection.cleared":"Selection cleared","a11y.selection.count":{one:"{count} row selected",other:"{count} rows selected"},"tabs.tablist":"Tabs","a11y.tabs.selected":"{label} tab selected","a11y.scrollbar.horizontal":"Horizontal scrollbar","a11y.scrollbar.vertical":"Vertical scrollbar","designer.canvas":"Dashboard canvas","designer.chrome":"Designer tools","designer.page":"Page {n}","a11y.designer.edit":"Edit mode","a11y.designer.view":"View mode","layout.region":"Dashboard layout","layout.move":"Move {title}","layout.resize":"Resize {title}","layout.close":"Close {title}","a11y.layout.grabbed":"{title} grabbed, column {x} of {columns}, row {y}","a11y.layout.position":"{title}, column {x} of {columns}, row {y}","a11y.layout.dropped":"{title} dropped, column {x} of {columns}, row {y}","a11y.layout.cancelled":"{title} move cancelled","a11y.layout.resizeCancelled":"{title} resize cancelled","a11y.layout.reverted":"{title} returned to column {x}, row {y}","a11y.layout.resizeGrabbed":"{title} resize grabbed, {w} by {h} cells","a11y.layout.resizeStep":"{title}, {w} by {h} cells","a11y.layout.resized":"{title} resized to {w} by {h} cells","a11y.layout.closed":"{title} closed","layout.maximise":"Maximise {title}","layout.minimise":"Minimise {title}","layout.restore":"Restore {title}","a11y.layout.maximised":"{title} maximised, filling the dashboard; press Escape to restore it","a11y.layout.minimised":"{title} minimised","a11y.layout.restored":"{title} restored to column {x}, row {y}","a11y.group.cleared":"Grouping cleared","a11y.group.by":"Grouped by {columns}","a11y.group.expanded":"{label} expanded, {rows} shown","a11y.group.collapsed":"{label} collapsed, {rows} shown","a11y.page.position":"Page {page} of {pages}","a11y.updates.paused":"Updates paused","a11y.updates.resumed":"Updates resumed","a11y.edit.refusedOne":"Edit to {column} was refused and put back to {value}{reason}","a11y.edit.refusedMany":{one:"{count} edit was refused and put back{reason}",other:"{count} edits were refused and put back{reason}"},"a11y.edit.reason":", {reason}","a11y.history.undo":"Undid {label}","a11y.history.redo":"Redid {label}","a11y.history.undoLast":"Undid the last change","a11y.history.redoLast":"Redid the last change","a11y.column.cannotResize":"{column} cannot be resized","a11y.column.resized":"{column} is {width} pixels wide","a11y.column.atMinimum":"{column} is at its narrowest, {width} pixels","a11y.column.atMaximum":"{column} is at its widest, {width} pixels","a11y.column.cannotMove":"{column} cannot be moved","a11y.column.alreadyFirst":"{column} is already first in its group","a11y.column.alreadyLast":"{column} is already last in its group","a11y.column.cannotMoveThere":"{column} cannot be moved there","a11y.column.moved":"{column} moved to position {at} of {of}","a11y.group.formed":"{column} grouped with {other} in a new band","a11y.group.dissolved":"band {group} dissolved","a11y.group.renamed":"band renamed to {group}","a11y.group.moved":"band {group} moved to position {at} of {of}","a11y.column.addedToGroup":"{column} added to band {group}","a11y.column.removedFromGroup":"{column} removed from its band","a11y.column.notInGroup":"{column} is not in a band","a11y.column.cannotGroup":"{column} cannot be grouped","a11y.group.cannotMove":"band {group} cannot be moved there","columngroup.newGroup":"New group","columngroup.rename":"Rename band","columngroup.dissolve":"Dissolve band","columngroup.group":"Group with adjacent column","columngroup.untitled":"Untitled band","panel.bandCollapse":"Collapse band {band}","panel.bandExpand":"Expand band {band}","panel.bandVisible":"Show or hide every column in band {band}","panel.bandRenameFor":"Rename band {band}","panel.bandDissolveFor":"Dissolve band {band}","header.filter":"Filter {column}","header.menu":"Column menu for {column}","header.toggleGroup":"Toggle {group}","header.dragHint":"Drag {column} to reorder, or onto another column to group","header.dragRole":"draggable column header","header.group":"group","header.selectAllRows":"Select all rows","header.clearSelection":"Clear selection","cell.selectRow":"Select row","cell.detail.show":"Show detail","cell.detail.hide":"Hide detail","cell.detail.showInPane":"Show in the detail pane","cell.detail.showingInPane":"Showing in the detail pane","cell.group.expand":"Expand","cell.group.collapse":"Collapse","cell.delta.up":"up","cell.delta.down":"down","cell.delta.unchanged":"unchanged","cell.delta.moved":"{direction} {magnitude}","cell.delta.describedUnchanged":"{label}, unchanged","cell.delta.described":"{label}, {direction} by {magnitude}","cell.qr.of":"QR code for {text}","cell.qr.empty":"No QR code","cell.barcode.of":"Barcode for {text}","cell.barcode.empty":"No barcode","cell.barcode.invalid":"Invalid value for this barcode","cell.rating.of":"{rating} of {max}","cell.rating.empty":"Not rated","cell.stage.of":"Stage {current} of {total}: {label}","cell.stage.empty":"No stage","a11y.panel.cannotMove":"{column} cannot be moved","a11y.panel.alreadyFirst":"{column} is already first","a11y.panel.alreadyLast":"{column} is already last","a11y.panel.moved":"{column} moved to position {at} of {of}","a11y.panel.removedFrom":"{column} removed from {list}","a11y.panel.addedTo":"{column} added to {list}","a11y.panel.cannotAddTo":"{column} cannot be added to {list}","a11y.annotate.erased":"Annotation removed","a11y.annotate.noMarks":"No annotations to erase","a11y.annotate.focusedMark":"Mark {at} of {of} selected","a11y.annotate.confirmClear":"Clear all annotations? Choose Clear or Keep.","a11y.annotate.cleared":"All annotations cleared","a11y.range.written":{one:"{count} cell updated",other:"{count} cells updated"},"a11y.range.cleared":{one:"{count} cell cleared",other:"{count} cells cleared"},"paste.preview.title":"Review paste","paste.preview.summary":{one:"{changes} cell will change, {rejected} rejected.",other:"{changes} cells will change, {rejected} rejected."},"paste.preview.changesHeading":{one:"{count} change",other:"{count} changes"},"paste.preview.rejectedHeading":{one:"{count} rejected",other:"{count} rejected"},"paste.preview.colOld":"Current","paste.preview.colNew":"New","paste.preview.colCell":"Cell","paste.preview.colReason":"Reason","paste.preview.empty":"This paste would change nothing.","paste.preview.confirm":"Apply","paste.preview.cancel":"Cancel","paste.preview.reason.permission":"Not permitted","paste.preview.reason.readOnly":"Read-only","paste.preview.reason.validation":"Invalid value","paste.preview.reason.locked":"Being edited","paste.preview.reason.missing":"No such cell","a11y.paste.previewOpened":{one:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel.",other:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel."},"a11y.paste.cancelled":"Paste cancelled; nothing changed","status.total":"{rows}","status.counting":"Counting rows…","status.shownOfTotal":"{shown} of {total}","status.selected":"{count} selected","status.selectedAcrossSource":"{count} selected across the source","status.selectedAcrossSourceCounting":"All matching rows selected, counting…","status.count":"Count {count}","status.loading":"Loading {count}…","status.loadingOf":"Loading {loaded} of {total} ({percent}%)","status.stat.sum":"Sum","status.stat.min":"Min","status.stat.max":"Max","status.stat.avg":"Avg","status.paused":"Paused","status.pausedWaiting":"Paused · {waiting}","status.coalesced":"{count} coalesced","status.hiddenComments":"{comments} on hidden rows","pagination.label":"Pagination","pagination.first":"First page","pagination.previous":"Previous page","pagination.next":"Next page","pagination.last":"Last page","pagination.page":"Page","pagination.ofPages":"of {pages}","pagination.summary":"{from}–{to} of {total}","pagination.pageSize":"Rows per page","pagination.range":"{from}–{to}","pagination.counting":"{from}–{to}, counting…","pagination.jump":"Page number, press Enter to jump","pagination.jumpBounded":"Page number, 1 to {pages}, press Enter to jump","panel.columns":"Columns","panel.filters":"Filters","panel.views":"Views","panel.quickFilter":"Quick filter","find.label":"Find in grid","find.placeholder":"Find in grid","find.next":"Next match","find.previous":"Previous match","find.close":"Close find","find.matchCase":"Match case","find.wholeCell":"Whole cell","find.columnScope":"Search in","find.allColumns":"All columns","find.count":"{current} of {total}","find.countPartial":"{current} of {total} so far","find.none":"No matches","find.searching":"Searching…","find.loadedRows":"in loaded rows","panel.formatting":"Formatting","panel.statistics":"Statistics","stat.noData":"No data","stat.tone.good":"good","stat.tone.bad":"bad","stat.tone.flat":"flat","panel.regression":"Regression","panel.compare":"Compare","panel.insights":"Insights","panel.compareGroups":"Compare groups","panel.explain":"Explain","insights.subset":"Filtered subset vs whole","insights.dataset":"This grid vs another dataset","insights.groups":"Group comparison","insights.noFilter":"Filter the grid to compare the subset against the whole.","insights.by":"Group by","insights.test":"Test","insights.effect":"Effect size","insights.interval":"Confidence interval","insights.pValue":"p-value","insights.smallSample":"small sample — interpret with care","insights.needGroups":"Choose two columns with groups to compare.","compareGroups.noTest":"Not enough readings, or no variation, in at least one group.","insights.empty":"No columns to analyse.","insights.anomalies":"Anomalies","insights.anomalyCount":"{count} flagged of {n}","insights.anomalyMethod":"Method","insights.anomalyThreshold":"Threshold","anomaly.chip":"{count} anomalies flagged","anomaly.chipActive":"Showing {count} anomalies — clear","compare.first":"First column","compare.second":"Second column","compare.needTwo":"Two numeric columns are needed to compare","compare.noPairs":"No rows have a value in both","compare.pairs":"{count} pairs","compare.pearson":"Correlation (Pearson)","compare.spearman":"Rank correlation (Spearman)","compare.kendall":"Kendall’s tau","compare.covariance":"Covariance","compare.slope":"Slope","compare.intercept":"Intercept","compare.r2":"R²","compare.stdError":"Standard error","compare.weighted":"Weighted average","panel.zone.group":"row groups","panel.zone.values":"values","panel.zone.pivot":"pivot columns","groupZone.label":"Row groups","groupZone.title":"Group by","groupZone.hint":"Drag a column here to group rows by its values","groupZone.chip":"{column}, group {at} of {of}","groupZone.remove":"Stop grouping by {column}","groupZone.add":"Add a group","total.sum":"Sum","total.avg":"Average","total.min":"Min","total.max":"Max","total.count":"Count","total.countValues":"Count of values","total.first":"First","total.last":"Last","total.custom":"Total","total.median":"Median","total.p25":"25th percentile","total.p75":"75th percentile","total.p90":"90th percentile","total.p95":"95th percentile","total.p99":"99th percentile","total.iqr":"Interquartile range","total.mad":"Median absolute deviation","total.variance":"Variance","total.varianceP":"Variance (population)","total.stddev":"Standard deviation","total.stddevP":"Standard deviation (population)","total.range":"Range","total.distinct":"Distinct","total.mode":"Mode","total.skewness":"Skewness","total.kurtosis":"Kurtosis","total.geomean":"Geometric mean","total.harmean":"Harmonic mean","total.sumSquares":"Sum of squares","total.weightedAvg":"Weighted average","total.argmin":"Lowest by","total.argmax":"Highest by","total.hhi":"Concentration (HHI)","total.entropy":"Entropy","total.evenness":"Evenness","total.top3Share":"Top 3 share","total.top10Share":"Top 10 share","total.gini":"Gini coefficient","total.trimmedMean":"Trimmed mean","total.winsorizedMean":"Winsorized mean","total.robustOutliers":"Outliers (robust)","total.jarqueBera":"Jarque–Bera","total.passRate":"Pass rate","total.failureCount":"Failures","stats.column":"Column","stats.choose":"Choose a column to profile","stats.noColumns":"No numeric columns to profile","stats.noValues":"Nothing numeric in this column","stats.count":"Count","stats.present":"Present","stats.missing":"Missing","stats.distinct":"Distinct","stats.min":"Minimum","stats.max":"Maximum","stats.mean":"Mean","stats.median":"Median","stats.q1":"Lower quartile","stats.q3":"Upper quartile","stats.iqr":"Interquartile range","stats.stddev":"Standard deviation","stats.outliers":"Outliers","stats.distribution":"Distribution","stats.distribution.detail":"Distribution: rows per range","stats.bin":"{count} between {from} and {to}","stats.topValues":"Top values","stats.section.shape":"Shape","stats.section.robust":"Robust","stats.section.concentration":"Concentration","stats.section.capability":"Capability","stats.cp":"Cp","stats.cpk":"Cpk","stats.pp":"Pp","stats.ppk":"Ppk","stats.outOfSpec":"Out of specification","stats.filtered":"Over the {count} filtered rows","stats.unavailable":"Not computed by the source: {stats}.","stats.unavailable.notPlain":"`{column}` is not a plain column the engine can name","stats.unavailable.where":"a `where` predicate is in force ({list}), which only the browser can run","stats.unavailable.filter":"the grid's filter did not fully push to the engine","stats.unavailable.quick":"the quick search did not push to the engine","stats.unavailable.client":'the source did not compute "{fn}" in the engine ({reason}); set the pushdown source\'s `{setting}`',"stats.unavailable.outliers":"the count of values outside Tukey's fences is not an engine aggregate","stats.unavailable.histogram":"the shape of the column is not an engine aggregate","stats.unavailable.topValues":"the source did not answer a grouped count in the engine","explain.column":"Value","explain.by":"Break down by","explain.byRow":"Each row","explain.noColumns":"No numeric columns to explain","explain.unavailable":"Nothing to explain in this column","explain.total":"{fn}: {total}","explain.weighted":"weighted effects","explain.single":"one contributor","explain.delta":"was {before}, now {after} (Δ {delta})","explain.breakdown":"Contributors","explain.contributor":"Contributor","explain.count":"Rows","explain.value":"Value","explain.contribution":"Contribution","explain.share":"Share","explain.change":"Change","explain.before":"Before","explain.after":"After","explain.effect":"Effect","explain.kind.new":"New","explain.kind.dropped":"Dropped","explain.kind.changed":"Changed","explain.narrative":"Explanation","explain.narrative.lead":"{top} accounts for {share}; the {fn} is {total}.","explain.narrative.next":"{next} follows at {share}.","explain.narrative.driver":"The change of {delta} was driven most by {top} ({effect}).","explain.narrative.driverNext":"{next} ({kind}) moved it {effect}.","explain.narrative.none":"Nothing contributed to this total.","explain.narrative.noChange":"Nothing changed between the two states.","regression.noModel":"No model configured. Set predictors and a response on the panel.","regression.cannotFit":"The model cannot be fitted over the current rows.","regression.observations":"Fitted over {count} rows","regression.r2":"R²","regression.adjR2":"Adjusted R²","regression.coefficients":"Coefficients","regression.term":"Term","regression.estimate":"Estimate ± SE","regression.stdError":"Std error","regression.t":"t","regression.p":"p","regression.vif":"Variance inflation (VIF)","regression.heteroscedasticity":"Heteroscedasticity (Breusch–Pagan)","regression.heteroscedastic":"Heteroscedastic: BP {statistic}, p {p}","regression.homoscedastic":"No heteroscedasticity detected: BP {statistic}, p {p}","menu.sortAscending":"Sort ascending","menu.sortDescending":"Sort descending","menu.clearSort":"Clear sort","menu.groupBy":"Group by this column","menu.ungroup":"Stop grouping by this column","menu.hideColumn":"Hide column","menu.pinStart":"Pin to start","menu.pinEnd":"Pin to end","menu.unpin":"Unpin","menu.autosize":"Fit to content","ai.valuesNotAmongOptions":'{values} {shown} not among the options for "{column}"',"menu.clearCells":{one:"Clear cell",other:"Clear {count} cells"},"menu.fillDown":"Fill down","menu.copy":"Copy","menu.copyWithHeaders":"Copy with headers","menu.paste":"Paste","menu.filterEllipsis":"Filter…","menu.columnStatistics":"Column statistics","menu.compareGroups":"Compare groups","menu.explain":"Explain this number","menu.pinColumn":"Pin column","menu.sizeToFit":"Size to fit content","menu.sizeAllToFit":"Size all columns to fit","menu.width":"Width","menu.narrower":"Narrower","menu.wider":"Wider","menu.moveColumn":"Move column","menu.moveLeft":"Move left","menu.moveRight":"Move right","menu.moveToStart":"Move to start","menu.moveToEnd":"Move to end","menu.unpivot":"Remove from pivot","menu.pivotBy":"Pivot by this column","menu.stopTotalling":"Stop totalling","menu.totalColumn":"Total this column","menu.aggregate":"Aggregate","menu.aggregateNone":"None","menu.aggregateGroup":"Group subtotals","menu.aggregateGrand":"Grand total","menu.aggregateSame":"Same as total","menu.redactColumn":"Redact column","menu.stopRedacting":"Stop redacting","menu.stopRedactingAll":"Stop redacting everything","menu.sortGroupsAscending":"Sort groups ascending","menu.sortGroupsDescending":"Sort groups descending","menu.filterGroups":"Filter groups…","menu.expandAll":"Expand all","menu.collapseAll":"Collapse all","menu.clearGrouping":"Clear grouping","menu.colour":"Colour","menu.importCsv":"Import rows from CSV…","import.title":"Import rows","import.clipboard":"the clipboard","import.summary":{one:"{count} row from {name}",other:"{count} rows from {name}"},"import.opened":{one:"Import preview open, {count} row",other:"Import preview open, {count} rows"},"import.done":{one:"{count} row imported",other:"{count} rows imported"},"import.confirm":"Import","import.cancel":"Cancel","import.colSource":"Column","import.colField":"Maps to","import.colType":"Type","import.skip":"— skip —","import.mapLabel":'Map "{source}" to a field',"import.modeLabel":"On import","import.sheetLabel":"Sheet","import.append":"Add to existing rows","import.replace":"Replace all rows","menu.deleteRow":{one:"Delete row",other:"Delete {count} rows"},"toolbar.undo":"Undo","toolbar.redo":"Redo","toolbar.undoLabelled":"Undo {label}","toolbar.redoLabelled":"Redo {label}","toolbar.exportCsv":"Export to CSV","toolbar.exportExcel":"Export to Excel","toolbar.clipboard":"Copy visible rows to the clipboard","toolbar.print":"Print","toolbar.pause":"Hold incoming updates","toolbar.resume":"Resume updates","toolbar.applyHeld":{one:"Apply {count} held update",other:"Apply {count} held updates"},"toolbar.restoreView":"Restore the default view","toolbar.maximiseGrid":"Maximise the grid to fill the window","toolbar.restoreSize":"Restore the grid to the page (Esc)","toolbar.annotate.pen":"Draw freehand","toolbar.annotate.arrow":"Draw an arrow","toolbar.annotate.rect":"Draw a rectangle","toolbar.annotate.highlight":"Highlight","toolbar.annotate.erase":"Erase","toolbar.annotate.clearAll":"Clear all annotations","toolbar.annotate.clearAllConfirm":"Clear","toolbar.annotate.clearAllKeep":"Keep","overlay.noRows":"No rows to show","overlay.noResults":"No rows match the current filters","overlay.loading":"Loading…","overlay.error":"Something went wrong","overlay.loadingRows":"Loading rows {from} to {to}","overlay.rowError":"Failed to load","comments.panel":"Cell comments","comments.close":"Close comments","comments.write":"Write a comment","comments.post":"Comment","comments.delete":"Delete","comments.valueMoved":"Written when the value was {was}: it is now {now}.","comments.resolve":"Resolve","comments.reopen":"Reopen","comments.loading":"Loading…","comments.empty":"No comments yet.","comments.unknownAuthor":"Unknown","comments.edited":"{time} (edited)","comments.cellTitle":"{column}: {row}","presence.hidden":{one:"{count} not in view",other:"{count} not in view"},"presence.someoneElse":"someone else","a11y.presence.refused":"This cell is being edited by {name}","presence.peer":"{name}: jump to their cursor","presence.peerIdle":"{name}, idle: jump to their cursor","presence.peerHidden":"{name}, not in the current view","facets.filter":"{column} distribution filter","header.totalOf":"{total} of {column}","diff.before":"Was: {value}","diff.empty":"(empty)","kanban.columnCards":{one:"{title}, {count} card",other:"{title}, {count} cards"},"kanban.laneCards":{one:"{lane}, {title}, {count} card",other:"{lane}, {title}, {count} cards"},"kanban.blocked":"Blocked","kanban.ready":"Ready","kanban.blockedBy":{one:"blocked by {count} card",other:"blocked by {count} cards"},"kanban.card.assignedTo":"Assigned to {names}","kanban.card.overdue":"Overdue","kanban.card.dueSoon":"Due soon","kanban.card.progress":"{percent}% complete","kanban.card.checklist":"{done} of {total} done","gantt.lag":"+{days}d","gantt.lead":"{days}d","gantt.a11y.moved":"{name} moved to {date}","gantt.a11y.day":"day {day}","gantt.a11y.resized":"{name} resized to {days} days","gantt.a11y.linkFrom":"Linking from {name}. Focus the successor and press L.","gantt.a11y.linked":"Linked {from} to {to}, finish to start.","gantt.a11y.linkCancelled":"Link cancelled.","gantt.a11y.deleted":"{name} deleted.","gantt.a11y.readOnly":"Read-only.","gantt.row.moveHandle":"Drag to reorder or re-parent {name}","gantt.a11y.rowMoved":"{name} moved.","gantt.a11y.rowReparented":"{name} moved under {parent}.","gantt.a11y.rowPromoted":"{name} moved to the top level.","gantt.a11y.rowMoveCancelled":"Move cancelled.","gantt.a11y.copied":"{count} tasks copied.","gantt.a11y.cut":"{count} tasks cut.","gantt.a11y.pasted":"{count} tasks pasted.","gantt.task.newName":"New task","gantt.a11y.taskAdded":"{name} added.","gantt.menu.addAbove":"Add task above","gantt.menu.addBelow":"Add task below","gantt.menu.addChild":"Add subtask","gantt.menu.addSuccessor":"Add successor","gantt.menu.addPredecessor":"Add predecessor","gantt.menu.toMilestone":"Convert to milestone","gantt.menu.toTask":"Convert to task","gantt.menu.delete":"Delete task","gantt.a11y.linkCycle":"Linking {from} to {to} would create a cycle; link not created.","gantt.a11y.linkCreated":"{from} linked to {to}, {type}.","gantt.a11y.linkDeleted":"Link from {from} to {to} deleted.","gantt.a11y.linkLabel":"Link, {from} to {to}, {type}","gantt.linkEditor.title":"Edit link from {from} to {to}","gantt.linkEditor.type":"Link type","gantt.linkEditor.lag":"Lag, in days","gantt.linkEditor.apply":"Apply","gantt.linkEditor.delete":"Delete link","gantt.linkEditor.cancel":"Cancel","gantt.a11y.undone":"Undone.","gantt.a11y.redone":"Redone.","gantt.a11y.nothingToUndo":"Nothing to undo.","gantt.a11y.nothingToRedo":"Nothing to redo.","gantt.workload.title":"Resource workload","gantt.workload.resource":"Resource","gantt.workload.total":"Total","gantt.workload.unassigned":"Unassigned","gantt.workload.ungrouped":"No group","gantt.workload.cell":"{hours} h from {date}","gantt.workload.over":"{hours} h from {date}, over a capacity of {capacity} h","gantt.workload.expand":"Show {name}’s tasks","gantt.workload.collapse":"Hide {name}’s tasks","gantt.workload.expandGroup":"Show the {name} group","gantt.workload.collapseGroup":"Hide the {name} group","gantt.workload.unitToggle":"Hours / % / Cost","gantt.workload.unitHours":"Showing hours","gantt.workload.unitPercent":"Showing percent of capacity","gantt.workload.unitCost":"Showing cost","gantt.workload.cellPercent":"{percent}% from {date}","gantt.workload.overPercent":"{percent}% from {date}, over capacity","gantt.workload.cellNoCapacity":"No available hours from {date}","gantt.workload.cellCost":"{cost} from {date}","gantt.workload.otherProjectLabel":"{name} (other project)","gantt.workload.external":"External booking","gantt.a11y.hoursSet":"{name}: {hours} h from {date}","gantt.a11y.hoursCleared":"{name}: no hours from {date}","gantt.a11y.hoursRefused":"{date} is not a working day; {name} was not changed.","gantt.histogram.title":"Resource histogram","gantt.histogram.tableTitle":"Resource histogram data","gantt.histogram.resource":"Resource","gantt.histogram.period":"Period","gantt.histogram.hours":"Hours","gantt.histogram.percent":"Percent of capacity","gantt.histogram.cost":"Cost","gantt.histogram.capacity":"Capacity","gantt.histogram.overAllocated":"Over-allocated","gantt.histogram.yes":"Yes","gantt.histogram.no":"No","gantt.histogram.tip":"{name}, {from} to {to}: {value}{capacity}{tasks}","gantt.histogram.tipHours":"{hours} h","gantt.histogram.tipPercent":"{percent}% of capacity","gantt.histogram.tipCost":"{cost}","gantt.histogram.tipCapacity":", capacity {hours} h","gantt.histogram.tipTasks":" ({tasks})","gantt.histogram.tipOver":", over capacity","gantt.histogram.tipNoCapacity":"no available hours","gantt.picker.title":"Assign resources to {name}","gantt.picker.open":"Edit assignments for {name}","gantt.picker.search":"Search resources","gantt.picker.list":"Resources","gantt.picker.selected":"Assigned resources","gantt.picker.load":"{load}% booked of {capacity}% over these dates","gantt.picker.none":"No matching resources","gantt.picker.units":"{name}, units in percent","gantt.picker.remove":"Remove {name}","gantt.picker.apply":"Apply","gantt.picker.cancel":"Cancel","gantt.picker.warn":"{name} would be over-allocated: {load}% booked of {capacity}%","gantt.picker.ok":"No resource would be over-allocated","gantt.picker.assign":"Assign","gantt.col.effort":"Effort","gantt.col.units":"Units","gantt.unscheduled":"Unscheduled","gantt.col.unscheduled":"Unscheduled","gantt.inactive":"Inactive","gantt.col.inactive":"Inactive","gantt.col.slack":"Slack","gantt.col.deadline":"Deadline","gantt.col.constraint":"Constraint","gantt.col.constraintDate":"Constraint date","gantt.col.earlyStart":"Early start","gantt.col.lateStart":"Late start","gantt.col.lateFinish":"Late finish","gantt.col.baselineStart":"Baseline start","gantt.col.baselineEnd":"Baseline finish","gantt.col.variance":"Variance","gantt.col.note":"Note","gantt.col.sequence":"#","gantt.col.predecessors":"Predecessors","gantt.col.successors":"Successors","gantt.link.invalid":"Cannot read “{token}” as a link. Write a task number, a type and a lag, like 3FS+2; links not changed.","gantt.link.unknownRef":"No task is numbered “{token}”; links not changed.","gantt.link.self":"“{token}” links a task to itself; links not changed.","gantt.link.duplicate":"“{token}” repeats a link already listed; links not changed.","gantt.link.cycle":"“{token}” would create a cycle; links not changed.","gantt.constraint.ASAP":"As soon as possible","gantt.constraint.MSO":"Must start on","gantt.constraint.MFO":"Must finish on","gantt.constraint.ALAP":"As late as possible","gantt.constraint.SNET":"Start no earlier than","gantt.constraint.SNLT":"Start no later than","gantt.constraint.FNET":"Finish no earlier than","gantt.constraint.FNLT":"Finish no later than","gantt.row.ancestor":"Shown because a task inside it matches the filter","gantt.progress.handle":"Drag to set the progress of {name}","gantt.a11y.progress":"{name} {percent}% complete","gantt.col.name":"Task name","gantt.col.start":"Start","gantt.col.end":"Finish","gantt.col.duration":"Duration","gantt.col.assignee":"Assignee","gantt.col.progress":"%","gantt.col.wbs":"WBS","gantt.zoom.label":"Zoom","gantt.zoom.day":"Day","gantt.zoom.week":"Week","gantt.zoom.month":"Month","gantt.zoom.quarter":"Quarter","gantt.zoom.fit":"Fit to plan","gantt.tip.range":"{from} to {to}","gantt.tip.duration":"{days}d","gantt.tip.slack":"slack {days}d","gantt.tip.effort":"{hours}h","gantt.tip.row":"{label}: {value}","gantt.tip.start":"Start","gantt.tip.end":"End","gantt.tip.date":"Date","gantt.tip.durationLabel":"Duration","gantt.tip.durationValue":"{days} days","gantt.tip.complete":"Complete","gantt.tip.effortLabel":"Effort","gantt.tip.effortValue":"{hours} h","gantt.tip.assigned":"Assigned","gantt.tip.cost":"Cost","gantt.tip.slackLabel":"Slack","gantt.tip.slackValue":"{days} days","gantt.tip.deadline":"Deadline","gantt.mode.fixedDuration":"Fixed duration","gantt.mode.fixedEffort":"Fixed effort","gantt.mode.fixedUnits":"Fixed units","gantt.scurve.spi":"SPI {index}","gantt.scurve.cpi":"CPI {index}","gantt.print.page":"Page {page} of {pages}","gantt.print.printed":"Printed {date}","gantt.dataBand.title":"Data band","gantt.dataBand.name":"Task","gantt.dataBand.resource":"Resource","gantt.dataBand.total":"Total","gantt.dataBand.unassigned":"Unassigned","gantt.dataBand.collapse":"Collapse {name}","gantt.dataBand.expand":"Expand {name}","gantt.dataBand.cell":"{name}, {date}: {value}","gantt.issues.title":"Scheduling conflicts","gantt.issues.empty":"No scheduling conflicts","gantt.issues.count":"{count} scheduling conflicts","gantt.issues.toggle":"Toggle the conflicts panel","gantt.issues.cycle":"Circular dependency: {tasks}","gantt.issues.constraint":"{task} cannot meet its {constraint} constraint of {date}","gantt.issues.lock":"{task} is locked but a dependency would move it","gantt.issues.deadline":"{task} finishes after its deadline of {date}","gantt.issues.fixRemoveLink":"Remove link","gantt.issues.fixAsap":"Set as soon as possible","gantt.issues.fixUnlock":"Unlock task","gantt.issues.fixClearDeadline":"Clear deadline","gantt.resize.startHandle":"Drag to change the start of {name}","gantt.a11y.resizedStart":"{name} start moved to {date}, now {days} days","gantt.a11y.startEdge":"Start edge can be resized: drag the left edge, or press Ctrl+Shift+Left or Right.","gantt.a11y.chain":"Dependency chain highlighted: {preds} predecessors, {succs} successors.","timeline.scrub":"Scrub through recent changes","timeline.goLive":"Go live","timeline.returnToPresent":"Return to the present","a11y.fillHandle":"Drag to fill","panel.icons":"Icons","value.tooLong":"Too long","dataview.label":"Items","dataview.empty":"No items","dataview.reorder.sorted":"Items cannot be reordered while the view is sorted","dataview.reorder.filtered":"Items cannot be reordered while a filter is applied","shortcuts.title":"Keyboard shortcuts","shortcuts.close":"Close keyboard shortcuts","shortcuts.hint":"Press Escape to close.","shortcuts.or":"or","a11y.reorder.moved":"Moved to position {position} of {total}","a11y.reorder.sorted":"Rows cannot be reordered while the grid is sorted","a11y.reorder.filtered":"Rows cannot be reordered while a filter is applied","a11y.reorder.grouped":"Rows cannot be reordered while the grid is grouped","a11y.reorder.grab":"Reorder row","a11y.reorder.sortedManual":"Rows cannot be reordered while the grid is sorted. Press Alt+Shift+M, or the Manual order button in the heading, to order them by hand","a11y.reorder.groupDerived":"The row cannot join that group: the group is worked out from the value, so there is no single value to give it","a11y.reorder.groupReadOnly":"The row cannot join that group: its grouping value cannot be edited","a11y.reorder.invalid":"The row cannot join that group: the new value was not valid","a11y.reorder.vetoed":"The move was declined; the row stays where it was","a11y.reorder.vetoedBecause":"The move was declined ({reason}); the row stays where it was","a11y.reorder.refused":"The row cannot be moved there","a11y.reorder.regrouped":"Moved into {group}","a11y.tree.dropRefusedDescendant":"A row cannot be dropped into one of its own descendants; the row stays where it was","a11y.rowOrder.entered":"Manual order: the rows keep their places and can be moved by hand","a11y.rowOrder.exited":"Manual order ended; the rows follow the sort","rowOrder.button":"Manual order","rowOrder.enter":"Order the rows by hand instead of by the sort","rowOrder.exit":"Return to the sorted order","a11y.transfer.moved":"Row moved to the other grid","a11y.transfer.copied":"Row copied to the other grid","a11y.transfer.refused":"That grid does not accept this row","a11y.transfer.declined":"The drop was declined; the row stays where it was","a11y.transfer.stale":"The drop target changed while it was being confirmed; the row stays where it was","shortcuts.group.grid":"In the data","shortcuts.group.header":"On a column heading","shortcuts.group.panel":"In the column list","shortcut.moveCell":"Move the focused cell","shortcut.rowEnds":"First / last cell of the row","shortcut.gridEnds":"First cell of the first row / last cell of the last row","shortcut.pageRows":"Move one viewport of rows","shortcut.nextCell":"Leave the grid for the next / previous focusable element (arrows move between cells)","shortcut.undo":"Undo the last edit, paste, fill or clear","shortcut.redo":"Redo the step that was undone","shortcut.startEdit":"Start editing the focused cell","shortcut.toggleRow":"Toggle selection of the focused row","shortcut.cancel":"Cancel the current edit or drag","shortcut.expandCollapse":"Expand / collapse a group or tree row","shortcut.focusHeader":"Move focus to the column header","shortcut.focusPanel":"Move focus to the tool panel","shortcut.explain":"Explain the focused column","shortcut.contextMenu":"Open the context menu for the focused cell","shortcut.moveRow":"Move the focused row, when row reorder is enabled","shortcut.manualOrder":"Order the rows by hand, or return to the sort, when row reorder allows a manual order","shortcut.headingMove":"Move between headings","shortcut.headingEnds":"First / last heading","shortcut.headingSort":"Sort by the column, Shift to add to the sort","shortcut.headingResize":"Resize the column, Ctrl for a coarse step","shortcut.headingAutosize":"Size the column to its content","shortcut.headingReorder":"Move the column","shortcut.headingMenu":"Open the column menu","shortcut.headingExit":"Return focus to the data","shortcut.listGroup":"Group by the column, or stop grouping by it","shortcut.listValues":"Add the column to values, or take it out","shortcut.listPivot":"Pivot by the column, or stop pivoting by it","shortcut.listMove":"Move the column","shortcut.find":"Find in the grid","tags.label":"Show columns","tags.all":"All columns","tags.showing":"Showing {tag}","form.title":"Edit row","form.save":"Save","form.cancel":"Cancel","form.loading":"Loading…","form.loadFailed":"Could not load this record.","form.loadTimeout":"The record did not arrive in time.","form.retry":"Try again","form.choose":"Choose…","form.newTitle":"New row","form.createFailed":"Could not add this record.","form.grid.cellInvalid":"Row {row}, {column}: {message}","form.grid.required":"Add at least one row.","form.grid.addRow":"Add row","form.grid.deleteRow":"Delete row","form.grid.total":"Total","form.grid.rowControls":"Row controls","presentation.cards":"Showing records as cards","presentation.table":"Showing records as a table","editor.format":"Format","editor.codeHint":"Tab indents · Esc cancels · Ctrl+Enter saves","editor.colours":"Colours","editor.customColour":"Custom colour","editor.hexValue":"Hex value","editor.hexPlaceholder":"#rrggbb","editor.clearColour":"Clear colour","editor.time":"Time","editor.noIcon":"No icon","editor.selectAll":"Select all","editor.passwordHint":"Enter the value twice to save it.","editor.clearRating":"Clear rating","editor.clear":"Clear","editor.value":"Value","editor.currency":"Currency","editor.richtext.formatting":"Formatting","editor.richtext.richText":"Rich text","editor.richtext.placeholder":"Start writing…","editor.richtext.linkLabel":"Link address","editor.richtext.linkPlaceholder":"https://","editor.richtext.linkAdd":"Add link","editor.richtext.bold":"Bold (Ctrl+B)","editor.richtext.italic":"Italic (Ctrl+I)","editor.richtext.underline":"Underline (Ctrl+U)","editor.richtext.strike":"Strikethrough","editor.richtext.heading":"Paragraph style","editor.richtext.alignLeft":"Align left","editor.richtext.alignCenter":"Align centre","editor.richtext.alignRight":"Align right","editor.richtext.ul":"Bulleted list","editor.richtext.ol":"Numbered list","editor.richtext.color":"Text colour","editor.richtext.link":"Link (Ctrl+K)","editor.richtext.image":"Insert image","editor.richtext.clear":"Clear formatting","editor.richtext.source":"HTML source","editor.richtext.undo":"Undo (Ctrl+Z)","editor.richtext.redo":"Redo (Ctrl+Y)","formatting.format":"Format","formatting.noRules":"No rules yet. The first one that matches a cell wins.","formatting.clearAll":"Clear all","formatting.addRule":"Add rule","formatting.condition":"Condition","formatting.value":"Value","formatting.secondValue":"Second value","formatting.moveEarlier":"Move earlier","formatting.moveLater":"Move later","formatting.ruleKind":"Rule type","formatting.aCondition":"A condition","formatting.aColourScale":"A colour scale","formatting.compare":"Compare a value","formatting.distribution":"By the distribution","formatting.colourScale":"Colour scale","formatting.scaleBounds":"Scale bounds","formatting.preview":"Preview","formatting.livePreview":"Live preview","history.title":"History","history.show":"Show history","history.empty":"Nothing to undo yet.","prompt.ask":"Ask","prompt.apply":"Apply","prompt.discard":"Discard","panel.searchColumns":"Search columns","panel.searchColumnsPlaceholder":"Search columns…","panel.searchColumnsToFilter":"Search columns to filter","panel.showAll":"Show all","panel.hideAll":"Hide all","panel.clearAll":"Clear all","panel.clear":"Clear","panel.filterAllColumns":"Filter all columns","panel.columnFiltered":"This column is filtered","panel.clearFilterOn":"Clear the filter on {column}","panel.clearFilter":"Clear this filter","panel.filterEmptyNoMatch":"No column matches “{query}”.","panel.filterEmptyNone":"No column on this grid can be filtered.","panel.filterSummaryActive":"{active} of {total} columns filtered","panel.filterSummaryNone":"No filters · {total} columns available","panel.filterBy":"Filter by {column}","panel.filteredBy":"Filtered by {column}","panel.columnDragHint":"Drag {column} into a zone above, or onto another column to reorder","panel.gridActions":"Grid actions","panel.tabActiveCount":{one:"{title}, {count} active",other:"{title}, {count} active"},"panel.tabActive":"{title}, active","views.default":"Default","views.namePlaceholder":"Name this view…","views.nameLabel":"Name for the current layout","views.save":"Save view","licence.watermark":G,"licence.watermark.free":M,"filter.op.contains":"Contains","filter.op.notContains":"Does not contain","filter.op.equals":"Equals","filter.op.notEqual":"Does not equal","filter.op.startsWith":"Starts with","filter.op.endsWith":"Ends with","filter.op.blank":"Is blank","filter.op.notBlank":"Is not blank","filter.op.lessThan":"Less than","filter.op.lessThanOrEqual":"Less than or equal","filter.op.greaterThan":"Greater than","filter.op.greaterThanOrEqual":"Greater than or equal","filter.op.inRange":"In range","filter.op.matches":"Matches","filter.op.before":"Before","filter.op.after":"After","filter.op.relative":"Relative to today","filter.rel.today":"Today","filter.rel.yesterday":"Yesterday","filter.rel.tomorrow":"Tomorrow","filter.rel.lastNDays":"Last N days","filter.rel.nextNDays":"Next N days","filter.rel.thisWeek":"This week","filter.rel.lastWeek":"Last week","filter.rel.thisMonth":"This month","filter.rel.lastMonth":"Last month","filter.rel.thisQuarter":"This quarter","filter.rel.quarterToDate":"Quarter to date","filter.rel.thisYear":"This year","filter.rel.yearToDate":"Year to date","filter.operator":"Operator","filter.join":"Join","filter.value":"Value","filter.from":"From","filter.to":"To","filter.addCondition":"Add condition","filter.noConditions":"No conditions","filter.removeCondition":"Remove condition","filter.search":"Search","filter.searchValues":"Search values","filter.noMatches":"No values match","filter.selectAll":"Select all","filter.clear":"Clear","filter.all":"All","filter.allExcept":"All but {count}","filter.loadingValues":"Loading values…","filter.topValues":"Top {shown} of {total} values","filter.valuesFailed":"Values could not be loaded: {error}","filter.valuesUnsupported":"This source cannot list the values of {column}; filter by condition instead.","filter.true":"True","filter.false":"False","filter.expression":"Filter expression","filter.column":"Column","filter.relativePeriod":"Relative period","filter.days":"Number of days","filter.tab.set":"Values","filter.tab.text":"Text","filter.tab.number":"Number","filter.tab.date":"Date","filter.tab.advanced":"Advanced","filterRow.label":"Filter row","filterRow.conditions":{one:"{count} condition",other:"{count} conditions"},"chart.empty":"Nothing to chart","chart.summary":"{type} chart of {measure} by {dimension}","chart.summaryShare":"{type} chart of {measure}","chart.summaryType":"{type} chart","chart.summaryGauge":"{type} chart of {measure}, {fn}: {value}","chart.waterfallTotal":"Total","chart.summaryEngine":"Figures computed by the data engine over every matching row","chart.summaryEngineViewport":"{count} points in this view, fetched from the data engine","chart.summaryEngineDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells counted by the data engine","chart.summaryClientDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells computed in the browser","chart.viewportOverCap":"{count} rows in this view, more than the {cap} this map draws; zoom in or narrow the filter","chart.dataTable":"Chart data","chart.viewportFilter.label":"Map view","chart.annotate.rail":"Drawing tools","chart.annotate.select":"Select and move a drawing","chart.annotate.trendLine":"Trend line","chart.annotate.horizontalLine":"Horizontal line","chart.annotate.verticalLine":"Vertical line","chart.annotate.channel":"Parallel channel","chart.annotate.fibonacci":"Fibonacci retracement","chart.annotate.arrow":"Arrow","chart.annotate.pen":"Freehand pen","chart.annotate.pen.described":"Freehand drawing from {from} to {to}","chart.annotate.measure-x":"Date range","chart.annotate.measure-y":"Price range","chart.annotate.measure-xy":"Date and price range","chart.annotate.measure.bars":{one:"{count} bar",other:"{count} bars"},"chart.annotate.measure.points":{one:"{count} point",other:"{count} points"},"chart.annotate.measure.volume":"Vol {value}","chart.annotate.measure.seconds":"{count}s","chart.annotate.measure.minutes":"{count}m","chart.annotate.measure.hours":"{count}h","chart.annotate.measure.days":"{count}d","chart.annotate.measure.weeks":"{count}w","chart.annotate.measure.months":"{count}mo","chart.annotate.measure.years":"{count}y","chart.annotate.measure":"Measure","chart.annotate.measure.dx":"Δx {value}","chart.annotate.measure.dy":"Δy {value}","chart.annotate.measure.pct":"{value}%","chart.annotate.measure.categories":{one:"{count} category",other:"{count} categories"},"chart.annotate.measure.slope.perDay":"Slope {value} per day","chart.annotate.measure.slope.perCategory":"Slope {value} per category","chart.annotate.measure.slope.perUnit":"Slope {value} per unit","chart.annotate.measure.dur.d":"{count} d","chart.annotate.measure.dur.h":"{count} h","chart.annotate.measure.dur.min":"{count} min","chart.annotate.measure.dur.s":"{count} s","chart.annotate.measure.dur.ms":"{count} ms","chart.annotate.measure.announce":"Measurement: {readout}","chart.annotate.measure.start":"Measure start: {x}, {y}","chart.annotate.text":"Text","chart.annotate.callout":"Callout","chart.annotate.note":"Note","chart.annotate.delete":"Delete the selected drawing","chart.annotate.editLabel":"Annotation text","chart.zoom.toolbar":"Zoom controls","chart.zoom.in":"Zoom in","chart.zoom.out":"Zoom out","chart.zoom.left":"Pan left","chart.zoom.right":"Pan right","chart.zoom.reset":"Reset the zoom","chart.legendMore":{one:"+{count} more",other:"+{count} more"},"chart.type.line":"Line","chart.type.area":"Area","chart.type.bar":"Bar","chart.type.pie":"Pie","chart.type.donut":"Donut","chart.type.sunburst":"Sunburst","chart.type.scatter":"Scatter","chart.type.step":"Step","chart.type.rangeArea":"Range","chart.type.horizontalBar":"Horizontal bar","chart.type.waterfall":"Waterfall","chart.type.floatingBar":"Floating bar","chart.type.horizontalFloatingBar":"Horizontal floating bar","chart.type.populationPyramid":"Population pyramid","chart.type.bullet":"Bullet","chart.type.bubble":"Bubble","chart.type.histogram":"Histogram","chart.type.boxplot":"Box plot","chart.type.forest":"Forest plot","chart.type.qq":"QQ plot","chart.type.ecdf":"ECDF","chart.type.lorenz":"Lorenz","chart.type.correlogram":"Correlogram","chart.type.control":"Control","chart.type.capability":"Capability","chart.type.movingRange":"Moving range","chart.type.treemap":"Treemap","chart.type.combo":"Combination","chart.type.pareto":"Pareto","chart.type.heatmap":"Heat map","chart.type.radar":"Radar","chart.type.gauge":"Gauge","chart.type.funnel":"Funnel","chart.type.candlestick":"Candlestick","chart.type.ohlc":"OHLC","chart.type.polarArea":"Polar area","chart.type.nightingale":"Nightingale rose","chart.type.rose":"Rose","chart.type.radialBar":"Radial bar","chart.type.polarScatter":"Polar scatter","chart.type.geomap":"Map","chart.type.sankey":"Sankey","chart.type.chord":"Chord","chart.type.pyramid":"Pyramid","chart.type.pictorial":"Pictorial","chart.type.serpentine":"Serpentine timeline","chart.type.spiral":"Spiral timeline","chart.edit.aggregated":"This value is a total of several rows, so it cannot be dragged.","chart.edit.refused":"That change was not applied.","chart.edit.refusedWhy":"That change was not applied: {reason}","chart.type.network":"Network","chart.type.stream":"Stream","chart.type.marimekko":"Marimekko","chart.type.violin":"Violin","chart.type.gantt":"Gantt","chart.type.forceTree":"Force-directed tree","chart.type.pack":"Packed circles","chart.type.tree":"Tree","chart.type.voronoiTreemap":"Voronoi treemap","chart.type.alluvial":"Alluvial","chart.type.arc":"Arc diagram","chart.type.barRace":"Bar chart race","chart.type.bubblemap":"Bubble map","chart.type.bump":"Bump chart","chart.type.calendar":"Calendar heat map","chart.type.choropleth":"Choropleth map","chart.type.decomposition":"Decomposition tree","chart.type.diverging":"Diverging bar","chart.type.dumbbell":"Dumbbell","chart.type.fan":"Fan chart","chart.type.hexbin":"Hexagonal bin","chart.type.hexmap":"Hex map","chart.type.icicle":"Icicle","chart.type.markermap":"Marker map","chart.type.motion":"Motion chart","chart.type.parallel":"Parallel coordinates","chart.type.ridgeline":"Ridgeline","chart.type.roc":"ROC curve","chart.type.scatter3d":"3D scatter","chart.type.slope":"Slope chart","chart.type.splom":"Scatter plot matrix","chart.type.venn":"Venn diagram","chart.type.waffle":"Waffle","chart.type.wordCloud":"Word cloud","chart.tasksDropped":{one:"{count} more task not shown",other:"{count} more tasks not shown"},"chart.geoUnmatched":{one:"{count} row could not be placed on the map",other:"{count} rows could not be placed on the map"},"chart.r2":"R² {value}","ai.insights":"Insights","ai.explainView":"Explain this view","ai.explain":"Explain","ai.ask":"Ask","ai.apply":"Apply","ai.discard":"Discard","ai.propose":"Propose","ai.approve":"Approve","ai.thinking":"Thinking…","ai.applying":"Applying…","ai.applied":"Applied: {what}","ai.couldNotApply":"Could not apply: {why}","ai.applyFailed":"it failed","ai.discarded":"Discarded.","ai.discardedNothingWritten":"Discarded. Nothing was written.","ai.nothingWritten":"Nothing was written.","ai.nothingWrittenVetoed":"Nothing was written — a before-handler vetoed it.","ai.scope":"Scope: {scope}","ai.unsafeQuery":"I could not turn that into a safe query: {why}","ai.nothingToDo":"nothing to do","ai.insightsFailed":"Could not generate insights right now. The grid is unaffected.","ai.modelUnreachable":"Could not reach the model right now. The grid is unaffected.","ai.flagged":{one:"{count} unverified figure was removed as ungrounded.",other:"{count} unverified figures were removed as ungrounded."},"ai.askPlaceholder":"Ask your data: “EMEA deals over 50k, biggest first”","ai.askLabel":"Ask your data","ai.actorPlaceholder":"Ask AI to change data: “set the Network Upgrade project to In Progress”","ai.actorLabel":"Ask AI to change data","editor.password.show":"Show value","editor.password.hide":"Hide value","editor.password.showField":"Show {column}","editor.password.hideField":"Hide {column}","facets.computing":"Computing…","facets.suppressed.cardinality":"Too many distinct values to chart","facets.suppressed.rows":"Too many rows to chart","facets.suppressed.streaming":"Paused while live data is streaming","facets.suppressed.noProvider":"No distribution available for this data source","facets.suppressed.type":"This column has no chartable distribution","facets.bucketOf":"{count} of {whole} rows","history.undo":"Undo","history.redo":"Redo","history.described":"{action} {label}","history.nothingToUndo":"Nothing to undo","history.nothingToRedo":"Nothing to redo","history.undoDisabled":"Undo (nothing to undo)","history.redoDisabled":"Redo (nothing to redo)","a11y.presence.joined":"{name} joined","a11y.presence.left":"{name} left","prompt.asking":"Asking…","prompt.moreNotes":{one:"and {count} more",other:"and {count} more"},"shortcuts.key.cmd":"Cmd","timeline.live":"Live","timeline.recording":"recording…","panel.zoneHint.group":"Drag a column here to group rows by its values","panel.zoneHint.values":"Drag a column here to total it","panel.zoneHint.pivot":"Drag a column here to pivot across its values","panel.zoneHint.any":"Drag a column here","panel.rowsOf":"{shown} of {total} rows","views.empty":"No saved views yet. Set the grid up as you want it, then save it below.","views.applied":"Applied","views.matchesGrid":"Matches the grid as it is","views.delete":"Delete","views.confirmDelete":"Delete {name}?","views.confirmDeleteLabel":"Confirm deleting {name}","views.shared":"View copied to the clipboard","views.sharedDownload":"Clipboard unavailable; the view was downloaded as {name}","views.sharedFailed":"The view could not be copied or downloaded","views.rename":"Rename","views.ownedBy":"Owned by {name}","views.ownerOnlyReason":"Only {name} or an admin can do that","views.noOwnerReason":"Only an admin can do that — this view has no recorded owner","views.unshare":"Unshare","views.unshareTitle":"Stop sharing {name}","views.duplicate":"Duplicate","views.duplicateTitle":"Duplicate {name}","views.copyName":"{name} (copy)","gantt.row.expand":"Expand {name}","gantt.row.collapse":"Collapse {name}","gantt.resource.over":"{name} — over-allocated","kanban.board":"Board","kanban.requiredTitle":"Required fields","kanban.requiredSave":"Save","kanban.requiredCancel":"Cancel","kanban.moveRefused":'Move refused: a card in "{from}" cannot move to "{to}".',"kpi.status.good":"good","kpi.status.warn":"warn","kpi.status.critical":"critical","kpi.status.unknown":"No data","kpi.node.item":"{count} item","kpi.node.items":"{count} items","kpi.node.worst":"worst status {status}","kpi.node.unknown":"{count} unknown","sidebar.nav":"Main navigation","sidebar.search":"Search","sidebar.collapse":"Collapse sidebar","sidebar.expand":"Expand sidebar","toolbar.more":"More"}),x=Object.freeze(Object.keys(F))}),Be("packages/core/src/i18n/format.js",function(e,D){"use strict";Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"formatMessage",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return k}});const M=D("packages/core/src/internal/predicates.js").isFunction,G=/\{(\w+)\}/g,F=new Map,x=new Map;function q(y){const l=y||"";if(F.has(l))return F.get(l);let g=null;try{g=new Intl.PluralRules(y||void 0)}catch{g=null}return F.set(l,g),g}function W(y,l,g="conjunction"){const i=Array.isArray(y)?y.filter(c=>c!=null&&c!==""):[];if(i.length===0)return"";if(i.length===1)return String(i[0]);const t=`${l||""}|${g}`;let o=x.get(t);if(o===void 0){try{o=new Intl.ListFormat(l||void 0,{style:"long",type:g})}catch{o=null}x.set(t,o)}return o?o.format(i.map(String)):i.map(String).join(", ")}function I(y,l){return y==null?"":typeof y=="number"?Number.isFinite(y)?y.toLocaleString(l||void 0,{maximumFractionDigits:20}):"":String(y)}function K(y,l,g){if(typeof y=="string")return y;if(!y||typeof y!="object")return"";const i=l&&typeof l.count=="number"?l.count:null;if(i===null)return y.other??"";const t=q(g),o=t?t.select(i):i===1?"one":"other";return y[o]??y.other??""}function R(y,l={},g){const i=K(y,l,g);return i?i.replace(G,(t,o)=>Object.prototype.hasOwnProperty.call(l,o)?I(l[o],g):t):""}function S(y,l,g="en-GB"){return typeof y=="string"&&y?y:typeof l=="string"&&l?l:g}function k(y,l){const g=y?y[l]:void 0;return g==null||M(g)?l:g}}),Be("packages/core/src/i18n/registry.js",function(e,D){"use strict";Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"localeCatalogue",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return q}});const M=D("packages/core/src/i18n/catalogue.js").EN_GB,G=new Map([["en-gb",M]]);function F(W,I){const K=typeof W=="string"?W.toLowerCase():"";return!K||!I||typeof I!="object"?!1:(G.set(K,I),!0)}function x(W){if(typeof W!="string"||!W)return null;const I=W.toLowerCase(),K=G.get(I);if(K)return K;const R=I.split("-")[0],S=G.get(R);if(S)return S;for(const[k,y]of G)if(k.split("-")[0]===R)return y;return null}function q(){return[...G.keys()]}}),Be("packages/core/src/i18n/index.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"Messages",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"defaultMessages",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return f}});const re=D("packages/core/src/i18n/catalogue.js"),M=re.EN_GB,G=re.MESSAGE_KEYS,F=D("packages/core/src/i18n/format.js"),x=F.formatMessage,q=F.formatList,W=F.lookup,I=F.resolveLocale,R=D("packages/core/src/internal/predicates.js").isFunction,k=D("packages/core/src/internal/warn.js").warnOnce,y=D("packages/core/src/i18n/registry.js"),l=y.registerLocale,g=y.localeCatalogue;Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return re.EN_GB}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return re.MESSAGE_KEYS}}),Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return F.formatList}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return F.resolveLocale}}),Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return y.registerLocale}});const i="en-GB";class t{#e=i;#t=M;constructor(m={}){this.configure(m)}configure(m={}){this.#e=I(m.locale,m.declared,i);const r=m.messages,s=g(this.#e);if(!s&&this.#e.toLowerCase()!=="en-gb"&&(!r||typeof r!="object")&&k(`i18n:locale:not-loaded:${this.#e.toLowerCase()}`,`locale "${this.#e}" is not loaded: import "@toclocoinc/lattice-grid/locales/${this.#e}" to add its text; English is used until then.`),!r||typeof r!="object"){this.#t=s?{...M,...s}:M;return}const p=Object.keys(r).filter(u=>!(u in M));p.length&&k(`i18n:unknown:${p[0]}`,`message keys not in the catalogue and so ignored: ${p.slice(0,5).join(", ")}${p.length>5?`, and ${p.length-5} more`:""}`),this.#t={...M,...s||{},...r}}get locale(){return this.#e}t(m,r){return x(W(this.#t,m),r||{},this.#e)}list(m,r){return q(m,this.#e,r)}number(m,r){const s=Number(m);return Number.isFinite(s)?s.toLocaleString(this.#e,r||{maximumFractionDigits:20}):""}}const o=new t;function c(n){return n instanceof t?n:new t(n||{})}function f(n){const m=n&&typeof n=="object"?n:{},r=G.filter(d=>{const p=m[d];return p==null||p===""||R(p)}),s=Object.keys(m).filter(d=>!(d in M));return{missing:r,unknown:s}}}),Be("packages/core/src/columns/types/structured.js",function(e,D){"use strict";Object.defineProperty(e,"MASK_DEFAULTS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"parseJsonText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return i}});const re=D("packages/core/src/internal/predicates.js"),M=re.isNil,G=re.isObject,x=D("packages/core/src/i18n/index.js").defaultMessages,q=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function W(t,o){const c=o||{},f=c.emptyDisplay??q.emptyDisplay;if(M(t)||t==="")return f;const m=[...typeof c.char=="string"&&c.char!==""?c.char:q.char][0]||q.char,r=c.fixedLength??q.fixedLength,s=Number.isFinite(c.length)&&Number(c.length)>0?Math.floor(Number(c.length)):q.length,d=typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):null;let p=0;if(d!==null){const u=Number.isFinite(c.lastVisible)?Math.floor(Number(c.lastVisible)):q.lastVisible,b=[...d];if(p=u>0&&u<b.length?u:0,p>0){const a=b.slice(b.length-p).join(""),h=Math.max(1,(r?s:b.length)-p);return m.repeat(h)+a}return m.repeat(r?s:Math.max(1,b.length))}return m.repeat(s)}const I=48;function K(t){try{const o=JSON.stringify(t);return o===void 0?null:o}catch{return null}}function R(t,o){if(M(t))return"";const c=Number.isFinite(o&&o.inlineLimit)?Number(o.inlineLimit):I;if(typeof t=="string")return t.length>c?`${t.slice(0,c-1)}…`:t;if(typeof t!="object")return String(t);const f=K(t);if(f!==null&&f.length<=c)return f;if(Array.isArray(t)){const m=t.length;return`[${x.t("count.items",{count:m})}]`}const n=Object.keys(t).length;return`{${x.t("count.keys",{count:n})}}`}function S(t,o){if(t==null)return"null";const c=typeof t;if(c==="number"||c==="boolean"||c==="bigint")return String(t);if(c==="string")return JSON.stringify(t);if(c!=="object")return JSON.stringify(String(t));const f=o||new WeakSet;return f.has(t)?'"[circular]"':(f.add(t),t instanceof Date?JSON.stringify(t.toISOString()):Array.isArray(t)?`[${t.map(r=>S(r,f)).join(",")}]`:`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${S(t[r],f)}`).join(",")}}`)}function k(t,o){if(M(t))return M(o)?0:1;if(M(o))return-1;const c=S(t),f=S(o);return c<f?-1:c>f?1:0}function y(t){if(M(t))return null;const o=String(t);if(o.trim()==="")return null;try{return JSON.parse(o)}catch{return o}}function l(t){const o=t&&t.cell&&t.cell.props;return G(o)?o:{}}const g=Object.freeze({json:{base:"object",storage:"object",format:t=>R(t&&t.value,l(t&&t.column)),parse:t=>y(t&&t.text),compare:k,defaults:{editor:"code",filter:"text",align:"start"},excel:"@",toClipboard:t=>{if(M(t))return"";if(typeof t=="string")return t;try{const o=JSON.stringify(t,null,2);return o===void 0?String(t):o}catch{return String(t)}},fromClipboard:t=>y(t)},secret:{base:"text",storage:"object",format:t=>W(t&&t.value,l(t&&t.column)),parse:t=>{const o=t&&t.text;return M(o)||String(o)===""?null:String(o)},compare:(t,o)=>{const c=M(t)||t==="",f=M(o)||o==="";return c===f?0:c?1:-1},defaults:{editor:"password",filter:"none",align:"start"},excel:"@",export:{csv:!1,excel:!1},toClipboard:t=>W(t),fromClipboard:t=>M(t)||String(t)===""?null:String(t)}}),i=g}),Be("packages/core/src/columns/types/unit.js",function(e,D){"use strict";Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return C}});const M=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/warn.js").warnOnce;function x(B,z,X,Q){return Object.freeze({symbol:B,factor:z,aliases:Object.freeze(X||[]),binary:!!(Q&&Q.binary),prefix:Q&&Q.prefix||null,auto:!(Q&&Q.auto===!1)})}function q(B,z,X,Q){return x(B,z,X,Q)}const W=Object.freeze({data:Object.freeze([x("B",1,["byte","bytes"]),x("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),x("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),x("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),x("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),x("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),x("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),x("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),x("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),x("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([x("bps",1,["bit","bits","bit/s","b/s"]),x("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),x("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),x("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),x("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([x("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),x("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),x("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),x("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),x("in",.0254,["inch","inches"],{auto:!1}),x("ft",.3048,["foot","feet"],{auto:!1}),x("yd",.9144,["yard","yards"],{auto:!1}),x("m",1,["metre","metres","meter","meters"]),x("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),x("mi",1609.344,["mile","miles"],{auto:!1}),x("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([x("mg",.001,["milligram","milligrams"]),x("g",1,["gram","grams"]),x("oz",28.349523125,["ounce","ounces"],{auto:!1}),x("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),x("kg",1e3,["kilogram","kilograms"]),x("st",6350.29318,["stone"],{auto:!1}),x("t",1e6,["tonne","tonnes","ton"],{auto:!1}),x("ton (US)",907184.74,["ton","shortton"],{auto:!1}),x("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([x("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),x("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),x("ms",.001,["msec","msecs","millisecond","milliseconds"]),x("s",1,["sec","secs","second","seconds"]),x("m",60,["min","mins","minute","minutes"]),x("h",3600,["hr","hrs","hour","hours"]),x("d",86400,["day","days"])]),speed:Object.freeze([x("mm/s",.001,["millimetre/s","millimeter/s"]),x("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),x("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),x("mph",.44704,["mile/h","miles/h"],{auto:!1}),x("kn",1852/3600,["knot","knots"],{auto:!1}),x("m/s",1,["metre/s","meter/s","mps"]),x("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([x("mm/s²",.001,["mm/s2"]),x("ft/s²",.3048,["ft/s2"],{auto:!1}),x("m/s²",1,["m/s2","metre/s2","meter/s2"]),x("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([x("mm²",1e-6,["mm2"]),x("cm²",1e-4,["cm2"]),x("in²",64516e-8,["in2","sqin"],{auto:!1}),x("ft²",.09290304,["ft2","sqft"],{auto:!1}),x("yd²",.83612736,["yd2","sqyd"],{auto:!1}),x("m²",1,["m2","sqm"]),x("ha",1e4,["hectare","hectares"],{auto:!1}),x("ac",4046.8564224,["acre","acres"],{auto:!1}),x("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([x("µL",1e-6,["ul","microlitre","microliter"]),x("mL",.001,["millilitre","milliliter"]),x("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),x("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),x("L",1,["litre","litres","liter","liters"]),x("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),x("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),x("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),x("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([x("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),x("J",1,["joule","joules"]),x("cal",4.184,["calorie","calories"],{auto:!1}),x("kJ",1e3,["kilojoule","kilojoules"]),x("BTU",1055.05585262,["btu"],{auto:!1}),x("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),x("MJ",1e6,["megajoule","megajoules"]),x("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),x("GJ",1e9,["gigajoule","gigajoules"]),x("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([x("mW",.001,["milliwatt","milliwatts"]),x("W",1,["watt","watts"]),x("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),x("kW",1e3,["kilowatt","kilowatts"]),x("hp",745.6998715822702,["horsepower"],{auto:!1}),x("MW",1e6,["megawatt","megawatts"]),x("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([x("mN",.001,["millinewton","millinewtons"]),x("N",1,["newton","newtons"]),x("lbf",4.4482216152605,["poundforce"],{auto:!1}),x("kgf",9.80665,["kilogramforce"],{auto:!1}),x("kN",1e3,["kilonewton","kilonewtons"]),x("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([x("Pa",1,["pascal","pascals"]),x("mbar",100,["millibar"],{auto:!1}),x("inH₂O",249.0889,["inh2o"],{auto:!1}),x("mmHg",133.322387415,["torr"],{auto:!1}),x("kPa",1e3,["kilopascal","kilopascals"]),x("inHg",3386.388640341,["inhg"],{auto:!1}),x("psi",6894.757293168361,["lbf/in2"],{auto:!1}),x("bar",1e5,[],{auto:!1}),x("atm",101325,["atmosphere","atmospheres"],{auto:!1}),x("MPa",1e6,["megapascal","megapascals"]),x("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([x("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),x("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),x("kN·m",1e3,["knm","kn.m"],{auto:!1}),x("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([x("kg/m³",1,["kg/m3"]),x("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),x("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),x("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([x("L/min",1/6e4,["lpm","l/min"],{auto:!1}),x("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),x("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),x("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),x("cfm",.0004719474432,["ft3/min"],{auto:!1}),x("L/s",.001,["lps","l/s"],{auto:!1}),x("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([x("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),x("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),x("mrad",.001,["milliradian","milliradians"],{auto:!1}),x("mil",Math.PI/3200,["nato-mil"],{auto:!1}),x("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),x("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),x("rad",1,["radian","radians"]),x("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([x("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),x("rad/s",1,["radps","radians/s"]),x("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),x("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([x("ppt",1e-12,["partspertrillion"],{auto:!1}),x("ppb",1e-9,["partsperbillion"]),x("ppm",1e-6,["partspermillion"]),x("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),x("‰",.001,["permille","permil"],{auto:!1}),x("%",.01,["pct","percent"]),x("×",1,["x","ratio","times"])]),molarity:Object.freeze([x("pM",1e-12,["picomolar","picomolarity"]),x("nM",1e-9,["nanomolar","nanomolarity"]),x("µM",1e-6,["um-molar","micromolar","micromolarity"]),x("mM",.001,["millimolar","millimolarity"]),x("M",1,["molar","mol/l","mol/L","molarity"]),x("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([x("mg/s",1e-6,["milligrams/s"]),x("g/s",.001,["grams/s"]),x("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),x("kg/s",1,["kilograms/s","kgps"]),x("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),x("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),x("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([x("µPa·s",1e-6,["upas","micropascalsecond"]),x("cP",.001,["centipoise"],{auto:!1}),x("mPa·s",.001,["mpas","millipascalsecond"]),x("P",.1,["poise"],{auto:!1}),x("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([x("cSt",1e-6,["centistokes","centistoke"]),x("mm²/s",1e-6,["mm2/s"],{auto:!1}),x("St",1e-4,["stokes","stoke"],{auto:!1}),x("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([x("mW/(m·K)",.001,["mw/mk"]),x("W/(m·K)",1,["w/mk","wmk"]),x("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),x("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([x("J/(kg·K)",1,["j/kgk","jkgk"]),x("kJ/(kg·K)",1e3,["kj/kgk"]),x("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([x("nSv/h",1e-9,["nsvh"]),x("µSv/h",1e-6,["usv/h","usvh"]),x("mSv/h",.001,["msvh"]),x("Sv/h",1,["svh"]),x("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),I=Symbol("ambiguous"),K=new Map,R=new Map;function S(B,z){const X=String(B||"").trim();if(!X)throw new Error("[lattice] a unit system needs a name");if(W[X]||R.has(X))throw new Error(`[lattice] unit system "${X}" already exists`);const Q=[...z||[]];if(!Q.length)throw new Error(`[lattice] unit system "${X}" has no units`);if(!Q.some(L=>L.factor===1))throw new Error(`[lattice] unit system "${X}" has no base unit (none with factor 1)`);const H=new Set;for(const L of Q){if(H.has(L.symbol))throw new Error(`[lattice] unit system "${X}" declares "${L.symbol}" twice`);H.add(L.symbol)}return R.set(X,Object.freeze(Q)),K.delete(X),X}function k(){return[...Object.keys(W),...R.keys()]}function y(B){const z=l(B);return z?z.units:[]}function l(B){const z=String(B||""),X=K.get(z);if(X!==void 0)return X;const Q=W[z]||R.get(z);if(!Q)return K.set(z,null),null;const H=Object.freeze([...Q].sort((se,ne)=>se.factor-ne.factor)),L=new Map,Z=new Map,ee=(se,ne)=>{const ae=L.get(se);ae===void 0?L.set(se,ne):ae!==ne&&L.set(se,I)};for(const se of H){ee(se.symbol.toLowerCase(),se);for(const ne of se.aliases)ee(ne.toLowerCase(),se);if(se.prefix){const ne=Z.get(se.prefix)||[];ne.push(se),Z.set(se.prefix,ne)}}const te={units:H,byToken:L,byPrefix:Z,decimal:H.filter(se=>!se.binary&&se.auto),binary:H.some(se=>se.binary)?H.filter(se=>(se.binary||se.factor===1)&&se.auto):null};return K.set(z,te),te}function g(B,z){return z&&B.binary||B.decimal}function i(B,z){const X=l(B);if(!X||M(z))return null;const Q=X.units.find(L=>L.symbol===String(z));if(Q)return Q;const H=X.byToken.get(String(z).trim().toLowerCase());return H&&H!==I?H:null}const t=new WeakMap;function o(B){const z=B||{};if(typeof z=="object"&&z!==null){const L=t.get(z);if(L!==void 0)return L}const X=z.system||"data",Q=l(X);let H=null;if(!Q)F(`unit:system:${X}`,`unknown unit system "${X}"; known systems are ${k().join(", ")}`);else{let L=z.unit?i(X,z.unit):null;L||(z.unit&&F(`unit:unit:${X}:${z.unit}`,`unknown unit "${z.unit}" in system "${X}"; falling back to ${Q.units[0].symbol}`),L=Q.units.find(Z=>Z.factor===1)||Q.units[0]),H={index:Q,base:L,binary:z.binary===!0}}return typeof z=="object"&&z!==null&&t.set(z,H),H}const c=new WeakMap;function f(B,z){if(!B||!z||!Array.isArray(B.compound)||B.compound.length===0)return null;const X=c.get(B);if(X!==void 0)return X;const Q=new Set,H=[];for(const Z of B.compound){const ee=i(B.system||"data",Z);if(!ee){F(`unit:compound:${B.system}:${Z}`,`unknown compound unit "${Z}" in system "${B.system||"data"}"; ignoring it`);continue}Q.has(ee.symbol)||(Q.add(ee.symbol),H.push(ee))}H.sort((Z,ee)=>ee.factor-Z.factor);const L=H.length>=2?H:null;return c.set(B,L),L}function n(B,z,X){return z===X||z.factor===X.factor?B:B*z.factor/X.factor}const m=new Map;function r(B){const z=B||"",X=m.get(z);if(X)return X;const Q={group:",",decimal:"."};try{for(const H of new Intl.NumberFormat(B||void 0).formatToParts(12345.6))H.type==="group"?Q.group=H.value:H.type==="decimal"&&(Q.decimal=H.value)}catch{}return m.set(z,Q),Q}const s=/[\s ]/g,d=/^[+-]?[\d '’ .,]*(?:[eE][+-]?\d+)?/,p=/^[^\d+\-(.,\s]+\s*/,u=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function b(B,z){const{group:X,decimal:Q}=r(z);let H=String(B).replace(s,"");if(H==="")return null;const L=Q?H.indexOf(Q):-1;if(X&&X!==Q){if(L>=0&&H.indexOf(X,L+Q.length)>=0)return null;H=H.split(X).join("")}if(Q&&Q!=="."&&(H=H.split(Q).join(".")),!u.test(H))return null;const Z=Number(H);return Number.isFinite(Z)?Z:null}function a(B,z,X){const Q=String(B).trim().replace(/\.$/,"");if(Q==="")return null;const H=z.units.find(ne=>ne.symbol===Q);if(H)return H;const L=Q.toLowerCase(),Z=z.byToken.get(L);if(Z===I)return null;if(Z)return Z;const ee=z.byPrefix.get(L);if(!ee||!ee.length)return null;const te=g(z,X),se=ee.filter(ne=>te.includes(ne));return se.length===1?se[0]:null}function h(B,z,X,Q){let H=B,L=0,Z=!1,ee=!1;for(;H!=="";){const te=d.exec(H)[0];if(te==="")return null;const se=b(te,Q&&Q.locale);if(se===null)return null;H=H.slice(te.length).trim();const ne=H.search(/[+-]?[\d]/),ae=(ne>=0?H.slice(0,ne):H).trim();if(H=ne>=0?H.slice(ne).trim():"",ae===""){if(Z)return null;ee=!0,L+=n(se,X[0],z.base)}else{const de=a(ae,z.index,z.binary);if(!de)return null;L+=n(se,de,z.base)}if(Z=!0,ee&&H!=="")return null}return Z?L:null}function w(B,z){if(M(B))return null;if(typeof B=="number")return Number.isFinite(B)?B:null;const X=o(z);if(!X)return null;let Q=String(B).trim();if(Q==="")return null;let H=!1;Q.startsWith("(")&&Q.endsWith(")")&&(H=!0,Q=Q.slice(1,-1).trim());const L=f(z,X);if(L){Q.startsWith("-")&&(H=!0,Q=Q.slice(1).trim());const le=h(Q,X,L,z);return le===null?null:H?-le:le}let Z=null;const ee=p.exec(Q);if(ee&&ee[0]){const le=a(ee[0].trim(),X.index,X.binary);le&&(Z=le,Q=Q.slice(ee[0].length).trim())}const te=d.exec(Q)[0],se=b(te,z&&z.locale);if(se===null)return null;const ne=Q.slice(te.length).trim();if(Z&&ne!=="")return null;const ae=Z||(ne===""?X.base:a(ne,X.index,X.binary));if(!ae)return null;const de=n(se,ae,X.base);return H?-de:de}const v=new Map;function A(B,z,X,Q){const H=`${B||""}|${z}|${X}|${Q?1:0}`;let L=v.get(H);return L||(L=new Intl.NumberFormat(B||void 0,{minimumFractionDigits:z,maximumFractionDigits:X,useGrouping:Q}),v.set(H,L)),L}function _(B,z){if(!Number.isFinite(B)||B===0)return Math.max(0,z-1);const X=Math.floor(Math.log10(Math.abs(B)));return Math.min(20,Math.max(0,z-1-X))}function V(B,z){if(!Number.isFinite(B)||B===0)return B;const X=Math.ceil(Math.log10(Math.abs(B))),Q=10**(z-X);return Math.round(B*Q)/Q}function Y(B,z,X){if(!X||X===z.base.symbol)return z.base;if(X!=="auto")return $(z,X);if(B===0||!Number.isFinite(B))return z.base;const Q=Math.abs(B)*z.base.factor,H=g(z.index,z.binary);let L=H[0];for(const te of H)Q>=te.factor&&(L=te);if(Q>=L.factor)return L;let Z=L;for(const te of z.index.units)te.binary!==z.binary&&te.factor!==1||te.factor<=Q&&te.factor>(Z===L?0:Z.factor)&&(Z=te);if(Z!==L)return Z;let ee=L;for(const te of z.index.units)te.binary!==z.binary&&te.factor!==1||te.factor<ee.factor&&(ee=te);return ee.factor<z.base.factor?ee:z.base}function $(B,z){const X=B.index.units.find(H=>H.symbol===z);if(X)return X;const Q=B.index.byToken.get(String(z).toLowerCase());return Q&&Q!==I?Q:(F(`unit:display:${z}`,`unknown display unit "${z}"; rendering in ${B.base.symbol}`),B.base)}function j(B,z,X,Q){const H=B<0;let L=Math.abs(B)*z.base.factor;const Z=typeof Q.decimals=="number"?Q.decimals:Q.minDecimals??0,ee=typeof Q.decimals=="number"?Q.decimals:Q.maxDecimals??Math.max(Z,2),te=Q.space??" ",se=[];for(let ae=0;ae<X.length;ae++){const de=X[ae],le=ae===X.length-1;let be=le?L/de.factor:Math.floor(L/de.factor);if(L-=be*de.factor,le){const Ne=10**ee;be=Math.round(be*Ne)/Ne+0}const Ce=le?A(Q.locale,Z,ee,Q.group!==!1):A(Q.locale,0,0,Q.group!==!1);se.push(`${Ce.format(be)}${te}${de.symbol}`)}const ne=se.join(" ");return H?`-${ne}`:ne}function E(B,z){const X=z||{},Q=X.nullDisplay??"";if(M(B)||B==="")return Q;const H=typeof B=="number"?B:Number(B);if(!Number.isFinite(H))return Q;const L=o(X);if(!L)return String(H);const Z=f(X,L);if(Z)return j(H,L,Z,X);const ee=typeof X.significantFigures=="number"&&X.significantFigures>0?X.significantFigures:0,te=ee?V(H,ee):H,se=Y(te,L,X.display),ne=n(te,L.base,se);let ae=typeof X.decimals=="number"?X.decimals:X.minDecimals??0,de=typeof X.decimals=="number"?X.decimals:X.maxDecimals??Math.max(ae,2);ee&&(ae=_(ne,ee),de=ae);const le=A(X.locale,ae,de,X.group!==!1).format(ne),be=X.space??" ";return X.placement==="prefix"?`${se.symbol}${X.space??""}${le}`:`${le}${be}${se.symbol}`}function O(B,z){const X=M(B)||Number.isNaN(B)?null:Number(B),Q=M(z)||Number.isNaN(z)?null:Number(z);return X===null||Number.isNaN(X)?Q===null||Number.isNaN(Q)?0:1:Q===null||Number.isNaN(Q)||X<Q?-1:X>Q?1:0}function N(B){const z=typeof B.decimals=="number"&&B.decimals>0?`.${"0".repeat(B.decimals)}`:"";return`${typeof B.decimals=="number"?`#,##0${z}`:"#,##0.##"}" ${B.symbol}"`}function T(B){const z={system:"data",...B||{}},X=o(z),Q=X?X.base.symbol:String(z.unit||""),H=Object.freeze({...z,unit:Q}),L=Object.freeze({...H,display:Q,decimals:void 0,minDecimals:0,maxDecimals:20,group:!1}),Z=new Map([[H.locale||"",H]]),ee=te=>{const se=te||"";let ne=Z.get(se);return ne||(ne=Object.freeze({...H,locale:te||void 0}),Z.set(se,ne)),ne};return{base:"number",extends:"number",storage:"float64",unitConfig:H,format:te=>E(te.value,te.locale?ee(te.locale):H),parse:te=>w(te.text,te.locale?ee(te.locale):H),compare:O,defaults:{filter:"number",editor:"unit",align:"end",total:z.total||"sum"},...z.totals?{totals:z.totals}:{},excel:z.excel||N({decimals:z.decimals,symbol:Q}),toStorage:te=>typeof te=="number"?Number.isFinite(te)?te:null:typeof te=="string"?w(te,H):M(te)?null:w(String(te),H),toClipboard:te=>E(te,L),fromClipboard:te=>w(te,H)}}const C=T}),Be("packages/core/src/columns/types/engineering.js",function(e,D){"use strict";Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return x}});const M=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/columns/types/unit.js").createUnitType;function x(I){const K=2*Math.PI/I;return R=>{let S=0,k=0,y=0;for(const g of R||[]){if(M(g))continue;const i=Number(g);Number.isFinite(i)&&(S+=Math.cos(i*K),k+=Math.sin(i*K),y+=1)}return!y||Math.hypot(S,k)/y<1e-12?null:(Math.atan2(k,S)/K%I+I)%I}}function q(I){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:x(I)}}}const W=Object.freeze({metres:F({system:"length",unit:"m",display:"auto",maxDecimals:3}),millimetres:F({system:"length",unit:"mm",maxDecimals:2}),kilometres:F({system:"length",unit:"km",maxDecimals:3}),grams:F({system:"mass",unit:"g",display:"auto",maxDecimals:3}),kilograms:F({system:"mass",unit:"kg",maxDecimals:3}),tonnes:F({system:"mass",unit:"t",maxDecimals:3}),seconds:F({system:"duration",unit:"s",display:"auto",maxDecimals:3}),milliseconds:F({system:"duration",unit:"ms",maxDecimals:3}),hours:F({system:"duration",unit:"h",maxDecimals:2}),speed:F({system:"speed",unit:"m/s",display:"auto",maxDecimals:2}),kph:F({system:"speed",unit:"km/h",maxDecimals:1}),mph:F({system:"speed",unit:"mph",maxDecimals:1}),knots:F({system:"speed",unit:"kn",maxDecimals:1}),acceleration:F({system:"acceleration",unit:"m/s²",maxDecimals:3}),area:F({system:"area",unit:"m²",display:"auto",maxDecimals:2}),hectares:F({system:"area",unit:"ha",maxDecimals:4}),volume:F({system:"volume",unit:"L",display:"auto",maxDecimals:3}),cubicMetres:F({system:"volume",unit:"m³",maxDecimals:3}),energy:F({system:"energy",unit:"J",display:"auto",maxDecimals:3}),kilowattHours:F({system:"energy",unit:"kWh",maxDecimals:2}),power:F({system:"power",unit:"W",display:"auto",maxDecimals:2}),kilowatts:F({system:"power",unit:"kW",maxDecimals:2}),force:F({system:"force",unit:"N",display:"auto",maxDecimals:2}),pressure:F({system:"pressure",unit:"Pa",display:"auto",maxDecimals:2}),bar:F({system:"pressure",unit:"bar",maxDecimals:3}),psi:F({system:"pressure",unit:"psi",maxDecimals:1}),torque:F({system:"torque",unit:"N·m",maxDecimals:2}),density:F({system:"density",unit:"kg/m³",maxDecimals:2}),flow:F({system:"flow",unit:"m³/s",maxDecimals:4}),litresPerMinute:F({system:"flow",unit:"L/min",maxDecimals:1}),radians:F({system:"angle",unit:"rad",maxDecimals:4,totals:q(2*Math.PI)}),degrees:F({system:"angle",unit:"°",maxDecimals:2,totals:q(360)}),rpm:F({system:"angularVelocity",unit:"rpm",maxDecimals:0}),angularVelocity:F({system:"angularVelocity",unit:"rad/s",maxDecimals:3}),ppm:F({system:"fraction",unit:"ppm",maxDecimals:2}),ppb:F({system:"fraction",unit:"ppb",maxDecimals:2}),basisPoints:F({system:"fraction",unit:"bp",maxDecimals:1}),molarity:F({system:"molarity",unit:"M",display:"auto",maxDecimals:3}),massFlow:F({system:"massFlow",unit:"kg/s",maxDecimals:3}),tonnesPerHour:F({system:"massFlow",unit:"t/h",maxDecimals:2}),viscosity:F({system:"viscosity",unit:"Pa·s",display:"auto",maxDecimals:3}),kinematicViscosity:F({system:"kinematicViscosity",unit:"cSt",maxDecimals:2}),thermalConductivity:F({system:"thermalConductivity",unit:"W/(m·K)",maxDecimals:3}),specificHeat:F({system:"specificHeat",unit:"J/(kg·K)",maxDecimals:1}),doseRate:F({system:"doseRate",unit:"µSv/h",display:"auto",maxDecimals:2})})}),Be("packages/core/src/columns/types/si.js",function(e,D){"use strict";Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return S}});const re=D("packages/core/src/columns/types/unit.js"),M=re.defineUnit,G=re.registerUnitSystem,F=re.createUnitType,x=Object.freeze([Object.freeze({symbol:"f",name:"femto",factor:1e-15}),Object.freeze({symbol:"p",name:"pico",factor:1e-12}),Object.freeze({symbol:"n",name:"nano",factor:1e-9}),Object.freeze({symbol:"µ",name:"micro",factor:1e-6}),Object.freeze({symbol:"m",name:"milli",factor:.001}),Object.freeze({symbol:"c",name:"centi",factor:.01}),Object.freeze({symbol:"",name:"",factor:1}),Object.freeze({symbol:"k",name:"kilo",factor:1e3}),Object.freeze({symbol:"M",name:"mega",factor:1e6}),Object.freeze({symbol:"G",name:"giga",factor:1e9}),Object.freeze({symbol:"T",name:"tera",factor:1e12}),Object.freeze({symbol:"P",name:"peta",factor:1e15})]),q=Object.freeze(["p","n","µ","m","","k","M","G"]);function W(k){const y=String(k.base),l=new Set([...k.prefixes||q,""]),g=[];for(const i of x){if(!l.has(i.symbol))continue;const t=`${i.symbol}${y}`,o=[];if(k.name){o.push(`${i.name}${k.name}`,`${i.name}${k.name}s`);const c=i.name.slice(-1);if(c&&k.name.startsWith(c)){const f=`${i.name.slice(0,-1)}${k.name}`;o.push(f,`${f}s`)}}i.symbol==="µ"&&o.push(`u${y}`),i.factor===1&&k.aliases&&o.push(...k.aliases),g.push(M(t,i.factor,o))}for(const i of k.extra||[])g.push(i);return g}function I(k,y){const l=W(y);return G(k,l)}function K(k,y,l){return I(k,y),F({system:k,unit:y.base,display:"auto",maxDecimals:3,...l||{}})}const R=Object.freeze({voltage:K("voltage",{base:"V",name:"volt"}),current:K("current",{base:"A",name:"amp",aliases:["ampere","amperes"]}),resistance:K("resistance",{base:"Ω",name:"ohm",aliases:["ohm","ohms","R"],prefixes:["m","","k","M","G"]}),capacitance:K("capacitance",{base:"F",name:"farad",prefixes:["f","p","n","µ","m",""]}),inductance:K("inductance",{base:"H",name:"henry",prefixes:["p","n","µ","m",""]}),charge:K("charge",{base:"C",name:"coulomb",prefixes:["p","n","µ","m",""],extra:[M("mAh",3.6,["milliamphour","milliamphours"],{auto:!1}),M("Ah",3600,["amphour","amphours"],{auto:!1})]}),conductance:K("conductance",{base:"S",name:"siemens",prefixes:["n","µ","m","","k"]}),fluxDensity:K("fluxDensity",{base:"T",name:"tesla",prefixes:["n","µ","m",""],extra:[M("G",1e-4,["gauss"],{auto:!1})]}),luminousFlux:K("luminousFlux",{base:"lm",name:"lumen",prefixes:["m","","k"]}),illuminance:K("illuminance",{base:"lx",name:"lux",prefixes:["m","","k"]}),luminousIntensity:K("luminousIntensity",{base:"cd",name:"candela",prefixes:["m","","k"]}),substance:K("substance",{base:"mol",name:"mole",prefixes:["n","µ","m","","k"]}),absorbedDose:K("absorbedDose",{base:"Gy",name:"gray",prefixes:["µ","m",""]}),equivalentDose:K("equivalentDose",{base:"Sv",name:"sievert",prefixes:["n","µ","m",""]}),radioactivity:K("radioactivity",{base:"Bq",name:"becquerel",prefixes:["","k","M","G","T"],extra:[M("Ci",37e9,["curie","curies"],{auto:!1})]}),frequency:K("frequency",{base:"Hz",name:"hertz",prefixes:["m","","k","M","G","T"]})}),S=K}),Be("packages/core/src/columns/types/temperature.js",function(e,D){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});const M=D("packages/core/src/internal/predicates.js").isNil,G=Object.freeze({C:Object.freeze({symbol:"°C",aliases:["c","°c","celsius","centigrade"],toKelvin:g=>g+273.15,fromKelvin:g=>g-273.15}),F:Object.freeze({symbol:"°F",aliases:["f","°f","fahrenheit"],toKelvin:g=>(g+459.67)*(5/9),fromKelvin:g=>g*(9/5)-459.67}),K:Object.freeze({symbol:"K",aliases:["k","kelvin"],toKelvin:g=>g,fromKelvin:g=>g}),R:Object.freeze({symbol:"°R",aliases:["r","°r","rankine"],toKelvin:g=>g*(5/9),fromKelvin:g=>g*(9/5)})});function F(g){if(M(g))return null;const i=String(g).trim();if(i==="")return null;for(const[o,c]of Object.entries(G))if(i===o||i===c.symbol)return{key:o,scale:c};const t=i.toLowerCase();for(const[o,c]of Object.entries(G))if(c.aliases.includes(t))return{key:o,scale:c};return null}function x(g,i,t){const o=F(i),c=F(t);return!o||!c||!Number.isFinite(Number(g))?null:o.key===c.key?Number(g):c.scale.fromKelvin(o.scale.toKelvin(Number(g)))}const q=new Map;function W(g,i,t){const o=`${g||""}|${i}|${t}`;let c=q.get(o);return c||(c=new Intl.NumberFormat(g||void 0,{minimumFractionDigits:i,maximumFractionDigits:t}),q.set(o,c)),c}function I(g,i){const t=i||{},o=t.nullDisplay??"";if(M(g)||g==="")return o;const c=Number(g);if(!Number.isFinite(c))return o;const f=F(t.scale||"C");if(!f)return String(c);const n=F(t.display||t.scale||"C")||f,m=n.key===f.key?c:n.scale.fromKelvin(f.scale.toKelvin(c)),r=typeof t.decimals=="number"?t.decimals:null,s=r??t.minDecimals??0,d=r??t.maxDecimals??1;return`${W(t.locale,s,d).format(m)}${t.space??" "}${n.scale.symbol}`}const K=/^[+-]?[\d\s., ]*\d/;function R(g,i){const t=String(g).trim();if(t==="")return null;const o=new Intl.NumberFormat(i||void 0).formatToParts(1.1).find(m=>m.type==="decimal")?.value||".",c=o===","?".":",",f=t.split(c).join("").split(/[\s ]/).join("").replace(o,"."),n=Number(f);return Number.isFinite(n)?n:null}function S(g,i){if(M(g))return null;const t=i||{},o=F(t.scale||"C");if(!o)return null;if(typeof g=="number")return Number.isFinite(g)?g:null;let c=String(g).trim();if(c==="")return null;let f=!1;c.startsWith("(")&&c.endsWith(")")&&(f=!0,c=c.slice(1,-1).trim());const n=K.exec(c);if(!n)return null;const m=R(n[0],t.locale);if(m===null)return null;const r=c.slice(n[0].length).trim();if(r==="")return f?-m:m;const s=F(r);if(!s)return null;const d=s.key===o.key?m:o.scale.fromKelvin(s.scale.toKelvin(m));return f?-d:d}function k(g){const i=Object.freeze({scale:"C",...g||{}}),o=(F(i.scale)||F("C")).scale.symbol,c=Object.freeze({...i,display:i.scale,decimals:void 0,minDecimals:0,maxDecimals:20}),f=new Map([[i.locale||"",i]]),n=m=>{const r=m||"";let s=f.get(r);return s||(s=Object.freeze({...i,locale:m||void 0}),f.set(r,s)),s};return{base:"number",extends:"number",storage:"float64",temperatureConfig:i,format:m=>I(m.value,m.locale?n(m.locale):i),parse:m=>S(m.text,m.locale?n(m.locale):i),defaults:{filter:"number",editor:"temperature",align:"end",total:"avg"},totals:{supported:["avg","min","max","count","countValues"]},excel:i.excel||`#,##0${typeof i.decimals=="number"&&i.decimals>0?`.${"0".repeat(i.decimals)}`:".#"}" ${o}"`,toStorage:m=>typeof m=="number"?Number.isFinite(m)?m:null:typeof m=="string"?S(m,i):M(m)?null:S(String(m),i),toClipboard:m=>I(m,c),fromClipboard:m=>S(m,i)}}const y=Object.freeze({celsius:k({scale:"C"}),fahrenheit:k({scale:"F"}),kelvin:k({scale:"K"})}),l=k}),Be("packages/core/src/columns/types/radix.js",function(e,D){"use strict";Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"digitsForWidth",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"radixRange",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"radixName",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"normaliseRadixOptions",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"compileRadixFormat",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"compileRadixParse",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"parseRadixResult",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return j}});const M=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/warn.js").warnOnce,x=Object.freeze({2:2,8:8,16:16,bin:2,binary:2,base2:2,oct:8,octal:8,base8:8,hex:16,hexadecimal:16,base16:16}),q=Object.freeze({2:1,8:3,16:4}),W=Object.freeze({2:"0b",8:"0o",16:"0x"}),I=Object.freeze({2:4,8:3,16:2}),K=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),R=Object.freeze({2:"binary",8:"octal",16:"hexadecimal"}),S=Object.freeze([[/^0x/i,16],[/^0b/i,2],[/^0o/i,8],[/^#/,16]]),k=/[\s\u00a0\u202f_,']/g,y=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,l=Object.freeze([8,16,32,53]),g=new WeakSet,i=new WeakMap,t=new Map,o=new WeakMap,c=new WeakMap,f=Object.freeze({hex:Object.freeze({radix:16}),hex8:Object.freeze({radix:16,bitWidth:8,pad:!0,signed:!1}),hex16:Object.freeze({radix:16,bitWidth:16,pad:!0,signed:!1}),hex32:Object.freeze({radix:16,bitWidth:32,pad:!0,signed:!1}),binary:Object.freeze({radix:2}),binary8:Object.freeze({radix:2,bitWidth:8,pad:!0,signed:!1,group:4}),octal:Object.freeze({radix:8})});function n(E){if(E==null)return 16;const O=typeof E=="string"?E.toLowerCase():E,N=x[O];return N||(F(`radix:base:${String(E)}`,`unsupported radix ${String(E)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function m(E,O){return Math.ceil(E/q[O])}function r(E,O){if(!E)return O?{min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}:{min:0,max:Number.MAX_SAFE_INTEGER};if(!O)return{min:0,max:2**E-1};const N=2**(E-1);return{min:-N,max:N-1}}function s(E){return R[E]||"hexadecimal"}function d(E){if(typeof E=="string"){const O=f[E];return O||F(`radix:preset:${E}`,`unknown radix preset "${E}"; known presets are ${Object.keys(f).join(", ")}`),{...O||{}}}if(E&&typeof E.preset=="string"){const O=f[E.preset];return O||F(`radix:preset:${E.preset}`,`unknown radix preset "${E.preset}"; known presets are ${Object.keys(f).join(", ")}`),{...O||{},...E}}return E||{}}function p(E){const O=d(E),N=n(O.radix),T=q[N];let C=null;if(O.bitWidth!==void 0&&O.bitWidth!==null&&O.bitWidth!==!1){const te=Number(O.bitWidth);l.includes(te)?C=te:F(`radix:width:${String(O.bitWidth)}`,`unsupported bitWidth ${String(O.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let B=O.signed!==!1;!B&&C===null&&(F("radix:unsigned:width","signed: false needs a bitWidth to render a two's-complement pattern; defaulting to 32"),C=32);const z=O.prefix===void 0||O.prefix===!0?W[N]:O.prefix===!1?"":String(O.prefix);let X=0;O.pad===!0?X=C?m(C,N):0:typeof O.pad=="number"&&O.pad>0&&(X=Math.floor(O.pad));let Q=0;O.group===!0?Q=I[N]:typeof O.group=="number"&&O.group>0&&(Q=Math.floor(O.group));const H=r(C,B),L=typeof O.min=="number"?Math.max(H.min,O.min):H.min,Z=typeof O.max=="number"?Math.min(H.max,O.max):H.max,ee=Object.freeze({radix:N,bits:T,prefix:z,uppercase:O.uppercase!==!1,pad:X,group:Q,groupSeparator:typeof O.groupSeparator=="string"?O.groupSeparator:" ",bitWidth:C,signed:B,min:L,max:Z<L?L:Z,nullDisplay:typeof O.nullDisplay=="string"?O.nullDisplay:"",name:s(N)});return g.add(ee),ee}function u(E){if(E&&g.has(E))return E;if(typeof E=="string"){let O=t.get(E);return O||(O=p(E),t.set(E,O)),O}if(E&&typeof E=="object"){let O=i.get(E);return O||(O=p(E),i.set(E,O)),O}return u("hex")}function b(E){return E<0?-Math.round(-E):Math.round(E)}function a(E,O,N){if(O<=0||E.length<=O)return E;const T=E.length%O||O,C=[E.slice(0,T)];for(let B=T;B<E.length;B+=O)C.push(E.slice(B,B+O));return C.join(N)}function h(E){const O=u(E),{radix:N,prefix:T,uppercase:C,pad:B,group:z,groupSeparator:X,signed:Q,bitWidth:H,nullDisplay:L}=O,Z=H?2**H:0,ee=te=>{if(M(te)||te==="")return L;const se=typeof te=="number"?te:Number(te);if(!Number.isFinite(se))return L;const ne=b(se);let ae="",de=ne;ne<0&&(Q?(ae="-",de=-ne):de=(ne%Z+Z)%Z);let le=de.toString(N);return le=C?le.toUpperCase():le.toLowerCase(),B>0&&le.length<B&&(le=le.padStart(B,"0")),z>0&&(le=a(le,z,X)),ae+T+le};return ee.options=O,ee}function w(E,O){const N=u(O);let T=o.get(N);return T||(T=h(N),o.set(N,T)),T(E)}function v(E){const O=u(E),{radix:N,groupSeparator:T,signed:C,min:B,max:z}=O,X=K[N],Q=H=>{if(M(H))return{ok:!0,value:null,reason:"blank"};let L=String(H);if(T&&T!==""&&(L=L.split(T).join("")),L=L.replace(k,""),L==="")return{ok:!0,value:null,reason:"blank"};let Z=!1;if((L[0]==="-"||L[0]==="+")&&(Z=L[0]==="-",L=L.slice(1)),L==="")return{ok:!1,value:null,reason:"digits"};let ee=null;for(const[se,ne]of S){const ae=se.exec(L);if(!ae)continue;const de=L.slice(ae[0].length);if(de==="")break;if(!K[ne].test(de))return{ok:!1,value:null,reason:"digits"};ee=parseInt(de,ne);break}if(ee===null)if(X.test(L))ee=parseInt(L,N);else if(y.test(L))ee=Number(L);else return{ok:!1,value:null,reason:"digits"};if(!Number.isFinite(ee))return{ok:!1,value:null,reason:"digits"};const te=b(Z?-ee:ee);return!C&&te<0?{ok:!1,value:te,reason:"negative"}:te<B||te>z?{ok:!1,value:te,reason:"range"}:{ok:!0,value:te,reason:"ok"}};return Q.options=O,Q}function A(E,O){const N=u(O);let T=c.get(N);return T||(T=v(N),c.set(N,T)),T(E)}function _(E,O){const N=A(E,O);return N.ok?N.value:null}function V(E,O){const N=M(E)||Number.isNaN(E)?null:Number(E),T=M(O)||Number.isNaN(O)?null:Number(O);return N===null?T===null?0:1:T===null||N<T?-1:N>T?1:0}function Y(E){const O=E.min>=-2147483648&&E.max<=2147483647;return E.bitWidth&&O?"int32":"float64"}function $(E){const O=p(E),N=h(O),T=v(O);return{base:"number",extends:"number",storage:Y(O),matches:null,format:C=>N(C.value),parse:C=>{const B=T(C.text);return B.ok?B.value:null},compare:V,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:C=>N(C),fromClipboard:C=>{const B=T(C);return B.ok?B.value:null},radix:O,formatValue:N,parseText:T}}const j=$}),Be("packages/core/src/columns/types/aggregable.js",function(e,D){"use strict";Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"weightedMean",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"logarithmicSum",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"logarithmicMean",{enumerable:!0,get:function(){return x}});const M=D("packages/core/src/internal/predicates.js").isNil;function G(R){const S=[];for(const k of R||[]){if(M(k))continue;const y=Number(k);Number.isFinite(y)&&S.push(y)}return S}function F(R){return S=>{const k=G(S);if(!k.length)return null;let y=0;for(const l of k)y+=10**(l/R);return R*Math.log10(y)}}function x(R){return S=>{const k=G(S);if(!k.length)return null;let y=0;for(const l of k)y+=10**(l/R);return R*Math.log10(y/k.length)}}function q(R,S){const k=S&&S.column,l=(k&&k.typeOptions||{}).weight,g=S&&S.valueAt;if(!l||typeof g!="function")return null;let i=0,t=0;for(let o=0;o<R.length;o++){if(M(R[o]))continue;const c=Number(R[o]);if(!Number.isFinite(c))continue;const f=g(l,o);if(M(f))continue;const n=Number(f);!Number.isFinite(n)||n<=0||(i+=c*n,t+=n)}return t===0?null:i/t}function W(R={}){const S=R.factor===20?20:10,k=typeof R.suffix=="string"?R.suffix:"",y=Number.isInteger(R.decimals)?R.decimals:1;return{base:"number",storage:"float64",name:R.name||"logarithmic",format:l=>{const g=l&&l.value;return M(g)||!Number.isFinite(Number(g))?"":`${Number(g).toFixed(y)}${k}`},parse:l=>{const g=String((l&&l.text)??"").replace(k,"").trim();if(!g)return null;const i=Number(g);return Number.isFinite(i)?i:null},defaults:{align:"end",filter:"number"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:{sum:F(S),avg:x(S)}}}}function I(R={}){const S=Number.isInteger(R.decimals)?R.decimals:1,k=R.percent===!0;return{base:"number",storage:"float64",name:R.name||"ratio",format:y=>{const l=y&&y.value;return M(l)||!Number.isFinite(Number(l))?"":k?`${Number(l).toFixed(S)}%`:Number(l).toFixed(S)},parse:y=>{const l=String((y&&y.text)??"").replace("%","").trim();if(!l)return null;const g=Number(l);return Number.isFinite(g)?g:null},defaults:{align:"end",filter:"number"},totals:{supported:["avg","min","max","count","countValues"],implement:{avg:q}}}}const K=Object.freeze({decibel:W({name:"decibel",factor:10,suffix:" dB"}),decibelAmplitude:W({name:"decibelAmplitude",factor:20,suffix:" dB"}),ratio:I({name:"ratio"}),percentRate:I({name:"percentRate",percent:!0})})}),Be("packages/core/src/columns/types/currency.js",function(e,D){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"moneyToText",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});const M=D("packages/core/src/internal/predicates.js").isNil,G="⚠ no rate";function F(m){if(M(m))return null;const r=String(m).trim().toUpperCase();return r===""?null:r}function x(m){if(M(m))return null;if(typeof m=="object"&&!Array.isArray(m)){const r=Number(m.amount),s=F(m.code);return!s||!Number.isFinite(r)?null:{amount:r,code:s}}if(Array.isArray(m)&&m.length===2){const r=Number(m[0]),s=F(m[1]);return!s||!Number.isFinite(r)?null:{amount:r,code:s}}return null}const q=Object.freeze({$:"USD","€":"EUR","£":"GBP","¥":"JPY","₹":"INR","₩":"KRW","₽":"RUB","₺":"TRY","₴":"UAH","₪":"ILS"}),W=Object.freeze({USD:"$",EUR:"€",GBP:"£",JPY:"¥",INR:"₹",KRW:"₩",RUB:"₽",TRY:"₺",UAH:"₴",ILS:"₪"}),I=/[+-]?[\d\s., ]*\d/;function K(m,r){const s=String(m).trim();if(s==="")return null;const d=new Intl.NumberFormat(r||void 0).formatToParts(1.1).find(a=>a.type==="decimal")?.value||".",p=d===","?".":",",u=s.split(p).join("").split(/[\s ]/).join("").replace(d,"."),b=Number(u);return Number.isFinite(b)?b:null}function R(m,r){const s=r||{},d=F(s.code);if(M(m))return null;const p=x(m);if(p)return p;if(typeof m=="number")return Number.isFinite(m)&&d?{amount:m,code:d}:null;let u=String(m).trim();if(u==="")return null;let b=!1;u.startsWith("(")&&u.endsWith(")")&&(b=!0,u=u.slice(1,-1).trim());let a=null;for(const[V,Y]of Object.entries(q)){if(u.startsWith(V)){a=Y,u=u.slice(V.length).trim();break}if(u.endsWith(V)){a=Y,u=u.slice(0,-V.length).trim();break}}const h=I.exec(u);if(!h)return null;const w=K(h[0],s.locale);if(w===null)return null;const v=(u.slice(0,h.index)+" "+u.slice(h.index+h[0].length)).trim();!a&&v!==""&&(a=F(v));const A=a||d;return A?{amount:b?-w:w,code:A}:null}function S(m,r){if(typeof m=="function")return(s,d)=>{if(s===d)return 1;const p=m(s,d);return typeof p=="number"&&Number.isFinite(p)&&p>0?p:null};if(m&&typeof m=="object"){const s=m;return(d,p)=>{if(d===p)return 1;const u=Number(s[d]),b=Number(s[p]);return!Number.isFinite(u)||!Number.isFinite(b)||u<=0||b<=0?null:b/u}}return(s,d)=>s===d?1:null}function k(m,r,s){if(!m)return null;if(m.code===r)return m.amount;const d=s(m.code,r);return d===null?null:m.amount*d}const y=new Map;function l(m,r,s){const d=`${m||""}|${r}|${s??""}`;let p=y.get(d);if(!p){const u={style:"currency",currency:r};typeof s=="number"&&(u.minimumFractionDigits=s,u.maximumFractionDigits=s);try{p={fmt:new Intl.NumberFormat(m||void 0,u),currency:!0}}catch{p={fmt:new Intl.NumberFormat(m||void 0,typeof s=="number"?{minimumFractionDigits:s,maximumFractionDigits:s}:{}),currency:!1}}y.set(d,p)}return p}function g(m,r){const s=r||{},d=s.nullDisplay??"",p=x(m);if(!p)return d;const u=F(s.display)||p.code;let b=p.amount,a=p.code;if(u!==p.code){const v=s.rateFn||S(s.rates,s.rateBase),A=k(p,u,v);if(A===null)return`${s.missingRate??G} ${p.code}→${u}`;b=A,a=u}const{fmt:h,currency:w}=l(s.locale,a,s.decimals);return w?h.format(b):`${h.format(b)} ${a}`}function i(m){const r=x(m);return r?`${r.amount} ${r.code}`:""}function t(m){const r=m||{},s=F(r.display),d=r.rateFn||S(r.rates,r.rateBase);return(p,u)=>{const b=x(p),a=x(u);if(!b&&!a)return 0;if(!b)return 1;if(!a)return-1;if(s){const h=k(b,s,d),w=k(a,s,d);if(h!==null&&w!==null)return h===w?0:h<w?-1:1}return b.code===a.code?b.amount===a.amount?0:b.amount<a.amount?-1:1:b.code<a.code?-1:1}}function o(m){const r=m||{},s=(p,u)=>{const b=[];for(const A of p||[]){const _=x(A);_&&b.push(_)}if(!b.length)return null;if(new Set(b.map(A=>A.code)).size===1){const A=b[0].code;return{amount:u(b.map(_=>_.amount)),code:A}}const h=F(r.display);if(!h)return`${r.missingRate??G}: mixed currencies, no display currency set`;const w=r.rateFn||S(r.rates,r.rateBase),v=[];for(const A of b){const _=k(A,h,w);if(_===null)return`${r.missingRate??G}: ${A.code}→${h}`;v.push(_)}return{amount:u(v),code:h}},d=p=>p.reduce((u,b)=>u+b,0);return{sum:p=>s(p,d),avg:p=>s(p,u=>d(u)/u.length),min:p=>s(p,u=>Math.min(...u)),max:p=>s(p,u=>Math.max(...u))}}function c(m){const r=Object.freeze({code:"USD",...m||{}}),s=S(r.rates,r.rateBase),d=Object.freeze({...r,rateFn:s}),p=o(d),u=t(d),b=new Map([[r.locale||"",d]]),a=v=>{const A=v||"";let _=b.get(A);return _||(_=Object.freeze({...d,locale:v||void 0}),b.set(A,_)),_},h=W[F(r.display||r.code)]||"",w=typeof r.decimals=="number"&&r.decimals>0?`.${"0".repeat(r.decimals)}`:".00";return{base:"object",extends:"object",storage:"object",name:"currency",currencyConfig:d,format:v=>g(v.value,v.locale?a(v.locale):d),parse:v=>R(v.text,v.locale?a(v.locale):d),compare:u,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:p},excel:r.excel||(h?`"${h}"#,##0${w}`:`#,##0${w}`),toStorage:v=>{const A=x(v);return A||(typeof v=="string"||typeof v=="number"?R(v,d):null)},toClipboard:v=>i(v),fromClipboard:v=>R(v,d)}}const f=Object.freeze({currency:c({code:"USD"}),usd:c({code:"USD"}),eur:c({code:"EUR"}),gbp:c({code:"GBP"}),jpy:c({code:"JPY",decimals:0})}),n=c}),Be("packages/core/src/columns/types/index.js",function(e,D){"use strict";Object.defineProperty(e,"EXTENDED_TYPES",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return V}});const re=D("packages/core/src/columns/types/temporal.js"),M=re.TEMPORAL_TYPES,G=D("packages/core/src/columns/types/network.js"),F=G.NETWORK_TYPES,x=D("packages/core/src/columns/types/structured.js"),q=x.STRUCTURED_TYPES,W=D("packages/core/src/columns/types/unit.js"),I=W.createUnitType,K=W.UNIT_SYSTEMS,R=W.parseUnit,S=W.formatUnit,k=W.registerUnitSystem,y=W.unitSystemNames,l=W.unitsOf,g=W.defineUnit,i=D("packages/core/src/columns/types/engineering.js"),t=i.ENGINEERING_TYPES,o=D("packages/core/src/columns/types/si.js"),c=o.SI_TYPES,f=o.createSiType,n=o.createSiSystem,m=o.siUnits,r=o.SI_PREFIXES,s=D("packages/core/src/columns/types/temperature.js"),d=s.TEMPERATURE_TYPES,p=s.createTemperatureType,u=s.convertTemperature,b=s.formatTemperature,a=s.parseTemperature,h=s.TEMPERATURE_SCALES,w=D("packages/core/src/columns/types/radix.js"),v=w.createRadixType,A=w.RADIX_PRESETS,_=w.parseRadix,V=w.formatRadix,Y=D("packages/core/src/columns/types/aggregable.js"),$=Y.AGGREGABLE_TYPES,j=D("packages/core/src/columns/types/currency.js"),E=j.CURRENCY_TYPES,O=j.createCurrencyType,N=j.parseMoney,T=j.formatMoney,C=j.convertMoney,B=j.toMoney,z=j.rateFunction,X=j.moneyComparator,Q=j.normaliseCode,H=j.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return W.findUnit}}),Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return i.ENGINEERING_TYPES}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return i.circularMean}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return s.TEMPERATURE_TYPES}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return s.createTemperatureType}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return s.convertTemperature}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return s.formatTemperature}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return s.parseTemperature}}),Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return s.TEMPERATURE_SCALES}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return s.findScale}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return j.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return j.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return j.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return j.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return j.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return j.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return j.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return j.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return j.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return j.MISSING_RATE}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return re.TEMPORAL_TYPES}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return G.NETWORK_TYPES}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return x.STRUCTURED_TYPES}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return Y.AGGREGABLE_TYPES}}),Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return Y.createLogarithmicType}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return Y.createRatioType}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return re.parseTime}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return re.formatTime}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return re.parseDateTime}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return re.formatDateTime}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return re.parseDuration}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return re.formatDuration}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return G.parseIpv4}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return G.formatIpv4}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return G.parseCidr}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return G.formatCidr}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return G.parseIpv6}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return G.formatIpv6}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return G.networkAddress}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return G.broadcastAddress}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return G.hostCount}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return G.containsAddress}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return G.overlaps}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return x.maskValue}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return x.summariseJson}});const L=Object.freeze({...M,...F,...q,...$,hex:v(A.hex),hex8:v(A.hex8),hex16:v(A.hex16),hex32:v(A.hex32),binary:v(A.binary),binary8:v(A.binary8),octal:v(A.octal),bytes:I({system:"data",unit:"B",display:"auto"}),megabytes:I({system:"data",unit:"MB"}),gigabytes:I({system:"data",unit:"GB"}),bitrate:I({system:"bitrate",unit:"Mbps"}),gigabits:I({system:"bitrate",unit:"Gbps"}),...t,...c,...d,...E});{const Z=new Set;for(const ee of[M,F,q,$,t,c,d,E])for(const te of Object.keys(ee)){if(Z.has(te))throw new Error(`[lattice] data type "${te}" is declared twice`);Z.add(te)}}}),Be("packages/core/src/compute/handle.js",function(e,D){"use strict";Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return c}});const re=D("packages/core/src/internal/compare.js"),M=re.collator,G=re.defaultCompare,x=D("packages/core/src/internal/warn.js").warnOnce;function q(f){const n=new Uint32Array(f);for(let m=0;m<f;m++)n[m]=m;return n}function W(f,n){if(n&&typeof n.count=="number")return n.count;if(!f)return 0;if(typeof f.count=="number")return f.count;if(typeof f.length=="number")return f.length;const m=f.values;return f.kind==="multi"&&f.offsets?Math.max(0,f.offsets.length-1):m?f.kind==="bitset"?typeof m.size=="number"?m.size:f.presence&&typeof f.presence.size=="number"?f.presence.size:(x(`count:${f.id}`,`column "${f.id}" is bitset-backed with no declared row count; assuming ${m.length*8}`),m.length*8):m.length:f.presence&&typeof f.presence.size=="number"?f.presence.size:0}const I=new WeakMap;function K(f){const n=f.constructor;if(!n)return"unknown";const m=I.get(n);if(m)return m;let r="unknown";try{let s=null;typeof n.from=="function"?s=n.from([!1,!0]):(s=new n(8),s.set(1));const d=s&&s.words;d&&d.length&&(d[0]===2?r="lsb":d[0]===64&&(r="msb"))}catch{r="unknown"}return I.set(n,r),r}function R(f){if(!f)return()=>0;const n=f instanceof Uint8Array?f:f.words;if(n instanceof Uint8Array){const m=f instanceof Uint8Array?"lsb":K(f);if(m==="lsb")return r=>n[r>>>3]>>>(r&7)&1;if(m==="msb")return r=>n[r>>>3]>>>7-(r&7)&1}return typeof f.get=="function"?m=>f.get(m)?1:0:()=>0}function S(f){return!f||!f.presence?null:R(f.presence)}function k(f){return f?typeof f.size=="number"?f.size:typeof f.values=="function"?f.values().length:0:0}function y(f,n){return f?typeof f.valueOf=="function"?f.valueOf(n):typeof f.values=="function"?f.values()[n]:null:null}function l(f,n){const m=f.offsets,r=f.values;if(!m||!r)return[];const s=m[n],d=m[n+1];if(!(d>s))return[];const p=f.dict,u=new Array(d-s);for(let b=s;b<d;b++)u[b-s]=p?y(p,r[b]):r[b];return u}function g(f){if(!f)return()=>{};const n=f.values,m=S(f),r=f.kind;if(r==="dictionary"){const s=f.dict;return m?d=>m(d)?y(s,n[d]):null:d=>y(s,n[d])}if(r==="bitset"){const s=R(n);return m?d=>m(d)?s(d)===1:null:d=>s(d)===1}if(r==="multi")return m?s=>m(s)?l(f,s):null:s=>l(f,s);if(!n&&typeof f.get=="function"){const s=f.get.bind(f);return d=>{const p=s(d);return p===void 0?null:p}}return m?s=>{if(!m(s))return null;const d=n[s];return d===void 0?null:d}:s=>{const d=n[s];return d===void 0?null:d}}function i(f,n){if(f<n)return-1;if(f>n)return 1;if(f===n){const s=Object.is(f,-0),d=Object.is(n,-0);return s===d?0:s?-1:1}const m=Number.isNaN(f),r=Number.isNaN(n);return m&&r?0:m?1:-1}function t(f){const n=M(f);return(m,r)=>{if(m===r)return 0;const s=typeof m,d=typeof r;if(s==="string"&&d==="string")return n.compare(m,r);if(s==="number"&&d==="number")return i(m,r);if(s==="boolean"&&d==="boolean")return m===r?0:m?1:-1;if(m instanceof Date||r instanceof Date){const p=m instanceof Date?m.getTime():Number(m),u=r instanceof Date?r.getTime():Number(r);return i(p,u)}return G(m,r)}}function o(f,n){if(f&&typeof f.ranks=="function")return f.ranks(n);const m=f&&typeof f.values=="function"?f.values():[],r=m.length,s=t(n),d=new Array(r);for(let u=0;u<r;u++)d[u]=u;d.sort((u,b)=>s(m[u],m[b])||u-b);const p=new Uint32Array(r);for(let u=0;u<r;u++)p[d[u]]=u;return p}function c(f){return f==null||typeof f=="number"&&Number.isNaN(f)}}),Be("packages/core/src/compute/filter.js",function(e,D){"use strict";Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"wallMs",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return de}});const M=D("packages/core/src/internal/predicates.js").isBlank,F=D("packages/core/src/internal/merge.js").toArray,q=D("packages/core/src/internal/warn.js").warnOnce,W=D("packages/core/src/format/date.js"),I=W.toDate,K=W.toIsoDate,R=D("packages/core/src/compute/handle.js"),S=R.bitReader,k=R.dictSize,y=R.dictValue,l=R.presenceReader,g=R.valueComparator,i=R.valueReader,t=/^\d{4}-\d{2}-\d{2}$/,o="\0null\0";function c(le,be){const Ce=le&&le.pool;if(Ce){const Ne=Ce.mask||Ce.acquireMask||Ce.acquire||Ce.take;if(typeof Ne=="function"){const he=Ne.call(Ce,be);if(he&&he.length>=be)return he}}return new Uint8Array(be)}function f(le,be){const Ce=le&&le.pool;if(!Ce||!be)return;const Ne=Ce.release||Ce.releaseMask||Ce.free||Ce.recycle;typeof Ne=="function"&&Ne.call(Ce,be)}function n(le,be,Ce){return le.fill(Ce,0,be),le}function m(le){return le==null||typeof le=="number"&&Number.isNaN(le)}function r(le,be){if(le==null)return le;if(be==="number")return typeof le=="number"?le:Number(le);if(be==="date"||be==="dateString"){const Ce=K(le);return Ce===null?s(le):Ce}return be==="boolean"?typeof le=="boolean"?le:le==="true"||le===1?!0:le==="false"||le===0?!1:!!le:le}function s(le){return le instanceof Date?le.getTime():typeof le=="number"?le:Date.parse(String(le))}function d(le){return typeof le=="number"?le:le instanceof Date?le.getTime():le==null||le===""?NaN:Number(le)}function p(le,be){const Ce=typeof le=="string"?le:String(le);return be?Ce:Ce.toLowerCase()}function u(le,be){return le==null?o:typeof le=="string"?be?le:le.toLowerCase():le instanceof Date?le.getTime():le}function b(le,be,Ce){const Ne=new Set;for(const he of F(le)){const ie=r(he,Ce);Ne.add(u(ie,be)),typeof ie=="string"&&ie!==""&&Number.isFinite(Number(ie))?Ne.add(Number(ie)):typeof ie=="number"&&Number.isFinite(ie)&&Ne.add(u(String(ie),be))}return Ne}function a(le,be,Ce){if(le==null||be===null||be===void 0)return le==null&&be==null;const Ne=typeof le,he=typeof be;return Ne==="string"&&he==="string"?Ce?le===be:le.toLowerCase()===be.toLowerCase():le instanceof Date||be instanceof Date?s(le)===s(be):Ne==="number"&&he==="number"?le===be||Number.isNaN(le)&&Number.isNaN(be):Ne==="number"&&he==="string"?le===Number(be):Ne==="string"&&he==="number"?Number(le)===be:Ne==="boolean"||he==="boolean"?le===be:Array.isArray(le)&&Array.isArray(be)?le.length===be.length&&le.every((ie,ue)=>a(ie,be[ue],Ce)):le===be}function h(le,be){try{if(le instanceof RegExp){const Ce=le.flags.replace(/[gy]/g,"");return new RegExp(le.source,be||Ce.includes("i")?Ce:`${Ce}i`)}return new RegExp(String(le),be?"":"i")}catch(Ce){return q(`regex:${String(le)}`,`filter operator "matches" received an invalid pattern: ${String(le)}`,Ce),null}}function w(le,be){if(le&&le.type==="datetime"&&v.has(le.op))return $(le,be);const Ce=j(le,be),Ne=le&&le.type;return Ne!=="date"&&Ne!=="dateString"?Ce:he=>Ce(typeof he=="string"&&t.test(he)?he:K(he)??he)}const v=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn"]),A=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3})\d*)?)?)?$/,_=new Map;function V(le,be){let Ce=_.get(be);if(Ce===void 0){try{Ce=new Intl.DateTimeFormat("en-CA",{timeZone:be,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{Ce=null}_.set(be,Ce)}if(!Ce)return null;const Ne={};for(const he of Ce.formatToParts(le))he.type!=="literal"&&(Ne[he.type]=he.value);return Ne}function Y(le,be){if(le==null||le==="")return null;if(typeof le=="string"){const ie=A.exec(le.trim());if(ie)return Date.UTC(+ie[1],+ie[2]-1,+ie[3],+(ie[4]||0),+(ie[5]||0),+(ie[6]||0),+(ie[7]||"0").padEnd(3,"0"))}const Ce=I(le);if(!Ce)return null;const Ne=Ce.getUTCMilliseconds(),he=be?V(Ce,be):null;return he?Date.UTC(+he.year,+he.month-1,+he.day,he.hour==="24"?0:+he.hour,+he.minute,+he.second,Ne):Date.UTC(Ce.getFullYear(),Ce.getMonth(),Ce.getDate(),Ce.getHours(),Ce.getMinutes(),Ce.getSeconds(),Ne)}function $(le,be){const Ce=typeof le.timeZone=="string"&&le.timeZone?le.timeZone:void 0,Ne=ue=>Y(ue,Ce),he=Array.isArray(le.value)?le.value.map(Ne):Ne(le.value),ie=j({...le,type:"number",value:he},be);return ue=>ie(Y(ue))}function j(le,be){const Ce=le&&le.op,Ne=!!(le&&le.caseSensitive),he=le&&le.type,ie=g(be),ue=ge=>pe=>!ge(pe);switch(Ce){case"eq":{const ge=r(le.value,he);return pe=>a(pe,ge,Ne)}case"ne":{const ge=r(le.value,he);return pe=>!a(pe,ge,Ne)}case"lt":case"lte":case"gt":case"gte":{const ge=r(le.value,he);if(m(ge))return()=>!1;const pe=Ce==="lt"?-1:Ce==="lte"?0:Ce==="gt"?1:2;return Oe=>{if(m(Oe))return!1;const ve=ie(Oe,ge);return pe===-1?ve<0:pe===0?ve<=0:pe===1?ve>0:ve>=0}}case"between":case"notBetween":{const ge=F(le.value),pe=r(ge[0],he),Oe=r(ge[1],he),ve=le.bounds||"[]",ye=ve.charAt(0)!=="(",Ae=ve.charAt(1)!==")";if(m(pe)||m(Oe))return Ce==="between"?()=>!1:()=>!0;const Me=je=>{if(m(je))return!1;const _e=ie(je,pe),Pe=ie(je,Oe);return(ye?_e>=0:_e>0)&&(Ae?Pe<=0:Pe<0)};return Ce==="between"?Me:ue(Me)}case"in":case"notIn":{const ge=b(le.value,Ne,he),pe=Oe=>ge.has(u(Oe,Ne));return Ce==="in"?pe:ue(pe)}case"contains":case"notContains":{const ge=p(r(le.value,he),Ne),pe=Oe=>Oe==null?!1:p(Oe,Ne).includes(ge);return Ce==="contains"?pe:ue(pe)}case"startsWith":{const ge=p(r(le.value,he),Ne);return pe=>pe==null?!1:p(pe,Ne).startsWith(ge)}case"endsWith":{const ge=p(r(le.value,he),Ne);return pe=>pe==null?!1:p(pe,Ne).endsWith(ge)}case"matches":{const ge=h(le.value,Ne);return ge?pe=>pe==null?!1:ge.test(String(pe)):()=>!1}case"blank":case"notBlank":{const ge=le.trim===!0,pe=Oe=>M(Oe)||Array.isArray(Oe)&&Oe.length===0||ge&&typeof Oe=="string"&&Oe.trim()==="";return Ce==="blank"?pe:Oe=>!pe(Oe)}case"containsAny":case"containsNone":{const ge=b(le.value,Ne,he),pe=Oe=>{const ve=Oe==null?[]:F(Oe);for(let ye=0;ye<ve.length;ye++)if(ge.has(u(ve[ye],Ne)))return!0;return!1};return Ce==="containsAny"?pe:ue(pe)}case"containsAll":{const ge=F(le.value).map(pe=>u(r(pe,he),Ne));return pe=>{const Oe=pe==null?[]:F(pe);if(ge.length===0)return!0;const ve=new Set(Oe.map(ye=>u(ye,Ne)));for(let ye=0;ye<ge.length;ye++)if(!ve.has(ge[ye]))return!1;return!0}}default:{const ge=de(Ce);return ge?ge.compile(le.value):(q(`op:${String(Ce)}`,`unknown filter operator "${String(Ce)}"; the condition is refused rather than matching every row`),()=>!1)}}}function E(le,be,Ce){return w(be,Ce)(le)}const O=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),N=new Set(["containsAny","containsAll","containsNone"]);function T(le,be,Ce){const Ne=le&&le.op,he=O[Ne]||Ne,ie=w({...le,op:he,type:be.type},Ce),ue=be.items,ge=pe=>{const Oe=ue(pe);if(!Oe)return!1;for(let ve=0;ve<Oe.length;ve++)if(ie(Oe[ve]))return!0;return!1};return O[Ne]?pe=>!ge(pe):ge}function C(le,be,Ce,Ne,he){const ie=he?null:l(le);if(ie){const pe=be?1:0;for(let Oe=0;Oe<Ne;Oe++)Ce[Oe]=ie(Oe)===pe?1:0;return Ce}const ue=le.kind;if(ue==="float64"||ue==="int32"||ue==="bitset")return n(Ce,Ne,be?1:0);const ge=i(le);for(let pe=0;pe<Ne;pe++){const Oe=ge(pe),ve=M(Oe)||Array.isArray(Oe)&&Oe.length===0||he&&typeof Oe=="string"&&Oe.trim()==="";Ce[pe]=ve===be?0:1}return Ce}function B(le,be,Ce,Ne){const he=le.dict,ie=k(he),ue=new Uint8Array(ie);for(let ve=0;ve<ie;ve++)ue[ve]=be(y(he,ve))?1:0;const ge=le.values,pe=l(le);if(!pe){for(let ve=0;ve<Ne;ve++)Ce[ve]=ue[ge[ve]];return Ce}const Oe=be(null)?1:0;for(let ve=0;ve<Ne;ve++)Ce[ve]=pe(ve)===1?ue[ge[ve]]:Oe;return Ce}function z(le,be,Ce,Ne){const he=S(le.values),ie=be(!0)?1:0,ue=be(!1)?1:0,ge=l(le);if(!ge){for(let Oe=0;Oe<Ne;Oe++)Ce[Oe]=he(Oe)===1?ie:ue;return Ce}const pe=be(null)?1:0;for(let Oe=0;Oe<Ne;Oe++)Ce[Oe]=ge(Oe)===0?pe:he(Oe)===1?ie:ue;return Ce}function X(le,be,Ce,Ne,he){const ie=le.values,ue=be.type,ge=be.op;let pe=!0;switch(ge){case"eq":case"ne":{const ve=d(r(be.value,ue)),ye=typeof be.value=="number"&&Number.isNaN(be.value),Ae=ge==="ne"?1:0;if(ye)for(let Me=0;Me<he;Me++)Ne[Me]=(Number.isNaN(ie[Me])?1:0)^Ae;else for(let Me=0;Me<he;Me++)Ne[Me]=(ie[Me]===ve?1:0)^Ae;break}case"lt":{const ve=d(r(be.value,ue));for(let ye=0;ye<he;ye++)Ne[ye]=ie[ye]<ve?1:0;break}case"lte":{const ve=d(r(be.value,ue));for(let ye=0;ye<he;ye++)Ne[ye]=ie[ye]<=ve?1:0;break}case"gt":{const ve=d(r(be.value,ue));for(let ye=0;ye<he;ye++)Ne[ye]=ie[ye]>ve?1:0;break}case"gte":{const ve=d(r(be.value,ue));for(let ye=0;ye<he;ye++)Ne[ye]=ie[ye]>=ve?1:0;break}case"between":case"notBetween":{const ve=F(be.value),ye=d(r(ve[0],ue)),Ae=d(r(ve[1],ue)),Me=be.bounds||"[]",je=Me.charAt(0)!=="(",_e=Me.charAt(1)!==")",Pe=ge==="notBetween"?1:0;if(je&&_e)for(let Se=0;Se<he;Se++)Ne[Se]=(ie[Se]>=ye&ie[Se]<=Ae?1:0)^Pe;else if(je)for(let Se=0;Se<he;Se++)Ne[Se]=(ie[Se]>=ye&ie[Se]<Ae?1:0)^Pe;else if(_e)for(let Se=0;Se<he;Se++)Ne[Se]=(ie[Se]>ye&ie[Se]<=Ae?1:0)^Pe;else for(let Se=0;Se<he;Se++)Ne[Se]=(ie[Se]>ye&ie[Se]<Ae?1:0)^Pe;break}case"in":case"notIn":{const ve=new Set;for(const Ae of F(be.value)){const Me=d(r(Ae,ue));Number.isNaN(Me)||ve.add(Me)}const ye=ge==="notIn"?1:0;for(let Ae=0;Ae<he;Ae++)Ne[Ae]=(ve.has(ie[Ae])?1:0)^ye;break}default:pe=!1;break}if(!pe)return!1;const Oe=l(le);if(Oe){const ve=Ce(null)?1:0;for(let ye=0;ye<he;ye++)Oe(ye)===0&&(Ne[ye]=ve)}return!0}function Q(le,be,Ce,Ne){const he=i(le);for(let ie=0;ie<Ne;ie++)Ce[ie]=be(he(ie))?1:0;return Ce}function H(le,be,Ce){const Ne=be.count|0,he=Ce||c(be,Ne);if(!le)return n(he,Ne,1);const ie=typeof be.handle=="function"?be.handle(le.col):void 0,ue=typeof be.custom=="function"?be.custom:null;if(!ie){if(ue){for(let ve=0;ve<Ne;ve++)he[ve]=ue(le,ve)?1:0;return he}return q(`filter:col:${String(le.col)}`,`filter references unknown column "${String(le.col)}"; the condition is refused rather than matching every row`),n(he,Ne,0)}const ge=le.op;if(ge==="blank"||ge==="notBlank")return C(ie,ge==="notBlank",he,Ne,le.trim===!0);const pe=typeof be.itemwise=="function"?be.itemwise(le.col):null;if(pe&&!de(ge)&&!N.has(ge))return Q(ie,T(le,pe,be.locale),he,Ne);const Oe=w(le,be.locale);switch(ie.kind){case"dictionary":return B(ie,Oe,he,Ne);case"bitset":return z(ie,Oe,he,Ne);case"float64":case"int32":return X(ie,le,Oe,he,Ne)?he:Q(ie,Oe,he,Ne);default:return Q(ie,Oe,he,Ne)}}function L(le,be,Ce){if(!le)return n(c(be,Ce),Ce,1);if(Array.isArray(le.conditions)){const Ne=le.conditions.filter(ue=>ue!=null),he=le.op==="or"?"or":le.op==="not"?"not":"and";if(Ne.length===0)return n(c(be,Ce),Ce,1);const ie=L(Ne[0],be,Ce);for(let ue=1;ue<Ne.length;ue++){const ge=L(Ne[ue],be,Ce);if(he==="or")for(let pe=0;pe<Ce;pe++)ie[pe]|=ge[pe];else for(let pe=0;pe<Ce;pe++)ie[pe]&=ge[pe];f(be,ge)}if(he==="not")for(let ue=0;ue<Ce;ue++)ie[ue]^=1;return ie}return H(le,be,c(be,Ce))}function Z(le,be){return L(le,be,be.count|0)}function ee(le,be){if(!le||!be)return le||null;const Ce=le;if(Array.isArray(Ce.conditions)){if((Ce.op==="or"?"or":Ce.op==="not"?"not":"and")!=="and")return te(Ce,be)?null:le;const he=[];for(const ie of Ce.conditions){const ue=ee(ie,be);ue&&he.push(ue)}return he.length?{...Ce,op:"and",conditions:he}:null}return Ce.col===be?null:le}function te(le,be){if(!le||typeof le!="object")return!1;const Ce=le;if(Ce.col===be)return!0;if(Array.isArray(Ce.conditions)){for(const Ne of Ce.conditions)if(te(Ne,be))return!0}return!1}function se(le,be,Ce){if(Ce&&Ce.length>=be){let ue=0;for(let ge=0;ge<be;ge++)le[ge]&&(Ce[ue++]=ge);return Ce.subarray(0,ue)}let Ne=0;for(let ue=0;ue<be;ue++)Ne+=le[ue]?1:0;const he=new Uint32Array(Ne);let ie=0;for(let ue=0;ue<be;ue++)le[ue]&&(he[ie++]=ue);return he}const ne=new Map;function ae(le){if(!(!le||typeof le!="object"))for(const[be,Ce]of Object.entries(le))Ce&&typeof Ce.compile=="function"&&ne.set(be,Ce)}function de(le){return typeof le=="string"?ne.get(le):void 0}}),Be("packages/core/src/columns/datatypes.js",function(e,D){"use strict";Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"parseNumberText",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"BUILTIN_TYPES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return T}});const re=D("packages/core/src/internal/compare.js"),M=re.collator,G=re.defaultCompare,F=D("packages/core/src/internal/predicates.js"),x=F.isNil,q=F.isObject,W=F.isFunction,K=D("packages/core/src/internal/warn.js").fail,S=D("packages/core/src/internal/text.js").titleCase,k=D("packages/core/src/format/date.js"),y=k.toDate,l=k.toIsoDate,g=k.compareIso,t=D("packages/core/src/format/boolean.js").toTriState,c=D("packages/core/src/columns/types/index.js").EXTENDED_TYPES,f=D("packages/core/src/formula/index.js"),n=f.evaluateFormula,m=f.looksLikeFormula,s=D("packages/core/src/compute/filter.js").declareOperators,d=/^\d{4}-\d{2}-\d{2}$/;function p(C){return C.getHours()===0&&C.getMinutes()===0&&C.getSeconds()===0&&C.getMilliseconds()===0}const u=new Map;function b(C){const B=C||"",z=u.get(B);if(z)return z;const X={group:",",decimal:"."};try{for(const Q of new Intl.NumberFormat(C||void 0).formatToParts(12345.6))Q.type==="group"?X.group=Q.value:Q.type==="decimal"&&(X.decimal=Q.value)}catch{}return u.set(B,X),X}const a=/\d\s*[*/^]\s*[\d.(]/;function h(C,B){if(x(C))return null;let z=String(C).trim();if(z===""||z.startsWith("=")||a.test(z))return null;let X=1;z.startsWith("(")&&z.endsWith(")")&&(X=-1,z=z.slice(1,-1));const Q=z.endsWith("%"),{group:H,decimal:L}=b(B);if(z=z.replace(/[\s\u00a0\u202f\u2009']/g,""),H&&H!=="."&&H!==","&&(z=z.split(H).join("")),z=z.replace(/[^0-9eE+\-.,]/g,""),L===","?z=z.split(".").join("").replace(",","."):z=z.split(",").join(""),z===""||z==="-"||z==="+")return null;const Z=Number(z);return Number.isNaN(Z)?null:X*(Q?Z/100:Z)}function w(C,B){const z=x(C)||Number.isNaN(C)?null:Number(C),X=x(B)||Number.isNaN(B)?null:Number(B);return z===null?X===null?0:1:X===null||z<X?-1:z>X?1:0}function v(C,B){const z=t(C),X=t(B);return z===null?X===null?0:1:X===null?-1:z===X?0:z?1:-1}function A(C,B){const z=y(C),X=y(B);if(!z)return X?1:0;if(!X)return-1;const Q=z.getTime(),H=X.getTime();return Q<H?-1:Q>H?1:0}const _=new Map;function V(C){const B=y(C.value);if(!B)return"";const z=C.locale||"";let X=_.get(z);return X||(X=new Intl.DateTimeFormat(C.locale||void 0,{dateStyle:"medium"}),_.set(z,X)),X.format(B)}const Y={boolean:{base:"boolean",storage:"bitset",matches:C=>typeof C=="boolean",parse:C=>t(C.text),compare:v,format:C=>t(C.value)===null?"":t(C.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:C=>t(C)===null?"":String(t(C)),fromClipboard:C=>t(C)},number:{base:"number",storage:"float64",matches:C=>typeof C=="number"&&!Number.isNaN(C),parse:C=>{if(m(C.text)){const B=n(C.text,C);if(!B.ok)return null;const z=Number(B.value);return Number.isFinite(z)?z:null}return h(C.text,C.locale)},compare:w,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:C=>x(C)?"":String(C),fromClipboard:(C,B)=>h(C,B&&B.locale)},date:{base:"dateString",storage:"dictionary",matches:C=>typeof C=="string"&&d.test(C)&&!Number.isNaN(Date.parse(C))||C instanceof Date&&!Number.isNaN(C.getTime())&&p(C),parse:C=>l(C.text),compare:g,format:V,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:C=>l(C),toClipboard:C=>x(C)?"":String(C),fromClipboard:C=>l(C)},dateString:{base:"dateString",storage:"dictionary",matches:C=>typeof C=="string"&&d.test(C)&&!Number.isNaN(Date.parse(C)),parse:C=>l(C.text),compare:g,format:V,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:C=>l(C),toClipboard:C=>x(C)?"":String(C),fromClipboard:C=>l(C)},text:{base:"text",storage:"dictionary",matches:C=>typeof C=="string",parse:C=>C.text===""?null:String(C.text),compare:(C,B)=>x(C)?x(B)?0:1:x(B)?-1:M().compare(String(C),String(B)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:C=>x(C)?"":String(C),fromClipboard:C=>C},image:{base:"text",storage:"dictionary",parse:C=>C.text===""||C.text==null?null:String(C.text).trim(),compare:(C,B)=>x(C)?x(B)?0:1:x(B)?-1:M().compare(String(C),String(B)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:C=>x(C)?"":String(C),fromClipboard:C=>C},lookup:{base:"text",storage:"dictionary",parse:C=>{if(C.text===""||C.text==null)return null;const B=C.column&&C.column.lookup,z=B&&W(B.options)?B.options():null;if(!z)return C.text;const X=String(C.text),Q=z.find(Z=>String(Z.id)===X);if(Q)return Q.id;const H=X.trim().toLowerCase(),L=z.find(Z=>String(Z.label).toLowerCase()===H);return L?L.id:C.text},compare:G,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:C=>x(C)?"":String(C),fromClipboard:C=>C},object:{base:"object",storage:"object",matches:C=>C!==null&&typeof C=="object"&&!(C instanceof Date),parse:C=>{try{return C.text===""?null:JSON.parse(C.text)}catch{return C.text}},compare:(C,B)=>G(C,B),format:C=>{const B=C.value;if(x(B))return"";if(typeof B=="string")return B;try{return JSON.stringify(B)}catch{return String(B)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:C=>x(C)?"":typeof C=="string"?C:JSON.stringify(C),fromClipboard:C=>C}},$=["boolean","number","date","dateString","datetime","text","object"];function j(C,B,z,X){const Q=z.get(C);if(Q)return Q;X.includes(C)&&K(`circular data type extends chain: ${[...X,C].join(" → ")}`);const H=B[C];H||K(`unknown data type "${C}"`);let L=null;H.extends&&(L=j(H.extends,B,z,[...X,C]));const Z={...L||{},...H,name:C,defaults:{...L&&L.defaults||{},...H.defaults||{}}};return Z.base||(Z.base=L&&L.base||"text"),Z.storage||(Z.storage=L&&L.storage||"object"),z.set(C,Z),Z}function E(C,B){const z={...Y,...c};if(B&&typeof B.dataType=="function"&&typeof B.names=="function")for(const Q of B.names("dataType")){const H=B.dataType(Q);H&&(z[Q]=H)}if(q(C))for(const[Q,H]of Object.entries(C))z[Q]=H;const X=new Map;for(const Q of $)j(Q,z,X,[]);j("lookup",z,X,[]);for(const Q of Object.keys(z))j(Q,z,X,[]);for(const Q of X.values())s(Q.operators);return X}function O(C,B){if(C.base==="text"&&(!C.compare||C.compare===Y.text.compare)){const z=M(B);return(X,Q)=>x(X)?x(Q)?0:1:x(Q)?-1:z.compare(String(X),String(Q))}return C.compare||G}function N(C,B){return B?C.multiStorage||"multi":C.storage||"object"}function T(C){return S(String(C).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),Be("packages/core/src/columns/infer.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_SAMPLE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"inferFromValues",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return W}});const M=D("packages/core/src/internal/warn.js").infoOnce,F=D("packages/core/src/internal/predicates.js").isNil,x=100;function q(I,K,R={}){const S=R.sampleSize??x,k=[];for(let y=0;y<I.length&&k.length<S;y++){const l=I[y];F(l)||typeof l=="number"&&Number.isNaN(l)||k.push(l)}if(k.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[y,l]of K){if(typeof l.matches!="function")continue;let g=!0;for(let i=0;i<k.length;i++)if(!l.matches(k[i])){g=!1;break}if(g)return{type:y,unanimous:!0,sampled:k.length}}return R.quiet||M(`infer:${R.colId||"?"}`,`column "${R.colId||"?"}" has mixed or ambiguous values and was inferred as "text". Declare \`type\` on the column to get correct sorting, filtering and export.`),{type:"text",unanimous:!1,sampled:k.length}}function W(I,K,R,S,k={}){const y=k.sampleSize??x,l=[];for(let g=0;g<K.length&&l.length<y;g++){const i=R(K[g]);F(i)||typeof i=="number"&&Number.isNaN(i)||l.push(i)}return q(l,S,{...k,colId:I}).type}}),Be("packages/core/src/columns/graph.js",function(e,D){"use strict";Object.defineProperty(e,"WHOLE_ROW",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"declarationOf",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return S}});const re=D("packages/core/src/internal/warn.js"),M=re.DEV,G=re.fail,F=re.warnOnce,q=D("packages/core/src/internal/predicates.js").isFunction,W="*";function I(k){const y=k.value||{};if(!q(y.compute))return{computed:!1,wholeRow:!1,deps:[],pure:!0};const g=y.pure!==!1;return y.deps===W?{computed:!0,wholeRow:!0,deps:[],pure:g}:Array.isArray(y.deps)?{computed:!0,wholeRow:!1,deps:y.deps.slice(),pure:g}:(F(`deps:missing:${k.id}`,`computed column "${k.id}" declares no \`value.deps\`; treating it as \`deps: '*'\` (a whole-row dependency). Declare the dependencies to get precise invalidation.`),{computed:!0,wholeRow:!0,deps:[],pure:g})}function K(k){const y=new Map;for(const d of k)y.set(d.id,d);const l=new Map,g=new Map,i=new Set,t=new Set,o=new Set,c=new Set;for(const d of k){const p=I(d);if(!p.computed){l.set(d.id,[]);continue}t.add(d.id),(p.pure?o:c).add(d.id),p.wholeRow&&i.add(d.id);const u=[],b=[];for(const a of p.deps)(y.has(a)?u:b).push(a);l.set(d.id,u),b.length&&g.set(d.id,b)}for(const d of o)for(const p of l.get(d))c.has(p)&&G(`pure computed column "${d}" depends on impure column "${p}". Mark it \`value.pure: false\` or make the dependency pure.`);const f=[],n=new Map,m=[],r=d=>{const p=n.get(d);if(p!=="done"){if(p==="open"){const u=m.indexOf(d);G(`circular column dependency: ${[...m.slice(u),d].join(" → ")}`)}n.set(d,"open"),m.push(d);for(const u of l.get(d)||[])y.has(u)&&r(u);m.pop(),n.set(d,"done"),f.push(d)}};for(const d of k)r(d.id);const s=new Map;for(const d of k)s.set(d.id,[]);for(const d of k)for(const p of l.get(d.id)||[]){const u=s.get(p);u&&!u.includes(d.id)&&u.push(d.id)}if(i.size)for(const d of k){if(t.has(d.id))continue;const p=s.get(d.id);for(const u of i)p.includes(u)||p.push(u)}return{order:f,dependents:s,pure:o,impure:c,computed:t,deps:l,wholeRow:i,external:g,index:y}}function R(k,y){const l=Array.isArray(y)?y:[y],g=new Set,i=[...l];for(;i.length;){const t=i.shift();for(const o of k.dependents.get(t)||[])g.has(o)||(g.add(o),i.push(o))}for(const t of l)g.delete(t);return k.order.filter(t=>g.has(t))}function S(k,y,l){if(!M)return k;const g=y instanceof Set?y:new Set(y);return new Proxy(k,{get(i,t){return typeof t=="string"&&!g.has(t)&&!Object.hasOwn(i,t)&&F(`undeclared:${l}:${t}`,`computed column "${l}" read undeclared dependency "${t}". Add it to \`value.deps\` or the value will go stale.`),i[t]}})}}),Be("packages/core/src/model/rowkey.js",function(e,D){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"compositeKey",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"createRowKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"warnMissingKeys",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"groupPathKey",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"splitPathKey",{enumerable:!0,get:function(){return t}});const M=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/internal/paths.js").pathGetter,x=D("packages/core/src/internal/predicates.js"),q=x.isFunction,W=x.isBlank,I=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],K="";function R(o){if(o===null)return"\0n";if(o===void 0)return"\0u";const c=typeof o;if(c==="string")return o;if(c==="number"||c==="bigint"||c==="boolean")return String(o);if(o instanceof Date)return`\0d${o.getTime()}`;try{return`\0o${JSON.stringify(o)}`}catch{return"\0o?"}}function S(o){if(o.length===1)return R(o[0]);let c="";for(let f=0;f<o.length;f++)f&&(c+=K),c+=R(o[f]);return c}function k(o,c={}){const f=c.warn!==!1;if(q(o)){const n=o;return{stable:!0,fields:[],disabled:[],key(m,r){try{const s=n(m);return Array.isArray(s)?S(s):R(s)}catch(s){return M("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",s),`#${r??-1}`}},keyEmpty(m){try{const r=n(m);return Array.isArray(r)?r.length===0||r.some(W):W(r)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(o)&&o.length>0){const n=o.filter(s=>typeof s=="string"),m=n.map(s=>F(s)),r=m.length;return{stable:!0,fields:n,disabled:[],key(s){const d=new Array(r);for(let p=0;p<r;p++)d[p]=m[p](s);return S(d)},keyEmpty(s){for(let d=0;d<r;d++)if(W(m[d](s)))return!0;return!1},missingFields(s){const d=[];for(let p=0;p<r;p++)W(m[p](s))&&d.push(n[p]);return d}}}if(typeof o=="string"&&o.length>0){const n=F(o);return{stable:!0,fields:[o],disabled:[],key(m){return R(n(m))},keyEmpty(m){return W(n(m))},missingFields(m){return W(n(m))?[o]:[]}}}return f&&M("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${I.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:I.slice(),key(n,m){if(n===null||typeof n!="object")return`#${m??0}:${String(n)}`;let r=y.get(n);return r===void 0&&(r=`#${l++}`,y.set(n,r)),r}}}const y=new WeakMap;let l=0;function g(o,c){if(!o||o.stable===!1||!q(o.keyEmpty)||!Array.isArray(c)||c.length===0)return;let f=0,n=null,m;for(let p=0;p<c.length;p++){const u=c[p];o.keyEmpty(u)&&(f++,n===null&&(n=q(o.missingFields)?o.missingFields(u):[],m=u))}if(f===0)return;const r=o.fields.length?o.fields.join(","):"(function)",s=n&&n.length?n.join(", "):o.fields.length?o.fields.join(", "):"the rowKey function",d=m!==null&&typeof m=="object"?Object.keys(m).join(", ")||"(no fields)":String(m);M(`rowKey.emptyValue:${r}`,`rowKey ${s} is missing on ${f} of ${c.length} rows; the first such row has: ${d}. Rows without a key value collapse onto one key, so selection, edits and rows.apply updates land on whichever row now shares it. Set rowKey to a field present on every row, or fix the source data.`)}function i(o){return S(o)}function t(o){return o.split(K)}}),Be("packages/core/src/columns/lookup.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_SEPARATOR",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"normaliseOption",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"Lookup",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"toValueArray",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createLookup",{enumerable:!0,get:function(){return o}});const re=D("packages/core/src/internal/compare.js"),M=re.collator,G=re.defaultCompare,F=D("packages/core/src/internal/predicates.js"),x=F.isFunction,q=F.isNil,I=D("packages/core/src/internal/warn.js").warnOnce,R=D("packages/core/src/model/rowkey.js").compositeKey,S=", ",k="";function y(c,f,n,m){if(c===null||typeof c!="object")return{id:c,label:c==null?"":String(c)};const r=c[f],s=c[n],d={id:r,label:s==null?String(r??""):String(s)};c.disabled&&(d.disabled=!0),c.variant&&(d.variant=c.variant),c.icon&&(d.icon=c.icon);const p=m?c[m]:c.group;return p!==void 0&&(d.group=p),d}function l(c,f,n=0,m=[],r=[]){for(const s of c||[]){const d=s&&typeof s=="object"?s[f]:null;if(r.push({raw:s,depth:n,path:m}),Array.isArray(d)&&d.length){const p=String(s&&typeof s=="object"?s.label??s.name??s.id??"":s);l(d,f,n+1,[...m,p],r)}}return r}function g(c){return!!c&&typeof c=="object"&&!Array.isArray(c)&&x(c.router&&c.router.subscribe)}class i{#e;#t;#n;#r;#i=[];#s=new Map;#o=new Map;#l=0;#a="idle";#c=null;#u;#f=null;#d=new Map;constructor(f,n={}){this.#e=f||{},this.#t=n.colId||"?",this.#n=n.locale,this.#r=n.onChange||null,this.#u=M(this.#n),Array.isArray(this.#e.options)?this.#h(this.#e.options):this.#e.options===void 0&&(this.#a="ready")}get colId(){return this.#t}get version(){return this.#l}get state(){return this.#a}get ready(){return this.#a==="ready"}get multiple(){return this.#e.multiple===!0}get separator(){return this.#e.separator??S}get allowCustom(){return this.#e.allowCustom===!0}get sortBy(){return this.#e.sortBy||"label"}get spec(){return this.#e}options(){return this.#i}setLocale(f){this.#n=f,this.#u=M(f)}#h(f){const n=this.#e,m=n.valueKey||"id",r=n.labelKey||"label",s=n.childrenKey||"children";this.#i=l(f,s).map(d=>{const p=y(d.raw,m,r,n.groupKey);return d.depth&&(p.depth=d.depth,p.path=d.path),p}),this.#s=new Map,this.#o=new Map,this.#i.forEach((d,p)=>{this.#s.set(d.id,d),this.#o.set(d.id,p)}),this.#a="ready",this.#l+=1}load(){if(this.#c)return this.#c;const f=this.#e.options;if(Array.isArray(f)||f===void 0)return this.#c=Promise.resolve(this.#i),this.#c;if(g(f))return this.#c=this.#p(f),this.#c;if(!x(f))return I(`lookup:options:${this.#t}`,`column "${this.#t}" has an invalid \`lookup.options\`; expected an array, a function, or a router route`),this.#a="ready",this.#c=Promise.resolve([]),this.#c;this.#a="loading";let n;try{n=f()}catch(m){return this.#a="error",I(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,m),this.#c=Promise.resolve([]),this.#c}return!n||!x(n.then)?(this.#h(n),this.#c=Promise.resolve(this.#i),this.#r&&this.#r(this),this.#c):(this.#c=n.then(m=>(this.#h(m),this.#r&&this.#r(this),this.#i),m=>(this.#a="error",I(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,m),[])),this.#c)}refresh(){return this.#c=null,Array.isArray(this.#e.options)?(this.#h(this.#e.options),this.#r&&this.#r(this),Promise.resolve(this.#i)):this.load()}#p(f){if(this.#f)return Promise.resolve(this.#i);const n=this.#e,m=n.valueKey||"id",r=n.labelKey||"label",s=n.groupKey,d=x(f.map)?f.map:null,p=b=>y(d?d(b):b,m,r,s).id,u=b=>this.#m(b,d,m,r,s);return f.router.subscribe(f.predicate,u,{rowKey:p}),this.#f=()=>{x(f.router.detach)&&f.router.detach(u)},this.#a="ready",Promise.resolve(this.#i)}#m(f,n,m,r,s){const d=f&&f.add||[],p=f&&f.update||[],u=f&&f.remove||[];if(!(!d.length&&!p.length&&!u.length)){for(const b of d)this.#g(b,n,m,r,s);for(const b of p)this.#g(b,n,m,r,s);for(const b of u){if(!this.#d.has(b))continue;const a=this.#d.get(b);this.#d.delete(b),this.#s.delete(a);const h=this.#i.findIndex(w=>w.id===a);h>=0&&this.#i.splice(h,1)}this.#o=new Map(this.#i.map((b,a)=>[b.id,a])),this.#a="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(f,n,m,r,s){const d=y(n?n(f):f,m,r,s);this.#d.set(R([d.id]),d.id);const p=this.#i.findIndex(u=>u.id===d.id);p>=0?this.#i[p]=d:this.#i.push(d),this.#s.set(d.id,d)}destroy(){this.#f&&(this.#f(),this.#f=null)}search(f,n){const m=this.#e;if(!x(m.search)){const d=String(f||"").toLowerCase();return Promise.resolve(d===""?this.#i:this.#i.filter(p=>p.label.toLowerCase().includes(d)))}const r=m.valueKey||"id",s=m.labelKey||"label";return Promise.resolve(m.search(f,n)).then(d=>(d||[]).map(p=>y(p,r,s,m.groupKey)))}option(f){return this.#s.get(f)}has(f){return this.#s.has(f)}label(f){if(q(f)||f==="")return"";const n=this.#s.get(f);if(n)return n.label;if(this.#a==="loading"||this.#a==="idle")return"";this.allowCustom||I(`lookup:unknown:${this.#t}`,`column "${this.#t}" holds value ${JSON.stringify(f)} which is not in its lookup options. Showing the raw value; set \`lookup.unknownLabel\` or \`lookup.allowCustom\` to change that.`);const m=this.#e.unknownLabel;return x(m)?String(m(f)??""):typeof m=="string"?m:String(f)}text(f){if(this.multiple){const n=t(f);return n.length===0?"":n.map(m=>this.label(m)).join(this.separator)}return this.label(f)}dictionary(){return this.#i.map(f=>f.id)}sorted(){const f=this.sortBy;if(f==="optionOrder"||f==="count")return this.#i.slice();if(f==="value")return this.#i.slice().sort((m,r)=>G(m.id,r.id));const n=this.#u;return this.#i.slice().sort((m,r)=>n.compare(m.label,r.label))}comparator(){const f=this.sortBy,n=this.multiple,m=this.#u,r=this.#o;if(n&&f==="count")return(d,p)=>t(d).length-t(p).length;const s=n?d=>t(d)[0]:d=>d;return f==="value"?(d,p)=>G(s(d),s(p)):f==="optionOrder"?(d,p)=>{const u=r.has(s(d))?r.get(s(d)):Number.MAX_SAFE_INTEGER,b=r.has(s(p))?r.get(s(p)):Number.MAX_SAFE_INTEGER;return u-b}:(d,p)=>{const u=s(d),b=s(p);return q(u)?q(b)?0:1:q(b)?-1:m.compare(this.label(u),this.label(b))}}groupKey(f){return this.multiple?t(f).map(m=>String(m)).sort().join(k):q(f)?"":String(f)}countValues(f){return this.multiple?t(f).length:q(f)?0:1}contains(f,n,m){const r=this.multiple?t(f):q(f)?[]:[f],s=Array.isArray(n)?n:[n];switch(m){case"containsAll":return s.every(d=>r.includes(d));case"containsNone":return!s.some(d=>r.includes(d));default:return s.some(d=>r.includes(d))}}exportText(f,n="label"){return n==="value"?this.multiple?t(f).join(this.separator):q(f)?"":String(f):this.text(f)}exportColumns(){const f=this.multiple;return this.#i.map(n=>({id:n.id,label:n.label,has:m=>f?t(m).includes(n.id):m===n.id}))}}function t(c){return Array.isArray(c)?c:q(c)||c===""?[]:[c]}function o(c,f={}){const n=c.lookup;if(!n)return null;const m=new i(n,{colId:c.id,locale:f.locale,onChange:f.onChange});return!Array.isArray(n.options)&&n.options!==void 0&&m.load(),m}}),Be("packages/core/src/columns/value.js",function(e,D){"use strict";Object.defineProperty(e,"compileDisplay",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"warnImpureUse",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"ValuePipeline",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return i}});const M=D("packages/core/src/internal/paths.js").getPath,G=D("packages/core/src/internal/predicates.js"),F=G.isFunction,x=G.isNil,W=D("packages/core/src/internal/lru.js").Lru,K=D("packages/core/src/internal/warn.js").warnOnce,S=D("packages/core/src/columns/graph.js").depsProxy,k="\0";function y(f,n={}){const m=n.locale,r=n.grid??null,s=n.context,d=f.value&&f.value.format,p=f.formatter||null,u=f.dataType&&f.dataType.format,b=f.lookup||null,a=(h,w,v)=>({value:h,data:v,row:w,column:f,colId:f.id,grid:r,context:s,locale:m});if(F(d))return(h,w,v)=>{const A=d(a(h,w,v));return A==null?"":String(A)};if(p){if(b){const h=p.kind==="text";return(w,v,A)=>p(h?b.text(w):w,a(w,v,A))}return(h,w,v)=>p(h,a(h,w,v))}return F(u)?(h,w,v)=>{const A=u(a(h,w,v));return A==null?"":String(A)}:b?h=>b.text(h):h=>x(h)?"":typeof h=="string"?h:String(h)}function l(f,n){!f||!f.value||f.value.pure!==!1||K(`impure:${n}:${f.id}`,`column "${f.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${n}. The result is not stable across passes.`)}class g{#e;#t;#n;#r;#i;#s;#o=new W(4096);constructor(n){this.#e=n.columns instanceof Map?n.columns:new Map((n.columns||[]).map(m=>[m.id,m])),this.#t=n.graph,this.#n=n.grid??null,this.#r=n.context,this.#s=n.stored||null,this.#i=n.rowKey||i}get graph(){return this.#t}setGraph(n){this.#t=n,this.#o.clear()}beginPass(){this.#o.clear()}endPass(){this.#o.clear()}invalidate(n){if(this.#o.size===0)return;const m=n&&n.rows?new Set([...n.rows].map(String)):null,r=n&&n.columns?[...n.columns]:null;if(!m&&!r){this.#o.clear();return}const s=r?this.#l(r):null;for(const d of[...this.#o.keys()]){const p=String(d).split(k);p.length===3&&(m&&!m.has(p[0])||s&&!s.has(p[2])||this.#o.delete(d))}}#l(n){const m=new Set,r=this.#t,s=[...n];for(;s.length;){const d=s.pop();if(!m.has(d)){m.add(d);for(const p of r?r.dependents.get(d)||[]:[])s.push(p)}}return m}value(n,m,r){const s=typeof n=="string"?this.#e.get(n):n;if(!s)return;if(!s.computed)return this.#c(s,m,r);if(s.value.pure!==!1&&this.#s&&r&&r.physical!=null&&this.#s.has(s.id))return this.#s.get(s.id,r.physical);if(s.volatile)return this.compute(s,m,r);if(s.value.pure===!1)return this.compute(s,m,r);const d=`${this.#a(m,r)}${k}${s.id}`;if(this.#o.has(d))return this.#o.get(d);const p=this.compute(s,m,r);return this.#o.set(d,p),p}#a(n,m){return`${this.#i(n,m)}${k}${t(n)}`}#c(n,m,r){if(this.#s&&r&&r.physical!=null&&this.#s.has(n.id))return this.#s.get(n.id,r.physical);if(n.field)return n.read?n.read(m):M(m,n.field)}compute(n,m,r){const s=this.#t,d=s&&s.wholeRow.has(n.id);let p;if(d)p=m??{};else{p={};const b=s&&s.deps.get(n.id)||[];for(const h of b)p[h]=this.value(h,m,r);const a=s&&s.external.get(n.id)||[];for(const h of a)p[h]=M(m,h);p=S(p,[...b,...a],n.id)}const u={data:m,row:r,column:n,grid:this.#n,context:this.#r};return n.value.compute(p,u)}values(n,m){const r={},s=this.#t?this.#t.order:[...this.#e.keys()];for(const d of s)r[d]=this.value(d,n,m);return r}text(n,m,r){const s=typeof n=="string"?this.#e.get(n):n;return s?s.formatValue(this.value(s,m,r),r,m):""}key(n,m,r){const s=typeof n=="string"?this.#e.get(n):n;if(!s)return"";const d=this.value(s,m,r);return F(s.value.key)?String(s.value.key(this.#u(s,d,m,r))):s.lookup?s.lookup.groupKey(d):x(d)?"":String(d)}quickFilterText(n,m,r){const s=typeof n=="string"?this.#e.get(n):n;if(!s)return"";if(F(s.value.quickFilterText)){const d=this.value(s,m,r);return String(s.value.quickFilterText(this.#u(s,d,m,r))??"")}return this.text(s,m,r)}#u(n,m,r,s){return{value:m,data:r,row:s,column:n,colId:n.id,grid:this.#n,context:this.#r}}parse(n,m,r,s){const d=typeof n=="string"?this.#e.get(n):n;if(!d)return m;const p={text:m,value:this.value(d,r,s),data:r,row:s,column:d,grid:this.#n,context:this.#r,locale:this.#n&&F(this.#n.get)?this.#n.get("locale"):void 0,formulaFunctions:this.#n&&F(this.#n.get)?this.#n.get("formulaFunctions"):void 0};return F(d.value.parse)?d.value.parse(p):d.dataType&&F(d.dataType.parse)?d.dataType.parse(p):m}validate(n,m,r,s,d){const p=typeof n=="string"?this.#e.get(n):n;if(!p||!F(p.edit.validate))return!0;const u=p.edit.validate({value:m,oldValue:r,data:s,row:d,column:p,grid:this.#n,context:this.#r});return u===!0||u===void 0?!0:String(u)}apply(n,m,r,s){const d=typeof n=="string"?this.#e.get(n):n;if(!d)return!1;const p=this.value(d,r,s);if(F(d.value.apply)){const u=d.value.apply({value:m,oldValue:p,data:r,row:s,column:d,grid:this.#n,context:this.#r});return this.#f(d,r,s),u!==!1}return d.field?p===m?!1:(d.write(r,m),this.#f(d,r,s),!0):(K(`apply:${d.id}`,`column "${d.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(n,m,r,s){const d=typeof n=="string"?this.#e.get(n):n;if(!d)return{ok:!1,value:void 0,oldValue:void 0,changed:!1,error:"unknown column"};const p=this.value(d,r,s),u=this.parse(d,m,r,s),b=this.validate(d,u,p,r,s);if(b!==!0)return{ok:!1,value:u,oldValue:p,changed:!1,error:b};const a=this.apply(d,u,r,s);return{ok:!0,value:u,oldValue:p,changed:a}}#f(n,m,r){if(this.#o.size===0)return;const s=this.#a(m,r);this.#o.delete(`${s}${k}${n.id}`);for(const d of this.#t?this.#t.dependents.get(n.id)||[]:[])this.#o.delete(`${s}${k}${d}`)}}function i(f,n){return n&&n.key!=null?String(n.key):t(f)}function t(f){if(f&&typeof f=="object"){let n=o.get(f);return n===void 0&&(n=`#${c++}`,o.set(f,n)),n}return String(f)}const o=new WeakMap;let c=0}),Be("packages/core/src/model/shadow.js",function(e,D){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"HISTORY_TICK_MAX_MS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"HISTORY_TICK_MIN_MS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"CLUSTER_SHADOW_KINDS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"DEFAULT_ANOMALY_THRESHOLD",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"SPEC_STATUS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"POSITIONAL_KINDS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"SHADOW_LABELS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"specStatusOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ShadowTracker",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"shadowsIn",{enumerable:!0,get:function(){return s}});const M=D("packages/core/src/internal/warn.js").warnOnce,G=2e5,F=20,x=1e3,q=50;function W(d){return Math.min(x,Math.max(q,Math.floor(d)))}const I=Object.freeze(["updates","updatedAt","sinceUpdate","delta","deltaPercent","rate","history","firstValue","streak","rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag","specStatus","rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta","fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD","cluster","clusterDistance"]),K=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),R=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),S=Object.freeze(["cluster","clusterDistance"]),k=.6745,y=3.5,l=Object.freeze({PASS:"PASS",WARN:"WARN",FAIL:"FAIL"}),g=Object.freeze(["rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag"]),i=Object.freeze({updates:"Updates",updatedAt:"Updated at",sinceUpdate:"Since update",delta:"Change",deltaPercent:"Change %",rate:"Rate of change",history:"History",firstValue:"Baseline",streak:"Streak",rank:"Rank",rankAsc:"Rank, ascending",rankChange:"Rank change",percentile:"Percentile",quartile:"Quartile",zScore:"Z-score",shareOfTotal:"Share of total",anomalyScore:"Anomaly score",anomalyFlag:"Anomaly",specStatus:"Spec status",rollingSum:"Rolling sum",rollingAvg:"Rolling average",rollingMin:"Rolling minimum",rollingMax:"Rolling maximum",windowCoverage:"Window coverage",cumulativeToDate:"Cumulative to date",periodOverPeriod:"Period over period",rollingQuantile:"Rolling quantile",windowApproximate:"Window approximate",tsTrend:"Trend",tsSeasonal:"Seasonal",tsResidual:"Seasonal residual",tsCoverage:"Decomposition coverage",tsSmoothed:"Smoothed",tsSmoothingAlpha:"Smoothing α",tsSmoothingBeta:"Smoothing β",fitPredicted:"Predicted",fitResidual:"Residual",fitInfluence:"Influence",fitStdResidual:"Std. residual",fitLeverage:"Leverage",fitCooksD:"Cook's D",cluster:"Cluster",clusterDistance:"Cluster distance"});function t(d,p){if(!p)return null;const u=Number.isFinite(Number(p.lower))?Number(p.lower):null,b=Number.isFinite(Number(p.upper))?Number(p.upper):null;if(u===null&&b===null||!Number.isFinite(d))return null;if(u!==null&&d<u||b!==null&&d>b)return l.FAIL;const a=Number.isFinite(Number(p.warnLower))?Number(p.warnLower):null,h=Number.isFinite(Number(p.warnUpper))?Number(p.warnUpper):null;return a!==null&&d<a||h!==null&&d>h?l.WARN:l.PASS}function o(d,p,u){if(!p||typeof p!="object")return null;if(p.kind!=="time")return p.kind!==void 0&&M(`shadow.history.window.kind:${d}`,`a 'history' shadow's 'window' only accepts {kind: 'time', span}; '${p.kind}' is not honoured (a plain count is already what 'depth' means, and a session has no span to divide into buckets), so it reported the original, unwindowed history.`),null;const b=p.minutes!=null?Number(p.minutes)*6e4:Number(p.span);if(!(b>0))return M(`shadow.history.window.span:${d}`,"a 'history' shadow's time window needs a positive 'span' (ms) or 'minutes'; it had none, so it reported the original, unwindowed history."),null;const a=Math.max(2,Math.floor(u)||F);return{span:b,bucketMs:Math.max(1,Math.floor(b/a))}}class c{#e;#t=new Map;#n=new Map;#r=new Map;#i=new Map;#s=new Map;#o=new Map;#l=0;#a;#c;#u;#f;#d=new Map;#h=null;#p=null;#m=null;constructor(p){this.#e=p.colId,this.#a=Math.max(2,p.depth||F),this.#c=Math.max(1,p.max||G),this.#u=p.now||(()=>Date.now()),this.#f=o(this.#e,p.historyWindow,this.#a),this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#f}observe(p,u){const b=r(u);if(b===null)return;if(!this.#n.has(p)){this.#p=null,this.#m=null,this.#g(),this.#t.set(p,b),this.#n.set(p,b),this.#r.set(p,0),this.#i.set(p,this.#u()),this.#s.set(p,[b]),this.#f&&this.#d.set(p,[b]),this.#o.set(p,0);return}const a=this.#n.get(p);if(a===b)return;this.#p=null,this.#m=null,this.#n.set(p,b),this.#r.set(p,(this.#r.get(p)||0)+1),this.#i.set(p,this.#u());const h=this.#s.get(p)||[];h.push(b),h.length>this.#a&&h.splice(0,h.length-this.#a),this.#s.set(p,h);const w=Math.sign(b-a),v=this.#o.get(p)||0;this.#o.set(p,Math.sign(v)===w?v+w:w)}#g(){if(this.#n.size<this.#c)return;const p=this.#n.keys().next().value;p!==void 0&&(this.#t.delete(p),this.#n.delete(p),this.#r.delete(p),this.#i.delete(p),this.#s.delete(p),this.#d.delete(p),this.#o.delete(p),this.#l++)}rebase(){for(const[p,u]of this.#n)this.#t.set(p,u);this.#p=null,this.#m=null}reset(){this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#i.clear(),this.#s.clear(),this.#d.clear(),this.#o.clear(),this.#l=0,this.#p=null,this.#m=null,this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}retain(p){const u=p instanceof Set?p:new Set(p);let b=0;for(const a of[...this.#n.keys()])u.has(a)||(this.#t.delete(a),this.#n.delete(a),this.#r.delete(a),this.#i.delete(a),this.#s.delete(a),this.#d.delete(a),this.#o.delete(a),b++);return b&&(this.#p=null,this.#m=null),b}advanceHistoryWindow(p=this.#u()){const u=this.#f;if(!u)return 0;const b=Math.floor(p/u.bucketMs),a=b-this.#h;if(!(a>0))return 0;const h=Math.min(a,this.#a);for(const[w,v]of this.#d){const A=this.#n.get(w);for(let _=0;_<h;_++)v.push(A);v.length>this.#a&&v.splice(0,v.length-this.#a)}return this.#h=b,a}read(p,u,b,a){switch(p){case"updates":return this.#r.has(u)?this.#r.get(u):0;case"updatedAt":{const h=this.#i.get(u);return h===void 0?null:new Date(h)}case"sinceUpdate":{const h=this.#i.get(u);return h===void 0?null:this.#u()-h}case"firstValue":return this.#t.has(u)?this.#t.get(u):null;case"delta":return this.#n.has(u)?this.#n.get(u)-this.#t.get(u):null;case"deltaPercent":{if(!this.#n.has(u))return null;const h=this.#t.get(u);return h?(this.#n.get(u)-h)/Math.abs(h)*100:null}case"rate":{const h=this.#s.get(u),w=this.#i.get(u);if(!h||h.length<2||w===void 0)return null;const v=this.#u()-w,A=h[h.length-1]-h[h.length-2];return v>0?A/v*1e3:A}case"history":return this.#f?this.#d.has(u)?[...this.#d.get(u)]:null:this.#s.has(u)?[...this.#s.get(u)]:null;case"streak":return this.#o.has(u)?this.#o.get(u):0;case"specStatus":return this.#n.has(u)?t(this.#n.get(u),a):null;default:return g.includes(p)?this.#O(p,u,b,a):null}}#b(p){if(p){if(this.#m&&this.#m.only===p)return this.#m.view;const u=this.#y(p);return this.#m={only:p,view:u},u}return this.#p?this.#p:(this.#p=this.#y(null),this.#p)}#y(p){const u=[];for(const[$,j]of this.#n)p&&!p.has($)||u.push(j);const b=u.sort(($,j)=>$-j);let a=0,h=0,w=0,v=0;for(const $ of b){v+=$,a++;const j=$-h;h+=j/a,w+=j*($-h)}const A=[];for(const[$,j]of this.#t)p&&!p.has($)||A.push(j);const _=a?f(b):0,V=b.map($=>Math.abs($-_)).sort(($,j)=>$-j),Y=a?f(V):0;return{sorted:b,baseline:A.sort(($,j)=>$-j),sum:v,mean:a?h:0,sd:a>1?Math.sqrt(w/(a-1)):0,median:_,mad:Y}}#O(p,u,b,a){if(!this.#n.has(u)||b&&!b.has(u))return null;const h=this.#n.get(u),w=this.#b(b),v=w.sorted.length;if(!v)return null;switch(p){case"rank":return v-m(w.sorted,h)+1;case"rankAsc":return n(w.sorted,h)+1;case"rankChange":{if(!this.#t.has(u)||!w.baseline.length)return null;const A=w.baseline.length-m(w.baseline,this.#t.get(u))+1,_=v-m(w.sorted,h)+1;return A-_}case"percentile":return m(w.sorted,h)/v*100;case"quartile":{const A=m(w.sorted,h)/v;return Math.min(4,Math.max(1,Math.ceil(A*4)))}case"zScore":return w.sd?(h-w.mean)/w.sd:null;case"anomalyScore":return w.mad?k*(h-w.median)/w.mad:null;case"anomalyFlag":{if(!w.mad)return null;const A=a&&Number.isFinite(Number(a.threshold))?Number(a.threshold):y;return Math.abs(k*(h-w.median)/w.mad)>A}case"shareOfTotal":return w.sum?h/w.sum*100:null;default:return null}}}function f(d){const p=d.length;if(!p)return 0;const u=(p-1)*.5,b=Math.floor(u),a=Math.ceil(u);return b===a?d[b]:d[b]+(u-b)*(d[a]-d[b])}function n(d,p){let u=0,b=d.length;for(;u<b;){const a=u+b>>1;d[a]<p?u=a+1:b=a}return u}function m(d,p){let u=0,b=d.length;for(;u<b;){const a=u+b>>1;d[a]<=p?u=a+1:b=a}return u}function r(d){if(d==null||d==="")return null;if(d instanceof Date){const u=d.getTime();return Number.isFinite(u)?u:null}const p=typeof d=="number"?d:Number(d);return Number.isFinite(p)?p:null}function s(d){const p=[];for(const u of d||[]){const b=u.shadow;if(!b)continue;const a=typeof b=="string"?{kind:b}:b,h=a.kind;I.includes(h)&&(K.includes(h)||R.includes(h)||S.includes(h)||p.push({colId:u.id||u.field,of:a.of||u.field||u.id,kind:h,depth:a.depth,historyWindow:h==="history"?a.window:void 0}))}return p}}),Be("packages/core/src/columns/model.js",function(e,D){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return Ce}});const re=D("packages/core/src/internal/merge.js"),M=re.expand,G=re.merge,F=re.toArray,x=D("packages/core/src/internal/warn.js"),q=x.fail,W=x.warnOnce,I=D("packages/core/src/internal/paths.js"),K=I.getPath,R=I.pathGetter,S=I.pathSetter,y=D("packages/core/src/internal/text.js").humanise,l=D("packages/core/src/internal/predicates.js"),g=l.isFunction,i=l.isObject,o=D("packages/core/src/internal/uid.js").uid,f=D("packages/core/src/format/index.js").compileFormat,n=D("packages/core/src/columns/datatypes.js"),m=n.comparatorFor,r=n.createTypeRegistry,s=n.storageKind,d=D("packages/core/src/columns/infer.js"),p=d.inferColumnType,u=d.DEFAULT_SAMPLE,b=D("packages/core/src/columns/graph.js"),a=b.buildGraph,h=b.affectedBy,v=D("packages/core/src/columns/lookup.js").createLookup,A=D("packages/core/src/columns/value.js"),_=A.compileDisplay,V=A.ValuePipeline,Y=A.warnImpureUse,$=D("packages/core/src/model/shadow.js"),j=$.FIT_SHADOW_KINDS,E=$.CLUSTER_SHADOW_KINDS,O=Object.freeze({geometry:"geometry",list:"list"}),N={value:{pure:!0},cell:{},edit:{enabled:!1},sort:{enabled:!0,direction:null,order:0,nullsFirst:!1},filter:{enabled:!0,type:"text"},group:{enabled:!1,index:-1,explode:!1},pivot:{enabled:!1,index:-1},total:null,layout:{width:150,min:40,max:null,flex:0,pin:null,hidden:!1,resizable:!0,movable:!0,lockVisible:!1,lockPosition:!1},header:{},facet:{},export:{lookup:"label",csv:!0,excel:!0},allowGroup:!0,allowPivot:!0,allowTotal:!0,nullable:!0,quickFilter:!0},T={centre:"center"},C=new Set(["start","center","end","left","right"]);function B(he){if(typeof he!="string")return;const ie=he.toLowerCase();return T[ie]?T[ie]:C.has(ie)?ie:void 0}function z(he){if(typeof he!="string")return;const ie=he.toLowerCase();return ie==="center"||ie==="centre"?"middle":ie==="top"||ie==="middle"||ie==="bottom"?ie:void 0}const X=["cell","layout","header"];function Q(he){if(!i(he))return{};const ie={...he},ue=(ge,pe)=>{if(he[ge]===void 0)return;const Oe=M(he[ge],pe);Oe&&X.includes(ge)&&!i(he[ge])&&delete Oe.enabled,ie[ge]=Oe};return ue("sort","direction"),ue("filter","type"),ue("cell","render"),ue("edit","editor"),ue("layout","width"),ue("group","index"),ue("pivot","index"),ue("header","render"),ue("facet","strategy"),ie}function H(he,ie){const ue={...he||{}},ge=i(ie)&&i(ie.layout)&&ie.layout.width!==void 0;return ue.fit==="content"&&!ge&&delete ue.width,ue}const L=new Set(["allowGroup","allowPivot","allowTotal","cell","colSpan","contextMenu","diff","edit","export","facet","field","filter","filterRow","format","grandTotal","group","groupTotal","header","headerControls","id","layout","lookup","nullable","pivot","preset","quickFilter","rowSpan","running","shadow","showWhen","sort","spec","tags","title","total","type","typeOptions","validation","value","verticalAlign"]),Z=new Set(["collapsible","columns","facet","header","id","marryChildren","openByDefault","showWhen","title"]);function ee(he,ie,ue,ge){const pe=ue==="columnGroup"?"column group":"column";for(const Oe of Object.keys(he))if(!ie.has(Oe)){if(Oe==="timeZone"&&ue==="column"){W("column.timeZone",`\`timeZone\` is not a column option, so it had no effect on column "${ge}". A date column stores, displays, sorts and filters in the grid-level \`timeZone\` (else the viewer's); set \`timeZone\` on the grid, not the column.`);continue}W(`${ue}.unknown:${Oe}`,`'${Oe}' is not a configuration key this grid recognises, so it had no effect on ${pe} "${ge}". Check the spelling against the reference.`)}}function te(he){i(he.cell)&&he.cell.autoHeight!==void 0&&W("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${he.id||he.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function se(he,ie){const ue=ie&&g(he.defaultsFor)?he.defaultsFor(ie):null,ge={...he.defaults||{},...i(ue)?ue:{}},pe={};return ge.align&&(pe.align=ge.align,pe.cell={align:ge.align},pe.header={align:ge.align}),ge.filter&&(pe.filter=ge.filter==="none"?{enabled:!1,type:"none"}:{enabled:!0,type:ge.filter}),ge.editor&&(pe.edit=ge.editor==="none"?{editor:null}:{editor:ge.editor}),ge.total&&(pe.total=ge.total),ge.render&&(pe.cell={...pe.cell||{},render:ge.render}),he.export&&(pe.export={...he.export}),pe}function ne(he){if(typeof he=="string")return he.trim()?[he.trim()]:[];if(!Array.isArray(he))return[];const ie=[];for(const ue of he){if(typeof ue!="string")continue;const ge=ue.trim();ge&&!ie.includes(ge)&&ie.push(ge)}return ie}class ae{#e=new Map;#t=[];#n=[];#r=new WeakMap;#i;#s;#o;#l;#a;#c;#u(ie,ue,ge){const pe=this.#f(ie,ue,ge);if(typeof pe!="string"||!this.#d)return pe??null;const Oe=ue&&ue.totals&&ue.totals.implement;if(Oe&&g(Oe[pe])){const ye=Oe[pe];return ye.totalName=pe,ye}const ve=this.#d.totalFn?.(pe);return g(ve)?ve:pe}#f(ie,ue,ge){if(typeof ie!="string")return ie;const pe=ue&&ue.totals&&ue.totals.supported;if(!Array.isArray(pe)||pe.includes(ie))return ie;const Oe=pe.length?pe.join(", "):"none";return q(`column "${ge}" is typed ${ue.name||"a type"}, for which the total "${ie}" is not meaningful. Supported: ${Oe}. Aggregating it anyway would produce a confident wrong number.`),ie}#d;#h;#p;#m;#g;#b;#y=!1;#O;#w;constructor(ie={}){this.#s=Q(ie.columnDefaults||{}),this.#o=ie.columnPresets||{},this.#a=ie.locale,this.#l=ie.timeZone,this.#c=z(ie.verticalAlign),this.#d=ie.registry||null,this.#h=ie.grid||null,this.#p=ie.context,this.#O=ie.sampleSize??u,this.#w=ie.onChange||null,this.#b=g(ie.rowKey)?ie.rowKey:void 0,this.#i=r(ie.dataTypes,this.#d);const{leaves:ue,groups:ge}=Ce(ie.columns||[]);this.#n=ge;for(const pe of ue){pe.facet!==void 0&&this.#r.set(pe.def,pe.facet);const Oe=this.#A(pe.def,null);if(Oe.groupPath=pe.path,this.#e.has(Oe.id)){W(`columns.duplicate:${Oe.id}`,`two columns resolve to the id '${Oe.id}', so the second is ignored. An id defaults to the column's field, so declare an explicit \`id\` when two columns read the same field.`);continue}pe.column=Oe,this.#e.set(Oe.id,Oe),this.#t.push(Oe.id)}this.#P(ie.stored||null)}#A(ie,ue){ee(ie,L,"column",ie.id||ie.field||"(unnamed)"),te(ie);const ge=Q(ie),pe=F(ie.preset),Oe=pe.map(He=>{const Ye=this.#o[He];return Ye?Q(Ye):(W(`preset:${He}`,`unknown column preset "${He}"; ignoring`),{})}),ve=this.#S(ge,Oe,ue),ye=this.#i.get(ve)||this.#i.get("text");if(!this.#i.has(ve)&&ie.type){const He=O[ve];W(`type:${ve}`,`unknown data type "${ve}"; falling back to "text"`+(He?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${He}'.`:""))}const Ae=g(ye.items)?this.#C(ge,Oe,ie.id||ie.field||"(unnamed)"):null;let Me=N;Me=G(Me,this.#s),ie.type!==!1&&(Me=G(Me,se(ye,Ae)));for(const He of Oe)Me=G(Me,He);this.#r.has(ie)&&(Me=G(Me,Q({facet:this.#r.get(ie)}))),Me=G(Me,ge);const je=Me.edit;je&&je.editor&&je.enabled!==!0&&!g(je.enabled)&&(ie.edit||{}).editor&&W(`column.editor-not-enabled:${ie.id||ie.field}`,`column '${ie.id||ie.field}' names the editor '${je.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const _e=ie.id||ie.field||o("col");if(ie.shadow&&!g(Me.value&&Me.value.compute)){const He=typeof ie.shadow=="string"?{kind:ie.shadow}:ie.shadow,Ye=He.of||ie.field||_e,Qe=j.includes(He.kind),lt=E.includes(He.kind),ot=Qe?He.model||He:null,yt=Qe&&ot?[...Array.isArray(ot.predictors)?ot.predictors:[],ot.response].filter(Boolean):null,Ct=lt?(Array.isArray(He.columns)?He.columns:[]).filter(Boolean):null;Me.value={...Me.value||{},deps:Ct&&Ct.length?Ct:yt&&yt.length?yt:He.orderBy&&He.orderBy!==Ye?[Ye,He.orderBy]:[Ye],pure:!1,compute:(Nt,dt)=>{const at=dt.grid&&dt.grid.statistics;if(!at)return null;const bt=dt.row&&dt.row.key||at.keyOf(dt.data);if(!bt)return null;if(Qe){if(!g(at.fitShadow))return null;const Tt=He.model?{...He.model,threshold:He.threshold}:He;return at.fitShadow(He.kind,bt,Tt)}return lt?g(at.clusterShadow)?at.clusterShadow(He.kind,bt,He):null:at.shadow(Ye,He.kind,bt,He.scope,He)}}}if(ie.running&&!g(Me.value&&Me.value.compute)){const He=typeof ie.running=="string"?{kind:ie.running}:ie.running,Ye=He.of||ie.field||_e;Me.value={...Me.value||{},deps:[Ye],pure:!1,compute:(Qe,lt)=>{const ot=lt.grid&<.grid.statistics;if(!ot||!g(ot.running))return null;const yt=lt.row&<.row.key||ot.keyOf(lt.data);return yt?ot.running(Ye,He.kind||"total",yt):null}},ie.sort===void 0&&(Me.sort={...Me.sort||{},enabled:!1})}const Pe=ie.field??(g(Me.value&&Me.value.compute)?null:ie.id??null),Se=g(Me.value&&Me.value.compute),Fe={id:_e,field:Pe,shadow:ie.shadow||null,running:ie.running||null,spec:ie.spec||null,validation:ie.validation||null,volatile:!!(ie.shadow||ie.running),title:Me.title??y(Pe||_e),type:ye.name,dataType:ye,itemType:Ae,nullable:Me.nullable!==!1,align:B(ge.cell&&ge.cell.align||ge.align||Me.cell&&Me.cell.align||Me.align||ye.defaults&&ye.defaults.align)||"start",verticalAlign:z(ge.cell&&ge.cell.verticalAlign||ge.verticalAlign||Me.cell&&Me.cell.verticalAlign||Me.verticalAlign)||this.#c,rowSpan:g(Me.rowSpan)?Me.rowSpan:null,colSpan:g(Me.colSpan)?Me.colSpan:null,value:{pure:!0,...Me.value||{}},cell:{...Me.cell||{}},edit:{...Me.edit||{}},sort:{...Me.sort||{}},filter:{...Me.filter||{}},group:{enabled:!1,index:-1,explode:!1,...Me.group||{}},pivot:{enabled:!1,index:-1,...Me.pivot||{}},total:this.#u(Me.total,ye,ie.id||ie.field||"(unnamed)"),groupTotal:Me.groupTotal===void 0?null:this.#u(Me.groupTotal,ye,ie.id||ie.field||"(unnamed)"),grandTotal:Me.grandTotal===void 0?null:this.#u(Me.grandTotal,ye,ie.id||ie.field||"(unnamed)"),tags:ne(Me.tags),typeOptions:Me.typeOptions??null,...i(Me[ve])?{[ve]:Me[ve]}:{},layout:H(Me.layout,ge),header:{...Me.header||{}},contextMenu:Me.contextMenu===void 0?null:Me.contextMenu,facet:{...Me.facet||{}},export:{...Me.export||{}},allowGroup:Me.allowGroup!==!1,allowPivot:Me.allowPivot!==!1,allowTotal:Me.allowTotal!==!1,quickFilter:Me.quickFilter!==!1,def:ie,format:Me.format,presets:pe,inferred:ue!=null&&!ie.type,computed:Se,diff:ie.diff===void 0?void 0:!!ie.diff,read:Pe?R(Pe):null,write:Pe?S(Pe):null};Fe.cell.align=B(ge.cell&&ge.cell.align)||Fe.align,Fe.header.align=B(ge.header&&ge.header.align)||Fe.align;const We=Me.lookup||null;return Fe.lookup=We?v({id:_e,lookup:We},{locale:this.#a,onChange:()=>{this.#w&&this.#w("lookup",{colId:_e})}}):null,Fe.group.explode&&Fe.lookup&&Fe.lookup.multiple&&W(`explode:${_e}`,`column "${_e}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(Fe),Fe}#v(ie){ie.formatter=f(ie.format,ie.dataType,this.#a,this.#l,ie.id),ie.formatValue=_(ie,{locale:this.#a,grid:this.#h,context:this.#p}),ie.itemCompare=ie.itemType?m(ie.itemType,this.#a):null,ie.compare=g(ie.value.compare)?ie.value.compare:ie.lookup?ie.lookup.comparator():g(ie.dataType.compareFor)?ie.dataType.compareFor(ie):m(ie.dataType,this.#a),ie.excel=ie.formatter&&ie.formatter.ooxml||ie.dataType&&ie.dataType.excel||"General",ie.storeKind=s(ie.dataType,!!(ie.lookup&&ie.lookup.multiple))}#C(ie,ue,ge){let pe=i(ie.typeOptions)?ie.typeOptions:null;for(let Ae=ue.length-1;!pe&&Ae>=0;Ae--)i(ue[Ae].typeOptions)&&(pe=ue[Ae].typeOptions);!pe&&i(this.#s.typeOptions)&&(pe=this.#s.typeOptions);const Oe=pe&&pe.of!==void 0?pe.of:"text",ve=typeof Oe=="string"?this.#i.get(Oe):void 0;return ve&&!g(ve.items)&&ve.storage!=="object"?ve:(W(`type:of:${String(Oe)}`,`column "${ge}" names "${String(Oe)}" as its item type (typeOptions.of), which is not ${ve?"a scalar data type":"a known data type"}; its items are read as text.`),this.#i.get("text"))}#S(ie,ue,ge){if(ie.type===!1)return"text";if(ie.type)return ie.type;for(let pe=ue.length-1;pe>=0;pe--)if(ue[pe].type)return ue[pe].type;if(this.#s.type)return this.#s.type;if(ie.shadow){const pe=typeof ie.shadow=="string"?ie.shadow:ie.shadow.kind;if(pe==="fitInfluence")return"boolean";if(pe==="fitPredicted"||pe==="fitResidual"||pe==="fitStdResidual"||pe==="fitLeverage"||pe==="fitCooksD"||pe==="tsTrend"||pe==="tsSeasonal"||pe==="tsResidual"||pe==="tsCoverage"||pe==="tsSmoothed"||pe==="tsSmoothingAlpha"||pe==="tsSmoothingBeta"||pe==="cluster"||pe==="clusterDistance")return"number"}return ge||(ie.lookup?"lookup":"text")}#P(ie){const ue=this.all();this.#m=a(ue),this.#g?this.#g.setGraph(this.#m):this.#g=new V({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:ie||null,rowKey:this.#b});const ge=this.#g;for(const pe of ue)pe.getValue=(Oe,ve)=>ge.value(pe,Oe,ve)}all(){return this.#t.map(ie=>this.#e.get(ie))}visible(){return this.all().filter(ie=>!ie.layout.hidden)}get(ie){return this.#e.get(ie)}groups(){const ie=ue=>{const ge=[];for(const pe of ue)Array.isArray(pe.columns)?ge.push({...pe,columns:ie(pe.columns)}):pe.column&&ge.push(pe.column);return ge};return ie(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#i}affectedBy(ie){return h(this.#m,ie)}value(ie,ue,ge){return this.#g.value(ie,ue,ge)}text(ie,ue,ge){return this.#g.text(ie,ue,ge)}checkImpure(ie,ue){Y(this.#e.get(ie),ue)}setLocale(ie){this.#a=ie;for(const ue of this.all())ue.lookup&&ue.lookup.setLocale(ie),this.#v(ue);this.#w&&this.#w("locale",{locale:ie})}infer(ie){const ue={};if(this.#y||!Array.isArray(ie)||ie.length===0)return ue;this.#y=!0;let ge=!1;for(const pe of this.all()){const Oe=pe.def;if(Oe.type!==void 0||!pe.field||pe.computed||pe.lookup||this.#E(pe))continue;const ve=pe.read||(Me=>K(Me,pe.field)),ye=p(pe.id,ie,ve,this.#i,{sampleSize:this.#O});if(ye===pe.type)continue;ue[pe.id]=ye;const Ae=this.#A(Oe,ye);Ae.groupPath=pe.groupPath,Ae.layout={...Ae.layout,...de(pe.layout)},this.#e.set(pe.id,Ae),Ne(this.#n,pe.id,Ae),ge=!0}return ge&&this.#P(null),ue}redecorate(ie,ue,ge={}){const pe=this.#e.get(ie);if(!pe){W(`redecorate:${ie}`,`columns.decorate('${ie}', …): no column with id '${ie}'.`);return}const Oe=pe.def||{},ve={...i(Oe.cell)?Oe.cell:{}};ve.decoration=ue??void 0,ge&&"variant"in ge&&(ve.variant=ge.variant);const ye={...Oe,cell:ve};this.#r.has(Oe)&&this.#r.set(ye,this.#r.get(Oe));const Ae=this.#A(ye,pe.type);return Ae.groupPath=pe.groupPath,Ae.layout={...Ae.layout,...de(pe.layout)},pe.lookup&&pe.lookup!==Ae.lookup&&g(pe.lookup.destroy)&&pe.lookup.destroy(),this.#e.set(ie,Ae),Ne(this.#n,ie,Ae),this.#P(null),this.#w&&this.#w("decorate",{colId:ie}),Ae}destroy(){for(const ie of this.#e.values())ie.lookup&&g(ie.lookup.destroy)&&ie.lookup.destroy()}#E(ie){for(const ue of ie.presets){const ge=this.#o[ue];if(ge&&ge.type)return!0}return!!this.#s.type}#T(ie){return!ie.computed&&g(ie.dataType&&ie.dataType.toStorage)}storeReader(ie){if(ie.computed)return ue=>this.#g.value(ie,ue,null);if(this.#T(ie)){const ue=ie.dataType.toStorage,ge={timeZone:this.#l,colId:ie.id,itemType:ie.itemType||null};return pe=>ue(ie.read(pe),ge)}return ie.read}storeValue(ie,ue){if(!(!ie||ie.computed)&&g(ie.read))return this.storeReader(ie)(ue)}storeSchema(){const ie=[];for(const ue of this.all()){if(ue.computed&&ue.value.pure===!1||!ue.computed&&!ue.field)continue;const ge=this.storeReader(ue);let pe=null;!ue.computed&&!this.#T(ue)&&typeof ue.field=="string"&&!ue.lookup&&(pe=ue.field);const Oe={id:ue.id,kind:ue.storeKind,nullable:ue.nullable,read:ge};pe!==null&&(Oe.field=pe),ue.lookup&&(Oe.dictionary=ue.lookup.dictionary()),ie.push(Oe)}return ie}state(){return this.all().map(ie=>({id:ie.id,width:ie.layout.width,flex:ie.layout.flex||void 0,hidden:!!ie.layout.hidden,headerWrap:ie.header?.wrap===!0?!0:void 0,headerOrientation:ie.header?.orientation==="vertical"?"vertical":void 0,pin:ie.layout.pin??null,sort:ie.sort.direction??null,sortIndex:ie.sort.direction?ie.sort.order??0:null,groupIndex:ie.group.enabled?ie.group.index??0:null,pivotIndex:ie.pivot.enabled?ie.pivot.index??0:null,total:typeof ie.total=="string"?ie.total:null,groupTotal:typeof ie.groupTotal=="string"?ie.groupTotal:void 0,grandTotal:typeof ie.grandTotal=="string"?ie.grandTotal:void 0,decoration:ie.cell&&ie.cell.decoration!=null?le(ie.cell.decoration):void 0,variant:ie.cell&&ie.cell.variant!=null?le(ie.cell.variant):void 0}))}applyState(ie,ue={}){const ge={applied:[],skipped:[]},pe=Array.isArray(ie)?ie:ie&&ie.columns||[],Oe=!Array.isArray(ie)&&ie&&ie.columnOrder||null;for(const ye of pe){if(!ye||!ye.id){ge.skipped.push({key:"?",reason:"no id"});continue}let Ae=this.#e.get(ye.id);if(!Ae){ge.skipped.push({key:ye.id,reason:"unknown column"});continue}if(Object.hasOwn(ye,"decoration")||Object.hasOwn(ye,"variant")){const Me=Ae.cell?Ae.cell.decoration:void 0,je=ye.decoration??null,_e=Object.hasOwn(ye,"variant"),Pe=_e&&!be(Ae.cell?Ae.cell.variant:void 0,ye.variant);(!be(Me,je)||Pe)&&(this.redecorate(ye.id,je,_e?{variant:ye.variant??void 0}:{}),Ae=this.#e.get(ye.id)||Ae)}ye.width!=null&&(Ae.layout.width=ye.width),ye.flex!=null&&(Ae.layout.flex=ye.flex),ye.hidden!=null&&(Ae.layout.hidden=!!ye.hidden),ye.headerWrap!==void 0&&(Ae.header.wrap=!!ye.headerWrap),ye.headerOrientation!==void 0&&(Ae.header.orientation=ye.headerOrientation==="vertical"?"vertical":"horizontal"),ye.pin!==void 0&&(Ae.layout.pin=ye.pin),ye.sort!==void 0&&(Ae.sort.direction=ye.sort),ye.sortIndex!=null&&(Ae.sort.order=ye.sortIndex),ye.groupIndex!=null&&(Ae.group.enabled=!0,Ae.group.index=ye.groupIndex),ye.pivotIndex!=null&&(Ae.pivot.enabled=!0,Ae.pivot.index=ye.pivotIndex),ye.total!==void 0&&(Ae.total=ye.total),ye.groupTotal!==void 0&&(Ae.groupTotal=ye.groupTotal),ye.grandTotal!==void 0&&(Ae.grandTotal=ye.grandTotal),ge.applied.push(ye.id)}const ve=Oe||(ue&&ue.keepOrder?[]:pe.map(ye=>ye&&ye.id).filter(Boolean));if(ve.length){const ye=ve.filter(Me=>this.#e.has(Me)),Ae=this.#t.filter(Me=>!ye.includes(Me));this.#t=[...ye,...Ae]}return this.#w&&this.#w("state",ge),ge}move(ie,ue){this.#M(ie,ue)&&(this.#R(),this.#w&&this.#w("move",{id:ie,to:ue}))}reorder(ie){const ue={applied:[],skipped:[]},ge=[];let pe=0;for(const Oe of Array.isArray(ie)?ie:[]){const ve=pe++;this.#M(Oe,ve)&&(ue.applied.push(Oe),ge.push({id:Oe,to:ve}))}if(!ge.length)return ue;if(this.#R(),this.#w)for(const Oe of ge)this.#w("move",Oe);return ue}#M(ie,ue){const ge=this.#t.indexOf(ie);if(ge===-1||Math.max(0,Math.min(Number(ue)||0,this.#t.length-1))===ge)return!1;const Oe=this.#e.get(ie);if(Oe.layout.movable===!1||Oe.layout.lockPosition)return W(`move:${ie}`,`column "${ie}" is not movable; the move was ignored`),!1;const ve=this.#N(ie,ue);return ve?(W(`move.married:${ve}`,`band "${ve}" declares marryChildren, so its columns stay together; the move was ignored`),!1):(this.#t.splice(ge,1),this.#t.splice(Math.max(0,Math.min(ue,this.#t.length)),0,ie),!0)}#N(ie,ue){if(!this.#n||!this.#n.length)return null;const ge=this.#t.filter(ye=>ye!==ie),pe=Math.max(0,Math.min(ue,ge.length)),Oe=(ye,Ae)=>{if(Array.isArray(ye.columns)){for(const je of ye.columns)Oe(je,Ae);return Ae}const Me=ye.column?ye.column.id:ye.id;return Me&&Ae.push(Me),Ae},ve=ye=>{for(const Ae of ye){if(!Array.isArray(Ae.columns))continue;if(Ae.marryChildren===!0){const je=Oe(Ae,[]),_e=je.includes(ie),Pe=je.map(Se=>ge.indexOf(Se)).filter(Se=>Se>=0);if(Pe.length){const Se=Math.min(...Pe),Fe=Math.max(...Pe);if(_e?pe<Se||pe>Fe+1:pe>Se&&pe<=Fe)return Ae.id}}const Me=ve(Ae.columns);if(Me)return Me}return null};return ve(this.#n)}#R(){const ie=new Map(this.#t.map((pe,Oe)=>[pe,Oe])),ue=pe=>{if(!Array.isArray(pe.columns)){const ve=pe.column?pe.column.id:pe.id;return ie.has(ve)?ie.get(ve):1/0}let Oe=1/0;for(const ve of pe.columns)Oe=Math.min(Oe,ue(ve));return Oe},ge=pe=>{pe.sort((Oe,ve)=>ue(Oe)-ue(ve));for(const Oe of pe)Array.isArray(Oe.columns)&&ge(Oe.columns)};ge(this.#n)}#F(ie){const ue=ge=>{for(let pe=0;pe<ge.length;pe++){const Oe=ge[pe];if(Array.isArray(Oe.columns)){const ve=ue(Oe.columns);if(ve)return ve}else if(Oe.column&&Oe.column.id===ie)return ge.splice(pe,1)[0]}return null};return ue(this.#n)}#V(ie){const ue=[];for(let ge=ie.length-1;ge>=0;ge--){const pe=ie[ge];Array.isArray(pe.columns)&&(ue.push(...this.#V(pe.columns)),pe.columns.length===0&&(ue.push(pe.id),ie.splice(ge,1)))}return ue}#W(){const ie=(ue,ge,pe)=>{for(const Oe of ue)Array.isArray(Oe.columns)?ie(Oe.columns,[...ge,Oe.id]):Oe.column&&(Oe.column.groupPath=ge)};ie(this.#n,[])}#L(ie){const ue=new Set(ie),ge=this.#t.filter(ye=>ue.has(ye));if(!ge.length)return;const pe=Math.min(...ge.map(ye=>this.#t.indexOf(ye))),Oe=this.#t.slice(0,pe).filter(ye=>!ue.has(ye)),ve=this.#t.slice(pe).filter(ye=>!ue.has(ye));this.#t=[...Oe,...ge,...ve]}#q(ie){const ue=[],ge=pe=>{if(Array.isArray(pe.columns))for(const Oe of pe.columns)ge(Oe);else pe.column&&ue.push(pe.column.id)};return ge(ie),ue}#B(ie){const ue=ge=>{for(const pe of ge){if(!Array.isArray(pe.columns))continue;if(pe.id===ie)return{node:pe,parent:ge};const Oe=ue(pe.columns);if(Oe)return Oe}return null};return ue(this.#n)}groupColumns(ie,ue={}){const ge=F(ie).filter(Ae=>this.#e.has(Ae));if(!ge.length)return W("columns.group.empty","groupColumns was given no known column ids; nothing was grouped."),null;for(const Ae of ge)if(this.#e.get(Ae).layout.lockPosition)return W(`columns.group.locked:${Ae}`,`column "${Ae}" is position-locked and cannot be grouped.`),null;const pe=ue.groupId?this.#B(ue.groupId):null;if(ue.groupId&&!pe)return W(`columns.group.unknown:${ue.groupId}`,`no band "${ue.groupId}" to add to; nothing was grouped.`),null;let Oe=null;if(!pe&&ue.id!=null&&(Oe=String(ue.id),this.#B(Oe)||this.#e.has(Oe)))return W(`columns.group.idtaken:${Oe}`,`band id "${Oe}" is already in use; nothing was grouped.`),null;const ve=ge.map(Ae=>this.#F(Ae)).filter(Boolean);if(!ve.length)return null;let ye;if(pe)pe.node.columns.push(...ve),ye=pe.node.id;else{const Ae={id:Oe||o("grp"),title:ue.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:ve},Me=Number.isInteger(ue.at)?Math.max(0,Math.min(ue.at,this.#n.length)):this.#n.length;this.#n.splice(Me,0,Ae),ye=Ae.id}return this.#V(this.#n),this.#L(ge),this.#W(),this.#R(),this.#w&&this.#w("columngroup",{action:"formed",groupId:ye,ids:ge}),ye}ungroupColumn(ie){const ue=this.#e.get(ie);if(!ue){W(`columns.ungroup.unknown:${ie}`,`no column "${ie}" to ungroup.`);return}const ge=ue.groupPath||[];if(!ge.length)return;const pe=ge[ge.length-1],Oe=this.#B(pe);if(!Oe)return;const ve=this.#F(ie);if(!ve)return;const ye=Oe.parent.indexOf(Oe.node);Oe.parent.splice(ye+1,0,ve);const Ae=this.#V(this.#n),Me=this.#q(Oe.node);if(Me.length){this.#L(Me);const je=Math.max(...Me.map(Pe=>this.#t.indexOf(Pe))),_e=this.#t.filter(Pe=>Pe!==ie);_e.splice(je+1,0,ie),this.#t=_e}this.#W(),this.#R(),this.#w&&this.#w("columngroup",{action:"removed",id:ie,dissolved:Ae})}renameGroup(ie,ue){const ge=this.#B(ie);if(!ge){W(`columns.group.rename:${ie}`,`no band "${ie}" to rename.`);return}ge.node.title=String(ue??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:ie,title:ge.node.title})}dissolveGroup(ie){const ue=this.#B(ie);if(!ue){W(`columns.group.dissolve:${ie}`,`no band "${ie}" to dissolve.`);return}const ge=ue.parent.indexOf(ue.node);ue.parent.splice(ge,1,...ue.node.columns),this.#W(),this.#R(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:ie})}moveGroup(ie,ue){const ge=this.#B(ie);if(!ge){W(`columns.group.move:${ie}`,`no band "${ie}" to move.`);return}const pe=ge.parent,Oe=pe.indexOf(ge.node);Oe!==-1&&(pe.splice(Oe,1),pe.splice(Math.max(0,Math.min(ue,pe.length)),0,ge.node),this.#Y(),this.#W(),this.#w&&this.#w("columngroup",{action:"moved",groupId:ie,to:ue}))}#Y(){const ie=[],ue=pe=>{for(const Oe of pe)Array.isArray(Oe.columns)?ue(Oe.columns):Oe.column&&ie.push(Oe.column.id)};ue(this.#n);const ge=new Set(ie);this.#t=[...ie,...this.#t.filter(pe=>!ge.has(pe))]}groupTree(){const ie=ge=>ge.map(pe=>Array.isArray(pe.columns)?{id:pe.id,title:pe.title||"",collapsible:!!pe.collapsible,openByDefault:pe.openByDefault!==!1,columns:ie(pe.columns)}:pe.column?pe.column.id:null).filter(pe=>pe!==null),ue=ie(this.#n);return ue.some(ge=>ge&&typeof ge=="object")?ue:[]}applyGroupTree(ie){if(!Array.isArray(ie))return;const ue=new Set,ge=Oe=>{const ve=[];for(const ye of Oe)if(ye&&typeof ye=="object"&&Array.isArray(ye.columns)){const Ae=ge(ye.columns);if(!Ae.length)continue;ve.push({id:ye.id||o("grp"),title:ye.title||"",collapsible:ye.collapsible===!0,openByDefault:ye.openByDefault!==!1,showWhen:"always",marryChildren:!1,header:{},def:{},columns:Ae})}else if(typeof ye=="string"){const Ae=this.#e.get(ye);Ae&&!ue.has(ye)&&(ue.add(ye),ve.push({column:Ae,path:[]}))}return ve},pe=ge(ie);for(const Oe of this.#t){if(ue.has(Oe))continue;const ve=this.#e.get(Oe);ve&&pe.push({column:ve,path:[]})}this.#n=pe,this.#W(),this.#R(),this.#w&&this.#w("columngroup",{action:"applied"})}show(ie){this.#G(ie,!1)}hide(ie){this.#G(ie,!0)}#G(ie,ue){const ge=[];for(const pe of F(ie)){const Oe=this.#e.get(pe);if(Oe){if(ue&&Oe.layout.lockVisible){W(`lockVisible:${pe}`,`column "${pe}" is \`layout.lockVisible\` and cannot be hidden`);continue}Oe.layout.hidden!==ue&&(Oe.layout.hidden=ue,ge.push(pe))}}ge.length&&this.#w&&this.#w("visible",{ids:ge,hidden:ue})}pin(ie,ue){const ge=this.#e.get(ie);ge&&(ge.layout.pin=ue??null,this.#w&&this.#w("pin",{id:ie,side:ge.layout.pin}))}pinMany(ie){const ue={};for(const[pe,Oe]of ie){const ve=this.#e.get(pe);ve&&(ve.layout.pin=Oe??null,ue[pe]=ve.layout.pin)}const ge=Object.keys(ue);ge.length&&this.#w&&this.#w("pin",{ids:ge,pins:ue})}#D(ie,ue){const ge=ie.layout.min??0,pe=ie.layout.max;let Oe=Math.max(ge,ue);return pe!=null&&(Oe=Math.min(pe,Oe)),ie.layout.width=Oe,ie.layout.flex=0,Oe}resize(ie,ue){const ge=this.#e.get(ie);if(!ge)return;if(ge.layout.resizable===!1){W(`resize:${ie}`,`column "${ie}" is not resizable; the resize was ignored`);return}const pe=this.#D(ge,ue);this.#w&&this.#w("resize",{id:ie,width:pe})}resizeMany(ie){const ue={};for(const[pe,Oe]of ie){const ve=this.#e.get(pe);if(ve){if(ve.layout.resizable===!1){W(`resize:${pe}`,`column "${pe}" is not resizable; the resize was ignored`);continue}ue[pe]=this.#D(ve,Oe)}}const ge=Object.keys(ue);ge.length&&this.#w&&this.#w("resize",{ids:ge,widths:ue})}}function de(he){const ie={};return he.width!=null&&(ie.width=he.width),he.hidden!=null&&(ie.hidden=he.hidden),he.pin!==void 0&&(ie.pin=he.pin),ie}function le(he){if(he===null||typeof he!="object")return he;try{return structuredClone(he)}catch{}try{return JSON.parse(JSON.stringify(he))}catch{return he}}function be(he,ie){const ue=he??null,ge=ie??null;if(ue===ge)return!0;if(ue===null||ge===null)return!1;if(typeof ue!="object"||typeof ge!="object")return ue===ge;try{return JSON.stringify(ue)===JSON.stringify(ge)}catch{return!1}}function Ce(he){const ie=[],ue=(pe,Oe,ve)=>{const ye=[];for(const Ae of pe){if(!i(Ae)){q("a column definition must be an object");continue}if(Array.isArray(Ae.columns)){ee(Ae,Z,"columnGroup",Ae.title||Ae.id||"(unnamed)");const Me={id:Ae.id||o("grp"),title:Ae.title||"",collapsible:Ae.collapsible===!0,openByDefault:Ae.openByDefault!==!1,showWhen:Ae.showWhen||"always",marryChildren:Ae.marryChildren===!0,header:Ae.header||{},def:Ae,columns:[]};Me.columns=ue(Ae.columns,[...Oe,Me.id],Ae.facet!==void 0?Ae.facet:ve),ye.push(Me)}else{const Me={def:Ae,path:Oe,facet:ve};ie.push(Me),ye.push(Me)}}return ye},ge=ue(he,[],void 0);return{leaves:ie,groups:ge}}function Ne(he,ie,ue){for(const ge of he){if(ge.columns){if(Ne(ge.columns,ie,ue))return!0;continue}if(ge.column&&ge.column.id===ie)return ge.column=ue,!0}return!1}}),Be("packages/core/src/columns/autogroup.js",function(e,D){"use strict";Object.defineProperty(e,"AUTO_GROUP_ID",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createAutoGroupColumn",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"warnOnAbsurdGrouping",{enumerable:!0,get:function(){return K}});const M=D("packages/core/src/internal/warn.js").warnOnce,G="__lattice_group",F=240,x=.5;function q(R){const S=R.def&&R.def.layout;return(typeof S=="number"||S&&S.width!=null||R.def&&R.def.width!=null)&&Number.isFinite(R.layout.width)?R.layout.width:null}function W(R){const S=R.def&&R.def.layout;return!!(S&&S.min!=null)||R.def&&R.def.minWidth!=null}function I(R){const{columns:S,groupBy:k}=R,y=k.map(c=>S.get(c)).filter(Boolean),l=y.length?y.map(c=>c.title||c.id).join(" > "):"Group",g=y.find(c=>q(c)!=null),i=R.config&&R.config.autoGroupColumnWidth||(g?q(g):F);let t=g&&W(g)?g.layout.min:120;g&&!W(g)&&(t=Math.min(t,i));const o=g&&g.layout.max!=null?g.layout.max:null;return{id:G,field:null,title:l,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group"},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!0},groupedIds:k.slice(),group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:i,min:t,max:o,pin:R.config&&R.config.autoGroupColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(c,f){return f&&f.group?f.groupValue:null},formatValue(c,f){if(!f||!f.group)return"";if(f.grandTotal)return R.config&&R.config.grandTotalLabel||"Total";const n=y[Math.min(f.level||0,y.length-1)];return n&&typeof n.formatValue=="function"?n.formatValue(c,f):c==null?"":String(c)}}}function K(R,S,k){!R.length||k<100||S<k*x||M(`grouping.cardinality:${R.join(",")}`,`grouping by ${R.join(", ")} produced ${S} groups for ${k} rows: nearly one group per row. Grouping a continuous value such as a percentage or a timestamp rarely reads usefully; consider a computed banding column.`)}}),Be("packages/core/src/columns/selectcolumn.js",function(e,D){"use strict";Object.defineProperty(e,"SELECT_COLUMN_ID",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"createSelectionColumn",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return F}});const re="__lattice_select",M=44;function G(x){const q=x.selection||{},W=x.config&&x.config.selectionColumnWidth||M;return{id:re,field:null,title:"",type:"boolean",dataType:{base:"boolean"},nullable:!1,align:"center",generated:!0,control:!0,value:{pure:!0},cell:{render:"checkbox",props:{mode:"selection"},align:"center"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:W,min:W,max:W,pin:x.config&&x.config.selectionColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,headerCheckbox:q.headerCheckbox===!0,def:{},getValue(I,K){return K?K.selected:!1},formatValue(){return""}}}const F=G}),Be("packages/core/src/columns/rownumbercolumn.js",function(e,D){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createRowNumberColumn",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return K}});const M=D("packages/core/src/internal/predicates.js").isFunction,G="__lattice_rownumber",F=40,x=9,q=22;function W(R){const S=String(Math.max(1,Math.trunc(Math.abs(R))||1)).length;return Math.max(F,S*x+q)}function I(R){const S=R.rowNumbers,k=S&&typeof S=="object"?S:{},y=Number.isFinite(k.start)?k.start:1,l=Number.isFinite(k.width)?k.width:W((R.maxNumber||0)+y),g=M(R.rank)?R.rank:()=>null;return{id:G,field:null,title:typeof k.title=="string"?k.title:"",type:"number",dataType:{base:"number"},nullable:!0,align:"end",generated:!0,control:!0,value:{pure:!0},cell:{align:"end"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:l,min:l,max:l,pin:"start",hidden:!1,resizable:k.width==null,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(i,t){const o=g(t);return o==null?null:o-1+y},formatValue(i){return i==null?"":String(i)}}}const K=I}),Be("packages/core/src/model/detail.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_DETAIL_HEIGHT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DEFAULT_CACHE_LIMIT",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"DetailModel",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return K}});const M=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce,x=240,q=10;function W(R){if(!R)return null;const S=R===!0?{}:R;return S.enabled===!1?null:!M(S.rows)&&!S.render?(F("detail.rows","detail is enabled but neither `rows` nor `render` was supplied; expanding a master would show an empty region, so it stays off."),null):{render:S.render||null,config:S.config||null,rows:M(S.rows)?S.rows:null,height:S.height??x,maxHeight:S.maxHeight??null,cacheLimit:Number.isFinite(S.cacheLimit)?Math.max(0,S.cacheLimit):q,isMaster:M(S.isMaster)?S.isMaster:null,target:S.target||null,onCreate:M(S.onCreate)?S.onCreate:null,path:typeof S.path=="string"?S.path:null}}class I{#e;#t=new Set;#n;#r=0;constructor(S){this.#e=S.config,this.#n=M(S.onChange)?S.onChange:()=>{}}get config(){return this.#e}get inline(){return!this.#e.target}isMaster(S){if(!S||S.group||S.detail)return!1;const k=this.#e.isMaster;return k?!!k(S.data,S):!0}isOpen(S){return this.#t.has(S)}keys(){return[...this.#t]}activeKey(){for(const S of this.#t)return S;return null}heightOf(S){const k=this.#e.height;return M(k)?Number(k(S))||x:k==="auto"?x:Number(k)||x}open(S){return this.#t.has(S)?!1:(this.inline||this.#t.clear(),this.#t.add(S),this.#i(),!0)}close(S){return this.#t.delete(S)?(this.#i(),!0):!1}toggle(S){return this.#t.has(S)?(this.close(S),!1):(this.open(S),!0)}closeAll(){this.#t.size&&(this.#t.clear(),this.#i())}prune(S){if(!this.#t.size||!M(S))return;let k=!1;for(const y of[...this.#t])S(y)||(this.#t.delete(y),k=!0);k&&this.#i()}signature(){return`${this.#r}`}set(S){this.#t.clear();const k=Array.isArray(S)?S:[];for(const y of this.inline?k:k.slice(0,1))this.#t.add(y);this.#i()}#i(){this.#r++,this.#n()}}const K=I}),Be("packages/core/src/compute/special.js",function(e,D){"use strict";Object.defineProperty(e,"logGamma",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"incompleteBeta",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"normalQuantile",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"normalCdf",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"studentT",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"chiSquareUpperTail",{enumerable:!0,get:function(){return i}});const re=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),M=3e-12,G=1e-300;function F(t){if(t<.5)return Math.log(Math.PI/Math.sin(Math.PI*t))-F(1-t);const o=t-1;let c=.9999999999998099;const f=o+7.5;for(let n=0;n<re.length;n++)c+=re[n]/(o+n+1);return .5*Math.log(2*Math.PI)+(o+.5)*Math.log(f)-f+Math.log(c)}function x(t,o,c){const f=t+o,n=t+1,m=t-1;let r=1,s=1-f*c/n;Math.abs(s)<G&&(s=G),s=1/s;let d=s;for(let p=1;p<=300;p++){const u=2*p;let b=p*(o-p)*c/((m+u)*(t+u));s=1+b*s,Math.abs(s)<G&&(s=G),r=1+b/r,Math.abs(r)<G&&(r=G),s=1/s,d*=s*r,b=-(t+p)*(f+p)*c/((t+u)*(n+u)),s=1+b*s,Math.abs(s)<G&&(s=G),r=1+b/r,Math.abs(r)<G&&(r=G),s=1/s;const a=s*r;if(d*=a,Math.abs(a-1)<M)break}return d}function q(t,o,c){if(!(t>0)||!(o>0)||!Number.isFinite(c))return Number.NaN;if(c<=0)return 0;if(c>=1)return 1;const f=Math.exp(F(t+o)-F(t)-F(o)+t*Math.log(c)+o*Math.log(1-c));return c<(t+1)/(t+o+2)?f*x(t,o,c)/t:1-f*x(o,t,1-c)/o}function W(t){if(!(t>0)||!(t<1))return t===0?-1/0:t===1?1/0:Number.NaN;const o=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],c=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],f=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],n=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],m=.02425;let r,s,d;t<m?(r=Math.sqrt(-2*Math.log(t)),d=(((((f[0]*r+f[1])*r+f[2])*r+f[3])*r+f[4])*r+f[5])/((((n[0]*r+n[1])*r+n[2])*r+n[3])*r+1)):t<=1-m?(r=t-.5,s=r*r,d=(((((o[0]*s+o[1])*s+o[2])*s+o[3])*s+o[4])*s+o[5])*r/(((((c[0]*s+c[1])*s+c[2])*s+c[3])*s+c[4])*s+1)):(r=Math.sqrt(-2*Math.log(1-t)),d=-(((((f[0]*r+f[1])*r+f[2])*r+f[3])*r+f[4])*r+f[5])/((((n[0]*r+n[1])*r+n[2])*r+n[3])*r+1));const u=(.5*I(-d/Math.SQRT2)-t)*Math.sqrt(2*Math.PI)*Math.exp(d*d/2);return d-u/(1+d*u/2)}function I(t){const o=Math.abs(t),c=2/(2+o),f=4*c-2,n=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,15626441722e-18,-85238095915e-18,6529054439e-18,5059343495e-18,-991364156e-18,-227365122e-18,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18];let m=0,r=0,s;for(let p=n.length-1;p>0;p--)s=r,r=f*r-m+n[p],m=s;const d=c*Math.exp(-o*o+.5*(n[0]+f*r)-m);return t>=0?d:2-d}function K(t){return .5*I(-t/Math.SQRT2)}function R(t,o){if(!(o>0)||!Number.isFinite(t))return Number.NaN;const c=.5*q(o/2,.5,o/(o+t*t));return t>0?1-c:c}function S(t,o){if(!(t>0)||!(t<1)||!(o>0))return Number.NaN;if(o>1e7)return W(t);let c=-1e4,f=1e4,n=W(t);const m=F(o/2)+F(.5)-F((o+1)/2);for(let r=0;r<60;r++){const s=R(n,o);s<t?c=n:f=n;const d=Math.exp(-((o+1)/2)*Math.log(1+n*n/o)-m)/Math.sqrt(o),p=d>0?(s-t)/d:0;if(Math.abs(p)<1e-12)break;const u=n-p;if(n=u>c&&u<f&&Number.isFinite(u)?u:(c+f)/2,f-c<1e-12)break}return n}function k(t,o){let c=t,f=1/t,n=f;for(let m=0;m<300&&(c+=1,n*=o/c,f+=n,!(Math.abs(n)<Math.abs(f)*M));m++);return f*Math.exp(-o+t*Math.log(o)-F(t))}function y(t,o){let c=o+1-t,f=1/G,n=1/c,m=n;for(let r=1;r<=300;r++){const s=-r*(r-t);c+=2,n=s*n+c,Math.abs(n)<G&&(n=G),f=c+s/f,Math.abs(f)<G&&(f=G),n=1/n;const d=n*f;if(m*=d,Math.abs(d-1)<M)break}return Math.exp(-o+t*Math.log(o)-F(t))*m}function l(t,o){return!(t>0)||!(o>=0)||!Number.isFinite(o)?Number.NaN:o===0?0:o<t+1?k(t,o):1-y(t,o)}function g(t,o){return o>0?l(o/2,t/2):Number.NaN}function i(t,o){const c=g(t,o);return Number.isNaN(c)?Number.NaN:Math.min(1,Math.max(0,1-c))}}),Be("packages/core/src/compute/linalg.js",function(e,D){"use strict";Object.defineProperty(e,"cholesky",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"choleskySolve",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"choleskyInverse",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"normalEquations",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return q}});function re(W){const I=W.length,K=Array.from({length:I},()=>new Array(I).fill(0));for(let R=0;R<I;R++)for(let S=0;S<=R;S++){let k=W[R][S];for(let y=0;y<S;y++)k-=K[R][y]*K[S][y];if(R===S){if(!(k>0))return null;K[R][S]=Math.sqrt(k)}else K[R][S]=k/K[S][S]}return K}function M(W,I){const K=W.length,R=new Array(K).fill(0);for(let k=0;k<K;k++){let y=I[k];for(let l=0;l<k;l++)y-=W[k][l]*R[l];R[k]=y/W[k][k]}const S=new Array(K).fill(0);for(let k=K-1;k>=0;k--){let y=R[k];for(let l=k+1;l<K;l++)y-=W[l][k]*S[l];S[k]=y/W[k][k]}return S}function G(W){const I=W.length,K=Array.from({length:I},()=>new Array(I).fill(0));for(let R=0;R<I;R++){const S=new Array(I).fill(0);S[R]=1;const k=M(W,S);for(let y=0;y<I;y++)K[y][R]=k[y]}return K}function F(W,I,K){const R=W.length,S=R?W[0].length:0,k=Array.from({length:S},()=>new Array(S).fill(0)),y=new Array(S).fill(0);for(let l=0;l<R;l++){const g=K?K[l]:1,i=W[l];for(let t=0;t<S;t++){const o=g*i[t];y[t]+=o*I[l];for(let c=t;c<S;c++)k[t][c]+=o*i[c]}}for(let l=0;l<S;l++)for(let g=0;g<l;g++)k[l][g]=k[g][l];return{xtwx:k,xtwy:y}}function x(W,I){return W.map(K=>K.reduce((R,S,k)=>R+S*I[k],0))}function q(W,I){let K=0;for(let R=0;R<W.length;R++){let S=0;for(let k=0;k<W.length;k++)S+=I[R][k]*W[k];K+=W[R]*S}return K}}),Be("packages/core/src/compute/sketch.js",function(e,D){"use strict";Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return k}});class re{#e=0;#t=0;#n=0;static get errorBound(){return Object.freeze({kind:"exact",metric:"none",value:0,statement:"mean and variance match a full recompute to float rounding"})}get count(){return this.#e}add(l){if(!Number.isFinite(l))return;this.#e++;const g=l-this.#t;this.#t+=g/this.#e,this.#n+=g*(l-this.#t)}merge(l){if(l.#e===0)return;if(this.#e===0){this.#e=l.#e,this.#t=l.#t,this.#n=l.#n;return}const g=this.#e+l.#e,i=l.#t-this.#t;this.#t+=i*(l.#e/g),this.#n+=l.#n+i*i*(this.#e*l.#e/g),this.#e=g}mean(){return this.#e?this.#t:null}variance(){return this.#e>1?this.#n/(this.#e-1):null}varianceP(){return this.#e?this.#n/this.#e:null}stddev(){const l=this.variance();return l===null?null:Math.sqrt(l)}stddevP(){const l=this.varianceP();return l===null?null:Math.sqrt(l)}}class M{#e=[];#t=0;#n;#r;constructor(l,g=Math.random){if(!(l>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(l),this.#r=g}static get errorBound(){return Object.freeze({kind:"probabilistic",metric:"none",value:0,statement:"uniform sample: each element included with probability capacity/n; sample statistics are unbiased estimators"})}get seen(){return this.#t}get size(){return this.#e.length}add(l){if(!Number.isFinite(l))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(l);return}const g=Math.floor(this.#r()*this.#t);g<this.#n&&(this.#e[g]=l)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let l=0;for(const g of this.#e)l+=g;return l/this.#e.length}quantile(l){const g=this.#e.length;if(!g)return null;const i=this.#e.slice().sort((f,n)=>f-n);if(g===1)return i[0];const t=(g-1)*Math.min(1,Math.max(0,l)),o=Math.floor(t),c=Math.ceil(t);return o===c?i[o]:i[o]+(t-o)*(i[c]-i[o])}}function G(y){return y^=y>>>16,y=Math.imul(y,2246822507),y^=y>>>13,y=Math.imul(y,3266489909),y^=y>>>15,y>>>0}function F(y){if(typeof y=="number"){const i=new DataView(new ArrayBuffer(8));return i.setFloat64(0,y===0?0:y),G(i.getUint32(0)^i.getUint32(4))}const l=typeof y=="string"?y:String(y);let g=2166136261;for(let i=0;i<l.length;i++)g^=l.charCodeAt(i),g=Math.imul(g,16777619);return G(g)}class x{#e;#t;#n;constructor(l=14){const g=Math.floor(l);if(g<4||g>16)throw new RangeError("HLL precision must be 4..16");this.#e=g,this.#t=1<<g,this.#n=new Uint8Array(this.#t)}static errorBoundFor(l=14){const g=1<<Math.floor(l),i=1.04/Math.sqrt(g);return Object.freeze({kind:"probabilistic",metric:"relative",value:i,statement:`distinct count within ~${(i*100).toFixed(2)}% relative standard error (m=${g} buckets)`})}errorBound(){return x.errorBoundFor(this.#e)}add(l){const g=F(l),i=g&this.#t-1,t=g>>>this.#e|1<<32-this.#e;let o=1,c=t;for(;(c&1)===0;)o++,c>>>=1;o>this.#n[i]&&(this.#n[i]=o)}count(){const l=this.#t,g=32-this.#e,i=new Float64Array(g+2);for(let c=0;c<l;c++)i[this.#n[c]]++;let t=l*I(1-i[g+1]/l);for(let c=g;c>=1;c--)t=.5*(t+i[c]);t+=l*W(i[0]/l);const o=q*l*l/t;return Math.round(o)}}const q=.5/Math.log(2);function W(y){if(y===1)return 1/0;let l=1,g=y,i;do y*=y,i=g,g+=y*l,l+=l;while(g!==i);return g}function I(y){if(y===0||y===1)return 0;let l=1,g=1-y,i;do y=Math.sqrt(y),i=g,l*=.5,g-=(1-y)**2*l;while(g!==i);return g/3}class K{#e=new Map;#t;#n=0;constructor(l){if(!(l>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(l)}errorBoundFor(l){const g=l/this.#t;return Object.freeze({kind:"deterministic",metric:"absolute",value:g,statement:`each count overestimates the truth by at most N/m = ${g.toFixed(2)} (N=${l}, m=${this.#t})`})}get seen(){return this.#n}add(l){this.#n++;const g=this.#e.get(l);if(g){g.count++;return}if(this.#e.size<this.#t){this.#e.set(l,{count:1,error:0});return}let i,t=1/0;for(const[o,c]of this.#e)c.count<t&&(t=c.count,i=o);this.#e.delete(i),this.#e.set(l,{count:t+1,error:t})}top(l=this.#t){return[...this.#e.entries()].map(([i,t])=>({item:i,count:t.count,error:t.error})).sort((i,t)=>t.count-i.count).slice(0,Math.max(0,Math.floor(l)))}}class R{#e;#t=[[]];#n=0;#r;#i;constructor(l=200,g=Math.random){this.#e=Math.max(8,Math.floor(l)),this.#r=g,this.#i=2/3}static errorBoundFor(l=200){const g=1/Math.max(8,Math.floor(l));return Object.freeze({kind:"probabilistic",metric:"rank",value:g,statement:`queried quantile's true rank within ~${(g*100).toFixed(2)}% of N of the requested rank (k=${l})`})}errorBound(){return R.errorBoundFor(this.#e)}get count(){return this.#n}#s(l){const i=this.#t.length-1-l,t=Math.ceil(this.#e*this.#i**i);return Math.max(2,t)}add(l){Number.isFinite(l)&&(this.#n++,this.#t[0].push(l),this.#t[0].length>=this.#s(0)&&this.#o(0))}#o(l){const g=this.#t[l];g.sort((o,c)=>o-c),l+1>=this.#t.length&&this.#t.push([]);const i=this.#t[l+1],t=this.#r()<.5?0:1;for(let o=t;o<g.length;o+=2)i.push(g[o]);this.#t[l]=[];for(let o=0;o<this.#t.length;o++)if(this.#t[o].length>=this.#s(o)){this.#o(o);return}}#l(){const l=[];for(let g=0;g<this.#t.length;g++){const i=1<<g;for(const t of this.#t[g])l.push({v:t,w:i})}return l}quantile(l){const g=this.#l();if(!g.length)return null;g.sort((c,f)=>c.v-f.v);let i=0;for(const c of g)i+=c.w;const t=Math.min(1,Math.max(0,l))*i;let o=0;for(const c of g)if(o+=c.w,o>=t)return c.v;return g[g.length-1].v}rank(l){let g=0;for(let i=0;i<this.#t.length;i++){const t=1<<i;for(const o of this.#t[i])o<=l&&(g+=t)}return g}}const S=Object.freeze({distinct:x.errorBoundFor(14),median:R.errorBoundFor(200),p25:R.errorBoundFor(200),p75:R.errorBoundFor(200),p90:R.errorBoundFor(200),p95:R.errorBoundFor(200),p99:R.errorBoundFor(200),iqr:R.errorBoundFor(200),topK:Object.freeze({kind:"deterministic",metric:"absolute",value:0,statement:"each count overestimates the truth by at most N/m; top-K exact when the K-th item exceeds N/m"})}),k={Welford:re,Reservoir:M,HyperLogLog:x,SpaceSaving:K,KLL:R,hash32:F,SKETCH_BOUNDS:S}}),Be("packages/core/src/compute/statistics.js",function(e,D){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"numbers",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"frequencies",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"herfindahl",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"entropy",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"evenness",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"topShare",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"gini",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"moments",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"quantileSorted",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"quantile",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"STAT_FNS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"modifiedZOutliers",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"jarqueBera",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"weightedQuantile",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"covariance",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return be}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return he}}),Object.defineProperty(e,"autocorrelations",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"spearman",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(e,"kendall",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"seriesStats",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(e,"D2_N2",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"D4_N2",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"movingRanges",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(e,"withinSigma",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(e,"countOutside",{enumerable:!0,get:function(){return We}}),Object.defineProperty(e,"histogram",{enumerable:!0,get:function(){return He}}),Object.defineProperty(e,"DEFAULT_CONFIDENCE",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(e,"meanInterval",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(e,"proportionInterval",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(e,"slopeInterval",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(e,"capabilityInterval",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(e,"standardizedMeanDifference",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(e,"normalTotalVariation",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(e,"frequencyMap",{enumerable:!0,get:function(){return at}}),Object.defineProperty(e,"categoricalDistance",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(e,"SUBSET_RELIABILITY_FLOOR",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(e,"compareColumn",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(e,"isNumericColumn",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"populationRead",{enumerable:!0,get:function(){return $e}});const re=D("packages/core/src/compute/handle.js"),M=re.presenceReader,G=re.valueReader,F=D("packages/core/src/compute/special.js"),x=F.studentTQuantile,q=F.studentT,W=F.normalQuantile,I=F.normalCdf,K=F.chiSquareUpperTail,R=D("packages/core/src/compute/linalg.js"),S=R.cholesky,k=R.choleskySolve,y=R.choleskyInverse,l=R.normalEquations,g=R.quadForm,t=D("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,o=5e3,c=Object.freeze({variance:"rescan",varianceP:"rescan",stddev:"rescan",stddevP:"rescan",sumSquares:"rescan",weightedAvg:"rescan",median:"rescan",p25:"rescan",p75:"rescan",p90:"rescan",p95:"rescan",p99:"rescan",iqr:"rescan",mode:"rescan",distinct:"rescan",range:"rescan",skewness:"rescan",kurtosis:"rescan",geomean:"rescan",harmean:"rescan",mad:"rescan",argmin:"rescan",argmax:"rescan",hhi:"rescan",entropy:"rescan",evenness:"rescan",top3Share:"rescan",top10Share:"rescan",gini:"rescan",trimmedMean:"rescan",winsorizedMean:"rescan",robustOutliers:"rescan",jarqueBera:"rescan",passRate:"rescan",failureCount:"rescan"}),f=Object.freeze({distinct:Object.freeze({sketch:"HyperLogLog",bound:t.distinct}),median:Object.freeze({sketch:"KLL",bound:t.median}),p25:Object.freeze({sketch:"KLL",bound:t.p25}),p75:Object.freeze({sketch:"KLL",bound:t.p75}),p90:Object.freeze({sketch:"KLL",bound:t.p90}),p95:Object.freeze({sketch:"KLL",bound:t.p95}),p99:Object.freeze({sketch:"KLL",bound:t.p99}),iqr:Object.freeze({sketch:"KLL",bound:t.iqr}),top3Share:Object.freeze({sketch:"SpaceSaving",bound:t.topK}),top10Share:Object.freeze({sketch:"SpaceSaving",bound:t.topK})});function n(me){const Ee=me==="sum"||me==="avg"||me==="countValues"||me==="min"||me==="max"?"maintained":Object.prototype.hasOwnProperty.call(c,me)?c[me]:null,we=Object.prototype.hasOwnProperty.call(f,me)?f[me]:null;return{stat:me,exact:Ee,approximate:we}}function m(me,Ee){const we=Ee.length,Te=new Float64Array(we);let Le=0;if(me&&(me.kind==="float64"||me.kind==="int32")){const ze=me.values,Ge=M(me);for(let tt=0;tt<we;tt++){const it=Ee[tt];if(Ge&&Ge(it)!==1)continue;const ut=ze[it];Number.isNaN(ut)||(Te[Le++]=ut)}return Te.subarray(0,Le)}const Ue=G(me);for(let ze=0;ze<we;ze++){const Ge=Ue(Ee[ze]);if(Ge==null||Ge==="")continue;const tt=typeof Ge=="number"?Ge:Number(Ge);Number.isFinite(tt)&&(Te[Le++]=tt)}return Te.subarray(0,Le)}function r(me,Ee){const we=new Map,Te=G(me);let Le=0;for(let Ue=0;Ue<Ee.length;Ue++){const ze=Te(Ee[Ue]);if(ze==null||ze===""||typeof ze=="number"&&Number.isNaN(ze))continue;const Ge=typeof ze=="object"?String(ze):ze;we.set(Ge,(we.get(Ge)||0)+1),Le++}const xe=[...we.values()].sort((Ue,ze)=>ze-Ue);return{counts:xe,total:Le,distinct:xe.length}}function s(me){return me.total>0?me.counts.map(Ee=>Ee/me.total):[]}function d(me,Ee){const we=r(me,Ee);if(!we.total)return null;let Te=0;for(const Le of s(we))Te+=Le*Le;return Te}function p(me,Ee){const we=r(me,Ee);if(!we.total)return null;let Te=0;for(const Le of s(we))Le>0&&(Te-=Le*Math.log2(Le));return Te}function u(me,Ee){const we=r(me,Ee);if(!we.total||we.distinct<2)return we.total?1:null;let Te=0;for(const Le of s(we))Le>0&&(Te-=Le*Math.log2(Le));return Te/Math.log2(we.distinct)}function b(me,Ee,we=3){const Te=r(me,Ee);if(!Te.total)return null;const Le=Math.max(1,Math.floor(we));let xe=0;for(let Ue=0;Ue<Math.min(Le,Te.counts.length);Ue++)xe+=Te.counts[Ue];return xe/Te.total}function a(me,Ee){const we=m(me,Ee),Te=we.length;if(!Te)return null;const Le=we.slice().sort();if(Le[0]<0)return null;let xe=0,Ue=0;for(let ze=0;ze<Te;ze++)xe+=Le[ze],Ue+=(ze+1)*Le[ze];return xe===0?0:2*Ue/(Te*xe)-(Te+1)/Te}function h(me){let Ee=0,we=0,Te=0;for(let Le=0;Le<me.length;Le++){const xe=me[Le];Ee++;const Ue=xe-we;we+=Ue/Ee,Te+=Ue*(xe-we)}return{n:Ee,mean:we,m2:Te}}function w(me,Ee){const we=me.length;if(!we)return NaN;if(we===1)return me[0];const Te=(we-1)*Math.min(1,Math.max(0,Ee)),Le=Math.floor(Te),xe=Math.ceil(Te);return Le===xe?me[Le]:me[Le]+(Te-Le)*(me[xe]-me[Le])}function v(me,Ee){if(!me.length)return NaN;const we=me.slice().sort();return w(we,Ee)}function A(me,Ee){const we=G(me);let Te=0,Le=0,xe=0;for(let Ue=0;Ue<Ee.length;Ue++){const ze=we(Ee[Ue]);if(ze==null||ze==="")continue;const Ge=String(ze).toUpperCase();Ge==="PASS"?Te++:Ge==="FAIL"?Le++:Ge==="WARN"&&xe++}return{pass:Te+xe,fail:Le,warn:xe,judged:Te+xe+Le}}const _=Object.freeze({hhi:(me,Ee)=>d(me,Ee),entropy:(me,Ee)=>p(me,Ee),evenness:(me,Ee)=>u(me,Ee),top3Share:(me,Ee)=>b(me,Ee,3),top10Share:(me,Ee)=>b(me,Ee,10),gini:(me,Ee)=>a(me,Ee),trimmedMean:(me,Ee)=>E(m(me,Ee),.1),winsorizedMean:(me,Ee)=>O(m(me,Ee),.1),robustOutliers:(me,Ee)=>N(m(me,Ee),3.5),jarqueBera:(me,Ee)=>T(m(me,Ee)),variance:(me,Ee)=>{const{n:we,m2:Te}=h(m(me,Ee));return we>1?Te/(we-1):null},varianceP:(me,Ee)=>{const{n:we,m2:Te}=h(m(me,Ee));return we>0?Te/we:null},stddev:(me,Ee)=>{const{n:we,m2:Te}=h(m(me,Ee));return we>1?Math.sqrt(Te/(we-1)):null},stddevP:(me,Ee)=>{const{n:we,m2:Te}=h(m(me,Ee));return we>0?Math.sqrt(Te/we):null},median:(me,Ee)=>{const we=m(me,Ee);return we.length?v(we,.5):null},p25:(me,Ee)=>{const we=m(me,Ee);return we.length?v(we,.25):null},p75:(me,Ee)=>{const we=m(me,Ee);return we.length?v(we,.75):null},p90:(me,Ee)=>{const we=m(me,Ee);return we.length?v(we,.9):null},p95:(me,Ee)=>{const we=m(me,Ee);return we.length?v(we,.95):null},p99:(me,Ee)=>{const we=m(me,Ee);return we.length?v(we,.99):null},iqr:(me,Ee)=>{const we=m(me,Ee);if(!we.length)return null;const Te=we.slice().sort();return w(Te,.75)-w(Te,.25)},mad:(me,Ee)=>{const we=m(me,Ee);if(!we.length)return null;const Te=v(we,.5),Le=new Float64Array(we.length);for(let xe=0;xe<we.length;xe++)Le[xe]=Math.abs(we[xe]-Te);return v(Le,.5)},range:(me,Ee)=>{const we=m(me,Ee);if(!we.length)return null;let Te=1/0,Le=-1/0;for(let xe=0;xe<we.length;xe++)we[xe]<Te&&(Te=we[xe]),we[xe]>Le&&(Le=we[xe]);return Le-Te},distinct:(me,Ee)=>{const we=G(me),Te=new Set;for(let Le=0;Le<Ee.length;Le++){const xe=we(Ee[Le]);xe==null||xe===""||Te.add(xe instanceof Date?xe.getTime():xe)}return Te.size},mode:(me,Ee)=>{const we=G(me),Te=new Map;for(let Ue=0;Ue<Ee.length;Ue++){const ze=we(Ee[Ue]);if(ze==null||ze==="")continue;const Ge=ze instanceof Date?ze.getTime():ze;Te.set(Ge,(Te.get(Ge)||0)+1)}let Le=null,xe=1;for(const[Ue,ze]of Te)ze>xe&&(xe=ze,Le=Ue);return Le},skewness:(me,Ee)=>{const we=m(me,Ee),{n:Te,mean:Le,m2:xe}=h(we);if(Te<3||xe<=0)return null;const Ue=Math.sqrt(xe/(Te-1));let ze=0;for(let Ge=0;Ge<we.length;Ge++)ze+=((we[Ge]-Le)/Ue)**3;return Te/((Te-1)*(Te-2))*ze},kurtosis:(me,Ee)=>{const we=m(me,Ee),{n:Te,mean:Le,m2:xe}=h(we);if(Te<4||xe<=0)return null;const Ue=Math.sqrt(xe/(Te-1));let ze=0;for(let it=0;it<we.length;it++)ze+=((we[it]-Le)/Ue)**4;const Ge=Te*(Te+1)/((Te-1)*(Te-2)*(Te-3)),tt=3*(Te-1)**2/((Te-2)*(Te-3));return Ge*ze-tt},geomean:(me,Ee)=>{const we=m(me,Ee);if(!we.length)return null;let Te=0;for(let Le=0;Le<we.length;Le++){if(we[Le]<=0)return null;Te+=Math.log(we[Le])}return Math.exp(Te/we.length)},harmean:(me,Ee)=>{const we=m(me,Ee);if(!we.length)return null;let Te=0;for(let Le=0;Le<we.length;Le++){if(we[Le]===0)return null;Te+=1/we[Le]}return we.length/Te},sumSquares:(me,Ee)=>{const we=m(me,Ee);let Te=0;for(let Le=0;Le<we.length;Le++)Te+=we[Le]*we[Le];return Te},passRate:(me,Ee)=>{const{pass:we,judged:Te}=A(me,Ee);return Te?we/Te:null},failureCount:(me,Ee)=>A(me,Ee).fail}),V=Object.freeze({hhi:"Concentration (HHI)",entropy:"Entropy",evenness:"Evenness",top3Share:"Top 3 share",top10Share:"Top 10 share",gini:"Gini coefficient",trimmedMean:"Trimmed mean",winsorizedMean:"Winsorized mean",robustOutliers:"Outliers (robust)",jarqueBera:"Jarque–Bera",median:"Median",p25:"25th percentile",p75:"75th percentile",p90:"90th percentile",p95:"95th percentile",p99:"99th percentile",iqr:"Interquartile range",mad:"Median absolute deviation",variance:"Variance",varianceP:"Variance (population)",stddev:"Standard deviation",stddevP:"Standard deviation (population)",range:"Range",distinct:"Distinct",mode:"Mode",skewness:"Skewness",kurtosis:"Kurtosis",geomean:"Geometric mean",harmean:"Harmonic mean",sumSquares:"Sum of squares",weightedAvg:"Weighted average",argmin:"Lowest by",argmax:"Highest by",passRate:"Pass rate",failureCount:"Failures"});function Y(me,Ee,we){const Te=G(me),Le=G(Ee);let xe=0,Ue=0;for(let ze=0;ze<we.length;ze++){const Ge=we[ze],tt=Number(Te(Ge)),it=Number(Le(Ge));!Number.isFinite(tt)||!Number.isFinite(it)||(xe+=tt*it,Ue+=it)}return Ue===0?null:xe/Ue}function $(me,Ee,we){const Te=G(me);let Le=null,xe=we?-1/0:1/0;for(let Ue=0;Ue<Ee.length;Ue++){const ze=Ee[Ue],Ge=Number(Te(ze));Number.isFinite(Ge)&&(we?Ge>xe:Ge<xe)&&(xe=Ge,Le=ze)}return Le}function j(me,Ee,we){const Te=G(me),Le=G(Ee);let xe=0,Ue=0,ze=0,Ge=0,tt=0,it=0;for(let Ve=0;Ve<we.length;Ve++){const Je=we[Ve],st=Number(Te(Je)),et=Number(Le(Je));!Number.isFinite(st)||!Number.isFinite(et)||(xe++,Ue+=st,ze+=et,Ge+=st*st,tt+=et*et,it+=st*et)}if(xe<2)return null;const ut=xe*it-Ue*ze,wt=Math.sqrt((xe*Ge-Ue*Ue)*(xe*tt-ze*ze));if(wt===0)return null;const jt=ut/wt;return Math.max(-1,Math.min(1,jt))}function E(me,Ee=.1){const we=me.length;if(!we)return null;const Te=Array.from(me).sort((ze,Ge)=>ze-Ge),Le=Math.floor(we*Math.min(.49,Math.max(0,Ee))),xe=Te.slice(Le,we-Le);if(!xe.length)return w(Te,.5);let Ue=0;for(const ze of xe)Ue+=ze;return Ue/xe.length}function O(me,Ee=.1){const we=me.length;if(!we)return null;const Te=Array.from(me).sort((Ge,tt)=>Ge-tt),Le=Math.floor(we*Math.min(.49,Math.max(0,Ee))),xe=Te[Le],Ue=Te[we-1-Le];let ze=0;for(const Ge of Te)ze+=Math.min(Ue,Math.max(xe,Ge));return ze/we}function N(me,Ee=3.5){if(!me.length)return null;const Te=Array.from(me).sort((Ge,tt)=>Ge-tt),Le=w(Te,.5),xe=Te.map(Ge=>Math.abs(Ge-Le)).sort((Ge,tt)=>Ge-tt),Ue=w(xe,.5);if(Ue===0)return null;let ze=0;for(const Ge of Te)Math.abs(.6745*(Ge-Le)/Ue)>Ee&&ze++;return ze}function T(me){const Ee=me.length;if(Ee<8)return null;let we=0;for(const Ge of me)we+=Ge;we/=Ee;let Te=0,Le=0,xe=0;for(const Ge of me){const tt=Ge-we;Te+=tt*tt,Le+=tt*tt*tt,xe+=tt*tt*tt*tt}if(Te/=Ee,Le/=Ee,xe/=Ee,Te===0)return null;const Ue=Le/Te**1.5,ze=xe/(Te*Te)-3;return Ee/6*(Ue*Ue+ze*ze/4)}function C(me,Ee,we){const Te=[];let Le=0;for(let Ge=0;Ge<me.length;Ge++){const tt=Number(me[Ge]),it=Number(Ee[Ge]);!Number.isFinite(tt)||!Number.isFinite(it)||it<=0||(Te.push([tt,it]),Le+=it)}if(!Te.length||Le<=0)return null;if(Te.sort((Ge,tt)=>Ge[0]-tt[0]),Te.length===1)return Te[0][0];const xe=[];let Ue=0;for(const[,Ge]of Te)xe.push((Ue+Ge/2)/Le),Ue+=Ge;const ze=Math.max(0,Math.min(1,we));if(ze<=xe[0])return Te[0][0];if(ze>=xe[xe.length-1])return Te[Te.length-1][0];for(let Ge=1;Ge<xe.length;Ge++){if(ze>xe[Ge])continue;const tt=xe[Ge]-xe[Ge-1],it=tt>0?(ze-xe[Ge-1])/tt:0;return Te[Ge-1][0]+(Te[Ge][0]-Te[Ge-1][0])*it}return Te[Te.length-1][0]}function B(me,Ee,we){const Te=G(me),Le=G(Ee),xe=new Float64Array(we.length),Ue=new Float64Array(we.length);let ze=0;for(let Ge=0;Ge<we.length;Ge++){const tt=we[Ge],it=Number(Te(tt)),ut=Number(Le(tt));!Number.isFinite(it)||!Number.isFinite(ut)||(xe[ze]=it,Ue[ze]=ut,ze++)}return{xs:xe.subarray(0,ze),ys:Ue.subarray(0,ze),n:ze}}function z(me,Ee,we,Te=!1){const{xs:Le,ys:xe,n:Ue}=B(me,Ee,we);if(Ue<2)return null;let ze=0,Ge=0;for(let it=0;it<Ue;it++)ze+=Le[it],Ge+=xe[it];ze/=Ue,Ge/=Ue;let tt=0;for(let it=0;it<Ue;it++)tt+=(Le[it]-ze)*(xe[it]-Ge);return tt/(Te?Ue:Ue-1)}function X(me,Ee,we){const{xs:Te,ys:Le,n:xe}=B(me,Ee,we);if(xe<2)return null;let Ue=0,ze=0;for(let st=0;st<xe;st++)Ue+=Te[st],ze+=Le[st];Ue/=xe,ze/=xe;let Ge=0,tt=0,it=0;for(let st=0;st<xe;st++){const et=Te[st]-Ue,ft=Le[st]-ze;Ge+=et*et,tt+=et*ft,it+=ft*ft}if(Ge===0)return null;const ut=tt/Ge,wt=ze-ut*Ue,jt=it===0?1:Math.max(0,Math.min(1,tt*tt/(Ge*it))),Ve=Math.max(0,it-ut*tt),Je=xe>2?Math.sqrt(Ve/(xe-2)/Ge):0;return{slope:ut,intercept:wt,r2:jt,stdError:Je,n:xe}}const Q=new Set(["ols","wls","robust"]),H=new Set(["quantile"]),L=new Set(["ridge","lasso","elasticnet","mixed","gls"]),Z=1.345;function ee(me,Ee,we){const{xtwx:Te,xtwy:Le}=l(me,Ee,we),xe=S(Te);if(!xe)return null;const Ue=k(xe,Le),ze=y(xe),Ge=te(me,Ue),tt=Ee.map((it,ut)=>it-Ge[ut]);return{beta:Ue,cov:ze,fitted:Ge,residuals:tt}}function te(me,Ee){return me.map(we=>we.reduce((Te,Le,xe)=>Te+Le*Ee[xe],0))}function se(me,Ee){const we=me.length,Te=me.map(tt=>tt[Ee]),Le=me.map(tt=>[1,...tt.filter((it,ut)=>ut!==Ee)]),xe=ee(Le,Te,null);if(!xe)return 1;const Ue=Te.reduce((tt,it)=>tt+it,0)/we;let ze=0,Ge=0;for(let tt=0;tt<we;tt++)ze+=xe.residuals[tt]**2,Ge+=(Te[tt]-Ue)**2;return Ge===0?1:Math.max(0,Math.min(1,1-ze/Ge))}function ne(me){const Ee=[...me].sort((Le,xe)=>Le-xe),we=ae(Ee),Te=me.map(Le=>Math.abs(Le-we)).sort((Le,xe)=>Le-xe);return ae(Te)/.6745}function ae(me){const Ee=me.length;if(!Ee)return 0;const we=Math.floor(Ee/2);return Ee%2?me[we]:(me[we-1]+me[we])/2}function de(me,Ee,we={}){const Te=we.method||"ols";if(L.has(Te))throw new Error(`[lattice] regression method "${Te}" is out of scope; use ols, wls or robust.`);if(H.has(Te))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!Q.has(Te))throw new Error(`[lattice] unknown regression method "${Te}"; use ols, wls or robust.`);const Le=Array.isArray(Ee)?Ee.length:0,xe=Le&&Array.isArray(me[0])?me[0].length:0,Ue=xe+1;if(!(Le>Ue))return null;for(let It=0;It<Le;It++){if(!Number.isFinite(Ee[It])||!Array.isArray(me[It])||me[It].length!==xe)return null;for(let Vt=0;Vt<xe;Vt++)if(!Number.isFinite(me[It][Vt]))return null}let ze=null;if(Te==="wls"){if(ze=we.weights,!Array.isArray(ze)||ze.length!==Le)return null;for(let It=0;It<Le;It++)if(!(ze[It]>0)||!Number.isFinite(ze[It]))return null}const Ge=me.map(It=>[1,...It]);let tt,it=null;if(Te==="robust"){if(tt=ee(Ge,Ee,null),!tt)return null;for(let It=0;It<50;It++){const Vt=ne(tt.residuals);if(!(Vt>0))break;const qt=tt.residuals.map(Gt=>{const nn=Math.abs(Gt/Vt);return nn<=Z?1:Z/nn}),Jt=ee(Ge,Ee,qt);if(!Jt)return null;const rn=Jt.beta.reduce((Gt,nn,an)=>Math.max(Gt,Math.abs(nn-tt.beta[an])),0);if(tt=Jt,it=qt,rn<1e-10)break}}else if(tt=ee(Ge,Ee,ze),!tt)return null;const ut=Te==="robust"?it:ze,{beta:wt,cov:jt,fitted:Ve,residuals:Je}=tt;let st=0,et=0,ft=0;for(let It=0;It<Le;It++){const Vt=ut?ut[It]:1;st+=Vt*Je[It]**2,et+=Vt,ft+=Vt*Ee[It]}const At=ft/et;let Et=0;for(let It=0;It<Le;It++){const Vt=ut?ut[It]:1;Et+=Vt*(Ee[It]-At)**2}const Rt=Le-Ue,xt=st/Rt,Ft=Et===0?1:Math.max(0,Math.min(1,1-st/Et)),Ht=1-(1-Ft)*(Le-1)/Rt,qe=Array.isArray(we.names)&&we.names.length===xe?we.names:me[0].map((It,Vt)=>`x${Vt+1}`),ct=Qe(we.confidence),pt=Rt>0?x(1-(1-ct)/2,Rt):1/0,Ot=wt.map((It,Vt)=>{const qt=Math.sqrt(Math.max(0,xt*jt[Vt][Vt])),Jt=qt>0?It/qt:It===0?0:1/0,rn=Number.isFinite(Jt)?2*(1-q(Math.abs(Jt),Rt)):0,Gt=Number.isFinite(pt)?pt*qt:null;return{name:Vt===0?"(intercept)":qe[Vt-1],estimate:It,stdError:qt,t:Jt,p:Math.max(0,Math.min(1,rn)),lower:Gt===null?null:It-Gt,upper:Gt===null?null:It+Gt}}),Lt=new Array(Le),$t=new Array(Le);for(let It=0;It<Le;It++){const Vt=ut?ut[It]:1,qt=Math.max(0,Math.min(1,Vt*g(Ge[It],jt)));Lt[It]=qt;const Jt=(1-qt)**2;$t[It]=Jt>0&&xt>0?Je[It]**2/(Ue*xt)*(qt/Jt):null}const kt=me[0].map((It,Vt)=>{if(xe<2)return 1;const qt=se(me,Vt);return qt>=1?1/0:1/(1-qt)});let Dt=null;{const It=Je.map(qt=>qt*qt),Vt=ee(Ge,It,null);if(Vt){const qt=It.reduce((sn,bn)=>sn+bn,0)/Le;let Jt=0,rn=0;for(let sn=0;sn<Le;sn++)Jt+=Vt.residuals[sn]**2,rn+=(It[sn]-qt)**2;const Gt=rn===0?0:Math.max(0,Math.min(1,1-Jt/rn)),nn=Le*Gt,an=K(nn,xe);Dt={statistic:nn,df:xe,p:an,heteroscedastic:an<.05}}}let Wt=null;if(xe===1){const It=me.map((Vt,qt)=>qt).sort((Vt,qt)=>me[Vt][0]-me[qt][0]);Wt={confidence:ct,points:It.map(Vt=>{const qt=Ge[Vt],Jt=Math.sqrt(Math.max(0,xt*g(qt,jt)));return{x:me[Vt][0],yhat:Ve[Vt],lower:Ve[Vt]-pt*Jt,upper:Ve[Vt]+pt*Jt}})}}return{method:Te,coefficients:Ot,r2:Ft,adjR2:Ht,n:Le,df:Rt,sigma2:xt,fitted:Ve,residuals:Je,leverage:Lt,cooksD:$t,vif:kt,heteroscedasticity:Dt,band:Wt,weights:ut?[...ut]:null}}function le(me){const Ee=me.length,we=Array.from({length:Ee},(xe,Ue)=>Ue).sort((xe,Ue)=>me[xe]-me[Ue]),Te=new Float64Array(Ee);let Le=0;for(;Le<Ee;){let xe=Le;for(;xe+1<Ee&&me[we[xe+1]]===me[we[Le]];)xe++;const Ue=(Le+xe)/2+1;for(let ze=Le;ze<=xe;ze++)Te[we[ze]]=Ue;Le=xe+1}return Te}const be=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function Ce(me){const Ee=[.01,.05,.1],we=[be["1%"],be["5%"],be["10%"]];if(me<=we[0]){const xe=(Math.log(Ee[1])-Math.log(Ee[0]))/(we[1]-we[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(Ee[0])+xe*(me-we[0]))))}if(me>=we[2]){const xe=(Math.log(Ee[2])-Math.log(Ee[1]))/(we[2]-we[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(Ee[2])+xe*(me-we[2]))))}const Te=me<we[1]?0:1,Le=(me-we[Te])/(we[Te+1]-we[Te]);return Math.exp(Math.log(Ee[Te])+Le*(Math.log(Ee[Te+1])-Math.log(Ee[Te])))}function Ne(me,Ee,we,Te){const Le=we-Te,xe=Te+3,Ue=new Array(Le),ze=new Array(Le);let Ge=!0,tt=Te;for(let Ve=0;Ve<Le;Ve++){const Je=Te+Ve,st=new Float64Array(xe);st[0]=1,st[1]=Ve+1,st[2]=me[Je];for(let et=1;et<=Te;et++)st[2+et]=Ee[Je-et];for(let et=1;et<xe;et++)Number.isFinite(st[et])||(tt=Math.min(tt,et-3));Ue[Ve]=st,ze[Ve]=Ee[Je],Number.isFinite(ze[Ve])||(Ge=!1)}if(!Ge)return 0;const{xtwx:it,xtwy:ut}=l(Ue,ze,null);let wt=0,jt=1/0;for(let Ve=0;Ve<=tt;Ve++){const Je=Ve+3;if(!(Le>Je))continue;const st=new Array(Je);for(let Ft=0;Ft<Je;Ft++)st[Ft]=it[Ft].slice(0,Je);const et=S(st);if(!et)continue;const ft=k(et,ut.slice(0,Je));let At=0;for(let Ft=0;Ft<Le;Ft++){const Ht=Ue[Ft];let qe=0;for(let ct=0;ct<Je;ct++)qe+=Ht[ct]*ft[ct];At+=(ze[Ft]-qe)**2}const Rt=At/(Le-Je)*(Le-Je);if(!(Rt>0))continue;const xt=Le*Math.log(Rt/Le)+2*Je;xt<jt&&(jt=xt,wt=Ve)}return wt}function he(me,Ee={}){const we=[];for(let jt=0;jt<me.length;jt++){const Ve=Number(me[jt]);Number.isFinite(Ve)&&we.push(Ve)}const Te=we.length,Le=Te-1;if(Te<8||Le<6)return null;const xe=new Array(Le);for(let jt=0;jt<Le;jt++)xe[jt]=we[jt+1]-we[jt];let Ue=Number.isFinite(Ee.maxlag)?Math.floor(Ee.maxlag):Math.ceil(12*(Te/100)**.25);Ue=Math.max(0,Math.min(Ue,Math.floor((Le-5)/2)));const ze=(jt,Ve)=>{const Je=[],st=[];for(let et=Ve;et<Le;et++){const ft=[et-Ve+1,we[et]];for(let At=1;At<=jt;At++)ft.push(xe[et-At]);Je.push(ft),st.push(xe[et])}return de(Je,st,{method:"ols"})},Ge=Ne(we,xe,Le,Ue),tt=ze(Ge,Ge);if(!tt||!tt.coefficients[2])return null;const it=tt.coefficients[2].t,ut=Ce(it),wt=it<be["5%"];return{statistic:it,usedLag:Ge,nobs:Le-Ge,criticalValues:{...be},pValue:ut,pApproximate:!0,stationary:wt,verdict:wt?"stationary":"non-stationary",regression:"ct"}}function ie(me,Ee={}){const we=[];for(let wt=0;wt<me.length;wt++){const jt=Number(me[wt]);Number.isFinite(jt)&&we.push(jt)}const Te=we.length;if(Te<3)return null;let Le=Number.isFinite(Ee.maxlag)?Math.floor(Ee.maxlag):Math.min(10,Te-1);Le=Math.max(1,Math.min(Le,Te-1));let xe=0;for(const wt of we)xe+=wt;xe/=Te;const Ue=we.map(wt=>wt-xe);let ze=0;for(const wt of Ue)ze+=wt*wt;ze/=Te;const Ge=new Array(Le+1).fill(0);Ge[0]=1;for(let wt=1;wt<=Le;wt++){let jt=0;for(let Ve=wt;Ve<Te;Ve++)jt+=Ue[Ve]*Ue[Ve-wt];Ge[wt]=ze>0?jt/Te/ze:0}const tt=new Array(Le+1).fill(0);tt[0]=1;let it=[];for(let wt=1;wt<=Le;wt++){let jt=Ge[wt];for(let et=1;et<wt;et++)jt-=it[et-1]*Ge[wt-et];let Ve=1;for(let et=1;et<wt;et++)Ve-=it[et-1]*Ge[et];const Je=Ve!==0?jt/Ve:0,st=new Array(wt);for(let et=1;et<wt;et++)st[et-1]=it[et-1]-Je*it[wt-1-et];st[wt-1]=Je,tt[wt]=Je,it=st}const ut=1.96/Math.sqrt(Te);return{acf:Ge,pacf:tt,bounds:{upper:ut,lower:-ut},n:Te,nlags:Le,approximate:!0}}function ue(me,Ee,we){const{xs:Te,ys:Le,n:xe}=B(me,Ee,we);if(xe<2)return null;const Ue=le(Te),ze=le(Le);let Ge=0,tt=0;for(let jt=0;jt<xe;jt++)Ge+=Ue[jt],tt+=ze[jt];Ge/=xe,tt/=xe;let it=0,ut=0,wt=0;for(let jt=0;jt<xe;jt++){const Ve=Ue[jt]-Ge,Je=ze[jt]-tt;it+=Ve*Je,ut+=Ve*Ve,wt+=Je*Je}return ut===0||wt===0?null:Math.max(-1,Math.min(1,it/Math.sqrt(ut*wt)))}function ge(me,Ee,we){const{xs:Te,ys:Le,n:xe}=B(me,Ee,we);if(xe<2||xe>o)return null;let Ue=0,ze=0,Ge=0,tt=0;for(let wt=0;wt<xe;wt++)for(let jt=wt+1;jt<xe;jt++){const Ve=Math.sign(Te[wt]-Te[jt]),Je=Math.sign(Le[wt]-Le[jt]),st=Ve*Je;st>0?Ue++:st<0?ze++:Ve===0&&Je===0||(Ve===0?Ge++:tt++)}const it=Ue+ze+tt,ut=Ue+ze+Ge;return it===0||ut===0?null:(Ue-ze)/Math.sqrt(it*ut)}function pe(me,Ee={}){const we=me.length;if(we<2)return null;const Te=me[0],Le=me[we-1],xe=[];for(let et=1;et<we;et++){const ft=me[et-1];ft!==0&&xe.push((me[et]-ft)/Math.abs(ft))}let Ue=null;if(xe.length>1){let et=0;for(const At of xe)et+=At;et/=xe.length;let ft=0;for(const At of xe)ft+=(At-et)**2;Ue=Math.sqrt(ft/(xe.length-1))}const ze=Number(Ee.periodsPerYear)>0?Number(Ee.periodsPerYear):null;let Ge=me[0],tt=0,it=0,ut=0,wt=0;for(let et=1;et<we;et++){if(me[et]>Ge){Ge=me[et],tt=et;continue}if(Ge<=0)continue;const ft=(Ge-me[et])/Ge;ft>it&&(it=ft,ut=tt,wt=et)}let jt=null;if(we>2){let et=0;for(let Et=0;Et<we;Et++)et+=me[Et];et/=we;let ft=0,At=0;for(let Et=0;Et<we;Et++){const Rt=me[Et]-et;At+=Rt*Rt,Et>0&&(ft+=Rt*(me[Et-1]-et))}jt=At>0?ft/At:null}let Ve=0,Je=0;for(const et of xe)et>0?Ve++:et<0&&Je++;let st=null;if(Te>0&&Le>0){const et=(Le/Te)**(1/(we-1))-1;st=ze?(1+et)**ze-1:et}return{n:we,first:Te,last:Le,change:Le-Te,changePercent:Te===0?null:(Le-Te)/Math.abs(Te)*100,volatility:Ue,annualisedVolatility:Ue!==null&&ze?Ue*Math.sqrt(ze):null,growth:st,maxDrawdown:it,maxDrawdownFrom:ut,maxDrawdownTo:wt,autocorrelation:jt,upDays:Ve,downDays:Je}}const Oe=1.128,ve=3.267;function ye(me){const Ee=me.length;if(Ee<2)return null;const we=[];for(let Le=1;Le<Ee;Le++)we.push(Math.abs(me[Le]-me[Le-1]));const Te=we.reduce((Le,xe)=>Le+xe,0)/we.length;return{ranges:we,centre:Te,upper:ve*Te,lower:0}}function Ae(me){const Ee=me.length;if(Ee<2)return null;let we=0;for(let Le=1;Le<Ee;Le++)we+=Math.abs(me[Le]-me[Le-1]);const Te=we/(Ee-1);return{sigma:Te/Oe,meanRange:Te}}function Me(me,Ee){const we=me.length;if(we<2||!Ee)return null;const Te=Number.isFinite(Number(Ee.lower))?Number(Ee.lower):null,Le=Number.isFinite(Number(Ee.upper))?Number(Ee.upper):null;if(Te===null&&Le===null)return null;let xe=0;for(let Ve=0;Ve<we;Ve++)xe+=me[Ve];xe/=we;let Ue=0;for(let Ve=0;Ve<we;Ve++)Ue+=(me[Ve]-xe)**2;const ze=Math.sqrt(Ue/(we-1)),Ge=Ae(me),tt=Ge?Ge.sigma:null,it=Ve=>{if(!Ve||Ve<=0)return{index:null,k:null};const st=Te!==null&&Le!==null?(Le-Te)/(6*Ve):null,et=Le!==null?(Le-xe)/(3*Ve):1/0,ft=Te!==null?(xe-Te)/(3*Ve):1/0;return{index:st,k:Math.min(et,ft)}},ut=it(tt),wt=it(ze);let jt=0;for(let Ve=0;Ve<we;Ve++){if(Te!==null&&me[Ve]<Te){jt++;continue}Le!==null&&me[Ve]>Le&&jt++}return{n:we,mean:xe,lower:Te,upper:Le,target:Number.isFinite(Number(Ee.target))?Number(Ee.target):null,sigmaWithin:tt,sigmaOverall:ze,cp:ut.index,cpk:ut.k,pp:wt.index,ppk:wt.k,outOfSpec:jt,defectRate:we?jt/we:null}}function je(me){const Ee=me.length;if(Ee<2)return null;const we=Ae(me);if(!we||!(we.sigma>0))return null;let Te=0;for(let Le=0;Le<Ee;Le++)Te+=me[Le];return Te/=Ee,{centre:Te,sigma:we.sigma,upper:Te+3*we.sigma,lower:Te-3*we.sigma}}function _e(me,Ee){if(!Ee||!(Ee.sigma>0))return[];const we=me.length,{centre:Te,sigma:Le}=Ee,xe=ze=>(me[ze]-Te)/Le,Ue=[];for(let ze=0;ze<we;ze++){if(Math.abs(xe(ze))>3&&Ue.push({index:ze,rule:1,description:"beyond three sigma"}),ze>=2)for(const Ge of[1,-1]){let tt=0;for(let it=ze-2;it<=ze;it++)xe(it)*Ge>2&&tt++;if(tt>=2){Ue.push({index:ze,rule:2,description:"two of three past two sigma"});break}}if(ze>=4)for(const Ge of[1,-1]){let tt=0;for(let it=ze-4;it<=ze;it++)xe(it)*Ge>1&&tt++;if(tt>=4){Ue.push({index:ze,rule:3,description:"four of five past one sigma"});break}}if(ze>=7)for(const Ge of[1,-1]){let tt=!0;for(let it=ze-7;it<=ze;it++)if(xe(it)*Ge<=0){tt=!1;break}if(tt){Ue.push({index:ze,rule:4,description:"eight in a row on one side"});break}}}return Ue}function Pe(me,Ee){if(!Ee||!(Ee.sigma>0))return[];const we=me.length,{centre:Te,sigma:Le}=Ee,xe=Ge=>(me[Ge]-Te)/Le,Ue=(Ge,tt,it,ut)=>{for(const wt of[1,-1]){let jt=0;for(let Ve=Ge;Ve<=tt;Ve++)xe(Ve)*wt>it&&jt++;if(jt>=ut)return!0}return!1},ze=[];for(let Ge=0;Ge<we;Ge++){if(Math.abs(xe(Ge))>3&&ze.push({index:Ge,rule:1,description:"beyond three sigma"}),Ge>=8)for(const tt of[1,-1]){let it=!0;for(let ut=Ge-8;ut<=Ge;ut++)if(xe(ut)*tt<=0){it=!1;break}if(it){ze.push({index:Ge,rule:2,description:"nine in a row on one side"});break}}if(Ge>=5)for(const tt of[1,-1]){let it=!0;for(let ut=Ge-4;ut<=Ge;ut++)if((me[ut]-me[ut-1])*tt<=0){it=!1;break}if(it){ze.push({index:Ge,rule:3,description:tt>0?"six rising":"six falling"});break}}if(Ge>=13){let tt=!0;for(let it=Ge-12;it<=Ge;it++){const ut=me[it]-me[it-1],wt=me[it+1<=Ge?it+1:it]-me[it];if(it+1>Ge)break;if(ut===0||wt===0||ut>0==wt>0){tt=!1;break}}tt&&ze.push({index:Ge,rule:4,description:"fourteen alternating"})}if(Ge>=2&&Ue(Ge-2,Ge,2,2)&&ze.push({index:Ge,rule:5,description:"two of three past two sigma"}),Ge>=4&&Ue(Ge-4,Ge,1,4)&&ze.push({index:Ge,rule:6,description:"four of five past one sigma"}),Ge>=14){let tt=!0;for(let it=Ge-14;it<=Ge;it++)if(Math.abs(xe(it))>=1){tt=!1;break}tt&&ze.push({index:Ge,rule:7,description:"fifteen within one sigma"})}if(Ge>=7){let tt=!0;for(let it=Ge-7;it<=Ge;it++)if(Math.abs(xe(it))<=1){tt=!1;break}tt&&ze.push({index:Ge,rule:8,description:"eight beyond one sigma"})}}return ze}const Se=Object.freeze(["westernElectric","nelson"]);function Fe(me,Ee,we="westernElectric"){return String(we)==="nelson"?Pe(me,Ee):_e(me,Ee)}function We(me,Ee,we){let Te=0;for(let Le=0;Le<me.length;Le++)(me[Le]<Ee||me[Le]>we)&&Te++;return Te}function He(me,Ee,we,Te=20){const Le=me.length;if(!Le)return[];const xe=me[0],Ue=me[Le-1];if(Ue===xe)return[{from:xe,to:Ue,count:Le}];const ze=we-Ee,Ge=1.5*ze;let tt=ze>0?Math.max(xe,Ee-Ge):xe,it=ze>0?Math.min(Ue,we+Ge):Ue;it>tt||(tt=xe,it=Ue);const ut=ze>0?2*ze/Math.cbrt(Le):(it-tt)/(Math.ceil(Math.log2(Le))+1),wt=ut>0?Math.min(Te,Math.max(1,Math.ceil((it-tt)/ut))):1,jt=(it-tt)/wt,Ve=[];for(let Je=0;Je<wt;Je++)Ve.push({from:tt+Je*jt,to:tt+(Je+1)*jt,count:0});for(let Je=0;Je<Le;Je++){const st=Math.min(wt-1,Math.max(0,Math.floor((me[Je]-tt)/jt)));Ve[st].count++}return Ve[0].from=xe,Ve[wt-1].to=Ue,Ve}const Ye=.95;function Qe(me){const Ee=Number(me);return Number.isFinite(Ee)&&Ee>0&&Ee<1?Ee:Ye}function lt(me,Ee=Ye){const we=me.length;if(we<2)return null;let Te=0;for(let it=0;it<we;it++)Te+=me[it];const Le=Te/we;let xe=0;for(let it=0;it<we;it++){const ut=me[it]-Le;xe+=ut*ut}const Ue=Math.sqrt(xe/(we-1)),ze=Qe(Ee),tt=x(1-(1-ze)/2,we-1)*Ue/Math.sqrt(we);return{mean:Le,lower:Le-tt,upper:Le+tt,margin:tt,n:we,confidence:ze}}function ot(me,Ee,we=Ye){const Te=Number(me),Le=Number(Ee);if(!(Le>0)||!(Te>=0)||Te>Le)return null;const xe=Qe(we),Ue=W(1-(1-xe)/2),ze=Te/Le,Ge=Ue*Ue,tt=1+Ge/Le,it=(ze+Ge/(2*Le))/tt,ut=Ue/tt*Math.sqrt(ze*(1-ze)/Le+Ge/(4*Le*Le));return{proportion:ze,lower:Math.max(0,it-ut),upper:Math.min(1,it+ut),n:Le,confidence:xe}}function yt(me,Ee=Ye){if(!me||!(me.n>2)||!Number.isFinite(me.stdError))return null;const we=Qe(Ee),Le=x(1-(1-we)/2,me.n-2)*me.stdError;return{slope:me.slope,lower:me.slope-Le,upper:me.slope+Le,margin:Le,confidence:we}}function Ct(me,Ee,we=Ye){const Te=Number(me),Le=Number(Ee);if(!Number.isFinite(Te)||!(Le>1))return null;const xe=Qe(we),ze=W(1-(1-xe)/2)*Math.sqrt(1/(9*Le)+Te*Te/(2*(Le-1)));return{index:Te,lower:Te-ze,upper:Te+ze,margin:ze,n:Le,confidence:xe}}function Nt(me,Ee){return!me||!(me.sd>0)||!Number.isFinite(Ee)||!Number.isFinite(me.mean)?null:(Ee-me.mean)/me.sd}function dt(me){return Number.isFinite(me)?Math.min(1,Math.max(0,2*I(Math.abs(me)/2)-1)):0}function at(me,Ee){const we=new Map,Te=G(me);let Le=0;for(let xe=0;xe<Ee.length;xe++){const Ue=Te(Ee[xe]);if(Ue==null||Ue===""||typeof Ue=="number"&&Number.isNaN(Ue))continue;const ze=Ue instanceof Date?Ue.getTime():typeof Ue=="object"?String(Ue):Ue;we.set(ze,(we.get(ze)||0)+1),Le++}return{map:we,total:Le}}function bt(me,Ee,we,Te){if(!(Ee>0)||!(Te>0))return null;let Le=0;const xe=new Set(me.keys());for(const Ue of we.keys())xe.add(Ue);for(const Ue of xe){const ze=(me.get(Ue)||0)/Ee,Ge=(we.get(Ue)||0)/Te;Le+=Math.abs(ze-Ge)}return Le/2}const Tt=10;function ht(me,Ee,we){if(we&&we.numeric){const ze=m(me,Ee),{n:Ge,mean:tt}=h(ze),it=Ge>0?Nt({mean:we.mean,sd:we.sd},tt):null;return{measure:"standardizedMeanDifference",magnitude:it,distance:it===null?0:dt(it),direction:it===null?0:Math.sign(it),subsetN:Ge,populationN:we.n||0,reliable:Ge>=Tt}}const{map:Le,total:xe}=at(me,Ee),Ue=bt(Le,xe,we.map,we.total);return{measure:"categoricalTotalVariation",magnitude:Ue,distance:Ue===null?0:Ue,direction:0,subsetN:xe,populationN:we.total||0,reliable:xe>=Tt}}function ke(me,Ee){if(me&&(me.kind==="float64"||me.kind==="int32"))return!0;const we=G(me);let Te=0,Le=0;for(let xe=0;xe<Ee.length&&Te<200;xe++){const Ue=we(Ee[xe]);if(Ue==null||Ue==="")continue;if(Ue instanceof Date)return!1;Te++;const ze=typeof Ue=="number"?Ue:Number(Ue);Number.isFinite(ze)&&Le++}return Te===0?!1:Le/Te>=.9}function $e(me,Ee){if(ke(me,Ee)){const Le=m(me,Ee),{n:xe,mean:Ue,m2:ze}=h(Le);return{numeric:!0,mean:Ue,sd:xe>0?Math.sqrt(ze/xe):0,n:xe}}const{map:we,total:Te}=at(me,Ee);return{numeric:!1,map:we,total:Te}}}),Be("packages/core/src/compute/total.js",function(e,D){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"aggregatesFor",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"aggregateAllowed",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return h}});const M=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce,x=D("packages/core/src/compute/handle.js"),q=x.presenceReader,W=x.valueComparator,I=x.valueReader,K=D("packages/core/src/compute/statistics.js"),R=K.STAT_FNS,S=K.STAT_LABELS;function k(w){return!!w&&(w.kind==="float64"||w.kind==="int32")}function y(w,v){const A=v.length;let _=0;if(k(w)){const Y=w.values,$=q(w);if(!$){for(let j=0;j<A;j++){const E=Y[v[j]];Number.isNaN(E)||(_+=E)}return _}for(let j=0;j<A;j++){const E=v[j];if($(E)===1){const O=Y[E];Number.isNaN(O)||(_+=O)}}return _}const V=I(w);for(let Y=0;Y<A;Y++){const $=m(V(v[Y]));$!==null&&(_+=$)}return _}y.kernel=!0;function l(w,v){const A=v.length;let _=0;if(k(w)){const Y=w.values,$=q(w);if(!$){for(let j=0;j<A;j++)Number.isNaN(Y[v[j]])||_++;return _}for(let j=0;j<A;j++){const E=v[j];$(E)===1&&!Number.isNaN(Y[E])&&_++}return _}const V=I(w);for(let Y=0;Y<A;Y++){const $=V(v[Y]);$!=null&&!(typeof $=="number"&&Number.isNaN($))&&_++}return _}l.kernel=!0;function g(w,v){return v.length}g.kernel=!0;function i(w,v){const A=l(w,v);return A===0?null:y(w,v)/A}i.kernel=!0;function t(w,v,A,_){const V=v.length;if(k(w)){const E=w.values,O=q(w);let N=null;if(!O){for(let T=0;T<V;T++){const C=E[v[T]];Number.isNaN(C)||(N===null||(A<0?C<N:C>N))&&(N=C)}return N}for(let T=0;T<V;T++){const C=v[T];if(O(C)===0)continue;const B=E[C];Number.isNaN(B)||(N===null||(A<0?B<N:B>N))&&(N=B)}return N}const Y=I(w),$=W(_);let j=null;for(let E=0;E<V;E++){const O=Y(v[E]);O==null||typeof O=="number"&&Number.isNaN(O)||(j===null||(A<0?$(O,j)<0:$(O,j)>0))&&(j=O)}return j}function o(w,v,A){return t(w,v,-1,A&&A.locale)}o.kernel=!0;function c(w,v,A){return t(w,v,1,A&&A.locale)}c.kernel=!0;function f(w,v){return v.length===0?null:I(w)(v[0])}f.kernel=!0;function n(w,v){return v.length===0?null:I(w)(v[v.length-1])}n.kernel=!0;function m(w){if(typeof w=="number")return Number.isNaN(w)?null:w;if(w==null||w===""||typeof w=="boolean")return null;if(w instanceof Date)return w.getTime();const v=Number(w);return Number.isNaN(v)?null:v}const r={sum:y,min:o,max:c,avg:i,count:g,first:f,last:n,countValues:l,...R},s=Object.freeze({...S,sum:"Sum",avg:"Average",min:"Min",max:"Max",count:"Count",countValues:"Count of values",first:"First",last:"Last"});function d(w){return w?typeof w=="string"?s[w]||w:"Total":""}const p=Object.freeze(["sum","avg","min","max","count","countValues","first","last"]);function u(w){const v=w&&w.dataType&&w.dataType.totals&&w.dataType.totals.supported;if(Array.isArray(v))return v.slice();const A=p.filter(_=>_ in r);for(const _ of Object.keys(r))A.includes(_)||A.push(_);return A}function b(w,v){return typeof v!="string"?!0:u(w).includes(v)}function a(w,v){const A=I(w),_=[];for(let V=0;V<v.length;V++){const Y=A(v[V]);Y!=null&&_.push(Y)}return _}function h(w,v,A,_){const V=v||[];if(typeof A=="string"){const Y=r[A];return Y?Y(w,V,_):(F(`total:${A}`,`unknown total function "${A}"; register it in config.totalFns`),null)}return M(A)?A.kernel===!0?A(w,V,_):A(a(w,V),_||{}):null}}),Be("packages/core/src/compute/windowed.js",function(e,D){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return q}});const M=D("packages/core/src/compute/sketch.js").Welford;class G{#e;#t;#n=[];#r;#i;constructor(I,K=0,R=Date.now){if(I!=="count"&&I!=="time"&&I!=="session")throw new RangeError(`unknown window kind: ${I}`);if((I==="count"||I==="time")&&!(K>0))throw new RangeError(`a ${I} window needs a positive span`);this.#e=I,this.#t=Math.floor(K),this.#r=R,this.#i=R()}get size(){return this.#n.length}push(I,K=this.#r()){Number.isFinite(I)&&(this.#n.push({t:K,v:I}),this.#s(K))}#s(I){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const K=I-this.#t;for(;this.#n.length&&this.#n[0].t<K;)this.#n.shift()}}spec(){const I=this.#e==="session"?this.#r()-this.#i:this.#t;return{kind:this.#e,span:I,size:this.#n.length}}values(){return this.#n.map(I=>I.v)}aggregate(){const I=this.spec();if(!this.#n.length)return{over:I,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const K=new M;let R=0,S=1/0,k=-1/0;for(const{v:y}of this.#n)R+=y,y<S&&(S=y),y>k&&(k=y),K.add(y);return{over:I,count:this.#n.length,sum:R,mean:K.mean(),min:S,max:k,variance:K.variance(),stddev:K.stddev()}}reduce(I){const K=this.aggregate(),R={sum:K.sum,avg:K.mean,mean:K.mean,min:K.min,max:K.max,count:K.count,variance:K.variance,stddev:K.stddev};if(!(I in R))throw new RangeError(`unknown windowed aggregate: ${I}`);return{value:R[I],over:K.over}}}const F=Object.freeze(["count","time","session"]);function x(W,I=Date.now){const K=W.kind==="time"&&W.minutes!=null?W.minutes*6e4:W.span??0;return new G(W.kind,K,I)}const q={Window:G,WINDOW_KINDS:F,openWindow:x}}),Be("packages/core/src/compute/rolling.js",function(e,D){"use strict";Object.defineProperty(e,"ROLLING_WINDOW_FIELDS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"rollingWindow",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"rollingQuantile",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"seasonalDecompose",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"exponentialSmoothing",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return m}});const M=D("packages/core/src/compute/windowed.js").openWindow,F=D("packages/core/src/compute/sketch.js").KLL,x=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function q(r,s,d,p){if(r.kind==="count"){const u=Math.max(1,Math.floor(r.span||0));return{coverage:Math.min(1,s/u),partial:s<u}}if(r.kind==="time"){const u=r.minutes!=null?r.minutes*6e4:r.span||0;if(!(u>0))return{coverage:1,partial:!1};const b=d-p;return{coverage:Math.min(1,b/u),partial:b<u}}return{coverage:null,partial:!1}}function W(r,s){const d=M(s),p=new Map,u=r.length?r[0].at:0;for(let b=0;b<r.length;b++){const{key:a,at:h,value:w}=r[b];Number.isFinite(w)&&d.push(w,h);const v=d.aggregate(),A=q(s,v.count,h,u);a!=null&&p.set(String(a),{sum:v.sum,avg:v.mean,min:v.min,max:v.max,count:v.count,coverage:A.coverage,partial:A.partial})}return p}function I(r){const s=new Map;let d=0;for(const{key:p,value:u}of r)Number.isFinite(u)&&(d+=u),p!=null&&s.set(String(p),d);return s}function K(r,s=1){const d=new Map,p=Math.max(1,Math.floor(s));for(let u=0;u<r.length;u++){const{key:b,value:a}=r[u];if(b==null)continue;const h=u>=p?r[u-p].value:null,w=Number.isFinite(a)?a:null,v=Number.isFinite(h)?h:null;d.set(String(b),w!==null&&v!==null?w-v:null)}return d}const R=4096;function S(r){let s=r>>>0;return()=>{s+=1831565813;let d=s;return d=Math.imul(d^d>>>15,d|1),d^=d+Math.imul(d^d>>>7,d|61),((d^d>>>14)>>>0)/4294967296}}function k(r,s){const d=r.length;if(d===1)return r[0];const p=(d-1)*s,u=Math.floor(p),b=Math.ceil(p);return u===b?r[u]:r[u]+(p-u)*(r[b]-r[u])}function y(r,s,d={}){const p=Math.min(1,Math.max(0,d.q==null?.5:d.q)),u=Math.max(1,Math.floor(d.cap==null?R:d.cap)),b=S(d.seed==null?2654435769:d.seed),a=new Map,h=r.length?r[0].at:0;if(s.kind==="session"){const v=new F(200,b);let A=0;for(const{key:_,value:V}of r)Number.isFinite(V)&&(v.add(V),A++),_!=null&&a.set(String(_),{value:A?v.quantile(p):null,approx:A>0,count:A,coverage:null,partial:!1});return a}const w=M(s);for(const{key:v,at:A,value:_}of r){Number.isFinite(_)&&w.push(_,A);const V=w.values(),Y=V.length;let $=null,j=!1;if(Y)if(Y<=u)$=k([...V].sort((O,N)=>O-N),p);else{const O=new F(200,b);for(const N of V)O.add(N);$=O.quantile(p),j=!0}const E=q(s,Y,A,h);v!=null&&a.set(String(v),{value:$,approx:j,count:Y,coverage:E.coverage,partial:E.partial})}return a}function l(r,s){const d=r.length,p=new Array(d).fill(null),u=Math.floor(s/2),b=s%2===0;for(let a=0;a<d;a++){if(a-u<0||a+u>=d)continue;let h=0,w=!0;if(b)for(let v=-u;v<=u;v++){const A=r[a+v];if(!Number.isFinite(A)){w=!1;break}h+=v===-u||v===u?A*.5:A}else for(let v=-u;v<=u;v++){const A=r[a+v];if(!Number.isFinite(A)){w=!1;break}h+=A}w&&(p[a]=h/s)}return p}function g(r,s){const d=new Map,p=Math.floor(Number(s&&s.period));if(!(p>=2))return d;const u=s&&s.model==="multiplicative",b=r.length,a=r.map(j=>Number.isFinite(j.value)?j.value:null),h=l(a,p),w=new Array(b).fill(null);for(let j=0;j<b;j++){const E=h[j],O=a[j];E===null||O===null||(u?E!==0&&(w[j]=O/E):w[j]=O-E)}const v=new Array(p).fill(0),A=new Array(p).fill(0);for(let j=0;j<b;j++){if(w[j]===null)continue;const E=j%p;v[E]+=w[j],A[E]+=1}const _=u?1:0,V=v.map((j,E)=>A[E]?j/A[E]:_),Y=V.reduce((j,E)=>j+E,0)/p,$=u?V.map(j=>Y!==0?j/Y:1):V.map(j=>j-Y);for(let j=0;j<b;j++){const{key:E}=r[j];if(E==null)continue;const O=h[j],N=$[j%p],T=a[j];let C=null;O!==null&&T!==null&&(C=u?O*N!==0?T/(O*N):null:T-O-N),d.set(String(E),{trend:O,seasonal:T===null?null:N,residual:C,coverage:O===null?0:1,partial:O===null})}return d}function i(r,s,d,p=80){const u=(Math.sqrt(5)-1)/2;let b=s,a=d,h=a-u*(a-b),w=b+u*(a-b),v=r(h),A=r(w);for(let _=0;_<p;_++)v<A?(a=w,w=h,A=v,h=a-u*(a-b),v=r(h)):(b=h,h=w,v=A,w=b+u*(a-b),A=r(w));return(b+a)/2}const t=1e-4,o=1-1e-4;function c(r,s){const d=r.length,p=new Array(d).fill(null),u=new Array(d).fill(null);let b=null,a=0;for(let h=0;h<d;h++){const w=r[h];if(!Number.isFinite(w)){b!==null&&(u[h]=b,p[h]=b);continue}if(b===null){b=w,u[h]=w,p[h]=w;continue}u[h]=b,a+=(w-b)**2,b=s*w+(1-s)*b,p[h]=b}return{smoothed:p,fitted:u,sse:a}}function f(r,s,d){const p=r.length,u=new Array(p).fill(null),b=new Array(p).fill(null);let a=null,h=null,w=0;for(let v=0;v<p;v++){const A=r[v];if(!Number.isFinite(A)){a!==null&&(a+=h,u[v]=a);continue}if(a===null){a=A,u[v]=A;continue}if(h===null){h=A-a;const Y=a+h;b[v]=Y,w+=(A-Y)**2;const $=a;a=s*A+(1-s)*($+h),h=d*(a-$)+(1-d)*h,u[v]=a;continue}const _=a+h;b[v]=_,w+=(A-_)**2;const V=a;a=s*A+(1-s)*(V+h),h=d*(a-V)+(1-d)*h,u[v]=a}return{smoothed:u,fitted:b,sse:w}}function n(r,s={}){const d=new Map,p=s.method==="holt",u=r.map(_=>Number.isFinite(_.value)?_.value:null),b=u.filter(_=>_!==null).length,a=_=>Math.min(o,Math.max(t,_)),h=()=>{for(const{key:_}of r)_!=null&&d.set(String(_),{smoothed:null,fitted:null,alpha:null,beta:null,sse:null});return d};if(b<(p?2:1))return h();let w=Number.isFinite(s.alpha)?a(s.alpha):null,v=p&&Number.isFinite(s.beta)?a(s.beta):null;if(p){if(w===null||v===null){let _=w===null?.5:w,V=v===null?.5:v;for(let Y=0;Y<6;Y++)w===null&&(_=i($=>f(u,$,V).sse,t,o)),v===null&&(V=i($=>f(u,_,$).sse,t,o));w=w===null?_:w,v=v===null?V:v}}else w===null&&(w=i(_=>c(u,_).sse,t,o));const A=p?f(u,w,v):c(u,w);for(let _=0;_<r.length;_++){const{key:V}=r[_];V!=null&&d.set(String(V),{smoothed:A.smoothed[_],fitted:A.fitted[_],alpha:w,beta:p?v:null,sse:A.sse})}return d}const m={ROLLING_WINDOW_FIELDS:x,QUANTILE_SPAN_CAP:R,rollingWindow:W,rollingQuantile:y,cumulativeToDate:I,periodOverPeriod:K,seasonalDecompose:g,exponentialSmoothing:n}}),Be("packages/core/src/compute/cluster.js",function(e,D){"use strict";Object.defineProperty(e,"CLUSTER_ROW_CAP",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"DBSCAN_ROW_CAP",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"DEFAULT_K",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"DEFAULT_MIN_POINTS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"orderByCentre",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"kmeans",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"dbscan",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"autoK",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"standardise",{enumerable:!0,get:function(){return t}});const re=1e5,M=2e4,G=3,F=5,x=100;function q(o){let c=o>>>0;return function(){c=c+1831565813|0;let n=Math.imul(c^c>>>15,1|c);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}function W(o,c){let f=0;for(let n=0;n<o.length;n++){const m=o[n]-c[n];f+=m*m}return f}function I(o,c){return Math.sqrt(W(o,c))}function K(o,c){let f=-1,n=1/0;for(let m=0;m<c.length;m++){const r=W(o,c[m]);r<n&&(n=r,f=m)}return f}function R(o,c,f){const n=q(f),m=o.length,r=[Array.from(o[Math.floor(n()*m)])],s=new Float64Array(m).fill(1/0);for(let d=1;d<c;d++){let p=0;for(let h=0;h<m;h++){const w=W(o[h],r[r.length-1]);w<s[h]&&(s[h]=w),p+=s[h]}const u=n()*(p||m);let b=0,a=m-1;for(let h=0;h<m;h++)if(b+=p?s[h]:1,b>=u){a=h;break}r.push(Array.from(o[a]))}return r}function S(o,c){for(let f=0;f<o.length;f++){const n=o[f]-c[f];if(n!==0)return n}return 0}function k(o,c,f,n){const m=c.map((s,d)=>({centre:s,i:d})).sort((s,d)=>S(s.centre,d.centre)),r=new Int32Array(c.length);for(let s=0;s<m.length;s++)r[m[s].i]=s;for(let s=0;s<o.length;s++)o[s]>=0&&(o[s]=r[o[s]]);return{assignments:o,centres:m.map(s=>s.centre),sizes:m.map(s=>f[s.i]),distances:n}}function y(o,c={}){const f=o.length,n=f?o[0].length:0,m=Math.floor(c.k||G);if(!(f>=m)||m<1||n<1)return null;let r=R(o,m,c.seed===void 0?1:c.seed);const s=new Int32Array(f);let d=!0;for(let a=0;a<x&&d;a++){d=!1;for(let v=0;v<f;v++){const A=K(o[v],r);s[v]!==A&&(s[v]=A,d=!0)}const h=r.map(()=>new Float64Array(n)),w=new Array(m).fill(0);for(let v=0;v<f;v++){const A=s[v];for(let _=0;_<n;_++)h[A][_]+=o[v][_];w[A]++}for(let v=0;v<m;v++)if(w[v])for(let A=0;A<n;A++)r[v][A]=h[v][A]/w[v];else{let A=0,_=-1/0;for(let V=0;V<f;V++){const Y=W(o[V],r[v]);Y>_&&(_=Y,A=V)}r[v]=Array.from(o[A]),d=!0}}const p=new Array(m).fill(0),u=new Float64Array(f);let b=0;for(let a=0;a<f;a++){const h=s[a];p[h]++;const w=W(o[a],r[h]);u[a]=Math.sqrt(w),b+=w}return{assignments:s,centres:r,sizes:p,inertia:b,distances:u}}function l(o,c={}){const f=o.length,n=f?o[0].length:0,m=Number(c.eps),r=Math.max(1,Math.floor(c.minPoints||F));if(!(m>0)||f===0||n<1)return null;const s=new Array(f);for(let w=0;w<f;w++){const v=[];for(let A=0;A<f;A++)w!==A&&I(o[w],o[A])<=m&&v.push(A);s[w]=v}const d=new Int32Array(f).fill(-1);let p=0;for(let w=0;w<f;w++){if(d[w]!==-1||s[w].length<r)continue;d[w]=p;const v=[...s[w]];for(let A=0;A<v.length;A++){const _=v[A];d[_]===-1&&(d[_]=p,s[_].length>=r&&v.push(...s[_]))}p++}if(!p)return{assignments:d,centres:[],sizes:[],distances:new Float64Array(f).fill(NaN)};const u=[],b=new Array(p).fill(0),a=Array.from({length:p},()=>new Float64Array(n));for(let w=0;w<f;w++){const v=d[w];if(!(v<0)){b[v]++;for(let A=0;A<n;A++)a[v][A]+=o[w][A]}}for(let w=0;w<p;w++){const v=new Array(n);for(let A=0;A<n;A++)v[A]=a[w][A]/b[w];u.push(v)}const h=new Float64Array(f).fill(NaN);for(let w=0;w<f;w++){const v=d[w];v>=0&&(h[w]=I(o[w],u[v]))}return{assignments:d,centres:u,sizes:b,distances:h}}function g(o,c,f){const n=o.length;if(n===0)return 0;const m=new Int32Array(f);for(let s=0;s<n;s++)m[c[s]]++;let r=0;for(let s=0;s<n;s++){const d=c[s],p=new Float64Array(f);for(let a=0;a<n;a++)s!==a&&(p[c[a]]+=I(o[s],o[a]));const u=m[d]>1?p[d]/(m[d]-1):0;let b=1/0;for(let a=0;a<f;a++){if(a===d||m[a]===0)continue;const h=p[a]/m[a];h<b&&(b=h)}b!==1/0&&(r+=(b-u)/Math.max(u,b))}return r/n}function i(o,c={}){const f=o.length;if(!f)return null;const n=c.criterion==="silhouette"?"silhouette":"elbow",m=Math.max(2,Math.floor(c.maxK||8)),r=c.seed===void 0?1:c.seed;if(n==="silhouette"){const w=[],v=[];for(let _=2;_<=Math.min(m,f);_++){const V=y(o,{k:_,seed:r});V&&(w.push(_),v.push(g(o,V.assignments,_)))}if(!w.length)return null;let A=0;for(let _=1;_<v.length;_++)v[_]>v[A]&&(A=_);return{k:w[A],criterion:n,scores:v,ks:w}}const s=[],d=[];for(let w=1;w<=Math.min(m,f);w++){const v=y(o,{k:w,seed:r});v&&(s.push(w),d.push(v.inertia))}if(d.length<2)return null;const p={k:s[0],y:d[0]},u={k:s[s.length-1],y:d[d.length-1]},b=Math.hypot(u.k-p.k,u.y-p.y)||1;let a=0,h=-1/0;for(let w=0;w<d.length;w++){const v=Math.abs((u.k-p.k)*(p.y-d[w])-(p.k-s[w])*(u.y-p.y))/b;v>h&&(h=v,a=w)}return{k:s[a],criterion:n,scores:d,ks:s}}function t(o){const c=o.length,f=c?o[0].length:0;if(!c||!f)return null;const n=new Array(f).fill(0);for(let r=0;r<c;r++)for(let s=0;s<f;s++)n[s]+=o[r][s];for(let r=0;r<f;r++)n[r]/=c;const m=new Array(f).fill(0);for(let r=0;r<c;r++)for(let s=0;s<f;s++){const d=o[r][s]-n[s];m[s]+=d*d}for(let r=0;r<f;r++)m[r]=c>1?Math.sqrt(m[r]/(c-1)):0;for(let r=0;r<c;r++)for(let s=0;s<f;s++)m[s]>0?o[r][s]=(o[r][s]-n[s])/m[s]:o[r][s]=o[r][s]-n[s];return{mean:n,sd:m}}}),Be("packages/core/src/compute/compare.js",function(e,D){"use strict";Object.defineProperty(e,"COMPARE_MEASURES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"pooledStandardMeanDifference",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"numericSummary",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"bothNumeric",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"compareColumnAcross",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"compareDatasets",{enumerable:!0,get:function(){return l}});const re=D("packages/core/src/compute/statistics.js"),M=re.numbers,G=re.moments,F=re.frequencyMap,x=re.categoricalDistance,q=re.normalTotalVariation,W=re.isNumericColumn,I=re.SUBSET_RELIABILITY_FLOOR,K=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function R(g,i){if(!g||!i||!(g.n>0)||!(i.n>0)||!Number.isFinite(g.mean)||!Number.isFinite(i.mean))return null;const t=(g.n*g.sd*g.sd+i.n*i.sd*i.sd)/(g.n+i.n);return t>0?(g.mean-i.mean)/Math.sqrt(t):null}function S(g,i){const t=M(g,i),{n:o,mean:c,m2:f}=G(t),n=o>0?Math.sqrt(f/o):0;return{mean:c,sd:n,n:o}}function k(g,i,t,o){return W(g,i)&&W(t,o)}function y(g,i,t,o){if(k(g,i,t,o)){const m=S(g,i),r=S(t,o),s=R(m,r);return{measure:K.numeric,magnitude:s,distance:s===null?0:q(s),direction:s===null?0:Math.sign(s),nA:m.n,nB:r.n,meanA:m.mean,meanB:r.mean,reliable:m.n>=I&&r.n>=I}}const c=F(g,i),f=F(t,o),n=x(c.map,c.total,f.map,f.total);return{measure:K.categorical,magnitude:n,distance:n===null?0:n,direction:0,nA:c.total,nB:f.total,meanA:null,meanB:null,reliable:c.total>=I&&f.total>=I}}function l(g,i,t={}){const o=new Set(g.columns),c=new Set(i.columns),f=g.columns.filter(d=>c.has(d)),n=Array.isArray(t.columns)&&t.columns.length?f.filter(d=>t.columns.includes(d)):f,m=g.indices(),r=i.indices(),s=[];for(const d of n){const p=g.handle(d),u=i.handle(d);if(!p||!u)continue;const b=y(p,m,u,r);s.push({column:d,name:g.name&&g.name(d)||i.name&&i.name(d)||d,measure:b.measure,magnitude:b.magnitude,distance:b.distance,direction:b.direction,nA:b.nA,nB:b.nB,meanA:b.meanA,meanB:b.meanB,reliable:b.reliable})}return s.sort((d,p)=>p.distance-d.distance||Math.abs(p.magnitude||0)-Math.abs(d.magnitude||0)),{ranked:s,nA:m.length,nB:r.length,unmatched:{onlyA:g.columns.filter(d=>!c.has(d)),onlyB:i.columns.filter(d=>!o.has(d))},measures:K}}}),Be("packages/core/src/compute/anomaly.js",function(e,D){"use strict";Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DEFAULT_MODIFIED_Z_THRESHOLD",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return m}});const M=D("packages/core/src/compute/statistics.js").quantileSorted,F=D("packages/core/src/compute/special.js").logGamma,x=.6745,q=3.5,W=1.5,I=.975,K=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function R(r){if(!r.length)return null;const d=Array.from(r,Number).sort((a,h)=>a-h),p=M(d,.5),u=d.map(a=>Math.abs(a-p)).sort((a,h)=>a-h),b=M(u,.5);return{median:p,mad:b}}function S(r,s={}){const d=Number.isFinite(s.threshold)?s.threshold:q,p=r.length,u=new Array(p).fill(null),b=new Array(p).fill(!1),a=[];for(let v=0;v<p;v++){const A=Number(r[v]);Number.isFinite(A)&&a.push(A)}if(!a.length)return{median:null,mad:null,threshold:d,scores:u,flags:b,flagged:0};const h=R(a);if(h.mad===0)return{median:h.median,mad:0,threshold:d,scores:u,flags:b,flagged:0};let w=0;for(let v=0;v<p;v++){const A=Number(r[v]);if(!Number.isFinite(A))continue;const _=x*(A-h.median)/h.mad;u[v]=_,Math.abs(_)>d&&(b[v]=!0,w++)}return{median:h.median,mad:h.mad,threshold:d,scores:u,flags:b,flagged:w}}function k(r,s={}){const d=Number.isFinite(s.k)?s.k:W,p=[];for(let w=0;w<r.length;w++){const v=Number(r[w]);Number.isFinite(v)&&p.push(v)}if(!p.length)return null;const u=p.sort((w,v)=>w-v),b=M(u,.25),a=M(u,.75),h=a-b;return{q1:b,q3:a,iqr:h,lower:b-d*h,upper:a+d*h,k:d}}function y(r,s){if(s<=0)return 0;const d=F(r);if(s<r+1){let v=r,A=1/r,_=A;for(let V=0;V<1e3&&(v+=1,_*=s/v,A+=_,!(Math.abs(_)<Math.abs(A)*1e-15));V++);return A*Math.exp(-s+r*Math.log(s)-d)}const p=1e-300;let u=s+1-r,b=1/p,a=1/u,h=a;for(let v=1;v<1e3;v++){const A=-v*(v-r);u+=2,a=A*a+u,Math.abs(a)<p&&(a=p),b=u+A/b,Math.abs(b)<p&&(b=p),a=1/a;const _=a*b;if(h*=_,Math.abs(_-1)<1e-15)break}return 1-Math.exp(-s+r*Math.log(s)-d)*h}function l(r,s){return r<=0?0:y(s/2,r/2)}function g(r,s=I){if(!(s>0)||!(s<1))return NaN;let d=0,p=Math.max(1,r);for(;l(p,r)<s;)p*=2;for(let u=0;u<200;u++){const b=(d+p)/2;if(l(b,r)<s?d=b:p=b,p-d<1e-10)break}return(d+p)/2}function i(r){const s=r.length,d=r.map((p,u)=>{const b=p.slice();for(let a=0;a<s;a++)b.push(u===a?1:0);return b});for(let p=0;p<s;p++){let u=p;for(let a=p+1;a<s;a++)Math.abs(d[a][p])>Math.abs(d[u][p])&&(u=a);if(Math.abs(d[u][p])<1e-12)return null;if(u!==p){const a=d[u];d[u]=d[p],d[p]=a}const b=d[p][p];for(let a=0;a<2*s;a++)d[p][a]/=b;for(let a=0;a<s;a++){if(a===p)continue;const h=d[a][p];if(h!==0)for(let w=0;w<2*s;w++)d[a][w]-=h*d[p][w]}}return d.map(p=>p.slice(s))}function t(r,s){const d=r.length,p=new Array(s).fill(0);for(const a of r)for(let h=0;h<s;h++)p[h]+=a[h];for(let a=0;a<s;a++)p[a]/=d;const u=Array.from({length:s},()=>new Array(s).fill(0));for(const a of r)for(let h=0;h<s;h++){const w=a[h]-p[h];for(let v=h;v<s;v++)u[h][v]+=w*(a[v]-p[v])}const b=d>1?d-1:1;for(let a=0;a<s;a++)for(let h=a;h<s;h++)u[a][h]/=b,u[h][a]=u[a][h];return{mean:p,cov:u}}function o(r,s={}){const d=Number.isFinite(s.p)?s.p:I,p=Number.isFinite(s.ridge)?s.ridge:1e-6,u=r.length;if(!u)return null;const b=r[0].length;if(!b)return null;const a=new Array(u).fill(null),h=new Array(u).fill(null),w=new Array(u).fill(!1),v=[],A=[];for(let N=0;N<u;N++){const T=r[N];let C=T.length===b;const B=new Array(b);for(let z=0;C&&z<b;z++){const X=Number(T[z]);Number.isFinite(X)?B[z]=X:C=!1}C&&(v.push(N),A.push(B))}const _=b,V=g(_,d);if(A.length<=b)return{center:[],df:_,cutoff:V,singular:!0,used:A.length,distances:a,squared:h,flags:w,flagged:0};const{mean:Y,cov:$}=t(A,b);let j=i($),E=!1;if(!j){E=!0;let N=0;for(let B=0;B<b;B++)N+=$[B][B];const T=N/b*p||p,C=$.map((B,z)=>B.map((X,Q)=>z===Q?X+T:X));if(j=i(C),!j)return{center:Y,df:_,cutoff:V,singular:!0,used:A.length,distances:a,squared:h,flags:w,flagged:0}}let O=0;for(let N=0;N<A.length;N++){const T=A[N],C=new Array(b);for(let X=0;X<b;X++)C[X]=T[X]-Y[X];let B=0;for(let X=0;X<b;X++){let Q=0;for(let H=0;H<b;H++)Q+=j[X][H]*C[H];B+=C[X]*Q}B<0&&(B=0);const z=v[N];h[z]=B,a[z]=Math.sqrt(B),B>V&&(w[z]=!0,O++)}return{center:Y,df:_,cutoff:V,singular:E,used:A.length,distances:a,squared:h,flags:w,flagged:O}}const c=20,f=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function n(r,s={}){const d=s.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",p=Number.isFinite(s.windowLen)&&s.windowLen>=1?Math.floor(s.windowLen):c,u=Number.isFinite(s.threshold)?s.threshold:q,b=Number.isFinite(s.k)?s.k:W,a=Number.isFinite(s.minPeriods)&&s.minPeriods>=1?Math.floor(s.minPeriods):p,h=r.length,w=new Array(h).fill(null),v=new Array(h).fill(!1);let A=0;for(let _=0;_<h;_++){const V=Number(r[_]);if(!Number.isFinite(V))continue;const Y=Math.max(0,_-p+1),$=[];for(let j=Y;j<=_;j++){const E=Number(r[j]);Number.isFinite(E)&&$.push(E)}if(!($.length<a))if(d==="rollingIqr"){const j=k($,{k:b});if(!j)continue;(V<j.lower||V>j.upper)&&(v[_]=!0,A++)}else{const j=R($);if(!j||j.mad===0)continue;const E=x*(V-j.median)/j.mad;w[_]=E,Math.abs(E)>u&&(v[_]=!0,A++)}}return{method:d,windowLen:p,minPeriods:a,threshold:u,k:b,scores:w,flags:v,flagged:A}}function m(r={}){const s=r||{},d=s.field;if(typeof d!="string"||!d)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const p=s.method||"modifiedZScore";if(!(K.includes(p)||f.includes(p))||p==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${p}'`);const b=typeof s.orderBy=="string"?s.orderBy:null,a=s.latest===!0,h=f.includes(p),w=v=>Number(v==null?NaN:v[d]);return v=>{const A=Array.isArray(v)?v.slice():[...v];b&&A.sort((j,E)=>{const O=j?.[b],N=E?.[b];return O===N?0:O==null?-1:N==null?1:O<N?-1:1});const _=A.map(w);let V,Y;if(h)({flags:V,scores:Y}=n(_,{method:p,windowLen:s.windowLen,threshold:s.threshold,k:s.k,minPeriods:s.minPeriods}));else if(p==="iqr"){const j=k(_,{k:s.k});V=_.map(E=>j?Number.isFinite(E)&&(E<j.lower||E>j.upper):!1),Y=_.map(()=>null)}else({flags:V,scores:Y}=S(_,{threshold:s.threshold}));if(a){const j=V.length-1;return j<0||!V[j]?!1:{method:p,field:d,flagged:[{row:A[j],score:Y[j]}]}}const $=[];for(let j=0;j<V.length;j++)V[j]&&$.push({row:A[j],score:Y[j]});return $.length?{method:p,field:d,flagged:$}:!1}}}),Be("packages/core/src/compute/forecast.js",function(e,D){"use strict";Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r}});const re=D("packages/core/src/compute/special.js"),M=re.normalQuantile,G=re.studentTQuantile,x=D("packages/core/src/internal/warn.js").warnOnce,q=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),W=1e-4,I=1-1e-4;function K(s){const d=[];for(let p=0;p<s.length;p++){const u=s[p];if(u!==null&&typeof u=="object"){const b=Number.isFinite(u.at)?u.at:p,a=Number.isFinite(u.value)?u.value:null;d.push({at:b,value:a})}else d.push({at:p,value:Number.isFinite(u)?Number(u):null})}return d}function R(s){const d=s.filter(h=>h.value!==null),p=d[0],u=d[d.length-1],b=u.at-p.at,a=d.length>1&&b>0?b/(d.length-1):1;return{lastAt:u.at,step:a}}function S(s){return Math.min(I,Math.max(W,s))}function k(s,d=W,p=I,u=80){const b=(Math.sqrt(5)-1)/2;let a=d,h=p,w=h-b*(h-a),v=a+b*(h-a),A=s(w),_=s(v);for(let V=0;V<u;V++)A<_?(h=v,v=w,_=A,w=h-b*(h-a),A=s(w)):(a=w,w=v,A=_,v=a+b*(h-a),_=s(v));return(a+h)/2}function y(s,d){let p=null,u=0,b=0;for(let a=0;a<s.length;a++){const h=s[a];if(h!==null){if(p===null){p=h;continue}u+=(h-p)**2,b+=1,p=d*h+(1-d)*p}}return{level:p,sse:u,m:b}}function l(s,d,p){let u=null,b=null,a=0,h=0;for(let w=0;w<s.length;w++){const v=s[w];if(v===null){u!==null&&b!==null&&(u+=b);continue}if(u===null){u=v;continue}b===null&&(b=v-u);const A=u+b;a+=(v-A)**2,h+=1;const _=u;u=d*v+(1-d)*(_+b),b=p*(u-_)+(1-p)*b}return{level:u,trend:b,sse:a,m:h}}function g(s,d,p,u,b){const a=s.length;if(a<2*d)return null;const h=E=>{let O=0,N=0;for(let T=E;T<E+d&&T<a;T++)s[T]!==null&&(O+=s[T],N+=1);return N?O/N:null},w=h(0),v=h(d);if(w===null||v===null)return null;let A=w,_=(v-w)/d;const V=new Array(d).fill(0);for(let E=0;E<d;E++)V[E]=s[E]===null?0:s[E]-A;const Y=V.reduce((E,O)=>E+O,0)/d;for(let E=0;E<d;E++)V[E]-=Y;let $=0,j=0;for(let E=d;E<a;E++){const O=E%d,N=V[O],T=s[E];if(T===null){A+=_;continue}const C=A+_+N;$+=(T-C)**2,j+=1;const B=A;A=p*(T-N)+(1-p)*(A+_),_=u*(A-B)+(1-u)*_,V[O]=b*(T-A)+(1-b)*N}return{level:A,trend:_,season:V,phase:(a-1)%d,sse:$,count:j}}function i(s,d,p){let u=1;for(const a of d)u+=a*a;const b=Math.sqrt(s*u);return{se:b,margin:p*b}}function t(s,d={}){if(!s||typeof s.length!="number"||s.length===0)return null;const p=q.includes(d.method)?d.method:"linear",u=Math.max(1,Math.floor(Number(d.horizon)||1)),b=Number.isFinite(d.confidence)&&d.confidence>0&&d.confidence<1?d.confidence:.95,a=1-(1-b)/2,h=K(s),w=h.map($=>$.value),v=w.filter($=>$!==null),A=v.length,{lastAt:_,step:V}=A?R(h):{lastAt:0,step:1},Y=$=>_+$*V;return p==="linear"?o(h,A,u,b,a,Y):p==="movingAverage"?c(v,A,u,b,a,d,Y):p==="ses"?f(w,A,u,b,a,d,Y):p==="holt"?n(w,A,u,b,a,d,Y):m(w,A,u,b,a,d,Y)}function o(s,d,p,u,b,a){if(d<2)return null;let h=0,w=0;for(const T of s)T.value!==null&&(h+=T.at,w+=T.value);h/=d,w/=d;let v=0,A=0,_=0;for(const T of s){if(T.value===null)continue;const C=T.at-h,B=T.value-w;v+=C*C,A+=C*B,_+=B*B}if(v===0)return null;const V=A/v,Y=w-V*h,$=_===0?1:Math.max(0,Math.min(1,A*A/(v*_))),j=Math.max(0,_-V*A),E=d>2?Math.sqrt(j/(d-2)):null,O=d>2?G(b,d-2):null,N=[];for(let T=1;T<=p;T++){const C=a(T),B=Y+V*C;let z=null,X=null,Q=null,H=null,L=null;if(E!==null){const Z=1/d+(C-h)**2/v,ee=E*Math.sqrt(1+Z),te=E*Math.sqrt(Z);L=ee,z=B-O*ee,X=B+O*ee,Q=B-O*te,H=B+O*te}N.push({step:T,at:C,mean:B,lower:z,upper:X,lowerMean:Q,upperMean:H,se:L})}return{method:"linear",horizon:p,confidence:u,n:d,sigma:E,r2:$,params:{slope:V,intercept:Y},points:N}}function c(s,d,p,u,b,a,h){if(d<1)return null;const w=Math.max(1,Math.min(d,Math.floor(Number(a.windowLen)||d))),v=s.slice(d-w);let A=0;for(const E of v)A+=E;const _=A/w;let V=null,Y=null;if(w>1){let E=0;for(const N of v)E+=(N-_)**2;V=Math.sqrt(E/(w-1))*Math.sqrt(1+1/w),Y=G(b,w-1)}const $=V===null?null:Y*V,j=[];for(let E=1;E<=p;E++)j.push({step:E,at:h(E),mean:_,lower:$===null?null:_-$,upper:$===null?null:_+$,se:V});return{method:"movingAverage",horizon:p,confidence:u,n:d,sigma:V===null?null:V,params:{windowLen:w},points:j}}function f(s,d,p,u,b,a,h){if(d<1)return null;let w=Number.isFinite(a.alpha)?S(a.alpha):null;w===null&&(w=k(Y=>y(s,Y).sse));const v=y(s,w),A=M(b),_=v.m>0?v.sse/v.m:null,V=[];for(let Y=1;Y<=p;Y++){const $=v.level;let j=null,E=null,O=null;if(_!==null){const N=[];for(let C=1;C<Y;C++)N.push(w);const T=i(_,N,A);O=T.se,j=$-T.margin,E=$+T.margin}V.push({step:Y,at:h(Y),mean:$,lower:j,upper:E,se:O})}return{method:"ses",horizon:p,confidence:u,n:d,sigma:_===null?null:Math.sqrt(_),params:{alpha:w},points:V}}function n(s,d,p,u,b,a,h){if(d<2)return null;let w=Number.isFinite(a.alpha)?S(a.alpha):null,v=Number.isFinite(a.beta)?S(a.beta):null;if(w===null||v===null){let j=w===null?.5:w,E=v===null?.5:v;for(let O=0;O<6;O++)w===null&&(j=k(N=>l(s,N,E).sse)),v===null&&(E=k(N=>l(s,j,N).sse));w=w===null?j:w,v=v===null?E:v}const A=l(s,w,v),_=M(b),V=A.m>0?A.sse/A.m:null,Y=w*v,$=[];for(let j=1;j<=p;j++){const E=A.level+j*A.trend;let O=null,N=null,T=null;if(V!==null){const C=[];for(let z=1;z<j;z++)C.push(w+z*Y);const B=i(V,C,_);T=B.se,O=E-B.margin,N=E+B.margin}$.push({step:j,at:h(j),mean:E,lower:O,upper:N,se:T})}return{method:"holt",horizon:p,confidence:u,n:d,sigma:V===null?null:Math.sqrt(V),params:{alpha:w,beta:v},points:$}}function m(s,d,p,u,b,a,h){const w=Math.floor(Number(a.period));if(!(w>=2))return x("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(d<2*w)return null;let v=Number.isFinite(a.alpha)?S(a.alpha):null,A=Number.isFinite(a.beta)?S(a.beta):null,_=Number.isFinite(a.gamma)?S(a.gamma):null;const V=(T,C,B)=>{const z=g(s,w,T,C,B);return z?z.sse:1/0};if(v===null||A===null||_===null){let T=v===null?.5:v,C=A===null?.5:A,B=_===null?.5:_;for(let z=0;z<8;z++)v===null&&(T=k(X=>V(X,C,B))),A===null&&(C=k(X=>V(T,X,B))),_===null&&(B=k(X=>V(T,C,X)));v=v===null?T:v,A=A===null?C:A,_=_===null?B:_}const Y=g(s,w,v,A,_);if(!Y)return null;const $=M(b),j=Y.count>0?Y.sse/Y.count:null,E=v*A,O=_*(1-v),N=[];for(let T=1;T<=p;T++){const C=Y.season[(Y.phase+T)%w],B=Y.level+T*Y.trend+C;let z=null,X=null,Q=null;if(j!==null){const H=[];for(let Z=1;Z<T;Z++)H.push(v+Z*E+(Z%w===0?O:0));const L=i(j,H,$);Q=L.se,z=B-L.margin,X=B+L.margin}N.push({step:T,at:h(T),mean:B,lower:z,upper:X,se:Q})}return{method:"holtWinters",horizon:p,confidence:u,n:d,sigma:j===null?null:Math.sqrt(j),params:{alpha:v,beta:A,gamma:_,period:w},points:N}}const r={FORECAST_METHODS:q,forecast:t}}),Be("packages/core/src/compute/hypothesis.js",function(e,D){"use strict";Object.defineProperty(e,"GROUP_TESTS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"NORMALITY_ALPHA",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"HL_PAIR_LIMIT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"welchTTest",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"mannWhitneyUTest",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"chiSquareTest",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return $}});const M=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/compute/handle.js").valueReader,x=D("packages/core/src/compute/statistics.js"),q=x.numbers,W=x.moments,I=x.frequencyMap,K=x.categoricalDistance,R=x.isNumericColumn,S=x.jarqueBera,k=x.proportionInterval,y=x.SUBSET_RELIABILITY_FLOOR,g=D("packages/core/src/compute/compare.js").pooledStandardMeanDifference,i=D("packages/core/src/compute/special.js"),t=i.studentT,o=i.studentTQuantile,c=i.normalCdf,f=i.normalQuantile,n=i.chiSquareUpperTail,m=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),r=.05,s=2e6;function d(j){const E=Number(j);return Number.isFinite(E)&&E>0&&E<1?E:.95}function p(j){const{n:E,mean:O,m2:N}=W(j);return{mean:O,sd:E>0?Math.sqrt(N/E):0,n:E}}function u(j,E){const O=j.length;if(O<2)return 0;let N=0;for(let T=0;T<O;T++){const C=j[T]-E;N+=C*C}return N/(O-1)}function b(j,E){return{name:"pooledStandardMeanDifference",value:g(p(j),p(E))}}function a(j,E,O){const N=j.length,T=E.length;if(N<2||T<2)return null;const C=d(O),{mean:B}=W(j),{mean:z}=W(E),X=u(j,B),Q=u(E,z),H=X/N+Q/T;if(!(H>0))return null;const L=Math.sqrt(H),Z=(B-z)/L,ee=X/N*(X/N)/(N-1),te=Q/T*(Q/T)/(T-1),se=H*H/(ee+te),ne=Math.min(1,Math.max(0,2*(1-t(Math.abs(Z),se)))),ae=B-z,de=o(1-(1-C)/2,se)*L;return{test:m.WELCH,statistic:Z,statisticName:"t",df:se,pValue:ne,interval:{estimate:ae,lower:ae-de,upper:ae+de,confidence:C,method:"welch-t (difference of means)"},effectSize:b(j,E),nA:N,nB:T,reliable:N>=y&&T>=y,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function h(j){const E=j.length;if(E===0)return Number.NaN;const O=E>>1;return E%2?j[O]:(j[O-1]+j[O])/2}function w(j,E,O){const N=j.length,T=E.length,C=N*T;if(C===0||C>s)return null;const B=new Float64Array(C);let z=0;for(let ee=0;ee<N;ee++)for(let te=0;te<T;te++)B[z++]=j[ee]-E[te];B.sort();const X=h(B),Q=Math.sqrt(N*T*(N+T+1)/12),H=f(1-(1-O)/2);let L=Math.round(C/2-H*Q);L>=0||(L=0);const Z=Math.floor((C-1)/2);return L>Z&&(L=Z),{estimate:X,lower:B[L],upper:B[C-1-L],confidence:O,method:"hodges-lehmann (normal approximation)"}}function v(j,E,O){const N=j.length,T=E.length;if(N<1||T<1)return null;const C=d(O),B=N+T,z=new Array(B);for(let ne=0;ne<N;ne++)z[ne]={v:j[ne],g:0};for(let ne=0;ne<T;ne++)z[N+ne]={v:E[ne],g:1};z.sort((ne,ae)=>ne.v-ae.v);let X=0,Q=0,H=0;for(;H<B;){let ne=H;for(;ne<B&&z[ne].v===z[H].v;)ne++;const ae=ne-H,de=(H+1+ne)/2;for(let le=H;le<ne;le++)z[le].g===0&&(X+=de);Q+=ae*ae*ae-ae,H=ne}const L=X-N*(N+1)/2,Z=N*T/2,ee=N*T/12*(B+1-Q/(B*(B-1)));let te=1;if(ee>0){const ne=Math.max(0,Math.abs(L-Z)-.5);te=Math.min(1,2*c(-ne/Math.sqrt(ee)))}const se=w(j,E,C);return{test:m.MANN_WHITNEY,statistic:L,statisticName:"U",df:null,pValue:te,interval:se,effectSize:b(j,E),nA:N,nB:T,reliable:N>=y&&T>=y,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function A(j,E,O,N,T){const C=k(j,E,T),B=k(O,N,T);if(!C||!B)return null;const z=C.proportion-B.proportion,X=z-Math.sqrt((C.proportion-C.lower)**2+(B.upper-B.proportion)**2),Q=z+Math.sqrt((C.upper-C.proportion)**2+(B.proportion-B.lower)**2);return{lower:X,upper:Q}}function _(j,E,O,N,T,C={}){if(!(E>0)||!(N>0))return null;const B=new Set([...j.keys(),...O.keys()]),z=B.size;if(z<2)return null;const X=E+N;let Q=0;for(const te of B){const se=j.get(te)||0,ne=O.get(te)||0,ae=se+ne,de=E*ae/X,le=N*ae/X;de>0&&(Q+=(se-de)*(se-de)/de),le>0&&(Q+=(ne-le)*(ne-le)/le)}const H=z-1,L=n(Q,H);let Z=null;C.category!==void 0&&B.has(C.category)?Z=C.category:z===2&&([Z]=[...B]);let ee=null;if(Z!==null){const te=A(j.get(Z)||0,E,O.get(Z)||0,N,d(T));te&&(ee={estimate:(j.get(Z)||0)/E-(O.get(Z)||0)/N,lower:te.lower,upper:te.upper,confidence:d(T),method:"newcombe (difference in this category's share)",category:Z})}return{test:m.CHI_SQUARE,statistic:Q,statisticName:"chiSquare",df:H,pValue:L,interval:ee,effectSize:{name:"categoricalTotalVariation",value:K(j,E,O,N)},nA:E,nB:N,reliable:E>=y&&N>=y,method:"Pearson chi-square test of independence (2×k, no continuity correction)"}}function V(j){return j==null||j===""||typeof j=="number"&&Number.isNaN(j)?null:j instanceof Date?j.getTime():typeof j=="object"?String(j):j}function Y(j,E,O){if(O===m.WELCH||O===m.MANN_WHITNEY)return{test:O,chosenBy:"override",reason:`caller override: ${O}`};const N=S(j),T=S(E),C=N===null?null:Math.exp(-N/2),B=T===null?null:Math.exp(-T/2);return C!==null&&C<r||B!==null&&B<r?{test:m.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${r})`}:{test:m.WELCH,chosenBy:"auto",reason:C!==null||B!==null?"column family: numeric, no departure from normality detected":"column family: numeric (too few rows to screen normality)"}}function $(j,E,O,N={}){if(!j||!E)return null;const T=d(N.confidence),C=F(E);let B;if(Array.isArray(N.groups)&&N.groups.length===2)B=[V(N.groups[0]),V(N.groups[1])];else{const{map:ne}=I(E,O),ae=[...ne.entries()].sort((de,le)=>le[1]-de[1]).slice(0,2).map(de=>de[0]);if(ae.length<2)return M("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;B=ae}const[z,X]=B;if(z===null||X===null||z===X)return M("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const Q=[],H=[];for(let ne=0;ne<O.length;ne++){const ae=V(C(O[ne]));ae===z?Q.push(O[ne]):ae===X&&H.push(O[ne])}if(Q.length===0||H.length===0)return M("compareGroups:empty","[lattice] compareGroups: one of the two groups has no rows in the current set."),null;const L=N.test&&N.test!=="auto"?String(N.test):null,Z=R(j,Q.concat(H));let ee,te,se;if(L===m.CHI_SQUARE||!L&&!Z){te=L?"override":"auto",se=L?"caller override: chiSquare":"column family: categorical";const ne=I(j,Q),ae=I(j,H);ee=_(ne.map,ne.total,ae.map,ae.total,T,{category:N.category})}else{if((L===m.WELCH||L===m.MANN_WHITNEY)&&!Z)return M("compareGroups:numeric-override",`[lattice] compareGroups: ${L} needs a numeric column, but the column is not numeric.`),null;const ne=q(j,Q),ae=q(j,H),de=Y(ne,ae,L);te=de.chosenBy,se=de.reason,ee=de.test===m.MANN_WHITNEY?v(ne,ae,T):a(ne,ae,T)}return ee?{...ee,chosenBy:te,reason:se,groups:[z,X]}:(M("compareGroups:degenerate","[lattice] compareGroups: the chosen test had too little to work with (too few values, or no variation)."),null)}}),Be("packages/core/src/compute/significance.js",function(e,D){"use strict";Object.defineProperty(e,"COMPARE_TESTS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"compare",{enumerable:!0,get:function(){return be}});const M=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/compute/handle.js").valueReader,x=D("packages/core/src/compute/statistics.js"),q=x.numbers,W=x.moments,I=x.frequencyMap,K=x.isNumericColumn,R=x.jarqueBera,S=x.proportionInterval,k=D("packages/core/src/compute/special.js"),y=k.studentT,l=k.studentTQuantile,g=k.normalCdf,i=k.normalQuantile,t=k.chiSquareUpperTail,o=k.incompleteBeta,c=Object.freeze({T:"t",WELCH:"welch",MANN_WHITNEY:"mannWhitney",ANOVA:"anova",KRUSKAL:"kruskal",CHI_SQUARE:"chiSquare",PROPORTIONS:"proportions"}),f=new Set([c.T,c.WELCH,c.MANN_WHITNEY]),n=new Set([c.ANOVA,c.KRUSKAL]),m=new Set([c.CHI_SQUARE,c.PROPORTIONS]),r=.05,s=[.2,.5,.8],d=[.147,.33,.474],p=[.01,.06,.14],u=[[.1,.3,.5],[.07,.21,.35],[.06,.17,.29],[.05,.15,.25]];function b(he){const ie=Number(he);return Number.isFinite(ie)&&ie>0&&ie<1?ie:.05}function a(he){return he==null||he===""||typeof he=="number"&&Number.isNaN(he)?null:he instanceof Date?he.getTime():typeof he=="object"?String(he):he}function h(he,ie){const ue=F(he),ge=[],pe=new Map;for(let Oe=0;Oe<ie.length;Oe++){const ve=a(ue(ie[Oe]));if(ve===null)continue;let ye=pe.get(ve);ye||(ye={value:ve,rows:[]},pe.set(ve,ye),ge.push(ye)),ye.rows.push(ie[Oe])}return ge}function w(he){const{n:ie,mean:ue,m2:ge}=W(he),pe=ie>1?ge/(ie-1):0;return{n:ie,mean:ue,sd:Math.sqrt(pe),variance:pe}}function v(he,ie,ue){if(!(ie>0)||!(ue>0)||!(he>=0)||!Number.isFinite(he))return Number.NaN;if(he===0)return 1;const ge=ie*he/(ie*he+ue);return 1-o(ie/2,ue/2,ge)}function A(he,ie){const ue=Math.abs(he);return Number.isFinite(ue)?ue>=ie[2]?"large":ue>=ie[1]?"medium":ue>=ie[0]?"small":"negligible":"negligible"}function _(he,ie,ue){if(he==="cohensD")return A(ie,s);if(he==="cliffsDelta")return A(ie,d);if(he==="etaSquared")return A(ie,p);const ge=Math.max(1,Math.min(u.length,Math.floor(ue||1)));return A(ie,u[ge-1])}function V(he,ie){if(!(he.n>1)||!(ie.n>1))return null;const ue=((he.n-1)*he.variance+(ie.n-1)*ie.variance)/(he.n+ie.n-2);return ue>0?(he.mean-ie.mean)/Math.sqrt(ue):null}function Y(he,ie){const ue=he.length,ge=ie.length;if(!ue||!ge)return null;const pe=Array.from(ie).sort((ye,Ae)=>ye-Ae);let Oe=0,ve=0;for(let ye=0;ye<ue;ye++){const Ae=he[ye];let Me=0,je=ge;for(;Me<je;){const Fe=Me+je>>1;pe[Fe]<Ae?Me=Fe+1:je=Fe}const _e=Me;let Pe=Me;for(;Pe<ge&&pe[Pe]===Ae;)Pe++;const Se=Pe-Me;Oe+=_e,ve+=ge-Pe}return(Oe-ve)/(ue*ge)}function $(he,ie,ue,ge){const pe=Math.min(ue-1,ge-1);return!(ie>0)||!(pe>0)?null:Math.sqrt(he/(ie*pe))}function j(he){return Number.isFinite(he)?he<.001?"p < 0.001":he>=.995?"p > 0.995":`p = ${he.toFixed(3)}`:"p = —"}function E(he){if(!Number.isFinite(he))return"0";const ie=Math.abs(he);return ie===0?"0":ie>=1e3?String(Math.round(he)):ie>=100?String(Number(he.toFixed(0))):ie>=10?String(Number(he.toFixed(1))):ie>=1?String(Number(he.toFixed(2))):String(Number(he.toPrecision(2)))}const O=new Set(["cohensD","cliffsDelta"]);function N(he){if(he.difference!=null&&Math.abs(he.difference)>=1e-12)return Math.sign(he.difference);const ie=he.effectSize;if(ie&&O.has(ie.name)&&Number.isFinite(ie.value)&&Math.abs(ie.value)>=1e-12)return Math.sign(ie.value);const[ue,ge]=he.groups;return Number.isFinite(ue.mean)&&Number.isFinite(ge.mean)&&ue.mean!==ge.mean?Math.sign(ue.mean-ge.mean):0}function T(he){const ie=he.measureName||"values";return{subject:ie.charAt(0).toUpperCase()+ie.slice(1),be:ie==="values"?"are":"is",name:ie}}function C(he,ie){const ue=ie.unit?` ${ie.unit}`:"",{subject:ge,be:pe}=T(ie),Oe=he.groups[0].label,ve=he.groups[1].label,ye=he.effectSize?he.effectSize.label:"negligible",Ae=he.pValue<he.alpha,Me=Ae?"unlikely to be chance":"consistent with chance";if(!Ae&&ye==="negligible")return`${ge} ${pe} essentially the same for ${Oe} and ${ve} (${j(he.pValue)}); the effect is ${ye}.`;const je=N(he),_e=`the difference is ${Me} (${j(he.pValue)}) and the effect is ${ye}.`;if(je===0)return`${ge} ${pe} different between ${Oe} and ${ve}; ${_e}`;const Pe=je>0?Oe:ve,Se=je>0?ve:Oe,We=he.difference!=null&&Math.abs(he.difference)>=1e-12?` by about ${E(Math.abs(he.difference))}${ue}`:"";return`${ge} ${pe} higher for ${Pe} than for ${Se}${We}; ${_e}`}function B(he,ie){const{name:ue}=T(ie),ge=he.effectSize?he.effectSize.label:"negligible",pe=j(he.pValue);return he.pValue<he.alpha?`The groups differ in ${ue}; the difference is unlikely to be chance (${pe}) and the effect is ${ge}.`:ge==="negligible"?`The groups are essentially the same in ${ue} (${pe}); the effect is ${ge}.`:`The groups show a ${ge} effect in ${ue}, but the difference is consistent with chance (${pe}).`}function z(he,ie){const ue=he.length;if(ue<2)return null;const{mean:ge,m2:pe}=W(he),Oe=pe/(ue-1);if(!(Oe>0))return null;const ve=Math.sqrt(Oe),ye=ve/Math.sqrt(ue),Ae=ge/ye,Me=ue-1,je=Math.min(1,Math.max(0,2*(1-y(Math.abs(Ae),Me)))),_e=l(1-ie/2,Me)*ye,Pe=ge/ve;return{test:c.T,statistic:Ae,statisticName:"t",df:Me,pValue:je,difference:ge,interval:{estimate:ge,lower:ge-_e,upper:ge+_e,confidence:1-ie,method:"paired-t (mean of the pair differences)"},effectSize:{name:"cohensD",label:A(Pe,s),value:Pe}}}function X(he,ie){const ue=Array.from(he).filter(We=>We!==0),ge=ue.length;if(!ge)return null;const pe=Array.from({length:ge},(We,He)=>He).sort((We,He)=>Math.abs(ue[We])-Math.abs(ue[He])),Oe=new Array(ge);let ve=0;for(;ve<ge;){let We=ve;for(;We+1<ge&&Math.abs(ue[pe[We+1]])===Math.abs(ue[pe[ve]]);)We++;const He=(ve+We)/2+1;for(let Ye=ve;Ye<=We;Ye++)Oe[pe[Ye]]=He;ve=We+1}let ye=0,Ae=0;for(let We=0;We<ge;We++)Ae+=Oe[We],ue[We]>0&&(ye+=Oe[We]);const Me=Ae-ye,je=ge*(ge+1)/4,_e=Math.sqrt(ge*(ge+1)*(2*ge+1)/24),Pe=_e>0?(Math.abs(ye-je)-.5)/_e:0,Se=Math.min(1,Math.max(0,2*g(-Math.max(0,Pe)))),Fe=Ae>0?(ye-Me)/Ae:0;return{test:c.MANN_WHITNEY,statistic:ye,statisticName:"W",df:null,pValue:Se,difference:null,interval:null,effectSize:{name:"cliffsDelta",label:A(Fe,d),value:Fe}}}function Q(he,ie,ue){const ge=w(he),pe=w(ie);if(ge.n<2||pe.n<2)return null;const Oe=((ge.n-1)*ge.variance+(pe.n-1)*pe.variance)/(ge.n+pe.n-2);if(!(Oe>0))return null;const ve=Math.sqrt(Oe*(1/ge.n+1/pe.n)),ye=(ge.mean-pe.mean)/ve,Ae=ge.n+pe.n-2,Me=Math.min(1,Math.max(0,2*(1-y(Math.abs(ye),Ae)))),je=ge.mean-pe.mean,_e=l(1-ue/2,Ae)*ve,Pe=V(ge,pe);return{test:c.T,statistic:ye,statisticName:"t",df:Ae,pValue:Me,difference:je,interval:{estimate:je,lower:je-_e,upper:je+_e,confidence:1-ue,method:"student-t (pooled variance, difference of means)"},effectSize:{name:"cohensD",label:A(Pe,s),value:Pe},summaries:[ge,pe]}}function H(he,ie,ue){const ge=w(he),pe=w(ie);if(ge.n<2||pe.n<2)return null;const Oe=ge.variance/ge.n+pe.variance/pe.n;if(!(Oe>0))return null;const ve=Math.sqrt(Oe),ye=(ge.mean-pe.mean)/ve,Ae=ge.variance/ge.n*(ge.variance/ge.n)/(ge.n-1),Me=pe.variance/pe.n*(pe.variance/pe.n)/(pe.n-1),je=Oe*Oe/(Ae+Me),_e=Math.min(1,Math.max(0,2*(1-y(Math.abs(ye),je)))),Pe=ge.mean-pe.mean,Se=l(1-ue/2,je)*ve,Fe=V(ge,pe);return{test:c.WELCH,statistic:ye,statisticName:"t",df:je,pValue:_e,difference:Pe,interval:{estimate:Pe,lower:Pe-Se,upper:Pe+Se,confidence:1-ue,method:"welch-t (unequal variances, difference of means)"},effectSize:{name:"cohensD",label:A(Fe,s),value:Fe},summaries:[ge,pe]}}function L(he,ie,ue){const ge=he.length,pe=ie.length;if(ge<1||pe<1)return null;const Oe=w(he),ve=w(ie),ye=ge+pe,Ae=new Array(ye);for(let Ye=0;Ye<ge;Ye++)Ae[Ye]={v:he[Ye],g:0};for(let Ye=0;Ye<pe;Ye++)Ae[ge+Ye]={v:ie[Ye],g:1};Ae.sort((Ye,Qe)=>Ye.v-Qe.v);let Me=0,je=0,_e=0;for(;_e<ye;){let Ye=_e;for(;Ye<ye&&Ae[Ye].v===Ae[_e].v;)Ye++;const Qe=(_e+1+Ye)/2;for(let ot=_e;ot<Ye;ot++)Ae[ot].g===0&&(Me+=Qe);const lt=Ye-_e;je+=lt*lt*lt-lt,_e=Ye}const Pe=Me-ge*(ge+1)/2,Se=ge*pe/2,Fe=ge*pe/12*(ye+1-je/(ye*(ye-1)));let We=1;if(Fe>0){const Ye=Math.max(0,Math.abs(Pe-Se)-.5);We=Math.min(1,2*g(-Ye/Math.sqrt(Fe)))}const He=Y(he,ie);return{test:c.MANN_WHITNEY,statistic:Pe,statisticName:"U",df:null,pValue:We,difference:null,interval:Z(he,ie,1-ue),effectSize:{name:"cliffsDelta",label:A(He,d),value:He},summaries:[Oe,ve]}}function Z(he,ie,ue){const ge=he.length,pe=ie.length,Oe=ge*pe;if(Oe===0||Oe>2e6)return null;const ve=new Float64Array(Oe);let ye=0;for(let Fe=0;Fe<ge;Fe++)for(let We=0;We<pe;We++)ve[ye++]=he[Fe]-ie[We];ve.sort();const Ae=Oe>>1,Me=Oe%2?ve[Ae]:(ve[Ae-1]+ve[Ae])/2,je=Math.sqrt(ge*pe*(ge+pe+1)/12),_e=i(1-(1-ue)/2);let Pe=Math.round(Oe/2-_e*je);Pe>=0||(Pe=0);const Se=Math.floor((Oe-1)/2);return Pe>Se&&(Pe=Se),{estimate:Me,lower:ve[Pe],upper:ve[Oe-1-Pe],confidence:ue,method:"hodges-lehmann (location shift)"}}function ee(he,ie){const ue=he.length,ge=he.map(w);if(ge.some(We=>We.n<2))return null;const pe=ge.reduce((We,He)=>We+He.n,0),Oe=ge.reduce((We,He)=>We+He.mean*He.n,0)/pe;let ve=0,ye=0;for(let We=0;We<ue;We++)ve+=ge[We].n*(ge[We].mean-Oe)**2,ye+=(ge[We].n-1)*ge[We].variance;const Ae=ue-1,Me=pe-ue;if(!(ye>0)||Me<1)return null;const je=ve/Ae,_e=ye/Me,Pe=je/_e,Se=Math.min(1,Math.max(0,v(Pe,Ae,Me))),Fe=ve/(ve+ye);return{test:c.ANOVA,statistic:Pe,statisticName:"F",df:{between:Ae,within:Me},pValue:Se,difference:null,interval:null,effectSize:{name:"etaSquared",label:A(Fe,p),value:Fe},summaries:ge}}function te(he,ie){const ue=he.length,ge=he.map(w);if(ue<2)return null;const pe=ge.reduce((He,Ye)=>He+Ye.n,0),Oe=[];for(let He=0;He<ue;He++)for(let Ye=0;Ye<he[He].length;Ye++)Oe.push({v:he[He][Ye],g:He});Oe.sort((He,Ye)=>He.v-Ye.v);const ve=new Array(Oe.length);let ye=0,Ae=0;for(;Ae<Oe.length;){let He=Ae;for(;He<Oe.length&&Oe[He].v===Oe[Ae].v;)He++;const Ye=(Ae+1+He)/2;for(let lt=Ae;lt<He;lt++)ve[lt]=Ye;const Qe=He-Ae;ye+=Qe*Qe*Qe-Qe,Ae=He}const Me=new Array(ue).fill(0);for(let He=0;He<Oe.length;He++)Me[Oe[He].g]+=ve[He];let je=0;for(let He=0;He<ue;He++)je+=Me[He]*Me[He]/ge[He].n;je=12/(pe*(pe+1))*je-3*(pe+1);const _e=1-ye/(pe*pe*pe-pe),Pe=_e>0?je/_e:je,Se=ue-1,Fe=Math.min(1,Math.max(0,t(Pe,Se))),We=(Pe-ue+1)/(pe-ue);return{test:c.KRUSKAL,statistic:Pe,statisticName:"H",df:Se,pValue:Fe,difference:null,interval:null,effectSize:{name:"etaSquared",label:A(We,p),value:Math.max(0,We)},summaries:ge}}function se(he,ie,ue,ge,pe){const Oe=S(he,ie,pe),ve=S(ue,ge,pe);if(!Oe||!ve)return null;const ye=Oe.proportion-ve.proportion,Ae=ye-Math.sqrt((Oe.proportion-Oe.lower)**2+(ve.upper-ve.proportion)**2),Me=ye+Math.sqrt((Oe.upper-Oe.proportion)**2+(ve.proportion-ve.lower)**2);return{estimate:ye,lower:Ae,upper:Me}}function ne(he,ie,ue,ge){const pe=F(ie),Oe=new Set,ve=[];for(const Ye of he){const Qe=new Map;let lt=0;for(const ot of Ye.rows){const yt=a(pe(ot));yt!==null&&(Qe.set(yt,(Qe.get(yt)||0)+1),lt++,Oe.add(yt))}ve.push(Qe),Ye.total=lt}const ye=[...Oe];if(ye.length<2)return null;const Ae=he.reduce((Ye,Qe)=>Ye+Qe.total,0);if(!(Ae>0))return null;let Me=0;for(const Ye of he)for(const Qe of ye){const lt=ve[he.indexOf(Ye)].get(Qe)||0,ot=he.reduce((Ct,Nt)=>Ct+(ve[he.indexOf(Nt)].get(Qe)||0),0),yt=Ye.total*ot/Ae;yt>0&&(Me+=(lt-yt)*(lt-yt)/yt)}const je=he.length,_e=ye.length,Pe=(je-1)*(_e-1),Se=Math.min(1,Math.max(0,t(Me,Pe))),Fe=$(Me,Ae,je,_e);let We=null;if(je===2&&_e===2){const[Ye]=ye,Qe=ve[0].get(Ye)||0,lt=ve[1].get(Ye)||0,ot=se(Qe,he[0].total,lt,he[1].total,ge);ot&&(We={...ot,confidence:ge,method:"newcombe (difference in this category's share)",category:Ye})}const He=he.map((Ye,Qe)=>{const lt={};for(const ot of ye)lt[String(ot)]=(ve[Qe].get(ot)||0)/Ye.total;return lt});return{test:c.CHI_SQUARE,statistic:Me,statisticName:"chiSquare",df:Pe,pValue:Se,difference:null,interval:We,effectSize:{name:"cramersV",label:_("cramersV",Fe,Math.min(je-1,_e-1)),value:Fe},proportions:He}}function ae(he,ie,ue,ge){const pe=F(ie),Oe=new Set;for(const ot of he)for(const yt of ot.rows){const Ct=a(pe(yt));Ct!==null&&Oe.add(Ct)}if(Oe.size!==2)return null;const[ve]=[...Oe],ye=he[0].rows.reduce((ot,yt)=>ot+(a(pe(yt))===ve?1:0),0),Ae=he[1].rows.reduce((ot,yt)=>ot+(a(pe(yt))===ve?1:0),0),Me=he[0].rows.length,je=he[1].rows.length;if(!(Me>0)||!(je>0))return null;const _e=ye/Me,Pe=Ae/je,Se=(ye+Ae)/(Me+je);if(!(Se>0)||!(Se<1))return null;const Fe=Math.sqrt(Se*(1-Se)*(1/Me+1/je)),We=(_e-Pe)/Fe,He=Math.min(1,Math.max(0,2*g(-Math.abs(We)))),Ye=_e-Pe,Qe=se(ye,Me,Ae,je,ge),lt=$(We*We,Me+je,2,2);return{test:c.PROPORTIONS,statistic:We,statisticName:"z",df:null,pValue:He,difference:Ye,interval:Qe?{...Qe,confidence:ge,method:"newcombe (difference in proportions)",category:ve}:null,effectSize:{name:"cramersV",label:_("cramersV",lt,1),value:lt},proportions:[{[String(ve)]:_e},{[String(ve)]:Pe}],focalCategory:ve}}function de(he,ie,ue,ge){if(ue&&f.has(ue))return{test:ue,reason:`caller override: ${ue}`};const pe=R(he),Oe=R(ie),ve=pe===null?null:Math.exp(-pe/2),ye=Oe===null?null:Math.exp(-Oe/2);if(ve!==null&&ve<r||ye!==null&&ye<r)return{test:c.MANN_WHITNEY,reason:"two numeric groups, non-normal by Jarque-Bera"};const Ae=w(he),Me=w(ie);if(Ae.n>=3&&Me.n>=3&&Ae.variance>0&&Me.variance>0){const je=Math.max(Ae.variance,Me.variance)/Math.min(Ae.variance,Me.variance),_e=Ae.variance>=Me.variance?Ae.n-1:Me.n-1,Pe=Ae.variance>=Me.variance?Me.n-1:Ae.n-1;if(2*Math.min(v(je,_e,Pe),1-v(je,_e,Pe))<ge)return{test:c.WELCH,reason:"two numeric groups, unequal variances (F-test)"}}return{test:c.T,reason:ve!==null||ye!==null?"two numeric groups, equal variances and no departure from normality":"two numeric groups (too few rows to screen normality)"}}function le(he,ie){if(ie&&n.has(ie))return{test:ie,reason:`caller override: ${ie}`};for(const ue of he){const ge=R(ue),pe=ge===null?null:Math.exp(-ge/2);if(pe!==null&&pe<r)return{test:c.KRUSKAL,reason:"three or more numeric groups, non-normal by Jarque-Bera"}}return{test:c.ANOVA,reason:"three or more numeric groups, no departure from normality detected"}}function be(he,ie,ue,ge={},pe=null){if(!he||!ie)return null;const Oe=b(ge.alpha),ve=1-Oe,ye=ge.test&&ge.test!=="auto"?String(ge.test):null,Ae=h(ie,ue);if(Ae.length<2)return M("compare:groups",'[lattice] statistics.compare: the "by" column has fewer than two distinct values to group by.'),null;let Me;if(Array.isArray(ge.groups)&&ge.groups.length===2){const Qe=[a(ge.groups[0]),a(ge.groups[1])];if(Qe[0]===null||Qe[1]===null||Qe[0]===Qe[1])return M("compare:distinct","[lattice] statistics.compare: the two groups must be two distinct, present values."),null;if(Me=Ae.filter(lt=>lt.value===Qe[0]||lt.value===Qe[1]),Me.length!==2)return M("compare:empty","[lattice] statistics.compare: one of the two groups has no rows in the current set."),null;Me.sort((lt,ot)=>lt.value===Qe[0]?-1:1)}else Ae.length===2||ye&&f.has(ye)||ye&&m.has(ye)?Me=Ae.slice(0,2):(ye&&n.has(ye),Me=Ae);const _e=K(he,ue),Pe=!!ge.paired&&pe&&Me.length===2&&_e;let Se,Fe,We;if(_e)if(Me.length===2&&!(ye&&n.has(ye))){const Qe=q(he,Me[0].rows),lt=q(he,Me[1].rows);if(Qe.length<3||lt.length<3)return M("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;if(w(Qe).variance===0||w(lt).variance===0)return M("compare:zero-variance","[lattice] statistics.compare: a group has zero variance, so the difference has no scale to test."),null;if(Pe){const yt=Ne(he,pe,Me[0].rows,Me[1].rows);return yt?(Fe=ye?"override":"auto",We=ye?`caller override: ${ye} (paired)`:"two numeric groups, paired",Se=ye===c.MANN_WHITNEY?X(yt.diffs,Oe):z(yt.diffs,Oe),Se?(Se.paired=!0,Se.chosenBy=Fe,Se.reason=We,Se.groups=[{value:Me[0].value,label:String(Me[0].value),n:yt.n},{value:Me[1].value,label:String(Me[1].value),n:yt.n}],Se.alpha=Oe,Se.method=Se.test===c.MANN_WHITNEY?"Wilcoxon signed-rank test (paired)":"Student's paired t-test (difference of pairs)",Se.verdict=C(Se,ge),Se.categorical=!1,Se):(M("compare:degenerate","[lattice] statistics.compare: the paired test had too little to work with."),null)):(M("compare:paired","[lattice] statistics.compare: not enough matched pairs to run a paired test."),null)}const ot=de(Qe,lt,ye,Oe);Fe=ye?"override":"auto",We=ot.reason,ot.test===c.MANN_WHITNEY?Se=L(Qe,lt,Oe):ot.test===c.WELCH?Se=H(Qe,lt,Oe):Se=Q(Qe,lt,Oe),Se&&Se.interval&&Se.difference===null&&(Se.difference=Se.interval.estimate)}else{const Qe=Me.map(ot=>q(he,ot.rows));if(Qe.some(ot=>ot.length<3))return M("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;const lt=le(Qe,ye);Fe=ye?"override":"auto",We=lt.reason,Se=lt.test===c.KRUSKAL?te(Qe,Oe):ee(Qe,Oe)}else if(Me.length===2){const Qe=Ce(he,Me).size===2;if(ye===c.PROPORTIONS||Qe&&!ye)Fe=ye?"override":"auto",We=ye?"caller override: proportions":"categorical measure with two categories (binary)",Se=ae(Me,he,Oe,ve);else if(ye===c.CHI_SQUARE||!Qe&&!ye)Fe=ye?"override":"auto",We=ye?"caller override: chiSquare":`categorical measure with ${Ce(he,Me).size} categories`,Se=ne(Me,he,Oe,ve);else return M("compare:numeric-needed",`[lattice] statistics.compare: ${ye} needs a numeric measure, but the column is categorical.`),null}else Fe=ye?"override":"auto",We=ye?`caller override: ${ye}`:`categorical measure with ${Ce(he,Me).size} categories`,Se=ne(Me,he,Oe,ve);if(!Se)return M("compare:degenerate","[lattice] statistics.compare: the chosen test had too little to work with (too few values, or no variation)."),null;const He=Se.summaries,Ye=Se.proportions;return{test:Se.test,chosenBy:Fe,reason:We,statistic:Se.statistic,statisticName:Se.statisticName,df:Se.df===void 0?null:Se.df,pValue:Se.pValue,alpha:Oe,paired:!1,interval:Se.interval||null,effectSize:Se.effectSize,groups:Me.map((Qe,lt)=>({value:Qe.value,label:String(Qe.value),n:He?He[lt].n:Qe.total,...He?{mean:He[lt].mean,sd:He[lt].sd}:{},...Ye?{proportions:Ye[lt]}:{}})),difference:Se.difference===void 0?null:Se.difference,method:Se.test,categorical:!_e,verdict:Me.length===2?C({...Se,alpha:Oe,groups:[{value:Me[0].value,label:String(Me[0].value),mean:He?He[0].mean:void 0},{value:Me[1].value,label:String(Me[1].value),mean:He?He[1].mean:void 0}],categorical:!_e,difference:Se.difference===void 0?null:Se.difference},ge):B({...Se,alpha:Oe},ge)}}function Ce(he,ie){const ue=F(he),ge=new Set;for(const pe of ie)for(const Oe of pe.rows){const ve=a(ue(Oe));ve!==null&&ge.add(ve)}return ge}function Ne(he,ie,ue,ge){const pe=F(ie),Oe=F(he),ve=new Map;for(const Ae of ge){const Me=a(pe(Ae));Me!==null&&ve.set(Me,Oe(Ae))}const ye=[];for(const Ae of ue){const Me=a(pe(Ae));if(Me===null||!ve.has(Me))continue;const je=Number(Oe(Ae)),_e=Number(ve.get(Me));!Number.isFinite(je)||!Number.isFinite(_e)||ye.push(je-_e)}return ye.length<2?null:{diffs:Float64Array.from(ye),n:ye.length}}}),Be("packages/core/src/columns/detailcolumn.js",function(e,D){"use strict";Object.defineProperty(e,"DETAIL_COLUMN_ID",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"createDetailColumn",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return F}});const re="__lattice_detail",M=36;function G(x){const q=x.config&&x.config.detailColumnWidth||M;return{id:re,field:null,title:"",type:"text",dataType:{base:"text"},nullable:!0,align:"center",generated:!0,control:!0,detailExpander:!0,value:{pure:!0},cell:{render:"detailExpander",align:"center"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:q,min:q,max:q,pin:x.config&&x.config.detailColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(W,I){return!!(I&&I.expanded)},formatValue(){return""}}}const F=G}),Be("packages/core/src/columns/treecolumn.js",function(e,D){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createTreeColumn",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return q}});const M=D("packages/core/src/internal/predicates.js").isFunction,G="__lattice_tree",F=260;function x(W){const I=W.tree||{},K=W.config&&W.config.treeColumnWidth||F,R=!!(W.config&&W.config.treeColumnFlex),S=()=>(W.columns&&M(W.columns.visible)?W.columns.visible():[]).find(g=>!g.generated)||null,k=(l,g)=>{if(g&&g.group)return g.groupValue;if(M(I.label))return I.label(l,g);if(typeof I.label=="string")return l==null?null:l[I.label];const i=S();return i&&M(i.getValue)?i.getValue(l,g):null},y=()=>{if(I.title)return I.title;const l=typeof I.label=="string"?W.columns&&M(W.columns.get)?W.columns.get(I.label):null:S();return l&&(l.title||l.id)||"Hierarchy"};return{id:G,get title(){return y()},field:null,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group",props:{icon:I.icon,iconClass:I.iconClass,content:I.content,checkbox:I.checkbox,onCheck:I.onCheck}},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:R?{flex:1,min:0,pin:W.config&&W.config.treeColumnPin||null,hidden:!1,resizable:!1,movable:!1,lockPosition:!0}:{width:K,min:140,pin:W.config&&W.config.treeColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(l,g){return k(l,g)},formatValue(l,g){if(g&&g.grandTotal)return W.config&&W.config.grandTotalLabel||"Total";if(l==null)return"";if(!I.label){const i=S();if(i&&M(i.formatValue))return i.formatValue(l,g)}return String(l)}}}const q=x}),Be("packages/core/src/columns/pivotcolumns.js",function(e,D){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return x}});const M=D("packages/core/src/internal/warn.js").warnOnce,G="__lattice_pivot",F=500;function x(K){const{pivot:R,valueColumns:S,config:k}=K,y=R&&R.paths||[],l=K.separator||k&&k.pivot&&k.pivot.separator||" | ",g=k&&k.pivot&&k.pivot.maxColumns||F;if(!y.length||!S.length)return{tree:[],leaves:[],error:null};const i=q(k),t=y.length*S.length+(i?S.length:0);if(t>g){const f=`pivot would generate ${t} columns, above the limit of ${g}. Pivot on a lower-cardinality column, or raise pivot.maxColumns.`;return M(`pivot.maxColumns:${t}`,f),{tree:[],leaves:[],error:f}}const o=[],c=[];for(const f of y){const n=[];for(const m of S){const r=I(f,m,l);n.push(r),c.push(r)}n.length===1?(n[0].title=String(f),o.push(n[0])):o.push({id:`${G}:group:${f}`,title:String(f),columns:n,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(i){const f=S.map(m=>W(m,k));c.push(...f);const n=k&&k.pivot&&k.pivot.totalsLabel||"Total";if(f.length===1)f[0].title=n,i==="before"?o.unshift(f[0]):o.push(f[0]);else{const m={id:`${G}:group:__totals`,title:n,columns:f,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};i==="before"?o.unshift(m):o.push(m)}}return{tree:o,leaves:c,error:null}}function q(K){const R=K&&K.pivot&&K.pivot.groupTotals;return R==="before"||R==="after"?R:null}function W(K,R){return{id:`${G}:__total${R&&R.pivot&&R.pivot.separator||" | "}${K.id}`,field:null,title:K.title||K.id,type:K.type,dataType:K.dataType,nullable:!0,align:K.align,generated:!0,pivot:{enabled:!1,index:0,sourceId:K.id,total:!0},value:{pure:!0},cell:{align:K.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:K.total,lookup:null,layout:{width:K.layout&&K.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(S,k){const y=k&&k.totals;return y&&Object.hasOwn(y,K.id)?y[K.id]:null},formatValue(S,k){return S==null?"":K.formatValue?K.formatValue(S,k):String(S)}}}function I(K,R,S){return{id:`${G}:${K}${S}${R.id}`,field:null,title:R.title||R.id,type:R.type,dataType:R.dataType,nullable:!0,align:R.align,generated:!0,pivot:{enabled:!1,index:0,path:K,sourceId:R.id},value:{pure:!0},cell:{align:R.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:R.total,lookup:null,layout:{width:R.layout&&R.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(){return null},formatValue(k,y){return k==null?"":R.formatValue?R.formatValue(k,y):String(k)}}}}),Be("packages/core/src/compute/group.js",function(e,D){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return k}});const re=D("packages/core/src/compute/handle.js"),M=re.dictSize,G=re.identity,F=re.presenceReader,x=re.rowCount,q=re.valueReader,W="",I="\0",K=1<<20;function R(y,l,g,i){const t=y.length,o=y.map(s=>q(s)),c=Array.isArray(i)&&i.some(Boolean),f=c?o.map((s,d)=>i[d]?p=>i[d](s(p)):s):o;if(!c&&t>0&&y.every(s=>s&&s.kind==="dictionary"&&s.dict)){const s=y.map(p=>M(p.dict)+1);let d=1;for(let p=0;p<t;p++)d*=s[p];if(d<=Number.MAX_SAFE_INTEGER){const p=y.map(h=>h.values),u=y.map(h=>F(h)),b=h=>{let w=0;for(let v=0;v<t;v++){const A=u[v],_=A&&A(h)===0?s[v]-1:p[v][h];w=w*s[v]+_}return w},a=new Float64Array(g);for(let h=0;h<g;h++)a[h]=b(l[h]);return{packed:a,strings:null,product:d,readers:f,keyOf:b}}}const m=s=>{let d="";for(let p=0;p<t;p++){const u=f[p](s);d+=(p===0?"":W)+(u==null?I:String(u))}return d},r=new Array(g);for(let s=0;s<g;s++)r[s]=m(l[s]);return{packed:null,strings:r,product:1/0,readers:f,keyOf:m}}function S(y,l,g,i){const t=new Uint32Array(i+1);for(let n=0;n<g;n++)t[l[n]+1]++;for(let n=0;n<i;n++)t[n+1]+=t[n];const o=new Uint32Array(g),c=t.slice(0,i);for(let n=0;n<g;n++)o[c[l[n]]++]=y[n];const f=new Array(i);for(let n=0;n<i;n++)f[n]=o.subarray(t[n],t[n+1]);return f}function k(y,l,g={}){const i=y||[],t=l||G(x(i[0],g)),o=t.length;if(i.length===0||o===0)return{keys:[],buckets:[]};const{packed:c,strings:f,product:n,readers:m}=R(i,t,o,g.project),r=new Uint32Array(o);let s=0,d=null;if(c&&n<=Math.max(1024,Math.min(K,o*4))){const a=n,h=new Int32Array(a).fill(-1);for(let w=0;w<o;w++)h[c[w]]=0;for(let w=0;w<a;w++)h[w]===0&&(h[w]=s++);for(let w=0;w<o;w++)r[w]=h[c[w]];d=new Float64Array(s);for(let w=0;w<a;w++)h[w]>=0&&(d[h[w]]=w)}else if(c){const a=new Map;for(let h=0;h<o;h++){const w=c[h];let v=a.get(w);v===void 0&&(v=s++,a.set(w,v)),r[h]=v}d=new Float64Array(s);for(const[h,w]of a)d[w]=h}else{const a=new Map;for(let h=0;h<o;h++){const w=f[h];let v=a.get(w);v===void 0&&(v=s++,a.set(w,v)),r[h]=v}}const p=S(t,r,o,s),u=new Array(s);for(let a=0;a<s;a++){const h=p[a][0],w=new Array(m.length);for(let v=0;v<m.length;v++)w[v]=m[v](h);u[a]=w}const b={keys:u,buckets:p};return d&&(b.packed=d),b}}),Be("packages/core/src/compute/pivot.js",function(e,D){"use strict";Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return o}});const M=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/compute/handle.js").valueComparator,q=D("packages/core/src/compute/group.js").packKeys,I=D("packages/core/src/compute/total.js").total,K="|",R="/",S=2e3;function k(n,m,r){return`${n}${K}${m}${K}${r}`}function y(n,m){let r="";for(let s=0;s<n.length;s++){const d=n[s];r+=(s===0?"":m)+(d==null?"":String(d))}return r}function l(n,m,r={}){const s=r.separator||R,d=m.length,{keyOf:p,readers:u}=q(n,m,0),b=new Map,a=[],h=[];for(let $=0;$<d;$++){const j=m[$],E=p(j);if(b.has(E))continue;b.set(E,a.length),h.push(E);const O=new Array(u.length);for(let N=0;N<u.length;N++)O[N]=u[N](j);a.push(O)}const w=F(r.locale),v=a.map(($,j)=>j);v.sort(($,j)=>{const E=a[$],O=a[j];for(let N=0;N<E.length;N++){const T=g(E[N],O[N],w);if(T!==0)return T}return $-j});const A=new Array(v.length),_=new Array(v.length),V=new Map;for(let $=0;$<v.length;$++){const j=v[$];A[$]=a[j],_[$]=y(a[j],s),V.set(h[j],$)}return{keys:A,paths:_,idOf:$=>{const j=V.get(p($));return j===void 0?-1:j}}}function g(n,m,r){const s=n==null,d=m==null;return s||d?s&&d?0:s?1:-1:r(n,m)}function i(n){const m=n.values||n.totals||[];if(m.length&&typeof m[0]=="object"&&m[0]!==null)return m.filter(p=>p&&p.handle);const r=typeof n.handle=="function"?n.handle:null;if(!r)return m.length&&M("pivot:handles","pivot was given total column ids but no handle(colId) resolver, so no cell values were reduced. Pass values: [{ colId, handle, fn }] or opts.handle."),[];const s=typeof n.totalOf=="function"?n.totalOf:null,d=[];for(const p of m){const u=r(p);u&&d.push({colId:p,handle:u,fn:s?s(p):"sum"})}return d}function t(n,m,r){if(Array.isArray(n)){const s=r||{};return{...s,pivotHandles:n,order:m||null,groups:s.groups||null}}return n||{}}function o(n,m,r){const s=t(n,m,r),d=s.separator||R,p=i(s),u=s.maxColumns===void 0?S:s.maxColumns,b=s.groups&&s.groups.buckets?s.groups:null,a=b?b.buckets:[s.order||new Uint32Array(0)],h=s.groupPaths||(b?b.keys.map(E=>y(E,d)):[""]),w=f(a),{keys:v,paths:A,idOf:_}=l(s.pivotHandles||[],w,s),V=A.length*Math.max(1,p.length),Y=c(A,p,d);if(u&&V>u){const E=new Map;return{keys:v,paths:A,fields:Y,groupPaths:h,columns:V,values:E,cells:E,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${V} columns, above pivot.maxColumns of ${u}. Narrow the pivot columns or raise the limit.`,columns:V,maxColumns:u}}}const $=new Map,j=A.length;for(let E=0;E<a.length;E++){const O=a[E],N=h[E]===void 0?"":h[E],T=O.length;if(T===0)continue;const C=new Int32Array(T),B=new Uint32Array(j+1);for(let Q=0;Q<T;Q++){const H=_(O[Q]);C[Q]=H,H>=0&&B[H+1]++}for(let Q=0;Q<j;Q++)B[Q+1]+=B[Q];const z=new Uint32Array(T),X=B.slice(0,j);for(let Q=0;Q<T;Q++){const H=C[Q];H>=0&&(z[X[H]++]=O[Q])}for(let Q=0;Q<j;Q++){const H=B[Q],L=B[Q+1];if(L===H)continue;const Z=z.subarray(H,L);for(let ee=0;ee<p.length;ee++){const te=p[ee],se=I(te.handle,Z,te.fn,s.totalContext||{locale:s.locale});$.set(k(N,A[Q],te.colId),se)}}}return{keys:v,paths:A,fields:Y,groupPaths:h,columns:V,values:$,cells:$,error:null}}function c(n,m,r){if(m.length===0)return n.slice();const s=[];for(const d of n)for(const p of m)s.push(`${d}${r}${p.colId}`);return s}function f(n){if(n.length===1)return n[0]||new Uint32Array(0);let m=0;for(const d of n)m+=d?d.length:0;const r=new Uint32Array(m);let s=0;for(const d of n)!d||d.length===0||(r.set(d,s),s+=d.length);return r}}),Be("packages/core/src/compute/explain.js",function(e,D){"use strict";Object.defineProperty(e,"explainContributors",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"explainChange",{enumerable:!0,get:function(){return k}});const M=D("packages/core/src/compute/total.js").total,F=D("packages/core/src/compute/group.js").groupByColumns,x=new Set(["sum","count","countValues"]),q=new Set(["min","max"]),W=new Set(["avg"]);function I(y){return typeof y=="string"?y:typeof y=="function"&&y.totalName?y.totalName:null}function K(y,l,g,i){return M(y,l,g,i||{})}function R(y,l){if(l)try{return l(y)}catch{}return y==null?"":String(y)}function S(y){const{handle:l,fn:g,leaves:i,by:t,labelOf:o,rowLabel:c}=y,f={locale:y.locale},n=i&&i.length?i:[],m=I(g),r=K(l,n,g,f),s=q.has(m);let d;if(s){let b=-1;for(let a=0;a<n.length;a++){const h=K(l,[n[a]],g,f);if(Object.is(h,r)){b=n[a];break}}d=b<0?[]:[{key:b,indices:[b],label:c?c(b):String(b)}]}else if(t){const b=F([t],n);d=b.keys.map((a,h)=>({key:a[0],indices:b.buckets[h],label:R(a[0],o)}))}else d=Array.from({length:n.length},(b,a)=>{const h=n[a];return{key:h,indices:[h],label:c?c(h):String(h)}});const p=n.length,u=[];for(const b of d){const a=K(l,b.indices,g,f),h=b.indices.length;let w,v;if(m==="avg")w=((typeof a=="number"?a:0)-(typeof r=="number"?r:0))*h,v=p?h/p:0;else if(s)w=typeof a=="number"?a:0,v=1;else{w=typeof a=="number"?a:0;const A=typeof r=="number"?r:0;v=A?w/A:0}u.push({key:b.key,label:b.label,count:h,value:a,contribution:w,share:v})}return u.sort((b,a)=>Math.abs(a.contribution)-Math.abs(b.contribution)||(b.label<a.label?-1:b.label>a.label?1:0)),{total:r,fn:m,weighted:W.has(m),single:s,contributors:u}}function k(y){const l=S({...y,leaves:y.after}),g=S({...y,leaves:y.before}),i=typeof l.total=="number"?l.total:0,t=typeof g.total=="number"?g.total:0,o=new Map;for(const n of l.contributors)o.set(n.key,n);const c=[],f=new Set;for(const n of g.contributors){f.add(n.key);const m=o.get(n.key);if(m===void 0)c.push({key:n.key,label:n.label,before:n.value,after:null,effect:-n.contribution,kind:"dropped",count:n.count});else{const r=m.contribution-n.contribution;r!==0&&c.push({key:n.key,label:n.label,before:n.value,after:m.value,effect:r,kind:"changed",count:m.count})}}for(const n of l.contributors)f.has(n.key)||c.push({key:n.key,label:n.label,before:null,after:n.value,effect:n.contribution,kind:"new",count:n.count});return c.sort((n,m)=>Math.abs(m.effect)-Math.abs(n.effect)||(n.label<m.label?-1:n.label>m.label?1:0)),{before:g.total,after:l.total,delta:i-t,weighted:l.weighted||g.weighted,single:l.single||g.single,drivers:c}}}),Be("packages/core/src/store/bitset.js",function(e,D){"use strict";Object.defineProperty(e,"Bitset",{enumerable:!0,get:function(){return M}});const re=8;class M{static#e=new Uint8Array(256);static{for(let F=1;F<256;F++)M.#e[F]=M.#e[F>>1]+(F&1)}#t;#n;constructor(F=0){const x=Math.max(0,F|0);this.#n=x,this.#t=new Uint8Array(Math.ceil(x/re))}get size(){return this.#n}get words(){return this.#t}get bytes(){return this.#t?this.#t.byteLength:0}get(F){return F<0||F>=this.#n?0:this.#t[F>>3]>>(F&7)&1}set(F){return F>=0&&F<this.#n&&(this.#t[F>>3]|=1<<(F&7)),this}clear(F){return F>=0&&F<this.#n&&(this.#t[F>>3]&=~(1<<(F&7))),this}assign(F,x){return x?this.set(F):this.clear(F)}fill(F=!1){return this.#t.fill(F?255:0),F&&this.#r(),this}grow(F){const x=Math.max(0,F|0);if(x<=this.#n)return this;const q=Math.ceil(x/re);if(q>this.#t.length){const W=new Uint8Array(q);W.set(this.#t),this.#t=W}return this.#n=x,this}count(){const F=this.#t,x=M.#e;let q=0;for(let W=0;W<F.length;W++)q+=x[F[W]];return q}and(F){const x=F instanceof M?F.words:F,q=this.#t,W=Math.min(q.length,x.length);for(let I=0;I<W;I++)q[I]&=x[I];for(let I=W;I<q.length;I++)q[I]=0;return this}or(F){const x=F instanceof M?F.words:F,q=this.#t,W=Math.min(q.length,x.length);for(let I=0;I<W;I++)q[I]|=x[I];return this}not(){const F=this.#t;for(let x=0;x<F.length;x++)F[x]=~F[x]&255;return this.#r(),this}clone(){const F=new M(this.#n);return F.words.set(this.#t.subarray(0,F.words.length)),F}release(){this.#t=new Uint8Array(0),this.#n=0}#r(){const F=this.#n&7;if(F===0)return;const x=this.#n>>3;x<this.#t.length&&(this.#t[x]&=(1<<F)-1)}static from(F){const x=Array.isArray(F)?F:Array.from(F),q=new M(x.length);for(let W=0;W<x.length;W++)x[W]&&q.set(W);return q}}}),Be("packages/core/src/store/dictionary.js",function(e,D){"use strict";Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return F}});const re=D("packages/core/src/internal/compare.js"),M=re.collator,G=re.defaultCompare;class F{#e;#t=new Map;#n=0;#r=null;#i=-1;#s="\0";constructor(q=[]){this.#e=[];for(let W=0;W<q.length;W++){const I=q[W];this.#t.has(I)||(this.#t.set(I,this.#e.length),this.#e.push(I))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let q=this.#e.length*8;for(let W=0;W<this.#e.length;W++){const I=this.#e[W];typeof I=="string"&&(q+=I.length*2),q+=16}return q}codeOf(q){const W=this.#t.get(q);if(W!==void 0)return W;const I=this.#e.length;return this.#e.push(q),this.#t.set(q,I),this.#n++,I}lookup(q){const W=this.#t.get(q);return W===void 0?-1:W}has(q){return this.#t.has(q)}valueOf(q){return this.#e[q]}values(){return this.#e}ranks(q){const W=q||"";if(this.#r&&this.#i===this.#n&&this.#s===W)return this.#r;const I=this.#e.length,K=new Array(I);for(let y=0;y<I;y++)K[y]=y;const R=M(q).compare,S=this.#e;K.sort((y,l)=>this.#o(S[y],S[l],R));const k=new Uint32Array(I);for(let y=0;y<I;y++)k[K[y]]=y;return this.#r=k,this.#i=this.#n,this.#s=W,k}#o(q,W,I){return typeof q=="string"&&typeof W=="string"?I(q,W):G(q,W)}}}),Be("packages/core/src/store/multivalue.js",function(e,D){"use strict";Object.defineProperty(e,"MultiValue",{enumerable:!0,get:function(){return re}});class re{#e;#t;#n=0;#r=0;constructor(G={}){const F=Math.max(1,G.rows??16),x=Math.max(1,G.values??F);this.#e=new Int32Array(x),this.#t=new Uint32Array(F+1)}get values(){return this.#e}get offsets(){return this.#t}get rows(){return this.#n}get length(){return this.#r}get bytes(){return this.#e.byteLength+this.#t.byteLength}count(G){return G<0||G>=this.#n?0:this.#t[G+1]-this.#t[G]}at(G){return G<0||G>=this.#n?this.#e.subarray(0,0):this.#e.subarray(this.#t[G],this.#t[G+1])}has(G,F){if(G<0||G>=this.#n)return!1;const x=this.#e,q=this.#t[G+1];for(let W=this.#t[G];W<q;W++)if(x[W]===F)return!0;return!1}hasAny(G,F){for(let x=0;x<F.length;x++)if(this.has(G,F[x]))return!0;return!1}hasAll(G,F){for(let x=0;x<F.length;x++)if(!this.has(G,F[x]))return!1;return!0}hasNone(G,F){return!this.hasAny(G,F)}push(G){const F=this.#n,x=G.length;this.#i(F+1),this.#s(this.#r+x);const q=this.#r;for(let W=0;W<x;W++)this.#e[q+W]=G[W]|0;return this.#r+=x,this.#n=F+1,this.#t[F]=q,this.#t[F+1]=this.#r,F}write(G,F){if(G===this.#n){this.push(F);return}if(G<0||G>this.#n)return;const x=this.#t[G],q=this.#t[G+1],W=F.length;if(q-x===W){for(let I=0;I<W;I++)this.#e[x+I]=F[I]|0;return}this.#o(G,F)}compact(G,F,x){const q=this.#e,W=this.#t,I=this.#n,K=new Int32Array(Math.max(1,this.#r)),R=new Uint32Array(F+1);let S=0;for(let k=0;k<I;k++){if(G[k]===x)continue;const y=W[k],l=W[k+1];R[G[k]]=S;for(let g=y;g<l;g++)K[S++]=q[g];R[G[k]+1]=S}this.#e=K,this.#t=R,this.#n=F,this.#r=S}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#i(G){if(G+1<=this.#t.length)return;let F=this.#t.length-1;for(;F<G;)F=F*2||16;const x=new Uint32Array(F+1);x.set(this.#t),this.#t=x}#s(G){if(G<=this.#e.length)return;let F=this.#e.length;for(;F<G;)F=F*2||16;const x=new Int32Array(F);x.set(this.#e),this.#e=x}#o(G,F){const x=this.#e,q=this.#t,W=this.#n,I=F.length-(q[G+1]-q[G]),K=new Int32Array(Math.max(1,this.#r+I)),R=new Uint32Array(q.length);let S=0;for(let k=0;k<W;k++){if(R[k]=S,k===G)for(let y=0;y<F.length;y++)K[S++]=F[y]|0;else for(let y=q[k];y<q[k+1];y++)K[S++]=x[y];R[k+1]=S}this.#e=K,this.#t=R,this.#r=S}}}),Be("packages/core/src/compute/sort.js",function(e,D){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return j}});const re=D("packages/core/src/compute/handle.js"),M=re.bitReader,G=re.dictRanks,F=re.dictSize,x=re.identity,q=re.isMissing,W=re.presenceReader,I=re.rowCount,K=re.valueComparator,R=re.valueReader,S=new Uint32Array(0),k=new ArrayBuffer(8),y=new Float64Array(k),l=new Uint32Array(k),g=(y[0]=-1,(l[1]&2147483648)!==0?1:0),i=g===1?0:1;function t(O,N){y[0]=O;let T=l[g],C=l[i];(T&2147483648)!==0?(T=~T>>>0,C=~C>>>0):T=(T^2147483648)>>>0,N[0]=C,N[1]=T}function o(O,N,T,C){if(C<2)return O;const B=new Uint32Array(256*8);for(let te=0;te<C;te++){const se=N[te],ne=T[te];B[se&255]++,B[256+(se>>>8&255)]++,B[512+(se>>>16&255)]++,B[768+(se>>>24&255)]++,B[1024+(ne&255)]++,B[1280+(ne>>>8&255)]++,B[1536+(ne>>>16&255)]++,B[1792+(ne>>>24&255)]++}let z=O,X=N,Q=T,H=new Uint32Array(C),L=new Uint32Array(C),Z=new Uint32Array(C);const ee=new Uint32Array(256);for(let te=0;te<8;te++){const se=te<<8,ne=(te&3)<<3,ae=te>=4;let de=!1;for(let Ce=0;Ce<256;Ce++)if(B[se+Ce]===C){de=!0;break}if(de)continue;let le=0;for(let Ce=0;Ce<256;Ce++)ee[Ce]=le,le+=B[se+Ce];for(let Ce=0;Ce<C;Ce++){const Ne=X[Ce],he=Q[Ce],ie=(ae?he:Ne)>>>ne&255,ue=ee[ie]++;H[ue]=z[Ce],L[ue]=Ne,Z[ue]=he}let be=z;z=H,H=be,be=X,X=L,L=be,be=Q,Q=Z,Z=be}return z}function c(O,N,T){if(T<2)return O;const C=new Uint32Array(256*4);for(let L=0;L<T;L++){const Z=N[L];C[Z&255]++,C[256+(Z>>>8&255)]++,C[512+(Z>>>16&255)]++,C[768+(Z>>>24&255)]++}let B=O,z=N,X=new Uint32Array(T),Q=new Uint32Array(T);const H=new Uint32Array(256);for(let L=0;L<4;L++){const Z=L<<8,ee=L<<3;let te=!1;for(let ae=0;ae<256;ae++)if(C[Z+ae]===T){te=!0;break}if(te)continue;let se=0;for(let ae=0;ae<256;ae++)H[ae]=se,se+=C[Z+ae];for(let ae=0;ae<T;ae++){const de=z[ae],le=H[de>>>ee&255]++;X[le]=B[ae],Q[le]=de}let ne=B;B=X,X=ne,ne=z,z=Q,Q=ne}return B}function f(O,N,T,C){const B=new Uint32Array(C+1);for(let Q=0;Q<T;Q++)B[N[Q]]++;let z=0;for(let Q=0;Q<=C;Q++){const H=B[Q];B[Q]=z,z+=H}const X=new Uint32Array(T);for(let Q=0;Q<T;Q++)X[B[N[Q]]++]=O[Q];return X}function n(O,N,T,C){return T<2?O:C<=65536||C<=T*2?f(O,N,T,C):c(O,N,T)}function m(O,N){return O.length===N&&O.byteOffset===0?O:Uint32Array.prototype.slice.call(O,0,N)}function r(O,N,T=!1){const C=N||x(O.length),B=C.length;if(B<2)return Uint32Array.from(C);const z=new Uint32Array(B),X=new Uint32Array(B),Q=new Uint32Array(B),H=new Uint32Array(B),L=new Uint32Array(2);let Z=0,ee=0;for(let ne=0;ne<B;ne++){const ae=C[ne],de=O[ae];if(Number.isNaN(de)){H[ee++]=ae;continue}t(de,L),T?(X[Z]=~L[0]>>>0,Q[Z]=~L[1]>>>0):(X[Z]=L[0],Q[Z]=L[1]),z[Z++]=ae}const te=o(z.subarray(0,Z),X.subarray(0,Z),Q.subarray(0,Z),Z);if(ee===0)return m(te,Z);const se=new Uint32Array(B);return se.set(te.subarray(0,Z),0),se.set(H.subarray(0,ee),Z),se}function s(O,N,T=!1){const C=N||x(O.length),B=C.length;if(B<2)return Uint32Array.from(C);const z=Uint32Array.from(C),X=new Uint32Array(B);for(let Q=0;Q<B;Q++){const H=(O[z[Q]]^2147483648)>>>0;X[Q]=T?~H>>>0:H}return m(c(z,X,B),B)}function d(O,N,T={}){const C=N||x(I(O,T)),B=C.length;if(B<2)return Uint32Array.from(C);const z=G(O.dict,T.locale),X=O.values,Q=W(O),H=Math.max(F(O.dict),z.length),L=H,Z=Uint32Array.from(C),ee=new Uint32Array(B),te=!!T.descending;for(let se=0;se<B;se++){const ne=Z[se];let ae=Q&&Q(ne)===0?L:z[X[ne]];ae===void 0&&(ae=L),ee[se]=te?L-ae:ae}return m(n(Z,ee,B,H+1),B)}function p(O,N,T){const C=N.length;let B=Uint32Array.from(N);if(C<2)return B;let z=new Uint32Array(C);for(let X=1;X<C;X<<=1){for(let H=0;H<C;H+=X<<1){const L=Math.min(H+X,C),Z=Math.min(H+(X<<1),C);let ee=H,te=L,se=H;for(;ee<L&&te<Z;)z[se++]=T(O[B[ee]],O[B[te]])<=0?B[ee++]:B[te++];for(;ee<L;)z[se++]=B[ee++];for(;te<Z;)z[se++]=B[te++]}const Q=B;B=z,z=Q}return B}function u(O,N,T){const C=M(O.values),B=N.length,z=new Uint32Array(B),X=T?1:0;let Q=0;for(let H=0;H<B;H++)C(N[H])===X&&(z[Q++]=N[H]);for(let H=0;H<B;H++)C(N[H])!==X&&(z[Q++]=N[H]);return z}function b(O,N){const T=O.values,C=O.kind;if((C==="object"||C===void 0)&&(Array.isArray(T)||ArrayBuffer.isView(T))&&!O.presence)return T;const z=R(O),X=new Array(I(O)||0);for(let Q=0;Q<N.length;Q++){const H=N[Q];X[H]=z(H)}return X}function a(O,N){for(let T=0;T<N.length;T++)if(typeof O[N[T]]!="string")return!1;return!0}function h(O,N,T,C,B){const z=O.length,X=Uint32Array.from(O);if(z<2||C<1)return X;const Q=new Uint32Array(z),H=C-1;for(let L=0;L<z;L++){const Z=T[N[L]];Q[L]=B?H-Z:Z}return m(n(X,Q,z,C),z)}function w(O,N,T){const C=K(T),B=new Array(N);for(let X=0;X<N;X++)B[X]=X;B.sort((X,Q)=>C(O[X],O[Q])||X-Q);const z=new Uint32Array(N);for(let X=0;X<N;X++)z[B[X]]=X;return z}function v(O,N,T){const C=N.length,B=new Map,z=[],X=new Uint32Array(C);for(let L=0;L<C;L++){const Z=O[N[L]];let ee=B.get(Z);ee===void 0&&(ee=z.length,B.set(Z,ee),z.push(Z)),X[L]=ee}const Q=z.length,H=w(z,Q,T.locale);return h(N,X,H,Q,!!T.descending)}function A(O,N,T){const C=b(O,N);if(N.length>=2&&a(C,N)){const X=O.stringRank;return X&&X.version===O.version&&X.usable(N,C,T.locale)?X.sort(N,T):v(C,N,T)}const B=K(T.locale),z=T.descending?(X,Q)=>B(Q,X):B;return p(C,N,z)}function _(O,N,T){const C=b(O,N),B=T.compare,X=!!T.descending?(Q,H)=>-B(Q,H,void 0,void 0,!0):(Q,H)=>B(Q,H,void 0,void 0,!1);return p(C,N,X)}function V(O,N){const T=N.length,C=W(O),B=O.values,z=O.kind==="float64"&&!!B,X=O.kind==="object"||O.kind==="multi"||O.kind===void 0;if(!C&&!z&&!X)return{present:N,absent:S};const Q=new Uint32Array(T),H=new Uint32Array(T);let L=0,Z=0;if(C&&z)for(let ee=0;ee<T;ee++){const te=N[ee];C(te)===1&&!Number.isNaN(B[te])?Q[L++]=te:H[Z++]=te}else if(z&&!C)for(let ee=0;ee<T;ee++){const te=N[ee];Number.isNaN(B[te])?H[Z++]=te:Q[L++]=te}else if(C&&!X)for(let ee=0;ee<T;ee++){const te=N[ee];C(te)===1?Q[L++]=te:H[Z++]=te}else{const ee=R(O);for(let te=0;te<T;te++){const se=N[te];q(ee(se))?H[Z++]=se:Q[L++]=se}}return Z===0?{present:N,absent:S}:{present:Q.subarray(0,L),absent:H.subarray(0,Z)}}function Y(O,N,T){if(N.length===0)return O;const C=new Uint32Array(O.length+N.length);return T?(C.set(N,0),C.set(O,N.length)):(C.set(O,0),C.set(N,O.length)),C}function $(O,N,T={}){const C=N||x(I(O,T));if(!O||C.length<2)return Uint32Array.from(C);const{present:B,absent:z}=V(O,C);if(B.length===0)return Uint32Array.from(C);const X=!!T.descending;let Q;if(typeof T.compare=="function")Q=_(O,B,T);else switch(O.kind){case"float64":Q=r(O.values,B,X);break;case"int32":Q=s(O.values,B,X);break;case"dictionary":Q=d(O,B,T);break;case"bitset":Q=u(O,B,X);break;default:Q=A(O,B,T);break}return Y(Q,z,!!T.nullsFirst)}function j(O,N,T,C={}){const B=N||[],z=B.length&&(B[0].handle||E(O,B[0].col))||O&&O[0];let X=T||x(I(z,C));for(let Q=B.length-1;Q>=0;Q--){const H=B[Q],L=H.handle||E(O,H.col)||O&&O[Q];L&&(X=$(L,X,{descending:H.descending!==void 0?!!H.descending:H.dir==="desc",nullsFirst:!!H.nullsFirst,locale:H.locale!==void 0?H.locale:C.locale,compare:H.compare}))}return X instanceof Uint32Array?X:Uint32Array.from(X)}function E(O,N){if(!(!O||N===void 0)){for(let T=0;T<O.length;T++)if(O[T]&&O[T].id===N)return O[T]}}}),Be("packages/core/src/store/stringrank.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_MAX_DISTINCT",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"StringRankIndex",{enumerable:!0,get:function(){return x}});const re=D("packages/core/src/compute/sort.js"),M=re.collateStringRanks,G=re.rankSortStrings,F=1e5;class x{#e=[];#t=new Map;#n;#r=0;#i=0;#s=-1;#o;#l=!1;#a=null;#c=-1;#u="\0";constructor(W=F){this.#o=W>0?W:F,this.#n=new Uint32Array(0)}get version(){return this.#s}set version(W){this.#s=W}get generation(){return this.#i}get size(){return this.#e.length}get capped(){return this.#l}get length(){return this.#r}get bytes(){let W=this.#n.byteLength;const I=this.#e;for(let K=0;K<I.length;K++)W+=I[K].length*2+24;return W}#f(W,I){const K=this.#t.get(W);if(K!==void 0)return K;if(this.#l)return-1;if(I&&this.#e.length>=this.#o)return this.#l=!0,-1;const R=this.#e.length;return this.#e.push(W),this.#t.set(W,R),this.#i++,R}build(W,I){const K=I|0;this.#e=[],this.#t=new Map,this.#i=0,this.#l=!1,this.#a=null,this.#c=-1,this.#n=new Uint32Array(K);for(let R=0;R<K;R++){const S=W[R],k=typeof S=="string"?this.#f(S,!1):-1;this.#n[R]=k<0?0:k}this.#r=K}append(W,I,K){const R=(I|0)+(K|0);if(R>this.#n.length){const S=new Uint32Array(R);S.set(this.#n.subarray(0,this.#r)),this.#n=S}for(let S=I|0;S<R;S++){const k=W[S],y=typeof k=="string"?this.#f(k,!0):-1;this.#n[S]=y<0?0:y}this.#r=Math.max(this.#r,R)}ranks(W){const I=W||"";if(this.#a&&this.#c===this.#i&&this.#u===I)return this.#a;const K=M(this.#e,this.#e.length,W);return this.#a=K,this.#c=this.#i,this.#u=I,K}usable(W,I,K){if(this.#l||this.#e.length===0)return!1;const R=this.#n,S=this.#e,k=this.#r;for(let y=0;y<W.length;y++){const l=W[y];if(l>=k||S[R[l]]!==I[l])return!1}return!0}sort(W,I){const K=this.ranks(I.locale),R=this.#e.length,S=W.length,k=new Uint32Array(S),y=this.#n;for(let l=0;l<S;l++)k[l]=y[W[l]];return G(W,k,K,R,!!I.descending)}}}),Be("packages/core/src/store/columnstore.js",function(e,D){"use strict";Object.defineProperty(e,"REMOVED",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"toFloat",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ColumnHandle",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"ColumnStore",{enumerable:!0,get:function(){return u}});const M=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/internal/predicates.js").isFunction,q=D("packages/core/src/internal/paths.js").pathGetter,I=D("packages/core/src/store/bitset.js").Bitset,R=D("packages/core/src/store/dictionary.js").Dictionary,k=D("packages/core/src/store/multivalue.js").MultiValue,l=D("packages/core/src/store/stringrank.js").StringRankIndex,g=4294967295,i=1024,t=5e3,o=.2,c=new Set(["float64","int32","bitset","dictionary","object","multi"]);function f(b){return b==null}function n(b){if(typeof b=="number")return b;if(b instanceof Date)return b.getTime();if(typeof b=="boolean")return b?1:0;const a=Number(b);return Number.isNaN(a)&&typeof b=="string"?Date.parse(b):a}function m(b){const a=n(b);return Number.isFinite(a)?a|0:0}function r(b){return f(b)?[]:Array.isArray(b)?b:[b]}function s(b,a){switch(b.kind){case"float64":case"int32":return b.buf[a];case"bitset":return b.bits.get(a)===1;case"dictionary":return b.dict.valueOf(b.buf[a]);case"multi":{const h=b.mv.at(a),w=new Array(h.length);for(let v=0;v<h.length;v++)w[v]=b.dict.valueOf(h[v]);return w}default:return b.buf[a]}}function d(b,a){switch(b.kind){case"float64":case"int32":return b.values[a];case"bitset":return(b.values[a>>3]&1<<(a&7))!==0;case"dictionary":return(b.table||[])[b.values[a]];case"multi":{const h=b.offsets[a],w=b.offsets[a+1],v=b.table||[],A=new Array(w-h);for(let _=h;_<w;_++)A[_-h]=v[b.values[_]];return A}default:return b.values[a]}}class p{#e;#t;#n;#r;#i;#s;#o;#l=!1;#a=null;#c=null;#u=null;#f=null;#d=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#O=null;#w=null;#A=!1;constructor(a,h){this.#e=a.id;const w=c.has(a.kind)?a.kind:"object";a.kind&&!c.has(a.kind)&&M(`store.kind.${a.id}`,`column "${a.id}" declares unknown storage kind "${a.kind}"; falling back to object`),this.#n=w,this.#t=w,this.#r=a.nullable!==!1,this.#o=a.dictionary??null,this.#s=h,this.#i=F(a.read)?a.read:q(a.field||a.id),this.#h=a.stringRankIndex!=="off",this.#p=typeof a.stringRankMaxDistinct=="number"?a.stringRankMaxDistinct:0,this.#O=new Map}get id(){return this.#e}get kind(){return this.#l?this.#t:"object"}get target(){return this.#n}get nullable(){return this.#r}get values(){return this.#A?null:this.#l?this.#t==="bitset"?this.#c.words:this.#t==="multi"?this.#u.values:this.#a:this.#T().values}get presence(){return this.#A||!this.#r?null:this.#l?this.#g:this.#T().presence}get dict(){return this.#A||!this.#l?null:this.#t==="dictionary"||this.#t==="multi"?this.#f:null}get stringRank(){if(this.#A||!this.#h||this.kind!=="object")return null;const a=this.values,h=this.#s.physical();if(!a||h===0)return null;if(this.#d===null){if(typeof a[0]!="string")return null;const w=new l(this.#v());return w.build(a,h),w.version=this.#y,this.#d=w,this.#m=this.#y,w.capped?null:w}return this.#d.length<h&&this.#d.append(a,this.#d.length,h-this.#d.length),this.#d.version=this.#y,this.#m=this.#y,this.#d.capped?null:this.#d}#v(){return this.#p}#C(){this.#d=null,this.#m=-1}get offsets(){return this.#A||!this.#l||this.#t!=="multi"?null:this.#u.offsets}get version(){return this.#y}get bytes(){let a=0;return this.#a&&(a+=this.#a.byteLength??this.#a.length*8),this.#c&&(a+=this.#c.bytes),this.#u&&(a+=this.#u.bytes),this.#g&&(a+=this.#g.bytes),this.#f&&(a+=this.#f.bytes),this.#O&&(a+=this.#O.size*24),a}get(a){if(!this.#A&&!(a<0||a>=this.#s.physical())){if(!this.#l)return this.#E(a);if(this.#r&&this.#g.get(a)===0)return null;switch(this.#t){case"float64":case"int32":return this.#a[a];case"bitset":return this.#c.get(a)===1;case"dictionary":return this.#f.valueOf(this.#a[a]);case"multi":{const h=this.#u.at(a),w=new Array(h.length);for(let v=0;v<h.length;v++)w[v]=this.#f.valueOf(h[v]);return w}default:return this.#a[a]}}}set(a,h){this.#A||(this.#l?this.#P(a,h):this.#O.set(a,h===void 0?null:h),this.#d&&this.#C(),this.#y++)}read(a){return this.#i(a)}appendColumn(a,h,w){if(this.#A||w<=0)return;if(!this.#l){this.#y++;return}const v=this.#i,A=this.#r,_=this.#g;let V=!1;switch(this.#t){case"float64":{const Y=this.#a;for(let $=0;$<w;$++){const j=v(a[$]);if(typeof j=="number"){A&&_.set(h+$),Y[h+$]=j;continue}const E=j==null;A?_.assign(h+$,!E):E&&(V=!0),Y[h+$]=E?NaN:n(j)}break}case"int32":{const Y=this.#a;for(let $=0;$<w;$++){const j=v(a[$]),E=j==null;A?_.assign(h+$,!E):E&&(V=!0),Y[h+$]=E?0:m(j)}break}case"bitset":{const Y=this.#c;for(let $=0;$<w;$++){const j=v(a[$]),E=j==null;A?_.assign(h+$,!E):E&&(V=!0),Y.assign(h+$,!E&&!!j)}break}case"dictionary":{const Y=this.#a,$=this.#f;for(let j=0;j<w;j++){const E=v(a[j]),O=E==null;A?_.assign(h+j,!O):O&&(V=!0),Y[h+j]=O?0:$.codeOf(E)}break}case"multi":{const Y=this.#u,$=this.#f;for(let j=0;j<w;j++){const E=v(a[j]),O=E==null;A?_.assign(h+j,!O):O&&(V=!0);const N=r(E),T=new Array(N.length);for(let C=0;C<N.length;C++)T[C]=$.codeOf(N[C]);Y.write(h+j,T)}break}default:{const Y=this.#a;for(let $=0;$<w;$++){const j=v(a[$]),E=j==null;A?_.assign(h+$,!E):E&&(V=!0),Y[h+$]=E?null:j}break}}V&&M(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#d&&this.#t==="object"&&(this.#d.append(this.#a,h,w),this.#d.version=this.#y+1,this.#m=this.#y+1),this.#y++}appendPacked(a,h,w){if(this.#A||w<=0||!a)return;if(!this.#l){this.#y++;return}const v=this.#g,A=a.presence;if(v)if(A)for(let V=0;V<w;V++)v.assign(h+V,(A[V>>3]&1<<(V&7))!==0);else for(let V=0;V<w;V++)v.set(h+V);const _=a.kind===this.#t;if(_&&(this.#t==="float64"||this.#t==="int32")){this.#a.set(a.values,h),this.#y++;return}if(_&&this.#t==="bitset"){const V=a.values;for(let Y=0;Y<w;Y++)this.#c.assign(h+Y,(V[Y>>3]&1<<(Y&7))!==0);this.#y++;return}if(_&&this.#t==="dictionary"){const V=a.table||[],Y=new Uint32Array(V.length);for(let O=0;O<V.length;O++)Y[O]=this.#f.codeOf(V[O]);const $=a.values,j=this.#a,E=v;for(let O=0;O<w;O++){if(E&&(A&&(A[O>>3]&1<<(O&7))===0)){j[h+O]=0;continue}j[h+O]=Y[$[O]]??0}this.#y++;return}if(_&&this.#t==="multi"){const V=a.table||[],Y=new Uint32Array(V.length);for(let E=0;E<V.length;E++)Y[E]=this.#f.codeOf(V[E]);const $=a.values,j=a.offsets;for(let E=0;E<w;E++){const O=j[E],N=j[E+1],T=new Array(N-O);for(let C=O;C<N;C++)T[C-O]=Y[$[C]]??0;this.#u.write(h+E,T)}this.#y++;return}for(let V=0;V<w;V++){const Y=A?(A[V>>3]&1<<(V&7))===0:a.kind==="object"?a.values[V]===null:!1;this.#P(h+V,Y?null:d(a,V))}this.#y++}touch(){this.#y++}columnarise(a,h){if(this.#l||this.#A)return;const w=new Array(h);for(let v=0;v<h;v++)w[v]=this.#E(v);this.#t=this.#n,this.#l=!0,this.#S(a);for(let v=0;v<h;v++)this.#P(v,w[v]);this.#O.clear(),this.#w=null,this.#C(),this.#y++}grow(a){if(!(!this.#l||this.#A||a<=this.#b)){switch(this.#t){case"float64":case"int32":case"dictionary":{const h=new this.#a.constructor(a);h.set(this.#a),this.#a=h;break}case"bitset":this.#c.grow(a);break;case"multi":break;default:this.#a.length=a;break}this.#g&&this.#g.grow(a),this.#b=a,this.#y++}}convert(a){if(this.#A||!c.has(a)||(this.#n=a,!this.#l||a===this.#t))return!1;const h={kind:this.#t,buf:this.#a,bits:this.#c,mv:this.#u,dict:this.#f},w=this.#s.physical(),v=this.#g;this.#t=a,this.#S(this.#b);for(let A=0;A<w;A++){const _=v!==null&&v.get(A)===0;_&&a!=="multi"||this.#P(A,_?null:s(h,A))}return this.#C(),this.#y++,!0}compact(a,h,w){if(!this.#A){if(this.#C(),!this.#l){const v=this.#O;if(v.size){const A=new Map;for(const[_,V]of v)a[_]!==g&&A.set(a[_],V);this.#O=A}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const v=this.#a;for(let A=0;A<h;A++)a[A]!==g&&(v[a[A]]=v[A]);if(this.#t==="object")for(let A=w;A<h;A++)v[A]=void 0;break}case"bitset":{const v=this.#c;for(let A=0;A<h;A++)a[A]!==g&&v.assign(a[A],v.get(A)===1);for(let A=w;A<h;A++)v.clear(A);break}case"multi":this.#u.compact(a,w,g);break;default:break}if(this.#g){const v=this.#g;for(let A=0;A<h;A++)a[A]!==g&&v.assign(a[A],v.get(A)===1);for(let A=w;A<h;A++)v.clear(A)}this.#y++}}release(){this.#A||(this.#A=!0,this.#a=null,this.#c&&this.#c.release(),this.#c=null,this.#u&&this.#u.release(),this.#u=null,this.#g&&this.#g.release(),this.#g=null,this.#f=null,this.#d=null,this.#O=new Map,this.#w=null,this.#b=0,this.#y++)}#S(a){const h=Math.max(1,a);switch(this.#a=null,this.#c=null,this.#u=null,this.#t){case"float64":this.#a=new Float64Array(h);break;case"int32":this.#a=new Int32Array(h);break;case"bitset":this.#c=new I(h);break;case"dictionary":this.#a=new Uint32Array(h),this.#f=this.#f??new R(this.#o??[]);break;case"multi":this.#u=new k({rows:h,values:h}),this.#f=this.#f??new R(this.#o??[]);break;default:this.#a=new Array(h);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#f=null),this.#r&&(this.#g?this.#g.grow(h):this.#g=new I(h)),this.#b=h}#P(a,h){const w=f(h);switch(this.#r?this.#g.assign(a,!w):w&&M(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#t){case"float64":this.#a[a]=w?NaN:n(h);break;case"int32":this.#a[a]=w?0:m(h);break;case"bitset":this.#c.assign(a,!w&&!!h);break;case"dictionary":this.#a[a]=w?0:this.#f.codeOf(h);break;case"multi":{const v=r(h),A=new Array(v.length);for(let _=0;_<v.length;_++)A[_]=this.#f.codeOf(v[_]);this.#u.write(a,A);break}default:this.#a[a]=w?null:h;break}}#E(a){if(this.#O.has(a))return this.#O.get(a);const h=this.#i(this.#s.rowAt(a));return h===void 0?null:h}#T(){if(this.#w&&this.#w.version===this.#y)return this.#w;const a=this.#s.physical(),h=new Array(a),w=this.#r?new I(a):null;for(let v=0;v<a;v++){const A=this.#E(v);h[v]=A,w&&!f(A)&&w.set(v)}return this.#w={version:this.#y,values:h,presence:w},this.#w}}class u{#e;#t=new Map;#n=[];#r=[];#i=0;#s=0;#o=0;#l=0;#a=new I(0);#c=!1;#u=!0;#f;#d;#h;#p=!1;constructor(a,h={}){this.#e=Array.isArray(a)?a:[],this.#d=Math.max(1,h.initialCapacity??i),this.#u=h.retainSource!==!1,this.#f=this.#u?h.columnarBelow??t:0,this.#h=h.compactRatio??o;const w={rowAt:v=>this.#r[v],physical:()=>this.#i};for(const v of this.#e){if(!v||!v.id)continue;if(this.#t.has(v.id)){M(`store.dup.${v.id}`,`duplicate column id "${v.id}" in the store schema; ignoring the second`);continue}const A=new p(v,w);this.#t.set(v.id,A),this.#n.push(A)}this.#f<=0&&this.#b()}get count(){return this.#o}get physical(){return this.#i}get capacity(){return this.#c?this.#s:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let a=this.#a.bytes+this.#r.length*8;for(const h of this.#n)a+=h.bytes;return a}append(a){const h=this.#i;if(this.#p||!a)return{from:h,to:h};const w=a.length|0;if(w===0)return{from:h,to:h};if(this.#u)for(let A=0;A<w;A++)this.#r[h+A]=a[A];if(this.#i=h+w,this.#o+=w,this.#a.grow(this.#i),!this.#c){if(this.#i>=this.#f)this.#b();else for(const A of this.#n)A.touch();return{from:h,to:this.#i}}this.#m(this.#i);const v=this.#n;for(let A=0;A<v.length;A++)v[A].appendColumn(a,h,w);return{from:h,to:this.#i}}appendPacked(a,h){const w=this.#i;if(this.#p||!a)return{from:w,to:w};const v=a.count|0;if(v===0)return{from:w,to:w};if(this.#u&&h)for(let _=0;_<v;_++)this.#r[w+_]=h[_];this.#i=w+v,this.#o+=v,this.#a.grow(this.#i),this.#c||this.#b(),this.#m(this.#i);const A=new Map;for(const _ of a.columns)A.set(_.id,_);for(const _ of this.#n){const V=A.get(_.id);V?_.appendPacked(V,w,v):_.grow(this.#s)}return{from:w,to:this.#i}}source(a){if(this.#u)return this.#r[a];if(!(a<0||a>=this.#i))return this.#g(a)}setSource(a,h){this.#p||a<0||a>=this.#i||this.#u&&(this.#r[a]=h)}get(a,h){const w=this.#t.get(a);return w?w.get(h):void 0}set(a,h,w){if(this.#p||h<0||h>=this.#i)return;const v=this.#t.get(a);if(!v){M(`store.set.${a}`,`set() on unknown column "${a}"`);return}v.set(h,w)}remove(a){return this.#p||a<0||a>=this.#i||this.#a.get(a)===1?!1:(this.#a.set(a),this.#l++,this.#o--,!0)}live(a){return a<0||a>=this.#i?!1:this.#a.get(a)===0}compact(a={}){if(this.#p||this.#l===0||!a.force&&this.#l/this.#i<this.#h)return null;const h=this.#i,w=new Uint32Array(h);let v=0;for(let A=0;A<h;A++)w[A]=this.#a.get(A)===1?g:v++;for(const A of this.#n)A.compact(w,h,v);if(this.#u){const A=this.#r;for(let _=0;_<h;_++)w[_]!==g&&(A[w[_]]=A[_]);A.length=v}return this.#i=v,this.#o=v,this.#l=0,this.#a=new I(Math.max(this.#s,v)),w}column(a){return this.#t.get(a)}columns(){return this.#n.slice()}liveIndices(){const a=new Uint32Array(this.#o);if(this.#l===0){for(let w=0;w<this.#i;w++)a[w]=w;return a}let h=0;for(let w=0;w<this.#i;w++)this.#a.get(w)===0&&(a[h++]=w);return a}convert(a,h){const w=this.#t.get(a);return w?w.convert(h):!1}destroy(){if(!this.#p){this.#p=!0;for(const a of this.#n)a.release();this.#t.clear(),this.#n.length=0,this.#r.length=0,this.#a.release(),this.#i=0,this.#o=0,this.#l=0,this.#s=0}}#m(a){if(a<=this.#s)return;let h=this.#s||this.#d;for(;h<a;)h*=2;for(const w of this.#n)w.grow(h);this.#a.grow(h),this.#s=h}#g(a){const h={};for(const w of this.#n)h[w.id]=w.get(a);return h}#b(){if(this.#c)return;let a=this.#d;for(;a<this.#i;)a*=2;this.#c=!0,this.#s=a,this.#a.grow(a);for(const h of this.#n)h.columnarise(a,this.#i)}}}),Be("packages/core/src/store/pool.js",function(e,D){"use strict";Object.defineProperty(e,"MaskPool",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"sharedPool",{enumerable:!0,get:function(){return x}});const re=64,M=8;function G(W){let I=re;for(;I<W;)I*=2;return I}class F{#e=new Map;#t=new WeakSet;#n;#r=0;#i={acquired:0,reused:0,released:0};constructor(I={}){this.#n=I.limit??M}get bytes(){return this.#r}mask(I){const K=new Uint8Array(this.#s(I),0,I);return K.fill(0),K}indices(I){return new Uint32Array(this.#s(I*4),0,I)}release(I){if(!I||!I.buffer)return!1;const K=I.buffer;if(!this.#t.has(K))return!1;this.#t.delete(K),this.#i.released++;const R=K.byteLength;let S=this.#e.get(R);return S||this.#e.set(R,S=[]),S.length>=this.#n||(S.push(K),this.#r+=R),!0}releaseAll(I){for(const K of I)this.release(K)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#i,retained:this.#r}}#s(I){const K=G(I),R=this.#e.get(K);this.#i.acquired++;let S;return R&&R.length?(S=R.pop(),this.#r-=K,this.#i.reused++):S=new ArrayBuffer(K),this.#t.add(S),S}}function x(){return q??=new F,q}let q=null}),Be("packages/core/src/compute/sortspec.js",function(e,D){"use strict";Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return x}});function re(q){return{locale:q===void 0?void 0:String(q),numeric:!0,sensitivity:"variant"}}function M(q){return!!q&&typeof q.compare!="function"}function G(q){if(!q)return!0;for(let W=0;W<q.length;W++)if(!M(q[W]))return!1;return!0}function F(q,W){const I=q.col!==void 0?q.col:q.handle&&q.handle.id,K=q.locale!==void 0?q.locale:W;return{col:I,descending:q.descending!==void 0?!!q.descending:q.dir==="desc",nullsFirst:!!q.nullsFirst,collation:re(K)}}function x(q,W){const I=q||[],K=new Array(I.length);for(let R=0;R<I.length;R++)K[R]=F(I[R],W);return K}}),Be("packages/core/src/compute/facet.js",function(e,D){"use strict";Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"orderedReader",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"toNumeric",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return w}});const re=D("packages/core/src/compute/handle.js"),M=re.presenceReader,G=re.valueReader,F=re.dictSize,x=re.dictValue,q=Object.freeze(["equal","quantile","log"]),W=Object.freeze(["hour","day","week","month","quarter","year"]),I=20,K=50,R=1e4;function S(v,A){if(!v)return"none";const _=A;if(_&&(_.multi===!0||typeof _.items=="function"))return"category";const V=A&&A.base;if(V==="date"||V==="datetime"||V==="time"||V==="dateString")return"date";switch(v.kind){case"bitset":return"boolean";case"float64":case"int32":return"numeric";case"dictionary":return"category";case"multi":return"category";default:return V==="number"?"numeric":V==="boolean"?"boolean":V==="text"?"category":"none"}}function k(v){const A=v.values,_=v.kind;if((_==="float64"||_==="int32")&&A)return Y=>A[Y];const V=G(v);return Y=>y(V(Y))}function y(v){if(typeof v=="number")return v;if(v instanceof Date)return v.getTime();if(v==null||v==="")return NaN;if(typeof v=="boolean")return v?1:0;if(typeof v=="string"){const A=Number(v);if(Number.isFinite(A))return A;const _=Date.parse(v);return Number.isFinite(_)?_:NaN}return NaN}function l(v,A,_,V=K){if(!v)return{cardinality:0,exact:!0};if(v.dict)return{cardinality:F(v.dict),exact:!0};if(v.kind==="bitset")return{cardinality:2,exact:!0};const Y=G(v),$=A?A.length:_,j=new Set;for(let E=0;E<$;E++){const O=Y(A?A[E]:E);if(O!=null&&(j.add(O),j.size>V))return{cardinality:j.size,exact:!1}}return{cardinality:j.size,exact:!0}}const g=36e5,i=864e5;function t(v,A=I){const _=Number.isFinite(v)&&v>0?v:0,V=Math.max(1,A)*2;return _/g<=V?"hour":_/i<=V?"day":_/(7*i)<=V?"week":_/(30*i)<=V?"month":_/(91*i)<=V?"quarter":"year"}function o(v,A){if(!Number.isFinite(v))return NaN;const _=new Date(v);switch(A){case"hour":return _.setMinutes(0,0,0),_.getTime();case"day":return _.setHours(0,0,0,0),_.getTime();case"week":{_.setHours(0,0,0,0);const V=(_.getDay()+6)%7;return _.setDate(_.getDate()-V),_.getTime()}case"month":return _.setDate(1),_.setHours(0,0,0,0),_.getTime();case"quarter":return _.setMonth(Math.floor(_.getMonth()/3)*3,1),_.setHours(0,0,0,0),_.getTime();default:return _.setMonth(0,1),_.setHours(0,0,0,0),_.getTime()}}function c(v,A){const _=new Date(v);switch(A){case"hour":_.setHours(_.getHours()+1);break;case"day":_.setDate(_.getDate()+1);break;case"week":_.setDate(_.getDate()+7);break;case"month":_.setMonth(_.getMonth()+1);break;case"quarter":_.setMonth(_.getMonth()+3);break;default:_.setFullYear(_.getFullYear()+1);break}return _.getTime()}function f(v,A,_){const V=k(v),Y=M(v),$=A?A.length:_;let j=1/0,E=-1/0,O=0,N=0;for(let T=0;T<$;T++){const C=A?A[T]:T;if(Y&&!Y(C)){O++;continue}const B=V(C);if(!Number.isFinite(B)){O++;continue}B<j&&(j=B),B>E&&(E=B),N++}return{min:j,max:E,nulls:O,finite:N}}function n(v,A,_,V){const Y=k(v),$=M(v),j=A?A.length:_,E=j>V?j/V:1,O=[];for(let T=0;T<j;T+=E){const C=A?A[Math.floor(T)]:Math.floor(T);if($&&!$(C))continue;const B=Y(C);Number.isFinite(B)&&O.push(B)}const N=Float64Array.from(O);return N.sort(),N}function m(v,A,_,V={}){const Y=V.kind||S(v,V.type);return Y==="none"||!v?{kind:"none",buckets:[],suppressed:"type"}:Y==="boolean"?r(v,A,_):Y==="category"?s(v,A,_,V):p(v,A,_,Y,V)}function r(v,A,_){const V=M(v);let Y=0;if(V){const j=A?A.length:_;for(let E=0;E<j;E++)V(A?A[E]:E)||Y++}const $=[{value:!1,label:"false"},{value:!0,label:"true"}];return Y>0&&$.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:$}}function s(v,A,_,V){const Y=V.cardinalityLimit??K,{cardinality:$}=l(v,A,_,Y);if($>Y&&(V.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:$};const j=G(v),E=A?A.length:_,O=new Map;let N=0;for(let X=0;X<E;X++){const Q=j(A?A[X]:X);if(Q==null||Q===""){N++;continue}if(Array.isArray(Q)){if(!Q.length){N++;continue}for(const H of Q)O.set(H,(O.get(H)||0)+1);continue}O.set(Q,(O.get(Q)||0)+1)}let T=[...O.entries()];V.order==="alpha"?T.sort((X,Q)=>String(X[0]).localeCompare(String(Q[0]))):T.sort((X,Q)=>Q[1]-X[1]);let C=0,B=0;if(T.length>Y){B=T.length-Y;for(let X=Y;X<T.length;X++)C+=T[X][1];T=T.slice(0,Y)}const z=T.map(([X])=>({value:X,label:String(X)}));return C>0&&z.push({remainder:!0,label:`Other (${B} values)`}),N>0&&z.push({null:!0,label:"Empty"}),{kind:"category",buckets:z,cardinality:$}}function d(v,A,_,V,Y){const $=n(v,A,_,R),j=$.length;if(j<100)return null;const E=$[Math.floor(.01*j)],O=$[Math.ceil(.99*j)-1];return!(O>E)||Y-V<=2*(O-E)?null:{lo:E,hi:O}}function p(v,A,_,V,Y){const{min:$,max:j,nulls:E,finite:O}=f(v,A,_);if(!O)return{kind:V,buckets:E?[{null:!0,label:"Empty"}]:[],empty:!0};const N=Math.max(1,Math.floor(Y.buckets||I));let T=[];if(V==="date"){const B=W.includes(Y.granularity)?Y.granularity:t(j-$,N);let z=o($,B);for(;z<=j&&T.length<4096;){const X=c(z,B);if(!(X>z))break;T.push({from:z,to:X}),z=X}return{kind:V,buckets:u(T,E),granularity:B}}const C=q.includes(Y.strategy)?Y.strategy:"equal";if(C==="quantile"){const B=n(v,A,_,R);if(B.length){const z=[B[0]];for(let X=1;X<N;X++){const Q=B[Math.min(B.length-1,Math.floor(X/N*B.length))];Q>z[z.length-1]&&z.push(Q)}z.push(j);for(let X=0;X<z.length-1;X++)T.push({from:z[X],to:z[X+1]})}}else if(C==="log"&&$>0){const B=Math.log10($),X=(Math.log10(j)-B)/N||1;for(let Q=0;Q<N;Q++)T.push({from:10**(B+Q*X),to:10**(B+(Q+1)*X)})}if(!T.length&&C==="equal"){const B=d(v,A,_,$,j);if(B){const z=(B.hi-B.lo)/N;B.lo>$&&T.push({from:$,to:B.lo,overflow:"low"});for(let X=0;X<N;X++)T.push({from:B.lo+X*z,to:B.lo+(X+1)*z});T[T.length-1].to=B.hi,B.hi<j&&T.push({from:B.hi,to:j,overflow:"high"})}}if(!T.length){const B=(j-$)/N||1;for(let z=0;z<N;z++)T.push({from:$+z*B,to:$+(z+1)*B})}return T[T.length-1].to=j,{kind:V,buckets:u(T,E),strategy:C,min:$,max:j}}function u(v,A){return A>0?[...v,{null:!0,label:"Empty"}]:v}function b(v,A,_,V,Y){const $=V&&V.buckets||[],j=Y&&Y.length>=$.length?Y.subarray(0,$.length):new Uint32Array($.length);if(j.fill(0),!v||!$.length)return j;const E=$.length-1,O=!!$[E]&&$[E].null===!0,N=A?A.length:_;if(V.kind==="boolean"){const X=G(v);for(let Q=0;Q<N;Q++){const H=X(A?A[Q]:Q);if(H==null){O&&j[E]++;continue}j[H?1:0]++}return j}if(V.kind==="category"){const X=new Map;for(let L=0;L<$.length;L++)!$[L].null&&!$[L].remainder&&X.set($[L].value,L);const Q=$.findIndex(L=>L.remainder),H=G(v);for(let L=0;L<N;L++){const Z=H(A?A[L]:L);if(Z==null||Z===""){O&&j[E]++;continue}if(Array.isArray(Z)){if(!Z.length){O&&j[E]++;continue}for(const te of Z){const se=X.get(te);se!==void 0?j[se]++:Q>=0&&j[Q]++}continue}const ee=X.get(Z);ee!==void 0?j[ee]++:Q>=0&&j[Q]++}return j}const T=O?$.length-1:$.length,C=new Float64Array(T+1);for(let X=0;X<T;X++)C[X]=$[X].from;C[T]=T?$[T-1].to:0;const B=k(v),z=M(v);for(let X=0;X<N;X++){const Q=A?A[X]:X;if(z&&!z(Q)){O&&j[E]++;continue}const H=B(Q);if(!Number.isFinite(H)){O&&j[E]++;continue}const L=a(C,T,H);L>=0&&j[L]++}return j}function a(v,A,_){if(!A||_<v[0])return-1;if(_>=v[A])return _===v[A]?A-1:-1;let V=0,Y=A-1;for(;V<Y;){const $=V+Y+1>>>1;_>=v[$]?V=$:Y=$-1}return V}function h(v,A,_,V={}){const Y=V.bounds||m(v,V.boundsIndices??A,_,V);return{bounds:Y,counts:b(v,A,_,Y)}}const w=h}),Be("packages/core/src/compute/pivotmatrix.js",function(e,D){"use strict";Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return o}});const M=D("packages/core/src/compute/handle.js").valueComparator,F=D("packages/core/src/compute/total.js").total,q=D("packages/core/src/compute/group.js").packKeys,W=D("packages/core/src/compute/pivot.js"),I=W.joinPath,K=W.DEFAULT_PATH_SEPARATOR,R=W.DEFAULT_MAX_COLUMNS,S="";function k(c,f,n={}){const m=n.separator||K,r=c||[],s=f instanceof Uint32Array?f:Uint32Array.from(f||[]),d=s.length;if(r.length===0)return{tuples:[[]],paths:[S],buckets:[s]};const{keyOf:p,readers:u}=q(r,s,0),b=new Map,a=[],h=[],w=[];for(let $=0;$<d;$++){const j=s[$],E=p(j);let O=b.get(E);if(O===void 0){O=a.length,b.set(E,O),h.push(E);const N=new Array(u.length);for(let T=0;T<u.length;T++)N[T]=u[T](j);a.push(N),w.push([])}w[O].push(j)}const v=M(n.locale),A=a.map(($,j)=>j);A.sort(($,j)=>{const E=a[$],O=a[j];for(let N=0;N<E.length;N++){const T=y(E[N],O[N],v);if(T!==0)return T}return $-j});const _=new Array(A.length),V=new Array(A.length),Y=new Array(A.length);for(let $=0;$<A.length;$++){const j=A[$];_[$]=a[j],V[$]=I(a[j],m),Y[$]=Uint32Array.from(w[j])}return{tuples:_,paths:V,buckets:Y}}function y(c,f,n){const m=c==null,r=f==null;return m||r?m&&r?0:m?1:-1:n(c,f)}function l(c,f,n){const m=[];for(let r=0;r<c.length;r++)n.has(c[r])&&m.push(c[r]);return Uint32Array.from(m)}function g(c,f,n,m){return{value:f.length?F(c,f,n,m):null,leaves:f,count:f.length}}function i(c){const f=c&&c.opts||{},n=f.separator||K,m=f.totalContext||{locale:f.locale},r=(c.measures||[]).filter(V=>V&&V.handle),s=c.leaves instanceof Uint32Array?c.leaves:Uint32Array.from(c.leaves||[]),d=k(c.rowHandles||[],s,{...f,separator:n}),p=k(c.columnHandles||[],s,{...f,separator:n}),u=f.maxColumns===void 0?R:f.maxColumns,b=p.paths.length*Math.max(1,r.length),a=new Map;if(u&&b>u)return{rowAxis:d,columnAxis:p,measures:r.map(V=>({colId:V.colId,fn:V.fn})),body:a,rowMargin:a,columnMargin:a,grand:a,columns:b,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${b} columns, above pivot.maxColumns of ${u}. Narrow the pivot columns or raise the limit.`,columns:b,maxColumns:u}};const h=new Map,w=new Map,v=new Map,A=new Map,_=p.buckets.map(V=>new Set(V));for(let V=0;V<p.paths.length;V++){const Y=p.buckets[V],$=p.paths[V];for(const j of r)v.set(o($,j.colId),g(j.handle,Y,j.fn,m))}for(let V=0;V<d.paths.length;V++){const Y=d.buckets[V],$=d.paths[V];for(const j of r)w.set(o($,j.colId),g(j.handle,Y,j.fn,m));for(let j=0;j<p.paths.length;j++){const E=l(Y,p.buckets[j],_[j]);if(E.length===0)continue;const O=p.paths[j];for(const N of r)h.set(t($,O,N.colId),g(N.handle,E,N.fn,m))}}for(const V of r)A.set(V.colId,g(V.handle,s,V.fn,m));return{rowAxis:d,columnAxis:p,measures:r.map(V=>({colId:V.colId,fn:V.fn})),body:h,rowMargin:w,columnMargin:v,grand:A,columns:b,error:null}}function t(c,f,n){return`${c}\0${f}\0${n}`}function o(c,f){return`${c}\0${f}`}}),Be("packages/core/src/compute/reference.js",function(e,D){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return i}});const M=D("packages/core/src/internal/paths.js").getPath,G=D("packages/core/src/compute/handle.js"),F=G.isMissing,x=G.valueComparator,W=D("packages/core/src/compute/filter.js").testValue,I="",K="\0";function R(c,f){const n=f.includes(".")?M(c,f):c?.[f];return n===void 0?null:n}function S(c,f,n={}){const m=f||[];let r=c.map((s,d)=>d);if(m.length===0)return r;for(let s=m.length-1;s>=0;s--)r=k(c,r,m[s],n);return r}function k(c,f,n,m){const r=n.locale!==void 0?n.locale:m.locale,s=x(r),d=n.descending!==void 0?!!n.descending:n.dir==="desc",p=[],u=[];for(const h of f){const w=R(c[h],n.col);F(w)?u.push(h):p.push(h)}const b=new Map;for(let h=0;h<p.length;h++)b.set(p[h],h);const a=(h,w)=>{const v=R(c[h],n.col),A=R(c[w],n.col);let _;return typeof n.compare=="function"?(_=n.compare(v,A,c[h],c[w],d),d&&(_=-_)):_=d?s(A,v):s(v,A),_!==0?_:b.get(h)-b.get(w)};return p.sort(a),n.nullsFirst?u.concat(p):p.concat(u)}function y(c,f,n={}){const m=[];for(let r=0;r<c.length;r++)l(c[r],f,n,r)&&m.push(r);return m}function l(c,f,n,m){if(!f)return!0;if(Array.isArray(f.conditions)){const r=f.conditions.filter(d=>d!=null);if(r.length===0)return!0;if(f.op==="or")return r.some(d=>l(c,d,n,m));const s=r.every(d=>l(c,d,n,m));return f.op==="not"?!s:s}return f.col===void 0&&typeof n.custom=="function"?!!n.custom(f,c,m):W(R(c,f.col),f,n.locale)}function g(c,f,n,m){const r=n||c.map((u,b)=>b),s=new Map,d=[],p=[];for(const u of r){const b=f.map((w,v)=>{const A=R(c[u],w);return m&&m[v]?m[v](A):A}),a=b.map(w=>w==null?K:String(w)).join(I);let h=s.get(a);h===void 0&&(h=d.length,s.set(a,h),d.push(b),p.push([])),p[h].push(u)}return{keys:d,buckets:p}}function i(c,f,n={}){const m=x(n.locale),r=c.filter(d=>!F(d)),s=r.map(t).filter(d=>d!==null);switch(f){case"count":return c.length;case"countValues":return r.length;case"sum":return s.reduce((d,p)=>d+p,0);case"avg":return r.length===0?null:s.reduce((d,p)=>d+p,0)/r.length;case"min":return r.length===0?null:r.reduce((d,p)=>m(p,d)<0?p:d);case"max":return r.length===0?null:r.reduce((d,p)=>m(p,d)>0?p:d);case"first":return c.length===0?null:o(c[0]);case"last":return c.length===0?null:o(c[c.length-1]);default:return null}}function t(c){if(typeof c=="number")return Number.isNaN(c)?null:c;if(c==null||c===""||typeof c=="boolean")return null;if(c instanceof Date)return c.getTime();const f=Number(c);return Number.isNaN(f)?null:f}function o(c){return c===void 0?null:c}}),Be("packages/core/src/compute/index.js",function(e,D){"use strict";const re=D("packages/core/src/compute/sort.js");Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return re.sortColumn}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return re.sortMulti}}),Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return re.radixSortFloat64}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return re.radixSortInt32}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return re.rankSortDictionary}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return re.mergeSortComparator}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return re.collateStringRanks}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return re.rankSortStrings}});const M=D("packages/core/src/compute/sortspec.js");Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return M.collationDescriptor}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return M.isPortableSort}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return M.isPortableSortSet}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return M.describeSortEntry}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return M.describeSort}});const G=D("packages/core/src/compute/filter.js");Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return G.evaluateFilters}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return G.evaluateCondition}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return G.compact}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return G.testValue}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return G.compilePredicate}}),Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return G.releaseMask}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return G.pruneColumn}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return G.mentionsColumn}});const F=D("packages/core/src/compute/group.js");Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return F.groupByColumns}}),Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return F.packKeys}});const x=D("packages/core/src/compute/facet.js");Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return x.facet}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return x.computeBounds}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return x.countInto}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return x.bucketOf}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return x.facetKind}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return x.cardinalityOf}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return x.pickGranularity}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return x.floorTo}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return x.advance}}),Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return x.STRATEGIES}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return x.GRANULARITIES}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return x.DEFAULT_BUCKETS}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return x.DEFAULT_CARDINALITY_LIMIT}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return x.QUANTILE_SAMPLE}});const q=D("packages/core/src/compute/total.js");Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return q.TOTAL_FNS}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return q.TOTAL_LABELS}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return q.totalLabel}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return q.total}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return q.collectValues}});const W=D("packages/core/src/compute/pivot.js");Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return W.pivot}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return W.resolvePivotKeys}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return W.pivotKey}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return W.joinPath}}),Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return W.KEY_DELIMITER}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return W.DEFAULT_PATH_SEPARATOR}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return W.DEFAULT_MAX_COLUMNS}});const I=D("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return I.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return I.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return I.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return I.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return I.GRAND_PATH}});const K=D("packages/core/src/compute/reference.js");Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return K.referenceSort}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return K.referenceFilter}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return K.referenceGroup}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return K.referenceTotal}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return K.referencePasses}}),Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return K.referenceValue}});const R=D("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return R.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return R.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return R.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return R.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return R.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return R.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return R.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return R.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return R.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return R.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return R.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return R.isMissing}});const S=D("packages/core/src/compute/sketch.js");Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return S.Welford}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return S.Reservoir}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return S.HyperLogLog}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return S.SpaceSaving}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return S.KLL}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return S.hash32}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return S.SKETCH_BOUNDS}});const k=D("packages/core/src/compute/windowed.js");Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return k.Window}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return k.WINDOW_KINDS}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return k.openWindow}});const y=D("packages/core/src/compute/statistics.js");Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return y.MAINTENANCE}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return y.APPROXIMATE}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return y.maintenanceOf}});const l=D("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return l.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return l.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return l.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return l.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return l.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return l.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return l.anomalyCondition}});const g=D("packages/core/src/compute/forecast.js");Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return g.FORECAST_METHODS}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return g.forecast}})}),Be("packages/core/src/source/rows.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_ROW_HEIGHT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"KEY_SEP",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"groupPrefixKeys",{enumerable:!0,get:function(){return g}});const M=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/internal/predicates.js").isFunction,x=32,q="\0";function W(i){return new I(i)}class I{#e;#t;constructor(t){this.#e=F(t&&t.rowKey)?t.rowKey:null;const o=t&&t.config?t.config.rowHeight:void 0;this.#t=typeof o=="number"||F(o)?o:x}get keyed(){return this.#e!==null}keyOf(t,o){if(this.#e){const c=this.#e(t);if(c!=null)return String(c)}else M("source.rowKey.missing","no config.rowKey; falling back to index identity.","Row changes, streaming dedupe, selection persistence and remote reload are disabled.");return`#${o}`}heightOf(t){return F(this.#t)?Number(this.#t(t))||x:this.#t}leaf(t,o,c=0,f=null){const n={key:this.keyOf(t,o),data:t,level:c,parent:f,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:o};return n.height=this.heightOf(n),n}group(t){const o={key:l(t.keyPath||t.path),data:null,level:t.level,parent:t.parent||null,children:[],group:!0,expanded:t.expanded!==!1,leafCount:t.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:t.column,groupValue:t.value,groupPath:t.path,hasChildren:t.hasChildren!==!1};return t.totals&&(o.totals=t.totals),o.height=this.heightOf(o),o}footer(t){const o={key:`${t.key}${q}footer`,data:null,level:t.level,parent:t,group:!0,footer:!0,expanded:!1,leafCount:t.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:t.groupColumn,groupValue:t.groupValue,groupPath:t.groupPath,hasChildren:!1,totals:t.totals};return o.height=this.heightOf(o),o}detail(t,o){return{key:`${t.key}${q}detail`,data:t.data,level:t.level+1,parent:t,group:!1,detail:!0,expanded:!1,leafCount:0,height:o,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:t.key}}grandTotal(t,o){const c={key:`${q}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:o,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:t};return c.height=this.heightOf(c),c}skeleton(t,o=0,c=!1){const f={key:`${q}pending${q}${t}`,data:null,level:o,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:t,selected:!1,physical:null,pending:!0};return c&&(f.loadError=!0),f.height=this.heightOf(f),f}}function K(i,t,o,c){return{key:`${q}pinned${q}${o}${q}${t}`,data:i,level:0,parent:null,group:!1,expanded:!1,leafCount:0,height:c,index:null,selected:!1,physical:null,hasChildren:!1,pinned:o}}function R(i,t){return new Proxy([],{get(o,c,f){if(c==="length")return i();if(typeof c=="string"){const n=Number(c);if(Number.isInteger(n)&&n>=0)return t(n)}return Reflect.get(o,c,f)},has(o,c){if(typeof c=="string"){const f=Number(c);if(Number.isInteger(f)&&f>=0)return f<i()}return Reflect.has(o,c)}})}function S(i){return i==null?"":String(i)}const k="";function y(i){if(i==null)return k;const t=String(i);return t.startsWith(k)?k+t:t}function l(i){const t=i||[];let o="g";for(let c=0;c<t.length;c++)o+=q+y(t[c]);return o}function g(i){const t=new Array(i.length),o=[];for(let c=0;c<i.length;c++)o.push(i[c]),t[c]=l(o);return t}}),Be("packages/core/src/source/handles.js",function(e,D){"use strict";Object.defineProperty(e,"HandleProvider",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"createHandleProvider",{enumerable:!0,get:function(){return q}});const M=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce;class x{#e;#t;#n;#r=new Map;#i=0;constructor(I,K,R){this.#e=I,this.#t=K,this.#n=M(R)?R:()=>!1}get store(){const I=this.#e.store;return I&&M(I.column)?I:null}invalidate(){this.#i++}handle(I){const K=this.store;if(K){const y=K.column(I);if(y)return y}const R=this.#r.get(I);if(R&&R.builtAt===this.#i)return R.handle;const S=this.#s(I);if(!S)return;if(K&&this.#n()){F(`source.dropped.${I}`,`column "${I}" cannot be served under ingest.dropSourceRows: it is an impure computed column (a shadow or a positional/rank column) that is never stored, so it can only be read from the caller's row objects — which dropSourceRows has released. Do not sort, filter, group or total on such a column with dropSourceRows enabled.`);return}const k=this.#o(S);return this.#r.set(I,{handle:k,builtAt:this.#i}),k}#s(I){const K=this.#e.columns;return K&&M(K.get)?K.get(I):void 0}#o(I){const K=this.#t()||[],R=K.length,S=new Array(R),k=M(I.getValue)?l=>I.getValue(l):l=>l?.[I.field||I.id];for(let l=0;l<R;l++)S[l]=K[l]===void 0?void 0:k(K[l]);const y=this.#i;return{id:I.id,kind:"object",nullable:!1,values:S,presence:null,dict:null,offsets:null,get(l){return S[l]},version:y}}}function q(W,I,K){return new x(W,I,K)}}),Be("packages/core/src/compute/incremental.js",function(e,D){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return K}});const M=D("packages/core/src/store/columnstore.js").toFloat,G=Object.freeze(["sum","avg","countValues","min","max"]),F=Object.freeze(["float64"]),x=1e15;function q(R,S){return typeof R!="string"||!G.includes(R)?!1:!!S&&F.includes(S.kind)}function W(R){if(R==null)return null;const S=M(R);return Number.isNaN(S)?null:S}class I{#e;#t=0;#n=0;#r=0;#i=1/0;#s=-1/0;#o=!1;#l=!1;constructor(S){this.#e=S}get valid(){return this.#o&&!this.#l}get fn(){return this.#e}seed(S){this.#a();for(let k=0;k<S.length;k++){const y=W(S[k]);y!==null&&this.#c(y)}this.#o=!0}seedColumn(S,k,y){this.#a();for(let l=0;l<y.length;l++){const g=y[l];if(k&&k(g)===0)continue;const i=S[g];Number.isNaN(i)||this.#c(i)}this.#o=!0}#a(){this.#t=0,this.#n=0,this.#r=0,this.#i=1/0,this.#s=-1/0,this.#l=!1}#c(S){if(!Number.isFinite(S)){this.#l=!0;return}const k=this.#t+S;this.#n+=Math.abs(this.#t)>=Math.abs(S)?this.#t-k+S:S-k+this.#t,this.#t=k,this.#r++,S<this.#i&&(this.#i=S),S>this.#s&&(this.#s=S)}#u(S){const k=this.#t-S;this.#n+=Math.abs(this.#t)>=Math.abs(S)?this.#t-k-S:-S-k+this.#t,this.#t=k,this.#r--}update(S,k){if(!this.#o)return!1;const y=W(S),l=W(k);return y===null&&l===null?!0:y!==null&&!Number.isFinite(y)||l!==null&&!Number.isFinite(l)?!1:this.#e==="min"||this.#e==="max"?y===null||l===null?!1:this.#e==="min"?l<this.#i?(this.#i=l,!0):y>this.#i:l>this.#s?(this.#s=l,!0):y<this.#s:Math.abs(this.#t)>x?!1:(y!==null&&this.#u(y),l!==null&&this.#c(l),!0)}value(){switch(this.#e){case"countValues":return this.#r;case"avg":return this.#r?(this.#t+this.#n)/this.#r:null;case"min":return this.#r?this.#i:null;case"max":return this.#r?this.#s:null;default:return this.#t+this.#n}}invalidate(){this.#o=!1}}const K=I}),Be("packages/core/src/source/filterwire.js",function(e,D){"use strict";Object.defineProperty(e,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"resolveRelativeRange",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"relativeTokenOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"relativeTokenHelp",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"isResolvableRelative",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"resolveRelativeCondition",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"forEachCondition",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"mapConditions",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"normaliseFilterSet",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"buildFilterSet",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"wireFilters",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"querySignature",{enumerable:!0,get:function(){return v}});const M=D("packages/core/src/internal/warn.js").warnOnce,G="source.remote.hostFilter",F="source.where.pageRelative";function x(V,Y){!Array.isArray(V)||!V.length||M(F,`filters.where (${V.join(", ")}) runs over the rows the ${Y} source fetched,`,"not the whole dataset: match counts and totals are page-relative.","Give the predicate a { condition } twin so the engine can narrow the fetch itself.")}function q(V){const Y=(V||{}).config;!Y||!Y.hostFilter||M(G,"config.hostFilter is not sent to a server-delegated source (paged/remote) and is not applied:","filtering only the fetched window would give wrong counts and totals.","Express the filter as a FilterSet condition, or send it through config.context.")}const W="source.where.notApplied";function I(V,Y){M(`${W}:${V}`,`filters.where("${V}") is registered but the ${Y} source holds only its fetched window`,"and cannot run the predicate over it: the predicate is not applied there, and rows it would","exclude stay on screen.","Give it a { condition } twin so the engine can narrow the fetch itself — that is the","supported route for a paged or remote source.")}const K="source.where.overThreshold";function R(V,Y,$,j){!Array.isArray(V)||!V.length||M(`${K}:${Y}`,`filters.where (${V.join(", ")}) is not applied to the ${Y} pushdown source:`,$===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${$.toLocaleString()} rows, at or past the whereRowLimit of ${j.toLocaleString()}.`,"Running the predicate needs every matching row fetched and held here, which is the whole","download a pushdown source exists to avoid, so it is refused and the rows the predicate","would exclude stay on screen.","Give the predicate a { condition } twin so the engine narrows the fetch itself — that is the","route that works at any size — or raise `whereRowLimit` on the source config if you want the","download.")}const S=new Map;function k(V){let Y=S.get(V);return Y||(Y=new Intl.DateTimeFormat("en-US",{timeZone:V,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),S.set(V,Y)),Y}function y(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function l(V,Y){const $=k(Y).formatToParts(new Date(V)),j={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const E of $)E.type==="year"?j.y=+E.value:E.type==="month"?j.m=+E.value:E.type==="day"?j.d=+E.value:E.type==="hour"?j.h=+E.value%24:E.type==="minute"?j.mi=+E.value:E.type==="second"&&(j.s=+E.value);return j}function g(V,Y){const $=l(V,Y);return Date.UTC($.y,$.m-1,$.d,$.h,$.mi,$.s)-Math.floor(V/1e3)*1e3}function i(V,Y,$,j){const E=Date.UTC(V,Y-1,$),O=E-g(E,j);return E-g(O,j)}function t(V,Y,$){const j=new Date(Date.UTC(V.y,V.m-1,V.d+Y));return i(j.getUTCFullYear(),j.getUTCMonth()+1,j.getUTCDate(),$)}const o=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function c(V,Y){if(typeof V!="string")return null;const $=V.trim().toLowerCase().replace(/[\s_-]+/g,""),j=/^last(\d*|n)days?$/.exec($);if(j){const E=j[1]==="n"?"":j[1],O=Number(E||Y);return!Number.isFinite(O)||O<=0?null:{kind:"lastNDays",n:Math.floor(O)}}switch($){case"today":return{kind:"today",n:0};case"yesterday":return{kind:"yesterday",n:0};case"thisweek":return{kind:"thisWeek",n:0};case"thismonth":return{kind:"thisMonth",n:0};case"thisquarter":return{kind:"thisQuarter",n:0};case"thisyear":return{kind:"thisYear",n:0};case"quartertodate":case"qtd":return{kind:"quarterToDate",n:0};case"yeartodate":case"ytd":return{kind:"yearToDate",n:0};default:return null}}function f(V,Y={}){const $=c(V,Y.n);if(!$)return null;const j=Y.tz||y(),E=Y.now instanceof Date?Y.now.getTime():typeof Y.now=="number"?Y.now:Date.now(),O=l(E,j),N=i(O.y,O.m,O.d,j),T=t(O,1,j);let C=N,B=T;switch($.kind){case"today":break;case"yesterday":C=t(O,-1,j),B=N;break;case"lastNDays":B=Y.includeToday?T:N,C=t(O,Y.includeToday?-($.n-1):-$.n,j);break;case"thisWeek":{const z=Number.isFinite(Y.weekStartsOn)?Number(Y.weekStartsOn):1,Q=(new Date(Date.UTC(O.y,O.m-1,O.d)).getUTCDay()-z+7)%7;C=t(O,-Q,j),B=t(O,-Q+7,j);break}case"thisMonth":C=i(O.y,O.m,1,j),B=i(O.m===12?O.y+1:O.y,O.m===12?1:O.m+1,1,j);break;case"thisQuarter":case"quarterToDate":{const z=Math.floor((O.m-1)/3)*3+1;C=i(O.y,z,1,j),B=$.kind==="quarterToDate"?T:z===10?i(O.y+1,1,1,j):i(O.y,z+3,1,j);break}case"thisYear":case"yearToDate":C=i(O.y,1,1,j),B=$.kind==="yearToDate"?T:i(O.y+1,1,1,j);break;default:return null}return{from:new Date(C).toISOString(),to:new Date(B).toISOString(),bounds:"[)",tz:j,relative:$.kind==="lastNDays"?`last${$.n}Days`:$.kind,n:$.n}}function n(V){if(!V||typeof V!="object")return null;const Y=V.value;if(Y&&typeof Y=="object"&&!Array.isArray(Y)&&"relative"in Y)return{token:String(Y.relative),n:typeof Y.n=="number"?Y.n:void 0};if(V.op==="relative"&&typeof V.value=="string")return{token:V.value,n:void 0};const $=V.meta;return $&&typeof $.relative=="string"&&V.value===void 0?{token:$.relative,n:typeof $.n=="number"?$.n:void 0}:null}function m(){return`Known tokens: ${o.filter(Y=>Y!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function r(V){const Y=n(V);return Y?c(Y.token,Y.n)!==null:!1}function s(V,Y={}){const $=n(V);if(!$)return V;const j=f($.token,{...Y,n:$.n});return j?{...V,type:V.type||"date",op:"between",value:[j.from,j.to],bounds:V.bounds||j.bounds,meta:{...V.meta||{},relative:j.relative,tz:j.tz}}:(M(`source.relative.${$.token}`,`unknown relative date token "${$.token}"; sending the condition unresolved.`,m()),V)}function d(V){return!!V&&typeof V=="object"&&Array.isArray(V.conditions)}function p(V,Y){if(V){if(d(V)){for(const $ of V.conditions)p($,Y);return}Y(V)}}function u(V,Y){if(!V)return null;if(!d(V))return Y(V);const $=V;let j=!1;const E=[];for(const O of $.conditions){const N=u(O,Y);N!==O&&(j=!0),N&&E.push(N)}return!j&&E.length===$.conditions.length?V:E.length?{...$,conditions:E}:null}function b(V){if(!V)return null;if(!d(V))return V;const Y=V,$=[];for(const j of Y.conditions){const E=b(j);E&&$.push(E)}return $.length?{op:Y.op,conditions:$}:null}function a(V){const Y=b(V);return Y?d(Y)&&Y.op==="and"?Y:{op:"and",conditions:[Y]}:null}function h(V){const Y=(V||[]).filter(Boolean);return Y.length?{op:"and",conditions:Y}:null}function w(V,Y={}){const $=u(V,j=>s(j,Y));return a($)}function v(V){const Y=A(V.filters??null);return JSON.stringify([Y,V.sort??null,V.quick??"",V.groupBy??null,V.pivotBy??null,_(V.context)])}function A(V){if(!V)return null;if(d(V)){const j=V;return{op:j.op,conditions:j.conditions.map(A)}}const Y=V,$=Y.meta&&typeof Y.meta.relative=="string"?Y.meta.relative:n(Y)?.token;return{col:Y.col,op:Y.op,bounds:Y.bounds??null,caseSensitive:Y.caseSensitive??!1,value:$?`rel:${$}`:Y.value??null}}function _(V){if(V==null)return null;try{return JSON.parse(JSON.stringify(V))}catch{return M("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),Be("packages/core/src/source/tree.js",function(e,D){"use strict";Object.defineProperty(e,"SYNTHETIC",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"buildFromPath",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"assignLevels",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"resolveTree",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"buildTree",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"indexTree",{enumerable:!0,get:function(){return l}});const M=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce,x="",q="\0tree:";function W(g,i){return{physical:g,key:i,level:0,children:[],value:void 0}}function I(g,i){const t=[],o=new Map;for(let c=0;c<g.length;c++){const f=g[c],n=i.pathOf(f),m=Array.isArray(n)?n.map(s=>String(s)):[];if(!m.length){const s=W(f,i.keyOf(f));t.push(s);continue}let r=null;for(let s=0;s<m.length;s++){const d=m.slice(0,s+1).join(x),p=s===m.length-1;let u=o.get(d);u&&p&&u.physical===-1&&(u.physical=f,u.key=i.keyOf(f)),u||(u=W(p?f:-1,p?i.keyOf(f):q+d),u.level=s,u.value=m[s],o.set(d,u),r?r.children.push(u):t.push(u)),r=u}}return{roots:t,nodes:o}}function K(g,i){const t=new Map,o=[];for(let m=0;m<g.length;m++){const r=g[m],s=i.keyOf(r),d=W(r,s);t.set(s,d);const p=i.parentOf(r);p!=null&&p!==""&&o.push({node:d,parent:String(p)})}let c=null;const f=new Map;for(const{node:m,parent:r}of o){const s=t.get(r);if(s){f.set(m.key,s);continue}i.orphans&&i.orphans!=="root"&&(c||(c=W(-1,`${q}orphans`),c.value=i.orphans),f.set(m.key,c))}const n=[];for(const m of t.values()){const r=f.get(m.key);r?r.children.push(m):n.push(m)}return c&&c.children.length&&n.push(c),{roots:R(n,t,i.orphans,c),nodes:t}}function R(g,i,t,o){const c=new Set,f=[...g];for(;f.length;){const d=f.pop();if(!c.has(d.key)){c.add(d.key);for(const p of d.children)f.push(p)}}const n=[];for(const d of i.values())c.has(d.key)||n.push(d);if(!n.length)return g;const m=!!t&&t!=="root";F("tree.cycle",`tree.parentKey produced ${n.length} row(s) inside a parent cycle; `+(m?`they are shown under "${t}".`:"they are shown at the root."));for(const d of n)d.children=d.children.filter(p=>c.has(p.key));if(!m)return[...g,...n];let r=o;const s=[...g];return r||(r=W(-1,`${q}orphans`),r.value=t,s.push(r)),r.children.push(...n),s}function S(g){let i=0;const t=(o,c)=>{for(const f of o)f.level=c,c>i&&(i=c),f.children.length&&t(f.children,c+1)};return t(g,0),i}function k(g,i){if(!g||typeof g!="object")return null;const t=g.path,o=g.parentKey,c=M(g.hasChildren)?f=>!!g.hasChildren(i.dataAt(f)):null;if(M(t))return{mode:"path",pathOf:f=>t(i.dataAt(f)),keyOf:i.keyOf,declaresChildren:c};if(o!=null){const f=M(o)?o:n=>n?.[o];return{mode:"parentKey",parentOf:n=>f(i.dataAt(n)),keyOf:i.keyOf,orphans:g.orphans||"root",declaresChildren:c}}return F("tree.shape","tree is configured with neither `path` nor `parentKey`; rows stay flat."),null}function y(g,i){const t=i.mode==="path"?I(g,i):K(g,i),o=S(t.roots);return{...t,depth:o}}function l(g,i){const t=new Map,o=c=>{for(let f=0;f<c.length;f++){const n=c[f];if(n.physical>=0){const m=i?i(n.physical):!1,r=m&&n.children.length===0;t.set(n.physical,{level:n.level,posinset:f+1,setsize:c.length,hasChildren:n.children.length>0||m,lazy:r})}n.children.length&&o(n.children)}};return o(g),t}}),Be("packages/core/src/source/settle.js",function(e,D){"use strict";Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return M}});const re=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function M(G){const F=G&&typeof G=="object"?G.reason:null;return typeof F=="string"&&re.includes(F)}}),Be("packages/core/src/source/memory.js",function(e,D){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"quickMatcher",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"MemorySource",{enumerable:!0,get:function(){return Q}});const M=D("packages/core/src/internal/lru.js").Lru,G=D("packages/core/src/internal/warn.js"),F=G.warnOnce,x=G.fail,W=D("packages/core/src/internal/predicates.js").isFunction,K=D("packages/core/src/internal/compare.js").defaultCompare,S=D("packages/core/src/internal/merge.js").mergeRow,k=D("packages/core/src/source/rows.js"),y=k.createRowFactory,l=k.groupKey,g=k.groupPathElement,i=k.groupPrefixKeys,t=k.lazyRowView,c=D("packages/core/src/source/handles.js").createHandleProvider,f=D("packages/core/src/compute/incremental.js"),n=f.RunningTotal,m=f.isIncremental,s=D("packages/core/src/compute/handle.js").presenceReader,d=D("packages/core/src/source/filterwire.js"),p=d.querySignature,u=d.mapConditions,b=d.resolveRelativeCondition,a=D("packages/core/src/source/tree.js"),h=a.buildTree,w=a.resolveTree,v=a.indexTree,A=D("packages/core/src/source/settle.js"),_=A.PIPELINE_SETTLE_REASONS,V=A.isPipelineSettle,Y=Object.freeze(["filter","sort","group","total","pivot","flatten"]),$=Object.freeze([]);function j(H,L){if(!H)return null;const Z=L==="grand"?H.grandTotal:H.groupTotal;return Z??H.total}function E(H){return!!H&&!H.running}function O(H){if(H)return H.value&&W(H.value.compare)?H.value.compare:W(H.compare)?H.compare:void 0}function N(H){const L=H&&H.dataType;return!L||!W(L.items)?null:{items:L.items,type:H.itemType&&H.itemType.name||"text"}}function T(H){return!!H&&(typeof H=="object"||typeof H=="function")&&W(H.then)}const C=new Uint32Array(0),B=4096;function z(H,L){return new Q(H,L)}function X(H,L){if(L==="regex")try{const Z=new RegExp(H,"iu");return ee=>Z.test(ee)}catch{return Z=>Z.includes(H)}if(L==="fuzzy"){const Z=[...H].filter(ee=>ee!==" ");return Z.length?ee=>{let te=0;for(let se=0;se<ee.length&&te<Z.length;se++)ee[se]===Z[te]&&te++;return te===Z.length}:()=>!0}if(L==="words"){const Z=H.split(/\s+/).filter(Boolean);return Z.length?ee=>Z.every(te=>ee.includes(te)):()=>!0}return Z=>Z.includes(H)}class Q{mode="memory";#e;#t;#n;#r=!1;#i=null;#s;#o;#l=new Map;#a=!1;#c=0;#u=0;#f=new Map;#d=new Map;#h;#p=null;#m=Q.#g();static#g(){return{slots:[],groupHeadings:$,unnumbered:$,pivot:null,inlineLeaves:null,matchCount:0,grand:null,grandLeaves:0,groupLeaves:null}}#b=new Map;#y=null;#O=new Map;#w=-1;#A=[];#v=new Map;#C=-1;#S=[];#P=null;#E=null;#T=null;#M=null;#N=null;#R=null;#F=null;#V=null;#W=Symbol("unset");#L=new Map;#q=null;get#B(){return this.#m.slots}set#B(L){this.#m.slots=L}get#Y(){return this.#m.inlineLeaves}set#Y(L){this.#m.inlineLeaves=L}get#G(){return this.#m.groupHeadings}set#G(L){this.#m.groupHeadings=L}get#D(){return this.#m.unnumbered}set#D(L){this.#m.unnumbered=L}get#_(){return this.#m.pivot}set#_(L){this.#m.pivot=L}constructor(L,Z){this.#t=L||{mode:"memory"},this.#e=Z||{};const ee=this.#e.config||{};this.#n=this.#t.rows||ee.rows||[],this.#s=y(this.#e),this.#o=c(this.#e,()=>this.#n,()=>this.#r),this.#h=new M(Number(ee.rowCacheSize)||B);for(const te of Y)this.#l.set(te,{key:null,result:null,id:0,computed:!1})}count(){this.#U();const L=this.#ye();return L?L.length:this.#B.length}#ye(){const L=Number(this.#z("pageSize",0))||0;if(L<=0)return null;const Z=this.#B.length,ee=Math.max(1,Math.ceil(Z/L)),se=Math.min(Math.max(0,Number(this.#z("page",0))||0),ee-1)*L;return{offset:se,length:Math.max(0,Math.min(L,Z-se))}}pageInfo(){this.#U();const L=Number(this.#z("pageSize",0))||0,Z=this.#B.length;if(L<=0)return{page:0,pageSize:0,total:Z,pageCount:1};const ee=Math.max(1,Math.ceil(Z/L));return{page:Math.min(Math.max(0,Number(this.#z("page",0))||0),ee-1),pageSize:L,total:Z,pageCount:ee}}totalCount(){return this.#j().length}matchCount(){return this.#U(),this.#m.matchCount}at(L){this.#U();const Z=this.#ye();if(Z)return L<0||L>=Z.length?void 0:this.#Ee(Z.offset+L,L);if(!(L<0||L>=this.#B.length))return this.#Ee(L,L)}byKey(L){this.#U(),this.#p||this.#ie();const Z=this.#p.get(L);if(Z!==void 0)return this.#ae(Z);for(let ee=0;ee<this.#B.length;ee++){const te=this.#B[ee];if(typeof te!="number"&&te&&te.key===L)return this.#Ee(ee)}}loaded(L){return L>=0&&L<this.count()}hint(L,Z){}display(){return this.#U(),this.#q||(this.#q=this.#Fe()),this.#q}invalidateQuickText(){this.#L.clear(),this.invalidate("filter")}invalidate(L){const Z=Y.indexOf(L);Z<0&&x(`unknown pipeline stage "${L}"; expected one of ${Y.join(", ")}`);for(let ee=Z;ee<Y.length;ee++){const te=this.#l.get(Y[ee]);te.key=null,te.computed=!1}this.#q=null}apply(L){const Z=[],ee={added:[],updated:[],removed:[],rejected:Z};if(!L)return ee;let te=!1;const se=new Set;if(L.remove&&L.remove.length)for(const ne of L.remove){const ae=this.#xe(ne);if(ae===void 0){Z.push({operation:"remove",id:this.#me(ne),reason:"unknown-id"});continue}ee.removed.push(this.#s.keyOf(this.#r?this.#Ce(ae):this.#n[ae],ae)),this.#r||(this.#n[ae]=void 0),this.#h.delete(ae),this.#L.delete(ae),te=!0}if(L.update&&L.update.length){const ne=this.#O.size||this.#vt()?this.#Ge():null,ae=this.#v.size?this.#lt():null,de=ae&&ae.length?this.#Ge():null;for(const le of L.update){const be=this.#xe(le);if(be===void 0){Z.push({operation:"update",id:this.#Me(le),reason:"unknown-id"});continue}const Ce=this.#r?this.#i&&this.#i.has(be)?this.#i.get(be):this.#Ce(be):this.#n[be],Ne=S(Ce,le);for(const he of this.#$e(Ce,Ne))se.add(he);if(this.#r||(this.#n[be]=Ne),ne&&this.#Je(ne,be,Ce,Ne),de&&this.#yt(ae,de,be,Ce,Ne),this.#p){const he=this.#s.keyOf(Ce,be),ie=this.#s.keyOf(Ne,be);he!==ie&&(this.#p.delete(he),this.#p.set(ie,be))}this.#h.delete(be),this.#L.delete(be),ee.updated.push(this.#ae(be))}}if(L.add&&L.add.length&&this.#r){typeof L.at=="number"&&L.at<this.#ct()&&(this.#h.clear(),this.#L.clear()),this.#p=null;for(const ne of L.add){const ae=this.#je(this.#Me(ne));ae!==void 0&&ee.added.push(this.#ae(ae))}te=!0}else if(L.add&&L.add.length){let ne=typeof L.at=="number"?L.at:this.#n.length;if(ne<this.#n.length){let le=0;for(let be=0;be<this.#n.length;be++)this.#n[be]!==void 0&&le++;if(le!==this.#n.length){let be=0;for(let Ce=0;Ce<this.#n.length;Ce++)this.#n[Ce]!==void 0&&(this.#n[be++]=this.#n[Ce]);this.#n.length=be,this.#p=null,this.#h.clear(),this.#L.clear()}}const ae=this.#n.length;ne=Math.max(0,ne);let de=L.add===this.#n?L.add.slice():L.add;if(this.#s.keyed){const le=[];for(const be of de){const Ce=this.#Me(be);if(this.#xe(Ce)!==void 0){Z.push({operation:"add",id:Ce,reason:"duplicate-id"});continue}le.push(be)}le.length!==de.length&&(de=le)}if(!de.length)return ee;if(ne>=ae)for(let le=0;le<de.length;le++)this.#n.push(de[le]);else this.#n.splice(ne,0,...de),this.#h.clear(),this.#L.clear();for(let le=0;le<de.length;le++)ee.added.push(this.#ae(ne>=ae?ae+le:ne+le));te=!0}return this.#c++,te&&(this.#p=null,this.#Ze()),this.#o.invalidate(),this.#q=null,te||this.#H(se)?(this.#u++,this.invalidate("filter")):this.invalidate("total"),this.#ut("rows:changed",{companion:!0,added:ee.added.length,updated:ee.updated.length,removed:ee.removed.length}),this.#i=null,ee}groupHeadingsAt(L){this.#U();const Z=this.#G;if(!Z.length||!Number.isInteger(L)||L<0)return $;let ee=0,te=Z.length-1,se=-1;for(;ee<=te;){const ae=ee+te>>1;Z[ae].at<=L?(se=ae,ee=ae+1):te=ae-1}if(se<0)return $;const ne=[];for(let ae=Z[se].row;ae;ae=ae.parent)ne.push(ae);return ne.reverse(),ne}unnumberedRowCount(L){this.#U();const Z=this.#D;if(!Z.length||!Number.isInteger(L)||L<0)return 0;let ee=0,te=Z.length-1,se=-1;for(;ee<=te;){const ne=ee+te>>1;Z[ne].at<=L?(se=ne,ee=ne+1):te=ne-1}return se+1}moveRow(L,Z){if(this.#r)return F("source.moveRow.dropped","rows.move() is not supported under ingest.dropSourceRows: the source objects have been released and the store cannot reorder its columns in place. Enable retainSource (leave dropSourceRows off) to reorder rows."),!1;const ee=this.#n;if(!Number.isInteger(L)||!Number.isInteger(Z))return!1;let te=0;for(let ae=0;ae<ee.length;ae++)ee[ae]!==void 0&&te++;if(L<0||L>=te)return!1;const se=Math.max(0,Math.min(te-1,Z));if(se===L)return!1;if(te!==ee.length){let ae=0;for(let de=0;de<ee.length;de++)ee[de]!==void 0&&(ee[ae++]=ee[de]);ee.length=ae}const[ne]=ee.splice(L,1);return ee.splice(se,0,ne),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#L.clear(),this.#Ze(),this.#o.invalidate(),this.#q=null,this.invalidate("filter"),this.#ut("rows:changed",{companion:!0,added:0,updated:0,removed:0,moved:1}),!0}reload(L){this.#ce(),this.#c++,this.#u++,this.#p=null,this.#L.clear(),this.#h.clear(),this.#Ze(),this.#o.invalidate(),this.invalidate("filter"),this.#ut("model:changed",{reason:"reload"})}destroy(){this.#ce(),this.#h.clear(),this.#L.clear(),this.#p=null,this.#B=[],this.#Y=null,this.#q=null,this.#Ze();for(const L of Y)this.#l.set(L,{key:null,result:null,id:0,computed:!1})}#ce(){for(const{controller:L}of this.#b.values())try{L.abort()}catch{}this.#b.clear()}setRows(L){this.#n=L||[],this.#r=!1,this.#c++,this.#u++,this.#p=null,this.#L.clear(),this.#h.clear(),this.#Ze(),this.#o.invalidate(),this.invalidate("filter")}notePriorRows(L){this.#i=L||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#L.clear(),this.#o.invalidate()}data(){if(!this.#r)return this.#n;const L=this.#e.store;if(!L||!W(L.source))return this.#n;const Z=L.physical||0,ee=new Array(Z);for(let te=0;te<Z;te++)ee[te]=L.live&&!L.live(te)?void 0:L.source(te);return ee}#ue(){const L=this.#z("detail",null);return!L||!W(L.isOpen)||L.inline===!1?null:L}#Ne(){const L=(this.#e.config||{}).tree;return this.#W!==L&&(this.#W=L,this.#V=w(L,{dataAt:Z=>this.#Ce(Z),keyOf:Z=>this.#s.keyOf(this.#Ce(Z),Z)})),this.#V}#se(){return(this.#e.config||{}).grandTotalRow==="bottom"}grandTotalRow(){if(!this.#se())return null;this.#U();const L=this.#m.grand;return L?this.#s.grandTotal(L,this.#qe(this.#m.grandLeaves)):null}pivot(){return this.#U(),this.#_}pivotMatrix(){this.#U();const L=this.#m.groupLeaves,Z=(this.#e.compute||{}).pivotMatrix;if(!W(Z))return null;const ee=this.#z("groupBy",[]),te=this.#z("pivotBy",[]);if(!ee.length&&!te.length)return F("pivotView.no-dimension","pivotView is on but the grid has no pivot dimension, so there is no matrix to draw. Put a column on the pivot (its `pivot` setting, or `pivotBy` in the query) for the columns across the top, and group by a column for the rows down the side."),null;const se=this.#Ge().map(ae=>({colId:ae.id,handle:this.#o.handle(ae.id),fn:j(ae,"group")})).filter(ae=>ae.handle&&ae.fn),ne=this.#e.config||{};return Z({rowHandles:ee.map(ae=>this.#o.handle(ae)).filter(Boolean),columnHandles:te.map(ae=>this.#o.handle(ae)).filter(Boolean),measures:se,leaves:L||new Uint32Array(0),opts:{locale:ne.locale,separator:(ne.pivot||{}).separator,maxColumns:(ne.pivot||{}).maxColumns}})}keysForLeaves(L){const Z=[];if(!L)return Z;for(let ee=0;ee<L.length;ee++){const te=this.#ae(L[ee]);te&&te.key!=null&&Z.push(String(te.key))}return Z}leavesOf(L){this.#U();const Z=this.#l.get("group"),ee=Z&&Z.result;if(!ee||!ee.nodes)return[];const te=ee.nodes.get(L);if(!te)return[];const se=[],ne=ae=>{const de=ae.row&&ae.row.children;if(de&&de.length){for(const le of de){const be=ee.nodes.get(le.key);be&&ne(be)}return}if(ae.leaves)for(let le=0;le<ae.leaves.length;le++)se.push(this.#ae(ae.leaves[le]))};return ne(te),se}#me(L){return typeof L=="string"?L:this.#Me(L)}#Me(L){try{return this.#s.keyOf(L,-1)}catch{return"(unkeyed)"}}#xe(L){if(typeof L=="string")return this.#je(L);if(this.#s.keyed){const ee=this.#s.keyOf(L,-1),te=this.#je(ee);if(te!==void 0)return te}if(this.#r)return;const Z=this.#n.indexOf(L);return Z>=0?Z:void 0}#je(L){return this.#p||this.#ie(),this.#p.get(L)}#ie(){this.#p=new Map;const L=this.#ct(),Z=this.#e.store,ee=Z&&W(Z.live)?te=>Z.live(te):null;for(let te=0;te<L;te++){if(ee&&!ee(te))continue;const se=this.#Ce(te);se!==void 0&&this.#p.set(this.#s.keyOf(se,te),te)}}#$e(L,Z){const ee=[];for(const te of this.#Q())this.#Ke(te)&&this.#oe(te,L,Z,new Set)&&ee.push(te);return ee}#oe(L,Z,ee,te){if(te.has(L))return!1;te.add(L);const se=this.#Ke(L);if(!se)return!1;const ne=se.value&&se.value.deps;return Array.isArray(ne)&&ne.length?ne.some(ae=>this.#oe(String(ae),Z,ee,te)):W(se.getValue)?!Object.is(se.getValue(Z),se.getValue(ee)):!1}#Q(){const L=new Set;for(const ee of this.#z("sort",[]))L.add(ee.col);for(const ee of this.#z("groupBy",[]))L.add(ee);const Z=ee=>{if(ee){if(Array.isArray(ee.conditions)){ee.conditions.forEach(Z);return}ee.col&&L.add(ee.col)}};return Z(this.#z("filters",null)),[...L]}#H(L){if(!L.size)return!1;if(this.#z("quick",""))return!0;for(const Z of this.#Q())if(L.has(Z))return!0;return!1}#U(){if(!this.#a){this.#a=!0;try{this.#J()}finally{this.#a=!1}}}pipelineRunning(){return this.#a}#J(){const L=this.#pe("filter",()=>this.#Z(),()=>this.#k()),Z=this.#fe(L),ee=this.#pe("group",()=>this.#K(),()=>this.#Ve(Z)),te=this.#pe("total",()=>this.#I(),()=>this.#Xe(ee));this.#pe("pivot",()=>this.#ve(),()=>this.#kt(ee)),this.#pe("flatten",()=>this.#Ae(),()=>this.#Mt(ee)),this.#he(ee,te)}#fe(L){const Z=this.#l.get("sort"),ee=this.#ne();if(Z.computed&&Z.key===ee&&!this.#b.has("sort"))return Z.result;const te=this.#b.get("sort");return te&&te.key===ee?Z.result:Z.result&&this.#ge(L)?(this.#ke(L,ee),Z.result):this.#pe("sort",()=>ee,()=>this.#Pe(L))}#le(){if(this.#y===null){const L=this.#e.pipelineWorker,Z=W(L)?L():null;this.#y=Z||!1}return this.#y||null}#we(){const L=this.#z("sort",[]);if(!Array.isArray(L)||!L.length)return null;const Z=(this.#e.config||{}).locale,ee=[],te=[];for(const se of L){const ne=this.#Ke(se.col);if(ne&&ne.running)continue;if(ne&&ne.value&&W(ne.value.compare))return null;const ae=this.#o.handle(se.col);if(!ae)return null;ee.push({col:se.col,descending:se.dir==="desc",nullsFirst:!!se.nullsFirst,locale:Z}),te.push(ae)}return ee.length?{entries:ee,handles:te,locale:Z}:null}#ge(L){if(this.#re())return!1;const Z=this.#le();if(!Z)return!1;const ee=Number(Z.threshold);return Number.isFinite(ee)&&L.length<ee?!1:!!this.#we()}#ke(L,Z){const ee=this.#le(),te=ee&&this.#we();if(!te){this.#pe("sort",()=>Z,()=>this.#Pe(L));return}const se=new AbortController;this.#b.set("sort",{key:Z,controller:se});const ne=te.entries.length===1?ee.sortColumn(te.handles[0],L,{descending:te.entries[0].descending,nullsFirst:te.entries[0].nullsFirst,locale:te.locale,signal:se.signal,key:"sort"}):ee.sortMulti(te.handles,te.entries.map((ae,de)=>({...ae,handle:te.handles[de]})),L,{signal:se.signal,key:"sort"});if(!T(ne)){this.#b.delete("sort"),this.#pe("sort",()=>Z,()=>ne);return}ne.then(ae=>this.#Ie(Z,ae),ae=>this.#de("sort",Z,ae))}#Ie(L,Z){const ee=this.#b.get("sort");if(!(!ee||ee.key!==L)){if(this.#ne()!==L){this.#b.delete("sort");return}this.#b.delete("sort"),this.#pe("sort",()=>L,()=>Z),this.#q=null,this.#U(),this.#ut("model:changed",{reason:_[0]})}}#de(L,Z,ee){const te=this.#b.get(L);if(!(!te||te.key!==Z)&&(this.#b.delete(L),!(ee&&ee.name==="AbortError")&&L==="sort"&&this.#ne()===Z)){const se=this.#pe("filter",()=>this.#Z(),()=>this.#k());this.#pe("sort",()=>Z,()=>this.#Pe(se)),this.#q=null,this.#U(),F("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",ee),this.#ut("model:changed",{reason:_[1]})}}#he(L,Z){const ee=L&&L.leaves?L.leaves.length:this.#m.slots.length;this.#m.matchCount=ee,this.#m.grand=Z&&Z.grand||null,this.#m.grandLeaves=L&&L.leaves?L.leaves.length:0,this.#m.groupLeaves=L&&L.leaves?L.leaves:null}#pe(L,Z,ee){const te=this.#l.get(L),se=Z();return te.computed&&te.key===se||(te.result=ee(),te.key=se,te.computed=!0,te.id++,L==="flatten"&&(this.#q=null)),te.result}#$(L){return this.#l.get(L).id}#Z(){const L=(this.#e.config||{}).hostFilter,Z=L&&W(L.active)&&L.active()?1:0,ee=this.#z("where",null),te=ee?ee.version:0,se=this.#Pt("filter.sig",`${this.#nt()}`,()=>p({filters:this.#z("filters",null),quick:this.#z("quick",""),quickMode:this.#z("quickMode","contains")}));return`${this.#u}|${se}|${Z}|${te}`}#ne(){const L=this.#re();return`${this.#$("filter")}|${JSON.stringify(this.#z("sort",[]))}`+(L?`|manual:${L.version}`:"")}#re(){const L=this.#z("rowOrder",null);return L&&Array.isArray(L.keys)?L:null}#Be(L,Z){this.#p||this.#ie();const ee=this.#p,te=this.#ct(),se=Z.keys.length,ne=new Float64Array(te);for(let ae=0;ae<te;ae++)ne[ae]=se+ae;for(let ae=0;ae<se;ae++){const de=ee.get(Z.keys[ae]);de!==void 0&&(ne[de]=ae)}return Uint32Array.from(L).sort((ae,de)=>ne[ae]-ne[de])}orderedKeys(){this.#p||this.#ie();const L=this.#p,Z=new Map;for(const[ae,de]of L)Z.set(de,ae);const ee=Uint32Array.from([...Z.keys()]).sort(),te=this.#re(),se=te?this.#Be(ee,te):this.#Pe(ee),ne=new Array(se.length);for(let ae=0;ae<se.length;ae++)ne[ae]=Z.get(se[ae]);return ne}#K(){const L=this.#z("pivotBy",[]).length>0?"p":"u";return`${this.#$("sort")}|${JSON.stringify(this.#z("groupBy",[]))}|${L}`}#I(){const L=this.#te()?"f":"a",Z=(this.#e.config||{}).totalOnlyChangedColumns?"n":"w";return`${this.#$("group")}|${JSON.stringify(this.#z("totals",[]))}|${L}${Z}|${this.#c}`}#ve(){return`${this.#$("group")}|${JSON.stringify(this.#z("pivotBy",[]))}`}#Ae(){const Z=this.#He()||!this.#se()?this.#$("total"):"x",ee=`${this.#nt()}`,te=this.#Pt("flatten.keys",ee,()=>{const ne=this.#z("expanded",null);return ne?[...ne].sort().join(""):"*"}),se=this.#Pt("flatten.detail",ee,()=>{const ne=this.#z("detail",null);return ne&&W(ne.signature)?ne.signature():""});return`${Z}|${this.#$("pivot")}|${te}|${se}`}#He(){const L=this.#z("groupBy",[]);return Array.isArray(L)&&L.length>0}stageState(){const L=[];for(const[Z,ee]of this.#l){const te=ee.result;L.push({stage:Z,materialised:!!ee.computed,bytes:te&&typeof te.byteLength=="number"?te.byteLength:null,rows:te&&typeof te.length=="number"?te.length:null,rebuilds:ee.id})}return L}facetIndices(L){return this.#k(L||null)}facetRows(L){const Z=this.facetIndices(L),ee=[];for(let te=0;te<Z.length;te++){const se=this.#ae(Z[te]);se&&ee.push(se)}return ee}invalidateRows(){this.#h.clear(),this.#L.clear(),this.#q=null}invalidateHandles(){this.#o.invalidate()}rows(){return this.#n}unfilteredIndices(){return this.#j()}filteredIndices(){const L=this.#l.get("filter");if(L&&L.computed&&L.key===this.#Z())return L.result||this.#j();this.#U();const Z=this.#l.get("filter");return(Z&&Z.computed?Z.result:null)||this.#j()}unfilteredRows(){const L=this.#j(),Z=[];for(let ee=0;ee<L.length;ee++){const te=this.#ae(L[ee]);te&&Z.push(te)}return Z}#k(L=null){const Z=this.#j(),ee=this.#z("filters",null),te=L?this.#rt("pruneColumn")(ee,L):ee,se=this.#Rt(te),ne=String(this.#z("quick","")||"").trim().toLowerCase(),ae=ne?X(ne,String(this.#z("quickMode","contains")||"contains")):null,de=(this.#e.config||{}).hostFilter,le=!!(de&&W(de.active)&&de.active()),be=this.#z("where",null),Ce=!!(be&&be.active);if(!se&&!ne&&!le&&!Ce)return Z;let Ne=null;se&&(Ne=this.#rt("evaluateFilters")(se,{handle:ge=>this.#o.handle(ge),count:this.#ct(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:ge=>N(this.#Ke(ge))}));const he=new Uint32Array(Z.length);let ie=0;for(let ue=0;ue<Z.length;ue++){const ge=Z[ue];if(!(Ne&&!Ne[ge])&&!(ae&&!this.#ot(ge,ae))){if(le||Ce){const pe=this.#ae(ge);if(le&&!de.passes(pe)||Ce&&!be.passes(pe.data,pe.key))continue}he[ie++]=ge}}if(Ne){const ue=(this.#e.compute||{}).releaseMask;W(ue)&&ue({pool:this.#e.pool},Ne)}return he.subarray(0,ie)}handleFor(L){return this.#o.handle(L)}#Pe(L){const Z=this.#re();if(Z)return this.#Be(L,Z);const ee=this.#z("sort",[]).filter(ne=>{const ae=this.#Ke(ne.col);return!ae||!ae.running?!0:(F(`source.sort.running.${ne.col}`,`sort ignores "${ne.col}": a running total is a function of the sort order, so it cannot also decide it. Sort by the column it runs over instead.`),!1)});if(!ee.length)return L;const te=(this.#e.config||{}).locale;if(ee.length===1){const ne=ee[0],ae=this.#o.handle(ne.col);if(!ae)return F(`source.sort.${ne.col}`,`sort ignores unknown column "${ne.col}".`),L;const de=this.#Ke(ne.col);return this.#rt("sortColumn")(ae,L,{descending:ne.dir==="desc",nullsFirst:ne.nullsFirst,locale:te,compare:O(de)})}const se=[];for(const ne of ee){const ae=this.#o.handle(ne.col);if(!ae){F(`source.sort.${ne.col}`,`sort ignores unknown column "${ne.col}".`);continue}se.push({handle:ae,descending:ne.dir==="desc",nullsFirst:ne.nullsFirst,locale:te,compare:O(this.#Ke(ne.col))})}return se.length?this.#rt("sortMulti")(se.map(ne=>ne.handle),se,L):L}#Ve(L){const Z=this.#z("groupBy",[]),ee=this.#Ne();if(ee&&!Z.length){const ue=h(L,ee);return this.#R=v(ue.roots,ee.declaresChildren),{roots:null,leaves:L,nodes:new Map,tree:ue}}if(this.#R=null,ee&&Z.length&&F("tree.grouped","grouping is active on a grid configured with `tree`; the grouping wins and the hierarchy is not shown."),!Z.length)return{roots:null,leaves:L,nodes:new Map};const te=(this.#e.config||{}).timeZone,se=[],ne=[];let ae=!1;for(const ue of Z){const ge=this.#o.handle(ue);if(!ge){F(`source.group.${ue}`,`grouping ignores unknown column "${ue}".`);continue}se.push(ge);const pe=this.#Ke(ue),Oe=pe&&pe.dataType;if(Oe&&W(Oe.groupProjector)){const ve=pe.typeOptions&&pe.typeOptions.timeZone||te||void 0,ye=Oe.groupProjector(pe,ve);ne.push(ye||null),ye&&(ae=!0)}else ne.push(null)}if(!se.length)return{roots:null,leaves:L,nodes:new Map};const{keys:de,buckets:le}=this.#rt("groupByColumns")(se,L,{locale:(this.#e.config||{}).locale,project:ae?ne:void 0}),be=this.#z("pivotBy",[]).length>0,Ce=[],Ne=new Map;for(let ue=0;ue<le.length;ue++){const ge=de[ue];let pe=null;const Oe=[];for(let ve=0;ve<ge.length;ve++){Oe.push(g(ge[ve]));const ye=l(Oe),Ae=ve===ge.length-1;let Me=Ne.get(ye);if(!Me){const je=this.#s.group({path:[...Oe],column:Z[ve],value:ge[ve],level:ve,parent:pe,expanded:be&&Ae?!1:this.#tt(ye,{key:ye,column:Z[ve],value:ge[ve],level:ve,path:[...Oe]}),hasChildren:!(be&&Ae)});Me={row:je,leaves:null},Ne.set(ye,Me),pe?pe.children.push(je):Ce.push(je)}Me.row.leafCount+=le[ue].length,ve===ge.length-1&&(Me.leaves=le[ue]),pe=Me.row}}const he=this.#z("sort",[])||[],ie=(ue,ge)=>{if(!ue||ue.length<2){if(ue)for(const ye of ue)ie(ye.children,ge+1);return}const pe=Z[ge],Oe=he.find(ye=>ye.col===pe),ve=Oe&&Oe.dir==="desc"?-1:1;ue.sort((ye,Ae)=>ve*K(ye.groupValue,Ae.groupValue));for(const ye of ue)ie(ye.children,ge+1)};return ie(Ce,0),{roots:Ce,leaves:L,nodes:Ne,keys:de,buckets:le}}#Ye(L,Z){const ee=new Map,te=new Map,se=ne=>{const ae=ne.physical>=0?[ne.physical]:[];for(const de of ne.children)ae.push(...se(de));if(ne.children.length){const de=this.#Qe(Z,Uint32Array.from(ae),null);ne.physical>=0?ee.set(ne.physical,de):te.set(ne.key,de)}return ae};for(const ne of L.roots)se(ne);return{byPhysical:ee,byKey:te}}#Xe(L){const Z=this.#Ge();if(!Z.length)return this.#E=null,this.#T=null,{grand:null};const ee={id:this.#$("group"),columns:Z.map(he=>he.id).join("")},te=this.#E&&this.#E.id===ee.id&&this.#E.columns===ee.columns,se=this.#vt()&&te?this.#P:null,ne=se?Z.filter(he=>se.has(he.id)):Z,ae=te?this.#T:null,de=this.#te()?null:this.#wt(),le=this.#Oe(Z),be=he=>{const ie=L.nodes.get(he.key);let ue=ie&&ie.leaves?ie.leaves:null;if(he.children&&he.children.length){const Oe=he.children.map(be);let ve=0;for(const Me of Oe)ve+=Me.length;const ye=new Uint32Array(ve);let Ae=0;for(const Me of Oe)ye.set(Me,Ae),Ae+=Me.length;ue=ye}ue=ue||new Uint32Array(0);const ge=de?de.get(he.key)||C:ue,pe=this.#ft(he,se?ne:Z,ge,le);return he.totals=se?{...he.totals,...pe}:pe,ue};if(L.roots&&ne.length)for(const he of L.roots)be(he);if(this.#F=L.tree?this.#Ye(L.tree,Z):null,this.#E=ee,this.#P=this.#vt()?new Set:null,!(this.#e.config||{}).grandTotalRow)return this.#A.length=0,this.#T=null,{grand:null};const Ne=de?this.#dt():L.leaves;return this.#T=this.#Ue(Z,Ne,se,ae),{grand:this.#T}}#Ue(L,Z,ee,te){const se={},ne=this.#$("group");ne!==this.#w&&(this.#ht(),this.#w=ne);const ae=this.#A;this.#A=[];for(const de of L){if(!E(de))continue;const le=this.#o.handle(de.id);if(!le)continue;const be=j(de,"grand");if(!m(be,le)){if(ee&&!ee.has(de.id)&&te&&de.id in te){se[de.id]=te[de.id];continue}se[de.id]=this.#Qe([de],Z,null,"grand")[de.id];continue}let Ce=this.#O.get(de.id);if((!Ce||Ce.fn!==be)&&(Ce=new n(be),this.#O.set(de.id,Ce)),Ce.valid){let Ne=!0;for(const he of ae)if(he.colId===de.id&&!Ce.update(he.before,he.after)){Ne=!1;break}if(Ne){se[de.id]=Ce.value();continue}Ce.invalidate()}Ce.seedColumn(le.values,s(le),Z),se[de.id]=Ce.valid?Ce.value():this.#Qe([de],Z,null,"grand")[de.id]}return se}#Oe(L){const Z=this.#$("group");Z!==this.#C&&(this.#v.clear(),this.#C=Z);const ee=new Map;for(const se of L){if(!E(se))continue;const ne=this.#o.handle(se.id),ae=j(se,"group");m(ae,ne)&&ee.set(se.id,{fn:ae})}if(!ee.size)return this.#S.length=0,ee;const te=this.#S;this.#S=[];for(const se of te){const{beforeKeys:ne,afterKeys:ae,colDeltas:de}=se,le=ne.length?new Set(ne):null,be=ae.length?new Set(ae):null;for(const{colId:Ce,before:Ne,after:he}of de)if(ee.has(Ce)){for(const ie of ne)be&&be.has(ie)||this.#Se(ie,Ce,Ne,null);for(const ie of ae)le&&le.has(ie)||this.#Se(ie,Ce,null,he);for(const ie of ne)be&&!be.has(ie)||this.#Se(ie,Ce,Ne,he)}}return ee}#Se(L,Z,ee,te){const se=this.#v.get(L),ne=se&&se.get(Z);!ne||!ne.valid||ne.update(ee,te)||ne.invalidate()}#ft(L,Z,ee,te){if(!te||!te.size)return this.#Qe(Z,ee,L);const se={};let ne=null,ae=this.#v.get(L.key);for(const de of Z){const le=te.get(de.id);if(!le){(ne||(ne=[])).push(de);continue}const be=this.#o.handle(de.id);if(!be)continue;ae||(ae=new Map,this.#v.set(L.key,ae));let Ce=ae.get(de.id);if((!Ce||Ce.fn!==le.fn)&&(Ce=new n(le.fn),ae.set(de.id,Ce)),Ce.valid||Ce.seedColumn(be.values,s(be),ee),Ce.valid){se[de.id]=Ce.value();continue}(ne||(ne=[])).push(de)}return ne&&Object.assign(se,this.#Qe(ne,ee,L)),se}#Je(L,Z,ee,te){const se=!this.#te()||this.#et(Z);for(const ne of L){const ae=ne.getValue;if(!W(ae))continue;const de=ae(ee),le=ae(te);Object.is(de,le)||(this.#P&&this.#P.add(ne.id),se&&this.#O.has(ne.id)&&this.#A.push({colId:ne.id,before:de,after:le}))}}#lt(){const L=this.#z("groupBy",[]),Z=[];for(const ee of L){const te=this.#Ke(ee);te&&Z.push(te)}return Z}#We(L,Z){const ee=new Array(L.length);for(let te=0;te<L.length;te++){const se=L[te].getValue;ee[te]=g(W(se)?se(Z):void 0)}return ee}#yt(L,Z,ee,te,se){if(this.#te()&&!this.#et(ee))return;const ne=i(this.#We(L,te)),ae=i(this.#We(L,se)),de=ne.length!==ae.length||ne.some((be,Ce)=>be!==ae[Ce]),le=[];for(const be of Z){const Ce=be.getValue;if(!W(Ce))continue;const Ne=Ce(te),he=Ce(se);!de&&Object.is(Ne,he)||le.push({colId:be.id,before:Ne,after:he})}!le.length&&!de||this.#S.push({beforeKeys:ne,afterKeys:ae,colDeltas:le})}#et(L){const Z=this.#l.get("filter"),ee=Z&&Z.computed?Z.result:null;if(!ee)return!0;let te=0,se=ee.length-1;for(;te<=se;){const ne=te+se>>1,ae=ee[ne];if(ae===L)return!0;ae<L?te=ne+1:se=ne-1}return!1}#te(){return(this.#e.config||{}).totalFilteredOnly!==!1}#qe(L){return this.#te()?L:this.#dt().length}#dt(){return(!this.#M||this.#M.version!==this.#u)&&(this.#M={version:this.#u,indices:this.#j()}),this.#M.indices}#wt(){const L=this.#z("groupBy",[]),Z=`${this.#u}|${JSON.stringify(L)}`;if(this.#N&&this.#N.key===Z)return this.#N.map;const ee=new Map,te=[];for(const se of L){const ne=this.#o.handle(se);ne&&te.push(ne)}if(te.length){const se=this.#dt(),{keys:ne,buckets:ae}=this.#rt("groupByColumns")(te,se,{locale:(this.#e.config||{}).locale}),de=new Map;for(let le=0;le<ae.length;le++){const be=ne[le],Ce=[];for(let Ne=0;Ne<be.length;Ne++){Ce.push(g(be[Ne]));const he=l(Ce);let ie=de.get(he);ie||(ie=[],de.set(he,ie));for(let ue=0;ue<ae[le].length;ue++)ie.push(ae[le][ue])}}for(const[le,be]of de)ee.set(le,Uint32Array.from(be))}return this.#N={key:Z,map:ee},ee}#vt(){return!!(this.#e.config||{}).totalOnlyChangedColumns}#Ze(){this.#ht(),this.#ze(),this.#P=null,this.#E=null,this.#T=null}#ht(){this.#O.clear(),this.#A.length=0,this.#w=-1}#ze(){this.#v.clear(),this.#S.length=0,this.#C=-1}#kt(L){const Z=this.#z("pivotBy",[]);if(!Z.length)return this.#_=null,null;const ee=(this.#e.compute||{}).pivot;if(!W(ee))return F("source.pivot.kernel","pivot requested but ctx.compute.pivot is not available; showing unpivoted rows."),this.#_=null,null;const te=Z.map(ne=>this.#o.handle(ne)).filter(Boolean),se=this.#Ge();return this.#_=ee(te,L.leaves,{groups:L.keys&&L.buckets?{keys:L.keys,buckets:L.buckets}:null,totals:se.map(ne=>ne.id),handle:ne=>this.#o.handle(ne),totalOf:ne=>j(se.find(ae=>ae.id===ne),"group"),separator:((this.#e.config||{}).pivot||{}).separator,maxColumns:((this.#e.config||{}).pivot||{}).maxColumns})||null,this.#_}#Mt(L){const Z=this.#l.get("total").result,ee=!!(this.#e.config||{}).groupFooter,te=this.#ue();if(L.tree)return this.#Re(L,Z,te);if(!L.roots&&!te){if(Z&&Z.grand&&!this.#se()){const be=this.#s.grandTotal(Z.grand,this.#qe(L.leaves.length));if(this.#Y===L.leaves&&Array.isArray(this.#B))this.#B[this.#B.length-1]=be;else{const Ce=Array.from(L.leaves);Ce.push(be),this.#B=Ce,this.#Y=L.leaves}this.#D=[{at:this.#B.length-1}]}else this.#Y=null,this.#B=L.leaves,this.#D=$;return this.#G=$,this.#B}const se=[],ne=[],ae=[],de=be=>{if(se.push(be),!te)return;const Ce=this.#ae(be);!Ce||!te.isOpen(Ce.key)||(Ce.master=!0,Ce.expanded=!0,ae.push({at:se.length}),se.push(this.#s.detail(Ce,te.heightOf(Ce))))};if(!L.roots){for(let be=0;be<L.leaves.length;be++)de(L.leaves[be]);return Z&&Z.grand&&!this.#se()&&(ae.push({at:se.length}),se.push(this.#s.grandTotal(Z.grand,this.#qe(L.leaves.length)))),this.#Y=null,this.#G=$,this.#D=ae.length?ae:$,this.#B=se,se}const le=(be,Ce,Ne)=>{if(be.expanded=be.hasChildren===!1?!1:this.#tt(be.key,{key:be.key,column:be.groupColumn,value:be.groupValue,level:be.level,path:be.groupPath}),be.posinset=Ce+1,be.setsize=Ne,ne.push({at:se.length,row:be}),ae.push({at:se.length}),se.push(be),!!be.expanded){if(be.children&&be.children.length)for(let he=0;he<be.children.length;he++)le(be.children[he],he,be.children.length);else{const he=L.nodes.get(be.key),ie=he&&he.leaves?he.leaves:null;if(ie)for(let ue=0;ue<ie.length;ue++)de(ie[ue])}ee&&be.totals&&(ae.push({at:se.length}),se.push(this.#s.footer(be)))}};for(let be=0;be<L.roots.length;be++)le(L.roots[be],be,L.roots.length);return Z&&Z.grand&&!this.#se()&&(ae.push({at:se.length}),se.push(this.#s.grandTotal(Z.grand,this.#qe(L.leaves.length)))),this.#G=ne,this.#D=ae,this.#B=se,se}#j(){const L=this.#e.store;if(L&&W(L.liveIndices))return L.liveIndices();const Z=new Uint32Array(this.#n.length);let ee=0;for(let te=0;te<this.#n.length;te++)this.#n[te]!==void 0&&(Z[ee++]=te);return Z.subarray(0,ee)}#ct(){const L=this.#e.store;return L&&typeof L.physical=="number"?L.physical:this.#n.length}#Ce(L){const Z=this.#e.store;return Z&&W(Z.source)?Z.source(L):this.#n[L]}#Ee(L,Z=L){const ee=this.#B[L];if(typeof ee!="number")return ee.index=Z,ee;const te=this.#ae(ee);return te.index=Z,te}#ae(L){let Z=this.#h.get(L);Z||(Z=this.#s.leaf(this.#Ce(L),L),this.#h.set(L,Z));const ee=this.#R?this.#R.get(L):null;if(ee){Z.level=ee.level,Z.posinset=ee.posinset,Z.setsize=ee.setsize,Z.hasChildren=ee.hasChildren,Z.expanded=ee.hasChildren&&!ee.lazy&&this.#tt(Z.key);const te=this.#F?this.#F.byPhysical.get(L):void 0;te?Z.totals=te:Z.totals&&(Z.totals=null)}else Z.hasChildren&&(Z.level=0,Z.hasChildren=!1,Z.expanded=!1,Z.posinset=void 0,Z.setsize=void 0);return Z}#Re(L,Z,ee){const te=[],se=[],ne=de=>{if(de.leafCount!==void 0)return de.leafCount;let le=de.physical>=0?1:0;for(const be of de.children)le+=ne(be);return de.leafCount=le,le},ae=de=>{const le=this.#tt(de.key);if(de.physical>=0){if(te.push(de.physical),ee&&ee.isOpen(this.#ae(de.physical).key)){const be=this.#ae(de.physical);se.push({at:te.length}),te.push(this.#s.detail(be,ee.heightOf(be)))}}else te.push(this.#s.group({path:[de.key],column:null,value:de.value,level:de.level,parent:null,expanded:le,hasChildren:de.children.length>0,leafCount:ne(de),totals:this.#F?this.#F.byKey.get(de.key):void 0}));if(le)for(const be of de.children)ae(be)};for(const de of L.tree.roots)ae(de);return Z&&Z.grand&&!this.#se()&&(se.push({at:te.length}),te.push(this.#s.grandTotal(Z.grand,this.#qe(L.leaves.length)))),this.#Y=null,this.#G=$,this.#D=se.length?se:$,this.#B=te,te}#Fe(){return t(()=>this.count(),L=>this.at(L))}#ot(L,Z){let ee=this.#L.get(L);if(ee===void 0){const te=this.#Ce(L),se=this.#mt(),ne=[],ae=this.#e.columnHidden;for(const de of se){if(de.quickFilter===!1||W(ae)&&ae(de.id))continue;const le=de.value&&W(de.value.quickFilterText)?de.value.quickFilterText({value:void 0,data:te,row:null,column:de,colId:de.id,grid:null,context:this.#z("context",null)}):null,be=le??(W(de.formatValue)?de.formatValue(W(de.getValue)?de.getValue(te):void 0):"");be!=null&&be!==""&&ne.push(String(be))}ee=ne.join(" ").toLowerCase(),this.#L.set(L,ee)}return Z(ee)}#Ge(){const L=this.#z("totals",[]),Z=L&&L.length?new Set(L):null;return this.#mt().filter(ee=>Z?Z.has(ee.id):!!(ee.total||ee.groupTotal||ee.grandTotal))}#Qe(L,Z,ee,te="group"){const se={},ne=(this.#e.compute||{}).total;for(const ae of L){if(!E(ae))continue;const de=this.#o.handle(ae.id);if(!de)continue;const le=j(ae,te);if(le)if(W(le)){const be=new Array(Z.length);for(let Ce=0;Ce<Z.length;Ce++)be[Ce]=de.get(Z[Ce]);se[ae.id]=le(be,{row:ee,column:ae,grid:this.#e.grid||null,context:this.#z("context",null),valueAt:(Ce,Ne)=>{const he=this.#o.handle(Ce);return he&&Ne>=0&&Ne<Z.length?he.get(Z[Ne]):null}})}else W(ne)&&(se[ae.id]=ne(de,Z,le))}return se}#Rt(L){if(!L)return L;const Z=this.#e.config||{},ee={tz:Z.timeZone,weekStartsOn:Z.weekStartsOn};return u(L,te=>{const se=b(te,ee),ne=this.#Ke(se&&se.col),ae=ne&&ne.type==="datetime";if(se&&se.type)return se.type==="datetime"&&!se.timeZone&&ne?{...se,timeZone:Z.timeZone||void 0}:se;if(ae)return{...se,type:"datetime",timeZone:Z.timeZone||void 0};const de=ne&&(ne.dataType?.base||ne.type);return de?{...se,type:de}:se})}#tt(L,Z){const ee=this.#z("expanded",null);return ee?W(ee.has)?ee.has(L,Z):Array.prototype.includes.call(ee,L):!0}#z(L,Z){if(L==="context"||!W(this.#e.stateVersion))return this.#jt(L,Z);const ee=this.#pt(L),te=this.#f.get(L);if(te&&te.version===ee)return te.value;const se=this.#jt(L,Z);return this.#f.set(L,{version:ee,value:se}),se}#jt(L,Z){const ee=this.#e.state;if(ee&&W(ee[L])){const te=ee[L]();return te??Z}return Z}#nt(){const L=this.#e.stateVersion;return W(L)?L():0}#Dt(){const L=this.#e.columnsVersion,Z=this.#e.permissionsVersion;return`${W(L)?L():0}|${W(Z)?Z():0}`}#pt(L){return L==="totals"?this.#Dt():`${this.#nt()}`}#Pt(L,Z,ee){if(!W(this.#e.stateVersion))return ee();const te=this.#d.get(L);if(te&&te.version===Z)return te.key;const se=ee();return this.#d.set(L,{version:Z,key:se}),se}#rt(L){const Z=(this.#e.compute||{})[L];return W(Z)||x(`ctx.compute.${L} is required by the memory source pipeline`),Z}#mt(){const L=this.#e.columns;return L&&W(L.all)?L.all():[]}#Ke(L){const Z=this.#e.columns;return Z&&W(Z.get)?Z.get(L):void 0}#ut(L,Z){const ee=this.#e.emit;W(ee)&&ee(L,Z)}}}),Be("packages/core/src/source/abort.js",function(e,D){"use strict";Object.defineProperty(e,"SupersededError",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"RequestToken",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"AbortScope",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createAbortScope",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return x}});class re extends Error{constructor(W,I="superseded"){super(`[lattice] request ${W?`"${W}" `:""}${I}`),this.name="SupersededError",this.superseded=!0,this.key=W}}class M{#e;constructor(W,I,K,R){this.#e=W,this.key=I,this.controller=K,this.signal=K.signal,this.seq=R}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(W){this.signal.aborted||this.controller.abort(new re(this.key,W)),this.#e.settle(this)}}class G{#e=new Map;#t=0;begin(W="",I="superseded"){const K=this.#e.get(W);K&&!K.signal.aborted&&K.controller.abort(new re(W,I));const R=new M(this,W,new AbortController,++this.#t);return this.#e.set(W,R),R}tokenFor(W){return this.#e.get(W)}pending(W=""){const I=this.#e.get(W);return!!I&&!I.signal.aborted}get size(){return this.#e.size}settle(W){this.#e.get(W.key)===W&&this.#e.delete(W.key)}abort(W="",I="superseded"){const K=this.#e.get(W);K&&K.abort(I)}abortAll(W="superseded"){for(const I of[...this.#e.values()])I.abort(W);this.#e.clear()}}function F(){return new G}function x(q){if(!q||typeof q!="object")return!1;const W=q;return W.superseded===!0||W.name==="AbortError"||W.name==="SupersededError"}}),Be("packages/core/src/source/blockcache.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_PAGE_SIZE",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"DEFAULT_MAX_CACHED_PAGES",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"BlockCache",{enumerable:!0,get:function(){return F}});const re=100,M=32;class G{constructor(q){this.id=q,this.rows=null,this.state="pending",this.token=null,this.error=null}}class F{#e=new Map;#t;#n;#r=0;#i=-1;constructor(q={}){this.#t=Math.max(1,Math.floor(Number(q.pageSize)||re)),this.#n=Math.max(1,Math.floor(Number(q.maxCachedPages)||M))}get pageSize(){return this.#t}get maxBlocks(){return this.#n}get size(){return this.#e.size}blockOf(q){return Math.floor(q/this.#t)}rangeOf(q){return{start:q*this.#t,end:(q+1)*this.#t}}has(q){return this.#e.has(q)}pending(q){const W=this.#e.get(q);return!!W&&W.state==="pending"}loaded(q){const W=this.#e.get(q);return!!W&&W.state==="loaded"}begin(q,W){let I=this.#e.get(q);return I||(I=new G(q)),I.state="pending",I.token=W,I.error=null,this.#s(q,I),I}fill(q,W){const I=this.#e.get(q)||new G(q);I.rows=W,I.state="loaded",I.token=null,this.#s(q,I)}failed(q,W){const I=this.#e.get(q)||new G(q);I.state="error",I.error=W,I.token=null,this.#s(q,I)}delete(q){return this.#e.delete(q)}rowAt(q){const W=this.blockOf(q),I=this.#e.get(W);if(!(!I||I.state!=="loaded"||!I.rows))return this.#s(W,I),I.rows[q-W*this.#t]}rowLoaded(q){const W=this.blockOf(q),I=this.#e.get(W);return!!I&&I.state==="loaded"&&!!I.rows&&q-W*this.#t<I.rows.length}erroredAt(q){const W=this.#e.get(this.blockOf(q));return!!W&&W.state==="error"}loadedExtent(){let q=0;for(const W of this.#e.values()){if(W.state!=="loaded"||!W.rows)continue;const I=W.id*this.#t+W.rows.length;I>q&&(q=I)}return q}fillOf(q){const W=this.#e.get(q);return W&&W.state==="loaded"&&W.rows?W.rows.length:null}protect(q,W){this.#r=this.blockOf(Math.max(0,q)),this.#i=this.blockOf(Math.max(0,W))}evict(){const q=[];if(this.#e.size<=this.#n)return q;for(const[W,I]of this.#e){if(this.#e.size-q.length<=this.#n)break;W>=this.#r&&W<=this.#i||I.state!=="pending"&&q.push(W)}for(const W of q)this.#e.delete(W);return q}ids(){return[...this.#e.keys()]}clear(){this.#e.clear()}#s(q,W){this.#e.delete(q),this.#e.set(q,W)}}}),Be("packages/core/src/source/pagewindow.js",function(e,D){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return re}});function re(M,G,F,x){const q=Math.floor(Number(M)||0);if(q<=0)return null;const W=Math.max(0,Math.floor(Number(G)||0)),I=Math.max(0,Math.floor(Number(F)||0));if(x){const K=Math.max(1,Math.ceil(I/q)),R=Math.min(W,K-1),S=R*q;return{page:R,pageSize:q,offset:S,length:Math.max(0,Math.min(q,I-S)),pageCount:K,total:I}}return{page:W,pageSize:q,offset:W*q,length:q,pageCount:Math.max(W+2,Math.ceil(I/q)),total:null}}}),Be("packages/core/src/source/paged.js",function(e,D){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"PagedSource",{enumerable:!0,get:function(){return p}});const M=D("packages/core/src/internal/lru.js").Lru,F=D("packages/core/src/internal/predicates.js").isFunction,q=D("packages/core/src/internal/warn.js").warnOnce,I=D("packages/core/src/internal/schedule.js").settleDebounce,K=D("packages/core/src/source/abort.js"),R=K.createAbortScope,S=K.isAbortError,k=D("packages/core/src/source/blockcache.js"),y=k.BlockCache,l=k.DEFAULT_PAGE_SIZE,g=k.DEFAULT_MAX_CACHED_PAGES,t=D("packages/core/src/source/rows.js").createRowFactory,o=D("packages/core/src/source/filterwire.js"),c=o.wireFilters,f=o.querySignature,n=o.warnHostFilterNotApplied,r=D("packages/core/src/source/pagewindow.js").pageWindow,s=120;function d(u,b){return new p(u,b)}class p{mode="paged";#e;#t;#n;#r=R();#i;#s;#o=new Map;#l=null;#a=null;#c=!1;#u=0;#f="";#d={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(b,a){this.#e=b||{mode:"paged"},this.#t=a||{},this.#n=new y({pageSize:this.#e.pageSize||l,maxCachedPages:this.#e.maxCachedPages||g}),this.#i=t(this.#t),this.#s=new M(this.#n.pageSize*4),this.#h=I((h,w)=>this.#w(h,w),s),this.#f=this.#P(),F(this.#e.fetch)||q("source.paged.fetch",'source.mode "paged" requires a fetch function; the grid will stay empty.'),n(this.#t)}count(){const b=this.#y();return b?b.length:this.#b()}#b(){if(this.#C(),this.#l!==null)return this.#l;const b=Math.max(this.#u,this.#n.loadedExtent());return this.#c?b:b+this.#n.pageSize}matchCount(){return this.#b()}totalCount(){return this.#b()}pageInfo(){const b=this.#y();if(!b){const a=this.#b();return{page:0,pageSize:0,total:this.exact()?a:null,pageCount:1,counting:!1}}return{page:b.page,pageSize:b.pageSize,total:b.total,pageCount:b.pageCount,counting:b.total===null&&this.#r.size>0&&this.#u===0&&this.#n.loadedExtent()===0}}#y(){const b=this.#b(),a=r(this.#T("pageSize",0),this.#T("page",0),b,this.exact());if(!a)return this.#g="",null;const h=`${this.#m}:${a.offset}:${a.length}`;if(h!==this.#g&&!this.#p&&(this.#g=h,a.length>0)){const w=a.offset+a.length-1;this.#d={start:a.offset,end:w},this.#w(a.offset,w)}return a}at(b){const a=this.#y();if(a){if(b<0||b>=a.length)return;const h=this.#O(a.offset+b);return h&&(h.index=b),h}return this.#O(b)}#O(b){if(b<0||b>=this.#b())return;const a=this.#s.get(b);if(a&&(a.data!==null||!this.#n.rowLoaded(b)))return a;const h=this.#n.rowAt(b);if(h===void 0){const v=this.#i.skeleton(b,0,this.#n.erroredAt(b));return this.#s.set(b,v),v}const w=this.#i.leaf(h,b);return w.index=b,this.#s.set(b,w),this.#o.set(w.key,b),w}byKey(b){const a=this.#o.get(b);return a===void 0?void 0:this.#O(a)}loaded(b){const a=this.#y();return a?b>=0&&b<a.length&&this.#n.rowLoaded(a.offset+b):this.#n.rowLoaded(b)}loadedCount(){this.#C();let b=0;for(const a of this.#n.ids()){if(!this.#n.loaded(a))continue;const h=this.#n.fillOf(a);typeof h=="number"&&(b+=h)}return b}residentRows(){this.#C();const b=this.#y(),a=b?b.offset:0,h=b?b.offset+b.length:1/0,w=[],v=this.#n.ids().sort((A,_)=>A-_);for(const A of v){if(!this.#n.loaded(A))continue;const{start:_}=this.#n.rangeOf(A),V=this.#n.fillOf(A)||0;for(let Y=_;Y<_+V;Y++){if(Y<a||Y>=h)continue;const $=this.#s.peek(Y);if($&&$.data!==null&&$.data!==void 0){w.push($);continue}const j=this.#n.rowAt(Y);if(j===void 0)continue;const E=this.#i.leaf(j,Y);E.index=Y,this.#s.set(Y,E),this.#o.set(E.key,Y),w.push(E)}}return w}hint(b,a){if(this.#p)return;const h=this.#C();let w=Math.max(0,Math.floor(b)),v=Math.max(w,Math.floor(a));const A=this.#y();if(A){if(A.length===0)return;w=A.offset,v=A.offset+A.length-1}this.#d={start:w,end:v},this.#n.protect(w,v);for(const _ of this.#n.evict())this.#v(_);this.#h(w,v),h&&this.#h.flush()}#w(b,a){if(this.#p)return;this.#n.protect(b,a);const h=this.#n.blockOf(b),w=this.#n.blockOf(a);for(let v=h;v<=w&&!(this.#l!==null&&v*this.#n.pageSize>=this.#l);v++)this.#n.has(v)||this.#A(v)}apply(b){const a={added:[],updated:[],removed:[]};if(!b)return a;if(b.update)for(const h of b.update){const w=this.#i.keyOf(h,-1),v=this.#o.get(w);if(v===void 0)continue;const A=this.#i.leaf(h,v);A.index=v,this.#s.set(v,A),a.updated.push(A)}return(b.add&&b.add.length||b.remove&&b.remove.length)&&this.reload(),a}reload(b){this.#S("reload"),this.#h.cancel(),this.hint(this.#d.start,this.#d.end)}destroy(){this.#p=!0,this.#h.cancel(),this.#r.abortAll("destroyed"),this.#n.clear(),this.#s.clear(),this.#o.clear()}exact(){return this.#l!==null||this.#c}pending(){return this.#r.size}async#A(b){if(!F(this.#e.fetch))return;const a=this.#r.begin(`block:${b}`);this.#n.begin(b,a);const{start:h,end:w}=this.#n.rangeOf(b),v=this.#f;try{const A=await this.#e.fetch({range:{start:h,end:w},sort:this.#T("sort",[]),filters:c(this.#T("filters",null),this.#E()),quick:this.#T("quick","")||void 0,context:this.#T("context",null),signal:a.signal});if(!a.current||v!==this.#f||this.#p)return;a.settle();const _=A&&A.rows||[];this.#n.fill(b,_);for(let Y=0;Y<_.length;Y++)this.#s.delete(h+Y);const V=A&&typeof A.total=="number"?A.total:A&&typeof A.count=="number"?A.count:null;V!==null?(this.#l=V,this.#c=!0):_.length<this.#n.pageSize?(this.#c=!0,this.#l=h+_.length):this.#u=Math.max(this.#u,h+_.length),this.#M("model:changed",{reason:"page",block:b,from:h,to:h+_.length}),this.#M("rows:changed",{companion:!0,reason:"page",block:b,from:h,to:h+_.length}),this.#l!==null&&this.#l!==this.#a&&(this.#a=this.#l,this.#M("source:total",{total:this.#l,groupPath:[]}))}catch(A){if(a.settle(),S(A))return;this.#n.failed(b,A);for(let _=h;_<w;_++)this.#s.delete(_);this.#M("model:changed",{reason:"page-error",block:b,range:{start:h,end:w}}),this.#M("source:error",{error:A,block:b,range:{start:h,end:w}})}}#v(b){const{start:a,end:h}=this.#n.rangeOf(b);for(let w=a;w<h;w++){const v=this.#s.peek(w);v&&this.#o.delete(v.key),this.#s.delete(w)}}#C(){const b=this.#P();return b===this.#f?!1:(this.#f=b,this.#S("query"),!0)}#S(b){this.#r.abortAll(b),this.#n.clear(),this.#s.clear(),this.#o.clear(),this.#l=null,this.#a=null,this.#c=!1,this.#u=0,this.#m++,this.#M("model:changed",{reason:b})}#P(){return f({filters:this.#T("filters",null),sort:this.#T("sort",[]),quick:this.#T("quick",""),context:this.#T("context",null)})}#E(){const b=this.#t.config||{};return{tz:b.timeZone,weekStartsOn:b.weekStartsOn}}#T(b,a){const h=this.#t.state;if(h&&F(h[b])){const w=h[b]();return w??a}return a}#M(b,a){const h=this.#t.emit;F(h)&&h(b,a)}}}),Be("packages/core/src/source/aggregates.js",function(e,D){"use strict";Object.defineProperty(e,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"pushableAggregates",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"fillAggregateSql",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"routeAggregate",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"resolveAggregatePlan",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"groupKeysPushable",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"pushdownDocRows",{enumerable:!0,get:function(){return K}});const re=Object.freeze({sum:{pushable:!0,class:"identical",sql:"sum(%c)"},avg:{pushable:!0,class:"identical",sql:"avg(%c)"},min:{pushable:!0,class:"identical",sql:"min(%c)"},max:{pushable:!0,class:"identical",sql:"max(%c)"},count:{pushable:!0,class:"identical",sql:"count(*)"},countValues:{pushable:!0,class:"identical",sql:"count(%c)",blankAware:!0},range:{pushable:!0,class:"identical",sql:"(max(%c) - min(%c))"},variance:{pushable:!0,class:"identical",sql:"var_samp(%c)"},varianceP:{pushable:!0,class:"identical",sql:"var_pop(%c)"},stddev:{pushable:!0,class:"identical",sql:"stddev_samp(%c)"},stddevP:{pushable:!0,class:"identical",sql:"stddev_pop(%c)"},sumSquares:{pushable:!0,class:"identical",sql:"sum(%c * %c)"},median:{pushable:!0,class:"identical",sql:"median(%c)"},p25:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.25)"},p75:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.75)"},p90:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.9)"},p95:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.95)"},p99:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.99)"},iqr:{pushable:!0,class:"identical",sql:"(quantile_cont(%c, 0.75) - quantile_cont(%c, 0.25))"},mad:{pushable:!0,class:"identical",sql:"mad(%c)"},distinct:{pushable:!0,class:"identical",sql:"count(DISTINCT %c)",blankAware:!0},skewness:{pushable:!0,class:"identical",sql:"skewness(%c)"},kurtosis:{pushable:!0,class:"identical",sql:"kurtosis(%c)"},geomean:{pushable:!0,class:"identical",sql:"exp(avg(ln(%c)))"},harmean:{pushable:!0,class:"identical",sql:"(count(%c) / sum(1.0 / %c))"},entropy:{pushable:!0,class:"identical",sql:"entropy(%c)",blankAware:!0},correlation:{pushable:!0,class:"identical",sql:"corr(%w, %c)",twoColumn:!0},hhi:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_transform(map_values(histogram(%c)), lambda v: (v::DOUBLE/count(%c))*(v::DOUBLE/count(%c)))) END"},evenness:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL WHEN count(DISTINCT %c)<2 THEN 1.0 ELSE entropy(%c)/log2(count(DISTINCT %c)) END"},top3Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,3))::DOUBLE/count(%c) END"},top10Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,10))::DOUBLE/count(%c) END"},gini:{pushable:!0,class:"identical",sql:"CASE WHEN list_min(list(%c) FILTER (WHERE isfinite(%c)))<0 THEN NULL WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL WHEN list_sum(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN 0 ELSE 2.0*list_sum(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v, i: i*v))/(len(list(%c) FILTER (WHERE isfinite(%c)))*list_sum(list(%c) FILTER (WHERE isfinite(%c))))-(len(list(%c) FILTER (WHERE isfinite(%c)))+1.0)/len(list(%c) FILTER (WHERE isfinite(%c))) END"},trimmedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_slice(list_sort(list(%c) FILTER (WHERE isfinite(%c))), floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1, len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT)) END"},winsorizedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v: least(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT], greatest(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1], v)))) END"},robustOutliers:{pushable:!0,class:"identical",sql:"(SELECT CASE WHEN len(d.a)=0 THEN NULL WHEN d.mad=0 THEN NULL ELSE len(list_filter(d.a, lambda v: abs(0.6745*(v-d.med)/d.mad)>3.5)) END FROM (SELECT xs AS a, list_median(xs) AS med, list_median(list_transform(xs, lambda w: abs(w-list_median(xs)))) AS mad FROM (SELECT list(%c) FILTER (WHERE isfinite(%c)) AS xs)) d)"},jarqueBera:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))<8 THEN NULL WHEN list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2)))=0 THEN NULL ELSE (len(list(%c) FILTER (WHERE isfinite(%c)))/6.0)*(power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),3)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),1.5),2)+power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),4)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),2)-3,2)/4.0) END"},weightedAvg:{pushable:!0,class:"identical",twoColumn:!0,sql:"sum(%c*%w) FILTER (WHERE isfinite(%c) AND isfinite(%w))/nullif(sum(%w) FILTER (WHERE isfinite(%c) AND isfinite(%w)),0)"},mode:{pushable:!0,class:"may-differ",sql:"mode(%c)",note:"DuckDB returns a modal value even for an all-distinct column; the grid returns null. Tie-breaking can also differ, and on a text column an empty string counts as a value. Under pushdown you will see a value."},weightedQuantile:{pushable:!1,class:"fallback",note:"No SQL equivalent for the grid's weighted-quantile midpoint convention; always computed client-side (needs a full-dataset pull for a correct figure over a remote source)."}});function M(){const R=new Set;for(const[S,k]of Object.entries(re))k.pushable&&R.add(S);return R}function G(R,S,k){let y=R.split("%c").join(S);return k!==void 0&&(y=y.split("%w").join(k)),y}function F(R){const S=R||{},k=S.default==="engine"||S.default==="engine-if-identical"?S.default:"client",y={};if(S.overrides&&typeof S.overrides=="object")for(const[l,g]of Object.entries(S.overrides))(g==="engine"||g==="client")&&(y[l]=g);return{default:k,overrides:y}}function x(R,S){const k=re[R];if(!k||!k.pushable)return"client";const y=S.overrides[R];return y==="engine"||y==="client"?y:S.default==="client"?"client":S.default==="engine-if-identical"?k.class==="identical"?"engine":"client":"engine"}function q(R,S){const k=F(S),y=[],l=[];for(const g of R||[]){const i=re[g.fn],t=x(g.fn,k),o={id:g.id,col:g.col,fn:g.fn,class:i?i.class:"fallback"};g.weight!==void 0&&(o.weight=g.weight),g.params!==void 0&&(o.params=g.params),t==="engine"?y.push(o):(o.reason=i&&!i.pushable?i.note||"the engine cannot express this stat":"client by config",l.push(o))}return{engine:y,client:l,config:k}}const W=/^[A-Za-z_][A-Za-z0-9_$]*$/;function I(R,S=[]){return(R||[]).every(y=>{if(typeof y=="string")return W.test(y);if(!y||typeof y!="object")return!1;const l=y;return Array.isArray(S)&&S.includes(l.bucket)&&typeof l.col=="string"&&W.test(l.col)&&typeof l.size=="number"&&Number.isFinite(l.size)&&l.size>0})}function K(){return Object.entries(re).map(([R,S])=>({stat:R,class:S.class,sql:S.sql?G(S.sql,"col",S.twoColumn?"weight":void 0):"",note:S.note||(S.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),Be("packages/core/src/source/pushdown.js",function(e,D){"use strict";Object.defineProperty(e,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"NO_CAPABILITIES",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"capabilitiesOf",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"splitFilters",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"applyResidual",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"createPushdownSource",{enumerable:!0,get:function(){return H}});const M=D("packages/core/src/internal/compare.js").defaultCompare,F=D("packages/core/src/internal/predicates.js").isFunction,q=D("packages/core/src/internal/merge.js").toArray,I=D("packages/core/src/internal/warn.js").warnOnce,K=D("packages/core/src/source/filterwire.js"),R=K.isGroup,S=K.warnWherePageRelative,k=K.warnWhereOverThreshold,y=K.wireFilters,l=D("packages/core/src/source/aggregates.js"),g=l.resolveAggregatePlan,i=l.groupKeysPushable,t=l.STAT_PUSHDOWN,c=D("packages/core/src/source/abort.js").SupersededError,f=1e3;function n(L){const Z=L&&L.signal;if(!Z||!Z.aborted)return;const ee=Z.reason;throw ee instanceof Error?ee:new c("","superseded before it was sent")}const m=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function r(L){if(!L||typeof L!="object")return!1;const Z=L.returning==="row"||L.returning==="key"?L.returning:"none";return{append:L.append===!0,update:L.update===!0,delete:L.delete===!0,returning:Z}}function s(L,Z){if(!L||typeof Z!="string")return;if(!Z.includes("."))return L[Z];let ee=L;for(const te of Z.split(".")){if(ee===null||typeof ee!="object")return;ee=ee[te]}return ee}function d(L){if(L===!0)return!0;if(!L||typeof L!="object")return!1;const Z=L;return Z.enabled===!1?!1:Z.enabled===!0||F(Z.commit)}function p(L){const Z={...m,...L||{}};return Z.operators=new Set(Z.operators||[]),Z.mutate=r(Z.mutate),Z}function u(L,Z){return!L||!L.op||!Z.operators.size?!1:Z.operators.has(L.op)}function b(L,Z){if(!L)return{pushed:null,residual:null};if(!Z.filter)return{pushed:null,residual:L};if(Z.filter==="term"){if(R(L)){const ne=L.conditions||[];if(String(L.op)!=="and")return{pushed:null,residual:L};const ae=ne.findIndex(le=>!R(le)&&u(le,Z));if(ae<0)return{pushed:null,residual:L};const de=ne.filter((le,be)=>be!==ae);return{pushed:ne[ae],residual:de.length?{op:"and",conditions:de}:null}}return u(L,Z)?{pushed:L,residual:null}:{pushed:null,residual:L}}if(!R(L))return u(L,Z)?{pushed:L,residual:null}:{pushed:null,residual:L};if(String(L.op)!=="and")return(L.conditions||[]).every(ae=>R(ae)?b(ae,Z).residual===null:u(ae,Z))?{pushed:L,residual:null}:{pushed:null,residual:L};const ee=[],te=[];for(const ne of L.conditions||[]){if(R(ne)){if(Z.filter==="flat"){te.push(ne);continue}const ae=b(ne,Z);ae.pushed&&ee.push(ae.pushed),ae.residual&&te.push(ae.residual);continue}(u(ne,Z)?ee:te).push(ne)}const se=ne=>ne.length===0?null:ne.length===1?ne[0]:{op:"and",conditions:ne};return{pushed:se(ee),residual:se(te)}}const a="__lattice_leaves";function h(L){return L.aggregates?L.aggregates instanceof Set?L.aggregates:new Set(q(L.aggregates)):new Set}function w(L){const Z=h(L);return Z.size?Z.has("count")?L.filter!=="tree"||!L.operators||!L.operators.has("eq")?"the adapter does not declare the `group` capability, and cannot narrow a group's rows by its key (that needs a `tree` filter with the `eq` operator)":"":"the adapter does not declare the `group` capability, and its declared aggregates have no `count` to give each group its row count":"the adapter does not declare the `group` capability"}function v(L,Z,ee,te,se,ne,ae){const de=Array.isArray(L.groupBy)?L.groupBy:[],le=Array.isArray(L.groupPath)?L.groupPath:[],be=Array.isArray(L.groupValues)?L.groupValues:null;if(!Z.group){const Ce=w(Z);if(Ce)return Ce}return i(de)?ee.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":te?se?ne?"a host `where` predicate can only run in the browser, over rows the engine grouped":ae?"fullDataset holds the whole matching set, so the grid groups it itself":!be||be.length!==le.length?"the request carries no typed `groupValues` for its group path, and the string `groupPath` cannot be compared against a typed column":"":"a quick search did not push, so the engine would group unsearched rows":"the sort did not push, so the engine would order the groups differently":"a grouping key is not a plain column the engine can name in a GROUP BY"}const A="pushdown:pivot-unsupported",_="pushdown:group-unsupported",V=Symbol("lattice.remote.ungroupedLevel");function Y(L,Z,ee,te,se,ne){const ae=Array.isArray(L.pivotBy)?L.pivotBy:[],de=Array.isArray(L.groupBy)?L.groupBy:[],le=Array.isArray(L.groupPath)?L.groupPath:[],be=Array.isArray(L.groupValues)?L.groupValues:null;return Z.pivot?i(ae)?de.length&&!i(de)?"a grouping key is not a plain column the engine can name in a GROUP BY":ee.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":te?se?ne?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!be||be.length!==le.length?"the request carries no typed `groupValues` for its group path, and the string `groupPath` cannot be compared against a typed column":"":"a quick search did not push, so the engine would pivot unsearched rows":"the sort did not push, so the engine would order the rows differently":"a pivot column is not a plain column the engine can name in a GROUP BY":"the adapter does not declare the `pivot` capability"}function $(L,Z,ee=!1){const te=b(L.filters||null,Z),se=[];te.residual&&se.push("filter");const ne=L.sort||[],ae=ne.length===0||Z.sort==="multi"&&ne.length>=1||Z.sort==="single"&&ne.length===1;!ae&&ne.length&&se.push("sort");const de=L.quick?String(L.quick):"",le=!de||!!Z.quick;le||se.push("quick");const be=L.where&&L.where.active?L.where:null;be&&se.push("where");const Ce={filters:te.residual,sort:ae?null:ne,quick:le?"":de,where:be},Ne=!!ee,he=Array.isArray(L.groupBy)&&L.groupBy.length>0,ie=he?v(L,Z,te,ae,le,be,Ne):"",ue=L.pivotMode!==!1&&Array.isArray(L.pivotBy)&&L.pivotBy.length>0,ge=ue?Y(L,Z,te,ae,le,be):"",pe=ue&&ge==="";ue&&!pe&&se.push("pivot");const Oe=ue?pe&&he:he&&ie==="";he&&!ue&&!Oe&&se.push("group");const ve=(Oe||pe)&&Array.isArray(L.groupValues)?L.groupValues.length:0,ye=Oe||ue?!1:Ne||!!(Ce.filters||Ce.sort||Ce.quick||Ce.where)||!Z.range;return{pushed:{...L,filters:te.pushed,sort:ae?ne:[],quick:le?de:"",range:ye?null:L.range},residual:Ce,needsAll:ye,unpushed:se,full:Ne,grouped:Oe,groupLevel:ve,groupReason:ue?"":ie,pivoted:pe,pivotReason:ge}}function j(L){const Z=Array.isArray(L.totals)?L.totals:[],ee=L.totalFns&&typeof L.totalFns=="object"?L.totalFns:{},te=[],se=[];for(const ne of Z){const ae=String(ne),de=typeof ee[ae]=="string"?ee[ae]:null,le=de?t[de]:null;de?!le||!le.pushable||!le.sql?se.push({id:ae,fn:de,class:le?le.class:"fallback",reason:le&&le.note?le.note:`the pushdown map cannot express "${de}"`}):le.twoColumn?se.push({id:ae,fn:de,class:le.class,reason:`"${de}" reduces two columns, and a grouped request carries no weight column`}):te.push({id:ae,col:ae,fn:de,class:le.class}):se.push({id:ae,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:te,client:se}}const E=Object.freeze({items:L=>L==null?[]:Array.isArray(L)?L:[L]});function O(L,Z,ee){if(!Z)return L;let te=L;if(Z.filters&&F(ee.evaluateFilters)){const se=te,ne={count:te.length,handle:le=>({id:le,get:be=>s(se[be],le)}),itemwise:le=>se.some(be=>Array.isArray(s(be,le)))?E:null},ae=ee.evaluateFilters(Z.filters,ne),de=[];for(let le=0;le<te.length;le++)ae[le]&&de.push(te[le]);te=de}if(Z.where&&Z.where.active&&(Z.whole||S(Z.where.names,"pushdown"),te=te.filter(se=>Z.where.passes(se))),Z.quick){const se=Z.quick.toLowerCase();te=te.filter(ne=>{if(!ne||typeof ne!="object")return!1;for(const ae of Object.values(ne))if(ae!=null&&String(ae).toLowerCase().includes(se))return!0;return!1})}if(Z.sort&&Z.sort.length&&F(ee.sortMulti)){const se=[...new Set(Z.sort.map(le=>le.col))],ne=te,ae=se.map(le=>({id:le,get:be=>s(ne[be],le)})),de=ee.sortMulti(ae,Z.sort.map(le=>({col:le.col,dir:le.dir})),Uint32Array.from({length:te.length},(le,be)=>be),{});te=Array.from(de,le=>ne[le])}return te}function N(L){return JSON.stringify({filters:L.filters||null,sort:L.sort||[],quick:L.quick||"",groupBy:L.groupBy||[],groupPath:L.groupPath||[],context:L.context??null})}function T(L){if(!L||typeof L!="object")return 16;let Z="";try{Z=JSON.stringify(L)}catch{return 200}return Z.length*2+64}function C(L){const Z=L||{};return{enabled:!!Z.enabled,maxRows:Number.isFinite(Z.maxRows)?Z.maxRows:1e6,maxBytesEstimate:Number.isFinite(Z.maxBytesEstimate)?Z.maxBytesEstimate:512*1024*1024}}const B=5e4;function z(L){return Number.isFinite(L)&&L>=0?L:B}function X(L){return!!L&&F(L.then)}async function Q(L){if(!L||L.total!==void 0||!X(L.pendingTotal))return L;const Z=await L.pendingTotal,{pendingTotal:ee,...te}=L;return typeof Z=="number"?{...te,total:Z}:te}function H(L={}){const Z=L.adapter;if(!Z||!F(Z.execute))return I("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...L,mode:"remote",fetch:async()=>({rows:[],total:0})};const ee=p(Z.capabilities),te=Z.capabilities&&Object.getOwnPropertyDescriptor(Z.capabilities,"operators");te&&F(te.get)&&Object.defineProperty(ee,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(Z.capabilities.operators||[]),set:()=>{}});const se=Z.name||"adapter";let ne=null;const ae=()=>F(Z.ready)?(ne||(ne=Promise.resolve(Z.ready()).then(()=>{Object.assign(ee,p(Z.capabilities))},we=>{throw ne=null,we})),ne):null,de=C(L.fullDataset),le=!!L.allowPartialResults,be=z(L.whereRowLimit);let Ce=null;const Ne=L.aggregates;let he=null,ie=null,ue=null,ge=null,pe=null,Oe,ve=null,ye=0,Ae=null;const Me=()=>!de.enabled||!he?null:(Ae!==he.key&&(ye++,Ae=he.key),{rows:he.rows,version:ye}),je=async we=>{const Te=we.where&&we.where.active?we.where:null;if(!Te)return{request:we,probe:null};const{where:Le,...xe}=we,Ue=$(xe,ee,de.enabled);if(Ue.needsAll)return{request:we,probe:null};const ze=N(Ue.pushed);let Ge=null;return(!Ce||Ce.key!==ze)&&(ee.total?(n(we),Ge=await Q(await Z.execute(Ue.pushed,we)),Ce={key:ze,size:Ge&&typeof Ge.total=="number"?Ge.total:null}):Ce={key:ze,size:null}),Ce.size!==null&&Ce.size<be?{request:we,probe:null}:(k(Te.names,se,Ce.size,be),{request:xe,probe:Ge})},_e=async(we,Te)=>{ve=null;const Le=j(we.pushed);ue={engine:Le.engine,client:Le.client,groupBy:we.pushed.groupBy},Le.client.length&&I(`source.pushdown.group.totals.${se}.${Le.client.map(ze=>ze.id).join(".")}`,`the ${se} adapter cannot compute the group subtotal for ${Le.client.map(ze=>`"${ze.id}" (${ze.reason})`).join(", ")}, so those group rows carry no value for that column. A figure computed over anything other than the group would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const xe=await Z.executeGroupLevel(we.pushed,Le.engine,Te)||{};let Ue=xe.rows||[];return!ee.range&&Te.range&&(Ue=Ue.slice(Te.range.start,Te.range.end)),We(xe),xe.total===void 0?{rows:Ue}:{rows:Ue,total:xe.total}},Pe=new Map,Se=64,Fe=async(we,Te)=>{ve=null;const Le=we.pushed,xe=Le.groupBy,Ue=Array.isArray(Le.groupValues)?Le.groupValues:[],ze=Ue.length,Ge=[...Le.filters?[Le.filters]:[],...xe.slice(0,ze).map((ct,pt)=>({col:ct,op:"eq",value:Ue[pt]===void 0?null:Ue[pt],caseSensitive:!0}))],tt=Ge.length===0?null:Ge.length===1?Ge[0]:{op:"and",conditions:Ge},it=Te.range?Te.range.start:0;if(ze>=xe.length){const ct={...Le,filters:tt,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},pt=await Q(await Z.execute(ct,Te))||{};let Ot=pt.rows||[];return!ee.range&&Te.range&&(Ot=Ot.slice(Te.range.start,Te.range.end)),typeof pt.total=="number"?{rows:Ot,total:pt.total}:{rows:Ot}}const ut=xe[ze],wt=j(Le),jt=h(ee),Ve=wt.engine.filter(ct=>jt.has(ct.fn)),Je=[...wt.engine.filter(ct=>!jt.has(ct.fn)).map(ct=>({id:ct.id,fn:ct.fn,class:ct.class,reason:`the ${se} adapter does not compute "${ct.fn}"`})),...wt.client];ue={engine:Ve,client:Je,groupBy:xe},Je.length&&I(`source.pushdown.group.totals.${se}.${Je.map(ct=>ct.id).join(".")}`,`the ${se} adapter cannot compute the group subtotal for ${Je.map(ct=>`"${ct.id}" (${ct.reason})`).join(", ")}, so those group rows carry no value for that column. A figure computed over anything other than the group would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const st=[...Ve.map(ct=>({id:ct.id,col:ct.col,fn:ct.fn})),{id:a,col:ut,fn:"count"}],et={...Le,filters:tt,range:null},ft=JSON.stringify([N(et),Ue,ut,st]);let At=it>0?Pe.get(ft):void 0;if(!At){for(At=Promise.resolve(Z.executeGroupedAggregates(et,[ut],st)),Pe.delete(ft),Pe.set(ft,At);Pe.size>Se;)Pe.delete(Pe.keys().next().value);At.catch(()=>{Pe.get(ft)===At&&Pe.delete(ft)})}const Et=await At||[];n(Te);const Rt=ct=>{const pt={};for(const Ot of Ve)pt[Ot.id]=ct?ct[Ot.id]:void 0;return pt},xt=(Le.sort||[]).find(ct=>ct&&ct.col===ut),Ft=xt&&xt.dir==="desc"?-1:1,Ht=Et.filter(ct=>ct&&ct.level===1).map(ct=>({[ut]:ct.keys[0]===void 0?null:ct.keys[0],leafCount:Number(ct.values&&ct.values[a])||0,totals:Rt(ct.values)})).sort((ct,pt)=>Ft*M(ct[ut],pt[ut]));if(ze===0){const ct=Et.find(Ot=>Ot&&Ot.level===0),pt=ct?Number(ct.values&&ct.values[a]):NaN;We({matchCount:Number.isFinite(pt)?pt:Ht.reduce((Ot,Lt)=>Ot+Lt.leafCount,0),...ct?{grand:Rt(ct.values)}:{}})}const qe=Te.range?Te.range.end:Ht.length;return{rows:Ht.slice(it,qe),total:Ht.length}},We=we=>{typeof we.matchCount=="number"&&(ge=we.matchCount,pe=we.grand?{totals:we.grand,leafCount:we.matchCount}:null,Oe===void 0&&F(Z.unfilteredCount)&&(Oe=null,Promise.resolve(Z.unfilteredCount()).then(Te=>{Oe=typeof Te=="number"?Te:null}).catch(Te=>{I(`source.pushdown.group.unfiltered.${se}`,`the ${se} adapter could not count the unfiltered set (${Te&&Te.message?Te.message:Te}), so "N of M" falls back to the display count for its denominator.`)})))},He=async(we,Te)=>{ve=null;const Le=j(we.pushed);ue={engine:Le.engine,client:Le.client,groupBy:we.pushed.groupBy,pivotBy:we.pushed.pivotBy},Le.client.length&&I(`source.pushdown.pivot.totals.${se}.${Le.client.map(tt=>tt.id).join(".")}`,`the ${se} adapter cannot compute the pivot cells for ${Le.client.map(tt=>`"${tt.id}" (${tt.reason})`).join(", ")}, so those cells are empty. A figure computed over anything other than the cell would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const xe=await Z.executePivotLevel(we.pushed,Le.engine,Te)||{};let Ue=xe.rows||[];!ee.range&&Te.range&&(Ue=Ue.slice(Te.range.start,Te.range.end)),We(xe);const ze=xe.pivot&&typeof xe.pivot=="object"?xe.pivot:{},Ge={cells:Array.isArray(ze.cells)?ze.cells:[],...Array.isArray(ze.axis)?{axis:ze.axis}:{}};return xe.total===void 0?{rows:Ue,pivot:Ge}:{rows:Ue,total:xe.total,pivot:Ge}},Ye=we=>{I(`source.pushdown.pivot.${se}.${we}`,`pushdown:pivot-unsupported: the ${se} adapter cannot pivot this query because ${we}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const Te=new Error(`[lattice] ${A}: the ${se} adapter cannot pivot this query because ${we}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw Te.code=A,Te.reason=we,Te},Qe=(we,Te)=>{const Le={key:Te,state:"pending",value:null};return ve=Le,we.then(xe=>(ve===Le&&(ve={key:Te,state:"settled",value:typeof xe=="number"?xe:null}),xe),xe=>{throw ve===Le&&(ve={key:Te,state:"failed",value:null}),xe})};let lt=0,ot=[];const yt=()=>lt===0?null:new Promise(we=>{const Te=setTimeout(we,f);ot.push(()=>{clearTimeout(Te),we()})});let Ct;const Nt=async we=>{const Te=ae();Te&&await Te;const xe=we&&we.pivotMode!==!1&&Array.isArray(we.pivotBy)&&we.pivotBy.length>0?{request:we,probe:null}:await je(we);n(we);let Ue=$(xe.request,ee,de.enabled);if(ee.group&&Ue.grouped&&!Ue.pivoted&&!F(Z.executeGroupLevel)&&(I(`source.pushdown.group.method.${se}`,`the ${se} adapter declares the \`group\` capability but has no \`executeGroupLevel(query, aggregates, request)\`, so grouping is not pushed and the grid stays ungrouped unless it holds the whole matching set. Implement the method or drop the capability.`),Ue=$(xe.request,{...ee,group:!1,aggregates:null},de.enabled)),Ue.pivoted&&!F(Z.executePivotLevel)&&(Ue=$(xe.request,{...ee,pivot:!1},de.enabled),Ue.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Ue.grouped&&!Ue.pivoted&&!ee.group&&!F(Z.executeGroupedAggregates)&&(I(`source.pushdown.group.aggregates.method.${se}`,`the ${se} adapter declares \`aggregates\` but has no \`executeGroupedAggregates(query, groupBy, aggregates)\`, so the grouped view cannot be built from grouped aggregates and the grid stays ungrouped unless it holds the whole matching set. Implement the method, or declare \`group\` and implement \`executeGroupLevel\`.`),Ue=$(xe.request,{...ee,aggregates:null},de.enabled)),ie=Ue,Ue.pivoted)return He(Ue,we);if(Ue.pivotReason&&Ye(Ue.pivotReason),Ue.grouped)return ee.group?_e(Ue,we):Fe(Ue,we);const Ge=!!Ue.groupReason&&!Ue.full;Ge?I(`source.pushdown.group-unsupported.${se}.${Ue.groupReason}`,`pushdown:group-unsupported: the ${se} adapter was not asked to group this query because ${Ue.groupReason}, so the grid stays ungrouped rather than building group rows, counts and subtotals from a window of leaf rows. \`lastPlan().groupReason\` says the same.`):Ue.groupReason&&I(`source.pushdown.group.${se}.${Ue.groupReason}`,`the ${se} adapter was not asked to group this query because ${Ue.groupReason}. The engine returns rows and the grouping is the grid's to do, which needs every matching row in the browser — correct where the grid holds them, and wrong-looking where it holds a window. \`lastPlan().unpushed\` names it.`);const tt=st=>Ge?{...st,[V]:!0}:st;if(!Ue.needsAll){const st=xe.probe||await Z.execute(Ue.pushed,we),et=st.rows||[];return X(st.pendingTotal)&&st.total===void 0?tt({rows:et,pendingTotal:Qe(st.pendingTotal,N(Ue.pushed))}):(ve=null,!ee.total&&st.total===void 0?tt({rows:et}):tt({rows:et,total:st.total??et.length}))}Ue.unpushed.length&&I(`source.pushdown.residual.${se}.${Ue.unpushed.join(".")}`,`the ${se} adapter cannot push ${Ue.unpushed.join(" or ")}, so every matching row is fetched and the rest is applied in the browser. Correct, and slower than it needs to be: widening the adapter is the fix.`);const it=N(Ue.pushed);if(!he||he.key!==it){const st=await Q(await Z.execute(Ue.pushed,we));ve=null;const et=st.rows||[];if(Ue.full){const ft=typeof st.total=="number"?Math.max(st.total,et.length):et.length;if(ft>de.maxRows)throw new Error(`[lattice] fullDataset refused: the ${se} adapter's matching set is ${ft.toLocaleString()} rows, past the configured maxRows of ${de.maxRows.toLocaleString()}. The whole set cannot be held client-side, so it is refused rather than truncated — a fraction shown as the whole would make every total and statistic silently wrong. Narrow the filter or raise maxRows.`);const At=et.length*T(et[0]);if(At>de.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${se} adapter's matching set is an estimated ${Math.round(At/(1024*1024)).toLocaleString()} MB across ${et.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(de.maxBytesEstimate/(1024*1024)).toLocaleString()} MB. The whole set cannot be held client-side, so it is refused rather than truncated. Narrow the filter or raise maxBytesEstimate.`)}if(typeof st.total=="number"&&et.length<st.total){const ft=!!(Ue.residual.filters||Ue.residual.quick||Ue.residual.sort&&Ue.residual.sort.length);if(ft&&!le)throw new Error(`[lattice] the ${se} adapter returned ${et.length} of ${st.total} matching rows when asked for the whole result, and the query has residual ${Ue.unpushed.join(" and ")||"work"} to finish in the browser. Filtering or sorting a fraction of the result would return wrong rows, so the result is refused. Fix the adapter to follow the engine's own paging before returning, hold the data in memory, or set \`allowPartialResults: true\` on the source config to accept this knowingly.`);ft?I(`source.pushdown.partial.residual.${se}`,`the ${se} adapter returned ${et.length} of ${st.total} matching rows when asked for the whole result, and residual work will run over that fraction. allowPartialResults is set, so the result is used as-is — it may be wrong. The adapter must follow the engine's own paging to be correct.`):I(`source.pushdown.partial.${se}`,`the ${se} adapter returned ${et.length} of ${st.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}he={key:it,rows:et,total:typeof st.total=="number"?st.total:null}}let ut=Ue;if(Ue.residual.where){const st=he.total??he.rows.length;if(st>=be){k(Ue.residual.where.names,se,st,be);const{where:et,...ft}=xe.request;ut=$(ft,ee,de.enabled),ie=ut}}const wt=he.total!==null&&he.rows.length>=he.total,jt=O(he.rows,{...ut.residual,whole:wt},L.compute||{}),Ve=we.range?we.range.start:0,Je=we.range?we.range.end:jt.length;return tt({rows:jt.slice(Ve,Je),total:jt.length})},dt=async(we,Te,Le)=>{const Ue=Le&&Le.waitForPage&&Ct&&F(Ct.pageForegroundIdle)?Ct.pageForegroundIdle():yt();Ue&&await Ue;const ze=ae();ze&&await ze;const Ge=$(we,ee,de.enabled);ie=Ge;const tt=g(Te,Ne),it=Array.isArray(we.groupBy)?we.groupBy:[],ut=it.length>0,wt=!Ge.residual.filters&&!Ge.residual.quick,jt=!ut||i(it,ee.buckets);let Ve=tt.engine,Je=tt.client;if(ee.aggregates&&Ve.length){const At=ee.aggregates instanceof Set?ee.aggregates:new Set(q(ee.aggregates)),Et=Ve.filter(Rt=>!At.has(Rt.fn));Et.length&&(Ve=Ve.filter(Rt=>At.has(Rt.fn)),Je=[...Et.map(Rt=>({...Rt,reason:`the ${se} adapter does not compute "${Rt.fn}"`})),...Je])}const st=At=>{Je=[...Ve.map(Et=>({...Et,reason:At})),...Je],Ve=[]};Ve.length&&!wt?st(Ge.residual.quick&&!Ge.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):Ve.length&&!jt&&st("a grouping key the engine cannot form forces all-client (no mixed provenance)");let et={},ft;return Ve.length&&(F(ut?Z.executeGroupedAggregates:Z.executeAggregates)?ut?ft=await Z.executeGroupedAggregates(Ge.pushed,it,Ve)||[]:et=await Z.executeAggregates(Ge.pushed,Ve)||{}:(I(`source.pushdown.aggregates.${se}${ut?".grouped":""}`,`the ${se} adapter cannot compute ${ut?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),st(`adapter cannot compute ${ut?"grouped ":""}aggregates`))),ue={engine:Ve,client:Je,...ut?{groupBy:it}:{}},{values:et,engine:Ve,client:Je,...ft!==void 0?{groups:ft}:{}}},at=async we=>{lt++;try{return await Nt(we)}finally{if(lt--,lt===0&&ot.length){const Te=ot;ot=[];for(const Le of Te)Le()}}},bt=d(L.edit),Tt=L.edit&&typeof L.edit=="object"&&F(L.edit.commit);let ht=L.edit;if(bt&&!Tt)if(ee.mutate&&ee.mutate.update){const we=Te=>{if(!ee.mutate||!ee.mutate.update)throw new Error(`[lattice] the ${se} adapter cannot update rows (mutate.update is not declared), so this edit cannot be persisted. The cell is reverted rather than left looking saved.`);const Le={kind:"update",key:String(Te.key),patch:{[Te.colId]:Te.value}};return Z.mutate(Le,Te.request||{})};ht={...L.edit===!0?{}:L.edit,commit:we}}else I(`source.pushdown.readonly.${se}`,`edit is enabled but the ${se} adapter declares mutate: ${ee.mutate?"without update":"false"} (read-only by declaration), so no commit is synthesised and the grid stays read-only. Declare \`mutate: { update: true }\` on the adapter to allow cell edits.`);const ke=bt&&ee.mutate&&(ee.mutate.append||ee.mutate.delete)?{append:ee.mutate.append===!0,remove:ee.mutate.delete===!0,returning:ee.mutate.returning,mutate:(we,Te)=>Z.mutate(we,Te||{})}:null,$e=async we=>{const Te=ae();Te&&await Te;const{range:Le,signal:xe,export:Ue,...ze}=we||{},Ge={...ze,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:$(Ge,ee,de.enabled),signal:xe}};async function*me(we,Te={}){const{plan:Le,signal:xe}=await $e(we),Ue=Math.max(1,Math.floor(Number(Te.pageSize))||5e3),ze={signal:xe,stream:!0},Ge=we&&we.range&&Number.isFinite(Number(we.range.start))&&Number.isFinite(Number(we.range.end))?{start:Math.max(0,Number(we.range.start)),end:Math.max(0,Number(we.range.end))}:null;if(!Le.needsAll){const ut=Ge?Ge.start:0,wt=Ge?Ge.end:1/0;for(let jt=ut;jt<wt;jt+=Ue){n(ze);const Ve=Math.min(jt+Ue,wt),Je=await Z.execute({...Le.pushed,range:{start:jt,end:Ve}},ze);Je&&X(Je.pendingTotal)&&Je.pendingTotal.then(null,()=>{});const st=Je&&Je.rows||[];if(st.length&&(yield st),st.length<Ve-jt)return}return}n(ze);const tt=await Q(await Z.execute({...Le.pushed,range:void 0},ze));let it=O(tt&&tt.rows||[],{...Le.residual,whole:!0},L.compute||{});Ge&&(it=it.slice(Ge.start,Ge.end));for(let ut=0;ut<it.length;ut+=Ue)yield it.slice(ut,ut+Ue)}return Ct={...L,edit:ht,rowMutate:ke,mode:"remote",fetch:at,foregroundIdle:yt,aggregate:dt,countMatching:async we=>{const{plan:Te,signal:Le}=await $e(we);if(!Te.needsAll&&ee.total){n({signal:Le});const Ue=await Q(await Z.execute({...Te.pushed,range:{start:0,end:0}},{signal:Le}));if(Ue&&typeof Ue.total=="number")return Ue.total}let xe=0;for await(const Ue of me({...we,range:void 0}))xe+=Ue.length;return xe},streamMatching:me,capabilitiesOf:p,planQuery:$,wireFilters:y,resolveAggregatePlan:we=>g(we,Ne),STAT_PUSHDOWN:t,lastPlan:()=>ie?{...ie,...ue?{aggregates:ue}:{},...ve?{total:{deferred:!0,state:ve.state,value:ve.value}}:{}}:null,fullFrame:Me,counts:()=>({match:ge,total:Oe??null,pending:!!ve&&ve.state==="pending"}),grandTotals:()=>pe},Ct}}),Be("packages/core/src/source/remote.js",function(e,D){"use strict";Object.defineProperty(e,"PROTOCOL",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return N}});const M=D("packages/core/src/internal/lru.js").Lru,F=D("packages/core/src/internal/predicates.js").isFunction,q=D("packages/core/src/internal/warn.js").warnOnce,I=D("packages/core/src/internal/schedule.js").settleDebounce,K=D("packages/core/src/source/abort.js"),R=K.createAbortScope,S=K.isAbortError,k=D("packages/core/src/source/blockcache.js"),y=k.BlockCache,l=k.DEFAULT_PAGE_SIZE,g=k.DEFAULT_MAX_CACHED_PAGES,i=D("packages/core/src/source/rows.js"),t=i.createRowFactory,o=i.groupKey,c=D("packages/core/src/source/filterwire.js"),f=c.wireFilters,n=c.querySignature,m=c.warnHostFilterNotApplied,s=D("packages/core/src/source/pagewindow.js").pageWindow,p=D("packages/core/src/source/memory.js").MemorySource,b=D("packages/core/src/compute/handle.js").valueComparator,a=D("packages/core/src/compute/pivot.js"),h=a.pivotKey,w=a.joinPath,v=a.DEFAULT_PATH_SEPARATOR,_=D("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,V=1,Y=120,$=1e3;function j(T,C,B){for(let z=0;z<Math.max(T.length,C.length);z++){const X=T[z],Q=C[z],H=X==null,L=Q==null;if(H||L){if(H&&L)continue;return H?1:-1}const Z=B(X,Q);if(Z!==0)return Z}return 0}function E(T,C){return new N(T,C)}class O{constructor(C,B,z,X){this.path=C,this.keyPath=X||C,this.values=[],this.level=B,this.key=o(this.keyPath),this.cache=new y(z),this.count=null,this.complete=!1,this.announced=null,this.counting=!1,this.failed=!1,this.children=new Map,this.row=null,this.flat=!1}}class N{mode="remote";#e;#t;#n;#r;#i=new Map;#s=new Set;#o=R();#l;#a;#c=new Map;#u=[];#f=null;#d="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#O="";#w=null;#A=-1;constructor(C,B){this.#e=C||{mode:"remote"},this.#t=B||{},F(this.#e.fullFrame)&&(this.filteredIndices=()=>this.#F(),this.unfilteredIndices=()=>this.#V(),this.handleFor=L=>this.#W(L),this.display=()=>this.#L(),this.grandTotalRow=()=>this.#B(),this.unfilteredRows=()=>this.#D(),this.facetIndices=L=>this.#q(L));const z=this.#e.counts;F(z)&&(this.matchCount=()=>this.#Y("match"),this.totalCount=()=>this.#Y("total"));const X=this.#e.grandTotals;F(X)&&(this.grandTotalRow=()=>this.#G());const Q=this.#e.foregroundIdle;F(Q)&&(this.foregroundIdle=()=>this.#me(Q),this.#e.pageForegroundIdle=()=>this.#b?this.#me(Q):null);const H=this.#e;F(H.countMatching)&&F(H.streamMatching)&&(this.selectionQuery=()=>this.#_(),this.countMatching=L=>H.countMatching(L),this.streamMatching=(L,Z)=>H.streamMatching(L,Z),this.loadedRows=()=>this.#ye(),this.resident=()=>this.#N()!==null),this.#n={pageSize:this.#e.pageSize||l,maxCachedPages:this.#e.maxCachedPages||g},this.#l=t(this.#t),this.#a=new M(this.#n.pageSize*4),this.#h=I((L,Z)=>this.#T(L,Z),Y),this.#r=new O([],0,this.#n),this.#i.set(this.#r.key,this.#r),this.#d=this.#we(),F(this.#e.fetch)||q("source.remote.fetch",'source.mode "remote" requires a fetch function; the grid will stay empty.'),this.#he()}count(){const C=this.#S();return C?C.length:this.#v()}#v(){const C=this.#N();return C?C.count():(this.#fe(),this.#$e(this.#r))}#C(){if(this.#N())return!0;const C=B=>{if(B.count===null&&!B.complete)return!1;for(const z of B.children.values())if(this.#ge(z.key)&&!C(z))return!1;return!0};return C(this.#r)}pageInfo(){const C=this.#S(),B=this.totalPending();if(!C){const z=this.#v();return{page:0,pageSize:0,total:this.#C()?z:null,pageCount:1,counting:B}}return{page:C.page,pageSize:C.pageSize,total:C.total,pageCount:C.pageCount,counting:B||C.total===null&&this.#o.size>0&&this.#r.cache.loadedExtent()===0}}#S(){const C=this.#v(),B=s(this.#$("pageSize",0),this.#$("page",0),C,this.#C());if(!B)return this.#O="",null;const z=`${this.#y}:${B.offset}:${B.length}`;return z!==this.#O&&!this.#p&&(this.#O=z,B.length>0&&!this.#N()&&this.#T(B.offset,B.offset+B.length-1)),B}at(C){const B=this.#S();if(B){if(C<0||C>=B.length)return;const z=this.#P(B.offset+C);return z&&(z.index=C),z}return this.#P(C)}#P(C){const B=this.#N();if(B)return B.at(C);if(this.#fe(),C<0||C>=this.#v())return;const z=this.#Q(this.#r,C);if(!z)return;const X=this.#H(z.node,z.local);return X&&(X.index=C),X||this.#l.skeleton(C,z.node.level,z.node.cache.erroredAt(z.local))}byKey(C){const B=this.#N();if(B)return B.byKey(C);const z=this.#c.get(C);if(!z)return;const X=z.lastIndexOf(":"),Q=this.#i.get(z.slice(0,X));return Q&&this.#H(Q,Number(z.slice(X+1)))||void 0}loaded(C){const B=this.#S();if(B){if(C<0||C>=B.length)return!1;C+=B.offset}const z=this.#N();if(z)return z.loaded(C);if(C<0||C>=this.#v())return!1;const X=this.#Q(this.#r,C);return!!X&&X.node.cache.rowLoaded(X.local)}hint(C,B){if(this.#p)return;this.#b=!0;const z=this.#fe();let X=Math.max(0,Math.floor(C)),Q=Math.max(X,Math.floor(B));const H=this.#S();if(H){if(H.length===0)return;X=H.offset,Q=H.offset+H.length-1}for(const[L,Z]of this.#E(X,Q)){L.cache.protect(Z.min,Z.max);for(const ee of L.cache.evict())this.#J(L,ee)}this.#h(X,Q),z&&this.#h.flush()}#E(C,B){const z=this.#v(),X=new Map;for(let Q=C;Q<=B&&Q<z;Q++){const H=this.#Q(this.#r,Q);if(!H)continue;const L=X.get(H.node);L?(L.min=Math.min(L.min,H.local),L.max=Math.max(L.max,H.local)):X.set(H.node,{min:H.local,max:H.local})}return X.size||X.set(this.#r,{min:C,max:C}),X}#T(C,B){if(!this.#p)for(const[z,X]of this.#E(C,B)){z.cache.protect(X.min,X.max);const Q=z.cache.blockOf(X.min),H=z.cache.blockOf(X.max);for(let L=Q;L<=H&&!(z.count!==null&&L*z.cache.pageSize>=z.count);L++)z.cache.has(L)||this.#ue(z,L)}}apply(C){const B={added:[],updated:[],removed:[]};if(!C)return B;if(C.update)for(const z of C.update){const X=this.#c.get(this.#l.keyOf(z,-1));if(!X)continue;this.#a.delete(X);const Q=X.lastIndexOf(":"),H=this.#i.get(X.slice(0,Q));if(!H)continue;const L=Number(X.slice(Q+1)),Z=H.cache.blockOf(L);if(!H.cache.loaded(Z))continue;const{start:ee}=H.cache.rangeOf(Z),te=[];for(let ne=ee;ne<ee+H.cache.pageSize;ne++){const ae=H.cache.rowAt(ne);if(ae===void 0)break;te.push(ne===L?z:ae)}H.cache.fill(Z,te);const se=this.#H(H,L);se&&B.updated.push(se)}return(C.add&&C.add.length||C.remove&&C.remove.length)&&this.reload({keepExpanded:!0}),B}reload(C){this.#o.abortAll("reload"),this.#h.cancel(),C&&C.keepExpanded===!1&&this.#s.clear(),this.#le(),this.#Z("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#o.abortAll("destroyed"),this.#le(),this.#i.clear(),this.#s.clear(),this.#w&&F(this.#w.destroy)&&this.#w.destroy(),this.#w=null}expand(C){this.#s.has(C)||(this.#s.add(C),this.#Z("group:toggled",{key:C,expanded:!0}),this.#Z("model:changed",{reason:"expand",key:C}))}collapse(C){this.#s.delete(C)&&(this.#Z("group:toggled",{key:C,expanded:!1}),this.#Z("model:changed",{reason:"collapse",key:C}))}expandedKeys(){return[...this.#s]}pivotFields(){return this.#u}pivot(){this.#fe();const C=this.#f;if(!C||!C.keys.size||!this.#$("pivotBy",[]).length)return null;if(!C.result){const B=b((this.#t.config||{}).locale),z=[...C.keys.entries()].sort((Q,H)=>j(Q[1],H[1],B)),X=z.map(([Q])=>Q);C.result={keys:z.map(([,Q])=>Q),paths:X,fields:this.#je(X),groupPaths:[],columns:X.length*Math.max(1,this.#ke().length),values:C.cells,cells:C.cells,error:null}}return C.result}invalidateHandles(){this.#w&&(F(this.#w.invalidateHandles)&&this.#w.invalidateHandles(),F(this.#w.invalidate)&&this.#w.invalidate("filter"))}#M(){const C=this.#e.fullFrame;return F(C)?C():null}#N(){const C=this.#M();return C?(this.#w||(this.#w=new p({mode:"memory"},this.#R())),C.version!==this.#A&&(this.#w.setRows(C.rows),this.#A=C.version),this.#w):null}#R(){const C=this.#t,B=C.state||{};return{...C,state:{...B,page:()=>0,pageSize:()=>0}}}#F(){const C=this.#N();return C?C.filteredIndices():new Uint32Array(0)}#V(){const C=this.#N();return C?C.unfilteredIndices():new Uint32Array(0)}#W(C){const B=this.#N();return B?B.handleFor(C):void 0}#L(){const C=this.#N();return C?C.display():[]}#q(C){const B=this.#N();return B&&F(B.facetIndices)?B.facetIndices(C):new Uint32Array(0)}#B(){const C=this.#N();return C&&F(C.grandTotalRow)?C.grandTotalRow():null}#Y(C){const B=this.#N();if(B){const H=C==="match"?B.matchCount:B.totalCount;if(F(H))return H.call(B)}const z=this.#e.counts,X=F(z)?z():null,Q=X?X[C]:null;return typeof Q=="number"?Q:this.#v()}#G(){const C=this.#N();if(C&&F(C.grandTotalRow))return C.grandTotalRow();if((this.#t.config||{}).grandTotalRow!=="bottom")return null;const z=this.#e.grandTotals,X=F(z)?z():null;return!X||!X.totals?null:this.#l.grandTotal(X.totals,X.leafCount||0)}#D(){const C=this.#N();if(C&&F(C.unfilteredRows))return C.unfilteredRows();const B=[],z=this.count();for(let X=0;X<z;X++){const Q=this.at(X);Q&&B.push(Q)}return B}#_(){const C=this.#$("quick",""),B={protocol:V,groupPath:[],groupValues:[],groupBy:[],totals:[],totalFns:{},pivotBy:[],pivotMode:!1,filters:f(this.#$("filters",null),this.#pe()),sort:this.#$("sort",[]),context:this.#$("context",null)};C&&(B.quick=C);const z=this.#$("where",null);return z&&z.active&&(B.where=z),B}#ye(){const C=this.#$("groupBy",[]).length,B=[];for(const z of this.#i.values())if(!(z.level!==C&&!z.flat))for(const X of z.cache.ids()){if(!z.cache.loaded(X))continue;const{start:Q,end:H}=z.cache.rangeOf(X);for(let L=Q;L<H&&z.cache.rowLoaded(L);L++){const Z=this.#H(z,L);Z&&!Z.group&&B.push(Z)}}return B}loadedCount(){const C=this.#N();if(C){const X=C.matchCount();return typeof X=="number"?X:C.count()}this.#fe();const B=this.#$("groupBy",[]).length;let z=0;for(const X of this.#i.values())if(!(X.level!==B&&!X.flat))for(const Q of X.cache.ids()){if(!X.cache.loaded(Q))continue;const H=X.cache.fillOf(Q);typeof H=="number"&&(z+=H)}return z}residentRows(){const C=this.#N();return C?C.display():this.#$("groupBy",[]).length>0?null:(this.#fe(),this.#ye())}#ce(C,B,z){const{start:X,end:Q}=C.cache.rangeOf(B),H=this.#$("groupBy",[]),L=this.#$("pivotBy",[]),Z=this.#$("quick",""),ee=this.#ke(),te={protocol:V,range:{start:X,end:Q},groupPath:C.path,groupValues:C.values,groupBy:H,totals:ee,totalFns:this.#Ie(ee),pivotBy:L,pivotMode:L.length>0,filters:f(this.#$("filters",null),this.#pe()),sort:this.#$("sort",[]),context:this.#$("context",null),signal:z};Z&&(te.quick=Z);const se=this.#$("where",null);return se&&se.active&&(te.where=se),te}async#ue(C,B){if(!F(this.#e.fetch))return;if(!this.#m){this.#m=!0;const H=this.#g;this.#g=[],queueMicrotask(()=>{for(const L of H)L()})}const z=this.#o.begin(`${C.key}:${B}`);C.cache.begin(B,z);const X=this.#d,{start:Q}=C.cache.rangeOf(B);try{const H=await this.#e.fetch(this.#ce(C,B,z.signal));if(!z.current||X!==this.#d||this.#p)return;z.settle();const L=H&&H.rows||[];if(!!(H&&H[_])&&!C.flat){C.flat=!0,C.children.clear();for(const[se,ne]of[...this.#c])ne.startsWith(`${C.key}:`)&&(this.#a.delete(ne),this.#c.delete(se))}C.cache.fill(B,L),C.failed=!1;for(let se=0;se<L.length;se++)this.#a.delete(`${C.key}:${Q+se}`);const ee=H&&typeof H.count=="number"?H.count:H&&typeof H.total=="number"?H.total:null,te=H&&F(H.pendingTotal?.then)?H.pendingTotal:null;ee!==null?(C.count=ee,C.complete=!0):L.length<C.cache.pageSize?(C.count=Q+L.length,C.complete=!0):te&&(C.counting=!0,C.announced=null),H&&Array.isArray(H.pivotFields)&&this.#Me(H.pivotFields),H&&H.pivot&&typeof H.pivot=="object"&&this.#ie(H.pivot),this.#Z("model:changed",{reason:"page",groupPath:C.path,block:B}),this.#Z("rows:changed",{companion:!0,reason:"page",groupPath:C.path,block:B}),this.#se(C),te&&this.#Ne(C,te,X)}catch(H){if(z.settle(),S(H))return;C.cache.failed(B,H),C.failed=!0;const{end:L}=C.cache.rangeOf(B);for(let Z=Q;Z<L;Z++)this.#a.delete(`${C.key}:${Z}`);this.#Z("model:changed",{reason:"page-error",groupPath:C.path,block:B}),this.#Z("source:error",{error:H,groupPath:C.path,block:B})}}async#Ne(C,B,z){let X;try{X=await B}catch(Q){if(z!==this.#d||this.#p)return;C.counting=!1,S(Q)||(C.failed=!0),S(Q)||this.#Z("source:error",{error:Q,groupPath:C.path});return}z!==this.#d||this.#p||(C.counting=!1,typeof X=="number"&&(C.count=X,C.complete=!0,this.#se(C),this.#Z("model:changed",{reason:"total",count:X,groupPath:C.path})))}#se(C){typeof C.count!="number"||!C.complete||C.announced!==C.count&&(C.announced=C.count,this.#Z("source:total",{total:C.count,groupPath:C.path}))}#me(C){if(this.#p)return null;this.#fe();const B=this.#m?null:new Promise(L=>{this.#g.push(L),setTimeout(L,$)}),z=C();if(!B&&!z)return null;const X=(async()=>{B&&await B;for(let L=C();L;L=C())await L})();let Q;const H=new Promise(L=>{Q=setTimeout(L,$)});return Promise.race([X,H]).then(()=>clearTimeout(Q))}totalPending(){if(this.#r.failed)return!1;if(this.#r.counting===!0)return!0;if(this.#N())return!1;this.#fe();const C=this.#r;return C.count===null&&!C.complete&&C.cache.loadedExtent()===0}totalFailed(){return this.#r.failed===!0}#Me(C){C.length===this.#u.length&&C.every((B,z)=>B===this.#u[z])||(this.#u=C,this.#Z("column:pivoted",{pivotFields:C,remote:!0}))}#xe(){const C=this.#t.config||{};return C.pivot&&C.pivot.separator||v}#je(C){const B=this.#xe(),z=this.#ke();if(!z.length)return C.slice();const X=[];for(const Q of C)for(const H of z)X.push(`${Q}${B}${H}`);return X}#ie(C){const B=this.#xe();this.#f||(this.#f={keys:new Map,cells:new Map,result:null});const z=this.#f;let X=!1;const Q=L=>{const Z=Array.isArray(L)?L:[L],ee=w(Z,B);return z.keys.has(ee)||(z.keys.set(ee,Z),X=!0),ee},H=this.#$("groupBy",[]).length>0;for(const L of Array.isArray(C.axis)?C.axis:[])Q(L);for(const L of Array.isArray(C.cells)?C.cells:[]){if(!L||typeof L!="object")continue;const Z=Q(L.pivot);if(H&&!(Array.isArray(L.group)&&L.group.length))continue;const ee=w(Array.isArray(L.group)?L.group:[],B);for(const[te,se]of Object.entries(L.values||{}))z.cells.set(h(ee,Z,te),se)}z.result=null,X&&this.#Me((this.pivot()||{fields:[]}).fields)}#$e(C){let B=this.#oe(C);for(const z of C.children.values())this.#ge(z.key)&&(B+=this.#$e(z));return B}#oe(C){if(C.count!==null)return C.count;const B=C.cache.loadedExtent();return C.complete?B:C.row&&C.row.leafCount>0?C.level>=this.#$("groupBy",[]).length?Math.max(B,C.row.leafCount):B===0?1:Math.min(B+C.cache.pageSize,Math.max(B,C.row.leafCount)):B+C.cache.pageSize}#Q(C,B){let z=B,X=0;const Q=[...C.children.entries()].filter(([,L])=>this.#ge(L.key)).sort((L,Z)=>L[0]-Z[0]);for(const[L,Z]of Q){const ee=L-X+1;if(z<ee)return{node:C,local:X+z};z-=ee,X=L+1;const te=this.#$e(Z);if(z<te)return this.#Q(Z,z);z-=te}const H=this.#oe(C);return X+z<H?{node:C,local:X+z}:null}#H(C,B){const z=`${C.key}:${B}`,X=this.#a.get(z);if(X)return X;const Q=C.cache.rowAt(B);if(Q===void 0)return null;const H=this.#$("groupBy",[]);let L;if(C.level<H.length&&!C.flat){const Z=H[C.level],ee=this.#f!==null&&C.level===H.length-1&&this.#$("pivotBy",[]).length>0,te=this.#de(Q,Z),se=te==null,ne=[...C.path,se?"":String(te)],ae=[...C.keyPath,se?null:String(te)];if(L=this.#l.group({path:ne,keyPath:ae,column:Z,value:te,level:C.level,parent:C.row,leafCount:Number(Q.leafCount)||0,expanded:ee?!1:this.#ge(o(ae)),...ee?{hasChildren:!1}:{}}),L.totals=this.#U(Q),L.data=Q,!ee){let de=this.#i.get(L.key);de?de.row=L:(de=new O(ne,C.level+1,this.#n,ae),de.row=L,this.#i.set(de.key,de)),de.values=[...C.values,te],C.children.set(B,de)}}else L=this.#l.leaf(Q,B,C.level,C.row);return this.#a.set(z,L),this.#c.set(L.key,z),L}#U(C){const B=C||{};if(B.totals&&typeof B.totals=="object")return B.totals;const z={};for(const X of this.#ke())Object.hasOwn(B,X)&&(z[X]=B[X]);return z}#J(C,B){const{start:z,end:X}=C.cache.rangeOf(B);for(let Q=z;Q<X;Q++){const H=`${C.key}:${Q}`,L=this.#a.peek(H);L&&this.#c.delete(L.key),this.#a.delete(H)}}#fe(){const C=this.#we();return C===this.#d?!1:(this.#d=C,this.#o.abortAll("query"),this.#le(),this.#m=!1,this.#Z("model:changed",{reason:"query"}),!0)}#le(){for(const C of this.#i.values())C.cache.clear(),C.count=null,C.complete=!1,C.announced=null,C.counting=!1,C.failed=!1,C.children.clear(),C.flat=!1;this.#a.clear(),this.#c.clear(),this.#y++,this.#f=null}#we(){const C=this.#$("where",null);return`${n({filters:this.#$("filters",null),sort:this.#$("sort",[]),quick:this.#$("quick",""),groupBy:this.#$("groupBy",[]),pivotBy:this.#$("pivotBy",[]),context:this.#$("context",null)})}|${C?C.version:0}`}#ge(C){const B=this.#$("expanded",null);return B?F(B.has)?B.has(C):Array.prototype.includes.call(B,C):this.#s.has(C)}#ke(){const C=this.#$("totals",[]);if(C&&C.length)return[...C];const B=this.#t.columns;return!B||!F(B.all)?[]:B.all().filter(z=>!!z.total).map(z=>z.id)}#Ie(C){const B=this.#t.columns,z={};if(!B||!F(B.get))return z;for(const X of C){const Q=B.get(X);if(!Q)continue;const H=Q.groupTotal!=null?Q.groupTotal:Q.total;typeof H=="string"&&(z[X]=H)}return z}#de(C,B){const z=this.#t.columns,X=z&&F(z.get)?z.get(B):void 0;return X&&F(X.getValue)?X.getValue(C):C?.[B]}#he(){m(this.#t)}#pe(){const C=this.#t.config||{};return{tz:C.timeZone,weekStartsOn:C.weekStartsOn}}#$(C,B){const z=this.#t.state;if(z&&F(z[C])){const X=z[C]();return X??B}return B}#Z(C,B){const z=this.#t.emit;F(z)&&z(C,B)}}}),Be("packages/core/src/source/gapbuffer.js",function(e,D){"use strict";Object.defineProperty(e,"GapBuffer",{enumerable:!0,get:function(){return M}});const re=64;class M{#e;#t=0;#n=0;constructor(F=re){this.#e=new Uint32Array(Math.max(1,F)),this.#n=this.#e.length}static from(F,x=re){const q=new M(F.length+Math.max(1,x));return q.#e.set(F,0),q.#t=F.length,q.#n=q.#e.length,q}get length(){return this.#t+(this.#e.length-this.#n)}get capacity(){return this.#e.length}at(F){return F<0||F>=this.length?0:F<this.#t?this.#e[F]:this.#e[F+(this.#n-this.#t)]}insert(F,x){const q=F<0?0:F>this.length?this.length:F;this.#r(q),this.#t===this.#n&&this.#i(),this.#e[this.#t++]=x}push(F){this.insert(this.length,F)}removeAt(F){return!Number.isInteger(F)||F<0||F>=this.length?!1:(this.#r(F),this.#n++,!0)}toArray(){const F=new Uint32Array(this.length);return F.set(this.#e.subarray(0,this.#t),0),F.set(this.#e.subarray(this.#n),this.#t),F}clear(){this.#t=0,this.#n=this.#e.length}#r(F){if(F!==this.#t)if(F<this.#t){const x=this.#t-F;this.#e.copyWithin(this.#n-x,F,this.#t),this.#t=F,this.#n-=x}else{const x=F-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+x),this.#t=F,this.#n+=x}}#i(){const F=this.#e.length-this.#n,x=new Uint32Array(Math.max(this.#e.length*2,this.#e.length+re));x.set(this.#e.subarray(0,this.#t),0),x.set(this.#e.subarray(this.#n),x.length-F),this.#e=x,this.#n=x.length-F}}}),Be("packages/core/src/store/ingest.js",function(e,D){"use strict";Object.defineProperty(e,"INGEST_DEFAULTS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"inferKind",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"decideText",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"createReaders",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"Ingest",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return f}});const re=D("packages/core/src/internal/schedule.js"),M=re.now,G=re.nextFrame,F=D("packages/core/src/internal/warn.js"),x=F.infoOnce,q=F.warnOnce,I=D("packages/core/src/internal/predicates.js").isFunction,R=D("packages/core/src/internal/paths.js").pathGetter,k=D("packages/core/src/store/columnstore.js").ColumnStore,y=Object.freeze({chunkMs:8,chunkRows:512,sampleSize:100,dictionaryRatio:.1,columnarBelow:5e3,initialCapacity:1024});function l(n,m={}){if(m.multi)return"multi";if(n.length===0)return"object";let r=0,s=0,d=0,p=0,u=0;for(let a=0;a<n.length;a++){const h=n[a];typeof h=="number"?r++:typeof h=="boolean"?s++:typeof h=="string"?d++:h instanceof Date?p++:Array.isArray(h)&&u++}const b=n.length;return r===b?"float64":s===b?"bitset":p===b?"float64":d===b?"text":u===b?"multi":"object"}function g(n,m,r){return m<=0||n<r*m?"dictionary":"object"}function i(n,m,r){const s=new Map,d=new Map;for(const V of n){if(V.computed)continue;const Y=I(V.read)?V.read:R(V.field||V.id);d.set(V.id,Y),s.set(V.id,Y)}const p=m?.order??[],u=m?.fns??{},b=m?.deps??{},a=m?.wrapDeps??null,h=p.filter(V=>I(u[V])),w=h.some(V=>b[V]==="*");let v=new WeakMap;const A=V=>{const Y={};if(w)for(const[$,j]of d)Y[$]=j(V);for(const $ of h){const j=b[$];let E;if(j==="*")E=Y;else{E={};const O=j||[];for(let N=0;N<O.length;N++){const T=O[N];E[T]=T in Y?Y[T]:d.get(T)?.(V)}}Y[$]=u[$](a?a(E,$):E,{data:V,row:null,column:null,grid:null,context:r})}return Y},_=V=>{if(V===null||typeof V!="object"&&typeof V!="function")return A(V);let Y=v.get(V);return Y===void 0&&(Y=A(V),v.set(V,Y)),Y};for(const V of h)s.set(V,Y=>_(Y)[V]);return{readers:s,reset(){v=new WeakMap}}}class t{spec;read;kind;inferred;nullable;candidate=!1;distinct=null;change=null;reason="";constructor(m,r){this.spec=m,this.read=r,this.kind="object",this.inferred=!1,this.nullable=m.nullable!==!1}}class o{#e;#t=[];#n=null;#r;#i=0;#s;#o=!1;#l=!1;#a=0;#c;constructor(m,r={},s={}){this.#e=Array.isArray(m)?m:Array.from(m||[]),this.#s={...y,...s};const d=r.columns??[];this.#r=i(d,r.computed??null,r.context),this.#c=this.#e.length>=this.#s.columnarBelow,this.#u(d,r.computed??null),this.#n=new k(this.#t.map(p=>({id:p.spec.id,kind:p.kind,nullable:p.nullable,read:p.read,dictionary:p.spec.dictionary})),{initialCapacity:this.#s.initialCapacity,columnarBelow:this.#s.columnarBelow})}get store(){return this.#n}get done(){return this.#o||this.#l}get progress(){return this.#i}slice(){if(this.done)return!1;if(this.#s.signal?.aborted)return this.#l=!0,!1;const m=M(),{chunkMs:r,chunkRows:s}=this.#s,d=this.#e.length;do{const p=Math.min(this.#i+s,d);this.#n.append(this.#e.slice(this.#i,p)),this.#f(this.#i,p),this.#i=p,this.#r.reset(),this.#h(!1)}while(this.#i<d&&M()-m<r);return this.#a+=M()-m,this.#s.onProgress?.({loaded:this.#i,total:d}),this.#i>=d?(this.#h(!0),this.#o=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(m=>({id:m.spec.id,kind:m.kind,nullable:m.nullable,read:m.read,dictionary:m.spec.dictionary})),decisions:this.#t.map(m=>({id:m.spec.id,kind:m.kind,nullable:m.nullable,inferred:m.inferred,distinct:m.candidate||m.change?this.#d(m):null,change:m.change,reason:m.reason})),count:this.#n.count,elapsed:this.#a,cancelled:this.#l}}#u(m,r){const s=this.#e,d=Math.min(this.#s.sampleSize,s.length),p=this.#s.dictionaryRatio,u=r?.pure instanceof Set?r.pure:new Set(r?.pure??r?.order??[]);for(const b of m){if(!b||!b.id)continue;if(b.computed&&(b.pure===!1||r&&!u.has(b.id))){q(`ingest.impure.${b.id}`,`column "${b.id}" is an impure computed column and is not materialised into the store`);continue}const a=this.#r.readers.get(b.id)??(I(b.read)?b.read:R(b.field||b.id)),h=new t(b,a);if(b.kind)h.kind=b.kind,h.reason="declared by the caller";else if(b.dictionary)h.kind=b.multi?"multi":"dictionary",h.reason="value table supplied (lookup column)";else{const w=[];for(let A=0;A<d&&w.length<this.#s.sampleSize;A++){const _=a(s[A]);_!=null&&w.push(_)}h.inferred=!0;const v=l(w,{multi:b.multi});if(v==="text"){const A=new Set(w).size;h.kind=g(A,w.length,p),h.candidate=this.#c,h.reason=`sampled ${A} distinct in ${w.length}`}else h.kind=v,h.reason=`inferred from ${w.length} sampled values`,v==="object"&&w.length&&x(`ingest.mixed.${b.id}`,`column "${b.id}" holds mixed or unrecognised value types; storing as an object array. Declare a type to avoid this.`);h.kind==="object"&&h.candidate&&(h.distinct=new Set(w))}this.#t.push(h)}}#f(m,r){const s=this.#e;for(const d of this.#t){if(!d.candidate||!d.distinct)continue;const p=d.distinct;for(let u=m;u<r;u++){const b=d.read(s[u]);b!=null&&p.add(b)}}}#d(m){if(m.distinct)return m.distinct.size;const r=this.#n.column(m.spec.id);return r?.dict?r.dict.size:0}#h(m){const r=this.#s.dictionaryRatio,s=this.#e.length;for(const d of this.#t){if(!d.candidate)continue;const p=this.#d(d);if(d.kind==="dictionary"&&p>=r*s){const u=this.#n.column(d.spec.id);d.distinct=new Set(u?.dict?u.dict.values():[]),this.#n.convert(d.spec.id,"object"),d.kind="object",d.change="demoted",d.reason=`${p} distinct values is at or above ${r*100}% of ${s} rows`;continue}if(d.kind==="object"&&p>=r*s){d.candidate=!1,d.distinct=null,d.reason=`${p} distinct values is at or above ${r*100}% of ${s} rows`;continue}m&&d.kind==="object"&&p<r*s&&(this.#n.convert(d.spec.id,"dictionary"),d.kind="dictionary",d.change=d.change==="demoted"?null:"promoted",d.reason=`${p} distinct values is below ${r*100}% of ${s} rows`,d.distinct=null),m&&(d.candidate=!1)}}}async function c(n,m={},r={}){const s=new o(n,m,r),d=r.scheduler?.frame??G;for(;s.slice();)await new Promise(p=>{d(p)});return s.result()}function f(n,m={},r={}){const s=new o(n,m,{...r,chunkMs:1/0});for(;s.slice(););return s.result()}}),Be("packages/core/src/store/columnpack.js",function(e,D){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return g}});const M=D("packages/core/src/internal/paths.js").pathGetter,G=D("packages/core/src/store/ingest.js"),F=G.inferKind,x=G.decideText,q=G.INGEST_DEFAULTS,I=D("packages/core/src/store/columnstore.js").toFloat,K=new Set(["float64","int32","bitset","dictionary","object","multi"]);function R(i){if(!Array.isArray(i)||i.length===0)return!1;for(const t of i)if(!t||typeof t.id!="string"||typeof t.field!="string"||t.field===""||t.kind&&!K.has(t.kind))return!1;return!0}function S(i){const t=I(i);return Number.isFinite(t)?t|0:0}function k(i){return i==null?[]:Array.isArray(i)?i:[i]}function y(i,t,o,c){if(i.kind)return i.kind;const f=[];for(let r=0;r<t.length&&f.length<q.sampleSize;r++){const s=t[r];s!=null&&f.push(s)}const n=F(f,{multi:i.multi});if(n!=="text")return n;const m=new Set(f).size;return x(m,f.length,c)}function l(i,t,o={}){const c=t.length|0,f=o.dictionaryRatio??q.dictionaryRatio,n=[];for(const m of i){const r=M(m.field||m.id),s=m.nullable!==!1,d=new Array(c);for(let h=0;h<c;h++){const w=r(t[h]);d[h]=w===void 0?null:w}const p=y(m,d,c,f),u=s?new Uint8Array(c+7>>3):null,b=h=>{u&&(u[h>>3]|=1<<(h&7))};let a;switch(p){case"float64":{const h=new Float64Array(c);for(let w=0;w<c;w++){const v=d[w],A=v===null;A||b(w),h[w]=A?NaN:I(v)}a={id:m.id,kind:p,nullable:s,values:h,presence:u,offsets:null,table:null};break}case"int32":{const h=new Int32Array(c);for(let w=0;w<c;w++){const v=d[w],A=v===null;A||b(w),h[w]=A?0:S(v)}a={id:m.id,kind:p,nullable:s,values:h,presence:u,offsets:null,table:null};break}case"bitset":{const h=new Uint8Array(c+7>>3);for(let w=0;w<c;w++){const v=d[w],A=v===null;A||b(w),!A&&v&&(h[w>>3]|=1<<(w&7))}a={id:m.id,kind:p,nullable:s,values:h,presence:u,offsets:null,table:null};break}case"dictionary":{const h=new Uint32Array(c),w=[],v=new Map;for(let A=0;A<c;A++){const _=d[A];if(_===null){h[A]=0;continue}b(A);let V=v.get(_);V===void 0&&(V=w.length,w.push(_),v.set(_,V)),h[A]=V}a={id:m.id,kind:p,nullable:s,values:h,presence:u,offsets:null,table:w};break}case"multi":{const h=[],w=new Map,v=new Uint32Array(c+1),A=[];for(let _=0;_<c;_++){const V=d[_];v[_]=A.length,V===null||b(_);const $=k(V);for(let j=0;j<$.length;j++){const E=$[j];let O=w.get(E);O===void 0&&(O=h.length,h.push(E),w.set(E,O)),A.push(O)}}v[c]=A.length,a={id:m.id,kind:p,nullable:s,values:Int32Array.from(A),presence:u,offsets:v,table:h};break}default:{const h=new Array(c);for(let w=0;w<c;w++){const v=d[w];v!==null&&b(w),h[w]=v}a={id:m.id,kind:"object",nullable:s,values:h,presence:u,offsets:null,table:null};break}}n.push(a)}return{count:c,columns:n}}function g(i){const t=[];if(!i||!Array.isArray(i.columns))return t;const o=c=>{ArrayBuffer.isView(c)&&c.buffer&&!t.includes(c.buffer)&&t.push(c.buffer)};for(const c of i.columns)o(c.values),o(c.presence),o(c.offsets);return t}}),Be("packages/core/src/source/stream.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_PROMOTE_BELOW",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"createStreamSource",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return O}});const M=D("packages/core/src/internal/lru.js").Lru,F=D("packages/core/src/internal/predicates.js").isFunction,x=D("packages/core/src/internal/schedule.js"),q=x.now,W=x.nextFrame,I=x.cancelFrame,K=x.whenIdle,S=D("packages/core/src/internal/compare.js").defaultCompare,k=D("packages/core/src/internal/warn.js"),y=k.warnOnce,l=k.infoOnce,i=D("packages/core/src/internal/paths.js").getPath,t=D("packages/core/src/source/abort.js"),o=t.createAbortScope,c=t.isAbortError,f=D("packages/core/src/source/rows.js"),n=f.createRowFactory,m=f.lazyRowView,s=D("packages/core/src/source/gapbuffer.js").GapBuffer,p=D("packages/core/src/source/memory.js").createMemorySource,b=D("packages/core/src/source/filterwire.js").querySignature,h=D("packages/core/src/store/columnpack.js").isPortableSchema,w=25e4,v=Symbol("lattice.stream.storeBacked"),A=8,_=.1,V=1e3,Y=50;function $(N){return Math.min(V,Math.max(Y,Math.floor(N/4)))}function j(N){if(N instanceof Date)return N.getTime();if(typeof N=="number")return Number.isFinite(N)?N:NaN;if(typeof N=="string"){const T=N.trim();if(!T)return NaN;const C=Date.parse(T);return Number.isNaN(C)?Number(T):C}return NaN}function E(N,T){return new O(N,T)}class O{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#i=[];#s=null;#o;#l;#a=new Map;#c=o();#u={loaded:0,estimated:void 0};#f=null;#d=0;#h=0;#p=0;#m=0;#g=null;#b=null;#y=null;#O=!1;#w=!1;#A=!1;#v=!1;#C="";#S=0;#P=0;#E=0;#T=null;#M=1/0;#N=!1;#R=null;#F=null;#V=null;#W=null;#L=!1;#q=0;#B=0;#Y=!1;constructor(T,C){this.#e=T||{mode:"stream"},this.#t=C||{},this.#o=n(this.#t),this.#l=new M(4096),this.#C=this.#Ue();const B=(this.#t.config||{}).ingest;this.#L=!!B&&B.retainSource===!1,F(this.#e.open)||y("source.stream.open",'source.mode "stream" requires an open function; the grid will stay empty.'),this.#e.autoStart!==!1&&queueMicrotask(()=>this.start());const z=Number(this.#e.poll);Number.isFinite(z)&&z>0&&(this.#W=setInterval(()=>{this.#v||this.reload()},z),this.#W&&F(this.#W.unref)&&this.#W.unref()),this.#D()}#G(){const T=Number(this.#e.maxAge);return Number.isFinite(T)&&T>0?T:0}#D(){const T=this.#G();if(!T)return;const C=this.#e.ageBy;F(C)?this.#F=C:typeof C=="string"&&C?this.#F=B=>i(B,C):this.#F=null,this.#T=[],this.#R=setInterval(()=>{this.#v||this.#_()&&(this.#fe(),this.#re())},$(T)),this.#R&&F(this.#R.unref)&&this.#R.unref()}#_(){const T=this.#G();return!T||!this.#T?!1:this.#N?!0:this.#M<Date.now()-T*(1+_)}#ye(T,C){if(!this.#T)return;const B=this.#F?j(this.#F(C)):Date.now();this.#T[T]=B,Number.isNaN(B)||(B<this.#M&&(this.#M=B),B<Date.now()-this.#G()&&(this.#N=!0))}#ce(){return this.#Oe("groupBy",[]).length>0?!0:!!this.#Oe("pivotMode",!1)&&this.#Oe("pivotBy",[]).length>0}#ue(){if(this.#g||this.#v)return;const T=this.#ce();if(T&&!this.#b){this.#b=p({mode:"memory",rows:this.#n},this.#Ne()),this.#O=!1;return}!T&&this.#b&&(this.#b.destroy(),this.#b=null)}#Ne(){if(this.#y)return this.#y;const T=this,C={liveIndices:()=>T.#se(),live:B=>T.#n[B]!==void 0,source:B=>T.#Ae(B),get physical(){return T.#n.length}};return this.#L&&(C.column=B=>{const z=T.#t.store;return z&&F(z.column)?z.column(B):void 0}),this.#y=Object.create(this.#t,{store:{value:C,enumerable:!0,configurable:!0}}),this.#y}#se(){const T=new Uint32Array(this.#n.length);let C=0;for(let B=0;B<this.#n.length;B++)this.#n[B]!==void 0&&(T[C++]=B);return T.subarray(0,C)}#me(){return this.#g?this.#g:this.#b?(this.#O&&(this.#O=!1,this.#b.setRows(this.#n)),this.#b):null}invalidate(T="filter"){if(this.#g){this.#g.invalidate(T);return}this.#ue(),this.#b&&this.#b.invalidate(T),(T==="filter"||T==="sort")&&this.#ke()}count(){const T=this.#me();return T?T.count():this.#r?this.#r.length:this.#S}matchCount(){const T=this.#me();return T&&F(T.matchCount)?T.matchCount():this.#r?this.#r.length:this.#S}totalCount(){const T=this.#me();return T&&F(T.totalCount)?T.totalCount():this.#S}unfilteredRows(){const T=this.#me();if(T&&F(T.unfilteredRows))return T.unfilteredRows();const C=[];for(let B=0;B<this.#n.length;B++){if(!this.#n[B])continue;const z=this.#k(B);z&&C.push(z)}return C}at(T){const C=this.#me();if(C)return C.at(T);if(T<0||T>=this.count())return;const B=this.#r?this.#r.at(T):T,z=this.#k(B);return z.index=T,z}byKey(T){const C=this.#me();if(C)return C.byKey(T);const B=this.#a.get(T);return B===void 0?void 0:this.#k(B)}leavesOf(T){const C=this.#me();return C&&F(C.leavesOf)?C.leavesOf(T):[]}loaded(T){return T>=0&&T<this.count()}hint(T,C){if(this.#g){this.#g.hint(T,C);return}this.#Me(),this.#p=Math.max(0,Math.floor(T))}#Me(){this.#v||this.#Ue()===this.#C||this.reload()}display(){const T=this.#me();return T?T.display():m(()=>this.count(),C=>this.at(C))}apply(T){if(this.#g)return this.#g.apply(T);const C={added:[],updated:[],removed:[]};if(!T)return C;if(T.update){let B=!1;for(const z of T.update){const X=this.#a.get(this.#o.keyOf(z,-1));if(X===void 0)continue;const Q=this.#he(X);this.#L?this.#He(X,z):this.#n[X]=z,this.#l.delete(X),this.#pe(X,Q),this.#T&&(this.#ye(X,z),B=!0),this.#O=!0,C.updated.push(this.#k(X))}B&&this.#fe()}if(T.add&&T.add.length){const B=this.#U(T.add);for(const z of B)C.added.push(this.#k(z))}return T.remove&&T.remove.length&&y("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#re(),C}reload(T){this.#c.abortAll("reload"),this.#Xe(),this.#b&&(this.#b.destroy(),this.#b=null),this.#O=!1,this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear(),this.#g=null,this.#S=0,this.#P=0,this.#E=0,this.#T&&(this.#T=[]),this.#M=1/0,this.#N=!1,this.#w=!1,this.#A=!1,this.#u={loaded:0,estimated:void 0},this.#C=this.#Ue(),this.#Se("model:changed",{reason:"reload"}),this.start()}destroy(){this.#v=!0,this.#W!==null&&(clearInterval(this.#W),this.#W=null),this.#R!==null&&(clearInterval(this.#R),this.#R=null),this.#T=null,this.#c.abortAll("destroyed"),this.#Xe(),this.#f!==null&&(this.#ve(this.#f),this.#f=null),this.#b&&(this.#b.destroy(),this.#b=null),this.#g&&this.#g.destroy(),this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear()}async start(){if(this.#A||this.#v||!F(this.#e.open))return;this.#A=!0;const T=this.#c.begin("stream");this.#ke(),this.#ue();let C;try{C=this.#e.open({sort:this.#Oe("sort",[]),filters:this.#Oe("filters",null),quick:this.#Oe("quick","")||void 0,context:this.#Oe("context",null),signal:T.signal})}catch(z){this.#Se("source:error",{error:z});return}const B=F(C[Symbol.asyncIterator])?C[Symbol.asyncIterator]():C[Symbol.iterator]();this.#V=B;try{for(;;){const z=await B.next();if(!T.current||this.#v)return;if(z.done){this.#ne();return}if(await this.#xe(z.value,T),!T.current||this.#v)return;if(z.value&&z.value.done){this.#ne();return}if(await this.#Be(),!T.current||this.#v)return}}catch(z){if(c(z))return;this.#Se("source:error",{error:z})}finally{T.settle()}}progress(){return{loaded:this.#u.loaded,estimated:this.#u.estimated,done:this.#w,live:this.#S,evicted:this.#P}}promoted(){return this.#g!==null}memorySource(){return this.#g}invalidateHandles(){const T=this.#me();T&&(F(T.invalidateHandles)&&T.invalidateHandles(),F(T.invalidate)&&T.invalidate("sort"))}renderCount(){return this.#d}ingestStats(){return{worker:this.#q,inline:this.#B,storeBacked:this.#L}}#xe(T,C){if(!T)return;const B=T.rows;if(B&&B.length&&this.#ie(B))return this.#oe(T,C);const z=q();B&&B.length&&(this.#U(B),this.#B++),this.#je(T),this.#h+=q()-z,this.#re()}#je(T){this.#u.loaded=T.progress&&typeof T.progress.loaded=="number"?T.progress.loaded:this.#n.length,T.progress&&typeof T.progress.estimated=="number"&&(this.#u.estimated=T.progress.estimated)}#ie(T){if(this.#Y||this.#g)return!1;const C=this.#Q();if(!C)return!1;const B=this.#t.store;if(!B||!F(B.appendPacked))return!1;const z=this.#H();return!z||!h(z)?(this.#Y=!0,l("source.stream.ingest-worker","stream ingest.useWorker is on but a column reads through a closure (a computed or date column); columnizing on the main thread instead."),!1):T.length<C.threshold?!1:!this.#$e(T)}#$e(T){if(!this.#o.keyed)return!1;const C=new Set;for(let B=0;B<T.length;B++){const z=this.#o.keyOf(T[B],this.#n.length+B);if(z!=null){if(C.has(z)||this.#a.has(z))return!0;C.add(z)}}return!1}async#oe(T,C){const B=T.rows,z=this.#Q(),X=this.#H();let Q;try{Q=await z.columnize(X,B,{key:"ingest:stream",signal:C&&C.signal})}catch(te){if(c(te)||(y("source.stream.columnize","worker columnization failed; columnizing on the main thread",te),this.#Y=!0,C&&(!C.current||this.#v)))return;this.#U(B),this.#B++,this.#je(T),this.#re();return}if(C&&(!C.current||this.#v))return;const H=this.#t.store,L=this.#L?void 0:B,{from:Z}=H.appendPacked(Q,L),ee=Q.count|0;for(let te=0;te<ee;te++){const se=Z+te,ne=B[te],ae=this.#o.keyed?this.#o.keyOf(ne,se):null;if(this.#n[se]=this.#L?v:ne,this.#S++,this.#ye(se,ne),ae!==null&&this.#a.set(ae,se),!this.#r||!this.#Ie(se))continue;const de=this.#$(se);this.#r.insert(de,se),de<=this.#p&&this.#m++}this.#O=!0,this.#fe(),this.#q++,this.#je(T),this.#re()}#Q(){const T=this.#t.ingestWorker;return F(T)?T():null}#H(){const T=this.#t.storeSchema;return F(T)?T():null}#U(T){const C=[],B=this.#t.store,z=new Array(T.length),X=[],Q=new Set;for(let L=0;L<T.length;L++){const Z=this.#o.keyed?this.#o.keyOf(T[L],this.#n.length+X.length):null;z[L]=Z,!(Z!==null&&(this.#a.has(Z)||Q.has(Z)))&&(Z!==null&&Q.add(Z),X.push(T[L]))}let H=X.length&&B&&F(B.append)?B.append(X).from:this.#n.length;for(let L=0;L<T.length;L++){const Z=T[L],ee=z[L];if(ee!==null&&this.#a.has(ee)){const ne=this.#a.get(ee),ae=this.#he(ne);this.#L||(this.#n[ne]=Z,B&&F(B.setSource)&&B.setSource(ne,Z)),this.#He(ne,Z),this.#l.delete(ne),this.#ye(ne,Z),this.#pe(ne,ae);continue}const te=H++;if(this.#n[te]=this.#L?v:Z,this.#S++,this.#ye(te,Z),ee!==null&&this.#a.set(ee,te),C.push(te),!this.#r||!this.#Ie(te))continue;const se=this.#$(te);this.#r.insert(se,te),se<=this.#p&&this.#m++}return this.#O=!0,this.#fe(),C}#J(T){const C=this.#n[T];let B=!1;if(this.#r){const H=this.#ge(T);H>=0&&H<=this.#p&&(B=!0)}else T<=this.#p&&(B=!0);const z=C===v?this.#Ae(T):C,X=this.#o.keyed?this.#o.keyOf(z,T):null;X!==null&&this.#a.get(X)===T&&this.#a.delete(X),this.#n[T]=void 0,this.#T&&(this.#T[T]=NaN),this.#l.delete(T);const Q=this.#t.store;return Q&&F(Q.remove)&&Q.remove(T),this.#S--,B}#fe(){let T=0,C=0;const B=this.#we();T+=B.dropped,C+=B.aboveAnchor;const z=this.#le();T+=z.dropped,C+=z.aboveAnchor,T&&(this.#O=!0,this.#P+=T,this.#ke(),this.#m-=C,this.#Se("stream:evicted",{evicted:T,total:this.#P,live:this.#S}))}#le(){const T=this.#e.maxRows;if(!Number.isFinite(T)||T<=0||this.#S<=T)return{dropped:0,aboveAnchor:0};const C=Math.max(1,Math.floor(T*(1-_)));let B=0,z=0;for(;this.#S>C&&this.#E<this.#n.length;){const X=this.#E++;this.#n[X]!==void 0&&(this.#J(X)&&z++,B++)}return{dropped:B,aboveAnchor:z}}#we(){const T=this.#G();if(!T||!this.#T||!this.#_())return{dropped:0,aboveAnchor:0};const C=Date.now()-T;let B=0,z=0,X=1/0;for(let Q=this.#E;Q<this.#n.length;Q++){if(this.#n[Q]===void 0)continue;const H=this.#T[Q];if(!(Number.isNaN(H)||H===void 0)){if(H>=C){H<X&&(X=H);continue}this.#J(Q)&&z++,B++}}for(this.#M=X,this.#N=!1;this.#E<this.#n.length&&this.#n[this.#E]===void 0;)this.#E++;return{dropped:B,aboveAnchor:z}}#ge(T){if(!this.#r)return T;for(let C=0;C<this.#r.length;C++)if(this.#r.at(C)===T)return C;return-1}#ke(){this.#i=this.#Oe("sort",[]),this.#s=this.#Oe("filters",null);const T=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#G()>0,C=this.#Oe("where",null),B=(this.#t.config||{}).hostFilter,z=!!(C&&C.active)||!!(B&&F(B.active)&&B.active());if(!(T||this.#i.length>0||!!this.#s||!!this.#Oe("quick","")||z)){this.#r=null;return}this.#r=new s(Math.max(64,this.#n.length+64));for(let Q=0;Q<this.#n.length;Q++)this.#n[Q]!==void 0&&this.#Ie(Q)&&this.#r.insert(this.#$(Q),Q)}#Ie(T){const C=this.#Ae(T);if(this.#s&&!this.#de(this.#s,C))return!1;const B=String(this.#Oe("quick","")||"").toLowerCase();if(B&&!this.#Ve(C).includes(B))return!1;const z=(this.#t.config||{}).hostFilter;if(z&&F(z.active)&&z.active()&&!z.passes(this.#k(T)))return!1;const X=this.#Oe("where",null);if(X&&X.active){const Q=this.#k(T);if(!X.passes(Q.data,Q.key))return!1}return!0}#de(T,C){if(!T)return!0;const B=T;if(Array.isArray(B.conditions))return B.op==="or"?B.conditions.some(Q=>this.#de(Q,C)):B.op==="not"?!B.conditions.some(Q=>this.#de(Q,C)):B.conditions.every(Q=>this.#de(Q,C));const z=T,X=(this.#t.compute||{}).testValue;return F(X)?!!X(this.#Pe(C,z.col),z,(this.#t.config||{}).locale):(y("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#he(T){if(!this.#r)return-1;if(!this.#i.length)return this.#ge(T);let C=0,B=this.#r.length;for(;C<B;){const z=C+B>>>1;this.#Z(this.#r.at(z),T)<0?C=z+1:B=z}for(let z=C;z<this.#r.length;z++){const X=this.#r.at(z);if(X===T)return z;if(this.#Z(X,T)>0)break}return this.#ge(T)}#pe(T,C){if(!this.#r||!this.#i.length)return;const B=this.#Ie(T);if(C>=0&&this.#r.at(C)===T)this.#r.removeAt(C),C<=this.#p&&this.#m--;else if(C>=0)return;if(!B)return;const z=this.#$(T);this.#r.insert(z,T),z<=this.#p&&this.#m++}#$(T){if(!this.#r||!this.#i.length)return this.#r?this.#r.length:0;let C=0,B=this.#r.length;for(;C<B;){const z=C+B>>>1;this.#Z(T,this.#r.at(z))<0?B=z:C=z+1}return C}#Z(T,C){const B=this.#Ae(T),z=this.#Ae(C);for(const X of this.#i){const Q=this.#Ye(X.col),H=this.#Pe(B,X.col),L=this.#Pe(z,X.col),ee=(Q&&Q.value&&F(Q.value.compare)?Q.value.compare:S)(H,L);if(ee!==0)return X.dir==="desc"?-ee:ee}return 0}#ne(){this.#w=!0,this.#u.loaded=this.#u.loaded||this.#n.length;const T=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:w;!this.#L&&this.#n.length<T&&(this.#g=p({mode:"memory",rows:this.#n},this.#t),this.#R!==null&&(clearInterval(this.#R),this.#R=null),this.#b&&(this.#b.destroy(),this.#b=null)),this.#re(),this.#Se("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:T})}#re(){this.#f!==null||this.#v||(this.#f=this.#I(()=>{this.#f=null,this.#d++;const T=this.#m;this.#m=0,this.#h=0,this.#Se("stream:chunk",{loaded:this.#u.loaded,estimated:this.#u.estimated,count:this.count(),renders:this.#d}),this.#Se("model:changed",{reason:"stream",shiftAboveViewport:T,anchor:this.#p}),this.#Se("rows:changed",{companion:!0,reason:"stream"})}))}#Be(){return this.#d===0||this.#h<this.#K()?Promise.resolve():(this.#h=0,new Promise(T=>{const C=(this.#t.scheduler||{}).idle;F(C)?C(()=>T()):K(()=>T())}))}#K(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:A}#I(T){const C=this.#t.scheduler||{};return F(C.frame)?C.frame(T):W(T)}#ve(T){const C=this.#t.scheduler||{};F(C.cancel)?C.cancel(T):I(T)}#Ae(T){const C=this.#n[T];if(C!==void 0&&C!==v)return C;if(C===void 0)return;const B=this.#t.store;return B&&F(B.source)?B.source(T):void 0}#He(T,C){const B=this.#t.store;if(!B||!F(B.set))return;const z=this.#H();if(Array.isArray(z))for(const X of z){if(!X||!X.id)continue;const Q=F(X.read)?X.read:H=>i(H,X.field||X.id);B.set(X.id,T,Q(C))}}#k(T){let C=this.#l.get(T);return C||(C=this.#o.leaf(this.#Ae(T),T),this.#l.set(T,C)),C}#Pe(T,C){const B=this.#Ye(C);return B&&F(B.getValue)?B.getValue(T):T?.[C]}#Ve(T){const C=this.#t.columns,B=C&&F(C.all)?C.all():[],z=[];for(const X of B){const Q=F(X.getValue)?X.getValue(T):void 0;Q!=null&&Q!==""&&z.push(String(Q))}return z.join(" ").toLowerCase()}#Ye(T){const C=this.#t.columns;return C&&F(C.get)?C.get(T):void 0}#Xe(){const T=this.#V;if(this.#V=null,T&&F(T.return))try{T.return()}catch{}}#Ue(){return b({context:this.#Oe("context",null)})}#Oe(T,C){const B=this.#t.state;if(B&&F(B[T])){const z=B[T]();return z??C}return C}#Se(T,C){const B=this.#t.emit;F(B)&&B(T,C)}}}),Be("packages/core/src/source/url.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return y}});const M=D("packages/core/src/internal/warn.js").warnOnce,G=D("packages/core/src/internal/predicates.js"),F=G.isObject,x=G.isFunction,W=D("packages/core/src/internal/paths.js").getPath,K=D("packages/core/src/source/abort.js").isAbortError,R=500,S=new Set(["application/x-ndjson","application/ndjson","application/jsonlines","application/jsonl","application/x-jsonlines","text/x-ndjson"]),k=Symbol("lattice.url.skip");function y(u,b={}){const a=F(b)?b:{},h=x(a.fetch)?a.fetch:typeof globalThis<"u"&&x(globalThis.fetch)?globalThis.fetch:null,w=a.format==="json"||a.format==="ndjson"?a.format:void 0,v=typeof a.rowsPath=="string"&&a.rowsPath?a.rowsPath:void 0,A=x(a.map)?a.map:void 0,_=F(a.headers)?a.headers:void 0,V=Number.isFinite(a.batchSize)&&a.batchSize>0?Math.floor(a.batchSize):R,Y=a.lenient===!0,$=Number.isFinite(a.poll)&&a.poll>0?Math.floor(a.poll):void 0,j=typeof u=="string"&&u.length>0;j||M("source.url.url","createUrlSource needs a URL string; the grid will stay empty.");async function*E(N={}){if(!j)return;if(!h)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const T=N&&N.signal;let C;try{C=await h(u,_?{signal:T,headers:_}:{signal:T})}catch(X){throw K(X)?X:new Error(`[lattice] createUrlSource: request to ${u} failed — ${X&&X.message||X}`)}if(!C||!C.ok){const X=C?C.status:"no response";throw new Error(`[lattice] createUrlSource: ${X} for ${u}`)}const B=l(u,w,C),z=C.body&&x(C.body.getReader)?C.body.getReader():null;try{if(!z){const H=await C.text();(B||t(H,u))==="ndjson"?yield*r(null,null,H,0,C,u,V,Y):yield*m(H,u,v,A);return}const X=new TextDecoder("utf-8");if(B==="json"){yield*m(await n(z,X,""),u,v,A);return}if(B==="ndjson"){yield*r(z,X,"",0,C,u,V,Y);return}const Q=await o(z,X,u);Q.format==="json"?yield*m(await n(z,X,Q.seed),u,v,A):yield*r(z,X,Q.seed,Q.bytes,C,u,V,Y)}finally{if(z&&x(z.cancel))try{await z.cancel()}catch{}}}const O={mode:"stream",open:E,autoStart:a.autoStart!==!1};return $!==void 0&&(O.poll=$),Number.isFinite(a.maxRows)&&(O.maxRows=a.maxRows),Number.isFinite(a.maxAge)&&(O.maxAge=a.maxAge),(typeof a.ageBy=="string"||x(a.ageBy))&&(O.ageBy=a.ageBy),Number.isFinite(a.coalesceMs)&&(O.coalesceMs=a.coalesceMs),Number.isFinite(a.promoteToMemoryBelow)&&(O.promoteToMemoryBelow=a.promoteToMemoryBelow),O}function l(u,b,a){if(b)return b;const h=g(u);if(h)return h;const w=a&&a.headers&&x(a.headers.get)?a.headers.get("content-type"):null;return i(w)}function g(u){const b=String(u).split(/[?#]/)[0].toLowerCase();if(b.endsWith(".ndjson")||b.endsWith(".jsonl"))return"ndjson";if(b.endsWith(".json"))return"json"}function i(u){if(!u)return;const b=u.split(";")[0].trim().toLowerCase();if(S.has(b))return"ndjson";if(b==="application/json"||b==="text/json"||b.endsWith("+json"))return"json"}function t(u,b){const a=u.replace(/^\s+/,""),h=c(a);if(h==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${b} — pass opts.format: 'json' | 'ndjson'.`);return h}async function o(u,b,a){let h="",w=0;for(;;){const{value:A,done:_}=await u.read();if(A&&(w+=A.byteLength,h+=b.decode(A,{stream:!0})),_){h+=b.decode();break}const V=h.replace(/^\s+/,"");if(V){if(V[0]==="[")return{format:"json",seed:h,bytes:w};if(V[0]!=="{"||h.indexOf(`
|
|
8
8
|
`)!==-1)break}}const v=c(h.replace(/^\s+/,""));if(v==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${a} — pass opts.format: 'json' | 'ndjson'.`);return{format:v,seed:h,bytes:w}}function c(u){if(!u||u[0]==="[")return"json";if(u[0]!=="{")return"error";const b=u.indexOf(`
|
|
9
9
|
`);if(b===-1)return"json";let a=u.slice(0,b);return a.endsWith("\r")&&(a=a.slice(0,-1)),f(a)?"ndjson":"json"}function f(u){try{return JSON.parse(u),!0}catch{return!1}}async function n(u,b,a){let h=a;for(;;){const{value:w,done:v}=await u.read();if(w&&(h+=b.decode(w,{stream:!0})),v)break}return h+=b.decode(),h}function*m(u,b,a,h){let w;try{w=JSON.parse(u)}catch(A){throw new Error(`[lattice] createUrlSource: ${b} is not valid JSON — ${A.message}`)}let v=a!==void 0?W(w,a):w;if(h&&(v=h(v)),!Array.isArray(v)){const A=a!==void 0||h?"":"; pass opts.rowsPath or opts.map to select the array";throw new Error(`[lattice] createUrlSource: ${b} did not resolve to an array${A}.`)}yield{rows:v,progress:{loaded:v.length,estimated:v.length}}}async function*r(u,b,a,h,w,v,A,_){const V=p(w);let Y=a||"",$=h||0,j=0,E=0,O=[];function*N(){let C;for(;(C=Y.indexOf(`
|
|
10
10
|
`))!==-1;){const B=Y.slice(0,C);Y=Y.slice(C+1),E++;const z=s(B,E,v,_);z!==k&&(O.push(z),O.length>=A&&(j+=O.length,yield d(O,j,V,$),O=[]))}}if(u){for(;;){const{value:C,done:B}=await u.read();if(C&&($+=C.byteLength,Y+=b.decode(C,{stream:!0}),yield*N()),B)break}Y+=b.decode()}yield*N(),E++;const T=s(Y,E,v,_);T!==k&&O.push(T),O.length&&(j+=O.length,yield d(O,j,V,$))}function s(u,b,a,h){let w=u;if(w.endsWith("\r")&&(w=w.slice(0,-1)),!w.trim())return k;try{return JSON.parse(w)}catch(v){if(h)return M(`source.url.badline.${a}`,`skipping a malformed NDJSON line (line ${b}) from ${a} — ${v.message}`),k;throw new Error(`[lattice] createUrlSource: malformed NDJSON at line ${b} of ${a} — ${v.message}`)}}function d(u,b,a,h){const w=a&&h>0&&b>0?Math.max(b,Math.round(a/(h/b))):void 0;return{rows:u,progress:{loaded:b,estimated:w}}}function p(u){const b=u&&u.headers&&x(u.headers.get)?u.headers.get("content-length"):null,a=b!=null?Number(b):NaN;return Number.isFinite(a)&&a>0?a:void 0}}),Be("packages/core/src/source/derive.js",function(e,D){"use strict";Object.defineProperty(e,"FOLLOW_MODES",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"BUCKETS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"DERIVED_ROW_KEY",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"DERIVED_SOURCE_KEY",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"UNION_KEY_SEP",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"readPath",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"unnest",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"reduceValues",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"applyLimit",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"applyCumulative",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"groupRows",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"finishGroups",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"derive",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"normalizeUnionSource",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"namespaceUnionKeys",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"joinRows",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"preGroup",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"buildJoinIndex",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"joinOne",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"joinKeyOf",{enumerable:!0,get:function(){return w}});const re=D("packages/core/src/internal/predicates.js"),M=re.isFunction,G=re.isObject,x=D("packages/core/src/compute/total.js").TOTAL_FNS,q=Object.freeze(["filtered","all","selected","grouped"]),W=Object.freeze(["day","week","month","quarter","year"]),I="__key",K="__source",R="";function S(v,A){if(!G(v)||typeof A!="string")return;if(!A.includes("."))return v[A];let _=v;for(const V of A.split(".")){if(!G(_))return;_=_[V]}return _}function k(v,A){const _=[];for(const V of v){const Y=S(V,A);if(!(!Array.isArray(Y)||!Y.length))for(const $ of Y)_.push({...V,[A]:$})}return _}function y(v,A){const _=v instanceof Date?v:new Date(v),V=_.getTime();if(!Number.isFinite(V))return null;const Y=_.getUTCFullYear(),$=_.getUTCMonth(),j=_.getUTCDate(),E=O=>O.toISOString().slice(0,10);switch(A){case"year":return E(new Date(Date.UTC(Y,0,1)));case"quarter":return E(new Date(Date.UTC(Y,Math.floor($/3)*3,1)));case"month":return E(new Date(Date.UTC(Y,$,1)));case"week":{const O=(_.getUTCDay()+6)%7;return E(new Date(Date.UTC(Y,$,j-O)))}default:return E(new Date(Date.UTC(Y,$,j)))}}function l(v,A,_){const V=A.map(Y=>_&&_.of===Y?y(S(v,Y),_.by):S(v,Y));return{key:V.map(Y=>Y==null?"\0":String(Y)).join(""),values:V}}function g(v,A){const _=x[A];return _?_({get:V=>v[V]},o(v.length)):null}function i(v,A){return!A||typeof A.of!="string"||A.of===""||v&&v.includes(A.of)?v:[A.of,...v||[]]}function t(v,A){const _={},V=o(v.length);for(const[Y,$]of Object.entries(A)){const j=$.fn||"count",E=x[j];if(!E){_[Y]=null;continue}const O=$.of?v.map(N=>S(N,$.of)):[];_[Y]=E({get:N=>O[N]},V)}return _}const o=(()=>{const v=new Map;return A=>{let _=v.get(A);if(!_){_=new Uint32Array(A);for(let V=0;V<A;V++)_[V]=V;v.size<512&&v.set(A,_)}return _}})();function c(v,A,_){if(!Number.isFinite(A)||A<=0)return v;if(!_)return v.slice(0,A);const V=new Map,Y=[];for(const $ of v){const j=String(S($,_)),E=V.get(j)||0;E>=A||(V.set(j,E+1),Y.push($))}return Y}function f(v,A){const _=v.reduce((j,E)=>j+(Number(S(E,A.of))||0),0);if(!_)return v;const V=_*A.upTo;let Y=0;const $=[];for(const j of v)if($.push(j),Y+=Number(S(j,A.of))||0,Y>=V)break;return $}function n(v,A){return!Array.isArray(A)||!A.length?v:[...v].sort((_,V)=>{for(const Y of A){const $=S(_,Y.col),j=S(V,Y.col);if($===j)continue;return $==null?1:j==null?-1:((typeof $=="number"&&typeof j=="number"?$<j:String($)<String(j))?-1:1)*(Y.dir==="desc"?-1:1)}return 0})}function m(v,A,_){const V=A.groupBy?Array.isArray(A.groupBy)?A.groupBy:[A.groupBy]:null,Y=G(A.bucket)?A.bucket:null,$=i(V,Y),j=new Map,E=new Map;if(!$)return{groups:j,rowGroup:E};for(const O of v){const{key:N,values:T}=l(O,$,Y);let C=j.get(N);C||(C={values:T,rows:new Map},j.set(N,C));const B=_(O);C.rows.set(B,O),E.set(B,N)}return{groups:j,rowGroup:E}}function r(v,A,_=null,V=null){const Y=A.groupBy?Array.isArray(A.groupBy)?A.groupBy:[A.groupBy]:null,$=G(A.bucket)?A.bucket:null,j=i(Y,$);let E=[...v.entries()].map(([O,N])=>{if(_&&V&&!V.has(O)){const C=_.get(O);if(C)return C}const T={[I]:O};return j.forEach((C,B)=>{T[C.includes(".")?C.split(".").pop():C]=N.values[B]}),Object.assign(T,t([...N.rows.values()],A.select||{})),_&&_.set(O,T),T});return E=n(E,A.sort),G(A.cumulative)&&(E=f(E,A.cumulative)),c(E,A.limit,A.limitPer||null)}function s(v,A){const _=b(v,A),V=A.groupBy?Array.isArray(A.groupBy)?A.groupBy:[A.groupBy]:null,Y=G(A.bucket)?A.bucket:null,$=i(V,Y);let j;if(!$)j=_.map((E,O)=>({...E,[I]:String(S(E,A.rowKey||"id")??O)}));else{const E=new Map;for(const O of _){const{key:N,values:T}=l(O,$,Y);let C=E.get(N);C||(C={values:T,rows:[]},E.set(N,C)),C.rows.push(O)}j=[...E.entries()].map(([O,N])=>{const T={[I]:O};return $.forEach((C,B)=>{T[C.includes(".")?C.split(".").pop():C]=N.values[B]}),Object.assign(T,t(N.rows,A.select||{})),T})}return j=n(j,A.sort),G(A.cumulative)&&(j=f(j,A.cumulative)),c(j,A.limit,A.limitPer||null)}function d(v,A){const V=G(v)&&G(v.grid)?v:{grid:v};return{grid:G(V.grid)?V.grid:null,label:V.label!=null&&V.label!==""?String(V.label):String(A),follow:typeof V.follow=="string"?V.follow:void 0,map:M(V.map)?V.map:null}}function p(v){for(const A of v){const _=A[K];_!==void 0&&(A[I]=`${_}${R}${A[I]}`)}return v}function u(v,A){const _=A.on,V=G(_)?String(_.left||_.right||""):String(_||""),Y=G(_)?String(_.right||_.left||""):String(_||"");if(!V||!Y)return v;const $=A.index instanceof Map?A.index:a(Array.isArray(A.rows)?A.rows:[],Y),j=Array.isArray(A.select)?A.select.map(String):null,E=A.prefix?String(A.prefix):"",O=String(A.type||"inner")==="left",N=[];for(const T of v){const C=S(T,V),B=C==null?void 0:$.get(String(C));if(!B){O&&N.push(T);continue}const z={...T},X=j||Object.keys(B);for(const Q of X)!E&&Q===V||(z[E?E+Q:Q]=S(B,Q));N.push(z)}return N}function b(v,A){let _=Array.isArray(v)?v:[];return A.unnest&&(_=k(_,A.unnest)),G(A.join)&&(Array.isArray(A.join.rows)||A.join.index instanceof Map)&&(_=u(_,A.join)),M(A.where)&&(_=_.filter(V=>!!A.where(V))),_}function a(v,A){const _=new Map;for(const V of v){const Y=S(V,A);if(Y==null)continue;const $=String(Y);_.has($)||_.set($,V)}return _}function h(v,A){const _=A.on,V=G(_)?String(_.left||_.right||""):String(_||""),Y=G(_)?String(_.right||_.left||""):String(_||"");if(!V||!Y)return v;const $=A.index instanceof Map?A.index:new Map,j=S(v,V),E=j==null?void 0:$.get(String(j));if(!E)return String(A.type||"inner")==="left"?v:null;const O=Array.isArray(A.select)?A.select.map(String):null,N=A.prefix?String(A.prefix):"",T={...v};for(const C of O||Object.keys(E))!N&&C===V||(T[N?N+C:C]=S(E,C));return T}function w(v,A){const _=S(v,A);return _==null?null:String(_)}}),Be("packages/core/src/source/derived.js",function(e,D){"use strict";Object.defineProperty(e,"IDLE_REFRESH_MS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PROFILE_FIELDS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"ALERT_THRESHOLDS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"STATISTICS_FNS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SERIES_METRICS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"PRODUCER_IGNORED_KEYS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"profileAlerts",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"DerivedSource",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"createDerivedSource",{enumerable:!0,get:function(){return Y}});const re=D("packages/core/src/internal/predicates.js"),M=re.isFunction,G=re.isObject,x=D("packages/core/src/internal/warn.js").warnOnce,W=D("packages/core/src/source/memory.js").MemorySource,K=D("packages/core/src/source/settle.js").isPipelineSettle,R=D("packages/core/src/source/derive.js"),S=R.derive,k=R.preGroup,y=R.groupRows,l=R.finishGroups,g=R.readPath,i=R.buildJoinIndex,t=R.joinOne,o=R.joinKeyOf,c=R.FOLLOW_MODES,f=R.DERIVED_ROW_KEY,n=R.DERIVED_SOURCE_KEY,m=R.normalizeUnionSource,r=R.namespaceUnionKeys,s=16,d=Object.freeze(["column","rows","present","missing","numeric","distinct","min","max","mean","median","q1","q3","iqr","stddev","outliers","alerts","alertCount"]),p=Object.freeze({missing:.2,cardinality:.9,skew:1,outliers:.05}),u=Object.freeze(["correlation","series","datasetVsDataset"]),b=Object.freeze(["n","first","last","change","changePercent","volatility","annualisedVolatility","growth","maxDrawdown","maxDrawdownFrom","maxDrawdownTo","autocorrelation","upDays","downDays"]),a=Object.freeze(["unnest","join","where","bucket","groupBy","select","sort","limit","limitPer","cumulative"]);function h($,j={}){const E={...p,...G(j)?j:{}},O=ee=>typeof ee=="number"&&Number.isFinite(ee)?ee:null,N=O($.rows)??0,T=O($.numeric)??0,C=O($.missing)??0,B=O($.distinct),z=O($.mean),X=O($.median),Q=O($.stddev),H=O(Array.isArray($.outliers)?$.outliers.length:$.outliers),L=T>0,Z=[];return B===0?["empty"]:(B===1&&Z.push("constant"),N>0&&C/N>=E.missing&&Z.push("high-missing"),!L&&B!==null&&N>1&&B===N&&C===0?Z.push("unique"):B!==null&&N>0&&B/N>=E.cardinality&&Z.push("high-cardinality"),L&&z!==null&&X!==null&&Q!==null&&Q>0&&Math.abs(3*(z-X)/Q)>=E.skew&&Z.push("skewed"),L&&H!==null&&H/T>=E.outliers&&Z.push("outliers"),Z)}class w extends W{#e=null;#t={};#n=[];#r=null;#i=!1;#s={};#o=!1;#l=null;#a=null;#c=!1;#u=null;#f=!1;#d=null;constructor(j,E){super({mode:"memory",rows:[]},E),this.#s=E||{},this.#t=G(j)?j:{};const O=this.#t.from;if(Array.isArray(O)){if(this.#e=null,this.#d=this.#g(O),!this.#d.length){x("source.derived.from",'source.mode "derived" needs `from`: at least one grid to derive from.');return}this.#t.follow!==void 0&&x("source.derived.union.follow",'source.mode "derived": `follow` is ignored when `from` is a union of several grids (BACKLOG-0001045) — each entry carries its own `follow` instead.'),this.#t.crossFilter&&x("source.derived.union.crossfilter",'source.mode "derived": `crossFilter` is not supported when `from` is a union of several grids (BACKLOG-0001045) — it has no single target once there is more than one parent. Push a filter onto the individual source grid you mean instead.'),this.#t.statistics!==void 0&&(x("source.derived.union.statistics",'source.mode "derived": `statistics` is not supported when `from` is a union of several grids (BACKLOG-0001046) — a relational statistic reduces one grid\'s own columns, and a union has no single set of them. Derive the statistics of a single grid instead.'),this.#f=!0),this.#m(),this.#b(),this.refresh();return}if(this.#e=O||null,!this.#e){x("source.derived.from",'source.mode "derived" needs `from`: the grid to derive from.');return}this.#t.follow&&!c.includes(String(this.#t.follow))&&x(`source.derived.follow.${this.#t.follow}`,`unknown follow "${this.#t.follow}"; using "filtered". Known: ${c.join(", ")}.`),this.#h()||(this.#f=!0),this.#m(),this.#b(),this.refresh()}#h(){const j=this.#t.statistics;if(j===void 0)return!0;if(this.#t.profile!==void 0)return x("source.derived.producer.conflict",'source.mode "derived": `profile` and `statistics` are both terminal producers and cannot be used together — each replaces the pipeline with its own output builder. Declare one, or chain a second derived grid whose `from` is the first.'),!1;if(!G(j))return x("source.derived.statistics.shape",`source.mode "derived": \`statistics\` needs an object naming the statistic, e.g. \`{ fn: 'correlation', columns: ['a', 'b'] }\`. Known fn: ${u.join(", ")}.`),!1;const E=String(j.fn||"");return u.includes(E)?this.#p(E,j):(x(`source.derived.statistics.fn.${E}`,`source.mode "derived": unknown \`statistics.fn\` "${E}". Known: ${u.join(", ")}. Every *single-column* statistic is reached through \`select\` instead, e.g. \`select: { p95: { of: 'amount', fn: 'p95' } }\`.`),!1)}#p(j,E){if(j==="correlation"){if((Array.isArray(E.columns)?E.columns.filter(Boolean):[]).length<2)return x("source.derived.statistics.columns","source.mode \"derived\": `statistics: { fn: 'correlation' }` needs `columns`: at least two column ids to correlate pairwise."),!1;const N=E.orient===void 0?"pairs":String(E.orient);return N!=="pairs"&&N!=="matrix"&&x(`source.derived.statistics.orient.${N}`,`source.mode "derived": unknown \`statistics.orient\` "${N}" for \`fn: 'correlation'\`; using "pairs". Known: pairs, matrix.`),!0}return j==="series"?!E.of||!E.by?(x("source.derived.statistics.series","source.mode \"derived\": `statistics: { fn: 'series' }` needs both `of` (the column to summarise) and `by` (the column that orders it). `by` is never guessed — kernels see rows in arrival order, which is not the grid's sort."),!1):!0:G(E.with)?!0:(x("source.derived.statistics.with","source.mode \"derived\": `statistics: { fn: 'datasetVsDataset' }` needs `with`: the second grid to compare this one against."),!1)}#m(){const j=this.#t.statistics!==void 0?"statistics":this.#t.profile!==void 0?"profile":null;if(!j)return;const E=a.filter(O=>this.#t[O]!==void 0);E.length&&x(`source.derived.producer.ignored.${j}`,`source.mode "derived": \`${j}\` is a terminal producer and replaces the pipeline, so ${E.map(O=>`\`${O}\``).join(", ")} ${E.length>1?"are":"is"} ignored. Sort, filter or limit the derived grid itself, or chain a second derived grid whose \`from\` is this one.`)}#g(j){const E=this.#s&&this.#s.grid,O=new Set,N=[];return j.forEach((T,C)=>{const B=m(T,C);if(O.has(B.label)&&x(`source.derived.union.label.${B.label}`,`source.mode "derived": two union sources share the label "${B.label}"; give each a distinct \`label\` or __source/__key will not distinguish them.`),O.add(B.label),!B.grid){x(`source.derived.union.missing.${B.label}`,`source.mode "derived": union source "${B.label}" has no grid and was skipped.`),N.push(B);return}if(E&&M(B.grid.on)){const z=A(E,B.grid,[B.label]);if(z){x(`source.derived.union.cycle.${B.label}`,`source.mode "derived": union source "${B.label}" was refused — it derives from the grid being derived, directly or through a chain (${z.join(" → ")}). Remove it from \`from\`.`),N.push({...B,grid:null});return}}N.push(B)}),N}#b(){if(this.#d){this.#O(),this.#w();return}const j=this.#e;if(!j||!M(j.on))return;const E=String(this.#t.follow||"filtered"),O=["rows:changed"];(E==="filtered"||E==="grouped")&&O.push("filter:changed","model:changed"),E==="selected"&&O.push("selection:changed"),E==="grouped"&&O.push("column:grouped");for(const N of O){const T=C=>{N==="rows:changed"&&v(C)||N==="model:changed"&&!K(C)||this.schedule(N==="rows:changed"?C:null)};j.on(N,T),this.#n.push(()=>M(j.off)&&j.off(N,T))}this.#w(),this.#y()}#y(){const j=this.#t.statistics,E=G(j)?j.with:null;if(!G(E)||!M(E.on))return;const O=E;for(const N of["rows:changed","filter:changed","model:changed"]){const T=C=>{N==="rows:changed"&&v(C)||N==="model:changed"&&!K(C)||this.schedule(null)};O.on(N,T),this.#n.push(()=>M(O.off)&&O.off(N,T))}}#O(){for(const j of this.#d){const E=j.grid;if(!E||!M(E.on))continue;const O=c.includes(String(j.follow))?String(j.follow):"filtered",N=["rows:changed"];(O==="filtered"||O==="grouped")&&N.push("filter:changed","model:changed"),O==="selected"&&N.push("selection:changed"),O==="grouped"&&N.push("column:grouped");for(const T of N){const C=B=>{T==="rows:changed"&&v(B)||T==="model:changed"&&!K(B)||this.schedule(null)};E.on(T,C),this.#n.push(()=>M(E.off)&&E.off(T,C))}}}#w(){const j=this.#t.join,E=j&&j.with;if(!E||!M(E.on))return;const N=String(j.follow||"all")==="all"?["rows:changed"]:["rows:changed","filter:changed","model:changed"];for(const T of N){const C=B=>{T==="rows:changed"&&v(B)||T==="model:changed"&&!K(B)||this.schedule({partner:!0})};E.on(T,C),this.#n.push(()=>M(E.off)&&E.off(T,C))}}#A(){const j=this.#t.join;if(!j||!j.with)return null;const E=j.on,O=G(E)?String(E.left||E.right||""):String(E||""),N=G(E)?String(E.right||E.left||""):String(E||"");return O&&N?{left:O,right:N}:null}#v(){const j=this.#A();if(!j)return this.#u=null,null;const E=this.#u;if(this.#u=i(this.#P(),j.right),!E)return null;const O=this.#t.join||{},N=Array.isArray(O.select)?O.select.map(String):null,T=z=>z?(N||Object.keys(z)).map(Q=>String(g(z,Q))).join(""):null,C=new Set,B=new Set;for(const[z,X]of this.#u)T(X)!==T(E.get(z))&&(C.add(z),E.has(z)||B.add(z));for(const z of E.keys())this.#u.has(z)||C.add(z);return{affected:C,gained:B}}#C(j,E){const O=this.#l;if(!O||!O.leftByJoinKey)return null;const N=[];for(const T of j){const C=O.leftByJoinKey.get(T);if(C)for(const B of C){const z=O.rowData.get(B);z!==void 0&&N.push({key:B,data:z})}}return this.#M({updated:N,added:[],removed:[]},E)}#S(j,E){if(!this.#l||!this.#l.leftByJoinKey||j.unnest||j.where||String(j.follow||"filtered")==="grouped")return!1;const O=j.join||{};return String(O.type||"inner")==="left"?!0:E.size===0}#P(){const j=this.#t.join,E=j&&j.with;if(!E||!E.rows)return[];const O=[],N=T=>{T.group||O.push(_(T))};return String(j.follow||"all")==="filtered"&&M(E.rows.forEach)?E.rows.forEach(N):M(E.rows.forEachAll)&&E.rows.forEachAll(N),O}schedule(j){const E=this.#t.refresh===void 0?"idle":this.#t.refresh;if(E==="manual")return;if(E==="live"){this.refresh(j);return}const O=typeof E=="number"&&Number.isFinite(E)?E:s;if(this.#r){this.#c=!0;return}this.#c=!1,this.#r=setTimeout(()=>{this.#r=null,this.refresh(this.#c?null:j)},O)}refresh(j){if(!(this.#i||!this.#e&&!this.#d)){if(this.#o){x("source.derived.cycle","a derived grid is deriving from itself, directly or through a chain. The cycle was refused; check the `from` of each grid in the chain.");return}this.#o=!0;try{const E=this.#f?[]:this.#d?this.#t.profile?this.#q():this.#L():this.#t.statistics!==void 0?this.#ye():this.#t.profile?this.#se():this.#E(j);this.setRows(E),this.invalidate("filter"),M(this.#s.emit)&&this.#s.emit("rows:changed",{derived:!0},"derived")}finally{this.#o=!1}}}#E(j){const O=G(j)&&j.partner===!0?this.#v():null,N=this.#F();if(O&&this.#l){if(!O.affected.size)return l(this.#l.groups,N,this.#l.reduced,new Set);if(this.#S(N,O.gained)){const te=this.#C(O.affected,N);if(te)return l(this.#l.groups,N,this.#l.reduced,te)}}const T=this.#T(N,j);if(T&&this.#l){const te=this.#M(T,N);return l(this.#l.groups,N,this.#l.reduced,te)}const C=k(this.#B(),N);if(this.#a=this.#R(),!N.groupBy)return this.#l=null,S(C,N);const B=this.#N(),{groups:z,rowGroup:X}=y(C,N,B),Q=new Map;for(const[te,se]of X){const ne=z.get(se);ne&&Q.set(te,ne.rows.get(te))}const H=new Map,L=this.#A(),Z=new Map,ee=new Map;if(L)for(const[te,se]of Q){const ne=o(se,L.left);if(ne===null)continue;Z.set(te,ne);let ae=ee.get(ne);ae||(ae=new Set,ee.set(ne,ae)),ae.add(te)}return this.#l={groups:z,rowGroup:X,rowData:Q,reduced:H,leftJoinKey:Z,leftByJoinKey:ee},l(z,N,H,null)}#T(j,E){if(!this.#l||!j.groupBy||j.unnest||j.where||String(j.follow||"filtered")==="grouped"||G(j.join)&&j.join.with&&!(j.join.index instanceof Map)||!G(E))return null;const O=Array.isArray(E.updated)?E.updated:null,N=Array.isArray(E.added)?E.added:null,T=Array.isArray(E.removed)?E.removed:null;if(!O&&!N&&!T)return null;const C=this.#a;if(C&&C.size&&String(j.follow||"filtered")!=="all"){if(E.edit===!0&&Array.isArray(E.columns)){for(const B of E.columns)if(C.has(String(B)))return null}for(const B of O||[]){const z=B&&B.key,X=z===void 0?void 0:this.#l.rowData.get(String(z)),Q=_(B);for(const H of C)if(g(X,H)!==g(Q,H))return null}}return{updated:O||[],added:N||[],removed:T||[]}}#M(j,E){const O=this.#l,N=this.#N(),T=new Set,C=G(E.join)&&E.join.index instanceof Map?E.join:null,B=this.#A(),z=Q=>{const H=O.rowGroup.get(Q);if(H===void 0)return;T.add(H);const L=O.groups.get(H);if(L&&(L.rows.delete(Q),L.rows.size||O.groups.delete(H)),O.rowGroup.delete(Q),O.rowData.delete(Q),O.leftJoinKey){const Z=O.leftJoinKey.get(Q);if(Z!==void 0){const ee=O.leftByJoinKey.get(Z);ee&&(ee.delete(Q),ee.size||O.leftByJoinKey.delete(Z)),O.leftJoinKey.delete(Q)}}},X=Q=>{const H=C?t(Q,C):Q;if(!H)return;const L=N(H),Z=y([H],E,N);for(const[ee,te]of Z.groups){let se=O.groups.get(ee);se||(se={values:te.values,rows:new Map},O.groups.set(ee,se)),se.rows.set(L,H),O.rowGroup.set(L,ee),T.add(ee)}if(O.rowData.set(L,H),B&&O.leftByJoinKey){const ee=o(H,B.left);if(ee!==null){O.leftJoinKey.set(L,ee);let te=O.leftByJoinKey.get(ee);te||(te=new Set,O.leftByJoinKey.set(ee,te)),te.add(L)}}};for(const Q of j.removed)z(String(Q));for(const Q of j.updated)z(String(Q.key)),X(_(Q));for(const Q of j.added)X(_(Q));return T}#N(){const j=this.#e,E=j&&j.config&&j.config.rowKey||"id";return O=>String(g(O,typeof E=="string"?E:"id")??"")}#R(){const j=this.#e,E=j&&j.state&&M(j.state.get)?j.state.get():null,O=new Set,N=T=>{if(T){if(Array.isArray(T.conditions)){T.conditions.forEach(N);return}T.col&&O.add(String(T.col))}};return E&&N(E.filters),O}#F(){let j=this.#t;if(j.join&&j.join.with&&(this.#u||this.#v(),j={...j,join:{...j.join,index:this.#u}}),this.#d||String(j.follow||"filtered")!=="grouped")return j;const E=this.#e,O=E&&E.state&&M(E.state.get)?E.state.get():null,N=O&&Array.isArray(O.group)?O.group:[];return N.length?{...j,groupBy:[...N]}:j}#V(){const j=[];for(const E of this.#d)if(E.grid)try{const O=c.includes(String(E.follow))?String(E.follow):"filtered",N=this.#W(E.grid,O);for(const T of N){const C=E.map?E.map(T):T;G(C)&&j.push({...C,[n]:E.label})}}catch(O){x(`source.derived.union.failed.${E.label}`,`source.mode "derived": union source "${E.label}" failed to read (${O&&O.message?O.message:O}) and was skipped this pass.`)}return j}#W(j,E){if(!j||!j.rows)return[];if(E==="all"){const N=[];return M(j.rows.forEachAll)&&j.rows.forEachAll(T=>{T.group||N.push(_(T))}),N}if(E==="selected")return(j.selection&&M(j.selection.rows)?j.selection.rows():[]).filter(Boolean).map(_);const O=[];return M(j.rows.forEach)&&j.rows.forEach(N=>{N.group||O.push(_(N))}),O}#L(){const j=this.#F(),E=this.#V(),O=S(E,j);return j.groupBy?O:r(O)}#q(){return x("source.derived.union.profile",'source.mode "derived": `profile` is not supported when `from` is a union of several grids (BACKLOG-0001045); profile a single grid instead.'),[]}#B(){const j=this.#e,E=String(this.#t.follow||"filtered");if(!j||!j.rows)return[];if(E==="all"){const T=[];return M(j.rows.forEachAll)&&j.rows.forEachAll(C=>{C.group||T.push(_(C))}),T}if(E==="selected")return(j.selection&&M(j.selection.rows)?j.selection.rows():[]).filter(Boolean).map(_);const O=this.#Y(),N=[];return O&&this.#G().length&&M(j.rows.forEachExcept)?(j.rows.forEachExcept(O,T=>{T.group||N.push(_(T))}),N):(M(j.rows.forEach)&&j.rows.forEach(T=>{T.group||N.push(_(T))}),N)}#Y(){const j=this.#t.crossFilter;if(!j||this.#d)return null;if(typeof j=="string")return j;if(j.col)return String(j.col);const E=this.#t.groupBy,O=Array.isArray(E)?E[0]:E;return O?String(O):null}#G(){const j=this.#Y(),E=this.#e;if(!j||!E||!E.filters||!M(E.filters.get))return[];const O=V(E.filters.get(),j);return O?O.op==="in"&&Array.isArray(O.value)?O.value.map(String):O.op==="eq"&&O.value!==void 0?[String(O.value)]:[]:[]}#D(j){const E=this.#Y(),O=this.#e;if(!E||!O||!O.filters||!M(O.filters.set))return;const N=this.#s.compute||{},T=M(O.filters.get)?O.filters.get():null,C=M(N.pruneColumn)?N.pruneColumn(T,E):null;if(!j.length){O.filters.set(C||null);return}const B=j.length===1?{col:E,op:"eq",value:j[0]}:{col:E,op:"in",value:j.slice()},z=C?C.conditions&&C.op?C.conditions:[C]:[];O.filters.set(z.length?{op:"and",conditions:[...z,B]}:B)}crossFilter(){const j=this;return{enabled(){return!!j.#Y()},column(){return j.#Y()},get(){return j.#G()},set(E){const O=E==null?[]:(Array.isArray(E)?E:[E]).map(N=>String(N));j.#D(O)},toggle(E){const O=String(E),N=j.#G(),C=N.indexOf(O)>=0?N.filter(B=>B!==O):[...N,O];j.#D(C)},clear(){j.#D([])}}}#_(j){const E=j&&j.rows;if(E&&M(E.matchCount)){const O=E.matchCount(),N=Number(O);if(O!==null&&Number.isFinite(N))return N}if(E&&M(E.count)){const O=Number(E.count());if(Number.isFinite(O))return O}return 0}#ye(){const j=this.#e,E=this.#t.statistics;if(!j||!j.statistics||!G(E))return[];switch(String(E.fn)){case"correlation":return this.#ce(j,E);case"series":return this.#ue(j,E);case"datasetVsDataset":return this.#Ne(j,E);default:return[]}}#ce(j,E){const O=E.columns.filter(Boolean).map(String),N=this.#_(j),T=(C,B)=>{const z=j.statistics.correlation(C,B);return typeof z=="number"&&Number.isFinite(z)?z:null};if(String(E.orient||"pairs")!=="matrix"){const C=[];for(let B=0;B<O.length;B++)for(let z=B+1;z<O.length;z++)C.push({[f]:`${O[B]}${O[z]}`,a:O[B],b:O[z],coefficient:T(O[B],O[z]),n:N});return C}return O.map(C=>{const B={[f]:C,column:C};for(const z of O)B[z]=C===z?1:T(C,z);return B.n=N,B})}#ue(j,E){const O=this.#_(j),N={by:String(E.by)};E.periodsPerYear!==void 0&&(N.periodsPerYear=Number(E.periodsPerYear));const T=j.statistics.series(String(E.of),N)||{};return b.map(C=>({[f]:C,metric:C,value:T[C]??null,n:O}))}#Ne(j,E){const O=E.with,N=Array.isArray(E.columns)?{columns:E.columns.map(String)}:void 0,T=j.statistics.datasetVsDataset(O,N);if(!G(T))return[];const B=(Array.isArray(T.ranked)?T.ranked:[]).map(Q=>({[f]:String(Q.column),column:Q.column,measure:Q.measure??null,magnitude:Q.magnitude??null,distance:Q.distance??null,direction:Q.direction??null,nA:Q.nA??null,nB:Q.nB??null,meanA:Q.meanA??null,meanB:Q.meanB??null,reliable:Q.reliable??null,unmatched:""})),z=T.unmatched,X=[["A",z&&z.onlyA],["B",z&&z.onlyB]];for(const[Q,H]of X)for(const L of H||[])B.push({[f]:`${Q}${L}`,column:L,measure:null,magnitude:null,distance:null,direction:null,nA:null,nB:null,meanA:null,meanB:null,reliable:!1,unmatched:Q});return B}#se(){const j=this.#e;if(!j||!j.statistics||!M(j.statistics.profile))return[];const O=(Array.isArray(this.#t.profile)?this.#t.profile:[this.#t.profile]).filter(Boolean).map(T=>{const C=j.statistics.profile(String(T))||{},B={[f]:String(T)};for(const X of d)B[X]=X==="column"?String(T):C[X]??null;B.outliers=Array.isArray(C.outliers)?C.outliers.length:C.outliers??null;const z=h({...C,rows:B.rows,outliers:B.outliers,numeric:C.numeric},this.#t.alerts);return B.alerts=z.join(", "),B.alertCount=z.length,B});if(this.#t.orient!=="metrics")return O;const N=O[0];return N?d.filter(T=>T!=="column").map(T=>({[f]:T,metric:T,value:N[T]})):[]}apply(j){const E=["add","update","remove"],O=[];for(const N of E)for(const T of j&&j[N]||[])O.push({operation:N,id:T&&T.id,reason:"derived-read-only"});return O.length&&x("source.derived.readonly","a derived grid is read-only: its rows are computed from another grid. Write to the source grid instead, and the derived one follows."),{added:[],updated:[],removed:[],rejected:O}}destroy(){this.#i=!0,this.#r&&(clearTimeout(this.#r),this.#r=null),this.#Y()&&this.#G().length&&this.#D([]);for(const j of this.#n)try{j()}catch{}this.#n=[],this.#e=null,this.#d=null,super.destroy()}}function v($){return G($)&&$.companion===!0}function A($,j,E,O=new Set){if(j===$)return E;if(O.has(j))return null;O.add(j);let N=null;try{N=M(j.config)?j.config():null}catch{N=null}const T=N&&G(N.source)?N.source:null;if(!T||T.mode!=="derived")return null;const C=T.from;if(Array.isArray(C)){for(let B=0;B<C.length;B++){const z=m(C[B],B);if(!z.grid||!M(z.grid.on))continue;const X=A($,z.grid,[...E,z.label],O);if(X)return X}return null}return G(C)&&M(C.on)?A($,C,[...E,"(from)"],O):null}function _($){return G($)&&"data"in $?$.data:$}function V($,j){if(!$||typeof $!="object")return null;if(Array.isArray($.conditions)){for(const O of $.conditions){const N=V(O,j);if(N)return N}return null}return $.col===j?$:null}function Y($,j){return new w($,j)}}),Be("packages/core/src/source/adapters/odata.js",function(e,D){"use strict";Object.defineProperty(e,"conditionToOData",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"filtersToOData",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"odataAdapter",{enumerable:!0,get:function(){return d}});const M=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/source/filterwire.js").isGroup,x=Object.freeze(["eq","ne","gt","gte","lt","lte","contains","startsWith","endsWith","blank","notBlank","between","notBetween"]),q=/^\d{4}-\d{2}-\d{2}$/,W=/^\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/,I=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;function K(p){const u=p instanceof Date?p:typeof p=="number"&&Number.isFinite(p)?new Date(p):typeof p=="string"&&I.test(p)?new Date(p):null;return u&&!Number.isNaN(u.getTime())?u:null}const R=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function S(p,u){throw typeof u=="string"&&R.test(u)?new Error(`odataAdapter: "${u}" needs a zone designator to be used as a ${p} value — add "Z" for UTC or a "+HH:MM"/"-HH:MM" offset. A date-time with no zone is ambiguous (whose local time?) and would otherwise silently become the wrong instant rather than the one intended.`):new Error(`odataAdapter: "${String(u)}" is not a usable ${p} value`)}function k(p){const u=K(p);return u||S("DateTimeOffset",p),u.toISOString()}function y(p){if(typeof p=="string"&&q.test(p))return p;const u=K(p);return u||S("Date",p),u.toISOString().slice(0,10)}function l(p){if(typeof p=="string"&&W.test(p))return p.length===5?`${p}:00`:p;if(typeof p=="number"&&Number.isFinite(p)&&p>=0&&p<864e5){const u=Math.floor(p),b=a=>String(a).padStart(2,"0");return`${b(Math.floor(u/36e5))}:${b(Math.floor(u%36e5/6e4))}:${b(Math.floor(u%6e4/1e3))}`}throw new Error(`odataAdapter: "${String(p)}" is not a usable TimeOfDay value`)}const g=Object.freeze({timestamp:k,datetime:k,date:y,dateString:y,time:l}),i=200,t=1e3,o=Object.freeze({eq:"eq",ne:"ne",gt:"gt",gte:"ge",lt:"lt",lte:"le"});function c(p,u){if(p==null)return"null";const b=u&&g[String(u)];return b?b(p):typeof p=="number"||typeof p=="boolean"?String(p):p instanceof Date?p.toISOString():`'${String(p).replace(/'/g,"''")}'`}function f(p){const u=String(p),b=/^[A-Za-z_][A-Za-z0-9_]*$/;if(!u||!u.split("/").every(a=>b.test(a)))throw new Error(`odataAdapter: "${u}" is not a usable column name`);return u}const n=Object.freeze({lo:{incl:"ge",excl:"gt"},hi:{incl:"le",excl:"lt"}});function m(p){const u=f(p.col),b=String(p.op),a=p.type;if(o[b])return`${u} ${o[b]} ${c(p.value,a)}`;if(b==="contains")return`contains(${u},${c(p.value,a)})`;if(b==="startsWith")return`startswith(${u},${c(p.value,a)})`;if(b==="endsWith")return`endswith(${u},${c(p.value,a)})`;if(b==="blank")return`(${u} eq null)`;if(b==="notBlank")return`(${u} ne null)`;if(b==="between"||b==="notBetween"){const h=Array.isArray(p.value)?p.value:[p.value,p.value],w=String(p.bounds||"[]"),v=w.charAt(0)==="("?n.lo.excl:n.lo.incl,A=w.charAt(1)===")"?n.hi.excl:n.hi.incl,_=`(${u} ${v} ${c(h[0],a)} and ${u} ${A} ${c(h[1],a)})`;return b==="between"?_:`(${u} eq null or not ${_})`}return null}function r(p){const u=String(p&&p.op);throw M(`source.odata.filter.refuse.${u}`,`a "${u}" filter condition cannot be written as an OData $filter expression, so the request was refused rather than sent without it — silently dropping it would have matched more or fewer rows than the filter asked for. Route this condition through a source that can pushdown-split it as residual (source.filter capability), or drop it from the tree before building the URL.`),new Error(`odataAdapter: a "${u}" filter condition cannot be expressed in OData and was refused`)}function s(p){if(!p)return"";if(!F(p)){const a=m(p);return a===null?r(p):a}const u=String(p.op)==="or"?" or ":" and ",b=(p.conditions||[]).map(a=>{if(F(a))return s(a);const h=m(a);return h===null?r(a):h}).filter(Boolean);return b.length?b.length===1?b[0]:`(${b.join(u)})`:""}function d(p={}){const u=String(p.url||""),b=p.fetch||(typeof fetch=="function"?fetch:null),a=p.count!==!1,h=f(p.key||"id"),w=p.edit===!0;return{name:"odata",capabilities:{filter:"tree",operators:x,sort:"multi",quick:p.search===!0,range:!0,total:a,mutate:w?{update:!0,delete:!0,append:!0,returning:"row"}:!1},urlFor(v){const A=[],_=(Y,$)=>A.push(`${Y}=${encodeURIComponent($)}`),V=s(v.filters);return V&&_("$filter",V),v.sort&&v.sort.length&&_("$orderby",v.sort.map(Y=>`${f(Y.col)}${Y.dir==="desc"?" desc":" asc"}`).join(",")),v.range&&(_("$skip",String(v.range.start)),_("$top",String(v.range.end-v.range.start))),v.quick&&_("$search",`"${String(v.quick).replace(/"/g,"")}"`),a&&_("$count","true"),A.length?`${u}?${A.join("&")}`:u},async execute(v,A){if(!b)throw new Error("odataAdapter needs a fetch implementation");const _={Accept:"application/json",...p.headers||{}},V=A&&A.signal,Y=async O=>{const N=await b(O,{headers:_,signal:V});if(!N.ok)throw new Error(`OData request failed: ${N.status}`);return N.json()};let $=await Y(this.urlFor(v)),j=$.value||$.rows||[];const E=$["@odata.count"]??$.count;if(!v.range){let O=$["@odata.nextLink"];for(;O&&j.length<i*t;)$=await Y(O),j=j.concat($.value||$.rows||[]),O=$["@odata.nextLink"]}return E==null?(a&&M("source.odata.nocount",`${u} was asked for $count=true and answered without an @odata.count, so the grid has no total for this query and will scroll open-ended rather than present the page size as the whole. The endpoint does not support $count, or filters it out.`),{rows:j}):{rows:j,total:Number(E)}},urlForKey(v){return`${u}(${c(v)})`},async mutate(v,A){if(!b)throw new Error("odataAdapter needs a fetch implementation");if(!v||v.kind!=="update"&&v.kind!=="delete"&&v.kind!=="append")throw new Error(`odataAdapter: mutation kind "${v&&v.kind}" is not supported (update, delete and append are wired)`);const _={Accept:"application/json","Content-Type":"application/json",...p.headers||{}},V=A&&A.signal;if(v.kind==="delete"){const O=Array.isArray(v.keys)&&v.keys.length?v.keys[0]:v.key;if(O==null)throw new Error("odataAdapter: a delete needs a row key");const N=await b(this.urlForKey(O),{method:"DELETE",headers:_,signal:V});if(!N.ok)throw new Error(`OData delete failed: ${N.status}`);return{ok:!0}}if(v.kind==="append"){const O=Array.isArray(v.rows)?v.rows.filter(z=>z&&typeof z=="object"):[];if(O.length!==1)throw new Error("odataAdapter: an append needs exactly one row object (OData creates one entity per POST)");const N=await b(u,{method:"POST",headers:_,signal:V,body:JSON.stringify(O[0])});if(!N.ok)throw new Error(`OData add-row failed: ${N.status}`);const T=N.status===204?null:await N.json().catch(()=>null),C=T&&typeof T=="object"&&"value"in T?T.value:T;if(!C||typeof C!="object")throw new Error("odataAdapter: the POST returned no created entity to rekey the appended row by. Have the service return the created entity (Prefer: return=representation).");const B=C[h];if(B==null)throw new Error(`odataAdapter: the created entity carried no ${h} to rekey the appended row by.`);return{ok:!0,keys:[String(B)],rows:[C]}}const Y=this.urlForKey(v.key),$=await b(Y,{method:"PATCH",headers:_,signal:V,body:JSON.stringify(v.patch||{})});if(!$.ok)throw new Error(`OData update failed: ${$.status}`);if($.status===204)return{ok:!0};const j=await $.json(),E=j&&typeof j=="object"&&"value"in j?j.value:j;return E==null?{ok:!0}:{ok:!0,rows:[E]}}}}}),Be("packages/core/src/source/adapters/rest.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_PARAMS",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"DEFAULT_VERBS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"restAdapter",{enumerable:!0,get:function(){return G}});const re=Object.freeze({offset:"offset",limit:"limit",sort:"sort",order:"order",filter:"filter",search:"q"}),M=Object.freeze({update:"PATCH",delete:"DELETE",append:"POST"});function G(F={}){const x=String(F.url||""),q=F.fetch||(typeof fetch=="function"?fetch:null),W={...re,...F.params||{}},I=F.encodeFilter||(t=>JSON.stringify(t)),K=F.rows||(t=>Array.isArray(t)?t:t.rows||t.data||[]),R=F.total||((t,o)=>Array.isArray(t)?o.length:t.total??t.count??o.length),S=F.edit===!0,k=F.returning==="row"?"row":F.returning==="key"?"key":"none",y=F.keyField||"id",l=F.writeUrlFor||(t=>`${x}/${encodeURIComponent(String(t.key??(t.keys&&t.keys[0])))}`),g=F.encodeMutation||(t=>{const o=M[t.kind];if(t.kind==="update")return{method:o,url:l(t),headers:{"Content-Type":"application/json"},body:JSON.stringify(t.patch||{})};if(t.kind==="append"){const c=Array.isArray(t.rows)?t.rows:t.rows?[t.rows]:[];return{method:o,url:x,headers:{"Content-Type":"application/json"},body:JSON.stringify(c.length===1?c[0]:c)}}return{method:o,url:l(t)}}),i=F.writeRow||(t=>{if(t===null||typeof t!="object")return null;if(Array.isArray(t))return t.length?t[0]:null;const o=t;return o.row??o.data??t});return{name:"rest",capabilities:{range:!0,total:!0,sort:"multi",filter:!1,quick:!1,mutate:S?{update:!0,delete:!0,append:!0,returning:k}:!1,...F.capabilities||{},...F.operators?{filter:"tree",operators:F.operators}:{}},urlFor(t){const o=new URLSearchParams;t.range&&(o.set(W.offset,String(t.range.start)),o.set(W.limit,String(t.range.end-t.range.start))),t.sort&&t.sort.length&&(o.set(W.sort,t.sort.map(f=>f.col).join(",")),o.set(W.order,t.sort.map(f=>f.dir||"asc").join(","))),t.filters&&o.set(W.filter,I(t.filters)),t.quick&&o.set(W.search,String(t.quick));const c=o.toString();return c?`${x}?${c}`:x},async execute(t,o){if(!q)throw new Error("restAdapter needs a fetch implementation");const c=await q(this.urlFor(t),{headers:{Accept:"application/json",...F.headers||{}},signal:o&&o.signal});if(!c.ok)throw new Error(`request failed: ${c.status}`);const f=await c.json(),n=K(f);return{rows:n,total:R(f,n)}},writeUrlFor(t){return l(t)},encodeMutation(t){return g(t)},async mutate(t,o){if(!q)throw new Error("restAdapter needs a fetch implementation");if(!t||t.kind!=="update"&&t.kind!=="delete"&&t.kind!=="append")throw new Error(`restAdapter: mutation kind "${t&&t.kind}" is not supported (update, delete and append are wired)`);const c=g(t);if(!c||!c.url||!c.method)throw new Error("restAdapter: encodeMutation must return { method, url }");const f={Accept:"application/json",...F.headers||{},...c.headers||{}},n=await q(c.url,{method:c.method,headers:f,signal:o&&o.signal,...c.body!==void 0?{body:c.body}:{}});if(!n.ok)throw new Error(`REST ${t.kind} failed: ${n.status}`);if(t.kind==="append"){if(k==="none")return{ok:!0};if(n.status===204)throw new Error("restAdapter: the add-row POST returned 204 with no body, so the appended row has no server key to rekey by. Declare returning: 'row'/'key' and have the endpoint return the created row.");const s=await n.json(),d=i(s),p=d&&typeof d=="object"?d[y]:void 0;if(p==null)throw new Error(`restAdapter: the add-row response carried no ${y} to rekey the appended row by. Point \`keyField\` at the primary key the endpoint returns, or override \`writeRow\`.`);return k==="row"?{ok:!0,keys:[String(p)],rows:[d]}:{ok:!0,keys:[String(p)]}}if(k!=="row"||n.status===204)return{ok:!0};const m=await n.json(),r=i(m);return r==null?{ok:!0}:{ok:!0,rows:[r]}}}}}),Be("packages/core/src/source/adapters/dfql.js",function(e,D){"use strict";Object.defineProperty(e,"DFQL_BASE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DFQL_WRITE_URL",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"dfqlAdapter",{enumerable:!0,get:function(){return S}});const M=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce,x="https://rest.demandflow.com",q="https://stream.demandflow.com/dfql",W=Object.freeze(["id","created","updated","ownerId","entity"]);function I(k){const y={},l=[];for(const[g,i]of Object.entries(k||{})){if(W.includes(g)){l.push(g);continue}y[g]=i}return l.length&&F("source.dfql.protected",`a DFQL update tried to write protected field(s) ${l.join(", ")}; they are server-assigned and immutable, so they were dropped from the PATCH.`),y}function K(k){if(!k||typeof k!="object"||Array.isArray(k))return["fields (must be an object)"];const y=k,l=[];return(typeof y.entity!="string"||!y.entity)&&l.push("entity (uppercase code)"),Number.isFinite(Number(y.level))||l.push("level (numeric)"),(typeof y.comboKey!="string"||!y.comboKey.endsWith("|ENT:"))&&l.push("comboKey (a string ending '|ENT:')"),l}async function R(k){const y=[],l=o=>{const c=o.trim();if(c)try{y.push(JSON.parse(c))}catch{}};if(!k.body||typeof k.body.getReader!="function")return(await k.text()).split(`
|