@toclocoinc/lattice-grid 1.101.2 → 1.101.4
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 +34 -0
- package/README.md +1 -1
- package/angular/package.json +1 -1
- package/docs/API.html +115 -17
- package/docs/THEMING.md +2 -1
- 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/deckgl.html +1 -1
- package/docs/api/designer.html +1 -1
- package/docs/api/form.html +114 -14
- 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 +2 -2
- 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/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/types.html +1 -1
- package/docs/api-detail.html +9 -6
- 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/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/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 +5 -3
- package/modules/form.esm.min.js +221 -196
- package/modules/form.esm.min.js.map +2 -2
- package/modules/form.min.cjs +221 -196
- package/modules/form.min.js +221 -196
- package/modules/form.min.js.map +2 -2
- 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/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/mapview.d.ts +1 -1
- package/modules/mapview.esm.min.js +1 -1
- package/modules/mapview.min.cjs +1 -1
- package/modules/mapview.min.js +1 -1
- 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/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/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/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
package/modules/htmx.esm.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.101.
|
|
2
|
+
* Lattice Grid 1.101.4, htmx module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
6
6
|
var hr=Object.create(null),pr=Object.create(null);function Ue(e,U){hr[e]=U}function Kn(e){var U=pr[e];if(U)return U;var te=Object.create(null);pr[e]=te;var C=hr[e];if(!C)throw new Error("[lattice] missing module: "+e);return C(te,Kn),te}Ue("packages/core/src/internal/predicates.js",function(e,U){"use strict";Object.defineProperty(e,"isObject",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isFunction",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"isNil",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"isBlank",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"isCtor",{enumerable:!0,get:function(){return B}});function te(Z){return Z!==null&&typeof Z=="object"&&!Array.isArray(Z)}function C(Z){return typeof Z=="function"}function q(Z){return Z==null}function z(Z){return Z==null||Z===""}function B(Z){return typeof Z!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(Z))?!0:!!(Z.prototype&&Object.getOwnPropertyNames(Z.prototype).length>1)}}),Ue("packages/core/src/internal/warn.js",function(e,U){"use strict";Object.defineProperty(e,"reportedWarnings",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"warnOnce",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"infoOnce",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resetWarnings",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"fail",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"invariant",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEV",{enumerable:!0,get:function(){return f}});const te=new Set,C=2e3;function q(l){if(te.add(l),te.size>C){const r=te.values().next().value;r!==void 0&&te.delete(r)}}const z=[],B=500;function Z(l,r,t){z.push({key:l,level:r,message:t.map(i=>typeof i=="string"?i:K(i)).join(" "),at:Date.now()}),z.length>B&&z.shift()}function K(l){if(l instanceof Error)return l.message;try{return JSON.stringify(l)}catch{return String(l)}}function F(){return z.map(l=>({...l}))}function X(l){if(l.length===0||typeof l[0]!="string")return l;const r=l[0].replace(/^\[lattice\]\s*/,"");return r===l[0]?l:[r,...l.slice(1)]}function H(l,...r){if(te.has(l))return;q(l);const t=X(r);Z(l,"warn",t),console.warn("[lattice]",...t)}function j(l,...r){if(te.has(l))return;q(l);const t=X(r);Z(l,"info",t),console.info("[lattice]",...t)}function w(){te.clear(),z.length=0}function m(l,r){const t=new Error(`[lattice] ${l}`);throw r!==void 0&&(t.cause=r),t}function c(l,r){l||m(r)}const f=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})()}),Ue("packages/core/src/formatting/rules.js",function(e,U){"use strict";Object.defineProperty(e,"RULE_OPS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"DISTRIBUTION_OPS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"DISTRIBUTION_LABELS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"testRule",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"mixColour",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"summariseColumn",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"quantileOf",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"needsDistribution",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"resolveDistribution",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ICON_SETS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"compileRules",{enumerable:!0,get:function(){return M}});const C=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce,B=Object.freeze(["eq","ne","gt","gte","lt","lte","between","outside","contains","notContains","startsWith","endsWith","blank","notBlank","true","false"]),Z=Object.freeze(["topPercent","bottomPercent","topN","bottomN","aboveMean","belowMean","aboveMedian","belowMedian","zAbove","zBelow","outlier"]),K=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 F($,P){const N=Number($),T=Number(P);if($!==null&&$!==""&&P!==null&&P!==""&&Number.isFinite(N)&&Number.isFinite(T))return N<T?-1:N>T?1:0;const A=String($??"").toLowerCase(),S=String(P??"").toLowerCase();return A<S?-1:A>S?1:0}function X($){return $==null||$===""}function H($,P){if(!P||typeof P!="object")return!1;const{op:N}=P,T=P.value,E=P.value2;switch(N){case"blank":return X($);case"notBlank":return!X($);case"true":return $===!0;case"false":return $===!1;default:break}if(X($))return!1;switch(N){case"eq":return F($,T)===0;case"ne":return F($,T)!==0;case"gt":return F($,T)>0;case"gte":return F($,T)>=0;case"lt":return F($,T)<0;case"lte":return F($,T)<=0;case"between":return F($,T)>=0&&F($,E)<=0;case"outside":return F($,T)<0||F($,E)>0;case"contains":return String($).toLowerCase().includes(String(T??"").toLowerCase());case"notContains":return!String($).toLowerCase().includes(String(T??"").toLowerCase());case"startsWith":return String($).toLowerCase().startsWith(String(T??"").toLowerCase());case"endsWith":return String($).toLowerCase().endsWith(String(T??"").toLowerCase());default:return!1}}function j($,P,N){const T=ee=>{const ne=String(ee).replace("#",""),se=ne.length===3?ne.split("").map(le=>le+le).join(""):ne;return[0,2,4].map(le=>parseInt(se.slice(le,le+2),16)||0)},[E,A,S]=T($),[x,W,V]=T(P),G=Math.max(0,Math.min(1,N)),Q=(ee,ne)=>Math.round(ee+(ne-ee)*G);return`#${[Q(E,x),Q(A,W),Q(S,V)].map(ee=>ee.toString(16).padStart(2,"0")).join("")}`}function w($){const P=[];for(const x of $||[]){if(x==null||x==="")continue;const W=x instanceof Date?x.getTime():Number(x);Number.isFinite(W)&&P.push(W)}if(!P.length)return null;P.sort((x,W)=>x-W);let N=0,T=0,E=0;for(const x of P){N++;const W=x-T;T+=W/N,E+=W*(x-T)}const A=m(P,.25),S=m(P,.75);return{n:P.length,min:P[0],max:P[P.length-1],mean:T,stddev:P.length>1?Math.sqrt(E/(P.length-1)):0,median:m(P,.5),q1:A,q3:S,iqr:S-A,sorted:P}}function m($,P){if(!$.length)return 0;const N=($.length-1)*Math.max(0,Math.min(1,P)),T=Math.floor(N),E=Math.ceil(N);return T===E?$[T]:$[T]+(N-T)*($[E]-$[T])}function c($){for(const P of Array.isArray($)?$:[])if(!(!P||typeof P!="object")&&(P.when&&Z.includes(P.when.op)||P.scale&&P.scale.from||P.dataBar&&!(Number.isFinite(Number(P.dataBar.min))&&Number.isFinite(Number(P.dataBar.max)))||P.iconSet&&!Array.isArray(P.iconSet.thresholds)))return!0;return!1}function f($,P){const N=Number($.value),T=E=>m(P.sorted,E);switch($.op){case"topPercent":{const E=l(N,10);return{op:"gte",value:T(1-E)}}case"bottomPercent":{const E=l(N,10);return{op:"lte",value:T(E)}}case"topN":{const E=Math.max(1,Math.floor(N)||1),A=Math.max(0,P.sorted.length-E);return{op:"gte",value:P.sorted[A]}}case"bottomN":{const E=Math.max(1,Math.floor(N)||1),A=Math.min(P.sorted.length-1,E-1);return{op:"lte",value:P.sorted[A]}}case"aboveMean":return{op:"gt",value:P.mean};case"belowMean":return{op:"lt",value:P.mean};case"aboveMedian":return{op:"gt",value:P.median};case"belowMedian":return{op:"lt",value:P.median};case"zAbove":return P.stddev?{op:"gte",value:P.mean+(Number.isFinite(N)?N:2)*P.stddev}:null;case"zBelow":return P.stddev?{op:"lte",value:P.mean-(Number.isFinite(N)?N:2)*P.stddev}:null;case"outlier":{const E=(Number.isFinite(N)&&N>0?N:1.5)*P.iqr;return P.iqr?{op:"outside",value:P.q1-E,value2:P.q3+E}:null}default:return null}}function l($,P){const N=Number.isFinite($)?$:P,T=N>1?N/100:N;return Math.max(0,Math.min(1,T))}function r($,P){if($.from==="minmax")return{...$,min:P.min,max:P.max};if($.from==="quantile")return{...$,min:m(P.sorted,l(Number($.low),5)),max:m(P.sorted,l(Number($.high),95))};if($.from==="stddev"){const N=Number.isFinite(Number($.deviations))?Number($.deviations):2;return{...$,min:P.mean-N*P.stddev,max:P.mean+N*P.stddev}}return $}function t($,P){const N=Array.isArray($)?$:[];return!P||!P.n?N.map(T=>T&&c([T])?{...T,enabled:!1}:T):N.map(T=>{if(!T||typeof T!="object")return T;if(T.scale&&T.scale.from)return{...T,scale:r(T.scale,P)};if(T.dataBar)return{...T,dataBar:i(T.dataBar,P)};if(T.iconSet)return{...T,iconSet:s(T.iconSet,P)};if(!T.when||!Z.includes(T.when.op))return T;const E=f(T.when,P);return E?{...T,when:E}:{...T,enabled:!1}})}function i($,P){const N=Number.isFinite(Number($.min))?Number($.min):void 0,T=Number.isFinite(Number($.max))?Number($.max):void 0;if(N!==void 0&&T!==void 0)return{...$,min:N,max:T};if($.from==="quantile")return{...$,min:N??m(P.sorted,l(Number($.low),5)),max:T??m(P.sorted,l(Number($.high),95))};if($.from==="stddev"){const E=Number.isFinite(Number($.deviations))?Number($.deviations):2;return{...$,min:N??P.mean-E*P.stddev,max:T??P.mean+E*P.stddev}}return{...$,min:N??P.min,max:T??P.max}}function s($,P){if(Array.isArray($.thresholds))return $;const N=n($),T=[];for(let E=1;E<N;E++)T.push(m(P.sorted,E/N));return{...$,thresholds:T}}function n($){if(Array.isArray($.icons)&&$.icons.length>=2)return $.icons.length;if(Number.isFinite(Number($.count))&&Number($.count)>=2)return Math.floor(Number($.count));const P=k[$.set];return P?P.length:3}function u($){return`url("data:image/svg+xml,${encodeURIComponent($)}")`}function o($){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="${$}"/></svg>`}function a($,P){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><polygon points="${P==="up"?"8,2 14,13 2,13":P==="down"?"2,3 14,3 8,14":"4,2 14,8 4,14"}" fill="${$}"/></svg>`}function h($,P){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 ${P*16} 16">`;for(let E=0;E<P;E++){const A=E<$?"#f5a623":"#d0d0d0";T+=`<path transform="translate(${E*16},0)" d="${N}" fill="${A}"/>`}return`${T}</svg>`}const v=Object.freeze([a("#c0392b","down"),a("#e0a800","right"),a("#2e7d32","up")]),g=Object.freeze([o("#d13438"),o("#f5a623"),o("#2e9e44")]),k=Object.freeze({arrows:v,trafficLights:g,ratings:Object.freeze([1,2,3,4,5].map($=>h($,5)))}),d=Object.freeze({arrows:"Arrows",trafficLights:"Traffic lights",ratings:"Ratings"});function p($){if(Array.isArray($.icons)&&$.icons.length>=2)return $.icons.map(T=>/^\s*(url\(|data:|<)/.test(String(T))&&String(T).trim().startsWith("<")?u(String(T)):String(T));const P=$.set||"arrows";if(P==="ratings"){const T=n($),E=[];for(let A=1;A<=T;A++)E.push(u(h(A,T)));return E}const N=k[P];return N?N.map(u):(z(`iconSet:${P}`,`unknown icon set '${P}'; falling back to arrows.`),v.map(u))}function b($){const P=Number($.min),T=Number($.max)-P,E=$.colour||$.color||"#5b9bd5",A=$.negativeColour||$.negativeColor||"#d13438",S=$.direction==="rtl"?"left":"right",x=V=>Math.max(0,Math.min(1,(V-P)/T))*100,W=T?Math.max(0,Math.min(100,(0-P)/T*100)):0;return V=>{if(X(V))return null;const G=Number(V);if(!Number.isFinite(G)||!T)return null;const Q=x(G),ee=Math.min(Q,W),ne=Math.max(Q,W),se=G>=0?E:A;return{backgroundImage:`linear-gradient(to ${S}, transparent ${ee}%, ${se} ${ee}%, ${se} ${ne}%, transparent ${ne}%)`,backgroundRepeat:"no-repeat",backgroundPosition:"0 0"}}}function O($){const P=p($),N=$.reverse?[...P].reverse():P,T=(Array.isArray($.thresholds)?$.thresholds:[]).map(Number).filter(Number.isFinite),E=Number.isFinite(Number($.size))?Number($.size):16,A=$.set==="ratings"?E*n($):E;return S=>{if(X(S))return null;const x=Number(S);if(!Number.isFinite(x))return null;let W=0;for(const G of T)x>=G&&W++;const V=N[Math.min(W,N.length-1)];return V?{backgroundImage:V,backgroundRepeat:"no-repeat",backgroundPosition:"left center",backgroundSize:`${A}px ${E}px`,paddingLeft:`${A+4}px`}:null}}function y($){const P=Array.isArray($.colours)&&$.colours.length>=2?$.colours:["#f8f9fa","#1a6bc7"],N=Number($.min),T=Number($.max),E=T-N,A=P.length-1,S=[];for(let W=0;W<=A;W++)S.push(A?W/A:0);const x=Number($.mid);if($.mid!==void 0&&$.mid!==null)if(P.length%2===0)z("formatting.scale.mid.even",`a scale's "mid" needs an odd number of colours (a middle stop to pin); ${P.length} were given, so "mid" was ignored.`);else if(Number.isFinite(x)&&E&&x>Math.min(N,T)&&x<Math.max(N,T)){const W=A/2,V=Math.max(0,Math.min(1,(x-N)/E));for(let G=0;G<=A;G++)S[G]=G<=W?W?G/W*V:V:V+(G-W)/(A-W)*(1-V)}else Number.isFinite(x)&&z("formatting.scale.mid.range",`a scale's "mid" (${x}) is outside its min..max range, so it was ignored.`);return W=>{const V=Number(W);if(!Number.isFinite(V)||!E)return null;const G=Math.max(0,Math.min(1,(V-N)/E));let Q=0;for(;Q<A-1&&G>S[Q+1];)Q++;const ee=S[Q+1]-S[Q],ne=ee>0?(G-S[Q])/ee:0;return{background:j(P[Q],P[Q+1],Math.max(0,Math.min(1,ne)))}}}function M($,P=null){const N=c($)?t($,P):$,T=(Array.isArray(N)?N:[]).filter(S=>S&&typeof S=="object");if(!T.length)return()=>null;const E=T.map(S=>S.scale?{scale:y(S.scale),enabled:S.enabled!==!1}:S.dataBar?{scale:b(S.dataBar),enabled:S.enabled!==!1}:S.iconSet?{scale:O(S.iconSet),enabled:S.enabled!==!1}:{when:S.when,style:S.style,stop:S.stopIfTrue!==!1,enabled:S.enabled!==!1}),A=D(E)?L():null;return(S,x)=>{const W=S?S.value:void 0;let V=null;x&&(x.mode=0);for(const G of E){if(!G.enabled)continue;if(G.scale){const ne=G.scale(W);ne&&(V={...V||{},...ne});continue}if(!H(W,G.when))continue;let Q;const ee=C(G.style);if(ee?x&&A?(Q=G.style(A.enter(S)),A.mode>x.mode&&(x.mode=A.mode)):Q=G.style(S):Q=G.style,Q&&(V=V?{...V,...Q}:ee?Q:{...Q}),G.stop)break}return V}}function D($){return $.some(P=>P.enabled&&!P.scale&&C(P.style))}const _=new Set(["value","colId","column"]),I=new Set(["row","data","index"]);function L(){let $={};const P={mode:0,enter(E){return $=E||{},P.mode=0,T}},N=E=>{if(_.has(E))return;const A=I.has(E)?1:2;A>P.mode&&(P.mode=A)},T=new Proxy({},{get(E,A){return N(A),$[A]},has(E,A){return N(A),A in $},set(E,A,S){return P.mode=2,$[A]=S,!0},ownKeys(){return P.mode=2,Reflect.ownKeys($)},getOwnPropertyDescriptor(E,A){P.mode=2;const S=Object.getOwnPropertyDescriptor($,A);return S?{value:$[A],enumerable:S.enumerable,configurable:!0,writable:!0}:void 0}});return P}}),Ue("packages/core/src/formula/parse.js",function(e,U){"use strict";Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return t}});const te="num",C="str",q="ref",z="name",B="op",Z="end",K=["<=",">=","<>","!="],F="+-*/^%(),<>=";class X extends Error{constructor(s,n){super(s),this.name="FormulaError",this.at=n}}function H(i){const s=[];let n=0;for(;n<i.length;){const u=i[n];if(u===" "||u===" "||u===`
|
|
7
|
-
`||u==="\r"){n++;continue}if(u>="0"&&u<="9"){n=w(i,n,s);continue}if(u==="."&&i[n+1]>="0"&&i[n+1]<="9"){n=w(i,n,s);continue}if(u==='"'||u==="'"){n=m(i,n,s);continue}if(u==="["){const a=i.indexOf("]",n+1);if(a<0)throw new X("a [column reference] was opened and never closed",n);s.push({kind:q,value:i.slice(n+1,a).trim(),at:n}),n=a+1;continue}if(j(u)){n=c(i,n,s);continue}const o=i.slice(n,n+2);if(K.includes(o)){s.push({kind:B,value:o==="!="?"<>":o,at:n}),n+=2;continue}if(F.includes(u)){s.push({kind:B,value:u,at:n}),n++;continue}throw new X(`unexpected character ${JSON.stringify(u)}`,n)}return s.push({kind:Z,value:null,at:i.length}),s}function j(i){return/[A-Za-z_À-]/.test(i)}function w(i,s,n){let u=s,o=!1;for(;u<i.length;){const a=i[u];if(a>="0"&&a<="9"){u++;continue}if(a==="."&&!o){o=!0,u++;continue}if((a==="e"||a==="E")&&/[0-9+-]/.test(i[u+1]||"")){for(u+=2;u<i.length&&i[u]>="0"&&i[u]<="9";)u++;break}break}return n.push({kind:te,value:Number(i.slice(s,u)),at:s}),u}function m(i,s,n){const u=i[s];let o=s+1,a="";for(;o<i.length;){if(i[o]===u){if(i[o+1]===u){a+=u,o+=2;continue}return n.push({kind:C,value:a,at:s}),o+1}a+=i[o],o++}throw new X("a string was opened and never closed",s)}function c(i,s,n){let u=s;for(;u<i.length&&/[A-Za-z0-9_.À-]/.test(i[u]);)u++;const o=i.slice(s,u);let a=u;for(;a<i.length&&i[a]===" ";)a++;return n.push({kind:i[a]==="("?z:q,value:o,at:s}),u}const f={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function l(i){const s=String(i??"").replace(/^\s*=/,"");if(!s.trim())throw new X("the formula is empty");const n=H(s);let u=0;const o=()=>n[u],a=()=>n[u++],h=O=>{const y=o();if(y.kind!==B||y.value!==O)throw new X(`expected ${JSON.stringify(O)}`,y.at);u++},v=O=>{let y=g();for(;;){const M=o();if(M.kind!==B)break;const D=f[M.value];if(!D||D<O)break;u++;const _=v(M.value==="^"?D:D+1);y={kind:"bin",op:M.value,left:y,right:_}}return y},g=()=>{const O=o();return O.kind===B&&(O.value==="-"||O.value==="+")?(u++,{kind:"unary",op:O.value,arg:g()}):k()},k=()=>{let O=d();for(;o().kind===B&&o().value==="%";)u++,O={kind:"unary",op:"%",arg:O};return O},d=()=>{const O=a();if(O.kind===te)return{kind:"num",value:O.value};if(O.kind===C)return{kind:"str",value:O.value};if(O.kind===q)return{kind:"ref",name:O.value};if(O.kind===z){h("(");const y=[];if(!(o().kind===B&&o().value===")"))for(;;){if(y.push(v(1)),o().kind===B&&o().value===","){u++;continue}break}return h(")"),{kind:"call",name:String(O.value).toUpperCase(),args:y}}if(O.kind===B&&O.value==="("){const y=v(1);return h(")"),y}throw O.kind===Z?new X("the formula ends unexpectedly",O.at):new X(`unexpected ${JSON.stringify(O.value)}`,O.at)},p=v(1),b=o();if(b.kind!==Z)throw new X(`unexpected ${JSON.stringify(b.value)}: is an operator missing?`,b.at);return p}function r(i){const s=new Set,n=u=>{if(!(!u||typeof u!="object")){if(u.kind==="ref"){s.add(String(u.name));return}if(u.kind==="bin"){n(u.left),n(u.right);return}if(u.kind==="unary"){n(u.arg);return}if(u.kind==="call")for(const o of u.args)n(o)}};return n(i),[...s]}function t(i){return typeof i=="string"&&/^\s*=/.test(i)&&i.trim()!=="="}}),Ue("packages/core/src/formula/evaluate.js",function(e,U){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return w}});const C=U("packages/core/src/formula/parse.js").FormulaError;function q(m){if(m==null||m==="")return 0;if(typeof m=="boolean")return m?1:0;if(m instanceof Date)return m.getTime();const c=typeof m=="number"?m:Number(String(m).replace(/[,\s]/g,""));if(!Number.isFinite(c))throw new C(`${JSON.stringify(m)} is not a number`);return c}function z(m){return m==null?"":String(m)}function B(m){if(typeof m=="boolean")return m;if(m==null||m==="")return!1;if(typeof m=="number")return m!==0;const c=String(m).trim().toLowerCase();return c==="false"||c==="no"||c==="0"?!1:c!==""}function Z(m){const c=[];for(const f of m){if(Array.isArray(f)){for(const l of f)l!=null&&l!==""&&c.push(q(l));continue}f==null||f===""||c.push(q(f))}return c}function K(m,c){const f=10**c,l=m*f;return Math.sign(l)*Math.round(Math.abs(l)+Number.EPSILON*Math.abs(l))/f}function F(m,c){if(!m.length)return 0;const f=m.slice().sort((i,s)=>i-s),l=(f.length-1)*Math.min(1,Math.max(0,c)),r=Math.floor(l),t=Math.ceil(l);return r===t?f[r]:f[r]+(l-r)*(f[t]-f[r])}function X(m,c){let f=0,l=0,r=0;for(const i of m){f++;const s=i-l;l+=s/f,r+=s*(i-l)}const t=c?f-1:f;return t>0?Math.sqrt(r/t):0}const H={SUM:m=>Z(m).reduce((c,f)=>c+f,0),AVERAGE:m=>{const c=Z(m);return c.length?c.reduce((f,l)=>f+l,0)/c.length:0},MIN:m=>{const c=Z(m);return c.length?Math.min(...c):0},MAX:m=>{const c=Z(m);return c.length?Math.max(...c):0},COUNT:m=>Z(m).length,PRODUCT:m=>Z(m).reduce((c,f)=>c*f,1),ROUND:m=>K(q(m[0]),m.length>1?q(m[1]):0),ROUNDDOWN:m=>{const c=10**(m.length>1?q(m[1]):0),f=q(m[0])*c;return(f<0?Math.ceil(f):Math.floor(f))/c},ROUNDUP:m=>{const c=10**(m.length>1?q(m[1]):0),f=q(m[0])*c;return(f<0?Math.floor(f):Math.ceil(f))/c},ABS:m=>Math.abs(q(m[0])),FLOOR:m=>Math.floor(q(m[0])),CEILING:m=>Math.ceil(q(m[0])),SQRT:m=>Math.sqrt(q(m[0])),POWER:m=>q(m[0])**q(m[1]),MOD:m=>{const c=q(m[1]);if(c===0)throw new C("MOD by zero");return(q(m[0])%c+c)%c},IF:m=>B(m[0])?m[1]:m.length>2?m[2]:!1,AND:m=>m.every(B),OR:m=>m.some(B),NOT:m=>!B(m[0]),COALESCE:m=>m.find(c=>c!=null&&c!=="")??null,CONCAT:m=>m.map(z).join(""),LEN:m=>z(m[0]).length,UPPER:m=>z(m[0]).toUpperCase(),LOWER:m=>z(m[0]).toLowerCase(),TRIM:m=>z(m[0]).trim(),LEFT:m=>z(m[0]).slice(0,m.length>1?q(m[1]):1),RIGHT:m=>{const c=m.length>1?q(m[1]):1;return c<=0?"":z(m[0]).slice(-c)},MEDIAN:m=>F(Z(m),.5),PERCENTILE:m=>{const c=q(m[m.length-1]);return F(Z(m.slice(0,-1)),c>1?c/100:c)},QUARTILE1:m=>F(Z(m),.25),QUARTILE3:m=>F(Z(m),.75),STDEV:m=>X(Z(m),!0),STDEVP:m=>X(Z(m),!1),VAR:m=>{const c=X(Z(m),!0);return c*c},VARP:m=>{const c=X(Z(m),!1);return c*c},COUNTDISTINCT:m=>{const c=new Set;for(const f of m){const l=Array.isArray(f)?f:[f];for(const r of l)r!=null&&r!==""&&c.add(r)}return c.size},IQR:m=>{const c=Z(m);return F(c,.75)-F(c,.25)}};H.AVG=H.AVERAGE,H.CEIL=H.CEILING,H.POW=H.POWER,H.STDEVS=H.STDEV,H.PERCENTILEINC=H.PERCENTILE;function j(m,c){const f=Number(m),l=Number(c);if(m!==null&&m!==""&&c!==null&&c!==""&&Number.isFinite(f)&&Number.isFinite(l))return f<l?-1:f>l?1:0;const t=z(m).toLowerCase(),i=z(c).toLowerCase();return t<i?-1:t>i?1:0}function w(m,c={}){const f=typeof c.lookup=="function"?c.lookup:null,l=c.functions?{...H,...c.functions}:H,r=t=>{switch(t.kind){case"num":return t.value;case"str":return t.value;case"ref":{if(!f)throw new C(`there is no column called ${JSON.stringify(t.name)} here`);const i=f(String(t.name));if(i===void 0)throw new C(`there is no column called ${JSON.stringify(t.name)}`);return i}case"unary":{if(t.op==="%")return q(r(t.arg))/100;const i=q(r(t.arg));return t.op==="-"?-i:i}case"bin":{const i=t.op;if(i==="=")return j(r(t.left),r(t.right))===0;if(i==="<>")return j(r(t.left),r(t.right))!==0;if(i==="<")return j(r(t.left),r(t.right))<0;if(i==="<=")return j(r(t.left),r(t.right))<=0;if(i===">")return j(r(t.left),r(t.right))>0;if(i===">=")return j(r(t.left),r(t.right))>=0;const s=q(r(t.left)),n=q(r(t.right));if(i==="+")return s+n;if(i==="-")return s-n;if(i==="*")return s*n;if(i==="^")return s**n;if(i==="/"){if(n===0)throw new C("division by zero");return s/n}throw new C(`unknown operator ${JSON.stringify(i)}`)}case"call":{const i=c.lazy&&c.lazy[t.name];if(typeof i=="function")return i(t.args,r,c);const s=l[t.name];if(typeof s!="function")throw new C(`there is no function called ${t.name}`);return s(t.args.map(r),c)}default:throw new C("the formula could not be read")}};return r(m)}}),Ue("packages/core/src/formula/index.js",function(e,U){"use strict";Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return j}});const te=U("packages/core/src/formula/parse.js"),C=te.parseFormula,q=te.referencesOf,z=te.looksLikeFormula,B=te.FormulaError,Z=te.tokenise,K=U("packages/core/src/formula/evaluate.js"),F=K.evaluateAst,X=K.FUNCTIONS;function H(w){const{grid:m,row:c,data:f}=w||{},l=n=>String(n).toLowerCase().replace(/[\s_-]/g,""),r=m&&m.columns&&typeof m.columns.all=="function"?m.columns.all():[],t=m&&m.permissions,i=t&&typeof t.isReadable=="function"?n=>t.isReadable(n):()=>!0,s=new Set;for(const n of r)i(n)||(s.add(l(n.id)),n.field&&s.add(l(n.field)),n.title&&s.add(l(n.title)));return n=>{const u=l(n);if(s.has(u))throw new B(`"${n}" cannot be read`);for(const o of r)if(l(o.id)===u||o.field&&l(o.field)===u||o.title&&l(o.title)===u)return c&&m.rows&&typeof m.rows.value=="function"?m.rows.value(c.key,o.id):f?f[o.field||o.id]:void 0;if(f&&typeof f=="object"){for(const o of Object.keys(f))if(l(o)===u){if(!i(o))throw new B(`"${n}" cannot be read`);return f[o]}}}}function j(w,m={}){try{const c=C(w);return{ok:!0,value:F(c,{lookup:H(m),functions:m.formulaFunctions}),references:q(c)}}catch(c){return{ok:!1,error:c instanceof B?c.message:"the formula could not be read",at:c instanceof B?c.at:void 0}}}}),Ue("packages/core/src/internal/version.js",function(e,U){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return q}});const te="1.101.2";async function C(){return te}const q="1.101.2"}),Ue("packages/core/src/internal/merge.js",function(e,U){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"mergeRow",{enumerable:!0,get:function(){return K}});const C=U("packages/core/src/internal/predicates.js").isObject;function q(F,X,H){if(F!==void 0)return F===!0?{enabled:!0,...H}:F===!1?{enabled:!1}:C(F)?F:{[X]:F,enabled:!0}}function z(F){return F==null?[]:Array.isArray(F)?F:[F]}const B=Object.freeze(new Set(["__proto__","constructor","prototype"]));function Z(F,X){if(!C(F))return C(X)?{...X}:X;if(!C(X))return X===void 0?F:X;const H={...F};for(const j of Object.keys(X)){if(B.has(j))continue;const w=X[j];w!==void 0&&(H[j]=C(w)&&C(H[j])?Z(H[j],w):w)}return H}function K(F,X){if(!C(F)||!C(X)||F===X)return X;const H=Object.create(Object.getPrototypeOf(F));return Object.assign(H,F,X),H}}),Ue("packages/core/src/internal/schedule.js",function(e,U){"use strict";Object.defineProperty(e,"now",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"nextFrame",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return K}});function te(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const C=typeof requestAnimationFrame=="function";function q(F){return C?requestAnimationFrame(F):setTimeout(()=>F(te()),16)}function z(F){F!=null&&(C?cancelAnimationFrame(F):clearTimeout(F))}function B(F){let X=null,H=null;const j=()=>{X=null;const m=H;H=null,F(...m||[])},w=(...m)=>{H=m,X===null&&(X=q(j))};return w.cancel=()=>{z(X),X=null,H=null},w.flush=()=>{X!==null&&(z(X),j())},w}function Z(F,X){let H=null,j=null;const w=()=>{if(H=null,j===null)return;const f=j;j=null,F(...f),m()},m=()=>{H=setTimeout(w,X),typeof H?.unref=="function"&&H.unref()},c=(...f)=>{H===null?(F(...f),m()):(j=f,clearTimeout(H),m())};return c.flush=()=>{if(H!==null&&clearTimeout(H),H=null,j===null)return;const f=j;j=null,F(...f)},c.cancel=()=>{H!==null&&clearTimeout(H),H=null,j=null},c.pending=()=>H!==null||j!==null,c}function K(F,X=50){return typeof requestIdleCallback=="function"?requestIdleCallback(F,{timeout:X}):setTimeout(()=>F({timeRemaining:()=>0,didTimeout:!0}),1)}}),Ue("packages/core/src/internal/paths.js",function(e,U){"use strict";Object.defineProperty(e,"pathGetter",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"pathSetter",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"getPath",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return Z}});const te=new Map;function C(K){let F=te.get(K);if(F)return F;if(!K.includes("."))F=X=>X?.[K];else{const X=K.split("."),H=X.length;F=j=>{let w=j;for(let m=0;m<H;m++){if(w==null)return;w=w[X[m]]}return w}}return te.set(K,F),F}const q=new Map;function z(K){let F=q.get(K);if(F)return F;if(!K.includes("."))F=(X,H)=>{X!=null&&(X[K]=H)};else{const X=K.split("."),H=X.length-1;F=(j,w)=>{let m=j;for(let c=0;c<H;c++){if(m==null)return;const f=X[c];m[f]==null&&(m[f]={}),m=m[f]}m!=null&&(m[X[H]]=w)}}return q.set(K,F),F}function B(K,F){return C(F)(K)}function Z(K,F,X){z(F)(K,X)}}),Ue("packages/core/src/internal/compare.js",function(e,U){"use strict";Object.defineProperty(e,"collator",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"defaultCompare",{enumerable:!0,get:function(){return q}});const te=new Map;function C(z,B){const Z=`${z||""}|${B?JSON.stringify(B):""}`;let K=te.get(Z);return K||(K=new Intl.Collator(z||void 0,{numeric:!0,sensitivity:"variant",...B}),te.set(Z,K)),K}function q(z,B){if(z===B)return 0;if(z==null)return 1;if(B==null)return-1;if(typeof z=="number"&&typeof B=="number")return Number.isNaN(z)?Number.isNaN(B)?0:1:Number.isNaN(B)||z<B?-1:z>B?1:0;const Z=String(z),K=String(B);return Z<K?-1:Z>K?1:0}}),Ue("packages/core/src/defaults.js",function(e,U){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return j}});const C=U("packages/core/src/internal/predicates.js").isObject,z=U("packages/core/src/internal/merge.js").merge,Z=U("packages/core/src/internal/warn.js").warnOnce;let K=null;class F extends Error{}function X(w,m=new Set){if(Array.isArray(w)){if(m.has(w))throw new F;m.add(w);const f=w.map(l=>X(l,m));return m.delete(w),f}if(!C(w)||Object.getPrototypeOf(w)!==Object.prototype&&Object.getPrototypeOf(w)!==null)return w;if(m.has(w))throw new F;m.add(w);const c={};for(const[f,l]of Object.entries(w))c[f]=X(l,m);return m.delete(w),c}function H(w){if(w===void 0)return X(K??{});if(w===null)return K=null,{};if(!C(w))return Z("defaults:type",`defaults() expects a configuration object, or null to clear it, but got ${Array.isArray(w)?"an array":typeof w}. The call was ignored and the defaults are unchanged.`),X(K??{});try{K=X(w)}catch(m){if(!(m instanceof F))throw m;return Z("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."),X(K??{})}return X(K)}function j(w){return K===null?w:z(X(K),w)}}),Ue("packages/core/src/internal/uid.js",function(e,U){"use strict";Object.defineProperty(e,"uid",{enumerable:!0,get:function(){return C}});let te=0;function C(q="l"){return`${q}${(++te).toString(36)}`}}),Ue("packages/core/src/events/names.js",function(e,U){"use strict";Object.defineProperty(e,"EVENT_NAMES",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isKnownEvent",{enumerable:!0,get:function(){return q}});const te=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","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:menu:open","columns:changed","columns:tagged","columngroup:changed","header: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"]),C=new Set(te);function q(z){return z==="*"||C.has(z)}}),Ue("packages/core/src/events/bus.js",function(e,U){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return f}});const te=U("packages/core/src/internal/warn.js"),C=te.warnOnce,q=te.DEV,B=U("packages/core/src/internal/uid.js").uid,K=U("packages/core/src/events/names.js").isKnownEvent,F="*";function X(l,r){!q||K(r)||C(`bus.unknown:${r}`,`${l}('${r}') 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 H=new Set(["api","user","init","ai"]),j=new WeakMap;function w(l){let r=j.get(l);return r||(r=B("h"),j.set(l,r)),r}function m(){return typeof performance=="object"&&performance?performance.now():Date.now()}function c(l){if(!l||typeof l!="object")return{};const r={};for(const[t,i]of Object.entries(l))t!=="grid"&&(i==null?r[t]=String(i):Array.isArray(i)?r[t]=`[${i.length}]`:typeof i=="object"?r[t]=i.key?`row ${i.key}`:"{…}":typeof i=="function"?r[t]="[function]":r[t]=String(i).slice(0,60));return r}class f{#e=new Map;#t=!1;#n=[];#r=200;#s=new Map;#i=null;#o=!1;#l=0;constructor(r=null){this.#i=r}attach(r){this.#i=r}get grid(){return this.#i}get destroyed(){return this.#o}on(r,t){if(typeof t!="function")return C(`bus.handler:${r}`,`on('${r}') needs a function; ignored.`),()=>{};X("on",r);let i=this.#e.get(r);return i||(i=[],this.#e.set(r,i)),i.push(t),()=>this.off(r,t)}once(r,t){if(typeof t!="function")return C(`bus.handler:${r}`,`once('${r}') needs a function; ignored.`),()=>{};X("once",r);const i=s=>{this.off(r,t),t(s)};return this.#s.set(t,i),this.on(r,i)}off(r,t){if(t===void 0){this.#e.delete(r);return}const i=this.#e.get(r);if(!i)return;const s=this.#s.get(t),n=s&&i.includes(s)?s:t,u=i.indexOf(n);u>=0&&i.splice(u,1),s&&n===s&&this.#s.delete(t),i.length===0&&this.#e.delete(r)}count(r){const t=this.#e.get(r),i=r===F?null:this.#e.get(F);return(t?t.length:0)+(i?i.length:0)}#a(r,t,i,s,n){this.#n.push({type:r,origin:t,listeners:(s?s.length:0)+(n?n.length:0),payload:c(i),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(r,t){this.#t=!!r,Number.isFinite(t)&&t>0&&(this.#r=Math.floor(t)),r||(this.#n=[])}eventLog(){return this.#n.map(r=>({...r}))}clearEventLog(){this.#n=[]}counts(){const r={};for(const[t,i]of this.#e)r[t]=i.length;return r}emit(r,t,i){const s=i??(t&&t.origin),n=H.has(s)?s:"api",u={...t||null,type:r,origin:n,grid:this.#i};if(this.#o)return u;const o=this.#e.get(r),a=r===F?void 0:this.#e.get(F);if(this.#t&&this.#a(r,n,t,o,a),!o&&!a)return u;const h=this.#t?m():0;this.#l++;try{o&&this.#c(o.slice(),u,r),a&&this.#c(a.slice(),u,F)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=m()-h)}return u}emitBefore(r,t,i){const s=i??(t&&t.origin),n=H.has(s)?s:"user";let u=!1,o=null;const a=p=>{u=!0,p!=null&&o===null&&(o=String(p))},h={...t||null,type:r,origin:n,grid:this.#i,get defaultPrevented(){return u},get reason(){return o},preventDefault(p){a(p)}};if(this.#o)return!0;const v=this.#e.get(r);this.#t&&this.#a(r,n,t,v,void 0);const g=v?v.slice():[];if(g.length===0)return!0;const k=()=>(u&&o===null&&(o="prevented"),u&&t&&typeof t=="object"&&(t.reason=o),!u),d=[];for(const p of g)try{const b=p(h);b&&typeof b.then=="function"?d.push(b):b===!1&&a("prevented")}catch(b){a("error"),C(`bus.beforeThrow:${r}:${w(p)}`,`a '${r}' before-handler threw; the action was cancelled.`,b)}return d.length===0?k():Promise.allSettled(d).then(p=>{for(const b of p)b.status==="rejected"?(a("error"),C(`bus.beforeReject:${r}`,`a '${r}' before-handler rejected; the action was cancelled.`,b.reason)):b.value===!1&&a("prevented");return k()})}#c(r,t,i){for(let s=0;s<r.length;s++)try{r[s](t)}catch(n){C(`bus.throw:${i}:${w(r[s])}`,`a '${i}' handler threw; other handlers were unaffected.`,n)}}clear(){this.#e.clear(),this.#s.clear()}destroy(){this.clear(),this.#o=!0,this.#i=null}}}),Ue("packages/core/src/registry/free-tier-notice.js",function(e,U){"use strict";Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return te}});const te="Free for non-commercial use: latticegrid.dev/free"}),Ue("packages/core/src/registry/licence.js",function(e,U){"use strict";Object.defineProperty(e,"PRODUCT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"LICENCE_VERSION",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"fromBase64Url",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"toBase64Url",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"asciiBytes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"parseLicence",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"hasEd25519",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"verifyLicence",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"isLocalHost",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"currentHost",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"matchesDomain",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"LicenceHolder",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setLicence",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return L}});const C=U("packages/core/src/internal/warn.js").warnOnce,q=U("packages/core/src/registry/free-tier-notice.js"),z=q.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return q.FREE_TIER_NOTICE}});const B="lattice-grid",Z=1,K="LG1",F=64,X="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",H="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",j=(()=>{const $=new Int16Array(128).fill(-1);for(let P=0;P<H.length;P++)$[H.charCodeAt(P)]=P;return $[43]=62,$[47]=63,$})();function w($){if(typeof $!="string")return null;let P="";for(let x=0;x<$.length;x++){const W=$.charCodeAt(x);if(W!==61){if(W>127||j[W]<0)return null;P+=$[x]}}const N=P.length;if(N%4===1)return null;const T=new Uint8Array(Math.floor(N*3/4));let E=0,A=0,S=0;for(let x=0;x<N;x++)E=E<<6|j[P.charCodeAt(x)],A+=6,A>=8&&(A-=8,T[S++]=E>>A&255);return S===T.length?T:T.subarray(0,S)}function m($){let P="",N=0;for(;N+2<$.length;N+=3){const E=$[N]<<16|$[N+1]<<8|$[N+2];P+=H[E>>18&63]+H[E>>12&63]+H[E>>6&63]+H[E&63]}const T=$.length-N;if(T===1){const E=$[N]<<16;P+=H[E>>18&63]+H[E>>12&63]}else if(T===2){const E=$[N]<<16|$[N+1]<<8;P+=H[E>>18&63]+H[E>>12&63]+H[E>>6&63]}return P}function c($){const P=new Uint8Array($.length);for(let N=0;N<$.length;N++)P[N]=$.charCodeAt(N)&127;return P}function f($){if(typeof TextDecoder=="function")return new TextDecoder().decode($);let P="";for(let N=0;N<$.length;N++)P+=String.fromCharCode($[N]);return P}function l($){const P={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof $=="string"?$:""};if(typeof $!="string"||$.length===0)return{...P,reason:"missing"};const N=$.trim(),T=N.split(".");if(T.length!==3)return P;const[E,A,S]=T;if(E!==K)return{...P,reason:"prefix"};const x=w(A),W=w(S);if(!x||!W)return P;let V;try{V=JSON.parse(f(x))}catch{return P}return V===null||typeof V!="object"?P:{ok:!0,reason:null,product:typeof V.p=="string"?V.p:null,issuedTo:typeof V.t=="string"?V.t:null,expires:typeof V.e=="string"?V.e:null,terms:typeof V.terms=="string"?V.terms:null,features:Array.isArray(V.f)?V.f.slice():[],deployments:Array.isArray(V.d)?V.d.slice():[],version:typeof V.v=="number"?V.v:0,message:c(A),signature:W,raw:N}}function r($,P){if(!$)return!1;const N=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test($)?`${$}T23:59:59.999Z`:$);return Number.isNaN(N)?!0:P>N}function t($){return $==="non-commercial"?"non-commercial":"commercial"}let i=null,s=null,n=null;function u(){const $=globalThis.crypto;return $&&$.subtle?$.subtle:null}async function o($){if(i&&s===$)return i;const P=u();if(!P)return null;const N=w($);if(!N)return null;try{const T=await P.importKey("raw",N,{name:"Ed25519"},!1,["verify"]);return i=T,s=$,T}catch{return null}}async function a(){return n!==null||(n=await o(X)!==null),n}async function h($,P={}){const N=P.warn!==!1,T=P.product||B,E=P.publicKey||X,A=P.now??Date.now(),S=P.host??g(),x=v(S)?"":` ${z}`,W=l($);if(!W.ok){const ne=W.reason==="missing"?"missing":"malformed";return N&&C(`licence.${ne}`,ne==="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:ne,terms:"commercial"}}const V={product:W.product||void 0,issuedTo:W.issuedTo||void 0,expires:W.expires||void 0,terms:t(W.terms)};if(W.product!==T)return N&&C("licence.product",`licence key is for '${W.product}', not '${T}'. The grid will render with a watermark.`),{valid:!1,...V,reason:"product"};if(r(W.expires,A))return N&&C("licence.expired",`licence expired on ${W.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,...V,reason:"expired"};const G=W.deployments||[];if(G.length&&S&&!v(S)&&!k(S,G))return N&&C("licence.domain",`licence key is not valid for ${S}; it covers ${G.join(", ")}. The grid will render with a watermark.`),{valid:!1,...V,reason:"domain"};const Q=await o(E);if(!Q){const ne=!!W.signature&&W.signature.length===F;return N&&C("licence.algorithm","this host does not provide crypto.subtle Ed25519, so the licence signature could not be verified. A structural check was used instead."),ne?{valid:!0,...V,reason:"unverified"}:{valid:!1,...V,reason:"signature"}}let ee=!1;try{ee=await u().verify({name:"Ed25519"},Q,W.signature,W.message)}catch{ee=!1}return ee?{valid:!0,...V}:(N&&C("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...V,reason:"signature"})}function v($){const P=String($??g()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!P||P==="localhost"||P.endsWith(".localhost")||P==="::1"||P==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(P)}function g(){const $=globalThis.location;return $&&typeof $.hostname=="string"?$.hostname:null}function k($,P){const N=d($);return!N||!Array.isArray(P)?!1:P.some(T=>{const E=d(T);if(!E)return!1;if(E==="*")return!0;if(E.startsWith("*.")){const A=E.slice(2);return N===A||N.endsWith(`.${A}`)}return N===E})}function d($){return String($??"").trim().toLowerCase().replace(/\.$/,"")}class p{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#s;#i=new Set;constructor(P={}){this.#s=P}set(P){this.#e=typeof P=="string"?P.trim():"";const N=l(this.#e);return this.#t=N.ok?{valid:!r(N.expires,Date.now())&&N.product===(this.#s.product||B),product:N.product||void 0,issuedTo:N.issuedTo||void 0,expires:N.expires||void 0,terms:t(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 P=this.#e;return this.#n=h(P,this.#s).then(N=>{if(this.#e===P){this.#t=N;for(const T of this.#i)T(N)}return N}),this.#n}onSettled(P){return this.#i.add(P),()=>this.#i.delete(P)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!v(this.#r)}setHost(P){this.#r=P}state(){return this.#t.valid?"licensed":v(this.#r)?"localhost":"trial"}reset(){this.#e="",this.#t={valid:!1,reason:"missing",terms:"commercial"},this.#n=null,this.#i.clear()}}const b=Symbol.for("lattice-grid/licence/holder");function O(){const $=globalThis,P=$&&$[b];if(P&&typeof P.set=="function"&&typeof P.watermark=="function")return P;const N=new p;if($)try{$[b]=N}catch{}return N}const y=O();function M($){return y.set($)}function D(){return y.info()}function _(){return y.watermark()}function I(){return y.state()}function L(){return y}}),Ue("packages/core/src/registry/registry.js",function(e,U){"use strict";Object.defineProperty(e,"KINDS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"REGIONS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return i}});const te=U("packages/core/src/internal/warn.js"),C=te.warnOnce,q=te.DEV,B=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/registry/licence.js"),K=Z.LicenceHolder,F=Z.sharedLicence,X=["renderer","editor","filter","dataType","totalFn","pipe","component"],H=["all","header","body","totals","panels"];class j{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#s;#i=null;#o=null;#l=new Set;#a=new Map;constructor(n={}){for(const u of X)this.#t.set(u,new Map);this.#s=n.holder||F(),this.#o=n.grid??null,this.#i=this.#s.onSettled(()=>{this.#d({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),n.licence&&this.setLicence(n.licence)}registerModules(n,u={}){u.licence&&this.setLicence(u.licence),u.grid!==void 0&&(this.#o=u.grid);const o=Array.isArray(n)?n:[n],a=[];for(const h of o){if(!h||typeof h!="object"||typeof h.name!="string"||!h.name){C("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(h.name)){q&&this.#u(this.#e.get(h.name),h);continue}if(!B(h.install)){C(`registry.module.install:${h.name}`,`module '${h.name}' has no install() and was ignored.`);continue}const v={registry:this,grid:this.#o};try{h.install(v)}catch(g){C(`registry.module.throw:${h.name}`,`module '${h.name}' threw during install; it was not registered.`,g);continue}this.#e.set(h.name,h);for(const g of w(h))this.#n.add(g);a.push(h.name),this.#d({reason:"module",name:h.name,capabilities:this.capabilities(),regions:f(h)})}return a}unregisterModule(n){const u=this.#e.get(n);if(!u)return!1;if(B(u.uninstall))try{u.uninstall({registry:this,grid:this.#o})}catch(o){C(`registry.module.uninstall:${n}`,`module '${n}' threw during uninstall.`,o)}return this.#e.delete(n),this.#c(),this.#d({reason:"unmodule",name:n,capabilities:this.capabilities(),regions:f(u)}),!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 u of w(n))this.#n.add(u)}#u(n,u){!n||n===u||m(n,u)||C(`registry.module.reconfigure:${u.name}`,`module '${u.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 B(n)?(this.#r.add(n),this.#a.set(n,this.#o),()=>{this.#r.delete(n),this.#a.delete(n)}):()=>{}}#d(n){for(const u of[...this.#r])try{u(n)}catch(o){C("registry.onChange.throw","a registry change handler threw.",o)}}register(n,u,o){const a=this.#t.get(n);if(!a){C(`registry.kind:${n}`,`unknown registry kind '${n}'; expected one of ${X.join(", ")}.`);return}if(!u||typeof u!="string"){C(`registry.name:${n}`,`register('${n}', ...) needs a name.`);return}a.has(u)&&a.get(u)!==o&&C(`registry.replace:${n}:${u}`,`'${u}' was already registered as a ${n} and has been replaced.`),a.set(u,o),this.#d({reason:"register",name:u,kind:n,capabilities:this.capabilities(),regions:l(n)})}registerAll(n,u){if(u)for(const o of Object.keys(u))this.register(n,o,u[o])}get(n,u){const o=this.#t.get(n);return o?o.get(u):void 0}names(n){const u=this.#t.get(n);return u?[...u.keys()]:[]}#f(n,u){const o=this.#t.get(n).get(u);return o!==void 0?o:this.#t.get("component").get(u)}renderer(n){return this.#f("renderer",n)}editor(n){return this.#f("editor",n)}filter(n){return this.#f("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.#s.set(n)}licence(){return this.#s.info()}licenceVerified(){return this.#s.verify()}watermark(){return this.#s.watermark()}attach(n){n!=null&&(this.#l.add(n),this.#o=n)}detach(n){if(n!=null){this.#l.delete(n);for(const[u,o]of[...this.#a])o===n&&(this.#r.delete(u),this.#a.delete(u));if(this.#o===n){const u=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#o=u}this.#l.size===0&&this.#i&&(this.#i(),this.#i=null)}}destroy(n){if(n!=null){this.detach(n);return}for(const u of[...this.#e.keys()])this.unregisterModule(u);this.#r.clear(),this.#a.clear(),this.#l.clear(),this.#i&&this.#i(),this.#i=null,this.#o=null}}function w(s){const n=s.capabilities,u=Array.isArray(n)?n.filter(o=>typeof o=="string"):[];return[s.name,...u]}function m(s,n){return s.install!==n.install||s.uninstall!==n.uninstall||(s.version||"")!==(n.version||"")?!1:c(w(s),w(n))&&c(f(s),f(n))}function c(s,n){const u=new Set(s),o=new Set(n);if(u.size!==o.size)return!1;for(const a of u)if(!o.has(a))return!1;return!0}function f(s){const n=s.regions;return!Array.isArray(n)||n.length===0?["all"]:n.filter(u=>H.includes(u))}function l(s){switch(s){case"filter":return["header"];case"totalFn":return["totals"];case"renderer":case"editor":case"pipe":return["body"];default:return["all"]}}const r=new j;function t(){return r}function i(s,n={}){return r.registerModules(s,n)}}),Ue("packages/core/src/internal/text.js",function(e,U){"use strict";Object.defineProperty(e,"humanise",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"escapeHtml",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return z}});function te(B){return B?(B.includes(".")?B.slice(B.lastIndexOf(".")+1):B).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(/^./,K=>K.toUpperCase()):""}const C={"&":"&","<":"<",">":">",'"':""","'":"'"};function q(B){const Z=B==null?"":String(B);return/[&<>"']/.test(Z)?Z.replace(/[&<>"']/g,K=>C[K]):Z}function z(B){return String(B).replace(/\w\S*/g,Z=>Z[0].toUpperCase()+Z.slice(1).toLowerCase())}}),Ue("packages/core/src/format/mask.js",function(e,U){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return Z}});const te=new Set(["0","#","?",",","."]),C="\0";function q(F){const X=[];let H="",j=!1;for(let w=0;w<F.length;w++){const m=F[w];if(m==="\\"){H+=m+(F[w+1]??""),w+=1;continue}if(m==='"'){j=!j,H+=m;continue}if(m===";"&&!j){X.push(H),H="";continue}H+=m}return X.push(H),X}function z(F){let X="",H="",j="",w=1,m=!1,c=!1;const f=a=>{c?H+=a:X+=a};for(let a=0;a<F.length;a++){const h=F[a];if(h==="\\"){f(F[a+1]??""),a+=1;continue}if(h==='"'){const v=F.indexOf('"',a+1);f(v===-1?F.slice(a+1):F.slice(a+1,v)),a=v===-1?F.length:v;continue}if(h==="%"){w*=100,f("%");continue}if(h==="@"){m=!0,f("\0");continue}if(te.has(h)){j+=h,c=!0;continue}f(h)}let l=-1;for(let a=j.length-1;a>=0;a--){const h=j[a];if(h==="0"||h==="#"||h==="?"){l=a;break}}let r=!1,t="";for(let a=0;a<j.length;a++){const h=j[a];if(h===","){a>l?w/=1e3:r=!0;continue}t+=h}const i=t.indexOf("."),s=i===-1?t:t.slice(0,i),n=i===-1?"":t.slice(i+1);let u=0;for(const a of s)a==="0"&&(u+=1);let o=0;for(const a of n)a==="0"&&(o+=1);return{prefix:X,suffix:H,minInt:u,minDec:o,maxDec:n.length,grouping:r,scale:w,hasNumber:l!==-1,isText:m}}function B(F,X){const H=new Intl.NumberFormat(X,{minimumIntegerDigits:Math.max(F.minInt,1),minimumFractionDigits:F.minDec,maximumFractionDigits:Math.max(F.maxDec,F.minDec),useGrouping:F.grouping}),{prefix:j,suffix:w,scale:m,hasNumber:c}=F;return f=>{if(!c)return j+w;const l=m===1?f:f*m;return j+H.format(l)+w}}function Z(F,X){const j=q(String(F)).map(z),w=j.map(t=>B(t,X)),m=0,c=j.length>1?1:-1,f=j.length>2?2:-1,l=j.length>3?3:-1,r=t=>{if(t==null||t==="")return"";if(typeof t!="number"||Number.isNaN(t)){const i=Number(t);if(Number.isNaN(i))return l===-1?String(t):(j[l].prefix+j[l].suffix).split("\0").join(String(t));t=i}return t===0&&f!==-1?w[f](0):t<0&&c!==-1?w[c](-t):w[m](t)};return r.spec={mask:F},{format:r,ooxml:K(String(F))}}function K(F){return F.trim()}}),Ue("packages/core/src/format/pattern.js",function(e,U){"use strict";Object.defineProperty(e,"parseNumberPattern",{enumerable:!0,get:function(){return B}});const C=U("packages/core/src/format/mask.js").splitSections;function q(Z){let K="",F="",X="",H="",j=!1,w=!1,m=!1,c=!1;const f=r=>{m?F+=r:K+=r};for(let r=0;r<Z.length;r++){const t=Z[r];if(t==="\\"){f(Z[r+1]??""),r+=1;continue}if(t==='"'){const i=Z.indexOf('"',r+1);f(i===-1?Z.slice(r+1):Z.slice(r+1,i)),r=i===-1?Z.length:i;continue}if(t==="%"){w=!0;continue}if(t==="0"||t==="#"){m=!0,c?H+=t:X+=t;continue}if(t===","){c||(j=!0);continue}if(t==="."&&!c){c=!0;continue}f(t)}if(!m)return{hasDigit:!1,prefix:K,suffix:F,minDec:0,maxDec:0,grouping:!1,percent:w};let l=0;for(const r of H)r==="0"&&(l+=1);return{hasDigit:!0,prefix:K,suffix:F,minDec:l,maxDec:H.length,grouping:j,percent:w}}function z(Z,K){const F=K.trim(),X=Z.trim();return F.startsWith("(")&&F.endsWith(")")&&F.slice(1,-1).trim()===X?"parentheses":F.endsWith("-")?"suffix":"minus"}function B(Z){if(typeof Z!="string")return null;const K=C(Z);if(K.length===0)return null;const F=q(K[0]);if(!F.hasDigit)return null;const X={style:F.percent?"percent":"decimal",prefix:F.prefix,suffix:F.suffix,minDecimals:F.minDec,maxDecimals:Math.max(F.maxDec,F.minDec),thousandsSeparator:F.grouping?void 0:!1};if(K.length>1&&(X.negative=z(K[0],K[1])),K.length>2){const H=q(K[2]);H.hasDigit||(X.zeroDisplay=H.prefix+H.suffix)}return X}}),Ue("packages/core/src/format/number.js",function(e,U){"use strict";Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return K}});const C=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/warn.js").warnOnce,Z=U("packages/core/src/format/pattern.js").parseNumberPattern;function K(F,X){const H=typeof F=="string"?{pattern:F}:F||{};let j=H;if(typeof H.pattern=="string"){const O=Z(H.pattern);if(O){const{pattern:y,...M}=H;j={...O,...M}}else z(`format:pattern:${H.pattern}`,`invalid number format pattern "${H.pattern}"; the value will use the default number format`)}const w=j.locale||X||void 0,m=j.style||"decimal",c=typeof j.scale=="number"?j.scale:1,f=j.nullDisplay??"",l=j.zeroDisplay,r=j.prefix||"",t=j.suffix||"",i=j.negative||"minus",s=j.signed===!0,n={style:m,notation:j.notation||"standard"};m==="currency"&&(n.currency=j.currency||"USD",j.currencyDisplay&&(n.currencyDisplay=j.currencyDisplay)),typeof j.decimals=="number"?(n.minimumFractionDigits=j.decimals,n.maximumFractionDigits=j.decimals):(typeof j.minDecimals=="number"&&(n.minimumFractionDigits=j.minDecimals),typeof j.maxDecimals=="number"&&(n.maximumFractionDigits=j.maxDecimals),n.minimumFractionDigits>(n.maximumFractionDigits??20)&&(n.maximumFractionDigits=n.minimumFractionDigits)),j.thousandsSeparator===!1&&(n.useGrouping=!1),n.notation==="compact"&&(n.compactDisplay=j.compactDisplay||"short");const u=new Intl.NumberFormat(w,n),o=typeof j.thousandsSeparator=="string"?j.thousandsSeparator:null,a=typeof j.decimalSeparator=="string"?j.decimalSeparator:null;let h=",",v=".";if(o||a)for(const O of u.formatToParts(12345.6))O.type==="group"?h=O.value:O.type==="decimal"&&(v=O.value);const g=O=>{let y=O;return o&&(y=y.split(h).join("")),a&&(y=y.split(v).join("")),o&&(y=y.split("").join(o)),a&&(y=y.split("").join(a)),y},k=!!(o||a),d=r!==""&&m==="currency",p=O=>{let y;if(d){const M=u.formatToParts(O);let D=!1;y="";for(const _ of M)y+=_.value,!D&&_.type==="currency"&&(y+=r,D=!0);D||(y=r+y)}else y=r+u.format(O);return k&&(y=g(y)),y+t},b=O=>{if(C(O)||O==="")return f;const y=typeof O=="number"?O:Number(O);if(Number.isNaN(y))return f;const M=c===1?y:y*c;return M===0&&l!==void 0?l:M<0?i==="parentheses"?`(${p(-M)})`:i==="suffix"?`${p(-M)}-`:p(M):s&&M>0?`+${p(M)}`:p(M)};return b.negativeClass=j.negativeClass||null,b.spec=j,b}}),Ue("packages/core/src/format/date.js",function(e,U){"use strict";Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return t}});const C=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/warn.js").warnOnce,B=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function Z(i){const s=[];let n=0,u="";const o=()=>{u&&(s.push({token:null,text:u}),u="")};for(;n<i.length;){const a=i[n];if(a==="'"){if(i[n+1]==="'"){u+="'",n+=2;continue}const v=i.indexOf("'",n+1);if(v===-1){u+=i.slice(n+1),n=i.length;continue}u+=i.slice(n+1,v),n=v+1;continue}const h=B.find(v=>i.startsWith(v,n));if(h){o(),s.push({token:h,text:h}),n+=h.length;continue}/[A-Za-z]/.test(a)&&z(`date.pattern.token:${a}`,`the date pattern "${i}" contains '${a}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${B.join(" ")}.`),u+=a,n+=1}return o(),s}const K=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function F(i){if(C(i)||i==="")return null;if(i instanceof Date)return Number.isNaN(i.getTime())?null:i;if(typeof i=="number")return Number.isNaN(i)?null:new Date(i);if(typeof i=="string"){const s=K.exec(i.trim());if(s){const[,u,o,a,h="0",v="0",g="0"]=s;return new Date(+u,+o-1,+a,+h,+v,+g)}const n=new Date(i);return Number.isNaN(n.getTime())?null:n}return null}function X(i,s){return String(i).padStart(s,"0")}function H(i){if(!i)return u=>({year:u.getFullYear(),month:u.getMonth()+1,day:u.getDate(),hour:u.getHours(),minute:u.getMinutes(),second:u.getSeconds(),ms:u.getMilliseconds(),weekday:u.getDay()});const s=new Intl.DateTimeFormat("en-US",{timeZone:i,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 u=>{const o={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:u.getMilliseconds(),weekday:0};for(const a of s.formatToParts(u))switch(a.type){case"year":o.year=Number(a.value);break;case"month":o.month=Number(a.value);break;case"day":o.day=Number(a.value);break;case"hour":o.hour=Number(a.value)%24;break;case"minute":o.minute=Number(a.value);break;case"second":o.second=Number(a.value);break;case"weekday":o.weekday=n[a.value]??0;break;default:break}return o}}function j(i,s,n){const u=Z(i),o=H(n),a=new Set(u.filter(d=>d.token).map(d=>d.token)),h=a.has("MMM")?new Intl.DateTimeFormat(s,{month:"short",timeZone:n}):null,v=a.has("MMMM")?new Intl.DateTimeFormat(s,{month:"long",timeZone:n}):null,g=a.has("EEE")?new Intl.DateTimeFormat(s,{weekday:"short",timeZone:n}):null,k=a.has("EEEE")?new Intl.DateTimeFormat(s,{weekday:"long",timeZone:n}):null;return d=>{const p=o(d);let b="";for(const O of u){if(!O.token){b+=O.text;continue}switch(O.token){case"yyyy":b+=X(p.year,4);break;case"yy":b+=X(p.year%100,2);break;case"MMMM":b+=v.format(d);break;case"MMM":b+=h.format(d);break;case"MM":b+=X(p.month,2);break;case"M":b+=String(p.month);break;case"dd":b+=X(p.day,2);break;case"d":b+=String(p.day);break;case"EEEE":b+=k.format(d);break;case"EEE":b+=g.format(d);break;case"HH":b+=X(p.hour,2);break;case"H":b+=String(p.hour);break;case"hh":b+=X(p.hour%12===0?12:p.hour%12,2);break;case"h":b+=String(p.hour%12===0?12:p.hour%12);break;case"mm":b+=X(p.minute,2);break;case"m":b+=String(p.minute);break;case"ss":b+=X(p.second,2);break;case"s":b+=String(p.second);break;case"SSS":b+=X(p.ms,3);break;case"a":b+=p.hour<12?"AM":"PM";break;default:b+=O.text;break}}return b}}const w=[["year",365*24*36e5],["month",720*36e5],["week",168*36e5],["day",24*36e5],["hour",36e5],["minute",6e4],["second",1e3]];function m(i,s){const n=i||{},u=n.locale||s||void 0,o=n.nullDisplay??"",a=n.timeZone;let h;if(n.pattern)h=j(n.pattern,u,a);else if(n.dateStyle||n.timeStyle){const p={timeZone:a};n.dateStyle&&(p.dateStyle=n.dateStyle),n.timeStyle&&(p.timeStyle=n.timeStyle);const b=new Intl.DateTimeFormat(u,p);h=O=>b.format(O)}else{const p=new Intl.DateTimeFormat(u,{dateStyle:"medium",timeZone:a});h=b=>p.format(b)}const v=n.relative?new Intl.RelativeTimeFormat(u,{numeric:"auto"}):null,k=(typeof n.relative=="object"&&n.relative?n.relative.threshold??7:7)*24*36e5,d=(p,b)=>{const O=F(p);if(!O)return o;if(v){const y=b&&typeof b.now=="number"?b.now:Date.now(),M=O.getTime()-y;if(Math.abs(M)<k){for(const[D,_]of w)if(Math.abs(M)>=_||D==="second")return v.format(Math.round(M/_),D)}}return h(O)};return d.spec=n,d}function c(i){if(C(i)||i==="")return null;if(typeof i=="string"){const u=/^(\d{4}-\d{2}-\d{2})/.exec(i.trim());if(u)return u[1];const o=F(i);return o?c(o):null}const s=F(i);if(!s)return null;const n=u=>String(u).padStart(2,"0");return`${s.getFullYear()}-${n(s.getMonth()+1)}-${n(s.getDate())}`}function f(i,s){if(C(i)||i==="")return null;if(typeof i=="string"){const u=i.trim();if(l.test(u)){const h=F(u);return h?r(h,s):null}const o=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(u);if(o){const[,h,v,g,k]=o;return`${h}T${v}:${g}${k&&k!=="00"?`:${k}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(u))return`${u}T00:00`;const a=F(u);return a?f(a):null}const n=F(i);return n?r(n,s):null}const l=/(?:Z|[+-]\d{2}:?\d{2})$/i;function r(i,s){const n=h=>String(h).padStart(2,"0");if(s)try{const h=new Intl.DateTimeFormat("en-CA",{timeZone:s,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(i).reduce((k,d)=>(d.type!=="literal"&&(k[d.type]=d.value),k),{}),v=h.hour==="24"?"00":h.hour,g=Number(h.second);return`${h.year}-${h.month}-${h.day}T${v}:${h.minute}`+(g?`:${h.second}`:"")}catch{}const u=`${i.getFullYear()}-${n(i.getMonth()+1)}-${n(i.getDate())}`,o=i.getSeconds(),a=`${n(i.getHours())}:${n(i.getMinutes())}${o?`:${n(o)}`:""}`;return`${u}T${a}`}function t(i,s){const n=C(i)||i===""?null:String(i),u=C(s)||s===""?null:String(s);return n===null?u===null?0:1:u===null||n<u?-1:n>u?1:0}}),Ue("packages/core/src/format/boolean.js",function(e,U){"use strict";Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return Z}});const C=U("packages/core/src/internal/predicates.js").isNil,q={true:"☑",false:"☐",null:""},z={true:"◉",false:"◯",null:""};function B(K){if(C(K)||K==="")return null;if(typeof K=="boolean")return K;if(typeof K=="number")return K!==0;const F=String(K).trim().toLowerCase();return F==="true"||F==="yes"||F==="y"||F==="1"?!0:F==="false"||F==="no"||F==="n"||F==="0"?!1:null}function Z(K,F){const X=K||{},H=X.display||"text",j=X.trueLabel??"Yes",w=X.falseLabel??"No",m=X.nullLabel??"";let c=j,f=w;const l=m;H==="checkbox"?(c=q.true,f=q.false):H==="switch"?(c=z.true,f=z.false):H==="icon"&&(c=X.trueIcon??j,f=X.falseIcon??w);const r=t=>{const i=B(t);return i===null?l:i?c:f};return r.display=H,r.labels={true:j,false:w,null:m},r.locale=F,r.spec=X,r}}),Ue("packages/core/src/format/text.js",function(e,U){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return B}});const C=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/text.js").titleCase;function B(Z,K){const F=Z||{},X=F.locale||K||void 0,H=F.nullDisplay??"",j=F.emptyDisplay??"",w=F.transform||"none",m=typeof F.truncate=="number"?{chars:F.truncate}:F.truncate||null,c=m?m.chars:0,f=m?m.ellipsis??"…":"",l=t=>{switch(w){case"upper":return X?t.toLocaleUpperCase(X):t.toUpperCase();case"lower":return X?t.toLocaleLowerCase(X):t.toLowerCase();case"title":return z(t);default:return t}},r=t=>{if(C(t))return H;let i=typeof t=="string"?t:String(t);return i===""?j:(w!=="none"&&(i=l(i)),c>0&&i.length>c&&(i=i.slice(0,c)+f),i)};return r.spec=F,r}}),Ue("packages/core/src/format/shorthand.js",function(e,U){"use strict";Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return K}});const te=["currency","number","percent","date","boolean","text","relative"],C=/[#0?@;"\\]/,q=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function z(F){return typeof F!="string"||F===""||Z(F)?!1:C.test(F)}function B(F){return typeof F!="string"||F===""||Z(F)?!1:q.test(F)}function Z(F){const X=F.indexOf(":"),H=X===-1?F:F.slice(0,X);return te.includes(H)?H:null}function K(F){const X=Z(F);if(!X)return null;const H=F.indexOf(":"),j=H===-1?"":F.slice(H+1),w=j===""?[]:j.split(":");switch(X){case"currency":{const m={type:"number",style:"currency",currency:w[0]||"USD"};return w[1]!==void 0&&w[1]!==""&&(m.decimals=Number(w[1])),m}case"number":{const m={type:"number",style:"decimal"};return w[0]!==void 0&&w[0]!==""&&(m.decimals=Number(w[0])),m}case"percent":{const m={type:"number",style:"percent"};return w[0]!==void 0&&w[0]!==""&&(m.decimals=Number(w[0])),m}case"date":return{type:"date",pattern:j||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const m=j.split("/"),c={type:"boolean",display:"text"};return m[0]!==void 0&&m[0]!==""&&(c.trueLabel=m[0]),m[1]!==void 0&&m[1]!==""&&(c.falseLabel=m[1]),m[2]!==void 0&&(c.nullLabel=m[2]),c}case"text":{const m={type:"text"};return w[0]&&(m.transform=w[0]),w[1]!==void 0&&w[1]!==""&&(m.truncate=Number(w[1])),m}default:return null}}}),Ue("packages/core/src/format/index.js",function(e,U){"use strict";Object.defineProperty(e,"compileFormat",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"specToOoxml",{enumerable:!0,get:function(){return y}});const te=U("packages/core/src/internal/predicates.js"),C=te.isFunction,q=te.isObject,B=U("packages/core/src/internal/warn.js").warnOnce,Z=U("packages/core/src/format/number.js"),K=Z.compileNumber,F=U("packages/core/src/format/date.js"),X=F.compileDate,H=F.scanPattern,j=U("packages/core/src/format/boolean.js"),w=j.compileBoolean,m=U("packages/core/src/format/text.js"),c=m.compileText,f=U("packages/core/src/format/mask.js"),l=f.compileMask,r=U("packages/core/src/format/shorthand.js"),t=r.parseShorthand,i=r.looksLikeMask,s=r.looksLikeDatePattern,u=U("packages/core/src/format/pattern.js").parseNumberPattern;Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return Z.compileNumber}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return F.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return F.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return F.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return F.toDate}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return j.compileBoolean}}),Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return j.toTriState}}),Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return m.compileText}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return f.compileMask}}),Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return f.splitSections}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return f.parseSection}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return r.parseShorthand}}),Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return r.looksLikeMask}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return r.looksLikeDatePattern}});const o=new Set(["decimal","currency","percent","unit"]),a=new Set(["type","locale"]),h={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"])},v=new Set(["number","date","boolean","text"]);function g(I,L){const $=I.type;if($===void 0||v.has($)||!o.has(String($)))return;const P=L?`"${L}"`:"with no id";B(`format:unknown-style-key:${L||""}:${$}`,`column ${P} has format: { type: "${$}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${$}" instead?`)}function k(I,L,$){const P=h[L],N=$?`"${$}"`:"with no id";for(const T of I){if(a.has(T)||P.has(T))continue;const E=Object.keys(h).find(A=>A!==L&&h[A].has(T));E?B(`format:inapplicable:${$||""}:${T}`,`column ${N} has format key "${T}", which applies to a ${E} column, not the ${L} column it was applied to; it is ignored.`):B(`format:unknown:${$||""}:${T}`,`column ${N} has an unrecognised format key "${T}" for its ${L} format; it is ignored.`)}}function d(I){if(I.type==="number"||I.type==="date"||I.type==="boolean"||I.type==="text")return!0;const L=o.has(String(I.style));return!!(I.pattern||I.dateStyle||I.timeStyle||I.relative||I.timeZone||I.trueLabel||I.falseLabel||I.display||I.trueIcon||I.falseIcon||I.transform||I.truncate||I.emptyDisplay||L||I.currency||I.decimals!==void 0||I.minDecimals!==void 0||I.maxDecimals!==void 0||I.notation||I.negative||I.scale!==void 0||I.prefix||I.suffix||I.zeroDisplay!==void 0)}function p(I,L){if(I.type==="number"||I.type==="date"||I.type==="boolean"||I.type==="text")return I.type;if(I.pattern){if(i(I.pattern))return"number";if(s(I.pattern))return"date"}if(I.dateStyle||I.timeStyle||I.relative||I.timeZone)return"date";if(I.trueLabel||I.falseLabel||I.display||I.trueIcon||I.falseIcon)return"boolean";if(I.transform||I.truncate||I.emptyDisplay)return"text";if(I.style||I.currency||I.decimals!==void 0||I.minDecimals!==void 0||I.maxDecimals!==void 0||I.notation||I.negative||I.scale!==void 0||I.prefix||I.suffix||I.zeroDisplay!==void 0)return"number";const $=L&&L.base;return $==="number"?"number":$==="date"||$==="dateString"?"date":$==="boolean"?"boolean":"text"}function b(I,L=null,$=void 0,P=void 0,N=void 0){if(I==null||I==="")return null;const T=q(I)?Object.keys(I):null;if(typeof I=="function"){const S=(x,W)=>String(I({...W||{},value:x,locale:$})??"");return S.ooxml=L&&L.excel||"General",S}if(typeof I=="string"){if(i(I)){const{format:x,ooxml:W}=l(I,$);return x.ooxml=W,x}const S=t(I)||(s(I)?{type:"date",pattern:I}:null);return S?b(S,L,$,P,N):(B(`format:${I}`,`unrecognised format string "${I}"; the value will be stringified`),null)}if(!q(I))return B("format:shape","format must be a spec object or a string; ignoring",I),null;if(L&&C(L.format)&&!d(I)||L&&C(L.format)&&Array.isArray(L.formatPatterns)&&I.type===void 0)return null;const E=p(I,L);E==="date"&&P&&I.timeZone===void 0&&(I={...I,timeZone:P}),g(I,N),k(T||Object.keys(I),E,N);let A;switch(E){case"number":A=K(I,$);break;case"date":A=X(I,$);break;case"boolean":A=w(I,$);break;default:A=c(I,$);break}return A.ooxml=y(I,E,$,L),A.kind=E,A}const O={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 y(I,L,$=void 0,P=null){if(L==="date"){if(I.pattern){let S="";for(const x of H(I.pattern))S+=x.token?O[x.token]??x.text:x.text;return S}return P&&P.excel||"yyyy-mm-dd"}if(L==="boolean")return"General";if(L==="text")return"@";if(typeof I.pattern=="string"&&u(I.pattern))return String(I.pattern).trim();if(I.notation==="compact"||I.notation==="scientific")return"General";const N=typeof I.decimals=="number"?I.decimals:typeof I.minDecimals=="number"?I.minDecimals:I.style==="currency"?2:0;let E=`${I.thousandsSeparator===!1?"":"#,#"}#0${N>0?`.${"0".repeat(N)}`:""}`,A="";return I.style==="currency"&&(A+=M(_(I.currency||"USD",$))),I.prefix&&(A+=M(I.prefix)),E=A+E,I.style==="percent"&&(E=`${E}%`),I.suffix&&(E+=M(I.suffix)),I.negative==="parentheses"?`${E};(${E})`:I.negative==="suffix"?`${E};${E}-`:E}function M(I){return`"${String(I).split('"').join("")}"`}const D=new Map;function _(I,L){const $=`${I}|${L||""}`;let P=D.get($);if(P!==void 0)return P;P=I;try{const T=new Intl.NumberFormat(L,{style:"currency",currency:I}).formatToParts(0).find(E=>E.type==="currency");T&&(P=T.value)}catch{}return D.set($,P),P}}),Ue("packages/core/src/columns/types/temporal.js",function(e,U){"use strict";Object.defineProperty(e,"MS_SECOND",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"MS_MINUTE",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"MS_HOUR",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MS_DAY",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"MS_WEEK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"toTimeMs",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"zonedParts",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"zoneOffsetAt",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"instantFromParts",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"toEpochMs",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"toDurationMs",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"resolveZoneName",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"zoneLabel",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(e,"formatInstant",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(e,"timestampGroupProjector",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"TEMPORAL_INFERENCE_ORDER",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Ve}});const te=U("packages/core/src/internal/predicates.js"),C=te.isNil,q=te.isFunction,z=U("packages/core/src/format/date.js"),B=z.toDate,Z=z.compilePattern,K=z.compileDate,F=z.toIsoDateTime,X=z.compareIso,H=864e5,j=Object.freeze({}),w=1e3,m=60*w,c=60*m,f=24*c,l=7*f,r=new WeakMap;function t(Se,Ge){const Ce=Se&&Se.locale||"",Te=Se&&Se.column;if(!Te)return Ce?{locale:Ce}:j;const ze=r.get(Te);if(ze&&ze.locale===Ce)return ze.bag;const Ke=Te.typeOptions||Te[Ge]||(i(Te.format)?Te.format:null),Ze={...Ke||j,locale:Ke&&Ke.locale||Ce||void 0};return r.set(Te,{locale:Ce,bag:Ze}),Ze}function i(Se){return Se!==null&&typeof Se=="object"&&!Array.isArray(Se)&&!(Se instanceof Date)}function s(Se,Ge){const Ce=Se===null||Number.isNaN(Se)?null:Se,Te=Ge===null||Number.isNaN(Ge)?null:Ge;return Ce===null?Te===null?0:1:Te===null||Ce<Te?-1:Ce>Te?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,u=/^(\d{3,6})$/;function o(Se,Ge,Ce,Te){return!(Se>=0&&Se<=23)||!(Ge>=0&&Ge<=59)||!(Ce>=0&&Ce<=59)||!(Te>=0&&Te<=999)?null:Se*c+Ge*m+Ce*w+Te}function a(Se){if(C(Se))return null;const Ge=String(Se).trim();if(Ge==="")return null;const Ce=u.exec(Ge);if(Ce){const wt=Ce[1];if(wt.length===5)return null;const ht=wt.length===3?1:2;return o(Number(wt.slice(0,ht)),Number(wt.slice(ht,ht+2)),Number(wt.slice(ht+2,ht+4)||0),0)}const Te=n.exec(Ge);if(!Te)return null;let ze=Number(Te[1]);const Ke=Number(Te[2]||0),Ze=Number(Te[3]||0),nt=Te[4]?Number(Te[4].padEnd(3,"0")):0,it=Te[5]?Te[5][0].toLowerCase():null;if(it){if(ze<1||ze>12)return null;ze=ze%12,it==="p"&&(ze+=12)}return o(ze,Ke,Ze,nt)}function h(Se){return C(Se)||Se===""?null:typeof Se=="number"?Number.isFinite(Se)?(Se%f+f)%f:null:Se instanceof Date?Number.isNaN(Se.getTime())?null:Se.getHours()*c+Se.getMinutes()*m+Se.getSeconds()*w+Se.getMilliseconds():a(Se)}const v=new Map;function g(Se){const Ge=Se.pattern||"",Ce=Se.timeStyle||(Se.seconds?"medium":"short"),Te=`${Se.locale||""}|${Ge}|${Ce}`;let ze=v.get(Te);if(ze)return ze;if(Ge)ze=Z(Ge,Se.locale||void 0,"UTC");else{const Ke=new Intl.DateTimeFormat(Se.locale||void 0,{timeStyle:Ce,timeZone:"UTC"});ze=Ze=>Ke.format(Ze)}return v.set(Te,ze),ze}function k(Se,Ge){const Ce=Ge||j;if(Se==null||typeof Se!="number"||!Number.isFinite(Se))return Ce.nullDisplay??"";const Te=(Se%f+f)%f;return g(Ce)(new Date(Te))}function d(Se){return Se instanceof Date?!Number.isNaN(Se.getTime()):typeof Se=="number"?Number.isFinite(Se)&&Se>=0&&Se<f:typeof Se!="string"||!Se.includes(":")?!1:a(Se)!==null}function p(Se){const Ge=h(Se);return Ge==null?"":k(Ge,{pattern:Ge%w===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const b=new Map;function O(Se){const Ge=Se||"";let Ce=b.get(Ge);return Ce||(Ce=new Intl.DateTimeFormat("en-GB",{timeZone:Se||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),b.set(Ge,Ce)),Ce}function y(Se,Ge){const Ce={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const Te of O(Ge).formatToParts(new Date(Se)))Te.type==="year"?Ce.year=Number(Te.value):Te.type==="month"?Ce.month=Number(Te.value):Te.type==="day"?Ce.day=Number(Te.value):Te.type==="hour"?Ce.hour=Number(Te.value)%24:Te.type==="minute"?Ce.minute=Number(Te.value):Te.type==="second"&&(Ce.second=Number(Te.value));return Ce}function M(Se,Ge){const Ce=y(Se,Ge);return Date.UTC(Ce.year,Ce.month-1,Ce.day,Ce.hour,Ce.minute,Ce.second,0)-Math.floor(Se/1e3)*1e3}function D(Se,Ge){const Ce=Se.hour||0,Te=Se.minute||0,ze=Se.second||0,Ke=Se.ms||0;if(!Ge)return new Date(Se.year,Se.month-1,Se.day,Ce,Te,ze,Ke).getTime();const Ze=Date.UTC(Se.year,Se.month-1,Se.day,Ce,Te,ze,Ke);let nt=Ze-M(Ze,Ge);return nt=Ze-M(nt,Ge),nt}const _=/(?:Z|[+-]\d{2}:?\d{2})$/i,I=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function L(Se,Ge){if(C(Se))return null;const Ce=String(Se).trim();if(Ce==="")return null;const Te=Ge&&Ge.timeZone||void 0;if(!_.test(Ce)){const ze=I.exec(Ce);if(ze){const Ke=(ze[4]||"").trim(),Ze=Ke===""?0:a(Ke);if(Ze===null)return null;const nt=D({year:Number(ze[1]),month:Number(ze[2]),day:Number(ze[3]),hour:Math.floor(Ze/c),minute:Math.floor(Ze/m)%60,second:Math.floor(Ze/w)%60,ms:Ze%w},Te);return Number.isNaN(nt)?null:new Date(nt)}}return B(Ce)}function $(Se){if(typeof Se=="number")return Number.isFinite(Se)?Se:null;const Ge=B(Se);return Ge?Ge.getTime():null}const P=new Map;function N(Se){const Ge=[Se.locale||"",Se.pattern||"",Se.dateStyle||"",Se.timeStyle||"",Se.timeZone||"",Se.seconds?"1":""].join("|");let Ce=P.get(Ge);if(Ce)return Ce;const Te=Se.pattern?{type:"date",pattern:Se.pattern,timeZone:Se.timeZone}:{type:"date",dateStyle:Se.dateStyle||"medium",timeStyle:Se.timeStyle||(Se.seconds?"medium":"short"),timeZone:Se.timeZone};return Ce=K(Te,Se.locale||void 0),P.set(Ge,Ce),Ce}function T(Se,Ge){const Ce=Ge||j,Te=$(Se);return Te==null?Ce.nullDisplay??"":N(Ce)(Te)}function E(Se){return Se instanceof Date?!Number.isNaN(Se.getTime()):typeof Se!="string"||!I.test(Se.trim())?!1:L(Se)!==null}const A=Object.freeze([{key:"w",ms:l,intl:"week",long:["week","weeks"],names:["w","wk","wks","week","weeks"]},{key:"d",ms:f,intl:"day",long:["day","days"],names:["d","dy","day","days"]},{key:"h",ms:c,intl:"hour",long:["hour","hours"],names:["h","hr","hrs","hour","hours"]},{key:"m",ms:m,intl:"minute",long:["minute","minutes"],names:["m","min","mins","minute","minutes"]},{key:"s",ms:w,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"]}]),S=new Map;for(const Se of A)for(const Ge of Se.names)S.set(Ge,Se);const x=Object.freeze(A.filter(Se=>Se.key!=="w")),W=/^(\d+(?:\.\d+)?)\s*([a-z]+)\s*(?:,\s*)?/,V=/^\d+(?:\.\d+)?$/,G=/^(\d+):([0-5]?\d)(?::([0-5]?\d))?(?:\.(\d{1,3}))?$/;function Q(Se){const Ge=Se&&Se.defaultUnit?S.get(String(Se.defaultUnit).toLowerCase()):null;return Ge?Ge.ms:m}function ee(Se){return(Se&&Se.defaultUnit?S.get(String(Se.defaultUnit).toLowerCase()):null)||S.get("m")}function ne(Se,Ge){if(C(Se))return null;let Ce=String(Se).trim().toLowerCase();if(Ce==="")return null;let Te=1;if(Ce[0]==="-"?(Te=-1,Ce=Ce.slice(1).trim()):Ce[0]==="+"&&(Ce=Ce.slice(1).trim()),Ce==="")return null;const ze=G.exec(Ce);if(ze){const it=ze[3]!==void 0,wt=Number(ze[1])*c+Number(ze[2])*m+(it?Number(ze[3])*w:0)+(ze[4]?Number(ze[4].padEnd(3,"0")):0);return Te*wt}if(V.test(Ce))return Math.round(Te*Number(Ce)*Q(Ge||j));let Ke=Ce,Ze=0,nt=0;for(;Ke!=="";){const it=W.exec(Ke);if(!it)return null;const wt=S.get(it[2]);if(!wt)return null;Ze+=Number(it[1])*wt.ms,Ke=Ke.slice(it[0].length),nt++}return nt===0?null:Math.round(Te*Ze)}function se(Se){return C(Se)||Se===""?null:typeof Se=="number"?Number.isFinite(Se)?Se:null:ne(Se)}const le=new Map;function me(Se,Ge,Ce){const Te=`${Ce||""}|${Ge.intl}`;let ze=le.get(Te);if(ze===void 0){try{ze=new Intl.NumberFormat(Ce||void 0,{style:"unit",unit:Ge.intl,unitDisplay:"long"})}catch{ze=null}le.set(Te,ze)}return ze?ze.format(Se):`${Se} ${Se===1?Ge.long[0]:Ge.long[1]}`}function ve(Se,Ge){return String(Se).padStart(Ge,"0")}function fe(Se,Ge){const Ce=Ge||j;if(Se==null||typeof Se!="number"||!Number.isFinite(Se))return Ce.nullDisplay??"";const Te=Ce.style||"short",ze=Se<0;let Ke=Math.round(Math.abs(Se));const Ze=ze?"-":"";if(Ke===0&&Ce.zeroDisplay!=null)return Ce.zeroDisplay;if(Te==="clock"){const ht=Math.floor(Ke/c),Ot=Math.floor(Ke/m)%60,Pt=Math.floor(Ke/w)%60;return`${Ze}${ve(ht,2)}:${ve(Ot,2)}:${ve(Pt,2)}`}if(Ke===0){const ht=ee(Ce);return Te==="long"?me(0,ht,Ce.locale):`0${ht.key}`}const nt=Ce.weeks===!0?A:x,it=typeof Ce.maxUnits=="number"&&Ce.maxUnits>0?Ce.maxUnits:Ce.maxUnits===void 0?2:1/0,wt=[];for(const ht of nt){if(wt.length>=it)break;const Ot=Math.floor(Ke/ht.ms);Ot!==0&&(Ke-=Ot*ht.ms,wt.push(Te==="long"?me(Ot,ht,Ce.locale):`${Ot}${ht.key}`))}return Ze+wt.join(" ")}function xe(Se){if(typeof Se!="string")return!1;const Ge=Se.trim();return Ge===""||G.test(Ge)||!/[a-z]/i.test(Ge)?!1:ne(Ge)!==null}const He=Date.UTC(1899,11,30),Be=new Map;function ae(Se,Ge){const Ce=Se||"";let Te=Be.get(Ce);Te||(Te=new Intl.DateTimeFormat("en-GB",{timeZone:Se||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),Be.set(Ce,Te));const ze=typeof Ge=="number"?Ge:Date.now();for(const Ke of Te.formatToParts(new Date(ze)))if(Ke.type==="timeZoneName")return Ke.value;return""}function Ae(Se){if(Se)return Se;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function Me(Se,Ge){const Ce=Ae(Se),Te=ae(Se,Ge);return Te?`${Ce} (${Te})`:Ce}function Re(Se,Ge){if(Se&&Se.timeZone)return Se.timeZone;const Ce=Ge&&Ge.grid;return(Ce&&q(Ce.get)?Ce.get("timeZone"):void 0)||void 0}function pe(Se,Ge){const Ce=Ge||j,Te=$(Se);if(Te==null)return Ce.nullDisplay??"";const ze=N(Ce)(Te);if(!Ce.showOrigin)return ze;const Ke=Ce.originZone;return Ke?Ke===(Ce.timeZone||Ae(Ce.timeZone))?ze:`${ze} (${Me(Ke,Te)})`:`${ze} (no origin recorded)`}function $e(Se,Ge,Ce,Te){if(Ge==="instant"||!Ge)return Se;const ze=y(Se,Ce);if(Ge==="month")return D({year:ze.year,month:ze.month,day:1},Ce);if(Ge==="week"){const Ke=Te>=1&&Te<=7?Te:1,nt=((new Date(Date.UTC(ze.year,ze.month-1,ze.day)).getUTCDay()+6)%7+1-Ke+7)%7,it=new Date(Date.UTC(ze.year,ze.month-1,ze.day-nt));return D({year:it.getUTCFullYear(),month:it.getUTCMonth()+1,day:it.getUTCDate()},Ce)}return D({year:ze.year,month:ze.month,day:ze.day},Ce)}function ce(Se,Ge){const Ce=Se&&Se.group,Te=Ce&&Ce.granularity||"day";if(Te==="instant")return null;const ze=Ce&&Ce.weekStart;return Ke=>typeof Ke=="number"?$e(Ke,Te,Ge,ze):Ke}const ge={time:{base:"number",storage:"float64",matches:d,format:Se=>k(h(Se.value),t(Se,"time")),parse:Se=>a(Se.text),compare:(Se,Ge)=>s(h(Se),h(Ge)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:Se=>{const Ge=h(Se);return Ge===null?null:Ge/H},toStorage:Se=>h(Se),toClipboard:p,fromClipboard:a},datetime:{base:"dateString",storage:"dictionary",matches:E,format:Se=>T(Se.value,t(Se,"datetime")),parse:Se=>F(L(Se.text,t(Se,"datetime"))??Se.text),compare:X,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(Se,Ge)=>F(Se,Ge&&Ge.timeZone),toClipboard:Se=>C(Se)?"":String(Se),fromClipboard:Se=>F(Se)},duration:{base:"number",storage:"float64",matches:xe,format:Se=>fe(se(Se.value),t(Se,"duration")),parse:Se=>ne(Se.text,t(Se,"duration")),compare:(Se,Ge)=>s(se(Se),se(Ge)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:Se=>{const Ge=se(Se);return Ge===null?null:Ge/H},toStorage:Se=>se(Se),toClipboard:Se=>fe(se(Se),{style:"short",maxUnits:-1}),fromClipboard:Se=>ne(Se)},timestamp:{base:"number",storage:"float64",format:Se=>{const Ge=t(Se,"timestamp");return pe(Se.value,{...Ge,timeZone:Re(Ge,Se)})},parse:Se=>{const Ge=t(Se,"timestamp"),Ce=L(Se.text,{timeZone:Re(Ge,Se)});return Ce?Ce.getTime():null},compare:(Se,Ge)=>s($(Se),$(Ge)),groupProjector:(Se,Ge)=>ce(Se,Ge),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(Se,Ge)=>{const Ce=$(Se);if(Ce==null)return null;const Te=y(Ce,Ge&&Ge.timeZone||void 0);return(Date.UTC(Te.year,Te.month-1,Te.day,Te.hour,Te.minute,Te.second)-He)/H},toStorage:Se=>$(Se),toClipboard:Se=>{const Ge=$(Se);return Ge==null?"":new Date(Ge).toISOString()},fromClipboard:Se=>$(Se)}},je=["datetime","time","duration"],Ve=ge}),Ue("packages/core/src/internal/lru.js",function(e,U){"use strict";Object.defineProperty(e,"Lru",{enumerable:!0,get:function(){return te}});class te{#e;#t=new Map;#n;constructor(q=256,z=null){this.#e=q,this.#n=z}get size(){return this.#t.size}get max(){return this.#e}set max(q){this.#e=q,this.#r()}has(q){return this.#t.has(q)}get(q){const z=this.#t;if(!z.has(q))return;const B=z.get(q);return z.delete(q),z.set(q,B),B}peek(q){return this.#t.get(q)}set(q,z){const B=this.#t;return B.has(q)&&B.delete(q),B.set(q,z),this.#r(),z}delete(q){const z=this.#t.get(q);return this.#t.delete(q)&&this.#n&&this.#n(z,q),z}clear(){if(this.#n)for(const[q,z]of this.#t)this.#n(z,q);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const q=this.#t;for(;q.size>this.#e;){const z=q.keys().next().value,B=q.get(z);q.delete(z),this.#n&&this.#n(B,z)}}}}),Ue("packages/core/src/columns/types/network.js",function(e,U){"use strict";Object.defineProperty(e,"toUint32",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"compareIpv4",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"packCidr",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"cidrParts",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"isCidr",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"compareCidr",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"netmask",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"addressCount",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"ipv6Groups",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return $}});const C=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/lru.js").Lru,B=4294967295,Z=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function K(P){if(C(P))return null;if(typeof P=="string")return F(P);const N=Number(P);return Number.isFinite(N)?N<0?N<-2147483648?null:N>>>0:N>B?null:Math.trunc(N)>>>0:null}function F(P){if(C(P))return null;const N=String(P).trim();if(N==="")return null;const T=Z.exec(N);if(!T)return null;let E=0;for(let A=1;A<=4;A++){const S=T[A];if(S.length>1&&S.charCodeAt(0)===48)return null;const x=Number(S);if(x>255)return null;E=E*256+x}return E}function X(P){const N=K(P);return N===null?"":`${N>>>24&255}.${N>>>16&255}.${N>>>8&255}.${N&255}`}function H(P){return typeof P=="string"&&F(P)!==null}function j(P,N){const T=K(P),E=K(N);return T===null?E===null?0:1:E===null||T<E?-1:T>E?1:0}const w=64,m=B*w+32,c=/^(?:0|[1-9]\d?)$/;function f(P,N){return P*w+N}function l(P){if(C(P))return null;if(typeof P=="string"){const E=r(P);return E===null?null:l(E)}if(typeof P=="object"){const E=K(P.address),A=Number(P.prefix);return E===null||!Number.isInteger(A)||A<0||A>32?null:{address:E,prefix:A}}const N=Number(P);if(!Number.isInteger(N)||N<0||N>m)return null;const T=N%w;return T>32?null:{address:(N-T)/w,prefix:T}}function r(P){if(C(P))return null;const N=String(P).trim();if(N==="")return null;const T=N.indexOf("/");if(T<0)return null;const E=F(N.slice(0,T));if(E===null)return null;const A=N.slice(T+1).trim();if(!c.test(A))return null;const S=Number(A);return S>32?null:f(E,S)}function t(P){const N=l(P);return N?`${X(N.address)}/${N.prefix}`:""}function i(P){return typeof P=="string"&&r(P)!==null}function s(P,N){const T=l(P),E=l(N);return T?E?T.address!==E.address?T.address<E.address?-1:1:T.prefix-E.prefix:-1:E?1:0}function n(P){return P===0?0:4294967295<<32-P>>>0}function u(P){const N=l(P);return N?(N.address&n(N.prefix))>>>0:null}function o(P){const N=l(P);return N?(N.address&n(N.prefix)|~n(N.prefix)>>>0)>>>0:null}function a(P){const N=l(P);return N?2**(32-N.prefix):null}function h(P){const N=l(P);return N?N.prefix===32?1:N.prefix===31?2:2**(32-N.prefix)-2:null}function v(P,N){const T=l(P);if(!T)return!1;const E=K(N);if(E===null)return!1;const A=n(T.prefix);return(E&A)>>>0===(T.address&A)>>>0}function g(P,N){const T=u(P),E=u(N);return T===null||E===null?!1:T<=o(N)&&E<=o(P)}const k=/^[0-9a-fA-F]{1,4}$/,d=new z(512);function p(P){if(C(P))return null;let N=String(P).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 V=N.lastIndexOf(":");if(V<0)return null;const G=F(N.slice(V+1));if(G===null)return null;N=`${N.slice(0,V+1)}${(G>>>16&65535).toString(16)}:${(G&65535).toString(16)}`}const E=N.split("::");if(E.length>2)return null;const A=b(E[0]);if(A===null)return null;if(E.length===1)return A.length===8?A:null;const S=b(E[1]);if(S===null)return null;const x=8-A.length-S.length;if(x<1)return null;const W=A.slice();for(let V=0;V<x;V++)W.push(0);for(const V of S)W.push(V);return W}function b(P){if(P==="")return[];const N=[];for(const T of P.split(":")){if(!k.test(T))return null;N.push(parseInt(T,16))}return N}function O(P){if(typeof P!="string")return p(P);if(d.has(P))return d.get(P);const N=p(P);return d.set(P,N),N}function y(P){if(P[0]===0&&P[1]===0&&P[2]===0&&P[3]===0&&P[4]===0&&P[5]===65535)return`::ffff:${X((P[6]<<16|P[7])>>>0)}`;let N=-1,T=0,E=-1,A=0;for(let W=0;W<8;W++)P[W]===0?(E<0?(E=W,A=1):A++,A>T&&(T=A,N=E)):(E=-1,A=0);if(T<2)return P.map(W=>W.toString(16)).join(":");const S=P.slice(0,N).map(W=>W.toString(16)).join(":"),x=P.slice(N+T).map(W=>W.toString(16)).join(":");return`${S}::${x}`}function M(P){const N=p(P);return N===null?null:y(N)}function D(P){return M(P)??""}function _(P){return typeof P=="string"&&P.indexOf(":")>=0&&p(P)!==null}function I(P,N){const T=O(P),E=O(N);if(!T)return E?1:0;if(!E)return-1;for(let A=0;A<8;A++)if(T[A]!==E[A])return T[A]<E[A]?-1:1;return 0}const L=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:H,parse:P=>F(P.text),compare:j,format:P=>X(P.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:P=>K(P),toClipboard:P=>X(P),fromClipboard:P=>F(P)},cidr:{base:"number",storage:"float64",matches:i,parse:P=>r(P.text),compare:s,format:P=>t(P.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:P=>{const N=l(P);return N===null?null:f(N.address,N.prefix)},toClipboard:P=>t(P),fromClipboard:P=>r(P)},ipv6:{base:"text",storage:"dictionary",matches:_,parse:P=>M(P.text),compare:I,format:P=>D(P.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:P=>M(P),toClipboard:P=>D(P),fromClipboard:P=>M(P)}}),$=L}),Ue("packages/core/src/i18n/catalogue.js",function(e,U){"use strict";Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return z}});const C=U("packages/core/src/registry/free-tier-notice.js").FREE_TIER_NOTICE,q=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","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.","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","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.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","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.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.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.","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","views.default":"Default","views.namePlaceholder":"Name this view…","views.nameLabel":"Name for the current layout","views.save":"Save view","licence.watermark":"Unlicensed: Lattice Grid trial","licence.watermark.free":C,"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}","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"}),z=Object.freeze(Object.keys(q))}),Ue("packages/core/src/i18n/format.js",function(e,U){"use strict";Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"formatMessage",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return w}});const C=U("packages/core/src/internal/predicates.js").isFunction,q=/\{(\w+)\}/g,z=new Map,B=new Map;function Z(m){const c=m||"";if(z.has(c))return z.get(c);let f=null;try{f=new Intl.PluralRules(m||void 0)}catch{f=null}return z.set(c,f),f}function K(m,c,f="conjunction"){const l=Array.isArray(m)?m.filter(i=>i!=null&&i!==""):[];if(l.length===0)return"";if(l.length===1)return String(l[0]);const r=`${c||""}|${f}`;let t=B.get(r);if(t===void 0){try{t=new Intl.ListFormat(c||void 0,{style:"long",type:f})}catch{t=null}B.set(r,t)}return t?t.format(l.map(String)):l.map(String).join(", ")}function F(m,c){return m==null?"":typeof m=="number"?Number.isFinite(m)?m.toLocaleString(c||void 0,{maximumFractionDigits:20}):"":String(m)}function X(m,c,f){if(typeof m=="string")return m;if(!m||typeof m!="object")return"";const l=c&&typeof c.count=="number"?c.count:null;if(l===null)return m.other??"";const r=Z(f),t=r?r.select(l):l===1?"one":"other";return m[t]??m.other??""}function H(m,c={},f){const l=X(m,c,f);return l?l.replace(q,(r,t)=>Object.prototype.hasOwnProperty.call(c,t)?F(c[t],f):r):""}function j(m,c,f="en-GB"){return typeof m=="string"&&m?m:typeof c=="string"&&c?c:f}function w(m,c){const f=m?m[c]:void 0;return f==null||C(f)?c:f}}),Ue("packages/core/src/i18n/registry.js",function(e,U){"use strict";Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"localeCatalogue",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return Z}});const C=U("packages/core/src/i18n/catalogue.js").EN_GB,q=new Map([["en-gb",C]]);function z(K,F){const X=typeof K=="string"?K.toLowerCase():"";return!X||!F||typeof F!="object"?!1:(q.set(X,F),!0)}function B(K){if(typeof K!="string"||!K)return null;const F=K.toLowerCase(),X=q.get(F);if(X)return X;const H=F.split("-")[0],j=q.get(H);if(j)return j;for(const[w,m]of q)if(w.split("-")[0]===H)return m;return null}function Z(){return[...q.keys()]}}),Ue("packages/core/src/i18n/index.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"Messages",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"defaultMessages",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return s}});const te=U("packages/core/src/i18n/catalogue.js"),C=te.EN_GB,q=te.MESSAGE_KEYS,z=U("packages/core/src/i18n/format.js"),B=z.formatMessage,Z=z.formatList,K=z.lookup,F=z.resolveLocale,H=U("packages/core/src/internal/predicates.js").isFunction,w=U("packages/core/src/internal/warn.js").warnOnce,m=U("packages/core/src/i18n/registry.js"),c=m.registerLocale,f=m.localeCatalogue;Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return te.EN_GB}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return te.MESSAGE_KEYS}}),Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return z.formatList}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return z.resolveLocale}}),Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return m.registerLocale}});const l="en-GB";class r{#e=l;#t=C;constructor(u={}){this.configure(u)}configure(u={}){this.#e=F(u.locale,u.declared,l);const o=u.messages,a=f(this.#e);if(!a&&this.#e.toLowerCase()!=="en-gb"&&(!o||typeof o!="object")&&w(`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.`),!o||typeof o!="object"){this.#t=a?{...C,...a}:C;return}const v=Object.keys(o).filter(g=>!(g in C));v.length&&w(`i18n:unknown:${v[0]}`,`message keys not in the catalogue and so ignored: ${v.slice(0,5).join(", ")}${v.length>5?`, and ${v.length-5} more`:""}`),this.#t={...C,...a||{},...o}}get locale(){return this.#e}t(u,o){return B(K(this.#t,u),o||{},this.#e)}list(u,o){return Z(u,this.#e,o)}number(u,o){const a=Number(u);return Number.isFinite(a)?a.toLocaleString(this.#e,o||{maximumFractionDigits:20}):""}}const t=new r;function i(n){return n instanceof r?n:new r(n||{})}function s(n){const u=n&&typeof n=="object"?n:{},o=q.filter(h=>{const v=u[h];return v==null||v===""||H(v)}),a=Object.keys(u).filter(h=>!(h in C));return{missing:o,unknown:a}}}),Ue("packages/core/src/columns/types/structured.js",function(e,U){"use strict";Object.defineProperty(e,"MASK_DEFAULTS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"parseJsonText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});const te=U("packages/core/src/internal/predicates.js"),C=te.isNil,q=te.isObject,B=U("packages/core/src/i18n/index.js").defaultMessages,Z=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function K(r,t){const i=t||{},s=i.emptyDisplay??Z.emptyDisplay;if(C(r)||r==="")return s;const u=[...typeof i.char=="string"&&i.char!==""?i.char:Z.char][0]||Z.char,o=i.fixedLength??Z.fixedLength,a=Number.isFinite(i.length)&&Number(i.length)>0?Math.floor(Number(i.length)):Z.length,h=typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"||typeof r=="bigint"?String(r):null;let v=0;if(h!==null){const g=Number.isFinite(i.lastVisible)?Math.floor(Number(i.lastVisible)):Z.lastVisible,k=[...h];if(v=g>0&&g<k.length?g:0,v>0){const d=k.slice(k.length-v).join(""),p=Math.max(1,(o?a:k.length)-v);return u.repeat(p)+d}return u.repeat(o?a:Math.max(1,k.length))}return u.repeat(a)}const F=48;function X(r){try{const t=JSON.stringify(r);return t===void 0?null:t}catch{return null}}function H(r,t){if(C(r))return"";const i=Number.isFinite(t&&t.inlineLimit)?Number(t.inlineLimit):F;if(typeof r=="string")return r.length>i?`${r.slice(0,i-1)}…`:r;if(typeof r!="object")return String(r);const s=X(r);if(s!==null&&s.length<=i)return s;if(Array.isArray(r)){const u=r.length;return`[${B.t("count.items",{count:u})}]`}const n=Object.keys(r).length;return`{${B.t("count.keys",{count:n})}}`}function j(r,t){if(r==null)return"null";const i=typeof r;if(i==="number"||i==="boolean"||i==="bigint")return String(r);if(i==="string")return JSON.stringify(r);if(i!=="object")return JSON.stringify(String(r));const s=t||new WeakSet;return s.has(r)?'"[circular]"':(s.add(r),r instanceof Date?JSON.stringify(r.toISOString()):Array.isArray(r)?`[${r.map(o=>j(o,s)).join(",")}]`:`{${Object.keys(r).sort().map(o=>`${JSON.stringify(o)}:${j(r[o],s)}`).join(",")}}`)}function w(r,t){if(C(r))return C(t)?0:1;if(C(t))return-1;const i=j(r),s=j(t);return i<s?-1:i>s?1:0}function m(r){if(C(r))return null;const t=String(r);if(t.trim()==="")return null;try{return JSON.parse(t)}catch{return t}}function c(r){const t=r&&r.cell&&r.cell.props;return q(t)?t:{}}const f=Object.freeze({json:{base:"object",storage:"object",format:r=>H(r&&r.value,c(r&&r.column)),parse:r=>m(r&&r.text),compare:w,defaults:{editor:"code",filter:"text",align:"start"},excel:"@",toClipboard:r=>{if(C(r))return"";if(typeof r=="string")return r;try{const t=JSON.stringify(r,null,2);return t===void 0?String(r):t}catch{return String(r)}},fromClipboard:r=>m(r)},secret:{base:"text",storage:"object",format:r=>K(r&&r.value,c(r&&r.column)),parse:r=>{const t=r&&r.text;return C(t)||String(t)===""?null:String(t)},compare:(r,t)=>{const i=C(r)||r==="",s=C(t)||t==="";return i===s?0:i?1:-1},defaults:{editor:"password",filter:"none",align:"start"},excel:"@",export:{csv:!1,excel:!1},toClipboard:r=>K(r),fromClipboard:r=>C(r)||String(r)===""?null:String(r)}}),l=f}),Ue("packages/core/src/columns/types/unit.js",function(e,U){"use strict";Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return E}});const C=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/warn.js").warnOnce;function B(A,S,x,W){return Object.freeze({symbol:A,factor:S,aliases:Object.freeze(x||[]),binary:!!(W&&W.binary),prefix:W&&W.prefix||null,auto:!(W&&W.auto===!1)})}function Z(A,S,x,W){return B(A,S,x,W)}const K=Object.freeze({data:Object.freeze([B("B",1,["byte","bytes"]),B("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),B("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),B("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),B("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),B("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),B("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),B("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),B("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),B("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([B("bps",1,["bit","bits","bit/s","b/s"]),B("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),B("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),B("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),B("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([B("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),B("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),B("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),B("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),B("in",.0254,["inch","inches"],{auto:!1}),B("ft",.3048,["foot","feet"],{auto:!1}),B("yd",.9144,["yard","yards"],{auto:!1}),B("m",1,["metre","metres","meter","meters"]),B("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),B("mi",1609.344,["mile","miles"],{auto:!1}),B("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([B("mg",.001,["milligram","milligrams"]),B("g",1,["gram","grams"]),B("oz",28.349523125,["ounce","ounces"],{auto:!1}),B("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),B("kg",1e3,["kilogram","kilograms"]),B("st",6350.29318,["stone"],{auto:!1}),B("t",1e6,["tonne","tonnes","ton"],{auto:!1}),B("ton (US)",907184.74,["ton","shortton"],{auto:!1}),B("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([B("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),B("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),B("ms",.001,["msec","msecs","millisecond","milliseconds"]),B("s",1,["sec","secs","second","seconds"]),B("m",60,["min","mins","minute","minutes"]),B("h",3600,["hr","hrs","hour","hours"]),B("d",86400,["day","days"])]),speed:Object.freeze([B("mm/s",.001,["millimetre/s","millimeter/s"]),B("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),B("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),B("mph",.44704,["mile/h","miles/h"],{auto:!1}),B("kn",1852/3600,["knot","knots"],{auto:!1}),B("m/s",1,["metre/s","meter/s","mps"]),B("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([B("mm/s²",.001,["mm/s2"]),B("ft/s²",.3048,["ft/s2"],{auto:!1}),B("m/s²",1,["m/s2","metre/s2","meter/s2"]),B("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([B("mm²",1e-6,["mm2"]),B("cm²",1e-4,["cm2"]),B("in²",64516e-8,["in2","sqin"],{auto:!1}),B("ft²",.09290304,["ft2","sqft"],{auto:!1}),B("yd²",.83612736,["yd2","sqyd"],{auto:!1}),B("m²",1,["m2","sqm"]),B("ha",1e4,["hectare","hectares"],{auto:!1}),B("ac",4046.8564224,["acre","acres"],{auto:!1}),B("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([B("µL",1e-6,["ul","microlitre","microliter"]),B("mL",.001,["millilitre","milliliter"]),B("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),B("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),B("L",1,["litre","litres","liter","liters"]),B("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),B("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),B("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),B("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([B("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),B("J",1,["joule","joules"]),B("cal",4.184,["calorie","calories"],{auto:!1}),B("kJ",1e3,["kilojoule","kilojoules"]),B("BTU",1055.05585262,["btu"],{auto:!1}),B("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),B("MJ",1e6,["megajoule","megajoules"]),B("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),B("GJ",1e9,["gigajoule","gigajoules"]),B("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([B("mW",.001,["milliwatt","milliwatts"]),B("W",1,["watt","watts"]),B("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),B("kW",1e3,["kilowatt","kilowatts"]),B("hp",745.6998715822702,["horsepower"],{auto:!1}),B("MW",1e6,["megawatt","megawatts"]),B("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([B("mN",.001,["millinewton","millinewtons"]),B("N",1,["newton","newtons"]),B("lbf",4.4482216152605,["poundforce"],{auto:!1}),B("kgf",9.80665,["kilogramforce"],{auto:!1}),B("kN",1e3,["kilonewton","kilonewtons"]),B("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([B("Pa",1,["pascal","pascals"]),B("mbar",100,["millibar"],{auto:!1}),B("inH₂O",249.0889,["inh2o"],{auto:!1}),B("mmHg",133.322387415,["torr"],{auto:!1}),B("kPa",1e3,["kilopascal","kilopascals"]),B("inHg",3386.388640341,["inhg"],{auto:!1}),B("psi",6894.757293168361,["lbf/in2"],{auto:!1}),B("bar",1e5,[],{auto:!1}),B("atm",101325,["atmosphere","atmospheres"],{auto:!1}),B("MPa",1e6,["megapascal","megapascals"]),B("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([B("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),B("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),B("kN·m",1e3,["knm","kn.m"],{auto:!1}),B("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([B("kg/m³",1,["kg/m3"]),B("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),B("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),B("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([B("L/min",1/6e4,["lpm","l/min"],{auto:!1}),B("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),B("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),B("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),B("cfm",.0004719474432,["ft3/min"],{auto:!1}),B("L/s",.001,["lps","l/s"],{auto:!1}),B("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([B("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),B("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),B("mrad",.001,["milliradian","milliradians"],{auto:!1}),B("mil",Math.PI/3200,["nato-mil"],{auto:!1}),B("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),B("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),B("rad",1,["radian","radians"]),B("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([B("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),B("rad/s",1,["radps","radians/s"]),B("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),B("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([B("ppt",1e-12,["partspertrillion"],{auto:!1}),B("ppb",1e-9,["partsperbillion"]),B("ppm",1e-6,["partspermillion"]),B("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),B("‰",.001,["permille","permil"],{auto:!1}),B("%",.01,["pct","percent"]),B("×",1,["x","ratio","times"])]),molarity:Object.freeze([B("pM",1e-12,["picomolar","picomolarity"]),B("nM",1e-9,["nanomolar","nanomolarity"]),B("µM",1e-6,["um-molar","micromolar","micromolarity"]),B("mM",.001,["millimolar","millimolarity"]),B("M",1,["molar","mol/l","mol/L","molarity"]),B("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([B("mg/s",1e-6,["milligrams/s"]),B("g/s",.001,["grams/s"]),B("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),B("kg/s",1,["kilograms/s","kgps"]),B("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),B("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),B("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([B("µPa·s",1e-6,["upas","micropascalsecond"]),B("cP",.001,["centipoise"],{auto:!1}),B("mPa·s",.001,["mpas","millipascalsecond"]),B("P",.1,["poise"],{auto:!1}),B("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([B("cSt",1e-6,["centistokes","centistoke"]),B("mm²/s",1e-6,["mm2/s"],{auto:!1}),B("St",1e-4,["stokes","stoke"],{auto:!1}),B("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([B("mW/(m·K)",.001,["mw/mk"]),B("W/(m·K)",1,["w/mk","wmk"]),B("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),B("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([B("J/(kg·K)",1,["j/kgk","jkgk"]),B("kJ/(kg·K)",1e3,["kj/kgk"]),B("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([B("nSv/h",1e-9,["nsvh"]),B("µSv/h",1e-6,["usv/h","usvh"]),B("mSv/h",.001,["msvh"]),B("Sv/h",1,["svh"]),B("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),F=Symbol("ambiguous"),X=new Map,H=new Map;function j(A,S){const x=String(A||"").trim();if(!x)throw new Error("[lattice] a unit system needs a name");if(K[x]||H.has(x))throw new Error(`[lattice] unit system "${x}" already exists`);const W=[...S||[]];if(!W.length)throw new Error(`[lattice] unit system "${x}" has no units`);if(!W.some(G=>G.factor===1))throw new Error(`[lattice] unit system "${x}" has no base unit (none with factor 1)`);const V=new Set;for(const G of W){if(V.has(G.symbol))throw new Error(`[lattice] unit system "${x}" declares "${G.symbol}" twice`);V.add(G.symbol)}return H.set(x,Object.freeze(W)),X.delete(x),x}function w(){return[...Object.keys(K),...H.keys()]}function m(A){const S=c(A);return S?S.units:[]}function c(A){const S=String(A||""),x=X.get(S);if(x!==void 0)return x;const W=K[S]||H.get(S);if(!W)return X.set(S,null),null;const V=Object.freeze([...W].sort((se,le)=>se.factor-le.factor)),G=new Map,Q=new Map,ee=(se,le)=>{const me=G.get(se);me===void 0?G.set(se,le):me!==le&&G.set(se,F)};for(const se of V){ee(se.symbol.toLowerCase(),se);for(const le of se.aliases)ee(le.toLowerCase(),se);if(se.prefix){const le=Q.get(se.prefix)||[];le.push(se),Q.set(se.prefix,le)}}const ne={units:V,byToken:G,byPrefix:Q,decimal:V.filter(se=>!se.binary&&se.auto),binary:V.some(se=>se.binary)?V.filter(se=>(se.binary||se.factor===1)&&se.auto):null};return X.set(S,ne),ne}function f(A,S){return S&&A.binary||A.decimal}function l(A,S){const x=c(A);if(!x||C(S))return null;const W=x.units.find(G=>G.symbol===String(S));if(W)return W;const V=x.byToken.get(String(S).trim().toLowerCase());return V&&V!==F?V:null}const r=new WeakMap;function t(A){const S=A||{};if(typeof S=="object"&&S!==null){const G=r.get(S);if(G!==void 0)return G}const x=S.system||"data",W=c(x);let V=null;if(!W)z(`unit:system:${x}`,`unknown unit system "${x}"; known systems are ${w().join(", ")}`);else{let G=S.unit?l(x,S.unit):null;G||(S.unit&&z(`unit:unit:${x}:${S.unit}`,`unknown unit "${S.unit}" in system "${x}"; falling back to ${W.units[0].symbol}`),G=W.units.find(Q=>Q.factor===1)||W.units[0]),V={index:W,base:G,binary:S.binary===!0}}return typeof S=="object"&&S!==null&&r.set(S,V),V}const i=new WeakMap;function s(A,S){if(!A||!S||!Array.isArray(A.compound)||A.compound.length===0)return null;const x=i.get(A);if(x!==void 0)return x;const W=new Set,V=[];for(const Q of A.compound){const ee=l(A.system||"data",Q);if(!ee){z(`unit:compound:${A.system}:${Q}`,`unknown compound unit "${Q}" in system "${A.system||"data"}"; ignoring it`);continue}W.has(ee.symbol)||(W.add(ee.symbol),V.push(ee))}V.sort((Q,ee)=>ee.factor-Q.factor);const G=V.length>=2?V:null;return i.set(A,G),G}function n(A,S,x){return S===x||S.factor===x.factor?A:A*S.factor/x.factor}const u=new Map;function o(A){const S=A||"",x=u.get(S);if(x)return x;const W={group:",",decimal:"."};try{for(const V of new Intl.NumberFormat(A||void 0).formatToParts(12345.6))V.type==="group"?W.group=V.value:V.type==="decimal"&&(W.decimal=V.value)}catch{}return u.set(S,W),W}const a=/[\s ]/g,h=/^[+-]?[\d '’ .,]*(?:[eE][+-]?\d+)?/,v=/^[^\d+\-(.,\s]+\s*/,g=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function k(A,S){const{group:x,decimal:W}=o(S);let V=String(A).replace(a,"");if(V==="")return null;const G=W?V.indexOf(W):-1;if(x&&x!==W){if(G>=0&&V.indexOf(x,G+W.length)>=0)return null;V=V.split(x).join("")}if(W&&W!=="."&&(V=V.split(W).join(".")),!g.test(V))return null;const Q=Number(V);return Number.isFinite(Q)?Q:null}function d(A,S,x){const W=String(A).trim().replace(/\.$/,"");if(W==="")return null;const V=S.units.find(le=>le.symbol===W);if(V)return V;const G=W.toLowerCase(),Q=S.byToken.get(G);if(Q===F)return null;if(Q)return Q;const ee=S.byPrefix.get(G);if(!ee||!ee.length)return null;const ne=f(S,x),se=ee.filter(le=>ne.includes(le));return se.length===1?se[0]:null}function p(A,S,x,W){let V=A,G=0,Q=!1,ee=!1;for(;V!=="";){const ne=h.exec(V)[0];if(ne==="")return null;const se=k(ne,W&&W.locale);if(se===null)return null;V=V.slice(ne.length).trim();const le=V.search(/[+-]?[\d]/),me=(le>=0?V.slice(0,le):V).trim();if(V=le>=0?V.slice(le).trim():"",me===""){if(Q)return null;ee=!0,G+=n(se,x[0],S.base)}else{const ve=d(me,S.index,S.binary);if(!ve)return null;G+=n(se,ve,S.base)}if(Q=!0,ee&&V!=="")return null}return Q?G:null}function b(A,S){if(C(A))return null;if(typeof A=="number")return Number.isFinite(A)?A:null;const x=t(S);if(!x)return null;let W=String(A).trim();if(W==="")return null;let V=!1;W.startsWith("(")&&W.endsWith(")")&&(V=!0,W=W.slice(1,-1).trim());const G=s(S,x);if(G){W.startsWith("-")&&(V=!0,W=W.slice(1).trim());const fe=p(W,x,G,S);return fe===null?null:V?-fe:fe}let Q=null;const ee=v.exec(W);if(ee&&ee[0]){const fe=d(ee[0].trim(),x.index,x.binary);fe&&(Q=fe,W=W.slice(ee[0].length).trim())}const ne=h.exec(W)[0],se=k(ne,S&&S.locale);if(se===null)return null;const le=W.slice(ne.length).trim();if(Q&&le!=="")return null;const me=Q||(le===""?x.base:d(le,x.index,x.binary));if(!me)return null;const ve=n(se,me,x.base);return V?-ve:ve}const O=new Map;function y(A,S,x,W){const V=`${A||""}|${S}|${x}|${W?1:0}`;let G=O.get(V);return G||(G=new Intl.NumberFormat(A||void 0,{minimumFractionDigits:S,maximumFractionDigits:x,useGrouping:W}),O.set(V,G)),G}function M(A,S){if(!Number.isFinite(A)||A===0)return Math.max(0,S-1);const x=Math.floor(Math.log10(Math.abs(A)));return Math.min(20,Math.max(0,S-1-x))}function D(A,S){if(!Number.isFinite(A)||A===0)return A;const x=Math.ceil(Math.log10(Math.abs(A))),W=10**(S-x);return Math.round(A*W)/W}function _(A,S,x){if(!x||x===S.base.symbol)return S.base;if(x!=="auto")return I(S,x);if(A===0||!Number.isFinite(A))return S.base;const W=Math.abs(A)*S.base.factor,V=f(S.index,S.binary);let G=V[0];for(const ne of V)W>=ne.factor&&(G=ne);if(W>=G.factor)return G;let Q=G;for(const ne of S.index.units)ne.binary!==S.binary&&ne.factor!==1||ne.factor<=W&&ne.factor>(Q===G?0:Q.factor)&&(Q=ne);if(Q!==G)return Q;let ee=G;for(const ne of S.index.units)ne.binary!==S.binary&&ne.factor!==1||ne.factor<ee.factor&&(ee=ne);return ee.factor<S.base.factor?ee:S.base}function I(A,S){const x=A.index.units.find(V=>V.symbol===S);if(x)return x;const W=A.index.byToken.get(String(S).toLowerCase());return W&&W!==F?W:(z(`unit:display:${S}`,`unknown display unit "${S}"; rendering in ${A.base.symbol}`),A.base)}function L(A,S,x,W){const V=A<0;let G=Math.abs(A)*S.base.factor;const Q=typeof W.decimals=="number"?W.decimals:W.minDecimals??0,ee=typeof W.decimals=="number"?W.decimals:W.maxDecimals??Math.max(Q,2),ne=W.space??" ",se=[];for(let me=0;me<x.length;me++){const ve=x[me],fe=me===x.length-1;let xe=fe?G/ve.factor:Math.floor(G/ve.factor);if(G-=xe*ve.factor,fe){const Be=10**ee;xe=Math.round(xe*Be)/Be+0}const He=fe?y(W.locale,Q,ee,W.group!==!1):y(W.locale,0,0,W.group!==!1);se.push(`${He.format(xe)}${ne}${ve.symbol}`)}const le=se.join(" ");return V?`-${le}`:le}function $(A,S){const x=S||{},W=x.nullDisplay??"";if(C(A)||A==="")return W;const V=typeof A=="number"?A:Number(A);if(!Number.isFinite(V))return W;const G=t(x);if(!G)return String(V);const Q=s(x,G);if(Q)return L(V,G,Q,x);const ee=typeof x.significantFigures=="number"&&x.significantFigures>0?x.significantFigures:0,ne=ee?D(V,ee):V,se=_(ne,G,x.display),le=n(ne,G.base,se);let me=typeof x.decimals=="number"?x.decimals:x.minDecimals??0,ve=typeof x.decimals=="number"?x.decimals:x.maxDecimals??Math.max(me,2);ee&&(me=M(le,ee),ve=me);const fe=y(x.locale,me,ve,x.group!==!1).format(le),xe=x.space??" ";return x.placement==="prefix"?`${se.symbol}${x.space??""}${fe}`:`${fe}${xe}${se.symbol}`}function P(A,S){const x=C(A)||Number.isNaN(A)?null:Number(A),W=C(S)||Number.isNaN(S)?null:Number(S);return x===null||Number.isNaN(x)?W===null||Number.isNaN(W)?0:1:W===null||Number.isNaN(W)||x<W?-1:x>W?1:0}function N(A){const S=typeof A.decimals=="number"&&A.decimals>0?`.${"0".repeat(A.decimals)}`:"";return`${typeof A.decimals=="number"?`#,##0${S}`:"#,##0.##"}" ${A.symbol}"`}function T(A){const S={system:"data",...A||{}},x=t(S),W=x?x.base.symbol:String(S.unit||""),V=Object.freeze({...S,unit:W}),G=Object.freeze({...V,display:W,decimals:void 0,minDecimals:0,maxDecimals:20,group:!1}),Q=new Map([[V.locale||"",V]]),ee=ne=>{const se=ne||"";let le=Q.get(se);return le||(le=Object.freeze({...V,locale:ne||void 0}),Q.set(se,le)),le};return{base:"number",extends:"number",storage:"float64",unitConfig:V,format:ne=>$(ne.value,ne.locale?ee(ne.locale):V),parse:ne=>b(ne.text,ne.locale?ee(ne.locale):V),compare:P,defaults:{filter:"number",editor:"unit",align:"end",total:S.total||"sum"},...S.totals?{totals:S.totals}:{},excel:S.excel||N({decimals:S.decimals,symbol:W}),toStorage:ne=>typeof ne=="number"?Number.isFinite(ne)?ne:null:typeof ne=="string"?b(ne,V):C(ne)?null:b(String(ne),V),toClipboard:ne=>$(ne,G),fromClipboard:ne=>b(ne,V)}}const E=T}),Ue("packages/core/src/columns/types/engineering.js",function(e,U){"use strict";Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return B}});const C=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/columns/types/unit.js").createUnitType;function B(F){const X=2*Math.PI/F;return H=>{let j=0,w=0,m=0;for(const f of H||[]){if(C(f))continue;const l=Number(f);Number.isFinite(l)&&(j+=Math.cos(l*X),w+=Math.sin(l*X),m+=1)}return!m||Math.hypot(j,w)/m<1e-12?null:(Math.atan2(w,j)/X%F+F)%F}}function Z(F){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:B(F)}}}const K=Object.freeze({metres:z({system:"length",unit:"m",display:"auto",maxDecimals:3}),millimetres:z({system:"length",unit:"mm",maxDecimals:2}),kilometres:z({system:"length",unit:"km",maxDecimals:3}),grams:z({system:"mass",unit:"g",display:"auto",maxDecimals:3}),kilograms:z({system:"mass",unit:"kg",maxDecimals:3}),tonnes:z({system:"mass",unit:"t",maxDecimals:3}),seconds:z({system:"duration",unit:"s",display:"auto",maxDecimals:3}),milliseconds:z({system:"duration",unit:"ms",maxDecimals:3}),hours:z({system:"duration",unit:"h",maxDecimals:2}),speed:z({system:"speed",unit:"m/s",display:"auto",maxDecimals:2}),kph:z({system:"speed",unit:"km/h",maxDecimals:1}),mph:z({system:"speed",unit:"mph",maxDecimals:1}),knots:z({system:"speed",unit:"kn",maxDecimals:1}),acceleration:z({system:"acceleration",unit:"m/s²",maxDecimals:3}),area:z({system:"area",unit:"m²",display:"auto",maxDecimals:2}),hectares:z({system:"area",unit:"ha",maxDecimals:4}),volume:z({system:"volume",unit:"L",display:"auto",maxDecimals:3}),cubicMetres:z({system:"volume",unit:"m³",maxDecimals:3}),energy:z({system:"energy",unit:"J",display:"auto",maxDecimals:3}),kilowattHours:z({system:"energy",unit:"kWh",maxDecimals:2}),power:z({system:"power",unit:"W",display:"auto",maxDecimals:2}),kilowatts:z({system:"power",unit:"kW",maxDecimals:2}),force:z({system:"force",unit:"N",display:"auto",maxDecimals:2}),pressure:z({system:"pressure",unit:"Pa",display:"auto",maxDecimals:2}),bar:z({system:"pressure",unit:"bar",maxDecimals:3}),psi:z({system:"pressure",unit:"psi",maxDecimals:1}),torque:z({system:"torque",unit:"N·m",maxDecimals:2}),density:z({system:"density",unit:"kg/m³",maxDecimals:2}),flow:z({system:"flow",unit:"m³/s",maxDecimals:4}),litresPerMinute:z({system:"flow",unit:"L/min",maxDecimals:1}),radians:z({system:"angle",unit:"rad",maxDecimals:4,totals:Z(2*Math.PI)}),degrees:z({system:"angle",unit:"°",maxDecimals:2,totals:Z(360)}),rpm:z({system:"angularVelocity",unit:"rpm",maxDecimals:0}),angularVelocity:z({system:"angularVelocity",unit:"rad/s",maxDecimals:3}),ppm:z({system:"fraction",unit:"ppm",maxDecimals:2}),ppb:z({system:"fraction",unit:"ppb",maxDecimals:2}),basisPoints:z({system:"fraction",unit:"bp",maxDecimals:1}),molarity:z({system:"molarity",unit:"M",display:"auto",maxDecimals:3}),massFlow:z({system:"massFlow",unit:"kg/s",maxDecimals:3}),tonnesPerHour:z({system:"massFlow",unit:"t/h",maxDecimals:2}),viscosity:z({system:"viscosity",unit:"Pa·s",display:"auto",maxDecimals:3}),kinematicViscosity:z({system:"kinematicViscosity",unit:"cSt",maxDecimals:2}),thermalConductivity:z({system:"thermalConductivity",unit:"W/(m·K)",maxDecimals:3}),specificHeat:z({system:"specificHeat",unit:"J/(kg·K)",maxDecimals:1}),doseRate:z({system:"doseRate",unit:"µSv/h",display:"auto",maxDecimals:2})})}),Ue("packages/core/src/columns/types/si.js",function(e,U){"use strict";Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return j}});const te=U("packages/core/src/columns/types/unit.js"),C=te.defineUnit,q=te.registerUnitSystem,z=te.createUnitType,B=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})]),Z=Object.freeze(["p","n","µ","m","","k","M","G"]);function K(w){const m=String(w.base),c=new Set([...w.prefixes||Z,""]),f=[];for(const l of B){if(!c.has(l.symbol))continue;const r=`${l.symbol}${m}`,t=[];if(w.name){t.push(`${l.name}${w.name}`,`${l.name}${w.name}s`);const i=l.name.slice(-1);if(i&&w.name.startsWith(i)){const s=`${l.name.slice(0,-1)}${w.name}`;t.push(s,`${s}s`)}}l.symbol==="µ"&&t.push(`u${m}`),l.factor===1&&w.aliases&&t.push(...w.aliases),f.push(C(r,l.factor,t))}for(const l of w.extra||[])f.push(l);return f}function F(w,m){const c=K(m);return q(w,c)}function X(w,m,c){return F(w,m),z({system:w,unit:m.base,display:"auto",maxDecimals:3,...c||{}})}const H=Object.freeze({voltage:X("voltage",{base:"V",name:"volt"}),current:X("current",{base:"A",name:"amp",aliases:["ampere","amperes"]}),resistance:X("resistance",{base:"Ω",name:"ohm",aliases:["ohm","ohms","R"],prefixes:["m","","k","M","G"]}),capacitance:X("capacitance",{base:"F",name:"farad",prefixes:["f","p","n","µ","m",""]}),inductance:X("inductance",{base:"H",name:"henry",prefixes:["p","n","µ","m",""]}),charge:X("charge",{base:"C",name:"coulomb",prefixes:["p","n","µ","m",""],extra:[C("mAh",3.6,["milliamphour","milliamphours"],{auto:!1}),C("Ah",3600,["amphour","amphours"],{auto:!1})]}),conductance:X("conductance",{base:"S",name:"siemens",prefixes:["n","µ","m","","k"]}),fluxDensity:X("fluxDensity",{base:"T",name:"tesla",prefixes:["n","µ","m",""],extra:[C("G",1e-4,["gauss"],{auto:!1})]}),luminousFlux:X("luminousFlux",{base:"lm",name:"lumen",prefixes:["m","","k"]}),illuminance:X("illuminance",{base:"lx",name:"lux",prefixes:["m","","k"]}),luminousIntensity:X("luminousIntensity",{base:"cd",name:"candela",prefixes:["m","","k"]}),substance:X("substance",{base:"mol",name:"mole",prefixes:["n","µ","m","","k"]}),absorbedDose:X("absorbedDose",{base:"Gy",name:"gray",prefixes:["µ","m",""]}),equivalentDose:X("equivalentDose",{base:"Sv",name:"sievert",prefixes:["n","µ","m",""]}),radioactivity:X("radioactivity",{base:"Bq",name:"becquerel",prefixes:["","k","M","G","T"],extra:[C("Ci",37e9,["curie","curies"],{auto:!1})]}),frequency:X("frequency",{base:"Hz",name:"hertz",prefixes:["m","","k","M","G","T"]})}),j=X}),Ue("packages/core/src/columns/types/temperature.js",function(e,U){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});const C=U("packages/core/src/internal/predicates.js").isNil,q=Object.freeze({C:Object.freeze({symbol:"°C",aliases:["c","°c","celsius","centigrade"],toKelvin:f=>f+273.15,fromKelvin:f=>f-273.15}),F:Object.freeze({symbol:"°F",aliases:["f","°f","fahrenheit"],toKelvin:f=>(f+459.67)*(5/9),fromKelvin:f=>f*(9/5)-459.67}),K:Object.freeze({symbol:"K",aliases:["k","kelvin"],toKelvin:f=>f,fromKelvin:f=>f}),R:Object.freeze({symbol:"°R",aliases:["r","°r","rankine"],toKelvin:f=>f*(5/9),fromKelvin:f=>f*(9/5)})});function z(f){if(C(f))return null;const l=String(f).trim();if(l==="")return null;for(const[t,i]of Object.entries(q))if(l===t||l===i.symbol)return{key:t,scale:i};const r=l.toLowerCase();for(const[t,i]of Object.entries(q))if(i.aliases.includes(r))return{key:t,scale:i};return null}function B(f,l,r){const t=z(l),i=z(r);return!t||!i||!Number.isFinite(Number(f))?null:t.key===i.key?Number(f):i.scale.fromKelvin(t.scale.toKelvin(Number(f)))}const Z=new Map;function K(f,l,r){const t=`${f||""}|${l}|${r}`;let i=Z.get(t);return i||(i=new Intl.NumberFormat(f||void 0,{minimumFractionDigits:l,maximumFractionDigits:r}),Z.set(t,i)),i}function F(f,l){const r=l||{},t=r.nullDisplay??"";if(C(f)||f==="")return t;const i=Number(f);if(!Number.isFinite(i))return t;const s=z(r.scale||"C");if(!s)return String(i);const n=z(r.display||r.scale||"C")||s,u=n.key===s.key?i:n.scale.fromKelvin(s.scale.toKelvin(i)),o=typeof r.decimals=="number"?r.decimals:null,a=o??r.minDecimals??0,h=o??r.maxDecimals??1;return`${K(r.locale,a,h).format(u)}${r.space??" "}${n.scale.symbol}`}const X=/^[+-]?[\d\s., ]*\d/;function H(f,l){const r=String(f).trim();if(r==="")return null;const t=new Intl.NumberFormat(l||void 0).formatToParts(1.1).find(u=>u.type==="decimal")?.value||".",i=t===","?".":",",s=r.split(i).join("").split(/[\s ]/).join("").replace(t,"."),n=Number(s);return Number.isFinite(n)?n:null}function j(f,l){if(C(f))return null;const r=l||{},t=z(r.scale||"C");if(!t)return null;if(typeof f=="number")return Number.isFinite(f)?f:null;let i=String(f).trim();if(i==="")return null;let s=!1;i.startsWith("(")&&i.endsWith(")")&&(s=!0,i=i.slice(1,-1).trim());const n=X.exec(i);if(!n)return null;const u=H(n[0],r.locale);if(u===null)return null;const o=i.slice(n[0].length).trim();if(o==="")return s?-u:u;const a=z(o);if(!a)return null;const h=a.key===t.key?u:t.scale.fromKelvin(a.scale.toKelvin(u));return s?-h:h}function w(f){const l=Object.freeze({scale:"C",...f||{}}),t=(z(l.scale)||z("C")).scale.symbol,i=Object.freeze({...l,display:l.scale,decimals:void 0,minDecimals:0,maxDecimals:20}),s=new Map([[l.locale||"",l]]),n=u=>{const o=u||"";let a=s.get(o);return a||(a=Object.freeze({...l,locale:u||void 0}),s.set(o,a)),a};return{base:"number",extends:"number",storage:"float64",temperatureConfig:l,format:u=>F(u.value,u.locale?n(u.locale):l),parse:u=>j(u.text,u.locale?n(u.locale):l),defaults:{filter:"number",editor:"temperature",align:"end",total:"avg"},totals:{supported:["avg","min","max","count","countValues"]},excel:l.excel||`#,##0${typeof l.decimals=="number"&&l.decimals>0?`.${"0".repeat(l.decimals)}`:".#"}" ${t}"`,toStorage:u=>typeof u=="number"?Number.isFinite(u)?u:null:typeof u=="string"?j(u,l):C(u)?null:j(String(u),l),toClipboard:u=>F(u,i),fromClipboard:u=>j(u,l)}}const m=Object.freeze({celsius:w({scale:"C"}),fahrenheit:w({scale:"F"}),kelvin:w({scale:"K"})}),c=w}),Ue("packages/core/src/columns/types/radix.js",function(e,U){"use strict";Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"digitsForWidth",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"radixRange",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"radixName",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"normaliseRadixOptions",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"compileRadixFormat",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"compileRadixParse",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"parseRadixResult",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return L}});const C=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/warn.js").warnOnce,B=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}),Z=Object.freeze({2:1,8:3,16:4}),K=Object.freeze({2:"0b",8:"0o",16:"0x"}),F=Object.freeze({2:4,8:3,16:2}),X=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),H=Object.freeze({2:"binary",8:"octal",16:"hexadecimal"}),j=Object.freeze([[/^0x/i,16],[/^0b/i,2],[/^0o/i,8],[/^#/,16]]),w=/[\s\u00a0\u202f_,']/g,m=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,c=Object.freeze([8,16,32,53]),f=new WeakSet,l=new WeakMap,r=new Map,t=new WeakMap,i=new WeakMap,s=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($){if($==null)return 16;const P=typeof $=="string"?$.toLowerCase():$,N=B[P];return N||(z(`radix:base:${String($)}`,`unsupported radix ${String($)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function u($,P){return Math.ceil($/Z[P])}function o($,P){if(!$)return P?{min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}:{min:0,max:Number.MAX_SAFE_INTEGER};if(!P)return{min:0,max:2**$-1};const N=2**($-1);return{min:-N,max:N-1}}function a($){return H[$]||"hexadecimal"}function h($){if(typeof $=="string"){const P=s[$];return P||z(`radix:preset:${$}`,`unknown radix preset "${$}"; known presets are ${Object.keys(s).join(", ")}`),{...P||{}}}if($&&typeof $.preset=="string"){const P=s[$.preset];return P||z(`radix:preset:${$.preset}`,`unknown radix preset "${$.preset}"; known presets are ${Object.keys(s).join(", ")}`),{...P||{},...$}}return $||{}}function v($){const P=h($),N=n(P.radix),T=Z[N];let E=null;if(P.bitWidth!==void 0&&P.bitWidth!==null&&P.bitWidth!==!1){const ne=Number(P.bitWidth);c.includes(ne)?E=ne:z(`radix:width:${String(P.bitWidth)}`,`unsupported bitWidth ${String(P.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let A=P.signed!==!1;!A&&E===null&&(z("radix:unsigned:width","signed: false needs a bitWidth to render a two's-complement pattern; defaulting to 32"),E=32);const S=P.prefix===void 0||P.prefix===!0?K[N]:P.prefix===!1?"":String(P.prefix);let x=0;P.pad===!0?x=E?u(E,N):0:typeof P.pad=="number"&&P.pad>0&&(x=Math.floor(P.pad));let W=0;P.group===!0?W=F[N]:typeof P.group=="number"&&P.group>0&&(W=Math.floor(P.group));const V=o(E,A),G=typeof P.min=="number"?Math.max(V.min,P.min):V.min,Q=typeof P.max=="number"?Math.min(V.max,P.max):V.max,ee=Object.freeze({radix:N,bits:T,prefix:S,uppercase:P.uppercase!==!1,pad:x,group:W,groupSeparator:typeof P.groupSeparator=="string"?P.groupSeparator:" ",bitWidth:E,signed:A,min:G,max:Q<G?G:Q,nullDisplay:typeof P.nullDisplay=="string"?P.nullDisplay:"",name:a(N)});return f.add(ee),ee}function g($){if($&&f.has($))return $;if(typeof $=="string"){let P=r.get($);return P||(P=v($),r.set($,P)),P}if($&&typeof $=="object"){let P=l.get($);return P||(P=v($),l.set($,P)),P}return g("hex")}function k($){return $<0?-Math.round(-$):Math.round($)}function d($,P,N){if(P<=0||$.length<=P)return $;const T=$.length%P||P,E=[$.slice(0,T)];for(let A=T;A<$.length;A+=P)E.push($.slice(A,A+P));return E.join(N)}function p($){const P=g($),{radix:N,prefix:T,uppercase:E,pad:A,group:S,groupSeparator:x,signed:W,bitWidth:V,nullDisplay:G}=P,Q=V?2**V:0,ee=ne=>{if(C(ne)||ne==="")return G;const se=typeof ne=="number"?ne:Number(ne);if(!Number.isFinite(se))return G;const le=k(se);let me="",ve=le;le<0&&(W?(me="-",ve=-le):ve=(le%Q+Q)%Q);let fe=ve.toString(N);return fe=E?fe.toUpperCase():fe.toLowerCase(),A>0&&fe.length<A&&(fe=fe.padStart(A,"0")),S>0&&(fe=d(fe,S,x)),me+T+fe};return ee.options=P,ee}function b($,P){const N=g(P);let T=t.get(N);return T||(T=p(N),t.set(N,T)),T($)}function O($){const P=g($),{radix:N,groupSeparator:T,signed:E,min:A,max:S}=P,x=X[N],W=V=>{if(C(V))return{ok:!0,value:null,reason:"blank"};let G=String(V);if(T&&T!==""&&(G=G.split(T).join("")),G=G.replace(w,""),G==="")return{ok:!0,value:null,reason:"blank"};let Q=!1;if((G[0]==="-"||G[0]==="+")&&(Q=G[0]==="-",G=G.slice(1)),G==="")return{ok:!1,value:null,reason:"digits"};let ee=null;for(const[se,le]of j){const me=se.exec(G);if(!me)continue;const ve=G.slice(me[0].length);if(ve==="")break;if(!X[le].test(ve))return{ok:!1,value:null,reason:"digits"};ee=parseInt(ve,le);break}if(ee===null)if(x.test(G))ee=parseInt(G,N);else if(m.test(G))ee=Number(G);else return{ok:!1,value:null,reason:"digits"};if(!Number.isFinite(ee))return{ok:!1,value:null,reason:"digits"};const ne=k(Q?-ee:ee);return!E&&ne<0?{ok:!1,value:ne,reason:"negative"}:ne<A||ne>S?{ok:!1,value:ne,reason:"range"}:{ok:!0,value:ne,reason:"ok"}};return W.options=P,W}function y($,P){const N=g(P);let T=i.get(N);return T||(T=O(N),i.set(N,T)),T($)}function M($,P){const N=y($,P);return N.ok?N.value:null}function D($,P){const N=C($)||Number.isNaN($)?null:Number($),T=C(P)||Number.isNaN(P)?null:Number(P);return N===null?T===null?0:1:T===null||N<T?-1:N>T?1:0}function _($){const P=$.min>=-2147483648&&$.max<=2147483647;return $.bitWidth&&P?"int32":"float64"}function I($){const P=v($),N=p(P),T=O(P);return{base:"number",extends:"number",storage:_(P),matches:null,format:E=>N(E.value),parse:E=>{const A=T(E.text);return A.ok?A.value:null},compare:D,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:E=>N(E),fromClipboard:E=>{const A=T(E);return A.ok?A.value:null},radix:P,formatValue:N,parseText:T}}const L=I}),Ue("packages/core/src/columns/types/aggregable.js",function(e,U){"use strict";Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"weightedMean",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"logarithmicSum",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"logarithmicMean",{enumerable:!0,get:function(){return B}});const C=U("packages/core/src/internal/predicates.js").isNil;function q(H){const j=[];for(const w of H||[]){if(C(w))continue;const m=Number(w);Number.isFinite(m)&&j.push(m)}return j}function z(H){return j=>{const w=q(j);if(!w.length)return null;let m=0;for(const c of w)m+=10**(c/H);return H*Math.log10(m)}}function B(H){return j=>{const w=q(j);if(!w.length)return null;let m=0;for(const c of w)m+=10**(c/H);return H*Math.log10(m/w.length)}}function Z(H,j){const w=j&&j.column,c=(w&&w.typeOptions||{}).weight,f=j&&j.valueAt;if(!c||typeof f!="function")return null;let l=0,r=0;for(let t=0;t<H.length;t++){if(C(H[t]))continue;const i=Number(H[t]);if(!Number.isFinite(i))continue;const s=f(c,t);if(C(s))continue;const n=Number(s);!Number.isFinite(n)||n<=0||(l+=i*n,r+=n)}return r===0?null:l/r}function K(H={}){const j=H.factor===20?20:10,w=typeof H.suffix=="string"?H.suffix:"",m=Number.isInteger(H.decimals)?H.decimals:1;return{base:"number",storage:"float64",name:H.name||"logarithmic",format:c=>{const f=c&&c.value;return C(f)||!Number.isFinite(Number(f))?"":`${Number(f).toFixed(m)}${w}`},parse:c=>{const f=String((c&&c.text)??"").replace(w,"").trim();if(!f)return null;const l=Number(f);return Number.isFinite(l)?l:null},defaults:{align:"end",filter:"number"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:{sum:z(j),avg:B(j)}}}}function F(H={}){const j=Number.isInteger(H.decimals)?H.decimals:1,w=H.percent===!0;return{base:"number",storage:"float64",name:H.name||"ratio",format:m=>{const c=m&&m.value;return C(c)||!Number.isFinite(Number(c))?"":w?`${Number(c).toFixed(j)}%`:Number(c).toFixed(j)},parse:m=>{const c=String((m&&m.text)??"").replace("%","").trim();if(!c)return null;const f=Number(c);return Number.isFinite(f)?f:null},defaults:{align:"end",filter:"number"},totals:{supported:["avg","min","max","count","countValues"],implement:{avg:Z}}}}const X=Object.freeze({decibel:K({name:"decibel",factor:10,suffix:" dB"}),decibelAmplitude:K({name:"decibelAmplitude",factor:20,suffix:" dB"}),ratio:F({name:"ratio"}),percentRate:F({name:"percentRate",percent:!0})})}),Ue("packages/core/src/columns/types/currency.js",function(e,U){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"moneyToText",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});const C=U("packages/core/src/internal/predicates.js").isNil,q="⚠ no rate";function z(u){if(C(u))return null;const o=String(u).trim().toUpperCase();return o===""?null:o}function B(u){if(C(u))return null;if(typeof u=="object"&&!Array.isArray(u)){const o=Number(u.amount),a=z(u.code);return!a||!Number.isFinite(o)?null:{amount:o,code:a}}if(Array.isArray(u)&&u.length===2){const o=Number(u[0]),a=z(u[1]);return!a||!Number.isFinite(o)?null:{amount:o,code:a}}return null}const Z=Object.freeze({$:"USD","€":"EUR","£":"GBP","¥":"JPY","₹":"INR","₩":"KRW","₽":"RUB","₺":"TRY","₴":"UAH","₪":"ILS"}),K=Object.freeze({USD:"$",EUR:"€",GBP:"£",JPY:"¥",INR:"₹",KRW:"₩",RUB:"₽",TRY:"₺",UAH:"₴",ILS:"₪"}),F=/[+-]?[\d\s., ]*\d/;function X(u,o){const a=String(u).trim();if(a==="")return null;const h=new Intl.NumberFormat(o||void 0).formatToParts(1.1).find(d=>d.type==="decimal")?.value||".",v=h===","?".":",",g=a.split(v).join("").split(/[\s ]/).join("").replace(h,"."),k=Number(g);return Number.isFinite(k)?k:null}function H(u,o){const a=o||{},h=z(a.code);if(C(u))return null;const v=B(u);if(v)return v;if(typeof u=="number")return Number.isFinite(u)&&h?{amount:u,code:h}:null;let g=String(u).trim();if(g==="")return null;let k=!1;g.startsWith("(")&&g.endsWith(")")&&(k=!0,g=g.slice(1,-1).trim());let d=null;for(const[D,_]of Object.entries(Z)){if(g.startsWith(D)){d=_,g=g.slice(D.length).trim();break}if(g.endsWith(D)){d=_,g=g.slice(0,-D.length).trim();break}}const p=F.exec(g);if(!p)return null;const b=X(p[0],a.locale);if(b===null)return null;const O=(g.slice(0,p.index)+" "+g.slice(p.index+p[0].length)).trim();!d&&O!==""&&(d=z(O));const y=d||h;return y?{amount:k?-b:b,code:y}:null}function j(u,o){if(typeof u=="function")return(a,h)=>{if(a===h)return 1;const v=u(a,h);return typeof v=="number"&&Number.isFinite(v)&&v>0?v:null};if(u&&typeof u=="object"){const a=u;return(h,v)=>{if(h===v)return 1;const g=Number(a[h]),k=Number(a[v]);return!Number.isFinite(g)||!Number.isFinite(k)||g<=0||k<=0?null:k/g}}return(a,h)=>a===h?1:null}function w(u,o,a){if(!u)return null;if(u.code===o)return u.amount;const h=a(u.code,o);return h===null?null:u.amount*h}const m=new Map;function c(u,o,a){const h=`${u||""}|${o}|${a??""}`;let v=m.get(h);if(!v){const g={style:"currency",currency:o};typeof a=="number"&&(g.minimumFractionDigits=a,g.maximumFractionDigits=a);try{v={fmt:new Intl.NumberFormat(u||void 0,g),currency:!0}}catch{v={fmt:new Intl.NumberFormat(u||void 0,typeof a=="number"?{minimumFractionDigits:a,maximumFractionDigits:a}:{}),currency:!1}}m.set(h,v)}return v}function f(u,o){const a=o||{},h=a.nullDisplay??"",v=B(u);if(!v)return h;const g=z(a.display)||v.code;let k=v.amount,d=v.code;if(g!==v.code){const O=a.rateFn||j(a.rates,a.rateBase),y=w(v,g,O);if(y===null)return`${a.missingRate??q} ${v.code}→${g}`;k=y,d=g}const{fmt:p,currency:b}=c(a.locale,d,a.decimals);return b?p.format(k):`${p.format(k)} ${d}`}function l(u){const o=B(u);return o?`${o.amount} ${o.code}`:""}function r(u){const o=u||{},a=z(o.display),h=o.rateFn||j(o.rates,o.rateBase);return(v,g)=>{const k=B(v),d=B(g);if(!k&&!d)return 0;if(!k)return 1;if(!d)return-1;if(a){const p=w(k,a,h),b=w(d,a,h);if(p!==null&&b!==null)return p===b?0:p<b?-1:1}return k.code===d.code?k.amount===d.amount?0:k.amount<d.amount?-1:1:k.code<d.code?-1:1}}function t(u){const o=u||{},a=(v,g)=>{const k=[];for(const y of v||[]){const M=B(y);M&&k.push(M)}if(!k.length)return null;if(new Set(k.map(y=>y.code)).size===1){const y=k[0].code;return{amount:g(k.map(M=>M.amount)),code:y}}const p=z(o.display);if(!p)return`${o.missingRate??q}: mixed currencies, no display currency set`;const b=o.rateFn||j(o.rates,o.rateBase),O=[];for(const y of k){const M=w(y,p,b);if(M===null)return`${o.missingRate??q}: ${y.code}→${p}`;O.push(M)}return{amount:g(O),code:p}},h=v=>v.reduce((g,k)=>g+k,0);return{sum:v=>a(v,h),avg:v=>a(v,g=>h(g)/g.length),min:v=>a(v,g=>Math.min(...g)),max:v=>a(v,g=>Math.max(...g))}}function i(u){const o=Object.freeze({code:"USD",...u||{}}),a=j(o.rates,o.rateBase),h=Object.freeze({...o,rateFn:a}),v=t(h),g=r(h),k=new Map([[o.locale||"",h]]),d=O=>{const y=O||"";let M=k.get(y);return M||(M=Object.freeze({...h,locale:O||void 0}),k.set(y,M)),M},p=K[z(o.display||o.code)]||"",b=typeof o.decimals=="number"&&o.decimals>0?`.${"0".repeat(o.decimals)}`:".00";return{base:"object",extends:"object",storage:"object",name:"currency",currencyConfig:h,format:O=>f(O.value,O.locale?d(O.locale):h),parse:O=>H(O.text,O.locale?d(O.locale):h),compare:g,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:v},excel:o.excel||(p?`"${p}"#,##0${b}`:`#,##0${b}`),toStorage:O=>{const y=B(O);return y||(typeof O=="string"||typeof O=="number"?H(O,h):null)},toClipboard:O=>l(O),fromClipboard:O=>H(O,h)}}const s=Object.freeze({currency:i({code:"USD"}),usd:i({code:"USD"}),eur:i({code:"EUR"}),gbp:i({code:"GBP"}),jpy:i({code:"JPY",decimals:0})}),n=i}),Ue("packages/core/src/columns/types/index.js",function(e,U){"use strict";Object.defineProperty(e,"EXTENDED_TYPES",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return D}});const te=U("packages/core/src/columns/types/temporal.js"),C=te.TEMPORAL_TYPES,q=U("packages/core/src/columns/types/network.js"),z=q.NETWORK_TYPES,B=U("packages/core/src/columns/types/structured.js"),Z=B.STRUCTURED_TYPES,K=U("packages/core/src/columns/types/unit.js"),F=K.createUnitType,X=K.UNIT_SYSTEMS,H=K.parseUnit,j=K.formatUnit,w=K.registerUnitSystem,m=K.unitSystemNames,c=K.unitsOf,f=K.defineUnit,l=U("packages/core/src/columns/types/engineering.js"),r=l.ENGINEERING_TYPES,t=U("packages/core/src/columns/types/si.js"),i=t.SI_TYPES,s=t.createSiType,n=t.createSiSystem,u=t.siUnits,o=t.SI_PREFIXES,a=U("packages/core/src/columns/types/temperature.js"),h=a.TEMPERATURE_TYPES,v=a.createTemperatureType,g=a.convertTemperature,k=a.formatTemperature,d=a.parseTemperature,p=a.TEMPERATURE_SCALES,b=U("packages/core/src/columns/types/radix.js"),O=b.createRadixType,y=b.RADIX_PRESETS,M=b.parseRadix,D=b.formatRadix,_=U("packages/core/src/columns/types/aggregable.js"),I=_.AGGREGABLE_TYPES,L=U("packages/core/src/columns/types/currency.js"),$=L.CURRENCY_TYPES,P=L.createCurrencyType,N=L.parseMoney,T=L.formatMoney,E=L.convertMoney,A=L.toMoney,S=L.rateFunction,x=L.moneyComparator,W=L.normaliseCode,V=L.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return K.findUnit}}),Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return l.ENGINEERING_TYPES}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return l.circularMean}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return a.TEMPERATURE_TYPES}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return a.createTemperatureType}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return a.convertTemperature}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return a.formatTemperature}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return a.parseTemperature}}),Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return a.TEMPERATURE_SCALES}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return a.findScale}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return L.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return L.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return L.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return L.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return L.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return L.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return L.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return L.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return L.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return L.MISSING_RATE}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return te.TEMPORAL_TYPES}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return q.NETWORK_TYPES}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return B.STRUCTURED_TYPES}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return _.AGGREGABLE_TYPES}}),Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return _.createLogarithmicType}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return _.createRatioType}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return te.parseTime}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return te.formatTime}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return te.parseDateTime}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return te.formatDateTime}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return te.parseDuration}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return te.formatDuration}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return q.parseIpv4}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return q.formatIpv4}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return q.parseCidr}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return q.formatCidr}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return q.parseIpv6}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return q.formatIpv6}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return q.networkAddress}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return q.broadcastAddress}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return q.hostCount}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return q.containsAddress}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return q.overlaps}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return B.maskValue}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return B.summariseJson}});const G=Object.freeze({...C,...z,...Z,...I,hex:O(y.hex),hex8:O(y.hex8),hex16:O(y.hex16),hex32:O(y.hex32),binary:O(y.binary),binary8:O(y.binary8),octal:O(y.octal),bytes:F({system:"data",unit:"B",display:"auto"}),megabytes:F({system:"data",unit:"MB"}),gigabytes:F({system:"data",unit:"GB"}),bitrate:F({system:"bitrate",unit:"Mbps"}),gigabits:F({system:"bitrate",unit:"Gbps"}),...r,...i,...h,...$});{const Q=new Set;for(const ee of[C,z,Z,I,r,i,h,$])for(const ne of Object.keys(ee)){if(Q.has(ne))throw new Error(`[lattice] data type "${ne}" is declared twice`);Q.add(ne)}}}),Ue("packages/core/src/compute/handle.js",function(e,U){"use strict";Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return i}});const te=U("packages/core/src/internal/compare.js"),C=te.collator,q=te.defaultCompare,B=U("packages/core/src/internal/warn.js").warnOnce;function Z(s){const n=new Uint32Array(s);for(let u=0;u<s;u++)n[u]=u;return n}function K(s,n){if(n&&typeof n.count=="number")return n.count;if(!s)return 0;if(typeof s.count=="number")return s.count;if(typeof s.length=="number")return s.length;const u=s.values;return s.kind==="multi"&&s.offsets?Math.max(0,s.offsets.length-1):u?s.kind==="bitset"?typeof u.size=="number"?u.size:s.presence&&typeof s.presence.size=="number"?s.presence.size:(B(`count:${s.id}`,`column "${s.id}" is bitset-backed with no declared row count; assuming ${u.length*8}`),u.length*8):u.length:s.presence&&typeof s.presence.size=="number"?s.presence.size:0}const F=new WeakMap;function X(s){const n=s.constructor;if(!n)return"unknown";const u=F.get(n);if(u)return u;let o="unknown";try{let a=null;typeof n.from=="function"?a=n.from([!1,!0]):(a=new n(8),a.set(1));const h=a&&a.words;h&&h.length&&(h[0]===2?o="lsb":h[0]===64&&(o="msb"))}catch{o="unknown"}return F.set(n,o),o}function H(s){if(!s)return()=>0;const n=s instanceof Uint8Array?s:s.words;if(n instanceof Uint8Array){const u=s instanceof Uint8Array?"lsb":X(s);if(u==="lsb")return o=>n[o>>>3]>>>(o&7)&1;if(u==="msb")return o=>n[o>>>3]>>>7-(o&7)&1}return typeof s.get=="function"?u=>s.get(u)?1:0:()=>0}function j(s){return!s||!s.presence?null:H(s.presence)}function w(s){return s?typeof s.size=="number"?s.size:typeof s.values=="function"?s.values().length:0:0}function m(s,n){return s?typeof s.valueOf=="function"?s.valueOf(n):typeof s.values=="function"?s.values()[n]:null:null}function c(s,n){const u=s.offsets,o=s.values;if(!u||!o)return[];const a=u[n],h=u[n+1];if(!(h>a))return[];const v=s.dict,g=new Array(h-a);for(let k=a;k<h;k++)g[k-a]=v?m(v,o[k]):o[k];return g}function f(s){if(!s)return()=>{};const n=s.values,u=j(s),o=s.kind;if(o==="dictionary"){const a=s.dict;return u?h=>u(h)?m(a,n[h]):null:h=>m(a,n[h])}if(o==="bitset"){const a=H(n);return u?h=>u(h)?a(h)===1:null:h=>a(h)===1}if(o==="multi")return u?a=>u(a)?c(s,a):null:a=>c(s,a);if(!n&&typeof s.get=="function"){const a=s.get.bind(s);return h=>{const v=a(h);return v===void 0?null:v}}return u?a=>{if(!u(a))return null;const h=n[a];return h===void 0?null:h}:a=>{const h=n[a];return h===void 0?null:h}}function l(s,n){if(s<n)return-1;if(s>n)return 1;if(s===n){const a=Object.is(s,-0),h=Object.is(n,-0);return a===h?0:a?-1:1}const u=Number.isNaN(s),o=Number.isNaN(n);return u&&o?0:u?1:-1}function r(s){const n=C(s);return(u,o)=>{if(u===o)return 0;const a=typeof u,h=typeof o;if(a==="string"&&h==="string")return n.compare(u,o);if(a==="number"&&h==="number")return l(u,o);if(a==="boolean"&&h==="boolean")return u===o?0:u?1:-1;if(u instanceof Date||o instanceof Date){const v=u instanceof Date?u.getTime():Number(u),g=o instanceof Date?o.getTime():Number(o);return l(v,g)}return q(u,o)}}function t(s,n){if(s&&typeof s.ranks=="function")return s.ranks(n);const u=s&&typeof s.values=="function"?s.values():[],o=u.length,a=r(n),h=new Array(o);for(let g=0;g<o;g++)h[g]=g;h.sort((g,k)=>a(u[g],u[k])||g-k);const v=new Uint32Array(o);for(let g=0;g<o;g++)v[h[g]]=g;return v}function i(s){return s==null||typeof s=="number"&&Number.isNaN(s)}}),Ue("packages/core/src/compute/filter.js",function(e,U){"use strict";Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"wallMs",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return ve}});const C=U("packages/core/src/internal/predicates.js").isBlank,z=U("packages/core/src/internal/merge.js").toArray,Z=U("packages/core/src/internal/warn.js").warnOnce,K=U("packages/core/src/format/date.js"),F=K.toDate,X=K.toIsoDate,H=U("packages/core/src/compute/handle.js"),j=H.bitReader,w=H.dictSize,m=H.dictValue,c=H.presenceReader,f=H.valueComparator,l=H.valueReader,r=/^\d{4}-\d{2}-\d{2}$/,t="\0null\0";function i(fe,xe){const He=fe&&fe.pool;if(He){const Be=He.mask||He.acquireMask||He.acquire||He.take;if(typeof Be=="function"){const ae=Be.call(He,xe);if(ae&&ae.length>=xe)return ae}}return new Uint8Array(xe)}function s(fe,xe){const He=fe&&fe.pool;if(!He||!xe)return;const Be=He.release||He.releaseMask||He.free||He.recycle;typeof Be=="function"&&Be.call(He,xe)}function n(fe,xe,He){return fe.fill(He,0,xe),fe}function u(fe){return fe==null||typeof fe=="number"&&Number.isNaN(fe)}function o(fe,xe){if(fe==null)return fe;if(xe==="number")return typeof fe=="number"?fe:Number(fe);if(xe==="date"||xe==="dateString"){const He=X(fe);return He===null?a(fe):He}return xe==="boolean"?typeof fe=="boolean"?fe:fe==="true"||fe===1?!0:fe==="false"||fe===0?!1:!!fe:fe}function a(fe){return fe instanceof Date?fe.getTime():typeof fe=="number"?fe:Date.parse(String(fe))}function h(fe){return typeof fe=="number"?fe:fe instanceof Date?fe.getTime():fe==null||fe===""?NaN:Number(fe)}function v(fe,xe){const He=typeof fe=="string"?fe:String(fe);return xe?He:He.toLowerCase()}function g(fe,xe){return fe==null?t:typeof fe=="string"?xe?fe:fe.toLowerCase():fe instanceof Date?fe.getTime():fe}function k(fe,xe,He){const Be=new Set;for(const ae of z(fe)){const Ae=o(ae,He);Be.add(g(Ae,xe)),typeof Ae=="string"&&Ae!==""&&Number.isFinite(Number(Ae))?Be.add(Number(Ae)):typeof Ae=="number"&&Number.isFinite(Ae)&&Be.add(g(String(Ae),xe))}return Be}function d(fe,xe,He){if(fe==null||xe===null||xe===void 0)return fe==null&&xe==null;const Be=typeof fe,ae=typeof xe;return Be==="string"&&ae==="string"?He?fe===xe:fe.toLowerCase()===xe.toLowerCase():fe instanceof Date||xe instanceof Date?a(fe)===a(xe):Be==="number"&&ae==="number"?fe===xe||Number.isNaN(fe)&&Number.isNaN(xe):Be==="number"&&ae==="string"?fe===Number(xe):Be==="string"&&ae==="number"?Number(fe)===xe:Be==="boolean"||ae==="boolean"?fe===xe:Array.isArray(fe)&&Array.isArray(xe)?fe.length===xe.length&&fe.every((Ae,Me)=>d(Ae,xe[Me],He)):fe===xe}function p(fe,xe){try{if(fe instanceof RegExp){const He=fe.flags.replace(/[gy]/g,"");return new RegExp(fe.source,xe||He.includes("i")?He:`${He}i`)}return new RegExp(String(fe),xe?"":"i")}catch(He){return Z(`regex:${String(fe)}`,`filter operator "matches" received an invalid pattern: ${String(fe)}`,He),null}}function b(fe,xe){if(fe&&fe.type==="datetime"&&O.has(fe.op))return I(fe,xe);const He=L(fe,xe),Be=fe&&fe.type;return Be!=="date"&&Be!=="dateString"?He:ae=>He(typeof ae=="string"&&r.test(ae)?ae:X(ae)??ae)}const O=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn"]),y=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3})\d*)?)?)?$/,M=new Map;function D(fe,xe){let He=M.get(xe);if(He===void 0){try{He=new Intl.DateTimeFormat("en-CA",{timeZone:xe,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{He=null}M.set(xe,He)}if(!He)return null;const Be={};for(const ae of He.formatToParts(fe))ae.type!=="literal"&&(Be[ae.type]=ae.value);return Be}function _(fe,xe){if(fe==null||fe==="")return null;if(typeof fe=="string"){const Ae=y.exec(fe.trim());if(Ae)return Date.UTC(+Ae[1],+Ae[2]-1,+Ae[3],+(Ae[4]||0),+(Ae[5]||0),+(Ae[6]||0),+(Ae[7]||"0").padEnd(3,"0"))}const He=F(fe);if(!He)return null;const Be=He.getUTCMilliseconds(),ae=xe?D(He,xe):null;return ae?Date.UTC(+ae.year,+ae.month-1,+ae.day,ae.hour==="24"?0:+ae.hour,+ae.minute,+ae.second,Be):Date.UTC(He.getFullYear(),He.getMonth(),He.getDate(),He.getHours(),He.getMinutes(),He.getSeconds(),Be)}function I(fe,xe){const He=typeof fe.timeZone=="string"&&fe.timeZone?fe.timeZone:void 0,Be=Me=>_(Me,He),ae=Array.isArray(fe.value)?fe.value.map(Be):Be(fe.value),Ae=L({...fe,type:"number",value:ae},xe);return Me=>Ae(_(Me))}function L(fe,xe){const He=fe&&fe.op,Be=!!(fe&&fe.caseSensitive),ae=fe&&fe.type,Ae=f(xe),Me=Re=>pe=>!Re(pe);switch(He){case"eq":{const Re=o(fe.value,ae);return pe=>d(pe,Re,Be)}case"ne":{const Re=o(fe.value,ae);return pe=>!d(pe,Re,Be)}case"lt":case"lte":case"gt":case"gte":{const Re=o(fe.value,ae);if(u(Re))return()=>!1;const pe=He==="lt"?-1:He==="lte"?0:He==="gt"?1:2;return $e=>{if(u($e))return!1;const ce=Ae($e,Re);return pe===-1?ce<0:pe===0?ce<=0:pe===1?ce>0:ce>=0}}case"between":case"notBetween":{const Re=z(fe.value),pe=o(Re[0],ae),$e=o(Re[1],ae),ce=fe.bounds||"[]",ge=ce.charAt(0)!=="(",je=ce.charAt(1)!==")";if(u(pe)||u($e))return He==="between"?()=>!1:()=>!0;const Ve=Se=>{if(u(Se))return!1;const Ge=Ae(Se,pe),Ce=Ae(Se,$e);return(ge?Ge>=0:Ge>0)&&(je?Ce<=0:Ce<0)};return He==="between"?Ve:Me(Ve)}case"in":case"notIn":{const Re=k(fe.value,Be,ae),pe=$e=>Re.has(g($e,Be));return He==="in"?pe:Me(pe)}case"contains":case"notContains":{const Re=v(o(fe.value,ae),Be),pe=$e=>$e==null?!1:v($e,Be).includes(Re);return He==="contains"?pe:Me(pe)}case"startsWith":{const Re=v(o(fe.value,ae),Be);return pe=>pe==null?!1:v(pe,Be).startsWith(Re)}case"endsWith":{const Re=v(o(fe.value,ae),Be);return pe=>pe==null?!1:v(pe,Be).endsWith(Re)}case"matches":{const Re=p(fe.value,Be);return Re?pe=>pe==null?!1:Re.test(String(pe)):()=>!1}case"blank":return Re=>C(Re)||Array.isArray(Re)&&Re.length===0;case"notBlank":return Re=>!(C(Re)||Array.isArray(Re)&&Re.length===0);case"containsAny":case"containsNone":{const Re=k(fe.value,Be,ae),pe=$e=>{const ce=$e==null?[]:z($e);for(let ge=0;ge<ce.length;ge++)if(Re.has(g(ce[ge],Be)))return!0;return!1};return He==="containsAny"?pe:Me(pe)}case"containsAll":{const Re=z(fe.value).map(pe=>g(o(pe,ae),Be));return pe=>{const $e=pe==null?[]:z(pe);if(Re.length===0)return!0;const ce=new Set($e.map(ge=>g(ge,Be)));for(let ge=0;ge<Re.length;ge++)if(!ce.has(Re[ge]))return!1;return!0}}default:{const Re=ve(He);return Re?Re.compile(fe.value):(Z(`op:${String(He)}`,`unknown filter operator "${String(He)}"; the condition is refused rather than matching every row`),()=>!1)}}}function $(fe,xe,He){return b(xe,He)(fe)}const P=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),N=new Set(["containsAny","containsAll","containsNone"]);function T(fe,xe,He){const Be=fe&&fe.op,ae=P[Be]||Be,Ae=b({...fe,op:ae,type:xe.type},He),Me=xe.items,Re=pe=>{const $e=Me(pe);if(!$e)return!1;for(let ce=0;ce<$e.length;ce++)if(Ae($e[ce]))return!0;return!1};return P[Be]?pe=>!Re(pe):Re}function E(fe,xe,He,Be){const ae=c(fe);if(ae){const Re=xe?1:0;for(let pe=0;pe<Be;pe++)He[pe]=ae(pe)===Re?1:0;return He}const Ae=fe.kind;if(Ae==="float64"||Ae==="int32"||Ae==="bitset")return n(He,Be,xe?1:0);const Me=l(fe);for(let Re=0;Re<Be;Re++){const pe=Me(Re),$e=C(pe)||Array.isArray(pe)&&pe.length===0;He[Re]=$e===xe?0:1}return He}function A(fe,xe,He,Be){const ae=fe.dict,Ae=w(ae),Me=new Uint8Array(Ae);for(let ce=0;ce<Ae;ce++)Me[ce]=xe(m(ae,ce))?1:0;const Re=fe.values,pe=c(fe);if(!pe){for(let ce=0;ce<Be;ce++)He[ce]=Me[Re[ce]];return He}const $e=xe(null)?1:0;for(let ce=0;ce<Be;ce++)He[ce]=pe(ce)===1?Me[Re[ce]]:$e;return He}function S(fe,xe,He,Be){const ae=j(fe.values),Ae=xe(!0)?1:0,Me=xe(!1)?1:0,Re=c(fe);if(!Re){for(let $e=0;$e<Be;$e++)He[$e]=ae($e)===1?Ae:Me;return He}const pe=xe(null)?1:0;for(let $e=0;$e<Be;$e++)He[$e]=Re($e)===0?pe:ae($e)===1?Ae:Me;return He}function x(fe,xe,He,Be,ae){const Ae=fe.values,Me=xe.type,Re=xe.op;let pe=!0;switch(Re){case"eq":case"ne":{const ce=h(o(xe.value,Me)),ge=typeof xe.value=="number"&&Number.isNaN(xe.value),je=Re==="ne"?1:0;if(ge)for(let Ve=0;Ve<ae;Ve++)Be[Ve]=(Number.isNaN(Ae[Ve])?1:0)^je;else for(let Ve=0;Ve<ae;Ve++)Be[Ve]=(Ae[Ve]===ce?1:0)^je;break}case"lt":{const ce=h(o(xe.value,Me));for(let ge=0;ge<ae;ge++)Be[ge]=Ae[ge]<ce?1:0;break}case"lte":{const ce=h(o(xe.value,Me));for(let ge=0;ge<ae;ge++)Be[ge]=Ae[ge]<=ce?1:0;break}case"gt":{const ce=h(o(xe.value,Me));for(let ge=0;ge<ae;ge++)Be[ge]=Ae[ge]>ce?1:0;break}case"gte":{const ce=h(o(xe.value,Me));for(let ge=0;ge<ae;ge++)Be[ge]=Ae[ge]>=ce?1:0;break}case"between":case"notBetween":{const ce=z(xe.value),ge=h(o(ce[0],Me)),je=h(o(ce[1],Me)),Ve=xe.bounds||"[]",Se=Ve.charAt(0)!=="(",Ge=Ve.charAt(1)!==")",Ce=Re==="notBetween"?1:0;if(Se&&Ge)for(let Te=0;Te<ae;Te++)Be[Te]=(Ae[Te]>=ge&Ae[Te]<=je?1:0)^Ce;else if(Se)for(let Te=0;Te<ae;Te++)Be[Te]=(Ae[Te]>=ge&Ae[Te]<je?1:0)^Ce;else if(Ge)for(let Te=0;Te<ae;Te++)Be[Te]=(Ae[Te]>ge&Ae[Te]<=je?1:0)^Ce;else for(let Te=0;Te<ae;Te++)Be[Te]=(Ae[Te]>ge&Ae[Te]<je?1:0)^Ce;break}case"in":case"notIn":{const ce=new Set;for(const je of z(xe.value)){const Ve=h(o(je,Me));Number.isNaN(Ve)||ce.add(Ve)}const ge=Re==="notIn"?1:0;for(let je=0;je<ae;je++)Be[je]=(ce.has(Ae[je])?1:0)^ge;break}default:pe=!1;break}if(!pe)return!1;const $e=c(fe);if($e){const ce=He(null)?1:0;for(let ge=0;ge<ae;ge++)$e(ge)===0&&(Be[ge]=ce)}return!0}function W(fe,xe,He,Be){const ae=l(fe);for(let Ae=0;Ae<Be;Ae++)He[Ae]=xe(ae(Ae))?1:0;return He}function V(fe,xe,He){const Be=xe.count|0,ae=He||i(xe,Be);if(!fe)return n(ae,Be,1);const Ae=typeof xe.handle=="function"?xe.handle(fe.col):void 0,Me=typeof xe.custom=="function"?xe.custom:null;if(!Ae){if(Me){for(let ce=0;ce<Be;ce++)ae[ce]=Me(fe,ce)?1:0;return ae}return Z(`filter:col:${String(fe.col)}`,`filter references unknown column "${String(fe.col)}"; the condition is refused rather than matching every row`),n(ae,Be,0)}const Re=fe.op;if(Re==="blank"||Re==="notBlank")return E(Ae,Re==="notBlank",ae,Be);const pe=typeof xe.itemwise=="function"?xe.itemwise(fe.col):null;if(pe&&!ve(Re)&&!N.has(Re))return W(Ae,T(fe,pe,xe.locale),ae,Be);const $e=b(fe,xe.locale);switch(Ae.kind){case"dictionary":return A(Ae,$e,ae,Be);case"bitset":return S(Ae,$e,ae,Be);case"float64":case"int32":return x(Ae,fe,$e,ae,Be)?ae:W(Ae,$e,ae,Be);default:return W(Ae,$e,ae,Be)}}function G(fe,xe,He){if(!fe)return n(i(xe,He),He,1);if(Array.isArray(fe.conditions)){const Be=fe.conditions.filter(Me=>Me!=null),ae=fe.op==="or"?"or":fe.op==="not"?"not":"and";if(Be.length===0)return n(i(xe,He),He,1);const Ae=G(Be[0],xe,He);for(let Me=1;Me<Be.length;Me++){const Re=G(Be[Me],xe,He);if(ae==="or")for(let pe=0;pe<He;pe++)Ae[pe]|=Re[pe];else for(let pe=0;pe<He;pe++)Ae[pe]&=Re[pe];s(xe,Re)}if(ae==="not")for(let Me=0;Me<He;Me++)Ae[Me]^=1;return Ae}return V(fe,xe,i(xe,He))}function Q(fe,xe){return G(fe,xe,xe.count|0)}function ee(fe,xe){if(!fe||!xe)return fe||null;const He=fe;if(Array.isArray(He.conditions)){if((He.op==="or"?"or":He.op==="not"?"not":"and")!=="and")return ne(He,xe)?null:fe;const ae=[];for(const Ae of He.conditions){const Me=ee(Ae,xe);Me&&ae.push(Me)}return ae.length?{...He,op:"and",conditions:ae}:null}return He.col===xe?null:fe}function ne(fe,xe){if(!fe||typeof fe!="object")return!1;const He=fe;if(He.col===xe)return!0;if(Array.isArray(He.conditions)){for(const Be of He.conditions)if(ne(Be,xe))return!0}return!1}function se(fe,xe,He){if(He&&He.length>=xe){let Me=0;for(let Re=0;Re<xe;Re++)fe[Re]&&(He[Me++]=Re);return He.subarray(0,Me)}let Be=0;for(let Me=0;Me<xe;Me++)Be+=fe[Me]?1:0;const ae=new Uint32Array(Be);let Ae=0;for(let Me=0;Me<xe;Me++)fe[Me]&&(ae[Ae++]=Me);return ae}const le=new Map;function me(fe){if(!(!fe||typeof fe!="object"))for(const[xe,He]of Object.entries(fe))He&&typeof He.compile=="function"&&le.set(xe,He)}function ve(fe){return typeof fe=="string"?le.get(fe):void 0}}),Ue("packages/core/src/columns/datatypes.js",function(e,U){"use strict";Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"parseNumberText",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"BUILTIN_TYPES",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return T}});const te=U("packages/core/src/internal/compare.js"),C=te.collator,q=te.defaultCompare,z=U("packages/core/src/internal/predicates.js"),B=z.isNil,Z=z.isObject,K=z.isFunction,X=U("packages/core/src/internal/warn.js").fail,j=U("packages/core/src/internal/text.js").titleCase,w=U("packages/core/src/format/date.js"),m=w.toDate,c=w.toIsoDate,f=w.compareIso,r=U("packages/core/src/format/boolean.js").toTriState,i=U("packages/core/src/columns/types/index.js").EXTENDED_TYPES,s=U("packages/core/src/formula/index.js"),n=s.evaluateFormula,u=s.looksLikeFormula,a=U("packages/core/src/compute/filter.js").declareOperators,h=/^\d{4}-\d{2}-\d{2}$/;function v(E){return E.getHours()===0&&E.getMinutes()===0&&E.getSeconds()===0&&E.getMilliseconds()===0}const g=new Map;function k(E){const A=E||"",S=g.get(A);if(S)return S;const x={group:",",decimal:"."};try{for(const W of new Intl.NumberFormat(E||void 0).formatToParts(12345.6))W.type==="group"?x.group=W.value:W.type==="decimal"&&(x.decimal=W.value)}catch{}return g.set(A,x),x}const d=/\d\s*[*/^]\s*[\d.(]/;function p(E,A){if(B(E))return null;let S=String(E).trim();if(S===""||S.startsWith("=")||d.test(S))return null;let x=1;S.startsWith("(")&&S.endsWith(")")&&(x=-1,S=S.slice(1,-1));const W=S.endsWith("%"),{group:V,decimal:G}=k(A);if(S=S.replace(/[\s\u00a0\u202f\u2009']/g,""),V&&V!=="."&&V!==","&&(S=S.split(V).join("")),S=S.replace(/[^0-9eE+\-.,]/g,""),G===","?S=S.split(".").join("").replace(",","."):S=S.split(",").join(""),S===""||S==="-"||S==="+")return null;const Q=Number(S);return Number.isNaN(Q)?null:x*(W?Q/100:Q)}function b(E,A){const S=B(E)||Number.isNaN(E)?null:Number(E),x=B(A)||Number.isNaN(A)?null:Number(A);return S===null?x===null?0:1:x===null||S<x?-1:S>x?1:0}function O(E,A){const S=r(E),x=r(A);return S===null?x===null?0:1:x===null?-1:S===x?0:S?1:-1}function y(E,A){const S=m(E),x=m(A);if(!S)return x?1:0;if(!x)return-1;const W=S.getTime(),V=x.getTime();return W<V?-1:W>V?1:0}const M=new Map;function D(E){const A=m(E.value);if(!A)return"";const S=E.locale||"";let x=M.get(S);return x||(x=new Intl.DateTimeFormat(E.locale||void 0,{dateStyle:"medium"}),M.set(S,x)),x.format(A)}const _={boolean:{base:"boolean",storage:"bitset",matches:E=>typeof E=="boolean",parse:E=>r(E.text),compare:O,format:E=>r(E.value)===null?"":r(E.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:E=>r(E)===null?"":String(r(E)),fromClipboard:E=>r(E)},number:{base:"number",storage:"float64",matches:E=>typeof E=="number"&&!Number.isNaN(E),parse:E=>{if(u(E.text)){const A=n(E.text,E);if(!A.ok)return null;const S=Number(A.value);return Number.isFinite(S)?S:null}return p(E.text,E.locale)},compare:b,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:E=>B(E)?"":String(E),fromClipboard:(E,A)=>p(E,A&&A.locale)},date:{base:"dateString",storage:"dictionary",matches:E=>typeof E=="string"&&h.test(E)&&!Number.isNaN(Date.parse(E))||E instanceof Date&&!Number.isNaN(E.getTime())&&v(E),parse:E=>c(E.text),compare:f,format:D,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:E=>c(E),toClipboard:E=>B(E)?"":String(E),fromClipboard:E=>c(E)},dateString:{base:"dateString",storage:"dictionary",matches:E=>typeof E=="string"&&h.test(E)&&!Number.isNaN(Date.parse(E)),parse:E=>c(E.text),compare:f,format:D,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:E=>c(E),toClipboard:E=>B(E)?"":String(E),fromClipboard:E=>c(E)},text:{base:"text",storage:"dictionary",matches:E=>typeof E=="string",parse:E=>E.text===""?null:String(E.text),compare:(E,A)=>B(E)?B(A)?0:1:B(A)?-1:C().compare(String(E),String(A)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:E=>B(E)?"":String(E),fromClipboard:E=>E},image:{base:"text",storage:"dictionary",parse:E=>E.text===""||E.text==null?null:String(E.text).trim(),compare:(E,A)=>B(E)?B(A)?0:1:B(A)?-1:C().compare(String(E),String(A)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:E=>B(E)?"":String(E),fromClipboard:E=>E},lookup:{base:"text",storage:"dictionary",parse:E=>{if(E.text===""||E.text==null)return null;const A=E.column&&E.column.lookup,S=A&&K(A.options)?A.options():null;if(!S)return E.text;const x=String(E.text),W=S.find(Q=>String(Q.id)===x);if(W)return W.id;const V=x.trim().toLowerCase(),G=S.find(Q=>String(Q.label).toLowerCase()===V);return G?G.id:E.text},compare:q,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:E=>B(E)?"":String(E),fromClipboard:E=>E},object:{base:"object",storage:"object",matches:E=>E!==null&&typeof E=="object"&&!(E instanceof Date),parse:E=>{try{return E.text===""?null:JSON.parse(E.text)}catch{return E.text}},compare:(E,A)=>q(E,A),format:E=>{const A=E.value;if(B(A))return"";if(typeof A=="string")return A;try{return JSON.stringify(A)}catch{return String(A)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:E=>B(E)?"":typeof E=="string"?E:JSON.stringify(E),fromClipboard:E=>E}},I=["boolean","number","date","dateString","datetime","text","object"];function L(E,A,S,x){const W=S.get(E);if(W)return W;x.includes(E)&&X(`circular data type extends chain: ${[...x,E].join(" → ")}`);const V=A[E];V||X(`unknown data type "${E}"`);let G=null;V.extends&&(G=L(V.extends,A,S,[...x,E]));const Q={...G||{},...V,name:E,defaults:{...G&&G.defaults||{},...V.defaults||{}}};return Q.base||(Q.base=G&&G.base||"text"),Q.storage||(Q.storage=G&&G.storage||"object"),S.set(E,Q),Q}function $(E,A){const S={..._,...i};if(A&&typeof A.dataType=="function"&&typeof A.names=="function")for(const W of A.names("dataType")){const V=A.dataType(W);V&&(S[W]=V)}if(Z(E))for(const[W,V]of Object.entries(E))S[W]=V;const x=new Map;for(const W of I)L(W,S,x,[]);L("lookup",S,x,[]);for(const W of Object.keys(S))L(W,S,x,[]);for(const W of x.values())a(W.operators);return x}function P(E,A){if(E.base==="text"&&(!E.compare||E.compare===_.text.compare)){const S=C(A);return(x,W)=>B(x)?B(W)?0:1:B(W)?-1:S.compare(String(x),String(W))}return E.compare||q}function N(E,A){return A?E.multiStorage||"multi":E.storage||"object"}function T(E){return j(String(E).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),Ue("packages/core/src/columns/infer.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_SAMPLE",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"inferFromValues",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return K}});const C=U("packages/core/src/internal/warn.js").infoOnce,z=U("packages/core/src/internal/predicates.js").isNil,B=100;function Z(F,X,H={}){const j=H.sampleSize??B,w=[];for(let m=0;m<F.length&&w.length<j;m++){const c=F[m];z(c)||typeof c=="number"&&Number.isNaN(c)||w.push(c)}if(w.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[m,c]of X){if(typeof c.matches!="function")continue;let f=!0;for(let l=0;l<w.length;l++)if(!c.matches(w[l])){f=!1;break}if(f)return{type:m,unanimous:!0,sampled:w.length}}return H.quiet||C(`infer:${H.colId||"?"}`,`column "${H.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:w.length}}function K(F,X,H,j,w={}){const m=w.sampleSize??B,c=[];for(let f=0;f<X.length&&c.length<m;f++){const l=H(X[f]);z(l)||typeof l=="number"&&Number.isNaN(l)||c.push(l)}return Z(c,j,{...w,colId:F}).type}}),Ue("packages/core/src/columns/graph.js",function(e,U){"use strict";Object.defineProperty(e,"WHOLE_ROW",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"declarationOf",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return j}});const te=U("packages/core/src/internal/warn.js"),C=te.DEV,q=te.fail,z=te.warnOnce,Z=U("packages/core/src/internal/predicates.js").isFunction,K="*";function F(w){const m=w.value||{};if(!Z(m.compute))return{computed:!1,wholeRow:!1,deps:[],pure:!0};const f=m.pure!==!1;return m.deps===K?{computed:!0,wholeRow:!0,deps:[],pure:f}:Array.isArray(m.deps)?{computed:!0,wholeRow:!1,deps:m.deps.slice(),pure:f}:(z(`deps:missing:${w.id}`,`computed column "${w.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:f})}function X(w){const m=new Map;for(const h of w)m.set(h.id,h);const c=new Map,f=new Map,l=new Set,r=new Set,t=new Set,i=new Set;for(const h of w){const v=F(h);if(!v.computed){c.set(h.id,[]);continue}r.add(h.id),(v.pure?t:i).add(h.id),v.wholeRow&&l.add(h.id);const g=[],k=[];for(const d of v.deps)(m.has(d)?g:k).push(d);c.set(h.id,g),k.length&&f.set(h.id,k)}for(const h of t)for(const v of c.get(h))i.has(v)&&q(`pure computed column "${h}" depends on impure column "${v}". Mark it \`value.pure: false\` or make the dependency pure.`);const s=[],n=new Map,u=[],o=h=>{const v=n.get(h);if(v!=="done"){if(v==="open"){const g=u.indexOf(h);q(`circular column dependency: ${[...u.slice(g),h].join(" → ")}`)}n.set(h,"open"),u.push(h);for(const g of c.get(h)||[])m.has(g)&&o(g);u.pop(),n.set(h,"done"),s.push(h)}};for(const h of w)o(h.id);const a=new Map;for(const h of w)a.set(h.id,[]);for(const h of w)for(const v of c.get(h.id)||[]){const g=a.get(v);g&&!g.includes(h.id)&&g.push(h.id)}if(l.size)for(const h of w){if(r.has(h.id))continue;const v=a.get(h.id);for(const g of l)v.includes(g)||v.push(g)}return{order:s,dependents:a,pure:t,impure:i,computed:r,deps:c,wholeRow:l,external:f,index:m}}function H(w,m){const c=Array.isArray(m)?m:[m],f=new Set,l=[...c];for(;l.length;){const r=l.shift();for(const t of w.dependents.get(r)||[])f.has(t)||(f.add(t),l.push(t))}for(const r of c)f.delete(r);return w.order.filter(r=>f.has(r))}function j(w,m,c){if(!C)return w;const f=m instanceof Set?m:new Set(m);return new Proxy(w,{get(l,r){return typeof r=="string"&&!f.has(r)&&!Object.hasOwn(l,r)&&z(`undeclared:${c}:${r}`,`computed column "${c}" read undeclared dependency "${r}". Add it to \`value.deps\` or the value will go stale.`),l[r]}})}}),Ue("packages/core/src/model/rowkey.js",function(e,U){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"compositeKey",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createRowKey",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"warnMissingKeys",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"groupPathKey",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"splitPathKey",{enumerable:!0,get:function(){return r}});const C=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/internal/paths.js").pathGetter,B=U("packages/core/src/internal/predicates.js"),Z=B.isFunction,K=B.isBlank,F=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],X="";function H(t){if(t===null)return"\0n";if(t===void 0)return"\0u";const i=typeof t;if(i==="string")return t;if(i==="number"||i==="bigint"||i==="boolean")return String(t);if(t instanceof Date)return`\0d${t.getTime()}`;try{return`\0o${JSON.stringify(t)}`}catch{return"\0o?"}}function j(t){if(t.length===1)return H(t[0]);let i="";for(let s=0;s<t.length;s++)s&&(i+=X),i+=H(t[s]);return i}function w(t,i={}){const s=i.warn!==!1;if(Z(t)){const n=t;return{stable:!0,fields:[],disabled:[],key(u,o){try{const a=n(u);return Array.isArray(a)?j(a):H(a)}catch(a){return C("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",a),`#${o??-1}`}},keyEmpty(u){try{const o=n(u);return Array.isArray(o)?o.length===0||o.some(K):K(o)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(t)&&t.length>0){const n=t.filter(a=>typeof a=="string"),u=n.map(a=>z(a)),o=u.length;return{stable:!0,fields:n,disabled:[],key(a){const h=new Array(o);for(let v=0;v<o;v++)h[v]=u[v](a);return j(h)},keyEmpty(a){for(let h=0;h<o;h++)if(K(u[h](a)))return!0;return!1},missingFields(a){const h=[];for(let v=0;v<o;v++)K(u[v](a))&&h.push(n[v]);return h}}}if(typeof t=="string"&&t.length>0){const n=z(t);return{stable:!0,fields:[t],disabled:[],key(u){return H(n(u))},keyEmpty(u){return K(n(u))},missingFields(u){return K(n(u))?[t]:[]}}}return s&&C("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${F.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:F.slice(),key(n,u){if(n===null||typeof n!="object")return`#${u??0}:${String(n)}`;let o=m.get(n);return o===void 0&&(o=`#${c++}`,m.set(n,o)),o}}}const m=new WeakMap;let c=0;function f(t,i){if(!t||t.stable===!1||!Z(t.keyEmpty)||!Array.isArray(i)||i.length===0)return;let s=0,n=null,u;for(let v=0;v<i.length;v++){const g=i[v];t.keyEmpty(g)&&(s++,n===null&&(n=Z(t.missingFields)?t.missingFields(g):[],u=g))}if(s===0)return;const o=t.fields.length?t.fields.join(","):"(function)",a=n&&n.length?n.join(", "):t.fields.length?t.fields.join(", "):"the rowKey function",h=u!==null&&typeof u=="object"?Object.keys(u).join(", ")||"(no fields)":String(u);C(`rowKey.emptyValue:${o}`,`rowKey ${a} is missing on ${s} of ${i.length} rows; the first such row has: ${h}. 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 l(t){return j(t)}function r(t){return t.split(X)}}),Ue("packages/core/src/columns/lookup.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_SEPARATOR",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"normaliseOption",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"Lookup",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toValueArray",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"createLookup",{enumerable:!0,get:function(){return t}});const te=U("packages/core/src/internal/compare.js"),C=te.collator,q=te.defaultCompare,z=U("packages/core/src/internal/predicates.js"),B=z.isFunction,Z=z.isNil,F=U("packages/core/src/internal/warn.js").warnOnce,H=U("packages/core/src/model/rowkey.js").compositeKey,j=", ",w="";function m(i,s,n,u){if(i===null||typeof i!="object")return{id:i,label:i==null?"":String(i)};const o=i[s],a=i[n],h={id:o,label:a==null?String(o??""):String(a)};i.disabled&&(h.disabled=!0),i.variant&&(h.variant=i.variant),i.icon&&(h.icon=i.icon);const v=u?i[u]:i.group;return v!==void 0&&(h.group=v),h}function c(i,s,n=0,u=[],o=[]){for(const a of i||[]){const h=a&&typeof a=="object"?a[s]:null;if(o.push({raw:a,depth:n,path:u}),Array.isArray(h)&&h.length){const v=String(a&&typeof a=="object"?a.label??a.name??a.id??"":a);c(h,s,n+1,[...u,v],o)}}return o}function f(i){return!!i&&typeof i=="object"&&!Array.isArray(i)&&B(i.router&&i.router.subscribe)}class l{#e;#t;#n;#r;#s=[];#i=new Map;#o=new Map;#l=0;#a="idle";#c=null;#u;#d=null;#f=new Map;constructor(s,n={}){this.#e=s||{},this.#t=n.colId||"?",this.#n=n.locale,this.#r=n.onChange||null,this.#u=C(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??j}get allowCustom(){return this.#e.allowCustom===!0}get sortBy(){return this.#e.sortBy||"label"}get spec(){return this.#e}options(){return this.#s}setLocale(s){this.#n=s,this.#u=C(s)}#h(s){const n=this.#e,u=n.valueKey||"id",o=n.labelKey||"label",a=n.childrenKey||"children";this.#s=c(s,a).map(h=>{const v=m(h.raw,u,o,n.groupKey);return h.depth&&(v.depth=h.depth,v.path=h.path),v}),this.#i=new Map,this.#o=new Map,this.#s.forEach((h,v)=>{this.#i.set(h.id,h),this.#o.set(h.id,v)}),this.#a="ready",this.#l+=1}load(){if(this.#c)return this.#c;const s=this.#e.options;if(Array.isArray(s)||s===void 0)return this.#c=Promise.resolve(this.#s),this.#c;if(f(s))return this.#c=this.#p(s),this.#c;if(!B(s))return F(`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=s()}catch(u){return this.#a="error",F(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,u),this.#c=Promise.resolve([]),this.#c}return!n||!B(n.then)?(this.#h(n),this.#c=Promise.resolve(this.#s),this.#r&&this.#r(this),this.#c):(this.#c=n.then(u=>(this.#h(u),this.#r&&this.#r(this),this.#s),u=>(this.#a="error",F(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,u),[])),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.#s)):this.load()}#p(s){if(this.#d)return Promise.resolve(this.#s);const n=this.#e,u=n.valueKey||"id",o=n.labelKey||"label",a=n.groupKey,h=B(s.map)?s.map:null,v=k=>m(h?h(k):k,u,o,a).id,g=k=>this.#m(k,h,u,o,a);return s.router.subscribe(s.predicate,g,{rowKey:v}),this.#d=()=>{B(s.router.detach)&&s.router.detach(g)},this.#a="ready",Promise.resolve(this.#s)}#m(s,n,u,o,a){const h=s&&s.add||[],v=s&&s.update||[],g=s&&s.remove||[];if(!(!h.length&&!v.length&&!g.length)){for(const k of h)this.#g(k,n,u,o,a);for(const k of v)this.#g(k,n,u,o,a);for(const k of g){if(!this.#f.has(k))continue;const d=this.#f.get(k);this.#f.delete(k),this.#i.delete(d);const p=this.#s.findIndex(b=>b.id===d);p>=0&&this.#s.splice(p,1)}this.#o=new Map(this.#s.map((k,d)=>[k.id,d])),this.#a="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(s,n,u,o,a){const h=m(n?n(s):s,u,o,a);this.#f.set(H([h.id]),h.id);const v=this.#s.findIndex(g=>g.id===h.id);v>=0?this.#s[v]=h:this.#s.push(h),this.#i.set(h.id,h)}destroy(){this.#d&&(this.#d(),this.#d=null)}search(s,n){const u=this.#e;if(!B(u.search)){const h=String(s||"").toLowerCase();return Promise.resolve(h===""?this.#s:this.#s.filter(v=>v.label.toLowerCase().includes(h)))}const o=u.valueKey||"id",a=u.labelKey||"label";return Promise.resolve(u.search(s,n)).then(h=>(h||[]).map(v=>m(v,o,a,u.groupKey)))}option(s){return this.#i.get(s)}has(s){return this.#i.has(s)}label(s){if(Z(s)||s==="")return"";const n=this.#i.get(s);if(n)return n.label;if(this.#a==="loading"||this.#a==="idle")return"";this.allowCustom||F(`lookup:unknown:${this.#t}`,`column "${this.#t}" holds value ${JSON.stringify(s)} which is not in its lookup options. Showing the raw value; set \`lookup.unknownLabel\` or \`lookup.allowCustom\` to change that.`);const u=this.#e.unknownLabel;return B(u)?String(u(s)??""):typeof u=="string"?u:String(s)}text(s){if(this.multiple){const n=r(s);return n.length===0?"":n.map(u=>this.label(u)).join(this.separator)}return this.label(s)}dictionary(){return this.#s.map(s=>s.id)}sorted(){const s=this.sortBy;if(s==="optionOrder"||s==="count")return this.#s.slice();if(s==="value")return this.#s.slice().sort((u,o)=>q(u.id,o.id));const n=this.#u;return this.#s.slice().sort((u,o)=>n.compare(u.label,o.label))}comparator(){const s=this.sortBy,n=this.multiple,u=this.#u,o=this.#o;if(n&&s==="count")return(h,v)=>r(h).length-r(v).length;const a=n?h=>r(h)[0]:h=>h;return s==="value"?(h,v)=>q(a(h),a(v)):s==="optionOrder"?(h,v)=>{const g=o.has(a(h))?o.get(a(h)):Number.MAX_SAFE_INTEGER,k=o.has(a(v))?o.get(a(v)):Number.MAX_SAFE_INTEGER;return g-k}:(h,v)=>{const g=a(h),k=a(v);return Z(g)?Z(k)?0:1:Z(k)?-1:u.compare(this.label(g),this.label(k))}}groupKey(s){return this.multiple?r(s).map(u=>String(u)).sort().join(w):Z(s)?"":String(s)}countValues(s){return this.multiple?r(s).length:Z(s)?0:1}contains(s,n,u){const o=this.multiple?r(s):Z(s)?[]:[s],a=Array.isArray(n)?n:[n];switch(u){case"containsAll":return a.every(h=>o.includes(h));case"containsNone":return!a.some(h=>o.includes(h));default:return a.some(h=>o.includes(h))}}exportText(s,n="label"){return n==="value"?this.multiple?r(s).join(this.separator):Z(s)?"":String(s):this.text(s)}exportColumns(){const s=this.multiple;return this.#s.map(n=>({id:n.id,label:n.label,has:u=>s?r(u).includes(n.id):u===n.id}))}}function r(i){return Array.isArray(i)?i:Z(i)||i===""?[]:[i]}function t(i,s={}){const n=i.lookup;if(!n)return null;const u=new l(n,{colId:i.id,locale:s.locale,onChange:s.onChange});return!Array.isArray(n.options)&&n.options!==void 0&&u.load(),u}}),Ue("packages/core/src/columns/value.js",function(e,U){"use strict";Object.defineProperty(e,"compileDisplay",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"warnImpureUse",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ValuePipeline",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return l}});const C=U("packages/core/src/internal/paths.js").getPath,q=U("packages/core/src/internal/predicates.js"),z=q.isFunction,B=q.isNil,K=U("packages/core/src/internal/lru.js").Lru,X=U("packages/core/src/internal/warn.js").warnOnce,j=U("packages/core/src/columns/graph.js").depsProxy,w="\0";function m(s,n={}){const u=n.locale,o=n.grid??null,a=n.context,h=s.value&&s.value.format,v=s.formatter||null,g=s.dataType&&s.dataType.format,k=s.lookup||null,d=(p,b,O)=>({value:p,data:O,row:b,column:s,colId:s.id,grid:o,context:a,locale:u});if(z(h))return(p,b,O)=>{const y=h(d(p,b,O));return y==null?"":String(y)};if(v){if(k){const p=v.kind==="text";return(b,O,y)=>v(p?k.text(b):b,d(b,O,y))}return(p,b,O)=>v(p,d(p,b,O))}return z(g)?(p,b,O)=>{const y=g(d(p,b,O));return y==null?"":String(y)}:k?p=>k.text(p):p=>B(p)?"":typeof p=="string"?p:String(p)}function c(s,n){!s||!s.value||s.value.pure!==!1||X(`impure:${n}:${s.id}`,`column "${s.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${n}. The result is not stable across passes.`)}class f{#e;#t;#n;#r;#s;#i;#o=new K(4096);constructor(n){this.#e=n.columns instanceof Map?n.columns:new Map((n.columns||[]).map(u=>[u.id,u])),this.#t=n.graph,this.#n=n.grid??null,this.#r=n.context,this.#i=n.stored||null,this.#s=n.rowKey||l}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 u=n&&n.rows?new Set([...n.rows].map(String)):null,o=n&&n.columns?[...n.columns]:null;if(!u&&!o){this.#o.clear();return}const a=o?this.#l(o):null;for(const h of[...this.#o.keys()]){const v=String(h).split(w);v.length===3&&(u&&!u.has(v[0])||a&&!a.has(v[2])||this.#o.delete(h))}}#l(n){const u=new Set,o=this.#t,a=[...n];for(;a.length;){const h=a.pop();if(!u.has(h)){u.add(h);for(const v of o?o.dependents.get(h)||[]:[])a.push(v)}}return u}value(n,u,o){const a=typeof n=="string"?this.#e.get(n):n;if(!a)return;if(!a.computed)return this.#c(a,u,o);if(a.value.pure!==!1&&this.#i&&o&&o.physical!=null&&this.#i.has(a.id))return this.#i.get(a.id,o.physical);if(a.volatile)return this.compute(a,u,o);if(a.value.pure===!1)return this.compute(a,u,o);const h=`${this.#a(u,o)}${w}${a.id}`;if(this.#o.has(h))return this.#o.get(h);const v=this.compute(a,u,o);return this.#o.set(h,v),v}#a(n,u){return`${this.#s(n,u)}${w}${r(n)}`}#c(n,u,o){if(this.#i&&o&&o.physical!=null&&this.#i.has(n.id))return this.#i.get(n.id,o.physical);if(n.field)return n.read?n.read(u):C(u,n.field)}compute(n,u,o){const a=this.#t,h=a&&a.wholeRow.has(n.id);let v;if(h)v=u??{};else{v={};const k=a&&a.deps.get(n.id)||[];for(const p of k)v[p]=this.value(p,u,o);const d=a&&a.external.get(n.id)||[];for(const p of d)v[p]=C(u,p);v=j(v,[...k,...d],n.id)}const g={data:u,row:o,column:n,grid:this.#n,context:this.#r};return n.value.compute(v,g)}values(n,u){const o={},a=this.#t?this.#t.order:[...this.#e.keys()];for(const h of a)o[h]=this.value(h,n,u);return o}text(n,u,o){const a=typeof n=="string"?this.#e.get(n):n;return a?a.formatValue(this.value(a,u,o),o,u):""}key(n,u,o){const a=typeof n=="string"?this.#e.get(n):n;if(!a)return"";const h=this.value(a,u,o);return z(a.value.key)?String(a.value.key(this.#u(a,h,u,o))):a.lookup?a.lookup.groupKey(h):B(h)?"":String(h)}quickFilterText(n,u,o){const a=typeof n=="string"?this.#e.get(n):n;if(!a)return"";if(z(a.value.quickFilterText)){const h=this.value(a,u,o);return String(a.value.quickFilterText(this.#u(a,h,u,o))??"")}return this.text(a,u,o)}#u(n,u,o,a){return{value:u,data:o,row:a,column:n,colId:n.id,grid:this.#n,context:this.#r}}parse(n,u,o,a){const h=typeof n=="string"?this.#e.get(n):n;if(!h)return u;const v={text:u,value:this.value(h,o,a),data:o,row:a,column:h,grid:this.#n,context:this.#r,locale:this.#n&&z(this.#n.get)?this.#n.get("locale"):void 0,formulaFunctions:this.#n&&z(this.#n.get)?this.#n.get("formulaFunctions"):void 0};return z(h.value.parse)?h.value.parse(v):h.dataType&&z(h.dataType.parse)?h.dataType.parse(v):u}validate(n,u,o,a,h){const v=typeof n=="string"?this.#e.get(n):n;if(!v||!z(v.edit.validate))return!0;const g=v.edit.validate({value:u,oldValue:o,data:a,row:h,column:v,grid:this.#n,context:this.#r});return g===!0||g===void 0?!0:String(g)}apply(n,u,o,a){const h=typeof n=="string"?this.#e.get(n):n;if(!h)return!1;const v=this.value(h,o,a);if(z(h.value.apply)){const g=h.value.apply({value:u,oldValue:v,data:o,row:a,column:h,grid:this.#n,context:this.#r});return this.#d(h,o,a),g!==!1}return h.field?v===u?!1:(h.write(o,u),this.#d(h,o,a),!0):(X(`apply:${h.id}`,`column "${h.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(n,u,o,a){const h=typeof n=="string"?this.#e.get(n):n;if(!h)return{ok:!1,value:void 0,oldValue:void 0,changed:!1,error:"unknown column"};const v=this.value(h,o,a),g=this.parse(h,u,o,a),k=this.validate(h,g,v,o,a);if(k!==!0)return{ok:!1,value:g,oldValue:v,changed:!1,error:k};const d=this.apply(h,g,o,a);return{ok:!0,value:g,oldValue:v,changed:d}}#d(n,u,o){if(this.#o.size===0)return;const a=this.#a(u,o);this.#o.delete(`${a}${w}${n.id}`);for(const h of this.#t?this.#t.dependents.get(n.id)||[]:[])this.#o.delete(`${a}${w}${h}`)}}function l(s,n){return n&&n.key!=null?String(n.key):r(s)}function r(s){if(s&&typeof s=="object"){let n=t.get(s);return n===void 0&&(n=`#${i++}`,t.set(s,n)),n}return String(s)}const t=new WeakMap;let i=0}),Ue("packages/core/src/model/shadow.js",function(e,U){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"HISTORY_TICK_MAX_MS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"HISTORY_TICK_MIN_MS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"DEFAULT_ANOMALY_THRESHOLD",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"SPEC_STATUS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"POSITIONAL_KINDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"SHADOW_LABELS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"specStatusOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"ShadowTracker",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shadowsIn",{enumerable:!0,get:function(){return o}});const C=U("packages/core/src/internal/warn.js").warnOnce,q=2e5,z=20,B=1e3,Z=50;function K(a){return Math.min(B,Math.max(Z,Math.floor(a)))}const F=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"]),X=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),H=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),j=.6745,w=3.5,m=Object.freeze({PASS:"PASS",WARN:"WARN",FAIL:"FAIL"}),c=Object.freeze(["rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag"]),f=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"});function l(a,h){if(!h)return null;const v=Number.isFinite(Number(h.lower))?Number(h.lower):null,g=Number.isFinite(Number(h.upper))?Number(h.upper):null;if(v===null&&g===null||!Number.isFinite(a))return null;if(v!==null&&a<v||g!==null&&a>g)return m.FAIL;const k=Number.isFinite(Number(h.warnLower))?Number(h.warnLower):null,d=Number.isFinite(Number(h.warnUpper))?Number(h.warnUpper):null;return k!==null&&a<k||d!==null&&a>d?m.WARN:m.PASS}function r(a,h,v){if(!h||typeof h!="object")return null;if(h.kind!=="time")return h.kind!==void 0&&C(`shadow.history.window.kind:${a}`,`a 'history' shadow's 'window' only accepts {kind: 'time', span}; '${h.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 g=h.minutes!=null?Number(h.minutes)*6e4:Number(h.span);if(!(g>0))return C(`shadow.history.window.span:${a}`,"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 k=Math.max(2,Math.floor(v)||z);return{span:g,bucketMs:Math.max(1,Math.floor(g/k))}}class t{#e;#t=new Map;#n=new Map;#r=new Map;#s=new Map;#i=new Map;#o=new Map;#l=0;#a;#c;#u;#d;#f=new Map;#h=null;#p=null;#m=null;constructor(h){this.#e=h.colId,this.#a=Math.max(2,h.depth||z),this.#c=Math.max(1,h.max||q),this.#u=h.now||(()=>Date.now()),this.#d=r(this.#e,h.historyWindow,this.#a),this.#d&&(this.#h=Math.floor(this.#u()/this.#d.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#d}observe(h,v){const g=u(v);if(g===null)return;if(!this.#n.has(h)){this.#p=null,this.#m=null,this.#g(),this.#t.set(h,g),this.#n.set(h,g),this.#r.set(h,0),this.#s.set(h,this.#u()),this.#i.set(h,[g]),this.#d&&this.#f.set(h,[g]),this.#o.set(h,0);return}const k=this.#n.get(h);if(k===g)return;this.#p=null,this.#m=null,this.#n.set(h,g),this.#r.set(h,(this.#r.get(h)||0)+1),this.#s.set(h,this.#u());const d=this.#i.get(h)||[];d.push(g),d.length>this.#a&&d.splice(0,d.length-this.#a),this.#i.set(h,d);const p=Math.sign(g-k),b=this.#o.get(h)||0;this.#o.set(h,Math.sign(b)===p?b+p:p)}#g(){if(this.#n.size<this.#c)return;const h=this.#n.keys().next().value;h!==void 0&&(this.#t.delete(h),this.#n.delete(h),this.#r.delete(h),this.#s.delete(h),this.#i.delete(h),this.#f.delete(h),this.#o.delete(h),this.#l++)}rebase(){for(const[h,v]of this.#n)this.#t.set(h,v);this.#p=null,this.#m=null}reset(){this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#s.clear(),this.#i.clear(),this.#f.clear(),this.#o.clear(),this.#l=0,this.#p=null,this.#m=null,this.#d&&(this.#h=Math.floor(this.#u()/this.#d.bucketMs))}retain(h){const v=h instanceof Set?h:new Set(h);let g=0;for(const k of[...this.#n.keys()])v.has(k)||(this.#t.delete(k),this.#n.delete(k),this.#r.delete(k),this.#s.delete(k),this.#i.delete(k),this.#f.delete(k),this.#o.delete(k),g++);return g&&(this.#p=null,this.#m=null),g}advanceHistoryWindow(h=this.#u()){const v=this.#d;if(!v)return 0;const g=Math.floor(h/v.bucketMs),k=g-this.#h;if(!(k>0))return 0;const d=Math.min(k,this.#a);for(const[p,b]of this.#f){const O=this.#n.get(p);for(let y=0;y<d;y++)b.push(O);b.length>this.#a&&b.splice(0,b.length-this.#a)}return this.#h=g,k}read(h,v,g,k){switch(h){case"updates":return this.#r.has(v)?this.#r.get(v):0;case"updatedAt":{const d=this.#s.get(v);return d===void 0?null:new Date(d)}case"sinceUpdate":{const d=this.#s.get(v);return d===void 0?null:this.#u()-d}case"firstValue":return this.#t.has(v)?this.#t.get(v):null;case"delta":return this.#n.has(v)?this.#n.get(v)-this.#t.get(v):null;case"deltaPercent":{if(!this.#n.has(v))return null;const d=this.#t.get(v);return d?(this.#n.get(v)-d)/Math.abs(d)*100:null}case"rate":{const d=this.#i.get(v),p=this.#s.get(v);if(!d||d.length<2||p===void 0)return null;const b=this.#u()-p,O=d[d.length-1]-d[d.length-2];return b>0?O/b*1e3:O}case"history":return this.#d?this.#f.has(v)?[...this.#f.get(v)]:null:this.#i.has(v)?[...this.#i.get(v)]:null;case"streak":return this.#o.has(v)?this.#o.get(v):0;case"specStatus":return this.#n.has(v)?l(this.#n.get(v),k):null;default:return c.includes(h)?this.#A(h,v,g,k):null}}#b(h){if(h){if(this.#m&&this.#m.only===h)return this.#m.view;const v=this.#y(h);return this.#m={only:h,view:v},v}return this.#p?this.#p:(this.#p=this.#y(null),this.#p)}#y(h){const v=[];for(const[_,I]of this.#n)h&&!h.has(_)||v.push(I);const g=v.sort((_,I)=>_-I);let k=0,d=0,p=0,b=0;for(const _ of g){b+=_,k++;const I=_-d;d+=I/k,p+=I*(_-d)}const O=[];for(const[_,I]of this.#t)h&&!h.has(_)||O.push(I);const y=k?i(g):0,M=g.map(_=>Math.abs(_-y)).sort((_,I)=>_-I),D=k?i(M):0;return{sorted:g,baseline:O.sort((_,I)=>_-I),sum:b,mean:k?d:0,sd:k>1?Math.sqrt(p/(k-1)):0,median:y,mad:D}}#A(h,v,g,k){if(!this.#n.has(v)||g&&!g.has(v))return null;const d=this.#n.get(v),p=this.#b(g),b=p.sorted.length;if(!b)return null;switch(h){case"rank":return b-n(p.sorted,d)+1;case"rankAsc":return s(p.sorted,d)+1;case"rankChange":{if(!this.#t.has(v)||!p.baseline.length)return null;const O=p.baseline.length-n(p.baseline,this.#t.get(v))+1,y=b-n(p.sorted,d)+1;return O-y}case"percentile":return n(p.sorted,d)/b*100;case"quartile":{const O=n(p.sorted,d)/b;return Math.min(4,Math.max(1,Math.ceil(O*4)))}case"zScore":return p.sd?(d-p.mean)/p.sd:null;case"anomalyScore":return p.mad?j*(d-p.median)/p.mad:null;case"anomalyFlag":{if(!p.mad)return null;const O=k&&Number.isFinite(Number(k.threshold))?Number(k.threshold):w;return Math.abs(j*(d-p.median)/p.mad)>O}case"shareOfTotal":return p.sum?d/p.sum*100:null;default:return null}}}function i(a){const h=a.length;if(!h)return 0;const v=(h-1)*.5,g=Math.floor(v),k=Math.ceil(v);return g===k?a[g]:a[g]+(v-g)*(a[k]-a[g])}function s(a,h){let v=0,g=a.length;for(;v<g;){const k=v+g>>1;a[k]<h?v=k+1:g=k}return v}function n(a,h){let v=0,g=a.length;for(;v<g;){const k=v+g>>1;a[k]<=h?v=k+1:g=k}return v}function u(a){if(a==null||a==="")return null;if(a instanceof Date){const v=a.getTime();return Number.isFinite(v)?v:null}const h=typeof a=="number"?a:Number(a);return Number.isFinite(h)?h:null}function o(a){const h=[];for(const v of a||[]){const g=v.shadow;if(!g)continue;const k=typeof g=="string"?{kind:g}:g,d=k.kind;F.includes(d)&&(X.includes(d)||H.includes(d)||h.push({colId:v.id||v.field,of:k.of||v.field||v.id,kind:d,depth:k.depth,historyWindow:d==="history"?k.window:void 0}))}return h}}),Ue("packages/core/src/columns/model.js",function(e,U){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return le}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return xe}});const te=U("packages/core/src/internal/merge.js"),C=te.expand,q=te.merge,z=te.toArray,B=U("packages/core/src/internal/warn.js"),Z=B.fail,K=B.warnOnce,F=U("packages/core/src/internal/paths.js"),X=F.getPath,H=F.pathGetter,j=F.pathSetter,m=U("packages/core/src/internal/text.js").humanise,c=U("packages/core/src/internal/predicates.js"),f=c.isFunction,l=c.isObject,t=U("packages/core/src/internal/uid.js").uid,s=U("packages/core/src/format/index.js").compileFormat,n=U("packages/core/src/columns/datatypes.js"),u=n.comparatorFor,o=n.createTypeRegistry,a=n.storageKind,h=U("packages/core/src/columns/infer.js"),v=h.inferColumnType,g=h.DEFAULT_SAMPLE,k=U("packages/core/src/columns/graph.js"),d=k.buildGraph,p=k.affectedBy,O=U("packages/core/src/columns/lookup.js").createLookup,y=U("packages/core/src/columns/value.js"),M=y.compileDisplay,D=y.ValuePipeline,_=y.warnImpureUse,L=U("packages/core/src/model/shadow.js").FIT_SHADOW_KINDS,$=Object.freeze({geometry:"geometry",list:"list"}),P={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},N={centre:"center"},T=new Set(["start","center","end","left","right"]);function E(Be){if(typeof Be!="string")return;const ae=Be.toLowerCase();return N[ae]?N[ae]:T.has(ae)?ae:void 0}function A(Be){if(typeof Be!="string")return;const ae=Be.toLowerCase();return ae==="center"||ae==="centre"?"middle":ae==="top"||ae==="middle"||ae==="bottom"?ae:void 0}const S=["cell","layout","header"];function x(Be){if(!l(Be))return{};const ae={...Be},Ae=(Me,Re)=>{if(Be[Me]===void 0)return;const pe=C(Be[Me],Re);pe&&S.includes(Me)&&!l(Be[Me])&&delete pe.enabled,ae[Me]=pe};return Ae("sort","direction"),Ae("filter","type"),Ae("cell","render"),Ae("edit","editor"),Ae("layout","width"),Ae("group","index"),Ae("pivot","index"),Ae("header","render"),Ae("facet","strategy"),ae}function W(Be,ae){const Ae={...Be||{}},Me=l(ae)&&l(ae.layout)&&ae.layout.width!==void 0;return Ae.fit==="content"&&!Me&&delete Ae.width,Ae}const V=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"]),G=new Set(["collapsible","columns","facet","header","id","marryChildren","openByDefault","showWhen","title"]);function Q(Be,ae,Ae,Me){const Re=Ae==="columnGroup"?"column group":"column";for(const pe of Object.keys(Be))if(!ae.has(pe)){if(pe==="timeZone"&&Ae==="column"){K("column.timeZone",`\`timeZone\` is not a column option, so it had no effect on column "${Me}". 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}K(`${Ae}.unknown:${pe}`,`'${pe}' is not a configuration key this grid recognises, so it had no effect on ${Re} "${Me}". Check the spelling against the reference.`)}}function ee(Be){l(Be.cell)&&Be.cell.autoHeight!==void 0&&K("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${Be.id||Be.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function ne(Be,ae){const Ae=ae&&f(Be.defaultsFor)?Be.defaultsFor(ae):null,Me={...Be.defaults||{},...l(Ae)?Ae:{}},Re={};return Me.align&&(Re.align=Me.align,Re.cell={align:Me.align},Re.header={align:Me.align}),Me.filter&&(Re.filter=Me.filter==="none"?{enabled:!1,type:"none"}:{enabled:!0,type:Me.filter}),Me.editor&&(Re.edit=Me.editor==="none"?{editor:null}:{editor:Me.editor}),Me.total&&(Re.total=Me.total),Me.render&&(Re.cell={...Re.cell||{},render:Me.render}),Be.export&&(Re.export={...Be.export}),Re}function se(Be){if(typeof Be=="string")return Be.trim()?[Be.trim()]:[];if(!Array.isArray(Be))return[];const ae=[];for(const Ae of Be){if(typeof Ae!="string")continue;const Me=Ae.trim();Me&&!ae.includes(Me)&&ae.push(Me)}return ae}class le{#e=new Map;#t=[];#n=[];#r=new WeakMap;#s;#i;#o;#l;#a;#c;#u(ae,Ae,Me){const Re=this.#d(ae,Ae,Me);if(typeof Re!="string"||!this.#f)return Re??null;const pe=Ae&&Ae.totals&&Ae.totals.implement;if(pe&&f(pe[Re])){const ce=pe[Re];return ce.totalName=Re,ce}const $e=this.#f.totalFn?.(Re);return f($e)?$e:Re}#d(ae,Ae,Me){if(typeof ae!="string")return ae;const Re=Ae&&Ae.totals&&Ae.totals.supported;if(!Array.isArray(Re)||Re.includes(ae))return ae;const pe=Re.length?Re.join(", "):"none";return Z(`column "${Me}" is typed ${Ae.name||"a type"}, for which the total "${ae}" is not meaningful. Supported: ${pe}. Aggregating it anyway would produce a confident wrong number.`),ae}#f;#h;#p;#m;#g;#b;#y=!1;#A;#w;constructor(ae={}){this.#i=x(ae.columnDefaults||{}),this.#o=ae.columnPresets||{},this.#a=ae.locale,this.#l=ae.timeZone,this.#c=A(ae.verticalAlign),this.#f=ae.registry||null,this.#h=ae.grid||null,this.#p=ae.context,this.#A=ae.sampleSize??g,this.#w=ae.onChange||null,this.#b=f(ae.rowKey)?ae.rowKey:void 0,this.#s=o(ae.dataTypes,this.#f);const{leaves:Ae,groups:Me}=xe(ae.columns||[]);this.#n=Me;for(const Re of Ae){Re.facet!==void 0&&this.#r.set(Re.def,Re.facet);const pe=this.#O(Re.def,null);if(pe.groupPath=Re.path,this.#e.has(pe.id)){K(`columns.duplicate:${pe.id}`,`two columns resolve to the id '${pe.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}Re.column=pe,this.#e.set(pe.id,pe),this.#t.push(pe.id)}this.#E(ae.stored||null)}#O(ae,Ae){Q(ae,V,"column",ae.id||ae.field||"(unnamed)"),ee(ae);const Me=x(ae),Re=z(ae.preset),pe=Re.map(Ke=>{const Ze=this.#o[Ke];return Ze?x(Ze):(K(`preset:${Ke}`,`unknown column preset "${Ke}"; ignoring`),{})}),$e=this.#S(Me,pe,Ae),ce=this.#s.get($e)||this.#s.get("text");if(!this.#s.has($e)&&ae.type){const Ke=$[$e];K(`type:${$e}`,`unknown data type "${$e}"; falling back to "text"`+(Ke?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${Ke}'.`:""))}const ge=f(ce.items)?this.#T(Me,pe,ae.id||ae.field||"(unnamed)"):null;let je=P;je=q(je,this.#i),ae.type!==!1&&(je=q(je,ne(ce,ge)));for(const Ke of pe)je=q(je,Ke);this.#r.has(ae)&&(je=q(je,x({facet:this.#r.get(ae)}))),je=q(je,Me);const Ve=je.edit;Ve&&Ve.editor&&Ve.enabled!==!0&&!f(Ve.enabled)&&(ae.edit||{}).editor&&K(`column.editor-not-enabled:${ae.id||ae.field}`,`column '${ae.id||ae.field}' names the editor '${Ve.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const Se=ae.id||ae.field||t("col");if(ae.shadow&&!f(je.value&&je.value.compute)){const Ke=typeof ae.shadow=="string"?{kind:ae.shadow}:ae.shadow,Ze=Ke.of||ae.field||Se,nt=L.includes(Ke.kind),it=nt?Ke.model||Ke:null,wt=nt&&it?[...Array.isArray(it.predictors)?it.predictors:[],it.response].filter(Boolean):null;je.value={...je.value||{},deps:wt&&wt.length?wt:Ke.orderBy&&Ke.orderBy!==Ze?[Ze,Ke.orderBy]:[Ze],pure:!1,compute:(ht,Ot)=>{const Pt=Ot.grid&&Ot.grid.statistics;if(!Pt)return null;const Nt=Ot.row&&Ot.row.key||Pt.keyOf(Ot.data);if(!Nt)return null;if(nt){if(!f(Pt.fitShadow))return null;const ct=Ke.model?{...Ke.model,threshold:Ke.threshold}:Ke;return Pt.fitShadow(Ke.kind,Nt,ct)}return Pt.shadow(Ze,Ke.kind,Nt,Ke.scope,Ke)}}}if(ae.running&&!f(je.value&&je.value.compute)){const Ke=typeof ae.running=="string"?{kind:ae.running}:ae.running,Ze=Ke.of||ae.field||Se;je.value={...je.value||{},deps:[Ze],pure:!1,compute:(nt,it)=>{const wt=it.grid&&it.grid.statistics;if(!wt||!f(wt.running))return null;const ht=it.row&&it.row.key||wt.keyOf(it.data);return ht?wt.running(Ze,Ke.kind||"total",ht):null}},ae.sort===void 0&&(je.sort={...je.sort||{},enabled:!1})}const Ge=ae.field??(f(je.value&&je.value.compute)?null:ae.id??null),Ce=f(je.value&&je.value.compute),Te={id:Se,field:Ge,shadow:ae.shadow||null,running:ae.running||null,spec:ae.spec||null,validation:ae.validation||null,volatile:!!(ae.shadow||ae.running),title:je.title??m(Ge||Se),type:ce.name,dataType:ce,itemType:ge,nullable:je.nullable!==!1,align:E(Me.cell&&Me.cell.align||Me.align||je.cell&&je.cell.align||je.align||ce.defaults&&ce.defaults.align)||"start",verticalAlign:A(Me.cell&&Me.cell.verticalAlign||Me.verticalAlign||je.cell&&je.cell.verticalAlign||je.verticalAlign)||this.#c,rowSpan:f(je.rowSpan)?je.rowSpan:null,colSpan:f(je.colSpan)?je.colSpan:null,value:{pure:!0,...je.value||{}},cell:{...je.cell||{}},edit:{...je.edit||{}},sort:{...je.sort||{}},filter:{...je.filter||{}},group:{enabled:!1,index:-1,explode:!1,...je.group||{}},pivot:{enabled:!1,index:-1,...je.pivot||{}},total:this.#u(je.total,ce,ae.id||ae.field||"(unnamed)"),groupTotal:je.groupTotal===void 0?null:this.#u(je.groupTotal,ce,ae.id||ae.field||"(unnamed)"),grandTotal:je.grandTotal===void 0?null:this.#u(je.grandTotal,ce,ae.id||ae.field||"(unnamed)"),tags:se(je.tags),typeOptions:je.typeOptions??null,...l(je[$e])?{[$e]:je[$e]}:{},layout:W(je.layout,Me),header:{...je.header||{}},contextMenu:je.contextMenu===void 0?null:je.contextMenu,facet:{...je.facet||{}},export:{...je.export||{}},allowGroup:je.allowGroup!==!1,allowPivot:je.allowPivot!==!1,allowTotal:je.allowTotal!==!1,quickFilter:je.quickFilter!==!1,def:ae,format:je.format,presets:Re,inferred:Ae!=null&&!ae.type,computed:Ce,diff:ae.diff===void 0?void 0:!!ae.diff,read:Ge?H(Ge):null,write:Ge?j(Ge):null};Te.cell.align=E(Me.cell&&Me.cell.align)||Te.align,Te.header.align=E(Me.header&&Me.header.align)||Te.align;const ze=je.lookup||null;return Te.lookup=ze?O({id:Se,lookup:ze},{locale:this.#a,onChange:()=>{this.#w&&this.#w("lookup",{colId:Se})}}):null,Te.group.explode&&Te.lookup&&Te.lookup.multiple&&K(`explode:${Se}`,`column "${Se}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(Te),Te}#v(ae){ae.formatter=s(ae.format,ae.dataType,this.#a,this.#l,ae.id),ae.formatValue=M(ae,{locale:this.#a,grid:this.#h,context:this.#p}),ae.itemCompare=ae.itemType?u(ae.itemType,this.#a):null,ae.compare=f(ae.value.compare)?ae.value.compare:ae.lookup?ae.lookup.comparator():f(ae.dataType.compareFor)?ae.dataType.compareFor(ae):u(ae.dataType,this.#a),ae.excel=ae.formatter&&ae.formatter.ooxml||ae.dataType&&ae.dataType.excel||"General",ae.storeKind=a(ae.dataType,!!(ae.lookup&&ae.lookup.multiple))}#T(ae,Ae,Me){let Re=l(ae.typeOptions)?ae.typeOptions:null;for(let ge=Ae.length-1;!Re&&ge>=0;ge--)l(Ae[ge].typeOptions)&&(Re=Ae[ge].typeOptions);!Re&&l(this.#i.typeOptions)&&(Re=this.#i.typeOptions);const pe=Re&&Re.of!==void 0?Re.of:"text",$e=typeof pe=="string"?this.#s.get(pe):void 0;return $e&&!f($e.items)&&$e.storage!=="object"?$e:(K(`type:of:${String(pe)}`,`column "${Me}" names "${String(pe)}" as its item type (typeOptions.of), which is not ${$e?"a scalar data type":"a known data type"}; its items are read as text.`),this.#s.get("text"))}#S(ae,Ae,Me){if(ae.type===!1)return"text";if(ae.type)return ae.type;for(let Re=Ae.length-1;Re>=0;Re--)if(Ae[Re].type)return Ae[Re].type;if(this.#i.type)return this.#i.type;if(ae.shadow){const Re=typeof ae.shadow=="string"?ae.shadow:ae.shadow.kind;if(Re==="fitInfluence")return"boolean";if(Re==="fitPredicted"||Re==="fitResidual"||Re==="fitStdResidual"||Re==="fitLeverage"||Re==="fitCooksD"||Re==="tsTrend"||Re==="tsSeasonal"||Re==="tsResidual"||Re==="tsCoverage"||Re==="tsSmoothed"||Re==="tsSmoothingAlpha"||Re==="tsSmoothingBeta")return"number"}return Me||(ae.lookup?"lookup":"text")}#E(ae){const Ae=this.all();this.#m=d(Ae),this.#g?this.#g.setGraph(this.#m):this.#g=new D({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:ae||null,rowKey:this.#b});const Me=this.#g;for(const Re of Ae)Re.getValue=(pe,$e)=>Me.value(Re,pe,$e)}all(){return this.#t.map(ae=>this.#e.get(ae))}visible(){return this.all().filter(ae=>!ae.layout.hidden)}get(ae){return this.#e.get(ae)}groups(){const ae=Ae=>{const Me=[];for(const Re of Ae)Array.isArray(Re.columns)?Me.push({...Re,columns:ae(Re.columns)}):Re.column&&Me.push(Re.column);return Me};return ae(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#s}affectedBy(ae){return p(this.#m,ae)}value(ae,Ae,Me){return this.#g.value(ae,Ae,Me)}text(ae,Ae,Me){return this.#g.text(ae,Ae,Me)}checkImpure(ae,Ae){_(this.#e.get(ae),Ae)}setLocale(ae){this.#a=ae;for(const Ae of this.all())Ae.lookup&&Ae.lookup.setLocale(ae),this.#v(Ae);this.#w&&this.#w("locale",{locale:ae})}infer(ae){const Ae={};if(this.#y||!Array.isArray(ae)||ae.length===0)return Ae;this.#y=!0;let Me=!1;for(const Re of this.all()){const pe=Re.def;if(pe.type!==void 0||!Re.field||Re.computed||Re.lookup||this.#M(Re))continue;const $e=Re.read||(je=>X(je,Re.field)),ce=v(Re.id,ae,$e,this.#s,{sampleSize:this.#A});if(ce===Re.type)continue;Ae[Re.id]=ce;const ge=this.#O(pe,ce);ge.groupPath=Re.groupPath,ge.layout={...ge.layout,...me(Re.layout)},this.#e.set(Re.id,ge),He(this.#n,Re.id,ge),Me=!0}return Me&&this.#E(null),Ae}redecorate(ae,Ae,Me={}){const Re=this.#e.get(ae);if(!Re){K(`redecorate:${ae}`,`columns.decorate('${ae}', …): no column with id '${ae}'.`);return}const pe=Re.def||{},$e={...l(pe.cell)?pe.cell:{}};$e.decoration=Ae??void 0,Me&&"variant"in Me&&($e.variant=Me.variant);const ce={...pe,cell:$e};this.#r.has(pe)&&this.#r.set(ce,this.#r.get(pe));const ge=this.#O(ce,Re.type);return ge.groupPath=Re.groupPath,ge.layout={...ge.layout,...me(Re.layout)},Re.lookup&&Re.lookup!==ge.lookup&&f(Re.lookup.destroy)&&Re.lookup.destroy(),this.#e.set(ae,ge),He(this.#n,ae,ge),this.#E(null),this.#w&&this.#w("decorate",{colId:ae}),ge}destroy(){for(const ae of this.#e.values())ae.lookup&&f(ae.lookup.destroy)&&ae.lookup.destroy()}#M(ae){for(const Ae of ae.presets){const Me=this.#o[Ae];if(Me&&Me.type)return!0}return!!this.#i.type}#P(ae){return!ae.computed&&f(ae.dataType&&ae.dataType.toStorage)}storeReader(ae){if(ae.computed)return Ae=>this.#g.value(ae,Ae,null);if(this.#P(ae)){const Ae=ae.dataType.toStorage,Me={timeZone:this.#l,colId:ae.id,itemType:ae.itemType||null};return Re=>Ae(ae.read(Re),Me)}return ae.read}storeValue(ae,Ae){if(!(!ae||ae.computed)&&f(ae.read))return this.storeReader(ae)(Ae)}storeSchema(){const ae=[];for(const Ae of this.all()){if(Ae.computed&&Ae.value.pure===!1||!Ae.computed&&!Ae.field)continue;const Me=this.storeReader(Ae);let Re=null;!Ae.computed&&!this.#P(Ae)&&typeof Ae.field=="string"&&!Ae.lookup&&(Re=Ae.field);const pe={id:Ae.id,kind:Ae.storeKind,nullable:Ae.nullable,read:Me};Re!==null&&(pe.field=Re),Ae.lookup&&(pe.dictionary=Ae.lookup.dictionary()),ae.push(pe)}return ae}state(){return this.all().map(ae=>({id:ae.id,width:ae.layout.width,flex:ae.layout.flex||void 0,hidden:!!ae.layout.hidden,headerWrap:ae.header?.wrap===!0?!0:void 0,headerOrientation:ae.header?.orientation==="vertical"?"vertical":void 0,pin:ae.layout.pin??null,sort:ae.sort.direction??null,sortIndex:ae.sort.direction?ae.sort.order??0:null,groupIndex:ae.group.enabled?ae.group.index??0:null,pivotIndex:ae.pivot.enabled?ae.pivot.index??0:null,total:typeof ae.total=="string"?ae.total:null,groupTotal:typeof ae.groupTotal=="string"?ae.groupTotal:void 0,grandTotal:typeof ae.grandTotal=="string"?ae.grandTotal:void 0,decoration:ae.cell&&ae.cell.decoration!=null?ve(ae.cell.decoration):void 0,variant:ae.cell&&ae.cell.variant!=null?ve(ae.cell.variant):void 0}))}applyState(ae,Ae={}){const Me={applied:[],skipped:[]},Re=Array.isArray(ae)?ae:ae&&ae.columns||[],pe=!Array.isArray(ae)&&ae&&ae.columnOrder||null;for(const ce of Re){if(!ce||!ce.id){Me.skipped.push({key:"?",reason:"no id"});continue}let ge=this.#e.get(ce.id);if(!ge){Me.skipped.push({key:ce.id,reason:"unknown column"});continue}if(Object.hasOwn(ce,"decoration")||Object.hasOwn(ce,"variant")){const je=ge.cell?ge.cell.decoration:void 0,Ve=ce.decoration??null,Se=Object.hasOwn(ce,"variant"),Ge=Se&&!fe(ge.cell?ge.cell.variant:void 0,ce.variant);(!fe(je,Ve)||Ge)&&(this.redecorate(ce.id,Ve,Se?{variant:ce.variant??void 0}:{}),ge=this.#e.get(ce.id)||ge)}ce.width!=null&&(ge.layout.width=ce.width),ce.flex!=null&&(ge.layout.flex=ce.flex),ce.hidden!=null&&(ge.layout.hidden=!!ce.hidden),ce.headerWrap!==void 0&&(ge.header.wrap=!!ce.headerWrap),ce.headerOrientation!==void 0&&(ge.header.orientation=ce.headerOrientation==="vertical"?"vertical":"horizontal"),ce.pin!==void 0&&(ge.layout.pin=ce.pin),ce.sort!==void 0&&(ge.sort.direction=ce.sort),ce.sortIndex!=null&&(ge.sort.order=ce.sortIndex),ce.groupIndex!=null&&(ge.group.enabled=!0,ge.group.index=ce.groupIndex),ce.pivotIndex!=null&&(ge.pivot.enabled=!0,ge.pivot.index=ce.pivotIndex),ce.total!==void 0&&(ge.total=ce.total),ce.groupTotal!==void 0&&(ge.groupTotal=ce.groupTotal),ce.grandTotal!==void 0&&(ge.grandTotal=ce.grandTotal),Me.applied.push(ce.id)}const $e=pe||(Ae&&Ae.keepOrder?[]:Re.map(ce=>ce&&ce.id).filter(Boolean));if($e.length){const ce=$e.filter(je=>this.#e.has(je)),ge=this.#t.filter(je=>!ce.includes(je));this.#t=[...ce,...ge]}return this.#w&&this.#w("state",Me),Me}move(ae,Ae){this.#N(ae,Ae)&&(this.#$(),this.#w&&this.#w("move",{id:ae,to:Ae}))}reorder(ae){const Ae={applied:[],skipped:[]},Me=[];let Re=0;for(const pe of Array.isArray(ae)?ae:[]){const $e=Re++;this.#N(pe,$e)&&(Ae.applied.push(pe),Me.push({id:pe,to:$e}))}if(!Me.length)return Ae;if(this.#$(),this.#w)for(const pe of Me)this.#w("move",pe);return Ae}#N(ae,Ae){const Me=this.#t.indexOf(ae);if(Me===-1||Math.max(0,Math.min(Number(Ae)||0,this.#t.length-1))===Me)return!1;const pe=this.#e.get(ae);if(pe.layout.movable===!1||pe.layout.lockPosition)return K(`move:${ae}`,`column "${ae}" is not movable; the move was ignored`),!1;const $e=this.#R(ae,Ae);return $e?(K(`move.married:${$e}`,`band "${$e}" declares marryChildren, so its columns stay together; the move was ignored`),!1):(this.#t.splice(Me,1),this.#t.splice(Math.max(0,Math.min(Ae,this.#t.length)),0,ae),!0)}#R(ae,Ae){if(!this.#n||!this.#n.length)return null;const Me=this.#t.filter(ce=>ce!==ae),Re=Math.max(0,Math.min(Ae,Me.length)),pe=(ce,ge)=>{if(Array.isArray(ce.columns)){for(const Ve of ce.columns)pe(Ve,ge);return ge}const je=ce.column?ce.column.id:ce.id;return je&&ge.push(je),ge},$e=ce=>{for(const ge of ce){if(!Array.isArray(ge.columns))continue;if(ge.marryChildren===!0){const Ve=pe(ge,[]),Se=Ve.includes(ae),Ge=Ve.map(Ce=>Me.indexOf(Ce)).filter(Ce=>Ce>=0);if(Ge.length){const Ce=Math.min(...Ge),Te=Math.max(...Ge);if(Se?Re<Ce||Re>Te+1:Re>Ce&&Re<=Te)return ge.id}}const je=$e(ge.columns);if(je)return je}return null};return $e(this.#n)}#$(){const ae=new Map(this.#t.map((Re,pe)=>[Re,pe])),Ae=Re=>{if(!Array.isArray(Re.columns)){const $e=Re.column?Re.column.id:Re.id;return ae.has($e)?ae.get($e):1/0}let pe=1/0;for(const $e of Re.columns)pe=Math.min(pe,Ae($e));return pe},Me=Re=>{Re.sort((pe,$e)=>Ae(pe)-Ae($e));for(const pe of Re)Array.isArray(pe.columns)&&Me(pe.columns)};Me(this.#n)}#V(ae){const Ae=Me=>{for(let Re=0;Re<Me.length;Re++){const pe=Me[Re];if(Array.isArray(pe.columns)){const $e=Ae(pe.columns);if($e)return $e}else if(pe.column&&pe.column.id===ae)return Me.splice(Re,1)[0]}return null};return Ae(this.#n)}#W(ae){const Ae=[];for(let Me=ae.length-1;Me>=0;Me--){const Re=ae[Me];Array.isArray(Re.columns)&&(Ae.push(...this.#W(Re.columns)),Re.columns.length===0&&(Ae.push(Re.id),ae.splice(Me,1)))}return Ae}#D(){const ae=(Ae,Me,Re)=>{for(const pe of Ae)Array.isArray(pe.columns)?ae(pe.columns,[...Me,pe.id]):pe.column&&(pe.column.groupPath=Me)};ae(this.#n,[])}#x(ae){const Ae=new Set(ae),Me=this.#t.filter(ce=>Ae.has(ce));if(!Me.length)return;const Re=Math.min(...Me.map(ce=>this.#t.indexOf(ce))),pe=this.#t.slice(0,Re).filter(ce=>!Ae.has(ce)),$e=this.#t.slice(Re).filter(ce=>!Ae.has(ce));this.#t=[...pe,...Me,...$e]}#Y(ae){const Ae=[],Me=Re=>{if(Array.isArray(Re.columns))for(const pe of Re.columns)Me(pe);else Re.column&&Ae.push(Re.column.id)};return Me(ae),Ae}#I(ae){const Ae=Me=>{for(const Re of Me){if(!Array.isArray(Re.columns))continue;if(Re.id===ae)return{node:Re,parent:Me};const pe=Ae(Re.columns);if(pe)return pe}return null};return Ae(this.#n)}groupColumns(ae,Ae={}){const Me=z(ae).filter(ge=>this.#e.has(ge));if(!Me.length)return K("columns.group.empty","groupColumns was given no known column ids; nothing was grouped."),null;for(const ge of Me)if(this.#e.get(ge).layout.lockPosition)return K(`columns.group.locked:${ge}`,`column "${ge}" is position-locked and cannot be grouped.`),null;const Re=Ae.groupId?this.#I(Ae.groupId):null;if(Ae.groupId&&!Re)return K(`columns.group.unknown:${Ae.groupId}`,`no band "${Ae.groupId}" to add to; nothing was grouped.`),null;let pe=null;if(!Re&&Ae.id!=null&&(pe=String(Ae.id),this.#I(pe)||this.#e.has(pe)))return K(`columns.group.idtaken:${pe}`,`band id "${pe}" is already in use; nothing was grouped.`),null;const $e=Me.map(ge=>this.#V(ge)).filter(Boolean);if(!$e.length)return null;let ce;if(Re)Re.node.columns.push(...$e),ce=Re.node.id;else{const ge={id:pe||t("grp"),title:Ae.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:$e},je=Number.isInteger(Ae.at)?Math.max(0,Math.min(Ae.at,this.#n.length)):this.#n.length;this.#n.splice(je,0,ge),ce=ge.id}return this.#W(this.#n),this.#x(Me),this.#D(),this.#$(),this.#w&&this.#w("columngroup",{action:"formed",groupId:ce,ids:Me}),ce}ungroupColumn(ae){const Ae=this.#e.get(ae);if(!Ae){K(`columns.ungroup.unknown:${ae}`,`no column "${ae}" to ungroup.`);return}const Me=Ae.groupPath||[];if(!Me.length)return;const Re=Me[Me.length-1],pe=this.#I(Re);if(!pe)return;const $e=this.#V(ae);if(!$e)return;const ce=pe.parent.indexOf(pe.node);pe.parent.splice(ce+1,0,$e);const ge=this.#W(this.#n),je=this.#Y(pe.node);if(je.length){this.#x(je);const Ve=Math.max(...je.map(Ge=>this.#t.indexOf(Ge))),Se=this.#t.filter(Ge=>Ge!==ae);Se.splice(Ve+1,0,ae),this.#t=Se}this.#D(),this.#$(),this.#w&&this.#w("columngroup",{action:"removed",id:ae,dissolved:ge})}renameGroup(ae,Ae){const Me=this.#I(ae);if(!Me){K(`columns.group.rename:${ae}`,`no band "${ae}" to rename.`);return}Me.node.title=String(Ae??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:ae,title:Me.node.title})}dissolveGroup(ae){const Ae=this.#I(ae);if(!Ae){K(`columns.group.dissolve:${ae}`,`no band "${ae}" to dissolve.`);return}const Me=Ae.parent.indexOf(Ae.node);Ae.parent.splice(Me,1,...Ae.node.columns),this.#D(),this.#$(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:ae})}moveGroup(ae,Ae){const Me=this.#I(ae);if(!Me){K(`columns.group.move:${ae}`,`no band "${ae}" to move.`);return}const Re=Me.parent,pe=Re.indexOf(Me.node);pe!==-1&&(Re.splice(pe,1),Re.splice(Math.max(0,Math.min(Ae,Re.length)),0,Me.node),this.#K(),this.#D(),this.#w&&this.#w("columngroup",{action:"moved",groupId:ae,to:Ae}))}#K(){const ae=[],Ae=Re=>{for(const pe of Re)Array.isArray(pe.columns)?Ae(pe.columns):pe.column&&ae.push(pe.column.id)};Ae(this.#n);const Me=new Set(ae);this.#t=[...ae,...this.#t.filter(Re=>!Me.has(Re))]}groupTree(){const ae=Me=>Me.map(Re=>Array.isArray(Re.columns)?{id:Re.id,title:Re.title||"",collapsible:!!Re.collapsible,openByDefault:Re.openByDefault!==!1,columns:ae(Re.columns)}:Re.column?Re.column.id:null).filter(Re=>Re!==null),Ae=ae(this.#n);return Ae.some(Me=>Me&&typeof Me=="object")?Ae:[]}applyGroupTree(ae){if(!Array.isArray(ae))return;const Ae=new Set,Me=pe=>{const $e=[];for(const ce of pe)if(ce&&typeof ce=="object"&&Array.isArray(ce.columns)){const ge=Me(ce.columns);if(!ge.length)continue;$e.push({id:ce.id||t("grp"),title:ce.title||"",collapsible:ce.collapsible===!0,openByDefault:ce.openByDefault!==!1,showWhen:"always",marryChildren:!1,header:{},def:{},columns:ge})}else if(typeof ce=="string"){const ge=this.#e.get(ce);ge&&!Ae.has(ce)&&(Ae.add(ce),$e.push({column:ge,path:[]}))}return $e},Re=Me(ae);for(const pe of this.#t){if(Ae.has(pe))continue;const $e=this.#e.get(pe);$e&&Re.push({column:$e,path:[]})}this.#n=Re,this.#D(),this.#$(),this.#w&&this.#w("columngroup",{action:"applied"})}show(ae){this.#U(ae,!1)}hide(ae){this.#U(ae,!0)}#U(ae,Ae){const Me=[];for(const Re of z(ae)){const pe=this.#e.get(Re);if(pe){if(Ae&&pe.layout.lockVisible){K(`lockVisible:${Re}`,`column "${Re}" is \`layout.lockVisible\` and cannot be hidden`);continue}pe.layout.hidden!==Ae&&(pe.layout.hidden=Ae,Me.push(Re))}}Me.length&&this.#w&&this.#w("visible",{ids:Me,hidden:Ae})}pin(ae,Ae){const Me=this.#e.get(ae);Me&&(Me.layout.pin=Ae??null,this.#w&&this.#w("pin",{id:ae,side:Me.layout.pin}))}pinMany(ae){const Ae={};for(const[Re,pe]of ae){const $e=this.#e.get(Re);$e&&($e.layout.pin=pe??null,Ae[Re]=$e.layout.pin)}const Me=Object.keys(Ae);Me.length&&this.#w&&this.#w("pin",{ids:Me,pins:Ae})}#B(ae,Ae){const Me=ae.layout.min??0,Re=ae.layout.max;let pe=Math.max(Me,Ae);return Re!=null&&(pe=Math.min(Re,pe)),ae.layout.width=pe,ae.layout.flex=0,pe}resize(ae,Ae){const Me=this.#e.get(ae);if(!Me)return;if(Me.layout.resizable===!1){K(`resize:${ae}`,`column "${ae}" is not resizable; the resize was ignored`);return}const Re=this.#B(Me,Ae);this.#w&&this.#w("resize",{id:ae,width:Re})}resizeMany(ae){const Ae={};for(const[Re,pe]of ae){const $e=this.#e.get(Re);if($e){if($e.layout.resizable===!1){K(`resize:${Re}`,`column "${Re}" is not resizable; the resize was ignored`);continue}Ae[Re]=this.#B($e,pe)}}const Me=Object.keys(Ae);Me.length&&this.#w&&this.#w("resize",{ids:Me,widths:Ae})}}function me(Be){const ae={};return Be.width!=null&&(ae.width=Be.width),Be.hidden!=null&&(ae.hidden=Be.hidden),Be.pin!==void 0&&(ae.pin=Be.pin),ae}function ve(Be){if(Be===null||typeof Be!="object")return Be;try{return structuredClone(Be)}catch{}try{return JSON.parse(JSON.stringify(Be))}catch{return Be}}function fe(Be,ae){const Ae=Be??null,Me=ae??null;if(Ae===Me)return!0;if(Ae===null||Me===null)return!1;if(typeof Ae!="object"||typeof Me!="object")return Ae===Me;try{return JSON.stringify(Ae)===JSON.stringify(Me)}catch{return!1}}function xe(Be){const ae=[],Ae=(Re,pe,$e)=>{const ce=[];for(const ge of Re){if(!l(ge)){Z("a column definition must be an object");continue}if(Array.isArray(ge.columns)){Q(ge,G,"columnGroup",ge.title||ge.id||"(unnamed)");const je={id:ge.id||t("grp"),title:ge.title||"",collapsible:ge.collapsible===!0,openByDefault:ge.openByDefault!==!1,showWhen:ge.showWhen||"always",marryChildren:ge.marryChildren===!0,header:ge.header||{},def:ge,columns:[]};je.columns=Ae(ge.columns,[...pe,je.id],ge.facet!==void 0?ge.facet:$e),ce.push(je)}else{const je={def:ge,path:pe,facet:$e};ae.push(je),ce.push(je)}}return ce},Me=Ae(Be,[],void 0);return{leaves:ae,groups:Me}}function He(Be,ae,Ae){for(const Me of Be){if(Me.columns){if(He(Me.columns,ae,Ae))return!0;continue}if(Me.column&&Me.column.id===ae)return Me.column=Ae,!0}return!1}}),Ue("packages/core/src/columns/autogroup.js",function(e,U){"use strict";Object.defineProperty(e,"AUTO_GROUP_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createAutoGroupColumn",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"warnOnAbsurdGrouping",{enumerable:!0,get:function(){return K}});const C=U("packages/core/src/internal/warn.js").warnOnce,q="__lattice_group",z=240,B=.5;function Z(F){const{columns:X,groupBy:H}=F,j=H.map(c=>X.get(c)).filter(Boolean),w=j.length?j.map(c=>c.title||c.id).join(" > "):"Group",m=F.config&&F.config.autoGroupColumnWidth||z;return{id:q,field:null,title:w,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:H.slice(),group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:m,min:120,pin:F.config&&F.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 F.config&&F.config.grandTotalLabel||"Total";const l=j[Math.min(f.level||0,j.length-1)];return l&&typeof l.formatValue=="function"?l.formatValue(c,f):c==null?"":String(c)}}}function K(F,X,H){!F.length||H<100||X<H*B||C(`grouping.cardinality:${F.join(",")}`,`grouping by ${F.join(", ")} produced ${X} groups for ${H} 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.`)}}),Ue("packages/core/src/columns/selectcolumn.js",function(e,U){"use strict";Object.defineProperty(e,"SELECT_COLUMN_ID",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"createSelectionColumn",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return z}});const te="__lattice_select",C=44;function q(B){const Z=B.selection||{},K=B.config&&B.config.selectionColumnWidth||C;return{id:te,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:K,min:K,max:K,pin:B.config&&B.config.selectionColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,headerCheckbox:Z.headerCheckbox===!0,def:{},getValue(F,X){return X?X.selected:!1},formatValue(){return""}}}const z=q}),Ue("packages/core/src/columns/rownumbercolumn.js",function(e,U){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createRowNumberColumn",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return X}});const C=U("packages/core/src/internal/predicates.js").isFunction,q="__lattice_rownumber",z=40,B=9,Z=22;function K(H){const j=String(Math.max(1,Math.trunc(Math.abs(H))||1)).length;return Math.max(z,j*B+Z)}function F(H){const j=H.rowNumbers,w=j&&typeof j=="object"?j:{},m=Number.isFinite(w.start)?w.start:1,c=Number.isFinite(w.width)?w.width:K((H.maxNumber||0)+m),f=C(H.rank)?H.rank:()=>null;return{id:q,field:null,title:typeof w.title=="string"?w.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:c,min:c,max:c,pin:"start",hidden:!1,resizable:w.width==null,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(l,r){const t=f(r);return t==null?null:t-1+m},formatValue(l){return l==null?"":String(l)}}}const X=F}),Ue("packages/core/src/model/detail.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_DETAIL_HEIGHT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"DEFAULT_CACHE_LIMIT",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DetailModel",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return X}});const C=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce,B=240,Z=10;function K(H){if(!H)return null;const j=H===!0?{}:H;return j.enabled===!1?null:!C(j.rows)&&!j.render?(z("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:j.render||null,config:j.config||null,rows:C(j.rows)?j.rows:null,height:j.height??B,cacheLimit:Number.isFinite(j.cacheLimit)?Math.max(0,j.cacheLimit):Z,isMaster:C(j.isMaster)?j.isMaster:null,target:j.target||null,onCreate:C(j.onCreate)?j.onCreate:null,path:typeof j.path=="string"?j.path:null}}class F{#e;#t=new Set;#n;#r=0;constructor(j){this.#e=j.config,this.#n=C(j.onChange)?j.onChange:()=>{}}get config(){return this.#e}get inline(){return!this.#e.target}isMaster(j){if(!j||j.group||j.detail)return!1;const w=this.#e.isMaster;return w?!!w(j.data,j):!0}isOpen(j){return this.#t.has(j)}keys(){return[...this.#t]}activeKey(){for(const j of this.#t)return j;return null}heightOf(j){const w=this.#e.height;return C(w)?Number(w(j))||B:w==="auto"?B:Number(w)||B}open(j){return this.#t.has(j)?!1:(this.inline||this.#t.clear(),this.#t.add(j),this.#s(),!0)}close(j){return this.#t.delete(j)?(this.#s(),!0):!1}toggle(j){return this.#t.has(j)?(this.close(j),!1):(this.open(j),!0)}closeAll(){this.#t.size&&(this.#t.clear(),this.#s())}prune(j){if(!this.#t.size||!C(j))return;let w=!1;for(const m of[...this.#t])j(m)||(this.#t.delete(m),w=!0);w&&this.#s()}signature(){return`${this.#r}`}set(j){this.#t.clear();const w=Array.isArray(j)?j:[];for(const m of this.inline?w:w.slice(0,1))this.#t.add(m);this.#s()}#s(){this.#r++,this.#n()}}const X=F}),Ue("packages/core/src/compute/special.js",function(e,U){"use strict";Object.defineProperty(e,"logGamma",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"incompleteBeta",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"normalQuantile",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"normalCdf",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"studentT",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"chiSquareUpperTail",{enumerable:!0,get:function(){return l}});const te=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),C=3e-12,q=1e-300;function z(r){if(r<.5)return Math.log(Math.PI/Math.sin(Math.PI*r))-z(1-r);const t=r-1;let i=.9999999999998099;const s=t+7.5;for(let n=0;n<te.length;n++)i+=te[n]/(t+n+1);return .5*Math.log(2*Math.PI)+(t+.5)*Math.log(s)-s+Math.log(i)}function B(r,t,i){const s=r+t,n=r+1,u=r-1;let o=1,a=1-s*i/n;Math.abs(a)<q&&(a=q),a=1/a;let h=a;for(let v=1;v<=300;v++){const g=2*v;let k=v*(t-v)*i/((u+g)*(r+g));a=1+k*a,Math.abs(a)<q&&(a=q),o=1+k/o,Math.abs(o)<q&&(o=q),a=1/a,h*=a*o,k=-(r+v)*(s+v)*i/((r+g)*(n+g)),a=1+k*a,Math.abs(a)<q&&(a=q),o=1+k/o,Math.abs(o)<q&&(o=q),a=1/a;const d=a*o;if(h*=d,Math.abs(d-1)<C)break}return h}function Z(r,t,i){if(!(r>0)||!(t>0)||!Number.isFinite(i))return Number.NaN;if(i<=0)return 0;if(i>=1)return 1;const s=Math.exp(z(r+t)-z(r)-z(t)+r*Math.log(i)+t*Math.log(1-i));return i<(r+1)/(r+t+2)?s*B(r,t,i)/r:1-s*B(t,r,1-i)/t}function K(r){if(!(r>0)||!(r<1))return r===0?-1/0:r===1?1/0:Number.NaN;const t=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],i=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],s=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],n=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],u=.02425;let o,a,h;r<u?(o=Math.sqrt(-2*Math.log(r)),h=(((((s[0]*o+s[1])*o+s[2])*o+s[3])*o+s[4])*o+s[5])/((((n[0]*o+n[1])*o+n[2])*o+n[3])*o+1)):r<=1-u?(o=r-.5,a=o*o,h=(((((t[0]*a+t[1])*a+t[2])*a+t[3])*a+t[4])*a+t[5])*o/(((((i[0]*a+i[1])*a+i[2])*a+i[3])*a+i[4])*a+1)):(o=Math.sqrt(-2*Math.log(1-r)),h=-(((((s[0]*o+s[1])*o+s[2])*o+s[3])*o+s[4])*o+s[5])/((((n[0]*o+n[1])*o+n[2])*o+n[3])*o+1));const g=(.5*F(-h/Math.SQRT2)-r)*Math.sqrt(2*Math.PI)*Math.exp(h*h/2);return h-g/(1+h*g/2)}function F(r){const t=Math.abs(r),i=2/(2+t),s=4*i-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 u=0,o=0,a;for(let v=n.length-1;v>0;v--)a=o,o=s*o-u+n[v],u=a;const h=i*Math.exp(-t*t+.5*(n[0]+s*o)-u);return r>=0?h:2-h}function X(r){return .5*F(-r/Math.SQRT2)}function H(r,t){if(!(t>0)||!Number.isFinite(r))return Number.NaN;const i=.5*Z(t/2,.5,t/(t+r*r));return r>0?1-i:i}function j(r,t){if(!(r>0)||!(r<1)||!(t>0))return Number.NaN;if(t>1e7)return K(r);let i=-1e4,s=1e4,n=K(r);const u=z(t/2)+z(.5)-z((t+1)/2);for(let o=0;o<60;o++){const a=H(n,t);a<r?i=n:s=n;const h=Math.exp(-((t+1)/2)*Math.log(1+n*n/t)-u)/Math.sqrt(t),v=h>0?(a-r)/h:0;if(Math.abs(v)<1e-12)break;const g=n-v;if(n=g>i&&g<s&&Number.isFinite(g)?g:(i+s)/2,s-i<1e-12)break}return n}function w(r,t){let i=r,s=1/r,n=s;for(let u=0;u<300&&(i+=1,n*=t/i,s+=n,!(Math.abs(n)<Math.abs(s)*C));u++);return s*Math.exp(-t+r*Math.log(t)-z(r))}function m(r,t){let i=t+1-r,s=1/q,n=1/i,u=n;for(let o=1;o<=300;o++){const a=-o*(o-r);i+=2,n=a*n+i,Math.abs(n)<q&&(n=q),s=i+a/s,Math.abs(s)<q&&(s=q),n=1/n;const h=n*s;if(u*=h,Math.abs(h-1)<C)break}return Math.exp(-t+r*Math.log(t)-z(r))*u}function c(r,t){return!(r>0)||!(t>=0)||!Number.isFinite(t)?Number.NaN:t===0?0:t<r+1?w(r,t):1-m(r,t)}function f(r,t){return t>0?c(t/2,r/2):Number.NaN}function l(r,t){const i=f(r,t);return Number.isNaN(i)?Number.NaN:Math.min(1,Math.max(0,1-i))}}),Ue("packages/core/src/compute/linalg.js",function(e,U){"use strict";Object.defineProperty(e,"cholesky",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"choleskySolve",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"choleskyInverse",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"normalEquations",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return Z}});function te(K){const F=K.length,X=Array.from({length:F},()=>new Array(F).fill(0));for(let H=0;H<F;H++)for(let j=0;j<=H;j++){let w=K[H][j];for(let m=0;m<j;m++)w-=X[H][m]*X[j][m];if(H===j){if(!(w>0))return null;X[H][j]=Math.sqrt(w)}else X[H][j]=w/X[j][j]}return X}function C(K,F){const X=K.length,H=new Array(X).fill(0);for(let w=0;w<X;w++){let m=F[w];for(let c=0;c<w;c++)m-=K[w][c]*H[c];H[w]=m/K[w][w]}const j=new Array(X).fill(0);for(let w=X-1;w>=0;w--){let m=H[w];for(let c=w+1;c<X;c++)m-=K[c][w]*j[c];j[w]=m/K[w][w]}return j}function q(K){const F=K.length,X=Array.from({length:F},()=>new Array(F).fill(0));for(let H=0;H<F;H++){const j=new Array(F).fill(0);j[H]=1;const w=C(K,j);for(let m=0;m<F;m++)X[m][H]=w[m]}return X}function z(K,F,X){const H=K.length,j=H?K[0].length:0,w=Array.from({length:j},()=>new Array(j).fill(0)),m=new Array(j).fill(0);for(let c=0;c<H;c++){const f=X?X[c]:1,l=K[c];for(let r=0;r<j;r++){const t=f*l[r];m[r]+=t*F[c];for(let i=r;i<j;i++)w[r][i]+=t*l[i]}}for(let c=0;c<j;c++)for(let f=0;f<c;f++)w[c][f]=w[f][c];return{xtwx:w,xtwy:m}}function B(K,F){return K.map(X=>X.reduce((H,j,w)=>H+j*F[w],0))}function Z(K,F){let X=0;for(let H=0;H<K.length;H++){let j=0;for(let w=0;w<K.length;w++)j+=F[H][w]*K[w];X+=K[H]*j}return X}}),Ue("packages/core/src/compute/sketch.js",function(e,U){"use strict";Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return w}});class te{#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(c){if(!Number.isFinite(c))return;this.#e++;const f=c-this.#t;this.#t+=f/this.#e,this.#n+=f*(c-this.#t)}merge(c){if(c.#e===0)return;if(this.#e===0){this.#e=c.#e,this.#t=c.#t,this.#n=c.#n;return}const f=this.#e+c.#e,l=c.#t-this.#t;this.#t+=l*(c.#e/f),this.#n+=c.#n+l*l*(this.#e*c.#e/f),this.#e=f}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 c=this.variance();return c===null?null:Math.sqrt(c)}stddevP(){const c=this.varianceP();return c===null?null:Math.sqrt(c)}}class C{#e=[];#t=0;#n;#r;constructor(c,f=Math.random){if(!(c>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(c),this.#r=f}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(c){if(!Number.isFinite(c))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(c);return}const f=Math.floor(this.#r()*this.#t);f<this.#n&&(this.#e[f]=c)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let c=0;for(const f of this.#e)c+=f;return c/this.#e.length}quantile(c){const f=this.#e.length;if(!f)return null;const l=this.#e.slice().sort((s,n)=>s-n);if(f===1)return l[0];const r=(f-1)*Math.min(1,Math.max(0,c)),t=Math.floor(r),i=Math.ceil(r);return t===i?l[t]:l[t]+(r-t)*(l[i]-l[t])}}function q(m){return m^=m>>>16,m=Math.imul(m,2246822507),m^=m>>>13,m=Math.imul(m,3266489909),m^=m>>>15,m>>>0}function z(m){if(typeof m=="number"){const l=new DataView(new ArrayBuffer(8));return l.setFloat64(0,m===0?0:m),q(l.getUint32(0)^l.getUint32(4))}const c=typeof m=="string"?m:String(m);let f=2166136261;for(let l=0;l<c.length;l++)f^=c.charCodeAt(l),f=Math.imul(f,16777619);return q(f)}class B{#e;#t;#n;constructor(c=14){const f=Math.floor(c);if(f<4||f>16)throw new RangeError("HLL precision must be 4..16");this.#e=f,this.#t=1<<f,this.#n=new Uint8Array(this.#t)}static errorBoundFor(c=14){const f=1<<Math.floor(c),l=1.04/Math.sqrt(f);return Object.freeze({kind:"probabilistic",metric:"relative",value:l,statement:`distinct count within ~${(l*100).toFixed(2)}% relative standard error (m=${f} buckets)`})}errorBound(){return B.errorBoundFor(this.#e)}add(c){const f=z(c),l=f&this.#t-1,r=f>>>this.#e|1<<32-this.#e;let t=1,i=r;for(;(i&1)===0;)t++,i>>>=1;t>this.#n[l]&&(this.#n[l]=t)}count(){const c=this.#t,f=32-this.#e,l=new Float64Array(f+2);for(let i=0;i<c;i++)l[this.#n[i]]++;let r=c*F(1-l[f+1]/c);for(let i=f;i>=1;i--)r=.5*(r+l[i]);r+=c*K(l[0]/c);const t=Z*c*c/r;return Math.round(t)}}const Z=.5/Math.log(2);function K(m){if(m===1)return 1/0;let c=1,f=m,l;do m*=m,l=f,f+=m*c,c+=c;while(f!==l);return f}function F(m){if(m===0||m===1)return 0;let c=1,f=1-m,l;do m=Math.sqrt(m),l=f,c*=.5,f-=(1-m)**2*c;while(f!==l);return f/3}class X{#e=new Map;#t;#n=0;constructor(c){if(!(c>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(c)}errorBoundFor(c){const f=c/this.#t;return Object.freeze({kind:"deterministic",metric:"absolute",value:f,statement:`each count overestimates the truth by at most N/m = ${f.toFixed(2)} (N=${c}, m=${this.#t})`})}get seen(){return this.#n}add(c){this.#n++;const f=this.#e.get(c);if(f){f.count++;return}if(this.#e.size<this.#t){this.#e.set(c,{count:1,error:0});return}let l,r=1/0;for(const[t,i]of this.#e)i.count<r&&(r=i.count,l=t);this.#e.delete(l),this.#e.set(c,{count:r+1,error:r})}top(c=this.#t){return[...this.#e.entries()].map(([l,r])=>({item:l,count:r.count,error:r.error})).sort((l,r)=>r.count-l.count).slice(0,Math.max(0,Math.floor(c)))}}class H{#e;#t=[[]];#n=0;#r;#s;constructor(c=200,f=Math.random){this.#e=Math.max(8,Math.floor(c)),this.#r=f,this.#s=2/3}static errorBoundFor(c=200){const f=1/Math.max(8,Math.floor(c));return Object.freeze({kind:"probabilistic",metric:"rank",value:f,statement:`queried quantile's true rank within ~${(f*100).toFixed(2)}% of N of the requested rank (k=${c})`})}errorBound(){return H.errorBoundFor(this.#e)}get count(){return this.#n}#i(c){const l=this.#t.length-1-c,r=Math.ceil(this.#e*this.#s**l);return Math.max(2,r)}add(c){Number.isFinite(c)&&(this.#n++,this.#t[0].push(c),this.#t[0].length>=this.#i(0)&&this.#o(0))}#o(c){const f=this.#t[c];f.sort((t,i)=>t-i),c+1>=this.#t.length&&this.#t.push([]);const l=this.#t[c+1],r=this.#r()<.5?0:1;for(let t=r;t<f.length;t+=2)l.push(f[t]);this.#t[c]=[];for(let t=0;t<this.#t.length;t++)if(this.#t[t].length>=this.#i(t)){this.#o(t);return}}#l(){const c=[];for(let f=0;f<this.#t.length;f++){const l=1<<f;for(const r of this.#t[f])c.push({v:r,w:l})}return c}quantile(c){const f=this.#l();if(!f.length)return null;f.sort((i,s)=>i.v-s.v);let l=0;for(const i of f)l+=i.w;const r=Math.min(1,Math.max(0,c))*l;let t=0;for(const i of f)if(t+=i.w,t>=r)return i.v;return f[f.length-1].v}rank(c){let f=0;for(let l=0;l<this.#t.length;l++){const r=1<<l;for(const t of this.#t[l])t<=c&&(f+=r)}return f}}const j=Object.freeze({distinct:B.errorBoundFor(14),median:H.errorBoundFor(200),p25:H.errorBoundFor(200),p75:H.errorBoundFor(200),p90:H.errorBoundFor(200),p95:H.errorBoundFor(200),p99:H.errorBoundFor(200),iqr:H.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"})}),w={Welford:te,Reservoir:C,HyperLogLog:B,SpaceSaving:X,KLL:H,hash32:z,SKETCH_BOUNDS:j}}),Ue("packages/core/src/compute/statistics.js",function(e,U){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"numbers",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"frequencies",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"herfindahl",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"entropy",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"evenness",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"topShare",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"gini",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"moments",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"quantileSorted",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"quantile",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"STAT_FNS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return P}}),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 E}}),Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"covariance",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"autocorrelations",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"spearman",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(e,"kendall",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(e,"seriesStats",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(e,"D2_N2",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(e,"D4_N2",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(e,"movingRanges",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"withinSigma",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(e,"countOutside",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(e,"histogram",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(e,"DEFAULT_CONFIDENCE",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(e,"meanInterval",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(e,"proportionInterval",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(e,"slopeInterval",{enumerable:!0,get:function(){return Ot}}),Object.defineProperty(e,"capabilityInterval",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(e,"standardizedMeanDifference",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(e,"normalTotalVariation",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(e,"frequencyMap",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(e,"categoricalDistance",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(e,"SUBSET_RELIABILITY_FLOOR",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(e,"compareColumn",{enumerable:!0,get:function(){return at}}),Object.defineProperty(e,"isNumericColumn",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(e,"populationRead",{enumerable:!0,get:function(){return Oe}});const te=U("packages/core/src/compute/handle.js"),C=te.presenceReader,q=te.valueReader,z=U("packages/core/src/compute/special.js"),B=z.studentTQuantile,Z=z.studentT,K=z.normalQuantile,F=z.normalCdf,X=z.chiSquareUpperTail,H=U("packages/core/src/compute/linalg.js"),j=H.cholesky,w=H.choleskySolve,m=H.choleskyInverse,c=H.normalEquations,f=H.quadForm,r=U("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,t=5e3,i=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"}),s=Object.freeze({distinct:Object.freeze({sketch:"HyperLogLog",bound:r.distinct}),median:Object.freeze({sketch:"KLL",bound:r.median}),p25:Object.freeze({sketch:"KLL",bound:r.p25}),p75:Object.freeze({sketch:"KLL",bound:r.p75}),p90:Object.freeze({sketch:"KLL",bound:r.p90}),p95:Object.freeze({sketch:"KLL",bound:r.p95}),p99:Object.freeze({sketch:"KLL",bound:r.p99}),iqr:Object.freeze({sketch:"KLL",bound:r.iqr}),top3Share:Object.freeze({sketch:"SpaceSaving",bound:r.topK}),top10Share:Object.freeze({sketch:"SpaceSaving",bound:r.topK})});function n(ue){const Ee=ue==="sum"||ue==="avg"||ue==="countValues"||ue==="min"||ue==="max"?"maintained":Object.prototype.hasOwnProperty.call(i,ue)?i[ue]:null,be=Object.prototype.hasOwnProperty.call(s,ue)?s[ue]:null;return{stat:ue,exact:Ee,approximate:be}}function u(ue,Ee){const be=Ee.length,Ne=new Float64Array(be);let re=0;if(ue&&(ue.kind==="float64"||ue.kind==="int32")){const ke=ue.values,Le=C(ue);for(let De=0;De<be;De++){const Pe=Ee[De];if(Le&&Le(Pe)!==1)continue;const _e=ke[Pe];Number.isNaN(_e)||(Ne[re++]=_e)}return Ne.subarray(0,re)}const we=q(ue);for(let ke=0;ke<be;ke++){const Le=we(Ee[ke]);if(Le==null||Le==="")continue;const De=typeof Le=="number"?Le:Number(Le);Number.isFinite(De)&&(Ne[re++]=De)}return Ne.subarray(0,re)}function o(ue,Ee){const be=new Map,Ne=q(ue);let re=0;for(let we=0;we<Ee.length;we++){const ke=Ne(Ee[we]);if(ke==null||ke===""||typeof ke=="number"&&Number.isNaN(ke))continue;const Le=typeof ke=="object"?String(ke):ke;be.set(Le,(be.get(Le)||0)+1),re++}const oe=[...be.values()].sort((we,ke)=>ke-we);return{counts:oe,total:re,distinct:oe.length}}function a(ue){return ue.total>0?ue.counts.map(Ee=>Ee/ue.total):[]}function h(ue,Ee){const be=o(ue,Ee);if(!be.total)return null;let Ne=0;for(const re of a(be))Ne+=re*re;return Ne}function v(ue,Ee){const be=o(ue,Ee);if(!be.total)return null;let Ne=0;for(const re of a(be))re>0&&(Ne-=re*Math.log2(re));return Ne}function g(ue,Ee){const be=o(ue,Ee);if(!be.total||be.distinct<2)return be.total?1:null;let Ne=0;for(const re of a(be))re>0&&(Ne-=re*Math.log2(re));return Ne/Math.log2(be.distinct)}function k(ue,Ee,be=3){const Ne=o(ue,Ee);if(!Ne.total)return null;const re=Math.max(1,Math.floor(be));let oe=0;for(let we=0;we<Math.min(re,Ne.counts.length);we++)oe+=Ne.counts[we];return oe/Ne.total}function d(ue,Ee){const be=u(ue,Ee),Ne=be.length;if(!Ne)return null;const re=be.slice().sort();if(re[0]<0)return null;let oe=0,we=0;for(let ke=0;ke<Ne;ke++)oe+=re[ke],we+=(ke+1)*re[ke];return oe===0?0:2*we/(Ne*oe)-(Ne+1)/Ne}function p(ue){let Ee=0,be=0,Ne=0;for(let re=0;re<ue.length;re++){const oe=ue[re];Ee++;const we=oe-be;be+=we/Ee,Ne+=we*(oe-be)}return{n:Ee,mean:be,m2:Ne}}function b(ue,Ee){const be=ue.length;if(!be)return NaN;if(be===1)return ue[0];const Ne=(be-1)*Math.min(1,Math.max(0,Ee)),re=Math.floor(Ne),oe=Math.ceil(Ne);return re===oe?ue[re]:ue[re]+(Ne-re)*(ue[oe]-ue[re])}function O(ue,Ee){if(!ue.length)return NaN;const be=ue.slice().sort();return b(be,Ee)}function y(ue,Ee){const be=q(ue);let Ne=0,re=0,oe=0;for(let we=0;we<Ee.length;we++){const ke=be(Ee[we]);if(ke==null||ke==="")continue;const Le=String(ke).toUpperCase();Le==="PASS"?Ne++:Le==="FAIL"?re++:Le==="WARN"&&oe++}return{pass:Ne+oe,fail:re,warn:oe,judged:Ne+oe+re}}const M=Object.freeze({hhi:(ue,Ee)=>h(ue,Ee),entropy:(ue,Ee)=>v(ue,Ee),evenness:(ue,Ee)=>g(ue,Ee),top3Share:(ue,Ee)=>k(ue,Ee,3),top10Share:(ue,Ee)=>k(ue,Ee,10),gini:(ue,Ee)=>d(ue,Ee),trimmedMean:(ue,Ee)=>$(u(ue,Ee),.1),winsorizedMean:(ue,Ee)=>P(u(ue,Ee),.1),robustOutliers:(ue,Ee)=>N(u(ue,Ee),3.5),jarqueBera:(ue,Ee)=>T(u(ue,Ee)),variance:(ue,Ee)=>{const{n:be,m2:Ne}=p(u(ue,Ee));return be>1?Ne/(be-1):null},varianceP:(ue,Ee)=>{const{n:be,m2:Ne}=p(u(ue,Ee));return be>0?Ne/be:null},stddev:(ue,Ee)=>{const{n:be,m2:Ne}=p(u(ue,Ee));return be>1?Math.sqrt(Ne/(be-1)):null},stddevP:(ue,Ee)=>{const{n:be,m2:Ne}=p(u(ue,Ee));return be>0?Math.sqrt(Ne/be):null},median:(ue,Ee)=>{const be=u(ue,Ee);return be.length?O(be,.5):null},p25:(ue,Ee)=>{const be=u(ue,Ee);return be.length?O(be,.25):null},p75:(ue,Ee)=>{const be=u(ue,Ee);return be.length?O(be,.75):null},p90:(ue,Ee)=>{const be=u(ue,Ee);return be.length?O(be,.9):null},p95:(ue,Ee)=>{const be=u(ue,Ee);return be.length?O(be,.95):null},p99:(ue,Ee)=>{const be=u(ue,Ee);return be.length?O(be,.99):null},iqr:(ue,Ee)=>{const be=u(ue,Ee);if(!be.length)return null;const Ne=be.slice().sort();return b(Ne,.75)-b(Ne,.25)},mad:(ue,Ee)=>{const be=u(ue,Ee);if(!be.length)return null;const Ne=O(be,.5),re=new Float64Array(be.length);for(let oe=0;oe<be.length;oe++)re[oe]=Math.abs(be[oe]-Ne);return O(re,.5)},range:(ue,Ee)=>{const be=u(ue,Ee);if(!be.length)return null;let Ne=1/0,re=-1/0;for(let oe=0;oe<be.length;oe++)be[oe]<Ne&&(Ne=be[oe]),be[oe]>re&&(re=be[oe]);return re-Ne},distinct:(ue,Ee)=>{const be=q(ue),Ne=new Set;for(let re=0;re<Ee.length;re++){const oe=be(Ee[re]);oe==null||oe===""||Ne.add(oe instanceof Date?oe.getTime():oe)}return Ne.size},mode:(ue,Ee)=>{const be=q(ue),Ne=new Map;for(let we=0;we<Ee.length;we++){const ke=be(Ee[we]);if(ke==null||ke==="")continue;const Le=ke instanceof Date?ke.getTime():ke;Ne.set(Le,(Ne.get(Le)||0)+1)}let re=null,oe=1;for(const[we,ke]of Ne)ke>oe&&(oe=ke,re=we);return re},skewness:(ue,Ee)=>{const be=u(ue,Ee),{n:Ne,mean:re,m2:oe}=p(be);if(Ne<3||oe<=0)return null;const we=Math.sqrt(oe/(Ne-1));let ke=0;for(let Le=0;Le<be.length;Le++)ke+=((be[Le]-re)/we)**3;return Ne/((Ne-1)*(Ne-2))*ke},kurtosis:(ue,Ee)=>{const be=u(ue,Ee),{n:Ne,mean:re,m2:oe}=p(be);if(Ne<4||oe<=0)return null;const we=Math.sqrt(oe/(Ne-1));let ke=0;for(let Pe=0;Pe<be.length;Pe++)ke+=((be[Pe]-re)/we)**4;const Le=Ne*(Ne+1)/((Ne-1)*(Ne-2)*(Ne-3)),De=3*(Ne-1)**2/((Ne-2)*(Ne-3));return Le*ke-De},geomean:(ue,Ee)=>{const be=u(ue,Ee);if(!be.length)return null;let Ne=0;for(let re=0;re<be.length;re++){if(be[re]<=0)return null;Ne+=Math.log(be[re])}return Math.exp(Ne/be.length)},harmean:(ue,Ee)=>{const be=u(ue,Ee);if(!be.length)return null;let Ne=0;for(let re=0;re<be.length;re++){if(be[re]===0)return null;Ne+=1/be[re]}return be.length/Ne},sumSquares:(ue,Ee)=>{const be=u(ue,Ee);let Ne=0;for(let re=0;re<be.length;re++)Ne+=be[re]*be[re];return Ne},passRate:(ue,Ee)=>{const{pass:be,judged:Ne}=y(ue,Ee);return Ne?be/Ne:null},failureCount:(ue,Ee)=>y(ue,Ee).fail}),D=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 _(ue,Ee,be){const Ne=q(ue),re=q(Ee);let oe=0,we=0;for(let ke=0;ke<be.length;ke++){const Le=be[ke],De=Number(Ne(Le)),Pe=Number(re(Le));!Number.isFinite(De)||!Number.isFinite(Pe)||(oe+=De*Pe,we+=Pe)}return we===0?null:oe/we}function I(ue,Ee,be){const Ne=q(ue);let re=null,oe=be?-1/0:1/0;for(let we=0;we<Ee.length;we++){const ke=Ee[we],Le=Number(Ne(ke));Number.isFinite(Le)&&(be?Le>oe:Le<oe)&&(oe=Le,re=ke)}return re}function L(ue,Ee,be){const Ne=q(ue),re=q(Ee);let oe=0,we=0,ke=0,Le=0,De=0,Pe=0;for(let et=0;et<be.length;et++){const ft=be[et],dt=Number(Ne(ft)),ut=Number(re(ft));!Number.isFinite(dt)||!Number.isFinite(ut)||(oe++,we+=dt,ke+=ut,Le+=dt*dt,De+=ut*ut,Pe+=dt*ut)}if(oe<2)return null;const _e=oe*Pe-we*ke,qe=Math.sqrt((oe*Le-we*we)*(oe*De-ke*ke));if(qe===0)return null;const Qe=_e/qe;return Math.max(-1,Math.min(1,Qe))}function $(ue,Ee=.1){const be=ue.length;if(!be)return null;const Ne=Array.from(ue).sort((ke,Le)=>ke-Le),re=Math.floor(be*Math.min(.49,Math.max(0,Ee))),oe=Ne.slice(re,be-re);if(!oe.length)return b(Ne,.5);let we=0;for(const ke of oe)we+=ke;return we/oe.length}function P(ue,Ee=.1){const be=ue.length;if(!be)return null;const Ne=Array.from(ue).sort((Le,De)=>Le-De),re=Math.floor(be*Math.min(.49,Math.max(0,Ee))),oe=Ne[re],we=Ne[be-1-re];let ke=0;for(const Le of Ne)ke+=Math.min(we,Math.max(oe,Le));return ke/be}function N(ue,Ee=3.5){if(!ue.length)return null;const Ne=Array.from(ue).sort((Le,De)=>Le-De),re=b(Ne,.5),oe=Ne.map(Le=>Math.abs(Le-re)).sort((Le,De)=>Le-De),we=b(oe,.5);if(we===0)return null;let ke=0;for(const Le of Ne)Math.abs(.6745*(Le-re)/we)>Ee&&ke++;return ke}function T(ue){const Ee=ue.length;if(Ee<8)return null;let be=0;for(const Le of ue)be+=Le;be/=Ee;let Ne=0,re=0,oe=0;for(const Le of ue){const De=Le-be;Ne+=De*De,re+=De*De*De,oe+=De*De*De*De}if(Ne/=Ee,re/=Ee,oe/=Ee,Ne===0)return null;const we=re/Ne**1.5,ke=oe/(Ne*Ne)-3;return Ee/6*(we*we+ke*ke/4)}function E(ue,Ee,be){const Ne=[];let re=0;for(let Le=0;Le<ue.length;Le++){const De=Number(ue[Le]),Pe=Number(Ee[Le]);!Number.isFinite(De)||!Number.isFinite(Pe)||Pe<=0||(Ne.push([De,Pe]),re+=Pe)}if(!Ne.length||re<=0)return null;if(Ne.sort((Le,De)=>Le[0]-De[0]),Ne.length===1)return Ne[0][0];const oe=[];let we=0;for(const[,Le]of Ne)oe.push((we+Le/2)/re),we+=Le;const ke=Math.max(0,Math.min(1,be));if(ke<=oe[0])return Ne[0][0];if(ke>=oe[oe.length-1])return Ne[Ne.length-1][0];for(let Le=1;Le<oe.length;Le++){if(ke>oe[Le])continue;const De=oe[Le]-oe[Le-1],Pe=De>0?(ke-oe[Le-1])/De:0;return Ne[Le-1][0]+(Ne[Le][0]-Ne[Le-1][0])*Pe}return Ne[Ne.length-1][0]}function A(ue,Ee,be){const Ne=q(ue),re=q(Ee),oe=new Float64Array(be.length),we=new Float64Array(be.length);let ke=0;for(let Le=0;Le<be.length;Le++){const De=be[Le],Pe=Number(Ne(De)),_e=Number(re(De));!Number.isFinite(Pe)||!Number.isFinite(_e)||(oe[ke]=Pe,we[ke]=_e,ke++)}return{xs:oe.subarray(0,ke),ys:we.subarray(0,ke),n:ke}}function S(ue,Ee,be,Ne=!1){const{xs:re,ys:oe,n:we}=A(ue,Ee,be);if(we<2)return null;let ke=0,Le=0;for(let Pe=0;Pe<we;Pe++)ke+=re[Pe],Le+=oe[Pe];ke/=we,Le/=we;let De=0;for(let Pe=0;Pe<we;Pe++)De+=(re[Pe]-ke)*(oe[Pe]-Le);return De/(Ne?we:we-1)}function x(ue,Ee,be){const{xs:Ne,ys:re,n:oe}=A(ue,Ee,be);if(oe<2)return null;let we=0,ke=0;for(let dt=0;dt<oe;dt++)we+=Ne[dt],ke+=re[dt];we/=oe,ke/=oe;let Le=0,De=0,Pe=0;for(let dt=0;dt<oe;dt++){const ut=Ne[dt]-we,Ct=re[dt]-ke;Le+=ut*ut,De+=ut*Ct,Pe+=Ct*Ct}if(Le===0)return null;const _e=De/Le,qe=ke-_e*we,Qe=Pe===0?1:Math.max(0,Math.min(1,De*De/(Le*Pe))),et=Math.max(0,Pe-_e*De),ft=oe>2?Math.sqrt(et/(oe-2)/Le):0;return{slope:_e,intercept:qe,r2:Qe,stdError:ft,n:oe}}const W=new Set(["ols","wls","robust"]),V=new Set(["quantile"]),G=new Set(["ridge","lasso","elasticnet","mixed","gls"]),Q=1.345;function ee(ue,Ee,be){const{xtwx:Ne,xtwy:re}=c(ue,Ee,be),oe=j(Ne);if(!oe)return null;const we=w(oe,re),ke=m(oe),Le=ne(ue,we),De=Ee.map((Pe,_e)=>Pe-Le[_e]);return{beta:we,cov:ke,fitted:Le,residuals:De}}function ne(ue,Ee){return ue.map(be=>be.reduce((Ne,re,oe)=>Ne+re*Ee[oe],0))}function se(ue,Ee){const be=ue.length,Ne=ue.map(De=>De[Ee]),re=ue.map(De=>[1,...De.filter((Pe,_e)=>_e!==Ee)]),oe=ee(re,Ne,null);if(!oe)return 1;const we=Ne.reduce((De,Pe)=>De+Pe,0)/be;let ke=0,Le=0;for(let De=0;De<be;De++)ke+=oe.residuals[De]**2,Le+=(Ne[De]-we)**2;return Le===0?1:Math.max(0,Math.min(1,1-ke/Le))}function le(ue){const Ee=[...ue].sort((re,oe)=>re-oe),be=me(Ee),Ne=ue.map(re=>Math.abs(re-be)).sort((re,oe)=>re-oe);return me(Ne)/.6745}function me(ue){const Ee=ue.length;if(!Ee)return 0;const be=Math.floor(Ee/2);return Ee%2?ue[be]:(ue[be-1]+ue[be])/2}function ve(ue,Ee,be={}){const Ne=be.method||"ols";if(G.has(Ne))throw new Error(`[lattice] regression method "${Ne}" is out of scope; use ols, wls or robust.`);if(V.has(Ne))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!W.has(Ne))throw new Error(`[lattice] unknown regression method "${Ne}"; use ols, wls or robust.`);const re=Array.isArray(Ee)?Ee.length:0,oe=re&&Array.isArray(ue[0])?ue[0].length:0,we=oe+1;if(!(re>we))return null;for(let Dt=0;Dt<re;Dt++){if(!Number.isFinite(Ee[Dt])||!Array.isArray(ue[Dt])||ue[Dt].length!==oe)return null;for(let Bt=0;Bt<oe;Bt++)if(!Number.isFinite(ue[Dt][Bt]))return null}let ke=null;if(Ne==="wls"){if(ke=be.weights,!Array.isArray(ke)||ke.length!==re)return null;for(let Dt=0;Dt<re;Dt++)if(!(ke[Dt]>0)||!Number.isFinite(ke[Dt]))return null}const Le=ue.map(Dt=>[1,...Dt]);let De,Pe=null;if(Ne==="robust"){if(De=ee(Le,Ee,null),!De)return null;for(let Dt=0;Dt<50;Dt++){const Bt=le(De.residuals);if(!(Bt>0))break;const zt=De.residuals.map(Jt=>{const qt=Math.abs(Jt/Bt);return qt<=Q?1:Q/qt}),Yt=ee(Le,Ee,zt);if(!Yt)return null;const Qt=Yt.beta.reduce((Jt,qt,rn)=>Math.max(Jt,Math.abs(qt-De.beta[rn])),0);if(De=Yt,Pe=zt,Qt<1e-10)break}}else if(De=ee(Le,Ee,ke),!De)return null;const _e=Ne==="robust"?Pe:ke,{beta:qe,cov:Qe,fitted:et,residuals:ft}=De;let dt=0,ut=0,Ct=0;for(let Dt=0;Dt<re;Dt++){const Bt=_e?_e[Dt]:1;dt+=Bt*ft[Dt]**2,ut+=Bt,Ct+=Bt*Ee[Dt]}const Mt=Ct/ut;let xt=0;for(let Dt=0;Dt<re;Dt++){const Bt=_e?_e[Dt]:1;xt+=Bt*(Ee[Dt]-Mt)**2}const Ye=re-we,mt=dt/Ye,gt=xt===0?1:Math.max(0,Math.min(1,1-dt/xt)),St=1-(1-gt)*(re-1)/Ye,Rt=Array.isArray(be.names)&&be.names.length===oe?be.names:ue[0].map((Dt,Bt)=>`x${Bt+1}`),vt=it(be.confidence),bt=Ye>0?B(1-(1-vt)/2,Ye):1/0,Lt=qe.map((Dt,Bt)=>{const zt=Math.sqrt(Math.max(0,mt*Qe[Bt][Bt])),Yt=zt>0?Dt/zt:Dt===0?0:1/0,Qt=Number.isFinite(Yt)?2*(1-Z(Math.abs(Yt),Ye)):0,Jt=Number.isFinite(bt)?bt*zt:null;return{name:Bt===0?"(intercept)":Rt[Bt-1],estimate:Dt,stdError:zt,t:Yt,p:Math.max(0,Math.min(1,Qt)),lower:Jt===null?null:Dt-Jt,upper:Jt===null?null:Dt+Jt}}),Ht=new Array(re),Xt=new Array(re);for(let Dt=0;Dt<re;Dt++){const Bt=_e?_e[Dt]:1,zt=Math.max(0,Math.min(1,Bt*f(Le[Dt],Qe)));Ht[Dt]=zt;const Yt=(1-zt)**2;Xt[Dt]=Yt>0&&mt>0?ft[Dt]**2/(we*mt)*(zt/Yt):null}const mn=ue[0].map((Dt,Bt)=>{if(oe<2)return 1;const zt=se(ue,Bt);return zt>=1?1/0:1/(1-zt)});let dn=null;{const Dt=ft.map(zt=>zt*zt),Bt=ee(Le,Dt,null);if(Bt){const zt=Dt.reduce((en,gn)=>en+gn,0)/re;let Yt=0,Qt=0;for(let en=0;en<re;en++)Yt+=Bt.residuals[en]**2,Qt+=(Dt[en]-zt)**2;const Jt=Qt===0?0:Math.max(0,Math.min(1,1-Yt/Qt)),qt=re*Jt,rn=X(qt,oe);dn={statistic:qt,df:oe,p:rn,heteroscedastic:rn<.05}}}let an=null;if(oe===1){const Dt=ue.map((Bt,zt)=>zt).sort((Bt,zt)=>ue[Bt][0]-ue[zt][0]);an={confidence:vt,points:Dt.map(Bt=>{const zt=Le[Bt],Yt=Math.sqrt(Math.max(0,mt*f(zt,Qe)));return{x:ue[Bt][0],yhat:et[Bt],lower:et[Bt]-bt*Yt,upper:et[Bt]+bt*Yt}})}}return{method:Ne,coefficients:Lt,r2:gt,adjR2:St,n:re,df:Ye,sigma2:mt,fitted:et,residuals:ft,leverage:Ht,cooksD:Xt,vif:mn,heteroscedasticity:dn,band:an,weights:_e?[..._e]:null}}function fe(ue){const Ee=ue.length,be=Array.from({length:Ee},(oe,we)=>we).sort((oe,we)=>ue[oe]-ue[we]),Ne=new Float64Array(Ee);let re=0;for(;re<Ee;){let oe=re;for(;oe+1<Ee&&ue[be[oe+1]]===ue[be[re]];)oe++;const we=(re+oe)/2+1;for(let ke=re;ke<=oe;ke++)Ne[be[ke]]=we;re=oe+1}return Ne}const xe=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function He(ue){const Ee=[.01,.05,.1],be=[xe["1%"],xe["5%"],xe["10%"]];if(ue<=be[0]){const oe=(Math.log(Ee[1])-Math.log(Ee[0]))/(be[1]-be[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(Ee[0])+oe*(ue-be[0]))))}if(ue>=be[2]){const oe=(Math.log(Ee[2])-Math.log(Ee[1]))/(be[2]-be[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(Ee[2])+oe*(ue-be[2]))))}const Ne=ue<be[1]?0:1,re=(ue-be[Ne])/(be[Ne+1]-be[Ne]);return Math.exp(Math.log(Ee[Ne])+re*(Math.log(Ee[Ne+1])-Math.log(Ee[Ne])))}function Be(ue,Ee,be,Ne){const re=be-Ne,oe=Ne+3,we=new Array(re),ke=new Array(re);let Le=!0,De=Ne;for(let et=0;et<re;et++){const ft=Ne+et,dt=new Float64Array(oe);dt[0]=1,dt[1]=et+1,dt[2]=ue[ft];for(let ut=1;ut<=Ne;ut++)dt[2+ut]=Ee[ft-ut];for(let ut=1;ut<oe;ut++)Number.isFinite(dt[ut])||(De=Math.min(De,ut-3));we[et]=dt,ke[et]=Ee[ft],Number.isFinite(ke[et])||(Le=!1)}if(!Le)return 0;const{xtwx:Pe,xtwy:_e}=c(we,ke,null);let qe=0,Qe=1/0;for(let et=0;et<=De;et++){const ft=et+3;if(!(re>ft))continue;const dt=new Array(ft);for(let gt=0;gt<ft;gt++)dt[gt]=Pe[gt].slice(0,ft);const ut=j(dt);if(!ut)continue;const Ct=w(ut,_e.slice(0,ft));let Mt=0;for(let gt=0;gt<re;gt++){const St=we[gt];let Rt=0;for(let vt=0;vt<ft;vt++)Rt+=St[vt]*Ct[vt];Mt+=(ke[gt]-Rt)**2}const Ye=Mt/(re-ft)*(re-ft);if(!(Ye>0))continue;const mt=re*Math.log(Ye/re)+2*ft;mt<Qe&&(Qe=mt,qe=et)}return qe}function ae(ue,Ee={}){const be=[];for(let Qe=0;Qe<ue.length;Qe++){const et=Number(ue[Qe]);Number.isFinite(et)&&be.push(et)}const Ne=be.length,re=Ne-1;if(Ne<8||re<6)return null;const oe=new Array(re);for(let Qe=0;Qe<re;Qe++)oe[Qe]=be[Qe+1]-be[Qe];let we=Number.isFinite(Ee.maxlag)?Math.floor(Ee.maxlag):Math.ceil(12*(Ne/100)**.25);we=Math.max(0,Math.min(we,Math.floor((re-5)/2)));const ke=(Qe,et)=>{const ft=[],dt=[];for(let ut=et;ut<re;ut++){const Ct=[ut-et+1,be[ut]];for(let Mt=1;Mt<=Qe;Mt++)Ct.push(oe[ut-Mt]);ft.push(Ct),dt.push(oe[ut])}return ve(ft,dt,{method:"ols"})},Le=Be(be,oe,re,we),De=ke(Le,Le);if(!De||!De.coefficients[2])return null;const Pe=De.coefficients[2].t,_e=He(Pe),qe=Pe<xe["5%"];return{statistic:Pe,usedLag:Le,nobs:re-Le,criticalValues:{...xe},pValue:_e,pApproximate:!0,stationary:qe,verdict:qe?"stationary":"non-stationary",regression:"ct"}}function Ae(ue,Ee={}){const be=[];for(let qe=0;qe<ue.length;qe++){const Qe=Number(ue[qe]);Number.isFinite(Qe)&&be.push(Qe)}const Ne=be.length;if(Ne<3)return null;let re=Number.isFinite(Ee.maxlag)?Math.floor(Ee.maxlag):Math.min(10,Ne-1);re=Math.max(1,Math.min(re,Ne-1));let oe=0;for(const qe of be)oe+=qe;oe/=Ne;const we=be.map(qe=>qe-oe);let ke=0;for(const qe of we)ke+=qe*qe;ke/=Ne;const Le=new Array(re+1).fill(0);Le[0]=1;for(let qe=1;qe<=re;qe++){let Qe=0;for(let et=qe;et<Ne;et++)Qe+=we[et]*we[et-qe];Le[qe]=ke>0?Qe/Ne/ke:0}const De=new Array(re+1).fill(0);De[0]=1;let Pe=[];for(let qe=1;qe<=re;qe++){let Qe=Le[qe];for(let ut=1;ut<qe;ut++)Qe-=Pe[ut-1]*Le[qe-ut];let et=1;for(let ut=1;ut<qe;ut++)et-=Pe[ut-1]*Le[ut];const ft=et!==0?Qe/et:0,dt=new Array(qe);for(let ut=1;ut<qe;ut++)dt[ut-1]=Pe[ut-1]-ft*Pe[qe-1-ut];dt[qe-1]=ft,De[qe]=ft,Pe=dt}const _e=1.96/Math.sqrt(Ne);return{acf:Le,pacf:De,bounds:{upper:_e,lower:-_e},n:Ne,nlags:re,approximate:!0}}function Me(ue,Ee,be){const{xs:Ne,ys:re,n:oe}=A(ue,Ee,be);if(oe<2)return null;const we=fe(Ne),ke=fe(re);let Le=0,De=0;for(let Qe=0;Qe<oe;Qe++)Le+=we[Qe],De+=ke[Qe];Le/=oe,De/=oe;let Pe=0,_e=0,qe=0;for(let Qe=0;Qe<oe;Qe++){const et=we[Qe]-Le,ft=ke[Qe]-De;Pe+=et*ft,_e+=et*et,qe+=ft*ft}return _e===0||qe===0?null:Math.max(-1,Math.min(1,Pe/Math.sqrt(_e*qe)))}function Re(ue,Ee,be){const{xs:Ne,ys:re,n:oe}=A(ue,Ee,be);if(oe<2||oe>t)return null;let we=0,ke=0,Le=0,De=0;for(let qe=0;qe<oe;qe++)for(let Qe=qe+1;Qe<oe;Qe++){const et=Math.sign(Ne[qe]-Ne[Qe]),ft=Math.sign(re[qe]-re[Qe]),dt=et*ft;dt>0?we++:dt<0?ke++:et===0&&ft===0||(et===0?Le++:De++)}const Pe=we+ke+De,_e=we+ke+Le;return Pe===0||_e===0?null:(we-ke)/Math.sqrt(Pe*_e)}function pe(ue,Ee={}){const be=ue.length;if(be<2)return null;const Ne=ue[0],re=ue[be-1],oe=[];for(let ut=1;ut<be;ut++){const Ct=ue[ut-1];Ct!==0&&oe.push((ue[ut]-Ct)/Math.abs(Ct))}let we=null;if(oe.length>1){let ut=0;for(const Mt of oe)ut+=Mt;ut/=oe.length;let Ct=0;for(const Mt of oe)Ct+=(Mt-ut)**2;we=Math.sqrt(Ct/(oe.length-1))}const ke=Number(Ee.periodsPerYear)>0?Number(Ee.periodsPerYear):null;let Le=ue[0],De=0,Pe=0,_e=0,qe=0;for(let ut=1;ut<be;ut++){if(ue[ut]>Le){Le=ue[ut],De=ut;continue}if(Le<=0)continue;const Ct=(Le-ue[ut])/Le;Ct>Pe&&(Pe=Ct,_e=De,qe=ut)}let Qe=null;if(be>2){let ut=0;for(let xt=0;xt<be;xt++)ut+=ue[xt];ut/=be;let Ct=0,Mt=0;for(let xt=0;xt<be;xt++){const Ye=ue[xt]-ut;Mt+=Ye*Ye,xt>0&&(Ct+=Ye*(ue[xt-1]-ut))}Qe=Mt>0?Ct/Mt:null}let et=0,ft=0;for(const ut of oe)ut>0?et++:ut<0&&ft++;let dt=null;if(Ne>0&&re>0){const ut=(re/Ne)**(1/(be-1))-1;dt=ke?(1+ut)**ke-1:ut}return{n:be,first:Ne,last:re,change:re-Ne,changePercent:Ne===0?null:(re-Ne)/Math.abs(Ne)*100,volatility:we,annualisedVolatility:we!==null&&ke?we*Math.sqrt(ke):null,growth:dt,maxDrawdown:Pe,maxDrawdownFrom:_e,maxDrawdownTo:qe,autocorrelation:Qe,upDays:et,downDays:ft}}const $e=1.128,ce=3.267;function ge(ue){const Ee=ue.length;if(Ee<2)return null;const be=[];for(let re=1;re<Ee;re++)be.push(Math.abs(ue[re]-ue[re-1]));const Ne=be.reduce((re,oe)=>re+oe,0)/be.length;return{ranges:be,centre:Ne,upper:ce*Ne,lower:0}}function je(ue){const Ee=ue.length;if(Ee<2)return null;let be=0;for(let re=1;re<Ee;re++)be+=Math.abs(ue[re]-ue[re-1]);const Ne=be/(Ee-1);return{sigma:Ne/$e,meanRange:Ne}}function Ve(ue,Ee){const be=ue.length;if(be<2||!Ee)return null;const Ne=Number.isFinite(Number(Ee.lower))?Number(Ee.lower):null,re=Number.isFinite(Number(Ee.upper))?Number(Ee.upper):null;if(Ne===null&&re===null)return null;let oe=0;for(let et=0;et<be;et++)oe+=ue[et];oe/=be;let we=0;for(let et=0;et<be;et++)we+=(ue[et]-oe)**2;const ke=Math.sqrt(we/(be-1)),Le=je(ue),De=Le?Le.sigma:null,Pe=et=>{if(!et||et<=0)return{index:null,k:null};const dt=Ne!==null&&re!==null?(re-Ne)/(6*et):null,ut=re!==null?(re-oe)/(3*et):1/0,Ct=Ne!==null?(oe-Ne)/(3*et):1/0;return{index:dt,k:Math.min(ut,Ct)}},_e=Pe(De),qe=Pe(ke);let Qe=0;for(let et=0;et<be;et++){if(Ne!==null&&ue[et]<Ne){Qe++;continue}re!==null&&ue[et]>re&&Qe++}return{n:be,mean:oe,lower:Ne,upper:re,target:Number.isFinite(Number(Ee.target))?Number(Ee.target):null,sigmaWithin:De,sigmaOverall:ke,cp:_e.index,cpk:_e.k,pp:qe.index,ppk:qe.k,outOfSpec:Qe,defectRate:be?Qe/be:null}}function Se(ue){const Ee=ue.length;if(Ee<2)return null;const be=je(ue);if(!be||!(be.sigma>0))return null;let Ne=0;for(let re=0;re<Ee;re++)Ne+=ue[re];return Ne/=Ee,{centre:Ne,sigma:be.sigma,upper:Ne+3*be.sigma,lower:Ne-3*be.sigma}}function Ge(ue,Ee){if(!Ee||!(Ee.sigma>0))return[];const be=ue.length,{centre:Ne,sigma:re}=Ee,oe=ke=>(ue[ke]-Ne)/re,we=[];for(let ke=0;ke<be;ke++){if(Math.abs(oe(ke))>3&&we.push({index:ke,rule:1,description:"beyond three sigma"}),ke>=2)for(const Le of[1,-1]){let De=0;for(let Pe=ke-2;Pe<=ke;Pe++)oe(Pe)*Le>2&&De++;if(De>=2){we.push({index:ke,rule:2,description:"two of three past two sigma"});break}}if(ke>=4)for(const Le of[1,-1]){let De=0;for(let Pe=ke-4;Pe<=ke;Pe++)oe(Pe)*Le>1&&De++;if(De>=4){we.push({index:ke,rule:3,description:"four of five past one sigma"});break}}if(ke>=7)for(const Le of[1,-1]){let De=!0;for(let Pe=ke-7;Pe<=ke;Pe++)if(oe(Pe)*Le<=0){De=!1;break}if(De){we.push({index:ke,rule:4,description:"eight in a row on one side"});break}}}return we}function Ce(ue,Ee){if(!Ee||!(Ee.sigma>0))return[];const be=ue.length,{centre:Ne,sigma:re}=Ee,oe=Le=>(ue[Le]-Ne)/re,we=(Le,De,Pe,_e)=>{for(const qe of[1,-1]){let Qe=0;for(let et=Le;et<=De;et++)oe(et)*qe>Pe&&Qe++;if(Qe>=_e)return!0}return!1},ke=[];for(let Le=0;Le<be;Le++){if(Math.abs(oe(Le))>3&&ke.push({index:Le,rule:1,description:"beyond three sigma"}),Le>=8)for(const De of[1,-1]){let Pe=!0;for(let _e=Le-8;_e<=Le;_e++)if(oe(_e)*De<=0){Pe=!1;break}if(Pe){ke.push({index:Le,rule:2,description:"nine in a row on one side"});break}}if(Le>=5)for(const De of[1,-1]){let Pe=!0;for(let _e=Le-4;_e<=Le;_e++)if((ue[_e]-ue[_e-1])*De<=0){Pe=!1;break}if(Pe){ke.push({index:Le,rule:3,description:De>0?"six rising":"six falling"});break}}if(Le>=13){let De=!0;for(let Pe=Le-12;Pe<=Le;Pe++){const _e=ue[Pe]-ue[Pe-1],qe=ue[Pe+1<=Le?Pe+1:Pe]-ue[Pe];if(Pe+1>Le)break;if(_e===0||qe===0||_e>0==qe>0){De=!1;break}}De&&ke.push({index:Le,rule:4,description:"fourteen alternating"})}if(Le>=2&&we(Le-2,Le,2,2)&&ke.push({index:Le,rule:5,description:"two of three past two sigma"}),Le>=4&&we(Le-4,Le,1,4)&&ke.push({index:Le,rule:6,description:"four of five past one sigma"}),Le>=14){let De=!0;for(let Pe=Le-14;Pe<=Le;Pe++)if(Math.abs(oe(Pe))>=1){De=!1;break}De&&ke.push({index:Le,rule:7,description:"fifteen within one sigma"})}if(Le>=7){let De=!0;for(let Pe=Le-7;Pe<=Le;Pe++)if(Math.abs(oe(Pe))<=1){De=!1;break}De&&ke.push({index:Le,rule:8,description:"eight beyond one sigma"})}}return ke}const Te=Object.freeze(["westernElectric","nelson"]);function ze(ue,Ee,be="westernElectric"){return String(be)==="nelson"?Ce(ue,Ee):Ge(ue,Ee)}function Ke(ue,Ee,be){let Ne=0;for(let re=0;re<ue.length;re++)(ue[re]<Ee||ue[re]>be)&&Ne++;return Ne}function Ze(ue,Ee,be,Ne=20){const re=ue.length;if(!re)return[];const oe=ue[0],we=ue[re-1];if(we===oe)return[{from:oe,to:we,count:re}];const ke=be-Ee,Le=1.5*ke;let De=ke>0?Math.max(oe,Ee-Le):oe,Pe=ke>0?Math.min(we,be+Le):we;Pe>De||(De=oe,Pe=we);const _e=ke>0?2*ke/Math.cbrt(re):(Pe-De)/(Math.ceil(Math.log2(re))+1),qe=_e>0?Math.min(Ne,Math.max(1,Math.ceil((Pe-De)/_e))):1,Qe=(Pe-De)/qe,et=[];for(let ft=0;ft<qe;ft++)et.push({from:De+ft*Qe,to:De+(ft+1)*Qe,count:0});for(let ft=0;ft<re;ft++){const dt=Math.min(qe-1,Math.max(0,Math.floor((ue[ft]-De)/Qe)));et[dt].count++}return et[0].from=oe,et[qe-1].to=we,et}const nt=.95;function it(ue){const Ee=Number(ue);return Number.isFinite(Ee)&&Ee>0&&Ee<1?Ee:nt}function wt(ue,Ee=nt){const be=ue.length;if(be<2)return null;let Ne=0;for(let Pe=0;Pe<be;Pe++)Ne+=ue[Pe];const re=Ne/be;let oe=0;for(let Pe=0;Pe<be;Pe++){const _e=ue[Pe]-re;oe+=_e*_e}const we=Math.sqrt(oe/(be-1)),ke=it(Ee),De=B(1-(1-ke)/2,be-1)*we/Math.sqrt(be);return{mean:re,lower:re-De,upper:re+De,margin:De,n:be,confidence:ke}}function ht(ue,Ee,be=nt){const Ne=Number(ue),re=Number(Ee);if(!(re>0)||!(Ne>=0)||Ne>re)return null;const oe=it(be),we=K(1-(1-oe)/2),ke=Ne/re,Le=we*we,De=1+Le/re,Pe=(ke+Le/(2*re))/De,_e=we/De*Math.sqrt(ke*(1-ke)/re+Le/(4*re*re));return{proportion:ke,lower:Math.max(0,Pe-_e),upper:Math.min(1,Pe+_e),n:re,confidence:oe}}function Ot(ue,Ee=nt){if(!ue||!(ue.n>2)||!Number.isFinite(ue.stdError))return null;const be=it(Ee),re=B(1-(1-be)/2,ue.n-2)*ue.stdError;return{slope:ue.slope,lower:ue.slope-re,upper:ue.slope+re,margin:re,confidence:be}}function Pt(ue,Ee,be=nt){const Ne=Number(ue),re=Number(Ee);if(!Number.isFinite(Ne)||!(re>1))return null;const oe=it(be),ke=K(1-(1-oe)/2)*Math.sqrt(1/(9*re)+Ne*Ne/(2*(re-1)));return{index:Ne,lower:Ne-ke,upper:Ne+ke,margin:ke,n:re,confidence:oe}}function Nt(ue,Ee){return!ue||!(ue.sd>0)||!Number.isFinite(Ee)||!Number.isFinite(ue.mean)?null:(Ee-ue.mean)/ue.sd}function ct(ue){return Number.isFinite(ue)?Math.min(1,Math.max(0,2*F(Math.abs(ue)/2)-1)):0}function lt(ue,Ee){const be=new Map,Ne=q(ue);let re=0;for(let oe=0;oe<Ee.length;oe++){const we=Ne(Ee[oe]);if(we==null||we===""||typeof we=="number"&&Number.isNaN(we))continue;const ke=we instanceof Date?we.getTime():typeof we=="object"?String(we):we;be.set(ke,(be.get(ke)||0)+1),re++}return{map:be,total:re}}function yt(ue,Ee,be,Ne){if(!(Ee>0)||!(Ne>0))return null;let re=0;const oe=new Set(ue.keys());for(const we of be.keys())oe.add(we);for(const we of oe){const ke=(ue.get(we)||0)/Ee,Le=(be.get(we)||0)/Ne;re+=Math.abs(ke-Le)}return re/2}const Tt=10;function at(ue,Ee,be){if(be&&be.numeric){const ke=u(ue,Ee),{n:Le,mean:De}=p(ke),Pe=Le>0?Nt({mean:be.mean,sd:be.sd},De):null;return{measure:"standardizedMeanDifference",magnitude:Pe,distance:Pe===null?0:ct(Pe),direction:Pe===null?0:Math.sign(Pe),subsetN:Le,populationN:be.n||0,reliable:Le>=Tt}}const{map:re,total:oe}=lt(ue,Ee),we=yt(re,oe,be.map,be.total);return{measure:"categoricalTotalVariation",magnitude:we,distance:we===null?0:we,direction:0,subsetN:oe,populationN:be.total||0,reliable:oe>=Tt}}function ye(ue,Ee){if(ue&&(ue.kind==="float64"||ue.kind==="int32"))return!0;const be=q(ue);let Ne=0,re=0;for(let oe=0;oe<Ee.length&&Ne<200;oe++){const we=be(Ee[oe]);if(we==null||we==="")continue;if(we instanceof Date)return!1;Ne++;const ke=typeof we=="number"?we:Number(we);Number.isFinite(ke)&&re++}return Ne===0?!1:re/Ne>=.9}function Oe(ue,Ee){if(ye(ue,Ee)){const re=u(ue,Ee),{n:oe,mean:we,m2:ke}=p(re);return{numeric:!0,mean:we,sd:oe>0?Math.sqrt(ke/oe):0,n:oe}}const{map:be,total:Ne}=lt(ue,Ee);return{numeric:!1,map:be,total:Ne}}}),Ue("packages/core/src/compute/total.js",function(e,U){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"aggregatesFor",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"aggregateAllowed",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return p}});const C=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce,B=U("packages/core/src/compute/handle.js"),Z=B.presenceReader,K=B.valueComparator,F=B.valueReader,X=U("packages/core/src/compute/statistics.js"),H=X.STAT_FNS,j=X.STAT_LABELS;function w(b){return!!b&&(b.kind==="float64"||b.kind==="int32")}function m(b,O){const y=O.length;let M=0;if(w(b)){const _=b.values,I=Z(b);if(!I){for(let L=0;L<y;L++){const $=_[O[L]];Number.isNaN($)||(M+=$)}return M}for(let L=0;L<y;L++){const $=O[L];if(I($)===1){const P=_[$];Number.isNaN(P)||(M+=P)}}return M}const D=F(b);for(let _=0;_<y;_++){const I=u(D(O[_]));I!==null&&(M+=I)}return M}m.kernel=!0;function c(b,O){const y=O.length;let M=0;if(w(b)){const _=b.values,I=Z(b);if(!I){for(let L=0;L<y;L++)Number.isNaN(_[O[L]])||M++;return M}for(let L=0;L<y;L++){const $=O[L];I($)===1&&!Number.isNaN(_[$])&&M++}return M}const D=F(b);for(let _=0;_<y;_++){const I=D(O[_]);I!=null&&!(typeof I=="number"&&Number.isNaN(I))&&M++}return M}c.kernel=!0;function f(b,O){return O.length}f.kernel=!0;function l(b,O){const y=c(b,O);return y===0?null:m(b,O)/y}l.kernel=!0;function r(b,O,y,M){const D=O.length;if(w(b)){const $=b.values,P=Z(b);let N=null;if(!P){for(let T=0;T<D;T++){const E=$[O[T]];Number.isNaN(E)||(N===null||(y<0?E<N:E>N))&&(N=E)}return N}for(let T=0;T<D;T++){const E=O[T];if(P(E)===0)continue;const A=$[E];Number.isNaN(A)||(N===null||(y<0?A<N:A>N))&&(N=A)}return N}const _=F(b),I=K(M);let L=null;for(let $=0;$<D;$++){const P=_(O[$]);P==null||typeof P=="number"&&Number.isNaN(P)||(L===null||(y<0?I(P,L)<0:I(P,L)>0))&&(L=P)}return L}function t(b,O,y){return r(b,O,-1,y&&y.locale)}t.kernel=!0;function i(b,O,y){return r(b,O,1,y&&y.locale)}i.kernel=!0;function s(b,O){return O.length===0?null:F(b)(O[0])}s.kernel=!0;function n(b,O){return O.length===0?null:F(b)(O[O.length-1])}n.kernel=!0;function u(b){if(typeof b=="number")return Number.isNaN(b)?null:b;if(b==null||b===""||typeof b=="boolean")return null;if(b instanceof Date)return b.getTime();const O=Number(b);return Number.isNaN(O)?null:O}const o={sum:m,min:t,max:i,avg:l,count:f,first:s,last:n,countValues:c,...H},a=Object.freeze({...j,sum:"Sum",avg:"Average",min:"Min",max:"Max",count:"Count",countValues:"Count of values",first:"First",last:"Last"});function h(b){return b?typeof b=="string"?a[b]||b:"Total":""}const v=Object.freeze(["sum","avg","min","max","count","countValues","first","last"]);function g(b){const O=b&&b.dataType&&b.dataType.totals&&b.dataType.totals.supported;if(Array.isArray(O))return O.slice();const y=v.filter(M=>M in o);for(const M of Object.keys(o))y.includes(M)||y.push(M);return y}function k(b,O){return typeof O!="string"?!0:g(b).includes(O)}function d(b,O){const y=F(b),M=[];for(let D=0;D<O.length;D++){const _=y(O[D]);_!=null&&M.push(_)}return M}function p(b,O,y,M){const D=O||[];if(typeof y=="string"){const _=o[y];return _?_(b,D,M):(z(`total:${y}`,`unknown total function "${y}"; register it in config.totalFns`),null)}return C(y)?y.kernel===!0?y(b,D,M):y(d(b,D),M||{}):null}}),Ue("packages/core/src/compute/windowed.js",function(e,U){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const C=U("packages/core/src/compute/sketch.js").Welford;class q{#e;#t;#n=[];#r;#s;constructor(F,X=0,H=Date.now){if(F!=="count"&&F!=="time"&&F!=="session")throw new RangeError(`unknown window kind: ${F}`);if((F==="count"||F==="time")&&!(X>0))throw new RangeError(`a ${F} window needs a positive span`);this.#e=F,this.#t=Math.floor(X),this.#r=H,this.#s=H()}get size(){return this.#n.length}push(F,X=this.#r()){Number.isFinite(F)&&(this.#n.push({t:X,v:F}),this.#i(X))}#i(F){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const X=F-this.#t;for(;this.#n.length&&this.#n[0].t<X;)this.#n.shift()}}spec(){const F=this.#e==="session"?this.#r()-this.#s:this.#t;return{kind:this.#e,span:F,size:this.#n.length}}values(){return this.#n.map(F=>F.v)}aggregate(){const F=this.spec();if(!this.#n.length)return{over:F,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const X=new C;let H=0,j=1/0,w=-1/0;for(const{v:m}of this.#n)H+=m,m<j&&(j=m),m>w&&(w=m),X.add(m);return{over:F,count:this.#n.length,sum:H,mean:X.mean(),min:j,max:w,variance:X.variance(),stddev:X.stddev()}}reduce(F){const X=this.aggregate(),H={sum:X.sum,avg:X.mean,mean:X.mean,min:X.min,max:X.max,count:X.count,variance:X.variance,stddev:X.stddev};if(!(F in H))throw new RangeError(`unknown windowed aggregate: ${F}`);return{value:H[F],over:X.over}}}const z=Object.freeze(["count","time","session"]);function B(K,F=Date.now){const X=K.kind==="time"&&K.minutes!=null?K.minutes*6e4:K.span??0;return new q(K.kind,X,F)}const Z={Window:q,WINDOW_KINDS:z,openWindow:B}}),Ue("packages/core/src/compute/rolling.js",function(e,U){"use strict";Object.defineProperty(e,"ROLLING_WINDOW_FIELDS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"rollingWindow",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"rollingQuantile",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"seasonalDecompose",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"exponentialSmoothing",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});const C=U("packages/core/src/compute/windowed.js").openWindow,z=U("packages/core/src/compute/sketch.js").KLL,B=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function Z(o,a,h,v){if(o.kind==="count"){const g=Math.max(1,Math.floor(o.span||0));return{coverage:Math.min(1,a/g),partial:a<g}}if(o.kind==="time"){const g=o.minutes!=null?o.minutes*6e4:o.span||0;if(!(g>0))return{coverage:1,partial:!1};const k=h-v;return{coverage:Math.min(1,k/g),partial:k<g}}return{coverage:null,partial:!1}}function K(o,a){const h=C(a),v=new Map,g=o.length?o[0].at:0;for(let k=0;k<o.length;k++){const{key:d,at:p,value:b}=o[k];Number.isFinite(b)&&h.push(b,p);const O=h.aggregate(),y=Z(a,O.count,p,g);d!=null&&v.set(String(d),{sum:O.sum,avg:O.mean,min:O.min,max:O.max,count:O.count,coverage:y.coverage,partial:y.partial})}return v}function F(o){const a=new Map;let h=0;for(const{key:v,value:g}of o)Number.isFinite(g)&&(h+=g),v!=null&&a.set(String(v),h);return a}function X(o,a=1){const h=new Map,v=Math.max(1,Math.floor(a));for(let g=0;g<o.length;g++){const{key:k,value:d}=o[g];if(k==null)continue;const p=g>=v?o[g-v].value:null,b=Number.isFinite(d)?d:null,O=Number.isFinite(p)?p:null;h.set(String(k),b!==null&&O!==null?b-O:null)}return h}const H=4096;function j(o){let a=o>>>0;return()=>{a+=1831565813;let h=a;return h=Math.imul(h^h>>>15,h|1),h^=h+Math.imul(h^h>>>7,h|61),((h^h>>>14)>>>0)/4294967296}}function w(o,a){const h=o.length;if(h===1)return o[0];const v=(h-1)*a,g=Math.floor(v),k=Math.ceil(v);return g===k?o[g]:o[g]+(v-g)*(o[k]-o[g])}function m(o,a,h={}){const v=Math.min(1,Math.max(0,h.q==null?.5:h.q)),g=Math.max(1,Math.floor(h.cap==null?H:h.cap)),k=j(h.seed==null?2654435769:h.seed),d=new Map,p=o.length?o[0].at:0;if(a.kind==="session"){const O=new z(200,k);let y=0;for(const{key:M,value:D}of o)Number.isFinite(D)&&(O.add(D),y++),M!=null&&d.set(String(M),{value:y?O.quantile(v):null,approx:y>0,count:y,coverage:null,partial:!1});return d}const b=C(a);for(const{key:O,at:y,value:M}of o){Number.isFinite(M)&&b.push(M,y);const D=b.values(),_=D.length;let I=null,L=!1;if(_)if(_<=g)I=w([...D].sort((P,N)=>P-N),v);else{const P=new z(200,k);for(const N of D)P.add(N);I=P.quantile(v),L=!0}const $=Z(a,_,y,p);O!=null&&d.set(String(O),{value:I,approx:L,count:_,coverage:$.coverage,partial:$.partial})}return d}function c(o,a){const h=o.length,v=new Array(h).fill(null),g=Math.floor(a/2),k=a%2===0;for(let d=0;d<h;d++){if(d-g<0||d+g>=h)continue;let p=0,b=!0;if(k)for(let O=-g;O<=g;O++){const y=o[d+O];if(!Number.isFinite(y)){b=!1;break}p+=O===-g||O===g?y*.5:y}else for(let O=-g;O<=g;O++){const y=o[d+O];if(!Number.isFinite(y)){b=!1;break}p+=y}b&&(v[d]=p/a)}return v}function f(o,a){const h=new Map,v=Math.floor(Number(a&&a.period));if(!(v>=2))return h;const g=a&&a.model==="multiplicative",k=o.length,d=o.map(L=>Number.isFinite(L.value)?L.value:null),p=c(d,v),b=new Array(k).fill(null);for(let L=0;L<k;L++){const $=p[L],P=d[L];$===null||P===null||(g?$!==0&&(b[L]=P/$):b[L]=P-$)}const O=new Array(v).fill(0),y=new Array(v).fill(0);for(let L=0;L<k;L++){if(b[L]===null)continue;const $=L%v;O[$]+=b[L],y[$]+=1}const M=g?1:0,D=O.map((L,$)=>y[$]?L/y[$]:M),_=D.reduce((L,$)=>L+$,0)/v,I=g?D.map(L=>_!==0?L/_:1):D.map(L=>L-_);for(let L=0;L<k;L++){const{key:$}=o[L];if($==null)continue;const P=p[L],N=I[L%v],T=d[L];let E=null;P!==null&&T!==null&&(E=g?P*N!==0?T/(P*N):null:T-P-N),h.set(String($),{trend:P,seasonal:T===null?null:N,residual:E,coverage:P===null?0:1,partial:P===null})}return h}function l(o,a,h,v=80){const g=(Math.sqrt(5)-1)/2;let k=a,d=h,p=d-g*(d-k),b=k+g*(d-k),O=o(p),y=o(b);for(let M=0;M<v;M++)O<y?(d=b,b=p,y=O,p=d-g*(d-k),O=o(p)):(k=p,p=b,O=y,b=k+g*(d-k),y=o(b));return(k+d)/2}const r=1e-4,t=1-1e-4;function i(o,a){const h=o.length,v=new Array(h).fill(null),g=new Array(h).fill(null);let k=null,d=0;for(let p=0;p<h;p++){const b=o[p];if(!Number.isFinite(b)){k!==null&&(g[p]=k,v[p]=k);continue}if(k===null){k=b,g[p]=b,v[p]=b;continue}g[p]=k,d+=(b-k)**2,k=a*b+(1-a)*k,v[p]=k}return{smoothed:v,fitted:g,sse:d}}function s(o,a,h){const v=o.length,g=new Array(v).fill(null),k=new Array(v).fill(null);let d=null,p=null,b=0;for(let O=0;O<v;O++){const y=o[O];if(!Number.isFinite(y)){d!==null&&(d+=p,g[O]=d);continue}if(d===null){d=y,g[O]=y;continue}if(p===null){p=y-d;const _=d+p;k[O]=_,b+=(y-_)**2;const I=d;d=a*y+(1-a)*(I+p),p=h*(d-I)+(1-h)*p,g[O]=d;continue}const M=d+p;k[O]=M,b+=(y-M)**2;const D=d;d=a*y+(1-a)*(D+p),p=h*(d-D)+(1-h)*p,g[O]=d}return{smoothed:g,fitted:k,sse:b}}function n(o,a={}){const h=new Map,v=a.method==="holt",g=o.map(M=>Number.isFinite(M.value)?M.value:null),k=g.filter(M=>M!==null).length,d=M=>Math.min(t,Math.max(r,M)),p=()=>{for(const{key:M}of o)M!=null&&h.set(String(M),{smoothed:null,fitted:null,alpha:null,beta:null,sse:null});return h};if(k<(v?2:1))return p();let b=Number.isFinite(a.alpha)?d(a.alpha):null,O=v&&Number.isFinite(a.beta)?d(a.beta):null;if(v){if(b===null||O===null){let M=b===null?.5:b,D=O===null?.5:O;for(let _=0;_<6;_++)b===null&&(M=l(I=>s(g,I,D).sse,r,t)),O===null&&(D=l(I=>s(g,M,I).sse,r,t));b=b===null?M:b,O=O===null?D:O}}else b===null&&(b=l(M=>i(g,M).sse,r,t));const y=v?s(g,b,O):i(g,b);for(let M=0;M<o.length;M++){const{key:D}=o[M];D!=null&&h.set(String(D),{smoothed:y.smoothed[M],fitted:y.fitted[M],alpha:b,beta:v?O:null,sse:y.sse})}return h}const u={ROLLING_WINDOW_FIELDS:B,QUANTILE_SPAN_CAP:H,rollingWindow:K,rollingQuantile:m,cumulativeToDate:F,periodOverPeriod:X,seasonalDecompose:f,exponentialSmoothing:n}}),Ue("packages/core/src/compute/compare.js",function(e,U){"use strict";Object.defineProperty(e,"COMPARE_MEASURES",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"pooledStandardMeanDifference",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"numericSummary",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"bothNumeric",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"compareColumnAcross",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"compareDatasets",{enumerable:!0,get:function(){return c}});const te=U("packages/core/src/compute/statistics.js"),C=te.numbers,q=te.moments,z=te.frequencyMap,B=te.categoricalDistance,Z=te.normalTotalVariation,K=te.isNumericColumn,F=te.SUBSET_RELIABILITY_FLOOR,X=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function H(f,l){if(!f||!l||!(f.n>0)||!(l.n>0)||!Number.isFinite(f.mean)||!Number.isFinite(l.mean))return null;const r=(f.n*f.sd*f.sd+l.n*l.sd*l.sd)/(f.n+l.n);return r>0?(f.mean-l.mean)/Math.sqrt(r):null}function j(f,l){const r=C(f,l),{n:t,mean:i,m2:s}=q(r),n=t>0?Math.sqrt(s/t):0;return{mean:i,sd:n,n:t}}function w(f,l,r,t){return K(f,l)&&K(r,t)}function m(f,l,r,t){if(w(f,l,r,t)){const u=j(f,l),o=j(r,t),a=H(u,o);return{measure:X.numeric,magnitude:a,distance:a===null?0:Z(a),direction:a===null?0:Math.sign(a),nA:u.n,nB:o.n,reliable:u.n>=F&&o.n>=F}}const i=z(f,l),s=z(r,t),n=B(i.map,i.total,s.map,s.total);return{measure:X.categorical,magnitude:n,distance:n===null?0:n,direction:0,nA:i.total,nB:s.total,reliable:i.total>=F&&s.total>=F}}function c(f,l,r={}){const t=new Set(f.columns),i=new Set(l.columns),s=f.columns.filter(h=>i.has(h)),n=Array.isArray(r.columns)&&r.columns.length?s.filter(h=>r.columns.includes(h)):s,u=f.indices(),o=l.indices(),a=[];for(const h of n){const v=f.handle(h),g=l.handle(h);if(!v||!g)continue;const k=m(v,u,g,o);a.push({column:h,name:f.name&&f.name(h)||l.name&&l.name(h)||h,measure:k.measure,magnitude:k.magnitude,distance:k.distance,direction:k.direction,nA:k.nA,nB:k.nB,reliable:k.reliable})}return a.sort((h,v)=>v.distance-h.distance||Math.abs(v.magnitude||0)-Math.abs(h.magnitude||0)),{ranked:a,nA:u.length,nB:o.length,unmatched:{onlyA:f.columns.filter(h=>!i.has(h)),onlyB:l.columns.filter(h=>!t.has(h))},measures:X}}}),Ue("packages/core/src/compute/anomaly.js",function(e,U){"use strict";Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"DEFAULT_MODIFIED_Z_THRESHOLD",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return u}});const C=U("packages/core/src/compute/statistics.js").quantileSorted,z=U("packages/core/src/compute/special.js").logGamma,B=.6745,Z=3.5,K=1.5,F=.975,X=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function H(o){if(!o.length)return null;const h=Array.from(o,Number).sort((d,p)=>d-p),v=C(h,.5),g=h.map(d=>Math.abs(d-v)).sort((d,p)=>d-p),k=C(g,.5);return{median:v,mad:k}}function j(o,a={}){const h=Number.isFinite(a.threshold)?a.threshold:Z,v=o.length,g=new Array(v).fill(null),k=new Array(v).fill(!1),d=[];for(let O=0;O<v;O++){const y=Number(o[O]);Number.isFinite(y)&&d.push(y)}if(!d.length)return{median:null,mad:null,threshold:h,scores:g,flags:k,flagged:0};const p=H(d);if(p.mad===0)return{median:p.median,mad:0,threshold:h,scores:g,flags:k,flagged:0};let b=0;for(let O=0;O<v;O++){const y=Number(o[O]);if(!Number.isFinite(y))continue;const M=B*(y-p.median)/p.mad;g[O]=M,Math.abs(M)>h&&(k[O]=!0,b++)}return{median:p.median,mad:p.mad,threshold:h,scores:g,flags:k,flagged:b}}function w(o,a={}){const h=Number.isFinite(a.k)?a.k:K,v=[];for(let b=0;b<o.length;b++){const O=Number(o[b]);Number.isFinite(O)&&v.push(O)}if(!v.length)return null;const g=v.sort((b,O)=>b-O),k=C(g,.25),d=C(g,.75),p=d-k;return{q1:k,q3:d,iqr:p,lower:k-h*p,upper:d+h*p,k:h}}function m(o,a){if(a<=0)return 0;const h=z(o);if(a<o+1){let O=o,y=1/o,M=y;for(let D=0;D<1e3&&(O+=1,M*=a/O,y+=M,!(Math.abs(M)<Math.abs(y)*1e-15));D++);return y*Math.exp(-a+o*Math.log(a)-h)}const v=1e-300;let g=a+1-o,k=1/v,d=1/g,p=d;for(let O=1;O<1e3;O++){const y=-O*(O-o);g+=2,d=y*d+g,Math.abs(d)<v&&(d=v),k=g+y/k,Math.abs(k)<v&&(k=v),d=1/d;const M=d*k;if(p*=M,Math.abs(M-1)<1e-15)break}return 1-Math.exp(-a+o*Math.log(a)-h)*p}function c(o,a){return o<=0?0:m(a/2,o/2)}function f(o,a=F){if(!(a>0)||!(a<1))return NaN;let h=0,v=Math.max(1,o);for(;c(v,o)<a;)v*=2;for(let g=0;g<200;g++){const k=(h+v)/2;if(c(k,o)<a?h=k:v=k,v-h<1e-10)break}return(h+v)/2}function l(o){const a=o.length,h=o.map((v,g)=>{const k=v.slice();for(let d=0;d<a;d++)k.push(g===d?1:0);return k});for(let v=0;v<a;v++){let g=v;for(let d=v+1;d<a;d++)Math.abs(h[d][v])>Math.abs(h[g][v])&&(g=d);if(Math.abs(h[g][v])<1e-12)return null;if(g!==v){const d=h[g];h[g]=h[v],h[v]=d}const k=h[v][v];for(let d=0;d<2*a;d++)h[v][d]/=k;for(let d=0;d<a;d++){if(d===v)continue;const p=h[d][v];if(p!==0)for(let b=0;b<2*a;b++)h[d][b]-=p*h[v][b]}}return h.map(v=>v.slice(a))}function r(o,a){const h=o.length,v=new Array(a).fill(0);for(const d of o)for(let p=0;p<a;p++)v[p]+=d[p];for(let d=0;d<a;d++)v[d]/=h;const g=Array.from({length:a},()=>new Array(a).fill(0));for(const d of o)for(let p=0;p<a;p++){const b=d[p]-v[p];for(let O=p;O<a;O++)g[p][O]+=b*(d[O]-v[O])}const k=h>1?h-1:1;for(let d=0;d<a;d++)for(let p=d;p<a;p++)g[d][p]/=k,g[p][d]=g[d][p];return{mean:v,cov:g}}function t(o,a={}){const h=Number.isFinite(a.p)?a.p:F,v=Number.isFinite(a.ridge)?a.ridge:1e-6,g=o.length;if(!g)return null;const k=o[0].length;if(!k)return null;const d=new Array(g).fill(null),p=new Array(g).fill(null),b=new Array(g).fill(!1),O=[],y=[];for(let N=0;N<g;N++){const T=o[N];let E=T.length===k;const A=new Array(k);for(let S=0;E&&S<k;S++){const x=Number(T[S]);Number.isFinite(x)?A[S]=x:E=!1}E&&(O.push(N),y.push(A))}const M=k,D=f(M,h);if(y.length<=k)return{center:[],df:M,cutoff:D,singular:!0,used:y.length,distances:d,squared:p,flags:b,flagged:0};const{mean:_,cov:I}=r(y,k);let L=l(I),$=!1;if(!L){$=!0;let N=0;for(let A=0;A<k;A++)N+=I[A][A];const T=N/k*v||v,E=I.map((A,S)=>A.map((x,W)=>S===W?x+T:x));if(L=l(E),!L)return{center:_,df:M,cutoff:D,singular:!0,used:y.length,distances:d,squared:p,flags:b,flagged:0}}let P=0;for(let N=0;N<y.length;N++){const T=y[N],E=new Array(k);for(let x=0;x<k;x++)E[x]=T[x]-_[x];let A=0;for(let x=0;x<k;x++){let W=0;for(let V=0;V<k;V++)W+=L[x][V]*E[V];A+=E[x]*W}A<0&&(A=0);const S=O[N];p[S]=A,d[S]=Math.sqrt(A),A>D&&(b[S]=!0,P++)}return{center:_,df:M,cutoff:D,singular:$,used:y.length,distances:d,squared:p,flags:b,flagged:P}}const i=20,s=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function n(o,a={}){const h=a.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",v=Number.isFinite(a.windowLen)&&a.windowLen>=1?Math.floor(a.windowLen):i,g=Number.isFinite(a.threshold)?a.threshold:Z,k=Number.isFinite(a.k)?a.k:K,d=Number.isFinite(a.minPeriods)&&a.minPeriods>=1?Math.floor(a.minPeriods):v,p=o.length,b=new Array(p).fill(null),O=new Array(p).fill(!1);let y=0;for(let M=0;M<p;M++){const D=Number(o[M]);if(!Number.isFinite(D))continue;const _=Math.max(0,M-v+1),I=[];for(let L=_;L<=M;L++){const $=Number(o[L]);Number.isFinite($)&&I.push($)}if(!(I.length<d))if(h==="rollingIqr"){const L=w(I,{k});if(!L)continue;(D<L.lower||D>L.upper)&&(O[M]=!0,y++)}else{const L=H(I);if(!L||L.mad===0)continue;const $=B*(D-L.median)/L.mad;b[M]=$,Math.abs($)>g&&(O[M]=!0,y++)}}return{method:h,windowLen:v,minPeriods:d,threshold:g,k,scores:b,flags:O,flagged:y}}function u(o={}){const a=o||{},h=a.field;if(typeof h!="string"||!h)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const v=a.method||"modifiedZScore";if(!(X.includes(v)||s.includes(v))||v==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${v}'`);const k=typeof a.orderBy=="string"?a.orderBy:null,d=a.latest===!0,p=s.includes(v),b=O=>Number(O==null?NaN:O[h]);return O=>{const y=Array.isArray(O)?O.slice():[...O];k&&y.sort((L,$)=>{const P=L?.[k],N=$?.[k];return P===N?0:P==null?-1:N==null?1:P<N?-1:1});const M=y.map(b);let D,_;if(p)({flags:D,scores:_}=n(M,{method:v,windowLen:a.windowLen,threshold:a.threshold,k:a.k,minPeriods:a.minPeriods}));else if(v==="iqr"){const L=w(M,{k:a.k});D=M.map($=>L?Number.isFinite($)&&($<L.lower||$>L.upper):!1),_=M.map(()=>null)}else({flags:D,scores:_}=j(M,{threshold:a.threshold}));if(d){const L=D.length-1;return L<0||!D[L]?!1:{method:v,field:h,flagged:[{row:y[L],score:_[L]}]}}const I=[];for(let L=0;L<D.length;L++)D[L]&&I.push({row:y[L],score:_[L]});return I.length?{method:v,field:h,flagged:I}:!1}}}),Ue("packages/core/src/compute/forecast.js",function(e,U){"use strict";Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}});const te=U("packages/core/src/compute/special.js"),C=te.normalQuantile,q=te.studentTQuantile,B=U("packages/core/src/internal/warn.js").warnOnce,Z=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),K=1e-4,F=1-1e-4;function X(a){const h=[];for(let v=0;v<a.length;v++){const g=a[v];if(g!==null&&typeof g=="object"){const k=Number.isFinite(g.at)?g.at:v,d=Number.isFinite(g.value)?g.value:null;h.push({at:k,value:d})}else h.push({at:v,value:Number.isFinite(g)?Number(g):null})}return h}function H(a){const h=a.filter(p=>p.value!==null),v=h[0],g=h[h.length-1],k=g.at-v.at,d=h.length>1&&k>0?k/(h.length-1):1;return{lastAt:g.at,step:d}}function j(a){return Math.min(F,Math.max(K,a))}function w(a,h=K,v=F,g=80){const k=(Math.sqrt(5)-1)/2;let d=h,p=v,b=p-k*(p-d),O=d+k*(p-d),y=a(b),M=a(O);for(let D=0;D<g;D++)y<M?(p=O,O=b,M=y,b=p-k*(p-d),y=a(b)):(d=b,b=O,y=M,O=d+k*(p-d),M=a(O));return(d+p)/2}function m(a,h){let v=null,g=0,k=0;for(let d=0;d<a.length;d++){const p=a[d];if(p!==null){if(v===null){v=p;continue}g+=(p-v)**2,k+=1,v=h*p+(1-h)*v}}return{level:v,sse:g,m:k}}function c(a,h,v){let g=null,k=null,d=0,p=0;for(let b=0;b<a.length;b++){const O=a[b];if(O===null){g!==null&&k!==null&&(g+=k);continue}if(g===null){g=O;continue}k===null&&(k=O-g);const y=g+k;d+=(O-y)**2,p+=1;const M=g;g=h*O+(1-h)*(M+k),k=v*(g-M)+(1-v)*k}return{level:g,trend:k,sse:d,m:p}}function f(a,h,v,g,k){const d=a.length;if(d<2*h)return null;const p=$=>{let P=0,N=0;for(let T=$;T<$+h&&T<d;T++)a[T]!==null&&(P+=a[T],N+=1);return N?P/N:null},b=p(0),O=p(h);if(b===null||O===null)return null;let y=b,M=(O-b)/h;const D=new Array(h).fill(0);for(let $=0;$<h;$++)D[$]=a[$]===null?0:a[$]-y;const _=D.reduce(($,P)=>$+P,0)/h;for(let $=0;$<h;$++)D[$]-=_;let I=0,L=0;for(let $=h;$<d;$++){const P=$%h,N=D[P],T=a[$];if(T===null){y+=M;continue}const E=y+M+N;I+=(T-E)**2,L+=1;const A=y;y=v*(T-N)+(1-v)*(y+M),M=g*(y-A)+(1-g)*M,D[P]=k*(T-y)+(1-k)*N}return{level:y,trend:M,season:D,phase:(d-1)%h,sse:I,count:L}}function l(a,h,v){let g=1;for(const d of h)g+=d*d;const k=Math.sqrt(a*g);return{se:k,margin:v*k}}function r(a,h={}){if(!a||typeof a.length!="number"||a.length===0)return null;const v=Z.includes(h.method)?h.method:"linear",g=Math.max(1,Math.floor(Number(h.horizon)||1)),k=Number.isFinite(h.confidence)&&h.confidence>0&&h.confidence<1?h.confidence:.95,d=1-(1-k)/2,p=X(a),b=p.map(I=>I.value),O=b.filter(I=>I!==null),y=O.length,{lastAt:M,step:D}=y?H(p):{lastAt:0,step:1},_=I=>M+I*D;return v==="linear"?t(p,y,g,k,d,_):v==="movingAverage"?i(O,y,g,k,d,h,_):v==="ses"?s(b,y,g,k,d,h,_):v==="holt"?n(b,y,g,k,d,h,_):u(b,y,g,k,d,h,_)}function t(a,h,v,g,k,d){if(h<2)return null;let p=0,b=0;for(const T of a)T.value!==null&&(p+=T.at,b+=T.value);p/=h,b/=h;let O=0,y=0,M=0;for(const T of a){if(T.value===null)continue;const E=T.at-p,A=T.value-b;O+=E*E,y+=E*A,M+=A*A}if(O===0)return null;const D=y/O,_=b-D*p,I=M===0?1:Math.max(0,Math.min(1,y*y/(O*M))),L=Math.max(0,M-D*y),$=h>2?Math.sqrt(L/(h-2)):null,P=h>2?q(k,h-2):null,N=[];for(let T=1;T<=v;T++){const E=d(T),A=_+D*E;let S=null,x=null,W=null,V=null,G=null;if($!==null){const Q=1/h+(E-p)**2/O,ee=$*Math.sqrt(1+Q),ne=$*Math.sqrt(Q);G=ee,S=A-P*ee,x=A+P*ee,W=A-P*ne,V=A+P*ne}N.push({step:T,at:E,mean:A,lower:S,upper:x,lowerMean:W,upperMean:V,se:G})}return{method:"linear",horizon:v,confidence:g,n:h,sigma:$,r2:I,params:{slope:D,intercept:_},points:N}}function i(a,h,v,g,k,d,p){if(h<1)return null;const b=Math.max(1,Math.min(h,Math.floor(Number(d.windowLen)||h))),O=a.slice(h-b);let y=0;for(const $ of O)y+=$;const M=y/b;let D=null,_=null;if(b>1){let $=0;for(const N of O)$+=(N-M)**2;D=Math.sqrt($/(b-1))*Math.sqrt(1+1/b),_=q(k,b-1)}const I=D===null?null:_*D,L=[];for(let $=1;$<=v;$++)L.push({step:$,at:p($),mean:M,lower:I===null?null:M-I,upper:I===null?null:M+I,se:D});return{method:"movingAverage",horizon:v,confidence:g,n:h,sigma:D===null?null:D,params:{windowLen:b},points:L}}function s(a,h,v,g,k,d,p){if(h<1)return null;let b=Number.isFinite(d.alpha)?j(d.alpha):null;b===null&&(b=w(_=>m(a,_).sse));const O=m(a,b),y=C(k),M=O.m>0?O.sse/O.m:null,D=[];for(let _=1;_<=v;_++){const I=O.level;let L=null,$=null,P=null;if(M!==null){const N=[];for(let E=1;E<_;E++)N.push(b);const T=l(M,N,y);P=T.se,L=I-T.margin,$=I+T.margin}D.push({step:_,at:p(_),mean:I,lower:L,upper:$,se:P})}return{method:"ses",horizon:v,confidence:g,n:h,sigma:M===null?null:Math.sqrt(M),params:{alpha:b},points:D}}function n(a,h,v,g,k,d,p){if(h<2)return null;let b=Number.isFinite(d.alpha)?j(d.alpha):null,O=Number.isFinite(d.beta)?j(d.beta):null;if(b===null||O===null){let L=b===null?.5:b,$=O===null?.5:O;for(let P=0;P<6;P++)b===null&&(L=w(N=>c(a,N,$).sse)),O===null&&($=w(N=>c(a,L,N).sse));b=b===null?L:b,O=O===null?$:O}const y=c(a,b,O),M=C(k),D=y.m>0?y.sse/y.m:null,_=b*O,I=[];for(let L=1;L<=v;L++){const $=y.level+L*y.trend;let P=null,N=null,T=null;if(D!==null){const E=[];for(let S=1;S<L;S++)E.push(b+S*_);const A=l(D,E,M);T=A.se,P=$-A.margin,N=$+A.margin}I.push({step:L,at:p(L),mean:$,lower:P,upper:N,se:T})}return{method:"holt",horizon:v,confidence:g,n:h,sigma:D===null?null:Math.sqrt(D),params:{alpha:b,beta:O},points:I}}function u(a,h,v,g,k,d,p){const b=Math.floor(Number(d.period));if(!(b>=2))return B("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(h<2*b)return null;let O=Number.isFinite(d.alpha)?j(d.alpha):null,y=Number.isFinite(d.beta)?j(d.beta):null,M=Number.isFinite(d.gamma)?j(d.gamma):null;const D=(T,E,A)=>{const S=f(a,b,T,E,A);return S?S.sse:1/0};if(O===null||y===null||M===null){let T=O===null?.5:O,E=y===null?.5:y,A=M===null?.5:M;for(let S=0;S<8;S++)O===null&&(T=w(x=>D(x,E,A))),y===null&&(E=w(x=>D(T,x,A))),M===null&&(A=w(x=>D(T,E,x)));O=O===null?T:O,y=y===null?E:y,M=M===null?A:M}const _=f(a,b,O,y,M);if(!_)return null;const I=C(k),L=_.count>0?_.sse/_.count:null,$=O*y,P=M*(1-O),N=[];for(let T=1;T<=v;T++){const E=_.season[(_.phase+T)%b],A=_.level+T*_.trend+E;let S=null,x=null,W=null;if(L!==null){const V=[];for(let Q=1;Q<T;Q++)V.push(O+Q*$+(Q%b===0?P:0));const G=l(L,V,I);W=G.se,S=A-G.margin,x=A+G.margin}N.push({step:T,at:p(T),mean:A,lower:S,upper:x,se:W})}return{method:"holtWinters",horizon:v,confidence:g,n:h,sigma:L===null?null:Math.sqrt(L),params:{alpha:O,beta:y,gamma:M,period:b},points:N}}const o={FORECAST_METHODS:Z,forecast:r}}),Ue("packages/core/src/compute/hypothesis.js",function(e,U){"use strict";Object.defineProperty(e,"GROUP_TESTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"NORMALITY_ALPHA",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"HL_PAIR_LIMIT",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"welchTTest",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"mannWhitneyUTest",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"chiSquareTest",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return I}});const C=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/compute/handle.js").valueReader,B=U("packages/core/src/compute/statistics.js"),Z=B.numbers,K=B.moments,F=B.frequencyMap,X=B.categoricalDistance,H=B.isNumericColumn,j=B.jarqueBera,w=B.proportionInterval,m=B.SUBSET_RELIABILITY_FLOOR,f=U("packages/core/src/compute/compare.js").pooledStandardMeanDifference,l=U("packages/core/src/compute/special.js"),r=l.studentT,t=l.studentTQuantile,i=l.normalCdf,s=l.normalQuantile,n=l.chiSquareUpperTail,u=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),o=.05,a=2e6;function h(L){const $=Number(L);return Number.isFinite($)&&$>0&&$<1?$:.95}function v(L){const{n:$,mean:P,m2:N}=K(L);return{mean:P,sd:$>0?Math.sqrt(N/$):0,n:$}}function g(L,$){const P=L.length;if(P<2)return 0;let N=0;for(let T=0;T<P;T++){const E=L[T]-$;N+=E*E}return N/(P-1)}function k(L,$){return{name:"pooledStandardMeanDifference",value:f(v(L),v($))}}function d(L,$,P){const N=L.length,T=$.length;if(N<2||T<2)return null;const E=h(P),{mean:A}=K(L),{mean:S}=K($),x=g(L,A),W=g($,S),V=x/N+W/T;if(!(V>0))return null;const G=Math.sqrt(V),Q=(A-S)/G,ee=x/N*(x/N)/(N-1),ne=W/T*(W/T)/(T-1),se=V*V/(ee+ne),le=Math.min(1,Math.max(0,2*(1-r(Math.abs(Q),se)))),me=A-S,ve=t(1-(1-E)/2,se)*G;return{test:u.WELCH,statistic:Q,statisticName:"t",df:se,pValue:le,interval:{estimate:me,lower:me-ve,upper:me+ve,confidence:E,method:"welch-t (difference of means)"},effectSize:k(L,$),nA:N,nB:T,reliable:N>=m&&T>=m,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function p(L){const $=L.length;if($===0)return Number.NaN;const P=$>>1;return $%2?L[P]:(L[P-1]+L[P])/2}function b(L,$,P){const N=L.length,T=$.length,E=N*T;if(E===0||E>a)return null;const A=new Float64Array(E);let S=0;for(let ee=0;ee<N;ee++)for(let ne=0;ne<T;ne++)A[S++]=L[ee]-$[ne];A.sort();const x=p(A),W=Math.sqrt(N*T*(N+T+1)/12),V=s(1-(1-P)/2);let G=Math.round(E/2-V*W);G>=0||(G=0);const Q=Math.floor((E-1)/2);return G>Q&&(G=Q),{estimate:x,lower:A[G],upper:A[E-1-G],confidence:P,method:"hodges-lehmann (normal approximation)"}}function O(L,$,P){const N=L.length,T=$.length;if(N<1||T<1)return null;const E=h(P),A=N+T,S=new Array(A);for(let le=0;le<N;le++)S[le]={v:L[le],g:0};for(let le=0;le<T;le++)S[N+le]={v:$[le],g:1};S.sort((le,me)=>le.v-me.v);let x=0,W=0,V=0;for(;V<A;){let le=V;for(;le<A&&S[le].v===S[V].v;)le++;const me=le-V,ve=(V+1+le)/2;for(let fe=V;fe<le;fe++)S[fe].g===0&&(x+=ve);W+=me*me*me-me,V=le}const G=x-N*(N+1)/2,Q=N*T/2,ee=N*T/12*(A+1-W/(A*(A-1)));let ne=1;if(ee>0){const le=Math.max(0,Math.abs(G-Q)-.5);ne=Math.min(1,2*i(-le/Math.sqrt(ee)))}const se=b(L,$,E);return{test:u.MANN_WHITNEY,statistic:G,statisticName:"U",df:null,pValue:ne,interval:se,effectSize:k(L,$),nA:N,nB:T,reliable:N>=m&&T>=m,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function y(L,$,P,N,T){const E=w(L,$,T),A=w(P,N,T);if(!E||!A)return null;const S=E.proportion-A.proportion,x=S-Math.sqrt((E.proportion-E.lower)**2+(A.upper-A.proportion)**2),W=S+Math.sqrt((E.upper-E.proportion)**2+(A.proportion-A.lower)**2);return{lower:x,upper:W}}function M(L,$,P,N,T,E={}){if(!($>0)||!(N>0))return null;const A=new Set([...L.keys(),...P.keys()]),S=A.size;if(S<2)return null;const x=$+N;let W=0;for(const ne of A){const se=L.get(ne)||0,le=P.get(ne)||0,me=se+le,ve=$*me/x,fe=N*me/x;ve>0&&(W+=(se-ve)*(se-ve)/ve),fe>0&&(W+=(le-fe)*(le-fe)/fe)}const V=S-1,G=n(W,V);let Q=null;E.category!==void 0&&A.has(E.category)?Q=E.category:S===2&&([Q]=[...A]);let ee=null;if(Q!==null){const ne=y(L.get(Q)||0,$,P.get(Q)||0,N,h(T));ne&&(ee={estimate:(L.get(Q)||0)/$-(P.get(Q)||0)/N,lower:ne.lower,upper:ne.upper,confidence:h(T),method:"newcombe (difference in this category's share)",category:Q})}return{test:u.CHI_SQUARE,statistic:W,statisticName:"chiSquare",df:V,pValue:G,interval:ee,effectSize:{name:"categoricalTotalVariation",value:X(L,$,P,N)},nA:$,nB:N,reliable:$>=m&&N>=m,method:"Pearson chi-square test of independence (2×k, no continuity correction)"}}function D(L){return L==null||L===""||typeof L=="number"&&Number.isNaN(L)?null:L instanceof Date?L.getTime():typeof L=="object"?String(L):L}function _(L,$,P){if(P===u.WELCH||P===u.MANN_WHITNEY)return{test:P,chosenBy:"override",reason:`caller override: ${P}`};const N=j(L),T=j($),E=N===null?null:Math.exp(-N/2),A=T===null?null:Math.exp(-T/2);return E!==null&&E<o||A!==null&&A<o?{test:u.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${o})`}:{test:u.WELCH,chosenBy:"auto",reason:E!==null||A!==null?"column family: numeric, no departure from normality detected":"column family: numeric (too few rows to screen normality)"}}function I(L,$,P,N={}){if(!L||!$)return null;const T=h(N.confidence),E=z($);let A;if(Array.isArray(N.groups)&&N.groups.length===2)A=[D(N.groups[0]),D(N.groups[1])];else{const{map:le}=F($,P),me=[...le.entries()].sort((ve,fe)=>fe[1]-ve[1]).slice(0,2).map(ve=>ve[0]);if(me.length<2)return C("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;A=me}const[S,x]=A;if(S===null||x===null||S===x)return C("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const W=[],V=[];for(let le=0;le<P.length;le++){const me=D(E(P[le]));me===S?W.push(P[le]):me===x&&V.push(P[le])}if(W.length===0||V.length===0)return C("compareGroups:empty","[lattice] compareGroups: one of the two groups has no rows in the current set."),null;const G=N.test&&N.test!=="auto"?String(N.test):null,Q=H(L,W.concat(V));let ee,ne,se;if(G===u.CHI_SQUARE||!G&&!Q){ne=G?"override":"auto",se=G?"caller override: chiSquare":"column family: categorical";const le=F(L,W),me=F(L,V);ee=M(le.map,le.total,me.map,me.total,T,{category:N.category})}else{if((G===u.WELCH||G===u.MANN_WHITNEY)&&!Q)return C("compareGroups:numeric-override",`[lattice] compareGroups: ${G} needs a numeric column, but the column is not numeric.`),null;const le=Z(L,W),me=Z(L,V),ve=_(le,me,G);ne=ve.chosenBy,se=ve.reason,ee=ve.test===u.MANN_WHITNEY?O(le,me,T):d(le,me,T)}return ee?{...ee,chosenBy:ne,reason:se,groups:[S,x]}:(C("compareGroups:degenerate","[lattice] compareGroups: the chosen test had too little to work with (too few values, or no variation)."),null)}}),Ue("packages/core/src/columns/detailcolumn.js",function(e,U){"use strict";Object.defineProperty(e,"DETAIL_COLUMN_ID",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"createDetailColumn",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return z}});const te="__lattice_detail",C=36;function q(B){const Z=B.config&&B.config.detailColumnWidth||C;return{id:te,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:Z,min:Z,max:Z,pin:B.config&&B.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(K,F){return!!(F&&F.expanded)},formatValue(){return""}}}const z=q}),Ue("packages/core/src/columns/treecolumn.js",function(e,U){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createTreeColumn",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const C=U("packages/core/src/internal/predicates.js").isFunction,q="__lattice_tree",z=260;function B(K){const F=K.tree||{},X=K.config&&K.config.treeColumnWidth||z,H=()=>(K.columns&&C(K.columns.visible)?K.columns.visible():[]).find(c=>!c.generated)||null,j=(m,c)=>{if(c&&c.group)return c.groupValue;if(C(F.label))return F.label(m,c);if(typeof F.label=="string")return m==null?null:m[F.label];const f=H();return f&&C(f.getValue)?f.getValue(m,c):null},w=()=>{if(F.title)return F.title;const m=typeof F.label=="string"?K.columns&&C(K.columns.get)?K.columns.get(F.label):null:H();return m&&(m.title||m.id)||"Hierarchy"};return{id:q,get title(){return w()},field:null,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:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:X,min:140,pin:K.config&&K.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(m,c){return j(m,c)},formatValue(m,c){if(c&&c.grandTotal)return K.config&&K.config.grandTotalLabel||"Total";if(m==null)return"";if(!F.label){const f=H();if(f&&C(f.formatValue))return f.formatValue(m,c)}return String(m)}}}const Z=B}),Ue("packages/core/src/columns/pivotcolumns.js",function(e,U){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return B}});const C=U("packages/core/src/internal/warn.js").warnOnce,q="__lattice_pivot",z=500;function B(X){const{pivot:H,valueColumns:j,config:w}=X,m=H&&H.paths||[],c=X.separator||w&&w.pivot&&w.pivot.separator||" | ",f=w&&w.pivot&&w.pivot.maxColumns||z;if(!m.length||!j.length)return{tree:[],leaves:[],error:null};const l=Z(w),r=m.length*j.length+(l?j.length:0);if(r>f){const s=`pivot would generate ${r} columns, above the limit of ${f}. Pivot on a lower-cardinality column, or raise pivot.maxColumns.`;return C(`pivot.maxColumns:${r}`,s),{tree:[],leaves:[],error:s}}const t=[],i=[];for(const s of m){const n=[];for(const u of j){const o=F(s,u,c);n.push(o),i.push(o)}n.length===1?(n[0].title=String(s),t.push(n[0])):t.push({id:`${q}:group:${s}`,title:String(s),columns:n,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(l){const s=j.map(u=>K(u,w));i.push(...s);const n=w&&w.pivot&&w.pivot.totalsLabel||"Total";if(s.length===1)s[0].title=n,l==="before"?t.unshift(s[0]):t.push(s[0]);else{const u={id:`${q}:group:__totals`,title:n,columns:s,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};l==="before"?t.unshift(u):t.push(u)}}return{tree:t,leaves:i,error:null}}function Z(X){const H=X&&X.pivot&&X.pivot.groupTotals;return H==="before"||H==="after"?H:null}function K(X,H){return{id:`${q}:__total${H&&H.pivot&&H.pivot.separator||" | "}${X.id}`,field:null,title:X.title||X.id,type:X.type,dataType:X.dataType,nullable:!0,align:X.align,generated:!0,pivot:{enabled:!1,index:0,sourceId:X.id,total:!0},value:{pure:!0},cell:{align:X.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:X.total,lookup:null,layout:{width:X.layout&&X.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(j,w){const m=w&&w.totals;return m&&Object.hasOwn(m,X.id)?m[X.id]:null},formatValue(j,w){return j==null?"":X.formatValue?X.formatValue(j,w):String(j)}}}function F(X,H,j){return{id:`${q}:${X}${j}${H.id}`,field:null,title:H.title||H.id,type:H.type,dataType:H.dataType,nullable:!0,align:H.align,generated:!0,pivot:{enabled:!1,index:0,path:X,sourceId:H.id},value:{pure:!0},cell:{align:H.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:H.total,lookup:null,layout:{width:H.layout&&H.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(w,m){return w==null?"":H.formatValue?H.formatValue(w,m):String(w)}}}}),Ue("packages/core/src/compute/group.js",function(e,U){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return w}});const te=U("packages/core/src/compute/handle.js"),C=te.dictSize,q=te.identity,z=te.presenceReader,B=te.rowCount,Z=te.valueReader,K="",F="\0",X=1<<20;function H(m,c,f,l){const r=m.length,t=m.map(a=>Z(a)),i=Array.isArray(l)&&l.some(Boolean),s=i?t.map((a,h)=>l[h]?v=>l[h](a(v)):a):t;if(!i&&r>0&&m.every(a=>a&&a.kind==="dictionary"&&a.dict)){const a=m.map(v=>C(v.dict)+1);let h=1;for(let v=0;v<r;v++)h*=a[v];if(h<=Number.MAX_SAFE_INTEGER){const v=m.map(p=>p.values),g=m.map(p=>z(p)),k=p=>{let b=0;for(let O=0;O<r;O++){const y=g[O],M=y&&y(p)===0?a[O]-1:v[O][p];b=b*a[O]+M}return b},d=new Float64Array(f);for(let p=0;p<f;p++)d[p]=k(c[p]);return{packed:d,strings:null,product:h,readers:s,keyOf:k}}}const u=a=>{let h="";for(let v=0;v<r;v++){const g=s[v](a);h+=(v===0?"":K)+(g==null?F:String(g))}return h},o=new Array(f);for(let a=0;a<f;a++)o[a]=u(c[a]);return{packed:null,strings:o,product:1/0,readers:s,keyOf:u}}function j(m,c,f,l){const r=new Uint32Array(l+1);for(let n=0;n<f;n++)r[c[n]+1]++;for(let n=0;n<l;n++)r[n+1]+=r[n];const t=new Uint32Array(f),i=r.slice(0,l);for(let n=0;n<f;n++)t[i[c[n]]++]=m[n];const s=new Array(l);for(let n=0;n<l;n++)s[n]=t.subarray(r[n],r[n+1]);return s}function w(m,c,f={}){const l=m||[],r=c||q(B(l[0],f)),t=r.length;if(l.length===0||t===0)return{keys:[],buckets:[]};const{packed:i,strings:s,product:n,readers:u}=H(l,r,t,f.project),o=new Uint32Array(t);let a=0,h=null;if(i&&n<=Math.max(1024,Math.min(X,t*4))){const d=n,p=new Int32Array(d).fill(-1);for(let b=0;b<t;b++)p[i[b]]=0;for(let b=0;b<d;b++)p[b]===0&&(p[b]=a++);for(let b=0;b<t;b++)o[b]=p[i[b]];h=new Float64Array(a);for(let b=0;b<d;b++)p[b]>=0&&(h[p[b]]=b)}else if(i){const d=new Map;for(let p=0;p<t;p++){const b=i[p];let O=d.get(b);O===void 0&&(O=a++,d.set(b,O)),o[p]=O}h=new Float64Array(a);for(const[p,b]of d)h[b]=p}else{const d=new Map;for(let p=0;p<t;p++){const b=s[p];let O=d.get(b);O===void 0&&(O=a++,d.set(b,O)),o[p]=O}}const v=j(r,o,t,a),g=new Array(a);for(let d=0;d<a;d++){const p=v[d][0],b=new Array(u.length);for(let O=0;O<u.length;O++)b[O]=u[O](p);g[d]=b}const k={keys:g,buckets:v};return h&&(k.packed=h),k}}),Ue("packages/core/src/compute/pivot.js",function(e,U){"use strict";Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return t}});const C=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/compute/handle.js").valueComparator,Z=U("packages/core/src/compute/group.js").packKeys,F=U("packages/core/src/compute/total.js").total,X="|",H="/",j=2e3;function w(n,u,o){return`${n}${X}${u}${X}${o}`}function m(n,u){let o="";for(let a=0;a<n.length;a++){const h=n[a];o+=(a===0?"":u)+(h==null?"":String(h))}return o}function c(n,u,o={}){const a=o.separator||H,h=u.length,{keyOf:v,readers:g}=Z(n,u,0),k=new Map,d=[],p=[];for(let I=0;I<h;I++){const L=u[I],$=v(L);if(k.has($))continue;k.set($,d.length),p.push($);const P=new Array(g.length);for(let N=0;N<g.length;N++)P[N]=g[N](L);d.push(P)}const b=z(o.locale),O=d.map((I,L)=>L);O.sort((I,L)=>{const $=d[I],P=d[L];for(let N=0;N<$.length;N++){const T=f($[N],P[N],b);if(T!==0)return T}return I-L});const y=new Array(O.length),M=new Array(O.length),D=new Map;for(let I=0;I<O.length;I++){const L=O[I];y[I]=d[L],M[I]=m(d[L],a),D.set(p[L],I)}return{keys:y,paths:M,idOf:I=>{const L=D.get(v(I));return L===void 0?-1:L}}}function f(n,u,o){const a=n==null,h=u==null;return a||h?a&&h?0:a?1:-1:o(n,u)}function l(n){const u=n.values||n.totals||[];if(u.length&&typeof u[0]=="object"&&u[0]!==null)return u.filter(v=>v&&v.handle);const o=typeof n.handle=="function"?n.handle:null;if(!o)return u.length&&C("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 a=typeof n.totalOf=="function"?n.totalOf:null,h=[];for(const v of u){const g=o(v);g&&h.push({colId:v,handle:g,fn:a?a(v):"sum"})}return h}function r(n,u,o){if(Array.isArray(n)){const a=o||{};return{...a,pivotHandles:n,order:u||null,groups:a.groups||null}}return n||{}}function t(n,u,o){const a=r(n,u,o),h=a.separator||H,v=l(a),g=a.maxColumns===void 0?j:a.maxColumns,k=a.groups&&a.groups.buckets?a.groups:null,d=k?k.buckets:[a.order||new Uint32Array(0)],p=a.groupPaths||(k?k.keys.map($=>m($,h)):[""]),b=s(d),{keys:O,paths:y,idOf:M}=c(a.pivotHandles||[],b,a),D=y.length*Math.max(1,v.length),_=i(y,v,h);if(g&&D>g){const $=new Map;return{keys:O,paths:y,fields:_,groupPaths:p,columns:D,values:$,cells:$,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${D} columns, above pivot.maxColumns of ${g}. Narrow the pivot columns or raise the limit.`,columns:D,maxColumns:g}}}const I=new Map,L=y.length;for(let $=0;$<d.length;$++){const P=d[$],N=p[$]===void 0?"":p[$],T=P.length;if(T===0)continue;const E=new Int32Array(T),A=new Uint32Array(L+1);for(let W=0;W<T;W++){const V=M(P[W]);E[W]=V,V>=0&&A[V+1]++}for(let W=0;W<L;W++)A[W+1]+=A[W];const S=new Uint32Array(T),x=A.slice(0,L);for(let W=0;W<T;W++){const V=E[W];V>=0&&(S[x[V]++]=P[W])}for(let W=0;W<L;W++){const V=A[W],G=A[W+1];if(G===V)continue;const Q=S.subarray(V,G);for(let ee=0;ee<v.length;ee++){const ne=v[ee],se=F(ne.handle,Q,ne.fn,a.totalContext||{locale:a.locale});I.set(w(N,y[W],ne.colId),se)}}}return{keys:O,paths:y,fields:_,groupPaths:p,columns:D,values:I,cells:I,error:null}}function i(n,u,o){if(u.length===0)return n.slice();const a=[];for(const h of n)for(const v of u)a.push(`${h}${o}${v.colId}`);return a}function s(n){if(n.length===1)return n[0]||new Uint32Array(0);let u=0;for(const h of n)u+=h?h.length:0;const o=new Uint32Array(u);let a=0;for(const h of n)!h||h.length===0||(o.set(h,a),a+=h.length);return o}}),Ue("packages/core/src/store/bitset.js",function(e,U){"use strict";Object.defineProperty(e,"Bitset",{enumerable:!0,get:function(){return C}});const te=8;class C{static#e=new Uint8Array(256);static{for(let z=1;z<256;z++)C.#e[z]=C.#e[z>>1]+(z&1)}#t;#n;constructor(z=0){const B=Math.max(0,z|0);this.#n=B,this.#t=new Uint8Array(Math.ceil(B/te))}get size(){return this.#n}get words(){return this.#t}get bytes(){return this.#t?this.#t.byteLength:0}get(z){return z<0||z>=this.#n?0:this.#t[z>>3]>>(z&7)&1}set(z){return z>=0&&z<this.#n&&(this.#t[z>>3]|=1<<(z&7)),this}clear(z){return z>=0&&z<this.#n&&(this.#t[z>>3]&=~(1<<(z&7))),this}assign(z,B){return B?this.set(z):this.clear(z)}fill(z=!1){return this.#t.fill(z?255:0),z&&this.#r(),this}grow(z){const B=Math.max(0,z|0);if(B<=this.#n)return this;const Z=Math.ceil(B/te);if(Z>this.#t.length){const K=new Uint8Array(Z);K.set(this.#t),this.#t=K}return this.#n=B,this}count(){const z=this.#t,B=C.#e;let Z=0;for(let K=0;K<z.length;K++)Z+=B[z[K]];return Z}and(z){const B=z instanceof C?z.words:z,Z=this.#t,K=Math.min(Z.length,B.length);for(let F=0;F<K;F++)Z[F]&=B[F];for(let F=K;F<Z.length;F++)Z[F]=0;return this}or(z){const B=z instanceof C?z.words:z,Z=this.#t,K=Math.min(Z.length,B.length);for(let F=0;F<K;F++)Z[F]|=B[F];return this}not(){const z=this.#t;for(let B=0;B<z.length;B++)z[B]=~z[B]&255;return this.#r(),this}clone(){const z=new C(this.#n);return z.words.set(this.#t.subarray(0,z.words.length)),z}release(){this.#t=new Uint8Array(0),this.#n=0}#r(){const z=this.#n&7;if(z===0)return;const B=this.#n>>3;B<this.#t.length&&(this.#t[B]&=(1<<z)-1)}static from(z){const B=Array.isArray(z)?z:Array.from(z),Z=new C(B.length);for(let K=0;K<B.length;K++)B[K]&&Z.set(K);return Z}}}),Ue("packages/core/src/store/dictionary.js",function(e,U){"use strict";Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return z}});const te=U("packages/core/src/internal/compare.js"),C=te.collator,q=te.defaultCompare;class z{#e;#t=new Map;#n=0;#r=null;#s=-1;#i="\0";constructor(Z=[]){this.#e=[];for(let K=0;K<Z.length;K++){const F=Z[K];this.#t.has(F)||(this.#t.set(F,this.#e.length),this.#e.push(F))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let Z=this.#e.length*8;for(let K=0;K<this.#e.length;K++){const F=this.#e[K];typeof F=="string"&&(Z+=F.length*2),Z+=16}return Z}codeOf(Z){const K=this.#t.get(Z);if(K!==void 0)return K;const F=this.#e.length;return this.#e.push(Z),this.#t.set(Z,F),this.#n++,F}lookup(Z){const K=this.#t.get(Z);return K===void 0?-1:K}has(Z){return this.#t.has(Z)}valueOf(Z){return this.#e[Z]}values(){return this.#e}ranks(Z){const K=Z||"";if(this.#r&&this.#s===this.#n&&this.#i===K)return this.#r;const F=this.#e.length,X=new Array(F);for(let m=0;m<F;m++)X[m]=m;const H=C(Z).compare,j=this.#e;X.sort((m,c)=>this.#o(j[m],j[c],H));const w=new Uint32Array(F);for(let m=0;m<F;m++)w[X[m]]=m;return this.#r=w,this.#s=this.#n,this.#i=K,w}#o(Z,K,F){return typeof Z=="string"&&typeof K=="string"?F(Z,K):q(Z,K)}}}),Ue("packages/core/src/store/multivalue.js",function(e,U){"use strict";Object.defineProperty(e,"MultiValue",{enumerable:!0,get:function(){return te}});class te{#e;#t;#n=0;#r=0;constructor(q={}){const z=Math.max(1,q.rows??16),B=Math.max(1,q.values??z);this.#e=new Int32Array(B),this.#t=new Uint32Array(z+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(q){return q<0||q>=this.#n?0:this.#t[q+1]-this.#t[q]}at(q){return q<0||q>=this.#n?this.#e.subarray(0,0):this.#e.subarray(this.#t[q],this.#t[q+1])}has(q,z){if(q<0||q>=this.#n)return!1;const B=this.#e,Z=this.#t[q+1];for(let K=this.#t[q];K<Z;K++)if(B[K]===z)return!0;return!1}hasAny(q,z){for(let B=0;B<z.length;B++)if(this.has(q,z[B]))return!0;return!1}hasAll(q,z){for(let B=0;B<z.length;B++)if(!this.has(q,z[B]))return!1;return!0}hasNone(q,z){return!this.hasAny(q,z)}push(q){const z=this.#n,B=q.length;this.#s(z+1),this.#i(this.#r+B);const Z=this.#r;for(let K=0;K<B;K++)this.#e[Z+K]=q[K]|0;return this.#r+=B,this.#n=z+1,this.#t[z]=Z,this.#t[z+1]=this.#r,z}write(q,z){if(q===this.#n){this.push(z);return}if(q<0||q>this.#n)return;const B=this.#t[q],Z=this.#t[q+1],K=z.length;if(Z-B===K){for(let F=0;F<K;F++)this.#e[B+F]=z[F]|0;return}this.#o(q,z)}compact(q,z,B){const Z=this.#e,K=this.#t,F=this.#n,X=new Int32Array(Math.max(1,this.#r)),H=new Uint32Array(z+1);let j=0;for(let w=0;w<F;w++){if(q[w]===B)continue;const m=K[w],c=K[w+1];H[q[w]]=j;for(let f=m;f<c;f++)X[j++]=Z[f];H[q[w]+1]=j}this.#e=X,this.#t=H,this.#n=z,this.#r=j}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#s(q){if(q+1<=this.#t.length)return;let z=this.#t.length-1;for(;z<q;)z=z*2||16;const B=new Uint32Array(z+1);B.set(this.#t),this.#t=B}#i(q){if(q<=this.#e.length)return;let z=this.#e.length;for(;z<q;)z=z*2||16;const B=new Int32Array(z);B.set(this.#e),this.#e=B}#o(q,z){const B=this.#e,Z=this.#t,K=this.#n,F=z.length-(Z[q+1]-Z[q]),X=new Int32Array(Math.max(1,this.#r+F)),H=new Uint32Array(Z.length);let j=0;for(let w=0;w<K;w++){if(H[w]=j,w===q)for(let m=0;m<z.length;m++)X[j++]=z[m]|0;else for(let m=Z[w];m<Z[w+1];m++)X[j++]=B[m];H[w+1]=j}this.#e=X,this.#t=H,this.#r=j}}}),Ue("packages/core/src/compute/sort.js",function(e,U){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return L}});const te=U("packages/core/src/compute/handle.js"),C=te.bitReader,q=te.dictRanks,z=te.dictSize,B=te.identity,Z=te.isMissing,K=te.presenceReader,F=te.rowCount,X=te.valueComparator,H=te.valueReader,j=new Uint32Array(0),w=new ArrayBuffer(8),m=new Float64Array(w),c=new Uint32Array(w),f=(m[0]=-1,(c[1]&2147483648)!==0?1:0),l=f===1?0:1;function r(P,N){m[0]=P;let T=c[f],E=c[l];(T&2147483648)!==0?(T=~T>>>0,E=~E>>>0):T=(T^2147483648)>>>0,N[0]=E,N[1]=T}function t(P,N,T,E){if(E<2)return P;const A=new Uint32Array(256*8);for(let ne=0;ne<E;ne++){const se=N[ne],le=T[ne];A[se&255]++,A[256+(se>>>8&255)]++,A[512+(se>>>16&255)]++,A[768+(se>>>24&255)]++,A[1024+(le&255)]++,A[1280+(le>>>8&255)]++,A[1536+(le>>>16&255)]++,A[1792+(le>>>24&255)]++}let S=P,x=N,W=T,V=new Uint32Array(E),G=new Uint32Array(E),Q=new Uint32Array(E);const ee=new Uint32Array(256);for(let ne=0;ne<8;ne++){const se=ne<<8,le=(ne&3)<<3,me=ne>=4;let ve=!1;for(let He=0;He<256;He++)if(A[se+He]===E){ve=!0;break}if(ve)continue;let fe=0;for(let He=0;He<256;He++)ee[He]=fe,fe+=A[se+He];for(let He=0;He<E;He++){const Be=x[He],ae=W[He],Ae=(me?ae:Be)>>>le&255,Me=ee[Ae]++;V[Me]=S[He],G[Me]=Be,Q[Me]=ae}let xe=S;S=V,V=xe,xe=x,x=G,G=xe,xe=W,W=Q,Q=xe}return S}function i(P,N,T){if(T<2)return P;const E=new Uint32Array(256*4);for(let G=0;G<T;G++){const Q=N[G];E[Q&255]++,E[256+(Q>>>8&255)]++,E[512+(Q>>>16&255)]++,E[768+(Q>>>24&255)]++}let A=P,S=N,x=new Uint32Array(T),W=new Uint32Array(T);const V=new Uint32Array(256);for(let G=0;G<4;G++){const Q=G<<8,ee=G<<3;let ne=!1;for(let me=0;me<256;me++)if(E[Q+me]===T){ne=!0;break}if(ne)continue;let se=0;for(let me=0;me<256;me++)V[me]=se,se+=E[Q+me];for(let me=0;me<T;me++){const ve=S[me],fe=V[ve>>>ee&255]++;x[fe]=A[me],W[fe]=ve}let le=A;A=x,x=le,le=S,S=W,W=le}return A}function s(P,N,T,E){const A=new Uint32Array(E+1);for(let W=0;W<T;W++)A[N[W]]++;let S=0;for(let W=0;W<=E;W++){const V=A[W];A[W]=S,S+=V}const x=new Uint32Array(T);for(let W=0;W<T;W++)x[A[N[W]]++]=P[W];return x}function n(P,N,T,E){return T<2?P:E<=65536||E<=T*2?s(P,N,T,E):i(P,N,T)}function u(P,N){return P.length===N&&P.byteOffset===0?P:Uint32Array.prototype.slice.call(P,0,N)}function o(P,N,T=!1){const E=N||B(P.length),A=E.length;if(A<2)return Uint32Array.from(E);const S=new Uint32Array(A),x=new Uint32Array(A),W=new Uint32Array(A),V=new Uint32Array(A),G=new Uint32Array(2);let Q=0,ee=0;for(let le=0;le<A;le++){const me=E[le],ve=P[me];if(Number.isNaN(ve)){V[ee++]=me;continue}r(ve,G),T?(x[Q]=~G[0]>>>0,W[Q]=~G[1]>>>0):(x[Q]=G[0],W[Q]=G[1]),S[Q++]=me}const ne=t(S.subarray(0,Q),x.subarray(0,Q),W.subarray(0,Q),Q);if(ee===0)return u(ne,Q);const se=new Uint32Array(A);return se.set(ne.subarray(0,Q),0),se.set(V.subarray(0,ee),Q),se}function a(P,N,T=!1){const E=N||B(P.length),A=E.length;if(A<2)return Uint32Array.from(E);const S=Uint32Array.from(E),x=new Uint32Array(A);for(let W=0;W<A;W++){const V=(P[S[W]]^2147483648)>>>0;x[W]=T?~V>>>0:V}return u(i(S,x,A),A)}function h(P,N,T={}){const E=N||B(F(P,T)),A=E.length;if(A<2)return Uint32Array.from(E);const S=q(P.dict,T.locale),x=P.values,W=K(P),V=Math.max(z(P.dict),S.length),G=V,Q=Uint32Array.from(E),ee=new Uint32Array(A),ne=!!T.descending;for(let se=0;se<A;se++){const le=Q[se];let me=W&&W(le)===0?G:S[x[le]];me===void 0&&(me=G),ee[se]=ne?G-me:me}return u(n(Q,ee,A,V+1),A)}function v(P,N,T){const E=N.length;let A=Uint32Array.from(N);if(E<2)return A;let S=new Uint32Array(E);for(let x=1;x<E;x<<=1){for(let V=0;V<E;V+=x<<1){const G=Math.min(V+x,E),Q=Math.min(V+(x<<1),E);let ee=V,ne=G,se=V;for(;ee<G&&ne<Q;)S[se++]=T(P[A[ee]],P[A[ne]])<=0?A[ee++]:A[ne++];for(;ee<G;)S[se++]=A[ee++];for(;ne<Q;)S[se++]=A[ne++]}const W=A;A=S,S=W}return A}function g(P,N,T){const E=C(P.values),A=N.length,S=new Uint32Array(A),x=T?1:0;let W=0;for(let V=0;V<A;V++)E(N[V])===x&&(S[W++]=N[V]);for(let V=0;V<A;V++)E(N[V])!==x&&(S[W++]=N[V]);return S}function k(P,N){const T=P.values,E=P.kind;if((E==="object"||E===void 0)&&(Array.isArray(T)||ArrayBuffer.isView(T))&&!P.presence)return T;const S=H(P),x=new Array(F(P)||0);for(let W=0;W<N.length;W++){const V=N[W];x[V]=S(V)}return x}function d(P,N){for(let T=0;T<N.length;T++)if(typeof P[N[T]]!="string")return!1;return!0}function p(P,N,T,E,A){const S=P.length,x=Uint32Array.from(P);if(S<2||E<1)return x;const W=new Uint32Array(S),V=E-1;for(let G=0;G<S;G++){const Q=T[N[G]];W[G]=A?V-Q:Q}return u(n(x,W,S,E),S)}function b(P,N,T){const E=X(T),A=new Array(N);for(let x=0;x<N;x++)A[x]=x;A.sort((x,W)=>E(P[x],P[W])||x-W);const S=new Uint32Array(N);for(let x=0;x<N;x++)S[A[x]]=x;return S}function O(P,N,T){const E=N.length,A=new Map,S=[],x=new Uint32Array(E);for(let G=0;G<E;G++){const Q=P[N[G]];let ee=A.get(Q);ee===void 0&&(ee=S.length,A.set(Q,ee),S.push(Q)),x[G]=ee}const W=S.length,V=b(S,W,T.locale);return p(N,x,V,W,!!T.descending)}function y(P,N,T){const E=k(P,N);if(N.length>=2&&d(E,N)){const x=P.stringRank;return x&&x.version===P.version&&x.usable(N,E,T.locale)?x.sort(N,T):O(E,N,T)}const A=X(T.locale),S=T.descending?(x,W)=>A(W,x):A;return v(E,N,S)}function M(P,N,T){const E=k(P,N),A=T.compare,x=!!T.descending?(W,V)=>-A(W,V,void 0,void 0,!0):(W,V)=>A(W,V,void 0,void 0,!1);return v(E,N,x)}function D(P,N){const T=N.length,E=K(P),A=P.values,S=P.kind==="float64"&&!!A,x=P.kind==="object"||P.kind==="multi"||P.kind===void 0;if(!E&&!S&&!x)return{present:N,absent:j};const W=new Uint32Array(T),V=new Uint32Array(T);let G=0,Q=0;if(E&&S)for(let ee=0;ee<T;ee++){const ne=N[ee];E(ne)===1&&!Number.isNaN(A[ne])?W[G++]=ne:V[Q++]=ne}else if(S&&!E)for(let ee=0;ee<T;ee++){const ne=N[ee];Number.isNaN(A[ne])?V[Q++]=ne:W[G++]=ne}else if(E&&!x)for(let ee=0;ee<T;ee++){const ne=N[ee];E(ne)===1?W[G++]=ne:V[Q++]=ne}else{const ee=H(P);for(let ne=0;ne<T;ne++){const se=N[ne];Z(ee(se))?V[Q++]=se:W[G++]=se}}return Q===0?{present:N,absent:j}:{present:W.subarray(0,G),absent:V.subarray(0,Q)}}function _(P,N,T){if(N.length===0)return P;const E=new Uint32Array(P.length+N.length);return T?(E.set(N,0),E.set(P,N.length)):(E.set(P,0),E.set(N,P.length)),E}function I(P,N,T={}){const E=N||B(F(P,T));if(!P||E.length<2)return Uint32Array.from(E);const{present:A,absent:S}=D(P,E);if(A.length===0)return Uint32Array.from(E);const x=!!T.descending;let W;if(typeof T.compare=="function")W=M(P,A,T);else switch(P.kind){case"float64":W=o(P.values,A,x);break;case"int32":W=a(P.values,A,x);break;case"dictionary":W=h(P,A,T);break;case"bitset":W=g(P,A,x);break;default:W=y(P,A,T);break}return _(W,S,!!T.nullsFirst)}function L(P,N,T,E={}){const A=N||[],S=A.length&&(A[0].handle||$(P,A[0].col))||P&&P[0];let x=T||B(F(S,E));for(let W=A.length-1;W>=0;W--){const V=A[W],G=V.handle||$(P,V.col)||P&&P[W];G&&(x=I(G,x,{descending:V.descending!==void 0?!!V.descending:V.dir==="desc",nullsFirst:!!V.nullsFirst,locale:V.locale!==void 0?V.locale:E.locale,compare:V.compare}))}return x instanceof Uint32Array?x:Uint32Array.from(x)}function $(P,N){if(!(!P||N===void 0)){for(let T=0;T<P.length;T++)if(P[T]&&P[T].id===N)return P[T]}}}),Ue("packages/core/src/store/stringrank.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_MAX_DISTINCT",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"StringRankIndex",{enumerable:!0,get:function(){return B}});const te=U("packages/core/src/compute/sort.js"),C=te.collateStringRanks,q=te.rankSortStrings,z=1e5;class B{#e=[];#t=new Map;#n;#r=0;#s=0;#i=-1;#o;#l=!1;#a=null;#c=-1;#u="\0";constructor(K=z){this.#o=K>0?K:z,this.#n=new Uint32Array(0)}get version(){return this.#i}set version(K){this.#i=K}get generation(){return this.#s}get size(){return this.#e.length}get capped(){return this.#l}get length(){return this.#r}get bytes(){let K=this.#n.byteLength;const F=this.#e;for(let X=0;X<F.length;X++)K+=F[X].length*2+24;return K}#d(K,F){const X=this.#t.get(K);if(X!==void 0)return X;if(this.#l)return-1;if(F&&this.#e.length>=this.#o)return this.#l=!0,-1;const H=this.#e.length;return this.#e.push(K),this.#t.set(K,H),this.#s++,H}build(K,F){const X=F|0;this.#e=[],this.#t=new Map,this.#s=0,this.#l=!1,this.#a=null,this.#c=-1,this.#n=new Uint32Array(X);for(let H=0;H<X;H++){const j=K[H],w=typeof j=="string"?this.#d(j,!1):-1;this.#n[H]=w<0?0:w}this.#r=X}append(K,F,X){const H=(F|0)+(X|0);if(H>this.#n.length){const j=new Uint32Array(H);j.set(this.#n.subarray(0,this.#r)),this.#n=j}for(let j=F|0;j<H;j++){const w=K[j],m=typeof w=="string"?this.#d(w,!0):-1;this.#n[j]=m<0?0:m}this.#r=Math.max(this.#r,H)}ranks(K){const F=K||"";if(this.#a&&this.#c===this.#s&&this.#u===F)return this.#a;const X=C(this.#e,this.#e.length,K);return this.#a=X,this.#c=this.#s,this.#u=F,X}usable(K,F,X){if(this.#l||this.#e.length===0)return!1;const H=this.#n,j=this.#e,w=this.#r;for(let m=0;m<K.length;m++){const c=K[m];if(c>=w||j[H[c]]!==F[c])return!1}return!0}sort(K,F){const X=this.ranks(F.locale),H=this.#e.length,j=K.length,w=new Uint32Array(j),m=this.#n;for(let c=0;c<j;c++)w[c]=m[K[c]];return q(K,w,X,H,!!F.descending)}}}),Ue("packages/core/src/store/columnstore.js",function(e,U){"use strict";Object.defineProperty(e,"REMOVED",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"toFloat",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ColumnHandle",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"ColumnStore",{enumerable:!0,get:function(){return g}});const C=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/paths.js").pathGetter,F=U("packages/core/src/store/bitset.js").Bitset,H=U("packages/core/src/store/dictionary.js").Dictionary,w=U("packages/core/src/store/multivalue.js").MultiValue,c=U("packages/core/src/store/stringrank.js").StringRankIndex,f=4294967295,l=1024,r=5e3,t=.2,i=new Set(["float64","int32","bitset","dictionary","object","multi"]);function s(k){return k==null}function n(k){if(typeof k=="number")return k;if(k instanceof Date)return k.getTime();if(typeof k=="boolean")return k?1:0;const d=Number(k);return Number.isNaN(d)&&typeof k=="string"?Date.parse(k):d}function u(k){const d=n(k);return Number.isFinite(d)?d|0:0}function o(k){return s(k)?[]:Array.isArray(k)?k:[k]}function a(k,d){switch(k.kind){case"float64":case"int32":return k.buf[d];case"bitset":return k.bits.get(d)===1;case"dictionary":return k.dict.valueOf(k.buf[d]);case"multi":{const p=k.mv.at(d),b=new Array(p.length);for(let O=0;O<p.length;O++)b[O]=k.dict.valueOf(p[O]);return b}default:return k.buf[d]}}function h(k,d){switch(k.kind){case"float64":case"int32":return k.values[d];case"bitset":return(k.values[d>>3]&1<<(d&7))!==0;case"dictionary":return(k.table||[])[k.values[d]];case"multi":{const p=k.offsets[d],b=k.offsets[d+1],O=k.table||[],y=new Array(b-p);for(let M=p;M<b;M++)y[M-p]=O[k.values[M]];return y}default:return k.values[d]}}class v{#e;#t;#n;#r;#s;#i;#o;#l=!1;#a=null;#c=null;#u=null;#d=null;#f=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#A=null;#w=null;#O=!1;constructor(d,p){this.#e=d.id;const b=i.has(d.kind)?d.kind:"object";d.kind&&!i.has(d.kind)&&C(`store.kind.${d.id}`,`column "${d.id}" declares unknown storage kind "${d.kind}"; falling back to object`),this.#n=b,this.#t=b,this.#r=d.nullable!==!1,this.#o=d.dictionary??null,this.#i=p,this.#s=z(d.read)?d.read:Z(d.field||d.id),this.#h=d.stringRankIndex!=="off",this.#p=typeof d.stringRankMaxDistinct=="number"?d.stringRankMaxDistinct:0,this.#A=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.#O?null:this.#l?this.#t==="bitset"?this.#c.words:this.#t==="multi"?this.#u.values:this.#a:this.#P().values}get presence(){return this.#O||!this.#r?null:this.#l?this.#g:this.#P().presence}get dict(){return this.#O||!this.#l?null:this.#t==="dictionary"||this.#t==="multi"?this.#d:null}get stringRank(){if(this.#O||!this.#h||this.kind!=="object")return null;const d=this.values,p=this.#i.physical();if(!d||p===0)return null;if(this.#f===null){if(typeof d[0]!="string")return null;const b=new c(this.#v());return b.build(d,p),b.version=this.#y,this.#f=b,this.#m=this.#y,b.capped?null:b}return this.#f.length<p&&this.#f.append(d,this.#f.length,p-this.#f.length),this.#f.version=this.#y,this.#m=this.#y,this.#f.capped?null:this.#f}#v(){return this.#p}#T(){this.#f=null,this.#m=-1}get offsets(){return this.#O||!this.#l||this.#t!=="multi"?null:this.#u.offsets}get version(){return this.#y}get bytes(){let d=0;return this.#a&&(d+=this.#a.byteLength??this.#a.length*8),this.#c&&(d+=this.#c.bytes),this.#u&&(d+=this.#u.bytes),this.#g&&(d+=this.#g.bytes),this.#d&&(d+=this.#d.bytes),this.#A&&(d+=this.#A.size*24),d}get(d){if(!this.#O&&!(d<0||d>=this.#i.physical())){if(!this.#l)return this.#M(d);if(this.#r&&this.#g.get(d)===0)return null;switch(this.#t){case"float64":case"int32":return this.#a[d];case"bitset":return this.#c.get(d)===1;case"dictionary":return this.#d.valueOf(this.#a[d]);case"multi":{const p=this.#u.at(d),b=new Array(p.length);for(let O=0;O<p.length;O++)b[O]=this.#d.valueOf(p[O]);return b}default:return this.#a[d]}}}set(d,p){this.#O||(this.#l?this.#E(d,p):this.#A.set(d,p===void 0?null:p),this.#f&&this.#T(),this.#y++)}read(d){return this.#s(d)}appendColumn(d,p,b){if(this.#O||b<=0)return;if(!this.#l){this.#y++;return}const O=this.#s,y=this.#r,M=this.#g;let D=!1;switch(this.#t){case"float64":{const _=this.#a;for(let I=0;I<b;I++){const L=O(d[I]);if(typeof L=="number"){y&&M.set(p+I),_[p+I]=L;continue}const $=L==null;y?M.assign(p+I,!$):$&&(D=!0),_[p+I]=$?NaN:n(L)}break}case"int32":{const _=this.#a;for(let I=0;I<b;I++){const L=O(d[I]),$=L==null;y?M.assign(p+I,!$):$&&(D=!0),_[p+I]=$?0:u(L)}break}case"bitset":{const _=this.#c;for(let I=0;I<b;I++){const L=O(d[I]),$=L==null;y?M.assign(p+I,!$):$&&(D=!0),_.assign(p+I,!$&&!!L)}break}case"dictionary":{const _=this.#a,I=this.#d;for(let L=0;L<b;L++){const $=O(d[L]),P=$==null;y?M.assign(p+L,!P):P&&(D=!0),_[p+L]=P?0:I.codeOf($)}break}case"multi":{const _=this.#u,I=this.#d;for(let L=0;L<b;L++){const $=O(d[L]),P=$==null;y?M.assign(p+L,!P):P&&(D=!0);const N=o($),T=new Array(N.length);for(let E=0;E<N.length;E++)T[E]=I.codeOf(N[E]);_.write(p+L,T)}break}default:{const _=this.#a;for(let I=0;I<b;I++){const L=O(d[I]),$=L==null;y?M.assign(p+I,!$):$&&(D=!0),_[p+I]=$?null:L}break}}D&&C(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#f&&this.#t==="object"&&(this.#f.append(this.#a,p,b),this.#f.version=this.#y+1,this.#m=this.#y+1),this.#y++}appendPacked(d,p,b){if(this.#O||b<=0||!d)return;if(!this.#l){this.#y++;return}const O=this.#g,y=d.presence;if(O)if(y)for(let D=0;D<b;D++)O.assign(p+D,(y[D>>3]&1<<(D&7))!==0);else for(let D=0;D<b;D++)O.set(p+D);const M=d.kind===this.#t;if(M&&(this.#t==="float64"||this.#t==="int32")){this.#a.set(d.values,p),this.#y++;return}if(M&&this.#t==="bitset"){const D=d.values;for(let _=0;_<b;_++)this.#c.assign(p+_,(D[_>>3]&1<<(_&7))!==0);this.#y++;return}if(M&&this.#t==="dictionary"){const D=d.table||[],_=new Uint32Array(D.length);for(let P=0;P<D.length;P++)_[P]=this.#d.codeOf(D[P]);const I=d.values,L=this.#a,$=O;for(let P=0;P<b;P++){if($&&(y&&(y[P>>3]&1<<(P&7))===0)){L[p+P]=0;continue}L[p+P]=_[I[P]]??0}this.#y++;return}if(M&&this.#t==="multi"){const D=d.table||[],_=new Uint32Array(D.length);for(let $=0;$<D.length;$++)_[$]=this.#d.codeOf(D[$]);const I=d.values,L=d.offsets;for(let $=0;$<b;$++){const P=L[$],N=L[$+1],T=new Array(N-P);for(let E=P;E<N;E++)T[E-P]=_[I[E]]??0;this.#u.write(p+$,T)}this.#y++;return}for(let D=0;D<b;D++){const _=y?(y[D>>3]&1<<(D&7))===0:d.kind==="object"?d.values[D]===null:!1;this.#E(p+D,_?null:h(d,D))}this.#y++}touch(){this.#y++}columnarise(d,p){if(this.#l||this.#O)return;const b=new Array(p);for(let O=0;O<p;O++)b[O]=this.#M(O);this.#t=this.#n,this.#l=!0,this.#S(d);for(let O=0;O<p;O++)this.#E(O,b[O]);this.#A.clear(),this.#w=null,this.#T(),this.#y++}grow(d){if(!(!this.#l||this.#O||d<=this.#b)){switch(this.#t){case"float64":case"int32":case"dictionary":{const p=new this.#a.constructor(d);p.set(this.#a),this.#a=p;break}case"bitset":this.#c.grow(d);break;case"multi":break;default:this.#a.length=d;break}this.#g&&this.#g.grow(d),this.#b=d,this.#y++}}convert(d){if(this.#O||!i.has(d)||(this.#n=d,!this.#l||d===this.#t))return!1;const p={kind:this.#t,buf:this.#a,bits:this.#c,mv:this.#u,dict:this.#d},b=this.#i.physical(),O=this.#g;this.#t=d,this.#S(this.#b);for(let y=0;y<b;y++){const M=O!==null&&O.get(y)===0;M&&d!=="multi"||this.#E(y,M?null:a(p,y))}return this.#T(),this.#y++,!0}compact(d,p,b){if(!this.#O){if(this.#T(),!this.#l){const O=this.#A;if(O.size){const y=new Map;for(const[M,D]of O)d[M]!==f&&y.set(d[M],D);this.#A=y}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const O=this.#a;for(let y=0;y<p;y++)d[y]!==f&&(O[d[y]]=O[y]);if(this.#t==="object")for(let y=b;y<p;y++)O[y]=void 0;break}case"bitset":{const O=this.#c;for(let y=0;y<p;y++)d[y]!==f&&O.assign(d[y],O.get(y)===1);for(let y=b;y<p;y++)O.clear(y);break}case"multi":this.#u.compact(d,b,f);break;default:break}if(this.#g){const O=this.#g;for(let y=0;y<p;y++)d[y]!==f&&O.assign(d[y],O.get(y)===1);for(let y=b;y<p;y++)O.clear(y)}this.#y++}}release(){this.#O||(this.#O=!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.#d=null,this.#f=null,this.#A=new Map,this.#w=null,this.#b=0,this.#y++)}#S(d){const p=Math.max(1,d);switch(this.#a=null,this.#c=null,this.#u=null,this.#t){case"float64":this.#a=new Float64Array(p);break;case"int32":this.#a=new Int32Array(p);break;case"bitset":this.#c=new F(p);break;case"dictionary":this.#a=new Uint32Array(p),this.#d=this.#d??new H(this.#o??[]);break;case"multi":this.#u=new w({rows:p,values:p}),this.#d=this.#d??new H(this.#o??[]);break;default:this.#a=new Array(p);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#d=null),this.#r&&(this.#g?this.#g.grow(p):this.#g=new F(p)),this.#b=p}#E(d,p){const b=s(p);switch(this.#r?this.#g.assign(d,!b):b&&C(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#t){case"float64":this.#a[d]=b?NaN:n(p);break;case"int32":this.#a[d]=b?0:u(p);break;case"bitset":this.#c.assign(d,!b&&!!p);break;case"dictionary":this.#a[d]=b?0:this.#d.codeOf(p);break;case"multi":{const O=o(p),y=new Array(O.length);for(let M=0;M<O.length;M++)y[M]=this.#d.codeOf(O[M]);this.#u.write(d,y);break}default:this.#a[d]=b?null:p;break}}#M(d){if(this.#A.has(d))return this.#A.get(d);const p=this.#s(this.#i.rowAt(d));return p===void 0?null:p}#P(){if(this.#w&&this.#w.version===this.#y)return this.#w;const d=this.#i.physical(),p=new Array(d),b=this.#r?new F(d):null;for(let O=0;O<d;O++){const y=this.#M(O);p[O]=y,b&&!s(y)&&b.set(O)}return this.#w={version:this.#y,values:p,presence:b},this.#w}}class g{#e;#t=new Map;#n=[];#r=[];#s=0;#i=0;#o=0;#l=0;#a=new F(0);#c=!1;#u=!0;#d;#f;#h;#p=!1;constructor(d,p={}){this.#e=Array.isArray(d)?d:[],this.#f=Math.max(1,p.initialCapacity??l),this.#u=p.retainSource!==!1,this.#d=this.#u?p.columnarBelow??r:0,this.#h=p.compactRatio??t;const b={rowAt:O=>this.#r[O],physical:()=>this.#s};for(const O of this.#e){if(!O||!O.id)continue;if(this.#t.has(O.id)){C(`store.dup.${O.id}`,`duplicate column id "${O.id}" in the store schema; ignoring the second`);continue}const y=new v(O,b);this.#t.set(O.id,y),this.#n.push(y)}this.#d<=0&&this.#b()}get count(){return this.#o}get physical(){return this.#s}get capacity(){return this.#c?this.#i:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let d=this.#a.bytes+this.#r.length*8;for(const p of this.#n)d+=p.bytes;return d}append(d){const p=this.#s;if(this.#p||!d)return{from:p,to:p};const b=d.length|0;if(b===0)return{from:p,to:p};if(this.#u)for(let y=0;y<b;y++)this.#r[p+y]=d[y];if(this.#s=p+b,this.#o+=b,this.#a.grow(this.#s),!this.#c){if(this.#s>=this.#d)this.#b();else for(const y of this.#n)y.touch();return{from:p,to:this.#s}}this.#m(this.#s);const O=this.#n;for(let y=0;y<O.length;y++)O[y].appendColumn(d,p,b);return{from:p,to:this.#s}}appendPacked(d,p){const b=this.#s;if(this.#p||!d)return{from:b,to:b};const O=d.count|0;if(O===0)return{from:b,to:b};if(this.#u&&p)for(let M=0;M<O;M++)this.#r[b+M]=p[M];this.#s=b+O,this.#o+=O,this.#a.grow(this.#s),this.#c||this.#b(),this.#m(this.#s);const y=new Map;for(const M of d.columns)y.set(M.id,M);for(const M of this.#n){const D=y.get(M.id);D?M.appendPacked(D,b,O):M.grow(this.#i)}return{from:b,to:this.#s}}source(d){if(this.#u)return this.#r[d];if(!(d<0||d>=this.#s))return this.#g(d)}setSource(d,p){this.#p||d<0||d>=this.#s||this.#u&&(this.#r[d]=p)}get(d,p){const b=this.#t.get(d);return b?b.get(p):void 0}set(d,p,b){if(this.#p||p<0||p>=this.#s)return;const O=this.#t.get(d);if(!O){C(`store.set.${d}`,`set() on unknown column "${d}"`);return}O.set(p,b)}remove(d){return this.#p||d<0||d>=this.#s||this.#a.get(d)===1?!1:(this.#a.set(d),this.#l++,this.#o--,!0)}live(d){return d<0||d>=this.#s?!1:this.#a.get(d)===0}compact(d={}){if(this.#p||this.#l===0||!d.force&&this.#l/this.#s<this.#h)return null;const p=this.#s,b=new Uint32Array(p);let O=0;for(let y=0;y<p;y++)b[y]=this.#a.get(y)===1?f:O++;for(const y of this.#n)y.compact(b,p,O);if(this.#u){const y=this.#r;for(let M=0;M<p;M++)b[M]!==f&&(y[b[M]]=y[M]);y.length=O}return this.#s=O,this.#o=O,this.#l=0,this.#a=new F(Math.max(this.#i,O)),b}column(d){return this.#t.get(d)}columns(){return this.#n.slice()}liveIndices(){const d=new Uint32Array(this.#o);if(this.#l===0){for(let b=0;b<this.#s;b++)d[b]=b;return d}let p=0;for(let b=0;b<this.#s;b++)this.#a.get(b)===0&&(d[p++]=b);return d}convert(d,p){const b=this.#t.get(d);return b?b.convert(p):!1}destroy(){if(!this.#p){this.#p=!0;for(const d of this.#n)d.release();this.#t.clear(),this.#n.length=0,this.#r.length=0,this.#a.release(),this.#s=0,this.#o=0,this.#l=0,this.#i=0}}#m(d){if(d<=this.#i)return;let p=this.#i||this.#f;for(;p<d;)p*=2;for(const b of this.#n)b.grow(p);this.#a.grow(p),this.#i=p}#g(d){const p={};for(const b of this.#n)p[b.id]=b.get(d);return p}#b(){if(this.#c)return;let d=this.#f;for(;d<this.#s;)d*=2;this.#c=!0,this.#i=d,this.#a.grow(d);for(const p of this.#n)p.columnarise(d,this.#s)}}}),Ue("packages/core/src/store/pool.js",function(e,U){"use strict";Object.defineProperty(e,"MaskPool",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"sharedPool",{enumerable:!0,get:function(){return B}});const te=64,C=8;function q(K){let F=te;for(;F<K;)F*=2;return F}class z{#e=new Map;#t=new WeakSet;#n;#r=0;#s={acquired:0,reused:0,released:0};constructor(F={}){this.#n=F.limit??C}get bytes(){return this.#r}mask(F){const X=new Uint8Array(this.#i(F),0,F);return X.fill(0),X}indices(F){return new Uint32Array(this.#i(F*4),0,F)}release(F){if(!F||!F.buffer)return!1;const X=F.buffer;if(!this.#t.has(X))return!1;this.#t.delete(X),this.#s.released++;const H=X.byteLength;let j=this.#e.get(H);return j||this.#e.set(H,j=[]),j.length>=this.#n||(j.push(X),this.#r+=H),!0}releaseAll(F){for(const X of F)this.release(X)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#s,retained:this.#r}}#i(F){const X=q(F),H=this.#e.get(X);this.#s.acquired++;let j;return H&&H.length?(j=H.pop(),this.#r-=X,this.#s.reused++):j=new ArrayBuffer(X),this.#t.add(j),j}}function B(){return Z??=new z,Z}let Z=null}),Ue("packages/core/src/compute/sortspec.js",function(e,U){"use strict";Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return B}});function te(Z){return{locale:Z===void 0?void 0:String(Z),numeric:!0,sensitivity:"variant"}}function C(Z){return!!Z&&typeof Z.compare!="function"}function q(Z){if(!Z)return!0;for(let K=0;K<Z.length;K++)if(!C(Z[K]))return!1;return!0}function z(Z,K){const F=Z.col!==void 0?Z.col:Z.handle&&Z.handle.id,X=Z.locale!==void 0?Z.locale:K;return{col:F,descending:Z.descending!==void 0?!!Z.descending:Z.dir==="desc",nullsFirst:!!Z.nullsFirst,collation:te(X)}}function B(Z,K){const F=Z||[],X=new Array(F.length);for(let H=0;H<F.length;H++)X[H]=z(F[H],K);return X}}),Ue("packages/core/src/compute/facet.js",function(e,U){"use strict";Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"orderedReader",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"toNumeric",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return p}});const te=U("packages/core/src/compute/handle.js"),C=te.presenceReader,q=te.valueReader,z=te.dictSize,B=te.dictValue,Z=Object.freeze(["equal","quantile","log"]),K=Object.freeze(["hour","day","week","month","quarter","year"]),F=20,X=50,H=1e4;function j(b,O){if(!b)return"none";const y=O;if(y&&(y.multi===!0||typeof y.items=="function"))return"category";const M=O&&O.base;if(M==="date"||M==="datetime"||M==="time"||M==="dateString")return"date";switch(b.kind){case"bitset":return"boolean";case"float64":case"int32":return"numeric";case"dictionary":return"category";case"multi":return"category";default:return M==="number"?"numeric":M==="boolean"?"boolean":M==="text"?"category":"none"}}function w(b){const O=b.values,y=b.kind;if((y==="float64"||y==="int32")&&O)return D=>O[D];const M=q(b);return D=>m(M(D))}function m(b){if(typeof b=="number")return b;if(b instanceof Date)return b.getTime();if(b==null||b==="")return NaN;if(typeof b=="boolean")return b?1:0;if(typeof b=="string"){const O=Number(b);if(Number.isFinite(O))return O;const y=Date.parse(b);return Number.isFinite(y)?y:NaN}return NaN}function c(b,O,y,M=X){if(!b)return{cardinality:0,exact:!0};if(b.dict)return{cardinality:z(b.dict),exact:!0};if(b.kind==="bitset")return{cardinality:2,exact:!0};const D=q(b),_=O?O.length:y,I=new Set;for(let L=0;L<_;L++){const $=D(O?O[L]:L);if($!=null&&(I.add($),I.size>M))return{cardinality:I.size,exact:!1}}return{cardinality:I.size,exact:!0}}const f=36e5,l=864e5;function r(b,O=F){const y=Number.isFinite(b)&&b>0?b:0,M=Math.max(1,O)*2;return y/f<=M?"hour":y/l<=M?"day":y/(7*l)<=M?"week":y/(30*l)<=M?"month":y/(91*l)<=M?"quarter":"year"}function t(b,O){if(!Number.isFinite(b))return NaN;const y=new Date(b);switch(O){case"hour":return y.setMinutes(0,0,0),y.getTime();case"day":return y.setHours(0,0,0,0),y.getTime();case"week":{y.setHours(0,0,0,0);const M=(y.getDay()+6)%7;return y.setDate(y.getDate()-M),y.getTime()}case"month":return y.setDate(1),y.setHours(0,0,0,0),y.getTime();case"quarter":return y.setMonth(Math.floor(y.getMonth()/3)*3,1),y.setHours(0,0,0,0),y.getTime();default:return y.setMonth(0,1),y.setHours(0,0,0,0),y.getTime()}}function i(b,O){const y=new Date(b);switch(O){case"hour":y.setHours(y.getHours()+1);break;case"day":y.setDate(y.getDate()+1);break;case"week":y.setDate(y.getDate()+7);break;case"month":y.setMonth(y.getMonth()+1);break;case"quarter":y.setMonth(y.getMonth()+3);break;default:y.setFullYear(y.getFullYear()+1);break}return y.getTime()}function s(b,O,y){const M=w(b),D=C(b),_=O?O.length:y;let I=1/0,L=-1/0,$=0,P=0;for(let N=0;N<_;N++){const T=O?O[N]:N;if(D&&!D(T)){$++;continue}const E=M(T);if(!Number.isFinite(E)){$++;continue}E<I&&(I=E),E>L&&(L=E),P++}return{min:I,max:L,nulls:$,finite:P}}function n(b,O,y,M){const D=w(b),_=C(b),I=O?O.length:y,L=I>M?I/M:1,$=[];for(let N=0;N<I;N+=L){const T=O?O[Math.floor(N)]:Math.floor(N);if(_&&!_(T))continue;const E=D(T);Number.isFinite(E)&&$.push(E)}const P=Float64Array.from($);return P.sort(),P}function u(b,O,y,M={}){const D=M.kind||j(b,M.type);return D==="none"||!b?{kind:"none",buckets:[],suppressed:"type"}:D==="boolean"?o(b,O,y):D==="category"?a(b,O,y,M):h(b,O,y,D,M)}function o(b,O,y){const M=C(b);let D=0;if(M){const I=O?O.length:y;for(let L=0;L<I;L++)M(O?O[L]:L)||D++}const _=[{value:!1,label:"false"},{value:!0,label:"true"}];return D>0&&_.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:_}}function a(b,O,y,M){const D=M.cardinalityLimit??X,{cardinality:_}=c(b,O,y,D);if(_>D&&(M.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:_};const I=q(b),L=O?O.length:y,$=new Map;let P=0;for(let S=0;S<L;S++){const x=I(O?O[S]:S);if(x==null||x===""){P++;continue}if(Array.isArray(x)){if(!x.length){P++;continue}for(const W of x)$.set(W,($.get(W)||0)+1);continue}$.set(x,($.get(x)||0)+1)}let N=[...$.entries()];M.order==="alpha"?N.sort((S,x)=>String(S[0]).localeCompare(String(x[0]))):N.sort((S,x)=>x[1]-S[1]);let T=0,E=0;if(N.length>D){E=N.length-D;for(let S=D;S<N.length;S++)T+=N[S][1];N=N.slice(0,D)}const A=N.map(([S])=>({value:S,label:String(S)}));return T>0&&A.push({remainder:!0,label:`Other (${E} values)`}),P>0&&A.push({null:!0,label:"Empty"}),{kind:"category",buckets:A,cardinality:_}}function h(b,O,y,M,D){const{min:_,max:I,nulls:L,finite:$}=s(b,O,y);if(!$)return{kind:M,buckets:L?[{null:!0,label:"Empty"}]:[],empty:!0};const P=Math.max(1,Math.floor(D.buckets||F));let N=[];if(M==="date"){const E=K.includes(D.granularity)?D.granularity:r(I-_,P);let A=t(_,E);for(;A<=I&&N.length<4096;){const S=i(A,E);if(!(S>A))break;N.push({from:A,to:S}),A=S}return{kind:M,buckets:v(N,L),granularity:E}}const T=Z.includes(D.strategy)?D.strategy:"equal";if(T==="quantile"){const E=n(b,O,y,H);if(E.length){const A=[E[0]];for(let S=1;S<P;S++){const x=E[Math.min(E.length-1,Math.floor(S/P*E.length))];x>A[A.length-1]&&A.push(x)}A.push(I);for(let S=0;S<A.length-1;S++)N.push({from:A[S],to:A[S+1]})}}else if(T==="log"&&_>0){const E=Math.log10(_),S=(Math.log10(I)-E)/P||1;for(let x=0;x<P;x++)N.push({from:10**(E+x*S),to:10**(E+(x+1)*S)})}if(!N.length){const E=(I-_)/P||1;for(let A=0;A<P;A++)N.push({from:_+A*E,to:_+(A+1)*E})}return N[N.length-1].to=I,{kind:M,buckets:v(N,L),strategy:T,min:_,max:I}}function v(b,O){return O>0?[...b,{null:!0,label:"Empty"}]:b}function g(b,O,y,M,D){const _=M&&M.buckets||[],I=D&&D.length>=_.length?D.subarray(0,_.length):new Uint32Array(_.length);if(I.fill(0),!b||!_.length)return I;const L=_.length-1,$=!!_[L]&&_[L].null===!0,P=O?O.length:y;if(M.kind==="boolean"){const S=q(b);for(let x=0;x<P;x++){const W=S(O?O[x]:x);if(W==null){$&&I[L]++;continue}I[W?1:0]++}return I}if(M.kind==="category"){const S=new Map;for(let V=0;V<_.length;V++)!_[V].null&&!_[V].remainder&&S.set(_[V].value,V);const x=_.findIndex(V=>V.remainder),W=q(b);for(let V=0;V<P;V++){const G=W(O?O[V]:V);if(G==null||G===""){$&&I[L]++;continue}if(Array.isArray(G)){if(!G.length){$&&I[L]++;continue}for(const ee of G){const ne=S.get(ee);ne!==void 0?I[ne]++:x>=0&&I[x]++}continue}const Q=S.get(G);Q!==void 0?I[Q]++:x>=0&&I[x]++}return I}const N=$?_.length-1:_.length,T=new Float64Array(N+1);for(let S=0;S<N;S++)T[S]=_[S].from;T[N]=N?_[N-1].to:0;const E=w(b),A=C(b);for(let S=0;S<P;S++){const x=O?O[S]:S;if(A&&!A(x)){$&&I[L]++;continue}const W=E(x);if(!Number.isFinite(W)){$&&I[L]++;continue}const V=k(T,N,W);V>=0&&I[V]++}return I}function k(b,O,y){if(!O||y<b[0])return-1;if(y>=b[O])return y===b[O]?O-1:-1;let M=0,D=O-1;for(;M<D;){const _=M+D+1>>>1;y>=b[_]?M=_:D=_-1}return M}function d(b,O,y,M={}){const D=M.bounds||u(b,M.boundsIndices??O,y,M);return{bounds:D,counts:g(b,O,y,D)}}const p=d}),Ue("packages/core/src/compute/pivotmatrix.js",function(e,U){"use strict";Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return t}});const C=U("packages/core/src/compute/handle.js").valueComparator,z=U("packages/core/src/compute/total.js").total,Z=U("packages/core/src/compute/group.js").packKeys,K=U("packages/core/src/compute/pivot.js"),F=K.joinPath,X=K.DEFAULT_PATH_SEPARATOR,H=K.DEFAULT_MAX_COLUMNS,j="";function w(i,s,n={}){const u=n.separator||X,o=i||[],a=s instanceof Uint32Array?s:Uint32Array.from(s||[]),h=a.length;if(o.length===0)return{tuples:[[]],paths:[j],buckets:[a]};const{keyOf:v,readers:g}=Z(o,a,0),k=new Map,d=[],p=[],b=[];for(let I=0;I<h;I++){const L=a[I],$=v(L);let P=k.get($);if(P===void 0){P=d.length,k.set($,P),p.push($);const N=new Array(g.length);for(let T=0;T<g.length;T++)N[T]=g[T](L);d.push(N),b.push([])}b[P].push(L)}const O=C(n.locale),y=d.map((I,L)=>L);y.sort((I,L)=>{const $=d[I],P=d[L];for(let N=0;N<$.length;N++){const T=m($[N],P[N],O);if(T!==0)return T}return I-L});const M=new Array(y.length),D=new Array(y.length),_=new Array(y.length);for(let I=0;I<y.length;I++){const L=y[I];M[I]=d[L],D[I]=F(d[L],u),_[I]=Uint32Array.from(b[L])}return{tuples:M,paths:D,buckets:_}}function m(i,s,n){const u=i==null,o=s==null;return u||o?u&&o?0:u?1:-1:n(i,s)}function c(i,s,n){const u=[];for(let o=0;o<i.length;o++)n.has(i[o])&&u.push(i[o]);return Uint32Array.from(u)}function f(i,s,n,u){return{value:s.length?z(i,s,n,u):null,leaves:s,count:s.length}}function l(i){const s=i&&i.opts||{},n=s.separator||X,u=s.totalContext||{locale:s.locale},o=(i.measures||[]).filter(D=>D&&D.handle),a=i.leaves instanceof Uint32Array?i.leaves:Uint32Array.from(i.leaves||[]),h=w(i.rowHandles||[],a,{...s,separator:n}),v=w(i.columnHandles||[],a,{...s,separator:n}),g=s.maxColumns===void 0?H:s.maxColumns,k=v.paths.length*Math.max(1,o.length),d=new Map;if(g&&k>g)return{rowAxis:h,columnAxis:v,measures:o.map(D=>({colId:D.colId,fn:D.fn})),body:d,rowMargin:d,columnMargin:d,grand:d,columns:k,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${k} columns, above pivot.maxColumns of ${g}. Narrow the pivot columns or raise the limit.`,columns:k,maxColumns:g}};const p=new Map,b=new Map,O=new Map,y=new Map,M=v.buckets.map(D=>new Set(D));for(let D=0;D<v.paths.length;D++){const _=v.buckets[D],I=v.paths[D];for(const L of o)O.set(t(I,L.colId),f(L.handle,_,L.fn,u))}for(let D=0;D<h.paths.length;D++){const _=h.buckets[D],I=h.paths[D];for(const L of o)b.set(t(I,L.colId),f(L.handle,_,L.fn,u));for(let L=0;L<v.paths.length;L++){const $=c(_,v.buckets[L],M[L]);if($.length===0)continue;const P=v.paths[L];for(const N of o)p.set(r(I,P,N.colId),f(N.handle,$,N.fn,u))}}for(const D of o)y.set(D.colId,f(D.handle,a,D.fn,u));return{rowAxis:h,columnAxis:v,measures:o.map(D=>({colId:D.colId,fn:D.fn})),body:p,rowMargin:b,columnMargin:O,grand:y,columns:k,error:null}}function r(i,s,n){return`${i}\0${s}\0${n}`}function t(i,s){return`${i}\0${s}`}}),Ue("packages/core/src/compute/reference.js",function(e,U){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return l}});const C=U("packages/core/src/internal/paths.js").getPath,q=U("packages/core/src/compute/handle.js"),z=q.isMissing,B=q.valueComparator,K=U("packages/core/src/compute/filter.js").testValue,F="",X="\0";function H(i,s){const n=s.includes(".")?C(i,s):i?.[s];return n===void 0?null:n}function j(i,s,n={}){const u=s||[];let o=i.map((a,h)=>h);if(u.length===0)return o;for(let a=u.length-1;a>=0;a--)o=w(i,o,u[a],n);return o}function w(i,s,n,u){const o=n.locale!==void 0?n.locale:u.locale,a=B(o),h=n.descending!==void 0?!!n.descending:n.dir==="desc",v=[],g=[];for(const p of s){const b=H(i[p],n.col);z(b)?g.push(p):v.push(p)}const k=new Map;for(let p=0;p<v.length;p++)k.set(v[p],p);const d=(p,b)=>{const O=H(i[p],n.col),y=H(i[b],n.col);let M;return typeof n.compare=="function"?(M=n.compare(O,y,i[p],i[b],h),h&&(M=-M)):M=h?a(y,O):a(O,y),M!==0?M:k.get(p)-k.get(b)};return v.sort(d),n.nullsFirst?g.concat(v):v.concat(g)}function m(i,s,n={}){const u=[];for(let o=0;o<i.length;o++)c(i[o],s,n,o)&&u.push(o);return u}function c(i,s,n,u){if(!s)return!0;if(Array.isArray(s.conditions)){const o=s.conditions.filter(h=>h!=null);if(o.length===0)return!0;if(s.op==="or")return o.some(h=>c(i,h,n,u));const a=o.every(h=>c(i,h,n,u));return s.op==="not"?!a:a}return s.col===void 0&&typeof n.custom=="function"?!!n.custom(s,i,u):K(H(i,s.col),s,n.locale)}function f(i,s,n,u){const o=n||i.map((g,k)=>k),a=new Map,h=[],v=[];for(const g of o){const k=s.map((b,O)=>{const y=H(i[g],b);return u&&u[O]?u[O](y):y}),d=k.map(b=>b==null?X:String(b)).join(F);let p=a.get(d);p===void 0&&(p=h.length,a.set(d,p),h.push(k),v.push([])),v[p].push(g)}return{keys:h,buckets:v}}function l(i,s,n={}){const u=B(n.locale),o=i.filter(h=>!z(h)),a=o.map(r).filter(h=>h!==null);switch(s){case"count":return i.length;case"countValues":return o.length;case"sum":return a.reduce((h,v)=>h+v,0);case"avg":return o.length===0?null:a.reduce((h,v)=>h+v,0)/o.length;case"min":return o.length===0?null:o.reduce((h,v)=>u(v,h)<0?v:h);case"max":return o.length===0?null:o.reduce((h,v)=>u(v,h)>0?v:h);case"first":return i.length===0?null:t(i[0]);case"last":return i.length===0?null:t(i[i.length-1]);default:return null}}function r(i){if(typeof i=="number")return Number.isNaN(i)?null:i;if(i==null||i===""||typeof i=="boolean")return null;if(i instanceof Date)return i.getTime();const s=Number(i);return Number.isNaN(s)?null:s}function t(i){return i===void 0?null:i}}),Ue("packages/core/src/compute/index.js",function(e,U){"use strict";const te=U("packages/core/src/compute/sort.js");Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return te.sortColumn}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return te.sortMulti}}),Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return te.radixSortFloat64}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return te.radixSortInt32}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return te.rankSortDictionary}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return te.mergeSortComparator}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return te.collateStringRanks}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return te.rankSortStrings}});const C=U("packages/core/src/compute/sortspec.js");Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return C.collationDescriptor}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return C.isPortableSort}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return C.isPortableSortSet}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return C.describeSortEntry}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return C.describeSort}});const q=U("packages/core/src/compute/filter.js");Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return q.evaluateFilters}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return q.evaluateCondition}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return q.compact}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return q.testValue}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return q.compilePredicate}}),Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return q.releaseMask}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return q.pruneColumn}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return q.mentionsColumn}});const z=U("packages/core/src/compute/group.js");Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return z.groupByColumns}}),Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return z.packKeys}});const B=U("packages/core/src/compute/facet.js");Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return B.facet}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return B.computeBounds}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return B.countInto}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return B.bucketOf}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return B.facetKind}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return B.cardinalityOf}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return B.pickGranularity}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return B.floorTo}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return B.advance}}),Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return B.STRATEGIES}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return B.GRANULARITIES}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return B.DEFAULT_BUCKETS}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return B.DEFAULT_CARDINALITY_LIMIT}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return B.QUANTILE_SAMPLE}});const Z=U("packages/core/src/compute/total.js");Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return Z.TOTAL_FNS}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return Z.TOTAL_LABELS}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return Z.totalLabel}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return Z.total}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return Z.collectValues}});const K=U("packages/core/src/compute/pivot.js");Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return K.pivot}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return K.resolvePivotKeys}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return K.pivotKey}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return K.joinPath}}),Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return K.KEY_DELIMITER}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return K.DEFAULT_PATH_SEPARATOR}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return K.DEFAULT_MAX_COLUMNS}});const F=U("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return F.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return F.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return F.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return F.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return F.GRAND_PATH}});const X=U("packages/core/src/compute/reference.js");Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return X.referenceSort}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return X.referenceFilter}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return X.referenceGroup}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return X.referenceTotal}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return X.referencePasses}}),Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return X.referenceValue}});const H=U("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return H.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return H.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return H.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return H.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return H.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return H.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return H.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return H.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return H.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return H.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return H.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return H.isMissing}});const j=U("packages/core/src/compute/sketch.js");Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return j.Welford}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return j.Reservoir}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return j.HyperLogLog}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return j.SpaceSaving}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return j.KLL}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return j.hash32}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j.SKETCH_BOUNDS}});const w=U("packages/core/src/compute/windowed.js");Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return w.Window}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return w.WINDOW_KINDS}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return w.openWindow}});const m=U("packages/core/src/compute/statistics.js");Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return m.MAINTENANCE}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return m.APPROXIMATE}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return m.maintenanceOf}});const c=U("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return c.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return c.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return c.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return c.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return c.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return c.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return c.anomalyCondition}});const f=U("packages/core/src/compute/forecast.js");Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return f.FORECAST_METHODS}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return f.forecast}})}),Ue("packages/core/src/source/rows.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_ROW_HEIGHT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"KEY_SEP",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"groupPrefixKeys",{enumerable:!0,get:function(){return f}});const C=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/internal/predicates.js").isFunction,B=32,Z="\0";function K(l){return new F(l)}class F{#e;#t;constructor(r){this.#e=z(r&&r.rowKey)?r.rowKey:null;const t=r&&r.config?r.config.rowHeight:void 0;this.#t=typeof t=="number"||z(t)?t:B}get keyed(){return this.#e!==null}keyOf(r,t){if(this.#e){const i=this.#e(r);if(i!=null)return String(i)}else C("source.rowKey.missing","no config.rowKey; falling back to index identity.","Row changes, streaming dedupe, selection persistence and remote reload are disabled.");return`#${t}`}heightOf(r){return z(this.#t)?Number(this.#t(r))||B:this.#t}leaf(r,t,i=0,s=null){const n={key:this.keyOf(r,t),data:r,level:i,parent:s,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:t};return n.height=this.heightOf(n),n}group(r){const t={key:c(r.keyPath||r.path),data:null,level:r.level,parent:r.parent||null,children:[],group:!0,expanded:r.expanded!==!1,leafCount:r.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:r.column,groupValue:r.value,groupPath:r.path,hasChildren:r.hasChildren!==!1};return r.totals&&(t.totals=r.totals),t.height=this.heightOf(t),t}footer(r){const t={key:`${r.key}${Z}footer`,data:null,level:r.level,parent:r,group:!0,footer:!0,expanded:!1,leafCount:r.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:r.groupColumn,groupValue:r.groupValue,groupPath:r.groupPath,hasChildren:!1,totals:r.totals};return t.height=this.heightOf(t),t}detail(r,t){return{key:`${r.key}${Z}detail`,data:r.data,level:r.level+1,parent:r,group:!1,detail:!0,expanded:!1,leafCount:0,height:t,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:r.key}}grandTotal(r,t){const i={key:`${Z}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:t,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:r};return i.height=this.heightOf(i),i}skeleton(r,t=0,i=!1){const s={key:`${Z}pending${Z}${r}`,data:null,level:t,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:r,selected:!1,physical:null,pending:!0};return i&&(s.loadError=!0),s.height=this.heightOf(s),s}}function X(l,r,t,i){return{key:`${Z}pinned${Z}${t}${Z}${r}`,data:l,level:0,parent:null,group:!1,expanded:!1,leafCount:0,height:i,index:null,selected:!1,physical:null,hasChildren:!1,pinned:t}}function H(l,r){return new Proxy([],{get(t,i,s){if(i==="length")return l();if(typeof i=="string"){const n=Number(i);if(Number.isInteger(n)&&n>=0)return r(n)}return Reflect.get(t,i,s)},has(t,i){if(typeof i=="string"){const s=Number(i);if(Number.isInteger(s)&&s>=0)return s<l()}return Reflect.has(t,i)}})}function j(l){return l==null?"":String(l)}const w="";function m(l){if(l==null)return w;const r=String(l);return r.startsWith(w)?w+r:r}function c(l){const r=l||[];let t="g";for(let i=0;i<r.length;i++)t+=Z+m(r[i]);return t}function f(l){const r=new Array(l.length),t=[];for(let i=0;i<l.length;i++)t.push(l[i]),r[i]=c(t);return r}}),Ue("packages/core/src/source/handles.js",function(e,U){"use strict";Object.defineProperty(e,"HandleProvider",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"createHandleProvider",{enumerable:!0,get:function(){return Z}});const C=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce;class B{#e;#t;#n;#r=new Map;#s=0;constructor(F,X,H){this.#e=F,this.#t=X,this.#n=C(H)?H:()=>!1}get store(){const F=this.#e.store;return F&&C(F.column)?F:null}invalidate(){this.#s++}handle(F){const X=this.store;if(X){const m=X.column(F);if(m)return m}const H=this.#r.get(F);if(H&&H.builtAt===this.#s)return H.handle;const j=this.#i(F);if(!j)return;if(X&&this.#n()){z(`source.dropped.${F}`,`column "${F}" 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 w=this.#o(j);return this.#r.set(F,{handle:w,builtAt:this.#s}),w}#i(F){const X=this.#e.columns;return X&&C(X.get)?X.get(F):void 0}#o(F){const X=this.#t()||[],H=X.length,j=new Array(H),w=C(F.getValue)?c=>F.getValue(c):c=>c?.[F.field||F.id];for(let c=0;c<H;c++)j[c]=X[c]===void 0?void 0:w(X[c]);const m=this.#s;return{id:F.id,kind:"object",nullable:!1,values:j,presence:null,dict:null,offsets:null,get(c){return j[c]},version:m}}}function Z(K,F,X){return new B(K,F,X)}}),Ue("packages/core/src/compute/incremental.js",function(e,U){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return X}});const C=U("packages/core/src/store/columnstore.js").toFloat,q=Object.freeze(["sum","avg","countValues","min","max"]),z=Object.freeze(["float64"]),B=1e15;function Z(H,j){return typeof H!="string"||!q.includes(H)?!1:!!j&&z.includes(j.kind)}function K(H){if(H==null)return null;const j=C(H);return Number.isNaN(j)?null:j}class F{#e;#t=0;#n=0;#r=0;#s=1/0;#i=-1/0;#o=!1;#l=!1;constructor(j){this.#e=j}get valid(){return this.#o&&!this.#l}get fn(){return this.#e}seed(j){this.#a();for(let w=0;w<j.length;w++){const m=K(j[w]);m!==null&&this.#c(m)}this.#o=!0}seedColumn(j,w,m){this.#a();for(let c=0;c<m.length;c++){const f=m[c];if(w&&w(f)===0)continue;const l=j[f];Number.isNaN(l)||this.#c(l)}this.#o=!0}#a(){this.#t=0,this.#n=0,this.#r=0,this.#s=1/0,this.#i=-1/0,this.#l=!1}#c(j){if(!Number.isFinite(j)){this.#l=!0;return}const w=this.#t+j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-w+j:j-w+this.#t,this.#t=w,this.#r++,j<this.#s&&(this.#s=j),j>this.#i&&(this.#i=j)}#u(j){const w=this.#t-j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-w-j:-j-w+this.#t,this.#t=w,this.#r--}update(j,w){if(!this.#o)return!1;const m=K(j),c=K(w);return m===null&&c===null?!0:m!==null&&!Number.isFinite(m)||c!==null&&!Number.isFinite(c)?!1:this.#e==="min"||this.#e==="max"?m===null||c===null?!1:this.#e==="min"?c<this.#s?(this.#s=c,!0):m>this.#s:c>this.#i?(this.#i=c,!0):m<this.#i:Math.abs(this.#t)>B?!1:(m!==null&&this.#u(m),c!==null&&this.#c(c),!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.#s:null;case"max":return this.#r?this.#i:null;default:return this.#t+this.#n}}invalidate(){this.#o=!1}}const X=F}),Ue("packages/core/src/source/filterwire.js",function(e,U){"use strict";Object.defineProperty(e,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"resolveRelativeRange",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"relativeTokenOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"relativeTokenHelp",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"isResolvableRelative",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"resolveRelativeCondition",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"forEachCondition",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"mapConditions",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"normaliseFilterSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"buildFilterSet",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"wireFilters",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"querySignature",{enumerable:!0,get:function(){return O}});const C=U("packages/core/src/internal/warn.js").warnOnce,q="source.remote.hostFilter",z="source.where.pageRelative";function B(D,_){!Array.isArray(D)||!D.length||C(z,`filters.where (${D.join(", ")}) runs over the rows the ${_} 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 Z(D){const _=(D||{}).config;!_||!_.hostFilter||C(q,"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 K="source.where.notApplied";function F(D,_){C(`${K}:${D}`,`filters.where("${D}") is registered but the ${_} 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 X="source.where.overThreshold";function H(D,_,I,L){!Array.isArray(D)||!D.length||C(`${X}:${_}`,`filters.where (${D.join(", ")}) is not applied to the ${_} pushdown source:`,I===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${I.toLocaleString()} rows, at or past the whereRowLimit of ${L.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 j=new Map;function w(D){let _=j.get(D);return _||(_=new Intl.DateTimeFormat("en-US",{timeZone:D,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),j.set(D,_)),_}function m(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function c(D,_){const I=w(_).formatToParts(new Date(D)),L={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const $ of I)$.type==="year"?L.y=+$.value:$.type==="month"?L.m=+$.value:$.type==="day"?L.d=+$.value:$.type==="hour"?L.h=+$.value%24:$.type==="minute"?L.mi=+$.value:$.type==="second"&&(L.s=+$.value);return L}function f(D,_){const I=c(D,_);return Date.UTC(I.y,I.m-1,I.d,I.h,I.mi,I.s)-Math.floor(D/1e3)*1e3}function l(D,_,I,L){const $=Date.UTC(D,_-1,I),P=$-f($,L);return $-f(P,L)}function r(D,_,I){const L=new Date(Date.UTC(D.y,D.m-1,D.d+_));return l(L.getUTCFullYear(),L.getUTCMonth()+1,L.getUTCDate(),I)}const t=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function i(D,_){if(typeof D!="string")return null;const I=D.trim().toLowerCase().replace(/[\s_-]+/g,""),L=/^last(\d*|n)days?$/.exec(I);if(L){const $=L[1]==="n"?"":L[1],P=Number($||_);return!Number.isFinite(P)||P<=0?null:{kind:"lastNDays",n:Math.floor(P)}}switch(I){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 s(D,_={}){const I=i(D,_.n);if(!I)return null;const L=_.tz||m(),$=_.now instanceof Date?_.now.getTime():typeof _.now=="number"?_.now:Date.now(),P=c($,L),N=l(P.y,P.m,P.d,L),T=r(P,1,L);let E=N,A=T;switch(I.kind){case"today":break;case"yesterday":E=r(P,-1,L),A=N;break;case"lastNDays":A=_.includeToday?T:N,E=r(P,_.includeToday?-(I.n-1):-I.n,L);break;case"thisWeek":{const S=Number.isFinite(_.weekStartsOn)?Number(_.weekStartsOn):1,W=(new Date(Date.UTC(P.y,P.m-1,P.d)).getUTCDay()-S+7)%7;E=r(P,-W,L),A=r(P,-W+7,L);break}case"thisMonth":E=l(P.y,P.m,1,L),A=l(P.m===12?P.y+1:P.y,P.m===12?1:P.m+1,1,L);break;case"thisQuarter":case"quarterToDate":{const S=Math.floor((P.m-1)/3)*3+1;E=l(P.y,S,1,L),A=I.kind==="quarterToDate"?T:S===10?l(P.y+1,1,1,L):l(P.y,S+3,1,L);break}case"thisYear":case"yearToDate":E=l(P.y,1,1,L),A=I.kind==="yearToDate"?T:l(P.y+1,1,1,L);break;default:return null}return{from:new Date(E).toISOString(),to:new Date(A).toISOString(),bounds:"[)",tz:L,relative:I.kind==="lastNDays"?`last${I.n}Days`:I.kind,n:I.n}}function n(D){if(!D||typeof D!="object")return null;const _=D.value;if(_&&typeof _=="object"&&!Array.isArray(_)&&"relative"in _)return{token:String(_.relative),n:typeof _.n=="number"?_.n:void 0};if(D.op==="relative"&&typeof D.value=="string")return{token:D.value,n:void 0};const I=D.meta;return I&&typeof I.relative=="string"&&D.value===void 0?{token:I.relative,n:typeof I.n=="number"?I.n:void 0}:null}function u(){return`Known tokens: ${t.filter(_=>_!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function o(D){const _=n(D);return _?i(_.token,_.n)!==null:!1}function a(D,_={}){const I=n(D);if(!I)return D;const L=s(I.token,{..._,n:I.n});return L?{...D,type:D.type||"date",op:"between",value:[L.from,L.to],bounds:D.bounds||L.bounds,meta:{...D.meta||{},relative:L.relative,tz:L.tz}}:(C(`source.relative.${I.token}`,`unknown relative date token "${I.token}"; sending the condition unresolved.`,u()),D)}function h(D){return!!D&&typeof D=="object"&&Array.isArray(D.conditions)}function v(D,_){if(D){if(h(D)){for(const I of D.conditions)v(I,_);return}_(D)}}function g(D,_){if(!D)return null;if(!h(D))return _(D);const I=D;let L=!1;const $=[];for(const P of I.conditions){const N=g(P,_);N!==P&&(L=!0),N&&$.push(N)}return!L&&$.length===I.conditions.length?D:$.length?{...I,conditions:$}:null}function k(D){if(!D)return null;if(!h(D))return D;const _=D,I=[];for(const L of _.conditions){const $=k(L);$&&I.push($)}return I.length?{op:_.op,conditions:I}:null}function d(D){const _=k(D);return _?h(_)&&_.op==="and"?_:{op:"and",conditions:[_]}:null}function p(D){const _=(D||[]).filter(Boolean);return _.length?{op:"and",conditions:_}:null}function b(D,_={}){const I=g(D,L=>a(L,_));return d(I)}function O(D){const _=y(D.filters??null);return JSON.stringify([_,D.sort??null,D.quick??"",D.groupBy??null,D.pivotBy??null,M(D.context)])}function y(D){if(!D)return null;if(h(D)){const L=D;return{op:L.op,conditions:L.conditions.map(y)}}const _=D,I=_.meta&&typeof _.meta.relative=="string"?_.meta.relative:n(_)?.token;return{col:_.col,op:_.op,bounds:_.bounds??null,caseSensitive:_.caseSensitive??!1,value:I?`rel:${I}`:_.value??null}}function M(D){if(D==null)return null;try{return JSON.parse(JSON.stringify(D))}catch{return C("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),Ue("packages/core/src/source/tree.js",function(e,U){"use strict";Object.defineProperty(e,"SYNTHETIC",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"buildFromPath",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"assignLevels",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resolveTree",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"buildTree",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"indexTree",{enumerable:!0,get:function(){return c}});const C=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce,B="",Z="\0tree:";function K(f,l){return{physical:f,key:l,level:0,children:[],value:void 0}}function F(f,l){const r=[],t=new Map;for(let i=0;i<f.length;i++){const s=f[i],n=l.pathOf(s),u=Array.isArray(n)?n.map(a=>String(a)):[];if(!u.length){const a=K(s,l.keyOf(s));r.push(a);continue}let o=null;for(let a=0;a<u.length;a++){const h=u.slice(0,a+1).join(B),v=a===u.length-1;let g=t.get(h);g&&v&&g.physical===-1&&(g.physical=s,g.key=l.keyOf(s)),g||(g=K(v?s:-1,v?l.keyOf(s):Z+h),g.level=a,g.value=u[a],t.set(h,g),o?o.children.push(g):r.push(g)),o=g}}return{roots:r,nodes:t}}function X(f,l){const r=new Map,t=[];for(let u=0;u<f.length;u++){const o=f[u],a=l.keyOf(o),h=K(o,a);r.set(a,h);const v=l.parentOf(o);v!=null&&v!==""&&t.push({node:h,parent:String(v)})}let i=null;const s=new Map;for(const{node:u,parent:o}of t){const a=r.get(o);if(a){s.set(u.key,a);continue}l.orphans&&l.orphans!=="root"&&(i||(i=K(-1,`${Z}orphans`),i.value=l.orphans),s.set(u.key,i))}const n=[];for(const u of r.values()){const o=s.get(u.key);o?o.children.push(u):n.push(u)}return i&&i.children.length&&n.push(i),{roots:H(n,r,l.orphans,i),nodes:r}}function H(f,l,r,t){const i=new Set,s=[...f];for(;s.length;){const h=s.pop();if(!i.has(h.key)){i.add(h.key);for(const v of h.children)s.push(v)}}const n=[];for(const h of l.values())i.has(h.key)||n.push(h);if(!n.length)return f;const u=!!r&&r!=="root";z("tree.cycle",`tree.parentKey produced ${n.length} row(s) inside a parent cycle; `+(u?`they are shown under "${r}".`:"they are shown at the root."));for(const h of n)h.children=h.children.filter(v=>i.has(v.key));if(!u)return[...f,...n];let o=t;const a=[...f];return o||(o=K(-1,`${Z}orphans`),o.value=r,a.push(o)),o.children.push(...n),a}function j(f){let l=0;const r=(t,i)=>{for(const s of t)s.level=i,i>l&&(l=i),s.children.length&&r(s.children,i+1)};return r(f,0),l}function w(f,l){if(!f||typeof f!="object")return null;const r=f.path,t=f.parentKey,i=C(f.hasChildren)?s=>!!f.hasChildren(l.dataAt(s)):null;if(C(r))return{mode:"path",pathOf:s=>r(l.dataAt(s)),keyOf:l.keyOf,declaresChildren:i};if(t!=null){const s=C(t)?t:n=>n?.[t];return{mode:"parentKey",parentOf:n=>s(l.dataAt(n)),keyOf:l.keyOf,orphans:f.orphans||"root",declaresChildren:i}}return z("tree.shape","tree is configured with neither `path` nor `parentKey`; rows stay flat."),null}function m(f,l){const r=l.mode==="path"?F(f,l):X(f,l),t=j(r.roots);return{...r,depth:t}}function c(f,l){const r=new Map,t=i=>{for(let s=0;s<i.length;s++){const n=i[s];if(n.physical>=0){const u=l?l(n.physical):!1,o=u&&n.children.length===0;r.set(n.physical,{level:n.level,posinset:s+1,setsize:i.length,hasChildren:n.children.length>0||u,lazy:o})}n.children.length&&t(n.children)}};return t(f),r}}),Ue("packages/core/src/source/settle.js",function(e,U){"use strict";Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return C}});const te=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function C(q){const z=q&&typeof q=="object"?q.reason:null;return typeof z=="string"&&te.includes(z)}}),Ue("packages/core/src/source/memory.js",function(e,U){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"quickMatcher",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"MemorySource",{enumerable:!0,get:function(){return W}});const C=U("packages/core/src/internal/lru.js").Lru,q=U("packages/core/src/internal/warn.js"),z=q.warnOnce,B=q.fail,K=U("packages/core/src/internal/predicates.js").isFunction,X=U("packages/core/src/internal/compare.js").defaultCompare,j=U("packages/core/src/internal/merge.js").mergeRow,w=U("packages/core/src/source/rows.js"),m=w.createRowFactory,c=w.groupKey,f=w.groupPathElement,l=w.groupPrefixKeys,r=w.lazyRowView,i=U("packages/core/src/source/handles.js").createHandleProvider,s=U("packages/core/src/compute/incremental.js"),n=s.RunningTotal,u=s.isIncremental,a=U("packages/core/src/compute/handle.js").presenceReader,h=U("packages/core/src/source/filterwire.js"),v=h.querySignature,g=h.mapConditions,k=h.resolveRelativeCondition,d=U("packages/core/src/source/tree.js"),p=d.buildTree,b=d.resolveTree,O=d.indexTree,y=U("packages/core/src/source/settle.js"),M=y.PIPELINE_SETTLE_REASONS,D=y.isPipelineSettle,_=Object.freeze(["filter","sort","group","total","pivot","flatten"]),I=Object.freeze([]);function L(V,G){if(!V)return null;const Q=G==="grand"?V.grandTotal:V.groupTotal;return Q??V.total}function $(V){return!!V&&!V.running}function P(V){if(V)return V.value&&K(V.value.compare)?V.value.compare:K(V.compare)?V.compare:void 0}function N(V){const G=V&&V.dataType;return!G||!K(G.items)?null:{items:G.items,type:V.itemType&&V.itemType.name||"text"}}function T(V){return!!V&&(typeof V=="object"||typeof V=="function")&&K(V.then)}const E=new Uint32Array(0),A=4096;function S(V,G){return new W(V,G)}function x(V,G){if(G==="regex")try{const Q=new RegExp(V,"iu");return ee=>Q.test(ee)}catch{return Q=>Q.includes(V)}if(G==="fuzzy"){const Q=[...V].filter(ee=>ee!==" ");return Q.length?ee=>{let ne=0;for(let se=0;se<ee.length&&ne<Q.length;se++)ee[se]===Q[ne]&&ne++;return ne===Q.length}:()=>!0}if(G==="words"){const Q=V.split(/\s+/).filter(Boolean);return Q.length?ee=>Q.every(ne=>ee.includes(ne)):()=>!0}return Q=>Q.includes(V)}class W{mode="memory";#e;#t;#n;#r=!1;#s=null;#i;#o;#l=new Map;#a=!1;#c=0;#u=0;#d=new Map;#f=new Map;#h;#p=null;#m=W.#g();static#g(){return{slots:[],groupHeadings:I,unnumbered:I,pivot:null,inlineLeaves:null,matchCount:0,grand:null,grandLeaves:0,groupLeaves:null}}#b=new Map;#y=null;#A=new Map;#w=-1;#O=[];#v=new Map;#T=-1;#S=[];#E=null;#M=null;#P=null;#N=null;#R=null;#$=null;#V=null;#W=null;#D=Symbol("unset");#x=new Map;#Y=null;get#I(){return this.#m.slots}set#I(G){this.#m.slots=G}get#K(){return this.#m.inlineLeaves}set#K(G){this.#m.inlineLeaves=G}get#U(){return this.#m.groupHeadings}set#U(G){this.#m.groupHeadings=G}get#B(){return this.#m.unnumbered}set#B(G){this.#m.unnumbered=G}get#ce(){return this.#m.pivot}set#ce(G){this.#m.pivot=G}constructor(G,Q){this.#t=G||{mode:"memory"},this.#e=Q||{};const ee=this.#e.config||{};this.#n=this.#t.rows||ee.rows||[],this.#i=m(this.#e),this.#o=i(this.#e,()=>this.#n,()=>this.#r),this.#h=new C(Number(ee.rowCacheSize)||A);for(const ne of _)this.#l.set(ne,{key:null,result:null,id:0,computed:!1})}count(){this.#F();const G=this.#fe();return G?G.length:this.#I.length}#fe(){const G=Number(this.#H("pageSize",0))||0;if(G<=0)return null;const Q=this.#I.length,ee=Math.max(1,Math.ceil(Q/G)),se=Math.min(Math.max(0,Number(this.#H("page",0))||0),ee-1)*G;return{offset:se,length:Math.max(0,Math.min(G,Q-se))}}pageInfo(){this.#F();const G=Number(this.#H("pageSize",0))||0,Q=this.#I.length;if(G<=0)return{page:0,pageSize:0,total:Q,pageCount:1};const ee=Math.max(1,Math.ceil(Q/G));return{page:Math.min(Math.max(0,Number(this.#H("page",0))||0),ee-1),pageSize:G,total:Q,pageCount:ee}}totalCount(){return this.#Ve().length}matchCount(){return this.#F(),this.#m.matchCount}at(G){this.#F();const Q=this.#fe();if(Q)return G<0||G>=Q.length?void 0:this.#Se(Q.offset+G,G);if(!(G<0||G>=this.#I.length))return this.#Se(G,G)}byKey(G){this.#F(),this.#p||this.#Ce();const Q=this.#p.get(G);if(Q!==void 0)return this.#te(Q);for(let ee=0;ee<this.#I.length;ee++){const ne=this.#I[ee];if(typeof ne!="number"&&ne&&ne.key===G)return this.#Se(ee)}}loaded(G){return G>=0&&G<this.count()}hint(G,Q){}display(){return this.#F(),this.#Y||(this.#Y=this.#lt()),this.#Y}invalidateQuickText(){this.#x.clear(),this.invalidate("filter")}invalidate(G){const Q=_.indexOf(G);Q<0&&B(`unknown pipeline stage "${G}"; expected one of ${_.join(", ")}`);for(let ee=Q;ee<_.length;ee++){const ne=this.#l.get(_[ee]);ne.key=null,ne.computed=!1}this.#Y=null}apply(G){const Q=[],ee={added:[],updated:[],removed:[],rejected:Q};if(!G)return ee;let ne=!1;const se=new Set;if(G.remove&&G.remove.length)for(const le of G.remove){const me=this.#Pe(le);if(me===void 0){Q.push({operation:"remove",id:this.#be(le),reason:"unknown-id"});continue}ee.removed.push(this.#i.keyOf(this.#r?this.#we(me):this.#n[me],me)),this.#r||(this.#n[me]=void 0),this.#h.delete(me),this.#x.delete(me),ne=!0}if(G.update&&G.update.length){const le=this.#A.size||this.#Ge()?this.#et():null,me=this.#v.size?this.#at():null,ve=me&&me.length?this.#et():null;for(const fe of G.update){const xe=this.#Pe(fe);if(xe===void 0){Q.push({operation:"update",id:this.#je(fe),reason:"unknown-id"});continue}const He=this.#r?this.#s&&this.#s.has(xe)?this.#s.get(xe):this.#we(xe):this.#n[xe],Be=j(He,fe);for(const ae of this.#re(He,Be))se.add(ae);if(this.#r||(this.#n[xe]=Be),le&&this.#Et(le,xe,He,Be),ve&&this.#ht(me,ve,xe,He,Be),this.#p){const ae=this.#i.keyOf(He,xe),Ae=this.#i.keyOf(Be,xe);ae!==Ae&&(this.#p.delete(ae),this.#p.set(Ae,xe))}this.#h.delete(xe),this.#x.delete(xe),ee.updated.push(this.#te(xe))}}if(G.add&&G.add.length&&this.#r){typeof G.at=="number"&&G.at<this.#Te()&&(this.#h.clear(),this.#x.clear()),this.#p=null;for(const le of G.add){const me=this.#ne(this.#je(le));me!==void 0&&ee.added.push(this.#te(me))}ne=!0}else if(G.add&&G.add.length){const le=typeof G.at=="number"?G.at:this.#n.length,me=this.#n.length;let ve=G.add===this.#n?G.add.slice():G.add;if(this.#i.keyed){const fe=[];for(const xe of ve){const He=this.#je(xe);if(this.#Pe(He)!==void 0){Q.push({operation:"add",id:He,reason:"duplicate-id"});continue}fe.push(xe)}fe.length!==ve.length&&(ve=fe)}if(!ve.length)return ee;if(le>=me)for(let fe=0;fe<ve.length;fe++)this.#n.push(ve[fe]);else this.#n.splice(le,0,...ve),this.#h.clear(),this.#x.clear();for(let fe=0;fe<ve.length;fe++)ee.added.push(this.#te(le>=me?me+fe:le+fe));ne=!0}return this.#c++,ne&&(this.#p=null,this.#Ze()),this.#o.invalidate(),this.#Y=null,ne||this.#q(se)?(this.#u++,this.invalidate("filter")):this.invalidate("total"),this.#Ye("rows:changed",{companion:!0,added:ee.added.length,updated:ee.updated.length,removed:ee.removed.length}),this.#s=null,ee}groupHeadingsAt(G){this.#F();const Q=this.#U;if(!Q.length||!Number.isInteger(G)||G<0)return I;let ee=0,ne=Q.length-1,se=-1;for(;ee<=ne;){const me=ee+ne>>1;Q[me].at<=G?(se=me,ee=me+1):ne=me-1}if(se<0)return I;const le=[];for(let me=Q[se].row;me;me=me.parent)le.push(me);return le.reverse(),le}unnumberedRowCount(G){this.#F();const Q=this.#B;if(!Q.length||!Number.isInteger(G)||G<0)return 0;let ee=0,ne=Q.length-1,se=-1;for(;ee<=ne;){const le=ee+ne>>1;Q[le].at<=G?(se=le,ee=le+1):ne=le-1}return se+1}moveRow(G,Q){if(this.#r)return z("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(G)||!Number.isInteger(Q)||G<0||G>=ee.length)return!1;const ne=Math.max(0,Math.min(ee.length-1,Q));if(ne===G)return!1;const[se]=ee.splice(G,1);return ee.splice(ne,0,se),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#x.clear(),this.#Ze(),this.#o.invalidate(),this.#Y=null,this.invalidate("filter"),this.#Ye("rows:changed",{companion:!0,added:0,updated:0,removed:0,moved:1}),!0}reload(G){this.#ie(),this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#Ze(),this.#o.invalidate(),this.invalidate("filter"),this.#Ye("model:changed",{reason:"reload"})}destroy(){this.#ie(),this.#h.clear(),this.#x.clear(),this.#p=null,this.#I=[],this.#K=null,this.#Y=null,this.#Ze();for(const G of _)this.#l.set(G,{key:null,result:null,id:0,computed:!1})}#ie(){for(const{controller:G}of this.#b.values())try{G.abort()}catch{}this.#b.clear()}setRows(G){this.#n=G||[],this.#r=!1,this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#Ze(),this.#o.invalidate(),this.invalidate("filter")}notePriorRows(G){this.#s=G||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#x.clear(),this.#o.invalidate()}data(){if(!this.#r)return this.#n;const G=this.#e.store;if(!G||!K(G.source))return this.#n;const Q=G.physical||0,ee=new Array(Q);for(let ne=0;ne<Q;ne++)ee[ne]=G.live&&!G.live(ne)?void 0:G.source(ne);return ee}#Fe(){const G=this.#H("detail",null);return!G||!K(G.isOpen)||G.inline===!1?null:G}#Oe(){const G=(this.#e.config||{}).tree;return this.#D!==G&&(this.#D=G,this.#W=b(G,{dataAt:Q=>this.#we(Q),keyOf:Q=>this.#i.keyOf(this.#we(Q),Q)})),this.#W}#ge(){return(this.#e.config||{}).grandTotalRow==="bottom"}grandTotalRow(){if(!this.#ge())return null;this.#F();const G=this.#m.grand;return G?this.#i.grandTotal(G,this.#rt(this.#m.grandLeaves)):null}pivot(){return this.#F(),this.#ce}pivotMatrix(){this.#F();const G=this.#m.groupLeaves,Q=(this.#e.compute||{}).pivotMatrix;if(!K(Q))return null;const ee=this.#H("groupBy",[]),ne=this.#H("pivotBy",[]);if(!ee.length&&!ne.length)return z("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.#et().map(me=>({colId:me.id,handle:this.#o.handle(me.id),fn:L(me,"group")})).filter(me=>me.handle&&me.fn),le=this.#e.config||{};return Q({rowHandles:ee.map(me=>this.#o.handle(me)).filter(Boolean),columnHandles:ne.map(me=>this.#o.handle(me)).filter(Boolean),measures:se,leaves:G||new Uint32Array(0),opts:{locale:le.locale,separator:(le.pivot||{}).separator,maxColumns:(le.pivot||{}).maxColumns}})}keysForLeaves(G){const Q=[];if(!G)return Q;for(let ee=0;ee<G.length;ee++){const ne=this.#te(G[ee]);ne&&ne.key!=null&&Q.push(String(ne.key))}return Q}leavesOf(G){this.#F();const Q=this.#l.get("group"),ee=Q&&Q.result;if(!ee||!ee.nodes)return[];const ne=ee.nodes.get(G);if(!ne)return[];const se=[],le=me=>{const ve=me.row&&me.row.children;if(ve&&ve.length){for(const fe of ve){const xe=ee.nodes.get(fe.key);xe&&le(xe)}return}if(me.leaves)for(let fe=0;fe<me.leaves.length;fe++)se.push(this.#te(me.leaves[fe]))};return le(ne),se}#be(G){return typeof G=="string"?G:this.#je(G)}#je(G){try{return this.#i.keyOf(G,-1)}catch{return"(unkeyed)"}}#Pe(G){if(typeof G=="string")return this.#ne(G);if(this.#i.keyed){const ee=this.#i.keyOf(G,-1),ne=this.#ne(ee);if(ne!==void 0)return ne}if(this.#r)return;const Q=this.#n.indexOf(G);return Q>=0?Q:void 0}#ne(G){return this.#p||this.#Ce(),this.#p.get(G)}#Ce(){this.#p=new Map;const G=this.#Te(),Q=this.#e.store,ee=Q&&K(Q.live)?ne=>Q.live(ne):null;for(let ne=0;ne<G;ne++){if(ee&&!ee(ne))continue;const se=this.#we(ne);se!==void 0&&this.#p.set(this.#i.keyOf(se,ne),ne)}}#re(G,Q){const ee=[];for(const ne of this.#G())this.#We(ne)&&this.#J(ne,G,Q,new Set)&&ee.push(ne);return ee}#J(G,Q,ee,ne){if(ne.has(G))return!1;ne.add(G);const se=this.#We(G);if(!se)return!1;const le=se.value&&se.value.deps;return Array.isArray(le)&&le.length?le.some(me=>this.#J(String(me),Q,ee,ne)):K(se.getValue)?!Object.is(se.getValue(Q),se.getValue(ee)):!1}#G(){const G=new Set;for(const ee of this.#H("sort",[]))G.add(ee.col);for(const ee of this.#H("groupBy",[]))G.add(ee);const Q=ee=>{if(ee){if(Array.isArray(ee.conditions)){ee.conditions.forEach(Q);return}ee.col&&G.add(ee.col)}};return Q(this.#H("filters",null)),[...G]}#q(G){if(!G.size)return!1;if(this.#H("quick",""))return!0;for(const Q of this.#G())if(G.has(Q))return!0;return!1}#F(){if(!this.#a){this.#a=!0;try{this.#Me()}finally{this.#a=!1}}}pipelineRunning(){return this.#a}#Me(){const G=this.#_("filter",()=>this.#z(),()=>this.#ve()),Q=this.#X(G),ee=this.#_("group",()=>this.#pe(),()=>this.#st(Q)),ne=this.#_("total",()=>this.#me(),()=>this.#Be(ee));this.#_("pivot",()=>this.#Ue(),()=>this.#Mt(ee)),this.#_("flatten",()=>this.#Le(),()=>this.#j(ee)),this.#Ie(ee,ne)}#X(G){const Q=this.#l.get("sort"),ee=this.#oe();if(Q.computed&&Q.key===ee&&!this.#b.has("sort"))return Q.result;const ne=this.#b.get("sort");return ne&&ne.key===ee?Q.result:Q.result&&this.#Ne(G)?(this.#Ee(G,ee),Q.result):this.#_("sort",()=>ee,()=>this.#Re(G))}#ue(){if(this.#y===null){const G=this.#e.pipelineWorker,Q=K(G)?G():null;this.#y=Q||!1}return this.#y||null}#de(){const G=this.#H("sort",[]);if(!Array.isArray(G)||!G.length)return null;const Q=(this.#e.config||{}).locale,ee=[],ne=[];for(const se of G){const le=this.#We(se.col);if(le&&le.running)continue;if(le&&le.value&&K(le.value.compare))return null;const me=this.#o.handle(se.col);if(!me)return null;ee.push({col:se.col,descending:se.dir==="desc",nullsFirst:!!se.nullsFirst,locale:Q}),ne.push(me)}return ee.length?{entries:ee,handles:ne,locale:Q}:null}#Ne(G){if(this.#he())return!1;const Q=this.#ue();if(!Q)return!1;const ee=Number(Q.threshold);return Number.isFinite(ee)&&G.length<ee?!1:!!this.#de()}#Ee(G,Q){const ee=this.#ue(),ne=ee&&this.#de();if(!ne){this.#_("sort",()=>Q,()=>this.#Re(G));return}const se=new AbortController;this.#b.set("sort",{key:Q,controller:se});const le=ne.entries.length===1?ee.sortColumn(ne.handles[0],G,{descending:ne.entries[0].descending,nullsFirst:ne.entries[0].nullsFirst,locale:ne.locale,signal:se.signal,key:"sort"}):ee.sortMulti(ne.handles,ne.entries.map((me,ve)=>({...me,handle:ne.handles[ve]})),G,{signal:se.signal,key:"sort"});if(!T(le)){this.#b.delete("sort"),this.#_("sort",()=>Q,()=>le);return}le.then(me=>this.#ae(Q,me),me=>this.#le("sort",Q,me))}#ae(G,Q){const ee=this.#b.get("sort");if(!(!ee||ee.key!==G)){if(this.#oe()!==G){this.#b.delete("sort");return}this.#b.delete("sort"),this.#_("sort",()=>G,()=>Q),this.#Y=null,this.#F(),this.#Ye("model:changed",{reason:M[0]})}}#le(G,Q,ee){const ne=this.#b.get(G);if(!(!ne||ne.key!==Q)&&(this.#b.delete(G),!(ee&&ee.name==="AbortError")&&G==="sort"&&this.#oe()===Q)){const se=this.#_("filter",()=>this.#z(),()=>this.#ve());this.#_("sort",()=>Q,()=>this.#Re(se)),this.#Y=null,this.#F(),z("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",ee),this.#Ye("model:changed",{reason:M[1]})}}#Ie(G,Q){const ee=G&&G.leaves?G.leaves.length:this.#m.slots.length;this.#m.matchCount=ee,this.#m.grand=Q&&Q.grand||null,this.#m.grandLeaves=G&&G.leaves?G.leaves.length:0,this.#m.groupLeaves=G&&G.leaves?G.leaves:null}#_(G,Q,ee){const ne=this.#l.get(G),se=Q();return ne.computed&&ne.key===se||(ne.result=ee(),ne.key=se,ne.computed=!0,ne.id++,G==="flatten"&&(this.#Y=null)),ne.result}#C(G){return this.#l.get(G).id}#z(){const G=(this.#e.config||{}).hostFilter,Q=G&&K(G.active)&&G.active()?1:0,ee=this.#H("where",null),ne=ee?ee.version:0,se=this.#Ot("filter.sig",`${this.#tt()}`,()=>v({filters:this.#H("filters",null),quick:this.#H("quick",""),quickMode:this.#H("quickMode","contains")}));return`${this.#u}|${se}|${Q}|${ne}`}#oe(){const G=this.#he();return`${this.#C("filter")}|${JSON.stringify(this.#H("sort",[]))}`+(G?`|manual:${G.version}`:"")}#he(){const G=this.#H("rowOrder",null);return G&&Array.isArray(G.keys)?G:null}#se(G,Q){this.#p||this.#Ce();const ee=this.#p,ne=this.#Te(),se=Q.keys.length,le=new Float64Array(ne);for(let me=0;me<ne;me++)le[me]=se+me;for(let me=0;me<se;me++){const ve=ee.get(Q.keys[me]);ve!==void 0&&(le[ve]=me)}return Uint32Array.from(G).sort((me,ve)=>le[me]-le[ve])}orderedKeys(){this.#p||this.#Ce();const G=this.#p,Q=new Map;for(const[me,ve]of G)Q.set(ve,me);const ee=Uint32Array.from([...Q.keys()]).sort(),ne=this.#he(),se=ne?this.#se(ee,ne):this.#Re(ee),le=new Array(se.length);for(let me=0;me<se.length;me++)le[me]=Q.get(se[me]);return le}#pe(){const G=this.#H("pivotBy",[]).length>0?"p":"u";return`${this.#C("sort")}|${JSON.stringify(this.#H("groupBy",[]))}|${G}`}#me(){const G=this.#qe()?"f":"a",Q=(this.#e.config||{}).totalOnlyChangedColumns?"n":"w";return`${this.#C("group")}|${JSON.stringify(this.#H("totals",[]))}|${G}${Q}|${this.#c}`}#Ue(){return`${this.#C("group")}|${JSON.stringify(this.#H("pivotBy",[]))}`}#Le(){const Q=this.#k()||!this.#ge()?this.#C("total"):"x",ee=`${this.#tt()}`,ne=this.#Ot("flatten.keys",ee,()=>{const le=this.#H("expanded",null);return le?[...le].sort().join(""):"*"}),se=this.#Ot("flatten.detail",ee,()=>{const le=this.#H("detail",null);return le&&K(le.signature)?le.signature():""});return`${Q}|${this.#C("pivot")}|${ne}|${se}`}#k(){const G=this.#H("groupBy",[]);return Array.isArray(G)&&G.length>0}stageState(){const G=[];for(const[Q,ee]of this.#l){const ne=ee.result;G.push({stage:Q,materialised:!!ee.computed,bytes:ne&&typeof ne.byteLength=="number"?ne.byteLength:null,rows:ne&&typeof ne.length=="number"?ne.length:null,rebuilds:ee.id})}return G}facetIndices(G){return this.#ve(G||null)}facetRows(G){const Q=this.facetIndices(G),ee=[];for(let ne=0;ne<Q.length;ne++){const se=this.#te(Q[ne]);se&&ee.push(se)}return ee}invalidateRows(){this.#h.clear(),this.#x.clear(),this.#Y=null}invalidateHandles(){this.#o.invalidate()}rows(){return this.#n}unfilteredIndices(){return this.#Ve()}filteredIndices(){const G=this.#l.get("filter");if(G&&G.computed&&G.key===this.#z())return G.result||this.#Ve();this.#F();const Q=this.#l.get("filter");return(Q&&Q.computed?Q.result:null)||this.#Ve()}unfilteredRows(){const G=this.#Ve(),Q=[];for(let ee=0;ee<G.length;ee++){const ne=this.#te(G[ee]);ne&&Q.push(ne)}return Q}#ve(G=null){const Q=this.#Ve(),ee=this.#H("filters",null),ne=G?this.#Ke("pruneColumn")(ee,G):ee,se=this.#vt(ne),le=String(this.#H("quick","")||"").trim().toLowerCase(),me=le?x(le,String(this.#H("quickMode","contains")||"contains")):null,ve=(this.#e.config||{}).hostFilter,fe=!!(ve&&K(ve.active)&&ve.active()),xe=this.#H("where",null),He=!!(xe&&xe.active);if(!se&&!le&&!fe&&!He)return Q;let Be=null;se&&(Be=this.#Ke("evaluateFilters")(se,{handle:Re=>this.#o.handle(Re),count:this.#Te(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:Re=>N(this.#We(Re))}));const ae=new Uint32Array(Q.length);let Ae=0;for(let Me=0;Me<Q.length;Me++){const Re=Q[Me];if(!(Be&&!Be[Re])&&!(me&&!this.#wt(Re,me))){if(fe||He){const pe=this.#te(Re);if(fe&&!ve.passes(pe)||He&&!xe.passes(pe.data,pe.key))continue}ae[Ae++]=Re}}if(Be){const Me=(this.#e.compute||{}).releaseMask;K(Me)&&Me({pool:this.#e.pool},Be)}return ae.subarray(0,Ae)}handleFor(G){return this.#o.handle(G)}#Re(G){const Q=this.#he();if(Q)return this.#se(G,Q);const ee=this.#H("sort",[]).filter(le=>{const me=this.#We(le.col);return!me||!me.running?!0:(z(`source.sort.running.${le.col}`,`sort ignores "${le.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 G;const ne=(this.#e.config||{}).locale;if(ee.length===1){const le=ee[0],me=this.#o.handle(le.col);if(!me)return z(`source.sort.${le.col}`,`sort ignores unknown column "${le.col}".`),G;const ve=this.#We(le.col);return this.#Ke("sortColumn")(me,G,{descending:le.dir==="desc",nullsFirst:le.nullsFirst,locale:ne,compare:P(ve)})}const se=[];for(const le of ee){const me=this.#o.handle(le.col);if(!me){z(`source.sort.${le.col}`,`sort ignores unknown column "${le.col}".`);continue}se.push({handle:me,descending:le.dir==="desc",nullsFirst:le.nullsFirst,locale:ne,compare:P(this.#We(le.col))})}return se.length?this.#Ke("sortMulti")(se.map(le=>le.handle),se,G):G}#st(G){const Q=this.#H("groupBy",[]),ee=this.#Oe();if(ee&&!Q.length){const Me=p(G,ee);return this.#$=O(Me.roots,ee.declaresChildren),{roots:null,leaves:G,nodes:new Map,tree:Me}}if(this.#$=null,ee&&Q.length&&z("tree.grouped","grouping is active on a grid configured with `tree`; the grouping wins and the hierarchy is not shown."),!Q.length)return{roots:null,leaves:G,nodes:new Map};const ne=(this.#e.config||{}).timeZone,se=[],le=[];let me=!1;for(const Me of Q){const Re=this.#o.handle(Me);if(!Re){z(`source.group.${Me}`,`grouping ignores unknown column "${Me}".`);continue}se.push(Re);const pe=this.#We(Me),$e=pe&&pe.dataType;if($e&&K($e.groupProjector)){const ce=pe.typeOptions&&pe.typeOptions.timeZone||ne||void 0,ge=$e.groupProjector(pe,ce);le.push(ge||null),ge&&(me=!0)}else le.push(null)}if(!se.length)return{roots:null,leaves:G,nodes:new Map};const{keys:ve,buckets:fe}=this.#Ke("groupByColumns")(se,G,{locale:(this.#e.config||{}).locale,project:me?le:void 0}),xe=this.#H("pivotBy",[]).length>0,He=[],Be=new Map;for(let Me=0;Me<fe.length;Me++){const Re=ve[Me];let pe=null;const $e=[];for(let ce=0;ce<Re.length;ce++){$e.push(f(Re[ce]));const ge=c($e),je=ce===Re.length-1;let Ve=Be.get(ge);if(!Ve){const Se=this.#i.group({path:[...$e],column:Q[ce],value:Re[ce],level:ce,parent:pe,expanded:xe&&je?!1:this.#ct(ge,{key:ge,column:Q[ce],value:Re[ce],level:ce,path:[...$e]}),hasChildren:!(xe&&je)});Ve={row:Se,leaves:null},Be.set(ge,Ve),pe?pe.children.push(Se):He.push(Se)}Ve.row.leafCount+=fe[Me].length,ce===Re.length-1&&(Ve.leaves=fe[Me]),pe=Ve.row}}const ae=this.#H("sort",[])||[],Ae=(Me,Re)=>{if(!Me||Me.length<2){if(Me)for(const ge of Me)Ae(ge.children,Re+1);return}const pe=Q[Re],$e=ae.find(ge=>ge.col===pe),ce=$e&&$e.dir==="desc"?-1:1;Me.sort((ge,je)=>ce*X(ge.groupValue,je.groupValue));for(const ge of Me)Ae(ge.children,Re+1)};return Ae(He,0),{roots:He,leaves:G,nodes:Be,keys:ve,buckets:fe}}#He(G,Q){const ee=new Map,ne=new Map,se=le=>{const me=le.physical>=0?[le.physical]:[];for(const ve of le.children)me.push(...se(ve));if(le.children.length){const ve=this.#Je(Q,Uint32Array.from(me),null);le.physical>=0?ee.set(le.physical,ve):ne.set(le.key,ve)}return me};for(const le of G.roots)se(le);return{byPhysical:ee,byKey:ne}}#Be(G){const Q=this.#et();if(!Q.length)return this.#M=null,this.#P=null,{grand:null};const ee={id:this.#C("group"),columns:Q.map(ae=>ae.id).join("")},ne=this.#M&&this.#M.id===ee.id&&this.#M.columns===ee.columns,se=this.#Ge()&&ne?this.#E:null,le=se?Q.filter(ae=>se.has(ae.id)):Q,me=ne?this.#P:null,ve=this.#qe()?null:this.#Tt(),fe=this.#ye(Q),xe=ae=>{const Ae=G.nodes.get(ae.key);let Me=Ae&&Ae.leaves?Ae.leaves:null;if(ae.children&&ae.children.length){const $e=ae.children.map(xe);let ce=0;for(const Ve of $e)ce+=Ve.length;const ge=new Uint32Array(ce);let je=0;for(const Ve of $e)ge.set(Ve,je),je+=Ve.length;Me=ge}Me=Me||new Uint32Array(0);const Re=ve?ve.get(ae.key)||E:Me,pe=this.#ot(ae,se?le:Q,Re,fe);return ae.totals=se?{...ae.totals,...pe}:pe,Me};if(G.roots&&le.length)for(const ae of G.roots)xe(ae);if(this.#V=G.tree?this.#He(G.tree,Q):null,this.#M=ee,this.#E=this.#Ge()?new Set:null,!(this.#e.config||{}).grandTotalRow)return this.#O.length=0,this.#P=null,{grand:null};const Be=ve?this.#it():G.leaves;return this.#P=this.#Xe(Q,Be,se,me),{grand:this.#P}}#Xe(G,Q,ee,ne){const se={},le=this.#C("group");le!==this.#w&&(this.#Qe(),this.#w=le);const me=this.#O;this.#O=[];for(const ve of G){if(!$(ve))continue;const fe=this.#o.handle(ve.id);if(!fe)continue;const xe=L(ve,"grand");if(!u(xe,fe)){if(ee&&!ee.has(ve.id)&&ne&&ve.id in ne){se[ve.id]=ne[ve.id];continue}se[ve.id]=this.#Je([ve],Q,null,"grand")[ve.id];continue}let He=this.#A.get(ve.id);if((!He||He.fn!==xe)&&(He=new n(xe),this.#A.set(ve.id,He)),He.valid){let Be=!0;for(const ae of me)if(ae.colId===ve.id&&!He.update(ae.before,ae.after)){Be=!1;break}if(Be){se[ve.id]=He.value();continue}He.invalidate()}He.seedColumn(fe.values,a(fe),Q),se[ve.id]=He.valid?He.value():this.#Je([ve],Q,null,"grand")[ve.id]}return se}#ye(G){const Q=this.#C("group");Q!==this.#T&&(this.#v.clear(),this.#T=Q);const ee=new Map;for(const se of G){if(!$(se))continue;const le=this.#o.handle(se.id),me=L(se,"group");u(me,le)&&ee.set(se.id,{fn:me})}if(!ee.size)return this.#S.length=0,ee;const ne=this.#S;this.#S=[];for(const se of ne){const{beforeKeys:le,afterKeys:me,colDeltas:ve}=se,fe=le.length?new Set(le):null,xe=me.length?new Set(me):null;for(const{colId:He,before:Be,after:ae}of ve)if(ee.has(He)){for(const Ae of le)xe&&xe.has(Ae)||this.#ke(Ae,He,Be,null);for(const Ae of me)fe&&fe.has(Ae)||this.#ke(Ae,He,null,ae);for(const Ae of le)xe&&!xe.has(Ae)||this.#ke(Ae,He,Be,ae)}}return ee}#ke(G,Q,ee,ne){const se=this.#v.get(G),le=se&&se.get(Q);!le||!le.valid||le.update(ee,ne)||le.invalidate()}#ot(G,Q,ee,ne){if(!ne||!ne.size)return this.#Je(Q,ee,G);const se={};let le=null,me=this.#v.get(G.key);for(const ve of Q){const fe=ne.get(ve.id);if(!fe){(le||(le=[])).push(ve);continue}const xe=this.#o.handle(ve.id);if(!xe)continue;me||(me=new Map,this.#v.set(G.key,me));let He=me.get(ve.id);if((!He||He.fn!==fe.fn)&&(He=new n(fe.fn),me.set(ve.id,He)),He.valid||He.seedColumn(xe.values,a(xe),ee),He.valid){se[ve.id]=He.value();continue}(le||(le=[])).push(ve)}return le&&Object.assign(se,this.#Je(le,ee,G)),se}#Et(G,Q,ee,ne){const se=!this.#qe()||this.#ee(Q);for(const le of G){const me=le.getValue;if(!K(me))continue;const ve=me(ee),fe=me(ne);Object.is(ve,fe)||(this.#E&&this.#E.add(le.id),se&&this.#A.has(le.id)&&this.#O.push({colId:le.id,before:ve,after:fe}))}}#at(){const G=this.#H("groupBy",[]),Q=[];for(const ee of G){const ne=this.#We(ee);ne&&Q.push(ne)}return Q}#yt(G,Q){const ee=new Array(G.length);for(let ne=0;ne<G.length;ne++){const se=G[ne].getValue;ee[ne]=f(K(se)?se(Q):void 0)}return ee}#ht(G,Q,ee,ne,se){if(this.#qe()&&!this.#ee(ee))return;const le=l(this.#yt(G,ne)),me=l(this.#yt(G,se)),ve=le.length!==me.length||le.some((xe,He)=>xe!==me[He]),fe=[];for(const xe of Q){const He=xe.getValue;if(!K(He))continue;const Be=He(ne),ae=He(se);!ve&&Object.is(Be,ae)||fe.push({colId:xe.id,before:Be,after:ae})}!fe.length&&!ve||this.#S.push({beforeKeys:le,afterKeys:me,colDeltas:fe})}#ee(G){const Q=this.#l.get("filter"),ee=Q&&Q.computed?Q.result:null;if(!ee)return!0;let ne=0,se=ee.length-1;for(;ne<=se;){const le=ne+se>>1,me=ee[le];if(me===G)return!0;me<G?ne=le+1:se=le-1}return!1}#qe(){return(this.#e.config||{}).totalFilteredOnly!==!1}#rt(G){return this.#qe()?G:this.#it().length}#it(){return(!this.#N||this.#N.version!==this.#u)&&(this.#N={version:this.#u,indices:this.#Ve()}),this.#N.indices}#Tt(){const G=this.#H("groupBy",[]),Q=`${this.#u}|${JSON.stringify(G)}`;if(this.#R&&this.#R.key===Q)return this.#R.map;const ee=new Map,ne=[];for(const se of G){const le=this.#o.handle(se);le&&ne.push(le)}if(ne.length){const se=this.#it(),{keys:le,buckets:me}=this.#Ke("groupByColumns")(ne,se,{locale:(this.#e.config||{}).locale}),ve=new Map;for(let fe=0;fe<me.length;fe++){const xe=le[fe],He=[];for(let Be=0;Be<xe.length;Be++){He.push(f(xe[Be]));const ae=c(He);let Ae=ve.get(ae);Ae||(Ae=[],ve.set(ae,Ae));for(let Me=0;Me<me[fe].length;Me++)Ae.push(me[fe][Me])}}for(const[fe,xe]of ve)ee.set(fe,Uint32Array.from(xe))}return this.#R={key:Q,map:ee},ee}#Ge(){return!!(this.#e.config||{}).totalOnlyChangedColumns}#Ze(){this.#Qe(),this.#Nt(),this.#E=null,this.#M=null,this.#P=null}#Qe(){this.#A.clear(),this.#O.length=0,this.#w=-1}#Nt(){this.#v.clear(),this.#S.length=0,this.#T=-1}#Mt(G){const Q=this.#H("pivotBy",[]);if(!Q.length)return this.#ce=null,null;const ee=(this.#e.compute||{}).pivot;if(!K(ee))return z("source.pivot.kernel","pivot requested but ctx.compute.pivot is not available; showing unpivoted rows."),this.#ce=null,null;const ne=Q.map(le=>this.#o.handle(le)).filter(Boolean),se=this.#et();return this.#ce=ee(ne,G.leaves,{groups:G.keys&&G.buckets?{keys:G.keys,buckets:G.buckets}:null,totals:se.map(le=>le.id),handle:le=>this.#o.handle(le),totalOf:le=>L(se.find(me=>me.id===le),"group"),separator:((this.#e.config||{}).pivot||{}).separator,maxColumns:((this.#e.config||{}).pivot||{}).maxColumns})||null,this.#ce}#j(G){const Q=this.#l.get("total").result,ee=!!(this.#e.config||{}).groupFooter,ne=this.#Fe();if(G.tree)return this.#ze(G,Q,ne);if(!G.roots&&!ne){if(Q&&Q.grand&&!this.#ge()){const xe=this.#i.grandTotal(Q.grand,this.#rt(G.leaves.length));if(this.#K===G.leaves&&Array.isArray(this.#I))this.#I[this.#I.length-1]=xe;else{const He=Array.from(G.leaves);He.push(xe),this.#I=He,this.#K=G.leaves}this.#B=[{at:this.#I.length-1}]}else this.#K=null,this.#I=G.leaves,this.#B=I;return this.#U=I,this.#I}const se=[],le=[],me=[],ve=xe=>{if(se.push(xe),!ne)return;const He=this.#te(xe);!He||!ne.isOpen(He.key)||(He.master=!0,He.expanded=!0,me.push({at:se.length}),se.push(this.#i.detail(He,ne.heightOf(He))))};if(!G.roots){for(let xe=0;xe<G.leaves.length;xe++)ve(G.leaves[xe]);return Q&&Q.grand&&!this.#ge()&&(me.push({at:se.length}),se.push(this.#i.grandTotal(Q.grand,this.#rt(G.leaves.length)))),this.#K=null,this.#U=I,this.#B=me.length?me:I,this.#I=se,se}const fe=(xe,He,Be)=>{if(xe.expanded=xe.hasChildren===!1?!1:this.#ct(xe.key,{key:xe.key,column:xe.groupColumn,value:xe.groupValue,level:xe.level,path:xe.groupPath}),xe.posinset=He+1,xe.setsize=Be,le.push({at:se.length,row:xe}),me.push({at:se.length}),se.push(xe),!!xe.expanded){if(xe.children&&xe.children.length)for(let ae=0;ae<xe.children.length;ae++)fe(xe.children[ae],ae,xe.children.length);else{const ae=G.nodes.get(xe.key),Ae=ae&&ae.leaves?ae.leaves:null;if(Ae)for(let Me=0;Me<Ae.length;Me++)ve(Ae[Me])}ee&&xe.totals&&(me.push({at:se.length}),se.push(this.#i.footer(xe)))}};for(let xe=0;xe<G.roots.length;xe++)fe(G.roots[xe],xe,G.roots.length);return Q&&Q.grand&&!this.#ge()&&(me.push({at:se.length}),se.push(this.#i.grandTotal(Q.grand,this.#rt(G.leaves.length)))),this.#U=le,this.#B=me,this.#I=se,se}#Ve(){const G=this.#e.store;if(G&&K(G.liveIndices))return G.liveIndices();const Q=new Uint32Array(this.#n.length);let ee=0;for(let ne=0;ne<this.#n.length;ne++)this.#n[ne]!==void 0&&(Q[ee++]=ne);return Q.subarray(0,ee)}#Te(){const G=this.#e.store;return G&&typeof G.physical=="number"?G.physical:this.#n.length}#we(G){const Q=this.#e.store;return Q&&K(Q.source)?Q.source(G):this.#n[G]}#Se(G,Q=G){const ee=this.#I[G];if(typeof ee!="number")return ee.index=Q,ee;const ne=this.#te(ee);return ne.index=Q,ne}#te(G){let Q=this.#h.get(G);Q||(Q=this.#i.leaf(this.#we(G),G),this.#h.set(G,Q));const ee=this.#$?this.#$.get(G):null;if(ee){Q.level=ee.level,Q.posinset=ee.posinset,Q.setsize=ee.setsize,Q.hasChildren=ee.hasChildren,Q.expanded=ee.hasChildren&&!ee.lazy&&this.#ct(Q.key);const ne=this.#V?this.#V.byPhysical.get(G):void 0;ne?Q.totals=ne:Q.totals&&(Q.totals=null)}else Q.hasChildren&&(Q.level=0,Q.hasChildren=!1,Q.expanded=!1,Q.posinset=void 0,Q.setsize=void 0);return Q}#ze(G,Q,ee){const ne=[],se=[],le=ve=>{if(ve.leafCount!==void 0)return ve.leafCount;let fe=ve.physical>=0?1:0;for(const xe of ve.children)fe+=le(xe);return ve.leafCount=fe,fe},me=ve=>{const fe=this.#ct(ve.key);if(ve.physical>=0){if(ne.push(ve.physical),ee&&ee.isOpen(this.#te(ve.physical).key)){const xe=this.#te(ve.physical);se.push({at:ne.length}),ne.push(this.#i.detail(xe,ee.heightOf(xe)))}}else ne.push(this.#i.group({path:[ve.key],column:null,value:ve.value,level:ve.level,parent:null,expanded:fe,hasChildren:ve.children.length>0,leafCount:le(ve),totals:this.#V?this.#V.byKey.get(ve.key):void 0}));if(fe)for(const xe of ve.children)me(xe)};for(const ve of G.tree.roots)me(ve);return Q&&Q.grand&&!this.#ge()&&(se.push({at:ne.length}),ne.push(this.#i.grandTotal(Q.grand,this.#rt(G.leaves.length)))),this.#K=null,this.#U=I,this.#B=se.length?se:I,this.#I=ne,ne}#lt(){return r(()=>this.count(),G=>this.at(G))}#wt(G,Q){let ee=this.#x.get(G);if(ee===void 0){const ne=this.#we(G),se=this.#St(),le=[],me=this.#e.columnHidden;for(const ve of se){if(ve.quickFilter===!1||K(me)&&me(ve.id))continue;const fe=ve.value&&K(ve.value.quickFilterText)?ve.value.quickFilterText({value:void 0,data:ne,row:null,column:ve,colId:ve.id,grid:null,context:this.#H("context",null)}):null,xe=fe??(K(ve.formatValue)?ve.formatValue(K(ve.getValue)?ve.getValue(ne):void 0):"");xe!=null&&xe!==""&&le.push(String(xe))}ee=le.join(" ").toLowerCase(),this.#x.set(G,ee)}return Q(ee)}#et(){const G=this.#H("totals",[]),Q=G&&G.length?new Set(G):null;return this.#St().filter(ee=>Q?Q.has(ee.id):!!(ee.total||ee.groupTotal||ee.grandTotal))}#Je(G,Q,ee,ne="group"){const se={},le=(this.#e.compute||{}).total;for(const me of G){if(!$(me))continue;const ve=this.#o.handle(me.id);if(!ve)continue;const fe=L(me,ne);if(fe)if(K(fe)){const xe=new Array(Q.length);for(let He=0;He<Q.length;He++)xe[He]=ve.get(Q[He]);se[me.id]=fe(xe,{row:ee,column:me,grid:this.#e.grid||null,context:this.#H("context",null),valueAt:(He,Be)=>{const ae=this.#o.handle(He);return ae&&Be>=0&&Be<Q.length?ae.get(Q[Be]):null}})}else K(le)&&(se[me.id]=le(ve,Q,fe))}return se}#vt(G){if(!G)return G;const Q=this.#e.config||{},ee={tz:Q.timeZone,weekStartsOn:Q.weekStartsOn};return g(G,ne=>{const se=k(ne,ee),le=this.#We(se&&se.col),me=le&&le.type==="datetime";if(se&&se.type)return se.type==="datetime"&&!se.timeZone&&le?{...se,timeZone:Q.timeZone||void 0}:se;if(me)return{...se,type:"datetime",timeZone:Q.timeZone||void 0};const ve=le&&(le.dataType?.base||le.type);return ve?{...se,type:ve}:se})}#ct(G,Q){const ee=this.#H("expanded",null);return ee?K(ee.has)?ee.has(G,Q):Array.prototype.includes.call(ee,G):!0}#H(G,Q){if(G==="context"||!K(this.#e.stateVersion))return this.#Rt(G,Q);const ee=this.#kt(G),ne=this.#d.get(G);if(ne&&ne.version===ee)return ne.value;const se=this.#Rt(G,Q);return this.#d.set(G,{version:ee,value:se}),se}#Rt(G,Q){const ee=this.#e.state;if(ee&&K(ee[G])){const ne=ee[G]();return ne??Q}return Q}#tt(){const G=this.#e.stateVersion;return K(G)?G():0}#Ft(){const G=this.#e.columnsVersion,Q=this.#e.permissionsVersion;return`${K(G)?G():0}|${K(Q)?Q():0}`}#kt(G){return G==="totals"?this.#Ft():`${this.#tt()}`}#Ot(G,Q,ee){if(!K(this.#e.stateVersion))return ee();const ne=this.#f.get(G);if(ne&&ne.version===Q)return ne.key;const se=ee();return this.#f.set(G,{version:Q,key:se}),se}#Ke(G){const Q=(this.#e.compute||{})[G];return K(Q)||B(`ctx.compute.${G} is required by the memory source pipeline`),Q}#St(){const G=this.#e.columns;return G&&K(G.all)?G.all():[]}#We(G){const Q=this.#e.columns;return Q&&K(Q.get)?Q.get(G):void 0}#Ye(G,Q){const ee=this.#e.emit;K(ee)&&ee(G,Q)}}}),Ue("packages/core/src/source/abort.js",function(e,U){"use strict";Object.defineProperty(e,"SupersededError",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"RequestToken",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"AbortScope",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createAbortScope",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return B}});class te extends Error{constructor(K,F="superseded"){super(`[lattice] request ${K?`"${K}" `:""}${F}`),this.name="SupersededError",this.superseded=!0,this.key=K}}class C{#e;constructor(K,F,X,H){this.#e=K,this.key=F,this.controller=X,this.signal=X.signal,this.seq=H}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(K){this.signal.aborted||this.controller.abort(new te(this.key,K)),this.#e.settle(this)}}class q{#e=new Map;#t=0;begin(K="",F="superseded"){const X=this.#e.get(K);X&&!X.signal.aborted&&X.controller.abort(new te(K,F));const H=new C(this,K,new AbortController,++this.#t);return this.#e.set(K,H),H}tokenFor(K){return this.#e.get(K)}pending(K=""){const F=this.#e.get(K);return!!F&&!F.signal.aborted}get size(){return this.#e.size}settle(K){this.#e.get(K.key)===K&&this.#e.delete(K.key)}abort(K="",F="superseded"){const X=this.#e.get(K);X&&X.abort(F)}abortAll(K="superseded"){for(const F of[...this.#e.values()])F.abort(K);this.#e.clear()}}function z(){return new q}function B(Z){if(!Z||typeof Z!="object")return!1;const K=Z;return K.superseded===!0||K.name==="AbortError"||K.name==="SupersededError"}}),Ue("packages/core/src/source/blockcache.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_PAGE_SIZE",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"DEFAULT_MAX_CACHED_PAGES",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"BlockCache",{enumerable:!0,get:function(){return z}});const te=100,C=32;class q{constructor(Z){this.id=Z,this.rows=null,this.state="pending",this.token=null,this.error=null}}class z{#e=new Map;#t;#n;#r=0;#s=-1;constructor(Z={}){this.#t=Math.max(1,Math.floor(Number(Z.pageSize)||te)),this.#n=Math.max(1,Math.floor(Number(Z.maxCachedPages)||C))}get pageSize(){return this.#t}get maxBlocks(){return this.#n}get size(){return this.#e.size}blockOf(Z){return Math.floor(Z/this.#t)}rangeOf(Z){return{start:Z*this.#t,end:(Z+1)*this.#t}}has(Z){return this.#e.has(Z)}pending(Z){const K=this.#e.get(Z);return!!K&&K.state==="pending"}loaded(Z){const K=this.#e.get(Z);return!!K&&K.state==="loaded"}begin(Z,K){let F=this.#e.get(Z);return F||(F=new q(Z)),F.state="pending",F.token=K,F.error=null,this.#i(Z,F),F}fill(Z,K){const F=this.#e.get(Z)||new q(Z);F.rows=K,F.state="loaded",F.token=null,this.#i(Z,F)}failed(Z,K){const F=this.#e.get(Z)||new q(Z);F.state="error",F.error=K,F.token=null,this.#i(Z,F)}delete(Z){return this.#e.delete(Z)}rowAt(Z){const K=this.blockOf(Z),F=this.#e.get(K);if(!(!F||F.state!=="loaded"||!F.rows))return this.#i(K,F),F.rows[Z-K*this.#t]}rowLoaded(Z){const K=this.blockOf(Z),F=this.#e.get(K);return!!F&&F.state==="loaded"&&!!F.rows&&Z-K*this.#t<F.rows.length}erroredAt(Z){const K=this.#e.get(this.blockOf(Z));return!!K&&K.state==="error"}loadedExtent(){let Z=0;for(const K of this.#e.values()){if(K.state!=="loaded"||!K.rows)continue;const F=K.id*this.#t+K.rows.length;F>Z&&(Z=F)}return Z}fillOf(Z){const K=this.#e.get(Z);return K&&K.state==="loaded"&&K.rows?K.rows.length:null}protect(Z,K){this.#r=this.blockOf(Math.max(0,Z)),this.#s=this.blockOf(Math.max(0,K))}evict(){const Z=[];if(this.#e.size<=this.#n)return Z;for(const[K,F]of this.#e){if(this.#e.size-Z.length<=this.#n)break;K>=this.#r&&K<=this.#s||F.state!=="pending"&&Z.push(K)}for(const K of Z)this.#e.delete(K);return Z}ids(){return[...this.#e.keys()]}clear(){this.#e.clear()}#i(Z,K){this.#e.delete(Z),this.#e.set(Z,K)}}}),Ue("packages/core/src/source/pagewindow.js",function(e,U){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return te}});function te(C,q,z,B){const Z=Math.floor(Number(C)||0);if(Z<=0)return null;const K=Math.max(0,Math.floor(Number(q)||0)),F=Math.max(0,Math.floor(Number(z)||0));if(B){const X=Math.max(1,Math.ceil(F/Z)),H=Math.min(K,X-1),j=H*Z;return{page:H,pageSize:Z,offset:j,length:Math.max(0,Math.min(Z,F-j)),pageCount:X,total:F}}return{page:K,pageSize:Z,offset:K*Z,length:Z,pageCount:Math.max(K+2,Math.ceil(F/Z)),total:null}}}),Ue("packages/core/src/source/paged.js",function(e,U){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"PagedSource",{enumerable:!0,get:function(){return v}});const C=U("packages/core/src/internal/lru.js").Lru,z=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/warn.js").warnOnce,F=U("packages/core/src/internal/schedule.js").settleDebounce,X=U("packages/core/src/source/abort.js"),H=X.createAbortScope,j=X.isAbortError,w=U("packages/core/src/source/blockcache.js"),m=w.BlockCache,c=w.DEFAULT_PAGE_SIZE,f=w.DEFAULT_MAX_CACHED_PAGES,r=U("packages/core/src/source/rows.js").createRowFactory,t=U("packages/core/src/source/filterwire.js"),i=t.wireFilters,s=t.querySignature,n=t.warnHostFilterNotApplied,o=U("packages/core/src/source/pagewindow.js").pageWindow,a=120;function h(g,k){return new v(g,k)}class v{mode="paged";#e;#t;#n;#r=H();#s;#i;#o=new Map;#l=null;#a=null;#c=!1;#u=0;#d="";#f={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(k,d){this.#e=k||{mode:"paged"},this.#t=d||{},this.#n=new m({pageSize:this.#e.pageSize||c,maxCachedPages:this.#e.maxCachedPages||f}),this.#s=r(this.#t),this.#i=new C(this.#n.pageSize*4),this.#h=F((p,b)=>this.#w(p,b),a),this.#d=this.#E(),z(this.#e.fetch)||Z("source.paged.fetch",'source.mode "paged" requires a fetch function; the grid will stay empty.'),n(this.#t)}count(){const k=this.#y();return k?k.length:this.#b()}#b(){if(this.#T(),this.#l!==null)return this.#l;const k=Math.max(this.#u,this.#n.loadedExtent());return this.#c?k:k+this.#n.pageSize}matchCount(){return this.#b()}totalCount(){return this.#b()}pageInfo(){const k=this.#y();if(!k){const d=this.#b();return{page:0,pageSize:0,total:this.exact()?d:null,pageCount:1,counting:!1}}return{page:k.page,pageSize:k.pageSize,total:k.total,pageCount:k.pageCount,counting:k.total===null&&this.#r.size>0&&this.#u===0&&this.#n.loadedExtent()===0}}#y(){const k=this.#b(),d=o(this.#P("pageSize",0),this.#P("page",0),k,this.exact());if(!d)return this.#g="",null;const p=`${this.#m}:${d.offset}:${d.length}`;if(p!==this.#g&&!this.#p&&(this.#g=p,d.length>0)){const b=d.offset+d.length-1;this.#f={start:d.offset,end:b},this.#w(d.offset,b)}return d}at(k){const d=this.#y();if(d){if(k<0||k>=d.length)return;const p=this.#A(d.offset+k);return p&&(p.index=k),p}return this.#A(k)}#A(k){if(k<0||k>=this.#b())return;const d=this.#i.get(k);if(d&&(d.data!==null||!this.#n.rowLoaded(k)))return d;const p=this.#n.rowAt(k);if(p===void 0){const O=this.#s.skeleton(k,0,this.#n.erroredAt(k));return this.#i.set(k,O),O}const b=this.#s.leaf(p,k);return b.index=k,this.#i.set(k,b),this.#o.set(b.key,k),b}byKey(k){const d=this.#o.get(k);return d===void 0?void 0:this.#A(d)}loaded(k){const d=this.#y();return d?k>=0&&k<d.length&&this.#n.rowLoaded(d.offset+k):this.#n.rowLoaded(k)}loadedCount(){this.#T();let k=0;for(const d of this.#n.ids()){if(!this.#n.loaded(d))continue;const p=this.#n.fillOf(d);typeof p=="number"&&(k+=p)}return k}residentRows(){this.#T();const k=this.#y(),d=k?k.offset:0,p=k?k.offset+k.length:1/0,b=[],O=this.#n.ids().sort((y,M)=>y-M);for(const y of O){if(!this.#n.loaded(y))continue;const{start:M}=this.#n.rangeOf(y),D=this.#n.fillOf(y)||0;for(let _=M;_<M+D;_++){if(_<d||_>=p)continue;const I=this.#i.peek(_);if(I&&I.data!==null&&I.data!==void 0){b.push(I);continue}const L=this.#n.rowAt(_);if(L===void 0)continue;const $=this.#s.leaf(L,_);$.index=_,this.#i.set(_,$),this.#o.set($.key,_),b.push($)}}return b}hint(k,d){if(this.#p)return;const p=this.#T();let b=Math.max(0,Math.floor(k)),O=Math.max(b,Math.floor(d));const y=this.#y();if(y){if(y.length===0)return;b=y.offset,O=y.offset+y.length-1}this.#f={start:b,end:O},this.#n.protect(b,O);for(const M of this.#n.evict())this.#v(M);this.#h(b,O),p&&this.#h.flush()}#w(k,d){if(this.#p)return;this.#n.protect(k,d);const p=this.#n.blockOf(k),b=this.#n.blockOf(d);for(let O=p;O<=b&&!(this.#l!==null&&O*this.#n.pageSize>=this.#l);O++)this.#n.has(O)||this.#O(O)}apply(k){const d={added:[],updated:[],removed:[]};if(!k)return d;if(k.update)for(const p of k.update){const b=this.#s.keyOf(p,-1),O=this.#o.get(b);if(O===void 0)continue;const y=this.#s.leaf(p,O);y.index=O,this.#i.set(O,y),d.updated.push(y)}return(k.add&&k.add.length||k.remove&&k.remove.length)&&this.reload(),d}reload(k){this.#S("reload"),this.#h.cancel(),this.hint(this.#f.start,this.#f.end)}destroy(){this.#p=!0,this.#h.cancel(),this.#r.abortAll("destroyed"),this.#n.clear(),this.#i.clear(),this.#o.clear()}exact(){return this.#l!==null||this.#c}pending(){return this.#r.size}async#O(k){if(!z(this.#e.fetch))return;const d=this.#r.begin(`block:${k}`);this.#n.begin(k,d);const{start:p,end:b}=this.#n.rangeOf(k),O=this.#d;try{const y=await this.#e.fetch({range:{start:p,end:b},sort:this.#P("sort",[]),filters:i(this.#P("filters",null),this.#M()),quick:this.#P("quick","")||void 0,context:this.#P("context",null),signal:d.signal});if(!d.current||O!==this.#d||this.#p)return;d.settle();const M=y&&y.rows||[];this.#n.fill(k,M);for(let _=0;_<M.length;_++)this.#i.delete(p+_);const D=y&&typeof y.total=="number"?y.total:y&&typeof y.count=="number"?y.count:null;D!==null?(this.#l=D,this.#c=!0):M.length<this.#n.pageSize?(this.#c=!0,this.#l=p+M.length):this.#u=Math.max(this.#u,p+M.length),this.#N("model:changed",{reason:"page",block:k,from:p,to:p+M.length}),this.#N("rows:changed",{companion:!0,reason:"page",block:k,from:p,to:p+M.length}),this.#l!==null&&this.#l!==this.#a&&(this.#a=this.#l,this.#N("source:total",{total:this.#l,groupPath:[]}))}catch(y){if(d.settle(),j(y))return;this.#n.failed(k,y);for(let M=p;M<b;M++)this.#i.delete(M);this.#N("model:changed",{reason:"page-error",block:k,range:{start:p,end:b}}),this.#N("source:error",{error:y,block:k,range:{start:p,end:b}})}}#v(k){const{start:d,end:p}=this.#n.rangeOf(k);for(let b=d;b<p;b++){const O=this.#i.peek(b);O&&this.#o.delete(O.key),this.#i.delete(b)}}#T(){const k=this.#E();return k===this.#d?!1:(this.#d=k,this.#S("query"),!0)}#S(k){this.#r.abortAll(k),this.#n.clear(),this.#i.clear(),this.#o.clear(),this.#l=null,this.#a=null,this.#c=!1,this.#u=0,this.#m++,this.#N("model:changed",{reason:k})}#E(){return s({filters:this.#P("filters",null),sort:this.#P("sort",[]),quick:this.#P("quick",""),context:this.#P("context",null)})}#M(){const k=this.#t.config||{};return{tz:k.timeZone,weekStartsOn:k.weekStartsOn}}#P(k,d){const p=this.#t.state;if(p&&z(p[k])){const b=p[k]();return b??d}return d}#N(k,d){const p=this.#t.emit;z(p)&&p(k,d)}}}),Ue("packages/core/src/source/aggregates.js",function(e,U){"use strict";Object.defineProperty(e,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"pushableAggregates",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"fillAggregateSql",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"routeAggregate",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"resolveAggregatePlan",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"groupKeysPushable",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"pushdownDocRows",{enumerable:!0,get:function(){return X}});const te=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 C(){const H=new Set;for(const[j,w]of Object.entries(te))w.pushable&&H.add(j);return H}function q(H,j,w){let m=H.split("%c").join(j);return w!==void 0&&(m=m.split("%w").join(w)),m}function z(H){const j=H||{},w=j.default==="engine"||j.default==="engine-if-identical"?j.default:"client",m={};if(j.overrides&&typeof j.overrides=="object")for(const[c,f]of Object.entries(j.overrides))(f==="engine"||f==="client")&&(m[c]=f);return{default:w,overrides:m}}function B(H,j){const w=te[H];if(!w||!w.pushable)return"client";const m=j.overrides[H];return m==="engine"||m==="client"?m:j.default==="client"?"client":j.default==="engine-if-identical"?w.class==="identical"?"engine":"client":"engine"}function Z(H,j){const w=z(j),m=[],c=[];for(const f of H||[]){const l=te[f.fn],r=B(f.fn,w),t={id:f.id,col:f.col,fn:f.fn,class:l?l.class:"fallback"};f.weight!==void 0&&(t.weight=f.weight),f.params!==void 0&&(t.params=f.params),r==="engine"?m.push(t):(t.reason=l&&!l.pushable?l.note||"the engine cannot express this stat":"client by config",c.push(t))}return{engine:m,client:c,config:w}}const K=/^[A-Za-z_][A-Za-z0-9_$]*$/;function F(H,j=[]){return(H||[]).every(m=>{if(typeof m=="string")return K.test(m);if(!m||typeof m!="object")return!1;const c=m;return Array.isArray(j)&&j.includes(c.bucket)&&typeof c.col=="string"&&K.test(c.col)&&typeof c.size=="number"&&Number.isFinite(c.size)&&c.size>0})}function X(){return Object.entries(te).map(([H,j])=>({stat:H,class:j.class,sql:j.sql?q(j.sql,"col",j.twoColumn?"weight":void 0):"",note:j.note||(j.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),Ue("packages/core/src/source/pushdown.js",function(e,U){"use strict";Object.defineProperty(e,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"NO_CAPABILITIES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"capabilitiesOf",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"splitFilters",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"applyResidual",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"createPushdownSource",{enumerable:!0,get:function(){return V}});const C=U("packages/core/src/internal/compare.js").defaultCompare,z=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/merge.js").toArray,F=U("packages/core/src/internal/warn.js").warnOnce,X=U("packages/core/src/source/filterwire.js"),H=X.isGroup,j=X.warnWherePageRelative,w=X.warnWhereOverThreshold,m=X.wireFilters,c=U("packages/core/src/source/aggregates.js"),f=c.resolveAggregatePlan,l=c.groupKeysPushable,r=c.STAT_PUSHDOWN,i=U("packages/core/src/source/abort.js").SupersededError,s=1e3;function n(G){const Q=G&&G.signal;if(!Q||!Q.aborted)return;const ee=Q.reason;throw ee instanceof Error?ee:new i("","superseded before it was sent")}const u=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function o(G){if(!G||typeof G!="object")return!1;const Q=G.returning==="row"||G.returning==="key"?G.returning:"none";return{append:G.append===!0,update:G.update===!0,delete:G.delete===!0,returning:Q}}function a(G,Q){if(!G||typeof Q!="string")return;if(!Q.includes("."))return G[Q];let ee=G;for(const ne of Q.split(".")){if(ee===null||typeof ee!="object")return;ee=ee[ne]}return ee}function h(G){if(G===!0)return!0;if(!G||typeof G!="object")return!1;const Q=G;return Q.enabled===!1?!1:Q.enabled===!0||z(Q.commit)}function v(G){const Q={...u,...G||{}};return Q.operators=new Set(Q.operators||[]),Q.mutate=o(Q.mutate),Q}function g(G,Q){return!G||!G.op||!Q.operators.size?!1:Q.operators.has(G.op)}function k(G,Q){if(!G)return{pushed:null,residual:null};if(!Q.filter)return{pushed:null,residual:G};if(Q.filter==="term"){if(H(G)){const le=G.conditions||[];if(String(G.op)!=="and")return{pushed:null,residual:G};const me=le.findIndex(fe=>!H(fe)&&g(fe,Q));if(me<0)return{pushed:null,residual:G};const ve=le.filter((fe,xe)=>xe!==me);return{pushed:le[me],residual:ve.length?{op:"and",conditions:ve}:null}}return g(G,Q)?{pushed:G,residual:null}:{pushed:null,residual:G}}if(!H(G))return g(G,Q)?{pushed:G,residual:null}:{pushed:null,residual:G};if(String(G.op)!=="and")return(G.conditions||[]).every(me=>H(me)?k(me,Q).residual===null:g(me,Q))?{pushed:G,residual:null}:{pushed:null,residual:G};const ee=[],ne=[];for(const le of G.conditions||[]){if(H(le)){if(Q.filter==="flat"){ne.push(le);continue}const me=k(le,Q);me.pushed&&ee.push(me.pushed),me.residual&&ne.push(me.residual);continue}(g(le,Q)?ee:ne).push(le)}const se=le=>le.length===0?null:le.length===1?le[0]:{op:"and",conditions:le};return{pushed:se(ee),residual:se(ne)}}const d="__lattice_leaves";function p(G){return G.aggregates?G.aggregates instanceof Set?G.aggregates:new Set(Z(G.aggregates)):new Set}function b(G){const Q=p(G);return Q.size?Q.has("count")?G.filter!=="tree"||!G.operators||!G.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 O(G,Q,ee,ne,se,le,me){const ve=Array.isArray(G.groupBy)?G.groupBy:[],fe=Array.isArray(G.groupPath)?G.groupPath:[],xe=Array.isArray(G.groupValues)?G.groupValues:null;if(!Q.group){const He=b(Q);if(He)return He}return l(ve)?ee.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":ne?se?le?"a host `where` predicate can only run in the browser, over rows the engine grouped":me?"fullDataset holds the whole matching set, so the grid groups it itself":!xe||xe.length!==fe.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 y="pushdown:pivot-unsupported",M="pushdown:group-unsupported",D=Symbol("lattice.remote.ungroupedLevel");function _(G,Q,ee,ne,se,le){const me=Array.isArray(G.pivotBy)?G.pivotBy:[],ve=Array.isArray(G.groupBy)?G.groupBy:[],fe=Array.isArray(G.groupPath)?G.groupPath:[],xe=Array.isArray(G.groupValues)?G.groupValues:null;return Q.pivot?l(me)?ve.length&&!l(ve)?"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":ne?se?le?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!xe||xe.length!==fe.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 I(G,Q,ee=!1){const ne=k(G.filters||null,Q),se=[];ne.residual&&se.push("filter");const le=G.sort||[],me=le.length===0||Q.sort==="multi"&&le.length>=1||Q.sort==="single"&&le.length===1;!me&&le.length&&se.push("sort");const ve=G.quick?String(G.quick):"",fe=!ve||!!Q.quick;fe||se.push("quick");const xe=G.where&&G.where.active?G.where:null;xe&&se.push("where");const He={filters:ne.residual,sort:me?null:le,quick:fe?"":ve,where:xe},Be=!!ee,ae=Array.isArray(G.groupBy)&&G.groupBy.length>0,Ae=ae?O(G,Q,ne,me,fe,xe,Be):"",Me=G.pivotMode!==!1&&Array.isArray(G.pivotBy)&&G.pivotBy.length>0,Re=Me?_(G,Q,ne,me,fe,xe):"",pe=Me&&Re==="";Me&&!pe&&se.push("pivot");const $e=Me?pe&&ae:ae&&Ae==="";ae&&!Me&&!$e&&se.push("group");const ce=($e||pe)&&Array.isArray(G.groupValues)?G.groupValues.length:0,ge=$e||Me?!1:Be||!!(He.filters||He.sort||He.quick||He.where)||!Q.range;return{pushed:{...G,filters:ne.pushed,sort:me?le:[],quick:fe?ve:"",range:ge?null:G.range},residual:He,needsAll:ge,unpushed:se,full:Be,grouped:$e,groupLevel:ce,groupReason:Me?"":Ae,pivoted:pe,pivotReason:Re}}function L(G){const Q=Array.isArray(G.totals)?G.totals:[],ee=G.totalFns&&typeof G.totalFns=="object"?G.totalFns:{},ne=[],se=[];for(const le of Q){const me=String(le),ve=typeof ee[me]=="string"?ee[me]:null,fe=ve?r[ve]:null;ve?!fe||!fe.pushable||!fe.sql?se.push({id:me,fn:ve,class:fe?fe.class:"fallback",reason:fe&&fe.note?fe.note:`the pushdown map cannot express "${ve}"`}):fe.twoColumn?se.push({id:me,fn:ve,class:fe.class,reason:`"${ve}" reduces two columns, and a grouped request carries no weight column`}):ne.push({id:me,col:me,fn:ve,class:fe.class}):se.push({id:me,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:ne,client:se}}const $=Object.freeze({items:G=>G==null?[]:Array.isArray(G)?G:[G]});function P(G,Q,ee){if(!Q)return G;let ne=G;if(Q.filters&&z(ee.evaluateFilters)){const se=ne,le={count:ne.length,handle:fe=>({id:fe,get:xe=>a(se[xe],fe)}),itemwise:fe=>se.some(xe=>Array.isArray(a(xe,fe)))?$:null},me=ee.evaluateFilters(Q.filters,le),ve=[];for(let fe=0;fe<ne.length;fe++)me[fe]&&ve.push(ne[fe]);ne=ve}if(Q.where&&Q.where.active&&(Q.whole||j(Q.where.names,"pushdown"),ne=ne.filter(se=>Q.where.passes(se))),Q.quick){const se=Q.quick.toLowerCase();ne=ne.filter(le=>{if(!le||typeof le!="object")return!1;for(const me of Object.values(le))if(me!=null&&String(me).toLowerCase().includes(se))return!0;return!1})}if(Q.sort&&Q.sort.length&&z(ee.sortMulti)){const se=[...new Set(Q.sort.map(fe=>fe.col))],le=ne,me=se.map(fe=>({id:fe,get:xe=>a(le[xe],fe)})),ve=ee.sortMulti(me,Q.sort.map(fe=>({col:fe.col,dir:fe.dir})),Uint32Array.from({length:ne.length},(fe,xe)=>xe),{});ne=Array.from(ve,fe=>le[fe])}return ne}function N(G){return JSON.stringify({filters:G.filters||null,sort:G.sort||[],quick:G.quick||"",groupBy:G.groupBy||[],groupPath:G.groupPath||[],context:G.context??null})}function T(G){if(!G||typeof G!="object")return 16;let Q="";try{Q=JSON.stringify(G)}catch{return 200}return Q.length*2+64}function E(G){const Q=G||{};return{enabled:!!Q.enabled,maxRows:Number.isFinite(Q.maxRows)?Q.maxRows:1e6,maxBytesEstimate:Number.isFinite(Q.maxBytesEstimate)?Q.maxBytesEstimate:512*1024*1024}}const A=5e4;function S(G){return Number.isFinite(G)&&G>=0?G:A}function x(G){return!!G&&z(G.then)}async function W(G){if(!G||G.total!==void 0||!x(G.pendingTotal))return G;const Q=await G.pendingTotal,{pendingTotal:ee,...ne}=G;return typeof Q=="number"?{...ne,total:Q}:ne}function V(G={}){const Q=G.adapter;if(!Q||!z(Q.execute))return F("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...G,mode:"remote",fetch:async()=>({rows:[],total:0})};const ee=v(Q.capabilities),ne=Q.capabilities&&Object.getOwnPropertyDescriptor(Q.capabilities,"operators");ne&&z(ne.get)&&Object.defineProperty(ee,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(Q.capabilities.operators||[]),set:()=>{}});const se=Q.name||"adapter";let le=null;const me=()=>z(Q.ready)?(le||(le=Promise.resolve(Q.ready()).then(()=>{Object.assign(ee,v(Q.capabilities))},be=>{throw le=null,be})),le):null,ve=E(G.fullDataset),fe=!!G.allowPartialResults,xe=S(G.whereRowLimit);let He=null;const Be=G.aggregates;let ae=null,Ae=null,Me=null,Re=null,pe=null,$e,ce=null,ge=0,je=null;const Ve=()=>!ve.enabled||!ae?null:(je!==ae.key&&(ge++,je=ae.key),{rows:ae.rows,version:ge}),Se=async be=>{const Ne=be.where&&be.where.active?be.where:null;if(!Ne)return{request:be,probe:null};const{where:re,...oe}=be,we=I(oe,ee,ve.enabled);if(we.needsAll)return{request:be,probe:null};const ke=N(we.pushed);let Le=null;return(!He||He.key!==ke)&&(ee.total?(n(be),Le=await W(await Q.execute(we.pushed,be)),He={key:ke,size:Le&&typeof Le.total=="number"?Le.total:null}):He={key:ke,size:null}),He.size!==null&&He.size<xe?{request:be,probe:null}:(w(Ne.names,se,He.size,xe),{request:oe,probe:Le})},Ge=async(be,Ne)=>{ce=null;const re=L(be.pushed);Me={engine:re.engine,client:re.client,groupBy:be.pushed.groupBy},re.client.length&&F(`source.pushdown.group.totals.${se}.${re.client.map(ke=>ke.id).join(".")}`,`the ${se} adapter cannot compute the group subtotal for ${re.client.map(ke=>`"${ke.id}" (${ke.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 oe=await Q.executeGroupLevel(be.pushed,re.engine,Ne)||{};let we=oe.rows||[];return!ee.range&&Ne.range&&(we=we.slice(Ne.range.start,Ne.range.end)),Ke(oe),oe.total===void 0?{rows:we}:{rows:we,total:oe.total}},Ce=new Map,Te=64,ze=async(be,Ne)=>{ce=null;const re=be.pushed,oe=re.groupBy,we=Array.isArray(re.groupValues)?re.groupValues:[],ke=we.length,Le=[...re.filters?[re.filters]:[],...oe.slice(0,ke).map((vt,bt)=>({col:vt,op:"eq",value:we[bt]===void 0?null:we[bt],caseSensitive:!0}))],De=Le.length===0?null:Le.length===1?Le[0]:{op:"and",conditions:Le},Pe=Ne.range?Ne.range.start:0;if(ke>=oe.length){const vt={...re,filters:De,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},bt=await W(await Q.execute(vt,Ne))||{};let Lt=bt.rows||[];return!ee.range&&Ne.range&&(Lt=Lt.slice(Ne.range.start,Ne.range.end)),typeof bt.total=="number"?{rows:Lt,total:bt.total}:{rows:Lt}}const _e=oe[ke],qe=L(re),Qe=p(ee),et=qe.engine.filter(vt=>Qe.has(vt.fn)),ft=[...qe.engine.filter(vt=>!Qe.has(vt.fn)).map(vt=>({id:vt.id,fn:vt.fn,class:vt.class,reason:`the ${se} adapter does not compute "${vt.fn}"`})),...qe.client];Me={engine:et,client:ft,groupBy:oe},ft.length&&F(`source.pushdown.group.totals.${se}.${ft.map(vt=>vt.id).join(".")}`,`the ${se} adapter cannot compute the group subtotal for ${ft.map(vt=>`"${vt.id}" (${vt.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 dt=[...et.map(vt=>({id:vt.id,col:vt.col,fn:vt.fn})),{id:d,col:_e,fn:"count"}],ut={...re,filters:De,range:null},Ct=JSON.stringify([N(ut),we,_e,dt]);let Mt=Pe>0?Ce.get(Ct):void 0;if(!Mt){for(Mt=Promise.resolve(Q.executeGroupedAggregates(ut,[_e],dt)),Ce.delete(Ct),Ce.set(Ct,Mt);Ce.size>Te;)Ce.delete(Ce.keys().next().value);Mt.catch(()=>{Ce.get(Ct)===Mt&&Ce.delete(Ct)})}const xt=await Mt||[];n(Ne);const Ye=vt=>{const bt={};for(const Lt of et)bt[Lt.id]=vt?vt[Lt.id]:void 0;return bt},mt=(re.sort||[]).find(vt=>vt&&vt.col===_e),gt=mt&&mt.dir==="desc"?-1:1,St=xt.filter(vt=>vt&&vt.level===1).map(vt=>({[_e]:vt.keys[0]===void 0?null:vt.keys[0],leafCount:Number(vt.values&&vt.values[d])||0,totals:Ye(vt.values)})).sort((vt,bt)=>gt*C(vt[_e],bt[_e]));if(ke===0){const vt=xt.find(Lt=>Lt&&Lt.level===0),bt=vt?Number(vt.values&&vt.values[d]):NaN;Ke({matchCount:Number.isFinite(bt)?bt:St.reduce((Lt,Ht)=>Lt+Ht.leafCount,0),...vt?{grand:Ye(vt.values)}:{}})}const Rt=Ne.range?Ne.range.end:St.length;return{rows:St.slice(Pe,Rt),total:St.length}},Ke=be=>{typeof be.matchCount=="number"&&(Re=be.matchCount,pe=be.grand?{totals:be.grand,leafCount:be.matchCount}:null,$e===void 0&&z(Q.unfilteredCount)&&($e=null,Promise.resolve(Q.unfilteredCount()).then(Ne=>{$e=typeof Ne=="number"?Ne:null}).catch(Ne=>{F(`source.pushdown.group.unfiltered.${se}`,`the ${se} adapter could not count the unfiltered set (${Ne&&Ne.message?Ne.message:Ne}), so "N of M" falls back to the display count for its denominator.`)})))},Ze=async(be,Ne)=>{ce=null;const re=L(be.pushed);Me={engine:re.engine,client:re.client,groupBy:be.pushed.groupBy,pivotBy:be.pushed.pivotBy},re.client.length&&F(`source.pushdown.pivot.totals.${se}.${re.client.map(De=>De.id).join(".")}`,`the ${se} adapter cannot compute the pivot cells for ${re.client.map(De=>`"${De.id}" (${De.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 oe=await Q.executePivotLevel(be.pushed,re.engine,Ne)||{};let we=oe.rows||[];!ee.range&&Ne.range&&(we=we.slice(Ne.range.start,Ne.range.end)),Ke(oe);const ke=oe.pivot&&typeof oe.pivot=="object"?oe.pivot:{},Le={cells:Array.isArray(ke.cells)?ke.cells:[],...Array.isArray(ke.axis)?{axis:ke.axis}:{}};return oe.total===void 0?{rows:we,pivot:Le}:{rows:we,total:oe.total,pivot:Le}},nt=be=>{F(`source.pushdown.pivot.${se}.${be}`,`pushdown:pivot-unsupported: the ${se} adapter cannot pivot this query because ${be}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const Ne=new Error(`[lattice] ${y}: the ${se} adapter cannot pivot this query because ${be}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw Ne.code=y,Ne.reason=be,Ne},it=(be,Ne)=>{const re={key:Ne,state:"pending",value:null};return ce=re,be.then(oe=>(ce===re&&(ce={key:Ne,state:"settled",value:typeof oe=="number"?oe:null}),oe),oe=>{throw ce===re&&(ce={key:Ne,state:"failed",value:null}),oe})};let wt=0,ht=[];const Ot=()=>wt===0?null:new Promise(be=>{const Ne=setTimeout(be,s);ht.push(()=>{clearTimeout(Ne),be()})});let Pt;const Nt=async be=>{const Ne=me();Ne&&await Ne;const oe=be&&be.pivotMode!==!1&&Array.isArray(be.pivotBy)&&be.pivotBy.length>0?{request:be,probe:null}:await Se(be);n(be);let we=I(oe.request,ee,ve.enabled);if(ee.group&&we.grouped&&!we.pivoted&&!z(Q.executeGroupLevel)&&(F(`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.`),we=I(oe.request,{...ee,group:!1,aggregates:null},ve.enabled)),we.pivoted&&!z(Q.executePivotLevel)&&(we=I(oe.request,{...ee,pivot:!1},ve.enabled),we.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),we.grouped&&!we.pivoted&&!ee.group&&!z(Q.executeGroupedAggregates)&&(F(`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\`.`),we=I(oe.request,{...ee,aggregates:null},ve.enabled)),Ae=we,we.pivoted)return Ze(we,be);if(we.pivotReason&&nt(we.pivotReason),we.grouped)return ee.group?Ge(we,be):ze(we,be);const Le=!!we.groupReason&&!we.full;Le?F(`source.pushdown.group-unsupported.${se}.${we.groupReason}`,`pushdown:group-unsupported: the ${se} adapter was not asked to group this query because ${we.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.`):we.groupReason&&F(`source.pushdown.group.${se}.${we.groupReason}`,`the ${se} adapter was not asked to group this query because ${we.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 De=dt=>Le?{...dt,[D]:!0}:dt;if(!we.needsAll){const dt=oe.probe||await Q.execute(we.pushed,be),ut=dt.rows||[];return x(dt.pendingTotal)&&dt.total===void 0?De({rows:ut,pendingTotal:it(dt.pendingTotal,N(we.pushed))}):(ce=null,!ee.total&&dt.total===void 0?De({rows:ut}):De({rows:ut,total:dt.total??ut.length}))}we.unpushed.length&&F(`source.pushdown.residual.${se}.${we.unpushed.join(".")}`,`the ${se} adapter cannot push ${we.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 Pe=N(we.pushed);if(!ae||ae.key!==Pe){const dt=await W(await Q.execute(we.pushed,be));ce=null;const ut=dt.rows||[];if(we.full){const Ct=typeof dt.total=="number"?Math.max(dt.total,ut.length):ut.length;if(Ct>ve.maxRows)throw new Error(`[lattice] fullDataset refused: the ${se} adapter's matching set is ${Ct.toLocaleString()} rows, past the configured maxRows of ${ve.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 Mt=ut.length*T(ut[0]);if(Mt>ve.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${se} adapter's matching set is an estimated ${Math.round(Mt/(1024*1024)).toLocaleString()} MB across ${ut.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(ve.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 dt.total=="number"&&ut.length<dt.total){const Ct=!!(we.residual.filters||we.residual.quick||we.residual.sort&&we.residual.sort.length);if(Ct&&!fe)throw new Error(`[lattice] the ${se} adapter returned ${ut.length} of ${dt.total} matching rows when asked for the whole result, and the query has residual ${we.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.`);Ct?F(`source.pushdown.partial.residual.${se}`,`the ${se} adapter returned ${ut.length} of ${dt.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.`):F(`source.pushdown.partial.${se}`,`the ${se} adapter returned ${ut.length} of ${dt.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}ae={key:Pe,rows:ut,total:typeof dt.total=="number"?dt.total:null}}let _e=we;if(we.residual.where){const dt=ae.total??ae.rows.length;if(dt>=xe){w(we.residual.where.names,se,dt,xe);const{where:ut,...Ct}=oe.request;_e=I(Ct,ee,ve.enabled),Ae=_e}}const qe=ae.total!==null&&ae.rows.length>=ae.total,Qe=P(ae.rows,{..._e.residual,whole:qe},G.compute||{}),et=be.range?be.range.start:0,ft=be.range?be.range.end:Qe.length;return De({rows:Qe.slice(et,ft),total:Qe.length})},ct=async(be,Ne,re)=>{const we=re&&re.waitForPage&&Pt&&z(Pt.pageForegroundIdle)?Pt.pageForegroundIdle():Ot();we&&await we;const ke=me();ke&&await ke;const Le=I(be,ee,ve.enabled);Ae=Le;const De=f(Ne,Be),Pe=Array.isArray(be.groupBy)?be.groupBy:[],_e=Pe.length>0,qe=!Le.residual.filters&&!Le.residual.quick,Qe=!_e||l(Pe,ee.buckets);let et=De.engine,ft=De.client;if(ee.aggregates&&et.length){const Mt=ee.aggregates instanceof Set?ee.aggregates:new Set(Z(ee.aggregates)),xt=et.filter(Ye=>!Mt.has(Ye.fn));xt.length&&(et=et.filter(Ye=>Mt.has(Ye.fn)),ft=[...xt.map(Ye=>({...Ye,reason:`the ${se} adapter does not compute "${Ye.fn}"`})),...ft])}const dt=Mt=>{ft=[...et.map(xt=>({...xt,reason:Mt})),...ft],et=[]};et.length&&!qe?dt(Le.residual.quick&&!Le.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):et.length&&!Qe&&dt("a grouping key the engine cannot form forces all-client (no mixed provenance)");let ut={},Ct;return et.length&&(z(_e?Q.executeGroupedAggregates:Q.executeAggregates)?_e?Ct=await Q.executeGroupedAggregates(Le.pushed,Pe,et)||[]:ut=await Q.executeAggregates(Le.pushed,et)||{}:(F(`source.pushdown.aggregates.${se}${_e?".grouped":""}`,`the ${se} adapter cannot compute ${_e?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),dt(`adapter cannot compute ${_e?"grouped ":""}aggregates`))),Me={engine:et,client:ft,..._e?{groupBy:Pe}:{}},{values:ut,engine:et,client:ft,...Ct!==void 0?{groups:Ct}:{}}},lt=async be=>{wt++;try{return await Nt(be)}finally{if(wt--,wt===0&&ht.length){const Ne=ht;ht=[];for(const re of Ne)re()}}},yt=h(G.edit),Tt=G.edit&&typeof G.edit=="object"&&z(G.edit.commit);let at=G.edit;if(yt&&!Tt)if(ee.mutate&&ee.mutate.update){const be=Ne=>{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 re={kind:"update",key:String(Ne.key),patch:{[Ne.colId]:Ne.value}};return Q.mutate(re,Ne.request||{})};at={...G.edit===!0?{}:G.edit,commit:be}}else F(`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 ye=yt&&ee.mutate&&(ee.mutate.append||ee.mutate.delete)?{append:ee.mutate.append===!0,remove:ee.mutate.delete===!0,returning:ee.mutate.returning,mutate:(be,Ne)=>Q.mutate(be,Ne||{})}:null,Oe=async be=>{const Ne=me();Ne&&await Ne;const{range:re,signal:oe,export:we,...ke}=be||{},Le={...ke,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:I(Le,ee,ve.enabled),signal:oe}};async function*ue(be,Ne={}){const{plan:re,signal:oe}=await Oe(be),we=Math.max(1,Math.floor(Number(Ne.pageSize))||5e3),ke={signal:oe,stream:!0};if(!re.needsAll)for(let Pe=0;;Pe+=we){n(ke);const _e=await Q.execute({...re.pushed,range:{start:Pe,end:Pe+we}},ke);_e&&x(_e.pendingTotal)&&_e.pendingTotal.then(null,()=>{});const qe=_e&&_e.rows||[];if(qe.length&&(yield qe),qe.length<we)return}n(ke);const Le=await W(await Q.execute({...re.pushed,range:void 0},ke)),De=P(Le&&Le.rows||[],{...re.residual,whole:!0},G.compute||{});for(let Pe=0;Pe<De.length;Pe+=we)yield De.slice(Pe,Pe+we)}return Pt={...G,edit:at,rowMutate:ye,mode:"remote",fetch:lt,foregroundIdle:Ot,aggregate:ct,countMatching:async be=>{const{plan:Ne,signal:re}=await Oe(be);if(!Ne.needsAll&&ee.total){n({signal:re});const we=await W(await Q.execute({...Ne.pushed,range:{start:0,end:0}},{signal:re}));if(we&&typeof we.total=="number")return we.total}let oe=0;for await(const we of ue(be))oe+=we.length;return oe},streamMatching:ue,capabilitiesOf:v,planQuery:I,wireFilters:m,resolveAggregatePlan:be=>f(be,Be),STAT_PUSHDOWN:r,lastPlan:()=>Ae?{...Ae,...Me?{aggregates:Me}:{},...ce?{total:{deferred:!0,state:ce.state,value:ce.value}}:{}}:null,fullFrame:Ve,counts:()=>({match:Re,total:$e??null,pending:!!ce&&ce.state==="pending"}),grandTotals:()=>pe},Pt}}),Ue("packages/core/src/source/remote.js",function(e,U){"use strict";Object.defineProperty(e,"PROTOCOL",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return N}});const C=U("packages/core/src/internal/lru.js").Lru,z=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/warn.js").warnOnce,F=U("packages/core/src/internal/schedule.js").settleDebounce,X=U("packages/core/src/source/abort.js"),H=X.createAbortScope,j=X.isAbortError,w=U("packages/core/src/source/blockcache.js"),m=w.BlockCache,c=w.DEFAULT_PAGE_SIZE,f=w.DEFAULT_MAX_CACHED_PAGES,l=U("packages/core/src/source/rows.js"),r=l.createRowFactory,t=l.groupKey,i=U("packages/core/src/source/filterwire.js"),s=i.wireFilters,n=i.querySignature,u=i.warnHostFilterNotApplied,a=U("packages/core/src/source/pagewindow.js").pageWindow,v=U("packages/core/src/source/memory.js").MemorySource,k=U("packages/core/src/compute/handle.js").valueComparator,d=U("packages/core/src/compute/pivot.js"),p=d.pivotKey,b=d.joinPath,O=d.DEFAULT_PATH_SEPARATOR,M=U("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,D=1,_=120,I=1e3;function L(T,E,A){for(let S=0;S<Math.max(T.length,E.length);S++){const x=T[S],W=E[S],V=x==null,G=W==null;if(V||G){if(V&&G)continue;return V?1:-1}const Q=A(x,W);if(Q!==0)return Q}return 0}function $(T,E){return new N(T,E)}class P{constructor(E,A,S,x){this.path=E,this.keyPath=x||E,this.values=[],this.level=A,this.key=t(this.keyPath),this.cache=new m(S),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;#s=new Map;#i=new Set;#o=H();#l;#a;#c=new Map;#u=[];#d=null;#f="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#A="";#w=null;#O=-1;constructor(E,A){this.#e=E||{mode:"remote"},this.#t=A||{},z(this.#e.fullFrame)&&(this.filteredIndices=()=>this.#V(),this.unfilteredIndices=()=>this.#W(),this.handleFor=G=>this.#D(G),this.display=()=>this.#x(),this.grandTotalRow=()=>this.#I(),this.unfilteredRows=()=>this.#B(),this.facetIndices=G=>this.#Y(G));const S=this.#e.counts;z(S)&&(this.matchCount=()=>this.#K("match"),this.totalCount=()=>this.#K("total"));const x=this.#e.grandTotals;z(x)&&(this.grandTotalRow=()=>this.#U());const W=this.#e.foregroundIdle;z(W)&&(this.foregroundIdle=()=>this.#be(W),this.#e.pageForegroundIdle=()=>this.#b?this.#be(W):null);const V=this.#e;z(V.countMatching)&&z(V.streamMatching)&&(this.selectionQuery=()=>this.#ce(),this.countMatching=G=>V.countMatching(G),this.streamMatching=(G,Q)=>V.streamMatching(G,Q),this.loadedRows=()=>this.#fe(),this.resident=()=>this.#R()!==null),this.#n={pageSize:this.#e.pageSize||c,maxCachedPages:this.#e.maxCachedPages||f},this.#l=r(this.#t),this.#a=new C(this.#n.pageSize*4),this.#h=F((G,Q)=>this.#P(G,Q),_),this.#r=new P([],0,this.#n),this.#s.set(this.#r.key,this.#r),this.#f=this.#de(),z(this.#e.fetch)||Z("source.remote.fetch",'source.mode "remote" requires a fetch function; the grid will stay empty.'),this.#Ie()}count(){const E=this.#S();return E?E.length:this.#v()}#v(){const E=this.#R();return E?E.count():(this.#X(),this.#re(this.#r))}#T(){if(this.#R())return!0;const E=A=>{if(A.count===null&&!A.complete)return!1;for(const S of A.children.values())if(this.#Ne(S.key)&&!E(S))return!1;return!0};return E(this.#r)}pageInfo(){const E=this.#S(),A=this.totalPending();if(!E){const S=this.#v();return{page:0,pageSize:0,total:this.#T()?S:null,pageCount:1,counting:A}}return{page:E.page,pageSize:E.pageSize,total:E.total,pageCount:E.pageCount,counting:A||E.total===null&&this.#o.size>0&&this.#r.cache.loadedExtent()===0}}#S(){const E=this.#v(),A=a(this.#C("pageSize",0),this.#C("page",0),E,this.#T());if(!A)return this.#A="",null;const S=`${this.#y}:${A.offset}:${A.length}`;return S!==this.#A&&!this.#p&&(this.#A=S,A.length>0&&!this.#R()&&this.#P(A.offset,A.offset+A.length-1)),A}at(E){const A=this.#S();if(A){if(E<0||E>=A.length)return;const S=this.#E(A.offset+E);return S&&(S.index=E),S}return this.#E(E)}#E(E){const A=this.#R();if(A)return A.at(E);if(this.#X(),E<0||E>=this.#v())return;const S=this.#G(this.#r,E);if(!S)return;const x=this.#q(S.node,S.local);return x&&(x.index=E),x||this.#l.skeleton(E,S.node.level,S.node.cache.erroredAt(S.local))}byKey(E){const A=this.#R();if(A)return A.byKey(E);const S=this.#c.get(E);if(!S)return;const x=S.lastIndexOf(":"),W=this.#s.get(S.slice(0,x));return W&&this.#q(W,Number(S.slice(x+1)))||void 0}loaded(E){const A=this.#S();if(A){if(E<0||E>=A.length)return!1;E+=A.offset}const S=this.#R();if(S)return S.loaded(E);if(E<0||E>=this.#v())return!1;const x=this.#G(this.#r,E);return!!x&&x.node.cache.rowLoaded(x.local)}hint(E,A){if(this.#p)return;this.#b=!0;const S=this.#X();let x=Math.max(0,Math.floor(E)),W=Math.max(x,Math.floor(A));const V=this.#S();if(V){if(V.length===0)return;x=V.offset,W=V.offset+V.length-1}for(const[G,Q]of this.#M(x,W)){G.cache.protect(Q.min,Q.max);for(const ee of G.cache.evict())this.#Me(G,ee)}this.#h(x,W),S&&this.#h.flush()}#M(E,A){const S=this.#v(),x=new Map;for(let W=E;W<=A&&W<S;W++){const V=this.#G(this.#r,W);if(!V)continue;const G=x.get(V.node);G?(G.min=Math.min(G.min,V.local),G.max=Math.max(G.max,V.local)):x.set(V.node,{min:V.local,max:V.local})}return x.size||x.set(this.#r,{min:E,max:E}),x}#P(E,A){if(!this.#p)for(const[S,x]of this.#M(E,A)){S.cache.protect(x.min,x.max);const W=S.cache.blockOf(x.min),V=S.cache.blockOf(x.max);for(let G=W;G<=V&&!(S.count!==null&&G*S.cache.pageSize>=S.count);G++)S.cache.has(G)||this.#Fe(S,G)}}apply(E){const A={added:[],updated:[],removed:[]};if(!E)return A;if(E.update)for(const S of E.update){const x=this.#c.get(this.#l.keyOf(S,-1));if(!x)continue;this.#a.delete(x);const W=x.lastIndexOf(":"),V=this.#s.get(x.slice(0,W));if(!V)continue;const G=Number(x.slice(W+1)),Q=V.cache.blockOf(G);if(!V.cache.loaded(Q))continue;const{start:ee}=V.cache.rangeOf(Q),ne=[];for(let le=ee;le<ee+V.cache.pageSize;le++){const me=V.cache.rowAt(le);if(me===void 0)break;ne.push(le===G?S:me)}V.cache.fill(Q,ne);const se=this.#q(V,G);se&&A.updated.push(se)}return(E.add&&E.add.length||E.remove&&E.remove.length)&&this.reload({keepExpanded:!0}),A}reload(E){this.#o.abortAll("reload"),this.#h.cancel(),E&&E.keepExpanded===!1&&this.#i.clear(),this.#ue(),this.#z("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#o.abortAll("destroyed"),this.#ue(),this.#s.clear(),this.#i.clear(),this.#w&&z(this.#w.destroy)&&this.#w.destroy(),this.#w=null}expand(E){this.#i.has(E)||(this.#i.add(E),this.#z("group:toggled",{key:E,expanded:!0}),this.#z("model:changed",{reason:"expand",key:E}))}collapse(E){this.#i.delete(E)&&(this.#z("group:toggled",{key:E,expanded:!1}),this.#z("model:changed",{reason:"collapse",key:E}))}expandedKeys(){return[...this.#i]}pivotFields(){return this.#u}pivot(){this.#X();const E=this.#d;if(!E||!E.keys.size||!this.#C("pivotBy",[]).length)return null;if(!E.result){const A=k((this.#t.config||{}).locale),S=[...E.keys.entries()].sort((W,V)=>L(W[1],V[1],A)),x=S.map(([W])=>W);E.result={keys:S.map(([,W])=>W),paths:x,fields:this.#ne(x),groupPaths:[],columns:x.length*Math.max(1,this.#Ee().length),values:E.cells,cells:E.cells,error:null}}return E.result}invalidateHandles(){this.#w&&(z(this.#w.invalidateHandles)&&this.#w.invalidateHandles(),z(this.#w.invalidate)&&this.#w.invalidate("filter"))}#N(){const E=this.#e.fullFrame;return z(E)?E():null}#R(){const E=this.#N();return E?(this.#w||(this.#w=new v({mode:"memory"},this.#$())),E.version!==this.#O&&(this.#w.setRows(E.rows),this.#O=E.version),this.#w):null}#$(){const E=this.#t,A=E.state||{};return{...E,state:{...A,page:()=>0,pageSize:()=>0}}}#V(){const E=this.#R();return E?E.filteredIndices():new Uint32Array(0)}#W(){const E=this.#R();return E?E.unfilteredIndices():new Uint32Array(0)}#D(E){const A=this.#R();return A?A.handleFor(E):void 0}#x(){const E=this.#R();return E?E.display():[]}#Y(E){const A=this.#R();return A&&z(A.facetIndices)?A.facetIndices(E):new Uint32Array(0)}#I(){const E=this.#R();return E&&z(E.grandTotalRow)?E.grandTotalRow():null}#K(E){const A=this.#R();if(A){const V=E==="match"?A.matchCount:A.totalCount;if(z(V))return V.call(A)}const S=this.#e.counts,x=z(S)?S():null,W=x?x[E]:null;return typeof W=="number"?W:this.#v()}#U(){const E=this.#R();if(E&&z(E.grandTotalRow))return E.grandTotalRow();if((this.#t.config||{}).grandTotalRow!=="bottom")return null;const S=this.#e.grandTotals,x=z(S)?S():null;return!x||!x.totals?null:this.#l.grandTotal(x.totals,x.leafCount||0)}#B(){const E=this.#R();if(E&&z(E.unfilteredRows))return E.unfilteredRows();const A=[],S=this.count();for(let x=0;x<S;x++){const W=this.at(x);W&&A.push(W)}return A}#ce(){const E=this.#C("quick",""),A={protocol:D,groupPath:[],groupValues:[],groupBy:[],totals:[],totalFns:{},pivotBy:[],pivotMode:!1,filters:s(this.#C("filters",null),this.#_()),sort:this.#C("sort",[]),context:this.#C("context",null)};E&&(A.quick=E);const S=this.#C("where",null);return S&&S.active&&(A.where=S),A}#fe(){const E=this.#C("groupBy",[]).length,A=[];for(const S of this.#s.values())if(!(S.level!==E&&!S.flat))for(const x of S.cache.ids()){if(!S.cache.loaded(x))continue;const{start:W,end:V}=S.cache.rangeOf(x);for(let G=W;G<V&&S.cache.rowLoaded(G);G++){const Q=this.#q(S,G);Q&&!Q.group&&A.push(Q)}}return A}loadedCount(){const E=this.#R();if(E){const x=E.matchCount();return typeof x=="number"?x:E.count()}this.#X();const A=this.#C("groupBy",[]).length;let S=0;for(const x of this.#s.values())if(!(x.level!==A&&!x.flat))for(const W of x.cache.ids()){if(!x.cache.loaded(W))continue;const V=x.cache.fillOf(W);typeof V=="number"&&(S+=V)}return S}residentRows(){const E=this.#R();return E?E.display():this.#C("groupBy",[]).length>0?null:(this.#X(),this.#fe())}#ie(E,A,S){const{start:x,end:W}=E.cache.rangeOf(A),V=this.#C("groupBy",[]),G=this.#C("pivotBy",[]),Q=this.#C("quick",""),ee=this.#Ee(),ne={protocol:D,range:{start:x,end:W},groupPath:E.path,groupValues:E.values,groupBy:V,totals:ee,totalFns:this.#ae(ee),pivotBy:G,pivotMode:G.length>0,filters:s(this.#C("filters",null),this.#_()),sort:this.#C("sort",[]),context:this.#C("context",null),signal:S};Q&&(ne.quick=Q);const se=this.#C("where",null);return se&&se.active&&(ne.where=se),ne}async#Fe(E,A){if(!z(this.#e.fetch))return;if(!this.#m){this.#m=!0;const V=this.#g;this.#g=[],queueMicrotask(()=>{for(const G of V)G()})}const S=this.#o.begin(`${E.key}:${A}`);E.cache.begin(A,S);const x=this.#f,{start:W}=E.cache.rangeOf(A);try{const V=await this.#e.fetch(this.#ie(E,A,S.signal));if(!S.current||x!==this.#f||this.#p)return;S.settle();const G=V&&V.rows||[];if(!!(V&&V[M])&&!E.flat){E.flat=!0,E.children.clear();for(const[se,le]of[...this.#c])le.startsWith(`${E.key}:`)&&(this.#a.delete(le),this.#c.delete(se))}E.cache.fill(A,G),E.failed=!1;for(let se=0;se<G.length;se++)this.#a.delete(`${E.key}:${W+se}`);const ee=V&&typeof V.count=="number"?V.count:V&&typeof V.total=="number"?V.total:null,ne=V&&z(V.pendingTotal?.then)?V.pendingTotal:null;ee!==null?(E.count=ee,E.complete=!0):G.length<E.cache.pageSize?(E.count=W+G.length,E.complete=!0):ne&&(E.counting=!0,E.announced=null),V&&Array.isArray(V.pivotFields)&&this.#je(V.pivotFields),V&&V.pivot&&typeof V.pivot=="object"&&this.#Ce(V.pivot),this.#z("model:changed",{reason:"page",groupPath:E.path,block:A}),this.#z("rows:changed",{companion:!0,reason:"page",groupPath:E.path,block:A}),this.#ge(E),ne&&this.#Oe(E,ne,x)}catch(V){if(S.settle(),j(V))return;E.cache.failed(A,V),E.failed=!0;const{end:G}=E.cache.rangeOf(A);for(let Q=W;Q<G;Q++)this.#a.delete(`${E.key}:${Q}`);this.#z("model:changed",{reason:"page-error",groupPath:E.path,block:A}),this.#z("source:error",{error:V,groupPath:E.path,block:A})}}async#Oe(E,A,S){let x;try{x=await A}catch(W){if(S!==this.#f||this.#p)return;E.counting=!1,j(W)||(E.failed=!0),j(W)||this.#z("source:error",{error:W,groupPath:E.path});return}S!==this.#f||this.#p||(E.counting=!1,typeof x=="number"&&(E.count=x,E.complete=!0,this.#ge(E),this.#z("model:changed",{reason:"total",count:x,groupPath:E.path})))}#ge(E){typeof E.count!="number"||!E.complete||E.announced!==E.count&&(E.announced=E.count,this.#z("source:total",{total:E.count,groupPath:E.path}))}#be(E){if(this.#p)return null;this.#X();const A=this.#m?null:new Promise(G=>{this.#g.push(G),setTimeout(G,I)}),S=E();if(!A&&!S)return null;const x=(async()=>{A&&await A;for(let G=E();G;G=E())await G})();let W;const V=new Promise(G=>{W=setTimeout(G,I)});return Promise.race([x,V]).then(()=>clearTimeout(W))}totalPending(){if(this.#r.failed)return!1;if(this.#r.counting===!0)return!0;if(this.#R())return!1;this.#X();const E=this.#r;return E.count===null&&!E.complete&&E.cache.loadedExtent()===0}totalFailed(){return this.#r.failed===!0}#je(E){E.length===this.#u.length&&E.every((A,S)=>A===this.#u[S])||(this.#u=E,this.#z("column:pivoted",{pivotFields:E,remote:!0}))}#Pe(){const E=this.#t.config||{};return E.pivot&&E.pivot.separator||O}#ne(E){const A=this.#Pe(),S=this.#Ee();if(!S.length)return E.slice();const x=[];for(const W of E)for(const V of S)x.push(`${W}${A}${V}`);return x}#Ce(E){const A=this.#Pe();this.#d||(this.#d={keys:new Map,cells:new Map,result:null});const S=this.#d;let x=!1;const W=G=>{const Q=Array.isArray(G)?G:[G],ee=b(Q,A);return S.keys.has(ee)||(S.keys.set(ee,Q),x=!0),ee},V=this.#C("groupBy",[]).length>0;for(const G of Array.isArray(E.axis)?E.axis:[])W(G);for(const G of Array.isArray(E.cells)?E.cells:[]){if(!G||typeof G!="object")continue;const Q=W(G.pivot);if(V&&!(Array.isArray(G.group)&&G.group.length))continue;const ee=b(Array.isArray(G.group)?G.group:[],A);for(const[ne,se]of Object.entries(G.values||{}))S.cells.set(p(ee,Q,ne),se)}S.result=null,x&&this.#je((this.pivot()||{fields:[]}).fields)}#re(E){let A=this.#J(E);for(const S of E.children.values())this.#Ne(S.key)&&(A+=this.#re(S));return A}#J(E){if(E.count!==null)return E.count;const A=E.cache.loadedExtent();return E.complete?A:E.row&&E.row.leafCount>0?E.level>=this.#C("groupBy",[]).length?Math.max(A,E.row.leafCount):A===0?1:Math.min(A+E.cache.pageSize,Math.max(A,E.row.leafCount)):A+E.cache.pageSize}#G(E,A){let S=A,x=0;const W=[...E.children.entries()].filter(([,G])=>this.#Ne(G.key)).sort((G,Q)=>G[0]-Q[0]);for(const[G,Q]of W){const ee=G-x+1;if(S<ee)return{node:E,local:x+S};S-=ee,x=G+1;const ne=this.#re(Q);if(S<ne)return this.#G(Q,S);S-=ne}const V=this.#J(E);return x+S<V?{node:E,local:x+S}:null}#q(E,A){const S=`${E.key}:${A}`,x=this.#a.get(S);if(x)return x;const W=E.cache.rowAt(A);if(W===void 0)return null;const V=this.#C("groupBy",[]);let G;if(E.level<V.length&&!E.flat){const Q=V[E.level],ee=this.#d!==null&&E.level===V.length-1&&this.#C("pivotBy",[]).length>0,ne=this.#le(W,Q),se=ne==null,le=[...E.path,se?"":String(ne)],me=[...E.keyPath,se?null:String(ne)];if(G=this.#l.group({path:le,keyPath:me,column:Q,value:ne,level:E.level,parent:E.row,leafCount:Number(W.leafCount)||0,expanded:ee?!1:this.#Ne(t(me)),...ee?{hasChildren:!1}:{}}),G.totals=this.#F(W),G.data=W,!ee){let ve=this.#s.get(G.key);ve?ve.row=G:(ve=new P(le,E.level+1,this.#n,me),ve.row=G,this.#s.set(ve.key,ve)),ve.values=[...E.values,ne],E.children.set(A,ve)}}else G=this.#l.leaf(W,A,E.level,E.row);return this.#a.set(S,G),this.#c.set(G.key,S),G}#F(E){const A=E||{};if(A.totals&&typeof A.totals=="object")return A.totals;const S={};for(const x of this.#Ee())Object.hasOwn(A,x)&&(S[x]=A[x]);return S}#Me(E,A){const{start:S,end:x}=E.cache.rangeOf(A);for(let W=S;W<x;W++){const V=`${E.key}:${W}`,G=this.#a.peek(V);G&&this.#c.delete(G.key),this.#a.delete(V)}}#X(){const E=this.#de();return E===this.#f?!1:(this.#f=E,this.#o.abortAll("query"),this.#ue(),this.#m=!1,this.#z("model:changed",{reason:"query"}),!0)}#ue(){for(const E of this.#s.values())E.cache.clear(),E.count=null,E.complete=!1,E.announced=null,E.counting=!1,E.failed=!1,E.children.clear(),E.flat=!1;this.#a.clear(),this.#c.clear(),this.#y++,this.#d=null}#de(){const E=this.#C("where",null);return`${n({filters:this.#C("filters",null),sort:this.#C("sort",[]),quick:this.#C("quick",""),groupBy:this.#C("groupBy",[]),pivotBy:this.#C("pivotBy",[]),context:this.#C("context",null)})}|${E?E.version:0}`}#Ne(E){const A=this.#C("expanded",null);return A?z(A.has)?A.has(E):Array.prototype.includes.call(A,E):this.#i.has(E)}#Ee(){const E=this.#C("totals",[]);if(E&&E.length)return[...E];const A=this.#t.columns;return!A||!z(A.all)?[]:A.all().filter(S=>!!S.total).map(S=>S.id)}#ae(E){const A=this.#t.columns,S={};if(!A||!z(A.get))return S;for(const x of E){const W=A.get(x);if(!W)continue;const V=W.groupTotal!=null?W.groupTotal:W.total;typeof V=="string"&&(S[x]=V)}return S}#le(E,A){const S=this.#t.columns,x=S&&z(S.get)?S.get(A):void 0;return x&&z(x.getValue)?x.getValue(E):E?.[A]}#Ie(){u(this.#t)}#_(){const E=this.#t.config||{};return{tz:E.timeZone,weekStartsOn:E.weekStartsOn}}#C(E,A){const S=this.#t.state;if(S&&z(S[E])){const x=S[E]();return x??A}return A}#z(E,A){const S=this.#t.emit;z(S)&&S(E,A)}}}),Ue("packages/core/src/source/gapbuffer.js",function(e,U){"use strict";Object.defineProperty(e,"GapBuffer",{enumerable:!0,get:function(){return C}});const te=64;class C{#e;#t=0;#n=0;constructor(z=te){this.#e=new Uint32Array(Math.max(1,z)),this.#n=this.#e.length}static from(z,B=te){const Z=new C(z.length+Math.max(1,B));return Z.#e.set(z,0),Z.#t=z.length,Z.#n=Z.#e.length,Z}get length(){return this.#t+(this.#e.length-this.#n)}get capacity(){return this.#e.length}at(z){return z<0||z>=this.length?0:z<this.#t?this.#e[z]:this.#e[z+(this.#n-this.#t)]}insert(z,B){const Z=z<0?0:z>this.length?this.length:z;this.#r(Z),this.#t===this.#n&&this.#s(),this.#e[this.#t++]=B}push(z){this.insert(this.length,z)}removeAt(z){return!Number.isInteger(z)||z<0||z>=this.length?!1:(this.#r(z),this.#n++,!0)}toArray(){const z=new Uint32Array(this.length);return z.set(this.#e.subarray(0,this.#t),0),z.set(this.#e.subarray(this.#n),this.#t),z}clear(){this.#t=0,this.#n=this.#e.length}#r(z){if(z!==this.#t)if(z<this.#t){const B=this.#t-z;this.#e.copyWithin(this.#n-B,z,this.#t),this.#t=z,this.#n-=B}else{const B=z-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+B),this.#t=z,this.#n+=B}}#s(){const z=this.#e.length-this.#n,B=new Uint32Array(Math.max(this.#e.length*2,this.#e.length+te));B.set(this.#e.subarray(0,this.#t),0),B.set(this.#e.subarray(this.#n),B.length-z),this.#e=B,this.#n=B.length-z}}}),Ue("packages/core/src/store/ingest.js",function(e,U){"use strict";Object.defineProperty(e,"INGEST_DEFAULTS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"inferKind",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"decideText",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"createReaders",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"Ingest",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return s}});const te=U("packages/core/src/internal/schedule.js"),C=te.now,q=te.nextFrame,z=U("packages/core/src/internal/warn.js"),B=z.infoOnce,Z=z.warnOnce,F=U("packages/core/src/internal/predicates.js").isFunction,H=U("packages/core/src/internal/paths.js").pathGetter,w=U("packages/core/src/store/columnstore.js").ColumnStore,m=Object.freeze({chunkMs:8,chunkRows:512,sampleSize:100,dictionaryRatio:.1,columnarBelow:5e3,initialCapacity:1024});function c(n,u={}){if(u.multi)return"multi";if(n.length===0)return"object";let o=0,a=0,h=0,v=0,g=0;for(let d=0;d<n.length;d++){const p=n[d];typeof p=="number"?o++:typeof p=="boolean"?a++:typeof p=="string"?h++:p instanceof Date?v++:Array.isArray(p)&&g++}const k=n.length;return o===k?"float64":a===k?"bitset":v===k?"float64":h===k?"text":g===k?"multi":"object"}function f(n,u,o){return u<=0||n<o*u?"dictionary":"object"}function l(n,u,o){const a=new Map,h=new Map;for(const D of n){if(D.computed)continue;const _=F(D.read)?D.read:H(D.field||D.id);h.set(D.id,_),a.set(D.id,_)}const v=u?.order??[],g=u?.fns??{},k=u?.deps??{},d=u?.wrapDeps??null,p=v.filter(D=>F(g[D])),b=p.some(D=>k[D]==="*");let O=new WeakMap;const y=D=>{const _={};if(b)for(const[I,L]of h)_[I]=L(D);for(const I of p){const L=k[I];let $;if(L==="*")$=_;else{$={};const P=L||[];for(let N=0;N<P.length;N++){const T=P[N];$[T]=T in _?_[T]:h.get(T)?.(D)}}_[I]=g[I](d?d($,I):$,{data:D,row:null,column:null,grid:null,context:o})}return _},M=D=>{if(D===null||typeof D!="object"&&typeof D!="function")return y(D);let _=O.get(D);return _===void 0&&(_=y(D),O.set(D,_)),_};for(const D of p)a.set(D,_=>M(_)[D]);return{readers:a,reset(){O=new WeakMap}}}class r{spec;read;kind;inferred;nullable;candidate=!1;distinct=null;change=null;reason="";constructor(u,o){this.spec=u,this.read=o,this.kind="object",this.inferred=!1,this.nullable=u.nullable!==!1}}class t{#e;#t=[];#n=null;#r;#s=0;#i;#o=!1;#l=!1;#a=0;#c;constructor(u,o={},a={}){this.#e=Array.isArray(u)?u:Array.from(u||[]),this.#i={...m,...a};const h=o.columns??[];this.#r=l(h,o.computed??null,o.context),this.#c=this.#e.length>=this.#i.columnarBelow,this.#u(h,o.computed??null),this.#n=new w(this.#t.map(v=>({id:v.spec.id,kind:v.kind,nullable:v.nullable,read:v.read,dictionary:v.spec.dictionary})),{initialCapacity:this.#i.initialCapacity,columnarBelow:this.#i.columnarBelow})}get store(){return this.#n}get done(){return this.#o||this.#l}get progress(){return this.#s}slice(){if(this.done)return!1;if(this.#i.signal?.aborted)return this.#l=!0,!1;const u=C(),{chunkMs:o,chunkRows:a}=this.#i,h=this.#e.length;do{const v=Math.min(this.#s+a,h);this.#n.append(this.#e.slice(this.#s,v)),this.#d(this.#s,v),this.#s=v,this.#r.reset(),this.#h(!1)}while(this.#s<h&&C()-u<o);return this.#a+=C()-u,this.#i.onProgress?.({loaded:this.#s,total:h}),this.#s>=h?(this.#h(!0),this.#o=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(u=>({id:u.spec.id,kind:u.kind,nullable:u.nullable,read:u.read,dictionary:u.spec.dictionary})),decisions:this.#t.map(u=>({id:u.spec.id,kind:u.kind,nullable:u.nullable,inferred:u.inferred,distinct:u.candidate||u.change?this.#f(u):null,change:u.change,reason:u.reason})),count:this.#n.count,elapsed:this.#a,cancelled:this.#l}}#u(u,o){const a=this.#e,h=Math.min(this.#i.sampleSize,a.length),v=this.#i.dictionaryRatio,g=o?.pure instanceof Set?o.pure:new Set(o?.pure??o?.order??[]);for(const k of u){if(!k||!k.id)continue;if(k.computed&&(k.pure===!1||o&&!g.has(k.id))){Z(`ingest.impure.${k.id}`,`column "${k.id}" is an impure computed column and is not materialised into the store`);continue}const d=this.#r.readers.get(k.id)??(F(k.read)?k.read:H(k.field||k.id)),p=new r(k,d);if(k.kind)p.kind=k.kind,p.reason="declared by the caller";else if(k.dictionary)p.kind=k.multi?"multi":"dictionary",p.reason="value table supplied (lookup column)";else{const b=[];for(let y=0;y<h&&b.length<this.#i.sampleSize;y++){const M=d(a[y]);M!=null&&b.push(M)}p.inferred=!0;const O=c(b,{multi:k.multi});if(O==="text"){const y=new Set(b).size;p.kind=f(y,b.length,v),p.candidate=this.#c,p.reason=`sampled ${y} distinct in ${b.length}`}else p.kind=O,p.reason=`inferred from ${b.length} sampled values`,O==="object"&&b.length&&B(`ingest.mixed.${k.id}`,`column "${k.id}" holds mixed or unrecognised value types; storing as an object array. Declare a type to avoid this.`);p.kind==="object"&&p.candidate&&(p.distinct=new Set(b))}this.#t.push(p)}}#d(u,o){const a=this.#e;for(const h of this.#t){if(!h.candidate||!h.distinct)continue;const v=h.distinct;for(let g=u;g<o;g++){const k=h.read(a[g]);k!=null&&v.add(k)}}}#f(u){if(u.distinct)return u.distinct.size;const o=this.#n.column(u.spec.id);return o?.dict?o.dict.size:0}#h(u){const o=this.#i.dictionaryRatio,a=this.#e.length;for(const h of this.#t){if(!h.candidate)continue;const v=this.#f(h);if(h.kind==="dictionary"&&v>=o*a){const g=this.#n.column(h.spec.id);h.distinct=new Set(g?.dict?g.dict.values():[]),this.#n.convert(h.spec.id,"object"),h.kind="object",h.change="demoted",h.reason=`${v} distinct values is at or above ${o*100}% of ${a} rows`;continue}if(h.kind==="object"&&v>=o*a){h.candidate=!1,h.distinct=null,h.reason=`${v} distinct values is at or above ${o*100}% of ${a} rows`;continue}u&&h.kind==="object"&&v<o*a&&(this.#n.convert(h.spec.id,"dictionary"),h.kind="dictionary",h.change=h.change==="demoted"?null:"promoted",h.reason=`${v} distinct values is below ${o*100}% of ${a} rows`,h.distinct=null),u&&(h.candidate=!1)}}}async function i(n,u={},o={}){const a=new t(n,u,o),h=o.scheduler?.frame??q;for(;a.slice();)await new Promise(v=>{h(v)});return a.result()}function s(n,u={},o={}){const a=new t(n,u,{...o,chunkMs:1/0});for(;a.slice(););return a.result()}}),Ue("packages/core/src/store/columnpack.js",function(e,U){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return f}});const C=U("packages/core/src/internal/paths.js").pathGetter,q=U("packages/core/src/store/ingest.js"),z=q.inferKind,B=q.decideText,Z=q.INGEST_DEFAULTS,F=U("packages/core/src/store/columnstore.js").toFloat,X=new Set(["float64","int32","bitset","dictionary","object","multi"]);function H(l){if(!Array.isArray(l)||l.length===0)return!1;for(const r of l)if(!r||typeof r.id!="string"||typeof r.field!="string"||r.field===""||r.kind&&!X.has(r.kind))return!1;return!0}function j(l){const r=F(l);return Number.isFinite(r)?r|0:0}function w(l){return l==null?[]:Array.isArray(l)?l:[l]}function m(l,r,t,i){if(l.kind)return l.kind;const s=[];for(let o=0;o<r.length&&s.length<Z.sampleSize;o++){const a=r[o];a!=null&&s.push(a)}const n=z(s,{multi:l.multi});if(n!=="text")return n;const u=new Set(s).size;return B(u,s.length,i)}function c(l,r,t={}){const i=r.length|0,s=t.dictionaryRatio??Z.dictionaryRatio,n=[];for(const u of l){const o=C(u.field||u.id),a=u.nullable!==!1,h=new Array(i);for(let p=0;p<i;p++){const b=o(r[p]);h[p]=b===void 0?null:b}const v=m(u,h,i,s),g=a?new Uint8Array(i+7>>3):null,k=p=>{g&&(g[p>>3]|=1<<(p&7))};let d;switch(v){case"float64":{const p=new Float64Array(i);for(let b=0;b<i;b++){const O=h[b],y=O===null;y||k(b),p[b]=y?NaN:F(O)}d={id:u.id,kind:v,nullable:a,values:p,presence:g,offsets:null,table:null};break}case"int32":{const p=new Int32Array(i);for(let b=0;b<i;b++){const O=h[b],y=O===null;y||k(b),p[b]=y?0:j(O)}d={id:u.id,kind:v,nullable:a,values:p,presence:g,offsets:null,table:null};break}case"bitset":{const p=new Uint8Array(i+7>>3);for(let b=0;b<i;b++){const O=h[b],y=O===null;y||k(b),!y&&O&&(p[b>>3]|=1<<(b&7))}d={id:u.id,kind:v,nullable:a,values:p,presence:g,offsets:null,table:null};break}case"dictionary":{const p=new Uint32Array(i),b=[],O=new Map;for(let y=0;y<i;y++){const M=h[y];if(M===null){p[y]=0;continue}k(y);let D=O.get(M);D===void 0&&(D=b.length,b.push(M),O.set(M,D)),p[y]=D}d={id:u.id,kind:v,nullable:a,values:p,presence:g,offsets:null,table:b};break}case"multi":{const p=[],b=new Map,O=new Uint32Array(i+1),y=[];for(let M=0;M<i;M++){const D=h[M];O[M]=y.length,D===null||k(M);const I=w(D);for(let L=0;L<I.length;L++){const $=I[L];let P=b.get($);P===void 0&&(P=p.length,p.push($),b.set($,P)),y.push(P)}}O[i]=y.length,d={id:u.id,kind:v,nullable:a,values:Int32Array.from(y),presence:g,offsets:O,table:p};break}default:{const p=new Array(i);for(let b=0;b<i;b++){const O=h[b];O!==null&&k(b),p[b]=O}d={id:u.id,kind:"object",nullable:a,values:p,presence:g,offsets:null,table:null};break}}n.push(d)}return{count:i,columns:n}}function f(l){const r=[];if(!l||!Array.isArray(l.columns))return r;const t=i=>{ArrayBuffer.isView(i)&&i.buffer&&!r.includes(i.buffer)&&r.push(i.buffer)};for(const i of l.columns)t(i.values),t(i.presence),t(i.offsets);return r}}),Ue("packages/core/src/source/stream.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_PROMOTE_BELOW",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"createStreamSource",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return P}});const C=U("packages/core/src/internal/lru.js").Lru,z=U("packages/core/src/internal/predicates.js").isFunction,B=U("packages/core/src/internal/schedule.js"),Z=B.now,K=B.nextFrame,F=B.cancelFrame,X=B.whenIdle,j=U("packages/core/src/internal/compare.js").defaultCompare,w=U("packages/core/src/internal/warn.js"),m=w.warnOnce,c=w.infoOnce,l=U("packages/core/src/internal/paths.js").getPath,r=U("packages/core/src/source/abort.js"),t=r.createAbortScope,i=r.isAbortError,s=U("packages/core/src/source/rows.js"),n=s.createRowFactory,u=s.lazyRowView,a=U("packages/core/src/source/gapbuffer.js").GapBuffer,v=U("packages/core/src/source/memory.js").createMemorySource,k=U("packages/core/src/source/filterwire.js").querySignature,p=U("packages/core/src/store/columnpack.js").isPortableSchema,b=25e4,O=Symbol("lattice.stream.storeBacked"),y=8,M=.1,D=1e3,_=50;function I(N){return Math.min(D,Math.max(_,Math.floor(N/4)))}function L(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 E=Date.parse(T);return Number.isNaN(E)?Number(T):E}return NaN}function $(N,T){return new P(N,T)}class P{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#s=[];#i=null;#o;#l;#a=new Map;#c=t();#u={loaded:0,estimated:void 0};#d=null;#f=0;#h=0;#p=0;#m=0;#g=null;#b=null;#y=null;#A=!1;#w=!1;#O=!1;#v=!1;#T="";#S=0;#E=0;#M=0;#P=null;#N=1/0;#R=!1;#$=null;#V=null;#W=null;#D=null;#x=!1;#Y=0;#I=0;#K=!1;constructor(T,E){this.#e=T||{mode:"stream"},this.#t=E||{},this.#o=n(this.#t),this.#l=new C(4096),this.#T=this.#Xe();const A=(this.#t.config||{}).ingest;this.#x=!!A&&A.retainSource===!1,z(this.#e.open)||m("source.stream.open",'source.mode "stream" requires an open function; the grid will stay empty.'),this.#e.autoStart!==!1&&queueMicrotask(()=>this.start());const S=Number(this.#e.poll);Number.isFinite(S)&&S>0&&(this.#D=setInterval(()=>{this.#v||this.reload()},S),this.#D&&z(this.#D.unref)&&this.#D.unref()),this.#B()}#U(){const T=Number(this.#e.maxAge);return Number.isFinite(T)&&T>0?T:0}#B(){const T=this.#U();if(!T)return;const E=this.#e.ageBy;z(E)?this.#V=E:typeof E=="string"&&E?this.#V=A=>l(A,E):this.#V=null,this.#P=[],this.#$=setInterval(()=>{this.#v||this.#ce()&&(this.#X(),this.#he())},I(T)),this.#$&&z(this.#$.unref)&&this.#$.unref()}#ce(){const T=this.#U();return!T||!this.#P?!1:this.#R?!0:this.#N<Date.now()-T*(1+M)}#fe(T,E){if(!this.#P)return;const A=this.#V?L(this.#V(E)):Date.now();this.#P[T]=A,Number.isNaN(A)||(A<this.#N&&(this.#N=A),A<Date.now()-this.#U()&&(this.#R=!0))}#ie(){return this.#ye("groupBy",[]).length>0?!0:!!this.#ye("pivotMode",!1)&&this.#ye("pivotBy",[]).length>0}#Fe(){if(this.#g||this.#v)return;const T=this.#ie();if(T&&!this.#b){this.#b=v({mode:"memory",rows:this.#n},this.#Oe()),this.#A=!1;return}!T&&this.#b&&(this.#b.destroy(),this.#b=null)}#Oe(){if(this.#y)return this.#y;const T=this,E={liveIndices:()=>T.#ge(),live:A=>T.#n[A]!==void 0,source:A=>T.#Le(A),get physical(){return T.#n.length}};return this.#x&&(E.column=A=>{const S=T.#t.store;return S&&z(S.column)?S.column(A):void 0}),this.#y=Object.create(this.#t,{store:{value:E,enumerable:!0,configurable:!0}}),this.#y}#ge(){const T=new Uint32Array(this.#n.length);let E=0;for(let A=0;A<this.#n.length;A++)this.#n[A]!==void 0&&(T[E++]=A);return T.subarray(0,E)}#be(){return this.#g?this.#g:this.#b?(this.#A&&(this.#A=!1,this.#b.setRows(this.#n)),this.#b):null}invalidate(T="filter"){if(this.#g){this.#g.invalidate(T);return}this.#Fe(),this.#b&&this.#b.invalidate(T),(T==="filter"||T==="sort")&&this.#Ee()}count(){const T=this.#be();return T?T.count():this.#r?this.#r.length:this.#S}matchCount(){const T=this.#be();return T&&z(T.matchCount)?T.matchCount():this.#r?this.#r.length:this.#S}totalCount(){const T=this.#be();return T&&z(T.totalCount)?T.totalCount():this.#S}unfilteredRows(){const T=this.#be();if(T&&z(T.unfilteredRows))return T.unfilteredRows();const E=[];for(let A=0;A<this.#n.length;A++){if(!this.#n[A])continue;const S=this.#ve(A);S&&E.push(S)}return E}at(T){const E=this.#be();if(E)return E.at(T);if(T<0||T>=this.count())return;const A=this.#r?this.#r.at(T):T,S=this.#ve(A);return S.index=T,S}byKey(T){const E=this.#be();if(E)return E.byKey(T);const A=this.#a.get(T);return A===void 0?void 0:this.#ve(A)}leavesOf(T){const E=this.#be();return E&&z(E.leavesOf)?E.leavesOf(T):[]}loaded(T){return T>=0&&T<this.count()}hint(T,E){if(this.#g){this.#g.hint(T,E);return}this.#je(),this.#p=Math.max(0,Math.floor(T))}#je(){this.#v||this.#Xe()===this.#T||this.reload()}display(){const T=this.#be();return T?T.display():u(()=>this.count(),E=>this.at(E))}apply(T){if(this.#g)return this.#g.apply(T);const E={added:[],updated:[],removed:[]};if(!T)return E;if(T.update){let A=!1;for(const S of T.update){const x=this.#a.get(this.#o.keyOf(S,-1));if(x===void 0)continue;const W=this.#Ie(x);this.#x?this.#k(x,S):this.#n[x]=S,this.#l.delete(x),this.#_(x,W),this.#P&&(this.#fe(x,S),A=!0),this.#A=!0,E.updated.push(this.#ve(x))}A&&this.#X()}if(T.add&&T.add.length){const A=this.#F(T.add);for(const S of A)E.added.push(this.#ve(S))}return T.remove&&T.remove.length&&m("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#he(),E}reload(T){this.#c.abortAll("reload"),this.#Be(),this.#b&&(this.#b.destroy(),this.#b=null),this.#A=!1,this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear(),this.#g=null,this.#S=0,this.#E=0,this.#M=0,this.#P&&(this.#P=[]),this.#N=1/0,this.#R=!1,this.#w=!1,this.#O=!1,this.#u={loaded:0,estimated:void 0},this.#T=this.#Xe(),this.#ke("model:changed",{reason:"reload"}),this.start()}destroy(){this.#v=!0,this.#D!==null&&(clearInterval(this.#D),this.#D=null),this.#$!==null&&(clearInterval(this.#$),this.#$=null),this.#P=null,this.#c.abortAll("destroyed"),this.#Be(),this.#d!==null&&(this.#Ue(this.#d),this.#d=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.#O||this.#v||!z(this.#e.open))return;this.#O=!0;const T=this.#c.begin("stream");this.#Ee(),this.#Fe();let E;try{E=this.#e.open({sort:this.#ye("sort",[]),filters:this.#ye("filters",null),quick:this.#ye("quick","")||void 0,context:this.#ye("context",null),signal:T.signal})}catch(S){this.#ke("source:error",{error:S});return}const A=z(E[Symbol.asyncIterator])?E[Symbol.asyncIterator]():E[Symbol.iterator]();this.#W=A;try{for(;;){const S=await A.next();if(!T.current||this.#v)return;if(S.done){this.#oe();return}if(await this.#Pe(S.value,T),!T.current||this.#v)return;if(S.value&&S.value.done){this.#oe();return}if(await this.#se(),!T.current||this.#v)return}}catch(S){if(i(S))return;this.#ke("source:error",{error:S})}finally{T.settle()}}progress(){return{loaded:this.#u.loaded,estimated:this.#u.estimated,done:this.#w,live:this.#S,evicted:this.#E}}promoted(){return this.#g!==null}memorySource(){return this.#g}invalidateHandles(){const T=this.#be();T&&(z(T.invalidateHandles)&&T.invalidateHandles(),z(T.invalidate)&&T.invalidate("sort"))}renderCount(){return this.#f}ingestStats(){return{worker:this.#Y,inline:this.#I,storeBacked:this.#x}}#Pe(T,E){if(!T)return;const A=T.rows;if(A&&A.length&&this.#Ce(A))return this.#J(T,E);const S=Z();A&&A.length&&(this.#F(A),this.#I++),this.#ne(T),this.#h+=Z()-S,this.#he()}#ne(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)}#Ce(T){if(this.#K||this.#g)return!1;const E=this.#G();if(!E)return!1;const A=this.#t.store;if(!A||!z(A.appendPacked))return!1;const S=this.#q();return!S||!p(S)?(this.#K=!0,c("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<E.threshold?!1:!this.#re(T)}#re(T){if(!this.#o.keyed)return!1;const E=new Set;for(let A=0;A<T.length;A++){const S=this.#o.keyOf(T[A],this.#n.length+A);if(S!=null){if(E.has(S)||this.#a.has(S))return!0;E.add(S)}}return!1}async#J(T,E){const A=T.rows,S=this.#G(),x=this.#q();let W;try{W=await S.columnize(x,A,{key:"ingest:stream",signal:E&&E.signal})}catch(ne){if(i(ne)||(m("source.stream.columnize","worker columnization failed; columnizing on the main thread",ne),this.#K=!0,E&&(!E.current||this.#v)))return;this.#F(A),this.#I++,this.#ne(T),this.#he();return}if(E&&(!E.current||this.#v))return;const V=this.#t.store,G=this.#x?void 0:A,{from:Q}=V.appendPacked(W,G),ee=W.count|0;for(let ne=0;ne<ee;ne++){const se=Q+ne,le=A[ne],me=this.#o.keyed?this.#o.keyOf(le,se):null;if(this.#n[se]=this.#x?O:le,this.#S++,this.#fe(se,le),me!==null&&this.#a.set(me,se),!this.#r||!this.#ae(se))continue;const ve=this.#C(se);this.#r.insert(ve,se),ve<=this.#p&&this.#m++}this.#A=!0,this.#X(),this.#Y++,this.#ne(T),this.#he()}#G(){const T=this.#t.ingestWorker;return z(T)?T():null}#q(){const T=this.#t.storeSchema;return z(T)?T():null}#F(T){const E=[],A=this.#t.store,S=new Array(T.length),x=[],W=new Set;for(let G=0;G<T.length;G++){const Q=this.#o.keyed?this.#o.keyOf(T[G],this.#n.length+x.length):null;S[G]=Q,!(Q!==null&&(this.#a.has(Q)||W.has(Q)))&&(Q!==null&&W.add(Q),x.push(T[G]))}let V=x.length&&A&&z(A.append)?A.append(x).from:this.#n.length;for(let G=0;G<T.length;G++){const Q=T[G],ee=S[G];if(ee!==null&&this.#a.has(ee)){const le=this.#a.get(ee),me=this.#Ie(le);this.#x||(this.#n[le]=Q,A&&z(A.setSource)&&A.setSource(le,Q)),this.#k(le,Q),this.#l.delete(le),this.#fe(le,Q),this.#_(le,me);continue}const ne=V++;if(this.#n[ne]=this.#x?O:Q,this.#S++,this.#fe(ne,Q),ee!==null&&this.#a.set(ee,ne),E.push(ne),!this.#r||!this.#ae(ne))continue;const se=this.#C(ne);this.#r.insert(se,ne),se<=this.#p&&this.#m++}return this.#A=!0,this.#X(),E}#Me(T){const E=this.#n[T];let A=!1;if(this.#r){const V=this.#Ne(T);V>=0&&V<=this.#p&&(A=!0)}else T<=this.#p&&(A=!0);const S=E===O?this.#Le(T):E,x=this.#o.keyed?this.#o.keyOf(S,T):null;x!==null&&this.#a.get(x)===T&&this.#a.delete(x),this.#n[T]=void 0,this.#P&&(this.#P[T]=NaN),this.#l.delete(T);const W=this.#t.store;return W&&z(W.remove)&&W.remove(T),this.#S--,A}#X(){let T=0,E=0;const A=this.#de();T+=A.dropped,E+=A.aboveAnchor;const S=this.#ue();T+=S.dropped,E+=S.aboveAnchor,T&&(this.#A=!0,this.#E+=T,this.#Ee(),this.#m-=E,this.#ke("stream:evicted",{evicted:T,total:this.#E,live:this.#S}))}#ue(){const T=this.#e.maxRows;if(!Number.isFinite(T)||T<=0||this.#S<=T)return{dropped:0,aboveAnchor:0};const E=Math.max(1,Math.floor(T*(1-M)));let A=0,S=0;for(;this.#S>E&&this.#M<this.#n.length;){const x=this.#M++;this.#n[x]!==void 0&&(this.#Me(x)&&S++,A++)}return{dropped:A,aboveAnchor:S}}#de(){const T=this.#U();if(!T||!this.#P||!this.#ce())return{dropped:0,aboveAnchor:0};const E=Date.now()-T;let A=0,S=0,x=1/0;for(let W=this.#M;W<this.#n.length;W++){if(this.#n[W]===void 0)continue;const V=this.#P[W];if(!(Number.isNaN(V)||V===void 0)){if(V>=E){V<x&&(x=V);continue}this.#Me(W)&&S++,A++}}for(this.#N=x,this.#R=!1;this.#M<this.#n.length&&this.#n[this.#M]===void 0;)this.#M++;return{dropped:A,aboveAnchor:S}}#Ne(T){if(!this.#r)return T;for(let E=0;E<this.#r.length;E++)if(this.#r.at(E)===T)return E;return-1}#Ee(){this.#s=this.#ye("sort",[]),this.#i=this.#ye("filters",null);const T=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#U()>0,E=this.#ye("where",null),A=(this.#t.config||{}).hostFilter,S=!!(E&&E.active)||!!(A&&z(A.active)&&A.active());if(!(T||this.#s.length>0||!!this.#i||!!this.#ye("quick","")||S)){this.#r=null;return}this.#r=new a(Math.max(64,this.#n.length+64));for(let W=0;W<this.#n.length;W++)this.#n[W]!==void 0&&this.#ae(W)&&this.#r.insert(this.#C(W),W)}#ae(T){const E=this.#Le(T);if(this.#i&&!this.#le(this.#i,E))return!1;const A=String(this.#ye("quick","")||"").toLowerCase();if(A&&!this.#st(E).includes(A))return!1;const S=(this.#t.config||{}).hostFilter;if(S&&z(S.active)&&S.active()&&!S.passes(this.#ve(T)))return!1;const x=this.#ye("where",null);if(x&&x.active){const W=this.#ve(T);if(!x.passes(W.data,W.key))return!1}return!0}#le(T,E){if(!T)return!0;const A=T;if(Array.isArray(A.conditions))return A.op==="or"?A.conditions.some(W=>this.#le(W,E)):A.op==="not"?!A.conditions.some(W=>this.#le(W,E)):A.conditions.every(W=>this.#le(W,E));const S=T,x=(this.#t.compute||{}).testValue;return z(x)?!!x(this.#Re(E,S.col),S,(this.#t.config||{}).locale):(m("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#Ie(T){if(!this.#r)return-1;if(!this.#s.length)return this.#Ne(T);let E=0,A=this.#r.length;for(;E<A;){const S=E+A>>>1;this.#z(this.#r.at(S),T)<0?E=S+1:A=S}for(let S=E;S<this.#r.length;S++){const x=this.#r.at(S);if(x===T)return S;if(this.#z(x,T)>0)break}return this.#Ne(T)}#_(T,E){if(!this.#r||!this.#s.length)return;const A=this.#ae(T);if(E>=0&&this.#r.at(E)===T)this.#r.removeAt(E),E<=this.#p&&this.#m--;else if(E>=0)return;if(!A)return;const S=this.#C(T);this.#r.insert(S,T),S<=this.#p&&this.#m++}#C(T){if(!this.#r||!this.#s.length)return this.#r?this.#r.length:0;let E=0,A=this.#r.length;for(;E<A;){const S=E+A>>>1;this.#z(T,this.#r.at(S))<0?A=S:E=S+1}return E}#z(T,E){const A=this.#Le(T),S=this.#Le(E);for(const x of this.#s){const W=this.#He(x.col),V=this.#Re(A,x.col),G=this.#Re(S,x.col),ee=(W&&W.value&&z(W.value.compare)?W.value.compare:j)(V,G);if(ee!==0)return x.dir==="desc"?-ee:ee}return 0}#oe(){this.#w=!0,this.#u.loaded=this.#u.loaded||this.#n.length;const T=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:b;!this.#x&&this.#n.length<T&&(this.#g=v({mode:"memory",rows:this.#n},this.#t),this.#$!==null&&(clearInterval(this.#$),this.#$=null),this.#b&&(this.#b.destroy(),this.#b=null)),this.#he(),this.#ke("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:T})}#he(){this.#d!==null||this.#v||(this.#d=this.#me(()=>{this.#d=null,this.#f++;const T=this.#m;this.#m=0,this.#h=0,this.#ke("stream:chunk",{loaded:this.#u.loaded,estimated:this.#u.estimated,count:this.count(),renders:this.#f}),this.#ke("model:changed",{reason:"stream",shiftAboveViewport:T,anchor:this.#p}),this.#ke("rows:changed",{companion:!0,reason:"stream"})}))}#se(){return this.#f===0||this.#h<this.#pe()?Promise.resolve():(this.#h=0,new Promise(T=>{const E=(this.#t.scheduler||{}).idle;z(E)?E(()=>T()):X(()=>T())}))}#pe(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:y}#me(T){const E=this.#t.scheduler||{};return z(E.frame)?E.frame(T):K(T)}#Ue(T){const E=this.#t.scheduler||{};z(E.cancel)?E.cancel(T):F(T)}#Le(T){const E=this.#n[T];if(E!==void 0&&E!==O)return E;if(E===void 0)return;const A=this.#t.store;return A&&z(A.source)?A.source(T):void 0}#k(T,E){const A=this.#t.store;if(!A||!z(A.set))return;const S=this.#q();if(Array.isArray(S))for(const x of S){if(!x||!x.id)continue;const W=z(x.read)?x.read:V=>l(V,x.field||x.id);A.set(x.id,T,W(E))}}#ve(T){let E=this.#l.get(T);return E||(E=this.#o.leaf(this.#Le(T),T),this.#l.set(T,E)),E}#Re(T,E){const A=this.#He(E);return A&&z(A.getValue)?A.getValue(T):T?.[E]}#st(T){const E=this.#t.columns,A=E&&z(E.all)?E.all():[],S=[];for(const x of A){const W=z(x.getValue)?x.getValue(T):void 0;W!=null&&W!==""&&S.push(String(W))}return S.join(" ").toLowerCase()}#He(T){const E=this.#t.columns;return E&&z(E.get)?E.get(T):void 0}#Be(){const T=this.#W;if(this.#W=null,T&&z(T.return))try{T.return()}catch{}}#Xe(){return k({context:this.#ye("context",null)})}#ye(T,E){const A=this.#t.state;if(A&&z(A[T])){const S=A[T]();return S??E}return E}#ke(T,E){const A=this.#t.emit;z(A)&&A(T,E)}}}),Ue("packages/core/src/source/url.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return m}});const C=U("packages/core/src/internal/warn.js").warnOnce,q=U("packages/core/src/internal/predicates.js"),z=q.isObject,B=q.isFunction,K=U("packages/core/src/internal/paths.js").getPath,X=U("packages/core/src/source/abort.js").isAbortError,H=500,j=new Set(["application/x-ndjson","application/ndjson","application/jsonlines","application/jsonl","application/x-jsonlines","text/x-ndjson"]),w=Symbol("lattice.url.skip");function m(g,k={}){const d=z(k)?k:{},p=B(d.fetch)?d.fetch:typeof globalThis<"u"&&B(globalThis.fetch)?globalThis.fetch:null,b=d.format==="json"||d.format==="ndjson"?d.format:void 0,O=typeof d.rowsPath=="string"&&d.rowsPath?d.rowsPath:void 0,y=B(d.map)?d.map:void 0,M=z(d.headers)?d.headers:void 0,D=Number.isFinite(d.batchSize)&&d.batchSize>0?Math.floor(d.batchSize):H,_=d.lenient===!0,I=Number.isFinite(d.poll)&&d.poll>0?Math.floor(d.poll):void 0,L=typeof g=="string"&&g.length>0;L||C("source.url.url","createUrlSource needs a URL string; the grid will stay empty.");async function*$(N={}){if(!L)return;if(!p)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const T=N&&N.signal;let E;try{E=await p(g,M?{signal:T,headers:M}:{signal:T})}catch(x){throw X(x)?x:new Error(`[lattice] createUrlSource: request to ${g} failed — ${x&&x.message||x}`)}if(!E||!E.ok){const x=E?E.status:"no response";throw new Error(`[lattice] createUrlSource: ${x} for ${g}`)}const A=c(g,b,E),S=E.body&&B(E.body.getReader)?E.body.getReader():null;try{if(!S){const V=await E.text();(A||r(V,g))==="ndjson"?yield*o(null,null,V,0,E,g,D,_):yield*u(V,g,O,y);return}const x=new TextDecoder("utf-8");if(A==="json"){yield*u(await n(S,x,""),g,O,y);return}if(A==="ndjson"){yield*o(S,x,"",0,E,g,D,_);return}const W=await t(S,x,g);W.format==="json"?yield*u(await n(S,x,W.seed),g,O,y):yield*o(S,x,W.seed,W.bytes,E,g,D,_)}finally{if(S&&B(S.cancel))try{await S.cancel()}catch{}}}const P={mode:"stream",open:$,autoStart:d.autoStart!==!1};return I!==void 0&&(P.poll=I),Number.isFinite(d.maxRows)&&(P.maxRows=d.maxRows),Number.isFinite(d.maxAge)&&(P.maxAge=d.maxAge),(typeof d.ageBy=="string"||B(d.ageBy))&&(P.ageBy=d.ageBy),Number.isFinite(d.coalesceMs)&&(P.coalesceMs=d.coalesceMs),Number.isFinite(d.promoteToMemoryBelow)&&(P.promoteToMemoryBelow=d.promoteToMemoryBelow),P}function c(g,k,d){if(k)return k;const p=f(g);if(p)return p;const b=d&&d.headers&&B(d.headers.get)?d.headers.get("content-type"):null;return l(b)}function f(g){const k=String(g).split(/[?#]/)[0].toLowerCase();if(k.endsWith(".ndjson")||k.endsWith(".jsonl"))return"ndjson";if(k.endsWith(".json"))return"json"}function l(g){if(!g)return;const k=g.split(";")[0].trim().toLowerCase();if(j.has(k))return"ndjson";if(k==="application/json"||k==="text/json"||k.endsWith("+json"))return"json"}function r(g,k){const d=g.replace(/^\s+/,""),p=i(d);if(p==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${k} — pass opts.format: 'json' | 'ndjson'.`);return p}async function t(g,k,d){let p="",b=0;for(;;){const{value:y,done:M}=await g.read();if(y&&(b+=y.byteLength,p+=k.decode(y,{stream:!0})),M){p+=k.decode();break}const D=p.replace(/^\s+/,"");if(D){if(D[0]==="[")return{format:"json",seed:p,bytes:b};if(D[0]!=="{"||p.indexOf(`
|
|
7
|
+
`||u==="\r"){n++;continue}if(u>="0"&&u<="9"){n=w(i,n,s);continue}if(u==="."&&i[n+1]>="0"&&i[n+1]<="9"){n=w(i,n,s);continue}if(u==='"'||u==="'"){n=m(i,n,s);continue}if(u==="["){const a=i.indexOf("]",n+1);if(a<0)throw new X("a [column reference] was opened and never closed",n);s.push({kind:q,value:i.slice(n+1,a).trim(),at:n}),n=a+1;continue}if(j(u)){n=c(i,n,s);continue}const o=i.slice(n,n+2);if(K.includes(o)){s.push({kind:B,value:o==="!="?"<>":o,at:n}),n+=2;continue}if(F.includes(u)){s.push({kind:B,value:u,at:n}),n++;continue}throw new X(`unexpected character ${JSON.stringify(u)}`,n)}return s.push({kind:Z,value:null,at:i.length}),s}function j(i){return/[A-Za-z_À-]/.test(i)}function w(i,s,n){let u=s,o=!1;for(;u<i.length;){const a=i[u];if(a>="0"&&a<="9"){u++;continue}if(a==="."&&!o){o=!0,u++;continue}if((a==="e"||a==="E")&&/[0-9+-]/.test(i[u+1]||"")){for(u+=2;u<i.length&&i[u]>="0"&&i[u]<="9";)u++;break}break}return n.push({kind:te,value:Number(i.slice(s,u)),at:s}),u}function m(i,s,n){const u=i[s];let o=s+1,a="";for(;o<i.length;){if(i[o]===u){if(i[o+1]===u){a+=u,o+=2;continue}return n.push({kind:C,value:a,at:s}),o+1}a+=i[o],o++}throw new X("a string was opened and never closed",s)}function c(i,s,n){let u=s;for(;u<i.length&&/[A-Za-z0-9_.À-]/.test(i[u]);)u++;const o=i.slice(s,u);let a=u;for(;a<i.length&&i[a]===" ";)a++;return n.push({kind:i[a]==="("?z:q,value:o,at:s}),u}const f={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function l(i){const s=String(i??"").replace(/^\s*=/,"");if(!s.trim())throw new X("the formula is empty");const n=H(s);let u=0;const o=()=>n[u],a=()=>n[u++],h=O=>{const y=o();if(y.kind!==B||y.value!==O)throw new X(`expected ${JSON.stringify(O)}`,y.at);u++},v=O=>{let y=g();for(;;){const M=o();if(M.kind!==B)break;const D=f[M.value];if(!D||D<O)break;u++;const _=v(M.value==="^"?D:D+1);y={kind:"bin",op:M.value,left:y,right:_}}return y},g=()=>{const O=o();return O.kind===B&&(O.value==="-"||O.value==="+")?(u++,{kind:"unary",op:O.value,arg:g()}):k()},k=()=>{let O=d();for(;o().kind===B&&o().value==="%";)u++,O={kind:"unary",op:"%",arg:O};return O},d=()=>{const O=a();if(O.kind===te)return{kind:"num",value:O.value};if(O.kind===C)return{kind:"str",value:O.value};if(O.kind===q)return{kind:"ref",name:O.value};if(O.kind===z){h("(");const y=[];if(!(o().kind===B&&o().value===")"))for(;;){if(y.push(v(1)),o().kind===B&&o().value===","){u++;continue}break}return h(")"),{kind:"call",name:String(O.value).toUpperCase(),args:y}}if(O.kind===B&&O.value==="("){const y=v(1);return h(")"),y}throw O.kind===Z?new X("the formula ends unexpectedly",O.at):new X(`unexpected ${JSON.stringify(O.value)}`,O.at)},p=v(1),b=o();if(b.kind!==Z)throw new X(`unexpected ${JSON.stringify(b.value)}: is an operator missing?`,b.at);return p}function r(i){const s=new Set,n=u=>{if(!(!u||typeof u!="object")){if(u.kind==="ref"){s.add(String(u.name));return}if(u.kind==="bin"){n(u.left),n(u.right);return}if(u.kind==="unary"){n(u.arg);return}if(u.kind==="call")for(const o of u.args)n(o)}};return n(i),[...s]}function t(i){return typeof i=="string"&&/^\s*=/.test(i)&&i.trim()!=="="}}),Ue("packages/core/src/formula/evaluate.js",function(e,U){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return w}});const C=U("packages/core/src/formula/parse.js").FormulaError;function q(m){if(m==null||m==="")return 0;if(typeof m=="boolean")return m?1:0;if(m instanceof Date)return m.getTime();const c=typeof m=="number"?m:Number(String(m).replace(/[,\s]/g,""));if(!Number.isFinite(c))throw new C(`${JSON.stringify(m)} is not a number`);return c}function z(m){return m==null?"":String(m)}function B(m){if(typeof m=="boolean")return m;if(m==null||m==="")return!1;if(typeof m=="number")return m!==0;const c=String(m).trim().toLowerCase();return c==="false"||c==="no"||c==="0"?!1:c!==""}function Z(m){const c=[];for(const f of m){if(Array.isArray(f)){for(const l of f)l!=null&&l!==""&&c.push(q(l));continue}f==null||f===""||c.push(q(f))}return c}function K(m,c){const f=10**c,l=m*f;return Math.sign(l)*Math.round(Math.abs(l)+Number.EPSILON*Math.abs(l))/f}function F(m,c){if(!m.length)return 0;const f=m.slice().sort((i,s)=>i-s),l=(f.length-1)*Math.min(1,Math.max(0,c)),r=Math.floor(l),t=Math.ceil(l);return r===t?f[r]:f[r]+(l-r)*(f[t]-f[r])}function X(m,c){let f=0,l=0,r=0;for(const i of m){f++;const s=i-l;l+=s/f,r+=s*(i-l)}const t=c?f-1:f;return t>0?Math.sqrt(r/t):0}const H={SUM:m=>Z(m).reduce((c,f)=>c+f,0),AVERAGE:m=>{const c=Z(m);return c.length?c.reduce((f,l)=>f+l,0)/c.length:0},MIN:m=>{const c=Z(m);return c.length?Math.min(...c):0},MAX:m=>{const c=Z(m);return c.length?Math.max(...c):0},COUNT:m=>Z(m).length,PRODUCT:m=>Z(m).reduce((c,f)=>c*f,1),ROUND:m=>K(q(m[0]),m.length>1?q(m[1]):0),ROUNDDOWN:m=>{const c=10**(m.length>1?q(m[1]):0),f=q(m[0])*c;return(f<0?Math.ceil(f):Math.floor(f))/c},ROUNDUP:m=>{const c=10**(m.length>1?q(m[1]):0),f=q(m[0])*c;return(f<0?Math.floor(f):Math.ceil(f))/c},ABS:m=>Math.abs(q(m[0])),FLOOR:m=>Math.floor(q(m[0])),CEILING:m=>Math.ceil(q(m[0])),SQRT:m=>Math.sqrt(q(m[0])),POWER:m=>q(m[0])**q(m[1]),MOD:m=>{const c=q(m[1]);if(c===0)throw new C("MOD by zero");return(q(m[0])%c+c)%c},IF:m=>B(m[0])?m[1]:m.length>2?m[2]:!1,AND:m=>m.every(B),OR:m=>m.some(B),NOT:m=>!B(m[0]),COALESCE:m=>m.find(c=>c!=null&&c!=="")??null,CONCAT:m=>m.map(z).join(""),LEN:m=>z(m[0]).length,UPPER:m=>z(m[0]).toUpperCase(),LOWER:m=>z(m[0]).toLowerCase(),TRIM:m=>z(m[0]).trim(),LEFT:m=>z(m[0]).slice(0,m.length>1?q(m[1]):1),RIGHT:m=>{const c=m.length>1?q(m[1]):1;return c<=0?"":z(m[0]).slice(-c)},MEDIAN:m=>F(Z(m),.5),PERCENTILE:m=>{const c=q(m[m.length-1]);return F(Z(m.slice(0,-1)),c>1?c/100:c)},QUARTILE1:m=>F(Z(m),.25),QUARTILE3:m=>F(Z(m),.75),STDEV:m=>X(Z(m),!0),STDEVP:m=>X(Z(m),!1),VAR:m=>{const c=X(Z(m),!0);return c*c},VARP:m=>{const c=X(Z(m),!1);return c*c},COUNTDISTINCT:m=>{const c=new Set;for(const f of m){const l=Array.isArray(f)?f:[f];for(const r of l)r!=null&&r!==""&&c.add(r)}return c.size},IQR:m=>{const c=Z(m);return F(c,.75)-F(c,.25)}};H.AVG=H.AVERAGE,H.CEIL=H.CEILING,H.POW=H.POWER,H.STDEVS=H.STDEV,H.PERCENTILEINC=H.PERCENTILE;function j(m,c){const f=Number(m),l=Number(c);if(m!==null&&m!==""&&c!==null&&c!==""&&Number.isFinite(f)&&Number.isFinite(l))return f<l?-1:f>l?1:0;const t=z(m).toLowerCase(),i=z(c).toLowerCase();return t<i?-1:t>i?1:0}function w(m,c={}){const f=typeof c.lookup=="function"?c.lookup:null,l=c.functions?{...H,...c.functions}:H,r=t=>{switch(t.kind){case"num":return t.value;case"str":return t.value;case"ref":{if(!f)throw new C(`there is no column called ${JSON.stringify(t.name)} here`);const i=f(String(t.name));if(i===void 0)throw new C(`there is no column called ${JSON.stringify(t.name)}`);return i}case"unary":{if(t.op==="%")return q(r(t.arg))/100;const i=q(r(t.arg));return t.op==="-"?-i:i}case"bin":{const i=t.op;if(i==="=")return j(r(t.left),r(t.right))===0;if(i==="<>")return j(r(t.left),r(t.right))!==0;if(i==="<")return j(r(t.left),r(t.right))<0;if(i==="<=")return j(r(t.left),r(t.right))<=0;if(i===">")return j(r(t.left),r(t.right))>0;if(i===">=")return j(r(t.left),r(t.right))>=0;const s=q(r(t.left)),n=q(r(t.right));if(i==="+")return s+n;if(i==="-")return s-n;if(i==="*")return s*n;if(i==="^")return s**n;if(i==="/"){if(n===0)throw new C("division by zero");return s/n}throw new C(`unknown operator ${JSON.stringify(i)}`)}case"call":{const i=c.lazy&&c.lazy[t.name];if(typeof i=="function")return i(t.args,r,c);const s=l[t.name];if(typeof s!="function")throw new C(`there is no function called ${t.name}`);return s(t.args.map(r),c)}default:throw new C("the formula could not be read")}};return r(m)}}),Ue("packages/core/src/formula/index.js",function(e,U){"use strict";Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return j}});const te=U("packages/core/src/formula/parse.js"),C=te.parseFormula,q=te.referencesOf,z=te.looksLikeFormula,B=te.FormulaError,Z=te.tokenise,K=U("packages/core/src/formula/evaluate.js"),F=K.evaluateAst,X=K.FUNCTIONS;function H(w){const{grid:m,row:c,data:f}=w||{},l=n=>String(n).toLowerCase().replace(/[\s_-]/g,""),r=m&&m.columns&&typeof m.columns.all=="function"?m.columns.all():[],t=m&&m.permissions,i=t&&typeof t.isReadable=="function"?n=>t.isReadable(n):()=>!0,s=new Set;for(const n of r)i(n)||(s.add(l(n.id)),n.field&&s.add(l(n.field)),n.title&&s.add(l(n.title)));return n=>{const u=l(n);if(s.has(u))throw new B(`"${n}" cannot be read`);for(const o of r)if(l(o.id)===u||o.field&&l(o.field)===u||o.title&&l(o.title)===u)return c&&m.rows&&typeof m.rows.value=="function"?m.rows.value(c.key,o.id):f?f[o.field||o.id]:void 0;if(f&&typeof f=="object"){for(const o of Object.keys(f))if(l(o)===u){if(!i(o))throw new B(`"${n}" cannot be read`);return f[o]}}}}function j(w,m={}){try{const c=C(w);return{ok:!0,value:F(c,{lookup:H(m),functions:m.formulaFunctions}),references:q(c)}}catch(c){return{ok:!1,error:c instanceof B?c.message:"the formula could not be read",at:c instanceof B?c.at:void 0}}}}),Ue("packages/core/src/internal/version.js",function(e,U){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return q}});const te="1.101.4";async function C(){return te}const q="1.101.4"}),Ue("packages/core/src/internal/merge.js",function(e,U){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"mergeRow",{enumerable:!0,get:function(){return K}});const C=U("packages/core/src/internal/predicates.js").isObject;function q(F,X,H){if(F!==void 0)return F===!0?{enabled:!0,...H}:F===!1?{enabled:!1}:C(F)?F:{[X]:F,enabled:!0}}function z(F){return F==null?[]:Array.isArray(F)?F:[F]}const B=Object.freeze(new Set(["__proto__","constructor","prototype"]));function Z(F,X){if(!C(F))return C(X)?{...X}:X;if(!C(X))return X===void 0?F:X;const H={...F};for(const j of Object.keys(X)){if(B.has(j))continue;const w=X[j];w!==void 0&&(H[j]=C(w)&&C(H[j])?Z(H[j],w):w)}return H}function K(F,X){if(!C(F)||!C(X)||F===X)return X;const H=Object.create(Object.getPrototypeOf(F));return Object.assign(H,F,X),H}}),Ue("packages/core/src/internal/schedule.js",function(e,U){"use strict";Object.defineProperty(e,"now",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"nextFrame",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return K}});function te(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const C=typeof requestAnimationFrame=="function";function q(F){return C?requestAnimationFrame(F):setTimeout(()=>F(te()),16)}function z(F){F!=null&&(C?cancelAnimationFrame(F):clearTimeout(F))}function B(F){let X=null,H=null;const j=()=>{X=null;const m=H;H=null,F(...m||[])},w=(...m)=>{H=m,X===null&&(X=q(j))};return w.cancel=()=>{z(X),X=null,H=null},w.flush=()=>{X!==null&&(z(X),j())},w}function Z(F,X){let H=null,j=null;const w=()=>{if(H=null,j===null)return;const f=j;j=null,F(...f),m()},m=()=>{H=setTimeout(w,X),typeof H?.unref=="function"&&H.unref()},c=(...f)=>{H===null?(F(...f),m()):(j=f,clearTimeout(H),m())};return c.flush=()=>{if(H!==null&&clearTimeout(H),H=null,j===null)return;const f=j;j=null,F(...f)},c.cancel=()=>{H!==null&&clearTimeout(H),H=null,j=null},c.pending=()=>H!==null||j!==null,c}function K(F,X=50){return typeof requestIdleCallback=="function"?requestIdleCallback(F,{timeout:X}):setTimeout(()=>F({timeRemaining:()=>0,didTimeout:!0}),1)}}),Ue("packages/core/src/internal/paths.js",function(e,U){"use strict";Object.defineProperty(e,"pathGetter",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"pathSetter",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"getPath",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return Z}});const te=new Map;function C(K){let F=te.get(K);if(F)return F;if(!K.includes("."))F=X=>X?.[K];else{const X=K.split("."),H=X.length;F=j=>{let w=j;for(let m=0;m<H;m++){if(w==null)return;w=w[X[m]]}return w}}return te.set(K,F),F}const q=new Map;function z(K){let F=q.get(K);if(F)return F;if(!K.includes("."))F=(X,H)=>{X!=null&&(X[K]=H)};else{const X=K.split("."),H=X.length-1;F=(j,w)=>{let m=j;for(let c=0;c<H;c++){if(m==null)return;const f=X[c];m[f]==null&&(m[f]={}),m=m[f]}m!=null&&(m[X[H]]=w)}}return q.set(K,F),F}function B(K,F){return C(F)(K)}function Z(K,F,X){z(F)(K,X)}}),Ue("packages/core/src/internal/compare.js",function(e,U){"use strict";Object.defineProperty(e,"collator",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"defaultCompare",{enumerable:!0,get:function(){return q}});const te=new Map;function C(z,B){const Z=`${z||""}|${B?JSON.stringify(B):""}`;let K=te.get(Z);return K||(K=new Intl.Collator(z||void 0,{numeric:!0,sensitivity:"variant",...B}),te.set(Z,K)),K}function q(z,B){if(z===B)return 0;if(z==null)return 1;if(B==null)return-1;if(typeof z=="number"&&typeof B=="number")return Number.isNaN(z)?Number.isNaN(B)?0:1:Number.isNaN(B)||z<B?-1:z>B?1:0;const Z=String(z),K=String(B);return Z<K?-1:Z>K?1:0}}),Ue("packages/core/src/defaults.js",function(e,U){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return j}});const C=U("packages/core/src/internal/predicates.js").isObject,z=U("packages/core/src/internal/merge.js").merge,Z=U("packages/core/src/internal/warn.js").warnOnce;let K=null;class F extends Error{}function X(w,m=new Set){if(Array.isArray(w)){if(m.has(w))throw new F;m.add(w);const f=w.map(l=>X(l,m));return m.delete(w),f}if(!C(w)||Object.getPrototypeOf(w)!==Object.prototype&&Object.getPrototypeOf(w)!==null)return w;if(m.has(w))throw new F;m.add(w);const c={};for(const[f,l]of Object.entries(w))c[f]=X(l,m);return m.delete(w),c}function H(w){if(w===void 0)return X(K??{});if(w===null)return K=null,{};if(!C(w))return Z("defaults:type",`defaults() expects a configuration object, or null to clear it, but got ${Array.isArray(w)?"an array":typeof w}. The call was ignored and the defaults are unchanged.`),X(K??{});try{K=X(w)}catch(m){if(!(m instanceof F))throw m;return Z("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."),X(K??{})}return X(K)}function j(w){return K===null?w:z(X(K),w)}}),Ue("packages/core/src/internal/uid.js",function(e,U){"use strict";Object.defineProperty(e,"uid",{enumerable:!0,get:function(){return C}});let te=0;function C(q="l"){return`${q}${(++te).toString(36)}`}}),Ue("packages/core/src/events/names.js",function(e,U){"use strict";Object.defineProperty(e,"EVENT_NAMES",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isKnownEvent",{enumerable:!0,get:function(){return q}});const te=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","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:menu:open","columns:changed","columns:tagged","columngroup:changed","header: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"]),C=new Set(te);function q(z){return z==="*"||C.has(z)}}),Ue("packages/core/src/events/bus.js",function(e,U){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return f}});const te=U("packages/core/src/internal/warn.js"),C=te.warnOnce,q=te.DEV,B=U("packages/core/src/internal/uid.js").uid,K=U("packages/core/src/events/names.js").isKnownEvent,F="*";function X(l,r){!q||K(r)||C(`bus.unknown:${r}`,`${l}('${r}') 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 H=new Set(["api","user","init","ai"]),j=new WeakMap;function w(l){let r=j.get(l);return r||(r=B("h"),j.set(l,r)),r}function m(){return typeof performance=="object"&&performance?performance.now():Date.now()}function c(l){if(!l||typeof l!="object")return{};const r={};for(const[t,i]of Object.entries(l))t!=="grid"&&(i==null?r[t]=String(i):Array.isArray(i)?r[t]=`[${i.length}]`:typeof i=="object"?r[t]=i.key?`row ${i.key}`:"{…}":typeof i=="function"?r[t]="[function]":r[t]=String(i).slice(0,60));return r}class f{#e=new Map;#t=!1;#n=[];#r=200;#s=new Map;#i=null;#o=!1;#l=0;constructor(r=null){this.#i=r}attach(r){this.#i=r}get grid(){return this.#i}get destroyed(){return this.#o}on(r,t){if(typeof t!="function")return C(`bus.handler:${r}`,`on('${r}') needs a function; ignored.`),()=>{};X("on",r);let i=this.#e.get(r);return i||(i=[],this.#e.set(r,i)),i.push(t),()=>this.off(r,t)}once(r,t){if(typeof t!="function")return C(`bus.handler:${r}`,`once('${r}') needs a function; ignored.`),()=>{};X("once",r);const i=s=>{this.off(r,t),t(s)};return this.#s.set(t,i),this.on(r,i)}off(r,t){if(t===void 0){this.#e.delete(r);return}const i=this.#e.get(r);if(!i)return;const s=this.#s.get(t),n=s&&i.includes(s)?s:t,u=i.indexOf(n);u>=0&&i.splice(u,1),s&&n===s&&this.#s.delete(t),i.length===0&&this.#e.delete(r)}count(r){const t=this.#e.get(r),i=r===F?null:this.#e.get(F);return(t?t.length:0)+(i?i.length:0)}#a(r,t,i,s,n){this.#n.push({type:r,origin:t,listeners:(s?s.length:0)+(n?n.length:0),payload:c(i),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(r,t){this.#t=!!r,Number.isFinite(t)&&t>0&&(this.#r=Math.floor(t)),r||(this.#n=[])}eventLog(){return this.#n.map(r=>({...r}))}clearEventLog(){this.#n=[]}counts(){const r={};for(const[t,i]of this.#e)r[t]=i.length;return r}emit(r,t,i){const s=i??(t&&t.origin),n=H.has(s)?s:"api",u={...t||null,type:r,origin:n,grid:this.#i};if(this.#o)return u;const o=this.#e.get(r),a=r===F?void 0:this.#e.get(F);if(this.#t&&this.#a(r,n,t,o,a),!o&&!a)return u;const h=this.#t?m():0;this.#l++;try{o&&this.#c(o.slice(),u,r),a&&this.#c(a.slice(),u,F)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=m()-h)}return u}emitBefore(r,t,i){const s=i??(t&&t.origin),n=H.has(s)?s:"user";let u=!1,o=null;const a=p=>{u=!0,p!=null&&o===null&&(o=String(p))},h={...t||null,type:r,origin:n,grid:this.#i,get defaultPrevented(){return u},get reason(){return o},preventDefault(p){a(p)}};if(this.#o)return!0;const v=this.#e.get(r);this.#t&&this.#a(r,n,t,v,void 0);const g=v?v.slice():[];if(g.length===0)return!0;const k=()=>(u&&o===null&&(o="prevented"),u&&t&&typeof t=="object"&&(t.reason=o),!u),d=[];for(const p of g)try{const b=p(h);b&&typeof b.then=="function"?d.push(b):b===!1&&a("prevented")}catch(b){a("error"),C(`bus.beforeThrow:${r}:${w(p)}`,`a '${r}' before-handler threw; the action was cancelled.`,b)}return d.length===0?k():Promise.allSettled(d).then(p=>{for(const b of p)b.status==="rejected"?(a("error"),C(`bus.beforeReject:${r}`,`a '${r}' before-handler rejected; the action was cancelled.`,b.reason)):b.value===!1&&a("prevented");return k()})}#c(r,t,i){for(let s=0;s<r.length;s++)try{r[s](t)}catch(n){C(`bus.throw:${i}:${w(r[s])}`,`a '${i}' handler threw; other handlers were unaffected.`,n)}}clear(){this.#e.clear(),this.#s.clear()}destroy(){this.clear(),this.#o=!0,this.#i=null}}}),Ue("packages/core/src/registry/free-tier-notice.js",function(e,U){"use strict";Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return te}});const te="Free for non-commercial use: latticegrid.dev/free"}),Ue("packages/core/src/registry/licence.js",function(e,U){"use strict";Object.defineProperty(e,"PRODUCT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"LICENCE_VERSION",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"fromBase64Url",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"toBase64Url",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"asciiBytes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"parseLicence",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"hasEd25519",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"verifyLicence",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"isLocalHost",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"currentHost",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"matchesDomain",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"LicenceHolder",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setLicence",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return L}});const C=U("packages/core/src/internal/warn.js").warnOnce,q=U("packages/core/src/registry/free-tier-notice.js"),z=q.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return q.FREE_TIER_NOTICE}});const B="lattice-grid",Z=1,K="LG1",F=64,X="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",H="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",j=(()=>{const $=new Int16Array(128).fill(-1);for(let P=0;P<H.length;P++)$[H.charCodeAt(P)]=P;return $[43]=62,$[47]=63,$})();function w($){if(typeof $!="string")return null;let P="";for(let x=0;x<$.length;x++){const W=$.charCodeAt(x);if(W!==61){if(W>127||j[W]<0)return null;P+=$[x]}}const N=P.length;if(N%4===1)return null;const T=new Uint8Array(Math.floor(N*3/4));let E=0,A=0,S=0;for(let x=0;x<N;x++)E=E<<6|j[P.charCodeAt(x)],A+=6,A>=8&&(A-=8,T[S++]=E>>A&255);return S===T.length?T:T.subarray(0,S)}function m($){let P="",N=0;for(;N+2<$.length;N+=3){const E=$[N]<<16|$[N+1]<<8|$[N+2];P+=H[E>>18&63]+H[E>>12&63]+H[E>>6&63]+H[E&63]}const T=$.length-N;if(T===1){const E=$[N]<<16;P+=H[E>>18&63]+H[E>>12&63]}else if(T===2){const E=$[N]<<16|$[N+1]<<8;P+=H[E>>18&63]+H[E>>12&63]+H[E>>6&63]}return P}function c($){const P=new Uint8Array($.length);for(let N=0;N<$.length;N++)P[N]=$.charCodeAt(N)&127;return P}function f($){if(typeof TextDecoder=="function")return new TextDecoder().decode($);let P="";for(let N=0;N<$.length;N++)P+=String.fromCharCode($[N]);return P}function l($){const P={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof $=="string"?$:""};if(typeof $!="string"||$.length===0)return{...P,reason:"missing"};const N=$.trim(),T=N.split(".");if(T.length!==3)return P;const[E,A,S]=T;if(E!==K)return{...P,reason:"prefix"};const x=w(A),W=w(S);if(!x||!W)return P;let V;try{V=JSON.parse(f(x))}catch{return P}return V===null||typeof V!="object"?P:{ok:!0,reason:null,product:typeof V.p=="string"?V.p:null,issuedTo:typeof V.t=="string"?V.t:null,expires:typeof V.e=="string"?V.e:null,terms:typeof V.terms=="string"?V.terms:null,features:Array.isArray(V.f)?V.f.slice():[],deployments:Array.isArray(V.d)?V.d.slice():[],version:typeof V.v=="number"?V.v:0,message:c(A),signature:W,raw:N}}function r($,P){if(!$)return!1;const N=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test($)?`${$}T23:59:59.999Z`:$);return Number.isNaN(N)?!0:P>N}function t($){return $==="non-commercial"?"non-commercial":"commercial"}let i=null,s=null,n=null;function u(){const $=globalThis.crypto;return $&&$.subtle?$.subtle:null}async function o($){if(i&&s===$)return i;const P=u();if(!P)return null;const N=w($);if(!N)return null;try{const T=await P.importKey("raw",N,{name:"Ed25519"},!1,["verify"]);return i=T,s=$,T}catch{return null}}async function a(){return n!==null||(n=await o(X)!==null),n}async function h($,P={}){const N=P.warn!==!1,T=P.product||B,E=P.publicKey||X,A=P.now??Date.now(),S=P.host??g(),x=v(S)?"":` ${z}`,W=l($);if(!W.ok){const ne=W.reason==="missing"?"missing":"malformed";return N&&C(`licence.${ne}`,ne==="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:ne,terms:"commercial"}}const V={product:W.product||void 0,issuedTo:W.issuedTo||void 0,expires:W.expires||void 0,terms:t(W.terms)};if(W.product!==T)return N&&C("licence.product",`licence key is for '${W.product}', not '${T}'. The grid will render with a watermark.`),{valid:!1,...V,reason:"product"};if(r(W.expires,A))return N&&C("licence.expired",`licence expired on ${W.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,...V,reason:"expired"};const G=W.deployments||[];if(G.length&&S&&!v(S)&&!k(S,G))return N&&C("licence.domain",`licence key is not valid for ${S}; it covers ${G.join(", ")}. The grid will render with a watermark.`),{valid:!1,...V,reason:"domain"};const Q=await o(E);if(!Q){const ne=!!W.signature&&W.signature.length===F;return N&&C("licence.algorithm","this host does not provide crypto.subtle Ed25519, so the licence signature could not be verified. A structural check was used instead."),ne?{valid:!0,...V,reason:"unverified"}:{valid:!1,...V,reason:"signature"}}let ee=!1;try{ee=await u().verify({name:"Ed25519"},Q,W.signature,W.message)}catch{ee=!1}return ee?{valid:!0,...V}:(N&&C("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...V,reason:"signature"})}function v($){const P=String($??g()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!P||P==="localhost"||P.endsWith(".localhost")||P==="::1"||P==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(P)}function g(){const $=globalThis.location;return $&&typeof $.hostname=="string"?$.hostname:null}function k($,P){const N=d($);return!N||!Array.isArray(P)?!1:P.some(T=>{const E=d(T);if(!E)return!1;if(E==="*")return!0;if(E.startsWith("*.")){const A=E.slice(2);return N===A||N.endsWith(`.${A}`)}return N===E})}function d($){return String($??"").trim().toLowerCase().replace(/\.$/,"")}class p{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#s;#i=new Set;constructor(P={}){this.#s=P}set(P){this.#e=typeof P=="string"?P.trim():"";const N=l(this.#e);return this.#t=N.ok?{valid:!r(N.expires,Date.now())&&N.product===(this.#s.product||B),product:N.product||void 0,issuedTo:N.issuedTo||void 0,expires:N.expires||void 0,terms:t(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 P=this.#e;return this.#n=h(P,this.#s).then(N=>{if(this.#e===P){this.#t=N;for(const T of this.#i)T(N)}return N}),this.#n}onSettled(P){return this.#i.add(P),()=>this.#i.delete(P)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!v(this.#r)}setHost(P){this.#r=P}state(){return this.#t.valid?"licensed":v(this.#r)?"localhost":"trial"}reset(){this.#e="",this.#t={valid:!1,reason:"missing",terms:"commercial"},this.#n=null,this.#i.clear()}}const b=Symbol.for("lattice-grid/licence/holder");function O(){const $=globalThis,P=$&&$[b];if(P&&typeof P.set=="function"&&typeof P.watermark=="function")return P;const N=new p;if($)try{$[b]=N}catch{}return N}const y=O();function M($){return y.set($)}function D(){return y.info()}function _(){return y.watermark()}function I(){return y.state()}function L(){return y}}),Ue("packages/core/src/registry/registry.js",function(e,U){"use strict";Object.defineProperty(e,"KINDS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"REGIONS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return i}});const te=U("packages/core/src/internal/warn.js"),C=te.warnOnce,q=te.DEV,B=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/registry/licence.js"),K=Z.LicenceHolder,F=Z.sharedLicence,X=["renderer","editor","filter","dataType","totalFn","pipe","component"],H=["all","header","body","totals","panels"];class j{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#s;#i=null;#o=null;#l=new Set;#a=new Map;constructor(n={}){for(const u of X)this.#t.set(u,new Map);this.#s=n.holder||F(),this.#o=n.grid??null,this.#i=this.#s.onSettled(()=>{this.#d({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),n.licence&&this.setLicence(n.licence)}registerModules(n,u={}){u.licence&&this.setLicence(u.licence),u.grid!==void 0&&(this.#o=u.grid);const o=Array.isArray(n)?n:[n],a=[];for(const h of o){if(!h||typeof h!="object"||typeof h.name!="string"||!h.name){C("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(h.name)){q&&this.#u(this.#e.get(h.name),h);continue}if(!B(h.install)){C(`registry.module.install:${h.name}`,`module '${h.name}' has no install() and was ignored.`);continue}const v={registry:this,grid:this.#o};try{h.install(v)}catch(g){C(`registry.module.throw:${h.name}`,`module '${h.name}' threw during install; it was not registered.`,g);continue}this.#e.set(h.name,h);for(const g of w(h))this.#n.add(g);a.push(h.name),this.#d({reason:"module",name:h.name,capabilities:this.capabilities(),regions:f(h)})}return a}unregisterModule(n){const u=this.#e.get(n);if(!u)return!1;if(B(u.uninstall))try{u.uninstall({registry:this,grid:this.#o})}catch(o){C(`registry.module.uninstall:${n}`,`module '${n}' threw during uninstall.`,o)}return this.#e.delete(n),this.#c(),this.#d({reason:"unmodule",name:n,capabilities:this.capabilities(),regions:f(u)}),!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 u of w(n))this.#n.add(u)}#u(n,u){!n||n===u||m(n,u)||C(`registry.module.reconfigure:${u.name}`,`module '${u.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 B(n)?(this.#r.add(n),this.#a.set(n,this.#o),()=>{this.#r.delete(n),this.#a.delete(n)}):()=>{}}#d(n){for(const u of[...this.#r])try{u(n)}catch(o){C("registry.onChange.throw","a registry change handler threw.",o)}}register(n,u,o){const a=this.#t.get(n);if(!a){C(`registry.kind:${n}`,`unknown registry kind '${n}'; expected one of ${X.join(", ")}.`);return}if(!u||typeof u!="string"){C(`registry.name:${n}`,`register('${n}', ...) needs a name.`);return}a.has(u)&&a.get(u)!==o&&C(`registry.replace:${n}:${u}`,`'${u}' was already registered as a ${n} and has been replaced.`),a.set(u,o),this.#d({reason:"register",name:u,kind:n,capabilities:this.capabilities(),regions:l(n)})}registerAll(n,u){if(u)for(const o of Object.keys(u))this.register(n,o,u[o])}get(n,u){const o=this.#t.get(n);return o?o.get(u):void 0}names(n){const u=this.#t.get(n);return u?[...u.keys()]:[]}#f(n,u){const o=this.#t.get(n).get(u);return o!==void 0?o:this.#t.get("component").get(u)}renderer(n){return this.#f("renderer",n)}editor(n){return this.#f("editor",n)}filter(n){return this.#f("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.#s.set(n)}licence(){return this.#s.info()}licenceVerified(){return this.#s.verify()}watermark(){return this.#s.watermark()}attach(n){n!=null&&(this.#l.add(n),this.#o=n)}detach(n){if(n!=null){this.#l.delete(n);for(const[u,o]of[...this.#a])o===n&&(this.#r.delete(u),this.#a.delete(u));if(this.#o===n){const u=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#o=u}this.#l.size===0&&this.#i&&(this.#i(),this.#i=null)}}destroy(n){if(n!=null){this.detach(n);return}for(const u of[...this.#e.keys()])this.unregisterModule(u);this.#r.clear(),this.#a.clear(),this.#l.clear(),this.#i&&this.#i(),this.#i=null,this.#o=null}}function w(s){const n=s.capabilities,u=Array.isArray(n)?n.filter(o=>typeof o=="string"):[];return[s.name,...u]}function m(s,n){return s.install!==n.install||s.uninstall!==n.uninstall||(s.version||"")!==(n.version||"")?!1:c(w(s),w(n))&&c(f(s),f(n))}function c(s,n){const u=new Set(s),o=new Set(n);if(u.size!==o.size)return!1;for(const a of u)if(!o.has(a))return!1;return!0}function f(s){const n=s.regions;return!Array.isArray(n)||n.length===0?["all"]:n.filter(u=>H.includes(u))}function l(s){switch(s){case"filter":return["header"];case"totalFn":return["totals"];case"renderer":case"editor":case"pipe":return["body"];default:return["all"]}}const r=new j;function t(){return r}function i(s,n={}){return r.registerModules(s,n)}}),Ue("packages/core/src/internal/text.js",function(e,U){"use strict";Object.defineProperty(e,"humanise",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"escapeHtml",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return z}});function te(B){return B?(B.includes(".")?B.slice(B.lastIndexOf(".")+1):B).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(/^./,K=>K.toUpperCase()):""}const C={"&":"&","<":"<",">":">",'"':""","'":"'"};function q(B){const Z=B==null?"":String(B);return/[&<>"']/.test(Z)?Z.replace(/[&<>"']/g,K=>C[K]):Z}function z(B){return String(B).replace(/\w\S*/g,Z=>Z[0].toUpperCase()+Z.slice(1).toLowerCase())}}),Ue("packages/core/src/format/mask.js",function(e,U){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return Z}});const te=new Set(["0","#","?",",","."]),C="\0";function q(F){const X=[];let H="",j=!1;for(let w=0;w<F.length;w++){const m=F[w];if(m==="\\"){H+=m+(F[w+1]??""),w+=1;continue}if(m==='"'){j=!j,H+=m;continue}if(m===";"&&!j){X.push(H),H="";continue}H+=m}return X.push(H),X}function z(F){let X="",H="",j="",w=1,m=!1,c=!1;const f=a=>{c?H+=a:X+=a};for(let a=0;a<F.length;a++){const h=F[a];if(h==="\\"){f(F[a+1]??""),a+=1;continue}if(h==='"'){const v=F.indexOf('"',a+1);f(v===-1?F.slice(a+1):F.slice(a+1,v)),a=v===-1?F.length:v;continue}if(h==="%"){w*=100,f("%");continue}if(h==="@"){m=!0,f("\0");continue}if(te.has(h)){j+=h,c=!0;continue}f(h)}let l=-1;for(let a=j.length-1;a>=0;a--){const h=j[a];if(h==="0"||h==="#"||h==="?"){l=a;break}}let r=!1,t="";for(let a=0;a<j.length;a++){const h=j[a];if(h===","){a>l?w/=1e3:r=!0;continue}t+=h}const i=t.indexOf("."),s=i===-1?t:t.slice(0,i),n=i===-1?"":t.slice(i+1);let u=0;for(const a of s)a==="0"&&(u+=1);let o=0;for(const a of n)a==="0"&&(o+=1);return{prefix:X,suffix:H,minInt:u,minDec:o,maxDec:n.length,grouping:r,scale:w,hasNumber:l!==-1,isText:m}}function B(F,X){const H=new Intl.NumberFormat(X,{minimumIntegerDigits:Math.max(F.minInt,1),minimumFractionDigits:F.minDec,maximumFractionDigits:Math.max(F.maxDec,F.minDec),useGrouping:F.grouping}),{prefix:j,suffix:w,scale:m,hasNumber:c}=F;return f=>{if(!c)return j+w;const l=m===1?f:f*m;return j+H.format(l)+w}}function Z(F,X){const j=q(String(F)).map(z),w=j.map(t=>B(t,X)),m=0,c=j.length>1?1:-1,f=j.length>2?2:-1,l=j.length>3?3:-1,r=t=>{if(t==null||t==="")return"";if(typeof t!="number"||Number.isNaN(t)){const i=Number(t);if(Number.isNaN(i))return l===-1?String(t):(j[l].prefix+j[l].suffix).split("\0").join(String(t));t=i}return t===0&&f!==-1?w[f](0):t<0&&c!==-1?w[c](-t):w[m](t)};return r.spec={mask:F},{format:r,ooxml:K(String(F))}}function K(F){return F.trim()}}),Ue("packages/core/src/format/pattern.js",function(e,U){"use strict";Object.defineProperty(e,"parseNumberPattern",{enumerable:!0,get:function(){return B}});const C=U("packages/core/src/format/mask.js").splitSections;function q(Z){let K="",F="",X="",H="",j=!1,w=!1,m=!1,c=!1;const f=r=>{m?F+=r:K+=r};for(let r=0;r<Z.length;r++){const t=Z[r];if(t==="\\"){f(Z[r+1]??""),r+=1;continue}if(t==='"'){const i=Z.indexOf('"',r+1);f(i===-1?Z.slice(r+1):Z.slice(r+1,i)),r=i===-1?Z.length:i;continue}if(t==="%"){w=!0;continue}if(t==="0"||t==="#"){m=!0,c?H+=t:X+=t;continue}if(t===","){c||(j=!0);continue}if(t==="."&&!c){c=!0;continue}f(t)}if(!m)return{hasDigit:!1,prefix:K,suffix:F,minDec:0,maxDec:0,grouping:!1,percent:w};let l=0;for(const r of H)r==="0"&&(l+=1);return{hasDigit:!0,prefix:K,suffix:F,minDec:l,maxDec:H.length,grouping:j,percent:w}}function z(Z,K){const F=K.trim(),X=Z.trim();return F.startsWith("(")&&F.endsWith(")")&&F.slice(1,-1).trim()===X?"parentheses":F.endsWith("-")?"suffix":"minus"}function B(Z){if(typeof Z!="string")return null;const K=C(Z);if(K.length===0)return null;const F=q(K[0]);if(!F.hasDigit)return null;const X={style:F.percent?"percent":"decimal",prefix:F.prefix,suffix:F.suffix,minDecimals:F.minDec,maxDecimals:Math.max(F.maxDec,F.minDec),thousandsSeparator:F.grouping?void 0:!1};if(K.length>1&&(X.negative=z(K[0],K[1])),K.length>2){const H=q(K[2]);H.hasDigit||(X.zeroDisplay=H.prefix+H.suffix)}return X}}),Ue("packages/core/src/format/number.js",function(e,U){"use strict";Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return K}});const C=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/warn.js").warnOnce,Z=U("packages/core/src/format/pattern.js").parseNumberPattern;function K(F,X){const H=typeof F=="string"?{pattern:F}:F||{};let j=H;if(typeof H.pattern=="string"){const O=Z(H.pattern);if(O){const{pattern:y,...M}=H;j={...O,...M}}else z(`format:pattern:${H.pattern}`,`invalid number format pattern "${H.pattern}"; the value will use the default number format`)}const w=j.locale||X||void 0,m=j.style||"decimal",c=typeof j.scale=="number"?j.scale:1,f=j.nullDisplay??"",l=j.zeroDisplay,r=j.prefix||"",t=j.suffix||"",i=j.negative||"minus",s=j.signed===!0,n={style:m,notation:j.notation||"standard"};m==="currency"&&(n.currency=j.currency||"USD",j.currencyDisplay&&(n.currencyDisplay=j.currencyDisplay)),typeof j.decimals=="number"?(n.minimumFractionDigits=j.decimals,n.maximumFractionDigits=j.decimals):(typeof j.minDecimals=="number"&&(n.minimumFractionDigits=j.minDecimals),typeof j.maxDecimals=="number"&&(n.maximumFractionDigits=j.maxDecimals),n.minimumFractionDigits>(n.maximumFractionDigits??20)&&(n.maximumFractionDigits=n.minimumFractionDigits)),j.thousandsSeparator===!1&&(n.useGrouping=!1),n.notation==="compact"&&(n.compactDisplay=j.compactDisplay||"short");const u=new Intl.NumberFormat(w,n),o=typeof j.thousandsSeparator=="string"?j.thousandsSeparator:null,a=typeof j.decimalSeparator=="string"?j.decimalSeparator:null;let h=",",v=".";if(o||a)for(const O of u.formatToParts(12345.6))O.type==="group"?h=O.value:O.type==="decimal"&&(v=O.value);const g=O=>{let y=O;return o&&(y=y.split(h).join("")),a&&(y=y.split(v).join("")),o&&(y=y.split("").join(o)),a&&(y=y.split("").join(a)),y},k=!!(o||a),d=r!==""&&m==="currency",p=O=>{let y;if(d){const M=u.formatToParts(O);let D=!1;y="";for(const _ of M)y+=_.value,!D&&_.type==="currency"&&(y+=r,D=!0);D||(y=r+y)}else y=r+u.format(O);return k&&(y=g(y)),y+t},b=O=>{if(C(O)||O==="")return f;const y=typeof O=="number"?O:Number(O);if(Number.isNaN(y))return f;const M=c===1?y:y*c;return M===0&&l!==void 0?l:M<0?i==="parentheses"?`(${p(-M)})`:i==="suffix"?`${p(-M)}-`:p(M):s&&M>0?`+${p(M)}`:p(M)};return b.negativeClass=j.negativeClass||null,b.spec=j,b}}),Ue("packages/core/src/format/date.js",function(e,U){"use strict";Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return t}});const C=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/warn.js").warnOnce,B=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function Z(i){const s=[];let n=0,u="";const o=()=>{u&&(s.push({token:null,text:u}),u="")};for(;n<i.length;){const a=i[n];if(a==="'"){if(i[n+1]==="'"){u+="'",n+=2;continue}const v=i.indexOf("'",n+1);if(v===-1){u+=i.slice(n+1),n=i.length;continue}u+=i.slice(n+1,v),n=v+1;continue}const h=B.find(v=>i.startsWith(v,n));if(h){o(),s.push({token:h,text:h}),n+=h.length;continue}/[A-Za-z]/.test(a)&&z(`date.pattern.token:${a}`,`the date pattern "${i}" contains '${a}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${B.join(" ")}.`),u+=a,n+=1}return o(),s}const K=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function F(i){if(C(i)||i==="")return null;if(i instanceof Date)return Number.isNaN(i.getTime())?null:i;if(typeof i=="number")return Number.isNaN(i)?null:new Date(i);if(typeof i=="string"){const s=K.exec(i.trim());if(s){const[,u,o,a,h="0",v="0",g="0"]=s;return new Date(+u,+o-1,+a,+h,+v,+g)}const n=new Date(i);return Number.isNaN(n.getTime())?null:n}return null}function X(i,s){return String(i).padStart(s,"0")}function H(i){if(!i)return u=>({year:u.getFullYear(),month:u.getMonth()+1,day:u.getDate(),hour:u.getHours(),minute:u.getMinutes(),second:u.getSeconds(),ms:u.getMilliseconds(),weekday:u.getDay()});const s=new Intl.DateTimeFormat("en-US",{timeZone:i,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 u=>{const o={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:u.getMilliseconds(),weekday:0};for(const a of s.formatToParts(u))switch(a.type){case"year":o.year=Number(a.value);break;case"month":o.month=Number(a.value);break;case"day":o.day=Number(a.value);break;case"hour":o.hour=Number(a.value)%24;break;case"minute":o.minute=Number(a.value);break;case"second":o.second=Number(a.value);break;case"weekday":o.weekday=n[a.value]??0;break;default:break}return o}}function j(i,s,n){const u=Z(i),o=H(n),a=new Set(u.filter(d=>d.token).map(d=>d.token)),h=a.has("MMM")?new Intl.DateTimeFormat(s,{month:"short",timeZone:n}):null,v=a.has("MMMM")?new Intl.DateTimeFormat(s,{month:"long",timeZone:n}):null,g=a.has("EEE")?new Intl.DateTimeFormat(s,{weekday:"short",timeZone:n}):null,k=a.has("EEEE")?new Intl.DateTimeFormat(s,{weekday:"long",timeZone:n}):null;return d=>{const p=o(d);let b="";for(const O of u){if(!O.token){b+=O.text;continue}switch(O.token){case"yyyy":b+=X(p.year,4);break;case"yy":b+=X(p.year%100,2);break;case"MMMM":b+=v.format(d);break;case"MMM":b+=h.format(d);break;case"MM":b+=X(p.month,2);break;case"M":b+=String(p.month);break;case"dd":b+=X(p.day,2);break;case"d":b+=String(p.day);break;case"EEEE":b+=k.format(d);break;case"EEE":b+=g.format(d);break;case"HH":b+=X(p.hour,2);break;case"H":b+=String(p.hour);break;case"hh":b+=X(p.hour%12===0?12:p.hour%12,2);break;case"h":b+=String(p.hour%12===0?12:p.hour%12);break;case"mm":b+=X(p.minute,2);break;case"m":b+=String(p.minute);break;case"ss":b+=X(p.second,2);break;case"s":b+=String(p.second);break;case"SSS":b+=X(p.ms,3);break;case"a":b+=p.hour<12?"AM":"PM";break;default:b+=O.text;break}}return b}}const w=[["year",365*24*36e5],["month",720*36e5],["week",168*36e5],["day",24*36e5],["hour",36e5],["minute",6e4],["second",1e3]];function m(i,s){const n=i||{},u=n.locale||s||void 0,o=n.nullDisplay??"",a=n.timeZone;let h;if(n.pattern)h=j(n.pattern,u,a);else if(n.dateStyle||n.timeStyle){const p={timeZone:a};n.dateStyle&&(p.dateStyle=n.dateStyle),n.timeStyle&&(p.timeStyle=n.timeStyle);const b=new Intl.DateTimeFormat(u,p);h=O=>b.format(O)}else{const p=new Intl.DateTimeFormat(u,{dateStyle:"medium",timeZone:a});h=b=>p.format(b)}const v=n.relative?new Intl.RelativeTimeFormat(u,{numeric:"auto"}):null,k=(typeof n.relative=="object"&&n.relative?n.relative.threshold??7:7)*24*36e5,d=(p,b)=>{const O=F(p);if(!O)return o;if(v){const y=b&&typeof b.now=="number"?b.now:Date.now(),M=O.getTime()-y;if(Math.abs(M)<k){for(const[D,_]of w)if(Math.abs(M)>=_||D==="second")return v.format(Math.round(M/_),D)}}return h(O)};return d.spec=n,d}function c(i){if(C(i)||i==="")return null;if(typeof i=="string"){const u=/^(\d{4}-\d{2}-\d{2})/.exec(i.trim());if(u)return u[1];const o=F(i);return o?c(o):null}const s=F(i);if(!s)return null;const n=u=>String(u).padStart(2,"0");return`${s.getFullYear()}-${n(s.getMonth()+1)}-${n(s.getDate())}`}function f(i,s){if(C(i)||i==="")return null;if(typeof i=="string"){const u=i.trim();if(l.test(u)){const h=F(u);return h?r(h,s):null}const o=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(u);if(o){const[,h,v,g,k]=o;return`${h}T${v}:${g}${k&&k!=="00"?`:${k}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(u))return`${u}T00:00`;const a=F(u);return a?f(a):null}const n=F(i);return n?r(n,s):null}const l=/(?:Z|[+-]\d{2}:?\d{2})$/i;function r(i,s){const n=h=>String(h).padStart(2,"0");if(s)try{const h=new Intl.DateTimeFormat("en-CA",{timeZone:s,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(i).reduce((k,d)=>(d.type!=="literal"&&(k[d.type]=d.value),k),{}),v=h.hour==="24"?"00":h.hour,g=Number(h.second);return`${h.year}-${h.month}-${h.day}T${v}:${h.minute}`+(g?`:${h.second}`:"")}catch{}const u=`${i.getFullYear()}-${n(i.getMonth()+1)}-${n(i.getDate())}`,o=i.getSeconds(),a=`${n(i.getHours())}:${n(i.getMinutes())}${o?`:${n(o)}`:""}`;return`${u}T${a}`}function t(i,s){const n=C(i)||i===""?null:String(i),u=C(s)||s===""?null:String(s);return n===null?u===null?0:1:u===null||n<u?-1:n>u?1:0}}),Ue("packages/core/src/format/boolean.js",function(e,U){"use strict";Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return Z}});const C=U("packages/core/src/internal/predicates.js").isNil,q={true:"☑",false:"☐",null:""},z={true:"◉",false:"◯",null:""};function B(K){if(C(K)||K==="")return null;if(typeof K=="boolean")return K;if(typeof K=="number")return K!==0;const F=String(K).trim().toLowerCase();return F==="true"||F==="yes"||F==="y"||F==="1"?!0:F==="false"||F==="no"||F==="n"||F==="0"?!1:null}function Z(K,F){const X=K||{},H=X.display||"text",j=X.trueLabel??"Yes",w=X.falseLabel??"No",m=X.nullLabel??"";let c=j,f=w;const l=m;H==="checkbox"?(c=q.true,f=q.false):H==="switch"?(c=z.true,f=z.false):H==="icon"&&(c=X.trueIcon??j,f=X.falseIcon??w);const r=t=>{const i=B(t);return i===null?l:i?c:f};return r.display=H,r.labels={true:j,false:w,null:m},r.locale=F,r.spec=X,r}}),Ue("packages/core/src/format/text.js",function(e,U){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return B}});const C=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/text.js").titleCase;function B(Z,K){const F=Z||{},X=F.locale||K||void 0,H=F.nullDisplay??"",j=F.emptyDisplay??"",w=F.transform||"none",m=typeof F.truncate=="number"?{chars:F.truncate}:F.truncate||null,c=m?m.chars:0,f=m?m.ellipsis??"…":"",l=t=>{switch(w){case"upper":return X?t.toLocaleUpperCase(X):t.toUpperCase();case"lower":return X?t.toLocaleLowerCase(X):t.toLowerCase();case"title":return z(t);default:return t}},r=t=>{if(C(t))return H;let i=typeof t=="string"?t:String(t);return i===""?j:(w!=="none"&&(i=l(i)),c>0&&i.length>c&&(i=i.slice(0,c)+f),i)};return r.spec=F,r}}),Ue("packages/core/src/format/shorthand.js",function(e,U){"use strict";Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return K}});const te=["currency","number","percent","date","boolean","text","relative"],C=/[#0?@;"\\]/,q=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function z(F){return typeof F!="string"||F===""||Z(F)?!1:C.test(F)}function B(F){return typeof F!="string"||F===""||Z(F)?!1:q.test(F)}function Z(F){const X=F.indexOf(":"),H=X===-1?F:F.slice(0,X);return te.includes(H)?H:null}function K(F){const X=Z(F);if(!X)return null;const H=F.indexOf(":"),j=H===-1?"":F.slice(H+1),w=j===""?[]:j.split(":");switch(X){case"currency":{const m={type:"number",style:"currency",currency:w[0]||"USD"};return w[1]!==void 0&&w[1]!==""&&(m.decimals=Number(w[1])),m}case"number":{const m={type:"number",style:"decimal"};return w[0]!==void 0&&w[0]!==""&&(m.decimals=Number(w[0])),m}case"percent":{const m={type:"number",style:"percent"};return w[0]!==void 0&&w[0]!==""&&(m.decimals=Number(w[0])),m}case"date":return{type:"date",pattern:j||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const m=j.split("/"),c={type:"boolean",display:"text"};return m[0]!==void 0&&m[0]!==""&&(c.trueLabel=m[0]),m[1]!==void 0&&m[1]!==""&&(c.falseLabel=m[1]),m[2]!==void 0&&(c.nullLabel=m[2]),c}case"text":{const m={type:"text"};return w[0]&&(m.transform=w[0]),w[1]!==void 0&&w[1]!==""&&(m.truncate=Number(w[1])),m}default:return null}}}),Ue("packages/core/src/format/index.js",function(e,U){"use strict";Object.defineProperty(e,"compileFormat",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"specToOoxml",{enumerable:!0,get:function(){return y}});const te=U("packages/core/src/internal/predicates.js"),C=te.isFunction,q=te.isObject,B=U("packages/core/src/internal/warn.js").warnOnce,Z=U("packages/core/src/format/number.js"),K=Z.compileNumber,F=U("packages/core/src/format/date.js"),X=F.compileDate,H=F.scanPattern,j=U("packages/core/src/format/boolean.js"),w=j.compileBoolean,m=U("packages/core/src/format/text.js"),c=m.compileText,f=U("packages/core/src/format/mask.js"),l=f.compileMask,r=U("packages/core/src/format/shorthand.js"),t=r.parseShorthand,i=r.looksLikeMask,s=r.looksLikeDatePattern,u=U("packages/core/src/format/pattern.js").parseNumberPattern;Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return Z.compileNumber}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return F.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return F.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return F.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return F.toDate}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return j.compileBoolean}}),Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return j.toTriState}}),Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return m.compileText}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return f.compileMask}}),Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return f.splitSections}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return f.parseSection}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return r.parseShorthand}}),Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return r.looksLikeMask}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return r.looksLikeDatePattern}});const o=new Set(["decimal","currency","percent","unit"]),a=new Set(["type","locale"]),h={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"])},v=new Set(["number","date","boolean","text"]);function g(I,L){const $=I.type;if($===void 0||v.has($)||!o.has(String($)))return;const P=L?`"${L}"`:"with no id";B(`format:unknown-style-key:${L||""}:${$}`,`column ${P} has format: { type: "${$}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${$}" instead?`)}function k(I,L,$){const P=h[L],N=$?`"${$}"`:"with no id";for(const T of I){if(a.has(T)||P.has(T))continue;const E=Object.keys(h).find(A=>A!==L&&h[A].has(T));E?B(`format:inapplicable:${$||""}:${T}`,`column ${N} has format key "${T}", which applies to a ${E} column, not the ${L} column it was applied to; it is ignored.`):B(`format:unknown:${$||""}:${T}`,`column ${N} has an unrecognised format key "${T}" for its ${L} format; it is ignored.`)}}function d(I){if(I.type==="number"||I.type==="date"||I.type==="boolean"||I.type==="text")return!0;const L=o.has(String(I.style));return!!(I.pattern||I.dateStyle||I.timeStyle||I.relative||I.timeZone||I.trueLabel||I.falseLabel||I.display||I.trueIcon||I.falseIcon||I.transform||I.truncate||I.emptyDisplay||L||I.currency||I.decimals!==void 0||I.minDecimals!==void 0||I.maxDecimals!==void 0||I.notation||I.negative||I.scale!==void 0||I.prefix||I.suffix||I.zeroDisplay!==void 0)}function p(I,L){if(I.type==="number"||I.type==="date"||I.type==="boolean"||I.type==="text")return I.type;if(I.pattern){if(i(I.pattern))return"number";if(s(I.pattern))return"date"}if(I.dateStyle||I.timeStyle||I.relative||I.timeZone)return"date";if(I.trueLabel||I.falseLabel||I.display||I.trueIcon||I.falseIcon)return"boolean";if(I.transform||I.truncate||I.emptyDisplay)return"text";if(I.style||I.currency||I.decimals!==void 0||I.minDecimals!==void 0||I.maxDecimals!==void 0||I.notation||I.negative||I.scale!==void 0||I.prefix||I.suffix||I.zeroDisplay!==void 0)return"number";const $=L&&L.base;return $==="number"?"number":$==="date"||$==="dateString"?"date":$==="boolean"?"boolean":"text"}function b(I,L=null,$=void 0,P=void 0,N=void 0){if(I==null||I==="")return null;const T=q(I)?Object.keys(I):null;if(typeof I=="function"){const S=(x,W)=>String(I({...W||{},value:x,locale:$})??"");return S.ooxml=L&&L.excel||"General",S}if(typeof I=="string"){if(i(I)){const{format:x,ooxml:W}=l(I,$);return x.ooxml=W,x}const S=t(I)||(s(I)?{type:"date",pattern:I}:null);return S?b(S,L,$,P,N):(B(`format:${I}`,`unrecognised format string "${I}"; the value will be stringified`),null)}if(!q(I))return B("format:shape","format must be a spec object or a string; ignoring",I),null;if(L&&C(L.format)&&!d(I)||L&&C(L.format)&&Array.isArray(L.formatPatterns)&&I.type===void 0)return null;const E=p(I,L);E==="date"&&P&&I.timeZone===void 0&&(I={...I,timeZone:P}),g(I,N),k(T||Object.keys(I),E,N);let A;switch(E){case"number":A=K(I,$);break;case"date":A=X(I,$);break;case"boolean":A=w(I,$);break;default:A=c(I,$);break}return A.ooxml=y(I,E,$,L),A.kind=E,A}const O={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 y(I,L,$=void 0,P=null){if(L==="date"){if(I.pattern){let S="";for(const x of H(I.pattern))S+=x.token?O[x.token]??x.text:x.text;return S}return P&&P.excel||"yyyy-mm-dd"}if(L==="boolean")return"General";if(L==="text")return"@";if(typeof I.pattern=="string"&&u(I.pattern))return String(I.pattern).trim();if(I.notation==="compact"||I.notation==="scientific")return"General";const N=typeof I.decimals=="number"?I.decimals:typeof I.minDecimals=="number"?I.minDecimals:I.style==="currency"?2:0;let E=`${I.thousandsSeparator===!1?"":"#,#"}#0${N>0?`.${"0".repeat(N)}`:""}`,A="";return I.style==="currency"&&(A+=M(_(I.currency||"USD",$))),I.prefix&&(A+=M(I.prefix)),E=A+E,I.style==="percent"&&(E=`${E}%`),I.suffix&&(E+=M(I.suffix)),I.negative==="parentheses"?`${E};(${E})`:I.negative==="suffix"?`${E};${E}-`:E}function M(I){return`"${String(I).split('"').join("")}"`}const D=new Map;function _(I,L){const $=`${I}|${L||""}`;let P=D.get($);if(P!==void 0)return P;P=I;try{const T=new Intl.NumberFormat(L,{style:"currency",currency:I}).formatToParts(0).find(E=>E.type==="currency");T&&(P=T.value)}catch{}return D.set($,P),P}}),Ue("packages/core/src/columns/types/temporal.js",function(e,U){"use strict";Object.defineProperty(e,"MS_SECOND",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"MS_MINUTE",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"MS_HOUR",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MS_DAY",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"MS_WEEK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"toTimeMs",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"zonedParts",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"zoneOffsetAt",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"instantFromParts",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"toEpochMs",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"toDurationMs",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"resolveZoneName",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"zoneLabel",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(e,"formatInstant",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(e,"timestampGroupProjector",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"TEMPORAL_INFERENCE_ORDER",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Ve}});const te=U("packages/core/src/internal/predicates.js"),C=te.isNil,q=te.isFunction,z=U("packages/core/src/format/date.js"),B=z.toDate,Z=z.compilePattern,K=z.compileDate,F=z.toIsoDateTime,X=z.compareIso,H=864e5,j=Object.freeze({}),w=1e3,m=60*w,c=60*m,f=24*c,l=7*f,r=new WeakMap;function t(Se,Ge){const Ce=Se&&Se.locale||"",Te=Se&&Se.column;if(!Te)return Ce?{locale:Ce}:j;const ze=r.get(Te);if(ze&&ze.locale===Ce)return ze.bag;const Ke=Te.typeOptions||Te[Ge]||(i(Te.format)?Te.format:null),Ze={...Ke||j,locale:Ke&&Ke.locale||Ce||void 0};return r.set(Te,{locale:Ce,bag:Ze}),Ze}function i(Se){return Se!==null&&typeof Se=="object"&&!Array.isArray(Se)&&!(Se instanceof Date)}function s(Se,Ge){const Ce=Se===null||Number.isNaN(Se)?null:Se,Te=Ge===null||Number.isNaN(Ge)?null:Ge;return Ce===null?Te===null?0:1:Te===null||Ce<Te?-1:Ce>Te?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,u=/^(\d{3,6})$/;function o(Se,Ge,Ce,Te){return!(Se>=0&&Se<=23)||!(Ge>=0&&Ge<=59)||!(Ce>=0&&Ce<=59)||!(Te>=0&&Te<=999)?null:Se*c+Ge*m+Ce*w+Te}function a(Se){if(C(Se))return null;const Ge=String(Se).trim();if(Ge==="")return null;const Ce=u.exec(Ge);if(Ce){const wt=Ce[1];if(wt.length===5)return null;const ht=wt.length===3?1:2;return o(Number(wt.slice(0,ht)),Number(wt.slice(ht,ht+2)),Number(wt.slice(ht+2,ht+4)||0),0)}const Te=n.exec(Ge);if(!Te)return null;let ze=Number(Te[1]);const Ke=Number(Te[2]||0),Ze=Number(Te[3]||0),nt=Te[4]?Number(Te[4].padEnd(3,"0")):0,it=Te[5]?Te[5][0].toLowerCase():null;if(it){if(ze<1||ze>12)return null;ze=ze%12,it==="p"&&(ze+=12)}return o(ze,Ke,Ze,nt)}function h(Se){return C(Se)||Se===""?null:typeof Se=="number"?Number.isFinite(Se)?(Se%f+f)%f:null:Se instanceof Date?Number.isNaN(Se.getTime())?null:Se.getHours()*c+Se.getMinutes()*m+Se.getSeconds()*w+Se.getMilliseconds():a(Se)}const v=new Map;function g(Se){const Ge=Se.pattern||"",Ce=Se.timeStyle||(Se.seconds?"medium":"short"),Te=`${Se.locale||""}|${Ge}|${Ce}`;let ze=v.get(Te);if(ze)return ze;if(Ge)ze=Z(Ge,Se.locale||void 0,"UTC");else{const Ke=new Intl.DateTimeFormat(Se.locale||void 0,{timeStyle:Ce,timeZone:"UTC"});ze=Ze=>Ke.format(Ze)}return v.set(Te,ze),ze}function k(Se,Ge){const Ce=Ge||j;if(Se==null||typeof Se!="number"||!Number.isFinite(Se))return Ce.nullDisplay??"";const Te=(Se%f+f)%f;return g(Ce)(new Date(Te))}function d(Se){return Se instanceof Date?!Number.isNaN(Se.getTime()):typeof Se=="number"?Number.isFinite(Se)&&Se>=0&&Se<f:typeof Se!="string"||!Se.includes(":")?!1:a(Se)!==null}function p(Se){const Ge=h(Se);return Ge==null?"":k(Ge,{pattern:Ge%w===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const b=new Map;function O(Se){const Ge=Se||"";let Ce=b.get(Ge);return Ce||(Ce=new Intl.DateTimeFormat("en-GB",{timeZone:Se||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),b.set(Ge,Ce)),Ce}function y(Se,Ge){const Ce={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const Te of O(Ge).formatToParts(new Date(Se)))Te.type==="year"?Ce.year=Number(Te.value):Te.type==="month"?Ce.month=Number(Te.value):Te.type==="day"?Ce.day=Number(Te.value):Te.type==="hour"?Ce.hour=Number(Te.value)%24:Te.type==="minute"?Ce.minute=Number(Te.value):Te.type==="second"&&(Ce.second=Number(Te.value));return Ce}function M(Se,Ge){const Ce=y(Se,Ge);return Date.UTC(Ce.year,Ce.month-1,Ce.day,Ce.hour,Ce.minute,Ce.second,0)-Math.floor(Se/1e3)*1e3}function D(Se,Ge){const Ce=Se.hour||0,Te=Se.minute||0,ze=Se.second||0,Ke=Se.ms||0;if(!Ge)return new Date(Se.year,Se.month-1,Se.day,Ce,Te,ze,Ke).getTime();const Ze=Date.UTC(Se.year,Se.month-1,Se.day,Ce,Te,ze,Ke);let nt=Ze-M(Ze,Ge);return nt=Ze-M(nt,Ge),nt}const _=/(?:Z|[+-]\d{2}:?\d{2})$/i,I=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function L(Se,Ge){if(C(Se))return null;const Ce=String(Se).trim();if(Ce==="")return null;const Te=Ge&&Ge.timeZone||void 0;if(!_.test(Ce)){const ze=I.exec(Ce);if(ze){const Ke=(ze[4]||"").trim(),Ze=Ke===""?0:a(Ke);if(Ze===null)return null;const nt=D({year:Number(ze[1]),month:Number(ze[2]),day:Number(ze[3]),hour:Math.floor(Ze/c),minute:Math.floor(Ze/m)%60,second:Math.floor(Ze/w)%60,ms:Ze%w},Te);return Number.isNaN(nt)?null:new Date(nt)}}return B(Ce)}function $(Se){if(typeof Se=="number")return Number.isFinite(Se)?Se:null;const Ge=B(Se);return Ge?Ge.getTime():null}const P=new Map;function N(Se){const Ge=[Se.locale||"",Se.pattern||"",Se.dateStyle||"",Se.timeStyle||"",Se.timeZone||"",Se.seconds?"1":""].join("|");let Ce=P.get(Ge);if(Ce)return Ce;const Te=Se.pattern?{type:"date",pattern:Se.pattern,timeZone:Se.timeZone}:{type:"date",dateStyle:Se.dateStyle||"medium",timeStyle:Se.timeStyle||(Se.seconds?"medium":"short"),timeZone:Se.timeZone};return Ce=K(Te,Se.locale||void 0),P.set(Ge,Ce),Ce}function T(Se,Ge){const Ce=Ge||j,Te=$(Se);return Te==null?Ce.nullDisplay??"":N(Ce)(Te)}function E(Se){return Se instanceof Date?!Number.isNaN(Se.getTime()):typeof Se!="string"||!I.test(Se.trim())?!1:L(Se)!==null}const A=Object.freeze([{key:"w",ms:l,intl:"week",long:["week","weeks"],names:["w","wk","wks","week","weeks"]},{key:"d",ms:f,intl:"day",long:["day","days"],names:["d","dy","day","days"]},{key:"h",ms:c,intl:"hour",long:["hour","hours"],names:["h","hr","hrs","hour","hours"]},{key:"m",ms:m,intl:"minute",long:["minute","minutes"],names:["m","min","mins","minute","minutes"]},{key:"s",ms:w,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"]}]),S=new Map;for(const Se of A)for(const Ge of Se.names)S.set(Ge,Se);const x=Object.freeze(A.filter(Se=>Se.key!=="w")),W=/^(\d+(?:\.\d+)?)\s*([a-z]+)\s*(?:,\s*)?/,V=/^\d+(?:\.\d+)?$/,G=/^(\d+):([0-5]?\d)(?::([0-5]?\d))?(?:\.(\d{1,3}))?$/;function Q(Se){const Ge=Se&&Se.defaultUnit?S.get(String(Se.defaultUnit).toLowerCase()):null;return Ge?Ge.ms:m}function ee(Se){return(Se&&Se.defaultUnit?S.get(String(Se.defaultUnit).toLowerCase()):null)||S.get("m")}function ne(Se,Ge){if(C(Se))return null;let Ce=String(Se).trim().toLowerCase();if(Ce==="")return null;let Te=1;if(Ce[0]==="-"?(Te=-1,Ce=Ce.slice(1).trim()):Ce[0]==="+"&&(Ce=Ce.slice(1).trim()),Ce==="")return null;const ze=G.exec(Ce);if(ze){const it=ze[3]!==void 0,wt=Number(ze[1])*c+Number(ze[2])*m+(it?Number(ze[3])*w:0)+(ze[4]?Number(ze[4].padEnd(3,"0")):0);return Te*wt}if(V.test(Ce))return Math.round(Te*Number(Ce)*Q(Ge||j));let Ke=Ce,Ze=0,nt=0;for(;Ke!=="";){const it=W.exec(Ke);if(!it)return null;const wt=S.get(it[2]);if(!wt)return null;Ze+=Number(it[1])*wt.ms,Ke=Ke.slice(it[0].length),nt++}return nt===0?null:Math.round(Te*Ze)}function se(Se){return C(Se)||Se===""?null:typeof Se=="number"?Number.isFinite(Se)?Se:null:ne(Se)}const le=new Map;function me(Se,Ge,Ce){const Te=`${Ce||""}|${Ge.intl}`;let ze=le.get(Te);if(ze===void 0){try{ze=new Intl.NumberFormat(Ce||void 0,{style:"unit",unit:Ge.intl,unitDisplay:"long"})}catch{ze=null}le.set(Te,ze)}return ze?ze.format(Se):`${Se} ${Se===1?Ge.long[0]:Ge.long[1]}`}function ve(Se,Ge){return String(Se).padStart(Ge,"0")}function fe(Se,Ge){const Ce=Ge||j;if(Se==null||typeof Se!="number"||!Number.isFinite(Se))return Ce.nullDisplay??"";const Te=Ce.style||"short",ze=Se<0;let Ke=Math.round(Math.abs(Se));const Ze=ze?"-":"";if(Ke===0&&Ce.zeroDisplay!=null)return Ce.zeroDisplay;if(Te==="clock"){const ht=Math.floor(Ke/c),Ot=Math.floor(Ke/m)%60,Pt=Math.floor(Ke/w)%60;return`${Ze}${ve(ht,2)}:${ve(Ot,2)}:${ve(Pt,2)}`}if(Ke===0){const ht=ee(Ce);return Te==="long"?me(0,ht,Ce.locale):`0${ht.key}`}const nt=Ce.weeks===!0?A:x,it=typeof Ce.maxUnits=="number"&&Ce.maxUnits>0?Ce.maxUnits:Ce.maxUnits===void 0?2:1/0,wt=[];for(const ht of nt){if(wt.length>=it)break;const Ot=Math.floor(Ke/ht.ms);Ot!==0&&(Ke-=Ot*ht.ms,wt.push(Te==="long"?me(Ot,ht,Ce.locale):`${Ot}${ht.key}`))}return Ze+wt.join(" ")}function xe(Se){if(typeof Se!="string")return!1;const Ge=Se.trim();return Ge===""||G.test(Ge)||!/[a-z]/i.test(Ge)?!1:ne(Ge)!==null}const He=Date.UTC(1899,11,30),Be=new Map;function ae(Se,Ge){const Ce=Se||"";let Te=Be.get(Ce);Te||(Te=new Intl.DateTimeFormat("en-GB",{timeZone:Se||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),Be.set(Ce,Te));const ze=typeof Ge=="number"?Ge:Date.now();for(const Ke of Te.formatToParts(new Date(ze)))if(Ke.type==="timeZoneName")return Ke.value;return""}function Ae(Se){if(Se)return Se;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function Me(Se,Ge){const Ce=Ae(Se),Te=ae(Se,Ge);return Te?`${Ce} (${Te})`:Ce}function Re(Se,Ge){if(Se&&Se.timeZone)return Se.timeZone;const Ce=Ge&&Ge.grid;return(Ce&&q(Ce.get)?Ce.get("timeZone"):void 0)||void 0}function pe(Se,Ge){const Ce=Ge||j,Te=$(Se);if(Te==null)return Ce.nullDisplay??"";const ze=N(Ce)(Te);if(!Ce.showOrigin)return ze;const Ke=Ce.originZone;return Ke?Ke===(Ce.timeZone||Ae(Ce.timeZone))?ze:`${ze} (${Me(Ke,Te)})`:`${ze} (no origin recorded)`}function $e(Se,Ge,Ce,Te){if(Ge==="instant"||!Ge)return Se;const ze=y(Se,Ce);if(Ge==="month")return D({year:ze.year,month:ze.month,day:1},Ce);if(Ge==="week"){const Ke=Te>=1&&Te<=7?Te:1,nt=((new Date(Date.UTC(ze.year,ze.month-1,ze.day)).getUTCDay()+6)%7+1-Ke+7)%7,it=new Date(Date.UTC(ze.year,ze.month-1,ze.day-nt));return D({year:it.getUTCFullYear(),month:it.getUTCMonth()+1,day:it.getUTCDate()},Ce)}return D({year:ze.year,month:ze.month,day:ze.day},Ce)}function ce(Se,Ge){const Ce=Se&&Se.group,Te=Ce&&Ce.granularity||"day";if(Te==="instant")return null;const ze=Ce&&Ce.weekStart;return Ke=>typeof Ke=="number"?$e(Ke,Te,Ge,ze):Ke}const ge={time:{base:"number",storage:"float64",matches:d,format:Se=>k(h(Se.value),t(Se,"time")),parse:Se=>a(Se.text),compare:(Se,Ge)=>s(h(Se),h(Ge)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:Se=>{const Ge=h(Se);return Ge===null?null:Ge/H},toStorage:Se=>h(Se),toClipboard:p,fromClipboard:a},datetime:{base:"dateString",storage:"dictionary",matches:E,format:Se=>T(Se.value,t(Se,"datetime")),parse:Se=>F(L(Se.text,t(Se,"datetime"))??Se.text),compare:X,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(Se,Ge)=>F(Se,Ge&&Ge.timeZone),toClipboard:Se=>C(Se)?"":String(Se),fromClipboard:Se=>F(Se)},duration:{base:"number",storage:"float64",matches:xe,format:Se=>fe(se(Se.value),t(Se,"duration")),parse:Se=>ne(Se.text,t(Se,"duration")),compare:(Se,Ge)=>s(se(Se),se(Ge)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:Se=>{const Ge=se(Se);return Ge===null?null:Ge/H},toStorage:Se=>se(Se),toClipboard:Se=>fe(se(Se),{style:"short",maxUnits:-1}),fromClipboard:Se=>ne(Se)},timestamp:{base:"number",storage:"float64",format:Se=>{const Ge=t(Se,"timestamp");return pe(Se.value,{...Ge,timeZone:Re(Ge,Se)})},parse:Se=>{const Ge=t(Se,"timestamp"),Ce=L(Se.text,{timeZone:Re(Ge,Se)});return Ce?Ce.getTime():null},compare:(Se,Ge)=>s($(Se),$(Ge)),groupProjector:(Se,Ge)=>ce(Se,Ge),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(Se,Ge)=>{const Ce=$(Se);if(Ce==null)return null;const Te=y(Ce,Ge&&Ge.timeZone||void 0);return(Date.UTC(Te.year,Te.month-1,Te.day,Te.hour,Te.minute,Te.second)-He)/H},toStorage:Se=>$(Se),toClipboard:Se=>{const Ge=$(Se);return Ge==null?"":new Date(Ge).toISOString()},fromClipboard:Se=>$(Se)}},je=["datetime","time","duration"],Ve=ge}),Ue("packages/core/src/internal/lru.js",function(e,U){"use strict";Object.defineProperty(e,"Lru",{enumerable:!0,get:function(){return te}});class te{#e;#t=new Map;#n;constructor(q=256,z=null){this.#e=q,this.#n=z}get size(){return this.#t.size}get max(){return this.#e}set max(q){this.#e=q,this.#r()}has(q){return this.#t.has(q)}get(q){const z=this.#t;if(!z.has(q))return;const B=z.get(q);return z.delete(q),z.set(q,B),B}peek(q){return this.#t.get(q)}set(q,z){const B=this.#t;return B.has(q)&&B.delete(q),B.set(q,z),this.#r(),z}delete(q){const z=this.#t.get(q);return this.#t.delete(q)&&this.#n&&this.#n(z,q),z}clear(){if(this.#n)for(const[q,z]of this.#t)this.#n(z,q);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const q=this.#t;for(;q.size>this.#e;){const z=q.keys().next().value,B=q.get(z);q.delete(z),this.#n&&this.#n(B,z)}}}}),Ue("packages/core/src/columns/types/network.js",function(e,U){"use strict";Object.defineProperty(e,"toUint32",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"compareIpv4",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"packCidr",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"cidrParts",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"isCidr",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"compareCidr",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"netmask",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"addressCount",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"ipv6Groups",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return $}});const C=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/lru.js").Lru,B=4294967295,Z=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function K(P){if(C(P))return null;if(typeof P=="string")return F(P);const N=Number(P);return Number.isFinite(N)?N<0?N<-2147483648?null:N>>>0:N>B?null:Math.trunc(N)>>>0:null}function F(P){if(C(P))return null;const N=String(P).trim();if(N==="")return null;const T=Z.exec(N);if(!T)return null;let E=0;for(let A=1;A<=4;A++){const S=T[A];if(S.length>1&&S.charCodeAt(0)===48)return null;const x=Number(S);if(x>255)return null;E=E*256+x}return E}function X(P){const N=K(P);return N===null?"":`${N>>>24&255}.${N>>>16&255}.${N>>>8&255}.${N&255}`}function H(P){return typeof P=="string"&&F(P)!==null}function j(P,N){const T=K(P),E=K(N);return T===null?E===null?0:1:E===null||T<E?-1:T>E?1:0}const w=64,m=B*w+32,c=/^(?:0|[1-9]\d?)$/;function f(P,N){return P*w+N}function l(P){if(C(P))return null;if(typeof P=="string"){const E=r(P);return E===null?null:l(E)}if(typeof P=="object"){const E=K(P.address),A=Number(P.prefix);return E===null||!Number.isInteger(A)||A<0||A>32?null:{address:E,prefix:A}}const N=Number(P);if(!Number.isInteger(N)||N<0||N>m)return null;const T=N%w;return T>32?null:{address:(N-T)/w,prefix:T}}function r(P){if(C(P))return null;const N=String(P).trim();if(N==="")return null;const T=N.indexOf("/");if(T<0)return null;const E=F(N.slice(0,T));if(E===null)return null;const A=N.slice(T+1).trim();if(!c.test(A))return null;const S=Number(A);return S>32?null:f(E,S)}function t(P){const N=l(P);return N?`${X(N.address)}/${N.prefix}`:""}function i(P){return typeof P=="string"&&r(P)!==null}function s(P,N){const T=l(P),E=l(N);return T?E?T.address!==E.address?T.address<E.address?-1:1:T.prefix-E.prefix:-1:E?1:0}function n(P){return P===0?0:4294967295<<32-P>>>0}function u(P){const N=l(P);return N?(N.address&n(N.prefix))>>>0:null}function o(P){const N=l(P);return N?(N.address&n(N.prefix)|~n(N.prefix)>>>0)>>>0:null}function a(P){const N=l(P);return N?2**(32-N.prefix):null}function h(P){const N=l(P);return N?N.prefix===32?1:N.prefix===31?2:2**(32-N.prefix)-2:null}function v(P,N){const T=l(P);if(!T)return!1;const E=K(N);if(E===null)return!1;const A=n(T.prefix);return(E&A)>>>0===(T.address&A)>>>0}function g(P,N){const T=u(P),E=u(N);return T===null||E===null?!1:T<=o(N)&&E<=o(P)}const k=/^[0-9a-fA-F]{1,4}$/,d=new z(512);function p(P){if(C(P))return null;let N=String(P).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 V=N.lastIndexOf(":");if(V<0)return null;const G=F(N.slice(V+1));if(G===null)return null;N=`${N.slice(0,V+1)}${(G>>>16&65535).toString(16)}:${(G&65535).toString(16)}`}const E=N.split("::");if(E.length>2)return null;const A=b(E[0]);if(A===null)return null;if(E.length===1)return A.length===8?A:null;const S=b(E[1]);if(S===null)return null;const x=8-A.length-S.length;if(x<1)return null;const W=A.slice();for(let V=0;V<x;V++)W.push(0);for(const V of S)W.push(V);return W}function b(P){if(P==="")return[];const N=[];for(const T of P.split(":")){if(!k.test(T))return null;N.push(parseInt(T,16))}return N}function O(P){if(typeof P!="string")return p(P);if(d.has(P))return d.get(P);const N=p(P);return d.set(P,N),N}function y(P){if(P[0]===0&&P[1]===0&&P[2]===0&&P[3]===0&&P[4]===0&&P[5]===65535)return`::ffff:${X((P[6]<<16|P[7])>>>0)}`;let N=-1,T=0,E=-1,A=0;for(let W=0;W<8;W++)P[W]===0?(E<0?(E=W,A=1):A++,A>T&&(T=A,N=E)):(E=-1,A=0);if(T<2)return P.map(W=>W.toString(16)).join(":");const S=P.slice(0,N).map(W=>W.toString(16)).join(":"),x=P.slice(N+T).map(W=>W.toString(16)).join(":");return`${S}::${x}`}function M(P){const N=p(P);return N===null?null:y(N)}function D(P){return M(P)??""}function _(P){return typeof P=="string"&&P.indexOf(":")>=0&&p(P)!==null}function I(P,N){const T=O(P),E=O(N);if(!T)return E?1:0;if(!E)return-1;for(let A=0;A<8;A++)if(T[A]!==E[A])return T[A]<E[A]?-1:1;return 0}const L=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:H,parse:P=>F(P.text),compare:j,format:P=>X(P.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:P=>K(P),toClipboard:P=>X(P),fromClipboard:P=>F(P)},cidr:{base:"number",storage:"float64",matches:i,parse:P=>r(P.text),compare:s,format:P=>t(P.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:P=>{const N=l(P);return N===null?null:f(N.address,N.prefix)},toClipboard:P=>t(P),fromClipboard:P=>r(P)},ipv6:{base:"text",storage:"dictionary",matches:_,parse:P=>M(P.text),compare:I,format:P=>D(P.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:P=>M(P),toClipboard:P=>D(P),fromClipboard:P=>M(P)}}),$=L}),Ue("packages/core/src/i18n/catalogue.js",function(e,U){"use strict";Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return z}});const C=U("packages/core/src/registry/free-tier-notice.js").FREE_TIER_NOTICE,q=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","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.","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","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.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","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.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.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.","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","views.default":"Default","views.namePlaceholder":"Name this view…","views.nameLabel":"Name for the current layout","views.save":"Save view","licence.watermark":"Unlicensed: Lattice Grid trial","licence.watermark.free":C,"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}","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"}),z=Object.freeze(Object.keys(q))}),Ue("packages/core/src/i18n/format.js",function(e,U){"use strict";Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"formatMessage",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return w}});const C=U("packages/core/src/internal/predicates.js").isFunction,q=/\{(\w+)\}/g,z=new Map,B=new Map;function Z(m){const c=m||"";if(z.has(c))return z.get(c);let f=null;try{f=new Intl.PluralRules(m||void 0)}catch{f=null}return z.set(c,f),f}function K(m,c,f="conjunction"){const l=Array.isArray(m)?m.filter(i=>i!=null&&i!==""):[];if(l.length===0)return"";if(l.length===1)return String(l[0]);const r=`${c||""}|${f}`;let t=B.get(r);if(t===void 0){try{t=new Intl.ListFormat(c||void 0,{style:"long",type:f})}catch{t=null}B.set(r,t)}return t?t.format(l.map(String)):l.map(String).join(", ")}function F(m,c){return m==null?"":typeof m=="number"?Number.isFinite(m)?m.toLocaleString(c||void 0,{maximumFractionDigits:20}):"":String(m)}function X(m,c,f){if(typeof m=="string")return m;if(!m||typeof m!="object")return"";const l=c&&typeof c.count=="number"?c.count:null;if(l===null)return m.other??"";const r=Z(f),t=r?r.select(l):l===1?"one":"other";return m[t]??m.other??""}function H(m,c={},f){const l=X(m,c,f);return l?l.replace(q,(r,t)=>Object.prototype.hasOwnProperty.call(c,t)?F(c[t],f):r):""}function j(m,c,f="en-GB"){return typeof m=="string"&&m?m:typeof c=="string"&&c?c:f}function w(m,c){const f=m?m[c]:void 0;return f==null||C(f)?c:f}}),Ue("packages/core/src/i18n/registry.js",function(e,U){"use strict";Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"localeCatalogue",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return Z}});const C=U("packages/core/src/i18n/catalogue.js").EN_GB,q=new Map([["en-gb",C]]);function z(K,F){const X=typeof K=="string"?K.toLowerCase():"";return!X||!F||typeof F!="object"?!1:(q.set(X,F),!0)}function B(K){if(typeof K!="string"||!K)return null;const F=K.toLowerCase(),X=q.get(F);if(X)return X;const H=F.split("-")[0],j=q.get(H);if(j)return j;for(const[w,m]of q)if(w.split("-")[0]===H)return m;return null}function Z(){return[...q.keys()]}}),Ue("packages/core/src/i18n/index.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"Messages",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"defaultMessages",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return s}});const te=U("packages/core/src/i18n/catalogue.js"),C=te.EN_GB,q=te.MESSAGE_KEYS,z=U("packages/core/src/i18n/format.js"),B=z.formatMessage,Z=z.formatList,K=z.lookup,F=z.resolveLocale,H=U("packages/core/src/internal/predicates.js").isFunction,w=U("packages/core/src/internal/warn.js").warnOnce,m=U("packages/core/src/i18n/registry.js"),c=m.registerLocale,f=m.localeCatalogue;Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return te.EN_GB}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return te.MESSAGE_KEYS}}),Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return z.formatList}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return z.resolveLocale}}),Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return m.registerLocale}});const l="en-GB";class r{#e=l;#t=C;constructor(u={}){this.configure(u)}configure(u={}){this.#e=F(u.locale,u.declared,l);const o=u.messages,a=f(this.#e);if(!a&&this.#e.toLowerCase()!=="en-gb"&&(!o||typeof o!="object")&&w(`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.`),!o||typeof o!="object"){this.#t=a?{...C,...a}:C;return}const v=Object.keys(o).filter(g=>!(g in C));v.length&&w(`i18n:unknown:${v[0]}`,`message keys not in the catalogue and so ignored: ${v.slice(0,5).join(", ")}${v.length>5?`, and ${v.length-5} more`:""}`),this.#t={...C,...a||{},...o}}get locale(){return this.#e}t(u,o){return B(K(this.#t,u),o||{},this.#e)}list(u,o){return Z(u,this.#e,o)}number(u,o){const a=Number(u);return Number.isFinite(a)?a.toLocaleString(this.#e,o||{maximumFractionDigits:20}):""}}const t=new r;function i(n){return n instanceof r?n:new r(n||{})}function s(n){const u=n&&typeof n=="object"?n:{},o=q.filter(h=>{const v=u[h];return v==null||v===""||H(v)}),a=Object.keys(u).filter(h=>!(h in C));return{missing:o,unknown:a}}}),Ue("packages/core/src/columns/types/structured.js",function(e,U){"use strict";Object.defineProperty(e,"MASK_DEFAULTS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"parseJsonText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});const te=U("packages/core/src/internal/predicates.js"),C=te.isNil,q=te.isObject,B=U("packages/core/src/i18n/index.js").defaultMessages,Z=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function K(r,t){const i=t||{},s=i.emptyDisplay??Z.emptyDisplay;if(C(r)||r==="")return s;const u=[...typeof i.char=="string"&&i.char!==""?i.char:Z.char][0]||Z.char,o=i.fixedLength??Z.fixedLength,a=Number.isFinite(i.length)&&Number(i.length)>0?Math.floor(Number(i.length)):Z.length,h=typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"||typeof r=="bigint"?String(r):null;let v=0;if(h!==null){const g=Number.isFinite(i.lastVisible)?Math.floor(Number(i.lastVisible)):Z.lastVisible,k=[...h];if(v=g>0&&g<k.length?g:0,v>0){const d=k.slice(k.length-v).join(""),p=Math.max(1,(o?a:k.length)-v);return u.repeat(p)+d}return u.repeat(o?a:Math.max(1,k.length))}return u.repeat(a)}const F=48;function X(r){try{const t=JSON.stringify(r);return t===void 0?null:t}catch{return null}}function H(r,t){if(C(r))return"";const i=Number.isFinite(t&&t.inlineLimit)?Number(t.inlineLimit):F;if(typeof r=="string")return r.length>i?`${r.slice(0,i-1)}…`:r;if(typeof r!="object")return String(r);const s=X(r);if(s!==null&&s.length<=i)return s;if(Array.isArray(r)){const u=r.length;return`[${B.t("count.items",{count:u})}]`}const n=Object.keys(r).length;return`{${B.t("count.keys",{count:n})}}`}function j(r,t){if(r==null)return"null";const i=typeof r;if(i==="number"||i==="boolean"||i==="bigint")return String(r);if(i==="string")return JSON.stringify(r);if(i!=="object")return JSON.stringify(String(r));const s=t||new WeakSet;return s.has(r)?'"[circular]"':(s.add(r),r instanceof Date?JSON.stringify(r.toISOString()):Array.isArray(r)?`[${r.map(o=>j(o,s)).join(",")}]`:`{${Object.keys(r).sort().map(o=>`${JSON.stringify(o)}:${j(r[o],s)}`).join(",")}}`)}function w(r,t){if(C(r))return C(t)?0:1;if(C(t))return-1;const i=j(r),s=j(t);return i<s?-1:i>s?1:0}function m(r){if(C(r))return null;const t=String(r);if(t.trim()==="")return null;try{return JSON.parse(t)}catch{return t}}function c(r){const t=r&&r.cell&&r.cell.props;return q(t)?t:{}}const f=Object.freeze({json:{base:"object",storage:"object",format:r=>H(r&&r.value,c(r&&r.column)),parse:r=>m(r&&r.text),compare:w,defaults:{editor:"code",filter:"text",align:"start"},excel:"@",toClipboard:r=>{if(C(r))return"";if(typeof r=="string")return r;try{const t=JSON.stringify(r,null,2);return t===void 0?String(r):t}catch{return String(r)}},fromClipboard:r=>m(r)},secret:{base:"text",storage:"object",format:r=>K(r&&r.value,c(r&&r.column)),parse:r=>{const t=r&&r.text;return C(t)||String(t)===""?null:String(t)},compare:(r,t)=>{const i=C(r)||r==="",s=C(t)||t==="";return i===s?0:i?1:-1},defaults:{editor:"password",filter:"none",align:"start"},excel:"@",export:{csv:!1,excel:!1},toClipboard:r=>K(r),fromClipboard:r=>C(r)||String(r)===""?null:String(r)}}),l=f}),Ue("packages/core/src/columns/types/unit.js",function(e,U){"use strict";Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return E}});const C=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/warn.js").warnOnce;function B(A,S,x,W){return Object.freeze({symbol:A,factor:S,aliases:Object.freeze(x||[]),binary:!!(W&&W.binary),prefix:W&&W.prefix||null,auto:!(W&&W.auto===!1)})}function Z(A,S,x,W){return B(A,S,x,W)}const K=Object.freeze({data:Object.freeze([B("B",1,["byte","bytes"]),B("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),B("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),B("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),B("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),B("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),B("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),B("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),B("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),B("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([B("bps",1,["bit","bits","bit/s","b/s"]),B("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),B("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),B("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),B("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([B("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),B("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),B("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),B("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),B("in",.0254,["inch","inches"],{auto:!1}),B("ft",.3048,["foot","feet"],{auto:!1}),B("yd",.9144,["yard","yards"],{auto:!1}),B("m",1,["metre","metres","meter","meters"]),B("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),B("mi",1609.344,["mile","miles"],{auto:!1}),B("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([B("mg",.001,["milligram","milligrams"]),B("g",1,["gram","grams"]),B("oz",28.349523125,["ounce","ounces"],{auto:!1}),B("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),B("kg",1e3,["kilogram","kilograms"]),B("st",6350.29318,["stone"],{auto:!1}),B("t",1e6,["tonne","tonnes","ton"],{auto:!1}),B("ton (US)",907184.74,["ton","shortton"],{auto:!1}),B("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([B("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),B("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),B("ms",.001,["msec","msecs","millisecond","milliseconds"]),B("s",1,["sec","secs","second","seconds"]),B("m",60,["min","mins","minute","minutes"]),B("h",3600,["hr","hrs","hour","hours"]),B("d",86400,["day","days"])]),speed:Object.freeze([B("mm/s",.001,["millimetre/s","millimeter/s"]),B("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),B("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),B("mph",.44704,["mile/h","miles/h"],{auto:!1}),B("kn",1852/3600,["knot","knots"],{auto:!1}),B("m/s",1,["metre/s","meter/s","mps"]),B("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([B("mm/s²",.001,["mm/s2"]),B("ft/s²",.3048,["ft/s2"],{auto:!1}),B("m/s²",1,["m/s2","metre/s2","meter/s2"]),B("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([B("mm²",1e-6,["mm2"]),B("cm²",1e-4,["cm2"]),B("in²",64516e-8,["in2","sqin"],{auto:!1}),B("ft²",.09290304,["ft2","sqft"],{auto:!1}),B("yd²",.83612736,["yd2","sqyd"],{auto:!1}),B("m²",1,["m2","sqm"]),B("ha",1e4,["hectare","hectares"],{auto:!1}),B("ac",4046.8564224,["acre","acres"],{auto:!1}),B("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([B("µL",1e-6,["ul","microlitre","microliter"]),B("mL",.001,["millilitre","milliliter"]),B("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),B("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),B("L",1,["litre","litres","liter","liters"]),B("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),B("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),B("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),B("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([B("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),B("J",1,["joule","joules"]),B("cal",4.184,["calorie","calories"],{auto:!1}),B("kJ",1e3,["kilojoule","kilojoules"]),B("BTU",1055.05585262,["btu"],{auto:!1}),B("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),B("MJ",1e6,["megajoule","megajoules"]),B("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),B("GJ",1e9,["gigajoule","gigajoules"]),B("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([B("mW",.001,["milliwatt","milliwatts"]),B("W",1,["watt","watts"]),B("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),B("kW",1e3,["kilowatt","kilowatts"]),B("hp",745.6998715822702,["horsepower"],{auto:!1}),B("MW",1e6,["megawatt","megawatts"]),B("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([B("mN",.001,["millinewton","millinewtons"]),B("N",1,["newton","newtons"]),B("lbf",4.4482216152605,["poundforce"],{auto:!1}),B("kgf",9.80665,["kilogramforce"],{auto:!1}),B("kN",1e3,["kilonewton","kilonewtons"]),B("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([B("Pa",1,["pascal","pascals"]),B("mbar",100,["millibar"],{auto:!1}),B("inH₂O",249.0889,["inh2o"],{auto:!1}),B("mmHg",133.322387415,["torr"],{auto:!1}),B("kPa",1e3,["kilopascal","kilopascals"]),B("inHg",3386.388640341,["inhg"],{auto:!1}),B("psi",6894.757293168361,["lbf/in2"],{auto:!1}),B("bar",1e5,[],{auto:!1}),B("atm",101325,["atmosphere","atmospheres"],{auto:!1}),B("MPa",1e6,["megapascal","megapascals"]),B("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([B("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),B("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),B("kN·m",1e3,["knm","kn.m"],{auto:!1}),B("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([B("kg/m³",1,["kg/m3"]),B("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),B("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),B("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([B("L/min",1/6e4,["lpm","l/min"],{auto:!1}),B("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),B("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),B("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),B("cfm",.0004719474432,["ft3/min"],{auto:!1}),B("L/s",.001,["lps","l/s"],{auto:!1}),B("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([B("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),B("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),B("mrad",.001,["milliradian","milliradians"],{auto:!1}),B("mil",Math.PI/3200,["nato-mil"],{auto:!1}),B("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),B("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),B("rad",1,["radian","radians"]),B("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([B("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),B("rad/s",1,["radps","radians/s"]),B("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),B("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([B("ppt",1e-12,["partspertrillion"],{auto:!1}),B("ppb",1e-9,["partsperbillion"]),B("ppm",1e-6,["partspermillion"]),B("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),B("‰",.001,["permille","permil"],{auto:!1}),B("%",.01,["pct","percent"]),B("×",1,["x","ratio","times"])]),molarity:Object.freeze([B("pM",1e-12,["picomolar","picomolarity"]),B("nM",1e-9,["nanomolar","nanomolarity"]),B("µM",1e-6,["um-molar","micromolar","micromolarity"]),B("mM",.001,["millimolar","millimolarity"]),B("M",1,["molar","mol/l","mol/L","molarity"]),B("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([B("mg/s",1e-6,["milligrams/s"]),B("g/s",.001,["grams/s"]),B("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),B("kg/s",1,["kilograms/s","kgps"]),B("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),B("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),B("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([B("µPa·s",1e-6,["upas","micropascalsecond"]),B("cP",.001,["centipoise"],{auto:!1}),B("mPa·s",.001,["mpas","millipascalsecond"]),B("P",.1,["poise"],{auto:!1}),B("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([B("cSt",1e-6,["centistokes","centistoke"]),B("mm²/s",1e-6,["mm2/s"],{auto:!1}),B("St",1e-4,["stokes","stoke"],{auto:!1}),B("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([B("mW/(m·K)",.001,["mw/mk"]),B("W/(m·K)",1,["w/mk","wmk"]),B("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),B("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([B("J/(kg·K)",1,["j/kgk","jkgk"]),B("kJ/(kg·K)",1e3,["kj/kgk"]),B("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([B("nSv/h",1e-9,["nsvh"]),B("µSv/h",1e-6,["usv/h","usvh"]),B("mSv/h",.001,["msvh"]),B("Sv/h",1,["svh"]),B("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),F=Symbol("ambiguous"),X=new Map,H=new Map;function j(A,S){const x=String(A||"").trim();if(!x)throw new Error("[lattice] a unit system needs a name");if(K[x]||H.has(x))throw new Error(`[lattice] unit system "${x}" already exists`);const W=[...S||[]];if(!W.length)throw new Error(`[lattice] unit system "${x}" has no units`);if(!W.some(G=>G.factor===1))throw new Error(`[lattice] unit system "${x}" has no base unit (none with factor 1)`);const V=new Set;for(const G of W){if(V.has(G.symbol))throw new Error(`[lattice] unit system "${x}" declares "${G.symbol}" twice`);V.add(G.symbol)}return H.set(x,Object.freeze(W)),X.delete(x),x}function w(){return[...Object.keys(K),...H.keys()]}function m(A){const S=c(A);return S?S.units:[]}function c(A){const S=String(A||""),x=X.get(S);if(x!==void 0)return x;const W=K[S]||H.get(S);if(!W)return X.set(S,null),null;const V=Object.freeze([...W].sort((se,le)=>se.factor-le.factor)),G=new Map,Q=new Map,ee=(se,le)=>{const me=G.get(se);me===void 0?G.set(se,le):me!==le&&G.set(se,F)};for(const se of V){ee(se.symbol.toLowerCase(),se);for(const le of se.aliases)ee(le.toLowerCase(),se);if(se.prefix){const le=Q.get(se.prefix)||[];le.push(se),Q.set(se.prefix,le)}}const ne={units:V,byToken:G,byPrefix:Q,decimal:V.filter(se=>!se.binary&&se.auto),binary:V.some(se=>se.binary)?V.filter(se=>(se.binary||se.factor===1)&&se.auto):null};return X.set(S,ne),ne}function f(A,S){return S&&A.binary||A.decimal}function l(A,S){const x=c(A);if(!x||C(S))return null;const W=x.units.find(G=>G.symbol===String(S));if(W)return W;const V=x.byToken.get(String(S).trim().toLowerCase());return V&&V!==F?V:null}const r=new WeakMap;function t(A){const S=A||{};if(typeof S=="object"&&S!==null){const G=r.get(S);if(G!==void 0)return G}const x=S.system||"data",W=c(x);let V=null;if(!W)z(`unit:system:${x}`,`unknown unit system "${x}"; known systems are ${w().join(", ")}`);else{let G=S.unit?l(x,S.unit):null;G||(S.unit&&z(`unit:unit:${x}:${S.unit}`,`unknown unit "${S.unit}" in system "${x}"; falling back to ${W.units[0].symbol}`),G=W.units.find(Q=>Q.factor===1)||W.units[0]),V={index:W,base:G,binary:S.binary===!0}}return typeof S=="object"&&S!==null&&r.set(S,V),V}const i=new WeakMap;function s(A,S){if(!A||!S||!Array.isArray(A.compound)||A.compound.length===0)return null;const x=i.get(A);if(x!==void 0)return x;const W=new Set,V=[];for(const Q of A.compound){const ee=l(A.system||"data",Q);if(!ee){z(`unit:compound:${A.system}:${Q}`,`unknown compound unit "${Q}" in system "${A.system||"data"}"; ignoring it`);continue}W.has(ee.symbol)||(W.add(ee.symbol),V.push(ee))}V.sort((Q,ee)=>ee.factor-Q.factor);const G=V.length>=2?V:null;return i.set(A,G),G}function n(A,S,x){return S===x||S.factor===x.factor?A:A*S.factor/x.factor}const u=new Map;function o(A){const S=A||"",x=u.get(S);if(x)return x;const W={group:",",decimal:"."};try{for(const V of new Intl.NumberFormat(A||void 0).formatToParts(12345.6))V.type==="group"?W.group=V.value:V.type==="decimal"&&(W.decimal=V.value)}catch{}return u.set(S,W),W}const a=/[\s ]/g,h=/^[+-]?[\d '’ .,]*(?:[eE][+-]?\d+)?/,v=/^[^\d+\-(.,\s]+\s*/,g=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function k(A,S){const{group:x,decimal:W}=o(S);let V=String(A).replace(a,"");if(V==="")return null;const G=W?V.indexOf(W):-1;if(x&&x!==W){if(G>=0&&V.indexOf(x,G+W.length)>=0)return null;V=V.split(x).join("")}if(W&&W!=="."&&(V=V.split(W).join(".")),!g.test(V))return null;const Q=Number(V);return Number.isFinite(Q)?Q:null}function d(A,S,x){const W=String(A).trim().replace(/\.$/,"");if(W==="")return null;const V=S.units.find(le=>le.symbol===W);if(V)return V;const G=W.toLowerCase(),Q=S.byToken.get(G);if(Q===F)return null;if(Q)return Q;const ee=S.byPrefix.get(G);if(!ee||!ee.length)return null;const ne=f(S,x),se=ee.filter(le=>ne.includes(le));return se.length===1?se[0]:null}function p(A,S,x,W){let V=A,G=0,Q=!1,ee=!1;for(;V!=="";){const ne=h.exec(V)[0];if(ne==="")return null;const se=k(ne,W&&W.locale);if(se===null)return null;V=V.slice(ne.length).trim();const le=V.search(/[+-]?[\d]/),me=(le>=0?V.slice(0,le):V).trim();if(V=le>=0?V.slice(le).trim():"",me===""){if(Q)return null;ee=!0,G+=n(se,x[0],S.base)}else{const ve=d(me,S.index,S.binary);if(!ve)return null;G+=n(se,ve,S.base)}if(Q=!0,ee&&V!=="")return null}return Q?G:null}function b(A,S){if(C(A))return null;if(typeof A=="number")return Number.isFinite(A)?A:null;const x=t(S);if(!x)return null;let W=String(A).trim();if(W==="")return null;let V=!1;W.startsWith("(")&&W.endsWith(")")&&(V=!0,W=W.slice(1,-1).trim());const G=s(S,x);if(G){W.startsWith("-")&&(V=!0,W=W.slice(1).trim());const fe=p(W,x,G,S);return fe===null?null:V?-fe:fe}let Q=null;const ee=v.exec(W);if(ee&&ee[0]){const fe=d(ee[0].trim(),x.index,x.binary);fe&&(Q=fe,W=W.slice(ee[0].length).trim())}const ne=h.exec(W)[0],se=k(ne,S&&S.locale);if(se===null)return null;const le=W.slice(ne.length).trim();if(Q&&le!=="")return null;const me=Q||(le===""?x.base:d(le,x.index,x.binary));if(!me)return null;const ve=n(se,me,x.base);return V?-ve:ve}const O=new Map;function y(A,S,x,W){const V=`${A||""}|${S}|${x}|${W?1:0}`;let G=O.get(V);return G||(G=new Intl.NumberFormat(A||void 0,{minimumFractionDigits:S,maximumFractionDigits:x,useGrouping:W}),O.set(V,G)),G}function M(A,S){if(!Number.isFinite(A)||A===0)return Math.max(0,S-1);const x=Math.floor(Math.log10(Math.abs(A)));return Math.min(20,Math.max(0,S-1-x))}function D(A,S){if(!Number.isFinite(A)||A===0)return A;const x=Math.ceil(Math.log10(Math.abs(A))),W=10**(S-x);return Math.round(A*W)/W}function _(A,S,x){if(!x||x===S.base.symbol)return S.base;if(x!=="auto")return I(S,x);if(A===0||!Number.isFinite(A))return S.base;const W=Math.abs(A)*S.base.factor,V=f(S.index,S.binary);let G=V[0];for(const ne of V)W>=ne.factor&&(G=ne);if(W>=G.factor)return G;let Q=G;for(const ne of S.index.units)ne.binary!==S.binary&&ne.factor!==1||ne.factor<=W&&ne.factor>(Q===G?0:Q.factor)&&(Q=ne);if(Q!==G)return Q;let ee=G;for(const ne of S.index.units)ne.binary!==S.binary&&ne.factor!==1||ne.factor<ee.factor&&(ee=ne);return ee.factor<S.base.factor?ee:S.base}function I(A,S){const x=A.index.units.find(V=>V.symbol===S);if(x)return x;const W=A.index.byToken.get(String(S).toLowerCase());return W&&W!==F?W:(z(`unit:display:${S}`,`unknown display unit "${S}"; rendering in ${A.base.symbol}`),A.base)}function L(A,S,x,W){const V=A<0;let G=Math.abs(A)*S.base.factor;const Q=typeof W.decimals=="number"?W.decimals:W.minDecimals??0,ee=typeof W.decimals=="number"?W.decimals:W.maxDecimals??Math.max(Q,2),ne=W.space??" ",se=[];for(let me=0;me<x.length;me++){const ve=x[me],fe=me===x.length-1;let xe=fe?G/ve.factor:Math.floor(G/ve.factor);if(G-=xe*ve.factor,fe){const Be=10**ee;xe=Math.round(xe*Be)/Be+0}const He=fe?y(W.locale,Q,ee,W.group!==!1):y(W.locale,0,0,W.group!==!1);se.push(`${He.format(xe)}${ne}${ve.symbol}`)}const le=se.join(" ");return V?`-${le}`:le}function $(A,S){const x=S||{},W=x.nullDisplay??"";if(C(A)||A==="")return W;const V=typeof A=="number"?A:Number(A);if(!Number.isFinite(V))return W;const G=t(x);if(!G)return String(V);const Q=s(x,G);if(Q)return L(V,G,Q,x);const ee=typeof x.significantFigures=="number"&&x.significantFigures>0?x.significantFigures:0,ne=ee?D(V,ee):V,se=_(ne,G,x.display),le=n(ne,G.base,se);let me=typeof x.decimals=="number"?x.decimals:x.minDecimals??0,ve=typeof x.decimals=="number"?x.decimals:x.maxDecimals??Math.max(me,2);ee&&(me=M(le,ee),ve=me);const fe=y(x.locale,me,ve,x.group!==!1).format(le),xe=x.space??" ";return x.placement==="prefix"?`${se.symbol}${x.space??""}${fe}`:`${fe}${xe}${se.symbol}`}function P(A,S){const x=C(A)||Number.isNaN(A)?null:Number(A),W=C(S)||Number.isNaN(S)?null:Number(S);return x===null||Number.isNaN(x)?W===null||Number.isNaN(W)?0:1:W===null||Number.isNaN(W)||x<W?-1:x>W?1:0}function N(A){const S=typeof A.decimals=="number"&&A.decimals>0?`.${"0".repeat(A.decimals)}`:"";return`${typeof A.decimals=="number"?`#,##0${S}`:"#,##0.##"}" ${A.symbol}"`}function T(A){const S={system:"data",...A||{}},x=t(S),W=x?x.base.symbol:String(S.unit||""),V=Object.freeze({...S,unit:W}),G=Object.freeze({...V,display:W,decimals:void 0,minDecimals:0,maxDecimals:20,group:!1}),Q=new Map([[V.locale||"",V]]),ee=ne=>{const se=ne||"";let le=Q.get(se);return le||(le=Object.freeze({...V,locale:ne||void 0}),Q.set(se,le)),le};return{base:"number",extends:"number",storage:"float64",unitConfig:V,format:ne=>$(ne.value,ne.locale?ee(ne.locale):V),parse:ne=>b(ne.text,ne.locale?ee(ne.locale):V),compare:P,defaults:{filter:"number",editor:"unit",align:"end",total:S.total||"sum"},...S.totals?{totals:S.totals}:{},excel:S.excel||N({decimals:S.decimals,symbol:W}),toStorage:ne=>typeof ne=="number"?Number.isFinite(ne)?ne:null:typeof ne=="string"?b(ne,V):C(ne)?null:b(String(ne),V),toClipboard:ne=>$(ne,G),fromClipboard:ne=>b(ne,V)}}const E=T}),Ue("packages/core/src/columns/types/engineering.js",function(e,U){"use strict";Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return B}});const C=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/columns/types/unit.js").createUnitType;function B(F){const X=2*Math.PI/F;return H=>{let j=0,w=0,m=0;for(const f of H||[]){if(C(f))continue;const l=Number(f);Number.isFinite(l)&&(j+=Math.cos(l*X),w+=Math.sin(l*X),m+=1)}return!m||Math.hypot(j,w)/m<1e-12?null:(Math.atan2(w,j)/X%F+F)%F}}function Z(F){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:B(F)}}}const K=Object.freeze({metres:z({system:"length",unit:"m",display:"auto",maxDecimals:3}),millimetres:z({system:"length",unit:"mm",maxDecimals:2}),kilometres:z({system:"length",unit:"km",maxDecimals:3}),grams:z({system:"mass",unit:"g",display:"auto",maxDecimals:3}),kilograms:z({system:"mass",unit:"kg",maxDecimals:3}),tonnes:z({system:"mass",unit:"t",maxDecimals:3}),seconds:z({system:"duration",unit:"s",display:"auto",maxDecimals:3}),milliseconds:z({system:"duration",unit:"ms",maxDecimals:3}),hours:z({system:"duration",unit:"h",maxDecimals:2}),speed:z({system:"speed",unit:"m/s",display:"auto",maxDecimals:2}),kph:z({system:"speed",unit:"km/h",maxDecimals:1}),mph:z({system:"speed",unit:"mph",maxDecimals:1}),knots:z({system:"speed",unit:"kn",maxDecimals:1}),acceleration:z({system:"acceleration",unit:"m/s²",maxDecimals:3}),area:z({system:"area",unit:"m²",display:"auto",maxDecimals:2}),hectares:z({system:"area",unit:"ha",maxDecimals:4}),volume:z({system:"volume",unit:"L",display:"auto",maxDecimals:3}),cubicMetres:z({system:"volume",unit:"m³",maxDecimals:3}),energy:z({system:"energy",unit:"J",display:"auto",maxDecimals:3}),kilowattHours:z({system:"energy",unit:"kWh",maxDecimals:2}),power:z({system:"power",unit:"W",display:"auto",maxDecimals:2}),kilowatts:z({system:"power",unit:"kW",maxDecimals:2}),force:z({system:"force",unit:"N",display:"auto",maxDecimals:2}),pressure:z({system:"pressure",unit:"Pa",display:"auto",maxDecimals:2}),bar:z({system:"pressure",unit:"bar",maxDecimals:3}),psi:z({system:"pressure",unit:"psi",maxDecimals:1}),torque:z({system:"torque",unit:"N·m",maxDecimals:2}),density:z({system:"density",unit:"kg/m³",maxDecimals:2}),flow:z({system:"flow",unit:"m³/s",maxDecimals:4}),litresPerMinute:z({system:"flow",unit:"L/min",maxDecimals:1}),radians:z({system:"angle",unit:"rad",maxDecimals:4,totals:Z(2*Math.PI)}),degrees:z({system:"angle",unit:"°",maxDecimals:2,totals:Z(360)}),rpm:z({system:"angularVelocity",unit:"rpm",maxDecimals:0}),angularVelocity:z({system:"angularVelocity",unit:"rad/s",maxDecimals:3}),ppm:z({system:"fraction",unit:"ppm",maxDecimals:2}),ppb:z({system:"fraction",unit:"ppb",maxDecimals:2}),basisPoints:z({system:"fraction",unit:"bp",maxDecimals:1}),molarity:z({system:"molarity",unit:"M",display:"auto",maxDecimals:3}),massFlow:z({system:"massFlow",unit:"kg/s",maxDecimals:3}),tonnesPerHour:z({system:"massFlow",unit:"t/h",maxDecimals:2}),viscosity:z({system:"viscosity",unit:"Pa·s",display:"auto",maxDecimals:3}),kinematicViscosity:z({system:"kinematicViscosity",unit:"cSt",maxDecimals:2}),thermalConductivity:z({system:"thermalConductivity",unit:"W/(m·K)",maxDecimals:3}),specificHeat:z({system:"specificHeat",unit:"J/(kg·K)",maxDecimals:1}),doseRate:z({system:"doseRate",unit:"µSv/h",display:"auto",maxDecimals:2})})}),Ue("packages/core/src/columns/types/si.js",function(e,U){"use strict";Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return j}});const te=U("packages/core/src/columns/types/unit.js"),C=te.defineUnit,q=te.registerUnitSystem,z=te.createUnitType,B=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})]),Z=Object.freeze(["p","n","µ","m","","k","M","G"]);function K(w){const m=String(w.base),c=new Set([...w.prefixes||Z,""]),f=[];for(const l of B){if(!c.has(l.symbol))continue;const r=`${l.symbol}${m}`,t=[];if(w.name){t.push(`${l.name}${w.name}`,`${l.name}${w.name}s`);const i=l.name.slice(-1);if(i&&w.name.startsWith(i)){const s=`${l.name.slice(0,-1)}${w.name}`;t.push(s,`${s}s`)}}l.symbol==="µ"&&t.push(`u${m}`),l.factor===1&&w.aliases&&t.push(...w.aliases),f.push(C(r,l.factor,t))}for(const l of w.extra||[])f.push(l);return f}function F(w,m){const c=K(m);return q(w,c)}function X(w,m,c){return F(w,m),z({system:w,unit:m.base,display:"auto",maxDecimals:3,...c||{}})}const H=Object.freeze({voltage:X("voltage",{base:"V",name:"volt"}),current:X("current",{base:"A",name:"amp",aliases:["ampere","amperes"]}),resistance:X("resistance",{base:"Ω",name:"ohm",aliases:["ohm","ohms","R"],prefixes:["m","","k","M","G"]}),capacitance:X("capacitance",{base:"F",name:"farad",prefixes:["f","p","n","µ","m",""]}),inductance:X("inductance",{base:"H",name:"henry",prefixes:["p","n","µ","m",""]}),charge:X("charge",{base:"C",name:"coulomb",prefixes:["p","n","µ","m",""],extra:[C("mAh",3.6,["milliamphour","milliamphours"],{auto:!1}),C("Ah",3600,["amphour","amphours"],{auto:!1})]}),conductance:X("conductance",{base:"S",name:"siemens",prefixes:["n","µ","m","","k"]}),fluxDensity:X("fluxDensity",{base:"T",name:"tesla",prefixes:["n","µ","m",""],extra:[C("G",1e-4,["gauss"],{auto:!1})]}),luminousFlux:X("luminousFlux",{base:"lm",name:"lumen",prefixes:["m","","k"]}),illuminance:X("illuminance",{base:"lx",name:"lux",prefixes:["m","","k"]}),luminousIntensity:X("luminousIntensity",{base:"cd",name:"candela",prefixes:["m","","k"]}),substance:X("substance",{base:"mol",name:"mole",prefixes:["n","µ","m","","k"]}),absorbedDose:X("absorbedDose",{base:"Gy",name:"gray",prefixes:["µ","m",""]}),equivalentDose:X("equivalentDose",{base:"Sv",name:"sievert",prefixes:["n","µ","m",""]}),radioactivity:X("radioactivity",{base:"Bq",name:"becquerel",prefixes:["","k","M","G","T"],extra:[C("Ci",37e9,["curie","curies"],{auto:!1})]}),frequency:X("frequency",{base:"Hz",name:"hertz",prefixes:["m","","k","M","G","T"]})}),j=X}),Ue("packages/core/src/columns/types/temperature.js",function(e,U){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});const C=U("packages/core/src/internal/predicates.js").isNil,q=Object.freeze({C:Object.freeze({symbol:"°C",aliases:["c","°c","celsius","centigrade"],toKelvin:f=>f+273.15,fromKelvin:f=>f-273.15}),F:Object.freeze({symbol:"°F",aliases:["f","°f","fahrenheit"],toKelvin:f=>(f+459.67)*(5/9),fromKelvin:f=>f*(9/5)-459.67}),K:Object.freeze({symbol:"K",aliases:["k","kelvin"],toKelvin:f=>f,fromKelvin:f=>f}),R:Object.freeze({symbol:"°R",aliases:["r","°r","rankine"],toKelvin:f=>f*(5/9),fromKelvin:f=>f*(9/5)})});function z(f){if(C(f))return null;const l=String(f).trim();if(l==="")return null;for(const[t,i]of Object.entries(q))if(l===t||l===i.symbol)return{key:t,scale:i};const r=l.toLowerCase();for(const[t,i]of Object.entries(q))if(i.aliases.includes(r))return{key:t,scale:i};return null}function B(f,l,r){const t=z(l),i=z(r);return!t||!i||!Number.isFinite(Number(f))?null:t.key===i.key?Number(f):i.scale.fromKelvin(t.scale.toKelvin(Number(f)))}const Z=new Map;function K(f,l,r){const t=`${f||""}|${l}|${r}`;let i=Z.get(t);return i||(i=new Intl.NumberFormat(f||void 0,{minimumFractionDigits:l,maximumFractionDigits:r}),Z.set(t,i)),i}function F(f,l){const r=l||{},t=r.nullDisplay??"";if(C(f)||f==="")return t;const i=Number(f);if(!Number.isFinite(i))return t;const s=z(r.scale||"C");if(!s)return String(i);const n=z(r.display||r.scale||"C")||s,u=n.key===s.key?i:n.scale.fromKelvin(s.scale.toKelvin(i)),o=typeof r.decimals=="number"?r.decimals:null,a=o??r.minDecimals??0,h=o??r.maxDecimals??1;return`${K(r.locale,a,h).format(u)}${r.space??" "}${n.scale.symbol}`}const X=/^[+-]?[\d\s., ]*\d/;function H(f,l){const r=String(f).trim();if(r==="")return null;const t=new Intl.NumberFormat(l||void 0).formatToParts(1.1).find(u=>u.type==="decimal")?.value||".",i=t===","?".":",",s=r.split(i).join("").split(/[\s ]/).join("").replace(t,"."),n=Number(s);return Number.isFinite(n)?n:null}function j(f,l){if(C(f))return null;const r=l||{},t=z(r.scale||"C");if(!t)return null;if(typeof f=="number")return Number.isFinite(f)?f:null;let i=String(f).trim();if(i==="")return null;let s=!1;i.startsWith("(")&&i.endsWith(")")&&(s=!0,i=i.slice(1,-1).trim());const n=X.exec(i);if(!n)return null;const u=H(n[0],r.locale);if(u===null)return null;const o=i.slice(n[0].length).trim();if(o==="")return s?-u:u;const a=z(o);if(!a)return null;const h=a.key===t.key?u:t.scale.fromKelvin(a.scale.toKelvin(u));return s?-h:h}function w(f){const l=Object.freeze({scale:"C",...f||{}}),t=(z(l.scale)||z("C")).scale.symbol,i=Object.freeze({...l,display:l.scale,decimals:void 0,minDecimals:0,maxDecimals:20}),s=new Map([[l.locale||"",l]]),n=u=>{const o=u||"";let a=s.get(o);return a||(a=Object.freeze({...l,locale:u||void 0}),s.set(o,a)),a};return{base:"number",extends:"number",storage:"float64",temperatureConfig:l,format:u=>F(u.value,u.locale?n(u.locale):l),parse:u=>j(u.text,u.locale?n(u.locale):l),defaults:{filter:"number",editor:"temperature",align:"end",total:"avg"},totals:{supported:["avg","min","max","count","countValues"]},excel:l.excel||`#,##0${typeof l.decimals=="number"&&l.decimals>0?`.${"0".repeat(l.decimals)}`:".#"}" ${t}"`,toStorage:u=>typeof u=="number"?Number.isFinite(u)?u:null:typeof u=="string"?j(u,l):C(u)?null:j(String(u),l),toClipboard:u=>F(u,i),fromClipboard:u=>j(u,l)}}const m=Object.freeze({celsius:w({scale:"C"}),fahrenheit:w({scale:"F"}),kelvin:w({scale:"K"})}),c=w}),Ue("packages/core/src/columns/types/radix.js",function(e,U){"use strict";Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"digitsForWidth",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"radixRange",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"radixName",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"normaliseRadixOptions",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"compileRadixFormat",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"compileRadixParse",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"parseRadixResult",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return L}});const C=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/warn.js").warnOnce,B=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}),Z=Object.freeze({2:1,8:3,16:4}),K=Object.freeze({2:"0b",8:"0o",16:"0x"}),F=Object.freeze({2:4,8:3,16:2}),X=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),H=Object.freeze({2:"binary",8:"octal",16:"hexadecimal"}),j=Object.freeze([[/^0x/i,16],[/^0b/i,2],[/^0o/i,8],[/^#/,16]]),w=/[\s\u00a0\u202f_,']/g,m=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,c=Object.freeze([8,16,32,53]),f=new WeakSet,l=new WeakMap,r=new Map,t=new WeakMap,i=new WeakMap,s=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($){if($==null)return 16;const P=typeof $=="string"?$.toLowerCase():$,N=B[P];return N||(z(`radix:base:${String($)}`,`unsupported radix ${String($)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function u($,P){return Math.ceil($/Z[P])}function o($,P){if(!$)return P?{min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}:{min:0,max:Number.MAX_SAFE_INTEGER};if(!P)return{min:0,max:2**$-1};const N=2**($-1);return{min:-N,max:N-1}}function a($){return H[$]||"hexadecimal"}function h($){if(typeof $=="string"){const P=s[$];return P||z(`radix:preset:${$}`,`unknown radix preset "${$}"; known presets are ${Object.keys(s).join(", ")}`),{...P||{}}}if($&&typeof $.preset=="string"){const P=s[$.preset];return P||z(`radix:preset:${$.preset}`,`unknown radix preset "${$.preset}"; known presets are ${Object.keys(s).join(", ")}`),{...P||{},...$}}return $||{}}function v($){const P=h($),N=n(P.radix),T=Z[N];let E=null;if(P.bitWidth!==void 0&&P.bitWidth!==null&&P.bitWidth!==!1){const ne=Number(P.bitWidth);c.includes(ne)?E=ne:z(`radix:width:${String(P.bitWidth)}`,`unsupported bitWidth ${String(P.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let A=P.signed!==!1;!A&&E===null&&(z("radix:unsigned:width","signed: false needs a bitWidth to render a two's-complement pattern; defaulting to 32"),E=32);const S=P.prefix===void 0||P.prefix===!0?K[N]:P.prefix===!1?"":String(P.prefix);let x=0;P.pad===!0?x=E?u(E,N):0:typeof P.pad=="number"&&P.pad>0&&(x=Math.floor(P.pad));let W=0;P.group===!0?W=F[N]:typeof P.group=="number"&&P.group>0&&(W=Math.floor(P.group));const V=o(E,A),G=typeof P.min=="number"?Math.max(V.min,P.min):V.min,Q=typeof P.max=="number"?Math.min(V.max,P.max):V.max,ee=Object.freeze({radix:N,bits:T,prefix:S,uppercase:P.uppercase!==!1,pad:x,group:W,groupSeparator:typeof P.groupSeparator=="string"?P.groupSeparator:" ",bitWidth:E,signed:A,min:G,max:Q<G?G:Q,nullDisplay:typeof P.nullDisplay=="string"?P.nullDisplay:"",name:a(N)});return f.add(ee),ee}function g($){if($&&f.has($))return $;if(typeof $=="string"){let P=r.get($);return P||(P=v($),r.set($,P)),P}if($&&typeof $=="object"){let P=l.get($);return P||(P=v($),l.set($,P)),P}return g("hex")}function k($){return $<0?-Math.round(-$):Math.round($)}function d($,P,N){if(P<=0||$.length<=P)return $;const T=$.length%P||P,E=[$.slice(0,T)];for(let A=T;A<$.length;A+=P)E.push($.slice(A,A+P));return E.join(N)}function p($){const P=g($),{radix:N,prefix:T,uppercase:E,pad:A,group:S,groupSeparator:x,signed:W,bitWidth:V,nullDisplay:G}=P,Q=V?2**V:0,ee=ne=>{if(C(ne)||ne==="")return G;const se=typeof ne=="number"?ne:Number(ne);if(!Number.isFinite(se))return G;const le=k(se);let me="",ve=le;le<0&&(W?(me="-",ve=-le):ve=(le%Q+Q)%Q);let fe=ve.toString(N);return fe=E?fe.toUpperCase():fe.toLowerCase(),A>0&&fe.length<A&&(fe=fe.padStart(A,"0")),S>0&&(fe=d(fe,S,x)),me+T+fe};return ee.options=P,ee}function b($,P){const N=g(P);let T=t.get(N);return T||(T=p(N),t.set(N,T)),T($)}function O($){const P=g($),{radix:N,groupSeparator:T,signed:E,min:A,max:S}=P,x=X[N],W=V=>{if(C(V))return{ok:!0,value:null,reason:"blank"};let G=String(V);if(T&&T!==""&&(G=G.split(T).join("")),G=G.replace(w,""),G==="")return{ok:!0,value:null,reason:"blank"};let Q=!1;if((G[0]==="-"||G[0]==="+")&&(Q=G[0]==="-",G=G.slice(1)),G==="")return{ok:!1,value:null,reason:"digits"};let ee=null;for(const[se,le]of j){const me=se.exec(G);if(!me)continue;const ve=G.slice(me[0].length);if(ve==="")break;if(!X[le].test(ve))return{ok:!1,value:null,reason:"digits"};ee=parseInt(ve,le);break}if(ee===null)if(x.test(G))ee=parseInt(G,N);else if(m.test(G))ee=Number(G);else return{ok:!1,value:null,reason:"digits"};if(!Number.isFinite(ee))return{ok:!1,value:null,reason:"digits"};const ne=k(Q?-ee:ee);return!E&&ne<0?{ok:!1,value:ne,reason:"negative"}:ne<A||ne>S?{ok:!1,value:ne,reason:"range"}:{ok:!0,value:ne,reason:"ok"}};return W.options=P,W}function y($,P){const N=g(P);let T=i.get(N);return T||(T=O(N),i.set(N,T)),T($)}function M($,P){const N=y($,P);return N.ok?N.value:null}function D($,P){const N=C($)||Number.isNaN($)?null:Number($),T=C(P)||Number.isNaN(P)?null:Number(P);return N===null?T===null?0:1:T===null||N<T?-1:N>T?1:0}function _($){const P=$.min>=-2147483648&&$.max<=2147483647;return $.bitWidth&&P?"int32":"float64"}function I($){const P=v($),N=p(P),T=O(P);return{base:"number",extends:"number",storage:_(P),matches:null,format:E=>N(E.value),parse:E=>{const A=T(E.text);return A.ok?A.value:null},compare:D,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:E=>N(E),fromClipboard:E=>{const A=T(E);return A.ok?A.value:null},radix:P,formatValue:N,parseText:T}}const L=I}),Ue("packages/core/src/columns/types/aggregable.js",function(e,U){"use strict";Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"weightedMean",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"logarithmicSum",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"logarithmicMean",{enumerable:!0,get:function(){return B}});const C=U("packages/core/src/internal/predicates.js").isNil;function q(H){const j=[];for(const w of H||[]){if(C(w))continue;const m=Number(w);Number.isFinite(m)&&j.push(m)}return j}function z(H){return j=>{const w=q(j);if(!w.length)return null;let m=0;for(const c of w)m+=10**(c/H);return H*Math.log10(m)}}function B(H){return j=>{const w=q(j);if(!w.length)return null;let m=0;for(const c of w)m+=10**(c/H);return H*Math.log10(m/w.length)}}function Z(H,j){const w=j&&j.column,c=(w&&w.typeOptions||{}).weight,f=j&&j.valueAt;if(!c||typeof f!="function")return null;let l=0,r=0;for(let t=0;t<H.length;t++){if(C(H[t]))continue;const i=Number(H[t]);if(!Number.isFinite(i))continue;const s=f(c,t);if(C(s))continue;const n=Number(s);!Number.isFinite(n)||n<=0||(l+=i*n,r+=n)}return r===0?null:l/r}function K(H={}){const j=H.factor===20?20:10,w=typeof H.suffix=="string"?H.suffix:"",m=Number.isInteger(H.decimals)?H.decimals:1;return{base:"number",storage:"float64",name:H.name||"logarithmic",format:c=>{const f=c&&c.value;return C(f)||!Number.isFinite(Number(f))?"":`${Number(f).toFixed(m)}${w}`},parse:c=>{const f=String((c&&c.text)??"").replace(w,"").trim();if(!f)return null;const l=Number(f);return Number.isFinite(l)?l:null},defaults:{align:"end",filter:"number"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:{sum:z(j),avg:B(j)}}}}function F(H={}){const j=Number.isInteger(H.decimals)?H.decimals:1,w=H.percent===!0;return{base:"number",storage:"float64",name:H.name||"ratio",format:m=>{const c=m&&m.value;return C(c)||!Number.isFinite(Number(c))?"":w?`${Number(c).toFixed(j)}%`:Number(c).toFixed(j)},parse:m=>{const c=String((m&&m.text)??"").replace("%","").trim();if(!c)return null;const f=Number(c);return Number.isFinite(f)?f:null},defaults:{align:"end",filter:"number"},totals:{supported:["avg","min","max","count","countValues"],implement:{avg:Z}}}}const X=Object.freeze({decibel:K({name:"decibel",factor:10,suffix:" dB"}),decibelAmplitude:K({name:"decibelAmplitude",factor:20,suffix:" dB"}),ratio:F({name:"ratio"}),percentRate:F({name:"percentRate",percent:!0})})}),Ue("packages/core/src/columns/types/currency.js",function(e,U){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"moneyToText",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});const C=U("packages/core/src/internal/predicates.js").isNil,q="⚠ no rate";function z(u){if(C(u))return null;const o=String(u).trim().toUpperCase();return o===""?null:o}function B(u){if(C(u))return null;if(typeof u=="object"&&!Array.isArray(u)){const o=Number(u.amount),a=z(u.code);return!a||!Number.isFinite(o)?null:{amount:o,code:a}}if(Array.isArray(u)&&u.length===2){const o=Number(u[0]),a=z(u[1]);return!a||!Number.isFinite(o)?null:{amount:o,code:a}}return null}const Z=Object.freeze({$:"USD","€":"EUR","£":"GBP","¥":"JPY","₹":"INR","₩":"KRW","₽":"RUB","₺":"TRY","₴":"UAH","₪":"ILS"}),K=Object.freeze({USD:"$",EUR:"€",GBP:"£",JPY:"¥",INR:"₹",KRW:"₩",RUB:"₽",TRY:"₺",UAH:"₴",ILS:"₪"}),F=/[+-]?[\d\s., ]*\d/;function X(u,o){const a=String(u).trim();if(a==="")return null;const h=new Intl.NumberFormat(o||void 0).formatToParts(1.1).find(d=>d.type==="decimal")?.value||".",v=h===","?".":",",g=a.split(v).join("").split(/[\s ]/).join("").replace(h,"."),k=Number(g);return Number.isFinite(k)?k:null}function H(u,o){const a=o||{},h=z(a.code);if(C(u))return null;const v=B(u);if(v)return v;if(typeof u=="number")return Number.isFinite(u)&&h?{amount:u,code:h}:null;let g=String(u).trim();if(g==="")return null;let k=!1;g.startsWith("(")&&g.endsWith(")")&&(k=!0,g=g.slice(1,-1).trim());let d=null;for(const[D,_]of Object.entries(Z)){if(g.startsWith(D)){d=_,g=g.slice(D.length).trim();break}if(g.endsWith(D)){d=_,g=g.slice(0,-D.length).trim();break}}const p=F.exec(g);if(!p)return null;const b=X(p[0],a.locale);if(b===null)return null;const O=(g.slice(0,p.index)+" "+g.slice(p.index+p[0].length)).trim();!d&&O!==""&&(d=z(O));const y=d||h;return y?{amount:k?-b:b,code:y}:null}function j(u,o){if(typeof u=="function")return(a,h)=>{if(a===h)return 1;const v=u(a,h);return typeof v=="number"&&Number.isFinite(v)&&v>0?v:null};if(u&&typeof u=="object"){const a=u;return(h,v)=>{if(h===v)return 1;const g=Number(a[h]),k=Number(a[v]);return!Number.isFinite(g)||!Number.isFinite(k)||g<=0||k<=0?null:k/g}}return(a,h)=>a===h?1:null}function w(u,o,a){if(!u)return null;if(u.code===o)return u.amount;const h=a(u.code,o);return h===null?null:u.amount*h}const m=new Map;function c(u,o,a){const h=`${u||""}|${o}|${a??""}`;let v=m.get(h);if(!v){const g={style:"currency",currency:o};typeof a=="number"&&(g.minimumFractionDigits=a,g.maximumFractionDigits=a);try{v={fmt:new Intl.NumberFormat(u||void 0,g),currency:!0}}catch{v={fmt:new Intl.NumberFormat(u||void 0,typeof a=="number"?{minimumFractionDigits:a,maximumFractionDigits:a}:{}),currency:!1}}m.set(h,v)}return v}function f(u,o){const a=o||{},h=a.nullDisplay??"",v=B(u);if(!v)return h;const g=z(a.display)||v.code;let k=v.amount,d=v.code;if(g!==v.code){const O=a.rateFn||j(a.rates,a.rateBase),y=w(v,g,O);if(y===null)return`${a.missingRate??q} ${v.code}→${g}`;k=y,d=g}const{fmt:p,currency:b}=c(a.locale,d,a.decimals);return b?p.format(k):`${p.format(k)} ${d}`}function l(u){const o=B(u);return o?`${o.amount} ${o.code}`:""}function r(u){const o=u||{},a=z(o.display),h=o.rateFn||j(o.rates,o.rateBase);return(v,g)=>{const k=B(v),d=B(g);if(!k&&!d)return 0;if(!k)return 1;if(!d)return-1;if(a){const p=w(k,a,h),b=w(d,a,h);if(p!==null&&b!==null)return p===b?0:p<b?-1:1}return k.code===d.code?k.amount===d.amount?0:k.amount<d.amount?-1:1:k.code<d.code?-1:1}}function t(u){const o=u||{},a=(v,g)=>{const k=[];for(const y of v||[]){const M=B(y);M&&k.push(M)}if(!k.length)return null;if(new Set(k.map(y=>y.code)).size===1){const y=k[0].code;return{amount:g(k.map(M=>M.amount)),code:y}}const p=z(o.display);if(!p)return`${o.missingRate??q}: mixed currencies, no display currency set`;const b=o.rateFn||j(o.rates,o.rateBase),O=[];for(const y of k){const M=w(y,p,b);if(M===null)return`${o.missingRate??q}: ${y.code}→${p}`;O.push(M)}return{amount:g(O),code:p}},h=v=>v.reduce((g,k)=>g+k,0);return{sum:v=>a(v,h),avg:v=>a(v,g=>h(g)/g.length),min:v=>a(v,g=>Math.min(...g)),max:v=>a(v,g=>Math.max(...g))}}function i(u){const o=Object.freeze({code:"USD",...u||{}}),a=j(o.rates,o.rateBase),h=Object.freeze({...o,rateFn:a}),v=t(h),g=r(h),k=new Map([[o.locale||"",h]]),d=O=>{const y=O||"";let M=k.get(y);return M||(M=Object.freeze({...h,locale:O||void 0}),k.set(y,M)),M},p=K[z(o.display||o.code)]||"",b=typeof o.decimals=="number"&&o.decimals>0?`.${"0".repeat(o.decimals)}`:".00";return{base:"object",extends:"object",storage:"object",name:"currency",currencyConfig:h,format:O=>f(O.value,O.locale?d(O.locale):h),parse:O=>H(O.text,O.locale?d(O.locale):h),compare:g,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:v},excel:o.excel||(p?`"${p}"#,##0${b}`:`#,##0${b}`),toStorage:O=>{const y=B(O);return y||(typeof O=="string"||typeof O=="number"?H(O,h):null)},toClipboard:O=>l(O),fromClipboard:O=>H(O,h)}}const s=Object.freeze({currency:i({code:"USD"}),usd:i({code:"USD"}),eur:i({code:"EUR"}),gbp:i({code:"GBP"}),jpy:i({code:"JPY",decimals:0})}),n=i}),Ue("packages/core/src/columns/types/index.js",function(e,U){"use strict";Object.defineProperty(e,"EXTENDED_TYPES",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return D}});const te=U("packages/core/src/columns/types/temporal.js"),C=te.TEMPORAL_TYPES,q=U("packages/core/src/columns/types/network.js"),z=q.NETWORK_TYPES,B=U("packages/core/src/columns/types/structured.js"),Z=B.STRUCTURED_TYPES,K=U("packages/core/src/columns/types/unit.js"),F=K.createUnitType,X=K.UNIT_SYSTEMS,H=K.parseUnit,j=K.formatUnit,w=K.registerUnitSystem,m=K.unitSystemNames,c=K.unitsOf,f=K.defineUnit,l=U("packages/core/src/columns/types/engineering.js"),r=l.ENGINEERING_TYPES,t=U("packages/core/src/columns/types/si.js"),i=t.SI_TYPES,s=t.createSiType,n=t.createSiSystem,u=t.siUnits,o=t.SI_PREFIXES,a=U("packages/core/src/columns/types/temperature.js"),h=a.TEMPERATURE_TYPES,v=a.createTemperatureType,g=a.convertTemperature,k=a.formatTemperature,d=a.parseTemperature,p=a.TEMPERATURE_SCALES,b=U("packages/core/src/columns/types/radix.js"),O=b.createRadixType,y=b.RADIX_PRESETS,M=b.parseRadix,D=b.formatRadix,_=U("packages/core/src/columns/types/aggregable.js"),I=_.AGGREGABLE_TYPES,L=U("packages/core/src/columns/types/currency.js"),$=L.CURRENCY_TYPES,P=L.createCurrencyType,N=L.parseMoney,T=L.formatMoney,E=L.convertMoney,A=L.toMoney,S=L.rateFunction,x=L.moneyComparator,W=L.normaliseCode,V=L.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return K.findUnit}}),Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return l.ENGINEERING_TYPES}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return l.circularMean}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return a.TEMPERATURE_TYPES}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return a.createTemperatureType}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return a.convertTemperature}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return a.formatTemperature}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return a.parseTemperature}}),Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return a.TEMPERATURE_SCALES}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return a.findScale}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return L.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return L.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return L.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return L.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return L.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return L.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return L.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return L.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return L.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return L.MISSING_RATE}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return te.TEMPORAL_TYPES}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return q.NETWORK_TYPES}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return B.STRUCTURED_TYPES}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return _.AGGREGABLE_TYPES}}),Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return _.createLogarithmicType}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return _.createRatioType}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return te.parseTime}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return te.formatTime}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return te.parseDateTime}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return te.formatDateTime}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return te.parseDuration}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return te.formatDuration}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return q.parseIpv4}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return q.formatIpv4}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return q.parseCidr}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return q.formatCidr}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return q.parseIpv6}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return q.formatIpv6}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return q.networkAddress}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return q.broadcastAddress}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return q.hostCount}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return q.containsAddress}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return q.overlaps}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return B.maskValue}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return B.summariseJson}});const G=Object.freeze({...C,...z,...Z,...I,hex:O(y.hex),hex8:O(y.hex8),hex16:O(y.hex16),hex32:O(y.hex32),binary:O(y.binary),binary8:O(y.binary8),octal:O(y.octal),bytes:F({system:"data",unit:"B",display:"auto"}),megabytes:F({system:"data",unit:"MB"}),gigabytes:F({system:"data",unit:"GB"}),bitrate:F({system:"bitrate",unit:"Mbps"}),gigabits:F({system:"bitrate",unit:"Gbps"}),...r,...i,...h,...$});{const Q=new Set;for(const ee of[C,z,Z,I,r,i,h,$])for(const ne of Object.keys(ee)){if(Q.has(ne))throw new Error(`[lattice] data type "${ne}" is declared twice`);Q.add(ne)}}}),Ue("packages/core/src/compute/handle.js",function(e,U){"use strict";Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return i}});const te=U("packages/core/src/internal/compare.js"),C=te.collator,q=te.defaultCompare,B=U("packages/core/src/internal/warn.js").warnOnce;function Z(s){const n=new Uint32Array(s);for(let u=0;u<s;u++)n[u]=u;return n}function K(s,n){if(n&&typeof n.count=="number")return n.count;if(!s)return 0;if(typeof s.count=="number")return s.count;if(typeof s.length=="number")return s.length;const u=s.values;return s.kind==="multi"&&s.offsets?Math.max(0,s.offsets.length-1):u?s.kind==="bitset"?typeof u.size=="number"?u.size:s.presence&&typeof s.presence.size=="number"?s.presence.size:(B(`count:${s.id}`,`column "${s.id}" is bitset-backed with no declared row count; assuming ${u.length*8}`),u.length*8):u.length:s.presence&&typeof s.presence.size=="number"?s.presence.size:0}const F=new WeakMap;function X(s){const n=s.constructor;if(!n)return"unknown";const u=F.get(n);if(u)return u;let o="unknown";try{let a=null;typeof n.from=="function"?a=n.from([!1,!0]):(a=new n(8),a.set(1));const h=a&&a.words;h&&h.length&&(h[0]===2?o="lsb":h[0]===64&&(o="msb"))}catch{o="unknown"}return F.set(n,o),o}function H(s){if(!s)return()=>0;const n=s instanceof Uint8Array?s:s.words;if(n instanceof Uint8Array){const u=s instanceof Uint8Array?"lsb":X(s);if(u==="lsb")return o=>n[o>>>3]>>>(o&7)&1;if(u==="msb")return o=>n[o>>>3]>>>7-(o&7)&1}return typeof s.get=="function"?u=>s.get(u)?1:0:()=>0}function j(s){return!s||!s.presence?null:H(s.presence)}function w(s){return s?typeof s.size=="number"?s.size:typeof s.values=="function"?s.values().length:0:0}function m(s,n){return s?typeof s.valueOf=="function"?s.valueOf(n):typeof s.values=="function"?s.values()[n]:null:null}function c(s,n){const u=s.offsets,o=s.values;if(!u||!o)return[];const a=u[n],h=u[n+1];if(!(h>a))return[];const v=s.dict,g=new Array(h-a);for(let k=a;k<h;k++)g[k-a]=v?m(v,o[k]):o[k];return g}function f(s){if(!s)return()=>{};const n=s.values,u=j(s),o=s.kind;if(o==="dictionary"){const a=s.dict;return u?h=>u(h)?m(a,n[h]):null:h=>m(a,n[h])}if(o==="bitset"){const a=H(n);return u?h=>u(h)?a(h)===1:null:h=>a(h)===1}if(o==="multi")return u?a=>u(a)?c(s,a):null:a=>c(s,a);if(!n&&typeof s.get=="function"){const a=s.get.bind(s);return h=>{const v=a(h);return v===void 0?null:v}}return u?a=>{if(!u(a))return null;const h=n[a];return h===void 0?null:h}:a=>{const h=n[a];return h===void 0?null:h}}function l(s,n){if(s<n)return-1;if(s>n)return 1;if(s===n){const a=Object.is(s,-0),h=Object.is(n,-0);return a===h?0:a?-1:1}const u=Number.isNaN(s),o=Number.isNaN(n);return u&&o?0:u?1:-1}function r(s){const n=C(s);return(u,o)=>{if(u===o)return 0;const a=typeof u,h=typeof o;if(a==="string"&&h==="string")return n.compare(u,o);if(a==="number"&&h==="number")return l(u,o);if(a==="boolean"&&h==="boolean")return u===o?0:u?1:-1;if(u instanceof Date||o instanceof Date){const v=u instanceof Date?u.getTime():Number(u),g=o instanceof Date?o.getTime():Number(o);return l(v,g)}return q(u,o)}}function t(s,n){if(s&&typeof s.ranks=="function")return s.ranks(n);const u=s&&typeof s.values=="function"?s.values():[],o=u.length,a=r(n),h=new Array(o);for(let g=0;g<o;g++)h[g]=g;h.sort((g,k)=>a(u[g],u[k])||g-k);const v=new Uint32Array(o);for(let g=0;g<o;g++)v[h[g]]=g;return v}function i(s){return s==null||typeof s=="number"&&Number.isNaN(s)}}),Ue("packages/core/src/compute/filter.js",function(e,U){"use strict";Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"wallMs",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return ve}});const C=U("packages/core/src/internal/predicates.js").isBlank,z=U("packages/core/src/internal/merge.js").toArray,Z=U("packages/core/src/internal/warn.js").warnOnce,K=U("packages/core/src/format/date.js"),F=K.toDate,X=K.toIsoDate,H=U("packages/core/src/compute/handle.js"),j=H.bitReader,w=H.dictSize,m=H.dictValue,c=H.presenceReader,f=H.valueComparator,l=H.valueReader,r=/^\d{4}-\d{2}-\d{2}$/,t="\0null\0";function i(fe,xe){const He=fe&&fe.pool;if(He){const Be=He.mask||He.acquireMask||He.acquire||He.take;if(typeof Be=="function"){const ae=Be.call(He,xe);if(ae&&ae.length>=xe)return ae}}return new Uint8Array(xe)}function s(fe,xe){const He=fe&&fe.pool;if(!He||!xe)return;const Be=He.release||He.releaseMask||He.free||He.recycle;typeof Be=="function"&&Be.call(He,xe)}function n(fe,xe,He){return fe.fill(He,0,xe),fe}function u(fe){return fe==null||typeof fe=="number"&&Number.isNaN(fe)}function o(fe,xe){if(fe==null)return fe;if(xe==="number")return typeof fe=="number"?fe:Number(fe);if(xe==="date"||xe==="dateString"){const He=X(fe);return He===null?a(fe):He}return xe==="boolean"?typeof fe=="boolean"?fe:fe==="true"||fe===1?!0:fe==="false"||fe===0?!1:!!fe:fe}function a(fe){return fe instanceof Date?fe.getTime():typeof fe=="number"?fe:Date.parse(String(fe))}function h(fe){return typeof fe=="number"?fe:fe instanceof Date?fe.getTime():fe==null||fe===""?NaN:Number(fe)}function v(fe,xe){const He=typeof fe=="string"?fe:String(fe);return xe?He:He.toLowerCase()}function g(fe,xe){return fe==null?t:typeof fe=="string"?xe?fe:fe.toLowerCase():fe instanceof Date?fe.getTime():fe}function k(fe,xe,He){const Be=new Set;for(const ae of z(fe)){const Ae=o(ae,He);Be.add(g(Ae,xe)),typeof Ae=="string"&&Ae!==""&&Number.isFinite(Number(Ae))?Be.add(Number(Ae)):typeof Ae=="number"&&Number.isFinite(Ae)&&Be.add(g(String(Ae),xe))}return Be}function d(fe,xe,He){if(fe==null||xe===null||xe===void 0)return fe==null&&xe==null;const Be=typeof fe,ae=typeof xe;return Be==="string"&&ae==="string"?He?fe===xe:fe.toLowerCase()===xe.toLowerCase():fe instanceof Date||xe instanceof Date?a(fe)===a(xe):Be==="number"&&ae==="number"?fe===xe||Number.isNaN(fe)&&Number.isNaN(xe):Be==="number"&&ae==="string"?fe===Number(xe):Be==="string"&&ae==="number"?Number(fe)===xe:Be==="boolean"||ae==="boolean"?fe===xe:Array.isArray(fe)&&Array.isArray(xe)?fe.length===xe.length&&fe.every((Ae,Me)=>d(Ae,xe[Me],He)):fe===xe}function p(fe,xe){try{if(fe instanceof RegExp){const He=fe.flags.replace(/[gy]/g,"");return new RegExp(fe.source,xe||He.includes("i")?He:`${He}i`)}return new RegExp(String(fe),xe?"":"i")}catch(He){return Z(`regex:${String(fe)}`,`filter operator "matches" received an invalid pattern: ${String(fe)}`,He),null}}function b(fe,xe){if(fe&&fe.type==="datetime"&&O.has(fe.op))return I(fe,xe);const He=L(fe,xe),Be=fe&&fe.type;return Be!=="date"&&Be!=="dateString"?He:ae=>He(typeof ae=="string"&&r.test(ae)?ae:X(ae)??ae)}const O=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn"]),y=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3})\d*)?)?)?$/,M=new Map;function D(fe,xe){let He=M.get(xe);if(He===void 0){try{He=new Intl.DateTimeFormat("en-CA",{timeZone:xe,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{He=null}M.set(xe,He)}if(!He)return null;const Be={};for(const ae of He.formatToParts(fe))ae.type!=="literal"&&(Be[ae.type]=ae.value);return Be}function _(fe,xe){if(fe==null||fe==="")return null;if(typeof fe=="string"){const Ae=y.exec(fe.trim());if(Ae)return Date.UTC(+Ae[1],+Ae[2]-1,+Ae[3],+(Ae[4]||0),+(Ae[5]||0),+(Ae[6]||0),+(Ae[7]||"0").padEnd(3,"0"))}const He=F(fe);if(!He)return null;const Be=He.getUTCMilliseconds(),ae=xe?D(He,xe):null;return ae?Date.UTC(+ae.year,+ae.month-1,+ae.day,ae.hour==="24"?0:+ae.hour,+ae.minute,+ae.second,Be):Date.UTC(He.getFullYear(),He.getMonth(),He.getDate(),He.getHours(),He.getMinutes(),He.getSeconds(),Be)}function I(fe,xe){const He=typeof fe.timeZone=="string"&&fe.timeZone?fe.timeZone:void 0,Be=Me=>_(Me,He),ae=Array.isArray(fe.value)?fe.value.map(Be):Be(fe.value),Ae=L({...fe,type:"number",value:ae},xe);return Me=>Ae(_(Me))}function L(fe,xe){const He=fe&&fe.op,Be=!!(fe&&fe.caseSensitive),ae=fe&&fe.type,Ae=f(xe),Me=Re=>pe=>!Re(pe);switch(He){case"eq":{const Re=o(fe.value,ae);return pe=>d(pe,Re,Be)}case"ne":{const Re=o(fe.value,ae);return pe=>!d(pe,Re,Be)}case"lt":case"lte":case"gt":case"gte":{const Re=o(fe.value,ae);if(u(Re))return()=>!1;const pe=He==="lt"?-1:He==="lte"?0:He==="gt"?1:2;return $e=>{if(u($e))return!1;const ce=Ae($e,Re);return pe===-1?ce<0:pe===0?ce<=0:pe===1?ce>0:ce>=0}}case"between":case"notBetween":{const Re=z(fe.value),pe=o(Re[0],ae),$e=o(Re[1],ae),ce=fe.bounds||"[]",ge=ce.charAt(0)!=="(",je=ce.charAt(1)!==")";if(u(pe)||u($e))return He==="between"?()=>!1:()=>!0;const Ve=Se=>{if(u(Se))return!1;const Ge=Ae(Se,pe),Ce=Ae(Se,$e);return(ge?Ge>=0:Ge>0)&&(je?Ce<=0:Ce<0)};return He==="between"?Ve:Me(Ve)}case"in":case"notIn":{const Re=k(fe.value,Be,ae),pe=$e=>Re.has(g($e,Be));return He==="in"?pe:Me(pe)}case"contains":case"notContains":{const Re=v(o(fe.value,ae),Be),pe=$e=>$e==null?!1:v($e,Be).includes(Re);return He==="contains"?pe:Me(pe)}case"startsWith":{const Re=v(o(fe.value,ae),Be);return pe=>pe==null?!1:v(pe,Be).startsWith(Re)}case"endsWith":{const Re=v(o(fe.value,ae),Be);return pe=>pe==null?!1:v(pe,Be).endsWith(Re)}case"matches":{const Re=p(fe.value,Be);return Re?pe=>pe==null?!1:Re.test(String(pe)):()=>!1}case"blank":return Re=>C(Re)||Array.isArray(Re)&&Re.length===0;case"notBlank":return Re=>!(C(Re)||Array.isArray(Re)&&Re.length===0);case"containsAny":case"containsNone":{const Re=k(fe.value,Be,ae),pe=$e=>{const ce=$e==null?[]:z($e);for(let ge=0;ge<ce.length;ge++)if(Re.has(g(ce[ge],Be)))return!0;return!1};return He==="containsAny"?pe:Me(pe)}case"containsAll":{const Re=z(fe.value).map(pe=>g(o(pe,ae),Be));return pe=>{const $e=pe==null?[]:z(pe);if(Re.length===0)return!0;const ce=new Set($e.map(ge=>g(ge,Be)));for(let ge=0;ge<Re.length;ge++)if(!ce.has(Re[ge]))return!1;return!0}}default:{const Re=ve(He);return Re?Re.compile(fe.value):(Z(`op:${String(He)}`,`unknown filter operator "${String(He)}"; the condition is refused rather than matching every row`),()=>!1)}}}function $(fe,xe,He){return b(xe,He)(fe)}const P=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),N=new Set(["containsAny","containsAll","containsNone"]);function T(fe,xe,He){const Be=fe&&fe.op,ae=P[Be]||Be,Ae=b({...fe,op:ae,type:xe.type},He),Me=xe.items,Re=pe=>{const $e=Me(pe);if(!$e)return!1;for(let ce=0;ce<$e.length;ce++)if(Ae($e[ce]))return!0;return!1};return P[Be]?pe=>!Re(pe):Re}function E(fe,xe,He,Be){const ae=c(fe);if(ae){const Re=xe?1:0;for(let pe=0;pe<Be;pe++)He[pe]=ae(pe)===Re?1:0;return He}const Ae=fe.kind;if(Ae==="float64"||Ae==="int32"||Ae==="bitset")return n(He,Be,xe?1:0);const Me=l(fe);for(let Re=0;Re<Be;Re++){const pe=Me(Re),$e=C(pe)||Array.isArray(pe)&&pe.length===0;He[Re]=$e===xe?0:1}return He}function A(fe,xe,He,Be){const ae=fe.dict,Ae=w(ae),Me=new Uint8Array(Ae);for(let ce=0;ce<Ae;ce++)Me[ce]=xe(m(ae,ce))?1:0;const Re=fe.values,pe=c(fe);if(!pe){for(let ce=0;ce<Be;ce++)He[ce]=Me[Re[ce]];return He}const $e=xe(null)?1:0;for(let ce=0;ce<Be;ce++)He[ce]=pe(ce)===1?Me[Re[ce]]:$e;return He}function S(fe,xe,He,Be){const ae=j(fe.values),Ae=xe(!0)?1:0,Me=xe(!1)?1:0,Re=c(fe);if(!Re){for(let $e=0;$e<Be;$e++)He[$e]=ae($e)===1?Ae:Me;return He}const pe=xe(null)?1:0;for(let $e=0;$e<Be;$e++)He[$e]=Re($e)===0?pe:ae($e)===1?Ae:Me;return He}function x(fe,xe,He,Be,ae){const Ae=fe.values,Me=xe.type,Re=xe.op;let pe=!0;switch(Re){case"eq":case"ne":{const ce=h(o(xe.value,Me)),ge=typeof xe.value=="number"&&Number.isNaN(xe.value),je=Re==="ne"?1:0;if(ge)for(let Ve=0;Ve<ae;Ve++)Be[Ve]=(Number.isNaN(Ae[Ve])?1:0)^je;else for(let Ve=0;Ve<ae;Ve++)Be[Ve]=(Ae[Ve]===ce?1:0)^je;break}case"lt":{const ce=h(o(xe.value,Me));for(let ge=0;ge<ae;ge++)Be[ge]=Ae[ge]<ce?1:0;break}case"lte":{const ce=h(o(xe.value,Me));for(let ge=0;ge<ae;ge++)Be[ge]=Ae[ge]<=ce?1:0;break}case"gt":{const ce=h(o(xe.value,Me));for(let ge=0;ge<ae;ge++)Be[ge]=Ae[ge]>ce?1:0;break}case"gte":{const ce=h(o(xe.value,Me));for(let ge=0;ge<ae;ge++)Be[ge]=Ae[ge]>=ce?1:0;break}case"between":case"notBetween":{const ce=z(xe.value),ge=h(o(ce[0],Me)),je=h(o(ce[1],Me)),Ve=xe.bounds||"[]",Se=Ve.charAt(0)!=="(",Ge=Ve.charAt(1)!==")",Ce=Re==="notBetween"?1:0;if(Se&&Ge)for(let Te=0;Te<ae;Te++)Be[Te]=(Ae[Te]>=ge&Ae[Te]<=je?1:0)^Ce;else if(Se)for(let Te=0;Te<ae;Te++)Be[Te]=(Ae[Te]>=ge&Ae[Te]<je?1:0)^Ce;else if(Ge)for(let Te=0;Te<ae;Te++)Be[Te]=(Ae[Te]>ge&Ae[Te]<=je?1:0)^Ce;else for(let Te=0;Te<ae;Te++)Be[Te]=(Ae[Te]>ge&Ae[Te]<je?1:0)^Ce;break}case"in":case"notIn":{const ce=new Set;for(const je of z(xe.value)){const Ve=h(o(je,Me));Number.isNaN(Ve)||ce.add(Ve)}const ge=Re==="notIn"?1:0;for(let je=0;je<ae;je++)Be[je]=(ce.has(Ae[je])?1:0)^ge;break}default:pe=!1;break}if(!pe)return!1;const $e=c(fe);if($e){const ce=He(null)?1:0;for(let ge=0;ge<ae;ge++)$e(ge)===0&&(Be[ge]=ce)}return!0}function W(fe,xe,He,Be){const ae=l(fe);for(let Ae=0;Ae<Be;Ae++)He[Ae]=xe(ae(Ae))?1:0;return He}function V(fe,xe,He){const Be=xe.count|0,ae=He||i(xe,Be);if(!fe)return n(ae,Be,1);const Ae=typeof xe.handle=="function"?xe.handle(fe.col):void 0,Me=typeof xe.custom=="function"?xe.custom:null;if(!Ae){if(Me){for(let ce=0;ce<Be;ce++)ae[ce]=Me(fe,ce)?1:0;return ae}return Z(`filter:col:${String(fe.col)}`,`filter references unknown column "${String(fe.col)}"; the condition is refused rather than matching every row`),n(ae,Be,0)}const Re=fe.op;if(Re==="blank"||Re==="notBlank")return E(Ae,Re==="notBlank",ae,Be);const pe=typeof xe.itemwise=="function"?xe.itemwise(fe.col):null;if(pe&&!ve(Re)&&!N.has(Re))return W(Ae,T(fe,pe,xe.locale),ae,Be);const $e=b(fe,xe.locale);switch(Ae.kind){case"dictionary":return A(Ae,$e,ae,Be);case"bitset":return S(Ae,$e,ae,Be);case"float64":case"int32":return x(Ae,fe,$e,ae,Be)?ae:W(Ae,$e,ae,Be);default:return W(Ae,$e,ae,Be)}}function G(fe,xe,He){if(!fe)return n(i(xe,He),He,1);if(Array.isArray(fe.conditions)){const Be=fe.conditions.filter(Me=>Me!=null),ae=fe.op==="or"?"or":fe.op==="not"?"not":"and";if(Be.length===0)return n(i(xe,He),He,1);const Ae=G(Be[0],xe,He);for(let Me=1;Me<Be.length;Me++){const Re=G(Be[Me],xe,He);if(ae==="or")for(let pe=0;pe<He;pe++)Ae[pe]|=Re[pe];else for(let pe=0;pe<He;pe++)Ae[pe]&=Re[pe];s(xe,Re)}if(ae==="not")for(let Me=0;Me<He;Me++)Ae[Me]^=1;return Ae}return V(fe,xe,i(xe,He))}function Q(fe,xe){return G(fe,xe,xe.count|0)}function ee(fe,xe){if(!fe||!xe)return fe||null;const He=fe;if(Array.isArray(He.conditions)){if((He.op==="or"?"or":He.op==="not"?"not":"and")!=="and")return ne(He,xe)?null:fe;const ae=[];for(const Ae of He.conditions){const Me=ee(Ae,xe);Me&&ae.push(Me)}return ae.length?{...He,op:"and",conditions:ae}:null}return He.col===xe?null:fe}function ne(fe,xe){if(!fe||typeof fe!="object")return!1;const He=fe;if(He.col===xe)return!0;if(Array.isArray(He.conditions)){for(const Be of He.conditions)if(ne(Be,xe))return!0}return!1}function se(fe,xe,He){if(He&&He.length>=xe){let Me=0;for(let Re=0;Re<xe;Re++)fe[Re]&&(He[Me++]=Re);return He.subarray(0,Me)}let Be=0;for(let Me=0;Me<xe;Me++)Be+=fe[Me]?1:0;const ae=new Uint32Array(Be);let Ae=0;for(let Me=0;Me<xe;Me++)fe[Me]&&(ae[Ae++]=Me);return ae}const le=new Map;function me(fe){if(!(!fe||typeof fe!="object"))for(const[xe,He]of Object.entries(fe))He&&typeof He.compile=="function"&&le.set(xe,He)}function ve(fe){return typeof fe=="string"?le.get(fe):void 0}}),Ue("packages/core/src/columns/datatypes.js",function(e,U){"use strict";Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"parseNumberText",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"BUILTIN_TYPES",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return T}});const te=U("packages/core/src/internal/compare.js"),C=te.collator,q=te.defaultCompare,z=U("packages/core/src/internal/predicates.js"),B=z.isNil,Z=z.isObject,K=z.isFunction,X=U("packages/core/src/internal/warn.js").fail,j=U("packages/core/src/internal/text.js").titleCase,w=U("packages/core/src/format/date.js"),m=w.toDate,c=w.toIsoDate,f=w.compareIso,r=U("packages/core/src/format/boolean.js").toTriState,i=U("packages/core/src/columns/types/index.js").EXTENDED_TYPES,s=U("packages/core/src/formula/index.js"),n=s.evaluateFormula,u=s.looksLikeFormula,a=U("packages/core/src/compute/filter.js").declareOperators,h=/^\d{4}-\d{2}-\d{2}$/;function v(E){return E.getHours()===0&&E.getMinutes()===0&&E.getSeconds()===0&&E.getMilliseconds()===0}const g=new Map;function k(E){const A=E||"",S=g.get(A);if(S)return S;const x={group:",",decimal:"."};try{for(const W of new Intl.NumberFormat(E||void 0).formatToParts(12345.6))W.type==="group"?x.group=W.value:W.type==="decimal"&&(x.decimal=W.value)}catch{}return g.set(A,x),x}const d=/\d\s*[*/^]\s*[\d.(]/;function p(E,A){if(B(E))return null;let S=String(E).trim();if(S===""||S.startsWith("=")||d.test(S))return null;let x=1;S.startsWith("(")&&S.endsWith(")")&&(x=-1,S=S.slice(1,-1));const W=S.endsWith("%"),{group:V,decimal:G}=k(A);if(S=S.replace(/[\s\u00a0\u202f\u2009']/g,""),V&&V!=="."&&V!==","&&(S=S.split(V).join("")),S=S.replace(/[^0-9eE+\-.,]/g,""),G===","?S=S.split(".").join("").replace(",","."):S=S.split(",").join(""),S===""||S==="-"||S==="+")return null;const Q=Number(S);return Number.isNaN(Q)?null:x*(W?Q/100:Q)}function b(E,A){const S=B(E)||Number.isNaN(E)?null:Number(E),x=B(A)||Number.isNaN(A)?null:Number(A);return S===null?x===null?0:1:x===null||S<x?-1:S>x?1:0}function O(E,A){const S=r(E),x=r(A);return S===null?x===null?0:1:x===null?-1:S===x?0:S?1:-1}function y(E,A){const S=m(E),x=m(A);if(!S)return x?1:0;if(!x)return-1;const W=S.getTime(),V=x.getTime();return W<V?-1:W>V?1:0}const M=new Map;function D(E){const A=m(E.value);if(!A)return"";const S=E.locale||"";let x=M.get(S);return x||(x=new Intl.DateTimeFormat(E.locale||void 0,{dateStyle:"medium"}),M.set(S,x)),x.format(A)}const _={boolean:{base:"boolean",storage:"bitset",matches:E=>typeof E=="boolean",parse:E=>r(E.text),compare:O,format:E=>r(E.value)===null?"":r(E.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:E=>r(E)===null?"":String(r(E)),fromClipboard:E=>r(E)},number:{base:"number",storage:"float64",matches:E=>typeof E=="number"&&!Number.isNaN(E),parse:E=>{if(u(E.text)){const A=n(E.text,E);if(!A.ok)return null;const S=Number(A.value);return Number.isFinite(S)?S:null}return p(E.text,E.locale)},compare:b,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:E=>B(E)?"":String(E),fromClipboard:(E,A)=>p(E,A&&A.locale)},date:{base:"dateString",storage:"dictionary",matches:E=>typeof E=="string"&&h.test(E)&&!Number.isNaN(Date.parse(E))||E instanceof Date&&!Number.isNaN(E.getTime())&&v(E),parse:E=>c(E.text),compare:f,format:D,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:E=>c(E),toClipboard:E=>B(E)?"":String(E),fromClipboard:E=>c(E)},dateString:{base:"dateString",storage:"dictionary",matches:E=>typeof E=="string"&&h.test(E)&&!Number.isNaN(Date.parse(E)),parse:E=>c(E.text),compare:f,format:D,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:E=>c(E),toClipboard:E=>B(E)?"":String(E),fromClipboard:E=>c(E)},text:{base:"text",storage:"dictionary",matches:E=>typeof E=="string",parse:E=>E.text===""?null:String(E.text),compare:(E,A)=>B(E)?B(A)?0:1:B(A)?-1:C().compare(String(E),String(A)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:E=>B(E)?"":String(E),fromClipboard:E=>E},image:{base:"text",storage:"dictionary",parse:E=>E.text===""||E.text==null?null:String(E.text).trim(),compare:(E,A)=>B(E)?B(A)?0:1:B(A)?-1:C().compare(String(E),String(A)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:E=>B(E)?"":String(E),fromClipboard:E=>E},lookup:{base:"text",storage:"dictionary",parse:E=>{if(E.text===""||E.text==null)return null;const A=E.column&&E.column.lookup,S=A&&K(A.options)?A.options():null;if(!S)return E.text;const x=String(E.text),W=S.find(Q=>String(Q.id)===x);if(W)return W.id;const V=x.trim().toLowerCase(),G=S.find(Q=>String(Q.label).toLowerCase()===V);return G?G.id:E.text},compare:q,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:E=>B(E)?"":String(E),fromClipboard:E=>E},object:{base:"object",storage:"object",matches:E=>E!==null&&typeof E=="object"&&!(E instanceof Date),parse:E=>{try{return E.text===""?null:JSON.parse(E.text)}catch{return E.text}},compare:(E,A)=>q(E,A),format:E=>{const A=E.value;if(B(A))return"";if(typeof A=="string")return A;try{return JSON.stringify(A)}catch{return String(A)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:E=>B(E)?"":typeof E=="string"?E:JSON.stringify(E),fromClipboard:E=>E}},I=["boolean","number","date","dateString","datetime","text","object"];function L(E,A,S,x){const W=S.get(E);if(W)return W;x.includes(E)&&X(`circular data type extends chain: ${[...x,E].join(" → ")}`);const V=A[E];V||X(`unknown data type "${E}"`);let G=null;V.extends&&(G=L(V.extends,A,S,[...x,E]));const Q={...G||{},...V,name:E,defaults:{...G&&G.defaults||{},...V.defaults||{}}};return Q.base||(Q.base=G&&G.base||"text"),Q.storage||(Q.storage=G&&G.storage||"object"),S.set(E,Q),Q}function $(E,A){const S={..._,...i};if(A&&typeof A.dataType=="function"&&typeof A.names=="function")for(const W of A.names("dataType")){const V=A.dataType(W);V&&(S[W]=V)}if(Z(E))for(const[W,V]of Object.entries(E))S[W]=V;const x=new Map;for(const W of I)L(W,S,x,[]);L("lookup",S,x,[]);for(const W of Object.keys(S))L(W,S,x,[]);for(const W of x.values())a(W.operators);return x}function P(E,A){if(E.base==="text"&&(!E.compare||E.compare===_.text.compare)){const S=C(A);return(x,W)=>B(x)?B(W)?0:1:B(W)?-1:S.compare(String(x),String(W))}return E.compare||q}function N(E,A){return A?E.multiStorage||"multi":E.storage||"object"}function T(E){return j(String(E).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),Ue("packages/core/src/columns/infer.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_SAMPLE",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"inferFromValues",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return K}});const C=U("packages/core/src/internal/warn.js").infoOnce,z=U("packages/core/src/internal/predicates.js").isNil,B=100;function Z(F,X,H={}){const j=H.sampleSize??B,w=[];for(let m=0;m<F.length&&w.length<j;m++){const c=F[m];z(c)||typeof c=="number"&&Number.isNaN(c)||w.push(c)}if(w.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[m,c]of X){if(typeof c.matches!="function")continue;let f=!0;for(let l=0;l<w.length;l++)if(!c.matches(w[l])){f=!1;break}if(f)return{type:m,unanimous:!0,sampled:w.length}}return H.quiet||C(`infer:${H.colId||"?"}`,`column "${H.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:w.length}}function K(F,X,H,j,w={}){const m=w.sampleSize??B,c=[];for(let f=0;f<X.length&&c.length<m;f++){const l=H(X[f]);z(l)||typeof l=="number"&&Number.isNaN(l)||c.push(l)}return Z(c,j,{...w,colId:F}).type}}),Ue("packages/core/src/columns/graph.js",function(e,U){"use strict";Object.defineProperty(e,"WHOLE_ROW",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"declarationOf",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return j}});const te=U("packages/core/src/internal/warn.js"),C=te.DEV,q=te.fail,z=te.warnOnce,Z=U("packages/core/src/internal/predicates.js").isFunction,K="*";function F(w){const m=w.value||{};if(!Z(m.compute))return{computed:!1,wholeRow:!1,deps:[],pure:!0};const f=m.pure!==!1;return m.deps===K?{computed:!0,wholeRow:!0,deps:[],pure:f}:Array.isArray(m.deps)?{computed:!0,wholeRow:!1,deps:m.deps.slice(),pure:f}:(z(`deps:missing:${w.id}`,`computed column "${w.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:f})}function X(w){const m=new Map;for(const h of w)m.set(h.id,h);const c=new Map,f=new Map,l=new Set,r=new Set,t=new Set,i=new Set;for(const h of w){const v=F(h);if(!v.computed){c.set(h.id,[]);continue}r.add(h.id),(v.pure?t:i).add(h.id),v.wholeRow&&l.add(h.id);const g=[],k=[];for(const d of v.deps)(m.has(d)?g:k).push(d);c.set(h.id,g),k.length&&f.set(h.id,k)}for(const h of t)for(const v of c.get(h))i.has(v)&&q(`pure computed column "${h}" depends on impure column "${v}". Mark it \`value.pure: false\` or make the dependency pure.`);const s=[],n=new Map,u=[],o=h=>{const v=n.get(h);if(v!=="done"){if(v==="open"){const g=u.indexOf(h);q(`circular column dependency: ${[...u.slice(g),h].join(" → ")}`)}n.set(h,"open"),u.push(h);for(const g of c.get(h)||[])m.has(g)&&o(g);u.pop(),n.set(h,"done"),s.push(h)}};for(const h of w)o(h.id);const a=new Map;for(const h of w)a.set(h.id,[]);for(const h of w)for(const v of c.get(h.id)||[]){const g=a.get(v);g&&!g.includes(h.id)&&g.push(h.id)}if(l.size)for(const h of w){if(r.has(h.id))continue;const v=a.get(h.id);for(const g of l)v.includes(g)||v.push(g)}return{order:s,dependents:a,pure:t,impure:i,computed:r,deps:c,wholeRow:l,external:f,index:m}}function H(w,m){const c=Array.isArray(m)?m:[m],f=new Set,l=[...c];for(;l.length;){const r=l.shift();for(const t of w.dependents.get(r)||[])f.has(t)||(f.add(t),l.push(t))}for(const r of c)f.delete(r);return w.order.filter(r=>f.has(r))}function j(w,m,c){if(!C)return w;const f=m instanceof Set?m:new Set(m);return new Proxy(w,{get(l,r){return typeof r=="string"&&!f.has(r)&&!Object.hasOwn(l,r)&&z(`undeclared:${c}:${r}`,`computed column "${c}" read undeclared dependency "${r}". Add it to \`value.deps\` or the value will go stale.`),l[r]}})}}),Ue("packages/core/src/model/rowkey.js",function(e,U){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"compositeKey",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createRowKey",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"warnMissingKeys",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"groupPathKey",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"splitPathKey",{enumerable:!0,get:function(){return r}});const C=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/internal/paths.js").pathGetter,B=U("packages/core/src/internal/predicates.js"),Z=B.isFunction,K=B.isBlank,F=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],X="";function H(t){if(t===null)return"\0n";if(t===void 0)return"\0u";const i=typeof t;if(i==="string")return t;if(i==="number"||i==="bigint"||i==="boolean")return String(t);if(t instanceof Date)return`\0d${t.getTime()}`;try{return`\0o${JSON.stringify(t)}`}catch{return"\0o?"}}function j(t){if(t.length===1)return H(t[0]);let i="";for(let s=0;s<t.length;s++)s&&(i+=X),i+=H(t[s]);return i}function w(t,i={}){const s=i.warn!==!1;if(Z(t)){const n=t;return{stable:!0,fields:[],disabled:[],key(u,o){try{const a=n(u);return Array.isArray(a)?j(a):H(a)}catch(a){return C("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",a),`#${o??-1}`}},keyEmpty(u){try{const o=n(u);return Array.isArray(o)?o.length===0||o.some(K):K(o)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(t)&&t.length>0){const n=t.filter(a=>typeof a=="string"),u=n.map(a=>z(a)),o=u.length;return{stable:!0,fields:n,disabled:[],key(a){const h=new Array(o);for(let v=0;v<o;v++)h[v]=u[v](a);return j(h)},keyEmpty(a){for(let h=0;h<o;h++)if(K(u[h](a)))return!0;return!1},missingFields(a){const h=[];for(let v=0;v<o;v++)K(u[v](a))&&h.push(n[v]);return h}}}if(typeof t=="string"&&t.length>0){const n=z(t);return{stable:!0,fields:[t],disabled:[],key(u){return H(n(u))},keyEmpty(u){return K(n(u))},missingFields(u){return K(n(u))?[t]:[]}}}return s&&C("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${F.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:F.slice(),key(n,u){if(n===null||typeof n!="object")return`#${u??0}:${String(n)}`;let o=m.get(n);return o===void 0&&(o=`#${c++}`,m.set(n,o)),o}}}const m=new WeakMap;let c=0;function f(t,i){if(!t||t.stable===!1||!Z(t.keyEmpty)||!Array.isArray(i)||i.length===0)return;let s=0,n=null,u;for(let v=0;v<i.length;v++){const g=i[v];t.keyEmpty(g)&&(s++,n===null&&(n=Z(t.missingFields)?t.missingFields(g):[],u=g))}if(s===0)return;const o=t.fields.length?t.fields.join(","):"(function)",a=n&&n.length?n.join(", "):t.fields.length?t.fields.join(", "):"the rowKey function",h=u!==null&&typeof u=="object"?Object.keys(u).join(", ")||"(no fields)":String(u);C(`rowKey.emptyValue:${o}`,`rowKey ${a} is missing on ${s} of ${i.length} rows; the first such row has: ${h}. 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 l(t){return j(t)}function r(t){return t.split(X)}}),Ue("packages/core/src/columns/lookup.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_SEPARATOR",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"normaliseOption",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"Lookup",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toValueArray",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"createLookup",{enumerable:!0,get:function(){return t}});const te=U("packages/core/src/internal/compare.js"),C=te.collator,q=te.defaultCompare,z=U("packages/core/src/internal/predicates.js"),B=z.isFunction,Z=z.isNil,F=U("packages/core/src/internal/warn.js").warnOnce,H=U("packages/core/src/model/rowkey.js").compositeKey,j=", ",w="";function m(i,s,n,u){if(i===null||typeof i!="object")return{id:i,label:i==null?"":String(i)};const o=i[s],a=i[n],h={id:o,label:a==null?String(o??""):String(a)};i.disabled&&(h.disabled=!0),i.variant&&(h.variant=i.variant),i.icon&&(h.icon=i.icon);const v=u?i[u]:i.group;return v!==void 0&&(h.group=v),h}function c(i,s,n=0,u=[],o=[]){for(const a of i||[]){const h=a&&typeof a=="object"?a[s]:null;if(o.push({raw:a,depth:n,path:u}),Array.isArray(h)&&h.length){const v=String(a&&typeof a=="object"?a.label??a.name??a.id??"":a);c(h,s,n+1,[...u,v],o)}}return o}function f(i){return!!i&&typeof i=="object"&&!Array.isArray(i)&&B(i.router&&i.router.subscribe)}class l{#e;#t;#n;#r;#s=[];#i=new Map;#o=new Map;#l=0;#a="idle";#c=null;#u;#d=null;#f=new Map;constructor(s,n={}){this.#e=s||{},this.#t=n.colId||"?",this.#n=n.locale,this.#r=n.onChange||null,this.#u=C(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??j}get allowCustom(){return this.#e.allowCustom===!0}get sortBy(){return this.#e.sortBy||"label"}get spec(){return this.#e}options(){return this.#s}setLocale(s){this.#n=s,this.#u=C(s)}#h(s){const n=this.#e,u=n.valueKey||"id",o=n.labelKey||"label",a=n.childrenKey||"children";this.#s=c(s,a).map(h=>{const v=m(h.raw,u,o,n.groupKey);return h.depth&&(v.depth=h.depth,v.path=h.path),v}),this.#i=new Map,this.#o=new Map,this.#s.forEach((h,v)=>{this.#i.set(h.id,h),this.#o.set(h.id,v)}),this.#a="ready",this.#l+=1}load(){if(this.#c)return this.#c;const s=this.#e.options;if(Array.isArray(s)||s===void 0)return this.#c=Promise.resolve(this.#s),this.#c;if(f(s))return this.#c=this.#p(s),this.#c;if(!B(s))return F(`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=s()}catch(u){return this.#a="error",F(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,u),this.#c=Promise.resolve([]),this.#c}return!n||!B(n.then)?(this.#h(n),this.#c=Promise.resolve(this.#s),this.#r&&this.#r(this),this.#c):(this.#c=n.then(u=>(this.#h(u),this.#r&&this.#r(this),this.#s),u=>(this.#a="error",F(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,u),[])),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.#s)):this.load()}#p(s){if(this.#d)return Promise.resolve(this.#s);const n=this.#e,u=n.valueKey||"id",o=n.labelKey||"label",a=n.groupKey,h=B(s.map)?s.map:null,v=k=>m(h?h(k):k,u,o,a).id,g=k=>this.#m(k,h,u,o,a);return s.router.subscribe(s.predicate,g,{rowKey:v}),this.#d=()=>{B(s.router.detach)&&s.router.detach(g)},this.#a="ready",Promise.resolve(this.#s)}#m(s,n,u,o,a){const h=s&&s.add||[],v=s&&s.update||[],g=s&&s.remove||[];if(!(!h.length&&!v.length&&!g.length)){for(const k of h)this.#g(k,n,u,o,a);for(const k of v)this.#g(k,n,u,o,a);for(const k of g){if(!this.#f.has(k))continue;const d=this.#f.get(k);this.#f.delete(k),this.#i.delete(d);const p=this.#s.findIndex(b=>b.id===d);p>=0&&this.#s.splice(p,1)}this.#o=new Map(this.#s.map((k,d)=>[k.id,d])),this.#a="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(s,n,u,o,a){const h=m(n?n(s):s,u,o,a);this.#f.set(H([h.id]),h.id);const v=this.#s.findIndex(g=>g.id===h.id);v>=0?this.#s[v]=h:this.#s.push(h),this.#i.set(h.id,h)}destroy(){this.#d&&(this.#d(),this.#d=null)}search(s,n){const u=this.#e;if(!B(u.search)){const h=String(s||"").toLowerCase();return Promise.resolve(h===""?this.#s:this.#s.filter(v=>v.label.toLowerCase().includes(h)))}const o=u.valueKey||"id",a=u.labelKey||"label";return Promise.resolve(u.search(s,n)).then(h=>(h||[]).map(v=>m(v,o,a,u.groupKey)))}option(s){return this.#i.get(s)}has(s){return this.#i.has(s)}label(s){if(Z(s)||s==="")return"";const n=this.#i.get(s);if(n)return n.label;if(this.#a==="loading"||this.#a==="idle")return"";this.allowCustom||F(`lookup:unknown:${this.#t}`,`column "${this.#t}" holds value ${JSON.stringify(s)} which is not in its lookup options. Showing the raw value; set \`lookup.unknownLabel\` or \`lookup.allowCustom\` to change that.`);const u=this.#e.unknownLabel;return B(u)?String(u(s)??""):typeof u=="string"?u:String(s)}text(s){if(this.multiple){const n=r(s);return n.length===0?"":n.map(u=>this.label(u)).join(this.separator)}return this.label(s)}dictionary(){return this.#s.map(s=>s.id)}sorted(){const s=this.sortBy;if(s==="optionOrder"||s==="count")return this.#s.slice();if(s==="value")return this.#s.slice().sort((u,o)=>q(u.id,o.id));const n=this.#u;return this.#s.slice().sort((u,o)=>n.compare(u.label,o.label))}comparator(){const s=this.sortBy,n=this.multiple,u=this.#u,o=this.#o;if(n&&s==="count")return(h,v)=>r(h).length-r(v).length;const a=n?h=>r(h)[0]:h=>h;return s==="value"?(h,v)=>q(a(h),a(v)):s==="optionOrder"?(h,v)=>{const g=o.has(a(h))?o.get(a(h)):Number.MAX_SAFE_INTEGER,k=o.has(a(v))?o.get(a(v)):Number.MAX_SAFE_INTEGER;return g-k}:(h,v)=>{const g=a(h),k=a(v);return Z(g)?Z(k)?0:1:Z(k)?-1:u.compare(this.label(g),this.label(k))}}groupKey(s){return this.multiple?r(s).map(u=>String(u)).sort().join(w):Z(s)?"":String(s)}countValues(s){return this.multiple?r(s).length:Z(s)?0:1}contains(s,n,u){const o=this.multiple?r(s):Z(s)?[]:[s],a=Array.isArray(n)?n:[n];switch(u){case"containsAll":return a.every(h=>o.includes(h));case"containsNone":return!a.some(h=>o.includes(h));default:return a.some(h=>o.includes(h))}}exportText(s,n="label"){return n==="value"?this.multiple?r(s).join(this.separator):Z(s)?"":String(s):this.text(s)}exportColumns(){const s=this.multiple;return this.#s.map(n=>({id:n.id,label:n.label,has:u=>s?r(u).includes(n.id):u===n.id}))}}function r(i){return Array.isArray(i)?i:Z(i)||i===""?[]:[i]}function t(i,s={}){const n=i.lookup;if(!n)return null;const u=new l(n,{colId:i.id,locale:s.locale,onChange:s.onChange});return!Array.isArray(n.options)&&n.options!==void 0&&u.load(),u}}),Ue("packages/core/src/columns/value.js",function(e,U){"use strict";Object.defineProperty(e,"compileDisplay",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"warnImpureUse",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ValuePipeline",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return l}});const C=U("packages/core/src/internal/paths.js").getPath,q=U("packages/core/src/internal/predicates.js"),z=q.isFunction,B=q.isNil,K=U("packages/core/src/internal/lru.js").Lru,X=U("packages/core/src/internal/warn.js").warnOnce,j=U("packages/core/src/columns/graph.js").depsProxy,w="\0";function m(s,n={}){const u=n.locale,o=n.grid??null,a=n.context,h=s.value&&s.value.format,v=s.formatter||null,g=s.dataType&&s.dataType.format,k=s.lookup||null,d=(p,b,O)=>({value:p,data:O,row:b,column:s,colId:s.id,grid:o,context:a,locale:u});if(z(h))return(p,b,O)=>{const y=h(d(p,b,O));return y==null?"":String(y)};if(v){if(k){const p=v.kind==="text";return(b,O,y)=>v(p?k.text(b):b,d(b,O,y))}return(p,b,O)=>v(p,d(p,b,O))}return z(g)?(p,b,O)=>{const y=g(d(p,b,O));return y==null?"":String(y)}:k?p=>k.text(p):p=>B(p)?"":typeof p=="string"?p:String(p)}function c(s,n){!s||!s.value||s.value.pure!==!1||X(`impure:${n}:${s.id}`,`column "${s.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${n}. The result is not stable across passes.`)}class f{#e;#t;#n;#r;#s;#i;#o=new K(4096);constructor(n){this.#e=n.columns instanceof Map?n.columns:new Map((n.columns||[]).map(u=>[u.id,u])),this.#t=n.graph,this.#n=n.grid??null,this.#r=n.context,this.#i=n.stored||null,this.#s=n.rowKey||l}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 u=n&&n.rows?new Set([...n.rows].map(String)):null,o=n&&n.columns?[...n.columns]:null;if(!u&&!o){this.#o.clear();return}const a=o?this.#l(o):null;for(const h of[...this.#o.keys()]){const v=String(h).split(w);v.length===3&&(u&&!u.has(v[0])||a&&!a.has(v[2])||this.#o.delete(h))}}#l(n){const u=new Set,o=this.#t,a=[...n];for(;a.length;){const h=a.pop();if(!u.has(h)){u.add(h);for(const v of o?o.dependents.get(h)||[]:[])a.push(v)}}return u}value(n,u,o){const a=typeof n=="string"?this.#e.get(n):n;if(!a)return;if(!a.computed)return this.#c(a,u,o);if(a.value.pure!==!1&&this.#i&&o&&o.physical!=null&&this.#i.has(a.id))return this.#i.get(a.id,o.physical);if(a.volatile)return this.compute(a,u,o);if(a.value.pure===!1)return this.compute(a,u,o);const h=`${this.#a(u,o)}${w}${a.id}`;if(this.#o.has(h))return this.#o.get(h);const v=this.compute(a,u,o);return this.#o.set(h,v),v}#a(n,u){return`${this.#s(n,u)}${w}${r(n)}`}#c(n,u,o){if(this.#i&&o&&o.physical!=null&&this.#i.has(n.id))return this.#i.get(n.id,o.physical);if(n.field)return n.read?n.read(u):C(u,n.field)}compute(n,u,o){const a=this.#t,h=a&&a.wholeRow.has(n.id);let v;if(h)v=u??{};else{v={};const k=a&&a.deps.get(n.id)||[];for(const p of k)v[p]=this.value(p,u,o);const d=a&&a.external.get(n.id)||[];for(const p of d)v[p]=C(u,p);v=j(v,[...k,...d],n.id)}const g={data:u,row:o,column:n,grid:this.#n,context:this.#r};return n.value.compute(v,g)}values(n,u){const o={},a=this.#t?this.#t.order:[...this.#e.keys()];for(const h of a)o[h]=this.value(h,n,u);return o}text(n,u,o){const a=typeof n=="string"?this.#e.get(n):n;return a?a.formatValue(this.value(a,u,o),o,u):""}key(n,u,o){const a=typeof n=="string"?this.#e.get(n):n;if(!a)return"";const h=this.value(a,u,o);return z(a.value.key)?String(a.value.key(this.#u(a,h,u,o))):a.lookup?a.lookup.groupKey(h):B(h)?"":String(h)}quickFilterText(n,u,o){const a=typeof n=="string"?this.#e.get(n):n;if(!a)return"";if(z(a.value.quickFilterText)){const h=this.value(a,u,o);return String(a.value.quickFilterText(this.#u(a,h,u,o))??"")}return this.text(a,u,o)}#u(n,u,o,a){return{value:u,data:o,row:a,column:n,colId:n.id,grid:this.#n,context:this.#r}}parse(n,u,o,a){const h=typeof n=="string"?this.#e.get(n):n;if(!h)return u;const v={text:u,value:this.value(h,o,a),data:o,row:a,column:h,grid:this.#n,context:this.#r,locale:this.#n&&z(this.#n.get)?this.#n.get("locale"):void 0,formulaFunctions:this.#n&&z(this.#n.get)?this.#n.get("formulaFunctions"):void 0};return z(h.value.parse)?h.value.parse(v):h.dataType&&z(h.dataType.parse)?h.dataType.parse(v):u}validate(n,u,o,a,h){const v=typeof n=="string"?this.#e.get(n):n;if(!v||!z(v.edit.validate))return!0;const g=v.edit.validate({value:u,oldValue:o,data:a,row:h,column:v,grid:this.#n,context:this.#r});return g===!0||g===void 0?!0:String(g)}apply(n,u,o,a){const h=typeof n=="string"?this.#e.get(n):n;if(!h)return!1;const v=this.value(h,o,a);if(z(h.value.apply)){const g=h.value.apply({value:u,oldValue:v,data:o,row:a,column:h,grid:this.#n,context:this.#r});return this.#d(h,o,a),g!==!1}return h.field?v===u?!1:(h.write(o,u),this.#d(h,o,a),!0):(X(`apply:${h.id}`,`column "${h.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(n,u,o,a){const h=typeof n=="string"?this.#e.get(n):n;if(!h)return{ok:!1,value:void 0,oldValue:void 0,changed:!1,error:"unknown column"};const v=this.value(h,o,a),g=this.parse(h,u,o,a),k=this.validate(h,g,v,o,a);if(k!==!0)return{ok:!1,value:g,oldValue:v,changed:!1,error:k};const d=this.apply(h,g,o,a);return{ok:!0,value:g,oldValue:v,changed:d}}#d(n,u,o){if(this.#o.size===0)return;const a=this.#a(u,o);this.#o.delete(`${a}${w}${n.id}`);for(const h of this.#t?this.#t.dependents.get(n.id)||[]:[])this.#o.delete(`${a}${w}${h}`)}}function l(s,n){return n&&n.key!=null?String(n.key):r(s)}function r(s){if(s&&typeof s=="object"){let n=t.get(s);return n===void 0&&(n=`#${i++}`,t.set(s,n)),n}return String(s)}const t=new WeakMap;let i=0}),Ue("packages/core/src/model/shadow.js",function(e,U){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"HISTORY_TICK_MAX_MS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"HISTORY_TICK_MIN_MS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"DEFAULT_ANOMALY_THRESHOLD",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"SPEC_STATUS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"POSITIONAL_KINDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"SHADOW_LABELS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"specStatusOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"ShadowTracker",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shadowsIn",{enumerable:!0,get:function(){return o}});const C=U("packages/core/src/internal/warn.js").warnOnce,q=2e5,z=20,B=1e3,Z=50;function K(a){return Math.min(B,Math.max(Z,Math.floor(a)))}const F=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"]),X=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),H=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),j=.6745,w=3.5,m=Object.freeze({PASS:"PASS",WARN:"WARN",FAIL:"FAIL"}),c=Object.freeze(["rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag"]),f=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"});function l(a,h){if(!h)return null;const v=Number.isFinite(Number(h.lower))?Number(h.lower):null,g=Number.isFinite(Number(h.upper))?Number(h.upper):null;if(v===null&&g===null||!Number.isFinite(a))return null;if(v!==null&&a<v||g!==null&&a>g)return m.FAIL;const k=Number.isFinite(Number(h.warnLower))?Number(h.warnLower):null,d=Number.isFinite(Number(h.warnUpper))?Number(h.warnUpper):null;return k!==null&&a<k||d!==null&&a>d?m.WARN:m.PASS}function r(a,h,v){if(!h||typeof h!="object")return null;if(h.kind!=="time")return h.kind!==void 0&&C(`shadow.history.window.kind:${a}`,`a 'history' shadow's 'window' only accepts {kind: 'time', span}; '${h.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 g=h.minutes!=null?Number(h.minutes)*6e4:Number(h.span);if(!(g>0))return C(`shadow.history.window.span:${a}`,"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 k=Math.max(2,Math.floor(v)||z);return{span:g,bucketMs:Math.max(1,Math.floor(g/k))}}class t{#e;#t=new Map;#n=new Map;#r=new Map;#s=new Map;#i=new Map;#o=new Map;#l=0;#a;#c;#u;#d;#f=new Map;#h=null;#p=null;#m=null;constructor(h){this.#e=h.colId,this.#a=Math.max(2,h.depth||z),this.#c=Math.max(1,h.max||q),this.#u=h.now||(()=>Date.now()),this.#d=r(this.#e,h.historyWindow,this.#a),this.#d&&(this.#h=Math.floor(this.#u()/this.#d.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#d}observe(h,v){const g=u(v);if(g===null)return;if(!this.#n.has(h)){this.#p=null,this.#m=null,this.#g(),this.#t.set(h,g),this.#n.set(h,g),this.#r.set(h,0),this.#s.set(h,this.#u()),this.#i.set(h,[g]),this.#d&&this.#f.set(h,[g]),this.#o.set(h,0);return}const k=this.#n.get(h);if(k===g)return;this.#p=null,this.#m=null,this.#n.set(h,g),this.#r.set(h,(this.#r.get(h)||0)+1),this.#s.set(h,this.#u());const d=this.#i.get(h)||[];d.push(g),d.length>this.#a&&d.splice(0,d.length-this.#a),this.#i.set(h,d);const p=Math.sign(g-k),b=this.#o.get(h)||0;this.#o.set(h,Math.sign(b)===p?b+p:p)}#g(){if(this.#n.size<this.#c)return;const h=this.#n.keys().next().value;h!==void 0&&(this.#t.delete(h),this.#n.delete(h),this.#r.delete(h),this.#s.delete(h),this.#i.delete(h),this.#f.delete(h),this.#o.delete(h),this.#l++)}rebase(){for(const[h,v]of this.#n)this.#t.set(h,v);this.#p=null,this.#m=null}reset(){this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#s.clear(),this.#i.clear(),this.#f.clear(),this.#o.clear(),this.#l=0,this.#p=null,this.#m=null,this.#d&&(this.#h=Math.floor(this.#u()/this.#d.bucketMs))}retain(h){const v=h instanceof Set?h:new Set(h);let g=0;for(const k of[...this.#n.keys()])v.has(k)||(this.#t.delete(k),this.#n.delete(k),this.#r.delete(k),this.#s.delete(k),this.#i.delete(k),this.#f.delete(k),this.#o.delete(k),g++);return g&&(this.#p=null,this.#m=null),g}advanceHistoryWindow(h=this.#u()){const v=this.#d;if(!v)return 0;const g=Math.floor(h/v.bucketMs),k=g-this.#h;if(!(k>0))return 0;const d=Math.min(k,this.#a);for(const[p,b]of this.#f){const O=this.#n.get(p);for(let y=0;y<d;y++)b.push(O);b.length>this.#a&&b.splice(0,b.length-this.#a)}return this.#h=g,k}read(h,v,g,k){switch(h){case"updates":return this.#r.has(v)?this.#r.get(v):0;case"updatedAt":{const d=this.#s.get(v);return d===void 0?null:new Date(d)}case"sinceUpdate":{const d=this.#s.get(v);return d===void 0?null:this.#u()-d}case"firstValue":return this.#t.has(v)?this.#t.get(v):null;case"delta":return this.#n.has(v)?this.#n.get(v)-this.#t.get(v):null;case"deltaPercent":{if(!this.#n.has(v))return null;const d=this.#t.get(v);return d?(this.#n.get(v)-d)/Math.abs(d)*100:null}case"rate":{const d=this.#i.get(v),p=this.#s.get(v);if(!d||d.length<2||p===void 0)return null;const b=this.#u()-p,O=d[d.length-1]-d[d.length-2];return b>0?O/b*1e3:O}case"history":return this.#d?this.#f.has(v)?[...this.#f.get(v)]:null:this.#i.has(v)?[...this.#i.get(v)]:null;case"streak":return this.#o.has(v)?this.#o.get(v):0;case"specStatus":return this.#n.has(v)?l(this.#n.get(v),k):null;default:return c.includes(h)?this.#A(h,v,g,k):null}}#b(h){if(h){if(this.#m&&this.#m.only===h)return this.#m.view;const v=this.#y(h);return this.#m={only:h,view:v},v}return this.#p?this.#p:(this.#p=this.#y(null),this.#p)}#y(h){const v=[];for(const[_,I]of this.#n)h&&!h.has(_)||v.push(I);const g=v.sort((_,I)=>_-I);let k=0,d=0,p=0,b=0;for(const _ of g){b+=_,k++;const I=_-d;d+=I/k,p+=I*(_-d)}const O=[];for(const[_,I]of this.#t)h&&!h.has(_)||O.push(I);const y=k?i(g):0,M=g.map(_=>Math.abs(_-y)).sort((_,I)=>_-I),D=k?i(M):0;return{sorted:g,baseline:O.sort((_,I)=>_-I),sum:b,mean:k?d:0,sd:k>1?Math.sqrt(p/(k-1)):0,median:y,mad:D}}#A(h,v,g,k){if(!this.#n.has(v)||g&&!g.has(v))return null;const d=this.#n.get(v),p=this.#b(g),b=p.sorted.length;if(!b)return null;switch(h){case"rank":return b-n(p.sorted,d)+1;case"rankAsc":return s(p.sorted,d)+1;case"rankChange":{if(!this.#t.has(v)||!p.baseline.length)return null;const O=p.baseline.length-n(p.baseline,this.#t.get(v))+1,y=b-n(p.sorted,d)+1;return O-y}case"percentile":return n(p.sorted,d)/b*100;case"quartile":{const O=n(p.sorted,d)/b;return Math.min(4,Math.max(1,Math.ceil(O*4)))}case"zScore":return p.sd?(d-p.mean)/p.sd:null;case"anomalyScore":return p.mad?j*(d-p.median)/p.mad:null;case"anomalyFlag":{if(!p.mad)return null;const O=k&&Number.isFinite(Number(k.threshold))?Number(k.threshold):w;return Math.abs(j*(d-p.median)/p.mad)>O}case"shareOfTotal":return p.sum?d/p.sum*100:null;default:return null}}}function i(a){const h=a.length;if(!h)return 0;const v=(h-1)*.5,g=Math.floor(v),k=Math.ceil(v);return g===k?a[g]:a[g]+(v-g)*(a[k]-a[g])}function s(a,h){let v=0,g=a.length;for(;v<g;){const k=v+g>>1;a[k]<h?v=k+1:g=k}return v}function n(a,h){let v=0,g=a.length;for(;v<g;){const k=v+g>>1;a[k]<=h?v=k+1:g=k}return v}function u(a){if(a==null||a==="")return null;if(a instanceof Date){const v=a.getTime();return Number.isFinite(v)?v:null}const h=typeof a=="number"?a:Number(a);return Number.isFinite(h)?h:null}function o(a){const h=[];for(const v of a||[]){const g=v.shadow;if(!g)continue;const k=typeof g=="string"?{kind:g}:g,d=k.kind;F.includes(d)&&(X.includes(d)||H.includes(d)||h.push({colId:v.id||v.field,of:k.of||v.field||v.id,kind:d,depth:k.depth,historyWindow:d==="history"?k.window:void 0}))}return h}}),Ue("packages/core/src/columns/model.js",function(e,U){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return le}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return xe}});const te=U("packages/core/src/internal/merge.js"),C=te.expand,q=te.merge,z=te.toArray,B=U("packages/core/src/internal/warn.js"),Z=B.fail,K=B.warnOnce,F=U("packages/core/src/internal/paths.js"),X=F.getPath,H=F.pathGetter,j=F.pathSetter,m=U("packages/core/src/internal/text.js").humanise,c=U("packages/core/src/internal/predicates.js"),f=c.isFunction,l=c.isObject,t=U("packages/core/src/internal/uid.js").uid,s=U("packages/core/src/format/index.js").compileFormat,n=U("packages/core/src/columns/datatypes.js"),u=n.comparatorFor,o=n.createTypeRegistry,a=n.storageKind,h=U("packages/core/src/columns/infer.js"),v=h.inferColumnType,g=h.DEFAULT_SAMPLE,k=U("packages/core/src/columns/graph.js"),d=k.buildGraph,p=k.affectedBy,O=U("packages/core/src/columns/lookup.js").createLookup,y=U("packages/core/src/columns/value.js"),M=y.compileDisplay,D=y.ValuePipeline,_=y.warnImpureUse,L=U("packages/core/src/model/shadow.js").FIT_SHADOW_KINDS,$=Object.freeze({geometry:"geometry",list:"list"}),P={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},N={centre:"center"},T=new Set(["start","center","end","left","right"]);function E(Be){if(typeof Be!="string")return;const ae=Be.toLowerCase();return N[ae]?N[ae]:T.has(ae)?ae:void 0}function A(Be){if(typeof Be!="string")return;const ae=Be.toLowerCase();return ae==="center"||ae==="centre"?"middle":ae==="top"||ae==="middle"||ae==="bottom"?ae:void 0}const S=["cell","layout","header"];function x(Be){if(!l(Be))return{};const ae={...Be},Ae=(Me,Re)=>{if(Be[Me]===void 0)return;const pe=C(Be[Me],Re);pe&&S.includes(Me)&&!l(Be[Me])&&delete pe.enabled,ae[Me]=pe};return Ae("sort","direction"),Ae("filter","type"),Ae("cell","render"),Ae("edit","editor"),Ae("layout","width"),Ae("group","index"),Ae("pivot","index"),Ae("header","render"),Ae("facet","strategy"),ae}function W(Be,ae){const Ae={...Be||{}},Me=l(ae)&&l(ae.layout)&&ae.layout.width!==void 0;return Ae.fit==="content"&&!Me&&delete Ae.width,Ae}const V=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"]),G=new Set(["collapsible","columns","facet","header","id","marryChildren","openByDefault","showWhen","title"]);function Q(Be,ae,Ae,Me){const Re=Ae==="columnGroup"?"column group":"column";for(const pe of Object.keys(Be))if(!ae.has(pe)){if(pe==="timeZone"&&Ae==="column"){K("column.timeZone",`\`timeZone\` is not a column option, so it had no effect on column "${Me}". 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}K(`${Ae}.unknown:${pe}`,`'${pe}' is not a configuration key this grid recognises, so it had no effect on ${Re} "${Me}". Check the spelling against the reference.`)}}function ee(Be){l(Be.cell)&&Be.cell.autoHeight!==void 0&&K("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${Be.id||Be.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function ne(Be,ae){const Ae=ae&&f(Be.defaultsFor)?Be.defaultsFor(ae):null,Me={...Be.defaults||{},...l(Ae)?Ae:{}},Re={};return Me.align&&(Re.align=Me.align,Re.cell={align:Me.align},Re.header={align:Me.align}),Me.filter&&(Re.filter=Me.filter==="none"?{enabled:!1,type:"none"}:{enabled:!0,type:Me.filter}),Me.editor&&(Re.edit=Me.editor==="none"?{editor:null}:{editor:Me.editor}),Me.total&&(Re.total=Me.total),Me.render&&(Re.cell={...Re.cell||{},render:Me.render}),Be.export&&(Re.export={...Be.export}),Re}function se(Be){if(typeof Be=="string")return Be.trim()?[Be.trim()]:[];if(!Array.isArray(Be))return[];const ae=[];for(const Ae of Be){if(typeof Ae!="string")continue;const Me=Ae.trim();Me&&!ae.includes(Me)&&ae.push(Me)}return ae}class le{#e=new Map;#t=[];#n=[];#r=new WeakMap;#s;#i;#o;#l;#a;#c;#u(ae,Ae,Me){const Re=this.#d(ae,Ae,Me);if(typeof Re!="string"||!this.#f)return Re??null;const pe=Ae&&Ae.totals&&Ae.totals.implement;if(pe&&f(pe[Re])){const ce=pe[Re];return ce.totalName=Re,ce}const $e=this.#f.totalFn?.(Re);return f($e)?$e:Re}#d(ae,Ae,Me){if(typeof ae!="string")return ae;const Re=Ae&&Ae.totals&&Ae.totals.supported;if(!Array.isArray(Re)||Re.includes(ae))return ae;const pe=Re.length?Re.join(", "):"none";return Z(`column "${Me}" is typed ${Ae.name||"a type"}, for which the total "${ae}" is not meaningful. Supported: ${pe}. Aggregating it anyway would produce a confident wrong number.`),ae}#f;#h;#p;#m;#g;#b;#y=!1;#A;#w;constructor(ae={}){this.#i=x(ae.columnDefaults||{}),this.#o=ae.columnPresets||{},this.#a=ae.locale,this.#l=ae.timeZone,this.#c=A(ae.verticalAlign),this.#f=ae.registry||null,this.#h=ae.grid||null,this.#p=ae.context,this.#A=ae.sampleSize??g,this.#w=ae.onChange||null,this.#b=f(ae.rowKey)?ae.rowKey:void 0,this.#s=o(ae.dataTypes,this.#f);const{leaves:Ae,groups:Me}=xe(ae.columns||[]);this.#n=Me;for(const Re of Ae){Re.facet!==void 0&&this.#r.set(Re.def,Re.facet);const pe=this.#O(Re.def,null);if(pe.groupPath=Re.path,this.#e.has(pe.id)){K(`columns.duplicate:${pe.id}`,`two columns resolve to the id '${pe.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}Re.column=pe,this.#e.set(pe.id,pe),this.#t.push(pe.id)}this.#E(ae.stored||null)}#O(ae,Ae){Q(ae,V,"column",ae.id||ae.field||"(unnamed)"),ee(ae);const Me=x(ae),Re=z(ae.preset),pe=Re.map(Ke=>{const Ze=this.#o[Ke];return Ze?x(Ze):(K(`preset:${Ke}`,`unknown column preset "${Ke}"; ignoring`),{})}),$e=this.#S(Me,pe,Ae),ce=this.#s.get($e)||this.#s.get("text");if(!this.#s.has($e)&&ae.type){const Ke=$[$e];K(`type:${$e}`,`unknown data type "${$e}"; falling back to "text"`+(Ke?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${Ke}'.`:""))}const ge=f(ce.items)?this.#T(Me,pe,ae.id||ae.field||"(unnamed)"):null;let je=P;je=q(je,this.#i),ae.type!==!1&&(je=q(je,ne(ce,ge)));for(const Ke of pe)je=q(je,Ke);this.#r.has(ae)&&(je=q(je,x({facet:this.#r.get(ae)}))),je=q(je,Me);const Ve=je.edit;Ve&&Ve.editor&&Ve.enabled!==!0&&!f(Ve.enabled)&&(ae.edit||{}).editor&&K(`column.editor-not-enabled:${ae.id||ae.field}`,`column '${ae.id||ae.field}' names the editor '${Ve.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const Se=ae.id||ae.field||t("col");if(ae.shadow&&!f(je.value&&je.value.compute)){const Ke=typeof ae.shadow=="string"?{kind:ae.shadow}:ae.shadow,Ze=Ke.of||ae.field||Se,nt=L.includes(Ke.kind),it=nt?Ke.model||Ke:null,wt=nt&&it?[...Array.isArray(it.predictors)?it.predictors:[],it.response].filter(Boolean):null;je.value={...je.value||{},deps:wt&&wt.length?wt:Ke.orderBy&&Ke.orderBy!==Ze?[Ze,Ke.orderBy]:[Ze],pure:!1,compute:(ht,Ot)=>{const Pt=Ot.grid&&Ot.grid.statistics;if(!Pt)return null;const Nt=Ot.row&&Ot.row.key||Pt.keyOf(Ot.data);if(!Nt)return null;if(nt){if(!f(Pt.fitShadow))return null;const ct=Ke.model?{...Ke.model,threshold:Ke.threshold}:Ke;return Pt.fitShadow(Ke.kind,Nt,ct)}return Pt.shadow(Ze,Ke.kind,Nt,Ke.scope,Ke)}}}if(ae.running&&!f(je.value&&je.value.compute)){const Ke=typeof ae.running=="string"?{kind:ae.running}:ae.running,Ze=Ke.of||ae.field||Se;je.value={...je.value||{},deps:[Ze],pure:!1,compute:(nt,it)=>{const wt=it.grid&&it.grid.statistics;if(!wt||!f(wt.running))return null;const ht=it.row&&it.row.key||wt.keyOf(it.data);return ht?wt.running(Ze,Ke.kind||"total",ht):null}},ae.sort===void 0&&(je.sort={...je.sort||{},enabled:!1})}const Ge=ae.field??(f(je.value&&je.value.compute)?null:ae.id??null),Ce=f(je.value&&je.value.compute),Te={id:Se,field:Ge,shadow:ae.shadow||null,running:ae.running||null,spec:ae.spec||null,validation:ae.validation||null,volatile:!!(ae.shadow||ae.running),title:je.title??m(Ge||Se),type:ce.name,dataType:ce,itemType:ge,nullable:je.nullable!==!1,align:E(Me.cell&&Me.cell.align||Me.align||je.cell&&je.cell.align||je.align||ce.defaults&&ce.defaults.align)||"start",verticalAlign:A(Me.cell&&Me.cell.verticalAlign||Me.verticalAlign||je.cell&&je.cell.verticalAlign||je.verticalAlign)||this.#c,rowSpan:f(je.rowSpan)?je.rowSpan:null,colSpan:f(je.colSpan)?je.colSpan:null,value:{pure:!0,...je.value||{}},cell:{...je.cell||{}},edit:{...je.edit||{}},sort:{...je.sort||{}},filter:{...je.filter||{}},group:{enabled:!1,index:-1,explode:!1,...je.group||{}},pivot:{enabled:!1,index:-1,...je.pivot||{}},total:this.#u(je.total,ce,ae.id||ae.field||"(unnamed)"),groupTotal:je.groupTotal===void 0?null:this.#u(je.groupTotal,ce,ae.id||ae.field||"(unnamed)"),grandTotal:je.grandTotal===void 0?null:this.#u(je.grandTotal,ce,ae.id||ae.field||"(unnamed)"),tags:se(je.tags),typeOptions:je.typeOptions??null,...l(je[$e])?{[$e]:je[$e]}:{},layout:W(je.layout,Me),header:{...je.header||{}},contextMenu:je.contextMenu===void 0?null:je.contextMenu,facet:{...je.facet||{}},export:{...je.export||{}},allowGroup:je.allowGroup!==!1,allowPivot:je.allowPivot!==!1,allowTotal:je.allowTotal!==!1,quickFilter:je.quickFilter!==!1,def:ae,format:je.format,presets:Re,inferred:Ae!=null&&!ae.type,computed:Ce,diff:ae.diff===void 0?void 0:!!ae.diff,read:Ge?H(Ge):null,write:Ge?j(Ge):null};Te.cell.align=E(Me.cell&&Me.cell.align)||Te.align,Te.header.align=E(Me.header&&Me.header.align)||Te.align;const ze=je.lookup||null;return Te.lookup=ze?O({id:Se,lookup:ze},{locale:this.#a,onChange:()=>{this.#w&&this.#w("lookup",{colId:Se})}}):null,Te.group.explode&&Te.lookup&&Te.lookup.multiple&&K(`explode:${Se}`,`column "${Se}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(Te),Te}#v(ae){ae.formatter=s(ae.format,ae.dataType,this.#a,this.#l,ae.id),ae.formatValue=M(ae,{locale:this.#a,grid:this.#h,context:this.#p}),ae.itemCompare=ae.itemType?u(ae.itemType,this.#a):null,ae.compare=f(ae.value.compare)?ae.value.compare:ae.lookup?ae.lookup.comparator():f(ae.dataType.compareFor)?ae.dataType.compareFor(ae):u(ae.dataType,this.#a),ae.excel=ae.formatter&&ae.formatter.ooxml||ae.dataType&&ae.dataType.excel||"General",ae.storeKind=a(ae.dataType,!!(ae.lookup&&ae.lookup.multiple))}#T(ae,Ae,Me){let Re=l(ae.typeOptions)?ae.typeOptions:null;for(let ge=Ae.length-1;!Re&&ge>=0;ge--)l(Ae[ge].typeOptions)&&(Re=Ae[ge].typeOptions);!Re&&l(this.#i.typeOptions)&&(Re=this.#i.typeOptions);const pe=Re&&Re.of!==void 0?Re.of:"text",$e=typeof pe=="string"?this.#s.get(pe):void 0;return $e&&!f($e.items)&&$e.storage!=="object"?$e:(K(`type:of:${String(pe)}`,`column "${Me}" names "${String(pe)}" as its item type (typeOptions.of), which is not ${$e?"a scalar data type":"a known data type"}; its items are read as text.`),this.#s.get("text"))}#S(ae,Ae,Me){if(ae.type===!1)return"text";if(ae.type)return ae.type;for(let Re=Ae.length-1;Re>=0;Re--)if(Ae[Re].type)return Ae[Re].type;if(this.#i.type)return this.#i.type;if(ae.shadow){const Re=typeof ae.shadow=="string"?ae.shadow:ae.shadow.kind;if(Re==="fitInfluence")return"boolean";if(Re==="fitPredicted"||Re==="fitResidual"||Re==="fitStdResidual"||Re==="fitLeverage"||Re==="fitCooksD"||Re==="tsTrend"||Re==="tsSeasonal"||Re==="tsResidual"||Re==="tsCoverage"||Re==="tsSmoothed"||Re==="tsSmoothingAlpha"||Re==="tsSmoothingBeta")return"number"}return Me||(ae.lookup?"lookup":"text")}#E(ae){const Ae=this.all();this.#m=d(Ae),this.#g?this.#g.setGraph(this.#m):this.#g=new D({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:ae||null,rowKey:this.#b});const Me=this.#g;for(const Re of Ae)Re.getValue=(pe,$e)=>Me.value(Re,pe,$e)}all(){return this.#t.map(ae=>this.#e.get(ae))}visible(){return this.all().filter(ae=>!ae.layout.hidden)}get(ae){return this.#e.get(ae)}groups(){const ae=Ae=>{const Me=[];for(const Re of Ae)Array.isArray(Re.columns)?Me.push({...Re,columns:ae(Re.columns)}):Re.column&&Me.push(Re.column);return Me};return ae(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#s}affectedBy(ae){return p(this.#m,ae)}value(ae,Ae,Me){return this.#g.value(ae,Ae,Me)}text(ae,Ae,Me){return this.#g.text(ae,Ae,Me)}checkImpure(ae,Ae){_(this.#e.get(ae),Ae)}setLocale(ae){this.#a=ae;for(const Ae of this.all())Ae.lookup&&Ae.lookup.setLocale(ae),this.#v(Ae);this.#w&&this.#w("locale",{locale:ae})}infer(ae){const Ae={};if(this.#y||!Array.isArray(ae)||ae.length===0)return Ae;this.#y=!0;let Me=!1;for(const Re of this.all()){const pe=Re.def;if(pe.type!==void 0||!Re.field||Re.computed||Re.lookup||this.#M(Re))continue;const $e=Re.read||(je=>X(je,Re.field)),ce=v(Re.id,ae,$e,this.#s,{sampleSize:this.#A});if(ce===Re.type)continue;Ae[Re.id]=ce;const ge=this.#O(pe,ce);ge.groupPath=Re.groupPath,ge.layout={...ge.layout,...me(Re.layout)},this.#e.set(Re.id,ge),He(this.#n,Re.id,ge),Me=!0}return Me&&this.#E(null),Ae}redecorate(ae,Ae,Me={}){const Re=this.#e.get(ae);if(!Re){K(`redecorate:${ae}`,`columns.decorate('${ae}', …): no column with id '${ae}'.`);return}const pe=Re.def||{},$e={...l(pe.cell)?pe.cell:{}};$e.decoration=Ae??void 0,Me&&"variant"in Me&&($e.variant=Me.variant);const ce={...pe,cell:$e};this.#r.has(pe)&&this.#r.set(ce,this.#r.get(pe));const ge=this.#O(ce,Re.type);return ge.groupPath=Re.groupPath,ge.layout={...ge.layout,...me(Re.layout)},Re.lookup&&Re.lookup!==ge.lookup&&f(Re.lookup.destroy)&&Re.lookup.destroy(),this.#e.set(ae,ge),He(this.#n,ae,ge),this.#E(null),this.#w&&this.#w("decorate",{colId:ae}),ge}destroy(){for(const ae of this.#e.values())ae.lookup&&f(ae.lookup.destroy)&&ae.lookup.destroy()}#M(ae){for(const Ae of ae.presets){const Me=this.#o[Ae];if(Me&&Me.type)return!0}return!!this.#i.type}#P(ae){return!ae.computed&&f(ae.dataType&&ae.dataType.toStorage)}storeReader(ae){if(ae.computed)return Ae=>this.#g.value(ae,Ae,null);if(this.#P(ae)){const Ae=ae.dataType.toStorage,Me={timeZone:this.#l,colId:ae.id,itemType:ae.itemType||null};return Re=>Ae(ae.read(Re),Me)}return ae.read}storeValue(ae,Ae){if(!(!ae||ae.computed)&&f(ae.read))return this.storeReader(ae)(Ae)}storeSchema(){const ae=[];for(const Ae of this.all()){if(Ae.computed&&Ae.value.pure===!1||!Ae.computed&&!Ae.field)continue;const Me=this.storeReader(Ae);let Re=null;!Ae.computed&&!this.#P(Ae)&&typeof Ae.field=="string"&&!Ae.lookup&&(Re=Ae.field);const pe={id:Ae.id,kind:Ae.storeKind,nullable:Ae.nullable,read:Me};Re!==null&&(pe.field=Re),Ae.lookup&&(pe.dictionary=Ae.lookup.dictionary()),ae.push(pe)}return ae}state(){return this.all().map(ae=>({id:ae.id,width:ae.layout.width,flex:ae.layout.flex||void 0,hidden:!!ae.layout.hidden,headerWrap:ae.header?.wrap===!0?!0:void 0,headerOrientation:ae.header?.orientation==="vertical"?"vertical":void 0,pin:ae.layout.pin??null,sort:ae.sort.direction??null,sortIndex:ae.sort.direction?ae.sort.order??0:null,groupIndex:ae.group.enabled?ae.group.index??0:null,pivotIndex:ae.pivot.enabled?ae.pivot.index??0:null,total:typeof ae.total=="string"?ae.total:null,groupTotal:typeof ae.groupTotal=="string"?ae.groupTotal:void 0,grandTotal:typeof ae.grandTotal=="string"?ae.grandTotal:void 0,decoration:ae.cell&&ae.cell.decoration!=null?ve(ae.cell.decoration):void 0,variant:ae.cell&&ae.cell.variant!=null?ve(ae.cell.variant):void 0}))}applyState(ae,Ae={}){const Me={applied:[],skipped:[]},Re=Array.isArray(ae)?ae:ae&&ae.columns||[],pe=!Array.isArray(ae)&&ae&&ae.columnOrder||null;for(const ce of Re){if(!ce||!ce.id){Me.skipped.push({key:"?",reason:"no id"});continue}let ge=this.#e.get(ce.id);if(!ge){Me.skipped.push({key:ce.id,reason:"unknown column"});continue}if(Object.hasOwn(ce,"decoration")||Object.hasOwn(ce,"variant")){const je=ge.cell?ge.cell.decoration:void 0,Ve=ce.decoration??null,Se=Object.hasOwn(ce,"variant"),Ge=Se&&!fe(ge.cell?ge.cell.variant:void 0,ce.variant);(!fe(je,Ve)||Ge)&&(this.redecorate(ce.id,Ve,Se?{variant:ce.variant??void 0}:{}),ge=this.#e.get(ce.id)||ge)}ce.width!=null&&(ge.layout.width=ce.width),ce.flex!=null&&(ge.layout.flex=ce.flex),ce.hidden!=null&&(ge.layout.hidden=!!ce.hidden),ce.headerWrap!==void 0&&(ge.header.wrap=!!ce.headerWrap),ce.headerOrientation!==void 0&&(ge.header.orientation=ce.headerOrientation==="vertical"?"vertical":"horizontal"),ce.pin!==void 0&&(ge.layout.pin=ce.pin),ce.sort!==void 0&&(ge.sort.direction=ce.sort),ce.sortIndex!=null&&(ge.sort.order=ce.sortIndex),ce.groupIndex!=null&&(ge.group.enabled=!0,ge.group.index=ce.groupIndex),ce.pivotIndex!=null&&(ge.pivot.enabled=!0,ge.pivot.index=ce.pivotIndex),ce.total!==void 0&&(ge.total=ce.total),ce.groupTotal!==void 0&&(ge.groupTotal=ce.groupTotal),ce.grandTotal!==void 0&&(ge.grandTotal=ce.grandTotal),Me.applied.push(ce.id)}const $e=pe||(Ae&&Ae.keepOrder?[]:Re.map(ce=>ce&&ce.id).filter(Boolean));if($e.length){const ce=$e.filter(je=>this.#e.has(je)),ge=this.#t.filter(je=>!ce.includes(je));this.#t=[...ce,...ge]}return this.#w&&this.#w("state",Me),Me}move(ae,Ae){this.#N(ae,Ae)&&(this.#$(),this.#w&&this.#w("move",{id:ae,to:Ae}))}reorder(ae){const Ae={applied:[],skipped:[]},Me=[];let Re=0;for(const pe of Array.isArray(ae)?ae:[]){const $e=Re++;this.#N(pe,$e)&&(Ae.applied.push(pe),Me.push({id:pe,to:$e}))}if(!Me.length)return Ae;if(this.#$(),this.#w)for(const pe of Me)this.#w("move",pe);return Ae}#N(ae,Ae){const Me=this.#t.indexOf(ae);if(Me===-1||Math.max(0,Math.min(Number(Ae)||0,this.#t.length-1))===Me)return!1;const pe=this.#e.get(ae);if(pe.layout.movable===!1||pe.layout.lockPosition)return K(`move:${ae}`,`column "${ae}" is not movable; the move was ignored`),!1;const $e=this.#R(ae,Ae);return $e?(K(`move.married:${$e}`,`band "${$e}" declares marryChildren, so its columns stay together; the move was ignored`),!1):(this.#t.splice(Me,1),this.#t.splice(Math.max(0,Math.min(Ae,this.#t.length)),0,ae),!0)}#R(ae,Ae){if(!this.#n||!this.#n.length)return null;const Me=this.#t.filter(ce=>ce!==ae),Re=Math.max(0,Math.min(Ae,Me.length)),pe=(ce,ge)=>{if(Array.isArray(ce.columns)){for(const Ve of ce.columns)pe(Ve,ge);return ge}const je=ce.column?ce.column.id:ce.id;return je&&ge.push(je),ge},$e=ce=>{for(const ge of ce){if(!Array.isArray(ge.columns))continue;if(ge.marryChildren===!0){const Ve=pe(ge,[]),Se=Ve.includes(ae),Ge=Ve.map(Ce=>Me.indexOf(Ce)).filter(Ce=>Ce>=0);if(Ge.length){const Ce=Math.min(...Ge),Te=Math.max(...Ge);if(Se?Re<Ce||Re>Te+1:Re>Ce&&Re<=Te)return ge.id}}const je=$e(ge.columns);if(je)return je}return null};return $e(this.#n)}#$(){const ae=new Map(this.#t.map((Re,pe)=>[Re,pe])),Ae=Re=>{if(!Array.isArray(Re.columns)){const $e=Re.column?Re.column.id:Re.id;return ae.has($e)?ae.get($e):1/0}let pe=1/0;for(const $e of Re.columns)pe=Math.min(pe,Ae($e));return pe},Me=Re=>{Re.sort((pe,$e)=>Ae(pe)-Ae($e));for(const pe of Re)Array.isArray(pe.columns)&&Me(pe.columns)};Me(this.#n)}#V(ae){const Ae=Me=>{for(let Re=0;Re<Me.length;Re++){const pe=Me[Re];if(Array.isArray(pe.columns)){const $e=Ae(pe.columns);if($e)return $e}else if(pe.column&&pe.column.id===ae)return Me.splice(Re,1)[0]}return null};return Ae(this.#n)}#W(ae){const Ae=[];for(let Me=ae.length-1;Me>=0;Me--){const Re=ae[Me];Array.isArray(Re.columns)&&(Ae.push(...this.#W(Re.columns)),Re.columns.length===0&&(Ae.push(Re.id),ae.splice(Me,1)))}return Ae}#D(){const ae=(Ae,Me,Re)=>{for(const pe of Ae)Array.isArray(pe.columns)?ae(pe.columns,[...Me,pe.id]):pe.column&&(pe.column.groupPath=Me)};ae(this.#n,[])}#x(ae){const Ae=new Set(ae),Me=this.#t.filter(ce=>Ae.has(ce));if(!Me.length)return;const Re=Math.min(...Me.map(ce=>this.#t.indexOf(ce))),pe=this.#t.slice(0,Re).filter(ce=>!Ae.has(ce)),$e=this.#t.slice(Re).filter(ce=>!Ae.has(ce));this.#t=[...pe,...Me,...$e]}#Y(ae){const Ae=[],Me=Re=>{if(Array.isArray(Re.columns))for(const pe of Re.columns)Me(pe);else Re.column&&Ae.push(Re.column.id)};return Me(ae),Ae}#I(ae){const Ae=Me=>{for(const Re of Me){if(!Array.isArray(Re.columns))continue;if(Re.id===ae)return{node:Re,parent:Me};const pe=Ae(Re.columns);if(pe)return pe}return null};return Ae(this.#n)}groupColumns(ae,Ae={}){const Me=z(ae).filter(ge=>this.#e.has(ge));if(!Me.length)return K("columns.group.empty","groupColumns was given no known column ids; nothing was grouped."),null;for(const ge of Me)if(this.#e.get(ge).layout.lockPosition)return K(`columns.group.locked:${ge}`,`column "${ge}" is position-locked and cannot be grouped.`),null;const Re=Ae.groupId?this.#I(Ae.groupId):null;if(Ae.groupId&&!Re)return K(`columns.group.unknown:${Ae.groupId}`,`no band "${Ae.groupId}" to add to; nothing was grouped.`),null;let pe=null;if(!Re&&Ae.id!=null&&(pe=String(Ae.id),this.#I(pe)||this.#e.has(pe)))return K(`columns.group.idtaken:${pe}`,`band id "${pe}" is already in use; nothing was grouped.`),null;const $e=Me.map(ge=>this.#V(ge)).filter(Boolean);if(!$e.length)return null;let ce;if(Re)Re.node.columns.push(...$e),ce=Re.node.id;else{const ge={id:pe||t("grp"),title:Ae.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:$e},je=Number.isInteger(Ae.at)?Math.max(0,Math.min(Ae.at,this.#n.length)):this.#n.length;this.#n.splice(je,0,ge),ce=ge.id}return this.#W(this.#n),this.#x(Me),this.#D(),this.#$(),this.#w&&this.#w("columngroup",{action:"formed",groupId:ce,ids:Me}),ce}ungroupColumn(ae){const Ae=this.#e.get(ae);if(!Ae){K(`columns.ungroup.unknown:${ae}`,`no column "${ae}" to ungroup.`);return}const Me=Ae.groupPath||[];if(!Me.length)return;const Re=Me[Me.length-1],pe=this.#I(Re);if(!pe)return;const $e=this.#V(ae);if(!$e)return;const ce=pe.parent.indexOf(pe.node);pe.parent.splice(ce+1,0,$e);const ge=this.#W(this.#n),je=this.#Y(pe.node);if(je.length){this.#x(je);const Ve=Math.max(...je.map(Ge=>this.#t.indexOf(Ge))),Se=this.#t.filter(Ge=>Ge!==ae);Se.splice(Ve+1,0,ae),this.#t=Se}this.#D(),this.#$(),this.#w&&this.#w("columngroup",{action:"removed",id:ae,dissolved:ge})}renameGroup(ae,Ae){const Me=this.#I(ae);if(!Me){K(`columns.group.rename:${ae}`,`no band "${ae}" to rename.`);return}Me.node.title=String(Ae??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:ae,title:Me.node.title})}dissolveGroup(ae){const Ae=this.#I(ae);if(!Ae){K(`columns.group.dissolve:${ae}`,`no band "${ae}" to dissolve.`);return}const Me=Ae.parent.indexOf(Ae.node);Ae.parent.splice(Me,1,...Ae.node.columns),this.#D(),this.#$(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:ae})}moveGroup(ae,Ae){const Me=this.#I(ae);if(!Me){K(`columns.group.move:${ae}`,`no band "${ae}" to move.`);return}const Re=Me.parent,pe=Re.indexOf(Me.node);pe!==-1&&(Re.splice(pe,1),Re.splice(Math.max(0,Math.min(Ae,Re.length)),0,Me.node),this.#K(),this.#D(),this.#w&&this.#w("columngroup",{action:"moved",groupId:ae,to:Ae}))}#K(){const ae=[],Ae=Re=>{for(const pe of Re)Array.isArray(pe.columns)?Ae(pe.columns):pe.column&&ae.push(pe.column.id)};Ae(this.#n);const Me=new Set(ae);this.#t=[...ae,...this.#t.filter(Re=>!Me.has(Re))]}groupTree(){const ae=Me=>Me.map(Re=>Array.isArray(Re.columns)?{id:Re.id,title:Re.title||"",collapsible:!!Re.collapsible,openByDefault:Re.openByDefault!==!1,columns:ae(Re.columns)}:Re.column?Re.column.id:null).filter(Re=>Re!==null),Ae=ae(this.#n);return Ae.some(Me=>Me&&typeof Me=="object")?Ae:[]}applyGroupTree(ae){if(!Array.isArray(ae))return;const Ae=new Set,Me=pe=>{const $e=[];for(const ce of pe)if(ce&&typeof ce=="object"&&Array.isArray(ce.columns)){const ge=Me(ce.columns);if(!ge.length)continue;$e.push({id:ce.id||t("grp"),title:ce.title||"",collapsible:ce.collapsible===!0,openByDefault:ce.openByDefault!==!1,showWhen:"always",marryChildren:!1,header:{},def:{},columns:ge})}else if(typeof ce=="string"){const ge=this.#e.get(ce);ge&&!Ae.has(ce)&&(Ae.add(ce),$e.push({column:ge,path:[]}))}return $e},Re=Me(ae);for(const pe of this.#t){if(Ae.has(pe))continue;const $e=this.#e.get(pe);$e&&Re.push({column:$e,path:[]})}this.#n=Re,this.#D(),this.#$(),this.#w&&this.#w("columngroup",{action:"applied"})}show(ae){this.#U(ae,!1)}hide(ae){this.#U(ae,!0)}#U(ae,Ae){const Me=[];for(const Re of z(ae)){const pe=this.#e.get(Re);if(pe){if(Ae&&pe.layout.lockVisible){K(`lockVisible:${Re}`,`column "${Re}" is \`layout.lockVisible\` and cannot be hidden`);continue}pe.layout.hidden!==Ae&&(pe.layout.hidden=Ae,Me.push(Re))}}Me.length&&this.#w&&this.#w("visible",{ids:Me,hidden:Ae})}pin(ae,Ae){const Me=this.#e.get(ae);Me&&(Me.layout.pin=Ae??null,this.#w&&this.#w("pin",{id:ae,side:Me.layout.pin}))}pinMany(ae){const Ae={};for(const[Re,pe]of ae){const $e=this.#e.get(Re);$e&&($e.layout.pin=pe??null,Ae[Re]=$e.layout.pin)}const Me=Object.keys(Ae);Me.length&&this.#w&&this.#w("pin",{ids:Me,pins:Ae})}#B(ae,Ae){const Me=ae.layout.min??0,Re=ae.layout.max;let pe=Math.max(Me,Ae);return Re!=null&&(pe=Math.min(Re,pe)),ae.layout.width=pe,ae.layout.flex=0,pe}resize(ae,Ae){const Me=this.#e.get(ae);if(!Me)return;if(Me.layout.resizable===!1){K(`resize:${ae}`,`column "${ae}" is not resizable; the resize was ignored`);return}const Re=this.#B(Me,Ae);this.#w&&this.#w("resize",{id:ae,width:Re})}resizeMany(ae){const Ae={};for(const[Re,pe]of ae){const $e=this.#e.get(Re);if($e){if($e.layout.resizable===!1){K(`resize:${Re}`,`column "${Re}" is not resizable; the resize was ignored`);continue}Ae[Re]=this.#B($e,pe)}}const Me=Object.keys(Ae);Me.length&&this.#w&&this.#w("resize",{ids:Me,widths:Ae})}}function me(Be){const ae={};return Be.width!=null&&(ae.width=Be.width),Be.hidden!=null&&(ae.hidden=Be.hidden),Be.pin!==void 0&&(ae.pin=Be.pin),ae}function ve(Be){if(Be===null||typeof Be!="object")return Be;try{return structuredClone(Be)}catch{}try{return JSON.parse(JSON.stringify(Be))}catch{return Be}}function fe(Be,ae){const Ae=Be??null,Me=ae??null;if(Ae===Me)return!0;if(Ae===null||Me===null)return!1;if(typeof Ae!="object"||typeof Me!="object")return Ae===Me;try{return JSON.stringify(Ae)===JSON.stringify(Me)}catch{return!1}}function xe(Be){const ae=[],Ae=(Re,pe,$e)=>{const ce=[];for(const ge of Re){if(!l(ge)){Z("a column definition must be an object");continue}if(Array.isArray(ge.columns)){Q(ge,G,"columnGroup",ge.title||ge.id||"(unnamed)");const je={id:ge.id||t("grp"),title:ge.title||"",collapsible:ge.collapsible===!0,openByDefault:ge.openByDefault!==!1,showWhen:ge.showWhen||"always",marryChildren:ge.marryChildren===!0,header:ge.header||{},def:ge,columns:[]};je.columns=Ae(ge.columns,[...pe,je.id],ge.facet!==void 0?ge.facet:$e),ce.push(je)}else{const je={def:ge,path:pe,facet:$e};ae.push(je),ce.push(je)}}return ce},Me=Ae(Be,[],void 0);return{leaves:ae,groups:Me}}function He(Be,ae,Ae){for(const Me of Be){if(Me.columns){if(He(Me.columns,ae,Ae))return!0;continue}if(Me.column&&Me.column.id===ae)return Me.column=Ae,!0}return!1}}),Ue("packages/core/src/columns/autogroup.js",function(e,U){"use strict";Object.defineProperty(e,"AUTO_GROUP_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createAutoGroupColumn",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"warnOnAbsurdGrouping",{enumerable:!0,get:function(){return K}});const C=U("packages/core/src/internal/warn.js").warnOnce,q="__lattice_group",z=240,B=.5;function Z(F){const{columns:X,groupBy:H}=F,j=H.map(c=>X.get(c)).filter(Boolean),w=j.length?j.map(c=>c.title||c.id).join(" > "):"Group",m=F.config&&F.config.autoGroupColumnWidth||z;return{id:q,field:null,title:w,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:H.slice(),group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:m,min:120,pin:F.config&&F.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 F.config&&F.config.grandTotalLabel||"Total";const l=j[Math.min(f.level||0,j.length-1)];return l&&typeof l.formatValue=="function"?l.formatValue(c,f):c==null?"":String(c)}}}function K(F,X,H){!F.length||H<100||X<H*B||C(`grouping.cardinality:${F.join(",")}`,`grouping by ${F.join(", ")} produced ${X} groups for ${H} 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.`)}}),Ue("packages/core/src/columns/selectcolumn.js",function(e,U){"use strict";Object.defineProperty(e,"SELECT_COLUMN_ID",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"createSelectionColumn",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return z}});const te="__lattice_select",C=44;function q(B){const Z=B.selection||{},K=B.config&&B.config.selectionColumnWidth||C;return{id:te,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:K,min:K,max:K,pin:B.config&&B.config.selectionColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,headerCheckbox:Z.headerCheckbox===!0,def:{},getValue(F,X){return X?X.selected:!1},formatValue(){return""}}}const z=q}),Ue("packages/core/src/columns/rownumbercolumn.js",function(e,U){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createRowNumberColumn",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return X}});const C=U("packages/core/src/internal/predicates.js").isFunction,q="__lattice_rownumber",z=40,B=9,Z=22;function K(H){const j=String(Math.max(1,Math.trunc(Math.abs(H))||1)).length;return Math.max(z,j*B+Z)}function F(H){const j=H.rowNumbers,w=j&&typeof j=="object"?j:{},m=Number.isFinite(w.start)?w.start:1,c=Number.isFinite(w.width)?w.width:K((H.maxNumber||0)+m),f=C(H.rank)?H.rank:()=>null;return{id:q,field:null,title:typeof w.title=="string"?w.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:c,min:c,max:c,pin:"start",hidden:!1,resizable:w.width==null,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(l,r){const t=f(r);return t==null?null:t-1+m},formatValue(l){return l==null?"":String(l)}}}const X=F}),Ue("packages/core/src/model/detail.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_DETAIL_HEIGHT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"DEFAULT_CACHE_LIMIT",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DetailModel",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return X}});const C=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce,B=240,Z=10;function K(H){if(!H)return null;const j=H===!0?{}:H;return j.enabled===!1?null:!C(j.rows)&&!j.render?(z("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:j.render||null,config:j.config||null,rows:C(j.rows)?j.rows:null,height:j.height??B,cacheLimit:Number.isFinite(j.cacheLimit)?Math.max(0,j.cacheLimit):Z,isMaster:C(j.isMaster)?j.isMaster:null,target:j.target||null,onCreate:C(j.onCreate)?j.onCreate:null,path:typeof j.path=="string"?j.path:null}}class F{#e;#t=new Set;#n;#r=0;constructor(j){this.#e=j.config,this.#n=C(j.onChange)?j.onChange:()=>{}}get config(){return this.#e}get inline(){return!this.#e.target}isMaster(j){if(!j||j.group||j.detail)return!1;const w=this.#e.isMaster;return w?!!w(j.data,j):!0}isOpen(j){return this.#t.has(j)}keys(){return[...this.#t]}activeKey(){for(const j of this.#t)return j;return null}heightOf(j){const w=this.#e.height;return C(w)?Number(w(j))||B:w==="auto"?B:Number(w)||B}open(j){return this.#t.has(j)?!1:(this.inline||this.#t.clear(),this.#t.add(j),this.#s(),!0)}close(j){return this.#t.delete(j)?(this.#s(),!0):!1}toggle(j){return this.#t.has(j)?(this.close(j),!1):(this.open(j),!0)}closeAll(){this.#t.size&&(this.#t.clear(),this.#s())}prune(j){if(!this.#t.size||!C(j))return;let w=!1;for(const m of[...this.#t])j(m)||(this.#t.delete(m),w=!0);w&&this.#s()}signature(){return`${this.#r}`}set(j){this.#t.clear();const w=Array.isArray(j)?j:[];for(const m of this.inline?w:w.slice(0,1))this.#t.add(m);this.#s()}#s(){this.#r++,this.#n()}}const X=F}),Ue("packages/core/src/compute/special.js",function(e,U){"use strict";Object.defineProperty(e,"logGamma",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"incompleteBeta",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"normalQuantile",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"normalCdf",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"studentT",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"chiSquareUpperTail",{enumerable:!0,get:function(){return l}});const te=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),C=3e-12,q=1e-300;function z(r){if(r<.5)return Math.log(Math.PI/Math.sin(Math.PI*r))-z(1-r);const t=r-1;let i=.9999999999998099;const s=t+7.5;for(let n=0;n<te.length;n++)i+=te[n]/(t+n+1);return .5*Math.log(2*Math.PI)+(t+.5)*Math.log(s)-s+Math.log(i)}function B(r,t,i){const s=r+t,n=r+1,u=r-1;let o=1,a=1-s*i/n;Math.abs(a)<q&&(a=q),a=1/a;let h=a;for(let v=1;v<=300;v++){const g=2*v;let k=v*(t-v)*i/((u+g)*(r+g));a=1+k*a,Math.abs(a)<q&&(a=q),o=1+k/o,Math.abs(o)<q&&(o=q),a=1/a,h*=a*o,k=-(r+v)*(s+v)*i/((r+g)*(n+g)),a=1+k*a,Math.abs(a)<q&&(a=q),o=1+k/o,Math.abs(o)<q&&(o=q),a=1/a;const d=a*o;if(h*=d,Math.abs(d-1)<C)break}return h}function Z(r,t,i){if(!(r>0)||!(t>0)||!Number.isFinite(i))return Number.NaN;if(i<=0)return 0;if(i>=1)return 1;const s=Math.exp(z(r+t)-z(r)-z(t)+r*Math.log(i)+t*Math.log(1-i));return i<(r+1)/(r+t+2)?s*B(r,t,i)/r:1-s*B(t,r,1-i)/t}function K(r){if(!(r>0)||!(r<1))return r===0?-1/0:r===1?1/0:Number.NaN;const t=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],i=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],s=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],n=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],u=.02425;let o,a,h;r<u?(o=Math.sqrt(-2*Math.log(r)),h=(((((s[0]*o+s[1])*o+s[2])*o+s[3])*o+s[4])*o+s[5])/((((n[0]*o+n[1])*o+n[2])*o+n[3])*o+1)):r<=1-u?(o=r-.5,a=o*o,h=(((((t[0]*a+t[1])*a+t[2])*a+t[3])*a+t[4])*a+t[5])*o/(((((i[0]*a+i[1])*a+i[2])*a+i[3])*a+i[4])*a+1)):(o=Math.sqrt(-2*Math.log(1-r)),h=-(((((s[0]*o+s[1])*o+s[2])*o+s[3])*o+s[4])*o+s[5])/((((n[0]*o+n[1])*o+n[2])*o+n[3])*o+1));const g=(.5*F(-h/Math.SQRT2)-r)*Math.sqrt(2*Math.PI)*Math.exp(h*h/2);return h-g/(1+h*g/2)}function F(r){const t=Math.abs(r),i=2/(2+t),s=4*i-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 u=0,o=0,a;for(let v=n.length-1;v>0;v--)a=o,o=s*o-u+n[v],u=a;const h=i*Math.exp(-t*t+.5*(n[0]+s*o)-u);return r>=0?h:2-h}function X(r){return .5*F(-r/Math.SQRT2)}function H(r,t){if(!(t>0)||!Number.isFinite(r))return Number.NaN;const i=.5*Z(t/2,.5,t/(t+r*r));return r>0?1-i:i}function j(r,t){if(!(r>0)||!(r<1)||!(t>0))return Number.NaN;if(t>1e7)return K(r);let i=-1e4,s=1e4,n=K(r);const u=z(t/2)+z(.5)-z((t+1)/2);for(let o=0;o<60;o++){const a=H(n,t);a<r?i=n:s=n;const h=Math.exp(-((t+1)/2)*Math.log(1+n*n/t)-u)/Math.sqrt(t),v=h>0?(a-r)/h:0;if(Math.abs(v)<1e-12)break;const g=n-v;if(n=g>i&&g<s&&Number.isFinite(g)?g:(i+s)/2,s-i<1e-12)break}return n}function w(r,t){let i=r,s=1/r,n=s;for(let u=0;u<300&&(i+=1,n*=t/i,s+=n,!(Math.abs(n)<Math.abs(s)*C));u++);return s*Math.exp(-t+r*Math.log(t)-z(r))}function m(r,t){let i=t+1-r,s=1/q,n=1/i,u=n;for(let o=1;o<=300;o++){const a=-o*(o-r);i+=2,n=a*n+i,Math.abs(n)<q&&(n=q),s=i+a/s,Math.abs(s)<q&&(s=q),n=1/n;const h=n*s;if(u*=h,Math.abs(h-1)<C)break}return Math.exp(-t+r*Math.log(t)-z(r))*u}function c(r,t){return!(r>0)||!(t>=0)||!Number.isFinite(t)?Number.NaN:t===0?0:t<r+1?w(r,t):1-m(r,t)}function f(r,t){return t>0?c(t/2,r/2):Number.NaN}function l(r,t){const i=f(r,t);return Number.isNaN(i)?Number.NaN:Math.min(1,Math.max(0,1-i))}}),Ue("packages/core/src/compute/linalg.js",function(e,U){"use strict";Object.defineProperty(e,"cholesky",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"choleskySolve",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"choleskyInverse",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"normalEquations",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return Z}});function te(K){const F=K.length,X=Array.from({length:F},()=>new Array(F).fill(0));for(let H=0;H<F;H++)for(let j=0;j<=H;j++){let w=K[H][j];for(let m=0;m<j;m++)w-=X[H][m]*X[j][m];if(H===j){if(!(w>0))return null;X[H][j]=Math.sqrt(w)}else X[H][j]=w/X[j][j]}return X}function C(K,F){const X=K.length,H=new Array(X).fill(0);for(let w=0;w<X;w++){let m=F[w];for(let c=0;c<w;c++)m-=K[w][c]*H[c];H[w]=m/K[w][w]}const j=new Array(X).fill(0);for(let w=X-1;w>=0;w--){let m=H[w];for(let c=w+1;c<X;c++)m-=K[c][w]*j[c];j[w]=m/K[w][w]}return j}function q(K){const F=K.length,X=Array.from({length:F},()=>new Array(F).fill(0));for(let H=0;H<F;H++){const j=new Array(F).fill(0);j[H]=1;const w=C(K,j);for(let m=0;m<F;m++)X[m][H]=w[m]}return X}function z(K,F,X){const H=K.length,j=H?K[0].length:0,w=Array.from({length:j},()=>new Array(j).fill(0)),m=new Array(j).fill(0);for(let c=0;c<H;c++){const f=X?X[c]:1,l=K[c];for(let r=0;r<j;r++){const t=f*l[r];m[r]+=t*F[c];for(let i=r;i<j;i++)w[r][i]+=t*l[i]}}for(let c=0;c<j;c++)for(let f=0;f<c;f++)w[c][f]=w[f][c];return{xtwx:w,xtwy:m}}function B(K,F){return K.map(X=>X.reduce((H,j,w)=>H+j*F[w],0))}function Z(K,F){let X=0;for(let H=0;H<K.length;H++){let j=0;for(let w=0;w<K.length;w++)j+=F[H][w]*K[w];X+=K[H]*j}return X}}),Ue("packages/core/src/compute/sketch.js",function(e,U){"use strict";Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return w}});class te{#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(c){if(!Number.isFinite(c))return;this.#e++;const f=c-this.#t;this.#t+=f/this.#e,this.#n+=f*(c-this.#t)}merge(c){if(c.#e===0)return;if(this.#e===0){this.#e=c.#e,this.#t=c.#t,this.#n=c.#n;return}const f=this.#e+c.#e,l=c.#t-this.#t;this.#t+=l*(c.#e/f),this.#n+=c.#n+l*l*(this.#e*c.#e/f),this.#e=f}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 c=this.variance();return c===null?null:Math.sqrt(c)}stddevP(){const c=this.varianceP();return c===null?null:Math.sqrt(c)}}class C{#e=[];#t=0;#n;#r;constructor(c,f=Math.random){if(!(c>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(c),this.#r=f}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(c){if(!Number.isFinite(c))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(c);return}const f=Math.floor(this.#r()*this.#t);f<this.#n&&(this.#e[f]=c)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let c=0;for(const f of this.#e)c+=f;return c/this.#e.length}quantile(c){const f=this.#e.length;if(!f)return null;const l=this.#e.slice().sort((s,n)=>s-n);if(f===1)return l[0];const r=(f-1)*Math.min(1,Math.max(0,c)),t=Math.floor(r),i=Math.ceil(r);return t===i?l[t]:l[t]+(r-t)*(l[i]-l[t])}}function q(m){return m^=m>>>16,m=Math.imul(m,2246822507),m^=m>>>13,m=Math.imul(m,3266489909),m^=m>>>15,m>>>0}function z(m){if(typeof m=="number"){const l=new DataView(new ArrayBuffer(8));return l.setFloat64(0,m===0?0:m),q(l.getUint32(0)^l.getUint32(4))}const c=typeof m=="string"?m:String(m);let f=2166136261;for(let l=0;l<c.length;l++)f^=c.charCodeAt(l),f=Math.imul(f,16777619);return q(f)}class B{#e;#t;#n;constructor(c=14){const f=Math.floor(c);if(f<4||f>16)throw new RangeError("HLL precision must be 4..16");this.#e=f,this.#t=1<<f,this.#n=new Uint8Array(this.#t)}static errorBoundFor(c=14){const f=1<<Math.floor(c),l=1.04/Math.sqrt(f);return Object.freeze({kind:"probabilistic",metric:"relative",value:l,statement:`distinct count within ~${(l*100).toFixed(2)}% relative standard error (m=${f} buckets)`})}errorBound(){return B.errorBoundFor(this.#e)}add(c){const f=z(c),l=f&this.#t-1,r=f>>>this.#e|1<<32-this.#e;let t=1,i=r;for(;(i&1)===0;)t++,i>>>=1;t>this.#n[l]&&(this.#n[l]=t)}count(){const c=this.#t,f=32-this.#e,l=new Float64Array(f+2);for(let i=0;i<c;i++)l[this.#n[i]]++;let r=c*F(1-l[f+1]/c);for(let i=f;i>=1;i--)r=.5*(r+l[i]);r+=c*K(l[0]/c);const t=Z*c*c/r;return Math.round(t)}}const Z=.5/Math.log(2);function K(m){if(m===1)return 1/0;let c=1,f=m,l;do m*=m,l=f,f+=m*c,c+=c;while(f!==l);return f}function F(m){if(m===0||m===1)return 0;let c=1,f=1-m,l;do m=Math.sqrt(m),l=f,c*=.5,f-=(1-m)**2*c;while(f!==l);return f/3}class X{#e=new Map;#t;#n=0;constructor(c){if(!(c>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(c)}errorBoundFor(c){const f=c/this.#t;return Object.freeze({kind:"deterministic",metric:"absolute",value:f,statement:`each count overestimates the truth by at most N/m = ${f.toFixed(2)} (N=${c}, m=${this.#t})`})}get seen(){return this.#n}add(c){this.#n++;const f=this.#e.get(c);if(f){f.count++;return}if(this.#e.size<this.#t){this.#e.set(c,{count:1,error:0});return}let l,r=1/0;for(const[t,i]of this.#e)i.count<r&&(r=i.count,l=t);this.#e.delete(l),this.#e.set(c,{count:r+1,error:r})}top(c=this.#t){return[...this.#e.entries()].map(([l,r])=>({item:l,count:r.count,error:r.error})).sort((l,r)=>r.count-l.count).slice(0,Math.max(0,Math.floor(c)))}}class H{#e;#t=[[]];#n=0;#r;#s;constructor(c=200,f=Math.random){this.#e=Math.max(8,Math.floor(c)),this.#r=f,this.#s=2/3}static errorBoundFor(c=200){const f=1/Math.max(8,Math.floor(c));return Object.freeze({kind:"probabilistic",metric:"rank",value:f,statement:`queried quantile's true rank within ~${(f*100).toFixed(2)}% of N of the requested rank (k=${c})`})}errorBound(){return H.errorBoundFor(this.#e)}get count(){return this.#n}#i(c){const l=this.#t.length-1-c,r=Math.ceil(this.#e*this.#s**l);return Math.max(2,r)}add(c){Number.isFinite(c)&&(this.#n++,this.#t[0].push(c),this.#t[0].length>=this.#i(0)&&this.#o(0))}#o(c){const f=this.#t[c];f.sort((t,i)=>t-i),c+1>=this.#t.length&&this.#t.push([]);const l=this.#t[c+1],r=this.#r()<.5?0:1;for(let t=r;t<f.length;t+=2)l.push(f[t]);this.#t[c]=[];for(let t=0;t<this.#t.length;t++)if(this.#t[t].length>=this.#i(t)){this.#o(t);return}}#l(){const c=[];for(let f=0;f<this.#t.length;f++){const l=1<<f;for(const r of this.#t[f])c.push({v:r,w:l})}return c}quantile(c){const f=this.#l();if(!f.length)return null;f.sort((i,s)=>i.v-s.v);let l=0;for(const i of f)l+=i.w;const r=Math.min(1,Math.max(0,c))*l;let t=0;for(const i of f)if(t+=i.w,t>=r)return i.v;return f[f.length-1].v}rank(c){let f=0;for(let l=0;l<this.#t.length;l++){const r=1<<l;for(const t of this.#t[l])t<=c&&(f+=r)}return f}}const j=Object.freeze({distinct:B.errorBoundFor(14),median:H.errorBoundFor(200),p25:H.errorBoundFor(200),p75:H.errorBoundFor(200),p90:H.errorBoundFor(200),p95:H.errorBoundFor(200),p99:H.errorBoundFor(200),iqr:H.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"})}),w={Welford:te,Reservoir:C,HyperLogLog:B,SpaceSaving:X,KLL:H,hash32:z,SKETCH_BOUNDS:j}}),Ue("packages/core/src/compute/statistics.js",function(e,U){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"numbers",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"frequencies",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"herfindahl",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"entropy",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"evenness",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"topShare",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"gini",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"moments",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"quantileSorted",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"quantile",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"STAT_FNS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return P}}),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 E}}),Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"covariance",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"autocorrelations",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"spearman",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(e,"kendall",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(e,"seriesStats",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(e,"D2_N2",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(e,"D4_N2",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(e,"movingRanges",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"withinSigma",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(e,"countOutside",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(e,"histogram",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(e,"DEFAULT_CONFIDENCE",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(e,"meanInterval",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(e,"proportionInterval",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(e,"slopeInterval",{enumerable:!0,get:function(){return Ot}}),Object.defineProperty(e,"capabilityInterval",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(e,"standardizedMeanDifference",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(e,"normalTotalVariation",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(e,"frequencyMap",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(e,"categoricalDistance",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(e,"SUBSET_RELIABILITY_FLOOR",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(e,"compareColumn",{enumerable:!0,get:function(){return at}}),Object.defineProperty(e,"isNumericColumn",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(e,"populationRead",{enumerable:!0,get:function(){return Oe}});const te=U("packages/core/src/compute/handle.js"),C=te.presenceReader,q=te.valueReader,z=U("packages/core/src/compute/special.js"),B=z.studentTQuantile,Z=z.studentT,K=z.normalQuantile,F=z.normalCdf,X=z.chiSquareUpperTail,H=U("packages/core/src/compute/linalg.js"),j=H.cholesky,w=H.choleskySolve,m=H.choleskyInverse,c=H.normalEquations,f=H.quadForm,r=U("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,t=5e3,i=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"}),s=Object.freeze({distinct:Object.freeze({sketch:"HyperLogLog",bound:r.distinct}),median:Object.freeze({sketch:"KLL",bound:r.median}),p25:Object.freeze({sketch:"KLL",bound:r.p25}),p75:Object.freeze({sketch:"KLL",bound:r.p75}),p90:Object.freeze({sketch:"KLL",bound:r.p90}),p95:Object.freeze({sketch:"KLL",bound:r.p95}),p99:Object.freeze({sketch:"KLL",bound:r.p99}),iqr:Object.freeze({sketch:"KLL",bound:r.iqr}),top3Share:Object.freeze({sketch:"SpaceSaving",bound:r.topK}),top10Share:Object.freeze({sketch:"SpaceSaving",bound:r.topK})});function n(ue){const Ee=ue==="sum"||ue==="avg"||ue==="countValues"||ue==="min"||ue==="max"?"maintained":Object.prototype.hasOwnProperty.call(i,ue)?i[ue]:null,be=Object.prototype.hasOwnProperty.call(s,ue)?s[ue]:null;return{stat:ue,exact:Ee,approximate:be}}function u(ue,Ee){const be=Ee.length,Ne=new Float64Array(be);let re=0;if(ue&&(ue.kind==="float64"||ue.kind==="int32")){const ke=ue.values,Le=C(ue);for(let De=0;De<be;De++){const Pe=Ee[De];if(Le&&Le(Pe)!==1)continue;const _e=ke[Pe];Number.isNaN(_e)||(Ne[re++]=_e)}return Ne.subarray(0,re)}const we=q(ue);for(let ke=0;ke<be;ke++){const Le=we(Ee[ke]);if(Le==null||Le==="")continue;const De=typeof Le=="number"?Le:Number(Le);Number.isFinite(De)&&(Ne[re++]=De)}return Ne.subarray(0,re)}function o(ue,Ee){const be=new Map,Ne=q(ue);let re=0;for(let we=0;we<Ee.length;we++){const ke=Ne(Ee[we]);if(ke==null||ke===""||typeof ke=="number"&&Number.isNaN(ke))continue;const Le=typeof ke=="object"?String(ke):ke;be.set(Le,(be.get(Le)||0)+1),re++}const oe=[...be.values()].sort((we,ke)=>ke-we);return{counts:oe,total:re,distinct:oe.length}}function a(ue){return ue.total>0?ue.counts.map(Ee=>Ee/ue.total):[]}function h(ue,Ee){const be=o(ue,Ee);if(!be.total)return null;let Ne=0;for(const re of a(be))Ne+=re*re;return Ne}function v(ue,Ee){const be=o(ue,Ee);if(!be.total)return null;let Ne=0;for(const re of a(be))re>0&&(Ne-=re*Math.log2(re));return Ne}function g(ue,Ee){const be=o(ue,Ee);if(!be.total||be.distinct<2)return be.total?1:null;let Ne=0;for(const re of a(be))re>0&&(Ne-=re*Math.log2(re));return Ne/Math.log2(be.distinct)}function k(ue,Ee,be=3){const Ne=o(ue,Ee);if(!Ne.total)return null;const re=Math.max(1,Math.floor(be));let oe=0;for(let we=0;we<Math.min(re,Ne.counts.length);we++)oe+=Ne.counts[we];return oe/Ne.total}function d(ue,Ee){const be=u(ue,Ee),Ne=be.length;if(!Ne)return null;const re=be.slice().sort();if(re[0]<0)return null;let oe=0,we=0;for(let ke=0;ke<Ne;ke++)oe+=re[ke],we+=(ke+1)*re[ke];return oe===0?0:2*we/(Ne*oe)-(Ne+1)/Ne}function p(ue){let Ee=0,be=0,Ne=0;for(let re=0;re<ue.length;re++){const oe=ue[re];Ee++;const we=oe-be;be+=we/Ee,Ne+=we*(oe-be)}return{n:Ee,mean:be,m2:Ne}}function b(ue,Ee){const be=ue.length;if(!be)return NaN;if(be===1)return ue[0];const Ne=(be-1)*Math.min(1,Math.max(0,Ee)),re=Math.floor(Ne),oe=Math.ceil(Ne);return re===oe?ue[re]:ue[re]+(Ne-re)*(ue[oe]-ue[re])}function O(ue,Ee){if(!ue.length)return NaN;const be=ue.slice().sort();return b(be,Ee)}function y(ue,Ee){const be=q(ue);let Ne=0,re=0,oe=0;for(let we=0;we<Ee.length;we++){const ke=be(Ee[we]);if(ke==null||ke==="")continue;const Le=String(ke).toUpperCase();Le==="PASS"?Ne++:Le==="FAIL"?re++:Le==="WARN"&&oe++}return{pass:Ne+oe,fail:re,warn:oe,judged:Ne+oe+re}}const M=Object.freeze({hhi:(ue,Ee)=>h(ue,Ee),entropy:(ue,Ee)=>v(ue,Ee),evenness:(ue,Ee)=>g(ue,Ee),top3Share:(ue,Ee)=>k(ue,Ee,3),top10Share:(ue,Ee)=>k(ue,Ee,10),gini:(ue,Ee)=>d(ue,Ee),trimmedMean:(ue,Ee)=>$(u(ue,Ee),.1),winsorizedMean:(ue,Ee)=>P(u(ue,Ee),.1),robustOutliers:(ue,Ee)=>N(u(ue,Ee),3.5),jarqueBera:(ue,Ee)=>T(u(ue,Ee)),variance:(ue,Ee)=>{const{n:be,m2:Ne}=p(u(ue,Ee));return be>1?Ne/(be-1):null},varianceP:(ue,Ee)=>{const{n:be,m2:Ne}=p(u(ue,Ee));return be>0?Ne/be:null},stddev:(ue,Ee)=>{const{n:be,m2:Ne}=p(u(ue,Ee));return be>1?Math.sqrt(Ne/(be-1)):null},stddevP:(ue,Ee)=>{const{n:be,m2:Ne}=p(u(ue,Ee));return be>0?Math.sqrt(Ne/be):null},median:(ue,Ee)=>{const be=u(ue,Ee);return be.length?O(be,.5):null},p25:(ue,Ee)=>{const be=u(ue,Ee);return be.length?O(be,.25):null},p75:(ue,Ee)=>{const be=u(ue,Ee);return be.length?O(be,.75):null},p90:(ue,Ee)=>{const be=u(ue,Ee);return be.length?O(be,.9):null},p95:(ue,Ee)=>{const be=u(ue,Ee);return be.length?O(be,.95):null},p99:(ue,Ee)=>{const be=u(ue,Ee);return be.length?O(be,.99):null},iqr:(ue,Ee)=>{const be=u(ue,Ee);if(!be.length)return null;const Ne=be.slice().sort();return b(Ne,.75)-b(Ne,.25)},mad:(ue,Ee)=>{const be=u(ue,Ee);if(!be.length)return null;const Ne=O(be,.5),re=new Float64Array(be.length);for(let oe=0;oe<be.length;oe++)re[oe]=Math.abs(be[oe]-Ne);return O(re,.5)},range:(ue,Ee)=>{const be=u(ue,Ee);if(!be.length)return null;let Ne=1/0,re=-1/0;for(let oe=0;oe<be.length;oe++)be[oe]<Ne&&(Ne=be[oe]),be[oe]>re&&(re=be[oe]);return re-Ne},distinct:(ue,Ee)=>{const be=q(ue),Ne=new Set;for(let re=0;re<Ee.length;re++){const oe=be(Ee[re]);oe==null||oe===""||Ne.add(oe instanceof Date?oe.getTime():oe)}return Ne.size},mode:(ue,Ee)=>{const be=q(ue),Ne=new Map;for(let we=0;we<Ee.length;we++){const ke=be(Ee[we]);if(ke==null||ke==="")continue;const Le=ke instanceof Date?ke.getTime():ke;Ne.set(Le,(Ne.get(Le)||0)+1)}let re=null,oe=1;for(const[we,ke]of Ne)ke>oe&&(oe=ke,re=we);return re},skewness:(ue,Ee)=>{const be=u(ue,Ee),{n:Ne,mean:re,m2:oe}=p(be);if(Ne<3||oe<=0)return null;const we=Math.sqrt(oe/(Ne-1));let ke=0;for(let Le=0;Le<be.length;Le++)ke+=((be[Le]-re)/we)**3;return Ne/((Ne-1)*(Ne-2))*ke},kurtosis:(ue,Ee)=>{const be=u(ue,Ee),{n:Ne,mean:re,m2:oe}=p(be);if(Ne<4||oe<=0)return null;const we=Math.sqrt(oe/(Ne-1));let ke=0;for(let Pe=0;Pe<be.length;Pe++)ke+=((be[Pe]-re)/we)**4;const Le=Ne*(Ne+1)/((Ne-1)*(Ne-2)*(Ne-3)),De=3*(Ne-1)**2/((Ne-2)*(Ne-3));return Le*ke-De},geomean:(ue,Ee)=>{const be=u(ue,Ee);if(!be.length)return null;let Ne=0;for(let re=0;re<be.length;re++){if(be[re]<=0)return null;Ne+=Math.log(be[re])}return Math.exp(Ne/be.length)},harmean:(ue,Ee)=>{const be=u(ue,Ee);if(!be.length)return null;let Ne=0;for(let re=0;re<be.length;re++){if(be[re]===0)return null;Ne+=1/be[re]}return be.length/Ne},sumSquares:(ue,Ee)=>{const be=u(ue,Ee);let Ne=0;for(let re=0;re<be.length;re++)Ne+=be[re]*be[re];return Ne},passRate:(ue,Ee)=>{const{pass:be,judged:Ne}=y(ue,Ee);return Ne?be/Ne:null},failureCount:(ue,Ee)=>y(ue,Ee).fail}),D=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 _(ue,Ee,be){const Ne=q(ue),re=q(Ee);let oe=0,we=0;for(let ke=0;ke<be.length;ke++){const Le=be[ke],De=Number(Ne(Le)),Pe=Number(re(Le));!Number.isFinite(De)||!Number.isFinite(Pe)||(oe+=De*Pe,we+=Pe)}return we===0?null:oe/we}function I(ue,Ee,be){const Ne=q(ue);let re=null,oe=be?-1/0:1/0;for(let we=0;we<Ee.length;we++){const ke=Ee[we],Le=Number(Ne(ke));Number.isFinite(Le)&&(be?Le>oe:Le<oe)&&(oe=Le,re=ke)}return re}function L(ue,Ee,be){const Ne=q(ue),re=q(Ee);let oe=0,we=0,ke=0,Le=0,De=0,Pe=0;for(let et=0;et<be.length;et++){const ft=be[et],dt=Number(Ne(ft)),ut=Number(re(ft));!Number.isFinite(dt)||!Number.isFinite(ut)||(oe++,we+=dt,ke+=ut,Le+=dt*dt,De+=ut*ut,Pe+=dt*ut)}if(oe<2)return null;const _e=oe*Pe-we*ke,qe=Math.sqrt((oe*Le-we*we)*(oe*De-ke*ke));if(qe===0)return null;const Qe=_e/qe;return Math.max(-1,Math.min(1,Qe))}function $(ue,Ee=.1){const be=ue.length;if(!be)return null;const Ne=Array.from(ue).sort((ke,Le)=>ke-Le),re=Math.floor(be*Math.min(.49,Math.max(0,Ee))),oe=Ne.slice(re,be-re);if(!oe.length)return b(Ne,.5);let we=0;for(const ke of oe)we+=ke;return we/oe.length}function P(ue,Ee=.1){const be=ue.length;if(!be)return null;const Ne=Array.from(ue).sort((Le,De)=>Le-De),re=Math.floor(be*Math.min(.49,Math.max(0,Ee))),oe=Ne[re],we=Ne[be-1-re];let ke=0;for(const Le of Ne)ke+=Math.min(we,Math.max(oe,Le));return ke/be}function N(ue,Ee=3.5){if(!ue.length)return null;const Ne=Array.from(ue).sort((Le,De)=>Le-De),re=b(Ne,.5),oe=Ne.map(Le=>Math.abs(Le-re)).sort((Le,De)=>Le-De),we=b(oe,.5);if(we===0)return null;let ke=0;for(const Le of Ne)Math.abs(.6745*(Le-re)/we)>Ee&&ke++;return ke}function T(ue){const Ee=ue.length;if(Ee<8)return null;let be=0;for(const Le of ue)be+=Le;be/=Ee;let Ne=0,re=0,oe=0;for(const Le of ue){const De=Le-be;Ne+=De*De,re+=De*De*De,oe+=De*De*De*De}if(Ne/=Ee,re/=Ee,oe/=Ee,Ne===0)return null;const we=re/Ne**1.5,ke=oe/(Ne*Ne)-3;return Ee/6*(we*we+ke*ke/4)}function E(ue,Ee,be){const Ne=[];let re=0;for(let Le=0;Le<ue.length;Le++){const De=Number(ue[Le]),Pe=Number(Ee[Le]);!Number.isFinite(De)||!Number.isFinite(Pe)||Pe<=0||(Ne.push([De,Pe]),re+=Pe)}if(!Ne.length||re<=0)return null;if(Ne.sort((Le,De)=>Le[0]-De[0]),Ne.length===1)return Ne[0][0];const oe=[];let we=0;for(const[,Le]of Ne)oe.push((we+Le/2)/re),we+=Le;const ke=Math.max(0,Math.min(1,be));if(ke<=oe[0])return Ne[0][0];if(ke>=oe[oe.length-1])return Ne[Ne.length-1][0];for(let Le=1;Le<oe.length;Le++){if(ke>oe[Le])continue;const De=oe[Le]-oe[Le-1],Pe=De>0?(ke-oe[Le-1])/De:0;return Ne[Le-1][0]+(Ne[Le][0]-Ne[Le-1][0])*Pe}return Ne[Ne.length-1][0]}function A(ue,Ee,be){const Ne=q(ue),re=q(Ee),oe=new Float64Array(be.length),we=new Float64Array(be.length);let ke=0;for(let Le=0;Le<be.length;Le++){const De=be[Le],Pe=Number(Ne(De)),_e=Number(re(De));!Number.isFinite(Pe)||!Number.isFinite(_e)||(oe[ke]=Pe,we[ke]=_e,ke++)}return{xs:oe.subarray(0,ke),ys:we.subarray(0,ke),n:ke}}function S(ue,Ee,be,Ne=!1){const{xs:re,ys:oe,n:we}=A(ue,Ee,be);if(we<2)return null;let ke=0,Le=0;for(let Pe=0;Pe<we;Pe++)ke+=re[Pe],Le+=oe[Pe];ke/=we,Le/=we;let De=0;for(let Pe=0;Pe<we;Pe++)De+=(re[Pe]-ke)*(oe[Pe]-Le);return De/(Ne?we:we-1)}function x(ue,Ee,be){const{xs:Ne,ys:re,n:oe}=A(ue,Ee,be);if(oe<2)return null;let we=0,ke=0;for(let dt=0;dt<oe;dt++)we+=Ne[dt],ke+=re[dt];we/=oe,ke/=oe;let Le=0,De=0,Pe=0;for(let dt=0;dt<oe;dt++){const ut=Ne[dt]-we,Ct=re[dt]-ke;Le+=ut*ut,De+=ut*Ct,Pe+=Ct*Ct}if(Le===0)return null;const _e=De/Le,qe=ke-_e*we,Qe=Pe===0?1:Math.max(0,Math.min(1,De*De/(Le*Pe))),et=Math.max(0,Pe-_e*De),ft=oe>2?Math.sqrt(et/(oe-2)/Le):0;return{slope:_e,intercept:qe,r2:Qe,stdError:ft,n:oe}}const W=new Set(["ols","wls","robust"]),V=new Set(["quantile"]),G=new Set(["ridge","lasso","elasticnet","mixed","gls"]),Q=1.345;function ee(ue,Ee,be){const{xtwx:Ne,xtwy:re}=c(ue,Ee,be),oe=j(Ne);if(!oe)return null;const we=w(oe,re),ke=m(oe),Le=ne(ue,we),De=Ee.map((Pe,_e)=>Pe-Le[_e]);return{beta:we,cov:ke,fitted:Le,residuals:De}}function ne(ue,Ee){return ue.map(be=>be.reduce((Ne,re,oe)=>Ne+re*Ee[oe],0))}function se(ue,Ee){const be=ue.length,Ne=ue.map(De=>De[Ee]),re=ue.map(De=>[1,...De.filter((Pe,_e)=>_e!==Ee)]),oe=ee(re,Ne,null);if(!oe)return 1;const we=Ne.reduce((De,Pe)=>De+Pe,0)/be;let ke=0,Le=0;for(let De=0;De<be;De++)ke+=oe.residuals[De]**2,Le+=(Ne[De]-we)**2;return Le===0?1:Math.max(0,Math.min(1,1-ke/Le))}function le(ue){const Ee=[...ue].sort((re,oe)=>re-oe),be=me(Ee),Ne=ue.map(re=>Math.abs(re-be)).sort((re,oe)=>re-oe);return me(Ne)/.6745}function me(ue){const Ee=ue.length;if(!Ee)return 0;const be=Math.floor(Ee/2);return Ee%2?ue[be]:(ue[be-1]+ue[be])/2}function ve(ue,Ee,be={}){const Ne=be.method||"ols";if(G.has(Ne))throw new Error(`[lattice] regression method "${Ne}" is out of scope; use ols, wls or robust.`);if(V.has(Ne))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!W.has(Ne))throw new Error(`[lattice] unknown regression method "${Ne}"; use ols, wls or robust.`);const re=Array.isArray(Ee)?Ee.length:0,oe=re&&Array.isArray(ue[0])?ue[0].length:0,we=oe+1;if(!(re>we))return null;for(let Dt=0;Dt<re;Dt++){if(!Number.isFinite(Ee[Dt])||!Array.isArray(ue[Dt])||ue[Dt].length!==oe)return null;for(let Bt=0;Bt<oe;Bt++)if(!Number.isFinite(ue[Dt][Bt]))return null}let ke=null;if(Ne==="wls"){if(ke=be.weights,!Array.isArray(ke)||ke.length!==re)return null;for(let Dt=0;Dt<re;Dt++)if(!(ke[Dt]>0)||!Number.isFinite(ke[Dt]))return null}const Le=ue.map(Dt=>[1,...Dt]);let De,Pe=null;if(Ne==="robust"){if(De=ee(Le,Ee,null),!De)return null;for(let Dt=0;Dt<50;Dt++){const Bt=le(De.residuals);if(!(Bt>0))break;const zt=De.residuals.map(Jt=>{const qt=Math.abs(Jt/Bt);return qt<=Q?1:Q/qt}),Yt=ee(Le,Ee,zt);if(!Yt)return null;const Qt=Yt.beta.reduce((Jt,qt,rn)=>Math.max(Jt,Math.abs(qt-De.beta[rn])),0);if(De=Yt,Pe=zt,Qt<1e-10)break}}else if(De=ee(Le,Ee,ke),!De)return null;const _e=Ne==="robust"?Pe:ke,{beta:qe,cov:Qe,fitted:et,residuals:ft}=De;let dt=0,ut=0,Ct=0;for(let Dt=0;Dt<re;Dt++){const Bt=_e?_e[Dt]:1;dt+=Bt*ft[Dt]**2,ut+=Bt,Ct+=Bt*Ee[Dt]}const Mt=Ct/ut;let xt=0;for(let Dt=0;Dt<re;Dt++){const Bt=_e?_e[Dt]:1;xt+=Bt*(Ee[Dt]-Mt)**2}const Ye=re-we,mt=dt/Ye,gt=xt===0?1:Math.max(0,Math.min(1,1-dt/xt)),St=1-(1-gt)*(re-1)/Ye,Rt=Array.isArray(be.names)&&be.names.length===oe?be.names:ue[0].map((Dt,Bt)=>`x${Bt+1}`),vt=it(be.confidence),bt=Ye>0?B(1-(1-vt)/2,Ye):1/0,Lt=qe.map((Dt,Bt)=>{const zt=Math.sqrt(Math.max(0,mt*Qe[Bt][Bt])),Yt=zt>0?Dt/zt:Dt===0?0:1/0,Qt=Number.isFinite(Yt)?2*(1-Z(Math.abs(Yt),Ye)):0,Jt=Number.isFinite(bt)?bt*zt:null;return{name:Bt===0?"(intercept)":Rt[Bt-1],estimate:Dt,stdError:zt,t:Yt,p:Math.max(0,Math.min(1,Qt)),lower:Jt===null?null:Dt-Jt,upper:Jt===null?null:Dt+Jt}}),Ht=new Array(re),Xt=new Array(re);for(let Dt=0;Dt<re;Dt++){const Bt=_e?_e[Dt]:1,zt=Math.max(0,Math.min(1,Bt*f(Le[Dt],Qe)));Ht[Dt]=zt;const Yt=(1-zt)**2;Xt[Dt]=Yt>0&&mt>0?ft[Dt]**2/(we*mt)*(zt/Yt):null}const mn=ue[0].map((Dt,Bt)=>{if(oe<2)return 1;const zt=se(ue,Bt);return zt>=1?1/0:1/(1-zt)});let dn=null;{const Dt=ft.map(zt=>zt*zt),Bt=ee(Le,Dt,null);if(Bt){const zt=Dt.reduce((en,gn)=>en+gn,0)/re;let Yt=0,Qt=0;for(let en=0;en<re;en++)Yt+=Bt.residuals[en]**2,Qt+=(Dt[en]-zt)**2;const Jt=Qt===0?0:Math.max(0,Math.min(1,1-Yt/Qt)),qt=re*Jt,rn=X(qt,oe);dn={statistic:qt,df:oe,p:rn,heteroscedastic:rn<.05}}}let an=null;if(oe===1){const Dt=ue.map((Bt,zt)=>zt).sort((Bt,zt)=>ue[Bt][0]-ue[zt][0]);an={confidence:vt,points:Dt.map(Bt=>{const zt=Le[Bt],Yt=Math.sqrt(Math.max(0,mt*f(zt,Qe)));return{x:ue[Bt][0],yhat:et[Bt],lower:et[Bt]-bt*Yt,upper:et[Bt]+bt*Yt}})}}return{method:Ne,coefficients:Lt,r2:gt,adjR2:St,n:re,df:Ye,sigma2:mt,fitted:et,residuals:ft,leverage:Ht,cooksD:Xt,vif:mn,heteroscedasticity:dn,band:an,weights:_e?[..._e]:null}}function fe(ue){const Ee=ue.length,be=Array.from({length:Ee},(oe,we)=>we).sort((oe,we)=>ue[oe]-ue[we]),Ne=new Float64Array(Ee);let re=0;for(;re<Ee;){let oe=re;for(;oe+1<Ee&&ue[be[oe+1]]===ue[be[re]];)oe++;const we=(re+oe)/2+1;for(let ke=re;ke<=oe;ke++)Ne[be[ke]]=we;re=oe+1}return Ne}const xe=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function He(ue){const Ee=[.01,.05,.1],be=[xe["1%"],xe["5%"],xe["10%"]];if(ue<=be[0]){const oe=(Math.log(Ee[1])-Math.log(Ee[0]))/(be[1]-be[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(Ee[0])+oe*(ue-be[0]))))}if(ue>=be[2]){const oe=(Math.log(Ee[2])-Math.log(Ee[1]))/(be[2]-be[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(Ee[2])+oe*(ue-be[2]))))}const Ne=ue<be[1]?0:1,re=(ue-be[Ne])/(be[Ne+1]-be[Ne]);return Math.exp(Math.log(Ee[Ne])+re*(Math.log(Ee[Ne+1])-Math.log(Ee[Ne])))}function Be(ue,Ee,be,Ne){const re=be-Ne,oe=Ne+3,we=new Array(re),ke=new Array(re);let Le=!0,De=Ne;for(let et=0;et<re;et++){const ft=Ne+et,dt=new Float64Array(oe);dt[0]=1,dt[1]=et+1,dt[2]=ue[ft];for(let ut=1;ut<=Ne;ut++)dt[2+ut]=Ee[ft-ut];for(let ut=1;ut<oe;ut++)Number.isFinite(dt[ut])||(De=Math.min(De,ut-3));we[et]=dt,ke[et]=Ee[ft],Number.isFinite(ke[et])||(Le=!1)}if(!Le)return 0;const{xtwx:Pe,xtwy:_e}=c(we,ke,null);let qe=0,Qe=1/0;for(let et=0;et<=De;et++){const ft=et+3;if(!(re>ft))continue;const dt=new Array(ft);for(let gt=0;gt<ft;gt++)dt[gt]=Pe[gt].slice(0,ft);const ut=j(dt);if(!ut)continue;const Ct=w(ut,_e.slice(0,ft));let Mt=0;for(let gt=0;gt<re;gt++){const St=we[gt];let Rt=0;for(let vt=0;vt<ft;vt++)Rt+=St[vt]*Ct[vt];Mt+=(ke[gt]-Rt)**2}const Ye=Mt/(re-ft)*(re-ft);if(!(Ye>0))continue;const mt=re*Math.log(Ye/re)+2*ft;mt<Qe&&(Qe=mt,qe=et)}return qe}function ae(ue,Ee={}){const be=[];for(let Qe=0;Qe<ue.length;Qe++){const et=Number(ue[Qe]);Number.isFinite(et)&&be.push(et)}const Ne=be.length,re=Ne-1;if(Ne<8||re<6)return null;const oe=new Array(re);for(let Qe=0;Qe<re;Qe++)oe[Qe]=be[Qe+1]-be[Qe];let we=Number.isFinite(Ee.maxlag)?Math.floor(Ee.maxlag):Math.ceil(12*(Ne/100)**.25);we=Math.max(0,Math.min(we,Math.floor((re-5)/2)));const ke=(Qe,et)=>{const ft=[],dt=[];for(let ut=et;ut<re;ut++){const Ct=[ut-et+1,be[ut]];for(let Mt=1;Mt<=Qe;Mt++)Ct.push(oe[ut-Mt]);ft.push(Ct),dt.push(oe[ut])}return ve(ft,dt,{method:"ols"})},Le=Be(be,oe,re,we),De=ke(Le,Le);if(!De||!De.coefficients[2])return null;const Pe=De.coefficients[2].t,_e=He(Pe),qe=Pe<xe["5%"];return{statistic:Pe,usedLag:Le,nobs:re-Le,criticalValues:{...xe},pValue:_e,pApproximate:!0,stationary:qe,verdict:qe?"stationary":"non-stationary",regression:"ct"}}function Ae(ue,Ee={}){const be=[];for(let qe=0;qe<ue.length;qe++){const Qe=Number(ue[qe]);Number.isFinite(Qe)&&be.push(Qe)}const Ne=be.length;if(Ne<3)return null;let re=Number.isFinite(Ee.maxlag)?Math.floor(Ee.maxlag):Math.min(10,Ne-1);re=Math.max(1,Math.min(re,Ne-1));let oe=0;for(const qe of be)oe+=qe;oe/=Ne;const we=be.map(qe=>qe-oe);let ke=0;for(const qe of we)ke+=qe*qe;ke/=Ne;const Le=new Array(re+1).fill(0);Le[0]=1;for(let qe=1;qe<=re;qe++){let Qe=0;for(let et=qe;et<Ne;et++)Qe+=we[et]*we[et-qe];Le[qe]=ke>0?Qe/Ne/ke:0}const De=new Array(re+1).fill(0);De[0]=1;let Pe=[];for(let qe=1;qe<=re;qe++){let Qe=Le[qe];for(let ut=1;ut<qe;ut++)Qe-=Pe[ut-1]*Le[qe-ut];let et=1;for(let ut=1;ut<qe;ut++)et-=Pe[ut-1]*Le[ut];const ft=et!==0?Qe/et:0,dt=new Array(qe);for(let ut=1;ut<qe;ut++)dt[ut-1]=Pe[ut-1]-ft*Pe[qe-1-ut];dt[qe-1]=ft,De[qe]=ft,Pe=dt}const _e=1.96/Math.sqrt(Ne);return{acf:Le,pacf:De,bounds:{upper:_e,lower:-_e},n:Ne,nlags:re,approximate:!0}}function Me(ue,Ee,be){const{xs:Ne,ys:re,n:oe}=A(ue,Ee,be);if(oe<2)return null;const we=fe(Ne),ke=fe(re);let Le=0,De=0;for(let Qe=0;Qe<oe;Qe++)Le+=we[Qe],De+=ke[Qe];Le/=oe,De/=oe;let Pe=0,_e=0,qe=0;for(let Qe=0;Qe<oe;Qe++){const et=we[Qe]-Le,ft=ke[Qe]-De;Pe+=et*ft,_e+=et*et,qe+=ft*ft}return _e===0||qe===0?null:Math.max(-1,Math.min(1,Pe/Math.sqrt(_e*qe)))}function Re(ue,Ee,be){const{xs:Ne,ys:re,n:oe}=A(ue,Ee,be);if(oe<2||oe>t)return null;let we=0,ke=0,Le=0,De=0;for(let qe=0;qe<oe;qe++)for(let Qe=qe+1;Qe<oe;Qe++){const et=Math.sign(Ne[qe]-Ne[Qe]),ft=Math.sign(re[qe]-re[Qe]),dt=et*ft;dt>0?we++:dt<0?ke++:et===0&&ft===0||(et===0?Le++:De++)}const Pe=we+ke+De,_e=we+ke+Le;return Pe===0||_e===0?null:(we-ke)/Math.sqrt(Pe*_e)}function pe(ue,Ee={}){const be=ue.length;if(be<2)return null;const Ne=ue[0],re=ue[be-1],oe=[];for(let ut=1;ut<be;ut++){const Ct=ue[ut-1];Ct!==0&&oe.push((ue[ut]-Ct)/Math.abs(Ct))}let we=null;if(oe.length>1){let ut=0;for(const Mt of oe)ut+=Mt;ut/=oe.length;let Ct=0;for(const Mt of oe)Ct+=(Mt-ut)**2;we=Math.sqrt(Ct/(oe.length-1))}const ke=Number(Ee.periodsPerYear)>0?Number(Ee.periodsPerYear):null;let Le=ue[0],De=0,Pe=0,_e=0,qe=0;for(let ut=1;ut<be;ut++){if(ue[ut]>Le){Le=ue[ut],De=ut;continue}if(Le<=0)continue;const Ct=(Le-ue[ut])/Le;Ct>Pe&&(Pe=Ct,_e=De,qe=ut)}let Qe=null;if(be>2){let ut=0;for(let xt=0;xt<be;xt++)ut+=ue[xt];ut/=be;let Ct=0,Mt=0;for(let xt=0;xt<be;xt++){const Ye=ue[xt]-ut;Mt+=Ye*Ye,xt>0&&(Ct+=Ye*(ue[xt-1]-ut))}Qe=Mt>0?Ct/Mt:null}let et=0,ft=0;for(const ut of oe)ut>0?et++:ut<0&&ft++;let dt=null;if(Ne>0&&re>0){const ut=(re/Ne)**(1/(be-1))-1;dt=ke?(1+ut)**ke-1:ut}return{n:be,first:Ne,last:re,change:re-Ne,changePercent:Ne===0?null:(re-Ne)/Math.abs(Ne)*100,volatility:we,annualisedVolatility:we!==null&&ke?we*Math.sqrt(ke):null,growth:dt,maxDrawdown:Pe,maxDrawdownFrom:_e,maxDrawdownTo:qe,autocorrelation:Qe,upDays:et,downDays:ft}}const $e=1.128,ce=3.267;function ge(ue){const Ee=ue.length;if(Ee<2)return null;const be=[];for(let re=1;re<Ee;re++)be.push(Math.abs(ue[re]-ue[re-1]));const Ne=be.reduce((re,oe)=>re+oe,0)/be.length;return{ranges:be,centre:Ne,upper:ce*Ne,lower:0}}function je(ue){const Ee=ue.length;if(Ee<2)return null;let be=0;for(let re=1;re<Ee;re++)be+=Math.abs(ue[re]-ue[re-1]);const Ne=be/(Ee-1);return{sigma:Ne/$e,meanRange:Ne}}function Ve(ue,Ee){const be=ue.length;if(be<2||!Ee)return null;const Ne=Number.isFinite(Number(Ee.lower))?Number(Ee.lower):null,re=Number.isFinite(Number(Ee.upper))?Number(Ee.upper):null;if(Ne===null&&re===null)return null;let oe=0;for(let et=0;et<be;et++)oe+=ue[et];oe/=be;let we=0;for(let et=0;et<be;et++)we+=(ue[et]-oe)**2;const ke=Math.sqrt(we/(be-1)),Le=je(ue),De=Le?Le.sigma:null,Pe=et=>{if(!et||et<=0)return{index:null,k:null};const dt=Ne!==null&&re!==null?(re-Ne)/(6*et):null,ut=re!==null?(re-oe)/(3*et):1/0,Ct=Ne!==null?(oe-Ne)/(3*et):1/0;return{index:dt,k:Math.min(ut,Ct)}},_e=Pe(De),qe=Pe(ke);let Qe=0;for(let et=0;et<be;et++){if(Ne!==null&&ue[et]<Ne){Qe++;continue}re!==null&&ue[et]>re&&Qe++}return{n:be,mean:oe,lower:Ne,upper:re,target:Number.isFinite(Number(Ee.target))?Number(Ee.target):null,sigmaWithin:De,sigmaOverall:ke,cp:_e.index,cpk:_e.k,pp:qe.index,ppk:qe.k,outOfSpec:Qe,defectRate:be?Qe/be:null}}function Se(ue){const Ee=ue.length;if(Ee<2)return null;const be=je(ue);if(!be||!(be.sigma>0))return null;let Ne=0;for(let re=0;re<Ee;re++)Ne+=ue[re];return Ne/=Ee,{centre:Ne,sigma:be.sigma,upper:Ne+3*be.sigma,lower:Ne-3*be.sigma}}function Ge(ue,Ee){if(!Ee||!(Ee.sigma>0))return[];const be=ue.length,{centre:Ne,sigma:re}=Ee,oe=ke=>(ue[ke]-Ne)/re,we=[];for(let ke=0;ke<be;ke++){if(Math.abs(oe(ke))>3&&we.push({index:ke,rule:1,description:"beyond three sigma"}),ke>=2)for(const Le of[1,-1]){let De=0;for(let Pe=ke-2;Pe<=ke;Pe++)oe(Pe)*Le>2&&De++;if(De>=2){we.push({index:ke,rule:2,description:"two of three past two sigma"});break}}if(ke>=4)for(const Le of[1,-1]){let De=0;for(let Pe=ke-4;Pe<=ke;Pe++)oe(Pe)*Le>1&&De++;if(De>=4){we.push({index:ke,rule:3,description:"four of five past one sigma"});break}}if(ke>=7)for(const Le of[1,-1]){let De=!0;for(let Pe=ke-7;Pe<=ke;Pe++)if(oe(Pe)*Le<=0){De=!1;break}if(De){we.push({index:ke,rule:4,description:"eight in a row on one side"});break}}}return we}function Ce(ue,Ee){if(!Ee||!(Ee.sigma>0))return[];const be=ue.length,{centre:Ne,sigma:re}=Ee,oe=Le=>(ue[Le]-Ne)/re,we=(Le,De,Pe,_e)=>{for(const qe of[1,-1]){let Qe=0;for(let et=Le;et<=De;et++)oe(et)*qe>Pe&&Qe++;if(Qe>=_e)return!0}return!1},ke=[];for(let Le=0;Le<be;Le++){if(Math.abs(oe(Le))>3&&ke.push({index:Le,rule:1,description:"beyond three sigma"}),Le>=8)for(const De of[1,-1]){let Pe=!0;for(let _e=Le-8;_e<=Le;_e++)if(oe(_e)*De<=0){Pe=!1;break}if(Pe){ke.push({index:Le,rule:2,description:"nine in a row on one side"});break}}if(Le>=5)for(const De of[1,-1]){let Pe=!0;for(let _e=Le-4;_e<=Le;_e++)if((ue[_e]-ue[_e-1])*De<=0){Pe=!1;break}if(Pe){ke.push({index:Le,rule:3,description:De>0?"six rising":"six falling"});break}}if(Le>=13){let De=!0;for(let Pe=Le-12;Pe<=Le;Pe++){const _e=ue[Pe]-ue[Pe-1],qe=ue[Pe+1<=Le?Pe+1:Pe]-ue[Pe];if(Pe+1>Le)break;if(_e===0||qe===0||_e>0==qe>0){De=!1;break}}De&&ke.push({index:Le,rule:4,description:"fourteen alternating"})}if(Le>=2&&we(Le-2,Le,2,2)&&ke.push({index:Le,rule:5,description:"two of three past two sigma"}),Le>=4&&we(Le-4,Le,1,4)&&ke.push({index:Le,rule:6,description:"four of five past one sigma"}),Le>=14){let De=!0;for(let Pe=Le-14;Pe<=Le;Pe++)if(Math.abs(oe(Pe))>=1){De=!1;break}De&&ke.push({index:Le,rule:7,description:"fifteen within one sigma"})}if(Le>=7){let De=!0;for(let Pe=Le-7;Pe<=Le;Pe++)if(Math.abs(oe(Pe))<=1){De=!1;break}De&&ke.push({index:Le,rule:8,description:"eight beyond one sigma"})}}return ke}const Te=Object.freeze(["westernElectric","nelson"]);function ze(ue,Ee,be="westernElectric"){return String(be)==="nelson"?Ce(ue,Ee):Ge(ue,Ee)}function Ke(ue,Ee,be){let Ne=0;for(let re=0;re<ue.length;re++)(ue[re]<Ee||ue[re]>be)&&Ne++;return Ne}function Ze(ue,Ee,be,Ne=20){const re=ue.length;if(!re)return[];const oe=ue[0],we=ue[re-1];if(we===oe)return[{from:oe,to:we,count:re}];const ke=be-Ee,Le=1.5*ke;let De=ke>0?Math.max(oe,Ee-Le):oe,Pe=ke>0?Math.min(we,be+Le):we;Pe>De||(De=oe,Pe=we);const _e=ke>0?2*ke/Math.cbrt(re):(Pe-De)/(Math.ceil(Math.log2(re))+1),qe=_e>0?Math.min(Ne,Math.max(1,Math.ceil((Pe-De)/_e))):1,Qe=(Pe-De)/qe,et=[];for(let ft=0;ft<qe;ft++)et.push({from:De+ft*Qe,to:De+(ft+1)*Qe,count:0});for(let ft=0;ft<re;ft++){const dt=Math.min(qe-1,Math.max(0,Math.floor((ue[ft]-De)/Qe)));et[dt].count++}return et[0].from=oe,et[qe-1].to=we,et}const nt=.95;function it(ue){const Ee=Number(ue);return Number.isFinite(Ee)&&Ee>0&&Ee<1?Ee:nt}function wt(ue,Ee=nt){const be=ue.length;if(be<2)return null;let Ne=0;for(let Pe=0;Pe<be;Pe++)Ne+=ue[Pe];const re=Ne/be;let oe=0;for(let Pe=0;Pe<be;Pe++){const _e=ue[Pe]-re;oe+=_e*_e}const we=Math.sqrt(oe/(be-1)),ke=it(Ee),De=B(1-(1-ke)/2,be-1)*we/Math.sqrt(be);return{mean:re,lower:re-De,upper:re+De,margin:De,n:be,confidence:ke}}function ht(ue,Ee,be=nt){const Ne=Number(ue),re=Number(Ee);if(!(re>0)||!(Ne>=0)||Ne>re)return null;const oe=it(be),we=K(1-(1-oe)/2),ke=Ne/re,Le=we*we,De=1+Le/re,Pe=(ke+Le/(2*re))/De,_e=we/De*Math.sqrt(ke*(1-ke)/re+Le/(4*re*re));return{proportion:ke,lower:Math.max(0,Pe-_e),upper:Math.min(1,Pe+_e),n:re,confidence:oe}}function Ot(ue,Ee=nt){if(!ue||!(ue.n>2)||!Number.isFinite(ue.stdError))return null;const be=it(Ee),re=B(1-(1-be)/2,ue.n-2)*ue.stdError;return{slope:ue.slope,lower:ue.slope-re,upper:ue.slope+re,margin:re,confidence:be}}function Pt(ue,Ee,be=nt){const Ne=Number(ue),re=Number(Ee);if(!Number.isFinite(Ne)||!(re>1))return null;const oe=it(be),ke=K(1-(1-oe)/2)*Math.sqrt(1/(9*re)+Ne*Ne/(2*(re-1)));return{index:Ne,lower:Ne-ke,upper:Ne+ke,margin:ke,n:re,confidence:oe}}function Nt(ue,Ee){return!ue||!(ue.sd>0)||!Number.isFinite(Ee)||!Number.isFinite(ue.mean)?null:(Ee-ue.mean)/ue.sd}function ct(ue){return Number.isFinite(ue)?Math.min(1,Math.max(0,2*F(Math.abs(ue)/2)-1)):0}function lt(ue,Ee){const be=new Map,Ne=q(ue);let re=0;for(let oe=0;oe<Ee.length;oe++){const we=Ne(Ee[oe]);if(we==null||we===""||typeof we=="number"&&Number.isNaN(we))continue;const ke=we instanceof Date?we.getTime():typeof we=="object"?String(we):we;be.set(ke,(be.get(ke)||0)+1),re++}return{map:be,total:re}}function yt(ue,Ee,be,Ne){if(!(Ee>0)||!(Ne>0))return null;let re=0;const oe=new Set(ue.keys());for(const we of be.keys())oe.add(we);for(const we of oe){const ke=(ue.get(we)||0)/Ee,Le=(be.get(we)||0)/Ne;re+=Math.abs(ke-Le)}return re/2}const Tt=10;function at(ue,Ee,be){if(be&&be.numeric){const ke=u(ue,Ee),{n:Le,mean:De}=p(ke),Pe=Le>0?Nt({mean:be.mean,sd:be.sd},De):null;return{measure:"standardizedMeanDifference",magnitude:Pe,distance:Pe===null?0:ct(Pe),direction:Pe===null?0:Math.sign(Pe),subsetN:Le,populationN:be.n||0,reliable:Le>=Tt}}const{map:re,total:oe}=lt(ue,Ee),we=yt(re,oe,be.map,be.total);return{measure:"categoricalTotalVariation",magnitude:we,distance:we===null?0:we,direction:0,subsetN:oe,populationN:be.total||0,reliable:oe>=Tt}}function ye(ue,Ee){if(ue&&(ue.kind==="float64"||ue.kind==="int32"))return!0;const be=q(ue);let Ne=0,re=0;for(let oe=0;oe<Ee.length&&Ne<200;oe++){const we=be(Ee[oe]);if(we==null||we==="")continue;if(we instanceof Date)return!1;Ne++;const ke=typeof we=="number"?we:Number(we);Number.isFinite(ke)&&re++}return Ne===0?!1:re/Ne>=.9}function Oe(ue,Ee){if(ye(ue,Ee)){const re=u(ue,Ee),{n:oe,mean:we,m2:ke}=p(re);return{numeric:!0,mean:we,sd:oe>0?Math.sqrt(ke/oe):0,n:oe}}const{map:be,total:Ne}=lt(ue,Ee);return{numeric:!1,map:be,total:Ne}}}),Ue("packages/core/src/compute/total.js",function(e,U){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"aggregatesFor",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"aggregateAllowed",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return p}});const C=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce,B=U("packages/core/src/compute/handle.js"),Z=B.presenceReader,K=B.valueComparator,F=B.valueReader,X=U("packages/core/src/compute/statistics.js"),H=X.STAT_FNS,j=X.STAT_LABELS;function w(b){return!!b&&(b.kind==="float64"||b.kind==="int32")}function m(b,O){const y=O.length;let M=0;if(w(b)){const _=b.values,I=Z(b);if(!I){for(let L=0;L<y;L++){const $=_[O[L]];Number.isNaN($)||(M+=$)}return M}for(let L=0;L<y;L++){const $=O[L];if(I($)===1){const P=_[$];Number.isNaN(P)||(M+=P)}}return M}const D=F(b);for(let _=0;_<y;_++){const I=u(D(O[_]));I!==null&&(M+=I)}return M}m.kernel=!0;function c(b,O){const y=O.length;let M=0;if(w(b)){const _=b.values,I=Z(b);if(!I){for(let L=0;L<y;L++)Number.isNaN(_[O[L]])||M++;return M}for(let L=0;L<y;L++){const $=O[L];I($)===1&&!Number.isNaN(_[$])&&M++}return M}const D=F(b);for(let _=0;_<y;_++){const I=D(O[_]);I!=null&&!(typeof I=="number"&&Number.isNaN(I))&&M++}return M}c.kernel=!0;function f(b,O){return O.length}f.kernel=!0;function l(b,O){const y=c(b,O);return y===0?null:m(b,O)/y}l.kernel=!0;function r(b,O,y,M){const D=O.length;if(w(b)){const $=b.values,P=Z(b);let N=null;if(!P){for(let T=0;T<D;T++){const E=$[O[T]];Number.isNaN(E)||(N===null||(y<0?E<N:E>N))&&(N=E)}return N}for(let T=0;T<D;T++){const E=O[T];if(P(E)===0)continue;const A=$[E];Number.isNaN(A)||(N===null||(y<0?A<N:A>N))&&(N=A)}return N}const _=F(b),I=K(M);let L=null;for(let $=0;$<D;$++){const P=_(O[$]);P==null||typeof P=="number"&&Number.isNaN(P)||(L===null||(y<0?I(P,L)<0:I(P,L)>0))&&(L=P)}return L}function t(b,O,y){return r(b,O,-1,y&&y.locale)}t.kernel=!0;function i(b,O,y){return r(b,O,1,y&&y.locale)}i.kernel=!0;function s(b,O){return O.length===0?null:F(b)(O[0])}s.kernel=!0;function n(b,O){return O.length===0?null:F(b)(O[O.length-1])}n.kernel=!0;function u(b){if(typeof b=="number")return Number.isNaN(b)?null:b;if(b==null||b===""||typeof b=="boolean")return null;if(b instanceof Date)return b.getTime();const O=Number(b);return Number.isNaN(O)?null:O}const o={sum:m,min:t,max:i,avg:l,count:f,first:s,last:n,countValues:c,...H},a=Object.freeze({...j,sum:"Sum",avg:"Average",min:"Min",max:"Max",count:"Count",countValues:"Count of values",first:"First",last:"Last"});function h(b){return b?typeof b=="string"?a[b]||b:"Total":""}const v=Object.freeze(["sum","avg","min","max","count","countValues","first","last"]);function g(b){const O=b&&b.dataType&&b.dataType.totals&&b.dataType.totals.supported;if(Array.isArray(O))return O.slice();const y=v.filter(M=>M in o);for(const M of Object.keys(o))y.includes(M)||y.push(M);return y}function k(b,O){return typeof O!="string"?!0:g(b).includes(O)}function d(b,O){const y=F(b),M=[];for(let D=0;D<O.length;D++){const _=y(O[D]);_!=null&&M.push(_)}return M}function p(b,O,y,M){const D=O||[];if(typeof y=="string"){const _=o[y];return _?_(b,D,M):(z(`total:${y}`,`unknown total function "${y}"; register it in config.totalFns`),null)}return C(y)?y.kernel===!0?y(b,D,M):y(d(b,D),M||{}):null}}),Ue("packages/core/src/compute/windowed.js",function(e,U){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const C=U("packages/core/src/compute/sketch.js").Welford;class q{#e;#t;#n=[];#r;#s;constructor(F,X=0,H=Date.now){if(F!=="count"&&F!=="time"&&F!=="session")throw new RangeError(`unknown window kind: ${F}`);if((F==="count"||F==="time")&&!(X>0))throw new RangeError(`a ${F} window needs a positive span`);this.#e=F,this.#t=Math.floor(X),this.#r=H,this.#s=H()}get size(){return this.#n.length}push(F,X=this.#r()){Number.isFinite(F)&&(this.#n.push({t:X,v:F}),this.#i(X))}#i(F){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const X=F-this.#t;for(;this.#n.length&&this.#n[0].t<X;)this.#n.shift()}}spec(){const F=this.#e==="session"?this.#r()-this.#s:this.#t;return{kind:this.#e,span:F,size:this.#n.length}}values(){return this.#n.map(F=>F.v)}aggregate(){const F=this.spec();if(!this.#n.length)return{over:F,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const X=new C;let H=0,j=1/0,w=-1/0;for(const{v:m}of this.#n)H+=m,m<j&&(j=m),m>w&&(w=m),X.add(m);return{over:F,count:this.#n.length,sum:H,mean:X.mean(),min:j,max:w,variance:X.variance(),stddev:X.stddev()}}reduce(F){const X=this.aggregate(),H={sum:X.sum,avg:X.mean,mean:X.mean,min:X.min,max:X.max,count:X.count,variance:X.variance,stddev:X.stddev};if(!(F in H))throw new RangeError(`unknown windowed aggregate: ${F}`);return{value:H[F],over:X.over}}}const z=Object.freeze(["count","time","session"]);function B(K,F=Date.now){const X=K.kind==="time"&&K.minutes!=null?K.minutes*6e4:K.span??0;return new q(K.kind,X,F)}const Z={Window:q,WINDOW_KINDS:z,openWindow:B}}),Ue("packages/core/src/compute/rolling.js",function(e,U){"use strict";Object.defineProperty(e,"ROLLING_WINDOW_FIELDS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"rollingWindow",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"rollingQuantile",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"seasonalDecompose",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"exponentialSmoothing",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});const C=U("packages/core/src/compute/windowed.js").openWindow,z=U("packages/core/src/compute/sketch.js").KLL,B=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function Z(o,a,h,v){if(o.kind==="count"){const g=Math.max(1,Math.floor(o.span||0));return{coverage:Math.min(1,a/g),partial:a<g}}if(o.kind==="time"){const g=o.minutes!=null?o.minutes*6e4:o.span||0;if(!(g>0))return{coverage:1,partial:!1};const k=h-v;return{coverage:Math.min(1,k/g),partial:k<g}}return{coverage:null,partial:!1}}function K(o,a){const h=C(a),v=new Map,g=o.length?o[0].at:0;for(let k=0;k<o.length;k++){const{key:d,at:p,value:b}=o[k];Number.isFinite(b)&&h.push(b,p);const O=h.aggregate(),y=Z(a,O.count,p,g);d!=null&&v.set(String(d),{sum:O.sum,avg:O.mean,min:O.min,max:O.max,count:O.count,coverage:y.coverage,partial:y.partial})}return v}function F(o){const a=new Map;let h=0;for(const{key:v,value:g}of o)Number.isFinite(g)&&(h+=g),v!=null&&a.set(String(v),h);return a}function X(o,a=1){const h=new Map,v=Math.max(1,Math.floor(a));for(let g=0;g<o.length;g++){const{key:k,value:d}=o[g];if(k==null)continue;const p=g>=v?o[g-v].value:null,b=Number.isFinite(d)?d:null,O=Number.isFinite(p)?p:null;h.set(String(k),b!==null&&O!==null?b-O:null)}return h}const H=4096;function j(o){let a=o>>>0;return()=>{a+=1831565813;let h=a;return h=Math.imul(h^h>>>15,h|1),h^=h+Math.imul(h^h>>>7,h|61),((h^h>>>14)>>>0)/4294967296}}function w(o,a){const h=o.length;if(h===1)return o[0];const v=(h-1)*a,g=Math.floor(v),k=Math.ceil(v);return g===k?o[g]:o[g]+(v-g)*(o[k]-o[g])}function m(o,a,h={}){const v=Math.min(1,Math.max(0,h.q==null?.5:h.q)),g=Math.max(1,Math.floor(h.cap==null?H:h.cap)),k=j(h.seed==null?2654435769:h.seed),d=new Map,p=o.length?o[0].at:0;if(a.kind==="session"){const O=new z(200,k);let y=0;for(const{key:M,value:D}of o)Number.isFinite(D)&&(O.add(D),y++),M!=null&&d.set(String(M),{value:y?O.quantile(v):null,approx:y>0,count:y,coverage:null,partial:!1});return d}const b=C(a);for(const{key:O,at:y,value:M}of o){Number.isFinite(M)&&b.push(M,y);const D=b.values(),_=D.length;let I=null,L=!1;if(_)if(_<=g)I=w([...D].sort((P,N)=>P-N),v);else{const P=new z(200,k);for(const N of D)P.add(N);I=P.quantile(v),L=!0}const $=Z(a,_,y,p);O!=null&&d.set(String(O),{value:I,approx:L,count:_,coverage:$.coverage,partial:$.partial})}return d}function c(o,a){const h=o.length,v=new Array(h).fill(null),g=Math.floor(a/2),k=a%2===0;for(let d=0;d<h;d++){if(d-g<0||d+g>=h)continue;let p=0,b=!0;if(k)for(let O=-g;O<=g;O++){const y=o[d+O];if(!Number.isFinite(y)){b=!1;break}p+=O===-g||O===g?y*.5:y}else for(let O=-g;O<=g;O++){const y=o[d+O];if(!Number.isFinite(y)){b=!1;break}p+=y}b&&(v[d]=p/a)}return v}function f(o,a){const h=new Map,v=Math.floor(Number(a&&a.period));if(!(v>=2))return h;const g=a&&a.model==="multiplicative",k=o.length,d=o.map(L=>Number.isFinite(L.value)?L.value:null),p=c(d,v),b=new Array(k).fill(null);for(let L=0;L<k;L++){const $=p[L],P=d[L];$===null||P===null||(g?$!==0&&(b[L]=P/$):b[L]=P-$)}const O=new Array(v).fill(0),y=new Array(v).fill(0);for(let L=0;L<k;L++){if(b[L]===null)continue;const $=L%v;O[$]+=b[L],y[$]+=1}const M=g?1:0,D=O.map((L,$)=>y[$]?L/y[$]:M),_=D.reduce((L,$)=>L+$,0)/v,I=g?D.map(L=>_!==0?L/_:1):D.map(L=>L-_);for(let L=0;L<k;L++){const{key:$}=o[L];if($==null)continue;const P=p[L],N=I[L%v],T=d[L];let E=null;P!==null&&T!==null&&(E=g?P*N!==0?T/(P*N):null:T-P-N),h.set(String($),{trend:P,seasonal:T===null?null:N,residual:E,coverage:P===null?0:1,partial:P===null})}return h}function l(o,a,h,v=80){const g=(Math.sqrt(5)-1)/2;let k=a,d=h,p=d-g*(d-k),b=k+g*(d-k),O=o(p),y=o(b);for(let M=0;M<v;M++)O<y?(d=b,b=p,y=O,p=d-g*(d-k),O=o(p)):(k=p,p=b,O=y,b=k+g*(d-k),y=o(b));return(k+d)/2}const r=1e-4,t=1-1e-4;function i(o,a){const h=o.length,v=new Array(h).fill(null),g=new Array(h).fill(null);let k=null,d=0;for(let p=0;p<h;p++){const b=o[p];if(!Number.isFinite(b)){k!==null&&(g[p]=k,v[p]=k);continue}if(k===null){k=b,g[p]=b,v[p]=b;continue}g[p]=k,d+=(b-k)**2,k=a*b+(1-a)*k,v[p]=k}return{smoothed:v,fitted:g,sse:d}}function s(o,a,h){const v=o.length,g=new Array(v).fill(null),k=new Array(v).fill(null);let d=null,p=null,b=0;for(let O=0;O<v;O++){const y=o[O];if(!Number.isFinite(y)){d!==null&&(d+=p,g[O]=d);continue}if(d===null){d=y,g[O]=y;continue}if(p===null){p=y-d;const _=d+p;k[O]=_,b+=(y-_)**2;const I=d;d=a*y+(1-a)*(I+p),p=h*(d-I)+(1-h)*p,g[O]=d;continue}const M=d+p;k[O]=M,b+=(y-M)**2;const D=d;d=a*y+(1-a)*(D+p),p=h*(d-D)+(1-h)*p,g[O]=d}return{smoothed:g,fitted:k,sse:b}}function n(o,a={}){const h=new Map,v=a.method==="holt",g=o.map(M=>Number.isFinite(M.value)?M.value:null),k=g.filter(M=>M!==null).length,d=M=>Math.min(t,Math.max(r,M)),p=()=>{for(const{key:M}of o)M!=null&&h.set(String(M),{smoothed:null,fitted:null,alpha:null,beta:null,sse:null});return h};if(k<(v?2:1))return p();let b=Number.isFinite(a.alpha)?d(a.alpha):null,O=v&&Number.isFinite(a.beta)?d(a.beta):null;if(v){if(b===null||O===null){let M=b===null?.5:b,D=O===null?.5:O;for(let _=0;_<6;_++)b===null&&(M=l(I=>s(g,I,D).sse,r,t)),O===null&&(D=l(I=>s(g,M,I).sse,r,t));b=b===null?M:b,O=O===null?D:O}}else b===null&&(b=l(M=>i(g,M).sse,r,t));const y=v?s(g,b,O):i(g,b);for(let M=0;M<o.length;M++){const{key:D}=o[M];D!=null&&h.set(String(D),{smoothed:y.smoothed[M],fitted:y.fitted[M],alpha:b,beta:v?O:null,sse:y.sse})}return h}const u={ROLLING_WINDOW_FIELDS:B,QUANTILE_SPAN_CAP:H,rollingWindow:K,rollingQuantile:m,cumulativeToDate:F,periodOverPeriod:X,seasonalDecompose:f,exponentialSmoothing:n}}),Ue("packages/core/src/compute/compare.js",function(e,U){"use strict";Object.defineProperty(e,"COMPARE_MEASURES",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"pooledStandardMeanDifference",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"numericSummary",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"bothNumeric",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"compareColumnAcross",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"compareDatasets",{enumerable:!0,get:function(){return c}});const te=U("packages/core/src/compute/statistics.js"),C=te.numbers,q=te.moments,z=te.frequencyMap,B=te.categoricalDistance,Z=te.normalTotalVariation,K=te.isNumericColumn,F=te.SUBSET_RELIABILITY_FLOOR,X=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function H(f,l){if(!f||!l||!(f.n>0)||!(l.n>0)||!Number.isFinite(f.mean)||!Number.isFinite(l.mean))return null;const r=(f.n*f.sd*f.sd+l.n*l.sd*l.sd)/(f.n+l.n);return r>0?(f.mean-l.mean)/Math.sqrt(r):null}function j(f,l){const r=C(f,l),{n:t,mean:i,m2:s}=q(r),n=t>0?Math.sqrt(s/t):0;return{mean:i,sd:n,n:t}}function w(f,l,r,t){return K(f,l)&&K(r,t)}function m(f,l,r,t){if(w(f,l,r,t)){const u=j(f,l),o=j(r,t),a=H(u,o);return{measure:X.numeric,magnitude:a,distance:a===null?0:Z(a),direction:a===null?0:Math.sign(a),nA:u.n,nB:o.n,reliable:u.n>=F&&o.n>=F}}const i=z(f,l),s=z(r,t),n=B(i.map,i.total,s.map,s.total);return{measure:X.categorical,magnitude:n,distance:n===null?0:n,direction:0,nA:i.total,nB:s.total,reliable:i.total>=F&&s.total>=F}}function c(f,l,r={}){const t=new Set(f.columns),i=new Set(l.columns),s=f.columns.filter(h=>i.has(h)),n=Array.isArray(r.columns)&&r.columns.length?s.filter(h=>r.columns.includes(h)):s,u=f.indices(),o=l.indices(),a=[];for(const h of n){const v=f.handle(h),g=l.handle(h);if(!v||!g)continue;const k=m(v,u,g,o);a.push({column:h,name:f.name&&f.name(h)||l.name&&l.name(h)||h,measure:k.measure,magnitude:k.magnitude,distance:k.distance,direction:k.direction,nA:k.nA,nB:k.nB,reliable:k.reliable})}return a.sort((h,v)=>v.distance-h.distance||Math.abs(v.magnitude||0)-Math.abs(h.magnitude||0)),{ranked:a,nA:u.length,nB:o.length,unmatched:{onlyA:f.columns.filter(h=>!i.has(h)),onlyB:l.columns.filter(h=>!t.has(h))},measures:X}}}),Ue("packages/core/src/compute/anomaly.js",function(e,U){"use strict";Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"DEFAULT_MODIFIED_Z_THRESHOLD",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return u}});const C=U("packages/core/src/compute/statistics.js").quantileSorted,z=U("packages/core/src/compute/special.js").logGamma,B=.6745,Z=3.5,K=1.5,F=.975,X=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function H(o){if(!o.length)return null;const h=Array.from(o,Number).sort((d,p)=>d-p),v=C(h,.5),g=h.map(d=>Math.abs(d-v)).sort((d,p)=>d-p),k=C(g,.5);return{median:v,mad:k}}function j(o,a={}){const h=Number.isFinite(a.threshold)?a.threshold:Z,v=o.length,g=new Array(v).fill(null),k=new Array(v).fill(!1),d=[];for(let O=0;O<v;O++){const y=Number(o[O]);Number.isFinite(y)&&d.push(y)}if(!d.length)return{median:null,mad:null,threshold:h,scores:g,flags:k,flagged:0};const p=H(d);if(p.mad===0)return{median:p.median,mad:0,threshold:h,scores:g,flags:k,flagged:0};let b=0;for(let O=0;O<v;O++){const y=Number(o[O]);if(!Number.isFinite(y))continue;const M=B*(y-p.median)/p.mad;g[O]=M,Math.abs(M)>h&&(k[O]=!0,b++)}return{median:p.median,mad:p.mad,threshold:h,scores:g,flags:k,flagged:b}}function w(o,a={}){const h=Number.isFinite(a.k)?a.k:K,v=[];for(let b=0;b<o.length;b++){const O=Number(o[b]);Number.isFinite(O)&&v.push(O)}if(!v.length)return null;const g=v.sort((b,O)=>b-O),k=C(g,.25),d=C(g,.75),p=d-k;return{q1:k,q3:d,iqr:p,lower:k-h*p,upper:d+h*p,k:h}}function m(o,a){if(a<=0)return 0;const h=z(o);if(a<o+1){let O=o,y=1/o,M=y;for(let D=0;D<1e3&&(O+=1,M*=a/O,y+=M,!(Math.abs(M)<Math.abs(y)*1e-15));D++);return y*Math.exp(-a+o*Math.log(a)-h)}const v=1e-300;let g=a+1-o,k=1/v,d=1/g,p=d;for(let O=1;O<1e3;O++){const y=-O*(O-o);g+=2,d=y*d+g,Math.abs(d)<v&&(d=v),k=g+y/k,Math.abs(k)<v&&(k=v),d=1/d;const M=d*k;if(p*=M,Math.abs(M-1)<1e-15)break}return 1-Math.exp(-a+o*Math.log(a)-h)*p}function c(o,a){return o<=0?0:m(a/2,o/2)}function f(o,a=F){if(!(a>0)||!(a<1))return NaN;let h=0,v=Math.max(1,o);for(;c(v,o)<a;)v*=2;for(let g=0;g<200;g++){const k=(h+v)/2;if(c(k,o)<a?h=k:v=k,v-h<1e-10)break}return(h+v)/2}function l(o){const a=o.length,h=o.map((v,g)=>{const k=v.slice();for(let d=0;d<a;d++)k.push(g===d?1:0);return k});for(let v=0;v<a;v++){let g=v;for(let d=v+1;d<a;d++)Math.abs(h[d][v])>Math.abs(h[g][v])&&(g=d);if(Math.abs(h[g][v])<1e-12)return null;if(g!==v){const d=h[g];h[g]=h[v],h[v]=d}const k=h[v][v];for(let d=0;d<2*a;d++)h[v][d]/=k;for(let d=0;d<a;d++){if(d===v)continue;const p=h[d][v];if(p!==0)for(let b=0;b<2*a;b++)h[d][b]-=p*h[v][b]}}return h.map(v=>v.slice(a))}function r(o,a){const h=o.length,v=new Array(a).fill(0);for(const d of o)for(let p=0;p<a;p++)v[p]+=d[p];for(let d=0;d<a;d++)v[d]/=h;const g=Array.from({length:a},()=>new Array(a).fill(0));for(const d of o)for(let p=0;p<a;p++){const b=d[p]-v[p];for(let O=p;O<a;O++)g[p][O]+=b*(d[O]-v[O])}const k=h>1?h-1:1;for(let d=0;d<a;d++)for(let p=d;p<a;p++)g[d][p]/=k,g[p][d]=g[d][p];return{mean:v,cov:g}}function t(o,a={}){const h=Number.isFinite(a.p)?a.p:F,v=Number.isFinite(a.ridge)?a.ridge:1e-6,g=o.length;if(!g)return null;const k=o[0].length;if(!k)return null;const d=new Array(g).fill(null),p=new Array(g).fill(null),b=new Array(g).fill(!1),O=[],y=[];for(let N=0;N<g;N++){const T=o[N];let E=T.length===k;const A=new Array(k);for(let S=0;E&&S<k;S++){const x=Number(T[S]);Number.isFinite(x)?A[S]=x:E=!1}E&&(O.push(N),y.push(A))}const M=k,D=f(M,h);if(y.length<=k)return{center:[],df:M,cutoff:D,singular:!0,used:y.length,distances:d,squared:p,flags:b,flagged:0};const{mean:_,cov:I}=r(y,k);let L=l(I),$=!1;if(!L){$=!0;let N=0;for(let A=0;A<k;A++)N+=I[A][A];const T=N/k*v||v,E=I.map((A,S)=>A.map((x,W)=>S===W?x+T:x));if(L=l(E),!L)return{center:_,df:M,cutoff:D,singular:!0,used:y.length,distances:d,squared:p,flags:b,flagged:0}}let P=0;for(let N=0;N<y.length;N++){const T=y[N],E=new Array(k);for(let x=0;x<k;x++)E[x]=T[x]-_[x];let A=0;for(let x=0;x<k;x++){let W=0;for(let V=0;V<k;V++)W+=L[x][V]*E[V];A+=E[x]*W}A<0&&(A=0);const S=O[N];p[S]=A,d[S]=Math.sqrt(A),A>D&&(b[S]=!0,P++)}return{center:_,df:M,cutoff:D,singular:$,used:y.length,distances:d,squared:p,flags:b,flagged:P}}const i=20,s=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function n(o,a={}){const h=a.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",v=Number.isFinite(a.windowLen)&&a.windowLen>=1?Math.floor(a.windowLen):i,g=Number.isFinite(a.threshold)?a.threshold:Z,k=Number.isFinite(a.k)?a.k:K,d=Number.isFinite(a.minPeriods)&&a.minPeriods>=1?Math.floor(a.minPeriods):v,p=o.length,b=new Array(p).fill(null),O=new Array(p).fill(!1);let y=0;for(let M=0;M<p;M++){const D=Number(o[M]);if(!Number.isFinite(D))continue;const _=Math.max(0,M-v+1),I=[];for(let L=_;L<=M;L++){const $=Number(o[L]);Number.isFinite($)&&I.push($)}if(!(I.length<d))if(h==="rollingIqr"){const L=w(I,{k});if(!L)continue;(D<L.lower||D>L.upper)&&(O[M]=!0,y++)}else{const L=H(I);if(!L||L.mad===0)continue;const $=B*(D-L.median)/L.mad;b[M]=$,Math.abs($)>g&&(O[M]=!0,y++)}}return{method:h,windowLen:v,minPeriods:d,threshold:g,k,scores:b,flags:O,flagged:y}}function u(o={}){const a=o||{},h=a.field;if(typeof h!="string"||!h)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const v=a.method||"modifiedZScore";if(!(X.includes(v)||s.includes(v))||v==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${v}'`);const k=typeof a.orderBy=="string"?a.orderBy:null,d=a.latest===!0,p=s.includes(v),b=O=>Number(O==null?NaN:O[h]);return O=>{const y=Array.isArray(O)?O.slice():[...O];k&&y.sort((L,$)=>{const P=L?.[k],N=$?.[k];return P===N?0:P==null?-1:N==null?1:P<N?-1:1});const M=y.map(b);let D,_;if(p)({flags:D,scores:_}=n(M,{method:v,windowLen:a.windowLen,threshold:a.threshold,k:a.k,minPeriods:a.minPeriods}));else if(v==="iqr"){const L=w(M,{k:a.k});D=M.map($=>L?Number.isFinite($)&&($<L.lower||$>L.upper):!1),_=M.map(()=>null)}else({flags:D,scores:_}=j(M,{threshold:a.threshold}));if(d){const L=D.length-1;return L<0||!D[L]?!1:{method:v,field:h,flagged:[{row:y[L],score:_[L]}]}}const I=[];for(let L=0;L<D.length;L++)D[L]&&I.push({row:y[L],score:_[L]});return I.length?{method:v,field:h,flagged:I}:!1}}}),Ue("packages/core/src/compute/forecast.js",function(e,U){"use strict";Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}});const te=U("packages/core/src/compute/special.js"),C=te.normalQuantile,q=te.studentTQuantile,B=U("packages/core/src/internal/warn.js").warnOnce,Z=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),K=1e-4,F=1-1e-4;function X(a){const h=[];for(let v=0;v<a.length;v++){const g=a[v];if(g!==null&&typeof g=="object"){const k=Number.isFinite(g.at)?g.at:v,d=Number.isFinite(g.value)?g.value:null;h.push({at:k,value:d})}else h.push({at:v,value:Number.isFinite(g)?Number(g):null})}return h}function H(a){const h=a.filter(p=>p.value!==null),v=h[0],g=h[h.length-1],k=g.at-v.at,d=h.length>1&&k>0?k/(h.length-1):1;return{lastAt:g.at,step:d}}function j(a){return Math.min(F,Math.max(K,a))}function w(a,h=K,v=F,g=80){const k=(Math.sqrt(5)-1)/2;let d=h,p=v,b=p-k*(p-d),O=d+k*(p-d),y=a(b),M=a(O);for(let D=0;D<g;D++)y<M?(p=O,O=b,M=y,b=p-k*(p-d),y=a(b)):(d=b,b=O,y=M,O=d+k*(p-d),M=a(O));return(d+p)/2}function m(a,h){let v=null,g=0,k=0;for(let d=0;d<a.length;d++){const p=a[d];if(p!==null){if(v===null){v=p;continue}g+=(p-v)**2,k+=1,v=h*p+(1-h)*v}}return{level:v,sse:g,m:k}}function c(a,h,v){let g=null,k=null,d=0,p=0;for(let b=0;b<a.length;b++){const O=a[b];if(O===null){g!==null&&k!==null&&(g+=k);continue}if(g===null){g=O;continue}k===null&&(k=O-g);const y=g+k;d+=(O-y)**2,p+=1;const M=g;g=h*O+(1-h)*(M+k),k=v*(g-M)+(1-v)*k}return{level:g,trend:k,sse:d,m:p}}function f(a,h,v,g,k){const d=a.length;if(d<2*h)return null;const p=$=>{let P=0,N=0;for(let T=$;T<$+h&&T<d;T++)a[T]!==null&&(P+=a[T],N+=1);return N?P/N:null},b=p(0),O=p(h);if(b===null||O===null)return null;let y=b,M=(O-b)/h;const D=new Array(h).fill(0);for(let $=0;$<h;$++)D[$]=a[$]===null?0:a[$]-y;const _=D.reduce(($,P)=>$+P,0)/h;for(let $=0;$<h;$++)D[$]-=_;let I=0,L=0;for(let $=h;$<d;$++){const P=$%h,N=D[P],T=a[$];if(T===null){y+=M;continue}const E=y+M+N;I+=(T-E)**2,L+=1;const A=y;y=v*(T-N)+(1-v)*(y+M),M=g*(y-A)+(1-g)*M,D[P]=k*(T-y)+(1-k)*N}return{level:y,trend:M,season:D,phase:(d-1)%h,sse:I,count:L}}function l(a,h,v){let g=1;for(const d of h)g+=d*d;const k=Math.sqrt(a*g);return{se:k,margin:v*k}}function r(a,h={}){if(!a||typeof a.length!="number"||a.length===0)return null;const v=Z.includes(h.method)?h.method:"linear",g=Math.max(1,Math.floor(Number(h.horizon)||1)),k=Number.isFinite(h.confidence)&&h.confidence>0&&h.confidence<1?h.confidence:.95,d=1-(1-k)/2,p=X(a),b=p.map(I=>I.value),O=b.filter(I=>I!==null),y=O.length,{lastAt:M,step:D}=y?H(p):{lastAt:0,step:1},_=I=>M+I*D;return v==="linear"?t(p,y,g,k,d,_):v==="movingAverage"?i(O,y,g,k,d,h,_):v==="ses"?s(b,y,g,k,d,h,_):v==="holt"?n(b,y,g,k,d,h,_):u(b,y,g,k,d,h,_)}function t(a,h,v,g,k,d){if(h<2)return null;let p=0,b=0;for(const T of a)T.value!==null&&(p+=T.at,b+=T.value);p/=h,b/=h;let O=0,y=0,M=0;for(const T of a){if(T.value===null)continue;const E=T.at-p,A=T.value-b;O+=E*E,y+=E*A,M+=A*A}if(O===0)return null;const D=y/O,_=b-D*p,I=M===0?1:Math.max(0,Math.min(1,y*y/(O*M))),L=Math.max(0,M-D*y),$=h>2?Math.sqrt(L/(h-2)):null,P=h>2?q(k,h-2):null,N=[];for(let T=1;T<=v;T++){const E=d(T),A=_+D*E;let S=null,x=null,W=null,V=null,G=null;if($!==null){const Q=1/h+(E-p)**2/O,ee=$*Math.sqrt(1+Q),ne=$*Math.sqrt(Q);G=ee,S=A-P*ee,x=A+P*ee,W=A-P*ne,V=A+P*ne}N.push({step:T,at:E,mean:A,lower:S,upper:x,lowerMean:W,upperMean:V,se:G})}return{method:"linear",horizon:v,confidence:g,n:h,sigma:$,r2:I,params:{slope:D,intercept:_},points:N}}function i(a,h,v,g,k,d,p){if(h<1)return null;const b=Math.max(1,Math.min(h,Math.floor(Number(d.windowLen)||h))),O=a.slice(h-b);let y=0;for(const $ of O)y+=$;const M=y/b;let D=null,_=null;if(b>1){let $=0;for(const N of O)$+=(N-M)**2;D=Math.sqrt($/(b-1))*Math.sqrt(1+1/b),_=q(k,b-1)}const I=D===null?null:_*D,L=[];for(let $=1;$<=v;$++)L.push({step:$,at:p($),mean:M,lower:I===null?null:M-I,upper:I===null?null:M+I,se:D});return{method:"movingAverage",horizon:v,confidence:g,n:h,sigma:D===null?null:D,params:{windowLen:b},points:L}}function s(a,h,v,g,k,d,p){if(h<1)return null;let b=Number.isFinite(d.alpha)?j(d.alpha):null;b===null&&(b=w(_=>m(a,_).sse));const O=m(a,b),y=C(k),M=O.m>0?O.sse/O.m:null,D=[];for(let _=1;_<=v;_++){const I=O.level;let L=null,$=null,P=null;if(M!==null){const N=[];for(let E=1;E<_;E++)N.push(b);const T=l(M,N,y);P=T.se,L=I-T.margin,$=I+T.margin}D.push({step:_,at:p(_),mean:I,lower:L,upper:$,se:P})}return{method:"ses",horizon:v,confidence:g,n:h,sigma:M===null?null:Math.sqrt(M),params:{alpha:b},points:D}}function n(a,h,v,g,k,d,p){if(h<2)return null;let b=Number.isFinite(d.alpha)?j(d.alpha):null,O=Number.isFinite(d.beta)?j(d.beta):null;if(b===null||O===null){let L=b===null?.5:b,$=O===null?.5:O;for(let P=0;P<6;P++)b===null&&(L=w(N=>c(a,N,$).sse)),O===null&&($=w(N=>c(a,L,N).sse));b=b===null?L:b,O=O===null?$:O}const y=c(a,b,O),M=C(k),D=y.m>0?y.sse/y.m:null,_=b*O,I=[];for(let L=1;L<=v;L++){const $=y.level+L*y.trend;let P=null,N=null,T=null;if(D!==null){const E=[];for(let S=1;S<L;S++)E.push(b+S*_);const A=l(D,E,M);T=A.se,P=$-A.margin,N=$+A.margin}I.push({step:L,at:p(L),mean:$,lower:P,upper:N,se:T})}return{method:"holt",horizon:v,confidence:g,n:h,sigma:D===null?null:Math.sqrt(D),params:{alpha:b,beta:O},points:I}}function u(a,h,v,g,k,d,p){const b=Math.floor(Number(d.period));if(!(b>=2))return B("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(h<2*b)return null;let O=Number.isFinite(d.alpha)?j(d.alpha):null,y=Number.isFinite(d.beta)?j(d.beta):null,M=Number.isFinite(d.gamma)?j(d.gamma):null;const D=(T,E,A)=>{const S=f(a,b,T,E,A);return S?S.sse:1/0};if(O===null||y===null||M===null){let T=O===null?.5:O,E=y===null?.5:y,A=M===null?.5:M;for(let S=0;S<8;S++)O===null&&(T=w(x=>D(x,E,A))),y===null&&(E=w(x=>D(T,x,A))),M===null&&(A=w(x=>D(T,E,x)));O=O===null?T:O,y=y===null?E:y,M=M===null?A:M}const _=f(a,b,O,y,M);if(!_)return null;const I=C(k),L=_.count>0?_.sse/_.count:null,$=O*y,P=M*(1-O),N=[];for(let T=1;T<=v;T++){const E=_.season[(_.phase+T)%b],A=_.level+T*_.trend+E;let S=null,x=null,W=null;if(L!==null){const V=[];for(let Q=1;Q<T;Q++)V.push(O+Q*$+(Q%b===0?P:0));const G=l(L,V,I);W=G.se,S=A-G.margin,x=A+G.margin}N.push({step:T,at:p(T),mean:A,lower:S,upper:x,se:W})}return{method:"holtWinters",horizon:v,confidence:g,n:h,sigma:L===null?null:Math.sqrt(L),params:{alpha:O,beta:y,gamma:M,period:b},points:N}}const o={FORECAST_METHODS:Z,forecast:r}}),Ue("packages/core/src/compute/hypothesis.js",function(e,U){"use strict";Object.defineProperty(e,"GROUP_TESTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"NORMALITY_ALPHA",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"HL_PAIR_LIMIT",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"welchTTest",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"mannWhitneyUTest",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"chiSquareTest",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return I}});const C=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/compute/handle.js").valueReader,B=U("packages/core/src/compute/statistics.js"),Z=B.numbers,K=B.moments,F=B.frequencyMap,X=B.categoricalDistance,H=B.isNumericColumn,j=B.jarqueBera,w=B.proportionInterval,m=B.SUBSET_RELIABILITY_FLOOR,f=U("packages/core/src/compute/compare.js").pooledStandardMeanDifference,l=U("packages/core/src/compute/special.js"),r=l.studentT,t=l.studentTQuantile,i=l.normalCdf,s=l.normalQuantile,n=l.chiSquareUpperTail,u=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),o=.05,a=2e6;function h(L){const $=Number(L);return Number.isFinite($)&&$>0&&$<1?$:.95}function v(L){const{n:$,mean:P,m2:N}=K(L);return{mean:P,sd:$>0?Math.sqrt(N/$):0,n:$}}function g(L,$){const P=L.length;if(P<2)return 0;let N=0;for(let T=0;T<P;T++){const E=L[T]-$;N+=E*E}return N/(P-1)}function k(L,$){return{name:"pooledStandardMeanDifference",value:f(v(L),v($))}}function d(L,$,P){const N=L.length,T=$.length;if(N<2||T<2)return null;const E=h(P),{mean:A}=K(L),{mean:S}=K($),x=g(L,A),W=g($,S),V=x/N+W/T;if(!(V>0))return null;const G=Math.sqrt(V),Q=(A-S)/G,ee=x/N*(x/N)/(N-1),ne=W/T*(W/T)/(T-1),se=V*V/(ee+ne),le=Math.min(1,Math.max(0,2*(1-r(Math.abs(Q),se)))),me=A-S,ve=t(1-(1-E)/2,se)*G;return{test:u.WELCH,statistic:Q,statisticName:"t",df:se,pValue:le,interval:{estimate:me,lower:me-ve,upper:me+ve,confidence:E,method:"welch-t (difference of means)"},effectSize:k(L,$),nA:N,nB:T,reliable:N>=m&&T>=m,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function p(L){const $=L.length;if($===0)return Number.NaN;const P=$>>1;return $%2?L[P]:(L[P-1]+L[P])/2}function b(L,$,P){const N=L.length,T=$.length,E=N*T;if(E===0||E>a)return null;const A=new Float64Array(E);let S=0;for(let ee=0;ee<N;ee++)for(let ne=0;ne<T;ne++)A[S++]=L[ee]-$[ne];A.sort();const x=p(A),W=Math.sqrt(N*T*(N+T+1)/12),V=s(1-(1-P)/2);let G=Math.round(E/2-V*W);G>=0||(G=0);const Q=Math.floor((E-1)/2);return G>Q&&(G=Q),{estimate:x,lower:A[G],upper:A[E-1-G],confidence:P,method:"hodges-lehmann (normal approximation)"}}function O(L,$,P){const N=L.length,T=$.length;if(N<1||T<1)return null;const E=h(P),A=N+T,S=new Array(A);for(let le=0;le<N;le++)S[le]={v:L[le],g:0};for(let le=0;le<T;le++)S[N+le]={v:$[le],g:1};S.sort((le,me)=>le.v-me.v);let x=0,W=0,V=0;for(;V<A;){let le=V;for(;le<A&&S[le].v===S[V].v;)le++;const me=le-V,ve=(V+1+le)/2;for(let fe=V;fe<le;fe++)S[fe].g===0&&(x+=ve);W+=me*me*me-me,V=le}const G=x-N*(N+1)/2,Q=N*T/2,ee=N*T/12*(A+1-W/(A*(A-1)));let ne=1;if(ee>0){const le=Math.max(0,Math.abs(G-Q)-.5);ne=Math.min(1,2*i(-le/Math.sqrt(ee)))}const se=b(L,$,E);return{test:u.MANN_WHITNEY,statistic:G,statisticName:"U",df:null,pValue:ne,interval:se,effectSize:k(L,$),nA:N,nB:T,reliable:N>=m&&T>=m,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function y(L,$,P,N,T){const E=w(L,$,T),A=w(P,N,T);if(!E||!A)return null;const S=E.proportion-A.proportion,x=S-Math.sqrt((E.proportion-E.lower)**2+(A.upper-A.proportion)**2),W=S+Math.sqrt((E.upper-E.proportion)**2+(A.proportion-A.lower)**2);return{lower:x,upper:W}}function M(L,$,P,N,T,E={}){if(!($>0)||!(N>0))return null;const A=new Set([...L.keys(),...P.keys()]),S=A.size;if(S<2)return null;const x=$+N;let W=0;for(const ne of A){const se=L.get(ne)||0,le=P.get(ne)||0,me=se+le,ve=$*me/x,fe=N*me/x;ve>0&&(W+=(se-ve)*(se-ve)/ve),fe>0&&(W+=(le-fe)*(le-fe)/fe)}const V=S-1,G=n(W,V);let Q=null;E.category!==void 0&&A.has(E.category)?Q=E.category:S===2&&([Q]=[...A]);let ee=null;if(Q!==null){const ne=y(L.get(Q)||0,$,P.get(Q)||0,N,h(T));ne&&(ee={estimate:(L.get(Q)||0)/$-(P.get(Q)||0)/N,lower:ne.lower,upper:ne.upper,confidence:h(T),method:"newcombe (difference in this category's share)",category:Q})}return{test:u.CHI_SQUARE,statistic:W,statisticName:"chiSquare",df:V,pValue:G,interval:ee,effectSize:{name:"categoricalTotalVariation",value:X(L,$,P,N)},nA:$,nB:N,reliable:$>=m&&N>=m,method:"Pearson chi-square test of independence (2×k, no continuity correction)"}}function D(L){return L==null||L===""||typeof L=="number"&&Number.isNaN(L)?null:L instanceof Date?L.getTime():typeof L=="object"?String(L):L}function _(L,$,P){if(P===u.WELCH||P===u.MANN_WHITNEY)return{test:P,chosenBy:"override",reason:`caller override: ${P}`};const N=j(L),T=j($),E=N===null?null:Math.exp(-N/2),A=T===null?null:Math.exp(-T/2);return E!==null&&E<o||A!==null&&A<o?{test:u.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${o})`}:{test:u.WELCH,chosenBy:"auto",reason:E!==null||A!==null?"column family: numeric, no departure from normality detected":"column family: numeric (too few rows to screen normality)"}}function I(L,$,P,N={}){if(!L||!$)return null;const T=h(N.confidence),E=z($);let A;if(Array.isArray(N.groups)&&N.groups.length===2)A=[D(N.groups[0]),D(N.groups[1])];else{const{map:le}=F($,P),me=[...le.entries()].sort((ve,fe)=>fe[1]-ve[1]).slice(0,2).map(ve=>ve[0]);if(me.length<2)return C("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;A=me}const[S,x]=A;if(S===null||x===null||S===x)return C("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const W=[],V=[];for(let le=0;le<P.length;le++){const me=D(E(P[le]));me===S?W.push(P[le]):me===x&&V.push(P[le])}if(W.length===0||V.length===0)return C("compareGroups:empty","[lattice] compareGroups: one of the two groups has no rows in the current set."),null;const G=N.test&&N.test!=="auto"?String(N.test):null,Q=H(L,W.concat(V));let ee,ne,se;if(G===u.CHI_SQUARE||!G&&!Q){ne=G?"override":"auto",se=G?"caller override: chiSquare":"column family: categorical";const le=F(L,W),me=F(L,V);ee=M(le.map,le.total,me.map,me.total,T,{category:N.category})}else{if((G===u.WELCH||G===u.MANN_WHITNEY)&&!Q)return C("compareGroups:numeric-override",`[lattice] compareGroups: ${G} needs a numeric column, but the column is not numeric.`),null;const le=Z(L,W),me=Z(L,V),ve=_(le,me,G);ne=ve.chosenBy,se=ve.reason,ee=ve.test===u.MANN_WHITNEY?O(le,me,T):d(le,me,T)}return ee?{...ee,chosenBy:ne,reason:se,groups:[S,x]}:(C("compareGroups:degenerate","[lattice] compareGroups: the chosen test had too little to work with (too few values, or no variation)."),null)}}),Ue("packages/core/src/columns/detailcolumn.js",function(e,U){"use strict";Object.defineProperty(e,"DETAIL_COLUMN_ID",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"createDetailColumn",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return z}});const te="__lattice_detail",C=36;function q(B){const Z=B.config&&B.config.detailColumnWidth||C;return{id:te,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:Z,min:Z,max:Z,pin:B.config&&B.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(K,F){return!!(F&&F.expanded)},formatValue(){return""}}}const z=q}),Ue("packages/core/src/columns/treecolumn.js",function(e,U){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createTreeColumn",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const C=U("packages/core/src/internal/predicates.js").isFunction,q="__lattice_tree",z=260;function B(K){const F=K.tree||{},X=K.config&&K.config.treeColumnWidth||z,H=()=>(K.columns&&C(K.columns.visible)?K.columns.visible():[]).find(c=>!c.generated)||null,j=(m,c)=>{if(c&&c.group)return c.groupValue;if(C(F.label))return F.label(m,c);if(typeof F.label=="string")return m==null?null:m[F.label];const f=H();return f&&C(f.getValue)?f.getValue(m,c):null},w=()=>{if(F.title)return F.title;const m=typeof F.label=="string"?K.columns&&C(K.columns.get)?K.columns.get(F.label):null:H();return m&&(m.title||m.id)||"Hierarchy"};return{id:q,get title(){return w()},field:null,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:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:X,min:140,pin:K.config&&K.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(m,c){return j(m,c)},formatValue(m,c){if(c&&c.grandTotal)return K.config&&K.config.grandTotalLabel||"Total";if(m==null)return"";if(!F.label){const f=H();if(f&&C(f.formatValue))return f.formatValue(m,c)}return String(m)}}}const Z=B}),Ue("packages/core/src/columns/pivotcolumns.js",function(e,U){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return B}});const C=U("packages/core/src/internal/warn.js").warnOnce,q="__lattice_pivot",z=500;function B(X){const{pivot:H,valueColumns:j,config:w}=X,m=H&&H.paths||[],c=X.separator||w&&w.pivot&&w.pivot.separator||" | ",f=w&&w.pivot&&w.pivot.maxColumns||z;if(!m.length||!j.length)return{tree:[],leaves:[],error:null};const l=Z(w),r=m.length*j.length+(l?j.length:0);if(r>f){const s=`pivot would generate ${r} columns, above the limit of ${f}. Pivot on a lower-cardinality column, or raise pivot.maxColumns.`;return C(`pivot.maxColumns:${r}`,s),{tree:[],leaves:[],error:s}}const t=[],i=[];for(const s of m){const n=[];for(const u of j){const o=F(s,u,c);n.push(o),i.push(o)}n.length===1?(n[0].title=String(s),t.push(n[0])):t.push({id:`${q}:group:${s}`,title:String(s),columns:n,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(l){const s=j.map(u=>K(u,w));i.push(...s);const n=w&&w.pivot&&w.pivot.totalsLabel||"Total";if(s.length===1)s[0].title=n,l==="before"?t.unshift(s[0]):t.push(s[0]);else{const u={id:`${q}:group:__totals`,title:n,columns:s,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};l==="before"?t.unshift(u):t.push(u)}}return{tree:t,leaves:i,error:null}}function Z(X){const H=X&&X.pivot&&X.pivot.groupTotals;return H==="before"||H==="after"?H:null}function K(X,H){return{id:`${q}:__total${H&&H.pivot&&H.pivot.separator||" | "}${X.id}`,field:null,title:X.title||X.id,type:X.type,dataType:X.dataType,nullable:!0,align:X.align,generated:!0,pivot:{enabled:!1,index:0,sourceId:X.id,total:!0},value:{pure:!0},cell:{align:X.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:X.total,lookup:null,layout:{width:X.layout&&X.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(j,w){const m=w&&w.totals;return m&&Object.hasOwn(m,X.id)?m[X.id]:null},formatValue(j,w){return j==null?"":X.formatValue?X.formatValue(j,w):String(j)}}}function F(X,H,j){return{id:`${q}:${X}${j}${H.id}`,field:null,title:H.title||H.id,type:H.type,dataType:H.dataType,nullable:!0,align:H.align,generated:!0,pivot:{enabled:!1,index:0,path:X,sourceId:H.id},value:{pure:!0},cell:{align:H.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:H.total,lookup:null,layout:{width:H.layout&&H.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(w,m){return w==null?"":H.formatValue?H.formatValue(w,m):String(w)}}}}),Ue("packages/core/src/compute/group.js",function(e,U){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return w}});const te=U("packages/core/src/compute/handle.js"),C=te.dictSize,q=te.identity,z=te.presenceReader,B=te.rowCount,Z=te.valueReader,K="",F="\0",X=1<<20;function H(m,c,f,l){const r=m.length,t=m.map(a=>Z(a)),i=Array.isArray(l)&&l.some(Boolean),s=i?t.map((a,h)=>l[h]?v=>l[h](a(v)):a):t;if(!i&&r>0&&m.every(a=>a&&a.kind==="dictionary"&&a.dict)){const a=m.map(v=>C(v.dict)+1);let h=1;for(let v=0;v<r;v++)h*=a[v];if(h<=Number.MAX_SAFE_INTEGER){const v=m.map(p=>p.values),g=m.map(p=>z(p)),k=p=>{let b=0;for(let O=0;O<r;O++){const y=g[O],M=y&&y(p)===0?a[O]-1:v[O][p];b=b*a[O]+M}return b},d=new Float64Array(f);for(let p=0;p<f;p++)d[p]=k(c[p]);return{packed:d,strings:null,product:h,readers:s,keyOf:k}}}const u=a=>{let h="";for(let v=0;v<r;v++){const g=s[v](a);h+=(v===0?"":K)+(g==null?F:String(g))}return h},o=new Array(f);for(let a=0;a<f;a++)o[a]=u(c[a]);return{packed:null,strings:o,product:1/0,readers:s,keyOf:u}}function j(m,c,f,l){const r=new Uint32Array(l+1);for(let n=0;n<f;n++)r[c[n]+1]++;for(let n=0;n<l;n++)r[n+1]+=r[n];const t=new Uint32Array(f),i=r.slice(0,l);for(let n=0;n<f;n++)t[i[c[n]]++]=m[n];const s=new Array(l);for(let n=0;n<l;n++)s[n]=t.subarray(r[n],r[n+1]);return s}function w(m,c,f={}){const l=m||[],r=c||q(B(l[0],f)),t=r.length;if(l.length===0||t===0)return{keys:[],buckets:[]};const{packed:i,strings:s,product:n,readers:u}=H(l,r,t,f.project),o=new Uint32Array(t);let a=0,h=null;if(i&&n<=Math.max(1024,Math.min(X,t*4))){const d=n,p=new Int32Array(d).fill(-1);for(let b=0;b<t;b++)p[i[b]]=0;for(let b=0;b<d;b++)p[b]===0&&(p[b]=a++);for(let b=0;b<t;b++)o[b]=p[i[b]];h=new Float64Array(a);for(let b=0;b<d;b++)p[b]>=0&&(h[p[b]]=b)}else if(i){const d=new Map;for(let p=0;p<t;p++){const b=i[p];let O=d.get(b);O===void 0&&(O=a++,d.set(b,O)),o[p]=O}h=new Float64Array(a);for(const[p,b]of d)h[b]=p}else{const d=new Map;for(let p=0;p<t;p++){const b=s[p];let O=d.get(b);O===void 0&&(O=a++,d.set(b,O)),o[p]=O}}const v=j(r,o,t,a),g=new Array(a);for(let d=0;d<a;d++){const p=v[d][0],b=new Array(u.length);for(let O=0;O<u.length;O++)b[O]=u[O](p);g[d]=b}const k={keys:g,buckets:v};return h&&(k.packed=h),k}}),Ue("packages/core/src/compute/pivot.js",function(e,U){"use strict";Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return t}});const C=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/compute/handle.js").valueComparator,Z=U("packages/core/src/compute/group.js").packKeys,F=U("packages/core/src/compute/total.js").total,X="|",H="/",j=2e3;function w(n,u,o){return`${n}${X}${u}${X}${o}`}function m(n,u){let o="";for(let a=0;a<n.length;a++){const h=n[a];o+=(a===0?"":u)+(h==null?"":String(h))}return o}function c(n,u,o={}){const a=o.separator||H,h=u.length,{keyOf:v,readers:g}=Z(n,u,0),k=new Map,d=[],p=[];for(let I=0;I<h;I++){const L=u[I],$=v(L);if(k.has($))continue;k.set($,d.length),p.push($);const P=new Array(g.length);for(let N=0;N<g.length;N++)P[N]=g[N](L);d.push(P)}const b=z(o.locale),O=d.map((I,L)=>L);O.sort((I,L)=>{const $=d[I],P=d[L];for(let N=0;N<$.length;N++){const T=f($[N],P[N],b);if(T!==0)return T}return I-L});const y=new Array(O.length),M=new Array(O.length),D=new Map;for(let I=0;I<O.length;I++){const L=O[I];y[I]=d[L],M[I]=m(d[L],a),D.set(p[L],I)}return{keys:y,paths:M,idOf:I=>{const L=D.get(v(I));return L===void 0?-1:L}}}function f(n,u,o){const a=n==null,h=u==null;return a||h?a&&h?0:a?1:-1:o(n,u)}function l(n){const u=n.values||n.totals||[];if(u.length&&typeof u[0]=="object"&&u[0]!==null)return u.filter(v=>v&&v.handle);const o=typeof n.handle=="function"?n.handle:null;if(!o)return u.length&&C("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 a=typeof n.totalOf=="function"?n.totalOf:null,h=[];for(const v of u){const g=o(v);g&&h.push({colId:v,handle:g,fn:a?a(v):"sum"})}return h}function r(n,u,o){if(Array.isArray(n)){const a=o||{};return{...a,pivotHandles:n,order:u||null,groups:a.groups||null}}return n||{}}function t(n,u,o){const a=r(n,u,o),h=a.separator||H,v=l(a),g=a.maxColumns===void 0?j:a.maxColumns,k=a.groups&&a.groups.buckets?a.groups:null,d=k?k.buckets:[a.order||new Uint32Array(0)],p=a.groupPaths||(k?k.keys.map($=>m($,h)):[""]),b=s(d),{keys:O,paths:y,idOf:M}=c(a.pivotHandles||[],b,a),D=y.length*Math.max(1,v.length),_=i(y,v,h);if(g&&D>g){const $=new Map;return{keys:O,paths:y,fields:_,groupPaths:p,columns:D,values:$,cells:$,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${D} columns, above pivot.maxColumns of ${g}. Narrow the pivot columns or raise the limit.`,columns:D,maxColumns:g}}}const I=new Map,L=y.length;for(let $=0;$<d.length;$++){const P=d[$],N=p[$]===void 0?"":p[$],T=P.length;if(T===0)continue;const E=new Int32Array(T),A=new Uint32Array(L+1);for(let W=0;W<T;W++){const V=M(P[W]);E[W]=V,V>=0&&A[V+1]++}for(let W=0;W<L;W++)A[W+1]+=A[W];const S=new Uint32Array(T),x=A.slice(0,L);for(let W=0;W<T;W++){const V=E[W];V>=0&&(S[x[V]++]=P[W])}for(let W=0;W<L;W++){const V=A[W],G=A[W+1];if(G===V)continue;const Q=S.subarray(V,G);for(let ee=0;ee<v.length;ee++){const ne=v[ee],se=F(ne.handle,Q,ne.fn,a.totalContext||{locale:a.locale});I.set(w(N,y[W],ne.colId),se)}}}return{keys:O,paths:y,fields:_,groupPaths:p,columns:D,values:I,cells:I,error:null}}function i(n,u,o){if(u.length===0)return n.slice();const a=[];for(const h of n)for(const v of u)a.push(`${h}${o}${v.colId}`);return a}function s(n){if(n.length===1)return n[0]||new Uint32Array(0);let u=0;for(const h of n)u+=h?h.length:0;const o=new Uint32Array(u);let a=0;for(const h of n)!h||h.length===0||(o.set(h,a),a+=h.length);return o}}),Ue("packages/core/src/store/bitset.js",function(e,U){"use strict";Object.defineProperty(e,"Bitset",{enumerable:!0,get:function(){return C}});const te=8;class C{static#e=new Uint8Array(256);static{for(let z=1;z<256;z++)C.#e[z]=C.#e[z>>1]+(z&1)}#t;#n;constructor(z=0){const B=Math.max(0,z|0);this.#n=B,this.#t=new Uint8Array(Math.ceil(B/te))}get size(){return this.#n}get words(){return this.#t}get bytes(){return this.#t?this.#t.byteLength:0}get(z){return z<0||z>=this.#n?0:this.#t[z>>3]>>(z&7)&1}set(z){return z>=0&&z<this.#n&&(this.#t[z>>3]|=1<<(z&7)),this}clear(z){return z>=0&&z<this.#n&&(this.#t[z>>3]&=~(1<<(z&7))),this}assign(z,B){return B?this.set(z):this.clear(z)}fill(z=!1){return this.#t.fill(z?255:0),z&&this.#r(),this}grow(z){const B=Math.max(0,z|0);if(B<=this.#n)return this;const Z=Math.ceil(B/te);if(Z>this.#t.length){const K=new Uint8Array(Z);K.set(this.#t),this.#t=K}return this.#n=B,this}count(){const z=this.#t,B=C.#e;let Z=0;for(let K=0;K<z.length;K++)Z+=B[z[K]];return Z}and(z){const B=z instanceof C?z.words:z,Z=this.#t,K=Math.min(Z.length,B.length);for(let F=0;F<K;F++)Z[F]&=B[F];for(let F=K;F<Z.length;F++)Z[F]=0;return this}or(z){const B=z instanceof C?z.words:z,Z=this.#t,K=Math.min(Z.length,B.length);for(let F=0;F<K;F++)Z[F]|=B[F];return this}not(){const z=this.#t;for(let B=0;B<z.length;B++)z[B]=~z[B]&255;return this.#r(),this}clone(){const z=new C(this.#n);return z.words.set(this.#t.subarray(0,z.words.length)),z}release(){this.#t=new Uint8Array(0),this.#n=0}#r(){const z=this.#n&7;if(z===0)return;const B=this.#n>>3;B<this.#t.length&&(this.#t[B]&=(1<<z)-1)}static from(z){const B=Array.isArray(z)?z:Array.from(z),Z=new C(B.length);for(let K=0;K<B.length;K++)B[K]&&Z.set(K);return Z}}}),Ue("packages/core/src/store/dictionary.js",function(e,U){"use strict";Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return z}});const te=U("packages/core/src/internal/compare.js"),C=te.collator,q=te.defaultCompare;class z{#e;#t=new Map;#n=0;#r=null;#s=-1;#i="\0";constructor(Z=[]){this.#e=[];for(let K=0;K<Z.length;K++){const F=Z[K];this.#t.has(F)||(this.#t.set(F,this.#e.length),this.#e.push(F))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let Z=this.#e.length*8;for(let K=0;K<this.#e.length;K++){const F=this.#e[K];typeof F=="string"&&(Z+=F.length*2),Z+=16}return Z}codeOf(Z){const K=this.#t.get(Z);if(K!==void 0)return K;const F=this.#e.length;return this.#e.push(Z),this.#t.set(Z,F),this.#n++,F}lookup(Z){const K=this.#t.get(Z);return K===void 0?-1:K}has(Z){return this.#t.has(Z)}valueOf(Z){return this.#e[Z]}values(){return this.#e}ranks(Z){const K=Z||"";if(this.#r&&this.#s===this.#n&&this.#i===K)return this.#r;const F=this.#e.length,X=new Array(F);for(let m=0;m<F;m++)X[m]=m;const H=C(Z).compare,j=this.#e;X.sort((m,c)=>this.#o(j[m],j[c],H));const w=new Uint32Array(F);for(let m=0;m<F;m++)w[X[m]]=m;return this.#r=w,this.#s=this.#n,this.#i=K,w}#o(Z,K,F){return typeof Z=="string"&&typeof K=="string"?F(Z,K):q(Z,K)}}}),Ue("packages/core/src/store/multivalue.js",function(e,U){"use strict";Object.defineProperty(e,"MultiValue",{enumerable:!0,get:function(){return te}});class te{#e;#t;#n=0;#r=0;constructor(q={}){const z=Math.max(1,q.rows??16),B=Math.max(1,q.values??z);this.#e=new Int32Array(B),this.#t=new Uint32Array(z+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(q){return q<0||q>=this.#n?0:this.#t[q+1]-this.#t[q]}at(q){return q<0||q>=this.#n?this.#e.subarray(0,0):this.#e.subarray(this.#t[q],this.#t[q+1])}has(q,z){if(q<0||q>=this.#n)return!1;const B=this.#e,Z=this.#t[q+1];for(let K=this.#t[q];K<Z;K++)if(B[K]===z)return!0;return!1}hasAny(q,z){for(let B=0;B<z.length;B++)if(this.has(q,z[B]))return!0;return!1}hasAll(q,z){for(let B=0;B<z.length;B++)if(!this.has(q,z[B]))return!1;return!0}hasNone(q,z){return!this.hasAny(q,z)}push(q){const z=this.#n,B=q.length;this.#s(z+1),this.#i(this.#r+B);const Z=this.#r;for(let K=0;K<B;K++)this.#e[Z+K]=q[K]|0;return this.#r+=B,this.#n=z+1,this.#t[z]=Z,this.#t[z+1]=this.#r,z}write(q,z){if(q===this.#n){this.push(z);return}if(q<0||q>this.#n)return;const B=this.#t[q],Z=this.#t[q+1],K=z.length;if(Z-B===K){for(let F=0;F<K;F++)this.#e[B+F]=z[F]|0;return}this.#o(q,z)}compact(q,z,B){const Z=this.#e,K=this.#t,F=this.#n,X=new Int32Array(Math.max(1,this.#r)),H=new Uint32Array(z+1);let j=0;for(let w=0;w<F;w++){if(q[w]===B)continue;const m=K[w],c=K[w+1];H[q[w]]=j;for(let f=m;f<c;f++)X[j++]=Z[f];H[q[w]+1]=j}this.#e=X,this.#t=H,this.#n=z,this.#r=j}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#s(q){if(q+1<=this.#t.length)return;let z=this.#t.length-1;for(;z<q;)z=z*2||16;const B=new Uint32Array(z+1);B.set(this.#t),this.#t=B}#i(q){if(q<=this.#e.length)return;let z=this.#e.length;for(;z<q;)z=z*2||16;const B=new Int32Array(z);B.set(this.#e),this.#e=B}#o(q,z){const B=this.#e,Z=this.#t,K=this.#n,F=z.length-(Z[q+1]-Z[q]),X=new Int32Array(Math.max(1,this.#r+F)),H=new Uint32Array(Z.length);let j=0;for(let w=0;w<K;w++){if(H[w]=j,w===q)for(let m=0;m<z.length;m++)X[j++]=z[m]|0;else for(let m=Z[w];m<Z[w+1];m++)X[j++]=B[m];H[w+1]=j}this.#e=X,this.#t=H,this.#r=j}}}),Ue("packages/core/src/compute/sort.js",function(e,U){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return L}});const te=U("packages/core/src/compute/handle.js"),C=te.bitReader,q=te.dictRanks,z=te.dictSize,B=te.identity,Z=te.isMissing,K=te.presenceReader,F=te.rowCount,X=te.valueComparator,H=te.valueReader,j=new Uint32Array(0),w=new ArrayBuffer(8),m=new Float64Array(w),c=new Uint32Array(w),f=(m[0]=-1,(c[1]&2147483648)!==0?1:0),l=f===1?0:1;function r(P,N){m[0]=P;let T=c[f],E=c[l];(T&2147483648)!==0?(T=~T>>>0,E=~E>>>0):T=(T^2147483648)>>>0,N[0]=E,N[1]=T}function t(P,N,T,E){if(E<2)return P;const A=new Uint32Array(256*8);for(let ne=0;ne<E;ne++){const se=N[ne],le=T[ne];A[se&255]++,A[256+(se>>>8&255)]++,A[512+(se>>>16&255)]++,A[768+(se>>>24&255)]++,A[1024+(le&255)]++,A[1280+(le>>>8&255)]++,A[1536+(le>>>16&255)]++,A[1792+(le>>>24&255)]++}let S=P,x=N,W=T,V=new Uint32Array(E),G=new Uint32Array(E),Q=new Uint32Array(E);const ee=new Uint32Array(256);for(let ne=0;ne<8;ne++){const se=ne<<8,le=(ne&3)<<3,me=ne>=4;let ve=!1;for(let He=0;He<256;He++)if(A[se+He]===E){ve=!0;break}if(ve)continue;let fe=0;for(let He=0;He<256;He++)ee[He]=fe,fe+=A[se+He];for(let He=0;He<E;He++){const Be=x[He],ae=W[He],Ae=(me?ae:Be)>>>le&255,Me=ee[Ae]++;V[Me]=S[He],G[Me]=Be,Q[Me]=ae}let xe=S;S=V,V=xe,xe=x,x=G,G=xe,xe=W,W=Q,Q=xe}return S}function i(P,N,T){if(T<2)return P;const E=new Uint32Array(256*4);for(let G=0;G<T;G++){const Q=N[G];E[Q&255]++,E[256+(Q>>>8&255)]++,E[512+(Q>>>16&255)]++,E[768+(Q>>>24&255)]++}let A=P,S=N,x=new Uint32Array(T),W=new Uint32Array(T);const V=new Uint32Array(256);for(let G=0;G<4;G++){const Q=G<<8,ee=G<<3;let ne=!1;for(let me=0;me<256;me++)if(E[Q+me]===T){ne=!0;break}if(ne)continue;let se=0;for(let me=0;me<256;me++)V[me]=se,se+=E[Q+me];for(let me=0;me<T;me++){const ve=S[me],fe=V[ve>>>ee&255]++;x[fe]=A[me],W[fe]=ve}let le=A;A=x,x=le,le=S,S=W,W=le}return A}function s(P,N,T,E){const A=new Uint32Array(E+1);for(let W=0;W<T;W++)A[N[W]]++;let S=0;for(let W=0;W<=E;W++){const V=A[W];A[W]=S,S+=V}const x=new Uint32Array(T);for(let W=0;W<T;W++)x[A[N[W]]++]=P[W];return x}function n(P,N,T,E){return T<2?P:E<=65536||E<=T*2?s(P,N,T,E):i(P,N,T)}function u(P,N){return P.length===N&&P.byteOffset===0?P:Uint32Array.prototype.slice.call(P,0,N)}function o(P,N,T=!1){const E=N||B(P.length),A=E.length;if(A<2)return Uint32Array.from(E);const S=new Uint32Array(A),x=new Uint32Array(A),W=new Uint32Array(A),V=new Uint32Array(A),G=new Uint32Array(2);let Q=0,ee=0;for(let le=0;le<A;le++){const me=E[le],ve=P[me];if(Number.isNaN(ve)){V[ee++]=me;continue}r(ve,G),T?(x[Q]=~G[0]>>>0,W[Q]=~G[1]>>>0):(x[Q]=G[0],W[Q]=G[1]),S[Q++]=me}const ne=t(S.subarray(0,Q),x.subarray(0,Q),W.subarray(0,Q),Q);if(ee===0)return u(ne,Q);const se=new Uint32Array(A);return se.set(ne.subarray(0,Q),0),se.set(V.subarray(0,ee),Q),se}function a(P,N,T=!1){const E=N||B(P.length),A=E.length;if(A<2)return Uint32Array.from(E);const S=Uint32Array.from(E),x=new Uint32Array(A);for(let W=0;W<A;W++){const V=(P[S[W]]^2147483648)>>>0;x[W]=T?~V>>>0:V}return u(i(S,x,A),A)}function h(P,N,T={}){const E=N||B(F(P,T)),A=E.length;if(A<2)return Uint32Array.from(E);const S=q(P.dict,T.locale),x=P.values,W=K(P),V=Math.max(z(P.dict),S.length),G=V,Q=Uint32Array.from(E),ee=new Uint32Array(A),ne=!!T.descending;for(let se=0;se<A;se++){const le=Q[se];let me=W&&W(le)===0?G:S[x[le]];me===void 0&&(me=G),ee[se]=ne?G-me:me}return u(n(Q,ee,A,V+1),A)}function v(P,N,T){const E=N.length;let A=Uint32Array.from(N);if(E<2)return A;let S=new Uint32Array(E);for(let x=1;x<E;x<<=1){for(let V=0;V<E;V+=x<<1){const G=Math.min(V+x,E),Q=Math.min(V+(x<<1),E);let ee=V,ne=G,se=V;for(;ee<G&&ne<Q;)S[se++]=T(P[A[ee]],P[A[ne]])<=0?A[ee++]:A[ne++];for(;ee<G;)S[se++]=A[ee++];for(;ne<Q;)S[se++]=A[ne++]}const W=A;A=S,S=W}return A}function g(P,N,T){const E=C(P.values),A=N.length,S=new Uint32Array(A),x=T?1:0;let W=0;for(let V=0;V<A;V++)E(N[V])===x&&(S[W++]=N[V]);for(let V=0;V<A;V++)E(N[V])!==x&&(S[W++]=N[V]);return S}function k(P,N){const T=P.values,E=P.kind;if((E==="object"||E===void 0)&&(Array.isArray(T)||ArrayBuffer.isView(T))&&!P.presence)return T;const S=H(P),x=new Array(F(P)||0);for(let W=0;W<N.length;W++){const V=N[W];x[V]=S(V)}return x}function d(P,N){for(let T=0;T<N.length;T++)if(typeof P[N[T]]!="string")return!1;return!0}function p(P,N,T,E,A){const S=P.length,x=Uint32Array.from(P);if(S<2||E<1)return x;const W=new Uint32Array(S),V=E-1;for(let G=0;G<S;G++){const Q=T[N[G]];W[G]=A?V-Q:Q}return u(n(x,W,S,E),S)}function b(P,N,T){const E=X(T),A=new Array(N);for(let x=0;x<N;x++)A[x]=x;A.sort((x,W)=>E(P[x],P[W])||x-W);const S=new Uint32Array(N);for(let x=0;x<N;x++)S[A[x]]=x;return S}function O(P,N,T){const E=N.length,A=new Map,S=[],x=new Uint32Array(E);for(let G=0;G<E;G++){const Q=P[N[G]];let ee=A.get(Q);ee===void 0&&(ee=S.length,A.set(Q,ee),S.push(Q)),x[G]=ee}const W=S.length,V=b(S,W,T.locale);return p(N,x,V,W,!!T.descending)}function y(P,N,T){const E=k(P,N);if(N.length>=2&&d(E,N)){const x=P.stringRank;return x&&x.version===P.version&&x.usable(N,E,T.locale)?x.sort(N,T):O(E,N,T)}const A=X(T.locale),S=T.descending?(x,W)=>A(W,x):A;return v(E,N,S)}function M(P,N,T){const E=k(P,N),A=T.compare,x=!!T.descending?(W,V)=>-A(W,V,void 0,void 0,!0):(W,V)=>A(W,V,void 0,void 0,!1);return v(E,N,x)}function D(P,N){const T=N.length,E=K(P),A=P.values,S=P.kind==="float64"&&!!A,x=P.kind==="object"||P.kind==="multi"||P.kind===void 0;if(!E&&!S&&!x)return{present:N,absent:j};const W=new Uint32Array(T),V=new Uint32Array(T);let G=0,Q=0;if(E&&S)for(let ee=0;ee<T;ee++){const ne=N[ee];E(ne)===1&&!Number.isNaN(A[ne])?W[G++]=ne:V[Q++]=ne}else if(S&&!E)for(let ee=0;ee<T;ee++){const ne=N[ee];Number.isNaN(A[ne])?V[Q++]=ne:W[G++]=ne}else if(E&&!x)for(let ee=0;ee<T;ee++){const ne=N[ee];E(ne)===1?W[G++]=ne:V[Q++]=ne}else{const ee=H(P);for(let ne=0;ne<T;ne++){const se=N[ne];Z(ee(se))?V[Q++]=se:W[G++]=se}}return Q===0?{present:N,absent:j}:{present:W.subarray(0,G),absent:V.subarray(0,Q)}}function _(P,N,T){if(N.length===0)return P;const E=new Uint32Array(P.length+N.length);return T?(E.set(N,0),E.set(P,N.length)):(E.set(P,0),E.set(N,P.length)),E}function I(P,N,T={}){const E=N||B(F(P,T));if(!P||E.length<2)return Uint32Array.from(E);const{present:A,absent:S}=D(P,E);if(A.length===0)return Uint32Array.from(E);const x=!!T.descending;let W;if(typeof T.compare=="function")W=M(P,A,T);else switch(P.kind){case"float64":W=o(P.values,A,x);break;case"int32":W=a(P.values,A,x);break;case"dictionary":W=h(P,A,T);break;case"bitset":W=g(P,A,x);break;default:W=y(P,A,T);break}return _(W,S,!!T.nullsFirst)}function L(P,N,T,E={}){const A=N||[],S=A.length&&(A[0].handle||$(P,A[0].col))||P&&P[0];let x=T||B(F(S,E));for(let W=A.length-1;W>=0;W--){const V=A[W],G=V.handle||$(P,V.col)||P&&P[W];G&&(x=I(G,x,{descending:V.descending!==void 0?!!V.descending:V.dir==="desc",nullsFirst:!!V.nullsFirst,locale:V.locale!==void 0?V.locale:E.locale,compare:V.compare}))}return x instanceof Uint32Array?x:Uint32Array.from(x)}function $(P,N){if(!(!P||N===void 0)){for(let T=0;T<P.length;T++)if(P[T]&&P[T].id===N)return P[T]}}}),Ue("packages/core/src/store/stringrank.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_MAX_DISTINCT",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"StringRankIndex",{enumerable:!0,get:function(){return B}});const te=U("packages/core/src/compute/sort.js"),C=te.collateStringRanks,q=te.rankSortStrings,z=1e5;class B{#e=[];#t=new Map;#n;#r=0;#s=0;#i=-1;#o;#l=!1;#a=null;#c=-1;#u="\0";constructor(K=z){this.#o=K>0?K:z,this.#n=new Uint32Array(0)}get version(){return this.#i}set version(K){this.#i=K}get generation(){return this.#s}get size(){return this.#e.length}get capped(){return this.#l}get length(){return this.#r}get bytes(){let K=this.#n.byteLength;const F=this.#e;for(let X=0;X<F.length;X++)K+=F[X].length*2+24;return K}#d(K,F){const X=this.#t.get(K);if(X!==void 0)return X;if(this.#l)return-1;if(F&&this.#e.length>=this.#o)return this.#l=!0,-1;const H=this.#e.length;return this.#e.push(K),this.#t.set(K,H),this.#s++,H}build(K,F){const X=F|0;this.#e=[],this.#t=new Map,this.#s=0,this.#l=!1,this.#a=null,this.#c=-1,this.#n=new Uint32Array(X);for(let H=0;H<X;H++){const j=K[H],w=typeof j=="string"?this.#d(j,!1):-1;this.#n[H]=w<0?0:w}this.#r=X}append(K,F,X){const H=(F|0)+(X|0);if(H>this.#n.length){const j=new Uint32Array(H);j.set(this.#n.subarray(0,this.#r)),this.#n=j}for(let j=F|0;j<H;j++){const w=K[j],m=typeof w=="string"?this.#d(w,!0):-1;this.#n[j]=m<0?0:m}this.#r=Math.max(this.#r,H)}ranks(K){const F=K||"";if(this.#a&&this.#c===this.#s&&this.#u===F)return this.#a;const X=C(this.#e,this.#e.length,K);return this.#a=X,this.#c=this.#s,this.#u=F,X}usable(K,F,X){if(this.#l||this.#e.length===0)return!1;const H=this.#n,j=this.#e,w=this.#r;for(let m=0;m<K.length;m++){const c=K[m];if(c>=w||j[H[c]]!==F[c])return!1}return!0}sort(K,F){const X=this.ranks(F.locale),H=this.#e.length,j=K.length,w=new Uint32Array(j),m=this.#n;for(let c=0;c<j;c++)w[c]=m[K[c]];return q(K,w,X,H,!!F.descending)}}}),Ue("packages/core/src/store/columnstore.js",function(e,U){"use strict";Object.defineProperty(e,"REMOVED",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"toFloat",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ColumnHandle",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"ColumnStore",{enumerable:!0,get:function(){return g}});const C=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/paths.js").pathGetter,F=U("packages/core/src/store/bitset.js").Bitset,H=U("packages/core/src/store/dictionary.js").Dictionary,w=U("packages/core/src/store/multivalue.js").MultiValue,c=U("packages/core/src/store/stringrank.js").StringRankIndex,f=4294967295,l=1024,r=5e3,t=.2,i=new Set(["float64","int32","bitset","dictionary","object","multi"]);function s(k){return k==null}function n(k){if(typeof k=="number")return k;if(k instanceof Date)return k.getTime();if(typeof k=="boolean")return k?1:0;const d=Number(k);return Number.isNaN(d)&&typeof k=="string"?Date.parse(k):d}function u(k){const d=n(k);return Number.isFinite(d)?d|0:0}function o(k){return s(k)?[]:Array.isArray(k)?k:[k]}function a(k,d){switch(k.kind){case"float64":case"int32":return k.buf[d];case"bitset":return k.bits.get(d)===1;case"dictionary":return k.dict.valueOf(k.buf[d]);case"multi":{const p=k.mv.at(d),b=new Array(p.length);for(let O=0;O<p.length;O++)b[O]=k.dict.valueOf(p[O]);return b}default:return k.buf[d]}}function h(k,d){switch(k.kind){case"float64":case"int32":return k.values[d];case"bitset":return(k.values[d>>3]&1<<(d&7))!==0;case"dictionary":return(k.table||[])[k.values[d]];case"multi":{const p=k.offsets[d],b=k.offsets[d+1],O=k.table||[],y=new Array(b-p);for(let M=p;M<b;M++)y[M-p]=O[k.values[M]];return y}default:return k.values[d]}}class v{#e;#t;#n;#r;#s;#i;#o;#l=!1;#a=null;#c=null;#u=null;#d=null;#f=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#A=null;#w=null;#O=!1;constructor(d,p){this.#e=d.id;const b=i.has(d.kind)?d.kind:"object";d.kind&&!i.has(d.kind)&&C(`store.kind.${d.id}`,`column "${d.id}" declares unknown storage kind "${d.kind}"; falling back to object`),this.#n=b,this.#t=b,this.#r=d.nullable!==!1,this.#o=d.dictionary??null,this.#i=p,this.#s=z(d.read)?d.read:Z(d.field||d.id),this.#h=d.stringRankIndex!=="off",this.#p=typeof d.stringRankMaxDistinct=="number"?d.stringRankMaxDistinct:0,this.#A=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.#O?null:this.#l?this.#t==="bitset"?this.#c.words:this.#t==="multi"?this.#u.values:this.#a:this.#P().values}get presence(){return this.#O||!this.#r?null:this.#l?this.#g:this.#P().presence}get dict(){return this.#O||!this.#l?null:this.#t==="dictionary"||this.#t==="multi"?this.#d:null}get stringRank(){if(this.#O||!this.#h||this.kind!=="object")return null;const d=this.values,p=this.#i.physical();if(!d||p===0)return null;if(this.#f===null){if(typeof d[0]!="string")return null;const b=new c(this.#v());return b.build(d,p),b.version=this.#y,this.#f=b,this.#m=this.#y,b.capped?null:b}return this.#f.length<p&&this.#f.append(d,this.#f.length,p-this.#f.length),this.#f.version=this.#y,this.#m=this.#y,this.#f.capped?null:this.#f}#v(){return this.#p}#T(){this.#f=null,this.#m=-1}get offsets(){return this.#O||!this.#l||this.#t!=="multi"?null:this.#u.offsets}get version(){return this.#y}get bytes(){let d=0;return this.#a&&(d+=this.#a.byteLength??this.#a.length*8),this.#c&&(d+=this.#c.bytes),this.#u&&(d+=this.#u.bytes),this.#g&&(d+=this.#g.bytes),this.#d&&(d+=this.#d.bytes),this.#A&&(d+=this.#A.size*24),d}get(d){if(!this.#O&&!(d<0||d>=this.#i.physical())){if(!this.#l)return this.#M(d);if(this.#r&&this.#g.get(d)===0)return null;switch(this.#t){case"float64":case"int32":return this.#a[d];case"bitset":return this.#c.get(d)===1;case"dictionary":return this.#d.valueOf(this.#a[d]);case"multi":{const p=this.#u.at(d),b=new Array(p.length);for(let O=0;O<p.length;O++)b[O]=this.#d.valueOf(p[O]);return b}default:return this.#a[d]}}}set(d,p){this.#O||(this.#l?this.#E(d,p):this.#A.set(d,p===void 0?null:p),this.#f&&this.#T(),this.#y++)}read(d){return this.#s(d)}appendColumn(d,p,b){if(this.#O||b<=0)return;if(!this.#l){this.#y++;return}const O=this.#s,y=this.#r,M=this.#g;let D=!1;switch(this.#t){case"float64":{const _=this.#a;for(let I=0;I<b;I++){const L=O(d[I]);if(typeof L=="number"){y&&M.set(p+I),_[p+I]=L;continue}const $=L==null;y?M.assign(p+I,!$):$&&(D=!0),_[p+I]=$?NaN:n(L)}break}case"int32":{const _=this.#a;for(let I=0;I<b;I++){const L=O(d[I]),$=L==null;y?M.assign(p+I,!$):$&&(D=!0),_[p+I]=$?0:u(L)}break}case"bitset":{const _=this.#c;for(let I=0;I<b;I++){const L=O(d[I]),$=L==null;y?M.assign(p+I,!$):$&&(D=!0),_.assign(p+I,!$&&!!L)}break}case"dictionary":{const _=this.#a,I=this.#d;for(let L=0;L<b;L++){const $=O(d[L]),P=$==null;y?M.assign(p+L,!P):P&&(D=!0),_[p+L]=P?0:I.codeOf($)}break}case"multi":{const _=this.#u,I=this.#d;for(let L=0;L<b;L++){const $=O(d[L]),P=$==null;y?M.assign(p+L,!P):P&&(D=!0);const N=o($),T=new Array(N.length);for(let E=0;E<N.length;E++)T[E]=I.codeOf(N[E]);_.write(p+L,T)}break}default:{const _=this.#a;for(let I=0;I<b;I++){const L=O(d[I]),$=L==null;y?M.assign(p+I,!$):$&&(D=!0),_[p+I]=$?null:L}break}}D&&C(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#f&&this.#t==="object"&&(this.#f.append(this.#a,p,b),this.#f.version=this.#y+1,this.#m=this.#y+1),this.#y++}appendPacked(d,p,b){if(this.#O||b<=0||!d)return;if(!this.#l){this.#y++;return}const O=this.#g,y=d.presence;if(O)if(y)for(let D=0;D<b;D++)O.assign(p+D,(y[D>>3]&1<<(D&7))!==0);else for(let D=0;D<b;D++)O.set(p+D);const M=d.kind===this.#t;if(M&&(this.#t==="float64"||this.#t==="int32")){this.#a.set(d.values,p),this.#y++;return}if(M&&this.#t==="bitset"){const D=d.values;for(let _=0;_<b;_++)this.#c.assign(p+_,(D[_>>3]&1<<(_&7))!==0);this.#y++;return}if(M&&this.#t==="dictionary"){const D=d.table||[],_=new Uint32Array(D.length);for(let P=0;P<D.length;P++)_[P]=this.#d.codeOf(D[P]);const I=d.values,L=this.#a,$=O;for(let P=0;P<b;P++){if($&&(y&&(y[P>>3]&1<<(P&7))===0)){L[p+P]=0;continue}L[p+P]=_[I[P]]??0}this.#y++;return}if(M&&this.#t==="multi"){const D=d.table||[],_=new Uint32Array(D.length);for(let $=0;$<D.length;$++)_[$]=this.#d.codeOf(D[$]);const I=d.values,L=d.offsets;for(let $=0;$<b;$++){const P=L[$],N=L[$+1],T=new Array(N-P);for(let E=P;E<N;E++)T[E-P]=_[I[E]]??0;this.#u.write(p+$,T)}this.#y++;return}for(let D=0;D<b;D++){const _=y?(y[D>>3]&1<<(D&7))===0:d.kind==="object"?d.values[D]===null:!1;this.#E(p+D,_?null:h(d,D))}this.#y++}touch(){this.#y++}columnarise(d,p){if(this.#l||this.#O)return;const b=new Array(p);for(let O=0;O<p;O++)b[O]=this.#M(O);this.#t=this.#n,this.#l=!0,this.#S(d);for(let O=0;O<p;O++)this.#E(O,b[O]);this.#A.clear(),this.#w=null,this.#T(),this.#y++}grow(d){if(!(!this.#l||this.#O||d<=this.#b)){switch(this.#t){case"float64":case"int32":case"dictionary":{const p=new this.#a.constructor(d);p.set(this.#a),this.#a=p;break}case"bitset":this.#c.grow(d);break;case"multi":break;default:this.#a.length=d;break}this.#g&&this.#g.grow(d),this.#b=d,this.#y++}}convert(d){if(this.#O||!i.has(d)||(this.#n=d,!this.#l||d===this.#t))return!1;const p={kind:this.#t,buf:this.#a,bits:this.#c,mv:this.#u,dict:this.#d},b=this.#i.physical(),O=this.#g;this.#t=d,this.#S(this.#b);for(let y=0;y<b;y++){const M=O!==null&&O.get(y)===0;M&&d!=="multi"||this.#E(y,M?null:a(p,y))}return this.#T(),this.#y++,!0}compact(d,p,b){if(!this.#O){if(this.#T(),!this.#l){const O=this.#A;if(O.size){const y=new Map;for(const[M,D]of O)d[M]!==f&&y.set(d[M],D);this.#A=y}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const O=this.#a;for(let y=0;y<p;y++)d[y]!==f&&(O[d[y]]=O[y]);if(this.#t==="object")for(let y=b;y<p;y++)O[y]=void 0;break}case"bitset":{const O=this.#c;for(let y=0;y<p;y++)d[y]!==f&&O.assign(d[y],O.get(y)===1);for(let y=b;y<p;y++)O.clear(y);break}case"multi":this.#u.compact(d,b,f);break;default:break}if(this.#g){const O=this.#g;for(let y=0;y<p;y++)d[y]!==f&&O.assign(d[y],O.get(y)===1);for(let y=b;y<p;y++)O.clear(y)}this.#y++}}release(){this.#O||(this.#O=!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.#d=null,this.#f=null,this.#A=new Map,this.#w=null,this.#b=0,this.#y++)}#S(d){const p=Math.max(1,d);switch(this.#a=null,this.#c=null,this.#u=null,this.#t){case"float64":this.#a=new Float64Array(p);break;case"int32":this.#a=new Int32Array(p);break;case"bitset":this.#c=new F(p);break;case"dictionary":this.#a=new Uint32Array(p),this.#d=this.#d??new H(this.#o??[]);break;case"multi":this.#u=new w({rows:p,values:p}),this.#d=this.#d??new H(this.#o??[]);break;default:this.#a=new Array(p);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#d=null),this.#r&&(this.#g?this.#g.grow(p):this.#g=new F(p)),this.#b=p}#E(d,p){const b=s(p);switch(this.#r?this.#g.assign(d,!b):b&&C(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#t){case"float64":this.#a[d]=b?NaN:n(p);break;case"int32":this.#a[d]=b?0:u(p);break;case"bitset":this.#c.assign(d,!b&&!!p);break;case"dictionary":this.#a[d]=b?0:this.#d.codeOf(p);break;case"multi":{const O=o(p),y=new Array(O.length);for(let M=0;M<O.length;M++)y[M]=this.#d.codeOf(O[M]);this.#u.write(d,y);break}default:this.#a[d]=b?null:p;break}}#M(d){if(this.#A.has(d))return this.#A.get(d);const p=this.#s(this.#i.rowAt(d));return p===void 0?null:p}#P(){if(this.#w&&this.#w.version===this.#y)return this.#w;const d=this.#i.physical(),p=new Array(d),b=this.#r?new F(d):null;for(let O=0;O<d;O++){const y=this.#M(O);p[O]=y,b&&!s(y)&&b.set(O)}return this.#w={version:this.#y,values:p,presence:b},this.#w}}class g{#e;#t=new Map;#n=[];#r=[];#s=0;#i=0;#o=0;#l=0;#a=new F(0);#c=!1;#u=!0;#d;#f;#h;#p=!1;constructor(d,p={}){this.#e=Array.isArray(d)?d:[],this.#f=Math.max(1,p.initialCapacity??l),this.#u=p.retainSource!==!1,this.#d=this.#u?p.columnarBelow??r:0,this.#h=p.compactRatio??t;const b={rowAt:O=>this.#r[O],physical:()=>this.#s};for(const O of this.#e){if(!O||!O.id)continue;if(this.#t.has(O.id)){C(`store.dup.${O.id}`,`duplicate column id "${O.id}" in the store schema; ignoring the second`);continue}const y=new v(O,b);this.#t.set(O.id,y),this.#n.push(y)}this.#d<=0&&this.#b()}get count(){return this.#o}get physical(){return this.#s}get capacity(){return this.#c?this.#i:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let d=this.#a.bytes+this.#r.length*8;for(const p of this.#n)d+=p.bytes;return d}append(d){const p=this.#s;if(this.#p||!d)return{from:p,to:p};const b=d.length|0;if(b===0)return{from:p,to:p};if(this.#u)for(let y=0;y<b;y++)this.#r[p+y]=d[y];if(this.#s=p+b,this.#o+=b,this.#a.grow(this.#s),!this.#c){if(this.#s>=this.#d)this.#b();else for(const y of this.#n)y.touch();return{from:p,to:this.#s}}this.#m(this.#s);const O=this.#n;for(let y=0;y<O.length;y++)O[y].appendColumn(d,p,b);return{from:p,to:this.#s}}appendPacked(d,p){const b=this.#s;if(this.#p||!d)return{from:b,to:b};const O=d.count|0;if(O===0)return{from:b,to:b};if(this.#u&&p)for(let M=0;M<O;M++)this.#r[b+M]=p[M];this.#s=b+O,this.#o+=O,this.#a.grow(this.#s),this.#c||this.#b(),this.#m(this.#s);const y=new Map;for(const M of d.columns)y.set(M.id,M);for(const M of this.#n){const D=y.get(M.id);D?M.appendPacked(D,b,O):M.grow(this.#i)}return{from:b,to:this.#s}}source(d){if(this.#u)return this.#r[d];if(!(d<0||d>=this.#s))return this.#g(d)}setSource(d,p){this.#p||d<0||d>=this.#s||this.#u&&(this.#r[d]=p)}get(d,p){const b=this.#t.get(d);return b?b.get(p):void 0}set(d,p,b){if(this.#p||p<0||p>=this.#s)return;const O=this.#t.get(d);if(!O){C(`store.set.${d}`,`set() on unknown column "${d}"`);return}O.set(p,b)}remove(d){return this.#p||d<0||d>=this.#s||this.#a.get(d)===1?!1:(this.#a.set(d),this.#l++,this.#o--,!0)}live(d){return d<0||d>=this.#s?!1:this.#a.get(d)===0}compact(d={}){if(this.#p||this.#l===0||!d.force&&this.#l/this.#s<this.#h)return null;const p=this.#s,b=new Uint32Array(p);let O=0;for(let y=0;y<p;y++)b[y]=this.#a.get(y)===1?f:O++;for(const y of this.#n)y.compact(b,p,O);if(this.#u){const y=this.#r;for(let M=0;M<p;M++)b[M]!==f&&(y[b[M]]=y[M]);y.length=O}return this.#s=O,this.#o=O,this.#l=0,this.#a=new F(Math.max(this.#i,O)),b}column(d){return this.#t.get(d)}columns(){return this.#n.slice()}liveIndices(){const d=new Uint32Array(this.#o);if(this.#l===0){for(let b=0;b<this.#s;b++)d[b]=b;return d}let p=0;for(let b=0;b<this.#s;b++)this.#a.get(b)===0&&(d[p++]=b);return d}convert(d,p){const b=this.#t.get(d);return b?b.convert(p):!1}destroy(){if(!this.#p){this.#p=!0;for(const d of this.#n)d.release();this.#t.clear(),this.#n.length=0,this.#r.length=0,this.#a.release(),this.#s=0,this.#o=0,this.#l=0,this.#i=0}}#m(d){if(d<=this.#i)return;let p=this.#i||this.#f;for(;p<d;)p*=2;for(const b of this.#n)b.grow(p);this.#a.grow(p),this.#i=p}#g(d){const p={};for(const b of this.#n)p[b.id]=b.get(d);return p}#b(){if(this.#c)return;let d=this.#f;for(;d<this.#s;)d*=2;this.#c=!0,this.#i=d,this.#a.grow(d);for(const p of this.#n)p.columnarise(d,this.#s)}}}),Ue("packages/core/src/store/pool.js",function(e,U){"use strict";Object.defineProperty(e,"MaskPool",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"sharedPool",{enumerable:!0,get:function(){return B}});const te=64,C=8;function q(K){let F=te;for(;F<K;)F*=2;return F}class z{#e=new Map;#t=new WeakSet;#n;#r=0;#s={acquired:0,reused:0,released:0};constructor(F={}){this.#n=F.limit??C}get bytes(){return this.#r}mask(F){const X=new Uint8Array(this.#i(F),0,F);return X.fill(0),X}indices(F){return new Uint32Array(this.#i(F*4),0,F)}release(F){if(!F||!F.buffer)return!1;const X=F.buffer;if(!this.#t.has(X))return!1;this.#t.delete(X),this.#s.released++;const H=X.byteLength;let j=this.#e.get(H);return j||this.#e.set(H,j=[]),j.length>=this.#n||(j.push(X),this.#r+=H),!0}releaseAll(F){for(const X of F)this.release(X)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#s,retained:this.#r}}#i(F){const X=q(F),H=this.#e.get(X);this.#s.acquired++;let j;return H&&H.length?(j=H.pop(),this.#r-=X,this.#s.reused++):j=new ArrayBuffer(X),this.#t.add(j),j}}function B(){return Z??=new z,Z}let Z=null}),Ue("packages/core/src/compute/sortspec.js",function(e,U){"use strict";Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return B}});function te(Z){return{locale:Z===void 0?void 0:String(Z),numeric:!0,sensitivity:"variant"}}function C(Z){return!!Z&&typeof Z.compare!="function"}function q(Z){if(!Z)return!0;for(let K=0;K<Z.length;K++)if(!C(Z[K]))return!1;return!0}function z(Z,K){const F=Z.col!==void 0?Z.col:Z.handle&&Z.handle.id,X=Z.locale!==void 0?Z.locale:K;return{col:F,descending:Z.descending!==void 0?!!Z.descending:Z.dir==="desc",nullsFirst:!!Z.nullsFirst,collation:te(X)}}function B(Z,K){const F=Z||[],X=new Array(F.length);for(let H=0;H<F.length;H++)X[H]=z(F[H],K);return X}}),Ue("packages/core/src/compute/facet.js",function(e,U){"use strict";Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"orderedReader",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"toNumeric",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return p}});const te=U("packages/core/src/compute/handle.js"),C=te.presenceReader,q=te.valueReader,z=te.dictSize,B=te.dictValue,Z=Object.freeze(["equal","quantile","log"]),K=Object.freeze(["hour","day","week","month","quarter","year"]),F=20,X=50,H=1e4;function j(b,O){if(!b)return"none";const y=O;if(y&&(y.multi===!0||typeof y.items=="function"))return"category";const M=O&&O.base;if(M==="date"||M==="datetime"||M==="time"||M==="dateString")return"date";switch(b.kind){case"bitset":return"boolean";case"float64":case"int32":return"numeric";case"dictionary":return"category";case"multi":return"category";default:return M==="number"?"numeric":M==="boolean"?"boolean":M==="text"?"category":"none"}}function w(b){const O=b.values,y=b.kind;if((y==="float64"||y==="int32")&&O)return D=>O[D];const M=q(b);return D=>m(M(D))}function m(b){if(typeof b=="number")return b;if(b instanceof Date)return b.getTime();if(b==null||b==="")return NaN;if(typeof b=="boolean")return b?1:0;if(typeof b=="string"){const O=Number(b);if(Number.isFinite(O))return O;const y=Date.parse(b);return Number.isFinite(y)?y:NaN}return NaN}function c(b,O,y,M=X){if(!b)return{cardinality:0,exact:!0};if(b.dict)return{cardinality:z(b.dict),exact:!0};if(b.kind==="bitset")return{cardinality:2,exact:!0};const D=q(b),_=O?O.length:y,I=new Set;for(let L=0;L<_;L++){const $=D(O?O[L]:L);if($!=null&&(I.add($),I.size>M))return{cardinality:I.size,exact:!1}}return{cardinality:I.size,exact:!0}}const f=36e5,l=864e5;function r(b,O=F){const y=Number.isFinite(b)&&b>0?b:0,M=Math.max(1,O)*2;return y/f<=M?"hour":y/l<=M?"day":y/(7*l)<=M?"week":y/(30*l)<=M?"month":y/(91*l)<=M?"quarter":"year"}function t(b,O){if(!Number.isFinite(b))return NaN;const y=new Date(b);switch(O){case"hour":return y.setMinutes(0,0,0),y.getTime();case"day":return y.setHours(0,0,0,0),y.getTime();case"week":{y.setHours(0,0,0,0);const M=(y.getDay()+6)%7;return y.setDate(y.getDate()-M),y.getTime()}case"month":return y.setDate(1),y.setHours(0,0,0,0),y.getTime();case"quarter":return y.setMonth(Math.floor(y.getMonth()/3)*3,1),y.setHours(0,0,0,0),y.getTime();default:return y.setMonth(0,1),y.setHours(0,0,0,0),y.getTime()}}function i(b,O){const y=new Date(b);switch(O){case"hour":y.setHours(y.getHours()+1);break;case"day":y.setDate(y.getDate()+1);break;case"week":y.setDate(y.getDate()+7);break;case"month":y.setMonth(y.getMonth()+1);break;case"quarter":y.setMonth(y.getMonth()+3);break;default:y.setFullYear(y.getFullYear()+1);break}return y.getTime()}function s(b,O,y){const M=w(b),D=C(b),_=O?O.length:y;let I=1/0,L=-1/0,$=0,P=0;for(let N=0;N<_;N++){const T=O?O[N]:N;if(D&&!D(T)){$++;continue}const E=M(T);if(!Number.isFinite(E)){$++;continue}E<I&&(I=E),E>L&&(L=E),P++}return{min:I,max:L,nulls:$,finite:P}}function n(b,O,y,M){const D=w(b),_=C(b),I=O?O.length:y,L=I>M?I/M:1,$=[];for(let N=0;N<I;N+=L){const T=O?O[Math.floor(N)]:Math.floor(N);if(_&&!_(T))continue;const E=D(T);Number.isFinite(E)&&$.push(E)}const P=Float64Array.from($);return P.sort(),P}function u(b,O,y,M={}){const D=M.kind||j(b,M.type);return D==="none"||!b?{kind:"none",buckets:[],suppressed:"type"}:D==="boolean"?o(b,O,y):D==="category"?a(b,O,y,M):h(b,O,y,D,M)}function o(b,O,y){const M=C(b);let D=0;if(M){const I=O?O.length:y;for(let L=0;L<I;L++)M(O?O[L]:L)||D++}const _=[{value:!1,label:"false"},{value:!0,label:"true"}];return D>0&&_.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:_}}function a(b,O,y,M){const D=M.cardinalityLimit??X,{cardinality:_}=c(b,O,y,D);if(_>D&&(M.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:_};const I=q(b),L=O?O.length:y,$=new Map;let P=0;for(let S=0;S<L;S++){const x=I(O?O[S]:S);if(x==null||x===""){P++;continue}if(Array.isArray(x)){if(!x.length){P++;continue}for(const W of x)$.set(W,($.get(W)||0)+1);continue}$.set(x,($.get(x)||0)+1)}let N=[...$.entries()];M.order==="alpha"?N.sort((S,x)=>String(S[0]).localeCompare(String(x[0]))):N.sort((S,x)=>x[1]-S[1]);let T=0,E=0;if(N.length>D){E=N.length-D;for(let S=D;S<N.length;S++)T+=N[S][1];N=N.slice(0,D)}const A=N.map(([S])=>({value:S,label:String(S)}));return T>0&&A.push({remainder:!0,label:`Other (${E} values)`}),P>0&&A.push({null:!0,label:"Empty"}),{kind:"category",buckets:A,cardinality:_}}function h(b,O,y,M,D){const{min:_,max:I,nulls:L,finite:$}=s(b,O,y);if(!$)return{kind:M,buckets:L?[{null:!0,label:"Empty"}]:[],empty:!0};const P=Math.max(1,Math.floor(D.buckets||F));let N=[];if(M==="date"){const E=K.includes(D.granularity)?D.granularity:r(I-_,P);let A=t(_,E);for(;A<=I&&N.length<4096;){const S=i(A,E);if(!(S>A))break;N.push({from:A,to:S}),A=S}return{kind:M,buckets:v(N,L),granularity:E}}const T=Z.includes(D.strategy)?D.strategy:"equal";if(T==="quantile"){const E=n(b,O,y,H);if(E.length){const A=[E[0]];for(let S=1;S<P;S++){const x=E[Math.min(E.length-1,Math.floor(S/P*E.length))];x>A[A.length-1]&&A.push(x)}A.push(I);for(let S=0;S<A.length-1;S++)N.push({from:A[S],to:A[S+1]})}}else if(T==="log"&&_>0){const E=Math.log10(_),S=(Math.log10(I)-E)/P||1;for(let x=0;x<P;x++)N.push({from:10**(E+x*S),to:10**(E+(x+1)*S)})}if(!N.length){const E=(I-_)/P||1;for(let A=0;A<P;A++)N.push({from:_+A*E,to:_+(A+1)*E})}return N[N.length-1].to=I,{kind:M,buckets:v(N,L),strategy:T,min:_,max:I}}function v(b,O){return O>0?[...b,{null:!0,label:"Empty"}]:b}function g(b,O,y,M,D){const _=M&&M.buckets||[],I=D&&D.length>=_.length?D.subarray(0,_.length):new Uint32Array(_.length);if(I.fill(0),!b||!_.length)return I;const L=_.length-1,$=!!_[L]&&_[L].null===!0,P=O?O.length:y;if(M.kind==="boolean"){const S=q(b);for(let x=0;x<P;x++){const W=S(O?O[x]:x);if(W==null){$&&I[L]++;continue}I[W?1:0]++}return I}if(M.kind==="category"){const S=new Map;for(let V=0;V<_.length;V++)!_[V].null&&!_[V].remainder&&S.set(_[V].value,V);const x=_.findIndex(V=>V.remainder),W=q(b);for(let V=0;V<P;V++){const G=W(O?O[V]:V);if(G==null||G===""){$&&I[L]++;continue}if(Array.isArray(G)){if(!G.length){$&&I[L]++;continue}for(const ee of G){const ne=S.get(ee);ne!==void 0?I[ne]++:x>=0&&I[x]++}continue}const Q=S.get(G);Q!==void 0?I[Q]++:x>=0&&I[x]++}return I}const N=$?_.length-1:_.length,T=new Float64Array(N+1);for(let S=0;S<N;S++)T[S]=_[S].from;T[N]=N?_[N-1].to:0;const E=w(b),A=C(b);for(let S=0;S<P;S++){const x=O?O[S]:S;if(A&&!A(x)){$&&I[L]++;continue}const W=E(x);if(!Number.isFinite(W)){$&&I[L]++;continue}const V=k(T,N,W);V>=0&&I[V]++}return I}function k(b,O,y){if(!O||y<b[0])return-1;if(y>=b[O])return y===b[O]?O-1:-1;let M=0,D=O-1;for(;M<D;){const _=M+D+1>>>1;y>=b[_]?M=_:D=_-1}return M}function d(b,O,y,M={}){const D=M.bounds||u(b,M.boundsIndices??O,y,M);return{bounds:D,counts:g(b,O,y,D)}}const p=d}),Ue("packages/core/src/compute/pivotmatrix.js",function(e,U){"use strict";Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return t}});const C=U("packages/core/src/compute/handle.js").valueComparator,z=U("packages/core/src/compute/total.js").total,Z=U("packages/core/src/compute/group.js").packKeys,K=U("packages/core/src/compute/pivot.js"),F=K.joinPath,X=K.DEFAULT_PATH_SEPARATOR,H=K.DEFAULT_MAX_COLUMNS,j="";function w(i,s,n={}){const u=n.separator||X,o=i||[],a=s instanceof Uint32Array?s:Uint32Array.from(s||[]),h=a.length;if(o.length===0)return{tuples:[[]],paths:[j],buckets:[a]};const{keyOf:v,readers:g}=Z(o,a,0),k=new Map,d=[],p=[],b=[];for(let I=0;I<h;I++){const L=a[I],$=v(L);let P=k.get($);if(P===void 0){P=d.length,k.set($,P),p.push($);const N=new Array(g.length);for(let T=0;T<g.length;T++)N[T]=g[T](L);d.push(N),b.push([])}b[P].push(L)}const O=C(n.locale),y=d.map((I,L)=>L);y.sort((I,L)=>{const $=d[I],P=d[L];for(let N=0;N<$.length;N++){const T=m($[N],P[N],O);if(T!==0)return T}return I-L});const M=new Array(y.length),D=new Array(y.length),_=new Array(y.length);for(let I=0;I<y.length;I++){const L=y[I];M[I]=d[L],D[I]=F(d[L],u),_[I]=Uint32Array.from(b[L])}return{tuples:M,paths:D,buckets:_}}function m(i,s,n){const u=i==null,o=s==null;return u||o?u&&o?0:u?1:-1:n(i,s)}function c(i,s,n){const u=[];for(let o=0;o<i.length;o++)n.has(i[o])&&u.push(i[o]);return Uint32Array.from(u)}function f(i,s,n,u){return{value:s.length?z(i,s,n,u):null,leaves:s,count:s.length}}function l(i){const s=i&&i.opts||{},n=s.separator||X,u=s.totalContext||{locale:s.locale},o=(i.measures||[]).filter(D=>D&&D.handle),a=i.leaves instanceof Uint32Array?i.leaves:Uint32Array.from(i.leaves||[]),h=w(i.rowHandles||[],a,{...s,separator:n}),v=w(i.columnHandles||[],a,{...s,separator:n}),g=s.maxColumns===void 0?H:s.maxColumns,k=v.paths.length*Math.max(1,o.length),d=new Map;if(g&&k>g)return{rowAxis:h,columnAxis:v,measures:o.map(D=>({colId:D.colId,fn:D.fn})),body:d,rowMargin:d,columnMargin:d,grand:d,columns:k,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${k} columns, above pivot.maxColumns of ${g}. Narrow the pivot columns or raise the limit.`,columns:k,maxColumns:g}};const p=new Map,b=new Map,O=new Map,y=new Map,M=v.buckets.map(D=>new Set(D));for(let D=0;D<v.paths.length;D++){const _=v.buckets[D],I=v.paths[D];for(const L of o)O.set(t(I,L.colId),f(L.handle,_,L.fn,u))}for(let D=0;D<h.paths.length;D++){const _=h.buckets[D],I=h.paths[D];for(const L of o)b.set(t(I,L.colId),f(L.handle,_,L.fn,u));for(let L=0;L<v.paths.length;L++){const $=c(_,v.buckets[L],M[L]);if($.length===0)continue;const P=v.paths[L];for(const N of o)p.set(r(I,P,N.colId),f(N.handle,$,N.fn,u))}}for(const D of o)y.set(D.colId,f(D.handle,a,D.fn,u));return{rowAxis:h,columnAxis:v,measures:o.map(D=>({colId:D.colId,fn:D.fn})),body:p,rowMargin:b,columnMargin:O,grand:y,columns:k,error:null}}function r(i,s,n){return`${i}\0${s}\0${n}`}function t(i,s){return`${i}\0${s}`}}),Ue("packages/core/src/compute/reference.js",function(e,U){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return l}});const C=U("packages/core/src/internal/paths.js").getPath,q=U("packages/core/src/compute/handle.js"),z=q.isMissing,B=q.valueComparator,K=U("packages/core/src/compute/filter.js").testValue,F="",X="\0";function H(i,s){const n=s.includes(".")?C(i,s):i?.[s];return n===void 0?null:n}function j(i,s,n={}){const u=s||[];let o=i.map((a,h)=>h);if(u.length===0)return o;for(let a=u.length-1;a>=0;a--)o=w(i,o,u[a],n);return o}function w(i,s,n,u){const o=n.locale!==void 0?n.locale:u.locale,a=B(o),h=n.descending!==void 0?!!n.descending:n.dir==="desc",v=[],g=[];for(const p of s){const b=H(i[p],n.col);z(b)?g.push(p):v.push(p)}const k=new Map;for(let p=0;p<v.length;p++)k.set(v[p],p);const d=(p,b)=>{const O=H(i[p],n.col),y=H(i[b],n.col);let M;return typeof n.compare=="function"?(M=n.compare(O,y,i[p],i[b],h),h&&(M=-M)):M=h?a(y,O):a(O,y),M!==0?M:k.get(p)-k.get(b)};return v.sort(d),n.nullsFirst?g.concat(v):v.concat(g)}function m(i,s,n={}){const u=[];for(let o=0;o<i.length;o++)c(i[o],s,n,o)&&u.push(o);return u}function c(i,s,n,u){if(!s)return!0;if(Array.isArray(s.conditions)){const o=s.conditions.filter(h=>h!=null);if(o.length===0)return!0;if(s.op==="or")return o.some(h=>c(i,h,n,u));const a=o.every(h=>c(i,h,n,u));return s.op==="not"?!a:a}return s.col===void 0&&typeof n.custom=="function"?!!n.custom(s,i,u):K(H(i,s.col),s,n.locale)}function f(i,s,n,u){const o=n||i.map((g,k)=>k),a=new Map,h=[],v=[];for(const g of o){const k=s.map((b,O)=>{const y=H(i[g],b);return u&&u[O]?u[O](y):y}),d=k.map(b=>b==null?X:String(b)).join(F);let p=a.get(d);p===void 0&&(p=h.length,a.set(d,p),h.push(k),v.push([])),v[p].push(g)}return{keys:h,buckets:v}}function l(i,s,n={}){const u=B(n.locale),o=i.filter(h=>!z(h)),a=o.map(r).filter(h=>h!==null);switch(s){case"count":return i.length;case"countValues":return o.length;case"sum":return a.reduce((h,v)=>h+v,0);case"avg":return o.length===0?null:a.reduce((h,v)=>h+v,0)/o.length;case"min":return o.length===0?null:o.reduce((h,v)=>u(v,h)<0?v:h);case"max":return o.length===0?null:o.reduce((h,v)=>u(v,h)>0?v:h);case"first":return i.length===0?null:t(i[0]);case"last":return i.length===0?null:t(i[i.length-1]);default:return null}}function r(i){if(typeof i=="number")return Number.isNaN(i)?null:i;if(i==null||i===""||typeof i=="boolean")return null;if(i instanceof Date)return i.getTime();const s=Number(i);return Number.isNaN(s)?null:s}function t(i){return i===void 0?null:i}}),Ue("packages/core/src/compute/index.js",function(e,U){"use strict";const te=U("packages/core/src/compute/sort.js");Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return te.sortColumn}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return te.sortMulti}}),Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return te.radixSortFloat64}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return te.radixSortInt32}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return te.rankSortDictionary}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return te.mergeSortComparator}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return te.collateStringRanks}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return te.rankSortStrings}});const C=U("packages/core/src/compute/sortspec.js");Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return C.collationDescriptor}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return C.isPortableSort}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return C.isPortableSortSet}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return C.describeSortEntry}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return C.describeSort}});const q=U("packages/core/src/compute/filter.js");Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return q.evaluateFilters}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return q.evaluateCondition}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return q.compact}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return q.testValue}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return q.compilePredicate}}),Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return q.releaseMask}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return q.pruneColumn}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return q.mentionsColumn}});const z=U("packages/core/src/compute/group.js");Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return z.groupByColumns}}),Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return z.packKeys}});const B=U("packages/core/src/compute/facet.js");Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return B.facet}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return B.computeBounds}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return B.countInto}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return B.bucketOf}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return B.facetKind}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return B.cardinalityOf}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return B.pickGranularity}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return B.floorTo}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return B.advance}}),Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return B.STRATEGIES}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return B.GRANULARITIES}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return B.DEFAULT_BUCKETS}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return B.DEFAULT_CARDINALITY_LIMIT}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return B.QUANTILE_SAMPLE}});const Z=U("packages/core/src/compute/total.js");Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return Z.TOTAL_FNS}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return Z.TOTAL_LABELS}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return Z.totalLabel}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return Z.total}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return Z.collectValues}});const K=U("packages/core/src/compute/pivot.js");Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return K.pivot}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return K.resolvePivotKeys}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return K.pivotKey}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return K.joinPath}}),Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return K.KEY_DELIMITER}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return K.DEFAULT_PATH_SEPARATOR}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return K.DEFAULT_MAX_COLUMNS}});const F=U("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return F.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return F.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return F.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return F.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return F.GRAND_PATH}});const X=U("packages/core/src/compute/reference.js");Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return X.referenceSort}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return X.referenceFilter}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return X.referenceGroup}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return X.referenceTotal}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return X.referencePasses}}),Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return X.referenceValue}});const H=U("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return H.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return H.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return H.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return H.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return H.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return H.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return H.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return H.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return H.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return H.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return H.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return H.isMissing}});const j=U("packages/core/src/compute/sketch.js");Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return j.Welford}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return j.Reservoir}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return j.HyperLogLog}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return j.SpaceSaving}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return j.KLL}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return j.hash32}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j.SKETCH_BOUNDS}});const w=U("packages/core/src/compute/windowed.js");Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return w.Window}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return w.WINDOW_KINDS}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return w.openWindow}});const m=U("packages/core/src/compute/statistics.js");Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return m.MAINTENANCE}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return m.APPROXIMATE}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return m.maintenanceOf}});const c=U("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return c.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return c.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return c.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return c.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return c.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return c.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return c.anomalyCondition}});const f=U("packages/core/src/compute/forecast.js");Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return f.FORECAST_METHODS}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return f.forecast}})}),Ue("packages/core/src/source/rows.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_ROW_HEIGHT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"KEY_SEP",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"groupPrefixKeys",{enumerable:!0,get:function(){return f}});const C=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/internal/predicates.js").isFunction,B=32,Z="\0";function K(l){return new F(l)}class F{#e;#t;constructor(r){this.#e=z(r&&r.rowKey)?r.rowKey:null;const t=r&&r.config?r.config.rowHeight:void 0;this.#t=typeof t=="number"||z(t)?t:B}get keyed(){return this.#e!==null}keyOf(r,t){if(this.#e){const i=this.#e(r);if(i!=null)return String(i)}else C("source.rowKey.missing","no config.rowKey; falling back to index identity.","Row changes, streaming dedupe, selection persistence and remote reload are disabled.");return`#${t}`}heightOf(r){return z(this.#t)?Number(this.#t(r))||B:this.#t}leaf(r,t,i=0,s=null){const n={key:this.keyOf(r,t),data:r,level:i,parent:s,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:t};return n.height=this.heightOf(n),n}group(r){const t={key:c(r.keyPath||r.path),data:null,level:r.level,parent:r.parent||null,children:[],group:!0,expanded:r.expanded!==!1,leafCount:r.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:r.column,groupValue:r.value,groupPath:r.path,hasChildren:r.hasChildren!==!1};return r.totals&&(t.totals=r.totals),t.height=this.heightOf(t),t}footer(r){const t={key:`${r.key}${Z}footer`,data:null,level:r.level,parent:r,group:!0,footer:!0,expanded:!1,leafCount:r.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:r.groupColumn,groupValue:r.groupValue,groupPath:r.groupPath,hasChildren:!1,totals:r.totals};return t.height=this.heightOf(t),t}detail(r,t){return{key:`${r.key}${Z}detail`,data:r.data,level:r.level+1,parent:r,group:!1,detail:!0,expanded:!1,leafCount:0,height:t,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:r.key}}grandTotal(r,t){const i={key:`${Z}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:t,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:r};return i.height=this.heightOf(i),i}skeleton(r,t=0,i=!1){const s={key:`${Z}pending${Z}${r}`,data:null,level:t,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:r,selected:!1,physical:null,pending:!0};return i&&(s.loadError=!0),s.height=this.heightOf(s),s}}function X(l,r,t,i){return{key:`${Z}pinned${Z}${t}${Z}${r}`,data:l,level:0,parent:null,group:!1,expanded:!1,leafCount:0,height:i,index:null,selected:!1,physical:null,hasChildren:!1,pinned:t}}function H(l,r){return new Proxy([],{get(t,i,s){if(i==="length")return l();if(typeof i=="string"){const n=Number(i);if(Number.isInteger(n)&&n>=0)return r(n)}return Reflect.get(t,i,s)},has(t,i){if(typeof i=="string"){const s=Number(i);if(Number.isInteger(s)&&s>=0)return s<l()}return Reflect.has(t,i)}})}function j(l){return l==null?"":String(l)}const w="";function m(l){if(l==null)return w;const r=String(l);return r.startsWith(w)?w+r:r}function c(l){const r=l||[];let t="g";for(let i=0;i<r.length;i++)t+=Z+m(r[i]);return t}function f(l){const r=new Array(l.length),t=[];for(let i=0;i<l.length;i++)t.push(l[i]),r[i]=c(t);return r}}),Ue("packages/core/src/source/handles.js",function(e,U){"use strict";Object.defineProperty(e,"HandleProvider",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"createHandleProvider",{enumerable:!0,get:function(){return Z}});const C=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce;class B{#e;#t;#n;#r=new Map;#s=0;constructor(F,X,H){this.#e=F,this.#t=X,this.#n=C(H)?H:()=>!1}get store(){const F=this.#e.store;return F&&C(F.column)?F:null}invalidate(){this.#s++}handle(F){const X=this.store;if(X){const m=X.column(F);if(m)return m}const H=this.#r.get(F);if(H&&H.builtAt===this.#s)return H.handle;const j=this.#i(F);if(!j)return;if(X&&this.#n()){z(`source.dropped.${F}`,`column "${F}" 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 w=this.#o(j);return this.#r.set(F,{handle:w,builtAt:this.#s}),w}#i(F){const X=this.#e.columns;return X&&C(X.get)?X.get(F):void 0}#o(F){const X=this.#t()||[],H=X.length,j=new Array(H),w=C(F.getValue)?c=>F.getValue(c):c=>c?.[F.field||F.id];for(let c=0;c<H;c++)j[c]=X[c]===void 0?void 0:w(X[c]);const m=this.#s;return{id:F.id,kind:"object",nullable:!1,values:j,presence:null,dict:null,offsets:null,get(c){return j[c]},version:m}}}function Z(K,F,X){return new B(K,F,X)}}),Ue("packages/core/src/compute/incremental.js",function(e,U){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return X}});const C=U("packages/core/src/store/columnstore.js").toFloat,q=Object.freeze(["sum","avg","countValues","min","max"]),z=Object.freeze(["float64"]),B=1e15;function Z(H,j){return typeof H!="string"||!q.includes(H)?!1:!!j&&z.includes(j.kind)}function K(H){if(H==null)return null;const j=C(H);return Number.isNaN(j)?null:j}class F{#e;#t=0;#n=0;#r=0;#s=1/0;#i=-1/0;#o=!1;#l=!1;constructor(j){this.#e=j}get valid(){return this.#o&&!this.#l}get fn(){return this.#e}seed(j){this.#a();for(let w=0;w<j.length;w++){const m=K(j[w]);m!==null&&this.#c(m)}this.#o=!0}seedColumn(j,w,m){this.#a();for(let c=0;c<m.length;c++){const f=m[c];if(w&&w(f)===0)continue;const l=j[f];Number.isNaN(l)||this.#c(l)}this.#o=!0}#a(){this.#t=0,this.#n=0,this.#r=0,this.#s=1/0,this.#i=-1/0,this.#l=!1}#c(j){if(!Number.isFinite(j)){this.#l=!0;return}const w=this.#t+j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-w+j:j-w+this.#t,this.#t=w,this.#r++,j<this.#s&&(this.#s=j),j>this.#i&&(this.#i=j)}#u(j){const w=this.#t-j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-w-j:-j-w+this.#t,this.#t=w,this.#r--}update(j,w){if(!this.#o)return!1;const m=K(j),c=K(w);return m===null&&c===null?!0:m!==null&&!Number.isFinite(m)||c!==null&&!Number.isFinite(c)?!1:this.#e==="min"||this.#e==="max"?m===null||c===null?!1:this.#e==="min"?c<this.#s?(this.#s=c,!0):m>this.#s:c>this.#i?(this.#i=c,!0):m<this.#i:Math.abs(this.#t)>B?!1:(m!==null&&this.#u(m),c!==null&&this.#c(c),!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.#s:null;case"max":return this.#r?this.#i:null;default:return this.#t+this.#n}}invalidate(){this.#o=!1}}const X=F}),Ue("packages/core/src/source/filterwire.js",function(e,U){"use strict";Object.defineProperty(e,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"resolveRelativeRange",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"relativeTokenOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"relativeTokenHelp",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"isResolvableRelative",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"resolveRelativeCondition",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"forEachCondition",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"mapConditions",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"normaliseFilterSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"buildFilterSet",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"wireFilters",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"querySignature",{enumerable:!0,get:function(){return O}});const C=U("packages/core/src/internal/warn.js").warnOnce,q="source.remote.hostFilter",z="source.where.pageRelative";function B(D,_){!Array.isArray(D)||!D.length||C(z,`filters.where (${D.join(", ")}) runs over the rows the ${_} 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 Z(D){const _=(D||{}).config;!_||!_.hostFilter||C(q,"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 K="source.where.notApplied";function F(D,_){C(`${K}:${D}`,`filters.where("${D}") is registered but the ${_} 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 X="source.where.overThreshold";function H(D,_,I,L){!Array.isArray(D)||!D.length||C(`${X}:${_}`,`filters.where (${D.join(", ")}) is not applied to the ${_} pushdown source:`,I===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${I.toLocaleString()} rows, at or past the whereRowLimit of ${L.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 j=new Map;function w(D){let _=j.get(D);return _||(_=new Intl.DateTimeFormat("en-US",{timeZone:D,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),j.set(D,_)),_}function m(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function c(D,_){const I=w(_).formatToParts(new Date(D)),L={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const $ of I)$.type==="year"?L.y=+$.value:$.type==="month"?L.m=+$.value:$.type==="day"?L.d=+$.value:$.type==="hour"?L.h=+$.value%24:$.type==="minute"?L.mi=+$.value:$.type==="second"&&(L.s=+$.value);return L}function f(D,_){const I=c(D,_);return Date.UTC(I.y,I.m-1,I.d,I.h,I.mi,I.s)-Math.floor(D/1e3)*1e3}function l(D,_,I,L){const $=Date.UTC(D,_-1,I),P=$-f($,L);return $-f(P,L)}function r(D,_,I){const L=new Date(Date.UTC(D.y,D.m-1,D.d+_));return l(L.getUTCFullYear(),L.getUTCMonth()+1,L.getUTCDate(),I)}const t=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function i(D,_){if(typeof D!="string")return null;const I=D.trim().toLowerCase().replace(/[\s_-]+/g,""),L=/^last(\d*|n)days?$/.exec(I);if(L){const $=L[1]==="n"?"":L[1],P=Number($||_);return!Number.isFinite(P)||P<=0?null:{kind:"lastNDays",n:Math.floor(P)}}switch(I){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 s(D,_={}){const I=i(D,_.n);if(!I)return null;const L=_.tz||m(),$=_.now instanceof Date?_.now.getTime():typeof _.now=="number"?_.now:Date.now(),P=c($,L),N=l(P.y,P.m,P.d,L),T=r(P,1,L);let E=N,A=T;switch(I.kind){case"today":break;case"yesterday":E=r(P,-1,L),A=N;break;case"lastNDays":A=_.includeToday?T:N,E=r(P,_.includeToday?-(I.n-1):-I.n,L);break;case"thisWeek":{const S=Number.isFinite(_.weekStartsOn)?Number(_.weekStartsOn):1,W=(new Date(Date.UTC(P.y,P.m-1,P.d)).getUTCDay()-S+7)%7;E=r(P,-W,L),A=r(P,-W+7,L);break}case"thisMonth":E=l(P.y,P.m,1,L),A=l(P.m===12?P.y+1:P.y,P.m===12?1:P.m+1,1,L);break;case"thisQuarter":case"quarterToDate":{const S=Math.floor((P.m-1)/3)*3+1;E=l(P.y,S,1,L),A=I.kind==="quarterToDate"?T:S===10?l(P.y+1,1,1,L):l(P.y,S+3,1,L);break}case"thisYear":case"yearToDate":E=l(P.y,1,1,L),A=I.kind==="yearToDate"?T:l(P.y+1,1,1,L);break;default:return null}return{from:new Date(E).toISOString(),to:new Date(A).toISOString(),bounds:"[)",tz:L,relative:I.kind==="lastNDays"?`last${I.n}Days`:I.kind,n:I.n}}function n(D){if(!D||typeof D!="object")return null;const _=D.value;if(_&&typeof _=="object"&&!Array.isArray(_)&&"relative"in _)return{token:String(_.relative),n:typeof _.n=="number"?_.n:void 0};if(D.op==="relative"&&typeof D.value=="string")return{token:D.value,n:void 0};const I=D.meta;return I&&typeof I.relative=="string"&&D.value===void 0?{token:I.relative,n:typeof I.n=="number"?I.n:void 0}:null}function u(){return`Known tokens: ${t.filter(_=>_!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function o(D){const _=n(D);return _?i(_.token,_.n)!==null:!1}function a(D,_={}){const I=n(D);if(!I)return D;const L=s(I.token,{..._,n:I.n});return L?{...D,type:D.type||"date",op:"between",value:[L.from,L.to],bounds:D.bounds||L.bounds,meta:{...D.meta||{},relative:L.relative,tz:L.tz}}:(C(`source.relative.${I.token}`,`unknown relative date token "${I.token}"; sending the condition unresolved.`,u()),D)}function h(D){return!!D&&typeof D=="object"&&Array.isArray(D.conditions)}function v(D,_){if(D){if(h(D)){for(const I of D.conditions)v(I,_);return}_(D)}}function g(D,_){if(!D)return null;if(!h(D))return _(D);const I=D;let L=!1;const $=[];for(const P of I.conditions){const N=g(P,_);N!==P&&(L=!0),N&&$.push(N)}return!L&&$.length===I.conditions.length?D:$.length?{...I,conditions:$}:null}function k(D){if(!D)return null;if(!h(D))return D;const _=D,I=[];for(const L of _.conditions){const $=k(L);$&&I.push($)}return I.length?{op:_.op,conditions:I}:null}function d(D){const _=k(D);return _?h(_)&&_.op==="and"?_:{op:"and",conditions:[_]}:null}function p(D){const _=(D||[]).filter(Boolean);return _.length?{op:"and",conditions:_}:null}function b(D,_={}){const I=g(D,L=>a(L,_));return d(I)}function O(D){const _=y(D.filters??null);return JSON.stringify([_,D.sort??null,D.quick??"",D.groupBy??null,D.pivotBy??null,M(D.context)])}function y(D){if(!D)return null;if(h(D)){const L=D;return{op:L.op,conditions:L.conditions.map(y)}}const _=D,I=_.meta&&typeof _.meta.relative=="string"?_.meta.relative:n(_)?.token;return{col:_.col,op:_.op,bounds:_.bounds??null,caseSensitive:_.caseSensitive??!1,value:I?`rel:${I}`:_.value??null}}function M(D){if(D==null)return null;try{return JSON.parse(JSON.stringify(D))}catch{return C("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),Ue("packages/core/src/source/tree.js",function(e,U){"use strict";Object.defineProperty(e,"SYNTHETIC",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"buildFromPath",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"assignLevels",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resolveTree",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"buildTree",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"indexTree",{enumerable:!0,get:function(){return c}});const C=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce,B="",Z="\0tree:";function K(f,l){return{physical:f,key:l,level:0,children:[],value:void 0}}function F(f,l){const r=[],t=new Map;for(let i=0;i<f.length;i++){const s=f[i],n=l.pathOf(s),u=Array.isArray(n)?n.map(a=>String(a)):[];if(!u.length){const a=K(s,l.keyOf(s));r.push(a);continue}let o=null;for(let a=0;a<u.length;a++){const h=u.slice(0,a+1).join(B),v=a===u.length-1;let g=t.get(h);g&&v&&g.physical===-1&&(g.physical=s,g.key=l.keyOf(s)),g||(g=K(v?s:-1,v?l.keyOf(s):Z+h),g.level=a,g.value=u[a],t.set(h,g),o?o.children.push(g):r.push(g)),o=g}}return{roots:r,nodes:t}}function X(f,l){const r=new Map,t=[];for(let u=0;u<f.length;u++){const o=f[u],a=l.keyOf(o),h=K(o,a);r.set(a,h);const v=l.parentOf(o);v!=null&&v!==""&&t.push({node:h,parent:String(v)})}let i=null;const s=new Map;for(const{node:u,parent:o}of t){const a=r.get(o);if(a){s.set(u.key,a);continue}l.orphans&&l.orphans!=="root"&&(i||(i=K(-1,`${Z}orphans`),i.value=l.orphans),s.set(u.key,i))}const n=[];for(const u of r.values()){const o=s.get(u.key);o?o.children.push(u):n.push(u)}return i&&i.children.length&&n.push(i),{roots:H(n,r,l.orphans,i),nodes:r}}function H(f,l,r,t){const i=new Set,s=[...f];for(;s.length;){const h=s.pop();if(!i.has(h.key)){i.add(h.key);for(const v of h.children)s.push(v)}}const n=[];for(const h of l.values())i.has(h.key)||n.push(h);if(!n.length)return f;const u=!!r&&r!=="root";z("tree.cycle",`tree.parentKey produced ${n.length} row(s) inside a parent cycle; `+(u?`they are shown under "${r}".`:"they are shown at the root."));for(const h of n)h.children=h.children.filter(v=>i.has(v.key));if(!u)return[...f,...n];let o=t;const a=[...f];return o||(o=K(-1,`${Z}orphans`),o.value=r,a.push(o)),o.children.push(...n),a}function j(f){let l=0;const r=(t,i)=>{for(const s of t)s.level=i,i>l&&(l=i),s.children.length&&r(s.children,i+1)};return r(f,0),l}function w(f,l){if(!f||typeof f!="object")return null;const r=f.path,t=f.parentKey,i=C(f.hasChildren)?s=>!!f.hasChildren(l.dataAt(s)):null;if(C(r))return{mode:"path",pathOf:s=>r(l.dataAt(s)),keyOf:l.keyOf,declaresChildren:i};if(t!=null){const s=C(t)?t:n=>n?.[t];return{mode:"parentKey",parentOf:n=>s(l.dataAt(n)),keyOf:l.keyOf,orphans:f.orphans||"root",declaresChildren:i}}return z("tree.shape","tree is configured with neither `path` nor `parentKey`; rows stay flat."),null}function m(f,l){const r=l.mode==="path"?F(f,l):X(f,l),t=j(r.roots);return{...r,depth:t}}function c(f,l){const r=new Map,t=i=>{for(let s=0;s<i.length;s++){const n=i[s];if(n.physical>=0){const u=l?l(n.physical):!1,o=u&&n.children.length===0;r.set(n.physical,{level:n.level,posinset:s+1,setsize:i.length,hasChildren:n.children.length>0||u,lazy:o})}n.children.length&&t(n.children)}};return t(f),r}}),Ue("packages/core/src/source/settle.js",function(e,U){"use strict";Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return C}});const te=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function C(q){const z=q&&typeof q=="object"?q.reason:null;return typeof z=="string"&&te.includes(z)}}),Ue("packages/core/src/source/memory.js",function(e,U){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"quickMatcher",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"MemorySource",{enumerable:!0,get:function(){return W}});const C=U("packages/core/src/internal/lru.js").Lru,q=U("packages/core/src/internal/warn.js"),z=q.warnOnce,B=q.fail,K=U("packages/core/src/internal/predicates.js").isFunction,X=U("packages/core/src/internal/compare.js").defaultCompare,j=U("packages/core/src/internal/merge.js").mergeRow,w=U("packages/core/src/source/rows.js"),m=w.createRowFactory,c=w.groupKey,f=w.groupPathElement,l=w.groupPrefixKeys,r=w.lazyRowView,i=U("packages/core/src/source/handles.js").createHandleProvider,s=U("packages/core/src/compute/incremental.js"),n=s.RunningTotal,u=s.isIncremental,a=U("packages/core/src/compute/handle.js").presenceReader,h=U("packages/core/src/source/filterwire.js"),v=h.querySignature,g=h.mapConditions,k=h.resolveRelativeCondition,d=U("packages/core/src/source/tree.js"),p=d.buildTree,b=d.resolveTree,O=d.indexTree,y=U("packages/core/src/source/settle.js"),M=y.PIPELINE_SETTLE_REASONS,D=y.isPipelineSettle,_=Object.freeze(["filter","sort","group","total","pivot","flatten"]),I=Object.freeze([]);function L(V,G){if(!V)return null;const Q=G==="grand"?V.grandTotal:V.groupTotal;return Q??V.total}function $(V){return!!V&&!V.running}function P(V){if(V)return V.value&&K(V.value.compare)?V.value.compare:K(V.compare)?V.compare:void 0}function N(V){const G=V&&V.dataType;return!G||!K(G.items)?null:{items:G.items,type:V.itemType&&V.itemType.name||"text"}}function T(V){return!!V&&(typeof V=="object"||typeof V=="function")&&K(V.then)}const E=new Uint32Array(0),A=4096;function S(V,G){return new W(V,G)}function x(V,G){if(G==="regex")try{const Q=new RegExp(V,"iu");return ee=>Q.test(ee)}catch{return Q=>Q.includes(V)}if(G==="fuzzy"){const Q=[...V].filter(ee=>ee!==" ");return Q.length?ee=>{let ne=0;for(let se=0;se<ee.length&&ne<Q.length;se++)ee[se]===Q[ne]&&ne++;return ne===Q.length}:()=>!0}if(G==="words"){const Q=V.split(/\s+/).filter(Boolean);return Q.length?ee=>Q.every(ne=>ee.includes(ne)):()=>!0}return Q=>Q.includes(V)}class W{mode="memory";#e;#t;#n;#r=!1;#s=null;#i;#o;#l=new Map;#a=!1;#c=0;#u=0;#d=new Map;#f=new Map;#h;#p=null;#m=W.#g();static#g(){return{slots:[],groupHeadings:I,unnumbered:I,pivot:null,inlineLeaves:null,matchCount:0,grand:null,grandLeaves:0,groupLeaves:null}}#b=new Map;#y=null;#A=new Map;#w=-1;#O=[];#v=new Map;#T=-1;#S=[];#E=null;#M=null;#P=null;#N=null;#R=null;#$=null;#V=null;#W=null;#D=Symbol("unset");#x=new Map;#Y=null;get#I(){return this.#m.slots}set#I(G){this.#m.slots=G}get#K(){return this.#m.inlineLeaves}set#K(G){this.#m.inlineLeaves=G}get#U(){return this.#m.groupHeadings}set#U(G){this.#m.groupHeadings=G}get#B(){return this.#m.unnumbered}set#B(G){this.#m.unnumbered=G}get#ce(){return this.#m.pivot}set#ce(G){this.#m.pivot=G}constructor(G,Q){this.#t=G||{mode:"memory"},this.#e=Q||{};const ee=this.#e.config||{};this.#n=this.#t.rows||ee.rows||[],this.#i=m(this.#e),this.#o=i(this.#e,()=>this.#n,()=>this.#r),this.#h=new C(Number(ee.rowCacheSize)||A);for(const ne of _)this.#l.set(ne,{key:null,result:null,id:0,computed:!1})}count(){this.#F();const G=this.#fe();return G?G.length:this.#I.length}#fe(){const G=Number(this.#H("pageSize",0))||0;if(G<=0)return null;const Q=this.#I.length,ee=Math.max(1,Math.ceil(Q/G)),se=Math.min(Math.max(0,Number(this.#H("page",0))||0),ee-1)*G;return{offset:se,length:Math.max(0,Math.min(G,Q-se))}}pageInfo(){this.#F();const G=Number(this.#H("pageSize",0))||0,Q=this.#I.length;if(G<=0)return{page:0,pageSize:0,total:Q,pageCount:1};const ee=Math.max(1,Math.ceil(Q/G));return{page:Math.min(Math.max(0,Number(this.#H("page",0))||0),ee-1),pageSize:G,total:Q,pageCount:ee}}totalCount(){return this.#Ve().length}matchCount(){return this.#F(),this.#m.matchCount}at(G){this.#F();const Q=this.#fe();if(Q)return G<0||G>=Q.length?void 0:this.#Se(Q.offset+G,G);if(!(G<0||G>=this.#I.length))return this.#Se(G,G)}byKey(G){this.#F(),this.#p||this.#Ce();const Q=this.#p.get(G);if(Q!==void 0)return this.#te(Q);for(let ee=0;ee<this.#I.length;ee++){const ne=this.#I[ee];if(typeof ne!="number"&&ne&&ne.key===G)return this.#Se(ee)}}loaded(G){return G>=0&&G<this.count()}hint(G,Q){}display(){return this.#F(),this.#Y||(this.#Y=this.#lt()),this.#Y}invalidateQuickText(){this.#x.clear(),this.invalidate("filter")}invalidate(G){const Q=_.indexOf(G);Q<0&&B(`unknown pipeline stage "${G}"; expected one of ${_.join(", ")}`);for(let ee=Q;ee<_.length;ee++){const ne=this.#l.get(_[ee]);ne.key=null,ne.computed=!1}this.#Y=null}apply(G){const Q=[],ee={added:[],updated:[],removed:[],rejected:Q};if(!G)return ee;let ne=!1;const se=new Set;if(G.remove&&G.remove.length)for(const le of G.remove){const me=this.#Pe(le);if(me===void 0){Q.push({operation:"remove",id:this.#be(le),reason:"unknown-id"});continue}ee.removed.push(this.#i.keyOf(this.#r?this.#we(me):this.#n[me],me)),this.#r||(this.#n[me]=void 0),this.#h.delete(me),this.#x.delete(me),ne=!0}if(G.update&&G.update.length){const le=this.#A.size||this.#Ge()?this.#et():null,me=this.#v.size?this.#at():null,ve=me&&me.length?this.#et():null;for(const fe of G.update){const xe=this.#Pe(fe);if(xe===void 0){Q.push({operation:"update",id:this.#je(fe),reason:"unknown-id"});continue}const He=this.#r?this.#s&&this.#s.has(xe)?this.#s.get(xe):this.#we(xe):this.#n[xe],Be=j(He,fe);for(const ae of this.#re(He,Be))se.add(ae);if(this.#r||(this.#n[xe]=Be),le&&this.#Et(le,xe,He,Be),ve&&this.#ht(me,ve,xe,He,Be),this.#p){const ae=this.#i.keyOf(He,xe),Ae=this.#i.keyOf(Be,xe);ae!==Ae&&(this.#p.delete(ae),this.#p.set(Ae,xe))}this.#h.delete(xe),this.#x.delete(xe),ee.updated.push(this.#te(xe))}}if(G.add&&G.add.length&&this.#r){typeof G.at=="number"&&G.at<this.#Te()&&(this.#h.clear(),this.#x.clear()),this.#p=null;for(const le of G.add){const me=this.#ne(this.#je(le));me!==void 0&&ee.added.push(this.#te(me))}ne=!0}else if(G.add&&G.add.length){const le=typeof G.at=="number"?G.at:this.#n.length,me=this.#n.length;let ve=G.add===this.#n?G.add.slice():G.add;if(this.#i.keyed){const fe=[];for(const xe of ve){const He=this.#je(xe);if(this.#Pe(He)!==void 0){Q.push({operation:"add",id:He,reason:"duplicate-id"});continue}fe.push(xe)}fe.length!==ve.length&&(ve=fe)}if(!ve.length)return ee;if(le>=me)for(let fe=0;fe<ve.length;fe++)this.#n.push(ve[fe]);else this.#n.splice(le,0,...ve),this.#h.clear(),this.#x.clear();for(let fe=0;fe<ve.length;fe++)ee.added.push(this.#te(le>=me?me+fe:le+fe));ne=!0}return this.#c++,ne&&(this.#p=null,this.#Ze()),this.#o.invalidate(),this.#Y=null,ne||this.#q(se)?(this.#u++,this.invalidate("filter")):this.invalidate("total"),this.#Ye("rows:changed",{companion:!0,added:ee.added.length,updated:ee.updated.length,removed:ee.removed.length}),this.#s=null,ee}groupHeadingsAt(G){this.#F();const Q=this.#U;if(!Q.length||!Number.isInteger(G)||G<0)return I;let ee=0,ne=Q.length-1,se=-1;for(;ee<=ne;){const me=ee+ne>>1;Q[me].at<=G?(se=me,ee=me+1):ne=me-1}if(se<0)return I;const le=[];for(let me=Q[se].row;me;me=me.parent)le.push(me);return le.reverse(),le}unnumberedRowCount(G){this.#F();const Q=this.#B;if(!Q.length||!Number.isInteger(G)||G<0)return 0;let ee=0,ne=Q.length-1,se=-1;for(;ee<=ne;){const le=ee+ne>>1;Q[le].at<=G?(se=le,ee=le+1):ne=le-1}return se+1}moveRow(G,Q){if(this.#r)return z("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(G)||!Number.isInteger(Q)||G<0||G>=ee.length)return!1;const ne=Math.max(0,Math.min(ee.length-1,Q));if(ne===G)return!1;const[se]=ee.splice(G,1);return ee.splice(ne,0,se),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#x.clear(),this.#Ze(),this.#o.invalidate(),this.#Y=null,this.invalidate("filter"),this.#Ye("rows:changed",{companion:!0,added:0,updated:0,removed:0,moved:1}),!0}reload(G){this.#ie(),this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#Ze(),this.#o.invalidate(),this.invalidate("filter"),this.#Ye("model:changed",{reason:"reload"})}destroy(){this.#ie(),this.#h.clear(),this.#x.clear(),this.#p=null,this.#I=[],this.#K=null,this.#Y=null,this.#Ze();for(const G of _)this.#l.set(G,{key:null,result:null,id:0,computed:!1})}#ie(){for(const{controller:G}of this.#b.values())try{G.abort()}catch{}this.#b.clear()}setRows(G){this.#n=G||[],this.#r=!1,this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#Ze(),this.#o.invalidate(),this.invalidate("filter")}notePriorRows(G){this.#s=G||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#x.clear(),this.#o.invalidate()}data(){if(!this.#r)return this.#n;const G=this.#e.store;if(!G||!K(G.source))return this.#n;const Q=G.physical||0,ee=new Array(Q);for(let ne=0;ne<Q;ne++)ee[ne]=G.live&&!G.live(ne)?void 0:G.source(ne);return ee}#Fe(){const G=this.#H("detail",null);return!G||!K(G.isOpen)||G.inline===!1?null:G}#Oe(){const G=(this.#e.config||{}).tree;return this.#D!==G&&(this.#D=G,this.#W=b(G,{dataAt:Q=>this.#we(Q),keyOf:Q=>this.#i.keyOf(this.#we(Q),Q)})),this.#W}#ge(){return(this.#e.config||{}).grandTotalRow==="bottom"}grandTotalRow(){if(!this.#ge())return null;this.#F();const G=this.#m.grand;return G?this.#i.grandTotal(G,this.#rt(this.#m.grandLeaves)):null}pivot(){return this.#F(),this.#ce}pivotMatrix(){this.#F();const G=this.#m.groupLeaves,Q=(this.#e.compute||{}).pivotMatrix;if(!K(Q))return null;const ee=this.#H("groupBy",[]),ne=this.#H("pivotBy",[]);if(!ee.length&&!ne.length)return z("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.#et().map(me=>({colId:me.id,handle:this.#o.handle(me.id),fn:L(me,"group")})).filter(me=>me.handle&&me.fn),le=this.#e.config||{};return Q({rowHandles:ee.map(me=>this.#o.handle(me)).filter(Boolean),columnHandles:ne.map(me=>this.#o.handle(me)).filter(Boolean),measures:se,leaves:G||new Uint32Array(0),opts:{locale:le.locale,separator:(le.pivot||{}).separator,maxColumns:(le.pivot||{}).maxColumns}})}keysForLeaves(G){const Q=[];if(!G)return Q;for(let ee=0;ee<G.length;ee++){const ne=this.#te(G[ee]);ne&&ne.key!=null&&Q.push(String(ne.key))}return Q}leavesOf(G){this.#F();const Q=this.#l.get("group"),ee=Q&&Q.result;if(!ee||!ee.nodes)return[];const ne=ee.nodes.get(G);if(!ne)return[];const se=[],le=me=>{const ve=me.row&&me.row.children;if(ve&&ve.length){for(const fe of ve){const xe=ee.nodes.get(fe.key);xe&&le(xe)}return}if(me.leaves)for(let fe=0;fe<me.leaves.length;fe++)se.push(this.#te(me.leaves[fe]))};return le(ne),se}#be(G){return typeof G=="string"?G:this.#je(G)}#je(G){try{return this.#i.keyOf(G,-1)}catch{return"(unkeyed)"}}#Pe(G){if(typeof G=="string")return this.#ne(G);if(this.#i.keyed){const ee=this.#i.keyOf(G,-1),ne=this.#ne(ee);if(ne!==void 0)return ne}if(this.#r)return;const Q=this.#n.indexOf(G);return Q>=0?Q:void 0}#ne(G){return this.#p||this.#Ce(),this.#p.get(G)}#Ce(){this.#p=new Map;const G=this.#Te(),Q=this.#e.store,ee=Q&&K(Q.live)?ne=>Q.live(ne):null;for(let ne=0;ne<G;ne++){if(ee&&!ee(ne))continue;const se=this.#we(ne);se!==void 0&&this.#p.set(this.#i.keyOf(se,ne),ne)}}#re(G,Q){const ee=[];for(const ne of this.#G())this.#We(ne)&&this.#J(ne,G,Q,new Set)&&ee.push(ne);return ee}#J(G,Q,ee,ne){if(ne.has(G))return!1;ne.add(G);const se=this.#We(G);if(!se)return!1;const le=se.value&&se.value.deps;return Array.isArray(le)&&le.length?le.some(me=>this.#J(String(me),Q,ee,ne)):K(se.getValue)?!Object.is(se.getValue(Q),se.getValue(ee)):!1}#G(){const G=new Set;for(const ee of this.#H("sort",[]))G.add(ee.col);for(const ee of this.#H("groupBy",[]))G.add(ee);const Q=ee=>{if(ee){if(Array.isArray(ee.conditions)){ee.conditions.forEach(Q);return}ee.col&&G.add(ee.col)}};return Q(this.#H("filters",null)),[...G]}#q(G){if(!G.size)return!1;if(this.#H("quick",""))return!0;for(const Q of this.#G())if(G.has(Q))return!0;return!1}#F(){if(!this.#a){this.#a=!0;try{this.#Me()}finally{this.#a=!1}}}pipelineRunning(){return this.#a}#Me(){const G=this.#_("filter",()=>this.#z(),()=>this.#ve()),Q=this.#X(G),ee=this.#_("group",()=>this.#pe(),()=>this.#st(Q)),ne=this.#_("total",()=>this.#me(),()=>this.#Be(ee));this.#_("pivot",()=>this.#Ue(),()=>this.#Mt(ee)),this.#_("flatten",()=>this.#Le(),()=>this.#j(ee)),this.#Ie(ee,ne)}#X(G){const Q=this.#l.get("sort"),ee=this.#oe();if(Q.computed&&Q.key===ee&&!this.#b.has("sort"))return Q.result;const ne=this.#b.get("sort");return ne&&ne.key===ee?Q.result:Q.result&&this.#Ne(G)?(this.#Ee(G,ee),Q.result):this.#_("sort",()=>ee,()=>this.#Re(G))}#ue(){if(this.#y===null){const G=this.#e.pipelineWorker,Q=K(G)?G():null;this.#y=Q||!1}return this.#y||null}#de(){const G=this.#H("sort",[]);if(!Array.isArray(G)||!G.length)return null;const Q=(this.#e.config||{}).locale,ee=[],ne=[];for(const se of G){const le=this.#We(se.col);if(le&&le.running)continue;if(le&&le.value&&K(le.value.compare))return null;const me=this.#o.handle(se.col);if(!me)return null;ee.push({col:se.col,descending:se.dir==="desc",nullsFirst:!!se.nullsFirst,locale:Q}),ne.push(me)}return ee.length?{entries:ee,handles:ne,locale:Q}:null}#Ne(G){if(this.#he())return!1;const Q=this.#ue();if(!Q)return!1;const ee=Number(Q.threshold);return Number.isFinite(ee)&&G.length<ee?!1:!!this.#de()}#Ee(G,Q){const ee=this.#ue(),ne=ee&&this.#de();if(!ne){this.#_("sort",()=>Q,()=>this.#Re(G));return}const se=new AbortController;this.#b.set("sort",{key:Q,controller:se});const le=ne.entries.length===1?ee.sortColumn(ne.handles[0],G,{descending:ne.entries[0].descending,nullsFirst:ne.entries[0].nullsFirst,locale:ne.locale,signal:se.signal,key:"sort"}):ee.sortMulti(ne.handles,ne.entries.map((me,ve)=>({...me,handle:ne.handles[ve]})),G,{signal:se.signal,key:"sort"});if(!T(le)){this.#b.delete("sort"),this.#_("sort",()=>Q,()=>le);return}le.then(me=>this.#ae(Q,me),me=>this.#le("sort",Q,me))}#ae(G,Q){const ee=this.#b.get("sort");if(!(!ee||ee.key!==G)){if(this.#oe()!==G){this.#b.delete("sort");return}this.#b.delete("sort"),this.#_("sort",()=>G,()=>Q),this.#Y=null,this.#F(),this.#Ye("model:changed",{reason:M[0]})}}#le(G,Q,ee){const ne=this.#b.get(G);if(!(!ne||ne.key!==Q)&&(this.#b.delete(G),!(ee&&ee.name==="AbortError")&&G==="sort"&&this.#oe()===Q)){const se=this.#_("filter",()=>this.#z(),()=>this.#ve());this.#_("sort",()=>Q,()=>this.#Re(se)),this.#Y=null,this.#F(),z("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",ee),this.#Ye("model:changed",{reason:M[1]})}}#Ie(G,Q){const ee=G&&G.leaves?G.leaves.length:this.#m.slots.length;this.#m.matchCount=ee,this.#m.grand=Q&&Q.grand||null,this.#m.grandLeaves=G&&G.leaves?G.leaves.length:0,this.#m.groupLeaves=G&&G.leaves?G.leaves:null}#_(G,Q,ee){const ne=this.#l.get(G),se=Q();return ne.computed&&ne.key===se||(ne.result=ee(),ne.key=se,ne.computed=!0,ne.id++,G==="flatten"&&(this.#Y=null)),ne.result}#C(G){return this.#l.get(G).id}#z(){const G=(this.#e.config||{}).hostFilter,Q=G&&K(G.active)&&G.active()?1:0,ee=this.#H("where",null),ne=ee?ee.version:0,se=this.#Ot("filter.sig",`${this.#tt()}`,()=>v({filters:this.#H("filters",null),quick:this.#H("quick",""),quickMode:this.#H("quickMode","contains")}));return`${this.#u}|${se}|${Q}|${ne}`}#oe(){const G=this.#he();return`${this.#C("filter")}|${JSON.stringify(this.#H("sort",[]))}`+(G?`|manual:${G.version}`:"")}#he(){const G=this.#H("rowOrder",null);return G&&Array.isArray(G.keys)?G:null}#se(G,Q){this.#p||this.#Ce();const ee=this.#p,ne=this.#Te(),se=Q.keys.length,le=new Float64Array(ne);for(let me=0;me<ne;me++)le[me]=se+me;for(let me=0;me<se;me++){const ve=ee.get(Q.keys[me]);ve!==void 0&&(le[ve]=me)}return Uint32Array.from(G).sort((me,ve)=>le[me]-le[ve])}orderedKeys(){this.#p||this.#Ce();const G=this.#p,Q=new Map;for(const[me,ve]of G)Q.set(ve,me);const ee=Uint32Array.from([...Q.keys()]).sort(),ne=this.#he(),se=ne?this.#se(ee,ne):this.#Re(ee),le=new Array(se.length);for(let me=0;me<se.length;me++)le[me]=Q.get(se[me]);return le}#pe(){const G=this.#H("pivotBy",[]).length>0?"p":"u";return`${this.#C("sort")}|${JSON.stringify(this.#H("groupBy",[]))}|${G}`}#me(){const G=this.#qe()?"f":"a",Q=(this.#e.config||{}).totalOnlyChangedColumns?"n":"w";return`${this.#C("group")}|${JSON.stringify(this.#H("totals",[]))}|${G}${Q}|${this.#c}`}#Ue(){return`${this.#C("group")}|${JSON.stringify(this.#H("pivotBy",[]))}`}#Le(){const Q=this.#k()||!this.#ge()?this.#C("total"):"x",ee=`${this.#tt()}`,ne=this.#Ot("flatten.keys",ee,()=>{const le=this.#H("expanded",null);return le?[...le].sort().join(""):"*"}),se=this.#Ot("flatten.detail",ee,()=>{const le=this.#H("detail",null);return le&&K(le.signature)?le.signature():""});return`${Q}|${this.#C("pivot")}|${ne}|${se}`}#k(){const G=this.#H("groupBy",[]);return Array.isArray(G)&&G.length>0}stageState(){const G=[];for(const[Q,ee]of this.#l){const ne=ee.result;G.push({stage:Q,materialised:!!ee.computed,bytes:ne&&typeof ne.byteLength=="number"?ne.byteLength:null,rows:ne&&typeof ne.length=="number"?ne.length:null,rebuilds:ee.id})}return G}facetIndices(G){return this.#ve(G||null)}facetRows(G){const Q=this.facetIndices(G),ee=[];for(let ne=0;ne<Q.length;ne++){const se=this.#te(Q[ne]);se&&ee.push(se)}return ee}invalidateRows(){this.#h.clear(),this.#x.clear(),this.#Y=null}invalidateHandles(){this.#o.invalidate()}rows(){return this.#n}unfilteredIndices(){return this.#Ve()}filteredIndices(){const G=this.#l.get("filter");if(G&&G.computed&&G.key===this.#z())return G.result||this.#Ve();this.#F();const Q=this.#l.get("filter");return(Q&&Q.computed?Q.result:null)||this.#Ve()}unfilteredRows(){const G=this.#Ve(),Q=[];for(let ee=0;ee<G.length;ee++){const ne=this.#te(G[ee]);ne&&Q.push(ne)}return Q}#ve(G=null){const Q=this.#Ve(),ee=this.#H("filters",null),ne=G?this.#Ke("pruneColumn")(ee,G):ee,se=this.#vt(ne),le=String(this.#H("quick","")||"").trim().toLowerCase(),me=le?x(le,String(this.#H("quickMode","contains")||"contains")):null,ve=(this.#e.config||{}).hostFilter,fe=!!(ve&&K(ve.active)&&ve.active()),xe=this.#H("where",null),He=!!(xe&&xe.active);if(!se&&!le&&!fe&&!He)return Q;let Be=null;se&&(Be=this.#Ke("evaluateFilters")(se,{handle:Re=>this.#o.handle(Re),count:this.#Te(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:Re=>N(this.#We(Re))}));const ae=new Uint32Array(Q.length);let Ae=0;for(let Me=0;Me<Q.length;Me++){const Re=Q[Me];if(!(Be&&!Be[Re])&&!(me&&!this.#wt(Re,me))){if(fe||He){const pe=this.#te(Re);if(fe&&!ve.passes(pe)||He&&!xe.passes(pe.data,pe.key))continue}ae[Ae++]=Re}}if(Be){const Me=(this.#e.compute||{}).releaseMask;K(Me)&&Me({pool:this.#e.pool},Be)}return ae.subarray(0,Ae)}handleFor(G){return this.#o.handle(G)}#Re(G){const Q=this.#he();if(Q)return this.#se(G,Q);const ee=this.#H("sort",[]).filter(le=>{const me=this.#We(le.col);return!me||!me.running?!0:(z(`source.sort.running.${le.col}`,`sort ignores "${le.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 G;const ne=(this.#e.config||{}).locale;if(ee.length===1){const le=ee[0],me=this.#o.handle(le.col);if(!me)return z(`source.sort.${le.col}`,`sort ignores unknown column "${le.col}".`),G;const ve=this.#We(le.col);return this.#Ke("sortColumn")(me,G,{descending:le.dir==="desc",nullsFirst:le.nullsFirst,locale:ne,compare:P(ve)})}const se=[];for(const le of ee){const me=this.#o.handle(le.col);if(!me){z(`source.sort.${le.col}`,`sort ignores unknown column "${le.col}".`);continue}se.push({handle:me,descending:le.dir==="desc",nullsFirst:le.nullsFirst,locale:ne,compare:P(this.#We(le.col))})}return se.length?this.#Ke("sortMulti")(se.map(le=>le.handle),se,G):G}#st(G){const Q=this.#H("groupBy",[]),ee=this.#Oe();if(ee&&!Q.length){const Me=p(G,ee);return this.#$=O(Me.roots,ee.declaresChildren),{roots:null,leaves:G,nodes:new Map,tree:Me}}if(this.#$=null,ee&&Q.length&&z("tree.grouped","grouping is active on a grid configured with `tree`; the grouping wins and the hierarchy is not shown."),!Q.length)return{roots:null,leaves:G,nodes:new Map};const ne=(this.#e.config||{}).timeZone,se=[],le=[];let me=!1;for(const Me of Q){const Re=this.#o.handle(Me);if(!Re){z(`source.group.${Me}`,`grouping ignores unknown column "${Me}".`);continue}se.push(Re);const pe=this.#We(Me),$e=pe&&pe.dataType;if($e&&K($e.groupProjector)){const ce=pe.typeOptions&&pe.typeOptions.timeZone||ne||void 0,ge=$e.groupProjector(pe,ce);le.push(ge||null),ge&&(me=!0)}else le.push(null)}if(!se.length)return{roots:null,leaves:G,nodes:new Map};const{keys:ve,buckets:fe}=this.#Ke("groupByColumns")(se,G,{locale:(this.#e.config||{}).locale,project:me?le:void 0}),xe=this.#H("pivotBy",[]).length>0,He=[],Be=new Map;for(let Me=0;Me<fe.length;Me++){const Re=ve[Me];let pe=null;const $e=[];for(let ce=0;ce<Re.length;ce++){$e.push(f(Re[ce]));const ge=c($e),je=ce===Re.length-1;let Ve=Be.get(ge);if(!Ve){const Se=this.#i.group({path:[...$e],column:Q[ce],value:Re[ce],level:ce,parent:pe,expanded:xe&&je?!1:this.#ct(ge,{key:ge,column:Q[ce],value:Re[ce],level:ce,path:[...$e]}),hasChildren:!(xe&&je)});Ve={row:Se,leaves:null},Be.set(ge,Ve),pe?pe.children.push(Se):He.push(Se)}Ve.row.leafCount+=fe[Me].length,ce===Re.length-1&&(Ve.leaves=fe[Me]),pe=Ve.row}}const ae=this.#H("sort",[])||[],Ae=(Me,Re)=>{if(!Me||Me.length<2){if(Me)for(const ge of Me)Ae(ge.children,Re+1);return}const pe=Q[Re],$e=ae.find(ge=>ge.col===pe),ce=$e&&$e.dir==="desc"?-1:1;Me.sort((ge,je)=>ce*X(ge.groupValue,je.groupValue));for(const ge of Me)Ae(ge.children,Re+1)};return Ae(He,0),{roots:He,leaves:G,nodes:Be,keys:ve,buckets:fe}}#He(G,Q){const ee=new Map,ne=new Map,se=le=>{const me=le.physical>=0?[le.physical]:[];for(const ve of le.children)me.push(...se(ve));if(le.children.length){const ve=this.#Je(Q,Uint32Array.from(me),null);le.physical>=0?ee.set(le.physical,ve):ne.set(le.key,ve)}return me};for(const le of G.roots)se(le);return{byPhysical:ee,byKey:ne}}#Be(G){const Q=this.#et();if(!Q.length)return this.#M=null,this.#P=null,{grand:null};const ee={id:this.#C("group"),columns:Q.map(ae=>ae.id).join("")},ne=this.#M&&this.#M.id===ee.id&&this.#M.columns===ee.columns,se=this.#Ge()&&ne?this.#E:null,le=se?Q.filter(ae=>se.has(ae.id)):Q,me=ne?this.#P:null,ve=this.#qe()?null:this.#Tt(),fe=this.#ye(Q),xe=ae=>{const Ae=G.nodes.get(ae.key);let Me=Ae&&Ae.leaves?Ae.leaves:null;if(ae.children&&ae.children.length){const $e=ae.children.map(xe);let ce=0;for(const Ve of $e)ce+=Ve.length;const ge=new Uint32Array(ce);let je=0;for(const Ve of $e)ge.set(Ve,je),je+=Ve.length;Me=ge}Me=Me||new Uint32Array(0);const Re=ve?ve.get(ae.key)||E:Me,pe=this.#ot(ae,se?le:Q,Re,fe);return ae.totals=se?{...ae.totals,...pe}:pe,Me};if(G.roots&&le.length)for(const ae of G.roots)xe(ae);if(this.#V=G.tree?this.#He(G.tree,Q):null,this.#M=ee,this.#E=this.#Ge()?new Set:null,!(this.#e.config||{}).grandTotalRow)return this.#O.length=0,this.#P=null,{grand:null};const Be=ve?this.#it():G.leaves;return this.#P=this.#Xe(Q,Be,se,me),{grand:this.#P}}#Xe(G,Q,ee,ne){const se={},le=this.#C("group");le!==this.#w&&(this.#Qe(),this.#w=le);const me=this.#O;this.#O=[];for(const ve of G){if(!$(ve))continue;const fe=this.#o.handle(ve.id);if(!fe)continue;const xe=L(ve,"grand");if(!u(xe,fe)){if(ee&&!ee.has(ve.id)&&ne&&ve.id in ne){se[ve.id]=ne[ve.id];continue}se[ve.id]=this.#Je([ve],Q,null,"grand")[ve.id];continue}let He=this.#A.get(ve.id);if((!He||He.fn!==xe)&&(He=new n(xe),this.#A.set(ve.id,He)),He.valid){let Be=!0;for(const ae of me)if(ae.colId===ve.id&&!He.update(ae.before,ae.after)){Be=!1;break}if(Be){se[ve.id]=He.value();continue}He.invalidate()}He.seedColumn(fe.values,a(fe),Q),se[ve.id]=He.valid?He.value():this.#Je([ve],Q,null,"grand")[ve.id]}return se}#ye(G){const Q=this.#C("group");Q!==this.#T&&(this.#v.clear(),this.#T=Q);const ee=new Map;for(const se of G){if(!$(se))continue;const le=this.#o.handle(se.id),me=L(se,"group");u(me,le)&&ee.set(se.id,{fn:me})}if(!ee.size)return this.#S.length=0,ee;const ne=this.#S;this.#S=[];for(const se of ne){const{beforeKeys:le,afterKeys:me,colDeltas:ve}=se,fe=le.length?new Set(le):null,xe=me.length?new Set(me):null;for(const{colId:He,before:Be,after:ae}of ve)if(ee.has(He)){for(const Ae of le)xe&&xe.has(Ae)||this.#ke(Ae,He,Be,null);for(const Ae of me)fe&&fe.has(Ae)||this.#ke(Ae,He,null,ae);for(const Ae of le)xe&&!xe.has(Ae)||this.#ke(Ae,He,Be,ae)}}return ee}#ke(G,Q,ee,ne){const se=this.#v.get(G),le=se&&se.get(Q);!le||!le.valid||le.update(ee,ne)||le.invalidate()}#ot(G,Q,ee,ne){if(!ne||!ne.size)return this.#Je(Q,ee,G);const se={};let le=null,me=this.#v.get(G.key);for(const ve of Q){const fe=ne.get(ve.id);if(!fe){(le||(le=[])).push(ve);continue}const xe=this.#o.handle(ve.id);if(!xe)continue;me||(me=new Map,this.#v.set(G.key,me));let He=me.get(ve.id);if((!He||He.fn!==fe.fn)&&(He=new n(fe.fn),me.set(ve.id,He)),He.valid||He.seedColumn(xe.values,a(xe),ee),He.valid){se[ve.id]=He.value();continue}(le||(le=[])).push(ve)}return le&&Object.assign(se,this.#Je(le,ee,G)),se}#Et(G,Q,ee,ne){const se=!this.#qe()||this.#ee(Q);for(const le of G){const me=le.getValue;if(!K(me))continue;const ve=me(ee),fe=me(ne);Object.is(ve,fe)||(this.#E&&this.#E.add(le.id),se&&this.#A.has(le.id)&&this.#O.push({colId:le.id,before:ve,after:fe}))}}#at(){const G=this.#H("groupBy",[]),Q=[];for(const ee of G){const ne=this.#We(ee);ne&&Q.push(ne)}return Q}#yt(G,Q){const ee=new Array(G.length);for(let ne=0;ne<G.length;ne++){const se=G[ne].getValue;ee[ne]=f(K(se)?se(Q):void 0)}return ee}#ht(G,Q,ee,ne,se){if(this.#qe()&&!this.#ee(ee))return;const le=l(this.#yt(G,ne)),me=l(this.#yt(G,se)),ve=le.length!==me.length||le.some((xe,He)=>xe!==me[He]),fe=[];for(const xe of Q){const He=xe.getValue;if(!K(He))continue;const Be=He(ne),ae=He(se);!ve&&Object.is(Be,ae)||fe.push({colId:xe.id,before:Be,after:ae})}!fe.length&&!ve||this.#S.push({beforeKeys:le,afterKeys:me,colDeltas:fe})}#ee(G){const Q=this.#l.get("filter"),ee=Q&&Q.computed?Q.result:null;if(!ee)return!0;let ne=0,se=ee.length-1;for(;ne<=se;){const le=ne+se>>1,me=ee[le];if(me===G)return!0;me<G?ne=le+1:se=le-1}return!1}#qe(){return(this.#e.config||{}).totalFilteredOnly!==!1}#rt(G){return this.#qe()?G:this.#it().length}#it(){return(!this.#N||this.#N.version!==this.#u)&&(this.#N={version:this.#u,indices:this.#Ve()}),this.#N.indices}#Tt(){const G=this.#H("groupBy",[]),Q=`${this.#u}|${JSON.stringify(G)}`;if(this.#R&&this.#R.key===Q)return this.#R.map;const ee=new Map,ne=[];for(const se of G){const le=this.#o.handle(se);le&&ne.push(le)}if(ne.length){const se=this.#it(),{keys:le,buckets:me}=this.#Ke("groupByColumns")(ne,se,{locale:(this.#e.config||{}).locale}),ve=new Map;for(let fe=0;fe<me.length;fe++){const xe=le[fe],He=[];for(let Be=0;Be<xe.length;Be++){He.push(f(xe[Be]));const ae=c(He);let Ae=ve.get(ae);Ae||(Ae=[],ve.set(ae,Ae));for(let Me=0;Me<me[fe].length;Me++)Ae.push(me[fe][Me])}}for(const[fe,xe]of ve)ee.set(fe,Uint32Array.from(xe))}return this.#R={key:Q,map:ee},ee}#Ge(){return!!(this.#e.config||{}).totalOnlyChangedColumns}#Ze(){this.#Qe(),this.#Nt(),this.#E=null,this.#M=null,this.#P=null}#Qe(){this.#A.clear(),this.#O.length=0,this.#w=-1}#Nt(){this.#v.clear(),this.#S.length=0,this.#T=-1}#Mt(G){const Q=this.#H("pivotBy",[]);if(!Q.length)return this.#ce=null,null;const ee=(this.#e.compute||{}).pivot;if(!K(ee))return z("source.pivot.kernel","pivot requested but ctx.compute.pivot is not available; showing unpivoted rows."),this.#ce=null,null;const ne=Q.map(le=>this.#o.handle(le)).filter(Boolean),se=this.#et();return this.#ce=ee(ne,G.leaves,{groups:G.keys&&G.buckets?{keys:G.keys,buckets:G.buckets}:null,totals:se.map(le=>le.id),handle:le=>this.#o.handle(le),totalOf:le=>L(se.find(me=>me.id===le),"group"),separator:((this.#e.config||{}).pivot||{}).separator,maxColumns:((this.#e.config||{}).pivot||{}).maxColumns})||null,this.#ce}#j(G){const Q=this.#l.get("total").result,ee=!!(this.#e.config||{}).groupFooter,ne=this.#Fe();if(G.tree)return this.#ze(G,Q,ne);if(!G.roots&&!ne){if(Q&&Q.grand&&!this.#ge()){const xe=this.#i.grandTotal(Q.grand,this.#rt(G.leaves.length));if(this.#K===G.leaves&&Array.isArray(this.#I))this.#I[this.#I.length-1]=xe;else{const He=Array.from(G.leaves);He.push(xe),this.#I=He,this.#K=G.leaves}this.#B=[{at:this.#I.length-1}]}else this.#K=null,this.#I=G.leaves,this.#B=I;return this.#U=I,this.#I}const se=[],le=[],me=[],ve=xe=>{if(se.push(xe),!ne)return;const He=this.#te(xe);!He||!ne.isOpen(He.key)||(He.master=!0,He.expanded=!0,me.push({at:se.length}),se.push(this.#i.detail(He,ne.heightOf(He))))};if(!G.roots){for(let xe=0;xe<G.leaves.length;xe++)ve(G.leaves[xe]);return Q&&Q.grand&&!this.#ge()&&(me.push({at:se.length}),se.push(this.#i.grandTotal(Q.grand,this.#rt(G.leaves.length)))),this.#K=null,this.#U=I,this.#B=me.length?me:I,this.#I=se,se}const fe=(xe,He,Be)=>{if(xe.expanded=xe.hasChildren===!1?!1:this.#ct(xe.key,{key:xe.key,column:xe.groupColumn,value:xe.groupValue,level:xe.level,path:xe.groupPath}),xe.posinset=He+1,xe.setsize=Be,le.push({at:se.length,row:xe}),me.push({at:se.length}),se.push(xe),!!xe.expanded){if(xe.children&&xe.children.length)for(let ae=0;ae<xe.children.length;ae++)fe(xe.children[ae],ae,xe.children.length);else{const ae=G.nodes.get(xe.key),Ae=ae&&ae.leaves?ae.leaves:null;if(Ae)for(let Me=0;Me<Ae.length;Me++)ve(Ae[Me])}ee&&xe.totals&&(me.push({at:se.length}),se.push(this.#i.footer(xe)))}};for(let xe=0;xe<G.roots.length;xe++)fe(G.roots[xe],xe,G.roots.length);return Q&&Q.grand&&!this.#ge()&&(me.push({at:se.length}),se.push(this.#i.grandTotal(Q.grand,this.#rt(G.leaves.length)))),this.#U=le,this.#B=me,this.#I=se,se}#Ve(){const G=this.#e.store;if(G&&K(G.liveIndices))return G.liveIndices();const Q=new Uint32Array(this.#n.length);let ee=0;for(let ne=0;ne<this.#n.length;ne++)this.#n[ne]!==void 0&&(Q[ee++]=ne);return Q.subarray(0,ee)}#Te(){const G=this.#e.store;return G&&typeof G.physical=="number"?G.physical:this.#n.length}#we(G){const Q=this.#e.store;return Q&&K(Q.source)?Q.source(G):this.#n[G]}#Se(G,Q=G){const ee=this.#I[G];if(typeof ee!="number")return ee.index=Q,ee;const ne=this.#te(ee);return ne.index=Q,ne}#te(G){let Q=this.#h.get(G);Q||(Q=this.#i.leaf(this.#we(G),G),this.#h.set(G,Q));const ee=this.#$?this.#$.get(G):null;if(ee){Q.level=ee.level,Q.posinset=ee.posinset,Q.setsize=ee.setsize,Q.hasChildren=ee.hasChildren,Q.expanded=ee.hasChildren&&!ee.lazy&&this.#ct(Q.key);const ne=this.#V?this.#V.byPhysical.get(G):void 0;ne?Q.totals=ne:Q.totals&&(Q.totals=null)}else Q.hasChildren&&(Q.level=0,Q.hasChildren=!1,Q.expanded=!1,Q.posinset=void 0,Q.setsize=void 0);return Q}#ze(G,Q,ee){const ne=[],se=[],le=ve=>{if(ve.leafCount!==void 0)return ve.leafCount;let fe=ve.physical>=0?1:0;for(const xe of ve.children)fe+=le(xe);return ve.leafCount=fe,fe},me=ve=>{const fe=this.#ct(ve.key);if(ve.physical>=0){if(ne.push(ve.physical),ee&&ee.isOpen(this.#te(ve.physical).key)){const xe=this.#te(ve.physical);se.push({at:ne.length}),ne.push(this.#i.detail(xe,ee.heightOf(xe)))}}else ne.push(this.#i.group({path:[ve.key],column:null,value:ve.value,level:ve.level,parent:null,expanded:fe,hasChildren:ve.children.length>0,leafCount:le(ve),totals:this.#V?this.#V.byKey.get(ve.key):void 0}));if(fe)for(const xe of ve.children)me(xe)};for(const ve of G.tree.roots)me(ve);return Q&&Q.grand&&!this.#ge()&&(se.push({at:ne.length}),ne.push(this.#i.grandTotal(Q.grand,this.#rt(G.leaves.length)))),this.#K=null,this.#U=I,this.#B=se.length?se:I,this.#I=ne,ne}#lt(){return r(()=>this.count(),G=>this.at(G))}#wt(G,Q){let ee=this.#x.get(G);if(ee===void 0){const ne=this.#we(G),se=this.#St(),le=[],me=this.#e.columnHidden;for(const ve of se){if(ve.quickFilter===!1||K(me)&&me(ve.id))continue;const fe=ve.value&&K(ve.value.quickFilterText)?ve.value.quickFilterText({value:void 0,data:ne,row:null,column:ve,colId:ve.id,grid:null,context:this.#H("context",null)}):null,xe=fe??(K(ve.formatValue)?ve.formatValue(K(ve.getValue)?ve.getValue(ne):void 0):"");xe!=null&&xe!==""&&le.push(String(xe))}ee=le.join(" ").toLowerCase(),this.#x.set(G,ee)}return Q(ee)}#et(){const G=this.#H("totals",[]),Q=G&&G.length?new Set(G):null;return this.#St().filter(ee=>Q?Q.has(ee.id):!!(ee.total||ee.groupTotal||ee.grandTotal))}#Je(G,Q,ee,ne="group"){const se={},le=(this.#e.compute||{}).total;for(const me of G){if(!$(me))continue;const ve=this.#o.handle(me.id);if(!ve)continue;const fe=L(me,ne);if(fe)if(K(fe)){const xe=new Array(Q.length);for(let He=0;He<Q.length;He++)xe[He]=ve.get(Q[He]);se[me.id]=fe(xe,{row:ee,column:me,grid:this.#e.grid||null,context:this.#H("context",null),valueAt:(He,Be)=>{const ae=this.#o.handle(He);return ae&&Be>=0&&Be<Q.length?ae.get(Q[Be]):null}})}else K(le)&&(se[me.id]=le(ve,Q,fe))}return se}#vt(G){if(!G)return G;const Q=this.#e.config||{},ee={tz:Q.timeZone,weekStartsOn:Q.weekStartsOn};return g(G,ne=>{const se=k(ne,ee),le=this.#We(se&&se.col),me=le&&le.type==="datetime";if(se&&se.type)return se.type==="datetime"&&!se.timeZone&&le?{...se,timeZone:Q.timeZone||void 0}:se;if(me)return{...se,type:"datetime",timeZone:Q.timeZone||void 0};const ve=le&&(le.dataType?.base||le.type);return ve?{...se,type:ve}:se})}#ct(G,Q){const ee=this.#H("expanded",null);return ee?K(ee.has)?ee.has(G,Q):Array.prototype.includes.call(ee,G):!0}#H(G,Q){if(G==="context"||!K(this.#e.stateVersion))return this.#Rt(G,Q);const ee=this.#kt(G),ne=this.#d.get(G);if(ne&&ne.version===ee)return ne.value;const se=this.#Rt(G,Q);return this.#d.set(G,{version:ee,value:se}),se}#Rt(G,Q){const ee=this.#e.state;if(ee&&K(ee[G])){const ne=ee[G]();return ne??Q}return Q}#tt(){const G=this.#e.stateVersion;return K(G)?G():0}#Ft(){const G=this.#e.columnsVersion,Q=this.#e.permissionsVersion;return`${K(G)?G():0}|${K(Q)?Q():0}`}#kt(G){return G==="totals"?this.#Ft():`${this.#tt()}`}#Ot(G,Q,ee){if(!K(this.#e.stateVersion))return ee();const ne=this.#f.get(G);if(ne&&ne.version===Q)return ne.key;const se=ee();return this.#f.set(G,{version:Q,key:se}),se}#Ke(G){const Q=(this.#e.compute||{})[G];return K(Q)||B(`ctx.compute.${G} is required by the memory source pipeline`),Q}#St(){const G=this.#e.columns;return G&&K(G.all)?G.all():[]}#We(G){const Q=this.#e.columns;return Q&&K(Q.get)?Q.get(G):void 0}#Ye(G,Q){const ee=this.#e.emit;K(ee)&&ee(G,Q)}}}),Ue("packages/core/src/source/abort.js",function(e,U){"use strict";Object.defineProperty(e,"SupersededError",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"RequestToken",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"AbortScope",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createAbortScope",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return B}});class te extends Error{constructor(K,F="superseded"){super(`[lattice] request ${K?`"${K}" `:""}${F}`),this.name="SupersededError",this.superseded=!0,this.key=K}}class C{#e;constructor(K,F,X,H){this.#e=K,this.key=F,this.controller=X,this.signal=X.signal,this.seq=H}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(K){this.signal.aborted||this.controller.abort(new te(this.key,K)),this.#e.settle(this)}}class q{#e=new Map;#t=0;begin(K="",F="superseded"){const X=this.#e.get(K);X&&!X.signal.aborted&&X.controller.abort(new te(K,F));const H=new C(this,K,new AbortController,++this.#t);return this.#e.set(K,H),H}tokenFor(K){return this.#e.get(K)}pending(K=""){const F=this.#e.get(K);return!!F&&!F.signal.aborted}get size(){return this.#e.size}settle(K){this.#e.get(K.key)===K&&this.#e.delete(K.key)}abort(K="",F="superseded"){const X=this.#e.get(K);X&&X.abort(F)}abortAll(K="superseded"){for(const F of[...this.#e.values()])F.abort(K);this.#e.clear()}}function z(){return new q}function B(Z){if(!Z||typeof Z!="object")return!1;const K=Z;return K.superseded===!0||K.name==="AbortError"||K.name==="SupersededError"}}),Ue("packages/core/src/source/blockcache.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_PAGE_SIZE",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"DEFAULT_MAX_CACHED_PAGES",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"BlockCache",{enumerable:!0,get:function(){return z}});const te=100,C=32;class q{constructor(Z){this.id=Z,this.rows=null,this.state="pending",this.token=null,this.error=null}}class z{#e=new Map;#t;#n;#r=0;#s=-1;constructor(Z={}){this.#t=Math.max(1,Math.floor(Number(Z.pageSize)||te)),this.#n=Math.max(1,Math.floor(Number(Z.maxCachedPages)||C))}get pageSize(){return this.#t}get maxBlocks(){return this.#n}get size(){return this.#e.size}blockOf(Z){return Math.floor(Z/this.#t)}rangeOf(Z){return{start:Z*this.#t,end:(Z+1)*this.#t}}has(Z){return this.#e.has(Z)}pending(Z){const K=this.#e.get(Z);return!!K&&K.state==="pending"}loaded(Z){const K=this.#e.get(Z);return!!K&&K.state==="loaded"}begin(Z,K){let F=this.#e.get(Z);return F||(F=new q(Z)),F.state="pending",F.token=K,F.error=null,this.#i(Z,F),F}fill(Z,K){const F=this.#e.get(Z)||new q(Z);F.rows=K,F.state="loaded",F.token=null,this.#i(Z,F)}failed(Z,K){const F=this.#e.get(Z)||new q(Z);F.state="error",F.error=K,F.token=null,this.#i(Z,F)}delete(Z){return this.#e.delete(Z)}rowAt(Z){const K=this.blockOf(Z),F=this.#e.get(K);if(!(!F||F.state!=="loaded"||!F.rows))return this.#i(K,F),F.rows[Z-K*this.#t]}rowLoaded(Z){const K=this.blockOf(Z),F=this.#e.get(K);return!!F&&F.state==="loaded"&&!!F.rows&&Z-K*this.#t<F.rows.length}erroredAt(Z){const K=this.#e.get(this.blockOf(Z));return!!K&&K.state==="error"}loadedExtent(){let Z=0;for(const K of this.#e.values()){if(K.state!=="loaded"||!K.rows)continue;const F=K.id*this.#t+K.rows.length;F>Z&&(Z=F)}return Z}fillOf(Z){const K=this.#e.get(Z);return K&&K.state==="loaded"&&K.rows?K.rows.length:null}protect(Z,K){this.#r=this.blockOf(Math.max(0,Z)),this.#s=this.blockOf(Math.max(0,K))}evict(){const Z=[];if(this.#e.size<=this.#n)return Z;for(const[K,F]of this.#e){if(this.#e.size-Z.length<=this.#n)break;K>=this.#r&&K<=this.#s||F.state!=="pending"&&Z.push(K)}for(const K of Z)this.#e.delete(K);return Z}ids(){return[...this.#e.keys()]}clear(){this.#e.clear()}#i(Z,K){this.#e.delete(Z),this.#e.set(Z,K)}}}),Ue("packages/core/src/source/pagewindow.js",function(e,U){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return te}});function te(C,q,z,B){const Z=Math.floor(Number(C)||0);if(Z<=0)return null;const K=Math.max(0,Math.floor(Number(q)||0)),F=Math.max(0,Math.floor(Number(z)||0));if(B){const X=Math.max(1,Math.ceil(F/Z)),H=Math.min(K,X-1),j=H*Z;return{page:H,pageSize:Z,offset:j,length:Math.max(0,Math.min(Z,F-j)),pageCount:X,total:F}}return{page:K,pageSize:Z,offset:K*Z,length:Z,pageCount:Math.max(K+2,Math.ceil(F/Z)),total:null}}}),Ue("packages/core/src/source/paged.js",function(e,U){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"PagedSource",{enumerable:!0,get:function(){return v}});const C=U("packages/core/src/internal/lru.js").Lru,z=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/warn.js").warnOnce,F=U("packages/core/src/internal/schedule.js").settleDebounce,X=U("packages/core/src/source/abort.js"),H=X.createAbortScope,j=X.isAbortError,w=U("packages/core/src/source/blockcache.js"),m=w.BlockCache,c=w.DEFAULT_PAGE_SIZE,f=w.DEFAULT_MAX_CACHED_PAGES,r=U("packages/core/src/source/rows.js").createRowFactory,t=U("packages/core/src/source/filterwire.js"),i=t.wireFilters,s=t.querySignature,n=t.warnHostFilterNotApplied,o=U("packages/core/src/source/pagewindow.js").pageWindow,a=120;function h(g,k){return new v(g,k)}class v{mode="paged";#e;#t;#n;#r=H();#s;#i;#o=new Map;#l=null;#a=null;#c=!1;#u=0;#d="";#f={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(k,d){this.#e=k||{mode:"paged"},this.#t=d||{},this.#n=new m({pageSize:this.#e.pageSize||c,maxCachedPages:this.#e.maxCachedPages||f}),this.#s=r(this.#t),this.#i=new C(this.#n.pageSize*4),this.#h=F((p,b)=>this.#w(p,b),a),this.#d=this.#E(),z(this.#e.fetch)||Z("source.paged.fetch",'source.mode "paged" requires a fetch function; the grid will stay empty.'),n(this.#t)}count(){const k=this.#y();return k?k.length:this.#b()}#b(){if(this.#T(),this.#l!==null)return this.#l;const k=Math.max(this.#u,this.#n.loadedExtent());return this.#c?k:k+this.#n.pageSize}matchCount(){return this.#b()}totalCount(){return this.#b()}pageInfo(){const k=this.#y();if(!k){const d=this.#b();return{page:0,pageSize:0,total:this.exact()?d:null,pageCount:1,counting:!1}}return{page:k.page,pageSize:k.pageSize,total:k.total,pageCount:k.pageCount,counting:k.total===null&&this.#r.size>0&&this.#u===0&&this.#n.loadedExtent()===0}}#y(){const k=this.#b(),d=o(this.#P("pageSize",0),this.#P("page",0),k,this.exact());if(!d)return this.#g="",null;const p=`${this.#m}:${d.offset}:${d.length}`;if(p!==this.#g&&!this.#p&&(this.#g=p,d.length>0)){const b=d.offset+d.length-1;this.#f={start:d.offset,end:b},this.#w(d.offset,b)}return d}at(k){const d=this.#y();if(d){if(k<0||k>=d.length)return;const p=this.#A(d.offset+k);return p&&(p.index=k),p}return this.#A(k)}#A(k){if(k<0||k>=this.#b())return;const d=this.#i.get(k);if(d&&(d.data!==null||!this.#n.rowLoaded(k)))return d;const p=this.#n.rowAt(k);if(p===void 0){const O=this.#s.skeleton(k,0,this.#n.erroredAt(k));return this.#i.set(k,O),O}const b=this.#s.leaf(p,k);return b.index=k,this.#i.set(k,b),this.#o.set(b.key,k),b}byKey(k){const d=this.#o.get(k);return d===void 0?void 0:this.#A(d)}loaded(k){const d=this.#y();return d?k>=0&&k<d.length&&this.#n.rowLoaded(d.offset+k):this.#n.rowLoaded(k)}loadedCount(){this.#T();let k=0;for(const d of this.#n.ids()){if(!this.#n.loaded(d))continue;const p=this.#n.fillOf(d);typeof p=="number"&&(k+=p)}return k}residentRows(){this.#T();const k=this.#y(),d=k?k.offset:0,p=k?k.offset+k.length:1/0,b=[],O=this.#n.ids().sort((y,M)=>y-M);for(const y of O){if(!this.#n.loaded(y))continue;const{start:M}=this.#n.rangeOf(y),D=this.#n.fillOf(y)||0;for(let _=M;_<M+D;_++){if(_<d||_>=p)continue;const I=this.#i.peek(_);if(I&&I.data!==null&&I.data!==void 0){b.push(I);continue}const L=this.#n.rowAt(_);if(L===void 0)continue;const $=this.#s.leaf(L,_);$.index=_,this.#i.set(_,$),this.#o.set($.key,_),b.push($)}}return b}hint(k,d){if(this.#p)return;const p=this.#T();let b=Math.max(0,Math.floor(k)),O=Math.max(b,Math.floor(d));const y=this.#y();if(y){if(y.length===0)return;b=y.offset,O=y.offset+y.length-1}this.#f={start:b,end:O},this.#n.protect(b,O);for(const M of this.#n.evict())this.#v(M);this.#h(b,O),p&&this.#h.flush()}#w(k,d){if(this.#p)return;this.#n.protect(k,d);const p=this.#n.blockOf(k),b=this.#n.blockOf(d);for(let O=p;O<=b&&!(this.#l!==null&&O*this.#n.pageSize>=this.#l);O++)this.#n.has(O)||this.#O(O)}apply(k){const d={added:[],updated:[],removed:[]};if(!k)return d;if(k.update)for(const p of k.update){const b=this.#s.keyOf(p,-1),O=this.#o.get(b);if(O===void 0)continue;const y=this.#s.leaf(p,O);y.index=O,this.#i.set(O,y),d.updated.push(y)}return(k.add&&k.add.length||k.remove&&k.remove.length)&&this.reload(),d}reload(k){this.#S("reload"),this.#h.cancel(),this.hint(this.#f.start,this.#f.end)}destroy(){this.#p=!0,this.#h.cancel(),this.#r.abortAll("destroyed"),this.#n.clear(),this.#i.clear(),this.#o.clear()}exact(){return this.#l!==null||this.#c}pending(){return this.#r.size}async#O(k){if(!z(this.#e.fetch))return;const d=this.#r.begin(`block:${k}`);this.#n.begin(k,d);const{start:p,end:b}=this.#n.rangeOf(k),O=this.#d;try{const y=await this.#e.fetch({range:{start:p,end:b},sort:this.#P("sort",[]),filters:i(this.#P("filters",null),this.#M()),quick:this.#P("quick","")||void 0,context:this.#P("context",null),signal:d.signal});if(!d.current||O!==this.#d||this.#p)return;d.settle();const M=y&&y.rows||[];this.#n.fill(k,M);for(let _=0;_<M.length;_++)this.#i.delete(p+_);const D=y&&typeof y.total=="number"?y.total:y&&typeof y.count=="number"?y.count:null;D!==null?(this.#l=D,this.#c=!0):M.length<this.#n.pageSize?(this.#c=!0,this.#l=p+M.length):this.#u=Math.max(this.#u,p+M.length),this.#N("model:changed",{reason:"page",block:k,from:p,to:p+M.length}),this.#N("rows:changed",{companion:!0,reason:"page",block:k,from:p,to:p+M.length}),this.#l!==null&&this.#l!==this.#a&&(this.#a=this.#l,this.#N("source:total",{total:this.#l,groupPath:[]}))}catch(y){if(d.settle(),j(y))return;this.#n.failed(k,y);for(let M=p;M<b;M++)this.#i.delete(M);this.#N("model:changed",{reason:"page-error",block:k,range:{start:p,end:b}}),this.#N("source:error",{error:y,block:k,range:{start:p,end:b}})}}#v(k){const{start:d,end:p}=this.#n.rangeOf(k);for(let b=d;b<p;b++){const O=this.#i.peek(b);O&&this.#o.delete(O.key),this.#i.delete(b)}}#T(){const k=this.#E();return k===this.#d?!1:(this.#d=k,this.#S("query"),!0)}#S(k){this.#r.abortAll(k),this.#n.clear(),this.#i.clear(),this.#o.clear(),this.#l=null,this.#a=null,this.#c=!1,this.#u=0,this.#m++,this.#N("model:changed",{reason:k})}#E(){return s({filters:this.#P("filters",null),sort:this.#P("sort",[]),quick:this.#P("quick",""),context:this.#P("context",null)})}#M(){const k=this.#t.config||{};return{tz:k.timeZone,weekStartsOn:k.weekStartsOn}}#P(k,d){const p=this.#t.state;if(p&&z(p[k])){const b=p[k]();return b??d}return d}#N(k,d){const p=this.#t.emit;z(p)&&p(k,d)}}}),Ue("packages/core/src/source/aggregates.js",function(e,U){"use strict";Object.defineProperty(e,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"pushableAggregates",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"fillAggregateSql",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"routeAggregate",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"resolveAggregatePlan",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"groupKeysPushable",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"pushdownDocRows",{enumerable:!0,get:function(){return X}});const te=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 C(){const H=new Set;for(const[j,w]of Object.entries(te))w.pushable&&H.add(j);return H}function q(H,j,w){let m=H.split("%c").join(j);return w!==void 0&&(m=m.split("%w").join(w)),m}function z(H){const j=H||{},w=j.default==="engine"||j.default==="engine-if-identical"?j.default:"client",m={};if(j.overrides&&typeof j.overrides=="object")for(const[c,f]of Object.entries(j.overrides))(f==="engine"||f==="client")&&(m[c]=f);return{default:w,overrides:m}}function B(H,j){const w=te[H];if(!w||!w.pushable)return"client";const m=j.overrides[H];return m==="engine"||m==="client"?m:j.default==="client"?"client":j.default==="engine-if-identical"?w.class==="identical"?"engine":"client":"engine"}function Z(H,j){const w=z(j),m=[],c=[];for(const f of H||[]){const l=te[f.fn],r=B(f.fn,w),t={id:f.id,col:f.col,fn:f.fn,class:l?l.class:"fallback"};f.weight!==void 0&&(t.weight=f.weight),f.params!==void 0&&(t.params=f.params),r==="engine"?m.push(t):(t.reason=l&&!l.pushable?l.note||"the engine cannot express this stat":"client by config",c.push(t))}return{engine:m,client:c,config:w}}const K=/^[A-Za-z_][A-Za-z0-9_$]*$/;function F(H,j=[]){return(H||[]).every(m=>{if(typeof m=="string")return K.test(m);if(!m||typeof m!="object")return!1;const c=m;return Array.isArray(j)&&j.includes(c.bucket)&&typeof c.col=="string"&&K.test(c.col)&&typeof c.size=="number"&&Number.isFinite(c.size)&&c.size>0})}function X(){return Object.entries(te).map(([H,j])=>({stat:H,class:j.class,sql:j.sql?q(j.sql,"col",j.twoColumn?"weight":void 0):"",note:j.note||(j.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),Ue("packages/core/src/source/pushdown.js",function(e,U){"use strict";Object.defineProperty(e,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"NO_CAPABILITIES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"capabilitiesOf",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"splitFilters",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"applyResidual",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"createPushdownSource",{enumerable:!0,get:function(){return V}});const C=U("packages/core/src/internal/compare.js").defaultCompare,z=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/merge.js").toArray,F=U("packages/core/src/internal/warn.js").warnOnce,X=U("packages/core/src/source/filterwire.js"),H=X.isGroup,j=X.warnWherePageRelative,w=X.warnWhereOverThreshold,m=X.wireFilters,c=U("packages/core/src/source/aggregates.js"),f=c.resolveAggregatePlan,l=c.groupKeysPushable,r=c.STAT_PUSHDOWN,i=U("packages/core/src/source/abort.js").SupersededError,s=1e3;function n(G){const Q=G&&G.signal;if(!Q||!Q.aborted)return;const ee=Q.reason;throw ee instanceof Error?ee:new i("","superseded before it was sent")}const u=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function o(G){if(!G||typeof G!="object")return!1;const Q=G.returning==="row"||G.returning==="key"?G.returning:"none";return{append:G.append===!0,update:G.update===!0,delete:G.delete===!0,returning:Q}}function a(G,Q){if(!G||typeof Q!="string")return;if(!Q.includes("."))return G[Q];let ee=G;for(const ne of Q.split(".")){if(ee===null||typeof ee!="object")return;ee=ee[ne]}return ee}function h(G){if(G===!0)return!0;if(!G||typeof G!="object")return!1;const Q=G;return Q.enabled===!1?!1:Q.enabled===!0||z(Q.commit)}function v(G){const Q={...u,...G||{}};return Q.operators=new Set(Q.operators||[]),Q.mutate=o(Q.mutate),Q}function g(G,Q){return!G||!G.op||!Q.operators.size?!1:Q.operators.has(G.op)}function k(G,Q){if(!G)return{pushed:null,residual:null};if(!Q.filter)return{pushed:null,residual:G};if(Q.filter==="term"){if(H(G)){const le=G.conditions||[];if(String(G.op)!=="and")return{pushed:null,residual:G};const me=le.findIndex(fe=>!H(fe)&&g(fe,Q));if(me<0)return{pushed:null,residual:G};const ve=le.filter((fe,xe)=>xe!==me);return{pushed:le[me],residual:ve.length?{op:"and",conditions:ve}:null}}return g(G,Q)?{pushed:G,residual:null}:{pushed:null,residual:G}}if(!H(G))return g(G,Q)?{pushed:G,residual:null}:{pushed:null,residual:G};if(String(G.op)!=="and")return(G.conditions||[]).every(me=>H(me)?k(me,Q).residual===null:g(me,Q))?{pushed:G,residual:null}:{pushed:null,residual:G};const ee=[],ne=[];for(const le of G.conditions||[]){if(H(le)){if(Q.filter==="flat"){ne.push(le);continue}const me=k(le,Q);me.pushed&&ee.push(me.pushed),me.residual&&ne.push(me.residual);continue}(g(le,Q)?ee:ne).push(le)}const se=le=>le.length===0?null:le.length===1?le[0]:{op:"and",conditions:le};return{pushed:se(ee),residual:se(ne)}}const d="__lattice_leaves";function p(G){return G.aggregates?G.aggregates instanceof Set?G.aggregates:new Set(Z(G.aggregates)):new Set}function b(G){const Q=p(G);return Q.size?Q.has("count")?G.filter!=="tree"||!G.operators||!G.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 O(G,Q,ee,ne,se,le,me){const ve=Array.isArray(G.groupBy)?G.groupBy:[],fe=Array.isArray(G.groupPath)?G.groupPath:[],xe=Array.isArray(G.groupValues)?G.groupValues:null;if(!Q.group){const He=b(Q);if(He)return He}return l(ve)?ee.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":ne?se?le?"a host `where` predicate can only run in the browser, over rows the engine grouped":me?"fullDataset holds the whole matching set, so the grid groups it itself":!xe||xe.length!==fe.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 y="pushdown:pivot-unsupported",M="pushdown:group-unsupported",D=Symbol("lattice.remote.ungroupedLevel");function _(G,Q,ee,ne,se,le){const me=Array.isArray(G.pivotBy)?G.pivotBy:[],ve=Array.isArray(G.groupBy)?G.groupBy:[],fe=Array.isArray(G.groupPath)?G.groupPath:[],xe=Array.isArray(G.groupValues)?G.groupValues:null;return Q.pivot?l(me)?ve.length&&!l(ve)?"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":ne?se?le?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!xe||xe.length!==fe.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 I(G,Q,ee=!1){const ne=k(G.filters||null,Q),se=[];ne.residual&&se.push("filter");const le=G.sort||[],me=le.length===0||Q.sort==="multi"&&le.length>=1||Q.sort==="single"&&le.length===1;!me&&le.length&&se.push("sort");const ve=G.quick?String(G.quick):"",fe=!ve||!!Q.quick;fe||se.push("quick");const xe=G.where&&G.where.active?G.where:null;xe&&se.push("where");const He={filters:ne.residual,sort:me?null:le,quick:fe?"":ve,where:xe},Be=!!ee,ae=Array.isArray(G.groupBy)&&G.groupBy.length>0,Ae=ae?O(G,Q,ne,me,fe,xe,Be):"",Me=G.pivotMode!==!1&&Array.isArray(G.pivotBy)&&G.pivotBy.length>0,Re=Me?_(G,Q,ne,me,fe,xe):"",pe=Me&&Re==="";Me&&!pe&&se.push("pivot");const $e=Me?pe&&ae:ae&&Ae==="";ae&&!Me&&!$e&&se.push("group");const ce=($e||pe)&&Array.isArray(G.groupValues)?G.groupValues.length:0,ge=$e||Me?!1:Be||!!(He.filters||He.sort||He.quick||He.where)||!Q.range;return{pushed:{...G,filters:ne.pushed,sort:me?le:[],quick:fe?ve:"",range:ge?null:G.range},residual:He,needsAll:ge,unpushed:se,full:Be,grouped:$e,groupLevel:ce,groupReason:Me?"":Ae,pivoted:pe,pivotReason:Re}}function L(G){const Q=Array.isArray(G.totals)?G.totals:[],ee=G.totalFns&&typeof G.totalFns=="object"?G.totalFns:{},ne=[],se=[];for(const le of Q){const me=String(le),ve=typeof ee[me]=="string"?ee[me]:null,fe=ve?r[ve]:null;ve?!fe||!fe.pushable||!fe.sql?se.push({id:me,fn:ve,class:fe?fe.class:"fallback",reason:fe&&fe.note?fe.note:`the pushdown map cannot express "${ve}"`}):fe.twoColumn?se.push({id:me,fn:ve,class:fe.class,reason:`"${ve}" reduces two columns, and a grouped request carries no weight column`}):ne.push({id:me,col:me,fn:ve,class:fe.class}):se.push({id:me,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:ne,client:se}}const $=Object.freeze({items:G=>G==null?[]:Array.isArray(G)?G:[G]});function P(G,Q,ee){if(!Q)return G;let ne=G;if(Q.filters&&z(ee.evaluateFilters)){const se=ne,le={count:ne.length,handle:fe=>({id:fe,get:xe=>a(se[xe],fe)}),itemwise:fe=>se.some(xe=>Array.isArray(a(xe,fe)))?$:null},me=ee.evaluateFilters(Q.filters,le),ve=[];for(let fe=0;fe<ne.length;fe++)me[fe]&&ve.push(ne[fe]);ne=ve}if(Q.where&&Q.where.active&&(Q.whole||j(Q.where.names,"pushdown"),ne=ne.filter(se=>Q.where.passes(se))),Q.quick){const se=Q.quick.toLowerCase();ne=ne.filter(le=>{if(!le||typeof le!="object")return!1;for(const me of Object.values(le))if(me!=null&&String(me).toLowerCase().includes(se))return!0;return!1})}if(Q.sort&&Q.sort.length&&z(ee.sortMulti)){const se=[...new Set(Q.sort.map(fe=>fe.col))],le=ne,me=se.map(fe=>({id:fe,get:xe=>a(le[xe],fe)})),ve=ee.sortMulti(me,Q.sort.map(fe=>({col:fe.col,dir:fe.dir})),Uint32Array.from({length:ne.length},(fe,xe)=>xe),{});ne=Array.from(ve,fe=>le[fe])}return ne}function N(G){return JSON.stringify({filters:G.filters||null,sort:G.sort||[],quick:G.quick||"",groupBy:G.groupBy||[],groupPath:G.groupPath||[],context:G.context??null})}function T(G){if(!G||typeof G!="object")return 16;let Q="";try{Q=JSON.stringify(G)}catch{return 200}return Q.length*2+64}function E(G){const Q=G||{};return{enabled:!!Q.enabled,maxRows:Number.isFinite(Q.maxRows)?Q.maxRows:1e6,maxBytesEstimate:Number.isFinite(Q.maxBytesEstimate)?Q.maxBytesEstimate:512*1024*1024}}const A=5e4;function S(G){return Number.isFinite(G)&&G>=0?G:A}function x(G){return!!G&&z(G.then)}async function W(G){if(!G||G.total!==void 0||!x(G.pendingTotal))return G;const Q=await G.pendingTotal,{pendingTotal:ee,...ne}=G;return typeof Q=="number"?{...ne,total:Q}:ne}function V(G={}){const Q=G.adapter;if(!Q||!z(Q.execute))return F("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...G,mode:"remote",fetch:async()=>({rows:[],total:0})};const ee=v(Q.capabilities),ne=Q.capabilities&&Object.getOwnPropertyDescriptor(Q.capabilities,"operators");ne&&z(ne.get)&&Object.defineProperty(ee,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(Q.capabilities.operators||[]),set:()=>{}});const se=Q.name||"adapter";let le=null;const me=()=>z(Q.ready)?(le||(le=Promise.resolve(Q.ready()).then(()=>{Object.assign(ee,v(Q.capabilities))},be=>{throw le=null,be})),le):null,ve=E(G.fullDataset),fe=!!G.allowPartialResults,xe=S(G.whereRowLimit);let He=null;const Be=G.aggregates;let ae=null,Ae=null,Me=null,Re=null,pe=null,$e,ce=null,ge=0,je=null;const Ve=()=>!ve.enabled||!ae?null:(je!==ae.key&&(ge++,je=ae.key),{rows:ae.rows,version:ge}),Se=async be=>{const Ne=be.where&&be.where.active?be.where:null;if(!Ne)return{request:be,probe:null};const{where:re,...oe}=be,we=I(oe,ee,ve.enabled);if(we.needsAll)return{request:be,probe:null};const ke=N(we.pushed);let Le=null;return(!He||He.key!==ke)&&(ee.total?(n(be),Le=await W(await Q.execute(we.pushed,be)),He={key:ke,size:Le&&typeof Le.total=="number"?Le.total:null}):He={key:ke,size:null}),He.size!==null&&He.size<xe?{request:be,probe:null}:(w(Ne.names,se,He.size,xe),{request:oe,probe:Le})},Ge=async(be,Ne)=>{ce=null;const re=L(be.pushed);Me={engine:re.engine,client:re.client,groupBy:be.pushed.groupBy},re.client.length&&F(`source.pushdown.group.totals.${se}.${re.client.map(ke=>ke.id).join(".")}`,`the ${se} adapter cannot compute the group subtotal for ${re.client.map(ke=>`"${ke.id}" (${ke.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 oe=await Q.executeGroupLevel(be.pushed,re.engine,Ne)||{};let we=oe.rows||[];return!ee.range&&Ne.range&&(we=we.slice(Ne.range.start,Ne.range.end)),Ke(oe),oe.total===void 0?{rows:we}:{rows:we,total:oe.total}},Ce=new Map,Te=64,ze=async(be,Ne)=>{ce=null;const re=be.pushed,oe=re.groupBy,we=Array.isArray(re.groupValues)?re.groupValues:[],ke=we.length,Le=[...re.filters?[re.filters]:[],...oe.slice(0,ke).map((vt,bt)=>({col:vt,op:"eq",value:we[bt]===void 0?null:we[bt],caseSensitive:!0}))],De=Le.length===0?null:Le.length===1?Le[0]:{op:"and",conditions:Le},Pe=Ne.range?Ne.range.start:0;if(ke>=oe.length){const vt={...re,filters:De,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},bt=await W(await Q.execute(vt,Ne))||{};let Lt=bt.rows||[];return!ee.range&&Ne.range&&(Lt=Lt.slice(Ne.range.start,Ne.range.end)),typeof bt.total=="number"?{rows:Lt,total:bt.total}:{rows:Lt}}const _e=oe[ke],qe=L(re),Qe=p(ee),et=qe.engine.filter(vt=>Qe.has(vt.fn)),ft=[...qe.engine.filter(vt=>!Qe.has(vt.fn)).map(vt=>({id:vt.id,fn:vt.fn,class:vt.class,reason:`the ${se} adapter does not compute "${vt.fn}"`})),...qe.client];Me={engine:et,client:ft,groupBy:oe},ft.length&&F(`source.pushdown.group.totals.${se}.${ft.map(vt=>vt.id).join(".")}`,`the ${se} adapter cannot compute the group subtotal for ${ft.map(vt=>`"${vt.id}" (${vt.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 dt=[...et.map(vt=>({id:vt.id,col:vt.col,fn:vt.fn})),{id:d,col:_e,fn:"count"}],ut={...re,filters:De,range:null},Ct=JSON.stringify([N(ut),we,_e,dt]);let Mt=Pe>0?Ce.get(Ct):void 0;if(!Mt){for(Mt=Promise.resolve(Q.executeGroupedAggregates(ut,[_e],dt)),Ce.delete(Ct),Ce.set(Ct,Mt);Ce.size>Te;)Ce.delete(Ce.keys().next().value);Mt.catch(()=>{Ce.get(Ct)===Mt&&Ce.delete(Ct)})}const xt=await Mt||[];n(Ne);const Ye=vt=>{const bt={};for(const Lt of et)bt[Lt.id]=vt?vt[Lt.id]:void 0;return bt},mt=(re.sort||[]).find(vt=>vt&&vt.col===_e),gt=mt&&mt.dir==="desc"?-1:1,St=xt.filter(vt=>vt&&vt.level===1).map(vt=>({[_e]:vt.keys[0]===void 0?null:vt.keys[0],leafCount:Number(vt.values&&vt.values[d])||0,totals:Ye(vt.values)})).sort((vt,bt)=>gt*C(vt[_e],bt[_e]));if(ke===0){const vt=xt.find(Lt=>Lt&&Lt.level===0),bt=vt?Number(vt.values&&vt.values[d]):NaN;Ke({matchCount:Number.isFinite(bt)?bt:St.reduce((Lt,Ht)=>Lt+Ht.leafCount,0),...vt?{grand:Ye(vt.values)}:{}})}const Rt=Ne.range?Ne.range.end:St.length;return{rows:St.slice(Pe,Rt),total:St.length}},Ke=be=>{typeof be.matchCount=="number"&&(Re=be.matchCount,pe=be.grand?{totals:be.grand,leafCount:be.matchCount}:null,$e===void 0&&z(Q.unfilteredCount)&&($e=null,Promise.resolve(Q.unfilteredCount()).then(Ne=>{$e=typeof Ne=="number"?Ne:null}).catch(Ne=>{F(`source.pushdown.group.unfiltered.${se}`,`the ${se} adapter could not count the unfiltered set (${Ne&&Ne.message?Ne.message:Ne}), so "N of M" falls back to the display count for its denominator.`)})))},Ze=async(be,Ne)=>{ce=null;const re=L(be.pushed);Me={engine:re.engine,client:re.client,groupBy:be.pushed.groupBy,pivotBy:be.pushed.pivotBy},re.client.length&&F(`source.pushdown.pivot.totals.${se}.${re.client.map(De=>De.id).join(".")}`,`the ${se} adapter cannot compute the pivot cells for ${re.client.map(De=>`"${De.id}" (${De.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 oe=await Q.executePivotLevel(be.pushed,re.engine,Ne)||{};let we=oe.rows||[];!ee.range&&Ne.range&&(we=we.slice(Ne.range.start,Ne.range.end)),Ke(oe);const ke=oe.pivot&&typeof oe.pivot=="object"?oe.pivot:{},Le={cells:Array.isArray(ke.cells)?ke.cells:[],...Array.isArray(ke.axis)?{axis:ke.axis}:{}};return oe.total===void 0?{rows:we,pivot:Le}:{rows:we,total:oe.total,pivot:Le}},nt=be=>{F(`source.pushdown.pivot.${se}.${be}`,`pushdown:pivot-unsupported: the ${se} adapter cannot pivot this query because ${be}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const Ne=new Error(`[lattice] ${y}: the ${se} adapter cannot pivot this query because ${be}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw Ne.code=y,Ne.reason=be,Ne},it=(be,Ne)=>{const re={key:Ne,state:"pending",value:null};return ce=re,be.then(oe=>(ce===re&&(ce={key:Ne,state:"settled",value:typeof oe=="number"?oe:null}),oe),oe=>{throw ce===re&&(ce={key:Ne,state:"failed",value:null}),oe})};let wt=0,ht=[];const Ot=()=>wt===0?null:new Promise(be=>{const Ne=setTimeout(be,s);ht.push(()=>{clearTimeout(Ne),be()})});let Pt;const Nt=async be=>{const Ne=me();Ne&&await Ne;const oe=be&&be.pivotMode!==!1&&Array.isArray(be.pivotBy)&&be.pivotBy.length>0?{request:be,probe:null}:await Se(be);n(be);let we=I(oe.request,ee,ve.enabled);if(ee.group&&we.grouped&&!we.pivoted&&!z(Q.executeGroupLevel)&&(F(`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.`),we=I(oe.request,{...ee,group:!1,aggregates:null},ve.enabled)),we.pivoted&&!z(Q.executePivotLevel)&&(we=I(oe.request,{...ee,pivot:!1},ve.enabled),we.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),we.grouped&&!we.pivoted&&!ee.group&&!z(Q.executeGroupedAggregates)&&(F(`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\`.`),we=I(oe.request,{...ee,aggregates:null},ve.enabled)),Ae=we,we.pivoted)return Ze(we,be);if(we.pivotReason&&nt(we.pivotReason),we.grouped)return ee.group?Ge(we,be):ze(we,be);const Le=!!we.groupReason&&!we.full;Le?F(`source.pushdown.group-unsupported.${se}.${we.groupReason}`,`pushdown:group-unsupported: the ${se} adapter was not asked to group this query because ${we.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.`):we.groupReason&&F(`source.pushdown.group.${se}.${we.groupReason}`,`the ${se} adapter was not asked to group this query because ${we.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 De=dt=>Le?{...dt,[D]:!0}:dt;if(!we.needsAll){const dt=oe.probe||await Q.execute(we.pushed,be),ut=dt.rows||[];return x(dt.pendingTotal)&&dt.total===void 0?De({rows:ut,pendingTotal:it(dt.pendingTotal,N(we.pushed))}):(ce=null,!ee.total&&dt.total===void 0?De({rows:ut}):De({rows:ut,total:dt.total??ut.length}))}we.unpushed.length&&F(`source.pushdown.residual.${se}.${we.unpushed.join(".")}`,`the ${se} adapter cannot push ${we.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 Pe=N(we.pushed);if(!ae||ae.key!==Pe){const dt=await W(await Q.execute(we.pushed,be));ce=null;const ut=dt.rows||[];if(we.full){const Ct=typeof dt.total=="number"?Math.max(dt.total,ut.length):ut.length;if(Ct>ve.maxRows)throw new Error(`[lattice] fullDataset refused: the ${se} adapter's matching set is ${Ct.toLocaleString()} rows, past the configured maxRows of ${ve.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 Mt=ut.length*T(ut[0]);if(Mt>ve.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${se} adapter's matching set is an estimated ${Math.round(Mt/(1024*1024)).toLocaleString()} MB across ${ut.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(ve.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 dt.total=="number"&&ut.length<dt.total){const Ct=!!(we.residual.filters||we.residual.quick||we.residual.sort&&we.residual.sort.length);if(Ct&&!fe)throw new Error(`[lattice] the ${se} adapter returned ${ut.length} of ${dt.total} matching rows when asked for the whole result, and the query has residual ${we.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.`);Ct?F(`source.pushdown.partial.residual.${se}`,`the ${se} adapter returned ${ut.length} of ${dt.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.`):F(`source.pushdown.partial.${se}`,`the ${se} adapter returned ${ut.length} of ${dt.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}ae={key:Pe,rows:ut,total:typeof dt.total=="number"?dt.total:null}}let _e=we;if(we.residual.where){const dt=ae.total??ae.rows.length;if(dt>=xe){w(we.residual.where.names,se,dt,xe);const{where:ut,...Ct}=oe.request;_e=I(Ct,ee,ve.enabled),Ae=_e}}const qe=ae.total!==null&&ae.rows.length>=ae.total,Qe=P(ae.rows,{..._e.residual,whole:qe},G.compute||{}),et=be.range?be.range.start:0,ft=be.range?be.range.end:Qe.length;return De({rows:Qe.slice(et,ft),total:Qe.length})},ct=async(be,Ne,re)=>{const we=re&&re.waitForPage&&Pt&&z(Pt.pageForegroundIdle)?Pt.pageForegroundIdle():Ot();we&&await we;const ke=me();ke&&await ke;const Le=I(be,ee,ve.enabled);Ae=Le;const De=f(Ne,Be),Pe=Array.isArray(be.groupBy)?be.groupBy:[],_e=Pe.length>0,qe=!Le.residual.filters&&!Le.residual.quick,Qe=!_e||l(Pe,ee.buckets);let et=De.engine,ft=De.client;if(ee.aggregates&&et.length){const Mt=ee.aggregates instanceof Set?ee.aggregates:new Set(Z(ee.aggregates)),xt=et.filter(Ye=>!Mt.has(Ye.fn));xt.length&&(et=et.filter(Ye=>Mt.has(Ye.fn)),ft=[...xt.map(Ye=>({...Ye,reason:`the ${se} adapter does not compute "${Ye.fn}"`})),...ft])}const dt=Mt=>{ft=[...et.map(xt=>({...xt,reason:Mt})),...ft],et=[]};et.length&&!qe?dt(Le.residual.quick&&!Le.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):et.length&&!Qe&&dt("a grouping key the engine cannot form forces all-client (no mixed provenance)");let ut={},Ct;return et.length&&(z(_e?Q.executeGroupedAggregates:Q.executeAggregates)?_e?Ct=await Q.executeGroupedAggregates(Le.pushed,Pe,et)||[]:ut=await Q.executeAggregates(Le.pushed,et)||{}:(F(`source.pushdown.aggregates.${se}${_e?".grouped":""}`,`the ${se} adapter cannot compute ${_e?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),dt(`adapter cannot compute ${_e?"grouped ":""}aggregates`))),Me={engine:et,client:ft,..._e?{groupBy:Pe}:{}},{values:ut,engine:et,client:ft,...Ct!==void 0?{groups:Ct}:{}}},lt=async be=>{wt++;try{return await Nt(be)}finally{if(wt--,wt===0&&ht.length){const Ne=ht;ht=[];for(const re of Ne)re()}}},yt=h(G.edit),Tt=G.edit&&typeof G.edit=="object"&&z(G.edit.commit);let at=G.edit;if(yt&&!Tt)if(ee.mutate&&ee.mutate.update){const be=Ne=>{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 re={kind:"update",key:String(Ne.key),patch:{[Ne.colId]:Ne.value}};return Q.mutate(re,Ne.request||{})};at={...G.edit===!0?{}:G.edit,commit:be}}else F(`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 ye=yt&&ee.mutate&&(ee.mutate.append||ee.mutate.delete)?{append:ee.mutate.append===!0,remove:ee.mutate.delete===!0,returning:ee.mutate.returning,mutate:(be,Ne)=>Q.mutate(be,Ne||{})}:null,Oe=async be=>{const Ne=me();Ne&&await Ne;const{range:re,signal:oe,export:we,...ke}=be||{},Le={...ke,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:I(Le,ee,ve.enabled),signal:oe}};async function*ue(be,Ne={}){const{plan:re,signal:oe}=await Oe(be),we=Math.max(1,Math.floor(Number(Ne.pageSize))||5e3),ke={signal:oe,stream:!0};if(!re.needsAll)for(let Pe=0;;Pe+=we){n(ke);const _e=await Q.execute({...re.pushed,range:{start:Pe,end:Pe+we}},ke);_e&&x(_e.pendingTotal)&&_e.pendingTotal.then(null,()=>{});const qe=_e&&_e.rows||[];if(qe.length&&(yield qe),qe.length<we)return}n(ke);const Le=await W(await Q.execute({...re.pushed,range:void 0},ke)),De=P(Le&&Le.rows||[],{...re.residual,whole:!0},G.compute||{});for(let Pe=0;Pe<De.length;Pe+=we)yield De.slice(Pe,Pe+we)}return Pt={...G,edit:at,rowMutate:ye,mode:"remote",fetch:lt,foregroundIdle:Ot,aggregate:ct,countMatching:async be=>{const{plan:Ne,signal:re}=await Oe(be);if(!Ne.needsAll&&ee.total){n({signal:re});const we=await W(await Q.execute({...Ne.pushed,range:{start:0,end:0}},{signal:re}));if(we&&typeof we.total=="number")return we.total}let oe=0;for await(const we of ue(be))oe+=we.length;return oe},streamMatching:ue,capabilitiesOf:v,planQuery:I,wireFilters:m,resolveAggregatePlan:be=>f(be,Be),STAT_PUSHDOWN:r,lastPlan:()=>Ae?{...Ae,...Me?{aggregates:Me}:{},...ce?{total:{deferred:!0,state:ce.state,value:ce.value}}:{}}:null,fullFrame:Ve,counts:()=>({match:Re,total:$e??null,pending:!!ce&&ce.state==="pending"}),grandTotals:()=>pe},Pt}}),Ue("packages/core/src/source/remote.js",function(e,U){"use strict";Object.defineProperty(e,"PROTOCOL",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return N}});const C=U("packages/core/src/internal/lru.js").Lru,z=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/warn.js").warnOnce,F=U("packages/core/src/internal/schedule.js").settleDebounce,X=U("packages/core/src/source/abort.js"),H=X.createAbortScope,j=X.isAbortError,w=U("packages/core/src/source/blockcache.js"),m=w.BlockCache,c=w.DEFAULT_PAGE_SIZE,f=w.DEFAULT_MAX_CACHED_PAGES,l=U("packages/core/src/source/rows.js"),r=l.createRowFactory,t=l.groupKey,i=U("packages/core/src/source/filterwire.js"),s=i.wireFilters,n=i.querySignature,u=i.warnHostFilterNotApplied,a=U("packages/core/src/source/pagewindow.js").pageWindow,v=U("packages/core/src/source/memory.js").MemorySource,k=U("packages/core/src/compute/handle.js").valueComparator,d=U("packages/core/src/compute/pivot.js"),p=d.pivotKey,b=d.joinPath,O=d.DEFAULT_PATH_SEPARATOR,M=U("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,D=1,_=120,I=1e3;function L(T,E,A){for(let S=0;S<Math.max(T.length,E.length);S++){const x=T[S],W=E[S],V=x==null,G=W==null;if(V||G){if(V&&G)continue;return V?1:-1}const Q=A(x,W);if(Q!==0)return Q}return 0}function $(T,E){return new N(T,E)}class P{constructor(E,A,S,x){this.path=E,this.keyPath=x||E,this.values=[],this.level=A,this.key=t(this.keyPath),this.cache=new m(S),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;#s=new Map;#i=new Set;#o=H();#l;#a;#c=new Map;#u=[];#d=null;#f="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#A="";#w=null;#O=-1;constructor(E,A){this.#e=E||{mode:"remote"},this.#t=A||{},z(this.#e.fullFrame)&&(this.filteredIndices=()=>this.#V(),this.unfilteredIndices=()=>this.#W(),this.handleFor=G=>this.#D(G),this.display=()=>this.#x(),this.grandTotalRow=()=>this.#I(),this.unfilteredRows=()=>this.#B(),this.facetIndices=G=>this.#Y(G));const S=this.#e.counts;z(S)&&(this.matchCount=()=>this.#K("match"),this.totalCount=()=>this.#K("total"));const x=this.#e.grandTotals;z(x)&&(this.grandTotalRow=()=>this.#U());const W=this.#e.foregroundIdle;z(W)&&(this.foregroundIdle=()=>this.#be(W),this.#e.pageForegroundIdle=()=>this.#b?this.#be(W):null);const V=this.#e;z(V.countMatching)&&z(V.streamMatching)&&(this.selectionQuery=()=>this.#ce(),this.countMatching=G=>V.countMatching(G),this.streamMatching=(G,Q)=>V.streamMatching(G,Q),this.loadedRows=()=>this.#fe(),this.resident=()=>this.#R()!==null),this.#n={pageSize:this.#e.pageSize||c,maxCachedPages:this.#e.maxCachedPages||f},this.#l=r(this.#t),this.#a=new C(this.#n.pageSize*4),this.#h=F((G,Q)=>this.#P(G,Q),_),this.#r=new P([],0,this.#n),this.#s.set(this.#r.key,this.#r),this.#f=this.#de(),z(this.#e.fetch)||Z("source.remote.fetch",'source.mode "remote" requires a fetch function; the grid will stay empty.'),this.#Ie()}count(){const E=this.#S();return E?E.length:this.#v()}#v(){const E=this.#R();return E?E.count():(this.#X(),this.#re(this.#r))}#T(){if(this.#R())return!0;const E=A=>{if(A.count===null&&!A.complete)return!1;for(const S of A.children.values())if(this.#Ne(S.key)&&!E(S))return!1;return!0};return E(this.#r)}pageInfo(){const E=this.#S(),A=this.totalPending();if(!E){const S=this.#v();return{page:0,pageSize:0,total:this.#T()?S:null,pageCount:1,counting:A}}return{page:E.page,pageSize:E.pageSize,total:E.total,pageCount:E.pageCount,counting:A||E.total===null&&this.#o.size>0&&this.#r.cache.loadedExtent()===0}}#S(){const E=this.#v(),A=a(this.#C("pageSize",0),this.#C("page",0),E,this.#T());if(!A)return this.#A="",null;const S=`${this.#y}:${A.offset}:${A.length}`;return S!==this.#A&&!this.#p&&(this.#A=S,A.length>0&&!this.#R()&&this.#P(A.offset,A.offset+A.length-1)),A}at(E){const A=this.#S();if(A){if(E<0||E>=A.length)return;const S=this.#E(A.offset+E);return S&&(S.index=E),S}return this.#E(E)}#E(E){const A=this.#R();if(A)return A.at(E);if(this.#X(),E<0||E>=this.#v())return;const S=this.#G(this.#r,E);if(!S)return;const x=this.#q(S.node,S.local);return x&&(x.index=E),x||this.#l.skeleton(E,S.node.level,S.node.cache.erroredAt(S.local))}byKey(E){const A=this.#R();if(A)return A.byKey(E);const S=this.#c.get(E);if(!S)return;const x=S.lastIndexOf(":"),W=this.#s.get(S.slice(0,x));return W&&this.#q(W,Number(S.slice(x+1)))||void 0}loaded(E){const A=this.#S();if(A){if(E<0||E>=A.length)return!1;E+=A.offset}const S=this.#R();if(S)return S.loaded(E);if(E<0||E>=this.#v())return!1;const x=this.#G(this.#r,E);return!!x&&x.node.cache.rowLoaded(x.local)}hint(E,A){if(this.#p)return;this.#b=!0;const S=this.#X();let x=Math.max(0,Math.floor(E)),W=Math.max(x,Math.floor(A));const V=this.#S();if(V){if(V.length===0)return;x=V.offset,W=V.offset+V.length-1}for(const[G,Q]of this.#M(x,W)){G.cache.protect(Q.min,Q.max);for(const ee of G.cache.evict())this.#Me(G,ee)}this.#h(x,W),S&&this.#h.flush()}#M(E,A){const S=this.#v(),x=new Map;for(let W=E;W<=A&&W<S;W++){const V=this.#G(this.#r,W);if(!V)continue;const G=x.get(V.node);G?(G.min=Math.min(G.min,V.local),G.max=Math.max(G.max,V.local)):x.set(V.node,{min:V.local,max:V.local})}return x.size||x.set(this.#r,{min:E,max:E}),x}#P(E,A){if(!this.#p)for(const[S,x]of this.#M(E,A)){S.cache.protect(x.min,x.max);const W=S.cache.blockOf(x.min),V=S.cache.blockOf(x.max);for(let G=W;G<=V&&!(S.count!==null&&G*S.cache.pageSize>=S.count);G++)S.cache.has(G)||this.#Fe(S,G)}}apply(E){const A={added:[],updated:[],removed:[]};if(!E)return A;if(E.update)for(const S of E.update){const x=this.#c.get(this.#l.keyOf(S,-1));if(!x)continue;this.#a.delete(x);const W=x.lastIndexOf(":"),V=this.#s.get(x.slice(0,W));if(!V)continue;const G=Number(x.slice(W+1)),Q=V.cache.blockOf(G);if(!V.cache.loaded(Q))continue;const{start:ee}=V.cache.rangeOf(Q),ne=[];for(let le=ee;le<ee+V.cache.pageSize;le++){const me=V.cache.rowAt(le);if(me===void 0)break;ne.push(le===G?S:me)}V.cache.fill(Q,ne);const se=this.#q(V,G);se&&A.updated.push(se)}return(E.add&&E.add.length||E.remove&&E.remove.length)&&this.reload({keepExpanded:!0}),A}reload(E){this.#o.abortAll("reload"),this.#h.cancel(),E&&E.keepExpanded===!1&&this.#i.clear(),this.#ue(),this.#z("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#o.abortAll("destroyed"),this.#ue(),this.#s.clear(),this.#i.clear(),this.#w&&z(this.#w.destroy)&&this.#w.destroy(),this.#w=null}expand(E){this.#i.has(E)||(this.#i.add(E),this.#z("group:toggled",{key:E,expanded:!0}),this.#z("model:changed",{reason:"expand",key:E}))}collapse(E){this.#i.delete(E)&&(this.#z("group:toggled",{key:E,expanded:!1}),this.#z("model:changed",{reason:"collapse",key:E}))}expandedKeys(){return[...this.#i]}pivotFields(){return this.#u}pivot(){this.#X();const E=this.#d;if(!E||!E.keys.size||!this.#C("pivotBy",[]).length)return null;if(!E.result){const A=k((this.#t.config||{}).locale),S=[...E.keys.entries()].sort((W,V)=>L(W[1],V[1],A)),x=S.map(([W])=>W);E.result={keys:S.map(([,W])=>W),paths:x,fields:this.#ne(x),groupPaths:[],columns:x.length*Math.max(1,this.#Ee().length),values:E.cells,cells:E.cells,error:null}}return E.result}invalidateHandles(){this.#w&&(z(this.#w.invalidateHandles)&&this.#w.invalidateHandles(),z(this.#w.invalidate)&&this.#w.invalidate("filter"))}#N(){const E=this.#e.fullFrame;return z(E)?E():null}#R(){const E=this.#N();return E?(this.#w||(this.#w=new v({mode:"memory"},this.#$())),E.version!==this.#O&&(this.#w.setRows(E.rows),this.#O=E.version),this.#w):null}#$(){const E=this.#t,A=E.state||{};return{...E,state:{...A,page:()=>0,pageSize:()=>0}}}#V(){const E=this.#R();return E?E.filteredIndices():new Uint32Array(0)}#W(){const E=this.#R();return E?E.unfilteredIndices():new Uint32Array(0)}#D(E){const A=this.#R();return A?A.handleFor(E):void 0}#x(){const E=this.#R();return E?E.display():[]}#Y(E){const A=this.#R();return A&&z(A.facetIndices)?A.facetIndices(E):new Uint32Array(0)}#I(){const E=this.#R();return E&&z(E.grandTotalRow)?E.grandTotalRow():null}#K(E){const A=this.#R();if(A){const V=E==="match"?A.matchCount:A.totalCount;if(z(V))return V.call(A)}const S=this.#e.counts,x=z(S)?S():null,W=x?x[E]:null;return typeof W=="number"?W:this.#v()}#U(){const E=this.#R();if(E&&z(E.grandTotalRow))return E.grandTotalRow();if((this.#t.config||{}).grandTotalRow!=="bottom")return null;const S=this.#e.grandTotals,x=z(S)?S():null;return!x||!x.totals?null:this.#l.grandTotal(x.totals,x.leafCount||0)}#B(){const E=this.#R();if(E&&z(E.unfilteredRows))return E.unfilteredRows();const A=[],S=this.count();for(let x=0;x<S;x++){const W=this.at(x);W&&A.push(W)}return A}#ce(){const E=this.#C("quick",""),A={protocol:D,groupPath:[],groupValues:[],groupBy:[],totals:[],totalFns:{},pivotBy:[],pivotMode:!1,filters:s(this.#C("filters",null),this.#_()),sort:this.#C("sort",[]),context:this.#C("context",null)};E&&(A.quick=E);const S=this.#C("where",null);return S&&S.active&&(A.where=S),A}#fe(){const E=this.#C("groupBy",[]).length,A=[];for(const S of this.#s.values())if(!(S.level!==E&&!S.flat))for(const x of S.cache.ids()){if(!S.cache.loaded(x))continue;const{start:W,end:V}=S.cache.rangeOf(x);for(let G=W;G<V&&S.cache.rowLoaded(G);G++){const Q=this.#q(S,G);Q&&!Q.group&&A.push(Q)}}return A}loadedCount(){const E=this.#R();if(E){const x=E.matchCount();return typeof x=="number"?x:E.count()}this.#X();const A=this.#C("groupBy",[]).length;let S=0;for(const x of this.#s.values())if(!(x.level!==A&&!x.flat))for(const W of x.cache.ids()){if(!x.cache.loaded(W))continue;const V=x.cache.fillOf(W);typeof V=="number"&&(S+=V)}return S}residentRows(){const E=this.#R();return E?E.display():this.#C("groupBy",[]).length>0?null:(this.#X(),this.#fe())}#ie(E,A,S){const{start:x,end:W}=E.cache.rangeOf(A),V=this.#C("groupBy",[]),G=this.#C("pivotBy",[]),Q=this.#C("quick",""),ee=this.#Ee(),ne={protocol:D,range:{start:x,end:W},groupPath:E.path,groupValues:E.values,groupBy:V,totals:ee,totalFns:this.#ae(ee),pivotBy:G,pivotMode:G.length>0,filters:s(this.#C("filters",null),this.#_()),sort:this.#C("sort",[]),context:this.#C("context",null),signal:S};Q&&(ne.quick=Q);const se=this.#C("where",null);return se&&se.active&&(ne.where=se),ne}async#Fe(E,A){if(!z(this.#e.fetch))return;if(!this.#m){this.#m=!0;const V=this.#g;this.#g=[],queueMicrotask(()=>{for(const G of V)G()})}const S=this.#o.begin(`${E.key}:${A}`);E.cache.begin(A,S);const x=this.#f,{start:W}=E.cache.rangeOf(A);try{const V=await this.#e.fetch(this.#ie(E,A,S.signal));if(!S.current||x!==this.#f||this.#p)return;S.settle();const G=V&&V.rows||[];if(!!(V&&V[M])&&!E.flat){E.flat=!0,E.children.clear();for(const[se,le]of[...this.#c])le.startsWith(`${E.key}:`)&&(this.#a.delete(le),this.#c.delete(se))}E.cache.fill(A,G),E.failed=!1;for(let se=0;se<G.length;se++)this.#a.delete(`${E.key}:${W+se}`);const ee=V&&typeof V.count=="number"?V.count:V&&typeof V.total=="number"?V.total:null,ne=V&&z(V.pendingTotal?.then)?V.pendingTotal:null;ee!==null?(E.count=ee,E.complete=!0):G.length<E.cache.pageSize?(E.count=W+G.length,E.complete=!0):ne&&(E.counting=!0,E.announced=null),V&&Array.isArray(V.pivotFields)&&this.#je(V.pivotFields),V&&V.pivot&&typeof V.pivot=="object"&&this.#Ce(V.pivot),this.#z("model:changed",{reason:"page",groupPath:E.path,block:A}),this.#z("rows:changed",{companion:!0,reason:"page",groupPath:E.path,block:A}),this.#ge(E),ne&&this.#Oe(E,ne,x)}catch(V){if(S.settle(),j(V))return;E.cache.failed(A,V),E.failed=!0;const{end:G}=E.cache.rangeOf(A);for(let Q=W;Q<G;Q++)this.#a.delete(`${E.key}:${Q}`);this.#z("model:changed",{reason:"page-error",groupPath:E.path,block:A}),this.#z("source:error",{error:V,groupPath:E.path,block:A})}}async#Oe(E,A,S){let x;try{x=await A}catch(W){if(S!==this.#f||this.#p)return;E.counting=!1,j(W)||(E.failed=!0),j(W)||this.#z("source:error",{error:W,groupPath:E.path});return}S!==this.#f||this.#p||(E.counting=!1,typeof x=="number"&&(E.count=x,E.complete=!0,this.#ge(E),this.#z("model:changed",{reason:"total",count:x,groupPath:E.path})))}#ge(E){typeof E.count!="number"||!E.complete||E.announced!==E.count&&(E.announced=E.count,this.#z("source:total",{total:E.count,groupPath:E.path}))}#be(E){if(this.#p)return null;this.#X();const A=this.#m?null:new Promise(G=>{this.#g.push(G),setTimeout(G,I)}),S=E();if(!A&&!S)return null;const x=(async()=>{A&&await A;for(let G=E();G;G=E())await G})();let W;const V=new Promise(G=>{W=setTimeout(G,I)});return Promise.race([x,V]).then(()=>clearTimeout(W))}totalPending(){if(this.#r.failed)return!1;if(this.#r.counting===!0)return!0;if(this.#R())return!1;this.#X();const E=this.#r;return E.count===null&&!E.complete&&E.cache.loadedExtent()===0}totalFailed(){return this.#r.failed===!0}#je(E){E.length===this.#u.length&&E.every((A,S)=>A===this.#u[S])||(this.#u=E,this.#z("column:pivoted",{pivotFields:E,remote:!0}))}#Pe(){const E=this.#t.config||{};return E.pivot&&E.pivot.separator||O}#ne(E){const A=this.#Pe(),S=this.#Ee();if(!S.length)return E.slice();const x=[];for(const W of E)for(const V of S)x.push(`${W}${A}${V}`);return x}#Ce(E){const A=this.#Pe();this.#d||(this.#d={keys:new Map,cells:new Map,result:null});const S=this.#d;let x=!1;const W=G=>{const Q=Array.isArray(G)?G:[G],ee=b(Q,A);return S.keys.has(ee)||(S.keys.set(ee,Q),x=!0),ee},V=this.#C("groupBy",[]).length>0;for(const G of Array.isArray(E.axis)?E.axis:[])W(G);for(const G of Array.isArray(E.cells)?E.cells:[]){if(!G||typeof G!="object")continue;const Q=W(G.pivot);if(V&&!(Array.isArray(G.group)&&G.group.length))continue;const ee=b(Array.isArray(G.group)?G.group:[],A);for(const[ne,se]of Object.entries(G.values||{}))S.cells.set(p(ee,Q,ne),se)}S.result=null,x&&this.#je((this.pivot()||{fields:[]}).fields)}#re(E){let A=this.#J(E);for(const S of E.children.values())this.#Ne(S.key)&&(A+=this.#re(S));return A}#J(E){if(E.count!==null)return E.count;const A=E.cache.loadedExtent();return E.complete?A:E.row&&E.row.leafCount>0?E.level>=this.#C("groupBy",[]).length?Math.max(A,E.row.leafCount):A===0?1:Math.min(A+E.cache.pageSize,Math.max(A,E.row.leafCount)):A+E.cache.pageSize}#G(E,A){let S=A,x=0;const W=[...E.children.entries()].filter(([,G])=>this.#Ne(G.key)).sort((G,Q)=>G[0]-Q[0]);for(const[G,Q]of W){const ee=G-x+1;if(S<ee)return{node:E,local:x+S};S-=ee,x=G+1;const ne=this.#re(Q);if(S<ne)return this.#G(Q,S);S-=ne}const V=this.#J(E);return x+S<V?{node:E,local:x+S}:null}#q(E,A){const S=`${E.key}:${A}`,x=this.#a.get(S);if(x)return x;const W=E.cache.rowAt(A);if(W===void 0)return null;const V=this.#C("groupBy",[]);let G;if(E.level<V.length&&!E.flat){const Q=V[E.level],ee=this.#d!==null&&E.level===V.length-1&&this.#C("pivotBy",[]).length>0,ne=this.#le(W,Q),se=ne==null,le=[...E.path,se?"":String(ne)],me=[...E.keyPath,se?null:String(ne)];if(G=this.#l.group({path:le,keyPath:me,column:Q,value:ne,level:E.level,parent:E.row,leafCount:Number(W.leafCount)||0,expanded:ee?!1:this.#Ne(t(me)),...ee?{hasChildren:!1}:{}}),G.totals=this.#F(W),G.data=W,!ee){let ve=this.#s.get(G.key);ve?ve.row=G:(ve=new P(le,E.level+1,this.#n,me),ve.row=G,this.#s.set(ve.key,ve)),ve.values=[...E.values,ne],E.children.set(A,ve)}}else G=this.#l.leaf(W,A,E.level,E.row);return this.#a.set(S,G),this.#c.set(G.key,S),G}#F(E){const A=E||{};if(A.totals&&typeof A.totals=="object")return A.totals;const S={};for(const x of this.#Ee())Object.hasOwn(A,x)&&(S[x]=A[x]);return S}#Me(E,A){const{start:S,end:x}=E.cache.rangeOf(A);for(let W=S;W<x;W++){const V=`${E.key}:${W}`,G=this.#a.peek(V);G&&this.#c.delete(G.key),this.#a.delete(V)}}#X(){const E=this.#de();return E===this.#f?!1:(this.#f=E,this.#o.abortAll("query"),this.#ue(),this.#m=!1,this.#z("model:changed",{reason:"query"}),!0)}#ue(){for(const E of this.#s.values())E.cache.clear(),E.count=null,E.complete=!1,E.announced=null,E.counting=!1,E.failed=!1,E.children.clear(),E.flat=!1;this.#a.clear(),this.#c.clear(),this.#y++,this.#d=null}#de(){const E=this.#C("where",null);return`${n({filters:this.#C("filters",null),sort:this.#C("sort",[]),quick:this.#C("quick",""),groupBy:this.#C("groupBy",[]),pivotBy:this.#C("pivotBy",[]),context:this.#C("context",null)})}|${E?E.version:0}`}#Ne(E){const A=this.#C("expanded",null);return A?z(A.has)?A.has(E):Array.prototype.includes.call(A,E):this.#i.has(E)}#Ee(){const E=this.#C("totals",[]);if(E&&E.length)return[...E];const A=this.#t.columns;return!A||!z(A.all)?[]:A.all().filter(S=>!!S.total).map(S=>S.id)}#ae(E){const A=this.#t.columns,S={};if(!A||!z(A.get))return S;for(const x of E){const W=A.get(x);if(!W)continue;const V=W.groupTotal!=null?W.groupTotal:W.total;typeof V=="string"&&(S[x]=V)}return S}#le(E,A){const S=this.#t.columns,x=S&&z(S.get)?S.get(A):void 0;return x&&z(x.getValue)?x.getValue(E):E?.[A]}#Ie(){u(this.#t)}#_(){const E=this.#t.config||{};return{tz:E.timeZone,weekStartsOn:E.weekStartsOn}}#C(E,A){const S=this.#t.state;if(S&&z(S[E])){const x=S[E]();return x??A}return A}#z(E,A){const S=this.#t.emit;z(S)&&S(E,A)}}}),Ue("packages/core/src/source/gapbuffer.js",function(e,U){"use strict";Object.defineProperty(e,"GapBuffer",{enumerable:!0,get:function(){return C}});const te=64;class C{#e;#t=0;#n=0;constructor(z=te){this.#e=new Uint32Array(Math.max(1,z)),this.#n=this.#e.length}static from(z,B=te){const Z=new C(z.length+Math.max(1,B));return Z.#e.set(z,0),Z.#t=z.length,Z.#n=Z.#e.length,Z}get length(){return this.#t+(this.#e.length-this.#n)}get capacity(){return this.#e.length}at(z){return z<0||z>=this.length?0:z<this.#t?this.#e[z]:this.#e[z+(this.#n-this.#t)]}insert(z,B){const Z=z<0?0:z>this.length?this.length:z;this.#r(Z),this.#t===this.#n&&this.#s(),this.#e[this.#t++]=B}push(z){this.insert(this.length,z)}removeAt(z){return!Number.isInteger(z)||z<0||z>=this.length?!1:(this.#r(z),this.#n++,!0)}toArray(){const z=new Uint32Array(this.length);return z.set(this.#e.subarray(0,this.#t),0),z.set(this.#e.subarray(this.#n),this.#t),z}clear(){this.#t=0,this.#n=this.#e.length}#r(z){if(z!==this.#t)if(z<this.#t){const B=this.#t-z;this.#e.copyWithin(this.#n-B,z,this.#t),this.#t=z,this.#n-=B}else{const B=z-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+B),this.#t=z,this.#n+=B}}#s(){const z=this.#e.length-this.#n,B=new Uint32Array(Math.max(this.#e.length*2,this.#e.length+te));B.set(this.#e.subarray(0,this.#t),0),B.set(this.#e.subarray(this.#n),B.length-z),this.#e=B,this.#n=B.length-z}}}),Ue("packages/core/src/store/ingest.js",function(e,U){"use strict";Object.defineProperty(e,"INGEST_DEFAULTS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"inferKind",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"decideText",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"createReaders",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"Ingest",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return s}});const te=U("packages/core/src/internal/schedule.js"),C=te.now,q=te.nextFrame,z=U("packages/core/src/internal/warn.js"),B=z.infoOnce,Z=z.warnOnce,F=U("packages/core/src/internal/predicates.js").isFunction,H=U("packages/core/src/internal/paths.js").pathGetter,w=U("packages/core/src/store/columnstore.js").ColumnStore,m=Object.freeze({chunkMs:8,chunkRows:512,sampleSize:100,dictionaryRatio:.1,columnarBelow:5e3,initialCapacity:1024});function c(n,u={}){if(u.multi)return"multi";if(n.length===0)return"object";let o=0,a=0,h=0,v=0,g=0;for(let d=0;d<n.length;d++){const p=n[d];typeof p=="number"?o++:typeof p=="boolean"?a++:typeof p=="string"?h++:p instanceof Date?v++:Array.isArray(p)&&g++}const k=n.length;return o===k?"float64":a===k?"bitset":v===k?"float64":h===k?"text":g===k?"multi":"object"}function f(n,u,o){return u<=0||n<o*u?"dictionary":"object"}function l(n,u,o){const a=new Map,h=new Map;for(const D of n){if(D.computed)continue;const _=F(D.read)?D.read:H(D.field||D.id);h.set(D.id,_),a.set(D.id,_)}const v=u?.order??[],g=u?.fns??{},k=u?.deps??{},d=u?.wrapDeps??null,p=v.filter(D=>F(g[D])),b=p.some(D=>k[D]==="*");let O=new WeakMap;const y=D=>{const _={};if(b)for(const[I,L]of h)_[I]=L(D);for(const I of p){const L=k[I];let $;if(L==="*")$=_;else{$={};const P=L||[];for(let N=0;N<P.length;N++){const T=P[N];$[T]=T in _?_[T]:h.get(T)?.(D)}}_[I]=g[I](d?d($,I):$,{data:D,row:null,column:null,grid:null,context:o})}return _},M=D=>{if(D===null||typeof D!="object"&&typeof D!="function")return y(D);let _=O.get(D);return _===void 0&&(_=y(D),O.set(D,_)),_};for(const D of p)a.set(D,_=>M(_)[D]);return{readers:a,reset(){O=new WeakMap}}}class r{spec;read;kind;inferred;nullable;candidate=!1;distinct=null;change=null;reason="";constructor(u,o){this.spec=u,this.read=o,this.kind="object",this.inferred=!1,this.nullable=u.nullable!==!1}}class t{#e;#t=[];#n=null;#r;#s=0;#i;#o=!1;#l=!1;#a=0;#c;constructor(u,o={},a={}){this.#e=Array.isArray(u)?u:Array.from(u||[]),this.#i={...m,...a};const h=o.columns??[];this.#r=l(h,o.computed??null,o.context),this.#c=this.#e.length>=this.#i.columnarBelow,this.#u(h,o.computed??null),this.#n=new w(this.#t.map(v=>({id:v.spec.id,kind:v.kind,nullable:v.nullable,read:v.read,dictionary:v.spec.dictionary})),{initialCapacity:this.#i.initialCapacity,columnarBelow:this.#i.columnarBelow})}get store(){return this.#n}get done(){return this.#o||this.#l}get progress(){return this.#s}slice(){if(this.done)return!1;if(this.#i.signal?.aborted)return this.#l=!0,!1;const u=C(),{chunkMs:o,chunkRows:a}=this.#i,h=this.#e.length;do{const v=Math.min(this.#s+a,h);this.#n.append(this.#e.slice(this.#s,v)),this.#d(this.#s,v),this.#s=v,this.#r.reset(),this.#h(!1)}while(this.#s<h&&C()-u<o);return this.#a+=C()-u,this.#i.onProgress?.({loaded:this.#s,total:h}),this.#s>=h?(this.#h(!0),this.#o=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(u=>({id:u.spec.id,kind:u.kind,nullable:u.nullable,read:u.read,dictionary:u.spec.dictionary})),decisions:this.#t.map(u=>({id:u.spec.id,kind:u.kind,nullable:u.nullable,inferred:u.inferred,distinct:u.candidate||u.change?this.#f(u):null,change:u.change,reason:u.reason})),count:this.#n.count,elapsed:this.#a,cancelled:this.#l}}#u(u,o){const a=this.#e,h=Math.min(this.#i.sampleSize,a.length),v=this.#i.dictionaryRatio,g=o?.pure instanceof Set?o.pure:new Set(o?.pure??o?.order??[]);for(const k of u){if(!k||!k.id)continue;if(k.computed&&(k.pure===!1||o&&!g.has(k.id))){Z(`ingest.impure.${k.id}`,`column "${k.id}" is an impure computed column and is not materialised into the store`);continue}const d=this.#r.readers.get(k.id)??(F(k.read)?k.read:H(k.field||k.id)),p=new r(k,d);if(k.kind)p.kind=k.kind,p.reason="declared by the caller";else if(k.dictionary)p.kind=k.multi?"multi":"dictionary",p.reason="value table supplied (lookup column)";else{const b=[];for(let y=0;y<h&&b.length<this.#i.sampleSize;y++){const M=d(a[y]);M!=null&&b.push(M)}p.inferred=!0;const O=c(b,{multi:k.multi});if(O==="text"){const y=new Set(b).size;p.kind=f(y,b.length,v),p.candidate=this.#c,p.reason=`sampled ${y} distinct in ${b.length}`}else p.kind=O,p.reason=`inferred from ${b.length} sampled values`,O==="object"&&b.length&&B(`ingest.mixed.${k.id}`,`column "${k.id}" holds mixed or unrecognised value types; storing as an object array. Declare a type to avoid this.`);p.kind==="object"&&p.candidate&&(p.distinct=new Set(b))}this.#t.push(p)}}#d(u,o){const a=this.#e;for(const h of this.#t){if(!h.candidate||!h.distinct)continue;const v=h.distinct;for(let g=u;g<o;g++){const k=h.read(a[g]);k!=null&&v.add(k)}}}#f(u){if(u.distinct)return u.distinct.size;const o=this.#n.column(u.spec.id);return o?.dict?o.dict.size:0}#h(u){const o=this.#i.dictionaryRatio,a=this.#e.length;for(const h of this.#t){if(!h.candidate)continue;const v=this.#f(h);if(h.kind==="dictionary"&&v>=o*a){const g=this.#n.column(h.spec.id);h.distinct=new Set(g?.dict?g.dict.values():[]),this.#n.convert(h.spec.id,"object"),h.kind="object",h.change="demoted",h.reason=`${v} distinct values is at or above ${o*100}% of ${a} rows`;continue}if(h.kind==="object"&&v>=o*a){h.candidate=!1,h.distinct=null,h.reason=`${v} distinct values is at or above ${o*100}% of ${a} rows`;continue}u&&h.kind==="object"&&v<o*a&&(this.#n.convert(h.spec.id,"dictionary"),h.kind="dictionary",h.change=h.change==="demoted"?null:"promoted",h.reason=`${v} distinct values is below ${o*100}% of ${a} rows`,h.distinct=null),u&&(h.candidate=!1)}}}async function i(n,u={},o={}){const a=new t(n,u,o),h=o.scheduler?.frame??q;for(;a.slice();)await new Promise(v=>{h(v)});return a.result()}function s(n,u={},o={}){const a=new t(n,u,{...o,chunkMs:1/0});for(;a.slice(););return a.result()}}),Ue("packages/core/src/store/columnpack.js",function(e,U){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return f}});const C=U("packages/core/src/internal/paths.js").pathGetter,q=U("packages/core/src/store/ingest.js"),z=q.inferKind,B=q.decideText,Z=q.INGEST_DEFAULTS,F=U("packages/core/src/store/columnstore.js").toFloat,X=new Set(["float64","int32","bitset","dictionary","object","multi"]);function H(l){if(!Array.isArray(l)||l.length===0)return!1;for(const r of l)if(!r||typeof r.id!="string"||typeof r.field!="string"||r.field===""||r.kind&&!X.has(r.kind))return!1;return!0}function j(l){const r=F(l);return Number.isFinite(r)?r|0:0}function w(l){return l==null?[]:Array.isArray(l)?l:[l]}function m(l,r,t,i){if(l.kind)return l.kind;const s=[];for(let o=0;o<r.length&&s.length<Z.sampleSize;o++){const a=r[o];a!=null&&s.push(a)}const n=z(s,{multi:l.multi});if(n!=="text")return n;const u=new Set(s).size;return B(u,s.length,i)}function c(l,r,t={}){const i=r.length|0,s=t.dictionaryRatio??Z.dictionaryRatio,n=[];for(const u of l){const o=C(u.field||u.id),a=u.nullable!==!1,h=new Array(i);for(let p=0;p<i;p++){const b=o(r[p]);h[p]=b===void 0?null:b}const v=m(u,h,i,s),g=a?new Uint8Array(i+7>>3):null,k=p=>{g&&(g[p>>3]|=1<<(p&7))};let d;switch(v){case"float64":{const p=new Float64Array(i);for(let b=0;b<i;b++){const O=h[b],y=O===null;y||k(b),p[b]=y?NaN:F(O)}d={id:u.id,kind:v,nullable:a,values:p,presence:g,offsets:null,table:null};break}case"int32":{const p=new Int32Array(i);for(let b=0;b<i;b++){const O=h[b],y=O===null;y||k(b),p[b]=y?0:j(O)}d={id:u.id,kind:v,nullable:a,values:p,presence:g,offsets:null,table:null};break}case"bitset":{const p=new Uint8Array(i+7>>3);for(let b=0;b<i;b++){const O=h[b],y=O===null;y||k(b),!y&&O&&(p[b>>3]|=1<<(b&7))}d={id:u.id,kind:v,nullable:a,values:p,presence:g,offsets:null,table:null};break}case"dictionary":{const p=new Uint32Array(i),b=[],O=new Map;for(let y=0;y<i;y++){const M=h[y];if(M===null){p[y]=0;continue}k(y);let D=O.get(M);D===void 0&&(D=b.length,b.push(M),O.set(M,D)),p[y]=D}d={id:u.id,kind:v,nullable:a,values:p,presence:g,offsets:null,table:b};break}case"multi":{const p=[],b=new Map,O=new Uint32Array(i+1),y=[];for(let M=0;M<i;M++){const D=h[M];O[M]=y.length,D===null||k(M);const I=w(D);for(let L=0;L<I.length;L++){const $=I[L];let P=b.get($);P===void 0&&(P=p.length,p.push($),b.set($,P)),y.push(P)}}O[i]=y.length,d={id:u.id,kind:v,nullable:a,values:Int32Array.from(y),presence:g,offsets:O,table:p};break}default:{const p=new Array(i);for(let b=0;b<i;b++){const O=h[b];O!==null&&k(b),p[b]=O}d={id:u.id,kind:"object",nullable:a,values:p,presence:g,offsets:null,table:null};break}}n.push(d)}return{count:i,columns:n}}function f(l){const r=[];if(!l||!Array.isArray(l.columns))return r;const t=i=>{ArrayBuffer.isView(i)&&i.buffer&&!r.includes(i.buffer)&&r.push(i.buffer)};for(const i of l.columns)t(i.values),t(i.presence),t(i.offsets);return r}}),Ue("packages/core/src/source/stream.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_PROMOTE_BELOW",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"createStreamSource",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return P}});const C=U("packages/core/src/internal/lru.js").Lru,z=U("packages/core/src/internal/predicates.js").isFunction,B=U("packages/core/src/internal/schedule.js"),Z=B.now,K=B.nextFrame,F=B.cancelFrame,X=B.whenIdle,j=U("packages/core/src/internal/compare.js").defaultCompare,w=U("packages/core/src/internal/warn.js"),m=w.warnOnce,c=w.infoOnce,l=U("packages/core/src/internal/paths.js").getPath,r=U("packages/core/src/source/abort.js"),t=r.createAbortScope,i=r.isAbortError,s=U("packages/core/src/source/rows.js"),n=s.createRowFactory,u=s.lazyRowView,a=U("packages/core/src/source/gapbuffer.js").GapBuffer,v=U("packages/core/src/source/memory.js").createMemorySource,k=U("packages/core/src/source/filterwire.js").querySignature,p=U("packages/core/src/store/columnpack.js").isPortableSchema,b=25e4,O=Symbol("lattice.stream.storeBacked"),y=8,M=.1,D=1e3,_=50;function I(N){return Math.min(D,Math.max(_,Math.floor(N/4)))}function L(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 E=Date.parse(T);return Number.isNaN(E)?Number(T):E}return NaN}function $(N,T){return new P(N,T)}class P{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#s=[];#i=null;#o;#l;#a=new Map;#c=t();#u={loaded:0,estimated:void 0};#d=null;#f=0;#h=0;#p=0;#m=0;#g=null;#b=null;#y=null;#A=!1;#w=!1;#O=!1;#v=!1;#T="";#S=0;#E=0;#M=0;#P=null;#N=1/0;#R=!1;#$=null;#V=null;#W=null;#D=null;#x=!1;#Y=0;#I=0;#K=!1;constructor(T,E){this.#e=T||{mode:"stream"},this.#t=E||{},this.#o=n(this.#t),this.#l=new C(4096),this.#T=this.#Xe();const A=(this.#t.config||{}).ingest;this.#x=!!A&&A.retainSource===!1,z(this.#e.open)||m("source.stream.open",'source.mode "stream" requires an open function; the grid will stay empty.'),this.#e.autoStart!==!1&&queueMicrotask(()=>this.start());const S=Number(this.#e.poll);Number.isFinite(S)&&S>0&&(this.#D=setInterval(()=>{this.#v||this.reload()},S),this.#D&&z(this.#D.unref)&&this.#D.unref()),this.#B()}#U(){const T=Number(this.#e.maxAge);return Number.isFinite(T)&&T>0?T:0}#B(){const T=this.#U();if(!T)return;const E=this.#e.ageBy;z(E)?this.#V=E:typeof E=="string"&&E?this.#V=A=>l(A,E):this.#V=null,this.#P=[],this.#$=setInterval(()=>{this.#v||this.#ce()&&(this.#X(),this.#he())},I(T)),this.#$&&z(this.#$.unref)&&this.#$.unref()}#ce(){const T=this.#U();return!T||!this.#P?!1:this.#R?!0:this.#N<Date.now()-T*(1+M)}#fe(T,E){if(!this.#P)return;const A=this.#V?L(this.#V(E)):Date.now();this.#P[T]=A,Number.isNaN(A)||(A<this.#N&&(this.#N=A),A<Date.now()-this.#U()&&(this.#R=!0))}#ie(){return this.#ye("groupBy",[]).length>0?!0:!!this.#ye("pivotMode",!1)&&this.#ye("pivotBy",[]).length>0}#Fe(){if(this.#g||this.#v)return;const T=this.#ie();if(T&&!this.#b){this.#b=v({mode:"memory",rows:this.#n},this.#Oe()),this.#A=!1;return}!T&&this.#b&&(this.#b.destroy(),this.#b=null)}#Oe(){if(this.#y)return this.#y;const T=this,E={liveIndices:()=>T.#ge(),live:A=>T.#n[A]!==void 0,source:A=>T.#Le(A),get physical(){return T.#n.length}};return this.#x&&(E.column=A=>{const S=T.#t.store;return S&&z(S.column)?S.column(A):void 0}),this.#y=Object.create(this.#t,{store:{value:E,enumerable:!0,configurable:!0}}),this.#y}#ge(){const T=new Uint32Array(this.#n.length);let E=0;for(let A=0;A<this.#n.length;A++)this.#n[A]!==void 0&&(T[E++]=A);return T.subarray(0,E)}#be(){return this.#g?this.#g:this.#b?(this.#A&&(this.#A=!1,this.#b.setRows(this.#n)),this.#b):null}invalidate(T="filter"){if(this.#g){this.#g.invalidate(T);return}this.#Fe(),this.#b&&this.#b.invalidate(T),(T==="filter"||T==="sort")&&this.#Ee()}count(){const T=this.#be();return T?T.count():this.#r?this.#r.length:this.#S}matchCount(){const T=this.#be();return T&&z(T.matchCount)?T.matchCount():this.#r?this.#r.length:this.#S}totalCount(){const T=this.#be();return T&&z(T.totalCount)?T.totalCount():this.#S}unfilteredRows(){const T=this.#be();if(T&&z(T.unfilteredRows))return T.unfilteredRows();const E=[];for(let A=0;A<this.#n.length;A++){if(!this.#n[A])continue;const S=this.#ve(A);S&&E.push(S)}return E}at(T){const E=this.#be();if(E)return E.at(T);if(T<0||T>=this.count())return;const A=this.#r?this.#r.at(T):T,S=this.#ve(A);return S.index=T,S}byKey(T){const E=this.#be();if(E)return E.byKey(T);const A=this.#a.get(T);return A===void 0?void 0:this.#ve(A)}leavesOf(T){const E=this.#be();return E&&z(E.leavesOf)?E.leavesOf(T):[]}loaded(T){return T>=0&&T<this.count()}hint(T,E){if(this.#g){this.#g.hint(T,E);return}this.#je(),this.#p=Math.max(0,Math.floor(T))}#je(){this.#v||this.#Xe()===this.#T||this.reload()}display(){const T=this.#be();return T?T.display():u(()=>this.count(),E=>this.at(E))}apply(T){if(this.#g)return this.#g.apply(T);const E={added:[],updated:[],removed:[]};if(!T)return E;if(T.update){let A=!1;for(const S of T.update){const x=this.#a.get(this.#o.keyOf(S,-1));if(x===void 0)continue;const W=this.#Ie(x);this.#x?this.#k(x,S):this.#n[x]=S,this.#l.delete(x),this.#_(x,W),this.#P&&(this.#fe(x,S),A=!0),this.#A=!0,E.updated.push(this.#ve(x))}A&&this.#X()}if(T.add&&T.add.length){const A=this.#F(T.add);for(const S of A)E.added.push(this.#ve(S))}return T.remove&&T.remove.length&&m("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#he(),E}reload(T){this.#c.abortAll("reload"),this.#Be(),this.#b&&(this.#b.destroy(),this.#b=null),this.#A=!1,this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear(),this.#g=null,this.#S=0,this.#E=0,this.#M=0,this.#P&&(this.#P=[]),this.#N=1/0,this.#R=!1,this.#w=!1,this.#O=!1,this.#u={loaded:0,estimated:void 0},this.#T=this.#Xe(),this.#ke("model:changed",{reason:"reload"}),this.start()}destroy(){this.#v=!0,this.#D!==null&&(clearInterval(this.#D),this.#D=null),this.#$!==null&&(clearInterval(this.#$),this.#$=null),this.#P=null,this.#c.abortAll("destroyed"),this.#Be(),this.#d!==null&&(this.#Ue(this.#d),this.#d=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.#O||this.#v||!z(this.#e.open))return;this.#O=!0;const T=this.#c.begin("stream");this.#Ee(),this.#Fe();let E;try{E=this.#e.open({sort:this.#ye("sort",[]),filters:this.#ye("filters",null),quick:this.#ye("quick","")||void 0,context:this.#ye("context",null),signal:T.signal})}catch(S){this.#ke("source:error",{error:S});return}const A=z(E[Symbol.asyncIterator])?E[Symbol.asyncIterator]():E[Symbol.iterator]();this.#W=A;try{for(;;){const S=await A.next();if(!T.current||this.#v)return;if(S.done){this.#oe();return}if(await this.#Pe(S.value,T),!T.current||this.#v)return;if(S.value&&S.value.done){this.#oe();return}if(await this.#se(),!T.current||this.#v)return}}catch(S){if(i(S))return;this.#ke("source:error",{error:S})}finally{T.settle()}}progress(){return{loaded:this.#u.loaded,estimated:this.#u.estimated,done:this.#w,live:this.#S,evicted:this.#E}}promoted(){return this.#g!==null}memorySource(){return this.#g}invalidateHandles(){const T=this.#be();T&&(z(T.invalidateHandles)&&T.invalidateHandles(),z(T.invalidate)&&T.invalidate("sort"))}renderCount(){return this.#f}ingestStats(){return{worker:this.#Y,inline:this.#I,storeBacked:this.#x}}#Pe(T,E){if(!T)return;const A=T.rows;if(A&&A.length&&this.#Ce(A))return this.#J(T,E);const S=Z();A&&A.length&&(this.#F(A),this.#I++),this.#ne(T),this.#h+=Z()-S,this.#he()}#ne(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)}#Ce(T){if(this.#K||this.#g)return!1;const E=this.#G();if(!E)return!1;const A=this.#t.store;if(!A||!z(A.appendPacked))return!1;const S=this.#q();return!S||!p(S)?(this.#K=!0,c("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<E.threshold?!1:!this.#re(T)}#re(T){if(!this.#o.keyed)return!1;const E=new Set;for(let A=0;A<T.length;A++){const S=this.#o.keyOf(T[A],this.#n.length+A);if(S!=null){if(E.has(S)||this.#a.has(S))return!0;E.add(S)}}return!1}async#J(T,E){const A=T.rows,S=this.#G(),x=this.#q();let W;try{W=await S.columnize(x,A,{key:"ingest:stream",signal:E&&E.signal})}catch(ne){if(i(ne)||(m("source.stream.columnize","worker columnization failed; columnizing on the main thread",ne),this.#K=!0,E&&(!E.current||this.#v)))return;this.#F(A),this.#I++,this.#ne(T),this.#he();return}if(E&&(!E.current||this.#v))return;const V=this.#t.store,G=this.#x?void 0:A,{from:Q}=V.appendPacked(W,G),ee=W.count|0;for(let ne=0;ne<ee;ne++){const se=Q+ne,le=A[ne],me=this.#o.keyed?this.#o.keyOf(le,se):null;if(this.#n[se]=this.#x?O:le,this.#S++,this.#fe(se,le),me!==null&&this.#a.set(me,se),!this.#r||!this.#ae(se))continue;const ve=this.#C(se);this.#r.insert(ve,se),ve<=this.#p&&this.#m++}this.#A=!0,this.#X(),this.#Y++,this.#ne(T),this.#he()}#G(){const T=this.#t.ingestWorker;return z(T)?T():null}#q(){const T=this.#t.storeSchema;return z(T)?T():null}#F(T){const E=[],A=this.#t.store,S=new Array(T.length),x=[],W=new Set;for(let G=0;G<T.length;G++){const Q=this.#o.keyed?this.#o.keyOf(T[G],this.#n.length+x.length):null;S[G]=Q,!(Q!==null&&(this.#a.has(Q)||W.has(Q)))&&(Q!==null&&W.add(Q),x.push(T[G]))}let V=x.length&&A&&z(A.append)?A.append(x).from:this.#n.length;for(let G=0;G<T.length;G++){const Q=T[G],ee=S[G];if(ee!==null&&this.#a.has(ee)){const le=this.#a.get(ee),me=this.#Ie(le);this.#x||(this.#n[le]=Q,A&&z(A.setSource)&&A.setSource(le,Q)),this.#k(le,Q),this.#l.delete(le),this.#fe(le,Q),this.#_(le,me);continue}const ne=V++;if(this.#n[ne]=this.#x?O:Q,this.#S++,this.#fe(ne,Q),ee!==null&&this.#a.set(ee,ne),E.push(ne),!this.#r||!this.#ae(ne))continue;const se=this.#C(ne);this.#r.insert(se,ne),se<=this.#p&&this.#m++}return this.#A=!0,this.#X(),E}#Me(T){const E=this.#n[T];let A=!1;if(this.#r){const V=this.#Ne(T);V>=0&&V<=this.#p&&(A=!0)}else T<=this.#p&&(A=!0);const S=E===O?this.#Le(T):E,x=this.#o.keyed?this.#o.keyOf(S,T):null;x!==null&&this.#a.get(x)===T&&this.#a.delete(x),this.#n[T]=void 0,this.#P&&(this.#P[T]=NaN),this.#l.delete(T);const W=this.#t.store;return W&&z(W.remove)&&W.remove(T),this.#S--,A}#X(){let T=0,E=0;const A=this.#de();T+=A.dropped,E+=A.aboveAnchor;const S=this.#ue();T+=S.dropped,E+=S.aboveAnchor,T&&(this.#A=!0,this.#E+=T,this.#Ee(),this.#m-=E,this.#ke("stream:evicted",{evicted:T,total:this.#E,live:this.#S}))}#ue(){const T=this.#e.maxRows;if(!Number.isFinite(T)||T<=0||this.#S<=T)return{dropped:0,aboveAnchor:0};const E=Math.max(1,Math.floor(T*(1-M)));let A=0,S=0;for(;this.#S>E&&this.#M<this.#n.length;){const x=this.#M++;this.#n[x]!==void 0&&(this.#Me(x)&&S++,A++)}return{dropped:A,aboveAnchor:S}}#de(){const T=this.#U();if(!T||!this.#P||!this.#ce())return{dropped:0,aboveAnchor:0};const E=Date.now()-T;let A=0,S=0,x=1/0;for(let W=this.#M;W<this.#n.length;W++){if(this.#n[W]===void 0)continue;const V=this.#P[W];if(!(Number.isNaN(V)||V===void 0)){if(V>=E){V<x&&(x=V);continue}this.#Me(W)&&S++,A++}}for(this.#N=x,this.#R=!1;this.#M<this.#n.length&&this.#n[this.#M]===void 0;)this.#M++;return{dropped:A,aboveAnchor:S}}#Ne(T){if(!this.#r)return T;for(let E=0;E<this.#r.length;E++)if(this.#r.at(E)===T)return E;return-1}#Ee(){this.#s=this.#ye("sort",[]),this.#i=this.#ye("filters",null);const T=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#U()>0,E=this.#ye("where",null),A=(this.#t.config||{}).hostFilter,S=!!(E&&E.active)||!!(A&&z(A.active)&&A.active());if(!(T||this.#s.length>0||!!this.#i||!!this.#ye("quick","")||S)){this.#r=null;return}this.#r=new a(Math.max(64,this.#n.length+64));for(let W=0;W<this.#n.length;W++)this.#n[W]!==void 0&&this.#ae(W)&&this.#r.insert(this.#C(W),W)}#ae(T){const E=this.#Le(T);if(this.#i&&!this.#le(this.#i,E))return!1;const A=String(this.#ye("quick","")||"").toLowerCase();if(A&&!this.#st(E).includes(A))return!1;const S=(this.#t.config||{}).hostFilter;if(S&&z(S.active)&&S.active()&&!S.passes(this.#ve(T)))return!1;const x=this.#ye("where",null);if(x&&x.active){const W=this.#ve(T);if(!x.passes(W.data,W.key))return!1}return!0}#le(T,E){if(!T)return!0;const A=T;if(Array.isArray(A.conditions))return A.op==="or"?A.conditions.some(W=>this.#le(W,E)):A.op==="not"?!A.conditions.some(W=>this.#le(W,E)):A.conditions.every(W=>this.#le(W,E));const S=T,x=(this.#t.compute||{}).testValue;return z(x)?!!x(this.#Re(E,S.col),S,(this.#t.config||{}).locale):(m("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#Ie(T){if(!this.#r)return-1;if(!this.#s.length)return this.#Ne(T);let E=0,A=this.#r.length;for(;E<A;){const S=E+A>>>1;this.#z(this.#r.at(S),T)<0?E=S+1:A=S}for(let S=E;S<this.#r.length;S++){const x=this.#r.at(S);if(x===T)return S;if(this.#z(x,T)>0)break}return this.#Ne(T)}#_(T,E){if(!this.#r||!this.#s.length)return;const A=this.#ae(T);if(E>=0&&this.#r.at(E)===T)this.#r.removeAt(E),E<=this.#p&&this.#m--;else if(E>=0)return;if(!A)return;const S=this.#C(T);this.#r.insert(S,T),S<=this.#p&&this.#m++}#C(T){if(!this.#r||!this.#s.length)return this.#r?this.#r.length:0;let E=0,A=this.#r.length;for(;E<A;){const S=E+A>>>1;this.#z(T,this.#r.at(S))<0?A=S:E=S+1}return E}#z(T,E){const A=this.#Le(T),S=this.#Le(E);for(const x of this.#s){const W=this.#He(x.col),V=this.#Re(A,x.col),G=this.#Re(S,x.col),ee=(W&&W.value&&z(W.value.compare)?W.value.compare:j)(V,G);if(ee!==0)return x.dir==="desc"?-ee:ee}return 0}#oe(){this.#w=!0,this.#u.loaded=this.#u.loaded||this.#n.length;const T=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:b;!this.#x&&this.#n.length<T&&(this.#g=v({mode:"memory",rows:this.#n},this.#t),this.#$!==null&&(clearInterval(this.#$),this.#$=null),this.#b&&(this.#b.destroy(),this.#b=null)),this.#he(),this.#ke("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:T})}#he(){this.#d!==null||this.#v||(this.#d=this.#me(()=>{this.#d=null,this.#f++;const T=this.#m;this.#m=0,this.#h=0,this.#ke("stream:chunk",{loaded:this.#u.loaded,estimated:this.#u.estimated,count:this.count(),renders:this.#f}),this.#ke("model:changed",{reason:"stream",shiftAboveViewport:T,anchor:this.#p}),this.#ke("rows:changed",{companion:!0,reason:"stream"})}))}#se(){return this.#f===0||this.#h<this.#pe()?Promise.resolve():(this.#h=0,new Promise(T=>{const E=(this.#t.scheduler||{}).idle;z(E)?E(()=>T()):X(()=>T())}))}#pe(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:y}#me(T){const E=this.#t.scheduler||{};return z(E.frame)?E.frame(T):K(T)}#Ue(T){const E=this.#t.scheduler||{};z(E.cancel)?E.cancel(T):F(T)}#Le(T){const E=this.#n[T];if(E!==void 0&&E!==O)return E;if(E===void 0)return;const A=this.#t.store;return A&&z(A.source)?A.source(T):void 0}#k(T,E){const A=this.#t.store;if(!A||!z(A.set))return;const S=this.#q();if(Array.isArray(S))for(const x of S){if(!x||!x.id)continue;const W=z(x.read)?x.read:V=>l(V,x.field||x.id);A.set(x.id,T,W(E))}}#ve(T){let E=this.#l.get(T);return E||(E=this.#o.leaf(this.#Le(T),T),this.#l.set(T,E)),E}#Re(T,E){const A=this.#He(E);return A&&z(A.getValue)?A.getValue(T):T?.[E]}#st(T){const E=this.#t.columns,A=E&&z(E.all)?E.all():[],S=[];for(const x of A){const W=z(x.getValue)?x.getValue(T):void 0;W!=null&&W!==""&&S.push(String(W))}return S.join(" ").toLowerCase()}#He(T){const E=this.#t.columns;return E&&z(E.get)?E.get(T):void 0}#Be(){const T=this.#W;if(this.#W=null,T&&z(T.return))try{T.return()}catch{}}#Xe(){return k({context:this.#ye("context",null)})}#ye(T,E){const A=this.#t.state;if(A&&z(A[T])){const S=A[T]();return S??E}return E}#ke(T,E){const A=this.#t.emit;z(A)&&A(T,E)}}}),Ue("packages/core/src/source/url.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return m}});const C=U("packages/core/src/internal/warn.js").warnOnce,q=U("packages/core/src/internal/predicates.js"),z=q.isObject,B=q.isFunction,K=U("packages/core/src/internal/paths.js").getPath,X=U("packages/core/src/source/abort.js").isAbortError,H=500,j=new Set(["application/x-ndjson","application/ndjson","application/jsonlines","application/jsonl","application/x-jsonlines","text/x-ndjson"]),w=Symbol("lattice.url.skip");function m(g,k={}){const d=z(k)?k:{},p=B(d.fetch)?d.fetch:typeof globalThis<"u"&&B(globalThis.fetch)?globalThis.fetch:null,b=d.format==="json"||d.format==="ndjson"?d.format:void 0,O=typeof d.rowsPath=="string"&&d.rowsPath?d.rowsPath:void 0,y=B(d.map)?d.map:void 0,M=z(d.headers)?d.headers:void 0,D=Number.isFinite(d.batchSize)&&d.batchSize>0?Math.floor(d.batchSize):H,_=d.lenient===!0,I=Number.isFinite(d.poll)&&d.poll>0?Math.floor(d.poll):void 0,L=typeof g=="string"&&g.length>0;L||C("source.url.url","createUrlSource needs a URL string; the grid will stay empty.");async function*$(N={}){if(!L)return;if(!p)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const T=N&&N.signal;let E;try{E=await p(g,M?{signal:T,headers:M}:{signal:T})}catch(x){throw X(x)?x:new Error(`[lattice] createUrlSource: request to ${g} failed — ${x&&x.message||x}`)}if(!E||!E.ok){const x=E?E.status:"no response";throw new Error(`[lattice] createUrlSource: ${x} for ${g}`)}const A=c(g,b,E),S=E.body&&B(E.body.getReader)?E.body.getReader():null;try{if(!S){const V=await E.text();(A||r(V,g))==="ndjson"?yield*o(null,null,V,0,E,g,D,_):yield*u(V,g,O,y);return}const x=new TextDecoder("utf-8");if(A==="json"){yield*u(await n(S,x,""),g,O,y);return}if(A==="ndjson"){yield*o(S,x,"",0,E,g,D,_);return}const W=await t(S,x,g);W.format==="json"?yield*u(await n(S,x,W.seed),g,O,y):yield*o(S,x,W.seed,W.bytes,E,g,D,_)}finally{if(S&&B(S.cancel))try{await S.cancel()}catch{}}}const P={mode:"stream",open:$,autoStart:d.autoStart!==!1};return I!==void 0&&(P.poll=I),Number.isFinite(d.maxRows)&&(P.maxRows=d.maxRows),Number.isFinite(d.maxAge)&&(P.maxAge=d.maxAge),(typeof d.ageBy=="string"||B(d.ageBy))&&(P.ageBy=d.ageBy),Number.isFinite(d.coalesceMs)&&(P.coalesceMs=d.coalesceMs),Number.isFinite(d.promoteToMemoryBelow)&&(P.promoteToMemoryBelow=d.promoteToMemoryBelow),P}function c(g,k,d){if(k)return k;const p=f(g);if(p)return p;const b=d&&d.headers&&B(d.headers.get)?d.headers.get("content-type"):null;return l(b)}function f(g){const k=String(g).split(/[?#]/)[0].toLowerCase();if(k.endsWith(".ndjson")||k.endsWith(".jsonl"))return"ndjson";if(k.endsWith(".json"))return"json"}function l(g){if(!g)return;const k=g.split(";")[0].trim().toLowerCase();if(j.has(k))return"ndjson";if(k==="application/json"||k==="text/json"||k.endsWith("+json"))return"json"}function r(g,k){const d=g.replace(/^\s+/,""),p=i(d);if(p==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${k} — pass opts.format: 'json' | 'ndjson'.`);return p}async function t(g,k,d){let p="",b=0;for(;;){const{value:y,done:M}=await g.read();if(y&&(b+=y.byteLength,p+=k.decode(y,{stream:!0})),M){p+=k.decode();break}const D=p.replace(/^\s+/,"");if(D){if(D[0]==="[")return{format:"json",seed:p,bytes:b};if(D[0]!=="{"||p.indexOf(`
|
|
8
8
|
`)!==-1)break}}const O=i(p.replace(/^\s+/,""));if(O==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${d} — pass opts.format: 'json' | 'ndjson'.`);return{format:O,seed:p,bytes:b}}function i(g){if(!g||g[0]==="[")return"json";if(g[0]!=="{")return"error";const k=g.indexOf(`
|
|
9
9
|
`);if(k===-1)return"json";let d=g.slice(0,k);return d.endsWith("\r")&&(d=d.slice(0,-1)),s(d)?"ndjson":"json"}function s(g){try{return JSON.parse(g),!0}catch{return!1}}async function n(g,k,d){let p=d;for(;;){const{value:b,done:O}=await g.read();if(b&&(p+=k.decode(b,{stream:!0})),O)break}return p+=k.decode(),p}function*u(g,k,d,p){let b;try{b=JSON.parse(g)}catch(y){throw new Error(`[lattice] createUrlSource: ${k} is not valid JSON — ${y.message}`)}let O=d!==void 0?K(b,d):b;if(p&&(O=p(O)),!Array.isArray(O)){const y=d!==void 0||p?"":"; pass opts.rowsPath or opts.map to select the array";throw new Error(`[lattice] createUrlSource: ${k} did not resolve to an array${y}.`)}yield{rows:O,progress:{loaded:O.length,estimated:O.length}}}async function*o(g,k,d,p,b,O,y,M){const D=v(b);let _=d||"",I=p||0,L=0,$=0,P=[];function*N(){let E;for(;(E=_.indexOf(`
|
|
10
10
|
`))!==-1;){const A=_.slice(0,E);_=_.slice(E+1),$++;const S=a(A,$,O,M);S!==w&&(P.push(S),P.length>=y&&(L+=P.length,yield h(P,L,D,I),P=[]))}}if(g){for(;;){const{value:E,done:A}=await g.read();if(E&&(I+=E.byteLength,_+=k.decode(E,{stream:!0}),yield*N()),A)break}_+=k.decode()}yield*N(),$++;const T=a(_,$,O,M);T!==w&&P.push(T),P.length&&(L+=P.length,yield h(P,L,D,I))}function a(g,k,d,p){let b=g;if(b.endsWith("\r")&&(b=b.slice(0,-1)),!b.trim())return w;try{return JSON.parse(b)}catch(O){if(p)return C(`source.url.badline.${d}`,`skipping a malformed NDJSON line (line ${k}) from ${d} — ${O.message}`),w;throw new Error(`[lattice] createUrlSource: malformed NDJSON at line ${k} of ${d} — ${O.message}`)}}function h(g,k,d,p){const b=d&&p>0&&k>0?Math.max(k,Math.round(d/(p/k))):void 0;return{rows:g,progress:{loaded:k,estimated:b}}}function v(g){const k=g&&g.headers&&B(g.headers.get)?g.headers.get("content-length"):null,d=k!=null?Number(k):NaN;return Number.isFinite(d)&&d>0?d:void 0}}),Ue("packages/core/src/source/derive.js",function(e,U){"use strict";Object.defineProperty(e,"FOLLOW_MODES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"BUCKETS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DERIVED_ROW_KEY",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"DERIVED_SOURCE_KEY",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"UNION_KEY_SEP",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"readPath",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"unnest",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"reduceValues",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"applyLimit",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"applyCumulative",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"groupRows",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"finishGroups",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"derive",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"normalizeUnionSource",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"namespaceUnionKeys",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"joinRows",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"preGroup",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"buildJoinIndex",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"joinOne",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"joinKeyOf",{enumerable:!0,get:function(){return b}});const te=U("packages/core/src/internal/predicates.js"),C=te.isFunction,q=te.isObject,B=U("packages/core/src/compute/total.js").TOTAL_FNS,Z=Object.freeze(["filtered","all","selected","grouped"]),K=Object.freeze(["day","week","month","quarter","year"]),F="__key",X="__source",H="";function j(O,y){if(!q(O)||typeof y!="string")return;if(!y.includes("."))return O[y];let M=O;for(const D of y.split(".")){if(!q(M))return;M=M[D]}return M}function w(O,y){const M=[];for(const D of O){const _=j(D,y);if(!(!Array.isArray(_)||!_.length))for(const I of _)M.push({...D,[y]:I})}return M}function m(O,y){const M=O instanceof Date?O:new Date(O),D=M.getTime();if(!Number.isFinite(D))return null;const _=M.getUTCFullYear(),I=M.getUTCMonth(),L=M.getUTCDate(),$=P=>P.toISOString().slice(0,10);switch(y){case"year":return $(new Date(Date.UTC(_,0,1)));case"quarter":return $(new Date(Date.UTC(_,Math.floor(I/3)*3,1)));case"month":return $(new Date(Date.UTC(_,I,1)));case"week":{const P=(M.getUTCDay()+6)%7;return $(new Date(Date.UTC(_,I,L-P)))}default:return $(new Date(Date.UTC(_,I,L)))}}function c(O,y,M){const D=y.map(_=>M&&M.of===_?m(j(O,_),M.by):j(O,_));return{key:D.map(_=>_==null?"\0":String(_)).join(""),values:D}}function f(O,y){const M=B[y];return M?M({get:D=>O[D]},t(O.length)):null}function l(O,y){return!y||typeof y.of!="string"||y.of===""||O&&O.includes(y.of)?O:[y.of,...O||[]]}function r(O,y){const M={},D=t(O.length);for(const[_,I]of Object.entries(y)){const L=I.fn||"count",$=B[L];if(!$){M[_]=null;continue}const P=I.of?O.map(N=>j(N,I.of)):[];M[_]=$({get:N=>P[N]},D)}return M}const t=(()=>{const O=new Map;return y=>{let M=O.get(y);if(!M){M=new Uint32Array(y);for(let D=0;D<y;D++)M[D]=D;O.size<512&&O.set(y,M)}return M}})();function i(O,y,M){if(!Number.isFinite(y)||y<=0)return O;if(!M)return O.slice(0,y);const D=new Map,_=[];for(const I of O){const L=String(j(I,M)),$=D.get(L)||0;$>=y||(D.set(L,$+1),_.push(I))}return _}function s(O,y){const M=O.reduce((L,$)=>L+(Number(j($,y.of))||0),0);if(!M)return O;const D=M*y.upTo;let _=0;const I=[];for(const L of O)if(I.push(L),_+=Number(j(L,y.of))||0,_>=D)break;return I}function n(O,y){return!Array.isArray(y)||!y.length?O:[...O].sort((M,D)=>{for(const _ of y){const I=j(M,_.col),L=j(D,_.col);if(I===L)continue;return I==null?1:L==null?-1:((typeof I=="number"&&typeof L=="number"?I<L:String(I)<String(L))?-1:1)*(_.dir==="desc"?-1:1)}return 0})}function u(O,y,M){const D=y.groupBy?Array.isArray(y.groupBy)?y.groupBy:[y.groupBy]:null,_=q(y.bucket)?y.bucket:null,I=l(D,_),L=new Map,$=new Map;if(!I)return{groups:L,rowGroup:$};for(const P of O){const{key:N,values:T}=c(P,I,_);let E=L.get(N);E||(E={values:T,rows:new Map},L.set(N,E));const A=M(P);E.rows.set(A,P),$.set(A,N)}return{groups:L,rowGroup:$}}function o(O,y,M=null,D=null){const _=y.groupBy?Array.isArray(y.groupBy)?y.groupBy:[y.groupBy]:null,I=q(y.bucket)?y.bucket:null,L=l(_,I);let $=[...O.entries()].map(([P,N])=>{if(M&&D&&!D.has(P)){const E=M.get(P);if(E)return E}const T={[F]:P};return L.forEach((E,A)=>{T[E.includes(".")?E.split(".").pop():E]=N.values[A]}),Object.assign(T,r([...N.rows.values()],y.select||{})),M&&M.set(P,T),T});return $=n($,y.sort),q(y.cumulative)&&($=s($,y.cumulative)),i($,y.limit,y.limitPer||null)}function a(O,y){const M=k(O,y),D=y.groupBy?Array.isArray(y.groupBy)?y.groupBy:[y.groupBy]:null,_=q(y.bucket)?y.bucket:null,I=l(D,_);let L;if(!I)L=M.map(($,P)=>({...$,[F]:String(j($,y.rowKey||"id")??P)}));else{const $=new Map;for(const P of M){const{key:N,values:T}=c(P,I,_);let E=$.get(N);E||(E={values:T,rows:[]},$.set(N,E)),E.rows.push(P)}L=[...$.entries()].map(([P,N])=>{const T={[F]:P};return I.forEach((E,A)=>{T[E.includes(".")?E.split(".").pop():E]=N.values[A]}),Object.assign(T,r(N.rows,y.select||{})),T})}return L=n(L,y.sort),q(y.cumulative)&&(L=s(L,y.cumulative)),i(L,y.limit,y.limitPer||null)}function h(O,y){const D=q(O)&&q(O.grid)?O:{grid:O};return{grid:q(D.grid)?D.grid:null,label:D.label!=null&&D.label!==""?String(D.label):String(y),follow:typeof D.follow=="string"?D.follow:void 0,map:C(D.map)?D.map:null}}function v(O){for(const y of O){const M=y[X];M!==void 0&&(y[F]=`${M}${H}${y[F]}`)}return O}function g(O,y){const M=y.on,D=q(M)?String(M.left||M.right||""):String(M||""),_=q(M)?String(M.right||M.left||""):String(M||"");if(!D||!_)return O;const I=y.index instanceof Map?y.index:d(Array.isArray(y.rows)?y.rows:[],_),L=Array.isArray(y.select)?y.select.map(String):null,$=y.prefix?String(y.prefix):"",P=String(y.type||"inner")==="left",N=[];for(const T of O){const E=j(T,D),A=E==null?void 0:I.get(String(E));if(!A){P&&N.push(T);continue}const S={...T},x=L||Object.keys(A);for(const W of x)!$&&W===D||(S[$?$+W:W]=j(A,W));N.push(S)}return N}function k(O,y){let M=Array.isArray(O)?O:[];return y.unnest&&(M=w(M,y.unnest)),q(y.join)&&(Array.isArray(y.join.rows)||y.join.index instanceof Map)&&(M=g(M,y.join)),C(y.where)&&(M=M.filter(D=>!!y.where(D))),M}function d(O,y){const M=new Map;for(const D of O){const _=j(D,y);if(_==null)continue;const I=String(_);M.has(I)||M.set(I,D)}return M}function p(O,y){const M=y.on,D=q(M)?String(M.left||M.right||""):String(M||""),_=q(M)?String(M.right||M.left||""):String(M||"");if(!D||!_)return O;const I=y.index instanceof Map?y.index:new Map,L=j(O,D),$=L==null?void 0:I.get(String(L));if(!$)return String(y.type||"inner")==="left"?O:null;const P=Array.isArray(y.select)?y.select.map(String):null,N=y.prefix?String(y.prefix):"",T={...O};for(const E of P||Object.keys($))!N&&E===D||(T[N?N+E:E]=j($,E));return T}function b(O,y){const M=j(O,y);return M==null?null:String(M)}}),Ue("packages/core/src/source/derived.js",function(e,U){"use strict";Object.defineProperty(e,"IDLE_REFRESH_MS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"PROFILE_FIELDS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ALERT_THRESHOLDS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"STATISTICS_FNS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"SERIES_METRICS",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"PRODUCER_IGNORED_KEYS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"profileAlerts",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"DerivedSource",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"createDerivedSource",{enumerable:!0,get:function(){return _}});const te=U("packages/core/src/internal/predicates.js"),C=te.isFunction,q=te.isObject,B=U("packages/core/src/internal/warn.js").warnOnce,K=U("packages/core/src/source/memory.js").MemorySource,X=U("packages/core/src/source/settle.js").isPipelineSettle,H=U("packages/core/src/source/derive.js"),j=H.derive,w=H.preGroup,m=H.groupRows,c=H.finishGroups,f=H.readPath,l=H.buildJoinIndex,r=H.joinOne,t=H.joinKeyOf,i=H.FOLLOW_MODES,s=H.DERIVED_ROW_KEY,n=H.DERIVED_SOURCE_KEY,u=H.normalizeUnionSource,o=H.namespaceUnionKeys,a=16,h=Object.freeze(["column","rows","present","missing","numeric","distinct","min","max","mean","median","q1","q3","iqr","stddev","outliers","alerts","alertCount"]),v=Object.freeze({missing:.2,cardinality:.9,skew:1,outliers:.05}),g=Object.freeze(["correlation","series","datasetVsDataset"]),k=Object.freeze(["n","first","last","change","changePercent","volatility","annualisedVolatility","growth","maxDrawdown","maxDrawdownFrom","maxDrawdownTo","autocorrelation","upDays","downDays"]),d=Object.freeze(["unnest","join","where","bucket","groupBy","select","sort","limit","limitPer","cumulative"]);function p(I,L={}){const $={...v,...q(L)?L:{}},P=ee=>typeof ee=="number"&&Number.isFinite(ee)?ee:null,N=P(I.rows)??0,T=P(I.numeric)??0,E=P(I.missing)??0,A=P(I.distinct),S=P(I.mean),x=P(I.median),W=P(I.stddev),V=P(Array.isArray(I.outliers)?I.outliers.length:I.outliers),G=T>0,Q=[];return A===0?["empty"]:(A===1&&Q.push("constant"),N>0&&E/N>=$.missing&&Q.push("high-missing"),!G&&A!==null&&N>1&&A===N&&E===0?Q.push("unique"):A!==null&&N>0&&A/N>=$.cardinality&&Q.push("high-cardinality"),G&&S!==null&&x!==null&&W!==null&&W>0&&Math.abs(3*(S-x)/W)>=$.skew&&Q.push("skewed"),G&&V!==null&&V/T>=$.outliers&&Q.push("outliers"),Q)}class b extends K{#e=null;#t={};#n=[];#r=null;#s=!1;#i={};#o=!1;#l=null;#a=null;#c=!1;#u=null;#d=!1;#f=null;constructor(L,$){super({mode:"memory",rows:[]},$),this.#i=$||{},this.#t=q(L)?L:{};const P=this.#t.from;if(Array.isArray(P)){if(this.#e=null,this.#f=this.#g(P),!this.#f.length){B("source.derived.from",'source.mode "derived" needs `from`: at least one grid to derive from.');return}this.#t.follow!==void 0&&B("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&&B("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&&(B("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.#d=!0),this.#m(),this.#b(),this.refresh();return}if(this.#e=P||null,!this.#e){B("source.derived.from",'source.mode "derived" needs `from`: the grid to derive from.');return}this.#t.follow&&!i.includes(String(this.#t.follow))&&B(`source.derived.follow.${this.#t.follow}`,`unknown follow "${this.#t.follow}"; using "filtered". Known: ${i.join(", ")}.`),this.#h()||(this.#d=!0),this.#m(),this.#b(),this.refresh()}#h(){const L=this.#t.statistics;if(L===void 0)return!0;if(this.#t.profile!==void 0)return B("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(!q(L))return B("source.derived.statistics.shape",`source.mode "derived": \`statistics\` needs an object naming the statistic, e.g. \`{ fn: 'correlation', columns: ['a', 'b'] }\`. Known fn: ${g.join(", ")}.`),!1;const $=String(L.fn||"");return g.includes($)?this.#p($,L):(B(`source.derived.statistics.fn.${$}`,`source.mode "derived": unknown \`statistics.fn\` "${$}". Known: ${g.join(", ")}. Every *single-column* statistic is reached through \`select\` instead, e.g. \`select: { p95: { of: 'amount', fn: 'p95' } }\`.`),!1)}#p(L,$){if(L==="correlation"){if((Array.isArray($.columns)?$.columns.filter(Boolean):[]).length<2)return B("source.derived.statistics.columns","source.mode \"derived\": `statistics: { fn: 'correlation' }` needs `columns`: at least two column ids to correlate pairwise."),!1;const N=$.orient===void 0?"pairs":String($.orient);return N!=="pairs"&&N!=="matrix"&&B(`source.derived.statistics.orient.${N}`,`source.mode "derived": unknown \`statistics.orient\` "${N}" for \`fn: 'correlation'\`; using "pairs". Known: pairs, matrix.`),!0}return L==="series"?!$.of||!$.by?(B("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:q($.with)?!0:(B("source.derived.statistics.with","source.mode \"derived\": `statistics: { fn: 'datasetVsDataset' }` needs `with`: the second grid to compare this one against."),!1)}#m(){const L=this.#t.statistics!==void 0?"statistics":this.#t.profile!==void 0?"profile":null;if(!L)return;const $=d.filter(P=>this.#t[P]!==void 0);$.length&&B(`source.derived.producer.ignored.${L}`,`source.mode "derived": \`${L}\` is a terminal producer and replaces the pipeline, so ${$.map(P=>`\`${P}\``).join(", ")} ${$.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(L){const $=this.#i&&this.#i.grid,P=new Set,N=[];return L.forEach((T,E)=>{const A=u(T,E);if(P.has(A.label)&&B(`source.derived.union.label.${A.label}`,`source.mode "derived": two union sources share the label "${A.label}"; give each a distinct \`label\` or __source/__key will not distinguish them.`),P.add(A.label),!A.grid){B(`source.derived.union.missing.${A.label}`,`source.mode "derived": union source "${A.label}" has no grid and was skipped.`),N.push(A);return}if($&&C(A.grid.on)){const S=y($,A.grid,[A.label]);if(S){B(`source.derived.union.cycle.${A.label}`,`source.mode "derived": union source "${A.label}" was refused — it derives from the grid being derived, directly or through a chain (${S.join(" → ")}). Remove it from \`from\`.`),N.push({...A,grid:null});return}}N.push(A)}),N}#b(){if(this.#f){this.#A(),this.#w();return}const L=this.#e;if(!L||!C(L.on))return;const $=String(this.#t.follow||"filtered"),P=["rows:changed"];($==="filtered"||$==="grouped")&&P.push("filter:changed","model:changed"),$==="selected"&&P.push("selection:changed"),$==="grouped"&&P.push("column:grouped");for(const N of P){const T=E=>{N==="rows:changed"&&O(E)||N==="model:changed"&&!X(E)||this.schedule(N==="rows:changed"?E:null)};L.on(N,T),this.#n.push(()=>C(L.off)&&L.off(N,T))}this.#w(),this.#y()}#y(){const L=this.#t.statistics,$=q(L)?L.with:null;if(!q($)||!C($.on))return;const P=$;for(const N of["rows:changed","filter:changed","model:changed"]){const T=E=>{N==="rows:changed"&&O(E)||N==="model:changed"&&!X(E)||this.schedule(null)};P.on(N,T),this.#n.push(()=>C(P.off)&&P.off(N,T))}}#A(){for(const L of this.#f){const $=L.grid;if(!$||!C($.on))continue;const P=i.includes(String(L.follow))?String(L.follow):"filtered",N=["rows:changed"];(P==="filtered"||P==="grouped")&&N.push("filter:changed","model:changed"),P==="selected"&&N.push("selection:changed"),P==="grouped"&&N.push("column:grouped");for(const T of N){const E=A=>{T==="rows:changed"&&O(A)||T==="model:changed"&&!X(A)||this.schedule(null)};$.on(T,E),this.#n.push(()=>C($.off)&&$.off(T,E))}}}#w(){const L=this.#t.join,$=L&&L.with;if(!$||!C($.on))return;const N=String(L.follow||"all")==="all"?["rows:changed"]:["rows:changed","filter:changed","model:changed"];for(const T of N){const E=A=>{T==="rows:changed"&&O(A)||T==="model:changed"&&!X(A)||this.schedule({partner:!0})};$.on(T,E),this.#n.push(()=>C($.off)&&$.off(T,E))}}#O(){const L=this.#t.join;if(!L||!L.with)return null;const $=L.on,P=q($)?String($.left||$.right||""):String($||""),N=q($)?String($.right||$.left||""):String($||"");return P&&N?{left:P,right:N}:null}#v(){const L=this.#O();if(!L)return this.#u=null,null;const $=this.#u;if(this.#u=l(this.#E(),L.right),!$)return null;const P=this.#t.join||{},N=Array.isArray(P.select)?P.select.map(String):null,T=S=>S?(N||Object.keys(S)).map(W=>String(f(S,W))).join(""):null,E=new Set,A=new Set;for(const[S,x]of this.#u)T(x)!==T($.get(S))&&(E.add(S),$.has(S)||A.add(S));for(const S of $.keys())this.#u.has(S)||E.add(S);return{affected:E,gained:A}}#T(L,$){const P=this.#l;if(!P||!P.leftByJoinKey)return null;const N=[];for(const T of L){const E=P.leftByJoinKey.get(T);if(E)for(const A of E){const S=P.rowData.get(A);S!==void 0&&N.push({key:A,data:S})}}return this.#N({updated:N,added:[],removed:[]},$)}#S(L,$){if(!this.#l||!this.#l.leftByJoinKey||L.unnest||L.where||String(L.follow||"filtered")==="grouped")return!1;const P=L.join||{};return String(P.type||"inner")==="left"?!0:$.size===0}#E(){const L=this.#t.join,$=L&&L.with;if(!$||!$.rows)return[];const P=[],N=T=>{T.group||P.push(M(T))};return String(L.follow||"all")==="filtered"&&C($.rows.forEach)?$.rows.forEach(N):C($.rows.forEachAll)&&$.rows.forEachAll(N),P}schedule(L){const $=this.#t.refresh===void 0?"idle":this.#t.refresh;if($==="manual")return;if($==="live"){this.refresh(L);return}const P=typeof $=="number"&&Number.isFinite($)?$:a;if(this.#r){this.#c=!0;return}this.#c=!1,this.#r=setTimeout(()=>{this.#r=null,this.refresh(this.#c?null:L)},P)}refresh(L){if(!(this.#s||!this.#e&&!this.#f)){if(this.#o){B("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 $=this.#d?[]:this.#f?this.#t.profile?this.#Y():this.#x():this.#t.statistics!==void 0?this.#fe():this.#t.profile?this.#ge():this.#M(L);this.setRows($),this.invalidate("filter"),C(this.#i.emit)&&this.#i.emit("rows:changed",{derived:!0},"derived")}finally{this.#o=!1}}}#M(L){const P=q(L)&&L.partner===!0?this.#v():null,N=this.#V();if(P&&this.#l){if(!P.affected.size)return c(this.#l.groups,N,this.#l.reduced,new Set);if(this.#S(N,P.gained)){const ne=this.#T(P.affected,N);if(ne)return c(this.#l.groups,N,this.#l.reduced,ne)}}const T=this.#P(N,L);if(T&&this.#l){const ne=this.#N(T,N);return c(this.#l.groups,N,this.#l.reduced,ne)}const E=w(this.#I(),N);if(this.#a=this.#$(),!N.groupBy)return this.#l=null,j(E,N);const A=this.#R(),{groups:S,rowGroup:x}=m(E,N,A),W=new Map;for(const[ne,se]of x){const le=S.get(se);le&&W.set(ne,le.rows.get(ne))}const V=new Map,G=this.#O(),Q=new Map,ee=new Map;if(G)for(const[ne,se]of W){const le=t(se,G.left);if(le===null)continue;Q.set(ne,le);let me=ee.get(le);me||(me=new Set,ee.set(le,me)),me.add(ne)}return this.#l={groups:S,rowGroup:x,rowData:W,reduced:V,leftJoinKey:Q,leftByJoinKey:ee},c(S,N,V,null)}#P(L,$){if(!this.#l||!L.groupBy||L.unnest||L.where||String(L.follow||"filtered")==="grouped"||q(L.join)&&L.join.with&&!(L.join.index instanceof Map)||!q($))return null;const P=Array.isArray($.updated)?$.updated:null,N=Array.isArray($.added)?$.added:null,T=Array.isArray($.removed)?$.removed:null;if(!P&&!N&&!T)return null;const E=this.#a;if(E&&E.size&&String(L.follow||"filtered")!=="all"){if($.edit===!0&&Array.isArray($.columns)){for(const A of $.columns)if(E.has(String(A)))return null}for(const A of P||[]){const S=A&&A.key,x=S===void 0?void 0:this.#l.rowData.get(String(S)),W=M(A);for(const V of E)if(f(x,V)!==f(W,V))return null}}return{updated:P||[],added:N||[],removed:T||[]}}#N(L,$){const P=this.#l,N=this.#R(),T=new Set,E=q($.join)&&$.join.index instanceof Map?$.join:null,A=this.#O(),S=W=>{const V=P.rowGroup.get(W);if(V===void 0)return;T.add(V);const G=P.groups.get(V);if(G&&(G.rows.delete(W),G.rows.size||P.groups.delete(V)),P.rowGroup.delete(W),P.rowData.delete(W),P.leftJoinKey){const Q=P.leftJoinKey.get(W);if(Q!==void 0){const ee=P.leftByJoinKey.get(Q);ee&&(ee.delete(W),ee.size||P.leftByJoinKey.delete(Q)),P.leftJoinKey.delete(W)}}},x=W=>{const V=E?r(W,E):W;if(!V)return;const G=N(V),Q=m([V],$,N);for(const[ee,ne]of Q.groups){let se=P.groups.get(ee);se||(se={values:ne.values,rows:new Map},P.groups.set(ee,se)),se.rows.set(G,V),P.rowGroup.set(G,ee),T.add(ee)}if(P.rowData.set(G,V),A&&P.leftByJoinKey){const ee=t(V,A.left);if(ee!==null){P.leftJoinKey.set(G,ee);let ne=P.leftByJoinKey.get(ee);ne||(ne=new Set,P.leftByJoinKey.set(ee,ne)),ne.add(G)}}};for(const W of L.removed)S(String(W));for(const W of L.updated)S(String(W.key)),x(M(W));for(const W of L.added)x(M(W));return T}#R(){const L=this.#e,$=L&&L.config&&L.config.rowKey||"id";return P=>String(f(P,typeof $=="string"?$:"id")??"")}#$(){const L=this.#e,$=L&&L.state&&C(L.state.get)?L.state.get():null,P=new Set,N=T=>{if(T){if(Array.isArray(T.conditions)){T.conditions.forEach(N);return}T.col&&P.add(String(T.col))}};return $&&N($.filters),P}#V(){let L=this.#t;if(L.join&&L.join.with&&(this.#u||this.#v(),L={...L,join:{...L.join,index:this.#u}}),this.#f||String(L.follow||"filtered")!=="grouped")return L;const $=this.#e,P=$&&$.state&&C($.state.get)?$.state.get():null,N=P&&Array.isArray(P.group)?P.group:[];return N.length?{...L,groupBy:[...N]}:L}#W(){const L=[];for(const $ of this.#f)if($.grid)try{const P=i.includes(String($.follow))?String($.follow):"filtered",N=this.#D($.grid,P);for(const T of N){const E=$.map?$.map(T):T;q(E)&&L.push({...E,[n]:$.label})}}catch(P){B(`source.derived.union.failed.${$.label}`,`source.mode "derived": union source "${$.label}" failed to read (${P&&P.message?P.message:P}) and was skipped this pass.`)}return L}#D(L,$){if(!L||!L.rows)return[];if($==="all"){const N=[];return C(L.rows.forEachAll)&&L.rows.forEachAll(T=>{T.group||N.push(M(T))}),N}if($==="selected")return(L.selection&&C(L.selection.rows)?L.selection.rows():[]).filter(Boolean).map(M);const P=[];return C(L.rows.forEach)&&L.rows.forEach(N=>{N.group||P.push(M(N))}),P}#x(){const L=this.#V(),$=this.#W(),P=j($,L);return L.groupBy?P:o(P)}#Y(){return B("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.'),[]}#I(){const L=this.#e,$=String(this.#t.follow||"filtered");if(!L||!L.rows)return[];if($==="all"){const T=[];return C(L.rows.forEachAll)&&L.rows.forEachAll(E=>{E.group||T.push(M(E))}),T}if($==="selected")return(L.selection&&C(L.selection.rows)?L.selection.rows():[]).filter(Boolean).map(M);const P=this.#K(),N=[];return P&&this.#U().length&&C(L.rows.forEachExcept)?(L.rows.forEachExcept(P,T=>{T.group||N.push(M(T))}),N):(C(L.rows.forEach)&&L.rows.forEach(T=>{T.group||N.push(M(T))}),N)}#K(){const L=this.#t.crossFilter;if(!L||this.#f)return null;if(typeof L=="string")return L;if(L.col)return String(L.col);const $=this.#t.groupBy,P=Array.isArray($)?$[0]:$;return P?String(P):null}#U(){const L=this.#K(),$=this.#e;if(!L||!$||!$.filters||!C($.filters.get))return[];const P=D($.filters.get(),L);return P?P.op==="in"&&Array.isArray(P.value)?P.value.map(String):P.op==="eq"&&P.value!==void 0?[String(P.value)]:[]:[]}#B(L){const $=this.#K(),P=this.#e;if(!$||!P||!P.filters||!C(P.filters.set))return;const N=this.#i.compute||{},T=C(P.filters.get)?P.filters.get():null,E=C(N.pruneColumn)?N.pruneColumn(T,$):null;if(!L.length){P.filters.set(E||null);return}const A=L.length===1?{col:$,op:"eq",value:L[0]}:{col:$,op:"in",value:L.slice()},S=E?E.conditions&&E.op?E.conditions:[E]:[];P.filters.set(S.length?{op:"and",conditions:[...S,A]}:A)}crossFilter(){const L=this;return{enabled(){return!!L.#K()},column(){return L.#K()},get(){return L.#U()},set($){const P=$==null?[]:(Array.isArray($)?$:[$]).map(N=>String(N));L.#B(P)},toggle($){const P=String($),N=L.#U(),E=N.indexOf(P)>=0?N.filter(A=>A!==P):[...N,P];L.#B(E)},clear(){L.#B([])}}}#ce(L){const $=L&&L.rows;if($&&C($.matchCount)){const P=$.matchCount(),N=Number(P);if(P!==null&&Number.isFinite(N))return N}if($&&C($.count)){const P=Number($.count());if(Number.isFinite(P))return P}return 0}#fe(){const L=this.#e,$=this.#t.statistics;if(!L||!L.statistics||!q($))return[];switch(String($.fn)){case"correlation":return this.#ie(L,$);case"series":return this.#Fe(L,$);case"datasetVsDataset":return this.#Oe(L,$);default:return[]}}#ie(L,$){const P=$.columns.filter(Boolean).map(String),N=this.#ce(L),T=(E,A)=>{const S=L.statistics.correlation(E,A);return typeof S=="number"&&Number.isFinite(S)?S:null};if(String($.orient||"pairs")!=="matrix"){const E=[];for(let A=0;A<P.length;A++)for(let S=A+1;S<P.length;S++)E.push({[s]:`${P[A]}${P[S]}`,a:P[A],b:P[S],coefficient:T(P[A],P[S]),n:N});return E}return P.map(E=>{const A={[s]:E,column:E};for(const S of P)A[S]=E===S?1:T(E,S);return A.n=N,A})}#Fe(L,$){const P=this.#ce(L),N={by:String($.by)};$.periodsPerYear!==void 0&&(N.periodsPerYear=Number($.periodsPerYear));const T=L.statistics.series(String($.of),N)||{};return k.map(E=>({[s]:E,metric:E,value:T[E]??null,n:P}))}#Oe(L,$){const P=$.with,N=Array.isArray($.columns)?{columns:$.columns.map(String)}:void 0,T=L.statistics.datasetVsDataset(P,N);if(!q(T))return[];const A=(Array.isArray(T.ranked)?T.ranked:[]).map(W=>({[s]:String(W.column),column:W.column,measure:W.measure??null,magnitude:W.magnitude??null,distance:W.distance??null,direction:W.direction??null,nA:W.nA??null,nB:W.nB??null,reliable:W.reliable??null,unmatched:""})),S=T.unmatched,x=[["A",S&&S.onlyA],["B",S&&S.onlyB]];for(const[W,V]of x)for(const G of V||[])A.push({[s]:`${W}${G}`,column:G,measure:null,magnitude:null,distance:null,direction:null,nA:null,nB:null,reliable:!1,unmatched:W});return A}#ge(){const L=this.#e;if(!L||!L.statistics||!C(L.statistics.profile))return[];const P=(Array.isArray(this.#t.profile)?this.#t.profile:[this.#t.profile]).filter(Boolean).map(T=>{const E=L.statistics.profile(String(T))||{},A={[s]:String(T)};for(const x of h)A[x]=x==="column"?String(T):E[x]??null;A.outliers=Array.isArray(E.outliers)?E.outliers.length:E.outliers??null;const S=p({...E,rows:A.rows,outliers:A.outliers,numeric:E.numeric},this.#t.alerts);return A.alerts=S.join(", "),A.alertCount=S.length,A});if(this.#t.orient!=="metrics")return P;const N=P[0];return N?h.filter(T=>T!=="column").map(T=>({[s]:T,metric:T,value:N[T]})):[]}apply(L){const $=["add","update","remove"],P=[];for(const N of $)for(const T of L&&L[N]||[])P.push({operation:N,id:T&&T.id,reason:"derived-read-only"});return P.length&&B("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:P}}destroy(){this.#s=!0,this.#r&&(clearTimeout(this.#r),this.#r=null),this.#K()&&this.#U().length&&this.#B([]);for(const L of this.#n)try{L()}catch{}this.#n=[],this.#e=null,this.#f=null,super.destroy()}}function O(I){return q(I)&&I.companion===!0}function y(I,L,$,P=new Set){if(L===I)return $;if(P.has(L))return null;P.add(L);let N=null;try{N=C(L.config)?L.config():null}catch{N=null}const T=N&&q(N.source)?N.source:null;if(!T||T.mode!=="derived")return null;const E=T.from;if(Array.isArray(E)){for(let A=0;A<E.length;A++){const S=u(E[A],A);if(!S.grid||!C(S.grid.on))continue;const x=y(I,S.grid,[...$,S.label],P);if(x)return x}return null}return q(E)&&C(E.on)?y(I,E,[...$,"(from)"],P):null}function M(I){return q(I)&&"data"in I?I.data:I}function D(I,L){if(!I||typeof I!="object")return null;if(Array.isArray(I.conditions)){for(const P of I.conditions){const N=D(P,L);if(N)return N}return null}return I.col===L?I:null}function _(I,L){return new b(I,L)}}),Ue("packages/core/src/source/adapters/odata.js",function(e,U){"use strict";Object.defineProperty(e,"conditionToOData",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"filtersToOData",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"odataAdapter",{enumerable:!0,get:function(){return h}});const C=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/source/filterwire.js").isGroup,B=Object.freeze(["eq","ne","gt","gte","lt","lte","contains","startsWith","endsWith","blank","notBlank","between","notBetween"]),Z=/^\d{4}-\d{2}-\d{2}$/,K=/^\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/,F=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;function X(v){const g=v instanceof Date?v:typeof v=="number"&&Number.isFinite(v)?new Date(v):typeof v=="string"&&F.test(v)?new Date(v):null;return g&&!Number.isNaN(g.getTime())?g:null}const H=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function j(v,g){throw typeof g=="string"&&H.test(g)?new Error(`odataAdapter: "${g}" needs a zone designator to be used as a ${v} 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(g)}" is not a usable ${v} value`)}function w(v){const g=X(v);return g||j("DateTimeOffset",v),g.toISOString()}function m(v){if(typeof v=="string"&&Z.test(v))return v;const g=X(v);return g||j("Date",v),g.toISOString().slice(0,10)}function c(v){if(typeof v=="string"&&K.test(v))return v.length===5?`${v}:00`:v;if(typeof v=="number"&&Number.isFinite(v)&&v>=0&&v<864e5){const g=Math.floor(v),k=d=>String(d).padStart(2,"0");return`${k(Math.floor(g/36e5))}:${k(Math.floor(g%36e5/6e4))}:${k(Math.floor(g%6e4/1e3))}`}throw new Error(`odataAdapter: "${String(v)}" is not a usable TimeOfDay value`)}const f=Object.freeze({timestamp:w,datetime:w,date:m,dateString:m,time:c}),l=200,r=1e3,t=Object.freeze({eq:"eq",ne:"ne",gt:"gt",gte:"ge",lt:"lt",lte:"le"});function i(v,g){if(v==null)return"null";const k=g&&f[String(g)];return k?k(v):typeof v=="number"||typeof v=="boolean"?String(v):v instanceof Date?v.toISOString():`'${String(v).replace(/'/g,"''")}'`}function s(v){const g=String(v),k=/^[A-Za-z_][A-Za-z0-9_]*$/;if(!g||!g.split("/").every(d=>k.test(d)))throw new Error(`odataAdapter: "${g}" is not a usable column name`);return g}const n=Object.freeze({lo:{incl:"ge",excl:"gt"},hi:{incl:"le",excl:"lt"}});function u(v){const g=s(v.col),k=String(v.op),d=v.type;if(t[k])return`${g} ${t[k]} ${i(v.value,d)}`;if(k==="contains")return`contains(${g},${i(v.value,d)})`;if(k==="startsWith")return`startswith(${g},${i(v.value,d)})`;if(k==="endsWith")return`endswith(${g},${i(v.value,d)})`;if(k==="blank")return`(${g} eq null)`;if(k==="notBlank")return`(${g} ne null)`;if(k==="between"||k==="notBetween"){const p=Array.isArray(v.value)?v.value:[v.value,v.value],b=String(v.bounds||"[]"),O=b.charAt(0)==="("?n.lo.excl:n.lo.incl,y=b.charAt(1)===")"?n.hi.excl:n.hi.incl,M=`(${g} ${O} ${i(p[0],d)} and ${g} ${y} ${i(p[1],d)})`;return k==="between"?M:`(${g} eq null or not ${M})`}return null}function o(v){const g=String(v&&v.op);throw C(`source.odata.filter.refuse.${g}`,`a "${g}" 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 "${g}" filter condition cannot be expressed in OData and was refused`)}function a(v){if(!v)return"";if(!z(v)){const d=u(v);return d===null?o(v):d}const g=String(v.op)==="or"?" or ":" and ",k=(v.conditions||[]).map(d=>{if(z(d))return a(d);const p=u(d);return p===null?o(d):p}).filter(Boolean);return k.length?k.length===1?k[0]:`(${k.join(g)})`:""}function h(v={}){const g=String(v.url||""),k=v.fetch||(typeof fetch=="function"?fetch:null),d=v.count!==!1,p=s(v.key||"id"),b=v.edit===!0;return{name:"odata",capabilities:{filter:"tree",operators:B,sort:"multi",quick:v.search===!0,range:!0,total:d,mutate:b?{update:!0,delete:!0,append:!0,returning:"row"}:!1},urlFor(O){const y=[],M=(_,I)=>y.push(`${_}=${encodeURIComponent(I)}`),D=a(O.filters);return D&&M("$filter",D),O.sort&&O.sort.length&&M("$orderby",O.sort.map(_=>`${s(_.col)}${_.dir==="desc"?" desc":" asc"}`).join(",")),O.range&&(M("$skip",String(O.range.start)),M("$top",String(O.range.end-O.range.start))),O.quick&&M("$search",`"${String(O.quick).replace(/"/g,"")}"`),d&&M("$count","true"),y.length?`${g}?${y.join("&")}`:g},async execute(O,y){if(!k)throw new Error("odataAdapter needs a fetch implementation");const M={Accept:"application/json",...v.headers||{}},D=y&&y.signal,_=async P=>{const N=await k(P,{headers:M,signal:D});if(!N.ok)throw new Error(`OData request failed: ${N.status}`);return N.json()};let I=await _(this.urlFor(O)),L=I.value||I.rows||[];const $=I["@odata.count"]??I.count;if(!O.range){let P=I["@odata.nextLink"];for(;P&&L.length<l*r;)I=await _(P),L=L.concat(I.value||I.rows||[]),P=I["@odata.nextLink"]}return $==null?(d&&C("source.odata.nocount",`${g} 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:L}):{rows:L,total:Number($)}},urlForKey(O){return`${g}(${i(O)})`},async mutate(O,y){if(!k)throw new Error("odataAdapter needs a fetch implementation");if(!O||O.kind!=="update"&&O.kind!=="delete"&&O.kind!=="append")throw new Error(`odataAdapter: mutation kind "${O&&O.kind}" is not supported (update, delete and append are wired)`);const M={Accept:"application/json","Content-Type":"application/json",...v.headers||{}},D=y&&y.signal;if(O.kind==="delete"){const P=Array.isArray(O.keys)&&O.keys.length?O.keys[0]:O.key;if(P==null)throw new Error("odataAdapter: a delete needs a row key");const N=await k(this.urlForKey(P),{method:"DELETE",headers:M,signal:D});if(!N.ok)throw new Error(`OData delete failed: ${N.status}`);return{ok:!0}}if(O.kind==="append"){const P=Array.isArray(O.rows)?O.rows.filter(S=>S&&typeof S=="object"):[];if(P.length!==1)throw new Error("odataAdapter: an append needs exactly one row object (OData creates one entity per POST)");const N=await k(g,{method:"POST",headers:M,signal:D,body:JSON.stringify(P[0])});if(!N.ok)throw new Error(`OData add-row failed: ${N.status}`);const T=N.status===204?null:await N.json().catch(()=>null),E=T&&typeof T=="object"&&"value"in T?T.value:T;if(!E||typeof E!="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 A=E[p];if(A==null)throw new Error(`odataAdapter: the created entity carried no ${p} to rekey the appended row by.`);return{ok:!0,keys:[String(A)],rows:[E]}}const _=this.urlForKey(O.key),I=await k(_,{method:"PATCH",headers:M,signal:D,body:JSON.stringify(O.patch||{})});if(!I.ok)throw new Error(`OData update failed: ${I.status}`);if(I.status===204)return{ok:!0};const L=await I.json(),$=L&&typeof L=="object"&&"value"in L?L.value:L;return $==null?{ok:!0}:{ok:!0,rows:[$]}}}}}),Ue("packages/core/src/source/adapters/rest.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_PARAMS",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"DEFAULT_VERBS",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"restAdapter",{enumerable:!0,get:function(){return q}});const te=Object.freeze({offset:"offset",limit:"limit",sort:"sort",order:"order",filter:"filter",search:"q"}),C=Object.freeze({update:"PATCH",delete:"DELETE",append:"POST"});function q(z={}){const B=String(z.url||""),Z=z.fetch||(typeof fetch=="function"?fetch:null),K={...te,...z.params||{}},F=z.encodeFilter||(r=>JSON.stringify(r)),X=z.rows||(r=>Array.isArray(r)?r:r.rows||r.data||[]),H=z.total||((r,t)=>Array.isArray(r)?t.length:r.total??r.count??t.length),j=z.edit===!0,w=z.returning==="row"?"row":z.returning==="key"?"key":"none",m=z.keyField||"id",c=z.writeUrlFor||(r=>`${B}/${encodeURIComponent(String(r.key??(r.keys&&r.keys[0])))}`),f=z.encodeMutation||(r=>{const t=C[r.kind];if(r.kind==="update")return{method:t,url:c(r),headers:{"Content-Type":"application/json"},body:JSON.stringify(r.patch||{})};if(r.kind==="append"){const i=Array.isArray(r.rows)?r.rows:r.rows?[r.rows]:[];return{method:t,url:B,headers:{"Content-Type":"application/json"},body:JSON.stringify(i.length===1?i[0]:i)}}return{method:t,url:c(r)}}),l=z.writeRow||(r=>{if(r===null||typeof r!="object")return null;if(Array.isArray(r))return r.length?r[0]:null;const t=r;return t.row??t.data??r});return{name:"rest",capabilities:{range:!0,total:!0,sort:"multi",filter:!1,quick:!1,mutate:j?{update:!0,delete:!0,append:!0,returning:w}:!1,...z.capabilities||{},...z.operators?{filter:"tree",operators:z.operators}:{}},urlFor(r){const t=new URLSearchParams;r.range&&(t.set(K.offset,String(r.range.start)),t.set(K.limit,String(r.range.end-r.range.start))),r.sort&&r.sort.length&&(t.set(K.sort,r.sort.map(s=>s.col).join(",")),t.set(K.order,r.sort.map(s=>s.dir||"asc").join(","))),r.filters&&t.set(K.filter,F(r.filters)),r.quick&&t.set(K.search,String(r.quick));const i=t.toString();return i?`${B}?${i}`:B},async execute(r,t){if(!Z)throw new Error("restAdapter needs a fetch implementation");const i=await Z(this.urlFor(r),{headers:{Accept:"application/json",...z.headers||{}},signal:t&&t.signal});if(!i.ok)throw new Error(`request failed: ${i.status}`);const s=await i.json(),n=X(s);return{rows:n,total:H(s,n)}},writeUrlFor(r){return c(r)},encodeMutation(r){return f(r)},async mutate(r,t){if(!Z)throw new Error("restAdapter needs a fetch implementation");if(!r||r.kind!=="update"&&r.kind!=="delete"&&r.kind!=="append")throw new Error(`restAdapter: mutation kind "${r&&r.kind}" is not supported (update, delete and append are wired)`);const i=f(r);if(!i||!i.url||!i.method)throw new Error("restAdapter: encodeMutation must return { method, url }");const s={Accept:"application/json",...z.headers||{},...i.headers||{}},n=await Z(i.url,{method:i.method,headers:s,signal:t&&t.signal,...i.body!==void 0?{body:i.body}:{}});if(!n.ok)throw new Error(`REST ${r.kind} failed: ${n.status}`);if(r.kind==="append"){if(w==="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 a=await n.json(),h=l(a),v=h&&typeof h=="object"?h[m]:void 0;if(v==null)throw new Error(`restAdapter: the add-row response carried no ${m} to rekey the appended row by. Point \`keyField\` at the primary key the endpoint returns, or override \`writeRow\`.`);return w==="row"?{ok:!0,keys:[String(v)],rows:[h]}:{ok:!0,keys:[String(v)]}}if(w!=="row"||n.status===204)return{ok:!0};const u=await n.json(),o=l(u);return o==null?{ok:!0}:{ok:!0,rows:[o]}}}}}),Ue("packages/core/src/source/adapters/dfql.js",function(e,U){"use strict";Object.defineProperty(e,"DFQL_BASE",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"DFQL_WRITE_URL",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"dfqlAdapter",{enumerable:!0,get:function(){return j}});const C=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce,B="https://rest.demandflow.com",Z="https://stream.demandflow.com/dfql",K=Object.freeze(["id","created","updated","ownerId","entity"]);function F(w){const m={},c=[];for(const[f,l]of Object.entries(w||{})){if(K.includes(f)){c.push(f);continue}m[f]=l}return c.length&&z("source.dfql.protected",`a DFQL update tried to write protected field(s) ${c.join(", ")}; they are server-assigned and immutable, so they were dropped from the PATCH.`),m}function X(w){if(!w||typeof w!="object"||Array.isArray(w))return["fields (must be an object)"];const m=w,c=[];return(typeof m.entity!="string"||!m.entity)&&c.push("entity (uppercase code)"),Number.isFinite(Number(m.level))||c.push("level (numeric)"),(typeof m.comboKey!="string"||!m.comboKey.endsWith("|ENT:"))&&c.push("comboKey (a string ending '|ENT:')"),c}async function H(w){const m=[],c=t=>{const i=t.trim();if(i)try{m.push(JSON.parse(i))}catch{}};if(!w.body||typeof w.body.getReader!="function")return(await w.text()).split(`
|