@toclocoinc/lattice-grid 1.98.1 → 1.98.2
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 +11 -0
- package/README.md +1 -1
- package/angular/package.json +1 -1
- package/docs/API.html +27 -17
- 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/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 +22 -12
- package/docs/api/shell.html +1 -1
- package/docs/api/tabs.html +1 -1
- package/docs/api/types.html +3 -3
- package/docs/api-detail.html +12 -4
- package/docs/warnings.json +1 -1
- package/lattice-grid.d.ts +1 -1
- package/lattice-grid.esm.min.js +2 -2
- package/lattice-grid.min.cjs +2 -2
- package/lattice-grid.min.js +2 -2
- package/locales/all.d.ts +1 -1
- package/locales/all.esm.min.js +1 -1
- package/locales/all.min.cjs +1 -1
- package/locales/all.min.js +1 -1
- package/locales/ar.d.ts +1 -1
- package/locales/ar.esm.min.js +1 -1
- package/locales/ar.min.cjs +1 -1
- package/locales/ar.min.js +1 -1
- package/locales/cs-CZ.d.ts +1 -1
- package/locales/cs-CZ.esm.min.js +1 -1
- package/locales/cs-CZ.min.cjs +1 -1
- package/locales/cs-CZ.min.js +1 -1
- package/locales/da-DK.d.ts +1 -1
- package/locales/da-DK.esm.min.js +1 -1
- package/locales/da-DK.min.cjs +1 -1
- package/locales/da-DK.min.js +1 -1
- package/locales/de-DE.d.ts +1 -1
- package/locales/de-DE.esm.min.js +1 -1
- package/locales/de-DE.min.cjs +1 -1
- package/locales/de-DE.min.js +1 -1
- package/locales/el-GR.d.ts +1 -1
- package/locales/el-GR.esm.min.js +1 -1
- package/locales/el-GR.min.cjs +1 -1
- package/locales/el-GR.min.js +1 -1
- package/locales/en-US.d.ts +1 -1
- package/locales/en-US.esm.min.js +1 -1
- package/locales/en-US.min.cjs +1 -1
- package/locales/en-US.min.js +1 -1
- package/locales/es-ES.d.ts +1 -1
- package/locales/es-ES.esm.min.js +1 -1
- package/locales/es-ES.min.cjs +1 -1
- package/locales/es-ES.min.js +1 -1
- package/locales/fi-FI.d.ts +1 -1
- package/locales/fi-FI.esm.min.js +1 -1
- package/locales/fi-FI.min.cjs +1 -1
- package/locales/fi-FI.min.js +1 -1
- package/locales/fr-CA.d.ts +1 -1
- package/locales/fr-CA.esm.min.js +1 -1
- package/locales/fr-CA.min.cjs +1 -1
- package/locales/fr-CA.min.js +1 -1
- package/locales/fr-FR.d.ts +1 -1
- package/locales/fr-FR.esm.min.js +1 -1
- package/locales/fr-FR.min.cjs +1 -1
- package/locales/fr-FR.min.js +1 -1
- package/locales/hu-HU.d.ts +1 -1
- package/locales/hu-HU.esm.min.js +1 -1
- package/locales/hu-HU.min.cjs +1 -1
- package/locales/hu-HU.min.js +1 -1
- package/locales/it-IT.d.ts +1 -1
- package/locales/it-IT.esm.min.js +1 -1
- package/locales/it-IT.min.cjs +1 -1
- package/locales/it-IT.min.js +1 -1
- package/locales/ja-JP.d.ts +1 -1
- package/locales/ja-JP.esm.min.js +1 -1
- package/locales/ja-JP.min.cjs +1 -1
- package/locales/ja-JP.min.js +1 -1
- package/locales/nb-NO.d.ts +1 -1
- package/locales/nb-NO.esm.min.js +1 -1
- package/locales/nb-NO.min.cjs +1 -1
- package/locales/nb-NO.min.js +1 -1
- package/locales/nl-NL.d.ts +1 -1
- package/locales/nl-NL.esm.min.js +1 -1
- package/locales/nl-NL.min.cjs +1 -1
- package/locales/nl-NL.min.js +1 -1
- package/locales/pl-PL.d.ts +1 -1
- package/locales/pl-PL.esm.min.js +1 -1
- package/locales/pl-PL.min.cjs +1 -1
- package/locales/pl-PL.min.js +1 -1
- package/locales/pt-BR.d.ts +1 -1
- package/locales/pt-BR.esm.min.js +1 -1
- package/locales/pt-BR.min.cjs +1 -1
- package/locales/pt-BR.min.js +1 -1
- package/locales/ro-RO.d.ts +1 -1
- package/locales/ro-RO.esm.min.js +1 -1
- package/locales/ro-RO.min.cjs +1 -1
- package/locales/ro-RO.min.js +1 -1
- package/locales/sv-SE.d.ts +1 -1
- package/locales/sv-SE.esm.min.js +1 -1
- package/locales/sv-SE.min.cjs +1 -1
- package/locales/sv-SE.min.js +1 -1
- package/locales/uk-UA.d.ts +1 -1
- package/locales/uk-UA.esm.min.js +1 -1
- package/locales/uk-UA.min.cjs +1 -1
- package/locales/uk-UA.min.js +1 -1
- package/modules/ai.d.ts +1 -1
- package/modules/ai.esm.min.js +1 -1
- package/modules/ai.min.cjs +1 -1
- package/modules/ai.min.js +1 -1
- package/modules/alarms.d.ts +1 -1
- package/modules/alarms.esm.min.js +1 -1
- package/modules/alarms.min.cjs +1 -1
- package/modules/alarms.min.js +1 -1
- package/modules/angular.d.ts +1 -1
- package/modules/angular.esm.min.js +1 -1
- package/modules/angular.min.cjs +1 -1
- package/modules/angular.min.js +1 -1
- package/modules/calendar.d.ts +1 -1
- package/modules/calendar.esm.min.js +1 -1
- package/modules/calendar.min.cjs +1 -1
- package/modules/calendar.min.js +1 -1
- package/modules/chart-alluvial.d.ts +1 -1
- package/modules/chart-alluvial.esm.min.js +1 -1
- package/modules/chart-alluvial.min.cjs +1 -1
- package/modules/chart-alluvial.min.js +1 -1
- package/modules/chart-arc.d.ts +1 -1
- package/modules/chart-arc.esm.min.js +1 -1
- package/modules/chart-arc.min.cjs +1 -1
- package/modules/chart-arc.min.js +1 -1
- package/modules/chart-barrace.d.ts +1 -1
- package/modules/chart-barrace.esm.min.js +1 -1
- package/modules/chart-barrace.min.cjs +1 -1
- package/modules/chart-barrace.min.js +1 -1
- package/modules/chart-bubblemap.d.ts +1 -1
- package/modules/chart-bubblemap.esm.min.js +1 -1
- package/modules/chart-bubblemap.min.cjs +1 -1
- package/modules/chart-bubblemap.min.js +1 -1
- package/modules/chart-bump.d.ts +1 -1
- package/modules/chart-bump.esm.min.js +1 -1
- package/modules/chart-bump.min.cjs +1 -1
- package/modules/chart-bump.min.js +1 -1
- package/modules/chart-calendar.d.ts +1 -1
- package/modules/chart-calendar.esm.min.js +1 -1
- package/modules/chart-calendar.min.cjs +1 -1
- package/modules/chart-calendar.min.js +1 -1
- package/modules/chart-choropleth.d.ts +1 -1
- package/modules/chart-choropleth.esm.min.js +1 -1
- package/modules/chart-choropleth.min.cjs +1 -1
- package/modules/chart-choropleth.min.js +1 -1
- package/modules/chart-decomposition.d.ts +1 -1
- package/modules/chart-decomposition.esm.min.js +1 -1
- package/modules/chart-decomposition.min.cjs +1 -1
- package/modules/chart-decomposition.min.js +1 -1
- package/modules/chart-diverging.d.ts +1 -1
- package/modules/chart-diverging.esm.min.js +1 -1
- package/modules/chart-diverging.min.cjs +1 -1
- package/modules/chart-diverging.min.js +1 -1
- package/modules/chart-dumbbell.d.ts +1 -1
- package/modules/chart-dumbbell.esm.min.js +1 -1
- package/modules/chart-dumbbell.min.cjs +1 -1
- package/modules/chart-dumbbell.min.js +1 -1
- package/modules/chart-fan.d.ts +1 -1
- package/modules/chart-fan.esm.min.js +1 -1
- package/modules/chart-fan.min.cjs +1 -1
- package/modules/chart-fan.min.js +1 -1
- package/modules/chart-forcetree.d.ts +1 -1
- package/modules/chart-forcetree.esm.min.js +1 -1
- package/modules/chart-forcetree.min.cjs +1 -1
- package/modules/chart-forcetree.min.js +1 -1
- package/modules/chart-hexbin.d.ts +1 -1
- package/modules/chart-hexbin.esm.min.js +1 -1
- package/modules/chart-hexbin.min.cjs +1 -1
- package/modules/chart-hexbin.min.js +1 -1
- package/modules/chart-hexmap.d.ts +1 -1
- package/modules/chart-hexmap.esm.min.js +1 -1
- package/modules/chart-hexmap.min.cjs +1 -1
- package/modules/chart-hexmap.min.js +1 -1
- package/modules/chart-icicle.d.ts +1 -1
- package/modules/chart-icicle.esm.min.js +1 -1
- package/modules/chart-icicle.min.cjs +1 -1
- package/modules/chart-icicle.min.js +1 -1
- package/modules/chart-markermap.d.ts +1 -1
- package/modules/chart-markermap.esm.min.js +1 -1
- package/modules/chart-markermap.min.cjs +1 -1
- package/modules/chart-markermap.min.js +1 -1
- package/modules/chart-motion.d.ts +1 -1
- package/modules/chart-motion.esm.min.js +1 -1
- package/modules/chart-motion.min.cjs +1 -1
- package/modules/chart-motion.min.js +1 -1
- package/modules/chart-pack.d.ts +1 -1
- package/modules/chart-pack.esm.min.js +1 -1
- package/modules/chart-pack.min.cjs +1 -1
- package/modules/chart-pack.min.js +1 -1
- package/modules/chart-parallel.d.ts +1 -1
- package/modules/chart-parallel.esm.min.js +1 -1
- package/modules/chart-parallel.min.cjs +1 -1
- package/modules/chart-parallel.min.js +1 -1
- package/modules/chart-pictorial.d.ts +1 -1
- package/modules/chart-pictorial.esm.min.js +1 -1
- package/modules/chart-pictorial.min.cjs +1 -1
- package/modules/chart-pictorial.min.js +1 -1
- package/modules/chart-polararea.d.ts +1 -1
- package/modules/chart-polararea.esm.min.js +1 -1
- package/modules/chart-polararea.min.cjs +1 -1
- package/modules/chart-polararea.min.js +1 -1
- package/modules/chart-polarscatter.d.ts +1 -1
- package/modules/chart-polarscatter.esm.min.js +1 -1
- package/modules/chart-polarscatter.min.cjs +1 -1
- package/modules/chart-polarscatter.min.js +1 -1
- package/modules/chart-pyramid.d.ts +1 -1
- package/modules/chart-pyramid.esm.min.js +1 -1
- package/modules/chart-pyramid.min.cjs +1 -1
- package/modules/chart-pyramid.min.js +1 -1
- package/modules/chart-radialbar.d.ts +1 -1
- package/modules/chart-radialbar.esm.min.js +1 -1
- package/modules/chart-radialbar.min.cjs +1 -1
- package/modules/chart-radialbar.min.js +1 -1
- package/modules/chart-ridgeline.d.ts +1 -1
- package/modules/chart-ridgeline.esm.min.js +1 -1
- package/modules/chart-ridgeline.min.cjs +1 -1
- package/modules/chart-ridgeline.min.js +1 -1
- package/modules/chart-roc.d.ts +1 -1
- package/modules/chart-roc.esm.min.js +1 -1
- package/modules/chart-roc.min.cjs +1 -1
- package/modules/chart-roc.min.js +1 -1
- package/modules/chart-scatter3d.d.ts +1 -1
- package/modules/chart-scatter3d.esm.min.js +1 -1
- package/modules/chart-scatter3d.min.cjs +1 -1
- package/modules/chart-scatter3d.min.js +1 -1
- package/modules/chart-serpentine.d.ts +1 -1
- package/modules/chart-serpentine.esm.min.js +1 -1
- package/modules/chart-serpentine.min.cjs +1 -1
- package/modules/chart-serpentine.min.js +1 -1
- package/modules/chart-slope.d.ts +1 -1
- package/modules/chart-slope.esm.min.js +1 -1
- package/modules/chart-slope.min.cjs +1 -1
- package/modules/chart-slope.min.js +1 -1
- package/modules/chart-spiral.d.ts +1 -1
- package/modules/chart-spiral.esm.min.js +1 -1
- package/modules/chart-spiral.min.cjs +1 -1
- package/modules/chart-spiral.min.js +1 -1
- package/modules/chart-splom.d.ts +1 -1
- package/modules/chart-splom.esm.min.js +1 -1
- package/modules/chart-splom.min.cjs +1 -1
- package/modules/chart-splom.min.js +1 -1
- package/modules/chart-tree.d.ts +1 -1
- package/modules/chart-tree.esm.min.js +1 -1
- package/modules/chart-tree.min.cjs +1 -1
- package/modules/chart-tree.min.js +1 -1
- package/modules/chart-venn.d.ts +1 -1
- package/modules/chart-venn.esm.min.js +1 -1
- package/modules/chart-venn.min.cjs +1 -1
- package/modules/chart-venn.min.js +1 -1
- package/modules/chart-voronoi.d.ts +1 -1
- package/modules/chart-voronoi.esm.min.js +1 -1
- package/modules/chart-voronoi.min.cjs +1 -1
- package/modules/chart-voronoi.min.js +1 -1
- package/modules/chart-waffle.d.ts +1 -1
- package/modules/chart-waffle.esm.min.js +1 -1
- package/modules/chart-waffle.min.cjs +1 -1
- package/modules/chart-waffle.min.js +1 -1
- package/modules/chart-wordcloud.d.ts +1 -1
- package/modules/chart-wordcloud.esm.min.js +1 -1
- package/modules/chart-wordcloud.min.cjs +1 -1
- package/modules/chart-wordcloud.min.js +1 -1
- package/modules/charts.d.ts +1 -1
- package/modules/charts.esm.min.js +1 -1
- package/modules/charts.min.cjs +1 -1
- package/modules/charts.min.js +1 -1
- package/modules/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/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 +12 -8
- package/modules/scheduler.esm.min.js +90 -78
- package/modules/scheduler.esm.min.js.map +2 -2
- package/modules/scheduler.min.cjs +90 -78
- package/modules/scheduler.min.js +90 -78
- package/modules/scheduler.min.js.map +2 -2
- 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/lattice-grid.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.98.
|
|
2
|
+
* Lattice Grid 1.98.2, core + DOM renderer
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
6
6
|
(function(gr){"use strict";var Xs=!0,Yn=Object.create(null),Xn=Object.create(null);function Ue(e,H){Yn[e]=H}function xn(e){var H=Xn[e];if(H)return H;var ne=Object.create(null);Xn[e]=ne;var $=Yn[e];if(!$)throw new Error("[lattice] missing module: "+e);return $(ne,xn),ne}Ue("packages/core/src/internal/predicates.js",function(e,H){"use strict";Object.defineProperty(e,"isObject",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"isFunction",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"isNil",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"isBlank",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"isCtor",{enumerable:!0,get:function(){return x}});function ne(Z){return Z!==null&&typeof Z=="object"&&!Array.isArray(Z)}function $(Z){return typeof Z=="function"}function q(Z){return Z==null}function B(Z){return Z==null||Z===""}function x(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,H){"use strict";Object.defineProperty(e,"reportedWarnings",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"warnOnce",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"infoOnce",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"resetWarnings",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"fail",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"invariant",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"DEV",{enumerable:!0,get:function(){return h}});const ne=new Set,$=2e3;function q(l){if(ne.add(l),ne.size>$){const r=ne.values().next().value;r!==void 0&&ne.delete(r)}}const B=[],x=500;function Z(l,r,n){B.push({key:l,level:r,message:n.map(o=>typeof o=="string"?o:Y(o)).join(" "),at:Date.now()}),B.length>x&&B.shift()}function Y(l){if(l instanceof Error)return l.message;try{return JSON.stringify(l)}catch{return String(l)}}function U(){return B.map(l=>({...l}))}function W(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 K(l,...r){if(ne.has(l))return;q(l);const n=W(r);Z(l,"warn",n),console.warn("[lattice]",...n)}function E(l,...r){if(ne.has(l))return;q(l);const n=W(r);Z(l,"info",n),console.info("[lattice]",...n)}function O(){ne.clear(),B.length=0}function b(l,r){const n=new Error(`[lattice] ${l}`);throw r!==void 0&&(n.cause=r),n}function u(l,r){l||b(r)}const h=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})()}),Ue("packages/core/src/formatting/rules.js",function(e,H){"use strict";Object.defineProperty(e,"RULE_OPS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DISTRIBUTION_OPS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"DISTRIBUTION_LABELS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"testRule",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"mixColour",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"summariseColumn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"quantileOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"needsDistribution",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveDistribution",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ICON_SETS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"compileRules",{enumerable:!0,get:function(){return T}});const $=H("packages/core/src/internal/predicates.js").isFunction,B=H("packages/core/src/internal/warn.js").warnOnce,x=Object.freeze(["eq","ne","gt","gte","lt","lte","between","outside","contains","notContains","startsWith","endsWith","blank","notBlank","true","false"]),Z=Object.freeze(["topPercent","bottomPercent","topN","bottomN","aboveMean","belowMean","aboveMedian","belowMedian","zAbove","zBelow","outlier"]),Y=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 U(A,M){const _=Number(A),R=Number(M);if(A!==null&&A!==""&&M!==null&&M!==""&&Number.isFinite(_)&&Number.isFinite(R))return _<R?-1:_>R?1:0;const j=String(A??"").toLowerCase(),L=String(M??"").toLowerCase();return j<L?-1:j>L?1:0}function W(A){return A==null||A===""}function K(A,M){if(!M||typeof M!="object")return!1;const{op:_}=M,R=M.value,I=M.value2;switch(_){case"blank":return W(A);case"notBlank":return!W(A);case"true":return A===!0;case"false":return A===!1;default:break}if(W(A))return!1;switch(_){case"eq":return U(A,R)===0;case"ne":return U(A,R)!==0;case"gt":return U(A,R)>0;case"gte":return U(A,R)>=0;case"lt":return U(A,R)<0;case"lte":return U(A,R)<=0;case"between":return U(A,R)>=0&&U(A,I)<=0;case"outside":return U(A,R)<0||U(A,I)>0;case"contains":return String(A).toLowerCase().includes(String(R??"").toLowerCase());case"notContains":return!String(A).toLowerCase().includes(String(R??"").toLowerCase());case"startsWith":return String(A).toLowerCase().startsWith(String(R??"").toLowerCase());case"endsWith":return String(A).toLowerCase().endsWith(String(R??"").toLowerCase());default:return!1}}function E(A,M,_){const R=G=>{const X=String(G).replace("#",""),V=X.length===3?X.split("").map(J=>J+J).join(""):X;return[0,2,4].map(J=>parseInt(V.slice(J,J+2),16)||0)},[I,j,L]=R(A),[F,N,S]=R(M),C=Math.max(0,Math.min(1,_)),D=(G,X)=>Math.round(G+(X-G)*C);return`#${[D(I,F),D(j,N),D(L,S)].map(G=>G.toString(16).padStart(2,"0")).join("")}`}function O(A){const M=[];for(const F of A||[]){if(F==null||F==="")continue;const N=F instanceof Date?F.getTime():Number(F);Number.isFinite(N)&&M.push(N)}if(!M.length)return null;M.sort((F,N)=>F-N);let _=0,R=0,I=0;for(const F of M){_++;const N=F-R;R+=N/_,I+=N*(F-R)}const j=b(M,.25),L=b(M,.75);return{n:M.length,min:M[0],max:M[M.length-1],mean:R,stddev:M.length>1?Math.sqrt(I/(M.length-1)):0,median:b(M,.5),q1:j,q3:L,iqr:L-j,sorted:M}}function b(A,M){if(!A.length)return 0;const _=(A.length-1)*Math.max(0,Math.min(1,M)),R=Math.floor(_),I=Math.ceil(_);return R===I?A[R]:A[R]+(_-R)*(A[I]-A[R])}function u(A){for(const M of Array.isArray(A)?A:[])if(!(!M||typeof M!="object")&&(M.when&&Z.includes(M.when.op)||M.scale&&M.scale.from||M.dataBar&&!(Number.isFinite(Number(M.dataBar.min))&&Number.isFinite(Number(M.dataBar.max)))||M.iconSet&&!Array.isArray(M.iconSet.thresholds)))return!0;return!1}function h(A,M){const _=Number(A.value),R=I=>b(M.sorted,I);switch(A.op){case"topPercent":{const I=l(_,10);return{op:"gte",value:R(1-I)}}case"bottomPercent":{const I=l(_,10);return{op:"lte",value:R(I)}}case"topN":{const I=Math.max(1,Math.floor(_)||1),j=Math.max(0,M.sorted.length-I);return{op:"gte",value:M.sorted[j]}}case"bottomN":{const I=Math.max(1,Math.floor(_)||1),j=Math.min(M.sorted.length-1,I-1);return{op:"lte",value:M.sorted[j]}}case"aboveMean":return{op:"gt",value:M.mean};case"belowMean":return{op:"lt",value:M.mean};case"aboveMedian":return{op:"gt",value:M.median};case"belowMedian":return{op:"lt",value:M.median};case"zAbove":return M.stddev?{op:"gte",value:M.mean+(Number.isFinite(_)?_:2)*M.stddev}:null;case"zBelow":return M.stddev?{op:"lte",value:M.mean-(Number.isFinite(_)?_:2)*M.stddev}:null;case"outlier":{const I=(Number.isFinite(_)&&_>0?_:1.5)*M.iqr;return M.iqr?{op:"outside",value:M.q1-I,value2:M.q3+I}:null}default:return null}}function l(A,M){const _=Number.isFinite(A)?A:M,R=_>1?_/100:_;return Math.max(0,Math.min(1,R))}function r(A,M){if(A.from==="minmax")return{...A,min:M.min,max:M.max};if(A.from==="quantile")return{...A,min:b(M.sorted,l(Number(A.low),5)),max:b(M.sorted,l(Number(A.high),95))};if(A.from==="stddev"){const _=Number.isFinite(Number(A.deviations))?Number(A.deviations):2;return{...A,min:M.mean-_*M.stddev,max:M.mean+_*M.stddev}}return A}function n(A,M){const _=Array.isArray(A)?A:[];return!M||!M.n?_.map(R=>R&&u([R])?{...R,enabled:!1}:R):_.map(R=>{if(!R||typeof R!="object")return R;if(R.scale&&R.scale.from)return{...R,scale:r(R.scale,M)};if(R.dataBar)return{...R,dataBar:o(R.dataBar,M)};if(R.iconSet)return{...R,iconSet:i(R.iconSet,M)};if(!R.when||!Z.includes(R.when.op))return R;const I=h(R.when,M);return I?{...R,when:I}:{...R,enabled:!1}})}function o(A,M){const _=Number.isFinite(Number(A.min))?Number(A.min):void 0,R=Number.isFinite(Number(A.max))?Number(A.max):void 0;if(_!==void 0&&R!==void 0)return{...A,min:_,max:R};if(A.from==="quantile")return{...A,min:_??b(M.sorted,l(Number(A.low),5)),max:R??b(M.sorted,l(Number(A.high),95))};if(A.from==="stddev"){const I=Number.isFinite(Number(A.deviations))?Number(A.deviations):2;return{...A,min:_??M.mean-I*M.stddev,max:R??M.mean+I*M.stddev}}return{...A,min:_??M.min,max:R??M.max}}function i(A,M){if(Array.isArray(A.thresholds))return A;const _=t(A),R=[];for(let I=1;I<_;I++)R.push(b(M.sorted,I/_));return{...A,thresholds:R}}function t(A){if(Array.isArray(A.icons)&&A.icons.length>=2)return A.icons.length;if(Number.isFinite(Number(A.count))&&Number(A.count)>=2)return Math.floor(Number(A.count));const M=k[A.set];return M?M.length:3}function c(A){return`url("data:image/svg+xml,${encodeURIComponent(A)}")`}function s(A){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="${A}"/></svg>`}function a(A,M){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><polygon points="${M==="up"?"8,2 14,13 2,13":M==="down"?"2,3 14,3 8,14":"4,2 14,8 4,14"}" fill="${A}"/></svg>`}function f(A,M){const _="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 R=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${M*16} 16">`;for(let I=0;I<M;I++){const j=I<A?"#f5a623":"#d0d0d0";R+=`<path transform="translate(${I*16},0)" d="${_}" fill="${j}"/>`}return`${R}</svg>`}const w=Object.freeze([a("#c0392b","down"),a("#e0a800","right"),a("#2e7d32","up")]),g=Object.freeze([s("#d13438"),s("#f5a623"),s("#2e9e44")]),k=Object.freeze({arrows:w,trafficLights:g,ratings:Object.freeze([1,2,3,4,5].map(A=>f(A,5)))}),d=Object.freeze({arrows:"Arrows",trafficLights:"Traffic lights",ratings:"Ratings"});function p(A){if(Array.isArray(A.icons)&&A.icons.length>=2)return A.icons.map(R=>/^\s*(url\(|data:|<)/.test(String(R))&&String(R).trim().startsWith("<")?c(String(R)):String(R));const M=A.set||"arrows";if(M==="ratings"){const R=t(A),I=[];for(let j=1;j<=R;j++)I.push(c(f(j,R)));return I}const _=k[M];return _?_.map(c):(B(`iconSet:${M}`,`unknown icon set '${M}'; falling back to arrows.`),w.map(c))}function m(A){const M=Number(A.min),R=Number(A.max)-M,I=A.colour||A.color||"#5b9bd5",j=A.negativeColour||A.negativeColor||"#d13438",L=A.direction==="rtl"?"left":"right",F=S=>Math.max(0,Math.min(1,(S-M)/R))*100,N=R?Math.max(0,Math.min(100,(0-M)/R*100)):0;return S=>{if(W(S))return null;const C=Number(S);if(!Number.isFinite(C)||!R)return null;const D=F(C),G=Math.min(D,N),X=Math.max(D,N),V=C>=0?I:j;return{backgroundImage:`linear-gradient(to ${L}, transparent ${G}%, ${V} ${G}%, ${V} ${X}%, transparent ${X}%)`,backgroundRepeat:"no-repeat",backgroundPosition:"0 0"}}}function v(A){const M=p(A),_=A.reverse?[...M].reverse():M,R=(Array.isArray(A.thresholds)?A.thresholds:[]).map(Number).filter(Number.isFinite),I=Number.isFinite(Number(A.size))?Number(A.size):16,j=A.set==="ratings"?I*t(A):I;return L=>{if(W(L))return null;const F=Number(L);if(!Number.isFinite(F))return null;let N=0;for(const C of R)F>=C&&N++;const S=_[Math.min(N,_.length-1)];return S?{backgroundImage:S,backgroundRepeat:"no-repeat",backgroundPosition:"left center",backgroundSize:`${j}px ${I}px`,paddingLeft:`${j+4}px`}:null}}function y(A){const M=Array.isArray(A.colours)&&A.colours.length>=2?A.colours:["#f8f9fa","#1a6bc7"],_=Number(A.min),R=Number(A.max),I=R-_,j=M.length-1,L=[];for(let N=0;N<=j;N++)L.push(j?N/j:0);const F=Number(A.mid);if(A.mid!==void 0&&A.mid!==null)if(M.length%2===0)B("formatting.scale.mid.even",`a scale's "mid" needs an odd number of colours (a middle stop to pin); ${M.length} were given, so "mid" was ignored.`);else if(Number.isFinite(F)&&I&&F>Math.min(_,R)&&F<Math.max(_,R)){const N=j/2,S=Math.max(0,Math.min(1,(F-_)/I));for(let C=0;C<=j;C++)L[C]=C<=N?N?C/N*S:S:S+(C-N)/(j-N)*(1-S)}else Number.isFinite(F)&&B("formatting.scale.mid.range",`a scale's "mid" (${F}) is outside its min..max range, so it was ignored.`);return N=>{const S=Number(N);if(!Number.isFinite(S)||!I)return null;const C=Math.max(0,Math.min(1,(S-_)/I));let D=0;for(;D<j-1&&C>L[D+1];)D++;const G=L[D+1]-L[D],X=G>0?(C-L[D])/G:0;return{background:E(M[D],M[D+1],Math.max(0,Math.min(1,X)))}}}function T(A,M=null){const _=u(A)?n(A,M):A,R=(Array.isArray(_)?_:[]).filter(j=>j&&typeof j=="object");if(!R.length)return()=>null;const I=R.map(j=>j.scale?{scale:y(j.scale),enabled:j.enabled!==!1}:j.dataBar?{scale:m(j.dataBar),enabled:j.enabled!==!1}:j.iconSet?{scale:v(j.iconSet),enabled:j.enabled!==!1}:{when:j.when,style:j.style,stop:j.stopIfTrue!==!1,enabled:j.enabled!==!1});return j=>{const L=j?j.value:void 0;let F=null;for(const N of I){if(!N.enabled)continue;if(N.scale){const C=N.scale(L);C&&(F={...F||{},...C});continue}if(!K(L,N.when))continue;const S=$(N.style)?N.style(j):N.style;if(S&&(F={...F||{},...S}),N.stop)break}return F}}}),Ue("packages/core/src/formula/parse.js",function(e,H){"use strict";Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return K}}),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 n}});const ne="num",$="str",q="ref",B="name",x="op",Z="end",Y=["<=",">=","<>","!="],U="+-*/^%(),<>=";class W extends Error{constructor(i,t){super(i),this.name="FormulaError",this.at=t}}function K(o){const i=[];let t=0;for(;t<o.length;){const c=o[t];if(c===" "||c===" "||c===`
|
|
7
|
-
`||c==="\r"){t++;continue}if(c>="0"&&c<="9"){t=O(o,t,i);continue}if(c==="."&&o[t+1]>="0"&&o[t+1]<="9"){t=O(o,t,i);continue}if(c==='"'||c==="'"){t=b(o,t,i);continue}if(c==="["){const a=o.indexOf("]",t+1);if(a<0)throw new W("a [column reference] was opened and never closed",t);i.push({kind:q,value:o.slice(t+1,a).trim(),at:t}),t=a+1;continue}if(E(c)){t=u(o,t,i);continue}const s=o.slice(t,t+2);if(Y.includes(s)){i.push({kind:x,value:s==="!="?"<>":s,at:t}),t+=2;continue}if(U.includes(c)){i.push({kind:x,value:c,at:t}),t++;continue}throw new W(`unexpected character ${JSON.stringify(c)}`,t)}return i.push({kind:Z,value:null,at:o.length}),i}function E(o){return/[A-Za-z_À-]/.test(o)}function O(o,i,t){let c=i,s=!1;for(;c<o.length;){const a=o[c];if(a>="0"&&a<="9"){c++;continue}if(a==="."&&!s){s=!0,c++;continue}if((a==="e"||a==="E")&&/[0-9+-]/.test(o[c+1]||"")){for(c+=2;c<o.length&&o[c]>="0"&&o[c]<="9";)c++;break}break}return t.push({kind:ne,value:Number(o.slice(i,c)),at:i}),c}function b(o,i,t){const c=o[i];let s=i+1,a="";for(;s<o.length;){if(o[s]===c){if(o[s+1]===c){a+=c,s+=2;continue}return t.push({kind:$,value:a,at:i}),s+1}a+=o[s],s++}throw new W("a string was opened and never closed",i)}function u(o,i,t){let c=i;for(;c<o.length&&/[A-Za-z0-9_.À-]/.test(o[c]);)c++;const s=o.slice(i,c);let a=c;for(;a<o.length&&o[a]===" ";)a++;return t.push({kind:o[a]==="("?B:q,value:s,at:i}),c}const h={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function l(o){const i=String(o??"").replace(/^\s*=/,"");if(!i.trim())throw new W("the formula is empty");const t=K(i);let c=0;const s=()=>t[c],a=()=>t[c++],f=v=>{const y=s();if(y.kind!==x||y.value!==v)throw new W(`expected ${JSON.stringify(v)}`,y.at);c++},w=v=>{let y=g();for(;;){const T=s();if(T.kind!==x)break;const A=h[T.value];if(!A||A<v)break;c++;const M=w(T.value==="^"?A:A+1);y={kind:"bin",op:T.value,left:y,right:M}}return y},g=()=>{const v=s();return v.kind===x&&(v.value==="-"||v.value==="+")?(c++,{kind:"unary",op:v.value,arg:g()}):k()},k=()=>{let v=d();for(;s().kind===x&&s().value==="%";)c++,v={kind:"unary",op:"%",arg:v};return v},d=()=>{const v=a();if(v.kind===ne)return{kind:"num",value:v.value};if(v.kind===$)return{kind:"str",value:v.value};if(v.kind===q)return{kind:"ref",name:v.value};if(v.kind===B){f("(");const y=[];if(!(s().kind===x&&s().value===")"))for(;;){if(y.push(w(1)),s().kind===x&&s().value===","){c++;continue}break}return f(")"),{kind:"call",name:String(v.value).toUpperCase(),args:y}}if(v.kind===x&&v.value==="("){const y=w(1);return f(")"),y}throw v.kind===Z?new W("the formula ends unexpectedly",v.at):new W(`unexpected ${JSON.stringify(v.value)}`,v.at)},p=w(1),m=s();if(m.kind!==Z)throw new W(`unexpected ${JSON.stringify(m.value)}: is an operator missing?`,m.at);return p}function r(o){const i=new Set,t=c=>{if(!(!c||typeof c!="object")){if(c.kind==="ref"){i.add(String(c.name));return}if(c.kind==="bin"){t(c.left),t(c.right);return}if(c.kind==="unary"){t(c.arg);return}if(c.kind==="call")for(const s of c.args)t(s)}};return t(o),[...i]}function n(o){return typeof o=="string"&&/^\s*=/.test(o)&&o.trim()!=="="}}),Ue("packages/core/src/formula/evaluate.js",function(e,H){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return O}});const $=H("packages/core/src/formula/parse.js").FormulaError;function q(b){if(b==null||b==="")return 0;if(typeof b=="boolean")return b?1:0;if(b instanceof Date)return b.getTime();const u=typeof b=="number"?b:Number(String(b).replace(/[,\s]/g,""));if(!Number.isFinite(u))throw new $(`${JSON.stringify(b)} is not a number`);return u}function B(b){return b==null?"":String(b)}function x(b){if(typeof b=="boolean")return b;if(b==null||b==="")return!1;if(typeof b=="number")return b!==0;const u=String(b).trim().toLowerCase();return u==="false"||u==="no"||u==="0"?!1:u!==""}function Z(b){const u=[];for(const h of b){if(Array.isArray(h)){for(const l of h)l!=null&&l!==""&&u.push(q(l));continue}h==null||h===""||u.push(q(h))}return u}function Y(b,u){const h=10**u,l=b*h;return Math.sign(l)*Math.round(Math.abs(l)+Number.EPSILON*Math.abs(l))/h}function U(b,u){if(!b.length)return 0;const h=b.slice().sort((o,i)=>o-i),l=(h.length-1)*Math.min(1,Math.max(0,u)),r=Math.floor(l),n=Math.ceil(l);return r===n?h[r]:h[r]+(l-r)*(h[n]-h[r])}function W(b,u){let h=0,l=0,r=0;for(const o of b){h++;const i=o-l;l+=i/h,r+=i*(o-l)}const n=u?h-1:h;return n>0?Math.sqrt(r/n):0}const K={SUM:b=>Z(b).reduce((u,h)=>u+h,0),AVERAGE:b=>{const u=Z(b);return u.length?u.reduce((h,l)=>h+l,0)/u.length:0},MIN:b=>{const u=Z(b);return u.length?Math.min(...u):0},MAX:b=>{const u=Z(b);return u.length?Math.max(...u):0},COUNT:b=>Z(b).length,PRODUCT:b=>Z(b).reduce((u,h)=>u*h,1),ROUND:b=>Y(q(b[0]),b.length>1?q(b[1]):0),ROUNDDOWN:b=>{const u=10**(b.length>1?q(b[1]):0),h=q(b[0])*u;return(h<0?Math.ceil(h):Math.floor(h))/u},ROUNDUP:b=>{const u=10**(b.length>1?q(b[1]):0),h=q(b[0])*u;return(h<0?Math.floor(h):Math.ceil(h))/u},ABS:b=>Math.abs(q(b[0])),FLOOR:b=>Math.floor(q(b[0])),CEILING:b=>Math.ceil(q(b[0])),SQRT:b=>Math.sqrt(q(b[0])),POWER:b=>q(b[0])**q(b[1]),MOD:b=>{const u=q(b[1]);if(u===0)throw new $("MOD by zero");return(q(b[0])%u+u)%u},IF:b=>x(b[0])?b[1]:b.length>2?b[2]:!1,AND:b=>b.every(x),OR:b=>b.some(x),NOT:b=>!x(b[0]),COALESCE:b=>b.find(u=>u!=null&&u!=="")??null,CONCAT:b=>b.map(B).join(""),LEN:b=>B(b[0]).length,UPPER:b=>B(b[0]).toUpperCase(),LOWER:b=>B(b[0]).toLowerCase(),TRIM:b=>B(b[0]).trim(),LEFT:b=>B(b[0]).slice(0,b.length>1?q(b[1]):1),RIGHT:b=>{const u=b.length>1?q(b[1]):1;return u<=0?"":B(b[0]).slice(-u)},MEDIAN:b=>U(Z(b),.5),PERCENTILE:b=>{const u=q(b[b.length-1]);return U(Z(b.slice(0,-1)),u>1?u/100:u)},QUARTILE1:b=>U(Z(b),.25),QUARTILE3:b=>U(Z(b),.75),STDEV:b=>W(Z(b),!0),STDEVP:b=>W(Z(b),!1),VAR:b=>{const u=W(Z(b),!0);return u*u},VARP:b=>{const u=W(Z(b),!1);return u*u},COUNTDISTINCT:b=>{const u=new Set;for(const h of b){const l=Array.isArray(h)?h:[h];for(const r of l)r!=null&&r!==""&&u.add(r)}return u.size},IQR:b=>{const u=Z(b);return U(u,.75)-U(u,.25)}};K.AVG=K.AVERAGE,K.CEIL=K.CEILING,K.POW=K.POWER,K.STDEVS=K.STDEV,K.PERCENTILEINC=K.PERCENTILE;function E(b,u){const h=Number(b),l=Number(u);if(b!==null&&b!==""&&u!==null&&u!==""&&Number.isFinite(h)&&Number.isFinite(l))return h<l?-1:h>l?1:0;const n=B(b).toLowerCase(),o=B(u).toLowerCase();return n<o?-1:n>o?1:0}function O(b,u={}){const h=typeof u.lookup=="function"?u.lookup:null,l=u.functions?{...K,...u.functions}:K,r=n=>{switch(n.kind){case"num":return n.value;case"str":return n.value;case"ref":{if(!h)throw new $(`there is no column called ${JSON.stringify(n.name)} here`);const o=h(String(n.name));if(o===void 0)throw new $(`there is no column called ${JSON.stringify(n.name)}`);return o}case"unary":{if(n.op==="%")return q(r(n.arg))/100;const o=q(r(n.arg));return n.op==="-"?-o:o}case"bin":{const o=n.op;if(o==="=")return E(r(n.left),r(n.right))===0;if(o==="<>")return E(r(n.left),r(n.right))!==0;if(o==="<")return E(r(n.left),r(n.right))<0;if(o==="<=")return E(r(n.left),r(n.right))<=0;if(o===">")return E(r(n.left),r(n.right))>0;if(o===">=")return E(r(n.left),r(n.right))>=0;const i=q(r(n.left)),t=q(r(n.right));if(o==="+")return i+t;if(o==="-")return i-t;if(o==="*")return i*t;if(o==="^")return i**t;if(o==="/"){if(t===0)throw new $("division by zero");return i/t}throw new $(`unknown operator ${JSON.stringify(o)}`)}case"call":{const o=u.lazy&&u.lazy[n.name];if(typeof o=="function")return o(n.args,r,u);const i=l[n.name];if(typeof i!="function")throw new $(`there is no function called ${n.name}`);return i(n.args.map(r),u)}default:throw new $("the formula could not be read")}};return r(b)}}),Ue("packages/core/src/formula/index.js",function(e,H){"use strict";Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return E}});const ne=H("packages/core/src/formula/parse.js"),$=ne.parseFormula,q=ne.referencesOf,B=ne.looksLikeFormula,x=ne.FormulaError,Z=ne.tokenise,Y=H("packages/core/src/formula/evaluate.js"),U=Y.evaluateAst,W=Y.FUNCTIONS;function K(O){const{grid:b,row:u,data:h}=O||{},l=t=>String(t).toLowerCase().replace(/[\s_-]/g,""),r=b&&b.columns&&typeof b.columns.all=="function"?b.columns.all():[],n=b&&b.permissions,o=n&&typeof n.isReadable=="function"?t=>n.isReadable(t):()=>!0,i=new Set;for(const t of r)o(t)||(i.add(l(t.id)),t.field&&i.add(l(t.field)),t.title&&i.add(l(t.title)));return t=>{const c=l(t);if(i.has(c))throw new x(`"${t}" cannot be read`);for(const s of r)if(l(s.id)===c||s.field&&l(s.field)===c||s.title&&l(s.title)===c)return u&&b.rows&&typeof b.rows.value=="function"?b.rows.value(u.key,s.id):h?h[s.field||s.id]:void 0;if(h&&typeof h=="object"){for(const s of Object.keys(h))if(l(s)===c){if(!o(s))throw new x(`"${t}" cannot be read`);return h[s]}}}}function E(O,b={}){try{const u=$(O);return{ok:!0,value:U(u,{lookup:K(b),functions:b.formulaFunctions}),references:q(u)}}catch(u){return{ok:!1,error:u instanceof x?u.message:"the formula could not be read",at:u instanceof x?u.at:void 0}}}}),Ue("packages/core/src/internal/version.js",function(e,H){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return q}});const ne="1.98.1";async function $(){return ne}const q="1.98.1"}),Ue("packages/core/src/internal/merge.js",function(e,H){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"mergeRow",{enumerable:!0,get:function(){return Y}});const $=H("packages/core/src/internal/predicates.js").isObject;function q(U,W,K){if(U!==void 0)return U===!0?{enabled:!0,...K}:U===!1?{enabled:!1}:$(U)?U:{[W]:U,enabled:!0}}function B(U){return U==null?[]:Array.isArray(U)?U:[U]}const x=Object.freeze(new Set(["__proto__","constructor","prototype"]));function Z(U,W){if(!$(U))return $(W)?{...W}:W;if(!$(W))return W===void 0?U:W;const K={...U};for(const E of Object.keys(W)){if(x.has(E))continue;const O=W[E];O!==void 0&&(K[E]=$(O)&&$(K[E])?Z(K[E],O):O)}return K}function Y(U,W){if(!$(U)||!$(W)||U===W)return W;const K=Object.create(Object.getPrototypeOf(U));return Object.assign(K,U,W),K}}),Ue("packages/core/src/internal/schedule.js",function(e,H){"use strict";Object.defineProperty(e,"now",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"nextFrame",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return Y}});function ne(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const $=typeof requestAnimationFrame=="function";function q(U){return $?requestAnimationFrame(U):setTimeout(()=>U(ne()),16)}function B(U){U!=null&&($?cancelAnimationFrame(U):clearTimeout(U))}function x(U){let W=null,K=null;const E=()=>{W=null;const b=K;K=null,U(...b||[])},O=(...b)=>{K=b,W===null&&(W=q(E))};return O.cancel=()=>{B(W),W=null,K=null},O.flush=()=>{W!==null&&(B(W),E())},O}function Z(U,W){let K=null,E=null;const O=()=>{if(K=null,E===null)return;const h=E;E=null,U(...h),b()},b=()=>{K=setTimeout(O,W),typeof K?.unref=="function"&&K.unref()},u=(...h)=>{K===null?(U(...h),b()):(E=h,clearTimeout(K),b())};return u.flush=()=>{if(K!==null&&clearTimeout(K),K=null,E===null)return;const h=E;E=null,U(...h)},u.cancel=()=>{K!==null&&clearTimeout(K),K=null,E=null},u.pending=()=>K!==null||E!==null,u}function Y(U,W=50){return typeof requestIdleCallback=="function"?requestIdleCallback(U,{timeout:W}):setTimeout(()=>U({timeRemaining:()=>0,didTimeout:!0}),1)}}),Ue("packages/core/src/internal/paths.js",function(e,H){"use strict";Object.defineProperty(e,"pathGetter",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"pathSetter",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"getPath",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return Z}});const ne=new Map;function $(Y){let U=ne.get(Y);if(U)return U;if(!Y.includes("."))U=W=>W?.[Y];else{const W=Y.split("."),K=W.length;U=E=>{let O=E;for(let b=0;b<K;b++){if(O==null)return;O=O[W[b]]}return O}}return ne.set(Y,U),U}const q=new Map;function B(Y){let U=q.get(Y);if(U)return U;if(!Y.includes("."))U=(W,K)=>{W!=null&&(W[Y]=K)};else{const W=Y.split("."),K=W.length-1;U=(E,O)=>{let b=E;for(let u=0;u<K;u++){if(b==null)return;const h=W[u];b[h]==null&&(b[h]={}),b=b[h]}b!=null&&(b[W[K]]=O)}}return q.set(Y,U),U}function x(Y,U){return $(U)(Y)}function Z(Y,U,W){B(U)(Y,W)}}),Ue("packages/core/src/internal/compare.js",function(e,H){"use strict";Object.defineProperty(e,"collator",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"defaultCompare",{enumerable:!0,get:function(){return q}});const ne=new Map;function $(B,x){const Z=`${B||""}|${x?JSON.stringify(x):""}`;let Y=ne.get(Z);return Y||(Y=new Intl.Collator(B||void 0,{numeric:!0,sensitivity:"variant",...x}),ne.set(Z,Y)),Y}function q(B,x){if(B===x)return 0;if(B==null)return 1;if(x==null)return-1;if(typeof B=="number"&&typeof x=="number")return Number.isNaN(B)?Number.isNaN(x)?0:1:Number.isNaN(x)||B<x?-1:B>x?1:0;const Z=String(B),Y=String(x);return Z<Y?-1:Z>Y?1:0}}),Ue("packages/core/src/defaults.js",function(e,H){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return E}});const $=H("packages/core/src/internal/predicates.js").isObject,B=H("packages/core/src/internal/merge.js").merge,Z=H("packages/core/src/internal/warn.js").warnOnce;let Y=null;class U extends Error{}function W(O,b=new Set){if(Array.isArray(O)){if(b.has(O))throw new U;b.add(O);const h=O.map(l=>W(l,b));return b.delete(O),h}if(!$(O)||Object.getPrototypeOf(O)!==Object.prototype&&Object.getPrototypeOf(O)!==null)return O;if(b.has(O))throw new U;b.add(O);const u={};for(const[h,l]of Object.entries(O))u[h]=W(l,b);return b.delete(O),u}function K(O){if(O===void 0)return W(Y??{});if(O===null)return Y=null,{};if(!$(O))return Z("defaults:type",`defaults() expects a configuration object, or null to clear it, but got ${Array.isArray(O)?"an array":typeof O}. The call was ignored and the defaults are unchanged.`),W(Y??{});try{Y=W(O)}catch(b){if(!(b instanceof U))throw b;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."),W(Y??{})}return W(Y)}function E(O){return Y===null?O:B(W(Y),O)}}),Ue("packages/core/src/internal/uid.js",function(e,H){"use strict";Object.defineProperty(e,"uid",{enumerable:!0,get:function(){return $}});let ne=0;function $(q="l"){return`${q}${(++ne).toString(36)}`}}),Ue("packages/core/src/events/names.js",function(e,H){"use strict";Object.defineProperty(e,"EVENT_NAMES",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"isKnownEvent",{enumerable:!0,get:function(){return q}});const ne=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"]),$=new Set(ne);function q(B){return B==="*"||$.has(B)}}),Ue("packages/core/src/events/bus.js",function(e,H){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return h}});const ne=H("packages/core/src/internal/warn.js"),$=ne.warnOnce,q=ne.DEV,x=H("packages/core/src/internal/uid.js").uid,Y=H("packages/core/src/events/names.js").isKnownEvent,U="*";function W(l,r){!q||Y(r)||$(`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 K=new Set(["api","user","init","ai"]),E=new WeakMap;function O(l){let r=E.get(l);return r||(r=x("h"),E.set(l,r)),r}function b(){return typeof performance=="object"&&performance?performance.now():Date.now()}function u(l){if(!l||typeof l!="object")return{};const r={};for(const[n,o]of Object.entries(l))n!=="grid"&&(o==null?r[n]=String(o):Array.isArray(o)?r[n]=`[${o.length}]`:typeof o=="object"?r[n]=o.key?`row ${o.key}`:"{…}":typeof o=="function"?r[n]="[function]":r[n]=String(o).slice(0,60));return r}class h{#e=new Map;#t=!1;#n=[];#r=200;#i=new Map;#s=null;#o=!1;#l=0;constructor(r=null){this.#s=r}attach(r){this.#s=r}get grid(){return this.#s}get destroyed(){return this.#o}on(r,n){if(typeof n!="function")return $(`bus.handler:${r}`,`on('${r}') needs a function; ignored.`),()=>{};W("on",r);let o=this.#e.get(r);return o||(o=[],this.#e.set(r,o)),o.push(n),()=>this.off(r,n)}once(r,n){if(typeof n!="function")return $(`bus.handler:${r}`,`once('${r}') needs a function; ignored.`),()=>{};W("once",r);const o=i=>{this.off(r,n),n(i)};return this.#i.set(n,o),this.on(r,o)}off(r,n){if(n===void 0){this.#e.delete(r);return}const o=this.#e.get(r);if(!o)return;const i=this.#i.get(n),t=i&&o.includes(i)?i:n,c=o.indexOf(t);c>=0&&o.splice(c,1),i&&t===i&&this.#i.delete(n),o.length===0&&this.#e.delete(r)}count(r){const n=this.#e.get(r),o=r===U?null:this.#e.get(U);return(n?n.length:0)+(o?o.length:0)}#a(r,n,o,i,t){this.#n.push({type:r,origin:n,listeners:(i?i.length:0)+(t?t.length:0),payload:u(o),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(r,n){this.#t=!!r,Number.isFinite(n)&&n>0&&(this.#r=Math.floor(n)),r||(this.#n=[])}eventLog(){return this.#n.map(r=>({...r}))}clearEventLog(){this.#n=[]}counts(){const r={};for(const[n,o]of this.#e)r[n]=o.length;return r}emit(r,n,o){const i=o??(n&&n.origin),t=K.has(i)?i:"api",c={...n||null,type:r,origin:t,grid:this.#s};if(this.#o)return c;const s=this.#e.get(r),a=r===U?void 0:this.#e.get(U);if(this.#t&&this.#a(r,t,n,s,a),!s&&!a)return c;const f=this.#t?b():0;this.#l++;try{s&&this.#c(s.slice(),c,r),a&&this.#c(a.slice(),c,U)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=b()-f)}return c}emitBefore(r,n,o){const i=o??(n&&n.origin),t=K.has(i)?i:"user";let c=!1,s=null;const a=p=>{c=!0,p!=null&&s===null&&(s=String(p))},f={...n||null,type:r,origin:t,grid:this.#s,get defaultPrevented(){return c},get reason(){return s},preventDefault(p){a(p)}};if(this.#o)return!0;const w=this.#e.get(r);this.#t&&this.#a(r,t,n,w,void 0);const g=w?w.slice():[];if(g.length===0)return!0;const k=()=>(c&&s===null&&(s="prevented"),c&&n&&typeof n=="object"&&(n.reason=s),!c),d=[];for(const p of g)try{const m=p(f);m&&typeof m.then=="function"?d.push(m):m===!1&&a("prevented")}catch(m){a("error"),$(`bus.beforeThrow:${r}:${O(p)}`,`a '${r}' before-handler threw; the action was cancelled.`,m)}return d.length===0?k():Promise.allSettled(d).then(p=>{for(const m of p)m.status==="rejected"?(a("error"),$(`bus.beforeReject:${r}`,`a '${r}' before-handler rejected; the action was cancelled.`,m.reason)):m.value===!1&&a("prevented");return k()})}#c(r,n,o){for(let i=0;i<r.length;i++)try{r[i](n)}catch(t){$(`bus.throw:${o}:${O(r[i])}`,`a '${o}' handler threw; other handlers were unaffected.`,t)}}clear(){this.#e.clear(),this.#i.clear()}destroy(){this.clear(),this.#o=!0,this.#s=null}}}),Ue("packages/core/src/registry/free-tier-notice.js",function(e,H){"use strict";Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return ne}});const ne="Free for non-commercial use: latticegrid.dev/free"}),Ue("packages/core/src/registry/licence.js",function(e,H){"use strict";Object.defineProperty(e,"PRODUCT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"LICENCE_VERSION",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"fromBase64Url",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"toBase64Url",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"asciiBytes",{enumerable:!0,get:function(){return u}}),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 f}}),Object.defineProperty(e,"isLocalHost",{enumerable:!0,get:function(){return w}}),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 T}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return R}});const $=H("packages/core/src/internal/warn.js").warnOnce,q=H("packages/core/src/registry/free-tier-notice.js"),B=q.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return q.FREE_TIER_NOTICE}});const x="lattice-grid",Z=1,Y="LG1",U=64,W="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",K="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",E=(()=>{const I=new Int16Array(128).fill(-1);for(let j=0;j<K.length;j++)I[K.charCodeAt(j)]=j;return I[43]=62,I[47]=63,I})();function O(I){if(typeof I!="string")return null;let j="";for(let D=0;D<I.length;D++){const G=I.charCodeAt(D);if(G!==61){if(G>127||E[G]<0)return null;j+=I[D]}}const L=j.length;if(L%4===1)return null;const F=new Uint8Array(Math.floor(L*3/4));let N=0,S=0,C=0;for(let D=0;D<L;D++)N=N<<6|E[j.charCodeAt(D)],S+=6,S>=8&&(S-=8,F[C++]=N>>S&255);return C===F.length?F:F.subarray(0,C)}function b(I){let j="",L=0;for(;L+2<I.length;L+=3){const N=I[L]<<16|I[L+1]<<8|I[L+2];j+=K[N>>18&63]+K[N>>12&63]+K[N>>6&63]+K[N&63]}const F=I.length-L;if(F===1){const N=I[L]<<16;j+=K[N>>18&63]+K[N>>12&63]}else if(F===2){const N=I[L]<<16|I[L+1]<<8;j+=K[N>>18&63]+K[N>>12&63]+K[N>>6&63]}return j}function u(I){const j=new Uint8Array(I.length);for(let L=0;L<I.length;L++)j[L]=I.charCodeAt(L)&127;return j}function h(I){if(typeof TextDecoder=="function")return new TextDecoder().decode(I);let j="";for(let L=0;L<I.length;L++)j+=String.fromCharCode(I[L]);return j}function l(I){const j={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof I=="string"?I:""};if(typeof I!="string"||I.length===0)return{...j,reason:"missing"};const L=I.trim(),F=L.split(".");if(F.length!==3)return j;const[N,S,C]=F;if(N!==Y)return{...j,reason:"prefix"};const D=O(S),G=O(C);if(!D||!G)return j;let X;try{X=JSON.parse(h(D))}catch{return j}return X===null||typeof X!="object"?j:{ok:!0,reason:null,product:typeof X.p=="string"?X.p:null,issuedTo:typeof X.t=="string"?X.t:null,expires:typeof X.e=="string"?X.e:null,terms:typeof X.terms=="string"?X.terms:null,features:Array.isArray(X.f)?X.f.slice():[],deployments:Array.isArray(X.d)?X.d.slice():[],version:typeof X.v=="number"?X.v:0,message:u(S),signature:G,raw:L}}function r(I,j){if(!I)return!1;const L=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(I)?`${I}T23:59:59.999Z`:I);return Number.isNaN(L)?!0:j>L}function n(I){return I==="non-commercial"?"non-commercial":"commercial"}let o=null,i=null,t=null;function c(){const I=globalThis.crypto;return I&&I.subtle?I.subtle:null}async function s(I){if(o&&i===I)return o;const j=c();if(!j)return null;const L=O(I);if(!L)return null;try{const F=await j.importKey("raw",L,{name:"Ed25519"},!1,["verify"]);return o=F,i=I,F}catch{return null}}async function a(){return t!==null||(t=await s(W)!==null),t}async function f(I,j={}){const L=j.warn!==!1,F=j.product||x,N=j.publicKey||W,S=j.now??Date.now(),C=j.host??g(),D=w(C)?"":` ${B}`,G=l(I);if(!G.ok){const te=G.reason==="missing"?"missing":"malformed";return L&&$(`licence.${te}`,te==="missing"?`no licence key supplied. The grid renders in full and carries a trial watermark on any host other than localhost. Get a key at latticegrid.dev.${D}`:`licence key could not be read. The grid will render with a watermark.${D}`),{valid:!1,reason:te,terms:"commercial"}}const X={product:G.product||void 0,issuedTo:G.issuedTo||void 0,expires:G.expires||void 0,terms:n(G.terms)};if(G.product!==F)return L&&$("licence.product",`licence key is for '${G.product}', not '${F}'. The grid will render with a watermark.`),{valid:!1,...X,reason:"product"};if(r(G.expires,S))return L&&$("licence.expired",`licence expired on ${G.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,...X,reason:"expired"};const V=G.deployments||[];if(V.length&&C&&!w(C)&&!k(C,V))return L&&$("licence.domain",`licence key is not valid for ${C}; it covers ${V.join(", ")}. The grid will render with a watermark.`),{valid:!1,...X,reason:"domain"};const J=await s(N);if(!J){const te=!!G.signature&&G.signature.length===U;return L&&$("licence.algorithm","this host does not provide crypto.subtle Ed25519, so the licence signature could not be verified. A structural check was used instead."),te?{valid:!0,...X,reason:"unverified"}:{valid:!1,...X,reason:"signature"}}let ee=!1;try{ee=await c().verify({name:"Ed25519"},J,G.signature,G.message)}catch{ee=!1}return ee?{valid:!0,...X}:(L&&$("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...X,reason:"signature"})}function w(I){const j=String(I??g()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!j||j==="localhost"||j.endsWith(".localhost")||j==="::1"||j==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(j)}function g(){const I=globalThis.location;return I&&typeof I.hostname=="string"?I.hostname:null}function k(I,j){const L=d(I);return!L||!Array.isArray(j)?!1:j.some(F=>{const N=d(F);if(!N)return!1;if(N==="*")return!0;if(N.startsWith("*.")){const S=N.slice(2);return L===S||L.endsWith(`.${S}`)}return L===N})}function d(I){return String(I??"").trim().toLowerCase().replace(/\.$/,"")}class p{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#i;#s=new Set;constructor(j={}){this.#i=j}set(j){this.#e=typeof j=="string"?j.trim():"";const L=l(this.#e);return this.#t=L.ok?{valid:!r(L.expires,Date.now())&&L.product===(this.#i.product||x),product:L.product||void 0,issuedTo:L.issuedTo||void 0,expires:L.expires||void 0,terms:n(L.terms),reason:"pending"}:{valid:!1,reason:L.reason||"malformed",terms:"commercial"},this.#n=null,this.#e&&this.verify(),this.#t}verify(){if(this.#n)return this.#n;const j=this.#e;return this.#n=f(j,this.#i).then(L=>{if(this.#e===j){this.#t=L;for(const F of this.#s)F(L)}return L}),this.#n}onSettled(j){return this.#s.add(j),()=>this.#s.delete(j)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!w(this.#r)}setHost(j){this.#r=j}state(){return this.#t.valid?"licensed":w(this.#r)?"localhost":"trial"}reset(){this.#e="",this.#t={valid:!1,reason:"missing",terms:"commercial"},this.#n=null,this.#s.clear()}}const m=Symbol.for("lattice-grid/licence/holder");function v(){const I=globalThis,j=I&&I[m];if(j&&typeof j.set=="function"&&typeof j.watermark=="function")return j;const L=new p;if(I)try{I[m]=L}catch{}return L}const y=v();function T(I){return y.set(I)}function A(){return y.info()}function M(){return y.watermark()}function _(){return y.state()}function R(){return y}}),Ue("packages/core/src/registry/registry.js",function(e,H){"use strict";Object.defineProperty(e,"KINDS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"REGIONS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return o}});const ne=H("packages/core/src/internal/warn.js"),$=ne.warnOnce,q=ne.DEV,x=H("packages/core/src/internal/predicates.js").isFunction,Z=H("packages/core/src/registry/licence.js"),Y=Z.LicenceHolder,U=Z.sharedLicence,W=["renderer","editor","filter","dataType","totalFn","pipe","component"],K=["all","header","body","totals","panels"];class E{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#i;#s=null;#o=null;#l=new Set;#a=new Map;constructor(t={}){for(const c of W)this.#t.set(c,new Map);this.#i=t.holder||U(),this.#o=t.grid??null,this.#s=this.#i.onSettled(()=>{this.#f({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),t.licence&&this.setLicence(t.licence)}registerModules(t,c={}){c.licence&&this.setLicence(c.licence),c.grid!==void 0&&(this.#o=c.grid);const s=Array.isArray(t)?t:[t],a=[];for(const f of s){if(!f||typeof f!="object"||typeof f.name!="string"||!f.name){$("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(f.name)){q&&this.#u(this.#e.get(f.name),f);continue}if(!x(f.install)){$(`registry.module.install:${f.name}`,`module '${f.name}' has no install() and was ignored.`);continue}const w={registry:this,grid:this.#o};try{f.install(w)}catch(g){$(`registry.module.throw:${f.name}`,`module '${f.name}' threw during install; it was not registered.`,g);continue}this.#e.set(f.name,f);for(const g of O(f))this.#n.add(g);a.push(f.name),this.#f({reason:"module",name:f.name,capabilities:this.capabilities(),regions:h(f)})}return a}unregisterModule(t){const c=this.#e.get(t);if(!c)return!1;if(x(c.uninstall))try{c.uninstall({registry:this,grid:this.#o})}catch(s){$(`registry.module.uninstall:${t}`,`module '${t}' threw during uninstall.`,s)}return this.#e.delete(t),this.#c(),this.#f({reason:"unmodule",name:t,capabilities:this.capabilities(),regions:h(c)}),!0}modules(){return[...this.#e.values()]}has(t){return this.#e.has(t)}#c(){this.#n.clear();for(const t of this.#e.values())for(const c of O(t))this.#n.add(c)}#u(t,c){!t||t===c||b(t,c)||$(`registry.module.reconfigure:${c.name}`,`module '${c.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(t){return this.#n.has(t)}onChange(t){return x(t)?(this.#r.add(t),this.#a.set(t,this.#o),()=>{this.#r.delete(t),this.#a.delete(t)}):()=>{}}#f(t){for(const c of[...this.#r])try{c(t)}catch(s){$("registry.onChange.throw","a registry change handler threw.",s)}}register(t,c,s){const a=this.#t.get(t);if(!a){$(`registry.kind:${t}`,`unknown registry kind '${t}'; expected one of ${W.join(", ")}.`);return}if(!c||typeof c!="string"){$(`registry.name:${t}`,`register('${t}', ...) needs a name.`);return}a.has(c)&&a.get(c)!==s&&$(`registry.replace:${t}:${c}`,`'${c}' was already registered as a ${t} and has been replaced.`),a.set(c,s),this.#f({reason:"register",name:c,kind:t,capabilities:this.capabilities(),regions:l(t)})}registerAll(t,c){if(c)for(const s of Object.keys(c))this.register(t,s,c[s])}get(t,c){const s=this.#t.get(t);return s?s.get(c):void 0}names(t){const c=this.#t.get(t);return c?[...c.keys()]:[]}#d(t,c){const s=this.#t.get(t).get(c);return s!==void 0?s:this.#t.get("component").get(c)}renderer(t){return this.#d("renderer",t)}editor(t){return this.#d("editor",t)}filter(t){return this.#d("filter",t)}dataType(t){return this.get("dataType",t)}totalFn(t){return this.get("totalFn",t)}pipe(t){return this.get("pipe",t)}setLicence(t){return this.#i.set(t)}licence(){return this.#i.info()}licenceVerified(){return this.#i.verify()}watermark(){return this.#i.watermark()}attach(t){t!=null&&(this.#l.add(t),this.#o=t)}detach(t){if(t!=null){this.#l.delete(t);for(const[c,s]of[...this.#a])s===t&&(this.#r.delete(c),this.#a.delete(c));if(this.#o===t){const c=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#o=c}this.#l.size===0&&this.#s&&(this.#s(),this.#s=null)}}destroy(t){if(t!=null){this.detach(t);return}for(const c of[...this.#e.keys()])this.unregisterModule(c);this.#r.clear(),this.#a.clear(),this.#l.clear(),this.#s&&this.#s(),this.#s=null,this.#o=null}}function O(i){const t=i.capabilities,c=Array.isArray(t)?t.filter(s=>typeof s=="string"):[];return[i.name,...c]}function b(i,t){return i.install!==t.install||i.uninstall!==t.uninstall||(i.version||"")!==(t.version||"")?!1:u(O(i),O(t))&&u(h(i),h(t))}function u(i,t){const c=new Set(i),s=new Set(t);if(c.size!==s.size)return!1;for(const a of c)if(!s.has(a))return!1;return!0}function h(i){const t=i.regions;return!Array.isArray(t)||t.length===0?["all"]:t.filter(c=>K.includes(c))}function l(i){switch(i){case"filter":return["header"];case"totalFn":return["totals"];case"renderer":case"editor":case"pipe":return["body"];default:return["all"]}}const r=new E;function n(){return r}function o(i,t={}){return r.registerModules(i,t)}}),Ue("packages/core/src/internal/text.js",function(e,H){"use strict";Object.defineProperty(e,"humanise",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"escapeHtml",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return B}});function ne(x){return x?(x.includes(".")?x.slice(x.lastIndexOf(".")+1):x).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,Y=>Y.toUpperCase()):""}const $={"&":"&","<":"<",">":">",'"':""","'":"'"};function q(x){const Z=x==null?"":String(x);return/[&<>"']/.test(Z)?Z.replace(/[&<>"']/g,Y=>$[Y]):Z}function B(x){return String(x).replace(/\w\S*/g,Z=>Z[0].toUpperCase()+Z.slice(1).toLowerCase())}}),Ue("packages/core/src/format/number.js",function(e,H){"use strict";Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return q}});const $=H("packages/core/src/internal/predicates.js").isNil;function q(B,x){const Z=B||{},Y=Z.locale||x||void 0,U=Z.style||"decimal",W=typeof Z.scale=="number"?Z.scale:1,K=Z.nullDisplay??"",E=Z.zeroDisplay,O=Z.prefix||"",b=Z.suffix||"",u=Z.negative||"minus",h=Z.signed===!0,l={style:U,notation:Z.notation||"standard"};U==="currency"&&(l.currency=Z.currency||"USD",Z.currencyDisplay&&(l.currencyDisplay=Z.currencyDisplay)),typeof Z.decimals=="number"?(l.minimumFractionDigits=Z.decimals,l.maximumFractionDigits=Z.decimals):(typeof Z.minDecimals=="number"&&(l.minimumFractionDigits=Z.minDecimals),typeof Z.maxDecimals=="number"&&(l.maximumFractionDigits=Z.maxDecimals),l.minimumFractionDigits>(l.maximumFractionDigits??20)&&(l.maximumFractionDigits=l.minimumFractionDigits)),Z.thousandsSeparator===!1&&(l.useGrouping=!1),l.notation==="compact"&&(l.compactDisplay=Z.compactDisplay||"short");const r=new Intl.NumberFormat(Y,l),n=typeof Z.thousandsSeparator=="string"?Z.thousandsSeparator:null,o=typeof Z.decimalSeparator=="string"?Z.decimalSeparator:null;let i=",",t=".";if(n||o)for(const g of r.formatToParts(12345.6))g.type==="group"?i=g.value:g.type==="decimal"&&(t=g.value);const c=g=>{let k=g;return n&&(k=k.split(i).join("")),o&&(k=k.split(t).join("")),n&&(k=k.split("").join(n)),o&&(k=k.split("").join(o)),k},s=!!(n||o),a=O!==""&&U==="currency",f=g=>{let k;if(a){const d=r.formatToParts(g);let p=!1;k="";for(const m of d)k+=m.value,!p&&m.type==="currency"&&(k+=O,p=!0);p||(k=O+k)}else k=O+r.format(g);return s&&(k=c(k)),k+b},w=g=>{if($(g)||g==="")return K;const k=typeof g=="number"?g:Number(g);if(Number.isNaN(k))return K;const d=W===1?k:k*W;return d===0&&E!==void 0?E:d<0?u==="parentheses"?`(${f(-d)})`:u==="suffix"?`${f(-d)}-`:f(d):h&&d>0?`+${f(d)}`:f(d)};return w.negativeClass=Z.negativeClass||null,w.spec=Z,w}}),Ue("packages/core/src/format/date.js",function(e,H){"use strict";Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return n}});const $=H("packages/core/src/internal/predicates.js").isNil,B=H("packages/core/src/internal/warn.js").warnOnce,x=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function Z(o){const i=[];let t=0,c="";const s=()=>{c&&(i.push({token:null,text:c}),c="")};for(;t<o.length;){const a=o[t];if(a==="'"){if(o[t+1]==="'"){c+="'",t+=2;continue}const w=o.indexOf("'",t+1);if(w===-1){c+=o.slice(t+1),t=o.length;continue}c+=o.slice(t+1,w),t=w+1;continue}const f=x.find(w=>o.startsWith(w,t));if(f){s(),i.push({token:f,text:f}),t+=f.length;continue}/[A-Za-z]/.test(a)&&B(`date.pattern.token:${a}`,`the date pattern "${o}" contains '${a}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${x.join(" ")}.`),c+=a,t+=1}return s(),i}const Y=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function U(o){if($(o)||o==="")return null;if(o instanceof Date)return Number.isNaN(o.getTime())?null:o;if(typeof o=="number")return Number.isNaN(o)?null:new Date(o);if(typeof o=="string"){const i=Y.exec(o.trim());if(i){const[,c,s,a,f="0",w="0",g="0"]=i;return new Date(+c,+s-1,+a,+f,+w,+g)}const t=new Date(o);return Number.isNaN(t.getTime())?null:t}return null}function W(o,i){return String(o).padStart(i,"0")}function K(o){if(!o)return c=>({year:c.getFullYear(),month:c.getMonth()+1,day:c.getDate(),hour:c.getHours(),minute:c.getMinutes(),second:c.getSeconds(),ms:c.getMilliseconds(),weekday:c.getDay()});const i=new Intl.DateTimeFormat("en-US",{timeZone:o,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"short"}),t={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return c=>{const s={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:c.getMilliseconds(),weekday:0};for(const a of i.formatToParts(c))switch(a.type){case"year":s.year=Number(a.value);break;case"month":s.month=Number(a.value);break;case"day":s.day=Number(a.value);break;case"hour":s.hour=Number(a.value)%24;break;case"minute":s.minute=Number(a.value);break;case"second":s.second=Number(a.value);break;case"weekday":s.weekday=t[a.value]??0;break;default:break}return s}}function E(o,i,t){const c=Z(o),s=K(t),a=new Set(c.filter(d=>d.token).map(d=>d.token)),f=a.has("MMM")?new Intl.DateTimeFormat(i,{month:"short",timeZone:t}):null,w=a.has("MMMM")?new Intl.DateTimeFormat(i,{month:"long",timeZone:t}):null,g=a.has("EEE")?new Intl.DateTimeFormat(i,{weekday:"short",timeZone:t}):null,k=a.has("EEEE")?new Intl.DateTimeFormat(i,{weekday:"long",timeZone:t}):null;return d=>{const p=s(d);let m="";for(const v of c){if(!v.token){m+=v.text;continue}switch(v.token){case"yyyy":m+=W(p.year,4);break;case"yy":m+=W(p.year%100,2);break;case"MMMM":m+=w.format(d);break;case"MMM":m+=f.format(d);break;case"MM":m+=W(p.month,2);break;case"M":m+=String(p.month);break;case"dd":m+=W(p.day,2);break;case"d":m+=String(p.day);break;case"EEEE":m+=k.format(d);break;case"EEE":m+=g.format(d);break;case"HH":m+=W(p.hour,2);break;case"H":m+=String(p.hour);break;case"hh":m+=W(p.hour%12===0?12:p.hour%12,2);break;case"h":m+=String(p.hour%12===0?12:p.hour%12);break;case"mm":m+=W(p.minute,2);break;case"m":m+=String(p.minute);break;case"ss":m+=W(p.second,2);break;case"s":m+=String(p.second);break;case"SSS":m+=W(p.ms,3);break;case"a":m+=p.hour<12?"AM":"PM";break;default:m+=v.text;break}}return m}}const O=[["year",365*24*36e5],["month",720*36e5],["week",168*36e5],["day",24*36e5],["hour",36e5],["minute",6e4],["second",1e3]];function b(o,i){const t=o||{},c=t.locale||i||void 0,s=t.nullDisplay??"",a=t.timeZone;let f;if(t.pattern)f=E(t.pattern,c,a);else if(t.dateStyle||t.timeStyle){const p={timeZone:a};t.dateStyle&&(p.dateStyle=t.dateStyle),t.timeStyle&&(p.timeStyle=t.timeStyle);const m=new Intl.DateTimeFormat(c,p);f=v=>m.format(v)}else{const p=new Intl.DateTimeFormat(c,{dateStyle:"medium",timeZone:a});f=m=>p.format(m)}const w=t.relative?new Intl.RelativeTimeFormat(c,{numeric:"auto"}):null,k=(typeof t.relative=="object"&&t.relative?t.relative.threshold??7:7)*24*36e5,d=(p,m)=>{const v=U(p);if(!v)return s;if(w){const y=m&&typeof m.now=="number"?m.now:Date.now(),T=v.getTime()-y;if(Math.abs(T)<k){for(const[A,M]of O)if(Math.abs(T)>=M||A==="second")return w.format(Math.round(T/M),A)}}return f(v)};return d.spec=t,d}function u(o){if($(o)||o==="")return null;if(typeof o=="string"){const c=/^(\d{4}-\d{2}-\d{2})/.exec(o.trim());if(c)return c[1];const s=U(o);return s?u(s):null}const i=U(o);if(!i)return null;const t=c=>String(c).padStart(2,"0");return`${i.getFullYear()}-${t(i.getMonth()+1)}-${t(i.getDate())}`}function h(o,i){if($(o)||o==="")return null;if(typeof o=="string"){const c=o.trim();if(l.test(c)){const f=U(c);return f?r(f,i):null}const s=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(c);if(s){const[,f,w,g,k]=s;return`${f}T${w}:${g}${k&&k!=="00"?`:${k}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(c))return`${c}T00:00`;const a=U(c);return a?h(a):null}const t=U(o);return t?r(t,i):null}const l=/(?:Z|[+-]\d{2}:?\d{2})$/i;function r(o,i){const t=f=>String(f).padStart(2,"0");if(i)try{const f=new Intl.DateTimeFormat("en-CA",{timeZone:i,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(o).reduce((k,d)=>(d.type!=="literal"&&(k[d.type]=d.value),k),{}),w=f.hour==="24"?"00":f.hour,g=Number(f.second);return`${f.year}-${f.month}-${f.day}T${w}:${f.minute}`+(g?`:${f.second}`:"")}catch{}const c=`${o.getFullYear()}-${t(o.getMonth()+1)}-${t(o.getDate())}`,s=o.getSeconds(),a=`${t(o.getHours())}:${t(o.getMinutes())}${s?`:${t(s)}`:""}`;return`${c}T${a}`}function n(o,i){const t=$(o)||o===""?null:String(o),c=$(i)||i===""?null:String(i);return t===null?c===null?0:1:c===null||t<c?-1:t>c?1:0}}),Ue("packages/core/src/format/boolean.js",function(e,H){"use strict";Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return Z}});const $=H("packages/core/src/internal/predicates.js").isNil,q={true:"☑",false:"☐",null:""},B={true:"◉",false:"◯",null:""};function x(Y){if($(Y)||Y==="")return null;if(typeof Y=="boolean")return Y;if(typeof Y=="number")return Y!==0;const U=String(Y).trim().toLowerCase();return U==="true"||U==="yes"||U==="y"||U==="1"?!0:U==="false"||U==="no"||U==="n"||U==="0"?!1:null}function Z(Y,U){const W=Y||{},K=W.display||"text",E=W.trueLabel??"Yes",O=W.falseLabel??"No",b=W.nullLabel??"";let u=E,h=O;const l=b;K==="checkbox"?(u=q.true,h=q.false):K==="switch"?(u=B.true,h=B.false):K==="icon"&&(u=W.trueIcon??E,h=W.falseIcon??O);const r=n=>{const o=x(n);return o===null?l:o?u:h};return r.display=K,r.labels={true:E,false:O,null:b},r.locale=U,r.spec=W,r}}),Ue("packages/core/src/format/text.js",function(e,H){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return x}});const $=H("packages/core/src/internal/predicates.js").isNil,B=H("packages/core/src/internal/text.js").titleCase;function x(Z,Y){const U=Z||{},W=U.locale||Y||void 0,K=U.nullDisplay??"",E=U.emptyDisplay??"",O=U.transform||"none",b=typeof U.truncate=="number"?{chars:U.truncate}:U.truncate||null,u=b?b.chars:0,h=b?b.ellipsis??"…":"",l=n=>{switch(O){case"upper":return W?n.toLocaleUpperCase(W):n.toUpperCase();case"lower":return W?n.toLocaleLowerCase(W):n.toLowerCase();case"title":return B(n);default:return n}},r=n=>{if($(n))return K;let o=typeof n=="string"?n:String(n);return o===""?E:(O!=="none"&&(o=l(o)),u>0&&o.length>u&&(o=o.slice(0,u)+h),o)};return r.spec=U,r}}),Ue("packages/core/src/format/mask.js",function(e,H){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return Z}});const ne=new Set(["0","#","?",",","."]),$="\0";function q(U){const W=[];let K="",E=!1;for(let O=0;O<U.length;O++){const b=U[O];if(b==="\\"){K+=b+(U[O+1]??""),O+=1;continue}if(b==='"'){E=!E,K+=b;continue}if(b===";"&&!E){W.push(K),K="";continue}K+=b}return W.push(K),W}function B(U){let W="",K="",E="",O=1,b=!1,u=!1;const h=a=>{u?K+=a:W+=a};for(let a=0;a<U.length;a++){const f=U[a];if(f==="\\"){h(U[a+1]??""),a+=1;continue}if(f==='"'){const w=U.indexOf('"',a+1);h(w===-1?U.slice(a+1):U.slice(a+1,w)),a=w===-1?U.length:w;continue}if(f==="%"){O*=100,h("%");continue}if(f==="@"){b=!0,h("\0");continue}if(ne.has(f)){E+=f,u=!0;continue}h(f)}let l=-1;for(let a=E.length-1;a>=0;a--){const f=E[a];if(f==="0"||f==="#"||f==="?"){l=a;break}}let r=!1,n="";for(let a=0;a<E.length;a++){const f=E[a];if(f===","){a>l?O/=1e3:r=!0;continue}n+=f}const o=n.indexOf("."),i=o===-1?n:n.slice(0,o),t=o===-1?"":n.slice(o+1);let c=0;for(const a of i)a==="0"&&(c+=1);let s=0;for(const a of t)a==="0"&&(s+=1);return{prefix:W,suffix:K,minInt:c,minDec:s,maxDec:t.length,grouping:r,scale:O,hasNumber:l!==-1,isText:b}}function x(U,W){const K=new Intl.NumberFormat(W,{minimumIntegerDigits:Math.max(U.minInt,1),minimumFractionDigits:U.minDec,maximumFractionDigits:Math.max(U.maxDec,U.minDec),useGrouping:U.grouping}),{prefix:E,suffix:O,scale:b,hasNumber:u}=U;return h=>{if(!u)return E+O;const l=b===1?h:h*b;return E+K.format(l)+O}}function Z(U,W){const E=q(String(U)).map(B),O=E.map(n=>x(n,W)),b=0,u=E.length>1?1:-1,h=E.length>2?2:-1,l=E.length>3?3:-1,r=n=>{if(n==null||n==="")return"";if(typeof n!="number"||Number.isNaN(n)){const o=Number(n);if(Number.isNaN(o))return l===-1?String(n):(E[l].prefix+E[l].suffix).split("\0").join(String(n));n=o}return n===0&&h!==-1?O[h](0):n<0&&u!==-1?O[u](-n):O[b](n)};return r.spec={mask:U},{format:r,ooxml:Y(String(U))}}function Y(U){return U.trim()}}),Ue("packages/core/src/format/shorthand.js",function(e,H){"use strict";Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return Y}});const ne=["currency","number","percent","date","boolean","text","relative"],$=/[#0?@;"\\]/,q=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function B(U){return typeof U!="string"||U===""||Z(U)?!1:$.test(U)}function x(U){return typeof U!="string"||U===""||Z(U)?!1:q.test(U)}function Z(U){const W=U.indexOf(":"),K=W===-1?U:U.slice(0,W);return ne.includes(K)?K:null}function Y(U){const W=Z(U);if(!W)return null;const K=U.indexOf(":"),E=K===-1?"":U.slice(K+1),O=E===""?[]:E.split(":");switch(W){case"currency":{const b={type:"number",style:"currency",currency:O[0]||"USD"};return O[1]!==void 0&&O[1]!==""&&(b.decimals=Number(O[1])),b}case"number":{const b={type:"number",style:"decimal"};return O[0]!==void 0&&O[0]!==""&&(b.decimals=Number(O[0])),b}case"percent":{const b={type:"number",style:"percent"};return O[0]!==void 0&&O[0]!==""&&(b.decimals=Number(O[0])),b}case"date":return{type:"date",pattern:E||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const b=E.split("/"),u={type:"boolean",display:"text"};return b[0]!==void 0&&b[0]!==""&&(u.trueLabel=b[0]),b[1]!==void 0&&b[1]!==""&&(u.falseLabel=b[1]),b[2]!==void 0&&(u.nullLabel=b[2]),u}case"text":{const b={type:"text"};return O[0]&&(b.transform=O[0]),O[1]!==void 0&&O[1]!==""&&(b.truncate=Number(O[1])),b}default:return null}}}),Ue("packages/core/src/format/index.js",function(e,H){"use strict";Object.defineProperty(e,"compileFormat",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"specToOoxml",{enumerable:!0,get:function(){return m}});const ne=H("packages/core/src/internal/predicates.js"),$=ne.isFunction,q=ne.isObject,x=H("packages/core/src/internal/warn.js").warnOnce,Z=H("packages/core/src/format/number.js"),Y=Z.compileNumber,U=H("packages/core/src/format/date.js"),W=U.compileDate,K=U.scanPattern,E=H("packages/core/src/format/boolean.js"),O=E.compileBoolean,b=H("packages/core/src/format/text.js"),u=b.compileText,h=H("packages/core/src/format/mask.js"),l=h.compileMask,r=H("packages/core/src/format/shorthand.js"),n=r.parseShorthand,o=r.looksLikeMask,i=r.looksLikeDatePattern;Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return Z.compileNumber}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return U.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return U.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return U.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return U.toDate}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return E.compileBoolean}}),Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return E.toTriState}}),Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return b.compileText}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return h.compileMask}}),Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return h.splitSections}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return h.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 t=new Set(["decimal","currency","percent","unit"]),c=new Set(["type","locale"]),s={number:new Set(["style","currency","currencyDisplay","decimals","minDecimals","maxDecimals","thousandsSeparator","decimalSeparator","notation","compactDisplay","negative","negativeClass","signed","prefix","suffix","zeroDisplay","nullDisplay","messages","scale"]),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"])},a=new Set(["number","date","boolean","text"]);function f(A,M){const _=A.type;if(_===void 0||a.has(_)||!t.has(String(_)))return;const R=M?`"${M}"`:"with no id";x(`format:unknown-style-key:${M||""}:${_}`,`column ${R} has format: { type: "${_}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${_}" instead?`)}function w(A,M,_){const R=s[M],I=_?`"${_}"`:"with no id";for(const j of A){if(c.has(j)||R.has(j))continue;const L=Object.keys(s).find(F=>F!==M&&s[F].has(j));L?x(`format:inapplicable:${_||""}:${j}`,`column ${I} has format key "${j}", which applies to a ${L} column, not the ${M} column it was applied to; it is ignored.`):x(`format:unknown:${_||""}:${j}`,`column ${I} has an unrecognised format key "${j}" for its ${M} format; it is ignored.`)}}function g(A){if(A.type==="number"||A.type==="date"||A.type==="boolean"||A.type==="text")return!0;const M=t.has(String(A.style));return!!(A.pattern||A.dateStyle||A.timeStyle||A.relative||A.timeZone||A.trueLabel||A.falseLabel||A.display||A.trueIcon||A.falseIcon||A.transform||A.truncate||A.emptyDisplay||M||A.currency||A.decimals!==void 0||A.minDecimals!==void 0||A.maxDecimals!==void 0||A.notation||A.negative||A.scale!==void 0||A.prefix||A.suffix||A.zeroDisplay!==void 0)}function k(A,M){if(A.type==="number"||A.type==="date"||A.type==="boolean"||A.type==="text")return A.type;if(A.pattern||A.dateStyle||A.timeStyle||A.relative||A.timeZone)return"date";if(A.trueLabel||A.falseLabel||A.display||A.trueIcon||A.falseIcon)return"boolean";if(A.transform||A.truncate||A.emptyDisplay)return"text";if(A.style||A.currency||A.decimals!==void 0||A.minDecimals!==void 0||A.maxDecimals!==void 0||A.notation||A.negative||A.scale!==void 0||A.prefix||A.suffix||A.zeroDisplay!==void 0)return"number";const _=M&&M.base;return _==="number"?"number":_==="date"||_==="dateString"?"date":_==="boolean"?"boolean":"text"}function d(A,M=null,_=void 0,R=void 0,I=void 0){if(A==null||A==="")return null;const j=q(A)?Object.keys(A):null;if(typeof A=="function"){const N=(S,C)=>String(A({...C||{},value:S,locale:_})??"");return N.ooxml=M&&M.excel||"General",N}if(typeof A=="string"){if(o(A)){const{format:S,ooxml:C}=l(A,_);return S.ooxml=C,S}const N=n(A)||(i(A)?{type:"date",pattern:A}:null);return N?d(N,M,_,R,I):(x(`format:${A}`,`unrecognised format string "${A}"; the value will be stringified`),null)}if(!q(A))return x("format:shape","format must be a spec object or a string; ignoring",A),null;if(M&&$(M.format)&&!g(A)||M&&$(M.format)&&Array.isArray(M.formatPatterns)&&A.type===void 0)return null;const L=k(A,M);L==="date"&&R&&A.timeZone===void 0&&(A={...A,timeZone:R}),f(A,I),w(j||Object.keys(A),L,I);let F;switch(L){case"number":F=Y(A,_);break;case"date":F=W(A,_);break;case"boolean":F=O(A,_);break;default:F=u(A,_);break}return F.ooxml=m(A,L,_,M),F.kind=L,F}const p={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 m(A,M,_=void 0,R=null){if(M==="date"){if(A.pattern){let N="";for(const S of K(A.pattern))N+=S.token?p[S.token]??S.text:S.text;return N}return R&&R.excel||"yyyy-mm-dd"}if(M==="boolean")return"General";if(M==="text")return"@";if(A.notation==="compact"||A.notation==="scientific")return"General";const I=typeof A.decimals=="number"?A.decimals:typeof A.minDecimals=="number"?A.minDecimals:A.style==="currency"?2:0;let L=`${A.thousandsSeparator===!1?"":"#,#"}#0${I>0?`.${"0".repeat(I)}`:""}`,F="";return A.style==="currency"&&(F+=v(T(A.currency||"USD",_))),A.prefix&&(F+=v(A.prefix)),L=F+L,A.style==="percent"&&(L=`${L}%`),A.suffix&&(L+=v(A.suffix)),A.negative==="parentheses"?`${L};(${L})`:A.negative==="suffix"?`${L};${L}-`:L}function v(A){return`"${String(A).split('"').join("")}"`}const y=new Map;function T(A,M){const _=`${A}|${M||""}`;let R=y.get(_);if(R!==void 0)return R;R=A;try{const j=new Intl.NumberFormat(M,{style:"currency",currency:A}).formatToParts(0).find(L=>L.type==="currency");j&&(R=j.value)}catch{}return y.set(_,R),R}}),Ue("packages/core/src/columns/types/temporal.js",function(e,H){"use strict";Object.defineProperty(e,"MS_SECOND",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"MS_MINUTE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"MS_HOUR",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"MS_DAY",{enumerable:!0,get:function(){return h}}),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 f}}),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 T}}),Object.defineProperty(e,"instantFromParts",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"toEpochMs",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"toDurationMs",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return he}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"resolveZoneName",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"zoneLabel",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"formatInstant",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return Le}}),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 Se}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Fe}});const ne=H("packages/core/src/internal/predicates.js"),$=ne.isNil,q=ne.isFunction,B=H("packages/core/src/format/date.js"),x=B.toDate,Z=B.compilePattern,Y=B.compileDate,U=B.toIsoDateTime,W=B.compareIso,K=864e5,E=Object.freeze({}),O=1e3,b=60*O,u=60*b,h=24*u,l=7*h,r=new WeakMap;function n(be,Ie){const He=be&&be.locale||"",Ge=be&&be.column;if(!Ge)return He?{locale:He}:E;const nt=r.get(Ge);if(nt&&nt.locale===He)return nt.bag;const st=Ge.typeOptions||Ge[Ie]||(o(Ge.format)?Ge.format:null),mt={...st||E,locale:st&&st.locale||He||void 0};return r.set(Ge,{locale:He,bag:mt}),mt}function o(be){return be!==null&&typeof be=="object"&&!Array.isArray(be)&&!(be instanceof Date)}function i(be,Ie){const He=be===null||Number.isNaN(be)?null:be,Ge=Ie===null||Number.isNaN(Ie)?null:Ie;return He===null?Ge===null?0:1:Ge===null||He<Ge?-1:He>Ge?1:0}const t=/^(\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,c=/^(\d{3,6})$/;function s(be,Ie,He,Ge){return!(be>=0&&be<=23)||!(Ie>=0&&Ie<=59)||!(He>=0&&He<=59)||!(Ge>=0&&Ge<=999)?null:be*u+Ie*b+He*O+Ge}function a(be){if($(be))return null;const Ie=String(be).trim();if(Ie==="")return null;const He=c.exec(Ie);if(He){const Pt=He[1];if(Pt.length===5)return null;const Mt=Pt.length===3?1:2;return s(Number(Pt.slice(0,Mt)),Number(Pt.slice(Mt,Mt+2)),Number(Pt.slice(Mt+2,Mt+4)||0),0)}const Ge=t.exec(Ie);if(!Ge)return null;let nt=Number(Ge[1]);const st=Number(Ge[2]||0),mt=Number(Ge[3]||0),kt=Ge[4]?Number(Ge[4].padEnd(3,"0")):0,St=Ge[5]?Ge[5][0].toLowerCase():null;if(St){if(nt<1||nt>12)return null;nt=nt%12,St==="p"&&(nt+=12)}return s(nt,st,mt,kt)}function f(be){return $(be)||be===""?null:typeof be=="number"?Number.isFinite(be)?(be%h+h)%h:null:be instanceof Date?Number.isNaN(be.getTime())?null:be.getHours()*u+be.getMinutes()*b+be.getSeconds()*O+be.getMilliseconds():a(be)}const w=new Map;function g(be){const Ie=be.pattern||"",He=be.timeStyle||(be.seconds?"medium":"short"),Ge=`${be.locale||""}|${Ie}|${He}`;let nt=w.get(Ge);if(nt)return nt;if(Ie)nt=Z(Ie,be.locale||void 0,"UTC");else{const st=new Intl.DateTimeFormat(be.locale||void 0,{timeStyle:He,timeZone:"UTC"});nt=mt=>st.format(mt)}return w.set(Ge,nt),nt}function k(be,Ie){const He=Ie||E;if(be==null||typeof be!="number"||!Number.isFinite(be))return He.nullDisplay??"";const Ge=(be%h+h)%h;return g(He)(new Date(Ge))}function d(be){return be instanceof Date?!Number.isNaN(be.getTime()):typeof be=="number"?Number.isFinite(be)&&be>=0&&be<h:typeof be!="string"||!be.includes(":")?!1:a(be)!==null}function p(be){const Ie=f(be);return Ie==null?"":k(Ie,{pattern:Ie%O===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const m=new Map;function v(be){const Ie=be||"";let He=m.get(Ie);return He||(He=new Intl.DateTimeFormat("en-GB",{timeZone:be||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),m.set(Ie,He)),He}function y(be,Ie){const He={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const Ge of v(Ie).formatToParts(new Date(be)))Ge.type==="year"?He.year=Number(Ge.value):Ge.type==="month"?He.month=Number(Ge.value):Ge.type==="day"?He.day=Number(Ge.value):Ge.type==="hour"?He.hour=Number(Ge.value)%24:Ge.type==="minute"?He.minute=Number(Ge.value):Ge.type==="second"&&(He.second=Number(Ge.value));return He}function T(be,Ie){const He=y(be,Ie);return Date.UTC(He.year,He.month-1,He.day,He.hour,He.minute,He.second,0)-Math.floor(be/1e3)*1e3}function A(be,Ie){const He=be.hour||0,Ge=be.minute||0,nt=be.second||0,st=be.ms||0;if(!Ie)return new Date(be.year,be.month-1,be.day,He,Ge,nt,st).getTime();const mt=Date.UTC(be.year,be.month-1,be.day,He,Ge,nt,st);let kt=mt-T(mt,Ie);return kt=mt-T(kt,Ie),kt}const M=/(?:Z|[+-]\d{2}:?\d{2})$/i,_=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function R(be,Ie){if($(be))return null;const He=String(be).trim();if(He==="")return null;const Ge=Ie&&Ie.timeZone||void 0;if(!M.test(He)){const nt=_.exec(He);if(nt){const st=(nt[4]||"").trim(),mt=st===""?0:a(st);if(mt===null)return null;const kt=A({year:Number(nt[1]),month:Number(nt[2]),day:Number(nt[3]),hour:Math.floor(mt/u),minute:Math.floor(mt/b)%60,second:Math.floor(mt/O)%60,ms:mt%O},Ge);return Number.isNaN(kt)?null:new Date(kt)}}return x(He)}function I(be){if(typeof be=="number")return Number.isFinite(be)?be:null;const Ie=x(be);return Ie?Ie.getTime():null}const j=new Map;function L(be){const Ie=[be.locale||"",be.pattern||"",be.dateStyle||"",be.timeStyle||"",be.timeZone||"",be.seconds?"1":""].join("|");let He=j.get(Ie);if(He)return He;const Ge=be.pattern?{type:"date",pattern:be.pattern,timeZone:be.timeZone}:{type:"date",dateStyle:be.dateStyle||"medium",timeStyle:be.timeStyle||(be.seconds?"medium":"short"),timeZone:be.timeZone};return He=Y(Ge,be.locale||void 0),j.set(Ie,He),He}function F(be,Ie){const He=Ie||E,Ge=I(be);return Ge==null?He.nullDisplay??"":L(He)(Ge)}function N(be){return be instanceof Date?!Number.isNaN(be.getTime()):typeof be!="string"||!_.test(be.trim())?!1:R(be)!==null}const S=Object.freeze([{key:"w",ms:l,intl:"week",long:["week","weeks"],names:["w","wk","wks","week","weeks"]},{key:"d",ms:h,intl:"day",long:["day","days"],names:["d","dy","day","days"]},{key:"h",ms:u,intl:"hour",long:["hour","hours"],names:["h","hr","hrs","hour","hours"]},{key:"m",ms:b,intl:"minute",long:["minute","minutes"],names:["m","min","mins","minute","minutes"]},{key:"s",ms:O,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"]}]),C=new Map;for(const be of S)for(const Ie of be.names)C.set(Ie,be);const D=Object.freeze(S.filter(be=>be.key!=="w")),G=/^(\d+(?:\.\d+)?)\s*([a-z]+)\s*(?:,\s*)?/,X=/^\d+(?:\.\d+)?$/,V=/^(\d+):([0-5]?\d)(?::([0-5]?\d))?(?:\.(\d{1,3}))?$/;function J(be){const Ie=be&&be.defaultUnit?C.get(String(be.defaultUnit).toLowerCase()):null;return Ie?Ie.ms:b}function ee(be){return(be&&be.defaultUnit?C.get(String(be.defaultUnit).toLowerCase()):null)||C.get("m")}function te(be,Ie){if($(be))return null;let He=String(be).trim().toLowerCase();if(He==="")return null;let Ge=1;if(He[0]==="-"?(Ge=-1,He=He.slice(1).trim()):He[0]==="+"&&(He=He.slice(1).trim()),He==="")return null;const nt=V.exec(He);if(nt){const St=nt[3]!==void 0,Pt=Number(nt[1])*u+Number(nt[2])*b+(St?Number(nt[3])*O:0)+(nt[4]?Number(nt[4].padEnd(3,"0")):0);return Ge*Pt}if(X.test(He))return Math.round(Ge*Number(He)*J(Ie||E));let st=He,mt=0,kt=0;for(;st!=="";){const St=G.exec(st);if(!St)return null;const Pt=C.get(St[2]);if(!Pt)return null;mt+=Number(St[1])*Pt.ms,st=st.slice(St[0].length),kt++}return kt===0?null:Math.round(Ge*mt)}function ie(be){return $(be)||be===""?null:typeof be=="number"?Number.isFinite(be)?be:null:te(be)}const oe=new Map;function ue(be,Ie,He){const Ge=`${He||""}|${Ie.intl}`;let nt=oe.get(Ge);if(nt===void 0){try{nt=new Intl.NumberFormat(He||void 0,{style:"unit",unit:Ie.intl,unitDisplay:"long"})}catch{nt=null}oe.set(Ge,nt)}return nt?nt.format(be):`${be} ${be===1?Ie.long[0]:Ie.long[1]}`}function ye(be,Ie){return String(be).padStart(Ie,"0")}function he(be,Ie){const He=Ie||E;if(be==null||typeof be!="number"||!Number.isFinite(be))return He.nullDisplay??"";const Ge=He.style||"short",nt=be<0;let st=Math.round(Math.abs(be));const mt=nt?"-":"";if(st===0&&He.zeroDisplay!=null)return He.zeroDisplay;if(Ge==="clock"){const Mt=Math.floor(st/u),It=Math.floor(st/b)%60,$t=Math.floor(st/O)%60;return`${mt}${ye(Mt,2)}:${ye(It,2)}:${ye($t,2)}`}if(st===0){const Mt=ee(He);return Ge==="long"?ue(0,Mt,He.locale):`0${Mt.key}`}const kt=He.weeks===!0?S:D,St=typeof He.maxUnits=="number"&&He.maxUnits>0?He.maxUnits:He.maxUnits===void 0?2:1/0,Pt=[];for(const Mt of kt){if(Pt.length>=St)break;const It=Math.floor(st/Mt.ms);It!==0&&(st-=It*Mt.ms,Pt.push(Ge==="long"?ue(It,Mt,He.locale):`${It}${Mt.key}`))}return mt+Pt.join(" ")}function Re(be){if(typeof be!="string")return!1;const Ie=be.trim();return Ie===""||V.test(Ie)||!/[a-z]/i.test(Ie)?!1:te(Ie)!==null}const Ce=Date.UTC(1899,11,30),we=new Map;function re(be,Ie){const He=be||"";let Ge=we.get(He);Ge||(Ge=new Intl.DateTimeFormat("en-GB",{timeZone:be||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),we.set(He,Ge));const nt=typeof Ie=="number"?Ie:Date.now();for(const st of Ge.formatToParts(new Date(nt)))if(st.type==="timeZoneName")return st.value;return""}function de(be){if(be)return be;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function me(be,Ie){const He=de(be),Ge=re(be,Ie);return Ge?`${He} (${Ge})`:He}function Oe(be,Ie){if(be&&be.timeZone)return be.timeZone;const He=Ie&&Ie.grid;return(He&&q(He.get)?He.get("timeZone"):void 0)||void 0}function ke(be,Ie){const He=Ie||E,Ge=I(be);if(Ge==null)return He.nullDisplay??"";const nt=L(He)(Ge);if(!He.showOrigin)return nt;const st=He.originZone;return st?st===(He.timeZone||de(He.timeZone))?nt:`${nt} (${me(st,Ge)})`:`${nt} (no origin recorded)`}function Le(be,Ie,He,Ge){if(Ie==="instant"||!Ie)return be;const nt=y(be,He);if(Ie==="month")return A({year:nt.year,month:nt.month,day:1},He);if(Ie==="week"){const st=Ge>=1&&Ge<=7?Ge:1,kt=((new Date(Date.UTC(nt.year,nt.month-1,nt.day)).getUTCDay()+6)%7+1-st+7)%7,St=new Date(Date.UTC(nt.year,nt.month-1,nt.day-kt));return A({year:St.getUTCFullYear(),month:St.getUTCMonth()+1,day:St.getUTCDate()},He)}return A({year:nt.year,month:nt.month,day:nt.day},He)}function ce(be,Ie){const He=be&&be.group,Ge=He&&He.granularity||"day";if(Ge==="instant")return null;const nt=He&&He.weekStart;return st=>typeof st=="number"?Le(st,Ge,Ie,nt):st}const ge={time:{base:"number",storage:"float64",matches:d,format:be=>k(f(be.value),n(be,"time")),parse:be=>a(be.text),compare:(be,Ie)=>i(f(be),f(Ie)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:be=>{const Ie=f(be);return Ie===null?null:Ie/K},toStorage:be=>f(be),toClipboard:p,fromClipboard:a},datetime:{base:"dateString",storage:"dictionary",matches:N,format:be=>F(be.value,n(be,"datetime")),parse:be=>U(R(be.text,n(be,"datetime"))??be.text),compare:W,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(be,Ie)=>U(be,Ie&&Ie.timeZone),toClipboard:be=>$(be)?"":String(be),fromClipboard:be=>U(be)},duration:{base:"number",storage:"float64",matches:Re,format:be=>he(ie(be.value),n(be,"duration")),parse:be=>te(be.text,n(be,"duration")),compare:(be,Ie)=>i(ie(be),ie(Ie)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:be=>{const Ie=ie(be);return Ie===null?null:Ie/K},toStorage:be=>ie(be),toClipboard:be=>he(ie(be),{style:"short",maxUnits:-1}),fromClipboard:be=>te(be)},timestamp:{base:"number",storage:"float64",format:be=>{const Ie=n(be,"timestamp");return ke(be.value,{...Ie,timeZone:Oe(Ie,be)})},parse:be=>{const Ie=n(be,"timestamp"),He=R(be.text,{timeZone:Oe(Ie,be)});return He?He.getTime():null},compare:(be,Ie)=>i(I(be),I(Ie)),groupProjector:(be,Ie)=>ce(be,Ie),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(be,Ie)=>{const He=I(be);if(He==null)return null;const Ge=y(He,Ie&&Ie.timeZone||void 0);return(Date.UTC(Ge.year,Ge.month-1,Ge.day,Ge.hour,Ge.minute,Ge.second)-Ce)/K},toStorage:be=>I(be),toClipboard:be=>{const Ie=I(be);return Ie==null?"":new Date(Ie).toISOString()},fromClipboard:be=>I(be)}},Se=["datetime","time","duration"],Fe=ge}),Ue("packages/core/src/internal/lru.js",function(e,H){"use strict";Object.defineProperty(e,"Lru",{enumerable:!0,get:function(){return ne}});class ne{#e;#t=new Map;#n;constructor(q=256,B=null){this.#e=q,this.#n=B}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 B=this.#t;if(!B.has(q))return;const x=B.get(q);return B.delete(q),B.set(q,x),x}peek(q){return this.#t.get(q)}set(q,B){const x=this.#t;return x.has(q)&&x.delete(q),x.set(q,B),this.#r(),B}delete(q){const B=this.#t.get(q);return this.#t.delete(q)&&this.#n&&this.#n(B,q),B}clear(){if(this.#n)for(const[q,B]of this.#t)this.#n(B,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 B=q.keys().next().value,x=q.get(B);q.delete(B),this.#n&&this.#n(x,B)}}}}),Ue("packages/core/src/columns/types/network.js",function(e,H){"use strict";Object.defineProperty(e,"toUint32",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"compareIpv4",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"packCidr",{enumerable:!0,get:function(){return h}}),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 n}}),Object.defineProperty(e,"isCidr",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"compareCidr",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"netmask",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"addressCount",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return w}}),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 T}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return I}});const $=H("packages/core/src/internal/predicates.js").isNil,B=H("packages/core/src/internal/lru.js").Lru,x=4294967295,Z=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function Y(j){if($(j))return null;if(typeof j=="string")return U(j);const L=Number(j);return Number.isFinite(L)?L<0?L<-2147483648?null:L>>>0:L>x?null:Math.trunc(L)>>>0:null}function U(j){if($(j))return null;const L=String(j).trim();if(L==="")return null;const F=Z.exec(L);if(!F)return null;let N=0;for(let S=1;S<=4;S++){const C=F[S];if(C.length>1&&C.charCodeAt(0)===48)return null;const D=Number(C);if(D>255)return null;N=N*256+D}return N}function W(j){const L=Y(j);return L===null?"":`${L>>>24&255}.${L>>>16&255}.${L>>>8&255}.${L&255}`}function K(j){return typeof j=="string"&&U(j)!==null}function E(j,L){const F=Y(j),N=Y(L);return F===null?N===null?0:1:N===null||F<N?-1:F>N?1:0}const O=64,b=x*O+32,u=/^(?:0|[1-9]\d?)$/;function h(j,L){return j*O+L}function l(j){if($(j))return null;if(typeof j=="string"){const N=r(j);return N===null?null:l(N)}if(typeof j=="object"){const N=Y(j.address),S=Number(j.prefix);return N===null||!Number.isInteger(S)||S<0||S>32?null:{address:N,prefix:S}}const L=Number(j);if(!Number.isInteger(L)||L<0||L>b)return null;const F=L%O;return F>32?null:{address:(L-F)/O,prefix:F}}function r(j){if($(j))return null;const L=String(j).trim();if(L==="")return null;const F=L.indexOf("/");if(F<0)return null;const N=U(L.slice(0,F));if(N===null)return null;const S=L.slice(F+1).trim();if(!u.test(S))return null;const C=Number(S);return C>32?null:h(N,C)}function n(j){const L=l(j);return L?`${W(L.address)}/${L.prefix}`:""}function o(j){return typeof j=="string"&&r(j)!==null}function i(j,L){const F=l(j),N=l(L);return F?N?F.address!==N.address?F.address<N.address?-1:1:F.prefix-N.prefix:-1:N?1:0}function t(j){return j===0?0:4294967295<<32-j>>>0}function c(j){const L=l(j);return L?(L.address&t(L.prefix))>>>0:null}function s(j){const L=l(j);return L?(L.address&t(L.prefix)|~t(L.prefix)>>>0)>>>0:null}function a(j){const L=l(j);return L?2**(32-L.prefix):null}function f(j){const L=l(j);return L?L.prefix===32?1:L.prefix===31?2:2**(32-L.prefix)-2:null}function w(j,L){const F=l(j);if(!F)return!1;const N=Y(L);if(N===null)return!1;const S=t(F.prefix);return(N&S)>>>0===(F.address&S)>>>0}function g(j,L){const F=c(j),N=c(L);return F===null||N===null?!1:F<=s(L)&&N<=s(j)}const k=/^[0-9a-fA-F]{1,4}$/,d=new B(512);function p(j){if($(j))return null;let L=String(j).trim();if(L==="")return null;const F=L.indexOf("%");if(F>=0&&(L=L.slice(0,F)),L==="")return null;if(L.indexOf(".")>=0){const X=L.lastIndexOf(":");if(X<0)return null;const V=U(L.slice(X+1));if(V===null)return null;L=`${L.slice(0,X+1)}${(V>>>16&65535).toString(16)}:${(V&65535).toString(16)}`}const N=L.split("::");if(N.length>2)return null;const S=m(N[0]);if(S===null)return null;if(N.length===1)return S.length===8?S:null;const C=m(N[1]);if(C===null)return null;const D=8-S.length-C.length;if(D<1)return null;const G=S.slice();for(let X=0;X<D;X++)G.push(0);for(const X of C)G.push(X);return G}function m(j){if(j==="")return[];const L=[];for(const F of j.split(":")){if(!k.test(F))return null;L.push(parseInt(F,16))}return L}function v(j){if(typeof j!="string")return p(j);if(d.has(j))return d.get(j);const L=p(j);return d.set(j,L),L}function y(j){if(j[0]===0&&j[1]===0&&j[2]===0&&j[3]===0&&j[4]===0&&j[5]===65535)return`::ffff:${W((j[6]<<16|j[7])>>>0)}`;let L=-1,F=0,N=-1,S=0;for(let G=0;G<8;G++)j[G]===0?(N<0?(N=G,S=1):S++,S>F&&(F=S,L=N)):(N=-1,S=0);if(F<2)return j.map(G=>G.toString(16)).join(":");const C=j.slice(0,L).map(G=>G.toString(16)).join(":"),D=j.slice(L+F).map(G=>G.toString(16)).join(":");return`${C}::${D}`}function T(j){const L=p(j);return L===null?null:y(L)}function A(j){return T(j)??""}function M(j){return typeof j=="string"&&j.indexOf(":")>=0&&p(j)!==null}function _(j,L){const F=v(j),N=v(L);if(!F)return N?1:0;if(!N)return-1;for(let S=0;S<8;S++)if(F[S]!==N[S])return F[S]<N[S]?-1:1;return 0}const R=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:K,parse:j=>U(j.text),compare:E,format:j=>W(j.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:j=>Y(j),toClipboard:j=>W(j),fromClipboard:j=>U(j)},cidr:{base:"number",storage:"float64",matches:o,parse:j=>r(j.text),compare:i,format:j=>n(j.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:j=>{const L=l(j);return L===null?null:h(L.address,L.prefix)},toClipboard:j=>n(j),fromClipboard:j=>r(j)},ipv6:{base:"text",storage:"dictionary",matches:M,parse:j=>T(j.text),compare:_,format:j=>A(j.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:j=>T(j),toClipboard:j=>A(j),fromClipboard:j=>T(j)}}),I=R}),Ue("packages/core/src/i18n/catalogue.js",function(e,H){"use strict";Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return B}});const $=H("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.rating.of":"{rating} of {max}","cell.rating.empty":"Not rated","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","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":$,"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","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"}),B=Object.freeze(Object.keys(q))}),Ue("packages/core/src/i18n/format.js",function(e,H){"use strict";Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"formatMessage",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return O}});const $=H("packages/core/src/internal/predicates.js").isFunction,q=/\{(\w+)\}/g,B=new Map,x=new Map;function Z(b){const u=b||"";if(B.has(u))return B.get(u);let h=null;try{h=new Intl.PluralRules(b||void 0)}catch{h=null}return B.set(u,h),h}function Y(b,u,h="conjunction"){const l=Array.isArray(b)?b.filter(o=>o!=null&&o!==""):[];if(l.length===0)return"";if(l.length===1)return String(l[0]);const r=`${u||""}|${h}`;let n=x.get(r);if(n===void 0){try{n=new Intl.ListFormat(u||void 0,{style:"long",type:h})}catch{n=null}x.set(r,n)}return n?n.format(l.map(String)):l.map(String).join(", ")}function U(b,u){return b==null?"":typeof b=="number"?Number.isFinite(b)?b.toLocaleString(u||void 0,{maximumFractionDigits:20}):"":String(b)}function W(b,u,h){if(typeof b=="string")return b;if(!b||typeof b!="object")return"";const l=u&&typeof u.count=="number"?u.count:null;if(l===null)return b.other??"";const r=Z(h),n=r?r.select(l):l===1?"one":"other";return b[n]??b.other??""}function K(b,u={},h){const l=W(b,u,h);return l?l.replace(q,(r,n)=>Object.prototype.hasOwnProperty.call(u,n)?U(u[n],h):r):""}function E(b,u,h="en-GB"){return typeof b=="string"&&b?b:typeof u=="string"&&u?u:h}function O(b,u){const h=b?b[u]:void 0;return h==null||$(h)?u:h}}),Ue("packages/core/src/i18n/registry.js",function(e,H){"use strict";Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"localeCatalogue",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return Z}});const $=H("packages/core/src/i18n/catalogue.js").EN_GB,q=new Map([["en-gb",$]]);function B(Y,U){const W=typeof Y=="string"?Y.toLowerCase():"";return!W||!U||typeof U!="object"?!1:(q.set(W,U),!0)}function x(Y){if(typeof Y!="string"||!Y)return null;const U=Y.toLowerCase(),W=q.get(U);if(W)return W;const K=U.split("-")[0],E=q.get(K);if(E)return E;for(const[O,b]of q)if(O.split("-")[0]===K)return b;return null}function Z(){return[...q.keys()]}}),Ue("packages/core/src/i18n/index.js",function(e,H){"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 n}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return i}});const ne=H("packages/core/src/i18n/catalogue.js"),$=ne.EN_GB,q=ne.MESSAGE_KEYS,B=H("packages/core/src/i18n/format.js"),x=B.formatMessage,Z=B.formatList,Y=B.lookup,U=B.resolveLocale,K=H("packages/core/src/internal/predicates.js").isFunction,O=H("packages/core/src/internal/warn.js").warnOnce,b=H("packages/core/src/i18n/registry.js"),u=b.registerLocale,h=b.localeCatalogue;Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return ne.EN_GB}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return ne.MESSAGE_KEYS}}),Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return B.formatList}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return B.resolveLocale}}),Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return b.registerLocale}});const l="en-GB";class r{#e=l;#t=$;constructor(c={}){this.configure(c)}configure(c={}){this.#e=U(c.locale,c.declared,l);const s=c.messages,a=h(this.#e);if(!a&&this.#e.toLowerCase()!=="en-gb"&&(!s||typeof s!="object")&&O(`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.`),!s||typeof s!="object"){this.#t=a?{...$,...a}:$;return}const w=Object.keys(s).filter(g=>!(g in $));w.length&&O(`i18n:unknown:${w[0]}`,`message keys not in the catalogue and so ignored: ${w.slice(0,5).join(", ")}${w.length>5?`, and ${w.length-5} more`:""}`),this.#t={...$,...a||{},...s}}get locale(){return this.#e}t(c,s){return x(Y(this.#t,c),s||{},this.#e)}list(c,s){return Z(c,this.#e,s)}number(c,s){const a=Number(c);return Number.isFinite(a)?a.toLocaleString(this.#e,s||{maximumFractionDigits:20}):""}}const n=new r;function o(t){return t instanceof r?t:new r(t||{})}function i(t){const c=t&&typeof t=="object"?t:{},s=q.filter(f=>{const w=c[f];return w==null||w===""||K(w)}),a=Object.keys(c).filter(f=>!(f in $));return{missing:s,unknown:a}}}),Ue("packages/core/src/columns/types/structured.js",function(e,H){"use strict";Object.defineProperty(e,"MASK_DEFAULTS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"parseJsonText",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});const ne=H("packages/core/src/internal/predicates.js"),$=ne.isNil,q=ne.isObject,x=H("packages/core/src/i18n/index.js").defaultMessages,Z=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function Y(r,n){const o=n||{},i=o.emptyDisplay??Z.emptyDisplay;if($(r)||r==="")return i;const c=[...typeof o.char=="string"&&o.char!==""?o.char:Z.char][0]||Z.char,s=o.fixedLength??Z.fixedLength,a=Number.isFinite(o.length)&&Number(o.length)>0?Math.floor(Number(o.length)):Z.length,f=typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"||typeof r=="bigint"?String(r):null;let w=0;if(f!==null){const g=Number.isFinite(o.lastVisible)?Math.floor(Number(o.lastVisible)):Z.lastVisible,k=[...f];if(w=g>0&&g<k.length?g:0,w>0){const d=k.slice(k.length-w).join(""),p=Math.max(1,(s?a:k.length)-w);return c.repeat(p)+d}return c.repeat(s?a:Math.max(1,k.length))}return c.repeat(a)}const U=48;function W(r){try{const n=JSON.stringify(r);return n===void 0?null:n}catch{return null}}function K(r,n){if($(r))return"";const o=Number.isFinite(n&&n.inlineLimit)?Number(n.inlineLimit):U;if(typeof r=="string")return r.length>o?`${r.slice(0,o-1)}…`:r;if(typeof r!="object")return String(r);const i=W(r);if(i!==null&&i.length<=o)return i;if(Array.isArray(r)){const c=r.length;return`[${x.t("count.items",{count:c})}]`}const t=Object.keys(r).length;return`{${x.t("count.keys",{count:t})}}`}function E(r,n){if(r==null)return"null";const o=typeof r;if(o==="number"||o==="boolean"||o==="bigint")return String(r);if(o==="string")return JSON.stringify(r);if(o!=="object")return JSON.stringify(String(r));const i=n||new WeakSet;return i.has(r)?'"[circular]"':(i.add(r),r instanceof Date?JSON.stringify(r.toISOString()):Array.isArray(r)?`[${r.map(s=>E(s,i)).join(",")}]`:`{${Object.keys(r).sort().map(s=>`${JSON.stringify(s)}:${E(r[s],i)}`).join(",")}}`)}function O(r,n){if($(r))return $(n)?0:1;if($(n))return-1;const o=E(r),i=E(n);return o<i?-1:o>i?1:0}function b(r){if($(r))return null;const n=String(r);if(n.trim()==="")return null;try{return JSON.parse(n)}catch{return n}}function u(r){const n=r&&r.cell&&r.cell.props;return q(n)?n:{}}const h=Object.freeze({json:{base:"object",storage:"object",format:r=>K(r&&r.value,u(r&&r.column)),parse:r=>b(r&&r.text),compare:O,defaults:{editor:"code",filter:"text",align:"start"},excel:"@",toClipboard:r=>{if($(r))return"";if(typeof r=="string")return r;try{const n=JSON.stringify(r,null,2);return n===void 0?String(r):n}catch{return String(r)}},fromClipboard:r=>b(r)},secret:{base:"text",storage:"object",format:r=>Y(r&&r.value,u(r&&r.column)),parse:r=>{const n=r&&r.text;return $(n)||String(n)===""?null:String(n)},compare:(r,n)=>{const o=$(r)||r==="",i=$(n)||n==="";return o===i?0:o?1:-1},defaults:{editor:"password",filter:"none",align:"start"},excel:"@",export:{csv:!1,excel:!1},toClipboard:r=>Y(r),fromClipboard:r=>$(r)||String(r)===""?null:String(r)}}),l=h}),Ue("packages/core/src/columns/types/unit.js",function(e,H){"use strict";Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return N}});const $=H("packages/core/src/internal/predicates.js").isNil,B=H("packages/core/src/internal/warn.js").warnOnce;function x(S,C,D,G){return Object.freeze({symbol:S,factor:C,aliases:Object.freeze(D||[]),binary:!!(G&&G.binary),prefix:G&&G.prefix||null,auto:!(G&&G.auto===!1)})}function Z(S,C,D,G){return x(S,C,D,G)}const Y=Object.freeze({data:Object.freeze([x("B",1,["byte","bytes"]),x("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),x("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),x("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),x("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),x("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),x("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),x("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),x("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),x("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([x("bps",1,["bit","bits","bit/s","b/s"]),x("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),x("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),x("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),x("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([x("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),x("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),x("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),x("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),x("in",.0254,["inch","inches"],{auto:!1}),x("ft",.3048,["foot","feet"],{auto:!1}),x("yd",.9144,["yard","yards"],{auto:!1}),x("m",1,["metre","metres","meter","meters"]),x("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),x("mi",1609.344,["mile","miles"],{auto:!1}),x("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([x("mg",.001,["milligram","milligrams"]),x("g",1,["gram","grams"]),x("oz",28.349523125,["ounce","ounces"],{auto:!1}),x("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),x("kg",1e3,["kilogram","kilograms"]),x("st",6350.29318,["stone"],{auto:!1}),x("t",1e6,["tonne","tonnes","ton"],{auto:!1}),x("ton (US)",907184.74,["ton","shortton"],{auto:!1}),x("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([x("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),x("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),x("ms",.001,["msec","msecs","millisecond","milliseconds"]),x("s",1,["sec","secs","second","seconds"]),x("m",60,["min","mins","minute","minutes"]),x("h",3600,["hr","hrs","hour","hours"]),x("d",86400,["day","days"])]),speed:Object.freeze([x("mm/s",.001,["millimetre/s","millimeter/s"]),x("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),x("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),x("mph",.44704,["mile/h","miles/h"],{auto:!1}),x("kn",1852/3600,["knot","knots"],{auto:!1}),x("m/s",1,["metre/s","meter/s","mps"]),x("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([x("mm/s²",.001,["mm/s2"]),x("ft/s²",.3048,["ft/s2"],{auto:!1}),x("m/s²",1,["m/s2","metre/s2","meter/s2"]),x("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([x("mm²",1e-6,["mm2"]),x("cm²",1e-4,["cm2"]),x("in²",64516e-8,["in2","sqin"],{auto:!1}),x("ft²",.09290304,["ft2","sqft"],{auto:!1}),x("yd²",.83612736,["yd2","sqyd"],{auto:!1}),x("m²",1,["m2","sqm"]),x("ha",1e4,["hectare","hectares"],{auto:!1}),x("ac",4046.8564224,["acre","acres"],{auto:!1}),x("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([x("µL",1e-6,["ul","microlitre","microliter"]),x("mL",.001,["millilitre","milliliter"]),x("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),x("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),x("L",1,["litre","litres","liter","liters"]),x("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),x("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),x("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),x("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([x("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),x("J",1,["joule","joules"]),x("cal",4.184,["calorie","calories"],{auto:!1}),x("kJ",1e3,["kilojoule","kilojoules"]),x("BTU",1055.05585262,["btu"],{auto:!1}),x("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),x("MJ",1e6,["megajoule","megajoules"]),x("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),x("GJ",1e9,["gigajoule","gigajoules"]),x("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([x("mW",.001,["milliwatt","milliwatts"]),x("W",1,["watt","watts"]),x("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),x("kW",1e3,["kilowatt","kilowatts"]),x("hp",745.6998715822702,["horsepower"],{auto:!1}),x("MW",1e6,["megawatt","megawatts"]),x("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([x("mN",.001,["millinewton","millinewtons"]),x("N",1,["newton","newtons"]),x("lbf",4.4482216152605,["poundforce"],{auto:!1}),x("kgf",9.80665,["kilogramforce"],{auto:!1}),x("kN",1e3,["kilonewton","kilonewtons"]),x("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([x("Pa",1,["pascal","pascals"]),x("mbar",100,["millibar"],{auto:!1}),x("inH₂O",249.0889,["inh2o"],{auto:!1}),x("mmHg",133.322387415,["torr"],{auto:!1}),x("kPa",1e3,["kilopascal","kilopascals"]),x("inHg",3386.388640341,["inhg"],{auto:!1}),x("psi",6894.757293168361,["lbf/in2"],{auto:!1}),x("bar",1e5,[],{auto:!1}),x("atm",101325,["atmosphere","atmospheres"],{auto:!1}),x("MPa",1e6,["megapascal","megapascals"]),x("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([x("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),x("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),x("kN·m",1e3,["knm","kn.m"],{auto:!1}),x("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([x("kg/m³",1,["kg/m3"]),x("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),x("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),x("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([x("L/min",1/6e4,["lpm","l/min"],{auto:!1}),x("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),x("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),x("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),x("cfm",.0004719474432,["ft3/min"],{auto:!1}),x("L/s",.001,["lps","l/s"],{auto:!1}),x("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([x("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),x("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),x("mrad",.001,["milliradian","milliradians"],{auto:!1}),x("mil",Math.PI/3200,["nato-mil"],{auto:!1}),x("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),x("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),x("rad",1,["radian","radians"]),x("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([x("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),x("rad/s",1,["radps","radians/s"]),x("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),x("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([x("ppt",1e-12,["partspertrillion"],{auto:!1}),x("ppb",1e-9,["partsperbillion"]),x("ppm",1e-6,["partspermillion"]),x("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),x("‰",.001,["permille","permil"],{auto:!1}),x("%",.01,["pct","percent"]),x("×",1,["x","ratio","times"])]),molarity:Object.freeze([x("pM",1e-12,["picomolar","picomolarity"]),x("nM",1e-9,["nanomolar","nanomolarity"]),x("µM",1e-6,["um-molar","micromolar","micromolarity"]),x("mM",.001,["millimolar","millimolarity"]),x("M",1,["molar","mol/l","mol/L","molarity"]),x("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([x("mg/s",1e-6,["milligrams/s"]),x("g/s",.001,["grams/s"]),x("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),x("kg/s",1,["kilograms/s","kgps"]),x("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),x("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),x("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([x("µPa·s",1e-6,["upas","micropascalsecond"]),x("cP",.001,["centipoise"],{auto:!1}),x("mPa·s",.001,["mpas","millipascalsecond"]),x("P",.1,["poise"],{auto:!1}),x("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([x("cSt",1e-6,["centistokes","centistoke"]),x("mm²/s",1e-6,["mm2/s"],{auto:!1}),x("St",1e-4,["stokes","stoke"],{auto:!1}),x("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([x("mW/(m·K)",.001,["mw/mk"]),x("W/(m·K)",1,["w/mk","wmk"]),x("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),x("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([x("J/(kg·K)",1,["j/kgk","jkgk"]),x("kJ/(kg·K)",1e3,["kj/kgk"]),x("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([x("nSv/h",1e-9,["nsvh"]),x("µSv/h",1e-6,["usv/h","usvh"]),x("mSv/h",.001,["msvh"]),x("Sv/h",1,["svh"]),x("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),U=Symbol("ambiguous"),W=new Map,K=new Map;function E(S,C){const D=String(S||"").trim();if(!D)throw new Error("[lattice] a unit system needs a name");if(Y[D]||K.has(D))throw new Error(`[lattice] unit system "${D}" already exists`);const G=[...C||[]];if(!G.length)throw new Error(`[lattice] unit system "${D}" has no units`);if(!G.some(V=>V.factor===1))throw new Error(`[lattice] unit system "${D}" has no base unit (none with factor 1)`);const X=new Set;for(const V of G){if(X.has(V.symbol))throw new Error(`[lattice] unit system "${D}" declares "${V.symbol}" twice`);X.add(V.symbol)}return K.set(D,Object.freeze(G)),W.delete(D),D}function O(){return[...Object.keys(Y),...K.keys()]}function b(S){const C=u(S);return C?C.units:[]}function u(S){const C=String(S||""),D=W.get(C);if(D!==void 0)return D;const G=Y[C]||K.get(C);if(!G)return W.set(C,null),null;const X=Object.freeze([...G].sort((ie,oe)=>ie.factor-oe.factor)),V=new Map,J=new Map,ee=(ie,oe)=>{const ue=V.get(ie);ue===void 0?V.set(ie,oe):ue!==oe&&V.set(ie,U)};for(const ie of X){ee(ie.symbol.toLowerCase(),ie);for(const oe of ie.aliases)ee(oe.toLowerCase(),ie);if(ie.prefix){const oe=J.get(ie.prefix)||[];oe.push(ie),J.set(ie.prefix,oe)}}const te={units:X,byToken:V,byPrefix:J,decimal:X.filter(ie=>!ie.binary&&ie.auto),binary:X.some(ie=>ie.binary)?X.filter(ie=>(ie.binary||ie.factor===1)&&ie.auto):null};return W.set(C,te),te}function h(S,C){return C&&S.binary||S.decimal}function l(S,C){const D=u(S);if(!D||$(C))return null;const G=D.units.find(V=>V.symbol===String(C));if(G)return G;const X=D.byToken.get(String(C).trim().toLowerCase());return X&&X!==U?X:null}const r=new WeakMap;function n(S){const C=S||{};if(typeof C=="object"&&C!==null){const V=r.get(C);if(V!==void 0)return V}const D=C.system||"data",G=u(D);let X=null;if(!G)B(`unit:system:${D}`,`unknown unit system "${D}"; known systems are ${O().join(", ")}`);else{let V=C.unit?l(D,C.unit):null;V||(C.unit&&B(`unit:unit:${D}:${C.unit}`,`unknown unit "${C.unit}" in system "${D}"; falling back to ${G.units[0].symbol}`),V=G.units.find(J=>J.factor===1)||G.units[0]),X={index:G,base:V,binary:C.binary===!0}}return typeof C=="object"&&C!==null&&r.set(C,X),X}const o=new WeakMap;function i(S,C){if(!S||!C||!Array.isArray(S.compound)||S.compound.length===0)return null;const D=o.get(S);if(D!==void 0)return D;const G=new Set,X=[];for(const J of S.compound){const ee=l(S.system||"data",J);if(!ee){B(`unit:compound:${S.system}:${J}`,`unknown compound unit "${J}" in system "${S.system||"data"}"; ignoring it`);continue}G.has(ee.symbol)||(G.add(ee.symbol),X.push(ee))}X.sort((J,ee)=>ee.factor-J.factor);const V=X.length>=2?X:null;return o.set(S,V),V}function t(S,C,D){return C===D||C.factor===D.factor?S:S*C.factor/D.factor}const c=new Map;function s(S){const C=S||"",D=c.get(C);if(D)return D;const G={group:",",decimal:"."};try{for(const X of new Intl.NumberFormat(S||void 0).formatToParts(12345.6))X.type==="group"?G.group=X.value:X.type==="decimal"&&(G.decimal=X.value)}catch{}return c.set(C,G),G}const a=/[\s ]/g,f=/^[+-]?[\d '’ .,]*(?:[eE][+-]?\d+)?/,w=/^[^\d+\-(.,\s]+\s*/,g=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function k(S,C){const{group:D,decimal:G}=s(C);let X=String(S).replace(a,"");if(X==="")return null;const V=G?X.indexOf(G):-1;if(D&&D!==G){if(V>=0&&X.indexOf(D,V+G.length)>=0)return null;X=X.split(D).join("")}if(G&&G!=="."&&(X=X.split(G).join(".")),!g.test(X))return null;const J=Number(X);return Number.isFinite(J)?J:null}function d(S,C,D){const G=String(S).trim().replace(/\.$/,"");if(G==="")return null;const X=C.units.find(oe=>oe.symbol===G);if(X)return X;const V=G.toLowerCase(),J=C.byToken.get(V);if(J===U)return null;if(J)return J;const ee=C.byPrefix.get(V);if(!ee||!ee.length)return null;const te=h(C,D),ie=ee.filter(oe=>te.includes(oe));return ie.length===1?ie[0]:null}function p(S,C,D,G){let X=S,V=0,J=!1,ee=!1;for(;X!=="";){const te=f.exec(X)[0];if(te==="")return null;const ie=k(te,G&&G.locale);if(ie===null)return null;X=X.slice(te.length).trim();const oe=X.search(/[+-]?[\d]/),ue=(oe>=0?X.slice(0,oe):X).trim();if(X=oe>=0?X.slice(oe).trim():"",ue===""){if(J)return null;ee=!0,V+=t(ie,D[0],C.base)}else{const ye=d(ue,C.index,C.binary);if(!ye)return null;V+=t(ie,ye,C.base)}if(J=!0,ee&&X!=="")return null}return J?V:null}function m(S,C){if($(S))return null;if(typeof S=="number")return Number.isFinite(S)?S:null;const D=n(C);if(!D)return null;let G=String(S).trim();if(G==="")return null;let X=!1;G.startsWith("(")&&G.endsWith(")")&&(X=!0,G=G.slice(1,-1).trim());const V=i(C,D);if(V){G.startsWith("-")&&(X=!0,G=G.slice(1).trim());const he=p(G,D,V,C);return he===null?null:X?-he:he}let J=null;const ee=w.exec(G);if(ee&&ee[0]){const he=d(ee[0].trim(),D.index,D.binary);he&&(J=he,G=G.slice(ee[0].length).trim())}const te=f.exec(G)[0],ie=k(te,C&&C.locale);if(ie===null)return null;const oe=G.slice(te.length).trim();if(J&&oe!=="")return null;const ue=J||(oe===""?D.base:d(oe,D.index,D.binary));if(!ue)return null;const ye=t(ie,ue,D.base);return X?-ye:ye}const v=new Map;function y(S,C,D,G){const X=`${S||""}|${C}|${D}|${G?1:0}`;let V=v.get(X);return V||(V=new Intl.NumberFormat(S||void 0,{minimumFractionDigits:C,maximumFractionDigits:D,useGrouping:G}),v.set(X,V)),V}function T(S,C){if(!Number.isFinite(S)||S===0)return Math.max(0,C-1);const D=Math.floor(Math.log10(Math.abs(S)));return Math.min(20,Math.max(0,C-1-D))}function A(S,C){if(!Number.isFinite(S)||S===0)return S;const D=Math.ceil(Math.log10(Math.abs(S))),G=10**(C-D);return Math.round(S*G)/G}function M(S,C,D){if(!D||D===C.base.symbol)return C.base;if(D!=="auto")return _(C,D);if(S===0||!Number.isFinite(S))return C.base;const G=Math.abs(S)*C.base.factor,X=h(C.index,C.binary);let V=X[0];for(const te of X)G>=te.factor&&(V=te);if(G>=V.factor)return V;let J=V;for(const te of C.index.units)te.binary!==C.binary&&te.factor!==1||te.factor<=G&&te.factor>(J===V?0:J.factor)&&(J=te);if(J!==V)return J;let ee=V;for(const te of C.index.units)te.binary!==C.binary&&te.factor!==1||te.factor<ee.factor&&(ee=te);return ee.factor<C.base.factor?ee:C.base}function _(S,C){const D=S.index.units.find(X=>X.symbol===C);if(D)return D;const G=S.index.byToken.get(String(C).toLowerCase());return G&&G!==U?G:(B(`unit:display:${C}`,`unknown display unit "${C}"; rendering in ${S.base.symbol}`),S.base)}function R(S,C,D,G){const X=S<0;let V=Math.abs(S)*C.base.factor;const J=typeof G.decimals=="number"?G.decimals:G.minDecimals??0,ee=typeof G.decimals=="number"?G.decimals:G.maxDecimals??Math.max(J,2),te=G.space??" ",ie=[];for(let ue=0;ue<D.length;ue++){const ye=D[ue],he=ue===D.length-1;let Re=he?V/ye.factor:Math.floor(V/ye.factor);if(V-=Re*ye.factor,he){const we=10**ee;Re=Math.round(Re*we)/we+0}const Ce=he?y(G.locale,J,ee,G.group!==!1):y(G.locale,0,0,G.group!==!1);ie.push(`${Ce.format(Re)}${te}${ye.symbol}`)}const oe=ie.join(" ");return X?`-${oe}`:oe}function I(S,C){const D=C||{},G=D.nullDisplay??"";if($(S)||S==="")return G;const X=typeof S=="number"?S:Number(S);if(!Number.isFinite(X))return G;const V=n(D);if(!V)return String(X);const J=i(D,V);if(J)return R(X,V,J,D);const ee=typeof D.significantFigures=="number"&&D.significantFigures>0?D.significantFigures:0,te=ee?A(X,ee):X,ie=M(te,V,D.display),oe=t(te,V.base,ie);let ue=typeof D.decimals=="number"?D.decimals:D.minDecimals??0,ye=typeof D.decimals=="number"?D.decimals:D.maxDecimals??Math.max(ue,2);ee&&(ue=T(oe,ee),ye=ue);const he=y(D.locale,ue,ye,D.group!==!1).format(oe),Re=D.space??" ";return D.placement==="prefix"?`${ie.symbol}${D.space??""}${he}`:`${he}${Re}${ie.symbol}`}function j(S,C){const D=$(S)||Number.isNaN(S)?null:Number(S),G=$(C)||Number.isNaN(C)?null:Number(C);return D===null||Number.isNaN(D)?G===null||Number.isNaN(G)?0:1:G===null||Number.isNaN(G)||D<G?-1:D>G?1:0}function L(S){const C=typeof S.decimals=="number"&&S.decimals>0?`.${"0".repeat(S.decimals)}`:"";return`${typeof S.decimals=="number"?`#,##0${C}`:"#,##0.##"}" ${S.symbol}"`}function F(S){const C={system:"data",...S||{}},D=n(C),G=D?D.base.symbol:String(C.unit||""),X=Object.freeze({...C,unit:G}),V=Object.freeze({...X,display:G,decimals:void 0,minDecimals:0,maxDecimals:20,group:!1}),J=new Map([[X.locale||"",X]]),ee=te=>{const ie=te||"";let oe=J.get(ie);return oe||(oe=Object.freeze({...X,locale:te||void 0}),J.set(ie,oe)),oe};return{base:"number",extends:"number",storage:"float64",unitConfig:X,format:te=>I(te.value,te.locale?ee(te.locale):X),parse:te=>m(te.text,te.locale?ee(te.locale):X),compare:j,defaults:{filter:"number",editor:"unit",align:"end",total:C.total||"sum"},...C.totals?{totals:C.totals}:{},excel:C.excel||L({decimals:C.decimals,symbol:G}),toStorage:te=>typeof te=="number"?Number.isFinite(te)?te:null:typeof te=="string"?m(te,X):$(te)?null:m(String(te),X),toClipboard:te=>I(te,V),fromClipboard:te=>m(te,X)}}const N=F}),Ue("packages/core/src/columns/types/engineering.js",function(e,H){"use strict";Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return x}});const $=H("packages/core/src/internal/predicates.js").isNil,B=H("packages/core/src/columns/types/unit.js").createUnitType;function x(U){const W=2*Math.PI/U;return K=>{let E=0,O=0,b=0;for(const h of K||[]){if($(h))continue;const l=Number(h);Number.isFinite(l)&&(E+=Math.cos(l*W),O+=Math.sin(l*W),b+=1)}return!b||Math.hypot(E,O)/b<1e-12?null:(Math.atan2(O,E)/W%U+U)%U}}function Z(U){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:x(U)}}}const Y=Object.freeze({metres:B({system:"length",unit:"m",display:"auto",maxDecimals:3}),millimetres:B({system:"length",unit:"mm",maxDecimals:2}),kilometres:B({system:"length",unit:"km",maxDecimals:3}),grams:B({system:"mass",unit:"g",display:"auto",maxDecimals:3}),kilograms:B({system:"mass",unit:"kg",maxDecimals:3}),tonnes:B({system:"mass",unit:"t",maxDecimals:3}),seconds:B({system:"duration",unit:"s",display:"auto",maxDecimals:3}),milliseconds:B({system:"duration",unit:"ms",maxDecimals:3}),hours:B({system:"duration",unit:"h",maxDecimals:2}),speed:B({system:"speed",unit:"m/s",display:"auto",maxDecimals:2}),kph:B({system:"speed",unit:"km/h",maxDecimals:1}),mph:B({system:"speed",unit:"mph",maxDecimals:1}),knots:B({system:"speed",unit:"kn",maxDecimals:1}),acceleration:B({system:"acceleration",unit:"m/s²",maxDecimals:3}),area:B({system:"area",unit:"m²",display:"auto",maxDecimals:2}),hectares:B({system:"area",unit:"ha",maxDecimals:4}),volume:B({system:"volume",unit:"L",display:"auto",maxDecimals:3}),cubicMetres:B({system:"volume",unit:"m³",maxDecimals:3}),energy:B({system:"energy",unit:"J",display:"auto",maxDecimals:3}),kilowattHours:B({system:"energy",unit:"kWh",maxDecimals:2}),power:B({system:"power",unit:"W",display:"auto",maxDecimals:2}),kilowatts:B({system:"power",unit:"kW",maxDecimals:2}),force:B({system:"force",unit:"N",display:"auto",maxDecimals:2}),pressure:B({system:"pressure",unit:"Pa",display:"auto",maxDecimals:2}),bar:B({system:"pressure",unit:"bar",maxDecimals:3}),psi:B({system:"pressure",unit:"psi",maxDecimals:1}),torque:B({system:"torque",unit:"N·m",maxDecimals:2}),density:B({system:"density",unit:"kg/m³",maxDecimals:2}),flow:B({system:"flow",unit:"m³/s",maxDecimals:4}),litresPerMinute:B({system:"flow",unit:"L/min",maxDecimals:1}),radians:B({system:"angle",unit:"rad",maxDecimals:4,totals:Z(2*Math.PI)}),degrees:B({system:"angle",unit:"°",maxDecimals:2,totals:Z(360)}),rpm:B({system:"angularVelocity",unit:"rpm",maxDecimals:0}),angularVelocity:B({system:"angularVelocity",unit:"rad/s",maxDecimals:3}),ppm:B({system:"fraction",unit:"ppm",maxDecimals:2}),ppb:B({system:"fraction",unit:"ppb",maxDecimals:2}),basisPoints:B({system:"fraction",unit:"bp",maxDecimals:1}),molarity:B({system:"molarity",unit:"M",display:"auto",maxDecimals:3}),massFlow:B({system:"massFlow",unit:"kg/s",maxDecimals:3}),tonnesPerHour:B({system:"massFlow",unit:"t/h",maxDecimals:2}),viscosity:B({system:"viscosity",unit:"Pa·s",display:"auto",maxDecimals:3}),kinematicViscosity:B({system:"kinematicViscosity",unit:"cSt",maxDecimals:2}),thermalConductivity:B({system:"thermalConductivity",unit:"W/(m·K)",maxDecimals:3}),specificHeat:B({system:"specificHeat",unit:"J/(kg·K)",maxDecimals:1}),doseRate:B({system:"doseRate",unit:"µSv/h",display:"auto",maxDecimals:2})})}),Ue("packages/core/src/columns/types/si.js",function(e,H){"use strict";Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return E}});const ne=H("packages/core/src/columns/types/unit.js"),$=ne.defineUnit,q=ne.registerUnitSystem,B=ne.createUnitType,x=Object.freeze([Object.freeze({symbol:"f",name:"femto",factor:1e-15}),Object.freeze({symbol:"p",name:"pico",factor:1e-12}),Object.freeze({symbol:"n",name:"nano",factor:1e-9}),Object.freeze({symbol:"µ",name:"micro",factor:1e-6}),Object.freeze({symbol:"m",name:"milli",factor:.001}),Object.freeze({symbol:"c",name:"centi",factor:.01}),Object.freeze({symbol:"",name:"",factor:1}),Object.freeze({symbol:"k",name:"kilo",factor:1e3}),Object.freeze({symbol:"M",name:"mega",factor:1e6}),Object.freeze({symbol:"G",name:"giga",factor:1e9}),Object.freeze({symbol:"T",name:"tera",factor:1e12}),Object.freeze({symbol:"P",name:"peta",factor:1e15})]),Z=Object.freeze(["p","n","µ","m","","k","M","G"]);function Y(O){const b=String(O.base),u=new Set([...O.prefixes||Z,""]),h=[];for(const l of x){if(!u.has(l.symbol))continue;const r=`${l.symbol}${b}`,n=[];if(O.name){n.push(`${l.name}${O.name}`,`${l.name}${O.name}s`);const o=l.name.slice(-1);if(o&&O.name.startsWith(o)){const i=`${l.name.slice(0,-1)}${O.name}`;n.push(i,`${i}s`)}}l.symbol==="µ"&&n.push(`u${b}`),l.factor===1&&O.aliases&&n.push(...O.aliases),h.push($(r,l.factor,n))}for(const l of O.extra||[])h.push(l);return h}function U(O,b){const u=Y(b);return q(O,u)}function W(O,b,u){return U(O,b),B({system:O,unit:b.base,display:"auto",maxDecimals:3,...u||{}})}const K=Object.freeze({voltage:W("voltage",{base:"V",name:"volt"}),current:W("current",{base:"A",name:"amp",aliases:["ampere","amperes"]}),resistance:W("resistance",{base:"Ω",name:"ohm",aliases:["ohm","ohms","R"],prefixes:["m","","k","M","G"]}),capacitance:W("capacitance",{base:"F",name:"farad",prefixes:["f","p","n","µ","m",""]}),inductance:W("inductance",{base:"H",name:"henry",prefixes:["p","n","µ","m",""]}),charge:W("charge",{base:"C",name:"coulomb",prefixes:["p","n","µ","m",""],extra:[$("mAh",3.6,["milliamphour","milliamphours"],{auto:!1}),$("Ah",3600,["amphour","amphours"],{auto:!1})]}),conductance:W("conductance",{base:"S",name:"siemens",prefixes:["n","µ","m","","k"]}),fluxDensity:W("fluxDensity",{base:"T",name:"tesla",prefixes:["n","µ","m",""],extra:[$("G",1e-4,["gauss"],{auto:!1})]}),luminousFlux:W("luminousFlux",{base:"lm",name:"lumen",prefixes:["m","","k"]}),illuminance:W("illuminance",{base:"lx",name:"lux",prefixes:["m","","k"]}),luminousIntensity:W("luminousIntensity",{base:"cd",name:"candela",prefixes:["m","","k"]}),substance:W("substance",{base:"mol",name:"mole",prefixes:["n","µ","m","","k"]}),absorbedDose:W("absorbedDose",{base:"Gy",name:"gray",prefixes:["µ","m",""]}),equivalentDose:W("equivalentDose",{base:"Sv",name:"sievert",prefixes:["n","µ","m",""]}),radioactivity:W("radioactivity",{base:"Bq",name:"becquerel",prefixes:["","k","M","G","T"],extra:[$("Ci",37e9,["curie","curies"],{auto:!1})]}),frequency:W("frequency",{base:"Hz",name:"hertz",prefixes:["m","","k","M","G","T"]})}),E=W}),Ue("packages/core/src/columns/types/temperature.js",function(e,H){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});const $=H("packages/core/src/internal/predicates.js").isNil,q=Object.freeze({C:Object.freeze({symbol:"°C",aliases:["c","°c","celsius","centigrade"],toKelvin:h=>h+273.15,fromKelvin:h=>h-273.15}),F:Object.freeze({symbol:"°F",aliases:["f","°f","fahrenheit"],toKelvin:h=>(h+459.67)*(5/9),fromKelvin:h=>h*(9/5)-459.67}),K:Object.freeze({symbol:"K",aliases:["k","kelvin"],toKelvin:h=>h,fromKelvin:h=>h}),R:Object.freeze({symbol:"°R",aliases:["r","°r","rankine"],toKelvin:h=>h*(5/9),fromKelvin:h=>h*(9/5)})});function B(h){if($(h))return null;const l=String(h).trim();if(l==="")return null;for(const[n,o]of Object.entries(q))if(l===n||l===o.symbol)return{key:n,scale:o};const r=l.toLowerCase();for(const[n,o]of Object.entries(q))if(o.aliases.includes(r))return{key:n,scale:o};return null}function x(h,l,r){const n=B(l),o=B(r);return!n||!o||!Number.isFinite(Number(h))?null:n.key===o.key?Number(h):o.scale.fromKelvin(n.scale.toKelvin(Number(h)))}const Z=new Map;function Y(h,l,r){const n=`${h||""}|${l}|${r}`;let o=Z.get(n);return o||(o=new Intl.NumberFormat(h||void 0,{minimumFractionDigits:l,maximumFractionDigits:r}),Z.set(n,o)),o}function U(h,l){const r=l||{},n=r.nullDisplay??"";if($(h)||h==="")return n;const o=Number(h);if(!Number.isFinite(o))return n;const i=B(r.scale||"C");if(!i)return String(o);const t=B(r.display||r.scale||"C")||i,c=t.key===i.key?o:t.scale.fromKelvin(i.scale.toKelvin(o)),s=typeof r.decimals=="number"?r.decimals:null,a=s??r.minDecimals??0,f=s??r.maxDecimals??1;return`${Y(r.locale,a,f).format(c)}${r.space??" "}${t.scale.symbol}`}const W=/^[+-]?[\d\s., ]*\d/;function K(h,l){const r=String(h).trim();if(r==="")return null;const n=new Intl.NumberFormat(l||void 0).formatToParts(1.1).find(c=>c.type==="decimal")?.value||".",o=n===","?".":",",i=r.split(o).join("").split(/[\s ]/).join("").replace(n,"."),t=Number(i);return Number.isFinite(t)?t:null}function E(h,l){if($(h))return null;const r=l||{},n=B(r.scale||"C");if(!n)return null;if(typeof h=="number")return Number.isFinite(h)?h:null;let o=String(h).trim();if(o==="")return null;let i=!1;o.startsWith("(")&&o.endsWith(")")&&(i=!0,o=o.slice(1,-1).trim());const t=W.exec(o);if(!t)return null;const c=K(t[0],r.locale);if(c===null)return null;const s=o.slice(t[0].length).trim();if(s==="")return i?-c:c;const a=B(s);if(!a)return null;const f=a.key===n.key?c:n.scale.fromKelvin(a.scale.toKelvin(c));return i?-f:f}function O(h){const l=Object.freeze({scale:"C",...h||{}}),n=(B(l.scale)||B("C")).scale.symbol,o=Object.freeze({...l,display:l.scale,decimals:void 0,minDecimals:0,maxDecimals:20}),i=new Map([[l.locale||"",l]]),t=c=>{const s=c||"";let a=i.get(s);return a||(a=Object.freeze({...l,locale:c||void 0}),i.set(s,a)),a};return{base:"number",extends:"number",storage:"float64",temperatureConfig:l,format:c=>U(c.value,c.locale?t(c.locale):l),parse:c=>E(c.text,c.locale?t(c.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)}`:".#"}" ${n}"`,toStorage:c=>typeof c=="number"?Number.isFinite(c)?c:null:typeof c=="string"?E(c,l):$(c)?null:E(String(c),l),toClipboard:c=>U(c,o),fromClipboard:c=>E(c,l)}}const b=Object.freeze({celsius:O({scale:"C"}),fahrenheit:O({scale:"F"}),kelvin:O({scale:"K"})}),u=O}),Ue("packages/core/src/columns/types/radix.js",function(e,H){"use strict";Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"digitsForWidth",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"radixRange",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"radixName",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"normaliseRadixOptions",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"compileRadixFormat",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"compileRadixParse",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"parseRadixResult",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return R}});const $=H("packages/core/src/internal/predicates.js").isNil,B=H("packages/core/src/internal/warn.js").warnOnce,x=Object.freeze({2:2,8:8,16:16,bin:2,binary:2,base2:2,oct:8,octal:8,base8:8,hex:16,hexadecimal:16,base16:16}),Z=Object.freeze({2:1,8:3,16:4}),Y=Object.freeze({2:"0b",8:"0o",16:"0x"}),U=Object.freeze({2:4,8:3,16:2}),W=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),K=Object.freeze({2:"binary",8:"octal",16:"hexadecimal"}),E=Object.freeze([[/^0x/i,16],[/^0b/i,2],[/^0o/i,8],[/^#/,16]]),O=/[\s\u00a0\u202f_,']/g,b=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,u=Object.freeze([8,16,32,53]),h=new WeakSet,l=new WeakMap,r=new Map,n=new WeakMap,o=new WeakMap,i=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 t(I){if(I==null)return 16;const j=typeof I=="string"?I.toLowerCase():I,L=x[j];return L||(B(`radix:base:${String(I)}`,`unsupported radix ${String(I)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function c(I,j){return Math.ceil(I/Z[j])}function s(I,j){if(!I)return j?{min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}:{min:0,max:Number.MAX_SAFE_INTEGER};if(!j)return{min:0,max:2**I-1};const L=2**(I-1);return{min:-L,max:L-1}}function a(I){return K[I]||"hexadecimal"}function f(I){if(typeof I=="string"){const j=i[I];return j||B(`radix:preset:${I}`,`unknown radix preset "${I}"; known presets are ${Object.keys(i).join(", ")}`),{...j||{}}}if(I&&typeof I.preset=="string"){const j=i[I.preset];return j||B(`radix:preset:${I.preset}`,`unknown radix preset "${I.preset}"; known presets are ${Object.keys(i).join(", ")}`),{...j||{},...I}}return I||{}}function w(I){const j=f(I),L=t(j.radix),F=Z[L];let N=null;if(j.bitWidth!==void 0&&j.bitWidth!==null&&j.bitWidth!==!1){const te=Number(j.bitWidth);u.includes(te)?N=te:B(`radix:width:${String(j.bitWidth)}`,`unsupported bitWidth ${String(j.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let S=j.signed!==!1;!S&&N===null&&(B("radix:unsigned:width","signed: false needs a bitWidth to render a two's-complement pattern; defaulting to 32"),N=32);const C=j.prefix===void 0||j.prefix===!0?Y[L]:j.prefix===!1?"":String(j.prefix);let D=0;j.pad===!0?D=N?c(N,L):0:typeof j.pad=="number"&&j.pad>0&&(D=Math.floor(j.pad));let G=0;j.group===!0?G=U[L]:typeof j.group=="number"&&j.group>0&&(G=Math.floor(j.group));const X=s(N,S),V=typeof j.min=="number"?Math.max(X.min,j.min):X.min,J=typeof j.max=="number"?Math.min(X.max,j.max):X.max,ee=Object.freeze({radix:L,bits:F,prefix:C,uppercase:j.uppercase!==!1,pad:D,group:G,groupSeparator:typeof j.groupSeparator=="string"?j.groupSeparator:" ",bitWidth:N,signed:S,min:V,max:J<V?V:J,nullDisplay:typeof j.nullDisplay=="string"?j.nullDisplay:"",name:a(L)});return h.add(ee),ee}function g(I){if(I&&h.has(I))return I;if(typeof I=="string"){let j=r.get(I);return j||(j=w(I),r.set(I,j)),j}if(I&&typeof I=="object"){let j=l.get(I);return j||(j=w(I),l.set(I,j)),j}return g("hex")}function k(I){return I<0?-Math.round(-I):Math.round(I)}function d(I,j,L){if(j<=0||I.length<=j)return I;const F=I.length%j||j,N=[I.slice(0,F)];for(let S=F;S<I.length;S+=j)N.push(I.slice(S,S+j));return N.join(L)}function p(I){const j=g(I),{radix:L,prefix:F,uppercase:N,pad:S,group:C,groupSeparator:D,signed:G,bitWidth:X,nullDisplay:V}=j,J=X?2**X:0,ee=te=>{if($(te)||te==="")return V;const ie=typeof te=="number"?te:Number(te);if(!Number.isFinite(ie))return V;const oe=k(ie);let ue="",ye=oe;oe<0&&(G?(ue="-",ye=-oe):ye=(oe%J+J)%J);let he=ye.toString(L);return he=N?he.toUpperCase():he.toLowerCase(),S>0&&he.length<S&&(he=he.padStart(S,"0")),C>0&&(he=d(he,C,D)),ue+F+he};return ee.options=j,ee}function m(I,j){const L=g(j);let F=n.get(L);return F||(F=p(L),n.set(L,F)),F(I)}function v(I){const j=g(I),{radix:L,groupSeparator:F,signed:N,min:S,max:C}=j,D=W[L],G=X=>{if($(X))return{ok:!0,value:null,reason:"blank"};let V=String(X);if(F&&F!==""&&(V=V.split(F).join("")),V=V.replace(O,""),V==="")return{ok:!0,value:null,reason:"blank"};let J=!1;if((V[0]==="-"||V[0]==="+")&&(J=V[0]==="-",V=V.slice(1)),V==="")return{ok:!1,value:null,reason:"digits"};let ee=null;for(const[ie,oe]of E){const ue=ie.exec(V);if(!ue)continue;const ye=V.slice(ue[0].length);if(ye==="")break;if(!W[oe].test(ye))return{ok:!1,value:null,reason:"digits"};ee=parseInt(ye,oe);break}if(ee===null)if(D.test(V))ee=parseInt(V,L);else if(b.test(V))ee=Number(V);else return{ok:!1,value:null,reason:"digits"};if(!Number.isFinite(ee))return{ok:!1,value:null,reason:"digits"};const te=k(J?-ee:ee);return!N&&te<0?{ok:!1,value:te,reason:"negative"}:te<S||te>C?{ok:!1,value:te,reason:"range"}:{ok:!0,value:te,reason:"ok"}};return G.options=j,G}function y(I,j){const L=g(j);let F=o.get(L);return F||(F=v(L),o.set(L,F)),F(I)}function T(I,j){const L=y(I,j);return L.ok?L.value:null}function A(I,j){const L=$(I)||Number.isNaN(I)?null:Number(I),F=$(j)||Number.isNaN(j)?null:Number(j);return L===null?F===null?0:1:F===null||L<F?-1:L>F?1:0}function M(I){const j=I.min>=-2147483648&&I.max<=2147483647;return I.bitWidth&&j?"int32":"float64"}function _(I){const j=w(I),L=p(j),F=v(j);return{base:"number",extends:"number",storage:M(j),matches:null,format:N=>L(N.value),parse:N=>{const S=F(N.text);return S.ok?S.value:null},compare:A,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:N=>L(N),fromClipboard:N=>{const S=F(N);return S.ok?S.value:null},radix:j,formatValue:L,parseText:F}}const R=_}),Ue("packages/core/src/columns/types/aggregable.js",function(e,H){"use strict";Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"weightedMean",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"logarithmicSum",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"logarithmicMean",{enumerable:!0,get:function(){return x}});const $=H("packages/core/src/internal/predicates.js").isNil;function q(K){const E=[];for(const O of K||[]){if($(O))continue;const b=Number(O);Number.isFinite(b)&&E.push(b)}return E}function B(K){return E=>{const O=q(E);if(!O.length)return null;let b=0;for(const u of O)b+=10**(u/K);return K*Math.log10(b)}}function x(K){return E=>{const O=q(E);if(!O.length)return null;let b=0;for(const u of O)b+=10**(u/K);return K*Math.log10(b/O.length)}}function Z(K,E){const O=E&&E.column,u=(O&&O.typeOptions||{}).weight,h=E&&E.valueAt;if(!u||typeof h!="function")return null;let l=0,r=0;for(let n=0;n<K.length;n++){if($(K[n]))continue;const o=Number(K[n]);if(!Number.isFinite(o))continue;const i=h(u,n);if($(i))continue;const t=Number(i);!Number.isFinite(t)||t<=0||(l+=o*t,r+=t)}return r===0?null:l/r}function Y(K={}){const E=K.factor===20?20:10,O=typeof K.suffix=="string"?K.suffix:"",b=Number.isInteger(K.decimals)?K.decimals:1;return{base:"number",storage:"float64",name:K.name||"logarithmic",format:u=>{const h=u&&u.value;return $(h)||!Number.isFinite(Number(h))?"":`${Number(h).toFixed(b)}${O}`},parse:u=>{const h=String((u&&u.text)??"").replace(O,"").trim();if(!h)return null;const l=Number(h);return Number.isFinite(l)?l:null},defaults:{align:"end",filter:"number"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:{sum:B(E),avg:x(E)}}}}function U(K={}){const E=Number.isInteger(K.decimals)?K.decimals:1,O=K.percent===!0;return{base:"number",storage:"float64",name:K.name||"ratio",format:b=>{const u=b&&b.value;return $(u)||!Number.isFinite(Number(u))?"":O?`${Number(u).toFixed(E)}%`:Number(u).toFixed(E)},parse:b=>{const u=String((b&&b.text)??"").replace("%","").trim();if(!u)return null;const h=Number(u);return Number.isFinite(h)?h:null},defaults:{align:"end",filter:"number"},totals:{supported:["avg","min","max","count","countValues"],implement:{avg:Z}}}}const W=Object.freeze({decibel:Y({name:"decibel",factor:10,suffix:" dB"}),decibelAmplitude:Y({name:"decibelAmplitude",factor:20,suffix:" dB"}),ratio:U({name:"ratio"}),percentRate:U({name:"percentRate",percent:!0})})}),Ue("packages/core/src/columns/types/currency.js",function(e,H){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return h}}),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 o}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});const $=H("packages/core/src/internal/predicates.js").isNil,q="⚠ no rate";function B(c){if($(c))return null;const s=String(c).trim().toUpperCase();return s===""?null:s}function x(c){if($(c))return null;if(typeof c=="object"&&!Array.isArray(c)){const s=Number(c.amount),a=B(c.code);return!a||!Number.isFinite(s)?null:{amount:s,code:a}}if(Array.isArray(c)&&c.length===2){const s=Number(c[0]),a=B(c[1]);return!a||!Number.isFinite(s)?null:{amount:s,code:a}}return null}const Z=Object.freeze({$:"USD","€":"EUR","£":"GBP","¥":"JPY","₹":"INR","₩":"KRW","₽":"RUB","₺":"TRY","₴":"UAH","₪":"ILS"}),Y=Object.freeze({USD:"$",EUR:"€",GBP:"£",JPY:"¥",INR:"₹",KRW:"₩",RUB:"₽",TRY:"₺",UAH:"₴",ILS:"₪"}),U=/[+-]?[\d\s., ]*\d/;function W(c,s){const a=String(c).trim();if(a==="")return null;const f=new Intl.NumberFormat(s||void 0).formatToParts(1.1).find(d=>d.type==="decimal")?.value||".",w=f===","?".":",",g=a.split(w).join("").split(/[\s ]/).join("").replace(f,"."),k=Number(g);return Number.isFinite(k)?k:null}function K(c,s){const a=s||{},f=B(a.code);if($(c))return null;const w=x(c);if(w)return w;if(typeof c=="number")return Number.isFinite(c)&&f?{amount:c,code:f}:null;let g=String(c).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[A,M]of Object.entries(Z)){if(g.startsWith(A)){d=M,g=g.slice(A.length).trim();break}if(g.endsWith(A)){d=M,g=g.slice(0,-A.length).trim();break}}const p=U.exec(g);if(!p)return null;const m=W(p[0],a.locale);if(m===null)return null;const v=(g.slice(0,p.index)+" "+g.slice(p.index+p[0].length)).trim();!d&&v!==""&&(d=B(v));const y=d||f;return y?{amount:k?-m:m,code:y}:null}function E(c,s){if(typeof c=="function")return(a,f)=>{if(a===f)return 1;const w=c(a,f);return typeof w=="number"&&Number.isFinite(w)&&w>0?w:null};if(c&&typeof c=="object"){const a=c;return(f,w)=>{if(f===w)return 1;const g=Number(a[f]),k=Number(a[w]);return!Number.isFinite(g)||!Number.isFinite(k)||g<=0||k<=0?null:k/g}}return(a,f)=>a===f?1:null}function O(c,s,a){if(!c)return null;if(c.code===s)return c.amount;const f=a(c.code,s);return f===null?null:c.amount*f}const b=new Map;function u(c,s,a){const f=`${c||""}|${s}|${a??""}`;let w=b.get(f);if(!w){const g={style:"currency",currency:s};typeof a=="number"&&(g.minimumFractionDigits=a,g.maximumFractionDigits=a);try{w={fmt:new Intl.NumberFormat(c||void 0,g),currency:!0}}catch{w={fmt:new Intl.NumberFormat(c||void 0,typeof a=="number"?{minimumFractionDigits:a,maximumFractionDigits:a}:{}),currency:!1}}b.set(f,w)}return w}function h(c,s){const a=s||{},f=a.nullDisplay??"",w=x(c);if(!w)return f;const g=B(a.display)||w.code;let k=w.amount,d=w.code;if(g!==w.code){const v=a.rateFn||E(a.rates,a.rateBase),y=O(w,g,v);if(y===null)return`${a.missingRate??q} ${w.code}→${g}`;k=y,d=g}const{fmt:p,currency:m}=u(a.locale,d,a.decimals);return m?p.format(k):`${p.format(k)} ${d}`}function l(c){const s=x(c);return s?`${s.amount} ${s.code}`:""}function r(c){const s=c||{},a=B(s.display),f=s.rateFn||E(s.rates,s.rateBase);return(w,g)=>{const k=x(w),d=x(g);if(!k&&!d)return 0;if(!k)return 1;if(!d)return-1;if(a){const p=O(k,a,f),m=O(d,a,f);if(p!==null&&m!==null)return p===m?0:p<m?-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 n(c){const s=c||{},a=(w,g)=>{const k=[];for(const y of w||[]){const T=x(y);T&&k.push(T)}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(T=>T.amount)),code:y}}const p=B(s.display);if(!p)return`${s.missingRate??q}: mixed currencies, no display currency set`;const m=s.rateFn||E(s.rates,s.rateBase),v=[];for(const y of k){const T=O(y,p,m);if(T===null)return`${s.missingRate??q}: ${y.code}→${p}`;v.push(T)}return{amount:g(v),code:p}},f=w=>w.reduce((g,k)=>g+k,0);return{sum:w=>a(w,f),avg:w=>a(w,g=>f(g)/g.length),min:w=>a(w,g=>Math.min(...g)),max:w=>a(w,g=>Math.max(...g))}}function o(c){const s=Object.freeze({code:"USD",...c||{}}),a=E(s.rates,s.rateBase),f=Object.freeze({...s,rateFn:a}),w=n(f),g=r(f),k=new Map([[s.locale||"",f]]),d=v=>{const y=v||"";let T=k.get(y);return T||(T=Object.freeze({...f,locale:v||void 0}),k.set(y,T)),T},p=Y[B(s.display||s.code)]||"",m=typeof s.decimals=="number"&&s.decimals>0?`.${"0".repeat(s.decimals)}`:".00";return{base:"object",extends:"object",storage:"object",name:"currency",currencyConfig:f,format:v=>h(v.value,v.locale?d(v.locale):f),parse:v=>K(v.text,v.locale?d(v.locale):f),compare:g,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:w},excel:s.excel||(p?`"${p}"#,##0${m}`:`#,##0${m}`),toStorage:v=>{const y=x(v);return y||(typeof v=="string"||typeof v=="number"?K(v,f):null)},toClipboard:v=>l(v),fromClipboard:v=>K(v,f)}}const i=Object.freeze({currency:o({code:"USD"}),usd:o({code:"USD"}),eur:o({code:"EUR"}),gbp:o({code:"GBP"}),jpy:o({code:"JPY",decimals:0})}),t=o}),Ue("packages/core/src/columns/types/index.js",function(e,H){"use strict";Object.defineProperty(e,"EXTENDED_TYPES",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return A}});const ne=H("packages/core/src/columns/types/temporal.js"),$=ne.TEMPORAL_TYPES,q=H("packages/core/src/columns/types/network.js"),B=q.NETWORK_TYPES,x=H("packages/core/src/columns/types/structured.js"),Z=x.STRUCTURED_TYPES,Y=H("packages/core/src/columns/types/unit.js"),U=Y.createUnitType,W=Y.UNIT_SYSTEMS,K=Y.parseUnit,E=Y.formatUnit,O=Y.registerUnitSystem,b=Y.unitSystemNames,u=Y.unitsOf,h=Y.defineUnit,l=H("packages/core/src/columns/types/engineering.js"),r=l.ENGINEERING_TYPES,n=H("packages/core/src/columns/types/si.js"),o=n.SI_TYPES,i=n.createSiType,t=n.createSiSystem,c=n.siUnits,s=n.SI_PREFIXES,a=H("packages/core/src/columns/types/temperature.js"),f=a.TEMPERATURE_TYPES,w=a.createTemperatureType,g=a.convertTemperature,k=a.formatTemperature,d=a.parseTemperature,p=a.TEMPERATURE_SCALES,m=H("packages/core/src/columns/types/radix.js"),v=m.createRadixType,y=m.RADIX_PRESETS,T=m.parseRadix,A=m.formatRadix,M=H("packages/core/src/columns/types/aggregable.js"),_=M.AGGREGABLE_TYPES,R=H("packages/core/src/columns/types/currency.js"),I=R.CURRENCY_TYPES,j=R.createCurrencyType,L=R.parseMoney,F=R.formatMoney,N=R.convertMoney,S=R.toMoney,C=R.rateFunction,D=R.moneyComparator,G=R.normaliseCode,X=R.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return Y.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 R.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return R.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return R.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return R.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return R.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return R.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return R.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return R.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return R.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return R.MISSING_RATE}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return ne.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 x.STRUCTURED_TYPES}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return M.AGGREGABLE_TYPES}}),Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return M.createLogarithmicType}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return M.createRatioType}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return ne.parseTime}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return ne.formatTime}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return ne.parseDateTime}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return ne.formatDateTime}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return ne.parseDuration}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return ne.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 x.maskValue}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return x.summariseJson}});const V=Object.freeze({...$,...B,...Z,..._,hex:v(y.hex),hex8:v(y.hex8),hex16:v(y.hex16),hex32:v(y.hex32),binary:v(y.binary),binary8:v(y.binary8),octal:v(y.octal),bytes:U({system:"data",unit:"B",display:"auto"}),megabytes:U({system:"data",unit:"MB"}),gigabytes:U({system:"data",unit:"GB"}),bitrate:U({system:"bitrate",unit:"Mbps"}),gigabits:U({system:"bitrate",unit:"Gbps"}),...r,...o,...f,...I});{const J=new Set;for(const ee of[$,B,Z,_,r,o,f,I])for(const te of Object.keys(ee)){if(J.has(te))throw new Error(`[lattice] data type "${te}" is declared twice`);J.add(te)}}}),Ue("packages/core/src/compute/handle.js",function(e,H){"use strict";Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return h}}),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 n}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return o}});const ne=H("packages/core/src/internal/compare.js"),$=ne.collator,q=ne.defaultCompare,x=H("packages/core/src/internal/warn.js").warnOnce;function Z(i){const t=new Uint32Array(i);for(let c=0;c<i;c++)t[c]=c;return t}function Y(i,t){if(t&&typeof t.count=="number")return t.count;if(!i)return 0;if(typeof i.count=="number")return i.count;if(typeof i.length=="number")return i.length;const c=i.values;return i.kind==="multi"&&i.offsets?Math.max(0,i.offsets.length-1):c?i.kind==="bitset"?typeof c.size=="number"?c.size:i.presence&&typeof i.presence.size=="number"?i.presence.size:(x(`count:${i.id}`,`column "${i.id}" is bitset-backed with no declared row count; assuming ${c.length*8}`),c.length*8):c.length:i.presence&&typeof i.presence.size=="number"?i.presence.size:0}const U=new WeakMap;function W(i){const t=i.constructor;if(!t)return"unknown";const c=U.get(t);if(c)return c;let s="unknown";try{let a=null;typeof t.from=="function"?a=t.from([!1,!0]):(a=new t(8),a.set(1));const f=a&&a.words;f&&f.length&&(f[0]===2?s="lsb":f[0]===64&&(s="msb"))}catch{s="unknown"}return U.set(t,s),s}function K(i){if(!i)return()=>0;const t=i instanceof Uint8Array?i:i.words;if(t instanceof Uint8Array){const c=i instanceof Uint8Array?"lsb":W(i);if(c==="lsb")return s=>t[s>>>3]>>>(s&7)&1;if(c==="msb")return s=>t[s>>>3]>>>7-(s&7)&1}return typeof i.get=="function"?c=>i.get(c)?1:0:()=>0}function E(i){return!i||!i.presence?null:K(i.presence)}function O(i){return i?typeof i.size=="number"?i.size:typeof i.values=="function"?i.values().length:0:0}function b(i,t){return i?typeof i.valueOf=="function"?i.valueOf(t):typeof i.values=="function"?i.values()[t]:null:null}function u(i,t){const c=i.offsets,s=i.values;if(!c||!s)return[];const a=c[t],f=c[t+1];if(!(f>a))return[];const w=i.dict,g=new Array(f-a);for(let k=a;k<f;k++)g[k-a]=w?b(w,s[k]):s[k];return g}function h(i){if(!i)return()=>{};const t=i.values,c=E(i),s=i.kind;if(s==="dictionary"){const a=i.dict;return c?f=>c(f)?b(a,t[f]):null:f=>b(a,t[f])}if(s==="bitset"){const a=K(t);return c?f=>c(f)?a(f)===1:null:f=>a(f)===1}if(s==="multi")return c?a=>c(a)?u(i,a):null:a=>u(i,a);if(!t&&typeof i.get=="function"){const a=i.get.bind(i);return f=>{const w=a(f);return w===void 0?null:w}}return c?a=>{if(!c(a))return null;const f=t[a];return f===void 0?null:f}:a=>{const f=t[a];return f===void 0?null:f}}function l(i,t){if(i<t)return-1;if(i>t)return 1;if(i===t){const a=Object.is(i,-0),f=Object.is(t,-0);return a===f?0:a?-1:1}const c=Number.isNaN(i),s=Number.isNaN(t);return c&&s?0:c?1:-1}function r(i){const t=$(i);return(c,s)=>{if(c===s)return 0;const a=typeof c,f=typeof s;if(a==="string"&&f==="string")return t.compare(c,s);if(a==="number"&&f==="number")return l(c,s);if(a==="boolean"&&f==="boolean")return c===s?0:c?1:-1;if(c instanceof Date||s instanceof Date){const w=c instanceof Date?c.getTime():Number(c),g=s instanceof Date?s.getTime():Number(s);return l(w,g)}return q(c,s)}}function n(i,t){if(i&&typeof i.ranks=="function")return i.ranks(t);const c=i&&typeof i.values=="function"?i.values():[],s=c.length,a=r(t),f=new Array(s);for(let g=0;g<s;g++)f[g]=g;f.sort((g,k)=>a(c[g],c[k])||g-k);const w=new Uint32Array(s);for(let g=0;g<s;g++)w[f[g]]=g;return w}function o(i){return i==null||typeof i=="number"&&Number.isNaN(i)}}),Ue("packages/core/src/compute/filter.js",function(e,H){"use strict";Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"wallMs",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return ye}});const $=H("packages/core/src/internal/predicates.js").isBlank,B=H("packages/core/src/internal/merge.js").toArray,Z=H("packages/core/src/internal/warn.js").warnOnce,Y=H("packages/core/src/format/date.js"),U=Y.toDate,W=Y.toIsoDate,K=H("packages/core/src/compute/handle.js"),E=K.bitReader,O=K.dictSize,b=K.dictValue,u=K.presenceReader,h=K.valueComparator,l=K.valueReader,r=/^\d{4}-\d{2}-\d{2}$/,n="\0null\0";function o(he,Re){const Ce=he&&he.pool;if(Ce){const we=Ce.mask||Ce.acquireMask||Ce.acquire||Ce.take;if(typeof we=="function"){const re=we.call(Ce,Re);if(re&&re.length>=Re)return re}}return new Uint8Array(Re)}function i(he,Re){const Ce=he&&he.pool;if(!Ce||!Re)return;const we=Ce.release||Ce.releaseMask||Ce.free||Ce.recycle;typeof we=="function"&&we.call(Ce,Re)}function t(he,Re,Ce){return he.fill(Ce,0,Re),he}function c(he){return he==null||typeof he=="number"&&Number.isNaN(he)}function s(he,Re){if(he==null)return he;if(Re==="number")return typeof he=="number"?he:Number(he);if(Re==="date"||Re==="dateString"){const Ce=W(he);return Ce===null?a(he):Ce}return Re==="boolean"?typeof he=="boolean"?he:he==="true"||he===1?!0:he==="false"||he===0?!1:!!he:he}function a(he){return he instanceof Date?he.getTime():typeof he=="number"?he:Date.parse(String(he))}function f(he){return typeof he=="number"?he:he instanceof Date?he.getTime():he==null||he===""?NaN:Number(he)}function w(he,Re){const Ce=typeof he=="string"?he:String(he);return Re?Ce:Ce.toLowerCase()}function g(he,Re){return he==null?n:typeof he=="string"?Re?he:he.toLowerCase():he instanceof Date?he.getTime():he}function k(he,Re,Ce){const we=new Set;for(const re of B(he)){const de=s(re,Ce);we.add(g(de,Re)),typeof de=="string"&&de!==""&&Number.isFinite(Number(de))?we.add(Number(de)):typeof de=="number"&&Number.isFinite(de)&&we.add(g(String(de),Re))}return we}function d(he,Re,Ce){if(he==null||Re===null||Re===void 0)return he==null&&Re==null;const we=typeof he,re=typeof Re;return we==="string"&&re==="string"?Ce?he===Re:he.toLowerCase()===Re.toLowerCase():he instanceof Date||Re instanceof Date?a(he)===a(Re):we==="number"&&re==="number"?he===Re||Number.isNaN(he)&&Number.isNaN(Re):we==="number"&&re==="string"?he===Number(Re):we==="string"&&re==="number"?Number(he)===Re:we==="boolean"||re==="boolean"?he===Re:Array.isArray(he)&&Array.isArray(Re)?he.length===Re.length&&he.every((de,me)=>d(de,Re[me],Ce)):he===Re}function p(he,Re){try{if(he instanceof RegExp){const Ce=he.flags.replace(/[gy]/g,"");return new RegExp(he.source,Re||Ce.includes("i")?Ce:`${Ce}i`)}return new RegExp(String(he),Re?"":"i")}catch(Ce){return Z(`regex:${String(he)}`,`filter operator "matches" received an invalid pattern: ${String(he)}`,Ce),null}}function m(he,Re){if(he&&he.type==="datetime"&&v.has(he.op))return _(he,Re);const Ce=R(he,Re),we=he&&he.type;return we!=="date"&&we!=="dateString"?Ce:re=>Ce(typeof re=="string"&&r.test(re)?re:W(re)??re)}const v=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*)?)?)?$/,T=new Map;function A(he,Re){let Ce=T.get(Re);if(Ce===void 0){try{Ce=new Intl.DateTimeFormat("en-CA",{timeZone:Re,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{Ce=null}T.set(Re,Ce)}if(!Ce)return null;const we={};for(const re of Ce.formatToParts(he))re.type!=="literal"&&(we[re.type]=re.value);return we}function M(he,Re){if(he==null||he==="")return null;if(typeof he=="string"){const de=y.exec(he.trim());if(de)return Date.UTC(+de[1],+de[2]-1,+de[3],+(de[4]||0),+(de[5]||0),+(de[6]||0),+(de[7]||"0").padEnd(3,"0"))}const Ce=U(he);if(!Ce)return null;const we=Ce.getUTCMilliseconds(),re=Re?A(Ce,Re):null;return re?Date.UTC(+re.year,+re.month-1,+re.day,re.hour==="24"?0:+re.hour,+re.minute,+re.second,we):Date.UTC(Ce.getFullYear(),Ce.getMonth(),Ce.getDate(),Ce.getHours(),Ce.getMinutes(),Ce.getSeconds(),we)}function _(he,Re){const Ce=typeof he.timeZone=="string"&&he.timeZone?he.timeZone:void 0,we=me=>M(me,Ce),re=Array.isArray(he.value)?he.value.map(we):we(he.value),de=R({...he,type:"number",value:re},Re);return me=>de(M(me))}function R(he,Re){const Ce=he&&he.op,we=!!(he&&he.caseSensitive),re=he&&he.type,de=h(Re),me=Oe=>ke=>!Oe(ke);switch(Ce){case"eq":{const Oe=s(he.value,re);return ke=>d(ke,Oe,we)}case"ne":{const Oe=s(he.value,re);return ke=>!d(ke,Oe,we)}case"lt":case"lte":case"gt":case"gte":{const Oe=s(he.value,re);if(c(Oe))return()=>!1;const ke=Ce==="lt"?-1:Ce==="lte"?0:Ce==="gt"?1:2;return Le=>{if(c(Le))return!1;const ce=de(Le,Oe);return ke===-1?ce<0:ke===0?ce<=0:ke===1?ce>0:ce>=0}}case"between":case"notBetween":{const Oe=B(he.value),ke=s(Oe[0],re),Le=s(Oe[1],re),ce=he.bounds||"[]",ge=ce.charAt(0)!=="(",Se=ce.charAt(1)!==")";if(c(ke)||c(Le))return Ce==="between"?()=>!1:()=>!0;const Fe=be=>{if(c(be))return!1;const Ie=de(be,ke),He=de(be,Le);return(ge?Ie>=0:Ie>0)&&(Se?He<=0:He<0)};return Ce==="between"?Fe:me(Fe)}case"in":case"notIn":{const Oe=k(he.value,we,re),ke=Le=>Oe.has(g(Le,we));return Ce==="in"?ke:me(ke)}case"contains":case"notContains":{const Oe=w(s(he.value,re),we),ke=Le=>Le==null?!1:w(Le,we).includes(Oe);return Ce==="contains"?ke:me(ke)}case"startsWith":{const Oe=w(s(he.value,re),we);return ke=>ke==null?!1:w(ke,we).startsWith(Oe)}case"endsWith":{const Oe=w(s(he.value,re),we);return ke=>ke==null?!1:w(ke,we).endsWith(Oe)}case"matches":{const Oe=p(he.value,we);return Oe?ke=>ke==null?!1:Oe.test(String(ke)):()=>!1}case"blank":return Oe=>$(Oe)||Array.isArray(Oe)&&Oe.length===0;case"notBlank":return Oe=>!($(Oe)||Array.isArray(Oe)&&Oe.length===0);case"containsAny":case"containsNone":{const Oe=k(he.value,we,re),ke=Le=>{const ce=Le==null?[]:B(Le);for(let ge=0;ge<ce.length;ge++)if(Oe.has(g(ce[ge],we)))return!0;return!1};return Ce==="containsAny"?ke:me(ke)}case"containsAll":{const Oe=B(he.value).map(ke=>g(s(ke,re),we));return ke=>{const Le=ke==null?[]:B(ke);if(Oe.length===0)return!0;const ce=new Set(Le.map(ge=>g(ge,we)));for(let ge=0;ge<Oe.length;ge++)if(!ce.has(Oe[ge]))return!1;return!0}}default:{const Oe=ye(Ce);return Oe?Oe.compile(he.value):(Z(`op:${String(Ce)}`,`unknown filter operator "${String(Ce)}"; the condition is refused rather than matching every row`),()=>!1)}}}function I(he,Re,Ce){return m(Re,Ce)(he)}const j=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),L=new Set(["containsAny","containsAll","containsNone"]);function F(he,Re,Ce){const we=he&&he.op,re=j[we]||we,de=m({...he,op:re,type:Re.type},Ce),me=Re.items,Oe=ke=>{const Le=me(ke);if(!Le)return!1;for(let ce=0;ce<Le.length;ce++)if(de(Le[ce]))return!0;return!1};return j[we]?ke=>!Oe(ke):Oe}function N(he,Re,Ce,we){const re=u(he);if(re){const Oe=Re?1:0;for(let ke=0;ke<we;ke++)Ce[ke]=re(ke)===Oe?1:0;return Ce}const de=he.kind;if(de==="float64"||de==="int32"||de==="bitset")return t(Ce,we,Re?1:0);const me=l(he);for(let Oe=0;Oe<we;Oe++){const ke=me(Oe),Le=$(ke)||Array.isArray(ke)&&ke.length===0;Ce[Oe]=Le===Re?0:1}return Ce}function S(he,Re,Ce,we){const re=he.dict,de=O(re),me=new Uint8Array(de);for(let ce=0;ce<de;ce++)me[ce]=Re(b(re,ce))?1:0;const Oe=he.values,ke=u(he);if(!ke){for(let ce=0;ce<we;ce++)Ce[ce]=me[Oe[ce]];return Ce}const Le=Re(null)?1:0;for(let ce=0;ce<we;ce++)Ce[ce]=ke(ce)===1?me[Oe[ce]]:Le;return Ce}function C(he,Re,Ce,we){const re=E(he.values),de=Re(!0)?1:0,me=Re(!1)?1:0,Oe=u(he);if(!Oe){for(let Le=0;Le<we;Le++)Ce[Le]=re(Le)===1?de:me;return Ce}const ke=Re(null)?1:0;for(let Le=0;Le<we;Le++)Ce[Le]=Oe(Le)===0?ke:re(Le)===1?de:me;return Ce}function D(he,Re,Ce,we,re){const de=he.values,me=Re.type,Oe=Re.op;let ke=!0;switch(Oe){case"eq":case"ne":{const ce=f(s(Re.value,me)),ge=typeof Re.value=="number"&&Number.isNaN(Re.value),Se=Oe==="ne"?1:0;if(ge)for(let Fe=0;Fe<re;Fe++)we[Fe]=(Number.isNaN(de[Fe])?1:0)^Se;else for(let Fe=0;Fe<re;Fe++)we[Fe]=(de[Fe]===ce?1:0)^Se;break}case"lt":{const ce=f(s(Re.value,me));for(let ge=0;ge<re;ge++)we[ge]=de[ge]<ce?1:0;break}case"lte":{const ce=f(s(Re.value,me));for(let ge=0;ge<re;ge++)we[ge]=de[ge]<=ce?1:0;break}case"gt":{const ce=f(s(Re.value,me));for(let ge=0;ge<re;ge++)we[ge]=de[ge]>ce?1:0;break}case"gte":{const ce=f(s(Re.value,me));for(let ge=0;ge<re;ge++)we[ge]=de[ge]>=ce?1:0;break}case"between":case"notBetween":{const ce=B(Re.value),ge=f(s(ce[0],me)),Se=f(s(ce[1],me)),Fe=Re.bounds||"[]",be=Fe.charAt(0)!=="(",Ie=Fe.charAt(1)!==")",He=Oe==="notBetween"?1:0;if(be&&Ie)for(let Ge=0;Ge<re;Ge++)we[Ge]=(de[Ge]>=ge&de[Ge]<=Se?1:0)^He;else if(be)for(let Ge=0;Ge<re;Ge++)we[Ge]=(de[Ge]>=ge&de[Ge]<Se?1:0)^He;else if(Ie)for(let Ge=0;Ge<re;Ge++)we[Ge]=(de[Ge]>ge&de[Ge]<=Se?1:0)^He;else for(let Ge=0;Ge<re;Ge++)we[Ge]=(de[Ge]>ge&de[Ge]<Se?1:0)^He;break}case"in":case"notIn":{const ce=new Set;for(const Se of B(Re.value)){const Fe=f(s(Se,me));Number.isNaN(Fe)||ce.add(Fe)}const ge=Oe==="notIn"?1:0;for(let Se=0;Se<re;Se++)we[Se]=(ce.has(de[Se])?1:0)^ge;break}default:ke=!1;break}if(!ke)return!1;const Le=u(he);if(Le){const ce=Ce(null)?1:0;for(let ge=0;ge<re;ge++)Le(ge)===0&&(we[ge]=ce)}return!0}function G(he,Re,Ce,we){const re=l(he);for(let de=0;de<we;de++)Ce[de]=Re(re(de))?1:0;return Ce}function X(he,Re,Ce){const we=Re.count|0,re=Ce||o(Re,we);if(!he)return t(re,we,1);const de=typeof Re.handle=="function"?Re.handle(he.col):void 0,me=typeof Re.custom=="function"?Re.custom:null;if(!de){if(me){for(let ce=0;ce<we;ce++)re[ce]=me(he,ce)?1:0;return re}return Z(`filter:col:${String(he.col)}`,`filter references unknown column "${String(he.col)}"; the condition is refused rather than matching every row`),t(re,we,0)}const Oe=he.op;if(Oe==="blank"||Oe==="notBlank")return N(de,Oe==="notBlank",re,we);const ke=typeof Re.itemwise=="function"?Re.itemwise(he.col):null;if(ke&&!ye(Oe)&&!L.has(Oe))return G(de,F(he,ke,Re.locale),re,we);const Le=m(he,Re.locale);switch(de.kind){case"dictionary":return S(de,Le,re,we);case"bitset":return C(de,Le,re,we);case"float64":case"int32":return D(de,he,Le,re,we)?re:G(de,Le,re,we);default:return G(de,Le,re,we)}}function V(he,Re,Ce){if(!he)return t(o(Re,Ce),Ce,1);if(Array.isArray(he.conditions)){const we=he.conditions.filter(me=>me!=null),re=he.op==="or"?"or":he.op==="not"?"not":"and";if(we.length===0)return t(o(Re,Ce),Ce,1);const de=V(we[0],Re,Ce);for(let me=1;me<we.length;me++){const Oe=V(we[me],Re,Ce);if(re==="or")for(let ke=0;ke<Ce;ke++)de[ke]|=Oe[ke];else for(let ke=0;ke<Ce;ke++)de[ke]&=Oe[ke];i(Re,Oe)}if(re==="not")for(let me=0;me<Ce;me++)de[me]^=1;return de}return X(he,Re,o(Re,Ce))}function J(he,Re){return V(he,Re,Re.count|0)}function ee(he,Re){if(!he||!Re)return he||null;const Ce=he;if(Array.isArray(Ce.conditions)){if((Ce.op==="or"?"or":Ce.op==="not"?"not":"and")!=="and")return te(Ce,Re)?null:he;const re=[];for(const de of Ce.conditions){const me=ee(de,Re);me&&re.push(me)}return re.length?{...Ce,op:"and",conditions:re}:null}return Ce.col===Re?null:he}function te(he,Re){if(!he||typeof he!="object")return!1;const Ce=he;if(Ce.col===Re)return!0;if(Array.isArray(Ce.conditions)){for(const we of Ce.conditions)if(te(we,Re))return!0}return!1}function ie(he,Re,Ce){if(Ce&&Ce.length>=Re){let me=0;for(let Oe=0;Oe<Re;Oe++)he[Oe]&&(Ce[me++]=Oe);return Ce.subarray(0,me)}let we=0;for(let me=0;me<Re;me++)we+=he[me]?1:0;const re=new Uint32Array(we);let de=0;for(let me=0;me<Re;me++)he[me]&&(re[de++]=me);return re}const oe=new Map;function ue(he){if(!(!he||typeof he!="object"))for(const[Re,Ce]of Object.entries(he))Ce&&typeof Ce.compile=="function"&&oe.set(Re,Ce)}function ye(he){return typeof he=="string"?oe.get(he):void 0}}),Ue("packages/core/src/columns/datatypes.js",function(e,H){"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 M}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return F}});const ne=H("packages/core/src/internal/compare.js"),$=ne.collator,q=ne.defaultCompare,B=H("packages/core/src/internal/predicates.js"),x=B.isNil,Z=B.isObject,Y=B.isFunction,W=H("packages/core/src/internal/warn.js").fail,E=H("packages/core/src/internal/text.js").titleCase,O=H("packages/core/src/format/date.js"),b=O.toDate,u=O.toIsoDate,h=O.compareIso,r=H("packages/core/src/format/boolean.js").toTriState,o=H("packages/core/src/columns/types/index.js").EXTENDED_TYPES,i=H("packages/core/src/formula/index.js"),t=i.evaluateFormula,c=i.looksLikeFormula,a=H("packages/core/src/compute/filter.js").declareOperators,f=/^\d{4}-\d{2}-\d{2}$/;function w(N){return N.getHours()===0&&N.getMinutes()===0&&N.getSeconds()===0&&N.getMilliseconds()===0}const g=new Map;function k(N){const S=N||"",C=g.get(S);if(C)return C;const D={group:",",decimal:"."};try{for(const G of new Intl.NumberFormat(N||void 0).formatToParts(12345.6))G.type==="group"?D.group=G.value:G.type==="decimal"&&(D.decimal=G.value)}catch{}return g.set(S,D),D}const d=/\d\s*[*/^]\s*[\d.(]/;function p(N,S){if(x(N))return null;let C=String(N).trim();if(C===""||C.startsWith("=")||d.test(C))return null;let D=1;C.startsWith("(")&&C.endsWith(")")&&(D=-1,C=C.slice(1,-1));const G=C.endsWith("%"),{group:X,decimal:V}=k(S);if(C=C.replace(/[\s\u00a0\u202f\u2009']/g,""),X&&X!=="."&&X!==","&&(C=C.split(X).join("")),C=C.replace(/[^0-9eE+\-.,]/g,""),V===","?C=C.split(".").join("").replace(",","."):C=C.split(",").join(""),C===""||C==="-"||C==="+")return null;const J=Number(C);return Number.isNaN(J)?null:D*(G?J/100:J)}function m(N,S){const C=x(N)||Number.isNaN(N)?null:Number(N),D=x(S)||Number.isNaN(S)?null:Number(S);return C===null?D===null?0:1:D===null||C<D?-1:C>D?1:0}function v(N,S){const C=r(N),D=r(S);return C===null?D===null?0:1:D===null?-1:C===D?0:C?1:-1}function y(N,S){const C=b(N),D=b(S);if(!C)return D?1:0;if(!D)return-1;const G=C.getTime(),X=D.getTime();return G<X?-1:G>X?1:0}const T=new Map;function A(N){const S=b(N.value);if(!S)return"";const C=N.locale||"";let D=T.get(C);return D||(D=new Intl.DateTimeFormat(N.locale||void 0,{dateStyle:"medium"}),T.set(C,D)),D.format(S)}const M={boolean:{base:"boolean",storage:"bitset",matches:N=>typeof N=="boolean",parse:N=>r(N.text),compare:v,format:N=>r(N.value)===null?"":r(N.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:N=>r(N)===null?"":String(r(N)),fromClipboard:N=>r(N)},number:{base:"number",storage:"float64",matches:N=>typeof N=="number"&&!Number.isNaN(N),parse:N=>{if(c(N.text)){const S=t(N.text,N);if(!S.ok)return null;const C=Number(S.value);return Number.isFinite(C)?C:null}return p(N.text,N.locale)},compare:m,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:N=>x(N)?"":String(N),fromClipboard:(N,S)=>p(N,S&&S.locale)},date:{base:"dateString",storage:"dictionary",matches:N=>typeof N=="string"&&f.test(N)&&!Number.isNaN(Date.parse(N))||N instanceof Date&&!Number.isNaN(N.getTime())&&w(N),parse:N=>u(N.text),compare:h,format:A,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:N=>u(N),toClipboard:N=>x(N)?"":String(N),fromClipboard:N=>u(N)},dateString:{base:"dateString",storage:"dictionary",matches:N=>typeof N=="string"&&f.test(N)&&!Number.isNaN(Date.parse(N)),parse:N=>u(N.text),compare:h,format:A,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:N=>u(N),toClipboard:N=>x(N)?"":String(N),fromClipboard:N=>u(N)},text:{base:"text",storage:"dictionary",matches:N=>typeof N=="string",parse:N=>N.text===""?null:String(N.text),compare:(N,S)=>x(N)?x(S)?0:1:x(S)?-1:$().compare(String(N),String(S)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:N=>x(N)?"":String(N),fromClipboard:N=>N},image:{base:"text",storage:"dictionary",parse:N=>N.text===""||N.text==null?null:String(N.text).trim(),compare:(N,S)=>x(N)?x(S)?0:1:x(S)?-1:$().compare(String(N),String(S)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:N=>x(N)?"":String(N),fromClipboard:N=>N},lookup:{base:"text",storage:"dictionary",parse:N=>{if(N.text===""||N.text==null)return null;const S=N.column&&N.column.lookup,C=S&&Y(S.options)?S.options():null;if(!C)return N.text;const D=String(N.text),G=C.find(J=>String(J.id)===D);if(G)return G.id;const X=D.trim().toLowerCase(),V=C.find(J=>String(J.label).toLowerCase()===X);return V?V.id:N.text},compare:q,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:N=>x(N)?"":String(N),fromClipboard:N=>N},object:{base:"object",storage:"object",matches:N=>N!==null&&typeof N=="object"&&!(N instanceof Date),parse:N=>{try{return N.text===""?null:JSON.parse(N.text)}catch{return N.text}},compare:(N,S)=>q(N,S),format:N=>{const S=N.value;if(x(S))return"";if(typeof S=="string")return S;try{return JSON.stringify(S)}catch{return String(S)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:N=>x(N)?"":typeof N=="string"?N:JSON.stringify(N),fromClipboard:N=>N}},_=["boolean","number","date","dateString","datetime","text","object"];function R(N,S,C,D){const G=C.get(N);if(G)return G;D.includes(N)&&W(`circular data type extends chain: ${[...D,N].join(" → ")}`);const X=S[N];X||W(`unknown data type "${N}"`);let V=null;X.extends&&(V=R(X.extends,S,C,[...D,N]));const J={...V||{},...X,name:N,defaults:{...V&&V.defaults||{},...X.defaults||{}}};return J.base||(J.base=V&&V.base||"text"),J.storage||(J.storage=V&&V.storage||"object"),C.set(N,J),J}function I(N,S){const C={...M,...o};if(S&&typeof S.dataType=="function"&&typeof S.names=="function")for(const G of S.names("dataType")){const X=S.dataType(G);X&&(C[G]=X)}if(Z(N))for(const[G,X]of Object.entries(N))C[G]=X;const D=new Map;for(const G of _)R(G,C,D,[]);R("lookup",C,D,[]);for(const G of Object.keys(C))R(G,C,D,[]);for(const G of D.values())a(G.operators);return D}function j(N,S){if(N.base==="text"&&(!N.compare||N.compare===M.text.compare)){const C=$(S);return(D,G)=>x(D)?x(G)?0:1:x(G)?-1:C.compare(String(D),String(G))}return N.compare||q}function L(N,S){return S?N.multiStorage||"multi":N.storage||"object"}function F(N){return E(String(N).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),Ue("packages/core/src/columns/infer.js",function(e,H){"use strict";Object.defineProperty(e,"DEFAULT_SAMPLE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"inferFromValues",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return Y}});const $=H("packages/core/src/internal/warn.js").infoOnce,B=H("packages/core/src/internal/predicates.js").isNil,x=100;function Z(U,W,K={}){const E=K.sampleSize??x,O=[];for(let b=0;b<U.length&&O.length<E;b++){const u=U[b];B(u)||typeof u=="number"&&Number.isNaN(u)||O.push(u)}if(O.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[b,u]of W){if(typeof u.matches!="function")continue;let h=!0;for(let l=0;l<O.length;l++)if(!u.matches(O[l])){h=!1;break}if(h)return{type:b,unanimous:!0,sampled:O.length}}return K.quiet||$(`infer:${K.colId||"?"}`,`column "${K.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:O.length}}function Y(U,W,K,E,O={}){const b=O.sampleSize??x,u=[];for(let h=0;h<W.length&&u.length<b;h++){const l=K(W[h]);B(l)||typeof l=="number"&&Number.isNaN(l)||u.push(l)}return Z(u,E,{...O,colId:U}).type}}),Ue("packages/core/src/columns/graph.js",function(e,H){"use strict";Object.defineProperty(e,"WHOLE_ROW",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"declarationOf",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return E}});const ne=H("packages/core/src/internal/warn.js"),$=ne.DEV,q=ne.fail,B=ne.warnOnce,Z=H("packages/core/src/internal/predicates.js").isFunction,Y="*";function U(O){const b=O.value||{};if(!Z(b.compute))return{computed:!1,wholeRow:!1,deps:[],pure:!0};const h=b.pure!==!1;return b.deps===Y?{computed:!0,wholeRow:!0,deps:[],pure:h}:Array.isArray(b.deps)?{computed:!0,wholeRow:!1,deps:b.deps.slice(),pure:h}:(B(`deps:missing:${O.id}`,`computed column "${O.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:h})}function W(O){const b=new Map;for(const f of O)b.set(f.id,f);const u=new Map,h=new Map,l=new Set,r=new Set,n=new Set,o=new Set;for(const f of O){const w=U(f);if(!w.computed){u.set(f.id,[]);continue}r.add(f.id),(w.pure?n:o).add(f.id),w.wholeRow&&l.add(f.id);const g=[],k=[];for(const d of w.deps)(b.has(d)?g:k).push(d);u.set(f.id,g),k.length&&h.set(f.id,k)}for(const f of n)for(const w of u.get(f))o.has(w)&&q(`pure computed column "${f}" depends on impure column "${w}". Mark it \`value.pure: false\` or make the dependency pure.`);const i=[],t=new Map,c=[],s=f=>{const w=t.get(f);if(w!=="done"){if(w==="open"){const g=c.indexOf(f);q(`circular column dependency: ${[...c.slice(g),f].join(" → ")}`)}t.set(f,"open"),c.push(f);for(const g of u.get(f)||[])b.has(g)&&s(g);c.pop(),t.set(f,"done"),i.push(f)}};for(const f of O)s(f.id);const a=new Map;for(const f of O)a.set(f.id,[]);for(const f of O)for(const w of u.get(f.id)||[]){const g=a.get(w);g&&!g.includes(f.id)&&g.push(f.id)}if(l.size)for(const f of O){if(r.has(f.id))continue;const w=a.get(f.id);for(const g of l)w.includes(g)||w.push(g)}return{order:i,dependents:a,pure:n,impure:o,computed:r,deps:u,wholeRow:l,external:h,index:b}}function K(O,b){const u=Array.isArray(b)?b:[b],h=new Set,l=[...u];for(;l.length;){const r=l.shift();for(const n of O.dependents.get(r)||[])h.has(n)||(h.add(n),l.push(n))}for(const r of u)h.delete(r);return O.order.filter(r=>h.has(r))}function E(O,b,u){if(!$)return O;const h=b instanceof Set?b:new Set(b);return new Proxy(O,{get(l,r){return typeof r=="string"&&!h.has(r)&&!Object.hasOwn(l,r)&&B(`undeclared:${u}:${r}`,`computed column "${u}" 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,H){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"compositeKey",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"createRowKey",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"warnMissingKeys",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"groupPathKey",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"splitPathKey",{enumerable:!0,get:function(){return r}});const $=H("packages/core/src/internal/warn.js").warnOnce,B=H("packages/core/src/internal/paths.js").pathGetter,x=H("packages/core/src/internal/predicates.js"),Z=x.isFunction,Y=x.isBlank,U=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],W="";function K(n){if(n===null)return"\0n";if(n===void 0)return"\0u";const o=typeof n;if(o==="string")return n;if(o==="number"||o==="bigint"||o==="boolean")return String(n);if(n instanceof Date)return`\0d${n.getTime()}`;try{return`\0o${JSON.stringify(n)}`}catch{return"\0o?"}}function E(n){if(n.length===1)return K(n[0]);let o="";for(let i=0;i<n.length;i++)i&&(o+=W),o+=K(n[i]);return o}function O(n,o={}){const i=o.warn!==!1;if(Z(n)){const t=n;return{stable:!0,fields:[],disabled:[],key(c,s){try{const a=t(c);return Array.isArray(a)?E(a):K(a)}catch(a){return $("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",a),`#${s??-1}`}},keyEmpty(c){try{const s=t(c);return Array.isArray(s)?s.length===0||s.some(Y):Y(s)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(n)&&n.length>0){const t=n.filter(a=>typeof a=="string"),c=t.map(a=>B(a)),s=c.length;return{stable:!0,fields:t,disabled:[],key(a){const f=new Array(s);for(let w=0;w<s;w++)f[w]=c[w](a);return E(f)},keyEmpty(a){for(let f=0;f<s;f++)if(Y(c[f](a)))return!0;return!1},missingFields(a){const f=[];for(let w=0;w<s;w++)Y(c[w](a))&&f.push(t[w]);return f}}}if(typeof n=="string"&&n.length>0){const t=B(n);return{stable:!0,fields:[n],disabled:[],key(c){return K(t(c))},keyEmpty(c){return Y(t(c))},missingFields(c){return Y(t(c))?[n]:[]}}}return i&&$("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${U.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:U.slice(),key(t,c){if(t===null||typeof t!="object")return`#${c??0}:${String(t)}`;let s=b.get(t);return s===void 0&&(s=`#${u++}`,b.set(t,s)),s}}}const b=new WeakMap;let u=0;function h(n,o){if(!n||n.stable===!1||!Z(n.keyEmpty)||!Array.isArray(o)||o.length===0)return;let i=0,t=null,c;for(let w=0;w<o.length;w++){const g=o[w];n.keyEmpty(g)&&(i++,t===null&&(t=Z(n.missingFields)?n.missingFields(g):[],c=g))}if(i===0)return;const s=n.fields.length?n.fields.join(","):"(function)",a=t&&t.length?t.join(", "):n.fields.length?n.fields.join(", "):"the rowKey function",f=c!==null&&typeof c=="object"?Object.keys(c).join(", ")||"(no fields)":String(c);$(`rowKey.emptyValue:${s}`,`rowKey ${a} is missing on ${i} of ${o.length} rows; the first such row has: ${f}. 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(n){return E(n)}function r(n){return n.split(W)}}),Ue("packages/core/src/columns/lookup.js",function(e,H){"use strict";Object.defineProperty(e,"DEFAULT_SEPARATOR",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"normaliseOption",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return u}}),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 n}});const ne=H("packages/core/src/internal/compare.js"),$=ne.collator,q=ne.defaultCompare,B=H("packages/core/src/internal/predicates.js"),x=B.isFunction,Z=B.isNil,U=H("packages/core/src/internal/warn.js").warnOnce,K=H("packages/core/src/model/rowkey.js").compositeKey,E=", ",O="";function b(o,i,t,c){if(o===null||typeof o!="object")return{id:o,label:o==null?"":String(o)};const s=o[i],a=o[t],f={id:s,label:a==null?String(s??""):String(a)};o.disabled&&(f.disabled=!0),o.variant&&(f.variant=o.variant),o.icon&&(f.icon=o.icon);const w=c?o[c]:o.group;return w!==void 0&&(f.group=w),f}function u(o,i,t=0,c=[],s=[]){for(const a of o||[]){const f=a&&typeof a=="object"?a[i]:null;if(s.push({raw:a,depth:t,path:c}),Array.isArray(f)&&f.length){const w=String(a&&typeof a=="object"?a.label??a.name??a.id??"":a);u(f,i,t+1,[...c,w],s)}}return s}function h(o){return!!o&&typeof o=="object"&&!Array.isArray(o)&&x(o.router&&o.router.subscribe)}class l{#e;#t;#n;#r;#i=[];#s=new Map;#o=new Map;#l=0;#a="idle";#c=null;#u;#f=null;#d=new Map;constructor(i,t={}){this.#e=i||{},this.#t=t.colId||"?",this.#n=t.locale,this.#r=t.onChange||null,this.#u=$(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??E}get allowCustom(){return this.#e.allowCustom===!0}get sortBy(){return this.#e.sortBy||"label"}get spec(){return this.#e}options(){return this.#i}setLocale(i){this.#n=i,this.#u=$(i)}#h(i){const t=this.#e,c=t.valueKey||"id",s=t.labelKey||"label",a=t.childrenKey||"children";this.#i=u(i,a).map(f=>{const w=b(f.raw,c,s,t.groupKey);return f.depth&&(w.depth=f.depth,w.path=f.path),w}),this.#s=new Map,this.#o=new Map,this.#i.forEach((f,w)=>{this.#s.set(f.id,f),this.#o.set(f.id,w)}),this.#a="ready",this.#l+=1}load(){if(this.#c)return this.#c;const i=this.#e.options;if(Array.isArray(i)||i===void 0)return this.#c=Promise.resolve(this.#i),this.#c;if(h(i))return this.#c=this.#p(i),this.#c;if(!x(i))return U(`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 t;try{t=i()}catch(c){return this.#a="error",U(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,c),this.#c=Promise.resolve([]),this.#c}return!t||!x(t.then)?(this.#h(t),this.#c=Promise.resolve(this.#i),this.#r&&this.#r(this),this.#c):(this.#c=t.then(c=>(this.#h(c),this.#r&&this.#r(this),this.#i),c=>(this.#a="error",U(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,c),[])),this.#c)}refresh(){return this.#c=null,Array.isArray(this.#e.options)?(this.#h(this.#e.options),this.#r&&this.#r(this),Promise.resolve(this.#i)):this.load()}#p(i){if(this.#f)return Promise.resolve(this.#i);const t=this.#e,c=t.valueKey||"id",s=t.labelKey||"label",a=t.groupKey,f=x(i.map)?i.map:null,w=k=>b(f?f(k):k,c,s,a).id,g=k=>this.#m(k,f,c,s,a);return i.router.subscribe(i.predicate,g,{rowKey:w}),this.#f=()=>{x(i.router.detach)&&i.router.detach(g)},this.#a="ready",Promise.resolve(this.#i)}#m(i,t,c,s,a){const f=i&&i.add||[],w=i&&i.update||[],g=i&&i.remove||[];if(!(!f.length&&!w.length&&!g.length)){for(const k of f)this.#g(k,t,c,s,a);for(const k of w)this.#g(k,t,c,s,a);for(const k of g){if(!this.#d.has(k))continue;const d=this.#d.get(k);this.#d.delete(k),this.#s.delete(d);const p=this.#i.findIndex(m=>m.id===d);p>=0&&this.#i.splice(p,1)}this.#o=new Map(this.#i.map((k,d)=>[k.id,d])),this.#a="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(i,t,c,s,a){const f=b(t?t(i):i,c,s,a);this.#d.set(K([f.id]),f.id);const w=this.#i.findIndex(g=>g.id===f.id);w>=0?this.#i[w]=f:this.#i.push(f),this.#s.set(f.id,f)}destroy(){this.#f&&(this.#f(),this.#f=null)}search(i,t){const c=this.#e;if(!x(c.search)){const f=String(i||"").toLowerCase();return Promise.resolve(f===""?this.#i:this.#i.filter(w=>w.label.toLowerCase().includes(f)))}const s=c.valueKey||"id",a=c.labelKey||"label";return Promise.resolve(c.search(i,t)).then(f=>(f||[]).map(w=>b(w,s,a,c.groupKey)))}option(i){return this.#s.get(i)}has(i){return this.#s.has(i)}label(i){if(Z(i)||i==="")return"";const t=this.#s.get(i);if(t)return t.label;if(this.#a==="loading"||this.#a==="idle")return"";this.allowCustom||U(`lookup:unknown:${this.#t}`,`column "${this.#t}" holds value ${JSON.stringify(i)} which is not in its lookup options. Showing the raw value; set \`lookup.unknownLabel\` or \`lookup.allowCustom\` to change that.`);const c=this.#e.unknownLabel;return x(c)?String(c(i)??""):typeof c=="string"?c:String(i)}text(i){if(this.multiple){const t=r(i);return t.length===0?"":t.map(c=>this.label(c)).join(this.separator)}return this.label(i)}dictionary(){return this.#i.map(i=>i.id)}sorted(){const i=this.sortBy;if(i==="optionOrder"||i==="count")return this.#i.slice();if(i==="value")return this.#i.slice().sort((c,s)=>q(c.id,s.id));const t=this.#u;return this.#i.slice().sort((c,s)=>t.compare(c.label,s.label))}comparator(){const i=this.sortBy,t=this.multiple,c=this.#u,s=this.#o;if(t&&i==="count")return(f,w)=>r(f).length-r(w).length;const a=t?f=>r(f)[0]:f=>f;return i==="value"?(f,w)=>q(a(f),a(w)):i==="optionOrder"?(f,w)=>{const g=s.has(a(f))?s.get(a(f)):Number.MAX_SAFE_INTEGER,k=s.has(a(w))?s.get(a(w)):Number.MAX_SAFE_INTEGER;return g-k}:(f,w)=>{const g=a(f),k=a(w);return Z(g)?Z(k)?0:1:Z(k)?-1:c.compare(this.label(g),this.label(k))}}groupKey(i){return this.multiple?r(i).map(c=>String(c)).sort().join(O):Z(i)?"":String(i)}countValues(i){return this.multiple?r(i).length:Z(i)?0:1}contains(i,t,c){const s=this.multiple?r(i):Z(i)?[]:[i],a=Array.isArray(t)?t:[t];switch(c){case"containsAll":return a.every(f=>s.includes(f));case"containsNone":return!a.some(f=>s.includes(f));default:return a.some(f=>s.includes(f))}}exportText(i,t="label"){return t==="value"?this.multiple?r(i).join(this.separator):Z(i)?"":String(i):this.text(i)}exportColumns(){const i=this.multiple;return this.#i.map(t=>({id:t.id,label:t.label,has:c=>i?r(c).includes(t.id):c===t.id}))}}function r(o){return Array.isArray(o)?o:Z(o)||o===""?[]:[o]}function n(o,i={}){const t=o.lookup;if(!t)return null;const c=new l(t,{colId:o.id,locale:i.locale,onChange:i.onChange});return!Array.isArray(t.options)&&t.options!==void 0&&c.load(),c}}),Ue("packages/core/src/columns/value.js",function(e,H){"use strict";Object.defineProperty(e,"compileDisplay",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"warnImpureUse",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ValuePipeline",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return l}});const $=H("packages/core/src/internal/paths.js").getPath,q=H("packages/core/src/internal/predicates.js"),B=q.isFunction,x=q.isNil,Y=H("packages/core/src/internal/lru.js").Lru,W=H("packages/core/src/internal/warn.js").warnOnce,E=H("packages/core/src/columns/graph.js").depsProxy,O="\0";function b(i,t={}){const c=t.locale,s=t.grid??null,a=t.context,f=i.value&&i.value.format,w=i.formatter||null,g=i.dataType&&i.dataType.format,k=i.lookup||null,d=(p,m,v)=>({value:p,data:v,row:m,column:i,colId:i.id,grid:s,context:a,locale:c});if(B(f))return(p,m,v)=>{const y=f(d(p,m,v));return y==null?"":String(y)};if(w){if(k){const p=w.kind==="text";return(m,v,y)=>w(p?k.text(m):m,d(m,v,y))}return(p,m,v)=>w(p,d(p,m,v))}return B(g)?(p,m,v)=>{const y=g(d(p,m,v));return y==null?"":String(y)}:k?p=>k.text(p):p=>x(p)?"":typeof p=="string"?p:String(p)}function u(i,t){!i||!i.value||i.value.pure!==!1||W(`impure:${t}:${i.id}`,`column "${i.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${t}. The result is not stable across passes.`)}class h{#e;#t;#n;#r;#i;#s;#o=new Y(4096);constructor(t){this.#e=t.columns instanceof Map?t.columns:new Map((t.columns||[]).map(c=>[c.id,c])),this.#t=t.graph,this.#n=t.grid??null,this.#r=t.context,this.#s=t.stored||null,this.#i=t.rowKey||l}get graph(){return this.#t}setGraph(t){this.#t=t,this.#o.clear()}beginPass(){this.#o.clear()}endPass(){this.#o.clear()}invalidate(t){if(this.#o.size===0)return;const c=t&&t.rows?new Set([...t.rows].map(String)):null,s=t&&t.columns?[...t.columns]:null;if(!c&&!s){this.#o.clear();return}const a=s?this.#l(s):null;for(const f of[...this.#o.keys()]){const w=String(f).split(O);w.length===3&&(c&&!c.has(w[0])||a&&!a.has(w[2])||this.#o.delete(f))}}#l(t){const c=new Set,s=this.#t,a=[...t];for(;a.length;){const f=a.pop();if(!c.has(f)){c.add(f);for(const w of s?s.dependents.get(f)||[]:[])a.push(w)}}return c}value(t,c,s){const a=typeof t=="string"?this.#e.get(t):t;if(!a)return;if(!a.computed)return this.#c(a,c,s);if(a.value.pure!==!1&&this.#s&&s&&s.physical!=null&&this.#s.has(a.id))return this.#s.get(a.id,s.physical);if(a.volatile)return this.compute(a,c,s);if(a.value.pure===!1)return this.compute(a,c,s);const f=`${this.#a(c,s)}${O}${a.id}`;if(this.#o.has(f))return this.#o.get(f);const w=this.compute(a,c,s);return this.#o.set(f,w),w}#a(t,c){return`${this.#i(t,c)}${O}${r(t)}`}#c(t,c,s){if(this.#s&&s&&s.physical!=null&&this.#s.has(t.id))return this.#s.get(t.id,s.physical);if(t.field)return t.read?t.read(c):$(c,t.field)}compute(t,c,s){const a=this.#t,f=a&&a.wholeRow.has(t.id);let w;if(f)w=c??{};else{w={};const k=a&&a.deps.get(t.id)||[];for(const p of k)w[p]=this.value(p,c,s);const d=a&&a.external.get(t.id)||[];for(const p of d)w[p]=$(c,p);w=E(w,[...k,...d],t.id)}const g={data:c,row:s,column:t,grid:this.#n,context:this.#r};return t.value.compute(w,g)}values(t,c){const s={},a=this.#t?this.#t.order:[...this.#e.keys()];for(const f of a)s[f]=this.value(f,t,c);return s}text(t,c,s){const a=typeof t=="string"?this.#e.get(t):t;return a?a.formatValue(this.value(a,c,s),s,c):""}key(t,c,s){const a=typeof t=="string"?this.#e.get(t):t;if(!a)return"";const f=this.value(a,c,s);return B(a.value.key)?String(a.value.key(this.#u(a,f,c,s))):a.lookup?a.lookup.groupKey(f):x(f)?"":String(f)}quickFilterText(t,c,s){const a=typeof t=="string"?this.#e.get(t):t;if(!a)return"";if(B(a.value.quickFilterText)){const f=this.value(a,c,s);return String(a.value.quickFilterText(this.#u(a,f,c,s))??"")}return this.text(a,c,s)}#u(t,c,s,a){return{value:c,data:s,row:a,column:t,colId:t.id,grid:this.#n,context:this.#r}}parse(t,c,s,a){const f=typeof t=="string"?this.#e.get(t):t;if(!f)return c;const w={text:c,value:this.value(f,s,a),data:s,row:a,column:f,grid:this.#n,context:this.#r,locale:this.#n&&B(this.#n.get)?this.#n.get("locale"):void 0,formulaFunctions:this.#n&&B(this.#n.get)?this.#n.get("formulaFunctions"):void 0};return B(f.value.parse)?f.value.parse(w):f.dataType&&B(f.dataType.parse)?f.dataType.parse(w):c}validate(t,c,s,a,f){const w=typeof t=="string"?this.#e.get(t):t;if(!w||!B(w.edit.validate))return!0;const g=w.edit.validate({value:c,oldValue:s,data:a,row:f,column:w,grid:this.#n,context:this.#r});return g===!0||g===void 0?!0:String(g)}apply(t,c,s,a){const f=typeof t=="string"?this.#e.get(t):t;if(!f)return!1;const w=this.value(f,s,a);if(B(f.value.apply)){const g=f.value.apply({value:c,oldValue:w,data:s,row:a,column:f,grid:this.#n,context:this.#r});return this.#f(f,s,a),g!==!1}return f.field?w===c?!1:(f.write(s,c),this.#f(f,s,a),!0):(W(`apply:${f.id}`,`column "${f.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(t,c,s,a){const f=typeof t=="string"?this.#e.get(t):t;if(!f)return{ok:!1,value:void 0,oldValue:void 0,changed:!1,error:"unknown column"};const w=this.value(f,s,a),g=this.parse(f,c,s,a),k=this.validate(f,g,w,s,a);if(k!==!0)return{ok:!1,value:g,oldValue:w,changed:!1,error:k};const d=this.apply(f,g,s,a);return{ok:!0,value:g,oldValue:w,changed:d}}#f(t,c,s){if(this.#o.size===0)return;const a=this.#a(c,s);this.#o.delete(`${a}${O}${t.id}`);for(const f of this.#t?this.#t.dependents.get(t.id)||[]:[])this.#o.delete(`${a}${O}${f}`)}}function l(i,t){return t&&t.key!=null?String(t.key):r(i)}function r(i){if(i&&typeof i=="object"){let t=n.get(i);return t===void 0&&(t=`#${o++}`,n.set(i,t)),t}return String(i)}const n=new WeakMap;let o=0}),Ue("packages/core/src/model/shadow.js",function(e,H){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"HISTORY_TICK_MAX_MS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"HISTORY_TICK_MIN_MS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"DEFAULT_ANOMALY_THRESHOLD",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"SPEC_STATUS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"POSITIONAL_KINDS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SHADOW_LABELS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"specStatusOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"ShadowTracker",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"shadowsIn",{enumerable:!0,get:function(){return s}});const $=H("packages/core/src/internal/warn.js").warnOnce,q=2e5,B=20,x=1e3,Z=50;function Y(a){return Math.min(x,Math.max(Z,Math.floor(a)))}const U=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"]),W=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),K=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),E=.6745,O=3.5,b=Object.freeze({PASS:"PASS",WARN:"WARN",FAIL:"FAIL"}),u=Object.freeze(["rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag"]),h=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,f){if(!f)return null;const w=Number.isFinite(Number(f.lower))?Number(f.lower):null,g=Number.isFinite(Number(f.upper))?Number(f.upper):null;if(w===null&&g===null||!Number.isFinite(a))return null;if(w!==null&&a<w||g!==null&&a>g)return b.FAIL;const k=Number.isFinite(Number(f.warnLower))?Number(f.warnLower):null,d=Number.isFinite(Number(f.warnUpper))?Number(f.warnUpper):null;return k!==null&&a<k||d!==null&&a>d?b.WARN:b.PASS}function r(a,f,w){if(!f||typeof f!="object")return null;if(f.kind!=="time")return f.kind!==void 0&&$(`shadow.history.window.kind:${a}`,`a 'history' shadow's 'window' only accepts {kind: 'time', span}; '${f.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=f.minutes!=null?Number(f.minutes)*6e4:Number(f.span);if(!(g>0))return $(`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(w)||B);return{span:g,bucketMs:Math.max(1,Math.floor(g/k))}}class n{#e;#t=new Map;#n=new Map;#r=new Map;#i=new Map;#s=new Map;#o=new Map;#l=0;#a;#c;#u;#f;#d=new Map;#h=null;#p=null;#m=null;constructor(f){this.#e=f.colId,this.#a=Math.max(2,f.depth||B),this.#c=Math.max(1,f.max||q),this.#u=f.now||(()=>Date.now()),this.#f=r(this.#e,f.historyWindow,this.#a),this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#f}observe(f,w){const g=c(w);if(g===null)return;if(!this.#n.has(f)){this.#p=null,this.#m=null,this.#g(),this.#t.set(f,g),this.#n.set(f,g),this.#r.set(f,0),this.#i.set(f,this.#u()),this.#s.set(f,[g]),this.#f&&this.#d.set(f,[g]),this.#o.set(f,0);return}const k=this.#n.get(f);if(k===g)return;this.#p=null,this.#m=null,this.#n.set(f,g),this.#r.set(f,(this.#r.get(f)||0)+1),this.#i.set(f,this.#u());const d=this.#s.get(f)||[];d.push(g),d.length>this.#a&&d.splice(0,d.length-this.#a),this.#s.set(f,d);const p=Math.sign(g-k),m=this.#o.get(f)||0;this.#o.set(f,Math.sign(m)===p?m+p:p)}#g(){if(this.#n.size<this.#c)return;const f=this.#n.keys().next().value;f!==void 0&&(this.#t.delete(f),this.#n.delete(f),this.#r.delete(f),this.#i.delete(f),this.#s.delete(f),this.#d.delete(f),this.#o.delete(f),this.#l++)}rebase(){for(const[f,w]of this.#n)this.#t.set(f,w);this.#p=null,this.#m=null}reset(){this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#i.clear(),this.#s.clear(),this.#d.clear(),this.#o.clear(),this.#l=0,this.#p=null,this.#m=null,this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}retain(f){const w=f instanceof Set?f:new Set(f);let g=0;for(const k of[...this.#n.keys()])w.has(k)||(this.#t.delete(k),this.#n.delete(k),this.#r.delete(k),this.#i.delete(k),this.#s.delete(k),this.#d.delete(k),this.#o.delete(k),g++);return g&&(this.#p=null,this.#m=null),g}advanceHistoryWindow(f=this.#u()){const w=this.#f;if(!w)return 0;const g=Math.floor(f/w.bucketMs),k=g-this.#h;if(!(k>0))return 0;const d=Math.min(k,this.#a);for(const[p,m]of this.#d){const v=this.#n.get(p);for(let y=0;y<d;y++)m.push(v);m.length>this.#a&&m.splice(0,m.length-this.#a)}return this.#h=g,k}read(f,w,g,k){switch(f){case"updates":return this.#r.has(w)?this.#r.get(w):0;case"updatedAt":{const d=this.#i.get(w);return d===void 0?null:new Date(d)}case"sinceUpdate":{const d=this.#i.get(w);return d===void 0?null:this.#u()-d}case"firstValue":return this.#t.has(w)?this.#t.get(w):null;case"delta":return this.#n.has(w)?this.#n.get(w)-this.#t.get(w):null;case"deltaPercent":{if(!this.#n.has(w))return null;const d=this.#t.get(w);return d?(this.#n.get(w)-d)/Math.abs(d)*100:null}case"rate":{const d=this.#s.get(w),p=this.#i.get(w);if(!d||d.length<2||p===void 0)return null;const m=this.#u()-p,v=d[d.length-1]-d[d.length-2];return m>0?v/m*1e3:v}case"history":return this.#f?this.#d.has(w)?[...this.#d.get(w)]:null:this.#s.has(w)?[...this.#s.get(w)]:null;case"streak":return this.#o.has(w)?this.#o.get(w):0;case"specStatus":return this.#n.has(w)?l(this.#n.get(w),k):null;default:return u.includes(f)?this.#A(f,w,g,k):null}}#b(f){if(f){if(this.#m&&this.#m.only===f)return this.#m.view;const w=this.#y(f);return this.#m={only:f,view:w},w}return this.#p?this.#p:(this.#p=this.#y(null),this.#p)}#y(f){const w=[];for(const[M,_]of this.#n)f&&!f.has(M)||w.push(_);const g=w.sort((M,_)=>M-_);let k=0,d=0,p=0,m=0;for(const M of g){m+=M,k++;const _=M-d;d+=_/k,p+=_*(M-d)}const v=[];for(const[M,_]of this.#t)f&&!f.has(M)||v.push(_);const y=k?o(g):0,T=g.map(M=>Math.abs(M-y)).sort((M,_)=>M-_),A=k?o(T):0;return{sorted:g,baseline:v.sort((M,_)=>M-_),sum:m,mean:k?d:0,sd:k>1?Math.sqrt(p/(k-1)):0,median:y,mad:A}}#A(f,w,g,k){if(!this.#n.has(w)||g&&!g.has(w))return null;const d=this.#n.get(w),p=this.#b(g),m=p.sorted.length;if(!m)return null;switch(f){case"rank":return m-t(p.sorted,d)+1;case"rankAsc":return i(p.sorted,d)+1;case"rankChange":{if(!this.#t.has(w)||!p.baseline.length)return null;const v=p.baseline.length-t(p.baseline,this.#t.get(w))+1,y=m-t(p.sorted,d)+1;return v-y}case"percentile":return t(p.sorted,d)/m*100;case"quartile":{const v=t(p.sorted,d)/m;return Math.min(4,Math.max(1,Math.ceil(v*4)))}case"zScore":return p.sd?(d-p.mean)/p.sd:null;case"anomalyScore":return p.mad?E*(d-p.median)/p.mad:null;case"anomalyFlag":{if(!p.mad)return null;const v=k&&Number.isFinite(Number(k.threshold))?Number(k.threshold):O;return Math.abs(E*(d-p.median)/p.mad)>v}case"shareOfTotal":return p.sum?d/p.sum*100:null;default:return null}}}function o(a){const f=a.length;if(!f)return 0;const w=(f-1)*.5,g=Math.floor(w),k=Math.ceil(w);return g===k?a[g]:a[g]+(w-g)*(a[k]-a[g])}function i(a,f){let w=0,g=a.length;for(;w<g;){const k=w+g>>1;a[k]<f?w=k+1:g=k}return w}function t(a,f){let w=0,g=a.length;for(;w<g;){const k=w+g>>1;a[k]<=f?w=k+1:g=k}return w}function c(a){if(a==null||a==="")return null;if(a instanceof Date){const w=a.getTime();return Number.isFinite(w)?w:null}const f=typeof a=="number"?a:Number(a);return Number.isFinite(f)?f:null}function s(a){const f=[];for(const w of a||[]){const g=w.shadow;if(!g)continue;const k=typeof g=="string"?{kind:g}:g,d=k.kind;U.includes(d)&&(W.includes(d)||K.includes(d)||f.push({colId:w.id||w.field,of:k.of||w.field||w.id,kind:d,depth:k.depth,historyWindow:d==="history"?k.window:void 0}))}return f}}),Ue("packages/core/src/columns/model.js",function(e,H){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return Re}});const ne=H("packages/core/src/internal/merge.js"),$=ne.expand,q=ne.merge,B=ne.toArray,x=H("packages/core/src/internal/warn.js"),Z=x.fail,Y=x.warnOnce,U=H("packages/core/src/internal/paths.js"),W=U.getPath,K=U.pathGetter,E=U.pathSetter,b=H("packages/core/src/internal/text.js").humanise,u=H("packages/core/src/internal/predicates.js"),h=u.isFunction,l=u.isObject,n=H("packages/core/src/internal/uid.js").uid,i=H("packages/core/src/format/index.js").compileFormat,t=H("packages/core/src/columns/datatypes.js"),c=t.comparatorFor,s=t.createTypeRegistry,a=t.storageKind,f=H("packages/core/src/columns/infer.js"),w=f.inferColumnType,g=f.DEFAULT_SAMPLE,k=H("packages/core/src/columns/graph.js"),d=k.buildGraph,p=k.affectedBy,v=H("packages/core/src/columns/lookup.js").createLookup,y=H("packages/core/src/columns/value.js"),T=y.compileDisplay,A=y.ValuePipeline,M=y.warnImpureUse,R=H("packages/core/src/model/shadow.js").FIT_SHADOW_KINDS,I=Object.freeze({geometry:"geometry",list:"list"}),j={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},L={centre:"center"},F=new Set(["start","center","end","left","right"]);function N(we){if(typeof we!="string")return;const re=we.toLowerCase();return L[re]?L[re]:F.has(re)?re:void 0}function S(we){if(typeof we!="string")return;const re=we.toLowerCase();return re==="center"||re==="centre"?"middle":re==="top"||re==="middle"||re==="bottom"?re:void 0}const C=["cell","layout","header"];function D(we){if(!l(we))return{};const re={...we},de=(me,Oe)=>{if(we[me]===void 0)return;const ke=$(we[me],Oe);ke&&C.includes(me)&&!l(we[me])&&delete ke.enabled,re[me]=ke};return de("sort","direction"),de("filter","type"),de("cell","render"),de("edit","editor"),de("layout","width"),de("group","index"),de("pivot","index"),de("header","render"),de("facet","strategy"),re}function G(we,re){const de={...we||{}},me=l(re)&&l(re.layout)&&re.layout.width!==void 0;return de.fit==="content"&&!me&&delete de.width,de}const X=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"]),V=new Set(["collapsible","columns","facet","header","id","marryChildren","openByDefault","showWhen","title"]);function J(we,re,de,me){const Oe=de==="columnGroup"?"column group":"column";for(const ke of Object.keys(we))if(!re.has(ke)){if(ke==="timeZone"&&de==="column"){Y("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}Y(`${de}.unknown:${ke}`,`'${ke}' is not a configuration key this grid recognises, so it had no effect on ${Oe} "${me}". Check the spelling against the reference.`)}}function ee(we){l(we.cell)&&we.cell.autoHeight!==void 0&&Y("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${we.id||we.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function te(we,re){const de=re&&h(we.defaultsFor)?we.defaultsFor(re):null,me={...we.defaults||{},...l(de)?de:{}},Oe={};return me.align&&(Oe.align=me.align,Oe.cell={align:me.align},Oe.header={align:me.align}),me.filter&&(Oe.filter=me.filter==="none"?{enabled:!1,type:"none"}:{enabled:!0,type:me.filter}),me.editor&&(Oe.edit=me.editor==="none"?{editor:null}:{editor:me.editor}),me.total&&(Oe.total=me.total),me.render&&(Oe.cell={...Oe.cell||{},render:me.render}),we.export&&(Oe.export={...we.export}),Oe}function ie(we){if(typeof we=="string")return we.trim()?[we.trim()]:[];if(!Array.isArray(we))return[];const re=[];for(const de of we){if(typeof de!="string")continue;const me=de.trim();me&&!re.includes(me)&&re.push(me)}return re}class oe{#e=new Map;#t=[];#n=[];#r=new WeakMap;#i;#s;#o;#l;#a;#c;#u(re,de,me){const Oe=this.#f(re,de,me);if(typeof Oe!="string"||!this.#d)return Oe??null;const ke=de&&de.totals&&de.totals.implement;if(ke&&h(ke[Oe])){const ce=ke[Oe];return ce.totalName=Oe,ce}const Le=this.#d.totalFn?.(Oe);return h(Le)?Le:Oe}#f(re,de,me){if(typeof re!="string")return re;const Oe=de&&de.totals&&de.totals.supported;if(!Array.isArray(Oe)||Oe.includes(re))return re;const ke=Oe.length?Oe.join(", "):"none";return Z(`column "${me}" is typed ${de.name||"a type"}, for which the total "${re}" is not meaningful. Supported: ${ke}. Aggregating it anyway would produce a confident wrong number.`),re}#d;#h;#p;#m;#g;#b;#y=!1;#A;#w;constructor(re={}){this.#s=D(re.columnDefaults||{}),this.#o=re.columnPresets||{},this.#a=re.locale,this.#l=re.timeZone,this.#c=S(re.verticalAlign),this.#d=re.registry||null,this.#h=re.grid||null,this.#p=re.context,this.#A=re.sampleSize??g,this.#w=re.onChange||null,this.#b=h(re.rowKey)?re.rowKey:void 0,this.#i=s(re.dataTypes,this.#d);const{leaves:de,groups:me}=Re(re.columns||[]);this.#n=me;for(const Oe of de){Oe.facet!==void 0&&this.#r.set(Oe.def,Oe.facet);const ke=this.#O(Oe.def,null);if(ke.groupPath=Oe.path,this.#e.has(ke.id)){Y(`columns.duplicate:${ke.id}`,`two columns resolve to the id '${ke.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}Oe.column=ke,this.#e.set(ke.id,ke),this.#t.push(ke.id)}this.#E(re.stored||null)}#O(re,de){J(re,X,"column",re.id||re.field||"(unnamed)"),ee(re);const me=D(re),Oe=B(re.preset),ke=Oe.map(st=>{const mt=this.#o[st];return mt?D(mt):(Y(`preset:${st}`,`unknown column preset "${st}"; ignoring`),{})}),Le=this.#S(me,ke,de),ce=this.#i.get(Le)||this.#i.get("text");if(!this.#i.has(Le)&&re.type){const st=I[Le];Y(`type:${Le}`,`unknown data type "${Le}"; falling back to "text"`+(st?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${st}'.`:""))}const ge=h(ce.items)?this.#T(me,ke,re.id||re.field||"(unnamed)"):null;let Se=j;Se=q(Se,this.#s),re.type!==!1&&(Se=q(Se,te(ce,ge)));for(const st of ke)Se=q(Se,st);this.#r.has(re)&&(Se=q(Se,D({facet:this.#r.get(re)}))),Se=q(Se,me);const Fe=Se.edit;Fe&&Fe.editor&&Fe.enabled!==!0&&!h(Fe.enabled)&&(re.edit||{}).editor&&Y(`column.editor-not-enabled:${re.id||re.field}`,`column '${re.id||re.field}' names the editor '${Fe.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const be=re.id||re.field||n("col");if(re.shadow&&!h(Se.value&&Se.value.compute)){const st=typeof re.shadow=="string"?{kind:re.shadow}:re.shadow,mt=st.of||re.field||be,kt=R.includes(st.kind),St=kt?st.model||st:null,Pt=kt&&St?[...Array.isArray(St.predictors)?St.predictors:[],St.response].filter(Boolean):null;Se.value={...Se.value||{},deps:Pt&&Pt.length?Pt:st.orderBy&&st.orderBy!==mt?[mt,st.orderBy]:[mt],pure:!1,compute:(Mt,It)=>{const $t=It.grid&&It.grid.statistics;if(!$t)return null;const Ut=It.row&&It.row.key||$t.keyOf(It.data);if(!Ut)return null;if(kt){if(!h($t.fitShadow))return null;const ft=st.model?{...st.model,threshold:st.threshold}:st;return $t.fitShadow(st.kind,Ut,ft)}return $t.shadow(mt,st.kind,Ut,st.scope,st)}}}if(re.running&&!h(Se.value&&Se.value.compute)){const st=typeof re.running=="string"?{kind:re.running}:re.running,mt=st.of||re.field||be;Se.value={...Se.value||{},deps:[mt],pure:!1,compute:(kt,St)=>{const Pt=St.grid&&St.grid.statistics;if(!Pt||!h(Pt.running))return null;const Mt=St.row&&St.row.key||Pt.keyOf(St.data);return Mt?Pt.running(mt,st.kind||"total",Mt):null}},re.sort===void 0&&(Se.sort={...Se.sort||{},enabled:!1})}const Ie=re.field??(h(Se.value&&Se.value.compute)?null:re.id??null),He=h(Se.value&&Se.value.compute),Ge={id:be,field:Ie,shadow:re.shadow||null,running:re.running||null,spec:re.spec||null,validation:re.validation||null,volatile:!!(re.shadow||re.running),title:Se.title??b(Ie||be),type:ce.name,dataType:ce,itemType:ge,nullable:Se.nullable!==!1,align:N(me.cell&&me.cell.align||me.align||Se.cell&&Se.cell.align||Se.align||ce.defaults&&ce.defaults.align)||"start",verticalAlign:S(me.cell&&me.cell.verticalAlign||me.verticalAlign||Se.cell&&Se.cell.verticalAlign||Se.verticalAlign)||this.#c,rowSpan:h(Se.rowSpan)?Se.rowSpan:null,colSpan:h(Se.colSpan)?Se.colSpan:null,value:{pure:!0,...Se.value||{}},cell:{...Se.cell||{}},edit:{...Se.edit||{}},sort:{...Se.sort||{}},filter:{...Se.filter||{}},group:{enabled:!1,index:-1,explode:!1,...Se.group||{}},pivot:{enabled:!1,index:-1,...Se.pivot||{}},total:this.#u(Se.total,ce,re.id||re.field||"(unnamed)"),groupTotal:Se.groupTotal===void 0?null:this.#u(Se.groupTotal,ce,re.id||re.field||"(unnamed)"),grandTotal:Se.grandTotal===void 0?null:this.#u(Se.grandTotal,ce,re.id||re.field||"(unnamed)"),tags:ie(Se.tags),typeOptions:Se.typeOptions??null,...l(Se[Le])?{[Le]:Se[Le]}:{},layout:G(Se.layout,me),header:{...Se.header||{}},contextMenu:Se.contextMenu===void 0?null:Se.contextMenu,facet:{...Se.facet||{}},export:{...Se.export||{}},allowGroup:Se.allowGroup!==!1,allowPivot:Se.allowPivot!==!1,allowTotal:Se.allowTotal!==!1,quickFilter:Se.quickFilter!==!1,def:re,format:Se.format,presets:Oe,inferred:de!=null&&!re.type,computed:He,diff:re.diff===void 0?void 0:!!re.diff,read:Ie?K(Ie):null,write:Ie?E(Ie):null};Ge.cell.align=N(me.cell&&me.cell.align)||Ge.align,Ge.header.align=N(me.header&&me.header.align)||Ge.align;const nt=Se.lookup||null;return Ge.lookup=nt?v({id:be,lookup:nt},{locale:this.#a,onChange:()=>{this.#w&&this.#w("lookup",{colId:be})}}):null,Ge.group.explode&&Ge.lookup&&Ge.lookup.multiple&&Y(`explode:${be}`,`column "${be}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(Ge),Ge}#v(re){re.formatter=i(re.format,re.dataType,this.#a,this.#l,re.id),re.formatValue=T(re,{locale:this.#a,grid:this.#h,context:this.#p}),re.itemCompare=re.itemType?c(re.itemType,this.#a):null,re.compare=h(re.value.compare)?re.value.compare:re.lookup?re.lookup.comparator():h(re.dataType.compareFor)?re.dataType.compareFor(re):c(re.dataType,this.#a),re.excel=re.formatter&&re.formatter.ooxml||re.dataType&&re.dataType.excel||"General",re.storeKind=a(re.dataType,!!(re.lookup&&re.lookup.multiple))}#T(re,de,me){let Oe=l(re.typeOptions)?re.typeOptions:null;for(let ge=de.length-1;!Oe&&ge>=0;ge--)l(de[ge].typeOptions)&&(Oe=de[ge].typeOptions);!Oe&&l(this.#s.typeOptions)&&(Oe=this.#s.typeOptions);const ke=Oe&&Oe.of!==void 0?Oe.of:"text",Le=typeof ke=="string"?this.#i.get(ke):void 0;return Le&&!h(Le.items)&&Le.storage!=="object"?Le:(Y(`type:of:${String(ke)}`,`column "${me}" names "${String(ke)}" as its item type (typeOptions.of), which is not ${Le?"a scalar data type":"a known data type"}; its items are read as text.`),this.#i.get("text"))}#S(re,de,me){if(re.type===!1)return"text";if(re.type)return re.type;for(let Oe=de.length-1;Oe>=0;Oe--)if(de[Oe].type)return de[Oe].type;if(this.#s.type)return this.#s.type;if(re.shadow){const Oe=typeof re.shadow=="string"?re.shadow:re.shadow.kind;if(Oe==="fitInfluence")return"boolean";if(Oe==="fitPredicted"||Oe==="fitResidual"||Oe==="fitStdResidual"||Oe==="fitLeverage"||Oe==="fitCooksD"||Oe==="tsTrend"||Oe==="tsSeasonal"||Oe==="tsResidual"||Oe==="tsCoverage"||Oe==="tsSmoothed"||Oe==="tsSmoothingAlpha"||Oe==="tsSmoothingBeta")return"number"}return me||(re.lookup?"lookup":"text")}#E(re){const de=this.all();this.#m=d(de),this.#g?this.#g.setGraph(this.#m):this.#g=new A({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:re||null,rowKey:this.#b});const me=this.#g;for(const Oe of de)Oe.getValue=(ke,Le)=>me.value(Oe,ke,Le)}all(){return this.#t.map(re=>this.#e.get(re))}visible(){return this.all().filter(re=>!re.layout.hidden)}get(re){return this.#e.get(re)}groups(){const re=de=>{const me=[];for(const Oe of de)Array.isArray(Oe.columns)?me.push({...Oe,columns:re(Oe.columns)}):Oe.column&&me.push(Oe.column);return me};return re(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#i}affectedBy(re){return p(this.#m,re)}value(re,de,me){return this.#g.value(re,de,me)}text(re,de,me){return this.#g.text(re,de,me)}checkImpure(re,de){M(this.#e.get(re),de)}setLocale(re){this.#a=re;for(const de of this.all())de.lookup&&de.lookup.setLocale(re),this.#v(de);this.#w&&this.#w("locale",{locale:re})}infer(re){const de={};if(this.#y||!Array.isArray(re)||re.length===0)return de;this.#y=!0;let me=!1;for(const Oe of this.all()){const ke=Oe.def;if(ke.type!==void 0||!Oe.field||Oe.computed||Oe.lookup||this.#N(Oe))continue;const Le=Oe.read||(Se=>W(Se,Oe.field)),ce=w(Oe.id,re,Le,this.#i,{sampleSize:this.#A});if(ce===Oe.type)continue;de[Oe.id]=ce;const ge=this.#O(ke,ce);ge.groupPath=Oe.groupPath,ge.layout={...ge.layout,...ue(Oe.layout)},this.#e.set(Oe.id,ge),Ce(this.#n,Oe.id,ge),me=!0}return me&&this.#E(null),de}redecorate(re,de,me={}){const Oe=this.#e.get(re);if(!Oe){Y(`redecorate:${re}`,`columns.decorate('${re}', …): no column with id '${re}'.`);return}const ke=Oe.def||{},Le={...l(ke.cell)?ke.cell:{}};Le.decoration=de??void 0,me&&"variant"in me&&(Le.variant=me.variant);const ce={...ke,cell:Le};this.#r.has(ke)&&this.#r.set(ce,this.#r.get(ke));const ge=this.#O(ce,Oe.type);return ge.groupPath=Oe.groupPath,ge.layout={...ge.layout,...ue(Oe.layout)},Oe.lookup&&Oe.lookup!==ge.lookup&&h(Oe.lookup.destroy)&&Oe.lookup.destroy(),this.#e.set(re,ge),Ce(this.#n,re,ge),this.#E(null),this.#w&&this.#w("decorate",{colId:re}),ge}destroy(){for(const re of this.#e.values())re.lookup&&h(re.lookup.destroy)&&re.lookup.destroy()}#N(re){for(const de of re.presets){const me=this.#o[de];if(me&&me.type)return!0}return!!this.#s.type}#P(re){return!re.computed&&h(re.dataType&&re.dataType.toStorage)}storeReader(re){if(re.computed)return de=>this.#g.value(re,de,null);if(this.#P(re)){const de=re.dataType.toStorage,me={timeZone:this.#l,colId:re.id,itemType:re.itemType||null};return Oe=>de(re.read(Oe),me)}return re.read}storeValue(re,de){if(!(!re||re.computed)&&h(re.read))return this.storeReader(re)(de)}storeSchema(){const re=[];for(const de of this.all()){if(de.computed&&de.value.pure===!1||!de.computed&&!de.field)continue;const me=this.storeReader(de);let Oe=null;!de.computed&&!this.#P(de)&&typeof de.field=="string"&&!de.lookup&&(Oe=de.field);const ke={id:de.id,kind:de.storeKind,nullable:de.nullable,read:me};Oe!==null&&(ke.field=Oe),de.lookup&&(ke.dictionary=de.lookup.dictionary()),re.push(ke)}return re}state(){return this.all().map(re=>({id:re.id,width:re.layout.width,flex:re.layout.flex||void 0,hidden:!!re.layout.hidden,headerWrap:re.header?.wrap===!0?!0:void 0,headerOrientation:re.header?.orientation==="vertical"?"vertical":void 0,pin:re.layout.pin??null,sort:re.sort.direction??null,sortIndex:re.sort.direction?re.sort.order??0:null,groupIndex:re.group.enabled?re.group.index??0:null,pivotIndex:re.pivot.enabled?re.pivot.index??0:null,total:typeof re.total=="string"?re.total:null,groupTotal:typeof re.groupTotal=="string"?re.groupTotal:void 0,grandTotal:typeof re.grandTotal=="string"?re.grandTotal:void 0,decoration:re.cell&&re.cell.decoration!=null?ye(re.cell.decoration):void 0,variant:re.cell&&re.cell.variant!=null?ye(re.cell.variant):void 0}))}applyState(re,de={}){const me={applied:[],skipped:[]},Oe=Array.isArray(re)?re:re&&re.columns||[],ke=!Array.isArray(re)&&re&&re.columnOrder||null;for(const ce of Oe){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 Se=ge.cell?ge.cell.decoration:void 0,Fe=ce.decoration??null,be=Object.hasOwn(ce,"variant"),Ie=be&&!he(ge.cell?ge.cell.variant:void 0,ce.variant);(!he(Se,Fe)||Ie)&&(this.redecorate(ce.id,Fe,be?{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 Le=ke||(de&&de.keepOrder?[]:Oe.map(ce=>ce&&ce.id).filter(Boolean));if(Le.length){const ce=Le.filter(Se=>this.#e.has(Se)),ge=this.#t.filter(Se=>!ce.includes(Se));this.#t=[...ce,...ge]}return this.#w&&this.#w("state",me),me}move(re,de){this.#M(re,de)&&(this.#$(),this.#w&&this.#w("move",{id:re,to:de}))}reorder(re){const de={applied:[],skipped:[]},me=[];let Oe=0;for(const ke of Array.isArray(re)?re:[]){const Le=Oe++;this.#M(ke,Le)&&(de.applied.push(ke),me.push({id:ke,to:Le}))}if(!me.length)return de;if(this.#$(),this.#w)for(const ke of me)this.#w("move",ke);return de}#M(re,de){const me=this.#t.indexOf(re);if(me===-1||Math.max(0,Math.min(Number(de)||0,this.#t.length-1))===me)return!1;const ke=this.#e.get(re);if(ke.layout.movable===!1||ke.layout.lockPosition)return Y(`move:${re}`,`column "${re}" is not movable; the move was ignored`),!1;const Le=this.#R(re,de);return Le?(Y(`move.married:${Le}`,`band "${Le}" 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(de,this.#t.length)),0,re),!0)}#R(re,de){if(!this.#n||!this.#n.length)return null;const me=this.#t.filter(ce=>ce!==re),Oe=Math.max(0,Math.min(de,me.length)),ke=(ce,ge)=>{if(Array.isArray(ce.columns)){for(const Fe of ce.columns)ke(Fe,ge);return ge}const Se=ce.column?ce.column.id:ce.id;return Se&&ge.push(Se),ge},Le=ce=>{for(const ge of ce){if(!Array.isArray(ge.columns))continue;if(ge.marryChildren===!0){const Fe=ke(ge,[]),be=Fe.includes(re),Ie=Fe.map(He=>me.indexOf(He)).filter(He=>He>=0);if(Ie.length){const He=Math.min(...Ie),Ge=Math.max(...Ie);if(be?Oe<He||Oe>Ge+1:Oe>He&&Oe<=Ge)return ge.id}}const Se=Le(ge.columns);if(Se)return Se}return null};return Le(this.#n)}#$(){const re=new Map(this.#t.map((Oe,ke)=>[Oe,ke])),de=Oe=>{if(!Array.isArray(Oe.columns)){const Le=Oe.column?Oe.column.id:Oe.id;return re.has(Le)?re.get(Le):1/0}let ke=1/0;for(const Le of Oe.columns)ke=Math.min(ke,de(Le));return ke},me=Oe=>{Oe.sort((ke,Le)=>de(ke)-de(Le));for(const ke of Oe)Array.isArray(ke.columns)&&me(ke.columns)};me(this.#n)}#U(re){const de=me=>{for(let Oe=0;Oe<me.length;Oe++){const ke=me[Oe];if(Array.isArray(ke.columns)){const Le=de(ke.columns);if(Le)return Le}else if(ke.column&&ke.column.id===re)return me.splice(Oe,1)[0]}return null};return de(this.#n)}#K(re){const de=[];for(let me=re.length-1;me>=0;me--){const Oe=re[me];Array.isArray(Oe.columns)&&(de.push(...this.#K(Oe.columns)),Oe.columns.length===0&&(de.push(Oe.id),re.splice(me,1)))}return de}#x(){const re=(de,me,Oe)=>{for(const ke of de)Array.isArray(ke.columns)?re(ke.columns,[...me,ke.id]):ke.column&&(ke.column.groupPath=me)};re(this.#n,[])}#I(re){const de=new Set(re),me=this.#t.filter(ce=>de.has(ce));if(!me.length)return;const Oe=Math.min(...me.map(ce=>this.#t.indexOf(ce))),ke=this.#t.slice(0,Oe).filter(ce=>!de.has(ce)),Le=this.#t.slice(Oe).filter(ce=>!de.has(ce));this.#t=[...ke,...me,...Le]}#Y(re){const de=[],me=Oe=>{if(Array.isArray(Oe.columns))for(const ke of Oe.columns)me(ke);else Oe.column&&de.push(Oe.column.id)};return me(re),de}#F(re){const de=me=>{for(const Oe of me){if(!Array.isArray(Oe.columns))continue;if(Oe.id===re)return{node:Oe,parent:me};const ke=de(Oe.columns);if(ke)return ke}return null};return de(this.#n)}groupColumns(re,de={}){const me=B(re).filter(ge=>this.#e.has(ge));if(!me.length)return Y("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 Y(`columns.group.locked:${ge}`,`column "${ge}" is position-locked and cannot be grouped.`),null;const Oe=de.groupId?this.#F(de.groupId):null;if(de.groupId&&!Oe)return Y(`columns.group.unknown:${de.groupId}`,`no band "${de.groupId}" to add to; nothing was grouped.`),null;let ke=null;if(!Oe&&de.id!=null&&(ke=String(de.id),this.#F(ke)||this.#e.has(ke)))return Y(`columns.group.idtaken:${ke}`,`band id "${ke}" is already in use; nothing was grouped.`),null;const Le=me.map(ge=>this.#U(ge)).filter(Boolean);if(!Le.length)return null;let ce;if(Oe)Oe.node.columns.push(...Le),ce=Oe.node.id;else{const ge={id:ke||n("grp"),title:de.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:Le},Se=Number.isInteger(de.at)?Math.max(0,Math.min(de.at,this.#n.length)):this.#n.length;this.#n.splice(Se,0,ge),ce=ge.id}return this.#K(this.#n),this.#I(me),this.#x(),this.#$(),this.#w&&this.#w("columngroup",{action:"formed",groupId:ce,ids:me}),ce}ungroupColumn(re){const de=this.#e.get(re);if(!de){Y(`columns.ungroup.unknown:${re}`,`no column "${re}" to ungroup.`);return}const me=de.groupPath||[];if(!me.length)return;const Oe=me[me.length-1],ke=this.#F(Oe);if(!ke)return;const Le=this.#U(re);if(!Le)return;const ce=ke.parent.indexOf(ke.node);ke.parent.splice(ce+1,0,Le);const ge=this.#K(this.#n),Se=this.#Y(ke.node);if(Se.length){this.#I(Se);const Fe=Math.max(...Se.map(Ie=>this.#t.indexOf(Ie))),be=this.#t.filter(Ie=>Ie!==re);be.splice(Fe+1,0,re),this.#t=be}this.#x(),this.#$(),this.#w&&this.#w("columngroup",{action:"removed",id:re,dissolved:ge})}renameGroup(re,de){const me=this.#F(re);if(!me){Y(`columns.group.rename:${re}`,`no band "${re}" to rename.`);return}me.node.title=String(de??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:re,title:me.node.title})}dissolveGroup(re){const de=this.#F(re);if(!de){Y(`columns.group.dissolve:${re}`,`no band "${re}" to dissolve.`);return}const me=de.parent.indexOf(de.node);de.parent.splice(me,1,...de.node.columns),this.#x(),this.#$(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:re})}moveGroup(re,de){const me=this.#F(re);if(!me){Y(`columns.group.move:${re}`,`no band "${re}" to move.`);return}const Oe=me.parent,ke=Oe.indexOf(me.node);ke!==-1&&(Oe.splice(ke,1),Oe.splice(Math.max(0,Math.min(de,Oe.length)),0,me.node),this.#G(),this.#x(),this.#w&&this.#w("columngroup",{action:"moved",groupId:re,to:de}))}#G(){const re=[],de=Oe=>{for(const ke of Oe)Array.isArray(ke.columns)?de(ke.columns):ke.column&&re.push(ke.column.id)};de(this.#n);const me=new Set(re);this.#t=[...re,...this.#t.filter(Oe=>!me.has(Oe))]}groupTree(){const re=me=>me.map(Oe=>Array.isArray(Oe.columns)?{id:Oe.id,title:Oe.title||"",collapsible:!!Oe.collapsible,openByDefault:Oe.openByDefault!==!1,columns:re(Oe.columns)}:Oe.column?Oe.column.id:null).filter(Oe=>Oe!==null),de=re(this.#n);return de.some(me=>me&&typeof me=="object")?de:[]}applyGroupTree(re){if(!Array.isArray(re))return;const de=new Set,me=ke=>{const Le=[];for(const ce of ke)if(ce&&typeof ce=="object"&&Array.isArray(ce.columns)){const ge=me(ce.columns);if(!ge.length)continue;Le.push({id:ce.id||n("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&&!de.has(ce)&&(de.add(ce),Le.push({column:ge,path:[]}))}return Le},Oe=me(re);for(const ke of this.#t){if(de.has(ke))continue;const Le=this.#e.get(ke);Le&&Oe.push({column:Le,path:[]})}this.#n=Oe,this.#x(),this.#$(),this.#w&&this.#w("columngroup",{action:"applied"})}show(re){this.#H(re,!1)}hide(re){this.#H(re,!0)}#H(re,de){const me=[];for(const Oe of B(re)){const ke=this.#e.get(Oe);if(ke){if(de&&ke.layout.lockVisible){Y(`lockVisible:${Oe}`,`column "${Oe}" is \`layout.lockVisible\` and cannot be hidden`);continue}ke.layout.hidden!==de&&(ke.layout.hidden=de,me.push(Oe))}}me.length&&this.#w&&this.#w("visible",{ids:me,hidden:de})}pin(re,de){const me=this.#e.get(re);me&&(me.layout.pin=de??null,this.#w&&this.#w("pin",{id:re,side:me.layout.pin}))}pinMany(re){const de={};for(const[Oe,ke]of re){const Le=this.#e.get(Oe);Le&&(Le.layout.pin=ke??null,de[Oe]=Le.layout.pin)}const me=Object.keys(de);me.length&&this.#w&&this.#w("pin",{ids:me,pins:de})}#z(re,de){const me=re.layout.min??0,Oe=re.layout.max;let ke=Math.max(me,de);return Oe!=null&&(ke=Math.min(Oe,ke)),re.layout.width=ke,re.layout.flex=0,ke}resize(re,de){const me=this.#e.get(re);if(!me)return;if(me.layout.resizable===!1){Y(`resize:${re}`,`column "${re}" is not resizable; the resize was ignored`);return}const Oe=this.#z(me,de);this.#w&&this.#w("resize",{id:re,width:Oe})}resizeMany(re){const de={};for(const[Oe,ke]of re){const Le=this.#e.get(Oe);if(Le){if(Le.layout.resizable===!1){Y(`resize:${Oe}`,`column "${Oe}" is not resizable; the resize was ignored`);continue}de[Oe]=this.#z(Le,ke)}}const me=Object.keys(de);me.length&&this.#w&&this.#w("resize",{ids:me,widths:de})}}function ue(we){const re={};return we.width!=null&&(re.width=we.width),we.hidden!=null&&(re.hidden=we.hidden),we.pin!==void 0&&(re.pin=we.pin),re}function ye(we){if(we===null||typeof we!="object")return we;try{return structuredClone(we)}catch{}try{return JSON.parse(JSON.stringify(we))}catch{return we}}function he(we,re){const de=we??null,me=re??null;if(de===me)return!0;if(de===null||me===null)return!1;if(typeof de!="object"||typeof me!="object")return de===me;try{return JSON.stringify(de)===JSON.stringify(me)}catch{return!1}}function Re(we){const re=[],de=(Oe,ke,Le)=>{const ce=[];for(const ge of Oe){if(!l(ge)){Z("a column definition must be an object");continue}if(Array.isArray(ge.columns)){J(ge,V,"columnGroup",ge.title||ge.id||"(unnamed)");const Se={id:ge.id||n("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:[]};Se.columns=de(ge.columns,[...ke,Se.id],ge.facet!==void 0?ge.facet:Le),ce.push(Se)}else{const Se={def:ge,path:ke,facet:Le};re.push(Se),ce.push(Se)}}return ce},me=de(we,[],void 0);return{leaves:re,groups:me}}function Ce(we,re,de){for(const me of we){if(me.columns){if(Ce(me.columns,re,de))return!0;continue}if(me.column&&me.column.id===re)return me.column=de,!0}return!1}}),Ue("packages/core/src/columns/autogroup.js",function(e,H){"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 Y}});const $=H("packages/core/src/internal/warn.js").warnOnce,q="__lattice_group",B=240,x=.5;function Z(U){const{columns:W,groupBy:K}=U,E=K.map(u=>W.get(u)).filter(Boolean),O=E.length?E.map(u=>u.title||u.id).join(" > "):"Group",b=U.config&&U.config.autoGroupColumnWidth||B;return{id:q,field:null,title:O,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group"},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!0},groupedIds:K.slice(),group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:b,min:120,pin:U.config&&U.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(u,h){return h&&h.group?h.groupValue:null},formatValue(u,h){if(!h||!h.group)return"";if(h.grandTotal)return U.config&&U.config.grandTotalLabel||"Total";const l=E[Math.min(h.level||0,E.length-1)];return l&&typeof l.formatValue=="function"?l.formatValue(u,h):u==null?"":String(u)}}}function Y(U,W,K){!U.length||K<100||W<K*x||$(`grouping.cardinality:${U.join(",")}`,`grouping by ${U.join(", ")} produced ${W} groups for ${K} rows: nearly one group per row. Grouping a continuous value such as a percentage or a timestamp rarely reads usefully; consider a computed banding column.`)}}),Ue("packages/core/src/columns/selectcolumn.js",function(e,H){"use strict";Object.defineProperty(e,"SELECT_COLUMN_ID",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"createSelectionColumn",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return B}});const ne="__lattice_select",$=44;function q(x){const Z=x.selection||{},Y=x.config&&x.config.selectionColumnWidth||$;return{id:ne,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:Y,min:Y,max:Y,pin:x.config&&x.config.selectionColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,headerCheckbox:Z.headerCheckbox===!0,def:{},getValue(U,W){return W?W.selected:!1},formatValue(){return""}}}const B=q}),Ue("packages/core/src/columns/rownumbercolumn.js",function(e,H){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createRowNumberColumn",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return W}});const $=H("packages/core/src/internal/predicates.js").isFunction,q="__lattice_rownumber",B=40,x=9,Z=22;function Y(K){const E=String(Math.max(1,Math.trunc(Math.abs(K))||1)).length;return Math.max(B,E*x+Z)}function U(K){const E=K.rowNumbers,O=E&&typeof E=="object"?E:{},b=Number.isFinite(O.start)?O.start:1,u=Number.isFinite(O.width)?O.width:Y((K.maxNumber||0)+b),h=$(K.rank)?K.rank:()=>null;return{id:q,field:null,title:typeof O.title=="string"?O.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:u,min:u,max:u,pin:"start",hidden:!1,resizable:O.width==null,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(l,r){const n=h(r);return n==null?null:n-1+b},formatValue(l){return l==null?"":String(l)}}}const W=U}),Ue("packages/core/src/model/detail.js",function(e,H){"use strict";Object.defineProperty(e,"DEFAULT_DETAIL_HEIGHT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DEFAULT_CACHE_LIMIT",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"DetailModel",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return W}});const $=H("packages/core/src/internal/predicates.js").isFunction,B=H("packages/core/src/internal/warn.js").warnOnce,x=240,Z=10;function Y(K){if(!K)return null;const E=K===!0?{}:K;return E.enabled===!1?null:!$(E.rows)&&!E.render?(B("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:E.render||null,config:E.config||null,rows:$(E.rows)?E.rows:null,height:E.height??x,cacheLimit:Number.isFinite(E.cacheLimit)?Math.max(0,E.cacheLimit):Z,isMaster:$(E.isMaster)?E.isMaster:null,target:E.target||null,onCreate:$(E.onCreate)?E.onCreate:null,path:typeof E.path=="string"?E.path:null}}class U{#e;#t=new Set;#n;#r=0;constructor(E){this.#e=E.config,this.#n=$(E.onChange)?E.onChange:()=>{}}get config(){return this.#e}get inline(){return!this.#e.target}isMaster(E){if(!E||E.group||E.detail)return!1;const O=this.#e.isMaster;return O?!!O(E.data,E):!0}isOpen(E){return this.#t.has(E)}keys(){return[...this.#t]}activeKey(){for(const E of this.#t)return E;return null}heightOf(E){const O=this.#e.height;return $(O)?Number(O(E))||x:O==="auto"?x:Number(O)||x}open(E){return this.#t.has(E)?!1:(this.inline||this.#t.clear(),this.#t.add(E),this.#i(),!0)}close(E){return this.#t.delete(E)?(this.#i(),!0):!1}toggle(E){return this.#t.has(E)?(this.close(E),!1):(this.open(E),!0)}closeAll(){this.#t.size&&(this.#t.clear(),this.#i())}prune(E){if(!this.#t.size||!$(E))return;let O=!1;for(const b of[...this.#t])E(b)||(this.#t.delete(b),O=!0);O&&this.#i()}signature(){return`${this.#r}`}set(E){this.#t.clear();const O=Array.isArray(E)?E:[];for(const b of this.inline?O:O.slice(0,1))this.#t.add(b);this.#i()}#i(){this.#r++,this.#n()}}const W=U}),Ue("packages/core/src/compute/special.js",function(e,H){"use strict";Object.defineProperty(e,"logGamma",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"incompleteBeta",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"normalQuantile",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"normalCdf",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"studentT",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"chiSquareUpperTail",{enumerable:!0,get:function(){return l}});const ne=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),$=3e-12,q=1e-300;function B(r){if(r<.5)return Math.log(Math.PI/Math.sin(Math.PI*r))-B(1-r);const n=r-1;let o=.9999999999998099;const i=n+7.5;for(let t=0;t<ne.length;t++)o+=ne[t]/(n+t+1);return .5*Math.log(2*Math.PI)+(n+.5)*Math.log(i)-i+Math.log(o)}function x(r,n,o){const i=r+n,t=r+1,c=r-1;let s=1,a=1-i*o/t;Math.abs(a)<q&&(a=q),a=1/a;let f=a;for(let w=1;w<=300;w++){const g=2*w;let k=w*(n-w)*o/((c+g)*(r+g));a=1+k*a,Math.abs(a)<q&&(a=q),s=1+k/s,Math.abs(s)<q&&(s=q),a=1/a,f*=a*s,k=-(r+w)*(i+w)*o/((r+g)*(t+g)),a=1+k*a,Math.abs(a)<q&&(a=q),s=1+k/s,Math.abs(s)<q&&(s=q),a=1/a;const d=a*s;if(f*=d,Math.abs(d-1)<$)break}return f}function Z(r,n,o){if(!(r>0)||!(n>0)||!Number.isFinite(o))return Number.NaN;if(o<=0)return 0;if(o>=1)return 1;const i=Math.exp(B(r+n)-B(r)-B(n)+r*Math.log(o)+n*Math.log(1-o));return o<(r+1)/(r+n+2)?i*x(r,n,o)/r:1-i*x(n,r,1-o)/n}function Y(r){if(!(r>0)||!(r<1))return r===0?-1/0:r===1?1/0:Number.NaN;const n=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],o=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],i=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],t=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],c=.02425;let s,a,f;r<c?(s=Math.sqrt(-2*Math.log(r)),f=(((((i[0]*s+i[1])*s+i[2])*s+i[3])*s+i[4])*s+i[5])/((((t[0]*s+t[1])*s+t[2])*s+t[3])*s+1)):r<=1-c?(s=r-.5,a=s*s,f=(((((n[0]*a+n[1])*a+n[2])*a+n[3])*a+n[4])*a+n[5])*s/(((((o[0]*a+o[1])*a+o[2])*a+o[3])*a+o[4])*a+1)):(s=Math.sqrt(-2*Math.log(1-r)),f=-(((((i[0]*s+i[1])*s+i[2])*s+i[3])*s+i[4])*s+i[5])/((((t[0]*s+t[1])*s+t[2])*s+t[3])*s+1));const g=(.5*U(-f/Math.SQRT2)-r)*Math.sqrt(2*Math.PI)*Math.exp(f*f/2);return f-g/(1+f*g/2)}function U(r){const n=Math.abs(r),o=2/(2+n),i=4*o-2,t=[-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 c=0,s=0,a;for(let w=t.length-1;w>0;w--)a=s,s=i*s-c+t[w],c=a;const f=o*Math.exp(-n*n+.5*(t[0]+i*s)-c);return r>=0?f:2-f}function W(r){return .5*U(-r/Math.SQRT2)}function K(r,n){if(!(n>0)||!Number.isFinite(r))return Number.NaN;const o=.5*Z(n/2,.5,n/(n+r*r));return r>0?1-o:o}function E(r,n){if(!(r>0)||!(r<1)||!(n>0))return Number.NaN;if(n>1e7)return Y(r);let o=-1e4,i=1e4,t=Y(r);const c=B(n/2)+B(.5)-B((n+1)/2);for(let s=0;s<60;s++){const a=K(t,n);a<r?o=t:i=t;const f=Math.exp(-((n+1)/2)*Math.log(1+t*t/n)-c)/Math.sqrt(n),w=f>0?(a-r)/f:0;if(Math.abs(w)<1e-12)break;const g=t-w;if(t=g>o&&g<i&&Number.isFinite(g)?g:(o+i)/2,i-o<1e-12)break}return t}function O(r,n){let o=r,i=1/r,t=i;for(let c=0;c<300&&(o+=1,t*=n/o,i+=t,!(Math.abs(t)<Math.abs(i)*$));c++);return i*Math.exp(-n+r*Math.log(n)-B(r))}function b(r,n){let o=n+1-r,i=1/q,t=1/o,c=t;for(let s=1;s<=300;s++){const a=-s*(s-r);o+=2,t=a*t+o,Math.abs(t)<q&&(t=q),i=o+a/i,Math.abs(i)<q&&(i=q),t=1/t;const f=t*i;if(c*=f,Math.abs(f-1)<$)break}return Math.exp(-n+r*Math.log(n)-B(r))*c}function u(r,n){return!(r>0)||!(n>=0)||!Number.isFinite(n)?Number.NaN:n===0?0:n<r+1?O(r,n):1-b(r,n)}function h(r,n){return n>0?u(n/2,r/2):Number.NaN}function l(r,n){const o=h(r,n);return Number.isNaN(o)?Number.NaN:Math.min(1,Math.max(0,1-o))}}),Ue("packages/core/src/compute/linalg.js",function(e,H){"use strict";Object.defineProperty(e,"cholesky",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"choleskySolve",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"choleskyInverse",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"normalEquations",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return Z}});function ne(Y){const U=Y.length,W=Array.from({length:U},()=>new Array(U).fill(0));for(let K=0;K<U;K++)for(let E=0;E<=K;E++){let O=Y[K][E];for(let b=0;b<E;b++)O-=W[K][b]*W[E][b];if(K===E){if(!(O>0))return null;W[K][E]=Math.sqrt(O)}else W[K][E]=O/W[E][E]}return W}function $(Y,U){const W=Y.length,K=new Array(W).fill(0);for(let O=0;O<W;O++){let b=U[O];for(let u=0;u<O;u++)b-=Y[O][u]*K[u];K[O]=b/Y[O][O]}const E=new Array(W).fill(0);for(let O=W-1;O>=0;O--){let b=K[O];for(let u=O+1;u<W;u++)b-=Y[u][O]*E[u];E[O]=b/Y[O][O]}return E}function q(Y){const U=Y.length,W=Array.from({length:U},()=>new Array(U).fill(0));for(let K=0;K<U;K++){const E=new Array(U).fill(0);E[K]=1;const O=$(Y,E);for(let b=0;b<U;b++)W[b][K]=O[b]}return W}function B(Y,U,W){const K=Y.length,E=K?Y[0].length:0,O=Array.from({length:E},()=>new Array(E).fill(0)),b=new Array(E).fill(0);for(let u=0;u<K;u++){const h=W?W[u]:1,l=Y[u];for(let r=0;r<E;r++){const n=h*l[r];b[r]+=n*U[u];for(let o=r;o<E;o++)O[r][o]+=n*l[o]}}for(let u=0;u<E;u++)for(let h=0;h<u;h++)O[u][h]=O[h][u];return{xtwx:O,xtwy:b}}function x(Y,U){return Y.map(W=>W.reduce((K,E,O)=>K+E*U[O],0))}function Z(Y,U){let W=0;for(let K=0;K<Y.length;K++){let E=0;for(let O=0;O<Y.length;O++)E+=U[K][O]*Y[O];W+=Y[K]*E}return W}}),Ue("packages/core/src/compute/sketch.js",function(e,H){"use strict";Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return O}});class ne{#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(u){if(!Number.isFinite(u))return;this.#e++;const h=u-this.#t;this.#t+=h/this.#e,this.#n+=h*(u-this.#t)}merge(u){if(u.#e===0)return;if(this.#e===0){this.#e=u.#e,this.#t=u.#t,this.#n=u.#n;return}const h=this.#e+u.#e,l=u.#t-this.#t;this.#t+=l*(u.#e/h),this.#n+=u.#n+l*l*(this.#e*u.#e/h),this.#e=h}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 u=this.variance();return u===null?null:Math.sqrt(u)}stddevP(){const u=this.varianceP();return u===null?null:Math.sqrt(u)}}class ${#e=[];#t=0;#n;#r;constructor(u,h=Math.random){if(!(u>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(u),this.#r=h}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(u){if(!Number.isFinite(u))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(u);return}const h=Math.floor(this.#r()*this.#t);h<this.#n&&(this.#e[h]=u)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let u=0;for(const h of this.#e)u+=h;return u/this.#e.length}quantile(u){const h=this.#e.length;if(!h)return null;const l=this.#e.slice().sort((i,t)=>i-t);if(h===1)return l[0];const r=(h-1)*Math.min(1,Math.max(0,u)),n=Math.floor(r),o=Math.ceil(r);return n===o?l[n]:l[n]+(r-n)*(l[o]-l[n])}}function q(b){return b^=b>>>16,b=Math.imul(b,2246822507),b^=b>>>13,b=Math.imul(b,3266489909),b^=b>>>15,b>>>0}function B(b){if(typeof b=="number"){const l=new DataView(new ArrayBuffer(8));return l.setFloat64(0,b===0?0:b),q(l.getUint32(0)^l.getUint32(4))}const u=typeof b=="string"?b:String(b);let h=2166136261;for(let l=0;l<u.length;l++)h^=u.charCodeAt(l),h=Math.imul(h,16777619);return q(h)}class x{#e;#t;#n;constructor(u=14){const h=Math.floor(u);if(h<4||h>16)throw new RangeError("HLL precision must be 4..16");this.#e=h,this.#t=1<<h,this.#n=new Uint8Array(this.#t)}static errorBoundFor(u=14){const h=1<<Math.floor(u),l=1.04/Math.sqrt(h);return Object.freeze({kind:"probabilistic",metric:"relative",value:l,statement:`distinct count within ~${(l*100).toFixed(2)}% relative standard error (m=${h} buckets)`})}errorBound(){return x.errorBoundFor(this.#e)}add(u){const h=B(u),l=h&this.#t-1,r=h>>>this.#e|1<<32-this.#e;let n=1,o=r;for(;(o&1)===0;)n++,o>>>=1;n>this.#n[l]&&(this.#n[l]=n)}count(){const u=this.#t,h=32-this.#e,l=new Float64Array(h+2);for(let o=0;o<u;o++)l[this.#n[o]]++;let r=u*U(1-l[h+1]/u);for(let o=h;o>=1;o--)r=.5*(r+l[o]);r+=u*Y(l[0]/u);const n=Z*u*u/r;return Math.round(n)}}const Z=.5/Math.log(2);function Y(b){if(b===1)return 1/0;let u=1,h=b,l;do b*=b,l=h,h+=b*u,u+=u;while(h!==l);return h}function U(b){if(b===0||b===1)return 0;let u=1,h=1-b,l;do b=Math.sqrt(b),l=h,u*=.5,h-=(1-b)**2*u;while(h!==l);return h/3}class W{#e=new Map;#t;#n=0;constructor(u){if(!(u>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(u)}errorBoundFor(u){const h=u/this.#t;return Object.freeze({kind:"deterministic",metric:"absolute",value:h,statement:`each count overestimates the truth by at most N/m = ${h.toFixed(2)} (N=${u}, m=${this.#t})`})}get seen(){return this.#n}add(u){this.#n++;const h=this.#e.get(u);if(h){h.count++;return}if(this.#e.size<this.#t){this.#e.set(u,{count:1,error:0});return}let l,r=1/0;for(const[n,o]of this.#e)o.count<r&&(r=o.count,l=n);this.#e.delete(l),this.#e.set(u,{count:r+1,error:r})}top(u=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(u)))}}class K{#e;#t=[[]];#n=0;#r;#i;constructor(u=200,h=Math.random){this.#e=Math.max(8,Math.floor(u)),this.#r=h,this.#i=2/3}static errorBoundFor(u=200){const h=1/Math.max(8,Math.floor(u));return Object.freeze({kind:"probabilistic",metric:"rank",value:h,statement:`queried quantile's true rank within ~${(h*100).toFixed(2)}% of N of the requested rank (k=${u})`})}errorBound(){return K.errorBoundFor(this.#e)}get count(){return this.#n}#s(u){const l=this.#t.length-1-u,r=Math.ceil(this.#e*this.#i**l);return Math.max(2,r)}add(u){Number.isFinite(u)&&(this.#n++,this.#t[0].push(u),this.#t[0].length>=this.#s(0)&&this.#o(0))}#o(u){const h=this.#t[u];h.sort((n,o)=>n-o),u+1>=this.#t.length&&this.#t.push([]);const l=this.#t[u+1],r=this.#r()<.5?0:1;for(let n=r;n<h.length;n+=2)l.push(h[n]);this.#t[u]=[];for(let n=0;n<this.#t.length;n++)if(this.#t[n].length>=this.#s(n)){this.#o(n);return}}#l(){const u=[];for(let h=0;h<this.#t.length;h++){const l=1<<h;for(const r of this.#t[h])u.push({v:r,w:l})}return u}quantile(u){const h=this.#l();if(!h.length)return null;h.sort((o,i)=>o.v-i.v);let l=0;for(const o of h)l+=o.w;const r=Math.min(1,Math.max(0,u))*l;let n=0;for(const o of h)if(n+=o.w,n>=r)return o.v;return h[h.length-1].v}rank(u){let h=0;for(let l=0;l<this.#t.length;l++){const r=1<<l;for(const n of this.#t[l])n<=u&&(h+=r)}return h}}const E=Object.freeze({distinct:x.errorBoundFor(14),median:K.errorBoundFor(200),p25:K.errorBoundFor(200),p75:K.errorBoundFor(200),p90:K.errorBoundFor(200),p95:K.errorBoundFor(200),p99:K.errorBoundFor(200),iqr:K.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"})}),O={Welford:ne,Reservoir:$,HyperLogLog:x,SpaceSaving:W,KLL:K,hash32:B,SKETCH_BOUNDS:E}}),Ue("packages/core/src/compute/statistics.js",function(e,H){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"numbers",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"frequencies",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"herfindahl",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"entropy",{enumerable:!0,get:function(){return w}}),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 m}}),Object.defineProperty(e,"quantile",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"STAT_FNS",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"modifiedZOutliers",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"jarqueBera",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"weightedQuantile",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"covariance",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"autocorrelations",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"spearman",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"kendall",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"seriesStats",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"D2_N2",{enumerable:!0,get:function(){return Le}}),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 Se}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return be}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return He}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(e,"countOutside",{enumerable:!0,get:function(){return st}}),Object.defineProperty(e,"histogram",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(e,"DEFAULT_CONFIDENCE",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(e,"meanInterval",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(e,"proportionInterval",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(e,"slopeInterval",{enumerable:!0,get:function(){return It}}),Object.defineProperty(e,"capabilityInterval",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(e,"standardizedMeanDifference",{enumerable:!0,get:function(){return Ut}}),Object.defineProperty(e,"normalTotalVariation",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(e,"frequencyMap",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(e,"categoricalDistance",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(e,"SUBSET_RELIABILITY_FLOOR",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(e,"compareColumn",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"isNumericColumn",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(e,"populationRead",{enumerable:!0,get:function(){return Be}});const ne=H("packages/core/src/compute/handle.js"),$=ne.presenceReader,q=ne.valueReader,B=H("packages/core/src/compute/special.js"),x=B.studentTQuantile,Z=B.studentT,Y=B.normalQuantile,U=B.normalCdf,W=B.chiSquareUpperTail,K=H("packages/core/src/compute/linalg.js"),E=K.cholesky,O=K.choleskySolve,b=K.choleskyInverse,u=K.normalEquations,h=K.quadForm,r=H("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,n=5e3,o=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"}),i=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 t(pe){const Ae=pe==="sum"||pe==="avg"||pe==="countValues"||pe==="min"||pe==="max"?"maintained":Object.prototype.hasOwnProperty.call(o,pe)?o[pe]:null,ve=Object.prototype.hasOwnProperty.call(i,pe)?i[pe]:null;return{stat:pe,exact:Ae,approximate:ve}}function c(pe,Ae){const ve=Ae.length,Pe=new Float64Array(ve);let je=0;if(pe&&(pe.kind==="float64"||pe.kind==="int32")){const ze=pe.values,_e=$(pe);for(let Qe=0;Qe<ve;Qe++){const Te=Ae[Qe];if(_e&&_e(Te)!==1)continue;const Ke=ze[Te];Number.isNaN(Ke)||(Pe[je++]=Ke)}return Pe.subarray(0,je)}const xe=q(pe);for(let ze=0;ze<ve;ze++){const _e=xe(Ae[ze]);if(_e==null||_e==="")continue;const Qe=typeof _e=="number"?_e:Number(_e);Number.isFinite(Qe)&&(Pe[je++]=Qe)}return Pe.subarray(0,je)}function s(pe,Ae){const ve=new Map,Pe=q(pe);let je=0;for(let xe=0;xe<Ae.length;xe++){const ze=Pe(Ae[xe]);if(ze==null||ze===""||typeof ze=="number"&&Number.isNaN(ze))continue;const _e=typeof ze=="object"?String(ze):ze;ve.set(_e,(ve.get(_e)||0)+1),je++}const Ne=[...ve.values()].sort((xe,ze)=>ze-xe);return{counts:Ne,total:je,distinct:Ne.length}}function a(pe){return pe.total>0?pe.counts.map(Ae=>Ae/pe.total):[]}function f(pe,Ae){const ve=s(pe,Ae);if(!ve.total)return null;let Pe=0;for(const je of a(ve))Pe+=je*je;return Pe}function w(pe,Ae){const ve=s(pe,Ae);if(!ve.total)return null;let Pe=0;for(const je of a(ve))je>0&&(Pe-=je*Math.log2(je));return Pe}function g(pe,Ae){const ve=s(pe,Ae);if(!ve.total||ve.distinct<2)return ve.total?1:null;let Pe=0;for(const je of a(ve))je>0&&(Pe-=je*Math.log2(je));return Pe/Math.log2(ve.distinct)}function k(pe,Ae,ve=3){const Pe=s(pe,Ae);if(!Pe.total)return null;const je=Math.max(1,Math.floor(ve));let Ne=0;for(let xe=0;xe<Math.min(je,Pe.counts.length);xe++)Ne+=Pe.counts[xe];return Ne/Pe.total}function d(pe,Ae){const ve=c(pe,Ae),Pe=ve.length;if(!Pe)return null;const je=ve.slice().sort();if(je[0]<0)return null;let Ne=0,xe=0;for(let ze=0;ze<Pe;ze++)Ne+=je[ze],xe+=(ze+1)*je[ze];return Ne===0?0:2*xe/(Pe*Ne)-(Pe+1)/Pe}function p(pe){let Ae=0,ve=0,Pe=0;for(let je=0;je<pe.length;je++){const Ne=pe[je];Ae++;const xe=Ne-ve;ve+=xe/Ae,Pe+=xe*(Ne-ve)}return{n:Ae,mean:ve,m2:Pe}}function m(pe,Ae){const ve=pe.length;if(!ve)return NaN;if(ve===1)return pe[0];const Pe=(ve-1)*Math.min(1,Math.max(0,Ae)),je=Math.floor(Pe),Ne=Math.ceil(Pe);return je===Ne?pe[je]:pe[je]+(Pe-je)*(pe[Ne]-pe[je])}function v(pe,Ae){if(!pe.length)return NaN;const ve=pe.slice().sort();return m(ve,Ae)}function y(pe,Ae){const ve=q(pe);let Pe=0,je=0,Ne=0;for(let xe=0;xe<Ae.length;xe++){const ze=ve(Ae[xe]);if(ze==null||ze==="")continue;const _e=String(ze).toUpperCase();_e==="PASS"?Pe++:_e==="FAIL"?je++:_e==="WARN"&&Ne++}return{pass:Pe+Ne,fail:je,warn:Ne,judged:Pe+Ne+je}}const T=Object.freeze({hhi:(pe,Ae)=>f(pe,Ae),entropy:(pe,Ae)=>w(pe,Ae),evenness:(pe,Ae)=>g(pe,Ae),top3Share:(pe,Ae)=>k(pe,Ae,3),top10Share:(pe,Ae)=>k(pe,Ae,10),gini:(pe,Ae)=>d(pe,Ae),trimmedMean:(pe,Ae)=>I(c(pe,Ae),.1),winsorizedMean:(pe,Ae)=>j(c(pe,Ae),.1),robustOutliers:(pe,Ae)=>L(c(pe,Ae),3.5),jarqueBera:(pe,Ae)=>F(c(pe,Ae)),variance:(pe,Ae)=>{const{n:ve,m2:Pe}=p(c(pe,Ae));return ve>1?Pe/(ve-1):null},varianceP:(pe,Ae)=>{const{n:ve,m2:Pe}=p(c(pe,Ae));return ve>0?Pe/ve:null},stddev:(pe,Ae)=>{const{n:ve,m2:Pe}=p(c(pe,Ae));return ve>1?Math.sqrt(Pe/(ve-1)):null},stddevP:(pe,Ae)=>{const{n:ve,m2:Pe}=p(c(pe,Ae));return ve>0?Math.sqrt(Pe/ve):null},median:(pe,Ae)=>{const ve=c(pe,Ae);return ve.length?v(ve,.5):null},p25:(pe,Ae)=>{const ve=c(pe,Ae);return ve.length?v(ve,.25):null},p75:(pe,Ae)=>{const ve=c(pe,Ae);return ve.length?v(ve,.75):null},p90:(pe,Ae)=>{const ve=c(pe,Ae);return ve.length?v(ve,.9):null},p95:(pe,Ae)=>{const ve=c(pe,Ae);return ve.length?v(ve,.95):null},p99:(pe,Ae)=>{const ve=c(pe,Ae);return ve.length?v(ve,.99):null},iqr:(pe,Ae)=>{const ve=c(pe,Ae);if(!ve.length)return null;const Pe=ve.slice().sort();return m(Pe,.75)-m(Pe,.25)},mad:(pe,Ae)=>{const ve=c(pe,Ae);if(!ve.length)return null;const Pe=v(ve,.5),je=new Float64Array(ve.length);for(let Ne=0;Ne<ve.length;Ne++)je[Ne]=Math.abs(ve[Ne]-Pe);return v(je,.5)},range:(pe,Ae)=>{const ve=c(pe,Ae);if(!ve.length)return null;let Pe=1/0,je=-1/0;for(let Ne=0;Ne<ve.length;Ne++)ve[Ne]<Pe&&(Pe=ve[Ne]),ve[Ne]>je&&(je=ve[Ne]);return je-Pe},distinct:(pe,Ae)=>{const ve=q(pe),Pe=new Set;for(let je=0;je<Ae.length;je++){const Ne=ve(Ae[je]);Ne==null||Ne===""||Pe.add(Ne instanceof Date?Ne.getTime():Ne)}return Pe.size},mode:(pe,Ae)=>{const ve=q(pe),Pe=new Map;for(let xe=0;xe<Ae.length;xe++){const ze=ve(Ae[xe]);if(ze==null||ze==="")continue;const _e=ze instanceof Date?ze.getTime():ze;Pe.set(_e,(Pe.get(_e)||0)+1)}let je=null,Ne=1;for(const[xe,ze]of Pe)ze>Ne&&(Ne=ze,je=xe);return je},skewness:(pe,Ae)=>{const ve=c(pe,Ae),{n:Pe,mean:je,m2:Ne}=p(ve);if(Pe<3||Ne<=0)return null;const xe=Math.sqrt(Ne/(Pe-1));let ze=0;for(let _e=0;_e<ve.length;_e++)ze+=((ve[_e]-je)/xe)**3;return Pe/((Pe-1)*(Pe-2))*ze},kurtosis:(pe,Ae)=>{const ve=c(pe,Ae),{n:Pe,mean:je,m2:Ne}=p(ve);if(Pe<4||Ne<=0)return null;const xe=Math.sqrt(Ne/(Pe-1));let ze=0;for(let Te=0;Te<ve.length;Te++)ze+=((ve[Te]-je)/xe)**4;const _e=Pe*(Pe+1)/((Pe-1)*(Pe-2)*(Pe-3)),Qe=3*(Pe-1)**2/((Pe-2)*(Pe-3));return _e*ze-Qe},geomean:(pe,Ae)=>{const ve=c(pe,Ae);if(!ve.length)return null;let Pe=0;for(let je=0;je<ve.length;je++){if(ve[je]<=0)return null;Pe+=Math.log(ve[je])}return Math.exp(Pe/ve.length)},harmean:(pe,Ae)=>{const ve=c(pe,Ae);if(!ve.length)return null;let Pe=0;for(let je=0;je<ve.length;je++){if(ve[je]===0)return null;Pe+=1/ve[je]}return ve.length/Pe},sumSquares:(pe,Ae)=>{const ve=c(pe,Ae);let Pe=0;for(let je=0;je<ve.length;je++)Pe+=ve[je]*ve[je];return Pe},passRate:(pe,Ae)=>{const{pass:ve,judged:Pe}=y(pe,Ae);return Pe?ve/Pe:null},failureCount:(pe,Ae)=>y(pe,Ae).fail}),A=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 M(pe,Ae,ve){const Pe=q(pe),je=q(Ae);let Ne=0,xe=0;for(let ze=0;ze<ve.length;ze++){const _e=ve[ze],Qe=Number(Pe(_e)),Te=Number(je(_e));!Number.isFinite(Qe)||!Number.isFinite(Te)||(Ne+=Qe*Te,xe+=Te)}return xe===0?null:Ne/xe}function _(pe,Ae,ve){const Pe=q(pe);let je=null,Ne=ve?-1/0:1/0;for(let xe=0;xe<Ae.length;xe++){const ze=Ae[xe],_e=Number(Pe(ze));Number.isFinite(_e)&&(ve?_e>Ne:_e<Ne)&&(Ne=_e,je=ze)}return je}function R(pe,Ae,ve){const Pe=q(pe),je=q(Ae);let Ne=0,xe=0,ze=0,_e=0,Qe=0,Te=0;for(let Ze=0;Ze<ve.length;Ze++){const lt=ve[Ze],ot=Number(Pe(lt)),it=Number(je(lt));!Number.isFinite(ot)||!Number.isFinite(it)||(Ne++,xe+=ot,ze+=it,_e+=ot*ot,Qe+=it*it,Te+=ot*it)}if(Ne<2)return null;const Ke=Ne*Te-xe*ze,qe=Math.sqrt((Ne*_e-xe*xe)*(Ne*Qe-ze*ze));if(qe===0)return null;const Je=Ke/qe;return Math.max(-1,Math.min(1,Je))}function I(pe,Ae=.1){const ve=pe.length;if(!ve)return null;const Pe=Array.from(pe).sort((ze,_e)=>ze-_e),je=Math.floor(ve*Math.min(.49,Math.max(0,Ae))),Ne=Pe.slice(je,ve-je);if(!Ne.length)return m(Pe,.5);let xe=0;for(const ze of Ne)xe+=ze;return xe/Ne.length}function j(pe,Ae=.1){const ve=pe.length;if(!ve)return null;const Pe=Array.from(pe).sort((_e,Qe)=>_e-Qe),je=Math.floor(ve*Math.min(.49,Math.max(0,Ae))),Ne=Pe[je],xe=Pe[ve-1-je];let ze=0;for(const _e of Pe)ze+=Math.min(xe,Math.max(Ne,_e));return ze/ve}function L(pe,Ae=3.5){if(!pe.length)return null;const Pe=Array.from(pe).sort((_e,Qe)=>_e-Qe),je=m(Pe,.5),Ne=Pe.map(_e=>Math.abs(_e-je)).sort((_e,Qe)=>_e-Qe),xe=m(Ne,.5);if(xe===0)return null;let ze=0;for(const _e of Pe)Math.abs(.6745*(_e-je)/xe)>Ae&&ze++;return ze}function F(pe){const Ae=pe.length;if(Ae<8)return null;let ve=0;for(const _e of pe)ve+=_e;ve/=Ae;let Pe=0,je=0,Ne=0;for(const _e of pe){const Qe=_e-ve;Pe+=Qe*Qe,je+=Qe*Qe*Qe,Ne+=Qe*Qe*Qe*Qe}if(Pe/=Ae,je/=Ae,Ne/=Ae,Pe===0)return null;const xe=je/Pe**1.5,ze=Ne/(Pe*Pe)-3;return Ae/6*(xe*xe+ze*ze/4)}function N(pe,Ae,ve){const Pe=[];let je=0;for(let _e=0;_e<pe.length;_e++){const Qe=Number(pe[_e]),Te=Number(Ae[_e]);!Number.isFinite(Qe)||!Number.isFinite(Te)||Te<=0||(Pe.push([Qe,Te]),je+=Te)}if(!Pe.length||je<=0)return null;if(Pe.sort((_e,Qe)=>_e[0]-Qe[0]),Pe.length===1)return Pe[0][0];const Ne=[];let xe=0;for(const[,_e]of Pe)Ne.push((xe+_e/2)/je),xe+=_e;const ze=Math.max(0,Math.min(1,ve));if(ze<=Ne[0])return Pe[0][0];if(ze>=Ne[Ne.length-1])return Pe[Pe.length-1][0];for(let _e=1;_e<Ne.length;_e++){if(ze>Ne[_e])continue;const Qe=Ne[_e]-Ne[_e-1],Te=Qe>0?(ze-Ne[_e-1])/Qe:0;return Pe[_e-1][0]+(Pe[_e][0]-Pe[_e-1][0])*Te}return Pe[Pe.length-1][0]}function S(pe,Ae,ve){const Pe=q(pe),je=q(Ae),Ne=new Float64Array(ve.length),xe=new Float64Array(ve.length);let ze=0;for(let _e=0;_e<ve.length;_e++){const Qe=ve[_e],Te=Number(Pe(Qe)),Ke=Number(je(Qe));!Number.isFinite(Te)||!Number.isFinite(Ke)||(Ne[ze]=Te,xe[ze]=Ke,ze++)}return{xs:Ne.subarray(0,ze),ys:xe.subarray(0,ze),n:ze}}function C(pe,Ae,ve,Pe=!1){const{xs:je,ys:Ne,n:xe}=S(pe,Ae,ve);if(xe<2)return null;let ze=0,_e=0;for(let Te=0;Te<xe;Te++)ze+=je[Te],_e+=Ne[Te];ze/=xe,_e/=xe;let Qe=0;for(let Te=0;Te<xe;Te++)Qe+=(je[Te]-ze)*(Ne[Te]-_e);return Qe/(Pe?xe:xe-1)}function D(pe,Ae,ve){const{xs:Pe,ys:je,n:Ne}=S(pe,Ae,ve);if(Ne<2)return null;let xe=0,ze=0;for(let ot=0;ot<Ne;ot++)xe+=Pe[ot],ze+=je[ot];xe/=Ne,ze/=Ne;let _e=0,Qe=0,Te=0;for(let ot=0;ot<Ne;ot++){const it=Pe[ot]-xe,Ot=je[ot]-ze;_e+=it*it,Qe+=it*Ot,Te+=Ot*Ot}if(_e===0)return null;const Ke=Qe/_e,qe=ze-Ke*xe,Je=Te===0?1:Math.max(0,Math.min(1,Qe*Qe/(_e*Te))),Ze=Math.max(0,Te-Ke*Qe),lt=Ne>2?Math.sqrt(Ze/(Ne-2)/_e):0;return{slope:Ke,intercept:qe,r2:Je,stdError:lt,n:Ne}}const G=new Set(["ols","wls","robust"]),X=new Set(["quantile"]),V=new Set(["ridge","lasso","elasticnet","mixed","gls"]),J=1.345;function ee(pe,Ae,ve){const{xtwx:Pe,xtwy:je}=u(pe,Ae,ve),Ne=E(Pe);if(!Ne)return null;const xe=O(Ne,je),ze=b(Ne),_e=te(pe,xe),Qe=Ae.map((Te,Ke)=>Te-_e[Ke]);return{beta:xe,cov:ze,fitted:_e,residuals:Qe}}function te(pe,Ae){return pe.map(ve=>ve.reduce((Pe,je,Ne)=>Pe+je*Ae[Ne],0))}function ie(pe,Ae){const ve=pe.length,Pe=pe.map(Qe=>Qe[Ae]),je=pe.map(Qe=>[1,...Qe.filter((Te,Ke)=>Ke!==Ae)]),Ne=ee(je,Pe,null);if(!Ne)return 1;const xe=Pe.reduce((Qe,Te)=>Qe+Te,0)/ve;let ze=0,_e=0;for(let Qe=0;Qe<ve;Qe++)ze+=Ne.residuals[Qe]**2,_e+=(Pe[Qe]-xe)**2;return _e===0?1:Math.max(0,Math.min(1,1-ze/_e))}function oe(pe){const Ae=[...pe].sort((je,Ne)=>je-Ne),ve=ue(Ae),Pe=pe.map(je=>Math.abs(je-ve)).sort((je,Ne)=>je-Ne);return ue(Pe)/.6745}function ue(pe){const Ae=pe.length;if(!Ae)return 0;const ve=Math.floor(Ae/2);return Ae%2?pe[ve]:(pe[ve-1]+pe[ve])/2}function ye(pe,Ae,ve={}){const Pe=ve.method||"ols";if(V.has(Pe))throw new Error(`[lattice] regression method "${Pe}" is out of scope; use ols, wls or robust.`);if(X.has(Pe))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!G.has(Pe))throw new Error(`[lattice] unknown regression method "${Pe}"; use ols, wls or robust.`);const je=Array.isArray(Ae)?Ae.length:0,Ne=je&&Array.isArray(pe[0])?pe[0].length:0,xe=Ne+1;if(!(je>xe))return null;for(let Nt=0;Nt<je;Nt++){if(!Number.isFinite(Ae[Nt])||!Array.isArray(pe[Nt])||pe[Nt].length!==Ne)return null;for(let xt=0;xt<Ne;xt++)if(!Number.isFinite(pe[Nt][xt]))return null}let ze=null;if(Pe==="wls"){if(ze=ve.weights,!Array.isArray(ze)||ze.length!==je)return null;for(let Nt=0;Nt<je;Nt++)if(!(ze[Nt]>0)||!Number.isFinite(ze[Nt]))return null}const _e=pe.map(Nt=>[1,...Nt]);let Qe,Te=null;if(Pe==="robust"){if(Qe=ee(_e,Ae,null),!Qe)return null;for(let Nt=0;Nt<50;Nt++){const xt=oe(Qe.residuals);if(!(xt>0))break;const zt=Qe.residuals.map(Qt=>{const Xt=Math.abs(Qt/xt);return Xt<=J?1:J/Xt}),Gt=ee(_e,Ae,zt);if(!Gt)return null;const Zt=Gt.beta.reduce((Qt,Xt,rn)=>Math.max(Qt,Math.abs(Xt-Qe.beta[rn])),0);if(Qe=Gt,Te=zt,Zt<1e-10)break}}else if(Qe=ee(_e,Ae,ze),!Qe)return null;const Ke=Pe==="robust"?Te:ze,{beta:qe,cov:Je,fitted:Ze,residuals:lt}=Qe;let ot=0,it=0,Ot=0;for(let Nt=0;Nt<je;Nt++){const xt=Ke?Ke[Nt]:1;ot+=xt*lt[Nt]**2,it+=xt,Ot+=xt*Ae[Nt]}const jt=Ot/it;let Rt=0;for(let Nt=0;Nt<je;Nt++){const xt=Ke?Ke[Nt]:1;Rt+=xt*(Ae[Nt]-jt)**2}const We=je-xe,gt=ot/We,ct=Rt===0?1:Math.max(0,Math.min(1,1-ot/Rt)),bt=1-(1-ct)*(je-1)/We,Et=Array.isArray(ve.names)&&ve.names.length===Ne?ve.names:pe[0].map((Nt,xt)=>`x${xt+1}`),ht=St(ve.confidence),ut=We>0?x(1-(1-ht)/2,We):1/0,Tt=qe.map((Nt,xt)=>{const zt=Math.sqrt(Math.max(0,gt*Je[xt][xt])),Gt=zt>0?Nt/zt:Nt===0?0:1/0,Zt=Number.isFinite(Gt)?2*(1-Z(Math.abs(Gt),We)):0,Qt=Number.isFinite(ut)?ut*zt:null;return{name:xt===0?"(intercept)":Et[xt-1],estimate:Nt,stdError:zt,t:Gt,p:Math.max(0,Math.min(1,Zt)),lower:Qt===null?null:Nt-Qt,upper:Qt===null?null:Nt+Qt}}),Ht=new Array(je),Yt=new Array(je);for(let Nt=0;Nt<je;Nt++){const xt=Ke?Ke[Nt]:1,zt=Math.max(0,Math.min(1,xt*h(_e[Nt],Je)));Ht[Nt]=zt;const Gt=(1-zt)**2;Yt[Nt]=Gt>0&>>0?lt[Nt]**2/(xe*gt)*(zt/Gt):null}const pn=pe[0].map((Nt,xt)=>{if(Ne<2)return 1;const zt=ie(pe,xt);return zt>=1?1/0:1/(1-zt)});let un=null;{const Nt=lt.map(zt=>zt*zt),xt=ee(_e,Nt,null);if(xt){const zt=Nt.reduce((Jt,mn)=>Jt+mn,0)/je;let Gt=0,Zt=0;for(let Jt=0;Jt<je;Jt++)Gt+=xt.residuals[Jt]**2,Zt+=(Nt[Jt]-zt)**2;const Qt=Zt===0?0:Math.max(0,Math.min(1,1-Gt/Zt)),Xt=je*Qt,rn=W(Xt,Ne);un={statistic:Xt,df:Ne,p:rn,heteroscedastic:rn<.05}}}let an=null;if(Ne===1){const Nt=pe.map((xt,zt)=>zt).sort((xt,zt)=>pe[xt][0]-pe[zt][0]);an={confidence:ht,points:Nt.map(xt=>{const zt=_e[xt],Gt=Math.sqrt(Math.max(0,gt*h(zt,Je)));return{x:pe[xt][0],yhat:Ze[xt],lower:Ze[xt]-ut*Gt,upper:Ze[xt]+ut*Gt}})}}return{method:Pe,coefficients:Tt,r2:ct,adjR2:bt,n:je,df:We,sigma2:gt,fitted:Ze,residuals:lt,leverage:Ht,cooksD:Yt,vif:pn,heteroscedasticity:un,band:an,weights:Ke?[...Ke]:null}}function he(pe){const Ae=pe.length,ve=Array.from({length:Ae},(Ne,xe)=>xe).sort((Ne,xe)=>pe[Ne]-pe[xe]),Pe=new Float64Array(Ae);let je=0;for(;je<Ae;){let Ne=je;for(;Ne+1<Ae&&pe[ve[Ne+1]]===pe[ve[je]];)Ne++;const xe=(je+Ne)/2+1;for(let ze=je;ze<=Ne;ze++)Pe[ve[ze]]=xe;je=Ne+1}return Pe}const Re=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function Ce(pe){const Ae=[.01,.05,.1],ve=[Re["1%"],Re["5%"],Re["10%"]];if(pe<=ve[0]){const Ne=(Math.log(Ae[1])-Math.log(Ae[0]))/(ve[1]-ve[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(Ae[0])+Ne*(pe-ve[0]))))}if(pe>=ve[2]){const Ne=(Math.log(Ae[2])-Math.log(Ae[1]))/(ve[2]-ve[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(Ae[2])+Ne*(pe-ve[2]))))}const Pe=pe<ve[1]?0:1,je=(pe-ve[Pe])/(ve[Pe+1]-ve[Pe]);return Math.exp(Math.log(Ae[Pe])+je*(Math.log(Ae[Pe+1])-Math.log(Ae[Pe])))}function we(pe,Ae,ve,Pe){const je=ve-Pe,Ne=Pe+3,xe=new Array(je),ze=new Array(je);let _e=!0,Qe=Pe;for(let Ze=0;Ze<je;Ze++){const lt=Pe+Ze,ot=new Float64Array(Ne);ot[0]=1,ot[1]=Ze+1,ot[2]=pe[lt];for(let it=1;it<=Pe;it++)ot[2+it]=Ae[lt-it];for(let it=1;it<Ne;it++)Number.isFinite(ot[it])||(Qe=Math.min(Qe,it-3));xe[Ze]=ot,ze[Ze]=Ae[lt],Number.isFinite(ze[Ze])||(_e=!1)}if(!_e)return 0;const{xtwx:Te,xtwy:Ke}=u(xe,ze,null);let qe=0,Je=1/0;for(let Ze=0;Ze<=Qe;Ze++){const lt=Ze+3;if(!(je>lt))continue;const ot=new Array(lt);for(let ct=0;ct<lt;ct++)ot[ct]=Te[ct].slice(0,lt);const it=E(ot);if(!it)continue;const Ot=O(it,Ke.slice(0,lt));let jt=0;for(let ct=0;ct<je;ct++){const bt=xe[ct];let Et=0;for(let ht=0;ht<lt;ht++)Et+=bt[ht]*Ot[ht];jt+=(ze[ct]-Et)**2}const We=jt/(je-lt)*(je-lt);if(!(We>0))continue;const gt=je*Math.log(We/je)+2*lt;gt<Je&&(Je=gt,qe=Ze)}return qe}function re(pe,Ae={}){const ve=[];for(let Je=0;Je<pe.length;Je++){const Ze=Number(pe[Je]);Number.isFinite(Ze)&&ve.push(Ze)}const Pe=ve.length,je=Pe-1;if(Pe<8||je<6)return null;const Ne=new Array(je);for(let Je=0;Je<je;Je++)Ne[Je]=ve[Je+1]-ve[Je];let xe=Number.isFinite(Ae.maxlag)?Math.floor(Ae.maxlag):Math.ceil(12*(Pe/100)**.25);xe=Math.max(0,Math.min(xe,Math.floor((je-5)/2)));const ze=(Je,Ze)=>{const lt=[],ot=[];for(let it=Ze;it<je;it++){const Ot=[it-Ze+1,ve[it]];for(let jt=1;jt<=Je;jt++)Ot.push(Ne[it-jt]);lt.push(Ot),ot.push(Ne[it])}return ye(lt,ot,{method:"ols"})},_e=we(ve,Ne,je,xe),Qe=ze(_e,_e);if(!Qe||!Qe.coefficients[2])return null;const Te=Qe.coefficients[2].t,Ke=Ce(Te),qe=Te<Re["5%"];return{statistic:Te,usedLag:_e,nobs:je-_e,criticalValues:{...Re},pValue:Ke,pApproximate:!0,stationary:qe,verdict:qe?"stationary":"non-stationary",regression:"ct"}}function de(pe,Ae={}){const ve=[];for(let qe=0;qe<pe.length;qe++){const Je=Number(pe[qe]);Number.isFinite(Je)&&ve.push(Je)}const Pe=ve.length;if(Pe<3)return null;let je=Number.isFinite(Ae.maxlag)?Math.floor(Ae.maxlag):Math.min(10,Pe-1);je=Math.max(1,Math.min(je,Pe-1));let Ne=0;for(const qe of ve)Ne+=qe;Ne/=Pe;const xe=ve.map(qe=>qe-Ne);let ze=0;for(const qe of xe)ze+=qe*qe;ze/=Pe;const _e=new Array(je+1).fill(0);_e[0]=1;for(let qe=1;qe<=je;qe++){let Je=0;for(let Ze=qe;Ze<Pe;Ze++)Je+=xe[Ze]*xe[Ze-qe];_e[qe]=ze>0?Je/Pe/ze:0}const Qe=new Array(je+1).fill(0);Qe[0]=1;let Te=[];for(let qe=1;qe<=je;qe++){let Je=_e[qe];for(let it=1;it<qe;it++)Je-=Te[it-1]*_e[qe-it];let Ze=1;for(let it=1;it<qe;it++)Ze-=Te[it-1]*_e[it];const lt=Ze!==0?Je/Ze:0,ot=new Array(qe);for(let it=1;it<qe;it++)ot[it-1]=Te[it-1]-lt*Te[qe-1-it];ot[qe-1]=lt,Qe[qe]=lt,Te=ot}const Ke=1.96/Math.sqrt(Pe);return{acf:_e,pacf:Qe,bounds:{upper:Ke,lower:-Ke},n:Pe,nlags:je,approximate:!0}}function me(pe,Ae,ve){const{xs:Pe,ys:je,n:Ne}=S(pe,Ae,ve);if(Ne<2)return null;const xe=he(Pe),ze=he(je);let _e=0,Qe=0;for(let Je=0;Je<Ne;Je++)_e+=xe[Je],Qe+=ze[Je];_e/=Ne,Qe/=Ne;let Te=0,Ke=0,qe=0;for(let Je=0;Je<Ne;Je++){const Ze=xe[Je]-_e,lt=ze[Je]-Qe;Te+=Ze*lt,Ke+=Ze*Ze,qe+=lt*lt}return Ke===0||qe===0?null:Math.max(-1,Math.min(1,Te/Math.sqrt(Ke*qe)))}function Oe(pe,Ae,ve){const{xs:Pe,ys:je,n:Ne}=S(pe,Ae,ve);if(Ne<2||Ne>n)return null;let xe=0,ze=0,_e=0,Qe=0;for(let qe=0;qe<Ne;qe++)for(let Je=qe+1;Je<Ne;Je++){const Ze=Math.sign(Pe[qe]-Pe[Je]),lt=Math.sign(je[qe]-je[Je]),ot=Ze*lt;ot>0?xe++:ot<0?ze++:Ze===0&<===0||(Ze===0?_e++:Qe++)}const Te=xe+ze+Qe,Ke=xe+ze+_e;return Te===0||Ke===0?null:(xe-ze)/Math.sqrt(Te*Ke)}function ke(pe,Ae={}){const ve=pe.length;if(ve<2)return null;const Pe=pe[0],je=pe[ve-1],Ne=[];for(let it=1;it<ve;it++){const Ot=pe[it-1];Ot!==0&&Ne.push((pe[it]-Ot)/Math.abs(Ot))}let xe=null;if(Ne.length>1){let it=0;for(const jt of Ne)it+=jt;it/=Ne.length;let Ot=0;for(const jt of Ne)Ot+=(jt-it)**2;xe=Math.sqrt(Ot/(Ne.length-1))}const ze=Number(Ae.periodsPerYear)>0?Number(Ae.periodsPerYear):null;let _e=pe[0],Qe=0,Te=0,Ke=0,qe=0;for(let it=1;it<ve;it++){if(pe[it]>_e){_e=pe[it],Qe=it;continue}if(_e<=0)continue;const Ot=(_e-pe[it])/_e;Ot>Te&&(Te=Ot,Ke=Qe,qe=it)}let Je=null;if(ve>2){let it=0;for(let Rt=0;Rt<ve;Rt++)it+=pe[Rt];it/=ve;let Ot=0,jt=0;for(let Rt=0;Rt<ve;Rt++){const We=pe[Rt]-it;jt+=We*We,Rt>0&&(Ot+=We*(pe[Rt-1]-it))}Je=jt>0?Ot/jt:null}let Ze=0,lt=0;for(const it of Ne)it>0?Ze++:it<0&<++;let ot=null;if(Pe>0&&je>0){const it=(je/Pe)**(1/(ve-1))-1;ot=ze?(1+it)**ze-1:it}return{n:ve,first:Pe,last:je,change:je-Pe,changePercent:Pe===0?null:(je-Pe)/Math.abs(Pe)*100,volatility:xe,annualisedVolatility:xe!==null&&ze?xe*Math.sqrt(ze):null,growth:ot,maxDrawdown:Te,maxDrawdownFrom:Ke,maxDrawdownTo:qe,autocorrelation:Je,upDays:Ze,downDays:lt}}const Le=1.128,ce=3.267;function ge(pe){const Ae=pe.length;if(Ae<2)return null;const ve=[];for(let je=1;je<Ae;je++)ve.push(Math.abs(pe[je]-pe[je-1]));const Pe=ve.reduce((je,Ne)=>je+Ne,0)/ve.length;return{ranges:ve,centre:Pe,upper:ce*Pe,lower:0}}function Se(pe){const Ae=pe.length;if(Ae<2)return null;let ve=0;for(let je=1;je<Ae;je++)ve+=Math.abs(pe[je]-pe[je-1]);const Pe=ve/(Ae-1);return{sigma:Pe/Le,meanRange:Pe}}function Fe(pe,Ae){const ve=pe.length;if(ve<2||!Ae)return null;const Pe=Number.isFinite(Number(Ae.lower))?Number(Ae.lower):null,je=Number.isFinite(Number(Ae.upper))?Number(Ae.upper):null;if(Pe===null&&je===null)return null;let Ne=0;for(let Ze=0;Ze<ve;Ze++)Ne+=pe[Ze];Ne/=ve;let xe=0;for(let Ze=0;Ze<ve;Ze++)xe+=(pe[Ze]-Ne)**2;const ze=Math.sqrt(xe/(ve-1)),_e=Se(pe),Qe=_e?_e.sigma:null,Te=Ze=>{if(!Ze||Ze<=0)return{index:null,k:null};const ot=Pe!==null&&je!==null?(je-Pe)/(6*Ze):null,it=je!==null?(je-Ne)/(3*Ze):1/0,Ot=Pe!==null?(Ne-Pe)/(3*Ze):1/0;return{index:ot,k:Math.min(it,Ot)}},Ke=Te(Qe),qe=Te(ze);let Je=0;for(let Ze=0;Ze<ve;Ze++){if(Pe!==null&&pe[Ze]<Pe){Je++;continue}je!==null&&pe[Ze]>je&&Je++}return{n:ve,mean:Ne,lower:Pe,upper:je,target:Number.isFinite(Number(Ae.target))?Number(Ae.target):null,sigmaWithin:Qe,sigmaOverall:ze,cp:Ke.index,cpk:Ke.k,pp:qe.index,ppk:qe.k,outOfSpec:Je,defectRate:ve?Je/ve:null}}function be(pe){const Ae=pe.length;if(Ae<2)return null;const ve=Se(pe);if(!ve||!(ve.sigma>0))return null;let Pe=0;for(let je=0;je<Ae;je++)Pe+=pe[je];return Pe/=Ae,{centre:Pe,sigma:ve.sigma,upper:Pe+3*ve.sigma,lower:Pe-3*ve.sigma}}function Ie(pe,Ae){if(!Ae||!(Ae.sigma>0))return[];const ve=pe.length,{centre:Pe,sigma:je}=Ae,Ne=ze=>(pe[ze]-Pe)/je,xe=[];for(let ze=0;ze<ve;ze++){if(Math.abs(Ne(ze))>3&&xe.push({index:ze,rule:1,description:"beyond three sigma"}),ze>=2)for(const _e of[1,-1]){let Qe=0;for(let Te=ze-2;Te<=ze;Te++)Ne(Te)*_e>2&&Qe++;if(Qe>=2){xe.push({index:ze,rule:2,description:"two of three past two sigma"});break}}if(ze>=4)for(const _e of[1,-1]){let Qe=0;for(let Te=ze-4;Te<=ze;Te++)Ne(Te)*_e>1&&Qe++;if(Qe>=4){xe.push({index:ze,rule:3,description:"four of five past one sigma"});break}}if(ze>=7)for(const _e of[1,-1]){let Qe=!0;for(let Te=ze-7;Te<=ze;Te++)if(Ne(Te)*_e<=0){Qe=!1;break}if(Qe){xe.push({index:ze,rule:4,description:"eight in a row on one side"});break}}}return xe}function He(pe,Ae){if(!Ae||!(Ae.sigma>0))return[];const ve=pe.length,{centre:Pe,sigma:je}=Ae,Ne=_e=>(pe[_e]-Pe)/je,xe=(_e,Qe,Te,Ke)=>{for(const qe of[1,-1]){let Je=0;for(let Ze=_e;Ze<=Qe;Ze++)Ne(Ze)*qe>Te&&Je++;if(Je>=Ke)return!0}return!1},ze=[];for(let _e=0;_e<ve;_e++){if(Math.abs(Ne(_e))>3&&ze.push({index:_e,rule:1,description:"beyond three sigma"}),_e>=8)for(const Qe of[1,-1]){let Te=!0;for(let Ke=_e-8;Ke<=_e;Ke++)if(Ne(Ke)*Qe<=0){Te=!1;break}if(Te){ze.push({index:_e,rule:2,description:"nine in a row on one side"});break}}if(_e>=5)for(const Qe of[1,-1]){let Te=!0;for(let Ke=_e-4;Ke<=_e;Ke++)if((pe[Ke]-pe[Ke-1])*Qe<=0){Te=!1;break}if(Te){ze.push({index:_e,rule:3,description:Qe>0?"six rising":"six falling"});break}}if(_e>=13){let Qe=!0;for(let Te=_e-12;Te<=_e;Te++){const Ke=pe[Te]-pe[Te-1],qe=pe[Te+1<=_e?Te+1:Te]-pe[Te];if(Te+1>_e)break;if(Ke===0||qe===0||Ke>0==qe>0){Qe=!1;break}}Qe&&ze.push({index:_e,rule:4,description:"fourteen alternating"})}if(_e>=2&&xe(_e-2,_e,2,2)&&ze.push({index:_e,rule:5,description:"two of three past two sigma"}),_e>=4&&xe(_e-4,_e,1,4)&&ze.push({index:_e,rule:6,description:"four of five past one sigma"}),_e>=14){let Qe=!0;for(let Te=_e-14;Te<=_e;Te++)if(Math.abs(Ne(Te))>=1){Qe=!1;break}Qe&&ze.push({index:_e,rule:7,description:"fifteen within one sigma"})}if(_e>=7){let Qe=!0;for(let Te=_e-7;Te<=_e;Te++)if(Math.abs(Ne(Te))<=1){Qe=!1;break}Qe&&ze.push({index:_e,rule:8,description:"eight beyond one sigma"})}}return ze}const Ge=Object.freeze(["westernElectric","nelson"]);function nt(pe,Ae,ve="westernElectric"){return String(ve)==="nelson"?He(pe,Ae):Ie(pe,Ae)}function st(pe,Ae,ve){let Pe=0;for(let je=0;je<pe.length;je++)(pe[je]<Ae||pe[je]>ve)&&Pe++;return Pe}function mt(pe,Ae,ve,Pe=20){const je=pe.length;if(!je)return[];const Ne=pe[0],xe=pe[je-1];if(xe===Ne)return[{from:Ne,to:xe,count:je}];const ze=ve-Ae,_e=1.5*ze;let Qe=ze>0?Math.max(Ne,Ae-_e):Ne,Te=ze>0?Math.min(xe,ve+_e):xe;Te>Qe||(Qe=Ne,Te=xe);const Ke=ze>0?2*ze/Math.cbrt(je):(Te-Qe)/(Math.ceil(Math.log2(je))+1),qe=Ke>0?Math.min(Pe,Math.max(1,Math.ceil((Te-Qe)/Ke))):1,Je=(Te-Qe)/qe,Ze=[];for(let lt=0;lt<qe;lt++)Ze.push({from:Qe+lt*Je,to:Qe+(lt+1)*Je,count:0});for(let lt=0;lt<je;lt++){const ot=Math.min(qe-1,Math.max(0,Math.floor((pe[lt]-Qe)/Je)));Ze[ot].count++}return Ze[0].from=Ne,Ze[qe-1].to=xe,Ze}const kt=.95;function St(pe){const Ae=Number(pe);return Number.isFinite(Ae)&&Ae>0&&Ae<1?Ae:kt}function Pt(pe,Ae=kt){const ve=pe.length;if(ve<2)return null;let Pe=0;for(let Te=0;Te<ve;Te++)Pe+=pe[Te];const je=Pe/ve;let Ne=0;for(let Te=0;Te<ve;Te++){const Ke=pe[Te]-je;Ne+=Ke*Ke}const xe=Math.sqrt(Ne/(ve-1)),ze=St(Ae),Qe=x(1-(1-ze)/2,ve-1)*xe/Math.sqrt(ve);return{mean:je,lower:je-Qe,upper:je+Qe,margin:Qe,n:ve,confidence:ze}}function Mt(pe,Ae,ve=kt){const Pe=Number(pe),je=Number(Ae);if(!(je>0)||!(Pe>=0)||Pe>je)return null;const Ne=St(ve),xe=Y(1-(1-Ne)/2),ze=Pe/je,_e=xe*xe,Qe=1+_e/je,Te=(ze+_e/(2*je))/Qe,Ke=xe/Qe*Math.sqrt(ze*(1-ze)/je+_e/(4*je*je));return{proportion:ze,lower:Math.max(0,Te-Ke),upper:Math.min(1,Te+Ke),n:je,confidence:Ne}}function It(pe,Ae=kt){if(!pe||!(pe.n>2)||!Number.isFinite(pe.stdError))return null;const ve=St(Ae),je=x(1-(1-ve)/2,pe.n-2)*pe.stdError;return{slope:pe.slope,lower:pe.slope-je,upper:pe.slope+je,margin:je,confidence:ve}}function $t(pe,Ae,ve=kt){const Pe=Number(pe),je=Number(Ae);if(!Number.isFinite(Pe)||!(je>1))return null;const Ne=St(ve),ze=Y(1-(1-Ne)/2)*Math.sqrt(1/(9*je)+Pe*Pe/(2*(je-1)));return{index:Pe,lower:Pe-ze,upper:Pe+ze,margin:ze,n:je,confidence:Ne}}function Ut(pe,Ae){return!pe||!(pe.sd>0)||!Number.isFinite(Ae)||!Number.isFinite(pe.mean)?null:(Ae-pe.mean)/pe.sd}function ft(pe){return Number.isFinite(pe)?Math.min(1,Math.max(0,2*U(Math.abs(pe)/2)-1)):0}function dt(pe,Ae){const ve=new Map,Pe=q(pe);let je=0;for(let Ne=0;Ne<Ae.length;Ne++){const xe=Pe(Ae[Ne]);if(xe==null||xe===""||typeof xe=="number"&&Number.isNaN(xe))continue;const ze=xe instanceof Date?xe.getTime():typeof xe=="object"?String(xe):xe;ve.set(ze,(ve.get(ze)||0)+1),je++}return{map:ve,total:je}}function wt(pe,Ae,ve,Pe){if(!(Ae>0)||!(Pe>0))return null;let je=0;const Ne=new Set(pe.keys());for(const xe of ve.keys())Ne.add(xe);for(const xe of Ne){const ze=(pe.get(xe)||0)/Ae,_e=(ve.get(xe)||0)/Pe;je+=Math.abs(ze-_e)}return je/2}const rt=10;function fe(pe,Ae,ve){if(ve&&ve.numeric){const ze=c(pe,Ae),{n:_e,mean:Qe}=p(ze),Te=_e>0?Ut({mean:ve.mean,sd:ve.sd},Qe):null;return{measure:"standardizedMeanDifference",magnitude:Te,distance:Te===null?0:ft(Te),direction:Te===null?0:Math.sign(Te),subsetN:_e,populationN:ve.n||0,reliable:_e>=rt}}const{map:je,total:Ne}=dt(pe,Ae),xe=wt(je,Ne,ve.map,ve.total);return{measure:"categoricalTotalVariation",magnitude:xe,distance:xe===null?0:xe,direction:0,subsetN:Ne,populationN:ve.total||0,reliable:Ne>=rt}}function Ee(pe,Ae){if(pe&&(pe.kind==="float64"||pe.kind==="int32"))return!0;const ve=q(pe);let Pe=0,je=0;for(let Ne=0;Ne<Ae.length&&Pe<200;Ne++){const xe=ve(Ae[Ne]);if(xe==null||xe==="")continue;if(xe instanceof Date)return!1;Pe++;const ze=typeof xe=="number"?xe:Number(xe);Number.isFinite(ze)&&je++}return Pe===0?!1:je/Pe>=.9}function Be(pe,Ae){if(Ee(pe,Ae)){const je=c(pe,Ae),{n:Ne,mean:xe,m2:ze}=p(je);return{numeric:!0,mean:xe,sd:Ne>0?Math.sqrt(ze/Ne):0,n:Ne}}const{map:ve,total:Pe}=dt(pe,Ae);return{numeric:!1,map:ve,total:Pe}}}),Ue("packages/core/src/compute/total.js",function(e,H){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return f}}),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 $=H("packages/core/src/internal/predicates.js").isFunction,B=H("packages/core/src/internal/warn.js").warnOnce,x=H("packages/core/src/compute/handle.js"),Z=x.presenceReader,Y=x.valueComparator,U=x.valueReader,W=H("packages/core/src/compute/statistics.js"),K=W.STAT_FNS,E=W.STAT_LABELS;function O(m){return!!m&&(m.kind==="float64"||m.kind==="int32")}function b(m,v){const y=v.length;let T=0;if(O(m)){const M=m.values,_=Z(m);if(!_){for(let R=0;R<y;R++){const I=M[v[R]];Number.isNaN(I)||(T+=I)}return T}for(let R=0;R<y;R++){const I=v[R];if(_(I)===1){const j=M[I];Number.isNaN(j)||(T+=j)}}return T}const A=U(m);for(let M=0;M<y;M++){const _=c(A(v[M]));_!==null&&(T+=_)}return T}b.kernel=!0;function u(m,v){const y=v.length;let T=0;if(O(m)){const M=m.values,_=Z(m);if(!_){for(let R=0;R<y;R++)Number.isNaN(M[v[R]])||T++;return T}for(let R=0;R<y;R++){const I=v[R];_(I)===1&&!Number.isNaN(M[I])&&T++}return T}const A=U(m);for(let M=0;M<y;M++){const _=A(v[M]);_!=null&&!(typeof _=="number"&&Number.isNaN(_))&&T++}return T}u.kernel=!0;function h(m,v){return v.length}h.kernel=!0;function l(m,v){const y=u(m,v);return y===0?null:b(m,v)/y}l.kernel=!0;function r(m,v,y,T){const A=v.length;if(O(m)){const I=m.values,j=Z(m);let L=null;if(!j){for(let F=0;F<A;F++){const N=I[v[F]];Number.isNaN(N)||(L===null||(y<0?N<L:N>L))&&(L=N)}return L}for(let F=0;F<A;F++){const N=v[F];if(j(N)===0)continue;const S=I[N];Number.isNaN(S)||(L===null||(y<0?S<L:S>L))&&(L=S)}return L}const M=U(m),_=Y(T);let R=null;for(let I=0;I<A;I++){const j=M(v[I]);j==null||typeof j=="number"&&Number.isNaN(j)||(R===null||(y<0?_(j,R)<0:_(j,R)>0))&&(R=j)}return R}function n(m,v,y){return r(m,v,-1,y&&y.locale)}n.kernel=!0;function o(m,v,y){return r(m,v,1,y&&y.locale)}o.kernel=!0;function i(m,v){return v.length===0?null:U(m)(v[0])}i.kernel=!0;function t(m,v){return v.length===0?null:U(m)(v[v.length-1])}t.kernel=!0;function c(m){if(typeof m=="number")return Number.isNaN(m)?null:m;if(m==null||m===""||typeof m=="boolean")return null;if(m instanceof Date)return m.getTime();const v=Number(m);return Number.isNaN(v)?null:v}const s={sum:b,min:n,max:o,avg:l,count:h,first:i,last:t,countValues:u,...K},a=Object.freeze({...E,sum:"Sum",avg:"Average",min:"Min",max:"Max",count:"Count",countValues:"Count of values",first:"First",last:"Last"});function f(m){return m?typeof m=="string"?a[m]||m:"Total":""}const w=Object.freeze(["sum","avg","min","max","count","countValues","first","last"]);function g(m){const v=m&&m.dataType&&m.dataType.totals&&m.dataType.totals.supported;if(Array.isArray(v))return v.slice();const y=w.filter(T=>T in s);for(const T of Object.keys(s))y.includes(T)||y.push(T);return y}function k(m,v){return typeof v!="string"?!0:g(m).includes(v)}function d(m,v){const y=U(m),T=[];for(let A=0;A<v.length;A++){const M=y(v[A]);M!=null&&T.push(M)}return T}function p(m,v,y,T){const A=v||[];if(typeof y=="string"){const M=s[y];return M?M(m,A,T):(B(`total:${y}`,`unknown total function "${y}"; register it in config.totalFns`),null)}return $(y)?y.kernel===!0?y(m,A,T):y(d(m,A),T||{}):null}}),Ue("packages/core/src/compute/windowed.js",function(e,H){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const $=H("packages/core/src/compute/sketch.js").Welford;class q{#e;#t;#n=[];#r;#i;constructor(U,W=0,K=Date.now){if(U!=="count"&&U!=="time"&&U!=="session")throw new RangeError(`unknown window kind: ${U}`);if((U==="count"||U==="time")&&!(W>0))throw new RangeError(`a ${U} window needs a positive span`);this.#e=U,this.#t=Math.floor(W),this.#r=K,this.#i=K()}get size(){return this.#n.length}push(U,W=this.#r()){Number.isFinite(U)&&(this.#n.push({t:W,v:U}),this.#s(W))}#s(U){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const W=U-this.#t;for(;this.#n.length&&this.#n[0].t<W;)this.#n.shift()}}spec(){const U=this.#e==="session"?this.#r()-this.#i:this.#t;return{kind:this.#e,span:U,size:this.#n.length}}values(){return this.#n.map(U=>U.v)}aggregate(){const U=this.spec();if(!this.#n.length)return{over:U,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const W=new $;let K=0,E=1/0,O=-1/0;for(const{v:b}of this.#n)K+=b,b<E&&(E=b),b>O&&(O=b),W.add(b);return{over:U,count:this.#n.length,sum:K,mean:W.mean(),min:E,max:O,variance:W.variance(),stddev:W.stddev()}}reduce(U){const W=this.aggregate(),K={sum:W.sum,avg:W.mean,mean:W.mean,min:W.min,max:W.max,count:W.count,variance:W.variance,stddev:W.stddev};if(!(U in K))throw new RangeError(`unknown windowed aggregate: ${U}`);return{value:K[U],over:W.over}}}const B=Object.freeze(["count","time","session"]);function x(Y,U=Date.now){const W=Y.kind==="time"&&Y.minutes!=null?Y.minutes*6e4:Y.span??0;return new q(Y.kind,W,U)}const Z={Window:q,WINDOW_KINDS:B,openWindow:x}}),Ue("packages/core/src/compute/rolling.js",function(e,H){"use strict";Object.defineProperty(e,"ROLLING_WINDOW_FIELDS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"rollingWindow",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"rollingQuantile",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"seasonalDecompose",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"exponentialSmoothing",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});const $=H("packages/core/src/compute/windowed.js").openWindow,B=H("packages/core/src/compute/sketch.js").KLL,x=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function Z(s,a,f,w){if(s.kind==="count"){const g=Math.max(1,Math.floor(s.span||0));return{coverage:Math.min(1,a/g),partial:a<g}}if(s.kind==="time"){const g=s.minutes!=null?s.minutes*6e4:s.span||0;if(!(g>0))return{coverage:1,partial:!1};const k=f-w;return{coverage:Math.min(1,k/g),partial:k<g}}return{coverage:null,partial:!1}}function Y(s,a){const f=$(a),w=new Map,g=s.length?s[0].at:0;for(let k=0;k<s.length;k++){const{key:d,at:p,value:m}=s[k];Number.isFinite(m)&&f.push(m,p);const v=f.aggregate(),y=Z(a,v.count,p,g);d!=null&&w.set(String(d),{sum:v.sum,avg:v.mean,min:v.min,max:v.max,count:v.count,coverage:y.coverage,partial:y.partial})}return w}function U(s){const a=new Map;let f=0;for(const{key:w,value:g}of s)Number.isFinite(g)&&(f+=g),w!=null&&a.set(String(w),f);return a}function W(s,a=1){const f=new Map,w=Math.max(1,Math.floor(a));for(let g=0;g<s.length;g++){const{key:k,value:d}=s[g];if(k==null)continue;const p=g>=w?s[g-w].value:null,m=Number.isFinite(d)?d:null,v=Number.isFinite(p)?p:null;f.set(String(k),m!==null&&v!==null?m-v:null)}return f}const K=4096;function E(s){let a=s>>>0;return()=>{a+=1831565813;let f=a;return f=Math.imul(f^f>>>15,f|1),f^=f+Math.imul(f^f>>>7,f|61),((f^f>>>14)>>>0)/4294967296}}function O(s,a){const f=s.length;if(f===1)return s[0];const w=(f-1)*a,g=Math.floor(w),k=Math.ceil(w);return g===k?s[g]:s[g]+(w-g)*(s[k]-s[g])}function b(s,a,f={}){const w=Math.min(1,Math.max(0,f.q==null?.5:f.q)),g=Math.max(1,Math.floor(f.cap==null?K:f.cap)),k=E(f.seed==null?2654435769:f.seed),d=new Map,p=s.length?s[0].at:0;if(a.kind==="session"){const v=new B(200,k);let y=0;for(const{key:T,value:A}of s)Number.isFinite(A)&&(v.add(A),y++),T!=null&&d.set(String(T),{value:y?v.quantile(w):null,approx:y>0,count:y,coverage:null,partial:!1});return d}const m=$(a);for(const{key:v,at:y,value:T}of s){Number.isFinite(T)&&m.push(T,y);const A=m.values(),M=A.length;let _=null,R=!1;if(M)if(M<=g)_=O([...A].sort((j,L)=>j-L),w);else{const j=new B(200,k);for(const L of A)j.add(L);_=j.quantile(w),R=!0}const I=Z(a,M,y,p);v!=null&&d.set(String(v),{value:_,approx:R,count:M,coverage:I.coverage,partial:I.partial})}return d}function u(s,a){const f=s.length,w=new Array(f).fill(null),g=Math.floor(a/2),k=a%2===0;for(let d=0;d<f;d++){if(d-g<0||d+g>=f)continue;let p=0,m=!0;if(k)for(let v=-g;v<=g;v++){const y=s[d+v];if(!Number.isFinite(y)){m=!1;break}p+=v===-g||v===g?y*.5:y}else for(let v=-g;v<=g;v++){const y=s[d+v];if(!Number.isFinite(y)){m=!1;break}p+=y}m&&(w[d]=p/a)}return w}function h(s,a){const f=new Map,w=Math.floor(Number(a&&a.period));if(!(w>=2))return f;const g=a&&a.model==="multiplicative",k=s.length,d=s.map(R=>Number.isFinite(R.value)?R.value:null),p=u(d,w),m=new Array(k).fill(null);for(let R=0;R<k;R++){const I=p[R],j=d[R];I===null||j===null||(g?I!==0&&(m[R]=j/I):m[R]=j-I)}const v=new Array(w).fill(0),y=new Array(w).fill(0);for(let R=0;R<k;R++){if(m[R]===null)continue;const I=R%w;v[I]+=m[R],y[I]+=1}const T=g?1:0,A=v.map((R,I)=>y[I]?R/y[I]:T),M=A.reduce((R,I)=>R+I,0)/w,_=g?A.map(R=>M!==0?R/M:1):A.map(R=>R-M);for(let R=0;R<k;R++){const{key:I}=s[R];if(I==null)continue;const j=p[R],L=_[R%w],F=d[R];let N=null;j!==null&&F!==null&&(N=g?j*L!==0?F/(j*L):null:F-j-L),f.set(String(I),{trend:j,seasonal:F===null?null:L,residual:N,coverage:j===null?0:1,partial:j===null})}return f}function l(s,a,f,w=80){const g=(Math.sqrt(5)-1)/2;let k=a,d=f,p=d-g*(d-k),m=k+g*(d-k),v=s(p),y=s(m);for(let T=0;T<w;T++)v<y?(d=m,m=p,y=v,p=d-g*(d-k),v=s(p)):(k=p,p=m,v=y,m=k+g*(d-k),y=s(m));return(k+d)/2}const r=1e-4,n=1-1e-4;function o(s,a){const f=s.length,w=new Array(f).fill(null),g=new Array(f).fill(null);let k=null,d=0;for(let p=0;p<f;p++){const m=s[p];if(!Number.isFinite(m)){k!==null&&(g[p]=k,w[p]=k);continue}if(k===null){k=m,g[p]=m,w[p]=m;continue}g[p]=k,d+=(m-k)**2,k=a*m+(1-a)*k,w[p]=k}return{smoothed:w,fitted:g,sse:d}}function i(s,a,f){const w=s.length,g=new Array(w).fill(null),k=new Array(w).fill(null);let d=null,p=null,m=0;for(let v=0;v<w;v++){const y=s[v];if(!Number.isFinite(y)){d!==null&&(d+=p,g[v]=d);continue}if(d===null){d=y,g[v]=y;continue}if(p===null){p=y-d;const M=d+p;k[v]=M,m+=(y-M)**2;const _=d;d=a*y+(1-a)*(_+p),p=f*(d-_)+(1-f)*p,g[v]=d;continue}const T=d+p;k[v]=T,m+=(y-T)**2;const A=d;d=a*y+(1-a)*(A+p),p=f*(d-A)+(1-f)*p,g[v]=d}return{smoothed:g,fitted:k,sse:m}}function t(s,a={}){const f=new Map,w=a.method==="holt",g=s.map(T=>Number.isFinite(T.value)?T.value:null),k=g.filter(T=>T!==null).length,d=T=>Math.min(n,Math.max(r,T)),p=()=>{for(const{key:T}of s)T!=null&&f.set(String(T),{smoothed:null,fitted:null,alpha:null,beta:null,sse:null});return f};if(k<(w?2:1))return p();let m=Number.isFinite(a.alpha)?d(a.alpha):null,v=w&&Number.isFinite(a.beta)?d(a.beta):null;if(w){if(m===null||v===null){let T=m===null?.5:m,A=v===null?.5:v;for(let M=0;M<6;M++)m===null&&(T=l(_=>i(g,_,A).sse,r,n)),v===null&&(A=l(_=>i(g,T,_).sse,r,n));m=m===null?T:m,v=v===null?A:v}}else m===null&&(m=l(T=>o(g,T).sse,r,n));const y=w?i(g,m,v):o(g,m);for(let T=0;T<s.length;T++){const{key:A}=s[T];A!=null&&f.set(String(A),{smoothed:y.smoothed[T],fitted:y.fitted[T],alpha:m,beta:w?v:null,sse:y.sse})}return f}const c={ROLLING_WINDOW_FIELDS:x,QUANTILE_SPAN_CAP:K,rollingWindow:Y,rollingQuantile:b,cumulativeToDate:U,periodOverPeriod:W,seasonalDecompose:h,exponentialSmoothing:t}}),Ue("packages/core/src/compute/compare.js",function(e,H){"use strict";Object.defineProperty(e,"COMPARE_MEASURES",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"pooledStandardMeanDifference",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"numericSummary",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"bothNumeric",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"compareColumnAcross",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"compareDatasets",{enumerable:!0,get:function(){return u}});const ne=H("packages/core/src/compute/statistics.js"),$=ne.numbers,q=ne.moments,B=ne.frequencyMap,x=ne.categoricalDistance,Z=ne.normalTotalVariation,Y=ne.isNumericColumn,U=ne.SUBSET_RELIABILITY_FLOOR,W=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function K(h,l){if(!h||!l||!(h.n>0)||!(l.n>0)||!Number.isFinite(h.mean)||!Number.isFinite(l.mean))return null;const r=(h.n*h.sd*h.sd+l.n*l.sd*l.sd)/(h.n+l.n);return r>0?(h.mean-l.mean)/Math.sqrt(r):null}function E(h,l){const r=$(h,l),{n,mean:o,m2:i}=q(r),t=n>0?Math.sqrt(i/n):0;return{mean:o,sd:t,n}}function O(h,l,r,n){return Y(h,l)&&Y(r,n)}function b(h,l,r,n){if(O(h,l,r,n)){const c=E(h,l),s=E(r,n),a=K(c,s);return{measure:W.numeric,magnitude:a,distance:a===null?0:Z(a),direction:a===null?0:Math.sign(a),nA:c.n,nB:s.n,reliable:c.n>=U&&s.n>=U}}const o=B(h,l),i=B(r,n),t=x(o.map,o.total,i.map,i.total);return{measure:W.categorical,magnitude:t,distance:t===null?0:t,direction:0,nA:o.total,nB:i.total,reliable:o.total>=U&&i.total>=U}}function u(h,l,r={}){const n=new Set(h.columns),o=new Set(l.columns),i=h.columns.filter(f=>o.has(f)),t=Array.isArray(r.columns)&&r.columns.length?i.filter(f=>r.columns.includes(f)):i,c=h.indices(),s=l.indices(),a=[];for(const f of t){const w=h.handle(f),g=l.handle(f);if(!w||!g)continue;const k=b(w,c,g,s);a.push({column:f,name:h.name&&h.name(f)||l.name&&l.name(f)||f,measure:k.measure,magnitude:k.magnitude,distance:k.distance,direction:k.direction,nA:k.nA,nB:k.nB,reliable:k.reliable})}return a.sort((f,w)=>w.distance-f.distance||Math.abs(w.magnitude||0)-Math.abs(f.magnitude||0)),{ranked:a,nA:c.length,nB:s.length,unmatched:{onlyA:h.columns.filter(f=>!o.has(f)),onlyB:l.columns.filter(f=>!n.has(f))},measures:W}}}),Ue("packages/core/src/compute/anomaly.js",function(e,H){"use strict";Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DEFAULT_MODIFIED_Z_THRESHOLD",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return c}});const $=H("packages/core/src/compute/statistics.js").quantileSorted,B=H("packages/core/src/compute/special.js").logGamma,x=.6745,Z=3.5,Y=1.5,U=.975,W=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function K(s){if(!s.length)return null;const f=Array.from(s,Number).sort((d,p)=>d-p),w=$(f,.5),g=f.map(d=>Math.abs(d-w)).sort((d,p)=>d-p),k=$(g,.5);return{median:w,mad:k}}function E(s,a={}){const f=Number.isFinite(a.threshold)?a.threshold:Z,w=s.length,g=new Array(w).fill(null),k=new Array(w).fill(!1),d=[];for(let v=0;v<w;v++){const y=Number(s[v]);Number.isFinite(y)&&d.push(y)}if(!d.length)return{median:null,mad:null,threshold:f,scores:g,flags:k,flagged:0};const p=K(d);if(p.mad===0)return{median:p.median,mad:0,threshold:f,scores:g,flags:k,flagged:0};let m=0;for(let v=0;v<w;v++){const y=Number(s[v]);if(!Number.isFinite(y))continue;const T=x*(y-p.median)/p.mad;g[v]=T,Math.abs(T)>f&&(k[v]=!0,m++)}return{median:p.median,mad:p.mad,threshold:f,scores:g,flags:k,flagged:m}}function O(s,a={}){const f=Number.isFinite(a.k)?a.k:Y,w=[];for(let m=0;m<s.length;m++){const v=Number(s[m]);Number.isFinite(v)&&w.push(v)}if(!w.length)return null;const g=w.sort((m,v)=>m-v),k=$(g,.25),d=$(g,.75),p=d-k;return{q1:k,q3:d,iqr:p,lower:k-f*p,upper:d+f*p,k:f}}function b(s,a){if(a<=0)return 0;const f=B(s);if(a<s+1){let v=s,y=1/s,T=y;for(let A=0;A<1e3&&(v+=1,T*=a/v,y+=T,!(Math.abs(T)<Math.abs(y)*1e-15));A++);return y*Math.exp(-a+s*Math.log(a)-f)}const w=1e-300;let g=a+1-s,k=1/w,d=1/g,p=d;for(let v=1;v<1e3;v++){const y=-v*(v-s);g+=2,d=y*d+g,Math.abs(d)<w&&(d=w),k=g+y/k,Math.abs(k)<w&&(k=w),d=1/d;const T=d*k;if(p*=T,Math.abs(T-1)<1e-15)break}return 1-Math.exp(-a+s*Math.log(a)-f)*p}function u(s,a){return s<=0?0:b(a/2,s/2)}function h(s,a=U){if(!(a>0)||!(a<1))return NaN;let f=0,w=Math.max(1,s);for(;u(w,s)<a;)w*=2;for(let g=0;g<200;g++){const k=(f+w)/2;if(u(k,s)<a?f=k:w=k,w-f<1e-10)break}return(f+w)/2}function l(s){const a=s.length,f=s.map((w,g)=>{const k=w.slice();for(let d=0;d<a;d++)k.push(g===d?1:0);return k});for(let w=0;w<a;w++){let g=w;for(let d=w+1;d<a;d++)Math.abs(f[d][w])>Math.abs(f[g][w])&&(g=d);if(Math.abs(f[g][w])<1e-12)return null;if(g!==w){const d=f[g];f[g]=f[w],f[w]=d}const k=f[w][w];for(let d=0;d<2*a;d++)f[w][d]/=k;for(let d=0;d<a;d++){if(d===w)continue;const p=f[d][w];if(p!==0)for(let m=0;m<2*a;m++)f[d][m]-=p*f[w][m]}}return f.map(w=>w.slice(a))}function r(s,a){const f=s.length,w=new Array(a).fill(0);for(const d of s)for(let p=0;p<a;p++)w[p]+=d[p];for(let d=0;d<a;d++)w[d]/=f;const g=Array.from({length:a},()=>new Array(a).fill(0));for(const d of s)for(let p=0;p<a;p++){const m=d[p]-w[p];for(let v=p;v<a;v++)g[p][v]+=m*(d[v]-w[v])}const k=f>1?f-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:w,cov:g}}function n(s,a={}){const f=Number.isFinite(a.p)?a.p:U,w=Number.isFinite(a.ridge)?a.ridge:1e-6,g=s.length;if(!g)return null;const k=s[0].length;if(!k)return null;const d=new Array(g).fill(null),p=new Array(g).fill(null),m=new Array(g).fill(!1),v=[],y=[];for(let L=0;L<g;L++){const F=s[L];let N=F.length===k;const S=new Array(k);for(let C=0;N&&C<k;C++){const D=Number(F[C]);Number.isFinite(D)?S[C]=D:N=!1}N&&(v.push(L),y.push(S))}const T=k,A=h(T,f);if(y.length<=k)return{center:[],df:T,cutoff:A,singular:!0,used:y.length,distances:d,squared:p,flags:m,flagged:0};const{mean:M,cov:_}=r(y,k);let R=l(_),I=!1;if(!R){I=!0;let L=0;for(let S=0;S<k;S++)L+=_[S][S];const F=L/k*w||w,N=_.map((S,C)=>S.map((D,G)=>C===G?D+F:D));if(R=l(N),!R)return{center:M,df:T,cutoff:A,singular:!0,used:y.length,distances:d,squared:p,flags:m,flagged:0}}let j=0;for(let L=0;L<y.length;L++){const F=y[L],N=new Array(k);for(let D=0;D<k;D++)N[D]=F[D]-M[D];let S=0;for(let D=0;D<k;D++){let G=0;for(let X=0;X<k;X++)G+=R[D][X]*N[X];S+=N[D]*G}S<0&&(S=0);const C=v[L];p[C]=S,d[C]=Math.sqrt(S),S>A&&(m[C]=!0,j++)}return{center:M,df:T,cutoff:A,singular:I,used:y.length,distances:d,squared:p,flags:m,flagged:j}}const o=20,i=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function t(s,a={}){const f=a.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",w=Number.isFinite(a.windowLen)&&a.windowLen>=1?Math.floor(a.windowLen):o,g=Number.isFinite(a.threshold)?a.threshold:Z,k=Number.isFinite(a.k)?a.k:Y,d=Number.isFinite(a.minPeriods)&&a.minPeriods>=1?Math.floor(a.minPeriods):w,p=s.length,m=new Array(p).fill(null),v=new Array(p).fill(!1);let y=0;for(let T=0;T<p;T++){const A=Number(s[T]);if(!Number.isFinite(A))continue;const M=Math.max(0,T-w+1),_=[];for(let R=M;R<=T;R++){const I=Number(s[R]);Number.isFinite(I)&&_.push(I)}if(!(_.length<d))if(f==="rollingIqr"){const R=O(_,{k});if(!R)continue;(A<R.lower||A>R.upper)&&(v[T]=!0,y++)}else{const R=K(_);if(!R||R.mad===0)continue;const I=x*(A-R.median)/R.mad;m[T]=I,Math.abs(I)>g&&(v[T]=!0,y++)}}return{method:f,windowLen:w,minPeriods:d,threshold:g,k,scores:m,flags:v,flagged:y}}function c(s={}){const a=s||{},f=a.field;if(typeof f!="string"||!f)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const w=a.method||"modifiedZScore";if(!(W.includes(w)||i.includes(w))||w==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${w}'`);const k=typeof a.orderBy=="string"?a.orderBy:null,d=a.latest===!0,p=i.includes(w),m=v=>Number(v==null?NaN:v[f]);return v=>{const y=Array.isArray(v)?v.slice():[...v];k&&y.sort((R,I)=>{const j=R?.[k],L=I?.[k];return j===L?0:j==null?-1:L==null?1:j<L?-1:1});const T=y.map(m);let A,M;if(p)({flags:A,scores:M}=t(T,{method:w,windowLen:a.windowLen,threshold:a.threshold,k:a.k,minPeriods:a.minPeriods}));else if(w==="iqr"){const R=O(T,{k:a.k});A=T.map(I=>R?Number.isFinite(I)&&(I<R.lower||I>R.upper):!1),M=T.map(()=>null)}else({flags:A,scores:M}=E(T,{threshold:a.threshold}));if(d){const R=A.length-1;return R<0||!A[R]?!1:{method:w,field:f,flagged:[{row:y[R],score:M[R]}]}}const _=[];for(let R=0;R<A.length;R++)A[R]&&_.push({row:y[R],score:M[R]});return _.length?{method:w,field:f,flagged:_}:!1}}}),Ue("packages/core/src/compute/forecast.js",function(e,H){"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 s}});const ne=H("packages/core/src/compute/special.js"),$=ne.normalQuantile,q=ne.studentTQuantile,x=H("packages/core/src/internal/warn.js").warnOnce,Z=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),Y=1e-4,U=1-1e-4;function W(a){const f=[];for(let w=0;w<a.length;w++){const g=a[w];if(g!==null&&typeof g=="object"){const k=Number.isFinite(g.at)?g.at:w,d=Number.isFinite(g.value)?g.value:null;f.push({at:k,value:d})}else f.push({at:w,value:Number.isFinite(g)?Number(g):null})}return f}function K(a){const f=a.filter(p=>p.value!==null),w=f[0],g=f[f.length-1],k=g.at-w.at,d=f.length>1&&k>0?k/(f.length-1):1;return{lastAt:g.at,step:d}}function E(a){return Math.min(U,Math.max(Y,a))}function O(a,f=Y,w=U,g=80){const k=(Math.sqrt(5)-1)/2;let d=f,p=w,m=p-k*(p-d),v=d+k*(p-d),y=a(m),T=a(v);for(let A=0;A<g;A++)y<T?(p=v,v=m,T=y,m=p-k*(p-d),y=a(m)):(d=m,m=v,y=T,v=d+k*(p-d),T=a(v));return(d+p)/2}function b(a,f){let w=null,g=0,k=0;for(let d=0;d<a.length;d++){const p=a[d];if(p!==null){if(w===null){w=p;continue}g+=(p-w)**2,k+=1,w=f*p+(1-f)*w}}return{level:w,sse:g,m:k}}function u(a,f,w){let g=null,k=null,d=0,p=0;for(let m=0;m<a.length;m++){const v=a[m];if(v===null){g!==null&&k!==null&&(g+=k);continue}if(g===null){g=v;continue}k===null&&(k=v-g);const y=g+k;d+=(v-y)**2,p+=1;const T=g;g=f*v+(1-f)*(T+k),k=w*(g-T)+(1-w)*k}return{level:g,trend:k,sse:d,m:p}}function h(a,f,w,g,k){const d=a.length;if(d<2*f)return null;const p=I=>{let j=0,L=0;for(let F=I;F<I+f&&F<d;F++)a[F]!==null&&(j+=a[F],L+=1);return L?j/L:null},m=p(0),v=p(f);if(m===null||v===null)return null;let y=m,T=(v-m)/f;const A=new Array(f).fill(0);for(let I=0;I<f;I++)A[I]=a[I]===null?0:a[I]-y;const M=A.reduce((I,j)=>I+j,0)/f;for(let I=0;I<f;I++)A[I]-=M;let _=0,R=0;for(let I=f;I<d;I++){const j=I%f,L=A[j],F=a[I];if(F===null){y+=T;continue}const N=y+T+L;_+=(F-N)**2,R+=1;const S=y;y=w*(F-L)+(1-w)*(y+T),T=g*(y-S)+(1-g)*T,A[j]=k*(F-y)+(1-k)*L}return{level:y,trend:T,season:A,phase:(d-1)%f,sse:_,count:R}}function l(a,f,w){let g=1;for(const d of f)g+=d*d;const k=Math.sqrt(a*g);return{se:k,margin:w*k}}function r(a,f={}){if(!a||typeof a.length!="number"||a.length===0)return null;const w=Z.includes(f.method)?f.method:"linear",g=Math.max(1,Math.floor(Number(f.horizon)||1)),k=Number.isFinite(f.confidence)&&f.confidence>0&&f.confidence<1?f.confidence:.95,d=1-(1-k)/2,p=W(a),m=p.map(_=>_.value),v=m.filter(_=>_!==null),y=v.length,{lastAt:T,step:A}=y?K(p):{lastAt:0,step:1},M=_=>T+_*A;return w==="linear"?n(p,y,g,k,d,M):w==="movingAverage"?o(v,y,g,k,d,f,M):w==="ses"?i(m,y,g,k,d,f,M):w==="holt"?t(m,y,g,k,d,f,M):c(m,y,g,k,d,f,M)}function n(a,f,w,g,k,d){if(f<2)return null;let p=0,m=0;for(const F of a)F.value!==null&&(p+=F.at,m+=F.value);p/=f,m/=f;let v=0,y=0,T=0;for(const F of a){if(F.value===null)continue;const N=F.at-p,S=F.value-m;v+=N*N,y+=N*S,T+=S*S}if(v===0)return null;const A=y/v,M=m-A*p,_=T===0?1:Math.max(0,Math.min(1,y*y/(v*T))),R=Math.max(0,T-A*y),I=f>2?Math.sqrt(R/(f-2)):null,j=f>2?q(k,f-2):null,L=[];for(let F=1;F<=w;F++){const N=d(F),S=M+A*N;let C=null,D=null,G=null,X=null,V=null;if(I!==null){const J=1/f+(N-p)**2/v,ee=I*Math.sqrt(1+J),te=I*Math.sqrt(J);V=ee,C=S-j*ee,D=S+j*ee,G=S-j*te,X=S+j*te}L.push({step:F,at:N,mean:S,lower:C,upper:D,lowerMean:G,upperMean:X,se:V})}return{method:"linear",horizon:w,confidence:g,n:f,sigma:I,r2:_,params:{slope:A,intercept:M},points:L}}function o(a,f,w,g,k,d,p){if(f<1)return null;const m=Math.max(1,Math.min(f,Math.floor(Number(d.windowLen)||f))),v=a.slice(f-m);let y=0;for(const I of v)y+=I;const T=y/m;let A=null,M=null;if(m>1){let I=0;for(const L of v)I+=(L-T)**2;A=Math.sqrt(I/(m-1))*Math.sqrt(1+1/m),M=q(k,m-1)}const _=A===null?null:M*A,R=[];for(let I=1;I<=w;I++)R.push({step:I,at:p(I),mean:T,lower:_===null?null:T-_,upper:_===null?null:T+_,se:A});return{method:"movingAverage",horizon:w,confidence:g,n:f,sigma:A===null?null:A,params:{windowLen:m},points:R}}function i(a,f,w,g,k,d,p){if(f<1)return null;let m=Number.isFinite(d.alpha)?E(d.alpha):null;m===null&&(m=O(M=>b(a,M).sse));const v=b(a,m),y=$(k),T=v.m>0?v.sse/v.m:null,A=[];for(let M=1;M<=w;M++){const _=v.level;let R=null,I=null,j=null;if(T!==null){const L=[];for(let N=1;N<M;N++)L.push(m);const F=l(T,L,y);j=F.se,R=_-F.margin,I=_+F.margin}A.push({step:M,at:p(M),mean:_,lower:R,upper:I,se:j})}return{method:"ses",horizon:w,confidence:g,n:f,sigma:T===null?null:Math.sqrt(T),params:{alpha:m},points:A}}function t(a,f,w,g,k,d,p){if(f<2)return null;let m=Number.isFinite(d.alpha)?E(d.alpha):null,v=Number.isFinite(d.beta)?E(d.beta):null;if(m===null||v===null){let R=m===null?.5:m,I=v===null?.5:v;for(let j=0;j<6;j++)m===null&&(R=O(L=>u(a,L,I).sse)),v===null&&(I=O(L=>u(a,R,L).sse));m=m===null?R:m,v=v===null?I:v}const y=u(a,m,v),T=$(k),A=y.m>0?y.sse/y.m:null,M=m*v,_=[];for(let R=1;R<=w;R++){const I=y.level+R*y.trend;let j=null,L=null,F=null;if(A!==null){const N=[];for(let C=1;C<R;C++)N.push(m+C*M);const S=l(A,N,T);F=S.se,j=I-S.margin,L=I+S.margin}_.push({step:R,at:p(R),mean:I,lower:j,upper:L,se:F})}return{method:"holt",horizon:w,confidence:g,n:f,sigma:A===null?null:Math.sqrt(A),params:{alpha:m,beta:v},points:_}}function c(a,f,w,g,k,d,p){const m=Math.floor(Number(d.period));if(!(m>=2))return x("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(f<2*m)return null;let v=Number.isFinite(d.alpha)?E(d.alpha):null,y=Number.isFinite(d.beta)?E(d.beta):null,T=Number.isFinite(d.gamma)?E(d.gamma):null;const A=(F,N,S)=>{const C=h(a,m,F,N,S);return C?C.sse:1/0};if(v===null||y===null||T===null){let F=v===null?.5:v,N=y===null?.5:y,S=T===null?.5:T;for(let C=0;C<8;C++)v===null&&(F=O(D=>A(D,N,S))),y===null&&(N=O(D=>A(F,D,S))),T===null&&(S=O(D=>A(F,N,D)));v=v===null?F:v,y=y===null?N:y,T=T===null?S:T}const M=h(a,m,v,y,T);if(!M)return null;const _=$(k),R=M.count>0?M.sse/M.count:null,I=v*y,j=T*(1-v),L=[];for(let F=1;F<=w;F++){const N=M.season[(M.phase+F)%m],S=M.level+F*M.trend+N;let C=null,D=null,G=null;if(R!==null){const X=[];for(let J=1;J<F;J++)X.push(v+J*I+(J%m===0?j:0));const V=l(R,X,_);G=V.se,C=S-V.margin,D=S+V.margin}L.push({step:F,at:p(F),mean:S,lower:C,upper:D,se:G})}return{method:"holtWinters",horizon:w,confidence:g,n:f,sigma:R===null?null:Math.sqrt(R),params:{alpha:v,beta:y,gamma:T,period:m},points:L}}const s={FORECAST_METHODS:Z,forecast:r}}),Ue("packages/core/src/compute/hypothesis.js",function(e,H){"use strict";Object.defineProperty(e,"GROUP_TESTS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NORMALITY_ALPHA",{enumerable:!0,get:function(){return s}}),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 v}}),Object.defineProperty(e,"chiSquareTest",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return _}});const $=H("packages/core/src/internal/warn.js").warnOnce,B=H("packages/core/src/compute/handle.js").valueReader,x=H("packages/core/src/compute/statistics.js"),Z=x.numbers,Y=x.moments,U=x.frequencyMap,W=x.categoricalDistance,K=x.isNumericColumn,E=x.jarqueBera,O=x.proportionInterval,b=x.SUBSET_RELIABILITY_FLOOR,h=H("packages/core/src/compute/compare.js").pooledStandardMeanDifference,l=H("packages/core/src/compute/special.js"),r=l.studentT,n=l.studentTQuantile,o=l.normalCdf,i=l.normalQuantile,t=l.chiSquareUpperTail,c=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),s=.05,a=2e6;function f(R){const I=Number(R);return Number.isFinite(I)&&I>0&&I<1?I:.95}function w(R){const{n:I,mean:j,m2:L}=Y(R);return{mean:j,sd:I>0?Math.sqrt(L/I):0,n:I}}function g(R,I){const j=R.length;if(j<2)return 0;let L=0;for(let F=0;F<j;F++){const N=R[F]-I;L+=N*N}return L/(j-1)}function k(R,I){return{name:"pooledStandardMeanDifference",value:h(w(R),w(I))}}function d(R,I,j){const L=R.length,F=I.length;if(L<2||F<2)return null;const N=f(j),{mean:S}=Y(R),{mean:C}=Y(I),D=g(R,S),G=g(I,C),X=D/L+G/F;if(!(X>0))return null;const V=Math.sqrt(X),J=(S-C)/V,ee=D/L*(D/L)/(L-1),te=G/F*(G/F)/(F-1),ie=X*X/(ee+te),oe=Math.min(1,Math.max(0,2*(1-r(Math.abs(J),ie)))),ue=S-C,ye=n(1-(1-N)/2,ie)*V;return{test:c.WELCH,statistic:J,statisticName:"t",df:ie,pValue:oe,interval:{estimate:ue,lower:ue-ye,upper:ue+ye,confidence:N,method:"welch-t (difference of means)"},effectSize:k(R,I),nA:L,nB:F,reliable:L>=b&&F>=b,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function p(R){const I=R.length;if(I===0)return Number.NaN;const j=I>>1;return I%2?R[j]:(R[j-1]+R[j])/2}function m(R,I,j){const L=R.length,F=I.length,N=L*F;if(N===0||N>a)return null;const S=new Float64Array(N);let C=0;for(let ee=0;ee<L;ee++)for(let te=0;te<F;te++)S[C++]=R[ee]-I[te];S.sort();const D=p(S),G=Math.sqrt(L*F*(L+F+1)/12),X=i(1-(1-j)/2);let V=Math.round(N/2-X*G);V>=0||(V=0);const J=Math.floor((N-1)/2);return V>J&&(V=J),{estimate:D,lower:S[V],upper:S[N-1-V],confidence:j,method:"hodges-lehmann (normal approximation)"}}function v(R,I,j){const L=R.length,F=I.length;if(L<1||F<1)return null;const N=f(j),S=L+F,C=new Array(S);for(let oe=0;oe<L;oe++)C[oe]={v:R[oe],g:0};for(let oe=0;oe<F;oe++)C[L+oe]={v:I[oe],g:1};C.sort((oe,ue)=>oe.v-ue.v);let D=0,G=0,X=0;for(;X<S;){let oe=X;for(;oe<S&&C[oe].v===C[X].v;)oe++;const ue=oe-X,ye=(X+1+oe)/2;for(let he=X;he<oe;he++)C[he].g===0&&(D+=ye);G+=ue*ue*ue-ue,X=oe}const V=D-L*(L+1)/2,J=L*F/2,ee=L*F/12*(S+1-G/(S*(S-1)));let te=1;if(ee>0){const oe=Math.max(0,Math.abs(V-J)-.5);te=Math.min(1,2*o(-oe/Math.sqrt(ee)))}const ie=m(R,I,N);return{test:c.MANN_WHITNEY,statistic:V,statisticName:"U",df:null,pValue:te,interval:ie,effectSize:k(R,I),nA:L,nB:F,reliable:L>=b&&F>=b,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function y(R,I,j,L,F){const N=O(R,I,F),S=O(j,L,F);if(!N||!S)return null;const C=N.proportion-S.proportion,D=C-Math.sqrt((N.proportion-N.lower)**2+(S.upper-S.proportion)**2),G=C+Math.sqrt((N.upper-N.proportion)**2+(S.proportion-S.lower)**2);return{lower:D,upper:G}}function T(R,I,j,L,F,N={}){if(!(I>0)||!(L>0))return null;const S=new Set([...R.keys(),...j.keys()]),C=S.size;if(C<2)return null;const D=I+L;let G=0;for(const te of S){const ie=R.get(te)||0,oe=j.get(te)||0,ue=ie+oe,ye=I*ue/D,he=L*ue/D;ye>0&&(G+=(ie-ye)*(ie-ye)/ye),he>0&&(G+=(oe-he)*(oe-he)/he)}const X=C-1,V=t(G,X);let J=null;N.category!==void 0&&S.has(N.category)?J=N.category:C===2&&([J]=[...S]);let ee=null;if(J!==null){const te=y(R.get(J)||0,I,j.get(J)||0,L,f(F));te&&(ee={estimate:(R.get(J)||0)/I-(j.get(J)||0)/L,lower:te.lower,upper:te.upper,confidence:f(F),method:"newcombe (difference in this category's share)",category:J})}return{test:c.CHI_SQUARE,statistic:G,statisticName:"chiSquare",df:X,pValue:V,interval:ee,effectSize:{name:"categoricalTotalVariation",value:W(R,I,j,L)},nA:I,nB:L,reliable:I>=b&&L>=b,method:"Pearson chi-square test of independence (2×k, no continuity correction)"}}function A(R){return R==null||R===""||typeof R=="number"&&Number.isNaN(R)?null:R instanceof Date?R.getTime():typeof R=="object"?String(R):R}function M(R,I,j){if(j===c.WELCH||j===c.MANN_WHITNEY)return{test:j,chosenBy:"override",reason:`caller override: ${j}`};const L=E(R),F=E(I),N=L===null?null:Math.exp(-L/2),S=F===null?null:Math.exp(-F/2);return N!==null&&N<s||S!==null&&S<s?{test:c.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${s})`}:{test:c.WELCH,chosenBy:"auto",reason:N!==null||S!==null?"column family: numeric, no departure from normality detected":"column family: numeric (too few rows to screen normality)"}}function _(R,I,j,L={}){if(!R||!I)return null;const F=f(L.confidence),N=B(I);let S;if(Array.isArray(L.groups)&&L.groups.length===2)S=[A(L.groups[0]),A(L.groups[1])];else{const{map:oe}=U(I,j),ue=[...oe.entries()].sort((ye,he)=>he[1]-ye[1]).slice(0,2).map(ye=>ye[0]);if(ue.length<2)return $("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;S=ue}const[C,D]=S;if(C===null||D===null||C===D)return $("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const G=[],X=[];for(let oe=0;oe<j.length;oe++){const ue=A(N(j[oe]));ue===C?G.push(j[oe]):ue===D&&X.push(j[oe])}if(G.length===0||X.length===0)return $("compareGroups:empty","[lattice] compareGroups: one of the two groups has no rows in the current set."),null;const V=L.test&&L.test!=="auto"?String(L.test):null,J=K(R,G.concat(X));let ee,te,ie;if(V===c.CHI_SQUARE||!V&&!J){te=V?"override":"auto",ie=V?"caller override: chiSquare":"column family: categorical";const oe=U(R,G),ue=U(R,X);ee=T(oe.map,oe.total,ue.map,ue.total,F,{category:L.category})}else{if((V===c.WELCH||V===c.MANN_WHITNEY)&&!J)return $("compareGroups:numeric-override",`[lattice] compareGroups: ${V} needs a numeric column, but the column is not numeric.`),null;const oe=Z(R,G),ue=Z(R,X),ye=M(oe,ue,V);te=ye.chosenBy,ie=ye.reason,ee=ye.test===c.MANN_WHITNEY?v(oe,ue,F):d(oe,ue,F)}return ee?{...ee,chosenBy:te,reason:ie,groups:[C,D]}:($("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,H){"use strict";Object.defineProperty(e,"DETAIL_COLUMN_ID",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"createDetailColumn",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return B}});const ne="__lattice_detail",$=36;function q(x){const Z=x.config&&x.config.detailColumnWidth||$;return{id:ne,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:x.config&&x.config.detailColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(Y,U){return!!(U&&U.expanded)},formatValue(){return""}}}const B=q}),Ue("packages/core/src/columns/treecolumn.js",function(e,H){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createTreeColumn",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const $=H("packages/core/src/internal/predicates.js").isFunction,q="__lattice_tree",B=260;function x(Y){const U=Y.tree||{},W=Y.config&&Y.config.treeColumnWidth||B,K=()=>(Y.columns&&$(Y.columns.visible)?Y.columns.visible():[]).find(u=>!u.generated)||null,E=(b,u)=>{if(u&&u.group)return u.groupValue;if($(U.label))return U.label(b,u);if(typeof U.label=="string")return b==null?null:b[U.label];const h=K();return h&&$(h.getValue)?h.getValue(b,u):null},O=()=>{if(U.title)return U.title;const b=typeof U.label=="string"?Y.columns&&$(Y.columns.get)?Y.columns.get(U.label):null:K();return b&&(b.title||b.id)||"Hierarchy"};return{id:q,get title(){return O()},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:W,min:140,pin:Y.config&&Y.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(b,u){return E(b,u)},formatValue(b,u){if(u&&u.grandTotal)return Y.config&&Y.config.grandTotalLabel||"Total";if(b==null)return"";if(!U.label){const h=K();if(h&&$(h.formatValue))return h.formatValue(b,u)}return String(b)}}}const Z=x}),Ue("packages/core/src/columns/pivotcolumns.js",function(e,H){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return x}});const $=H("packages/core/src/internal/warn.js").warnOnce,q="__lattice_pivot",B=500;function x(W){const{pivot:K,valueColumns:E,config:O}=W,b=K&&K.paths||[],u=W.separator||O&&O.pivot&&O.pivot.separator||" | ",h=O&&O.pivot&&O.pivot.maxColumns||B;if(!b.length||!E.length)return{tree:[],leaves:[],error:null};const l=Z(O),r=b.length*E.length+(l?E.length:0);if(r>h){const i=`pivot would generate ${r} columns, above the limit of ${h}. Pivot on a lower-cardinality column, or raise pivot.maxColumns.`;return $(`pivot.maxColumns:${r}`,i),{tree:[],leaves:[],error:i}}const n=[],o=[];for(const i of b){const t=[];for(const c of E){const s=U(i,c,u);t.push(s),o.push(s)}t.length===1?(t[0].title=String(i),n.push(t[0])):n.push({id:`${q}:group:${i}`,title:String(i),columns:t,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(l){const i=E.map(c=>Y(c,O));o.push(...i);const t=O&&O.pivot&&O.pivot.totalsLabel||"Total";if(i.length===1)i[0].title=t,l==="before"?n.unshift(i[0]):n.push(i[0]);else{const c={id:`${q}:group:__totals`,title:t,columns:i,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};l==="before"?n.unshift(c):n.push(c)}}return{tree:n,leaves:o,error:null}}function Z(W){const K=W&&W.pivot&&W.pivot.groupTotals;return K==="before"||K==="after"?K:null}function Y(W,K){return{id:`${q}:__total${K&&K.pivot&&K.pivot.separator||" | "}${W.id}`,field:null,title:W.title||W.id,type:W.type,dataType:W.dataType,nullable:!0,align:W.align,generated:!0,pivot:{enabled:!1,index:0,sourceId:W.id,total:!0},value:{pure:!0},cell:{align:W.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:W.total,lookup:null,layout:{width:W.layout&&W.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(E,O){const b=O&&O.totals;return b&&Object.hasOwn(b,W.id)?b[W.id]:null},formatValue(E,O){return E==null?"":W.formatValue?W.formatValue(E,O):String(E)}}}function U(W,K,E){return{id:`${q}:${W}${E}${K.id}`,field:null,title:K.title||K.id,type:K.type,dataType:K.dataType,nullable:!0,align:K.align,generated:!0,pivot:{enabled:!1,index:0,path:W,sourceId:K.id},value:{pure:!0},cell:{align:K.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:K.total,lookup:null,layout:{width:K.layout&&K.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(){return null},formatValue(O,b){return O==null?"":K.formatValue?K.formatValue(O,b):String(O)}}}}),Ue("packages/core/src/compute/group.js",function(e,H){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return O}});const ne=H("packages/core/src/compute/handle.js"),$=ne.dictSize,q=ne.identity,B=ne.presenceReader,x=ne.rowCount,Z=ne.valueReader,Y="",U="\0",W=1<<20;function K(b,u,h,l){const r=b.length,n=b.map(a=>Z(a)),o=Array.isArray(l)&&l.some(Boolean),i=o?n.map((a,f)=>l[f]?w=>l[f](a(w)):a):n;if(!o&&r>0&&b.every(a=>a&&a.kind==="dictionary"&&a.dict)){const a=b.map(w=>$(w.dict)+1);let f=1;for(let w=0;w<r;w++)f*=a[w];if(f<=Number.MAX_SAFE_INTEGER){const w=b.map(p=>p.values),g=b.map(p=>B(p)),k=p=>{let m=0;for(let v=0;v<r;v++){const y=g[v],T=y&&y(p)===0?a[v]-1:w[v][p];m=m*a[v]+T}return m},d=new Float64Array(h);for(let p=0;p<h;p++)d[p]=k(u[p]);return{packed:d,strings:null,product:f,readers:i,keyOf:k}}}const c=a=>{let f="";for(let w=0;w<r;w++){const g=i[w](a);f+=(w===0?"":Y)+(g==null?U:String(g))}return f},s=new Array(h);for(let a=0;a<h;a++)s[a]=c(u[a]);return{packed:null,strings:s,product:1/0,readers:i,keyOf:c}}function E(b,u,h,l){const r=new Uint32Array(l+1);for(let t=0;t<h;t++)r[u[t]+1]++;for(let t=0;t<l;t++)r[t+1]+=r[t];const n=new Uint32Array(h),o=r.slice(0,l);for(let t=0;t<h;t++)n[o[u[t]]++]=b[t];const i=new Array(l);for(let t=0;t<l;t++)i[t]=n.subarray(r[t],r[t+1]);return i}function O(b,u,h={}){const l=b||[],r=u||q(x(l[0],h)),n=r.length;if(l.length===0||n===0)return{keys:[],buckets:[]};const{packed:o,strings:i,product:t,readers:c}=K(l,r,n,h.project),s=new Uint32Array(n);let a=0,f=null;if(o&&t<=Math.max(1024,Math.min(W,n*4))){const d=t,p=new Int32Array(d).fill(-1);for(let m=0;m<n;m++)p[o[m]]=0;for(let m=0;m<d;m++)p[m]===0&&(p[m]=a++);for(let m=0;m<n;m++)s[m]=p[o[m]];f=new Float64Array(a);for(let m=0;m<d;m++)p[m]>=0&&(f[p[m]]=m)}else if(o){const d=new Map;for(let p=0;p<n;p++){const m=o[p];let v=d.get(m);v===void 0&&(v=a++,d.set(m,v)),s[p]=v}f=new Float64Array(a);for(const[p,m]of d)f[m]=p}else{const d=new Map;for(let p=0;p<n;p++){const m=i[p];let v=d.get(m);v===void 0&&(v=a++,d.set(m,v)),s[p]=v}}const w=E(r,s,n,a),g=new Array(a);for(let d=0;d<a;d++){const p=w[d][0],m=new Array(c.length);for(let v=0;v<c.length;v++)m[v]=c[v](p);g[d]=m}const k={keys:g,buckets:w};return f&&(k.packed=f),k}}),Ue("packages/core/src/compute/pivot.js",function(e,H){"use strict";Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return n}});const $=H("packages/core/src/internal/warn.js").warnOnce,B=H("packages/core/src/compute/handle.js").valueComparator,Z=H("packages/core/src/compute/group.js").packKeys,U=H("packages/core/src/compute/total.js").total,W="|",K="/",E=2e3;function O(t,c,s){return`${t}${W}${c}${W}${s}`}function b(t,c){let s="";for(let a=0;a<t.length;a++){const f=t[a];s+=(a===0?"":c)+(f==null?"":String(f))}return s}function u(t,c,s={}){const a=s.separator||K,f=c.length,{keyOf:w,readers:g}=Z(t,c,0),k=new Map,d=[],p=[];for(let _=0;_<f;_++){const R=c[_],I=w(R);if(k.has(I))continue;k.set(I,d.length),p.push(I);const j=new Array(g.length);for(let L=0;L<g.length;L++)j[L]=g[L](R);d.push(j)}const m=B(s.locale),v=d.map((_,R)=>R);v.sort((_,R)=>{const I=d[_],j=d[R];for(let L=0;L<I.length;L++){const F=h(I[L],j[L],m);if(F!==0)return F}return _-R});const y=new Array(v.length),T=new Array(v.length),A=new Map;for(let _=0;_<v.length;_++){const R=v[_];y[_]=d[R],T[_]=b(d[R],a),A.set(p[R],_)}return{keys:y,paths:T,idOf:_=>{const R=A.get(w(_));return R===void 0?-1:R}}}function h(t,c,s){const a=t==null,f=c==null;return a||f?a&&f?0:a?1:-1:s(t,c)}function l(t){const c=t.values||t.totals||[];if(c.length&&typeof c[0]=="object"&&c[0]!==null)return c.filter(w=>w&&w.handle);const s=typeof t.handle=="function"?t.handle:null;if(!s)return c.length&&$("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 t.totalOf=="function"?t.totalOf:null,f=[];for(const w of c){const g=s(w);g&&f.push({colId:w,handle:g,fn:a?a(w):"sum"})}return f}function r(t,c,s){if(Array.isArray(t)){const a=s||{};return{...a,pivotHandles:t,order:c||null,groups:a.groups||null}}return t||{}}function n(t,c,s){const a=r(t,c,s),f=a.separator||K,w=l(a),g=a.maxColumns===void 0?E: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(I=>b(I,f)):[""]),m=i(d),{keys:v,paths:y,idOf:T}=u(a.pivotHandles||[],m,a),A=y.length*Math.max(1,w.length),M=o(y,w,f);if(g&&A>g){const I=new Map;return{keys:v,paths:y,fields:M,groupPaths:p,columns:A,values:I,cells:I,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${A} columns, above pivot.maxColumns of ${g}. Narrow the pivot columns or raise the limit.`,columns:A,maxColumns:g}}}const _=new Map,R=y.length;for(let I=0;I<d.length;I++){const j=d[I],L=p[I]===void 0?"":p[I],F=j.length;if(F===0)continue;const N=new Int32Array(F),S=new Uint32Array(R+1);for(let G=0;G<F;G++){const X=T(j[G]);N[G]=X,X>=0&&S[X+1]++}for(let G=0;G<R;G++)S[G+1]+=S[G];const C=new Uint32Array(F),D=S.slice(0,R);for(let G=0;G<F;G++){const X=N[G];X>=0&&(C[D[X]++]=j[G])}for(let G=0;G<R;G++){const X=S[G],V=S[G+1];if(V===X)continue;const J=C.subarray(X,V);for(let ee=0;ee<w.length;ee++){const te=w[ee],ie=U(te.handle,J,te.fn,a.totalContext||{locale:a.locale});_.set(O(L,y[G],te.colId),ie)}}}return{keys:v,paths:y,fields:M,groupPaths:p,columns:A,values:_,cells:_,error:null}}function o(t,c,s){if(c.length===0)return t.slice();const a=[];for(const f of t)for(const w of c)a.push(`${f}${s}${w.colId}`);return a}function i(t){if(t.length===1)return t[0]||new Uint32Array(0);let c=0;for(const f of t)c+=f?f.length:0;const s=new Uint32Array(c);let a=0;for(const f of t)!f||f.length===0||(s.set(f,a),a+=f.length);return s}}),Ue("packages/core/src/store/bitset.js",function(e,H){"use strict";Object.defineProperty(e,"Bitset",{enumerable:!0,get:function(){return $}});const ne=8;class ${static#e=new Uint8Array(256);static{for(let B=1;B<256;B++)$.#e[B]=$.#e[B>>1]+(B&1)}#t;#n;constructor(B=0){const x=Math.max(0,B|0);this.#n=x,this.#t=new Uint8Array(Math.ceil(x/ne))}get size(){return this.#n}get words(){return this.#t}get bytes(){return this.#t?this.#t.byteLength:0}get(B){return B<0||B>=this.#n?0:this.#t[B>>3]>>(B&7)&1}set(B){return B>=0&&B<this.#n&&(this.#t[B>>3]|=1<<(B&7)),this}clear(B){return B>=0&&B<this.#n&&(this.#t[B>>3]&=~(1<<(B&7))),this}assign(B,x){return x?this.set(B):this.clear(B)}fill(B=!1){return this.#t.fill(B?255:0),B&&this.#r(),this}grow(B){const x=Math.max(0,B|0);if(x<=this.#n)return this;const Z=Math.ceil(x/ne);if(Z>this.#t.length){const Y=new Uint8Array(Z);Y.set(this.#t),this.#t=Y}return this.#n=x,this}count(){const B=this.#t,x=$.#e;let Z=0;for(let Y=0;Y<B.length;Y++)Z+=x[B[Y]];return Z}and(B){const x=B instanceof $?B.words:B,Z=this.#t,Y=Math.min(Z.length,x.length);for(let U=0;U<Y;U++)Z[U]&=x[U];for(let U=Y;U<Z.length;U++)Z[U]=0;return this}or(B){const x=B instanceof $?B.words:B,Z=this.#t,Y=Math.min(Z.length,x.length);for(let U=0;U<Y;U++)Z[U]|=x[U];return this}not(){const B=this.#t;for(let x=0;x<B.length;x++)B[x]=~B[x]&255;return this.#r(),this}clone(){const B=new $(this.#n);return B.words.set(this.#t.subarray(0,B.words.length)),B}release(){this.#t=new Uint8Array(0),this.#n=0}#r(){const B=this.#n&7;if(B===0)return;const x=this.#n>>3;x<this.#t.length&&(this.#t[x]&=(1<<B)-1)}static from(B){const x=Array.isArray(B)?B:Array.from(B),Z=new $(x.length);for(let Y=0;Y<x.length;Y++)x[Y]&&Z.set(Y);return Z}}}),Ue("packages/core/src/store/dictionary.js",function(e,H){"use strict";Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return B}});const ne=H("packages/core/src/internal/compare.js"),$=ne.collator,q=ne.defaultCompare;class B{#e;#t=new Map;#n=0;#r=null;#i=-1;#s="\0";constructor(Z=[]){this.#e=[];for(let Y=0;Y<Z.length;Y++){const U=Z[Y];this.#t.has(U)||(this.#t.set(U,this.#e.length),this.#e.push(U))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let Z=this.#e.length*8;for(let Y=0;Y<this.#e.length;Y++){const U=this.#e[Y];typeof U=="string"&&(Z+=U.length*2),Z+=16}return Z}codeOf(Z){const Y=this.#t.get(Z);if(Y!==void 0)return Y;const U=this.#e.length;return this.#e.push(Z),this.#t.set(Z,U),this.#n++,U}lookup(Z){const Y=this.#t.get(Z);return Y===void 0?-1:Y}has(Z){return this.#t.has(Z)}valueOf(Z){return this.#e[Z]}values(){return this.#e}ranks(Z){const Y=Z||"";if(this.#r&&this.#i===this.#n&&this.#s===Y)return this.#r;const U=this.#e.length,W=new Array(U);for(let b=0;b<U;b++)W[b]=b;const K=$(Z).compare,E=this.#e;W.sort((b,u)=>this.#o(E[b],E[u],K));const O=new Uint32Array(U);for(let b=0;b<U;b++)O[W[b]]=b;return this.#r=O,this.#i=this.#n,this.#s=Y,O}#o(Z,Y,U){return typeof Z=="string"&&typeof Y=="string"?U(Z,Y):q(Z,Y)}}}),Ue("packages/core/src/store/multivalue.js",function(e,H){"use strict";Object.defineProperty(e,"MultiValue",{enumerable:!0,get:function(){return ne}});class ne{#e;#t;#n=0;#r=0;constructor(q={}){const B=Math.max(1,q.rows??16),x=Math.max(1,q.values??B);this.#e=new Int32Array(x),this.#t=new Uint32Array(B+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,B){if(q<0||q>=this.#n)return!1;const x=this.#e,Z=this.#t[q+1];for(let Y=this.#t[q];Y<Z;Y++)if(x[Y]===B)return!0;return!1}hasAny(q,B){for(let x=0;x<B.length;x++)if(this.has(q,B[x]))return!0;return!1}hasAll(q,B){for(let x=0;x<B.length;x++)if(!this.has(q,B[x]))return!1;return!0}hasNone(q,B){return!this.hasAny(q,B)}push(q){const B=this.#n,x=q.length;this.#i(B+1),this.#s(this.#r+x);const Z=this.#r;for(let Y=0;Y<x;Y++)this.#e[Z+Y]=q[Y]|0;return this.#r+=x,this.#n=B+1,this.#t[B]=Z,this.#t[B+1]=this.#r,B}write(q,B){if(q===this.#n){this.push(B);return}if(q<0||q>this.#n)return;const x=this.#t[q],Z=this.#t[q+1],Y=B.length;if(Z-x===Y){for(let U=0;U<Y;U++)this.#e[x+U]=B[U]|0;return}this.#o(q,B)}compact(q,B,x){const Z=this.#e,Y=this.#t,U=this.#n,W=new Int32Array(Math.max(1,this.#r)),K=new Uint32Array(B+1);let E=0;for(let O=0;O<U;O++){if(q[O]===x)continue;const b=Y[O],u=Y[O+1];K[q[O]]=E;for(let h=b;h<u;h++)W[E++]=Z[h];K[q[O]+1]=E}this.#e=W,this.#t=K,this.#n=B,this.#r=E}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#i(q){if(q+1<=this.#t.length)return;let B=this.#t.length-1;for(;B<q;)B=B*2||16;const x=new Uint32Array(B+1);x.set(this.#t),this.#t=x}#s(q){if(q<=this.#e.length)return;let B=this.#e.length;for(;B<q;)B=B*2||16;const x=new Int32Array(B);x.set(this.#e),this.#e=x}#o(q,B){const x=this.#e,Z=this.#t,Y=this.#n,U=B.length-(Z[q+1]-Z[q]),W=new Int32Array(Math.max(1,this.#r+U)),K=new Uint32Array(Z.length);let E=0;for(let O=0;O<Y;O++){if(K[O]=E,O===q)for(let b=0;b<B.length;b++)W[E++]=B[b]|0;else for(let b=Z[O];b<Z[O+1];b++)W[E++]=x[b];K[O+1]=E}this.#e=W,this.#t=K,this.#r=E}}}),Ue("packages/core/src/compute/sort.js",function(e,H){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return R}});const ne=H("packages/core/src/compute/handle.js"),$=ne.bitReader,q=ne.dictRanks,B=ne.dictSize,x=ne.identity,Z=ne.isMissing,Y=ne.presenceReader,U=ne.rowCount,W=ne.valueComparator,K=ne.valueReader,E=new Uint32Array(0),O=new ArrayBuffer(8),b=new Float64Array(O),u=new Uint32Array(O),h=(b[0]=-1,(u[1]&2147483648)!==0?1:0),l=h===1?0:1;function r(j,L){b[0]=j;let F=u[h],N=u[l];(F&2147483648)!==0?(F=~F>>>0,N=~N>>>0):F=(F^2147483648)>>>0,L[0]=N,L[1]=F}function n(j,L,F,N){if(N<2)return j;const S=new Uint32Array(256*8);for(let te=0;te<N;te++){const ie=L[te],oe=F[te];S[ie&255]++,S[256+(ie>>>8&255)]++,S[512+(ie>>>16&255)]++,S[768+(ie>>>24&255)]++,S[1024+(oe&255)]++,S[1280+(oe>>>8&255)]++,S[1536+(oe>>>16&255)]++,S[1792+(oe>>>24&255)]++}let C=j,D=L,G=F,X=new Uint32Array(N),V=new Uint32Array(N),J=new Uint32Array(N);const ee=new Uint32Array(256);for(let te=0;te<8;te++){const ie=te<<8,oe=(te&3)<<3,ue=te>=4;let ye=!1;for(let Ce=0;Ce<256;Ce++)if(S[ie+Ce]===N){ye=!0;break}if(ye)continue;let he=0;for(let Ce=0;Ce<256;Ce++)ee[Ce]=he,he+=S[ie+Ce];for(let Ce=0;Ce<N;Ce++){const we=D[Ce],re=G[Ce],de=(ue?re:we)>>>oe&255,me=ee[de]++;X[me]=C[Ce],V[me]=we,J[me]=re}let Re=C;C=X,X=Re,Re=D,D=V,V=Re,Re=G,G=J,J=Re}return C}function o(j,L,F){if(F<2)return j;const N=new Uint32Array(256*4);for(let V=0;V<F;V++){const J=L[V];N[J&255]++,N[256+(J>>>8&255)]++,N[512+(J>>>16&255)]++,N[768+(J>>>24&255)]++}let S=j,C=L,D=new Uint32Array(F),G=new Uint32Array(F);const X=new Uint32Array(256);for(let V=0;V<4;V++){const J=V<<8,ee=V<<3;let te=!1;for(let ue=0;ue<256;ue++)if(N[J+ue]===F){te=!0;break}if(te)continue;let ie=0;for(let ue=0;ue<256;ue++)X[ue]=ie,ie+=N[J+ue];for(let ue=0;ue<F;ue++){const ye=C[ue],he=X[ye>>>ee&255]++;D[he]=S[ue],G[he]=ye}let oe=S;S=D,D=oe,oe=C,C=G,G=oe}return S}function i(j,L,F,N){const S=new Uint32Array(N+1);for(let G=0;G<F;G++)S[L[G]]++;let C=0;for(let G=0;G<=N;G++){const X=S[G];S[G]=C,C+=X}const D=new Uint32Array(F);for(let G=0;G<F;G++)D[S[L[G]]++]=j[G];return D}function t(j,L,F,N){return F<2?j:N<=65536||N<=F*2?i(j,L,F,N):o(j,L,F)}function c(j,L){return j.length===L&&j.byteOffset===0?j:Uint32Array.prototype.slice.call(j,0,L)}function s(j,L,F=!1){const N=L||x(j.length),S=N.length;if(S<2)return Uint32Array.from(N);const C=new Uint32Array(S),D=new Uint32Array(S),G=new Uint32Array(S),X=new Uint32Array(S),V=new Uint32Array(2);let J=0,ee=0;for(let oe=0;oe<S;oe++){const ue=N[oe],ye=j[ue];if(Number.isNaN(ye)){X[ee++]=ue;continue}r(ye,V),F?(D[J]=~V[0]>>>0,G[J]=~V[1]>>>0):(D[J]=V[0],G[J]=V[1]),C[J++]=ue}const te=n(C.subarray(0,J),D.subarray(0,J),G.subarray(0,J),J);if(ee===0)return c(te,J);const ie=new Uint32Array(S);return ie.set(te.subarray(0,J),0),ie.set(X.subarray(0,ee),J),ie}function a(j,L,F=!1){const N=L||x(j.length),S=N.length;if(S<2)return Uint32Array.from(N);const C=Uint32Array.from(N),D=new Uint32Array(S);for(let G=0;G<S;G++){const X=(j[C[G]]^2147483648)>>>0;D[G]=F?~X>>>0:X}return c(o(C,D,S),S)}function f(j,L,F={}){const N=L||x(U(j,F)),S=N.length;if(S<2)return Uint32Array.from(N);const C=q(j.dict,F.locale),D=j.values,G=Y(j),X=Math.max(B(j.dict),C.length),V=X,J=Uint32Array.from(N),ee=new Uint32Array(S),te=!!F.descending;for(let ie=0;ie<S;ie++){const oe=J[ie];let ue=G&&G(oe)===0?V:C[D[oe]];ue===void 0&&(ue=V),ee[ie]=te?V-ue:ue}return c(t(J,ee,S,X+1),S)}function w(j,L,F){const N=L.length;let S=Uint32Array.from(L);if(N<2)return S;let C=new Uint32Array(N);for(let D=1;D<N;D<<=1){for(let X=0;X<N;X+=D<<1){const V=Math.min(X+D,N),J=Math.min(X+(D<<1),N);let ee=X,te=V,ie=X;for(;ee<V&&te<J;)C[ie++]=F(j[S[ee]],j[S[te]])<=0?S[ee++]:S[te++];for(;ee<V;)C[ie++]=S[ee++];for(;te<J;)C[ie++]=S[te++]}const G=S;S=C,C=G}return S}function g(j,L,F){const N=$(j.values),S=L.length,C=new Uint32Array(S),D=F?1:0;let G=0;for(let X=0;X<S;X++)N(L[X])===D&&(C[G++]=L[X]);for(let X=0;X<S;X++)N(L[X])!==D&&(C[G++]=L[X]);return C}function k(j,L){const F=j.values,N=j.kind;if((N==="object"||N===void 0)&&(Array.isArray(F)||ArrayBuffer.isView(F))&&!j.presence)return F;const C=K(j),D=new Array(U(j)||0);for(let G=0;G<L.length;G++){const X=L[G];D[X]=C(X)}return D}function d(j,L){for(let F=0;F<L.length;F++)if(typeof j[L[F]]!="string")return!1;return!0}function p(j,L,F,N,S){const C=j.length,D=Uint32Array.from(j);if(C<2||N<1)return D;const G=new Uint32Array(C),X=N-1;for(let V=0;V<C;V++){const J=F[L[V]];G[V]=S?X-J:J}return c(t(D,G,C,N),C)}function m(j,L,F){const N=W(F),S=new Array(L);for(let D=0;D<L;D++)S[D]=D;S.sort((D,G)=>N(j[D],j[G])||D-G);const C=new Uint32Array(L);for(let D=0;D<L;D++)C[S[D]]=D;return C}function v(j,L,F){const N=L.length,S=new Map,C=[],D=new Uint32Array(N);for(let V=0;V<N;V++){const J=j[L[V]];let ee=S.get(J);ee===void 0&&(ee=C.length,S.set(J,ee),C.push(J)),D[V]=ee}const G=C.length,X=m(C,G,F.locale);return p(L,D,X,G,!!F.descending)}function y(j,L,F){const N=k(j,L);if(L.length>=2&&d(N,L)){const D=j.stringRank;return D&&D.version===j.version&&D.usable(L,N,F.locale)?D.sort(L,F):v(N,L,F)}const S=W(F.locale),C=F.descending?(D,G)=>S(G,D):S;return w(N,L,C)}function T(j,L,F){const N=k(j,L),S=F.compare,D=!!F.descending?(G,X)=>-S(G,X,void 0,void 0,!0):(G,X)=>S(G,X,void 0,void 0,!1);return w(N,L,D)}function A(j,L){const F=L.length,N=Y(j),S=j.values,C=j.kind==="float64"&&!!S,D=j.kind==="object"||j.kind==="multi"||j.kind===void 0;if(!N&&!C&&!D)return{present:L,absent:E};const G=new Uint32Array(F),X=new Uint32Array(F);let V=0,J=0;if(N&&C)for(let ee=0;ee<F;ee++){const te=L[ee];N(te)===1&&!Number.isNaN(S[te])?G[V++]=te:X[J++]=te}else if(C&&!N)for(let ee=0;ee<F;ee++){const te=L[ee];Number.isNaN(S[te])?X[J++]=te:G[V++]=te}else if(N&&!D)for(let ee=0;ee<F;ee++){const te=L[ee];N(te)===1?G[V++]=te:X[J++]=te}else{const ee=K(j);for(let te=0;te<F;te++){const ie=L[te];Z(ee(ie))?X[J++]=ie:G[V++]=ie}}return J===0?{present:L,absent:E}:{present:G.subarray(0,V),absent:X.subarray(0,J)}}function M(j,L,F){if(L.length===0)return j;const N=new Uint32Array(j.length+L.length);return F?(N.set(L,0),N.set(j,L.length)):(N.set(j,0),N.set(L,j.length)),N}function _(j,L,F={}){const N=L||x(U(j,F));if(!j||N.length<2)return Uint32Array.from(N);const{present:S,absent:C}=A(j,N);if(S.length===0)return Uint32Array.from(N);const D=!!F.descending;let G;if(typeof F.compare=="function")G=T(j,S,F);else switch(j.kind){case"float64":G=s(j.values,S,D);break;case"int32":G=a(j.values,S,D);break;case"dictionary":G=f(j,S,F);break;case"bitset":G=g(j,S,D);break;default:G=y(j,S,F);break}return M(G,C,!!F.nullsFirst)}function R(j,L,F,N={}){const S=L||[],C=S.length&&(S[0].handle||I(j,S[0].col))||j&&j[0];let D=F||x(U(C,N));for(let G=S.length-1;G>=0;G--){const X=S[G],V=X.handle||I(j,X.col)||j&&j[G];V&&(D=_(V,D,{descending:X.descending!==void 0?!!X.descending:X.dir==="desc",nullsFirst:!!X.nullsFirst,locale:X.locale!==void 0?X.locale:N.locale,compare:X.compare}))}return D instanceof Uint32Array?D:Uint32Array.from(D)}function I(j,L){if(!(!j||L===void 0)){for(let F=0;F<j.length;F++)if(j[F]&&j[F].id===L)return j[F]}}}),Ue("packages/core/src/store/stringrank.js",function(e,H){"use strict";Object.defineProperty(e,"DEFAULT_MAX_DISTINCT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"StringRankIndex",{enumerable:!0,get:function(){return x}});const ne=H("packages/core/src/compute/sort.js"),$=ne.collateStringRanks,q=ne.rankSortStrings,B=1e5;class x{#e=[];#t=new Map;#n;#r=0;#i=0;#s=-1;#o;#l=!1;#a=null;#c=-1;#u="\0";constructor(Y=B){this.#o=Y>0?Y:B,this.#n=new Uint32Array(0)}get version(){return this.#s}set version(Y){this.#s=Y}get generation(){return this.#i}get size(){return this.#e.length}get capped(){return this.#l}get length(){return this.#r}get bytes(){let Y=this.#n.byteLength;const U=this.#e;for(let W=0;W<U.length;W++)Y+=U[W].length*2+24;return Y}#f(Y,U){const W=this.#t.get(Y);if(W!==void 0)return W;if(this.#l)return-1;if(U&&this.#e.length>=this.#o)return this.#l=!0,-1;const K=this.#e.length;return this.#e.push(Y),this.#t.set(Y,K),this.#i++,K}build(Y,U){const W=U|0;this.#e=[],this.#t=new Map,this.#i=0,this.#l=!1,this.#a=null,this.#c=-1,this.#n=new Uint32Array(W);for(let K=0;K<W;K++){const E=Y[K],O=typeof E=="string"?this.#f(E,!1):-1;this.#n[K]=O<0?0:O}this.#r=W}append(Y,U,W){const K=(U|0)+(W|0);if(K>this.#n.length){const E=new Uint32Array(K);E.set(this.#n.subarray(0,this.#r)),this.#n=E}for(let E=U|0;E<K;E++){const O=Y[E],b=typeof O=="string"?this.#f(O,!0):-1;this.#n[E]=b<0?0:b}this.#r=Math.max(this.#r,K)}ranks(Y){const U=Y||"";if(this.#a&&this.#c===this.#i&&this.#u===U)return this.#a;const W=$(this.#e,this.#e.length,Y);return this.#a=W,this.#c=this.#i,this.#u=U,W}usable(Y,U,W){if(this.#l||this.#e.length===0)return!1;const K=this.#n,E=this.#e,O=this.#r;for(let b=0;b<Y.length;b++){const u=Y[b];if(u>=O||E[K[u]]!==U[u])return!1}return!0}sort(Y,U){const W=this.ranks(U.locale),K=this.#e.length,E=Y.length,O=new Uint32Array(E),b=this.#n;for(let u=0;u<E;u++)O[u]=b[Y[u]];return q(Y,O,W,K,!!U.descending)}}}),Ue("packages/core/src/store/columnstore.js",function(e,H){"use strict";Object.defineProperty(e,"REMOVED",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"toFloat",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ColumnHandle",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"ColumnStore",{enumerable:!0,get:function(){return g}});const $=H("packages/core/src/internal/warn.js").warnOnce,B=H("packages/core/src/internal/predicates.js").isFunction,Z=H("packages/core/src/internal/paths.js").pathGetter,U=H("packages/core/src/store/bitset.js").Bitset,K=H("packages/core/src/store/dictionary.js").Dictionary,O=H("packages/core/src/store/multivalue.js").MultiValue,u=H("packages/core/src/store/stringrank.js").StringRankIndex,h=4294967295,l=1024,r=5e3,n=.2,o=new Set(["float64","int32","bitset","dictionary","object","multi"]);function i(k){return k==null}function t(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 c(k){const d=t(k);return Number.isFinite(d)?d|0:0}function s(k){return i(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),m=new Array(p.length);for(let v=0;v<p.length;v++)m[v]=k.dict.valueOf(p[v]);return m}default:return k.buf[d]}}function f(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],m=k.offsets[d+1],v=k.table||[],y=new Array(m-p);for(let T=p;T<m;T++)y[T-p]=v[k.values[T]];return y}default:return k.values[d]}}class w{#e;#t;#n;#r;#i;#s;#o;#l=!1;#a=null;#c=null;#u=null;#f=null;#d=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#A=null;#w=null;#O=!1;constructor(d,p){this.#e=d.id;const m=o.has(d.kind)?d.kind:"object";d.kind&&!o.has(d.kind)&&$(`store.kind.${d.id}`,`column "${d.id}" declares unknown storage kind "${d.kind}"; falling back to object`),this.#n=m,this.#t=m,this.#r=d.nullable!==!1,this.#o=d.dictionary??null,this.#s=p,this.#i=B(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.#f:null}get stringRank(){if(this.#O||!this.#h||this.kind!=="object")return null;const d=this.values,p=this.#s.physical();if(!d||p===0)return null;if(this.#d===null){if(typeof d[0]!="string")return null;const m=new u(this.#v());return m.build(d,p),m.version=this.#y,this.#d=m,this.#m=this.#y,m.capped?null:m}return this.#d.length<p&&this.#d.append(d,this.#d.length,p-this.#d.length),this.#d.version=this.#y,this.#m=this.#y,this.#d.capped?null:this.#d}#v(){return this.#p}#T(){this.#d=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.#f&&(d+=this.#f.bytes),this.#A&&(d+=this.#A.size*24),d}get(d){if(!this.#O&&!(d<0||d>=this.#s.physical())){if(!this.#l)return this.#N(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.#f.valueOf(this.#a[d]);case"multi":{const p=this.#u.at(d),m=new Array(p.length);for(let v=0;v<p.length;v++)m[v]=this.#f.valueOf(p[v]);return m}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.#d&&this.#T(),this.#y++)}read(d){return this.#i(d)}appendColumn(d,p,m){if(this.#O||m<=0)return;if(!this.#l){this.#y++;return}const v=this.#i,y=this.#r,T=this.#g;let A=!1;switch(this.#t){case"float64":{const M=this.#a;for(let _=0;_<m;_++){const R=v(d[_]);if(typeof R=="number"){y&&T.set(p+_),M[p+_]=R;continue}const I=R==null;y?T.assign(p+_,!I):I&&(A=!0),M[p+_]=I?NaN:t(R)}break}case"int32":{const M=this.#a;for(let _=0;_<m;_++){const R=v(d[_]),I=R==null;y?T.assign(p+_,!I):I&&(A=!0),M[p+_]=I?0:c(R)}break}case"bitset":{const M=this.#c;for(let _=0;_<m;_++){const R=v(d[_]),I=R==null;y?T.assign(p+_,!I):I&&(A=!0),M.assign(p+_,!I&&!!R)}break}case"dictionary":{const M=this.#a,_=this.#f;for(let R=0;R<m;R++){const I=v(d[R]),j=I==null;y?T.assign(p+R,!j):j&&(A=!0),M[p+R]=j?0:_.codeOf(I)}break}case"multi":{const M=this.#u,_=this.#f;for(let R=0;R<m;R++){const I=v(d[R]),j=I==null;y?T.assign(p+R,!j):j&&(A=!0);const L=s(I),F=new Array(L.length);for(let N=0;N<L.length;N++)F[N]=_.codeOf(L[N]);M.write(p+R,F)}break}default:{const M=this.#a;for(let _=0;_<m;_++){const R=v(d[_]),I=R==null;y?T.assign(p+_,!I):I&&(A=!0),M[p+_]=I?null:R}break}}A&&$(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#d&&this.#t==="object"&&(this.#d.append(this.#a,p,m),this.#d.version=this.#y+1,this.#m=this.#y+1),this.#y++}appendPacked(d,p,m){if(this.#O||m<=0||!d)return;if(!this.#l){this.#y++;return}const v=this.#g,y=d.presence;if(v)if(y)for(let A=0;A<m;A++)v.assign(p+A,(y[A>>3]&1<<(A&7))!==0);else for(let A=0;A<m;A++)v.set(p+A);const T=d.kind===this.#t;if(T&&(this.#t==="float64"||this.#t==="int32")){this.#a.set(d.values,p),this.#y++;return}if(T&&this.#t==="bitset"){const A=d.values;for(let M=0;M<m;M++)this.#c.assign(p+M,(A[M>>3]&1<<(M&7))!==0);this.#y++;return}if(T&&this.#t==="dictionary"){const A=d.table||[],M=new Uint32Array(A.length);for(let j=0;j<A.length;j++)M[j]=this.#f.codeOf(A[j]);const _=d.values,R=this.#a,I=v;for(let j=0;j<m;j++){if(I&&(y&&(y[j>>3]&1<<(j&7))===0)){R[p+j]=0;continue}R[p+j]=M[_[j]]??0}this.#y++;return}if(T&&this.#t==="multi"){const A=d.table||[],M=new Uint32Array(A.length);for(let I=0;I<A.length;I++)M[I]=this.#f.codeOf(A[I]);const _=d.values,R=d.offsets;for(let I=0;I<m;I++){const j=R[I],L=R[I+1],F=new Array(L-j);for(let N=j;N<L;N++)F[N-j]=M[_[N]]??0;this.#u.write(p+I,F)}this.#y++;return}for(let A=0;A<m;A++){const M=y?(y[A>>3]&1<<(A&7))===0:d.kind==="object"?d.values[A]===null:!1;this.#E(p+A,M?null:f(d,A))}this.#y++}touch(){this.#y++}columnarise(d,p){if(this.#l||this.#O)return;const m=new Array(p);for(let v=0;v<p;v++)m[v]=this.#N(v);this.#t=this.#n,this.#l=!0,this.#S(d);for(let v=0;v<p;v++)this.#E(v,m[v]);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||!o.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.#f},m=this.#s.physical(),v=this.#g;this.#t=d,this.#S(this.#b);for(let y=0;y<m;y++){const T=v!==null&&v.get(y)===0;T&&d!=="multi"||this.#E(y,T?null:a(p,y))}return this.#T(),this.#y++,!0}compact(d,p,m){if(!this.#O){if(this.#T(),!this.#l){const v=this.#A;if(v.size){const y=new Map;for(const[T,A]of v)d[T]!==h&&y.set(d[T],A);this.#A=y}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const v=this.#a;for(let y=0;y<p;y++)d[y]!==h&&(v[d[y]]=v[y]);if(this.#t==="object")for(let y=m;y<p;y++)v[y]=void 0;break}case"bitset":{const v=this.#c;for(let y=0;y<p;y++)d[y]!==h&&v.assign(d[y],v.get(y)===1);for(let y=m;y<p;y++)v.clear(y);break}case"multi":this.#u.compact(d,m,h);break;default:break}if(this.#g){const v=this.#g;for(let y=0;y<p;y++)d[y]!==h&&v.assign(d[y],v.get(y)===1);for(let y=m;y<p;y++)v.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.#f=null,this.#d=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 U(p);break;case"dictionary":this.#a=new Uint32Array(p),this.#f=this.#f??new K(this.#o??[]);break;case"multi":this.#u=new O({rows:p,values:p}),this.#f=this.#f??new K(this.#o??[]);break;default:this.#a=new Array(p);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#f=null),this.#r&&(this.#g?this.#g.grow(p):this.#g=new U(p)),this.#b=p}#E(d,p){const m=i(p);switch(this.#r?this.#g.assign(d,!m):m&&$(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#t){case"float64":this.#a[d]=m?NaN:t(p);break;case"int32":this.#a[d]=m?0:c(p);break;case"bitset":this.#c.assign(d,!m&&!!p);break;case"dictionary":this.#a[d]=m?0:this.#f.codeOf(p);break;case"multi":{const v=s(p),y=new Array(v.length);for(let T=0;T<v.length;T++)y[T]=this.#f.codeOf(v[T]);this.#u.write(d,y);break}default:this.#a[d]=m?null:p;break}}#N(d){if(this.#A.has(d))return this.#A.get(d);const p=this.#i(this.#s.rowAt(d));return p===void 0?null:p}#P(){if(this.#w&&this.#w.version===this.#y)return this.#w;const d=this.#s.physical(),p=new Array(d),m=this.#r?new U(d):null;for(let v=0;v<d;v++){const y=this.#N(v);p[v]=y,m&&!i(y)&&m.set(v)}return this.#w={version:this.#y,values:p,presence:m},this.#w}}class g{#e;#t=new Map;#n=[];#r=[];#i=0;#s=0;#o=0;#l=0;#a=new U(0);#c=!1;#u=!0;#f;#d;#h;#p=!1;constructor(d,p={}){this.#e=Array.isArray(d)?d:[],this.#d=Math.max(1,p.initialCapacity??l),this.#u=p.retainSource!==!1,this.#f=this.#u?p.columnarBelow??r:0,this.#h=p.compactRatio??n;const m={rowAt:v=>this.#r[v],physical:()=>this.#i};for(const v of this.#e){if(!v||!v.id)continue;if(this.#t.has(v.id)){$(`store.dup.${v.id}`,`duplicate column id "${v.id}" in the store schema; ignoring the second`);continue}const y=new w(v,m);this.#t.set(v.id,y),this.#n.push(y)}this.#f<=0&&this.#b()}get count(){return this.#o}get physical(){return this.#i}get capacity(){return this.#c?this.#s:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let d=this.#a.bytes+this.#r.length*8;for(const p of this.#n)d+=p.bytes;return d}append(d){const p=this.#i;if(this.#p||!d)return{from:p,to:p};const m=d.length|0;if(m===0)return{from:p,to:p};if(this.#u)for(let y=0;y<m;y++)this.#r[p+y]=d[y];if(this.#i=p+m,this.#o+=m,this.#a.grow(this.#i),!this.#c){if(this.#i>=this.#f)this.#b();else for(const y of this.#n)y.touch();return{from:p,to:this.#i}}this.#m(this.#i);const v=this.#n;for(let y=0;y<v.length;y++)v[y].appendColumn(d,p,m);return{from:p,to:this.#i}}appendPacked(d,p){const m=this.#i;if(this.#p||!d)return{from:m,to:m};const v=d.count|0;if(v===0)return{from:m,to:m};if(this.#u&&p)for(let T=0;T<v;T++)this.#r[m+T]=p[T];this.#i=m+v,this.#o+=v,this.#a.grow(this.#i),this.#c||this.#b(),this.#m(this.#i);const y=new Map;for(const T of d.columns)y.set(T.id,T);for(const T of this.#n){const A=y.get(T.id);A?T.appendPacked(A,m,v):T.grow(this.#s)}return{from:m,to:this.#i}}source(d){if(this.#u)return this.#r[d];if(!(d<0||d>=this.#i))return this.#g(d)}setSource(d,p){this.#p||d<0||d>=this.#i||this.#u&&(this.#r[d]=p)}get(d,p){const m=this.#t.get(d);return m?m.get(p):void 0}set(d,p,m){if(this.#p||p<0||p>=this.#i)return;const v=this.#t.get(d);if(!v){$(`store.set.${d}`,`set() on unknown column "${d}"`);return}v.set(p,m)}remove(d){return this.#p||d<0||d>=this.#i||this.#a.get(d)===1?!1:(this.#a.set(d),this.#l++,this.#o--,!0)}live(d){return d<0||d>=this.#i?!1:this.#a.get(d)===0}compact(d={}){if(this.#p||this.#l===0||!d.force&&this.#l/this.#i<this.#h)return null;const p=this.#i,m=new Uint32Array(p);let v=0;for(let y=0;y<p;y++)m[y]=this.#a.get(y)===1?h:v++;for(const y of this.#n)y.compact(m,p,v);if(this.#u){const y=this.#r;for(let T=0;T<p;T++)m[T]!==h&&(y[m[T]]=y[T]);y.length=v}return this.#i=v,this.#o=v,this.#l=0,this.#a=new U(Math.max(this.#s,v)),m}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 m=0;m<this.#i;m++)d[m]=m;return d}let p=0;for(let m=0;m<this.#i;m++)this.#a.get(m)===0&&(d[p++]=m);return d}convert(d,p){const m=this.#t.get(d);return m?m.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.#i=0,this.#o=0,this.#l=0,this.#s=0}}#m(d){if(d<=this.#s)return;let p=this.#s||this.#d;for(;p<d;)p*=2;for(const m of this.#n)m.grow(p);this.#a.grow(p),this.#s=p}#g(d){const p={};for(const m of this.#n)p[m.id]=m.get(d);return p}#b(){if(this.#c)return;let d=this.#d;for(;d<this.#i;)d*=2;this.#c=!0,this.#s=d,this.#a.grow(d);for(const p of this.#n)p.columnarise(d,this.#i)}}}),Ue("packages/core/src/store/pool.js",function(e,H){"use strict";Object.defineProperty(e,"MaskPool",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"sharedPool",{enumerable:!0,get:function(){return x}});const ne=64,$=8;function q(Y){let U=ne;for(;U<Y;)U*=2;return U}class B{#e=new Map;#t=new WeakSet;#n;#r=0;#i={acquired:0,reused:0,released:0};constructor(U={}){this.#n=U.limit??$}get bytes(){return this.#r}mask(U){const W=new Uint8Array(this.#s(U),0,U);return W.fill(0),W}indices(U){return new Uint32Array(this.#s(U*4),0,U)}release(U){if(!U||!U.buffer)return!1;const W=U.buffer;if(!this.#t.has(W))return!1;this.#t.delete(W),this.#i.released++;const K=W.byteLength;let E=this.#e.get(K);return E||this.#e.set(K,E=[]),E.length>=this.#n||(E.push(W),this.#r+=K),!0}releaseAll(U){for(const W of U)this.release(W)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#i,retained:this.#r}}#s(U){const W=q(U),K=this.#e.get(W);this.#i.acquired++;let E;return K&&K.length?(E=K.pop(),this.#r-=W,this.#i.reused++):E=new ArrayBuffer(W),this.#t.add(E),E}}function x(){return Z??=new B,Z}let Z=null}),Ue("packages/core/src/compute/sortspec.js",function(e,H){"use strict";Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return x}});function ne(Z){return{locale:Z===void 0?void 0:String(Z),numeric:!0,sensitivity:"variant"}}function $(Z){return!!Z&&typeof Z.compare!="function"}function q(Z){if(!Z)return!0;for(let Y=0;Y<Z.length;Y++)if(!$(Z[Y]))return!1;return!0}function B(Z,Y){const U=Z.col!==void 0?Z.col:Z.handle&&Z.handle.id,W=Z.locale!==void 0?Z.locale:Y;return{col:U,descending:Z.descending!==void 0?!!Z.descending:Z.dir==="desc",nullsFirst:!!Z.nullsFirst,collation:ne(W)}}function x(Z,Y){const U=Z||[],W=new Array(U.length);for(let K=0;K<U.length;K++)W[K]=B(U[K],Y);return W}}),Ue("packages/core/src/compute/facet.js",function(e,H){"use strict";Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"orderedReader",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"toNumeric",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return c}}),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 ne=H("packages/core/src/compute/handle.js"),$=ne.presenceReader,q=ne.valueReader,B=ne.dictSize,x=ne.dictValue,Z=Object.freeze(["equal","quantile","log"]),Y=Object.freeze(["hour","day","week","month","quarter","year"]),U=20,W=50,K=1e4;function E(m,v){if(!m)return"none";const y=v;if(y&&(y.multi===!0||typeof y.items=="function"))return"category";const T=v&&v.base;if(T==="date"||T==="datetime"||T==="time"||T==="dateString")return"date";switch(m.kind){case"bitset":return"boolean";case"float64":case"int32":return"numeric";case"dictionary":return"category";case"multi":return"category";default:return T==="number"?"numeric":T==="boolean"?"boolean":T==="text"?"category":"none"}}function O(m){const v=m.values,y=m.kind;if((y==="float64"||y==="int32")&&v)return A=>v[A];const T=q(m);return A=>b(T(A))}function b(m){if(typeof m=="number")return m;if(m instanceof Date)return m.getTime();if(m==null||m==="")return NaN;if(typeof m=="boolean")return m?1:0;if(typeof m=="string"){const v=Number(m);if(Number.isFinite(v))return v;const y=Date.parse(m);return Number.isFinite(y)?y:NaN}return NaN}function u(m,v,y,T=W){if(!m)return{cardinality:0,exact:!0};if(m.dict)return{cardinality:B(m.dict),exact:!0};if(m.kind==="bitset")return{cardinality:2,exact:!0};const A=q(m),M=v?v.length:y,_=new Set;for(let R=0;R<M;R++){const I=A(v?v[R]:R);if(I!=null&&(_.add(I),_.size>T))return{cardinality:_.size,exact:!1}}return{cardinality:_.size,exact:!0}}const h=36e5,l=864e5;function r(m,v=U){const y=Number.isFinite(m)&&m>0?m:0,T=Math.max(1,v)*2;return y/h<=T?"hour":y/l<=T?"day":y/(7*l)<=T?"week":y/(30*l)<=T?"month":y/(91*l)<=T?"quarter":"year"}function n(m,v){if(!Number.isFinite(m))return NaN;const y=new Date(m);switch(v){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 T=(y.getDay()+6)%7;return y.setDate(y.getDate()-T),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 o(m,v){const y=new Date(m);switch(v){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 i(m,v,y){const T=O(m),A=$(m),M=v?v.length:y;let _=1/0,R=-1/0,I=0,j=0;for(let L=0;L<M;L++){const F=v?v[L]:L;if(A&&!A(F)){I++;continue}const N=T(F);if(!Number.isFinite(N)){I++;continue}N<_&&(_=N),N>R&&(R=N),j++}return{min:_,max:R,nulls:I,finite:j}}function t(m,v,y,T){const A=O(m),M=$(m),_=v?v.length:y,R=_>T?_/T:1,I=[];for(let L=0;L<_;L+=R){const F=v?v[Math.floor(L)]:Math.floor(L);if(M&&!M(F))continue;const N=A(F);Number.isFinite(N)&&I.push(N)}const j=Float64Array.from(I);return j.sort(),j}function c(m,v,y,T={}){const A=T.kind||E(m,T.type);return A==="none"||!m?{kind:"none",buckets:[],suppressed:"type"}:A==="boolean"?s(m,v,y):A==="category"?a(m,v,y,T):f(m,v,y,A,T)}function s(m,v,y){const T=$(m);let A=0;if(T){const _=v?v.length:y;for(let R=0;R<_;R++)T(v?v[R]:R)||A++}const M=[{value:!1,label:"false"},{value:!0,label:"true"}];return A>0&&M.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:M}}function a(m,v,y,T){const A=T.cardinalityLimit??W,{cardinality:M}=u(m,v,y,A);if(M>A&&(T.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:M};const _=q(m),R=v?v.length:y,I=new Map;let j=0;for(let C=0;C<R;C++){const D=_(v?v[C]:C);if(D==null||D===""){j++;continue}if(Array.isArray(D)){if(!D.length){j++;continue}for(const G of D)I.set(G,(I.get(G)||0)+1);continue}I.set(D,(I.get(D)||0)+1)}let L=[...I.entries()];T.order==="alpha"?L.sort((C,D)=>String(C[0]).localeCompare(String(D[0]))):L.sort((C,D)=>D[1]-C[1]);let F=0,N=0;if(L.length>A){N=L.length-A;for(let C=A;C<L.length;C++)F+=L[C][1];L=L.slice(0,A)}const S=L.map(([C])=>({value:C,label:String(C)}));return F>0&&S.push({remainder:!0,label:`Other (${N} values)`}),j>0&&S.push({null:!0,label:"Empty"}),{kind:"category",buckets:S,cardinality:M}}function f(m,v,y,T,A){const{min:M,max:_,nulls:R,finite:I}=i(m,v,y);if(!I)return{kind:T,buckets:R?[{null:!0,label:"Empty"}]:[],empty:!0};const j=Math.max(1,Math.floor(A.buckets||U));let L=[];if(T==="date"){const N=Y.includes(A.granularity)?A.granularity:r(_-M,j);let S=n(M,N);for(;S<=_&&L.length<4096;){const C=o(S,N);if(!(C>S))break;L.push({from:S,to:C}),S=C}return{kind:T,buckets:w(L,R),granularity:N}}const F=Z.includes(A.strategy)?A.strategy:"equal";if(F==="quantile"){const N=t(m,v,y,K);if(N.length){const S=[N[0]];for(let C=1;C<j;C++){const D=N[Math.min(N.length-1,Math.floor(C/j*N.length))];D>S[S.length-1]&&S.push(D)}S.push(_);for(let C=0;C<S.length-1;C++)L.push({from:S[C],to:S[C+1]})}}else if(F==="log"&&M>0){const N=Math.log10(M),C=(Math.log10(_)-N)/j||1;for(let D=0;D<j;D++)L.push({from:10**(N+D*C),to:10**(N+(D+1)*C)})}if(!L.length){const N=(_-M)/j||1;for(let S=0;S<j;S++)L.push({from:M+S*N,to:M+(S+1)*N})}return L[L.length-1].to=_,{kind:T,buckets:w(L,R),strategy:F,min:M,max:_}}function w(m,v){return v>0?[...m,{null:!0,label:"Empty"}]:m}function g(m,v,y,T,A){const M=T&&T.buckets||[],_=A&&A.length>=M.length?A.subarray(0,M.length):new Uint32Array(M.length);if(_.fill(0),!m||!M.length)return _;const R=M.length-1,I=!!M[R]&&M[R].null===!0,j=v?v.length:y;if(T.kind==="boolean"){const C=q(m);for(let D=0;D<j;D++){const G=C(v?v[D]:D);if(G==null){I&&_[R]++;continue}_[G?1:0]++}return _}if(T.kind==="category"){const C=new Map;for(let X=0;X<M.length;X++)!M[X].null&&!M[X].remainder&&C.set(M[X].value,X);const D=M.findIndex(X=>X.remainder),G=q(m);for(let X=0;X<j;X++){const V=G(v?v[X]:X);if(V==null||V===""){I&&_[R]++;continue}if(Array.isArray(V)){if(!V.length){I&&_[R]++;continue}for(const ee of V){const te=C.get(ee);te!==void 0?_[te]++:D>=0&&_[D]++}continue}const J=C.get(V);J!==void 0?_[J]++:D>=0&&_[D]++}return _}const L=I?M.length-1:M.length,F=new Float64Array(L+1);for(let C=0;C<L;C++)F[C]=M[C].from;F[L]=L?M[L-1].to:0;const N=O(m),S=$(m);for(let C=0;C<j;C++){const D=v?v[C]:C;if(S&&!S(D)){I&&_[R]++;continue}const G=N(D);if(!Number.isFinite(G)){I&&_[R]++;continue}const X=k(F,L,G);X>=0&&_[X]++}return _}function k(m,v,y){if(!v||y<m[0])return-1;if(y>=m[v])return y===m[v]?v-1:-1;let T=0,A=v-1;for(;T<A;){const M=T+A+1>>>1;y>=m[M]?T=M:A=M-1}return T}function d(m,v,y,T={}){const A=T.bounds||c(m,T.boundsIndices??v,y,T);return{bounds:A,counts:g(m,v,y,A)}}const p=d}),Ue("packages/core/src/compute/pivotmatrix.js",function(e,H){"use strict";Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return O}}),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 n}});const $=H("packages/core/src/compute/handle.js").valueComparator,B=H("packages/core/src/compute/total.js").total,Z=H("packages/core/src/compute/group.js").packKeys,Y=H("packages/core/src/compute/pivot.js"),U=Y.joinPath,W=Y.DEFAULT_PATH_SEPARATOR,K=Y.DEFAULT_MAX_COLUMNS,E="";function O(o,i,t={}){const c=t.separator||W,s=o||[],a=i instanceof Uint32Array?i:Uint32Array.from(i||[]),f=a.length;if(s.length===0)return{tuples:[[]],paths:[E],buckets:[a]};const{keyOf:w,readers:g}=Z(s,a,0),k=new Map,d=[],p=[],m=[];for(let _=0;_<f;_++){const R=a[_],I=w(R);let j=k.get(I);if(j===void 0){j=d.length,k.set(I,j),p.push(I);const L=new Array(g.length);for(let F=0;F<g.length;F++)L[F]=g[F](R);d.push(L),m.push([])}m[j].push(R)}const v=$(t.locale),y=d.map((_,R)=>R);y.sort((_,R)=>{const I=d[_],j=d[R];for(let L=0;L<I.length;L++){const F=b(I[L],j[L],v);if(F!==0)return F}return _-R});const T=new Array(y.length),A=new Array(y.length),M=new Array(y.length);for(let _=0;_<y.length;_++){const R=y[_];T[_]=d[R],A[_]=U(d[R],c),M[_]=Uint32Array.from(m[R])}return{tuples:T,paths:A,buckets:M}}function b(o,i,t){const c=o==null,s=i==null;return c||s?c&&s?0:c?1:-1:t(o,i)}function u(o,i,t){const c=[];for(let s=0;s<o.length;s++)t.has(o[s])&&c.push(o[s]);return Uint32Array.from(c)}function h(o,i,t,c){return{value:i.length?B(o,i,t,c):null,leaves:i,count:i.length}}function l(o){const i=o&&o.opts||{},t=i.separator||W,c=i.totalContext||{locale:i.locale},s=(o.measures||[]).filter(A=>A&&A.handle),a=o.leaves instanceof Uint32Array?o.leaves:Uint32Array.from(o.leaves||[]),f=O(o.rowHandles||[],a,{...i,separator:t}),w=O(o.columnHandles||[],a,{...i,separator:t}),g=i.maxColumns===void 0?K:i.maxColumns,k=w.paths.length*Math.max(1,s.length),d=new Map;if(g&&k>g)return{rowAxis:f,columnAxis:w,measures:s.map(A=>({colId:A.colId,fn:A.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,m=new Map,v=new Map,y=new Map,T=w.buckets.map(A=>new Set(A));for(let A=0;A<w.paths.length;A++){const M=w.buckets[A],_=w.paths[A];for(const R of s)v.set(n(_,R.colId),h(R.handle,M,R.fn,c))}for(let A=0;A<f.paths.length;A++){const M=f.buckets[A],_=f.paths[A];for(const R of s)m.set(n(_,R.colId),h(R.handle,M,R.fn,c));for(let R=0;R<w.paths.length;R++){const I=u(M,w.buckets[R],T[R]);if(I.length===0)continue;const j=w.paths[R];for(const L of s)p.set(r(_,j,L.colId),h(L.handle,I,L.fn,c))}}for(const A of s)y.set(A.colId,h(A.handle,a,A.fn,c));return{rowAxis:f,columnAxis:w,measures:s.map(A=>({colId:A.colId,fn:A.fn})),body:p,rowMargin:m,columnMargin:v,grand:y,columns:k,error:null}}function r(o,i,t){return`${o}\0${i}\0${t}`}function n(o,i){return`${o}\0${i}`}}),Ue("packages/core/src/compute/reference.js",function(e,H){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return l}});const $=H("packages/core/src/internal/paths.js").getPath,q=H("packages/core/src/compute/handle.js"),B=q.isMissing,x=q.valueComparator,Y=H("packages/core/src/compute/filter.js").testValue,U="",W="\0";function K(o,i){const t=i.includes(".")?$(o,i):o?.[i];return t===void 0?null:t}function E(o,i,t={}){const c=i||[];let s=o.map((a,f)=>f);if(c.length===0)return s;for(let a=c.length-1;a>=0;a--)s=O(o,s,c[a],t);return s}function O(o,i,t,c){const s=t.locale!==void 0?t.locale:c.locale,a=x(s),f=t.descending!==void 0?!!t.descending:t.dir==="desc",w=[],g=[];for(const p of i){const m=K(o[p],t.col);B(m)?g.push(p):w.push(p)}const k=new Map;for(let p=0;p<w.length;p++)k.set(w[p],p);const d=(p,m)=>{const v=K(o[p],t.col),y=K(o[m],t.col);let T;return typeof t.compare=="function"?(T=t.compare(v,y,o[p],o[m],f),f&&(T=-T)):T=f?a(y,v):a(v,y),T!==0?T:k.get(p)-k.get(m)};return w.sort(d),t.nullsFirst?g.concat(w):w.concat(g)}function b(o,i,t={}){const c=[];for(let s=0;s<o.length;s++)u(o[s],i,t,s)&&c.push(s);return c}function u(o,i,t,c){if(!i)return!0;if(Array.isArray(i.conditions)){const s=i.conditions.filter(f=>f!=null);if(s.length===0)return!0;if(i.op==="or")return s.some(f=>u(o,f,t,c));const a=s.every(f=>u(o,f,t,c));return i.op==="not"?!a:a}return i.col===void 0&&typeof t.custom=="function"?!!t.custom(i,o,c):Y(K(o,i.col),i,t.locale)}function h(o,i,t,c){const s=t||o.map((g,k)=>k),a=new Map,f=[],w=[];for(const g of s){const k=i.map((m,v)=>{const y=K(o[g],m);return c&&c[v]?c[v](y):y}),d=k.map(m=>m==null?W:String(m)).join(U);let p=a.get(d);p===void 0&&(p=f.length,a.set(d,p),f.push(k),w.push([])),w[p].push(g)}return{keys:f,buckets:w}}function l(o,i,t={}){const c=x(t.locale),s=o.filter(f=>!B(f)),a=s.map(r).filter(f=>f!==null);switch(i){case"count":return o.length;case"countValues":return s.length;case"sum":return a.reduce((f,w)=>f+w,0);case"avg":return s.length===0?null:a.reduce((f,w)=>f+w,0)/s.length;case"min":return s.length===0?null:s.reduce((f,w)=>c(w,f)<0?w:f);case"max":return s.length===0?null:s.reduce((f,w)=>c(w,f)>0?w:f);case"first":return o.length===0?null:n(o[0]);case"last":return o.length===0?null:n(o[o.length-1]);default:return null}}function r(o){if(typeof o=="number")return Number.isNaN(o)?null:o;if(o==null||o===""||typeof o=="boolean")return null;if(o instanceof Date)return o.getTime();const i=Number(o);return Number.isNaN(i)?null:i}function n(o){return o===void 0?null:o}}),Ue("packages/core/src/compute/index.js",function(e,H){"use strict";const ne=H("packages/core/src/compute/sort.js");Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return ne.sortColumn}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return ne.sortMulti}}),Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return ne.radixSortFloat64}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return ne.radixSortInt32}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return ne.rankSortDictionary}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return ne.mergeSortComparator}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return ne.collateStringRanks}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return ne.rankSortStrings}});const $=H("packages/core/src/compute/sortspec.js");Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return $.collationDescriptor}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return $.isPortableSort}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return $.isPortableSortSet}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return $.describeSortEntry}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return $.describeSort}});const q=H("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 B=H("packages/core/src/compute/group.js");Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return B.groupByColumns}}),Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return B.packKeys}});const x=H("packages/core/src/compute/facet.js");Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return x.facet}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return x.computeBounds}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return x.countInto}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return x.bucketOf}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return x.facetKind}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return x.cardinalityOf}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return x.pickGranularity}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return x.floorTo}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return x.advance}}),Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return x.STRATEGIES}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return x.GRANULARITIES}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return x.DEFAULT_BUCKETS}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return x.DEFAULT_CARDINALITY_LIMIT}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return x.QUANTILE_SAMPLE}});const Z=H("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 Y=H("packages/core/src/compute/pivot.js");Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return Y.pivot}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return Y.resolvePivotKeys}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return Y.pivotKey}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return Y.joinPath}}),Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return Y.KEY_DELIMITER}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return Y.DEFAULT_PATH_SEPARATOR}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return Y.DEFAULT_MAX_COLUMNS}});const U=H("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return U.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return U.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return U.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return U.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return U.GRAND_PATH}});const W=H("packages/core/src/compute/reference.js");Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return W.referenceSort}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return W.referenceFilter}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return W.referenceGroup}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return W.referenceTotal}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return W.referencePasses}}),Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return W.referenceValue}});const K=H("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return K.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return K.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return K.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return K.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return K.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return K.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return K.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return K.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return K.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return K.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return K.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return K.isMissing}});const E=H("packages/core/src/compute/sketch.js");Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return E.Welford}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return E.Reservoir}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return E.HyperLogLog}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return E.SpaceSaving}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return E.KLL}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return E.hash32}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return E.SKETCH_BOUNDS}});const O=H("packages/core/src/compute/windowed.js");Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return O.Window}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return O.WINDOW_KINDS}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return O.openWindow}});const b=H("packages/core/src/compute/statistics.js");Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return b.MAINTENANCE}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return b.APPROXIMATE}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return b.maintenanceOf}});const u=H("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return u.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return u.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return u.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return u.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return u.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return u.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return u.anomalyCondition}});const h=H("packages/core/src/compute/forecast.js");Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return h.FORECAST_METHODS}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return h.forecast}})}),Ue("packages/core/src/source/rows.js",function(e,H){"use strict";Object.defineProperty(e,"DEFAULT_ROW_HEIGHT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"KEY_SEP",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"groupPrefixKeys",{enumerable:!0,get:function(){return h}});const $=H("packages/core/src/internal/warn.js").warnOnce,B=H("packages/core/src/internal/predicates.js").isFunction,x=32,Z="\0";function Y(l){return new U(l)}class U{#e;#t;constructor(r){this.#e=B(r&&r.rowKey)?r.rowKey:null;const n=r&&r.config?r.config.rowHeight:void 0;this.#t=typeof n=="number"||B(n)?n:x}get keyed(){return this.#e!==null}keyOf(r,n){if(this.#e){const o=this.#e(r);if(o!=null)return String(o)}else $("source.rowKey.missing","no config.rowKey; falling back to index identity.","Row changes, streaming dedupe, selection persistence and remote reload are disabled.");return`#${n}`}heightOf(r){return B(this.#t)?Number(this.#t(r))||x:this.#t}leaf(r,n,o=0,i=null){const t={key:this.keyOf(r,n),data:r,level:o,parent:i,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:n};return t.height=this.heightOf(t),t}group(r){const n={key:u(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&&(n.totals=r.totals),n.height=this.heightOf(n),n}footer(r){const n={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 n.height=this.heightOf(n),n}detail(r,n){return{key:`${r.key}${Z}detail`,data:r.data,level:r.level+1,parent:r,group:!1,detail:!0,expanded:!1,leafCount:0,height:n,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:r.key}}grandTotal(r,n){const o={key:`${Z}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:n,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:r};return o.height=this.heightOf(o),o}skeleton(r,n=0,o=!1){const i={key:`${Z}pending${Z}${r}`,data:null,level:n,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:r,selected:!1,physical:null,pending:!0};return o&&(i.loadError=!0),i.height=this.heightOf(i),i}}function W(l,r,n,o){return{key:`${Z}pinned${Z}${n}${Z}${r}`,data:l,level:0,parent:null,group:!1,expanded:!1,leafCount:0,height:o,index:null,selected:!1,physical:null,hasChildren:!1,pinned:n}}function K(l,r){return new Proxy([],{get(n,o,i){if(o==="length")return l();if(typeof o=="string"){const t=Number(o);if(Number.isInteger(t)&&t>=0)return r(t)}return Reflect.get(n,o,i)},has(n,o){if(typeof o=="string"){const i=Number(o);if(Number.isInteger(i)&&i>=0)return i<l()}return Reflect.has(n,o)}})}function E(l){return l==null?"":String(l)}const O="";function b(l){if(l==null)return O;const r=String(l);return r.startsWith(O)?O+r:r}function u(l){const r=l||[];let n="g";for(let o=0;o<r.length;o++)n+=Z+b(r[o]);return n}function h(l){const r=new Array(l.length),n=[];for(let o=0;o<l.length;o++)n.push(l[o]),r[o]=u(n);return r}}),Ue("packages/core/src/source/handles.js",function(e,H){"use strict";Object.defineProperty(e,"HandleProvider",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"createHandleProvider",{enumerable:!0,get:function(){return Z}});const $=H("packages/core/src/internal/predicates.js").isFunction,B=H("packages/core/src/internal/warn.js").warnOnce;class x{#e;#t;#n;#r=new Map;#i=0;constructor(U,W,K){this.#e=U,this.#t=W,this.#n=$(K)?K:()=>!1}get store(){const U=this.#e.store;return U&&$(U.column)?U:null}invalidate(){this.#i++}handle(U){const W=this.store;if(W){const b=W.column(U);if(b)return b}const K=this.#r.get(U);if(K&&K.builtAt===this.#i)return K.handle;const E=this.#s(U);if(!E)return;if(W&&this.#n()){B(`source.dropped.${U}`,`column "${U}" 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 O=this.#o(E);return this.#r.set(U,{handle:O,builtAt:this.#i}),O}#s(U){const W=this.#e.columns;return W&&$(W.get)?W.get(U):void 0}#o(U){const W=this.#t()||[],K=W.length,E=new Array(K),O=$(U.getValue)?u=>U.getValue(u):u=>u?.[U.field||U.id];for(let u=0;u<K;u++)E[u]=W[u]===void 0?void 0:O(W[u]);const b=this.#i;return{id:U.id,kind:"object",nullable:!1,values:E,presence:null,dict:null,offsets:null,get(u){return E[u]},version:b}}}function Z(Y,U,W){return new x(Y,U,W)}}),Ue("packages/core/src/compute/incremental.js",function(e,H){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return W}});const $=H("packages/core/src/store/columnstore.js").toFloat,q=Object.freeze(["sum","avg","countValues","min","max"]),B=Object.freeze(["float64"]),x=1e15;function Z(K,E){return typeof K!="string"||!q.includes(K)?!1:!!E&&B.includes(E.kind)}function Y(K){if(K==null)return null;const E=$(K);return Number.isNaN(E)?null:E}class U{#e;#t=0;#n=0;#r=0;#i=1/0;#s=-1/0;#o=!1;#l=!1;constructor(E){this.#e=E}get valid(){return this.#o&&!this.#l}get fn(){return this.#e}seed(E){this.#a();for(let O=0;O<E.length;O++){const b=Y(E[O]);b!==null&&this.#c(b)}this.#o=!0}seedColumn(E,O,b){this.#a();for(let u=0;u<b.length;u++){const h=b[u];if(O&&O(h)===0)continue;const l=E[h];Number.isNaN(l)||this.#c(l)}this.#o=!0}#a(){this.#t=0,this.#n=0,this.#r=0,this.#i=1/0,this.#s=-1/0,this.#l=!1}#c(E){if(!Number.isFinite(E)){this.#l=!0;return}const O=this.#t+E;this.#n+=Math.abs(this.#t)>=Math.abs(E)?this.#t-O+E:E-O+this.#t,this.#t=O,this.#r++,E<this.#i&&(this.#i=E),E>this.#s&&(this.#s=E)}#u(E){const O=this.#t-E;this.#n+=Math.abs(this.#t)>=Math.abs(E)?this.#t-O-E:-E-O+this.#t,this.#t=O,this.#r--}update(E,O){if(!this.#o)return!1;const b=Y(E),u=Y(O);return b===null&&u===null?!0:b!==null&&!Number.isFinite(b)||u!==null&&!Number.isFinite(u)?!1:this.#e==="min"||this.#e==="max"?b===null||u===null?!1:this.#e==="min"?u<this.#i?(this.#i=u,!0):b>this.#i:u>this.#s?(this.#s=u,!0):b<this.#s:Math.abs(this.#t)>x?!1:(b!==null&&this.#u(b),u!==null&&this.#c(u),!0)}value(){switch(this.#e){case"countValues":return this.#r;case"avg":return this.#r?(this.#t+this.#n)/this.#r:null;case"min":return this.#r?this.#i:null;case"max":return this.#r?this.#s:null;default:return this.#t+this.#n}}invalidate(){this.#o=!1}}const W=U}),Ue("packages/core/src/source/filterwire.js",function(e,H){"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 B}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"resolveRelativeRange",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"relativeTokenOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"relativeTokenHelp",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"isResolvableRelative",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"resolveRelativeCondition",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"forEachCondition",{enumerable:!0,get:function(){return w}}),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 m}}),Object.defineProperty(e,"querySignature",{enumerable:!0,get:function(){return v}});const $=H("packages/core/src/internal/warn.js").warnOnce,q="source.remote.hostFilter",B="source.where.pageRelative";function x(A,M){!Array.isArray(A)||!A.length||$(B,`filters.where (${A.join(", ")}) runs over the rows the ${M} 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(A){const M=(A||{}).config;!M||!M.hostFilter||$(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 Y="source.where.notApplied";function U(A,M){$(`${Y}:${A}`,`filters.where("${A}") is registered but the ${M} 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 W="source.where.overThreshold";function K(A,M,_,R){!Array.isArray(A)||!A.length||$(`${W}:${M}`,`filters.where (${A.join(", ")}) is not applied to the ${M} pushdown source:`,_===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${_.toLocaleString()} rows, at or past the whereRowLimit of ${R.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 E=new Map;function O(A){let M=E.get(A);return M||(M=new Intl.DateTimeFormat("en-US",{timeZone:A,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),E.set(A,M)),M}function b(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function u(A,M){const _=O(M).formatToParts(new Date(A)),R={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const I of _)I.type==="year"?R.y=+I.value:I.type==="month"?R.m=+I.value:I.type==="day"?R.d=+I.value:I.type==="hour"?R.h=+I.value%24:I.type==="minute"?R.mi=+I.value:I.type==="second"&&(R.s=+I.value);return R}function h(A,M){const _=u(A,M);return Date.UTC(_.y,_.m-1,_.d,_.h,_.mi,_.s)-Math.floor(A/1e3)*1e3}function l(A,M,_,R){const I=Date.UTC(A,M-1,_),j=I-h(I,R);return I-h(j,R)}function r(A,M,_){const R=new Date(Date.UTC(A.y,A.m-1,A.d+M));return l(R.getUTCFullYear(),R.getUTCMonth()+1,R.getUTCDate(),_)}const n=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function o(A,M){if(typeof A!="string")return null;const _=A.trim().toLowerCase().replace(/[\s_-]+/g,""),R=/^last(\d*|n)days?$/.exec(_);if(R){const I=R[1]==="n"?"":R[1],j=Number(I||M);return!Number.isFinite(j)||j<=0?null:{kind:"lastNDays",n:Math.floor(j)}}switch(_){case"today":return{kind:"today",n:0};case"yesterday":return{kind:"yesterday",n:0};case"thisweek":return{kind:"thisWeek",n:0};case"thismonth":return{kind:"thisMonth",n:0};case"thisquarter":return{kind:"thisQuarter",n:0};case"thisyear":return{kind:"thisYear",n:0};case"quartertodate":case"qtd":return{kind:"quarterToDate",n:0};case"yeartodate":case"ytd":return{kind:"yearToDate",n:0};default:return null}}function i(A,M={}){const _=o(A,M.n);if(!_)return null;const R=M.tz||b(),I=M.now instanceof Date?M.now.getTime():typeof M.now=="number"?M.now:Date.now(),j=u(I,R),L=l(j.y,j.m,j.d,R),F=r(j,1,R);let N=L,S=F;switch(_.kind){case"today":break;case"yesterday":N=r(j,-1,R),S=L;break;case"lastNDays":S=M.includeToday?F:L,N=r(j,M.includeToday?-(_.n-1):-_.n,R);break;case"thisWeek":{const C=Number.isFinite(M.weekStartsOn)?Number(M.weekStartsOn):1,G=(new Date(Date.UTC(j.y,j.m-1,j.d)).getUTCDay()-C+7)%7;N=r(j,-G,R),S=r(j,-G+7,R);break}case"thisMonth":N=l(j.y,j.m,1,R),S=l(j.m===12?j.y+1:j.y,j.m===12?1:j.m+1,1,R);break;case"thisQuarter":case"quarterToDate":{const C=Math.floor((j.m-1)/3)*3+1;N=l(j.y,C,1,R),S=_.kind==="quarterToDate"?F:C===10?l(j.y+1,1,1,R):l(j.y,C+3,1,R);break}case"thisYear":case"yearToDate":N=l(j.y,1,1,R),S=_.kind==="yearToDate"?F:l(j.y+1,1,1,R);break;default:return null}return{from:new Date(N).toISOString(),to:new Date(S).toISOString(),bounds:"[)",tz:R,relative:_.kind==="lastNDays"?`last${_.n}Days`:_.kind,n:_.n}}function t(A){if(!A||typeof A!="object")return null;const M=A.value;if(M&&typeof M=="object"&&!Array.isArray(M)&&"relative"in M)return{token:String(M.relative),n:typeof M.n=="number"?M.n:void 0};if(A.op==="relative"&&typeof A.value=="string")return{token:A.value,n:void 0};const _=A.meta;return _&&typeof _.relative=="string"&&A.value===void 0?{token:_.relative,n:typeof _.n=="number"?_.n:void 0}:null}function c(){return`Known tokens: ${n.filter(M=>M!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function s(A){const M=t(A);return M?o(M.token,M.n)!==null:!1}function a(A,M={}){const _=t(A);if(!_)return A;const R=i(_.token,{...M,n:_.n});return R?{...A,type:A.type||"date",op:"between",value:[R.from,R.to],bounds:A.bounds||R.bounds,meta:{...A.meta||{},relative:R.relative,tz:R.tz}}:($(`source.relative.${_.token}`,`unknown relative date token "${_.token}"; sending the condition unresolved.`,c()),A)}function f(A){return!!A&&typeof A=="object"&&Array.isArray(A.conditions)}function w(A,M){if(A){if(f(A)){for(const _ of A.conditions)w(_,M);return}M(A)}}function g(A,M){if(!A)return null;if(!f(A))return M(A);const _=A;let R=!1;const I=[];for(const j of _.conditions){const L=g(j,M);L!==j&&(R=!0),L&&I.push(L)}return!R&&I.length===_.conditions.length?A:I.length?{..._,conditions:I}:null}function k(A){if(!A)return null;if(!f(A))return A;const M=A,_=[];for(const R of M.conditions){const I=k(R);I&&_.push(I)}return _.length?{op:M.op,conditions:_}:null}function d(A){const M=k(A);return M?f(M)&&M.op==="and"?M:{op:"and",conditions:[M]}:null}function p(A){const M=(A||[]).filter(Boolean);return M.length?{op:"and",conditions:M}:null}function m(A,M={}){const _=g(A,R=>a(R,M));return d(_)}function v(A){const M=y(A.filters??null);return JSON.stringify([M,A.sort??null,A.quick??"",A.groupBy??null,A.pivotBy??null,T(A.context)])}function y(A){if(!A)return null;if(f(A)){const R=A;return{op:R.op,conditions:R.conditions.map(y)}}const M=A,_=M.meta&&typeof M.meta.relative=="string"?M.meta.relative:t(M)?.token;return{col:M.col,op:M.op,bounds:M.bounds??null,caseSensitive:M.caseSensitive??!1,value:_?`rel:${_}`:M.value??null}}function T(A){if(A==null)return null;try{return JSON.parse(JSON.stringify(A))}catch{return $("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),Ue("packages/core/src/source/tree.js",function(e,H){"use strict";Object.defineProperty(e,"SYNTHETIC",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"buildFromPath",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"assignLevels",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"resolveTree",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"buildTree",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"indexTree",{enumerable:!0,get:function(){return u}});const $=H("packages/core/src/internal/predicates.js").isFunction,B=H("packages/core/src/internal/warn.js").warnOnce,x="",Z="\0tree:";function Y(h,l){return{physical:h,key:l,level:0,children:[],value:void 0}}function U(h,l){const r=[],n=new Map;for(let o=0;o<h.length;o++){const i=h[o],t=l.pathOf(i),c=Array.isArray(t)?t.map(a=>String(a)):[];if(!c.length){const a=Y(i,l.keyOf(i));r.push(a);continue}let s=null;for(let a=0;a<c.length;a++){const f=c.slice(0,a+1).join(x),w=a===c.length-1;let g=n.get(f);g&&w&&g.physical===-1&&(g.physical=i,g.key=l.keyOf(i)),g||(g=Y(w?i:-1,w?l.keyOf(i):Z+f),g.level=a,g.value=c[a],n.set(f,g),s?s.children.push(g):r.push(g)),s=g}}return{roots:r,nodes:n}}function W(h,l){const r=new Map,n=[];for(let c=0;c<h.length;c++){const s=h[c],a=l.keyOf(s),f=Y(s,a);r.set(a,f);const w=l.parentOf(s);w!=null&&w!==""&&n.push({node:f,parent:String(w)})}let o=null;const i=new Map;for(const{node:c,parent:s}of n){const a=r.get(s);if(a){i.set(c.key,a);continue}l.orphans&&l.orphans!=="root"&&(o||(o=Y(-1,`${Z}orphans`),o.value=l.orphans),i.set(c.key,o))}const t=[];for(const c of r.values()){const s=i.get(c.key);s?s.children.push(c):t.push(c)}return o&&o.children.length&&t.push(o),{roots:K(t,r,l.orphans,o),nodes:r}}function K(h,l,r,n){const o=new Set,i=[...h];for(;i.length;){const f=i.pop();if(!o.has(f.key)){o.add(f.key);for(const w of f.children)i.push(w)}}const t=[];for(const f of l.values())o.has(f.key)||t.push(f);if(!t.length)return h;const c=!!r&&r!=="root";B("tree.cycle",`tree.parentKey produced ${t.length} row(s) inside a parent cycle; `+(c?`they are shown under "${r}".`:"they are shown at the root."));for(const f of t)f.children=f.children.filter(w=>o.has(w.key));if(!c)return[...h,...t];let s=n;const a=[...h];return s||(s=Y(-1,`${Z}orphans`),s.value=r,a.push(s)),s.children.push(...t),a}function E(h){let l=0;const r=(n,o)=>{for(const i of n)i.level=o,o>l&&(l=o),i.children.length&&r(i.children,o+1)};return r(h,0),l}function O(h,l){if(!h||typeof h!="object")return null;const r=h.path,n=h.parentKey,o=$(h.hasChildren)?i=>!!h.hasChildren(l.dataAt(i)):null;if($(r))return{mode:"path",pathOf:i=>r(l.dataAt(i)),keyOf:l.keyOf,declaresChildren:o};if(n!=null){const i=$(n)?n:t=>t?.[n];return{mode:"parentKey",parentOf:t=>i(l.dataAt(t)),keyOf:l.keyOf,orphans:h.orphans||"root",declaresChildren:o}}return B("tree.shape","tree is configured with neither `path` nor `parentKey`; rows stay flat."),null}function b(h,l){const r=l.mode==="path"?U(h,l):W(h,l),n=E(r.roots);return{...r,depth:n}}function u(h,l){const r=new Map,n=o=>{for(let i=0;i<o.length;i++){const t=o[i];if(t.physical>=0){const c=l?l(t.physical):!1,s=c&&t.children.length===0;r.set(t.physical,{level:t.level,posinset:i+1,setsize:o.length,hasChildren:t.children.length>0||c,lazy:s})}t.children.length&&n(t.children)}};return n(h),r}}),Ue("packages/core/src/source/settle.js",function(e,H){"use strict";Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return $}});const ne=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function $(q){const B=q&&typeof q=="object"?q.reason:null;return typeof B=="string"&&ne.includes(B)}}),Ue("packages/core/src/source/memory.js",function(e,H){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"quickMatcher",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"MemorySource",{enumerable:!0,get:function(){return G}});const $=H("packages/core/src/internal/lru.js").Lru,q=H("packages/core/src/internal/warn.js"),B=q.warnOnce,x=q.fail,Y=H("packages/core/src/internal/predicates.js").isFunction,W=H("packages/core/src/internal/compare.js").defaultCompare,E=H("packages/core/src/internal/merge.js").mergeRow,O=H("packages/core/src/source/rows.js"),b=O.createRowFactory,u=O.groupKey,h=O.groupPathElement,l=O.groupPrefixKeys,r=O.lazyRowView,o=H("packages/core/src/source/handles.js").createHandleProvider,i=H("packages/core/src/compute/incremental.js"),t=i.RunningTotal,c=i.isIncremental,a=H("packages/core/src/compute/handle.js").presenceReader,f=H("packages/core/src/source/filterwire.js"),w=f.querySignature,g=f.mapConditions,k=f.resolveRelativeCondition,d=H("packages/core/src/source/tree.js"),p=d.buildTree,m=d.resolveTree,v=d.indexTree,y=H("packages/core/src/source/settle.js"),T=y.PIPELINE_SETTLE_REASONS,A=y.isPipelineSettle,M=Object.freeze(["filter","sort","group","total","pivot","flatten"]),_=Object.freeze([]);function R(X,V){if(!X)return null;const J=V==="grand"?X.grandTotal:X.groupTotal;return J??X.total}function I(X){return!!X&&!X.running}function j(X){if(X)return X.value&&Y(X.value.compare)?X.value.compare:Y(X.compare)?X.compare:void 0}function L(X){const V=X&&X.dataType;return!V||!Y(V.items)?null:{items:V.items,type:X.itemType&&X.itemType.name||"text"}}function F(X){return!!X&&(typeof X=="object"||typeof X=="function")&&Y(X.then)}const N=new Uint32Array(0),S=4096;function C(X,V){return new G(X,V)}function D(X,V){if(V==="regex")try{const J=new RegExp(X,"iu");return ee=>J.test(ee)}catch{return J=>J.includes(X)}if(V==="fuzzy"){const J=[...X].filter(ee=>ee!==" ");return J.length?ee=>{let te=0;for(let ie=0;ie<ee.length&&te<J.length;ie++)ee[ie]===J[te]&&te++;return te===J.length}:()=>!0}if(V==="words"){const J=X.split(/\s+/).filter(Boolean);return J.length?ee=>J.every(te=>ee.includes(te)):()=>!0}return J=>J.includes(X)}class G{mode="memory";#e;#t;#n;#r=!1;#i=null;#s;#o;#l=new Map;#a=!1;#c=0;#u=0;#f=new Map;#d=new Map;#h;#p=null;#m=G.#g();static#g(){return{slots:[],groupHeadings:_,unnumbered:_,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;#N=null;#P=null;#M=null;#R=null;#$=null;#U=null;#K=null;#x=Symbol("unset");#I=new Map;#Y=null;get#F(){return this.#m.slots}set#F(V){this.#m.slots=V}get#G(){return this.#m.inlineLeaves}set#G(V){this.#m.inlineLeaves=V}get#H(){return this.#m.groupHeadings}set#H(V){this.#m.groupHeadings=V}get#z(){return this.#m.unnumbered}set#z(V){this.#m.unnumbered=V}get#fe(){return this.#m.pivot}set#fe(V){this.#m.pivot=V}constructor(V,J){this.#t=V||{mode:"memory"},this.#e=J||{};const ee=this.#e.config||{};this.#n=this.#t.rows||ee.rows||[],this.#s=b(this.#e),this.#o=o(this.#e,()=>this.#n,()=>this.#r),this.#h=new $(Number(ee.rowCacheSize)||S);for(const te of M)this.#l.set(te,{key:null,result:null,id:0,computed:!1})}count(){this.#D();const V=this.#ne();return V?V.length:this.#F.length}#ne(){const V=Number(this.#V("pageSize",0))||0;if(V<=0)return null;const J=this.#F.length,ee=Math.max(1,Math.ceil(J/V)),ie=Math.min(Math.max(0,Number(this.#V("page",0))||0),ee-1)*V;return{offset:ie,length:Math.max(0,Math.min(V,J-ie))}}pageInfo(){this.#D();const V=Number(this.#V("pageSize",0))||0,J=this.#F.length;if(V<=0)return{page:0,pageSize:0,total:J,pageCount:1};const ee=Math.max(1,Math.ceil(J/V));return{page:Math.min(Math.max(0,Number(this.#V("page",0))||0),ee-1),pageSize:V,total:J,pageCount:ee}}totalCount(){return this.#ue().length}matchCount(){return this.#D(),this.#m.matchCount}at(V){this.#D();const J=this.#ne();if(J)return V<0||V>=J.length?void 0:this.#$e(J.offset+V,V);if(!(V<0||V>=this.#F.length))return this.#$e(V,V)}byKey(V){this.#D(),this.#p||this.#Ce();const J=this.#p.get(V);if(J!==void 0)return this.#Ae(J);for(let ee=0;ee<this.#F.length;ee++){const te=this.#F[ee];if(typeof te!="number"&&te&&te.key===V)return this.#$e(ee)}}loaded(V){return V>=0&&V<this.count()}hint(V,J){}display(){return this.#D(),this.#Y||(this.#Y=this.#Mt()),this.#Y}invalidateQuickText(){this.#I.clear(),this.invalidate("filter")}invalidate(V){const J=M.indexOf(V);J<0&&x(`unknown pipeline stage "${V}"; expected one of ${M.join(", ")}`);for(let ee=J;ee<M.length;ee++){const te=this.#l.get(M[ee]);te.key=null,te.computed=!1}this.#Y=null}apply(V){const J=[],ee={added:[],updated:[],removed:[],rejected:J};if(!V)return ee;let te=!1;const ie=new Set;if(V.remove&&V.remove.length)for(const oe of V.remove){const ue=this.#de(oe);if(ue===void 0){J.push({operation:"remove",id:this.#ye(oe),reason:"unknown-id"});continue}ee.removed.push(this.#s.keyOf(this.#r?this.#ae(ue):this.#n[ue],ue)),this.#r||(this.#n[ue]=void 0),this.#h.delete(ue),this.#I.delete(ue),te=!0}if(V.update&&V.update.length){const oe=this.#A.size||this.#Ge()?this.#Ze():null,ue=this.#v.size?this.#kt():null,ye=ue&&ue.length?this.#Ze():null;for(const he of V.update){const Re=this.#de(he);if(Re===void 0){J.push({operation:"update",id:this.#Pe(he),reason:"unknown-id"});continue}const Ce=this.#r?this.#i&&this.#i.has(Re)?this.#i.get(Re):this.#ae(Re):this.#n[Re],we=E(Ce,he);for(const re of this.#te(Ce,we))ie.add(re);if(this.#r||(this.#n[Re]=we),oe&&this.#Tt(oe,Re,Ce,we),ye&&this.#lt(ue,ye,Re,Ce,we),this.#p){const re=this.#s.keyOf(Ce,Re),de=this.#s.keyOf(we,Re);re!==de&&(this.#p.delete(re),this.#p.set(de,Re))}this.#h.delete(Re),this.#I.delete(Re),ee.updated.push(this.#Ae(Re))}}if(V.add&&V.add.length&&this.#r){typeof V.at=="number"&&V.at<this.#Me()&&(this.#h.clear(),this.#I.clear()),this.#p=null;for(const oe of V.add){const ue=this.#ie(this.#Pe(oe));ue!==void 0&&ee.added.push(this.#Ae(ue))}te=!0}else if(V.add&&V.add.length){const oe=typeof V.at=="number"?V.at:this.#n.length,ue=this.#n.length;let ye=V.add===this.#n?V.add.slice():V.add;if(this.#s.keyed){const he=[];for(const Re of ye){const Ce=this.#Pe(Re);if(this.#de(Ce)!==void 0){J.push({operation:"add",id:Ce,reason:"duplicate-id"});continue}he.push(Re)}he.length!==ye.length&&(ye=he)}if(!ye.length)return ee;if(oe>=ue)for(let he=0;he<ye.length;he++)this.#n.push(ye[he]);else this.#n.splice(oe,0,...ye),this.#h.clear(),this.#I.clear();for(let he=0;he<ye.length;he++)ee.added.push(this.#Ae(oe>=ue?ue+he:oe+he));te=!0}return this.#c++,te&&(this.#p=null,this.#nt()),this.#o.invalidate(),this.#Y=null,te||this.#X(ie)?(this.#u++,this.invalidate("filter")):this.invalidate("total"),this.#Qe("rows:changed",{companion:!0,added:ee.added.length,updated:ee.updated.length,removed:ee.removed.length}),this.#i=null,ee}groupHeadingsAt(V){this.#D();const J=this.#H;if(!J.length||!Number.isInteger(V)||V<0)return _;let ee=0,te=J.length-1,ie=-1;for(;ee<=te;){const ue=ee+te>>1;J[ue].at<=V?(ie=ue,ee=ue+1):te=ue-1}if(ie<0)return _;const oe=[];for(let ue=J[ie].row;ue;ue=ue.parent)oe.push(ue);return oe.reverse(),oe}unnumberedRowCount(V){this.#D();const J=this.#z;if(!J.length||!Number.isInteger(V)||V<0)return 0;let ee=0,te=J.length-1,ie=-1;for(;ee<=te;){const oe=ee+te>>1;J[oe].at<=V?(ie=oe,ee=oe+1):te=oe-1}return ie+1}moveRow(V,J){if(this.#r)return B("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(V)||!Number.isInteger(J)||V<0||V>=ee.length)return!1;const te=Math.max(0,Math.min(ee.length-1,J));if(te===V)return!1;const[ie]=ee.splice(V,1);return ee.splice(te,0,ie),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#I.clear(),this.#nt(),this.#o.invalidate(),this.#Y=null,this.invalidate("filter"),this.#Qe("rows:changed",{companion:!0,added:0,updated:0,removed:0,moved:1}),!0}reload(V){this.#pe(),this.#c++,this.#u++,this.#p=null,this.#I.clear(),this.#h.clear(),this.#nt(),this.#o.invalidate(),this.invalidate("filter"),this.#Qe("model:changed",{reason:"reload"})}destroy(){this.#pe(),this.#h.clear(),this.#I.clear(),this.#p=null,this.#F=[],this.#G=null,this.#Y=null,this.#nt();for(const V of M)this.#l.set(V,{key:null,result:null,id:0,computed:!1})}#pe(){for(const{controller:V}of this.#b.values())try{V.abort()}catch{}this.#b.clear()}setRows(V){this.#n=V||[],this.#r=!1,this.#c++,this.#u++,this.#p=null,this.#I.clear(),this.#h.clear(),this.#nt(),this.#o.invalidate(),this.invalidate("filter")}notePriorRows(V){this.#i=V||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#I.clear(),this.#o.invalidate()}data(){if(!this.#r)return this.#n;const V=this.#e.store;if(!V||!Y(V.source))return this.#n;const J=V.physical||0,ee=new Array(J);for(let te=0;te<J;te++)ee[te]=V.live&&!V.live(te)?void 0:V.source(te);return ee}#Fe(){const V=this.#V("detail",null);return!V||!Y(V.isOpen)||V.inline===!1?null:V}#Oe(){const V=(this.#e.config||{}).tree;return this.#x!==V&&(this.#x=V,this.#K=m(V,{dataAt:J=>this.#ae(J),keyOf:J=>this.#s.keyOf(this.#ae(J),J)})),this.#K}#me(){return(this.#e.config||{}).grandTotalRow==="bottom"}grandTotalRow(){if(!this.#me())return null;this.#D();const V=this.#m.grand;return V?this.#s.grandTotal(V,this.#et(this.#m.grandLeaves)):null}pivot(){return this.#D(),this.#fe}pivotMatrix(){this.#D();const V=this.#m.groupLeaves,J=(this.#e.compute||{}).pivotMatrix;if(!Y(J))return null;const ee=this.#V("groupBy",[]),te=this.#V("pivotBy",[]);if(!ee.length&&!te.length)return B("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 ie=this.#Ze().map(ue=>({colId:ue.id,handle:this.#o.handle(ue.id),fn:R(ue,"group")})).filter(ue=>ue.handle&&ue.fn),oe=this.#e.config||{};return J({rowHandles:ee.map(ue=>this.#o.handle(ue)).filter(Boolean),columnHandles:te.map(ue=>this.#o.handle(ue)).filter(Boolean),measures:ie,leaves:V||new Uint32Array(0),opts:{locale:oe.locale,separator:(oe.pivot||{}).separator,maxColumns:(oe.pivot||{}).maxColumns}})}keysForLeaves(V){const J=[];if(!V)return J;for(let ee=0;ee<V.length;ee++){const te=this.#Ae(V[ee]);te&&te.key!=null&&J.push(String(te.key))}return J}leavesOf(V){this.#D();const J=this.#l.get("group"),ee=J&&J.result;if(!ee||!ee.nodes)return[];const te=ee.nodes.get(V);if(!te)return[];const ie=[],oe=ue=>{const ye=ue.row&&ue.row.children;if(ye&&ye.length){for(const he of ye){const Re=ee.nodes.get(he.key);Re&&oe(Re)}return}if(ue.leaves)for(let he=0;he<ue.leaves.length;he++)ie.push(this.#Ae(ue.leaves[he]))};return oe(te),ie}#ye(V){return typeof V=="string"?V:this.#Pe(V)}#Pe(V){try{return this.#s.keyOf(V,-1)}catch{return"(unkeyed)"}}#de(V){if(typeof V=="string")return this.#ie(V);if(this.#s.keyed){const ee=this.#s.keyOf(V,-1),te=this.#ie(ee);if(te!==void 0)return te}if(this.#r)return;const J=this.#n.indexOf(V);return J>=0?J:void 0}#ie(V){return this.#p||this.#Ce(),this.#p.get(V)}#Ce(){this.#p=new Map;const V=this.#Me(),J=this.#e.store,ee=J&&Y(J.live)?te=>J.live(te):null;for(let te=0;te<V;te++){if(ee&&!ee(te))continue;const ie=this.#ae(te);ie!==void 0&&this.#p.set(this.#s.keyOf(ie,te),te)}}#te(V,J){const ee=[];for(const te of this.#W())this.#Ue(te)&&this.#J(te,V,J,new Set)&&ee.push(te);return ee}#J(V,J,ee,te){if(te.has(V))return!1;te.add(V);const ie=this.#Ue(V);if(!ie)return!1;const oe=ie.value&&ie.value.deps;return Array.isArray(oe)&&oe.length?oe.some(ue=>this.#J(String(ue),J,ee,te)):Y(ie.getValue)?!Object.is(ie.getValue(J),ie.getValue(ee)):!1}#W(){const V=new Set;for(const ee of this.#V("sort",[]))V.add(ee.col);for(const ee of this.#V("groupBy",[]))V.add(ee);const J=ee=>{if(ee){if(Array.isArray(ee.conditions)){ee.conditions.forEach(J);return}ee.col&&V.add(ee.col)}};return J(this.#V("filters",null)),[...V]}#X(V){if(!V.size)return!1;if(this.#V("quick",""))return!0;for(const J of this.#W())if(V.has(J))return!0;return!1}#D(){if(!this.#a){this.#a=!0;try{this.#Ne()}finally{this.#a=!1}}}pipelineRunning(){return this.#a}#Ne(){const V=this.#B("filter",()=>this.#_(),()=>this.#Re()),J=this.#q(V),ee=this.#B("group",()=>this.#ge(),()=>this.#Ye(J)),te=this.#B("total",()=>this.#we(),()=>this.#_e(ee));this.#B("pivot",()=>this.#k(),()=>this.#At(ee)),this.#B("flatten",()=>this.#Se(),()=>this.#Ke(ee)),this.#Be(ee,te)}#q(V){const J=this.#l.get("sort"),ee=this.#se();if(J.computed&&J.key===ee&&!this.#b.has("sort"))return J.result;const te=this.#b.get("sort");return te&&te.key===ee?J.result:J.result&&this.#Ee(V)?(this.#Te(V,ee),J.result):this.#B("sort",()=>ee,()=>this.#Ie(V))}#re(){if(this.#y===null){const V=this.#e.pipelineWorker,J=Y(V)?V():null;this.#y=J||!1}return this.#y||null}#ve(){const V=this.#V("sort",[]);if(!Array.isArray(V)||!V.length)return null;const J=(this.#e.config||{}).locale,ee=[],te=[];for(const ie of V){const oe=this.#Ue(ie.col);if(oe&&oe.running)continue;if(oe&&oe.value&&Y(oe.value.compare))return null;const ue=this.#o.handle(ie.col);if(!ue)return null;ee.push({col:ie.col,descending:ie.dir==="desc",nullsFirst:!!ie.nullsFirst,locale:J}),te.push(ue)}return ee.length?{entries:ee,handles:te,locale:J}:null}#Ee(V){if(this.#ce())return!1;const J=this.#re();if(!J)return!1;const ee=Number(J.threshold);return Number.isFinite(ee)&&V.length<ee?!1:!!this.#ve()}#Te(V,J){const ee=this.#re(),te=ee&&this.#ve();if(!te){this.#B("sort",()=>J,()=>this.#Ie(V));return}const ie=new AbortController;this.#b.set("sort",{key:J,controller:ie});const oe=te.entries.length===1?ee.sortColumn(te.handles[0],V,{descending:te.entries[0].descending,nullsFirst:te.entries[0].nullsFirst,locale:te.locale,signal:ie.signal,key:"sort"}):ee.sortMulti(te.handles,te.entries.map((ue,ye)=>({...ue,handle:te.handles[ye]})),V,{signal:ie.signal,key:"sort"});if(!F(oe)){this.#b.delete("sort"),this.#B("sort",()=>J,()=>oe);return}oe.then(ue=>this.#le(J,ue),ue=>this.#he("sort",J,ue))}#le(V,J){const ee=this.#b.get("sort");if(!(!ee||ee.key!==V)){if(this.#se()!==V){this.#b.delete("sort");return}this.#b.delete("sort"),this.#B("sort",()=>V,()=>J),this.#Y=null,this.#D(),this.#Qe("model:changed",{reason:T[0]})}}#he(V,J,ee){const te=this.#b.get(V);if(!(!te||te.key!==J)&&(this.#b.delete(V),!(ee&&ee.name==="AbortError")&&V==="sort"&&this.#se()===J)){const ie=this.#B("filter",()=>this.#_(),()=>this.#Re());this.#B("sort",()=>J,()=>this.#Ie(ie)),this.#Y=null,this.#D(),B("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",ee),this.#Qe("model:changed",{reason:T[1]})}}#Be(V,J){const ee=V&&V.leaves?V.leaves.length:this.#m.slots.length;this.#m.matchCount=ee,this.#m.grand=J&&J.grand||null,this.#m.grandLeaves=V&&V.leaves?V.leaves.length:0,this.#m.groupLeaves=V&&V.leaves?V.leaves:null}#B(V,J,ee){const te=this.#l.get(V),ie=J();return te.computed&&te.key===ie||(te.result=ee(),te.key=ie,te.computed=!0,te.id++,V==="flatten"&&(this.#Y=null)),te.result}#C(V){return this.#l.get(V).id}#_(){const V=(this.#e.config||{}).hostFilter,J=V&&Y(V.active)&&V.active()?1:0,ee=this.#V("where",null),te=ee?ee.version:0,ie=this.#gt("filter.sig",`${this.#ut()}`,()=>w({filters:this.#V("filters",null),quick:this.#V("quick",""),quickMode:this.#V("quickMode","contains")}));return`${this.#u}|${ie}|${J}|${te}`}#se(){const V=this.#ce();return`${this.#C("filter")}|${JSON.stringify(this.#V("sort",[]))}`+(V?`|manual:${V.version}`:"")}#ce(){const V=this.#V("rowOrder",null);return V&&Array.isArray(V.keys)?V:null}#oe(V,J){this.#p||this.#Ce();const ee=this.#p,te=this.#Me(),ie=J.keys.length,oe=new Float64Array(te);for(let ue=0;ue<te;ue++)oe[ue]=ie+ue;for(let ue=0;ue<ie;ue++){const ye=ee.get(J.keys[ue]);ye!==void 0&&(oe[ye]=ue)}return Uint32Array.from(V).sort((ue,ye)=>oe[ue]-oe[ye])}orderedKeys(){this.#p||this.#Ce();const V=this.#p,J=new Map;for(const[ue,ye]of V)J.set(ye,ue);const ee=Uint32Array.from([...J.keys()]).sort(),te=this.#ce(),ie=te?this.#oe(ee,te):this.#Ie(ee),oe=new Array(ie.length);for(let ue=0;ue<ie.length;ue++)oe[ue]=J.get(ie[ue]);return oe}#ge(){const V=this.#V("pivotBy",[]).length>0?"p":"u";return`${this.#C("sort")}|${JSON.stringify(this.#V("groupBy",[]))}|${V}`}#we(){const V=this.#Xe()?"f":"a",J=(this.#e.config||{}).totalOnlyChangedColumns?"n":"w";return`${this.#C("group")}|${JSON.stringify(this.#V("totals",[]))}|${V}${J}|${this.#c}`}#k(){return`${this.#C("group")}|${JSON.stringify(this.#V("pivotBy",[]))}`}#Se(){const J=this.#ze()||!this.#me()?this.#C("total"):"x",ee=`${this.#ut()}`,te=this.#gt("flatten.keys",ee,()=>{const oe=this.#V("expanded",null);return oe?[...oe].sort().join(""):"*"}),ie=this.#gt("flatten.detail",ee,()=>{const oe=this.#V("detail",null);return oe&&Y(oe.signature)?oe.signature():""});return`${J}|${this.#C("pivot")}|${te}|${ie}`}#ze(){const V=this.#V("groupBy",[]);return Array.isArray(V)&&V.length>0}stageState(){const V=[];for(const[J,ee]of this.#l){const te=ee.result;V.push({stage:J,materialised:!!ee.computed,bytes:te&&typeof te.byteLength=="number"?te.byteLength:null,rows:te&&typeof te.length=="number"?te.length:null,rebuilds:ee.id})}return V}facetIndices(V){return this.#Re(V||null)}facetRows(V){const J=this.facetIndices(V),ee=[];for(let te=0;te<J.length;te++){const ie=this.#Ae(J[te]);ie&&ee.push(ie)}return ee}invalidateRows(){this.#h.clear(),this.#I.clear(),this.#Y=null}invalidateHandles(){this.#o.invalidate()}rows(){return this.#n}unfilteredIndices(){return this.#ue()}filteredIndices(){const V=this.#l.get("filter");if(V&&V.computed&&V.key===this.#_())return V.result||this.#ue();this.#D();const J=this.#l.get("filter");return(J&&J.computed?J.result:null)||this.#ue()}unfilteredRows(){const V=this.#ue(),J=[];for(let ee=0;ee<V.length;ee++){const te=this.#Ae(V[ee]);te&&J.push(te)}return J}#Re(V=null){const J=this.#ue(),ee=this.#V("filters",null),te=V?this.#it("pruneColumn")(ee,V):ee,ie=this.#st(te),oe=String(this.#V("quick","")||"").trim().toLowerCase(),ue=oe?D(oe,String(this.#V("quickMode","contains")||"contains")):null,ye=(this.#e.config||{}).hostFilter,he=!!(ye&&Y(ye.active)&&ye.active()),Re=this.#V("where",null),Ce=!!(Re&&Re.active);if(!ie&&!oe&&!he&&!Ce)return J;let we=null;ie&&(we=this.#it("evaluateFilters")(ie,{handle:Oe=>this.#o.handle(Oe),count:this.#Me(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:Oe=>L(this.#Ue(Oe))}));const re=new Uint32Array(J.length);let de=0;for(let me=0;me<J.length;me++){const Oe=J[me];if(!(we&&!we[Oe])&&!(ue&&!this.#ct(Oe,ue))){if(he||Ce){const ke=this.#Ae(Oe);if(he&&!ye.passes(ke)||Ce&&!Re.passes(ke.data,ke.key))continue}re[de++]=Oe}}if(we){const me=(this.#e.compute||{}).releaseMask;Y(me)&&me({pool:this.#e.pool},we)}return re.subarray(0,de)}handleFor(V){return this.#o.handle(V)}#Ie(V){const J=this.#ce();if(J)return this.#oe(V,J);const ee=this.#V("sort",[]).filter(oe=>{const ue=this.#Ue(oe.col);return!ue||!ue.running?!0:(B(`source.sort.running.${oe.col}`,`sort ignores "${oe.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 V;const te=(this.#e.config||{}).locale;if(ee.length===1){const oe=ee[0],ue=this.#o.handle(oe.col);if(!ue)return B(`source.sort.${oe.col}`,`sort ignores unknown column "${oe.col}".`),V;const ye=this.#Ue(oe.col);return this.#it("sortColumn")(ue,V,{descending:oe.dir==="desc",nullsFirst:oe.nullsFirst,locale:te,compare:j(ye)})}const ie=[];for(const oe of ee){const ue=this.#o.handle(oe.col);if(!ue){B(`source.sort.${oe.col}`,`sort ignores unknown column "${oe.col}".`);continue}ie.push({handle:ue,descending:oe.dir==="desc",nullsFirst:oe.nullsFirst,locale:te,compare:j(this.#Ue(oe.col))})}return ie.length?this.#it("sortMulti")(ie.map(oe=>oe.handle),ie,V):V}#Ye(V){const J=this.#V("groupBy",[]),ee=this.#Oe();if(ee&&!J.length){const me=p(V,ee);return this.#$=v(me.roots,ee.declaresChildren),{roots:null,leaves:V,nodes:new Map,tree:me}}if(this.#$=null,ee&&J.length&&B("tree.grouped","grouping is active on a grid configured with `tree`; the grouping wins and the hierarchy is not shown."),!J.length)return{roots:null,leaves:V,nodes:new Map};const te=(this.#e.config||{}).timeZone,ie=[],oe=[];let ue=!1;for(const me of J){const Oe=this.#o.handle(me);if(!Oe){B(`source.group.${me}`,`grouping ignores unknown column "${me}".`);continue}ie.push(Oe);const ke=this.#Ue(me),Le=ke&&ke.dataType;if(Le&&Y(Le.groupProjector)){const ce=ke.typeOptions&&ke.typeOptions.timeZone||te||void 0,ge=Le.groupProjector(ke,ce);oe.push(ge||null),ge&&(ue=!0)}else oe.push(null)}if(!ie.length)return{roots:null,leaves:V,nodes:new Map};const{keys:ye,buckets:he}=this.#it("groupByColumns")(ie,V,{locale:(this.#e.config||{}).locale,project:ue?oe:void 0}),Re=this.#V("pivotBy",[]).length>0,Ce=[],we=new Map;for(let me=0;me<he.length;me++){const Oe=ye[me];let ke=null;const Le=[];for(let ce=0;ce<Oe.length;ce++){Le.push(h(Oe[ce]));const ge=u(Le),Se=ce===Oe.length-1;let Fe=we.get(ge);if(!Fe){const be=this.#s.group({path:[...Le],column:J[ce],value:Oe[ce],level:ce,parent:ke,expanded:Re&&Se?!1:this.#pt(ge,{key:ge,column:J[ce],value:Oe[ce],level:ce,path:[...Le]}),hasChildren:!(Re&&Se)});Fe={row:be,leaves:null},we.set(ge,Fe),ke?ke.children.push(be):Ce.push(be)}Fe.row.leafCount+=he[me].length,ce===Oe.length-1&&(Fe.leaves=he[me]),ke=Fe.row}}const re=this.#V("sort",[])||[],de=(me,Oe)=>{if(!me||me.length<2){if(me)for(const ge of me)de(ge.children,Oe+1);return}const ke=J[Oe],Le=re.find(ge=>ge.col===ke),ce=Le&&Le.dir==="desc"?-1:1;me.sort((ge,Se)=>ce*W(ge.groupValue,Se.groupValue));for(const ge of me)de(ge.children,Oe+1)};return de(Ce,0),{roots:Ce,leaves:V,nodes:we,keys:ye,buckets:he}}#Ve(V,J){const ee=new Map,te=new Map,ie=oe=>{const ue=oe.physical>=0?[oe.physical]:[];for(const ye of oe.children)ue.push(...ie(ye));if(oe.children.length){const ye=this.#rt(J,Uint32Array.from(ue),null);oe.physical>=0?ee.set(oe.physical,ye):te.set(oe.key,ye)}return ue};for(const oe of V.roots)ie(oe);return{byPhysical:ee,byKey:te}}#_e(V){const J=this.#Ze();if(!J.length)return this.#N=null,this.#P=null,{grand:null};const ee={id:this.#C("group"),columns:J.map(re=>re.id).join("")},te=this.#N&&this.#N.id===ee.id&&this.#N.columns===ee.columns,ie=this.#Ge()&&te?this.#E:null,oe=ie?J.filter(re=>ie.has(re.id)):J,ue=te?this.#P:null,ye=this.#Xe()?null:this.#tt(),he=this.#be(J),Re=re=>{const de=V.nodes.get(re.key);let me=de&&de.leaves?de.leaves:null;if(re.children&&re.children.length){const Le=re.children.map(Re);let ce=0;for(const Fe of Le)ce+=Fe.length;const ge=new Uint32Array(ce);let Se=0;for(const Fe of Le)ge.set(Fe,Se),Se+=Fe.length;me=ge}me=me||new Uint32Array(0);const Oe=ye?ye.get(re.key)||N:me,ke=this.#at(re,ie?oe:J,Oe,he);return re.totals=ie?{...re.totals,...ke}:ke,me};if(V.roots&&oe.length)for(const re of V.roots)Re(re);if(this.#U=V.tree?this.#Ve(V.tree,J):null,this.#N=ee,this.#E=this.#Ge()?new Set:null,!(this.#e.config||{}).grandTotalRow)return this.#O.length=0,this.#P=null,{grand:null};const we=ye?this.#qe():V.leaves;return this.#P=this.#We(J,we,ie,ue),{grand:this.#P}}#We(V,J,ee,te){const ie={},oe=this.#C("group");oe!==this.#w&&(this.#St(),this.#w=oe);const ue=this.#O;this.#O=[];for(const ye of V){if(!I(ye))continue;const he=this.#o.handle(ye.id);if(!he)continue;const Re=R(ye,"grand");if(!c(Re,he)){if(ee&&!ee.has(ye.id)&&te&&ye.id in te){ie[ye.id]=te[ye.id];continue}ie[ye.id]=this.#rt([ye],J,null,"grand")[ye.id];continue}let Ce=this.#A.get(ye.id);if((!Ce||Ce.fn!==Re)&&(Ce=new t(Re),this.#A.set(ye.id,Ce)),Ce.valid){let we=!0;for(const re of ue)if(re.colId===ye.id&&!Ce.update(re.before,re.after)){we=!1;break}if(we){ie[ye.id]=Ce.value();continue}Ce.invalidate()}Ce.seedColumn(he.values,a(he),J),ie[ye.id]=Ce.valid?Ce.value():this.#rt([ye],J,null,"grand")[ye.id]}return ie}#be(V){const J=this.#C("group");J!==this.#T&&(this.#v.clear(),this.#T=J);const ee=new Map;for(const ie of V){if(!I(ie))continue;const oe=this.#o.handle(ie.id),ue=R(ie,"group");c(ue,oe)&&ee.set(ie.id,{fn:ue})}if(!ee.size)return this.#S.length=0,ee;const te=this.#S;this.#S=[];for(const ie of te){const{beforeKeys:oe,afterKeys:ue,colDeltas:ye}=ie,he=oe.length?new Set(oe):null,Re=ue.length?new Set(ue):null;for(const{colId:Ce,before:we,after:re}of ye)if(ee.has(Ce)){for(const de of oe)Re&&Re.has(de)||this.#ke(de,Ce,we,null);for(const de of ue)he&&he.has(de)||this.#ke(de,Ce,null,re);for(const de of oe)Re&&!Re.has(de)||this.#ke(de,Ce,we,re)}}return ee}#ke(V,J,ee,te){const ie=this.#v.get(V),oe=ie&&ie.get(J);!oe||!oe.valid||oe.update(ee,te)||oe.invalidate()}#at(V,J,ee,te){if(!te||!te.size)return this.#rt(J,ee,V);const ie={};let oe=null,ue=this.#v.get(V.key);for(const ye of J){const he=te.get(ye.id);if(!he){(oe||(oe=[])).push(ye);continue}const Re=this.#o.handle(ye.id);if(!Re)continue;ue||(ue=new Map,this.#v.set(V.key,ue));let Ce=ue.get(ye.id);if((!Ce||Ce.fn!==he.fn)&&(Ce=new t(he.fn),ue.set(ye.id,Ce)),Ce.valid||Ce.seedColumn(Re.values,a(Re),ee),Ce.valid){ie[ye.id]=Ce.value();continue}(oe||(oe=[])).push(ye)}return oe&&Object.assign(ie,this.#rt(oe,ee,V)),ie}#Tt(V,J,ee,te){const ie=!this.#Xe()||this.#Ot(J);for(const oe of V){const ue=oe.getValue;if(!Y(ue))continue;const ye=ue(ee),he=ue(te);Object.is(ye,he)||(this.#E&&this.#E.add(oe.id),ie&&this.#A.has(oe.id)&&this.#O.push({colId:oe.id,before:ye,after:he}))}}#kt(){const V=this.#V("groupBy",[]),J=[];for(const ee of V){const te=this.#Ue(ee);te&&J.push(te)}return J}#ee(V,J){const ee=new Array(V.length);for(let te=0;te<V.length;te++){const ie=V[te].getValue;ee[te]=h(Y(ie)?ie(J):void 0)}return ee}#lt(V,J,ee,te,ie){if(this.#Xe()&&!this.#Ot(ee))return;const oe=l(this.#ee(V,te)),ue=l(this.#ee(V,ie)),ye=oe.length!==ue.length||oe.some((Re,Ce)=>Re!==ue[Ce]),he=[];for(const Re of J){const Ce=Re.getValue;if(!Y(Ce))continue;const we=Ce(te),re=Ce(ie);!ye&&Object.is(we,re)||he.push({colId:Re.id,before:we,after:re})}!he.length&&!ye||this.#S.push({beforeKeys:oe,afterKeys:ue,colDeltas:he})}#Ot(V){const J=this.#l.get("filter"),ee=J&&J.computed?J.result:null;if(!ee)return!0;let te=0,ie=ee.length-1;for(;te<=ie;){const oe=te+ie>>1,ue=ee[oe];if(ue===V)return!0;ue<V?te=oe+1:ie=oe-1}return!1}#Xe(){return(this.#e.config||{}).totalFilteredOnly!==!1}#et(V){return this.#Xe()?V:this.#qe().length}#qe(){return(!this.#M||this.#M.version!==this.#u)&&(this.#M={version:this.#u,indices:this.#ue()}),this.#M.indices}#tt(){const V=this.#V("groupBy",[]),J=`${this.#u}|${JSON.stringify(V)}`;if(this.#R&&this.#R.key===J)return this.#R.map;const ee=new Map,te=[];for(const ie of V){const oe=this.#o.handle(ie);oe&&te.push(oe)}if(te.length){const ie=this.#qe(),{keys:oe,buckets:ue}=this.#it("groupByColumns")(te,ie,{locale:(this.#e.config||{}).locale}),ye=new Map;for(let he=0;he<ue.length;he++){const Re=oe[he],Ce=[];for(let we=0;we<Re.length;we++){Ce.push(h(Re[we]));const re=u(Ce);let de=ye.get(re);de||(de=[],ye.set(re,de));for(let me=0;me<ue[he].length;me++)de.push(ue[he][me])}}for(const[he,Re]of ye)ee.set(he,Uint32Array.from(Re))}return this.#R={key:J,map:ee},ee}#Ge(){return!!(this.#e.config||{}).totalOnlyChangedColumns}#nt(){this.#St(),this.#j(),this.#E=null,this.#N=null,this.#P=null}#St(){this.#A.clear(),this.#O.length=0,this.#w=-1}#j(){this.#v.clear(),this.#S.length=0,this.#T=-1}#At(V){const J=this.#V("pivotBy",[]);if(!J.length)return this.#fe=null,null;const ee=(this.#e.compute||{}).pivot;if(!Y(ee))return B("source.pivot.kernel","pivot requested but ctx.compute.pivot is not available; showing unpivoted rows."),this.#fe=null,null;const te=J.map(oe=>this.#o.handle(oe)).filter(Boolean),ie=this.#Ze();return this.#fe=ee(te,V.leaves,{groups:V.keys&&V.buckets?{keys:V.keys,buckets:V.buckets}:null,totals:ie.map(oe=>oe.id),handle:oe=>this.#o.handle(oe),totalOf:oe=>R(ie.find(ue=>ue.id===oe),"group"),separator:((this.#e.config||{}).pivot||{}).separator,maxColumns:((this.#e.config||{}).pivot||{}).maxColumns})||null,this.#fe}#Ke(V){const J=this.#l.get("total").result,ee=!!(this.#e.config||{}).groupFooter,te=this.#Fe();if(V.tree)return this.#jt(V,J,te);if(!V.roots&&!te){if(J&&J.grand&&!this.#me()){const Re=this.#s.grandTotal(J.grand,this.#et(V.leaves.length));if(this.#G===V.leaves&&Array.isArray(this.#F))this.#F[this.#F.length-1]=Re;else{const Ce=Array.from(V.leaves);Ce.push(Re),this.#F=Ce,this.#G=V.leaves}this.#z=[{at:this.#F.length-1}]}else this.#G=null,this.#F=V.leaves,this.#z=_;return this.#H=_,this.#F}const ie=[],oe=[],ue=[],ye=Re=>{if(ie.push(Re),!te)return;const Ce=this.#Ae(Re);!Ce||!te.isOpen(Ce.key)||(Ce.master=!0,Ce.expanded=!0,ue.push({at:ie.length}),ie.push(this.#s.detail(Ce,te.heightOf(Ce))))};if(!V.roots){for(let Re=0;Re<V.leaves.length;Re++)ye(V.leaves[Re]);return J&&J.grand&&!this.#me()&&(ue.push({at:ie.length}),ie.push(this.#s.grandTotal(J.grand,this.#et(V.leaves.length)))),this.#G=null,this.#H=_,this.#z=ue.length?ue:_,this.#F=ie,ie}const he=(Re,Ce,we)=>{if(Re.expanded=Re.hasChildren===!1?!1:this.#pt(Re.key,{key:Re.key,column:Re.groupColumn,value:Re.groupValue,level:Re.level,path:Re.groupPath}),Re.posinset=Ce+1,Re.setsize=we,oe.push({at:ie.length,row:Re}),ue.push({at:ie.length}),ie.push(Re),!!Re.expanded){if(Re.children&&Re.children.length)for(let re=0;re<Re.children.length;re++)he(Re.children[re],re,Re.children.length);else{const re=V.nodes.get(Re.key),de=re&&re.leaves?re.leaves:null;if(de)for(let me=0;me<de.length;me++)ye(de[me])}ee&&Re.totals&&(ue.push({at:ie.length}),ie.push(this.#s.footer(Re)))}};for(let Re=0;Re<V.roots.length;Re++)he(V.roots[Re],Re,V.roots.length);return J&&J.grand&&!this.#me()&&(ue.push({at:ie.length}),ie.push(this.#s.grandTotal(J.grand,this.#et(V.leaves.length)))),this.#H=oe,this.#z=ue,this.#F=ie,ie}#ue(){const V=this.#e.store;if(V&&Y(V.liveIndices))return V.liveIndices();const J=new Uint32Array(this.#n.length);let ee=0;for(let te=0;te<this.#n.length;te++)this.#n[te]!==void 0&&(J[ee++]=te);return J.subarray(0,ee)}#Me(){const V=this.#e.store;return V&&typeof V.physical=="number"?V.physical:this.#n.length}#ae(V){const J=this.#e.store;return J&&Y(J.source)?J.source(V):this.#n[V]}#$e(V,J=V){const ee=this.#F[V];if(typeof ee!="number")return ee.index=J,ee;const te=this.#Ae(ee);return te.index=J,te}#Ae(V){let J=this.#h.get(V);J||(J=this.#s.leaf(this.#ae(V),V),this.#h.set(V,J));const ee=this.#$?this.#$.get(V):null;if(ee){J.level=ee.level,J.posinset=ee.posinset,J.setsize=ee.setsize,J.hasChildren=ee.hasChildren,J.expanded=ee.hasChildren&&!ee.lazy&&this.#pt(J.key);const te=this.#U?this.#U.byPhysical.get(V):void 0;te?J.totals=te:J.totals&&(J.totals=null)}else J.hasChildren&&(J.level=0,J.hasChildren=!1,J.expanded=!1,J.posinset=void 0,J.setsize=void 0);return J}#jt(V,J,ee){const te=[],ie=[],oe=ye=>{if(ye.leafCount!==void 0)return ye.leafCount;let he=ye.physical>=0?1:0;for(const Re of ye.children)he+=oe(Re);return ye.leafCount=he,he},ue=ye=>{const he=this.#pt(ye.key);if(ye.physical>=0){if(te.push(ye.physical),ee&&ee.isOpen(this.#Ae(ye.physical).key)){const Re=this.#Ae(ye.physical);ie.push({at:te.length}),te.push(this.#s.detail(Re,ee.heightOf(Re)))}}else te.push(this.#s.group({path:[ye.key],column:null,value:ye.value,level:ye.level,parent:null,expanded:he,hasChildren:ye.children.length>0,leafCount:oe(ye),totals:this.#U?this.#U.byKey.get(ye.key):void 0}));if(he)for(const Re of ye.children)ue(Re)};for(const ye of V.tree.roots)ue(ye);return J&&J.grand&&!this.#me()&&(ie.push({at:te.length}),te.push(this.#s.grandTotal(J.grand,this.#et(V.leaves.length)))),this.#G=null,this.#H=_,this.#z=ie.length?ie:_,this.#F=te,te}#Mt(){return r(()=>this.count(),V=>this.at(V))}#ct(V,J){let ee=this.#I.get(V);if(ee===void 0){const te=this.#ae(V),ie=this.#ot(),oe=[],ue=this.#e.columnHidden;for(const ye of ie){if(ye.quickFilter===!1||Y(ue)&&ue(ye.id))continue;const he=ye.value&&Y(ye.value.quickFilterText)?ye.value.quickFilterText({value:void 0,data:te,row:null,column:ye,colId:ye.id,grid:null,context:this.#V("context",null)}):null,Re=he??(Y(ye.formatValue)?ye.formatValue(Y(ye.getValue)?ye.getValue(te):void 0):"");Re!=null&&Re!==""&&oe.push(String(Re))}ee=oe.join(" ").toLowerCase(),this.#I.set(V,ee)}return J(ee)}#Ze(){const V=this.#V("totals",[]),J=V&&V.length?new Set(V):null;return this.#ot().filter(ee=>J?J.has(ee.id):!!(ee.total||ee.groupTotal||ee.grandTotal))}#rt(V,J,ee,te="group"){const ie={},oe=(this.#e.compute||{}).total;for(const ue of V){if(!I(ue))continue;const ye=this.#o.handle(ue.id);if(!ye)continue;const he=R(ue,te);if(he)if(Y(he)){const Re=new Array(J.length);for(let Ce=0;Ce<J.length;Ce++)Re[Ce]=ye.get(J[Ce]);ie[ue.id]=he(Re,{row:ee,column:ue,grid:this.#e.grid||null,context:this.#V("context",null),valueAt:(Ce,we)=>{const re=this.#o.handle(Ce);return re&&we>=0&&we<J.length?re.get(J[we]):null}})}else Y(oe)&&(ie[ue.id]=oe(ye,J,he))}return ie}#st(V){if(!V)return V;const J=this.#e.config||{},ee={tz:J.timeZone,weekStartsOn:J.weekStartsOn};return g(V,te=>{const ie=k(te,ee),oe=this.#Ue(ie&&ie.col),ue=oe&&oe.type==="datetime";if(ie&&ie.type)return ie.type==="datetime"&&!ie.timeZone&&oe?{...ie,timeZone:J.timeZone||void 0}:ie;if(ue)return{...ie,type:"datetime",timeZone:J.timeZone||void 0};const ye=oe&&(oe.dataType?.base||oe.type);return ye?{...ie,type:ye}:ie})}#pt(V,J){const ee=this.#V("expanded",null);return ee?Y(ee.has)?ee.has(V,J):Array.prototype.includes.call(ee,V):!0}#V(V,J){if(V==="context"||!Y(this.#e.stateVersion))return this.#Nt(V,J);const ee=this.#mt(V),te=this.#f.get(V);if(te&&te.version===ee)return te.value;const ie=this.#Nt(V,J);return this.#f.set(V,{version:ee,value:ie}),ie}#Nt(V,J){const ee=this.#e.state;if(ee&&Y(ee[V])){const te=ee[V]();return te??J}return J}#ut(){const V=this.#e.stateVersion;return Y(V)?V():0}#xt(){const V=this.#e.columnsVersion,J=this.#e.permissionsVersion;return`${Y(V)?V():0}|${Y(J)?J():0}`}#mt(V){return V==="totals"?this.#xt():`${this.#ut()}`}#gt(V,J,ee){if(!Y(this.#e.stateVersion))return ee();const te=this.#d.get(V);if(te&&te.version===J)return te.key;const ie=ee();return this.#d.set(V,{version:J,key:ie}),ie}#it(V){const J=(this.#e.compute||{})[V];return Y(J)||x(`ctx.compute.${V} is required by the memory source pipeline`),J}#ot(){const V=this.#e.columns;return V&&Y(V.all)?V.all():[]}#Ue(V){const J=this.#e.columns;return J&&Y(J.get)?J.get(V):void 0}#Qe(V,J){const ee=this.#e.emit;Y(ee)&&ee(V,J)}}}),Ue("packages/core/src/source/abort.js",function(e,H){"use strict";Object.defineProperty(e,"SupersededError",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"RequestToken",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"AbortScope",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createAbortScope",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return x}});class ne extends Error{constructor(Y,U="superseded"){super(`[lattice] request ${Y?`"${Y}" `:""}${U}`),this.name="SupersededError",this.superseded=!0,this.key=Y}}class ${#e;constructor(Y,U,W,K){this.#e=Y,this.key=U,this.controller=W,this.signal=W.signal,this.seq=K}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(Y){this.signal.aborted||this.controller.abort(new ne(this.key,Y)),this.#e.settle(this)}}class q{#e=new Map;#t=0;begin(Y="",U="superseded"){const W=this.#e.get(Y);W&&!W.signal.aborted&&W.controller.abort(new ne(Y,U));const K=new $(this,Y,new AbortController,++this.#t);return this.#e.set(Y,K),K}tokenFor(Y){return this.#e.get(Y)}pending(Y=""){const U=this.#e.get(Y);return!!U&&!U.signal.aborted}get size(){return this.#e.size}settle(Y){this.#e.get(Y.key)===Y&&this.#e.delete(Y.key)}abort(Y="",U="superseded"){const W=this.#e.get(Y);W&&W.abort(U)}abortAll(Y="superseded"){for(const U of[...this.#e.values()])U.abort(Y);this.#e.clear()}}function B(){return new q}function x(Z){if(!Z||typeof Z!="object")return!1;const Y=Z;return Y.superseded===!0||Y.name==="AbortError"||Y.name==="SupersededError"}}),Ue("packages/core/src/source/blockcache.js",function(e,H){"use strict";Object.defineProperty(e,"DEFAULT_PAGE_SIZE",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"DEFAULT_MAX_CACHED_PAGES",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"BlockCache",{enumerable:!0,get:function(){return B}});const ne=100,$=32;class q{constructor(Z){this.id=Z,this.rows=null,this.state="pending",this.token=null,this.error=null}}class B{#e=new Map;#t;#n;#r=0;#i=-1;constructor(Z={}){this.#t=Math.max(1,Math.floor(Number(Z.pageSize)||ne)),this.#n=Math.max(1,Math.floor(Number(Z.maxCachedPages)||$))}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 Y=this.#e.get(Z);return!!Y&&Y.state==="pending"}loaded(Z){const Y=this.#e.get(Z);return!!Y&&Y.state==="loaded"}begin(Z,Y){let U=this.#e.get(Z);return U||(U=new q(Z)),U.state="pending",U.token=Y,U.error=null,this.#s(Z,U),U}fill(Z,Y){const U=this.#e.get(Z)||new q(Z);U.rows=Y,U.state="loaded",U.token=null,this.#s(Z,U)}failed(Z,Y){const U=this.#e.get(Z)||new q(Z);U.state="error",U.error=Y,U.token=null,this.#s(Z,U)}delete(Z){return this.#e.delete(Z)}rowAt(Z){const Y=this.blockOf(Z),U=this.#e.get(Y);if(!(!U||U.state!=="loaded"||!U.rows))return this.#s(Y,U),U.rows[Z-Y*this.#t]}rowLoaded(Z){const Y=this.blockOf(Z),U=this.#e.get(Y);return!!U&&U.state==="loaded"&&!!U.rows&&Z-Y*this.#t<U.rows.length}erroredAt(Z){const Y=this.#e.get(this.blockOf(Z));return!!Y&&Y.state==="error"}loadedExtent(){let Z=0;for(const Y of this.#e.values()){if(Y.state!=="loaded"||!Y.rows)continue;const U=Y.id*this.#t+Y.rows.length;U>Z&&(Z=U)}return Z}fillOf(Z){const Y=this.#e.get(Z);return Y&&Y.state==="loaded"&&Y.rows?Y.rows.length:null}protect(Z,Y){this.#r=this.blockOf(Math.max(0,Z)),this.#i=this.blockOf(Math.max(0,Y))}evict(){const Z=[];if(this.#e.size<=this.#n)return Z;for(const[Y,U]of this.#e){if(this.#e.size-Z.length<=this.#n)break;Y>=this.#r&&Y<=this.#i||U.state!=="pending"&&Z.push(Y)}for(const Y of Z)this.#e.delete(Y);return Z}ids(){return[...this.#e.keys()]}clear(){this.#e.clear()}#s(Z,Y){this.#e.delete(Z),this.#e.set(Z,Y)}}}),Ue("packages/core/src/source/pagewindow.js",function(e,H){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return ne}});function ne($,q,B,x){const Z=Math.floor(Number($)||0);if(Z<=0)return null;const Y=Math.max(0,Math.floor(Number(q)||0)),U=Math.max(0,Math.floor(Number(B)||0));if(x){const W=Math.max(1,Math.ceil(U/Z)),K=Math.min(Y,W-1),E=K*Z;return{page:K,pageSize:Z,offset:E,length:Math.max(0,Math.min(Z,U-E)),pageCount:W,total:U}}return{page:Y,pageSize:Z,offset:Y*Z,length:Z,pageCount:Math.max(Y+2,Math.ceil(U/Z)),total:null}}}),Ue("packages/core/src/source/paged.js",function(e,H){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"PagedSource",{enumerable:!0,get:function(){return w}});const $=H("packages/core/src/internal/lru.js").Lru,B=H("packages/core/src/internal/predicates.js").isFunction,Z=H("packages/core/src/internal/warn.js").warnOnce,U=H("packages/core/src/internal/schedule.js").settleDebounce,W=H("packages/core/src/source/abort.js"),K=W.createAbortScope,E=W.isAbortError,O=H("packages/core/src/source/blockcache.js"),b=O.BlockCache,u=O.DEFAULT_PAGE_SIZE,h=O.DEFAULT_MAX_CACHED_PAGES,r=H("packages/core/src/source/rows.js").createRowFactory,n=H("packages/core/src/source/filterwire.js"),o=n.wireFilters,i=n.querySignature,t=n.warnHostFilterNotApplied,s=H("packages/core/src/source/pagewindow.js").pageWindow,a=120;function f(g,k){return new w(g,k)}class w{mode="paged";#e;#t;#n;#r=K();#i;#s;#o=new Map;#l=null;#a=null;#c=!1;#u=0;#f="";#d={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(k,d){this.#e=k||{mode:"paged"},this.#t=d||{},this.#n=new b({pageSize:this.#e.pageSize||u,maxCachedPages:this.#e.maxCachedPages||h}),this.#i=r(this.#t),this.#s=new $(this.#n.pageSize*4),this.#h=U((p,m)=>this.#w(p,m),a),this.#f=this.#E(),B(this.#e.fetch)||Z("source.paged.fetch",'source.mode "paged" requires a fetch function; the grid will stay empty.'),t(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=s(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 m=d.offset+d.length-1;this.#d={start:d.offset,end:m},this.#w(d.offset,m)}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.#s.get(k);if(d&&(d.data!==null||!this.#n.rowLoaded(k)))return d;const p=this.#n.rowAt(k);if(p===void 0){const v=this.#i.skeleton(k,0,this.#n.erroredAt(k));return this.#s.set(k,v),v}const m=this.#i.leaf(p,k);return m.index=k,this.#s.set(k,m),this.#o.set(m.key,k),m}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,m=[],v=this.#n.ids().sort((y,T)=>y-T);for(const y of v){if(!this.#n.loaded(y))continue;const{start:T}=this.#n.rangeOf(y),A=this.#n.fillOf(y)||0;for(let M=T;M<T+A;M++){if(M<d||M>=p)continue;const _=this.#s.peek(M);if(_&&_.data!==null&&_.data!==void 0){m.push(_);continue}const R=this.#n.rowAt(M);if(R===void 0)continue;const I=this.#i.leaf(R,M);I.index=M,this.#s.set(M,I),this.#o.set(I.key,M),m.push(I)}}return m}hint(k,d){if(this.#p)return;const p=this.#T();let m=Math.max(0,Math.floor(k)),v=Math.max(m,Math.floor(d));const y=this.#y();if(y){if(y.length===0)return;m=y.offset,v=y.offset+y.length-1}this.#d={start:m,end:v},this.#n.protect(m,v);for(const T of this.#n.evict())this.#v(T);this.#h(m,v),p&&this.#h.flush()}#w(k,d){if(this.#p)return;this.#n.protect(k,d);const p=this.#n.blockOf(k),m=this.#n.blockOf(d);for(let v=p;v<=m&&!(this.#l!==null&&v*this.#n.pageSize>=this.#l);v++)this.#n.has(v)||this.#O(v)}apply(k){const d={added:[],updated:[],removed:[]};if(!k)return d;if(k.update)for(const p of k.update){const m=this.#i.keyOf(p,-1),v=this.#o.get(m);if(v===void 0)continue;const y=this.#i.leaf(p,v);y.index=v,this.#s.set(v,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.#d.start,this.#d.end)}destroy(){this.#p=!0,this.#h.cancel(),this.#r.abortAll("destroyed"),this.#n.clear(),this.#s.clear(),this.#o.clear()}exact(){return this.#l!==null||this.#c}pending(){return this.#r.size}async#O(k){if(!B(this.#e.fetch))return;const d=this.#r.begin(`block:${k}`);this.#n.begin(k,d);const{start:p,end:m}=this.#n.rangeOf(k),v=this.#f;try{const y=await this.#e.fetch({range:{start:p,end:m},sort:this.#P("sort",[]),filters:o(this.#P("filters",null),this.#N()),quick:this.#P("quick","")||void 0,context:this.#P("context",null),signal:d.signal});if(!d.current||v!==this.#f||this.#p)return;d.settle();const T=y&&y.rows||[];this.#n.fill(k,T);for(let M=0;M<T.length;M++)this.#s.delete(p+M);const A=y&&typeof y.total=="number"?y.total:y&&typeof y.count=="number"?y.count:null;A!==null?(this.#l=A,this.#c=!0):T.length<this.#n.pageSize?(this.#c=!0,this.#l=p+T.length):this.#u=Math.max(this.#u,p+T.length),this.#M("model:changed",{reason:"page",block:k,from:p,to:p+T.length}),this.#M("rows:changed",{companion:!0,reason:"page",block:k,from:p,to:p+T.length}),this.#l!==null&&this.#l!==this.#a&&(this.#a=this.#l,this.#M("source:total",{total:this.#l,groupPath:[]}))}catch(y){if(d.settle(),E(y))return;this.#n.failed(k,y);for(let T=p;T<m;T++)this.#s.delete(T);this.#M("model:changed",{reason:"page-error",block:k,range:{start:p,end:m}}),this.#M("source:error",{error:y,block:k,range:{start:p,end:m}})}}#v(k){const{start:d,end:p}=this.#n.rangeOf(k);for(let m=d;m<p;m++){const v=this.#s.peek(m);v&&this.#o.delete(v.key),this.#s.delete(m)}}#T(){const k=this.#E();return k===this.#f?!1:(this.#f=k,this.#S("query"),!0)}#S(k){this.#r.abortAll(k),this.#n.clear(),this.#s.clear(),this.#o.clear(),this.#l=null,this.#a=null,this.#c=!1,this.#u=0,this.#m++,this.#M("model:changed",{reason:k})}#E(){return i({filters:this.#P("filters",null),sort:this.#P("sort",[]),quick:this.#P("quick",""),context:this.#P("context",null)})}#N(){const k=this.#t.config||{};return{tz:k.timeZone,weekStartsOn:k.weekStartsOn}}#P(k,d){const p=this.#t.state;if(p&&B(p[k])){const m=p[k]();return m??d}return d}#M(k,d){const p=this.#t.emit;B(p)&&p(k,d)}}}),Ue("packages/core/src/source/aggregates.js",function(e,H){"use strict";Object.defineProperty(e,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"pushableAggregates",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"fillAggregateSql",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"routeAggregate",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"resolveAggregatePlan",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"groupKeysPushable",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"pushdownDocRows",{enumerable:!0,get:function(){return W}});const ne=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 $(){const K=new Set;for(const[E,O]of Object.entries(ne))O.pushable&&K.add(E);return K}function q(K,E,O){let b=K.split("%c").join(E);return O!==void 0&&(b=b.split("%w").join(O)),b}function B(K){const E=K||{},O=E.default==="engine"||E.default==="engine-if-identical"?E.default:"client",b={};if(E.overrides&&typeof E.overrides=="object")for(const[u,h]of Object.entries(E.overrides))(h==="engine"||h==="client")&&(b[u]=h);return{default:O,overrides:b}}function x(K,E){const O=ne[K];if(!O||!O.pushable)return"client";const b=E.overrides[K];return b==="engine"||b==="client"?b:E.default==="client"?"client":E.default==="engine-if-identical"?O.class==="identical"?"engine":"client":"engine"}function Z(K,E){const O=B(E),b=[],u=[];for(const h of K||[]){const l=ne[h.fn],r=x(h.fn,O),n={id:h.id,col:h.col,fn:h.fn,class:l?l.class:"fallback"};h.weight!==void 0&&(n.weight=h.weight),h.params!==void 0&&(n.params=h.params),r==="engine"?b.push(n):(n.reason=l&&!l.pushable?l.note||"the engine cannot express this stat":"client by config",u.push(n))}return{engine:b,client:u,config:O}}const Y=/^[A-Za-z_][A-Za-z0-9_$]*$/;function U(K,E=[]){return(K||[]).every(b=>{if(typeof b=="string")return Y.test(b);if(!b||typeof b!="object")return!1;const u=b;return Array.isArray(E)&&E.includes(u.bucket)&&typeof u.col=="string"&&Y.test(u.col)&&typeof u.size=="number"&&Number.isFinite(u.size)&&u.size>0})}function W(){return Object.entries(ne).map(([K,E])=>({stat:K,class:E.class,sql:E.sql?q(E.sql,"col",E.twoColumn?"weight":void 0):"",note:E.note||(E.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),Ue("packages/core/src/source/pushdown.js",function(e,H){"use strict";Object.defineProperty(e,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"NO_CAPABILITIES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"capabilitiesOf",{enumerable:!0,get:function(){return w}}),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 T}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"applyResidual",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"createPushdownSource",{enumerable:!0,get:function(){return X}});const $=H("packages/core/src/internal/compare.js").defaultCompare,B=H("packages/core/src/internal/predicates.js").isFunction,Z=H("packages/core/src/internal/merge.js").toArray,U=H("packages/core/src/internal/warn.js").warnOnce,W=H("packages/core/src/source/filterwire.js"),K=W.isGroup,E=W.warnWherePageRelative,O=W.warnWhereOverThreshold,b=W.wireFilters,u=H("packages/core/src/source/aggregates.js"),h=u.resolveAggregatePlan,l=u.groupKeysPushable,r=u.STAT_PUSHDOWN,o=H("packages/core/src/source/abort.js").SupersededError,i=1e3;function t(V){const J=V&&V.signal;if(!J||!J.aborted)return;const ee=J.reason;throw ee instanceof Error?ee:new o("","superseded before it was sent")}const c=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function s(V){if(!V||typeof V!="object")return!1;const J=V.returning==="row"||V.returning==="key"?V.returning:"none";return{append:V.append===!0,update:V.update===!0,delete:V.delete===!0,returning:J}}function a(V,J){if(!V||typeof J!="string")return;if(!J.includes("."))return V[J];let ee=V;for(const te of J.split(".")){if(ee===null||typeof ee!="object")return;ee=ee[te]}return ee}function f(V){if(V===!0)return!0;if(!V||typeof V!="object")return!1;const J=V;return J.enabled===!1?!1:J.enabled===!0||B(J.commit)}function w(V){const J={...c,...V||{}};return J.operators=new Set(J.operators||[]),J.mutate=s(J.mutate),J}function g(V,J){return!V||!V.op||!J.operators.size?!1:J.operators.has(V.op)}function k(V,J){if(!V)return{pushed:null,residual:null};if(!J.filter)return{pushed:null,residual:V};if(J.filter==="term"){if(K(V)){const oe=V.conditions||[];if(String(V.op)!=="and")return{pushed:null,residual:V};const ue=oe.findIndex(he=>!K(he)&&g(he,J));if(ue<0)return{pushed:null,residual:V};const ye=oe.filter((he,Re)=>Re!==ue);return{pushed:oe[ue],residual:ye.length?{op:"and",conditions:ye}:null}}return g(V,J)?{pushed:V,residual:null}:{pushed:null,residual:V}}if(!K(V))return g(V,J)?{pushed:V,residual:null}:{pushed:null,residual:V};if(String(V.op)!=="and")return(V.conditions||[]).every(ue=>K(ue)?k(ue,J).residual===null:g(ue,J))?{pushed:V,residual:null}:{pushed:null,residual:V};const ee=[],te=[];for(const oe of V.conditions||[]){if(K(oe)){if(J.filter==="flat"){te.push(oe);continue}const ue=k(oe,J);ue.pushed&&ee.push(ue.pushed),ue.residual&&te.push(ue.residual);continue}(g(oe,J)?ee:te).push(oe)}const ie=oe=>oe.length===0?null:oe.length===1?oe[0]:{op:"and",conditions:oe};return{pushed:ie(ee),residual:ie(te)}}const d="__lattice_leaves";function p(V){return V.aggregates?V.aggregates instanceof Set?V.aggregates:new Set(Z(V.aggregates)):new Set}function m(V){const J=p(V);return J.size?J.has("count")?V.filter!=="tree"||!V.operators||!V.operators.has("eq")?"the adapter does not declare the `group` capability, and cannot narrow a group's rows by its key (that needs a `tree` filter with the `eq` operator)":"":"the adapter does not declare the `group` capability, and its declared aggregates have no `count` to give each group its row count":"the adapter does not declare the `group` capability"}function v(V,J,ee,te,ie,oe,ue){const ye=Array.isArray(V.groupBy)?V.groupBy:[],he=Array.isArray(V.groupPath)?V.groupPath:[],Re=Array.isArray(V.groupValues)?V.groupValues:null;if(!J.group){const Ce=m(J);if(Ce)return Ce}return l(ye)?ee.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":te?ie?oe?"a host `where` predicate can only run in the browser, over rows the engine grouped":ue?"fullDataset holds the whole matching set, so the grid groups it itself":!Re||Re.length!==he.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",T="pushdown:group-unsupported",A=Symbol("lattice.remote.ungroupedLevel");function M(V,J,ee,te,ie,oe){const ue=Array.isArray(V.pivotBy)?V.pivotBy:[],ye=Array.isArray(V.groupBy)?V.groupBy:[],he=Array.isArray(V.groupPath)?V.groupPath:[],Re=Array.isArray(V.groupValues)?V.groupValues:null;return J.pivot?l(ue)?ye.length&&!l(ye)?"a grouping key is not a plain column the engine can name in a GROUP BY":ee.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":te?ie?oe?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!Re||Re.length!==he.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 _(V,J,ee=!1){const te=k(V.filters||null,J),ie=[];te.residual&&ie.push("filter");const oe=V.sort||[],ue=oe.length===0||J.sort==="multi"&&oe.length>=1||J.sort==="single"&&oe.length===1;!ue&&oe.length&&ie.push("sort");const ye=V.quick?String(V.quick):"",he=!ye||!!J.quick;he||ie.push("quick");const Re=V.where&&V.where.active?V.where:null;Re&&ie.push("where");const Ce={filters:te.residual,sort:ue?null:oe,quick:he?"":ye,where:Re},we=!!ee,re=Array.isArray(V.groupBy)&&V.groupBy.length>0,de=re?v(V,J,te,ue,he,Re,we):"",me=V.pivotMode!==!1&&Array.isArray(V.pivotBy)&&V.pivotBy.length>0,Oe=me?M(V,J,te,ue,he,Re):"",ke=me&&Oe==="";me&&!ke&&ie.push("pivot");const Le=me?ke&&re:re&&de==="";re&&!me&&!Le&&ie.push("group");const ce=(Le||ke)&&Array.isArray(V.groupValues)?V.groupValues.length:0,ge=Le||me?!1:we||!!(Ce.filters||Ce.sort||Ce.quick||Ce.where)||!J.range;return{pushed:{...V,filters:te.pushed,sort:ue?oe:[],quick:he?ye:"",range:ge?null:V.range},residual:Ce,needsAll:ge,unpushed:ie,full:we,grouped:Le,groupLevel:ce,groupReason:me?"":de,pivoted:ke,pivotReason:Oe}}function R(V){const J=Array.isArray(V.totals)?V.totals:[],ee=V.totalFns&&typeof V.totalFns=="object"?V.totalFns:{},te=[],ie=[];for(const oe of J){const ue=String(oe),ye=typeof ee[ue]=="string"?ee[ue]:null,he=ye?r[ye]:null;ye?!he||!he.pushable||!he.sql?ie.push({id:ue,fn:ye,class:he?he.class:"fallback",reason:he&&he.note?he.note:`the pushdown map cannot express "${ye}"`}):he.twoColumn?ie.push({id:ue,fn:ye,class:he.class,reason:`"${ye}" reduces two columns, and a grouped request carries no weight column`}):te.push({id:ue,col:ue,fn:ye,class:he.class}):ie.push({id:ue,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:te,client:ie}}const I=Object.freeze({items:V=>V==null?[]:Array.isArray(V)?V:[V]});function j(V,J,ee){if(!J)return V;let te=V;if(J.filters&&B(ee.evaluateFilters)){const ie=te,oe={count:te.length,handle:he=>({id:he,get:Re=>a(ie[Re],he)}),itemwise:he=>ie.some(Re=>Array.isArray(a(Re,he)))?I:null},ue=ee.evaluateFilters(J.filters,oe),ye=[];for(let he=0;he<te.length;he++)ue[he]&&ye.push(te[he]);te=ye}if(J.where&&J.where.active&&(J.whole||E(J.where.names,"pushdown"),te=te.filter(ie=>J.where.passes(ie))),J.quick){const ie=J.quick.toLowerCase();te=te.filter(oe=>{if(!oe||typeof oe!="object")return!1;for(const ue of Object.values(oe))if(ue!=null&&String(ue).toLowerCase().includes(ie))return!0;return!1})}if(J.sort&&J.sort.length&&B(ee.sortMulti)){const ie=[...new Set(J.sort.map(he=>he.col))],oe=te,ue=ie.map(he=>({id:he,get:Re=>a(oe[Re],he)})),ye=ee.sortMulti(ue,J.sort.map(he=>({col:he.col,dir:he.dir})),Uint32Array.from({length:te.length},(he,Re)=>Re),{});te=Array.from(ye,he=>oe[he])}return te}function L(V){return JSON.stringify({filters:V.filters||null,sort:V.sort||[],quick:V.quick||"",groupBy:V.groupBy||[],groupPath:V.groupPath||[],context:V.context??null})}function F(V){if(!V||typeof V!="object")return 16;let J="";try{J=JSON.stringify(V)}catch{return 200}return J.length*2+64}function N(V){const J=V||{};return{enabled:!!J.enabled,maxRows:Number.isFinite(J.maxRows)?J.maxRows:1e6,maxBytesEstimate:Number.isFinite(J.maxBytesEstimate)?J.maxBytesEstimate:512*1024*1024}}const S=5e4;function C(V){return Number.isFinite(V)&&V>=0?V:S}function D(V){return!!V&&B(V.then)}async function G(V){if(!V||V.total!==void 0||!D(V.pendingTotal))return V;const J=await V.pendingTotal,{pendingTotal:ee,...te}=V;return typeof J=="number"?{...te,total:J}:te}function X(V={}){const J=V.adapter;if(!J||!B(J.execute))return U("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...V,mode:"remote",fetch:async()=>({rows:[],total:0})};const ee=w(J.capabilities),te=J.capabilities&&Object.getOwnPropertyDescriptor(J.capabilities,"operators");te&&B(te.get)&&Object.defineProperty(ee,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(J.capabilities.operators||[]),set:()=>{}});const ie=J.name||"adapter";let oe=null;const ue=()=>B(J.ready)?(oe||(oe=Promise.resolve(J.ready()).then(()=>{Object.assign(ee,w(J.capabilities))},ve=>{throw oe=null,ve})),oe):null,ye=N(V.fullDataset),he=!!V.allowPartialResults,Re=C(V.whereRowLimit);let Ce=null;const we=V.aggregates;let re=null,de=null,me=null,Oe=null,ke=null,Le,ce=null,ge=0,Se=null;const Fe=()=>!ye.enabled||!re?null:(Se!==re.key&&(ge++,Se=re.key),{rows:re.rows,version:ge}),be=async ve=>{const Pe=ve.where&&ve.where.active?ve.where:null;if(!Pe)return{request:ve,probe:null};const{where:je,...Ne}=ve,xe=_(Ne,ee,ye.enabled);if(xe.needsAll)return{request:ve,probe:null};const ze=L(xe.pushed);let _e=null;return(!Ce||Ce.key!==ze)&&(ee.total?(t(ve),_e=await G(await J.execute(xe.pushed,ve)),Ce={key:ze,size:_e&&typeof _e.total=="number"?_e.total:null}):Ce={key:ze,size:null}),Ce.size!==null&&Ce.size<Re?{request:ve,probe:null}:(O(Pe.names,ie,Ce.size,Re),{request:Ne,probe:_e})},Ie=async(ve,Pe)=>{ce=null;const je=R(ve.pushed);me={engine:je.engine,client:je.client,groupBy:ve.pushed.groupBy},je.client.length&&U(`source.pushdown.group.totals.${ie}.${je.client.map(ze=>ze.id).join(".")}`,`the ${ie} adapter cannot compute the group subtotal for ${je.client.map(ze=>`"${ze.id}" (${ze.reason})`).join(", ")}, so those group rows carry no value for that column. A figure computed over anything other than the group would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const Ne=await J.executeGroupLevel(ve.pushed,je.engine,Pe)||{};let xe=Ne.rows||[];return!ee.range&&Pe.range&&(xe=xe.slice(Pe.range.start,Pe.range.end)),st(Ne),Ne.total===void 0?{rows:xe}:{rows:xe,total:Ne.total}},He=new Map,Ge=64,nt=async(ve,Pe)=>{ce=null;const je=ve.pushed,Ne=je.groupBy,xe=Array.isArray(je.groupValues)?je.groupValues:[],ze=xe.length,_e=[...je.filters?[je.filters]:[],...Ne.slice(0,ze).map((ht,ut)=>({col:ht,op:"eq",value:xe[ut]===void 0?null:xe[ut],caseSensitive:!0}))],Qe=_e.length===0?null:_e.length===1?_e[0]:{op:"and",conditions:_e},Te=Pe.range?Pe.range.start:0;if(ze>=Ne.length){const ht={...je,filters:Qe,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},ut=await G(await J.execute(ht,Pe))||{};let Tt=ut.rows||[];return!ee.range&&Pe.range&&(Tt=Tt.slice(Pe.range.start,Pe.range.end)),typeof ut.total=="number"?{rows:Tt,total:ut.total}:{rows:Tt}}const Ke=Ne[ze],qe=R(je),Je=p(ee),Ze=qe.engine.filter(ht=>Je.has(ht.fn)),lt=[...qe.engine.filter(ht=>!Je.has(ht.fn)).map(ht=>({id:ht.id,fn:ht.fn,class:ht.class,reason:`the ${ie} adapter does not compute "${ht.fn}"`})),...qe.client];me={engine:Ze,client:lt,groupBy:Ne},lt.length&&U(`source.pushdown.group.totals.${ie}.${lt.map(ht=>ht.id).join(".")}`,`the ${ie} adapter cannot compute the group subtotal for ${lt.map(ht=>`"${ht.id}" (${ht.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 ot=[...Ze.map(ht=>({id:ht.id,col:ht.col,fn:ht.fn})),{id:d,col:Ke,fn:"count"}],it={...je,filters:Qe,range:null},Ot=JSON.stringify([L(it),xe,Ke,ot]);let jt=Te>0?He.get(Ot):void 0;if(!jt){for(jt=Promise.resolve(J.executeGroupedAggregates(it,[Ke],ot)),He.delete(Ot),He.set(Ot,jt);He.size>Ge;)He.delete(He.keys().next().value);jt.catch(()=>{He.get(Ot)===jt&&He.delete(Ot)})}const Rt=await jt||[];t(Pe);const We=ht=>{const ut={};for(const Tt of Ze)ut[Tt.id]=ht?ht[Tt.id]:void 0;return ut},gt=(je.sort||[]).find(ht=>ht&&ht.col===Ke),ct=gt&>.dir==="desc"?-1:1,bt=Rt.filter(ht=>ht&&ht.level===1).map(ht=>({[Ke]:ht.keys[0]===void 0?null:ht.keys[0],leafCount:Number(ht.values&&ht.values[d])||0,totals:We(ht.values)})).sort((ht,ut)=>ct*$(ht[Ke],ut[Ke]));if(ze===0){const ht=Rt.find(Tt=>Tt&&Tt.level===0),ut=ht?Number(ht.values&&ht.values[d]):NaN;st({matchCount:Number.isFinite(ut)?ut:bt.reduce((Tt,Ht)=>Tt+Ht.leafCount,0),...ht?{grand:We(ht.values)}:{}})}const Et=Pe.range?Pe.range.end:bt.length;return{rows:bt.slice(Te,Et),total:bt.length}},st=ve=>{typeof ve.matchCount=="number"&&(Oe=ve.matchCount,ke=ve.grand?{totals:ve.grand,leafCount:ve.matchCount}:null,Le===void 0&&B(J.unfilteredCount)&&(Le=null,Promise.resolve(J.unfilteredCount()).then(Pe=>{Le=typeof Pe=="number"?Pe:null}).catch(Pe=>{U(`source.pushdown.group.unfiltered.${ie}`,`the ${ie} adapter could not count the unfiltered set (${Pe&&Pe.message?Pe.message:Pe}), so "N of M" falls back to the display count for its denominator.`)})))},mt=async(ve,Pe)=>{ce=null;const je=R(ve.pushed);me={engine:je.engine,client:je.client,groupBy:ve.pushed.groupBy,pivotBy:ve.pushed.pivotBy},je.client.length&&U(`source.pushdown.pivot.totals.${ie}.${je.client.map(Qe=>Qe.id).join(".")}`,`the ${ie} adapter cannot compute the pivot cells for ${je.client.map(Qe=>`"${Qe.id}" (${Qe.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 Ne=await J.executePivotLevel(ve.pushed,je.engine,Pe)||{};let xe=Ne.rows||[];!ee.range&&Pe.range&&(xe=xe.slice(Pe.range.start,Pe.range.end)),st(Ne);const ze=Ne.pivot&&typeof Ne.pivot=="object"?Ne.pivot:{},_e={cells:Array.isArray(ze.cells)?ze.cells:[],...Array.isArray(ze.axis)?{axis:ze.axis}:{}};return Ne.total===void 0?{rows:xe,pivot:_e}:{rows:xe,total:Ne.total,pivot:_e}},kt=ve=>{U(`source.pushdown.pivot.${ie}.${ve}`,`pushdown:pivot-unsupported: the ${ie} adapter cannot pivot this query because ${ve}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const Pe=new Error(`[lattice] ${y}: the ${ie} adapter cannot pivot this query because ${ve}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw Pe.code=y,Pe.reason=ve,Pe},St=(ve,Pe)=>{const je={key:Pe,state:"pending",value:null};return ce=je,ve.then(Ne=>(ce===je&&(ce={key:Pe,state:"settled",value:typeof Ne=="number"?Ne:null}),Ne),Ne=>{throw ce===je&&(ce={key:Pe,state:"failed",value:null}),Ne})};let Pt=0,Mt=[];const It=()=>Pt===0?null:new Promise(ve=>{const Pe=setTimeout(ve,i);Mt.push(()=>{clearTimeout(Pe),ve()})});let $t;const Ut=async ve=>{const Pe=ue();Pe&&await Pe;const Ne=ve&&ve.pivotMode!==!1&&Array.isArray(ve.pivotBy)&&ve.pivotBy.length>0?{request:ve,probe:null}:await be(ve);t(ve);let xe=_(Ne.request,ee,ye.enabled);if(ee.group&&xe.grouped&&!xe.pivoted&&!B(J.executeGroupLevel)&&(U(`source.pushdown.group.method.${ie}`,`the ${ie} 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.`),xe=_(Ne.request,{...ee,group:!1,aggregates:null},ye.enabled)),xe.pivoted&&!B(J.executePivotLevel)&&(xe=_(Ne.request,{...ee,pivot:!1},ye.enabled),xe.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),xe.grouped&&!xe.pivoted&&!ee.group&&!B(J.executeGroupedAggregates)&&(U(`source.pushdown.group.aggregates.method.${ie}`,`the ${ie} 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\`.`),xe=_(Ne.request,{...ee,aggregates:null},ye.enabled)),de=xe,xe.pivoted)return mt(xe,ve);if(xe.pivotReason&&kt(xe.pivotReason),xe.grouped)return ee.group?Ie(xe,ve):nt(xe,ve);const _e=!!xe.groupReason&&!xe.full;_e?U(`source.pushdown.group-unsupported.${ie}.${xe.groupReason}`,`pushdown:group-unsupported: the ${ie} adapter was not asked to group this query because ${xe.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.`):xe.groupReason&&U(`source.pushdown.group.${ie}.${xe.groupReason}`,`the ${ie} adapter was not asked to group this query because ${xe.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 Qe=ot=>_e?{...ot,[A]:!0}:ot;if(!xe.needsAll){const ot=Ne.probe||await J.execute(xe.pushed,ve),it=ot.rows||[];return D(ot.pendingTotal)&&ot.total===void 0?Qe({rows:it,pendingTotal:St(ot.pendingTotal,L(xe.pushed))}):(ce=null,!ee.total&&ot.total===void 0?Qe({rows:it}):Qe({rows:it,total:ot.total??it.length}))}xe.unpushed.length&&U(`source.pushdown.residual.${ie}.${xe.unpushed.join(".")}`,`the ${ie} adapter cannot push ${xe.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 Te=L(xe.pushed);if(!re||re.key!==Te){const ot=await G(await J.execute(xe.pushed,ve));ce=null;const it=ot.rows||[];if(xe.full){const Ot=typeof ot.total=="number"?Math.max(ot.total,it.length):it.length;if(Ot>ye.maxRows)throw new Error(`[lattice] fullDataset refused: the ${ie} adapter's matching set is ${Ot.toLocaleString()} rows, past the configured maxRows of ${ye.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 jt=it.length*F(it[0]);if(jt>ye.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${ie} adapter's matching set is an estimated ${Math.round(jt/(1024*1024)).toLocaleString()} MB across ${it.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(ye.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 ot.total=="number"&&it.length<ot.total){const Ot=!!(xe.residual.filters||xe.residual.quick||xe.residual.sort&&xe.residual.sort.length);if(Ot&&!he)throw new Error(`[lattice] the ${ie} adapter returned ${it.length} of ${ot.total} matching rows when asked for the whole result, and the query has residual ${xe.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.`);Ot?U(`source.pushdown.partial.residual.${ie}`,`the ${ie} adapter returned ${it.length} of ${ot.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.`):U(`source.pushdown.partial.${ie}`,`the ${ie} adapter returned ${it.length} of ${ot.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}re={key:Te,rows:it,total:typeof ot.total=="number"?ot.total:null}}let Ke=xe;if(xe.residual.where){const ot=re.total??re.rows.length;if(ot>=Re){O(xe.residual.where.names,ie,ot,Re);const{where:it,...Ot}=Ne.request;Ke=_(Ot,ee,ye.enabled),de=Ke}}const qe=re.total!==null&&re.rows.length>=re.total,Je=j(re.rows,{...Ke.residual,whole:qe},V.compute||{}),Ze=ve.range?ve.range.start:0,lt=ve.range?ve.range.end:Je.length;return Qe({rows:Je.slice(Ze,lt),total:Je.length})},ft=async(ve,Pe,je)=>{const xe=je&&je.waitForPage&&$t&&B($t.pageForegroundIdle)?$t.pageForegroundIdle():It();xe&&await xe;const ze=ue();ze&&await ze;const _e=_(ve,ee,ye.enabled);de=_e;const Qe=h(Pe,we),Te=Array.isArray(ve.groupBy)?ve.groupBy:[],Ke=Te.length>0,qe=!_e.residual.filters&&!_e.residual.quick,Je=!Ke||l(Te,ee.buckets);let Ze=Qe.engine,lt=Qe.client;if(ee.aggregates&&Ze.length){const jt=ee.aggregates instanceof Set?ee.aggregates:new Set(Z(ee.aggregates)),Rt=Ze.filter(We=>!jt.has(We.fn));Rt.length&&(Ze=Ze.filter(We=>jt.has(We.fn)),lt=[...Rt.map(We=>({...We,reason:`the ${ie} adapter does not compute "${We.fn}"`})),...lt])}const ot=jt=>{lt=[...Ze.map(Rt=>({...Rt,reason:jt})),...lt],Ze=[]};Ze.length&&!qe?ot(_e.residual.quick&&!_e.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):Ze.length&&!Je&&ot("a grouping key the engine cannot form forces all-client (no mixed provenance)");let it={},Ot;return Ze.length&&(B(Ke?J.executeGroupedAggregates:J.executeAggregates)?Ke?Ot=await J.executeGroupedAggregates(_e.pushed,Te,Ze)||[]:it=await J.executeAggregates(_e.pushed,Ze)||{}:(U(`source.pushdown.aggregates.${ie}${Ke?".grouped":""}`,`the ${ie} adapter cannot compute ${Ke?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),ot(`adapter cannot compute ${Ke?"grouped ":""}aggregates`))),me={engine:Ze,client:lt,...Ke?{groupBy:Te}:{}},{values:it,engine:Ze,client:lt,...Ot!==void 0?{groups:Ot}:{}}},dt=async ve=>{Pt++;try{return await Ut(ve)}finally{if(Pt--,Pt===0&&Mt.length){const Pe=Mt;Mt=[];for(const je of Pe)je()}}},wt=f(V.edit),rt=V.edit&&typeof V.edit=="object"&&B(V.edit.commit);let fe=V.edit;if(wt&&!rt)if(ee.mutate&&ee.mutate.update){const ve=Pe=>{if(!ee.mutate||!ee.mutate.update)throw new Error(`[lattice] the ${ie} 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 je={kind:"update",key:String(Pe.key),patch:{[Pe.colId]:Pe.value}};return J.mutate(je,Pe.request||{})};fe={...V.edit===!0?{}:V.edit,commit:ve}}else U(`source.pushdown.readonly.${ie}`,`edit is enabled but the ${ie} 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 Ee=wt&&ee.mutate&&(ee.mutate.append||ee.mutate.delete)?{append:ee.mutate.append===!0,remove:ee.mutate.delete===!0,returning:ee.mutate.returning,mutate:(ve,Pe)=>J.mutate(ve,Pe||{})}:null,Be=async ve=>{const Pe=ue();Pe&&await Pe;const{range:je,signal:Ne,export:xe,...ze}=ve||{},_e={...ze,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:_(_e,ee,ye.enabled),signal:Ne}};async function*pe(ve,Pe={}){const{plan:je,signal:Ne}=await Be(ve),xe=Math.max(1,Math.floor(Number(Pe.pageSize))||5e3),ze={signal:Ne,stream:!0};if(!je.needsAll)for(let Te=0;;Te+=xe){t(ze);const Ke=await J.execute({...je.pushed,range:{start:Te,end:Te+xe}},ze);Ke&&D(Ke.pendingTotal)&&Ke.pendingTotal.then(null,()=>{});const qe=Ke&&Ke.rows||[];if(qe.length&&(yield qe),qe.length<xe)return}t(ze);const _e=await G(await J.execute({...je.pushed,range:void 0},ze)),Qe=j(_e&&_e.rows||[],{...je.residual,whole:!0},V.compute||{});for(let Te=0;Te<Qe.length;Te+=xe)yield Qe.slice(Te,Te+xe)}return $t={...V,edit:fe,rowMutate:Ee,mode:"remote",fetch:dt,foregroundIdle:It,aggregate:ft,countMatching:async ve=>{const{plan:Pe,signal:je}=await Be(ve);if(!Pe.needsAll&&ee.total){t({signal:je});const xe=await G(await J.execute({...Pe.pushed,range:{start:0,end:0}},{signal:je}));if(xe&&typeof xe.total=="number")return xe.total}let Ne=0;for await(const xe of pe(ve))Ne+=xe.length;return Ne},streamMatching:pe,capabilitiesOf:w,planQuery:_,wireFilters:b,resolveAggregatePlan:ve=>h(ve,we),STAT_PUSHDOWN:r,lastPlan:()=>de?{...de,...me?{aggregates:me}:{},...ce?{total:{deferred:!0,state:ce.state,value:ce.value}}:{}}:null,fullFrame:Fe,counts:()=>({match:Oe,total:Le??null,pending:!!ce&&ce.state==="pending"}),grandTotals:()=>ke},$t}}),Ue("packages/core/src/source/remote.js",function(e,H){"use strict";Object.defineProperty(e,"PROTOCOL",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return L}});const $=H("packages/core/src/internal/lru.js").Lru,B=H("packages/core/src/internal/predicates.js").isFunction,Z=H("packages/core/src/internal/warn.js").warnOnce,U=H("packages/core/src/internal/schedule.js").settleDebounce,W=H("packages/core/src/source/abort.js"),K=W.createAbortScope,E=W.isAbortError,O=H("packages/core/src/source/blockcache.js"),b=O.BlockCache,u=O.DEFAULT_PAGE_SIZE,h=O.DEFAULT_MAX_CACHED_PAGES,l=H("packages/core/src/source/rows.js"),r=l.createRowFactory,n=l.groupKey,o=H("packages/core/src/source/filterwire.js"),i=o.wireFilters,t=o.querySignature,c=o.warnHostFilterNotApplied,a=H("packages/core/src/source/pagewindow.js").pageWindow,w=H("packages/core/src/source/memory.js").MemorySource,k=H("packages/core/src/compute/handle.js").valueComparator,d=H("packages/core/src/compute/pivot.js"),p=d.pivotKey,m=d.joinPath,v=d.DEFAULT_PATH_SEPARATOR,T=H("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,A=1,M=120,_=1e3;function R(F,N,S){for(let C=0;C<Math.max(F.length,N.length);C++){const D=F[C],G=N[C],X=D==null,V=G==null;if(X||V){if(X&&V)continue;return X?1:-1}const J=S(D,G);if(J!==0)return J}return 0}function I(F,N){return new L(F,N)}class j{constructor(N,S,C,D){this.path=N,this.keyPath=D||N,this.values=[],this.level=S,this.key=n(this.keyPath),this.cache=new b(C),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 L{mode="remote";#e;#t;#n;#r;#i=new Map;#s=new Set;#o=K();#l;#a;#c=new Map;#u=[];#f=null;#d="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#A="";#w=null;#O=-1;constructor(N,S){this.#e=N||{mode:"remote"},this.#t=S||{},B(this.#e.fullFrame)&&(this.filteredIndices=()=>this.#U(),this.unfilteredIndices=()=>this.#K(),this.handleFor=V=>this.#x(V),this.display=()=>this.#I(),this.grandTotalRow=()=>this.#F(),this.unfilteredRows=()=>this.#z(),this.facetIndices=V=>this.#Y(V));const C=this.#e.counts;B(C)&&(this.matchCount=()=>this.#G("match"),this.totalCount=()=>this.#G("total"));const D=this.#e.grandTotals;B(D)&&(this.grandTotalRow=()=>this.#H());const G=this.#e.foregroundIdle;B(G)&&(this.foregroundIdle=()=>this.#ye(G),this.#e.pageForegroundIdle=()=>this.#b?this.#ye(G):null);const X=this.#e;B(X.countMatching)&&B(X.streamMatching)&&(this.selectionQuery=()=>this.#fe(),this.countMatching=V=>X.countMatching(V),this.streamMatching=(V,J)=>X.streamMatching(V,J),this.loadedRows=()=>this.#ne(),this.resident=()=>this.#R()!==null),this.#n={pageSize:this.#e.pageSize||u,maxCachedPages:this.#e.maxCachedPages||h},this.#l=r(this.#t),this.#a=new $(this.#n.pageSize*4),this.#h=U((V,J)=>this.#P(V,J),M),this.#r=new j([],0,this.#n),this.#i.set(this.#r.key,this.#r),this.#d=this.#ve(),B(this.#e.fetch)||Z("source.remote.fetch",'source.mode "remote" requires a fetch function; the grid will stay empty.'),this.#Be()}count(){const N=this.#S();return N?N.length:this.#v()}#v(){const N=this.#R();return N?N.count():(this.#q(),this.#te(this.#r))}#T(){if(this.#R())return!0;const N=S=>{if(S.count===null&&!S.complete)return!1;for(const C of S.children.values())if(this.#Ee(C.key)&&!N(C))return!1;return!0};return N(this.#r)}pageInfo(){const N=this.#S(),S=this.totalPending();if(!N){const C=this.#v();return{page:0,pageSize:0,total:this.#T()?C:null,pageCount:1,counting:S}}return{page:N.page,pageSize:N.pageSize,total:N.total,pageCount:N.pageCount,counting:S||N.total===null&&this.#o.size>0&&this.#r.cache.loadedExtent()===0}}#S(){const N=this.#v(),S=a(this.#C("pageSize",0),this.#C("page",0),N,this.#T());if(!S)return this.#A="",null;const C=`${this.#y}:${S.offset}:${S.length}`;return C!==this.#A&&!this.#p&&(this.#A=C,S.length>0&&!this.#R()&&this.#P(S.offset,S.offset+S.length-1)),S}at(N){const S=this.#S();if(S){if(N<0||N>=S.length)return;const C=this.#E(S.offset+N);return C&&(C.index=N),C}return this.#E(N)}#E(N){const S=this.#R();if(S)return S.at(N);if(this.#q(),N<0||N>=this.#v())return;const C=this.#W(this.#r,N);if(!C)return;const D=this.#X(C.node,C.local);return D&&(D.index=N),D||this.#l.skeleton(N,C.node.level,C.node.cache.erroredAt(C.local))}byKey(N){const S=this.#R();if(S)return S.byKey(N);const C=this.#c.get(N);if(!C)return;const D=C.lastIndexOf(":"),G=this.#i.get(C.slice(0,D));return G&&this.#X(G,Number(C.slice(D+1)))||void 0}loaded(N){const S=this.#S();if(S){if(N<0||N>=S.length)return!1;N+=S.offset}const C=this.#R();if(C)return C.loaded(N);if(N<0||N>=this.#v())return!1;const D=this.#W(this.#r,N);return!!D&&D.node.cache.rowLoaded(D.local)}hint(N,S){if(this.#p)return;this.#b=!0;const C=this.#q();let D=Math.max(0,Math.floor(N)),G=Math.max(D,Math.floor(S));const X=this.#S();if(X){if(X.length===0)return;D=X.offset,G=X.offset+X.length-1}for(const[V,J]of this.#N(D,G)){V.cache.protect(J.min,J.max);for(const ee of V.cache.evict())this.#Ne(V,ee)}this.#h(D,G),C&&this.#h.flush()}#N(N,S){const C=this.#v(),D=new Map;for(let G=N;G<=S&&G<C;G++){const X=this.#W(this.#r,G);if(!X)continue;const V=D.get(X.node);V?(V.min=Math.min(V.min,X.local),V.max=Math.max(V.max,X.local)):D.set(X.node,{min:X.local,max:X.local})}return D.size||D.set(this.#r,{min:N,max:N}),D}#P(N,S){if(!this.#p)for(const[C,D]of this.#N(N,S)){C.cache.protect(D.min,D.max);const G=C.cache.blockOf(D.min),X=C.cache.blockOf(D.max);for(let V=G;V<=X&&!(C.count!==null&&V*C.cache.pageSize>=C.count);V++)C.cache.has(V)||this.#Fe(C,V)}}apply(N){const S={added:[],updated:[],removed:[]};if(!N)return S;if(N.update)for(const C of N.update){const D=this.#c.get(this.#l.keyOf(C,-1));if(!D)continue;this.#a.delete(D);const G=D.lastIndexOf(":"),X=this.#i.get(D.slice(0,G));if(!X)continue;const V=Number(D.slice(G+1)),J=X.cache.blockOf(V);if(!X.cache.loaded(J))continue;const{start:ee}=X.cache.rangeOf(J),te=[];for(let oe=ee;oe<ee+X.cache.pageSize;oe++){const ue=X.cache.rowAt(oe);if(ue===void 0)break;te.push(oe===V?C:ue)}X.cache.fill(J,te);const ie=this.#X(X,V);ie&&S.updated.push(ie)}return(N.add&&N.add.length||N.remove&&N.remove.length)&&this.reload({keepExpanded:!0}),S}reload(N){this.#o.abortAll("reload"),this.#h.cancel(),N&&N.keepExpanded===!1&&this.#s.clear(),this.#re(),this.#_("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#o.abortAll("destroyed"),this.#re(),this.#i.clear(),this.#s.clear(),this.#w&&B(this.#w.destroy)&&this.#w.destroy(),this.#w=null}expand(N){this.#s.has(N)||(this.#s.add(N),this.#_("group:toggled",{key:N,expanded:!0}),this.#_("model:changed",{reason:"expand",key:N}))}collapse(N){this.#s.delete(N)&&(this.#_("group:toggled",{key:N,expanded:!1}),this.#_("model:changed",{reason:"collapse",key:N}))}expandedKeys(){return[...this.#s]}pivotFields(){return this.#u}pivot(){this.#q();const N=this.#f;if(!N||!N.keys.size||!this.#C("pivotBy",[]).length)return null;if(!N.result){const S=k((this.#t.config||{}).locale),C=[...N.keys.entries()].sort((G,X)=>R(G[1],X[1],S)),D=C.map(([G])=>G);N.result={keys:C.map(([,G])=>G),paths:D,fields:this.#ie(D),groupPaths:[],columns:D.length*Math.max(1,this.#Te().length),values:N.cells,cells:N.cells,error:null}}return N.result}invalidateHandles(){this.#w&&(B(this.#w.invalidateHandles)&&this.#w.invalidateHandles(),B(this.#w.invalidate)&&this.#w.invalidate("filter"))}#M(){const N=this.#e.fullFrame;return B(N)?N():null}#R(){const N=this.#M();return N?(this.#w||(this.#w=new w({mode:"memory"},this.#$())),N.version!==this.#O&&(this.#w.setRows(N.rows),this.#O=N.version),this.#w):null}#$(){const N=this.#t,S=N.state||{};return{...N,state:{...S,page:()=>0,pageSize:()=>0}}}#U(){const N=this.#R();return N?N.filteredIndices():new Uint32Array(0)}#K(){const N=this.#R();return N?N.unfilteredIndices():new Uint32Array(0)}#x(N){const S=this.#R();return S?S.handleFor(N):void 0}#I(){const N=this.#R();return N?N.display():[]}#Y(N){const S=this.#R();return S&&B(S.facetIndices)?S.facetIndices(N):new Uint32Array(0)}#F(){const N=this.#R();return N&&B(N.grandTotalRow)?N.grandTotalRow():null}#G(N){const S=this.#R();if(S){const X=N==="match"?S.matchCount:S.totalCount;if(B(X))return X.call(S)}const C=this.#e.counts,D=B(C)?C():null,G=D?D[N]:null;return typeof G=="number"?G:this.#v()}#H(){const N=this.#R();if(N&&B(N.grandTotalRow))return N.grandTotalRow();if((this.#t.config||{}).grandTotalRow!=="bottom")return null;const C=this.#e.grandTotals,D=B(C)?C():null;return!D||!D.totals?null:this.#l.grandTotal(D.totals,D.leafCount||0)}#z(){const N=this.#R();if(N&&B(N.unfilteredRows))return N.unfilteredRows();const S=[],C=this.count();for(let D=0;D<C;D++){const G=this.at(D);G&&S.push(G)}return S}#fe(){const N=this.#C("quick",""),S={protocol:A,groupPath:[],groupValues:[],groupBy:[],totals:[],totalFns:{},pivotBy:[],pivotMode:!1,filters:i(this.#C("filters",null),this.#B()),sort:this.#C("sort",[]),context:this.#C("context",null)};N&&(S.quick=N);const C=this.#C("where",null);return C&&C.active&&(S.where=C),S}#ne(){const N=this.#C("groupBy",[]).length,S=[];for(const C of this.#i.values())if(!(C.level!==N&&!C.flat))for(const D of C.cache.ids()){if(!C.cache.loaded(D))continue;const{start:G,end:X}=C.cache.rangeOf(D);for(let V=G;V<X&&C.cache.rowLoaded(V);V++){const J=this.#X(C,V);J&&!J.group&&S.push(J)}}return S}loadedCount(){const N=this.#R();if(N){const D=N.matchCount();return typeof D=="number"?D:N.count()}this.#q();const S=this.#C("groupBy",[]).length;let C=0;for(const D of this.#i.values())if(!(D.level!==S&&!D.flat))for(const G of D.cache.ids()){if(!D.cache.loaded(G))continue;const X=D.cache.fillOf(G);typeof X=="number"&&(C+=X)}return C}residentRows(){const N=this.#R();return N?N.display():this.#C("groupBy",[]).length>0?null:(this.#q(),this.#ne())}#pe(N,S,C){const{start:D,end:G}=N.cache.rangeOf(S),X=this.#C("groupBy",[]),V=this.#C("pivotBy",[]),J=this.#C("quick",""),ee=this.#Te(),te={protocol:A,range:{start:D,end:G},groupPath:N.path,groupValues:N.values,groupBy:X,totals:ee,totalFns:this.#le(ee),pivotBy:V,pivotMode:V.length>0,filters:i(this.#C("filters",null),this.#B()),sort:this.#C("sort",[]),context:this.#C("context",null),signal:C};J&&(te.quick=J);const ie=this.#C("where",null);return ie&&ie.active&&(te.where=ie),te}async#Fe(N,S){if(!B(this.#e.fetch))return;if(!this.#m){this.#m=!0;const X=this.#g;this.#g=[],queueMicrotask(()=>{for(const V of X)V()})}const C=this.#o.begin(`${N.key}:${S}`);N.cache.begin(S,C);const D=this.#d,{start:G}=N.cache.rangeOf(S);try{const X=await this.#e.fetch(this.#pe(N,S,C.signal));if(!C.current||D!==this.#d||this.#p)return;C.settle();const V=X&&X.rows||[];if(!!(X&&X[T])&&!N.flat){N.flat=!0,N.children.clear();for(const[ie,oe]of[...this.#c])oe.startsWith(`${N.key}:`)&&(this.#a.delete(oe),this.#c.delete(ie))}N.cache.fill(S,V),N.failed=!1;for(let ie=0;ie<V.length;ie++)this.#a.delete(`${N.key}:${G+ie}`);const ee=X&&typeof X.count=="number"?X.count:X&&typeof X.total=="number"?X.total:null,te=X&&B(X.pendingTotal?.then)?X.pendingTotal:null;ee!==null?(N.count=ee,N.complete=!0):V.length<N.cache.pageSize?(N.count=G+V.length,N.complete=!0):te&&(N.counting=!0,N.announced=null),X&&Array.isArray(X.pivotFields)&&this.#Pe(X.pivotFields),X&&X.pivot&&typeof X.pivot=="object"&&this.#Ce(X.pivot),this.#_("model:changed",{reason:"page",groupPath:N.path,block:S}),this.#_("rows:changed",{companion:!0,reason:"page",groupPath:N.path,block:S}),this.#me(N),te&&this.#Oe(N,te,D)}catch(X){if(C.settle(),E(X))return;N.cache.failed(S,X),N.failed=!0;const{end:V}=N.cache.rangeOf(S);for(let J=G;J<V;J++)this.#a.delete(`${N.key}:${J}`);this.#_("model:changed",{reason:"page-error",groupPath:N.path,block:S}),this.#_("source:error",{error:X,groupPath:N.path,block:S})}}async#Oe(N,S,C){let D;try{D=await S}catch(G){if(C!==this.#d||this.#p)return;N.counting=!1,E(G)||(N.failed=!0),E(G)||this.#_("source:error",{error:G,groupPath:N.path});return}C!==this.#d||this.#p||(N.counting=!1,typeof D=="number"&&(N.count=D,N.complete=!0,this.#me(N),this.#_("model:changed",{reason:"total",count:D,groupPath:N.path})))}#me(N){typeof N.count!="number"||!N.complete||N.announced!==N.count&&(N.announced=N.count,this.#_("source:total",{total:N.count,groupPath:N.path}))}#ye(N){if(this.#p)return null;this.#q();const S=this.#m?null:new Promise(V=>{this.#g.push(V),setTimeout(V,_)}),C=N();if(!S&&!C)return null;const D=(async()=>{S&&await S;for(let V=N();V;V=N())await V})();let G;const X=new Promise(V=>{G=setTimeout(V,_)});return Promise.race([D,X]).then(()=>clearTimeout(G))}totalPending(){if(this.#r.failed)return!1;if(this.#r.counting===!0)return!0;if(this.#R())return!1;this.#q();const N=this.#r;return N.count===null&&!N.complete&&N.cache.loadedExtent()===0}totalFailed(){return this.#r.failed===!0}#Pe(N){N.length===this.#u.length&&N.every((S,C)=>S===this.#u[C])||(this.#u=N,this.#_("column:pivoted",{pivotFields:N,remote:!0}))}#de(){const N=this.#t.config||{};return N.pivot&&N.pivot.separator||v}#ie(N){const S=this.#de(),C=this.#Te();if(!C.length)return N.slice();const D=[];for(const G of N)for(const X of C)D.push(`${G}${S}${X}`);return D}#Ce(N){const S=this.#de();this.#f||(this.#f={keys:new Map,cells:new Map,result:null});const C=this.#f;let D=!1;const G=V=>{const J=Array.isArray(V)?V:[V],ee=m(J,S);return C.keys.has(ee)||(C.keys.set(ee,J),D=!0),ee},X=this.#C("groupBy",[]).length>0;for(const V of Array.isArray(N.axis)?N.axis:[])G(V);for(const V of Array.isArray(N.cells)?N.cells:[]){if(!V||typeof V!="object")continue;const J=G(V.pivot);if(X&&!(Array.isArray(V.group)&&V.group.length))continue;const ee=m(Array.isArray(V.group)?V.group:[],S);for(const[te,ie]of Object.entries(V.values||{}))C.cells.set(p(ee,J,te),ie)}C.result=null,D&&this.#Pe((this.pivot()||{fields:[]}).fields)}#te(N){let S=this.#J(N);for(const C of N.children.values())this.#Ee(C.key)&&(S+=this.#te(C));return S}#J(N){if(N.count!==null)return N.count;const S=N.cache.loadedExtent();return N.complete?S:N.row&&N.row.leafCount>0?N.level>=this.#C("groupBy",[]).length?Math.max(S,N.row.leafCount):S===0?1:Math.min(S+N.cache.pageSize,Math.max(S,N.row.leafCount)):S+N.cache.pageSize}#W(N,S){let C=S,D=0;const G=[...N.children.entries()].filter(([,V])=>this.#Ee(V.key)).sort((V,J)=>V[0]-J[0]);for(const[V,J]of G){const ee=V-D+1;if(C<ee)return{node:N,local:D+C};C-=ee,D=V+1;const te=this.#te(J);if(C<te)return this.#W(J,C);C-=te}const X=this.#J(N);return D+C<X?{node:N,local:D+C}:null}#X(N,S){const C=`${N.key}:${S}`,D=this.#a.get(C);if(D)return D;const G=N.cache.rowAt(S);if(G===void 0)return null;const X=this.#C("groupBy",[]);let V;if(N.level<X.length&&!N.flat){const J=X[N.level],ee=this.#f!==null&&N.level===X.length-1&&this.#C("pivotBy",[]).length>0,te=this.#he(G,J),ie=te==null,oe=[...N.path,ie?"":String(te)],ue=[...N.keyPath,ie?null:String(te)];if(V=this.#l.group({path:oe,keyPath:ue,column:J,value:te,level:N.level,parent:N.row,leafCount:Number(G.leafCount)||0,expanded:ee?!1:this.#Ee(n(ue)),...ee?{hasChildren:!1}:{}}),V.totals=this.#D(G),V.data=G,!ee){let ye=this.#i.get(V.key);ye?ye.row=V:(ye=new j(oe,N.level+1,this.#n,ue),ye.row=V,this.#i.set(ye.key,ye)),ye.values=[...N.values,te],N.children.set(S,ye)}}else V=this.#l.leaf(G,S,N.level,N.row);return this.#a.set(C,V),this.#c.set(V.key,C),V}#D(N){const S=N||{};if(S.totals&&typeof S.totals=="object")return S.totals;const C={};for(const D of this.#Te())Object.hasOwn(S,D)&&(C[D]=S[D]);return C}#Ne(N,S){const{start:C,end:D}=N.cache.rangeOf(S);for(let G=C;G<D;G++){const X=`${N.key}:${G}`,V=this.#a.peek(X);V&&this.#c.delete(V.key),this.#a.delete(X)}}#q(){const N=this.#ve();return N===this.#d?!1:(this.#d=N,this.#o.abortAll("query"),this.#re(),this.#m=!1,this.#_("model:changed",{reason:"query"}),!0)}#re(){for(const N of this.#i.values())N.cache.clear(),N.count=null,N.complete=!1,N.announced=null,N.counting=!1,N.failed=!1,N.children.clear(),N.flat=!1;this.#a.clear(),this.#c.clear(),this.#y++,this.#f=null}#ve(){const N=this.#C("where",null);return`${t({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)})}|${N?N.version:0}`}#Ee(N){const S=this.#C("expanded",null);return S?B(S.has)?S.has(N):Array.prototype.includes.call(S,N):this.#s.has(N)}#Te(){const N=this.#C("totals",[]);if(N&&N.length)return[...N];const S=this.#t.columns;return!S||!B(S.all)?[]:S.all().filter(C=>!!C.total).map(C=>C.id)}#le(N){const S=this.#t.columns,C={};if(!S||!B(S.get))return C;for(const D of N){const G=S.get(D);if(!G)continue;const X=G.groupTotal!=null?G.groupTotal:G.total;typeof X=="string"&&(C[D]=X)}return C}#he(N,S){const C=this.#t.columns,D=C&&B(C.get)?C.get(S):void 0;return D&&B(D.getValue)?D.getValue(N):N?.[S]}#Be(){c(this.#t)}#B(){const N=this.#t.config||{};return{tz:N.timeZone,weekStartsOn:N.weekStartsOn}}#C(N,S){const C=this.#t.state;if(C&&B(C[N])){const D=C[N]();return D??S}return S}#_(N,S){const C=this.#t.emit;B(C)&&C(N,S)}}}),Ue("packages/core/src/source/gapbuffer.js",function(e,H){"use strict";Object.defineProperty(e,"GapBuffer",{enumerable:!0,get:function(){return $}});const ne=64;class ${#e;#t=0;#n=0;constructor(B=ne){this.#e=new Uint32Array(Math.max(1,B)),this.#n=this.#e.length}static from(B,x=ne){const Z=new $(B.length+Math.max(1,x));return Z.#e.set(B,0),Z.#t=B.length,Z.#n=Z.#e.length,Z}get length(){return this.#t+(this.#e.length-this.#n)}get capacity(){return this.#e.length}at(B){return B<0||B>=this.length?0:B<this.#t?this.#e[B]:this.#e[B+(this.#n-this.#t)]}insert(B,x){const Z=B<0?0:B>this.length?this.length:B;this.#r(Z),this.#t===this.#n&&this.#i(),this.#e[this.#t++]=x}push(B){this.insert(this.length,B)}removeAt(B){return!Number.isInteger(B)||B<0||B>=this.length?!1:(this.#r(B),this.#n++,!0)}toArray(){const B=new Uint32Array(this.length);return B.set(this.#e.subarray(0,this.#t),0),B.set(this.#e.subarray(this.#n),this.#t),B}clear(){this.#t=0,this.#n=this.#e.length}#r(B){if(B!==this.#t)if(B<this.#t){const x=this.#t-B;this.#e.copyWithin(this.#n-x,B,this.#t),this.#t=B,this.#n-=x}else{const x=B-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+x),this.#t=B,this.#n+=x}}#i(){const B=this.#e.length-this.#n,x=new Uint32Array(Math.max(this.#e.length*2,this.#e.length+ne));x.set(this.#e.subarray(0,this.#t),0),x.set(this.#e.subarray(this.#n),x.length-B),this.#e=x,this.#n=x.length-B}}}),Ue("packages/core/src/store/ingest.js",function(e,H){"use strict";Object.defineProperty(e,"INGEST_DEFAULTS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"inferKind",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"decideText",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"createReaders",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"Ingest",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return i}});const ne=H("packages/core/src/internal/schedule.js"),$=ne.now,q=ne.nextFrame,B=H("packages/core/src/internal/warn.js"),x=B.infoOnce,Z=B.warnOnce,U=H("packages/core/src/internal/predicates.js").isFunction,K=H("packages/core/src/internal/paths.js").pathGetter,O=H("packages/core/src/store/columnstore.js").ColumnStore,b=Object.freeze({chunkMs:8,chunkRows:512,sampleSize:100,dictionaryRatio:.1,columnarBelow:5e3,initialCapacity:1024});function u(t,c={}){if(c.multi)return"multi";if(t.length===0)return"object";let s=0,a=0,f=0,w=0,g=0;for(let d=0;d<t.length;d++){const p=t[d];typeof p=="number"?s++:typeof p=="boolean"?a++:typeof p=="string"?f++:p instanceof Date?w++:Array.isArray(p)&&g++}const k=t.length;return s===k?"float64":a===k?"bitset":w===k?"float64":f===k?"text":g===k?"multi":"object"}function h(t,c,s){return c<=0||t<s*c?"dictionary":"object"}function l(t,c,s){const a=new Map,f=new Map;for(const A of t){if(A.computed)continue;const M=U(A.read)?A.read:K(A.field||A.id);f.set(A.id,M),a.set(A.id,M)}const w=c?.order??[],g=c?.fns??{},k=c?.deps??{},d=c?.wrapDeps??null,p=w.filter(A=>U(g[A])),m=p.some(A=>k[A]==="*");let v=new WeakMap;const y=A=>{const M={};if(m)for(const[_,R]of f)M[_]=R(A);for(const _ of p){const R=k[_];let I;if(R==="*")I=M;else{I={};const j=R||[];for(let L=0;L<j.length;L++){const F=j[L];I[F]=F in M?M[F]:f.get(F)?.(A)}}M[_]=g[_](d?d(I,_):I,{data:A,row:null,column:null,grid:null,context:s})}return M},T=A=>{if(A===null||typeof A!="object"&&typeof A!="function")return y(A);let M=v.get(A);return M===void 0&&(M=y(A),v.set(A,M)),M};for(const A of p)a.set(A,M=>T(M)[A]);return{readers:a,reset(){v=new WeakMap}}}class r{spec;read;kind;inferred;nullable;candidate=!1;distinct=null;change=null;reason="";constructor(c,s){this.spec=c,this.read=s,this.kind="object",this.inferred=!1,this.nullable=c.nullable!==!1}}class n{#e;#t=[];#n=null;#r;#i=0;#s;#o=!1;#l=!1;#a=0;#c;constructor(c,s={},a={}){this.#e=Array.isArray(c)?c:Array.from(c||[]),this.#s={...b,...a};const f=s.columns??[];this.#r=l(f,s.computed??null,s.context),this.#c=this.#e.length>=this.#s.columnarBelow,this.#u(f,s.computed??null),this.#n=new O(this.#t.map(w=>({id:w.spec.id,kind:w.kind,nullable:w.nullable,read:w.read,dictionary:w.spec.dictionary})),{initialCapacity:this.#s.initialCapacity,columnarBelow:this.#s.columnarBelow})}get store(){return this.#n}get done(){return this.#o||this.#l}get progress(){return this.#i}slice(){if(this.done)return!1;if(this.#s.signal?.aborted)return this.#l=!0,!1;const c=$(),{chunkMs:s,chunkRows:a}=this.#s,f=this.#e.length;do{const w=Math.min(this.#i+a,f);this.#n.append(this.#e.slice(this.#i,w)),this.#f(this.#i,w),this.#i=w,this.#r.reset(),this.#h(!1)}while(this.#i<f&&$()-c<s);return this.#a+=$()-c,this.#s.onProgress?.({loaded:this.#i,total:f}),this.#i>=f?(this.#h(!0),this.#o=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(c=>({id:c.spec.id,kind:c.kind,nullable:c.nullable,read:c.read,dictionary:c.spec.dictionary})),decisions:this.#t.map(c=>({id:c.spec.id,kind:c.kind,nullable:c.nullable,inferred:c.inferred,distinct:c.candidate||c.change?this.#d(c):null,change:c.change,reason:c.reason})),count:this.#n.count,elapsed:this.#a,cancelled:this.#l}}#u(c,s){const a=this.#e,f=Math.min(this.#s.sampleSize,a.length),w=this.#s.dictionaryRatio,g=s?.pure instanceof Set?s.pure:new Set(s?.pure??s?.order??[]);for(const k of c){if(!k||!k.id)continue;if(k.computed&&(k.pure===!1||s&&!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)??(U(k.read)?k.read:K(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 m=[];for(let y=0;y<f&&m.length<this.#s.sampleSize;y++){const T=d(a[y]);T!=null&&m.push(T)}p.inferred=!0;const v=u(m,{multi:k.multi});if(v==="text"){const y=new Set(m).size;p.kind=h(y,m.length,w),p.candidate=this.#c,p.reason=`sampled ${y} distinct in ${m.length}`}else p.kind=v,p.reason=`inferred from ${m.length} sampled values`,v==="object"&&m.length&&x(`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(m))}this.#t.push(p)}}#f(c,s){const a=this.#e;for(const f of this.#t){if(!f.candidate||!f.distinct)continue;const w=f.distinct;for(let g=c;g<s;g++){const k=f.read(a[g]);k!=null&&w.add(k)}}}#d(c){if(c.distinct)return c.distinct.size;const s=this.#n.column(c.spec.id);return s?.dict?s.dict.size:0}#h(c){const s=this.#s.dictionaryRatio,a=this.#e.length;for(const f of this.#t){if(!f.candidate)continue;const w=this.#d(f);if(f.kind==="dictionary"&&w>=s*a){const g=this.#n.column(f.spec.id);f.distinct=new Set(g?.dict?g.dict.values():[]),this.#n.convert(f.spec.id,"object"),f.kind="object",f.change="demoted",f.reason=`${w} distinct values is at or above ${s*100}% of ${a} rows`;continue}if(f.kind==="object"&&w>=s*a){f.candidate=!1,f.distinct=null,f.reason=`${w} distinct values is at or above ${s*100}% of ${a} rows`;continue}c&&f.kind==="object"&&w<s*a&&(this.#n.convert(f.spec.id,"dictionary"),f.kind="dictionary",f.change=f.change==="demoted"?null:"promoted",f.reason=`${w} distinct values is below ${s*100}% of ${a} rows`,f.distinct=null),c&&(f.candidate=!1)}}}async function o(t,c={},s={}){const a=new n(t,c,s),f=s.scheduler?.frame??q;for(;a.slice();)await new Promise(w=>{f(w)});return a.result()}function i(t,c={},s={}){const a=new n(t,c,{...s,chunkMs:1/0});for(;a.slice(););return a.result()}}),Ue("packages/core/src/store/columnpack.js",function(e,H){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return h}});const $=H("packages/core/src/internal/paths.js").pathGetter,q=H("packages/core/src/store/ingest.js"),B=q.inferKind,x=q.decideText,Z=q.INGEST_DEFAULTS,U=H("packages/core/src/store/columnstore.js").toFloat,W=new Set(["float64","int32","bitset","dictionary","object","multi"]);function K(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&&!W.has(r.kind))return!1;return!0}function E(l){const r=U(l);return Number.isFinite(r)?r|0:0}function O(l){return l==null?[]:Array.isArray(l)?l:[l]}function b(l,r,n,o){if(l.kind)return l.kind;const i=[];for(let s=0;s<r.length&&i.length<Z.sampleSize;s++){const a=r[s];a!=null&&i.push(a)}const t=B(i,{multi:l.multi});if(t!=="text")return t;const c=new Set(i).size;return x(c,i.length,o)}function u(l,r,n={}){const o=r.length|0,i=n.dictionaryRatio??Z.dictionaryRatio,t=[];for(const c of l){const s=$(c.field||c.id),a=c.nullable!==!1,f=new Array(o);for(let p=0;p<o;p++){const m=s(r[p]);f[p]=m===void 0?null:m}const w=b(c,f,o,i),g=a?new Uint8Array(o+7>>3):null,k=p=>{g&&(g[p>>3]|=1<<(p&7))};let d;switch(w){case"float64":{const p=new Float64Array(o);for(let m=0;m<o;m++){const v=f[m],y=v===null;y||k(m),p[m]=y?NaN:U(v)}d={id:c.id,kind:w,nullable:a,values:p,presence:g,offsets:null,table:null};break}case"int32":{const p=new Int32Array(o);for(let m=0;m<o;m++){const v=f[m],y=v===null;y||k(m),p[m]=y?0:E(v)}d={id:c.id,kind:w,nullable:a,values:p,presence:g,offsets:null,table:null};break}case"bitset":{const p=new Uint8Array(o+7>>3);for(let m=0;m<o;m++){const v=f[m],y=v===null;y||k(m),!y&&v&&(p[m>>3]|=1<<(m&7))}d={id:c.id,kind:w,nullable:a,values:p,presence:g,offsets:null,table:null};break}case"dictionary":{const p=new Uint32Array(o),m=[],v=new Map;for(let y=0;y<o;y++){const T=f[y];if(T===null){p[y]=0;continue}k(y);let A=v.get(T);A===void 0&&(A=m.length,m.push(T),v.set(T,A)),p[y]=A}d={id:c.id,kind:w,nullable:a,values:p,presence:g,offsets:null,table:m};break}case"multi":{const p=[],m=new Map,v=new Uint32Array(o+1),y=[];for(let T=0;T<o;T++){const A=f[T];v[T]=y.length,A===null||k(T);const _=O(A);for(let R=0;R<_.length;R++){const I=_[R];let j=m.get(I);j===void 0&&(j=p.length,p.push(I),m.set(I,j)),y.push(j)}}v[o]=y.length,d={id:c.id,kind:w,nullable:a,values:Int32Array.from(y),presence:g,offsets:v,table:p};break}default:{const p=new Array(o);for(let m=0;m<o;m++){const v=f[m];v!==null&&k(m),p[m]=v}d={id:c.id,kind:"object",nullable:a,values:p,presence:g,offsets:null,table:null};break}}t.push(d)}return{count:o,columns:t}}function h(l){const r=[];if(!l||!Array.isArray(l.columns))return r;const n=o=>{ArrayBuffer.isView(o)&&o.buffer&&!r.includes(o.buffer)&&r.push(o.buffer)};for(const o of l.columns)n(o.values),n(o.presence),n(o.offsets);return r}}),Ue("packages/core/src/source/stream.js",function(e,H){"use strict";Object.defineProperty(e,"DEFAULT_PROMOTE_BELOW",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"createStreamSource",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return j}});const $=H("packages/core/src/internal/lru.js").Lru,B=H("packages/core/src/internal/predicates.js").isFunction,x=H("packages/core/src/internal/schedule.js"),Z=x.now,Y=x.nextFrame,U=x.cancelFrame,W=x.whenIdle,E=H("packages/core/src/internal/compare.js").defaultCompare,O=H("packages/core/src/internal/warn.js"),b=O.warnOnce,u=O.infoOnce,l=H("packages/core/src/internal/paths.js").getPath,r=H("packages/core/src/source/abort.js"),n=r.createAbortScope,o=r.isAbortError,i=H("packages/core/src/source/rows.js"),t=i.createRowFactory,c=i.lazyRowView,a=H("packages/core/src/source/gapbuffer.js").GapBuffer,w=H("packages/core/src/source/memory.js").createMemorySource,k=H("packages/core/src/source/filterwire.js").querySignature,p=H("packages/core/src/store/columnpack.js").isPortableSchema,m=25e4,v=Symbol("lattice.stream.storeBacked"),y=8,T=.1,A=1e3,M=50;function _(L){return Math.min(A,Math.max(M,Math.floor(L/4)))}function R(L){if(L instanceof Date)return L.getTime();if(typeof L=="number")return Number.isFinite(L)?L:NaN;if(typeof L=="string"){const F=L.trim();if(!F)return NaN;const N=Date.parse(F);return Number.isNaN(N)?Number(F):N}return NaN}function I(L,F){return new j(L,F)}class j{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#i=[];#s=null;#o;#l;#a=new Map;#c=n();#u={loaded:0,estimated:void 0};#f=null;#d=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;#N=0;#P=null;#M=1/0;#R=!1;#$=null;#U=null;#K=null;#x=null;#I=!1;#Y=0;#F=0;#G=!1;constructor(F,N){this.#e=F||{mode:"stream"},this.#t=N||{},this.#o=t(this.#t),this.#l=new $(4096),this.#T=this.#We();const S=(this.#t.config||{}).ingest;this.#I=!!S&&S.retainSource===!1,B(this.#e.open)||b("source.stream.open",'source.mode "stream" requires an open function; the grid will stay empty.'),this.#e.autoStart!==!1&&queueMicrotask(()=>this.start());const C=Number(this.#e.poll);Number.isFinite(C)&&C>0&&(this.#x=setInterval(()=>{this.#v||this.reload()},C),this.#x&&B(this.#x.unref)&&this.#x.unref()),this.#z()}#H(){const F=Number(this.#e.maxAge);return Number.isFinite(F)&&F>0?F:0}#z(){const F=this.#H();if(!F)return;const N=this.#e.ageBy;B(N)?this.#U=N:typeof N=="string"&&N?this.#U=S=>l(S,N):this.#U=null,this.#P=[],this.#$=setInterval(()=>{this.#v||this.#fe()&&(this.#q(),this.#ce())},_(F)),this.#$&&B(this.#$.unref)&&this.#$.unref()}#fe(){const F=this.#H();return!F||!this.#P?!1:this.#R?!0:this.#M<Date.now()-F*(1+T)}#ne(F,N){if(!this.#P)return;const S=this.#U?R(this.#U(N)):Date.now();this.#P[F]=S,Number.isNaN(S)||(S<this.#M&&(this.#M=S),S<Date.now()-this.#H()&&(this.#R=!0))}#pe(){return this.#be("groupBy",[]).length>0?!0:!!this.#be("pivotMode",!1)&&this.#be("pivotBy",[]).length>0}#Fe(){if(this.#g||this.#v)return;const F=this.#pe();if(F&&!this.#b){this.#b=w({mode:"memory",rows:this.#n},this.#Oe()),this.#A=!1;return}!F&&this.#b&&(this.#b.destroy(),this.#b=null)}#Oe(){if(this.#y)return this.#y;const F=this,N={liveIndices:()=>F.#me(),live:S=>F.#n[S]!==void 0,source:S=>F.#Se(S),get physical(){return F.#n.length}};return this.#I&&(N.column=S=>{const C=F.#t.store;return C&&B(C.column)?C.column(S):void 0}),this.#y=Object.create(this.#t,{store:{value:N,enumerable:!0,configurable:!0}}),this.#y}#me(){const F=new Uint32Array(this.#n.length);let N=0;for(let S=0;S<this.#n.length;S++)this.#n[S]!==void 0&&(F[N++]=S);return F.subarray(0,N)}#ye(){return this.#g?this.#g:this.#b?(this.#A&&(this.#A=!1,this.#b.setRows(this.#n)),this.#b):null}invalidate(F="filter"){if(this.#g){this.#g.invalidate(F);return}this.#Fe(),this.#b&&this.#b.invalidate(F),(F==="filter"||F==="sort")&&this.#Te()}count(){const F=this.#ye();return F?F.count():this.#r?this.#r.length:this.#S}matchCount(){const F=this.#ye();return F&&B(F.matchCount)?F.matchCount():this.#r?this.#r.length:this.#S}totalCount(){const F=this.#ye();return F&&B(F.totalCount)?F.totalCount():this.#S}unfilteredRows(){const F=this.#ye();if(F&&B(F.unfilteredRows))return F.unfilteredRows();const N=[];for(let S=0;S<this.#n.length;S++){if(!this.#n[S])continue;const C=this.#Re(S);C&&N.push(C)}return N}at(F){const N=this.#ye();if(N)return N.at(F);if(F<0||F>=this.count())return;const S=this.#r?this.#r.at(F):F,C=this.#Re(S);return C.index=F,C}byKey(F){const N=this.#ye();if(N)return N.byKey(F);const S=this.#a.get(F);return S===void 0?void 0:this.#Re(S)}leavesOf(F){const N=this.#ye();return N&&B(N.leavesOf)?N.leavesOf(F):[]}loaded(F){return F>=0&&F<this.count()}hint(F,N){if(this.#g){this.#g.hint(F,N);return}this.#Pe(),this.#p=Math.max(0,Math.floor(F))}#Pe(){this.#v||this.#We()===this.#T||this.reload()}display(){const F=this.#ye();return F?F.display():c(()=>this.count(),N=>this.at(N))}apply(F){if(this.#g)return this.#g.apply(F);const N={added:[],updated:[],removed:[]};if(!F)return N;if(F.update){let S=!1;for(const C of F.update){const D=this.#a.get(this.#o.keyOf(C,-1));if(D===void 0)continue;const G=this.#Be(D);this.#I?this.#ze(D,C):this.#n[D]=C,this.#l.delete(D),this.#B(D,G),this.#P&&(this.#ne(D,C),S=!0),this.#A=!0,N.updated.push(this.#Re(D))}S&&this.#q()}if(F.add&&F.add.length){const S=this.#D(F.add);for(const C of S)N.added.push(this.#Re(C))}return F.remove&&F.remove.length&&b("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#ce(),N}reload(F){this.#c.abortAll("reload"),this.#_e(),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.#N=0,this.#P&&(this.#P=[]),this.#M=1/0,this.#R=!1,this.#w=!1,this.#O=!1,this.#u={loaded:0,estimated:void 0},this.#T=this.#We(),this.#ke("model:changed",{reason:"reload"}),this.start()}destroy(){this.#v=!0,this.#x!==null&&(clearInterval(this.#x),this.#x=null),this.#$!==null&&(clearInterval(this.#$),this.#$=null),this.#P=null,this.#c.abortAll("destroyed"),this.#_e(),this.#f!==null&&(this.#k(this.#f),this.#f=null),this.#b&&(this.#b.destroy(),this.#b=null),this.#g&&this.#g.destroy(),this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear()}async start(){if(this.#O||this.#v||!B(this.#e.open))return;this.#O=!0;const F=this.#c.begin("stream");this.#Te(),this.#Fe();let N;try{N=this.#e.open({sort:this.#be("sort",[]),filters:this.#be("filters",null),quick:this.#be("quick","")||void 0,context:this.#be("context",null),signal:F.signal})}catch(C){this.#ke("source:error",{error:C});return}const S=B(N[Symbol.asyncIterator])?N[Symbol.asyncIterator]():N[Symbol.iterator]();this.#K=S;try{for(;;){const C=await S.next();if(!F.current||this.#v)return;if(C.done){this.#se();return}if(await this.#de(C.value,F),!F.current||this.#v)return;if(C.value&&C.value.done){this.#se();return}if(await this.#oe(),!F.current||this.#v)return}}catch(C){if(o(C))return;this.#ke("source:error",{error:C})}finally{F.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 F=this.#ye();F&&(B(F.invalidateHandles)&&F.invalidateHandles(),B(F.invalidate)&&F.invalidate("sort"))}renderCount(){return this.#d}ingestStats(){return{worker:this.#Y,inline:this.#F,storeBacked:this.#I}}#de(F,N){if(!F)return;const S=F.rows;if(S&&S.length&&this.#Ce(S))return this.#J(F,N);const C=Z();S&&S.length&&(this.#D(S),this.#F++),this.#ie(F),this.#h+=Z()-C,this.#ce()}#ie(F){this.#u.loaded=F.progress&&typeof F.progress.loaded=="number"?F.progress.loaded:this.#n.length,F.progress&&typeof F.progress.estimated=="number"&&(this.#u.estimated=F.progress.estimated)}#Ce(F){if(this.#G||this.#g)return!1;const N=this.#W();if(!N)return!1;const S=this.#t.store;if(!S||!B(S.appendPacked))return!1;const C=this.#X();return!C||!p(C)?(this.#G=!0,u("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):F.length<N.threshold?!1:!this.#te(F)}#te(F){if(!this.#o.keyed)return!1;const N=new Set;for(let S=0;S<F.length;S++){const C=this.#o.keyOf(F[S],this.#n.length+S);if(C!=null){if(N.has(C)||this.#a.has(C))return!0;N.add(C)}}return!1}async#J(F,N){const S=F.rows,C=this.#W(),D=this.#X();let G;try{G=await C.columnize(D,S,{key:"ingest:stream",signal:N&&N.signal})}catch(te){if(o(te)||(b("source.stream.columnize","worker columnization failed; columnizing on the main thread",te),this.#G=!0,N&&(!N.current||this.#v)))return;this.#D(S),this.#F++,this.#ie(F),this.#ce();return}if(N&&(!N.current||this.#v))return;const X=this.#t.store,V=this.#I?void 0:S,{from:J}=X.appendPacked(G,V),ee=G.count|0;for(let te=0;te<ee;te++){const ie=J+te,oe=S[te],ue=this.#o.keyed?this.#o.keyOf(oe,ie):null;if(this.#n[ie]=this.#I?v:oe,this.#S++,this.#ne(ie,oe),ue!==null&&this.#a.set(ue,ie),!this.#r||!this.#le(ie))continue;const ye=this.#C(ie);this.#r.insert(ye,ie),ye<=this.#p&&this.#m++}this.#A=!0,this.#q(),this.#Y++,this.#ie(F),this.#ce()}#W(){const F=this.#t.ingestWorker;return B(F)?F():null}#X(){const F=this.#t.storeSchema;return B(F)?F():null}#D(F){const N=[],S=this.#t.store,C=new Array(F.length),D=[],G=new Set;for(let V=0;V<F.length;V++){const J=this.#o.keyed?this.#o.keyOf(F[V],this.#n.length+D.length):null;C[V]=J,!(J!==null&&(this.#a.has(J)||G.has(J)))&&(J!==null&&G.add(J),D.push(F[V]))}let X=D.length&&S&&B(S.append)?S.append(D).from:this.#n.length;for(let V=0;V<F.length;V++){const J=F[V],ee=C[V];if(ee!==null&&this.#a.has(ee)){const oe=this.#a.get(ee),ue=this.#Be(oe);this.#I||(this.#n[oe]=J,S&&B(S.setSource)&&S.setSource(oe,J)),this.#ze(oe,J),this.#l.delete(oe),this.#ne(oe,J),this.#B(oe,ue);continue}const te=X++;if(this.#n[te]=this.#I?v:J,this.#S++,this.#ne(te,J),ee!==null&&this.#a.set(ee,te),N.push(te),!this.#r||!this.#le(te))continue;const ie=this.#C(te);this.#r.insert(ie,te),ie<=this.#p&&this.#m++}return this.#A=!0,this.#q(),N}#Ne(F){const N=this.#n[F];let S=!1;if(this.#r){const X=this.#Ee(F);X>=0&&X<=this.#p&&(S=!0)}else F<=this.#p&&(S=!0);const C=N===v?this.#Se(F):N,D=this.#o.keyed?this.#o.keyOf(C,F):null;D!==null&&this.#a.get(D)===F&&this.#a.delete(D),this.#n[F]=void 0,this.#P&&(this.#P[F]=NaN),this.#l.delete(F);const G=this.#t.store;return G&&B(G.remove)&&G.remove(F),this.#S--,S}#q(){let F=0,N=0;const S=this.#ve();F+=S.dropped,N+=S.aboveAnchor;const C=this.#re();F+=C.dropped,N+=C.aboveAnchor,F&&(this.#A=!0,this.#E+=F,this.#Te(),this.#m-=N,this.#ke("stream:evicted",{evicted:F,total:this.#E,live:this.#S}))}#re(){const F=this.#e.maxRows;if(!Number.isFinite(F)||F<=0||this.#S<=F)return{dropped:0,aboveAnchor:0};const N=Math.max(1,Math.floor(F*(1-T)));let S=0,C=0;for(;this.#S>N&&this.#N<this.#n.length;){const D=this.#N++;this.#n[D]!==void 0&&(this.#Ne(D)&&C++,S++)}return{dropped:S,aboveAnchor:C}}#ve(){const F=this.#H();if(!F||!this.#P||!this.#fe())return{dropped:0,aboveAnchor:0};const N=Date.now()-F;let S=0,C=0,D=1/0;for(let G=this.#N;G<this.#n.length;G++){if(this.#n[G]===void 0)continue;const X=this.#P[G];if(!(Number.isNaN(X)||X===void 0)){if(X>=N){X<D&&(D=X);continue}this.#Ne(G)&&C++,S++}}for(this.#M=D,this.#R=!1;this.#N<this.#n.length&&this.#n[this.#N]===void 0;)this.#N++;return{dropped:S,aboveAnchor:C}}#Ee(F){if(!this.#r)return F;for(let N=0;N<this.#r.length;N++)if(this.#r.at(N)===F)return N;return-1}#Te(){this.#i=this.#be("sort",[]),this.#s=this.#be("filters",null);const F=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#H()>0,N=this.#be("where",null),S=(this.#t.config||{}).hostFilter,C=!!(N&&N.active)||!!(S&&B(S.active)&&S.active());if(!(F||this.#i.length>0||!!this.#s||!!this.#be("quick","")||C)){this.#r=null;return}this.#r=new a(Math.max(64,this.#n.length+64));for(let G=0;G<this.#n.length;G++)this.#n[G]!==void 0&&this.#le(G)&&this.#r.insert(this.#C(G),G)}#le(F){const N=this.#Se(F);if(this.#s&&!this.#he(this.#s,N))return!1;const S=String(this.#be("quick","")||"").toLowerCase();if(S&&!this.#Ye(N).includes(S))return!1;const C=(this.#t.config||{}).hostFilter;if(C&&B(C.active)&&C.active()&&!C.passes(this.#Re(F)))return!1;const D=this.#be("where",null);if(D&&D.active){const G=this.#Re(F);if(!D.passes(G.data,G.key))return!1}return!0}#he(F,N){if(!F)return!0;const S=F;if(Array.isArray(S.conditions))return S.op==="or"?S.conditions.some(G=>this.#he(G,N)):S.op==="not"?!S.conditions.some(G=>this.#he(G,N)):S.conditions.every(G=>this.#he(G,N));const C=F,D=(this.#t.compute||{}).testValue;return B(D)?!!D(this.#Ie(N,C.col),C,(this.#t.config||{}).locale):(b("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#Be(F){if(!this.#r)return-1;if(!this.#i.length)return this.#Ee(F);let N=0,S=this.#r.length;for(;N<S;){const C=N+S>>>1;this.#_(this.#r.at(C),F)<0?N=C+1:S=C}for(let C=N;C<this.#r.length;C++){const D=this.#r.at(C);if(D===F)return C;if(this.#_(D,F)>0)break}return this.#Ee(F)}#B(F,N){if(!this.#r||!this.#i.length)return;const S=this.#le(F);if(N>=0&&this.#r.at(N)===F)this.#r.removeAt(N),N<=this.#p&&this.#m--;else if(N>=0)return;if(!S)return;const C=this.#C(F);this.#r.insert(C,F),C<=this.#p&&this.#m++}#C(F){if(!this.#r||!this.#i.length)return this.#r?this.#r.length:0;let N=0,S=this.#r.length;for(;N<S;){const C=N+S>>>1;this.#_(F,this.#r.at(C))<0?S=C:N=C+1}return N}#_(F,N){const S=this.#Se(F),C=this.#Se(N);for(const D of this.#i){const G=this.#Ve(D.col),X=this.#Ie(S,D.col),V=this.#Ie(C,D.col),ee=(G&&G.value&&B(G.value.compare)?G.value.compare:E)(X,V);if(ee!==0)return D.dir==="desc"?-ee:ee}return 0}#se(){this.#w=!0,this.#u.loaded=this.#u.loaded||this.#n.length;const F=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:m;!this.#I&&this.#n.length<F&&(this.#g=w({mode:"memory",rows:this.#n},this.#t),this.#$!==null&&(clearInterval(this.#$),this.#$=null),this.#b&&(this.#b.destroy(),this.#b=null)),this.#ce(),this.#ke("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:F})}#ce(){this.#f!==null||this.#v||(this.#f=this.#we(()=>{this.#f=null,this.#d++;const F=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.#d}),this.#ke("model:changed",{reason:"stream",shiftAboveViewport:F,anchor:this.#p}),this.#ke("rows:changed",{companion:!0,reason:"stream"})}))}#oe(){return this.#d===0||this.#h<this.#ge()?Promise.resolve():(this.#h=0,new Promise(F=>{const N=(this.#t.scheduler||{}).idle;B(N)?N(()=>F()):W(()=>F())}))}#ge(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:y}#we(F){const N=this.#t.scheduler||{};return B(N.frame)?N.frame(F):Y(F)}#k(F){const N=this.#t.scheduler||{};B(N.cancel)?N.cancel(F):U(F)}#Se(F){const N=this.#n[F];if(N!==void 0&&N!==v)return N;if(N===void 0)return;const S=this.#t.store;return S&&B(S.source)?S.source(F):void 0}#ze(F,N){const S=this.#t.store;if(!S||!B(S.set))return;const C=this.#X();if(Array.isArray(C))for(const D of C){if(!D||!D.id)continue;const G=B(D.read)?D.read:X=>l(X,D.field||D.id);S.set(D.id,F,G(N))}}#Re(F){let N=this.#l.get(F);return N||(N=this.#o.leaf(this.#Se(F),F),this.#l.set(F,N)),N}#Ie(F,N){const S=this.#Ve(N);return S&&B(S.getValue)?S.getValue(F):F?.[N]}#Ye(F){const N=this.#t.columns,S=N&&B(N.all)?N.all():[],C=[];for(const D of S){const G=B(D.getValue)?D.getValue(F):void 0;G!=null&&G!==""&&C.push(String(G))}return C.join(" ").toLowerCase()}#Ve(F){const N=this.#t.columns;return N&&B(N.get)?N.get(F):void 0}#_e(){const F=this.#K;if(this.#K=null,F&&B(F.return))try{F.return()}catch{}}#We(){return k({context:this.#be("context",null)})}#be(F,N){const S=this.#t.state;if(S&&B(S[F])){const C=S[F]();return C??N}return N}#ke(F,N){const S=this.#t.emit;B(S)&&S(F,N)}}}),Ue("packages/core/src/source/url.js",function(e,H){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return b}});const $=H("packages/core/src/internal/warn.js").warnOnce,q=H("packages/core/src/internal/predicates.js"),B=q.isObject,x=q.isFunction,Y=H("packages/core/src/internal/paths.js").getPath,W=H("packages/core/src/source/abort.js").isAbortError,K=500,E=new Set(["application/x-ndjson","application/ndjson","application/jsonlines","application/jsonl","application/x-jsonlines","text/x-ndjson"]),O=Symbol("lattice.url.skip");function b(g,k={}){const d=B(k)?k:{},p=x(d.fetch)?d.fetch:typeof globalThis<"u"&&x(globalThis.fetch)?globalThis.fetch:null,m=d.format==="json"||d.format==="ndjson"?d.format:void 0,v=typeof d.rowsPath=="string"&&d.rowsPath?d.rowsPath:void 0,y=x(d.map)?d.map:void 0,T=B(d.headers)?d.headers:void 0,A=Number.isFinite(d.batchSize)&&d.batchSize>0?Math.floor(d.batchSize):K,M=d.lenient===!0,_=Number.isFinite(d.poll)&&d.poll>0?Math.floor(d.poll):void 0,R=typeof g=="string"&&g.length>0;R||$("source.url.url","createUrlSource needs a URL string; the grid will stay empty.");async function*I(L={}){if(!R)return;if(!p)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const F=L&&L.signal;let N;try{N=await p(g,T?{signal:F,headers:T}:{signal:F})}catch(D){throw W(D)?D:new Error(`[lattice] createUrlSource: request to ${g} failed — ${D&&D.message||D}`)}if(!N||!N.ok){const D=N?N.status:"no response";throw new Error(`[lattice] createUrlSource: ${D} for ${g}`)}const S=u(g,m,N),C=N.body&&x(N.body.getReader)?N.body.getReader():null;try{if(!C){const X=await N.text();(S||r(X,g))==="ndjson"?yield*s(null,null,X,0,N,g,A,M):yield*c(X,g,v,y);return}const D=new TextDecoder("utf-8");if(S==="json"){yield*c(await t(C,D,""),g,v,y);return}if(S==="ndjson"){yield*s(C,D,"",0,N,g,A,M);return}const G=await n(C,D,g);G.format==="json"?yield*c(await t(C,D,G.seed),g,v,y):yield*s(C,D,G.seed,G.bytes,N,g,A,M)}finally{if(C&&x(C.cancel))try{await C.cancel()}catch{}}}const j={mode:"stream",open:I,autoStart:d.autoStart!==!1};return _!==void 0&&(j.poll=_),Number.isFinite(d.maxRows)&&(j.maxRows=d.maxRows),Number.isFinite(d.maxAge)&&(j.maxAge=d.maxAge),(typeof d.ageBy=="string"||x(d.ageBy))&&(j.ageBy=d.ageBy),Number.isFinite(d.coalesceMs)&&(j.coalesceMs=d.coalesceMs),Number.isFinite(d.promoteToMemoryBelow)&&(j.promoteToMemoryBelow=d.promoteToMemoryBelow),j}function u(g,k,d){if(k)return k;const p=h(g);if(p)return p;const m=d&&d.headers&&x(d.headers.get)?d.headers.get("content-type"):null;return l(m)}function h(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(E.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=o(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 n(g,k,d){let p="",m=0;for(;;){const{value:y,done:T}=await g.read();if(y&&(m+=y.byteLength,p+=k.decode(y,{stream:!0})),T){p+=k.decode();break}const A=p.replace(/^\s+/,"");if(A){if(A[0]==="[")return{format:"json",seed:p,bytes:m};if(A[0]!=="{"||p.indexOf(`
|
|
7
|
+
`||c==="\r"){t++;continue}if(c>="0"&&c<="9"){t=O(o,t,i);continue}if(c==="."&&o[t+1]>="0"&&o[t+1]<="9"){t=O(o,t,i);continue}if(c==='"'||c==="'"){t=b(o,t,i);continue}if(c==="["){const a=o.indexOf("]",t+1);if(a<0)throw new W("a [column reference] was opened and never closed",t);i.push({kind:q,value:o.slice(t+1,a).trim(),at:t}),t=a+1;continue}if(E(c)){t=u(o,t,i);continue}const s=o.slice(t,t+2);if(Y.includes(s)){i.push({kind:x,value:s==="!="?"<>":s,at:t}),t+=2;continue}if(U.includes(c)){i.push({kind:x,value:c,at:t}),t++;continue}throw new W(`unexpected character ${JSON.stringify(c)}`,t)}return i.push({kind:Z,value:null,at:o.length}),i}function E(o){return/[A-Za-z_À-]/.test(o)}function O(o,i,t){let c=i,s=!1;for(;c<o.length;){const a=o[c];if(a>="0"&&a<="9"){c++;continue}if(a==="."&&!s){s=!0,c++;continue}if((a==="e"||a==="E")&&/[0-9+-]/.test(o[c+1]||"")){for(c+=2;c<o.length&&o[c]>="0"&&o[c]<="9";)c++;break}break}return t.push({kind:ne,value:Number(o.slice(i,c)),at:i}),c}function b(o,i,t){const c=o[i];let s=i+1,a="";for(;s<o.length;){if(o[s]===c){if(o[s+1]===c){a+=c,s+=2;continue}return t.push({kind:$,value:a,at:i}),s+1}a+=o[s],s++}throw new W("a string was opened and never closed",i)}function u(o,i,t){let c=i;for(;c<o.length&&/[A-Za-z0-9_.À-]/.test(o[c]);)c++;const s=o.slice(i,c);let a=c;for(;a<o.length&&o[a]===" ";)a++;return t.push({kind:o[a]==="("?B:q,value:s,at:i}),c}const h={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function l(o){const i=String(o??"").replace(/^\s*=/,"");if(!i.trim())throw new W("the formula is empty");const t=K(i);let c=0;const s=()=>t[c],a=()=>t[c++],f=v=>{const y=s();if(y.kind!==x||y.value!==v)throw new W(`expected ${JSON.stringify(v)}`,y.at);c++},w=v=>{let y=g();for(;;){const T=s();if(T.kind!==x)break;const A=h[T.value];if(!A||A<v)break;c++;const M=w(T.value==="^"?A:A+1);y={kind:"bin",op:T.value,left:y,right:M}}return y},g=()=>{const v=s();return v.kind===x&&(v.value==="-"||v.value==="+")?(c++,{kind:"unary",op:v.value,arg:g()}):k()},k=()=>{let v=d();for(;s().kind===x&&s().value==="%";)c++,v={kind:"unary",op:"%",arg:v};return v},d=()=>{const v=a();if(v.kind===ne)return{kind:"num",value:v.value};if(v.kind===$)return{kind:"str",value:v.value};if(v.kind===q)return{kind:"ref",name:v.value};if(v.kind===B){f("(");const y=[];if(!(s().kind===x&&s().value===")"))for(;;){if(y.push(w(1)),s().kind===x&&s().value===","){c++;continue}break}return f(")"),{kind:"call",name:String(v.value).toUpperCase(),args:y}}if(v.kind===x&&v.value==="("){const y=w(1);return f(")"),y}throw v.kind===Z?new W("the formula ends unexpectedly",v.at):new W(`unexpected ${JSON.stringify(v.value)}`,v.at)},p=w(1),m=s();if(m.kind!==Z)throw new W(`unexpected ${JSON.stringify(m.value)}: is an operator missing?`,m.at);return p}function r(o){const i=new Set,t=c=>{if(!(!c||typeof c!="object")){if(c.kind==="ref"){i.add(String(c.name));return}if(c.kind==="bin"){t(c.left),t(c.right);return}if(c.kind==="unary"){t(c.arg);return}if(c.kind==="call")for(const s of c.args)t(s)}};return t(o),[...i]}function n(o){return typeof o=="string"&&/^\s*=/.test(o)&&o.trim()!=="="}}),Ue("packages/core/src/formula/evaluate.js",function(e,H){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return O}});const $=H("packages/core/src/formula/parse.js").FormulaError;function q(b){if(b==null||b==="")return 0;if(typeof b=="boolean")return b?1:0;if(b instanceof Date)return b.getTime();const u=typeof b=="number"?b:Number(String(b).replace(/[,\s]/g,""));if(!Number.isFinite(u))throw new $(`${JSON.stringify(b)} is not a number`);return u}function B(b){return b==null?"":String(b)}function x(b){if(typeof b=="boolean")return b;if(b==null||b==="")return!1;if(typeof b=="number")return b!==0;const u=String(b).trim().toLowerCase();return u==="false"||u==="no"||u==="0"?!1:u!==""}function Z(b){const u=[];for(const h of b){if(Array.isArray(h)){for(const l of h)l!=null&&l!==""&&u.push(q(l));continue}h==null||h===""||u.push(q(h))}return u}function Y(b,u){const h=10**u,l=b*h;return Math.sign(l)*Math.round(Math.abs(l)+Number.EPSILON*Math.abs(l))/h}function U(b,u){if(!b.length)return 0;const h=b.slice().sort((o,i)=>o-i),l=(h.length-1)*Math.min(1,Math.max(0,u)),r=Math.floor(l),n=Math.ceil(l);return r===n?h[r]:h[r]+(l-r)*(h[n]-h[r])}function W(b,u){let h=0,l=0,r=0;for(const o of b){h++;const i=o-l;l+=i/h,r+=i*(o-l)}const n=u?h-1:h;return n>0?Math.sqrt(r/n):0}const K={SUM:b=>Z(b).reduce((u,h)=>u+h,0),AVERAGE:b=>{const u=Z(b);return u.length?u.reduce((h,l)=>h+l,0)/u.length:0},MIN:b=>{const u=Z(b);return u.length?Math.min(...u):0},MAX:b=>{const u=Z(b);return u.length?Math.max(...u):0},COUNT:b=>Z(b).length,PRODUCT:b=>Z(b).reduce((u,h)=>u*h,1),ROUND:b=>Y(q(b[0]),b.length>1?q(b[1]):0),ROUNDDOWN:b=>{const u=10**(b.length>1?q(b[1]):0),h=q(b[0])*u;return(h<0?Math.ceil(h):Math.floor(h))/u},ROUNDUP:b=>{const u=10**(b.length>1?q(b[1]):0),h=q(b[0])*u;return(h<0?Math.floor(h):Math.ceil(h))/u},ABS:b=>Math.abs(q(b[0])),FLOOR:b=>Math.floor(q(b[0])),CEILING:b=>Math.ceil(q(b[0])),SQRT:b=>Math.sqrt(q(b[0])),POWER:b=>q(b[0])**q(b[1]),MOD:b=>{const u=q(b[1]);if(u===0)throw new $("MOD by zero");return(q(b[0])%u+u)%u},IF:b=>x(b[0])?b[1]:b.length>2?b[2]:!1,AND:b=>b.every(x),OR:b=>b.some(x),NOT:b=>!x(b[0]),COALESCE:b=>b.find(u=>u!=null&&u!=="")??null,CONCAT:b=>b.map(B).join(""),LEN:b=>B(b[0]).length,UPPER:b=>B(b[0]).toUpperCase(),LOWER:b=>B(b[0]).toLowerCase(),TRIM:b=>B(b[0]).trim(),LEFT:b=>B(b[0]).slice(0,b.length>1?q(b[1]):1),RIGHT:b=>{const u=b.length>1?q(b[1]):1;return u<=0?"":B(b[0]).slice(-u)},MEDIAN:b=>U(Z(b),.5),PERCENTILE:b=>{const u=q(b[b.length-1]);return U(Z(b.slice(0,-1)),u>1?u/100:u)},QUARTILE1:b=>U(Z(b),.25),QUARTILE3:b=>U(Z(b),.75),STDEV:b=>W(Z(b),!0),STDEVP:b=>W(Z(b),!1),VAR:b=>{const u=W(Z(b),!0);return u*u},VARP:b=>{const u=W(Z(b),!1);return u*u},COUNTDISTINCT:b=>{const u=new Set;for(const h of b){const l=Array.isArray(h)?h:[h];for(const r of l)r!=null&&r!==""&&u.add(r)}return u.size},IQR:b=>{const u=Z(b);return U(u,.75)-U(u,.25)}};K.AVG=K.AVERAGE,K.CEIL=K.CEILING,K.POW=K.POWER,K.STDEVS=K.STDEV,K.PERCENTILEINC=K.PERCENTILE;function E(b,u){const h=Number(b),l=Number(u);if(b!==null&&b!==""&&u!==null&&u!==""&&Number.isFinite(h)&&Number.isFinite(l))return h<l?-1:h>l?1:0;const n=B(b).toLowerCase(),o=B(u).toLowerCase();return n<o?-1:n>o?1:0}function O(b,u={}){const h=typeof u.lookup=="function"?u.lookup:null,l=u.functions?{...K,...u.functions}:K,r=n=>{switch(n.kind){case"num":return n.value;case"str":return n.value;case"ref":{if(!h)throw new $(`there is no column called ${JSON.stringify(n.name)} here`);const o=h(String(n.name));if(o===void 0)throw new $(`there is no column called ${JSON.stringify(n.name)}`);return o}case"unary":{if(n.op==="%")return q(r(n.arg))/100;const o=q(r(n.arg));return n.op==="-"?-o:o}case"bin":{const o=n.op;if(o==="=")return E(r(n.left),r(n.right))===0;if(o==="<>")return E(r(n.left),r(n.right))!==0;if(o==="<")return E(r(n.left),r(n.right))<0;if(o==="<=")return E(r(n.left),r(n.right))<=0;if(o===">")return E(r(n.left),r(n.right))>0;if(o===">=")return E(r(n.left),r(n.right))>=0;const i=q(r(n.left)),t=q(r(n.right));if(o==="+")return i+t;if(o==="-")return i-t;if(o==="*")return i*t;if(o==="^")return i**t;if(o==="/"){if(t===0)throw new $("division by zero");return i/t}throw new $(`unknown operator ${JSON.stringify(o)}`)}case"call":{const o=u.lazy&&u.lazy[n.name];if(typeof o=="function")return o(n.args,r,u);const i=l[n.name];if(typeof i!="function")throw new $(`there is no function called ${n.name}`);return i(n.args.map(r),u)}default:throw new $("the formula could not be read")}};return r(b)}}),Ue("packages/core/src/formula/index.js",function(e,H){"use strict";Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return E}});const ne=H("packages/core/src/formula/parse.js"),$=ne.parseFormula,q=ne.referencesOf,B=ne.looksLikeFormula,x=ne.FormulaError,Z=ne.tokenise,Y=H("packages/core/src/formula/evaluate.js"),U=Y.evaluateAst,W=Y.FUNCTIONS;function K(O){const{grid:b,row:u,data:h}=O||{},l=t=>String(t).toLowerCase().replace(/[\s_-]/g,""),r=b&&b.columns&&typeof b.columns.all=="function"?b.columns.all():[],n=b&&b.permissions,o=n&&typeof n.isReadable=="function"?t=>n.isReadable(t):()=>!0,i=new Set;for(const t of r)o(t)||(i.add(l(t.id)),t.field&&i.add(l(t.field)),t.title&&i.add(l(t.title)));return t=>{const c=l(t);if(i.has(c))throw new x(`"${t}" cannot be read`);for(const s of r)if(l(s.id)===c||s.field&&l(s.field)===c||s.title&&l(s.title)===c)return u&&b.rows&&typeof b.rows.value=="function"?b.rows.value(u.key,s.id):h?h[s.field||s.id]:void 0;if(h&&typeof h=="object"){for(const s of Object.keys(h))if(l(s)===c){if(!o(s))throw new x(`"${t}" cannot be read`);return h[s]}}}}function E(O,b={}){try{const u=$(O);return{ok:!0,value:U(u,{lookup:K(b),functions:b.formulaFunctions}),references:q(u)}}catch(u){return{ok:!1,error:u instanceof x?u.message:"the formula could not be read",at:u instanceof x?u.at:void 0}}}}),Ue("packages/core/src/internal/version.js",function(e,H){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return q}});const ne="1.98.2";async function $(){return ne}const q="1.98.2"}),Ue("packages/core/src/internal/merge.js",function(e,H){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"mergeRow",{enumerable:!0,get:function(){return Y}});const $=H("packages/core/src/internal/predicates.js").isObject;function q(U,W,K){if(U!==void 0)return U===!0?{enabled:!0,...K}:U===!1?{enabled:!1}:$(U)?U:{[W]:U,enabled:!0}}function B(U){return U==null?[]:Array.isArray(U)?U:[U]}const x=Object.freeze(new Set(["__proto__","constructor","prototype"]));function Z(U,W){if(!$(U))return $(W)?{...W}:W;if(!$(W))return W===void 0?U:W;const K={...U};for(const E of Object.keys(W)){if(x.has(E))continue;const O=W[E];O!==void 0&&(K[E]=$(O)&&$(K[E])?Z(K[E],O):O)}return K}function Y(U,W){if(!$(U)||!$(W)||U===W)return W;const K=Object.create(Object.getPrototypeOf(U));return Object.assign(K,U,W),K}}),Ue("packages/core/src/internal/schedule.js",function(e,H){"use strict";Object.defineProperty(e,"now",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"nextFrame",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return Y}});function ne(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const $=typeof requestAnimationFrame=="function";function q(U){return $?requestAnimationFrame(U):setTimeout(()=>U(ne()),16)}function B(U){U!=null&&($?cancelAnimationFrame(U):clearTimeout(U))}function x(U){let W=null,K=null;const E=()=>{W=null;const b=K;K=null,U(...b||[])},O=(...b)=>{K=b,W===null&&(W=q(E))};return O.cancel=()=>{B(W),W=null,K=null},O.flush=()=>{W!==null&&(B(W),E())},O}function Z(U,W){let K=null,E=null;const O=()=>{if(K=null,E===null)return;const h=E;E=null,U(...h),b()},b=()=>{K=setTimeout(O,W),typeof K?.unref=="function"&&K.unref()},u=(...h)=>{K===null?(U(...h),b()):(E=h,clearTimeout(K),b())};return u.flush=()=>{if(K!==null&&clearTimeout(K),K=null,E===null)return;const h=E;E=null,U(...h)},u.cancel=()=>{K!==null&&clearTimeout(K),K=null,E=null},u.pending=()=>K!==null||E!==null,u}function Y(U,W=50){return typeof requestIdleCallback=="function"?requestIdleCallback(U,{timeout:W}):setTimeout(()=>U({timeRemaining:()=>0,didTimeout:!0}),1)}}),Ue("packages/core/src/internal/paths.js",function(e,H){"use strict";Object.defineProperty(e,"pathGetter",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"pathSetter",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"getPath",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return Z}});const ne=new Map;function $(Y){let U=ne.get(Y);if(U)return U;if(!Y.includes("."))U=W=>W?.[Y];else{const W=Y.split("."),K=W.length;U=E=>{let O=E;for(let b=0;b<K;b++){if(O==null)return;O=O[W[b]]}return O}}return ne.set(Y,U),U}const q=new Map;function B(Y){let U=q.get(Y);if(U)return U;if(!Y.includes("."))U=(W,K)=>{W!=null&&(W[Y]=K)};else{const W=Y.split("."),K=W.length-1;U=(E,O)=>{let b=E;for(let u=0;u<K;u++){if(b==null)return;const h=W[u];b[h]==null&&(b[h]={}),b=b[h]}b!=null&&(b[W[K]]=O)}}return q.set(Y,U),U}function x(Y,U){return $(U)(Y)}function Z(Y,U,W){B(U)(Y,W)}}),Ue("packages/core/src/internal/compare.js",function(e,H){"use strict";Object.defineProperty(e,"collator",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"defaultCompare",{enumerable:!0,get:function(){return q}});const ne=new Map;function $(B,x){const Z=`${B||""}|${x?JSON.stringify(x):""}`;let Y=ne.get(Z);return Y||(Y=new Intl.Collator(B||void 0,{numeric:!0,sensitivity:"variant",...x}),ne.set(Z,Y)),Y}function q(B,x){if(B===x)return 0;if(B==null)return 1;if(x==null)return-1;if(typeof B=="number"&&typeof x=="number")return Number.isNaN(B)?Number.isNaN(x)?0:1:Number.isNaN(x)||B<x?-1:B>x?1:0;const Z=String(B),Y=String(x);return Z<Y?-1:Z>Y?1:0}}),Ue("packages/core/src/defaults.js",function(e,H){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return E}});const $=H("packages/core/src/internal/predicates.js").isObject,B=H("packages/core/src/internal/merge.js").merge,Z=H("packages/core/src/internal/warn.js").warnOnce;let Y=null;class U extends Error{}function W(O,b=new Set){if(Array.isArray(O)){if(b.has(O))throw new U;b.add(O);const h=O.map(l=>W(l,b));return b.delete(O),h}if(!$(O)||Object.getPrototypeOf(O)!==Object.prototype&&Object.getPrototypeOf(O)!==null)return O;if(b.has(O))throw new U;b.add(O);const u={};for(const[h,l]of Object.entries(O))u[h]=W(l,b);return b.delete(O),u}function K(O){if(O===void 0)return W(Y??{});if(O===null)return Y=null,{};if(!$(O))return Z("defaults:type",`defaults() expects a configuration object, or null to clear it, but got ${Array.isArray(O)?"an array":typeof O}. The call was ignored and the defaults are unchanged.`),W(Y??{});try{Y=W(O)}catch(b){if(!(b instanceof U))throw b;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."),W(Y??{})}return W(Y)}function E(O){return Y===null?O:B(W(Y),O)}}),Ue("packages/core/src/internal/uid.js",function(e,H){"use strict";Object.defineProperty(e,"uid",{enumerable:!0,get:function(){return $}});let ne=0;function $(q="l"){return`${q}${(++ne).toString(36)}`}}),Ue("packages/core/src/events/names.js",function(e,H){"use strict";Object.defineProperty(e,"EVENT_NAMES",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"isKnownEvent",{enumerable:!0,get:function(){return q}});const ne=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"]),$=new Set(ne);function q(B){return B==="*"||$.has(B)}}),Ue("packages/core/src/events/bus.js",function(e,H){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return h}});const ne=H("packages/core/src/internal/warn.js"),$=ne.warnOnce,q=ne.DEV,x=H("packages/core/src/internal/uid.js").uid,Y=H("packages/core/src/events/names.js").isKnownEvent,U="*";function W(l,r){!q||Y(r)||$(`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 K=new Set(["api","user","init","ai"]),E=new WeakMap;function O(l){let r=E.get(l);return r||(r=x("h"),E.set(l,r)),r}function b(){return typeof performance=="object"&&performance?performance.now():Date.now()}function u(l){if(!l||typeof l!="object")return{};const r={};for(const[n,o]of Object.entries(l))n!=="grid"&&(o==null?r[n]=String(o):Array.isArray(o)?r[n]=`[${o.length}]`:typeof o=="object"?r[n]=o.key?`row ${o.key}`:"{…}":typeof o=="function"?r[n]="[function]":r[n]=String(o).slice(0,60));return r}class h{#e=new Map;#t=!1;#n=[];#r=200;#i=new Map;#s=null;#o=!1;#l=0;constructor(r=null){this.#s=r}attach(r){this.#s=r}get grid(){return this.#s}get destroyed(){return this.#o}on(r,n){if(typeof n!="function")return $(`bus.handler:${r}`,`on('${r}') needs a function; ignored.`),()=>{};W("on",r);let o=this.#e.get(r);return o||(o=[],this.#e.set(r,o)),o.push(n),()=>this.off(r,n)}once(r,n){if(typeof n!="function")return $(`bus.handler:${r}`,`once('${r}') needs a function; ignored.`),()=>{};W("once",r);const o=i=>{this.off(r,n),n(i)};return this.#i.set(n,o),this.on(r,o)}off(r,n){if(n===void 0){this.#e.delete(r);return}const o=this.#e.get(r);if(!o)return;const i=this.#i.get(n),t=i&&o.includes(i)?i:n,c=o.indexOf(t);c>=0&&o.splice(c,1),i&&t===i&&this.#i.delete(n),o.length===0&&this.#e.delete(r)}count(r){const n=this.#e.get(r),o=r===U?null:this.#e.get(U);return(n?n.length:0)+(o?o.length:0)}#a(r,n,o,i,t){this.#n.push({type:r,origin:n,listeners:(i?i.length:0)+(t?t.length:0),payload:u(o),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(r,n){this.#t=!!r,Number.isFinite(n)&&n>0&&(this.#r=Math.floor(n)),r||(this.#n=[])}eventLog(){return this.#n.map(r=>({...r}))}clearEventLog(){this.#n=[]}counts(){const r={};for(const[n,o]of this.#e)r[n]=o.length;return r}emit(r,n,o){const i=o??(n&&n.origin),t=K.has(i)?i:"api",c={...n||null,type:r,origin:t,grid:this.#s};if(this.#o)return c;const s=this.#e.get(r),a=r===U?void 0:this.#e.get(U);if(this.#t&&this.#a(r,t,n,s,a),!s&&!a)return c;const f=this.#t?b():0;this.#l++;try{s&&this.#c(s.slice(),c,r),a&&this.#c(a.slice(),c,U)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=b()-f)}return c}emitBefore(r,n,o){const i=o??(n&&n.origin),t=K.has(i)?i:"user";let c=!1,s=null;const a=p=>{c=!0,p!=null&&s===null&&(s=String(p))},f={...n||null,type:r,origin:t,grid:this.#s,get defaultPrevented(){return c},get reason(){return s},preventDefault(p){a(p)}};if(this.#o)return!0;const w=this.#e.get(r);this.#t&&this.#a(r,t,n,w,void 0);const g=w?w.slice():[];if(g.length===0)return!0;const k=()=>(c&&s===null&&(s="prevented"),c&&n&&typeof n=="object"&&(n.reason=s),!c),d=[];for(const p of g)try{const m=p(f);m&&typeof m.then=="function"?d.push(m):m===!1&&a("prevented")}catch(m){a("error"),$(`bus.beforeThrow:${r}:${O(p)}`,`a '${r}' before-handler threw; the action was cancelled.`,m)}return d.length===0?k():Promise.allSettled(d).then(p=>{for(const m of p)m.status==="rejected"?(a("error"),$(`bus.beforeReject:${r}`,`a '${r}' before-handler rejected; the action was cancelled.`,m.reason)):m.value===!1&&a("prevented");return k()})}#c(r,n,o){for(let i=0;i<r.length;i++)try{r[i](n)}catch(t){$(`bus.throw:${o}:${O(r[i])}`,`a '${o}' handler threw; other handlers were unaffected.`,t)}}clear(){this.#e.clear(),this.#i.clear()}destroy(){this.clear(),this.#o=!0,this.#s=null}}}),Ue("packages/core/src/registry/free-tier-notice.js",function(e,H){"use strict";Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return ne}});const ne="Free for non-commercial use: latticegrid.dev/free"}),Ue("packages/core/src/registry/licence.js",function(e,H){"use strict";Object.defineProperty(e,"PRODUCT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"LICENCE_VERSION",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"fromBase64Url",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"toBase64Url",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"asciiBytes",{enumerable:!0,get:function(){return u}}),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 f}}),Object.defineProperty(e,"isLocalHost",{enumerable:!0,get:function(){return w}}),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 T}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return R}});const $=H("packages/core/src/internal/warn.js").warnOnce,q=H("packages/core/src/registry/free-tier-notice.js"),B=q.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return q.FREE_TIER_NOTICE}});const x="lattice-grid",Z=1,Y="LG1",U=64,W="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",K="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",E=(()=>{const I=new Int16Array(128).fill(-1);for(let j=0;j<K.length;j++)I[K.charCodeAt(j)]=j;return I[43]=62,I[47]=63,I})();function O(I){if(typeof I!="string")return null;let j="";for(let D=0;D<I.length;D++){const G=I.charCodeAt(D);if(G!==61){if(G>127||E[G]<0)return null;j+=I[D]}}const L=j.length;if(L%4===1)return null;const F=new Uint8Array(Math.floor(L*3/4));let N=0,S=0,C=0;for(let D=0;D<L;D++)N=N<<6|E[j.charCodeAt(D)],S+=6,S>=8&&(S-=8,F[C++]=N>>S&255);return C===F.length?F:F.subarray(0,C)}function b(I){let j="",L=0;for(;L+2<I.length;L+=3){const N=I[L]<<16|I[L+1]<<8|I[L+2];j+=K[N>>18&63]+K[N>>12&63]+K[N>>6&63]+K[N&63]}const F=I.length-L;if(F===1){const N=I[L]<<16;j+=K[N>>18&63]+K[N>>12&63]}else if(F===2){const N=I[L]<<16|I[L+1]<<8;j+=K[N>>18&63]+K[N>>12&63]+K[N>>6&63]}return j}function u(I){const j=new Uint8Array(I.length);for(let L=0;L<I.length;L++)j[L]=I.charCodeAt(L)&127;return j}function h(I){if(typeof TextDecoder=="function")return new TextDecoder().decode(I);let j="";for(let L=0;L<I.length;L++)j+=String.fromCharCode(I[L]);return j}function l(I){const j={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof I=="string"?I:""};if(typeof I!="string"||I.length===0)return{...j,reason:"missing"};const L=I.trim(),F=L.split(".");if(F.length!==3)return j;const[N,S,C]=F;if(N!==Y)return{...j,reason:"prefix"};const D=O(S),G=O(C);if(!D||!G)return j;let X;try{X=JSON.parse(h(D))}catch{return j}return X===null||typeof X!="object"?j:{ok:!0,reason:null,product:typeof X.p=="string"?X.p:null,issuedTo:typeof X.t=="string"?X.t:null,expires:typeof X.e=="string"?X.e:null,terms:typeof X.terms=="string"?X.terms:null,features:Array.isArray(X.f)?X.f.slice():[],deployments:Array.isArray(X.d)?X.d.slice():[],version:typeof X.v=="number"?X.v:0,message:u(S),signature:G,raw:L}}function r(I,j){if(!I)return!1;const L=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(I)?`${I}T23:59:59.999Z`:I);return Number.isNaN(L)?!0:j>L}function n(I){return I==="non-commercial"?"non-commercial":"commercial"}let o=null,i=null,t=null;function c(){const I=globalThis.crypto;return I&&I.subtle?I.subtle:null}async function s(I){if(o&&i===I)return o;const j=c();if(!j)return null;const L=O(I);if(!L)return null;try{const F=await j.importKey("raw",L,{name:"Ed25519"},!1,["verify"]);return o=F,i=I,F}catch{return null}}async function a(){return t!==null||(t=await s(W)!==null),t}async function f(I,j={}){const L=j.warn!==!1,F=j.product||x,N=j.publicKey||W,S=j.now??Date.now(),C=j.host??g(),D=w(C)?"":` ${B}`,G=l(I);if(!G.ok){const te=G.reason==="missing"?"missing":"malformed";return L&&$(`licence.${te}`,te==="missing"?`no licence key supplied. The grid renders in full and carries a trial watermark on any host other than localhost. Get a key at latticegrid.dev.${D}`:`licence key could not be read. The grid will render with a watermark.${D}`),{valid:!1,reason:te,terms:"commercial"}}const X={product:G.product||void 0,issuedTo:G.issuedTo||void 0,expires:G.expires||void 0,terms:n(G.terms)};if(G.product!==F)return L&&$("licence.product",`licence key is for '${G.product}', not '${F}'. The grid will render with a watermark.`),{valid:!1,...X,reason:"product"};if(r(G.expires,S))return L&&$("licence.expired",`licence expired on ${G.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,...X,reason:"expired"};const V=G.deployments||[];if(V.length&&C&&!w(C)&&!k(C,V))return L&&$("licence.domain",`licence key is not valid for ${C}; it covers ${V.join(", ")}. The grid will render with a watermark.`),{valid:!1,...X,reason:"domain"};const J=await s(N);if(!J){const te=!!G.signature&&G.signature.length===U;return L&&$("licence.algorithm","this host does not provide crypto.subtle Ed25519, so the licence signature could not be verified. A structural check was used instead."),te?{valid:!0,...X,reason:"unverified"}:{valid:!1,...X,reason:"signature"}}let ee=!1;try{ee=await c().verify({name:"Ed25519"},J,G.signature,G.message)}catch{ee=!1}return ee?{valid:!0,...X}:(L&&$("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...X,reason:"signature"})}function w(I){const j=String(I??g()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!j||j==="localhost"||j.endsWith(".localhost")||j==="::1"||j==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(j)}function g(){const I=globalThis.location;return I&&typeof I.hostname=="string"?I.hostname:null}function k(I,j){const L=d(I);return!L||!Array.isArray(j)?!1:j.some(F=>{const N=d(F);if(!N)return!1;if(N==="*")return!0;if(N.startsWith("*.")){const S=N.slice(2);return L===S||L.endsWith(`.${S}`)}return L===N})}function d(I){return String(I??"").trim().toLowerCase().replace(/\.$/,"")}class p{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#i;#s=new Set;constructor(j={}){this.#i=j}set(j){this.#e=typeof j=="string"?j.trim():"";const L=l(this.#e);return this.#t=L.ok?{valid:!r(L.expires,Date.now())&&L.product===(this.#i.product||x),product:L.product||void 0,issuedTo:L.issuedTo||void 0,expires:L.expires||void 0,terms:n(L.terms),reason:"pending"}:{valid:!1,reason:L.reason||"malformed",terms:"commercial"},this.#n=null,this.#e&&this.verify(),this.#t}verify(){if(this.#n)return this.#n;const j=this.#e;return this.#n=f(j,this.#i).then(L=>{if(this.#e===j){this.#t=L;for(const F of this.#s)F(L)}return L}),this.#n}onSettled(j){return this.#s.add(j),()=>this.#s.delete(j)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!w(this.#r)}setHost(j){this.#r=j}state(){return this.#t.valid?"licensed":w(this.#r)?"localhost":"trial"}reset(){this.#e="",this.#t={valid:!1,reason:"missing",terms:"commercial"},this.#n=null,this.#s.clear()}}const m=Symbol.for("lattice-grid/licence/holder");function v(){const I=globalThis,j=I&&I[m];if(j&&typeof j.set=="function"&&typeof j.watermark=="function")return j;const L=new p;if(I)try{I[m]=L}catch{}return L}const y=v();function T(I){return y.set(I)}function A(){return y.info()}function M(){return y.watermark()}function _(){return y.state()}function R(){return y}}),Ue("packages/core/src/registry/registry.js",function(e,H){"use strict";Object.defineProperty(e,"KINDS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"REGIONS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return o}});const ne=H("packages/core/src/internal/warn.js"),$=ne.warnOnce,q=ne.DEV,x=H("packages/core/src/internal/predicates.js").isFunction,Z=H("packages/core/src/registry/licence.js"),Y=Z.LicenceHolder,U=Z.sharedLicence,W=["renderer","editor","filter","dataType","totalFn","pipe","component"],K=["all","header","body","totals","panels"];class E{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#i;#s=null;#o=null;#l=new Set;#a=new Map;constructor(t={}){for(const c of W)this.#t.set(c,new Map);this.#i=t.holder||U(),this.#o=t.grid??null,this.#s=this.#i.onSettled(()=>{this.#f({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),t.licence&&this.setLicence(t.licence)}registerModules(t,c={}){c.licence&&this.setLicence(c.licence),c.grid!==void 0&&(this.#o=c.grid);const s=Array.isArray(t)?t:[t],a=[];for(const f of s){if(!f||typeof f!="object"||typeof f.name!="string"||!f.name){$("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(f.name)){q&&this.#u(this.#e.get(f.name),f);continue}if(!x(f.install)){$(`registry.module.install:${f.name}`,`module '${f.name}' has no install() and was ignored.`);continue}const w={registry:this,grid:this.#o};try{f.install(w)}catch(g){$(`registry.module.throw:${f.name}`,`module '${f.name}' threw during install; it was not registered.`,g);continue}this.#e.set(f.name,f);for(const g of O(f))this.#n.add(g);a.push(f.name),this.#f({reason:"module",name:f.name,capabilities:this.capabilities(),regions:h(f)})}return a}unregisterModule(t){const c=this.#e.get(t);if(!c)return!1;if(x(c.uninstall))try{c.uninstall({registry:this,grid:this.#o})}catch(s){$(`registry.module.uninstall:${t}`,`module '${t}' threw during uninstall.`,s)}return this.#e.delete(t),this.#c(),this.#f({reason:"unmodule",name:t,capabilities:this.capabilities(),regions:h(c)}),!0}modules(){return[...this.#e.values()]}has(t){return this.#e.has(t)}#c(){this.#n.clear();for(const t of this.#e.values())for(const c of O(t))this.#n.add(c)}#u(t,c){!t||t===c||b(t,c)||$(`registry.module.reconfigure:${c.name}`,`module '${c.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(t){return this.#n.has(t)}onChange(t){return x(t)?(this.#r.add(t),this.#a.set(t,this.#o),()=>{this.#r.delete(t),this.#a.delete(t)}):()=>{}}#f(t){for(const c of[...this.#r])try{c(t)}catch(s){$("registry.onChange.throw","a registry change handler threw.",s)}}register(t,c,s){const a=this.#t.get(t);if(!a){$(`registry.kind:${t}`,`unknown registry kind '${t}'; expected one of ${W.join(", ")}.`);return}if(!c||typeof c!="string"){$(`registry.name:${t}`,`register('${t}', ...) needs a name.`);return}a.has(c)&&a.get(c)!==s&&$(`registry.replace:${t}:${c}`,`'${c}' was already registered as a ${t} and has been replaced.`),a.set(c,s),this.#f({reason:"register",name:c,kind:t,capabilities:this.capabilities(),regions:l(t)})}registerAll(t,c){if(c)for(const s of Object.keys(c))this.register(t,s,c[s])}get(t,c){const s=this.#t.get(t);return s?s.get(c):void 0}names(t){const c=this.#t.get(t);return c?[...c.keys()]:[]}#d(t,c){const s=this.#t.get(t).get(c);return s!==void 0?s:this.#t.get("component").get(c)}renderer(t){return this.#d("renderer",t)}editor(t){return this.#d("editor",t)}filter(t){return this.#d("filter",t)}dataType(t){return this.get("dataType",t)}totalFn(t){return this.get("totalFn",t)}pipe(t){return this.get("pipe",t)}setLicence(t){return this.#i.set(t)}licence(){return this.#i.info()}licenceVerified(){return this.#i.verify()}watermark(){return this.#i.watermark()}attach(t){t!=null&&(this.#l.add(t),this.#o=t)}detach(t){if(t!=null){this.#l.delete(t);for(const[c,s]of[...this.#a])s===t&&(this.#r.delete(c),this.#a.delete(c));if(this.#o===t){const c=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#o=c}this.#l.size===0&&this.#s&&(this.#s(),this.#s=null)}}destroy(t){if(t!=null){this.detach(t);return}for(const c of[...this.#e.keys()])this.unregisterModule(c);this.#r.clear(),this.#a.clear(),this.#l.clear(),this.#s&&this.#s(),this.#s=null,this.#o=null}}function O(i){const t=i.capabilities,c=Array.isArray(t)?t.filter(s=>typeof s=="string"):[];return[i.name,...c]}function b(i,t){return i.install!==t.install||i.uninstall!==t.uninstall||(i.version||"")!==(t.version||"")?!1:u(O(i),O(t))&&u(h(i),h(t))}function u(i,t){const c=new Set(i),s=new Set(t);if(c.size!==s.size)return!1;for(const a of c)if(!s.has(a))return!1;return!0}function h(i){const t=i.regions;return!Array.isArray(t)||t.length===0?["all"]:t.filter(c=>K.includes(c))}function l(i){switch(i){case"filter":return["header"];case"totalFn":return["totals"];case"renderer":case"editor":case"pipe":return["body"];default:return["all"]}}const r=new E;function n(){return r}function o(i,t={}){return r.registerModules(i,t)}}),Ue("packages/core/src/internal/text.js",function(e,H){"use strict";Object.defineProperty(e,"humanise",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"escapeHtml",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return B}});function ne(x){return x?(x.includes(".")?x.slice(x.lastIndexOf(".")+1):x).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,Y=>Y.toUpperCase()):""}const $={"&":"&","<":"<",">":">",'"':""","'":"'"};function q(x){const Z=x==null?"":String(x);return/[&<>"']/.test(Z)?Z.replace(/[&<>"']/g,Y=>$[Y]):Z}function B(x){return String(x).replace(/\w\S*/g,Z=>Z[0].toUpperCase()+Z.slice(1).toLowerCase())}}),Ue("packages/core/src/format/number.js",function(e,H){"use strict";Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return q}});const $=H("packages/core/src/internal/predicates.js").isNil;function q(B,x){const Z=B||{},Y=Z.locale||x||void 0,U=Z.style||"decimal",W=typeof Z.scale=="number"?Z.scale:1,K=Z.nullDisplay??"",E=Z.zeroDisplay,O=Z.prefix||"",b=Z.suffix||"",u=Z.negative||"minus",h=Z.signed===!0,l={style:U,notation:Z.notation||"standard"};U==="currency"&&(l.currency=Z.currency||"USD",Z.currencyDisplay&&(l.currencyDisplay=Z.currencyDisplay)),typeof Z.decimals=="number"?(l.minimumFractionDigits=Z.decimals,l.maximumFractionDigits=Z.decimals):(typeof Z.minDecimals=="number"&&(l.minimumFractionDigits=Z.minDecimals),typeof Z.maxDecimals=="number"&&(l.maximumFractionDigits=Z.maxDecimals),l.minimumFractionDigits>(l.maximumFractionDigits??20)&&(l.maximumFractionDigits=l.minimumFractionDigits)),Z.thousandsSeparator===!1&&(l.useGrouping=!1),l.notation==="compact"&&(l.compactDisplay=Z.compactDisplay||"short");const r=new Intl.NumberFormat(Y,l),n=typeof Z.thousandsSeparator=="string"?Z.thousandsSeparator:null,o=typeof Z.decimalSeparator=="string"?Z.decimalSeparator:null;let i=",",t=".";if(n||o)for(const g of r.formatToParts(12345.6))g.type==="group"?i=g.value:g.type==="decimal"&&(t=g.value);const c=g=>{let k=g;return n&&(k=k.split(i).join("")),o&&(k=k.split(t).join("")),n&&(k=k.split("").join(n)),o&&(k=k.split("").join(o)),k},s=!!(n||o),a=O!==""&&U==="currency",f=g=>{let k;if(a){const d=r.formatToParts(g);let p=!1;k="";for(const m of d)k+=m.value,!p&&m.type==="currency"&&(k+=O,p=!0);p||(k=O+k)}else k=O+r.format(g);return s&&(k=c(k)),k+b},w=g=>{if($(g)||g==="")return K;const k=typeof g=="number"?g:Number(g);if(Number.isNaN(k))return K;const d=W===1?k:k*W;return d===0&&E!==void 0?E:d<0?u==="parentheses"?`(${f(-d)})`:u==="suffix"?`${f(-d)}-`:f(d):h&&d>0?`+${f(d)}`:f(d)};return w.negativeClass=Z.negativeClass||null,w.spec=Z,w}}),Ue("packages/core/src/format/date.js",function(e,H){"use strict";Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return n}});const $=H("packages/core/src/internal/predicates.js").isNil,B=H("packages/core/src/internal/warn.js").warnOnce,x=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function Z(o){const i=[];let t=0,c="";const s=()=>{c&&(i.push({token:null,text:c}),c="")};for(;t<o.length;){const a=o[t];if(a==="'"){if(o[t+1]==="'"){c+="'",t+=2;continue}const w=o.indexOf("'",t+1);if(w===-1){c+=o.slice(t+1),t=o.length;continue}c+=o.slice(t+1,w),t=w+1;continue}const f=x.find(w=>o.startsWith(w,t));if(f){s(),i.push({token:f,text:f}),t+=f.length;continue}/[A-Za-z]/.test(a)&&B(`date.pattern.token:${a}`,`the date pattern "${o}" contains '${a}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${x.join(" ")}.`),c+=a,t+=1}return s(),i}const Y=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function U(o){if($(o)||o==="")return null;if(o instanceof Date)return Number.isNaN(o.getTime())?null:o;if(typeof o=="number")return Number.isNaN(o)?null:new Date(o);if(typeof o=="string"){const i=Y.exec(o.trim());if(i){const[,c,s,a,f="0",w="0",g="0"]=i;return new Date(+c,+s-1,+a,+f,+w,+g)}const t=new Date(o);return Number.isNaN(t.getTime())?null:t}return null}function W(o,i){return String(o).padStart(i,"0")}function K(o){if(!o)return c=>({year:c.getFullYear(),month:c.getMonth()+1,day:c.getDate(),hour:c.getHours(),minute:c.getMinutes(),second:c.getSeconds(),ms:c.getMilliseconds(),weekday:c.getDay()});const i=new Intl.DateTimeFormat("en-US",{timeZone:o,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"short"}),t={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return c=>{const s={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:c.getMilliseconds(),weekday:0};for(const a of i.formatToParts(c))switch(a.type){case"year":s.year=Number(a.value);break;case"month":s.month=Number(a.value);break;case"day":s.day=Number(a.value);break;case"hour":s.hour=Number(a.value)%24;break;case"minute":s.minute=Number(a.value);break;case"second":s.second=Number(a.value);break;case"weekday":s.weekday=t[a.value]??0;break;default:break}return s}}function E(o,i,t){const c=Z(o),s=K(t),a=new Set(c.filter(d=>d.token).map(d=>d.token)),f=a.has("MMM")?new Intl.DateTimeFormat(i,{month:"short",timeZone:t}):null,w=a.has("MMMM")?new Intl.DateTimeFormat(i,{month:"long",timeZone:t}):null,g=a.has("EEE")?new Intl.DateTimeFormat(i,{weekday:"short",timeZone:t}):null,k=a.has("EEEE")?new Intl.DateTimeFormat(i,{weekday:"long",timeZone:t}):null;return d=>{const p=s(d);let m="";for(const v of c){if(!v.token){m+=v.text;continue}switch(v.token){case"yyyy":m+=W(p.year,4);break;case"yy":m+=W(p.year%100,2);break;case"MMMM":m+=w.format(d);break;case"MMM":m+=f.format(d);break;case"MM":m+=W(p.month,2);break;case"M":m+=String(p.month);break;case"dd":m+=W(p.day,2);break;case"d":m+=String(p.day);break;case"EEEE":m+=k.format(d);break;case"EEE":m+=g.format(d);break;case"HH":m+=W(p.hour,2);break;case"H":m+=String(p.hour);break;case"hh":m+=W(p.hour%12===0?12:p.hour%12,2);break;case"h":m+=String(p.hour%12===0?12:p.hour%12);break;case"mm":m+=W(p.minute,2);break;case"m":m+=String(p.minute);break;case"ss":m+=W(p.second,2);break;case"s":m+=String(p.second);break;case"SSS":m+=W(p.ms,3);break;case"a":m+=p.hour<12?"AM":"PM";break;default:m+=v.text;break}}return m}}const O=[["year",365*24*36e5],["month",720*36e5],["week",168*36e5],["day",24*36e5],["hour",36e5],["minute",6e4],["second",1e3]];function b(o,i){const t=o||{},c=t.locale||i||void 0,s=t.nullDisplay??"",a=t.timeZone;let f;if(t.pattern)f=E(t.pattern,c,a);else if(t.dateStyle||t.timeStyle){const p={timeZone:a};t.dateStyle&&(p.dateStyle=t.dateStyle),t.timeStyle&&(p.timeStyle=t.timeStyle);const m=new Intl.DateTimeFormat(c,p);f=v=>m.format(v)}else{const p=new Intl.DateTimeFormat(c,{dateStyle:"medium",timeZone:a});f=m=>p.format(m)}const w=t.relative?new Intl.RelativeTimeFormat(c,{numeric:"auto"}):null,k=(typeof t.relative=="object"&&t.relative?t.relative.threshold??7:7)*24*36e5,d=(p,m)=>{const v=U(p);if(!v)return s;if(w){const y=m&&typeof m.now=="number"?m.now:Date.now(),T=v.getTime()-y;if(Math.abs(T)<k){for(const[A,M]of O)if(Math.abs(T)>=M||A==="second")return w.format(Math.round(T/M),A)}}return f(v)};return d.spec=t,d}function u(o){if($(o)||o==="")return null;if(typeof o=="string"){const c=/^(\d{4}-\d{2}-\d{2})/.exec(o.trim());if(c)return c[1];const s=U(o);return s?u(s):null}const i=U(o);if(!i)return null;const t=c=>String(c).padStart(2,"0");return`${i.getFullYear()}-${t(i.getMonth()+1)}-${t(i.getDate())}`}function h(o,i){if($(o)||o==="")return null;if(typeof o=="string"){const c=o.trim();if(l.test(c)){const f=U(c);return f?r(f,i):null}const s=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(c);if(s){const[,f,w,g,k]=s;return`${f}T${w}:${g}${k&&k!=="00"?`:${k}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(c))return`${c}T00:00`;const a=U(c);return a?h(a):null}const t=U(o);return t?r(t,i):null}const l=/(?:Z|[+-]\d{2}:?\d{2})$/i;function r(o,i){const t=f=>String(f).padStart(2,"0");if(i)try{const f=new Intl.DateTimeFormat("en-CA",{timeZone:i,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(o).reduce((k,d)=>(d.type!=="literal"&&(k[d.type]=d.value),k),{}),w=f.hour==="24"?"00":f.hour,g=Number(f.second);return`${f.year}-${f.month}-${f.day}T${w}:${f.minute}`+(g?`:${f.second}`:"")}catch{}const c=`${o.getFullYear()}-${t(o.getMonth()+1)}-${t(o.getDate())}`,s=o.getSeconds(),a=`${t(o.getHours())}:${t(o.getMinutes())}${s?`:${t(s)}`:""}`;return`${c}T${a}`}function n(o,i){const t=$(o)||o===""?null:String(o),c=$(i)||i===""?null:String(i);return t===null?c===null?0:1:c===null||t<c?-1:t>c?1:0}}),Ue("packages/core/src/format/boolean.js",function(e,H){"use strict";Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return Z}});const $=H("packages/core/src/internal/predicates.js").isNil,q={true:"☑",false:"☐",null:""},B={true:"◉",false:"◯",null:""};function x(Y){if($(Y)||Y==="")return null;if(typeof Y=="boolean")return Y;if(typeof Y=="number")return Y!==0;const U=String(Y).trim().toLowerCase();return U==="true"||U==="yes"||U==="y"||U==="1"?!0:U==="false"||U==="no"||U==="n"||U==="0"?!1:null}function Z(Y,U){const W=Y||{},K=W.display||"text",E=W.trueLabel??"Yes",O=W.falseLabel??"No",b=W.nullLabel??"";let u=E,h=O;const l=b;K==="checkbox"?(u=q.true,h=q.false):K==="switch"?(u=B.true,h=B.false):K==="icon"&&(u=W.trueIcon??E,h=W.falseIcon??O);const r=n=>{const o=x(n);return o===null?l:o?u:h};return r.display=K,r.labels={true:E,false:O,null:b},r.locale=U,r.spec=W,r}}),Ue("packages/core/src/format/text.js",function(e,H){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return x}});const $=H("packages/core/src/internal/predicates.js").isNil,B=H("packages/core/src/internal/text.js").titleCase;function x(Z,Y){const U=Z||{},W=U.locale||Y||void 0,K=U.nullDisplay??"",E=U.emptyDisplay??"",O=U.transform||"none",b=typeof U.truncate=="number"?{chars:U.truncate}:U.truncate||null,u=b?b.chars:0,h=b?b.ellipsis??"…":"",l=n=>{switch(O){case"upper":return W?n.toLocaleUpperCase(W):n.toUpperCase();case"lower":return W?n.toLocaleLowerCase(W):n.toLowerCase();case"title":return B(n);default:return n}},r=n=>{if($(n))return K;let o=typeof n=="string"?n:String(n);return o===""?E:(O!=="none"&&(o=l(o)),u>0&&o.length>u&&(o=o.slice(0,u)+h),o)};return r.spec=U,r}}),Ue("packages/core/src/format/mask.js",function(e,H){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return Z}});const ne=new Set(["0","#","?",",","."]),$="\0";function q(U){const W=[];let K="",E=!1;for(let O=0;O<U.length;O++){const b=U[O];if(b==="\\"){K+=b+(U[O+1]??""),O+=1;continue}if(b==='"'){E=!E,K+=b;continue}if(b===";"&&!E){W.push(K),K="";continue}K+=b}return W.push(K),W}function B(U){let W="",K="",E="",O=1,b=!1,u=!1;const h=a=>{u?K+=a:W+=a};for(let a=0;a<U.length;a++){const f=U[a];if(f==="\\"){h(U[a+1]??""),a+=1;continue}if(f==='"'){const w=U.indexOf('"',a+1);h(w===-1?U.slice(a+1):U.slice(a+1,w)),a=w===-1?U.length:w;continue}if(f==="%"){O*=100,h("%");continue}if(f==="@"){b=!0,h("\0");continue}if(ne.has(f)){E+=f,u=!0;continue}h(f)}let l=-1;for(let a=E.length-1;a>=0;a--){const f=E[a];if(f==="0"||f==="#"||f==="?"){l=a;break}}let r=!1,n="";for(let a=0;a<E.length;a++){const f=E[a];if(f===","){a>l?O/=1e3:r=!0;continue}n+=f}const o=n.indexOf("."),i=o===-1?n:n.slice(0,o),t=o===-1?"":n.slice(o+1);let c=0;for(const a of i)a==="0"&&(c+=1);let s=0;for(const a of t)a==="0"&&(s+=1);return{prefix:W,suffix:K,minInt:c,minDec:s,maxDec:t.length,grouping:r,scale:O,hasNumber:l!==-1,isText:b}}function x(U,W){const K=new Intl.NumberFormat(W,{minimumIntegerDigits:Math.max(U.minInt,1),minimumFractionDigits:U.minDec,maximumFractionDigits:Math.max(U.maxDec,U.minDec),useGrouping:U.grouping}),{prefix:E,suffix:O,scale:b,hasNumber:u}=U;return h=>{if(!u)return E+O;const l=b===1?h:h*b;return E+K.format(l)+O}}function Z(U,W){const E=q(String(U)).map(B),O=E.map(n=>x(n,W)),b=0,u=E.length>1?1:-1,h=E.length>2?2:-1,l=E.length>3?3:-1,r=n=>{if(n==null||n==="")return"";if(typeof n!="number"||Number.isNaN(n)){const o=Number(n);if(Number.isNaN(o))return l===-1?String(n):(E[l].prefix+E[l].suffix).split("\0").join(String(n));n=o}return n===0&&h!==-1?O[h](0):n<0&&u!==-1?O[u](-n):O[b](n)};return r.spec={mask:U},{format:r,ooxml:Y(String(U))}}function Y(U){return U.trim()}}),Ue("packages/core/src/format/shorthand.js",function(e,H){"use strict";Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return Y}});const ne=["currency","number","percent","date","boolean","text","relative"],$=/[#0?@;"\\]/,q=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function B(U){return typeof U!="string"||U===""||Z(U)?!1:$.test(U)}function x(U){return typeof U!="string"||U===""||Z(U)?!1:q.test(U)}function Z(U){const W=U.indexOf(":"),K=W===-1?U:U.slice(0,W);return ne.includes(K)?K:null}function Y(U){const W=Z(U);if(!W)return null;const K=U.indexOf(":"),E=K===-1?"":U.slice(K+1),O=E===""?[]:E.split(":");switch(W){case"currency":{const b={type:"number",style:"currency",currency:O[0]||"USD"};return O[1]!==void 0&&O[1]!==""&&(b.decimals=Number(O[1])),b}case"number":{const b={type:"number",style:"decimal"};return O[0]!==void 0&&O[0]!==""&&(b.decimals=Number(O[0])),b}case"percent":{const b={type:"number",style:"percent"};return O[0]!==void 0&&O[0]!==""&&(b.decimals=Number(O[0])),b}case"date":return{type:"date",pattern:E||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const b=E.split("/"),u={type:"boolean",display:"text"};return b[0]!==void 0&&b[0]!==""&&(u.trueLabel=b[0]),b[1]!==void 0&&b[1]!==""&&(u.falseLabel=b[1]),b[2]!==void 0&&(u.nullLabel=b[2]),u}case"text":{const b={type:"text"};return O[0]&&(b.transform=O[0]),O[1]!==void 0&&O[1]!==""&&(b.truncate=Number(O[1])),b}default:return null}}}),Ue("packages/core/src/format/index.js",function(e,H){"use strict";Object.defineProperty(e,"compileFormat",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"specToOoxml",{enumerable:!0,get:function(){return m}});const ne=H("packages/core/src/internal/predicates.js"),$=ne.isFunction,q=ne.isObject,x=H("packages/core/src/internal/warn.js").warnOnce,Z=H("packages/core/src/format/number.js"),Y=Z.compileNumber,U=H("packages/core/src/format/date.js"),W=U.compileDate,K=U.scanPattern,E=H("packages/core/src/format/boolean.js"),O=E.compileBoolean,b=H("packages/core/src/format/text.js"),u=b.compileText,h=H("packages/core/src/format/mask.js"),l=h.compileMask,r=H("packages/core/src/format/shorthand.js"),n=r.parseShorthand,o=r.looksLikeMask,i=r.looksLikeDatePattern;Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return Z.compileNumber}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return U.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return U.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return U.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return U.toDate}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return E.compileBoolean}}),Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return E.toTriState}}),Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return b.compileText}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return h.compileMask}}),Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return h.splitSections}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return h.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 t=new Set(["decimal","currency","percent","unit"]),c=new Set(["type","locale"]),s={number:new Set(["style","currency","currencyDisplay","decimals","minDecimals","maxDecimals","thousandsSeparator","decimalSeparator","notation","compactDisplay","negative","negativeClass","signed","prefix","suffix","zeroDisplay","nullDisplay","messages","scale"]),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"])},a=new Set(["number","date","boolean","text"]);function f(A,M){const _=A.type;if(_===void 0||a.has(_)||!t.has(String(_)))return;const R=M?`"${M}"`:"with no id";x(`format:unknown-style-key:${M||""}:${_}`,`column ${R} has format: { type: "${_}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${_}" instead?`)}function w(A,M,_){const R=s[M],I=_?`"${_}"`:"with no id";for(const j of A){if(c.has(j)||R.has(j))continue;const L=Object.keys(s).find(F=>F!==M&&s[F].has(j));L?x(`format:inapplicable:${_||""}:${j}`,`column ${I} has format key "${j}", which applies to a ${L} column, not the ${M} column it was applied to; it is ignored.`):x(`format:unknown:${_||""}:${j}`,`column ${I} has an unrecognised format key "${j}" for its ${M} format; it is ignored.`)}}function g(A){if(A.type==="number"||A.type==="date"||A.type==="boolean"||A.type==="text")return!0;const M=t.has(String(A.style));return!!(A.pattern||A.dateStyle||A.timeStyle||A.relative||A.timeZone||A.trueLabel||A.falseLabel||A.display||A.trueIcon||A.falseIcon||A.transform||A.truncate||A.emptyDisplay||M||A.currency||A.decimals!==void 0||A.minDecimals!==void 0||A.maxDecimals!==void 0||A.notation||A.negative||A.scale!==void 0||A.prefix||A.suffix||A.zeroDisplay!==void 0)}function k(A,M){if(A.type==="number"||A.type==="date"||A.type==="boolean"||A.type==="text")return A.type;if(A.pattern||A.dateStyle||A.timeStyle||A.relative||A.timeZone)return"date";if(A.trueLabel||A.falseLabel||A.display||A.trueIcon||A.falseIcon)return"boolean";if(A.transform||A.truncate||A.emptyDisplay)return"text";if(A.style||A.currency||A.decimals!==void 0||A.minDecimals!==void 0||A.maxDecimals!==void 0||A.notation||A.negative||A.scale!==void 0||A.prefix||A.suffix||A.zeroDisplay!==void 0)return"number";const _=M&&M.base;return _==="number"?"number":_==="date"||_==="dateString"?"date":_==="boolean"?"boolean":"text"}function d(A,M=null,_=void 0,R=void 0,I=void 0){if(A==null||A==="")return null;const j=q(A)?Object.keys(A):null;if(typeof A=="function"){const N=(S,C)=>String(A({...C||{},value:S,locale:_})??"");return N.ooxml=M&&M.excel||"General",N}if(typeof A=="string"){if(o(A)){const{format:S,ooxml:C}=l(A,_);return S.ooxml=C,S}const N=n(A)||(i(A)?{type:"date",pattern:A}:null);return N?d(N,M,_,R,I):(x(`format:${A}`,`unrecognised format string "${A}"; the value will be stringified`),null)}if(!q(A))return x("format:shape","format must be a spec object or a string; ignoring",A),null;if(M&&$(M.format)&&!g(A)||M&&$(M.format)&&Array.isArray(M.formatPatterns)&&A.type===void 0)return null;const L=k(A,M);L==="date"&&R&&A.timeZone===void 0&&(A={...A,timeZone:R}),f(A,I),w(j||Object.keys(A),L,I);let F;switch(L){case"number":F=Y(A,_);break;case"date":F=W(A,_);break;case"boolean":F=O(A,_);break;default:F=u(A,_);break}return F.ooxml=m(A,L,_,M),F.kind=L,F}const p={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 m(A,M,_=void 0,R=null){if(M==="date"){if(A.pattern){let N="";for(const S of K(A.pattern))N+=S.token?p[S.token]??S.text:S.text;return N}return R&&R.excel||"yyyy-mm-dd"}if(M==="boolean")return"General";if(M==="text")return"@";if(A.notation==="compact"||A.notation==="scientific")return"General";const I=typeof A.decimals=="number"?A.decimals:typeof A.minDecimals=="number"?A.minDecimals:A.style==="currency"?2:0;let L=`${A.thousandsSeparator===!1?"":"#,#"}#0${I>0?`.${"0".repeat(I)}`:""}`,F="";return A.style==="currency"&&(F+=v(T(A.currency||"USD",_))),A.prefix&&(F+=v(A.prefix)),L=F+L,A.style==="percent"&&(L=`${L}%`),A.suffix&&(L+=v(A.suffix)),A.negative==="parentheses"?`${L};(${L})`:A.negative==="suffix"?`${L};${L}-`:L}function v(A){return`"${String(A).split('"').join("")}"`}const y=new Map;function T(A,M){const _=`${A}|${M||""}`;let R=y.get(_);if(R!==void 0)return R;R=A;try{const j=new Intl.NumberFormat(M,{style:"currency",currency:A}).formatToParts(0).find(L=>L.type==="currency");j&&(R=j.value)}catch{}return y.set(_,R),R}}),Ue("packages/core/src/columns/types/temporal.js",function(e,H){"use strict";Object.defineProperty(e,"MS_SECOND",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"MS_MINUTE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"MS_HOUR",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"MS_DAY",{enumerable:!0,get:function(){return h}}),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 f}}),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 T}}),Object.defineProperty(e,"instantFromParts",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"toEpochMs",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"toDurationMs",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return he}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"resolveZoneName",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"zoneLabel",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"formatInstant",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return Le}}),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 Se}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Fe}});const ne=H("packages/core/src/internal/predicates.js"),$=ne.isNil,q=ne.isFunction,B=H("packages/core/src/format/date.js"),x=B.toDate,Z=B.compilePattern,Y=B.compileDate,U=B.toIsoDateTime,W=B.compareIso,K=864e5,E=Object.freeze({}),O=1e3,b=60*O,u=60*b,h=24*u,l=7*h,r=new WeakMap;function n(be,Ie){const He=be&&be.locale||"",Ge=be&&be.column;if(!Ge)return He?{locale:He}:E;const nt=r.get(Ge);if(nt&&nt.locale===He)return nt.bag;const st=Ge.typeOptions||Ge[Ie]||(o(Ge.format)?Ge.format:null),mt={...st||E,locale:st&&st.locale||He||void 0};return r.set(Ge,{locale:He,bag:mt}),mt}function o(be){return be!==null&&typeof be=="object"&&!Array.isArray(be)&&!(be instanceof Date)}function i(be,Ie){const He=be===null||Number.isNaN(be)?null:be,Ge=Ie===null||Number.isNaN(Ie)?null:Ie;return He===null?Ge===null?0:1:Ge===null||He<Ge?-1:He>Ge?1:0}const t=/^(\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,c=/^(\d{3,6})$/;function s(be,Ie,He,Ge){return!(be>=0&&be<=23)||!(Ie>=0&&Ie<=59)||!(He>=0&&He<=59)||!(Ge>=0&&Ge<=999)?null:be*u+Ie*b+He*O+Ge}function a(be){if($(be))return null;const Ie=String(be).trim();if(Ie==="")return null;const He=c.exec(Ie);if(He){const Pt=He[1];if(Pt.length===5)return null;const Mt=Pt.length===3?1:2;return s(Number(Pt.slice(0,Mt)),Number(Pt.slice(Mt,Mt+2)),Number(Pt.slice(Mt+2,Mt+4)||0),0)}const Ge=t.exec(Ie);if(!Ge)return null;let nt=Number(Ge[1]);const st=Number(Ge[2]||0),mt=Number(Ge[3]||0),kt=Ge[4]?Number(Ge[4].padEnd(3,"0")):0,St=Ge[5]?Ge[5][0].toLowerCase():null;if(St){if(nt<1||nt>12)return null;nt=nt%12,St==="p"&&(nt+=12)}return s(nt,st,mt,kt)}function f(be){return $(be)||be===""?null:typeof be=="number"?Number.isFinite(be)?(be%h+h)%h:null:be instanceof Date?Number.isNaN(be.getTime())?null:be.getHours()*u+be.getMinutes()*b+be.getSeconds()*O+be.getMilliseconds():a(be)}const w=new Map;function g(be){const Ie=be.pattern||"",He=be.timeStyle||(be.seconds?"medium":"short"),Ge=`${be.locale||""}|${Ie}|${He}`;let nt=w.get(Ge);if(nt)return nt;if(Ie)nt=Z(Ie,be.locale||void 0,"UTC");else{const st=new Intl.DateTimeFormat(be.locale||void 0,{timeStyle:He,timeZone:"UTC"});nt=mt=>st.format(mt)}return w.set(Ge,nt),nt}function k(be,Ie){const He=Ie||E;if(be==null||typeof be!="number"||!Number.isFinite(be))return He.nullDisplay??"";const Ge=(be%h+h)%h;return g(He)(new Date(Ge))}function d(be){return be instanceof Date?!Number.isNaN(be.getTime()):typeof be=="number"?Number.isFinite(be)&&be>=0&&be<h:typeof be!="string"||!be.includes(":")?!1:a(be)!==null}function p(be){const Ie=f(be);return Ie==null?"":k(Ie,{pattern:Ie%O===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const m=new Map;function v(be){const Ie=be||"";let He=m.get(Ie);return He||(He=new Intl.DateTimeFormat("en-GB",{timeZone:be||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),m.set(Ie,He)),He}function y(be,Ie){const He={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const Ge of v(Ie).formatToParts(new Date(be)))Ge.type==="year"?He.year=Number(Ge.value):Ge.type==="month"?He.month=Number(Ge.value):Ge.type==="day"?He.day=Number(Ge.value):Ge.type==="hour"?He.hour=Number(Ge.value)%24:Ge.type==="minute"?He.minute=Number(Ge.value):Ge.type==="second"&&(He.second=Number(Ge.value));return He}function T(be,Ie){const He=y(be,Ie);return Date.UTC(He.year,He.month-1,He.day,He.hour,He.minute,He.second,0)-Math.floor(be/1e3)*1e3}function A(be,Ie){const He=be.hour||0,Ge=be.minute||0,nt=be.second||0,st=be.ms||0;if(!Ie)return new Date(be.year,be.month-1,be.day,He,Ge,nt,st).getTime();const mt=Date.UTC(be.year,be.month-1,be.day,He,Ge,nt,st);let kt=mt-T(mt,Ie);return kt=mt-T(kt,Ie),kt}const M=/(?:Z|[+-]\d{2}:?\d{2})$/i,_=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function R(be,Ie){if($(be))return null;const He=String(be).trim();if(He==="")return null;const Ge=Ie&&Ie.timeZone||void 0;if(!M.test(He)){const nt=_.exec(He);if(nt){const st=(nt[4]||"").trim(),mt=st===""?0:a(st);if(mt===null)return null;const kt=A({year:Number(nt[1]),month:Number(nt[2]),day:Number(nt[3]),hour:Math.floor(mt/u),minute:Math.floor(mt/b)%60,second:Math.floor(mt/O)%60,ms:mt%O},Ge);return Number.isNaN(kt)?null:new Date(kt)}}return x(He)}function I(be){if(typeof be=="number")return Number.isFinite(be)?be:null;const Ie=x(be);return Ie?Ie.getTime():null}const j=new Map;function L(be){const Ie=[be.locale||"",be.pattern||"",be.dateStyle||"",be.timeStyle||"",be.timeZone||"",be.seconds?"1":""].join("|");let He=j.get(Ie);if(He)return He;const Ge=be.pattern?{type:"date",pattern:be.pattern,timeZone:be.timeZone}:{type:"date",dateStyle:be.dateStyle||"medium",timeStyle:be.timeStyle||(be.seconds?"medium":"short"),timeZone:be.timeZone};return He=Y(Ge,be.locale||void 0),j.set(Ie,He),He}function F(be,Ie){const He=Ie||E,Ge=I(be);return Ge==null?He.nullDisplay??"":L(He)(Ge)}function N(be){return be instanceof Date?!Number.isNaN(be.getTime()):typeof be!="string"||!_.test(be.trim())?!1:R(be)!==null}const S=Object.freeze([{key:"w",ms:l,intl:"week",long:["week","weeks"],names:["w","wk","wks","week","weeks"]},{key:"d",ms:h,intl:"day",long:["day","days"],names:["d","dy","day","days"]},{key:"h",ms:u,intl:"hour",long:["hour","hours"],names:["h","hr","hrs","hour","hours"]},{key:"m",ms:b,intl:"minute",long:["minute","minutes"],names:["m","min","mins","minute","minutes"]},{key:"s",ms:O,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"]}]),C=new Map;for(const be of S)for(const Ie of be.names)C.set(Ie,be);const D=Object.freeze(S.filter(be=>be.key!=="w")),G=/^(\d+(?:\.\d+)?)\s*([a-z]+)\s*(?:,\s*)?/,X=/^\d+(?:\.\d+)?$/,V=/^(\d+):([0-5]?\d)(?::([0-5]?\d))?(?:\.(\d{1,3}))?$/;function J(be){const Ie=be&&be.defaultUnit?C.get(String(be.defaultUnit).toLowerCase()):null;return Ie?Ie.ms:b}function ee(be){return(be&&be.defaultUnit?C.get(String(be.defaultUnit).toLowerCase()):null)||C.get("m")}function te(be,Ie){if($(be))return null;let He=String(be).trim().toLowerCase();if(He==="")return null;let Ge=1;if(He[0]==="-"?(Ge=-1,He=He.slice(1).trim()):He[0]==="+"&&(He=He.slice(1).trim()),He==="")return null;const nt=V.exec(He);if(nt){const St=nt[3]!==void 0,Pt=Number(nt[1])*u+Number(nt[2])*b+(St?Number(nt[3])*O:0)+(nt[4]?Number(nt[4].padEnd(3,"0")):0);return Ge*Pt}if(X.test(He))return Math.round(Ge*Number(He)*J(Ie||E));let st=He,mt=0,kt=0;for(;st!=="";){const St=G.exec(st);if(!St)return null;const Pt=C.get(St[2]);if(!Pt)return null;mt+=Number(St[1])*Pt.ms,st=st.slice(St[0].length),kt++}return kt===0?null:Math.round(Ge*mt)}function ie(be){return $(be)||be===""?null:typeof be=="number"?Number.isFinite(be)?be:null:te(be)}const oe=new Map;function ue(be,Ie,He){const Ge=`${He||""}|${Ie.intl}`;let nt=oe.get(Ge);if(nt===void 0){try{nt=new Intl.NumberFormat(He||void 0,{style:"unit",unit:Ie.intl,unitDisplay:"long"})}catch{nt=null}oe.set(Ge,nt)}return nt?nt.format(be):`${be} ${be===1?Ie.long[0]:Ie.long[1]}`}function ye(be,Ie){return String(be).padStart(Ie,"0")}function he(be,Ie){const He=Ie||E;if(be==null||typeof be!="number"||!Number.isFinite(be))return He.nullDisplay??"";const Ge=He.style||"short",nt=be<0;let st=Math.round(Math.abs(be));const mt=nt?"-":"";if(st===0&&He.zeroDisplay!=null)return He.zeroDisplay;if(Ge==="clock"){const Mt=Math.floor(st/u),It=Math.floor(st/b)%60,$t=Math.floor(st/O)%60;return`${mt}${ye(Mt,2)}:${ye(It,2)}:${ye($t,2)}`}if(st===0){const Mt=ee(He);return Ge==="long"?ue(0,Mt,He.locale):`0${Mt.key}`}const kt=He.weeks===!0?S:D,St=typeof He.maxUnits=="number"&&He.maxUnits>0?He.maxUnits:He.maxUnits===void 0?2:1/0,Pt=[];for(const Mt of kt){if(Pt.length>=St)break;const It=Math.floor(st/Mt.ms);It!==0&&(st-=It*Mt.ms,Pt.push(Ge==="long"?ue(It,Mt,He.locale):`${It}${Mt.key}`))}return mt+Pt.join(" ")}function Re(be){if(typeof be!="string")return!1;const Ie=be.trim();return Ie===""||V.test(Ie)||!/[a-z]/i.test(Ie)?!1:te(Ie)!==null}const Ce=Date.UTC(1899,11,30),we=new Map;function re(be,Ie){const He=be||"";let Ge=we.get(He);Ge||(Ge=new Intl.DateTimeFormat("en-GB",{timeZone:be||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),we.set(He,Ge));const nt=typeof Ie=="number"?Ie:Date.now();for(const st of Ge.formatToParts(new Date(nt)))if(st.type==="timeZoneName")return st.value;return""}function de(be){if(be)return be;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function me(be,Ie){const He=de(be),Ge=re(be,Ie);return Ge?`${He} (${Ge})`:He}function Oe(be,Ie){if(be&&be.timeZone)return be.timeZone;const He=Ie&&Ie.grid;return(He&&q(He.get)?He.get("timeZone"):void 0)||void 0}function ke(be,Ie){const He=Ie||E,Ge=I(be);if(Ge==null)return He.nullDisplay??"";const nt=L(He)(Ge);if(!He.showOrigin)return nt;const st=He.originZone;return st?st===(He.timeZone||de(He.timeZone))?nt:`${nt} (${me(st,Ge)})`:`${nt} (no origin recorded)`}function Le(be,Ie,He,Ge){if(Ie==="instant"||!Ie)return be;const nt=y(be,He);if(Ie==="month")return A({year:nt.year,month:nt.month,day:1},He);if(Ie==="week"){const st=Ge>=1&&Ge<=7?Ge:1,kt=((new Date(Date.UTC(nt.year,nt.month-1,nt.day)).getUTCDay()+6)%7+1-st+7)%7,St=new Date(Date.UTC(nt.year,nt.month-1,nt.day-kt));return A({year:St.getUTCFullYear(),month:St.getUTCMonth()+1,day:St.getUTCDate()},He)}return A({year:nt.year,month:nt.month,day:nt.day},He)}function ce(be,Ie){const He=be&&be.group,Ge=He&&He.granularity||"day";if(Ge==="instant")return null;const nt=He&&He.weekStart;return st=>typeof st=="number"?Le(st,Ge,Ie,nt):st}const ge={time:{base:"number",storage:"float64",matches:d,format:be=>k(f(be.value),n(be,"time")),parse:be=>a(be.text),compare:(be,Ie)=>i(f(be),f(Ie)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:be=>{const Ie=f(be);return Ie===null?null:Ie/K},toStorage:be=>f(be),toClipboard:p,fromClipboard:a},datetime:{base:"dateString",storage:"dictionary",matches:N,format:be=>F(be.value,n(be,"datetime")),parse:be=>U(R(be.text,n(be,"datetime"))??be.text),compare:W,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(be,Ie)=>U(be,Ie&&Ie.timeZone),toClipboard:be=>$(be)?"":String(be),fromClipboard:be=>U(be)},duration:{base:"number",storage:"float64",matches:Re,format:be=>he(ie(be.value),n(be,"duration")),parse:be=>te(be.text,n(be,"duration")),compare:(be,Ie)=>i(ie(be),ie(Ie)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:be=>{const Ie=ie(be);return Ie===null?null:Ie/K},toStorage:be=>ie(be),toClipboard:be=>he(ie(be),{style:"short",maxUnits:-1}),fromClipboard:be=>te(be)},timestamp:{base:"number",storage:"float64",format:be=>{const Ie=n(be,"timestamp");return ke(be.value,{...Ie,timeZone:Oe(Ie,be)})},parse:be=>{const Ie=n(be,"timestamp"),He=R(be.text,{timeZone:Oe(Ie,be)});return He?He.getTime():null},compare:(be,Ie)=>i(I(be),I(Ie)),groupProjector:(be,Ie)=>ce(be,Ie),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(be,Ie)=>{const He=I(be);if(He==null)return null;const Ge=y(He,Ie&&Ie.timeZone||void 0);return(Date.UTC(Ge.year,Ge.month-1,Ge.day,Ge.hour,Ge.minute,Ge.second)-Ce)/K},toStorage:be=>I(be),toClipboard:be=>{const Ie=I(be);return Ie==null?"":new Date(Ie).toISOString()},fromClipboard:be=>I(be)}},Se=["datetime","time","duration"],Fe=ge}),Ue("packages/core/src/internal/lru.js",function(e,H){"use strict";Object.defineProperty(e,"Lru",{enumerable:!0,get:function(){return ne}});class ne{#e;#t=new Map;#n;constructor(q=256,B=null){this.#e=q,this.#n=B}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 B=this.#t;if(!B.has(q))return;const x=B.get(q);return B.delete(q),B.set(q,x),x}peek(q){return this.#t.get(q)}set(q,B){const x=this.#t;return x.has(q)&&x.delete(q),x.set(q,B),this.#r(),B}delete(q){const B=this.#t.get(q);return this.#t.delete(q)&&this.#n&&this.#n(B,q),B}clear(){if(this.#n)for(const[q,B]of this.#t)this.#n(B,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 B=q.keys().next().value,x=q.get(B);q.delete(B),this.#n&&this.#n(x,B)}}}}),Ue("packages/core/src/columns/types/network.js",function(e,H){"use strict";Object.defineProperty(e,"toUint32",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"compareIpv4",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"packCidr",{enumerable:!0,get:function(){return h}}),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 n}}),Object.defineProperty(e,"isCidr",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"compareCidr",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"netmask",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"addressCount",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return w}}),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 T}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return I}});const $=H("packages/core/src/internal/predicates.js").isNil,B=H("packages/core/src/internal/lru.js").Lru,x=4294967295,Z=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function Y(j){if($(j))return null;if(typeof j=="string")return U(j);const L=Number(j);return Number.isFinite(L)?L<0?L<-2147483648?null:L>>>0:L>x?null:Math.trunc(L)>>>0:null}function U(j){if($(j))return null;const L=String(j).trim();if(L==="")return null;const F=Z.exec(L);if(!F)return null;let N=0;for(let S=1;S<=4;S++){const C=F[S];if(C.length>1&&C.charCodeAt(0)===48)return null;const D=Number(C);if(D>255)return null;N=N*256+D}return N}function W(j){const L=Y(j);return L===null?"":`${L>>>24&255}.${L>>>16&255}.${L>>>8&255}.${L&255}`}function K(j){return typeof j=="string"&&U(j)!==null}function E(j,L){const F=Y(j),N=Y(L);return F===null?N===null?0:1:N===null||F<N?-1:F>N?1:0}const O=64,b=x*O+32,u=/^(?:0|[1-9]\d?)$/;function h(j,L){return j*O+L}function l(j){if($(j))return null;if(typeof j=="string"){const N=r(j);return N===null?null:l(N)}if(typeof j=="object"){const N=Y(j.address),S=Number(j.prefix);return N===null||!Number.isInteger(S)||S<0||S>32?null:{address:N,prefix:S}}const L=Number(j);if(!Number.isInteger(L)||L<0||L>b)return null;const F=L%O;return F>32?null:{address:(L-F)/O,prefix:F}}function r(j){if($(j))return null;const L=String(j).trim();if(L==="")return null;const F=L.indexOf("/");if(F<0)return null;const N=U(L.slice(0,F));if(N===null)return null;const S=L.slice(F+1).trim();if(!u.test(S))return null;const C=Number(S);return C>32?null:h(N,C)}function n(j){const L=l(j);return L?`${W(L.address)}/${L.prefix}`:""}function o(j){return typeof j=="string"&&r(j)!==null}function i(j,L){const F=l(j),N=l(L);return F?N?F.address!==N.address?F.address<N.address?-1:1:F.prefix-N.prefix:-1:N?1:0}function t(j){return j===0?0:4294967295<<32-j>>>0}function c(j){const L=l(j);return L?(L.address&t(L.prefix))>>>0:null}function s(j){const L=l(j);return L?(L.address&t(L.prefix)|~t(L.prefix)>>>0)>>>0:null}function a(j){const L=l(j);return L?2**(32-L.prefix):null}function f(j){const L=l(j);return L?L.prefix===32?1:L.prefix===31?2:2**(32-L.prefix)-2:null}function w(j,L){const F=l(j);if(!F)return!1;const N=Y(L);if(N===null)return!1;const S=t(F.prefix);return(N&S)>>>0===(F.address&S)>>>0}function g(j,L){const F=c(j),N=c(L);return F===null||N===null?!1:F<=s(L)&&N<=s(j)}const k=/^[0-9a-fA-F]{1,4}$/,d=new B(512);function p(j){if($(j))return null;let L=String(j).trim();if(L==="")return null;const F=L.indexOf("%");if(F>=0&&(L=L.slice(0,F)),L==="")return null;if(L.indexOf(".")>=0){const X=L.lastIndexOf(":");if(X<0)return null;const V=U(L.slice(X+1));if(V===null)return null;L=`${L.slice(0,X+1)}${(V>>>16&65535).toString(16)}:${(V&65535).toString(16)}`}const N=L.split("::");if(N.length>2)return null;const S=m(N[0]);if(S===null)return null;if(N.length===1)return S.length===8?S:null;const C=m(N[1]);if(C===null)return null;const D=8-S.length-C.length;if(D<1)return null;const G=S.slice();for(let X=0;X<D;X++)G.push(0);for(const X of C)G.push(X);return G}function m(j){if(j==="")return[];const L=[];for(const F of j.split(":")){if(!k.test(F))return null;L.push(parseInt(F,16))}return L}function v(j){if(typeof j!="string")return p(j);if(d.has(j))return d.get(j);const L=p(j);return d.set(j,L),L}function y(j){if(j[0]===0&&j[1]===0&&j[2]===0&&j[3]===0&&j[4]===0&&j[5]===65535)return`::ffff:${W((j[6]<<16|j[7])>>>0)}`;let L=-1,F=0,N=-1,S=0;for(let G=0;G<8;G++)j[G]===0?(N<0?(N=G,S=1):S++,S>F&&(F=S,L=N)):(N=-1,S=0);if(F<2)return j.map(G=>G.toString(16)).join(":");const C=j.slice(0,L).map(G=>G.toString(16)).join(":"),D=j.slice(L+F).map(G=>G.toString(16)).join(":");return`${C}::${D}`}function T(j){const L=p(j);return L===null?null:y(L)}function A(j){return T(j)??""}function M(j){return typeof j=="string"&&j.indexOf(":")>=0&&p(j)!==null}function _(j,L){const F=v(j),N=v(L);if(!F)return N?1:0;if(!N)return-1;for(let S=0;S<8;S++)if(F[S]!==N[S])return F[S]<N[S]?-1:1;return 0}const R=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:K,parse:j=>U(j.text),compare:E,format:j=>W(j.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:j=>Y(j),toClipboard:j=>W(j),fromClipboard:j=>U(j)},cidr:{base:"number",storage:"float64",matches:o,parse:j=>r(j.text),compare:i,format:j=>n(j.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:j=>{const L=l(j);return L===null?null:h(L.address,L.prefix)},toClipboard:j=>n(j),fromClipboard:j=>r(j)},ipv6:{base:"text",storage:"dictionary",matches:M,parse:j=>T(j.text),compare:_,format:j=>A(j.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:j=>T(j),toClipboard:j=>A(j),fromClipboard:j=>T(j)}}),I=R}),Ue("packages/core/src/i18n/catalogue.js",function(e,H){"use strict";Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return B}});const $=H("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.rating.of":"{rating} of {max}","cell.rating.empty":"Not rated","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","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":$,"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","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"}),B=Object.freeze(Object.keys(q))}),Ue("packages/core/src/i18n/format.js",function(e,H){"use strict";Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"formatMessage",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return O}});const $=H("packages/core/src/internal/predicates.js").isFunction,q=/\{(\w+)\}/g,B=new Map,x=new Map;function Z(b){const u=b||"";if(B.has(u))return B.get(u);let h=null;try{h=new Intl.PluralRules(b||void 0)}catch{h=null}return B.set(u,h),h}function Y(b,u,h="conjunction"){const l=Array.isArray(b)?b.filter(o=>o!=null&&o!==""):[];if(l.length===0)return"";if(l.length===1)return String(l[0]);const r=`${u||""}|${h}`;let n=x.get(r);if(n===void 0){try{n=new Intl.ListFormat(u||void 0,{style:"long",type:h})}catch{n=null}x.set(r,n)}return n?n.format(l.map(String)):l.map(String).join(", ")}function U(b,u){return b==null?"":typeof b=="number"?Number.isFinite(b)?b.toLocaleString(u||void 0,{maximumFractionDigits:20}):"":String(b)}function W(b,u,h){if(typeof b=="string")return b;if(!b||typeof b!="object")return"";const l=u&&typeof u.count=="number"?u.count:null;if(l===null)return b.other??"";const r=Z(h),n=r?r.select(l):l===1?"one":"other";return b[n]??b.other??""}function K(b,u={},h){const l=W(b,u,h);return l?l.replace(q,(r,n)=>Object.prototype.hasOwnProperty.call(u,n)?U(u[n],h):r):""}function E(b,u,h="en-GB"){return typeof b=="string"&&b?b:typeof u=="string"&&u?u:h}function O(b,u){const h=b?b[u]:void 0;return h==null||$(h)?u:h}}),Ue("packages/core/src/i18n/registry.js",function(e,H){"use strict";Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"localeCatalogue",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return Z}});const $=H("packages/core/src/i18n/catalogue.js").EN_GB,q=new Map([["en-gb",$]]);function B(Y,U){const W=typeof Y=="string"?Y.toLowerCase():"";return!W||!U||typeof U!="object"?!1:(q.set(W,U),!0)}function x(Y){if(typeof Y!="string"||!Y)return null;const U=Y.toLowerCase(),W=q.get(U);if(W)return W;const K=U.split("-")[0],E=q.get(K);if(E)return E;for(const[O,b]of q)if(O.split("-")[0]===K)return b;return null}function Z(){return[...q.keys()]}}),Ue("packages/core/src/i18n/index.js",function(e,H){"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 n}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return i}});const ne=H("packages/core/src/i18n/catalogue.js"),$=ne.EN_GB,q=ne.MESSAGE_KEYS,B=H("packages/core/src/i18n/format.js"),x=B.formatMessage,Z=B.formatList,Y=B.lookup,U=B.resolveLocale,K=H("packages/core/src/internal/predicates.js").isFunction,O=H("packages/core/src/internal/warn.js").warnOnce,b=H("packages/core/src/i18n/registry.js"),u=b.registerLocale,h=b.localeCatalogue;Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return ne.EN_GB}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return ne.MESSAGE_KEYS}}),Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return B.formatList}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return B.resolveLocale}}),Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return b.registerLocale}});const l="en-GB";class r{#e=l;#t=$;constructor(c={}){this.configure(c)}configure(c={}){this.#e=U(c.locale,c.declared,l);const s=c.messages,a=h(this.#e);if(!a&&this.#e.toLowerCase()!=="en-gb"&&(!s||typeof s!="object")&&O(`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.`),!s||typeof s!="object"){this.#t=a?{...$,...a}:$;return}const w=Object.keys(s).filter(g=>!(g in $));w.length&&O(`i18n:unknown:${w[0]}`,`message keys not in the catalogue and so ignored: ${w.slice(0,5).join(", ")}${w.length>5?`, and ${w.length-5} more`:""}`),this.#t={...$,...a||{},...s}}get locale(){return this.#e}t(c,s){return x(Y(this.#t,c),s||{},this.#e)}list(c,s){return Z(c,this.#e,s)}number(c,s){const a=Number(c);return Number.isFinite(a)?a.toLocaleString(this.#e,s||{maximumFractionDigits:20}):""}}const n=new r;function o(t){return t instanceof r?t:new r(t||{})}function i(t){const c=t&&typeof t=="object"?t:{},s=q.filter(f=>{const w=c[f];return w==null||w===""||K(w)}),a=Object.keys(c).filter(f=>!(f in $));return{missing:s,unknown:a}}}),Ue("packages/core/src/columns/types/structured.js",function(e,H){"use strict";Object.defineProperty(e,"MASK_DEFAULTS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"parseJsonText",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});const ne=H("packages/core/src/internal/predicates.js"),$=ne.isNil,q=ne.isObject,x=H("packages/core/src/i18n/index.js").defaultMessages,Z=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function Y(r,n){const o=n||{},i=o.emptyDisplay??Z.emptyDisplay;if($(r)||r==="")return i;const c=[...typeof o.char=="string"&&o.char!==""?o.char:Z.char][0]||Z.char,s=o.fixedLength??Z.fixedLength,a=Number.isFinite(o.length)&&Number(o.length)>0?Math.floor(Number(o.length)):Z.length,f=typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"||typeof r=="bigint"?String(r):null;let w=0;if(f!==null){const g=Number.isFinite(o.lastVisible)?Math.floor(Number(o.lastVisible)):Z.lastVisible,k=[...f];if(w=g>0&&g<k.length?g:0,w>0){const d=k.slice(k.length-w).join(""),p=Math.max(1,(s?a:k.length)-w);return c.repeat(p)+d}return c.repeat(s?a:Math.max(1,k.length))}return c.repeat(a)}const U=48;function W(r){try{const n=JSON.stringify(r);return n===void 0?null:n}catch{return null}}function K(r,n){if($(r))return"";const o=Number.isFinite(n&&n.inlineLimit)?Number(n.inlineLimit):U;if(typeof r=="string")return r.length>o?`${r.slice(0,o-1)}…`:r;if(typeof r!="object")return String(r);const i=W(r);if(i!==null&&i.length<=o)return i;if(Array.isArray(r)){const c=r.length;return`[${x.t("count.items",{count:c})}]`}const t=Object.keys(r).length;return`{${x.t("count.keys",{count:t})}}`}function E(r,n){if(r==null)return"null";const o=typeof r;if(o==="number"||o==="boolean"||o==="bigint")return String(r);if(o==="string")return JSON.stringify(r);if(o!=="object")return JSON.stringify(String(r));const i=n||new WeakSet;return i.has(r)?'"[circular]"':(i.add(r),r instanceof Date?JSON.stringify(r.toISOString()):Array.isArray(r)?`[${r.map(s=>E(s,i)).join(",")}]`:`{${Object.keys(r).sort().map(s=>`${JSON.stringify(s)}:${E(r[s],i)}`).join(",")}}`)}function O(r,n){if($(r))return $(n)?0:1;if($(n))return-1;const o=E(r),i=E(n);return o<i?-1:o>i?1:0}function b(r){if($(r))return null;const n=String(r);if(n.trim()==="")return null;try{return JSON.parse(n)}catch{return n}}function u(r){const n=r&&r.cell&&r.cell.props;return q(n)?n:{}}const h=Object.freeze({json:{base:"object",storage:"object",format:r=>K(r&&r.value,u(r&&r.column)),parse:r=>b(r&&r.text),compare:O,defaults:{editor:"code",filter:"text",align:"start"},excel:"@",toClipboard:r=>{if($(r))return"";if(typeof r=="string")return r;try{const n=JSON.stringify(r,null,2);return n===void 0?String(r):n}catch{return String(r)}},fromClipboard:r=>b(r)},secret:{base:"text",storage:"object",format:r=>Y(r&&r.value,u(r&&r.column)),parse:r=>{const n=r&&r.text;return $(n)||String(n)===""?null:String(n)},compare:(r,n)=>{const o=$(r)||r==="",i=$(n)||n==="";return o===i?0:o?1:-1},defaults:{editor:"password",filter:"none",align:"start"},excel:"@",export:{csv:!1,excel:!1},toClipboard:r=>Y(r),fromClipboard:r=>$(r)||String(r)===""?null:String(r)}}),l=h}),Ue("packages/core/src/columns/types/unit.js",function(e,H){"use strict";Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return N}});const $=H("packages/core/src/internal/predicates.js").isNil,B=H("packages/core/src/internal/warn.js").warnOnce;function x(S,C,D,G){return Object.freeze({symbol:S,factor:C,aliases:Object.freeze(D||[]),binary:!!(G&&G.binary),prefix:G&&G.prefix||null,auto:!(G&&G.auto===!1)})}function Z(S,C,D,G){return x(S,C,D,G)}const Y=Object.freeze({data:Object.freeze([x("B",1,["byte","bytes"]),x("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),x("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),x("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),x("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),x("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),x("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),x("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),x("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),x("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([x("bps",1,["bit","bits","bit/s","b/s"]),x("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),x("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),x("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),x("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([x("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),x("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),x("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),x("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),x("in",.0254,["inch","inches"],{auto:!1}),x("ft",.3048,["foot","feet"],{auto:!1}),x("yd",.9144,["yard","yards"],{auto:!1}),x("m",1,["metre","metres","meter","meters"]),x("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),x("mi",1609.344,["mile","miles"],{auto:!1}),x("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([x("mg",.001,["milligram","milligrams"]),x("g",1,["gram","grams"]),x("oz",28.349523125,["ounce","ounces"],{auto:!1}),x("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),x("kg",1e3,["kilogram","kilograms"]),x("st",6350.29318,["stone"],{auto:!1}),x("t",1e6,["tonne","tonnes","ton"],{auto:!1}),x("ton (US)",907184.74,["ton","shortton"],{auto:!1}),x("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([x("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),x("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),x("ms",.001,["msec","msecs","millisecond","milliseconds"]),x("s",1,["sec","secs","second","seconds"]),x("m",60,["min","mins","minute","minutes"]),x("h",3600,["hr","hrs","hour","hours"]),x("d",86400,["day","days"])]),speed:Object.freeze([x("mm/s",.001,["millimetre/s","millimeter/s"]),x("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),x("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),x("mph",.44704,["mile/h","miles/h"],{auto:!1}),x("kn",1852/3600,["knot","knots"],{auto:!1}),x("m/s",1,["metre/s","meter/s","mps"]),x("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([x("mm/s²",.001,["mm/s2"]),x("ft/s²",.3048,["ft/s2"],{auto:!1}),x("m/s²",1,["m/s2","metre/s2","meter/s2"]),x("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([x("mm²",1e-6,["mm2"]),x("cm²",1e-4,["cm2"]),x("in²",64516e-8,["in2","sqin"],{auto:!1}),x("ft²",.09290304,["ft2","sqft"],{auto:!1}),x("yd²",.83612736,["yd2","sqyd"],{auto:!1}),x("m²",1,["m2","sqm"]),x("ha",1e4,["hectare","hectares"],{auto:!1}),x("ac",4046.8564224,["acre","acres"],{auto:!1}),x("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([x("µL",1e-6,["ul","microlitre","microliter"]),x("mL",.001,["millilitre","milliliter"]),x("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),x("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),x("L",1,["litre","litres","liter","liters"]),x("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),x("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),x("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),x("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([x("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),x("J",1,["joule","joules"]),x("cal",4.184,["calorie","calories"],{auto:!1}),x("kJ",1e3,["kilojoule","kilojoules"]),x("BTU",1055.05585262,["btu"],{auto:!1}),x("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),x("MJ",1e6,["megajoule","megajoules"]),x("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),x("GJ",1e9,["gigajoule","gigajoules"]),x("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([x("mW",.001,["milliwatt","milliwatts"]),x("W",1,["watt","watts"]),x("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),x("kW",1e3,["kilowatt","kilowatts"]),x("hp",745.6998715822702,["horsepower"],{auto:!1}),x("MW",1e6,["megawatt","megawatts"]),x("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([x("mN",.001,["millinewton","millinewtons"]),x("N",1,["newton","newtons"]),x("lbf",4.4482216152605,["poundforce"],{auto:!1}),x("kgf",9.80665,["kilogramforce"],{auto:!1}),x("kN",1e3,["kilonewton","kilonewtons"]),x("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([x("Pa",1,["pascal","pascals"]),x("mbar",100,["millibar"],{auto:!1}),x("inH₂O",249.0889,["inh2o"],{auto:!1}),x("mmHg",133.322387415,["torr"],{auto:!1}),x("kPa",1e3,["kilopascal","kilopascals"]),x("inHg",3386.388640341,["inhg"],{auto:!1}),x("psi",6894.757293168361,["lbf/in2"],{auto:!1}),x("bar",1e5,[],{auto:!1}),x("atm",101325,["atmosphere","atmospheres"],{auto:!1}),x("MPa",1e6,["megapascal","megapascals"]),x("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([x("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),x("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),x("kN·m",1e3,["knm","kn.m"],{auto:!1}),x("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([x("kg/m³",1,["kg/m3"]),x("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),x("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),x("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([x("L/min",1/6e4,["lpm","l/min"],{auto:!1}),x("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),x("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),x("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),x("cfm",.0004719474432,["ft3/min"],{auto:!1}),x("L/s",.001,["lps","l/s"],{auto:!1}),x("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([x("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),x("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),x("mrad",.001,["milliradian","milliradians"],{auto:!1}),x("mil",Math.PI/3200,["nato-mil"],{auto:!1}),x("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),x("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),x("rad",1,["radian","radians"]),x("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([x("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),x("rad/s",1,["radps","radians/s"]),x("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),x("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([x("ppt",1e-12,["partspertrillion"],{auto:!1}),x("ppb",1e-9,["partsperbillion"]),x("ppm",1e-6,["partspermillion"]),x("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),x("‰",.001,["permille","permil"],{auto:!1}),x("%",.01,["pct","percent"]),x("×",1,["x","ratio","times"])]),molarity:Object.freeze([x("pM",1e-12,["picomolar","picomolarity"]),x("nM",1e-9,["nanomolar","nanomolarity"]),x("µM",1e-6,["um-molar","micromolar","micromolarity"]),x("mM",.001,["millimolar","millimolarity"]),x("M",1,["molar","mol/l","mol/L","molarity"]),x("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([x("mg/s",1e-6,["milligrams/s"]),x("g/s",.001,["grams/s"]),x("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),x("kg/s",1,["kilograms/s","kgps"]),x("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),x("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),x("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([x("µPa·s",1e-6,["upas","micropascalsecond"]),x("cP",.001,["centipoise"],{auto:!1}),x("mPa·s",.001,["mpas","millipascalsecond"]),x("P",.1,["poise"],{auto:!1}),x("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([x("cSt",1e-6,["centistokes","centistoke"]),x("mm²/s",1e-6,["mm2/s"],{auto:!1}),x("St",1e-4,["stokes","stoke"],{auto:!1}),x("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([x("mW/(m·K)",.001,["mw/mk"]),x("W/(m·K)",1,["w/mk","wmk"]),x("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),x("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([x("J/(kg·K)",1,["j/kgk","jkgk"]),x("kJ/(kg·K)",1e3,["kj/kgk"]),x("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([x("nSv/h",1e-9,["nsvh"]),x("µSv/h",1e-6,["usv/h","usvh"]),x("mSv/h",.001,["msvh"]),x("Sv/h",1,["svh"]),x("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),U=Symbol("ambiguous"),W=new Map,K=new Map;function E(S,C){const D=String(S||"").trim();if(!D)throw new Error("[lattice] a unit system needs a name");if(Y[D]||K.has(D))throw new Error(`[lattice] unit system "${D}" already exists`);const G=[...C||[]];if(!G.length)throw new Error(`[lattice] unit system "${D}" has no units`);if(!G.some(V=>V.factor===1))throw new Error(`[lattice] unit system "${D}" has no base unit (none with factor 1)`);const X=new Set;for(const V of G){if(X.has(V.symbol))throw new Error(`[lattice] unit system "${D}" declares "${V.symbol}" twice`);X.add(V.symbol)}return K.set(D,Object.freeze(G)),W.delete(D),D}function O(){return[...Object.keys(Y),...K.keys()]}function b(S){const C=u(S);return C?C.units:[]}function u(S){const C=String(S||""),D=W.get(C);if(D!==void 0)return D;const G=Y[C]||K.get(C);if(!G)return W.set(C,null),null;const X=Object.freeze([...G].sort((ie,oe)=>ie.factor-oe.factor)),V=new Map,J=new Map,ee=(ie,oe)=>{const ue=V.get(ie);ue===void 0?V.set(ie,oe):ue!==oe&&V.set(ie,U)};for(const ie of X){ee(ie.symbol.toLowerCase(),ie);for(const oe of ie.aliases)ee(oe.toLowerCase(),ie);if(ie.prefix){const oe=J.get(ie.prefix)||[];oe.push(ie),J.set(ie.prefix,oe)}}const te={units:X,byToken:V,byPrefix:J,decimal:X.filter(ie=>!ie.binary&&ie.auto),binary:X.some(ie=>ie.binary)?X.filter(ie=>(ie.binary||ie.factor===1)&&ie.auto):null};return W.set(C,te),te}function h(S,C){return C&&S.binary||S.decimal}function l(S,C){const D=u(S);if(!D||$(C))return null;const G=D.units.find(V=>V.symbol===String(C));if(G)return G;const X=D.byToken.get(String(C).trim().toLowerCase());return X&&X!==U?X:null}const r=new WeakMap;function n(S){const C=S||{};if(typeof C=="object"&&C!==null){const V=r.get(C);if(V!==void 0)return V}const D=C.system||"data",G=u(D);let X=null;if(!G)B(`unit:system:${D}`,`unknown unit system "${D}"; known systems are ${O().join(", ")}`);else{let V=C.unit?l(D,C.unit):null;V||(C.unit&&B(`unit:unit:${D}:${C.unit}`,`unknown unit "${C.unit}" in system "${D}"; falling back to ${G.units[0].symbol}`),V=G.units.find(J=>J.factor===1)||G.units[0]),X={index:G,base:V,binary:C.binary===!0}}return typeof C=="object"&&C!==null&&r.set(C,X),X}const o=new WeakMap;function i(S,C){if(!S||!C||!Array.isArray(S.compound)||S.compound.length===0)return null;const D=o.get(S);if(D!==void 0)return D;const G=new Set,X=[];for(const J of S.compound){const ee=l(S.system||"data",J);if(!ee){B(`unit:compound:${S.system}:${J}`,`unknown compound unit "${J}" in system "${S.system||"data"}"; ignoring it`);continue}G.has(ee.symbol)||(G.add(ee.symbol),X.push(ee))}X.sort((J,ee)=>ee.factor-J.factor);const V=X.length>=2?X:null;return o.set(S,V),V}function t(S,C,D){return C===D||C.factor===D.factor?S:S*C.factor/D.factor}const c=new Map;function s(S){const C=S||"",D=c.get(C);if(D)return D;const G={group:",",decimal:"."};try{for(const X of new Intl.NumberFormat(S||void 0).formatToParts(12345.6))X.type==="group"?G.group=X.value:X.type==="decimal"&&(G.decimal=X.value)}catch{}return c.set(C,G),G}const a=/[\s ]/g,f=/^[+-]?[\d '’ .,]*(?:[eE][+-]?\d+)?/,w=/^[^\d+\-(.,\s]+\s*/,g=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function k(S,C){const{group:D,decimal:G}=s(C);let X=String(S).replace(a,"");if(X==="")return null;const V=G?X.indexOf(G):-1;if(D&&D!==G){if(V>=0&&X.indexOf(D,V+G.length)>=0)return null;X=X.split(D).join("")}if(G&&G!=="."&&(X=X.split(G).join(".")),!g.test(X))return null;const J=Number(X);return Number.isFinite(J)?J:null}function d(S,C,D){const G=String(S).trim().replace(/\.$/,"");if(G==="")return null;const X=C.units.find(oe=>oe.symbol===G);if(X)return X;const V=G.toLowerCase(),J=C.byToken.get(V);if(J===U)return null;if(J)return J;const ee=C.byPrefix.get(V);if(!ee||!ee.length)return null;const te=h(C,D),ie=ee.filter(oe=>te.includes(oe));return ie.length===1?ie[0]:null}function p(S,C,D,G){let X=S,V=0,J=!1,ee=!1;for(;X!=="";){const te=f.exec(X)[0];if(te==="")return null;const ie=k(te,G&&G.locale);if(ie===null)return null;X=X.slice(te.length).trim();const oe=X.search(/[+-]?[\d]/),ue=(oe>=0?X.slice(0,oe):X).trim();if(X=oe>=0?X.slice(oe).trim():"",ue===""){if(J)return null;ee=!0,V+=t(ie,D[0],C.base)}else{const ye=d(ue,C.index,C.binary);if(!ye)return null;V+=t(ie,ye,C.base)}if(J=!0,ee&&X!=="")return null}return J?V:null}function m(S,C){if($(S))return null;if(typeof S=="number")return Number.isFinite(S)?S:null;const D=n(C);if(!D)return null;let G=String(S).trim();if(G==="")return null;let X=!1;G.startsWith("(")&&G.endsWith(")")&&(X=!0,G=G.slice(1,-1).trim());const V=i(C,D);if(V){G.startsWith("-")&&(X=!0,G=G.slice(1).trim());const he=p(G,D,V,C);return he===null?null:X?-he:he}let J=null;const ee=w.exec(G);if(ee&&ee[0]){const he=d(ee[0].trim(),D.index,D.binary);he&&(J=he,G=G.slice(ee[0].length).trim())}const te=f.exec(G)[0],ie=k(te,C&&C.locale);if(ie===null)return null;const oe=G.slice(te.length).trim();if(J&&oe!=="")return null;const ue=J||(oe===""?D.base:d(oe,D.index,D.binary));if(!ue)return null;const ye=t(ie,ue,D.base);return X?-ye:ye}const v=new Map;function y(S,C,D,G){const X=`${S||""}|${C}|${D}|${G?1:0}`;let V=v.get(X);return V||(V=new Intl.NumberFormat(S||void 0,{minimumFractionDigits:C,maximumFractionDigits:D,useGrouping:G}),v.set(X,V)),V}function T(S,C){if(!Number.isFinite(S)||S===0)return Math.max(0,C-1);const D=Math.floor(Math.log10(Math.abs(S)));return Math.min(20,Math.max(0,C-1-D))}function A(S,C){if(!Number.isFinite(S)||S===0)return S;const D=Math.ceil(Math.log10(Math.abs(S))),G=10**(C-D);return Math.round(S*G)/G}function M(S,C,D){if(!D||D===C.base.symbol)return C.base;if(D!=="auto")return _(C,D);if(S===0||!Number.isFinite(S))return C.base;const G=Math.abs(S)*C.base.factor,X=h(C.index,C.binary);let V=X[0];for(const te of X)G>=te.factor&&(V=te);if(G>=V.factor)return V;let J=V;for(const te of C.index.units)te.binary!==C.binary&&te.factor!==1||te.factor<=G&&te.factor>(J===V?0:J.factor)&&(J=te);if(J!==V)return J;let ee=V;for(const te of C.index.units)te.binary!==C.binary&&te.factor!==1||te.factor<ee.factor&&(ee=te);return ee.factor<C.base.factor?ee:C.base}function _(S,C){const D=S.index.units.find(X=>X.symbol===C);if(D)return D;const G=S.index.byToken.get(String(C).toLowerCase());return G&&G!==U?G:(B(`unit:display:${C}`,`unknown display unit "${C}"; rendering in ${S.base.symbol}`),S.base)}function R(S,C,D,G){const X=S<0;let V=Math.abs(S)*C.base.factor;const J=typeof G.decimals=="number"?G.decimals:G.minDecimals??0,ee=typeof G.decimals=="number"?G.decimals:G.maxDecimals??Math.max(J,2),te=G.space??" ",ie=[];for(let ue=0;ue<D.length;ue++){const ye=D[ue],he=ue===D.length-1;let Re=he?V/ye.factor:Math.floor(V/ye.factor);if(V-=Re*ye.factor,he){const we=10**ee;Re=Math.round(Re*we)/we+0}const Ce=he?y(G.locale,J,ee,G.group!==!1):y(G.locale,0,0,G.group!==!1);ie.push(`${Ce.format(Re)}${te}${ye.symbol}`)}const oe=ie.join(" ");return X?`-${oe}`:oe}function I(S,C){const D=C||{},G=D.nullDisplay??"";if($(S)||S==="")return G;const X=typeof S=="number"?S:Number(S);if(!Number.isFinite(X))return G;const V=n(D);if(!V)return String(X);const J=i(D,V);if(J)return R(X,V,J,D);const ee=typeof D.significantFigures=="number"&&D.significantFigures>0?D.significantFigures:0,te=ee?A(X,ee):X,ie=M(te,V,D.display),oe=t(te,V.base,ie);let ue=typeof D.decimals=="number"?D.decimals:D.minDecimals??0,ye=typeof D.decimals=="number"?D.decimals:D.maxDecimals??Math.max(ue,2);ee&&(ue=T(oe,ee),ye=ue);const he=y(D.locale,ue,ye,D.group!==!1).format(oe),Re=D.space??" ";return D.placement==="prefix"?`${ie.symbol}${D.space??""}${he}`:`${he}${Re}${ie.symbol}`}function j(S,C){const D=$(S)||Number.isNaN(S)?null:Number(S),G=$(C)||Number.isNaN(C)?null:Number(C);return D===null||Number.isNaN(D)?G===null||Number.isNaN(G)?0:1:G===null||Number.isNaN(G)||D<G?-1:D>G?1:0}function L(S){const C=typeof S.decimals=="number"&&S.decimals>0?`.${"0".repeat(S.decimals)}`:"";return`${typeof S.decimals=="number"?`#,##0${C}`:"#,##0.##"}" ${S.symbol}"`}function F(S){const C={system:"data",...S||{}},D=n(C),G=D?D.base.symbol:String(C.unit||""),X=Object.freeze({...C,unit:G}),V=Object.freeze({...X,display:G,decimals:void 0,minDecimals:0,maxDecimals:20,group:!1}),J=new Map([[X.locale||"",X]]),ee=te=>{const ie=te||"";let oe=J.get(ie);return oe||(oe=Object.freeze({...X,locale:te||void 0}),J.set(ie,oe)),oe};return{base:"number",extends:"number",storage:"float64",unitConfig:X,format:te=>I(te.value,te.locale?ee(te.locale):X),parse:te=>m(te.text,te.locale?ee(te.locale):X),compare:j,defaults:{filter:"number",editor:"unit",align:"end",total:C.total||"sum"},...C.totals?{totals:C.totals}:{},excel:C.excel||L({decimals:C.decimals,symbol:G}),toStorage:te=>typeof te=="number"?Number.isFinite(te)?te:null:typeof te=="string"?m(te,X):$(te)?null:m(String(te),X),toClipboard:te=>I(te,V),fromClipboard:te=>m(te,X)}}const N=F}),Ue("packages/core/src/columns/types/engineering.js",function(e,H){"use strict";Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return x}});const $=H("packages/core/src/internal/predicates.js").isNil,B=H("packages/core/src/columns/types/unit.js").createUnitType;function x(U){const W=2*Math.PI/U;return K=>{let E=0,O=0,b=0;for(const h of K||[]){if($(h))continue;const l=Number(h);Number.isFinite(l)&&(E+=Math.cos(l*W),O+=Math.sin(l*W),b+=1)}return!b||Math.hypot(E,O)/b<1e-12?null:(Math.atan2(O,E)/W%U+U)%U}}function Z(U){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:x(U)}}}const Y=Object.freeze({metres:B({system:"length",unit:"m",display:"auto",maxDecimals:3}),millimetres:B({system:"length",unit:"mm",maxDecimals:2}),kilometres:B({system:"length",unit:"km",maxDecimals:3}),grams:B({system:"mass",unit:"g",display:"auto",maxDecimals:3}),kilograms:B({system:"mass",unit:"kg",maxDecimals:3}),tonnes:B({system:"mass",unit:"t",maxDecimals:3}),seconds:B({system:"duration",unit:"s",display:"auto",maxDecimals:3}),milliseconds:B({system:"duration",unit:"ms",maxDecimals:3}),hours:B({system:"duration",unit:"h",maxDecimals:2}),speed:B({system:"speed",unit:"m/s",display:"auto",maxDecimals:2}),kph:B({system:"speed",unit:"km/h",maxDecimals:1}),mph:B({system:"speed",unit:"mph",maxDecimals:1}),knots:B({system:"speed",unit:"kn",maxDecimals:1}),acceleration:B({system:"acceleration",unit:"m/s²",maxDecimals:3}),area:B({system:"area",unit:"m²",display:"auto",maxDecimals:2}),hectares:B({system:"area",unit:"ha",maxDecimals:4}),volume:B({system:"volume",unit:"L",display:"auto",maxDecimals:3}),cubicMetres:B({system:"volume",unit:"m³",maxDecimals:3}),energy:B({system:"energy",unit:"J",display:"auto",maxDecimals:3}),kilowattHours:B({system:"energy",unit:"kWh",maxDecimals:2}),power:B({system:"power",unit:"W",display:"auto",maxDecimals:2}),kilowatts:B({system:"power",unit:"kW",maxDecimals:2}),force:B({system:"force",unit:"N",display:"auto",maxDecimals:2}),pressure:B({system:"pressure",unit:"Pa",display:"auto",maxDecimals:2}),bar:B({system:"pressure",unit:"bar",maxDecimals:3}),psi:B({system:"pressure",unit:"psi",maxDecimals:1}),torque:B({system:"torque",unit:"N·m",maxDecimals:2}),density:B({system:"density",unit:"kg/m³",maxDecimals:2}),flow:B({system:"flow",unit:"m³/s",maxDecimals:4}),litresPerMinute:B({system:"flow",unit:"L/min",maxDecimals:1}),radians:B({system:"angle",unit:"rad",maxDecimals:4,totals:Z(2*Math.PI)}),degrees:B({system:"angle",unit:"°",maxDecimals:2,totals:Z(360)}),rpm:B({system:"angularVelocity",unit:"rpm",maxDecimals:0}),angularVelocity:B({system:"angularVelocity",unit:"rad/s",maxDecimals:3}),ppm:B({system:"fraction",unit:"ppm",maxDecimals:2}),ppb:B({system:"fraction",unit:"ppb",maxDecimals:2}),basisPoints:B({system:"fraction",unit:"bp",maxDecimals:1}),molarity:B({system:"molarity",unit:"M",display:"auto",maxDecimals:3}),massFlow:B({system:"massFlow",unit:"kg/s",maxDecimals:3}),tonnesPerHour:B({system:"massFlow",unit:"t/h",maxDecimals:2}),viscosity:B({system:"viscosity",unit:"Pa·s",display:"auto",maxDecimals:3}),kinematicViscosity:B({system:"kinematicViscosity",unit:"cSt",maxDecimals:2}),thermalConductivity:B({system:"thermalConductivity",unit:"W/(m·K)",maxDecimals:3}),specificHeat:B({system:"specificHeat",unit:"J/(kg·K)",maxDecimals:1}),doseRate:B({system:"doseRate",unit:"µSv/h",display:"auto",maxDecimals:2})})}),Ue("packages/core/src/columns/types/si.js",function(e,H){"use strict";Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return E}});const ne=H("packages/core/src/columns/types/unit.js"),$=ne.defineUnit,q=ne.registerUnitSystem,B=ne.createUnitType,x=Object.freeze([Object.freeze({symbol:"f",name:"femto",factor:1e-15}),Object.freeze({symbol:"p",name:"pico",factor:1e-12}),Object.freeze({symbol:"n",name:"nano",factor:1e-9}),Object.freeze({symbol:"µ",name:"micro",factor:1e-6}),Object.freeze({symbol:"m",name:"milli",factor:.001}),Object.freeze({symbol:"c",name:"centi",factor:.01}),Object.freeze({symbol:"",name:"",factor:1}),Object.freeze({symbol:"k",name:"kilo",factor:1e3}),Object.freeze({symbol:"M",name:"mega",factor:1e6}),Object.freeze({symbol:"G",name:"giga",factor:1e9}),Object.freeze({symbol:"T",name:"tera",factor:1e12}),Object.freeze({symbol:"P",name:"peta",factor:1e15})]),Z=Object.freeze(["p","n","µ","m","","k","M","G"]);function Y(O){const b=String(O.base),u=new Set([...O.prefixes||Z,""]),h=[];for(const l of x){if(!u.has(l.symbol))continue;const r=`${l.symbol}${b}`,n=[];if(O.name){n.push(`${l.name}${O.name}`,`${l.name}${O.name}s`);const o=l.name.slice(-1);if(o&&O.name.startsWith(o)){const i=`${l.name.slice(0,-1)}${O.name}`;n.push(i,`${i}s`)}}l.symbol==="µ"&&n.push(`u${b}`),l.factor===1&&O.aliases&&n.push(...O.aliases),h.push($(r,l.factor,n))}for(const l of O.extra||[])h.push(l);return h}function U(O,b){const u=Y(b);return q(O,u)}function W(O,b,u){return U(O,b),B({system:O,unit:b.base,display:"auto",maxDecimals:3,...u||{}})}const K=Object.freeze({voltage:W("voltage",{base:"V",name:"volt"}),current:W("current",{base:"A",name:"amp",aliases:["ampere","amperes"]}),resistance:W("resistance",{base:"Ω",name:"ohm",aliases:["ohm","ohms","R"],prefixes:["m","","k","M","G"]}),capacitance:W("capacitance",{base:"F",name:"farad",prefixes:["f","p","n","µ","m",""]}),inductance:W("inductance",{base:"H",name:"henry",prefixes:["p","n","µ","m",""]}),charge:W("charge",{base:"C",name:"coulomb",prefixes:["p","n","µ","m",""],extra:[$("mAh",3.6,["milliamphour","milliamphours"],{auto:!1}),$("Ah",3600,["amphour","amphours"],{auto:!1})]}),conductance:W("conductance",{base:"S",name:"siemens",prefixes:["n","µ","m","","k"]}),fluxDensity:W("fluxDensity",{base:"T",name:"tesla",prefixes:["n","µ","m",""],extra:[$("G",1e-4,["gauss"],{auto:!1})]}),luminousFlux:W("luminousFlux",{base:"lm",name:"lumen",prefixes:["m","","k"]}),illuminance:W("illuminance",{base:"lx",name:"lux",prefixes:["m","","k"]}),luminousIntensity:W("luminousIntensity",{base:"cd",name:"candela",prefixes:["m","","k"]}),substance:W("substance",{base:"mol",name:"mole",prefixes:["n","µ","m","","k"]}),absorbedDose:W("absorbedDose",{base:"Gy",name:"gray",prefixes:["µ","m",""]}),equivalentDose:W("equivalentDose",{base:"Sv",name:"sievert",prefixes:["n","µ","m",""]}),radioactivity:W("radioactivity",{base:"Bq",name:"becquerel",prefixes:["","k","M","G","T"],extra:[$("Ci",37e9,["curie","curies"],{auto:!1})]}),frequency:W("frequency",{base:"Hz",name:"hertz",prefixes:["m","","k","M","G","T"]})}),E=W}),Ue("packages/core/src/columns/types/temperature.js",function(e,H){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});const $=H("packages/core/src/internal/predicates.js").isNil,q=Object.freeze({C:Object.freeze({symbol:"°C",aliases:["c","°c","celsius","centigrade"],toKelvin:h=>h+273.15,fromKelvin:h=>h-273.15}),F:Object.freeze({symbol:"°F",aliases:["f","°f","fahrenheit"],toKelvin:h=>(h+459.67)*(5/9),fromKelvin:h=>h*(9/5)-459.67}),K:Object.freeze({symbol:"K",aliases:["k","kelvin"],toKelvin:h=>h,fromKelvin:h=>h}),R:Object.freeze({symbol:"°R",aliases:["r","°r","rankine"],toKelvin:h=>h*(5/9),fromKelvin:h=>h*(9/5)})});function B(h){if($(h))return null;const l=String(h).trim();if(l==="")return null;for(const[n,o]of Object.entries(q))if(l===n||l===o.symbol)return{key:n,scale:o};const r=l.toLowerCase();for(const[n,o]of Object.entries(q))if(o.aliases.includes(r))return{key:n,scale:o};return null}function x(h,l,r){const n=B(l),o=B(r);return!n||!o||!Number.isFinite(Number(h))?null:n.key===o.key?Number(h):o.scale.fromKelvin(n.scale.toKelvin(Number(h)))}const Z=new Map;function Y(h,l,r){const n=`${h||""}|${l}|${r}`;let o=Z.get(n);return o||(o=new Intl.NumberFormat(h||void 0,{minimumFractionDigits:l,maximumFractionDigits:r}),Z.set(n,o)),o}function U(h,l){const r=l||{},n=r.nullDisplay??"";if($(h)||h==="")return n;const o=Number(h);if(!Number.isFinite(o))return n;const i=B(r.scale||"C");if(!i)return String(o);const t=B(r.display||r.scale||"C")||i,c=t.key===i.key?o:t.scale.fromKelvin(i.scale.toKelvin(o)),s=typeof r.decimals=="number"?r.decimals:null,a=s??r.minDecimals??0,f=s??r.maxDecimals??1;return`${Y(r.locale,a,f).format(c)}${r.space??" "}${t.scale.symbol}`}const W=/^[+-]?[\d\s., ]*\d/;function K(h,l){const r=String(h).trim();if(r==="")return null;const n=new Intl.NumberFormat(l||void 0).formatToParts(1.1).find(c=>c.type==="decimal")?.value||".",o=n===","?".":",",i=r.split(o).join("").split(/[\s ]/).join("").replace(n,"."),t=Number(i);return Number.isFinite(t)?t:null}function E(h,l){if($(h))return null;const r=l||{},n=B(r.scale||"C");if(!n)return null;if(typeof h=="number")return Number.isFinite(h)?h:null;let o=String(h).trim();if(o==="")return null;let i=!1;o.startsWith("(")&&o.endsWith(")")&&(i=!0,o=o.slice(1,-1).trim());const t=W.exec(o);if(!t)return null;const c=K(t[0],r.locale);if(c===null)return null;const s=o.slice(t[0].length).trim();if(s==="")return i?-c:c;const a=B(s);if(!a)return null;const f=a.key===n.key?c:n.scale.fromKelvin(a.scale.toKelvin(c));return i?-f:f}function O(h){const l=Object.freeze({scale:"C",...h||{}}),n=(B(l.scale)||B("C")).scale.symbol,o=Object.freeze({...l,display:l.scale,decimals:void 0,minDecimals:0,maxDecimals:20}),i=new Map([[l.locale||"",l]]),t=c=>{const s=c||"";let a=i.get(s);return a||(a=Object.freeze({...l,locale:c||void 0}),i.set(s,a)),a};return{base:"number",extends:"number",storage:"float64",temperatureConfig:l,format:c=>U(c.value,c.locale?t(c.locale):l),parse:c=>E(c.text,c.locale?t(c.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)}`:".#"}" ${n}"`,toStorage:c=>typeof c=="number"?Number.isFinite(c)?c:null:typeof c=="string"?E(c,l):$(c)?null:E(String(c),l),toClipboard:c=>U(c,o),fromClipboard:c=>E(c,l)}}const b=Object.freeze({celsius:O({scale:"C"}),fahrenheit:O({scale:"F"}),kelvin:O({scale:"K"})}),u=O}),Ue("packages/core/src/columns/types/radix.js",function(e,H){"use strict";Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"digitsForWidth",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"radixRange",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"radixName",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"normaliseRadixOptions",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"compileRadixFormat",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"compileRadixParse",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"parseRadixResult",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return R}});const $=H("packages/core/src/internal/predicates.js").isNil,B=H("packages/core/src/internal/warn.js").warnOnce,x=Object.freeze({2:2,8:8,16:16,bin:2,binary:2,base2:2,oct:8,octal:8,base8:8,hex:16,hexadecimal:16,base16:16}),Z=Object.freeze({2:1,8:3,16:4}),Y=Object.freeze({2:"0b",8:"0o",16:"0x"}),U=Object.freeze({2:4,8:3,16:2}),W=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),K=Object.freeze({2:"binary",8:"octal",16:"hexadecimal"}),E=Object.freeze([[/^0x/i,16],[/^0b/i,2],[/^0o/i,8],[/^#/,16]]),O=/[\s\u00a0\u202f_,']/g,b=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,u=Object.freeze([8,16,32,53]),h=new WeakSet,l=new WeakMap,r=new Map,n=new WeakMap,o=new WeakMap,i=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 t(I){if(I==null)return 16;const j=typeof I=="string"?I.toLowerCase():I,L=x[j];return L||(B(`radix:base:${String(I)}`,`unsupported radix ${String(I)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function c(I,j){return Math.ceil(I/Z[j])}function s(I,j){if(!I)return j?{min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}:{min:0,max:Number.MAX_SAFE_INTEGER};if(!j)return{min:0,max:2**I-1};const L=2**(I-1);return{min:-L,max:L-1}}function a(I){return K[I]||"hexadecimal"}function f(I){if(typeof I=="string"){const j=i[I];return j||B(`radix:preset:${I}`,`unknown radix preset "${I}"; known presets are ${Object.keys(i).join(", ")}`),{...j||{}}}if(I&&typeof I.preset=="string"){const j=i[I.preset];return j||B(`radix:preset:${I.preset}`,`unknown radix preset "${I.preset}"; known presets are ${Object.keys(i).join(", ")}`),{...j||{},...I}}return I||{}}function w(I){const j=f(I),L=t(j.radix),F=Z[L];let N=null;if(j.bitWidth!==void 0&&j.bitWidth!==null&&j.bitWidth!==!1){const te=Number(j.bitWidth);u.includes(te)?N=te:B(`radix:width:${String(j.bitWidth)}`,`unsupported bitWidth ${String(j.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let S=j.signed!==!1;!S&&N===null&&(B("radix:unsigned:width","signed: false needs a bitWidth to render a two's-complement pattern; defaulting to 32"),N=32);const C=j.prefix===void 0||j.prefix===!0?Y[L]:j.prefix===!1?"":String(j.prefix);let D=0;j.pad===!0?D=N?c(N,L):0:typeof j.pad=="number"&&j.pad>0&&(D=Math.floor(j.pad));let G=0;j.group===!0?G=U[L]:typeof j.group=="number"&&j.group>0&&(G=Math.floor(j.group));const X=s(N,S),V=typeof j.min=="number"?Math.max(X.min,j.min):X.min,J=typeof j.max=="number"?Math.min(X.max,j.max):X.max,ee=Object.freeze({radix:L,bits:F,prefix:C,uppercase:j.uppercase!==!1,pad:D,group:G,groupSeparator:typeof j.groupSeparator=="string"?j.groupSeparator:" ",bitWidth:N,signed:S,min:V,max:J<V?V:J,nullDisplay:typeof j.nullDisplay=="string"?j.nullDisplay:"",name:a(L)});return h.add(ee),ee}function g(I){if(I&&h.has(I))return I;if(typeof I=="string"){let j=r.get(I);return j||(j=w(I),r.set(I,j)),j}if(I&&typeof I=="object"){let j=l.get(I);return j||(j=w(I),l.set(I,j)),j}return g("hex")}function k(I){return I<0?-Math.round(-I):Math.round(I)}function d(I,j,L){if(j<=0||I.length<=j)return I;const F=I.length%j||j,N=[I.slice(0,F)];for(let S=F;S<I.length;S+=j)N.push(I.slice(S,S+j));return N.join(L)}function p(I){const j=g(I),{radix:L,prefix:F,uppercase:N,pad:S,group:C,groupSeparator:D,signed:G,bitWidth:X,nullDisplay:V}=j,J=X?2**X:0,ee=te=>{if($(te)||te==="")return V;const ie=typeof te=="number"?te:Number(te);if(!Number.isFinite(ie))return V;const oe=k(ie);let ue="",ye=oe;oe<0&&(G?(ue="-",ye=-oe):ye=(oe%J+J)%J);let he=ye.toString(L);return he=N?he.toUpperCase():he.toLowerCase(),S>0&&he.length<S&&(he=he.padStart(S,"0")),C>0&&(he=d(he,C,D)),ue+F+he};return ee.options=j,ee}function m(I,j){const L=g(j);let F=n.get(L);return F||(F=p(L),n.set(L,F)),F(I)}function v(I){const j=g(I),{radix:L,groupSeparator:F,signed:N,min:S,max:C}=j,D=W[L],G=X=>{if($(X))return{ok:!0,value:null,reason:"blank"};let V=String(X);if(F&&F!==""&&(V=V.split(F).join("")),V=V.replace(O,""),V==="")return{ok:!0,value:null,reason:"blank"};let J=!1;if((V[0]==="-"||V[0]==="+")&&(J=V[0]==="-",V=V.slice(1)),V==="")return{ok:!1,value:null,reason:"digits"};let ee=null;for(const[ie,oe]of E){const ue=ie.exec(V);if(!ue)continue;const ye=V.slice(ue[0].length);if(ye==="")break;if(!W[oe].test(ye))return{ok:!1,value:null,reason:"digits"};ee=parseInt(ye,oe);break}if(ee===null)if(D.test(V))ee=parseInt(V,L);else if(b.test(V))ee=Number(V);else return{ok:!1,value:null,reason:"digits"};if(!Number.isFinite(ee))return{ok:!1,value:null,reason:"digits"};const te=k(J?-ee:ee);return!N&&te<0?{ok:!1,value:te,reason:"negative"}:te<S||te>C?{ok:!1,value:te,reason:"range"}:{ok:!0,value:te,reason:"ok"}};return G.options=j,G}function y(I,j){const L=g(j);let F=o.get(L);return F||(F=v(L),o.set(L,F)),F(I)}function T(I,j){const L=y(I,j);return L.ok?L.value:null}function A(I,j){const L=$(I)||Number.isNaN(I)?null:Number(I),F=$(j)||Number.isNaN(j)?null:Number(j);return L===null?F===null?0:1:F===null||L<F?-1:L>F?1:0}function M(I){const j=I.min>=-2147483648&&I.max<=2147483647;return I.bitWidth&&j?"int32":"float64"}function _(I){const j=w(I),L=p(j),F=v(j);return{base:"number",extends:"number",storage:M(j),matches:null,format:N=>L(N.value),parse:N=>{const S=F(N.text);return S.ok?S.value:null},compare:A,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:N=>L(N),fromClipboard:N=>{const S=F(N);return S.ok?S.value:null},radix:j,formatValue:L,parseText:F}}const R=_}),Ue("packages/core/src/columns/types/aggregable.js",function(e,H){"use strict";Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"weightedMean",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"logarithmicSum",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"logarithmicMean",{enumerable:!0,get:function(){return x}});const $=H("packages/core/src/internal/predicates.js").isNil;function q(K){const E=[];for(const O of K||[]){if($(O))continue;const b=Number(O);Number.isFinite(b)&&E.push(b)}return E}function B(K){return E=>{const O=q(E);if(!O.length)return null;let b=0;for(const u of O)b+=10**(u/K);return K*Math.log10(b)}}function x(K){return E=>{const O=q(E);if(!O.length)return null;let b=0;for(const u of O)b+=10**(u/K);return K*Math.log10(b/O.length)}}function Z(K,E){const O=E&&E.column,u=(O&&O.typeOptions||{}).weight,h=E&&E.valueAt;if(!u||typeof h!="function")return null;let l=0,r=0;for(let n=0;n<K.length;n++){if($(K[n]))continue;const o=Number(K[n]);if(!Number.isFinite(o))continue;const i=h(u,n);if($(i))continue;const t=Number(i);!Number.isFinite(t)||t<=0||(l+=o*t,r+=t)}return r===0?null:l/r}function Y(K={}){const E=K.factor===20?20:10,O=typeof K.suffix=="string"?K.suffix:"",b=Number.isInteger(K.decimals)?K.decimals:1;return{base:"number",storage:"float64",name:K.name||"logarithmic",format:u=>{const h=u&&u.value;return $(h)||!Number.isFinite(Number(h))?"":`${Number(h).toFixed(b)}${O}`},parse:u=>{const h=String((u&&u.text)??"").replace(O,"").trim();if(!h)return null;const l=Number(h);return Number.isFinite(l)?l:null},defaults:{align:"end",filter:"number"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:{sum:B(E),avg:x(E)}}}}function U(K={}){const E=Number.isInteger(K.decimals)?K.decimals:1,O=K.percent===!0;return{base:"number",storage:"float64",name:K.name||"ratio",format:b=>{const u=b&&b.value;return $(u)||!Number.isFinite(Number(u))?"":O?`${Number(u).toFixed(E)}%`:Number(u).toFixed(E)},parse:b=>{const u=String((b&&b.text)??"").replace("%","").trim();if(!u)return null;const h=Number(u);return Number.isFinite(h)?h:null},defaults:{align:"end",filter:"number"},totals:{supported:["avg","min","max","count","countValues"],implement:{avg:Z}}}}const W=Object.freeze({decibel:Y({name:"decibel",factor:10,suffix:" dB"}),decibelAmplitude:Y({name:"decibelAmplitude",factor:20,suffix:" dB"}),ratio:U({name:"ratio"}),percentRate:U({name:"percentRate",percent:!0})})}),Ue("packages/core/src/columns/types/currency.js",function(e,H){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return h}}),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 o}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});const $=H("packages/core/src/internal/predicates.js").isNil,q="⚠ no rate";function B(c){if($(c))return null;const s=String(c).trim().toUpperCase();return s===""?null:s}function x(c){if($(c))return null;if(typeof c=="object"&&!Array.isArray(c)){const s=Number(c.amount),a=B(c.code);return!a||!Number.isFinite(s)?null:{amount:s,code:a}}if(Array.isArray(c)&&c.length===2){const s=Number(c[0]),a=B(c[1]);return!a||!Number.isFinite(s)?null:{amount:s,code:a}}return null}const Z=Object.freeze({$:"USD","€":"EUR","£":"GBP","¥":"JPY","₹":"INR","₩":"KRW","₽":"RUB","₺":"TRY","₴":"UAH","₪":"ILS"}),Y=Object.freeze({USD:"$",EUR:"€",GBP:"£",JPY:"¥",INR:"₹",KRW:"₩",RUB:"₽",TRY:"₺",UAH:"₴",ILS:"₪"}),U=/[+-]?[\d\s., ]*\d/;function W(c,s){const a=String(c).trim();if(a==="")return null;const f=new Intl.NumberFormat(s||void 0).formatToParts(1.1).find(d=>d.type==="decimal")?.value||".",w=f===","?".":",",g=a.split(w).join("").split(/[\s ]/).join("").replace(f,"."),k=Number(g);return Number.isFinite(k)?k:null}function K(c,s){const a=s||{},f=B(a.code);if($(c))return null;const w=x(c);if(w)return w;if(typeof c=="number")return Number.isFinite(c)&&f?{amount:c,code:f}:null;let g=String(c).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[A,M]of Object.entries(Z)){if(g.startsWith(A)){d=M,g=g.slice(A.length).trim();break}if(g.endsWith(A)){d=M,g=g.slice(0,-A.length).trim();break}}const p=U.exec(g);if(!p)return null;const m=W(p[0],a.locale);if(m===null)return null;const v=(g.slice(0,p.index)+" "+g.slice(p.index+p[0].length)).trim();!d&&v!==""&&(d=B(v));const y=d||f;return y?{amount:k?-m:m,code:y}:null}function E(c,s){if(typeof c=="function")return(a,f)=>{if(a===f)return 1;const w=c(a,f);return typeof w=="number"&&Number.isFinite(w)&&w>0?w:null};if(c&&typeof c=="object"){const a=c;return(f,w)=>{if(f===w)return 1;const g=Number(a[f]),k=Number(a[w]);return!Number.isFinite(g)||!Number.isFinite(k)||g<=0||k<=0?null:k/g}}return(a,f)=>a===f?1:null}function O(c,s,a){if(!c)return null;if(c.code===s)return c.amount;const f=a(c.code,s);return f===null?null:c.amount*f}const b=new Map;function u(c,s,a){const f=`${c||""}|${s}|${a??""}`;let w=b.get(f);if(!w){const g={style:"currency",currency:s};typeof a=="number"&&(g.minimumFractionDigits=a,g.maximumFractionDigits=a);try{w={fmt:new Intl.NumberFormat(c||void 0,g),currency:!0}}catch{w={fmt:new Intl.NumberFormat(c||void 0,typeof a=="number"?{minimumFractionDigits:a,maximumFractionDigits:a}:{}),currency:!1}}b.set(f,w)}return w}function h(c,s){const a=s||{},f=a.nullDisplay??"",w=x(c);if(!w)return f;const g=B(a.display)||w.code;let k=w.amount,d=w.code;if(g!==w.code){const v=a.rateFn||E(a.rates,a.rateBase),y=O(w,g,v);if(y===null)return`${a.missingRate??q} ${w.code}→${g}`;k=y,d=g}const{fmt:p,currency:m}=u(a.locale,d,a.decimals);return m?p.format(k):`${p.format(k)} ${d}`}function l(c){const s=x(c);return s?`${s.amount} ${s.code}`:""}function r(c){const s=c||{},a=B(s.display),f=s.rateFn||E(s.rates,s.rateBase);return(w,g)=>{const k=x(w),d=x(g);if(!k&&!d)return 0;if(!k)return 1;if(!d)return-1;if(a){const p=O(k,a,f),m=O(d,a,f);if(p!==null&&m!==null)return p===m?0:p<m?-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 n(c){const s=c||{},a=(w,g)=>{const k=[];for(const y of w||[]){const T=x(y);T&&k.push(T)}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(T=>T.amount)),code:y}}const p=B(s.display);if(!p)return`${s.missingRate??q}: mixed currencies, no display currency set`;const m=s.rateFn||E(s.rates,s.rateBase),v=[];for(const y of k){const T=O(y,p,m);if(T===null)return`${s.missingRate??q}: ${y.code}→${p}`;v.push(T)}return{amount:g(v),code:p}},f=w=>w.reduce((g,k)=>g+k,0);return{sum:w=>a(w,f),avg:w=>a(w,g=>f(g)/g.length),min:w=>a(w,g=>Math.min(...g)),max:w=>a(w,g=>Math.max(...g))}}function o(c){const s=Object.freeze({code:"USD",...c||{}}),a=E(s.rates,s.rateBase),f=Object.freeze({...s,rateFn:a}),w=n(f),g=r(f),k=new Map([[s.locale||"",f]]),d=v=>{const y=v||"";let T=k.get(y);return T||(T=Object.freeze({...f,locale:v||void 0}),k.set(y,T)),T},p=Y[B(s.display||s.code)]||"",m=typeof s.decimals=="number"&&s.decimals>0?`.${"0".repeat(s.decimals)}`:".00";return{base:"object",extends:"object",storage:"object",name:"currency",currencyConfig:f,format:v=>h(v.value,v.locale?d(v.locale):f),parse:v=>K(v.text,v.locale?d(v.locale):f),compare:g,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:w},excel:s.excel||(p?`"${p}"#,##0${m}`:`#,##0${m}`),toStorage:v=>{const y=x(v);return y||(typeof v=="string"||typeof v=="number"?K(v,f):null)},toClipboard:v=>l(v),fromClipboard:v=>K(v,f)}}const i=Object.freeze({currency:o({code:"USD"}),usd:o({code:"USD"}),eur:o({code:"EUR"}),gbp:o({code:"GBP"}),jpy:o({code:"JPY",decimals:0})}),t=o}),Ue("packages/core/src/columns/types/index.js",function(e,H){"use strict";Object.defineProperty(e,"EXTENDED_TYPES",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return A}});const ne=H("packages/core/src/columns/types/temporal.js"),$=ne.TEMPORAL_TYPES,q=H("packages/core/src/columns/types/network.js"),B=q.NETWORK_TYPES,x=H("packages/core/src/columns/types/structured.js"),Z=x.STRUCTURED_TYPES,Y=H("packages/core/src/columns/types/unit.js"),U=Y.createUnitType,W=Y.UNIT_SYSTEMS,K=Y.parseUnit,E=Y.formatUnit,O=Y.registerUnitSystem,b=Y.unitSystemNames,u=Y.unitsOf,h=Y.defineUnit,l=H("packages/core/src/columns/types/engineering.js"),r=l.ENGINEERING_TYPES,n=H("packages/core/src/columns/types/si.js"),o=n.SI_TYPES,i=n.createSiType,t=n.createSiSystem,c=n.siUnits,s=n.SI_PREFIXES,a=H("packages/core/src/columns/types/temperature.js"),f=a.TEMPERATURE_TYPES,w=a.createTemperatureType,g=a.convertTemperature,k=a.formatTemperature,d=a.parseTemperature,p=a.TEMPERATURE_SCALES,m=H("packages/core/src/columns/types/radix.js"),v=m.createRadixType,y=m.RADIX_PRESETS,T=m.parseRadix,A=m.formatRadix,M=H("packages/core/src/columns/types/aggregable.js"),_=M.AGGREGABLE_TYPES,R=H("packages/core/src/columns/types/currency.js"),I=R.CURRENCY_TYPES,j=R.createCurrencyType,L=R.parseMoney,F=R.formatMoney,N=R.convertMoney,S=R.toMoney,C=R.rateFunction,D=R.moneyComparator,G=R.normaliseCode,X=R.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return Y.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 R.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return R.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return R.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return R.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return R.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return R.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return R.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return R.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return R.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return R.MISSING_RATE}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return ne.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 x.STRUCTURED_TYPES}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return M.AGGREGABLE_TYPES}}),Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return M.createLogarithmicType}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return M.createRatioType}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return ne.parseTime}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return ne.formatTime}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return ne.parseDateTime}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return ne.formatDateTime}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return ne.parseDuration}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return ne.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 x.maskValue}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return x.summariseJson}});const V=Object.freeze({...$,...B,...Z,..._,hex:v(y.hex),hex8:v(y.hex8),hex16:v(y.hex16),hex32:v(y.hex32),binary:v(y.binary),binary8:v(y.binary8),octal:v(y.octal),bytes:U({system:"data",unit:"B",display:"auto"}),megabytes:U({system:"data",unit:"MB"}),gigabytes:U({system:"data",unit:"GB"}),bitrate:U({system:"bitrate",unit:"Mbps"}),gigabits:U({system:"bitrate",unit:"Gbps"}),...r,...o,...f,...I});{const J=new Set;for(const ee of[$,B,Z,_,r,o,f,I])for(const te of Object.keys(ee)){if(J.has(te))throw new Error(`[lattice] data type "${te}" is declared twice`);J.add(te)}}}),Ue("packages/core/src/compute/handle.js",function(e,H){"use strict";Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return h}}),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 n}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return o}});const ne=H("packages/core/src/internal/compare.js"),$=ne.collator,q=ne.defaultCompare,x=H("packages/core/src/internal/warn.js").warnOnce;function Z(i){const t=new Uint32Array(i);for(let c=0;c<i;c++)t[c]=c;return t}function Y(i,t){if(t&&typeof t.count=="number")return t.count;if(!i)return 0;if(typeof i.count=="number")return i.count;if(typeof i.length=="number")return i.length;const c=i.values;return i.kind==="multi"&&i.offsets?Math.max(0,i.offsets.length-1):c?i.kind==="bitset"?typeof c.size=="number"?c.size:i.presence&&typeof i.presence.size=="number"?i.presence.size:(x(`count:${i.id}`,`column "${i.id}" is bitset-backed with no declared row count; assuming ${c.length*8}`),c.length*8):c.length:i.presence&&typeof i.presence.size=="number"?i.presence.size:0}const U=new WeakMap;function W(i){const t=i.constructor;if(!t)return"unknown";const c=U.get(t);if(c)return c;let s="unknown";try{let a=null;typeof t.from=="function"?a=t.from([!1,!0]):(a=new t(8),a.set(1));const f=a&&a.words;f&&f.length&&(f[0]===2?s="lsb":f[0]===64&&(s="msb"))}catch{s="unknown"}return U.set(t,s),s}function K(i){if(!i)return()=>0;const t=i instanceof Uint8Array?i:i.words;if(t instanceof Uint8Array){const c=i instanceof Uint8Array?"lsb":W(i);if(c==="lsb")return s=>t[s>>>3]>>>(s&7)&1;if(c==="msb")return s=>t[s>>>3]>>>7-(s&7)&1}return typeof i.get=="function"?c=>i.get(c)?1:0:()=>0}function E(i){return!i||!i.presence?null:K(i.presence)}function O(i){return i?typeof i.size=="number"?i.size:typeof i.values=="function"?i.values().length:0:0}function b(i,t){return i?typeof i.valueOf=="function"?i.valueOf(t):typeof i.values=="function"?i.values()[t]:null:null}function u(i,t){const c=i.offsets,s=i.values;if(!c||!s)return[];const a=c[t],f=c[t+1];if(!(f>a))return[];const w=i.dict,g=new Array(f-a);for(let k=a;k<f;k++)g[k-a]=w?b(w,s[k]):s[k];return g}function h(i){if(!i)return()=>{};const t=i.values,c=E(i),s=i.kind;if(s==="dictionary"){const a=i.dict;return c?f=>c(f)?b(a,t[f]):null:f=>b(a,t[f])}if(s==="bitset"){const a=K(t);return c?f=>c(f)?a(f)===1:null:f=>a(f)===1}if(s==="multi")return c?a=>c(a)?u(i,a):null:a=>u(i,a);if(!t&&typeof i.get=="function"){const a=i.get.bind(i);return f=>{const w=a(f);return w===void 0?null:w}}return c?a=>{if(!c(a))return null;const f=t[a];return f===void 0?null:f}:a=>{const f=t[a];return f===void 0?null:f}}function l(i,t){if(i<t)return-1;if(i>t)return 1;if(i===t){const a=Object.is(i,-0),f=Object.is(t,-0);return a===f?0:a?-1:1}const c=Number.isNaN(i),s=Number.isNaN(t);return c&&s?0:c?1:-1}function r(i){const t=$(i);return(c,s)=>{if(c===s)return 0;const a=typeof c,f=typeof s;if(a==="string"&&f==="string")return t.compare(c,s);if(a==="number"&&f==="number")return l(c,s);if(a==="boolean"&&f==="boolean")return c===s?0:c?1:-1;if(c instanceof Date||s instanceof Date){const w=c instanceof Date?c.getTime():Number(c),g=s instanceof Date?s.getTime():Number(s);return l(w,g)}return q(c,s)}}function n(i,t){if(i&&typeof i.ranks=="function")return i.ranks(t);const c=i&&typeof i.values=="function"?i.values():[],s=c.length,a=r(t),f=new Array(s);for(let g=0;g<s;g++)f[g]=g;f.sort((g,k)=>a(c[g],c[k])||g-k);const w=new Uint32Array(s);for(let g=0;g<s;g++)w[f[g]]=g;return w}function o(i){return i==null||typeof i=="number"&&Number.isNaN(i)}}),Ue("packages/core/src/compute/filter.js",function(e,H){"use strict";Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"wallMs",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return ye}});const $=H("packages/core/src/internal/predicates.js").isBlank,B=H("packages/core/src/internal/merge.js").toArray,Z=H("packages/core/src/internal/warn.js").warnOnce,Y=H("packages/core/src/format/date.js"),U=Y.toDate,W=Y.toIsoDate,K=H("packages/core/src/compute/handle.js"),E=K.bitReader,O=K.dictSize,b=K.dictValue,u=K.presenceReader,h=K.valueComparator,l=K.valueReader,r=/^\d{4}-\d{2}-\d{2}$/,n="\0null\0";function o(he,Re){const Ce=he&&he.pool;if(Ce){const we=Ce.mask||Ce.acquireMask||Ce.acquire||Ce.take;if(typeof we=="function"){const re=we.call(Ce,Re);if(re&&re.length>=Re)return re}}return new Uint8Array(Re)}function i(he,Re){const Ce=he&&he.pool;if(!Ce||!Re)return;const we=Ce.release||Ce.releaseMask||Ce.free||Ce.recycle;typeof we=="function"&&we.call(Ce,Re)}function t(he,Re,Ce){return he.fill(Ce,0,Re),he}function c(he){return he==null||typeof he=="number"&&Number.isNaN(he)}function s(he,Re){if(he==null)return he;if(Re==="number")return typeof he=="number"?he:Number(he);if(Re==="date"||Re==="dateString"){const Ce=W(he);return Ce===null?a(he):Ce}return Re==="boolean"?typeof he=="boolean"?he:he==="true"||he===1?!0:he==="false"||he===0?!1:!!he:he}function a(he){return he instanceof Date?he.getTime():typeof he=="number"?he:Date.parse(String(he))}function f(he){return typeof he=="number"?he:he instanceof Date?he.getTime():he==null||he===""?NaN:Number(he)}function w(he,Re){const Ce=typeof he=="string"?he:String(he);return Re?Ce:Ce.toLowerCase()}function g(he,Re){return he==null?n:typeof he=="string"?Re?he:he.toLowerCase():he instanceof Date?he.getTime():he}function k(he,Re,Ce){const we=new Set;for(const re of B(he)){const de=s(re,Ce);we.add(g(de,Re)),typeof de=="string"&&de!==""&&Number.isFinite(Number(de))?we.add(Number(de)):typeof de=="number"&&Number.isFinite(de)&&we.add(g(String(de),Re))}return we}function d(he,Re,Ce){if(he==null||Re===null||Re===void 0)return he==null&&Re==null;const we=typeof he,re=typeof Re;return we==="string"&&re==="string"?Ce?he===Re:he.toLowerCase()===Re.toLowerCase():he instanceof Date||Re instanceof Date?a(he)===a(Re):we==="number"&&re==="number"?he===Re||Number.isNaN(he)&&Number.isNaN(Re):we==="number"&&re==="string"?he===Number(Re):we==="string"&&re==="number"?Number(he)===Re:we==="boolean"||re==="boolean"?he===Re:Array.isArray(he)&&Array.isArray(Re)?he.length===Re.length&&he.every((de,me)=>d(de,Re[me],Ce)):he===Re}function p(he,Re){try{if(he instanceof RegExp){const Ce=he.flags.replace(/[gy]/g,"");return new RegExp(he.source,Re||Ce.includes("i")?Ce:`${Ce}i`)}return new RegExp(String(he),Re?"":"i")}catch(Ce){return Z(`regex:${String(he)}`,`filter operator "matches" received an invalid pattern: ${String(he)}`,Ce),null}}function m(he,Re){if(he&&he.type==="datetime"&&v.has(he.op))return _(he,Re);const Ce=R(he,Re),we=he&&he.type;return we!=="date"&&we!=="dateString"?Ce:re=>Ce(typeof re=="string"&&r.test(re)?re:W(re)??re)}const v=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*)?)?)?$/,T=new Map;function A(he,Re){let Ce=T.get(Re);if(Ce===void 0){try{Ce=new Intl.DateTimeFormat("en-CA",{timeZone:Re,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{Ce=null}T.set(Re,Ce)}if(!Ce)return null;const we={};for(const re of Ce.formatToParts(he))re.type!=="literal"&&(we[re.type]=re.value);return we}function M(he,Re){if(he==null||he==="")return null;if(typeof he=="string"){const de=y.exec(he.trim());if(de)return Date.UTC(+de[1],+de[2]-1,+de[3],+(de[4]||0),+(de[5]||0),+(de[6]||0),+(de[7]||"0").padEnd(3,"0"))}const Ce=U(he);if(!Ce)return null;const we=Ce.getUTCMilliseconds(),re=Re?A(Ce,Re):null;return re?Date.UTC(+re.year,+re.month-1,+re.day,re.hour==="24"?0:+re.hour,+re.minute,+re.second,we):Date.UTC(Ce.getFullYear(),Ce.getMonth(),Ce.getDate(),Ce.getHours(),Ce.getMinutes(),Ce.getSeconds(),we)}function _(he,Re){const Ce=typeof he.timeZone=="string"&&he.timeZone?he.timeZone:void 0,we=me=>M(me,Ce),re=Array.isArray(he.value)?he.value.map(we):we(he.value),de=R({...he,type:"number",value:re},Re);return me=>de(M(me))}function R(he,Re){const Ce=he&&he.op,we=!!(he&&he.caseSensitive),re=he&&he.type,de=h(Re),me=Oe=>ke=>!Oe(ke);switch(Ce){case"eq":{const Oe=s(he.value,re);return ke=>d(ke,Oe,we)}case"ne":{const Oe=s(he.value,re);return ke=>!d(ke,Oe,we)}case"lt":case"lte":case"gt":case"gte":{const Oe=s(he.value,re);if(c(Oe))return()=>!1;const ke=Ce==="lt"?-1:Ce==="lte"?0:Ce==="gt"?1:2;return Le=>{if(c(Le))return!1;const ce=de(Le,Oe);return ke===-1?ce<0:ke===0?ce<=0:ke===1?ce>0:ce>=0}}case"between":case"notBetween":{const Oe=B(he.value),ke=s(Oe[0],re),Le=s(Oe[1],re),ce=he.bounds||"[]",ge=ce.charAt(0)!=="(",Se=ce.charAt(1)!==")";if(c(ke)||c(Le))return Ce==="between"?()=>!1:()=>!0;const Fe=be=>{if(c(be))return!1;const Ie=de(be,ke),He=de(be,Le);return(ge?Ie>=0:Ie>0)&&(Se?He<=0:He<0)};return Ce==="between"?Fe:me(Fe)}case"in":case"notIn":{const Oe=k(he.value,we,re),ke=Le=>Oe.has(g(Le,we));return Ce==="in"?ke:me(ke)}case"contains":case"notContains":{const Oe=w(s(he.value,re),we),ke=Le=>Le==null?!1:w(Le,we).includes(Oe);return Ce==="contains"?ke:me(ke)}case"startsWith":{const Oe=w(s(he.value,re),we);return ke=>ke==null?!1:w(ke,we).startsWith(Oe)}case"endsWith":{const Oe=w(s(he.value,re),we);return ke=>ke==null?!1:w(ke,we).endsWith(Oe)}case"matches":{const Oe=p(he.value,we);return Oe?ke=>ke==null?!1:Oe.test(String(ke)):()=>!1}case"blank":return Oe=>$(Oe)||Array.isArray(Oe)&&Oe.length===0;case"notBlank":return Oe=>!($(Oe)||Array.isArray(Oe)&&Oe.length===0);case"containsAny":case"containsNone":{const Oe=k(he.value,we,re),ke=Le=>{const ce=Le==null?[]:B(Le);for(let ge=0;ge<ce.length;ge++)if(Oe.has(g(ce[ge],we)))return!0;return!1};return Ce==="containsAny"?ke:me(ke)}case"containsAll":{const Oe=B(he.value).map(ke=>g(s(ke,re),we));return ke=>{const Le=ke==null?[]:B(ke);if(Oe.length===0)return!0;const ce=new Set(Le.map(ge=>g(ge,we)));for(let ge=0;ge<Oe.length;ge++)if(!ce.has(Oe[ge]))return!1;return!0}}default:{const Oe=ye(Ce);return Oe?Oe.compile(he.value):(Z(`op:${String(Ce)}`,`unknown filter operator "${String(Ce)}"; the condition is refused rather than matching every row`),()=>!1)}}}function I(he,Re,Ce){return m(Re,Ce)(he)}const j=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),L=new Set(["containsAny","containsAll","containsNone"]);function F(he,Re,Ce){const we=he&&he.op,re=j[we]||we,de=m({...he,op:re,type:Re.type},Ce),me=Re.items,Oe=ke=>{const Le=me(ke);if(!Le)return!1;for(let ce=0;ce<Le.length;ce++)if(de(Le[ce]))return!0;return!1};return j[we]?ke=>!Oe(ke):Oe}function N(he,Re,Ce,we){const re=u(he);if(re){const Oe=Re?1:0;for(let ke=0;ke<we;ke++)Ce[ke]=re(ke)===Oe?1:0;return Ce}const de=he.kind;if(de==="float64"||de==="int32"||de==="bitset")return t(Ce,we,Re?1:0);const me=l(he);for(let Oe=0;Oe<we;Oe++){const ke=me(Oe),Le=$(ke)||Array.isArray(ke)&&ke.length===0;Ce[Oe]=Le===Re?0:1}return Ce}function S(he,Re,Ce,we){const re=he.dict,de=O(re),me=new Uint8Array(de);for(let ce=0;ce<de;ce++)me[ce]=Re(b(re,ce))?1:0;const Oe=he.values,ke=u(he);if(!ke){for(let ce=0;ce<we;ce++)Ce[ce]=me[Oe[ce]];return Ce}const Le=Re(null)?1:0;for(let ce=0;ce<we;ce++)Ce[ce]=ke(ce)===1?me[Oe[ce]]:Le;return Ce}function C(he,Re,Ce,we){const re=E(he.values),de=Re(!0)?1:0,me=Re(!1)?1:0,Oe=u(he);if(!Oe){for(let Le=0;Le<we;Le++)Ce[Le]=re(Le)===1?de:me;return Ce}const ke=Re(null)?1:0;for(let Le=0;Le<we;Le++)Ce[Le]=Oe(Le)===0?ke:re(Le)===1?de:me;return Ce}function D(he,Re,Ce,we,re){const de=he.values,me=Re.type,Oe=Re.op;let ke=!0;switch(Oe){case"eq":case"ne":{const ce=f(s(Re.value,me)),ge=typeof Re.value=="number"&&Number.isNaN(Re.value),Se=Oe==="ne"?1:0;if(ge)for(let Fe=0;Fe<re;Fe++)we[Fe]=(Number.isNaN(de[Fe])?1:0)^Se;else for(let Fe=0;Fe<re;Fe++)we[Fe]=(de[Fe]===ce?1:0)^Se;break}case"lt":{const ce=f(s(Re.value,me));for(let ge=0;ge<re;ge++)we[ge]=de[ge]<ce?1:0;break}case"lte":{const ce=f(s(Re.value,me));for(let ge=0;ge<re;ge++)we[ge]=de[ge]<=ce?1:0;break}case"gt":{const ce=f(s(Re.value,me));for(let ge=0;ge<re;ge++)we[ge]=de[ge]>ce?1:0;break}case"gte":{const ce=f(s(Re.value,me));for(let ge=0;ge<re;ge++)we[ge]=de[ge]>=ce?1:0;break}case"between":case"notBetween":{const ce=B(Re.value),ge=f(s(ce[0],me)),Se=f(s(ce[1],me)),Fe=Re.bounds||"[]",be=Fe.charAt(0)!=="(",Ie=Fe.charAt(1)!==")",He=Oe==="notBetween"?1:0;if(be&&Ie)for(let Ge=0;Ge<re;Ge++)we[Ge]=(de[Ge]>=ge&de[Ge]<=Se?1:0)^He;else if(be)for(let Ge=0;Ge<re;Ge++)we[Ge]=(de[Ge]>=ge&de[Ge]<Se?1:0)^He;else if(Ie)for(let Ge=0;Ge<re;Ge++)we[Ge]=(de[Ge]>ge&de[Ge]<=Se?1:0)^He;else for(let Ge=0;Ge<re;Ge++)we[Ge]=(de[Ge]>ge&de[Ge]<Se?1:0)^He;break}case"in":case"notIn":{const ce=new Set;for(const Se of B(Re.value)){const Fe=f(s(Se,me));Number.isNaN(Fe)||ce.add(Fe)}const ge=Oe==="notIn"?1:0;for(let Se=0;Se<re;Se++)we[Se]=(ce.has(de[Se])?1:0)^ge;break}default:ke=!1;break}if(!ke)return!1;const Le=u(he);if(Le){const ce=Ce(null)?1:0;for(let ge=0;ge<re;ge++)Le(ge)===0&&(we[ge]=ce)}return!0}function G(he,Re,Ce,we){const re=l(he);for(let de=0;de<we;de++)Ce[de]=Re(re(de))?1:0;return Ce}function X(he,Re,Ce){const we=Re.count|0,re=Ce||o(Re,we);if(!he)return t(re,we,1);const de=typeof Re.handle=="function"?Re.handle(he.col):void 0,me=typeof Re.custom=="function"?Re.custom:null;if(!de){if(me){for(let ce=0;ce<we;ce++)re[ce]=me(he,ce)?1:0;return re}return Z(`filter:col:${String(he.col)}`,`filter references unknown column "${String(he.col)}"; the condition is refused rather than matching every row`),t(re,we,0)}const Oe=he.op;if(Oe==="blank"||Oe==="notBlank")return N(de,Oe==="notBlank",re,we);const ke=typeof Re.itemwise=="function"?Re.itemwise(he.col):null;if(ke&&!ye(Oe)&&!L.has(Oe))return G(de,F(he,ke,Re.locale),re,we);const Le=m(he,Re.locale);switch(de.kind){case"dictionary":return S(de,Le,re,we);case"bitset":return C(de,Le,re,we);case"float64":case"int32":return D(de,he,Le,re,we)?re:G(de,Le,re,we);default:return G(de,Le,re,we)}}function V(he,Re,Ce){if(!he)return t(o(Re,Ce),Ce,1);if(Array.isArray(he.conditions)){const we=he.conditions.filter(me=>me!=null),re=he.op==="or"?"or":he.op==="not"?"not":"and";if(we.length===0)return t(o(Re,Ce),Ce,1);const de=V(we[0],Re,Ce);for(let me=1;me<we.length;me++){const Oe=V(we[me],Re,Ce);if(re==="or")for(let ke=0;ke<Ce;ke++)de[ke]|=Oe[ke];else for(let ke=0;ke<Ce;ke++)de[ke]&=Oe[ke];i(Re,Oe)}if(re==="not")for(let me=0;me<Ce;me++)de[me]^=1;return de}return X(he,Re,o(Re,Ce))}function J(he,Re){return V(he,Re,Re.count|0)}function ee(he,Re){if(!he||!Re)return he||null;const Ce=he;if(Array.isArray(Ce.conditions)){if((Ce.op==="or"?"or":Ce.op==="not"?"not":"and")!=="and")return te(Ce,Re)?null:he;const re=[];for(const de of Ce.conditions){const me=ee(de,Re);me&&re.push(me)}return re.length?{...Ce,op:"and",conditions:re}:null}return Ce.col===Re?null:he}function te(he,Re){if(!he||typeof he!="object")return!1;const Ce=he;if(Ce.col===Re)return!0;if(Array.isArray(Ce.conditions)){for(const we of Ce.conditions)if(te(we,Re))return!0}return!1}function ie(he,Re,Ce){if(Ce&&Ce.length>=Re){let me=0;for(let Oe=0;Oe<Re;Oe++)he[Oe]&&(Ce[me++]=Oe);return Ce.subarray(0,me)}let we=0;for(let me=0;me<Re;me++)we+=he[me]?1:0;const re=new Uint32Array(we);let de=0;for(let me=0;me<Re;me++)he[me]&&(re[de++]=me);return re}const oe=new Map;function ue(he){if(!(!he||typeof he!="object"))for(const[Re,Ce]of Object.entries(he))Ce&&typeof Ce.compile=="function"&&oe.set(Re,Ce)}function ye(he){return typeof he=="string"?oe.get(he):void 0}}),Ue("packages/core/src/columns/datatypes.js",function(e,H){"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 M}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return F}});const ne=H("packages/core/src/internal/compare.js"),$=ne.collator,q=ne.defaultCompare,B=H("packages/core/src/internal/predicates.js"),x=B.isNil,Z=B.isObject,Y=B.isFunction,W=H("packages/core/src/internal/warn.js").fail,E=H("packages/core/src/internal/text.js").titleCase,O=H("packages/core/src/format/date.js"),b=O.toDate,u=O.toIsoDate,h=O.compareIso,r=H("packages/core/src/format/boolean.js").toTriState,o=H("packages/core/src/columns/types/index.js").EXTENDED_TYPES,i=H("packages/core/src/formula/index.js"),t=i.evaluateFormula,c=i.looksLikeFormula,a=H("packages/core/src/compute/filter.js").declareOperators,f=/^\d{4}-\d{2}-\d{2}$/;function w(N){return N.getHours()===0&&N.getMinutes()===0&&N.getSeconds()===0&&N.getMilliseconds()===0}const g=new Map;function k(N){const S=N||"",C=g.get(S);if(C)return C;const D={group:",",decimal:"."};try{for(const G of new Intl.NumberFormat(N||void 0).formatToParts(12345.6))G.type==="group"?D.group=G.value:G.type==="decimal"&&(D.decimal=G.value)}catch{}return g.set(S,D),D}const d=/\d\s*[*/^]\s*[\d.(]/;function p(N,S){if(x(N))return null;let C=String(N).trim();if(C===""||C.startsWith("=")||d.test(C))return null;let D=1;C.startsWith("(")&&C.endsWith(")")&&(D=-1,C=C.slice(1,-1));const G=C.endsWith("%"),{group:X,decimal:V}=k(S);if(C=C.replace(/[\s\u00a0\u202f\u2009']/g,""),X&&X!=="."&&X!==","&&(C=C.split(X).join("")),C=C.replace(/[^0-9eE+\-.,]/g,""),V===","?C=C.split(".").join("").replace(",","."):C=C.split(",").join(""),C===""||C==="-"||C==="+")return null;const J=Number(C);return Number.isNaN(J)?null:D*(G?J/100:J)}function m(N,S){const C=x(N)||Number.isNaN(N)?null:Number(N),D=x(S)||Number.isNaN(S)?null:Number(S);return C===null?D===null?0:1:D===null||C<D?-1:C>D?1:0}function v(N,S){const C=r(N),D=r(S);return C===null?D===null?0:1:D===null?-1:C===D?0:C?1:-1}function y(N,S){const C=b(N),D=b(S);if(!C)return D?1:0;if(!D)return-1;const G=C.getTime(),X=D.getTime();return G<X?-1:G>X?1:0}const T=new Map;function A(N){const S=b(N.value);if(!S)return"";const C=N.locale||"";let D=T.get(C);return D||(D=new Intl.DateTimeFormat(N.locale||void 0,{dateStyle:"medium"}),T.set(C,D)),D.format(S)}const M={boolean:{base:"boolean",storage:"bitset",matches:N=>typeof N=="boolean",parse:N=>r(N.text),compare:v,format:N=>r(N.value)===null?"":r(N.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:N=>r(N)===null?"":String(r(N)),fromClipboard:N=>r(N)},number:{base:"number",storage:"float64",matches:N=>typeof N=="number"&&!Number.isNaN(N),parse:N=>{if(c(N.text)){const S=t(N.text,N);if(!S.ok)return null;const C=Number(S.value);return Number.isFinite(C)?C:null}return p(N.text,N.locale)},compare:m,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:N=>x(N)?"":String(N),fromClipboard:(N,S)=>p(N,S&&S.locale)},date:{base:"dateString",storage:"dictionary",matches:N=>typeof N=="string"&&f.test(N)&&!Number.isNaN(Date.parse(N))||N instanceof Date&&!Number.isNaN(N.getTime())&&w(N),parse:N=>u(N.text),compare:h,format:A,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:N=>u(N),toClipboard:N=>x(N)?"":String(N),fromClipboard:N=>u(N)},dateString:{base:"dateString",storage:"dictionary",matches:N=>typeof N=="string"&&f.test(N)&&!Number.isNaN(Date.parse(N)),parse:N=>u(N.text),compare:h,format:A,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:N=>u(N),toClipboard:N=>x(N)?"":String(N),fromClipboard:N=>u(N)},text:{base:"text",storage:"dictionary",matches:N=>typeof N=="string",parse:N=>N.text===""?null:String(N.text),compare:(N,S)=>x(N)?x(S)?0:1:x(S)?-1:$().compare(String(N),String(S)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:N=>x(N)?"":String(N),fromClipboard:N=>N},image:{base:"text",storage:"dictionary",parse:N=>N.text===""||N.text==null?null:String(N.text).trim(),compare:(N,S)=>x(N)?x(S)?0:1:x(S)?-1:$().compare(String(N),String(S)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:N=>x(N)?"":String(N),fromClipboard:N=>N},lookup:{base:"text",storage:"dictionary",parse:N=>{if(N.text===""||N.text==null)return null;const S=N.column&&N.column.lookup,C=S&&Y(S.options)?S.options():null;if(!C)return N.text;const D=String(N.text),G=C.find(J=>String(J.id)===D);if(G)return G.id;const X=D.trim().toLowerCase(),V=C.find(J=>String(J.label).toLowerCase()===X);return V?V.id:N.text},compare:q,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:N=>x(N)?"":String(N),fromClipboard:N=>N},object:{base:"object",storage:"object",matches:N=>N!==null&&typeof N=="object"&&!(N instanceof Date),parse:N=>{try{return N.text===""?null:JSON.parse(N.text)}catch{return N.text}},compare:(N,S)=>q(N,S),format:N=>{const S=N.value;if(x(S))return"";if(typeof S=="string")return S;try{return JSON.stringify(S)}catch{return String(S)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:N=>x(N)?"":typeof N=="string"?N:JSON.stringify(N),fromClipboard:N=>N}},_=["boolean","number","date","dateString","datetime","text","object"];function R(N,S,C,D){const G=C.get(N);if(G)return G;D.includes(N)&&W(`circular data type extends chain: ${[...D,N].join(" → ")}`);const X=S[N];X||W(`unknown data type "${N}"`);let V=null;X.extends&&(V=R(X.extends,S,C,[...D,N]));const J={...V||{},...X,name:N,defaults:{...V&&V.defaults||{},...X.defaults||{}}};return J.base||(J.base=V&&V.base||"text"),J.storage||(J.storage=V&&V.storage||"object"),C.set(N,J),J}function I(N,S){const C={...M,...o};if(S&&typeof S.dataType=="function"&&typeof S.names=="function")for(const G of S.names("dataType")){const X=S.dataType(G);X&&(C[G]=X)}if(Z(N))for(const[G,X]of Object.entries(N))C[G]=X;const D=new Map;for(const G of _)R(G,C,D,[]);R("lookup",C,D,[]);for(const G of Object.keys(C))R(G,C,D,[]);for(const G of D.values())a(G.operators);return D}function j(N,S){if(N.base==="text"&&(!N.compare||N.compare===M.text.compare)){const C=$(S);return(D,G)=>x(D)?x(G)?0:1:x(G)?-1:C.compare(String(D),String(G))}return N.compare||q}function L(N,S){return S?N.multiStorage||"multi":N.storage||"object"}function F(N){return E(String(N).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),Ue("packages/core/src/columns/infer.js",function(e,H){"use strict";Object.defineProperty(e,"DEFAULT_SAMPLE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"inferFromValues",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return Y}});const $=H("packages/core/src/internal/warn.js").infoOnce,B=H("packages/core/src/internal/predicates.js").isNil,x=100;function Z(U,W,K={}){const E=K.sampleSize??x,O=[];for(let b=0;b<U.length&&O.length<E;b++){const u=U[b];B(u)||typeof u=="number"&&Number.isNaN(u)||O.push(u)}if(O.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[b,u]of W){if(typeof u.matches!="function")continue;let h=!0;for(let l=0;l<O.length;l++)if(!u.matches(O[l])){h=!1;break}if(h)return{type:b,unanimous:!0,sampled:O.length}}return K.quiet||$(`infer:${K.colId||"?"}`,`column "${K.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:O.length}}function Y(U,W,K,E,O={}){const b=O.sampleSize??x,u=[];for(let h=0;h<W.length&&u.length<b;h++){const l=K(W[h]);B(l)||typeof l=="number"&&Number.isNaN(l)||u.push(l)}return Z(u,E,{...O,colId:U}).type}}),Ue("packages/core/src/columns/graph.js",function(e,H){"use strict";Object.defineProperty(e,"WHOLE_ROW",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"declarationOf",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return E}});const ne=H("packages/core/src/internal/warn.js"),$=ne.DEV,q=ne.fail,B=ne.warnOnce,Z=H("packages/core/src/internal/predicates.js").isFunction,Y="*";function U(O){const b=O.value||{};if(!Z(b.compute))return{computed:!1,wholeRow:!1,deps:[],pure:!0};const h=b.pure!==!1;return b.deps===Y?{computed:!0,wholeRow:!0,deps:[],pure:h}:Array.isArray(b.deps)?{computed:!0,wholeRow:!1,deps:b.deps.slice(),pure:h}:(B(`deps:missing:${O.id}`,`computed column "${O.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:h})}function W(O){const b=new Map;for(const f of O)b.set(f.id,f);const u=new Map,h=new Map,l=new Set,r=new Set,n=new Set,o=new Set;for(const f of O){const w=U(f);if(!w.computed){u.set(f.id,[]);continue}r.add(f.id),(w.pure?n:o).add(f.id),w.wholeRow&&l.add(f.id);const g=[],k=[];for(const d of w.deps)(b.has(d)?g:k).push(d);u.set(f.id,g),k.length&&h.set(f.id,k)}for(const f of n)for(const w of u.get(f))o.has(w)&&q(`pure computed column "${f}" depends on impure column "${w}". Mark it \`value.pure: false\` or make the dependency pure.`);const i=[],t=new Map,c=[],s=f=>{const w=t.get(f);if(w!=="done"){if(w==="open"){const g=c.indexOf(f);q(`circular column dependency: ${[...c.slice(g),f].join(" → ")}`)}t.set(f,"open"),c.push(f);for(const g of u.get(f)||[])b.has(g)&&s(g);c.pop(),t.set(f,"done"),i.push(f)}};for(const f of O)s(f.id);const a=new Map;for(const f of O)a.set(f.id,[]);for(const f of O)for(const w of u.get(f.id)||[]){const g=a.get(w);g&&!g.includes(f.id)&&g.push(f.id)}if(l.size)for(const f of O){if(r.has(f.id))continue;const w=a.get(f.id);for(const g of l)w.includes(g)||w.push(g)}return{order:i,dependents:a,pure:n,impure:o,computed:r,deps:u,wholeRow:l,external:h,index:b}}function K(O,b){const u=Array.isArray(b)?b:[b],h=new Set,l=[...u];for(;l.length;){const r=l.shift();for(const n of O.dependents.get(r)||[])h.has(n)||(h.add(n),l.push(n))}for(const r of u)h.delete(r);return O.order.filter(r=>h.has(r))}function E(O,b,u){if(!$)return O;const h=b instanceof Set?b:new Set(b);return new Proxy(O,{get(l,r){return typeof r=="string"&&!h.has(r)&&!Object.hasOwn(l,r)&&B(`undeclared:${u}:${r}`,`computed column "${u}" 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,H){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"compositeKey",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"createRowKey",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"warnMissingKeys",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"groupPathKey",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"splitPathKey",{enumerable:!0,get:function(){return r}});const $=H("packages/core/src/internal/warn.js").warnOnce,B=H("packages/core/src/internal/paths.js").pathGetter,x=H("packages/core/src/internal/predicates.js"),Z=x.isFunction,Y=x.isBlank,U=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],W="";function K(n){if(n===null)return"\0n";if(n===void 0)return"\0u";const o=typeof n;if(o==="string")return n;if(o==="number"||o==="bigint"||o==="boolean")return String(n);if(n instanceof Date)return`\0d${n.getTime()}`;try{return`\0o${JSON.stringify(n)}`}catch{return"\0o?"}}function E(n){if(n.length===1)return K(n[0]);let o="";for(let i=0;i<n.length;i++)i&&(o+=W),o+=K(n[i]);return o}function O(n,o={}){const i=o.warn!==!1;if(Z(n)){const t=n;return{stable:!0,fields:[],disabled:[],key(c,s){try{const a=t(c);return Array.isArray(a)?E(a):K(a)}catch(a){return $("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",a),`#${s??-1}`}},keyEmpty(c){try{const s=t(c);return Array.isArray(s)?s.length===0||s.some(Y):Y(s)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(n)&&n.length>0){const t=n.filter(a=>typeof a=="string"),c=t.map(a=>B(a)),s=c.length;return{stable:!0,fields:t,disabled:[],key(a){const f=new Array(s);for(let w=0;w<s;w++)f[w]=c[w](a);return E(f)},keyEmpty(a){for(let f=0;f<s;f++)if(Y(c[f](a)))return!0;return!1},missingFields(a){const f=[];for(let w=0;w<s;w++)Y(c[w](a))&&f.push(t[w]);return f}}}if(typeof n=="string"&&n.length>0){const t=B(n);return{stable:!0,fields:[n],disabled:[],key(c){return K(t(c))},keyEmpty(c){return Y(t(c))},missingFields(c){return Y(t(c))?[n]:[]}}}return i&&$("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${U.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:U.slice(),key(t,c){if(t===null||typeof t!="object")return`#${c??0}:${String(t)}`;let s=b.get(t);return s===void 0&&(s=`#${u++}`,b.set(t,s)),s}}}const b=new WeakMap;let u=0;function h(n,o){if(!n||n.stable===!1||!Z(n.keyEmpty)||!Array.isArray(o)||o.length===0)return;let i=0,t=null,c;for(let w=0;w<o.length;w++){const g=o[w];n.keyEmpty(g)&&(i++,t===null&&(t=Z(n.missingFields)?n.missingFields(g):[],c=g))}if(i===0)return;const s=n.fields.length?n.fields.join(","):"(function)",a=t&&t.length?t.join(", "):n.fields.length?n.fields.join(", "):"the rowKey function",f=c!==null&&typeof c=="object"?Object.keys(c).join(", ")||"(no fields)":String(c);$(`rowKey.emptyValue:${s}`,`rowKey ${a} is missing on ${i} of ${o.length} rows; the first such row has: ${f}. 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(n){return E(n)}function r(n){return n.split(W)}}),Ue("packages/core/src/columns/lookup.js",function(e,H){"use strict";Object.defineProperty(e,"DEFAULT_SEPARATOR",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"normaliseOption",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return u}}),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 n}});const ne=H("packages/core/src/internal/compare.js"),$=ne.collator,q=ne.defaultCompare,B=H("packages/core/src/internal/predicates.js"),x=B.isFunction,Z=B.isNil,U=H("packages/core/src/internal/warn.js").warnOnce,K=H("packages/core/src/model/rowkey.js").compositeKey,E=", ",O="";function b(o,i,t,c){if(o===null||typeof o!="object")return{id:o,label:o==null?"":String(o)};const s=o[i],a=o[t],f={id:s,label:a==null?String(s??""):String(a)};o.disabled&&(f.disabled=!0),o.variant&&(f.variant=o.variant),o.icon&&(f.icon=o.icon);const w=c?o[c]:o.group;return w!==void 0&&(f.group=w),f}function u(o,i,t=0,c=[],s=[]){for(const a of o||[]){const f=a&&typeof a=="object"?a[i]:null;if(s.push({raw:a,depth:t,path:c}),Array.isArray(f)&&f.length){const w=String(a&&typeof a=="object"?a.label??a.name??a.id??"":a);u(f,i,t+1,[...c,w],s)}}return s}function h(o){return!!o&&typeof o=="object"&&!Array.isArray(o)&&x(o.router&&o.router.subscribe)}class l{#e;#t;#n;#r;#i=[];#s=new Map;#o=new Map;#l=0;#a="idle";#c=null;#u;#f=null;#d=new Map;constructor(i,t={}){this.#e=i||{},this.#t=t.colId||"?",this.#n=t.locale,this.#r=t.onChange||null,this.#u=$(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??E}get allowCustom(){return this.#e.allowCustom===!0}get sortBy(){return this.#e.sortBy||"label"}get spec(){return this.#e}options(){return this.#i}setLocale(i){this.#n=i,this.#u=$(i)}#h(i){const t=this.#e,c=t.valueKey||"id",s=t.labelKey||"label",a=t.childrenKey||"children";this.#i=u(i,a).map(f=>{const w=b(f.raw,c,s,t.groupKey);return f.depth&&(w.depth=f.depth,w.path=f.path),w}),this.#s=new Map,this.#o=new Map,this.#i.forEach((f,w)=>{this.#s.set(f.id,f),this.#o.set(f.id,w)}),this.#a="ready",this.#l+=1}load(){if(this.#c)return this.#c;const i=this.#e.options;if(Array.isArray(i)||i===void 0)return this.#c=Promise.resolve(this.#i),this.#c;if(h(i))return this.#c=this.#p(i),this.#c;if(!x(i))return U(`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 t;try{t=i()}catch(c){return this.#a="error",U(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,c),this.#c=Promise.resolve([]),this.#c}return!t||!x(t.then)?(this.#h(t),this.#c=Promise.resolve(this.#i),this.#r&&this.#r(this),this.#c):(this.#c=t.then(c=>(this.#h(c),this.#r&&this.#r(this),this.#i),c=>(this.#a="error",U(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,c),[])),this.#c)}refresh(){return this.#c=null,Array.isArray(this.#e.options)?(this.#h(this.#e.options),this.#r&&this.#r(this),Promise.resolve(this.#i)):this.load()}#p(i){if(this.#f)return Promise.resolve(this.#i);const t=this.#e,c=t.valueKey||"id",s=t.labelKey||"label",a=t.groupKey,f=x(i.map)?i.map:null,w=k=>b(f?f(k):k,c,s,a).id,g=k=>this.#m(k,f,c,s,a);return i.router.subscribe(i.predicate,g,{rowKey:w}),this.#f=()=>{x(i.router.detach)&&i.router.detach(g)},this.#a="ready",Promise.resolve(this.#i)}#m(i,t,c,s,a){const f=i&&i.add||[],w=i&&i.update||[],g=i&&i.remove||[];if(!(!f.length&&!w.length&&!g.length)){for(const k of f)this.#g(k,t,c,s,a);for(const k of w)this.#g(k,t,c,s,a);for(const k of g){if(!this.#d.has(k))continue;const d=this.#d.get(k);this.#d.delete(k),this.#s.delete(d);const p=this.#i.findIndex(m=>m.id===d);p>=0&&this.#i.splice(p,1)}this.#o=new Map(this.#i.map((k,d)=>[k.id,d])),this.#a="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(i,t,c,s,a){const f=b(t?t(i):i,c,s,a);this.#d.set(K([f.id]),f.id);const w=this.#i.findIndex(g=>g.id===f.id);w>=0?this.#i[w]=f:this.#i.push(f),this.#s.set(f.id,f)}destroy(){this.#f&&(this.#f(),this.#f=null)}search(i,t){const c=this.#e;if(!x(c.search)){const f=String(i||"").toLowerCase();return Promise.resolve(f===""?this.#i:this.#i.filter(w=>w.label.toLowerCase().includes(f)))}const s=c.valueKey||"id",a=c.labelKey||"label";return Promise.resolve(c.search(i,t)).then(f=>(f||[]).map(w=>b(w,s,a,c.groupKey)))}option(i){return this.#s.get(i)}has(i){return this.#s.has(i)}label(i){if(Z(i)||i==="")return"";const t=this.#s.get(i);if(t)return t.label;if(this.#a==="loading"||this.#a==="idle")return"";this.allowCustom||U(`lookup:unknown:${this.#t}`,`column "${this.#t}" holds value ${JSON.stringify(i)} which is not in its lookup options. Showing the raw value; set \`lookup.unknownLabel\` or \`lookup.allowCustom\` to change that.`);const c=this.#e.unknownLabel;return x(c)?String(c(i)??""):typeof c=="string"?c:String(i)}text(i){if(this.multiple){const t=r(i);return t.length===0?"":t.map(c=>this.label(c)).join(this.separator)}return this.label(i)}dictionary(){return this.#i.map(i=>i.id)}sorted(){const i=this.sortBy;if(i==="optionOrder"||i==="count")return this.#i.slice();if(i==="value")return this.#i.slice().sort((c,s)=>q(c.id,s.id));const t=this.#u;return this.#i.slice().sort((c,s)=>t.compare(c.label,s.label))}comparator(){const i=this.sortBy,t=this.multiple,c=this.#u,s=this.#o;if(t&&i==="count")return(f,w)=>r(f).length-r(w).length;const a=t?f=>r(f)[0]:f=>f;return i==="value"?(f,w)=>q(a(f),a(w)):i==="optionOrder"?(f,w)=>{const g=s.has(a(f))?s.get(a(f)):Number.MAX_SAFE_INTEGER,k=s.has(a(w))?s.get(a(w)):Number.MAX_SAFE_INTEGER;return g-k}:(f,w)=>{const g=a(f),k=a(w);return Z(g)?Z(k)?0:1:Z(k)?-1:c.compare(this.label(g),this.label(k))}}groupKey(i){return this.multiple?r(i).map(c=>String(c)).sort().join(O):Z(i)?"":String(i)}countValues(i){return this.multiple?r(i).length:Z(i)?0:1}contains(i,t,c){const s=this.multiple?r(i):Z(i)?[]:[i],a=Array.isArray(t)?t:[t];switch(c){case"containsAll":return a.every(f=>s.includes(f));case"containsNone":return!a.some(f=>s.includes(f));default:return a.some(f=>s.includes(f))}}exportText(i,t="label"){return t==="value"?this.multiple?r(i).join(this.separator):Z(i)?"":String(i):this.text(i)}exportColumns(){const i=this.multiple;return this.#i.map(t=>({id:t.id,label:t.label,has:c=>i?r(c).includes(t.id):c===t.id}))}}function r(o){return Array.isArray(o)?o:Z(o)||o===""?[]:[o]}function n(o,i={}){const t=o.lookup;if(!t)return null;const c=new l(t,{colId:o.id,locale:i.locale,onChange:i.onChange});return!Array.isArray(t.options)&&t.options!==void 0&&c.load(),c}}),Ue("packages/core/src/columns/value.js",function(e,H){"use strict";Object.defineProperty(e,"compileDisplay",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"warnImpureUse",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ValuePipeline",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return l}});const $=H("packages/core/src/internal/paths.js").getPath,q=H("packages/core/src/internal/predicates.js"),B=q.isFunction,x=q.isNil,Y=H("packages/core/src/internal/lru.js").Lru,W=H("packages/core/src/internal/warn.js").warnOnce,E=H("packages/core/src/columns/graph.js").depsProxy,O="\0";function b(i,t={}){const c=t.locale,s=t.grid??null,a=t.context,f=i.value&&i.value.format,w=i.formatter||null,g=i.dataType&&i.dataType.format,k=i.lookup||null,d=(p,m,v)=>({value:p,data:v,row:m,column:i,colId:i.id,grid:s,context:a,locale:c});if(B(f))return(p,m,v)=>{const y=f(d(p,m,v));return y==null?"":String(y)};if(w){if(k){const p=w.kind==="text";return(m,v,y)=>w(p?k.text(m):m,d(m,v,y))}return(p,m,v)=>w(p,d(p,m,v))}return B(g)?(p,m,v)=>{const y=g(d(p,m,v));return y==null?"":String(y)}:k?p=>k.text(p):p=>x(p)?"":typeof p=="string"?p:String(p)}function u(i,t){!i||!i.value||i.value.pure!==!1||W(`impure:${t}:${i.id}`,`column "${i.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${t}. The result is not stable across passes.`)}class h{#e;#t;#n;#r;#i;#s;#o=new Y(4096);constructor(t){this.#e=t.columns instanceof Map?t.columns:new Map((t.columns||[]).map(c=>[c.id,c])),this.#t=t.graph,this.#n=t.grid??null,this.#r=t.context,this.#s=t.stored||null,this.#i=t.rowKey||l}get graph(){return this.#t}setGraph(t){this.#t=t,this.#o.clear()}beginPass(){this.#o.clear()}endPass(){this.#o.clear()}invalidate(t){if(this.#o.size===0)return;const c=t&&t.rows?new Set([...t.rows].map(String)):null,s=t&&t.columns?[...t.columns]:null;if(!c&&!s){this.#o.clear();return}const a=s?this.#l(s):null;for(const f of[...this.#o.keys()]){const w=String(f).split(O);w.length===3&&(c&&!c.has(w[0])||a&&!a.has(w[2])||this.#o.delete(f))}}#l(t){const c=new Set,s=this.#t,a=[...t];for(;a.length;){const f=a.pop();if(!c.has(f)){c.add(f);for(const w of s?s.dependents.get(f)||[]:[])a.push(w)}}return c}value(t,c,s){const a=typeof t=="string"?this.#e.get(t):t;if(!a)return;if(!a.computed)return this.#c(a,c,s);if(a.value.pure!==!1&&this.#s&&s&&s.physical!=null&&this.#s.has(a.id))return this.#s.get(a.id,s.physical);if(a.volatile)return this.compute(a,c,s);if(a.value.pure===!1)return this.compute(a,c,s);const f=`${this.#a(c,s)}${O}${a.id}`;if(this.#o.has(f))return this.#o.get(f);const w=this.compute(a,c,s);return this.#o.set(f,w),w}#a(t,c){return`${this.#i(t,c)}${O}${r(t)}`}#c(t,c,s){if(this.#s&&s&&s.physical!=null&&this.#s.has(t.id))return this.#s.get(t.id,s.physical);if(t.field)return t.read?t.read(c):$(c,t.field)}compute(t,c,s){const a=this.#t,f=a&&a.wholeRow.has(t.id);let w;if(f)w=c??{};else{w={};const k=a&&a.deps.get(t.id)||[];for(const p of k)w[p]=this.value(p,c,s);const d=a&&a.external.get(t.id)||[];for(const p of d)w[p]=$(c,p);w=E(w,[...k,...d],t.id)}const g={data:c,row:s,column:t,grid:this.#n,context:this.#r};return t.value.compute(w,g)}values(t,c){const s={},a=this.#t?this.#t.order:[...this.#e.keys()];for(const f of a)s[f]=this.value(f,t,c);return s}text(t,c,s){const a=typeof t=="string"?this.#e.get(t):t;return a?a.formatValue(this.value(a,c,s),s,c):""}key(t,c,s){const a=typeof t=="string"?this.#e.get(t):t;if(!a)return"";const f=this.value(a,c,s);return B(a.value.key)?String(a.value.key(this.#u(a,f,c,s))):a.lookup?a.lookup.groupKey(f):x(f)?"":String(f)}quickFilterText(t,c,s){const a=typeof t=="string"?this.#e.get(t):t;if(!a)return"";if(B(a.value.quickFilterText)){const f=this.value(a,c,s);return String(a.value.quickFilterText(this.#u(a,f,c,s))??"")}return this.text(a,c,s)}#u(t,c,s,a){return{value:c,data:s,row:a,column:t,colId:t.id,grid:this.#n,context:this.#r}}parse(t,c,s,a){const f=typeof t=="string"?this.#e.get(t):t;if(!f)return c;const w={text:c,value:this.value(f,s,a),data:s,row:a,column:f,grid:this.#n,context:this.#r,locale:this.#n&&B(this.#n.get)?this.#n.get("locale"):void 0,formulaFunctions:this.#n&&B(this.#n.get)?this.#n.get("formulaFunctions"):void 0};return B(f.value.parse)?f.value.parse(w):f.dataType&&B(f.dataType.parse)?f.dataType.parse(w):c}validate(t,c,s,a,f){const w=typeof t=="string"?this.#e.get(t):t;if(!w||!B(w.edit.validate))return!0;const g=w.edit.validate({value:c,oldValue:s,data:a,row:f,column:w,grid:this.#n,context:this.#r});return g===!0||g===void 0?!0:String(g)}apply(t,c,s,a){const f=typeof t=="string"?this.#e.get(t):t;if(!f)return!1;const w=this.value(f,s,a);if(B(f.value.apply)){const g=f.value.apply({value:c,oldValue:w,data:s,row:a,column:f,grid:this.#n,context:this.#r});return this.#f(f,s,a),g!==!1}return f.field?w===c?!1:(f.write(s,c),this.#f(f,s,a),!0):(W(`apply:${f.id}`,`column "${f.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(t,c,s,a){const f=typeof t=="string"?this.#e.get(t):t;if(!f)return{ok:!1,value:void 0,oldValue:void 0,changed:!1,error:"unknown column"};const w=this.value(f,s,a),g=this.parse(f,c,s,a),k=this.validate(f,g,w,s,a);if(k!==!0)return{ok:!1,value:g,oldValue:w,changed:!1,error:k};const d=this.apply(f,g,s,a);return{ok:!0,value:g,oldValue:w,changed:d}}#f(t,c,s){if(this.#o.size===0)return;const a=this.#a(c,s);this.#o.delete(`${a}${O}${t.id}`);for(const f of this.#t?this.#t.dependents.get(t.id)||[]:[])this.#o.delete(`${a}${O}${f}`)}}function l(i,t){return t&&t.key!=null?String(t.key):r(i)}function r(i){if(i&&typeof i=="object"){let t=n.get(i);return t===void 0&&(t=`#${o++}`,n.set(i,t)),t}return String(i)}const n=new WeakMap;let o=0}),Ue("packages/core/src/model/shadow.js",function(e,H){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"HISTORY_TICK_MAX_MS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"HISTORY_TICK_MIN_MS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"DEFAULT_ANOMALY_THRESHOLD",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"SPEC_STATUS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"POSITIONAL_KINDS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SHADOW_LABELS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"specStatusOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"ShadowTracker",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"shadowsIn",{enumerable:!0,get:function(){return s}});const $=H("packages/core/src/internal/warn.js").warnOnce,q=2e5,B=20,x=1e3,Z=50;function Y(a){return Math.min(x,Math.max(Z,Math.floor(a)))}const U=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"]),W=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),K=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),E=.6745,O=3.5,b=Object.freeze({PASS:"PASS",WARN:"WARN",FAIL:"FAIL"}),u=Object.freeze(["rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag"]),h=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,f){if(!f)return null;const w=Number.isFinite(Number(f.lower))?Number(f.lower):null,g=Number.isFinite(Number(f.upper))?Number(f.upper):null;if(w===null&&g===null||!Number.isFinite(a))return null;if(w!==null&&a<w||g!==null&&a>g)return b.FAIL;const k=Number.isFinite(Number(f.warnLower))?Number(f.warnLower):null,d=Number.isFinite(Number(f.warnUpper))?Number(f.warnUpper):null;return k!==null&&a<k||d!==null&&a>d?b.WARN:b.PASS}function r(a,f,w){if(!f||typeof f!="object")return null;if(f.kind!=="time")return f.kind!==void 0&&$(`shadow.history.window.kind:${a}`,`a 'history' shadow's 'window' only accepts {kind: 'time', span}; '${f.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=f.minutes!=null?Number(f.minutes)*6e4:Number(f.span);if(!(g>0))return $(`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(w)||B);return{span:g,bucketMs:Math.max(1,Math.floor(g/k))}}class n{#e;#t=new Map;#n=new Map;#r=new Map;#i=new Map;#s=new Map;#o=new Map;#l=0;#a;#c;#u;#f;#d=new Map;#h=null;#p=null;#m=null;constructor(f){this.#e=f.colId,this.#a=Math.max(2,f.depth||B),this.#c=Math.max(1,f.max||q),this.#u=f.now||(()=>Date.now()),this.#f=r(this.#e,f.historyWindow,this.#a),this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#f}observe(f,w){const g=c(w);if(g===null)return;if(!this.#n.has(f)){this.#p=null,this.#m=null,this.#g(),this.#t.set(f,g),this.#n.set(f,g),this.#r.set(f,0),this.#i.set(f,this.#u()),this.#s.set(f,[g]),this.#f&&this.#d.set(f,[g]),this.#o.set(f,0);return}const k=this.#n.get(f);if(k===g)return;this.#p=null,this.#m=null,this.#n.set(f,g),this.#r.set(f,(this.#r.get(f)||0)+1),this.#i.set(f,this.#u());const d=this.#s.get(f)||[];d.push(g),d.length>this.#a&&d.splice(0,d.length-this.#a),this.#s.set(f,d);const p=Math.sign(g-k),m=this.#o.get(f)||0;this.#o.set(f,Math.sign(m)===p?m+p:p)}#g(){if(this.#n.size<this.#c)return;const f=this.#n.keys().next().value;f!==void 0&&(this.#t.delete(f),this.#n.delete(f),this.#r.delete(f),this.#i.delete(f),this.#s.delete(f),this.#d.delete(f),this.#o.delete(f),this.#l++)}rebase(){for(const[f,w]of this.#n)this.#t.set(f,w);this.#p=null,this.#m=null}reset(){this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#i.clear(),this.#s.clear(),this.#d.clear(),this.#o.clear(),this.#l=0,this.#p=null,this.#m=null,this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}retain(f){const w=f instanceof Set?f:new Set(f);let g=0;for(const k of[...this.#n.keys()])w.has(k)||(this.#t.delete(k),this.#n.delete(k),this.#r.delete(k),this.#i.delete(k),this.#s.delete(k),this.#d.delete(k),this.#o.delete(k),g++);return g&&(this.#p=null,this.#m=null),g}advanceHistoryWindow(f=this.#u()){const w=this.#f;if(!w)return 0;const g=Math.floor(f/w.bucketMs),k=g-this.#h;if(!(k>0))return 0;const d=Math.min(k,this.#a);for(const[p,m]of this.#d){const v=this.#n.get(p);for(let y=0;y<d;y++)m.push(v);m.length>this.#a&&m.splice(0,m.length-this.#a)}return this.#h=g,k}read(f,w,g,k){switch(f){case"updates":return this.#r.has(w)?this.#r.get(w):0;case"updatedAt":{const d=this.#i.get(w);return d===void 0?null:new Date(d)}case"sinceUpdate":{const d=this.#i.get(w);return d===void 0?null:this.#u()-d}case"firstValue":return this.#t.has(w)?this.#t.get(w):null;case"delta":return this.#n.has(w)?this.#n.get(w)-this.#t.get(w):null;case"deltaPercent":{if(!this.#n.has(w))return null;const d=this.#t.get(w);return d?(this.#n.get(w)-d)/Math.abs(d)*100:null}case"rate":{const d=this.#s.get(w),p=this.#i.get(w);if(!d||d.length<2||p===void 0)return null;const m=this.#u()-p,v=d[d.length-1]-d[d.length-2];return m>0?v/m*1e3:v}case"history":return this.#f?this.#d.has(w)?[...this.#d.get(w)]:null:this.#s.has(w)?[...this.#s.get(w)]:null;case"streak":return this.#o.has(w)?this.#o.get(w):0;case"specStatus":return this.#n.has(w)?l(this.#n.get(w),k):null;default:return u.includes(f)?this.#A(f,w,g,k):null}}#b(f){if(f){if(this.#m&&this.#m.only===f)return this.#m.view;const w=this.#y(f);return this.#m={only:f,view:w},w}return this.#p?this.#p:(this.#p=this.#y(null),this.#p)}#y(f){const w=[];for(const[M,_]of this.#n)f&&!f.has(M)||w.push(_);const g=w.sort((M,_)=>M-_);let k=0,d=0,p=0,m=0;for(const M of g){m+=M,k++;const _=M-d;d+=_/k,p+=_*(M-d)}const v=[];for(const[M,_]of this.#t)f&&!f.has(M)||v.push(_);const y=k?o(g):0,T=g.map(M=>Math.abs(M-y)).sort((M,_)=>M-_),A=k?o(T):0;return{sorted:g,baseline:v.sort((M,_)=>M-_),sum:m,mean:k?d:0,sd:k>1?Math.sqrt(p/(k-1)):0,median:y,mad:A}}#A(f,w,g,k){if(!this.#n.has(w)||g&&!g.has(w))return null;const d=this.#n.get(w),p=this.#b(g),m=p.sorted.length;if(!m)return null;switch(f){case"rank":return m-t(p.sorted,d)+1;case"rankAsc":return i(p.sorted,d)+1;case"rankChange":{if(!this.#t.has(w)||!p.baseline.length)return null;const v=p.baseline.length-t(p.baseline,this.#t.get(w))+1,y=m-t(p.sorted,d)+1;return v-y}case"percentile":return t(p.sorted,d)/m*100;case"quartile":{const v=t(p.sorted,d)/m;return Math.min(4,Math.max(1,Math.ceil(v*4)))}case"zScore":return p.sd?(d-p.mean)/p.sd:null;case"anomalyScore":return p.mad?E*(d-p.median)/p.mad:null;case"anomalyFlag":{if(!p.mad)return null;const v=k&&Number.isFinite(Number(k.threshold))?Number(k.threshold):O;return Math.abs(E*(d-p.median)/p.mad)>v}case"shareOfTotal":return p.sum?d/p.sum*100:null;default:return null}}}function o(a){const f=a.length;if(!f)return 0;const w=(f-1)*.5,g=Math.floor(w),k=Math.ceil(w);return g===k?a[g]:a[g]+(w-g)*(a[k]-a[g])}function i(a,f){let w=0,g=a.length;for(;w<g;){const k=w+g>>1;a[k]<f?w=k+1:g=k}return w}function t(a,f){let w=0,g=a.length;for(;w<g;){const k=w+g>>1;a[k]<=f?w=k+1:g=k}return w}function c(a){if(a==null||a==="")return null;if(a instanceof Date){const w=a.getTime();return Number.isFinite(w)?w:null}const f=typeof a=="number"?a:Number(a);return Number.isFinite(f)?f:null}function s(a){const f=[];for(const w of a||[]){const g=w.shadow;if(!g)continue;const k=typeof g=="string"?{kind:g}:g,d=k.kind;U.includes(d)&&(W.includes(d)||K.includes(d)||f.push({colId:w.id||w.field,of:k.of||w.field||w.id,kind:d,depth:k.depth,historyWindow:d==="history"?k.window:void 0}))}return f}}),Ue("packages/core/src/columns/model.js",function(e,H){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return Re}});const ne=H("packages/core/src/internal/merge.js"),$=ne.expand,q=ne.merge,B=ne.toArray,x=H("packages/core/src/internal/warn.js"),Z=x.fail,Y=x.warnOnce,U=H("packages/core/src/internal/paths.js"),W=U.getPath,K=U.pathGetter,E=U.pathSetter,b=H("packages/core/src/internal/text.js").humanise,u=H("packages/core/src/internal/predicates.js"),h=u.isFunction,l=u.isObject,n=H("packages/core/src/internal/uid.js").uid,i=H("packages/core/src/format/index.js").compileFormat,t=H("packages/core/src/columns/datatypes.js"),c=t.comparatorFor,s=t.createTypeRegistry,a=t.storageKind,f=H("packages/core/src/columns/infer.js"),w=f.inferColumnType,g=f.DEFAULT_SAMPLE,k=H("packages/core/src/columns/graph.js"),d=k.buildGraph,p=k.affectedBy,v=H("packages/core/src/columns/lookup.js").createLookup,y=H("packages/core/src/columns/value.js"),T=y.compileDisplay,A=y.ValuePipeline,M=y.warnImpureUse,R=H("packages/core/src/model/shadow.js").FIT_SHADOW_KINDS,I=Object.freeze({geometry:"geometry",list:"list"}),j={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},L={centre:"center"},F=new Set(["start","center","end","left","right"]);function N(we){if(typeof we!="string")return;const re=we.toLowerCase();return L[re]?L[re]:F.has(re)?re:void 0}function S(we){if(typeof we!="string")return;const re=we.toLowerCase();return re==="center"||re==="centre"?"middle":re==="top"||re==="middle"||re==="bottom"?re:void 0}const C=["cell","layout","header"];function D(we){if(!l(we))return{};const re={...we},de=(me,Oe)=>{if(we[me]===void 0)return;const ke=$(we[me],Oe);ke&&C.includes(me)&&!l(we[me])&&delete ke.enabled,re[me]=ke};return de("sort","direction"),de("filter","type"),de("cell","render"),de("edit","editor"),de("layout","width"),de("group","index"),de("pivot","index"),de("header","render"),de("facet","strategy"),re}function G(we,re){const de={...we||{}},me=l(re)&&l(re.layout)&&re.layout.width!==void 0;return de.fit==="content"&&!me&&delete de.width,de}const X=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"]),V=new Set(["collapsible","columns","facet","header","id","marryChildren","openByDefault","showWhen","title"]);function J(we,re,de,me){const Oe=de==="columnGroup"?"column group":"column";for(const ke of Object.keys(we))if(!re.has(ke)){if(ke==="timeZone"&&de==="column"){Y("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}Y(`${de}.unknown:${ke}`,`'${ke}' is not a configuration key this grid recognises, so it had no effect on ${Oe} "${me}". Check the spelling against the reference.`)}}function ee(we){l(we.cell)&&we.cell.autoHeight!==void 0&&Y("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${we.id||we.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function te(we,re){const de=re&&h(we.defaultsFor)?we.defaultsFor(re):null,me={...we.defaults||{},...l(de)?de:{}},Oe={};return me.align&&(Oe.align=me.align,Oe.cell={align:me.align},Oe.header={align:me.align}),me.filter&&(Oe.filter=me.filter==="none"?{enabled:!1,type:"none"}:{enabled:!0,type:me.filter}),me.editor&&(Oe.edit=me.editor==="none"?{editor:null}:{editor:me.editor}),me.total&&(Oe.total=me.total),me.render&&(Oe.cell={...Oe.cell||{},render:me.render}),we.export&&(Oe.export={...we.export}),Oe}function ie(we){if(typeof we=="string")return we.trim()?[we.trim()]:[];if(!Array.isArray(we))return[];const re=[];for(const de of we){if(typeof de!="string")continue;const me=de.trim();me&&!re.includes(me)&&re.push(me)}return re}class oe{#e=new Map;#t=[];#n=[];#r=new WeakMap;#i;#s;#o;#l;#a;#c;#u(re,de,me){const Oe=this.#f(re,de,me);if(typeof Oe!="string"||!this.#d)return Oe??null;const ke=de&&de.totals&&de.totals.implement;if(ke&&h(ke[Oe])){const ce=ke[Oe];return ce.totalName=Oe,ce}const Le=this.#d.totalFn?.(Oe);return h(Le)?Le:Oe}#f(re,de,me){if(typeof re!="string")return re;const Oe=de&&de.totals&&de.totals.supported;if(!Array.isArray(Oe)||Oe.includes(re))return re;const ke=Oe.length?Oe.join(", "):"none";return Z(`column "${me}" is typed ${de.name||"a type"}, for which the total "${re}" is not meaningful. Supported: ${ke}. Aggregating it anyway would produce a confident wrong number.`),re}#d;#h;#p;#m;#g;#b;#y=!1;#A;#w;constructor(re={}){this.#s=D(re.columnDefaults||{}),this.#o=re.columnPresets||{},this.#a=re.locale,this.#l=re.timeZone,this.#c=S(re.verticalAlign),this.#d=re.registry||null,this.#h=re.grid||null,this.#p=re.context,this.#A=re.sampleSize??g,this.#w=re.onChange||null,this.#b=h(re.rowKey)?re.rowKey:void 0,this.#i=s(re.dataTypes,this.#d);const{leaves:de,groups:me}=Re(re.columns||[]);this.#n=me;for(const Oe of de){Oe.facet!==void 0&&this.#r.set(Oe.def,Oe.facet);const ke=this.#O(Oe.def,null);if(ke.groupPath=Oe.path,this.#e.has(ke.id)){Y(`columns.duplicate:${ke.id}`,`two columns resolve to the id '${ke.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}Oe.column=ke,this.#e.set(ke.id,ke),this.#t.push(ke.id)}this.#E(re.stored||null)}#O(re,de){J(re,X,"column",re.id||re.field||"(unnamed)"),ee(re);const me=D(re),Oe=B(re.preset),ke=Oe.map(st=>{const mt=this.#o[st];return mt?D(mt):(Y(`preset:${st}`,`unknown column preset "${st}"; ignoring`),{})}),Le=this.#S(me,ke,de),ce=this.#i.get(Le)||this.#i.get("text");if(!this.#i.has(Le)&&re.type){const st=I[Le];Y(`type:${Le}`,`unknown data type "${Le}"; falling back to "text"`+(st?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${st}'.`:""))}const ge=h(ce.items)?this.#T(me,ke,re.id||re.field||"(unnamed)"):null;let Se=j;Se=q(Se,this.#s),re.type!==!1&&(Se=q(Se,te(ce,ge)));for(const st of ke)Se=q(Se,st);this.#r.has(re)&&(Se=q(Se,D({facet:this.#r.get(re)}))),Se=q(Se,me);const Fe=Se.edit;Fe&&Fe.editor&&Fe.enabled!==!0&&!h(Fe.enabled)&&(re.edit||{}).editor&&Y(`column.editor-not-enabled:${re.id||re.field}`,`column '${re.id||re.field}' names the editor '${Fe.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const be=re.id||re.field||n("col");if(re.shadow&&!h(Se.value&&Se.value.compute)){const st=typeof re.shadow=="string"?{kind:re.shadow}:re.shadow,mt=st.of||re.field||be,kt=R.includes(st.kind),St=kt?st.model||st:null,Pt=kt&&St?[...Array.isArray(St.predictors)?St.predictors:[],St.response].filter(Boolean):null;Se.value={...Se.value||{},deps:Pt&&Pt.length?Pt:st.orderBy&&st.orderBy!==mt?[mt,st.orderBy]:[mt],pure:!1,compute:(Mt,It)=>{const $t=It.grid&&It.grid.statistics;if(!$t)return null;const Ut=It.row&&It.row.key||$t.keyOf(It.data);if(!Ut)return null;if(kt){if(!h($t.fitShadow))return null;const ft=st.model?{...st.model,threshold:st.threshold}:st;return $t.fitShadow(st.kind,Ut,ft)}return $t.shadow(mt,st.kind,Ut,st.scope,st)}}}if(re.running&&!h(Se.value&&Se.value.compute)){const st=typeof re.running=="string"?{kind:re.running}:re.running,mt=st.of||re.field||be;Se.value={...Se.value||{},deps:[mt],pure:!1,compute:(kt,St)=>{const Pt=St.grid&&St.grid.statistics;if(!Pt||!h(Pt.running))return null;const Mt=St.row&&St.row.key||Pt.keyOf(St.data);return Mt?Pt.running(mt,st.kind||"total",Mt):null}},re.sort===void 0&&(Se.sort={...Se.sort||{},enabled:!1})}const Ie=re.field??(h(Se.value&&Se.value.compute)?null:re.id??null),He=h(Se.value&&Se.value.compute),Ge={id:be,field:Ie,shadow:re.shadow||null,running:re.running||null,spec:re.spec||null,validation:re.validation||null,volatile:!!(re.shadow||re.running),title:Se.title??b(Ie||be),type:ce.name,dataType:ce,itemType:ge,nullable:Se.nullable!==!1,align:N(me.cell&&me.cell.align||me.align||Se.cell&&Se.cell.align||Se.align||ce.defaults&&ce.defaults.align)||"start",verticalAlign:S(me.cell&&me.cell.verticalAlign||me.verticalAlign||Se.cell&&Se.cell.verticalAlign||Se.verticalAlign)||this.#c,rowSpan:h(Se.rowSpan)?Se.rowSpan:null,colSpan:h(Se.colSpan)?Se.colSpan:null,value:{pure:!0,...Se.value||{}},cell:{...Se.cell||{}},edit:{...Se.edit||{}},sort:{...Se.sort||{}},filter:{...Se.filter||{}},group:{enabled:!1,index:-1,explode:!1,...Se.group||{}},pivot:{enabled:!1,index:-1,...Se.pivot||{}},total:this.#u(Se.total,ce,re.id||re.field||"(unnamed)"),groupTotal:Se.groupTotal===void 0?null:this.#u(Se.groupTotal,ce,re.id||re.field||"(unnamed)"),grandTotal:Se.grandTotal===void 0?null:this.#u(Se.grandTotal,ce,re.id||re.field||"(unnamed)"),tags:ie(Se.tags),typeOptions:Se.typeOptions??null,...l(Se[Le])?{[Le]:Se[Le]}:{},layout:G(Se.layout,me),header:{...Se.header||{}},contextMenu:Se.contextMenu===void 0?null:Se.contextMenu,facet:{...Se.facet||{}},export:{...Se.export||{}},allowGroup:Se.allowGroup!==!1,allowPivot:Se.allowPivot!==!1,allowTotal:Se.allowTotal!==!1,quickFilter:Se.quickFilter!==!1,def:re,format:Se.format,presets:Oe,inferred:de!=null&&!re.type,computed:He,diff:re.diff===void 0?void 0:!!re.diff,read:Ie?K(Ie):null,write:Ie?E(Ie):null};Ge.cell.align=N(me.cell&&me.cell.align)||Ge.align,Ge.header.align=N(me.header&&me.header.align)||Ge.align;const nt=Se.lookup||null;return Ge.lookup=nt?v({id:be,lookup:nt},{locale:this.#a,onChange:()=>{this.#w&&this.#w("lookup",{colId:be})}}):null,Ge.group.explode&&Ge.lookup&&Ge.lookup.multiple&&Y(`explode:${be}`,`column "${be}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(Ge),Ge}#v(re){re.formatter=i(re.format,re.dataType,this.#a,this.#l,re.id),re.formatValue=T(re,{locale:this.#a,grid:this.#h,context:this.#p}),re.itemCompare=re.itemType?c(re.itemType,this.#a):null,re.compare=h(re.value.compare)?re.value.compare:re.lookup?re.lookup.comparator():h(re.dataType.compareFor)?re.dataType.compareFor(re):c(re.dataType,this.#a),re.excel=re.formatter&&re.formatter.ooxml||re.dataType&&re.dataType.excel||"General",re.storeKind=a(re.dataType,!!(re.lookup&&re.lookup.multiple))}#T(re,de,me){let Oe=l(re.typeOptions)?re.typeOptions:null;for(let ge=de.length-1;!Oe&&ge>=0;ge--)l(de[ge].typeOptions)&&(Oe=de[ge].typeOptions);!Oe&&l(this.#s.typeOptions)&&(Oe=this.#s.typeOptions);const ke=Oe&&Oe.of!==void 0?Oe.of:"text",Le=typeof ke=="string"?this.#i.get(ke):void 0;return Le&&!h(Le.items)&&Le.storage!=="object"?Le:(Y(`type:of:${String(ke)}`,`column "${me}" names "${String(ke)}" as its item type (typeOptions.of), which is not ${Le?"a scalar data type":"a known data type"}; its items are read as text.`),this.#i.get("text"))}#S(re,de,me){if(re.type===!1)return"text";if(re.type)return re.type;for(let Oe=de.length-1;Oe>=0;Oe--)if(de[Oe].type)return de[Oe].type;if(this.#s.type)return this.#s.type;if(re.shadow){const Oe=typeof re.shadow=="string"?re.shadow:re.shadow.kind;if(Oe==="fitInfluence")return"boolean";if(Oe==="fitPredicted"||Oe==="fitResidual"||Oe==="fitStdResidual"||Oe==="fitLeverage"||Oe==="fitCooksD"||Oe==="tsTrend"||Oe==="tsSeasonal"||Oe==="tsResidual"||Oe==="tsCoverage"||Oe==="tsSmoothed"||Oe==="tsSmoothingAlpha"||Oe==="tsSmoothingBeta")return"number"}return me||(re.lookup?"lookup":"text")}#E(re){const de=this.all();this.#m=d(de),this.#g?this.#g.setGraph(this.#m):this.#g=new A({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:re||null,rowKey:this.#b});const me=this.#g;for(const Oe of de)Oe.getValue=(ke,Le)=>me.value(Oe,ke,Le)}all(){return this.#t.map(re=>this.#e.get(re))}visible(){return this.all().filter(re=>!re.layout.hidden)}get(re){return this.#e.get(re)}groups(){const re=de=>{const me=[];for(const Oe of de)Array.isArray(Oe.columns)?me.push({...Oe,columns:re(Oe.columns)}):Oe.column&&me.push(Oe.column);return me};return re(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#i}affectedBy(re){return p(this.#m,re)}value(re,de,me){return this.#g.value(re,de,me)}text(re,de,me){return this.#g.text(re,de,me)}checkImpure(re,de){M(this.#e.get(re),de)}setLocale(re){this.#a=re;for(const de of this.all())de.lookup&&de.lookup.setLocale(re),this.#v(de);this.#w&&this.#w("locale",{locale:re})}infer(re){const de={};if(this.#y||!Array.isArray(re)||re.length===0)return de;this.#y=!0;let me=!1;for(const Oe of this.all()){const ke=Oe.def;if(ke.type!==void 0||!Oe.field||Oe.computed||Oe.lookup||this.#N(Oe))continue;const Le=Oe.read||(Se=>W(Se,Oe.field)),ce=w(Oe.id,re,Le,this.#i,{sampleSize:this.#A});if(ce===Oe.type)continue;de[Oe.id]=ce;const ge=this.#O(ke,ce);ge.groupPath=Oe.groupPath,ge.layout={...ge.layout,...ue(Oe.layout)},this.#e.set(Oe.id,ge),Ce(this.#n,Oe.id,ge),me=!0}return me&&this.#E(null),de}redecorate(re,de,me={}){const Oe=this.#e.get(re);if(!Oe){Y(`redecorate:${re}`,`columns.decorate('${re}', …): no column with id '${re}'.`);return}const ke=Oe.def||{},Le={...l(ke.cell)?ke.cell:{}};Le.decoration=de??void 0,me&&"variant"in me&&(Le.variant=me.variant);const ce={...ke,cell:Le};this.#r.has(ke)&&this.#r.set(ce,this.#r.get(ke));const ge=this.#O(ce,Oe.type);return ge.groupPath=Oe.groupPath,ge.layout={...ge.layout,...ue(Oe.layout)},Oe.lookup&&Oe.lookup!==ge.lookup&&h(Oe.lookup.destroy)&&Oe.lookup.destroy(),this.#e.set(re,ge),Ce(this.#n,re,ge),this.#E(null),this.#w&&this.#w("decorate",{colId:re}),ge}destroy(){for(const re of this.#e.values())re.lookup&&h(re.lookup.destroy)&&re.lookup.destroy()}#N(re){for(const de of re.presets){const me=this.#o[de];if(me&&me.type)return!0}return!!this.#s.type}#P(re){return!re.computed&&h(re.dataType&&re.dataType.toStorage)}storeReader(re){if(re.computed)return de=>this.#g.value(re,de,null);if(this.#P(re)){const de=re.dataType.toStorage,me={timeZone:this.#l,colId:re.id,itemType:re.itemType||null};return Oe=>de(re.read(Oe),me)}return re.read}storeValue(re,de){if(!(!re||re.computed)&&h(re.read))return this.storeReader(re)(de)}storeSchema(){const re=[];for(const de of this.all()){if(de.computed&&de.value.pure===!1||!de.computed&&!de.field)continue;const me=this.storeReader(de);let Oe=null;!de.computed&&!this.#P(de)&&typeof de.field=="string"&&!de.lookup&&(Oe=de.field);const ke={id:de.id,kind:de.storeKind,nullable:de.nullable,read:me};Oe!==null&&(ke.field=Oe),de.lookup&&(ke.dictionary=de.lookup.dictionary()),re.push(ke)}return re}state(){return this.all().map(re=>({id:re.id,width:re.layout.width,flex:re.layout.flex||void 0,hidden:!!re.layout.hidden,headerWrap:re.header?.wrap===!0?!0:void 0,headerOrientation:re.header?.orientation==="vertical"?"vertical":void 0,pin:re.layout.pin??null,sort:re.sort.direction??null,sortIndex:re.sort.direction?re.sort.order??0:null,groupIndex:re.group.enabled?re.group.index??0:null,pivotIndex:re.pivot.enabled?re.pivot.index??0:null,total:typeof re.total=="string"?re.total:null,groupTotal:typeof re.groupTotal=="string"?re.groupTotal:void 0,grandTotal:typeof re.grandTotal=="string"?re.grandTotal:void 0,decoration:re.cell&&re.cell.decoration!=null?ye(re.cell.decoration):void 0,variant:re.cell&&re.cell.variant!=null?ye(re.cell.variant):void 0}))}applyState(re,de={}){const me={applied:[],skipped:[]},Oe=Array.isArray(re)?re:re&&re.columns||[],ke=!Array.isArray(re)&&re&&re.columnOrder||null;for(const ce of Oe){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 Se=ge.cell?ge.cell.decoration:void 0,Fe=ce.decoration??null,be=Object.hasOwn(ce,"variant"),Ie=be&&!he(ge.cell?ge.cell.variant:void 0,ce.variant);(!he(Se,Fe)||Ie)&&(this.redecorate(ce.id,Fe,be?{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 Le=ke||(de&&de.keepOrder?[]:Oe.map(ce=>ce&&ce.id).filter(Boolean));if(Le.length){const ce=Le.filter(Se=>this.#e.has(Se)),ge=this.#t.filter(Se=>!ce.includes(Se));this.#t=[...ce,...ge]}return this.#w&&this.#w("state",me),me}move(re,de){this.#M(re,de)&&(this.#$(),this.#w&&this.#w("move",{id:re,to:de}))}reorder(re){const de={applied:[],skipped:[]},me=[];let Oe=0;for(const ke of Array.isArray(re)?re:[]){const Le=Oe++;this.#M(ke,Le)&&(de.applied.push(ke),me.push({id:ke,to:Le}))}if(!me.length)return de;if(this.#$(),this.#w)for(const ke of me)this.#w("move",ke);return de}#M(re,de){const me=this.#t.indexOf(re);if(me===-1||Math.max(0,Math.min(Number(de)||0,this.#t.length-1))===me)return!1;const ke=this.#e.get(re);if(ke.layout.movable===!1||ke.layout.lockPosition)return Y(`move:${re}`,`column "${re}" is not movable; the move was ignored`),!1;const Le=this.#R(re,de);return Le?(Y(`move.married:${Le}`,`band "${Le}" 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(de,this.#t.length)),0,re),!0)}#R(re,de){if(!this.#n||!this.#n.length)return null;const me=this.#t.filter(ce=>ce!==re),Oe=Math.max(0,Math.min(de,me.length)),ke=(ce,ge)=>{if(Array.isArray(ce.columns)){for(const Fe of ce.columns)ke(Fe,ge);return ge}const Se=ce.column?ce.column.id:ce.id;return Se&&ge.push(Se),ge},Le=ce=>{for(const ge of ce){if(!Array.isArray(ge.columns))continue;if(ge.marryChildren===!0){const Fe=ke(ge,[]),be=Fe.includes(re),Ie=Fe.map(He=>me.indexOf(He)).filter(He=>He>=0);if(Ie.length){const He=Math.min(...Ie),Ge=Math.max(...Ie);if(be?Oe<He||Oe>Ge+1:Oe>He&&Oe<=Ge)return ge.id}}const Se=Le(ge.columns);if(Se)return Se}return null};return Le(this.#n)}#$(){const re=new Map(this.#t.map((Oe,ke)=>[Oe,ke])),de=Oe=>{if(!Array.isArray(Oe.columns)){const Le=Oe.column?Oe.column.id:Oe.id;return re.has(Le)?re.get(Le):1/0}let ke=1/0;for(const Le of Oe.columns)ke=Math.min(ke,de(Le));return ke},me=Oe=>{Oe.sort((ke,Le)=>de(ke)-de(Le));for(const ke of Oe)Array.isArray(ke.columns)&&me(ke.columns)};me(this.#n)}#U(re){const de=me=>{for(let Oe=0;Oe<me.length;Oe++){const ke=me[Oe];if(Array.isArray(ke.columns)){const Le=de(ke.columns);if(Le)return Le}else if(ke.column&&ke.column.id===re)return me.splice(Oe,1)[0]}return null};return de(this.#n)}#K(re){const de=[];for(let me=re.length-1;me>=0;me--){const Oe=re[me];Array.isArray(Oe.columns)&&(de.push(...this.#K(Oe.columns)),Oe.columns.length===0&&(de.push(Oe.id),re.splice(me,1)))}return de}#x(){const re=(de,me,Oe)=>{for(const ke of de)Array.isArray(ke.columns)?re(ke.columns,[...me,ke.id]):ke.column&&(ke.column.groupPath=me)};re(this.#n,[])}#I(re){const de=new Set(re),me=this.#t.filter(ce=>de.has(ce));if(!me.length)return;const Oe=Math.min(...me.map(ce=>this.#t.indexOf(ce))),ke=this.#t.slice(0,Oe).filter(ce=>!de.has(ce)),Le=this.#t.slice(Oe).filter(ce=>!de.has(ce));this.#t=[...ke,...me,...Le]}#Y(re){const de=[],me=Oe=>{if(Array.isArray(Oe.columns))for(const ke of Oe.columns)me(ke);else Oe.column&&de.push(Oe.column.id)};return me(re),de}#F(re){const de=me=>{for(const Oe of me){if(!Array.isArray(Oe.columns))continue;if(Oe.id===re)return{node:Oe,parent:me};const ke=de(Oe.columns);if(ke)return ke}return null};return de(this.#n)}groupColumns(re,de={}){const me=B(re).filter(ge=>this.#e.has(ge));if(!me.length)return Y("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 Y(`columns.group.locked:${ge}`,`column "${ge}" is position-locked and cannot be grouped.`),null;const Oe=de.groupId?this.#F(de.groupId):null;if(de.groupId&&!Oe)return Y(`columns.group.unknown:${de.groupId}`,`no band "${de.groupId}" to add to; nothing was grouped.`),null;let ke=null;if(!Oe&&de.id!=null&&(ke=String(de.id),this.#F(ke)||this.#e.has(ke)))return Y(`columns.group.idtaken:${ke}`,`band id "${ke}" is already in use; nothing was grouped.`),null;const Le=me.map(ge=>this.#U(ge)).filter(Boolean);if(!Le.length)return null;let ce;if(Oe)Oe.node.columns.push(...Le),ce=Oe.node.id;else{const ge={id:ke||n("grp"),title:de.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:Le},Se=Number.isInteger(de.at)?Math.max(0,Math.min(de.at,this.#n.length)):this.#n.length;this.#n.splice(Se,0,ge),ce=ge.id}return this.#K(this.#n),this.#I(me),this.#x(),this.#$(),this.#w&&this.#w("columngroup",{action:"formed",groupId:ce,ids:me}),ce}ungroupColumn(re){const de=this.#e.get(re);if(!de){Y(`columns.ungroup.unknown:${re}`,`no column "${re}" to ungroup.`);return}const me=de.groupPath||[];if(!me.length)return;const Oe=me[me.length-1],ke=this.#F(Oe);if(!ke)return;const Le=this.#U(re);if(!Le)return;const ce=ke.parent.indexOf(ke.node);ke.parent.splice(ce+1,0,Le);const ge=this.#K(this.#n),Se=this.#Y(ke.node);if(Se.length){this.#I(Se);const Fe=Math.max(...Se.map(Ie=>this.#t.indexOf(Ie))),be=this.#t.filter(Ie=>Ie!==re);be.splice(Fe+1,0,re),this.#t=be}this.#x(),this.#$(),this.#w&&this.#w("columngroup",{action:"removed",id:re,dissolved:ge})}renameGroup(re,de){const me=this.#F(re);if(!me){Y(`columns.group.rename:${re}`,`no band "${re}" to rename.`);return}me.node.title=String(de??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:re,title:me.node.title})}dissolveGroup(re){const de=this.#F(re);if(!de){Y(`columns.group.dissolve:${re}`,`no band "${re}" to dissolve.`);return}const me=de.parent.indexOf(de.node);de.parent.splice(me,1,...de.node.columns),this.#x(),this.#$(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:re})}moveGroup(re,de){const me=this.#F(re);if(!me){Y(`columns.group.move:${re}`,`no band "${re}" to move.`);return}const Oe=me.parent,ke=Oe.indexOf(me.node);ke!==-1&&(Oe.splice(ke,1),Oe.splice(Math.max(0,Math.min(de,Oe.length)),0,me.node),this.#G(),this.#x(),this.#w&&this.#w("columngroup",{action:"moved",groupId:re,to:de}))}#G(){const re=[],de=Oe=>{for(const ke of Oe)Array.isArray(ke.columns)?de(ke.columns):ke.column&&re.push(ke.column.id)};de(this.#n);const me=new Set(re);this.#t=[...re,...this.#t.filter(Oe=>!me.has(Oe))]}groupTree(){const re=me=>me.map(Oe=>Array.isArray(Oe.columns)?{id:Oe.id,title:Oe.title||"",collapsible:!!Oe.collapsible,openByDefault:Oe.openByDefault!==!1,columns:re(Oe.columns)}:Oe.column?Oe.column.id:null).filter(Oe=>Oe!==null),de=re(this.#n);return de.some(me=>me&&typeof me=="object")?de:[]}applyGroupTree(re){if(!Array.isArray(re))return;const de=new Set,me=ke=>{const Le=[];for(const ce of ke)if(ce&&typeof ce=="object"&&Array.isArray(ce.columns)){const ge=me(ce.columns);if(!ge.length)continue;Le.push({id:ce.id||n("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&&!de.has(ce)&&(de.add(ce),Le.push({column:ge,path:[]}))}return Le},Oe=me(re);for(const ke of this.#t){if(de.has(ke))continue;const Le=this.#e.get(ke);Le&&Oe.push({column:Le,path:[]})}this.#n=Oe,this.#x(),this.#$(),this.#w&&this.#w("columngroup",{action:"applied"})}show(re){this.#H(re,!1)}hide(re){this.#H(re,!0)}#H(re,de){const me=[];for(const Oe of B(re)){const ke=this.#e.get(Oe);if(ke){if(de&&ke.layout.lockVisible){Y(`lockVisible:${Oe}`,`column "${Oe}" is \`layout.lockVisible\` and cannot be hidden`);continue}ke.layout.hidden!==de&&(ke.layout.hidden=de,me.push(Oe))}}me.length&&this.#w&&this.#w("visible",{ids:me,hidden:de})}pin(re,de){const me=this.#e.get(re);me&&(me.layout.pin=de??null,this.#w&&this.#w("pin",{id:re,side:me.layout.pin}))}pinMany(re){const de={};for(const[Oe,ke]of re){const Le=this.#e.get(Oe);Le&&(Le.layout.pin=ke??null,de[Oe]=Le.layout.pin)}const me=Object.keys(de);me.length&&this.#w&&this.#w("pin",{ids:me,pins:de})}#z(re,de){const me=re.layout.min??0,Oe=re.layout.max;let ke=Math.max(me,de);return Oe!=null&&(ke=Math.min(Oe,ke)),re.layout.width=ke,re.layout.flex=0,ke}resize(re,de){const me=this.#e.get(re);if(!me)return;if(me.layout.resizable===!1){Y(`resize:${re}`,`column "${re}" is not resizable; the resize was ignored`);return}const Oe=this.#z(me,de);this.#w&&this.#w("resize",{id:re,width:Oe})}resizeMany(re){const de={};for(const[Oe,ke]of re){const Le=this.#e.get(Oe);if(Le){if(Le.layout.resizable===!1){Y(`resize:${Oe}`,`column "${Oe}" is not resizable; the resize was ignored`);continue}de[Oe]=this.#z(Le,ke)}}const me=Object.keys(de);me.length&&this.#w&&this.#w("resize",{ids:me,widths:de})}}function ue(we){const re={};return we.width!=null&&(re.width=we.width),we.hidden!=null&&(re.hidden=we.hidden),we.pin!==void 0&&(re.pin=we.pin),re}function ye(we){if(we===null||typeof we!="object")return we;try{return structuredClone(we)}catch{}try{return JSON.parse(JSON.stringify(we))}catch{return we}}function he(we,re){const de=we??null,me=re??null;if(de===me)return!0;if(de===null||me===null)return!1;if(typeof de!="object"||typeof me!="object")return de===me;try{return JSON.stringify(de)===JSON.stringify(me)}catch{return!1}}function Re(we){const re=[],de=(Oe,ke,Le)=>{const ce=[];for(const ge of Oe){if(!l(ge)){Z("a column definition must be an object");continue}if(Array.isArray(ge.columns)){J(ge,V,"columnGroup",ge.title||ge.id||"(unnamed)");const Se={id:ge.id||n("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:[]};Se.columns=de(ge.columns,[...ke,Se.id],ge.facet!==void 0?ge.facet:Le),ce.push(Se)}else{const Se={def:ge,path:ke,facet:Le};re.push(Se),ce.push(Se)}}return ce},me=de(we,[],void 0);return{leaves:re,groups:me}}function Ce(we,re,de){for(const me of we){if(me.columns){if(Ce(me.columns,re,de))return!0;continue}if(me.column&&me.column.id===re)return me.column=de,!0}return!1}}),Ue("packages/core/src/columns/autogroup.js",function(e,H){"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 Y}});const $=H("packages/core/src/internal/warn.js").warnOnce,q="__lattice_group",B=240,x=.5;function Z(U){const{columns:W,groupBy:K}=U,E=K.map(u=>W.get(u)).filter(Boolean),O=E.length?E.map(u=>u.title||u.id).join(" > "):"Group",b=U.config&&U.config.autoGroupColumnWidth||B;return{id:q,field:null,title:O,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group"},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!0},groupedIds:K.slice(),group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:b,min:120,pin:U.config&&U.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(u,h){return h&&h.group?h.groupValue:null},formatValue(u,h){if(!h||!h.group)return"";if(h.grandTotal)return U.config&&U.config.grandTotalLabel||"Total";const l=E[Math.min(h.level||0,E.length-1)];return l&&typeof l.formatValue=="function"?l.formatValue(u,h):u==null?"":String(u)}}}function Y(U,W,K){!U.length||K<100||W<K*x||$(`grouping.cardinality:${U.join(",")}`,`grouping by ${U.join(", ")} produced ${W} groups for ${K} rows: nearly one group per row. Grouping a continuous value such as a percentage or a timestamp rarely reads usefully; consider a computed banding column.`)}}),Ue("packages/core/src/columns/selectcolumn.js",function(e,H){"use strict";Object.defineProperty(e,"SELECT_COLUMN_ID",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"createSelectionColumn",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return B}});const ne="__lattice_select",$=44;function q(x){const Z=x.selection||{},Y=x.config&&x.config.selectionColumnWidth||$;return{id:ne,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:Y,min:Y,max:Y,pin:x.config&&x.config.selectionColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,headerCheckbox:Z.headerCheckbox===!0,def:{},getValue(U,W){return W?W.selected:!1},formatValue(){return""}}}const B=q}),Ue("packages/core/src/columns/rownumbercolumn.js",function(e,H){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createRowNumberColumn",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return W}});const $=H("packages/core/src/internal/predicates.js").isFunction,q="__lattice_rownumber",B=40,x=9,Z=22;function Y(K){const E=String(Math.max(1,Math.trunc(Math.abs(K))||1)).length;return Math.max(B,E*x+Z)}function U(K){const E=K.rowNumbers,O=E&&typeof E=="object"?E:{},b=Number.isFinite(O.start)?O.start:1,u=Number.isFinite(O.width)?O.width:Y((K.maxNumber||0)+b),h=$(K.rank)?K.rank:()=>null;return{id:q,field:null,title:typeof O.title=="string"?O.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:u,min:u,max:u,pin:"start",hidden:!1,resizable:O.width==null,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(l,r){const n=h(r);return n==null?null:n-1+b},formatValue(l){return l==null?"":String(l)}}}const W=U}),Ue("packages/core/src/model/detail.js",function(e,H){"use strict";Object.defineProperty(e,"DEFAULT_DETAIL_HEIGHT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DEFAULT_CACHE_LIMIT",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"DetailModel",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return W}});const $=H("packages/core/src/internal/predicates.js").isFunction,B=H("packages/core/src/internal/warn.js").warnOnce,x=240,Z=10;function Y(K){if(!K)return null;const E=K===!0?{}:K;return E.enabled===!1?null:!$(E.rows)&&!E.render?(B("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:E.render||null,config:E.config||null,rows:$(E.rows)?E.rows:null,height:E.height??x,cacheLimit:Number.isFinite(E.cacheLimit)?Math.max(0,E.cacheLimit):Z,isMaster:$(E.isMaster)?E.isMaster:null,target:E.target||null,onCreate:$(E.onCreate)?E.onCreate:null,path:typeof E.path=="string"?E.path:null}}class U{#e;#t=new Set;#n;#r=0;constructor(E){this.#e=E.config,this.#n=$(E.onChange)?E.onChange:()=>{}}get config(){return this.#e}get inline(){return!this.#e.target}isMaster(E){if(!E||E.group||E.detail)return!1;const O=this.#e.isMaster;return O?!!O(E.data,E):!0}isOpen(E){return this.#t.has(E)}keys(){return[...this.#t]}activeKey(){for(const E of this.#t)return E;return null}heightOf(E){const O=this.#e.height;return $(O)?Number(O(E))||x:O==="auto"?x:Number(O)||x}open(E){return this.#t.has(E)?!1:(this.inline||this.#t.clear(),this.#t.add(E),this.#i(),!0)}close(E){return this.#t.delete(E)?(this.#i(),!0):!1}toggle(E){return this.#t.has(E)?(this.close(E),!1):(this.open(E),!0)}closeAll(){this.#t.size&&(this.#t.clear(),this.#i())}prune(E){if(!this.#t.size||!$(E))return;let O=!1;for(const b of[...this.#t])E(b)||(this.#t.delete(b),O=!0);O&&this.#i()}signature(){return`${this.#r}`}set(E){this.#t.clear();const O=Array.isArray(E)?E:[];for(const b of this.inline?O:O.slice(0,1))this.#t.add(b);this.#i()}#i(){this.#r++,this.#n()}}const W=U}),Ue("packages/core/src/compute/special.js",function(e,H){"use strict";Object.defineProperty(e,"logGamma",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"incompleteBeta",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"normalQuantile",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"normalCdf",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"studentT",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"chiSquareUpperTail",{enumerable:!0,get:function(){return l}});const ne=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),$=3e-12,q=1e-300;function B(r){if(r<.5)return Math.log(Math.PI/Math.sin(Math.PI*r))-B(1-r);const n=r-1;let o=.9999999999998099;const i=n+7.5;for(let t=0;t<ne.length;t++)o+=ne[t]/(n+t+1);return .5*Math.log(2*Math.PI)+(n+.5)*Math.log(i)-i+Math.log(o)}function x(r,n,o){const i=r+n,t=r+1,c=r-1;let s=1,a=1-i*o/t;Math.abs(a)<q&&(a=q),a=1/a;let f=a;for(let w=1;w<=300;w++){const g=2*w;let k=w*(n-w)*o/((c+g)*(r+g));a=1+k*a,Math.abs(a)<q&&(a=q),s=1+k/s,Math.abs(s)<q&&(s=q),a=1/a,f*=a*s,k=-(r+w)*(i+w)*o/((r+g)*(t+g)),a=1+k*a,Math.abs(a)<q&&(a=q),s=1+k/s,Math.abs(s)<q&&(s=q),a=1/a;const d=a*s;if(f*=d,Math.abs(d-1)<$)break}return f}function Z(r,n,o){if(!(r>0)||!(n>0)||!Number.isFinite(o))return Number.NaN;if(o<=0)return 0;if(o>=1)return 1;const i=Math.exp(B(r+n)-B(r)-B(n)+r*Math.log(o)+n*Math.log(1-o));return o<(r+1)/(r+n+2)?i*x(r,n,o)/r:1-i*x(n,r,1-o)/n}function Y(r){if(!(r>0)||!(r<1))return r===0?-1/0:r===1?1/0:Number.NaN;const n=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],o=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],i=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],t=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],c=.02425;let s,a,f;r<c?(s=Math.sqrt(-2*Math.log(r)),f=(((((i[0]*s+i[1])*s+i[2])*s+i[3])*s+i[4])*s+i[5])/((((t[0]*s+t[1])*s+t[2])*s+t[3])*s+1)):r<=1-c?(s=r-.5,a=s*s,f=(((((n[0]*a+n[1])*a+n[2])*a+n[3])*a+n[4])*a+n[5])*s/(((((o[0]*a+o[1])*a+o[2])*a+o[3])*a+o[4])*a+1)):(s=Math.sqrt(-2*Math.log(1-r)),f=-(((((i[0]*s+i[1])*s+i[2])*s+i[3])*s+i[4])*s+i[5])/((((t[0]*s+t[1])*s+t[2])*s+t[3])*s+1));const g=(.5*U(-f/Math.SQRT2)-r)*Math.sqrt(2*Math.PI)*Math.exp(f*f/2);return f-g/(1+f*g/2)}function U(r){const n=Math.abs(r),o=2/(2+n),i=4*o-2,t=[-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 c=0,s=0,a;for(let w=t.length-1;w>0;w--)a=s,s=i*s-c+t[w],c=a;const f=o*Math.exp(-n*n+.5*(t[0]+i*s)-c);return r>=0?f:2-f}function W(r){return .5*U(-r/Math.SQRT2)}function K(r,n){if(!(n>0)||!Number.isFinite(r))return Number.NaN;const o=.5*Z(n/2,.5,n/(n+r*r));return r>0?1-o:o}function E(r,n){if(!(r>0)||!(r<1)||!(n>0))return Number.NaN;if(n>1e7)return Y(r);let o=-1e4,i=1e4,t=Y(r);const c=B(n/2)+B(.5)-B((n+1)/2);for(let s=0;s<60;s++){const a=K(t,n);a<r?o=t:i=t;const f=Math.exp(-((n+1)/2)*Math.log(1+t*t/n)-c)/Math.sqrt(n),w=f>0?(a-r)/f:0;if(Math.abs(w)<1e-12)break;const g=t-w;if(t=g>o&&g<i&&Number.isFinite(g)?g:(o+i)/2,i-o<1e-12)break}return t}function O(r,n){let o=r,i=1/r,t=i;for(let c=0;c<300&&(o+=1,t*=n/o,i+=t,!(Math.abs(t)<Math.abs(i)*$));c++);return i*Math.exp(-n+r*Math.log(n)-B(r))}function b(r,n){let o=n+1-r,i=1/q,t=1/o,c=t;for(let s=1;s<=300;s++){const a=-s*(s-r);o+=2,t=a*t+o,Math.abs(t)<q&&(t=q),i=o+a/i,Math.abs(i)<q&&(i=q),t=1/t;const f=t*i;if(c*=f,Math.abs(f-1)<$)break}return Math.exp(-n+r*Math.log(n)-B(r))*c}function u(r,n){return!(r>0)||!(n>=0)||!Number.isFinite(n)?Number.NaN:n===0?0:n<r+1?O(r,n):1-b(r,n)}function h(r,n){return n>0?u(n/2,r/2):Number.NaN}function l(r,n){const o=h(r,n);return Number.isNaN(o)?Number.NaN:Math.min(1,Math.max(0,1-o))}}),Ue("packages/core/src/compute/linalg.js",function(e,H){"use strict";Object.defineProperty(e,"cholesky",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"choleskySolve",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"choleskyInverse",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"normalEquations",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return Z}});function ne(Y){const U=Y.length,W=Array.from({length:U},()=>new Array(U).fill(0));for(let K=0;K<U;K++)for(let E=0;E<=K;E++){let O=Y[K][E];for(let b=0;b<E;b++)O-=W[K][b]*W[E][b];if(K===E){if(!(O>0))return null;W[K][E]=Math.sqrt(O)}else W[K][E]=O/W[E][E]}return W}function $(Y,U){const W=Y.length,K=new Array(W).fill(0);for(let O=0;O<W;O++){let b=U[O];for(let u=0;u<O;u++)b-=Y[O][u]*K[u];K[O]=b/Y[O][O]}const E=new Array(W).fill(0);for(let O=W-1;O>=0;O--){let b=K[O];for(let u=O+1;u<W;u++)b-=Y[u][O]*E[u];E[O]=b/Y[O][O]}return E}function q(Y){const U=Y.length,W=Array.from({length:U},()=>new Array(U).fill(0));for(let K=0;K<U;K++){const E=new Array(U).fill(0);E[K]=1;const O=$(Y,E);for(let b=0;b<U;b++)W[b][K]=O[b]}return W}function B(Y,U,W){const K=Y.length,E=K?Y[0].length:0,O=Array.from({length:E},()=>new Array(E).fill(0)),b=new Array(E).fill(0);for(let u=0;u<K;u++){const h=W?W[u]:1,l=Y[u];for(let r=0;r<E;r++){const n=h*l[r];b[r]+=n*U[u];for(let o=r;o<E;o++)O[r][o]+=n*l[o]}}for(let u=0;u<E;u++)for(let h=0;h<u;h++)O[u][h]=O[h][u];return{xtwx:O,xtwy:b}}function x(Y,U){return Y.map(W=>W.reduce((K,E,O)=>K+E*U[O],0))}function Z(Y,U){let W=0;for(let K=0;K<Y.length;K++){let E=0;for(let O=0;O<Y.length;O++)E+=U[K][O]*Y[O];W+=Y[K]*E}return W}}),Ue("packages/core/src/compute/sketch.js",function(e,H){"use strict";Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return O}});class ne{#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(u){if(!Number.isFinite(u))return;this.#e++;const h=u-this.#t;this.#t+=h/this.#e,this.#n+=h*(u-this.#t)}merge(u){if(u.#e===0)return;if(this.#e===0){this.#e=u.#e,this.#t=u.#t,this.#n=u.#n;return}const h=this.#e+u.#e,l=u.#t-this.#t;this.#t+=l*(u.#e/h),this.#n+=u.#n+l*l*(this.#e*u.#e/h),this.#e=h}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 u=this.variance();return u===null?null:Math.sqrt(u)}stddevP(){const u=this.varianceP();return u===null?null:Math.sqrt(u)}}class ${#e=[];#t=0;#n;#r;constructor(u,h=Math.random){if(!(u>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(u),this.#r=h}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(u){if(!Number.isFinite(u))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(u);return}const h=Math.floor(this.#r()*this.#t);h<this.#n&&(this.#e[h]=u)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let u=0;for(const h of this.#e)u+=h;return u/this.#e.length}quantile(u){const h=this.#e.length;if(!h)return null;const l=this.#e.slice().sort((i,t)=>i-t);if(h===1)return l[0];const r=(h-1)*Math.min(1,Math.max(0,u)),n=Math.floor(r),o=Math.ceil(r);return n===o?l[n]:l[n]+(r-n)*(l[o]-l[n])}}function q(b){return b^=b>>>16,b=Math.imul(b,2246822507),b^=b>>>13,b=Math.imul(b,3266489909),b^=b>>>15,b>>>0}function B(b){if(typeof b=="number"){const l=new DataView(new ArrayBuffer(8));return l.setFloat64(0,b===0?0:b),q(l.getUint32(0)^l.getUint32(4))}const u=typeof b=="string"?b:String(b);let h=2166136261;for(let l=0;l<u.length;l++)h^=u.charCodeAt(l),h=Math.imul(h,16777619);return q(h)}class x{#e;#t;#n;constructor(u=14){const h=Math.floor(u);if(h<4||h>16)throw new RangeError("HLL precision must be 4..16");this.#e=h,this.#t=1<<h,this.#n=new Uint8Array(this.#t)}static errorBoundFor(u=14){const h=1<<Math.floor(u),l=1.04/Math.sqrt(h);return Object.freeze({kind:"probabilistic",metric:"relative",value:l,statement:`distinct count within ~${(l*100).toFixed(2)}% relative standard error (m=${h} buckets)`})}errorBound(){return x.errorBoundFor(this.#e)}add(u){const h=B(u),l=h&this.#t-1,r=h>>>this.#e|1<<32-this.#e;let n=1,o=r;for(;(o&1)===0;)n++,o>>>=1;n>this.#n[l]&&(this.#n[l]=n)}count(){const u=this.#t,h=32-this.#e,l=new Float64Array(h+2);for(let o=0;o<u;o++)l[this.#n[o]]++;let r=u*U(1-l[h+1]/u);for(let o=h;o>=1;o--)r=.5*(r+l[o]);r+=u*Y(l[0]/u);const n=Z*u*u/r;return Math.round(n)}}const Z=.5/Math.log(2);function Y(b){if(b===1)return 1/0;let u=1,h=b,l;do b*=b,l=h,h+=b*u,u+=u;while(h!==l);return h}function U(b){if(b===0||b===1)return 0;let u=1,h=1-b,l;do b=Math.sqrt(b),l=h,u*=.5,h-=(1-b)**2*u;while(h!==l);return h/3}class W{#e=new Map;#t;#n=0;constructor(u){if(!(u>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(u)}errorBoundFor(u){const h=u/this.#t;return Object.freeze({kind:"deterministic",metric:"absolute",value:h,statement:`each count overestimates the truth by at most N/m = ${h.toFixed(2)} (N=${u}, m=${this.#t})`})}get seen(){return this.#n}add(u){this.#n++;const h=this.#e.get(u);if(h){h.count++;return}if(this.#e.size<this.#t){this.#e.set(u,{count:1,error:0});return}let l,r=1/0;for(const[n,o]of this.#e)o.count<r&&(r=o.count,l=n);this.#e.delete(l),this.#e.set(u,{count:r+1,error:r})}top(u=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(u)))}}class K{#e;#t=[[]];#n=0;#r;#i;constructor(u=200,h=Math.random){this.#e=Math.max(8,Math.floor(u)),this.#r=h,this.#i=2/3}static errorBoundFor(u=200){const h=1/Math.max(8,Math.floor(u));return Object.freeze({kind:"probabilistic",metric:"rank",value:h,statement:`queried quantile's true rank within ~${(h*100).toFixed(2)}% of N of the requested rank (k=${u})`})}errorBound(){return K.errorBoundFor(this.#e)}get count(){return this.#n}#s(u){const l=this.#t.length-1-u,r=Math.ceil(this.#e*this.#i**l);return Math.max(2,r)}add(u){Number.isFinite(u)&&(this.#n++,this.#t[0].push(u),this.#t[0].length>=this.#s(0)&&this.#o(0))}#o(u){const h=this.#t[u];h.sort((n,o)=>n-o),u+1>=this.#t.length&&this.#t.push([]);const l=this.#t[u+1],r=this.#r()<.5?0:1;for(let n=r;n<h.length;n+=2)l.push(h[n]);this.#t[u]=[];for(let n=0;n<this.#t.length;n++)if(this.#t[n].length>=this.#s(n)){this.#o(n);return}}#l(){const u=[];for(let h=0;h<this.#t.length;h++){const l=1<<h;for(const r of this.#t[h])u.push({v:r,w:l})}return u}quantile(u){const h=this.#l();if(!h.length)return null;h.sort((o,i)=>o.v-i.v);let l=0;for(const o of h)l+=o.w;const r=Math.min(1,Math.max(0,u))*l;let n=0;for(const o of h)if(n+=o.w,n>=r)return o.v;return h[h.length-1].v}rank(u){let h=0;for(let l=0;l<this.#t.length;l++){const r=1<<l;for(const n of this.#t[l])n<=u&&(h+=r)}return h}}const E=Object.freeze({distinct:x.errorBoundFor(14),median:K.errorBoundFor(200),p25:K.errorBoundFor(200),p75:K.errorBoundFor(200),p90:K.errorBoundFor(200),p95:K.errorBoundFor(200),p99:K.errorBoundFor(200),iqr:K.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"})}),O={Welford:ne,Reservoir:$,HyperLogLog:x,SpaceSaving:W,KLL:K,hash32:B,SKETCH_BOUNDS:E}}),Ue("packages/core/src/compute/statistics.js",function(e,H){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"numbers",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"frequencies",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"herfindahl",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"entropy",{enumerable:!0,get:function(){return w}}),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 m}}),Object.defineProperty(e,"quantile",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"STAT_FNS",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"modifiedZOutliers",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"jarqueBera",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"weightedQuantile",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"covariance",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"autocorrelations",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"spearman",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"kendall",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"seriesStats",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"D2_N2",{enumerable:!0,get:function(){return Le}}),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 Se}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return be}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return He}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(e,"countOutside",{enumerable:!0,get:function(){return st}}),Object.defineProperty(e,"histogram",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(e,"DEFAULT_CONFIDENCE",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(e,"meanInterval",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(e,"proportionInterval",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(e,"slopeInterval",{enumerable:!0,get:function(){return It}}),Object.defineProperty(e,"capabilityInterval",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(e,"standardizedMeanDifference",{enumerable:!0,get:function(){return Ut}}),Object.defineProperty(e,"normalTotalVariation",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(e,"frequencyMap",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(e,"categoricalDistance",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(e,"SUBSET_RELIABILITY_FLOOR",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(e,"compareColumn",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"isNumericColumn",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(e,"populationRead",{enumerable:!0,get:function(){return Be}});const ne=H("packages/core/src/compute/handle.js"),$=ne.presenceReader,q=ne.valueReader,B=H("packages/core/src/compute/special.js"),x=B.studentTQuantile,Z=B.studentT,Y=B.normalQuantile,U=B.normalCdf,W=B.chiSquareUpperTail,K=H("packages/core/src/compute/linalg.js"),E=K.cholesky,O=K.choleskySolve,b=K.choleskyInverse,u=K.normalEquations,h=K.quadForm,r=H("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,n=5e3,o=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"}),i=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 t(pe){const Ae=pe==="sum"||pe==="avg"||pe==="countValues"||pe==="min"||pe==="max"?"maintained":Object.prototype.hasOwnProperty.call(o,pe)?o[pe]:null,ve=Object.prototype.hasOwnProperty.call(i,pe)?i[pe]:null;return{stat:pe,exact:Ae,approximate:ve}}function c(pe,Ae){const ve=Ae.length,Pe=new Float64Array(ve);let je=0;if(pe&&(pe.kind==="float64"||pe.kind==="int32")){const ze=pe.values,_e=$(pe);for(let Qe=0;Qe<ve;Qe++){const Te=Ae[Qe];if(_e&&_e(Te)!==1)continue;const Ke=ze[Te];Number.isNaN(Ke)||(Pe[je++]=Ke)}return Pe.subarray(0,je)}const xe=q(pe);for(let ze=0;ze<ve;ze++){const _e=xe(Ae[ze]);if(_e==null||_e==="")continue;const Qe=typeof _e=="number"?_e:Number(_e);Number.isFinite(Qe)&&(Pe[je++]=Qe)}return Pe.subarray(0,je)}function s(pe,Ae){const ve=new Map,Pe=q(pe);let je=0;for(let xe=0;xe<Ae.length;xe++){const ze=Pe(Ae[xe]);if(ze==null||ze===""||typeof ze=="number"&&Number.isNaN(ze))continue;const _e=typeof ze=="object"?String(ze):ze;ve.set(_e,(ve.get(_e)||0)+1),je++}const Ne=[...ve.values()].sort((xe,ze)=>ze-xe);return{counts:Ne,total:je,distinct:Ne.length}}function a(pe){return pe.total>0?pe.counts.map(Ae=>Ae/pe.total):[]}function f(pe,Ae){const ve=s(pe,Ae);if(!ve.total)return null;let Pe=0;for(const je of a(ve))Pe+=je*je;return Pe}function w(pe,Ae){const ve=s(pe,Ae);if(!ve.total)return null;let Pe=0;for(const je of a(ve))je>0&&(Pe-=je*Math.log2(je));return Pe}function g(pe,Ae){const ve=s(pe,Ae);if(!ve.total||ve.distinct<2)return ve.total?1:null;let Pe=0;for(const je of a(ve))je>0&&(Pe-=je*Math.log2(je));return Pe/Math.log2(ve.distinct)}function k(pe,Ae,ve=3){const Pe=s(pe,Ae);if(!Pe.total)return null;const je=Math.max(1,Math.floor(ve));let Ne=0;for(let xe=0;xe<Math.min(je,Pe.counts.length);xe++)Ne+=Pe.counts[xe];return Ne/Pe.total}function d(pe,Ae){const ve=c(pe,Ae),Pe=ve.length;if(!Pe)return null;const je=ve.slice().sort();if(je[0]<0)return null;let Ne=0,xe=0;for(let ze=0;ze<Pe;ze++)Ne+=je[ze],xe+=(ze+1)*je[ze];return Ne===0?0:2*xe/(Pe*Ne)-(Pe+1)/Pe}function p(pe){let Ae=0,ve=0,Pe=0;for(let je=0;je<pe.length;je++){const Ne=pe[je];Ae++;const xe=Ne-ve;ve+=xe/Ae,Pe+=xe*(Ne-ve)}return{n:Ae,mean:ve,m2:Pe}}function m(pe,Ae){const ve=pe.length;if(!ve)return NaN;if(ve===1)return pe[0];const Pe=(ve-1)*Math.min(1,Math.max(0,Ae)),je=Math.floor(Pe),Ne=Math.ceil(Pe);return je===Ne?pe[je]:pe[je]+(Pe-je)*(pe[Ne]-pe[je])}function v(pe,Ae){if(!pe.length)return NaN;const ve=pe.slice().sort();return m(ve,Ae)}function y(pe,Ae){const ve=q(pe);let Pe=0,je=0,Ne=0;for(let xe=0;xe<Ae.length;xe++){const ze=ve(Ae[xe]);if(ze==null||ze==="")continue;const _e=String(ze).toUpperCase();_e==="PASS"?Pe++:_e==="FAIL"?je++:_e==="WARN"&&Ne++}return{pass:Pe+Ne,fail:je,warn:Ne,judged:Pe+Ne+je}}const T=Object.freeze({hhi:(pe,Ae)=>f(pe,Ae),entropy:(pe,Ae)=>w(pe,Ae),evenness:(pe,Ae)=>g(pe,Ae),top3Share:(pe,Ae)=>k(pe,Ae,3),top10Share:(pe,Ae)=>k(pe,Ae,10),gini:(pe,Ae)=>d(pe,Ae),trimmedMean:(pe,Ae)=>I(c(pe,Ae),.1),winsorizedMean:(pe,Ae)=>j(c(pe,Ae),.1),robustOutliers:(pe,Ae)=>L(c(pe,Ae),3.5),jarqueBera:(pe,Ae)=>F(c(pe,Ae)),variance:(pe,Ae)=>{const{n:ve,m2:Pe}=p(c(pe,Ae));return ve>1?Pe/(ve-1):null},varianceP:(pe,Ae)=>{const{n:ve,m2:Pe}=p(c(pe,Ae));return ve>0?Pe/ve:null},stddev:(pe,Ae)=>{const{n:ve,m2:Pe}=p(c(pe,Ae));return ve>1?Math.sqrt(Pe/(ve-1)):null},stddevP:(pe,Ae)=>{const{n:ve,m2:Pe}=p(c(pe,Ae));return ve>0?Math.sqrt(Pe/ve):null},median:(pe,Ae)=>{const ve=c(pe,Ae);return ve.length?v(ve,.5):null},p25:(pe,Ae)=>{const ve=c(pe,Ae);return ve.length?v(ve,.25):null},p75:(pe,Ae)=>{const ve=c(pe,Ae);return ve.length?v(ve,.75):null},p90:(pe,Ae)=>{const ve=c(pe,Ae);return ve.length?v(ve,.9):null},p95:(pe,Ae)=>{const ve=c(pe,Ae);return ve.length?v(ve,.95):null},p99:(pe,Ae)=>{const ve=c(pe,Ae);return ve.length?v(ve,.99):null},iqr:(pe,Ae)=>{const ve=c(pe,Ae);if(!ve.length)return null;const Pe=ve.slice().sort();return m(Pe,.75)-m(Pe,.25)},mad:(pe,Ae)=>{const ve=c(pe,Ae);if(!ve.length)return null;const Pe=v(ve,.5),je=new Float64Array(ve.length);for(let Ne=0;Ne<ve.length;Ne++)je[Ne]=Math.abs(ve[Ne]-Pe);return v(je,.5)},range:(pe,Ae)=>{const ve=c(pe,Ae);if(!ve.length)return null;let Pe=1/0,je=-1/0;for(let Ne=0;Ne<ve.length;Ne++)ve[Ne]<Pe&&(Pe=ve[Ne]),ve[Ne]>je&&(je=ve[Ne]);return je-Pe},distinct:(pe,Ae)=>{const ve=q(pe),Pe=new Set;for(let je=0;je<Ae.length;je++){const Ne=ve(Ae[je]);Ne==null||Ne===""||Pe.add(Ne instanceof Date?Ne.getTime():Ne)}return Pe.size},mode:(pe,Ae)=>{const ve=q(pe),Pe=new Map;for(let xe=0;xe<Ae.length;xe++){const ze=ve(Ae[xe]);if(ze==null||ze==="")continue;const _e=ze instanceof Date?ze.getTime():ze;Pe.set(_e,(Pe.get(_e)||0)+1)}let je=null,Ne=1;for(const[xe,ze]of Pe)ze>Ne&&(Ne=ze,je=xe);return je},skewness:(pe,Ae)=>{const ve=c(pe,Ae),{n:Pe,mean:je,m2:Ne}=p(ve);if(Pe<3||Ne<=0)return null;const xe=Math.sqrt(Ne/(Pe-1));let ze=0;for(let _e=0;_e<ve.length;_e++)ze+=((ve[_e]-je)/xe)**3;return Pe/((Pe-1)*(Pe-2))*ze},kurtosis:(pe,Ae)=>{const ve=c(pe,Ae),{n:Pe,mean:je,m2:Ne}=p(ve);if(Pe<4||Ne<=0)return null;const xe=Math.sqrt(Ne/(Pe-1));let ze=0;for(let Te=0;Te<ve.length;Te++)ze+=((ve[Te]-je)/xe)**4;const _e=Pe*(Pe+1)/((Pe-1)*(Pe-2)*(Pe-3)),Qe=3*(Pe-1)**2/((Pe-2)*(Pe-3));return _e*ze-Qe},geomean:(pe,Ae)=>{const ve=c(pe,Ae);if(!ve.length)return null;let Pe=0;for(let je=0;je<ve.length;je++){if(ve[je]<=0)return null;Pe+=Math.log(ve[je])}return Math.exp(Pe/ve.length)},harmean:(pe,Ae)=>{const ve=c(pe,Ae);if(!ve.length)return null;let Pe=0;for(let je=0;je<ve.length;je++){if(ve[je]===0)return null;Pe+=1/ve[je]}return ve.length/Pe},sumSquares:(pe,Ae)=>{const ve=c(pe,Ae);let Pe=0;for(let je=0;je<ve.length;je++)Pe+=ve[je]*ve[je];return Pe},passRate:(pe,Ae)=>{const{pass:ve,judged:Pe}=y(pe,Ae);return Pe?ve/Pe:null},failureCount:(pe,Ae)=>y(pe,Ae).fail}),A=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 M(pe,Ae,ve){const Pe=q(pe),je=q(Ae);let Ne=0,xe=0;for(let ze=0;ze<ve.length;ze++){const _e=ve[ze],Qe=Number(Pe(_e)),Te=Number(je(_e));!Number.isFinite(Qe)||!Number.isFinite(Te)||(Ne+=Qe*Te,xe+=Te)}return xe===0?null:Ne/xe}function _(pe,Ae,ve){const Pe=q(pe);let je=null,Ne=ve?-1/0:1/0;for(let xe=0;xe<Ae.length;xe++){const ze=Ae[xe],_e=Number(Pe(ze));Number.isFinite(_e)&&(ve?_e>Ne:_e<Ne)&&(Ne=_e,je=ze)}return je}function R(pe,Ae,ve){const Pe=q(pe),je=q(Ae);let Ne=0,xe=0,ze=0,_e=0,Qe=0,Te=0;for(let Ze=0;Ze<ve.length;Ze++){const lt=ve[Ze],ot=Number(Pe(lt)),it=Number(je(lt));!Number.isFinite(ot)||!Number.isFinite(it)||(Ne++,xe+=ot,ze+=it,_e+=ot*ot,Qe+=it*it,Te+=ot*it)}if(Ne<2)return null;const Ke=Ne*Te-xe*ze,qe=Math.sqrt((Ne*_e-xe*xe)*(Ne*Qe-ze*ze));if(qe===0)return null;const Je=Ke/qe;return Math.max(-1,Math.min(1,Je))}function I(pe,Ae=.1){const ve=pe.length;if(!ve)return null;const Pe=Array.from(pe).sort((ze,_e)=>ze-_e),je=Math.floor(ve*Math.min(.49,Math.max(0,Ae))),Ne=Pe.slice(je,ve-je);if(!Ne.length)return m(Pe,.5);let xe=0;for(const ze of Ne)xe+=ze;return xe/Ne.length}function j(pe,Ae=.1){const ve=pe.length;if(!ve)return null;const Pe=Array.from(pe).sort((_e,Qe)=>_e-Qe),je=Math.floor(ve*Math.min(.49,Math.max(0,Ae))),Ne=Pe[je],xe=Pe[ve-1-je];let ze=0;for(const _e of Pe)ze+=Math.min(xe,Math.max(Ne,_e));return ze/ve}function L(pe,Ae=3.5){if(!pe.length)return null;const Pe=Array.from(pe).sort((_e,Qe)=>_e-Qe),je=m(Pe,.5),Ne=Pe.map(_e=>Math.abs(_e-je)).sort((_e,Qe)=>_e-Qe),xe=m(Ne,.5);if(xe===0)return null;let ze=0;for(const _e of Pe)Math.abs(.6745*(_e-je)/xe)>Ae&&ze++;return ze}function F(pe){const Ae=pe.length;if(Ae<8)return null;let ve=0;for(const _e of pe)ve+=_e;ve/=Ae;let Pe=0,je=0,Ne=0;for(const _e of pe){const Qe=_e-ve;Pe+=Qe*Qe,je+=Qe*Qe*Qe,Ne+=Qe*Qe*Qe*Qe}if(Pe/=Ae,je/=Ae,Ne/=Ae,Pe===0)return null;const xe=je/Pe**1.5,ze=Ne/(Pe*Pe)-3;return Ae/6*(xe*xe+ze*ze/4)}function N(pe,Ae,ve){const Pe=[];let je=0;for(let _e=0;_e<pe.length;_e++){const Qe=Number(pe[_e]),Te=Number(Ae[_e]);!Number.isFinite(Qe)||!Number.isFinite(Te)||Te<=0||(Pe.push([Qe,Te]),je+=Te)}if(!Pe.length||je<=0)return null;if(Pe.sort((_e,Qe)=>_e[0]-Qe[0]),Pe.length===1)return Pe[0][0];const Ne=[];let xe=0;for(const[,_e]of Pe)Ne.push((xe+_e/2)/je),xe+=_e;const ze=Math.max(0,Math.min(1,ve));if(ze<=Ne[0])return Pe[0][0];if(ze>=Ne[Ne.length-1])return Pe[Pe.length-1][0];for(let _e=1;_e<Ne.length;_e++){if(ze>Ne[_e])continue;const Qe=Ne[_e]-Ne[_e-1],Te=Qe>0?(ze-Ne[_e-1])/Qe:0;return Pe[_e-1][0]+(Pe[_e][0]-Pe[_e-1][0])*Te}return Pe[Pe.length-1][0]}function S(pe,Ae,ve){const Pe=q(pe),je=q(Ae),Ne=new Float64Array(ve.length),xe=new Float64Array(ve.length);let ze=0;for(let _e=0;_e<ve.length;_e++){const Qe=ve[_e],Te=Number(Pe(Qe)),Ke=Number(je(Qe));!Number.isFinite(Te)||!Number.isFinite(Ke)||(Ne[ze]=Te,xe[ze]=Ke,ze++)}return{xs:Ne.subarray(0,ze),ys:xe.subarray(0,ze),n:ze}}function C(pe,Ae,ve,Pe=!1){const{xs:je,ys:Ne,n:xe}=S(pe,Ae,ve);if(xe<2)return null;let ze=0,_e=0;for(let Te=0;Te<xe;Te++)ze+=je[Te],_e+=Ne[Te];ze/=xe,_e/=xe;let Qe=0;for(let Te=0;Te<xe;Te++)Qe+=(je[Te]-ze)*(Ne[Te]-_e);return Qe/(Pe?xe:xe-1)}function D(pe,Ae,ve){const{xs:Pe,ys:je,n:Ne}=S(pe,Ae,ve);if(Ne<2)return null;let xe=0,ze=0;for(let ot=0;ot<Ne;ot++)xe+=Pe[ot],ze+=je[ot];xe/=Ne,ze/=Ne;let _e=0,Qe=0,Te=0;for(let ot=0;ot<Ne;ot++){const it=Pe[ot]-xe,Ot=je[ot]-ze;_e+=it*it,Qe+=it*Ot,Te+=Ot*Ot}if(_e===0)return null;const Ke=Qe/_e,qe=ze-Ke*xe,Je=Te===0?1:Math.max(0,Math.min(1,Qe*Qe/(_e*Te))),Ze=Math.max(0,Te-Ke*Qe),lt=Ne>2?Math.sqrt(Ze/(Ne-2)/_e):0;return{slope:Ke,intercept:qe,r2:Je,stdError:lt,n:Ne}}const G=new Set(["ols","wls","robust"]),X=new Set(["quantile"]),V=new Set(["ridge","lasso","elasticnet","mixed","gls"]),J=1.345;function ee(pe,Ae,ve){const{xtwx:Pe,xtwy:je}=u(pe,Ae,ve),Ne=E(Pe);if(!Ne)return null;const xe=O(Ne,je),ze=b(Ne),_e=te(pe,xe),Qe=Ae.map((Te,Ke)=>Te-_e[Ke]);return{beta:xe,cov:ze,fitted:_e,residuals:Qe}}function te(pe,Ae){return pe.map(ve=>ve.reduce((Pe,je,Ne)=>Pe+je*Ae[Ne],0))}function ie(pe,Ae){const ve=pe.length,Pe=pe.map(Qe=>Qe[Ae]),je=pe.map(Qe=>[1,...Qe.filter((Te,Ke)=>Ke!==Ae)]),Ne=ee(je,Pe,null);if(!Ne)return 1;const xe=Pe.reduce((Qe,Te)=>Qe+Te,0)/ve;let ze=0,_e=0;for(let Qe=0;Qe<ve;Qe++)ze+=Ne.residuals[Qe]**2,_e+=(Pe[Qe]-xe)**2;return _e===0?1:Math.max(0,Math.min(1,1-ze/_e))}function oe(pe){const Ae=[...pe].sort((je,Ne)=>je-Ne),ve=ue(Ae),Pe=pe.map(je=>Math.abs(je-ve)).sort((je,Ne)=>je-Ne);return ue(Pe)/.6745}function ue(pe){const Ae=pe.length;if(!Ae)return 0;const ve=Math.floor(Ae/2);return Ae%2?pe[ve]:(pe[ve-1]+pe[ve])/2}function ye(pe,Ae,ve={}){const Pe=ve.method||"ols";if(V.has(Pe))throw new Error(`[lattice] regression method "${Pe}" is out of scope; use ols, wls or robust.`);if(X.has(Pe))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!G.has(Pe))throw new Error(`[lattice] unknown regression method "${Pe}"; use ols, wls or robust.`);const je=Array.isArray(Ae)?Ae.length:0,Ne=je&&Array.isArray(pe[0])?pe[0].length:0,xe=Ne+1;if(!(je>xe))return null;for(let Nt=0;Nt<je;Nt++){if(!Number.isFinite(Ae[Nt])||!Array.isArray(pe[Nt])||pe[Nt].length!==Ne)return null;for(let xt=0;xt<Ne;xt++)if(!Number.isFinite(pe[Nt][xt]))return null}let ze=null;if(Pe==="wls"){if(ze=ve.weights,!Array.isArray(ze)||ze.length!==je)return null;for(let Nt=0;Nt<je;Nt++)if(!(ze[Nt]>0)||!Number.isFinite(ze[Nt]))return null}const _e=pe.map(Nt=>[1,...Nt]);let Qe,Te=null;if(Pe==="robust"){if(Qe=ee(_e,Ae,null),!Qe)return null;for(let Nt=0;Nt<50;Nt++){const xt=oe(Qe.residuals);if(!(xt>0))break;const zt=Qe.residuals.map(Qt=>{const Xt=Math.abs(Qt/xt);return Xt<=J?1:J/Xt}),Gt=ee(_e,Ae,zt);if(!Gt)return null;const Zt=Gt.beta.reduce((Qt,Xt,rn)=>Math.max(Qt,Math.abs(Xt-Qe.beta[rn])),0);if(Qe=Gt,Te=zt,Zt<1e-10)break}}else if(Qe=ee(_e,Ae,ze),!Qe)return null;const Ke=Pe==="robust"?Te:ze,{beta:qe,cov:Je,fitted:Ze,residuals:lt}=Qe;let ot=0,it=0,Ot=0;for(let Nt=0;Nt<je;Nt++){const xt=Ke?Ke[Nt]:1;ot+=xt*lt[Nt]**2,it+=xt,Ot+=xt*Ae[Nt]}const jt=Ot/it;let Rt=0;for(let Nt=0;Nt<je;Nt++){const xt=Ke?Ke[Nt]:1;Rt+=xt*(Ae[Nt]-jt)**2}const We=je-xe,gt=ot/We,ct=Rt===0?1:Math.max(0,Math.min(1,1-ot/Rt)),bt=1-(1-ct)*(je-1)/We,Et=Array.isArray(ve.names)&&ve.names.length===Ne?ve.names:pe[0].map((Nt,xt)=>`x${xt+1}`),ht=St(ve.confidence),ut=We>0?x(1-(1-ht)/2,We):1/0,Tt=qe.map((Nt,xt)=>{const zt=Math.sqrt(Math.max(0,gt*Je[xt][xt])),Gt=zt>0?Nt/zt:Nt===0?0:1/0,Zt=Number.isFinite(Gt)?2*(1-Z(Math.abs(Gt),We)):0,Qt=Number.isFinite(ut)?ut*zt:null;return{name:xt===0?"(intercept)":Et[xt-1],estimate:Nt,stdError:zt,t:Gt,p:Math.max(0,Math.min(1,Zt)),lower:Qt===null?null:Nt-Qt,upper:Qt===null?null:Nt+Qt}}),Ht=new Array(je),Yt=new Array(je);for(let Nt=0;Nt<je;Nt++){const xt=Ke?Ke[Nt]:1,zt=Math.max(0,Math.min(1,xt*h(_e[Nt],Je)));Ht[Nt]=zt;const Gt=(1-zt)**2;Yt[Nt]=Gt>0&>>0?lt[Nt]**2/(xe*gt)*(zt/Gt):null}const pn=pe[0].map((Nt,xt)=>{if(Ne<2)return 1;const zt=ie(pe,xt);return zt>=1?1/0:1/(1-zt)});let un=null;{const Nt=lt.map(zt=>zt*zt),xt=ee(_e,Nt,null);if(xt){const zt=Nt.reduce((Jt,mn)=>Jt+mn,0)/je;let Gt=0,Zt=0;for(let Jt=0;Jt<je;Jt++)Gt+=xt.residuals[Jt]**2,Zt+=(Nt[Jt]-zt)**2;const Qt=Zt===0?0:Math.max(0,Math.min(1,1-Gt/Zt)),Xt=je*Qt,rn=W(Xt,Ne);un={statistic:Xt,df:Ne,p:rn,heteroscedastic:rn<.05}}}let an=null;if(Ne===1){const Nt=pe.map((xt,zt)=>zt).sort((xt,zt)=>pe[xt][0]-pe[zt][0]);an={confidence:ht,points:Nt.map(xt=>{const zt=_e[xt],Gt=Math.sqrt(Math.max(0,gt*h(zt,Je)));return{x:pe[xt][0],yhat:Ze[xt],lower:Ze[xt]-ut*Gt,upper:Ze[xt]+ut*Gt}})}}return{method:Pe,coefficients:Tt,r2:ct,adjR2:bt,n:je,df:We,sigma2:gt,fitted:Ze,residuals:lt,leverage:Ht,cooksD:Yt,vif:pn,heteroscedasticity:un,band:an,weights:Ke?[...Ke]:null}}function he(pe){const Ae=pe.length,ve=Array.from({length:Ae},(Ne,xe)=>xe).sort((Ne,xe)=>pe[Ne]-pe[xe]),Pe=new Float64Array(Ae);let je=0;for(;je<Ae;){let Ne=je;for(;Ne+1<Ae&&pe[ve[Ne+1]]===pe[ve[je]];)Ne++;const xe=(je+Ne)/2+1;for(let ze=je;ze<=Ne;ze++)Pe[ve[ze]]=xe;je=Ne+1}return Pe}const Re=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function Ce(pe){const Ae=[.01,.05,.1],ve=[Re["1%"],Re["5%"],Re["10%"]];if(pe<=ve[0]){const Ne=(Math.log(Ae[1])-Math.log(Ae[0]))/(ve[1]-ve[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(Ae[0])+Ne*(pe-ve[0]))))}if(pe>=ve[2]){const Ne=(Math.log(Ae[2])-Math.log(Ae[1]))/(ve[2]-ve[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(Ae[2])+Ne*(pe-ve[2]))))}const Pe=pe<ve[1]?0:1,je=(pe-ve[Pe])/(ve[Pe+1]-ve[Pe]);return Math.exp(Math.log(Ae[Pe])+je*(Math.log(Ae[Pe+1])-Math.log(Ae[Pe])))}function we(pe,Ae,ve,Pe){const je=ve-Pe,Ne=Pe+3,xe=new Array(je),ze=new Array(je);let _e=!0,Qe=Pe;for(let Ze=0;Ze<je;Ze++){const lt=Pe+Ze,ot=new Float64Array(Ne);ot[0]=1,ot[1]=Ze+1,ot[2]=pe[lt];for(let it=1;it<=Pe;it++)ot[2+it]=Ae[lt-it];for(let it=1;it<Ne;it++)Number.isFinite(ot[it])||(Qe=Math.min(Qe,it-3));xe[Ze]=ot,ze[Ze]=Ae[lt],Number.isFinite(ze[Ze])||(_e=!1)}if(!_e)return 0;const{xtwx:Te,xtwy:Ke}=u(xe,ze,null);let qe=0,Je=1/0;for(let Ze=0;Ze<=Qe;Ze++){const lt=Ze+3;if(!(je>lt))continue;const ot=new Array(lt);for(let ct=0;ct<lt;ct++)ot[ct]=Te[ct].slice(0,lt);const it=E(ot);if(!it)continue;const Ot=O(it,Ke.slice(0,lt));let jt=0;for(let ct=0;ct<je;ct++){const bt=xe[ct];let Et=0;for(let ht=0;ht<lt;ht++)Et+=bt[ht]*Ot[ht];jt+=(ze[ct]-Et)**2}const We=jt/(je-lt)*(je-lt);if(!(We>0))continue;const gt=je*Math.log(We/je)+2*lt;gt<Je&&(Je=gt,qe=Ze)}return qe}function re(pe,Ae={}){const ve=[];for(let Je=0;Je<pe.length;Je++){const Ze=Number(pe[Je]);Number.isFinite(Ze)&&ve.push(Ze)}const Pe=ve.length,je=Pe-1;if(Pe<8||je<6)return null;const Ne=new Array(je);for(let Je=0;Je<je;Je++)Ne[Je]=ve[Je+1]-ve[Je];let xe=Number.isFinite(Ae.maxlag)?Math.floor(Ae.maxlag):Math.ceil(12*(Pe/100)**.25);xe=Math.max(0,Math.min(xe,Math.floor((je-5)/2)));const ze=(Je,Ze)=>{const lt=[],ot=[];for(let it=Ze;it<je;it++){const Ot=[it-Ze+1,ve[it]];for(let jt=1;jt<=Je;jt++)Ot.push(Ne[it-jt]);lt.push(Ot),ot.push(Ne[it])}return ye(lt,ot,{method:"ols"})},_e=we(ve,Ne,je,xe),Qe=ze(_e,_e);if(!Qe||!Qe.coefficients[2])return null;const Te=Qe.coefficients[2].t,Ke=Ce(Te),qe=Te<Re["5%"];return{statistic:Te,usedLag:_e,nobs:je-_e,criticalValues:{...Re},pValue:Ke,pApproximate:!0,stationary:qe,verdict:qe?"stationary":"non-stationary",regression:"ct"}}function de(pe,Ae={}){const ve=[];for(let qe=0;qe<pe.length;qe++){const Je=Number(pe[qe]);Number.isFinite(Je)&&ve.push(Je)}const Pe=ve.length;if(Pe<3)return null;let je=Number.isFinite(Ae.maxlag)?Math.floor(Ae.maxlag):Math.min(10,Pe-1);je=Math.max(1,Math.min(je,Pe-1));let Ne=0;for(const qe of ve)Ne+=qe;Ne/=Pe;const xe=ve.map(qe=>qe-Ne);let ze=0;for(const qe of xe)ze+=qe*qe;ze/=Pe;const _e=new Array(je+1).fill(0);_e[0]=1;for(let qe=1;qe<=je;qe++){let Je=0;for(let Ze=qe;Ze<Pe;Ze++)Je+=xe[Ze]*xe[Ze-qe];_e[qe]=ze>0?Je/Pe/ze:0}const Qe=new Array(je+1).fill(0);Qe[0]=1;let Te=[];for(let qe=1;qe<=je;qe++){let Je=_e[qe];for(let it=1;it<qe;it++)Je-=Te[it-1]*_e[qe-it];let Ze=1;for(let it=1;it<qe;it++)Ze-=Te[it-1]*_e[it];const lt=Ze!==0?Je/Ze:0,ot=new Array(qe);for(let it=1;it<qe;it++)ot[it-1]=Te[it-1]-lt*Te[qe-1-it];ot[qe-1]=lt,Qe[qe]=lt,Te=ot}const Ke=1.96/Math.sqrt(Pe);return{acf:_e,pacf:Qe,bounds:{upper:Ke,lower:-Ke},n:Pe,nlags:je,approximate:!0}}function me(pe,Ae,ve){const{xs:Pe,ys:je,n:Ne}=S(pe,Ae,ve);if(Ne<2)return null;const xe=he(Pe),ze=he(je);let _e=0,Qe=0;for(let Je=0;Je<Ne;Je++)_e+=xe[Je],Qe+=ze[Je];_e/=Ne,Qe/=Ne;let Te=0,Ke=0,qe=0;for(let Je=0;Je<Ne;Je++){const Ze=xe[Je]-_e,lt=ze[Je]-Qe;Te+=Ze*lt,Ke+=Ze*Ze,qe+=lt*lt}return Ke===0||qe===0?null:Math.max(-1,Math.min(1,Te/Math.sqrt(Ke*qe)))}function Oe(pe,Ae,ve){const{xs:Pe,ys:je,n:Ne}=S(pe,Ae,ve);if(Ne<2||Ne>n)return null;let xe=0,ze=0,_e=0,Qe=0;for(let qe=0;qe<Ne;qe++)for(let Je=qe+1;Je<Ne;Je++){const Ze=Math.sign(Pe[qe]-Pe[Je]),lt=Math.sign(je[qe]-je[Je]),ot=Ze*lt;ot>0?xe++:ot<0?ze++:Ze===0&<===0||(Ze===0?_e++:Qe++)}const Te=xe+ze+Qe,Ke=xe+ze+_e;return Te===0||Ke===0?null:(xe-ze)/Math.sqrt(Te*Ke)}function ke(pe,Ae={}){const ve=pe.length;if(ve<2)return null;const Pe=pe[0],je=pe[ve-1],Ne=[];for(let it=1;it<ve;it++){const Ot=pe[it-1];Ot!==0&&Ne.push((pe[it]-Ot)/Math.abs(Ot))}let xe=null;if(Ne.length>1){let it=0;for(const jt of Ne)it+=jt;it/=Ne.length;let Ot=0;for(const jt of Ne)Ot+=(jt-it)**2;xe=Math.sqrt(Ot/(Ne.length-1))}const ze=Number(Ae.periodsPerYear)>0?Number(Ae.periodsPerYear):null;let _e=pe[0],Qe=0,Te=0,Ke=0,qe=0;for(let it=1;it<ve;it++){if(pe[it]>_e){_e=pe[it],Qe=it;continue}if(_e<=0)continue;const Ot=(_e-pe[it])/_e;Ot>Te&&(Te=Ot,Ke=Qe,qe=it)}let Je=null;if(ve>2){let it=0;for(let Rt=0;Rt<ve;Rt++)it+=pe[Rt];it/=ve;let Ot=0,jt=0;for(let Rt=0;Rt<ve;Rt++){const We=pe[Rt]-it;jt+=We*We,Rt>0&&(Ot+=We*(pe[Rt-1]-it))}Je=jt>0?Ot/jt:null}let Ze=0,lt=0;for(const it of Ne)it>0?Ze++:it<0&<++;let ot=null;if(Pe>0&&je>0){const it=(je/Pe)**(1/(ve-1))-1;ot=ze?(1+it)**ze-1:it}return{n:ve,first:Pe,last:je,change:je-Pe,changePercent:Pe===0?null:(je-Pe)/Math.abs(Pe)*100,volatility:xe,annualisedVolatility:xe!==null&&ze?xe*Math.sqrt(ze):null,growth:ot,maxDrawdown:Te,maxDrawdownFrom:Ke,maxDrawdownTo:qe,autocorrelation:Je,upDays:Ze,downDays:lt}}const Le=1.128,ce=3.267;function ge(pe){const Ae=pe.length;if(Ae<2)return null;const ve=[];for(let je=1;je<Ae;je++)ve.push(Math.abs(pe[je]-pe[je-1]));const Pe=ve.reduce((je,Ne)=>je+Ne,0)/ve.length;return{ranges:ve,centre:Pe,upper:ce*Pe,lower:0}}function Se(pe){const Ae=pe.length;if(Ae<2)return null;let ve=0;for(let je=1;je<Ae;je++)ve+=Math.abs(pe[je]-pe[je-1]);const Pe=ve/(Ae-1);return{sigma:Pe/Le,meanRange:Pe}}function Fe(pe,Ae){const ve=pe.length;if(ve<2||!Ae)return null;const Pe=Number.isFinite(Number(Ae.lower))?Number(Ae.lower):null,je=Number.isFinite(Number(Ae.upper))?Number(Ae.upper):null;if(Pe===null&&je===null)return null;let Ne=0;for(let Ze=0;Ze<ve;Ze++)Ne+=pe[Ze];Ne/=ve;let xe=0;for(let Ze=0;Ze<ve;Ze++)xe+=(pe[Ze]-Ne)**2;const ze=Math.sqrt(xe/(ve-1)),_e=Se(pe),Qe=_e?_e.sigma:null,Te=Ze=>{if(!Ze||Ze<=0)return{index:null,k:null};const ot=Pe!==null&&je!==null?(je-Pe)/(6*Ze):null,it=je!==null?(je-Ne)/(3*Ze):1/0,Ot=Pe!==null?(Ne-Pe)/(3*Ze):1/0;return{index:ot,k:Math.min(it,Ot)}},Ke=Te(Qe),qe=Te(ze);let Je=0;for(let Ze=0;Ze<ve;Ze++){if(Pe!==null&&pe[Ze]<Pe){Je++;continue}je!==null&&pe[Ze]>je&&Je++}return{n:ve,mean:Ne,lower:Pe,upper:je,target:Number.isFinite(Number(Ae.target))?Number(Ae.target):null,sigmaWithin:Qe,sigmaOverall:ze,cp:Ke.index,cpk:Ke.k,pp:qe.index,ppk:qe.k,outOfSpec:Je,defectRate:ve?Je/ve:null}}function be(pe){const Ae=pe.length;if(Ae<2)return null;const ve=Se(pe);if(!ve||!(ve.sigma>0))return null;let Pe=0;for(let je=0;je<Ae;je++)Pe+=pe[je];return Pe/=Ae,{centre:Pe,sigma:ve.sigma,upper:Pe+3*ve.sigma,lower:Pe-3*ve.sigma}}function Ie(pe,Ae){if(!Ae||!(Ae.sigma>0))return[];const ve=pe.length,{centre:Pe,sigma:je}=Ae,Ne=ze=>(pe[ze]-Pe)/je,xe=[];for(let ze=0;ze<ve;ze++){if(Math.abs(Ne(ze))>3&&xe.push({index:ze,rule:1,description:"beyond three sigma"}),ze>=2)for(const _e of[1,-1]){let Qe=0;for(let Te=ze-2;Te<=ze;Te++)Ne(Te)*_e>2&&Qe++;if(Qe>=2){xe.push({index:ze,rule:2,description:"two of three past two sigma"});break}}if(ze>=4)for(const _e of[1,-1]){let Qe=0;for(let Te=ze-4;Te<=ze;Te++)Ne(Te)*_e>1&&Qe++;if(Qe>=4){xe.push({index:ze,rule:3,description:"four of five past one sigma"});break}}if(ze>=7)for(const _e of[1,-1]){let Qe=!0;for(let Te=ze-7;Te<=ze;Te++)if(Ne(Te)*_e<=0){Qe=!1;break}if(Qe){xe.push({index:ze,rule:4,description:"eight in a row on one side"});break}}}return xe}function He(pe,Ae){if(!Ae||!(Ae.sigma>0))return[];const ve=pe.length,{centre:Pe,sigma:je}=Ae,Ne=_e=>(pe[_e]-Pe)/je,xe=(_e,Qe,Te,Ke)=>{for(const qe of[1,-1]){let Je=0;for(let Ze=_e;Ze<=Qe;Ze++)Ne(Ze)*qe>Te&&Je++;if(Je>=Ke)return!0}return!1},ze=[];for(let _e=0;_e<ve;_e++){if(Math.abs(Ne(_e))>3&&ze.push({index:_e,rule:1,description:"beyond three sigma"}),_e>=8)for(const Qe of[1,-1]){let Te=!0;for(let Ke=_e-8;Ke<=_e;Ke++)if(Ne(Ke)*Qe<=0){Te=!1;break}if(Te){ze.push({index:_e,rule:2,description:"nine in a row on one side"});break}}if(_e>=5)for(const Qe of[1,-1]){let Te=!0;for(let Ke=_e-4;Ke<=_e;Ke++)if((pe[Ke]-pe[Ke-1])*Qe<=0){Te=!1;break}if(Te){ze.push({index:_e,rule:3,description:Qe>0?"six rising":"six falling"});break}}if(_e>=13){let Qe=!0;for(let Te=_e-12;Te<=_e;Te++){const Ke=pe[Te]-pe[Te-1],qe=pe[Te+1<=_e?Te+1:Te]-pe[Te];if(Te+1>_e)break;if(Ke===0||qe===0||Ke>0==qe>0){Qe=!1;break}}Qe&&ze.push({index:_e,rule:4,description:"fourteen alternating"})}if(_e>=2&&xe(_e-2,_e,2,2)&&ze.push({index:_e,rule:5,description:"two of three past two sigma"}),_e>=4&&xe(_e-4,_e,1,4)&&ze.push({index:_e,rule:6,description:"four of five past one sigma"}),_e>=14){let Qe=!0;for(let Te=_e-14;Te<=_e;Te++)if(Math.abs(Ne(Te))>=1){Qe=!1;break}Qe&&ze.push({index:_e,rule:7,description:"fifteen within one sigma"})}if(_e>=7){let Qe=!0;for(let Te=_e-7;Te<=_e;Te++)if(Math.abs(Ne(Te))<=1){Qe=!1;break}Qe&&ze.push({index:_e,rule:8,description:"eight beyond one sigma"})}}return ze}const Ge=Object.freeze(["westernElectric","nelson"]);function nt(pe,Ae,ve="westernElectric"){return String(ve)==="nelson"?He(pe,Ae):Ie(pe,Ae)}function st(pe,Ae,ve){let Pe=0;for(let je=0;je<pe.length;je++)(pe[je]<Ae||pe[je]>ve)&&Pe++;return Pe}function mt(pe,Ae,ve,Pe=20){const je=pe.length;if(!je)return[];const Ne=pe[0],xe=pe[je-1];if(xe===Ne)return[{from:Ne,to:xe,count:je}];const ze=ve-Ae,_e=1.5*ze;let Qe=ze>0?Math.max(Ne,Ae-_e):Ne,Te=ze>0?Math.min(xe,ve+_e):xe;Te>Qe||(Qe=Ne,Te=xe);const Ke=ze>0?2*ze/Math.cbrt(je):(Te-Qe)/(Math.ceil(Math.log2(je))+1),qe=Ke>0?Math.min(Pe,Math.max(1,Math.ceil((Te-Qe)/Ke))):1,Je=(Te-Qe)/qe,Ze=[];for(let lt=0;lt<qe;lt++)Ze.push({from:Qe+lt*Je,to:Qe+(lt+1)*Je,count:0});for(let lt=0;lt<je;lt++){const ot=Math.min(qe-1,Math.max(0,Math.floor((pe[lt]-Qe)/Je)));Ze[ot].count++}return Ze[0].from=Ne,Ze[qe-1].to=xe,Ze}const kt=.95;function St(pe){const Ae=Number(pe);return Number.isFinite(Ae)&&Ae>0&&Ae<1?Ae:kt}function Pt(pe,Ae=kt){const ve=pe.length;if(ve<2)return null;let Pe=0;for(let Te=0;Te<ve;Te++)Pe+=pe[Te];const je=Pe/ve;let Ne=0;for(let Te=0;Te<ve;Te++){const Ke=pe[Te]-je;Ne+=Ke*Ke}const xe=Math.sqrt(Ne/(ve-1)),ze=St(Ae),Qe=x(1-(1-ze)/2,ve-1)*xe/Math.sqrt(ve);return{mean:je,lower:je-Qe,upper:je+Qe,margin:Qe,n:ve,confidence:ze}}function Mt(pe,Ae,ve=kt){const Pe=Number(pe),je=Number(Ae);if(!(je>0)||!(Pe>=0)||Pe>je)return null;const Ne=St(ve),xe=Y(1-(1-Ne)/2),ze=Pe/je,_e=xe*xe,Qe=1+_e/je,Te=(ze+_e/(2*je))/Qe,Ke=xe/Qe*Math.sqrt(ze*(1-ze)/je+_e/(4*je*je));return{proportion:ze,lower:Math.max(0,Te-Ke),upper:Math.min(1,Te+Ke),n:je,confidence:Ne}}function It(pe,Ae=kt){if(!pe||!(pe.n>2)||!Number.isFinite(pe.stdError))return null;const ve=St(Ae),je=x(1-(1-ve)/2,pe.n-2)*pe.stdError;return{slope:pe.slope,lower:pe.slope-je,upper:pe.slope+je,margin:je,confidence:ve}}function $t(pe,Ae,ve=kt){const Pe=Number(pe),je=Number(Ae);if(!Number.isFinite(Pe)||!(je>1))return null;const Ne=St(ve),ze=Y(1-(1-Ne)/2)*Math.sqrt(1/(9*je)+Pe*Pe/(2*(je-1)));return{index:Pe,lower:Pe-ze,upper:Pe+ze,margin:ze,n:je,confidence:Ne}}function Ut(pe,Ae){return!pe||!(pe.sd>0)||!Number.isFinite(Ae)||!Number.isFinite(pe.mean)?null:(Ae-pe.mean)/pe.sd}function ft(pe){return Number.isFinite(pe)?Math.min(1,Math.max(0,2*U(Math.abs(pe)/2)-1)):0}function dt(pe,Ae){const ve=new Map,Pe=q(pe);let je=0;for(let Ne=0;Ne<Ae.length;Ne++){const xe=Pe(Ae[Ne]);if(xe==null||xe===""||typeof xe=="number"&&Number.isNaN(xe))continue;const ze=xe instanceof Date?xe.getTime():typeof xe=="object"?String(xe):xe;ve.set(ze,(ve.get(ze)||0)+1),je++}return{map:ve,total:je}}function wt(pe,Ae,ve,Pe){if(!(Ae>0)||!(Pe>0))return null;let je=0;const Ne=new Set(pe.keys());for(const xe of ve.keys())Ne.add(xe);for(const xe of Ne){const ze=(pe.get(xe)||0)/Ae,_e=(ve.get(xe)||0)/Pe;je+=Math.abs(ze-_e)}return je/2}const rt=10;function fe(pe,Ae,ve){if(ve&&ve.numeric){const ze=c(pe,Ae),{n:_e,mean:Qe}=p(ze),Te=_e>0?Ut({mean:ve.mean,sd:ve.sd},Qe):null;return{measure:"standardizedMeanDifference",magnitude:Te,distance:Te===null?0:ft(Te),direction:Te===null?0:Math.sign(Te),subsetN:_e,populationN:ve.n||0,reliable:_e>=rt}}const{map:je,total:Ne}=dt(pe,Ae),xe=wt(je,Ne,ve.map,ve.total);return{measure:"categoricalTotalVariation",magnitude:xe,distance:xe===null?0:xe,direction:0,subsetN:Ne,populationN:ve.total||0,reliable:Ne>=rt}}function Ee(pe,Ae){if(pe&&(pe.kind==="float64"||pe.kind==="int32"))return!0;const ve=q(pe);let Pe=0,je=0;for(let Ne=0;Ne<Ae.length&&Pe<200;Ne++){const xe=ve(Ae[Ne]);if(xe==null||xe==="")continue;if(xe instanceof Date)return!1;Pe++;const ze=typeof xe=="number"?xe:Number(xe);Number.isFinite(ze)&&je++}return Pe===0?!1:je/Pe>=.9}function Be(pe,Ae){if(Ee(pe,Ae)){const je=c(pe,Ae),{n:Ne,mean:xe,m2:ze}=p(je);return{numeric:!0,mean:xe,sd:Ne>0?Math.sqrt(ze/Ne):0,n:Ne}}const{map:ve,total:Pe}=dt(pe,Ae);return{numeric:!1,map:ve,total:Pe}}}),Ue("packages/core/src/compute/total.js",function(e,H){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return f}}),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 $=H("packages/core/src/internal/predicates.js").isFunction,B=H("packages/core/src/internal/warn.js").warnOnce,x=H("packages/core/src/compute/handle.js"),Z=x.presenceReader,Y=x.valueComparator,U=x.valueReader,W=H("packages/core/src/compute/statistics.js"),K=W.STAT_FNS,E=W.STAT_LABELS;function O(m){return!!m&&(m.kind==="float64"||m.kind==="int32")}function b(m,v){const y=v.length;let T=0;if(O(m)){const M=m.values,_=Z(m);if(!_){for(let R=0;R<y;R++){const I=M[v[R]];Number.isNaN(I)||(T+=I)}return T}for(let R=0;R<y;R++){const I=v[R];if(_(I)===1){const j=M[I];Number.isNaN(j)||(T+=j)}}return T}const A=U(m);for(let M=0;M<y;M++){const _=c(A(v[M]));_!==null&&(T+=_)}return T}b.kernel=!0;function u(m,v){const y=v.length;let T=0;if(O(m)){const M=m.values,_=Z(m);if(!_){for(let R=0;R<y;R++)Number.isNaN(M[v[R]])||T++;return T}for(let R=0;R<y;R++){const I=v[R];_(I)===1&&!Number.isNaN(M[I])&&T++}return T}const A=U(m);for(let M=0;M<y;M++){const _=A(v[M]);_!=null&&!(typeof _=="number"&&Number.isNaN(_))&&T++}return T}u.kernel=!0;function h(m,v){return v.length}h.kernel=!0;function l(m,v){const y=u(m,v);return y===0?null:b(m,v)/y}l.kernel=!0;function r(m,v,y,T){const A=v.length;if(O(m)){const I=m.values,j=Z(m);let L=null;if(!j){for(let F=0;F<A;F++){const N=I[v[F]];Number.isNaN(N)||(L===null||(y<0?N<L:N>L))&&(L=N)}return L}for(let F=0;F<A;F++){const N=v[F];if(j(N)===0)continue;const S=I[N];Number.isNaN(S)||(L===null||(y<0?S<L:S>L))&&(L=S)}return L}const M=U(m),_=Y(T);let R=null;for(let I=0;I<A;I++){const j=M(v[I]);j==null||typeof j=="number"&&Number.isNaN(j)||(R===null||(y<0?_(j,R)<0:_(j,R)>0))&&(R=j)}return R}function n(m,v,y){return r(m,v,-1,y&&y.locale)}n.kernel=!0;function o(m,v,y){return r(m,v,1,y&&y.locale)}o.kernel=!0;function i(m,v){return v.length===0?null:U(m)(v[0])}i.kernel=!0;function t(m,v){return v.length===0?null:U(m)(v[v.length-1])}t.kernel=!0;function c(m){if(typeof m=="number")return Number.isNaN(m)?null:m;if(m==null||m===""||typeof m=="boolean")return null;if(m instanceof Date)return m.getTime();const v=Number(m);return Number.isNaN(v)?null:v}const s={sum:b,min:n,max:o,avg:l,count:h,first:i,last:t,countValues:u,...K},a=Object.freeze({...E,sum:"Sum",avg:"Average",min:"Min",max:"Max",count:"Count",countValues:"Count of values",first:"First",last:"Last"});function f(m){return m?typeof m=="string"?a[m]||m:"Total":""}const w=Object.freeze(["sum","avg","min","max","count","countValues","first","last"]);function g(m){const v=m&&m.dataType&&m.dataType.totals&&m.dataType.totals.supported;if(Array.isArray(v))return v.slice();const y=w.filter(T=>T in s);for(const T of Object.keys(s))y.includes(T)||y.push(T);return y}function k(m,v){return typeof v!="string"?!0:g(m).includes(v)}function d(m,v){const y=U(m),T=[];for(let A=0;A<v.length;A++){const M=y(v[A]);M!=null&&T.push(M)}return T}function p(m,v,y,T){const A=v||[];if(typeof y=="string"){const M=s[y];return M?M(m,A,T):(B(`total:${y}`,`unknown total function "${y}"; register it in config.totalFns`),null)}return $(y)?y.kernel===!0?y(m,A,T):y(d(m,A),T||{}):null}}),Ue("packages/core/src/compute/windowed.js",function(e,H){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const $=H("packages/core/src/compute/sketch.js").Welford;class q{#e;#t;#n=[];#r;#i;constructor(U,W=0,K=Date.now){if(U!=="count"&&U!=="time"&&U!=="session")throw new RangeError(`unknown window kind: ${U}`);if((U==="count"||U==="time")&&!(W>0))throw new RangeError(`a ${U} window needs a positive span`);this.#e=U,this.#t=Math.floor(W),this.#r=K,this.#i=K()}get size(){return this.#n.length}push(U,W=this.#r()){Number.isFinite(U)&&(this.#n.push({t:W,v:U}),this.#s(W))}#s(U){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const W=U-this.#t;for(;this.#n.length&&this.#n[0].t<W;)this.#n.shift()}}spec(){const U=this.#e==="session"?this.#r()-this.#i:this.#t;return{kind:this.#e,span:U,size:this.#n.length}}values(){return this.#n.map(U=>U.v)}aggregate(){const U=this.spec();if(!this.#n.length)return{over:U,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const W=new $;let K=0,E=1/0,O=-1/0;for(const{v:b}of this.#n)K+=b,b<E&&(E=b),b>O&&(O=b),W.add(b);return{over:U,count:this.#n.length,sum:K,mean:W.mean(),min:E,max:O,variance:W.variance(),stddev:W.stddev()}}reduce(U){const W=this.aggregate(),K={sum:W.sum,avg:W.mean,mean:W.mean,min:W.min,max:W.max,count:W.count,variance:W.variance,stddev:W.stddev};if(!(U in K))throw new RangeError(`unknown windowed aggregate: ${U}`);return{value:K[U],over:W.over}}}const B=Object.freeze(["count","time","session"]);function x(Y,U=Date.now){const W=Y.kind==="time"&&Y.minutes!=null?Y.minutes*6e4:Y.span??0;return new q(Y.kind,W,U)}const Z={Window:q,WINDOW_KINDS:B,openWindow:x}}),Ue("packages/core/src/compute/rolling.js",function(e,H){"use strict";Object.defineProperty(e,"ROLLING_WINDOW_FIELDS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"rollingWindow",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"rollingQuantile",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"seasonalDecompose",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"exponentialSmoothing",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});const $=H("packages/core/src/compute/windowed.js").openWindow,B=H("packages/core/src/compute/sketch.js").KLL,x=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function Z(s,a,f,w){if(s.kind==="count"){const g=Math.max(1,Math.floor(s.span||0));return{coverage:Math.min(1,a/g),partial:a<g}}if(s.kind==="time"){const g=s.minutes!=null?s.minutes*6e4:s.span||0;if(!(g>0))return{coverage:1,partial:!1};const k=f-w;return{coverage:Math.min(1,k/g),partial:k<g}}return{coverage:null,partial:!1}}function Y(s,a){const f=$(a),w=new Map,g=s.length?s[0].at:0;for(let k=0;k<s.length;k++){const{key:d,at:p,value:m}=s[k];Number.isFinite(m)&&f.push(m,p);const v=f.aggregate(),y=Z(a,v.count,p,g);d!=null&&w.set(String(d),{sum:v.sum,avg:v.mean,min:v.min,max:v.max,count:v.count,coverage:y.coverage,partial:y.partial})}return w}function U(s){const a=new Map;let f=0;for(const{key:w,value:g}of s)Number.isFinite(g)&&(f+=g),w!=null&&a.set(String(w),f);return a}function W(s,a=1){const f=new Map,w=Math.max(1,Math.floor(a));for(let g=0;g<s.length;g++){const{key:k,value:d}=s[g];if(k==null)continue;const p=g>=w?s[g-w].value:null,m=Number.isFinite(d)?d:null,v=Number.isFinite(p)?p:null;f.set(String(k),m!==null&&v!==null?m-v:null)}return f}const K=4096;function E(s){let a=s>>>0;return()=>{a+=1831565813;let f=a;return f=Math.imul(f^f>>>15,f|1),f^=f+Math.imul(f^f>>>7,f|61),((f^f>>>14)>>>0)/4294967296}}function O(s,a){const f=s.length;if(f===1)return s[0];const w=(f-1)*a,g=Math.floor(w),k=Math.ceil(w);return g===k?s[g]:s[g]+(w-g)*(s[k]-s[g])}function b(s,a,f={}){const w=Math.min(1,Math.max(0,f.q==null?.5:f.q)),g=Math.max(1,Math.floor(f.cap==null?K:f.cap)),k=E(f.seed==null?2654435769:f.seed),d=new Map,p=s.length?s[0].at:0;if(a.kind==="session"){const v=new B(200,k);let y=0;for(const{key:T,value:A}of s)Number.isFinite(A)&&(v.add(A),y++),T!=null&&d.set(String(T),{value:y?v.quantile(w):null,approx:y>0,count:y,coverage:null,partial:!1});return d}const m=$(a);for(const{key:v,at:y,value:T}of s){Number.isFinite(T)&&m.push(T,y);const A=m.values(),M=A.length;let _=null,R=!1;if(M)if(M<=g)_=O([...A].sort((j,L)=>j-L),w);else{const j=new B(200,k);for(const L of A)j.add(L);_=j.quantile(w),R=!0}const I=Z(a,M,y,p);v!=null&&d.set(String(v),{value:_,approx:R,count:M,coverage:I.coverage,partial:I.partial})}return d}function u(s,a){const f=s.length,w=new Array(f).fill(null),g=Math.floor(a/2),k=a%2===0;for(let d=0;d<f;d++){if(d-g<0||d+g>=f)continue;let p=0,m=!0;if(k)for(let v=-g;v<=g;v++){const y=s[d+v];if(!Number.isFinite(y)){m=!1;break}p+=v===-g||v===g?y*.5:y}else for(let v=-g;v<=g;v++){const y=s[d+v];if(!Number.isFinite(y)){m=!1;break}p+=y}m&&(w[d]=p/a)}return w}function h(s,a){const f=new Map,w=Math.floor(Number(a&&a.period));if(!(w>=2))return f;const g=a&&a.model==="multiplicative",k=s.length,d=s.map(R=>Number.isFinite(R.value)?R.value:null),p=u(d,w),m=new Array(k).fill(null);for(let R=0;R<k;R++){const I=p[R],j=d[R];I===null||j===null||(g?I!==0&&(m[R]=j/I):m[R]=j-I)}const v=new Array(w).fill(0),y=new Array(w).fill(0);for(let R=0;R<k;R++){if(m[R]===null)continue;const I=R%w;v[I]+=m[R],y[I]+=1}const T=g?1:0,A=v.map((R,I)=>y[I]?R/y[I]:T),M=A.reduce((R,I)=>R+I,0)/w,_=g?A.map(R=>M!==0?R/M:1):A.map(R=>R-M);for(let R=0;R<k;R++){const{key:I}=s[R];if(I==null)continue;const j=p[R],L=_[R%w],F=d[R];let N=null;j!==null&&F!==null&&(N=g?j*L!==0?F/(j*L):null:F-j-L),f.set(String(I),{trend:j,seasonal:F===null?null:L,residual:N,coverage:j===null?0:1,partial:j===null})}return f}function l(s,a,f,w=80){const g=(Math.sqrt(5)-1)/2;let k=a,d=f,p=d-g*(d-k),m=k+g*(d-k),v=s(p),y=s(m);for(let T=0;T<w;T++)v<y?(d=m,m=p,y=v,p=d-g*(d-k),v=s(p)):(k=p,p=m,v=y,m=k+g*(d-k),y=s(m));return(k+d)/2}const r=1e-4,n=1-1e-4;function o(s,a){const f=s.length,w=new Array(f).fill(null),g=new Array(f).fill(null);let k=null,d=0;for(let p=0;p<f;p++){const m=s[p];if(!Number.isFinite(m)){k!==null&&(g[p]=k,w[p]=k);continue}if(k===null){k=m,g[p]=m,w[p]=m;continue}g[p]=k,d+=(m-k)**2,k=a*m+(1-a)*k,w[p]=k}return{smoothed:w,fitted:g,sse:d}}function i(s,a,f){const w=s.length,g=new Array(w).fill(null),k=new Array(w).fill(null);let d=null,p=null,m=0;for(let v=0;v<w;v++){const y=s[v];if(!Number.isFinite(y)){d!==null&&(d+=p,g[v]=d);continue}if(d===null){d=y,g[v]=y;continue}if(p===null){p=y-d;const M=d+p;k[v]=M,m+=(y-M)**2;const _=d;d=a*y+(1-a)*(_+p),p=f*(d-_)+(1-f)*p,g[v]=d;continue}const T=d+p;k[v]=T,m+=(y-T)**2;const A=d;d=a*y+(1-a)*(A+p),p=f*(d-A)+(1-f)*p,g[v]=d}return{smoothed:g,fitted:k,sse:m}}function t(s,a={}){const f=new Map,w=a.method==="holt",g=s.map(T=>Number.isFinite(T.value)?T.value:null),k=g.filter(T=>T!==null).length,d=T=>Math.min(n,Math.max(r,T)),p=()=>{for(const{key:T}of s)T!=null&&f.set(String(T),{smoothed:null,fitted:null,alpha:null,beta:null,sse:null});return f};if(k<(w?2:1))return p();let m=Number.isFinite(a.alpha)?d(a.alpha):null,v=w&&Number.isFinite(a.beta)?d(a.beta):null;if(w){if(m===null||v===null){let T=m===null?.5:m,A=v===null?.5:v;for(let M=0;M<6;M++)m===null&&(T=l(_=>i(g,_,A).sse,r,n)),v===null&&(A=l(_=>i(g,T,_).sse,r,n));m=m===null?T:m,v=v===null?A:v}}else m===null&&(m=l(T=>o(g,T).sse,r,n));const y=w?i(g,m,v):o(g,m);for(let T=0;T<s.length;T++){const{key:A}=s[T];A!=null&&f.set(String(A),{smoothed:y.smoothed[T],fitted:y.fitted[T],alpha:m,beta:w?v:null,sse:y.sse})}return f}const c={ROLLING_WINDOW_FIELDS:x,QUANTILE_SPAN_CAP:K,rollingWindow:Y,rollingQuantile:b,cumulativeToDate:U,periodOverPeriod:W,seasonalDecompose:h,exponentialSmoothing:t}}),Ue("packages/core/src/compute/compare.js",function(e,H){"use strict";Object.defineProperty(e,"COMPARE_MEASURES",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"pooledStandardMeanDifference",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"numericSummary",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"bothNumeric",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"compareColumnAcross",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"compareDatasets",{enumerable:!0,get:function(){return u}});const ne=H("packages/core/src/compute/statistics.js"),$=ne.numbers,q=ne.moments,B=ne.frequencyMap,x=ne.categoricalDistance,Z=ne.normalTotalVariation,Y=ne.isNumericColumn,U=ne.SUBSET_RELIABILITY_FLOOR,W=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function K(h,l){if(!h||!l||!(h.n>0)||!(l.n>0)||!Number.isFinite(h.mean)||!Number.isFinite(l.mean))return null;const r=(h.n*h.sd*h.sd+l.n*l.sd*l.sd)/(h.n+l.n);return r>0?(h.mean-l.mean)/Math.sqrt(r):null}function E(h,l){const r=$(h,l),{n,mean:o,m2:i}=q(r),t=n>0?Math.sqrt(i/n):0;return{mean:o,sd:t,n}}function O(h,l,r,n){return Y(h,l)&&Y(r,n)}function b(h,l,r,n){if(O(h,l,r,n)){const c=E(h,l),s=E(r,n),a=K(c,s);return{measure:W.numeric,magnitude:a,distance:a===null?0:Z(a),direction:a===null?0:Math.sign(a),nA:c.n,nB:s.n,reliable:c.n>=U&&s.n>=U}}const o=B(h,l),i=B(r,n),t=x(o.map,o.total,i.map,i.total);return{measure:W.categorical,magnitude:t,distance:t===null?0:t,direction:0,nA:o.total,nB:i.total,reliable:o.total>=U&&i.total>=U}}function u(h,l,r={}){const n=new Set(h.columns),o=new Set(l.columns),i=h.columns.filter(f=>o.has(f)),t=Array.isArray(r.columns)&&r.columns.length?i.filter(f=>r.columns.includes(f)):i,c=h.indices(),s=l.indices(),a=[];for(const f of t){const w=h.handle(f),g=l.handle(f);if(!w||!g)continue;const k=b(w,c,g,s);a.push({column:f,name:h.name&&h.name(f)||l.name&&l.name(f)||f,measure:k.measure,magnitude:k.magnitude,distance:k.distance,direction:k.direction,nA:k.nA,nB:k.nB,reliable:k.reliable})}return a.sort((f,w)=>w.distance-f.distance||Math.abs(w.magnitude||0)-Math.abs(f.magnitude||0)),{ranked:a,nA:c.length,nB:s.length,unmatched:{onlyA:h.columns.filter(f=>!o.has(f)),onlyB:l.columns.filter(f=>!n.has(f))},measures:W}}}),Ue("packages/core/src/compute/anomaly.js",function(e,H){"use strict";Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DEFAULT_MODIFIED_Z_THRESHOLD",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return c}});const $=H("packages/core/src/compute/statistics.js").quantileSorted,B=H("packages/core/src/compute/special.js").logGamma,x=.6745,Z=3.5,Y=1.5,U=.975,W=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function K(s){if(!s.length)return null;const f=Array.from(s,Number).sort((d,p)=>d-p),w=$(f,.5),g=f.map(d=>Math.abs(d-w)).sort((d,p)=>d-p),k=$(g,.5);return{median:w,mad:k}}function E(s,a={}){const f=Number.isFinite(a.threshold)?a.threshold:Z,w=s.length,g=new Array(w).fill(null),k=new Array(w).fill(!1),d=[];for(let v=0;v<w;v++){const y=Number(s[v]);Number.isFinite(y)&&d.push(y)}if(!d.length)return{median:null,mad:null,threshold:f,scores:g,flags:k,flagged:0};const p=K(d);if(p.mad===0)return{median:p.median,mad:0,threshold:f,scores:g,flags:k,flagged:0};let m=0;for(let v=0;v<w;v++){const y=Number(s[v]);if(!Number.isFinite(y))continue;const T=x*(y-p.median)/p.mad;g[v]=T,Math.abs(T)>f&&(k[v]=!0,m++)}return{median:p.median,mad:p.mad,threshold:f,scores:g,flags:k,flagged:m}}function O(s,a={}){const f=Number.isFinite(a.k)?a.k:Y,w=[];for(let m=0;m<s.length;m++){const v=Number(s[m]);Number.isFinite(v)&&w.push(v)}if(!w.length)return null;const g=w.sort((m,v)=>m-v),k=$(g,.25),d=$(g,.75),p=d-k;return{q1:k,q3:d,iqr:p,lower:k-f*p,upper:d+f*p,k:f}}function b(s,a){if(a<=0)return 0;const f=B(s);if(a<s+1){let v=s,y=1/s,T=y;for(let A=0;A<1e3&&(v+=1,T*=a/v,y+=T,!(Math.abs(T)<Math.abs(y)*1e-15));A++);return y*Math.exp(-a+s*Math.log(a)-f)}const w=1e-300;let g=a+1-s,k=1/w,d=1/g,p=d;for(let v=1;v<1e3;v++){const y=-v*(v-s);g+=2,d=y*d+g,Math.abs(d)<w&&(d=w),k=g+y/k,Math.abs(k)<w&&(k=w),d=1/d;const T=d*k;if(p*=T,Math.abs(T-1)<1e-15)break}return 1-Math.exp(-a+s*Math.log(a)-f)*p}function u(s,a){return s<=0?0:b(a/2,s/2)}function h(s,a=U){if(!(a>0)||!(a<1))return NaN;let f=0,w=Math.max(1,s);for(;u(w,s)<a;)w*=2;for(let g=0;g<200;g++){const k=(f+w)/2;if(u(k,s)<a?f=k:w=k,w-f<1e-10)break}return(f+w)/2}function l(s){const a=s.length,f=s.map((w,g)=>{const k=w.slice();for(let d=0;d<a;d++)k.push(g===d?1:0);return k});for(let w=0;w<a;w++){let g=w;for(let d=w+1;d<a;d++)Math.abs(f[d][w])>Math.abs(f[g][w])&&(g=d);if(Math.abs(f[g][w])<1e-12)return null;if(g!==w){const d=f[g];f[g]=f[w],f[w]=d}const k=f[w][w];for(let d=0;d<2*a;d++)f[w][d]/=k;for(let d=0;d<a;d++){if(d===w)continue;const p=f[d][w];if(p!==0)for(let m=0;m<2*a;m++)f[d][m]-=p*f[w][m]}}return f.map(w=>w.slice(a))}function r(s,a){const f=s.length,w=new Array(a).fill(0);for(const d of s)for(let p=0;p<a;p++)w[p]+=d[p];for(let d=0;d<a;d++)w[d]/=f;const g=Array.from({length:a},()=>new Array(a).fill(0));for(const d of s)for(let p=0;p<a;p++){const m=d[p]-w[p];for(let v=p;v<a;v++)g[p][v]+=m*(d[v]-w[v])}const k=f>1?f-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:w,cov:g}}function n(s,a={}){const f=Number.isFinite(a.p)?a.p:U,w=Number.isFinite(a.ridge)?a.ridge:1e-6,g=s.length;if(!g)return null;const k=s[0].length;if(!k)return null;const d=new Array(g).fill(null),p=new Array(g).fill(null),m=new Array(g).fill(!1),v=[],y=[];for(let L=0;L<g;L++){const F=s[L];let N=F.length===k;const S=new Array(k);for(let C=0;N&&C<k;C++){const D=Number(F[C]);Number.isFinite(D)?S[C]=D:N=!1}N&&(v.push(L),y.push(S))}const T=k,A=h(T,f);if(y.length<=k)return{center:[],df:T,cutoff:A,singular:!0,used:y.length,distances:d,squared:p,flags:m,flagged:0};const{mean:M,cov:_}=r(y,k);let R=l(_),I=!1;if(!R){I=!0;let L=0;for(let S=0;S<k;S++)L+=_[S][S];const F=L/k*w||w,N=_.map((S,C)=>S.map((D,G)=>C===G?D+F:D));if(R=l(N),!R)return{center:M,df:T,cutoff:A,singular:!0,used:y.length,distances:d,squared:p,flags:m,flagged:0}}let j=0;for(let L=0;L<y.length;L++){const F=y[L],N=new Array(k);for(let D=0;D<k;D++)N[D]=F[D]-M[D];let S=0;for(let D=0;D<k;D++){let G=0;for(let X=0;X<k;X++)G+=R[D][X]*N[X];S+=N[D]*G}S<0&&(S=0);const C=v[L];p[C]=S,d[C]=Math.sqrt(S),S>A&&(m[C]=!0,j++)}return{center:M,df:T,cutoff:A,singular:I,used:y.length,distances:d,squared:p,flags:m,flagged:j}}const o=20,i=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function t(s,a={}){const f=a.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",w=Number.isFinite(a.windowLen)&&a.windowLen>=1?Math.floor(a.windowLen):o,g=Number.isFinite(a.threshold)?a.threshold:Z,k=Number.isFinite(a.k)?a.k:Y,d=Number.isFinite(a.minPeriods)&&a.minPeriods>=1?Math.floor(a.minPeriods):w,p=s.length,m=new Array(p).fill(null),v=new Array(p).fill(!1);let y=0;for(let T=0;T<p;T++){const A=Number(s[T]);if(!Number.isFinite(A))continue;const M=Math.max(0,T-w+1),_=[];for(let R=M;R<=T;R++){const I=Number(s[R]);Number.isFinite(I)&&_.push(I)}if(!(_.length<d))if(f==="rollingIqr"){const R=O(_,{k});if(!R)continue;(A<R.lower||A>R.upper)&&(v[T]=!0,y++)}else{const R=K(_);if(!R||R.mad===0)continue;const I=x*(A-R.median)/R.mad;m[T]=I,Math.abs(I)>g&&(v[T]=!0,y++)}}return{method:f,windowLen:w,minPeriods:d,threshold:g,k,scores:m,flags:v,flagged:y}}function c(s={}){const a=s||{},f=a.field;if(typeof f!="string"||!f)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const w=a.method||"modifiedZScore";if(!(W.includes(w)||i.includes(w))||w==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${w}'`);const k=typeof a.orderBy=="string"?a.orderBy:null,d=a.latest===!0,p=i.includes(w),m=v=>Number(v==null?NaN:v[f]);return v=>{const y=Array.isArray(v)?v.slice():[...v];k&&y.sort((R,I)=>{const j=R?.[k],L=I?.[k];return j===L?0:j==null?-1:L==null?1:j<L?-1:1});const T=y.map(m);let A,M;if(p)({flags:A,scores:M}=t(T,{method:w,windowLen:a.windowLen,threshold:a.threshold,k:a.k,minPeriods:a.minPeriods}));else if(w==="iqr"){const R=O(T,{k:a.k});A=T.map(I=>R?Number.isFinite(I)&&(I<R.lower||I>R.upper):!1),M=T.map(()=>null)}else({flags:A,scores:M}=E(T,{threshold:a.threshold}));if(d){const R=A.length-1;return R<0||!A[R]?!1:{method:w,field:f,flagged:[{row:y[R],score:M[R]}]}}const _=[];for(let R=0;R<A.length;R++)A[R]&&_.push({row:y[R],score:M[R]});return _.length?{method:w,field:f,flagged:_}:!1}}}),Ue("packages/core/src/compute/forecast.js",function(e,H){"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 s}});const ne=H("packages/core/src/compute/special.js"),$=ne.normalQuantile,q=ne.studentTQuantile,x=H("packages/core/src/internal/warn.js").warnOnce,Z=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),Y=1e-4,U=1-1e-4;function W(a){const f=[];for(let w=0;w<a.length;w++){const g=a[w];if(g!==null&&typeof g=="object"){const k=Number.isFinite(g.at)?g.at:w,d=Number.isFinite(g.value)?g.value:null;f.push({at:k,value:d})}else f.push({at:w,value:Number.isFinite(g)?Number(g):null})}return f}function K(a){const f=a.filter(p=>p.value!==null),w=f[0],g=f[f.length-1],k=g.at-w.at,d=f.length>1&&k>0?k/(f.length-1):1;return{lastAt:g.at,step:d}}function E(a){return Math.min(U,Math.max(Y,a))}function O(a,f=Y,w=U,g=80){const k=(Math.sqrt(5)-1)/2;let d=f,p=w,m=p-k*(p-d),v=d+k*(p-d),y=a(m),T=a(v);for(let A=0;A<g;A++)y<T?(p=v,v=m,T=y,m=p-k*(p-d),y=a(m)):(d=m,m=v,y=T,v=d+k*(p-d),T=a(v));return(d+p)/2}function b(a,f){let w=null,g=0,k=0;for(let d=0;d<a.length;d++){const p=a[d];if(p!==null){if(w===null){w=p;continue}g+=(p-w)**2,k+=1,w=f*p+(1-f)*w}}return{level:w,sse:g,m:k}}function u(a,f,w){let g=null,k=null,d=0,p=0;for(let m=0;m<a.length;m++){const v=a[m];if(v===null){g!==null&&k!==null&&(g+=k);continue}if(g===null){g=v;continue}k===null&&(k=v-g);const y=g+k;d+=(v-y)**2,p+=1;const T=g;g=f*v+(1-f)*(T+k),k=w*(g-T)+(1-w)*k}return{level:g,trend:k,sse:d,m:p}}function h(a,f,w,g,k){const d=a.length;if(d<2*f)return null;const p=I=>{let j=0,L=0;for(let F=I;F<I+f&&F<d;F++)a[F]!==null&&(j+=a[F],L+=1);return L?j/L:null},m=p(0),v=p(f);if(m===null||v===null)return null;let y=m,T=(v-m)/f;const A=new Array(f).fill(0);for(let I=0;I<f;I++)A[I]=a[I]===null?0:a[I]-y;const M=A.reduce((I,j)=>I+j,0)/f;for(let I=0;I<f;I++)A[I]-=M;let _=0,R=0;for(let I=f;I<d;I++){const j=I%f,L=A[j],F=a[I];if(F===null){y+=T;continue}const N=y+T+L;_+=(F-N)**2,R+=1;const S=y;y=w*(F-L)+(1-w)*(y+T),T=g*(y-S)+(1-g)*T,A[j]=k*(F-y)+(1-k)*L}return{level:y,trend:T,season:A,phase:(d-1)%f,sse:_,count:R}}function l(a,f,w){let g=1;for(const d of f)g+=d*d;const k=Math.sqrt(a*g);return{se:k,margin:w*k}}function r(a,f={}){if(!a||typeof a.length!="number"||a.length===0)return null;const w=Z.includes(f.method)?f.method:"linear",g=Math.max(1,Math.floor(Number(f.horizon)||1)),k=Number.isFinite(f.confidence)&&f.confidence>0&&f.confidence<1?f.confidence:.95,d=1-(1-k)/2,p=W(a),m=p.map(_=>_.value),v=m.filter(_=>_!==null),y=v.length,{lastAt:T,step:A}=y?K(p):{lastAt:0,step:1},M=_=>T+_*A;return w==="linear"?n(p,y,g,k,d,M):w==="movingAverage"?o(v,y,g,k,d,f,M):w==="ses"?i(m,y,g,k,d,f,M):w==="holt"?t(m,y,g,k,d,f,M):c(m,y,g,k,d,f,M)}function n(a,f,w,g,k,d){if(f<2)return null;let p=0,m=0;for(const F of a)F.value!==null&&(p+=F.at,m+=F.value);p/=f,m/=f;let v=0,y=0,T=0;for(const F of a){if(F.value===null)continue;const N=F.at-p,S=F.value-m;v+=N*N,y+=N*S,T+=S*S}if(v===0)return null;const A=y/v,M=m-A*p,_=T===0?1:Math.max(0,Math.min(1,y*y/(v*T))),R=Math.max(0,T-A*y),I=f>2?Math.sqrt(R/(f-2)):null,j=f>2?q(k,f-2):null,L=[];for(let F=1;F<=w;F++){const N=d(F),S=M+A*N;let C=null,D=null,G=null,X=null,V=null;if(I!==null){const J=1/f+(N-p)**2/v,ee=I*Math.sqrt(1+J),te=I*Math.sqrt(J);V=ee,C=S-j*ee,D=S+j*ee,G=S-j*te,X=S+j*te}L.push({step:F,at:N,mean:S,lower:C,upper:D,lowerMean:G,upperMean:X,se:V})}return{method:"linear",horizon:w,confidence:g,n:f,sigma:I,r2:_,params:{slope:A,intercept:M},points:L}}function o(a,f,w,g,k,d,p){if(f<1)return null;const m=Math.max(1,Math.min(f,Math.floor(Number(d.windowLen)||f))),v=a.slice(f-m);let y=0;for(const I of v)y+=I;const T=y/m;let A=null,M=null;if(m>1){let I=0;for(const L of v)I+=(L-T)**2;A=Math.sqrt(I/(m-1))*Math.sqrt(1+1/m),M=q(k,m-1)}const _=A===null?null:M*A,R=[];for(let I=1;I<=w;I++)R.push({step:I,at:p(I),mean:T,lower:_===null?null:T-_,upper:_===null?null:T+_,se:A});return{method:"movingAverage",horizon:w,confidence:g,n:f,sigma:A===null?null:A,params:{windowLen:m},points:R}}function i(a,f,w,g,k,d,p){if(f<1)return null;let m=Number.isFinite(d.alpha)?E(d.alpha):null;m===null&&(m=O(M=>b(a,M).sse));const v=b(a,m),y=$(k),T=v.m>0?v.sse/v.m:null,A=[];for(let M=1;M<=w;M++){const _=v.level;let R=null,I=null,j=null;if(T!==null){const L=[];for(let N=1;N<M;N++)L.push(m);const F=l(T,L,y);j=F.se,R=_-F.margin,I=_+F.margin}A.push({step:M,at:p(M),mean:_,lower:R,upper:I,se:j})}return{method:"ses",horizon:w,confidence:g,n:f,sigma:T===null?null:Math.sqrt(T),params:{alpha:m},points:A}}function t(a,f,w,g,k,d,p){if(f<2)return null;let m=Number.isFinite(d.alpha)?E(d.alpha):null,v=Number.isFinite(d.beta)?E(d.beta):null;if(m===null||v===null){let R=m===null?.5:m,I=v===null?.5:v;for(let j=0;j<6;j++)m===null&&(R=O(L=>u(a,L,I).sse)),v===null&&(I=O(L=>u(a,R,L).sse));m=m===null?R:m,v=v===null?I:v}const y=u(a,m,v),T=$(k),A=y.m>0?y.sse/y.m:null,M=m*v,_=[];for(let R=1;R<=w;R++){const I=y.level+R*y.trend;let j=null,L=null,F=null;if(A!==null){const N=[];for(let C=1;C<R;C++)N.push(m+C*M);const S=l(A,N,T);F=S.se,j=I-S.margin,L=I+S.margin}_.push({step:R,at:p(R),mean:I,lower:j,upper:L,se:F})}return{method:"holt",horizon:w,confidence:g,n:f,sigma:A===null?null:Math.sqrt(A),params:{alpha:m,beta:v},points:_}}function c(a,f,w,g,k,d,p){const m=Math.floor(Number(d.period));if(!(m>=2))return x("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(f<2*m)return null;let v=Number.isFinite(d.alpha)?E(d.alpha):null,y=Number.isFinite(d.beta)?E(d.beta):null,T=Number.isFinite(d.gamma)?E(d.gamma):null;const A=(F,N,S)=>{const C=h(a,m,F,N,S);return C?C.sse:1/0};if(v===null||y===null||T===null){let F=v===null?.5:v,N=y===null?.5:y,S=T===null?.5:T;for(let C=0;C<8;C++)v===null&&(F=O(D=>A(D,N,S))),y===null&&(N=O(D=>A(F,D,S))),T===null&&(S=O(D=>A(F,N,D)));v=v===null?F:v,y=y===null?N:y,T=T===null?S:T}const M=h(a,m,v,y,T);if(!M)return null;const _=$(k),R=M.count>0?M.sse/M.count:null,I=v*y,j=T*(1-v),L=[];for(let F=1;F<=w;F++){const N=M.season[(M.phase+F)%m],S=M.level+F*M.trend+N;let C=null,D=null,G=null;if(R!==null){const X=[];for(let J=1;J<F;J++)X.push(v+J*I+(J%m===0?j:0));const V=l(R,X,_);G=V.se,C=S-V.margin,D=S+V.margin}L.push({step:F,at:p(F),mean:S,lower:C,upper:D,se:G})}return{method:"holtWinters",horizon:w,confidence:g,n:f,sigma:R===null?null:Math.sqrt(R),params:{alpha:v,beta:y,gamma:T,period:m},points:L}}const s={FORECAST_METHODS:Z,forecast:r}}),Ue("packages/core/src/compute/hypothesis.js",function(e,H){"use strict";Object.defineProperty(e,"GROUP_TESTS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NORMALITY_ALPHA",{enumerable:!0,get:function(){return s}}),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 v}}),Object.defineProperty(e,"chiSquareTest",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return _}});const $=H("packages/core/src/internal/warn.js").warnOnce,B=H("packages/core/src/compute/handle.js").valueReader,x=H("packages/core/src/compute/statistics.js"),Z=x.numbers,Y=x.moments,U=x.frequencyMap,W=x.categoricalDistance,K=x.isNumericColumn,E=x.jarqueBera,O=x.proportionInterval,b=x.SUBSET_RELIABILITY_FLOOR,h=H("packages/core/src/compute/compare.js").pooledStandardMeanDifference,l=H("packages/core/src/compute/special.js"),r=l.studentT,n=l.studentTQuantile,o=l.normalCdf,i=l.normalQuantile,t=l.chiSquareUpperTail,c=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),s=.05,a=2e6;function f(R){const I=Number(R);return Number.isFinite(I)&&I>0&&I<1?I:.95}function w(R){const{n:I,mean:j,m2:L}=Y(R);return{mean:j,sd:I>0?Math.sqrt(L/I):0,n:I}}function g(R,I){const j=R.length;if(j<2)return 0;let L=0;for(let F=0;F<j;F++){const N=R[F]-I;L+=N*N}return L/(j-1)}function k(R,I){return{name:"pooledStandardMeanDifference",value:h(w(R),w(I))}}function d(R,I,j){const L=R.length,F=I.length;if(L<2||F<2)return null;const N=f(j),{mean:S}=Y(R),{mean:C}=Y(I),D=g(R,S),G=g(I,C),X=D/L+G/F;if(!(X>0))return null;const V=Math.sqrt(X),J=(S-C)/V,ee=D/L*(D/L)/(L-1),te=G/F*(G/F)/(F-1),ie=X*X/(ee+te),oe=Math.min(1,Math.max(0,2*(1-r(Math.abs(J),ie)))),ue=S-C,ye=n(1-(1-N)/2,ie)*V;return{test:c.WELCH,statistic:J,statisticName:"t",df:ie,pValue:oe,interval:{estimate:ue,lower:ue-ye,upper:ue+ye,confidence:N,method:"welch-t (difference of means)"},effectSize:k(R,I),nA:L,nB:F,reliable:L>=b&&F>=b,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function p(R){const I=R.length;if(I===0)return Number.NaN;const j=I>>1;return I%2?R[j]:(R[j-1]+R[j])/2}function m(R,I,j){const L=R.length,F=I.length,N=L*F;if(N===0||N>a)return null;const S=new Float64Array(N);let C=0;for(let ee=0;ee<L;ee++)for(let te=0;te<F;te++)S[C++]=R[ee]-I[te];S.sort();const D=p(S),G=Math.sqrt(L*F*(L+F+1)/12),X=i(1-(1-j)/2);let V=Math.round(N/2-X*G);V>=0||(V=0);const J=Math.floor((N-1)/2);return V>J&&(V=J),{estimate:D,lower:S[V],upper:S[N-1-V],confidence:j,method:"hodges-lehmann (normal approximation)"}}function v(R,I,j){const L=R.length,F=I.length;if(L<1||F<1)return null;const N=f(j),S=L+F,C=new Array(S);for(let oe=0;oe<L;oe++)C[oe]={v:R[oe],g:0};for(let oe=0;oe<F;oe++)C[L+oe]={v:I[oe],g:1};C.sort((oe,ue)=>oe.v-ue.v);let D=0,G=0,X=0;for(;X<S;){let oe=X;for(;oe<S&&C[oe].v===C[X].v;)oe++;const ue=oe-X,ye=(X+1+oe)/2;for(let he=X;he<oe;he++)C[he].g===0&&(D+=ye);G+=ue*ue*ue-ue,X=oe}const V=D-L*(L+1)/2,J=L*F/2,ee=L*F/12*(S+1-G/(S*(S-1)));let te=1;if(ee>0){const oe=Math.max(0,Math.abs(V-J)-.5);te=Math.min(1,2*o(-oe/Math.sqrt(ee)))}const ie=m(R,I,N);return{test:c.MANN_WHITNEY,statistic:V,statisticName:"U",df:null,pValue:te,interval:ie,effectSize:k(R,I),nA:L,nB:F,reliable:L>=b&&F>=b,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function y(R,I,j,L,F){const N=O(R,I,F),S=O(j,L,F);if(!N||!S)return null;const C=N.proportion-S.proportion,D=C-Math.sqrt((N.proportion-N.lower)**2+(S.upper-S.proportion)**2),G=C+Math.sqrt((N.upper-N.proportion)**2+(S.proportion-S.lower)**2);return{lower:D,upper:G}}function T(R,I,j,L,F,N={}){if(!(I>0)||!(L>0))return null;const S=new Set([...R.keys(),...j.keys()]),C=S.size;if(C<2)return null;const D=I+L;let G=0;for(const te of S){const ie=R.get(te)||0,oe=j.get(te)||0,ue=ie+oe,ye=I*ue/D,he=L*ue/D;ye>0&&(G+=(ie-ye)*(ie-ye)/ye),he>0&&(G+=(oe-he)*(oe-he)/he)}const X=C-1,V=t(G,X);let J=null;N.category!==void 0&&S.has(N.category)?J=N.category:C===2&&([J]=[...S]);let ee=null;if(J!==null){const te=y(R.get(J)||0,I,j.get(J)||0,L,f(F));te&&(ee={estimate:(R.get(J)||0)/I-(j.get(J)||0)/L,lower:te.lower,upper:te.upper,confidence:f(F),method:"newcombe (difference in this category's share)",category:J})}return{test:c.CHI_SQUARE,statistic:G,statisticName:"chiSquare",df:X,pValue:V,interval:ee,effectSize:{name:"categoricalTotalVariation",value:W(R,I,j,L)},nA:I,nB:L,reliable:I>=b&&L>=b,method:"Pearson chi-square test of independence (2×k, no continuity correction)"}}function A(R){return R==null||R===""||typeof R=="number"&&Number.isNaN(R)?null:R instanceof Date?R.getTime():typeof R=="object"?String(R):R}function M(R,I,j){if(j===c.WELCH||j===c.MANN_WHITNEY)return{test:j,chosenBy:"override",reason:`caller override: ${j}`};const L=E(R),F=E(I),N=L===null?null:Math.exp(-L/2),S=F===null?null:Math.exp(-F/2);return N!==null&&N<s||S!==null&&S<s?{test:c.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${s})`}:{test:c.WELCH,chosenBy:"auto",reason:N!==null||S!==null?"column family: numeric, no departure from normality detected":"column family: numeric (too few rows to screen normality)"}}function _(R,I,j,L={}){if(!R||!I)return null;const F=f(L.confidence),N=B(I);let S;if(Array.isArray(L.groups)&&L.groups.length===2)S=[A(L.groups[0]),A(L.groups[1])];else{const{map:oe}=U(I,j),ue=[...oe.entries()].sort((ye,he)=>he[1]-ye[1]).slice(0,2).map(ye=>ye[0]);if(ue.length<2)return $("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;S=ue}const[C,D]=S;if(C===null||D===null||C===D)return $("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const G=[],X=[];for(let oe=0;oe<j.length;oe++){const ue=A(N(j[oe]));ue===C?G.push(j[oe]):ue===D&&X.push(j[oe])}if(G.length===0||X.length===0)return $("compareGroups:empty","[lattice] compareGroups: one of the two groups has no rows in the current set."),null;const V=L.test&&L.test!=="auto"?String(L.test):null,J=K(R,G.concat(X));let ee,te,ie;if(V===c.CHI_SQUARE||!V&&!J){te=V?"override":"auto",ie=V?"caller override: chiSquare":"column family: categorical";const oe=U(R,G),ue=U(R,X);ee=T(oe.map,oe.total,ue.map,ue.total,F,{category:L.category})}else{if((V===c.WELCH||V===c.MANN_WHITNEY)&&!J)return $("compareGroups:numeric-override",`[lattice] compareGroups: ${V} needs a numeric column, but the column is not numeric.`),null;const oe=Z(R,G),ue=Z(R,X),ye=M(oe,ue,V);te=ye.chosenBy,ie=ye.reason,ee=ye.test===c.MANN_WHITNEY?v(oe,ue,F):d(oe,ue,F)}return ee?{...ee,chosenBy:te,reason:ie,groups:[C,D]}:($("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,H){"use strict";Object.defineProperty(e,"DETAIL_COLUMN_ID",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"createDetailColumn",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return B}});const ne="__lattice_detail",$=36;function q(x){const Z=x.config&&x.config.detailColumnWidth||$;return{id:ne,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:x.config&&x.config.detailColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(Y,U){return!!(U&&U.expanded)},formatValue(){return""}}}const B=q}),Ue("packages/core/src/columns/treecolumn.js",function(e,H){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createTreeColumn",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const $=H("packages/core/src/internal/predicates.js").isFunction,q="__lattice_tree",B=260;function x(Y){const U=Y.tree||{},W=Y.config&&Y.config.treeColumnWidth||B,K=()=>(Y.columns&&$(Y.columns.visible)?Y.columns.visible():[]).find(u=>!u.generated)||null,E=(b,u)=>{if(u&&u.group)return u.groupValue;if($(U.label))return U.label(b,u);if(typeof U.label=="string")return b==null?null:b[U.label];const h=K();return h&&$(h.getValue)?h.getValue(b,u):null},O=()=>{if(U.title)return U.title;const b=typeof U.label=="string"?Y.columns&&$(Y.columns.get)?Y.columns.get(U.label):null:K();return b&&(b.title||b.id)||"Hierarchy"};return{id:q,get title(){return O()},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:W,min:140,pin:Y.config&&Y.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(b,u){return E(b,u)},formatValue(b,u){if(u&&u.grandTotal)return Y.config&&Y.config.grandTotalLabel||"Total";if(b==null)return"";if(!U.label){const h=K();if(h&&$(h.formatValue))return h.formatValue(b,u)}return String(b)}}}const Z=x}),Ue("packages/core/src/columns/pivotcolumns.js",function(e,H){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return x}});const $=H("packages/core/src/internal/warn.js").warnOnce,q="__lattice_pivot",B=500;function x(W){const{pivot:K,valueColumns:E,config:O}=W,b=K&&K.paths||[],u=W.separator||O&&O.pivot&&O.pivot.separator||" | ",h=O&&O.pivot&&O.pivot.maxColumns||B;if(!b.length||!E.length)return{tree:[],leaves:[],error:null};const l=Z(O),r=b.length*E.length+(l?E.length:0);if(r>h){const i=`pivot would generate ${r} columns, above the limit of ${h}. Pivot on a lower-cardinality column, or raise pivot.maxColumns.`;return $(`pivot.maxColumns:${r}`,i),{tree:[],leaves:[],error:i}}const n=[],o=[];for(const i of b){const t=[];for(const c of E){const s=U(i,c,u);t.push(s),o.push(s)}t.length===1?(t[0].title=String(i),n.push(t[0])):n.push({id:`${q}:group:${i}`,title:String(i),columns:t,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(l){const i=E.map(c=>Y(c,O));o.push(...i);const t=O&&O.pivot&&O.pivot.totalsLabel||"Total";if(i.length===1)i[0].title=t,l==="before"?n.unshift(i[0]):n.push(i[0]);else{const c={id:`${q}:group:__totals`,title:t,columns:i,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};l==="before"?n.unshift(c):n.push(c)}}return{tree:n,leaves:o,error:null}}function Z(W){const K=W&&W.pivot&&W.pivot.groupTotals;return K==="before"||K==="after"?K:null}function Y(W,K){return{id:`${q}:__total${K&&K.pivot&&K.pivot.separator||" | "}${W.id}`,field:null,title:W.title||W.id,type:W.type,dataType:W.dataType,nullable:!0,align:W.align,generated:!0,pivot:{enabled:!1,index:0,sourceId:W.id,total:!0},value:{pure:!0},cell:{align:W.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:W.total,lookup:null,layout:{width:W.layout&&W.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(E,O){const b=O&&O.totals;return b&&Object.hasOwn(b,W.id)?b[W.id]:null},formatValue(E,O){return E==null?"":W.formatValue?W.formatValue(E,O):String(E)}}}function U(W,K,E){return{id:`${q}:${W}${E}${K.id}`,field:null,title:K.title||K.id,type:K.type,dataType:K.dataType,nullable:!0,align:K.align,generated:!0,pivot:{enabled:!1,index:0,path:W,sourceId:K.id},value:{pure:!0},cell:{align:K.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:K.total,lookup:null,layout:{width:K.layout&&K.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(){return null},formatValue(O,b){return O==null?"":K.formatValue?K.formatValue(O,b):String(O)}}}}),Ue("packages/core/src/compute/group.js",function(e,H){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return O}});const ne=H("packages/core/src/compute/handle.js"),$=ne.dictSize,q=ne.identity,B=ne.presenceReader,x=ne.rowCount,Z=ne.valueReader,Y="",U="\0",W=1<<20;function K(b,u,h,l){const r=b.length,n=b.map(a=>Z(a)),o=Array.isArray(l)&&l.some(Boolean),i=o?n.map((a,f)=>l[f]?w=>l[f](a(w)):a):n;if(!o&&r>0&&b.every(a=>a&&a.kind==="dictionary"&&a.dict)){const a=b.map(w=>$(w.dict)+1);let f=1;for(let w=0;w<r;w++)f*=a[w];if(f<=Number.MAX_SAFE_INTEGER){const w=b.map(p=>p.values),g=b.map(p=>B(p)),k=p=>{let m=0;for(let v=0;v<r;v++){const y=g[v],T=y&&y(p)===0?a[v]-1:w[v][p];m=m*a[v]+T}return m},d=new Float64Array(h);for(let p=0;p<h;p++)d[p]=k(u[p]);return{packed:d,strings:null,product:f,readers:i,keyOf:k}}}const c=a=>{let f="";for(let w=0;w<r;w++){const g=i[w](a);f+=(w===0?"":Y)+(g==null?U:String(g))}return f},s=new Array(h);for(let a=0;a<h;a++)s[a]=c(u[a]);return{packed:null,strings:s,product:1/0,readers:i,keyOf:c}}function E(b,u,h,l){const r=new Uint32Array(l+1);for(let t=0;t<h;t++)r[u[t]+1]++;for(let t=0;t<l;t++)r[t+1]+=r[t];const n=new Uint32Array(h),o=r.slice(0,l);for(let t=0;t<h;t++)n[o[u[t]]++]=b[t];const i=new Array(l);for(let t=0;t<l;t++)i[t]=n.subarray(r[t],r[t+1]);return i}function O(b,u,h={}){const l=b||[],r=u||q(x(l[0],h)),n=r.length;if(l.length===0||n===0)return{keys:[],buckets:[]};const{packed:o,strings:i,product:t,readers:c}=K(l,r,n,h.project),s=new Uint32Array(n);let a=0,f=null;if(o&&t<=Math.max(1024,Math.min(W,n*4))){const d=t,p=new Int32Array(d).fill(-1);for(let m=0;m<n;m++)p[o[m]]=0;for(let m=0;m<d;m++)p[m]===0&&(p[m]=a++);for(let m=0;m<n;m++)s[m]=p[o[m]];f=new Float64Array(a);for(let m=0;m<d;m++)p[m]>=0&&(f[p[m]]=m)}else if(o){const d=new Map;for(let p=0;p<n;p++){const m=o[p];let v=d.get(m);v===void 0&&(v=a++,d.set(m,v)),s[p]=v}f=new Float64Array(a);for(const[p,m]of d)f[m]=p}else{const d=new Map;for(let p=0;p<n;p++){const m=i[p];let v=d.get(m);v===void 0&&(v=a++,d.set(m,v)),s[p]=v}}const w=E(r,s,n,a),g=new Array(a);for(let d=0;d<a;d++){const p=w[d][0],m=new Array(c.length);for(let v=0;v<c.length;v++)m[v]=c[v](p);g[d]=m}const k={keys:g,buckets:w};return f&&(k.packed=f),k}}),Ue("packages/core/src/compute/pivot.js",function(e,H){"use strict";Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return n}});const $=H("packages/core/src/internal/warn.js").warnOnce,B=H("packages/core/src/compute/handle.js").valueComparator,Z=H("packages/core/src/compute/group.js").packKeys,U=H("packages/core/src/compute/total.js").total,W="|",K="/",E=2e3;function O(t,c,s){return`${t}${W}${c}${W}${s}`}function b(t,c){let s="";for(let a=0;a<t.length;a++){const f=t[a];s+=(a===0?"":c)+(f==null?"":String(f))}return s}function u(t,c,s={}){const a=s.separator||K,f=c.length,{keyOf:w,readers:g}=Z(t,c,0),k=new Map,d=[],p=[];for(let _=0;_<f;_++){const R=c[_],I=w(R);if(k.has(I))continue;k.set(I,d.length),p.push(I);const j=new Array(g.length);for(let L=0;L<g.length;L++)j[L]=g[L](R);d.push(j)}const m=B(s.locale),v=d.map((_,R)=>R);v.sort((_,R)=>{const I=d[_],j=d[R];for(let L=0;L<I.length;L++){const F=h(I[L],j[L],m);if(F!==0)return F}return _-R});const y=new Array(v.length),T=new Array(v.length),A=new Map;for(let _=0;_<v.length;_++){const R=v[_];y[_]=d[R],T[_]=b(d[R],a),A.set(p[R],_)}return{keys:y,paths:T,idOf:_=>{const R=A.get(w(_));return R===void 0?-1:R}}}function h(t,c,s){const a=t==null,f=c==null;return a||f?a&&f?0:a?1:-1:s(t,c)}function l(t){const c=t.values||t.totals||[];if(c.length&&typeof c[0]=="object"&&c[0]!==null)return c.filter(w=>w&&w.handle);const s=typeof t.handle=="function"?t.handle:null;if(!s)return c.length&&$("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 t.totalOf=="function"?t.totalOf:null,f=[];for(const w of c){const g=s(w);g&&f.push({colId:w,handle:g,fn:a?a(w):"sum"})}return f}function r(t,c,s){if(Array.isArray(t)){const a=s||{};return{...a,pivotHandles:t,order:c||null,groups:a.groups||null}}return t||{}}function n(t,c,s){const a=r(t,c,s),f=a.separator||K,w=l(a),g=a.maxColumns===void 0?E: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(I=>b(I,f)):[""]),m=i(d),{keys:v,paths:y,idOf:T}=u(a.pivotHandles||[],m,a),A=y.length*Math.max(1,w.length),M=o(y,w,f);if(g&&A>g){const I=new Map;return{keys:v,paths:y,fields:M,groupPaths:p,columns:A,values:I,cells:I,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${A} columns, above pivot.maxColumns of ${g}. Narrow the pivot columns or raise the limit.`,columns:A,maxColumns:g}}}const _=new Map,R=y.length;for(let I=0;I<d.length;I++){const j=d[I],L=p[I]===void 0?"":p[I],F=j.length;if(F===0)continue;const N=new Int32Array(F),S=new Uint32Array(R+1);for(let G=0;G<F;G++){const X=T(j[G]);N[G]=X,X>=0&&S[X+1]++}for(let G=0;G<R;G++)S[G+1]+=S[G];const C=new Uint32Array(F),D=S.slice(0,R);for(let G=0;G<F;G++){const X=N[G];X>=0&&(C[D[X]++]=j[G])}for(let G=0;G<R;G++){const X=S[G],V=S[G+1];if(V===X)continue;const J=C.subarray(X,V);for(let ee=0;ee<w.length;ee++){const te=w[ee],ie=U(te.handle,J,te.fn,a.totalContext||{locale:a.locale});_.set(O(L,y[G],te.colId),ie)}}}return{keys:v,paths:y,fields:M,groupPaths:p,columns:A,values:_,cells:_,error:null}}function o(t,c,s){if(c.length===0)return t.slice();const a=[];for(const f of t)for(const w of c)a.push(`${f}${s}${w.colId}`);return a}function i(t){if(t.length===1)return t[0]||new Uint32Array(0);let c=0;for(const f of t)c+=f?f.length:0;const s=new Uint32Array(c);let a=0;for(const f of t)!f||f.length===0||(s.set(f,a),a+=f.length);return s}}),Ue("packages/core/src/store/bitset.js",function(e,H){"use strict";Object.defineProperty(e,"Bitset",{enumerable:!0,get:function(){return $}});const ne=8;class ${static#e=new Uint8Array(256);static{for(let B=1;B<256;B++)$.#e[B]=$.#e[B>>1]+(B&1)}#t;#n;constructor(B=0){const x=Math.max(0,B|0);this.#n=x,this.#t=new Uint8Array(Math.ceil(x/ne))}get size(){return this.#n}get words(){return this.#t}get bytes(){return this.#t?this.#t.byteLength:0}get(B){return B<0||B>=this.#n?0:this.#t[B>>3]>>(B&7)&1}set(B){return B>=0&&B<this.#n&&(this.#t[B>>3]|=1<<(B&7)),this}clear(B){return B>=0&&B<this.#n&&(this.#t[B>>3]&=~(1<<(B&7))),this}assign(B,x){return x?this.set(B):this.clear(B)}fill(B=!1){return this.#t.fill(B?255:0),B&&this.#r(),this}grow(B){const x=Math.max(0,B|0);if(x<=this.#n)return this;const Z=Math.ceil(x/ne);if(Z>this.#t.length){const Y=new Uint8Array(Z);Y.set(this.#t),this.#t=Y}return this.#n=x,this}count(){const B=this.#t,x=$.#e;let Z=0;for(let Y=0;Y<B.length;Y++)Z+=x[B[Y]];return Z}and(B){const x=B instanceof $?B.words:B,Z=this.#t,Y=Math.min(Z.length,x.length);for(let U=0;U<Y;U++)Z[U]&=x[U];for(let U=Y;U<Z.length;U++)Z[U]=0;return this}or(B){const x=B instanceof $?B.words:B,Z=this.#t,Y=Math.min(Z.length,x.length);for(let U=0;U<Y;U++)Z[U]|=x[U];return this}not(){const B=this.#t;for(let x=0;x<B.length;x++)B[x]=~B[x]&255;return this.#r(),this}clone(){const B=new $(this.#n);return B.words.set(this.#t.subarray(0,B.words.length)),B}release(){this.#t=new Uint8Array(0),this.#n=0}#r(){const B=this.#n&7;if(B===0)return;const x=this.#n>>3;x<this.#t.length&&(this.#t[x]&=(1<<B)-1)}static from(B){const x=Array.isArray(B)?B:Array.from(B),Z=new $(x.length);for(let Y=0;Y<x.length;Y++)x[Y]&&Z.set(Y);return Z}}}),Ue("packages/core/src/store/dictionary.js",function(e,H){"use strict";Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return B}});const ne=H("packages/core/src/internal/compare.js"),$=ne.collator,q=ne.defaultCompare;class B{#e;#t=new Map;#n=0;#r=null;#i=-1;#s="\0";constructor(Z=[]){this.#e=[];for(let Y=0;Y<Z.length;Y++){const U=Z[Y];this.#t.has(U)||(this.#t.set(U,this.#e.length),this.#e.push(U))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let Z=this.#e.length*8;for(let Y=0;Y<this.#e.length;Y++){const U=this.#e[Y];typeof U=="string"&&(Z+=U.length*2),Z+=16}return Z}codeOf(Z){const Y=this.#t.get(Z);if(Y!==void 0)return Y;const U=this.#e.length;return this.#e.push(Z),this.#t.set(Z,U),this.#n++,U}lookup(Z){const Y=this.#t.get(Z);return Y===void 0?-1:Y}has(Z){return this.#t.has(Z)}valueOf(Z){return this.#e[Z]}values(){return this.#e}ranks(Z){const Y=Z||"";if(this.#r&&this.#i===this.#n&&this.#s===Y)return this.#r;const U=this.#e.length,W=new Array(U);for(let b=0;b<U;b++)W[b]=b;const K=$(Z).compare,E=this.#e;W.sort((b,u)=>this.#o(E[b],E[u],K));const O=new Uint32Array(U);for(let b=0;b<U;b++)O[W[b]]=b;return this.#r=O,this.#i=this.#n,this.#s=Y,O}#o(Z,Y,U){return typeof Z=="string"&&typeof Y=="string"?U(Z,Y):q(Z,Y)}}}),Ue("packages/core/src/store/multivalue.js",function(e,H){"use strict";Object.defineProperty(e,"MultiValue",{enumerable:!0,get:function(){return ne}});class ne{#e;#t;#n=0;#r=0;constructor(q={}){const B=Math.max(1,q.rows??16),x=Math.max(1,q.values??B);this.#e=new Int32Array(x),this.#t=new Uint32Array(B+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,B){if(q<0||q>=this.#n)return!1;const x=this.#e,Z=this.#t[q+1];for(let Y=this.#t[q];Y<Z;Y++)if(x[Y]===B)return!0;return!1}hasAny(q,B){for(let x=0;x<B.length;x++)if(this.has(q,B[x]))return!0;return!1}hasAll(q,B){for(let x=0;x<B.length;x++)if(!this.has(q,B[x]))return!1;return!0}hasNone(q,B){return!this.hasAny(q,B)}push(q){const B=this.#n,x=q.length;this.#i(B+1),this.#s(this.#r+x);const Z=this.#r;for(let Y=0;Y<x;Y++)this.#e[Z+Y]=q[Y]|0;return this.#r+=x,this.#n=B+1,this.#t[B]=Z,this.#t[B+1]=this.#r,B}write(q,B){if(q===this.#n){this.push(B);return}if(q<0||q>this.#n)return;const x=this.#t[q],Z=this.#t[q+1],Y=B.length;if(Z-x===Y){for(let U=0;U<Y;U++)this.#e[x+U]=B[U]|0;return}this.#o(q,B)}compact(q,B,x){const Z=this.#e,Y=this.#t,U=this.#n,W=new Int32Array(Math.max(1,this.#r)),K=new Uint32Array(B+1);let E=0;for(let O=0;O<U;O++){if(q[O]===x)continue;const b=Y[O],u=Y[O+1];K[q[O]]=E;for(let h=b;h<u;h++)W[E++]=Z[h];K[q[O]+1]=E}this.#e=W,this.#t=K,this.#n=B,this.#r=E}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#i(q){if(q+1<=this.#t.length)return;let B=this.#t.length-1;for(;B<q;)B=B*2||16;const x=new Uint32Array(B+1);x.set(this.#t),this.#t=x}#s(q){if(q<=this.#e.length)return;let B=this.#e.length;for(;B<q;)B=B*2||16;const x=new Int32Array(B);x.set(this.#e),this.#e=x}#o(q,B){const x=this.#e,Z=this.#t,Y=this.#n,U=B.length-(Z[q+1]-Z[q]),W=new Int32Array(Math.max(1,this.#r+U)),K=new Uint32Array(Z.length);let E=0;for(let O=0;O<Y;O++){if(K[O]=E,O===q)for(let b=0;b<B.length;b++)W[E++]=B[b]|0;else for(let b=Z[O];b<Z[O+1];b++)W[E++]=x[b];K[O+1]=E}this.#e=W,this.#t=K,this.#r=E}}}),Ue("packages/core/src/compute/sort.js",function(e,H){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return R}});const ne=H("packages/core/src/compute/handle.js"),$=ne.bitReader,q=ne.dictRanks,B=ne.dictSize,x=ne.identity,Z=ne.isMissing,Y=ne.presenceReader,U=ne.rowCount,W=ne.valueComparator,K=ne.valueReader,E=new Uint32Array(0),O=new ArrayBuffer(8),b=new Float64Array(O),u=new Uint32Array(O),h=(b[0]=-1,(u[1]&2147483648)!==0?1:0),l=h===1?0:1;function r(j,L){b[0]=j;let F=u[h],N=u[l];(F&2147483648)!==0?(F=~F>>>0,N=~N>>>0):F=(F^2147483648)>>>0,L[0]=N,L[1]=F}function n(j,L,F,N){if(N<2)return j;const S=new Uint32Array(256*8);for(let te=0;te<N;te++){const ie=L[te],oe=F[te];S[ie&255]++,S[256+(ie>>>8&255)]++,S[512+(ie>>>16&255)]++,S[768+(ie>>>24&255)]++,S[1024+(oe&255)]++,S[1280+(oe>>>8&255)]++,S[1536+(oe>>>16&255)]++,S[1792+(oe>>>24&255)]++}let C=j,D=L,G=F,X=new Uint32Array(N),V=new Uint32Array(N),J=new Uint32Array(N);const ee=new Uint32Array(256);for(let te=0;te<8;te++){const ie=te<<8,oe=(te&3)<<3,ue=te>=4;let ye=!1;for(let Ce=0;Ce<256;Ce++)if(S[ie+Ce]===N){ye=!0;break}if(ye)continue;let he=0;for(let Ce=0;Ce<256;Ce++)ee[Ce]=he,he+=S[ie+Ce];for(let Ce=0;Ce<N;Ce++){const we=D[Ce],re=G[Ce],de=(ue?re:we)>>>oe&255,me=ee[de]++;X[me]=C[Ce],V[me]=we,J[me]=re}let Re=C;C=X,X=Re,Re=D,D=V,V=Re,Re=G,G=J,J=Re}return C}function o(j,L,F){if(F<2)return j;const N=new Uint32Array(256*4);for(let V=0;V<F;V++){const J=L[V];N[J&255]++,N[256+(J>>>8&255)]++,N[512+(J>>>16&255)]++,N[768+(J>>>24&255)]++}let S=j,C=L,D=new Uint32Array(F),G=new Uint32Array(F);const X=new Uint32Array(256);for(let V=0;V<4;V++){const J=V<<8,ee=V<<3;let te=!1;for(let ue=0;ue<256;ue++)if(N[J+ue]===F){te=!0;break}if(te)continue;let ie=0;for(let ue=0;ue<256;ue++)X[ue]=ie,ie+=N[J+ue];for(let ue=0;ue<F;ue++){const ye=C[ue],he=X[ye>>>ee&255]++;D[he]=S[ue],G[he]=ye}let oe=S;S=D,D=oe,oe=C,C=G,G=oe}return S}function i(j,L,F,N){const S=new Uint32Array(N+1);for(let G=0;G<F;G++)S[L[G]]++;let C=0;for(let G=0;G<=N;G++){const X=S[G];S[G]=C,C+=X}const D=new Uint32Array(F);for(let G=0;G<F;G++)D[S[L[G]]++]=j[G];return D}function t(j,L,F,N){return F<2?j:N<=65536||N<=F*2?i(j,L,F,N):o(j,L,F)}function c(j,L){return j.length===L&&j.byteOffset===0?j:Uint32Array.prototype.slice.call(j,0,L)}function s(j,L,F=!1){const N=L||x(j.length),S=N.length;if(S<2)return Uint32Array.from(N);const C=new Uint32Array(S),D=new Uint32Array(S),G=new Uint32Array(S),X=new Uint32Array(S),V=new Uint32Array(2);let J=0,ee=0;for(let oe=0;oe<S;oe++){const ue=N[oe],ye=j[ue];if(Number.isNaN(ye)){X[ee++]=ue;continue}r(ye,V),F?(D[J]=~V[0]>>>0,G[J]=~V[1]>>>0):(D[J]=V[0],G[J]=V[1]),C[J++]=ue}const te=n(C.subarray(0,J),D.subarray(0,J),G.subarray(0,J),J);if(ee===0)return c(te,J);const ie=new Uint32Array(S);return ie.set(te.subarray(0,J),0),ie.set(X.subarray(0,ee),J),ie}function a(j,L,F=!1){const N=L||x(j.length),S=N.length;if(S<2)return Uint32Array.from(N);const C=Uint32Array.from(N),D=new Uint32Array(S);for(let G=0;G<S;G++){const X=(j[C[G]]^2147483648)>>>0;D[G]=F?~X>>>0:X}return c(o(C,D,S),S)}function f(j,L,F={}){const N=L||x(U(j,F)),S=N.length;if(S<2)return Uint32Array.from(N);const C=q(j.dict,F.locale),D=j.values,G=Y(j),X=Math.max(B(j.dict),C.length),V=X,J=Uint32Array.from(N),ee=new Uint32Array(S),te=!!F.descending;for(let ie=0;ie<S;ie++){const oe=J[ie];let ue=G&&G(oe)===0?V:C[D[oe]];ue===void 0&&(ue=V),ee[ie]=te?V-ue:ue}return c(t(J,ee,S,X+1),S)}function w(j,L,F){const N=L.length;let S=Uint32Array.from(L);if(N<2)return S;let C=new Uint32Array(N);for(let D=1;D<N;D<<=1){for(let X=0;X<N;X+=D<<1){const V=Math.min(X+D,N),J=Math.min(X+(D<<1),N);let ee=X,te=V,ie=X;for(;ee<V&&te<J;)C[ie++]=F(j[S[ee]],j[S[te]])<=0?S[ee++]:S[te++];for(;ee<V;)C[ie++]=S[ee++];for(;te<J;)C[ie++]=S[te++]}const G=S;S=C,C=G}return S}function g(j,L,F){const N=$(j.values),S=L.length,C=new Uint32Array(S),D=F?1:0;let G=0;for(let X=0;X<S;X++)N(L[X])===D&&(C[G++]=L[X]);for(let X=0;X<S;X++)N(L[X])!==D&&(C[G++]=L[X]);return C}function k(j,L){const F=j.values,N=j.kind;if((N==="object"||N===void 0)&&(Array.isArray(F)||ArrayBuffer.isView(F))&&!j.presence)return F;const C=K(j),D=new Array(U(j)||0);for(let G=0;G<L.length;G++){const X=L[G];D[X]=C(X)}return D}function d(j,L){for(let F=0;F<L.length;F++)if(typeof j[L[F]]!="string")return!1;return!0}function p(j,L,F,N,S){const C=j.length,D=Uint32Array.from(j);if(C<2||N<1)return D;const G=new Uint32Array(C),X=N-1;for(let V=0;V<C;V++){const J=F[L[V]];G[V]=S?X-J:J}return c(t(D,G,C,N),C)}function m(j,L,F){const N=W(F),S=new Array(L);for(let D=0;D<L;D++)S[D]=D;S.sort((D,G)=>N(j[D],j[G])||D-G);const C=new Uint32Array(L);for(let D=0;D<L;D++)C[S[D]]=D;return C}function v(j,L,F){const N=L.length,S=new Map,C=[],D=new Uint32Array(N);for(let V=0;V<N;V++){const J=j[L[V]];let ee=S.get(J);ee===void 0&&(ee=C.length,S.set(J,ee),C.push(J)),D[V]=ee}const G=C.length,X=m(C,G,F.locale);return p(L,D,X,G,!!F.descending)}function y(j,L,F){const N=k(j,L);if(L.length>=2&&d(N,L)){const D=j.stringRank;return D&&D.version===j.version&&D.usable(L,N,F.locale)?D.sort(L,F):v(N,L,F)}const S=W(F.locale),C=F.descending?(D,G)=>S(G,D):S;return w(N,L,C)}function T(j,L,F){const N=k(j,L),S=F.compare,D=!!F.descending?(G,X)=>-S(G,X,void 0,void 0,!0):(G,X)=>S(G,X,void 0,void 0,!1);return w(N,L,D)}function A(j,L){const F=L.length,N=Y(j),S=j.values,C=j.kind==="float64"&&!!S,D=j.kind==="object"||j.kind==="multi"||j.kind===void 0;if(!N&&!C&&!D)return{present:L,absent:E};const G=new Uint32Array(F),X=new Uint32Array(F);let V=0,J=0;if(N&&C)for(let ee=0;ee<F;ee++){const te=L[ee];N(te)===1&&!Number.isNaN(S[te])?G[V++]=te:X[J++]=te}else if(C&&!N)for(let ee=0;ee<F;ee++){const te=L[ee];Number.isNaN(S[te])?X[J++]=te:G[V++]=te}else if(N&&!D)for(let ee=0;ee<F;ee++){const te=L[ee];N(te)===1?G[V++]=te:X[J++]=te}else{const ee=K(j);for(let te=0;te<F;te++){const ie=L[te];Z(ee(ie))?X[J++]=ie:G[V++]=ie}}return J===0?{present:L,absent:E}:{present:G.subarray(0,V),absent:X.subarray(0,J)}}function M(j,L,F){if(L.length===0)return j;const N=new Uint32Array(j.length+L.length);return F?(N.set(L,0),N.set(j,L.length)):(N.set(j,0),N.set(L,j.length)),N}function _(j,L,F={}){const N=L||x(U(j,F));if(!j||N.length<2)return Uint32Array.from(N);const{present:S,absent:C}=A(j,N);if(S.length===0)return Uint32Array.from(N);const D=!!F.descending;let G;if(typeof F.compare=="function")G=T(j,S,F);else switch(j.kind){case"float64":G=s(j.values,S,D);break;case"int32":G=a(j.values,S,D);break;case"dictionary":G=f(j,S,F);break;case"bitset":G=g(j,S,D);break;default:G=y(j,S,F);break}return M(G,C,!!F.nullsFirst)}function R(j,L,F,N={}){const S=L||[],C=S.length&&(S[0].handle||I(j,S[0].col))||j&&j[0];let D=F||x(U(C,N));for(let G=S.length-1;G>=0;G--){const X=S[G],V=X.handle||I(j,X.col)||j&&j[G];V&&(D=_(V,D,{descending:X.descending!==void 0?!!X.descending:X.dir==="desc",nullsFirst:!!X.nullsFirst,locale:X.locale!==void 0?X.locale:N.locale,compare:X.compare}))}return D instanceof Uint32Array?D:Uint32Array.from(D)}function I(j,L){if(!(!j||L===void 0)){for(let F=0;F<j.length;F++)if(j[F]&&j[F].id===L)return j[F]}}}),Ue("packages/core/src/store/stringrank.js",function(e,H){"use strict";Object.defineProperty(e,"DEFAULT_MAX_DISTINCT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"StringRankIndex",{enumerable:!0,get:function(){return x}});const ne=H("packages/core/src/compute/sort.js"),$=ne.collateStringRanks,q=ne.rankSortStrings,B=1e5;class x{#e=[];#t=new Map;#n;#r=0;#i=0;#s=-1;#o;#l=!1;#a=null;#c=-1;#u="\0";constructor(Y=B){this.#o=Y>0?Y:B,this.#n=new Uint32Array(0)}get version(){return this.#s}set version(Y){this.#s=Y}get generation(){return this.#i}get size(){return this.#e.length}get capped(){return this.#l}get length(){return this.#r}get bytes(){let Y=this.#n.byteLength;const U=this.#e;for(let W=0;W<U.length;W++)Y+=U[W].length*2+24;return Y}#f(Y,U){const W=this.#t.get(Y);if(W!==void 0)return W;if(this.#l)return-1;if(U&&this.#e.length>=this.#o)return this.#l=!0,-1;const K=this.#e.length;return this.#e.push(Y),this.#t.set(Y,K),this.#i++,K}build(Y,U){const W=U|0;this.#e=[],this.#t=new Map,this.#i=0,this.#l=!1,this.#a=null,this.#c=-1,this.#n=new Uint32Array(W);for(let K=0;K<W;K++){const E=Y[K],O=typeof E=="string"?this.#f(E,!1):-1;this.#n[K]=O<0?0:O}this.#r=W}append(Y,U,W){const K=(U|0)+(W|0);if(K>this.#n.length){const E=new Uint32Array(K);E.set(this.#n.subarray(0,this.#r)),this.#n=E}for(let E=U|0;E<K;E++){const O=Y[E],b=typeof O=="string"?this.#f(O,!0):-1;this.#n[E]=b<0?0:b}this.#r=Math.max(this.#r,K)}ranks(Y){const U=Y||"";if(this.#a&&this.#c===this.#i&&this.#u===U)return this.#a;const W=$(this.#e,this.#e.length,Y);return this.#a=W,this.#c=this.#i,this.#u=U,W}usable(Y,U,W){if(this.#l||this.#e.length===0)return!1;const K=this.#n,E=this.#e,O=this.#r;for(let b=0;b<Y.length;b++){const u=Y[b];if(u>=O||E[K[u]]!==U[u])return!1}return!0}sort(Y,U){const W=this.ranks(U.locale),K=this.#e.length,E=Y.length,O=new Uint32Array(E),b=this.#n;for(let u=0;u<E;u++)O[u]=b[Y[u]];return q(Y,O,W,K,!!U.descending)}}}),Ue("packages/core/src/store/columnstore.js",function(e,H){"use strict";Object.defineProperty(e,"REMOVED",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"toFloat",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ColumnHandle",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"ColumnStore",{enumerable:!0,get:function(){return g}});const $=H("packages/core/src/internal/warn.js").warnOnce,B=H("packages/core/src/internal/predicates.js").isFunction,Z=H("packages/core/src/internal/paths.js").pathGetter,U=H("packages/core/src/store/bitset.js").Bitset,K=H("packages/core/src/store/dictionary.js").Dictionary,O=H("packages/core/src/store/multivalue.js").MultiValue,u=H("packages/core/src/store/stringrank.js").StringRankIndex,h=4294967295,l=1024,r=5e3,n=.2,o=new Set(["float64","int32","bitset","dictionary","object","multi"]);function i(k){return k==null}function t(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 c(k){const d=t(k);return Number.isFinite(d)?d|0:0}function s(k){return i(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),m=new Array(p.length);for(let v=0;v<p.length;v++)m[v]=k.dict.valueOf(p[v]);return m}default:return k.buf[d]}}function f(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],m=k.offsets[d+1],v=k.table||[],y=new Array(m-p);for(let T=p;T<m;T++)y[T-p]=v[k.values[T]];return y}default:return k.values[d]}}class w{#e;#t;#n;#r;#i;#s;#o;#l=!1;#a=null;#c=null;#u=null;#f=null;#d=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#A=null;#w=null;#O=!1;constructor(d,p){this.#e=d.id;const m=o.has(d.kind)?d.kind:"object";d.kind&&!o.has(d.kind)&&$(`store.kind.${d.id}`,`column "${d.id}" declares unknown storage kind "${d.kind}"; falling back to object`),this.#n=m,this.#t=m,this.#r=d.nullable!==!1,this.#o=d.dictionary??null,this.#s=p,this.#i=B(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.#f:null}get stringRank(){if(this.#O||!this.#h||this.kind!=="object")return null;const d=this.values,p=this.#s.physical();if(!d||p===0)return null;if(this.#d===null){if(typeof d[0]!="string")return null;const m=new u(this.#v());return m.build(d,p),m.version=this.#y,this.#d=m,this.#m=this.#y,m.capped?null:m}return this.#d.length<p&&this.#d.append(d,this.#d.length,p-this.#d.length),this.#d.version=this.#y,this.#m=this.#y,this.#d.capped?null:this.#d}#v(){return this.#p}#T(){this.#d=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.#f&&(d+=this.#f.bytes),this.#A&&(d+=this.#A.size*24),d}get(d){if(!this.#O&&!(d<0||d>=this.#s.physical())){if(!this.#l)return this.#N(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.#f.valueOf(this.#a[d]);case"multi":{const p=this.#u.at(d),m=new Array(p.length);for(let v=0;v<p.length;v++)m[v]=this.#f.valueOf(p[v]);return m}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.#d&&this.#T(),this.#y++)}read(d){return this.#i(d)}appendColumn(d,p,m){if(this.#O||m<=0)return;if(!this.#l){this.#y++;return}const v=this.#i,y=this.#r,T=this.#g;let A=!1;switch(this.#t){case"float64":{const M=this.#a;for(let _=0;_<m;_++){const R=v(d[_]);if(typeof R=="number"){y&&T.set(p+_),M[p+_]=R;continue}const I=R==null;y?T.assign(p+_,!I):I&&(A=!0),M[p+_]=I?NaN:t(R)}break}case"int32":{const M=this.#a;for(let _=0;_<m;_++){const R=v(d[_]),I=R==null;y?T.assign(p+_,!I):I&&(A=!0),M[p+_]=I?0:c(R)}break}case"bitset":{const M=this.#c;for(let _=0;_<m;_++){const R=v(d[_]),I=R==null;y?T.assign(p+_,!I):I&&(A=!0),M.assign(p+_,!I&&!!R)}break}case"dictionary":{const M=this.#a,_=this.#f;for(let R=0;R<m;R++){const I=v(d[R]),j=I==null;y?T.assign(p+R,!j):j&&(A=!0),M[p+R]=j?0:_.codeOf(I)}break}case"multi":{const M=this.#u,_=this.#f;for(let R=0;R<m;R++){const I=v(d[R]),j=I==null;y?T.assign(p+R,!j):j&&(A=!0);const L=s(I),F=new Array(L.length);for(let N=0;N<L.length;N++)F[N]=_.codeOf(L[N]);M.write(p+R,F)}break}default:{const M=this.#a;for(let _=0;_<m;_++){const R=v(d[_]),I=R==null;y?T.assign(p+_,!I):I&&(A=!0),M[p+_]=I?null:R}break}}A&&$(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#d&&this.#t==="object"&&(this.#d.append(this.#a,p,m),this.#d.version=this.#y+1,this.#m=this.#y+1),this.#y++}appendPacked(d,p,m){if(this.#O||m<=0||!d)return;if(!this.#l){this.#y++;return}const v=this.#g,y=d.presence;if(v)if(y)for(let A=0;A<m;A++)v.assign(p+A,(y[A>>3]&1<<(A&7))!==0);else for(let A=0;A<m;A++)v.set(p+A);const T=d.kind===this.#t;if(T&&(this.#t==="float64"||this.#t==="int32")){this.#a.set(d.values,p),this.#y++;return}if(T&&this.#t==="bitset"){const A=d.values;for(let M=0;M<m;M++)this.#c.assign(p+M,(A[M>>3]&1<<(M&7))!==0);this.#y++;return}if(T&&this.#t==="dictionary"){const A=d.table||[],M=new Uint32Array(A.length);for(let j=0;j<A.length;j++)M[j]=this.#f.codeOf(A[j]);const _=d.values,R=this.#a,I=v;for(let j=0;j<m;j++){if(I&&(y&&(y[j>>3]&1<<(j&7))===0)){R[p+j]=0;continue}R[p+j]=M[_[j]]??0}this.#y++;return}if(T&&this.#t==="multi"){const A=d.table||[],M=new Uint32Array(A.length);for(let I=0;I<A.length;I++)M[I]=this.#f.codeOf(A[I]);const _=d.values,R=d.offsets;for(let I=0;I<m;I++){const j=R[I],L=R[I+1],F=new Array(L-j);for(let N=j;N<L;N++)F[N-j]=M[_[N]]??0;this.#u.write(p+I,F)}this.#y++;return}for(let A=0;A<m;A++){const M=y?(y[A>>3]&1<<(A&7))===0:d.kind==="object"?d.values[A]===null:!1;this.#E(p+A,M?null:f(d,A))}this.#y++}touch(){this.#y++}columnarise(d,p){if(this.#l||this.#O)return;const m=new Array(p);for(let v=0;v<p;v++)m[v]=this.#N(v);this.#t=this.#n,this.#l=!0,this.#S(d);for(let v=0;v<p;v++)this.#E(v,m[v]);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||!o.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.#f},m=this.#s.physical(),v=this.#g;this.#t=d,this.#S(this.#b);for(let y=0;y<m;y++){const T=v!==null&&v.get(y)===0;T&&d!=="multi"||this.#E(y,T?null:a(p,y))}return this.#T(),this.#y++,!0}compact(d,p,m){if(!this.#O){if(this.#T(),!this.#l){const v=this.#A;if(v.size){const y=new Map;for(const[T,A]of v)d[T]!==h&&y.set(d[T],A);this.#A=y}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const v=this.#a;for(let y=0;y<p;y++)d[y]!==h&&(v[d[y]]=v[y]);if(this.#t==="object")for(let y=m;y<p;y++)v[y]=void 0;break}case"bitset":{const v=this.#c;for(let y=0;y<p;y++)d[y]!==h&&v.assign(d[y],v.get(y)===1);for(let y=m;y<p;y++)v.clear(y);break}case"multi":this.#u.compact(d,m,h);break;default:break}if(this.#g){const v=this.#g;for(let y=0;y<p;y++)d[y]!==h&&v.assign(d[y],v.get(y)===1);for(let y=m;y<p;y++)v.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.#f=null,this.#d=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 U(p);break;case"dictionary":this.#a=new Uint32Array(p),this.#f=this.#f??new K(this.#o??[]);break;case"multi":this.#u=new O({rows:p,values:p}),this.#f=this.#f??new K(this.#o??[]);break;default:this.#a=new Array(p);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#f=null),this.#r&&(this.#g?this.#g.grow(p):this.#g=new U(p)),this.#b=p}#E(d,p){const m=i(p);switch(this.#r?this.#g.assign(d,!m):m&&$(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#t){case"float64":this.#a[d]=m?NaN:t(p);break;case"int32":this.#a[d]=m?0:c(p);break;case"bitset":this.#c.assign(d,!m&&!!p);break;case"dictionary":this.#a[d]=m?0:this.#f.codeOf(p);break;case"multi":{const v=s(p),y=new Array(v.length);for(let T=0;T<v.length;T++)y[T]=this.#f.codeOf(v[T]);this.#u.write(d,y);break}default:this.#a[d]=m?null:p;break}}#N(d){if(this.#A.has(d))return this.#A.get(d);const p=this.#i(this.#s.rowAt(d));return p===void 0?null:p}#P(){if(this.#w&&this.#w.version===this.#y)return this.#w;const d=this.#s.physical(),p=new Array(d),m=this.#r?new U(d):null;for(let v=0;v<d;v++){const y=this.#N(v);p[v]=y,m&&!i(y)&&m.set(v)}return this.#w={version:this.#y,values:p,presence:m},this.#w}}class g{#e;#t=new Map;#n=[];#r=[];#i=0;#s=0;#o=0;#l=0;#a=new U(0);#c=!1;#u=!0;#f;#d;#h;#p=!1;constructor(d,p={}){this.#e=Array.isArray(d)?d:[],this.#d=Math.max(1,p.initialCapacity??l),this.#u=p.retainSource!==!1,this.#f=this.#u?p.columnarBelow??r:0,this.#h=p.compactRatio??n;const m={rowAt:v=>this.#r[v],physical:()=>this.#i};for(const v of this.#e){if(!v||!v.id)continue;if(this.#t.has(v.id)){$(`store.dup.${v.id}`,`duplicate column id "${v.id}" in the store schema; ignoring the second`);continue}const y=new w(v,m);this.#t.set(v.id,y),this.#n.push(y)}this.#f<=0&&this.#b()}get count(){return this.#o}get physical(){return this.#i}get capacity(){return this.#c?this.#s:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let d=this.#a.bytes+this.#r.length*8;for(const p of this.#n)d+=p.bytes;return d}append(d){const p=this.#i;if(this.#p||!d)return{from:p,to:p};const m=d.length|0;if(m===0)return{from:p,to:p};if(this.#u)for(let y=0;y<m;y++)this.#r[p+y]=d[y];if(this.#i=p+m,this.#o+=m,this.#a.grow(this.#i),!this.#c){if(this.#i>=this.#f)this.#b();else for(const y of this.#n)y.touch();return{from:p,to:this.#i}}this.#m(this.#i);const v=this.#n;for(let y=0;y<v.length;y++)v[y].appendColumn(d,p,m);return{from:p,to:this.#i}}appendPacked(d,p){const m=this.#i;if(this.#p||!d)return{from:m,to:m};const v=d.count|0;if(v===0)return{from:m,to:m};if(this.#u&&p)for(let T=0;T<v;T++)this.#r[m+T]=p[T];this.#i=m+v,this.#o+=v,this.#a.grow(this.#i),this.#c||this.#b(),this.#m(this.#i);const y=new Map;for(const T of d.columns)y.set(T.id,T);for(const T of this.#n){const A=y.get(T.id);A?T.appendPacked(A,m,v):T.grow(this.#s)}return{from:m,to:this.#i}}source(d){if(this.#u)return this.#r[d];if(!(d<0||d>=this.#i))return this.#g(d)}setSource(d,p){this.#p||d<0||d>=this.#i||this.#u&&(this.#r[d]=p)}get(d,p){const m=this.#t.get(d);return m?m.get(p):void 0}set(d,p,m){if(this.#p||p<0||p>=this.#i)return;const v=this.#t.get(d);if(!v){$(`store.set.${d}`,`set() on unknown column "${d}"`);return}v.set(p,m)}remove(d){return this.#p||d<0||d>=this.#i||this.#a.get(d)===1?!1:(this.#a.set(d),this.#l++,this.#o--,!0)}live(d){return d<0||d>=this.#i?!1:this.#a.get(d)===0}compact(d={}){if(this.#p||this.#l===0||!d.force&&this.#l/this.#i<this.#h)return null;const p=this.#i,m=new Uint32Array(p);let v=0;for(let y=0;y<p;y++)m[y]=this.#a.get(y)===1?h:v++;for(const y of this.#n)y.compact(m,p,v);if(this.#u){const y=this.#r;for(let T=0;T<p;T++)m[T]!==h&&(y[m[T]]=y[T]);y.length=v}return this.#i=v,this.#o=v,this.#l=0,this.#a=new U(Math.max(this.#s,v)),m}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 m=0;m<this.#i;m++)d[m]=m;return d}let p=0;for(let m=0;m<this.#i;m++)this.#a.get(m)===0&&(d[p++]=m);return d}convert(d,p){const m=this.#t.get(d);return m?m.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.#i=0,this.#o=0,this.#l=0,this.#s=0}}#m(d){if(d<=this.#s)return;let p=this.#s||this.#d;for(;p<d;)p*=2;for(const m of this.#n)m.grow(p);this.#a.grow(p),this.#s=p}#g(d){const p={};for(const m of this.#n)p[m.id]=m.get(d);return p}#b(){if(this.#c)return;let d=this.#d;for(;d<this.#i;)d*=2;this.#c=!0,this.#s=d,this.#a.grow(d);for(const p of this.#n)p.columnarise(d,this.#i)}}}),Ue("packages/core/src/store/pool.js",function(e,H){"use strict";Object.defineProperty(e,"MaskPool",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"sharedPool",{enumerable:!0,get:function(){return x}});const ne=64,$=8;function q(Y){let U=ne;for(;U<Y;)U*=2;return U}class B{#e=new Map;#t=new WeakSet;#n;#r=0;#i={acquired:0,reused:0,released:0};constructor(U={}){this.#n=U.limit??$}get bytes(){return this.#r}mask(U){const W=new Uint8Array(this.#s(U),0,U);return W.fill(0),W}indices(U){return new Uint32Array(this.#s(U*4),0,U)}release(U){if(!U||!U.buffer)return!1;const W=U.buffer;if(!this.#t.has(W))return!1;this.#t.delete(W),this.#i.released++;const K=W.byteLength;let E=this.#e.get(K);return E||this.#e.set(K,E=[]),E.length>=this.#n||(E.push(W),this.#r+=K),!0}releaseAll(U){for(const W of U)this.release(W)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#i,retained:this.#r}}#s(U){const W=q(U),K=this.#e.get(W);this.#i.acquired++;let E;return K&&K.length?(E=K.pop(),this.#r-=W,this.#i.reused++):E=new ArrayBuffer(W),this.#t.add(E),E}}function x(){return Z??=new B,Z}let Z=null}),Ue("packages/core/src/compute/sortspec.js",function(e,H){"use strict";Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return x}});function ne(Z){return{locale:Z===void 0?void 0:String(Z),numeric:!0,sensitivity:"variant"}}function $(Z){return!!Z&&typeof Z.compare!="function"}function q(Z){if(!Z)return!0;for(let Y=0;Y<Z.length;Y++)if(!$(Z[Y]))return!1;return!0}function B(Z,Y){const U=Z.col!==void 0?Z.col:Z.handle&&Z.handle.id,W=Z.locale!==void 0?Z.locale:Y;return{col:U,descending:Z.descending!==void 0?!!Z.descending:Z.dir==="desc",nullsFirst:!!Z.nullsFirst,collation:ne(W)}}function x(Z,Y){const U=Z||[],W=new Array(U.length);for(let K=0;K<U.length;K++)W[K]=B(U[K],Y);return W}}),Ue("packages/core/src/compute/facet.js",function(e,H){"use strict";Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"orderedReader",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"toNumeric",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return c}}),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 ne=H("packages/core/src/compute/handle.js"),$=ne.presenceReader,q=ne.valueReader,B=ne.dictSize,x=ne.dictValue,Z=Object.freeze(["equal","quantile","log"]),Y=Object.freeze(["hour","day","week","month","quarter","year"]),U=20,W=50,K=1e4;function E(m,v){if(!m)return"none";const y=v;if(y&&(y.multi===!0||typeof y.items=="function"))return"category";const T=v&&v.base;if(T==="date"||T==="datetime"||T==="time"||T==="dateString")return"date";switch(m.kind){case"bitset":return"boolean";case"float64":case"int32":return"numeric";case"dictionary":return"category";case"multi":return"category";default:return T==="number"?"numeric":T==="boolean"?"boolean":T==="text"?"category":"none"}}function O(m){const v=m.values,y=m.kind;if((y==="float64"||y==="int32")&&v)return A=>v[A];const T=q(m);return A=>b(T(A))}function b(m){if(typeof m=="number")return m;if(m instanceof Date)return m.getTime();if(m==null||m==="")return NaN;if(typeof m=="boolean")return m?1:0;if(typeof m=="string"){const v=Number(m);if(Number.isFinite(v))return v;const y=Date.parse(m);return Number.isFinite(y)?y:NaN}return NaN}function u(m,v,y,T=W){if(!m)return{cardinality:0,exact:!0};if(m.dict)return{cardinality:B(m.dict),exact:!0};if(m.kind==="bitset")return{cardinality:2,exact:!0};const A=q(m),M=v?v.length:y,_=new Set;for(let R=0;R<M;R++){const I=A(v?v[R]:R);if(I!=null&&(_.add(I),_.size>T))return{cardinality:_.size,exact:!1}}return{cardinality:_.size,exact:!0}}const h=36e5,l=864e5;function r(m,v=U){const y=Number.isFinite(m)&&m>0?m:0,T=Math.max(1,v)*2;return y/h<=T?"hour":y/l<=T?"day":y/(7*l)<=T?"week":y/(30*l)<=T?"month":y/(91*l)<=T?"quarter":"year"}function n(m,v){if(!Number.isFinite(m))return NaN;const y=new Date(m);switch(v){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 T=(y.getDay()+6)%7;return y.setDate(y.getDate()-T),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 o(m,v){const y=new Date(m);switch(v){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 i(m,v,y){const T=O(m),A=$(m),M=v?v.length:y;let _=1/0,R=-1/0,I=0,j=0;for(let L=0;L<M;L++){const F=v?v[L]:L;if(A&&!A(F)){I++;continue}const N=T(F);if(!Number.isFinite(N)){I++;continue}N<_&&(_=N),N>R&&(R=N),j++}return{min:_,max:R,nulls:I,finite:j}}function t(m,v,y,T){const A=O(m),M=$(m),_=v?v.length:y,R=_>T?_/T:1,I=[];for(let L=0;L<_;L+=R){const F=v?v[Math.floor(L)]:Math.floor(L);if(M&&!M(F))continue;const N=A(F);Number.isFinite(N)&&I.push(N)}const j=Float64Array.from(I);return j.sort(),j}function c(m,v,y,T={}){const A=T.kind||E(m,T.type);return A==="none"||!m?{kind:"none",buckets:[],suppressed:"type"}:A==="boolean"?s(m,v,y):A==="category"?a(m,v,y,T):f(m,v,y,A,T)}function s(m,v,y){const T=$(m);let A=0;if(T){const _=v?v.length:y;for(let R=0;R<_;R++)T(v?v[R]:R)||A++}const M=[{value:!1,label:"false"},{value:!0,label:"true"}];return A>0&&M.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:M}}function a(m,v,y,T){const A=T.cardinalityLimit??W,{cardinality:M}=u(m,v,y,A);if(M>A&&(T.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:M};const _=q(m),R=v?v.length:y,I=new Map;let j=0;for(let C=0;C<R;C++){const D=_(v?v[C]:C);if(D==null||D===""){j++;continue}if(Array.isArray(D)){if(!D.length){j++;continue}for(const G of D)I.set(G,(I.get(G)||0)+1);continue}I.set(D,(I.get(D)||0)+1)}let L=[...I.entries()];T.order==="alpha"?L.sort((C,D)=>String(C[0]).localeCompare(String(D[0]))):L.sort((C,D)=>D[1]-C[1]);let F=0,N=0;if(L.length>A){N=L.length-A;for(let C=A;C<L.length;C++)F+=L[C][1];L=L.slice(0,A)}const S=L.map(([C])=>({value:C,label:String(C)}));return F>0&&S.push({remainder:!0,label:`Other (${N} values)`}),j>0&&S.push({null:!0,label:"Empty"}),{kind:"category",buckets:S,cardinality:M}}function f(m,v,y,T,A){const{min:M,max:_,nulls:R,finite:I}=i(m,v,y);if(!I)return{kind:T,buckets:R?[{null:!0,label:"Empty"}]:[],empty:!0};const j=Math.max(1,Math.floor(A.buckets||U));let L=[];if(T==="date"){const N=Y.includes(A.granularity)?A.granularity:r(_-M,j);let S=n(M,N);for(;S<=_&&L.length<4096;){const C=o(S,N);if(!(C>S))break;L.push({from:S,to:C}),S=C}return{kind:T,buckets:w(L,R),granularity:N}}const F=Z.includes(A.strategy)?A.strategy:"equal";if(F==="quantile"){const N=t(m,v,y,K);if(N.length){const S=[N[0]];for(let C=1;C<j;C++){const D=N[Math.min(N.length-1,Math.floor(C/j*N.length))];D>S[S.length-1]&&S.push(D)}S.push(_);for(let C=0;C<S.length-1;C++)L.push({from:S[C],to:S[C+1]})}}else if(F==="log"&&M>0){const N=Math.log10(M),C=(Math.log10(_)-N)/j||1;for(let D=0;D<j;D++)L.push({from:10**(N+D*C),to:10**(N+(D+1)*C)})}if(!L.length){const N=(_-M)/j||1;for(let S=0;S<j;S++)L.push({from:M+S*N,to:M+(S+1)*N})}return L[L.length-1].to=_,{kind:T,buckets:w(L,R),strategy:F,min:M,max:_}}function w(m,v){return v>0?[...m,{null:!0,label:"Empty"}]:m}function g(m,v,y,T,A){const M=T&&T.buckets||[],_=A&&A.length>=M.length?A.subarray(0,M.length):new Uint32Array(M.length);if(_.fill(0),!m||!M.length)return _;const R=M.length-1,I=!!M[R]&&M[R].null===!0,j=v?v.length:y;if(T.kind==="boolean"){const C=q(m);for(let D=0;D<j;D++){const G=C(v?v[D]:D);if(G==null){I&&_[R]++;continue}_[G?1:0]++}return _}if(T.kind==="category"){const C=new Map;for(let X=0;X<M.length;X++)!M[X].null&&!M[X].remainder&&C.set(M[X].value,X);const D=M.findIndex(X=>X.remainder),G=q(m);for(let X=0;X<j;X++){const V=G(v?v[X]:X);if(V==null||V===""){I&&_[R]++;continue}if(Array.isArray(V)){if(!V.length){I&&_[R]++;continue}for(const ee of V){const te=C.get(ee);te!==void 0?_[te]++:D>=0&&_[D]++}continue}const J=C.get(V);J!==void 0?_[J]++:D>=0&&_[D]++}return _}const L=I?M.length-1:M.length,F=new Float64Array(L+1);for(let C=0;C<L;C++)F[C]=M[C].from;F[L]=L?M[L-1].to:0;const N=O(m),S=$(m);for(let C=0;C<j;C++){const D=v?v[C]:C;if(S&&!S(D)){I&&_[R]++;continue}const G=N(D);if(!Number.isFinite(G)){I&&_[R]++;continue}const X=k(F,L,G);X>=0&&_[X]++}return _}function k(m,v,y){if(!v||y<m[0])return-1;if(y>=m[v])return y===m[v]?v-1:-1;let T=0,A=v-1;for(;T<A;){const M=T+A+1>>>1;y>=m[M]?T=M:A=M-1}return T}function d(m,v,y,T={}){const A=T.bounds||c(m,T.boundsIndices??v,y,T);return{bounds:A,counts:g(m,v,y,A)}}const p=d}),Ue("packages/core/src/compute/pivotmatrix.js",function(e,H){"use strict";Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return O}}),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 n}});const $=H("packages/core/src/compute/handle.js").valueComparator,B=H("packages/core/src/compute/total.js").total,Z=H("packages/core/src/compute/group.js").packKeys,Y=H("packages/core/src/compute/pivot.js"),U=Y.joinPath,W=Y.DEFAULT_PATH_SEPARATOR,K=Y.DEFAULT_MAX_COLUMNS,E="";function O(o,i,t={}){const c=t.separator||W,s=o||[],a=i instanceof Uint32Array?i:Uint32Array.from(i||[]),f=a.length;if(s.length===0)return{tuples:[[]],paths:[E],buckets:[a]};const{keyOf:w,readers:g}=Z(s,a,0),k=new Map,d=[],p=[],m=[];for(let _=0;_<f;_++){const R=a[_],I=w(R);let j=k.get(I);if(j===void 0){j=d.length,k.set(I,j),p.push(I);const L=new Array(g.length);for(let F=0;F<g.length;F++)L[F]=g[F](R);d.push(L),m.push([])}m[j].push(R)}const v=$(t.locale),y=d.map((_,R)=>R);y.sort((_,R)=>{const I=d[_],j=d[R];for(let L=0;L<I.length;L++){const F=b(I[L],j[L],v);if(F!==0)return F}return _-R});const T=new Array(y.length),A=new Array(y.length),M=new Array(y.length);for(let _=0;_<y.length;_++){const R=y[_];T[_]=d[R],A[_]=U(d[R],c),M[_]=Uint32Array.from(m[R])}return{tuples:T,paths:A,buckets:M}}function b(o,i,t){const c=o==null,s=i==null;return c||s?c&&s?0:c?1:-1:t(o,i)}function u(o,i,t){const c=[];for(let s=0;s<o.length;s++)t.has(o[s])&&c.push(o[s]);return Uint32Array.from(c)}function h(o,i,t,c){return{value:i.length?B(o,i,t,c):null,leaves:i,count:i.length}}function l(o){const i=o&&o.opts||{},t=i.separator||W,c=i.totalContext||{locale:i.locale},s=(o.measures||[]).filter(A=>A&&A.handle),a=o.leaves instanceof Uint32Array?o.leaves:Uint32Array.from(o.leaves||[]),f=O(o.rowHandles||[],a,{...i,separator:t}),w=O(o.columnHandles||[],a,{...i,separator:t}),g=i.maxColumns===void 0?K:i.maxColumns,k=w.paths.length*Math.max(1,s.length),d=new Map;if(g&&k>g)return{rowAxis:f,columnAxis:w,measures:s.map(A=>({colId:A.colId,fn:A.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,m=new Map,v=new Map,y=new Map,T=w.buckets.map(A=>new Set(A));for(let A=0;A<w.paths.length;A++){const M=w.buckets[A],_=w.paths[A];for(const R of s)v.set(n(_,R.colId),h(R.handle,M,R.fn,c))}for(let A=0;A<f.paths.length;A++){const M=f.buckets[A],_=f.paths[A];for(const R of s)m.set(n(_,R.colId),h(R.handle,M,R.fn,c));for(let R=0;R<w.paths.length;R++){const I=u(M,w.buckets[R],T[R]);if(I.length===0)continue;const j=w.paths[R];for(const L of s)p.set(r(_,j,L.colId),h(L.handle,I,L.fn,c))}}for(const A of s)y.set(A.colId,h(A.handle,a,A.fn,c));return{rowAxis:f,columnAxis:w,measures:s.map(A=>({colId:A.colId,fn:A.fn})),body:p,rowMargin:m,columnMargin:v,grand:y,columns:k,error:null}}function r(o,i,t){return`${o}\0${i}\0${t}`}function n(o,i){return`${o}\0${i}`}}),Ue("packages/core/src/compute/reference.js",function(e,H){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return l}});const $=H("packages/core/src/internal/paths.js").getPath,q=H("packages/core/src/compute/handle.js"),B=q.isMissing,x=q.valueComparator,Y=H("packages/core/src/compute/filter.js").testValue,U="",W="\0";function K(o,i){const t=i.includes(".")?$(o,i):o?.[i];return t===void 0?null:t}function E(o,i,t={}){const c=i||[];let s=o.map((a,f)=>f);if(c.length===0)return s;for(let a=c.length-1;a>=0;a--)s=O(o,s,c[a],t);return s}function O(o,i,t,c){const s=t.locale!==void 0?t.locale:c.locale,a=x(s),f=t.descending!==void 0?!!t.descending:t.dir==="desc",w=[],g=[];for(const p of i){const m=K(o[p],t.col);B(m)?g.push(p):w.push(p)}const k=new Map;for(let p=0;p<w.length;p++)k.set(w[p],p);const d=(p,m)=>{const v=K(o[p],t.col),y=K(o[m],t.col);let T;return typeof t.compare=="function"?(T=t.compare(v,y,o[p],o[m],f),f&&(T=-T)):T=f?a(y,v):a(v,y),T!==0?T:k.get(p)-k.get(m)};return w.sort(d),t.nullsFirst?g.concat(w):w.concat(g)}function b(o,i,t={}){const c=[];for(let s=0;s<o.length;s++)u(o[s],i,t,s)&&c.push(s);return c}function u(o,i,t,c){if(!i)return!0;if(Array.isArray(i.conditions)){const s=i.conditions.filter(f=>f!=null);if(s.length===0)return!0;if(i.op==="or")return s.some(f=>u(o,f,t,c));const a=s.every(f=>u(o,f,t,c));return i.op==="not"?!a:a}return i.col===void 0&&typeof t.custom=="function"?!!t.custom(i,o,c):Y(K(o,i.col),i,t.locale)}function h(o,i,t,c){const s=t||o.map((g,k)=>k),a=new Map,f=[],w=[];for(const g of s){const k=i.map((m,v)=>{const y=K(o[g],m);return c&&c[v]?c[v](y):y}),d=k.map(m=>m==null?W:String(m)).join(U);let p=a.get(d);p===void 0&&(p=f.length,a.set(d,p),f.push(k),w.push([])),w[p].push(g)}return{keys:f,buckets:w}}function l(o,i,t={}){const c=x(t.locale),s=o.filter(f=>!B(f)),a=s.map(r).filter(f=>f!==null);switch(i){case"count":return o.length;case"countValues":return s.length;case"sum":return a.reduce((f,w)=>f+w,0);case"avg":return s.length===0?null:a.reduce((f,w)=>f+w,0)/s.length;case"min":return s.length===0?null:s.reduce((f,w)=>c(w,f)<0?w:f);case"max":return s.length===0?null:s.reduce((f,w)=>c(w,f)>0?w:f);case"first":return o.length===0?null:n(o[0]);case"last":return o.length===0?null:n(o[o.length-1]);default:return null}}function r(o){if(typeof o=="number")return Number.isNaN(o)?null:o;if(o==null||o===""||typeof o=="boolean")return null;if(o instanceof Date)return o.getTime();const i=Number(o);return Number.isNaN(i)?null:i}function n(o){return o===void 0?null:o}}),Ue("packages/core/src/compute/index.js",function(e,H){"use strict";const ne=H("packages/core/src/compute/sort.js");Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return ne.sortColumn}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return ne.sortMulti}}),Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return ne.radixSortFloat64}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return ne.radixSortInt32}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return ne.rankSortDictionary}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return ne.mergeSortComparator}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return ne.collateStringRanks}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return ne.rankSortStrings}});const $=H("packages/core/src/compute/sortspec.js");Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return $.collationDescriptor}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return $.isPortableSort}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return $.isPortableSortSet}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return $.describeSortEntry}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return $.describeSort}});const q=H("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 B=H("packages/core/src/compute/group.js");Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return B.groupByColumns}}),Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return B.packKeys}});const x=H("packages/core/src/compute/facet.js");Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return x.facet}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return x.computeBounds}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return x.countInto}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return x.bucketOf}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return x.facetKind}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return x.cardinalityOf}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return x.pickGranularity}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return x.floorTo}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return x.advance}}),Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return x.STRATEGIES}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return x.GRANULARITIES}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return x.DEFAULT_BUCKETS}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return x.DEFAULT_CARDINALITY_LIMIT}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return x.QUANTILE_SAMPLE}});const Z=H("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 Y=H("packages/core/src/compute/pivot.js");Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return Y.pivot}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return Y.resolvePivotKeys}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return Y.pivotKey}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return Y.joinPath}}),Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return Y.KEY_DELIMITER}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return Y.DEFAULT_PATH_SEPARATOR}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return Y.DEFAULT_MAX_COLUMNS}});const U=H("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return U.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return U.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return U.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return U.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return U.GRAND_PATH}});const W=H("packages/core/src/compute/reference.js");Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return W.referenceSort}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return W.referenceFilter}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return W.referenceGroup}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return W.referenceTotal}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return W.referencePasses}}),Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return W.referenceValue}});const K=H("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return K.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return K.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return K.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return K.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return K.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return K.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return K.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return K.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return K.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return K.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return K.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return K.isMissing}});const E=H("packages/core/src/compute/sketch.js");Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return E.Welford}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return E.Reservoir}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return E.HyperLogLog}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return E.SpaceSaving}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return E.KLL}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return E.hash32}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return E.SKETCH_BOUNDS}});const O=H("packages/core/src/compute/windowed.js");Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return O.Window}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return O.WINDOW_KINDS}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return O.openWindow}});const b=H("packages/core/src/compute/statistics.js");Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return b.MAINTENANCE}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return b.APPROXIMATE}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return b.maintenanceOf}});const u=H("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return u.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return u.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return u.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return u.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return u.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return u.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return u.anomalyCondition}});const h=H("packages/core/src/compute/forecast.js");Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return h.FORECAST_METHODS}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return h.forecast}})}),Ue("packages/core/src/source/rows.js",function(e,H){"use strict";Object.defineProperty(e,"DEFAULT_ROW_HEIGHT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"KEY_SEP",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"groupPrefixKeys",{enumerable:!0,get:function(){return h}});const $=H("packages/core/src/internal/warn.js").warnOnce,B=H("packages/core/src/internal/predicates.js").isFunction,x=32,Z="\0";function Y(l){return new U(l)}class U{#e;#t;constructor(r){this.#e=B(r&&r.rowKey)?r.rowKey:null;const n=r&&r.config?r.config.rowHeight:void 0;this.#t=typeof n=="number"||B(n)?n:x}get keyed(){return this.#e!==null}keyOf(r,n){if(this.#e){const o=this.#e(r);if(o!=null)return String(o)}else $("source.rowKey.missing","no config.rowKey; falling back to index identity.","Row changes, streaming dedupe, selection persistence and remote reload are disabled.");return`#${n}`}heightOf(r){return B(this.#t)?Number(this.#t(r))||x:this.#t}leaf(r,n,o=0,i=null){const t={key:this.keyOf(r,n),data:r,level:o,parent:i,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:n};return t.height=this.heightOf(t),t}group(r){const n={key:u(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&&(n.totals=r.totals),n.height=this.heightOf(n),n}footer(r){const n={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 n.height=this.heightOf(n),n}detail(r,n){return{key:`${r.key}${Z}detail`,data:r.data,level:r.level+1,parent:r,group:!1,detail:!0,expanded:!1,leafCount:0,height:n,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:r.key}}grandTotal(r,n){const o={key:`${Z}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:n,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:r};return o.height=this.heightOf(o),o}skeleton(r,n=0,o=!1){const i={key:`${Z}pending${Z}${r}`,data:null,level:n,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:r,selected:!1,physical:null,pending:!0};return o&&(i.loadError=!0),i.height=this.heightOf(i),i}}function W(l,r,n,o){return{key:`${Z}pinned${Z}${n}${Z}${r}`,data:l,level:0,parent:null,group:!1,expanded:!1,leafCount:0,height:o,index:null,selected:!1,physical:null,hasChildren:!1,pinned:n}}function K(l,r){return new Proxy([],{get(n,o,i){if(o==="length")return l();if(typeof o=="string"){const t=Number(o);if(Number.isInteger(t)&&t>=0)return r(t)}return Reflect.get(n,o,i)},has(n,o){if(typeof o=="string"){const i=Number(o);if(Number.isInteger(i)&&i>=0)return i<l()}return Reflect.has(n,o)}})}function E(l){return l==null?"":String(l)}const O="";function b(l){if(l==null)return O;const r=String(l);return r.startsWith(O)?O+r:r}function u(l){const r=l||[];let n="g";for(let o=0;o<r.length;o++)n+=Z+b(r[o]);return n}function h(l){const r=new Array(l.length),n=[];for(let o=0;o<l.length;o++)n.push(l[o]),r[o]=u(n);return r}}),Ue("packages/core/src/source/handles.js",function(e,H){"use strict";Object.defineProperty(e,"HandleProvider",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"createHandleProvider",{enumerable:!0,get:function(){return Z}});const $=H("packages/core/src/internal/predicates.js").isFunction,B=H("packages/core/src/internal/warn.js").warnOnce;class x{#e;#t;#n;#r=new Map;#i=0;constructor(U,W,K){this.#e=U,this.#t=W,this.#n=$(K)?K:()=>!1}get store(){const U=this.#e.store;return U&&$(U.column)?U:null}invalidate(){this.#i++}handle(U){const W=this.store;if(W){const b=W.column(U);if(b)return b}const K=this.#r.get(U);if(K&&K.builtAt===this.#i)return K.handle;const E=this.#s(U);if(!E)return;if(W&&this.#n()){B(`source.dropped.${U}`,`column "${U}" 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 O=this.#o(E);return this.#r.set(U,{handle:O,builtAt:this.#i}),O}#s(U){const W=this.#e.columns;return W&&$(W.get)?W.get(U):void 0}#o(U){const W=this.#t()||[],K=W.length,E=new Array(K),O=$(U.getValue)?u=>U.getValue(u):u=>u?.[U.field||U.id];for(let u=0;u<K;u++)E[u]=W[u]===void 0?void 0:O(W[u]);const b=this.#i;return{id:U.id,kind:"object",nullable:!1,values:E,presence:null,dict:null,offsets:null,get(u){return E[u]},version:b}}}function Z(Y,U,W){return new x(Y,U,W)}}),Ue("packages/core/src/compute/incremental.js",function(e,H){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return W}});const $=H("packages/core/src/store/columnstore.js").toFloat,q=Object.freeze(["sum","avg","countValues","min","max"]),B=Object.freeze(["float64"]),x=1e15;function Z(K,E){return typeof K!="string"||!q.includes(K)?!1:!!E&&B.includes(E.kind)}function Y(K){if(K==null)return null;const E=$(K);return Number.isNaN(E)?null:E}class U{#e;#t=0;#n=0;#r=0;#i=1/0;#s=-1/0;#o=!1;#l=!1;constructor(E){this.#e=E}get valid(){return this.#o&&!this.#l}get fn(){return this.#e}seed(E){this.#a();for(let O=0;O<E.length;O++){const b=Y(E[O]);b!==null&&this.#c(b)}this.#o=!0}seedColumn(E,O,b){this.#a();for(let u=0;u<b.length;u++){const h=b[u];if(O&&O(h)===0)continue;const l=E[h];Number.isNaN(l)||this.#c(l)}this.#o=!0}#a(){this.#t=0,this.#n=0,this.#r=0,this.#i=1/0,this.#s=-1/0,this.#l=!1}#c(E){if(!Number.isFinite(E)){this.#l=!0;return}const O=this.#t+E;this.#n+=Math.abs(this.#t)>=Math.abs(E)?this.#t-O+E:E-O+this.#t,this.#t=O,this.#r++,E<this.#i&&(this.#i=E),E>this.#s&&(this.#s=E)}#u(E){const O=this.#t-E;this.#n+=Math.abs(this.#t)>=Math.abs(E)?this.#t-O-E:-E-O+this.#t,this.#t=O,this.#r--}update(E,O){if(!this.#o)return!1;const b=Y(E),u=Y(O);return b===null&&u===null?!0:b!==null&&!Number.isFinite(b)||u!==null&&!Number.isFinite(u)?!1:this.#e==="min"||this.#e==="max"?b===null||u===null?!1:this.#e==="min"?u<this.#i?(this.#i=u,!0):b>this.#i:u>this.#s?(this.#s=u,!0):b<this.#s:Math.abs(this.#t)>x?!1:(b!==null&&this.#u(b),u!==null&&this.#c(u),!0)}value(){switch(this.#e){case"countValues":return this.#r;case"avg":return this.#r?(this.#t+this.#n)/this.#r:null;case"min":return this.#r?this.#i:null;case"max":return this.#r?this.#s:null;default:return this.#t+this.#n}}invalidate(){this.#o=!1}}const W=U}),Ue("packages/core/src/source/filterwire.js",function(e,H){"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 B}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"resolveRelativeRange",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"relativeTokenOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"relativeTokenHelp",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"isResolvableRelative",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"resolveRelativeCondition",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"forEachCondition",{enumerable:!0,get:function(){return w}}),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 m}}),Object.defineProperty(e,"querySignature",{enumerable:!0,get:function(){return v}});const $=H("packages/core/src/internal/warn.js").warnOnce,q="source.remote.hostFilter",B="source.where.pageRelative";function x(A,M){!Array.isArray(A)||!A.length||$(B,`filters.where (${A.join(", ")}) runs over the rows the ${M} 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(A){const M=(A||{}).config;!M||!M.hostFilter||$(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 Y="source.where.notApplied";function U(A,M){$(`${Y}:${A}`,`filters.where("${A}") is registered but the ${M} 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 W="source.where.overThreshold";function K(A,M,_,R){!Array.isArray(A)||!A.length||$(`${W}:${M}`,`filters.where (${A.join(", ")}) is not applied to the ${M} pushdown source:`,_===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${_.toLocaleString()} rows, at or past the whereRowLimit of ${R.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 E=new Map;function O(A){let M=E.get(A);return M||(M=new Intl.DateTimeFormat("en-US",{timeZone:A,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),E.set(A,M)),M}function b(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function u(A,M){const _=O(M).formatToParts(new Date(A)),R={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const I of _)I.type==="year"?R.y=+I.value:I.type==="month"?R.m=+I.value:I.type==="day"?R.d=+I.value:I.type==="hour"?R.h=+I.value%24:I.type==="minute"?R.mi=+I.value:I.type==="second"&&(R.s=+I.value);return R}function h(A,M){const _=u(A,M);return Date.UTC(_.y,_.m-1,_.d,_.h,_.mi,_.s)-Math.floor(A/1e3)*1e3}function l(A,M,_,R){const I=Date.UTC(A,M-1,_),j=I-h(I,R);return I-h(j,R)}function r(A,M,_){const R=new Date(Date.UTC(A.y,A.m-1,A.d+M));return l(R.getUTCFullYear(),R.getUTCMonth()+1,R.getUTCDate(),_)}const n=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function o(A,M){if(typeof A!="string")return null;const _=A.trim().toLowerCase().replace(/[\s_-]+/g,""),R=/^last(\d*|n)days?$/.exec(_);if(R){const I=R[1]==="n"?"":R[1],j=Number(I||M);return!Number.isFinite(j)||j<=0?null:{kind:"lastNDays",n:Math.floor(j)}}switch(_){case"today":return{kind:"today",n:0};case"yesterday":return{kind:"yesterday",n:0};case"thisweek":return{kind:"thisWeek",n:0};case"thismonth":return{kind:"thisMonth",n:0};case"thisquarter":return{kind:"thisQuarter",n:0};case"thisyear":return{kind:"thisYear",n:0};case"quartertodate":case"qtd":return{kind:"quarterToDate",n:0};case"yeartodate":case"ytd":return{kind:"yearToDate",n:0};default:return null}}function i(A,M={}){const _=o(A,M.n);if(!_)return null;const R=M.tz||b(),I=M.now instanceof Date?M.now.getTime():typeof M.now=="number"?M.now:Date.now(),j=u(I,R),L=l(j.y,j.m,j.d,R),F=r(j,1,R);let N=L,S=F;switch(_.kind){case"today":break;case"yesterday":N=r(j,-1,R),S=L;break;case"lastNDays":S=M.includeToday?F:L,N=r(j,M.includeToday?-(_.n-1):-_.n,R);break;case"thisWeek":{const C=Number.isFinite(M.weekStartsOn)?Number(M.weekStartsOn):1,G=(new Date(Date.UTC(j.y,j.m-1,j.d)).getUTCDay()-C+7)%7;N=r(j,-G,R),S=r(j,-G+7,R);break}case"thisMonth":N=l(j.y,j.m,1,R),S=l(j.m===12?j.y+1:j.y,j.m===12?1:j.m+1,1,R);break;case"thisQuarter":case"quarterToDate":{const C=Math.floor((j.m-1)/3)*3+1;N=l(j.y,C,1,R),S=_.kind==="quarterToDate"?F:C===10?l(j.y+1,1,1,R):l(j.y,C+3,1,R);break}case"thisYear":case"yearToDate":N=l(j.y,1,1,R),S=_.kind==="yearToDate"?F:l(j.y+1,1,1,R);break;default:return null}return{from:new Date(N).toISOString(),to:new Date(S).toISOString(),bounds:"[)",tz:R,relative:_.kind==="lastNDays"?`last${_.n}Days`:_.kind,n:_.n}}function t(A){if(!A||typeof A!="object")return null;const M=A.value;if(M&&typeof M=="object"&&!Array.isArray(M)&&"relative"in M)return{token:String(M.relative),n:typeof M.n=="number"?M.n:void 0};if(A.op==="relative"&&typeof A.value=="string")return{token:A.value,n:void 0};const _=A.meta;return _&&typeof _.relative=="string"&&A.value===void 0?{token:_.relative,n:typeof _.n=="number"?_.n:void 0}:null}function c(){return`Known tokens: ${n.filter(M=>M!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function s(A){const M=t(A);return M?o(M.token,M.n)!==null:!1}function a(A,M={}){const _=t(A);if(!_)return A;const R=i(_.token,{...M,n:_.n});return R?{...A,type:A.type||"date",op:"between",value:[R.from,R.to],bounds:A.bounds||R.bounds,meta:{...A.meta||{},relative:R.relative,tz:R.tz}}:($(`source.relative.${_.token}`,`unknown relative date token "${_.token}"; sending the condition unresolved.`,c()),A)}function f(A){return!!A&&typeof A=="object"&&Array.isArray(A.conditions)}function w(A,M){if(A){if(f(A)){for(const _ of A.conditions)w(_,M);return}M(A)}}function g(A,M){if(!A)return null;if(!f(A))return M(A);const _=A;let R=!1;const I=[];for(const j of _.conditions){const L=g(j,M);L!==j&&(R=!0),L&&I.push(L)}return!R&&I.length===_.conditions.length?A:I.length?{..._,conditions:I}:null}function k(A){if(!A)return null;if(!f(A))return A;const M=A,_=[];for(const R of M.conditions){const I=k(R);I&&_.push(I)}return _.length?{op:M.op,conditions:_}:null}function d(A){const M=k(A);return M?f(M)&&M.op==="and"?M:{op:"and",conditions:[M]}:null}function p(A){const M=(A||[]).filter(Boolean);return M.length?{op:"and",conditions:M}:null}function m(A,M={}){const _=g(A,R=>a(R,M));return d(_)}function v(A){const M=y(A.filters??null);return JSON.stringify([M,A.sort??null,A.quick??"",A.groupBy??null,A.pivotBy??null,T(A.context)])}function y(A){if(!A)return null;if(f(A)){const R=A;return{op:R.op,conditions:R.conditions.map(y)}}const M=A,_=M.meta&&typeof M.meta.relative=="string"?M.meta.relative:t(M)?.token;return{col:M.col,op:M.op,bounds:M.bounds??null,caseSensitive:M.caseSensitive??!1,value:_?`rel:${_}`:M.value??null}}function T(A){if(A==null)return null;try{return JSON.parse(JSON.stringify(A))}catch{return $("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),Ue("packages/core/src/source/tree.js",function(e,H){"use strict";Object.defineProperty(e,"SYNTHETIC",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"buildFromPath",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"assignLevels",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"resolveTree",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"buildTree",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"indexTree",{enumerable:!0,get:function(){return u}});const $=H("packages/core/src/internal/predicates.js").isFunction,B=H("packages/core/src/internal/warn.js").warnOnce,x="",Z="\0tree:";function Y(h,l){return{physical:h,key:l,level:0,children:[],value:void 0}}function U(h,l){const r=[],n=new Map;for(let o=0;o<h.length;o++){const i=h[o],t=l.pathOf(i),c=Array.isArray(t)?t.map(a=>String(a)):[];if(!c.length){const a=Y(i,l.keyOf(i));r.push(a);continue}let s=null;for(let a=0;a<c.length;a++){const f=c.slice(0,a+1).join(x),w=a===c.length-1;let g=n.get(f);g&&w&&g.physical===-1&&(g.physical=i,g.key=l.keyOf(i)),g||(g=Y(w?i:-1,w?l.keyOf(i):Z+f),g.level=a,g.value=c[a],n.set(f,g),s?s.children.push(g):r.push(g)),s=g}}return{roots:r,nodes:n}}function W(h,l){const r=new Map,n=[];for(let c=0;c<h.length;c++){const s=h[c],a=l.keyOf(s),f=Y(s,a);r.set(a,f);const w=l.parentOf(s);w!=null&&w!==""&&n.push({node:f,parent:String(w)})}let o=null;const i=new Map;for(const{node:c,parent:s}of n){const a=r.get(s);if(a){i.set(c.key,a);continue}l.orphans&&l.orphans!=="root"&&(o||(o=Y(-1,`${Z}orphans`),o.value=l.orphans),i.set(c.key,o))}const t=[];for(const c of r.values()){const s=i.get(c.key);s?s.children.push(c):t.push(c)}return o&&o.children.length&&t.push(o),{roots:K(t,r,l.orphans,o),nodes:r}}function K(h,l,r,n){const o=new Set,i=[...h];for(;i.length;){const f=i.pop();if(!o.has(f.key)){o.add(f.key);for(const w of f.children)i.push(w)}}const t=[];for(const f of l.values())o.has(f.key)||t.push(f);if(!t.length)return h;const c=!!r&&r!=="root";B("tree.cycle",`tree.parentKey produced ${t.length} row(s) inside a parent cycle; `+(c?`they are shown under "${r}".`:"they are shown at the root."));for(const f of t)f.children=f.children.filter(w=>o.has(w.key));if(!c)return[...h,...t];let s=n;const a=[...h];return s||(s=Y(-1,`${Z}orphans`),s.value=r,a.push(s)),s.children.push(...t),a}function E(h){let l=0;const r=(n,o)=>{for(const i of n)i.level=o,o>l&&(l=o),i.children.length&&r(i.children,o+1)};return r(h,0),l}function O(h,l){if(!h||typeof h!="object")return null;const r=h.path,n=h.parentKey,o=$(h.hasChildren)?i=>!!h.hasChildren(l.dataAt(i)):null;if($(r))return{mode:"path",pathOf:i=>r(l.dataAt(i)),keyOf:l.keyOf,declaresChildren:o};if(n!=null){const i=$(n)?n:t=>t?.[n];return{mode:"parentKey",parentOf:t=>i(l.dataAt(t)),keyOf:l.keyOf,orphans:h.orphans||"root",declaresChildren:o}}return B("tree.shape","tree is configured with neither `path` nor `parentKey`; rows stay flat."),null}function b(h,l){const r=l.mode==="path"?U(h,l):W(h,l),n=E(r.roots);return{...r,depth:n}}function u(h,l){const r=new Map,n=o=>{for(let i=0;i<o.length;i++){const t=o[i];if(t.physical>=0){const c=l?l(t.physical):!1,s=c&&t.children.length===0;r.set(t.physical,{level:t.level,posinset:i+1,setsize:o.length,hasChildren:t.children.length>0||c,lazy:s})}t.children.length&&n(t.children)}};return n(h),r}}),Ue("packages/core/src/source/settle.js",function(e,H){"use strict";Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return $}});const ne=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function $(q){const B=q&&typeof q=="object"?q.reason:null;return typeof B=="string"&&ne.includes(B)}}),Ue("packages/core/src/source/memory.js",function(e,H){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"quickMatcher",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"MemorySource",{enumerable:!0,get:function(){return G}});const $=H("packages/core/src/internal/lru.js").Lru,q=H("packages/core/src/internal/warn.js"),B=q.warnOnce,x=q.fail,Y=H("packages/core/src/internal/predicates.js").isFunction,W=H("packages/core/src/internal/compare.js").defaultCompare,E=H("packages/core/src/internal/merge.js").mergeRow,O=H("packages/core/src/source/rows.js"),b=O.createRowFactory,u=O.groupKey,h=O.groupPathElement,l=O.groupPrefixKeys,r=O.lazyRowView,o=H("packages/core/src/source/handles.js").createHandleProvider,i=H("packages/core/src/compute/incremental.js"),t=i.RunningTotal,c=i.isIncremental,a=H("packages/core/src/compute/handle.js").presenceReader,f=H("packages/core/src/source/filterwire.js"),w=f.querySignature,g=f.mapConditions,k=f.resolveRelativeCondition,d=H("packages/core/src/source/tree.js"),p=d.buildTree,m=d.resolveTree,v=d.indexTree,y=H("packages/core/src/source/settle.js"),T=y.PIPELINE_SETTLE_REASONS,A=y.isPipelineSettle,M=Object.freeze(["filter","sort","group","total","pivot","flatten"]),_=Object.freeze([]);function R(X,V){if(!X)return null;const J=V==="grand"?X.grandTotal:X.groupTotal;return J??X.total}function I(X){return!!X&&!X.running}function j(X){if(X)return X.value&&Y(X.value.compare)?X.value.compare:Y(X.compare)?X.compare:void 0}function L(X){const V=X&&X.dataType;return!V||!Y(V.items)?null:{items:V.items,type:X.itemType&&X.itemType.name||"text"}}function F(X){return!!X&&(typeof X=="object"||typeof X=="function")&&Y(X.then)}const N=new Uint32Array(0),S=4096;function C(X,V){return new G(X,V)}function D(X,V){if(V==="regex")try{const J=new RegExp(X,"iu");return ee=>J.test(ee)}catch{return J=>J.includes(X)}if(V==="fuzzy"){const J=[...X].filter(ee=>ee!==" ");return J.length?ee=>{let te=0;for(let ie=0;ie<ee.length&&te<J.length;ie++)ee[ie]===J[te]&&te++;return te===J.length}:()=>!0}if(V==="words"){const J=X.split(/\s+/).filter(Boolean);return J.length?ee=>J.every(te=>ee.includes(te)):()=>!0}return J=>J.includes(X)}class G{mode="memory";#e;#t;#n;#r=!1;#i=null;#s;#o;#l=new Map;#a=!1;#c=0;#u=0;#f=new Map;#d=new Map;#h;#p=null;#m=G.#g();static#g(){return{slots:[],groupHeadings:_,unnumbered:_,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;#N=null;#P=null;#M=null;#R=null;#$=null;#U=null;#K=null;#x=Symbol("unset");#I=new Map;#Y=null;get#F(){return this.#m.slots}set#F(V){this.#m.slots=V}get#G(){return this.#m.inlineLeaves}set#G(V){this.#m.inlineLeaves=V}get#H(){return this.#m.groupHeadings}set#H(V){this.#m.groupHeadings=V}get#z(){return this.#m.unnumbered}set#z(V){this.#m.unnumbered=V}get#fe(){return this.#m.pivot}set#fe(V){this.#m.pivot=V}constructor(V,J){this.#t=V||{mode:"memory"},this.#e=J||{};const ee=this.#e.config||{};this.#n=this.#t.rows||ee.rows||[],this.#s=b(this.#e),this.#o=o(this.#e,()=>this.#n,()=>this.#r),this.#h=new $(Number(ee.rowCacheSize)||S);for(const te of M)this.#l.set(te,{key:null,result:null,id:0,computed:!1})}count(){this.#D();const V=this.#ne();return V?V.length:this.#F.length}#ne(){const V=Number(this.#V("pageSize",0))||0;if(V<=0)return null;const J=this.#F.length,ee=Math.max(1,Math.ceil(J/V)),ie=Math.min(Math.max(0,Number(this.#V("page",0))||0),ee-1)*V;return{offset:ie,length:Math.max(0,Math.min(V,J-ie))}}pageInfo(){this.#D();const V=Number(this.#V("pageSize",0))||0,J=this.#F.length;if(V<=0)return{page:0,pageSize:0,total:J,pageCount:1};const ee=Math.max(1,Math.ceil(J/V));return{page:Math.min(Math.max(0,Number(this.#V("page",0))||0),ee-1),pageSize:V,total:J,pageCount:ee}}totalCount(){return this.#ue().length}matchCount(){return this.#D(),this.#m.matchCount}at(V){this.#D();const J=this.#ne();if(J)return V<0||V>=J.length?void 0:this.#$e(J.offset+V,V);if(!(V<0||V>=this.#F.length))return this.#$e(V,V)}byKey(V){this.#D(),this.#p||this.#Ce();const J=this.#p.get(V);if(J!==void 0)return this.#Ae(J);for(let ee=0;ee<this.#F.length;ee++){const te=this.#F[ee];if(typeof te!="number"&&te&&te.key===V)return this.#$e(ee)}}loaded(V){return V>=0&&V<this.count()}hint(V,J){}display(){return this.#D(),this.#Y||(this.#Y=this.#Mt()),this.#Y}invalidateQuickText(){this.#I.clear(),this.invalidate("filter")}invalidate(V){const J=M.indexOf(V);J<0&&x(`unknown pipeline stage "${V}"; expected one of ${M.join(", ")}`);for(let ee=J;ee<M.length;ee++){const te=this.#l.get(M[ee]);te.key=null,te.computed=!1}this.#Y=null}apply(V){const J=[],ee={added:[],updated:[],removed:[],rejected:J};if(!V)return ee;let te=!1;const ie=new Set;if(V.remove&&V.remove.length)for(const oe of V.remove){const ue=this.#de(oe);if(ue===void 0){J.push({operation:"remove",id:this.#ye(oe),reason:"unknown-id"});continue}ee.removed.push(this.#s.keyOf(this.#r?this.#ae(ue):this.#n[ue],ue)),this.#r||(this.#n[ue]=void 0),this.#h.delete(ue),this.#I.delete(ue),te=!0}if(V.update&&V.update.length){const oe=this.#A.size||this.#Ge()?this.#Ze():null,ue=this.#v.size?this.#kt():null,ye=ue&&ue.length?this.#Ze():null;for(const he of V.update){const Re=this.#de(he);if(Re===void 0){J.push({operation:"update",id:this.#Pe(he),reason:"unknown-id"});continue}const Ce=this.#r?this.#i&&this.#i.has(Re)?this.#i.get(Re):this.#ae(Re):this.#n[Re],we=E(Ce,he);for(const re of this.#te(Ce,we))ie.add(re);if(this.#r||(this.#n[Re]=we),oe&&this.#Tt(oe,Re,Ce,we),ye&&this.#lt(ue,ye,Re,Ce,we),this.#p){const re=this.#s.keyOf(Ce,Re),de=this.#s.keyOf(we,Re);re!==de&&(this.#p.delete(re),this.#p.set(de,Re))}this.#h.delete(Re),this.#I.delete(Re),ee.updated.push(this.#Ae(Re))}}if(V.add&&V.add.length&&this.#r){typeof V.at=="number"&&V.at<this.#Me()&&(this.#h.clear(),this.#I.clear()),this.#p=null;for(const oe of V.add){const ue=this.#ie(this.#Pe(oe));ue!==void 0&&ee.added.push(this.#Ae(ue))}te=!0}else if(V.add&&V.add.length){const oe=typeof V.at=="number"?V.at:this.#n.length,ue=this.#n.length;let ye=V.add===this.#n?V.add.slice():V.add;if(this.#s.keyed){const he=[];for(const Re of ye){const Ce=this.#Pe(Re);if(this.#de(Ce)!==void 0){J.push({operation:"add",id:Ce,reason:"duplicate-id"});continue}he.push(Re)}he.length!==ye.length&&(ye=he)}if(!ye.length)return ee;if(oe>=ue)for(let he=0;he<ye.length;he++)this.#n.push(ye[he]);else this.#n.splice(oe,0,...ye),this.#h.clear(),this.#I.clear();for(let he=0;he<ye.length;he++)ee.added.push(this.#Ae(oe>=ue?ue+he:oe+he));te=!0}return this.#c++,te&&(this.#p=null,this.#nt()),this.#o.invalidate(),this.#Y=null,te||this.#X(ie)?(this.#u++,this.invalidate("filter")):this.invalidate("total"),this.#Qe("rows:changed",{companion:!0,added:ee.added.length,updated:ee.updated.length,removed:ee.removed.length}),this.#i=null,ee}groupHeadingsAt(V){this.#D();const J=this.#H;if(!J.length||!Number.isInteger(V)||V<0)return _;let ee=0,te=J.length-1,ie=-1;for(;ee<=te;){const ue=ee+te>>1;J[ue].at<=V?(ie=ue,ee=ue+1):te=ue-1}if(ie<0)return _;const oe=[];for(let ue=J[ie].row;ue;ue=ue.parent)oe.push(ue);return oe.reverse(),oe}unnumberedRowCount(V){this.#D();const J=this.#z;if(!J.length||!Number.isInteger(V)||V<0)return 0;let ee=0,te=J.length-1,ie=-1;for(;ee<=te;){const oe=ee+te>>1;J[oe].at<=V?(ie=oe,ee=oe+1):te=oe-1}return ie+1}moveRow(V,J){if(this.#r)return B("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(V)||!Number.isInteger(J)||V<0||V>=ee.length)return!1;const te=Math.max(0,Math.min(ee.length-1,J));if(te===V)return!1;const[ie]=ee.splice(V,1);return ee.splice(te,0,ie),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#I.clear(),this.#nt(),this.#o.invalidate(),this.#Y=null,this.invalidate("filter"),this.#Qe("rows:changed",{companion:!0,added:0,updated:0,removed:0,moved:1}),!0}reload(V){this.#pe(),this.#c++,this.#u++,this.#p=null,this.#I.clear(),this.#h.clear(),this.#nt(),this.#o.invalidate(),this.invalidate("filter"),this.#Qe("model:changed",{reason:"reload"})}destroy(){this.#pe(),this.#h.clear(),this.#I.clear(),this.#p=null,this.#F=[],this.#G=null,this.#Y=null,this.#nt();for(const V of M)this.#l.set(V,{key:null,result:null,id:0,computed:!1})}#pe(){for(const{controller:V}of this.#b.values())try{V.abort()}catch{}this.#b.clear()}setRows(V){this.#n=V||[],this.#r=!1,this.#c++,this.#u++,this.#p=null,this.#I.clear(),this.#h.clear(),this.#nt(),this.#o.invalidate(),this.invalidate("filter")}notePriorRows(V){this.#i=V||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#I.clear(),this.#o.invalidate()}data(){if(!this.#r)return this.#n;const V=this.#e.store;if(!V||!Y(V.source))return this.#n;const J=V.physical||0,ee=new Array(J);for(let te=0;te<J;te++)ee[te]=V.live&&!V.live(te)?void 0:V.source(te);return ee}#Fe(){const V=this.#V("detail",null);return!V||!Y(V.isOpen)||V.inline===!1?null:V}#Oe(){const V=(this.#e.config||{}).tree;return this.#x!==V&&(this.#x=V,this.#K=m(V,{dataAt:J=>this.#ae(J),keyOf:J=>this.#s.keyOf(this.#ae(J),J)})),this.#K}#me(){return(this.#e.config||{}).grandTotalRow==="bottom"}grandTotalRow(){if(!this.#me())return null;this.#D();const V=this.#m.grand;return V?this.#s.grandTotal(V,this.#et(this.#m.grandLeaves)):null}pivot(){return this.#D(),this.#fe}pivotMatrix(){this.#D();const V=this.#m.groupLeaves,J=(this.#e.compute||{}).pivotMatrix;if(!Y(J))return null;const ee=this.#V("groupBy",[]),te=this.#V("pivotBy",[]);if(!ee.length&&!te.length)return B("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 ie=this.#Ze().map(ue=>({colId:ue.id,handle:this.#o.handle(ue.id),fn:R(ue,"group")})).filter(ue=>ue.handle&&ue.fn),oe=this.#e.config||{};return J({rowHandles:ee.map(ue=>this.#o.handle(ue)).filter(Boolean),columnHandles:te.map(ue=>this.#o.handle(ue)).filter(Boolean),measures:ie,leaves:V||new Uint32Array(0),opts:{locale:oe.locale,separator:(oe.pivot||{}).separator,maxColumns:(oe.pivot||{}).maxColumns}})}keysForLeaves(V){const J=[];if(!V)return J;for(let ee=0;ee<V.length;ee++){const te=this.#Ae(V[ee]);te&&te.key!=null&&J.push(String(te.key))}return J}leavesOf(V){this.#D();const J=this.#l.get("group"),ee=J&&J.result;if(!ee||!ee.nodes)return[];const te=ee.nodes.get(V);if(!te)return[];const ie=[],oe=ue=>{const ye=ue.row&&ue.row.children;if(ye&&ye.length){for(const he of ye){const Re=ee.nodes.get(he.key);Re&&oe(Re)}return}if(ue.leaves)for(let he=0;he<ue.leaves.length;he++)ie.push(this.#Ae(ue.leaves[he]))};return oe(te),ie}#ye(V){return typeof V=="string"?V:this.#Pe(V)}#Pe(V){try{return this.#s.keyOf(V,-1)}catch{return"(unkeyed)"}}#de(V){if(typeof V=="string")return this.#ie(V);if(this.#s.keyed){const ee=this.#s.keyOf(V,-1),te=this.#ie(ee);if(te!==void 0)return te}if(this.#r)return;const J=this.#n.indexOf(V);return J>=0?J:void 0}#ie(V){return this.#p||this.#Ce(),this.#p.get(V)}#Ce(){this.#p=new Map;const V=this.#Me(),J=this.#e.store,ee=J&&Y(J.live)?te=>J.live(te):null;for(let te=0;te<V;te++){if(ee&&!ee(te))continue;const ie=this.#ae(te);ie!==void 0&&this.#p.set(this.#s.keyOf(ie,te),te)}}#te(V,J){const ee=[];for(const te of this.#W())this.#Ue(te)&&this.#J(te,V,J,new Set)&&ee.push(te);return ee}#J(V,J,ee,te){if(te.has(V))return!1;te.add(V);const ie=this.#Ue(V);if(!ie)return!1;const oe=ie.value&&ie.value.deps;return Array.isArray(oe)&&oe.length?oe.some(ue=>this.#J(String(ue),J,ee,te)):Y(ie.getValue)?!Object.is(ie.getValue(J),ie.getValue(ee)):!1}#W(){const V=new Set;for(const ee of this.#V("sort",[]))V.add(ee.col);for(const ee of this.#V("groupBy",[]))V.add(ee);const J=ee=>{if(ee){if(Array.isArray(ee.conditions)){ee.conditions.forEach(J);return}ee.col&&V.add(ee.col)}};return J(this.#V("filters",null)),[...V]}#X(V){if(!V.size)return!1;if(this.#V("quick",""))return!0;for(const J of this.#W())if(V.has(J))return!0;return!1}#D(){if(!this.#a){this.#a=!0;try{this.#Ne()}finally{this.#a=!1}}}pipelineRunning(){return this.#a}#Ne(){const V=this.#B("filter",()=>this.#_(),()=>this.#Re()),J=this.#q(V),ee=this.#B("group",()=>this.#ge(),()=>this.#Ye(J)),te=this.#B("total",()=>this.#we(),()=>this.#_e(ee));this.#B("pivot",()=>this.#k(),()=>this.#At(ee)),this.#B("flatten",()=>this.#Se(),()=>this.#Ke(ee)),this.#Be(ee,te)}#q(V){const J=this.#l.get("sort"),ee=this.#se();if(J.computed&&J.key===ee&&!this.#b.has("sort"))return J.result;const te=this.#b.get("sort");return te&&te.key===ee?J.result:J.result&&this.#Ee(V)?(this.#Te(V,ee),J.result):this.#B("sort",()=>ee,()=>this.#Ie(V))}#re(){if(this.#y===null){const V=this.#e.pipelineWorker,J=Y(V)?V():null;this.#y=J||!1}return this.#y||null}#ve(){const V=this.#V("sort",[]);if(!Array.isArray(V)||!V.length)return null;const J=(this.#e.config||{}).locale,ee=[],te=[];for(const ie of V){const oe=this.#Ue(ie.col);if(oe&&oe.running)continue;if(oe&&oe.value&&Y(oe.value.compare))return null;const ue=this.#o.handle(ie.col);if(!ue)return null;ee.push({col:ie.col,descending:ie.dir==="desc",nullsFirst:!!ie.nullsFirst,locale:J}),te.push(ue)}return ee.length?{entries:ee,handles:te,locale:J}:null}#Ee(V){if(this.#ce())return!1;const J=this.#re();if(!J)return!1;const ee=Number(J.threshold);return Number.isFinite(ee)&&V.length<ee?!1:!!this.#ve()}#Te(V,J){const ee=this.#re(),te=ee&&this.#ve();if(!te){this.#B("sort",()=>J,()=>this.#Ie(V));return}const ie=new AbortController;this.#b.set("sort",{key:J,controller:ie});const oe=te.entries.length===1?ee.sortColumn(te.handles[0],V,{descending:te.entries[0].descending,nullsFirst:te.entries[0].nullsFirst,locale:te.locale,signal:ie.signal,key:"sort"}):ee.sortMulti(te.handles,te.entries.map((ue,ye)=>({...ue,handle:te.handles[ye]})),V,{signal:ie.signal,key:"sort"});if(!F(oe)){this.#b.delete("sort"),this.#B("sort",()=>J,()=>oe);return}oe.then(ue=>this.#le(J,ue),ue=>this.#he("sort",J,ue))}#le(V,J){const ee=this.#b.get("sort");if(!(!ee||ee.key!==V)){if(this.#se()!==V){this.#b.delete("sort");return}this.#b.delete("sort"),this.#B("sort",()=>V,()=>J),this.#Y=null,this.#D(),this.#Qe("model:changed",{reason:T[0]})}}#he(V,J,ee){const te=this.#b.get(V);if(!(!te||te.key!==J)&&(this.#b.delete(V),!(ee&&ee.name==="AbortError")&&V==="sort"&&this.#se()===J)){const ie=this.#B("filter",()=>this.#_(),()=>this.#Re());this.#B("sort",()=>J,()=>this.#Ie(ie)),this.#Y=null,this.#D(),B("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",ee),this.#Qe("model:changed",{reason:T[1]})}}#Be(V,J){const ee=V&&V.leaves?V.leaves.length:this.#m.slots.length;this.#m.matchCount=ee,this.#m.grand=J&&J.grand||null,this.#m.grandLeaves=V&&V.leaves?V.leaves.length:0,this.#m.groupLeaves=V&&V.leaves?V.leaves:null}#B(V,J,ee){const te=this.#l.get(V),ie=J();return te.computed&&te.key===ie||(te.result=ee(),te.key=ie,te.computed=!0,te.id++,V==="flatten"&&(this.#Y=null)),te.result}#C(V){return this.#l.get(V).id}#_(){const V=(this.#e.config||{}).hostFilter,J=V&&Y(V.active)&&V.active()?1:0,ee=this.#V("where",null),te=ee?ee.version:0,ie=this.#gt("filter.sig",`${this.#ut()}`,()=>w({filters:this.#V("filters",null),quick:this.#V("quick",""),quickMode:this.#V("quickMode","contains")}));return`${this.#u}|${ie}|${J}|${te}`}#se(){const V=this.#ce();return`${this.#C("filter")}|${JSON.stringify(this.#V("sort",[]))}`+(V?`|manual:${V.version}`:"")}#ce(){const V=this.#V("rowOrder",null);return V&&Array.isArray(V.keys)?V:null}#oe(V,J){this.#p||this.#Ce();const ee=this.#p,te=this.#Me(),ie=J.keys.length,oe=new Float64Array(te);for(let ue=0;ue<te;ue++)oe[ue]=ie+ue;for(let ue=0;ue<ie;ue++){const ye=ee.get(J.keys[ue]);ye!==void 0&&(oe[ye]=ue)}return Uint32Array.from(V).sort((ue,ye)=>oe[ue]-oe[ye])}orderedKeys(){this.#p||this.#Ce();const V=this.#p,J=new Map;for(const[ue,ye]of V)J.set(ye,ue);const ee=Uint32Array.from([...J.keys()]).sort(),te=this.#ce(),ie=te?this.#oe(ee,te):this.#Ie(ee),oe=new Array(ie.length);for(let ue=0;ue<ie.length;ue++)oe[ue]=J.get(ie[ue]);return oe}#ge(){const V=this.#V("pivotBy",[]).length>0?"p":"u";return`${this.#C("sort")}|${JSON.stringify(this.#V("groupBy",[]))}|${V}`}#we(){const V=this.#Xe()?"f":"a",J=(this.#e.config||{}).totalOnlyChangedColumns?"n":"w";return`${this.#C("group")}|${JSON.stringify(this.#V("totals",[]))}|${V}${J}|${this.#c}`}#k(){return`${this.#C("group")}|${JSON.stringify(this.#V("pivotBy",[]))}`}#Se(){const J=this.#ze()||!this.#me()?this.#C("total"):"x",ee=`${this.#ut()}`,te=this.#gt("flatten.keys",ee,()=>{const oe=this.#V("expanded",null);return oe?[...oe].sort().join(""):"*"}),ie=this.#gt("flatten.detail",ee,()=>{const oe=this.#V("detail",null);return oe&&Y(oe.signature)?oe.signature():""});return`${J}|${this.#C("pivot")}|${te}|${ie}`}#ze(){const V=this.#V("groupBy",[]);return Array.isArray(V)&&V.length>0}stageState(){const V=[];for(const[J,ee]of this.#l){const te=ee.result;V.push({stage:J,materialised:!!ee.computed,bytes:te&&typeof te.byteLength=="number"?te.byteLength:null,rows:te&&typeof te.length=="number"?te.length:null,rebuilds:ee.id})}return V}facetIndices(V){return this.#Re(V||null)}facetRows(V){const J=this.facetIndices(V),ee=[];for(let te=0;te<J.length;te++){const ie=this.#Ae(J[te]);ie&&ee.push(ie)}return ee}invalidateRows(){this.#h.clear(),this.#I.clear(),this.#Y=null}invalidateHandles(){this.#o.invalidate()}rows(){return this.#n}unfilteredIndices(){return this.#ue()}filteredIndices(){const V=this.#l.get("filter");if(V&&V.computed&&V.key===this.#_())return V.result||this.#ue();this.#D();const J=this.#l.get("filter");return(J&&J.computed?J.result:null)||this.#ue()}unfilteredRows(){const V=this.#ue(),J=[];for(let ee=0;ee<V.length;ee++){const te=this.#Ae(V[ee]);te&&J.push(te)}return J}#Re(V=null){const J=this.#ue(),ee=this.#V("filters",null),te=V?this.#it("pruneColumn")(ee,V):ee,ie=this.#st(te),oe=String(this.#V("quick","")||"").trim().toLowerCase(),ue=oe?D(oe,String(this.#V("quickMode","contains")||"contains")):null,ye=(this.#e.config||{}).hostFilter,he=!!(ye&&Y(ye.active)&&ye.active()),Re=this.#V("where",null),Ce=!!(Re&&Re.active);if(!ie&&!oe&&!he&&!Ce)return J;let we=null;ie&&(we=this.#it("evaluateFilters")(ie,{handle:Oe=>this.#o.handle(Oe),count:this.#Me(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:Oe=>L(this.#Ue(Oe))}));const re=new Uint32Array(J.length);let de=0;for(let me=0;me<J.length;me++){const Oe=J[me];if(!(we&&!we[Oe])&&!(ue&&!this.#ct(Oe,ue))){if(he||Ce){const ke=this.#Ae(Oe);if(he&&!ye.passes(ke)||Ce&&!Re.passes(ke.data,ke.key))continue}re[de++]=Oe}}if(we){const me=(this.#e.compute||{}).releaseMask;Y(me)&&me({pool:this.#e.pool},we)}return re.subarray(0,de)}handleFor(V){return this.#o.handle(V)}#Ie(V){const J=this.#ce();if(J)return this.#oe(V,J);const ee=this.#V("sort",[]).filter(oe=>{const ue=this.#Ue(oe.col);return!ue||!ue.running?!0:(B(`source.sort.running.${oe.col}`,`sort ignores "${oe.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 V;const te=(this.#e.config||{}).locale;if(ee.length===1){const oe=ee[0],ue=this.#o.handle(oe.col);if(!ue)return B(`source.sort.${oe.col}`,`sort ignores unknown column "${oe.col}".`),V;const ye=this.#Ue(oe.col);return this.#it("sortColumn")(ue,V,{descending:oe.dir==="desc",nullsFirst:oe.nullsFirst,locale:te,compare:j(ye)})}const ie=[];for(const oe of ee){const ue=this.#o.handle(oe.col);if(!ue){B(`source.sort.${oe.col}`,`sort ignores unknown column "${oe.col}".`);continue}ie.push({handle:ue,descending:oe.dir==="desc",nullsFirst:oe.nullsFirst,locale:te,compare:j(this.#Ue(oe.col))})}return ie.length?this.#it("sortMulti")(ie.map(oe=>oe.handle),ie,V):V}#Ye(V){const J=this.#V("groupBy",[]),ee=this.#Oe();if(ee&&!J.length){const me=p(V,ee);return this.#$=v(me.roots,ee.declaresChildren),{roots:null,leaves:V,nodes:new Map,tree:me}}if(this.#$=null,ee&&J.length&&B("tree.grouped","grouping is active on a grid configured with `tree`; the grouping wins and the hierarchy is not shown."),!J.length)return{roots:null,leaves:V,nodes:new Map};const te=(this.#e.config||{}).timeZone,ie=[],oe=[];let ue=!1;for(const me of J){const Oe=this.#o.handle(me);if(!Oe){B(`source.group.${me}`,`grouping ignores unknown column "${me}".`);continue}ie.push(Oe);const ke=this.#Ue(me),Le=ke&&ke.dataType;if(Le&&Y(Le.groupProjector)){const ce=ke.typeOptions&&ke.typeOptions.timeZone||te||void 0,ge=Le.groupProjector(ke,ce);oe.push(ge||null),ge&&(ue=!0)}else oe.push(null)}if(!ie.length)return{roots:null,leaves:V,nodes:new Map};const{keys:ye,buckets:he}=this.#it("groupByColumns")(ie,V,{locale:(this.#e.config||{}).locale,project:ue?oe:void 0}),Re=this.#V("pivotBy",[]).length>0,Ce=[],we=new Map;for(let me=0;me<he.length;me++){const Oe=ye[me];let ke=null;const Le=[];for(let ce=0;ce<Oe.length;ce++){Le.push(h(Oe[ce]));const ge=u(Le),Se=ce===Oe.length-1;let Fe=we.get(ge);if(!Fe){const be=this.#s.group({path:[...Le],column:J[ce],value:Oe[ce],level:ce,parent:ke,expanded:Re&&Se?!1:this.#pt(ge,{key:ge,column:J[ce],value:Oe[ce],level:ce,path:[...Le]}),hasChildren:!(Re&&Se)});Fe={row:be,leaves:null},we.set(ge,Fe),ke?ke.children.push(be):Ce.push(be)}Fe.row.leafCount+=he[me].length,ce===Oe.length-1&&(Fe.leaves=he[me]),ke=Fe.row}}const re=this.#V("sort",[])||[],de=(me,Oe)=>{if(!me||me.length<2){if(me)for(const ge of me)de(ge.children,Oe+1);return}const ke=J[Oe],Le=re.find(ge=>ge.col===ke),ce=Le&&Le.dir==="desc"?-1:1;me.sort((ge,Se)=>ce*W(ge.groupValue,Se.groupValue));for(const ge of me)de(ge.children,Oe+1)};return de(Ce,0),{roots:Ce,leaves:V,nodes:we,keys:ye,buckets:he}}#Ve(V,J){const ee=new Map,te=new Map,ie=oe=>{const ue=oe.physical>=0?[oe.physical]:[];for(const ye of oe.children)ue.push(...ie(ye));if(oe.children.length){const ye=this.#rt(J,Uint32Array.from(ue),null);oe.physical>=0?ee.set(oe.physical,ye):te.set(oe.key,ye)}return ue};for(const oe of V.roots)ie(oe);return{byPhysical:ee,byKey:te}}#_e(V){const J=this.#Ze();if(!J.length)return this.#N=null,this.#P=null,{grand:null};const ee={id:this.#C("group"),columns:J.map(re=>re.id).join("")},te=this.#N&&this.#N.id===ee.id&&this.#N.columns===ee.columns,ie=this.#Ge()&&te?this.#E:null,oe=ie?J.filter(re=>ie.has(re.id)):J,ue=te?this.#P:null,ye=this.#Xe()?null:this.#tt(),he=this.#be(J),Re=re=>{const de=V.nodes.get(re.key);let me=de&&de.leaves?de.leaves:null;if(re.children&&re.children.length){const Le=re.children.map(Re);let ce=0;for(const Fe of Le)ce+=Fe.length;const ge=new Uint32Array(ce);let Se=0;for(const Fe of Le)ge.set(Fe,Se),Se+=Fe.length;me=ge}me=me||new Uint32Array(0);const Oe=ye?ye.get(re.key)||N:me,ke=this.#at(re,ie?oe:J,Oe,he);return re.totals=ie?{...re.totals,...ke}:ke,me};if(V.roots&&oe.length)for(const re of V.roots)Re(re);if(this.#U=V.tree?this.#Ve(V.tree,J):null,this.#N=ee,this.#E=this.#Ge()?new Set:null,!(this.#e.config||{}).grandTotalRow)return this.#O.length=0,this.#P=null,{grand:null};const we=ye?this.#qe():V.leaves;return this.#P=this.#We(J,we,ie,ue),{grand:this.#P}}#We(V,J,ee,te){const ie={},oe=this.#C("group");oe!==this.#w&&(this.#St(),this.#w=oe);const ue=this.#O;this.#O=[];for(const ye of V){if(!I(ye))continue;const he=this.#o.handle(ye.id);if(!he)continue;const Re=R(ye,"grand");if(!c(Re,he)){if(ee&&!ee.has(ye.id)&&te&&ye.id in te){ie[ye.id]=te[ye.id];continue}ie[ye.id]=this.#rt([ye],J,null,"grand")[ye.id];continue}let Ce=this.#A.get(ye.id);if((!Ce||Ce.fn!==Re)&&(Ce=new t(Re),this.#A.set(ye.id,Ce)),Ce.valid){let we=!0;for(const re of ue)if(re.colId===ye.id&&!Ce.update(re.before,re.after)){we=!1;break}if(we){ie[ye.id]=Ce.value();continue}Ce.invalidate()}Ce.seedColumn(he.values,a(he),J),ie[ye.id]=Ce.valid?Ce.value():this.#rt([ye],J,null,"grand")[ye.id]}return ie}#be(V){const J=this.#C("group");J!==this.#T&&(this.#v.clear(),this.#T=J);const ee=new Map;for(const ie of V){if(!I(ie))continue;const oe=this.#o.handle(ie.id),ue=R(ie,"group");c(ue,oe)&&ee.set(ie.id,{fn:ue})}if(!ee.size)return this.#S.length=0,ee;const te=this.#S;this.#S=[];for(const ie of te){const{beforeKeys:oe,afterKeys:ue,colDeltas:ye}=ie,he=oe.length?new Set(oe):null,Re=ue.length?new Set(ue):null;for(const{colId:Ce,before:we,after:re}of ye)if(ee.has(Ce)){for(const de of oe)Re&&Re.has(de)||this.#ke(de,Ce,we,null);for(const de of ue)he&&he.has(de)||this.#ke(de,Ce,null,re);for(const de of oe)Re&&!Re.has(de)||this.#ke(de,Ce,we,re)}}return ee}#ke(V,J,ee,te){const ie=this.#v.get(V),oe=ie&&ie.get(J);!oe||!oe.valid||oe.update(ee,te)||oe.invalidate()}#at(V,J,ee,te){if(!te||!te.size)return this.#rt(J,ee,V);const ie={};let oe=null,ue=this.#v.get(V.key);for(const ye of J){const he=te.get(ye.id);if(!he){(oe||(oe=[])).push(ye);continue}const Re=this.#o.handle(ye.id);if(!Re)continue;ue||(ue=new Map,this.#v.set(V.key,ue));let Ce=ue.get(ye.id);if((!Ce||Ce.fn!==he.fn)&&(Ce=new t(he.fn),ue.set(ye.id,Ce)),Ce.valid||Ce.seedColumn(Re.values,a(Re),ee),Ce.valid){ie[ye.id]=Ce.value();continue}(oe||(oe=[])).push(ye)}return oe&&Object.assign(ie,this.#rt(oe,ee,V)),ie}#Tt(V,J,ee,te){const ie=!this.#Xe()||this.#Ot(J);for(const oe of V){const ue=oe.getValue;if(!Y(ue))continue;const ye=ue(ee),he=ue(te);Object.is(ye,he)||(this.#E&&this.#E.add(oe.id),ie&&this.#A.has(oe.id)&&this.#O.push({colId:oe.id,before:ye,after:he}))}}#kt(){const V=this.#V("groupBy",[]),J=[];for(const ee of V){const te=this.#Ue(ee);te&&J.push(te)}return J}#ee(V,J){const ee=new Array(V.length);for(let te=0;te<V.length;te++){const ie=V[te].getValue;ee[te]=h(Y(ie)?ie(J):void 0)}return ee}#lt(V,J,ee,te,ie){if(this.#Xe()&&!this.#Ot(ee))return;const oe=l(this.#ee(V,te)),ue=l(this.#ee(V,ie)),ye=oe.length!==ue.length||oe.some((Re,Ce)=>Re!==ue[Ce]),he=[];for(const Re of J){const Ce=Re.getValue;if(!Y(Ce))continue;const we=Ce(te),re=Ce(ie);!ye&&Object.is(we,re)||he.push({colId:Re.id,before:we,after:re})}!he.length&&!ye||this.#S.push({beforeKeys:oe,afterKeys:ue,colDeltas:he})}#Ot(V){const J=this.#l.get("filter"),ee=J&&J.computed?J.result:null;if(!ee)return!0;let te=0,ie=ee.length-1;for(;te<=ie;){const oe=te+ie>>1,ue=ee[oe];if(ue===V)return!0;ue<V?te=oe+1:ie=oe-1}return!1}#Xe(){return(this.#e.config||{}).totalFilteredOnly!==!1}#et(V){return this.#Xe()?V:this.#qe().length}#qe(){return(!this.#M||this.#M.version!==this.#u)&&(this.#M={version:this.#u,indices:this.#ue()}),this.#M.indices}#tt(){const V=this.#V("groupBy",[]),J=`${this.#u}|${JSON.stringify(V)}`;if(this.#R&&this.#R.key===J)return this.#R.map;const ee=new Map,te=[];for(const ie of V){const oe=this.#o.handle(ie);oe&&te.push(oe)}if(te.length){const ie=this.#qe(),{keys:oe,buckets:ue}=this.#it("groupByColumns")(te,ie,{locale:(this.#e.config||{}).locale}),ye=new Map;for(let he=0;he<ue.length;he++){const Re=oe[he],Ce=[];for(let we=0;we<Re.length;we++){Ce.push(h(Re[we]));const re=u(Ce);let de=ye.get(re);de||(de=[],ye.set(re,de));for(let me=0;me<ue[he].length;me++)de.push(ue[he][me])}}for(const[he,Re]of ye)ee.set(he,Uint32Array.from(Re))}return this.#R={key:J,map:ee},ee}#Ge(){return!!(this.#e.config||{}).totalOnlyChangedColumns}#nt(){this.#St(),this.#j(),this.#E=null,this.#N=null,this.#P=null}#St(){this.#A.clear(),this.#O.length=0,this.#w=-1}#j(){this.#v.clear(),this.#S.length=0,this.#T=-1}#At(V){const J=this.#V("pivotBy",[]);if(!J.length)return this.#fe=null,null;const ee=(this.#e.compute||{}).pivot;if(!Y(ee))return B("source.pivot.kernel","pivot requested but ctx.compute.pivot is not available; showing unpivoted rows."),this.#fe=null,null;const te=J.map(oe=>this.#o.handle(oe)).filter(Boolean),ie=this.#Ze();return this.#fe=ee(te,V.leaves,{groups:V.keys&&V.buckets?{keys:V.keys,buckets:V.buckets}:null,totals:ie.map(oe=>oe.id),handle:oe=>this.#o.handle(oe),totalOf:oe=>R(ie.find(ue=>ue.id===oe),"group"),separator:((this.#e.config||{}).pivot||{}).separator,maxColumns:((this.#e.config||{}).pivot||{}).maxColumns})||null,this.#fe}#Ke(V){const J=this.#l.get("total").result,ee=!!(this.#e.config||{}).groupFooter,te=this.#Fe();if(V.tree)return this.#jt(V,J,te);if(!V.roots&&!te){if(J&&J.grand&&!this.#me()){const Re=this.#s.grandTotal(J.grand,this.#et(V.leaves.length));if(this.#G===V.leaves&&Array.isArray(this.#F))this.#F[this.#F.length-1]=Re;else{const Ce=Array.from(V.leaves);Ce.push(Re),this.#F=Ce,this.#G=V.leaves}this.#z=[{at:this.#F.length-1}]}else this.#G=null,this.#F=V.leaves,this.#z=_;return this.#H=_,this.#F}const ie=[],oe=[],ue=[],ye=Re=>{if(ie.push(Re),!te)return;const Ce=this.#Ae(Re);!Ce||!te.isOpen(Ce.key)||(Ce.master=!0,Ce.expanded=!0,ue.push({at:ie.length}),ie.push(this.#s.detail(Ce,te.heightOf(Ce))))};if(!V.roots){for(let Re=0;Re<V.leaves.length;Re++)ye(V.leaves[Re]);return J&&J.grand&&!this.#me()&&(ue.push({at:ie.length}),ie.push(this.#s.grandTotal(J.grand,this.#et(V.leaves.length)))),this.#G=null,this.#H=_,this.#z=ue.length?ue:_,this.#F=ie,ie}const he=(Re,Ce,we)=>{if(Re.expanded=Re.hasChildren===!1?!1:this.#pt(Re.key,{key:Re.key,column:Re.groupColumn,value:Re.groupValue,level:Re.level,path:Re.groupPath}),Re.posinset=Ce+1,Re.setsize=we,oe.push({at:ie.length,row:Re}),ue.push({at:ie.length}),ie.push(Re),!!Re.expanded){if(Re.children&&Re.children.length)for(let re=0;re<Re.children.length;re++)he(Re.children[re],re,Re.children.length);else{const re=V.nodes.get(Re.key),de=re&&re.leaves?re.leaves:null;if(de)for(let me=0;me<de.length;me++)ye(de[me])}ee&&Re.totals&&(ue.push({at:ie.length}),ie.push(this.#s.footer(Re)))}};for(let Re=0;Re<V.roots.length;Re++)he(V.roots[Re],Re,V.roots.length);return J&&J.grand&&!this.#me()&&(ue.push({at:ie.length}),ie.push(this.#s.grandTotal(J.grand,this.#et(V.leaves.length)))),this.#H=oe,this.#z=ue,this.#F=ie,ie}#ue(){const V=this.#e.store;if(V&&Y(V.liveIndices))return V.liveIndices();const J=new Uint32Array(this.#n.length);let ee=0;for(let te=0;te<this.#n.length;te++)this.#n[te]!==void 0&&(J[ee++]=te);return J.subarray(0,ee)}#Me(){const V=this.#e.store;return V&&typeof V.physical=="number"?V.physical:this.#n.length}#ae(V){const J=this.#e.store;return J&&Y(J.source)?J.source(V):this.#n[V]}#$e(V,J=V){const ee=this.#F[V];if(typeof ee!="number")return ee.index=J,ee;const te=this.#Ae(ee);return te.index=J,te}#Ae(V){let J=this.#h.get(V);J||(J=this.#s.leaf(this.#ae(V),V),this.#h.set(V,J));const ee=this.#$?this.#$.get(V):null;if(ee){J.level=ee.level,J.posinset=ee.posinset,J.setsize=ee.setsize,J.hasChildren=ee.hasChildren,J.expanded=ee.hasChildren&&!ee.lazy&&this.#pt(J.key);const te=this.#U?this.#U.byPhysical.get(V):void 0;te?J.totals=te:J.totals&&(J.totals=null)}else J.hasChildren&&(J.level=0,J.hasChildren=!1,J.expanded=!1,J.posinset=void 0,J.setsize=void 0);return J}#jt(V,J,ee){const te=[],ie=[],oe=ye=>{if(ye.leafCount!==void 0)return ye.leafCount;let he=ye.physical>=0?1:0;for(const Re of ye.children)he+=oe(Re);return ye.leafCount=he,he},ue=ye=>{const he=this.#pt(ye.key);if(ye.physical>=0){if(te.push(ye.physical),ee&&ee.isOpen(this.#Ae(ye.physical).key)){const Re=this.#Ae(ye.physical);ie.push({at:te.length}),te.push(this.#s.detail(Re,ee.heightOf(Re)))}}else te.push(this.#s.group({path:[ye.key],column:null,value:ye.value,level:ye.level,parent:null,expanded:he,hasChildren:ye.children.length>0,leafCount:oe(ye),totals:this.#U?this.#U.byKey.get(ye.key):void 0}));if(he)for(const Re of ye.children)ue(Re)};for(const ye of V.tree.roots)ue(ye);return J&&J.grand&&!this.#me()&&(ie.push({at:te.length}),te.push(this.#s.grandTotal(J.grand,this.#et(V.leaves.length)))),this.#G=null,this.#H=_,this.#z=ie.length?ie:_,this.#F=te,te}#Mt(){return r(()=>this.count(),V=>this.at(V))}#ct(V,J){let ee=this.#I.get(V);if(ee===void 0){const te=this.#ae(V),ie=this.#ot(),oe=[],ue=this.#e.columnHidden;for(const ye of ie){if(ye.quickFilter===!1||Y(ue)&&ue(ye.id))continue;const he=ye.value&&Y(ye.value.quickFilterText)?ye.value.quickFilterText({value:void 0,data:te,row:null,column:ye,colId:ye.id,grid:null,context:this.#V("context",null)}):null,Re=he??(Y(ye.formatValue)?ye.formatValue(Y(ye.getValue)?ye.getValue(te):void 0):"");Re!=null&&Re!==""&&oe.push(String(Re))}ee=oe.join(" ").toLowerCase(),this.#I.set(V,ee)}return J(ee)}#Ze(){const V=this.#V("totals",[]),J=V&&V.length?new Set(V):null;return this.#ot().filter(ee=>J?J.has(ee.id):!!(ee.total||ee.groupTotal||ee.grandTotal))}#rt(V,J,ee,te="group"){const ie={},oe=(this.#e.compute||{}).total;for(const ue of V){if(!I(ue))continue;const ye=this.#o.handle(ue.id);if(!ye)continue;const he=R(ue,te);if(he)if(Y(he)){const Re=new Array(J.length);for(let Ce=0;Ce<J.length;Ce++)Re[Ce]=ye.get(J[Ce]);ie[ue.id]=he(Re,{row:ee,column:ue,grid:this.#e.grid||null,context:this.#V("context",null),valueAt:(Ce,we)=>{const re=this.#o.handle(Ce);return re&&we>=0&&we<J.length?re.get(J[we]):null}})}else Y(oe)&&(ie[ue.id]=oe(ye,J,he))}return ie}#st(V){if(!V)return V;const J=this.#e.config||{},ee={tz:J.timeZone,weekStartsOn:J.weekStartsOn};return g(V,te=>{const ie=k(te,ee),oe=this.#Ue(ie&&ie.col),ue=oe&&oe.type==="datetime";if(ie&&ie.type)return ie.type==="datetime"&&!ie.timeZone&&oe?{...ie,timeZone:J.timeZone||void 0}:ie;if(ue)return{...ie,type:"datetime",timeZone:J.timeZone||void 0};const ye=oe&&(oe.dataType?.base||oe.type);return ye?{...ie,type:ye}:ie})}#pt(V,J){const ee=this.#V("expanded",null);return ee?Y(ee.has)?ee.has(V,J):Array.prototype.includes.call(ee,V):!0}#V(V,J){if(V==="context"||!Y(this.#e.stateVersion))return this.#Nt(V,J);const ee=this.#mt(V),te=this.#f.get(V);if(te&&te.version===ee)return te.value;const ie=this.#Nt(V,J);return this.#f.set(V,{version:ee,value:ie}),ie}#Nt(V,J){const ee=this.#e.state;if(ee&&Y(ee[V])){const te=ee[V]();return te??J}return J}#ut(){const V=this.#e.stateVersion;return Y(V)?V():0}#xt(){const V=this.#e.columnsVersion,J=this.#e.permissionsVersion;return`${Y(V)?V():0}|${Y(J)?J():0}`}#mt(V){return V==="totals"?this.#xt():`${this.#ut()}`}#gt(V,J,ee){if(!Y(this.#e.stateVersion))return ee();const te=this.#d.get(V);if(te&&te.version===J)return te.key;const ie=ee();return this.#d.set(V,{version:J,key:ie}),ie}#it(V){const J=(this.#e.compute||{})[V];return Y(J)||x(`ctx.compute.${V} is required by the memory source pipeline`),J}#ot(){const V=this.#e.columns;return V&&Y(V.all)?V.all():[]}#Ue(V){const J=this.#e.columns;return J&&Y(J.get)?J.get(V):void 0}#Qe(V,J){const ee=this.#e.emit;Y(ee)&&ee(V,J)}}}),Ue("packages/core/src/source/abort.js",function(e,H){"use strict";Object.defineProperty(e,"SupersededError",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"RequestToken",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"AbortScope",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createAbortScope",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return x}});class ne extends Error{constructor(Y,U="superseded"){super(`[lattice] request ${Y?`"${Y}" `:""}${U}`),this.name="SupersededError",this.superseded=!0,this.key=Y}}class ${#e;constructor(Y,U,W,K){this.#e=Y,this.key=U,this.controller=W,this.signal=W.signal,this.seq=K}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(Y){this.signal.aborted||this.controller.abort(new ne(this.key,Y)),this.#e.settle(this)}}class q{#e=new Map;#t=0;begin(Y="",U="superseded"){const W=this.#e.get(Y);W&&!W.signal.aborted&&W.controller.abort(new ne(Y,U));const K=new $(this,Y,new AbortController,++this.#t);return this.#e.set(Y,K),K}tokenFor(Y){return this.#e.get(Y)}pending(Y=""){const U=this.#e.get(Y);return!!U&&!U.signal.aborted}get size(){return this.#e.size}settle(Y){this.#e.get(Y.key)===Y&&this.#e.delete(Y.key)}abort(Y="",U="superseded"){const W=this.#e.get(Y);W&&W.abort(U)}abortAll(Y="superseded"){for(const U of[...this.#e.values()])U.abort(Y);this.#e.clear()}}function B(){return new q}function x(Z){if(!Z||typeof Z!="object")return!1;const Y=Z;return Y.superseded===!0||Y.name==="AbortError"||Y.name==="SupersededError"}}),Ue("packages/core/src/source/blockcache.js",function(e,H){"use strict";Object.defineProperty(e,"DEFAULT_PAGE_SIZE",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"DEFAULT_MAX_CACHED_PAGES",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"BlockCache",{enumerable:!0,get:function(){return B}});const ne=100,$=32;class q{constructor(Z){this.id=Z,this.rows=null,this.state="pending",this.token=null,this.error=null}}class B{#e=new Map;#t;#n;#r=0;#i=-1;constructor(Z={}){this.#t=Math.max(1,Math.floor(Number(Z.pageSize)||ne)),this.#n=Math.max(1,Math.floor(Number(Z.maxCachedPages)||$))}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 Y=this.#e.get(Z);return!!Y&&Y.state==="pending"}loaded(Z){const Y=this.#e.get(Z);return!!Y&&Y.state==="loaded"}begin(Z,Y){let U=this.#e.get(Z);return U||(U=new q(Z)),U.state="pending",U.token=Y,U.error=null,this.#s(Z,U),U}fill(Z,Y){const U=this.#e.get(Z)||new q(Z);U.rows=Y,U.state="loaded",U.token=null,this.#s(Z,U)}failed(Z,Y){const U=this.#e.get(Z)||new q(Z);U.state="error",U.error=Y,U.token=null,this.#s(Z,U)}delete(Z){return this.#e.delete(Z)}rowAt(Z){const Y=this.blockOf(Z),U=this.#e.get(Y);if(!(!U||U.state!=="loaded"||!U.rows))return this.#s(Y,U),U.rows[Z-Y*this.#t]}rowLoaded(Z){const Y=this.blockOf(Z),U=this.#e.get(Y);return!!U&&U.state==="loaded"&&!!U.rows&&Z-Y*this.#t<U.rows.length}erroredAt(Z){const Y=this.#e.get(this.blockOf(Z));return!!Y&&Y.state==="error"}loadedExtent(){let Z=0;for(const Y of this.#e.values()){if(Y.state!=="loaded"||!Y.rows)continue;const U=Y.id*this.#t+Y.rows.length;U>Z&&(Z=U)}return Z}fillOf(Z){const Y=this.#e.get(Z);return Y&&Y.state==="loaded"&&Y.rows?Y.rows.length:null}protect(Z,Y){this.#r=this.blockOf(Math.max(0,Z)),this.#i=this.blockOf(Math.max(0,Y))}evict(){const Z=[];if(this.#e.size<=this.#n)return Z;for(const[Y,U]of this.#e){if(this.#e.size-Z.length<=this.#n)break;Y>=this.#r&&Y<=this.#i||U.state!=="pending"&&Z.push(Y)}for(const Y of Z)this.#e.delete(Y);return Z}ids(){return[...this.#e.keys()]}clear(){this.#e.clear()}#s(Z,Y){this.#e.delete(Z),this.#e.set(Z,Y)}}}),Ue("packages/core/src/source/pagewindow.js",function(e,H){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return ne}});function ne($,q,B,x){const Z=Math.floor(Number($)||0);if(Z<=0)return null;const Y=Math.max(0,Math.floor(Number(q)||0)),U=Math.max(0,Math.floor(Number(B)||0));if(x){const W=Math.max(1,Math.ceil(U/Z)),K=Math.min(Y,W-1),E=K*Z;return{page:K,pageSize:Z,offset:E,length:Math.max(0,Math.min(Z,U-E)),pageCount:W,total:U}}return{page:Y,pageSize:Z,offset:Y*Z,length:Z,pageCount:Math.max(Y+2,Math.ceil(U/Z)),total:null}}}),Ue("packages/core/src/source/paged.js",function(e,H){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"PagedSource",{enumerable:!0,get:function(){return w}});const $=H("packages/core/src/internal/lru.js").Lru,B=H("packages/core/src/internal/predicates.js").isFunction,Z=H("packages/core/src/internal/warn.js").warnOnce,U=H("packages/core/src/internal/schedule.js").settleDebounce,W=H("packages/core/src/source/abort.js"),K=W.createAbortScope,E=W.isAbortError,O=H("packages/core/src/source/blockcache.js"),b=O.BlockCache,u=O.DEFAULT_PAGE_SIZE,h=O.DEFAULT_MAX_CACHED_PAGES,r=H("packages/core/src/source/rows.js").createRowFactory,n=H("packages/core/src/source/filterwire.js"),o=n.wireFilters,i=n.querySignature,t=n.warnHostFilterNotApplied,s=H("packages/core/src/source/pagewindow.js").pageWindow,a=120;function f(g,k){return new w(g,k)}class w{mode="paged";#e;#t;#n;#r=K();#i;#s;#o=new Map;#l=null;#a=null;#c=!1;#u=0;#f="";#d={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(k,d){this.#e=k||{mode:"paged"},this.#t=d||{},this.#n=new b({pageSize:this.#e.pageSize||u,maxCachedPages:this.#e.maxCachedPages||h}),this.#i=r(this.#t),this.#s=new $(this.#n.pageSize*4),this.#h=U((p,m)=>this.#w(p,m),a),this.#f=this.#E(),B(this.#e.fetch)||Z("source.paged.fetch",'source.mode "paged" requires a fetch function; the grid will stay empty.'),t(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=s(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 m=d.offset+d.length-1;this.#d={start:d.offset,end:m},this.#w(d.offset,m)}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.#s.get(k);if(d&&(d.data!==null||!this.#n.rowLoaded(k)))return d;const p=this.#n.rowAt(k);if(p===void 0){const v=this.#i.skeleton(k,0,this.#n.erroredAt(k));return this.#s.set(k,v),v}const m=this.#i.leaf(p,k);return m.index=k,this.#s.set(k,m),this.#o.set(m.key,k),m}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,m=[],v=this.#n.ids().sort((y,T)=>y-T);for(const y of v){if(!this.#n.loaded(y))continue;const{start:T}=this.#n.rangeOf(y),A=this.#n.fillOf(y)||0;for(let M=T;M<T+A;M++){if(M<d||M>=p)continue;const _=this.#s.peek(M);if(_&&_.data!==null&&_.data!==void 0){m.push(_);continue}const R=this.#n.rowAt(M);if(R===void 0)continue;const I=this.#i.leaf(R,M);I.index=M,this.#s.set(M,I),this.#o.set(I.key,M),m.push(I)}}return m}hint(k,d){if(this.#p)return;const p=this.#T();let m=Math.max(0,Math.floor(k)),v=Math.max(m,Math.floor(d));const y=this.#y();if(y){if(y.length===0)return;m=y.offset,v=y.offset+y.length-1}this.#d={start:m,end:v},this.#n.protect(m,v);for(const T of this.#n.evict())this.#v(T);this.#h(m,v),p&&this.#h.flush()}#w(k,d){if(this.#p)return;this.#n.protect(k,d);const p=this.#n.blockOf(k),m=this.#n.blockOf(d);for(let v=p;v<=m&&!(this.#l!==null&&v*this.#n.pageSize>=this.#l);v++)this.#n.has(v)||this.#O(v)}apply(k){const d={added:[],updated:[],removed:[]};if(!k)return d;if(k.update)for(const p of k.update){const m=this.#i.keyOf(p,-1),v=this.#o.get(m);if(v===void 0)continue;const y=this.#i.leaf(p,v);y.index=v,this.#s.set(v,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.#d.start,this.#d.end)}destroy(){this.#p=!0,this.#h.cancel(),this.#r.abortAll("destroyed"),this.#n.clear(),this.#s.clear(),this.#o.clear()}exact(){return this.#l!==null||this.#c}pending(){return this.#r.size}async#O(k){if(!B(this.#e.fetch))return;const d=this.#r.begin(`block:${k}`);this.#n.begin(k,d);const{start:p,end:m}=this.#n.rangeOf(k),v=this.#f;try{const y=await this.#e.fetch({range:{start:p,end:m},sort:this.#P("sort",[]),filters:o(this.#P("filters",null),this.#N()),quick:this.#P("quick","")||void 0,context:this.#P("context",null),signal:d.signal});if(!d.current||v!==this.#f||this.#p)return;d.settle();const T=y&&y.rows||[];this.#n.fill(k,T);for(let M=0;M<T.length;M++)this.#s.delete(p+M);const A=y&&typeof y.total=="number"?y.total:y&&typeof y.count=="number"?y.count:null;A!==null?(this.#l=A,this.#c=!0):T.length<this.#n.pageSize?(this.#c=!0,this.#l=p+T.length):this.#u=Math.max(this.#u,p+T.length),this.#M("model:changed",{reason:"page",block:k,from:p,to:p+T.length}),this.#M("rows:changed",{companion:!0,reason:"page",block:k,from:p,to:p+T.length}),this.#l!==null&&this.#l!==this.#a&&(this.#a=this.#l,this.#M("source:total",{total:this.#l,groupPath:[]}))}catch(y){if(d.settle(),E(y))return;this.#n.failed(k,y);for(let T=p;T<m;T++)this.#s.delete(T);this.#M("model:changed",{reason:"page-error",block:k,range:{start:p,end:m}}),this.#M("source:error",{error:y,block:k,range:{start:p,end:m}})}}#v(k){const{start:d,end:p}=this.#n.rangeOf(k);for(let m=d;m<p;m++){const v=this.#s.peek(m);v&&this.#o.delete(v.key),this.#s.delete(m)}}#T(){const k=this.#E();return k===this.#f?!1:(this.#f=k,this.#S("query"),!0)}#S(k){this.#r.abortAll(k),this.#n.clear(),this.#s.clear(),this.#o.clear(),this.#l=null,this.#a=null,this.#c=!1,this.#u=0,this.#m++,this.#M("model:changed",{reason:k})}#E(){return i({filters:this.#P("filters",null),sort:this.#P("sort",[]),quick:this.#P("quick",""),context:this.#P("context",null)})}#N(){const k=this.#t.config||{};return{tz:k.timeZone,weekStartsOn:k.weekStartsOn}}#P(k,d){const p=this.#t.state;if(p&&B(p[k])){const m=p[k]();return m??d}return d}#M(k,d){const p=this.#t.emit;B(p)&&p(k,d)}}}),Ue("packages/core/src/source/aggregates.js",function(e,H){"use strict";Object.defineProperty(e,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"pushableAggregates",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"fillAggregateSql",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"routeAggregate",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"resolveAggregatePlan",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"groupKeysPushable",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"pushdownDocRows",{enumerable:!0,get:function(){return W}});const ne=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 $(){const K=new Set;for(const[E,O]of Object.entries(ne))O.pushable&&K.add(E);return K}function q(K,E,O){let b=K.split("%c").join(E);return O!==void 0&&(b=b.split("%w").join(O)),b}function B(K){const E=K||{},O=E.default==="engine"||E.default==="engine-if-identical"?E.default:"client",b={};if(E.overrides&&typeof E.overrides=="object")for(const[u,h]of Object.entries(E.overrides))(h==="engine"||h==="client")&&(b[u]=h);return{default:O,overrides:b}}function x(K,E){const O=ne[K];if(!O||!O.pushable)return"client";const b=E.overrides[K];return b==="engine"||b==="client"?b:E.default==="client"?"client":E.default==="engine-if-identical"?O.class==="identical"?"engine":"client":"engine"}function Z(K,E){const O=B(E),b=[],u=[];for(const h of K||[]){const l=ne[h.fn],r=x(h.fn,O),n={id:h.id,col:h.col,fn:h.fn,class:l?l.class:"fallback"};h.weight!==void 0&&(n.weight=h.weight),h.params!==void 0&&(n.params=h.params),r==="engine"?b.push(n):(n.reason=l&&!l.pushable?l.note||"the engine cannot express this stat":"client by config",u.push(n))}return{engine:b,client:u,config:O}}const Y=/^[A-Za-z_][A-Za-z0-9_$]*$/;function U(K,E=[]){return(K||[]).every(b=>{if(typeof b=="string")return Y.test(b);if(!b||typeof b!="object")return!1;const u=b;return Array.isArray(E)&&E.includes(u.bucket)&&typeof u.col=="string"&&Y.test(u.col)&&typeof u.size=="number"&&Number.isFinite(u.size)&&u.size>0})}function W(){return Object.entries(ne).map(([K,E])=>({stat:K,class:E.class,sql:E.sql?q(E.sql,"col",E.twoColumn?"weight":void 0):"",note:E.note||(E.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),Ue("packages/core/src/source/pushdown.js",function(e,H){"use strict";Object.defineProperty(e,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"NO_CAPABILITIES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"capabilitiesOf",{enumerable:!0,get:function(){return w}}),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 T}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"applyResidual",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"createPushdownSource",{enumerable:!0,get:function(){return X}});const $=H("packages/core/src/internal/compare.js").defaultCompare,B=H("packages/core/src/internal/predicates.js").isFunction,Z=H("packages/core/src/internal/merge.js").toArray,U=H("packages/core/src/internal/warn.js").warnOnce,W=H("packages/core/src/source/filterwire.js"),K=W.isGroup,E=W.warnWherePageRelative,O=W.warnWhereOverThreshold,b=W.wireFilters,u=H("packages/core/src/source/aggregates.js"),h=u.resolveAggregatePlan,l=u.groupKeysPushable,r=u.STAT_PUSHDOWN,o=H("packages/core/src/source/abort.js").SupersededError,i=1e3;function t(V){const J=V&&V.signal;if(!J||!J.aborted)return;const ee=J.reason;throw ee instanceof Error?ee:new o("","superseded before it was sent")}const c=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function s(V){if(!V||typeof V!="object")return!1;const J=V.returning==="row"||V.returning==="key"?V.returning:"none";return{append:V.append===!0,update:V.update===!0,delete:V.delete===!0,returning:J}}function a(V,J){if(!V||typeof J!="string")return;if(!J.includes("."))return V[J];let ee=V;for(const te of J.split(".")){if(ee===null||typeof ee!="object")return;ee=ee[te]}return ee}function f(V){if(V===!0)return!0;if(!V||typeof V!="object")return!1;const J=V;return J.enabled===!1?!1:J.enabled===!0||B(J.commit)}function w(V){const J={...c,...V||{}};return J.operators=new Set(J.operators||[]),J.mutate=s(J.mutate),J}function g(V,J){return!V||!V.op||!J.operators.size?!1:J.operators.has(V.op)}function k(V,J){if(!V)return{pushed:null,residual:null};if(!J.filter)return{pushed:null,residual:V};if(J.filter==="term"){if(K(V)){const oe=V.conditions||[];if(String(V.op)!=="and")return{pushed:null,residual:V};const ue=oe.findIndex(he=>!K(he)&&g(he,J));if(ue<0)return{pushed:null,residual:V};const ye=oe.filter((he,Re)=>Re!==ue);return{pushed:oe[ue],residual:ye.length?{op:"and",conditions:ye}:null}}return g(V,J)?{pushed:V,residual:null}:{pushed:null,residual:V}}if(!K(V))return g(V,J)?{pushed:V,residual:null}:{pushed:null,residual:V};if(String(V.op)!=="and")return(V.conditions||[]).every(ue=>K(ue)?k(ue,J).residual===null:g(ue,J))?{pushed:V,residual:null}:{pushed:null,residual:V};const ee=[],te=[];for(const oe of V.conditions||[]){if(K(oe)){if(J.filter==="flat"){te.push(oe);continue}const ue=k(oe,J);ue.pushed&&ee.push(ue.pushed),ue.residual&&te.push(ue.residual);continue}(g(oe,J)?ee:te).push(oe)}const ie=oe=>oe.length===0?null:oe.length===1?oe[0]:{op:"and",conditions:oe};return{pushed:ie(ee),residual:ie(te)}}const d="__lattice_leaves";function p(V){return V.aggregates?V.aggregates instanceof Set?V.aggregates:new Set(Z(V.aggregates)):new Set}function m(V){const J=p(V);return J.size?J.has("count")?V.filter!=="tree"||!V.operators||!V.operators.has("eq")?"the adapter does not declare the `group` capability, and cannot narrow a group's rows by its key (that needs a `tree` filter with the `eq` operator)":"":"the adapter does not declare the `group` capability, and its declared aggregates have no `count` to give each group its row count":"the adapter does not declare the `group` capability"}function v(V,J,ee,te,ie,oe,ue){const ye=Array.isArray(V.groupBy)?V.groupBy:[],he=Array.isArray(V.groupPath)?V.groupPath:[],Re=Array.isArray(V.groupValues)?V.groupValues:null;if(!J.group){const Ce=m(J);if(Ce)return Ce}return l(ye)?ee.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":te?ie?oe?"a host `where` predicate can only run in the browser, over rows the engine grouped":ue?"fullDataset holds the whole matching set, so the grid groups it itself":!Re||Re.length!==he.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",T="pushdown:group-unsupported",A=Symbol("lattice.remote.ungroupedLevel");function M(V,J,ee,te,ie,oe){const ue=Array.isArray(V.pivotBy)?V.pivotBy:[],ye=Array.isArray(V.groupBy)?V.groupBy:[],he=Array.isArray(V.groupPath)?V.groupPath:[],Re=Array.isArray(V.groupValues)?V.groupValues:null;return J.pivot?l(ue)?ye.length&&!l(ye)?"a grouping key is not a plain column the engine can name in a GROUP BY":ee.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":te?ie?oe?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!Re||Re.length!==he.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 _(V,J,ee=!1){const te=k(V.filters||null,J),ie=[];te.residual&&ie.push("filter");const oe=V.sort||[],ue=oe.length===0||J.sort==="multi"&&oe.length>=1||J.sort==="single"&&oe.length===1;!ue&&oe.length&&ie.push("sort");const ye=V.quick?String(V.quick):"",he=!ye||!!J.quick;he||ie.push("quick");const Re=V.where&&V.where.active?V.where:null;Re&&ie.push("where");const Ce={filters:te.residual,sort:ue?null:oe,quick:he?"":ye,where:Re},we=!!ee,re=Array.isArray(V.groupBy)&&V.groupBy.length>0,de=re?v(V,J,te,ue,he,Re,we):"",me=V.pivotMode!==!1&&Array.isArray(V.pivotBy)&&V.pivotBy.length>0,Oe=me?M(V,J,te,ue,he,Re):"",ke=me&&Oe==="";me&&!ke&&ie.push("pivot");const Le=me?ke&&re:re&&de==="";re&&!me&&!Le&&ie.push("group");const ce=(Le||ke)&&Array.isArray(V.groupValues)?V.groupValues.length:0,ge=Le||me?!1:we||!!(Ce.filters||Ce.sort||Ce.quick||Ce.where)||!J.range;return{pushed:{...V,filters:te.pushed,sort:ue?oe:[],quick:he?ye:"",range:ge?null:V.range},residual:Ce,needsAll:ge,unpushed:ie,full:we,grouped:Le,groupLevel:ce,groupReason:me?"":de,pivoted:ke,pivotReason:Oe}}function R(V){const J=Array.isArray(V.totals)?V.totals:[],ee=V.totalFns&&typeof V.totalFns=="object"?V.totalFns:{},te=[],ie=[];for(const oe of J){const ue=String(oe),ye=typeof ee[ue]=="string"?ee[ue]:null,he=ye?r[ye]:null;ye?!he||!he.pushable||!he.sql?ie.push({id:ue,fn:ye,class:he?he.class:"fallback",reason:he&&he.note?he.note:`the pushdown map cannot express "${ye}"`}):he.twoColumn?ie.push({id:ue,fn:ye,class:he.class,reason:`"${ye}" reduces two columns, and a grouped request carries no weight column`}):te.push({id:ue,col:ue,fn:ye,class:he.class}):ie.push({id:ue,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:te,client:ie}}const I=Object.freeze({items:V=>V==null?[]:Array.isArray(V)?V:[V]});function j(V,J,ee){if(!J)return V;let te=V;if(J.filters&&B(ee.evaluateFilters)){const ie=te,oe={count:te.length,handle:he=>({id:he,get:Re=>a(ie[Re],he)}),itemwise:he=>ie.some(Re=>Array.isArray(a(Re,he)))?I:null},ue=ee.evaluateFilters(J.filters,oe),ye=[];for(let he=0;he<te.length;he++)ue[he]&&ye.push(te[he]);te=ye}if(J.where&&J.where.active&&(J.whole||E(J.where.names,"pushdown"),te=te.filter(ie=>J.where.passes(ie))),J.quick){const ie=J.quick.toLowerCase();te=te.filter(oe=>{if(!oe||typeof oe!="object")return!1;for(const ue of Object.values(oe))if(ue!=null&&String(ue).toLowerCase().includes(ie))return!0;return!1})}if(J.sort&&J.sort.length&&B(ee.sortMulti)){const ie=[...new Set(J.sort.map(he=>he.col))],oe=te,ue=ie.map(he=>({id:he,get:Re=>a(oe[Re],he)})),ye=ee.sortMulti(ue,J.sort.map(he=>({col:he.col,dir:he.dir})),Uint32Array.from({length:te.length},(he,Re)=>Re),{});te=Array.from(ye,he=>oe[he])}return te}function L(V){return JSON.stringify({filters:V.filters||null,sort:V.sort||[],quick:V.quick||"",groupBy:V.groupBy||[],groupPath:V.groupPath||[],context:V.context??null})}function F(V){if(!V||typeof V!="object")return 16;let J="";try{J=JSON.stringify(V)}catch{return 200}return J.length*2+64}function N(V){const J=V||{};return{enabled:!!J.enabled,maxRows:Number.isFinite(J.maxRows)?J.maxRows:1e6,maxBytesEstimate:Number.isFinite(J.maxBytesEstimate)?J.maxBytesEstimate:512*1024*1024}}const S=5e4;function C(V){return Number.isFinite(V)&&V>=0?V:S}function D(V){return!!V&&B(V.then)}async function G(V){if(!V||V.total!==void 0||!D(V.pendingTotal))return V;const J=await V.pendingTotal,{pendingTotal:ee,...te}=V;return typeof J=="number"?{...te,total:J}:te}function X(V={}){const J=V.adapter;if(!J||!B(J.execute))return U("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...V,mode:"remote",fetch:async()=>({rows:[],total:0})};const ee=w(J.capabilities),te=J.capabilities&&Object.getOwnPropertyDescriptor(J.capabilities,"operators");te&&B(te.get)&&Object.defineProperty(ee,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(J.capabilities.operators||[]),set:()=>{}});const ie=J.name||"adapter";let oe=null;const ue=()=>B(J.ready)?(oe||(oe=Promise.resolve(J.ready()).then(()=>{Object.assign(ee,w(J.capabilities))},ve=>{throw oe=null,ve})),oe):null,ye=N(V.fullDataset),he=!!V.allowPartialResults,Re=C(V.whereRowLimit);let Ce=null;const we=V.aggregates;let re=null,de=null,me=null,Oe=null,ke=null,Le,ce=null,ge=0,Se=null;const Fe=()=>!ye.enabled||!re?null:(Se!==re.key&&(ge++,Se=re.key),{rows:re.rows,version:ge}),be=async ve=>{const Pe=ve.where&&ve.where.active?ve.where:null;if(!Pe)return{request:ve,probe:null};const{where:je,...Ne}=ve,xe=_(Ne,ee,ye.enabled);if(xe.needsAll)return{request:ve,probe:null};const ze=L(xe.pushed);let _e=null;return(!Ce||Ce.key!==ze)&&(ee.total?(t(ve),_e=await G(await J.execute(xe.pushed,ve)),Ce={key:ze,size:_e&&typeof _e.total=="number"?_e.total:null}):Ce={key:ze,size:null}),Ce.size!==null&&Ce.size<Re?{request:ve,probe:null}:(O(Pe.names,ie,Ce.size,Re),{request:Ne,probe:_e})},Ie=async(ve,Pe)=>{ce=null;const je=R(ve.pushed);me={engine:je.engine,client:je.client,groupBy:ve.pushed.groupBy},je.client.length&&U(`source.pushdown.group.totals.${ie}.${je.client.map(ze=>ze.id).join(".")}`,`the ${ie} adapter cannot compute the group subtotal for ${je.client.map(ze=>`"${ze.id}" (${ze.reason})`).join(", ")}, so those group rows carry no value for that column. A figure computed over anything other than the group would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const Ne=await J.executeGroupLevel(ve.pushed,je.engine,Pe)||{};let xe=Ne.rows||[];return!ee.range&&Pe.range&&(xe=xe.slice(Pe.range.start,Pe.range.end)),st(Ne),Ne.total===void 0?{rows:xe}:{rows:xe,total:Ne.total}},He=new Map,Ge=64,nt=async(ve,Pe)=>{ce=null;const je=ve.pushed,Ne=je.groupBy,xe=Array.isArray(je.groupValues)?je.groupValues:[],ze=xe.length,_e=[...je.filters?[je.filters]:[],...Ne.slice(0,ze).map((ht,ut)=>({col:ht,op:"eq",value:xe[ut]===void 0?null:xe[ut],caseSensitive:!0}))],Qe=_e.length===0?null:_e.length===1?_e[0]:{op:"and",conditions:_e},Te=Pe.range?Pe.range.start:0;if(ze>=Ne.length){const ht={...je,filters:Qe,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},ut=await G(await J.execute(ht,Pe))||{};let Tt=ut.rows||[];return!ee.range&&Pe.range&&(Tt=Tt.slice(Pe.range.start,Pe.range.end)),typeof ut.total=="number"?{rows:Tt,total:ut.total}:{rows:Tt}}const Ke=Ne[ze],qe=R(je),Je=p(ee),Ze=qe.engine.filter(ht=>Je.has(ht.fn)),lt=[...qe.engine.filter(ht=>!Je.has(ht.fn)).map(ht=>({id:ht.id,fn:ht.fn,class:ht.class,reason:`the ${ie} adapter does not compute "${ht.fn}"`})),...qe.client];me={engine:Ze,client:lt,groupBy:Ne},lt.length&&U(`source.pushdown.group.totals.${ie}.${lt.map(ht=>ht.id).join(".")}`,`the ${ie} adapter cannot compute the group subtotal for ${lt.map(ht=>`"${ht.id}" (${ht.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 ot=[...Ze.map(ht=>({id:ht.id,col:ht.col,fn:ht.fn})),{id:d,col:Ke,fn:"count"}],it={...je,filters:Qe,range:null},Ot=JSON.stringify([L(it),xe,Ke,ot]);let jt=Te>0?He.get(Ot):void 0;if(!jt){for(jt=Promise.resolve(J.executeGroupedAggregates(it,[Ke],ot)),He.delete(Ot),He.set(Ot,jt);He.size>Ge;)He.delete(He.keys().next().value);jt.catch(()=>{He.get(Ot)===jt&&He.delete(Ot)})}const Rt=await jt||[];t(Pe);const We=ht=>{const ut={};for(const Tt of Ze)ut[Tt.id]=ht?ht[Tt.id]:void 0;return ut},gt=(je.sort||[]).find(ht=>ht&&ht.col===Ke),ct=gt&>.dir==="desc"?-1:1,bt=Rt.filter(ht=>ht&&ht.level===1).map(ht=>({[Ke]:ht.keys[0]===void 0?null:ht.keys[0],leafCount:Number(ht.values&&ht.values[d])||0,totals:We(ht.values)})).sort((ht,ut)=>ct*$(ht[Ke],ut[Ke]));if(ze===0){const ht=Rt.find(Tt=>Tt&&Tt.level===0),ut=ht?Number(ht.values&&ht.values[d]):NaN;st({matchCount:Number.isFinite(ut)?ut:bt.reduce((Tt,Ht)=>Tt+Ht.leafCount,0),...ht?{grand:We(ht.values)}:{}})}const Et=Pe.range?Pe.range.end:bt.length;return{rows:bt.slice(Te,Et),total:bt.length}},st=ve=>{typeof ve.matchCount=="number"&&(Oe=ve.matchCount,ke=ve.grand?{totals:ve.grand,leafCount:ve.matchCount}:null,Le===void 0&&B(J.unfilteredCount)&&(Le=null,Promise.resolve(J.unfilteredCount()).then(Pe=>{Le=typeof Pe=="number"?Pe:null}).catch(Pe=>{U(`source.pushdown.group.unfiltered.${ie}`,`the ${ie} adapter could not count the unfiltered set (${Pe&&Pe.message?Pe.message:Pe}), so "N of M" falls back to the display count for its denominator.`)})))},mt=async(ve,Pe)=>{ce=null;const je=R(ve.pushed);me={engine:je.engine,client:je.client,groupBy:ve.pushed.groupBy,pivotBy:ve.pushed.pivotBy},je.client.length&&U(`source.pushdown.pivot.totals.${ie}.${je.client.map(Qe=>Qe.id).join(".")}`,`the ${ie} adapter cannot compute the pivot cells for ${je.client.map(Qe=>`"${Qe.id}" (${Qe.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 Ne=await J.executePivotLevel(ve.pushed,je.engine,Pe)||{};let xe=Ne.rows||[];!ee.range&&Pe.range&&(xe=xe.slice(Pe.range.start,Pe.range.end)),st(Ne);const ze=Ne.pivot&&typeof Ne.pivot=="object"?Ne.pivot:{},_e={cells:Array.isArray(ze.cells)?ze.cells:[],...Array.isArray(ze.axis)?{axis:ze.axis}:{}};return Ne.total===void 0?{rows:xe,pivot:_e}:{rows:xe,total:Ne.total,pivot:_e}},kt=ve=>{U(`source.pushdown.pivot.${ie}.${ve}`,`pushdown:pivot-unsupported: the ${ie} adapter cannot pivot this query because ${ve}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const Pe=new Error(`[lattice] ${y}: the ${ie} adapter cannot pivot this query because ${ve}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw Pe.code=y,Pe.reason=ve,Pe},St=(ve,Pe)=>{const je={key:Pe,state:"pending",value:null};return ce=je,ve.then(Ne=>(ce===je&&(ce={key:Pe,state:"settled",value:typeof Ne=="number"?Ne:null}),Ne),Ne=>{throw ce===je&&(ce={key:Pe,state:"failed",value:null}),Ne})};let Pt=0,Mt=[];const It=()=>Pt===0?null:new Promise(ve=>{const Pe=setTimeout(ve,i);Mt.push(()=>{clearTimeout(Pe),ve()})});let $t;const Ut=async ve=>{const Pe=ue();Pe&&await Pe;const Ne=ve&&ve.pivotMode!==!1&&Array.isArray(ve.pivotBy)&&ve.pivotBy.length>0?{request:ve,probe:null}:await be(ve);t(ve);let xe=_(Ne.request,ee,ye.enabled);if(ee.group&&xe.grouped&&!xe.pivoted&&!B(J.executeGroupLevel)&&(U(`source.pushdown.group.method.${ie}`,`the ${ie} 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.`),xe=_(Ne.request,{...ee,group:!1,aggregates:null},ye.enabled)),xe.pivoted&&!B(J.executePivotLevel)&&(xe=_(Ne.request,{...ee,pivot:!1},ye.enabled),xe.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),xe.grouped&&!xe.pivoted&&!ee.group&&!B(J.executeGroupedAggregates)&&(U(`source.pushdown.group.aggregates.method.${ie}`,`the ${ie} 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\`.`),xe=_(Ne.request,{...ee,aggregates:null},ye.enabled)),de=xe,xe.pivoted)return mt(xe,ve);if(xe.pivotReason&&kt(xe.pivotReason),xe.grouped)return ee.group?Ie(xe,ve):nt(xe,ve);const _e=!!xe.groupReason&&!xe.full;_e?U(`source.pushdown.group-unsupported.${ie}.${xe.groupReason}`,`pushdown:group-unsupported: the ${ie} adapter was not asked to group this query because ${xe.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.`):xe.groupReason&&U(`source.pushdown.group.${ie}.${xe.groupReason}`,`the ${ie} adapter was not asked to group this query because ${xe.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 Qe=ot=>_e?{...ot,[A]:!0}:ot;if(!xe.needsAll){const ot=Ne.probe||await J.execute(xe.pushed,ve),it=ot.rows||[];return D(ot.pendingTotal)&&ot.total===void 0?Qe({rows:it,pendingTotal:St(ot.pendingTotal,L(xe.pushed))}):(ce=null,!ee.total&&ot.total===void 0?Qe({rows:it}):Qe({rows:it,total:ot.total??it.length}))}xe.unpushed.length&&U(`source.pushdown.residual.${ie}.${xe.unpushed.join(".")}`,`the ${ie} adapter cannot push ${xe.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 Te=L(xe.pushed);if(!re||re.key!==Te){const ot=await G(await J.execute(xe.pushed,ve));ce=null;const it=ot.rows||[];if(xe.full){const Ot=typeof ot.total=="number"?Math.max(ot.total,it.length):it.length;if(Ot>ye.maxRows)throw new Error(`[lattice] fullDataset refused: the ${ie} adapter's matching set is ${Ot.toLocaleString()} rows, past the configured maxRows of ${ye.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 jt=it.length*F(it[0]);if(jt>ye.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${ie} adapter's matching set is an estimated ${Math.round(jt/(1024*1024)).toLocaleString()} MB across ${it.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(ye.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 ot.total=="number"&&it.length<ot.total){const Ot=!!(xe.residual.filters||xe.residual.quick||xe.residual.sort&&xe.residual.sort.length);if(Ot&&!he)throw new Error(`[lattice] the ${ie} adapter returned ${it.length} of ${ot.total} matching rows when asked for the whole result, and the query has residual ${xe.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.`);Ot?U(`source.pushdown.partial.residual.${ie}`,`the ${ie} adapter returned ${it.length} of ${ot.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.`):U(`source.pushdown.partial.${ie}`,`the ${ie} adapter returned ${it.length} of ${ot.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}re={key:Te,rows:it,total:typeof ot.total=="number"?ot.total:null}}let Ke=xe;if(xe.residual.where){const ot=re.total??re.rows.length;if(ot>=Re){O(xe.residual.where.names,ie,ot,Re);const{where:it,...Ot}=Ne.request;Ke=_(Ot,ee,ye.enabled),de=Ke}}const qe=re.total!==null&&re.rows.length>=re.total,Je=j(re.rows,{...Ke.residual,whole:qe},V.compute||{}),Ze=ve.range?ve.range.start:0,lt=ve.range?ve.range.end:Je.length;return Qe({rows:Je.slice(Ze,lt),total:Je.length})},ft=async(ve,Pe,je)=>{const xe=je&&je.waitForPage&&$t&&B($t.pageForegroundIdle)?$t.pageForegroundIdle():It();xe&&await xe;const ze=ue();ze&&await ze;const _e=_(ve,ee,ye.enabled);de=_e;const Qe=h(Pe,we),Te=Array.isArray(ve.groupBy)?ve.groupBy:[],Ke=Te.length>0,qe=!_e.residual.filters&&!_e.residual.quick,Je=!Ke||l(Te,ee.buckets);let Ze=Qe.engine,lt=Qe.client;if(ee.aggregates&&Ze.length){const jt=ee.aggregates instanceof Set?ee.aggregates:new Set(Z(ee.aggregates)),Rt=Ze.filter(We=>!jt.has(We.fn));Rt.length&&(Ze=Ze.filter(We=>jt.has(We.fn)),lt=[...Rt.map(We=>({...We,reason:`the ${ie} adapter does not compute "${We.fn}"`})),...lt])}const ot=jt=>{lt=[...Ze.map(Rt=>({...Rt,reason:jt})),...lt],Ze=[]};Ze.length&&!qe?ot(_e.residual.quick&&!_e.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):Ze.length&&!Je&&ot("a grouping key the engine cannot form forces all-client (no mixed provenance)");let it={},Ot;return Ze.length&&(B(Ke?J.executeGroupedAggregates:J.executeAggregates)?Ke?Ot=await J.executeGroupedAggregates(_e.pushed,Te,Ze)||[]:it=await J.executeAggregates(_e.pushed,Ze)||{}:(U(`source.pushdown.aggregates.${ie}${Ke?".grouped":""}`,`the ${ie} adapter cannot compute ${Ke?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),ot(`adapter cannot compute ${Ke?"grouped ":""}aggregates`))),me={engine:Ze,client:lt,...Ke?{groupBy:Te}:{}},{values:it,engine:Ze,client:lt,...Ot!==void 0?{groups:Ot}:{}}},dt=async ve=>{Pt++;try{return await Ut(ve)}finally{if(Pt--,Pt===0&&Mt.length){const Pe=Mt;Mt=[];for(const je of Pe)je()}}},wt=f(V.edit),rt=V.edit&&typeof V.edit=="object"&&B(V.edit.commit);let fe=V.edit;if(wt&&!rt)if(ee.mutate&&ee.mutate.update){const ve=Pe=>{if(!ee.mutate||!ee.mutate.update)throw new Error(`[lattice] the ${ie} 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 je={kind:"update",key:String(Pe.key),patch:{[Pe.colId]:Pe.value}};return J.mutate(je,Pe.request||{})};fe={...V.edit===!0?{}:V.edit,commit:ve}}else U(`source.pushdown.readonly.${ie}`,`edit is enabled but the ${ie} 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 Ee=wt&&ee.mutate&&(ee.mutate.append||ee.mutate.delete)?{append:ee.mutate.append===!0,remove:ee.mutate.delete===!0,returning:ee.mutate.returning,mutate:(ve,Pe)=>J.mutate(ve,Pe||{})}:null,Be=async ve=>{const Pe=ue();Pe&&await Pe;const{range:je,signal:Ne,export:xe,...ze}=ve||{},_e={...ze,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:_(_e,ee,ye.enabled),signal:Ne}};async function*pe(ve,Pe={}){const{plan:je,signal:Ne}=await Be(ve),xe=Math.max(1,Math.floor(Number(Pe.pageSize))||5e3),ze={signal:Ne,stream:!0};if(!je.needsAll)for(let Te=0;;Te+=xe){t(ze);const Ke=await J.execute({...je.pushed,range:{start:Te,end:Te+xe}},ze);Ke&&D(Ke.pendingTotal)&&Ke.pendingTotal.then(null,()=>{});const qe=Ke&&Ke.rows||[];if(qe.length&&(yield qe),qe.length<xe)return}t(ze);const _e=await G(await J.execute({...je.pushed,range:void 0},ze)),Qe=j(_e&&_e.rows||[],{...je.residual,whole:!0},V.compute||{});for(let Te=0;Te<Qe.length;Te+=xe)yield Qe.slice(Te,Te+xe)}return $t={...V,edit:fe,rowMutate:Ee,mode:"remote",fetch:dt,foregroundIdle:It,aggregate:ft,countMatching:async ve=>{const{plan:Pe,signal:je}=await Be(ve);if(!Pe.needsAll&&ee.total){t({signal:je});const xe=await G(await J.execute({...Pe.pushed,range:{start:0,end:0}},{signal:je}));if(xe&&typeof xe.total=="number")return xe.total}let Ne=0;for await(const xe of pe(ve))Ne+=xe.length;return Ne},streamMatching:pe,capabilitiesOf:w,planQuery:_,wireFilters:b,resolveAggregatePlan:ve=>h(ve,we),STAT_PUSHDOWN:r,lastPlan:()=>de?{...de,...me?{aggregates:me}:{},...ce?{total:{deferred:!0,state:ce.state,value:ce.value}}:{}}:null,fullFrame:Fe,counts:()=>({match:Oe,total:Le??null,pending:!!ce&&ce.state==="pending"}),grandTotals:()=>ke},$t}}),Ue("packages/core/src/source/remote.js",function(e,H){"use strict";Object.defineProperty(e,"PROTOCOL",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return L}});const $=H("packages/core/src/internal/lru.js").Lru,B=H("packages/core/src/internal/predicates.js").isFunction,Z=H("packages/core/src/internal/warn.js").warnOnce,U=H("packages/core/src/internal/schedule.js").settleDebounce,W=H("packages/core/src/source/abort.js"),K=W.createAbortScope,E=W.isAbortError,O=H("packages/core/src/source/blockcache.js"),b=O.BlockCache,u=O.DEFAULT_PAGE_SIZE,h=O.DEFAULT_MAX_CACHED_PAGES,l=H("packages/core/src/source/rows.js"),r=l.createRowFactory,n=l.groupKey,o=H("packages/core/src/source/filterwire.js"),i=o.wireFilters,t=o.querySignature,c=o.warnHostFilterNotApplied,a=H("packages/core/src/source/pagewindow.js").pageWindow,w=H("packages/core/src/source/memory.js").MemorySource,k=H("packages/core/src/compute/handle.js").valueComparator,d=H("packages/core/src/compute/pivot.js"),p=d.pivotKey,m=d.joinPath,v=d.DEFAULT_PATH_SEPARATOR,T=H("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,A=1,M=120,_=1e3;function R(F,N,S){for(let C=0;C<Math.max(F.length,N.length);C++){const D=F[C],G=N[C],X=D==null,V=G==null;if(X||V){if(X&&V)continue;return X?1:-1}const J=S(D,G);if(J!==0)return J}return 0}function I(F,N){return new L(F,N)}class j{constructor(N,S,C,D){this.path=N,this.keyPath=D||N,this.values=[],this.level=S,this.key=n(this.keyPath),this.cache=new b(C),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 L{mode="remote";#e;#t;#n;#r;#i=new Map;#s=new Set;#o=K();#l;#a;#c=new Map;#u=[];#f=null;#d="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#A="";#w=null;#O=-1;constructor(N,S){this.#e=N||{mode:"remote"},this.#t=S||{},B(this.#e.fullFrame)&&(this.filteredIndices=()=>this.#U(),this.unfilteredIndices=()=>this.#K(),this.handleFor=V=>this.#x(V),this.display=()=>this.#I(),this.grandTotalRow=()=>this.#F(),this.unfilteredRows=()=>this.#z(),this.facetIndices=V=>this.#Y(V));const C=this.#e.counts;B(C)&&(this.matchCount=()=>this.#G("match"),this.totalCount=()=>this.#G("total"));const D=this.#e.grandTotals;B(D)&&(this.grandTotalRow=()=>this.#H());const G=this.#e.foregroundIdle;B(G)&&(this.foregroundIdle=()=>this.#ye(G),this.#e.pageForegroundIdle=()=>this.#b?this.#ye(G):null);const X=this.#e;B(X.countMatching)&&B(X.streamMatching)&&(this.selectionQuery=()=>this.#fe(),this.countMatching=V=>X.countMatching(V),this.streamMatching=(V,J)=>X.streamMatching(V,J),this.loadedRows=()=>this.#ne(),this.resident=()=>this.#R()!==null),this.#n={pageSize:this.#e.pageSize||u,maxCachedPages:this.#e.maxCachedPages||h},this.#l=r(this.#t),this.#a=new $(this.#n.pageSize*4),this.#h=U((V,J)=>this.#P(V,J),M),this.#r=new j([],0,this.#n),this.#i.set(this.#r.key,this.#r),this.#d=this.#ve(),B(this.#e.fetch)||Z("source.remote.fetch",'source.mode "remote" requires a fetch function; the grid will stay empty.'),this.#Be()}count(){const N=this.#S();return N?N.length:this.#v()}#v(){const N=this.#R();return N?N.count():(this.#q(),this.#te(this.#r))}#T(){if(this.#R())return!0;const N=S=>{if(S.count===null&&!S.complete)return!1;for(const C of S.children.values())if(this.#Ee(C.key)&&!N(C))return!1;return!0};return N(this.#r)}pageInfo(){const N=this.#S(),S=this.totalPending();if(!N){const C=this.#v();return{page:0,pageSize:0,total:this.#T()?C:null,pageCount:1,counting:S}}return{page:N.page,pageSize:N.pageSize,total:N.total,pageCount:N.pageCount,counting:S||N.total===null&&this.#o.size>0&&this.#r.cache.loadedExtent()===0}}#S(){const N=this.#v(),S=a(this.#C("pageSize",0),this.#C("page",0),N,this.#T());if(!S)return this.#A="",null;const C=`${this.#y}:${S.offset}:${S.length}`;return C!==this.#A&&!this.#p&&(this.#A=C,S.length>0&&!this.#R()&&this.#P(S.offset,S.offset+S.length-1)),S}at(N){const S=this.#S();if(S){if(N<0||N>=S.length)return;const C=this.#E(S.offset+N);return C&&(C.index=N),C}return this.#E(N)}#E(N){const S=this.#R();if(S)return S.at(N);if(this.#q(),N<0||N>=this.#v())return;const C=this.#W(this.#r,N);if(!C)return;const D=this.#X(C.node,C.local);return D&&(D.index=N),D||this.#l.skeleton(N,C.node.level,C.node.cache.erroredAt(C.local))}byKey(N){const S=this.#R();if(S)return S.byKey(N);const C=this.#c.get(N);if(!C)return;const D=C.lastIndexOf(":"),G=this.#i.get(C.slice(0,D));return G&&this.#X(G,Number(C.slice(D+1)))||void 0}loaded(N){const S=this.#S();if(S){if(N<0||N>=S.length)return!1;N+=S.offset}const C=this.#R();if(C)return C.loaded(N);if(N<0||N>=this.#v())return!1;const D=this.#W(this.#r,N);return!!D&&D.node.cache.rowLoaded(D.local)}hint(N,S){if(this.#p)return;this.#b=!0;const C=this.#q();let D=Math.max(0,Math.floor(N)),G=Math.max(D,Math.floor(S));const X=this.#S();if(X){if(X.length===0)return;D=X.offset,G=X.offset+X.length-1}for(const[V,J]of this.#N(D,G)){V.cache.protect(J.min,J.max);for(const ee of V.cache.evict())this.#Ne(V,ee)}this.#h(D,G),C&&this.#h.flush()}#N(N,S){const C=this.#v(),D=new Map;for(let G=N;G<=S&&G<C;G++){const X=this.#W(this.#r,G);if(!X)continue;const V=D.get(X.node);V?(V.min=Math.min(V.min,X.local),V.max=Math.max(V.max,X.local)):D.set(X.node,{min:X.local,max:X.local})}return D.size||D.set(this.#r,{min:N,max:N}),D}#P(N,S){if(!this.#p)for(const[C,D]of this.#N(N,S)){C.cache.protect(D.min,D.max);const G=C.cache.blockOf(D.min),X=C.cache.blockOf(D.max);for(let V=G;V<=X&&!(C.count!==null&&V*C.cache.pageSize>=C.count);V++)C.cache.has(V)||this.#Fe(C,V)}}apply(N){const S={added:[],updated:[],removed:[]};if(!N)return S;if(N.update)for(const C of N.update){const D=this.#c.get(this.#l.keyOf(C,-1));if(!D)continue;this.#a.delete(D);const G=D.lastIndexOf(":"),X=this.#i.get(D.slice(0,G));if(!X)continue;const V=Number(D.slice(G+1)),J=X.cache.blockOf(V);if(!X.cache.loaded(J))continue;const{start:ee}=X.cache.rangeOf(J),te=[];for(let oe=ee;oe<ee+X.cache.pageSize;oe++){const ue=X.cache.rowAt(oe);if(ue===void 0)break;te.push(oe===V?C:ue)}X.cache.fill(J,te);const ie=this.#X(X,V);ie&&S.updated.push(ie)}return(N.add&&N.add.length||N.remove&&N.remove.length)&&this.reload({keepExpanded:!0}),S}reload(N){this.#o.abortAll("reload"),this.#h.cancel(),N&&N.keepExpanded===!1&&this.#s.clear(),this.#re(),this.#_("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#o.abortAll("destroyed"),this.#re(),this.#i.clear(),this.#s.clear(),this.#w&&B(this.#w.destroy)&&this.#w.destroy(),this.#w=null}expand(N){this.#s.has(N)||(this.#s.add(N),this.#_("group:toggled",{key:N,expanded:!0}),this.#_("model:changed",{reason:"expand",key:N}))}collapse(N){this.#s.delete(N)&&(this.#_("group:toggled",{key:N,expanded:!1}),this.#_("model:changed",{reason:"collapse",key:N}))}expandedKeys(){return[...this.#s]}pivotFields(){return this.#u}pivot(){this.#q();const N=this.#f;if(!N||!N.keys.size||!this.#C("pivotBy",[]).length)return null;if(!N.result){const S=k((this.#t.config||{}).locale),C=[...N.keys.entries()].sort((G,X)=>R(G[1],X[1],S)),D=C.map(([G])=>G);N.result={keys:C.map(([,G])=>G),paths:D,fields:this.#ie(D),groupPaths:[],columns:D.length*Math.max(1,this.#Te().length),values:N.cells,cells:N.cells,error:null}}return N.result}invalidateHandles(){this.#w&&(B(this.#w.invalidateHandles)&&this.#w.invalidateHandles(),B(this.#w.invalidate)&&this.#w.invalidate("filter"))}#M(){const N=this.#e.fullFrame;return B(N)?N():null}#R(){const N=this.#M();return N?(this.#w||(this.#w=new w({mode:"memory"},this.#$())),N.version!==this.#O&&(this.#w.setRows(N.rows),this.#O=N.version),this.#w):null}#$(){const N=this.#t,S=N.state||{};return{...N,state:{...S,page:()=>0,pageSize:()=>0}}}#U(){const N=this.#R();return N?N.filteredIndices():new Uint32Array(0)}#K(){const N=this.#R();return N?N.unfilteredIndices():new Uint32Array(0)}#x(N){const S=this.#R();return S?S.handleFor(N):void 0}#I(){const N=this.#R();return N?N.display():[]}#Y(N){const S=this.#R();return S&&B(S.facetIndices)?S.facetIndices(N):new Uint32Array(0)}#F(){const N=this.#R();return N&&B(N.grandTotalRow)?N.grandTotalRow():null}#G(N){const S=this.#R();if(S){const X=N==="match"?S.matchCount:S.totalCount;if(B(X))return X.call(S)}const C=this.#e.counts,D=B(C)?C():null,G=D?D[N]:null;return typeof G=="number"?G:this.#v()}#H(){const N=this.#R();if(N&&B(N.grandTotalRow))return N.grandTotalRow();if((this.#t.config||{}).grandTotalRow!=="bottom")return null;const C=this.#e.grandTotals,D=B(C)?C():null;return!D||!D.totals?null:this.#l.grandTotal(D.totals,D.leafCount||0)}#z(){const N=this.#R();if(N&&B(N.unfilteredRows))return N.unfilteredRows();const S=[],C=this.count();for(let D=0;D<C;D++){const G=this.at(D);G&&S.push(G)}return S}#fe(){const N=this.#C("quick",""),S={protocol:A,groupPath:[],groupValues:[],groupBy:[],totals:[],totalFns:{},pivotBy:[],pivotMode:!1,filters:i(this.#C("filters",null),this.#B()),sort:this.#C("sort",[]),context:this.#C("context",null)};N&&(S.quick=N);const C=this.#C("where",null);return C&&C.active&&(S.where=C),S}#ne(){const N=this.#C("groupBy",[]).length,S=[];for(const C of this.#i.values())if(!(C.level!==N&&!C.flat))for(const D of C.cache.ids()){if(!C.cache.loaded(D))continue;const{start:G,end:X}=C.cache.rangeOf(D);for(let V=G;V<X&&C.cache.rowLoaded(V);V++){const J=this.#X(C,V);J&&!J.group&&S.push(J)}}return S}loadedCount(){const N=this.#R();if(N){const D=N.matchCount();return typeof D=="number"?D:N.count()}this.#q();const S=this.#C("groupBy",[]).length;let C=0;for(const D of this.#i.values())if(!(D.level!==S&&!D.flat))for(const G of D.cache.ids()){if(!D.cache.loaded(G))continue;const X=D.cache.fillOf(G);typeof X=="number"&&(C+=X)}return C}residentRows(){const N=this.#R();return N?N.display():this.#C("groupBy",[]).length>0?null:(this.#q(),this.#ne())}#pe(N,S,C){const{start:D,end:G}=N.cache.rangeOf(S),X=this.#C("groupBy",[]),V=this.#C("pivotBy",[]),J=this.#C("quick",""),ee=this.#Te(),te={protocol:A,range:{start:D,end:G},groupPath:N.path,groupValues:N.values,groupBy:X,totals:ee,totalFns:this.#le(ee),pivotBy:V,pivotMode:V.length>0,filters:i(this.#C("filters",null),this.#B()),sort:this.#C("sort",[]),context:this.#C("context",null),signal:C};J&&(te.quick=J);const ie=this.#C("where",null);return ie&&ie.active&&(te.where=ie),te}async#Fe(N,S){if(!B(this.#e.fetch))return;if(!this.#m){this.#m=!0;const X=this.#g;this.#g=[],queueMicrotask(()=>{for(const V of X)V()})}const C=this.#o.begin(`${N.key}:${S}`);N.cache.begin(S,C);const D=this.#d,{start:G}=N.cache.rangeOf(S);try{const X=await this.#e.fetch(this.#pe(N,S,C.signal));if(!C.current||D!==this.#d||this.#p)return;C.settle();const V=X&&X.rows||[];if(!!(X&&X[T])&&!N.flat){N.flat=!0,N.children.clear();for(const[ie,oe]of[...this.#c])oe.startsWith(`${N.key}:`)&&(this.#a.delete(oe),this.#c.delete(ie))}N.cache.fill(S,V),N.failed=!1;for(let ie=0;ie<V.length;ie++)this.#a.delete(`${N.key}:${G+ie}`);const ee=X&&typeof X.count=="number"?X.count:X&&typeof X.total=="number"?X.total:null,te=X&&B(X.pendingTotal?.then)?X.pendingTotal:null;ee!==null?(N.count=ee,N.complete=!0):V.length<N.cache.pageSize?(N.count=G+V.length,N.complete=!0):te&&(N.counting=!0,N.announced=null),X&&Array.isArray(X.pivotFields)&&this.#Pe(X.pivotFields),X&&X.pivot&&typeof X.pivot=="object"&&this.#Ce(X.pivot),this.#_("model:changed",{reason:"page",groupPath:N.path,block:S}),this.#_("rows:changed",{companion:!0,reason:"page",groupPath:N.path,block:S}),this.#me(N),te&&this.#Oe(N,te,D)}catch(X){if(C.settle(),E(X))return;N.cache.failed(S,X),N.failed=!0;const{end:V}=N.cache.rangeOf(S);for(let J=G;J<V;J++)this.#a.delete(`${N.key}:${J}`);this.#_("model:changed",{reason:"page-error",groupPath:N.path,block:S}),this.#_("source:error",{error:X,groupPath:N.path,block:S})}}async#Oe(N,S,C){let D;try{D=await S}catch(G){if(C!==this.#d||this.#p)return;N.counting=!1,E(G)||(N.failed=!0),E(G)||this.#_("source:error",{error:G,groupPath:N.path});return}C!==this.#d||this.#p||(N.counting=!1,typeof D=="number"&&(N.count=D,N.complete=!0,this.#me(N),this.#_("model:changed",{reason:"total",count:D,groupPath:N.path})))}#me(N){typeof N.count!="number"||!N.complete||N.announced!==N.count&&(N.announced=N.count,this.#_("source:total",{total:N.count,groupPath:N.path}))}#ye(N){if(this.#p)return null;this.#q();const S=this.#m?null:new Promise(V=>{this.#g.push(V),setTimeout(V,_)}),C=N();if(!S&&!C)return null;const D=(async()=>{S&&await S;for(let V=N();V;V=N())await V})();let G;const X=new Promise(V=>{G=setTimeout(V,_)});return Promise.race([D,X]).then(()=>clearTimeout(G))}totalPending(){if(this.#r.failed)return!1;if(this.#r.counting===!0)return!0;if(this.#R())return!1;this.#q();const N=this.#r;return N.count===null&&!N.complete&&N.cache.loadedExtent()===0}totalFailed(){return this.#r.failed===!0}#Pe(N){N.length===this.#u.length&&N.every((S,C)=>S===this.#u[C])||(this.#u=N,this.#_("column:pivoted",{pivotFields:N,remote:!0}))}#de(){const N=this.#t.config||{};return N.pivot&&N.pivot.separator||v}#ie(N){const S=this.#de(),C=this.#Te();if(!C.length)return N.slice();const D=[];for(const G of N)for(const X of C)D.push(`${G}${S}${X}`);return D}#Ce(N){const S=this.#de();this.#f||(this.#f={keys:new Map,cells:new Map,result:null});const C=this.#f;let D=!1;const G=V=>{const J=Array.isArray(V)?V:[V],ee=m(J,S);return C.keys.has(ee)||(C.keys.set(ee,J),D=!0),ee},X=this.#C("groupBy",[]).length>0;for(const V of Array.isArray(N.axis)?N.axis:[])G(V);for(const V of Array.isArray(N.cells)?N.cells:[]){if(!V||typeof V!="object")continue;const J=G(V.pivot);if(X&&!(Array.isArray(V.group)&&V.group.length))continue;const ee=m(Array.isArray(V.group)?V.group:[],S);for(const[te,ie]of Object.entries(V.values||{}))C.cells.set(p(ee,J,te),ie)}C.result=null,D&&this.#Pe((this.pivot()||{fields:[]}).fields)}#te(N){let S=this.#J(N);for(const C of N.children.values())this.#Ee(C.key)&&(S+=this.#te(C));return S}#J(N){if(N.count!==null)return N.count;const S=N.cache.loadedExtent();return N.complete?S:N.row&&N.row.leafCount>0?N.level>=this.#C("groupBy",[]).length?Math.max(S,N.row.leafCount):S===0?1:Math.min(S+N.cache.pageSize,Math.max(S,N.row.leafCount)):S+N.cache.pageSize}#W(N,S){let C=S,D=0;const G=[...N.children.entries()].filter(([,V])=>this.#Ee(V.key)).sort((V,J)=>V[0]-J[0]);for(const[V,J]of G){const ee=V-D+1;if(C<ee)return{node:N,local:D+C};C-=ee,D=V+1;const te=this.#te(J);if(C<te)return this.#W(J,C);C-=te}const X=this.#J(N);return D+C<X?{node:N,local:D+C}:null}#X(N,S){const C=`${N.key}:${S}`,D=this.#a.get(C);if(D)return D;const G=N.cache.rowAt(S);if(G===void 0)return null;const X=this.#C("groupBy",[]);let V;if(N.level<X.length&&!N.flat){const J=X[N.level],ee=this.#f!==null&&N.level===X.length-1&&this.#C("pivotBy",[]).length>0,te=this.#he(G,J),ie=te==null,oe=[...N.path,ie?"":String(te)],ue=[...N.keyPath,ie?null:String(te)];if(V=this.#l.group({path:oe,keyPath:ue,column:J,value:te,level:N.level,parent:N.row,leafCount:Number(G.leafCount)||0,expanded:ee?!1:this.#Ee(n(ue)),...ee?{hasChildren:!1}:{}}),V.totals=this.#D(G),V.data=G,!ee){let ye=this.#i.get(V.key);ye?ye.row=V:(ye=new j(oe,N.level+1,this.#n,ue),ye.row=V,this.#i.set(ye.key,ye)),ye.values=[...N.values,te],N.children.set(S,ye)}}else V=this.#l.leaf(G,S,N.level,N.row);return this.#a.set(C,V),this.#c.set(V.key,C),V}#D(N){const S=N||{};if(S.totals&&typeof S.totals=="object")return S.totals;const C={};for(const D of this.#Te())Object.hasOwn(S,D)&&(C[D]=S[D]);return C}#Ne(N,S){const{start:C,end:D}=N.cache.rangeOf(S);for(let G=C;G<D;G++){const X=`${N.key}:${G}`,V=this.#a.peek(X);V&&this.#c.delete(V.key),this.#a.delete(X)}}#q(){const N=this.#ve();return N===this.#d?!1:(this.#d=N,this.#o.abortAll("query"),this.#re(),this.#m=!1,this.#_("model:changed",{reason:"query"}),!0)}#re(){for(const N of this.#i.values())N.cache.clear(),N.count=null,N.complete=!1,N.announced=null,N.counting=!1,N.failed=!1,N.children.clear(),N.flat=!1;this.#a.clear(),this.#c.clear(),this.#y++,this.#f=null}#ve(){const N=this.#C("where",null);return`${t({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)})}|${N?N.version:0}`}#Ee(N){const S=this.#C("expanded",null);return S?B(S.has)?S.has(N):Array.prototype.includes.call(S,N):this.#s.has(N)}#Te(){const N=this.#C("totals",[]);if(N&&N.length)return[...N];const S=this.#t.columns;return!S||!B(S.all)?[]:S.all().filter(C=>!!C.total).map(C=>C.id)}#le(N){const S=this.#t.columns,C={};if(!S||!B(S.get))return C;for(const D of N){const G=S.get(D);if(!G)continue;const X=G.groupTotal!=null?G.groupTotal:G.total;typeof X=="string"&&(C[D]=X)}return C}#he(N,S){const C=this.#t.columns,D=C&&B(C.get)?C.get(S):void 0;return D&&B(D.getValue)?D.getValue(N):N?.[S]}#Be(){c(this.#t)}#B(){const N=this.#t.config||{};return{tz:N.timeZone,weekStartsOn:N.weekStartsOn}}#C(N,S){const C=this.#t.state;if(C&&B(C[N])){const D=C[N]();return D??S}return S}#_(N,S){const C=this.#t.emit;B(C)&&C(N,S)}}}),Ue("packages/core/src/source/gapbuffer.js",function(e,H){"use strict";Object.defineProperty(e,"GapBuffer",{enumerable:!0,get:function(){return $}});const ne=64;class ${#e;#t=0;#n=0;constructor(B=ne){this.#e=new Uint32Array(Math.max(1,B)),this.#n=this.#e.length}static from(B,x=ne){const Z=new $(B.length+Math.max(1,x));return Z.#e.set(B,0),Z.#t=B.length,Z.#n=Z.#e.length,Z}get length(){return this.#t+(this.#e.length-this.#n)}get capacity(){return this.#e.length}at(B){return B<0||B>=this.length?0:B<this.#t?this.#e[B]:this.#e[B+(this.#n-this.#t)]}insert(B,x){const Z=B<0?0:B>this.length?this.length:B;this.#r(Z),this.#t===this.#n&&this.#i(),this.#e[this.#t++]=x}push(B){this.insert(this.length,B)}removeAt(B){return!Number.isInteger(B)||B<0||B>=this.length?!1:(this.#r(B),this.#n++,!0)}toArray(){const B=new Uint32Array(this.length);return B.set(this.#e.subarray(0,this.#t),0),B.set(this.#e.subarray(this.#n),this.#t),B}clear(){this.#t=0,this.#n=this.#e.length}#r(B){if(B!==this.#t)if(B<this.#t){const x=this.#t-B;this.#e.copyWithin(this.#n-x,B,this.#t),this.#t=B,this.#n-=x}else{const x=B-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+x),this.#t=B,this.#n+=x}}#i(){const B=this.#e.length-this.#n,x=new Uint32Array(Math.max(this.#e.length*2,this.#e.length+ne));x.set(this.#e.subarray(0,this.#t),0),x.set(this.#e.subarray(this.#n),x.length-B),this.#e=x,this.#n=x.length-B}}}),Ue("packages/core/src/store/ingest.js",function(e,H){"use strict";Object.defineProperty(e,"INGEST_DEFAULTS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"inferKind",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"decideText",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"createReaders",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"Ingest",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return i}});const ne=H("packages/core/src/internal/schedule.js"),$=ne.now,q=ne.nextFrame,B=H("packages/core/src/internal/warn.js"),x=B.infoOnce,Z=B.warnOnce,U=H("packages/core/src/internal/predicates.js").isFunction,K=H("packages/core/src/internal/paths.js").pathGetter,O=H("packages/core/src/store/columnstore.js").ColumnStore,b=Object.freeze({chunkMs:8,chunkRows:512,sampleSize:100,dictionaryRatio:.1,columnarBelow:5e3,initialCapacity:1024});function u(t,c={}){if(c.multi)return"multi";if(t.length===0)return"object";let s=0,a=0,f=0,w=0,g=0;for(let d=0;d<t.length;d++){const p=t[d];typeof p=="number"?s++:typeof p=="boolean"?a++:typeof p=="string"?f++:p instanceof Date?w++:Array.isArray(p)&&g++}const k=t.length;return s===k?"float64":a===k?"bitset":w===k?"float64":f===k?"text":g===k?"multi":"object"}function h(t,c,s){return c<=0||t<s*c?"dictionary":"object"}function l(t,c,s){const a=new Map,f=new Map;for(const A of t){if(A.computed)continue;const M=U(A.read)?A.read:K(A.field||A.id);f.set(A.id,M),a.set(A.id,M)}const w=c?.order??[],g=c?.fns??{},k=c?.deps??{},d=c?.wrapDeps??null,p=w.filter(A=>U(g[A])),m=p.some(A=>k[A]==="*");let v=new WeakMap;const y=A=>{const M={};if(m)for(const[_,R]of f)M[_]=R(A);for(const _ of p){const R=k[_];let I;if(R==="*")I=M;else{I={};const j=R||[];for(let L=0;L<j.length;L++){const F=j[L];I[F]=F in M?M[F]:f.get(F)?.(A)}}M[_]=g[_](d?d(I,_):I,{data:A,row:null,column:null,grid:null,context:s})}return M},T=A=>{if(A===null||typeof A!="object"&&typeof A!="function")return y(A);let M=v.get(A);return M===void 0&&(M=y(A),v.set(A,M)),M};for(const A of p)a.set(A,M=>T(M)[A]);return{readers:a,reset(){v=new WeakMap}}}class r{spec;read;kind;inferred;nullable;candidate=!1;distinct=null;change=null;reason="";constructor(c,s){this.spec=c,this.read=s,this.kind="object",this.inferred=!1,this.nullable=c.nullable!==!1}}class n{#e;#t=[];#n=null;#r;#i=0;#s;#o=!1;#l=!1;#a=0;#c;constructor(c,s={},a={}){this.#e=Array.isArray(c)?c:Array.from(c||[]),this.#s={...b,...a};const f=s.columns??[];this.#r=l(f,s.computed??null,s.context),this.#c=this.#e.length>=this.#s.columnarBelow,this.#u(f,s.computed??null),this.#n=new O(this.#t.map(w=>({id:w.spec.id,kind:w.kind,nullable:w.nullable,read:w.read,dictionary:w.spec.dictionary})),{initialCapacity:this.#s.initialCapacity,columnarBelow:this.#s.columnarBelow})}get store(){return this.#n}get done(){return this.#o||this.#l}get progress(){return this.#i}slice(){if(this.done)return!1;if(this.#s.signal?.aborted)return this.#l=!0,!1;const c=$(),{chunkMs:s,chunkRows:a}=this.#s,f=this.#e.length;do{const w=Math.min(this.#i+a,f);this.#n.append(this.#e.slice(this.#i,w)),this.#f(this.#i,w),this.#i=w,this.#r.reset(),this.#h(!1)}while(this.#i<f&&$()-c<s);return this.#a+=$()-c,this.#s.onProgress?.({loaded:this.#i,total:f}),this.#i>=f?(this.#h(!0),this.#o=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(c=>({id:c.spec.id,kind:c.kind,nullable:c.nullable,read:c.read,dictionary:c.spec.dictionary})),decisions:this.#t.map(c=>({id:c.spec.id,kind:c.kind,nullable:c.nullable,inferred:c.inferred,distinct:c.candidate||c.change?this.#d(c):null,change:c.change,reason:c.reason})),count:this.#n.count,elapsed:this.#a,cancelled:this.#l}}#u(c,s){const a=this.#e,f=Math.min(this.#s.sampleSize,a.length),w=this.#s.dictionaryRatio,g=s?.pure instanceof Set?s.pure:new Set(s?.pure??s?.order??[]);for(const k of c){if(!k||!k.id)continue;if(k.computed&&(k.pure===!1||s&&!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)??(U(k.read)?k.read:K(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 m=[];for(let y=0;y<f&&m.length<this.#s.sampleSize;y++){const T=d(a[y]);T!=null&&m.push(T)}p.inferred=!0;const v=u(m,{multi:k.multi});if(v==="text"){const y=new Set(m).size;p.kind=h(y,m.length,w),p.candidate=this.#c,p.reason=`sampled ${y} distinct in ${m.length}`}else p.kind=v,p.reason=`inferred from ${m.length} sampled values`,v==="object"&&m.length&&x(`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(m))}this.#t.push(p)}}#f(c,s){const a=this.#e;for(const f of this.#t){if(!f.candidate||!f.distinct)continue;const w=f.distinct;for(let g=c;g<s;g++){const k=f.read(a[g]);k!=null&&w.add(k)}}}#d(c){if(c.distinct)return c.distinct.size;const s=this.#n.column(c.spec.id);return s?.dict?s.dict.size:0}#h(c){const s=this.#s.dictionaryRatio,a=this.#e.length;for(const f of this.#t){if(!f.candidate)continue;const w=this.#d(f);if(f.kind==="dictionary"&&w>=s*a){const g=this.#n.column(f.spec.id);f.distinct=new Set(g?.dict?g.dict.values():[]),this.#n.convert(f.spec.id,"object"),f.kind="object",f.change="demoted",f.reason=`${w} distinct values is at or above ${s*100}% of ${a} rows`;continue}if(f.kind==="object"&&w>=s*a){f.candidate=!1,f.distinct=null,f.reason=`${w} distinct values is at or above ${s*100}% of ${a} rows`;continue}c&&f.kind==="object"&&w<s*a&&(this.#n.convert(f.spec.id,"dictionary"),f.kind="dictionary",f.change=f.change==="demoted"?null:"promoted",f.reason=`${w} distinct values is below ${s*100}% of ${a} rows`,f.distinct=null),c&&(f.candidate=!1)}}}async function o(t,c={},s={}){const a=new n(t,c,s),f=s.scheduler?.frame??q;for(;a.slice();)await new Promise(w=>{f(w)});return a.result()}function i(t,c={},s={}){const a=new n(t,c,{...s,chunkMs:1/0});for(;a.slice(););return a.result()}}),Ue("packages/core/src/store/columnpack.js",function(e,H){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return h}});const $=H("packages/core/src/internal/paths.js").pathGetter,q=H("packages/core/src/store/ingest.js"),B=q.inferKind,x=q.decideText,Z=q.INGEST_DEFAULTS,U=H("packages/core/src/store/columnstore.js").toFloat,W=new Set(["float64","int32","bitset","dictionary","object","multi"]);function K(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&&!W.has(r.kind))return!1;return!0}function E(l){const r=U(l);return Number.isFinite(r)?r|0:0}function O(l){return l==null?[]:Array.isArray(l)?l:[l]}function b(l,r,n,o){if(l.kind)return l.kind;const i=[];for(let s=0;s<r.length&&i.length<Z.sampleSize;s++){const a=r[s];a!=null&&i.push(a)}const t=B(i,{multi:l.multi});if(t!=="text")return t;const c=new Set(i).size;return x(c,i.length,o)}function u(l,r,n={}){const o=r.length|0,i=n.dictionaryRatio??Z.dictionaryRatio,t=[];for(const c of l){const s=$(c.field||c.id),a=c.nullable!==!1,f=new Array(o);for(let p=0;p<o;p++){const m=s(r[p]);f[p]=m===void 0?null:m}const w=b(c,f,o,i),g=a?new Uint8Array(o+7>>3):null,k=p=>{g&&(g[p>>3]|=1<<(p&7))};let d;switch(w){case"float64":{const p=new Float64Array(o);for(let m=0;m<o;m++){const v=f[m],y=v===null;y||k(m),p[m]=y?NaN:U(v)}d={id:c.id,kind:w,nullable:a,values:p,presence:g,offsets:null,table:null};break}case"int32":{const p=new Int32Array(o);for(let m=0;m<o;m++){const v=f[m],y=v===null;y||k(m),p[m]=y?0:E(v)}d={id:c.id,kind:w,nullable:a,values:p,presence:g,offsets:null,table:null};break}case"bitset":{const p=new Uint8Array(o+7>>3);for(let m=0;m<o;m++){const v=f[m],y=v===null;y||k(m),!y&&v&&(p[m>>3]|=1<<(m&7))}d={id:c.id,kind:w,nullable:a,values:p,presence:g,offsets:null,table:null};break}case"dictionary":{const p=new Uint32Array(o),m=[],v=new Map;for(let y=0;y<o;y++){const T=f[y];if(T===null){p[y]=0;continue}k(y);let A=v.get(T);A===void 0&&(A=m.length,m.push(T),v.set(T,A)),p[y]=A}d={id:c.id,kind:w,nullable:a,values:p,presence:g,offsets:null,table:m};break}case"multi":{const p=[],m=new Map,v=new Uint32Array(o+1),y=[];for(let T=0;T<o;T++){const A=f[T];v[T]=y.length,A===null||k(T);const _=O(A);for(let R=0;R<_.length;R++){const I=_[R];let j=m.get(I);j===void 0&&(j=p.length,p.push(I),m.set(I,j)),y.push(j)}}v[o]=y.length,d={id:c.id,kind:w,nullable:a,values:Int32Array.from(y),presence:g,offsets:v,table:p};break}default:{const p=new Array(o);for(let m=0;m<o;m++){const v=f[m];v!==null&&k(m),p[m]=v}d={id:c.id,kind:"object",nullable:a,values:p,presence:g,offsets:null,table:null};break}}t.push(d)}return{count:o,columns:t}}function h(l){const r=[];if(!l||!Array.isArray(l.columns))return r;const n=o=>{ArrayBuffer.isView(o)&&o.buffer&&!r.includes(o.buffer)&&r.push(o.buffer)};for(const o of l.columns)n(o.values),n(o.presence),n(o.offsets);return r}}),Ue("packages/core/src/source/stream.js",function(e,H){"use strict";Object.defineProperty(e,"DEFAULT_PROMOTE_BELOW",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"createStreamSource",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return j}});const $=H("packages/core/src/internal/lru.js").Lru,B=H("packages/core/src/internal/predicates.js").isFunction,x=H("packages/core/src/internal/schedule.js"),Z=x.now,Y=x.nextFrame,U=x.cancelFrame,W=x.whenIdle,E=H("packages/core/src/internal/compare.js").defaultCompare,O=H("packages/core/src/internal/warn.js"),b=O.warnOnce,u=O.infoOnce,l=H("packages/core/src/internal/paths.js").getPath,r=H("packages/core/src/source/abort.js"),n=r.createAbortScope,o=r.isAbortError,i=H("packages/core/src/source/rows.js"),t=i.createRowFactory,c=i.lazyRowView,a=H("packages/core/src/source/gapbuffer.js").GapBuffer,w=H("packages/core/src/source/memory.js").createMemorySource,k=H("packages/core/src/source/filterwire.js").querySignature,p=H("packages/core/src/store/columnpack.js").isPortableSchema,m=25e4,v=Symbol("lattice.stream.storeBacked"),y=8,T=.1,A=1e3,M=50;function _(L){return Math.min(A,Math.max(M,Math.floor(L/4)))}function R(L){if(L instanceof Date)return L.getTime();if(typeof L=="number")return Number.isFinite(L)?L:NaN;if(typeof L=="string"){const F=L.trim();if(!F)return NaN;const N=Date.parse(F);return Number.isNaN(N)?Number(F):N}return NaN}function I(L,F){return new j(L,F)}class j{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#i=[];#s=null;#o;#l;#a=new Map;#c=n();#u={loaded:0,estimated:void 0};#f=null;#d=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;#N=0;#P=null;#M=1/0;#R=!1;#$=null;#U=null;#K=null;#x=null;#I=!1;#Y=0;#F=0;#G=!1;constructor(F,N){this.#e=F||{mode:"stream"},this.#t=N||{},this.#o=t(this.#t),this.#l=new $(4096),this.#T=this.#We();const S=(this.#t.config||{}).ingest;this.#I=!!S&&S.retainSource===!1,B(this.#e.open)||b("source.stream.open",'source.mode "stream" requires an open function; the grid will stay empty.'),this.#e.autoStart!==!1&&queueMicrotask(()=>this.start());const C=Number(this.#e.poll);Number.isFinite(C)&&C>0&&(this.#x=setInterval(()=>{this.#v||this.reload()},C),this.#x&&B(this.#x.unref)&&this.#x.unref()),this.#z()}#H(){const F=Number(this.#e.maxAge);return Number.isFinite(F)&&F>0?F:0}#z(){const F=this.#H();if(!F)return;const N=this.#e.ageBy;B(N)?this.#U=N:typeof N=="string"&&N?this.#U=S=>l(S,N):this.#U=null,this.#P=[],this.#$=setInterval(()=>{this.#v||this.#fe()&&(this.#q(),this.#ce())},_(F)),this.#$&&B(this.#$.unref)&&this.#$.unref()}#fe(){const F=this.#H();return!F||!this.#P?!1:this.#R?!0:this.#M<Date.now()-F*(1+T)}#ne(F,N){if(!this.#P)return;const S=this.#U?R(this.#U(N)):Date.now();this.#P[F]=S,Number.isNaN(S)||(S<this.#M&&(this.#M=S),S<Date.now()-this.#H()&&(this.#R=!0))}#pe(){return this.#be("groupBy",[]).length>0?!0:!!this.#be("pivotMode",!1)&&this.#be("pivotBy",[]).length>0}#Fe(){if(this.#g||this.#v)return;const F=this.#pe();if(F&&!this.#b){this.#b=w({mode:"memory",rows:this.#n},this.#Oe()),this.#A=!1;return}!F&&this.#b&&(this.#b.destroy(),this.#b=null)}#Oe(){if(this.#y)return this.#y;const F=this,N={liveIndices:()=>F.#me(),live:S=>F.#n[S]!==void 0,source:S=>F.#Se(S),get physical(){return F.#n.length}};return this.#I&&(N.column=S=>{const C=F.#t.store;return C&&B(C.column)?C.column(S):void 0}),this.#y=Object.create(this.#t,{store:{value:N,enumerable:!0,configurable:!0}}),this.#y}#me(){const F=new Uint32Array(this.#n.length);let N=0;for(let S=0;S<this.#n.length;S++)this.#n[S]!==void 0&&(F[N++]=S);return F.subarray(0,N)}#ye(){return this.#g?this.#g:this.#b?(this.#A&&(this.#A=!1,this.#b.setRows(this.#n)),this.#b):null}invalidate(F="filter"){if(this.#g){this.#g.invalidate(F);return}this.#Fe(),this.#b&&this.#b.invalidate(F),(F==="filter"||F==="sort")&&this.#Te()}count(){const F=this.#ye();return F?F.count():this.#r?this.#r.length:this.#S}matchCount(){const F=this.#ye();return F&&B(F.matchCount)?F.matchCount():this.#r?this.#r.length:this.#S}totalCount(){const F=this.#ye();return F&&B(F.totalCount)?F.totalCount():this.#S}unfilteredRows(){const F=this.#ye();if(F&&B(F.unfilteredRows))return F.unfilteredRows();const N=[];for(let S=0;S<this.#n.length;S++){if(!this.#n[S])continue;const C=this.#Re(S);C&&N.push(C)}return N}at(F){const N=this.#ye();if(N)return N.at(F);if(F<0||F>=this.count())return;const S=this.#r?this.#r.at(F):F,C=this.#Re(S);return C.index=F,C}byKey(F){const N=this.#ye();if(N)return N.byKey(F);const S=this.#a.get(F);return S===void 0?void 0:this.#Re(S)}leavesOf(F){const N=this.#ye();return N&&B(N.leavesOf)?N.leavesOf(F):[]}loaded(F){return F>=0&&F<this.count()}hint(F,N){if(this.#g){this.#g.hint(F,N);return}this.#Pe(),this.#p=Math.max(0,Math.floor(F))}#Pe(){this.#v||this.#We()===this.#T||this.reload()}display(){const F=this.#ye();return F?F.display():c(()=>this.count(),N=>this.at(N))}apply(F){if(this.#g)return this.#g.apply(F);const N={added:[],updated:[],removed:[]};if(!F)return N;if(F.update){let S=!1;for(const C of F.update){const D=this.#a.get(this.#o.keyOf(C,-1));if(D===void 0)continue;const G=this.#Be(D);this.#I?this.#ze(D,C):this.#n[D]=C,this.#l.delete(D),this.#B(D,G),this.#P&&(this.#ne(D,C),S=!0),this.#A=!0,N.updated.push(this.#Re(D))}S&&this.#q()}if(F.add&&F.add.length){const S=this.#D(F.add);for(const C of S)N.added.push(this.#Re(C))}return F.remove&&F.remove.length&&b("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#ce(),N}reload(F){this.#c.abortAll("reload"),this.#_e(),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.#N=0,this.#P&&(this.#P=[]),this.#M=1/0,this.#R=!1,this.#w=!1,this.#O=!1,this.#u={loaded:0,estimated:void 0},this.#T=this.#We(),this.#ke("model:changed",{reason:"reload"}),this.start()}destroy(){this.#v=!0,this.#x!==null&&(clearInterval(this.#x),this.#x=null),this.#$!==null&&(clearInterval(this.#$),this.#$=null),this.#P=null,this.#c.abortAll("destroyed"),this.#_e(),this.#f!==null&&(this.#k(this.#f),this.#f=null),this.#b&&(this.#b.destroy(),this.#b=null),this.#g&&this.#g.destroy(),this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear()}async start(){if(this.#O||this.#v||!B(this.#e.open))return;this.#O=!0;const F=this.#c.begin("stream");this.#Te(),this.#Fe();let N;try{N=this.#e.open({sort:this.#be("sort",[]),filters:this.#be("filters",null),quick:this.#be("quick","")||void 0,context:this.#be("context",null),signal:F.signal})}catch(C){this.#ke("source:error",{error:C});return}const S=B(N[Symbol.asyncIterator])?N[Symbol.asyncIterator]():N[Symbol.iterator]();this.#K=S;try{for(;;){const C=await S.next();if(!F.current||this.#v)return;if(C.done){this.#se();return}if(await this.#de(C.value,F),!F.current||this.#v)return;if(C.value&&C.value.done){this.#se();return}if(await this.#oe(),!F.current||this.#v)return}}catch(C){if(o(C))return;this.#ke("source:error",{error:C})}finally{F.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 F=this.#ye();F&&(B(F.invalidateHandles)&&F.invalidateHandles(),B(F.invalidate)&&F.invalidate("sort"))}renderCount(){return this.#d}ingestStats(){return{worker:this.#Y,inline:this.#F,storeBacked:this.#I}}#de(F,N){if(!F)return;const S=F.rows;if(S&&S.length&&this.#Ce(S))return this.#J(F,N);const C=Z();S&&S.length&&(this.#D(S),this.#F++),this.#ie(F),this.#h+=Z()-C,this.#ce()}#ie(F){this.#u.loaded=F.progress&&typeof F.progress.loaded=="number"?F.progress.loaded:this.#n.length,F.progress&&typeof F.progress.estimated=="number"&&(this.#u.estimated=F.progress.estimated)}#Ce(F){if(this.#G||this.#g)return!1;const N=this.#W();if(!N)return!1;const S=this.#t.store;if(!S||!B(S.appendPacked))return!1;const C=this.#X();return!C||!p(C)?(this.#G=!0,u("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):F.length<N.threshold?!1:!this.#te(F)}#te(F){if(!this.#o.keyed)return!1;const N=new Set;for(let S=0;S<F.length;S++){const C=this.#o.keyOf(F[S],this.#n.length+S);if(C!=null){if(N.has(C)||this.#a.has(C))return!0;N.add(C)}}return!1}async#J(F,N){const S=F.rows,C=this.#W(),D=this.#X();let G;try{G=await C.columnize(D,S,{key:"ingest:stream",signal:N&&N.signal})}catch(te){if(o(te)||(b("source.stream.columnize","worker columnization failed; columnizing on the main thread",te),this.#G=!0,N&&(!N.current||this.#v)))return;this.#D(S),this.#F++,this.#ie(F),this.#ce();return}if(N&&(!N.current||this.#v))return;const X=this.#t.store,V=this.#I?void 0:S,{from:J}=X.appendPacked(G,V),ee=G.count|0;for(let te=0;te<ee;te++){const ie=J+te,oe=S[te],ue=this.#o.keyed?this.#o.keyOf(oe,ie):null;if(this.#n[ie]=this.#I?v:oe,this.#S++,this.#ne(ie,oe),ue!==null&&this.#a.set(ue,ie),!this.#r||!this.#le(ie))continue;const ye=this.#C(ie);this.#r.insert(ye,ie),ye<=this.#p&&this.#m++}this.#A=!0,this.#q(),this.#Y++,this.#ie(F),this.#ce()}#W(){const F=this.#t.ingestWorker;return B(F)?F():null}#X(){const F=this.#t.storeSchema;return B(F)?F():null}#D(F){const N=[],S=this.#t.store,C=new Array(F.length),D=[],G=new Set;for(let V=0;V<F.length;V++){const J=this.#o.keyed?this.#o.keyOf(F[V],this.#n.length+D.length):null;C[V]=J,!(J!==null&&(this.#a.has(J)||G.has(J)))&&(J!==null&&G.add(J),D.push(F[V]))}let X=D.length&&S&&B(S.append)?S.append(D).from:this.#n.length;for(let V=0;V<F.length;V++){const J=F[V],ee=C[V];if(ee!==null&&this.#a.has(ee)){const oe=this.#a.get(ee),ue=this.#Be(oe);this.#I||(this.#n[oe]=J,S&&B(S.setSource)&&S.setSource(oe,J)),this.#ze(oe,J),this.#l.delete(oe),this.#ne(oe,J),this.#B(oe,ue);continue}const te=X++;if(this.#n[te]=this.#I?v:J,this.#S++,this.#ne(te,J),ee!==null&&this.#a.set(ee,te),N.push(te),!this.#r||!this.#le(te))continue;const ie=this.#C(te);this.#r.insert(ie,te),ie<=this.#p&&this.#m++}return this.#A=!0,this.#q(),N}#Ne(F){const N=this.#n[F];let S=!1;if(this.#r){const X=this.#Ee(F);X>=0&&X<=this.#p&&(S=!0)}else F<=this.#p&&(S=!0);const C=N===v?this.#Se(F):N,D=this.#o.keyed?this.#o.keyOf(C,F):null;D!==null&&this.#a.get(D)===F&&this.#a.delete(D),this.#n[F]=void 0,this.#P&&(this.#P[F]=NaN),this.#l.delete(F);const G=this.#t.store;return G&&B(G.remove)&&G.remove(F),this.#S--,S}#q(){let F=0,N=0;const S=this.#ve();F+=S.dropped,N+=S.aboveAnchor;const C=this.#re();F+=C.dropped,N+=C.aboveAnchor,F&&(this.#A=!0,this.#E+=F,this.#Te(),this.#m-=N,this.#ke("stream:evicted",{evicted:F,total:this.#E,live:this.#S}))}#re(){const F=this.#e.maxRows;if(!Number.isFinite(F)||F<=0||this.#S<=F)return{dropped:0,aboveAnchor:0};const N=Math.max(1,Math.floor(F*(1-T)));let S=0,C=0;for(;this.#S>N&&this.#N<this.#n.length;){const D=this.#N++;this.#n[D]!==void 0&&(this.#Ne(D)&&C++,S++)}return{dropped:S,aboveAnchor:C}}#ve(){const F=this.#H();if(!F||!this.#P||!this.#fe())return{dropped:0,aboveAnchor:0};const N=Date.now()-F;let S=0,C=0,D=1/0;for(let G=this.#N;G<this.#n.length;G++){if(this.#n[G]===void 0)continue;const X=this.#P[G];if(!(Number.isNaN(X)||X===void 0)){if(X>=N){X<D&&(D=X);continue}this.#Ne(G)&&C++,S++}}for(this.#M=D,this.#R=!1;this.#N<this.#n.length&&this.#n[this.#N]===void 0;)this.#N++;return{dropped:S,aboveAnchor:C}}#Ee(F){if(!this.#r)return F;for(let N=0;N<this.#r.length;N++)if(this.#r.at(N)===F)return N;return-1}#Te(){this.#i=this.#be("sort",[]),this.#s=this.#be("filters",null);const F=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#H()>0,N=this.#be("where",null),S=(this.#t.config||{}).hostFilter,C=!!(N&&N.active)||!!(S&&B(S.active)&&S.active());if(!(F||this.#i.length>0||!!this.#s||!!this.#be("quick","")||C)){this.#r=null;return}this.#r=new a(Math.max(64,this.#n.length+64));for(let G=0;G<this.#n.length;G++)this.#n[G]!==void 0&&this.#le(G)&&this.#r.insert(this.#C(G),G)}#le(F){const N=this.#Se(F);if(this.#s&&!this.#he(this.#s,N))return!1;const S=String(this.#be("quick","")||"").toLowerCase();if(S&&!this.#Ye(N).includes(S))return!1;const C=(this.#t.config||{}).hostFilter;if(C&&B(C.active)&&C.active()&&!C.passes(this.#Re(F)))return!1;const D=this.#be("where",null);if(D&&D.active){const G=this.#Re(F);if(!D.passes(G.data,G.key))return!1}return!0}#he(F,N){if(!F)return!0;const S=F;if(Array.isArray(S.conditions))return S.op==="or"?S.conditions.some(G=>this.#he(G,N)):S.op==="not"?!S.conditions.some(G=>this.#he(G,N)):S.conditions.every(G=>this.#he(G,N));const C=F,D=(this.#t.compute||{}).testValue;return B(D)?!!D(this.#Ie(N,C.col),C,(this.#t.config||{}).locale):(b("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#Be(F){if(!this.#r)return-1;if(!this.#i.length)return this.#Ee(F);let N=0,S=this.#r.length;for(;N<S;){const C=N+S>>>1;this.#_(this.#r.at(C),F)<0?N=C+1:S=C}for(let C=N;C<this.#r.length;C++){const D=this.#r.at(C);if(D===F)return C;if(this.#_(D,F)>0)break}return this.#Ee(F)}#B(F,N){if(!this.#r||!this.#i.length)return;const S=this.#le(F);if(N>=0&&this.#r.at(N)===F)this.#r.removeAt(N),N<=this.#p&&this.#m--;else if(N>=0)return;if(!S)return;const C=this.#C(F);this.#r.insert(C,F),C<=this.#p&&this.#m++}#C(F){if(!this.#r||!this.#i.length)return this.#r?this.#r.length:0;let N=0,S=this.#r.length;for(;N<S;){const C=N+S>>>1;this.#_(F,this.#r.at(C))<0?S=C:N=C+1}return N}#_(F,N){const S=this.#Se(F),C=this.#Se(N);for(const D of this.#i){const G=this.#Ve(D.col),X=this.#Ie(S,D.col),V=this.#Ie(C,D.col),ee=(G&&G.value&&B(G.value.compare)?G.value.compare:E)(X,V);if(ee!==0)return D.dir==="desc"?-ee:ee}return 0}#se(){this.#w=!0,this.#u.loaded=this.#u.loaded||this.#n.length;const F=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:m;!this.#I&&this.#n.length<F&&(this.#g=w({mode:"memory",rows:this.#n},this.#t),this.#$!==null&&(clearInterval(this.#$),this.#$=null),this.#b&&(this.#b.destroy(),this.#b=null)),this.#ce(),this.#ke("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:F})}#ce(){this.#f!==null||this.#v||(this.#f=this.#we(()=>{this.#f=null,this.#d++;const F=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.#d}),this.#ke("model:changed",{reason:"stream",shiftAboveViewport:F,anchor:this.#p}),this.#ke("rows:changed",{companion:!0,reason:"stream"})}))}#oe(){return this.#d===0||this.#h<this.#ge()?Promise.resolve():(this.#h=0,new Promise(F=>{const N=(this.#t.scheduler||{}).idle;B(N)?N(()=>F()):W(()=>F())}))}#ge(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:y}#we(F){const N=this.#t.scheduler||{};return B(N.frame)?N.frame(F):Y(F)}#k(F){const N=this.#t.scheduler||{};B(N.cancel)?N.cancel(F):U(F)}#Se(F){const N=this.#n[F];if(N!==void 0&&N!==v)return N;if(N===void 0)return;const S=this.#t.store;return S&&B(S.source)?S.source(F):void 0}#ze(F,N){const S=this.#t.store;if(!S||!B(S.set))return;const C=this.#X();if(Array.isArray(C))for(const D of C){if(!D||!D.id)continue;const G=B(D.read)?D.read:X=>l(X,D.field||D.id);S.set(D.id,F,G(N))}}#Re(F){let N=this.#l.get(F);return N||(N=this.#o.leaf(this.#Se(F),F),this.#l.set(F,N)),N}#Ie(F,N){const S=this.#Ve(N);return S&&B(S.getValue)?S.getValue(F):F?.[N]}#Ye(F){const N=this.#t.columns,S=N&&B(N.all)?N.all():[],C=[];for(const D of S){const G=B(D.getValue)?D.getValue(F):void 0;G!=null&&G!==""&&C.push(String(G))}return C.join(" ").toLowerCase()}#Ve(F){const N=this.#t.columns;return N&&B(N.get)?N.get(F):void 0}#_e(){const F=this.#K;if(this.#K=null,F&&B(F.return))try{F.return()}catch{}}#We(){return k({context:this.#be("context",null)})}#be(F,N){const S=this.#t.state;if(S&&B(S[F])){const C=S[F]();return C??N}return N}#ke(F,N){const S=this.#t.emit;B(S)&&S(F,N)}}}),Ue("packages/core/src/source/url.js",function(e,H){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return b}});const $=H("packages/core/src/internal/warn.js").warnOnce,q=H("packages/core/src/internal/predicates.js"),B=q.isObject,x=q.isFunction,Y=H("packages/core/src/internal/paths.js").getPath,W=H("packages/core/src/source/abort.js").isAbortError,K=500,E=new Set(["application/x-ndjson","application/ndjson","application/jsonlines","application/jsonl","application/x-jsonlines","text/x-ndjson"]),O=Symbol("lattice.url.skip");function b(g,k={}){const d=B(k)?k:{},p=x(d.fetch)?d.fetch:typeof globalThis<"u"&&x(globalThis.fetch)?globalThis.fetch:null,m=d.format==="json"||d.format==="ndjson"?d.format:void 0,v=typeof d.rowsPath=="string"&&d.rowsPath?d.rowsPath:void 0,y=x(d.map)?d.map:void 0,T=B(d.headers)?d.headers:void 0,A=Number.isFinite(d.batchSize)&&d.batchSize>0?Math.floor(d.batchSize):K,M=d.lenient===!0,_=Number.isFinite(d.poll)&&d.poll>0?Math.floor(d.poll):void 0,R=typeof g=="string"&&g.length>0;R||$("source.url.url","createUrlSource needs a URL string; the grid will stay empty.");async function*I(L={}){if(!R)return;if(!p)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const F=L&&L.signal;let N;try{N=await p(g,T?{signal:F,headers:T}:{signal:F})}catch(D){throw W(D)?D:new Error(`[lattice] createUrlSource: request to ${g} failed — ${D&&D.message||D}`)}if(!N||!N.ok){const D=N?N.status:"no response";throw new Error(`[lattice] createUrlSource: ${D} for ${g}`)}const S=u(g,m,N),C=N.body&&x(N.body.getReader)?N.body.getReader():null;try{if(!C){const X=await N.text();(S||r(X,g))==="ndjson"?yield*s(null,null,X,0,N,g,A,M):yield*c(X,g,v,y);return}const D=new TextDecoder("utf-8");if(S==="json"){yield*c(await t(C,D,""),g,v,y);return}if(S==="ndjson"){yield*s(C,D,"",0,N,g,A,M);return}const G=await n(C,D,g);G.format==="json"?yield*c(await t(C,D,G.seed),g,v,y):yield*s(C,D,G.seed,G.bytes,N,g,A,M)}finally{if(C&&x(C.cancel))try{await C.cancel()}catch{}}}const j={mode:"stream",open:I,autoStart:d.autoStart!==!1};return _!==void 0&&(j.poll=_),Number.isFinite(d.maxRows)&&(j.maxRows=d.maxRows),Number.isFinite(d.maxAge)&&(j.maxAge=d.maxAge),(typeof d.ageBy=="string"||x(d.ageBy))&&(j.ageBy=d.ageBy),Number.isFinite(d.coalesceMs)&&(j.coalesceMs=d.coalesceMs),Number.isFinite(d.promoteToMemoryBelow)&&(j.promoteToMemoryBelow=d.promoteToMemoryBelow),j}function u(g,k,d){if(k)return k;const p=h(g);if(p)return p;const m=d&&d.headers&&x(d.headers.get)?d.headers.get("content-type"):null;return l(m)}function h(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(E.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=o(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 n(g,k,d){let p="",m=0;for(;;){const{value:y,done:T}=await g.read();if(y&&(m+=y.byteLength,p+=k.decode(y,{stream:!0})),T){p+=k.decode();break}const A=p.replace(/^\s+/,"");if(A){if(A[0]==="[")return{format:"json",seed:p,bytes:m};if(A[0]!=="{"||p.indexOf(`
|
|
8
8
|
`)!==-1)break}}const v=o(p.replace(/^\s+/,""));if(v==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${d} — pass opts.format: 'json' | 'ndjson'.`);return{format:v,seed:p,bytes:m}}function o(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)),i(d)?"ndjson":"json"}function i(g){try{return JSON.parse(g),!0}catch{return!1}}async function t(g,k,d){let p=d;for(;;){const{value:m,done:v}=await g.read();if(m&&(p+=k.decode(m,{stream:!0})),v)break}return p+=k.decode(),p}function*c(g,k,d,p){let m;try{m=JSON.parse(g)}catch(y){throw new Error(`[lattice] createUrlSource: ${k} is not valid JSON — ${y.message}`)}let v=d!==void 0?Y(m,d):m;if(p&&(v=p(v)),!Array.isArray(v)){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:v,progress:{loaded:v.length,estimated:v.length}}}async function*s(g,k,d,p,m,v,y,T){const A=w(m);let M=d||"",_=p||0,R=0,I=0,j=[];function*L(){let N;for(;(N=M.indexOf(`
|
|
10
10
|
`))!==-1;){const S=M.slice(0,N);M=M.slice(N+1),I++;const C=a(S,I,v,T);C!==O&&(j.push(C),j.length>=y&&(R+=j.length,yield f(j,R,A,_),j=[]))}}if(g){for(;;){const{value:N,done:S}=await g.read();if(N&&(_+=N.byteLength,M+=k.decode(N,{stream:!0}),yield*L()),S)break}M+=k.decode()}yield*L(),I++;const F=a(M,I,v,T);F!==O&&j.push(F),j.length&&(R+=j.length,yield f(j,R,A,_))}function a(g,k,d,p){let m=g;if(m.endsWith("\r")&&(m=m.slice(0,-1)),!m.trim())return O;try{return JSON.parse(m)}catch(v){if(p)return $(`source.url.badline.${d}`,`skipping a malformed NDJSON line (line ${k}) from ${d} — ${v.message}`),O;throw new Error(`[lattice] createUrlSource: malformed NDJSON at line ${k} of ${d} — ${v.message}`)}}function f(g,k,d,p){const m=d&&p>0&&k>0?Math.max(k,Math.round(d/(p/k))):void 0;return{rows:g,progress:{loaded:k,estimated:m}}}function w(g){const k=g&&g.headers&&x(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,H){"use strict";Object.defineProperty(e,"FOLLOW_MODES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"BUCKETS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"DERIVED_ROW_KEY",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"DERIVED_SOURCE_KEY",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"UNION_KEY_SEP",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"readPath",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"unnest",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"reduceValues",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"applyLimit",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"applyCumulative",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"groupRows",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"finishGroups",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"derive",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"normalizeUnionSource",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"namespaceUnionKeys",{enumerable:!0,get:function(){return w}}),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 m}});const ne=H("packages/core/src/internal/predicates.js"),$=ne.isFunction,q=ne.isObject,x=H("packages/core/src/compute/total.js").TOTAL_FNS,Z=Object.freeze(["filtered","all","selected","grouped"]),Y=Object.freeze(["day","week","month","quarter","year"]),U="__key",W="__source",K="";function E(v,y){if(!q(v)||typeof y!="string")return;if(!y.includes("."))return v[y];let T=v;for(const A of y.split(".")){if(!q(T))return;T=T[A]}return T}function O(v,y){const T=[];for(const A of v){const M=E(A,y);if(!(!Array.isArray(M)||!M.length))for(const _ of M)T.push({...A,[y]:_})}return T}function b(v,y){const T=v instanceof Date?v:new Date(v),A=T.getTime();if(!Number.isFinite(A))return null;const M=T.getUTCFullYear(),_=T.getUTCMonth(),R=T.getUTCDate(),I=j=>j.toISOString().slice(0,10);switch(y){case"year":return I(new Date(Date.UTC(M,0,1)));case"quarter":return I(new Date(Date.UTC(M,Math.floor(_/3)*3,1)));case"month":return I(new Date(Date.UTC(M,_,1)));case"week":{const j=(T.getUTCDay()+6)%7;return I(new Date(Date.UTC(M,_,R-j)))}default:return I(new Date(Date.UTC(M,_,R)))}}function u(v,y,T){const A=y.map(M=>T&&T.of===M?b(E(v,M),T.by):E(v,M));return{key:A.map(M=>M==null?"\0":String(M)).join(""),values:A}}function h(v,y){const T=x[y];return T?T({get:A=>v[A]},n(v.length)):null}function l(v,y){return!y||typeof y.of!="string"||y.of===""||v&&v.includes(y.of)?v:[y.of,...v||[]]}function r(v,y){const T={},A=n(v.length);for(const[M,_]of Object.entries(y)){const R=_.fn||"count",I=x[R];if(!I){T[M]=null;continue}const j=_.of?v.map(L=>E(L,_.of)):[];T[M]=I({get:L=>j[L]},A)}return T}const n=(()=>{const v=new Map;return y=>{let T=v.get(y);if(!T){T=new Uint32Array(y);for(let A=0;A<y;A++)T[A]=A;v.size<512&&v.set(y,T)}return T}})();function o(v,y,T){if(!Number.isFinite(y)||y<=0)return v;if(!T)return v.slice(0,y);const A=new Map,M=[];for(const _ of v){const R=String(E(_,T)),I=A.get(R)||0;I>=y||(A.set(R,I+1),M.push(_))}return M}function i(v,y){const T=v.reduce((R,I)=>R+(Number(E(I,y.of))||0),0);if(!T)return v;const A=T*y.upTo;let M=0;const _=[];for(const R of v)if(_.push(R),M+=Number(E(R,y.of))||0,M>=A)break;return _}function t(v,y){return!Array.isArray(y)||!y.length?v:[...v].sort((T,A)=>{for(const M of y){const _=E(T,M.col),R=E(A,M.col);if(_===R)continue;return _==null?1:R==null?-1:((typeof _=="number"&&typeof R=="number"?_<R:String(_)<String(R))?-1:1)*(M.dir==="desc"?-1:1)}return 0})}function c(v,y,T){const A=y.groupBy?Array.isArray(y.groupBy)?y.groupBy:[y.groupBy]:null,M=q(y.bucket)?y.bucket:null,_=l(A,M),R=new Map,I=new Map;if(!_)return{groups:R,rowGroup:I};for(const j of v){const{key:L,values:F}=u(j,_,M);let N=R.get(L);N||(N={values:F,rows:new Map},R.set(L,N));const S=T(j);N.rows.set(S,j),I.set(S,L)}return{groups:R,rowGroup:I}}function s(v,y,T=null,A=null){const M=y.groupBy?Array.isArray(y.groupBy)?y.groupBy:[y.groupBy]:null,_=q(y.bucket)?y.bucket:null,R=l(M,_);let I=[...v.entries()].map(([j,L])=>{if(T&&A&&!A.has(j)){const N=T.get(j);if(N)return N}const F={[U]:j};return R.forEach((N,S)=>{F[N.includes(".")?N.split(".").pop():N]=L.values[S]}),Object.assign(F,r([...L.rows.values()],y.select||{})),T&&T.set(j,F),F});return I=t(I,y.sort),q(y.cumulative)&&(I=i(I,y.cumulative)),o(I,y.limit,y.limitPer||null)}function a(v,y){const T=k(v,y),A=y.groupBy?Array.isArray(y.groupBy)?y.groupBy:[y.groupBy]:null,M=q(y.bucket)?y.bucket:null,_=l(A,M);let R;if(!_)R=T.map((I,j)=>({...I,[U]:String(E(I,y.rowKey||"id")??j)}));else{const I=new Map;for(const j of T){const{key:L,values:F}=u(j,_,M);let N=I.get(L);N||(N={values:F,rows:[]},I.set(L,N)),N.rows.push(j)}R=[...I.entries()].map(([j,L])=>{const F={[U]:j};return _.forEach((N,S)=>{F[N.includes(".")?N.split(".").pop():N]=L.values[S]}),Object.assign(F,r(L.rows,y.select||{})),F})}return R=t(R,y.sort),q(y.cumulative)&&(R=i(R,y.cumulative)),o(R,y.limit,y.limitPer||null)}function f(v,y){const A=q(v)&&q(v.grid)?v:{grid:v};return{grid:q(A.grid)?A.grid:null,label:A.label!=null&&A.label!==""?String(A.label):String(y),follow:typeof A.follow=="string"?A.follow:void 0,map:$(A.map)?A.map:null}}function w(v){for(const y of v){const T=y[W];T!==void 0&&(y[U]=`${T}${K}${y[U]}`)}return v}function g(v,y){const T=y.on,A=q(T)?String(T.left||T.right||""):String(T||""),M=q(T)?String(T.right||T.left||""):String(T||"");if(!A||!M)return v;const _=y.index instanceof Map?y.index:d(Array.isArray(y.rows)?y.rows:[],M),R=Array.isArray(y.select)?y.select.map(String):null,I=y.prefix?String(y.prefix):"",j=String(y.type||"inner")==="left",L=[];for(const F of v){const N=E(F,A),S=N==null?void 0:_.get(String(N));if(!S){j&&L.push(F);continue}const C={...F},D=R||Object.keys(S);for(const G of D)!I&&G===A||(C[I?I+G:G]=E(S,G));L.push(C)}return L}function k(v,y){let T=Array.isArray(v)?v:[];return y.unnest&&(T=O(T,y.unnest)),q(y.join)&&(Array.isArray(y.join.rows)||y.join.index instanceof Map)&&(T=g(T,y.join)),$(y.where)&&(T=T.filter(A=>!!y.where(A))),T}function d(v,y){const T=new Map;for(const A of v){const M=E(A,y);if(M==null)continue;const _=String(M);T.has(_)||T.set(_,A)}return T}function p(v,y){const T=y.on,A=q(T)?String(T.left||T.right||""):String(T||""),M=q(T)?String(T.right||T.left||""):String(T||"");if(!A||!M)return v;const _=y.index instanceof Map?y.index:new Map,R=E(v,A),I=R==null?void 0:_.get(String(R));if(!I)return String(y.type||"inner")==="left"?v:null;const j=Array.isArray(y.select)?y.select.map(String):null,L=y.prefix?String(y.prefix):"",F={...v};for(const N of j||Object.keys(I))!L&&N===A||(F[L?L+N:N]=E(I,N));return F}function m(v,y){const T=E(v,y);return T==null?null:String(T)}}),Ue("packages/core/src/source/derived.js",function(e,H){"use strict";Object.defineProperty(e,"IDLE_REFRESH_MS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"PROFILE_FIELDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ALERT_THRESHOLDS",{enumerable:!0,get:function(){return w}}),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 m}}),Object.defineProperty(e,"createDerivedSource",{enumerable:!0,get:function(){return M}});const ne=H("packages/core/src/internal/predicates.js"),$=ne.isFunction,q=ne.isObject,x=H("packages/core/src/internal/warn.js").warnOnce,Y=H("packages/core/src/source/memory.js").MemorySource,W=H("packages/core/src/source/settle.js").isPipelineSettle,K=H("packages/core/src/source/derive.js"),E=K.derive,O=K.preGroup,b=K.groupRows,u=K.finishGroups,h=K.readPath,l=K.buildJoinIndex,r=K.joinOne,n=K.joinKeyOf,o=K.FOLLOW_MODES,i=K.DERIVED_ROW_KEY,t=K.DERIVED_SOURCE_KEY,c=K.normalizeUnionSource,s=K.namespaceUnionKeys,a=16,f=Object.freeze(["column","rows","present","missing","numeric","distinct","min","max","mean","median","q1","q3","iqr","stddev","outliers","alerts","alertCount"]),w=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(_,R={}){const I={...w,...q(R)?R:{}},j=ee=>typeof ee=="number"&&Number.isFinite(ee)?ee:null,L=j(_.rows)??0,F=j(_.numeric)??0,N=j(_.missing)??0,S=j(_.distinct),C=j(_.mean),D=j(_.median),G=j(_.stddev),X=j(Array.isArray(_.outliers)?_.outliers.length:_.outliers),V=F>0,J=[];return S===0?["empty"]:(S===1&&J.push("constant"),L>0&&N/L>=I.missing&&J.push("high-missing"),!V&&S!==null&&L>1&&S===L&&N===0?J.push("unique"):S!==null&&L>0&&S/L>=I.cardinality&&J.push("high-cardinality"),V&&C!==null&&D!==null&&G!==null&&G>0&&Math.abs(3*(C-D)/G)>=I.skew&&J.push("skewed"),V&&X!==null&&X/F>=I.outliers&&J.push("outliers"),J)}class m extends Y{#e=null;#t={};#n=[];#r=null;#i=!1;#s={};#o=!1;#l=null;#a=null;#c=!1;#u=null;#f=!1;#d=null;constructor(R,I){super({mode:"memory",rows:[]},I),this.#s=I||{},this.#t=q(R)?R:{};const j=this.#t.from;if(Array.isArray(j)){if(this.#e=null,this.#d=this.#g(j),!this.#d.length){x("source.derived.from",'source.mode "derived" needs `from`: at least one grid to derive from.');return}this.#t.follow!==void 0&&x("source.derived.union.follow",'source.mode "derived": `follow` is ignored when `from` is a union of several grids (BACKLOG-0001045) — each entry carries its own `follow` instead.'),this.#t.crossFilter&&x("source.derived.union.crossfilter",'source.mode "derived": `crossFilter` is not supported when `from` is a union of several grids (BACKLOG-0001045) — it has no single target once there is more than one parent. Push a filter onto the individual source grid you mean instead.'),this.#t.statistics!==void 0&&(x("source.derived.union.statistics",'source.mode "derived": `statistics` is not supported when `from` is a union of several grids (BACKLOG-0001046) — a relational statistic reduces one grid\'s own columns, and a union has no single set of them. Derive the statistics of a single grid instead.'),this.#f=!0),this.#m(),this.#b(),this.refresh();return}if(this.#e=j||null,!this.#e){x("source.derived.from",'source.mode "derived" needs `from`: the grid to derive from.');return}this.#t.follow&&!o.includes(String(this.#t.follow))&&x(`source.derived.follow.${this.#t.follow}`,`unknown follow "${this.#t.follow}"; using "filtered". Known: ${o.join(", ")}.`),this.#h()||(this.#f=!0),this.#m(),this.#b(),this.refresh()}#h(){const R=this.#t.statistics;if(R===void 0)return!0;if(this.#t.profile!==void 0)return x("source.derived.producer.conflict",'source.mode "derived": `profile` and `statistics` are both terminal producers and cannot be used together — each replaces the pipeline with its own output builder. Declare one, or chain a second derived grid whose `from` is the first.'),!1;if(!q(R))return x("source.derived.statistics.shape",`source.mode "derived": \`statistics\` needs an object naming the statistic, e.g. \`{ fn: 'correlation', columns: ['a', 'b'] }\`. Known fn: ${g.join(", ")}.`),!1;const I=String(R.fn||"");return g.includes(I)?this.#p(I,R):(x(`source.derived.statistics.fn.${I}`,`source.mode "derived": unknown \`statistics.fn\` "${I}". Known: ${g.join(", ")}. Every *single-column* statistic is reached through \`select\` instead, e.g. \`select: { p95: { of: 'amount', fn: 'p95' } }\`.`),!1)}#p(R,I){if(R==="correlation"){if((Array.isArray(I.columns)?I.columns.filter(Boolean):[]).length<2)return x("source.derived.statistics.columns","source.mode \"derived\": `statistics: { fn: 'correlation' }` needs `columns`: at least two column ids to correlate pairwise."),!1;const L=I.orient===void 0?"pairs":String(I.orient);return L!=="pairs"&&L!=="matrix"&&x(`source.derived.statistics.orient.${L}`,`source.mode "derived": unknown \`statistics.orient\` "${L}" for \`fn: 'correlation'\`; using "pairs". Known: pairs, matrix.`),!0}return R==="series"?!I.of||!I.by?(x("source.derived.statistics.series","source.mode \"derived\": `statistics: { fn: 'series' }` needs both `of` (the column to summarise) and `by` (the column that orders it). `by` is never guessed — kernels see rows in arrival order, which is not the grid's sort."),!1):!0:q(I.with)?!0:(x("source.derived.statistics.with","source.mode \"derived\": `statistics: { fn: 'datasetVsDataset' }` needs `with`: the second grid to compare this one against."),!1)}#m(){const R=this.#t.statistics!==void 0?"statistics":this.#t.profile!==void 0?"profile":null;if(!R)return;const I=d.filter(j=>this.#t[j]!==void 0);I.length&&x(`source.derived.producer.ignored.${R}`,`source.mode "derived": \`${R}\` is a terminal producer and replaces the pipeline, so ${I.map(j=>`\`${j}\``).join(", ")} ${I.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(R){const I=this.#s&&this.#s.grid,j=new Set,L=[];return R.forEach((F,N)=>{const S=c(F,N);if(j.has(S.label)&&x(`source.derived.union.label.${S.label}`,`source.mode "derived": two union sources share the label "${S.label}"; give each a distinct \`label\` or __source/__key will not distinguish them.`),j.add(S.label),!S.grid){x(`source.derived.union.missing.${S.label}`,`source.mode "derived": union source "${S.label}" has no grid and was skipped.`),L.push(S);return}if(I&&$(S.grid.on)){const C=y(I,S.grid,[S.label]);if(C){x(`source.derived.union.cycle.${S.label}`,`source.mode "derived": union source "${S.label}" was refused — it derives from the grid being derived, directly or through a chain (${C.join(" → ")}). Remove it from \`from\`.`),L.push({...S,grid:null});return}}L.push(S)}),L}#b(){if(this.#d){this.#A(),this.#w();return}const R=this.#e;if(!R||!$(R.on))return;const I=String(this.#t.follow||"filtered"),j=["rows:changed"];(I==="filtered"||I==="grouped")&&j.push("filter:changed","model:changed"),I==="selected"&&j.push("selection:changed"),I==="grouped"&&j.push("column:grouped");for(const L of j){const F=N=>{L==="rows:changed"&&v(N)||L==="model:changed"&&!W(N)||this.schedule(L==="rows:changed"?N:null)};R.on(L,F),this.#n.push(()=>$(R.off)&&R.off(L,F))}this.#w(),this.#y()}#y(){const R=this.#t.statistics,I=q(R)?R.with:null;if(!q(I)||!$(I.on))return;const j=I;for(const L of["rows:changed","filter:changed","model:changed"]){const F=N=>{L==="rows:changed"&&v(N)||L==="model:changed"&&!W(N)||this.schedule(null)};j.on(L,F),this.#n.push(()=>$(j.off)&&j.off(L,F))}}#A(){for(const R of this.#d){const I=R.grid;if(!I||!$(I.on))continue;const j=o.includes(String(R.follow))?String(R.follow):"filtered",L=["rows:changed"];(j==="filtered"||j==="grouped")&&L.push("filter:changed","model:changed"),j==="selected"&&L.push("selection:changed"),j==="grouped"&&L.push("column:grouped");for(const F of L){const N=S=>{F==="rows:changed"&&v(S)||F==="model:changed"&&!W(S)||this.schedule(null)};I.on(F,N),this.#n.push(()=>$(I.off)&&I.off(F,N))}}}#w(){const R=this.#t.join,I=R&&R.with;if(!I||!$(I.on))return;const L=String(R.follow||"all")==="all"?["rows:changed"]:["rows:changed","filter:changed","model:changed"];for(const F of L){const N=S=>{F==="rows:changed"&&v(S)||F==="model:changed"&&!W(S)||this.schedule({partner:!0})};I.on(F,N),this.#n.push(()=>$(I.off)&&I.off(F,N))}}#O(){const R=this.#t.join;if(!R||!R.with)return null;const I=R.on,j=q(I)?String(I.left||I.right||""):String(I||""),L=q(I)?String(I.right||I.left||""):String(I||"");return j&&L?{left:j,right:L}:null}#v(){const R=this.#O();if(!R)return this.#u=null,null;const I=this.#u;if(this.#u=l(this.#E(),R.right),!I)return null;const j=this.#t.join||{},L=Array.isArray(j.select)?j.select.map(String):null,F=C=>C?(L||Object.keys(C)).map(G=>String(h(C,G))).join(""):null,N=new Set,S=new Set;for(const[C,D]of this.#u)F(D)!==F(I.get(C))&&(N.add(C),I.has(C)||S.add(C));for(const C of I.keys())this.#u.has(C)||N.add(C);return{affected:N,gained:S}}#T(R,I){const j=this.#l;if(!j||!j.leftByJoinKey)return null;const L=[];for(const F of R){const N=j.leftByJoinKey.get(F);if(N)for(const S of N){const C=j.rowData.get(S);C!==void 0&&L.push({key:S,data:C})}}return this.#M({updated:L,added:[],removed:[]},I)}#S(R,I){if(!this.#l||!this.#l.leftByJoinKey||R.unnest||R.where||String(R.follow||"filtered")==="grouped")return!1;const j=R.join||{};return String(j.type||"inner")==="left"?!0:I.size===0}#E(){const R=this.#t.join,I=R&&R.with;if(!I||!I.rows)return[];const j=[],L=F=>{F.group||j.push(T(F))};return String(R.follow||"all")==="filtered"&&$(I.rows.forEach)?I.rows.forEach(L):$(I.rows.forEachAll)&&I.rows.forEachAll(L),j}schedule(R){const I=this.#t.refresh===void 0?"idle":this.#t.refresh;if(I==="manual")return;if(I==="live"){this.refresh(R);return}const j=typeof I=="number"&&Number.isFinite(I)?I:a;if(this.#r){this.#c=!0;return}this.#c=!1,this.#r=setTimeout(()=>{this.#r=null,this.refresh(this.#c?null:R)},j)}refresh(R){if(!(this.#i||!this.#e&&!this.#d)){if(this.#o){x("source.derived.cycle","a derived grid is deriving from itself, directly or through a chain. The cycle was refused; check the `from` of each grid in the chain.");return}this.#o=!0;try{const I=this.#f?[]:this.#d?this.#t.profile?this.#Y():this.#I():this.#t.statistics!==void 0?this.#ne():this.#t.profile?this.#me():this.#N(R);this.setRows(I),this.invalidate("filter"),$(this.#s.emit)&&this.#s.emit("rows:changed",{derived:!0},"derived")}finally{this.#o=!1}}}#N(R){const j=q(R)&&R.partner===!0?this.#v():null,L=this.#U();if(j&&this.#l){if(!j.affected.size)return u(this.#l.groups,L,this.#l.reduced,new Set);if(this.#S(L,j.gained)){const te=this.#T(j.affected,L);if(te)return u(this.#l.groups,L,this.#l.reduced,te)}}const F=this.#P(L,R);if(F&&this.#l){const te=this.#M(F,L);return u(this.#l.groups,L,this.#l.reduced,te)}const N=O(this.#F(),L);if(this.#a=this.#$(),!L.groupBy)return this.#l=null,E(N,L);const S=this.#R(),{groups:C,rowGroup:D}=b(N,L,S),G=new Map;for(const[te,ie]of D){const oe=C.get(ie);oe&&G.set(te,oe.rows.get(te))}const X=new Map,V=this.#O(),J=new Map,ee=new Map;if(V)for(const[te,ie]of G){const oe=n(ie,V.left);if(oe===null)continue;J.set(te,oe);let ue=ee.get(oe);ue||(ue=new Set,ee.set(oe,ue)),ue.add(te)}return this.#l={groups:C,rowGroup:D,rowData:G,reduced:X,leftJoinKey:J,leftByJoinKey:ee},u(C,L,X,null)}#P(R,I){if(!this.#l||!R.groupBy||R.unnest||R.where||String(R.follow||"filtered")==="grouped"||q(R.join)&&R.join.with&&!(R.join.index instanceof Map)||!q(I))return null;const j=Array.isArray(I.updated)?I.updated:null,L=Array.isArray(I.added)?I.added:null,F=Array.isArray(I.removed)?I.removed:null;if(!j&&!L&&!F)return null;const N=this.#a;if(N&&N.size&&String(R.follow||"filtered")!=="all"){if(I.edit===!0&&Array.isArray(I.columns)){for(const S of I.columns)if(N.has(String(S)))return null}for(const S of j||[]){const C=S&&S.key,D=C===void 0?void 0:this.#l.rowData.get(String(C)),G=T(S);for(const X of N)if(h(D,X)!==h(G,X))return null}}return{updated:j||[],added:L||[],removed:F||[]}}#M(R,I){const j=this.#l,L=this.#R(),F=new Set,N=q(I.join)&&I.join.index instanceof Map?I.join:null,S=this.#O(),C=G=>{const X=j.rowGroup.get(G);if(X===void 0)return;F.add(X);const V=j.groups.get(X);if(V&&(V.rows.delete(G),V.rows.size||j.groups.delete(X)),j.rowGroup.delete(G),j.rowData.delete(G),j.leftJoinKey){const J=j.leftJoinKey.get(G);if(J!==void 0){const ee=j.leftByJoinKey.get(J);ee&&(ee.delete(G),ee.size||j.leftByJoinKey.delete(J)),j.leftJoinKey.delete(G)}}},D=G=>{const X=N?r(G,N):G;if(!X)return;const V=L(X),J=b([X],I,L);for(const[ee,te]of J.groups){let ie=j.groups.get(ee);ie||(ie={values:te.values,rows:new Map},j.groups.set(ee,ie)),ie.rows.set(V,X),j.rowGroup.set(V,ee),F.add(ee)}if(j.rowData.set(V,X),S&&j.leftByJoinKey){const ee=n(X,S.left);if(ee!==null){j.leftJoinKey.set(V,ee);let te=j.leftByJoinKey.get(ee);te||(te=new Set,j.leftByJoinKey.set(ee,te)),te.add(V)}}};for(const G of R.removed)C(String(G));for(const G of R.updated)C(String(G.key)),D(T(G));for(const G of R.added)D(T(G));return F}#R(){const R=this.#e,I=R&&R.config&&R.config.rowKey||"id";return j=>String(h(j,typeof I=="string"?I:"id")??"")}#$(){const R=this.#e,I=R&&R.state&&$(R.state.get)?R.state.get():null,j=new Set,L=F=>{if(F){if(Array.isArray(F.conditions)){F.conditions.forEach(L);return}F.col&&j.add(String(F.col))}};return I&&L(I.filters),j}#U(){let R=this.#t;if(R.join&&R.join.with&&(this.#u||this.#v(),R={...R,join:{...R.join,index:this.#u}}),this.#d||String(R.follow||"filtered")!=="grouped")return R;const I=this.#e,j=I&&I.state&&$(I.state.get)?I.state.get():null,L=j&&Array.isArray(j.group)?j.group:[];return L.length?{...R,groupBy:[...L]}:R}#K(){const R=[];for(const I of this.#d)if(I.grid)try{const j=o.includes(String(I.follow))?String(I.follow):"filtered",L=this.#x(I.grid,j);for(const F of L){const N=I.map?I.map(F):F;q(N)&&R.push({...N,[t]:I.label})}}catch(j){x(`source.derived.union.failed.${I.label}`,`source.mode "derived": union source "${I.label}" failed to read (${j&&j.message?j.message:j}) and was skipped this pass.`)}return R}#x(R,I){if(!R||!R.rows)return[];if(I==="all"){const L=[];return $(R.rows.forEachAll)&&R.rows.forEachAll(F=>{F.group||L.push(T(F))}),L}if(I==="selected")return(R.selection&&$(R.selection.rows)?R.selection.rows():[]).filter(Boolean).map(T);const j=[];return $(R.rows.forEach)&&R.rows.forEach(L=>{L.group||j.push(T(L))}),j}#I(){const R=this.#U(),I=this.#K(),j=E(I,R);return R.groupBy?j:s(j)}#Y(){return x("source.derived.union.profile",'source.mode "derived": `profile` is not supported when `from` is a union of several grids (BACKLOG-0001045); profile a single grid instead.'),[]}#F(){const R=this.#e,I=String(this.#t.follow||"filtered");if(!R||!R.rows)return[];if(I==="all"){const F=[];return $(R.rows.forEachAll)&&R.rows.forEachAll(N=>{N.group||F.push(T(N))}),F}if(I==="selected")return(R.selection&&$(R.selection.rows)?R.selection.rows():[]).filter(Boolean).map(T);const j=this.#G(),L=[];return j&&this.#H().length&&$(R.rows.forEachExcept)?(R.rows.forEachExcept(j,F=>{F.group||L.push(T(F))}),L):($(R.rows.forEach)&&R.rows.forEach(F=>{F.group||L.push(T(F))}),L)}#G(){const R=this.#t.crossFilter;if(!R||this.#d)return null;if(typeof R=="string")return R;if(R.col)return String(R.col);const I=this.#t.groupBy,j=Array.isArray(I)?I[0]:I;return j?String(j):null}#H(){const R=this.#G(),I=this.#e;if(!R||!I||!I.filters||!$(I.filters.get))return[];const j=A(I.filters.get(),R);return j?j.op==="in"&&Array.isArray(j.value)?j.value.map(String):j.op==="eq"&&j.value!==void 0?[String(j.value)]:[]:[]}#z(R){const I=this.#G(),j=this.#e;if(!I||!j||!j.filters||!$(j.filters.set))return;const L=this.#s.compute||{},F=$(j.filters.get)?j.filters.get():null,N=$(L.pruneColumn)?L.pruneColumn(F,I):null;if(!R.length){j.filters.set(N||null);return}const S=R.length===1?{col:I,op:"eq",value:R[0]}:{col:I,op:"in",value:R.slice()},C=N?N.conditions&&N.op?N.conditions:[N]:[];j.filters.set(C.length?{op:"and",conditions:[...C,S]}:S)}crossFilter(){const R=this;return{enabled(){return!!R.#G()},column(){return R.#G()},get(){return R.#H()},set(I){const j=I==null?[]:(Array.isArray(I)?I:[I]).map(L=>String(L));R.#z(j)},toggle(I){const j=String(I),L=R.#H(),N=L.indexOf(j)>=0?L.filter(S=>S!==j):[...L,j];R.#z(N)},clear(){R.#z([])}}}#fe(R){const I=R&&R.rows;if(I&&$(I.matchCount)){const j=I.matchCount(),L=Number(j);if(j!==null&&Number.isFinite(L))return L}if(I&&$(I.count)){const j=Number(I.count());if(Number.isFinite(j))return j}return 0}#ne(){const R=this.#e,I=this.#t.statistics;if(!R||!R.statistics||!q(I))return[];switch(String(I.fn)){case"correlation":return this.#pe(R,I);case"series":return this.#Fe(R,I);case"datasetVsDataset":return this.#Oe(R,I);default:return[]}}#pe(R,I){const j=I.columns.filter(Boolean).map(String),L=this.#fe(R),F=(N,S)=>{const C=R.statistics.correlation(N,S);return typeof C=="number"&&Number.isFinite(C)?C:null};if(String(I.orient||"pairs")!=="matrix"){const N=[];for(let S=0;S<j.length;S++)for(let C=S+1;C<j.length;C++)N.push({[i]:`${j[S]}${j[C]}`,a:j[S],b:j[C],coefficient:F(j[S],j[C]),n:L});return N}return j.map(N=>{const S={[i]:N,column:N};for(const C of j)S[C]=N===C?1:F(N,C);return S.n=L,S})}#Fe(R,I){const j=this.#fe(R),L={by:String(I.by)};I.periodsPerYear!==void 0&&(L.periodsPerYear=Number(I.periodsPerYear));const F=R.statistics.series(String(I.of),L)||{};return k.map(N=>({[i]:N,metric:N,value:F[N]??null,n:j}))}#Oe(R,I){const j=I.with,L=Array.isArray(I.columns)?{columns:I.columns.map(String)}:void 0,F=R.statistics.datasetVsDataset(j,L);if(!q(F))return[];const S=(Array.isArray(F.ranked)?F.ranked:[]).map(G=>({[i]:String(G.column),column:G.column,measure:G.measure??null,magnitude:G.magnitude??null,distance:G.distance??null,direction:G.direction??null,nA:G.nA??null,nB:G.nB??null,reliable:G.reliable??null,unmatched:""})),C=F.unmatched,D=[["A",C&&C.onlyA],["B",C&&C.onlyB]];for(const[G,X]of D)for(const V of X||[])S.push({[i]:`${G}${V}`,column:V,measure:null,magnitude:null,distance:null,direction:null,nA:null,nB:null,reliable:!1,unmatched:G});return S}#me(){const R=this.#e;if(!R||!R.statistics||!$(R.statistics.profile))return[];const j=(Array.isArray(this.#t.profile)?this.#t.profile:[this.#t.profile]).filter(Boolean).map(F=>{const N=R.statistics.profile(String(F))||{},S={[i]:String(F)};for(const D of f)S[D]=D==="column"?String(F):N[D]??null;S.outliers=Array.isArray(N.outliers)?N.outliers.length:N.outliers??null;const C=p({...N,rows:S.rows,outliers:S.outliers,numeric:N.numeric},this.#t.alerts);return S.alerts=C.join(", "),S.alertCount=C.length,S});if(this.#t.orient!=="metrics")return j;const L=j[0];return L?f.filter(F=>F!=="column").map(F=>({[i]:F,metric:F,value:L[F]})):[]}apply(R){const I=["add","update","remove"],j=[];for(const L of I)for(const F of R&&R[L]||[])j.push({operation:L,id:F&&F.id,reason:"derived-read-only"});return j.length&&x("source.derived.readonly","a derived grid is read-only: its rows are computed from another grid. Write to the source grid instead, and the derived one follows."),{added:[],updated:[],removed:[],rejected:j}}destroy(){this.#i=!0,this.#r&&(clearTimeout(this.#r),this.#r=null),this.#G()&&this.#H().length&&this.#z([]);for(const R of this.#n)try{R()}catch{}this.#n=[],this.#e=null,this.#d=null,super.destroy()}}function v(_){return q(_)&&_.companion===!0}function y(_,R,I,j=new Set){if(R===_)return I;if(j.has(R))return null;j.add(R);let L=null;try{L=$(R.config)?R.config():null}catch{L=null}const F=L&&q(L.source)?L.source:null;if(!F||F.mode!=="derived")return null;const N=F.from;if(Array.isArray(N)){for(let S=0;S<N.length;S++){const C=c(N[S],S);if(!C.grid||!$(C.grid.on))continue;const D=y(_,C.grid,[...I,C.label],j);if(D)return D}return null}return q(N)&&$(N.on)?y(_,N,[...I,"(from)"],j):null}function T(_){return q(_)&&"data"in _?_.data:_}function A(_,R){if(!_||typeof _!="object")return null;if(Array.isArray(_.conditions)){for(const j of _.conditions){const L=A(j,R);if(L)return L}return null}return _.col===R?_:null}function M(_,R){return new m(_,R)}}),Ue("packages/core/src/source/adapters/odata.js",function(e,H){"use strict";Object.defineProperty(e,"conditionToOData",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"filtersToOData",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"odataAdapter",{enumerable:!0,get:function(){return f}});const $=H("packages/core/src/internal/warn.js").warnOnce,B=H("packages/core/src/source/filterwire.js").isGroup,x=Object.freeze(["eq","ne","gt","gte","lt","lte","contains","startsWith","endsWith","blank","notBlank","between","notBetween"]),Z=/^\d{4}-\d{2}-\d{2}$/,Y=/^\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/,U=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;function W(w){const g=w instanceof Date?w:typeof w=="number"&&Number.isFinite(w)?new Date(w):typeof w=="string"&&U.test(w)?new Date(w):null;return g&&!Number.isNaN(g.getTime())?g:null}const K=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function E(w,g){throw typeof g=="string"&&K.test(g)?new Error(`odataAdapter: "${g}" needs a zone designator to be used as a ${w} 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 ${w} value`)}function O(w){const g=W(w);return g||E("DateTimeOffset",w),g.toISOString()}function b(w){if(typeof w=="string"&&Z.test(w))return w;const g=W(w);return g||E("Date",w),g.toISOString().slice(0,10)}function u(w){if(typeof w=="string"&&Y.test(w))return w.length===5?`${w}:00`:w;if(typeof w=="number"&&Number.isFinite(w)&&w>=0&&w<864e5){const g=Math.floor(w),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(w)}" is not a usable TimeOfDay value`)}const h=Object.freeze({timestamp:O,datetime:O,date:b,dateString:b,time:u}),l=200,r=1e3,n=Object.freeze({eq:"eq",ne:"ne",gt:"gt",gte:"ge",lt:"lt",lte:"le"});function o(w,g){if(w==null)return"null";const k=g&&h[String(g)];return k?k(w):typeof w=="number"||typeof w=="boolean"?String(w):w instanceof Date?w.toISOString():`'${String(w).replace(/'/g,"''")}'`}function i(w){const g=String(w),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 t=Object.freeze({lo:{incl:"ge",excl:"gt"},hi:{incl:"le",excl:"lt"}});function c(w){const g=i(w.col),k=String(w.op),d=w.type;if(n[k])return`${g} ${n[k]} ${o(w.value,d)}`;if(k==="contains")return`contains(${g},${o(w.value,d)})`;if(k==="startsWith")return`startswith(${g},${o(w.value,d)})`;if(k==="endsWith")return`endswith(${g},${o(w.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(w.value)?w.value:[w.value,w.value],m=String(w.bounds||"[]"),v=m.charAt(0)==="("?t.lo.excl:t.lo.incl,y=m.charAt(1)===")"?t.hi.excl:t.hi.incl,T=`(${g} ${v} ${o(p[0],d)} and ${g} ${y} ${o(p[1],d)})`;return k==="between"?T:`(${g} eq null or not ${T})`}return null}function s(w){const g=String(w&&w.op);throw $(`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(w){if(!w)return"";if(!B(w)){const d=c(w);return d===null?s(w):d}const g=String(w.op)==="or"?" or ":" and ",k=(w.conditions||[]).map(d=>{if(B(d))return a(d);const p=c(d);return p===null?s(d):p}).filter(Boolean);return k.length?k.length===1?k[0]:`(${k.join(g)})`:""}function f(w={}){const g=String(w.url||""),k=w.fetch||(typeof fetch=="function"?fetch:null),d=w.count!==!1,p=i(w.key||"id"),m=w.edit===!0;return{name:"odata",capabilities:{filter:"tree",operators:x,sort:"multi",quick:w.search===!0,range:!0,total:d,mutate:m?{update:!0,delete:!0,append:!0,returning:"row"}:!1},urlFor(v){const y=[],T=(M,_)=>y.push(`${M}=${encodeURIComponent(_)}`),A=a(v.filters);return A&&T("$filter",A),v.sort&&v.sort.length&&T("$orderby",v.sort.map(M=>`${i(M.col)}${M.dir==="desc"?" desc":" asc"}`).join(",")),v.range&&(T("$skip",String(v.range.start)),T("$top",String(v.range.end-v.range.start))),v.quick&&T("$search",`"${String(v.quick).replace(/"/g,"")}"`),d&&T("$count","true"),y.length?`${g}?${y.join("&")}`:g},async execute(v,y){if(!k)throw new Error("odataAdapter needs a fetch implementation");const T={Accept:"application/json",...w.headers||{}},A=y&&y.signal,M=async j=>{const L=await k(j,{headers:T,signal:A});if(!L.ok)throw new Error(`OData request failed: ${L.status}`);return L.json()};let _=await M(this.urlFor(v)),R=_.value||_.rows||[];const I=_["@odata.count"]??_.count;if(!v.range){let j=_["@odata.nextLink"];for(;j&&R.length<l*r;)_=await M(j),R=R.concat(_.value||_.rows||[]),j=_["@odata.nextLink"]}return I==null?(d&&$("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:R}):{rows:R,total:Number(I)}},urlForKey(v){return`${g}(${o(v)})`},async mutate(v,y){if(!k)throw new Error("odataAdapter needs a fetch implementation");if(!v||v.kind!=="update"&&v.kind!=="delete"&&v.kind!=="append")throw new Error(`odataAdapter: mutation kind "${v&&v.kind}" is not supported (update, delete and append are wired)`);const T={Accept:"application/json","Content-Type":"application/json",...w.headers||{}},A=y&&y.signal;if(v.kind==="delete"){const j=Array.isArray(v.keys)&&v.keys.length?v.keys[0]:v.key;if(j==null)throw new Error("odataAdapter: a delete needs a row key");const L=await k(this.urlForKey(j),{method:"DELETE",headers:T,signal:A});if(!L.ok)throw new Error(`OData delete failed: ${L.status}`);return{ok:!0}}if(v.kind==="append"){const j=Array.isArray(v.rows)?v.rows.filter(C=>C&&typeof C=="object"):[];if(j.length!==1)throw new Error("odataAdapter: an append needs exactly one row object (OData creates one entity per POST)");const L=await k(g,{method:"POST",headers:T,signal:A,body:JSON.stringify(j[0])});if(!L.ok)throw new Error(`OData add-row failed: ${L.status}`);const F=L.status===204?null:await L.json().catch(()=>null),N=F&&typeof F=="object"&&"value"in F?F.value:F;if(!N||typeof N!="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 S=N[p];if(S==null)throw new Error(`odataAdapter: the created entity carried no ${p} to rekey the appended row by.`);return{ok:!0,keys:[String(S)],rows:[N]}}const M=this.urlForKey(v.key),_=await k(M,{method:"PATCH",headers:T,signal:A,body:JSON.stringify(v.patch||{})});if(!_.ok)throw new Error(`OData update failed: ${_.status}`);if(_.status===204)return{ok:!0};const R=await _.json(),I=R&&typeof R=="object"&&"value"in R?R.value:R;return I==null?{ok:!0}:{ok:!0,rows:[I]}}}}}),Ue("packages/core/src/source/adapters/rest.js",function(e,H){"use strict";Object.defineProperty(e,"DEFAULT_PARAMS",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"DEFAULT_VERBS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"restAdapter",{enumerable:!0,get:function(){return q}});const ne=Object.freeze({offset:"offset",limit:"limit",sort:"sort",order:"order",filter:"filter",search:"q"}),$=Object.freeze({update:"PATCH",delete:"DELETE",append:"POST"});function q(B={}){const x=String(B.url||""),Z=B.fetch||(typeof fetch=="function"?fetch:null),Y={...ne,...B.params||{}},U=B.encodeFilter||(r=>JSON.stringify(r)),W=B.rows||(r=>Array.isArray(r)?r:r.rows||r.data||[]),K=B.total||((r,n)=>Array.isArray(r)?n.length:r.total??r.count??n.length),E=B.edit===!0,O=B.returning==="row"?"row":B.returning==="key"?"key":"none",b=B.keyField||"id",u=B.writeUrlFor||(r=>`${x}/${encodeURIComponent(String(r.key??(r.keys&&r.keys[0])))}`),h=B.encodeMutation||(r=>{const n=$[r.kind];if(r.kind==="update")return{method:n,url:u(r),headers:{"Content-Type":"application/json"},body:JSON.stringify(r.patch||{})};if(r.kind==="append"){const o=Array.isArray(r.rows)?r.rows:r.rows?[r.rows]:[];return{method:n,url:x,headers:{"Content-Type":"application/json"},body:JSON.stringify(o.length===1?o[0]:o)}}return{method:n,url:u(r)}}),l=B.writeRow||(r=>{if(r===null||typeof r!="object")return null;if(Array.isArray(r))return r.length?r[0]:null;const n=r;return n.row??n.data??r});return{name:"rest",capabilities:{range:!0,total:!0,sort:"multi",filter:!1,quick:!1,mutate:E?{update:!0,delete:!0,append:!0,returning:O}:!1,...B.capabilities||{},...B.operators?{filter:"tree",operators:B.operators}:{}},urlFor(r){const n=new URLSearchParams;r.range&&(n.set(Y.offset,String(r.range.start)),n.set(Y.limit,String(r.range.end-r.range.start))),r.sort&&r.sort.length&&(n.set(Y.sort,r.sort.map(i=>i.col).join(",")),n.set(Y.order,r.sort.map(i=>i.dir||"asc").join(","))),r.filters&&n.set(Y.filter,U(r.filters)),r.quick&&n.set(Y.search,String(r.quick));const o=n.toString();return o?`${x}?${o}`:x},async execute(r,n){if(!Z)throw new Error("restAdapter needs a fetch implementation");const o=await Z(this.urlFor(r),{headers:{Accept:"application/json",...B.headers||{}},signal:n&&n.signal});if(!o.ok)throw new Error(`request failed: ${o.status}`);const i=await o.json(),t=W(i);return{rows:t,total:K(i,t)}},writeUrlFor(r){return u(r)},encodeMutation(r){return h(r)},async mutate(r,n){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 o=h(r);if(!o||!o.url||!o.method)throw new Error("restAdapter: encodeMutation must return { method, url }");const i={Accept:"application/json",...B.headers||{},...o.headers||{}},t=await Z(o.url,{method:o.method,headers:i,signal:n&&n.signal,...o.body!==void 0?{body:o.body}:{}});if(!t.ok)throw new Error(`REST ${r.kind} failed: ${t.status}`);if(r.kind==="append"){if(O==="none")return{ok:!0};if(t.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 t.json(),f=l(a),w=f&&typeof f=="object"?f[b]:void 0;if(w==null)throw new Error(`restAdapter: the add-row response carried no ${b} to rekey the appended row by. Point \`keyField\` at the primary key the endpoint returns, or override \`writeRow\`.`);return O==="row"?{ok:!0,keys:[String(w)],rows:[f]}:{ok:!0,keys:[String(w)]}}if(O!=="row"||t.status===204)return{ok:!0};const c=await t.json(),s=l(c);return s==null?{ok:!0}:{ok:!0,rows:[s]}}}}}),Ue("packages/core/src/source/adapters/dfql.js",function(e,H){"use strict";Object.defineProperty(e,"DFQL_BASE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DFQL_WRITE_URL",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"dfqlAdapter",{enumerable:!0,get:function(){return E}});const $=H("packages/core/src/internal/predicates.js").isFunction,B=H("packages/core/src/internal/warn.js").warnOnce,x="https://rest.demandflow.com",Z="https://stream.demandflow.com/dfql",Y=Object.freeze(["id","created","updated","ownerId","entity"]);function U(O){const b={},u=[];for(const[h,l]of Object.entries(O||{})){if(Y.includes(h)){u.push(h);continue}b[h]=l}return u.length&&B("source.dfql.protected",`a DFQL update tried to write protected field(s) ${u.join(", ")}; they are server-assigned and immutable, so they were dropped from the PATCH.`),b}function W(O){if(!O||typeof O!="object"||Array.isArray(O))return["fields (must be an object)"];const b=O,u=[];return(typeof b.entity!="string"||!b.entity)&&u.push("entity (uppercase code)"),Number.isFinite(Number(b.level))||u.push("level (numeric)"),(typeof b.comboKey!="string"||!b.comboKey.endsWith("|ENT:"))&&u.push("comboKey (a string ending '|ENT:')"),u}async function K(O){const b=[],u=n=>{const o=n.trim();if(o)try{b.push(JSON.parse(o))}catch{}};if(!O.body||typeof O.body.getReader!="function")return(await O.text()).split(`
|